Jarvis/static/js/plugins/D3-dag/d3-dag_0.11.1.min.js

16 lines
94 KiB
JavaScript
Raw Normal View History

2023-04-25 17:06:14 +02:00
// d3-dag Version 0.11.1. Copyright 2022 Erik Brinkman.
var d3 = Object.assign(d3 || {}, (() => {
var d3=(()=>{var Yn=Object.create;var ge=Object.defineProperty,Xn=Object.defineProperties,eo=Object.getOwnPropertyDescriptor,to=Object.getOwnPropertyDescriptors,ro=Object.getOwnPropertyNames,Ie=Object.getOwnPropertySymbols,no=Object.getPrototypeOf,ct=Object.prototype.hasOwnProperty,Gt=Object.prototype.propertyIsEnumerable;var Ut=(e,t,r)=>t in e?ge(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,A=(e,t)=>{for(var r in t||(t={}))ct.call(t,r)&&Ut(e,r,t[r]);if(Ie)for(var r of Ie(t))Gt.call(t,r)&&Ut(e,r,t[r]);return e},T=(e,t)=>Xn(e,to(t)),qt=e=>ge(e,"__esModule",{value:!0});var B=(e,t)=>{var r={};for(var n in e)ct.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&Ie)for(var n of Ie(e))t.indexOf(n)<0&&Gt.call(e,n)&&(r[n]=e[n]);return r};var _=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),oo=(e,t)=>{for(var r in t)ge(e,r,{get:t[r],enumerable:!0})},jt=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of ro(t))!ct.call(e,o)&&(r||o!=="default")&&ge(e,o,{get:()=>t[o],enumerable:!(n=eo(t,o))||n.enumerable});return e},ft=(e,t)=>jt(qt(ge(e!=null?Yn(no(e)):{},"default",!t&&e&&e.__esModule?{get:()=>e.default,enumerable:!0}:{value:e,enumerable:!0})),e),io=(e=>(t,r)=>e&&e.get(t)||(r=jt(qt({}),t,1),e&&e.set(t,r),r))(typeof WeakMap!="undefined"?new WeakMap:0);var bt=_((Ji,dr)=>{function ur(e,t,r,n){this.feasible=r,this.evaluation=t,this.bounded=n,this._tableau=e}dr.exports=ur;ur.prototype.generateSolutionSet=function(){for(var e={},t=this._tableau,r=t.varIndexByRow,n=t.variablesPerIndex,o=t.matrix,a=t.rhsColumn,i=t.height-1,s=Math.round(1/t.precision),u=1;u<=i;u+=1){var c=r[u],d=n[c];if(!(d===void 0||d.isSlack===!0)){var l=o[u][a];e[d.id]=Math.round((Number.EPSILON+l)*s)/s}}return e}});var fr=_((Ki,cr)=>{var lr=bt();function Re(e,t,r,n,o){lr.call(this,e,t,r,n),this.iter=o}cr.exports=Re;Re.prototype=Object.create(lr.prototype);Re.constructor=Re});var K=_((Yi,pr)=>{var Lo=bt(),So=fr();function ee(e){this.model=null,this.matrix=null,this.width=0,this.height=0,this.costRowIndex=0,this.rhsColumn=0,this.variablesPerIndex=[],this.unrestrictedVars=null,this.feasible=!0,this.evaluation=0,this.simplexIters=0,this.varIndexByRow=null,this.varIndexByCol=null,this.rowByVarIndex=null,this.colByVarIndex=null,this.precision=e||1e-8,this.optionalObjectives=[],this.objectivesByPriority={},this.savedState=null,this.availableIndexes=[],this.lastElementIndex=0,this.variables=null,this.nVars=0,this.bounded=!0,this.unboundedVarIndex=null,this.branchAndCutIterations=0}pr.exports=ee;ee.prototype.solve=function(){return this.model.getNumberOfIntegerVariables()>0?this.branchAndCut():this.simplex(),this.updateVariableValues(),this.getSolution()};function xt(e,t){this.priority=e,this.reducedCosts=new Array(t);for(var r=0;r<t;r+=1)this.reducedCosts[r]=0}xt.prototype.copy=function(){var e=new xt(this.priority,this.reducedCosts.length);return e.reducedCosts=this.reducedCosts.slice(),e};ee.prototype.setOptionalObjective=function(e,t,r){var n=this.objectivesByPriority[e];if(n===void 0){var o=Math.max(this.width,t+1);n=new xt(e,o),this.objectivesByPriority[e]=n,this.optionalObjectives.push(n),this.optionalObjectives.sort(function(a,i){return a.priority-i.priority})}n.reducedCosts[t]=r};ee.prototype.initialize=function(e,t,r,n){this.variables=r,this.unrestrictedVars=n,this.width=e,this.height=t;for(var o=new Array(e),a=0;a<e;a++)o[a]=0;this.matrix=new Array(t);for(var i=0;i<t;i++)this.matrix[i]=o.slice();this.varIndexByRow=new Array(this.height),this.varIndexByCol=new Array(this.width),this.varIndexByRow[0]=-1,this.varIndexByCol[0]=-1,this.nVars=e+t-2,this.rowByVarIndex=new Array(this.nVars),this.colByVarIndex=new Array(this.nVars),this.lastElementIndex=this.nVars};ee.prototype._resetMatrix=function(){var e=this.model.variables,t=this.model.constraints,r=e.length,n=t.length,o,a,i=this.matrix[0],s=this.model.isMinimization===!0?-1:1;for(o=0;o<r;o+=1){var u=e[o],c=u.priority,d=s*u.cost;c===0?i[o+1]=d:this.setOptionalObjective(c,o+1,d),a=e[o].index,this.rowByVarIndex[a]=-1,this.colByVarIndex[a]=o+1,this.varIndexByCol[o+1]=a}for(var
`));for(var l=0;l<e.length;l++)if(c="__"+l,o=e[l],a=0,i=null,t.is_objective.test(o))r.opType=o.match(/(max|min)/gi)[0],i=o.match(t.parse_lhs).map(function(m){return m.replace(/\s+/,"")}).slice(1),i.forEach(function(m){s=m.match(t.get_num),s===null?m.substr(0,1)==="-"?s=-1:s=1:s=s[0],s=parseFloat(s),u=m.match(t.get_word)[0].replace(/\;$/,""),r.variables[u]=r.variables[u]||{},r.variables[u]._obj=s});else if(t.is_int.test(o))i=o.match(t.parse_int).slice(1),r.ints=r.ints||{},i.forEach(function(m){m=m.replace(";",""),r.ints[m]=1});else if(t.is_bin.test(o))i=o.match(t.parse_bin).slice(1),r.binaries=r.binaries||{},i.forEach(function(m){m=m.replace(";",""),r.binaries[m]=1});else if(t.is_constraint.test(o)){var p=o.indexOf(":"),g=p===-1?o:o.slice(p+1);i=g.match(t.parse_lhs).map(function(m){return m.replace(/\s+/,"")}),i.forEach(function(m){s=m.match(t.get_num),s===null?m.substr(0,1)==="-"?s=-1:s=1:s=s[0],s=parseFloat(s),u=m.match(t.get_word)[0],r.variables[u]=r.variables[u]||{},r.variables[u][c]=s}),d=parseFloat(o.match(t.parse_rhs)[0]),o=n[o.match(t.parse_dir)[0]],r.constraints[c]=r.constraints[c]||{},r.constraints[c][o]=d}else t.is_unrestricted.test(o)&&(i=o.match(t.parse_int).slice(1),r.unrestricted=r.unrestricted||{},i.forEach(function(m){m=m.replace(";",""),r.unrestricted[m]=1}));return r}function To(e){if(!e)throw new Error("Solver requires a model to operate on");var t="",r=[],n=1,o={max:"<=",min:">=",equal:"="},a=new RegExp("[^A-Za-z0-9_[{}/.&#$%~'@^]","gi");if(e.opType){t+=e.opType+":";for(var i in e.variables)e.variables[i][i]=e.variables[i][i]?e.variables[i][i]:1,e.variables[i][e.optimize]&&(t+=" "+e.variables[i][e.optimize]+" "+i.replace(a,"_"))}else t+="max:";t+=`;
`;for(var s in e.constraints)for(var u in e.constraints[s])if(typeof o[u]!="undefined"){for(var c in e.variables)typeof e.variables[c][s]!="undefined"&&(t+=" "+e.variables[c][s]+" "+c.replace(a,"_"));t+=" "+o[u]+" "+e.constraints[s][u],t+=`;
`}if(e.ints){t+=`
`;for(var d in e.ints)t+="int "+d.replace(a,"_")+`;
`}if(e.unrestricted){t+=`
`;for(var l in e.unrestricted)t+="unrestricted "+l.replace(a,"_")+`;
`}return t}Pr.exports=function(e){return e.length?Ao(e):To(e)}});var Br=_(()=>{});var _r=_(()=>{});var Rr=_(It=>{It.reformat=je();function Wr(e){return e=e.replace("\\r\\n",`\r
`),e=e.split(`\r
`),e=e.filter(function(t){var r;return r=new RegExp(" 0$","gi"),!(r.test(t)===!0||(r=new RegExp("\\d$","gi"),r.test(t)===!1))}).map(function(t){return t.split(/\:{0,1} +(?=\d)/)}).reduce(function(t,r,n){return t[r[0]]=r[1],t},{}),e}It.solve=function(e){return new Promise(function(t,r){typeof window!="undefined"&&r("Function Not Available in Browser");var n=je()(e);e.external||r("Data for this function must be contained in the 'external' attribute. Not seeing anything there."),e.external.binPath||r("No Executable | Binary path provided in arguments as 'binPath'"),e.external.args||r("No arguments array for cli | bash provided on 'args' attribute"),e.external.tempName||r("No 'tempName' given. This is necessary to produce a staging file for the solver to operate on");var o=Br();o.writeFile(e.external.tempName,n,function(a,i){if(a)r(a);else{var s=_r().execFile;e.external.args.push(e.external.tempName),s(e.external.binPath,e.external.args,function(u,c){if(u)if(u.code===1)t(Wr(c));else{var d={"-2":"Out of Memory","1":"SUBOPTIMAL","2":"INFEASIBLE","3":"UNBOUNDED","4":"DEGENERATE","5":"NUMFAILURE","6":"USER-ABORT","7":"TIMEOUT","9":"PRESOLVED","25":"ACCURACY ERROR","255":"FILE-ERROR"},l={code:u.code,meaning:d[u.code],data:c};r(l)}else t(Wr(c))})}})})}});var Gr=_((Ca,$r)=>{$r.exports={lpsolve:Rr()}});var kt=_((Ia,Ur)=>{Ur.exports=function(e,t){var r=t.optimize,n=JSON.parse(JSON.stringify(t.optimize)),o=Object.keys(t.optimize),a,i=0,s={},u="",c={},d=[],l,p,g,m,f;for(delete t.optimize,l=0;l<o.length;l++)n[o[l]]=0;for(l=0;l<o.length;l++){t.optimize=o[l],t.opType=r[o[l]],a=e.Solve(t,void 0,void 0,!0);for(m in o)if(!t.variables[o[m]]){a[o[m]]=a[o[m]]?a[o[m]]:0;for(g in t.variables)t.variables[g][o[m]]&&a[g]&&(a[o[m]]+=a[g]*t.variables[g][o[m]])}for(u="base",p=0;p<o.length;p++)a[o[p]]?u+="-"+(a[o[p]]*1e3|0)/1e3:u+="-0";if(!s[u]){for(s[u]=1,i++,p=0;p<o.length;p++)a[o[p]]&&(n[o[p]]+=a[o[p]]);delete a.feasible,delete a.result,d.push(a)}}for(l=0;l<o.length;l++)t.constraints[o[l]]={equal:n[o[l]]/i};t.optimize="cheater-"+Math.random(),t.opType="max";for(l in t.variables)t.variables[l].cheater=1;for(l in d)for(g in d[l])c[g]=c[g]||{min:1e99,max:-1e99};for(l in c)for(g in d)d[g][l]?(d[g][l]>c[l].max&&(c[l].max=d[g][l]),d[g][l]<c[l].min&&(c[l].min=d[g][l])):(d[g][l]=0,c[l].min=0);return a=e.Solve(t,void 0,void 0,!0),{midpoint:a,vertices:d,ranges:c}}});var Fr=_((ka,jr)=>{var Eo=Ir(),zt=Tr(),Vo=Ct(),Fe=$e(),qr=Vr(),Po=Fe.Constraint,Bo=Fe.Variable,_o=Fe.Numeral,Wo=Fe.Term,He=Gr(),Ze=function(){"use strict";this.Model=zt,this.branchAndCut=Vo,this.Constraint=Po,this.Variable=Bo,this.Numeral=_o,this.Term=Wo,this.Tableau=Eo,this.lastSolvedModel=null,this.External=He,this.Solve=function(e,t,r,n){if(n)for(var o in qr)e=qr[o](e);if(!e)throw new Error("Solver requires a model to operate on");if(typeof e.optimize=="object"&&Object.keys(e.optimize>1))return kt()(this,e);if(e.external){var a=Object.keys(He);if(a=JSON.stringify(a),!e.external.solver)throw new Error("The model you provided has an 'external' object that doesn't have a solver attribute. Use one of the following:"+a);if(!He[e.external.solver])throw new Error("No support (yet) for "+e.external.solver+". Please use one of these instead:"+a);return He[e.external.solver].solve(e)}else{e instanceof zt||(e=new zt(t).loadJson(e));var i=e.solve();if(this.lastSolvedModel=e,i.solutionSet=i.generateSolutionSet(),r)return i;var s={};return s.feasible=i.feasible,s.result=i.evaluation,s.bounded=i.bounded,i._tableau.__isIntegral&&(s.isIntegral=!0),Object.keys(i.solutionSet).forEach(function(u){i.solutionSet[u]!==0&&(s[u]=i.solutionSet[u])}),s}},this.ReformatLP=je(),this.MultiObjective=function(e){return kt()(this,e)}};typeof define=="function"?define([],function(){return new Ze}):typeof window=="object"?window.solver=new Ze:typeof self=="object"&&(self.solver=new Ze);jr.exports=new Ze});var Yr=_((_a,Kr)=>{"use strict";var Se=1e-60,Qr,Jr;do Se+=Se,Qr=1+.1*Se,Jr=1+.2*Se;while(Qr<=1||Jr<=1);Kr.exports=Se});var en=_((Wa,Xr)=>{"use strict";function $o(e,t,r){let n,o;for(let a=1;a<=r;a+=1){e[a][a]=1/e[a][a],o=-e[a][a
return d3; })())