=0?fl?(e-a)*(e-a)+(t-i)*(t-i):u-d},xn=function(e,t,n){for(var r,a,i,o,s=0,l=0;l=e&&e>=i||r<=e&&e<=i))continue;(e-r)/(i-r)*(o-a)+a>t&&s++}return s%2!=0},wn=function(e,t,n,r,a,i,o,s,l){var u,c=new Array(n.length);null!=s[0]?(u=Math.atan(s[1]/s[0]),s[0]<0?u+=Math.PI/2:u=-u-Math.PI/2):u=s;for(var d,h=Math.cos(-u),f=Math.sin(-u),p=0;p0){var v=kn(c,-l);d=En(v)}else d=c;return xn(e,t,d)},En=function(e){for(var t,n,r,a,i,o,s,l,u=new Array(e.length/2),c=0;c=0&&p<=1&&g.push(p),v>=0&&v<=1&&g.push(v),0===g.length)return[];var y=g[0]*s[0]+e,m=g[0]*s[1]+t;return g.length>1?g[0]==g[1]?[y,m]:[y,m,g[1]*s[0]+e,g[1]*s[1]+t]:[y,m]},Pn=function(e,t,n){return t<=e&&e<=n||n<=e&&e<=t?e:e<=t&&t<=n||n<=t&&t<=e?t:n},Sn=function(e,t,n,r,a,i,o,s,l){var u=e-a,c=n-e,d=o-a,h=t-i,f=r-t,p=s-i,v=d*h-p*u,g=c*h-f*u,y=p*c-d*f;if(0!==y){var m=v/y,b=g/y,x=-.001;return x<=m&&m<=1.001&&x<=b&&b<=1.001||l?[e+m*c,t+m*f]:[]}return 0===v||0===g?Pn(e,n,o)===o?[o,s]:Pn(e,n,a)===a?[a,i]:Pn(a,o,n)===n?[n,r]:[]:[]},Bn=function(e,t,n,r,a){var i=[],o=r/2,s=a/2,l=t,u=n;i.push({x:l+o*e[0],y:u+s*e[1]});for(var c=1;c0){var m=kn(v,-s);u=En(m)}else u=v}else u=n;for(var b=0;bu&&(u=t)},d=function(e){return l[e]},h=0;h0?b.edgesTo(m)[0]:m.edgesTo(b)[0];var w=r(x);m=m.id(),u[m]>u[v]+w&&(u[m]=u[v]+w,h.nodes.indexOf(m)<0?h.push(m):h.updateItem(m),l[m]=0,n[m]=[]),u[m]==u[v]+w&&(l[m]=l[m]+l[v],n[m].push(v))}else for(var E=0;E0;){for(var P=t.pop(),S=0;S0&&o.push(n[s]);0!==o.length&&a.push(r.collection(o))}return a}(c,l,t,r);return b=function(e){for(var t=0;t5&&void 0!==arguments[5]?arguments[5]:nr,o=r,s=0;s=2?lr(e,t,n,0,ir,or):lr(e,t,n,0,ar)},squaredEuclidean:function(e,t,n){return lr(e,t,n,0,ir)},manhattan:function(e,t,n){return lr(e,t,n,0,ar)},max:function(e,t,n){return lr(e,t,n,-1/0,sr)}};function cr(e,t,n,r,a,i){var o;return o=G(e)?e:ur[e]||ur.euclidean,0===t&&G(e)?o(a,i):o(t,n,r,a,i)}ur["squared-euclidean"]=ur.squaredEuclidean,ur.squaredeuclidean=ur.squaredEuclidean;var dr=ht({k:2,m:2,sensitivityThreshold:1e-4,distance:"euclidean",maxIterations:10,attributes:[],testMode:!1,testCentroids:null}),hr=function(e){return dr(e)},fr=function(e,t,n,r,a){var i="kMedoids"!==a?function(e){return n[e]}:function(e){return r[e](n)},o=n,s=t;return cr(e,r.length,i,function(e){return r[e](t)},o,s)},pr=function(e,t,n){for(var r=n.length,a=new Array(r),i=new Array(r),o=new Array(t),s=null,l=0;ln)return!1}return!0},br=function(e,t,n){for(var r=0;ra&&(a=t[l][u],i=u);o[i].push(e[l])}for(var c=0;c=a.threshold||"dendrogram"===a.mode&&1===e.length)return!1;var f,p=t[o],v=t[r[o]];f="dendrogram"===a.mode?{left:p,right:v,key:p.key}:{value:p.value.concat(v.value),key:p.key},e[p.index]=f,e.splice(v.index,1),t[p.key]=f;for(var g=0;gn[v.key][y.key]&&(i=n[v.key][y.key])):"max"===a.linkage?(i=n[p.key][y.key],n[p.key][y.key]1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:e.length,r=!(arguments.length>4&&void 0!==arguments[4])||arguments[4],a=!(arguments.length>5&&void 0!==arguments[5])||arguments[5];arguments.length>3&&void 0!==arguments[3]&&!arguments[3]?(n0&&e.splice(0,t)):e=e.slice(t,n);for(var i=0,o=e.length-1;o>=0;o--){var s=e[o];a?isFinite(s)||(e[o]=-1/0,i++):e.splice(o,1)}r&&e.sort(function(e,t){return e-t});var l=e.length,u=Math.floor(l/2);return l%2!=0?e[u+1+i]:(e[u-1+i]+e[u+i])/2}(e):"mean"===t?function(e){for(var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:e.length,r=0,a=0,i=t;i1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:e.length,r=1/0,a=t;a1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:e.length,r=-1/0,a=t;ao&&(i=l,o=t[a*e+l])}i>0&&r.push(i)}for(var u=0;u=P?(S=P,P=D,B=_):D>S&&(S=D);for(var A=0;A0?1:0;k[E%u.minIterations*t+z]=O,L+=O}if(L>0&&(E>=u.minIterations-1||E==u.maxIterations-1)){for(var V=0,F=0;F0&&r.push(a);return r}(t,i,o),Y=function(e,t,n){for(var r=zr(e,t,n),a=0;al&&(s=u,l=c)}n[a]=i[s]}return zr(e,t,n)}(t,r,j),q={},W=0;W1||o>1)&&(u=!0),c[t]=[],e.outgoers().forEach(function(e){e.isEdge()&&c[t].push(e.id())})}else d[t]=[void 0,e.target().id()]}):l.forEach(function(e){var t=e.id();e.isNode()?(e.degree(!0)%2&&(n?r?u=!0:r=t:n=t),c[t]=[],e.connectedEdges().forEach(function(e){return c[t].push(e.id())})):d[t]=[e.source().id(),e.target().id()]});var h={found:!1,trail:void 0};if(u)return h;if(r&&n)if(s){if(a&&r!=a)return h;a=r}else{if(a&&r!=a&&n!=a)return h;a||(a=r)}else a||(a=l[0].id());var f=function(e){for(var t,n,r,a=e,i=[e];c[a].length;)t=c[a].shift(),n=d[t][0],a!=(r=d[t][1])?(c[r]=c[r].filter(function(e){return e!=t}),a=r):s||a==n||(c[n]=c[n].filter(function(e){return e!=t}),a=n),i.unshift(t),i.unshift(a);return i},p=[],v=[];for(v=f(a);1!=v.length;)0==c[v[0]].length?(p.unshift(l.getElementById(v.shift())),p.unshift(l.getElementById(v.shift()))):v=f(v.shift()).concat(v);for(var g in p.unshift(l.getElementById(v.shift())),c)if(c[g].length)return h;return h.found=!0,h.trail=this.spawn(p,!0),h}},jr=function(){var e=this,t={},n=0,r=0,a=[],i=[],o={},s=function(l,u,c){l===c&&(r+=1),t[u]={id:n,low:n++,cutVertex:!1};var d,h,f,p,v=e.getElementById(u).connectedEdges().intersection(e);0===v.size()?a.push(e.spawn(e.getElementById(u))):v.forEach(function(n){d=n.source().id(),h=n.target().id(),(f=d===u?h:d)!==c&&(p=n.id(),o[p]||(o[p]=!0,i.push({x:u,y:f,edge:n})),f in t?t[u].low=Math.min(t[u].low,t[f].id):(s(l,f,u),t[u].low=Math.min(t[u].low,t[f].low),t[u].id<=t[f].low&&(t[u].cutVertex=!0,function(n,r){for(var o=i.length-1,s=[],l=e.spawn();i[o].x!=n||i[o].y!=r;)s.push(i.pop().edge),o--;s.push(i.pop().edge),s.forEach(function(n){var r=n.connectedNodes().intersection(e);l.merge(n),r.forEach(function(n){var r=n.id(),a=n.connectedEdges().intersection(e);l.merge(n),t[r].cutVertex?l.merge(a.filter(function(e){return e.isLoop()})):l.merge(a)})}),a.push(l)}(u,f))))})};e.forEach(function(e){if(e.isNode()){var n=e.id();n in t||(r=0,s(n,n),t[n].cutVertex=r>1)}});var l=Object.keys(t).filter(function(e){return t[e].cutVertex}).map(function(t){return e.getElementById(t)});return{cut:e.spawn(l),components:a}},Yr=function(){var e=this,t={},n=0,r=[],a=[],i=e.spawn(e),o=function(s){if(a.push(s),t[s]={index:n,low:n++,explored:!1},e.getElementById(s).connectedEdges().intersection(e).forEach(function(e){var n=e.target().id();n!==s&&(n in t||o(n),t[n].explored||(t[s].low=Math.min(t[s].low,t[n].low)))}),t[s].index===t[s].low){for(var l=e.spawn();;){var u=a.pop();if(l.merge(e.getElementById(u)),t[u].low=t[s].index,t[u].explored=!0,u===s)break}var c=l.edgesWith(l),d=l.merge(c);r.push(d),i=i.difference(d)}};return e.forEach(function(e){if(e.isNode()){var n=e.id();n in t||o(n)}}),{cut:i,components:r}},qr={};[Et,Mt,Rt,Nt,zt,Vt,Yt,Vn,Xn,Yn,Wn,tr,Cr,Rr,Vr,Xr,{hopcroftTarjanBiconnected:jr,htbc:jr,htb:jr,hopcroftTarjanBiconnectedComponents:jr},{tarjanStronglyConnected:Yr,tsc:Yr,tscc:Yr,tarjanStronglyConnectedComponents:Yr}].forEach(function(e){be(qr,e)});var Wr=function(e){if(!(this instanceof Wr))return new Wr(e);this.id="Thenable/1.0.7",this.state=0,this.fulfillValue=void 0,this.rejectReason=void 0,this.onFulfilled=[],this.onRejected=[],this.proxy={then:this.then.bind(this)},"function"==typeof e&&e.call(this,this.fulfill.bind(this),this.reject.bind(this))};Wr.prototype={fulfill:function(e){return Ur(this,1,"fulfillValue",e)},reject:function(e){return Ur(this,2,"rejectReason",e)},then:function(e,t){var n=this,r=new Wr;return n.onFulfilled.push(Gr(e,r,"fulfill")),n.onRejected.push(Gr(t,r,"reject")),Hr(n),r.proxy}};var Ur=function(e,t,n,r){return 0===e.state&&(e.state=t,e[n]=r,Hr(e)),e},Hr=function(e){1===e.state?Kr(e,"onFulfilled",e.fulfillValue):2===e.state&&Kr(e,"onRejected",e.rejectReason)},Kr=function(e,t,n){if(0!==e[t].length){var r=e[t];e[t]=[];var a=function(){for(var e=0;e0:void 0}},clearQueue:function(){return function(){var e=this,t=void 0!==e.length?e:[e];if(!(this._private.cy||this).styleEnabled())return this;for(var n=0;n-1}}(),a=function(){if(Wa)return qa;Wa=1;var e=Fi();return qa=function(t,n){var r=this.__data__,a=e(r,t);return a<0?(++this.size,r.push([t,n])):r[a][1]=n,this},qa}();function i(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t-1&&t%1==0&&t0&&this.spawn(r).updateStyle().emit("class"),t},addClass:function(e){return this.toggleClass(e,!0)},hasClass:function(e){var t=this[0];return null!=t&&t._private.classes.has(e)},toggleClass:function(e,t){Z(e)||(e=e.match(/\S+/g)||[]);for(var n=this,r=void 0===t,a=[],i=0,o=n.length;i0&&this.spawn(a).updateStyle().emit("class"),n},removeClass:function(e){return this.toggleClass(e,!1)},flashClass:function(e,t){var n=this;if(null==t)t=250;else if(0===t)return n;return n.addClass(e),setTimeout(function(){n.removeClass(e)},t),n}};Po.className=Po.classNames=Po.classes;var So={metaChar:"[\\!\\\"\\#\\$\\%\\&\\'\\(\\)\\*\\+\\,\\.\\/\\:\\;\\<\\=\\>\\?\\@\\[\\]\\^\\`\\{\\|\\}\\~]",comparatorOp:"=|\\!=|>|>=|<|<=|\\$=|\\^=|\\*=",boolOp:"\\?|\\!|\\^",string:"\"(?:\\\\\"|[^\"])*\"|'(?:\\\\'|[^'])*'",number:fe,meta:"degree|indegree|outdegree",separator:"\\s*,\\s*",descendant:"\\s+",child:"\\s+>\\s+",subject:"\\$",group:"node|edge|\\*",directedEdge:"\\s+->\\s+",undirectedEdge:"\\s+<->\\s+"};So.variable="(?:[\\w-.]|(?:\\\\"+So.metaChar+"))+",So.className="(?:[\\w-]|(?:\\\\"+So.metaChar+"))+",So.value=So.string+"|"+So.number,So.id=So.variable,function(){var e,t,n;for(e=So.comparatorOp.split("|"),n=0;n=0||"="!==t&&(So.comparatorOp+="|\\!"+t)}();var Bo=0,Do=1,_o=2,Ao=3,Mo=4,Ro=5,Io=6,No=7,Lo=8,zo=9,Oo=10,Vo=11,Fo=12,Xo=13,jo=14,Yo=15,qo=16,Wo=17,Uo=18,Ho=19,Ko=20,Go=[{selector:":selected",matches:function(e){return e.selected()}},{selector:":unselected",matches:function(e){return!e.selected()}},{selector:":selectable",matches:function(e){return e.selectable()}},{selector:":unselectable",matches:function(e){return!e.selectable()}},{selector:":locked",matches:function(e){return e.locked()}},{selector:":unlocked",matches:function(e){return!e.locked()}},{selector:":visible",matches:function(e){return e.visible()}},{selector:":hidden",matches:function(e){return!e.visible()}},{selector:":transparent",matches:function(e){return e.transparent()}},{selector:":grabbed",matches:function(e){return e.grabbed()}},{selector:":free",matches:function(e){return!e.grabbed()}},{selector:":removed",matches:function(e){return e.removed()}},{selector:":inside",matches:function(e){return!e.removed()}},{selector:":grabbable",matches:function(e){return e.grabbable()}},{selector:":ungrabbable",matches:function(e){return!e.grabbable()}},{selector:":animated",matches:function(e){return e.animated()}},{selector:":unanimated",matches:function(e){return!e.animated()}},{selector:":parent",matches:function(e){return e.isParent()}},{selector:":childless",matches:function(e){return e.isChildless()}},{selector:":child",matches:function(e){return e.isChild()}},{selector:":orphan",matches:function(e){return e.isOrphan()}},{selector:":nonorphan",matches:function(e){return e.isChild()}},{selector:":compound",matches:function(e){return e.isNode()?e.isParent():e.source().isParent()||e.target().isParent()}},{selector:":loop",matches:function(e){return e.isLoop()}},{selector:":simple",matches:function(e){return e.isSimple()}},{selector:":active",matches:function(e){return e.active()}},{selector:":inactive",matches:function(e){return!e.active()}},{selector:":backgrounding",matches:function(e){return e.backgrounding()}},{selector:":nonbackgrounding",matches:function(e){return!e.backgrounding()}}].sort(function(e,t){return function(e,t){return-1*me(e,t)}(e.selector,t.selector)}),Zo=function(){for(var e,t={},n=0;n0&&u.edgeCount>0)return st("The selector `"+e+"` is invalid because it uses both a compound selector and an edge selector"),!1;if(u.edgeCount>1)return st("The selector `"+e+"` is invalid because it uses multiple edge selectors"),!1;1===u.edgeCount&&st("The selector `"+e+"` 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},toString:function(){if(null!=this.toStringCache)return this.toStringCache;for(var e=function(e){return null==e?"":e},t=function(t){return K(t)?'"'+t+'"':e(t)},n=function(e){return" "+e+" "},r=function(r,i){var o=r.type,s=r.value;switch(o){case Bo:var l=e(s);return l.substring(0,l.length-1);case Ao:var u=r.field,c=r.operator;return"["+u+n(e(c))+t(s)+"]";case Ro:var d=r.operator,h=r.field;return"["+e(d)+h+"]";case Mo:return"["+r.field+"]";case Io:var f=r.operator;return"[["+r.field+n(e(f))+t(s)+"]]";case No:return s;case Lo:return"#"+s;case zo:return"."+s;case Wo:case Yo:return a(r.parent,i)+n(">")+a(r.child,i);case Uo:case qo:return a(r.ancestor,i)+" "+a(r.descendant,i);case Ho:var p=a(r.left,i),v=a(r.subject,i),g=a(r.right,i);return p+(p.length>0?" ":"")+v+g;case Ko:return""}},a=function(e,t){return e.checks.reduce(function(n,a,i){return n+(t===e&&0===i?"$":"")+r(a,t)},"")},i="",o=0;o1&&o=0&&(t=t.replace("!",""),c=!0),t.indexOf("@")>=0&&(t=t.replace("@",""),u=!0),(o||l||u)&&(a=o||s?""+e:"",i=""+n),u&&(e=a=a.toLowerCase(),n=i=i.toLowerCase()),t){case"*=":r=a.indexOf(i)>=0;break;case"$=":r=a.indexOf(i,a.length-i.length)>=0;break;case"^=":r=0===a.indexOf(i);break;case"=":r=e===n;break;case">":d=!0,r=e>n;break;case">=":d=!0,r=e>=n;break;case"<":d=!0,r=e0;){var u=a.shift();t(u),i.add(u.id()),o&&r(a,i,u)}return e}function gs(e,t,n){if(n.isParent())for(var r=n._private.children,a=0;a1&&void 0!==arguments[1])||arguments[1],gs)},ps.forEachUp=function(e){return vs(this,e,!(arguments.length>1&&void 0!==arguments[1])||arguments[1],ys)},ps.forEachUpAndDown=function(e){return vs(this,e,!(arguments.length>1&&void 0!==arguments[1])||arguments[1],ms)},ps.ancestors=ps.parents,(ds=hs={data:To.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:To.removeData({field:"data",event:"data",triggerFnName:"trigger",triggerEvent:!0,immutableKeys:{id:!0,source:!0,target:!0,parent:!0},updateStyle:!0}),scratch:To.data({field:"scratch",bindingEvent:"scratch",allowBinding:!0,allowSetting:!0,settingEvent:"scratch",settingTriggersEvent:!0,triggerFnName:"trigger",allowGetting:!0,updateStyle:!0}),removeScratch:To.removeData({field:"scratch",event:"scratch",triggerFnName:"trigger",triggerEvent:!0,updateStyle:!0}),rscratch:To.data({field:"rscratch",allowBinding:!1,allowSetting:!0,settingTriggersEvent:!1,allowGetting:!0}),removeRscratch:To.removeData({field:"rscratch",triggerEvent:!1}),id:function(){var e=this[0];if(e)return e._private.data.id}}).attr=ds.data,ds.removeAttr=ds.removeData;var bs,xs,ws=hs,Es={};function ks(e){return function(t){var n=this;if(void 0===t&&(t=!0),0!==n.length&&n.isNode()&&!n.removed()){for(var r=0,a=n[0],i=a._private.edges,o=0;ot}),minIndegree:Ts("indegree",function(e,t){return et}),minOutdegree:Ts("outdegree",function(e,t){return et})}),be(Es,{totalDegree:function(e){for(var t=0,n=this.nodes(),r=0;r0,c=u;u&&(l=l[0]);var d=c?l.position():{x:0,y:0};return a={x:s.x-d.x,y:s.y-d.y},void 0===e?a:a[e]}for(var h=0;h0,g=v;v&&(p=p[0]);var y=g?p.position():{x:0,y:0};void 0!==t?f.position(e,t+y[e]):void 0!==a&&f.position({x:a.x+y.x,y:a.y+y.y})}}else if(!i)return;return this}},bs.modelPosition=bs.point=bs.position,bs.modelPositions=bs.points=bs.positions,bs.renderedPoint=bs.renderedPosition,bs.relativePoint=bs.relativePosition;var Ss,Bs,Ds=xs;Ss=Bs={},Bs.renderedBoundingBox=function(e){var t=this.boundingBox(e),n=this.cy(),r=n.zoom(),a=n.pan(),i=t.x1*r+a.x,o=t.x2*r+a.x,s=t.y1*r+a.y,l=t.y2*r+a.y;return{x1:i,x2:o,y1:s,y2:l,w:o-i,h:l-s}},Bs.dirtyCompoundBoundsCache=function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=this.cy();return t.styleEnabled()&&t.hasCompoundNodes()?(this.forEachUp(function(t){if(t.isParent()){var n=t._private;n.compoundBoundsClean=!1,n.bbCache=null,e||t.emitAndNotify("bounds")}}),this):this},Bs.updateCompoundBounds=function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=this.cy();if(!t.styleEnabled()||!t.hasCompoundNodes())return this;if(!e&&t.batching())return this;function n(e){if(e.isParent()){var t=e._private,n=e.children(),r="include"===e.pstyle("compound-sizing-wrt-labels").value,a={width:{val:e.pstyle("min-width").pfValue,left:e.pstyle("min-width-bias-left"),right:e.pstyle("min-width-bias-right")},height:{val:e.pstyle("min-height").pfValue,top:e.pstyle("min-height-bias-top"),bottom:e.pstyle("min-height-bias-bottom")}},i=n.boundingBox({includeLabels:r,includeOverlays:!1,useCache:!1}),o=t.position;0!==i.w&&0!==i.h||((i={w:e.pstyle("width").pfValue,h:e.pstyle("height").pfValue}).x1=o.x-i.w/2,i.x2=o.x+i.w/2,i.y1=o.y-i.h/2,i.y2=o.y+i.h/2);var s=a.width.left.value;"px"===a.width.left.units&&a.width.val>0&&(s=100*s/a.width.val);var l=a.width.right.value;"px"===a.width.right.units&&a.width.val>0&&(l=100*l/a.width.val);var u=a.height.top.value;"px"===a.height.top.units&&a.height.val>0&&(u=100*u/a.height.val);var c=a.height.bottom.value;"px"===a.height.bottom.units&&a.height.val>0&&(c=100*c/a.height.val);var d=y(a.width.val-i.w,s,l),h=d.biasDiff,f=d.biasComplementDiff,p=y(a.height.val-i.h,u,c),v=p.biasDiff,g=p.biasComplementDiff;t.autoPadding=function(e,t,n,r){if("%"!==n.units)return"px"===n.units?n.pfValue:0;switch(r){case"width":return e>0?n.pfValue*e:0;case"height":return t>0?n.pfValue*t:0;case"average":return e>0&&t>0?n.pfValue*(e+t)/2:0;case"min":return e>0&&t>0?e>t?n.pfValue*t:n.pfValue*e:0;case"max":return e>0&&t>0?e>t?n.pfValue*e:n.pfValue*t:0;default:return 0}}(i.w,i.h,e.pstyle("padding"),e.pstyle("padding-relative-to").value),t.autoWidth=Math.max(i.w,a.width.val),o.x=(-h+i.x1+i.x2+f)/2,t.autoHeight=Math.max(i.h,a.height.val),o.y=(-v+i.y1+i.y2+g)/2}function y(e,t,n){var r=0,a=0,i=t+n;return e>0&&i>0&&(r=t/i*e,a=n/i*e),{biasDiff:r,biasComplementDiff:a}}}for(var r=0;re.x2?r:e.x2,e.y1=ne.y2?a:e.y2,e.w=e.x2-e.x1,e.h=e.y2-e.y1)},Ms=function(e,t){return null==t?e:As(e,t.x1,t.y1,t.x2,t.y2)},Rs=function(e,t,n){return vt(e,t,n)},Is=function(e,t,n){if(!t.cy().headless()){var r,a,i=t._private,o=i.rstyle,s=o.arrowWidth/2;if("none"!==t.pstyle(n+"-arrow-shape").value){"source"===n?(r=o.srcX,a=o.srcY):"target"===n?(r=o.tgtX,a=o.tgtY):(r=o.midX,a=o.midY);var l=i.arrowBounds=i.arrowBounds||{},u=l[n]=l[n]||{};u.x1=r-s,u.y1=a-s,u.x2=r+s,u.y2=a+s,u.w=u.x2-u.x1,u.h=u.y2-u.y1,on(u,1),As(e,u.x1,u.y1,u.x2,u.y2)}}},Ns=function(e,t,n){if(!t.cy().headless()){var r;r=n?n+"-":"";var a=t._private,i=a.rstyle;if(t.pstyle(r+"label").strValue){var o,s,l,u,c=t.pstyle("text-halign"),d=t.pstyle("text-valign"),h=Rs(i,"labelWidth",n),f=Rs(i,"labelHeight",n),p=Rs(i,"labelX",n),v=Rs(i,"labelY",n),g=t.pstyle(r+"text-margin-x").pfValue,y=t.pstyle(r+"text-margin-y").pfValue,m=t.isEdge(),b=t.pstyle(r+"text-rotation"),x=t.pstyle("text-outline-width").pfValue,w=t.pstyle("text-border-width").pfValue/2,E=t.pstyle("text-background-padding").pfValue,k=f,T=h,C=T/2,P=k/2;if(m)o=p-C,s=p+C,l=v-P,u=v+P;else{switch(c.value){case"left":o=p-T,s=p;break;case"center":o=p-C,s=p+C;break;case"right":o=p,s=p+T}switch(d.value){case"top":l=v-k,u=v;break;case"center":l=v-P,u=v+P;break;case"bottom":l=v,u=v+k}}var S=g-Math.max(x,w)-E-2,B=g+Math.max(x,w)+E+2,D=y-Math.max(x,w)-E-2,_=y+Math.max(x,w)+E+2;o+=S,s+=B,l+=D,u+=_;var A=n||"main",M=a.labelBounds,R=M[A]=M[A]||{};R.x1=o,R.y1=l,R.x2=s,R.y2=u,R.w=s-o,R.h=u-l,R.leftPad=S,R.rightPad=B,R.topPad=D,R.botPad=_;var I=m&&"autorotate"===b.strValue,N=null!=b.pfValue&&0!==b.pfValue;if(I||N){var L=I?Rs(a.rstyle,"labelAngle",n):b.pfValue,z=Math.cos(L),O=Math.sin(L),V=(o+s)/2,F=(l+u)/2;if(!m){switch(c.value){case"left":V=s;break;case"right":V=o}switch(d.value){case"top":F=u;break;case"bottom":F=l}}var X=function(e,t){return{x:(e-=V)*z-(t-=F)*O+V,y:e*O+t*z+F}},j=X(o,l),Y=X(o,u),q=X(s,l),W=X(s,u);o=Math.min(j.x,Y.x,q.x,W.x),s=Math.max(j.x,Y.x,q.x,W.x),l=Math.min(j.y,Y.y,q.y,W.y),u=Math.max(j.y,Y.y,q.y,W.y)}var U=A+"Rot",H=M[U]=M[U]||{};H.x1=o,H.y1=l,H.x2=s,H.y2=u,H.w=s-o,H.h=u-l,As(e,o,l,s,u),As(a.labelBounds.all,o,l,s,u)}return e}},Ls=function(e,t){if(!t.cy().headless()){var n=t.pstyle("outline-opacity").value,r=t.pstyle("outline-width").value+t.pstyle("outline-offset").value;zs(e,t,n,r,"outside",r/2)}},zs=function(e,t,n,r,a,i){if(!(0===n||r<=0||"inside"===a)){var o=t.cy().renderer(),s=o.nodeShapes[o.getNodeShape(t)];if(s){var l=t.position(),u=l.x,c=l.y,d=t.width(),h=t.height();if(s.hasMiterBounds){"center"===a&&(r/=2);var f=s.miterBounds(u,c,d,h,r);Ms(e,f)}else null!=i&&i>0&&sn(e,[i,i,i,i])}}},Os=function(e,t){var n,r,a,i,o,s,l,u=e._private.cy,c=u.styleEnabled(),d=u.headless(),h=nn(),f=e._private,p=e.isNode(),v=e.isEdge(),g=f.rstyle,y=p&&c?e.pstyle("bounds-expansion").pfValue:[0],m=function(e){return"none"!==e.pstyle("display").value},b=!c||m(e)&&(!v||m(e.source())&&m(e.target()));if(b){var x=0;c&&t.includeOverlays&&0!==e.pstyle("overlay-opacity").value&&(x=e.pstyle("overlay-padding").value);var w=0;c&&t.includeUnderlays&&0!==e.pstyle("underlay-opacity").value&&(w=e.pstyle("underlay-padding").value);var E=Math.max(x,w),k=0;if(c&&(k=e.pstyle("width").pfValue/2),p&&t.includeNodes){var T=e.position();o=T.x,s=T.y;var C=e.outerWidth()/2,P=e.outerHeight()/2;As(h,n=o-C,a=s-P,r=o+C,i=s+P),c&&Ls(h,e),c&&t.includeOutlines&&!d&&Ls(h,e),c&&function(e,t){if(!t.cy().headless()){var n=t.pstyle("border-opacity").value,r=t.pstyle("border-width").pfValue,a=t.pstyle("border-position").value;zs(e,t,n,r,a)}}(h,e)}else if(v&&t.includeEdges)if(c&&!d){var S=e.pstyle("curve-style").strValue;if(n=Math.min(g.srcX,g.midX,g.tgtX),r=Math.max(g.srcX,g.midX,g.tgtX),a=Math.min(g.srcY,g.midY,g.tgtY),i=Math.max(g.srcY,g.midY,g.tgtY),As(h,n-=k,a-=k,r+=k,i+=k),"haystack"===S){var B=g.haystackPts;if(B&&2===B.length){if(n=B[0].x,a=B[0].y,n>(r=B[1].x)){var D=n;n=r,r=D}if(a>(i=B[1].y)){var _=a;a=i,i=_}As(h,n-k,a-k,r+k,i+k)}}else if("bezier"===S||"unbundled-bezier"===S||he(S,"segments")||he(S,"taxi")){var A;switch(S){case"bezier":case"unbundled-bezier":A=g.bezierPts;break;case"segments":case"taxi":case"round-segments":case"round-taxi":A=g.linePts}if(null!=A)for(var M=0;M(r=N.x)){var L=n;n=r,r=L}if((a=I.y)>(i=N.y)){var z=a;a=i,i=z}As(h,n-=k,a-=k,r+=k,i+=k)}if(c&&t.includeEdges&&v&&(Is(h,e,"mid-source"),Is(h,e,"mid-target"),Is(h,e,"source"),Is(h,e,"target")),c)if("yes"===e.pstyle("ghost").value){var O=e.pstyle("ghost-offset-x").pfValue,V=e.pstyle("ghost-offset-y").pfValue;As(h,h.x1+O,h.y1+V,h.x2+O,h.y2+V)}var F=f.bodyBounds=f.bodyBounds||{};ln(F,h),sn(F,y),on(F,1),c&&(n=h.x1,r=h.x2,a=h.y1,i=h.y2,As(h,n-E,a-E,r+E,i+E));var X=f.overlayBounds=f.overlayBounds||{};ln(X,h),sn(X,y),on(X,1);var j=f.labelBounds=f.labelBounds||{};null!=j.all?((l=j.all).x1=1/0,l.y1=1/0,l.x2=-1/0,l.y2=-1/0,l.w=0,l.h=0):j.all=nn(),c&&t.includeLabels&&(t.includeMainLabels&&Ns(h,e,null),v&&(t.includeSourceLabels&&Ns(h,e,"source"),t.includeTargetLabels&&Ns(h,e,"target")))}return h.x1=_s(h.x1),h.y1=_s(h.y1),h.x2=_s(h.x2),h.y2=_s(h.y2),h.w=_s(h.x2-h.x1),h.h=_s(h.y2-h.y1),h.w>0&&h.h>0&&b&&(sn(h,y),on(h,1)),h},Vs=function(e){var t=0,n=function(e){return(e?1:0)<0&&void 0!==arguments[0]?arguments[0]:il,t=arguments.length>1?arguments[1]:void 0,n=0;n=0;s--)o(s);return this},sl.removeAllListeners=function(){return this.removeListener("*")},sl.emit=sl.trigger=function(e,t,n){var r=this.listeners,a=r.length;return this.emitting++,Z(t)||(t=[t]),cl(this,function(e,i){null!=n&&(r=[{event:i.event,type:i.type,namespace:i.namespace,callback:n}],a=r.length);for(var o=function(){var n=r[s];if(n.type===i.type&&(!n.namespace||n.namespace===i.namespace||".*"===n.namespace)&&e.eventMatches(e.context,n,i)){var a=[i];null!=t&&function(e,t){for(var n=0;n1&&!r){var a=this.length-1,i=this[a],o=i._private.data.id;this[a]=void 0,this[e]=i,n.set(o,{ele:i,index:e})}return this.length--,this},unmergeOne:function(e){e=e[0];var t=this._private,n=e._private.data.id,r=t.map.get(n);if(!r)return this;var a=r.index;return this.unmergeAt(a),this},unmerge:function(e){var t=this._private.cy;if(!e)return this;if(e&&K(e)){var n=e;e=t.mutableElements().filter(n)}for(var r=0;r=0;t--){e(this[t])&&this.unmergeAt(t)}return this},map:function(e,t){for(var n=[],r=this,a=0;ar&&(r=s,n=o)}return{value:r,ele:n}},min:function(e,t){for(var n,r=1/0,a=this,i=0;i=0&&a1&&void 0!==arguments[1])||arguments[1],n=this[0],r=n.cy();if(r.styleEnabled()&&n){n._private.styleDirty&&(n._private.styleDirty=!1,r.style().apply(n));var a=n._private.style[e];return null!=a?a:t?r.style().getDefaultProperty(e):null}},numericStyle:function(e){var t=this[0];if(t.cy().styleEnabled()&&t){var n=t.pstyle(e);return void 0!==n.pfValue?n.pfValue:n.value}},numericStyleUnits:function(e){var t=this[0];if(t.cy().styleEnabled())return t?t.pstyle(e).units:void 0},renderedStyle:function(e){var t=this.cy();if(!t.styleEnabled())return this;var n=this[0];return n?t.style().getRenderedStyle(n,e):void 0},style:function(e,t){var n=this.cy();if(!n.styleEnabled())return this;var r=!1,a=n.style();if($(e)){var i=e;a.applyBypass(this,i,r),this.emitAndNotify("style")}else if(K(e)){if(void 0===t){var o=this[0];return o?a.getStylePropertyValue(o,e):void 0}a.applyBypass(this,e,t,r),this.emitAndNotify("style")}else if(void 0===e){var s=this[0];return s?a.getRawStyle(s):void 0}return this},removeStyle:function(e){var t=this.cy();if(!t.styleEnabled())return this;var n=!1,r=t.style(),a=this;if(void 0===e)for(var i=0;i0&&t.push(c[0]),t.push(s[0])}return this.spawn(t,!0).filter(e)},"neighborhood"),closedNeighborhood:function(e){return this.neighborhood().add(this).filter(e)},openNeighborhood:function(e){return this.neighborhood(e)}}),Nl.neighbourhood=Nl.neighborhood,Nl.closedNeighbourhood=Nl.closedNeighborhood,Nl.openNeighbourhood=Nl.openNeighborhood,be(Nl,{source:fs(function(e){var t,n=this[0];return n&&(t=n._private.source||n.cy().collection()),t&&e?t.filter(e):t},"source"),target:fs(function(e){var t,n=this[0];return n&&(t=n._private.target||n.cy().collection()),t&&e?t.filter(e):t},"target"),sources:Vl({attr:"source"}),targets:Vl({attr:"target"})}),be(Nl,{edgesWith:fs(Fl(),"edgesWith"),edgesTo:fs(Fl({thisIsSrc:!0}),"edgesTo")}),be(Nl,{connectedEdges:fs(function(e){for(var t=[],n=0;n0);return i},component:function(){var e=this[0];return e.cy().mutableElements().components(e)[0]}}),Nl.componentsOf=Nl.components;var jl=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=arguments.length>3&&void 0!==arguments[3]&&arguments[3];if(void 0!==e){var a=new yt,i=!1;if(t){if(t.length>0&&$(t[0])&&!te(t[0])){i=!0;for(var o=[],s=new bt,l=0,u=t.length;l0&&void 0!==arguments[0])||arguments[0],r=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],a=this,i=a.cy(),o=i._private,s=[],l=[],u=0,c=a.length;u0){for(var I=e.length===a.length?a:new jl(i,e),N=0;N0&&void 0!==arguments[0])||arguments[0],t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],n=this,r=[],a={},i=n._private.cy;function o(e){var n=a[e.id()];t&&e.removed()||n||(a[e.id()]=!0,e.isNode()?(r.push(e),function(e){for(var t=e._private.edges,n=0;n0&&(e?k.emitAndNotify("remove"):t&&k.emit("remove"));for(var T=0;T=.001?function(t,r){for(var a=0;a<4;++a){var i=h(r,e,n);if(0===i)return r;r-=(d(r,e,n)-t)/i}return r}(t,o):0===l?o:function(t,r,a){var i,o,s=0;do{(i=d(o=r+(a-r)/2,e,n)-t)>0?a=o:r=o}while(Math.abs(i)>1e-7&&++s<10);return o}(t,r,r+a)}var p=!1;function v(){p=!0,e===t&&n===r||function(){for(var t=0;t<11;++t)s[t]=d(t*a,e,n)}()}var g=function(a){return p||v(),e===t&&n===r?a:0===a?0:1===a?1:d(f(a),t,r)};g.getControlPoints=function(){return[{x:e,y:t},{x:n,y:r}]};var y="generateBezier("+[e,t,n,r]+")";return g.toString=function(){return y},g}var Ul=function(){function e(e){return-e.tension*e.x-e.friction*e.v}function t(t,n,r){var a={x:t.x+r.dx*n,v:t.v+r.dv*n,tension:t.tension,friction:t.friction};return{dx:a.v,dv:e(a)}}function n(n,r){var a={dx:n.v,dv:e(n)},i=t(n,.5*r,a),o=t(n,.5*r,i),s=t(n,r,o),l=1/6*(a.dx+2*(i.dx+o.dx)+s.dx),u=1/6*(a.dv+2*(i.dv+o.dv)+s.dv);return n.x=n.x+l*r,n.v=n.v+u*r,n}return function e(t,r,a){var i,o,s,l={x:-1,v:0,tension:null,friction:null},u=[0],c=0,d=1e-4;for(t=parseFloat(t)||500,r=parseFloat(r)||20,a=a||null,l.tension=t,l.friction=r,o=(i=null!==a)?(c=e(t,r))/a*.016:.016;s=n(s||l,o),u.push(1+s.x),c+=16,Math.abs(s.x)>d&&Math.abs(s.v)>d;);return i?function(e){return u[e*(u.length-1)|0]}:c}}(),Hl=function(e,t,n,r){var a=Wl(e,t,n,r);return function(e,t,n){return e+(t-e)*a(n)}},Kl={linear:function(e,t,n){return e+(t-e)*n},ease:Hl(.25,.1,.25,1),"ease-in":Hl(.42,0,1,1),"ease-out":Hl(0,0,.58,1),"ease-in-out":Hl(.42,0,.58,1),"ease-in-sine":Hl(.47,0,.745,.715),"ease-out-sine":Hl(.39,.575,.565,1),"ease-in-out-sine":Hl(.445,.05,.55,.95),"ease-in-quad":Hl(.55,.085,.68,.53),"ease-out-quad":Hl(.25,.46,.45,.94),"ease-in-out-quad":Hl(.455,.03,.515,.955),"ease-in-cubic":Hl(.55,.055,.675,.19),"ease-out-cubic":Hl(.215,.61,.355,1),"ease-in-out-cubic":Hl(.645,.045,.355,1),"ease-in-quart":Hl(.895,.03,.685,.22),"ease-out-quart":Hl(.165,.84,.44,1),"ease-in-out-quart":Hl(.77,0,.175,1),"ease-in-quint":Hl(.755,.05,.855,.06),"ease-out-quint":Hl(.23,1,.32,1),"ease-in-out-quint":Hl(.86,0,.07,1),"ease-in-expo":Hl(.95,.05,.795,.035),"ease-out-expo":Hl(.19,1,.22,1),"ease-in-out-expo":Hl(1,0,0,1),"ease-in-circ":Hl(.6,.04,.98,.335),"ease-out-circ":Hl(.075,.82,.165,1),"ease-in-out-circ":Hl(.785,.135,.15,.86),spring:function(e,t,n){if(0===n)return Kl.linear;var r=Ul(e,t,n);return function(e,t,n){return e+(t-e)*r(n)}},"cubic-bezier":Hl};function Gl(e,t,n,r,a){if(1===r)return n;if(t===n)return n;var i=a(t,n,r);return null==e||((e.roundValue||e.color)&&(i=Math.round(i)),void 0!==e.min&&(i=Math.max(i,e.min)),void 0!==e.max&&(i=Math.min(i,e.max))),i}function Zl(e,t){return null!=e.pfValue||null!=e.value?null==e.pfValue||null!=t&&"%"===t.type.units?e.value:e.pfValue:e}function $l(e,t,n,r,a){var i=null!=a?a.type:null;n<0?n=0:n>1&&(n=1);var o=Zl(e,a),s=Zl(t,a);if(Q(o)&&Q(s))return Gl(i,o,s,n,r);if(Z(o)&&Z(s)){for(var l=[],u=0;u0?("spring"===d&&h.push(o.duration),o.easingImpl=Kl[d].apply(null,h)):o.easingImpl=Kl[d]}var f,p=o.easingImpl;if(f=0===o.duration?1:(n-l)/o.duration,o.applying&&(f=o.progress),f<0?f=0:f>1&&(f=1),null==o.delay){var v=o.startPosition,g=o.position;if(g&&a&&!e.locked()){var y={};Jl(v.x,g.x)&&(y.x=$l(v.x,g.x,f,p)),Jl(v.y,g.y)&&(y.y=$l(v.y,g.y,f,p)),e.position(y)}var m=o.startPan,b=o.pan,x=i.pan,w=null!=b&&r;w&&(Jl(m.x,b.x)&&(x.x=$l(m.x,b.x,f,p)),Jl(m.y,b.y)&&(x.y=$l(m.y,b.y,f,p)),e.emit("pan"));var E=o.startZoom,k=o.zoom,T=null!=k&&r;T&&(Jl(E,k)&&(i.zoom=tn(i.minZoom,$l(E,k,f,p),i.maxZoom)),e.emit("zoom")),(w||T)&&e.emit("viewport");var C=o.style;if(C&&C.length>0&&a){for(var P=0;P=0;t--){(0,e[t])()}e.splice(0,e.length)},c=i.length-1;c>=0;c--){var d=i[c],h=d._private;h.stopped?(i.splice(c,1),h.hooked=!1,h.playing=!1,h.started=!1,u(h.frames)):(h.playing||h.applying)&&(h.playing&&h.applying&&(h.applying=!1),h.started||eu(0,d,e),Ql(t,d,e,n),h.applying&&(h.applying=!1),u(h.frames),null!=h.step&&h.step(e),d.completed()&&(i.splice(c,1),h.hooked=!1,h.playing=!1,h.started=!1,u(h.completes)),s=!0)}return n||0!==i.length||0!==o.length||r.push(t),s}for(var i=!1,o=0;o0?t.notify("draw",n):t.notify("draw")),n.unmerge(r),t.emit("step")}var nu={animate:To.animate(),animation:To.animation(),animated:To.animated(),clearQueue:To.clearQueue(),delay:To.delay(),delayAnimation:To.delayAnimation(),stop:To.stop(),addToAnimationPool:function(e){this.styleEnabled()&&this._private.aniEles.merge(e)},stopAnimationLoop:function(){this._private.animationsRunning=!1},startAnimationLoop:function(){var e=this;if(e._private.animationsRunning=!0,e.styleEnabled()){var t=e.renderer();t&&t.beforeRender?t.beforeRender(function(t,n){tu(n,e)},t.beforeRenderPriorities.animations):function t(){e._private.animationsRunning&&ze(function(n){tu(n,e),t()})}()}}},ru={qualifierCompare:function(e,t){return null==e||null==t?null==e&&null==t:e.sameText(t)},eventMatches:function(e,t,n){var r=t.qualifier;return null==r||e!==n.target&&te(n.target)&&r.matches(n.target)},addEventFields:function(e,t){t.cy=e,t.target=e},callbackContext:function(e,t,n){return null!=t.qualifier?n.target:e}},au=function(e){return K(e)?new ls(e):e},iu={createEmitter:function(){var e=this._private;return e.emitter||(e.emitter=new ol(ru,this)),this},emitter:function(){return this._private.emitter},on:function(e,t,n){return this.emitter().on(e,au(t),n),this},removeListener:function(e,t,n){return this.emitter().removeListener(e,au(t),n),this},removeAllListeners:function(){return this.emitter().removeAllListeners(),this},one:function(e,t,n){return this.emitter().one(e,au(t),n),this},once:function(e,t,n){return this.emitter().one(e,au(t),n),this},emit:function(e,t){return this.emitter().emit(e,t),this},emitAndNotify:function(e,t){return this.emit(e),this.notify(e,t),this}};To.eventAliasesOn(iu);var ou={png:function(e){return e=e||{},this._private.renderer.png(e)},jpg:function(e){var t=this._private.renderer;return(e=e||{}).bg=e.bg||"#fff",t.jpg(e)}};ou.jpeg=ou.jpg;var su={layout:function(e){var t=this;if(null!=e)if(null!=e.name){var n=e.name,r=t.extension("layout",n);if(null!=r){var a;a=K(e.eles)?t.$(e.eles):null!=e.eles?e.eles:t.$();var i=new r(be({},e,{cy:t,eles:a}));return i}it("No such layout `"+n+"` found. Did you forget to import it and `cytoscape.use()` it?")}else it("A `name` must be specified to make a layout");else it("Layout options must be specified to make a layout")}};su.createLayout=su.makeLayout=su.layout;var lu={notify:function(e,t){var n=this._private;if(this.batching()){n.batchNotifications=n.batchNotifications||{};var r=n.batchNotifications[e]=n.batchNotifications[e]||this.collection();null!=t&&r.merge(t)}else if(n.notificationsEnabled){var a=this.renderer();!this.destroyed()&&a&&a.notify(e,t)}},notifications:function(e){var t=this._private;return void 0===e?t.notificationsEnabled:(t.notificationsEnabled=!!e,this)},noNotifications:function(e){this.notifications(!1),e(),this.notifications(!0)},batching:function(){return this._private.batchCount>0},startBatch:function(){var e=this._private;return null==e.batchCount&&(e.batchCount=0),0===e.batchCount&&(e.batchStyleEles=this.collection(),e.batchNotifications={}),e.batchCount++,this},endBatch:function(){var e=this._private;if(0===e.batchCount)return this;if(e.batchCount--,0===e.batchCount){e.batchStyleEles.updateStyle();var t=this.renderer();Object.keys(e.batchNotifications).forEach(function(n){var r=e.batchNotifications[n];r.empty()?t.notify(n):t.notify(n,r)})}return this},batch:function(e){return this.startBatch(),e(),this.endBatch(),this},batchData:function(e){var t=this;return this.batch(function(){for(var n=Object.keys(e),r=0;r0;)t.removeChild(t.childNodes[0]);e._private.renderer=null,e.mutableElements().forEach(function(e){var t=e._private;t.rscratch={},t.rstyle={},t.animation.current=[],t.animation.queue=[]})},onRender:function(e){return this.on("render",e)},offRender:function(e){return this.off("render",e)}};cu.invalidateDimensions=cu.resize;var du={collection:function(e,t){return K(e)?this.$(e):ee(e)?e.collection():Z(e)?(t||(t={}),new jl(this,e,t.unique,t.removed)):new jl(this)},nodes:function(e){var t=this.$(function(e){return e.isNode()});return e?t.filter(e):t},edges:function(e){var t=this.$(function(e){return e.isEdge()});return e?t.filter(e):t},$:function(e){var t=this._private.elements;return e?t.filter(e):t.spawnSelf()},mutableElements:function(){return this._private.elements}};du.elements=du.filter=du.$;var hu={},fu="t";hu.apply=function(e){for(var t=this,n=t._private.cy.collection(),r=0;r0;if(h||d&&f){var p=void 0;h&&f||h?p=u.properties:f&&(p=u.mappedProperties);for(var v=0;v1&&(g=1),s.color){var w=a.valueMin[0],E=a.valueMax[0],k=a.valueMin[1],T=a.valueMax[1],C=a.valueMin[2],P=a.valueMax[2],S=null==a.valueMin[3]?1:a.valueMin[3],B=null==a.valueMax[3]?1:a.valueMax[3],D=[Math.round(w+(E-w)*g),Math.round(k+(T-k)*g),Math.round(C+(P-C)*g),Math.round(S+(B-S)*g)];n={bypass:a.bypass,name:a.name,value:D,strValue:"rgb("+D[0]+", "+D[1]+", "+D[2]+")"}}else{if(!s.number)return!1;var _=a.valueMin+(a.valueMax-a.valueMin)*g;n=this.parse(a.name,_,a.bypass,h)}if(!n)return v(),!1;n.mapping=a,a=n;break;case o.data:for(var A=a.field.split("."),M=d.data,R=0;R0&&i>0){for(var s={},l=!1,u=0;u0?e.delayAnimation(o).play().promise().then(t):t()}).then(function(){return e.animation({style:s,duration:i,easing:e.pstyle("transition-timing-function").value,queue:!1}).play().promise()}).then(function(){n.removeBypasses(e,a),e.emitAndNotify("style"),r.transitioning=!1})}else r.transitioning&&(this.removeBypasses(e,a),e.emitAndNotify("style"),r.transitioning=!1)},hu.checkTrigger=function(e,t,n,r,a,i){var o=this.properties[t],s=a(o);e.removed()||null!=s&&s(n,r,e)&&i(o)},hu.checkZOrderTrigger=function(e,t,n,r){var a=this;this.checkTrigger(e,t,n,r,function(e){return e.triggersZOrder},function(){a._private.cy.notify("zorder",e)})},hu.checkBoundsTrigger=function(e,t,n,r){this.checkTrigger(e,t,n,r,function(e){return e.triggersBounds},function(t){e.dirtyCompoundBoundsCache(),e.dirtyBoundingBoxCache()})},hu.checkConnectedEdgesBoundsTrigger=function(e,t,n,r){this.checkTrigger(e,t,n,r,function(e){return e.triggersBoundsOfConnectedEdges},function(t){e.connectedEdges().forEach(function(e){e.dirtyBoundingBoxCache()})})},hu.checkParallelEdgesBoundsTrigger=function(e,t,n,r){this.checkTrigger(e,t,n,r,function(e){return e.triggersBoundsOfParallelEdges},function(t){e.parallelEdges().forEach(function(e){e.dirtyBoundingBoxCache()})})},hu.checkTriggers=function(e,t,n,r){e.dirtyStyleCache(),this.checkZOrderTrigger(e,t,n,r),this.checkBoundsTrigger(e,t,n,r),this.checkConnectedEdgesBoundsTrigger(e,t,n,r),this.checkParallelEdgesBoundsTrigger(e,t,n,r)};var pu={applyBypass:function(e,t,n,r){var a=[];if("*"===t||"**"===t){if(void 0!==n)for(var i=0;it.length?i.substr(t.length):""}function s(){n=n.length>r.length?n.substr(r.length):""}for(i=i.replace(/[/][*](\s|.)+?[*][/]/g,"");;){if(i.match(/^\s*$/))break;var l=i.match(/^\s*((?:.|\s)+?)\s*\{((?:.|\s)+?)\}/);if(!l){st("Halting stylesheet parsing: String stylesheet contains more to parse but no selector and block found in: "+i);break}t=l[0];var u=l[1];if("core"!==u)if(new ls(u).invalid){st("Skipping parsing of block: Invalid selector found in string stylesheet: "+u),o();continue}var c=l[2],d=!1;n=c;for(var h=[];;){if(n.match(/^\s*$/))break;var f=n.match(/^\s*(.+?)\s*:\s*(.+?)(?:\s*;|\s*$)/);if(!f){st("Skipping parsing of block: Invalid formatting of style property and value definitions found in:"+c),d=!0;break}r=f[0];var p=f[1],v=f[2];if(this.properties[p])a.parse(p,v)?(h.push({name:p,val:v}),s()):(st("Skipping property: Invalid property definition in: "+r),s());else st("Skipping property: Invalid property name in: "+r),s()}if(d){o();break}a.selector(u);for(var g=0;g=7&&"d"===t[0]&&(u=new RegExp(s.data.regex).exec(t))){if(n)return!1;var h=s.data;return{name:e,value:u,strValue:""+t,mapped:h,field:u[1],bypass:n}}if(t.length>=10&&"m"===t[0]&&(c=new RegExp(s.mapData.regex).exec(t))){if(n)return!1;if(d.multiple)return!1;var f=s.mapData;if(!d.color&&!d.number)return!1;var p=this.parse(e,c[4]);if(!p||p.mapped)return!1;var v=this.parse(e,c[5]);if(!v||v.mapped)return!1;if(p.pfValue===v.pfValue||p.strValue===v.strValue)return st("`"+e+": "+t+"` is not a valid mapper because the output range is zero; converting to `"+e+": "+p.strValue+"`"),this.parse(e,p.strValue);if(d.color){var g=p.value,y=v.value;if(!(g[0]!==y[0]||g[1]!==y[1]||g[2]!==y[2]||g[3]!==y[3]&&(null!=g[3]&&1!==g[3]||null!=y[3]&&1!==y[3])))return!1}return{name:e,value:c,strValue:""+t,mapped:f,field:c[1],fieldMin:parseFloat(c[2]),fieldMax:parseFloat(c[3]),valueMin:p.value,valueMax:v.value,bypass:n}}}if(d.multiple&&"multiple"!==r){var m;if(m=l?t.split(/\s+/):Z(t)?t:[t],d.evenMultiple&&m.length%2!=0)return null;for(var b=[],x=[],w=[],E="",k=!1,T=0;T0?" ":"")+C.strValue}return d.validate&&!d.validate(b,x)?null:d.singleEnum&&k?1===b.length&&K(b[0])?{name:e,value:b[0],strValue:b[0],bypass:n}:null:{name:e,value:b,pfValue:w,strValue:E,bypass:n,units:x}}var P,S,B=function(){for(var r=0;rd.max||d.strictMax&&t===d.max))return null;var R={name:e,value:t,strValue:""+t+(D||""),units:D,bypass:n};return d.unitless||"px"!==D&&"em"!==D?R.pfValue=t:R.pfValue="px"!==D&&D?this.getEmSizeInPixels()*t:t,"ms"!==D&&"s"!==D||(R.pfValue="ms"===D?t:1e3*t),"deg"!==D&&"rad"!==D||(R.pfValue="rad"===D?t:(P=t,Math.PI*P/180)),"%"===D&&(R.pfValue=t/100),R}if(d.propList){var I=[],N=""+t;if("none"===N);else{for(var L=N.split(/\s*,\s*|\s+/),z=0;z0&&l>0&&!isNaN(n.w)&&!isNaN(n.h)&&n.w>0&&n.h>0)return{zoom:o=(o=(o=Math.min((s-2*t)/n.w,(l-2*t)/n.h))>this._private.maxZoom?this._private.maxZoom:o)=n.minZoom&&(n.maxZoom=t),this},minZoom:function(e){return void 0===e?this._private.minZoom:this.zoomRange({min:e})},maxZoom:function(e){return void 0===e?this._private.maxZoom:this.zoomRange({max:e})},getZoomedViewport:function(e){var t,n,r=this._private,a=r.pan,i=r.zoom,o=!1;if(r.zoomingEnabled||(o=!0),Q(e)?n=e:$(e)&&(n=e.level,null!=e.position?t=qt(e.position,i,a):null!=e.renderedPosition&&(t=e.renderedPosition),null==t||r.panningEnabled||(o=!0)),n=(n=n>r.maxZoom?r.maxZoom:n)t.maxZoom||!t.zoomingEnabled?i=!0:(t.zoom=s,a.push("zoom"))}if(r&&(!i||!e.cancelOnFailedZoom)&&t.panningEnabled){var l=e.pan;Q(l.x)&&(t.pan.x=l.x,o=!1),Q(l.y)&&(t.pan.y=l.y,o=!1),o||a.push("pan")}return a.length>0&&(a.push("viewport"),this.emit(a.join(" ")),this.notify("viewport")),this},center:function(e){var t=this.getCenterPan(e);return t&&(this._private.pan=t,this.emit("pan viewport"),this.notify("viewport")),this},getCenterPan:function(e,t){if(this._private.panningEnabled){if(K(e)){var n=e;e=this.mutableElements().filter(n)}else ee(e)||(e=this.mutableElements());if(0!==e.length){var r=e.boundingBox(),a=this.width(),i=this.height();return{x:(a-(t=void 0===t?this._private.zoom:t)*(r.x1+r.x2))/2,y:(i-t*(r.y1+r.y2))/2}}}},reset:function(){return this._private.panningEnabled&&this._private.zoomingEnabled?(this.viewport({pan:{x:0,y:0},zoom:1}),this):this},invalidateSize:function(){this._private.sizeCache=null},size:function(){var e,t,n=this._private,r=n.container,a=this;return n.sizeCache=n.sizeCache||(r?(e=a.window().getComputedStyle(r),t=function(t){return parseFloat(e.getPropertyValue(t))},{width:r.clientWidth-t("padding-left")-t("padding-right"),height:r.clientHeight-t("padding-top")-t("padding-bottom")}):{width:1,height:1})},width:function(){return this.size().width},height:function(){return this.size().height},extent:function(){var e=this._private.pan,t=this._private.zoom,n=this.renderedExtent(),r={x1:(n.x1-e.x)/t,x2:(n.x2-e.x)/t,y1:(n.y1-e.y)/t,y2:(n.y2-e.y)/t};return r.w=r.x2-r.x1,r.h=r.y2-r.y1,r},renderedExtent:function(){var e=this.width(),t=this.height();return{x1:0,y1:0,x2:e,y2:t,w:e,h:t}},multiClickDebounceTime:function(e){return e?(this._private.multiClickDebounceTime=e,this):this._private.multiClickDebounceTime}};Tu.centre=Tu.center,Tu.autolockNodes=Tu.autolock,Tu.autoungrabifyNodes=Tu.autoungrabify;var Cu={data:To.data({field:"data",bindingEvent:"data",allowBinding:!0,allowSetting:!0,settingEvent:"data",settingTriggersEvent:!0,triggerFnName:"trigger",allowGetting:!0,updateStyle:!0}),removeData:To.removeData({field:"data",event:"data",triggerFnName:"trigger",triggerEvent:!0,updateStyle:!0}),scratch:To.data({field:"scratch",bindingEvent:"scratch",allowBinding:!0,allowSetting:!0,settingEvent:"scratch",settingTriggersEvent:!0,triggerFnName:"trigger",allowGetting:!0,updateStyle:!0}),removeScratch:To.removeData({field:"scratch",event:"scratch",triggerFnName:"trigger",triggerEvent:!0,updateStyle:!0})};Cu.attr=Cu.data,Cu.removeAttr=Cu.removeData;var Pu=function(e){var t=this,n=(e=be({},e)).container;n&&!J(n)&&J(n[0])&&(n=n[0]);var r=n?n._cyreg:null;(r=r||{})&&r.cy&&(r.cy.destroy(),r={});var a=r.readies=r.readies||[];n&&(n._cyreg=r),r.cy=t;var i=void 0!==f&&void 0!==n&&!e.headless,o=e;o.layout=be({name:i?"grid":"null"},o.layout),o.renderer=be({name:i?"canvas":"null"},o.renderer);var s=function(e,t,n){return void 0!==t?t:void 0!==n?n:e},l=this._private={container:n,ready:!1,options:o,elements:new jl(this),listeners:[],aniEles:new jl(this),data:o.data||{},scratch:{},layout:null,renderer:null,destroyed:!1,notificationsEnabled:!0,minZoom:1e-50,maxZoom:1e50,zoomingEnabled:s(!0,o.zoomingEnabled),userZoomingEnabled:s(!0,o.userZoomingEnabled),panningEnabled:s(!0,o.panningEnabled),userPanningEnabled:s(!0,o.userPanningEnabled),boxSelectionEnabled:s(!0,o.boxSelectionEnabled),autolock:s(!1,o.autolock,o.autolockNodes),autoungrabify:s(!1,o.autoungrabify,o.autoungrabifyNodes),autounselectify:s(!1,o.autounselectify),styleEnabled:void 0===o.styleEnabled?i:o.styleEnabled,zoom:Q(o.zoom)?o.zoom:1,pan:{x:$(o.pan)&&Q(o.pan.x)?o.pan.x:0,y:$(o.pan)&&Q(o.pan.y)?o.pan.y:0},animation:{current:[],queue:[]},hasCompoundNodes:!1,multiClickDebounceTime:s(250,o.multiClickDebounceTime)};this.createEmitter(),this.selectionType(o.selectionType),this.zoomRange({min:o.minZoom,max:o.maxZoom});l.styleEnabled&&t.setStyle([]);var u=be({},o,o.renderer);t.initRenderer(u);!function(e,t){if(e.some(oe))return $r.all(e).then(t);t(e)}([o.style,o.elements],function(e){var n=e[0],i=e[1];l.styleEnabled&&t.style().append(n),function(e,n,r){t.notifications(!1);var a=t.mutableElements();a.length>0&&a.remove(),null!=e&&($(e)||Z(e))&&t.add(e),t.one("layoutready",function(e){t.notifications(!0),t.emit(e),t.one("load",n),t.emitAndNotify("load")}).one("layoutstop",function(){t.one("done",r),t.emit("done")});var i=be({},t._private.options.layout);i.eles=t.elements(),t.layout(i).run()}(i,function(){t.startAnimationLoop(),l.ready=!0,G(o.ready)&&t.on("ready",o.ready);for(var e=0;e0,l=!!t.boundingBox,u=nn(l?t.boundingBox:structuredClone(n.extent()));if(ee(t.roots))e=t.roots;else if(Z(t.roots)){for(var c=[],d=0;d0;){var D=B(),_=T(D,P);if(_)D.outgoers().filter(function(e){return e.isNode()&&r.has(e)}).forEach(S);else if(null===_){st("Detected double maximal shift for node `"+D.id()+"`. Bailing maximal adjustment due to cycle. Use `options.maximal: true` only on DAGs.");break}}}var A=0;if(t.avoidOverlap)for(var M=0;M0&&y[0].length<=3?i/2:0),s=2*Math.PI/y[r].length*a;return 0===r&&1===y[0].length&&(o=1),{x:W+o*Math.cos(s),y:U+o*Math.sin(s)}}var c=y[r].length,d=Math.max(1===c?0:l?(u.w-2*t.padding-H.w)/((t.grid?$:c)-1):(u.w-2*t.padding-H.w)/((t.grid?$:c)+1),A);return{x:W+(a+1-(c+1)/2)*d,y:U+(r+1-(V+1)/2)*G}}(e),u,Q[t.direction])}),this};var Ru={fit:!0,padding:30,boundingBox:void 0,avoidOverlap:!0,nodeDimensionsIncludeLabels:!1,spacingFactor:void 0,radius:void 0,startAngle:1.5*Math.PI,sweep:void 0,clockwise:!0,sort:void 0,animate:!1,animationDuration:500,animationEasing:void 0,animateFilter:function(e,t){return!0},ready:void 0,stop:void 0,transform:function(e,t){return t}};function Iu(e){this.options=be({},Ru,e)}Iu.prototype.run=function(){var e=this.options,t=e,n=e.cy,r=t.eles,a=void 0!==t.counterclockwise?!t.counterclockwise:t.clockwise,i=r.nodes().not(":parent");t.sort&&(i=i.sort(t.sort));for(var o,s=nn(t.boundingBox?t.boundingBox:{x1:0,y1:0,w:n.width(),h:n.height()}),l=s.x1+s.w/2,u=s.y1+s.h/2,c=(void 0===t.sweep?2*Math.PI-2*Math.PI/i.length:t.sweep)/Math.max(1,i.length-1),d=0,h=0;h1&&t.avoidOverlap){d*=1.75;var g=Math.cos(c)-Math.cos(0),y=Math.sin(c)-Math.sin(0),m=Math.sqrt(d*d/(g*g+y*y));o=Math.max(m,o)}return r.nodes().layoutPositions(this,t,function(e,n){var r=t.startAngle+n*c*(a?1:-1),i=o*Math.cos(r),s=o*Math.sin(r);return{x:l+i,y:u+s}}),this};var Nu,Lu={fit:!0,padding:30,startAngle:1.5*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(e){return e.degree()},levelWidth:function(e){return e.maxDegree()/4},animate:!1,animationDuration:500,animationEasing:void 0,animateFilter:function(e,t){return!0},ready:void 0,stop:void 0,transform:function(e,t){return t}};function zu(e){this.options=be({},Lu,e)}zu.prototype.run=function(){for(var e=this.options,t=e,n=void 0!==t.counterclockwise?!t.counterclockwise:t.clockwise,r=e.cy,a=t.eles,i=a.nodes().not(":parent"),o=nn(t.boundingBox?t.boundingBox:{x1:0,y1:0,w:r.width(),h:r.height()}),s=o.x1+o.w/2,l=o.y1+o.h/2,u=[],c=0,d=0;d0)Math.abs(m[0].value-x.value)>=g&&(m=[],y.push(m));m.push(x)}var w=c+t.minNodeSpacing;if(!t.avoidOverlap){var E=y.length>0&&y[0].length>1,k=(Math.min(o.w,o.h)/2-w)/(y.length+E?1:0);w=Math.min(w,k)}for(var T=0,C=0;C1&&t.avoidOverlap){var D=Math.cos(B)-Math.cos(0),_=Math.sin(B)-Math.sin(0),A=Math.sqrt(w*w/(D*D+_*_));T=Math.max(A,T)}P.r=T,T+=w}if(t.equidistant){for(var M=0,R=0,I=0;I=e.numIter)&&(Uu(r,e),r.temperature=r.temperature*e.coolingFactor,!(r.temperature=e.animationThreshold&&i(),ze(c)):(ac(r,e),s())};c()}else{for(;u;)u=o(l),l++;ac(r,e),s()}return this},Vu.prototype.stop=function(){return this.stopped=!0,this.thread&&this.thread.stop(),this.emit("layoutstop"),this},Vu.prototype.destroy=function(){return this.thread&&this.thread.stop(),this};var Fu=function(e,t,n){for(var r=n.eles.edges(),a=n.eles.nodes(),i=nn(n.boundingBox?n.boundingBox:{x1:0,y1:0,w:e.width(),h:e.height()}),o={isCompound:e.hasCompoundNodes(),layoutNodes:[],idToIndex:{},nodeSize:a.size(),graphSet:[],indexToGraph:[],layoutEdges:[],edgeSize:r.size(),temperature:n.initialTemp,clientWidth:i.w,clientHeight:i.h,boundingBox:i},s=n.eles.components(),l={},u=0;u0){o.graphSet.push(w);for(u=0;ur.count?0:r.graph},ju=function(e,t,n,r){var a=r.graphSet[n];if(-10)var s=(u=r.nodeOverlap*o)*a/(v=Math.sqrt(a*a+i*i)),l=u*i/v;else{var u,c=$u(e,a,i),d=$u(t,-1*a,-1*i),h=d.x-c.x,f=d.y-c.y,p=h*h+f*f,v=Math.sqrt(p);s=(u=(e.nodeRepulsion+t.nodeRepulsion)/p)*h/v,l=u*f/v}e.isLocked||(e.offsetX-=s,e.offsetY-=l),t.isLocked||(t.offsetX+=s,t.offsetY+=l)}},Zu=function(e,t,n,r){if(n>0)var a=e.maxX-t.minX;else a=t.maxX-e.minX;if(r>0)var i=e.maxY-t.minY;else i=t.maxY-e.minY;return a>=0&&i>=0?Math.sqrt(a*a+i*i):0},$u=function(e,t,n){var r=e.positionX,a=e.positionY,i=e.height||1,o=e.width||1,s=n/t,l=i/o,u={};return 0===t&&0n?(u.x=r,u.y=a+i/2,u):0t&&-1*l<=s&&s<=l?(u.x=r-o/2,u.y=a-o*n/2/t,u):0=l)?(u.x=r+i*t/2/n,u.y=a+i/2,u):0>n&&(s<=-1*l||s>=l)?(u.x=r-i*t/2/n,u.y=a-i/2,u):u},Qu=function(e,t){for(var n=0;n1){var p=t.gravity*d/f,v=t.gravity*h/f;c.offsetX+=p,c.offsetY+=v}}}}},ec=function(e,t){var n=[],r=0,a=-1;for(n.push.apply(n,e.graphSet[0]),a+=e.graphSet[0].length;r<=a;){var i=n[r++],o=e.idToIndex[i],s=e.layoutNodes[o],l=s.children;if(0n)var a={x:n*e/r,y:n*t/r};else a={x:e,y:t};return a},rc=function(e,t){var n=e.parentId;if(null!=n){var r=t.layoutNodes[t.idToIndex[n]],a=!1;return(null==r.maxX||e.maxX+r.padRight>r.maxX)&&(r.maxX=e.maxX+r.padRight,a=!0),(null==r.minX||e.minX-r.padLeftr.maxY)&&(r.maxY=e.maxY+r.padBottom,a=!0),(null==r.minY||e.minY-r.padTopp&&(d+=f+t.componentSpacing,c=0,h=0,f=0)}}},ic={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(e){},sort:void 0,animate:!1,animationDuration:500,animationEasing:void 0,animateFilter:function(e,t){return!0},ready:void 0,stop:void 0,transform:function(e,t){return t}};function oc(e){this.options=be({},ic,e)}oc.prototype.run=function(){var e=this.options,t=e,n=e.cy,r=t.eles,a=r.nodes().not(":parent");t.sort&&(a=a.sort(t.sort));var i=nn(t.boundingBox?t.boundingBox:{x1:0,y1:0,w:n.width(),h:n.height()});if(0===i.h||0===i.w)r.nodes().layoutPositions(this,t,function(e){return{x:i.x1,y:i.y1}});else{var o=a.size(),s=Math.sqrt(o*i.h/i.w),l=Math.round(s),u=Math.round(i.w/i.h*s),c=function(e){if(null==e)return Math.min(l,u);Math.min(l,u)==l?l=e:u=e},d=function(e){if(null==e)return Math.max(l,u);Math.max(l,u)==l?l=e:u=e},h=t.rows,f=null!=t.cols?t.cols:t.columns;if(null!=h&&null!=f)l=h,u=f;else if(null!=h&&null==f)l=h,u=Math.ceil(o/l);else if(null==h&&null!=f)u=f,l=Math.ceil(o/u);else if(u*l>o){var p=c(),v=d();(p-1)*v>=o?c(p-1):(v-1)*p>=o&&d(v-1)}else for(;u*l=o?d(y+1):c(g+1)}var m=i.w/u,b=i.h/l;if(t.condense&&(m=0,b=0),t.avoidOverlap)for(var x=0;x=u&&(A=0,_++)},R={},I=0;I(r=bn(e,t,x[w],x[w+1],x[w+2],x[w+3])))return g(n,r),!0}else if("bezier"===i.edgeType||"multibezier"===i.edgeType||"self"===i.edgeType||"compound"===i.edgeType)for(x=i.allpts,w=0;w+5(r=mn(e,t,x[w],x[w+1],x[w+2],x[w+3],x[w+4],x[w+5])))return g(n,r),!0;m=m||a.source,b=b||a.target;var E=o.getArrowWidth(l,c),k=[{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}];for(w=0;w0&&(y(m),y(b))}function b(e,t,n){return vt(e,t,n)}function x(n,r){var a,i=n._private,o=p;a=r?r+"-":"",n.boundingBox();var s=i.labelBounds[r||"main"],l=n.pstyle(a+"label").value;if("yes"===n.pstyle("text-events").strValue&&l){var u=b(i.rscratch,"labelX",r),c=b(i.rscratch,"labelY",r),d=b(i.rscratch,"labelAngle",r),h=n.pstyle(a+"text-margin-x").pfValue,f=n.pstyle(a+"text-margin-y").pfValue,v=s.x1-o-h,y=s.x2+o-h,m=s.y1-o-f,x=s.y2+o-f;if(d){var w=Math.cos(d),E=Math.sin(d),k=function(e,t){return{x:(e-=u)*w-(t-=c)*E+u,y:e*E+t*w+c}},T=k(v,m),C=k(v,x),P=k(y,m),S=k(y,x),B=[T.x+h,T.y+f,P.x+h,P.y+f,S.x+h,S.y+f,C.x+h,C.y+f];if(xn(e,t,B))return g(n),!0}else if(cn(s,e,t))return g(n),!0}}n&&(l=l.interactive);for(var w=l.length-1;w>=0;w--){var E=l[w];E.isNode()?y(E)||x(E):m(E)||x(E)||x(E,"source")||x(E,"target")}return u},getAllInBox:function(e,t,n,r){var a=this.getCachedZSortedEles().interactive,i=2/this.cy.zoom(),o=[],s=Math.min(e,n),u=Math.max(e,n),c=Math.min(t,r),d=Math.max(t,r),h=nn({x1:e=s,y1:t=c,x2:n=u,y2:r=d}),f=[{x:h.x1,y:h.y1},{x:h.x2,y:h.y1},{x:h.x2,y:h.y2},{x:h.x1,y:h.y2}],p=[[f[0],f[1]],[f[1],f[2]],[f[2],f[3]],[f[3],f[0]]];function v(e,t,n){return vt(e,t,n)}function g(e,t){var n=e._private,r=i;e.boundingBox();var a=n.labelBounds.main;if(!a)return null;var o=v(n.rscratch,"labelX",t),s=v(n.rscratch,"labelY",t),l=v(n.rscratch,"labelAngle",t),u=e.pstyle("text-margin-x").pfValue,c=e.pstyle("text-margin-y").pfValue,d=a.x1-r-u,h=a.x2+r-u,f=a.y1-r-c,p=a.y2+r-c;if(l){var g=Math.cos(l),y=Math.sin(l),m=function(e,t){return{x:(e-=o)*g-(t-=s)*y+o,y:e*y+t*g+s}};return[m(d,f),m(h,f),m(h,p),m(d,p)]}return[{x:d,y:f},{x:h,y:f},{x:h,y:p},{x:d,y:p}]}function y(e,t,n,r){function a(e,t,n){return(n.y-e.y)*(t.x-e.x)>(t.y-e.y)*(n.x-e.x)}return a(e,n,r)!==a(t,n,r)&&a(e,t,n)!==a(e,t,r)}for(var m=0;m0?-(Math.PI-i.ang):Math.PI+i.ang),Vc(t,n,Oc),Ec=zc.nx*Oc.ny-zc.ny*Oc.nx,kc=zc.nx*Oc.nx-zc.ny*-Oc.ny,Pc=Math.asin(Math.max(-1,Math.min(1,Ec))),Math.abs(Pc)<1e-6)return xc=t.x,wc=t.y,void(Bc=_c=0);Tc=1,Cc=!1,kc<0?Pc<0?Pc=Math.PI+Pc:(Pc=Math.PI-Pc,Tc=-1,Cc=!0):Pc>0&&(Tc=-1,Cc=!0),_c=void 0!==t.radius?t.radius:r,Sc=Pc/2,Ac=Math.min(zc.len/2,Oc.len/2),a?(Dc=Math.abs(Math.cos(Sc)*_c/Math.sin(Sc)))>Ac?(Dc=Ac,Bc=Math.abs(Dc*Math.sin(Sc)/Math.cos(Sc))):Bc=_c:(Dc=Math.min(Ac,_c),Bc=Math.abs(Dc*Math.sin(Sc)/Math.cos(Sc))),Ic=t.x+Oc.nx*Dc,Nc=t.y+Oc.ny*Dc,xc=Ic-Oc.ny*Bc*Tc,wc=Nc+Oc.nx*Bc*Tc,Mc=t.x+zc.nx*Dc,Rc=t.y+zc.ny*Dc,Lc=t};function Xc(e,t){0===t.radius?e.lineTo(t.cx,t.cy):e.arc(t.cx,t.cy,t.radius,t.startAngle,t.endAngle,t.counterClockwise)}function jc(e,t,n,r){var a=!(arguments.length>4&&void 0!==arguments[4])||arguments[4];return 0===r||0===t.radius?{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}:(Fc(e,t,n,r,a),{cx:xc,cy:wc,radius:Bc,startX:Mc,startY:Rc,stopX:Ic,stopY:Nc,startAngle:zc.ang+Math.PI/2*Tc,endAngle:Oc.ang-Math.PI/2*Tc,counterClockwise:Cc})}var Yc=.01,qc=Math.sqrt(.02),Wc={};function Uc(e){var t=[];if(null!=e){for(var n=0;n0?Math.max(e-t,0):Math.min(e+t,0)},S=P(T,E),B=P(C,k),D=!1;"auto"===g?v=Math.abs(S)>Math.abs(B)?a:r:g===l||g===s?(v=r,D=!0):g!==i&&g!==o||(v=a,D=!0);var _,A=v===r,M=A?B:S,R=A?C:T,I=Gt(R),N=!1;(D&&(m||x)||!(g===s&&R<0||g===l&&R>0||g===i&&R>0||g===o&&R<0)||(M=(I*=-1)*Math.abs(M),N=!0),m)?_=(b<0?1+b:b)*M:_=(b<0?M:0)+b*I;var L=function(e){return Math.abs(e)=Math.abs(M)},z=L(_),O=L(Math.abs(M)-Math.abs(_));if((z||O)&&!N)if(A){var V=Math.abs(R)<=d/2,F=Math.abs(T)<=h/2;if(V){var X=(u.x1+u.x2)/2,j=u.y1,Y=u.y2;n.segpts=[X,j,X,Y]}else if(F){var q=(u.y1+u.y2)/2,W=u.x1,U=u.x2;n.segpts=[W,q,U,q]}else n.segpts=[u.x1,u.y2]}else{var H=Math.abs(R)<=c/2,K=Math.abs(C)<=f/2;if(H){var G=(u.y1+u.y2)/2,Z=u.x1,$=u.x2;n.segpts=[Z,G,$,G]}else if(K){var Q=(u.x1+u.x2)/2,J=u.y1,ee=u.y2;n.segpts=[Q,J,Q,ee]}else n.segpts=[u.x2,u.y1]}else if(A){var te=u.y1+_+(p?d/2*I:0),ne=u.x1,re=u.x2;n.segpts=[ne,te,re,te]}else{var ae=u.x1+_+(p?c/2*I:0),ie=u.y1,oe=u.y2;n.segpts=[ae,ie,ae,oe]}if(n.isRound){var se=e.pstyle("taxi-radius").value,le="arc-radius"===e.pstyle("radius-type").value[0];n.radii=new Array(n.segpts.length/2).fill(se),n.isArcRadius=new Array(n.segpts.length/2).fill(le)}},Wc.tryToCorrectInvalidPoints=function(e,t){var n=e._private.rscratch;if("bezier"===n.edgeType){var r=t.srcPos,a=t.tgtPos,i=t.srcW,o=t.srcH,s=t.tgtW,l=t.tgtH,u=t.srcShape,c=t.tgtShape,d=t.srcCornerRadius,h=t.tgtCornerRadius,f=t.srcRs,p=t.tgtRs,v=!Q(n.startX)||!Q(n.startY),g=!Q(n.arrowStartX)||!Q(n.arrowStartY),y=!Q(n.endX)||!Q(n.endY),m=!Q(n.arrowEndX)||!Q(n.arrowEndY),b=3*(this.getArrowWidth(e.pstyle("width").pfValue,e.pstyle("arrow-scale").value)*this.arrowShapeWidth),x=Zt({x:n.ctrlpts[0],y:n.ctrlpts[1]},{x:n.startX,y:n.startY}),w=xv.poolIndex()){var g=p;p=v,v=g}var y=d.srcPos=p.position(),m=d.tgtPos=v.position(),b=d.srcW=p.outerWidth(),x=d.srcH=p.outerHeight(),E=d.tgtW=v.outerWidth(),k=d.tgtH=v.outerHeight(),T=d.srcShape=n.nodeShapes[t.getNodeShape(p)],C=d.tgtShape=n.nodeShapes[t.getNodeShape(v)],P=d.srcCornerRadius="auto"===p.pstyle("corner-radius").value?"auto":p.pstyle("corner-radius").pfValue,S=d.tgtCornerRadius="auto"===v.pstyle("corner-radius").value?"auto":v.pstyle("corner-radius").pfValue,B=d.tgtRs=v._private.rscratch,D=d.srcRs=p._private.rscratch;d.dirCounts={north:0,west:0,south:0,east:0,northwest:0,southwest:0,northeast:0,southeast:0};for(var _=0;_=qc||(q=Math.sqrt(Math.max(Y*Y,Yc)+Math.max(j*j,Yc)));var W=d.vector={x:Y,y:j},U=d.vectorNorm={x:W.x/q,y:W.y/q},H={x:-U.y,y:U.x};d.nodesOverlap=!Q(q)||C.checkPoint(L[0],L[1],0,E,k,m.x,m.y,S,B)||T.checkPoint(O[0],O[1],0,b,x,y.x,y.y,P,D),d.vectorNormInverse=H,e={nodesOverlap:d.nodesOverlap,dirCounts:d.dirCounts,calculatedIntersection:!0,hasBezier:d.hasBezier,hasUnbundled:d.hasUnbundled,eles:d.eles,srcPos:m,srcRs:B,tgtPos:y,tgtRs:D,srcW:E,srcH:k,tgtW:b,tgtH:x,srcIntn:V,tgtIntn:z,srcShape:C,tgtShape:T,posPts:{x1:X.x2,y1:X.y2,x2:X.x1,y2:X.y1},intersectionPts:{x1:F.x2,y1:F.y2,x2:F.x1,y2:F.y1},vector:{x:-W.x,y:-W.y},vectorNorm:{x:-U.x,y:-U.y},vectorNormInverse:{x:-H.x,y:-H.y}}}var K=N?e:d;M.nodesOverlap=K.nodesOverlap,M.srcIntn=K.srcIntn,M.tgtIntn=K.tgtIntn,M.isRound=R.startsWith("round"),r&&(p.isParent()||p.isChild()||v.isParent()||v.isChild())&&(p.parents().anySame(v)||v.parents().anySame(p)||p.same(v)&&p.isParent())?t.findCompoundLoopPoints(A,K,_,I):p===v?t.findLoopPoints(A,K,_,I):R.endsWith("segments")?t.findSegmentsPoints(A,K):R.endsWith("taxi")?t.findTaxiPoints(A,K):"straight"===R||!I&&d.eles.length%2==1&&_===Math.floor(d.eles.length/2)?t.findStraightEdgePoints(A):t.findBezierPoints(A,K,_,I,N),t.findEndpoints(A),t.tryToCorrectInvalidPoints(A,K),t.checkForInvalidEdgeWarning(A),t.storeAllpts(A),t.storeEdgeProjections(A),t.calculateArrowAngles(A),t.recalculateEdgeLabelProjections(A),t.calculateLabelAngles(A)}},w=0;w0){var J=f,ee=$t(J,Ut(i)),te=$t(J,Ut($)),ne=ee;if(te2)$t(J,{x:$[2],y:$[3]})0){var ge=p,ye=$t(ge,Ut(i)),me=$t(ge,Ut(ve)),be=ye;if(me2)$t(ge,{x:ve[2],y:ve[3]})=u||m){c={cp:v,segment:y};break}}if(c)break}var b=c.cp,x=c.segment,w=(u-h)/x.length,E=x.t1-x.t0,k=s?x.t0+E*w:x.t1-E*w;k=tn(0,k,1),t=en(b.p0,b.p1,b.p2,k),a=function(e,t,n,r){var a=tn(0,r-.001,1),i=tn(0,r+.001,1),o=en(e,t,n,a),s=en(e,t,n,i);return Qc(o,s)}(b.p0,b.p1,b.p2,k);break;case"straight":case"segments":case"haystack":for(var T,C,P,S,B=0,D=r.allpts.length,_=0;_+3=u));_+=2);var A=(u-C)/T;A=tn(0,A,1),t=function(e,t,n,r){var a=t.x-e.x,i=t.y-e.y,o=Zt(e,t),s=a/o,l=i/o;return n=null==n?0:n,r=null!=r?r:n*o,{x:e.x+s*r,y:e.y+l*r}}(P,S,A),a=Qc(P,S)}o("labelX",n,t.x),o("labelY",n,t.y),o("labelAutoAngle",n,a)}};u("source"),u("target"),this.applyLabelDimensions(e)}},Zc.applyLabelDimensions=function(e){this.applyPrefixedLabelDimensions(e),e.isEdge()&&(this.applyPrefixedLabelDimensions(e,"source"),this.applyPrefixedLabelDimensions(e,"target"))},Zc.applyPrefixedLabelDimensions=function(e,t){var n=e._private,r=this.getLabelText(e,t),a=He(r,e._private.labelDimsKey);if(vt(n.rscratch,"prefixedLabelDimsKey",t)!==a){gt(n.rscratch,"prefixedLabelDimsKey",t,a);var i=this.calculateLabelDimensions(e,r),o=e.pstyle("line-height").pfValue,s=e.pstyle("text-wrap").strValue,l=vt(n.rscratch,"labelWrapCachedLines",t)||[],u="wrap"!==s?1:Math.max(l.length,1),c=i.height/u,d=c*o,h=i.width,f=i.height+(u-1)*(o-1)*c;gt(n.rstyle,"labelWidth",t,h),gt(n.rscratch,"labelWidth",t,h),gt(n.rstyle,"labelHeight",t,f),gt(n.rscratch,"labelHeight",t,f),gt(n.rscratch,"labelLineHeight",t,d)}},Zc.getLabelText=function(e,t){var n=e._private,r=t?t+"-":"",a=e.pstyle(r+"label").strValue,i=e.pstyle("text-transform").value,s=function(e,r){return r?(gt(n.rscratch,e,t,r),r):vt(n.rscratch,e,t)};if(!a)return"";"none"==i||("uppercase"==i?a=a.toUpperCase():"lowercase"==i&&(a=a.toLowerCase()));var l=e.pstyle("text-wrap").value;if("wrap"===l){var u=s("labelKey");if(null!=u&&s("labelWrapKey")===u)return s("labelWrapCachedText");for(var c=a.split("\n"),d=e.pstyle("text-max-width").pfValue,h="anywhere"===e.pstyle("text-overflow-wrap").value,f=[],p=/[\s\u200b]+|$/g,v=0;vd){var b,x="",w=0,E=o(g.matchAll(p));try{for(E.s();!(b=E.n()).done;){var k=b.value,T=k[0],C=g.substring(w,k.index);w=k.index+T.length;var P=0===x.length?C:x+C+T;this.calculateLabelDimensions(e,P).width<=d?x+=C+T:(x&&f.push(x),x=C+T)}}catch(A){E.e(A)}finally{E.f()}x.match(/^[\s\u200b]+$/)||f.push(x)}else f.push(g)}s("labelWrapCachedLines",f),a=s("labelWrapCachedText",f.join("\n")),s("labelWrapKey",u)}else if("ellipsis"===l){var S=e.pstyle("text-max-width").pfValue,B="",D=!1;if(this.calculateLabelDimensions(e,a).widthS)break;B+=a[_],_===a.length-1&&(D=!0)}return D||(B+="\u2026"),B}return a},Zc.getLabelJustification=function(e){var t=e.pstyle("text-justification").strValue,n=e.pstyle("text-halign").strValue;if("auto"!==t)return t;if(!e.isNode())return"center";switch(n){case"left":return"right";case"right":return"left";default:return"center"}},Zc.calculateLabelDimensions=function(e,t){var n=this.cy.window().document,r=e.pstyle("font-style").strValue,a=e.pstyle("font-size").pfValue,i=e.pstyle("font-family").strValue,o=e.pstyle("font-weight").strValue,s=this.labelCalcCanvas,l=this.labelCalcCanvasContext;if(!s){s=this.labelCalcCanvas=n.createElement("canvas"),l=this.labelCalcCanvasContext=s.getContext("2d");var u=s.style;u.position="absolute",u.left="-9999px",u.top="-9999px",u.zIndex="-1",u.visibility="hidden",u.pointerEvents="none"}l.font="".concat(r," ").concat(o," ").concat(a,"px ").concat(i);for(var c=0,d=0,h=t.split("\n"),f=0;f1&&void 0!==arguments[1])||arguments[1];if(t.merge(e),n)for(var r=0;r=e.desktopTapThreshold2}var P=a(t);g&&(e.hoverData.tapholdCancelled=!0);n=!0,r(v,["mousemove","vmousemove","tapdrag"],t,{x:c[0],y:c[1]});var S=function(e){return{originalEvent:t,type:e,position:{x:c[0],y:c[1]}}},B=function(){e.data.bgActivePosistion=void 0,e.hoverData.selecting||o.emit(S("boxstart")),p[4]=1,e.hoverData.selecting=!0,e.redrawHint("select",!0),e.redraw()};if(3===e.hoverData.which){if(g){var D=S("cxtdrag");b?b.emit(D):o.emit(D),e.hoverData.cxtDragged=!0,e.hoverData.cxtOver&&v===e.hoverData.cxtOver||(e.hoverData.cxtOver&&e.hoverData.cxtOver.emit(S("cxtdragout")),e.hoverData.cxtOver=v,v&&v.emit(S("cxtdragover")))}}else if(e.hoverData.dragging){if(n=!0,o.panningEnabled()&&o.userPanningEnabled()){var _;if(e.hoverData.justStartedPan){var A=e.hoverData.mdownPos;_={x:(c[0]-A[0])*s,y:(c[1]-A[1])*s},e.hoverData.justStartedPan=!1}else _={x:x[0]*s,y:x[1]*s};o.panBy(_),o.emit(S("dragpan")),e.hoverData.dragged=!0}c=e.projectIntoViewport(t.clientX,t.clientY)}else if(1!=p[4]||null!=b&&!b.pannable()){if(b&&b.pannable()&&b.active()&&b.unactivate(),b&&b.grabbed()||v==y||(y&&r(y,["mouseout","tapdragout"],t,{x:c[0],y:c[1]}),v&&r(v,["mouseover","tapdragover"],t,{x:c[0],y:c[1]}),e.hoverData.last=v),b)if(g){if(o.boxSelectionEnabled()&&P)b&&b.grabbed()&&(d(w),b.emit(S("freeon")),w.emit(S("free")),e.dragData.didDrag&&(b.emit(S("dragfreeon")),w.emit(S("dragfree")))),B();else if(b&&b.grabbed()&&e.nodeIsDraggable(b)){var M=!e.dragData.didDrag;M&&e.redrawHint("eles",!0),e.dragData.didDrag=!0,e.hoverData.draggingEles||u(w,{inDragLayer:!0});var R={x:0,y:0};if(Q(x[0])&&Q(x[1])&&(R.x+=x[0],R.y+=x[1],M)){var I=e.hoverData.dragDelta;I&&Q(I[0])&&Q(I[1])&&(R.x+=I[0],R.y+=I[1])}e.hoverData.draggingEles=!0,w.silentShift(R).emit(S("position")).emit(S("drag")),e.redrawHint("drag",!0),e.redraw()}}else!function(){var t=e.hoverData.dragDelta=e.hoverData.dragDelta||[];0===t.length?(t.push(x[0]),t.push(x[1])):(t[0]+=x[0],t[1]+=x[1])}();n=!0}else if(g){if(e.hoverData.dragging||!o.boxSelectionEnabled()||!P&&o.panningEnabled()&&o.userPanningEnabled()){if(!e.hoverData.selecting&&o.panningEnabled()&&o.userPanningEnabled()){i(b,e.hoverData.downs)&&(e.hoverData.dragging=!0,e.hoverData.justStartedPan=!0,p[4]=0,e.data.bgActivePosistion=Ut(h),e.redrawHint("select",!0),e.redraw())}}else B();b&&b.pannable()&&b.active()&&b.unactivate()}return p[2]=c[0],p[3]=c[1],n?(t.stopPropagation&&t.stopPropagation(),t.preventDefault&&t.preventDefault(),!1):void 0}},!1),e.registerBinding(t,"mouseup",function(t){if((1!==e.hoverData.which||1===t.which||!e.hoverData.capture)&&e.hoverData.capture){e.hoverData.capture=!1;var i=e.cy,o=e.projectIntoViewport(t.clientX,t.clientY),s=e.selection,l=e.findNearestElement(o[0],o[1],!0,!1),u=e.dragData.possibleDragElements,c=e.hoverData.down,h=a(t);e.data.bgActivePosistion&&(e.redrawHint("select",!0),e.redraw()),e.hoverData.tapholdCancelled=!0,e.data.bgActivePosistion=void 0,c&&c.unactivate();var f=function(e){return{originalEvent:t,type:e,position:{x:o[0],y:o[1]}}};if(3===e.hoverData.which){var p=f("cxttapend");if(c?c.emit(p):i.emit(p),!e.hoverData.cxtDragged){var v=f("cxttap");c?c.emit(v):i.emit(v)}e.hoverData.cxtDragged=!1,e.hoverData.which=null}else if(1===e.hoverData.which){if(r(l,["mouseup","tapend","vmouseup"],t,{x:o[0],y:o[1]}),e.dragData.didDrag||e.hoverData.dragged||e.hoverData.selecting||e.hoverData.isOverThresholdDrag||(r(c,["click","tap","vclick"],t,{x:o[0],y:o[1]}),x=!1,t.timeStamp-w<=i.multiClickDebounceTime()?(b&&clearTimeout(b),x=!0,w=null,r(c,["dblclick","dbltap","vdblclick"],t,{x:o[0],y:o[1]})):(b=setTimeout(function(){x||r(c,["oneclick","onetap","voneclick"],t,{x:o[0],y:o[1]})},i.multiClickDebounceTime()),w=t.timeStamp)),null!=c||e.dragData.didDrag||e.hoverData.selecting||e.hoverData.dragged||a(t)||(i.$(n).unselect(["tapunselect"]),u.length>0&&e.redrawHint("eles",!0),e.dragData.possibleDragElements=u=i.collection()),l!=c||e.dragData.didDrag||e.hoverData.selecting||null!=l&&l._private.selectable&&(e.hoverData.dragging||("additive"===i.selectionType()||h?l.selected()?l.unselect(["tapunselect"]):l.select(["tapselect"]):h||(i.$(n).unmerge(l).unselect(["tapunselect"]),l.select(["tapselect"]))),e.redrawHint("eles",!0)),e.hoverData.selecting){var g=i.collection(e.getAllInBox(s[0],s[1],s[2],s[3]));e.redrawHint("select",!0),g.length>0&&e.redrawHint("eles",!0),i.emit(f("boxend"));var y=function(e){return e.selectable()&&!e.selected()};"additive"===i.selectionType()||h||i.$(n).unmerge(g).unselect(),g.emit(f("box")).stdFilter(y).select().emit(f("boxselect")),e.redraw()}if(e.hoverData.dragging&&(e.hoverData.dragging=!1,e.redrawHint("select",!0),e.redrawHint("eles",!0),e.redraw()),!s[4]){e.redrawHint("drag",!0),e.redrawHint("eles",!0);var m=c&&c.grabbed();d(u),m&&(c.emit(f("freeon")),u.emit(f("free")),e.dragData.didDrag&&(c.emit(f("dragfreeon")),u.emit(f("dragfree"))))}}s[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 k,T,C,P,S,B,D,_,A,M,R,I,N,L,z=[],O=1e5,V=function(t){var n=!1,r=t.deltaY;if(null==r&&(null!=t.wheelDeltaY?r=t.wheelDeltaY/4:null!=t.wheelDelta&&(r=t.wheelDelta/4)),0!==r){if(null==k)if(z.length>=4){var a=z;if(k=function(e,t){for(var n=0;n5}if(k)for(var o=0;o5&&(r=5*Gt(r)),h=r/-250,k&&(h/=O,h*=3),h*=e.wheelSensitivity,1===t.deltaMode&&(h*=33);var f=s.zoom()*Math.pow(10,h);"gesturechange"===t.type&&(f=e.gestureStartZoom*t.scale),s.zoom({level:f,renderedPosition:{x:d[0],y:d[1]}}),s.emit({type:"gesturechange"===t.type?"pinchzoom":"scrollzoom",originalEvent:t,position:{x:c[0],y:c[1]}})}}}};e.registerBinding(e.container,"wheel",V,!0),e.registerBinding(t,"scroll",function(t){e.scrollingPage=!0,clearTimeout(e.scrollingPageTimeout),e.scrollingPageTimeout=setTimeout(function(){e.scrollingPage=!1},250)},!0),e.registerBinding(e.container,"gesturestart",function(t){e.gestureStartZoom=e.cy.zoom(),e.hasTouchStarted||t.preventDefault()},!0),e.registerBinding(e.container,"gesturechange",function(t){e.hasTouchStarted||V(t)},!0),e.registerBinding(e.container,"mouseout",function(t){var n=e.projectIntoViewport(t.clientX,t.clientY);e.cy.emit({originalEvent:t,type:"mouseout",position:{x:n[0],y:n[1]}})},!1),e.registerBinding(e.container,"mouseover",function(t){var n=e.projectIntoViewport(t.clientX,t.clientY);e.cy.emit({originalEvent:t,type:"mouseover",position:{x:n[0],y:n[1]}})},!1);var F,X,j,Y,q,W,U,H=function(e,t,n,r){return Math.sqrt((n-e)*(n-e)+(r-t)*(r-t))},K=function(e,t,n,r){return(n-e)*(n-e)+(r-t)*(r-t)};if(e.registerBinding(e.container,"touchstart",F=function(t){if(e.hasTouchStarted=!0,m(t)){f(),e.touchData.capture=!0,e.data.bgActivePosistion=void 0;var n=e.cy,a=e.touchData.now,i=e.touchData.earlier;if(t.touches[0]){var o=e.projectIntoViewport(t.touches[0].clientX,t.touches[0].clientY);a[0]=o[0],a[1]=o[1]}if(t.touches[1]){o=e.projectIntoViewport(t.touches[1].clientX,t.touches[1].clientY);a[2]=o[0],a[3]=o[1]}if(t.touches[2]){o=e.projectIntoViewport(t.touches[2].clientX,t.touches[2].clientY);a[4]=o[0],a[5]=o[1]}var l=function(e){return{originalEvent:t,type:e,position:{x:a[0],y:a[1]}}};if(t.touches[1]){e.touchData.singleTouchMoved=!0,d(e.dragData.touchDragEles);var h=e.findContainerClientCoords();M=h[0],R=h[1],I=h[2],N=h[3],T=t.touches[0].clientX-M,C=t.touches[0].clientY-R,P=t.touches[1].clientX-M,S=t.touches[1].clientY-R,L=0<=T&&T<=I&&0<=P&&P<=I&&0<=C&&C<=N&&0<=S&&S<=N;var p=n.pan(),v=n.zoom();B=H(T,C,P,S),D=K(T,C,P,S),A=[((_=[(T+P)/2,(C+S)/2])[0]-p.x)/v,(_[1]-p.y)/v];if(D<4e4&&!t.touches[2]){var g=e.findNearestElement(a[0],a[1],!0,!0),y=e.findNearestElement(a[2],a[3],!0,!0);return g&&g.isNode()?(g.activate().emit(l("cxttapstart")),e.touchData.start=g):y&&y.isNode()?(y.activate().emit(l("cxttapstart")),e.touchData.start=y):n.emit(l("cxttapstart")),e.touchData.start&&(e.touchData.start._private.grabbed=!1),e.touchData.cxt=!0,e.touchData.cxtDragged=!1,e.data.bgActivePosistion=void 0,void e.redraw()}}if(t.touches[2])n.boxSelectionEnabled()&&t.preventDefault();else if(t.touches[1]);else if(t.touches[0]){var b=e.findNearestElements(a[0],a[1],!0,!0),x=b[0];if(null!=x&&(x.activate(),e.touchData.start=x,e.touchData.starts=b,e.nodeIsGrabbable(x))){var w=e.dragData.touchDragEles=n.collection(),E=null;e.redrawHint("eles",!0),e.redrawHint("drag",!0),x.selected()?(E=n.$(function(t){return t.selected()&&e.nodeIsGrabbable(t)}),u(E,{addToList:w})):c(x,{addToList:w}),s(x),x.emit(l("grabon")),E?E.forEach(function(e){e.emit(l("grab"))}):x.emit(l("grab"))}r(x,["touchstart","tapstart","vmousedown"],t,{x:a[0],y:a[1]}),null==x&&(e.data.bgActivePosistion={x:o[0],y:o[1]},e.redrawHint("select",!0),e.redraw()),e.touchData.singleTouchMoved=!1,e.touchData.singleTouchStartTime=+new Date,clearTimeout(e.touchData.tapholdTimeout),e.touchData.tapholdTimeout=setTimeout(function(){!1!==e.touchData.singleTouchMoved||e.pinching||e.touchData.selecting||r(e.touchData.start,["taphold"],t,{x:a[0],y:a[1]})},e.tapholdDuration)}if(t.touches.length>=1){for(var k=e.touchData.startPosition=[null,null,null,null,null,null],z=0;z=e.touchTapThreshold2}if(n&&e.touchData.cxt){t.preventDefault();var E=t.touches[0].clientX-M,k=t.touches[0].clientY-R,_=t.touches[1].clientX-M,I=t.touches[1].clientY-R,N=K(E,k,_,I);if(N/D>=2.25||N>=22500){e.touchData.cxt=!1,e.data.bgActivePosistion=void 0,e.redrawHint("select",!0);var z=p("cxttapend");e.touchData.start?(e.touchData.start.unactivate().emit(z),e.touchData.start=null):o.emit(z)}}if(n&&e.touchData.cxt){z=p("cxtdrag");e.data.bgActivePosistion=void 0,e.redrawHint("select",!0),e.touchData.start?e.touchData.start.emit(z):o.emit(z),e.touchData.start&&(e.touchData.start._private.grabbed=!1),e.touchData.cxtDragged=!0;var O=e.findNearestElement(s[0],s[1],!0,!0);e.touchData.cxtOver&&O===e.touchData.cxtOver||(e.touchData.cxtOver&&e.touchData.cxtOver.emit(p("cxtdragout")),e.touchData.cxtOver=O,O&&O.emit(p("cxtdragover")))}else if(n&&t.touches[2]&&o.boxSelectionEnabled())t.preventDefault(),e.data.bgActivePosistion=void 0,this.lastThreeTouch=+new Date,e.touchData.selecting||o.emit(p("boxstart")),e.touchData.selecting=!0,e.touchData.didSelect=!0,a[4]=1,a&&0!==a.length&&void 0!==a[0]?(a[2]=(s[0]+s[2]+s[4])/3,a[3]=(s[1]+s[3]+s[5])/3):(a[0]=(s[0]+s[2]+s[4])/3,a[1]=(s[1]+s[3]+s[5])/3,a[2]=(s[0]+s[2]+s[4])/3+1,a[3]=(s[1]+s[3]+s[5])/3+1),e.redrawHint("select",!0),e.redraw();else if(n&&t.touches[1]&&!e.touchData.didSelect&&o.zoomingEnabled()&&o.panningEnabled()&&o.userZoomingEnabled()&&o.userPanningEnabled()){if(t.preventDefault(),e.data.bgActivePosistion=void 0,e.redrawHint("select",!0),te=e.dragData.touchDragEles){e.redrawHint("drag",!0);for(var V=0;V0&&!e.hoverData.draggingEles&&!e.swipePanning&&null!=e.data.bgActivePosistion&&(e.data.bgActivePosistion=void 0,e.redrawHint("select",!0),e.redraw())}},!1),e.registerBinding(t,"touchcancel",j=function(t){var n=e.touchData.start;e.touchData.capture=!1,n&&n.unactivate()}),e.registerBinding(t,"touchend",Y=function(t){var a=e.touchData.start;if(e.touchData.capture){0===t.touches.length&&(e.touchData.capture=!1),t.preventDefault();var i=e.selection;e.swipePanning=!1,e.hoverData.draggingEles=!1;var o=e.cy,s=o.zoom(),l=e.touchData.now,u=e.touchData.earlier;if(t.touches[0]){var c=e.projectIntoViewport(t.touches[0].clientX,t.touches[0].clientY);l[0]=c[0],l[1]=c[1]}if(t.touches[1]){c=e.projectIntoViewport(t.touches[1].clientX,t.touches[1].clientY);l[2]=c[0],l[3]=c[1]}if(t.touches[2]){c=e.projectIntoViewport(t.touches[2].clientX,t.touches[2].clientY);l[4]=c[0],l[5]=c[1]}var h,f=function(e){return{originalEvent:t,type:e,position:{x:l[0],y:l[1]}}};if(a&&a.unactivate(),e.touchData.cxt){if(h=f("cxttapend"),a?a.emit(h):o.emit(h),!e.touchData.cxtDragged){var p=f("cxttap");a?a.emit(p):o.emit(p)}return e.touchData.start&&(e.touchData.start._private.grabbed=!1),e.touchData.cxt=!1,e.touchData.start=null,void e.redraw()}if(!t.touches[2]&&o.boxSelectionEnabled()&&e.touchData.selecting){e.touchData.selecting=!1;var v=o.collection(e.getAllInBox(i[0],i[1],i[2],i[3]));i[0]=void 0,i[1]=void 0,i[2]=void 0,i[3]=void 0,i[4]=0,e.redrawHint("select",!0),o.emit(f("boxend"));v.emit(f("box")).stdFilter(function(e){return e.selectable()&&!e.selected()}).select().emit(f("boxselect")),v.nonempty()&&e.redrawHint("eles",!0),e.redraw()}if(null!=a&&a.unactivate(),t.touches[2])e.data.bgActivePosistion=void 0,e.redrawHint("select",!0);else if(t.touches[1]);else if(t.touches[0]);else if(!t.touches[0]){e.data.bgActivePosistion=void 0,e.redrawHint("select",!0);var g=e.dragData.touchDragEles;if(null!=a){var y=a._private.grabbed;d(g),e.redrawHint("drag",!0),e.redrawHint("eles",!0),y&&(a.emit(f("freeon")),g.emit(f("free")),e.dragData.didDrag&&(a.emit(f("dragfreeon")),g.emit(f("dragfree")))),r(a,["touchend","tapend","vmouseup","tapdragout"],t,{x:l[0],y:l[1]}),a.unactivate(),e.touchData.start=null}else{var m=e.findNearestElement(l[0],l[1],!0,!0);r(m,["touchend","tapend","vmouseup","tapdragout"],t,{x:l[0],y:l[1]})}var b=e.touchData.startPosition[0]-l[0],x=b*b,w=e.touchData.startPosition[1]-l[1],E=(x+w*w)*s*s;e.touchData.singleTouchMoved||(a||o.$(":selected").unselect(["tapunselect"]),r(a,["tap","vclick"],t,{x:l[0],y:l[1]}),q=!1,t.timeStamp-U<=o.multiClickDebounceTime()?(W&&clearTimeout(W),q=!0,U=null,r(a,["dbltap","vdblclick"],t,{x:l[0],y:l[1]})):(W=setTimeout(function(){q||r(a,["onetap","voneclick"],t,{x:l[0],y:l[1]})},o.multiClickDebounceTime()),U=t.timeStamp)),null!=a&&!e.dragData.didDrag&&a._private.selectable&&E2){for(var f=[c[0],c[1]],p=Math.pow(f[0]-e,2)+Math.pow(f[1]-t,2),v=1;v0)return v[0]}return null},f=Object.keys(d),p=0;p0?u:vn(a,i,e,t,n,r,o,s)},checkPoint:function(e,t,n,r,a,i,o,s){var l=2*(s="auto"===s?In(r,a):s);if(wn(e,t,this.points,i,o,r,a-l,[0,-1],n))return!0;if(wn(e,t,this.points,i,o,r-l,a,[0,-1],n))return!0;var u=r/2+2*n,c=a/2+2*n;return!!xn(e,t,[i-u,o-c,i-u,o,i+u,o,i+u,o-c])||(!!Tn(e,t,l,l,i+r/2-s,o+a/2-s,n)||!!Tn(e,t,l,l,i-r/2+s,o+a/2-s,n))}}},sd.registerNodeShapes=function(){var e=this.nodeShapes={},t=this;this.generateEllipse(),this.generatePolygon("triangle",An(3,0)),this.generateRoundPolygon("round-triangle",An(3,0)),this.generatePolygon("rectangle",An(4,0)),e.square=e.rectangle,this.generateRoundRectangle(),this.generateCutRectangle(),this.generateBarrel(),this.generateBottomRoundrectangle();var n=[0,1,1,0,0,-1,-1,0];this.generatePolygon("diamond",n),this.generateRoundPolygon("round-diamond",n),this.generatePolygon("pentagon",An(5,0)),this.generateRoundPolygon("round-pentagon",An(5,0)),this.generatePolygon("hexagon",An(6,0)),this.generateRoundPolygon("round-hexagon",An(6,0)),this.generatePolygon("heptagon",An(7,0)),this.generateRoundPolygon("round-heptagon",An(7,0)),this.generatePolygon("octagon",An(8,0)),this.generateRoundPolygon("round-octagon",An(8,0));var r=new Array(20),a=Rn(5,0),i=Rn(5,Math.PI/5),o=.5*(3-Math.sqrt(5));o*=1.57;for(var s=0;s=e.deqFastCost*v)break}else if(a){if(f>=e.deqCost*l||f>=e.deqAvgCost*s)break}else if(p>=e.deqNoDrawCost*hd)break;var g=e.deq(t,d,c);if(!(g.length>0))break;for(var y=0;y0&&(e.onDeqd(t,u),!a&&e.shouldRedraw(t,u,d,c)&&r())},a(t))}}},pd=function(){return i(function e(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:nt;a(this,e),this.idsByKey=new yt,this.keyForId=new yt,this.cachesByLvl=new yt,this.lvls=[],this.getKey=t,this.doesEleInvalidateKey=n},[{key:"getIdsFor",value:function(e){null==e&&it("Can not get id list for null key");var t=this.idsByKey,n=this.idsByKey.get(e);return n||(n=new bt,t.set(e,n)),n}},{key:"addIdForKey",value:function(e,t){null!=e&&this.getIdsFor(e).add(t)}},{key:"deleteIdForKey",value:function(e,t){null!=e&&this.getIdsFor(e).delete(t)}},{key:"getNumberOfIdsForKey",value:function(e){return null==e?0:this.getIdsFor(e).size}},{key:"updateKeyMappingFor",value:function(e){var t=e.id(),n=this.keyForId.get(t),r=this.getKey(e);this.deleteIdForKey(n,t),this.addIdForKey(r,t),this.keyForId.set(t,r)}},{key:"deleteKeyMappingFor",value:function(e){var t=e.id(),n=this.keyForId.get(t);this.deleteIdForKey(n,t),this.keyForId.delete(t)}},{key:"keyHasChangedFor",value:function(e){var t=e.id();return this.keyForId.get(t)!==this.getKey(e)}},{key:"isInvalid",value:function(e){return this.keyHasChangedFor(e)||this.doesEleInvalidateKey(e)}},{key:"getCachesAt",value:function(e){var t=this.cachesByLvl,n=this.lvls,r=t.get(e);return r||(r=new yt,t.set(e,r),n.push(e)),r}},{key:"getCache",value:function(e,t){return this.getCachesAt(t).get(e)}},{key:"get",value:function(e,t){var n=this.getKey(e),r=this.getCache(n,t);return null!=r&&this.updateKeyMappingFor(e),r}},{key:"getForCachedKey",value:function(e,t){var n=this.keyForId.get(e.id());return this.getCache(n,t)}},{key:"hasCache",value:function(e,t){return this.getCachesAt(t).has(e)}},{key:"has",value:function(e,t){var n=this.getKey(e);return this.hasCache(n,t)}},{key:"setCache",value:function(e,t,n){n.key=e,this.getCachesAt(t).set(e,n)}},{key:"set",value:function(e,t,n){var r=this.getKey(e);this.setCache(r,t,n),this.updateKeyMappingFor(e)}},{key:"deleteCache",value:function(e,t){this.getCachesAt(t).delete(e)}},{key:"delete",value:function(e,t){var n=this.getKey(e);this.deleteCache(n,t)}},{key:"invalidateKey",value:function(e){var t=this;this.lvls.forEach(function(n){return t.deleteCache(e,n)})}},{key:"invalidate",value:function(e){var t=e.id(),n=this.keyForId.get(t);this.deleteKeyMappingFor(e);var r=this.doesEleInvalidateKey(e);return r&&this.invalidateKey(n),r||0===this.getNumberOfIdsForKey(n)}}])}(),vd=7.99,gd={dequeue:"dequeue",downscale:"downscale",highQuality:"highQuality"},yd=ht({getKey:null,doesEleInvalidateKey:nt,drawElement:null,getBoundingBox:null,getRotationPoint:null,getRotationOffset:null,isVisible:tt,allowEdgeTxrCaching:!0,allowParentTxrCaching:!0}),md=function(e,t){var n=this;n.renderer=e,n.onDequeues=[];var r=yd(t);be(n,r),n.lookup=new pd(r.getKey,r.doesEleInvalidateKey),n.setupDequeueing()},bd=md.prototype;bd.reasons=gd,bd.getTextureQueue=function(e){var t=this;return t.eleImgCaches=t.eleImgCaches||{},t.eleImgCaches[e]=t.eleImgCaches[e]||[]},bd.getRetiredTextureQueue=function(e){var t=this.eleImgCaches.retired=this.eleImgCaches.retired||{};return t[e]=t[e]||[]},bd.getElementQueue=function(){return this.eleCacheQueue=this.eleCacheQueue||new _t(function(e,t){return t.reqs-e.reqs})},bd.getElementKeyToQueue=function(){return this.eleKeyToCacheQueue=this.eleKeyToCacheQueue||{}},bd.getElement=function(e,t,n,r,a){var i=this,o=this.renderer,s=o.cy.zoom(),l=this.lookup;if(!t||0===t.w||0===t.h||isNaN(t.w)||isNaN(t.h)||!e.visible()||e.removed())return null;if(!i.allowEdgeTxrCaching&&e.isEdge()||!i.allowParentTxrCaching&&e.isParent())return null;if(null==r&&(r=Math.ceil(Kt(s*n))),r<-4)r=-4;else if(s>=7.99||r>3)return null;var u=Math.pow(2,r),c=t.h*u,d=t.w*u,h=o.eleTextBiggerThanMin(e,u);if(!this.isVisible(e,h))return null;var f,p=l.get(e,r);if(p&&p.invalidated&&(p.invalidated=!1,p.texture.invalidatedWidth-=p.width),p)return p;if(f=c<=25?25:c<=50?50:50*Math.ceil(c/50),c>1024||d>1024)return null;var v=i.getTextureQueue(f),g=v[v.length-2],y=function(){return i.recycleTexture(f,d)||i.addTexture(f,d)};g||(g=v[v.length-1]),g||(g=y()),g.width-g.usedWidthr;S--)C=i.getElement(e,t,n,S,gd.downscale);P()}else{var B;if(!x&&!w&&!E)for(var D=r-1;D>=-4;D--){var _=l.get(e,D);if(_){B=_;break}}if(b(B))return i.queueElement(e,r),B;g.context.translate(g.usedWidth,0),g.context.scale(u,u),this.drawElement(g.context,e,t,h,!1),g.context.scale(1/u,1/u),g.context.translate(-g.usedWidth,0)}return p={x:g.usedWidth,texture:g,level:r,scale:u,width:d,height:c,scaledLabelShown:h},g.usedWidth+=Math.ceil(d+8),g.eleCaches.push(p),l.set(e,r,p),i.checkTextureFullness(g),p},bd.invalidateElements=function(e){for(var t=0;t=.2*e.width&&this.retireTexture(e)},bd.checkTextureFullness=function(e){var t=this.getTextureQueue(e.height);e.usedWidth/e.width>.8&&e.fullnessChecks>=10?ft(t,e):e.fullnessChecks++},bd.retireTexture=function(e){var t=e.height,n=this.getTextureQueue(t),r=this.lookup;ft(n,e),e.retired=!0;for(var a=e.eleCaches,i=0;i=t)return i.retired=!1,i.usedWidth=0,i.invalidatedWidth=0,i.fullnessChecks=0,pt(i.eleCaches),i.context.setTransform(1,0,0,1,0,0),i.context.clearRect(0,0,i.width,i.height),ft(r,i),n.push(i),i}},bd.queueElement=function(e,t){var n=this.getElementQueue(),r=this.getElementKeyToQueue(),a=this.getKey(e),i=r[a];if(i)i.level=Math.max(i.level,t),i.eles.merge(e),i.reqs++,n.updateItem(i);else{var o={eles:e.spawn().merge(e),level:t,reqs:1,key:a};n.push(o),r[a]=o}},bd.dequeue=function(e){for(var t=this,n=t.getElementQueue(),r=t.getElementKeyToQueue(),a=[],i=t.lookup,o=0;o<1&&n.size()>0;o++){var s=n.pop(),l=s.key,u=s.eles[0],c=i.hasCache(u,s.level);if(r[l]=null,!c){a.push(s);var d=t.getBoundingBox(u);t.getElement(u,d,e,s.level,gd.dequeue)}}return a},bd.removeFromQueue=function(e){var t=this.getElementQueue(),n=this.getElementKeyToQueue(),r=this.getKey(e),a=n[r];null!=a&&(1===a.eles.length?(a.reqs=et,t.updateItem(a),t.pop(),n[r]=null):a.eles.unmerge(e))},bd.onDequeue=function(e){this.onDequeues.push(e)},bd.offDequeue=function(e){ft(this.onDequeues,e)},bd.setupDequeueing=fd({deqRedrawThreshold:100,deqCost:.15,deqAvgCost:.1,deqNoDrawCost:.9,deqFastCost:.9,deq:function(e,t,n){return e.dequeue(t,n)},onDeqd:function(e,t){for(var n=0;n=3.99||n>2)return null;r.validateLayersElesOrdering(n,e);var o,s,l=r.layersByLevel,u=Math.pow(2,n),c=l[n]=l[n]||[];if(r.levelIsComplete(n,e))return c;!function(){var t=function(t){if(r.validateLayersElesOrdering(t,e),r.levelIsComplete(t,e))return s=l[t],!0},a=function(e){if(!s)for(var r=n+e;-4<=r&&r<=2&&!t(r);r+=e);};a(1),a(-1);for(var i=c.length-1;i>=0;i--){var o=c[i];o.invalid&&ft(c,o)}}();var d=function(t){var a=(t=t||{}).after;!function(){if(!o){o=nn();for(var t=0;t32767||s>32767)return null;if(i*s>16e6)return null;var l=r.makeLayer(o,n);if(null!=a){var d=c.indexOf(a)+1;c.splice(d,0,l)}else(void 0===t.insert||t.insert)&&c.unshift(l);return l};if(r.skipping&&!i)return null;for(var h=null,f=e.length/1,p=!i,v=0;v=f||!hn(h.bb,g.boundingBox()))&&!(h=d({insert:!0,after:h})))return null;s||p?r.queueLayer(h,g):r.drawEleInLayer(h,g,n,t),h.eles.push(g),m[n]=h}}return s||(p?null:c)},wd.getEleLevelForLayerLevel=function(e,t){return e},wd.drawEleInLayer=function(e,t,n,r){var a=this.renderer,i=e.context,o=t.boundingBox();0!==o.w&&0!==o.h&&t.visible()&&(n=this.getEleLevelForLayerLevel(n,r),a.setImgSmoothing(i,!1),a.drawCachedElement(i,t,null,null,n,true),a.setImgSmoothing(i,!0))},wd.levelIsComplete=function(e,t){var n=this.layersByLevel[e];if(!n||0===n.length)return!1;for(var r=0,a=0;a0)return!1;if(i.invalid)return!1;r+=i.eles.length}return r===t.length},wd.validateLayersElesOrdering=function(e,t){var n=this.layersByLevel[e];if(n)for(var r=0;r0){e=!0;break}}return e},wd.invalidateElements=function(e){var t=this;0!==e.length&&(t.lastInvalidationTime=Oe(),0!==e.length&&t.haveLayers()&&t.updateElementsInLayers(e,function(e,n,r){t.invalidateLayer(e)}))},wd.invalidateLayer=function(e){if(this.lastInvalidationTime=Oe(),!e.invalid){var t=e.level,n=e.eles,r=this.layersByLevel[t];ft(r,e),e.elesQueue=[],e.invalid=!0,e.replacement&&(e.replacement.invalid=!0);for(var a=0;a3&&void 0!==arguments[3])||arguments[3],a=!(arguments.length>4&&void 0!==arguments[4])||arguments[4],i=!(arguments.length>5&&void 0!==arguments[5])||arguments[5],o=this,s=t._private.rscratch;if((!i||t.visible())&&!s.badLine&&null!=s.allpts&&!isNaN(s.allpts[0])){var l;n&&(l=n,e.translate(-l.x1,-l.y1));var u=i?t.pstyle("opacity").value:1,c=i?t.pstyle("line-opacity").value:1,d=t.pstyle("curve-style").value,h=t.pstyle("line-style").value,f=t.pstyle("width").pfValue,p=t.pstyle("line-cap").value,v=t.pstyle("line-outline-width").value,g=t.pstyle("line-outline-color").value,y=u*c,m=u*c,b=function(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:y;"straight-triangle"===d?(o.eleStrokeStyle(e,t,n),o.drawEdgeTrianglePath(t,e,s.allpts)):(e.lineWidth=f,e.lineCap=p,o.eleStrokeStyle(e,t,n),o.drawEdgePath(t,e,s.allpts,h),e.lineCap="butt")},x=function(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:m;o.drawArrowheads(e,t,n)};if(e.lineJoin="round","yes"===t.pstyle("ghost").value){var w=t.pstyle("ghost-offset-x").pfValue,E=t.pstyle("ghost-offset-y").pfValue,k=t.pstyle("ghost-opacity").value,T=y*k;e.translate(w,E),b(T),x(T),e.translate(-w,-E)}else!function(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:y;e.lineWidth=f+v,e.lineCap=p,v>0?(o.colorStrokeStyle(e,g[0],g[1],g[2],n),"straight-triangle"===d?o.drawEdgeTrianglePath(t,e,s.allpts):(o.drawEdgePath(t,e,s.allpts,h),e.lineCap="butt")):e.lineCap="butt"}();a&&o.drawEdgeUnderlay(e,t),b(),x(),a&&o.drawEdgeOverlay(e,t),o.drawElementText(e,t,null,r),n&&e.translate(l.x1,l.y1)}}},Vd=function(e){if(!["overlay","underlay"].includes(e))throw new Error("Invalid state");return function(t,n){if(n.visible()){var r=n.pstyle("".concat(e,"-opacity")).value;if(0!==r){var a=this,i=a.usePaths(),o=n._private.rscratch,s=2*n.pstyle("".concat(e,"-padding")).pfValue,l=n.pstyle("".concat(e,"-color")).value;t.lineWidth=s,"self"!==o.edgeType||i?t.lineCap="round":t.lineCap="butt",a.colorStrokeStyle(t,l[0],l[1],l[2],r),a.drawEdgePath(n,t,o.allpts,"solid")}}}};Od.drawEdgeOverlay=Vd("overlay"),Od.drawEdgeUnderlay=Vd("underlay"),Od.drawEdgePath=function(e,t,n,r){var a,i=e._private.rscratch,s=t,l=!1,u=this.usePaths(),c=e.pstyle("line-dash-pattern").pfValue,d=e.pstyle("line-dash-offset").pfValue;if(u){var h=n.join("$");i.pathCacheKey&&i.pathCacheKey===h?(a=t=i.pathCache,l=!0):(a=t=new Path2D,i.pathCacheKey=h,i.pathCache=a)}if(s.setLineDash)switch(r){case"dotted":s.setLineDash([1,1]);break;case"dashed":s.setLineDash(c),s.lineDashOffset=d;break;case"solid":s.setLineDash([])}if(!l&&!i.badLine)switch(t.beginPath&&t.beginPath(),t.moveTo(n[0],n[1]),i.edgeType){case"bezier":case"self":case"compound":case"multibezier":for(var f=2;f+35&&void 0!==arguments[5]?arguments[5]:5,o=Math.min(i,r/2,a/2);e.beginPath(),e.moveTo(t+o,n),e.lineTo(t+r-o,n),e.quadraticCurveTo(t+r,n,t+r,n+o),e.lineTo(t+r,n+a-o),e.quadraticCurveTo(t+r,n+a,t+r-o,n+a),e.lineTo(t+o,n+a),e.quadraticCurveTo(t,n+a,t,n+a-o),e.lineTo(t,n+o),e.quadraticCurveTo(t,n,t+o,n),e.closePath()}Xd.eleTextBiggerThanMin=function(e,t){if(!t){var n=e.cy().zoom(),r=this.getPixelRatio(),a=Math.ceil(Kt(n*r));t=Math.pow(2,a)}return!(e.pstyle("font-size").pfValue*t5&&void 0!==arguments[5])||arguments[5],o=this;if(null==r){if(i&&!o.eleTextBiggerThanMin(t))return}else if(!1===r)return;if(t.isNode()){var s=t.pstyle("label");if(!s||!s.value)return;var l=o.getLabelJustification(t);e.textAlign=l,e.textBaseline="bottom"}else{var u=t.element()._private.rscratch.badLine,c=t.pstyle("label"),d=t.pstyle("source-label"),h=t.pstyle("target-label");if(u||(!c||!c.value)&&(!d||!d.value)&&(!h||!h.value))return;e.textAlign="center",e.textBaseline="bottom"}var f,p=!n;n&&(f=n,e.translate(-f.x1,-f.y1)),null==a?(o.drawText(e,t,null,p,i),t.isEdge()&&(o.drawText(e,t,"source",p,i),o.drawText(e,t,"target",p,i))):o.drawText(e,t,a,p,i),n&&e.translate(f.x1,f.y1)},Xd.getFontCache=function(e){var t;this.fontCaches=this.fontCaches||[];for(var n=0;n2&&void 0!==arguments[2])||arguments[2],r=t.pstyle("font-style").strValue,a=t.pstyle("font-size").pfValue+"px",i=t.pstyle("font-family").strValue,o=t.pstyle("font-weight").strValue,s=n?t.effectiveOpacity()*t.pstyle("text-opacity").value:1,l=t.pstyle("text-outline-opacity").value*s,u=t.pstyle("color").value,c=t.pstyle("text-outline-color").value;e.font=r+" "+o+" "+a+" "+i,e.lineJoin="round",this.colorFillStyle(e,u[0],u[1],u[2],s),this.colorStrokeStyle(e,c[0],c[1],c[2],l)},Xd.getTextAngle=function(e,t){var n,r=e._private.rscratch,a=t?t+"-":"",i=e.pstyle(a+"text-rotation");if("autorotate"===i.strValue){var o=vt(r,"labelAngle",t);n=e.isEdge()?o:0}else n="none"===i.strValue?0:i.pfValue;return n},Xd.drawText=function(e,t,n){var r=!(arguments.length>3&&void 0!==arguments[3])||arguments[3],a=!(arguments.length>4&&void 0!==arguments[4])||arguments[4],i=t._private.rscratch,o=a?t.effectiveOpacity():1;if(!a||0!==o&&0!==t.pstyle("text-opacity").value){"main"===n&&(n=null);var s,l,u=vt(i,"labelX",n),c=vt(i,"labelY",n),d=this.getLabelText(t,n);if(null!=d&&""!==d&&!isNaN(u)&&!isNaN(c)){this.setupTextStyle(e,t,a);var h,f=n?n+"-":"",p=vt(i,"labelWidth",n),v=vt(i,"labelHeight",n),g=t.pstyle(f+"text-margin-x").pfValue,y=t.pstyle(f+"text-margin-y").pfValue,m=t.isEdge(),b=t.pstyle("text-halign").value,x=t.pstyle("text-valign").value;switch(m&&(b="center",x="center"),u+=g,c+=y,0!==(h=r?this.getTextAngle(t,n):0)&&(s=u,l=c,e.translate(s,l),e.rotate(h),u=0,c=0),x){case"top":break;case"center":c+=v/2;break;case"bottom":c+=v}var w=t.pstyle("text-background-opacity").value,E=t.pstyle("text-border-opacity").value,k=t.pstyle("text-border-width").pfValue,T=t.pstyle("text-background-padding").pfValue,C=t.pstyle("text-background-shape").strValue,P="round-rectangle"===C||"roundrectangle"===C,S="circle"===C;if(w>0||k>0&&E>0){var B=e.fillStyle,D=e.strokeStyle,_=e.lineWidth,A=t.pstyle("text-background-color").value,M=t.pstyle("text-border-color").value,R=t.pstyle("text-border-style").value,I=w>0,N=k>0&&E>0,L=u-T;switch(b){case"left":L-=p;break;case"center":L-=p/2}var z=c-v-T,O=p+2*T,V=v+2*T;if(I&&(e.fillStyle="rgba(".concat(A[0],",").concat(A[1],",").concat(A[2],",").concat(w*o,")")),N&&(e.strokeStyle="rgba(".concat(M[0],",").concat(M[1],",").concat(M[2],",").concat(E*o,")"),e.lineWidth=k,e.setLineDash))switch(R){case"dotted":e.setLineDash([1,1]);break;case"dashed":e.setLineDash([4,2]);break;case"double":e.lineWidth=k/4,e.setLineDash([]);break;default:e.setLineDash([])}if(P?(e.beginPath(),jd(e,L,z,O,V,2)):S?(e.beginPath(),function(e,t,n,r,a){var i=Math.min(r,a)/2,o=t+r/2,s=n+a/2;e.beginPath(),e.arc(o,s,i,0,2*Math.PI),e.closePath()}(e,L,z,O,V)):(e.beginPath(),e.rect(L,z,O,V)),I&&e.fill(),N&&e.stroke(),N&&"double"===R){var F=k/2;e.beginPath(),P?jd(e,L+F,z+F,O-2*F,V-2*F,2):e.rect(L+F,z+F,O-2*F,V-2*F),e.stroke()}e.fillStyle=B,e.strokeStyle=D,e.lineWidth=_,e.setLineDash&&e.setLineDash([])}var X=2*t.pstyle("text-outline-width").pfValue;if(X>0&&(e.lineWidth=X),"wrap"===t.pstyle("text-wrap").value){var j=vt(i,"labelWrapCachedLines",n),Y=vt(i,"labelLineHeight",n),q=p/2,W=this.getLabelJustification(t);switch("auto"===W||("left"===b?"left"===W?u+=-p:"center"===W&&(u+=-q):"center"===b?"left"===W?u+=-q:"right"===W&&(u+=q):"right"===b&&("center"===W?u+=q:"right"===W&&(u+=p))),x){case"top":case"center":case"bottom":c-=(j.length-1)*Y}for(var U=0;U0&&e.strokeText(j[U],u,c),e.fillText(j[U],u,c),c+=Y}else X>0&&e.strokeText(d,u,c),e.fillText(d,u,c);0!==h&&(e.rotate(-h),e.translate(-s,-l))}}};var Yd={drawNode:function(e,t,n){var r,a,i=!(arguments.length>3&&void 0!==arguments[3])||arguments[3],o=!(arguments.length>4&&void 0!==arguments[4])||arguments[4],s=!(arguments.length>5&&void 0!==arguments[5])||arguments[5],l=this,u=t._private,c=u.rscratch,d=t.position();if(Q(d.x)&&Q(d.y)&&(!s||t.visible())){var h,f,p=s?t.effectiveOpacity():1,v=l.usePaths(),g=!1,y=t.padding();r=t.width()+2*y,a=t.height()+2*y,n&&(f=n,e.translate(-f.x1,-f.y1));for(var m=t.pstyle("background-image").value,b=new Array(m.length),x=new Array(m.length),w=0,E=0;E0&&void 0!==arguments[0]?arguments[0]:S;l.eleFillStyle(e,t,n)},Y=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:N;l.colorStrokeStyle(e,B[0],B[1],B[2],t)},q=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:V;l.colorStrokeStyle(e,z[0],z[1],z[2],t)},W=function(e,t,n,r){var a,i=l.nodePathCache=l.nodePathCache||[],o=Ke("polygon"===n?n+","+r.join(","):n,""+t,""+e,""+X),s=i[o],u=!1;return null!=s?(a=s,u=!0,c.pathCache=a):(a=new Path2D,i[o]=c.pathCache=a),{path:a,cacheHit:u}},U=t.pstyle("shape").strValue,H=t.pstyle("shape-polygon-points").pfValue;if(v){e.translate(d.x,d.y);var K=W(r,a,U,H);h=K.path,g=K.cacheHit}var G=function(){if(!g){var n=d;v&&(n={x:0,y:0}),l.nodeShapes[l.getNodeShape(t)].draw(h||e,n.x,n.y,r,a,X,c)}v?e.fill(h):e.fill()},Z=function(){for(var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:p,r=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],a=u.backgrounding,i=0,o=0;o0&&void 0!==arguments[0]&&arguments[0],i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:p;l.hasPie(t)&&(l.drawPie(e,t,i),n&&(v||l.nodeShapes[l.getNodeShape(t)].draw(e,d.x,d.y,r,a,X,c)))},J=function(){var n=arguments.length>0&&void 0!==arguments[0]&&arguments[0],i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:p;l.hasStripe(t)&&(e.save(),v?e.clip(c.pathCache):(l.nodeShapes[l.getNodeShape(t)].draw(e,d.x,d.y,r,a,X,c),e.clip()),l.drawStripe(e,t,i),e.restore(),n&&(v||l.nodeShapes[l.getNodeShape(t)].draw(e,d.x,d.y,r,a,X,c)))},ee=function(){var t=(C>0?C:-C)*(arguments.length>0&&void 0!==arguments[0]?arguments[0]:p),n=C>0?0:255;0!==C&&(l.colorFillStyle(e,n,n,n,t),v?e.fill(h):e.fill())},te=function(){if(P>0){if(e.lineWidth=P,e.lineCap=A,e.lineJoin=_,e.setLineDash)switch(D){case"dotted":e.setLineDash([1,1]);break;case"dashed":e.setLineDash(R),e.lineDashOffset=I;break;case"solid":case"double":e.setLineDash([])}if("center"!==M){if(e.save(),e.lineWidth*=2,"inside"===M)v?e.clip(h):e.clip();else{var t=new Path2D;t.rect(-r/2-P,-a/2-P,r+2*P,a+2*P),t.addPath(h),e.clip(t,"evenodd")}v?e.stroke(h):e.stroke(),e.restore()}else v?e.stroke(h):e.stroke();if("double"===D){e.lineWidth=P/3;var n=e.globalCompositeOperation;e.globalCompositeOperation="destination-out",v?e.stroke(h):e.stroke(),e.globalCompositeOperation=n}e.setLineDash&&e.setLineDash([])}},ne=function(){if(L>0){if(e.lineWidth=L,e.lineCap="butt",e.setLineDash)switch(O){case"dotted":e.setLineDash([1,1]);break;case"dashed":e.setLineDash([4,2]);break;case"solid":case"double":e.setLineDash([])}var n=d;v&&(n={x:0,y:0});var i=l.getNodeShape(t),o=P;"inside"===M&&(o=0),"outside"===M&&(o*=2);var s,u=(r+o+(L+F))/r,c=(a+o+(L+F))/a,h=r*u,f=a*c,p=l.nodeShapes[i].points;if(v)s=W(h,f,i,p).path;if("ellipse"===i)l.drawEllipsePath(s||e,n.x,n.y,h,f);else if(["round-diamond","round-heptagon","round-hexagon","round-octagon","round-pentagon","round-polygon","round-triangle","round-tag"].includes(i)){var g=0,y=0,m=0;"round-diamond"===i?g=1.4*(o+F+L):"round-heptagon"===i?(g=1.075*(o+F+L),m=-(o/2+F+L)/35):"round-hexagon"===i?g=1.12*(o+F+L):"round-pentagon"===i?(g=1.13*(o+F+L),m=-(o/2+F+L)/15):"round-tag"===i?(g=1.12*(o+F+L),y=.07*(o/2+L+F)):"round-triangle"===i&&(g=(o+F+L)*(Math.PI/2),m=-(o+F/2+L)/Math.PI),0!==g&&(h=r*(u=(r+g)/r),["round-hexagon","round-tag"].includes(i)||(f=a*(c=(a+g)/a)));for(var b=h/2,x=f/2,w=(X="auto"===X?Nn(h,f):X)+(o+L+F)/2,E=new Array(p.length/2),k=new Array(p.length/2),T=0;T0){if(r=r||n.position(),null==a||null==i){var d=n.padding();a=n.width()+2*d,i=n.height()+2*d}this.colorFillStyle(t,l[0],l[1],l[2],s),this.nodeShapes[u].draw(t,r.x,r.y,a+2*o,i+2*o,c),t.fill()}}}};Yd.drawNodeOverlay=qd("overlay"),Yd.drawNodeUnderlay=qd("underlay"),Yd.hasPie=function(e){return(e=e[0])._private.hasPie},Yd.hasStripe=function(e){return(e=e[0])._private.hasStripe},Yd.drawPie=function(e,t,n,r){t=t[0],r=r||t.position();var a,i=t.cy().style(),o=t.pstyle("pie-size"),s=t.pstyle("pie-hole"),l=t.pstyle("pie-start-angle").pfValue,u=r.x,c=r.y,d=t.width(),h=t.height(),f=Math.min(d,h)/2,p=0;if(this.usePaths()&&(u=0,c=0),"%"===o.units?f*=o.pfValue:void 0!==o.pfValue&&(f=o.pfValue/2),"%"===s.units?a=f*s.pfValue:void 0!==s.pfValue&&(a=s.pfValue/2),!(a>=f))for(var v=1;v<=i.pieBackgroundN;v++){var g=t.pstyle("pie-"+v+"-background-size").value,y=t.pstyle("pie-"+v+"-background-color").value,m=t.pstyle("pie-"+v+"-background-opacity").value*n,b=g/100;b+p>1&&(b=1-p);var x=1.5*Math.PI+2*Math.PI*p,w=(x+=l)+2*Math.PI*b;0===g||p>=1||p+b>1||(0===a?(e.beginPath(),e.moveTo(u,c),e.arc(u,c,f,x,w),e.closePath()):(e.beginPath(),e.arc(u,c,f,x,w),e.arc(u,c,a,w,x,!0),e.closePath()),this.colorFillStyle(e,y[0],y[1],y[2],m),e.fill(),p+=b)}},Yd.drawStripe=function(e,t,n,r){t=t[0],r=r||t.position();var a=t.cy().style(),i=r.x,o=r.y,s=t.width(),l=t.height(),u=0,c=this.usePaths();e.save();var d=t.pstyle("stripe-direction").value,h=t.pstyle("stripe-size");switch(d){case"vertical":break;case"righward":e.rotate(-Math.PI/2)}var f=s,p=l;"%"===h.units?(f*=h.pfValue,p*=h.pfValue):void 0!==h.pfValue&&(f=h.pfValue,p=h.pfValue),c&&(i=0,o=0),o-=f/2,i-=p/2;for(var v=1;v<=a.stripeBackgroundN;v++){var g=t.pstyle("stripe-"+v+"-background-size").value,y=t.pstyle("stripe-"+v+"-background-color").value,m=t.pstyle("stripe-"+v+"-background-opacity").value*n,b=g/100;b+u>1&&(b=1-u),0===g||u>=1||u+b>1||(e.beginPath(),e.rect(i,o+p*u,f,p*b),e.closePath(),this.colorFillStyle(e,y[0],y[1],y[2],m),e.fill(),u+=b)}e.restore()};var Wd,Ud={};function Hd(e,t,n){var r=e.createShader(t);if(e.shaderSource(r,n),e.compileShader(r),!e.getShaderParameter(r,e.COMPILE_STATUS))throw new Error(e.getShaderInfoLog(r));return r}function Kd(e,t,n){void 0===n&&(n=t);var r=e.makeOffscreenCanvas(t,n),a=r.context=r.getContext("2d");return r.clear=function(){return a.clearRect(0,0,r.width,r.height)},r.clear(),r}function Gd(e){var t=e.pixelRatio,n=e.cy.zoom(),r=e.cy.pan();return{zoom:n*t,pan:{x:r.x*t,y:r.y*t}}}function Zd(e,t){return!!t.picking||"solid"===e.pstyle("background-fill").value&&("none"===e.pstyle("background-image").strValue&&(0===e.pstyle("border-width").value||(0===e.pstyle("border-opacity").value||"solid"===e.pstyle("border-style").value)))}function $d(e,t){if(e.length!==t.length)return!1;for(var n=0;n>8&255)/255,n[2]=(e>>16&255)/255,n[3]=(e>>24&255)/255,n}function eh(e){return e[0]+(e[1]<<8)+(e[2]<<16)+(e[3]<<24)}function th(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 nh(e,t,n){switch(t){case e.FLOAT:return new Float32Array(n);case e.INT:return new Int32Array(n)}}function rh(e,t,n,r,a,i){switch(t){case e.FLOAT:return new Float32Array(n.buffer,i*r,a);case e.INT:return new Int32Array(n.buffer,i*r,a)}}function ah(e,t,n,r){var a=l(th(e,n),3),i=a[0],o=a[1],s=a[2],u=nh(e,o,t*i),c=i*s,d=e.createBuffer();e.bindBuffer(e.ARRAY_BUFFER,d),e.bufferData(e.ARRAY_BUFFER,t*c,e.DYNAMIC_DRAW),e.enableVertexAttribArray(r),o===e.FLOAT?e.vertexAttribPointer(r,i,o,!1,c,0):o===e.INT&&e.vertexAttribIPointer(r,i,o,c,0),e.vertexAttribDivisor(r,1),e.bindBuffer(e.ARRAY_BUFFER,null);for(var h=new Array(t),f=0;ft.minMbLowQualFrames&&(t.motionBlurPxRatio=t.mbPxRBlurry)),t.clearingMotionBlur&&(t.motionBlurPxRatio=1),t.textureDrawLastFrame&&!d&&(c[t.NODE]=!0,c[t.SELECT_BOX]=!0);var m=n.style(),b=n.zoom(),x=void 0!==o?o:b,w=n.pan(),E={x:w.x,y:w.y},k={zoom:b,pan:{x:w.x,y:w.y}},T=t.prevViewport;void 0===T||k.zoom!==T.zoom||k.pan.x!==T.pan.x||k.pan.y!==T.pan.y||v&&!p||(t.motionBlurPxRatio=1),s&&(E=s),x*=l,E.x*=l,E.y*=l;var C=t.getCachedZSortedEles();function P(e,n,r,a,i){var o=e.globalCompositeOperation;e.globalCompositeOperation="destination-out",t.colorFillStyle(e,255,255,255,t.motionBlurTransparency),e.fillRect(n,r,a,i),e.globalCompositeOperation=o}function S(e,n){var i,l,c,d;t.clearingMotionBlur||e!==u.bufferContexts[t.MOTIONBLUR_BUFFER_NODE]&&e!==u.bufferContexts[t.MOTIONBLUR_BUFFER_DRAG]?(i=E,l=x,c=t.canvasWidth,d=t.canvasHeight):(i={x:w.x*f,y:w.y*f},l=b*f,c=t.canvasWidth*f,d=t.canvasHeight*f),e.setTransform(1,0,0,1,0,0),"motionBlur"===n?P(e,0,0,c,d):r||void 0!==n&&!n||e.clearRect(0,0,c,d),a||(e.translate(i.x,i.y),e.scale(l,l)),s&&e.translate(s.x,s.y),o&&e.scale(o,o)}if(d||(t.textureDrawLastFrame=!1),d){if(t.textureDrawLastFrame=!0,!t.textureCache){t.textureCache={},t.textureCache.bb=n.mutableElements().boundingBox(),t.textureCache.texture=t.data.bufferCanvases[t.TEXTURE_BUFFER];var B=t.data.bufferContexts[t.TEXTURE_BUFFER];B.setTransform(1,0,0,1,0,0),B.clearRect(0,0,t.canvasWidth*t.textureMult,t.canvasHeight*t.textureMult),t.render({forcedContext:B,drawOnlyNodeLayer:!0,forcedPxRatio:l*t.textureMult}),(k=t.textureCache.viewport={zoom:n.zoom(),pan:n.pan(),width:t.canvasWidth,height:t.canvasHeight}).mpan={x:(0-k.pan.x)/k.zoom,y:(0-k.pan.y)/k.zoom}}c[t.DRAG]=!1,c[t.NODE]=!1;var D=u.contexts[t.NODE],_=t.textureCache.texture;k=t.textureCache.viewport;D.setTransform(1,0,0,1,0,0),h?P(D,0,0,k.width,k.height):D.clearRect(0,0,k.width,k.height);var A=m.core("outside-texture-bg-color").value,M=m.core("outside-texture-bg-opacity").value;t.colorFillStyle(D,A[0],A[1],A[2],M),D.fillRect(0,0,k.width,k.height);b=n.zoom();S(D,!1),D.clearRect(k.mpan.x,k.mpan.y,k.width/k.zoom/l,k.height/k.zoom/l),D.drawImage(_,k.mpan.x,k.mpan.y,k.width/k.zoom/l,k.height/k.zoom/l)}else t.textureOnViewport&&!r&&(t.textureCache=null);var R=n.extent(),I=t.pinching||t.hoverData.dragging||t.swipePanning||t.data.wheelZooming||t.hoverData.draggingEles||t.cy.animated(),N=t.hideEdgesOnViewport&&I,L=[];if(L[t.NODE]=!c[t.NODE]&&h&&!t.clearedForMotionBlur[t.NODE]||t.clearingMotionBlur,L[t.NODE]&&(t.clearedForMotionBlur[t.NODE]=!0),L[t.DRAG]=!c[t.DRAG]&&h&&!t.clearedForMotionBlur[t.DRAG]||t.clearingMotionBlur,L[t.DRAG]&&(t.clearedForMotionBlur[t.DRAG]=!0),c[t.NODE]||a||i||L[t.NODE]){var z=h&&!L[t.NODE]&&1!==f;S(D=r||(z?t.data.bufferContexts[t.MOTIONBLUR_BUFFER_NODE]:u.contexts[t.NODE]),h&&!z?"motionBlur":void 0),N?t.drawCachedNodes(D,C.nondrag,l,R):t.drawLayeredElements(D,C.nondrag,l,R),t.debug&&t.drawDebugPoints(D,C.nondrag),a||h||(c[t.NODE]=!1)}if(!i&&(c[t.DRAG]||a||L[t.DRAG])){z=h&&!L[t.DRAG]&&1!==f;S(D=r||(z?t.data.bufferContexts[t.MOTIONBLUR_BUFFER_DRAG]:u.contexts[t.DRAG]),h&&!z?"motionBlur":void 0),N?t.drawCachedNodes(D,C.drag,l,R):t.drawCachedElements(D,C.drag,l,R),t.debug&&t.drawDebugPoints(D,C.drag),a||h||(c[t.DRAG]=!1)}if(this.drawSelectionRectangle(e,S),h&&1!==f){var O=u.contexts[t.NODE],V=t.data.bufferCanvases[t.MOTIONBLUR_BUFFER_NODE],F=u.contexts[t.DRAG],X=t.data.bufferCanvases[t.MOTIONBLUR_BUFFER_DRAG],j=function(e,n,r){e.setTransform(1,0,0,1,0,0),r||!y?e.clearRect(0,0,t.canvasWidth,t.canvasHeight):P(e,0,0,t.canvasWidth,t.canvasHeight);var a=f;e.drawImage(n,0,0,t.canvasWidth*a,t.canvasHeight*a,0,0,t.canvasWidth,t.canvasHeight)};(c[t.NODE]||L[t.NODE])&&(j(O,V,L[t.NODE]),c[t.NODE]=!1),(c[t.DRAG]||L[t.DRAG])&&(j(F,X,L[t.DRAG]),c[t.DRAG]=!1)}t.prevViewport=k,t.clearingMotionBlur&&(t.clearingMotionBlur=!1,t.motionBlurCleared=!0,t.motionBlur=!0),h&&(t.motionBlurTimeout=setTimeout(function(){t.motionBlurTimeout=null,t.clearedForMotionBlur[t.NODE]=!1,t.clearedForMotionBlur[t.DRAG]=!1,t.motionBlur=!1,t.clearingMotionBlur=!d,t.mbFrames=0,c[t.NODE]=!0,c[t.DRAG]=!0,t.redraw()},100)),r||n.emit("render")},Ud.drawSelectionRectangle=function(e,t){var n=this,r=n.cy,a=n.data,i=r.style(),o=e.drawOnlyNodeLayer,s=e.drawAllLayers,l=a.canvasNeedsRedraw,u=e.forcedContext;if(n.showFps||!o&&l[n.SELECT_BOX]&&!s){var c=u||a.contexts[n.SELECT_BOX];if(t(c),1==n.selection[4]&&(n.hoverData.selecting||n.touchData.selecting)){var d=n.cy.zoom(),h=i.core("selection-box-border-width").value/d;c.lineWidth=h,c.fillStyle="rgba("+i.core("selection-box-color").value[0]+","+i.core("selection-box-color").value[1]+","+i.core("selection-box-color").value[2]+","+i.core("selection-box-opacity").value+")",c.fillRect(n.selection[0],n.selection[1],n.selection[2]-n.selection[0],n.selection[3]-n.selection[1]),h>0&&(c.strokeStyle="rgba("+i.core("selection-box-border-color").value[0]+","+i.core("selection-box-border-color").value[1]+","+i.core("selection-box-border-color").value[2]+","+i.core("selection-box-opacity").value+")",c.strokeRect(n.selection[0],n.selection[1],n.selection[2]-n.selection[0],n.selection[3]-n.selection[1]))}if(a.bgActivePosistion&&!n.hoverData.selecting){d=n.cy.zoom();var f=a.bgActivePosistion;c.fillStyle="rgba("+i.core("active-bg-color").value[0]+","+i.core("active-bg-color").value[1]+","+i.core("active-bg-color").value[2]+","+i.core("active-bg-opacity").value+")",c.beginPath(),c.arc(f.x,f.y,i.core("active-bg-size").pfValue/d,0,2*Math.PI),c.fill()}var p=n.lastRedrawTime;if(n.showFps&&p){p=Math.round(p);var v=Math.round(1e3/p),g="1 frame = "+p+" ms = "+v+" fps";if(c.setTransform(1,0,0,1,0,0),c.fillStyle="rgba(255, 0, 0, 0.75)",c.strokeStyle="rgba(255, 0, 0, 0.75)",c.font="30px Arial",!Wd){var y=c.measureText(g);Wd=y.actualBoundingBoxAscent}c.fillText(g,0,Wd);c.strokeRect(0,Wd+10,250,20),c.fillRect(0,Wd+10,250*Math.min(v/60,1),20)}s||(l[n.SELECT_BOX]=!1)}};var ih="undefined"!=typeof Float32Array?Float32Array:Array;function oh(){var e=new ih(9);return ih!=Float32Array&&(e[1]=0,e[2]=0,e[3]=0,e[5]=0,e[6]=0,e[7]=0),e[0]=1,e[4]=1,e[8]=1,e}function sh(e){return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=1,e[5]=0,e[6]=0,e[7]=0,e[8]=1,e}function lh(e,t,n){var r=t[0],a=t[1],i=t[2],o=t[3],s=t[4],l=t[5],u=t[6],c=t[7],d=t[8],h=n[0],f=n[1];return e[0]=r,e[1]=a,e[2]=i,e[3]=o,e[4]=s,e[5]=l,e[6]=h*r+f*o+u,e[7]=h*a+f*s+c,e[8]=h*i+f*l+d,e}function uh(e,t,n){var r=t[0],a=t[1],i=t[2],o=t[3],s=t[4],l=t[5],u=t[6],c=t[7],d=t[8],h=Math.sin(n),f=Math.cos(n);return e[0]=f*r+h*o,e[1]=f*a+h*s,e[2]=f*i+h*l,e[3]=f*o-h*r,e[4]=f*s-h*a,e[5]=f*l-h*i,e[6]=u,e[7]=c,e[8]=d,e}function ch(e,t,n){var r=n[0],a=n[1];return e[0]=r*t[0],e[1]=r*t[1],e[2]=r*t[2],e[3]=a*t[3],e[4]=a*t[4],e[5]=a*t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e}Math.hypot||(Math.hypot=function(){for(var e=0,t=arguments.length;t--;)e+=arguments[t]*arguments[t];return Math.sqrt(e)});var dh=function(){return i(function e(t,n,r,i){a(this,e),this.debugID=Math.floor(1e4*Math.random()),this.r=t,this.texSize=n,this.texRows=r,this.texHeight=Math.floor(n/r),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,n,n),this.scratch=i(t,n,this.texHeight,"scratch")},[{key:"lock",value:function(){this.locked=!0}},{key:"getKeys",value:function(){return new Set(this.keyToLocation.keys())}},{key:"getScale",value:function(e){var t=e.w,n=e.h,r=this.texHeight,a=this.texSize,i=r/n,o=t*i,s=n*i;return o>a&&(o=t*(i=a/t),s=n*i),{scale:i,texW:o,texH:s}}},{key:"draw",value:function(e,t,n){var r=this;if(this.locked)throw new Error("can't draw, atlas is locked");var a=this.texSize,i=this.texRows,o=this.texHeight,s=this.getScale(t),l=s.scale,u=s.texW,c=s.texH,d=function(e,r){if(n&&r){var a=r.context,i=e.x,s=e.row,u=i,c=o*s;a.save(),a.translate(u,c),a.scale(l,l),n(a,t),a.restore()}},h=[null,null],f=function(){d(r.freePointer,r.canvas),h[0]={x:r.freePointer.x,y:r.freePointer.row*o,w:u,h:c},h[1]={x:r.freePointer.x+u,y:r.freePointer.row*o,w:0,h:c},r.freePointer.x+=u,r.freePointer.x==a&&(r.freePointer.x=0,r.freePointer.row++)},p=function(){r.freePointer.x=0,r.freePointer.row++};if(this.freePointer.x+u<=a)f();else{if(this.freePointer.row>=i-1)return!1;this.freePointer.x===a?(p(),f()):this.enableWrapping?function(){var e=r.scratch,t=r.canvas;e.clear(),d({x:0,row:0},e);var n=a-r.freePointer.x,i=u-n,s=o,l=r.freePointer.x,f=r.freePointer.row*o,p=n;t.context.drawImage(e,0,0,p,s,l,f,p,s),h[0]={x:l,y:f,w:p,h:c};var v=n,g=(r.freePointer.row+1)*o,y=i;t&&t.context.drawImage(e,v,0,y,s,0,g,y,s),h[1]={x:0,y:g,w:y,h:c},r.freePointer.x=i,r.freePointer.row++}():(p(),f())}return this.keyToLocation.set(e,h),this.needsBuffer=!0,h}},{key:"getOffsets",value:function(e){return this.keyToLocation.get(e)}},{key:"isEmpty",value:function(){return 0===this.freePointer.x&&0===this.freePointer.row}},{key:"canFit",value:function(e){if(this.locked)return!1;var t=this.texSize,n=this.texRows,r=this.getScale(e).texW;return!(this.freePointer.x+r>t)||this.freePointer.row1&&void 0!==arguments[1]?arguments[1]:{},a=r.forceRedraw,i=void 0!==a&&a,s=r.filterEle,l=void 0===s?function(){return!0}:s,u=r.filterType,c=void 0===u?function(){return!0}:u,d=!1,h=!1,f=o(e);try{for(f.s();!(t=f.n()).done;){var p=t.value;if(l(p)){var v,g=o(this.renderTypes.values());try{var y=function(){var e=v.value,t=e.type;if(c(t)){var r=n.collections.get(e.collection),a=e.getKey(p),o=Array.isArray(a)?a:[a];if(i)o.forEach(function(e){return r.markKeyForGC(e)}),h=!0;else{var s=e.getID?e.getID(p):p.id(),l=n._key(t,s),u=n.typeAndIdToKey.get(l);void 0===u||$d(o,u)||(d=!0,n.typeAndIdToKey.delete(l),u.forEach(function(e){return r.markKeyForGC(e)}))}}};for(g.s();!(v=g.n()).done;)y()}catch(m){g.e(m)}finally{g.f()}}}}catch(m){f.e(m)}finally{f.f()}return h&&(this.gc(),d=!1),d}},{key:"gc",value:function(){var e,t=o(this.collections.values());try{for(t.s();!(e=t.n()).done;){e.value.gc()}}catch(n){t.e(n)}finally{t.f()}}},{key:"getOrCreateAtlas",value:function(e,t,n,r){var a=this.renderTypes.get(t),i=this.collections.get(a.collection),o=!1,s=i.draw(r,n,function(t){a.drawClipped?(t.save(),t.beginPath(),t.rect(0,0,n.w,n.h),t.clip(),a.drawElement(t,e,n,!0,!0),t.restore()):a.drawElement(t,e,n,!0,!0),o=!0});if(o){var l=a.getID?a.getID(e):e.id(),u=this._key(t,l);this.typeAndIdToKey.has(u)?this.typeAndIdToKey.get(u).push(r):this.typeAndIdToKey.set(u,[r])}return s}},{key:"getAtlasInfo",value:function(e,t){var n=this,r=this.renderTypes.get(t),a=r.getKey(e);return(Array.isArray(a)?a:[a]).map(function(a){var i=r.getBoundingBox(e,a),o=n.getOrCreateAtlas(e,t,i,a),s=l(o.getOffsets(a),2),u=s[0];return{atlas:o,tex:u,tex1:u,tex2:s[1],bb:i}})}},{key:"getDebugInfo",value:function(){var e,t=[],n=o(this.collections);try{for(n.s();!(e=n.n()).done;){var r=l(e.value,2),a=r[0],i=r[1].getCounts(),s=i.keyCount,u=i.atlasCount;t.push({type:a,keyCount:s,atlasCount:u})}}catch(c){n.e(c)}finally{n.f()}return t}}])}(),ph=function(){return i(function e(t){a(this,e),this.globalOptions=t,this.atlasSize=t.webglTexSize,this.maxAtlasesPerBatch=t.webglTexPerBatch,this.batchAtlases=[]},[{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(e,t){return t})}},{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(e){return this.batchAtlases.length!==this.maxAtlasesPerBatch||this.batchAtlases.includes(e)}},{key:"getAtlasIndexForBatch",value:function(e){var t=this.batchAtlases.indexOf(e);if(t<0){if(this.batchAtlases.length===this.maxAtlasesPerBatch)throw new Error("cannot add more atlases to batch");this.batchAtlases.push(e),t=this.batchAtlases.length-1}return t}}])}(),vh={SCREEN:{name:"screen",screen:!0},PICKING:{name:"picking",picking:!0}},gh=1,yh=2,mh=function(){return i(function e(t,n,r){a(this,e),this.r=t,this.gl=n,this.maxInstances=r.webglBatchSize,this.atlasSize=r.webglTexSize,this.bgColor=r.bgColor,this.debug=r.webglDebug,this.batchDebugInfo=[],r.enableWrapping=!0,r.createTextureCanvas=Kd,this.atlasManager=new fh(t,r),this.batchManager=new ph(r),this.simpleShapeOptions=new Map,this.program=this._createShaderProgram(vh.SCREEN),this.pickingProgram=this._createShaderProgram(vh.PICKING),this.vao=this._createVAO()},[{key:"addAtlasCollection",value:function(e,t){this.atlasManager.addAtlasCollection(e,t)}},{key:"addTextureAtlasRenderType",value:function(e,t){this.atlasManager.addRenderType(e,t)}},{key:"addSimpleShapeRenderType",value:function(e,t){this.simpleShapeOptions.set(e,t)}},{key:"invalidate",value:function(e){var t=(arguments.length>1&&void 0!==arguments[1]?arguments[1]:{}).type,n=this.atlasManager;return t?n.invalidate(e,{filterType:function(e){return e===t},forceRedraw:!0}):n.invalidate(e)}},{key:"gc",value:function(){this.atlasManager.gc()}},{key:"_createShaderProgram",value:function(e){var t=this.gl,n="#version 300 es\n precision highp float;\n\n uniform mat3 uPanZoomMatrix;\n uniform int uAtlasSize;\n \n // instanced\n in vec2 aPosition; // a vertex from the unit square\n \n in mat3 aTransform; // used to transform verticies, eg into a bounding box\n in int aVertType; // the type of thing we are rendering\n\n // the z-index that is output when using picking mode\n in vec4 aIndex;\n \n // For textures\n in int aAtlasId; // which shader unit/atlas to use\n in vec4 aTex; // x/y/w/h of texture in atlas\n\n // for edges\n in vec4 aPointAPointB;\n in vec4 aPointCPointD;\n in vec2 aLineWidth; // also used for node border width\n\n // simple shapes\n in vec4 aCornerRadius; // for round-rectangle [top-right, bottom-right, top-left, bottom-left]\n in vec4 aColor; // also used for edges\n in vec4 aBorderColor; // aLineWidth is used for border width\n\n // output values passed to the fragment shader\n out vec2 vTexCoord;\n out vec4 vColor;\n out vec2 vPosition;\n // flat values are not interpolated\n flat out int vAtlasId; \n flat out int vVertType;\n flat out vec2 vTopRight;\n flat out vec2 vBotLeft;\n flat out vec4 vCornerRadius;\n flat out vec4 vBorderColor;\n flat out vec2 vBorderWidth;\n flat out vec4 vIndex;\n \n void main(void) {\n int vid = gl_VertexID;\n vec2 position = aPosition; // TODO make this a vec3, simplifies some code below\n\n if(aVertType == ".concat(0,") {\n float texX = aTex.x; // texture coordinates\n float texY = aTex.y;\n float texW = aTex.z;\n float texH = aTex.w;\n\n if(vid == 1 || vid == 2 || vid == 4) {\n texX += texW;\n }\n if(vid == 2 || vid == 4 || vid == 5) {\n texY += texH;\n }\n\n float d = float(uAtlasSize);\n vTexCoord = vec2(texX / d, texY / d); // tex coords must be between 0 and 1\n\n gl_Position = vec4(uPanZoomMatrix * aTransform * vec3(position, 1.0), 1.0);\n }\n else if(aVertType == ").concat(4," || aVertType == ").concat(7," \n || aVertType == ").concat(5," || aVertType == ").concat(6,") { // simple shapes\n\n // the bounding box is needed by the fragment shader\n vBotLeft = (aTransform * vec3(0, 0, 1)).xy; // flat\n vTopRight = (aTransform * vec3(1, 1, 1)).xy; // flat\n vPosition = (aTransform * vec3(position, 1)).xy; // will be interpolated\n\n // calculations are done in the fragment shader, just pass these along\n vColor = aColor;\n vCornerRadius = aCornerRadius;\n vBorderColor = aBorderColor;\n vBorderWidth = aLineWidth;\n\n gl_Position = vec4(uPanZoomMatrix * aTransform * vec3(position, 1.0), 1.0);\n }\n else if(aVertType == ").concat(1,") {\n vec2 source = aPointAPointB.xy;\n vec2 target = aPointAPointB.zw;\n\n // adjust the geometry so that the line is centered on the edge\n position.y = position.y - 0.5;\n\n // stretch the unit square into a long skinny rectangle\n vec2 xBasis = target - source;\n vec2 yBasis = normalize(vec2(-xBasis.y, xBasis.x));\n vec2 point = source + xBasis * position.x + yBasis * aLineWidth[0] * position.y;\n\n gl_Position = vec4(uPanZoomMatrix * vec3(point, 1.0), 1.0);\n vColor = aColor;\n } \n else if(aVertType == ").concat(2,") {\n vec2 pointA = aPointAPointB.xy;\n vec2 pointB = aPointAPointB.zw;\n vec2 pointC = aPointCPointD.xy;\n vec2 pointD = aPointCPointD.zw;\n\n // adjust the geometry so that the line is centered on the edge\n position.y = position.y - 0.5;\n\n vec2 p0, p1, p2, pos;\n if(position.x == 0.0) { // The left side of the unit square\n p0 = pointA;\n p1 = pointB;\n p2 = pointC;\n pos = position;\n } else { // The right side of the unit square, use same approach but flip the geometry upside down\n p0 = pointD;\n p1 = pointC;\n p2 = pointB;\n pos = vec2(0.0, -position.y);\n }\n\n vec2 p01 = p1 - p0;\n vec2 p12 = p2 - p1;\n vec2 p21 = p1 - p2;\n\n // Find the normal vector.\n vec2 tangent = normalize(normalize(p12) + normalize(p01));\n vec2 normal = vec2(-tangent.y, tangent.x);\n\n // Find the vector perpendicular to p0 -> p1.\n vec2 p01Norm = normalize(vec2(-p01.y, p01.x));\n\n // Determine the bend direction.\n float sigma = sign(dot(p01 + p21, normal));\n float width = aLineWidth[0];\n\n if(sign(pos.y) == -sigma) {\n // This is an intersecting vertex. Adjust the position so that there's no overlap.\n vec2 point = 0.5 * width * normal * -sigma / dot(normal, p01Norm);\n gl_Position = vec4(uPanZoomMatrix * vec3(p1 + point, 1.0), 1.0);\n } else {\n // This is a non-intersecting vertex. Treat it like a mitre join.\n vec2 point = 0.5 * width * normal * sigma * dot(normal, p01Norm);\n gl_Position = vec4(uPanZoomMatrix * vec3(p1 + point, 1.0), 1.0);\n }\n\n vColor = aColor;\n } \n else if(aVertType == ").concat(3," && vid < 3) {\n // massage the first triangle into an edge arrow\n if(vid == 0)\n position = vec2(-0.15, -0.3);\n if(vid == 1)\n position = vec2( 0.0, 0.0);\n if(vid == 2)\n position = vec2( 0.15, -0.3);\n\n gl_Position = vec4(uPanZoomMatrix * aTransform * vec3(position, 1.0), 1.0);\n vColor = aColor;\n }\n else {\n gl_Position = vec4(2.0, 0.0, 0.0, 1.0); // discard vertex by putting it outside webgl clip space\n }\n\n vAtlasId = aAtlasId;\n vVertType = aVertType;\n vIndex = aIndex;\n }\n "),r=this.batchManager.getIndexArray(),a="#version 300 es\n precision highp float;\n\n // declare texture unit for each texture atlas in the batch\n ".concat(r.map(function(e){return"uniform sampler2D uTexture".concat(e,";")}).join("\n\t"),"\n\n uniform vec4 uBGColor;\n uniform float uZoom;\n\n in vec2 vTexCoord;\n in vec4 vColor;\n in vec2 vPosition; // model coordinates\n\n flat in int vAtlasId;\n flat in vec4 vIndex;\n flat in int vVertType;\n flat in vec2 vTopRight;\n flat in vec2 vBotLeft;\n flat in vec4 vCornerRadius;\n flat in vec4 vBorderColor;\n flat in vec2 vBorderWidth;\n\n out vec4 outColor;\n\n ").concat("\n float circleSD(vec2 p, float r) {\n return distance(vec2(0), p) - r; // signed distance\n }\n","\n ").concat("\n float rectangleSD(vec2 p, vec2 b) {\n vec2 d = abs(p)-b;\n return distance(vec2(0),max(d,0.0)) + min(max(d.x,d.y),0.0);\n }\n","\n ").concat("\n float roundRectangleSD(vec2 p, vec2 b, vec4 cr) {\n cr.xy = (p.x > 0.0) ? cr.xy : cr.zw;\n cr.x = (p.y > 0.0) ? cr.x : cr.y;\n vec2 q = abs(p) - b + cr.x;\n return min(max(q.x, q.y), 0.0) + distance(vec2(0), max(q, 0.0)) - cr.x;\n }\n","\n ").concat("\n float ellipseSD(vec2 p, vec2 ab) {\n p = abs( p ); // symmetry\n\n // find root with Newton solver\n vec2 q = ab*(p-ab);\n float w = (q.x1.0) ? d : -d;\n }\n","\n\n vec4 blend(vec4 top, vec4 bot) { // blend colors with premultiplied alpha\n return vec4( \n top.rgb + (bot.rgb * (1.0 - top.a)),\n top.a + (bot.a * (1.0 - top.a)) \n );\n }\n\n vec4 distInterp(vec4 cA, vec4 cB, float d) { // interpolate color using Signed Distance\n // scale to the zoom level so that borders don't look blurry when zoomed in\n // note 1.5 is an aribitrary value chosen because it looks good\n return mix(cA, cB, 1.0 - smoothstep(0.0, 1.5 / uZoom, abs(d))); \n }\n\n void main(void) {\n if(vVertType == ").concat(0,") {\n // look up the texel from the texture unit\n ").concat(r.map(function(e){return"if(vAtlasId == ".concat(e,") outColor = texture(uTexture").concat(e,", vTexCoord);")}).join("\n\telse "),"\n } \n else if(vVertType == ").concat(3,") {\n // mimics how canvas renderer uses context.globalCompositeOperation = 'destination-out';\n outColor = blend(vColor, uBGColor);\n outColor.a = 1.0; // make opaque, masks out line under arrow\n }\n else if(vVertType == ").concat(4," && vBorderWidth == vec2(0.0)) { // simple rectangle with no border\n outColor = vColor; // unit square is already transformed to the rectangle, nothing else needs to be done\n }\n else if(vVertType == ").concat(4," || vVertType == ").concat(7," \n || vVertType == ").concat(5," || vVertType == ").concat(6,") { // use SDF\n\n float outerBorder = vBorderWidth[0];\n float innerBorder = vBorderWidth[1];\n float borderPadding = outerBorder * 2.0;\n float w = vTopRight.x - vBotLeft.x - borderPadding;\n float h = vTopRight.y - vBotLeft.y - borderPadding;\n vec2 b = vec2(w/2.0, h/2.0); // half width, half height\n vec2 p = vPosition - vec2(vTopRight.x - b[0] - outerBorder, vTopRight.y - b[1] - outerBorder); // translate to center\n\n float d; // signed distance\n if(vVertType == ").concat(4,") {\n d = rectangleSD(p, b);\n } else if(vVertType == ").concat(7," && w == h) {\n d = circleSD(p, b.x); // faster than ellipse\n } else if(vVertType == ").concat(7,") {\n d = ellipseSD(p, b);\n } else {\n d = roundRectangleSD(p, b, vCornerRadius.wzyx);\n }\n\n // use the distance to interpolate a color to smooth the edges of the shape, doesn't need multisampling\n // we must smooth colors inwards, because we can't change pixels outside the shape's bounding box\n if(d > 0.0) {\n if(d > outerBorder) {\n discard;\n } else {\n outColor = distInterp(vBorderColor, vec4(0), d - outerBorder);\n }\n } else {\n if(d > innerBorder) {\n vec4 outerColor = outerBorder == 0.0 ? vec4(0) : vBorderColor;\n vec4 innerBorderColor = blend(vBorderColor, vColor);\n outColor = distInterp(innerBorderColor, outerColor, d);\n } \n else {\n vec4 outerColor;\n if(innerBorder == 0.0 && outerBorder == 0.0) {\n outerColor = vec4(0);\n } else if(innerBorder == 0.0) {\n outerColor = vBorderColor;\n } else {\n outerColor = blend(vBorderColor, vColor);\n }\n outColor = distInterp(vColor, outerColor, d - innerBorder);\n }\n }\n }\n else {\n outColor = vColor;\n }\n\n ").concat(e.picking?"if(outColor.a == 0.0) discard;\n else outColor = vIndex;":"","\n }\n "),i=function(e,t,n){var r=Hd(e,e.VERTEX_SHADER,t),a=Hd(e,e.FRAGMENT_SHADER,n),i=e.createProgram();if(e.attachShader(i,r),e.attachShader(i,a),e.linkProgram(i),!e.getProgramParameter(i,e.LINK_STATUS))throw new Error("Could not initialize shaders");return i}(t,n,a);i.aPosition=t.getAttribLocation(i,"aPosition"),i.aIndex=t.getAttribLocation(i,"aIndex"),i.aVertType=t.getAttribLocation(i,"aVertType"),i.aTransform=t.getAttribLocation(i,"aTransform"),i.aAtlasId=t.getAttribLocation(i,"aAtlasId"),i.aTex=t.getAttribLocation(i,"aTex"),i.aPointAPointB=t.getAttribLocation(i,"aPointAPointB"),i.aPointCPointD=t.getAttribLocation(i,"aPointCPointD"),i.aLineWidth=t.getAttribLocation(i,"aLineWidth"),i.aColor=t.getAttribLocation(i,"aColor"),i.aCornerRadius=t.getAttribLocation(i,"aCornerRadius"),i.aBorderColor=t.getAttribLocation(i,"aBorderColor"),i.uPanZoomMatrix=t.getUniformLocation(i,"uPanZoomMatrix"),i.uAtlasSize=t.getUniformLocation(i,"uAtlasSize"),i.uBGColor=t.getUniformLocation(i,"uBGColor"),i.uZoom=t.getUniformLocation(i,"uZoom"),i.uTextures=[];for(var o=0;o1&&void 0!==arguments[1]?arguments[1]:vh.SCREEN;this.panZoomMatrix=e,this.renderTarget=t,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(e,t){return!!e.visible()&&(!t||!t.isVisible||t.isVisible(e))}},{key:"drawTexture",value:function(e,t,n){var r=this.atlasManager,a=this.batchManager,i=r.getRenderTypeOpts(n);if(this._isVisible(e,i)&&(!e.isEdge()||this._isValidEdge(e))){if(this.renderTarget.picking&&i.getTexPickingMode){var s=i.getTexPickingMode(e);if(s===gh)return;if(s==yh)return void this.drawPickingRectangle(e,t,n)}var u,c=o(r.getAtlasInfo(e,n));try{for(c.s();!(u=c.n()).done;){var d=u.value,h=d.atlas,f=d.tex1,p=d.tex2;a.canAddToCurrentBatch(h)||this.endBatch();for(var v=a.getAtlasIndexForBatch(h),g=0,y=[[f,!0],[p,!1]];g=this.maxInstances&&this.endBatch()}}}}catch(T){c.e(T)}finally{c.f()}}}},{key:"setTransformMatrix",value:function(e,t,n,r){var a=!(arguments.length>4&&void 0!==arguments[4])||arguments[4],i=0;if(n.shapeProps&&n.shapeProps.padding&&(i=e.pstyle(n.shapeProps.padding).pfValue),r){var o=r.bb,s=r.tex1,l=r.tex2,u=s.w/(s.w+l.w);a||(u=1-u);var c=this._getAdjustedBB(o,i,a,u);this._applyTransformMatrix(t,c,n,e)}else{var d=n.getBoundingBox(e),h=this._getAdjustedBB(d,i,!0,1);this._applyTransformMatrix(t,h,n,e)}}},{key:"_applyTransformMatrix",value:function(e,t,n,r){var a,i;sh(e);var o=n.getRotation?n.getRotation(r):0;if(0!==o){var s=n.getRotationPoint(r);lh(e,e,[s.x,s.y]),uh(e,e,o);var l=n.getRotationOffset(r);a=l.x+(t.xOffset||0),i=l.y+(t.yOffset||0)}else a=t.x1,i=t.y1;lh(e,e,[a,i]),ch(e,e,[t.w,t.h])}},{key:"_getAdjustedBB",value:function(e,t,n,r){var a=e.x1,i=e.y1,o=e.w,s=e.h;t&&(a-=t,i-=t,o+=2*t,s+=2*t);var l=0,u=o*r;return n&&r<1?o=u:!n&&r<1&&(a+=l=o-u,o=u),{x1:a,y1:i,w:o,h:s,xOffset:l,yOffset:e.yOffset}}},{key:"drawPickingRectangle",value:function(e,t,n){var r=this.atlasManager.getRenderTypeOpts(n),a=this.instanceCount;this.vertTypeBuffer.getView(a)[0]=4,Jd(t,this.indexBuffer.getView(a)),Qd([0,0,0],1,this.colorBuffer.getView(a));var i=this.transformBuffer.getMatrixView(a);this.setTransformMatrix(e,i,r),this.simpleCount++,this.instanceCount++,this.instanceCount>=this.maxInstances&&this.endBatch()}},{key:"drawNode",value:function(e,t,n){var r=this.simpleShapeOptions.get(n);if(this._isVisible(e,r)){var a=r.shapeProps,i=this._getVertTypeForShape(e,a.shape);if(void 0===i||r.isSimple&&!r.isSimple(e,this.renderTarget))this.drawTexture(e,t,n);else{var o=this.instanceCount;if(this.vertTypeBuffer.getView(o)[0]=i,5===i||6===i){var s=r.getBoundingBox(e),l=this._getCornerRadius(e,a.radius,s),u=this.cornerRadiusBuffer.getView(o);u[0]=l,u[1]=l,u[2]=l,u[3]=l,6===i&&(u[0]=0,u[2]=0)}Jd(t,this.indexBuffer.getView(o));var c=this.renderTarget.picking?1:"node-body"===n?e.effectiveOpacity():1,d=this.renderTarget.picking?1:e.pstyle(a.opacity).value*c;Qd(e.pstyle(a.color).value,d,this.colorBuffer.getView(o));var h=this.lineWidthBuffer.getView(o);if(h[0]=0,h[1]=0,a.border){var f=e.pstyle("border-width").value;if(f>0){Qd(e.pstyle("border-color").value,c*e.pstyle("border-opacity").value,this.borderColorBuffer.getView(o));var p=e.pstyle("border-position").value;if("inside"===p)h[0]=0,h[1]=-f;else if("outside"===p)h[0]=f,h[1]=0;else{var v=f/2;h[0]=v,h[1]=-v}}}var g=this.transformBuffer.getMatrixView(o);this.setTransformMatrix(e,g,r),this.simpleCount++,this.instanceCount++,this.instanceCount>=this.maxInstances&&this.endBatch()}}}},{key:"_getVertTypeForShape",value:function(e,t){switch(e.pstyle(t).value){case"rectangle":return 4;case"ellipse":return 7;case"roundrectangle":case"round-rectangle":return 5;case"bottom-round-rectangle":return 6;default:return}}},{key:"_getCornerRadius",value:function(e,t,n){var r=n.w,a=n.h;if("auto"===e.pstyle(t).value)return In(r,a);var i=e.pstyle(t).pfValue,o=r/2,s=a/2;return Math.min(i,s,o)}},{key:"drawEdgeArrow",value:function(e,t,n){if(e.visible()){var r,a,i,o=e._private.rscratch;if("source"===n?(r=o.arrowStartX,a=o.arrowStartY,i=o.srcArrowAngle):(r=o.arrowEndX,a=o.arrowEndY,i=o.tgtArrowAngle),!(isNaN(r)||null==r||isNaN(a)||null==a||isNaN(i)||null==i))if("none"!==e.pstyle(n+"-arrow-shape").value){var s=e.pstyle(n+"-arrow-color").value,l=e.pstyle("opacity").value*e.pstyle("line-opacity").value,u=e.pstyle("width").pfValue,c=e.pstyle("arrow-scale").value,d=this.r.getArrowWidth(u,c),h=this.instanceCount,f=this.transformBuffer.getMatrixView(h);sh(f),lh(f,f,[r,a]),ch(f,f,[d,d]),uh(f,f,i),this.vertTypeBuffer.getView(h)[0]=3,Jd(t,this.indexBuffer.getView(h)),Qd(s,l,this.colorBuffer.getView(h)),this.instanceCount++,this.instanceCount>=this.maxInstances&&this.endBatch()}}}},{key:"drawEdgeLine",value:function(e,t){if(e.visible()){var n=this._getEdgePoints(e);if(n){var r=e.pstyle("opacity").value,a=e.pstyle("line-opacity").value,i=e.pstyle("width").pfValue,o=e.pstyle("line-color").value,s=r*a;if(n.length/2+this.instanceCount>this.maxInstances&&this.endBatch(),4==n.length){var l=this.instanceCount;this.vertTypeBuffer.getView(l)[0]=1,Jd(t,this.indexBuffer.getView(l)),Qd(o,s,this.colorBuffer.getView(l)),this.lineWidthBuffer.getView(l)[0]=i;var u=this.pointAPointBBuffer.getView(l);u[0]=n[0],u[1]=n[1],u[2]=n[2],u[3]=n[3],this.instanceCount++,this.instanceCount>=this.maxInstances&&this.endBatch()}else for(var c=0;c=this.maxInstances&&this.endBatch()}}}}},{key:"_isValidEdge",value:function(e){var t=e._private.rscratch;return!t.badLine&&null!=t.allpts&&!isNaN(t.allpts[0])}},{key:"_getEdgePoints",value:function(e){var t=e._private.rscratch;if(this._isValidEdge(e)){var n=t.allpts;if(4==n.length)return n;var r=this._getNumSegments(e);return this._getCurveSegmentPoints(n,r)}}},{key:"_getNumSegments",value:function(e){return Math.min(Math.max(15,5),this.maxInstances)}},{key:"_getCurveSegmentPoints",value:function(e,t){if(4==e.length)return e;for(var n=Array(2*(t+1)),r=0;r<=t;r++)if(0==r)n[0]=e[0],n[1]=e[1];else if(r==t)n[2*r]=e[e.length-2],n[2*r+1]=e[e.length-1];else{var a=r/t;this._setCurvePoint(e,a,n,2*r)}return n}},{key:"_setCurvePoint",value:function(e,t,n,r){if(!(e.length<=2)){for(var a=Array(e.length-2),i=0;i0}},u=function(e){return"yes"===e.pstyle("text-events").strValue?yh:gh},c=function(e){var t=e.position(),n=t.x,r=t.y,a=e.outerWidth(),i=e.outerHeight();return{w:a,h:i,x1:n-a/2,y1:r-i/2}};n.drawing.addAtlasCollection("node",{texRows:e.webglTexRowsNodes}),n.drawing.addAtlasCollection("label",{texRows:e.webglTexRows}),n.drawing.addTextureAtlasRenderType("node-body",{collection:"node",getKey:t.getStyleKey,getBoundingBox:t.getElementBox,drawElement:t.drawElement}),n.drawing.addSimpleShapeRenderType("node-body",{getBoundingBox:c,isSimple:Zd,shapeProps:{shape:"shape",color:"background-color",opacity:"background-opacity",radius:"corner-radius",border:!0}}),n.drawing.addSimpleShapeRenderType("node-overlay",{getBoundingBox:c,isVisible:s("overlay"),shapeProps:{shape:"overlay-shape",color:"overlay-color",opacity:"overlay-opacity",padding:"overlay-padding",radius:"overlay-corner-radius"}}),n.drawing.addSimpleShapeRenderType("node-underlay",{getBoundingBox:c,isVisible:s("underlay"),shapeProps:{shape:"underlay-shape",color:"underlay-color",opacity:"underlay-opacity",padding:"underlay-padding",radius:"underlay-corner-radius"}}),n.drawing.addTextureAtlasRenderType("label",{collection:"label",getTexPickingMode:u,getKey:wh(t.getLabelKey,null),getBoundingBox:Eh(t.getLabelBox,null),drawClipped:!0,drawElement:t.drawLabel,getRotation:a(null),getRotationPoint:t.getLabelRotationPoint,getRotationOffset:t.getLabelRotationOffset,isVisible:i("label")}),n.drawing.addTextureAtlasRenderType("edge-source-label",{collection:"label",getTexPickingMode:u,getKey:wh(t.getSourceLabelKey,"source"),getBoundingBox:Eh(t.getSourceLabelBox,"source"),drawClipped:!0,drawElement:t.drawSourceLabel,getRotation:a("source"),getRotationPoint:t.getSourceLabelRotationPoint,getRotationOffset:t.getSourceLabelRotationOffset,isVisible:i("source-label")}),n.drawing.addTextureAtlasRenderType("edge-target-label",{collection:"label",getTexPickingMode:u,getKey:wh(t.getTargetLabelKey,"target"),getBoundingBox:Eh(t.getTargetLabelBox,"target"),drawClipped:!0,drawElement:t.drawTargetLabel,getRotation:a("target"),getRotationPoint:t.getTargetLabelRotationPoint,getRotationOffset:t.getTargetLabelRotationOffset,isVisible:i("target-label")});var d=Re(function(){console.log("garbage collect flag set"),n.data.gc=!0},1e4);n.onUpdateEleCalcs(function(e,t){var r=!1;t&&t.length>0&&(r|=n.drawing.invalidate(t)),r&&d()}),function(e){var t=e.render;e.render=function(n){n=n||{};var r=e.cy;e.webgl&&(r.zoom()>vd?(!function(e){var t=e.data.contexts[e.WEBGL];t.clear(t.COLOR_BUFFER_BIT|t.DEPTH_BUFFER_BIT)}(e),t.call(e,n)):(!function(e){var t=function(t){t.save(),t.setTransform(1,0,0,1,0,0),t.clearRect(0,0,e.canvasWidth,e.canvasHeight),t.restore()};t(e.data.contexts[e.NODE]),t(e.data.contexts[e.DRAG])}(e),Ch(e,n,vh.SCREEN)))};var n=e.matchCanvasSize;e.matchCanvasSize=function(t){n.call(e,t),e.pickingFrameBuffer.setFramebufferAttachmentSizes(e.canvasWidth,e.canvasHeight),e.pickingFrameBuffer.needsDraw=!0},e.findNearestElements=function(t,n,r,a){return function(e,t,n){var r,a,i,s=function(e,t,n){var r,a,i,o,s=Gd(e),u=s.pan,c=s.zoom,d=function(e,t,n,r,a){var i=r*n+t.x,o=a*n+t.y;return[i,o=Math.round(e.canvasHeight-o)]}(e,u,c,t,n),h=l(d,2),f=h[0],p=h[1],v=6;if(r=f-v/2,a=p-v/2,o=v,0===(i=v)||0===o)return[];var g=e.data.contexts[e.WEBGL];g.bindFramebuffer(g.FRAMEBUFFER,e.pickingFrameBuffer),e.pickingFrameBuffer.needsDraw&&(g.viewport(0,0,g.canvas.width,g.canvas.height),Ch(e,null,vh.PICKING),e.pickingFrameBuffer.needsDraw=!1);var y=i*o,m=new Uint8Array(4*y);g.readPixels(r,a,i,o,g.RGBA,g.UNSIGNED_BYTE,m),g.bindFramebuffer(g.FRAMEBUFFER,null);for(var b=new Set,x=0;x=0&&b.add(w)}return b}(e,t,n),u=e.getCachedZSortedEles(),c=o(s);try{for(c.s();!(i=c.n()).done;){var d=u[i.value];if(!r&&d.isNode()&&(r=d),!a&&d.isEdge()&&(a=d),r&&a)break}}catch(h){c.e(h)}finally{c.f()}return[r,a].filter(Boolean)}(e,t,n)};var r=e.invalidateCachedZSortedEles;e.invalidateCachedZSortedEles=function(){r.call(e),e.pickingFrameBuffer.needsDraw=!0};var a=e.notify;e.notify=function(t,n){a.call(e,t,n),"viewport"===t||"bounds"===t?e.pickingFrameBuffer.needsDraw=!0:"background"===t&&e.drawing.invalidate(n,{type:"node-body"})}}(n)};var wh=function(e,t){return function(n){var r=e(n),a=xh(n,t);return a.length>1?a.map(function(e,t){return"".concat(r,"_").concat(t)}):r}},Eh=function(e,t){return function(n,r){var a=e(n);if("string"==typeof r){var i=r.indexOf("_");if(i>0){var o=Number(r.substring(i+1)),s=xh(n,t),l=a.h/s.length,u=l*o,c=a.y1+u;return{x1:a.x1,w:a.w,y1:c,h:l,yOffset:u}}}return a}};function kh(e,t){var n=e.canvasWidth,r=e.canvasHeight,a=Gd(e),i=a.pan,o=a.zoom;t.setTransform(1,0,0,1,0,0),t.clearRect(0,0,n,r),t.translate(i.x,i.y),t.scale(o,o)}function Th(e,t,n){var r=e.drawing;t+=1,n.isNode()?(r.drawNode(n,t,"node-underlay"),r.drawNode(n,t,"node-body"),r.drawTexture(n,t,"label"),r.drawNode(n,t,"node-overlay")):(r.drawEdgeLine(n,t),r.drawEdgeArrow(n,t,"source"),r.drawEdgeArrow(n,t,"target"),r.drawTexture(n,t,"label"),r.drawTexture(n,t,"edge-source-label"),r.drawTexture(n,t,"edge-target-label"))}function Ch(e,t,n){var r;e.webglDebug&&(r=performance.now());var a=e.drawing,i=0;if(n.screen&&e.data.canvasNeedsRedraw[e.SELECT_BOX]&&function(e,t){e.drawSelectionRectangle(t,function(t){return kh(e,t)})}(e,t),e.data.canvasNeedsRedraw[e.NODE]||n.picking){var s=e.data.contexts[e.WEBGL];n.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 l=function(e){var t=e.canvasWidth,n=e.canvasHeight,r=Gd(e),a=r.pan,i=r.zoom,o=oh();lh(o,o,[a.x,a.y]),ch(o,o,[i,i]);var s=oh();!function(e,t,n){e[0]=2/t,e[1]=0,e[2]=0,e[3]=0,e[4]=-2/n,e[5]=0,e[6]=-1,e[7]=1,e[8]=1}(s,t,n);var l,u,c,d,h,f,p,v,g,y,m,b,x,w,E,k,T,C,P,S,B,D=oh();return l=D,c=o,d=(u=s)[0],h=u[1],f=u[2],p=u[3],v=u[4],g=u[5],y=u[6],m=u[7],b=u[8],x=c[0],w=c[1],E=c[2],k=c[3],T=c[4],C=c[5],P=c[6],S=c[7],B=c[8],l[0]=x*d+w*p+E*y,l[1]=x*h+w*v+E*m,l[2]=x*f+w*g+E*b,l[3]=k*d+T*p+C*y,l[4]=k*h+T*v+C*m,l[5]=k*f+T*g+C*b,l[6]=P*d+S*p+B*y,l[7]=P*h+S*v+B*m,l[8]=P*f+S*g+B*b,D}(e),u=e.getCachedZSortedEles();if(i=u.length,a.startFrame(l,n),n.screen){for(var c=0;c0&&i>0){h.clearRect(0,0,a,i),h.globalCompositeOperation="source-over";var f=this.getCachedZSortedEles();if(e.full)h.translate(-n.x1*l,-n.y1*l),h.scale(l,l),this.drawElements(h,f),h.scale(1/l,1/l),h.translate(n.x1*l,n.y1*l);else{var p=t.pan(),v={x:p.x*l,y:p.y*l};l*=t.zoom(),h.translate(v.x,v.y),h.scale(l,l),this.drawElements(h,f),h.scale(1/l,1/l),h.translate(-v.x,-v.y)}e.bg&&(h.globalCompositeOperation="destination-over",h.fillStyle=e.bg,h.rect(0,0,a,i),h.fill())}return d},Rh.png=function(e){return Nh(e,this.bufferCanvasImage(e),"image/png")},Rh.jpg=function(e){return Nh(e,this.bufferCanvasImage(e),"image/jpeg")};var Lh={nodeShapeImpl:function(e,t,n,r,a,i,o,s){switch(e){case"ellipse":return this.drawEllipsePath(t,n,r,a,i);case"polygon":return this.drawPolygonPath(t,n,r,a,i,o);case"round-polygon":return this.drawRoundPolygonPath(t,n,r,a,i,o,s);case"roundrectangle":case"round-rectangle":return this.drawRoundRectanglePath(t,n,r,a,i,s);case"cutrectangle":case"cut-rectangle":return this.drawCutRectanglePath(t,n,r,a,i,o,s);case"bottomroundrectangle":case"bottom-round-rectangle":return this.drawBottomRoundRectanglePath(t,n,r,a,i,s);case"barrel":return this.drawBarrelPath(t,n,r,a,i)}}},zh=Vh,Oh=Vh.prototype;function Vh(e){var t=this,n=t.cy.window().document;e.webgl&&(Oh.CANVAS_LAYERS=t.CANVAS_LAYERS=4,console.log("webgl rendering enabled")),t.data={canvases:new Array(Oh.CANVAS_LAYERS),contexts:new Array(Oh.CANVAS_LAYERS),canvasNeedsRedraw:new Array(Oh.CANVAS_LAYERS),bufferCanvases:new Array(Oh.BUFFER_COUNT),bufferContexts:new Array(Oh.CANVAS_LAYERS)};var r="-webkit-tap-highlight-color",a="rgba(0,0,0,0)";t.data.canvasContainer=n.createElement("div");var i=t.data.canvasContainer.style;t.data.canvasContainer.style[r]=a,i.position="relative",i.zIndex="0",i.overflow="hidden";var o=e.cy.container();o.appendChild(t.data.canvasContainer),o.style[r]=a;var s={"-webkit-user-select":"none","-moz-user-select":"-moz-none","user-select":"none","-webkit-tap-highlight-color":"rgba(0,0,0,0)","outline-style":"none"};p&&p.userAgent.match(/msie|trident|edge/i)&&(s["-ms-touch-action"]="none",s["touch-action"]="none");for(var l=0;lv});n(6540);var s=n(8215),a=n(7559),i=n(4718),r=n(9169),o=n(8774),c=n(1312),l=n(6025),d=n(4848);function u(e){return(0,d.jsx)("svg",{viewBox:"0 0 24 24",...e,children:(0,d.jsx)("path",{d:"M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z",fill:"currentColor"})})}const m="breadcrumbHomeIcon_YNFT";function h(){const e=(0,l.Ay)("/");return(0,d.jsx)("li",{className:"breadcrumbs__item",children:(0,d.jsx)(o.A,{"aria-label":(0,c.T)({id:"theme.docs.breadcrumbs.home",message:"Home page",description:"The ARIA label for the home page in the breadcrumbs"}),className:"breadcrumbs__link",href:e,children:(0,d.jsx)(u,{className:m})})})}var f=n(5260),p=n(4586);function x(e){const t=function({breadcrumbs:e}){const{siteConfig:t}=(0,p.A)();return{"@context":"https://schema.org","@type":"BreadcrumbList",itemListElement:e.filter(e=>e.href).map((e,n)=>({"@type":"ListItem",position:n+1,name:e.label,item:`${t.url}${e.href}`}))}}({breadcrumbs:e.breadcrumbs});return(0,d.jsx)(f.A,{children:(0,d.jsx)("script",{type:"application/ld+json",children:JSON.stringify(t)})})}const g="breadcrumbsContainer_Z_bl";function b({children:e,href:t,isLast:n}){const s="breadcrumbs__link";return n?(0,d.jsx)("span",{className:s,children:e}):t?(0,d.jsx)(o.A,{className:s,href:t,children:(0,d.jsx)("span",{children:e})}):(0,d.jsx)("span",{className:s,children:e})}function j({children:e,active:t}){return(0,d.jsx)("li",{className:(0,s.A)("breadcrumbs__item",{"breadcrumbs__item--active":t}),children:e})}function v(){const e=(0,i.OF)(),t=(0,r.Dt)();return e?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(x,{breadcrumbs:e}),(0,d.jsx)("nav",{className:(0,s.A)(a.G.docs.docBreadcrumbs,g),"aria-label":(0,c.T)({id:"theme.docs.breadcrumbs.navAriaLabel",message:"Breadcrumbs",description:"The ARIA label for the breadcrumbs"}),children:(0,d.jsxs)("ul",{className:"breadcrumbs",children:[t&&(0,d.jsx)(h,{}),e.map((t,n)=>{const s=n===e.length-1,a="category"===t.type&&t.linkUnlisted?void 0:t.href;return(0,d.jsx)(j,{active:s,children:(0,d.jsx)(b,{href:a,isLast:s,children:t.label})},n)})]})})]}):null}},1719(e,t,n){"use strict";n.r(t),n.d(t,{default:()=>En});var s=n(6540),a=n(5500),i=n(9532),r=n(4848);const o=s.createContext(null);function c({children:e,content:t}){const n=function(e){return(0,s.useMemo)(()=>({metadata:e.metadata,frontMatter:e.frontMatter,assets:e.assets,contentTitle:e.contentTitle,toc:e.toc}),[e])}(t);return(0,r.jsx)(o.Provider,{value:n,children:e})}function l(){const e=(0,s.useContext)(o);if(null===e)throw new i.dV("DocProvider");return e}function d(){const{metadata:e,frontMatter:t,assets:n}=l();return(0,r.jsx)(a.be,{title:e.title,description:e.description,keywords:t.keywords,image:n.image??t.image})}var u=n(8215),m=n(4581),h=n(6929);function f(){const{metadata:e}=l();return(0,r.jsx)(h.A,{className:"docusaurus-mt-lg",previous:e.previous,next:e.next})}var p=n(1878),x=n(4267);function g(e){var t,n,s="";if("string"==typeof e||"number"==typeof e)s+=e;else if("object"==typeof e)if(Array.isArray(e))for(t=0;t(0,r.jsx)("li",{className:_,children:(0,r.jsx)(L,{...e})},e.permalink))})]})}const B="iconEdit_Z9Sw";function M({className:e,...t}){return(0,r.jsx)("svg",{fill:"currentColor",height:"20",width:"20",viewBox:"0 0 40 40",className:(0,u.A)(B,e),"aria-hidden":"true",...t,children:(0,r.jsx)("g",{children:(0,r.jsx)("path",{d:"m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"})})})}function H({editUrl:e}){return(0,r.jsxs)(A.A,{to:e,className:j.G.common.editThisPage,children:[(0,r.jsx)(M,{}),(0,r.jsx)(N.A,{id:"theme.common.editThisPage",description:"The link label to edit the current page",children:"Edit this page"})]})}function E(e={}){const{i18n:{currentLocale:t}}=(0,v.A)(),n=function(){const{i18n:{currentLocale:e,localeConfigs:t}}=(0,v.A)();return t[e].calendar}();return new Intl.DateTimeFormat(t,{calendar:n,...e})}function S({lastUpdatedAt:e}){const t=new Date(e),n=E({day:"numeric",month:"short",year:"numeric",timeZone:"UTC"}).format(t);return(0,r.jsx)(N.A,{id:"theme.lastUpdated.atDate",description:"The words used to describe on which date a page has been last updated",values:{date:(0,r.jsx)("b",{children:(0,r.jsx)("time",{dateTime:t.toISOString(),itemProp:"dateModified",children:n})})},children:" on {date}"})}function I({lastUpdatedBy:e}){return(0,r.jsx)(N.A,{id:"theme.lastUpdated.byUser",description:"The words used to describe by who the page has been last updated",values:{user:(0,r.jsx)("b",{children:e})},children:" by {user}"})}function V({lastUpdatedAt:e,lastUpdatedBy:t}){return(0,r.jsxs)("span",{className:j.G.common.lastUpdated,children:[(0,r.jsx)(N.A,{id:"theme.lastUpdated.lastUpdatedAtBy",description:"The sentence used to display when a page has been last updated, and by who",values:{atDate:e?(0,r.jsx)(S,{lastUpdatedAt:e}):"",byUser:t?(0,r.jsx)(I,{lastUpdatedBy:t}):""},children:"Last updated{atDate}{byUser}"}),!1]})}const U="lastUpdated_JAkA",O="noPrint_WFHX";function z({className:e,editUrl:t,lastUpdatedAt:n,lastUpdatedBy:s}){return(0,r.jsxs)("div",{className:(0,u.A)("row",e),children:[(0,r.jsx)("div",{className:(0,u.A)("col",O),children:t&&(0,r.jsx)(H,{editUrl:t})}),(0,r.jsx)("div",{className:(0,u.A)("col",U),children:(n||s)&&(0,r.jsx)(V,{lastUpdatedAt:n,lastUpdatedBy:s})})]})}var R=n(8007),P=n(8077);function $(){const{siteConfig:e}=(0,v.A)(),{metadata:t,frontMatter:n}=l(),{editUrl:s,lastUpdatedAt:a,lastUpdatedBy:i,tags:o}=t,c=!!n?.hide_app_cross_links,d=Array.isArray(n?.apps)?n.apps:null,u=e?.themeConfig?.conduction?.appId,m=(d&&d.length>0?d:u?[u]:[]).filter(e=>P.xS[e]),h=o.length>0,f=!!(s||a||i),p=!c&&m.length>0;return h||f||p?(0,r.jsxs)("footer",{className:b(j.G.docs.docFooter,"docusaurus-mt-lg"),children:[h&&(0,r.jsx)("div",{className:b("row margin-top--sm",j.G.docs.docFooterTagsRow),children:(0,r.jsx)("div",{className:"col",children:(0,r.jsx)(T,{tags:o})})}),f&&(0,r.jsx)(z,{className:b("margin-top--sm",j.G.docs.docFooterEditMetaRow),editUrl:s,lastUpdatedAt:a,lastUpdatedBy:i}),p&&(0,r.jsx)("div",{className:"margin-top--lg",children:(0,r.jsx)(R.bv,{variant:"inline",apps:m,surface:"docs",heading:1===m.length?"About this app":"About these apps"})})]}):null}var D=n(1422),F=n(6342);function G(e){const t=e.map(e=>({...e,parentIndex:-1,children:[]})),n=Array(7).fill(-1);t.forEach((e,t)=>{const s=n.slice(2,e.level);e.parentIndex=Math.max(...s),n[e.level]=t});const s=[];return t.forEach(e=>{const{parentIndex:n,...a}=e;n>=0?t[n].children.push(a):s.push(a)}),s}function W({toc:e,minHeadingLevel:t,maxHeadingLevel:n}){return e.flatMap(e=>{const s=W({toc:e.children,minHeadingLevel:t,maxHeadingLevel:n});return function(e){return e.level>=t&&e.level<=n}(e)?[{...e,children:s}]:s})}function q(e){const t=e.getBoundingClientRect();return t.top===t.bottom?q(e.parentNode):t}function J(e,{anchorTopOffset:t}){const n=e.find(e=>q(e).top>=t);if(n){return function(e){return e.top>0&&e.bottom{e.current=t?0:document.querySelector(".navbar").clientHeight},[t]),e}function X(e){const t=(0,s.useRef)(void 0),n=Z();(0,s.useEffect)(()=>{if(!e)return()=>{};const{linkClassName:s,linkActiveClassName:a,minHeadingLevel:i,maxHeadingLevel:r}=e;function o(){const e=function(e){return Array.from(document.getElementsByClassName(e))}(s),o=function({minHeadingLevel:e,maxHeadingLevel:t}){const n=[];for(let s=e;s<=t;s+=1)n.push(`h${s}.anchor`);return Array.from(document.querySelectorAll(n.join()))}({minHeadingLevel:i,maxHeadingLevel:r}),c=J(o,{anchorTopOffset:n.current}),l=e.find(e=>c&&c.id===function(e){return decodeURIComponent(e.href.substring(e.href.indexOf("#")+1))}(e));e.forEach(e=>{!function(e,n){n?(t.current&&t.current!==e&&t.current.classList.remove(a),e.classList.add(a),t.current=e):e.classList.remove(a)}(e,e===l)})}return document.addEventListener("scroll",o),document.addEventListener("resize",o),o(),()=>{document.removeEventListener("scroll",o),document.removeEventListener("resize",o)}},[e,n])}function Y({toc:e,className:t,linkClassName:n,isChild:s}){return e.length?(0,r.jsx)("ul",{className:s?void 0:t,children:e.map(e=>(0,r.jsxs)("li",{children:[(0,r.jsx)(A.A,{to:`#${e.id}`,className:n??void 0,dangerouslySetInnerHTML:{__html:e.value}}),(0,r.jsx)(Y,{isChild:!0,toc:e.children,className:t,linkClassName:n})]},e.id))}):null}const Q=s.memo(Y);function K({toc:e,className:t="table-of-contents table-of-contents__left-border",linkClassName:n="table-of-contents__link",linkActiveClassName:a,minHeadingLevel:i,maxHeadingLevel:o,...c}){const l=(0,F.p)(),d=i??l.tableOfContents.minHeadingLevel,u=o??l.tableOfContents.maxHeadingLevel,m=function({toc:e,minHeadingLevel:t,maxHeadingLevel:n}){return(0,s.useMemo)(()=>W({toc:G(e),minHeadingLevel:t,maxHeadingLevel:n}),[e,t,n])}({toc:e,minHeadingLevel:d,maxHeadingLevel:u});return X((0,s.useMemo)(()=>{if(n&&a)return{linkClassName:n,linkActiveClassName:a,minHeadingLevel:d,maxHeadingLevel:u}},[n,a,d,u])),(0,r.jsx)(Q,{toc:m,className:t,linkClassName:n,...c})}const ee="tocCollapsibleButton_TO0P",te="tocCollapsibleButtonExpanded_MG3E";function ne({collapsed:e,...t}){return(0,r.jsx)("button",{type:"button",...t,className:(0,u.A)("clean-btn",ee,!e&&te,t.className),children:(0,r.jsx)(N.A,{id:"theme.TOCCollapsible.toggleButtonLabel",description:"The label used by the button on the collapsible TOC component",children:"On this page"})})}const se="tocCollapsible_ETCw",ae="tocCollapsibleContent_vkbj",ie="tocCollapsibleExpanded_sAul";function re({toc:e,className:t,minHeadingLevel:n,maxHeadingLevel:s}){const{collapsed:a,toggleCollapsed:i}=(0,D.u)({initialState:!0});return(0,r.jsxs)("div",{className:(0,u.A)(se,!a&&ie,t),children:[(0,r.jsx)(ne,{collapsed:a,onClick:i}),(0,r.jsx)(D.N,{lazy:!0,className:ae,collapsed:a,children:(0,r.jsx)(K,{toc:e,minHeadingLevel:n,maxHeadingLevel:s})})]})}const oe="tocMobile_ITEo";function ce(){const{toc:e,frontMatter:t}=l();return(0,r.jsx)(re,{toc:e,minHeadingLevel:t.toc_min_heading_level,maxHeadingLevel:t.toc_max_heading_level,className:(0,u.A)(j.G.docs.docTocMobile,oe)})}const le="tableOfContents_bqdL";function de({className:e,...t}){return(0,r.jsx)("div",{className:(0,u.A)(le,"thin-scrollbar",e),children:(0,r.jsx)(K,{...t,linkClassName:"table-of-contents__link toc-highlight",linkActiveClassName:"table-of-contents__link--active"})})}function ue(){const{toc:e,frontMatter:t}=l();return(0,r.jsx)(de,{toc:e,minHeadingLevel:t.toc_min_heading_level,maxHeadingLevel:t.toc_max_heading_level,className:j.G.docs.docTocDesktop})}var me=n(5260),he=n(1107),fe=n(8453),pe=n(2303),xe=n(5293);function ge(){const{prism:e}=(0,F.p)(),{colorMode:t}=(0,xe.G)(),n=e.theme,s=e.darkTheme||n;return"dark"===t?s:n}var be=n(5066),je=n(8426),ve=n.n(je);const Ne=/title=(?["'])(?.*?)\1/,Ae=/\{(?[\d,-]+)\}/,ye={js:{start:"\\/\\/",end:""},jsBlock:{start:"\\/\\*",end:"\\*\\/"},jsx:{start:"\\{\\s*\\/\\*",end:"\\*\\/\\s*\\}"},bash:{start:"#",end:""},html:{start:"\x3c!--",end:"--\x3e"}},ke={...ye,lua:{start:"--",end:""},wasm:{start:"\\;\\;",end:""},tex:{start:"%",end:""},vb:{start:"['\u2018\u2019]",end:""},vbnet:{start:"(?:_\\s*)?['\u2018\u2019]",end:""},rem:{start:"[Rr][Ee][Mm]\\b",end:""},f90:{start:"!",end:""},ml:{start:"\\(\\*",end:"\\*\\)"},cobol:{start:"\\*>",end:""}},Ce=Object.keys(ye);function Le(e,t){const n=e.map(e=>{const{start:n,end:s}=ke[e];return`(?:${n}\\s*(${t.flatMap(e=>[e.line,e.block?.start,e.block?.end].filter(Boolean)).join("|")})\\s*${s})`}).join("|");return new RegExp(`^\\s*(?:${n})\\s*$`)}function we({showLineNumbers:e,metastring:t}){return"boolean"==typeof e?e?1:void 0:"number"==typeof e?e:function(e){const t=e?.split(" ").find(e=>e.startsWith("showLineNumbers"));if(t){if(t.startsWith("showLineNumbers=")){const e=t.replace("showLineNumbers=","");return parseInt(e,10)}return 1}}(t)}function _e(e,t){const{language:n,magicComments:s}=t;if(void 0===n)return{lineClassNames:{},code:e};const a=function(e,t){switch(e){case"js":case"javascript":case"ts":case"typescript":return Le(["js","jsBlock"],t);case"jsx":case"tsx":return Le(["js","jsBlock","jsx"],t);case"html":return Le(["js","jsBlock","html"],t);case"python":case"py":case"bash":return Le(["bash"],t);case"markdown":case"md":return Le(["html","jsx","bash"],t);case"tex":case"latex":case"matlab":return Le(["tex"],t);case"lua":case"haskell":return Le(["lua"],t);case"sql":return Le(["lua","jsBlock"],t);case"wasm":return Le(["wasm"],t);case"vb":case"vba":case"visual-basic":return Le(["vb","rem"],t);case"vbnet":return Le(["vbnet","rem"],t);case"batch":return Le(["rem"],t);case"basic":return Le(["rem","f90"],t);case"fsharp":return Le(["js","ml"],t);case"ocaml":case"sml":return Le(["ml"],t);case"fortran":return Le(["f90"],t);case"cobol":return Le(["cobol"],t);default:return Le(Ce,t)}}(n,s),i=e.split(/\r?\n/),r=Object.fromEntries(s.map(e=>[e.className,{start:0,range:""}])),o=Object.fromEntries(s.filter(e=>e.line).map(({className:e,line:t})=>[t,e])),c=Object.fromEntries(s.filter(e=>e.block).map(({className:e,block:t})=>[t.start,e])),l=Object.fromEntries(s.filter(e=>e.block).map(({className:e,block:t})=>[t.end,e]));for(let u=0;uvoid 0!==e);o[t]?r[o[t]].range+=`${u},`:c[t]?r[c[t]].start=u:l[t]&&(r[l[t]].range+=`${r[l[t]].start}-${u-1},`),i.splice(u,1)}const d={};return Object.entries(r).forEach(([e,{range:t}])=>{ve()(t).forEach(t=>{d[t]??=[],d[t].push(e)})}),{code:i.join("\n"),lineClassNames:d}}function Te(e,t){const n=e.replace(/\r?\n$/,"");return function(e,{metastring:t,magicComments:n}){if(t&&Ae.test(t)){const s=t.match(Ae).groups.range;if(0===n.length)throw new Error(`A highlight range has been given in code block's metastring (\`\`\` ${t}), but no magic comment config is available. Docusaurus applies the first magic comment entry's className for metastring ranges.`);const a=n[0].className,i=ve()(s).filter(e=>e>0).map(e=>[e-1,[a]]);return{lineClassNames:Object.fromEntries(i),code:e}}return null}(n,{...t})??_e(n,{...t})}function Be(e){const t=function(e){return t=e.language??function(e){if(!e)return;const t=e.split(" ").find(e=>e.startsWith("language-"));return t?.replace(/language-/,"")}(e.className)??e.defaultLanguage,t?.toLowerCase()??"text";var t}({language:e.language,defaultLanguage:e.defaultLanguage,className:e.className}),{lineClassNames:n,code:s}=Te(e.code,{metastring:e.metastring,magicComments:e.magicComments,language:t}),a=function({className:e,language:t}){return(0,be.A)(e,t&&!e?.includes(`language-${t}`)&&`language-${t}`)}({className:e.className,language:t}),i=(r=e.metastring,(r?.match(Ne)?.groups.title??"")||e.title);var r;const o=we({showLineNumbers:e.showLineNumbers,metastring:e.metastring});return{codeInput:e.code,code:s,className:a,language:t,title:i,lineNumbersStart:o,lineClassNames:n}}const Me=(0,s.createContext)(null);function He({metadata:e,wordWrap:t,children:n}){const a=(0,s.useMemo)(()=>({metadata:e,wordWrap:t}),[e,t]);return(0,r.jsx)(Me.Provider,{value:a,children:n})}function Ee(){const e=(0,s.useContext)(Me);if(null===e)throw new i.dV("CodeBlockContextProvider");return e}const Se="codeBlockContainer_Ckt0";function Ie({as:e,...t}){const n=function(e){const t={color:"--prism-color",backgroundColor:"--prism-background-color"},n={};return Object.entries(e.plain).forEach(([e,s])=>{const a=t[e];a&&"string"==typeof s&&(n[a]=s)}),n}(ge());return(0,r.jsx)(e,{...t,style:n,className:(0,u.A)(t.className,Se,j.G.common.codeBlock)})}const Ve="codeBlock_bY9V",Ue="codeBlockStandalone_MEMb",Oe="codeBlockLines_e6Vv",ze="codeBlockLinesWithNumbering_o6Pm";function Re({children:e,className:t}){return(0,r.jsx)(Ie,{as:"pre",tabIndex:0,className:(0,u.A)(Ue,"thin-scrollbar",t),children:(0,r.jsx)("code",{className:Oe,children:e})})}const Pe={attributes:!0,characterData:!0,childList:!0,subtree:!0};function $e(e,t){const[n,a]=(0,s.useState)(),r=(0,s.useCallback)(()=>{a(e.current?.closest("[role=tabpanel][hidden]"))},[e,a]);(0,s.useEffect)(()=>{r()},[r]),function(e,t,n=Pe){const a=(0,i._q)(t),r=(0,i.Be)(n);(0,s.useEffect)(()=>{const t=new MutationObserver(a);return e&&t.observe(e,r),()=>t.disconnect()},[e,a,r])}(n,e=>{e.forEach(e=>{"attributes"===e.type&&"hidden"===e.attributeName&&(t(),r())})},{attributes:!0,characterData:!1,childList:!1,subtree:!1})}function De({children:e}){return e}var Fe=n(4876);function Ge({line:e,token:t,...n}){return(0,r.jsx)("span",{...n})}const We="codeLine_lJS_",qe="codeLineNumber_Tfdd",Je="codeLineContent_feaV";function Ze(){return(0,r.jsx)("br",{})}function Xe({line:e,classNames:t,showLineNumbers:n,getLineProps:s,getTokenProps:a}){const i=function(e){const t=1===e.length&&"\n"===e[0].content?e[0]:void 0;return t?[{...t,content:""}]:e}(e),o=s({line:i,className:(0,u.A)(t,n&&We)}),c=i.map((e,t)=>{const n=a({token:e});return(0,r.jsx)(Ge,{...n,line:i,token:e,children:n.children},t)});return(0,r.jsxs)("div",{...o,children:[n?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("span",{className:qe}),(0,r.jsx)("span",{className:Je,children:c})]}):c,(0,r.jsx)(Ze,{})]})}const Ye=s.forwardRef((e,t)=>(0,r.jsx)("pre",{ref:t,tabIndex:0,...e,className:(0,u.A)(e.className,Ve,"thin-scrollbar")}));function Qe(e){const{metadata:t}=Ee();return(0,r.jsx)("code",{...e,className:(0,u.A)(e.className,Oe,void 0!==t.lineNumbersStart&&ze),style:{...e.style,counterReset:void 0===t.lineNumbersStart?void 0:"line-count "+(t.lineNumbersStart-1)}})}function Ke({className:e}){const{metadata:t,wordWrap:n}=Ee(),s=ge(),{code:a,language:i,lineNumbersStart:o,lineClassNames:c}=t;return(0,r.jsx)(Fe.f4,{theme:s,code:a,language:i,children:({className:t,style:s,tokens:a,getLineProps:i,getTokenProps:l})=>(0,r.jsx)(Ye,{ref:n.codeBlockRef,className:(0,u.A)(e,t),style:s,children:(0,r.jsx)(Qe,{children:a.map((e,t)=>(0,r.jsx)(Xe,{line:e,getLineProps:i,getTokenProps:l,classNames:c[t],showLineNumbers:void 0!==o},t))})})})}function et({children:e,fallback:t}){return(0,pe.A)()?(0,r.jsx)(r.Fragment,{children:e?.()}):t??null}function tt({className:e,...t}){return(0,r.jsx)("button",{type:"button",...t,className:(0,u.A)("clean-btn",e)})}function nt(e){return(0,r.jsx)("svg",{viewBox:"0 0 24 24",...e,children:(0,r.jsx)("path",{fill:"currentColor",d:"M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"})})}function st(e){return(0,r.jsx)("svg",{viewBox:"0 0 24 24",...e,children:(0,r.jsx)("path",{fill:"currentColor",d:"M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"})})}const at={copyButtonCopied:"copyButtonCopied_Vdqa",copyButtonIcons:"copyButtonIcons_IEyt",copyButtonIcon:"copyButtonIcon_TrPX",copyButtonSuccessIcon:"copyButtonSuccessIcon_cVMy"};function it(e){return e?(0,N.T)({id:"theme.CodeBlock.copied",message:"Copied",description:"The copied button label on code blocks"}):(0,N.T)({id:"theme.CodeBlock.copyButtonAriaLabel",message:"Copy code to clipboard",description:"The ARIA label for copy code blocks button"})}function rt(){const{metadata:{code:e}}=Ee(),[t,a]=(0,s.useState)(!1),i=(0,s.useRef)(void 0),r=(0,s.useCallback)(()=>{(async function(e){if(navigator.clipboard)return navigator.clipboard.writeText(e);const{default:t}=await n.e(3436).then(n.bind(n,3436));return t(e)})(e).then(()=>{a(!0),i.current=window.setTimeout(()=>{a(!1)},1e3)})},[e]);return(0,s.useEffect)(()=>()=>window.clearTimeout(i.current),[]),{copyCode:r,isCopied:t}}function ot({className:e}){const{copyCode:t,isCopied:n}=rt();return(0,r.jsx)(tt,{"aria-label":it(n),title:(0,N.T)({id:"theme.CodeBlock.copy",message:"Copy",description:"The copy button label on code blocks"}),className:(0,u.A)(e,at.copyButton,n&&at.copyButtonCopied),onClick:t,children:(0,r.jsxs)("span",{className:at.copyButtonIcons,"aria-hidden":"true",children:[(0,r.jsx)(nt,{className:at.copyButtonIcon}),(0,r.jsx)(st,{className:at.copyButtonSuccessIcon})]})})}function ct(e){return(0,r.jsx)("svg",{viewBox:"0 0 24 24",...e,children:(0,r.jsx)("path",{fill:"currentColor",d:"M4 19h6v-2H4v2zM20 5H4v2h16V5zm-3 6H4v2h13.25c1.1 0 2 .9 2 2s-.9 2-2 2H15v-2l-3 3l3 3v-2h2c2.21 0 4-1.79 4-4s-1.79-4-4-4z"})})}const lt="wordWrapButtonIcon_b1P5",dt="wordWrapButtonEnabled_uzNF";function ut({className:e}){const{wordWrap:t}=Ee();if(!(t.isEnabled||t.isCodeScrollable))return!1;const n=(0,N.T)({id:"theme.CodeBlock.wordWrapToggle",message:"Toggle word wrap",description:"The title attribute for toggle word wrapping button of code block lines"});return(0,r.jsx)(tt,{onClick:()=>t.toggle(),className:(0,u.A)(e,t.isEnabled&&dt),"aria-label":n,title:n,children:(0,r.jsx)(ct,{className:lt,"aria-hidden":"true"})})}const mt="buttonGroup_M5ko";function ht({className:e}){return(0,r.jsx)(et,{children:()=>(0,r.jsxs)("div",{className:(0,u.A)(e,mt),children:[(0,r.jsx)(ut,{}),(0,r.jsx)(ot,{})]})})}const ft="codeBlockContent_QJqH",pt="codeBlockTitle_OeMC";function xt({className:e}){const{metadata:t}=Ee();return(0,r.jsxs)(Ie,{as:"div",className:(0,u.A)(e,t.className),children:[t.title&&(0,r.jsx)("div",{className:pt,children:(0,r.jsx)(De,{children:t.title})}),(0,r.jsxs)("div",{className:ft,children:[(0,r.jsx)(Ke,{}),(0,r.jsx)(ht,{})]})]})}function gt(e){const t=function(e){const{prism:t}=(0,F.p)();return Be({code:e.children,className:e.className,metastring:e.metastring,magicComments:t.magicComments,defaultLanguage:t.defaultLanguage,language:e.language,title:e.title,showLineNumbers:e.showLineNumbers})}(e),n=function(){const[e,t]=(0,s.useState)(!1),[n,a]=(0,s.useState)(!1),i=(0,s.useRef)(null),r=(0,s.useCallback)(()=>{const n=i.current.querySelector("code");e?n.removeAttribute("style"):(n.style.whiteSpace="pre-wrap",n.style.overflowWrap="anywhere"),t(e=>!e)},[i,e]),o=(0,s.useCallback)(()=>{const{scrollWidth:e,clientWidth:t}=i.current,n=e>t||i.current.querySelector("code").hasAttribute("style");a(n)},[i]);return $e(i,o),(0,s.useEffect)(()=>{o()},[e,o]),(0,s.useEffect)(()=>(window.addEventListener("resize",o,{passive:!0}),()=>{window.removeEventListener("resize",o)}),[o]),{codeBlockRef:i,isEnabled:e,isCodeScrollable:n,toggle:r}}();return(0,r.jsx)(He,{metadata:t,wordWrap:n,children:(0,r.jsx)(xt,{})})}function bt({children:e,...t}){const n=(0,pe.A)(),a=function(e){return s.Children.toArray(e).some(e=>(0,s.isValidElement)(e))?e:Array.isArray(e)?e.join(""):e}(e),i="string"==typeof a?gt:Re;return(0,r.jsx)(i,{...t,children:a},String(n))}function jt(e){return(0,r.jsx)("code",{...e})}var vt=n(3535);var Nt=n(3427);const At="details_lb9f",yt="isBrowser_bmU9",kt="collapsibleContent_i85q";function Ct(e){return!!e&&("SUMMARY"===e.tagName||Ct(e.parentElement))}function Lt(e,t){return!!e&&(e===t||Lt(e.parentElement,t))}function wt({summary:e,children:t,...n}){(0,Nt.A)().collectAnchor(n.id);const a=(0,pe.A)(),i=(0,s.useRef)(null),{collapsed:o,setCollapsed:c}=(0,D.u)({initialState:!n.open}),[l,d]=(0,s.useState)(n.open),u=s.isValidElement(e)?e:(0,r.jsx)("summary",{children:e??"Details"});return(0,r.jsxs)("details",{...n,ref:i,open:l,"data-collapsed":o,className:(0,be.A)(At,a&&yt,n.className),onMouseDown:e=>{Ct(e.target)&&e.detail>1&&e.preventDefault()},onClick:e=>{e.stopPropagation();const t=e.target;Ct(t)&&Lt(t,i.current)&&(e.preventDefault(),o?(c(!1),d(!0)):c(!0))},children:[u,(0,r.jsx)(D.N,{lazy:!1,collapsed:o,onCollapseTransitionEnd:e=>{c(e),d(!e)},children:(0,r.jsx)("div",{className:kt,children:t})})]})}const _t="details_b_Ee";function Tt({...e}){return(0,r.jsx)(wt,{...e,className:(0,u.A)("alert alert--info",_t,e.className)})}function Bt(e){const t=s.Children.toArray(e.children),n=t.find(e=>s.isValidElement(e)&&"summary"===e.type),a=(0,r.jsx)(r.Fragment,{children:t.filter(e=>e!==n)});return(0,r.jsx)(Tt,{...e,summary:n,children:a})}function Mt(e){return(0,r.jsx)(he.A,{...e})}const Ht="containsTaskList_mC6p";function Et(e){if(void 0!==e)return(0,u.A)(e,e?.includes("contains-task-list")&&Ht)}const St="img_ev3q";function It(e){const{mdxAdmonitionTitle:t,rest:n}=function(e){const t=s.Children.toArray(e),n=t.find(e=>s.isValidElement(e)&&"mdxAdmonitionTitle"===e.type),a=t.filter(e=>e!==n),i=n?.props.children;return{mdxAdmonitionTitle:i,rest:a.length>0?(0,r.jsx)(r.Fragment,{children:a}):null}}(e.children),a=e.title??t;return{...e,...a&&{title:a},children:n}}const Vt="admonition_xJq3",Ut="admonitionHeading_Gvgb",Ot="admonitionIcon_Rf37",zt="admonitionContent_BuS1";function Rt({type:e,className:t,children:n,id:s}){return(0,r.jsx)("div",{className:(0,u.A)(j.G.common.admonition,j.G.common.admonitionType(e),Vt,t),id:s,children:n})}function Pt({icon:e,title:t}){return(0,r.jsxs)("div",{className:Ut,children:[(0,r.jsx)("span",{className:Ot,children:e}),t]})}function $t({children:e}){return e?(0,r.jsx)("div",{className:zt,children:e}):null}function Dt(e){const{type:t,icon:n,title:s,children:a,className:i,id:o}=e;return(0,r.jsxs)(Rt,{type:t,className:i,id:o,children:[s||n?(0,r.jsx)(Pt,{title:s,icon:n}):null,(0,r.jsx)($t,{children:a})]})}function Ft(e){return(0,r.jsx)("svg",{viewBox:"0 0 14 16",...e,children:(0,r.jsx)("path",{fillRule:"evenodd",d:"M6.3 5.69a.942.942 0 0 1-.28-.7c0-.28.09-.52.28-.7.19-.18.42-.28.7-.28.28 0 .52.09.7.28.18.19.28.42.28.7 0 .28-.09.52-.28.7a1 1 0 0 1-.7.3c-.28 0-.52-.11-.7-.3zM8 7.99c-.02-.25-.11-.48-.31-.69-.2-.19-.42-.3-.69-.31H6c-.27.02-.48.13-.69.31-.2.2-.3.44-.31.69h1v3c.02.27.11.5.31.69.2.2.42.31.69.31h1c.27 0 .48-.11.69-.31.2-.19.3-.42.31-.69H8V7.98v.01zM7 2.3c-3.14 0-5.7 2.54-5.7 5.68 0 3.14 2.56 5.7 5.7 5.7s5.7-2.55 5.7-5.7c0-3.15-2.56-5.69-5.7-5.69v.01zM7 .98c3.86 0 7 3.14 7 7s-3.14 7-7 7-7-3.12-7-7 3.14-7 7-7z"})})}const Gt={icon:(0,r.jsx)(Ft,{}),title:(0,r.jsx)(N.A,{id:"theme.admonition.note",description:"The default label used for the Note admonition (:::note)",children:"note"})};function Wt(e){return(0,r.jsx)(Dt,{...Gt,...e,className:(0,u.A)("alert alert--secondary",e.className),children:e.children})}function qt(e){return(0,r.jsx)("svg",{viewBox:"0 0 12 16",...e,children:(0,r.jsx)("path",{fillRule:"evenodd",d:"M6.5 0C3.48 0 1 2.19 1 5c0 .92.55 2.25 1 3 1.34 2.25 1.78 2.78 2 4v1h5v-1c.22-1.22.66-1.75 2-4 .45-.75 1-2.08 1-3 0-2.81-2.48-5-5.5-5zm3.64 7.48c-.25.44-.47.8-.67 1.11-.86 1.41-1.25 2.06-1.45 3.23-.02.05-.02.11-.02.17H5c0-.06 0-.13-.02-.17-.2-1.17-.59-1.83-1.45-3.23-.2-.31-.42-.67-.67-1.11C2.44 6.78 2 5.65 2 5c0-2.2 2.02-4 4.5-4 1.22 0 2.36.42 3.22 1.19C10.55 2.94 11 3.94 11 5c0 .66-.44 1.78-.86 2.48zM4 14h5c-.23 1.14-1.3 2-2.5 2s-2.27-.86-2.5-2z"})})}const Jt={icon:(0,r.jsx)(qt,{}),title:(0,r.jsx)(N.A,{id:"theme.admonition.tip",description:"The default label used for the Tip admonition (:::tip)",children:"tip"})};function Zt(e){return(0,r.jsx)(Dt,{...Jt,...e,className:(0,u.A)("alert alert--success",e.className),children:e.children})}function Xt(e){return(0,r.jsx)("svg",{viewBox:"0 0 14 16",...e,children:(0,r.jsx)("path",{fillRule:"evenodd",d:"M7 2.3c3.14 0 5.7 2.56 5.7 5.7s-2.56 5.7-5.7 5.7A5.71 5.71 0 0 1 1.3 8c0-3.14 2.56-5.7 5.7-5.7zM7 1C3.14 1 0 4.14 0 8s3.14 7 7 7 7-3.14 7-7-3.14-7-7-7zm1 3H6v5h2V4zm0 6H6v2h2v-2z"})})}const Yt={icon:(0,r.jsx)(Xt,{}),title:(0,r.jsx)(N.A,{id:"theme.admonition.info",description:"The default label used for the Info admonition (:::info)",children:"info"})};function Qt(e){return(0,r.jsx)(Dt,{...Yt,...e,className:(0,u.A)("alert alert--info",e.className),children:e.children})}function Kt(e){return(0,r.jsx)("svg",{viewBox:"0 0 16 16",...e,children:(0,r.jsx)("path",{fillRule:"evenodd",d:"M8.893 1.5c-.183-.31-.52-.5-.887-.5s-.703.19-.886.5L.138 13.499a.98.98 0 0 0 0 1.001c.193.31.53.501.886.501h13.964c.367 0 .704-.19.877-.5a1.03 1.03 0 0 0 .01-1.002L8.893 1.5zm.133 11.497H6.987v-2.003h2.039v2.003zm0-3.004H6.987V5.987h2.039v4.006z"})})}const en={icon:(0,r.jsx)(Kt,{}),title:(0,r.jsx)(N.A,{id:"theme.admonition.warning",description:"The default label used for the Warning admonition (:::warning)",children:"warning"})};function tn(e){return(0,r.jsx)("svg",{viewBox:"0 0 12 16",...e,children:(0,r.jsx)("path",{fillRule:"evenodd",d:"M5.05.31c.81 2.17.41 3.38-.52 4.31C3.55 5.67 1.98 6.45.9 7.98c-1.45 2.05-1.7 6.53 3.53 7.7-2.2-1.16-2.67-4.52-.3-6.61-.61 2.03.53 3.33 1.94 2.86 1.39-.47 2.3.53 2.27 1.67-.02.78-.31 1.44-1.13 1.81 3.42-.59 4.78-3.42 4.78-5.56 0-2.84-2.53-3.22-1.25-5.61-1.52.13-2.03 1.13-1.89 2.75.09 1.08-1.02 1.8-1.86 1.33-.67-.41-.66-1.19-.06-1.78C8.18 5.31 8.68 2.45 5.05.32L5.03.3l.02.01z"})})}const nn={icon:(0,r.jsx)(tn,{}),title:(0,r.jsx)(N.A,{id:"theme.admonition.danger",description:"The default label used for the Danger admonition (:::danger)",children:"danger"})};const sn={icon:(0,r.jsx)(Kt,{}),title:(0,r.jsx)(N.A,{id:"theme.admonition.caution",description:"The default label used for the Caution admonition (:::caution)",children:"caution"})};const an={...{note:Wt,tip:Zt,info:Qt,warning:function(e){return(0,r.jsx)(Dt,{...en,...e,className:(0,u.A)("alert alert--warning",e.className),children:e.children})},danger:function(e){return(0,r.jsx)(Dt,{...nn,...e,className:(0,u.A)("alert alert--danger",e.className),children:e.children})}},...{secondary:e=>(0,r.jsx)(Wt,{title:"secondary",...e}),important:e=>(0,r.jsx)(Qt,{title:"important",...e}),success:e=>(0,r.jsx)(Zt,{title:"success",...e}),caution:function(e){return(0,r.jsx)(Dt,{...sn,...e,className:(0,u.A)("alert alert--warning",e.className),children:e.children})}}};function rn(e){const t=It(e),n=(s=t.type,an[s]||(console.warn(`No admonition component found for admonition type "${s}". Using Info as fallback.`),an.info));var s;return(0,r.jsx)(n,{...t})}var on=n(7489),cn=n(2181);let ln=null;async function dn(){return ln||(ln=async function(){return(await n.e(3923).then(n.bind(n,3923))).default}()),ln}function un(){const{colorMode:e}=(0,xe.G)(),t=(0,F.p)().mermaid,n=t.theme[e],{options:a}=t;return(0,s.useMemo)(()=>({startOnLoad:!1,...a,theme:n}),[n,a])}function mn({text:e,config:t}){const[n,a]=(0,s.useState)(null),i=(0,s.useState)(`mermaid-svg-${Math.round(1e7*Math.random())}`)[0],r=un(),o=t??r;return(0,s.useEffect)(()=>{(async function({id:e,text:t,config:n}){const s=await dn();s.initialize(n);try{return await s.render(e,t)}catch(a){throw document.querySelector(`#d${e}`)?.remove(),a}})({id:i,text:e,config:o}).then(a).catch(e=>{a(()=>{throw e})})},[i,e,o]),n}const hn="container_lyt7";function fn({renderResult:e}){const t=(0,s.useRef)(null);return(0,s.useEffect)(()=>{const n=t.current;e.bindFunctions?.(n)},[e]),(0,r.jsx)("div",{ref:t,className:`docusaurus-mermaid-container ${hn}`,dangerouslySetInnerHTML:{__html:e.svg}})}function pn({value:e}){const t=mn({text:e});return null===t?null:(0,r.jsx)(fn,{renderResult:t})}const xn={Head:me.A,details:Bt,Details:Bt,code:function(e){return function(e){return void 0!==e.children&&s.Children.toArray(e.children).every(e=>"string"==typeof e&&!e.includes("\n"))}(e)?(0,r.jsx)(jt,{...e}):(0,r.jsx)(bt,{...e})},a:function(e){const t=(0,vt.v)(e.id);return(0,r.jsx)(A.A,{...e,className:(0,u.A)(t,e.className)})},pre:function(e){return(0,r.jsx)(r.Fragment,{children:e.children})},ul:function(e){return(0,r.jsx)("ul",{...e,className:Et(e.className)})},li:function(e){(0,Nt.A)().collectAnchor(e.id);const t=(0,vt.v)(e.id);return(0,r.jsx)("li",{className:(0,u.A)(t,e.className),...e})},img:function(e){return(0,r.jsx)("img",{decoding:"async",loading:"lazy",...e,className:(t=e.className,(0,u.A)(t,St))});var t},h1:e=>(0,r.jsx)(Mt,{as:"h1",...e}),h2:e=>(0,r.jsx)(Mt,{as:"h2",...e}),h3:e=>(0,r.jsx)(Mt,{as:"h3",...e}),h4:e=>(0,r.jsx)(Mt,{as:"h4",...e}),h5:e=>(0,r.jsx)(Mt,{as:"h5",...e}),h6:e=>(0,r.jsx)(Mt,{as:"h6",...e}),admonition:rn,mermaid:function(e){return(0,r.jsx)(on.A,{fallback:e=>(0,r.jsx)(cn.MN,{...e}),children:(0,r.jsx)(pn,{...e})})}};function gn({children:e}){return(0,r.jsx)(fe.x,{components:xn,children:e})}function bn({children:e}){const t=function(){const{metadata:e,frontMatter:t,contentTitle:n}=l();return t.hide_title||void 0!==n?null:e.title}();return(0,r.jsxs)("div",{className:(0,u.A)(j.G.docs.docMarkdown,"markdown"),children:[t&&(0,r.jsx)("header",{children:(0,r.jsx)(he.A,{as:"h1",children:t})}),(0,r.jsx)(gn,{children:e})]})}function jn(e){const{siteConfig:t}=(0,v.A)(),{metadata:n,frontMatter:s}=l(),a=!1!==s.techArticle?function(e,t,n){const s=e?`${e.replace(/\/$/,"")}${t.permalink}`:t.permalink,a={"@context":"https://schema.org","@type":"TechArticle","@id":`${s}#article`,mainEntityOfPage:s,headline:n.title||t.title,inLanguage:"en",publisher:{"@id":"https://www.conduction.nl/#org"}};(n.description||t.description)&&(a.description=n.description||t.description);const i=n.date||t.lastUpdatedAt;i&&(a.datePublished="number"==typeof i?new Date(1e3*i).toISOString():new Date(i).toISOString()),t.lastUpdatedAt&&(a.dateModified=new Date(1e3*t.lastUpdatedAt).toISOString());const r=n.author||n.authors;return r?"string"==typeof r?a.author={"@type":"Person",name:r}:Array.isArray(r)?a.author=r.map(e=>"string"==typeof e?{"@type":"Person",name:e}:{"@type":"Person",name:e.name,url:e.url}):"object"==typeof r&&(a.author={"@type":"Person",name:r.name,url:r.url}):a.author={"@type":"Organization",name:"Conduction","@id":"https://www.conduction.nl/#org"},a}(t.url,n,s):null;return(0,r.jsxs)(r.Fragment,{children:[a&&(0,r.jsx)(me.A,{children:(0,r.jsx)("script",{type:"application/ld+json",children:JSON.stringify(a)})}),(0,r.jsx)(bn,{...e})]})}var vn=n(594);function Nn(){return(0,r.jsx)(N.A,{id:"theme.contentVisibility.unlistedBanner.title",description:"The unlisted content banner title",children:"Unlisted page"})}function An(){return(0,r.jsx)(N.A,{id:"theme.contentVisibility.unlistedBanner.message",description:"The unlisted content banner message",children:"This page is unlisted. Search engines will not index it, and only users having a direct link can access it."})}function yn(){return(0,r.jsx)(me.A,{children:(0,r.jsx)("meta",{name:"robots",content:"noindex, nofollow"})})}function kn(){return(0,r.jsx)(N.A,{id:"theme.contentVisibility.draftBanner.title",description:"The draft content banner title",children:"Draft page"})}function Cn(){return(0,r.jsx)(N.A,{id:"theme.contentVisibility.draftBanner.message",description:"The draft content banner message",children:"This page is a draft. It will only be visible in dev and be excluded from the production build."})}function Ln({className:e}){return(0,r.jsx)(rn,{type:"caution",title:(0,r.jsx)(kn,{}),className:(0,u.A)(e,j.G.common.draftBanner),children:(0,r.jsx)(Cn,{})})}function wn({className:e}){return(0,r.jsx)(rn,{type:"caution",title:(0,r.jsx)(Nn,{}),className:(0,u.A)(e,j.G.common.unlistedBanner),children:(0,r.jsx)(An,{})})}function _n(e){return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(yn,{}),(0,r.jsx)(wn,{...e})]})}function Tn({metadata:e}){const{unlisted:t,frontMatter:n}=e;return(0,r.jsxs)(r.Fragment,{children:[(t||n.unlisted)&&(0,r.jsx)(_n,{}),n.draft&&(0,r.jsx)(Ln,{})]})}const Bn="docItemContainer_Djhp",Mn="docItemCol_VOVn";function Hn({children:e}){const t=function(){const{frontMatter:e,toc:t}=l(),n=(0,m.l)(),s=e.hide_table_of_contents,a=!s&&t.length>0;return{hidden:s,mobile:a?(0,r.jsx)(ce,{}):void 0,desktop:!a||"desktop"!==n&&"ssr"!==n?void 0:(0,r.jsx)(ue,{})}}(),{metadata:n}=l();return(0,r.jsxs)("div",{className:"row",children:[(0,r.jsxs)("div",{className:(0,u.A)("col",!t.hidden&&Mn),children:[(0,r.jsx)(Tn,{metadata:n}),(0,r.jsx)(p.A,{}),(0,r.jsxs)("div",{className:Bn,children:[(0,r.jsxs)("article",{children:[(0,r.jsx)(vn.A,{}),(0,r.jsx)(x.A,{}),t.mobile,(0,r.jsx)(jn,{children:e}),(0,r.jsx)($,{})]}),(0,r.jsx)(f,{})]})]}),t.desktop&&(0,r.jsx)("div",{className:"col col--3",children:t.desktop})]})}function En(e){const t=`docs-doc-id-${e.content.metadata.id}`,n=e.content;return(0,r.jsx)(c,{content:e.content,children:(0,r.jsxs)(a.e3,{className:t,children:[(0,r.jsx)(d,{}),(0,r.jsx)(Hn,{children:(0,r.jsx)(n,{})})]})})}},6929(e,t,n){"use strict";n.d(t,{A:()=>c});n(6540);var s=n(8215),a=n(1312),i=n(8774),r=n(4848);function o(e){const{permalink:t,title:n,subLabel:a,isNext:o}=e;return(0,r.jsxs)(i.A,{className:(0,s.A)("pagination-nav__link",o?"pagination-nav__link--next":"pagination-nav__link--prev"),to:t,children:[a&&(0,r.jsx)("div",{className:"pagination-nav__sublabel",children:a}),(0,r.jsx)("div",{className:"pagination-nav__label",children:n})]})}function c(e){const{className:t,previous:n,next:i}=e;return(0,r.jsxs)("nav",{className:(0,s.A)(t,"pagination-nav"),"aria-label":(0,a.T)({id:"theme.docs.paginator.navAriaLabel",message:"Docs pages",description:"The ARIA label for the docs pagination"}),children:[n&&(0,r.jsx)(o,{...n,subLabel:(0,r.jsx)(a.A,{id:"theme.docs.paginator.previous",description:"The label used to navigate to the previous doc",children:"Previous"})}),i&&(0,r.jsx)(o,{...i,subLabel:(0,r.jsx)(a.A,{id:"theme.docs.paginator.next",description:"The label used to navigate to the next doc",children:"Next"}),isNext:!0})]})}},4267(e,t,n){"use strict";n.d(t,{A:()=>c});n(6540);var s=n(8215),a=n(1312),i=n(7559),r=n(3025),o=n(4848);function c({className:e}){const t=(0,r.r)();return t.badge?(0,o.jsx)("span",{className:(0,s.A)(e,i.G.docs.docVersionBadge,"badge badge--secondary"),children:(0,o.jsx)(a.A,{id:"theme.docs.versionBadge.label",values:{versionLabel:t.label},children:"Version: {versionLabel}"})}):null}},1878(e,t,n){"use strict";n.d(t,{A:()=>x});n(6540);var s=n(8215),a=n(4586),i=n(8774),r=n(1312),o=n(8295),c=n(7559),l=n(3886),d=n(3025),u=n(4848);const m={unreleased:function({siteTitle:e,versionMetadata:t}){return(0,u.jsx)(r.A,{id:"theme.docs.versions.unreleasedVersionLabel",description:"The label used to tell the user that he's browsing an unreleased doc version",values:{siteTitle:e,versionLabel:(0,u.jsx)("b",{children:t.label})},children:"This is unreleased documentation for {siteTitle} {versionLabel} version."})},unmaintained:function({siteTitle:e,versionMetadata:t}){return(0,u.jsx)(r.A,{id:"theme.docs.versions.unmaintainedVersionLabel",description:"The label used to tell the user that he's browsing an unmaintained doc version",values:{siteTitle:e,versionLabel:(0,u.jsx)("b",{children:t.label})},children:"This is documentation for {siteTitle} {versionLabel}, which is no longer actively maintained."})}};function h(e){const t=m[e.versionMetadata.banner];return(0,u.jsx)(t,{...e})}function f({versionLabel:e,to:t,onClick:n}){return(0,u.jsx)(r.A,{id:"theme.docs.versions.latestVersionSuggestionLabel",description:"The label used to tell the user to check the latest version",values:{versionLabel:e,latestVersionLink:(0,u.jsx)("b",{children:(0,u.jsx)(i.A,{to:t,onClick:n,children:(0,u.jsx)(r.A,{id:"theme.docs.versions.latestVersionLinkLabel",description:"The label used for the latest version suggestion link label",children:"latest version"})})})},children:"For up-to-date documentation, see the {latestVersionLink} ({versionLabel})."})}function p({className:e,versionMetadata:t}){const{siteConfig:{title:n}}=(0,a.A)(),{pluginId:i}=(0,o.vT)({failfast:!0}),{savePreferredVersionName:r}=(0,l.g1)(i),{latestDocSuggestion:d,latestVersionSuggestion:m}=(0,o.HW)(i),p=d??(x=m).docs.find(e=>e.id===x.mainDocId);var x;return(0,u.jsxs)("div",{className:(0,s.A)(e,c.G.docs.docVersionBanner,"alert alert--warning margin-bottom--md"),role:"alert",children:[(0,u.jsx)("div",{children:(0,u.jsx)(h,{siteTitle:n,versionMetadata:t})}),(0,u.jsx)("div",{className:"margin-top--md",children:(0,u.jsx)(f,{versionLabel:m.label,to:p.path,onClick:()=>r(m.name)})})]})}function x({className:e}){const t=(0,d.r)();return t.banner?(0,u.jsx)(p,{className:e,versionMetadata:t}):null}},1107(e,t,n){"use strict";n.d(t,{A:()=>l});n(6540);var s=n(8215),a=n(1312),i=n(3535),r=n(8774),o=n(3427),c=n(4848);function l({as:e,id:t,...n}){const l=(0,o.A)(),d=(0,i.v)(t);if("h1"===e||!t)return(0,c.jsx)(e,{...n,id:void 0});l.collectAnchor(t);const u=(0,a.T)({id:"theme.common.headingLinkTitle",message:"Direct link to {heading}",description:"Title for link to heading"},{heading:"string"==typeof n.children?n.children:t});return(0,c.jsxs)(e,{...n,className:(0,s.A)("anchor",d,n.className),id:t,children:[n.children,(0,c.jsx)(r.A,{className:"hash-link",to:`#${t}`,"aria-label":u,title:u,translate:"no",children:"\u200b"})]})}},3535(e,t,n){"use strict";n.d(t,{v:()=>r});var s=n(6342);const a="anchorTargetStickyNavbar_Vzrq",i="anchorTargetHideOnScrollNavbar_vjPI";function r(e){const{navbar:{hideOnScroll:t}}=(0,s.p)();if(void 0!==e)return t?i:a}},8426(e,t){function n(e){let t,n=[];for(let s of e.split(",").map(e=>e.trim()))if(/^-?\d+$/.test(s))n.push(parseInt(s,10));else if(t=s.match(/^(-?\d+)(-|\.\.\.?|\u2025|\u2026|\u22EF)(-?\d+)$/)){let[e,s,a,i]=t;if(s&&i){s=parseInt(s),i=parseInt(i);const e=sn});var o=e(797),n=class{constructor(t){this.init=t,this.records=this.init()}static{(0,o.K2)(this,"ImperativeState")}reset(){this.records=this.init()}}},1795(t,r,e){e.d(r,{diagram:()=>Rt});var o=e(5871),n=e(2938),a=e(8515),i=e(3706),s=e(797),c=e(8731),d=e(451),h={NORMAL:0,REVERSE:1,HIGHLIGHT:2,MERGE:3,CHERRY_PICK:4},$=i.UI.gitGraph,m=(0,s.K2)(()=>(0,a.$t)({...$,...(0,i.zj)().gitGraph}),"getConfig"),l=new n.m(()=>{const t=m(),r=t.mainBranchName,e=t.mainBranchOrder;return{mainBranchName:r,commits:new Map,head:null,branchConfig:new Map([[r,{name:r,order:e}]]),branches:new Map([[r,null]]),currBranch:r,direction:"LR",seq:0,options:{}}});function g(){return(0,a.yT)({length:7})}function y(t,r){const e=Object.create(null);return t.reduce((t,o)=>{const n=r(o);return e[n]||(e[n]=!0,t.push(o)),t},[])}(0,s.K2)(g,"getID"),(0,s.K2)(y,"uniqBy");var p=(0,s.K2)(function(t){l.records.direction=t},"setDirection"),f=(0,s.K2)(function(t){s.Rm.debug("options str",t),t=t?.trim(),t=t||"{}";try{l.records.options=JSON.parse(t)}catch(r){s.Rm.error("error while parsing gitGraph options",r.message)}},"setOptions"),x=(0,s.K2)(function(){return l.records.options},"getOptions"),u=(0,s.K2)(function(t){let r=t.msg,e=t.id;const o=t.type;let n=t.tags;s.Rm.info("commit",r,e,o,n),s.Rm.debug("Entering commit:",r,e,o,n);const a=m();e=i.Y2.sanitizeText(e,a),r=i.Y2.sanitizeText(r,a),n=n?.map(t=>i.Y2.sanitizeText(t,a));const c={id:e||l.records.seq+"-"+g(),message:r,seq:l.records.seq++,type:o??h.NORMAL,tags:n??[],parents:null==l.records.head?[]:[l.records.head.id],branch:l.records.currBranch};l.records.head=c,s.Rm.info("main branch",a.mainBranchName),l.records.commits.has(c.id)&&s.Rm.warn(`Commit ID ${c.id} already exists`),l.records.commits.set(c.id,c),l.records.branches.set(l.records.currBranch,c.id),s.Rm.debug("in pushCommit "+c.id)},"commit"),b=(0,s.K2)(function(t){let r=t.name;const e=t.order;if(r=i.Y2.sanitizeText(r,m()),l.records.branches.has(r))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 ${r}")`);l.records.branches.set(r,null!=l.records.head?l.records.head.id:null),l.records.branchConfig.set(r,{name:r,order:e}),B(r),s.Rm.debug("in createBranch")},"branch"),w=(0,s.K2)(t=>{let r=t.branch,e=t.id;const o=t.type,n=t.tags,a=m();r=i.Y2.sanitizeText(r,a),e&&(e=i.Y2.sanitizeText(e,a));const c=l.records.branches.get(l.records.currBranch),d=l.records.branches.get(r),$=c?l.records.commits.get(c):void 0,y=d?l.records.commits.get(d):void 0;if($&&y&&$.branch===r)throw new Error(`Cannot merge branch '${r}' into itself.`);if(l.records.currBranch===r){const t=new Error('Incorrect usage of "merge". Cannot merge a branch to itself');throw t.hash={text:`merge ${r}`,token:`merge ${r}`,expected:["branch abc"]},t}if(void 0===$||!$){const t=new Error(`Incorrect usage of "merge". Current branch (${l.records.currBranch})has no commits`);throw t.hash={text:`merge ${r}`,token:`merge ${r}`,expected:["commit"]},t}if(!l.records.branches.has(r)){const t=new Error('Incorrect usage of "merge". Branch to be merged ('+r+") does not exist");throw t.hash={text:`merge ${r}`,token:`merge ${r}`,expected:[`branch ${r}`]},t}if(void 0===y||!y){const t=new Error('Incorrect usage of "merge". Branch to be merged ('+r+") has no commits");throw t.hash={text:`merge ${r}`,token:`merge ${r}`,expected:['"commit"']},t}if($===y){const t=new Error('Incorrect usage of "merge". Both branches have same head');throw t.hash={text:`merge ${r}`,token:`merge ${r}`,expected:["branch abc"]},t}if(e&&l.records.commits.has(e)){const t=new Error('Incorrect usage of "merge". Commit with id:'+e+" already exists, use different custom id");throw t.hash={text:`merge ${r} ${e} ${o} ${n?.join(" ")}`,token:`merge ${r} ${e} ${o} ${n?.join(" ")}`,expected:[`merge ${r} ${e}_UNIQUE ${o} ${n?.join(" ")}`]},t}const p=d||"",f={id:e||`${l.records.seq}-${g()}`,message:`merged branch ${r} into ${l.records.currBranch}`,seq:l.records.seq++,parents:null==l.records.head?[]:[l.records.head.id,p],branch:l.records.currBranch,type:h.MERGE,customType:o,customId:!!e,tags:n??[]};l.records.head=f,l.records.commits.set(f.id,f),l.records.branches.set(l.records.currBranch,f.id),s.Rm.debug(l.records.branches),s.Rm.debug("in mergeBranch")},"merge"),k=(0,s.K2)(function(t){let r=t.id,e=t.targetId,o=t.tags,n=t.parent;s.Rm.debug("Entering cherryPick:",r,e,o);const a=m();if(r=i.Y2.sanitizeText(r,a),e=i.Y2.sanitizeText(e,a),o=o?.map(t=>i.Y2.sanitizeText(t,a)),n=i.Y2.sanitizeText(n,a),!r||!l.records.commits.has(r)){const t=new Error('Incorrect usage of "cherryPick". Source commit id should exist and provided');throw t.hash={text:`cherryPick ${r} ${e}`,token:`cherryPick ${r} ${e}`,expected:["cherry-pick abc"]},t}const c=l.records.commits.get(r);if(void 0===c||!c)throw new Error('Incorrect usage of "cherryPick". Source commit id should exist and provided');if(n&&(!Array.isArray(c.parents)||!c.parents.includes(n))){throw new Error("Invalid operation: The specified parent commit is not an immediate parent of the cherry-picked commit.")}const d=c.branch;if(c.type===h.MERGE&&!n){throw new Error("Incorrect usage of cherry-pick: If the source commit is a merge commit, an immediate parent commit must be specified.")}if(!e||!l.records.commits.has(e)){if(d===l.records.currBranch){const t=new Error('Incorrect usage of "cherryPick". Source commit is already on current branch');throw t.hash={text:`cherryPick ${r} ${e}`,token:`cherryPick ${r} ${e}`,expected:["cherry-pick abc"]},t}const t=l.records.branches.get(l.records.currBranch);if(void 0===t||!t){const t=new Error(`Incorrect usage of "cherry-pick". Current branch (${l.records.currBranch})has no commits`);throw t.hash={text:`cherryPick ${r} ${e}`,token:`cherryPick ${r} ${e}`,expected:["cherry-pick abc"]},t}const a=l.records.commits.get(t);if(void 0===a||!a){const t=new Error(`Incorrect usage of "cherry-pick". Current branch (${l.records.currBranch})has no commits`);throw t.hash={text:`cherryPick ${r} ${e}`,token:`cherryPick ${r} ${e}`,expected:["cherry-pick abc"]},t}const i={id:l.records.seq+"-"+g(),message:`cherry-picked ${c?.message} into ${l.records.currBranch}`,seq:l.records.seq++,parents:null==l.records.head?[]:[l.records.head.id,c.id],branch:l.records.currBranch,type:h.CHERRY_PICK,tags:o?o.filter(Boolean):[`cherry-pick:${c.id}${c.type===h.MERGE?`|parent:${n}`:""}`]};l.records.head=i,l.records.commits.set(i.id,i),l.records.branches.set(l.records.currBranch,i.id),s.Rm.debug(l.records.branches),s.Rm.debug("in cherryPick")}},"cherryPick"),B=(0,s.K2)(function(t){if(t=i.Y2.sanitizeText(t,m()),!l.records.branches.has(t)){const r=new Error(`Trying to checkout branch which is not yet created. (Help try using "branch ${t}")`);throw r.hash={text:`checkout ${t}`,token:`checkout ${t}`,expected:[`branch ${t}`]},r}{l.records.currBranch=t;const r=l.records.branches.get(l.records.currBranch);l.records.head=void 0!==r&&r?l.records.commits.get(r)??null:null}},"checkout");function E(t,r,e){const o=t.indexOf(r);-1===o?t.push(e):t.splice(o,1,e)}function C(t){const r=t.reduce((t,r)=>t.seq>r.seq?t:r,t[0]);let e="";t.forEach(function(t){e+=t===r?"\t*":"\t|"});const o=[e,r.id,r.seq];for(const n in l.records.branches)l.records.branches.get(n)===r.id&&o.push(n);if(s.Rm.debug(o.join(" ")),r.parents&&2==r.parents.length&&r.parents[0]&&r.parents[1]){const e=l.records.commits.get(r.parents[0]);E(t,r,e),r.parents[1]&&t.push(l.records.commits.get(r.parents[1]))}else{if(0==r.parents.length)return;if(r.parents[0]){const e=l.records.commits.get(r.parents[0]);E(t,r,e)}}C(t=y(t,t=>t.id))}(0,s.K2)(E,"upsert"),(0,s.K2)(C,"prettyPrintCommitHistory");var L=(0,s.K2)(function(){s.Rm.debug(l.records.commits);C([v()[0]])},"prettyPrint"),T=(0,s.K2)(function(){l.reset(),(0,i.IU)()},"clear"),K=(0,s.K2)(function(){return[...l.records.branchConfig.values()].map((t,r)=>null!==t.order&&void 0!==t.order?t:{...t,order:parseFloat(`0.${r}`)}).sort((t,r)=>(t.order??0)-(r.order??0)).map(({name:t})=>({name:t}))},"getBranchesAsObjArray"),M=(0,s.K2)(function(){return l.records.branches},"getBranches"),R=(0,s.K2)(function(){return l.records.commits},"getCommits"),v=(0,s.K2)(function(){const t=[...l.records.commits.values()];return t.forEach(function(t){s.Rm.debug(t.id)}),t.sort((t,r)=>t.seq-r.seq),t},"getCommitsArray"),I={commitType:h,getConfig:m,setDirection:p,setOptions:f,getOptions:x,commit:u,branch:b,merge:w,cherryPick:k,checkout:B,prettyPrint:L,clear:T,getBranchesAsObjArray:K,getBranches:M,getCommits:R,getCommitsArray:v,getCurrentBranch:(0,s.K2)(function(){return l.records.currBranch},"getCurrentBranch"),getDirection:(0,s.K2)(function(){return l.records.direction},"getDirection"),getHead:(0,s.K2)(function(){return l.records.head},"getHead"),setAccTitle:i.SV,getAccTitle:i.iN,getAccDescription:i.m7,setAccDescription:i.EI,setDiagramTitle:i.ke,getDiagramTitle:i.ab},P=(0,s.K2)((t,r)=>{(0,o.S)(t,r),t.dir&&r.setDirection(t.dir);for(const e of t.statements)O(e,r)},"populate"),O=(0,s.K2)((t,r)=>{const e={Commit:(0,s.K2)(t=>r.commit(A(t)),"Commit"),Branch:(0,s.K2)(t=>r.branch(G(t)),"Branch"),Merge:(0,s.K2)(t=>r.merge(S(t)),"Merge"),Checkout:(0,s.K2)(t=>r.checkout(H(t)),"Checkout"),CherryPicking:(0,s.K2)(t=>r.cherryPick(W(t)),"CherryPicking")}[t.$type];e?e(t):s.Rm.error(`Unknown statement type: ${t.$type}`)},"parseStatement"),A=(0,s.K2)(t=>({id:t.id,msg:t.message??"",type:void 0!==t.type?h[t.type]:h.NORMAL,tags:t.tags??void 0}),"parseCommit"),G=(0,s.K2)(t=>({name:t.name,order:t.order??0}),"parseBranch"),S=(0,s.K2)(t=>({branch:t.branch,id:t.id??"",type:void 0!==t.type?h[t.type]:void 0,tags:t.tags??void 0}),"parseMerge"),H=(0,s.K2)(t=>t.branch,"parseCheckout"),W=(0,s.K2)(t=>({id:t.id,targetId:"",tags:0===t.tags?.length?void 0:t.tags,parent:t.parent}),"parseCherryPicking"),q={parse:(0,s.K2)(async t=>{const r=await(0,c.qg)("gitGraph",t);s.Rm.debug(r),P(r,I)},"parse")};var z=10,_=40,D=new Set(["redux","redux-dark","redux-color","redux-dark-color"]),Y=new Set(["redux-color","redux-dark-color"]),j=new Set(["dark","redux-dark","redux-dark-color","neo-dark"]),N=(0,s.K2)((t,r,e=!1)=>e&&t>0?(t-1)%(r-1)+1:t%r,"calcColorIndex"),F=new Map,V=new Map,U=new Map,J=[],Q=0,X="LR",Z=(0,s.K2)(()=>{F.clear(),V.clear(),U.clear(),Q=0,J=[],X="LR"},"clear"),tt=(0,s.K2)(t=>{const r=document.createElementNS("http://www.w3.org/2000/svg","text");return("string"==typeof t?t.split(/\\n|\n|
/gi):t).forEach(t=>{const e=document.createElementNS("http://www.w3.org/2000/svg","tspan");e.setAttributeNS("http://www.w3.org/XML/1998/namespace","xml:space","preserve"),e.setAttribute("dy","1em"),e.setAttribute("x","0"),e.setAttribute("class","row"),e.textContent=t.trim(),r.appendChild(e)}),r},"drawText"),rt=(0,s.K2)(t=>{let r,e,o;return"BT"===X?(e=(0,s.K2)((t,r)=>t<=r,"comparisonFunc"),o=1/0):(e=(0,s.K2)((t,r)=>t>=r,"comparisonFunc"),o=0),t.forEach(t=>{const n="TB"===X||"BT"==X?V.get(t)?.y:V.get(t)?.x;void 0!==n&&e(n,o)&&(r=t,o=n)}),r},"findClosestParent"),et=(0,s.K2)(t=>{let r="",e=1/0;return t.forEach(t=>{const o=V.get(t).y;o<=e&&(r=t,e=o)}),r||void 0},"findClosestParentBT"),ot=(0,s.K2)((t,r,e)=>{let o=e,n=e;const a=[];t.forEach(t=>{const e=r.get(t);if(!e)throw new Error(`Commit not found for key ${t}`);e.parents.length?(o=at(e),n=Math.max(o,n)):a.push(e),it(e,o)}),o=n,a.forEach(t=>{st(t,o,e)}),t.forEach(t=>{const e=r.get(t);if(e?.parents.length){const t=et(e.parents);o=V.get(t).y-_,o<=n&&(n=o);const r=F.get(e.branch).pos,a=o-z;V.set(e.id,{x:r,y:a})}})},"setParallelBTPos"),nt=(0,s.K2)(t=>{const r=rt(t.parents.filter(t=>null!==t));if(!r)throw new Error(`Closest parent not found for commit ${t.id}`);const e=V.get(r)?.y;if(void 0===e)throw new Error(`Closest parent position not found for commit ${t.id}`);return e},"findClosestParentPos"),at=(0,s.K2)(t=>nt(t)+_,"calculateCommitPosition"),it=(0,s.K2)((t,r)=>{const e=F.get(t.branch);if(!e)throw new Error(`Branch not found for commit ${t.id}`);const o=e.pos,n=r+z;return V.set(t.id,{x:o,y:n}),{x:o,y:n}},"setCommitPosition"),st=(0,s.K2)((t,r,e)=>{const o=F.get(t.branch);if(!o)throw new Error(`Branch not found for commit ${t.id}`);const n=r+e,a=o.pos;V.set(t.id,{x:a,y:n})},"setRootPosition"),ct=(0,s.K2)((t,r,e,o,n,a)=>{const{theme:s}=(0,i.D7)(),c=D.has(s??""),d=Y.has(s??""),$=j.has(s??"");if(a===h.HIGHLIGHT)t.append("rect").attr("x",e.x-10+(c?3:0)).attr("y",e.y-10+(c?3:0)).attr("width",c?14:20).attr("height",c?14:20).attr("class",`commit ${r.id} commit-highlight${N(n,8,d)} ${o}-outer`),t.append("rect").attr("x",e.x-6+(c?2:0)).attr("y",e.y-6+(c?2:0)).attr("width",c?8:12).attr("height",c?8:12).attr("class",`commit ${r.id} commit${N(n,8,d)} ${o}-inner`);else if(a===h.CHERRY_PICK)t.append("circle").attr("cx",e.x).attr("cy",e.y).attr("r",c?7:10).attr("class",`commit ${r.id} ${o}`),t.append("circle").attr("cx",e.x-3).attr("cy",e.y+2).attr("r",c?2.5:2.75).attr("fill",$?"#000000":"#fff").attr("class",`commit ${r.id} ${o}`),t.append("circle").attr("cx",e.x+3).attr("cy",e.y+2).attr("r",c?2.5:2.75).attr("fill",$?"#000000":"#fff").attr("class",`commit ${r.id} ${o}`),t.append("line").attr("x1",e.x+3).attr("y1",e.y+1).attr("x2",e.x).attr("y2",e.y-5).attr("stroke",$?"#000000":"#fff").attr("class",`commit ${r.id} ${o}`),t.append("line").attr("x1",e.x-3).attr("y1",e.y+1).attr("x2",e.x).attr("y2",e.y-5).attr("stroke",$?"#000000":"#fff").attr("class",`commit ${r.id} ${o}`);else{const i=t.append("circle");if(i.attr("cx",e.x),i.attr("cy",e.y),i.attr("r",c?7:10),i.attr("class",`commit ${r.id} commit${N(n,8,d)}`),a===h.MERGE){const a=t.append("circle");a.attr("cx",e.x),a.attr("cy",e.y),a.attr("r",c?5:6),a.attr("class",`commit ${o} ${r.id} commit${N(n,8,d)}`)}if(a===h.REVERSE){const a=c?4:5;t.append("path").attr("d",`M ${e.x-a},${e.y-a}L${e.x+a},${e.y+a}M${e.x-a},${e.y+a}L${e.x+a},${e.y-a}`).attr("class",`commit ${o} ${r.id} commit${N(n,8,d)}`)}}},"drawCommitBullet"),dt=(0,s.K2)((t,r,e,o,n)=>{if(r.type!==h.CHERRY_PICK&&(r.customId&&r.type===h.MERGE||r.type!==h.MERGE)&&n.showCommitLabel){const a=t.append("g"),i=a.insert("rect").attr("class","commit-label-bkg"),s=a.append("text").attr("x",o).attr("y",e.y+25).attr("class","commit-label").text(r.id),c=s.node()?.getBBox();if(c&&(i.attr("x",e.posWithOffset-c.width/2-2).attr("y",e.y+13.5).attr("width",c.width+4).attr("height",c.height+4),"TB"===X||"BT"===X?(i.attr("x",e.x-(c.width+16+5)).attr("y",e.y-12),s.attr("x",e.x-(c.width+16)).attr("y",e.y+c.height-12)):s.attr("x",e.posWithOffset-c.width/2),n.rotateCommitLabel))if("TB"===X||"BT"===X)s.attr("transform","rotate(-45, "+e.x+", "+e.y+")"),i.attr("transform","rotate(-45, "+e.x+", "+e.y+")");else{const t=-7.5-(c.width+10)/25*9.5,r=10+c.width/25*8.5;a.attr("transform","translate("+t+", "+r+") rotate(-45, "+o+", "+e.y+")")}}},"drawCommitLabel"),ht=(0,s.K2)((t,r,e,o)=>{if(r.tags.length>0){let n=0,a=0,i=0;const s=[];for(const o of r.tags.reverse()){const r=t.insert("polygon"),c=t.append("circle"),d=t.append("text").attr("y",e.y-16-n).attr("class","tag-label").text(o),h=d.node()?.getBBox();if(!h)throw new Error("Tag bbox not found");a=Math.max(a,h.width),i=Math.max(i,h.height),d.attr("x",e.posWithOffset-h.width/2),s.push({tag:d,hole:c,rect:r,yOffset:n}),n+=20}for(const{tag:t,hole:r,rect:c,yOffset:d}of s){const n=i/2,s=e.y-19.2-d;if(c.attr("class","tag-label-bkg").attr("points",`\n ${o-a/2-2},${s+2} \n ${o-a/2-2},${s-2}\n ${e.posWithOffset-a/2-4},${s-n-2}\n ${e.posWithOffset+a/2+4},${s-n-2}\n ${e.posWithOffset+a/2+4},${s+n+2}\n ${e.posWithOffset-a/2-4},${s+n+2}`),r.attr("cy",s).attr("cx",o-a/2+2).attr("r",1.5).attr("class","tag-hole"),"TB"===X||"BT"===X){const i=o+d;c.attr("class","tag-label-bkg").attr("points",`\n ${e.x},${i+2}\n ${e.x},${i-2}\n ${e.x+z},${i-n-2}\n ${e.x+z+a+4},${i-n-2}\n ${e.x+z+a+4},${i+n+2}\n ${e.x+z},${i+n+2}`).attr("transform","translate(12,12) rotate(45, "+e.x+","+o+")"),r.attr("cx",e.x+2).attr("cy",i).attr("transform","translate(12,12) rotate(45, "+e.x+","+o+")"),t.attr("x",e.x+5).attr("y",i+3).attr("transform","translate(14,14) rotate(45, "+e.x+","+o+")")}}}},"drawCommitTags"),$t=(0,s.K2)(t=>{switch(t.customType??t.type){case h.NORMAL:return"commit-normal";case h.REVERSE:return"commit-reverse";case h.HIGHLIGHT:return"commit-highlight";case h.MERGE:return"commit-merge";case h.CHERRY_PICK:return"commit-cherry-pick";default:return"commit-normal"}},"getCommitClassType"),mt=(0,s.K2)((t,r,e,o)=>{const n={x:0,y:0};if(!(t.parents.length>0)){if("TB"===r)return 30;if("BT"===r){return(o.get(t.id)??n).y-_}return 0}{const e=rt(t.parents);if(e){const a=o.get(e)??n;if("TB"===r)return a.y+_;if("BT"===r){return(o.get(t.id)??n).y-_}return a.x+_}}return 0},"calculatePosition"),lt=(0,s.K2)((t,r,e)=>{const o="BT"===X&&e?r:r+z,n=F.get(t.branch)?.pos,a="TB"===X||"BT"===X?F.get(t.branch)?.pos:o;if(void 0===a||void 0===n)throw new Error(`Position were undefined for commit ${t.id}`);const s=D.has((0,i.D7)().theme??"");return{x:a,y:"TB"===X||"BT"===X?o:n+(s?7:-2),posWithOffset:o}},"getCommitPosition"),gt=(0,s.K2)((t,r,e,o)=>{const n=t.append("g").attr("class","commit-bullets"),a=t.append("g").attr("class","commit-labels");let i="TB"===X||"BT"===X?30:0;const c=[...r.keys()],d=o.parallelCommits??!1,h=(0,s.K2)((t,e)=>{const o=r.get(t)?.seq,n=r.get(e)?.seq;return void 0!==o&&void 0!==n?o-n:0},"sortKeys");let $=c.sort(h);"BT"===X&&(d&&ot($,r,i),$=$.reverse()),$.forEach(t=>{const s=r.get(t);if(!s)throw new Error(`Commit not found for key ${t}`);d&&(i=mt(s,X,i,V));const c=lt(s,i,d);if(e){const t=$t(s),r=s.customType??s.type,e=F.get(s.branch)?.index??0;ct(n,s,c,t,e,r),dt(a,s,c,i,o),ht(a,s,c,i)}"TB"===X||"BT"===X?V.set(s.id,{x:c.x,y:c.posWithOffset}):V.set(s.id,{x:c.posWithOffset,y:c.y}),i="BT"===X&&d?i+_:i+_+z,i>Q&&(Q=i)})},"drawCommits"),yt=(0,s.K2)((t,r,e,o,n)=>{const a=("TB"===X||"BT"===X?e.xt.branch===a,"isOnBranchToGetCurve"),c=(0,s.K2)(e=>e.seq>t.seq&&e.seqc(t)&&i(t))},"shouldRerouteArrow"),pt=(0,s.K2)((t,r,e=0)=>{const o=t+Math.abs(t-r)/2;if(e>5)return o;if(J.every(t=>Math.abs(t-o)>=10))return J.push(o),o;const n=Math.abs(t-r);return pt(t,r-n/5,e+1)},"findLane"),ft=(0,s.K2)((t,r,e,o)=>{const{theme:n}=(0,i.D7)(),a=Y.has(n??""),s=V.get(r.id),c=V.get(e.id);if(void 0===s||void 0===c)throw new Error(`Commit positions not found for commits ${r.id} and ${e.id}`);const d=yt(r,e,s,c,o);let $,m="",l="",g=0,y=0,p=F.get(e.branch)?.index;if(e.type===h.MERGE&&r.id!==e.parents[0]&&(p=F.get(r.branch)?.index),d){m="A 10 10, 0, 0, 0,",l="A 10 10, 0, 0, 1,",g=10,y=10;const t=s.yc.x&&(m="A 20 20, 0, 0, 0,",l="A 20 20, 0, 0, 1,",g=20,y=20,$=e.type===h.MERGE&&r.id!==e.parents[0]?`M ${s.x} ${s.y} L ${s.x} ${c.y-g} ${l} ${s.x-y} ${c.y} L ${c.x} ${c.y}`:`M ${s.x} ${s.y} L ${c.x+g} ${s.y} ${m} ${c.x} ${s.y+y} L ${c.x} ${c.y}`),s.x===c.x&&($=`M ${s.x} ${s.y} L ${c.x} ${c.y}`)):"BT"===X?(s.xc.x&&(m="A 20 20, 0, 0, 0,",l="A 20 20, 0, 0, 1,",g=20,y=20,$=e.type===h.MERGE&&r.id!==e.parents[0]?`M ${s.x} ${s.y} L ${s.x} ${c.y+g} ${m} ${s.x-y} ${c.y} L ${c.x} ${c.y}`:`M ${s.x} ${s.y} L ${c.x+g} ${s.y} ${l} ${c.x} ${s.y-y} L ${c.x} ${c.y}`),s.x===c.x&&($=`M ${s.x} ${s.y} L ${c.x} ${c.y}`)):(s.yc.y&&($=e.type===h.MERGE&&r.id!==e.parents[0]?`M ${s.x} ${s.y} L ${c.x-g} ${s.y} ${m} ${c.x} ${s.y-y} L ${c.x} ${c.y}`:`M ${s.x} ${s.y} L ${s.x} ${c.y+g} ${l} ${s.x+y} ${c.y} L ${c.x} ${c.y}`),s.y===c.y&&($=`M ${s.x} ${s.y} L ${c.x} ${c.y}`));if(void 0===$)throw new Error("Line definition not found");t.append("path").attr("d",$).attr("class","arrow arrow"+N(p,8,a))},"drawArrow"),xt=(0,s.K2)((t,r)=>{const e=t.append("g").attr("class","commit-arrows");[...r.keys()].forEach(t=>{const o=r.get(t);o.parents&&o.parents.length>0&&o.parents.forEach(t=>{ft(e,r.get(t),o,r)})})},"drawArrows"),ut=(0,s.K2)((t,r,e,o)=>{const{look:n,theme:a,themeVariables:s}=(0,i.D7)(),{dropShadow:c,THEME_COLOR_LIMIT:d}=s,h=D.has(a??""),$=Y.has(a??""),m=t.append("g");r.forEach((t,r)=>{const a=N(r,h?d:8,$),i=F.get(t.name)?.pos;if(void 0===i)throw new Error(`Position not found for branch ${t.name}`);const s="TB"===X||"BT"===X?i:h?i+6+1:i-2,l=m.append("line");l.attr("x1",0),l.attr("y1",s),l.attr("x2",Q),l.attr("y2",s),l.attr("class","branch branch"+a),"TB"===X?(l.attr("y1",30),l.attr("x1",i),l.attr("y2",Q),l.attr("x2",i)):"BT"===X&&(l.attr("y1",Q),l.attr("x1",i),l.attr("y2",30),l.attr("x2",i)),J.push(s);const g=t.name,y=tt(g),p=m.insert("rect"),f=m.insert("g").attr("class","branchLabel").insert("g").attr("class","label branch-label"+a);f.node().appendChild(y);const x=y.getBBox(),u=h?0:4,b=h?16:0,w=h?12:0;"neo"===n&&p.attr("data-look","neo"),p.attr("class","branchLabelBkg label"+a).attr("style","neo"===n?`filter:${h?`url(#${o}-drop-shadow)`:c}`:"").attr("rx",u).attr("ry",u).attr("x",-x.width-4-(!0===e.rotateCommitLabel?30:0)).attr("y",-x.height/2+10).attr("width",x.width+18+b).attr("height",x.height+4+w),f.attr("transform","translate("+(-x.width-14-(!0===e.rotateCommitLabel?30:0)+b/2)+", "+(s-x.height/2-2)+")"),"TB"===X?(p.attr("x",i-x.width/2-10).attr("y",0),f.attr("transform","translate("+(i-x.width/2-5)+", 0)"),h&&(p.attr("transform",`translate(${-b/2-3}, ${-w-10})`),f.attr("transform","translate("+(i-x.width/2-5)+", "+(2*-w+7)+")"))):"BT"===X?(p.attr("x",i-x.width/2-10).attr("y",Q),f.attr("transform","translate("+(i-x.width/2-5)+", "+Q+")"),h&&(p.attr("transform",`translate(${-b/2-3}, ${w+10})`),f.attr("transform","translate("+(i-x.width/2-5)+", "+(Q+2*w+4)+")"))):p.attr("transform","translate(-19, "+(s-12-w/2)+")")})},"drawBranches"),bt=(0,s.K2)(function(t,r,e,o,n){return F.set(t,{pos:r,index:e}),r+=50+(n?40:0)+("TB"===X||"BT"===X?o.width/2:0)},"setBranchPosition"),wt={draw:(0,s.K2)(function(t,r,e,o){Z(),s.Rm.debug("in gitgraph renderer",t+"\n","id:",r,e);const n=o.db;if(!n.getConfig)return void s.Rm.error("getConfig method is not available on db");const c=n.getConfig(),h=c.rotateCommitLabel??!1;U=n.getCommits();const $=n.getBranchesAsObjArray();X=n.getDirection();const m=(0,d.Ltv)(`[id="${r}"]`),{look:l,theme:g,themeVariables:y}=(0,i.D7)(),{useGradient:p,gradientStart:f,gradientStop:x,filterColor:u}=y;if(p){const t=m.append("defs").append("linearGradient").attr("id",r+"-gradient").attr("gradientUnits","objectBoundingBox").attr("x1","0%").attr("y1","0%").attr("x2","100%").attr("y2","0%");t.append("stop").attr("offset","0%").attr("stop-color",f).attr("stop-opacity",1),t.append("stop").attr("offset","100%").attr("stop-color",x).attr("stop-opacity",1)}"neo"===l&&D.has(g??"")&&m.append("defs").append("filter").attr("id",r+"-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",u);let b=0;$.forEach((t,r)=>{const e=tt(t.name),o=m.append("g"),n=o.insert("g").attr("class","branchLabel"),a=n.insert("g").attr("class","label branch-label");a.node()?.appendChild(e);const i=e.getBBox();b=bt(t.name,b,r,i,h),a.remove(),n.remove(),o.remove()}),gt(m,U,!1,c),c.showBranches&&ut(m,$,c,r),xt(m,U),gt(m,U,!0,c),a._K.insertTitle(m,"gitTitleText",c.titleTopMargin??0,n.getDiagramTitle()),(0,i.mj)(void 0,m,c.diagramPadding,c.useMaxWidth)},"draw")};var kt=new Set(["redux","redux-dark","redux-color","redux-dark-color"]),Bt=new Set(["redux-color","redux-dark-color"]),Et=new Set(["neo","neo-dark"]),Ct=new Set(["dark","redux-dark","redux-dark-color","neo-dark"]),Lt=new Set(["redux","redux-dark","redux-color","redux-dark-color","neo","neo-dark"]),Tt=(0,s.K2)(t=>{const{svgId:r}=t;let e="";if(t.useGradient&&r)for(let o=0;o{const r=(0,i.zj)(),{theme:e,themeVariables:o}=r,{borderColorArray:n}=o,a=kt.has(e);if(Et.has(e)){let r="";for(let e=0;e`${Array.from({length:t.THEME_COLOR_LIMIT},(t,r)=>r).map(r=>{const e=r%8;return`\n .branch-label${r} { fill: ${t["gitBranchLabel"+e]}; }\n .commit${r} { stroke: ${t["git"+e]}; fill: ${t["git"+e]}; }\n .commit-highlight${r} { stroke: ${t["gitInv"+e]}; fill: ${t["gitInv"+e]}; }\n .label${r} { fill: ${t["git"+e]}; }\n .arrow${r} { stroke: ${t["git"+e]}; }\n `}).join("\n")}`,"normalTheme"),Rt={parser:q,db:I,renderer:wt,styles:(0,s.K2)(t=>{const r=(0,i.zj)(),{theme:e}=r,o=Lt.has(e);return`\n .commit-id,\n .commit-msg,\n .branch-label {\n fill: lightgrey;\n color: lightgrey;\n font-family: 'trebuchet ms', verdana, arial, sans-serif;\n font-family: var(--mermaid-font-family);\n }\n \n ${o?Kt(t):Mt(t)}\n\n .branch {\n stroke-width: ${t.strokeWidth};\n stroke: ${t.commitLineColor??t.lineColor};\n stroke-dasharray: ${o?"4 2":"2"};\n }\n .commit-label { font-size: ${t.commitLabelFontSize}; fill: ${o?t.nodeBorder:t.commitLabelColor}; ${o?`font-weight:${t.noteFontWeight};`:""}}\n .commit-label-bkg { font-size: ${t.commitLabelFontSize}; fill: ${o?"transparent":t.commitLabelBackground}; opacity: ${o?"":.5}; }\n .tag-label { font-size: ${t.tagLabelFontSize}; fill: ${t.tagLabelColor};}\n .tag-label-bkg { fill: ${o?t.mainBkg:t.tagLabelBackground}; stroke: ${o?t.nodeBorder:t.tagLabelBorder}; ${o?`filter:${t.dropShadow}`:""} }\n .tag-hole { fill: ${t.textColor}; }\n\n .commit-merge {\n stroke: ${o?t.mainBkg:t.primaryColor};\n fill: ${o?t.mainBkg:t.primaryColor};\n }\n .commit-reverse {\n stroke: ${o?t.mainBkg:t.primaryColor};\n fill: ${o?t.mainBkg:t.primaryColor};\n stroke-width: ${o?t.strokeWidth:3};\n }\n .commit-highlight-outer {\n }\n .commit-highlight-inner {\n stroke: ${o?t.mainBkg:t.primaryColor};\n fill: ${o?t.mainBkg:t.primaryColor};\n }\n\n .arrow {\n /* Intentional: neo themes keep the bold 8px arrow (like classic themes); only redux-geometry themes use the thinner options.strokeWidth. */\n stroke-width: ${kt.has(e)?t.strokeWidth:8};\n stroke-linecap: round;\n fill: none\n }\n .gitTitleText {\n text-anchor: middle;\n font-size: 18px;\n fill: ${t.textColor};\n }\n`},"getStyles")}}}]);
\ No newline at end of file
diff --git a/docs/build/assets/js/1844.905a2cb5.js b/docs/build/assets/js/1844.905a2cb5.js
deleted file mode 100644
index 647ccc931..000000000
--- a/docs/build/assets/js/1844.905a2cb5.js
+++ /dev/null
@@ -1 +0,0 @@
-"use strict";(globalThis.webpackChunkdoriath_docs=globalThis.webpackChunkdoriath_docs||[]).push([[1844],{1844(e,t,n){n.d(t,{diagram:()=>ne});var i=n(5871),a=n(8515),r=n(3706),o=n(797),s=n(8731),l=n(451),d="position frame",m="frame positioned",c="position relation",x="relation positioned",u=(0,o.K2)(function(e){o.Rm.debug("options str",e)},"setOptions"),f=(0,o.K2)(function(){return{}},"getOptions"),g=(0,o.K2)(function(){h(),(0,r.IU)()},"clear");function h(){w={}}(0,o.K2)(h,"reset");var b=r.UI.eventmodeling,p=(0,o.K2)(()=>(0,a.$t)({...b,...(0,r.zj)().eventmodeling}),"getConfig"),w={};function v(){let e=M;const{ast:t}=w,n=k();if(!t)throw new Error("No data for EventModel");return t.frames.forEach((i,a)=>{const r=E(i,t.dataEntities,n);let s;e=L(e,{$kind:d,index:a,frame:i,textProps:r}),j(i)?(o.Rm.debug("source frame",i.sourceFrames),s=t.frames.filter(e=>i.sourceFrames.some(t=>t.$refText===e.name)),s.forEach(t=>{e=L(e,{$kind:c,index:a,frame:i,sourceFrame:t})})):e=L(e,{$kind:c,index:a,frame:i})}),e={...e,sortedSwimlanesArray:H(e.swimlanes)},e}function y(e){w.ast=e}(0,o.K2)(v,"getState"),(0,o.K2)(y,"setAst");var P={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: "};function k(){return P}(0,o.K2)(k,"getDiagramProps");var M={boxes:[],swimlanes:{},relations:[],maxR:0,sortedSwimlanesArray:[]};function K(e){const t=e.split(".");if(2===t.length)return t[0]}function S(e){const t=e.split(".");return 2===t.length?t[1]:e}function B(e,t){if(t&&0!==t.length)return Object.values(e).find(e=>e.namespace===t)}function F(e,t,n){return Math.max(t,...Object.keys(e).filter(e=>{const i=Number.parseInt(e);return i>t&&iNumber.parseInt(e)))+1}function R(e,t){const n=K(e.entityIdentifier),i=B(t,n);switch(e.modelEntityType){case"ui":case"pcr":case"processor":return i?{index:i.index,label:i.namespace||P.labelUiAutomation}:n?{index:F(t,0,100),label:P.labelUiAutomationPrefix+n}:{index:0,label:P.labelUiAutomation};case"rmo":case"readmodel":case"cmd":case"command":return i?{index:i.index,label:i.namespace||P.labelCommandReadModel}:n?{index:F(t,100,200),label:P.labelCommandReadModelPrefix+n}:{index:100,label:P.labelCommandReadModel};default:return i?{index:i.index,label:i.namespace||P.labelEvents}:n?{index:F(t,200,300),label:P.labelEventsPrefix+n}:{index:200,label:P.labelEvents}}}function $(e){const{themeVariables:t}=(0,r.zj)();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 E(e,t,n){const i=(0,r.zj)(),s=(0,r.jZ)(S(e.entityIdentifier)??"",i);let l;const d={fontSize:16,fontWeight:700,fontFamily:'"trebuchet ms", verdana, arial, sans-serif',joinWith:"
"};let m=`${(0,a.bH)(s,n.textMaxWidth,d)}`;if(e.dataInlineValue&&(l=e.dataInlineValue,l=l.substring(l.indexOf("{")+1),l=l.substring(0,l.lastIndexOf("}")-1),l=(0,r.jZ)(l,i),l=(0,a.bH)(l,n.textMaxWidth,d),l=l.replaceAll(" "," ")),e.dataReference){const o=t.find(t=>t.name===e.dataReference?.$refText);o&&(l=o.dataBlockValue,l=l.substring(l.indexOf("{\n")+2),l=l.substring(0,l.lastIndexOf("}")-1),l=(0,r.jZ)(l,i),l=(0,a.bH)(l,n.textMaxWidth,d),l=l.replaceAll(" "," "),l+="
")}const c=void 0!==l;c&&(m+=`
${l}`);const x={fontSize:d.fontSize,fontWeight:d.fontWeight,fontFamily:d.fontFamily},u=(0,a.PX)(m,x),f={content:m,width:c?u.width/3:u.width,height:u.height};return o.Rm.debug(`[${e.name}] ${e.entityIdentifier} text`,f),f}function A(e,t){const n=t,i=$(n.frame),a={width:n.textProps.width+2*P.boxTextPadding,height:n.textProps.height+2*P.boxTextPadding};return[{$kind:m,frame:n.frame,index:n.index,visual:i,dimension:a,textProps:n.textProps}]}function T(e,t,n){return void 0===t?P.contentStartX:t.index===e.index&&e.r?e.r+P.boxPadding:void 0===n?P.contentStartX:n.r-P.boxOverlap+P.boxPadding}function W(e,t){const n=[...e.map(e=>e.r),t];return Math.max(...n)}function H(e){return Object.values(e).sort((e,t)=>e.index-t.index)}function I(e,t){const n=t,i=R(n.frame,e.swimlanes);let a;a=i.index in e.swimlanes?e.swimlanes[i.index]:{index:i.index,label:i.label,r:0,y:i.index*P.swimlaneMinHeight+P.swimlaneGap,height:P.swimlaneMinHeight,maxHeight:P.swimlaneMinHeight};const r=e.boxes.length>0?e.boxes[e.boxes.length-1]:void 0,o=void 0!==e.previousSwimlaneNumber?e.swimlanes[e.previousSwimlaneNumber]:void 0,s={width:Math.max(P.boxMinWidth,Math.min(P.boxMaxWidth,n.dimension.width))+2*P.boxPadding,height:Math.max(P.boxMinHeight,Math.min(P.boxMaxHeight,n.dimension.height))+2*P.boxPadding},l=T(a,o,r),d=l+s.width+P.boxPadding,m=W(Object.values(e.swimlanes),d);a.r=l+s.width,a.maxHeight=Math.max(a.maxHeight,s.height),a.height=Math.max(P.swimlaneMinHeight,a.maxHeight)+2*P.swimlanePadding;const c={x:l,y:P.swimlanePadding+a.y,r:d,dimension:s,leftSibling:!1,swimlane:a,visual:n.visual,text:n.textProps.content,frame:n.frame,index:n.index},x={...e,boxes:[...e.boxes,c],swimlanes:{...e.swimlanes,[`${a.index}`]:a},previousSwimlaneNumber:i.index,previousFrame:n.frame,maxR:m},u=H(x.swimlanes);u.length>0&&(u[0].y=0);for(let f=1;f0}function C(e,t){if(null!=t)return e.find(e=>e.frame.name===t.name)}function D(e,t,n){if(!(n<0))for(let i=n;i>=0;i--){const n=e[i];if(n.swimlane.index!==t)return n}}function U(e,t){const n=t;if((0,s.F5)(n.frame)||O(n.index,n.frame))return[];const i=C(e.boxes,n.frame);if(void 0===i)throw new Error(`Target box not found for frame ${n.frame.name}`);let a;if(a=n.sourceFrame?C(e.boxes,n.sourceFrame):D(e.boxes,i.swimlane.index,n.index-1),void 0===a)return[];return[{$kind:x,frame:n.frame,index:n.index,sourceBox:a,targetBox:i}]}function N(e,t){const n=t,i={visual:{fill:"none",stroke:"#000"},source:{x:n.sourceBox.x,y:n.sourceBox.y},target:{x:n.targetBox.x,y:n.targetBox.y},sourceBox:n.sourceBox,targetBox:n.targetBox};return{...e,relations:[...e.relations,i]}}(0,o.K2)(K,"extractNamespace"),(0,o.K2)(S,"extractName"),(0,o.K2)(B,"findSwimlaneByNamespace"),(0,o.K2)(F,"findNextAvailableIndex"),(0,o.K2)(R,"calculateSwimlaneProps"),(0,o.K2)($,"calculateEntityVisualProps"),(0,o.K2)(E,"calculateTextProps"),(0,o.K2)(A,"decidePositionFrame"),(0,o.K2)(T,"calculateX"),(0,o.K2)(W,"calculateMaxRight"),(0,o.K2)(H,"sortedSwimlanesArray"),(0,o.K2)(I,"evolveFramePositioned"),(0,o.K2)(O,"isFirstFrame"),(0,o.K2)(j,"hasSourceFrame"),(0,o.K2)(C,"findBoxByFrame"),(0,o.K2)(D,"findBoxByLineIndex"),(0,o.K2)(U,"decidePositionRelation"),(0,o.K2)(N,"evolveRelationPositioned");var V={[d]:A,[c]:U},z={[m]:I,[x]:N};function X(e,t){const n=V[t.$kind];if(null==n)return[];const i=n(e,t);return o.Rm.debug("decided events",i),i}function G(e,t){const n=t.reduce((e,t)=>{const n=z[t.$kind];return null==n?e:n(e,t)},e);return o.Rm.debug("evolve events",{state:e,newState:n,events:t}),n}function L(e,t){return G(e,X(e,t))}(0,o.K2)(X,"decide"),(0,o.K2)(G,"evolve"),(0,o.K2)(L,"dispatch");var Z={getConfig:p,setOptions:u,getOptions:f,clear:g,setAccTitle:r.SV,getAccTitle:r.iN,getAccDescription:r.m7,setAccDescription:r.EI,setDiagramTitle:r.ke,getDiagramTitle:r.ab,setAst:y,getDiagramProps:k,getState:v},Y={parse:(0,o.K2)(async e=>{const t=await(0,s.qg)("eventmodeling",e);o.Rm.debug(t),Z.setAst(t),(0,i.S)(t,Z)},"parse")};var _=(0,r.D7)(),q=_?.eventmodeling;function J(e,t){return n=>{const i=n.swimlane.y+t.swimlanePadding,a=e.append("g").attr("class","em-box");a.append("rect").attr("x",n.x).attr("y",i).attr("rx","3").attr("width",n.dimension.width).attr("height",n.dimension.height).attr("stroke",n.visual.stroke).attr("fill",n.visual.fill);a.append("foreignObject").attr("x",n.x+t.boxPadding).attr("y",i+10).attr("width",n.dimension.width-2*t.boxPadding).attr("height",n.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(n.text)}}function Q(e,t){return e>t}function ee(e,t,n,i){return a=>{const r=a.sourceBox.swimlane.y+t.swimlanePadding,s=a.targetBox.swimlane.y+t.swimlanePadding,l=Q(r,s),d=a.sourceBox.x+2*a.sourceBox.dimension.width/3,m=a.targetBox.x+a.targetBox.dimension.width/3;let c,x;o.Rm.debug(`rendering relation up=${l} for `,{sourceBox:a.sourceBox,targetBox:a.targetBox}),l?(c=r,x=s+a.targetBox.dimension.height):(c=r+a.sourceBox.dimension.height,x=s);const u=i.emRelationStroke??a.visual.stroke;e.append("path").attr("class","em-relation").attr("fill",a.visual.fill).attr("stroke",u).attr("stroke-width","1").attr("marker-end",`url(#${n})`).attr("d",`M${d} ${c} L${m} ${x}`)}}function te(e,t,n,i){return a=>{const r=e.append("g").attr("class","em-swimlane"),o=i.emSwimlaneBackgroundOdd??"rgb(250,250,250)",s=i.emSwimlaneBackgroundStroke??"rgb(240,240,240)";r.append("rect").attr("x",0).attr("y",a.y).attr("rx","3").attr("width",t+n.swimlanePadding).attr("height",a.height).attr("fill",o).attr("stroke",s),r.append("text").attr("font-weight",n.swimlaneTextFontWeight).attr("x",30).attr("y",a.y+30).text(a.label)}}(0,o.K2)(J,"renderD3Box"),(0,o.K2)(Q,"dirUpwards"),(0,o.K2)(ee,"renderD3Relation"),(0,o.K2)(te,"renderD3Swimlane");var ne={parser:Y,db:Z,renderer:{draw:(0,o.K2)(function(e,t,n,i){if(o.Rm.debug("in eventmodeling renderer",e+"\n","id:",t,n),!q)throw new Error("EventModeling config not found");const a=i.db,{themeVariables:s,eventmodeling:d}=(0,r.D7)(),m=(0,l.Ltv)(`[id="${t}"]`),c=a.getDiagramProps(),x=a.getState(),u=`em-arrowhead-${t}`,f=s.emArrowhead??"#000000";x.sortedSwimlanesArray.forEach(te(m,x.maxR,c,s)),x.boxes.forEach(J(m,c)),x.relations.forEach(ee(m,c,u,s));m.append("defs").append("marker").attr("id",u).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),(0,r.mj)(void 0,m,d?.padding??30,d?.useMaxWidth)},"draw")},styles:(0,o.K2)(e=>"","getStyles")}}}]);
\ No newline at end of file
diff --git a/docs/build/assets/js/1e9767c5.f53ee4bf.js b/docs/build/assets/js/1e9767c5.f53ee4bf.js
deleted file mode 100644
index a2f04582c..000000000
--- a/docs/build/assets/js/1e9767c5.f53ee4bf.js
+++ /dev/null
@@ -1 +0,0 @@
-"use strict";(globalThis.webpackChunkdoriath_docs=globalThis.webpackChunkdoriath_docs||[]).push([[9348],{7596(e,r,s){s.r(r),s.d(r,{assets:()=>l,contentTitle:()=>c,default:()=>a,frontMatter:()=>t,metadata:()=>n,toc:()=>h});const n=JSON.parse('{"id":"ARCHITECTURE","title":"Doriath \u2014 Architecture & Data Model","description":"1. Overview","source":"@site/ARCHITECTURE.md","sourceDirName":".","slug":"/ARCHITECTURE","permalink":"/docs/ARCHITECTURE","draft":false,"unlisted":false,"editUrl":"https://github.com/ConductionNL/doriath/tree/development/docs/ARCHITECTURE.md","tags":[],"version":"current","frontMatter":{},"sidebar":"tutorialSidebar","previous":{"title":"Manage Doriath settings","permalink":"/docs/tutorials/admin/admin-settings"},"next":{"title":"Doriath \u2014 Design References & Dashboard Wireframes","permalink":"/docs/DESIGN-REFERENCES"}}');var i=s(4848),d=s(8453);const t={},c="Doriath \u2014 Architecture & Data Model",l={},h=[{value:"1. Overview",id:"1-overview",level:2},{value:"Architecture Pattern",id:"architecture-pattern",level:3},{value:"2. Standards Research",id:"2-standards-research",level:2},{value:"2.1 Standards Evaluated",id:"21-standards-evaluated",level:3},{value:"2.2 Design Principle: Security First, Standards-Based",id:"22-design-principle-security-first-standards-based",level:3},{value:"2.3 Key Findings",id:"23-key-findings",level:3},{value:"3. Data Model Decisions",id:"3-data-model-decisions",level:2},{value:"3.1 Standards Hierarchy",id:"31-standards-hierarchy",level:3},{value:"3.2 Entity Definitions",id:"32-entity-definitions",level:3},{value:"EncryptionSuite",id:"encryptionsuite",level:4},{value:"Certificate Distinguished Name (DN)",id:"certificate-distinguished-name-dn",level:4},{value:"CACertificate",id:"cacertificate",level:4},{value:"Secret",id:"secret",level:4},{value:"SecretType",id:"secrettype",level:4},{value:"Folder",id:"folder",level:4},{value:"Application",id:"application",level:4},{value:"SecretShare (User-to-User)",id:"secretshare-user-to-user",level:4},{value:"GroupShare",id:"groupshare",level:4},{value:"SecretDelegation",id:"secretdelegation",level:4},{value:"LinkShare",id:"linkshare",level:4},{value:"SecretRequest",id:"secretrequest",level:4},{value:"SuiteMigration",id:"suitemigration",level:4},{value:"3.3 Encryption Flow Summary",id:"33-encryption-flow-summary",level:3},{value:"3.4 Nextcloud Integration Strategy",id:"34-nextcloud-integration-strategy",level:3},{value:"REUSE from Nextcloud",id:"reuse-from-nextcloud",level:4},{value:"BUILD in Doriath (Security-specific)",id:"build-in-doriath-security-specific",level:4},{value:"Key OCP Interface Examples",id:"key-ocp-interface-examples",level:4},{value:"3.5 @conduction/nextcloud-vue Library",id:"35-conductionnextcloud-vue-library",level:3},{value:"3.6 Vue Router (Navigation)",id:"36-vue-router-navigation",level:3},{value:"3.7 OpenConnector Integration",id:"37-openconnector-integration",level:3},{value:"4. Database Configuration",id:"4-database-configuration",level:2},{value:"Doctrine Entities",id:"doctrine-entities",level:3},{value:"5. Open Research Questions",id:"5-open-research-questions",level:2},{value:"6. References",id:"6-references",level:2},{value:"Cryptographic Standards",id:"cryptographic-standards",level:3},{value:"Key Management & Password Policy",id:"key-management--password-policy",level:3},{value:"Nextcloud OCP Interfaces",id:"nextcloud-ocp-interfaces",level:3},{value:"Architectural Decisions",id:"architectural-decisions",level:3}];function o(e){const r={a:"a",blockquote:"blockquote",code:"code",h1:"h1",h2:"h2",h3:"h3",h4:"h4",header:"header",li:"li",ol:"ol",p:"p",pre:"pre",strong:"strong",table:"table",tbody:"tbody",td:"td",th:"th",thead:"thead",tr:"tr",ul:"ul",...(0,d.R)(),...e.components};return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(r.header,{children:(0,i.jsx)(r.h1,{id:"doriath--architecture--data-model",children:"Doriath \u2014 Architecture & Data Model"})}),"\n",(0,i.jsx)(r.h2,{id:"1-overview",children:"1. Overview"}),"\n",(0,i.jsx)(r.p,{children:"Doriath is an encrypted secrets manager for Nextcloud \u2014 a password manager and key store for users and applications. It stores secrets (passwords, API keys, tokens, certificates) encrypted at rest using RSA-4096 public-key cryptography, with private keys protected by AES-256 encryption derived from a user's master password. A private Certificate Authority (root + intermediate) signs all user and application certificates."}),"\n",(0,i.jsx)(r.h3,{id:"architecture-pattern",children:"Architecture Pattern"}),"\n",(0,i.jsx)(r.pre,{children:(0,i.jsx)(r.code,{children:"\u250c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510\n\u2502 Doriath Frontend (Vue 2 + Pinia) \u2502\n\u2502 - Lock screen (master password entry) \u2502\n\u2502 - Vault: secrets list with folder tree \u2502\n\u2502 - Secret detail views (by type) \u2502\n\u2502 - Sharing UI (user, link, request) \u2502\n\u2502 - Key generator \u2502\n\u2502 - Dashboard (KPI cards, vault health) \u2502\n\u2502 - Admin settings (CA health, app management) \u2502\n\u2502 - User settings (session timeout, notifications) \u2502\n\u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u252c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518\n \u2502 REST API calls (Nextcloud session + X-Vault-Password)\n\u250c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u25bc\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510\n\u2502 Doriath PHP Backend \u2502\n\u2502 - Controllers: Secrets, EncryptionSuites, Applications, \u2502\n\u2502 Sharing, KeyGenerator, Settings \u2502\n\u2502 - Services: EncryptionService, CertificateAuthorityService,\u2502\n\u2502 SecretService, SharingService, MigrationService \u2502\n\u2502 - Entities: Doctrine ORM with Nextcloud migrations \u2502\n\u2502 - Encryption: OpenSSL (RSA-4096 + AES-256) \u2502\n\u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u252c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518\n \u2502 Doctrine ORM\n\u250c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u25bc\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510\n\u2502 PostgreSQL Database \u2502\n\u2502 - Own tables (ISchemaWrapper migrations) \u2502\n\u2502 - Encrypted fields: private keys (AES), secret values (RSA)\u2502\n\u2502 - Unencrypted fields: names, URLs, metadata \u2502\n\u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518\n"})}),"\n",(0,i.jsxs)(r.p,{children:["Doriath owns ",(0,i.jsx)(r.strong,{children:"all its database tables"})," \u2014 it does NOT use OpenRegister. This is an explicit exception to the org-wide ADR-001, justified by the security requirements of field-level encryption control and the need to eliminate intermediary services from the data path. See ",(0,i.jsx)(r.a,{href:"../openspec/architecture/adr-001-own-database-tables.md",children:"ADR-001"}),"."]}),"\n",(0,i.jsx)(r.h2,{id:"2-standards-research",children:"2. Standards Research"}),"\n",(0,i.jsx)(r.p,{children:"Before defining our encryption architecture and data model, we evaluated multiple standards across cryptography, key management, and password security."}),"\n",(0,i.jsx)(r.h3,{id:"21-standards-evaluated",children:"2.1 Standards Evaluated"}),"\n",(0,i.jsxs)(r.table,{children:[(0,i.jsx)(r.thead,{children:(0,i.jsxs)(r.tr,{children:[(0,i.jsx)(r.th,{children:"Standard"}),(0,i.jsx)(r.th,{children:"Type"}),(0,i.jsx)(r.th,{children:"Coverage"}),(0,i.jsx)(r.th,{children:"Maturity"}),(0,i.jsx)(r.th,{children:"Relevance"})]})}),(0,i.jsxs)(r.tbody,{children:[(0,i.jsxs)(r.tr,{children:[(0,i.jsx)(r.td,{children:(0,i.jsx)(r.strong,{children:"X.509 / RFC 5280"})}),(0,i.jsx)(r.td,{children:"International (IETF)"}),(0,i.jsx)(r.td,{children:"Certificate format, CA chains, certificate revocation, extensions"}),(0,i.jsx)(r.td,{children:"Very mature (since 1988)"}),(0,i.jsxs)(r.td,{children:[(0,i.jsx)(r.strong,{children:"HIGH"})," \u2014 defines certificate structure for our private CA"]})]}),(0,i.jsxs)(r.tr,{children:[(0,i.jsx)(r.td,{children:(0,i.jsx)(r.strong,{children:"PKCS#1 / RFC 8017"})}),(0,i.jsx)(r.td,{children:"International (IETF)"}),(0,i.jsx)(r.td,{children:"RSA encryption and signature schemes, OAEP padding"}),(0,i.jsx)(r.td,{children:"Very mature"}),(0,i.jsxs)(r.td,{children:[(0,i.jsx)(r.strong,{children:"HIGH"})," \u2014 RSA encryption of secrets"]})]}),(0,i.jsxs)(r.tr,{children:[(0,i.jsx)(r.td,{children:(0,i.jsx)(r.strong,{children:"PKCS#8 / RFC 5958"})}),(0,i.jsx)(r.td,{children:"International (IETF)"}),(0,i.jsx)(r.td,{children:"Private key storage format, encrypted private key wrapping"}),(0,i.jsx)(r.td,{children:"Very mature"}),(0,i.jsxs)(r.td,{children:[(0,i.jsx)(r.strong,{children:"HIGH"})," \u2014 AES-encrypted private key storage"]})]}),(0,i.jsxs)(r.tr,{children:[(0,i.jsx)(r.td,{children:(0,i.jsx)(r.strong,{children:"PKCS#10 / RFC 2986"})}),(0,i.jsx)(r.td,{children:"International (IETF)"}),(0,i.jsx)(r.td,{children:"Certificate Signing Request (CSR) format"}),(0,i.jsx)(r.td,{children:"Very mature"}),(0,i.jsxs)(r.td,{children:[(0,i.jsx)(r.strong,{children:"HIGH"})," \u2014 application registration via CSR"]})]}),(0,i.jsxs)(r.tr,{children:[(0,i.jsx)(r.td,{children:(0,i.jsx)(r.strong,{children:"NIST SP 800-57"})}),(0,i.jsx)(r.td,{children:"US Government"}),(0,i.jsx)(r.td,{children:"Key management lifecycle, key sizes, algorithm selection"}),(0,i.jsx)(r.td,{children:"Current (Rev. 5, 2020)"}),(0,i.jsxs)(r.td,{children:[(0,i.jsx)(r.strong,{children:"HIGH"})," \u2014 RSA-4096 and AES-256 recommendations"]})]}),(0,i.jsxs)(r.tr,{children:[(0,i.jsx)(r.td,{children:(0,i.jsx)(r.strong,{children:"NIST SP 800-63B"})}),(0,i.jsx)(r.td,{children:"US Government"}),(0,i.jsx)(r.td,{children:"Authenticator assurance levels, memorized secret requirements"}),(0,i.jsx)(r.td,{children:"Current (Rev. 4 draft)"}),(0,i.jsxs)(r.td,{children:[(0,i.jsx)(r.strong,{children:"HIGH"})," \u2014 master password strength policy"]})]}),(0,i.jsxs)(r.tr,{children:[(0,i.jsx)(r.td,{children:(0,i.jsx)(r.strong,{children:"OWASP Password Storage"})}),(0,i.jsx)(r.td,{children:"Industry (OWASP)"}),(0,i.jsx)(r.td,{children:"Password hashing, KDF selection (Argon2id, bcrypt, PBKDF2)"}),(0,i.jsx)(r.td,{children:"Active, regularly updated"}),(0,i.jsxs)(r.td,{children:[(0,i.jsx)(r.strong,{children:"HIGH"})," \u2014 Argon2id for link share KDF"]})]}),(0,i.jsxs)(r.tr,{children:[(0,i.jsx)(r.td,{children:(0,i.jsx)(r.strong,{children:"OWASP Cryptographic Storage"})}),(0,i.jsx)(r.td,{children:"Industry (OWASP)"}),(0,i.jsx)(r.td,{children:"Encryption at rest, key management, algorithm selection"}),(0,i.jsx)(r.td,{children:"Active"}),(0,i.jsxs)(r.td,{children:[(0,i.jsx)(r.strong,{children:"HIGH"})," \u2014 encryption architecture validation"]})]}),(0,i.jsxs)(r.tr,{children:[(0,i.jsx)(r.td,{children:(0,i.jsx)(r.strong,{children:"zxcvbn"})}),(0,i.jsx)(r.td,{children:"Industry (Dropbox)"}),(0,i.jsx)(r.td,{children:"Password strength estimation, entropy-based scoring (0\u20134)"}),(0,i.jsx)(r.td,{children:"Mature, widely adopted"}),(0,i.jsxs)(r.td,{children:[(0,i.jsx)(r.strong,{children:"HIGH"})," \u2014 master password strength meter"]})]}),(0,i.jsxs)(r.tr,{children:[(0,i.jsx)(r.td,{children:(0,i.jsx)(r.strong,{children:"Argon2 / RFC 9106"})}),(0,i.jsx)(r.td,{children:"International (IETF)"}),(0,i.jsx)(r.td,{children:"Memory-hard KDF: Argon2d, Argon2i, Argon2id"}),(0,i.jsx)(r.td,{children:"Standardized 2021"}),(0,i.jsxs)(r.td,{children:[(0,i.jsx)(r.strong,{children:"HIGH"})," \u2014 link share snapshot encryption"]})]}),(0,i.jsxs)(r.tr,{children:[(0,i.jsx)(r.td,{children:(0,i.jsx)(r.strong,{children:"WebAuthn / FIDO2"})}),(0,i.jsx)(r.td,{children:"International (W3C)"}),(0,i.jsx)(r.td,{children:"Passwordless authentication, hardware key support"}),(0,i.jsx)(r.td,{children:"Mature, growing adoption"}),(0,i.jsxs)(r.td,{children:[(0,i.jsx)(r.strong,{children:"LOW"})," \u2014 future: passwordless vault unlock"]})]}),(0,i.jsxs)(r.tr,{children:[(0,i.jsx)(r.td,{children:(0,i.jsx)(r.strong,{children:"Schema.org"})}),(0,i.jsx)(r.td,{children:"International (W3C)"}),(0,i.jsx)(r.td,{children:"Structured data vocabulary"}),(0,i.jsx)(r.td,{children:"Very mature"}),(0,i.jsxs)(r.td,{children:[(0,i.jsx)(r.strong,{children:"LOW"})," \u2014 no standard types for secrets/credentials"]})]})]})]}),"\n",(0,i.jsx)(r.h3,{id:"22-design-principle-security-first-standards-based",children:"2.2 Design Principle: Security First, Standards-Based"}),"\n",(0,i.jsxs)(r.blockquote,{children:["\n",(0,i.jsx)(r.p,{children:(0,i.jsx)(r.strong,{children:"All cryptographic operations use established standards via OpenSSL. No custom cryptography. The master password never touches the database."})}),"\n"]}),"\n",(0,i.jsx)(r.p,{children:"This means:"}),"\n",(0,i.jsxs)(r.ul,{children:["\n",(0,i.jsxs)(r.li,{children:["RSA encryption follows ",(0,i.jsx)(r.strong,{children:"PKCS#1 v1.5 / OAEP"})," padding via OpenSSL"]}),"\n",(0,i.jsxs)(r.li,{children:["Private keys are stored in ",(0,i.jsx)(r.strong,{children:"PKCS#8 PEM"})," format, AES-256 encrypted"]}),"\n",(0,i.jsxs)(r.li,{children:["Certificates follow ",(0,i.jsx)(r.strong,{children:"X.509 v3"})," format, signed by the private CA intermediate"]}),"\n",(0,i.jsxs)(r.li,{children:["CSR processing follows ",(0,i.jsx)(r.strong,{children:"PKCS#10"})," for application registration"]}),"\n",(0,i.jsxs)(r.li,{children:["Key derivation for link shares uses ",(0,i.jsx)(r.strong,{children:"Argon2id"})," (memory-hard, RFC 9106)"]}),"\n",(0,i.jsxs)(r.li,{children:["Master password strength is validated using ",(0,i.jsx)(r.strong,{children:"zxcvbn"})," entropy scoring aligned with NIST SP 800-63B"]}),"\n"]}),"\n",(0,i.jsx)(r.h3,{id:"23-key-findings",children:"2.3 Key Findings"}),"\n",(0,i.jsxs)(r.ol,{children:["\n",(0,i.jsxs)(r.li,{children:["\n",(0,i.jsxs)(r.p,{children:[(0,i.jsx)(r.strong,{children:"X.509 / RFC 5280"})," defines the certificate format Doriath uses for its private CA. The root certificate (20-year lifetime) signs an intermediate certificate (3-year lifetime), which in turn signs user and application certificates. This two-tier CA structure follows PKI best practice \u2014 the root key is used rarely, limiting exposure."]}),"\n"]}),"\n",(0,i.jsxs)(r.li,{children:["\n",(0,i.jsxs)(r.p,{children:[(0,i.jsx)(r.strong,{children:"NIST SP 800-57"})," recommends RSA-4096 for protection beyond 2031 (>128-bit security strength). AES-256 provides 256-bit security strength. Both exceed NIST's minimum recommendations for sensitive data protection. Key sizes in Doriath are only allowed to increase, never decrease."]}),"\n"]}),"\n",(0,i.jsxs)(r.li,{children:["\n",(0,i.jsxs)(r.p,{children:[(0,i.jsx)(r.strong,{children:"NIST SP 800-63B"})," defines memorized secret (password) requirements: minimum 8 characters (we require 12), no composition rules (we use entropy-based scoring instead), and blocklist checking. Our zxcvbn-based approach aligns with NIST's shift from complexity rules to entropy measurement."]}),"\n"]}),"\n",(0,i.jsxs)(r.li,{children:["\n",(0,i.jsxs)(r.p,{children:[(0,i.jsx)(r.strong,{children:"OWASP Password Storage Cheat Sheet"})," recommends Argon2id as the first choice for password hashing / key derivation. We use Argon2id for link share snapshot encryption (deriving an AES key from the link password). For master password \u2192 AES key derivation, we use a similar KDF approach."]}),"\n"]}),"\n",(0,i.jsxs)(r.li,{children:["\n",(0,i.jsxs)(r.p,{children:[(0,i.jsx)(r.strong,{children:"PKCS#10 (CSR)"})," enables applications to register with Doriath by submitting a Certificate Signing Request containing their public key. Doriath signs the public key with the CA intermediate and never stores the application's private key \u2014 the application manages its own key externally. This is standard PKI practice for distributed systems."]}),"\n"]}),"\n",(0,i.jsxs)(r.li,{children:["\n",(0,i.jsxs)(r.p,{children:[(0,i.jsx)(r.strong,{children:"RSA chunking constraint"})," (PKCS#1): RSA-4096 can encrypt at most ~500 bytes per operation (key size in bytes \u2212 padding overhead). Secrets larger than this limit must be chunked. This is a known limitation documented in ",(0,i.jsx)(r.a,{href:"../openspec/architecture/adr-003-rsa-aes-encryption-architecture.md",children:"ADR-003"}),"."]}),"\n"]}),"\n",(0,i.jsxs)(r.li,{children:["\n",(0,i.jsxs)(r.p,{children:[(0,i.jsx)(r.strong,{children:"zxcvbn"})," scores passwords on a 0\u20134 scale: 0 = too guessable, 1 = very guessable, 2 = somewhat guessable, 3 = safely unguessable (resists online attacks, ~10^8 guesses), 4 = very unguessable (resists offline attacks, ~10^10 guesses). Doriath requires score \u2265 3 by default, configurable up to 4 by admins."]}),"\n"]}),"\n",(0,i.jsxs)(r.li,{children:["\n",(0,i.jsxs)(r.p,{children:[(0,i.jsx)(r.strong,{children:"No applicable Schema.org types"})," \u2014 Schema.org has no standard vocabulary for secrets, credentials, or vault entries. Doriath entities do not carry schema.org type annotations, unlike other Conduction apps that model semantic data."]}),"\n"]}),"\n"]}),"\n",(0,i.jsx)(r.h2,{id:"3-data-model-decisions",children:"3. Data Model Decisions"}),"\n",(0,i.jsx)(r.h3,{id:"31-standards-hierarchy",children:"3.1 Standards Hierarchy"}),"\n",(0,i.jsxs)(r.table,{children:[(0,i.jsx)(r.thead,{children:(0,i.jsxs)(r.tr,{children:[(0,i.jsx)(r.th,{children:"Layer"}),(0,i.jsx)(r.th,{children:"Standard"}),(0,i.jsx)(r.th,{children:"Purpose"})]})}),(0,i.jsxs)(r.tbody,{children:[(0,i.jsxs)(r.tr,{children:[(0,i.jsx)(r.td,{children:(0,i.jsx)(r.strong,{children:"Cryptography"})}),(0,i.jsx)(r.td,{children:"RSA (PKCS#1), AES-256, OpenSSL"}),(0,i.jsx)(r.td,{children:"Encryption of secrets and private keys"})]}),(0,i.jsxs)(r.tr,{children:[(0,i.jsx)(r.td,{children:(0,i.jsx)(r.strong,{children:"Certificate format"})}),(0,i.jsx)(r.td,{children:"X.509 v3 (RFC 5280), PKCS#8, PKCS#10"}),(0,i.jsx)(r.td,{children:"CA certificates, key storage, CSR processing"})]}),(0,i.jsxs)(r.tr,{children:[(0,i.jsx)(r.td,{children:(0,i.jsx)(r.strong,{children:"Key derivation"})}),(0,i.jsx)(r.td,{children:"Argon2id (RFC 9106)"}),(0,i.jsx)(r.td,{children:"Link share password \u2192 AES key derivation"})]}),(0,i.jsxs)(r.tr,{children:[(0,i.jsx)(r.td,{children:(0,i.jsx)(r.strong,{children:"Password policy"})}),(0,i.jsx)(r.td,{children:"NIST SP 800-63B + zxcvbn"}),(0,i.jsx)(r.td,{children:"Master password strength enforcement"})]}),(0,i.jsxs)(r.tr,{children:[(0,i.jsx)(r.td,{children:(0,i.jsx)(r.strong,{children:"Key management"})}),(0,i.jsx)(r.td,{children:"NIST SP 800-57"}),(0,i.jsx)(r.td,{children:"Key size selection, lifecycle management"})]}),(0,i.jsxs)(r.tr,{children:[(0,i.jsx)(r.td,{children:(0,i.jsx)(r.strong,{children:"Nextcloud native"})}),(0,i.jsx)(r.td,{children:"OCP interfaces"}),(0,i.jsx)(r.td,{children:"Users, sessions, notifications, search, files"})]})]})]}),"\n",(0,i.jsx)(r.h3,{id:"32-entity-definitions",children:"3.2 Entity Definitions"}),"\n",(0,i.jsx)(r.h4,{id:"encryptionsuite",children:"EncryptionSuite"}),"\n",(0,i.jsxs)(r.p,{children:["The cryptographic identity of a user or application. Holds a public certificate (for encrypting secrets) and an AES-encrypted private key (for decrypting them). See ",(0,i.jsx)(r.a,{href:"../openspec/specs/encryption-suites/spec.md",children:"encryption-suites spec"})," for full requirements."]}),"\n",(0,i.jsxs)(r.table,{children:[(0,i.jsx)(r.thead,{children:(0,i.jsxs)(r.tr,{children:[(0,i.jsx)(r.th,{children:"Aspect"}),(0,i.jsx)(r.th,{children:"Decision"}),(0,i.jsx)(r.th,{children:"Rationale"})]})}),(0,i.jsxs)(r.tbody,{children:[(0,i.jsxs)(r.tr,{children:[(0,i.jsx)(r.td,{children:(0,i.jsx)(r.strong,{children:"Standard"})}),(0,i.jsx)(r.td,{children:"X.509 v3 certificate + PKCS#8 private key"}),(0,i.jsx)(r.td,{children:"Industry-standard PKI formats"})]}),(0,i.jsxs)(r.tr,{children:[(0,i.jsx)(r.td,{children:(0,i.jsx)(r.strong,{children:"Ownership"})}),(0,i.jsxs)(r.td,{children:["Polymorphic: ",(0,i.jsx)(r.code,{children:"owner_type"})," (user | application) + ",(0,i.jsx)(r.code,{children:"owner_id"})]}),(0,i.jsxs)(r.td,{children:["Single table, single query path \u2014 see ",(0,i.jsx)(r.a,{href:"../openspec/architecture/adr-002-polymorphic-encryption-suite-ownership.md",children:"ADR-002"})]})]}),(0,i.jsxs)(r.tr,{children:[(0,i.jsx)(r.td,{children:(0,i.jsx)(r.strong,{children:"Key size"})}),(0,i.jsx)(r.td,{children:"RSA-4096 minimum (only allowed to increase)"}),(0,i.jsx)(r.td,{children:"NIST SP 800-57 recommendation for long-term protection"})]}),(0,i.jsxs)(r.tr,{children:[(0,i.jsx)(r.td,{children:(0,i.jsx)(r.strong,{children:"Private key protection"})}),(0,i.jsx)(r.td,{children:"AES-256 encrypted with master password derived key"}),(0,i.jsxs)(r.td,{children:["Master password never stored \u2014 see ",(0,i.jsx)(r.a,{href:"../openspec/architecture/adr-003-rsa-aes-encryption-architecture.md",children:"ADR-003"})]})]}),(0,i.jsxs)(r.tr,{children:[(0,i.jsx)(r.td,{children:(0,i.jsx)(r.strong,{children:"Certificate DN"})}),(0,i.jsx)(r.td,{children:"Default DN fields + owner-specific CN"}),(0,i.jsx)(r.td,{children:"See certificate DN section below"})]})]})]}),"\n",(0,i.jsx)(r.p,{children:(0,i.jsx)(r.strong,{children:"Core properties:"})}),"\n",(0,i.jsxs)(r.table,{children:[(0,i.jsx)(r.thead,{children:(0,i.jsxs)(r.tr,{children:[(0,i.jsx)(r.th,{children:"Property"}),(0,i.jsx)(r.th,{children:"Type"}),(0,i.jsx)(r.th,{children:"Encrypted"}),(0,i.jsx)(r.th,{children:"Standard"}),(0,i.jsx)(r.th,{children:"Notes"})]})}),(0,i.jsxs)(r.tbody,{children:[(0,i.jsxs)(r.tr,{children:[(0,i.jsx)(r.td,{children:(0,i.jsx)(r.code,{children:"id"})}),(0,i.jsx)(r.td,{children:"UUID"}),(0,i.jsx)(r.td,{children:"No"}),(0,i.jsx)(r.td,{children:"\u2014"}),(0,i.jsx)(r.td,{children:"Primary key"})]}),(0,i.jsxs)(r.tr,{children:[(0,i.jsx)(r.td,{children:(0,i.jsx)(r.code,{children:"owner_type"})}),(0,i.jsx)(r.td,{children:"enum: user, application"}),(0,i.jsx)(r.td,{children:"No"}),(0,i.jsx)(r.td,{children:"ADR-002"}),(0,i.jsx)(r.td,{children:"Polymorphic ownership"})]}),(0,i.jsxs)(r.tr,{children:[(0,i.jsx)(r.td,{children:(0,i.jsx)(r.code,{children:"owner_id"})}),(0,i.jsx)(r.td,{children:"string"}),(0,i.jsx)(r.td,{children:"No"}),(0,i.jsx)(r.td,{children:"\u2014"}),(0,i.jsx)(r.td,{children:"Nextcloud user ID or Application ID"})]}),(0,i.jsxs)(r.tr,{children:[(0,i.jsx)(r.td,{children:(0,i.jsx)(r.code,{children:"certificate"})}),(0,i.jsx)(r.td,{children:"text (PEM)"}),(0,i.jsx)(r.td,{children:"No"}),(0,i.jsx)(r.td,{children:"X.509 v3"}),(0,i.jsx)(r.td,{children:"Public certificate signed by CA intermediate"})]}),(0,i.jsxs)(r.tr,{children:[(0,i.jsx)(r.td,{children:(0,i.jsx)(r.code,{children:"private_key"})}),(0,i.jsx)(r.td,{children:"text (PEM)"}),(0,i.jsx)(r.td,{children:"Yes (AES-256)"}),(0,i.jsx)(r.td,{children:"PKCS#8"}),(0,i.jsx)(r.td,{children:"Encrypted with master password derived key"})]}),(0,i.jsxs)(r.tr,{children:[(0,i.jsx)(r.td,{children:(0,i.jsx)(r.code,{children:"status"})}),(0,i.jsx)(r.td,{children:"enum: active, revoked, compromised"}),(0,i.jsx)(r.td,{children:"No"}),(0,i.jsx)(r.td,{children:"X.509 CRL concept"}),(0,i.jsx)(r.td,{children:"Lifecycle state"})]}),(0,i.jsxs)(r.tr,{children:[(0,i.jsx)(r.td,{children:(0,i.jsx)(r.code,{children:"revoked_at"})}),(0,i.jsx)(r.td,{children:"datetime"}),(0,i.jsx)(r.td,{children:"No"}),(0,i.jsx)(r.td,{children:"\u2014"}),(0,i.jsx)(r.td,{children:"Audit: when revoked"})]}),(0,i.jsxs)(r.tr,{children:[(0,i.jsx)(r.td,{children:(0,i.jsx)(r.code,{children:"revoked_reason"})}),(0,i.jsx)(r.td,{children:"string"}),(0,i.jsx)(r.td,{children:"No"}),(0,i.jsx)(r.td,{children:"X.509 CRL reason"}),(0,i.jsx)(r.td,{children:"Audit: why revoked"})]}),(0,i.jsxs)(r.tr,{children:[(0,i.jsx)(r.td,{children:(0,i.jsx)(r.code,{children:"revoked_by"})}),(0,i.jsx)(r.td,{children:"string"}),(0,i.jsx)(r.td,{children:"No"}),(0,i.jsx)(r.td,{children:"\u2014"}),(0,i.jsx)(r.td,{children:"Audit: who revoked"})]}),(0,i.jsxs)(r.tr,{children:[(0,i.jsx)(r.td,{children:(0,i.jsx)(r.code,{children:"reinstated_at"})}),(0,i.jsx)(r.td,{children:"datetime"}),(0,i.jsx)(r.td,{children:"No"}),(0,i.jsx)(r.td,{children:"\u2014"}),(0,i.jsx)(r.td,{children:"Audit: when reinstated"})]}),(0,i.jsxs)(r.tr,{children:[(0,i.jsx)(r.td,{children:(0,i.jsx)(r.code,{children:"reinstated_by"})}),(0,i.jsx)(r.td,{children:"string"}),(0,i.jsx)(r.td,{children:"No"}),(0,i.jsx)(r.td,{children:"\u2014"}),(0,i.jsx)(r.td,{children:"Audit: who reinstated"})]}),(0,i.jsxs)(r.tr,{children:[(0,i.jsx)(r.td,{children:(0,i.jsx)(r.code,{children:"created_at"})}),(0,i.jsx)(r.td,{children:"datetime"}),(0,i.jsx)(r.td,{children:"No"}),(0,i.jsx)(r.td,{children:"\u2014"}),(0,i.jsx)(r.td,{children:"\u2014"})]})]})]}),"\n",(0,i.jsx)(r.h4,{id:"certificate-distinguished-name-dn",children:"Certificate Distinguished Name (DN)"}),"\n",(0,i.jsxs)(r.p,{children:["All certificates issued by the Doriath CA share a common set of DN fields, with the ",(0,i.jsx)(r.code,{children:"commonName"})," varying by certificate type:"]}),"\n",(0,i.jsxs)(r.p,{children:[(0,i.jsx)(r.strong,{children:"Default DN fields"})," (defined as ",(0,i.jsx)(r.code,{children:"DEFAULT_DN"})," in ",(0,i.jsx)(r.code,{children:"CertificateAuthorityService"}),"):"]}),"\n",(0,i.jsxs)(r.table,{children:[(0,i.jsx)(r.thead,{children:(0,i.jsxs)(r.tr,{children:[(0,i.jsx)(r.th,{children:"Field"}),(0,i.jsx)(r.th,{children:"Value"})]})}),(0,i.jsxs)(r.tbody,{children:[(0,i.jsxs)(r.tr,{children:[(0,i.jsx)(r.td,{children:(0,i.jsx)(r.code,{children:"countryName"})}),(0,i.jsx)(r.td,{children:"NL"})]}),(0,i.jsxs)(r.tr,{children:[(0,i.jsx)(r.td,{children:(0,i.jsx)(r.code,{children:"stateOrProvinceName"})}),(0,i.jsx)(r.td,{children:"Noord-Holland"})]}),(0,i.jsxs)(r.tr,{children:[(0,i.jsx)(r.td,{children:(0,i.jsx)(r.code,{children:"localityName"})}),(0,i.jsx)(r.td,{children:"Amsterdam"})]}),(0,i.jsxs)(r.tr,{children:[(0,i.jsx)(r.td,{children:(0,i.jsx)(r.code,{children:"organizationName"})}),(0,i.jsx)(r.td,{children:"Conduction"})]}),(0,i.jsxs)(r.tr,{children:[(0,i.jsx)(r.td,{children:(0,i.jsx)(r.code,{children:"organizationalUnitName"})}),(0,i.jsx)(r.td,{children:"Doriath"})]})]})]}),"\n",(0,i.jsx)(r.p,{children:(0,i.jsx)(r.strong,{children:"Common Name by certificate type:"})}),"\n",(0,i.jsxs)(r.table,{children:[(0,i.jsx)(r.thead,{children:(0,i.jsxs)(r.tr,{children:[(0,i.jsx)(r.th,{children:"Certificate"}),(0,i.jsx)(r.th,{children:"Common Name"}),(0,i.jsx)(r.th,{children:"Example"})]})}),(0,i.jsxs)(r.tbody,{children:[(0,i.jsxs)(r.tr,{children:[(0,i.jsx)(r.td,{children:"Root CA"}),(0,i.jsx)(r.td,{children:(0,i.jsx)(r.code,{children:"Doriath Root CA"})}),(0,i.jsx)(r.td,{children:(0,i.jsx)(r.code,{children:"Doriath Root CA"})})]}),(0,i.jsxs)(r.tr,{children:[(0,i.jsx)(r.td,{children:"Intermediate CA"}),(0,i.jsx)(r.td,{children:(0,i.jsx)(r.code,{children:"Doriath Intermediate CA"})}),(0,i.jsx)(r.td,{children:(0,i.jsx)(r.code,{children:"Doriath Intermediate CA"})})]}),(0,i.jsxs)(r.tr,{children:[(0,i.jsx)(r.td,{children:"User certificate"}),(0,i.jsx)(r.td,{children:"Federated cloud ID (user@instance), falls back to user ID"}),(0,i.jsx)(r.td,{children:(0,i.jsx)(r.code,{children:"admin@nextcloud.local"})})]}),(0,i.jsxs)(r.tr,{children:[(0,i.jsx)(r.td,{children:"Application certificate"}),(0,i.jsx)(r.td,{children:"Application ID"}),(0,i.jsx)(r.td,{children:(0,i.jsx)(r.code,{children:"a1b2c3d4-..."})})]})]})]}),"\n",(0,i.jsxs)(r.p,{children:["The cloud ID is resolved via ",(0,i.jsx)(r.code,{children:"IUserManager::get($ownerId)->getCloudId()"})," in ",(0,i.jsx)(r.code,{children:"EncryptionSuiteService::resolveCommonName()"}),". This ensures user certificates contain the full federated identity. When a certificate is re-signed during CA renewal, the original CN is preserved by extracting it from the existing certificate via ",(0,i.jsx)(r.code,{children:"openssl_x509_parse()"}),"."]}),"\n",(0,i.jsx)(r.h4,{id:"cacertificate",children:"CACertificate"}),"\n",(0,i.jsx)(r.p,{children:"The private Certificate Authority that signs all user and application certificates."}),"\n",(0,i.jsxs)(r.table,{children:[(0,i.jsx)(r.thead,{children:(0,i.jsxs)(r.tr,{children:[(0,i.jsx)(r.th,{children:"Aspect"}),(0,i.jsx)(r.th,{children:"Decision"}),(0,i.jsx)(r.th,{children:"Rationale"})]})}),(0,i.jsxs)(r.tbody,{children:[(0,i.jsxs)(r.tr,{children:[(0,i.jsx)(r.td,{children:(0,i.jsx)(r.strong,{children:"Structure"})}),(0,i.jsx)(r.td,{children:"Two-tier: root (20yr) \u2192 intermediate (3yr)"}),(0,i.jsx)(r.td,{children:"PKI best practice \u2014 root key used rarely"})]}),(0,i.jsxs)(r.tr,{children:[(0,i.jsx)(r.td,{children:(0,i.jsx)(r.strong,{children:"Standard"})}),(0,i.jsx)(r.td,{children:"X.509 v3 certificates"}),(0,i.jsx)(r.td,{children:"Industry standard"})]}),(0,i.jsxs)(r.tr,{children:[(0,i.jsx)(r.td,{children:(0,i.jsx)(r.strong,{children:"Renewal"})}),(0,i.jsx)(r.td,{children:"Intermediate auto-renews; root requires manual admin action"}),(0,i.jsx)(r.td,{children:"Minimize disruption; root rotation is rare"})]})]})]}),"\n",(0,i.jsx)(r.p,{children:(0,i.jsx)(r.strong,{children:"Core properties:"})}),"\n",(0,i.jsxs)(r.table,{children:[(0,i.jsx)(r.thead,{children:(0,i.jsxs)(r.tr,{children:[(0,i.jsx)(r.th,{children:"Property"}),(0,i.jsx)(r.th,{children:"Type"}),(0,i.jsx)(r.th,{children:"Encrypted"}),(0,i.jsx)(r.th,{children:"Standard"}),(0,i.jsx)(r.th,{children:"Notes"})]})}),(0,i.jsxs)(r.tbody,{children:[(0,i.jsxs)(r.tr,{children:[(0,i.jsx)(r.td,{children:(0,i.jsx)(r.code,{children:"id"})}),(0,i.jsx)(r.td,{children:"UUID"}),(0,i.jsx)(r.td,{children:"No"}),(0,i.jsx)(r.td,{children:"\u2014"}),(0,i.jsx)(r.td,{children:"Primary key"})]}),(0,i.jsxs)(r.tr,{children:[(0,i.jsx)(r.td,{children:(0,i.jsx)(r.code,{children:"type"})}),(0,i.jsx)(r.td,{children:"enum: root, intermediate"}),(0,i.jsx)(r.td,{children:"No"}),(0,i.jsx)(r.td,{children:"PKI convention"}),(0,i.jsx)(r.td,{children:"Certificate tier"})]}),(0,i.jsxs)(r.tr,{children:[(0,i.jsx)(r.td,{children:(0,i.jsx)(r.code,{children:"certificate"})}),(0,i.jsx)(r.td,{children:"text (PEM)"}),(0,i.jsx)(r.td,{children:"No"}),(0,i.jsx)(r.td,{children:"X.509 v3"}),(0,i.jsx)(r.td,{children:"Public certificate"})]}),(0,i.jsxs)(r.tr,{children:[(0,i.jsx)(r.td,{children:(0,i.jsx)(r.code,{children:"private_key"})}),(0,i.jsx)(r.td,{children:"text (PEM)"}),(0,i.jsx)(r.td,{children:"Yes (AES-256)"}),(0,i.jsx)(r.td,{children:"PKCS#8"}),(0,i.jsx)(r.td,{children:"Only present for intermediate"})]}),(0,i.jsxs)(r.tr,{children:[(0,i.jsx)(r.td,{children:(0,i.jsx)(r.code,{children:"is_active"})}),(0,i.jsx)(r.td,{children:"bool"}),(0,i.jsx)(r.td,{children:"No"}),(0,i.jsx)(r.td,{children:"\u2014"}),(0,i.jsx)(r.td,{children:"Only one intermediate active for signing"})]}),(0,i.jsxs)(r.tr,{children:[(0,i.jsx)(r.td,{children:(0,i.jsx)(r.code,{children:"expires_at"})}),(0,i.jsx)(r.td,{children:"datetime"}),(0,i.jsx)(r.td,{children:"No"}),(0,i.jsx)(r.td,{children:"X.509 validity"}),(0,i.jsx)(r.td,{children:"For efficient expiry queries"})]}),(0,i.jsxs)(r.tr,{children:[(0,i.jsx)(r.td,{children:(0,i.jsx)(r.code,{children:"revoked_at"})}),(0,i.jsx)(r.td,{children:"datetime"}),(0,i.jsx)(r.td,{children:"No"}),(0,i.jsx)(r.td,{children:"X.509 CRL"}),(0,i.jsx)(r.td,{children:"Set on forced revocation"})]}),(0,i.jsxs)(r.tr,{children:[(0,i.jsx)(r.td,{children:(0,i.jsx)(r.code,{children:"successor_id"})}),(0,i.jsx)(r.td,{children:"FK"}),(0,i.jsx)(r.td,{children:"No"}),(0,i.jsx)(r.td,{children:"\u2014"}),(0,i.jsx)(r.td,{children:"Points to replacement certificate"})]}),(0,i.jsxs)(r.tr,{children:[(0,i.jsx)(r.td,{children:(0,i.jsx)(r.code,{children:"created_at"})}),(0,i.jsx)(r.td,{children:"datetime"}),(0,i.jsx)(r.td,{children:"No"}),(0,i.jsx)(r.td,{children:"\u2014"}),(0,i.jsx)(r.td,{children:"\u2014"})]})]})]}),"\n",(0,i.jsx)(r.h4,{id:"secret",children:"Secret"}),"\n",(0,i.jsx)(r.p,{children:"The core data entity \u2014 holds sensitive information encrypted with the owner's public certificate."}),"\n",(0,i.jsxs)(r.table,{children:[(0,i.jsx)(r.thead,{children:(0,i.jsxs)(r.tr,{children:[(0,i.jsx)(r.th,{children:"Aspect"}),(0,i.jsx)(r.th,{children:"Decision"}),(0,i.jsx)(r.th,{children:"Rationale"})]})}),(0,i.jsxs)(r.tbody,{children:[(0,i.jsxs)(r.tr,{children:[(0,i.jsx)(r.td,{children:(0,i.jsx)(r.strong,{children:"Encryption"})}),(0,i.jsx)(r.td,{children:"RSA-4096 (PKCS#1) per owner's public certificate"}),(0,i.jsx)(r.td,{children:"Asymmetric: enables write-without-read"})]}),(0,i.jsxs)(r.tr,{children:[(0,i.jsx)(r.td,{children:(0,i.jsx)(r.strong,{children:"Searchable fields"})}),(0,i.jsxs)(r.td,{children:[(0,i.jsx)(r.code,{children:"name"})," and ",(0,i.jsx)(r.code,{children:"url"})," stored unencrypted"]}),(0,i.jsx)(r.td,{children:"Enables search and Nextcloud unified search without master password"})]}),(0,i.jsxs)(r.tr,{children:[(0,i.jsx)(r.td,{children:(0,i.jsx)(r.strong,{children:"Folder organization"})}),(0,i.jsxs)(r.td,{children:["Tree via ",(0,i.jsx)(r.code,{children:"parent_id"})," on Folder entity"]}),(0,i.jsx)(r.td,{children:"User-managed hierarchy, no stored path strings"})]})]})]}),"\n",(0,i.jsx)(r.p,{children:(0,i.jsx)(r.strong,{children:"Core properties:"})}),"\n",(0,i.jsxs)(r.table,{children:[(0,i.jsx)(r.thead,{children:(0,i.jsxs)(r.tr,{children:[(0,i.jsx)(r.th,{children:"Property"}),(0,i.jsx)(r.th,{children:"Type"}),(0,i.jsx)(r.th,{children:"Encrypted"}),(0,i.jsx)(r.th,{children:"Standard"}),(0,i.jsx)(r.th,{children:"Notes"})]})}),(0,i.jsxs)(r.tbody,{children:[(0,i.jsxs)(r.tr,{children:[(0,i.jsx)(r.td,{children:(0,i.jsx)(r.code,{children:"id"})}),(0,i.jsx)(r.td,{children:"UUID"}),(0,i.jsx)(r.td,{children:"No"}),(0,i.jsx)(r.td,{children:"\u2014"}),(0,i.jsx)(r.td,{children:"Primary key"})]}),(0,i.jsxs)(r.tr,{children:[(0,i.jsx)(r.td,{children:(0,i.jsx)(r.code,{children:"name"})}),(0,i.jsx)(r.td,{children:"string"}),(0,i.jsx)(r.td,{children:"No"}),(0,i.jsx)(r.td,{children:"\u2014"}),(0,i.jsx)(r.td,{children:"Human-readable label \u2014 safe for lists/search"})]}),(0,i.jsxs)(r.tr,{children:[(0,i.jsx)(r.td,{children:(0,i.jsx)(r.code,{children:"url"})}),(0,i.jsx)(r.td,{children:"string"}),(0,i.jsx)(r.td,{children:"No"}),(0,i.jsx)(r.td,{children:"\u2014"}),(0,i.jsx)(r.td,{children:"Target URL \u2014 enables search without decryption"})]}),(0,i.jsxs)(r.tr,{children:[(0,i.jsx)(r.td,{children:(0,i.jsx)(r.code,{children:"type_id"})}),(0,i.jsx)(r.td,{children:"FK"}),(0,i.jsx)(r.td,{children:"No"}),(0,i.jsx)(r.td,{children:"\u2014"}),(0,i.jsxs)(r.td,{children:["SecretType reference; defaults to ",(0,i.jsx)(r.code,{children:"login"})]})]}),(0,i.jsxs)(r.tr,{children:[(0,i.jsx)(r.td,{children:(0,i.jsx)(r.code,{children:"folder_id"})}),(0,i.jsx)(r.td,{children:"FK"}),(0,i.jsx)(r.td,{children:"No"}),(0,i.jsx)(r.td,{children:"\u2014"}),(0,i.jsx)(r.td,{children:"Folder reference; null = root level"})]}),(0,i.jsxs)(r.tr,{children:[(0,i.jsx)(r.td,{children:(0,i.jsx)(r.code,{children:"key"})}),(0,i.jsx)(r.td,{children:"text"}),(0,i.jsx)(r.td,{children:"Yes (RSA)"}),(0,i.jsx)(r.td,{children:"PKCS#1"}),(0,i.jsx)(r.td,{children:"The actual secret value"})]}),(0,i.jsxs)(r.tr,{children:[(0,i.jsx)(r.td,{children:(0,i.jsx)(r.code,{children:"login"})}),(0,i.jsx)(r.td,{children:"string"}),(0,i.jsx)(r.td,{children:"Yes (RSA)"}),(0,i.jsx)(r.td,{children:"\u2014"}),(0,i.jsx)(r.td,{children:"Username, client ID, or equivalent"})]}),(0,i.jsxs)(r.tr,{children:[(0,i.jsx)(r.td,{children:(0,i.jsx)(r.code,{children:"additional_fields"})}),(0,i.jsx)(r.td,{children:"text"}),(0,i.jsx)(r.td,{children:"Yes (RSA)"}),(0,i.jsx)(r.td,{children:"\u2014"}),(0,i.jsx)(r.td,{children:"JSON blob of extra key-value pairs"})]}),(0,i.jsxs)(r.tr,{children:[(0,i.jsx)(r.td,{children:(0,i.jsx)(r.code,{children:"encryption_suite_id"})}),(0,i.jsx)(r.td,{children:"FK"}),(0,i.jsx)(r.td,{children:"No"}),(0,i.jsx)(r.td,{children:"\u2014"}),(0,i.jsx)(r.td,{children:"Which suite encrypted this secret"})]}),(0,i.jsxs)(r.tr,{children:[(0,i.jsx)(r.td,{children:(0,i.jsx)(r.code,{children:"owner_type"})}),(0,i.jsx)(r.td,{children:"enum: user, application"}),(0,i.jsx)(r.td,{children:"No"}),(0,i.jsx)(r.td,{children:"ADR-002"}),(0,i.jsx)(r.td,{children:"Polymorphic ownership"})]}),(0,i.jsxs)(r.tr,{children:[(0,i.jsx)(r.td,{children:(0,i.jsx)(r.code,{children:"owner_id"})}),(0,i.jsx)(r.td,{children:"string"}),(0,i.jsx)(r.td,{children:"No"}),(0,i.jsx)(r.td,{children:"\u2014"}),(0,i.jsx)(r.td,{children:"Nextcloud user ID or Application ID"})]}),(0,i.jsxs)(r.tr,{children:[(0,i.jsx)(r.td,{children:(0,i.jsx)(r.code,{children:"possibly_compromised_at"})}),(0,i.jsx)(r.td,{children:"datetime"}),(0,i.jsx)(r.td,{children:"No"}),(0,i.jsx)(r.td,{children:"\u2014"}),(0,i.jsx)(r.td,{children:"Set during compromise recovery"})]}),(0,i.jsxs)(r.tr,{children:[(0,i.jsx)(r.td,{children:(0,i.jsx)(r.code,{children:"migration_error"})}),(0,i.jsx)(r.td,{children:"text"}),(0,i.jsx)(r.td,{children:"No"}),(0,i.jsx)(r.td,{children:"\u2014"}),(0,i.jsx)(r.td,{children:"Set on re-encryption failure"})]}),(0,i.jsxs)(r.tr,{children:[(0,i.jsx)(r.td,{children:(0,i.jsx)(r.code,{children:"created_at"})}),(0,i.jsx)(r.td,{children:"datetime"}),(0,i.jsx)(r.td,{children:"No"}),(0,i.jsx)(r.td,{children:"\u2014"}),(0,i.jsx)(r.td,{children:"\u2014"})]}),(0,i.jsxs)(r.tr,{children:[(0,i.jsx)(r.td,{children:(0,i.jsx)(r.code,{children:"updated_at"})}),(0,i.jsx)(r.td,{children:"datetime"}),(0,i.jsx)(r.td,{children:"No"}),(0,i.jsx)(r.td,{children:"\u2014"}),(0,i.jsx)(r.td,{children:"\u2014"})]})]})]}),"\n",(0,i.jsx)(r.h4,{id:"secrettype",children:"SecretType"}),"\n",(0,i.jsx)(r.p,{children:"Defines the type of a secret \u2014 a UI hint that drives how the interface labels and presents fields."}),"\n",(0,i.jsxs)(r.table,{children:[(0,i.jsx)(r.thead,{children:(0,i.jsxs)(r.tr,{children:[(0,i.jsx)(r.th,{children:"Property"}),(0,i.jsx)(r.th,{children:"Type"}),(0,i.jsx)(r.th,{children:"Notes"})]})}),(0,i.jsxs)(r.tbody,{children:[(0,i.jsxs)(r.tr,{children:[(0,i.jsx)(r.td,{children:(0,i.jsx)(r.code,{children:"id"})}),(0,i.jsx)(r.td,{children:"UUID"}),(0,i.jsx)(r.td,{children:"Primary key"})]}),(0,i.jsxs)(r.tr,{children:[(0,i.jsx)(r.td,{children:(0,i.jsx)(r.code,{children:"name"})}),(0,i.jsx)(r.td,{children:"string"}),(0,i.jsxs)(r.td,{children:["Slug identifier (e.g., ",(0,i.jsx)(r.code,{children:"api_key"}),") \u2014 unique"]})]}),(0,i.jsxs)(r.tr,{children:[(0,i.jsx)(r.td,{children:(0,i.jsx)(r.code,{children:"label"})}),(0,i.jsx)(r.td,{children:"string"}),(0,i.jsx)(r.td,{children:'Human-readable (e.g., "API Key")'})]}),(0,i.jsxs)(r.tr,{children:[(0,i.jsx)(r.td,{children:(0,i.jsx)(r.code,{children:"scope"})}),(0,i.jsx)(r.td,{children:"enum: system, user, global"}),(0,i.jsxs)(r.td,{children:[(0,i.jsx)(r.code,{children:"system"})," = built-in; ",(0,i.jsx)(r.code,{children:"user"})," = per-user; ",(0,i.jsx)(r.code,{children:"global"})," = admin-created"]})]}),(0,i.jsxs)(r.tr,{children:[(0,i.jsx)(r.td,{children:(0,i.jsx)(r.code,{children:"owner_id"})}),(0,i.jsx)(r.td,{children:"string"}),(0,i.jsxs)(r.td,{children:["Nextcloud user ID for ",(0,i.jsx)(r.code,{children:"user"})," scope; null for system/global"]})]}),(0,i.jsxs)(r.tr,{children:[(0,i.jsx)(r.td,{children:(0,i.jsx)(r.code,{children:"created_at"})}),(0,i.jsx)(r.td,{children:"datetime"}),(0,i.jsx)(r.td,{children:"\u2014"})]})]})]}),"\n",(0,i.jsxs)(r.p,{children:[(0,i.jsx)(r.strong,{children:"System types"})," (seeded on install, immutable): ",(0,i.jsx)(r.code,{children:"login"}),", ",(0,i.jsx)(r.code,{children:"api_key"}),", ",(0,i.jsx)(r.code,{children:"ssh_key"}),", ",(0,i.jsx)(r.code,{children:"certificate"}),", ",(0,i.jsx)(r.code,{children:"note"}),", ",(0,i.jsx)(r.code,{children:"database"})]}),"\n",(0,i.jsx)(r.h4,{id:"folder",children:"Folder"}),"\n",(0,i.jsx)(r.p,{children:"Organizes secrets into a per-user tree hierarchy."}),"\n",(0,i.jsxs)(r.table,{children:[(0,i.jsx)(r.thead,{children:(0,i.jsxs)(r.tr,{children:[(0,i.jsx)(r.th,{children:"Property"}),(0,i.jsx)(r.th,{children:"Type"}),(0,i.jsx)(r.th,{children:"Notes"})]})}),(0,i.jsxs)(r.tbody,{children:[(0,i.jsxs)(r.tr,{children:[(0,i.jsx)(r.td,{children:(0,i.jsx)(r.code,{children:"id"})}),(0,i.jsx)(r.td,{children:"UUID"}),(0,i.jsx)(r.td,{children:"Primary key"})]}),(0,i.jsxs)(r.tr,{children:[(0,i.jsx)(r.td,{children:(0,i.jsx)(r.code,{children:"name"})}),(0,i.jsx)(r.td,{children:"string"}),(0,i.jsx)(r.td,{children:"Single path segment, no slashes"})]}),(0,i.jsxs)(r.tr,{children:[(0,i.jsx)(r.td,{children:(0,i.jsx)(r.code,{children:"parent_id"})}),(0,i.jsx)(r.td,{children:"FK (Folder)"}),(0,i.jsx)(r.td,{children:"Null = root level"})]}),(0,i.jsxs)(r.tr,{children:[(0,i.jsx)(r.td,{children:(0,i.jsx)(r.code,{children:"owner_type"})}),(0,i.jsx)(r.td,{children:"enum: user, application"}),(0,i.jsx)(r.td,{children:"Polymorphic ownership"})]}),(0,i.jsxs)(r.tr,{children:[(0,i.jsx)(r.td,{children:(0,i.jsx)(r.code,{children:"owner_id"})}),(0,i.jsx)(r.td,{children:"string"}),(0,i.jsx)(r.td,{children:"Nextcloud user ID or Application ID"})]}),(0,i.jsxs)(r.tr,{children:[(0,i.jsx)(r.td,{children:(0,i.jsx)(r.code,{children:"created_at"})}),(0,i.jsx)(r.td,{children:"datetime"}),(0,i.jsx)(r.td,{children:"\u2014"})]}),(0,i.jsxs)(r.tr,{children:[(0,i.jsx)(r.td,{children:(0,i.jsx)(r.code,{children:"updated_at"})}),(0,i.jsx)(r.td,{children:"datetime"}),(0,i.jsx)(r.td,{children:"\u2014"})]})]})]}),"\n",(0,i.jsx)(r.h4,{id:"application",children:"Application"}),"\n",(0,i.jsx)(r.p,{children:"An external or internal application registered to use Doriath as a secret store."}),"\n",(0,i.jsxs)(r.table,{children:[(0,i.jsx)(r.thead,{children:(0,i.jsxs)(r.tr,{children:[(0,i.jsx)(r.th,{children:"Property"}),(0,i.jsx)(r.th,{children:"Type"}),(0,i.jsx)(r.th,{children:"Notes"})]})}),(0,i.jsxs)(r.tbody,{children:[(0,i.jsxs)(r.tr,{children:[(0,i.jsx)(r.td,{children:(0,i.jsx)(r.code,{children:"id"})}),(0,i.jsx)(r.td,{children:"UUID"}),(0,i.jsx)(r.td,{children:"Primary key"})]}),(0,i.jsxs)(r.tr,{children:[(0,i.jsx)(r.td,{children:(0,i.jsx)(r.code,{children:"name"})}),(0,i.jsx)(r.td,{children:"string"}),(0,i.jsx)(r.td,{children:"Human-readable name"})]}),(0,i.jsxs)(r.tr,{children:[(0,i.jsx)(r.td,{children:(0,i.jsx)(r.code,{children:"type"})}),(0,i.jsx)(r.td,{children:"enum: internal, external"}),(0,i.jsx)(r.td,{children:"Informational; no functional difference currently"})]}),(0,i.jsxs)(r.tr,{children:[(0,i.jsx)(r.td,{children:(0,i.jsx)(r.code,{children:"status"})}),(0,i.jsx)(r.td,{children:"enum: pending, active"}),(0,i.jsxs)(r.td,{children:["Non-admin registrations start as ",(0,i.jsx)(r.code,{children:"pending"})]})]}),(0,i.jsxs)(r.tr,{children:[(0,i.jsx)(r.td,{children:(0,i.jsx)(r.code,{children:"registered_by"})}),(0,i.jsx)(r.td,{children:"string"}),(0,i.jsx)(r.td,{children:"Nextcloud user ID or null (anonymous)"})]}),(0,i.jsxs)(r.tr,{children:[(0,i.jsx)(r.td,{children:(0,i.jsx)(r.code,{children:"approved_by"})}),(0,i.jsx)(r.td,{children:"string"}),(0,i.jsx)(r.td,{children:"Admin user ID; null if pending"})]}),(0,i.jsxs)(r.tr,{children:[(0,i.jsx)(r.td,{children:(0,i.jsx)(r.code,{children:"created_at"})}),(0,i.jsx)(r.td,{children:"datetime"}),(0,i.jsx)(r.td,{children:"\u2014"})]}),(0,i.jsxs)(r.tr,{children:[(0,i.jsx)(r.td,{children:(0,i.jsx)(r.code,{children:"approved_at"})}),(0,i.jsx)(r.td,{children:"datetime"}),(0,i.jsx)(r.td,{children:"\u2014"})]})]})]}),"\n",(0,i.jsx)(r.h4,{id:"secretshare-user-to-user",children:"SecretShare (User-to-User)"}),"\n",(0,i.jsx)(r.p,{children:"Links an original secret to an encrypted copy in a recipient's vault."}),"\n",(0,i.jsxs)(r.table,{children:[(0,i.jsx)(r.thead,{children:(0,i.jsxs)(r.tr,{children:[(0,i.jsx)(r.th,{children:"Property"}),(0,i.jsx)(r.th,{children:"Type"}),(0,i.jsx)(r.th,{children:"Notes"})]})}),(0,i.jsxs)(r.tbody,{children:[(0,i.jsxs)(r.tr,{children:[(0,i.jsx)(r.td,{children:(0,i.jsx)(r.code,{children:"id"})}),(0,i.jsx)(r.td,{children:"UUID"}),(0,i.jsx)(r.td,{children:"Primary key"})]}),(0,i.jsxs)(r.tr,{children:[(0,i.jsx)(r.td,{children:(0,i.jsx)(r.code,{children:"source_secret_id"})}),(0,i.jsx)(r.td,{children:"FK (Secret)"}),(0,i.jsx)(r.td,{children:"The original secret"})]}),(0,i.jsxs)(r.tr,{children:[(0,i.jsx)(r.td,{children:(0,i.jsx)(r.code,{children:"target_user_id"})}),(0,i.jsx)(r.td,{children:"string"}),(0,i.jsx)(r.td,{children:"Recipient's Nextcloud user ID"})]}),(0,i.jsxs)(r.tr,{children:[(0,i.jsx)(r.td,{children:(0,i.jsx)(r.code,{children:"secret_id"})}),(0,i.jsx)(r.td,{children:"FK (Secret)"}),(0,i.jsx)(r.td,{children:"The encrypted copy in recipient's vault"})]}),(0,i.jsxs)(r.tr,{children:[(0,i.jsx)(r.td,{children:(0,i.jsx)(r.code,{children:"group_share_id"})}),(0,i.jsx)(r.td,{children:"FK (GroupShare)"}),(0,i.jsx)(r.td,{children:"Nullable \u2014 set if created from a group share"})]}),(0,i.jsxs)(r.tr,{children:[(0,i.jsx)(r.td,{children:(0,i.jsx)(r.code,{children:"created_at"})}),(0,i.jsx)(r.td,{children:"datetime"}),(0,i.jsx)(r.td,{children:"\u2014"})]})]})]}),"\n",(0,i.jsx)(r.h4,{id:"groupshare",children:"GroupShare"}),"\n",(0,i.jsx)(r.p,{children:"Tracks that a secret has been shared with a Nextcloud user group."}),"\n",(0,i.jsxs)(r.table,{children:[(0,i.jsx)(r.thead,{children:(0,i.jsxs)(r.tr,{children:[(0,i.jsx)(r.th,{children:"Property"}),(0,i.jsx)(r.th,{children:"Type"}),(0,i.jsx)(r.th,{children:"Notes"})]})}),(0,i.jsxs)(r.tbody,{children:[(0,i.jsxs)(r.tr,{children:[(0,i.jsx)(r.td,{children:(0,i.jsx)(r.code,{children:"id"})}),(0,i.jsx)(r.td,{children:"UUID"}),(0,i.jsx)(r.td,{children:"Primary key"})]}),(0,i.jsxs)(r.tr,{children:[(0,i.jsx)(r.td,{children:(0,i.jsx)(r.code,{children:"secret_id"})}),(0,i.jsx)(r.td,{children:"FK (Secret)"}),(0,i.jsx)(r.td,{children:"The secret shared with the group"})]}),(0,i.jsxs)(r.tr,{children:[(0,i.jsx)(r.td,{children:(0,i.jsx)(r.code,{children:"group_id"})}),(0,i.jsx)(r.td,{children:"string"}),(0,i.jsx)(r.td,{children:"Nextcloud group ID"})]}),(0,i.jsxs)(r.tr,{children:[(0,i.jsx)(r.td,{children:(0,i.jsx)(r.code,{children:"created_by"})}),(0,i.jsx)(r.td,{children:"string"}),(0,i.jsx)(r.td,{children:"Owner who created the share"})]}),(0,i.jsxs)(r.tr,{children:[(0,i.jsx)(r.td,{children:(0,i.jsx)(r.code,{children:"created_at"})}),(0,i.jsx)(r.td,{children:"datetime"}),(0,i.jsx)(r.td,{children:"\u2014"})]})]})]}),"\n",(0,i.jsx)(r.h4,{id:"secretdelegation",children:"SecretDelegation"}),"\n",(0,i.jsx)(r.p,{children:"Tracks ownership delegation of a secret."}),"\n",(0,i.jsxs)(r.table,{children:[(0,i.jsx)(r.thead,{children:(0,i.jsxs)(r.tr,{children:[(0,i.jsx)(r.th,{children:"Property"}),(0,i.jsx)(r.th,{children:"Type"}),(0,i.jsx)(r.th,{children:"Notes"})]})}),(0,i.jsxs)(r.tbody,{children:[(0,i.jsxs)(r.tr,{children:[(0,i.jsx)(r.td,{children:(0,i.jsx)(r.code,{children:"id"})}),(0,i.jsx)(r.td,{children:"UUID"}),(0,i.jsx)(r.td,{children:"Primary key"})]}),(0,i.jsxs)(r.tr,{children:[(0,i.jsx)(r.td,{children:(0,i.jsx)(r.code,{children:"secret_id"})}),(0,i.jsx)(r.td,{children:"FK (Secret)"}),(0,i.jsx)(r.td,{children:"The delegated secret"})]}),(0,i.jsxs)(r.tr,{children:[(0,i.jsx)(r.td,{children:(0,i.jsx)(r.code,{children:"original_owner_id"})}),(0,i.jsx)(r.td,{children:"string"}),(0,i.jsx)(r.td,{children:"Original owner's user ID"})]}),(0,i.jsxs)(r.tr,{children:[(0,i.jsx)(r.td,{children:(0,i.jsx)(r.code,{children:"delegated_to"})}),(0,i.jsx)(r.td,{children:"string"}),(0,i.jsx)(r.td,{children:"Delegate's user ID"})]}),(0,i.jsxs)(r.tr,{children:[(0,i.jsx)(r.td,{children:(0,i.jsx)(r.code,{children:"delegated_at"})}),(0,i.jsx)(r.td,{children:"datetime"}),(0,i.jsx)(r.td,{children:"\u2014"})]}),(0,i.jsxs)(r.tr,{children:[(0,i.jsx)(r.td,{children:(0,i.jsx)(r.code,{children:"initiated_by"})}),(0,i.jsx)(r.td,{children:"string"}),(0,i.jsx)(r.td,{children:"Who created the delegation"})]}),(0,i.jsxs)(r.tr,{children:[(0,i.jsx)(r.td,{children:(0,i.jsx)(r.code,{children:"is_permanent"})}),(0,i.jsx)(r.td,{children:"bool"}),(0,i.jsx)(r.td,{children:"False = temporary; true = permanent (owner's suite revoked)"})]}),(0,i.jsxs)(r.tr,{children:[(0,i.jsx)(r.td,{children:(0,i.jsx)(r.code,{children:"made_permanent_at"})}),(0,i.jsx)(r.td,{children:"datetime"}),(0,i.jsx)(r.td,{children:"Null while temporary"})]})]})]}),"\n",(0,i.jsx)(r.h4,{id:"linkshare",children:"LinkShare"}),"\n",(0,i.jsx)(r.p,{children:"A password-protected link for sharing a secret snapshot with external parties."}),"\n",(0,i.jsxs)(r.table,{children:[(0,i.jsx)(r.thead,{children:(0,i.jsxs)(r.tr,{children:[(0,i.jsx)(r.th,{children:"Property"}),(0,i.jsx)(r.th,{children:"Type"}),(0,i.jsx)(r.th,{children:"Encrypted"}),(0,i.jsx)(r.th,{children:"Notes"})]})}),(0,i.jsxs)(r.tbody,{children:[(0,i.jsxs)(r.tr,{children:[(0,i.jsx)(r.td,{children:(0,i.jsx)(r.code,{children:"id"})}),(0,i.jsx)(r.td,{children:"UUID"}),(0,i.jsx)(r.td,{children:"No"}),(0,i.jsx)(r.td,{children:"Primary key"})]}),(0,i.jsxs)(r.tr,{children:[(0,i.jsx)(r.td,{children:(0,i.jsx)(r.code,{children:"secret_id"})}),(0,i.jsx)(r.td,{children:"FK"}),(0,i.jsx)(r.td,{children:"No"}),(0,i.jsx)(r.td,{children:"The secret being shared"})]}),(0,i.jsxs)(r.tr,{children:[(0,i.jsx)(r.td,{children:(0,i.jsx)(r.code,{children:"token"})}),(0,i.jsx)(r.td,{children:"string"}),(0,i.jsx)(r.td,{children:"No"}),(0,i.jsx)(r.td,{children:"URL-safe random token (\u2265128 bits entropy)"})]}),(0,i.jsxs)(r.tr,{children:[(0,i.jsx)(r.td,{children:(0,i.jsx)(r.code,{children:"encrypted_secret_snapshot"})}),(0,i.jsx)(r.td,{children:"text"}),(0,i.jsx)(r.td,{children:"Yes (AES-256 via Argon2id KDF)"}),(0,i.jsx)(r.td,{children:"Point-in-time snapshot"})]}),(0,i.jsxs)(r.tr,{children:[(0,i.jsx)(r.td,{children:(0,i.jsx)(r.code,{children:"encryption_suite_id"})}),(0,i.jsx)(r.td,{children:"FK"}),(0,i.jsx)(r.td,{children:"No"}),(0,i.jsx)(r.td,{children:"Suite used to encrypt the snapshot"})]}),(0,i.jsxs)(r.tr,{children:[(0,i.jsx)(r.td,{children:(0,i.jsx)(r.code,{children:"usage_limit"})}),(0,i.jsx)(r.td,{children:"int"}),(0,i.jsx)(r.td,{children:"No"}),(0,i.jsx)(r.td,{children:"Max accesses; null = unlimited"})]}),(0,i.jsxs)(r.tr,{children:[(0,i.jsx)(r.td,{children:(0,i.jsx)(r.code,{children:"usage_count"})}),(0,i.jsx)(r.td,{children:"int"}),(0,i.jsx)(r.td,{children:"No"}),(0,i.jsx)(r.td,{children:"Current access count"})]}),(0,i.jsxs)(r.tr,{children:[(0,i.jsx)(r.td,{children:(0,i.jsx)(r.code,{children:"created_at"})}),(0,i.jsx)(r.td,{children:"datetime"}),(0,i.jsx)(r.td,{children:"No"}),(0,i.jsx)(r.td,{children:"\u2014"})]}),(0,i.jsxs)(r.tr,{children:[(0,i.jsx)(r.td,{children:(0,i.jsx)(r.code,{children:"expires_at"})}),(0,i.jsx)(r.td,{children:"datetime"}),(0,i.jsx)(r.td,{children:"No"}),(0,i.jsx)(r.td,{children:"Optional expiry"})]})]})]}),"\n",(0,i.jsxs)(r.p,{children:[(0,i.jsx)(r.strong,{children:"Security:"})," Link password is never stored. Snapshot is encrypted with AES-256 using a key derived from the link password via Argon2id (RFC 9106). After 5 consecutive failed attempts, the link share is permanently deleted."]}),"\n",(0,i.jsx)(r.h4,{id:"secretrequest",children:"SecretRequest"}),"\n",(0,i.jsx)(r.p,{children:"A fill-in link for write-without-read secret submission."}),"\n",(0,i.jsxs)(r.table,{children:[(0,i.jsx)(r.thead,{children:(0,i.jsxs)(r.tr,{children:[(0,i.jsx)(r.th,{children:"Property"}),(0,i.jsx)(r.th,{children:"Type"}),(0,i.jsx)(r.th,{children:"Notes"})]})}),(0,i.jsxs)(r.tbody,{children:[(0,i.jsxs)(r.tr,{children:[(0,i.jsx)(r.td,{children:(0,i.jsx)(r.code,{children:"id"})}),(0,i.jsx)(r.td,{children:"UUID"}),(0,i.jsx)(r.td,{children:"Primary key"})]}),(0,i.jsxs)(r.tr,{children:[(0,i.jsx)(r.td,{children:(0,i.jsx)(r.code,{children:"secret_id"})}),(0,i.jsx)(r.td,{children:"FK (Secret)"}),(0,i.jsx)(r.td,{children:"The unfilled Secret this request writes to"})]}),(0,i.jsxs)(r.tr,{children:[(0,i.jsx)(r.td,{children:(0,i.jsx)(r.code,{children:"encryption_suite_id"})}),(0,i.jsx)(r.td,{children:"FK"}),(0,i.jsx)(r.td,{children:"Public certificate used to encrypt submitted values"})]}),(0,i.jsxs)(r.tr,{children:[(0,i.jsx)(r.td,{children:(0,i.jsx)(r.code,{children:"token"})}),(0,i.jsx)(r.td,{children:"string"}),(0,i.jsx)(r.td,{children:"URL-safe random token (\u2265128 bits entropy)"})]}),(0,i.jsxs)(r.tr,{children:[(0,i.jsx)(r.td,{children:(0,i.jsx)(r.code,{children:"requested_fields"})}),(0,i.jsx)(r.td,{children:"JSON"}),(0,i.jsx)(r.td,{children:"Array of field names being requested"})]}),(0,i.jsxs)(r.tr,{children:[(0,i.jsx)(r.td,{children:(0,i.jsx)(r.code,{children:"status"})}),(0,i.jsx)(r.td,{children:"enum: pending, locked, fulfilled"}),(0,i.jsxs)(r.td,{children:[(0,i.jsx)(r.code,{children:"locked"})," during compromise recovery"]})]}),(0,i.jsxs)(r.tr,{children:[(0,i.jsx)(r.td,{children:(0,i.jsx)(r.code,{children:"expires_at"})}),(0,i.jsx)(r.td,{children:"datetime"}),(0,i.jsx)(r.td,{children:"Optional expiry"})]}),(0,i.jsxs)(r.tr,{children:[(0,i.jsx)(r.td,{children:(0,i.jsx)(r.code,{children:"created_at"})}),(0,i.jsx)(r.td,{children:"datetime"}),(0,i.jsx)(r.td,{children:"\u2014"})]}),(0,i.jsxs)(r.tr,{children:[(0,i.jsx)(r.td,{children:(0,i.jsx)(r.code,{children:"fulfilled_at"})}),(0,i.jsx)(r.td,{children:"datetime"}),(0,i.jsx)(r.td,{children:"\u2014"})]})]})]}),"\n",(0,i.jsx)(r.h4,{id:"suitemigration",children:"SuiteMigration"}),"\n",(0,i.jsx)(r.p,{children:"Tracks compromise recovery migrations."}),"\n",(0,i.jsxs)(r.table,{children:[(0,i.jsx)(r.thead,{children:(0,i.jsxs)(r.tr,{children:[(0,i.jsx)(r.th,{children:"Property"}),(0,i.jsx)(r.th,{children:"Type"}),(0,i.jsx)(r.th,{children:"Notes"})]})}),(0,i.jsxs)(r.tbody,{children:[(0,i.jsxs)(r.tr,{children:[(0,i.jsx)(r.td,{children:(0,i.jsx)(r.code,{children:"id"})}),(0,i.jsx)(r.td,{children:"UUID"}),(0,i.jsx)(r.td,{children:"Primary key"})]}),(0,i.jsxs)(r.tr,{children:[(0,i.jsx)(r.td,{children:(0,i.jsx)(r.code,{children:"old_suite_id"})}),(0,i.jsx)(r.td,{children:"FK (EncryptionSuite)"}),(0,i.jsx)(r.td,{children:"Compromised suite"})]}),(0,i.jsxs)(r.tr,{children:[(0,i.jsx)(r.td,{children:(0,i.jsx)(r.code,{children:"new_suite_id"})}),(0,i.jsx)(r.td,{children:"FK (EncryptionSuite)"}),(0,i.jsx)(r.td,{children:"Replacement suite"})]}),(0,i.jsxs)(r.tr,{children:[(0,i.jsx)(r.td,{children:(0,i.jsx)(r.code,{children:"status"})}),(0,i.jsx)(r.td,{children:"enum: in_progress, completed, completed_with_errors"}),(0,i.jsx)(r.td,{children:"Migration state"})]}),(0,i.jsxs)(r.tr,{children:[(0,i.jsx)(r.td,{children:(0,i.jsx)(r.code,{children:"started_at"})}),(0,i.jsx)(r.td,{children:"datetime"}),(0,i.jsx)(r.td,{children:"\u2014"})]}),(0,i.jsxs)(r.tr,{children:[(0,i.jsx)(r.td,{children:(0,i.jsx)(r.code,{children:"completed_at"})}),(0,i.jsx)(r.td,{children:"datetime"}),(0,i.jsx)(r.td,{children:"Null while in progress"})]})]})]}),"\n",(0,i.jsx)(r.h3,{id:"33-encryption-flow-summary",children:"3.3 Encryption Flow Summary"}),"\n",(0,i.jsx)(r.pre,{children:(0,i.jsx)(r.code,{children:" Master Password (user input, never stored)\n \u2502\n \u25bc\n \u250c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510\n \u2502 KDF (derive) \u2502\n \u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u252c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518\n \u2502\n \u25bc\n AES-Derived Key (stored in session only)\n \u2502\n \u250c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2534\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510\n \u25bc \u25bc\n \u250c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510 \u250c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510\n \u2502 Decrypt \u2502 \u2502 Encrypt \u2502\n \u2502 Private Key \u2502 \u2502 Private Key \u2502\n \u2502 (AES-256) \u2502 \u2502 (AES-256) \u2502\n \u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u252c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518 \u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518\n \u2502\n \u25bc\n Private Key (in memory only)\n \u2502\n \u250c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2534\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510\n \u25bc \u25bc\n\u250c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510 \u250c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510\n\u2502 Decrypt \u2502 \u2502 Encrypt \u2502\n\u2502 Secrets \u2502 \u2502 Secrets \u2502\n\u2502 (RSA-4096) \u2502 \u2502 (RSA-4096) \u2502\n\u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518 \u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518\n"})}),"\n",(0,i.jsxs)(r.p,{children:[(0,i.jsx)(r.strong,{children:"Write-without-read property:"})," Because encryption uses the owner's ",(0,i.jsx)(r.strong,{children:"public"})," certificate (available to anyone), any party can write a secret into another user's or application's vault. Only the private key holder can decrypt \u2014 and the private key requires the master password. This is a direct consequence of asymmetric cryptography and is fundamental to secret requests and application secret management."]}),"\n",(0,i.jsx)(r.h3,{id:"34-nextcloud-integration-strategy",children:"3.4 Nextcloud Integration Strategy"}),"\n",(0,i.jsx)(r.p,{children:(0,i.jsx)(r.strong,{children:"Principle: Doriath handles all encryption and secret storage itself. Nextcloud provides identity, session, notification, and search infrastructure."})}),"\n",(0,i.jsx)(r.h4,{id:"reuse-from-nextcloud",children:"REUSE from Nextcloud"}),"\n",(0,i.jsxs)(r.table,{children:[(0,i.jsx)(r.thead,{children:(0,i.jsxs)(r.tr,{children:[(0,i.jsx)(r.th,{children:"Feature"}),(0,i.jsx)(r.th,{children:"OCP Interface"}),(0,i.jsx)(r.th,{children:"What to Reuse"}),(0,i.jsx)(r.th,{children:"How"})]})}),(0,i.jsxs)(r.tbody,{children:[(0,i.jsxs)(r.tr,{children:[(0,i.jsx)(r.td,{children:(0,i.jsx)(r.strong,{children:"Users"})}),(0,i.jsx)(r.td,{children:(0,i.jsx)(r.code,{children:"OCP\\IUserManager"})}),(0,i.jsx)(r.td,{children:"Authentication identity, vault ownership"}),(0,i.jsx)(r.td,{children:"Reference by Nextcloud user UID"})]}),(0,i.jsxs)(r.tr,{children:[(0,i.jsx)(r.td,{children:(0,i.jsx)(r.strong,{children:"Groups"})}),(0,i.jsx)(r.td,{children:(0,i.jsx)(r.code,{children:"OCP\\IGroupManager"})}),(0,i.jsx)(r.td,{children:"Group sharing, vault_admin role"}),(0,i.jsx)(r.td,{children:"Query group membership for group shares"})]}),(0,i.jsxs)(r.tr,{children:[(0,i.jsx)(r.td,{children:(0,i.jsx)(r.strong,{children:"Session"})}),(0,i.jsx)(r.td,{children:(0,i.jsx)(r.code,{children:"OCP\\ISession"})}),(0,i.jsx)(r.td,{children:"Store AES-derived key during vault session"}),(0,i.jsx)(r.td,{children:(0,i.jsx)(r.code,{children:"ISession::set('doriath_aes_key', $derivedKey)"})})]}),(0,i.jsxs)(r.tr,{children:[(0,i.jsx)(r.td,{children:(0,i.jsx)(r.strong,{children:"Notifications"})}),(0,i.jsx)(r.td,{children:(0,i.jsx)(r.code,{children:"OCP\\Notification\\IManager"})}),(0,i.jsx)(r.td,{children:"Share received, request fulfilled, CA expiry, app approval"}),(0,i.jsxs)(r.td,{children:["Implement ",(0,i.jsx)(r.code,{children:"INotifier"})," for rendering"]})]}),(0,i.jsxs)(r.tr,{children:[(0,i.jsx)(r.td,{children:(0,i.jsx)(r.strong,{children:"Search"})}),(0,i.jsx)(r.td,{children:(0,i.jsx)(r.code,{children:"OCP\\Search\\IProvider"})}),(0,i.jsx)(r.td,{children:"Unified search (Ctrl+F) for secrets by name/URL"}),(0,i.jsx)(r.td,{children:"Query name + url without AES key; deep-link to secret"})]}),(0,i.jsxs)(r.tr,{children:[(0,i.jsx)(r.td,{children:(0,i.jsx)(r.strong,{children:"Settings"})}),(0,i.jsx)(r.td,{children:(0,i.jsx)(r.code,{children:"OCP\\Settings\\ISettings"})}),(0,i.jsx)(r.td,{children:"Admin settings panel (CA health, password policy)"}),(0,i.jsx)(r.td,{children:"Register admin section"})]}),(0,i.jsxs)(r.tr,{children:[(0,i.jsx)(r.td,{children:(0,i.jsx)(r.strong,{children:"App Config"})}),(0,i.jsx)(r.td,{children:(0,i.jsx)(r.code,{children:"OCP\\IAppConfig"})}),(0,i.jsx)(r.td,{children:"App-wide settings (min password length, session timeout)"}),(0,i.jsx)(r.td,{children:"Store admin-configurable values"})]}),(0,i.jsxs)(r.tr,{children:[(0,i.jsx)(r.td,{children:(0,i.jsx)(r.strong,{children:"User Config"})}),(0,i.jsx)(r.td,{children:(0,i.jsx)(r.code,{children:"OCP\\IConfig"})}),(0,i.jsx)(r.td,{children:"Per-user settings (session timeout preference, notification toggles)"}),(0,i.jsx)(r.td,{children:"Store user preferences"})]}),(0,i.jsxs)(r.tr,{children:[(0,i.jsx)(r.td,{children:(0,i.jsx)(r.strong,{children:"User Deletion"})}),(0,i.jsx)(r.td,{children:(0,i.jsx)(r.code,{children:"OCP\\User\\Events\\UserDeletedEvent"})}),(0,i.jsx)(r.td,{children:"Clean up EncryptionSuite, secrets, shares on user delete"}),(0,i.jsx)(r.td,{children:"Event listener"})]}),(0,i.jsxs)(r.tr,{children:[(0,i.jsx)(r.td,{children:(0,i.jsx)(r.strong,{children:"Group Membership"})}),(0,i.jsxs)(r.td,{children:[(0,i.jsx)(r.code,{children:"OCP\\Group\\Events\\UserAddedEvent"})," / ",(0,i.jsx)(r.code,{children:"UserRemovedEvent"})]}),(0,i.jsx)(r.td,{children:"Trigger group share add/revoke"}),(0,i.jsx)(r.td,{children:"Event listeners"})]})]})]}),"\n",(0,i.jsx)(r.h4,{id:"build-in-doriath-security-specific",children:"BUILD in Doriath (Security-specific)"}),"\n",(0,i.jsxs)(r.table,{children:[(0,i.jsx)(r.thead,{children:(0,i.jsxs)(r.tr,{children:[(0,i.jsx)(r.th,{children:"What"}),(0,i.jsx)(r.th,{children:"Why Not Reuse"})]})}),(0,i.jsxs)(r.tbody,{children:[(0,i.jsxs)(r.tr,{children:[(0,i.jsx)(r.td,{children:(0,i.jsx)(r.strong,{children:"EncryptionSuites & CA"})}),(0,i.jsx)(r.td,{children:"Core security model \u2014 no Nextcloud equivalent"})]}),(0,i.jsxs)(r.tr,{children:[(0,i.jsx)(r.td,{children:(0,i.jsx)(r.strong,{children:"Secret storage (encrypted)"})}),(0,i.jsx)(r.td,{children:"Field-level encryption with per-user keys \u2014 cannot use generic storage"})]}),(0,i.jsxs)(r.tr,{children:[(0,i.jsx)(r.td,{children:(0,i.jsx)(r.strong,{children:"Master password session"})}),(0,i.jsx)(r.td,{children:"Custom session management with configurable timeout and tab-close detection"})]}),(0,i.jsxs)(r.tr,{children:[(0,i.jsx)(r.td,{children:(0,i.jsx)(r.strong,{children:"Key generator"})}),(0,i.jsx)(r.td,{children:"Server-side cryptographic randomness with configurable rules"})]}),(0,i.jsxs)(r.tr,{children:[(0,i.jsx)(r.td,{children:(0,i.jsx)(r.strong,{children:"Sharing (user/link/request)"})}),(0,i.jsx)(r.td,{children:"Encryption-aware sharing \u2014 each share is a re-encrypted copy"})]}),(0,i.jsxs)(r.tr,{children:[(0,i.jsx)(r.td,{children:(0,i.jsx)(r.strong,{children:"Suite migration"})}),(0,i.jsx)(r.td,{children:"Compromise recovery with re-encryption \u2014 domain-specific"})]}),(0,i.jsxs)(r.tr,{children:[(0,i.jsx)(r.td,{children:(0,i.jsx)(r.strong,{children:"Application management"})}),(0,i.jsx)(r.td,{children:"CSR processing, approval queue \u2014 domain-specific PKI"})]})]})]}),"\n",(0,i.jsx)(r.h4,{id:"key-ocp-interface-examples",children:"Key OCP Interface Examples"}),"\n",(0,i.jsx)(r.pre,{children:(0,i.jsx)(r.code,{className:"language-php",children:"// Session \u2014 store AES-derived key\n$session = \\OCP\\Server::get(\\OCP\\ISession::class);\n$session->set('doriath_aes_key', $aesKey);\n$session->get('doriath_aes_key'); // retrieve for decryption\n\n// Notifications \u2014 secret shared\n$manager = \\OCP\\Server::get(\\OCP\\Notification\\IManager::class);\n$notification = $manager->createNotification();\n$notification->setApp('doriath')\n ->setUser($recipientId)\n ->setSubject('secret_shared', ['sharer' => $sharerId])\n ->setObject('secret', $secretId);\n$manager->notify($notification);\n\n// Search \u2014 register unified search provider\nclass SecretSearchProvider implements \\OCP\\Search\\IProvider {\n public function search(\\OCP\\IUser $user, \\OCP\\Search\\ISearchQuery $query): SearchResult {\n // Query name + url columns directly \u2014 no AES key needed\n $secrets = $this->secretMapper->searchByNameOrUrl($user->getUID(), $query->getTerm());\n // Return results with deep-link URLs (via lock screen if session inactive)\n }\n}\n\n// User deletion cleanup\nclass UserDeletedListener implements \\OCP\\EventDispatcher\\IEventListener {\n public function handle(\\OCP\\EventDispatcher\\Event $event): void {\n // Delete user's EncryptionSuite, secrets, shares, folders\n }\n}\n\n// Group membership \u2014 auto-revoke group shares\nclass UserRemovedFromGroupListener implements \\OCP\\EventDispatcher\\IEventListener {\n public function handle(\\OCP\\EventDispatcher\\Event $event): void {\n // Delete all SecretShares where group_share_id references a GroupShare for this group\n }\n}\n"})}),"\n",(0,i.jsx)(r.h3,{id:"35-conductionnextcloud-vue-library",children:"3.5 @conduction/nextcloud-vue Library"}),"\n",(0,i.jsxs)(r.p,{children:["Doriath uses its own database (not OpenRegister), so ",(0,i.jsx)(r.strong,{children:"store-level"})," components (",(0,i.jsx)(r.code,{children:"useObjectStore"}),", plugins) do not apply. However, the following ",(0,i.jsx)(r.strong,{children:"UI components and patterns"})," from ",(0,i.jsx)(r.code,{children:"@conduction/nextcloud-vue"})," are used:"]}),"\n",(0,i.jsxs)(r.table,{children:[(0,i.jsx)(r.thead,{children:(0,i.jsxs)(r.tr,{children:[(0,i.jsx)(r.th,{children:"Layer"}),(0,i.jsx)(r.th,{children:"What to Use"}),(0,i.jsx)(r.th,{children:"Purpose"})]})}),(0,i.jsxs)(r.tbody,{children:[(0,i.jsxs)(r.tr,{children:[(0,i.jsx)(r.td,{children:(0,i.jsx)(r.strong,{children:"Components"})}),(0,i.jsxs)(r.td,{children:[(0,i.jsx)(r.code,{children:"CnDataTable"}),", ",(0,i.jsx)(r.code,{children:"CnFilterBar"}),", ",(0,i.jsx)(r.code,{children:"CnStatusBadge"}),", ",(0,i.jsx)(r.code,{children:"CnEmptyState"}),", ",(0,i.jsx)(r.code,{children:"CnPagination"})]}),(0,i.jsx)(r.td,{children:"Consistent list views for secrets, applications, shares"})]}),(0,i.jsxs)(r.tr,{children:[(0,i.jsx)(r.td,{children:(0,i.jsx)(r.strong,{children:"Settings"})}),(0,i.jsxs)(r.td,{children:[(0,i.jsx)(r.code,{children:"CnSettingsSection"}),", ",(0,i.jsx)(r.code,{children:"CnVersionInfoCard"}),", ",(0,i.jsx)(r.code,{children:"CnSettingsCard"})]}),(0,i.jsx)(r.td,{children:"Admin settings page (CA health, password policy, app management)"})]}),(0,i.jsxs)(r.tr,{children:[(0,i.jsx)(r.td,{children:(0,i.jsx)(r.strong,{children:"Detail pages"})}),(0,i.jsxs)(r.td,{children:[(0,i.jsx)(r.code,{children:"CnDetailPage"}),", ",(0,i.jsx)(r.code,{children:"CnDetailCard"}),", ",(0,i.jsx)(r.code,{children:"CnObjectSidebar"})]}),(0,i.jsx)(r.td,{children:"Secret detail view with card-based layout + sidebar (files, notes, tags, audit trail)"})]}),(0,i.jsxs)(r.tr,{children:[(0,i.jsx)(r.td,{children:(0,i.jsx)(r.strong,{children:"CSS"})}),(0,i.jsx)(r.td,{children:"NL Design System double-fallback pattern (cn- prefix)"}),(0,i.jsx)(r.td,{children:"Government theming compliance"})]}),(0,i.jsxs)(r.tr,{children:[(0,i.jsx)(r.td,{children:(0,i.jsx)(r.strong,{children:"Not used"})}),(0,i.jsxs)(r.td,{children:[(0,i.jsx)(r.code,{children:"useObjectStore"}),", ",(0,i.jsx)(r.code,{children:"registerMappingPlugin"}),", ",(0,i.jsx)(r.code,{children:"lifecyclePlugin"}),", ",(0,i.jsx)(r.code,{children:"useListView"}),", ",(0,i.jsx)(r.code,{children:"useDetailView"})]}),(0,i.jsx)(r.td,{children:"These depend on OpenRegister API \u2014 Doriath has its own backend API"})]})]})]}),"\n",(0,i.jsxs)(r.p,{children:["Doriath implements its own Pinia stores (",(0,i.jsx)(r.code,{children:"useSecretStore"}),", ",(0,i.jsx)(r.code,{children:"useEncryptionSuiteStore"}),", ",(0,i.jsx)(r.code,{children:"useApplicationStore"}),", etc.) that call Doriath's REST API instead of the OpenRegister API. The stores follow the same patterns (loading state, pagination, CRUD) but are not derived from ",(0,i.jsx)(r.code,{children:"useObjectStore"}),"."]}),"\n",(0,i.jsxs)(r.p,{children:[(0,i.jsx)(r.strong,{children:"package.json dependency"})," (MUST be present):"]}),"\n",(0,i.jsx)(r.pre,{children:(0,i.jsx)(r.code,{className:"language-json",children:'"@conduction/nextcloud-vue": "^0.1.0-beta.1"\n'})}),"\n",(0,i.jsxs)(r.p,{children:[(0,i.jsx)(r.strong,{children:"Webpack alias"})," (MUST be in webpack.config.js):"]}),"\n",(0,i.jsx)(r.pre,{children:(0,i.jsx)(r.code,{className:"language-js",children:"const fs = require('fs')\nconst localLib = path.resolve(__dirname, '../nextcloud-vue/src')\nconst useLocalLib = fs.existsSync(localLib)\n\n// In resolve.alias:\n...(useLocalLib ? { '@conduction/nextcloud-vue': localLib } : {}),\n'vue$': path.resolve(__dirname, 'node_modules/vue'),\n'pinia$': path.resolve(__dirname, 'node_modules/pinia'),\n'@nextcloud/vue$': path.resolve(__dirname, 'node_modules/@nextcloud/vue'),\n"})}),"\n",(0,i.jsx)(r.h3,{id:"36-vue-router-navigation",children:"3.6 Vue Router (Navigation)"}),"\n",(0,i.jsxs)(r.p,{children:["All navigation uses Vue Router (hash mode). The lock screen is a ",(0,i.jsx)(r.strong,{children:"route guard"})," \u2014 if no AES key is in session, all routes redirect to the lock screen."]}),"\n",(0,i.jsxs)(r.table,{children:[(0,i.jsx)(r.thead,{children:(0,i.jsxs)(r.tr,{children:[(0,i.jsx)(r.th,{children:"Path"}),(0,i.jsx)(r.th,{children:"Name"}),(0,i.jsx)(r.th,{children:"Component"}),(0,i.jsx)(r.th,{children:"Props"})]})}),(0,i.jsxs)(r.tbody,{children:[(0,i.jsxs)(r.tr,{children:[(0,i.jsx)(r.td,{children:(0,i.jsx)(r.code,{children:"/"})}),(0,i.jsx)(r.td,{children:"Dashboard"}),(0,i.jsx)(r.td,{children:"Dashboard"}),(0,i.jsx)(r.td,{children:"\u2014"})]}),(0,i.jsxs)(r.tr,{children:[(0,i.jsx)(r.td,{children:(0,i.jsx)(r.code,{children:"/lock"})}),(0,i.jsx)(r.td,{children:"Lock"}),(0,i.jsx)(r.td,{children:"LockScreen"}),(0,i.jsx)(r.td,{children:(0,i.jsx)(r.code,{children:"route => ({ returnUrl: route.query.returnUrl })"})})]}),(0,i.jsxs)(r.tr,{children:[(0,i.jsx)(r.td,{children:(0,i.jsx)(r.code,{children:"/secrets"})}),(0,i.jsx)(r.td,{children:"Secrets"}),(0,i.jsx)(r.td,{children:"SecretList"}),(0,i.jsx)(r.td,{children:"\u2014"})]}),(0,i.jsxs)(r.tr,{children:[(0,i.jsx)(r.td,{children:(0,i.jsx)(r.code,{children:"/secrets/:id"})}),(0,i.jsx)(r.td,{children:"SecretDetail"}),(0,i.jsx)(r.td,{children:"SecretDetail"}),(0,i.jsx)(r.td,{children:(0,i.jsx)(r.code,{children:"route => ({ secretId: route.params.id })"})})]}),(0,i.jsxs)(r.tr,{children:[(0,i.jsx)(r.td,{children:(0,i.jsx)(r.code,{children:"/folders/:id"})}),(0,i.jsx)(r.td,{children:"FolderView"}),(0,i.jsx)(r.td,{children:"SecretList"}),(0,i.jsx)(r.td,{children:(0,i.jsx)(r.code,{children:"route => ({ folderId: route.params.id })"})})]}),(0,i.jsxs)(r.tr,{children:[(0,i.jsx)(r.td,{children:(0,i.jsx)(r.code,{children:"/applications"})}),(0,i.jsx)(r.td,{children:"Applications"}),(0,i.jsx)(r.td,{children:"ApplicationList"}),(0,i.jsx)(r.td,{children:"\u2014"})]}),(0,i.jsxs)(r.tr,{children:[(0,i.jsx)(r.td,{children:(0,i.jsx)(r.code,{children:"/applications/:id"})}),(0,i.jsx)(r.td,{children:"ApplicationDetail"}),(0,i.jsx)(r.td,{children:"ApplicationDetail"}),(0,i.jsx)(r.td,{children:(0,i.jsx)(r.code,{children:"route => ({ applicationId: route.params.id })"})})]}),(0,i.jsxs)(r.tr,{children:[(0,i.jsx)(r.td,{children:(0,i.jsx)(r.code,{children:"/share/link/:token"})}),(0,i.jsx)(r.td,{children:"LinkShareAccess"}),(0,i.jsx)(r.td,{children:"LinkShareAccess"}),(0,i.jsx)(r.td,{children:(0,i.jsx)(r.code,{children:"route => ({ token: route.params.token })"})})]}),(0,i.jsxs)(r.tr,{children:[(0,i.jsx)(r.td,{children:(0,i.jsx)(r.code,{children:"/share/request/:token"})}),(0,i.jsx)(r.td,{children:"SecretRequestFill"}),(0,i.jsx)(r.td,{children:"SecretRequestFill"}),(0,i.jsx)(r.td,{children:(0,i.jsx)(r.code,{children:"route => ({ token: route.params.token })"})})]}),(0,i.jsxs)(r.tr,{children:[(0,i.jsx)(r.td,{children:(0,i.jsx)(r.code,{children:"*"})}),(0,i.jsx)(r.td,{children:"\u2014"}),(0,i.jsxs)(r.td,{children:["redirect \u2192 ",(0,i.jsx)(r.code,{children:"/"})]}),(0,i.jsx)(r.td,{children:"\u2014"})]})]})]}),"\n",(0,i.jsx)(r.p,{children:(0,i.jsx)(r.strong,{children:"Route guard pattern:"})}),"\n",(0,i.jsx)(r.pre,{children:(0,i.jsx)(r.code,{className:"language-js",children:"router.beforeEach((to, from, next) => {\n // Public routes (link share, request fill-in) skip the lock screen\n if (['LinkShareAccess', 'SecretRequestFill', 'Lock'].includes(to.name)) {\n return next()\n }\n // Check if AES key is in session (API call to backend)\n if (!store.isUnlocked) {\n return next({ name: 'Lock', query: { returnUrl: to.fullPath } })\n }\n next()\n})\n"})}),"\n",(0,i.jsxs)(r.p,{children:["Key files: ",(0,i.jsx)(r.code,{children:"src/router/index.js"}),", registered in ",(0,i.jsx)(r.code,{children:"main.js"}),", ",(0,i.jsx)(r.code,{children:""})," in ",(0,i.jsx)(r.code,{children:"App.vue"}),".\nMainMenu navigation: use ",(0,i.jsx)(r.code,{children:":to"})," prop on ",(0,i.jsx)(r.code,{children:"NcAppNavigationItem"})," (NOT ",(0,i.jsx)(r.code,{children:"@click"})," + ",(0,i.jsx)(r.code,{children:"$router.push()"}),")."]}),"\n",(0,i.jsxs)(r.p,{children:["The MainMenu footer contains two items: ",(0,i.jsx)(r.strong,{children:'"Lock vault"'})," (lock icon \u2014 calls ",(0,i.jsx)(r.code,{children:"session.lock()"})," and navigates to ",(0,i.jsx)(r.code,{children:"/lock"}),") and ",(0,i.jsx)(r.strong,{children:'"Settings"'})," (gear icon \u2014 opens ",(0,i.jsx)(r.code,{children:"NcAppSettingsDialog"})," for user preferences)."]}),"\n",(0,i.jsx)(r.h3,{id:"37-openconnector-integration",children:"3.7 OpenConnector Integration"}),"\n",(0,i.jsxs)(r.p,{children:["Doriath acts as a ",(0,i.jsx)(r.strong,{children:"secret store for OpenConnector"}),". When OpenConnector needs API keys or credentials to connect to external services, it can retrieve them from Doriath's application vault via the API."]}),"\n",(0,i.jsx)(r.p,{children:(0,i.jsx)(r.strong,{children:"Integration pattern:"})}),"\n",(0,i.jsxs)(r.ol,{children:["\n",(0,i.jsx)(r.li,{children:"Register OpenConnector as an Application in Doriath (admin auto-approved)"}),"\n",(0,i.jsx)(r.li,{children:"OpenConnector receives an EncryptionSuite (via generated key pair or CSR)"}),"\n",(0,i.jsx)(r.li,{children:"Admin writes API keys/credentials into OpenConnector's application vault"}),"\n",(0,i.jsxs)(r.li,{children:["OpenConnector retrieves its secrets via Doriath's API using ",(0,i.jsx)(r.code,{children:"X-Vault-Password"})," header"]}),"\n"]}),"\n",(0,i.jsx)(r.p,{children:"This integration is via Doriath's REST API \u2014 no tight coupling or shared database."}),"\n",(0,i.jsx)(r.h2,{id:"4-database-configuration",children:"4. Database Configuration"}),"\n",(0,i.jsx)(r.h3,{id:"doctrine-entities",children:"Doctrine Entities"}),"\n",(0,i.jsxs)(r.p,{children:["All entities use Nextcloud's ",(0,i.jsx)(r.code,{children:"ISchemaWrapper"})," migration pattern. Migrations are stored in ",(0,i.jsx)(r.code,{children:"lib/Migration/"}),"."]}),"\n",(0,i.jsxs)(r.table,{children:[(0,i.jsx)(r.thead,{children:(0,i.jsxs)(r.tr,{children:[(0,i.jsx)(r.th,{children:"Entity"}),(0,i.jsx)(r.th,{children:"Table Name"}),(0,i.jsx)(r.th,{children:"Notes"})]})}),(0,i.jsxs)(r.tbody,{children:[(0,i.jsxs)(r.tr,{children:[(0,i.jsx)(r.td,{children:"EncryptionSuite"}),(0,i.jsx)(r.td,{children:(0,i.jsx)(r.code,{children:"doriath_encryption_suites"})}),(0,i.jsxs)(r.td,{children:["Composite index on ",(0,i.jsx)(r.code,{children:"(owner_type, owner_id)"})]})]}),(0,i.jsxs)(r.tr,{children:[(0,i.jsx)(r.td,{children:"CACertificate"}),(0,i.jsx)(r.td,{children:(0,i.jsx)(r.code,{children:"doriath_ca_certificates"})}),(0,i.jsx)(r.td,{children:"\u2014"})]}),(0,i.jsxs)(r.tr,{children:[(0,i.jsx)(r.td,{children:"Secret"}),(0,i.jsx)(r.td,{children:(0,i.jsx)(r.code,{children:"doriath_secrets"})}),(0,i.jsxs)(r.td,{children:["Index on ",(0,i.jsx)(r.code,{children:"(owner_type, owner_id)"}),", ",(0,i.jsx)(r.code,{children:"folder_id"}),", ",(0,i.jsx)(r.code,{children:"encryption_suite_id"})]})]}),(0,i.jsxs)(r.tr,{children:[(0,i.jsx)(r.td,{children:"SecretType"}),(0,i.jsx)(r.td,{children:(0,i.jsx)(r.code,{children:"doriath_secret_types"})}),(0,i.jsxs)(r.td,{children:["Unique index on ",(0,i.jsx)(r.code,{children:"name"})]})]}),(0,i.jsxs)(r.tr,{children:[(0,i.jsx)(r.td,{children:"Folder"}),(0,i.jsx)(r.td,{children:(0,i.jsx)(r.code,{children:"doriath_folders"})}),(0,i.jsxs)(r.td,{children:["Index on ",(0,i.jsx)(r.code,{children:"(owner_type, owner_id, parent_id)"})]})]}),(0,i.jsxs)(r.tr,{children:[(0,i.jsx)(r.td,{children:"Application"}),(0,i.jsx)(r.td,{children:(0,i.jsx)(r.code,{children:"doriath_applications"})}),(0,i.jsx)(r.td,{children:"\u2014"})]}),(0,i.jsxs)(r.tr,{children:[(0,i.jsx)(r.td,{children:"SecretShare"}),(0,i.jsx)(r.td,{children:(0,i.jsx)(r.code,{children:"doriath_secret_shares"})}),(0,i.jsxs)(r.td,{children:["Index on ",(0,i.jsx)(r.code,{children:"source_secret_id"}),", ",(0,i.jsx)(r.code,{children:"target_user_id"})]})]}),(0,i.jsxs)(r.tr,{children:[(0,i.jsx)(r.td,{children:"GroupShare"}),(0,i.jsx)(r.td,{children:(0,i.jsx)(r.code,{children:"doriath_group_shares"})}),(0,i.jsxs)(r.td,{children:["Index on ",(0,i.jsx)(r.code,{children:"(secret_id, group_id)"})]})]}),(0,i.jsxs)(r.tr,{children:[(0,i.jsx)(r.td,{children:"SecretDelegation"}),(0,i.jsx)(r.td,{children:(0,i.jsx)(r.code,{children:"doriath_secret_delegations"})}),(0,i.jsxs)(r.td,{children:["Index on ",(0,i.jsx)(r.code,{children:"secret_id"})]})]}),(0,i.jsxs)(r.tr,{children:[(0,i.jsx)(r.td,{children:"LinkShare"}),(0,i.jsx)(r.td,{children:(0,i.jsx)(r.code,{children:"doriath_link_shares"})}),(0,i.jsxs)(r.td,{children:["Unique index on ",(0,i.jsx)(r.code,{children:"token"})]})]}),(0,i.jsxs)(r.tr,{children:[(0,i.jsx)(r.td,{children:"SecretRequest"}),(0,i.jsx)(r.td,{children:(0,i.jsx)(r.code,{children:"doriath_secret_requests"})}),(0,i.jsxs)(r.td,{children:["Unique index on ",(0,i.jsx)(r.code,{children:"token"})]})]}),(0,i.jsxs)(r.tr,{children:[(0,i.jsx)(r.td,{children:"SuiteMigration"}),(0,i.jsx)(r.td,{children:(0,i.jsx)(r.code,{children:"doriath_suite_migrations"})}),(0,i.jsx)(r.td,{children:"\u2014"})]})]})]}),"\n",(0,i.jsx)(r.h2,{id:"5-open-research-questions",children:"5. Open Research Questions"}),"\n",(0,i.jsxs)(r.ol,{children:["\n",(0,i.jsxs)(r.li,{children:["\n",(0,i.jsxs)(r.p,{children:[(0,i.jsx)(r.strong,{children:"Application API authentication"})," \u2014 RFC 7523 (JWT Bearer / Private Key JWT) is the lean for how approved applications authenticate to retrieve secrets. Uses existing RSA key infrastructure, short-lived tokens, no new credential. Needs team discussion before finalizing. See ",(0,i.jsx)(r.a,{href:"../openspec/specs/application-mgmt/spec.md",children:"application-mgmt spec"}),"."]}),"\n"]}),"\n",(0,i.jsxs)(r.li,{children:["\n",(0,i.jsxs)(r.p,{children:[(0,i.jsx)(r.strong,{children:"Pagination approach"})," \u2014 50 items per page (standard pagination) or 30 items with dynamic infinite scroll? To be decided during UI design."]}),"\n"]}),"\n",(0,i.jsxs)(r.li,{children:["\n",(0,i.jsxs)(r.p,{children:[(0,i.jsx)(r.strong,{children:"Subfolder cascade"})," \u2014 Does ",(0,i.jsx)(r.code,{children:"?cascade=delete"})," and ",(0,i.jsx)(r.code,{children:"?cascade=move"})," apply recursively to subfolders, or only to direct contents? Unclear whether recursive folder deletion should be allowed."]}),"\n"]}),"\n",(0,i.jsxs)(r.li,{children:["\n",(0,i.jsxs)(r.p,{children:[(0,i.jsx)(r.strong,{children:"Internal application master password"})," \u2014 How does a Nextcloud app running a cronjob authenticate to its Doriath vault? No solution found that doesn't compromise the security model. See Vault-app.docx for full analysis."]}),"\n"]}),"\n",(0,i.jsxs)(r.li,{children:["\n",(0,i.jsxs)(r.p,{children:[(0,i.jsx)(r.strong,{children:"Post-quantum cryptography"})," \u2014 RSA-4096 is vulnerable to future quantum attacks. Post-quantum algorithms are not yet available in stable PHP/OpenSSL. Must be revisited when PHP gains support."]}),"\n"]}),"\n",(0,i.jsxs)(r.li,{children:["\n",(0,i.jsxs)(r.p,{children:[(0,i.jsx)(r.strong,{children:"Forced intermediate revocation and secret compromise"})," \u2014 When an admin force-revokes the intermediate certificate (e.g., leaked key), should all secrets be flagged ",(0,i.jsx)(r.code,{children:"possibly_compromised_at"}),"? The intermediate signs certificates but doesn't directly encrypt secrets. Needs further analysis."]}),"\n"]}),"\n"]}),"\n",(0,i.jsx)(r.h2,{id:"6-references",children:"6. References"}),"\n",(0,i.jsx)(r.h3,{id:"cryptographic-standards",children:"Cryptographic Standards"}),"\n",(0,i.jsxs)(r.ul,{children:["\n",(0,i.jsxs)(r.li,{children:[(0,i.jsx)(r.a,{href:"https://www.rfc-editor.org/rfc/rfc5280.html",children:"RFC 5280 \u2014 X.509 PKI Certificate Profile"})," \u2014 Certificate format and CA chain"]}),"\n",(0,i.jsxs)(r.li,{children:[(0,i.jsx)(r.a,{href:"https://www.rfc-editor.org/rfc/rfc8017.html",children:"RFC 8017 \u2014 PKCS#1 RSA Cryptography"})," \u2014 RSA encryption schemes"]}),"\n",(0,i.jsxs)(r.li,{children:[(0,i.jsx)(r.a,{href:"https://www.rfc-editor.org/rfc/rfc5958.html",children:"RFC 5958 \u2014 PKCS#8 Private Key Info"})," \u2014 Encrypted private key storage"]}),"\n",(0,i.jsxs)(r.li,{children:[(0,i.jsx)(r.a,{href:"https://www.rfc-editor.org/rfc/rfc2986.html",children:"RFC 2986 \u2014 PKCS#10 CSR"})," \u2014 Certificate Signing Request format"]}),"\n",(0,i.jsxs)(r.li,{children:[(0,i.jsx)(r.a,{href:"https://www.rfc-editor.org/rfc/rfc9106.html",children:"RFC 9106 \u2014 Argon2"})," \u2014 Memory-hard KDF"]}),"\n"]}),"\n",(0,i.jsx)(r.h3,{id:"key-management--password-policy",children:"Key Management & Password Policy"}),"\n",(0,i.jsxs)(r.ul,{children:["\n",(0,i.jsxs)(r.li,{children:[(0,i.jsx)(r.a,{href:"https://csrc.nist.gov/pubs/sp/800/57/pt1/r5/final",children:"NIST SP 800-57 Part 1"})," \u2014 Key management recommendations"]}),"\n",(0,i.jsxs)(r.li,{children:[(0,i.jsx)(r.a,{href:"https://pages.nist.gov/800-63-3/sp800-63b.html",children:"NIST SP 800-63B"})," \u2014 Authenticator assurance levels"]}),"\n",(0,i.jsx)(r.li,{children:(0,i.jsx)(r.a,{href:"https://cheatsheetseries.owasp.org/cheatsheets/Password_Storage_Cheat_Sheet.html",children:"OWASP Password Storage Cheat Sheet"})}),"\n",(0,i.jsx)(r.li,{children:(0,i.jsx)(r.a,{href:"https://cheatsheetseries.owasp.org/cheatsheets/Cryptographic_Storage_Cheat_Sheet.html",children:"OWASP Cryptographic Storage Cheat Sheet"})}),"\n",(0,i.jsxs)(r.li,{children:[(0,i.jsx)(r.a,{href:"https://github.com/dropbox/zxcvbn",children:"zxcvbn (Dropbox)"})," \u2014 Password strength estimation"]}),"\n"]}),"\n",(0,i.jsx)(r.h3,{id:"nextcloud-ocp-interfaces",children:"Nextcloud OCP Interfaces"}),"\n",(0,i.jsxs)(r.ul,{children:["\n",(0,i.jsxs)(r.li,{children:[(0,i.jsx)(r.a,{href:"https://docs.nextcloud.com/",children:"OCP\\ISession"})," \u2014 Server-side session storage"]}),"\n",(0,i.jsxs)(r.li,{children:[(0,i.jsx)(r.a,{href:"https://docs.nextcloud.com/",children:"OCP\\Notification\\IManager"})," \u2014 Notification system"]}),"\n",(0,i.jsxs)(r.li,{children:[(0,i.jsx)(r.a,{href:"https://docs.nextcloud.com/",children:"OCP\\Search\\IProvider"})," \u2014 Unified search integration"]}),"\n",(0,i.jsxs)(r.li,{children:[(0,i.jsx)(r.a,{href:"https://docs.nextcloud.com/",children:"OCP\\Settings\\ISettings"})," \u2014 Admin settings registration"]}),"\n"]}),"\n",(0,i.jsx)(r.h3,{id:"architectural-decisions",children:"Architectural Decisions"}),"\n",(0,i.jsxs)(r.ul,{children:["\n",(0,i.jsx)(r.li,{children:(0,i.jsx)(r.a,{href:"../openspec/architecture/adr-001-own-database-tables.md",children:"ADR-001: Own Database Tables"})}),"\n",(0,i.jsx)(r.li,{children:(0,i.jsx)(r.a,{href:"../openspec/architecture/adr-002-polymorphic-encryption-suite-ownership.md",children:"ADR-002: Polymorphic Encryption Suite Ownership"})}),"\n",(0,i.jsx)(r.li,{children:(0,i.jsx)(r.a,{href:"../openspec/architecture/adr-003-rsa-aes-encryption-architecture.md",children:"ADR-003: RSA + AES Encryption Architecture"})}),"\n"]})]})}function a(e={}){const{wrapper:r}={...(0,d.R)(),...e.components};return r?(0,i.jsx)(r,{...e,children:(0,i.jsx)(o,{...e})}):o(e)}}}]);
\ No newline at end of file
diff --git a/docs/build/assets/js/2014.8390c3fa.js b/docs/build/assets/js/2014.8390c3fa.js
deleted file mode 100644
index cb27d6c44..000000000
--- a/docs/build/assets/js/2014.8390c3fa.js
+++ /dev/null
@@ -1 +0,0 @@
-"use strict";(globalThis.webpackChunkdoriath_docs=globalThis.webpackChunkdoriath_docs||[]).push([[2014],{2014(a,e,s){s.d(e,{createTreemapServices:()=>c.d});var c=s(1681);s(9302)}}]);
\ No newline at end of file
diff --git a/docs/build/assets/js/2130.0859056b.js b/docs/build/assets/js/2130.0859056b.js
deleted file mode 100644
index 249d35a5f..000000000
--- a/docs/build/assets/js/2130.0859056b.js
+++ /dev/null
@@ -1 +0,0 @@
-"use strict";(globalThis.webpackChunkdoriath_docs=globalThis.webpackChunkdoriath_docs||[]).push([[2130],{2130(e,t,r){r.d(t,{default:()=>gn});class a extends Error{constructor(e,t){var r,n,i="KaTeX parse error: "+e,o=t&&t.loc;if(o&&o.start<=o.end){var s=o.lexer.input;r=o.start,n=o.end,r===s.length?i+=" at end of input: ":i+=" at position "+(r+1)+": ";var l=s.slice(r,n).replace(/[^]/g,"$&\u0332");i+=(r>15?"\u2026"+s.slice(r-15,r):s.slice(0,r))+l+(n+15e.replace(n,"-$1").toLowerCase(),o={"&":"&",">":">","<":"<",'"':""","'":"'"},s=/[&><"']/g,l=e=>String(e).replace(s,e=>o[e]),h=e=>"ordgroup"===e.type||"color"===e.type?1===e.body.length?h(e.body[0]):e:"font"===e.type?h(e.body):e,m=new Set(["mathord","textord","atom"]),c=e=>m.has(h(e).type),u={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