Ultron/static/js/plugins/D3-dag/d3-dag.0.8.2.min.js

16 lines
85 KiB
JavaScript
Raw Normal View History

2022-01-12 14:39:15 +01:00
// d3-dag Version 0.8.2. Copyright 2021 Erik Brinkman.
var d3 = Object.assign(d3 || {}, (() => {
var d3=(()=>{var li=Object.create;var dt=Object.defineProperty;var hi=Object.getOwnPropertyDescriptor;var fi=Object.getOwnPropertyNames;var ui=Object.getPrototypeOf,ci=Object.prototype.hasOwnProperty;var de=t=>dt(t,"__esModule",{value:!0});var pe=t=>{if(typeof require!="undefined")return require(t);throw new Error('Dynamic require of "'+t+'" is not supported')};var A=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),di=(t,e)=>{de(t);for(var r in e)dt(t,r,{get:e[r],enumerable:!0})},pi=(t,e,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of fi(e))!ci.call(t,i)&&i!=="default"&&dt(t,i,{get:()=>e[i],enumerable:!(r=hi(e,i))||r.enumerable});return t},rt=t=>pi(de(dt(t!=null?li(ui(t)):{},"default",t&&t.__esModule&&"default"in t?{get:()=>t.default,enumerable:!0}:{value:t,enumerable:!0})),t);var ge=A((ln,ve)=>{"use strict";function P(t,e){var e=e||{};this._head=0,this._tail=0,this._capacity=e.capacity,this._capacityMask=3,this._list=new Array(4),Array.isArray(t)&&this._fromArray(t)}P.prototype.peekAt=function(e){var r=e;if(r===(r|0)){var i=this.size();if(!(r>=i||r<-i))return r<0&&(r+=i),r=this._head+r&this._capacityMask,this._list[r]}};P.prototype.get=function(e){return this.peekAt(e)};P.prototype.peek=function(){if(this._head!==this._tail)return this._list[this._head]};P.prototype.peekFront=function(){return this.peek()};P.prototype.peekBack=function(){return this.peekAt(-1)};Object.defineProperty(P.prototype,"length",{get:function(){return this.size()}});P.prototype.size=function(){return this._head===this._tail?0:this._head<this._tail?this._tail-this._head:this._capacityMask+1-(this._head-this._tail)};P.prototype.unshift=function(e){if(e===void 0)return this.size();var r=this._list.length;return this._head=this._head-1+r&this._capacityMask,this._list[this._head]=e,this._tail===this._head&&this._growArray(),this._capacity&&this.size()>this._capacity&&this.pop(),this._head<this._tail?this._tail-this._head:this._capacityMask+1-(this._head-this._tail)};P.prototype.shift=function(){var e=this._head;if(e!==this._tail){var r=this._list[e];return this._list[e]=void 0,this._head=e+1&this._capacityMask,e<2&&this._tail>1e4&&this._tail<=this._list.length>>>2&&this._shrinkArray(),r}};P.prototype.push=function(e){if(e===void 0)return this.size();var r=this._tail;return this._list[r]=e,this._tail=r+1&this._capacityMask,this._tail===this._head&&this._growArray(),this._capacity&&this.size()>this._capacity&&this.shift(),this._head<this._tail?this._tail-this._head:this._capacityMask+1-(this._head-this._tail)};P.prototype.pop=function(){var e=this._tail;if(e!==this._head){var r=this._list.length;this._tail=e-1+r&this._capacityMask;var i=this._list[this._tail];return this._list[this._tail]=void 0,this._head<2&&e>1e4&&e<=r>>>2&&this._shrinkArray(),i}};P.prototype.removeOne=function(e){var r=e;if(r===(r|0)&&this._head!==this._tail){var i=this.size(),n=this._list.length;if(!(r>=i||r<-i)){r<0&&(r+=i),r=this._head+r&this._capacityMask;var s=this._list[r],o;if(e<i/2){for(o=e;o>0;o--)this._list[r]=this._list[r=r-1+n&this._capacityMask];this._list[r]=void 0,this._head=this._head+1+n&this._capacityMask}else{for(o=i-1-e;o>0;o--)this._list[r]=this._list[r=r+1+n&this._capacityMask];this._list[r]=void 0,this._tail=this._tail-1+n&this._capacityMask}return s}}};P.prototype.remove=function(e,r){var i=e,n,s=r;if(i===(i|0)&&this._head!==this._tail){var o=this.size(),a=this._list.length;if(!(i>=o||i<-o||r<1)){if(i<0&&(i+=o),r===1||!r)return n=new Array(1),n[0]=this.removeOne(i),n;if(i===0&&i+r>=o)return n=this.toArray(),this.clear(),n;i+r>o&&(r=o-i);var l;for(n=new Array(r),l=0;l<r;l++)n[l]=this._list[this._head+i+l&this._capacityMask];if(i=this._head+i&this._capacityMask,e+r===o){for(this._tail=this._tail-r+a&this._capacityMask,l=r;l>0;l--)this._list[i=i+1+a&this._capacityMask]=void 0;return n}if(e===0){for(this._head=this._head+r+a&this._capacityMask,l=r-1;l>0;l--)this._list[i=i+1+a&this._capacityMask]=void 0;return n}if(i<o/2){for(this._head=this._head+e+r+a&this._capacityMask,l=e;l>0;l--)this.unshift(this._list[i=i-1+a&this._capacityMask]);for
`));for(var f=0;f<t.length;f++)if(u="__"+f,n=t[f],s=0,o=null,e.is_objective.test(n))r.opType=n.match(/(max|min)/gi)[0],o=n.match(e.parse_lhs).map(function(g){return g.replace(/\s+/,"")}).slice(1),o.forEach(function(g){a=g.match(e.get_num),a===null?g.substr(0,1)==="-"?a=-1:a=1:a=a[0],a=parseFloat(a),l=g.match(e.get_word)[0].replace(/\;$/,""),r.variables[l]=r.variables[l]||{},r.variables[l]._obj=a});else if(e.is_int.test(n))o=n.match(e.parse_int).slice(1),r.ints=r.ints||{},o.forEach(function(g){g=g.replace(";",""),r.ints[g]=1});else if(e.is_bin.test(n))o=n.match(e.parse_bin).slice(1),r.binaries=r.binaries||{},o.forEach(function(g){g=g.replace(";",""),r.binaries[g]=1});else if(e.is_constraint.test(n)){var d=n.indexOf(":"),v=d===-1?n:n.slice(d+1);o=v.match(e.parse_lhs).map(function(g){return g.replace(/\s+/,"")}),o.forEach(function(g){a=g.match(e.get_num),a===null?g.substr(0,1)==="-"?a=-1:a=1:a=a[0],a=parseFloat(a),l=g.match(e.get_word)[0],r.variables[l]=r.variables[l]||{},r.variables[l][u]=a}),h=parseFloat(n.match(e.parse_rhs)[0]),n=i[n.match(e.parse_dir)[0]],r.constraints[u]=r.constraints[u]||{},r.constraints[u][n]=h}else e.is_unrestricted.test(n)&&(o=n.match(e.parse_int).slice(1),r.unrestricted=r.unrestricted||{},o.forEach(function(g){g=g.replace(";",""),r.unrestricted[g]=1}));return r}function Hi(t){if(!t)throw new Error("Solver requires a model to operate on");var e="",r=[],i=1,n={max:"<=",min:">=",equal:"="},s=new RegExp("[^A-Za-z0-9_[{}/.&#$%~'@^]","gi");if(t.opType){e+=t.opType+":";for(var o in t.variables)t.variables[o][o]=t.variables[o][o]?t.variables[o][o]:1,t.variables[o][t.optimize]&&(e+=" "+t.variables[o][t.optimize]+" "+o.replace(s,"_"))}else e+="max:";e+=`;
`;for(var a in t.constraints)for(var l in t.constraints[a])if(typeof n[l]!="undefined"){for(var u in t.variables)typeof t.variables[u][a]!="undefined"&&(e+=" "+t.variables[u][a]+" "+u.replace(s,"_"));e+=" "+n[l]+" "+t.constraints[a][l],e+=`;
`}if(t.ints){e+=`
`;for(var h in t.ints)e+="int "+h.replace(s,"_")+`;
`}if(t.unrestricted){e+=`
`;for(var f in t.unrestricted)e+="unrestricted "+f.replace(s,"_")+`;
`}return e}br.exports=function(t){return t.length?Wi(t):Hi(t)}});var wr=A(ee=>{ee.reformat=Et();function xr(t){return t=t.replace("\\r\\n",`\r
`),t=t.split(`\r
`),t=t.filter(function(e){var r;return r=new RegExp(" 0$","gi"),!(r.test(e)===!0||(r=new RegExp("\\d$","gi"),r.test(e)===!1))}).map(function(e){return e.split(/\:{0,1} +(?=\d)/)}).reduce(function(e,r,i){return e[r[0]]=r[1],e},{}),t}ee.solve=function(t){return new Promise(function(e,r){typeof window!="undefined"&&r("Function Not Available in Browser");var i=Et()(t);t.external||r("Data for this function must be contained in the 'external' attribute. Not seeing anything there."),t.external.binPath||r("No Executable | Binary path provided in arguments as 'binPath'"),t.external.args||r("No arguments array for cli | bash provided on 'args' attribute"),t.external.tempName||r("No 'tempName' given. This is necessary to produce a staging file for the solver to operate on");var n=pe("fs");n.writeFile(t.external.tempName,i,function(s,o){if(s)r(s);else{var a=pe("child_process").execFile;t.external.args.push(t.external.tempName),a(t.external.binPath,t.external.args,function(l,u){if(l)if(l.code===1)e(xr(u));else{var h={"-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"},f={code:l.code,meaning:h[l.code],data:u};r(f)}else e(xr(u))})}})})}});var Ir=A((rs,_r)=>{_r.exports={lpsolve:wr()}});var re=A((is,jr)=>{jr.exports=function(t,e){var r=e.optimize,i=JSON.parse(JSON.stringify(e.optimize)),n=Object.keys(e.optimize),s,o=0,a={},l="",u={},h=[],f,d,v,g,c;for(delete e.optimize,f=0;f<n.length;f++)i[n[f]]=0;for(f=0;f<n.length;f++){e.optimize=n[f],e.opType=r[n[f]],s=t.Solve(e,void 0,void 0,!0);for(g in n)if(!e.variables[n[g]]){s[n[g]]=s[n[g]]?s[n[g]]:0;for(v in e.variables)e.variables[v][n[g]]&&s[v]&&(s[n[g]]+=s[v]*e.variables[v][n[g]])}for(l="base",d=0;d<n.length;d++)s[n[d]]?l+="-"+(s[n[d]]*1e3|0)/1e3:l+="-0";if(!a[l]){for(a[l]=1,o++,d=0;d<n.length;d++)s[n[d]]&&(i[n[d]]+=s[n[d]]);delete s.feasible,delete s.result,h.push(s)}}for(f=0;f<n.length;f++)e.constraints[n[f]]={equal:i[n[f]]/o};e.optimize="cheater-"+Math.random(),e.opType="max";for(f in e.variables)e.variables[f].cheater=1;for(f in h)for(v in h[f])u[v]=u[v]||{min:1e99,max:-1e99};for(f in u)for(v in h)h[v][f]?(h[v][f]>u[f].max&&(u[f].max=h[v][f]),h[v][f]<u[f].min&&(u[f].min=h[v][f])):(h[v][f]=0,u[f].min=0);return s=t.Solve(e,void 0,void 0,!0),{midpoint:s,vertices:h,ranges:u}}});var At=A((ns,Or)=>{var Ji=ur(),ie=gr(),Zi=te(),Vt=Ot(),Mr=yr(),Yi=Vt.Constraint,Xi=Vt.Variable,Ki=Vt.Numeral,Qi=Vt.Term,St=Ir(),qt=function(){"use strict";this.Model=ie,this.branchAndCut=Zi,this.Constraint=Yi,this.Variable=Xi,this.Numeral=Ki,this.Term=Qi,this.Tableau=Ji,this.lastSolvedModel=null,this.External=St,this.Solve=function(t,e,r,i){if(i)for(var n in Mr)t=Mr[n](t);if(!t)throw new Error("Solver requires a model to operate on");if(typeof t.optimize=="object"&&Object.keys(t.optimize>1))return re()(this,t);if(t.external){var s=Object.keys(St);if(s=JSON.stringify(s),!t.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:"+s);if(!St[t.external.solver])throw new Error("No support (yet) for "+t.external.solver+". Please use one of these instead:"+s);return St[t.external.solver].solve(t)}else{t instanceof ie||(t=new ie(e).loadJson(t));var o=t.solve();if(this.lastSolvedModel=t,o.solutionSet=o.generateSolutionSet(),r)return o;var a={};return a.feasible=o.feasible,a.result=o.evaluation,a.bounded=o.bounded,o._tableau.__isIntegral&&(a.isIntegral=!0),Object.keys(o.solutionSet).forEach(function(l){o.solutionSet[l]!==0&&(a[l]=o.solutionSet[l])}),a}},this.ReformatLP=Et(),this.MultiObjective=function(t){return re()(this,t)}};typeof define=="function"?define([],function(){return new qt}):typeof window=="object"?window.solver=new qt:typeof self=="object"&&(self.solver=new qt);Or.exports=new qt});var Lr=A((Ps,Fr)=>{"use strict";var nn=function(t,e){return t<e};function D(t){if(!(this instanceof D))return new D(t);this.array=[],this.size=0,this.compare=t||nn}D.prototype.clone=function(){var t=new D(this
return d3; })())