@ohtaman/washi 0.1.1 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.ja.md +124 -22
- package/README.md +124 -22
- package/README.zh-CN.md +124 -22
- package/dist/browser/browser-runtime-D13gHOT5.js +4189 -0
- package/dist/browser/highs-worker.js +21 -0
- package/dist/{lib/demo → browser}/highs.wasm +0 -0
- package/dist/browser/highs.wasm.LICENSE +22 -0
- package/dist/browser/loader-CVt4CloI.js +58 -0
- package/dist/browser/solvers/glpk.js +1057 -0
- package/dist/browser/solvers/glpk.min.js +1 -0
- package/dist/browser/solvers/z3-built.js +8245 -0
- package/dist/browser/solvers/z3-built.wasm +4 -0
- package/dist/browser/solvers/z3.js +7528 -0
- package/dist/browser/solvers/z3.min.js +5 -0
- package/dist/browser/washi.js +1213 -0
- package/dist/browser/washi.min.js +5 -0
- package/dist/lib/async-mutex-Duo4jwzn.js +195 -0
- package/dist/lib/constraint-XWdn0ID9.js +93 -0
- package/dist/lib/highs-assets.js +1 -0
- package/dist/lib/highs-browser-runtime.js +4189 -0
- package/dist/lib/highs-node-runtime.js +1 -0
- package/dist/lib/highs-worker-factory.js +1 -0
- package/dist/lib/highs-worker.js +21 -0
- package/dist/lib/highs.wasm +0 -0
- package/dist/lib/loader-Dti0v9yC.js +50 -0
- package/dist/lib/registry-DksqCSjI.js +32 -0
- package/dist/lib/solvers/glpk.js +153 -2
- package/dist/lib/solvers/z3-assets.js +1 -0
- package/dist/lib/solvers/z3-built.js +8245 -0
- package/dist/lib/solvers/z3-built.wasm +4 -0
- package/dist/lib/solvers/z3.js +451 -2
- package/dist/lib/washi.js +388 -78
- package/dist/types/index.d.ts +2 -3
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/modeler/index.d.ts +1 -1
- package/dist/types/modeler/index.d.ts.map +1 -1
- package/dist/types/modeler/model.d.ts +1 -1
- package/dist/types/modeler/model.d.ts.map +1 -1
- package/dist/types/modeler/solvers/glpk/index.d.ts +3 -0
- package/dist/types/modeler/solvers/glpk/index.d.ts.map +1 -0
- package/dist/types/modeler/solvers/glpk/loader.d.ts +16 -0
- package/dist/types/modeler/solvers/glpk/loader.d.ts.map +1 -0
- package/dist/types/modeler/solvers/glpk/solver.d.ts +26 -0
- package/dist/types/modeler/solvers/glpk/solver.d.ts.map +1 -0
- package/dist/types/modeler/solvers/glpk.d.ts +1 -21
- package/dist/types/modeler/solvers/glpk.d.ts.map +1 -1
- package/dist/types/modeler/solvers/highs/assets.d.ts +3 -0
- package/dist/types/modeler/solvers/highs/assets.d.ts.map +1 -0
- package/dist/types/modeler/solvers/highs/browser-runtime.d.ts +2 -0
- package/dist/types/modeler/solvers/highs/browser-runtime.d.ts.map +1 -0
- package/dist/types/modeler/solvers/highs/index.d.ts +6 -0
- package/dist/types/modeler/solvers/highs/index.d.ts.map +1 -0
- package/dist/types/{highs-loader.d.ts → modeler/solvers/highs/loader.d.ts} +3 -3
- package/dist/types/modeler/solvers/highs/loader.d.ts.map +1 -0
- package/dist/types/modeler/solvers/highs/node-runtime.d.ts +2 -0
- package/dist/types/modeler/solvers/highs/node-runtime.d.ts.map +1 -0
- package/dist/types/modeler/solvers/highs/solver.d.ts +33 -0
- package/dist/types/modeler/solvers/highs/solver.d.ts.map +1 -0
- package/dist/types/modeler/solvers/highs/worker-client.d.ts +13 -0
- package/dist/types/modeler/solvers/highs/worker-client.d.ts.map +1 -0
- package/dist/types/modeler/solvers/highs/worker-factory.d.ts +3 -0
- package/dist/types/modeler/solvers/highs/worker-factory.d.ts.map +1 -0
- package/dist/types/modeler/solvers/highs/worker.d.ts +2 -0
- package/dist/types/modeler/solvers/highs/worker.d.ts.map +1 -0
- package/dist/types/modeler/solvers/highs.d.ts +1 -25
- package/dist/types/modeler/solvers/highs.d.ts.map +1 -1
- package/dist/types/modeler/solvers/index.d.ts +0 -2
- package/dist/types/modeler/solvers/index.d.ts.map +1 -1
- package/dist/types/modeler/solvers/mock.d.ts +1 -0
- package/dist/types/modeler/solvers/mock.d.ts.map +1 -1
- package/dist/types/modeler/solvers/registry.d.ts +1 -2
- package/dist/types/modeler/solvers/registry.d.ts.map +1 -1
- package/dist/types/modeler/solvers/types.d.ts +1 -1
- package/dist/types/modeler/solvers/types.d.ts.map +1 -1
- package/dist/types/modeler/solvers/z3/assets.d.ts +11 -0
- package/dist/types/modeler/solvers/z3/assets.d.ts.map +1 -0
- package/dist/types/modeler/solvers/z3/index.d.ts +3 -0
- package/dist/types/modeler/solvers/z3/index.d.ts.map +1 -0
- package/dist/types/modeler/solvers/z3/loader.d.ts +44 -0
- package/dist/types/modeler/solvers/z3/loader.d.ts.map +1 -0
- package/dist/types/modeler/solvers/z3/solver.d.ts +34 -0
- package/dist/types/modeler/solvers/z3/solver.d.ts.map +1 -0
- package/dist/types/modeler/solvers/z3.d.ts +1 -36
- package/dist/types/modeler/solvers/z3.d.ts.map +1 -1
- package/package.json +35 -9
- package/dist/lib/assets/highs-worker-DeDWU6KI.js +0 -3
- package/dist/lib/glpk-BC32ZaPG.js +0 -126
- package/dist/lib/washi-logo.png +0 -0
- package/dist/lib/washi-logo.svg +0 -70
- package/dist/lib/z3-C8g-PtmP.js +0 -582
- package/dist/types/glpk-loader.d.ts +0 -8
- package/dist/types/glpk-loader.d.ts.map +0 -1
- package/dist/types/highs-loader.d.ts.map +0 -1
- package/dist/types/highs-worker-client.d.ts +0 -12
- package/dist/types/highs-worker-client.d.ts.map +0 -1
- package/dist/types/highs-worker.d.ts +0 -2
- package/dist/types/highs-worker.d.ts.map +0 -1
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
var Washi=(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var t=Object.create,n=Object.defineProperty,r=Object.getOwnPropertyDescriptor,i=Object.getOwnPropertyNames,a=Object.getPrototypeOf,o=Object.prototype.hasOwnProperty,s=(e,t,n)=>()=>{if(n)throw n[0];try{return e&&(t=e(e=0)),t}catch(e){throw n=[e],e}},c=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports),l=(e,t)=>{let r={};for(var i in e)n(r,i,{get:e[i],enumerable:!0});return t||n(r,Symbol.toStringTag,{value:`Module`}),r},u=(e,t,a,s)=>{if(t&&typeof t==`object`||typeof t==`function`)for(var c=i(t),l=0,u=c.length,d;l<u;l++)d=c[l],!o.call(e,d)&&d!==a&&n(e,d,{get:(e=>t[e]).bind(null,d),enumerable:!(s=r(t,d))||s.enumerable});return e},d=(e,r,i)=>(i=e==null?{}:t(a(e)),u(r||!e||!e.__esModule||!o.call(e,`default`)?n(i,`default`,{value:e,enumerable:!0}):i,e)),f=0,p=class{and(e){return new h(`and`,[this,e])}or(e){return new h(`or`,[this,e])}implies(e){return new h(`implies`,[this,e])}xor(e){return new h(`xor`,[this,e])}not(){return new h(`not`,[this])}},m=class extends p{id;name;value=null;constructor(e){super(),this.id=++f,this.name=e||`p_${this.id}`}toString(){return this.name}},h=class extends p{op;children;constructor(e,t){super(),this.op=e,this.children=t}toString(){return this.op===`not`?`not(${this.children[0].toString()})`:`(${this.children.map(e=>e.toString()).join(` ${this.op} `)})`}};function g(...e){if(e.length===0)throw Error(`and() requires at least one expression`);return new h(`and`,e)}function _(...e){if(e.length===0)throw Error(`or() requires at least one expression`);return new h(`or`,e)}function v(e){return new h(`not`,[e])}function y(e,t){return new h(`implies`,[e,t])}function b(...e){if(e.length===0)throw Error(`xor() requires at least one expression`);return new h(`xor`,e)}var x=0,S=class{id;lhs;sense;rhs;name;slack=null;dual=null;constructor(e,t,n,r){this.id=++x,this.lhs=e,this.sense=t,this.rhs=n,this.name=r||`c_${this.id}`}get pi(){return this.dual}and(e){return new h(`and`,[this,e])}or(e){return new h(`or`,[this,e])}implies(e){return new h(`implies`,[this,e])}xor(e){return new h(`xor`,[this,e])}not(){return new h(`not`,[this])}toString(){let e=this.sense===`==`?`=`:this.sense;return`${this.name}: ${this.lhs.toString()} ${e} ${this.rhs}`}};function C(e,t){let n=e.id,r=t.id;return n<=r?`${n}:${r}`:`${r}:${n}`}var w=class e{linearTerms;quadTerms;constant;constructor(e=new Map,t=new Map,n=0){this.linearTerms=new Map(e),this.quadTerms=new Map;for(let[e,n]of t)this.quadTerms.set(e,{...n});this.constant=n}clone(){return new e(this.linearTerms,this.quadTerms,this.constant)}getQuadCoeff(e,t){let n=C(e,t),r=this.quadTerms.get(n);return r?r.coeff:0}add(t){let n=this.clone();if(typeof t==`number`)return n.constant+=t,n;if(t instanceof e){for(let[e,r]of t.quadTerms){let t=n.quadTerms.get(e),i=(t?t.coeff:0)+r.coeff;Math.abs(i)<1e-12?n.quadTerms.delete(e):n.quadTerms.set(e,{var1:r.var1,var2:r.var2,coeff:i})}for(let[e,r]of t.linearTerms){let t=(n.linearTerms.get(e)||0)+r;Math.abs(t)<1e-12?n.linearTerms.delete(e):n.linearTerms.set(e,t)}return n.constant+=t.constant,n}if(`terms`in t&&t.terms instanceof Map){for(let[e,r]of t.terms){let t=(n.linearTerms.get(e)||0)+r;Math.abs(t)<1e-12?n.linearTerms.delete(e):n.linearTerms.set(e,t)}return n.constant+=t.constant,n}let r=t,i=(n.linearTerms.get(r)||0)+1;return Math.abs(i)<1e-12?n.linearTerms.delete(r):n.linearTerms.set(r,i),n}sub(t){return typeof t==`number`?this.add(-t):t instanceof e?this.add(t.neg()):(`terms`in t&&t.terms instanceof Map,this.add(t.mul(-1)))}mul(t){let n=new e(new Map,new Map,this.constant*t);for(let[e,r]of this.linearTerms){let i=r*t;Math.abs(i)>=1e-12&&n.linearTerms.set(e,i)}for(let[e,r]of this.quadTerms){let i=r.coeff*t;Math.abs(i)>=1e-12&&n.quadTerms.set(e,{var1:r.var1,var2:r.var2,coeff:i})}return n}div(e){if(Math.abs(e)<1e-12)throw Error(`Division by zero in QuadExpr.div()`);return this.mul(1/e)}neg(){return this.mul(-1)}get value(){let e=this.constant;for(let[t,n]of this.linearTerms){if(t.value===null)return null;e+=n*t.value}for(let t of this.quadTerms.values()){if(t.var1.value===null||t.var2.value===null)return null;e+=t.coeff*t.var1.value*t.var2.value}return e}getValue(){return this.value}static fromProduct(t,n,r=1){let i=new e,a=C(t,n);return i.quadTerms.set(a,{var1:t.id<=n.id?t:n,var2:t.id<=n.id?n:t,coeff:r}),i}},T=class e{terms;constant;constructor(e=new Map,t=0){this.terms=new Map(e),this.constant=t}clone(){return new e(this.terms,this.constant)}add(e){if(e instanceof w)return e.add(this);let t=this.clone();if(typeof e==`number`)t.constant+=e;else if(`terms`in e){for(let[n,r]of e.terms){let e=(t.terms.get(n)||0)+r;Math.abs(e)<1e-12?t.terms.delete(n):t.terms.set(n,e)}t.constant+=e.constant}else{let n=(t.terms.get(e)||0)+1;Math.abs(n)<1e-12?t.terms.delete(e):t.terms.set(e,n)}return t}sub(e){return e instanceof w?e.neg().add(this):typeof e==`number`?this.add(-e):(`terms`in e,this.add(e.mul(-1)))}mul(t){if(typeof t==`number`){let n=new e(new Map,this.constant*t);for(let[e,r]of this.terms){let i=r*t;Math.abs(i)>=1e-12&&n.terms.set(e,i)}return n}let n=new w;Math.abs(this.constant)>=1e-12&&n.linearTerms.set(t,this.constant);for(let[e,r]of this.terms)n=n.add(w.fromProduct(e,t,r));return n}div(e){if(Math.abs(e)<1e-12)throw Error(`Division by zero in LinExpr.div()`);return this.mul(1/e)}neg(){return this.mul(-1)}get value(){let e=this.constant;for(let[t,n]of this.terms){if(t.value===null)return null;e+=n*t.value}return e}getValue(){return this.value}le(e,t){return this.toConstraint(`<=`,e,t)}lessThanOrEqual(e,t){return this.le(e,t)}ge(e,t){return this.toConstraint(`>=`,e,t)}greaterThanOrEqual(e,t){return this.ge(e,t)}eq(e,t){return this.toConstraint(`==`,e,t)}equalTo(e,t){return this.eq(e,t)}toConstraint(t,n,r){let i=this.clone(),a=0;typeof n==`number`?a=n:`terms`in n?(i=i.sub(new e(n.terms,0)),a=n.constant):i=i.sub(n);let o=a-i.constant;return i.constant=0,new S(i,t,o,r)}toString(){let e=[],t=!0;for(let[n,r]of this.terms){let i=r>=0?t?``:`+ `:`- `,a=Math.abs(r),o=a===1?``:`${a} `;e.push(`${i}${o}${n.name}`),t=!1}if(this.constant!==0||e.length===0){let n=this.constant>=0?t?``:`+ `:`- `;e.push(`${n}${Math.abs(this.constant)}`)}return e.join(` `)||`0`}};function E(e,t){let n=new Map,r=0,i=0;for(let a of e){let e=t?t(a,i++):a;if(typeof e==`number`)r+=e;else if(e&&typeof e==`object`&&`terms`in e){let t=e;for(let[e,r]of t.terms){let t=n.get(e)||0;n.set(e,t+r)}r+=t.constant}else if(e){let t=e,r=n.get(t)||0;n.set(t,r+1)}}for(let[e,t]of n)Math.abs(t)<1e-12&&n.delete(e);return new T(n,r)}var ee=E,D=E,O=0,k=class e{id;name;type;lb;ub;value=null;reducedCost=null;constructor(e={}){this.id=++O,this.name=e.name||`x_${this.id}`,this.type=e.type||`Continuous`,this.type===`Binary`?(this.lb=0,this.ub=1):(this.lb=e.lb===void 0?0:e.lb,this.ub=e.ub===void 0?1/0:e.ub)}get x(){return this.value}get varValue(){return this.value}mul(t){if(typeof t==`number`)return new T(new Map([[this,t]]),0);if(t instanceof e)return w.fromProduct(this,t,1);let n=new w;Math.abs(t.constant)>=1e-12&&n.linearTerms.set(this,t.constant);for(let[e,r]of t.terms){let t=w.fromProduct(this,e,r);n=n.add(t)}return n}add(e){return e instanceof w?e.add(this):new T(new Map([[this,1]]),0).add(e)}sub(e){return e instanceof w?e.neg().add(this):new T(new Map([[this,1]]),0).sub(e)}neg(){return this.mul(-1)}le(e,t){return new T(new Map([[this,1]]),0).le(e,t)}lessThanOrEqual(e,t){return this.le(e,t)}ge(e,t){return new T(new Map([[this,1]]),0).ge(e,t)}greaterThanOrEqual(e,t){return this.ge(e,t)}eq(e,t){return new T(new Map([[this,1]]),0).eq(e,t)}equalTo(e,t){return this.eq(e,t)}toString(){return this.name}};function A(e){let t=[],n=0,r=e.length;for(;n<r;){let i=e[n];if(/\s/.test(i)){n++;continue}if(i===`+`)t.push({type:`PLUS`,value:`+`}),n++;else if(i===`-`)t.push({type:`MINUS`,value:`-`}),n++;else if(i===`*`)t.push({type:`STAR`,value:`*`}),n++;else if(i===`/`)t.push({type:`SLASH`,value:`/`}),n++;else if(i===`(`)t.push({type:`LPAREN`,value:`(`}),n++;else if(i===`)`)t.push({type:`RPAREN`,value:`)`}),n++;else if(i===`<`||i===`>`||i===`=`){let a=i;n+1<r&&(e[n+1]===`=`||e[n+1]===`<`||e[n+1]===`>`)?(a+=e[n+1],n+=2):n++,t.push({type:`COMP`,value:a})}else if(/[0-9.]/.test(i)){let i=``;for(;n<r&&/[0-9.]/.test(e[n]);)i+=e[n],n++;t.push({type:`NUMBER`,value:i})}else if(/[a-zA-Z_]/.test(i)){let i=``;for(;n<r&&/[a-zA-Z0-9_]/.test(e[n]);)i+=e[n],n++;t.push({type:`IDENT`,value:i})}else throw Error(`Unexpected character '${i}' at position ${n} in: "${e}"`)}return t}var j=class{tokens;pos=0;resolver;constructor(e,t){this.tokens=e,this.resolver=t}peek(){return this.tokens[this.pos]}consume(e){let t=this.tokens[this.pos++];if(!t)throw Error(`Unexpected end of input`);if(e&&t.value!==e&&t.type!==e)throw Error(`Expected '${e}', but found '${t.value}'`);return t}parseExpression(){let e=this.parseTerm();for(;this.pos<this.tokens.length;){let t=this.peek();if(!t)break;if(t.type===`PLUS`)this.consume(),e=e.add(this.parseTerm());else if(t.type===`MINUS`)this.consume(),e=e.sub(this.parseTerm());else break}return e}parseTerm(){let e=this.parseFactor();for(;this.pos<this.tokens.length;){let t=this.peek();if(!t)break;if(t.type===`STAR`){this.consume();let t=this.parseFactor();e=this.multiplyExpressions(e,t)}else if(t.type===`SLASH`){this.consume();let t=this.parseFactor();if(t.terms.size>0)throw Error(`Cannot divide by variable in linear expression`);if(Math.abs(t.constant)<1e-12)throw Error(`Division by zero in expression`);e=e.div(t.constant)}else break}return e}multiplyExpressions(e,t){if(e.terms.size>0&&t.terms.size>0)throw Error(`Multiplication of two variables creates a non-linear term (not allowed in MILP/LP)`);return e.terms.size===0?t.mul(e.constant):e.mul(t.constant)}parseFactor(){let e=this.peek();if(!e)throw Error(`Unexpected end of expression`);if(e.type===`PLUS`)return this.consume(),this.parseFactor();if(e.type===`MINUS`)return this.consume(),this.parseFactor().neg();if(e.type===`NUMBER`){this.consume();let t=parseFloat(e.value);if(this.peek()?.type===`IDENT`){let e=this.consume();return this.resolveVariable(e.value).mul(t)}return new T(new Map,t)}if(e.type===`IDENT`){this.consume();let t=this.resolveVariable(e.value);return new T(new Map([[t,1]]),0)}if(e.type===`LPAREN`){this.consume(`LPAREN`);let e=this.parseExpression();return this.consume(`RPAREN`),e}throw Error(`Unexpected token '${e.value}' in expression`)}resolveVariable(e){let t=this.resolver(e);if(!t)throw Error(`Unknown variable '${e}' in expression`);return t}};function M(e,t){return new j(A(e),t).parseExpression()}function N(e,t,n){let r=e.match(/(<=|>=|==|=<|=>|=)/);if(!r)throw Error(`Constraint must contain a comparison operator (<=, >=, ==, =): "${e}"`);let i=r[0],a=r.index,o=e.substring(0,a).trim(),s=e.substring(a+i.length).trim(),c;if(i===`<=`||i===`=<`)c=`<=`;else if(i===`>=`||i===`=>`)c=`>=`;else if(i===`==`||i===`=`)c=`==`;else throw Error(`Unsupported operator "${i}"`);let l=M(o,t),u=M(s,t);return c===`<=`?l.le(u,n):c===`>=`?l.ge(u,n):l.eq(u,n)}function P(e,t){let n=new Map,r=``;for(let i=0;i<e.length;i++)if(r+=e[i],i<t.length){let e=t[i];if(typeof e==`number`)r+=`(${e})`;else if(e instanceof k){let t=`__v_${i}__`;n.set(t,e),r+=t}else if(e instanceof T){`${i}`,r+=`(${e.toString()})`;for(let[t]of e.terms)n.set(t.name,t)}}return{fullText:r,resolver:e=>n.get(e)}}function F(e,...t){let{fullText:n,resolver:r}=P(e,t);return N(n,r)}function I(e,...t){let{fullText:n,resolver:r}=P(e,t);return/(<=|>=|==|=<|=>|=)/.test(n)?N(n,r):M(n,r)}function L(e,t,n){let r=e.replace(/[^a-zA-Z0-9_]/g,`_`);return/^[0-9]/.test(r)&&(r=`${t}_${r}`),(!r||r.length===0)&&(r=`${t}_${n}`),r}function R(e){let{sense:t,objective:n,constraints:r,variables:i}=e,a=new Map,o=new Map,s=new Map,c=new Set;for(let e of i){let t=L(e.name,`x`,e.id),n=t,r=1;for(;c.has(n);)n=`${t}_${r++}`;c.add(n),o.set(e,n),a.set(n,e)}let l=new Set,u=new Map;for(let e of r){let t=L(e.name,`c`,e.id),n=t,r=1;for(;l.has(n);)n=`${t}_${r++}`;l.add(n),u.set(e,n),s.set(n,e)}let d=[];d.push(t===`Maximize`?`Maximize`:`Minimize`);let f=[],p=!0,m=n instanceof w?n.linearTerms:n.terms;if(m)for(let[e,t]of m){if(Math.abs(t)<1e-12)continue;let n=o.get(e),r=t>=0?p?``:`+ `:`- `,i=Math.abs(t),a=i===1?``:`${i} `;f.push(`${r}${a}${n}`),p=!1}if(n instanceof w&&n.quadTerms.size>0){let e=[],t=!0;for(let r of n.quadTerms.values()){if(Math.abs(r.coeff)<1e-12)continue;let n=2*r.coeff,i=n>=0?t?``:`+ `:`- `,a=Math.abs(n),s=a===1?``:`${a} `,c=o.get(r.var1),l=o.get(r.var2);r.var1===r.var2?e.push(`${i}${s}${c} ^ 2`):e.push(`${i}${s}${c} * ${l}`),t=!1}if(e.length>0){let t=`[ ${e.join(` `)} ] / 2`;f.length>0?f.push(`+`,t):f.push(t)}}let h=f.length>0?f.join(` `):`0`;d.push(` obj: ${h}`),d.push(`Subject To`);for(let e of r){let t=u.get(e),n=[],r=!0;for(let[t,i]of e.lhs.terms){if(Math.abs(i)<1e-12)continue;let e=o.get(t),a=i>=0?r?``:`+ `:`- `,s=Math.abs(i),c=s===1?``:`${s} `;n.push(`${a}${c}${e}`),r=!1}let i=n.length>0?n.join(` `):`0`,a=e.sense===`==`?`=`:e.sense;d.push(` ${t}: ${i} ${a} ${e.rhs}`)}d.push(`Bounds`);let g=[],_=[];for(let e of i){let t=o.get(e);if(e.type===`Binary`){_.push(t);continue}e.type===`Integer`&&g.push(t);let n=e.lb===-1/0,r=e.ub===1/0;n&&r?d.push(` ${t} free`):n&&!r?d.push(` -infinity <= ${t} <= ${e.ub}`):!n&&r?e.lb!==0&&d.push(` ${t} >= ${e.lb}`):d.push(` ${e.lb} <= ${t} <= ${e.ub}`)}if(g.length>0){d.push(`Generals`);for(let e=0;e<g.length;e+=10)d.push(` `+g.slice(e,e+10).join(` `))}if(_.length>0){d.push(`Binary`);for(let e=0;e<_.length;e+=10)d.push(` `+_.slice(e,e+10).join(` `))}return d.push(`End`),{lpString:d.join(`
|
|
2
|
+
`)+`
|
|
3
|
+
`,nameToVar:a,nameToConstraint:s}}var te=Symbol.for(`washi.solverRegistry`),z=Symbol.for(`washi.defaultSolverFactory`),B=globalThis;B[te]||(B[te]=new Map);var V=B[te];function ne(e,t){V.set(e.toLowerCase(),t)}function re(e){if(typeof e==`string`){let t=V.get(e.toLowerCase());if(!t)throw Error(`Solver '${e}' is not registered.`);B[z]=t}else B[z]=typeof e==`function`?e:()=>e}function H(e,t){if(!e){let e=B[z]||V.get(`highs`);if(!e)throw Error(`No default solver available. Available solvers: ${U().join(`, `)}`);return e(t)}if(typeof e==`string`){let n=e.toLowerCase(),r=V.get(n);if(!r)throw Error(n===`glpk`?`Solver 'glpk' not found. Available solvers: ${U().join(`, `)}. Please import '@ohtaman/washi/solvers/glpk' before selecting this solver.`:n===`z3`?`Solver 'z3' not found. Available solvers: ${U().join(`, `)}. Please import '@ohtaman/washi/solvers/z3' before selecting this solver.`:`Solver '${e}' not found. Available solvers: ${U().join(`, `)}`);return r(t)}return e}function U(){return Array.from(V.keys())}var W=typeof document<`u`?document.currentScript?.src:null,ie=W?new URL(`.`,W).href:null;function ae(e){if(!ie)throw Error(`[WaSHI] Load the browser IIFE using an external script src, or use the browser ESM build.`);return new URL(e,ie).href}function oe(){return ae(`highs.wasm`)}var se=c(((e,t)=>{var n=(()=>{var e=globalThis.document?.currentScript?.src;return async function(t={}){var n=t,r=!!globalThis.window,i=!!globalThis.WorkerGlobalScope;let a=n.print,o=n.printErr;n.print=e=>{a&&a(e)},n.printErr=e=>{o&&o(e)};var s=`./this.program`,c=(e,t)=>{throw t};i&&(e=self.location.href);var l=``;function u(e){return n.locateFile?n.locateFile(e,l):l+e}var d,f;if(r||i){try{l=new URL(`.`,e).href}catch{}i&&(f=e=>{var t=new XMLHttpRequest;return t.open(`GET`,e,!1),t.responseType=`arraybuffer`,t.send(null),new Uint8Array(t.response)}),d=async e=>{if(v(e))return new Promise((t,n)=>{var r=new XMLHttpRequest;r.open(`GET`,e,!0),r.responseType=`arraybuffer`,r.onload=()=>{if(r.status==200||r.status==0&&r.response){t(r.response);return}n(r.status)},r.onerror=n,r.send(null)});var t=await fetch(e,{credentials:`same-origin`});if(t.ok)return t.arrayBuffer();throw Error(t.status+` : `+t.url)}}var p=console.log.bind(console),m=console.error.bind(console),h,g=!1,_,v=e=>e.startsWith(`file://`);function y(){return Zt.buffer}function b(){if(!I?.buffer?.resizable){var e=y();I=new Int8Array(e),N=new Int16Array(e),V=new Uint8Array(e),te=new Uint16Array(e),P=new Int32Array(e),z=new Uint32Array(e),L=new Float32Array(e),R=new Float64Array(e),F=new BigInt64Array(e),B=new BigUint64Array(e)}}function x(){var e=n.preRun;e&&(typeof e==`function`&&(e=[e]),H.push(...e)),ne(H)}function S(){!n.noFSInit&&!Q.initialized&&Q.init(),Y.init(),nn.v(),Q.ignorePermissions=!1}function C(){var e=n.postRun;e&&(typeof e==`function`&&(e=[e]),re.push(...e)),ne(re)}function w(e){throw n.onAbort?.(e),e=`Aborted(${e})`,m(e),g=!0,e+=`. Build with -sASSERTIONS for more info.`,new WebAssembly.RuntimeError(e)}var T;function E(){return u(`highs.wasm`)}function ee(e){if(f)return f(e);throw`both async and sync fetching of the wasm failed`}async function D(e){if(!h)try{var t=await d(e);return new Uint8Array(t)}catch{}return ee(e)}async function O(e,t){try{var n=await D(e);return await WebAssembly.instantiate(n,t)}catch(e){m(`failed to asynchronously prepare wasm: ${e}`),w(e)}}async function k(e,t,n){if(!e&&!v(t))try{var r=fetch(t,{credentials:`same-origin`});return await WebAssembly.instantiateStreaming(r,n)}catch(e){m(`wasm streaming compile failed: ${e}`),m(`falling back to ArrayBuffer instantiation`)}return O(t,n)}function A(){return{a:en}}async function j(){function e(e){return nn=e.exports,$t(nn),b(),nn}function t(t){return e(t.instance)}var r=A(),i=n.instantiateWasm;return i?new Promise(t=>{i(r,n=>t(e(n)))}):(T??=E(),t(await k(h,T,r)))}class M{name=`ExitStatus`;constructor(e){this.message=`Program terminated with exit(${e})`,this.status=e}}var N,P,F,I,L,R,te,z,B,V,ne=e=>{for(;e.length>0;)e.shift()(n)},re=[],H=[],U=!0,W=e=>Jt(e),ie=()=>Xt();class ae{constructor(e){this.excPtr=e,this.ptr=e-24}set_type(e){z[this.ptr+4>>2]=e}get_type(){return z[this.ptr+4>>2]}set_destructor(e){z[this.ptr+8>>2]=e}get_destructor(){return z[this.ptr+8>>2]}set_caught(e){e=+!!e,I[this.ptr+12]=e}get_caught(){return I[this.ptr+12]!=0}set_rethrown(e){e=+!!e,I[this.ptr+13]=e}get_rethrown(){return I[this.ptr+13]!=0}init(e,t){this.set_adjusted_ptr(0),this.set_type(e),this.set_destructor(t)}set_adjusted_ptr(e){z[this.ptr+16>>2]=e}get_adjusted_ptr(){return z[this.ptr+16>>2]}}var oe=0,se=(e,t,n)=>{new ae(e).init(t,n),oe++,w()},ce=()=>{var e=P[$.varargs>>2];return $.varargs+=4,e},G=ce,K={isAbs:e=>e.charAt(0)===`/`,splitPath:e=>/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/.exec(e).slice(1),normalizeArray:(e,t)=>{for(var n=0,r=e.length-1;r>=0;r--){var i=e[r];i===`.`?e.splice(r,1):i===`..`?(e.splice(r,1),n++):n&&(e.splice(r,1),n--)}if(t)for(;n;n--)e.unshift(`..`);return e},normalize:e=>{var t=K.isAbs(e),n=e.slice(-1)===`/`;return e=K.normalizeArray(e.split(`/`).filter(e=>!!e),!t).join(`/`),!e&&!t&&(e=`.`),e&&n&&(e+=`/`),(t?`/`:``)+e},dirname:e=>{var t=K.splitPath(e),n=t[0],r=t[1];return!n&&!r?`.`:(r&&=r.slice(0,-1),n+r)},basename:e=>e&&e.match(/([^\/]+|\/)\/*$/)[1],join:(...e)=>K.normalize(e.join(`/`)),join2:(e,t)=>K.normalize(e+`/`+t)},le=()=>e=>(crypto.getRandomValues(e),0),ue=e=>(ue=le())(e),q={resolve:(...e)=>{for(var t=``,n=!1,r=e.length-1;r>=-1&&!n;r--){var i=r>=0?e[r]:Q.cwd();if(typeof i!=`string`)throw TypeError(`Arguments to path.resolve must be strings`);if(!i)return``;t=i+`/`+t,n=K.isAbs(i)}return t=K.normalizeArray(t.split(`/`).filter(e=>!!e),!n).join(`/`),(n?`/`:``)+t||`.`},relative:(e,t)=>{e=q.resolve(e).slice(1),t=q.resolve(t).slice(1);function n(e){for(var t=0;t<e.length&&e[t]===``;t++);for(var n=e.length-1;n>=0&&e[n]===``;n--);return t>n?[]:e.slice(t,n-t+1)}for(var r=n(e.split(`/`)),i=n(t.split(`/`)),a=Math.min(r.length,i.length),o=a,s=0;s<a;s++)if(r[s]!==i[s]){o=s;break}for(var c=[],s=o;s<r.length;s++)c.push(`..`);return c=c.concat(i.slice(o)),c.join(`/`)}},J=globalThis.TextDecoder&&new TextDecoder,de=(e,t,n,r)=>{var i=t+n;if(r)return i;for(;e[t]&&!(t>=i);)++t;return t},fe=(e,t=0,n,r)=>{var i=de(e,t,n,r);if(i-t>16&&e.buffer&&J)return J.decode(e.subarray(t,i));for(var a=``;t<i;){var o=e[t++];if(!(o&128)){a+=String.fromCharCode(o);continue}var s=e[t++]&63;if((o&224)==192){a+=String.fromCharCode((o&31)<<6|s);continue}var c=e[t++]&63;if(o=(o&240)==224?(o&15)<<12|s<<6|c:(o&7)<<18|s<<12|c<<6|e[t++]&63,o<65536)a+=String.fromCharCode(o);else{var l=o-65536;a+=String.fromCharCode(55296|l>>10,56320|l&1023)}}return a},pe=[],me=e=>{for(var t=0,n=0;n<e.length;++n){var r=e.charCodeAt(n);r<=127?t++:r<=2047?t+=2:r>=55296&&r<=57343?(t+=4,++n):t+=3}return t},he=(e,t,n,r)=>{if(!(r>0))return 0;for(var i=n,a=n+r-1,o=0;o<e.length;++o){var s=e.codePointAt(o);if(s<=127){if(n>=a)break;t[n++]=s}else if(s<=2047){if(n+1>=a)break;t[n++]=192|s>>6,t[n++]=128|s&63}else if(s<=65535){if(n+2>=a)break;t[n++]=224|s>>12,t[n++]=128|s>>6&63,t[n++]=128|s&63}else{if(n+3>=a)break;t[n++]=240|s>>18,t[n++]=128|s>>12&63,t[n++]=128|s>>6&63,t[n++]=128|s&63,o++}}return t[n]=0,n-i},ge=(e,t,n)=>{var r=n>0?n:me(e)+1,i=Array(r),a=he(e,i,0,i.length);return t&&(i.length=a),i},_e=()=>{if(!pe.length){var e=null;if(globalThis.window?.prompt&&(e=window.prompt(`Input: `),e!==null&&(e+=`
|
|
4
|
+
`)),!e)return null;pe=ge(e,!0)}return pe.shift()},Y={ttys:[],init(){},shutdown(){},register(e,t){Y.ttys[e]={input:[],output:[],ops:t},Q.registerDevice(e,Y.stream_ops)},stream_ops:{open(e){var t=Y.ttys[e.node.rdev];if(!t)throw new Q.ErrnoError(43);e.tty=t,e.seekable=!1},close(e){e.tty.ops.fsync(e.tty)},fsync(e){e.tty.ops.fsync(e.tty)},read(e,t,n,r,i){if(!e.tty||!e.tty.ops.get_char)throw new Q.ErrnoError(60);for(var a=0,o=0;o<r;o++){var s;try{s=e.tty.ops.get_char(e.tty)}catch{throw new Q.ErrnoError(29)}if(s===void 0&&a===0)throw new Q.ErrnoError(6);if(s==null)break;a++,t[n+o]=s}return a&&(e.node.atime=Date.now()),a},write(e,t,n,r,i){if(!e.tty||!e.tty.ops.put_char)throw new Q.ErrnoError(60);try{for(var a=0;a<r;a++)e.tty.ops.put_char(e.tty,t[n+a])}catch{throw new Q.ErrnoError(29)}return r&&(e.node.mtime=e.node.ctime=Date.now()),a}},default_tty_ops:{get_char(e){return _e()},put_char(e,t){t===null||t===10?(p(fe(e.output)),e.output=[]):t!=0&&e.output.push(t)},fsync(e){e.output?.length>0&&(p(fe(e.output)),e.output=[])},ioctl_tcgets(e){return{c_iflag:25856,c_oflag:5,c_cflag:191,c_lflag:35387,c_cc:[3,28,127,21,4,0,1,0,17,19,26,0,18,15,23,22,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]}},ioctl_tcsets(e,t,n){return 0},ioctl_tiocgwinsz(e){return[24,80]}},default_tty1_ops:{put_char(e,t){t===null||t===10?(m(fe(e.output)),e.output=[]):t!=0&&e.output.push(t)},fsync(e){e.output?.length>0&&(m(fe(e.output)),e.output=[])}}},X=e=>{w()},Z={ops_table:null,mount(e){return Z.createNode(null,`/`,16895,0)},createNode(e,t,n,r){if(Q.isBlkdev(n)||Q.isFIFO(n))throw new Q.ErrnoError(63);Z.ops_table||={dir:{node:{getattr:Z.node_ops.getattr,setattr:Z.node_ops.setattr,lookup:Z.node_ops.lookup,mknod:Z.node_ops.mknod,rename:Z.node_ops.rename,unlink:Z.node_ops.unlink,rmdir:Z.node_ops.rmdir,readdir:Z.node_ops.readdir,symlink:Z.node_ops.symlink},stream:{llseek:Z.stream_ops.llseek}},file:{node:{getattr:Z.node_ops.getattr,setattr:Z.node_ops.setattr},stream:{llseek:Z.stream_ops.llseek,read:Z.stream_ops.read,write:Z.stream_ops.write,mmap:Z.stream_ops.mmap,msync:Z.stream_ops.msync}},link:{node:{getattr:Z.node_ops.getattr,setattr:Z.node_ops.setattr,readlink:Z.node_ops.readlink},stream:{}},chrdev:{node:{getattr:Z.node_ops.getattr,setattr:Z.node_ops.setattr},stream:Q.chrdev_stream_ops}};var i=Q.createNode(e,t,n,r);return Q.isDir(i.mode)?(i.node_ops=Z.ops_table.dir.node,i.stream_ops=Z.ops_table.dir.stream,i.contents={}):Q.isFile(i.mode)?(i.node_ops=Z.ops_table.file.node,i.stream_ops=Z.ops_table.file.stream,i.usedBytes=0,i.contents=Z.emptyFileContents??=new Uint8Array):Q.isLink(i.mode)?(i.node_ops=Z.ops_table.link.node,i.stream_ops=Z.ops_table.link.stream):Q.isChrdev(i.mode)&&(i.node_ops=Z.ops_table.chrdev.node,i.stream_ops=Z.ops_table.chrdev.stream),i.atime=i.mtime=i.ctime=Date.now(),e&&(e.contents[t]=i,e.atime=e.mtime=e.ctime=i.atime),i},getFileDataAsTypedArray(e){return e.contents.subarray(0,e.usedBytes)},expandFileStorage(e,t){var n=e.contents.length;if(!(n>=t)){t=Math.max(t,n*(n<1048576?2:1.125)>>>0),n&&(t=Math.max(t,256));var r=Z.getFileDataAsTypedArray(e);e.contents=new Uint8Array(t),e.contents.set(r)}},resizeFileStorage(e,t){if(e.usedBytes!=t){var n=e.contents;e.contents=new Uint8Array(t),e.contents.set(n.subarray(0,Math.min(t,e.usedBytes))),e.usedBytes=t}},node_ops:{getattr(e){var t={};return t.dev=Q.isChrdev(e.mode)?e.id:1,t.ino=e.id,t.mode=e.mode,t.nlink=1,t.uid=0,t.gid=0,t.rdev=e.rdev,t.size=Q.isDir(e.mode)?4096:Q.isFile(e.mode)?e.usedBytes:Q.isLink(e.mode)?e.link.length:0,t.atime=new Date(e.atime),t.mtime=new Date(e.mtime),t.ctime=new Date(e.ctime),t.blksize=4096,t.blocks=Math.ceil(t.size/t.blksize),t},setattr(e,t){for(let n of[`mode`,`atime`,`mtime`,`ctime`])t[n]!=null&&(e[n]=t[n]);t.size!==void 0&&Z.resizeFileStorage(e,t.size)},lookup(e,t){throw Z.doesNotExistError||(Z.doesNotExistError=new Q.ErrnoError(44),Z.doesNotExistError.stack=`<generic error, no stack>`),Z.doesNotExistError},mknod(e,t,n,r){return Z.createNode(e,t,n,r)},rename(e,t,n){var r;try{r=Q.lookupNode(t,n)}catch{}if(r){if(Q.isDir(e.mode))for(var i in r.contents)throw new Q.ErrnoError(55);Q.hashRemoveNode(r)}delete e.parent.contents[e.name],t.contents[n]=e,e.name=n,t.ctime=t.mtime=e.parent.ctime=e.parent.mtime=Date.now()},unlink(e,t){delete e.contents[t],e.ctime=e.mtime=Date.now()},rmdir(e,t){for(var n in Q.lookupNode(e,t).contents)throw new Q.ErrnoError(55);delete e.contents[t],e.ctime=e.mtime=Date.now()},readdir(e){return[`.`,`..`,...Object.keys(e.contents)]},symlink(e,t,n){var r=Z.createNode(e,t,41471,0);return r.link=n,r},readlink(e){if(!Q.isLink(e.mode))throw new Q.ErrnoError(28);return e.link}},stream_ops:{read(e,t,n,r,i){var a=e.node.contents;if(i>=e.node.usedBytes)return 0;var o=Math.min(e.node.usedBytes-i,r);return t.set(a.subarray(i,i+o),n),o},write(e,t,n,r,i,a){if(t.buffer===I.buffer&&(a=!1),!r)return 0;var o=e.node;return o.mtime=o.ctime=Date.now(),a?(o.contents=t.subarray(n,n+r),o.usedBytes=r):o.usedBytes===0&&i===0?(o.contents=t.slice(n,n+r),o.usedBytes=r):(Z.expandFileStorage(o,i+r),o.contents.set(t.subarray(n,n+r),i),o.usedBytes=Math.max(o.usedBytes,i+r)),r},llseek(e,t,n){var r=t;if(n===1?r+=e.position:n===2&&Q.isFile(e.node.mode)&&(r+=e.node.usedBytes),r<0)throw new Q.ErrnoError(28);return r},mmap(e,t,n,r,i){if(!Q.isFile(e.node.mode))throw new Q.ErrnoError(43);var a,o,s=e.node.contents;if(!(i&2)&&s.buffer===I.buffer)o=!1,a=s.byteOffset;else{if(o=!0,a=X(t),!a)throw new Q.ErrnoError(48);s&&((n>0||n+t<s.length)&&(s=s.subarray?s.subarray(n,n+t):Array.prototype.slice.call(s,n,n+t)),I.set(s,a))}return{ptr:a,allocated:o}},msync(e,t,n,r,i){return Z.stream_ops.write(e,t,0,r,n,!1),0}}},ve=e=>{if(typeof e!=`string`)return e;var t={r:0,"r+":2,w:577,"w+":578,a:1089,"a+":1090}[e];if(t===void 0)throw Error(`Unknown file open mode: ${e}`);return t},ye=e=>(typeof e==`string`&&(e=ge(e,!0)),e.subarray||(e=new Uint8Array(e)),e),be=(e,t)=>{var n=0;return e&&(n|=365),t&&(n|=146),n},xe=async e=>{var t=await d(e);return new Uint8Array(t)},Se=(...e)=>Q.createDataFile(...e),Ce=e=>e,we=null,Te=async()=>we,Ee=0,De=null,Oe=e=>{Ee--,n.monitorRunDependencies?.(Ee),Ee||De()},ke=e=>{Ee||(we=new Promise(e=>De=e)),Ee++,n.monitorRunDependencies?.(Ee)},Ae=[],je=async(e,t)=>{typeof Browser<`u`&&Browser.init();for(var n of Ae)if(n.canHandle(t))return n.handle(e,t);return e},Me=async(e,t,n,r,i,a,o,s)=>{var c=t?q.resolve(K.join2(e,t)):e,l=Ce(`cp ${c}`);ke(l);try{var u=n;typeof n==`string`&&(u=await xe(n)),u=await je(u,c),s?.(),a||Se(e,t,u,r,i,o)}finally{Oe(l)}},Ne=(e,t,n,r,i,a,o,s,c,l)=>{Me(e,t,n,r,i,s,c,l).then(a).catch(o)},Q={root:null,mounts:[],devices:{},streams:[],nextInode:1,nameTable:null,currentPath:`/`,initialized:!1,ignorePermissions:!0,filesystems:null,syncFSRequests:0,ErrnoError:class{name=`ErrnoError`;constructor(e){this.errno=e}},FSStream:class{shared={};get object(){return this.node}set object(e){this.node=e}get isRead(){return(this.flags&2097155)!=1}get isWrite(){return!!(this.flags&2097155)}get isAppend(){return this.flags&1024}get flags(){return this.shared.flags}set flags(e){this.shared.flags=e}get position(){return this.shared.position}set position(e){this.shared.position=e}},FSNode:class{node_ops={};stream_ops={};readMode=365;writeMode=146;mounted=null;constructor(e,t,n,r){e||=this,this.parent=e,this.mount=e.mount,this.id=Q.nextInode++,this.name=t,this.mode=n,this.rdev=r,this.atime=this.mtime=this.ctime=Date.now()}get read(){return(this.mode&this.readMode)===this.readMode}set read(e){e?this.mode|=this.readMode:this.mode&=~this.readMode}get write(){return(this.mode&this.writeMode)===this.writeMode}set write(e){e?this.mode|=this.writeMode:this.mode&=~this.writeMode}get isFolder(){return Q.isDir(this.mode)}get isDevice(){return Q.isChrdev(this.mode)}addListener(e,t=!1){var n={cb:e,exclusive:t},r=this.listeners??=new Set;return r.add(n),{listeners:r,entry:n}}notifyListeners(e){if(this.listeners){var t;for(var n of this.listeners)n.exclusive?(t||=[]).push(n):n.cb(e);if(t){var r=(this.exclTurn||0)%t.length;this.exclTurn=r+1,t[r].cb(e)}}}},lookupPath(e,t={}){if(!e)throw new Q.ErrnoError(44);t.follow_mount??=!0,K.isAbs(e)||(e=Q.cwd()+`/`+e);linkloop:for(var n=0;n<40;n++){for(var r=e.split(`/`).filter(e=>!!e),i=Q.root,a=`/`,o=0;o<r.length;o++){var s=o===r.length-1;if(s&&t.parent)break;if(r[o]!==`.`){if(r[o]===`..`){if(a=K.dirname(a),Q.isRoot(i)){e=a+`/`+r.slice(o+1).join(`/`),n--;continue linkloop}i=i.parent;continue}a=K.join2(a,r[o]);try{i=Q.lookupNode(i,r[o])}catch(e){if(e?.errno===44&&s&&t.noent_okay)return{path:a};throw e}if(Q.isMountpoint(i)&&(!s||t.follow_mount)&&(i=i.mounted.root),Q.isLink(i.mode)&&(!s||t.follow)){if(!i.node_ops.readlink)throw new Q.ErrnoError(52);var c=i.node_ops.readlink(i);K.isAbs(c)||(c=K.dirname(a)+`/`+c),e=c+`/`+r.slice(o+1).join(`/`);continue linkloop}}}return{path:a,node:i}}throw new Q.ErrnoError(32)},getPath(e){for(var t;;){if(Q.isRoot(e)){var n=e.mount.mountpoint;return t?n[n.length-1]===`/`?n+t:`${n}/${t}`:n}t=t?`${e.name}/${t}`:e.name,e=e.parent}},hashName(e,t){for(var n=0,r=0;r<t.length;r++)n=(n<<5)-n+t.charCodeAt(r)|0;return(e+n>>>0)%Q.nameTable.length},hashAddNode(e){var t=Q.hashName(e.parent.id,e.name);e.name_next=Q.nameTable[t],Q.nameTable[t]=e},hashRemoveNode(e){var t=Q.hashName(e.parent.id,e.name);if(Q.nameTable[t]===e)Q.nameTable[t]=e.name_next;else for(var n=Q.nameTable[t];n;){if(n.name_next===e){n.name_next=e.name_next;break}n=n.name_next}},lookupNode(e,t){var n=Q.mayLookup(e);if(n)throw new Q.ErrnoError(n);for(var r=Q.hashName(e.id,t),i=Q.nameTable[r];i;i=i.name_next){var a=i.name;if(i.parent.id===e.id&&a===t)return i}return Q.lookup(e,t)},createNode(e,t,n,r){var i=new Q.FSNode(e,t,n,r);return Q.hashAddNode(i),i},destroyNode(e){Q.hashRemoveNode(e)},isRoot(e){return e===e.parent},isMountpoint(e){return!!e.mounted},isFile(e){return(e&61440)==32768},isDir(e){return(e&61440)==16384},isLink(e){return(e&61440)==40960},isChrdev(e){return(e&61440)==8192},isBlkdev(e){return(e&61440)==24576},isFIFO(e){return(e&61440)==4096},isSocket(e){return(e&49152)==49152},flagsToPermissionString(e){var t=[`r`,`w`,`rw`][e&3];return e&512&&(t+=`w`),t},nodePermissions(e,t){return Q.ignorePermissions?0:t.includes(`r`)&&!(e.mode&292)||t.includes(`w`)&&!(e.mode&146)||t.includes(`x`)&&!(e.mode&73)?2:0},mayLookup(e){return Q.isDir(e.mode)?Q.nodePermissions(e,`x`)||(e.node_ops.lookup?0:2):54},mayCreate(e,t){if(!Q.isDir(e.mode))return 54;try{return Q.lookupNode(e,t),20}catch{}return Q.nodePermissions(e,`wx`)},mayDelete(e,t,n){var r;try{r=Q.lookupNode(e,t)}catch(e){return e.errno}var i=Q.nodePermissions(e,`wx`);if(i)return i;if(n){if(!Q.isDir(r.mode))return 54;if(Q.isRoot(r)||Q.getPath(r)===Q.cwd())return 10}else if(Q.isDir(r.mode))return 31;return 0},mayOpen(e,t){if(!e)return 44;if(Q.isLink(e.mode))return 32;var n=Q.flagsToPermissionString(t);return Q.isDir(e.mode)&&(n!==`r`||t&576)?31:Q.nodePermissions(e,n)},checkOpExists(e,t){if(!e)throw new Q.ErrnoError(t);return e},MAX_OPEN_FDS:4096,nextfd(){for(var e=0;e<=Q.MAX_OPEN_FDS;e++)if(!Q.streams[e])return e;throw new Q.ErrnoError(33)},getStreamChecked(e){var t=Q.getStream(e);if(!t)throw new Q.ErrnoError(8);return t},getStream:e=>Q.streams[e],createStream(e,t=-1){return e=Object.assign(new Q.FSStream,e),t==-1&&(t=Q.nextfd()),e.fd=t,Q.streams[t]=e,e},closeStream(e){Q.streams[e]=null},dupStream(e,t=-1){var n=Q.createStream(e,t);return n.stream_ops?.dup?.(n),n},doSetAttr(e,t,n){var r=e?.stream_ops.setattr,i=r?e:t;r??=t.node_ops.setattr,Q.checkOpExists(r,63);try{r(i,n)}catch(e){throw e instanceof RangeError?new Q.ErrnoError(22):e}},chrdev_stream_ops:{open(e){e.stream_ops=Q.getDevice(e.node.rdev).stream_ops,e.stream_ops.open?.(e)},llseek(){throw new Q.ErrnoError(70)}},major:e=>e>>8,minor:e=>e&255,makedev:(e,t)=>e<<8|t,registerDevice(e,t){Q.devices[e]={stream_ops:t}},getDevice:e=>Q.devices[e],getMounts(e){for(var t=[],n=[e];n.length;){var r=n.pop();t.push(r),n.push(...r.mounts)}return t},syncfs(e,t){typeof e==`function`&&(t=e,e=!1),Q.syncFSRequests++,Q.syncFSRequests>1&&m(`warning: ${Q.syncFSRequests} FS.syncfs operations in flight at once, probably just doing extra work`);var n=Q.getMounts(Q.root.mount),r=0;function i(e){return Q.syncFSRequests--,t(e)}function a(e){if(e)return a.errored?void 0:(a.errored=!0,i(e));++r>=n.length&&i(null)}for(var o of n)o.type.syncfs?o.type.syncfs(o,e,a):a(null)},mount(e,t,n){var r=n===`/`,i=!n,a;if(r&&Q.root)throw new Q.ErrnoError(10);if(!r&&!i){var o=Q.lookupPath(n,{follow_mount:!1});if(n=o.path,a=o.node,Q.isMountpoint(a))throw new Q.ErrnoError(10);if(!Q.isDir(a.mode))throw new Q.ErrnoError(54)}var s={type:e,opts:t,mountpoint:n,mounts:[]},c=e.mount(s);return c.mount=s,s.root=c,r?Q.root=c:a&&(a.mounted=s,a.mount&&a.mount.mounts.push(s)),c},unmount(e){var t=Q.lookupPath(e,{follow_mount:!1});if(!Q.isMountpoint(t.node))throw new Q.ErrnoError(28);var n=t.node,r=n.mounted,i=Q.getMounts(r);for(var[a,o]of Object.entries(Q.nameTable))for(;o;){var s=o.name_next;i.includes(o.mount)&&Q.destroyNode(o),o=s}n.mounted=null;var c=n.mount.mounts.indexOf(r);n.mount.mounts.splice(c,1)},lookup(e,t){return e.node_ops.lookup(e,t)},mknod(e,t,n){var r=Q.lookupPath(e,{parent:!0}).node,i=K.basename(e);if(!i)throw new Q.ErrnoError(28);if(i===`.`||i===`..`)throw new Q.ErrnoError(20);var a=Q.mayCreate(r,i);if(a)throw new Q.ErrnoError(a);if(!r.node_ops.mknod)throw new Q.ErrnoError(63);return r.node_ops.mknod(r,i,t,n)},statfs(e){return Q.statfsNode(Q.lookupPath(e,{follow:!0}).node)},statfsStream(e){return Q.statfsNode(e.node)},statfsNode(e){var t={bsize:4096,frsize:4096,blocks:1e6,bfree:5e5,bavail:5e5,files:Q.nextInode,ffree:Q.nextInode-1,fsid:42,flags:2,namelen:255};return e.node_ops.statfs&&Object.assign(t,e.node_ops.statfs(e.mount.opts.root)),t},create(e,t=438){return t&=4095,t|=32768,Q.mknod(e,t,0)},mkdir(e,t=511){return t&=1023,t|=16384,Q.mknod(e,t,0)},mkdirTree(e,t){var n=e.split(`/`),r=``;for(var i of n)if(i){(r||K.isAbs(e))&&(r+=`/`),r+=i;try{Q.mkdir(r,t)}catch(e){if(e.errno!=20)throw e}}},mkdev(e,t,n){return n===void 0&&(n=t,t=438),t|=8192,Q.mknod(e,t,n)},symlink(e,t){if(!q.resolve(e))throw new Q.ErrnoError(44);var n=Q.lookupPath(t,{parent:!0}).node;if(!n)throw new Q.ErrnoError(44);var r=K.basename(t),i=Q.mayCreate(n,r);if(i)throw new Q.ErrnoError(i);if(!n.node_ops.symlink)throw new Q.ErrnoError(63);return n.node_ops.symlink(n,r,e)},link(e,t,n){var r=Q.lookupPath(t,{parent:!0}).node;if(!r)throw new Q.ErrnoError(44);var i=K.basename(t),a=Q.mayCreate(r,i);if(a)throw new Q.ErrnoError(a);if(!r.node_ops.link)throw new Q.ErrnoError(34);return r.node_ops.link(r,i,e,n)},rename(e,t){var n=K.dirname(e),r=K.dirname(t),i=K.basename(e),a=K.basename(t),o=Q.lookupPath(e,{parent:!0}),s=o.node,c;if(o=Q.lookupPath(t,{parent:!0}),c=o.node,!s||!c)throw new Q.ErrnoError(44);if(s.mount!==c.mount)throw new Q.ErrnoError(75);var l=Q.lookupNode(s,i),u=q.relative(e,r);if(u.charAt(0)!==`.`)throw new Q.ErrnoError(28);if(u=q.relative(t,n),u.charAt(0)!==`.`)throw new Q.ErrnoError(55);var d;try{d=Q.lookupNode(c,a)}catch{}if(l!==d){var f=Q.isDir(l.mode),p=Q.mayDelete(s,i,f);if(p||(p=d?Q.mayDelete(c,a,f):Q.mayCreate(c,a),p))throw new Q.ErrnoError(p);if(!s.node_ops.rename)throw new Q.ErrnoError(63);if(Q.isMountpoint(l)||d&&Q.isMountpoint(d))throw new Q.ErrnoError(10);if(c!==s&&(p=Q.nodePermissions(s,`w`),p))throw new Q.ErrnoError(p);Q.hashRemoveNode(l);try{s.node_ops.rename(l,c,a),l.parent=c}catch(e){throw e}finally{Q.hashAddNode(l)}}},rmdir(e){var t=Q.lookupPath(e,{parent:!0}).node,n=K.basename(e),r=Q.lookupNode(t,n),i=Q.mayDelete(t,n,!0);if(i)throw new Q.ErrnoError(i);if(!t.node_ops.rmdir)throw new Q.ErrnoError(63);if(Q.isMountpoint(r))throw new Q.ErrnoError(10);t.node_ops.rmdir(t,n),Q.destroyNode(r)},readdir(e){var t=Q.lookupPath(e,{follow:!0}).node;return Q.checkOpExists(t.node_ops.readdir,54)(t)},unlink(e){var t=Q.lookupPath(e,{parent:!0}).node;if(!t)throw new Q.ErrnoError(44);var n=K.basename(e),r=Q.lookupNode(t,n),i=Q.mayDelete(t,n,!1);if(i)throw new Q.ErrnoError(i);if(!t.node_ops.unlink)throw new Q.ErrnoError(63);if(Q.isMountpoint(r))throw new Q.ErrnoError(10);t.node_ops.unlink(t,n),Q.destroyNode(r)},readlink(e){var t=Q.lookupPath(e).node;if(!t)throw new Q.ErrnoError(44);if(!t.node_ops.readlink)throw new Q.ErrnoError(28);return t.node_ops.readlink(t)},stat(e,t){var n=Q.lookupPath(e,{follow:!t}).node;return Q.checkOpExists(n.node_ops.getattr,63)(n)},fstat(e){var t=Q.getStreamChecked(e),n=t.node,r=t.stream_ops.getattr,i=r?t:n;return r??=n.node_ops.getattr,Q.checkOpExists(r,63),r(i)},lstat(e){return Q.stat(e,!0)},doChmod(e,t,n,r){Q.doSetAttr(e,t,{mode:n&4095|t.mode&-4096,ctime:Date.now(),dontFollow:r})},chmod(e,t,n){var r=typeof e==`string`?Q.lookupPath(e,{follow:!n}).node:e;Q.doChmod(null,r,t,n)},lchmod(e,t){Q.chmod(e,t,!0)},fchmod(e,t){var n=Q.getStreamChecked(e);Q.doChmod(n,n.node,t,!1)},doChown(e,t,n){Q.doSetAttr(e,t,{timestamp:Date.now(),dontFollow:n})},chown(e,t,n,r){var i=typeof e==`string`?Q.lookupPath(e,{follow:!r}).node:e;Q.doChown(null,i,r)},lchown(e,t,n){Q.chown(e,t,n,!0)},fchown(e,t,n){var r=Q.getStreamChecked(e);Q.doChown(r,r.node,!1)},doTruncate(e,t,n){if(Q.isDir(t.mode))throw new Q.ErrnoError(31);if(!Q.isFile(t.mode))throw new Q.ErrnoError(28);var r=Q.nodePermissions(t,`w`);if(r)throw new Q.ErrnoError(r);Q.doSetAttr(e,t,{size:n,timestamp:Date.now()})},truncate(e,t){if(t<0)throw new Q.ErrnoError(28);var n=typeof e==`string`?Q.lookupPath(e,{follow:!0}).node:e;Q.doTruncate(null,n,t)},ftruncate(e,t){var n=Q.getStreamChecked(e);if(t<0||!(n.flags&2097155))throw new Q.ErrnoError(28);Q.doTruncate(n,n.node,t)},utime(e,t,n,r){var i=Q.lookupPath(e,{follow:!r});Q.doSetAttr(null,i.node,{atime:t,mtime:n,dontFollow:r})},open(e,t,n=438){if(e===``)throw new Q.ErrnoError(44);t=ve(t),n=t&64?n&4095|32768:0;var r,i;if(typeof e==`object`)r=e;else{i=e.endsWith(`/`);var a=Q.lookupPath(e,{follow:!(t&131072),noent_okay:!0});r=a.node,e=a.path}var o=!1;if(t&64){if(r){if(t&128)throw new Q.ErrnoError(20)}else if(i)throw new Q.ErrnoError(31);else r=Q.mknod(e,n|511,0),o=!0}if(!r)throw new Q.ErrnoError(44);if(Q.isChrdev(r.mode)&&(t&=-513),t&65536&&!Q.isDir(r.mode))throw new Q.ErrnoError(54);if(!o){var s=Q.mayOpen(r,t);if(s)throw new Q.ErrnoError(s)}t&512&&!o&&Q.truncate(r,0),t&=-131713;var c=Q.createStream({node:r,path:Q.getPath(r),flags:t,seekable:!0,position:0,stream_ops:r.stream_ops,ungotten:[],error:!1});return c.stream_ops.open&&c.stream_ops.open(c),o&&Q.chmod(r,n&511),c},close(e){if(Q.isClosed(e))throw new Q.ErrnoError(8);e.getdents&&=null,e.node?.notifyListeners(32);try{e.stream_ops.close&&e.stream_ops.close(e)}catch(e){throw e}finally{Q.closeStream(e.fd)}e.fd=null},isClosed(e){return e.fd===null},llseek(e,t,n){if(Q.isClosed(e))throw new Q.ErrnoError(8);if(!e.seekable||!e.stream_ops.llseek)throw new Q.ErrnoError(70);if(n!=0&&n!=1&&n!=2)throw new Q.ErrnoError(28);return e.position=e.stream_ops.llseek(e,t,n),e.ungotten=[],e.position},read(e,t,n,r,i){if(r<0||i<0)throw new Q.ErrnoError(28);if(Q.isClosed(e)||(e.flags&2097155)==1)throw new Q.ErrnoError(8);if(Q.isDir(e.node.mode))throw new Q.ErrnoError(31);if(!e.stream_ops.read)throw new Q.ErrnoError(28);var a=i!==void 0;if(!a)i=e.position;else if(!e.seekable)throw new Q.ErrnoError(70);var o=e.stream_ops.read(e,t,n,r,i);return a||(e.position+=o),o},write(e,t,n,r,i,a){if(r<0||i<0)throw new Q.ErrnoError(28);if(Q.isClosed(e)||!(e.flags&2097155))throw new Q.ErrnoError(8);if(Q.isDir(e.node.mode))throw new Q.ErrnoError(31);if(!e.stream_ops.write)throw new Q.ErrnoError(28);e.seekable&&e.flags&1024&&Q.llseek(e,0,2);var o=i!==void 0;if(!o)i=e.position;else if(!e.seekable)throw new Q.ErrnoError(70);var s=e.stream_ops.write(e,t,n,r,i,a);return o||(e.position+=s),s},mmap(e,t,n,r,i){if(r&2&&!(i&2)&&(e.flags&2097155)!=2||(e.flags&2097155)==1)throw new Q.ErrnoError(2);if(!e.stream_ops.mmap)throw new Q.ErrnoError(43);if(!t)throw new Q.ErrnoError(28);return e.stream_ops.mmap(e,t,n,r,i)},msync(e,t,n,r,i){return e.stream_ops.msync?e.stream_ops.msync(e,t,n,r,i):0},ioctl(e,t,n){if(!e.stream_ops.ioctl)throw new Q.ErrnoError(59);return e.stream_ops.ioctl(e,t,n)},readFile(e,t={}){t.flags=t.flags??0,t.encoding=t.encoding??`binary`,t.encoding!==`utf8`&&t.encoding!==`binary`&&w(`Invalid encoding type "${t.encoding}"`);var n=Q.open(e,t.flags),r=Q.stat(e).size,i=new Uint8Array(r);return Q.read(n,i,0,r,0),t.encoding===`utf8`&&(i=fe(i)),Q.close(n),i},writeFile(e,t,n={}){n.flags=n.flags??577;var r=Q.open(e,n.flags,n.mode);t=ye(t),Q.write(r,t,0,t.byteLength,void 0,n.canOwn),Q.close(r)},cwd:()=>Q.currentPath,chdir(e){var t=Q.lookupPath(e,{follow:!0});if(t.node===null)throw new Q.ErrnoError(44);if(!Q.isDir(t.node.mode))throw new Q.ErrnoError(54);var n=Q.nodePermissions(t.node,`x`);if(n)throw new Q.ErrnoError(n);Q.currentPath=t.path},createDefaultDirectories(){Q.mkdir(`/tmp`),Q.mkdir(`/home`),Q.mkdir(`/home/web_user`)},createDefaultDevices(){Q.mkdir(`/dev`),Q.registerDevice(Q.makedev(1,3),{read:()=>0,write:(e,t,n,r,i)=>r,llseek:()=>0}),Q.mkdev(`/dev/null`,Q.makedev(1,3)),Y.register(Q.makedev(5,0),Y.default_tty_ops),Y.register(Q.makedev(6,0),Y.default_tty1_ops),Q.mkdev(`/dev/tty`,Q.makedev(5,0)),Q.mkdev(`/dev/tty1`,Q.makedev(6,0));var e=new Uint8Array(1024),t=0,n=()=>(t===0&&(ue(e),t=e.byteLength),e[--t]);Q.createDevice(`/dev`,`random`,n),Q.createDevice(`/dev`,`urandom`,n),Q.mkdir(`/dev/shm`),Q.mkdir(`/dev/shm/tmp`)},createSpecialDirectories(){Q.mkdir(`/proc`);var e=Q.mkdir(`/proc/self`);Q.mkdir(`/proc/self/fd`),Q.mount({mount(){var t=Q.createNode(e,`fd`,16895,73);return t.stream_ops={llseek:Z.stream_ops.llseek},t.node_ops={lookup(e,t){var n=+t,r=Q.getStreamChecked(n),i={parent:null,mount:{mountpoint:`fake`},node_ops:{readlink:()=>r.path},id:n+1};return i.parent=i,i},readdir(){return Array.from(Q.streams.entries()).filter(([e,t])=>t).map(([e,t])=>e.toString())}},t}},{},`/proc/self/fd`)},createStandardStreams(e,t,n){e?Q.createDevice(`/dev`,`stdin`,e):Q.symlink(`/dev/tty`,`/dev/stdin`),t?Q.createDevice(`/dev`,`stdout`,null,t):Q.symlink(`/dev/tty`,`/dev/stdout`),n?Q.createDevice(`/dev`,`stderr`,null,n):Q.symlink(`/dev/tty1`,`/dev/stderr`),Q.open(`/dev/stdin`,0),Q.open(`/dev/stdout`,1),Q.open(`/dev/stderr`,1)},staticInit(){Q.nameTable=Array(4096),Q.mount(Z,{},`/`),Q.createDefaultDirectories(),Q.createDefaultDevices(),Q.createSpecialDirectories(),Q.filesystems={MEMFS:Z}},init(e,t,r){Q.initialized=!0,e??=n.stdin,t??=n.stdout,r??=n.stderr,Q.createStandardStreams(e,t,r)},quit(){Q.initialized=!1;for(var e of Q.streams)e&&Q.close(e)},findObject(e,t){var n=Q.analyzePath(e,t);return n.exists?n.object:null},analyzePath(e,t){try{var n=Q.lookupPath(e,{follow:!t});e=n.path}catch{}var r={isRoot:!1,exists:!1,error:0,name:null,path:null,object:null,parentExists:!1,parentPath:null,parentObject:null};try{var n=Q.lookupPath(e,{parent:!0});r.parentExists=!0,r.parentPath=n.path,r.parentObject=n.node,r.name=K.basename(e),n=Q.lookupPath(e,{follow:!t}),r.exists=!0,r.path=n.path,r.object=n.node,r.name=n.node.name,r.isRoot=n.path===`/`}catch(e){r.error=e.errno}return r},createPath(e,t,n,r){e=typeof e==`string`?e:Q.getPath(e);for(var i=t.split(`/`).reverse();i.length;){var a=i.pop();if(a){var o=K.join2(e,a);try{Q.mkdir(o)}catch(e){if(e.errno!=20)throw e}e=o}}return o},createFile(e,t,n,r,i){var a=K.join2(typeof e==`string`?e:Q.getPath(e),t),o=be(r,i);return Q.create(a,o)},createDataFile(e,t,n,r,i,a){var o=t;e&&(e=typeof e==`string`?e:Q.getPath(e),o=t?K.join2(e,t):e);var s=be(r,i),c=Q.create(o,s);if(n){n=ye(n),Q.chmod(c,s|146);var l=Q.open(c,577);Q.write(l,n,0,n.length,0,a),Q.close(l),Q.chmod(c,s)}},createDevice(e,t,n,r){var i=K.join2(typeof e==`string`?e:Q.getPath(e),t),a=be(!!n,!!r);Q.createDevice.major??=64;var o=Q.makedev(Q.createDevice.major++,0);return Q.registerDevice(o,{open(e){e.seekable=!1},close(e){r?.buffer?.length&&r(10)},read(e,t,r,i,a){for(var o=0,s=0;s<i;s++){var c;try{c=n()}catch{throw new Q.ErrnoError(29)}if(c===void 0&&o===0)throw new Q.ErrnoError(6);if(c==null)break;o++,t[r+s]=c}return o&&(e.node.atime=Date.now()),o},write(e,t,n,i,a){for(var o=0;o<i;o++)try{r(t[n+o])}catch{throw new Q.ErrnoError(29)}return i&&(e.node.mtime=e.node.ctime=Date.now()),o}}),Q.mkdev(i,a,o)},forceLoadFile(e){if(e.isDevice||e.isFolder||e.link||e.contents)return!0;if(globalThis.XMLHttpRequest)w(`Lazy loading should have been performed (contents set) in createLazyFile, but it was not. Lazy loading only works in web workers. Use --embed-file or --preload-file in emcc on the main thread.`);else try{e.contents=f(e.url)}catch{throw new Q.ErrnoError(29)}},createLazyFile(e,t,n,r,a){class o{lengthKnown=!1;chunks=[];get(e){if(!(e>this.length-1||e<0)){var t=e%this.chunkSize,n=e/this.chunkSize|0;return this.getter(n)[t]}}setDataGetter(e){this.getter=e}cacheLength(){var e=new XMLHttpRequest;e.open(`HEAD`,n,!1),e.send(null),e.status>=200&&e.status<300||e.status===304||w(`Couldn't load `+n+`. Status: `+e.status);var t=Number(e.getResponseHeader(`Content-length`)),r,i=(r=e.getResponseHeader(`Accept-Ranges`))&&r===`bytes`,a=(r=e.getResponseHeader(`Content-Encoding`))&&r===`gzip`,o=1048576;i||(o=t);var s=(e,r)=>{e>r&&w(`invalid range (${e}, ${r}) or no bytes requested!`),r>t-1&&w(`only ${t} bytes available! programmer error!`);var i=new XMLHttpRequest;return i.open(`GET`,n,!1),t!==o&&i.setRequestHeader(`Range`,`bytes=`+e+`-`+r),i.responseType=`arraybuffer`,i.overrideMimeType&&i.overrideMimeType(`text/plain; charset=x-user-defined`),i.send(null),i.status>=200&&i.status<300||i.status===304||w(`Couldn't load `+n+`. Status: `+i.status),i.response===void 0?ge(i.responseText??``,!0):new Uint8Array(i.response||[])},c=this;c.setDataGetter(e=>{var n=e*o,r=(e+1)*o-1;return r=Math.min(r,t-1),c.chunks[e]===void 0&&(c.chunks[e]=s(n,r)),c.chunks[e]===void 0&&w(`doXHR failed!`),c.chunks[e]}),(a||!t)&&(o=t=1,t=this.getter(0).length,o=t,p(`LazyFiles on gzip forces download of the whole file when length is accessed`)),this._length=t,this._chunkSize=o,this.lengthKnown=!0}get length(){return this.lengthKnown||this.cacheLength(),this._length}get chunkSize(){return this.lengthKnown||this.cacheLength(),this._chunkSize}}if(globalThis.XMLHttpRequest){i||w(`Cannot do synchronous binary XHRs outside webworkers in modern browsers. Use --embed-file or --preload-file in emcc`);var s={isDevice:!1,contents:new o}}else var s={isDevice:!1,url:n};var c=Q.createFile(e,t,s,r,a);s.contents?c.contents=s.contents:s.url&&(c.contents=null,c.url=s.url),Object.defineProperties(c,{usedBytes:{get:function(){return this.contents.length}}});var l={};for(let[e,t]of Object.entries(c.stream_ops))l[e]=(...e)=>(Q.forceLoadFile(c),t(...e));function u(e,t,n,r,i){var a=e.node.contents;if(i>=a.length)return 0;var o=Math.min(a.length-i,r);if(a.slice)for(var s=0;s<o;s++)t[n+s]=a[i+s];else for(var s=0;s<o;s++)t[n+s]=a.get(i+s);return o}return l.read=(e,t,n,r,i)=>(Q.forceLoadFile(c),u(e,t,n,r,i)),l.mmap=(e,t,n,r,i)=>{Q.forceLoadFile(c);var a=X(t);if(!a)throw new Q.ErrnoError(48);return u(e,I,a,t,n),{ptr:a,allocated:!0}},c.stream_ops=l,c}},Pe=(e,t,n)=>e?fe(V,e,t,n):``,$={currentUmask:18,calculateAt(e,t,n){if(K.isAbs(t))return t;var r=e===-100?Q.cwd():$.getStreamFromFD(e).path;if(t.length==0){if(!n)throw new Q.ErrnoError(44);return r}return r+`/`+t},writeStat(e,t){z[e>>2]=t.dev,z[e+4>>2]=t.mode,z[e+8>>2]=t.nlink,z[e+12>>2]=t.uid,z[e+16>>2]=t.gid,z[e+20>>2]=t.rdev,F[e+24>>3]=BigInt(t.size),P[e+32>>2]=4096,P[e+36>>2]=t.blocks;var n=t.atime.getTime(),r=t.mtime.getTime(),i=t.ctime.getTime();return F[e+40>>3]=BigInt(Math.floor(n/1e3)),z[e+48>>2]=n%1e3*1e3*1e3,F[e+56>>3]=BigInt(Math.floor(r/1e3)),z[e+64>>2]=r%1e3*1e3*1e3,F[e+72>>3]=BigInt(Math.floor(i/1e3)),z[e+80>>2]=i%1e3*1e3*1e3,F[e+88>>3]=BigInt(t.ino),0},writeStatFs(e,t){z[e+4>>2]=t.bsize,z[e+60>>2]=t.bsize,F[e+8>>3]=BigInt(t.blocks),F[e+16>>3]=BigInt(t.bfree),F[e+24>>3]=BigInt(t.bavail),F[e+32>>3]=BigInt(t.files),F[e+40>>3]=BigInt(t.ffree),z[e+48>>2]=t.fsid,z[e+64>>2]=t.flags,z[e+56>>2]=t.namelen},doMsync(e,t,n,r,i){if(!Q.isFile(t.node.mode))throw new Q.ErrnoError(43);if(r&2)return 0;var a=V.subarray(e,e+n);Q.msync(t,a,i,n,r)},getStreamFromFD(e){return Q.getStreamChecked(e)},varargs:void 0,getStr(e){return Pe(e)}};function Fe(e,t,n){$.varargs=n;try{var r=$.getStreamFromFD(e);switch(t){case 0:var i=ce();if(i<0)return-28;for(;Q.streams[i];)i++;return Q.dupStream(r,i).fd;case 1:case 2:return 0;case 3:return r.flags;case 4:var i=ce(),a=289792;return r.flags=r.flags&~a|i&a,0;case 12:var i=G(),o=0;return N[i+o>>1]=2,0;case 13:case 14:return 0}return-28}catch(e){if(Q===void 0||e.name!==`ErrnoError`)throw e;return-e.errno}}function Ie(e,t,n){$.varargs=n;try{var r=$.getStreamFromFD(e);switch(t){case 21509:return r.tty?0:-59;case 21505:if(!r.tty)return-59;if(r.tty.ops.ioctl_tcgets){var i=r.tty.ops.ioctl_tcgets(r),a=G();P[a>>2]=i.c_iflag||0,P[a+4>>2]=i.c_oflag||0,P[a+8>>2]=i.c_cflag||0,P[a+12>>2]=i.c_lflag||0;for(var o=0;o<32;o++)I[a+o+17]=i.c_cc[o]||0;return 0}return 0;case 21510:case 21511:case 21512:return r.tty?0:-59;case 21506:case 21507:case 21508:if(!r.tty)return-59;if(r.tty.ops.ioctl_tcsets){for(var a=G(),s=P[a>>2],c=P[a+4>>2],l=P[a+8>>2],u=P[a+12>>2],d=[],o=0;o<32;o++)d.push(I[a+o+17]);return r.tty.ops.ioctl_tcsets(r.tty,t,{c_iflag:s,c_oflag:c,c_cflag:l,c_lflag:u,c_cc:d})}return 0;case 21519:if(!r.tty)return-59;var a=G();return P[a>>2]=0,0;case 21520:return r.tty?-28:-59;case 21537:case 21531:var a=G();return Q.ioctl(r,t,a);case 21523:if(!r.tty)return-59;if(r.tty.ops.ioctl_tiocgwinsz){var f=r.tty.ops.ioctl_tiocgwinsz(r.tty),a=G();N[a>>1]=f[0],N[a+2>>1]=f[1]}return 0;case 21524:return r.tty?0:-59;case 21515:return r.tty?0:-59;default:return-28}}catch(e){if(Q===void 0||e.name!==`ErrnoError`)throw e;return-e.errno}}function Le(e,t,n,r){$.varargs=r;try{t=$.getStr(t),t=$.calculateAt(e,t);var i=r?ce():0;return n&64&&(i&=~$.currentUmask),Q.open(t,n,i).fd}catch(e){if(Q===void 0||e.name!==`ErrnoError`)throw e;return-e.errno}}var Re=()=>w(``),ze=0,Be=()=>{U=!1,ze=0},Ve={},He=e=>{if(e instanceof M||e==`unwind`)return _;c(1,e)},Ue=()=>U||ze>0,We=e=>{_=e,Ue()||(n.onExit?.(e),g=!0),c(e,new M(e))},Ge=(e,t)=>{_=e,We(e)},Ke=()=>{if(!Ue())try{Ge(_)}catch(e){He(e)}},qe=e=>{if(!g)try{return e()}catch(e){He(e)}finally{Ke()}},Je=()=>performance.now(),Ye=(e,t)=>(Ve[e]&&(clearTimeout(Ve[e].id),delete Ve[e]),t&&(Ve[e]={id:setTimeout(()=>{delete Ve[e],qe(()=>qt(e,Je()))},t),timeout_ms:t}),0),Xe=(e,t,n)=>he(e,V,t,n),Ze=(e,t,n,r)=>{var i=new Date().getFullYear(),a=new Date(i,0,1),o=new Date(i,6,1),s=a.getTimezoneOffset(),c=o.getTimezoneOffset(),l=Math.max(s,c);z[e>>2]=l*60,P[t>>2]=Number(s!=c);var u=e=>{var t=e>=0?`-`:`+`,n=Math.abs(e);return`UTC${t}${String(Math.floor(n/60)).padStart(2,`0`)}${String(n%60).padStart(2,`0`)}`},d=u(s),f=u(c);c<s?(Xe(d,n,17),Xe(f,r,17)):(Xe(d,r,17),Xe(f,n,17))},Qe=()=>Date.now(),$e=1,et=e=>e>=0&&e<=3,tt=9007199254740992,nt=-9007199254740992,rt=e=>e<nt||e>tt?NaN:Number(e);function it(e,t,n){if(t=rt(t),!et(e))return 28;var r;if(e===0)r=Qe();else if($e)r=Je();else return 52;var i=Math.round(r*1e3*1e3);return F[n>>3]=BigInt(i),0}var at=()=>2147483648,ot=(e,t)=>Math.ceil(e/t)*t,st=e=>{var t=(e-Zt.buffer.byteLength+65535)/65536|0;try{return Zt.grow(t),b(),1}catch{}},ct=e=>{var t=V.length;e>>>=0;var n=at();if(e>n)return!1;for(var r=1;r<=4;r*=2){var i=t*(1+.2/r);if(i=Math.min(i,e+100663296),st(Math.min(n,ot(Math.max(e,i),65536))))return!0}return!1},lt={},ut=()=>s,dt=()=>{if(!dt.strings){var e={USER:`web_user`,LOGNAME:`web_user`,PATH:`/`,PWD:`/`,HOME:`/home/web_user`,LANG:(globalThis.navigator?.language??`C`).replace(`-`,`_`)+`.UTF-8`,_:ut()};for(var t in lt)lt[t]===void 0?delete e[t]:e[t]=lt[t];var n=[];for(var t in e)n.push(`${t}=${e[t]}`);dt.strings=n}return dt.strings},ft=(e,t)=>{var n=0,r=0;for(var i of dt()){var a=t+n;z[e+r>>2]=a,n+=Xe(i,a,1/0)+1,r+=4}return 0},pt=(e,t)=>{var n=dt();z[e>>2]=n.length;var r=0;for(var i of n)r+=me(i)+1;return z[t>>2]=r,0};function mt(e){try{var t=$.getStreamFromFD(e);return Q.close(t),0}catch(e){if(Q===void 0||e.name!==`ErrnoError`)throw e;return e.errno}}var ht=(e,t,n,r)=>{for(var i=0,a=0;a<n;a++){var o=z[t>>2],s=z[t+4>>2];t+=8;try{var c=Q.read(e,I,o,s,r)}catch(e){if(i>0&&e instanceof Q.ErrnoError&&(e.errno==6||e.errno==6))break;throw e}if(c<0)return-1;if(i+=c,c<s)break;r!==void 0&&(r+=c)}return i};function gt(e,t,n,r){try{var i=ht($.getStreamFromFD(e),t,n);return z[r>>2]=i,0}catch(e){if(Q===void 0||e.name!==`ErrnoError`)throw e;return e.errno}}function _t(e,t,n,r){t=rt(t);try{if(isNaN(t))return 22;var i=$.getStreamFromFD(e);return Q.llseek(i,t,n),F[r>>3]=BigInt(i.position),i.getdents&&t===0&&n===0&&(i.getdents=null),0}catch(e){if(Q===void 0||e.name!==`ErrnoError`)throw e;return e.errno}}var vt=(e,t,n,r)=>{if(n==1)return Q.write(e,I,z[t>>2],z[t+4>>2],r);for(var i=0,a=0,o=t;a<n;a++,o+=8)i+=z[o+4>>2];for(var s=new Uint8Array(i),c=0,a=0;a<n;a++,t+=8){var l=z[t>>2],u=z[t+4>>2];s.set(V.subarray(l,l+u),c),c+=u}return Q.write(e,s,0,i,r)};function yt(e,t,n,r){try{var i=vt($.getStreamFromFD(e),t,n);return z[r>>2]=i,0}catch(e){if(Q===void 0||e.name!==`ErrnoError`)throw e;return e.errno}}var bt=e=>n[`_`+e],xt=(e,t)=>{I.set(e,t)},St=e=>Yt(e),Ct=e=>{var t=me(e)+1,n=St(t);return Xe(e,n,t),n},wt=(e,t,n,r,i)=>{var a={string:e=>{var t=0;return e!=null&&e!==0&&(t=Ct(e)),t},array:e=>{var t=St(e.length);return xt(e,t),t}};function o(e){return t===`string`?Pe(e):t===`boolean`?!!e:e}var s=bt(e),c=[],l=0;if(r)for(var u=0;u<r.length;u++){var d=a[n[u]];d?(l===0&&(l=ie()),c[u]=d(r[u])):c[u]=r[u]}var f=s(...c);function p(e){return l!==0&&W(l),o(e)}return f=p(f),f},Tt=(e,t,n,r)=>{var i=!n||n.every(e=>e===`number`||e===`boolean`);return t!==`string`&&i&&!r?bt(e):(...i)=>wt(e,t,n,i,r)},Et=[],Dt=e=>{var t=Et[e];return t||(Et[e]=t=Qt.get(e)),t},Ot=(e,t)=>{if(kt)for(var n=e;n<e+t;n++){var r=Dt(n);r&&kt.set(r,n)}},kt,At=e=>(kt||(kt=new WeakMap,Ot(0,Qt.length)),kt.get(e)||0),jt=[],Mt=()=>jt.length?jt.pop():Qt.grow(1),Nt=(e,t)=>{Qt.set(e,t),Et[e]=Qt.get(e)},Pt=e=>{let t=e.length;return[t%128|128,t>>7,...e]},Ft={i:127,p:127,j:126,f:125,d:124,e:111},It=e=>Pt(Array.from(e,e=>Ft[e])),Lt=(e,t)=>{var n=Uint8Array.of(0,97,115,109,1,0,0,0,1,...Pt([1,96,...It(t.slice(1)),...It(t[0]===`v`?``:t[0])]),2,7,1,1,101,1,102,0,0,7,5,1,1,102,0,0),r=new WebAssembly.Module(n);return new WebAssembly.Instance(r,{e:{f:e}}).exports.f},Rt=(e,t)=>{var n=At(e);if(n)return n;var r=Mt();try{Nt(r,e)}catch(n){if(!(n instanceof TypeError))throw n;Nt(r,Lt(e,t))}return kt.set(e,r),r},zt=e=>{kt.delete(Dt(e)),Nt(e,null),jt.push(e)};Q.createPreloadedFile=Ne,Q.preloadFile=Me,Q.staticInit(),n.noExitRuntime&&(U=n.noExitRuntime),n.print&&(p=n.print),n.printErr&&(m=n.printErr),n.arguments&&n.arguments,n.thisProgram&&(s=n.thisProgram);var Bt=n.preInit;if(Bt)for(typeof Bt==`function`&&(n.preInit=Bt=[Bt]);Bt.length>0;)Bt.shift()();n.cwrap=Tt,n.addFunction=Rt,n.removeFunction=zt,n.UTF8ToString=Pe;var Vt,Ht,Ut,Wt,Gt,Kt,qt,Jt,Yt,Xt,Zt,Qt;function $t(e){n._Highs_js_getColName=e.w,n._Highs_js_getRowName=e.x,n._Highs_js_getPresolvedColName=e.y,n._Highs_js_getPresolvedRowName=e.z,n._Highs_js_setCallback=e.A,n._Highs_js_getCallbackMipSolutionSize=e.B,n._Highs_lpCall=e.C,n._Highs_mipCall=e.D,n._Highs_qpCall=e.E,Vt=n._Highs_create=e.F,Ht=n._Highs_destroy=e.G,n._Highs_version=e.H,n._Highs_versionMajor=e.I,n._Highs_versionMinor=e.J,n._Highs_versionPatch=e.K,n._Highs_githash=e.L,n._Highs_presolve=e.M,Ut=n._Highs_run=e.N,n._Highs_postsolve=e.O,n._Highs_readModel=e.P,n._Highs_writeModel=e.Q,n._Highs_writePresolvedModel=e.R,n._Highs_writeSolution=e.S,n._Highs_writeSolutionPretty=e.T,n._Highs_passLp=e.U,n._Highs_passMip=e.V,n._Highs_passModel=e.W,n._Highs_passHessian=e.X,n._Highs_passLinearObjectives=e.Y,n._Highs_clearLinearObjectives=e.Z,n._Highs_getNumCol=e._,n._Highs_addLinearObjective=e.$,n._Highs_passRowName=e.aa,n._Highs_passColName=e.ba,n._Highs_passModelName=e.ca,n._Highs_readOptions=e.da,n._Highs_clear=e.ea,n._Highs_clearModel=e.fa,n._Highs_clearSolver=e.ga,n._Highs_releaseMemory=e.ha,n._Highs_setBoolOptionValue=e.ia,n._Highs_setIntOptionValue=e.ja,n._Highs_setDoubleOptionValue=e.ka,n._Highs_setStringOptionValue=e.la,n._Highs_getNumOptions=e.ma,n._Highs_getOptionName=e.na,n._Highs_getBoolOptionValue=e.oa,n._Highs_getBoolOptionValues=e.pa,n._Highs_getIntOptionValue=e.qa,n._Highs_getIntOptionValues=e.ra,n._Highs_getDoubleOptionValue=e.sa,n._Highs_getDoubleOptionValues=e.ta,n._Highs_getStringOptionValue=e.ua,n._Highs_getStringOptionValues=e.va,n._Highs_getOptionType=e.wa,n._Highs_resetOptions=e.xa,n._Highs_writeOptions=e.ya,n._Highs_writeOptionsDeviations=e.za,n._Highs_getIntInfoValue=e.Aa,n._Highs_getDoubleInfoValue=e.Ba,n._Highs_getInt64InfoValue=e.Ca,n._Highs_getInfoType=e.Da,n._Highs_getSolution=e.Ea,n._Highs_getBasis=e.Fa,Wt=n._Highs_getModelStatus=e.Ga,n._Highs_getDualRay=e.Ha,n._Highs_getDualUnboundednessDirection=e.Ia,n._Highs_getPrimalRay=e.Ja,n._Highs_getObjectiveValue=e.Ka,n._Highs_getBasicVariables=e.La,n._Highs_getBasisInverseRow=e.Ma,n._Highs_getBasisInverseCol=e.Na,n._Highs_getBasisSolve=e.Oa,n._Highs_getBasisTransposeSolve=e.Pa,n._Highs_getReducedRow=e.Qa,n._Highs_getReducedColumn=e.Ra,n._Highs_setBasis=e.Sa,n._Highs_getNumRow=e.Ta,n._Highs_setLogicalBasis=e.Ua,n._Highs_setSolution=e.Va,n._Highs_setSparseSolution=e.Wa,n._Highs_setCallback=e.Xa,n._Highs_startCallback=e.Ya,n._Highs_stopCallback=e.Za,n._Highs_getRunTime=e._a,n._Highs_zeroAllClocks=e.$a,n._Highs_addCol=e.ab,n._Highs_addCols=e.bb,n._Highs_addVar=e.cb,n._Highs_addVars=e.db,n._Highs_addRow=e.eb,n._Highs_addRows=e.fb,n._Highs_ensureColwise=e.gb,n._Highs_ensureRowwise=e.hb,n._Highs_changeObjectiveSense=e.ib,n._Highs_changeObjectiveOffset=e.jb,n._Highs_changeColIntegrality=e.kb,n._Highs_changeColsIntegralityByRange=e.lb,n._Highs_changeColsIntegralityBySet=e.mb,n._Highs_changeColsIntegralityByMask=e.nb,n._Highs_clearIntegrality=e.ob,n._Highs_changeColCost=e.pb,n._Highs_changeColsCostByRange=e.qb,n._Highs_changeColsCostBySet=e.rb,n._Highs_changeColsCostByMask=e.sb,n._Highs_changeColBounds=e.tb,n._Highs_changeColsBoundsByRange=e.ub,n._Highs_changeColsBoundsBySet=e.vb,n._Highs_changeColsBoundsByMask=e.wb,n._Highs_changeRowBounds=e.xb,n._Highs_changeRowsBoundsByRange=e.yb,n._Highs_changeRowsBoundsBySet=e.zb,n._Highs_changeRowsBoundsByMask=e.Ab,n._Highs_changeCoeff=e.Bb,n._Highs_getObjectiveSense=e.Cb,n._Highs_getObjectiveOffset=e.Db,n._Highs_getColsByRange=e.Eb,n._Highs_getColsBySet=e.Fb,n._Highs_getColsByMask=e.Gb,n._Highs_getRowsByRange=e.Hb,n._Highs_getRowsBySet=e.Ib,n._Highs_getRowsByMask=e.Jb,n._Highs_getRowName=e.Kb,n._Highs_getRowByName=e.Lb,n._Highs_getColName=e.Mb,n._Highs_getColByName=e.Nb,n._Highs_getColIntegrality=e.Ob,n._Highs_deleteColsByRange=e.Pb,n._Highs_deleteColsBySet=e.Qb,n._Highs_deleteColsByMask=e.Rb,n._Highs_deleteRowsByRange=e.Sb,n._Highs_deleteRowsBySet=e.Tb,n._Highs_deleteRowsByMask=e.Ub,n._Highs_scaleCol=e.Vb,n._Highs_scaleRow=e.Wb,n._Highs_getInfinity=e.Xb,n._Highs_getSizeofHighsInt=e.Yb,n._Highs_getNumNz=e.Zb,n._Highs_getHessianNumNz=e._b,n._Highs_getPresolvedNumCol=e.$b,n._Highs_getPresolvedNumRow=e.ac,n._Highs_getPresolvedNumNz=e.bc,n._Highs_getModel=e.cc,n._Highs_getLp=e.dc,n._Highs_getFixedLp=e.ec,n._Highs_getPresolvedLp=e.fc,n._Highs_getPresolvedColName=e.gc,n._Highs_getPresolvedRowName=e.hc,n._Highs_getIis=e.ic,n._Highs_getIisLp=e.jc,n._Highs_crossover=e.kc,n._Highs_getRanging=e.lc,n._Highs_feasibilityRelaxation=e.mc,n._Highs_getCallbackDataOutItem=e.nc,n._Highs_setCallbackSolution=e.oc,n._Highs_setCallbackSparseSolution=e.pc,n._Highs_repairCallbackSolution=e.qc,n._Highs_call=e.rc,Gt=n._free=e.tc,Kt=n._malloc=e.uc,qt=e.vc,Jt=e.wc,Yt=e.xc,Xt=e.yc,Zt=e.u,Qt=e.sc}var en={a:se,e:Fe,h:Ie,i:Le,k:Re,s:Be,l:Ye,m:Ze,p:it,j:Qe,c:Je,q:ct,n:ft,o:pt,b:Ge,d:mt,g:gt,t:_t,f:yt,r:We};async function tn(){x(),Ee&&await Te();var e=n.setStatus;e&&(e(`Running...`),await new Promise(e=>setTimeout(e,1)),setTimeout(e,1,``)),!g&&(S(),n.onRuntimeInitialized?.(),C())}var nn=await j();await tn();let rn=0;n.Highs_readModel=n.cwrap(`Highs_readModel`,`number`,[`number`,`string`]);let an=n.cwrap(`Highs_setIntOptionValue`,`number`,[`number`,`string`,`number`]),on=n.cwrap(`Highs_setDoubleOptionValue`,`number`,[`number`,`string`,`number`]),sn=n.cwrap(`Highs_setStringOptionValue`,`number`,[`number`,`string`,`string`]),cn=n.cwrap(`Highs_setBoolOptionValue`,`number`,[`number`,`string`,`number`]),ln=n.cwrap(`Highs_getOptionType`,`number`,[`number`,`string`,`number`]),un=n.cwrap(`Highs_getNumCol`,`number`,[`number`]),dn=n.cwrap(`Highs_getNumRow`,`number`,[`number`]),fn=n.cwrap(`Highs_getObjectiveValue`,`number`,[`number`]),pn=n.cwrap(`Highs_getInfinity`,`number`,[]),mn=n.cwrap(`Highs_getSolution`,`number`,[`number`,`number`,`number`,`number`,`number`]),hn=n.cwrap(`Highs_getBasis`,`number`,[`number`,`number`,`number`]),gn=n.cwrap(`Highs_getColsByRange`,`number`,[`number`,`number`,`number`,`number`,`number`,`number`,`number`,`number`,`number`,`number`,`number`]),_n=n.cwrap(`Highs_getRowsByRange`,`number`,[`number`,`number`,`number`,`number`,`number`,`number`,`number`,`number`,`number`,`number`]),vn=n.cwrap(`Highs_getColIntegrality`,`number`,[`number`,`number`,`number`]),yn=n.cwrap(`Highs_js_getColName`,`number`,[`number`,`number`,`number`,`number`,`number`]),bn=n.cwrap(`Highs_js_getRowName`,`number`,[`number`,`number`,`number`,`number`,`number`]),xn={0:`Not Set`,1:`Load error`,2:`Model error`,3:`Presolve error`,4:`Solve error`,5:`Postsolve error`,6:`Empty`,7:`Optimal`,8:`Infeasible`,9:`Primal infeasible or unbounded`,10:`Unbounded`,11:`Bound on objective reached`,12:`Target for objective reached`,13:`Time limit reached`,14:`Iteration limit reached`,15:`Unknown`};var Vt,Ut,Ht,Wt,Q;let Sn={0:`LB`,1:`BS`,2:`UB`,3:`FX`};function Cn(e,t,n){return e===3||e===2&&t===n?`FX`:Sn[e]||``}let wn=new Set([`Not Set`,`Load error`,`Model error`,`Presolve error`,`Solve error`,`Postsolve error`,`Empty`,`Infeasible`,`Unknown`]);n.solve=function(e,t){let r=`highs-model-${++rn}.lp`,i,a=[];function o(e){let t=Kt(e);if(!t)throw Error(`malloc failed`);return a.push(t),t}function s(e,t){let n=o(Int32Array.BYTES_PER_ELEMENT),r=yn(e,t,0,0,n);if(r!==0&&r!==1)return``;let i=P[n>>2];if(i<=0)return``;let s=Kt(i);return a.push(s),r=yn(e,t,s,i,n),r!==0&&r!==1?``:Pe(s)}function c(e,t){let n=o(Int32Array.BYTES_PER_ELEMENT),r=bn(e,t,0,0,n);if(r!==0&&r!==1)return``;let i=P[n>>2];if(i<=0)return``;let s=Kt(i);return a.push(s),r=bn(e,t,s,i,n),r!==0&&r!==1?``:Pe(s)}try{if(Q.writeFile(r,e),i=Vt(),!i)throw Error(`Unable to create the HiGHS solver`);En(()=>n.Highs_readModel(i,r),`read LP model (see http://web.mit.edu/lpsolve/doc/CPLEX-format.htm)`);let a=t||{};for(let e in a){let t=a[e],n=typeof t,r;if(n===`number`)r=Tn;else if(n===`boolean`)r=cn;else if(n===`string`)r=sn;else throw Error(`Unsupported option value type ${t} for '${e}'`);En(()=>r(i,e,t),`set option '${e}'`)}En(()=>Ut(i),`solve the problem`);let l=Wt(i),u=xn[l]||`Unknown`;if(u===`Empty`)return{Columns:{},Rows:[],ObjectiveValue:0,Status:`Empty`};let d=un(i),f=dn(i),p=pn(),m=fn(i);Math.abs(m)>=p*.5&&(m=m>0?1/0:-1/0);let h=d>0?o(d*Float64Array.BYTES_PER_ELEMENT):0,g=d>0?o(d*Float64Array.BYTES_PER_ELEMENT):0,_=f>0?o(f*Float64Array.BYTES_PER_ELEMENT):0,v=f>0?o(f*Float64Array.BYTES_PER_ELEMENT):0;En(()=>mn(i,h,g,_,v),`get solution`);let y=d>0?o(d*Int32Array.BYTES_PER_ELEMENT):0,b=f>0?o(f*Int32Array.BYTES_PER_ELEMENT):0,x=!1,S=hn(i,y,b);(S===0||S===1)&&(x=!0);let C=o(Int32Array.BYTES_PER_ELEMENT),w=d>0?o(d*Float64Array.BYTES_PER_ELEMENT):0,T=d>0?o(d*Float64Array.BYTES_PER_ELEMENT):0,E=d>0?o(d*Float64Array.BYTES_PER_ELEMENT):0;gn(i,0,d-1,C,w,T,E,0,0,0,0);let ee=o(Int32Array.BYTES_PER_ELEMENT),D=f>0?o(f*Float64Array.BYTES_PER_ELEMENT):0,O=f>0?o(f*Float64Array.BYTES_PER_ELEMENT):0;_n(i,0,f-1,ee,D,O,0,0,0,0);let k=o(Int32Array.BYTES_PER_ELEMENT),A=!wn.has(u),j=!1;for(let e=0;e<d&&!j;e++)vn(i,e,k),P[k>>2]!==0&&(j=!0);let M={};for(let e=0;e<d;e++){let t={Index:e,Lower:R[(T>>3)+e],Upper:R[(E>>3)+e]};if(vn(i,e,k),t.Type=P[k>>2]===1?`Integer`:`Continuous`,A&&(t.Primal=R[(h>>3)+e]),x&&A&&!j){let n=P[(y>>2)+e];t.Status=Cn(n,t.Lower,t.Upper),t.Dual=R[(g>>3)+e]}t.Name=s(i,e),M[t.Name]=t}let N=[];for(let e=0;e<f;e++){let t={Index:e,Name:c(i,e),Lower:R[(D>>3)+e],Upper:R[(O>>3)+e]};if(A&&(t.Primal=R[(_>>3)+e]),x&&A&&!j){let n=P[(b>>2)+e];t.Status=Cn(n,t.Lower,t.Upper),t.Dual=R[(v>>3)+e]}N.push(t)}return{Status:u,ObjectiveValue:m,Columns:M,Rows:N}}finally{i&&Ht(i);try{Q.unlink(r)}catch{}for(let e=a.length-1;e>=0;e--)try{Gt(a[e])}catch{}}};function Tn(e,t,n){let r=Kt(Int32Array.BYTES_PER_ELEMENT);if(!r)return-1;try{let i=ln(e,t,r);if(i!==0&&i!==1)return i;let a=P[r>>2];return a===1?!Number.isSafeInteger(n)||n<-2147483648||n>2147483647?-1:an(e,t,n):a===2?on(e,t,n):-1}finally{Gt(r)}}function En(e,t){let n;try{n=e()}catch(e){n=e}if(n!==0&&n!==1)throw Error(`Unable to `+t+`. HiGHS error `+n)}var Dn=this&&this.__classPrivateFieldSet||function(e,t,n,r,i){if(r===`m`)throw TypeError(`Private method is not writable`);if(r===`a`&&!i)throw TypeError(`Private accessor was defined without a setter`);if(typeof t==`function`?e!==t||!i:!t.has(e))throw TypeError(`Cannot write private member to an object whose class did not declare it`);return r===`a`?i.call(e,n):i?i.value=n:t.set(e,n),n},On=this&&this.__classPrivateFieldGet||function(e,t,n,r){if(n===`a`&&!r)throw TypeError(`Private accessor was defined without a getter`);if(typeof t==`function`?e!==t||!r:!t.has(e))throw TypeError(`Cannot read private member from an object whose class did not declare it`);return n===`m`?r:n===`a`?r.call(e):r?r.value:t.get(e)};return(function(e){"use strict";var t,n;let r={csc:1,csr:2},i={triangular:1,square:2},a=new Map,o=new Map,s=new Map,c=1,l=1,u=0;class d extends Error{constructor(e,t){super(e),this.status=-1,this.name=`HighsError`,this.operation=t}}class f extends d{constructor(){super(`Cannot use this HiGHS model after disposal; create a new model or keep the work inside highs.withModel()`,`dispose`),this.name=`HighsDisposedError`}}class p extends d{constructor(e){super(e,`validate`),this.name=`HighsValidationError`}}class m extends d{constructor(){super(`Only callback control methods may be called while HiGHS is executing a callback`,`callback`),this.name=`HighsReentrancyError`}}class h extends d{constructor(e){super(`Option '`+e+`' is not supported by the single-threaded data-only API`,`setOptionValue`),this.name=`HighsUnsupportedOptionError`,this.option=e}}function g(t,n,r){let i=t+`:`+n+`:`+r.join(`,`),a=s.get(i);if(!a){let c=e.cwrap(t,n,r);a=function(...e){let t=c.apply(null,e),n=o.get(e[0]);return n&&n._throwCallbackError(),t},s.set(i,a)}return a}function _(e,t,n=`number`){return g(e,n,Array(t).fill(`number`))}function v(e,t,n,r=`number`){return g(e,r,Array(t||0).fill(`number`).concat([`string`],Array(n||0).fill(`number`)))}function y(){return V}function b(){return P}function x(){return R}function S(e){return e?Pe(e):``}function C(e){return new p(e)}function w(){return new f}function T(e){return new d(e+` failed with HiGHS status -1`,e)}function E(e){return new h(e)}function ee(){return new m}function D(e){return{status:e}}function O(e,t){return e===-1?{status:e}:{status:e,value:t}}function k(e,t){if(e===-1)throw T(t);return{status:e,warnings:e===1?[t+` completed with a HiGHS warning`]:[]}}function A(e,t,n=0){if(!Number.isSafeInteger(e)||e<(n||0)||e>2147483647)throw C(t+` must be a 32-bit non-negative integer`);return e}function j(e,t){if(!Number.isSafeInteger(e)||e<-2147483648||e>2147483647)throw C(t+` must be a signed 32-bit integer`);return e}function M(e,t){if(e==null||typeof e.length!=`number`)throw C(t+` must be an array or typed array`);return e}function N(e,t,n){if(M(e,n),e.length!==t)throw C(n+` must contain `+t+` values; got `+e.length);return e}function F(e,t){if(typeof e!=`number`||Number.isNaN(e))throw C(t+` must be a number`);return e}function I(e,t,n){N(e,t,n);for(let t=0;t<e.length;t++)F(e[t],n+`[`+t+`]`);return e}function L(e,t,n,r){t==null?M(e,n):N(e,t,n);for(let t=0;t<e.length;t++){let i=e[t];if(A(i,n+`[`+t+`]`,0),r!=null&&i>=r)throw C(n+`[`+t+`] is outside the model`)}return e}function te(e,t,n,r){if(!e||e.format!==`csc`&&e.format!==`csr`)throw C(r+`.format must be 'csc' or 'csr'`);if(e.numRows!==t||e.numCols!==n)throw C(r+` dimensions do not match the model`);let i=e.format===`csc`?n:t;if(L(e.starts,i+1,r+`.starts`),e.starts[0]!==0)throw C(r+`.starts must begin with zero`);for(let t=1;t<e.starts.length;t++)if(e.starts[t]<e.starts[t-1])throw C(r+`.starts must be monotonic`);let a=e.starts[i];return L(e.indices,a,r+`.indices`,e.format===`csc`?t:n),I(e.values,a,r+`.values`),a}function z(e,t,n){if(!e||!(e.format in i))throw C(n+`.format must be 'triangular' or 'square'`);if(e.dimension!==t)throw C(n+`.dimension must equal numCols`);if(L(e.starts,t+1,n+`.starts`),e.starts[0]!==0)throw C(n+`.starts must begin with zero`);for(let t=1;t<e.starts.length;t++)if(e.starts[t]<e.starts[t-1])throw C(n+`.starts must be monotonic`);let r=e.starts[t];return L(e.indices,r,n+`.indices`,t),I(e.values,r,n+`.values`),r}function B(e){if(!e||typeof e!=`object`)throw C(`model must be an object`);let t=A(e.numCols,`numCols`,0),n=A(e.numRows,`numRows`,0);I(e.colCost,t,`colCost`),I(e.colLower,t,`colLower`),I(e.colUpper,t,`colUpper`),I(e.rowLower,n,`rowLower`),I(e.rowUpper,n,`rowUpper`);let r=te(e.matrix,n,t,`matrix`);if(e.integrality!=null){L(e.integrality,t,`integrality`);for(let n=0;n<t;n++)if(e.integrality[n]>4)throw C(`integrality values must be between 0 and 4`)}let i=e.hessian?z(e.hessian,t,`hessian`):0,a=e.sense==null?1:e.sense;if(a!==1&&a!==-1)throw C(`sense must be 1 (minimize) or -1 (maximize)`);if(F(e.offset==null?0:e.offset,`offset`),e.modelName!=null&&typeof e.modelName!=`string`)throw C(`modelName must be a string`);for(let[r,i,a]of[[e.colNames,t,`colNames`],[e.rowNames,n,`rowNames`]])if(r!=null){N(r,i,a);for(let e=0;e<r.length;e++)if(typeof r[e]!=`string`)throw C(a+`[`+e+`] must be a string`)}return{numCols:t,numRows:n,numNonzeros:r,hessianNonzeros:i,sense:a}}function ne(e,t,n){if(!e||typeof e!=`object`)throw C(n+` must be an object`);F(e.weight,n+`.weight`),F(e.offset,n+`.offset`),I(e.coefficients,t,n+`.coefficients`),F(e.absoluteTolerance,n+`.absoluteTolerance`),F(e.relativeTolerance,n+`.relativeTolerance`),j(e.priority,n+`.priority`)}class re{constructor(){this.pointers=[]}bytes(e){A(e,`allocation size`,0);let t=Kt(Math.max(1,e));if(!t)throw RangeError(`Unable to allocate WebAssembly memory`);return this.pointers.push(t),t}ints(e){let t=this.bytes(e.length*4);return b().set(e,t>>2),t}doubles(e){let t=this.bytes(e.length*8);return x().set(e,t>>3),t}pack(e){let t=[],n=0;for(let r of e){let e=r.type===`f64`?8:4;n=Math.ceil(n/e)*e,t.push(n),n+=r.values.length*e}let r=this.bytes(n);return e.forEach((e,n)=>{let i=r+t[n];e.type===`f64`?x().set(e.values,i>>3):b().set(e.values,i>>2)}),t.map(e=>r+e)}outInts(e){let t=this.bytes(e*4);return b().fill(0,t>>2,(t>>2)+e),t}outDoubles(e){let t=this.bytes(e*8);return x().fill(0,t>>3,(t>>3)+e),t}free(){for(let e=this.pointers.length-1;e>=0;e--)Gt(this.pointers[e]);this.pointers.length=0}}function H(e){let t=new re;try{return e(t)}finally{t.free()}}function U(e,t){return b().slice(e>>2,(e>>2)+t)}function W(e,t){return x().slice(e>>3,(e>>3)+t)}function ie(e){return new BigInt64Array(y().buffer,e,1)[0]}function ae(e){return`/tmp/highs-js-`+l+++`.`+e}function oe(e,t){if(!e||e.format!==`lp`&&e.format!==`mps`)throw C(`format must be 'lp' or 'mps'`);if(!(typeof e.data==`string`||ArrayBuffer.isView(e.data)))throw C(`model data must be a string or Uint8Array`);let n=ae(e.format);try{return Q.writeFile(n,e.data),t(n)}finally{try{Q.unlink(n)}catch{}}}function se(e,t,n){if(typeof e!=`string`)throw C(`data must be a string`);let r=ae(t);try{return Q.writeFile(r,e),n(r)}finally{try{Q.unlink(r)}catch{}}}function ce(e,t,n){let r=ae(e);try{let e=n(r);return e===-1?O(e):O(e,Q.readFile(r,t===`utf8`?{encoding:`utf8`}:void 0))}finally{try{Q.unlink(r)}catch{}}}function G(e){return/thread|parallel|concurr/i.test(e)||/(^|_)(log_file|read_.*_file|write_.*_file|solution_file|.*_file)$/.test(e)||/^write_.*_to_file$/.test(e)}function K(e){if(typeof e!=`string`||!e)throw C(`option name is required`);if(G(e))throw E(e)}function le(e){if(typeof e!=`string`||!e)throw C(`option name is required`);return!G(e)}function ue(e){if(typeof e!=`string`)throw C(`option data must be a string`);for(let t of e.split(/\r?\n/)){let e=/^\s*([A-Za-z][A-Za-z0-9_]*)\b/.exec(t);e&&!t.trimStart().startsWith(`#`)&&K(e[1])}}function q(e,t,n,r){if(!e||typeof e!=`object`)throw C(r+` selection must be tagged`);if(e.kind===`range`){let n=A(e.from,r+`.from`,0),i=A(e.to,r+`.to`,0);if(i<n||i>=t)throw C(r+` range is outside the model`);return{suffix:`ByRange`,prefix:[n,i],count:i-n+1}}if(e.kind===`set`){L(e.indices,null,r+`.indices`,t);for(let t=1;t<e.indices.length;t++)if(e.indices[t]<=e.indices[t-1])throw C(r+` set indices must increase strictly`);return{suffix:`BySet`,prefix:[e.indices.length,n.ints(e.indices)],count:e.indices.length}}if(e.kind===`mask`){N(e.mask,t,r+`.mask`);let i=new Int32Array(t),a=0;for(let n=0;n<t;n++){if(e.mask[n]!==!1&&e.mask[n]!==!0&&e.mask[n]!==0&&e.mask[n]!==1)throw C(r+`.mask values must be boolean, 0, or 1`);i[n]=+!!e.mask[n],a+=i[n]}return{suffix:`ByMask`,prefix:[n.ints(i)],count:a}}throw C(r+`.kind must be 'range', 'set', or 'mask'`)}function J(e){return{numCols:_(`Highs_getNumCol`,1)(e),numRows:_(`Highs_getNumRow`,1)(e),numNonzeros:_(`Highs_getNumNz`,1)(e),hessianNonzeros:_(`Highs_getHessianNumNz`,1)(e)}}function de(e){return{numCols:_(`Highs_getPresolvedNumCol`,1)(e),numRows:_(`Highs_getPresolvedNumRow`,1)(e),numNonzeros:_(`Highs_getPresolvedNumNz`,1)(e)}}class fe{constructor(e){t.set(this,void 0),n.set(this,void 0),this._callbackNumCols=0,Dn(this,t,e,`f`),Dn(this,n,!1,`f`),this._callbackDepth=0,this._callbackId=0,this._callbackError=void 0,this._callbackErrorPending=!1,o.set(e,this)}get disposed(){return On(this,n,`f`)}_require(e=!1){if(On(this,n,`f`))throw w();if(this._callbackDepth&&!e)throw ee();return On(this,t,`f`)}_rememberCallbackError(e){this._callbackErrorPending||=(this._callbackError=e,!0)}_throwCallbackError(){if(!this._callbackErrorPending)return;let e=this._callbackError;throw this._callbackError=void 0,this._callbackErrorPending=!1,e}clear(){return this._simple(`Highs_clear`)}clearSolver(){return this._simple(`Highs_clearSolver`)}presolve(){return this._simple(`Highs_presolve`)}getRunTime(){return _(`Highs_getRunTime`,1)(this._require(!1))}readModel(e){let t=this._require(!1);return D(oe(e,function(e){return v(`Highs_readModel`,1,0)(t,e)}))}exportPresolvedModel(e){let t=this._require(!1);if(e!==`lp`&&e!==`mps`)throw C(`format must be 'lp' or 'mps'`);return ce(e,e===`lp`?`utf8`:void 0,function(e){return v(`Highs_writePresolvedModel`,1,0)(t,e)})}passModel(e){let t=this._require(!1),n=H(function(n){let r=me(e,n);return _(`Highs_passModel`,21).apply(null,[t].concat(r.values))}),r=n===-1?n:he(t,e);return D(n===-1||r===-1?-1:Math.max(n,r))}passMip(e){let t=this._require(!1),n=H(function(n){let i=B(e),a=e.matrix;if(!e.integrality)throw C(`passMip requires an integrality vector`);let o=pe(e,n,!0);return _(`Highs_passMip`,16)(t,i.numCols,i.numRows,i.numNonzeros,r[a.format],i.sense,e.offset==null?0:e.offset,...o)}),i=n===-1?n:he(t,e);return D(n===-1||i===-1?-1:Math.max(n,i))}passHessian(e){let t=this._require(!1),n=J(t).numCols;return D(H(function(r){let a=z(e,n,`hessian`);return _(`Highs_passHessian`,7)(t,n,a,i[e.format],r.ints(Array.prototype.slice.call(e.starts,0,-1)),r.ints(e.indices),r.doubles(e.values))}))}addLinearObjective(e){let t=this._require(!1),n=J(t).numCols;return ne(e,n,`objective`),D(H(function(n){return _(`Highs_addLinearObjective`,7)(t,e.weight,e.offset,n.doubles(e.coefficients),e.absoluteTolerance,e.relativeTolerance,j(e.priority,`priority`))}))}passRowName(e,t){let n=this._require(!1);if(A(e,`row`,0),typeof t!=`string`)throw C(`name must be a string`);return D(v(`Highs_passRowName`,2,0)(n,e,t))}passModelName(e){if(typeof e!=`string`)throw C(`name must be a string`);return D(v(`Highs_passModelName`,1,0)(this._require(!1),e))}getOptionType(e){let t=this._require(!1);return le(e)?H(function(n){let r=n.outInts(1);return O(v(`Highs_getOptionType`,1,1)(t,e,r),[`boolean`,`integer`,`double`,`string`][b()[r>>2]])}):O(-1)}resetOptions(){return this._simple(`Highs_resetOptions`)}exportOptions(e){let t=this._require(!1),n=ce(`options`,`utf8`,function(n){return v(e?`Highs_writeOptionsDeviations`:`Highs_writeOptions`,1,0)(t,n)});return n.status!==-1&&(n.value=n.value.split(/\r?\n/).filter(function(e){let t=/^\s*([A-Za-z][A-Za-z0-9_]*)\b/.exec(e);return!t||!G(t[1])}).join(`
|
|
5
|
+
`)),n}getOptionName(e){let t=this._require(!1);return A(e,`option index`,0),H(function(n){let r=n.outInts(1),i=_(`Highs_getOptionName`,3)(t,e,r),a=b()[r>>2]>>>0;if(!a)return O(i,``);try{return O(i,S(a))}finally{Gt(a)}})}getInfoType(e){let t=this._require(!1);if(typeof e!=`string`||!e)throw C(`info name is required`);return H(function(n){let r=n.outInts(1),i=v(`Highs_getInfoType`,1,1)(t,e,r),a=b()[r>>2];return O(i,a===-1?`int64`:a===1?`integer`:a===2?`double`:void 0)})}getDimensions(){return J(this._require(!1))}getInfinity(){return _(`Highs_getInfinity`,1)(this._require(!1))}getModelStatus(){return _(`Highs_getModelStatus`,1)(this._require(!1))}getSolution(){let e=this._require(!1),t=this.getModelStatus();if(t===0||t===6)throw new d(`The model has not been solved`,`getSolution`);let n=J(e);return H(function(t){let r=t.outDoubles(n.numCols),i=t.outDoubles(n.numCols),a=t.outDoubles(n.numRows),o=t.outDoubles(n.numRows);return O(_(`Highs_getSolution`,5)(e,r,i,a,o),{colValue:W(r,n.numCols),rowValue:W(a,n.numRows),colDual:W(i,n.numCols),rowDual:W(o,n.numRows)})})}setSolution(e){let t=this._require(!1),n=J(t);return D(H(function(r){function i(e,t,n){return e==null?0:(I(e,t,n),r.doubles(e))}return _(`Highs_setSolution`,5)(t,i(e.colValue,n.numCols,`colValue`),i(e.rowValue,n.numRows,`rowValue`),i(e.colDual,n.numCols,`colDual`),i(e.rowDual,n.numRows,`rowDual`))}))}setBasis(e){let t=this._require(!1),n=J(t);if(!e)throw C(`basis is required`);return L(e.colStatus,n.numCols,`colStatus`),L(e.rowStatus,n.numRows,`rowStatus`),D(H(function(n){return _(`Highs_setBasis`,3)(t,n.ints(e.colStatus),n.ints(e.rowStatus))}))}postsolve(e){let t=this._require(!1),n=de(t);if(!e||e.colValue==null)throw C(`postsolve requires colValue`);return I(e.colValue,n.numCols,`colValue`),e.colDual!=null&&I(e.colDual,n.numCols,`colDual`),e.rowDual!=null&&I(e.rowDual,n.numRows,`rowDual`),D(H(function(n){return _(`Highs_postsolve`,4)(t,n.doubles(e.colValue),e.colDual?n.doubles(e.colDual):0,e.rowDual?n.doubles(e.rowDual):0)}))}getObjectiveOffset(){let e=this._require(!1);return H(function(t){let n=t.outDoubles(1);return O(_(`Highs_getObjectiveOffset`,2)(e,n),x()[n>>3])})}getModel(e){return ge(this,`Highs_getModel`,e,!0)}getPresolvedLp(e){return ge(this,`Highs_getPresolvedLp`,e,!1)}getFixedLp(e){let t=ge(this,`Highs_getFixedLp`,e,!1);return t.status!==-1&&t.value&&t.value.integrality.fill(0),t}ensureRowwise(){return this._simple(`Highs_ensureRowwise`)}addVars(e,t){let n=this._require(!1);return M(e,`lower`),I(t,e.length,`upper`),I(e,e.length,`lower`),D(H(function(r){return _(`Highs_addVars`,4)(n,e.length,r.doubles(e),r.doubles(t))}))}addCol(e,t,n,r){let i=this._require(!1);return F(e,`cost`),F(t,`lower`),F(n,`upper`),_e(r,J(i).numRows),D(H(function(a){return _(`Highs_addCol`,7)(i,e,t,n,r.indices.length,a.ints(r.indices),a.doubles(r.values))}))}addCols(e){let t=this._require(!1),n=J(t).numRows;if(!e||!e.matrix)throw C(`column data and matrix are required`);let r=e.cost.length;if(I(e.cost,r,`cost`),I(e.lower,r,`lower`),I(e.upper,r,`upper`),e.matrix.format!==`csc`)throw C(`addCols requires a csc matrix`);let i=te(e.matrix,n,r,`matrix`);return D(H(function(n){return _(`Highs_addCols`,9)(t,r,n.doubles(e.cost),n.doubles(e.lower),n.doubles(e.upper),i,n.ints(Array.prototype.slice.call(e.matrix.starts,0,-1)),n.ints(e.matrix.indices),n.doubles(e.matrix.values))}))}changeObjectiveSense(e){if(e!==1&&e!==-1)throw C(`sense must be 1 or -1`);return D(_(`Highs_changeObjectiveSense`,2)(this._require(!1),e))}changeColIntegrality(e,t){if(A(e,`column`,0),A(t,`integrality`,0),t>4)throw C(`integrality must be between 0 and 4`);return D(_(`Highs_changeColIntegrality`,3)(this._require(!1),e,t))}changeColCost(e,t){return A(e,`column`,0),F(t,`cost`),D(_(`Highs_changeColCost`,3)(this._require(!1),e,t))}changeRowBounds(e,t,n){return A(e,`row`,0),F(t,`lower`),F(n,`upper`),D(_(`Highs_changeRowBounds`,4)(this._require(!1),e,t,n))}changeColsIntegrality(e,t){let n=J(this._require(!1)).numCols;return Y(this,`changeColsIntegrality`,e,[],[t],n,`columns`)}changeColsBounds(e,t,n){let r=J(this._require(!1)).numCols;return Y(this,`changeColsBounds`,e,[t,n],[],r,`columns`)}deleteCols(e){return X(this,`Cols`,e,J(this._require(!1)).numCols)}scaleCol(e,t){return A(e,`column`,0),F(t,`factor`),D(_(`Highs_scaleCol`,3)(this._require(!1),e,t))}getCols(e){return Z(this,`Cols`,e)}getColName(e){return ve(this,`Highs_js_getColName`,e)}getPresolvedColName(e){return ve(this,`Highs_js_getPresolvedColName`,e)}getColByName(e){return ye(this,`Col`,e)}getColIntegrality(e){let t=this._require(!1);return A(e,`column`,0),H(function(n){let r=n.outInts(1);return O(_(`Highs_getColIntegrality`,3)(t,e,r),b()[r>>2])})}getPrimalRay(){return be(this,`Highs_getPrimalRay`,J(this._require(!1)).numCols)}getDualUnboundednessDirection(){return be(this,`Highs_getDualUnboundednessDirection`,J(this._require(!1)).numCols)}getBasisInverseRow(e,t){return xe(this,`Highs_getBasisInverseRow`,e,J(this._require(!1)).numRows,t)}getBasisSolve(e,t){return Se(this,`Highs_getBasisSolve`,e,t)}getReducedRow(e,t){let n=this._require(!1),r=J(n);return A(e,`row`,0),H(function(i){let a=i.outDoubles(r.numCols),o=i.outInts(1),s=i.outInts(r.numCols),c=_(`Highs_getReducedRow`,5)(n,e,a,o,s),l={values:W(a,r.numCols)};return t&&(l.nonzeroIndices=U(s,b()[o>>2])),O(c,l)})}crossover(e){let t=this._require(!1),n=J(t);if(!e||e.colValue==null)throw C(`crossover requires colValue`);if(I(e.colValue,n.numCols,`colValue`),e.colDual==null!=(e.rowDual==null))throw C(`colDual and rowDual must be supplied together`);return e.colDual&&I(e.colDual,n.numCols,`colDual`),e.rowDual&&I(e.rowDual,n.numRows,`rowDual`),D(H(function(r){return _(`Highs_crossover`,6)(t,n.numCols,n.numRows,r.doubles(e.colValue),e.colDual?r.doubles(e.colDual):0,e.rowDual?r.doubles(e.rowDual):0)}))}getRanging(){let e=this._require(!1),t=J(e);return H(function(n){let r=Ce(n,t.numCols),i=Ce(n,t.numCols),a=Ce(n,t.numCols),o=Ce(n,t.numCols),s=Ce(n,t.numRows),c=Ce(n,t.numRows),l=[r,i,a,o,s,c],u=[e];return l.forEach(function(e){u.push(e.valuePointer,e.objectivePointer,e.inPointer,e.outPointer)}),O(_(`Highs_getRanging`,u.length).apply(null,u),{colCostUp:r.detach(),colCostDown:i.detach(),colBoundUp:a.detach(),colBoundDown:o.detach(),rowBoundUp:s.detach(),rowBoundDown:c.detach()})})}setCallback(e){let t=this._require(!1);if(e!=null&&typeof e!=`function`)throw C(`callback must be a function or undefined`);let n=this._callbackId;if(!e){let e=_(`Highs_js_setCallback`,3)(t,0,0);return e!==-1&&(n&&a.delete(n),this._callbackId=0),D(e)}let r=c++;a.set(r,{raw:this,callback:e});let i=_(`Highs_js_setCallback`,3)(t,Oe(),r);return i===-1?a.delete(r):(n&&a.delete(n),this._callbackId=r),D(i)}startCallback(e){return ke(e),D(_(`Highs_startCallback`,2)(this._require(!1),e))}dispose(){if(On(this,n,`f`))return;let e=this._require(!1);this._callbackId&&a.delete(this._callbackId),o.delete(e),_(`Highs_destroy`,1,null)(e),Dn(this,t,0,`f`),Dn(this,n,!0,`f`)}_simple(e){return D(_(e,1)(this._require(!1)))}clearModel(){return this._simple(`Highs_clearModel`)}releaseMemory(){return this._simple(`Highs_releaseMemory`)}zeroAllClocks(){return this._simple(`Highs_zeroAllClocks`)}run(){let e=this._require(!1);return this._callbackNumCols=J(e).numCols,D(_(`Highs_run`,1)(e))}exportModel(e){let t=this._require(!1);if(e!==`lp`&&e!==`mps`)throw C(`format must be 'lp' or 'mps'`);return ce(e,e===`lp`?`utf8`:void 0,function(e){return v(`Highs_writeModel`,1,0)(t,e)})}exportSolution(e){let t=this._require(!1);return ce(`sol`,`utf8`,function(n){return v(e?`Highs_writeSolutionPretty`:`Highs_writeSolution`,1,0)(t,n)})}passLp(e){let t=this._require(!1),n=H(function(n){let i=B(e),a=e.matrix,o=pe(e,n,!1);return _(`Highs_passLp`,15)(t,i.numCols,i.numRows,i.numNonzeros,r[a.format],i.sense,e.offset==null?0:e.offset,...o)}),i=n===-1?n:he(t,e);return D(n===-1||i===-1?-1:Math.max(n,i))}passLinearObjectives(e){let t=this._require(!1),n=J(t).numCols;return M(e,`objectives`),D(H(function(r){let i=e.length,a=new Float64Array(i),o=new Float64Array(i),s=new Float64Array(i*n),c=new Float64Array(i),l=new Float64Array(i),u=new Int32Array(i);for(let t=0;t<i;t++){let r=e[t];ne(r,n,`objectives[`+t+`]`),a[t]=r.weight,o[t]=r.offset,s.set(r.coefficients,t*n),c[t]=r.absoluteTolerance,l[t]=r.relativeTolerance,u[t]=j(r.priority,`objectives[`+t+`].priority`)}return _(`Highs_passLinearObjectives`,8)(t,i,r.doubles(a),r.doubles(o),r.doubles(s),r.doubles(c),r.doubles(l),r.ints(u))}))}clearLinearObjectives(){return this._simple(`Highs_clearLinearObjectives`)}passColName(e,t){let n=this._require(!1);if(A(e,`column`,0),typeof t!=`string`)throw C(`name must be a string`);return D(v(`Highs_passColName`,2,0)(n,e,t))}setOptionValue(e,t){let n=this._require(!1);if(!le(e))return D(-1);let r=typeof t,i;if(r===`boolean`)i=v(`Highs_setBoolOptionValue`,1,1)(n,e,+!!t);else if(r===`string`)i=g(`Highs_setStringOptionValue`,`number`,[`number`,`string`,`string`])(n,e,t);else if(r===`number`){if(!Number.isFinite(t))throw C(`numeric option values must be finite`);Number.isSafeInteger(t)&&t>=-2147483648&&t<=2147483647?(i=v(`Highs_setIntOptionValue`,1,1)(n,e,t),i===-1&&(i=v(`Highs_setDoubleOptionValue`,1,1)(n,e,t))):i=v(`Highs_setDoubleOptionValue`,1,1)(n,e,t)}else throw C(`option values must be boolean, number, or string`);return D(i)}getOptionValue(e){let t=this._require(!1);if(!le(e))return O(-1);let n=this.getOptionType(e);return n.status===-1?O(-1):H(function(r){if(n.value===`string`){let n=r.bytes(512);return O(v(`Highs_getStringOptionValue`,1,1)(t,e,n),S(n))}if(n.value===`double`){let n=r.outDoubles(1);return O(v(`Highs_getDoubleOptionValue`,1,1)(t,e,n),x()[n>>3])}let i=r.outInts(1),a=v(n.value===`boolean`?`Highs_getBoolOptionValue`:`Highs_getIntOptionValue`,1,1)(t,e,i),o=b()[i>>2];return O(a,n.value===`boolean`?!!o:o)})}readOptions(e){let t=this._require(!1);if(typeof e!=`string`)throw C(`option data must be a string`);for(let t of e.split(/\r?\n/)){let e=/^\s*([A-Za-z][A-Za-z0-9_]*)\b/.exec(t);if(e&&!t.trimStart().startsWith(`#`)&&!le(e[1]))return D(-1)}return D(se(e,`options`,function(e){return v(`Highs_readOptions`,1,0)(t,e)}))}getNumOptions(){return _(`Highs_getNumOptions`,1)(this._require(!1))}getOptionValues(e){let t=this._require(!1);if(!le(e))return O(-1);let n=this.getOptionType(e);return n.status===-1?O(-1):H(function(r){let i=n.value;if(i===`boolean`){let n=r.outInts(1),a=r.outInts(1);return O(v(`Highs_getBoolOptionValues`,1,2)(t,e,n,a),{name:e,type:i,current:!!b()[n>>2],default:!!b()[a>>2]})}if(i===`integer`){let n=r.outInts(1),a=r.outInts(1),o=r.outInts(1),s=r.outInts(1);return O(v(`Highs_getIntOptionValues`,1,4)(t,e,n,a,o,s),{name:e,type:i,current:b()[n>>2],default:b()[s>>2],minimum:b()[a>>2],maximum:b()[o>>2]})}if(i===`double`){let n=r.outDoubles(1),a=r.outDoubles(1),o=r.outDoubles(1),s=r.outDoubles(1);return O(v(`Highs_getDoubleOptionValues`,1,4)(t,e,n,a,o,s),{name:e,type:i,current:x()[n>>3],default:x()[s>>3],minimum:x()[a>>3],maximum:x()[o>>3]})}let a=r.bytes(512),o=r.bytes(512);return O(v(`Highs_getStringOptionValues`,1,2)(t,e,a,o),{name:e,type:i,current:S(a),default:S(o)})})}getInfoValue(e){let t=this._require(!1),n=this.getInfoType(e);return n.status===-1?O(-1):H(function(r){if(n.value===`double`){let n=r.outDoubles(1);return O(v(`Highs_getDoubleInfoValue`,1,1)(t,e,n),x()[n>>3])}if(n.value===`int64`){let n=r.bytes(8);return O(v(`Highs_getInt64InfoValue`,1,1)(t,e,n),ie(n))}let i=r.outInts(1);return O(v(`Highs_getIntInfoValue`,1,1)(t,e,i),b()[i>>2])})}getPresolvedDimensions(){return de(this._require(!1))}getSizeofHighsInt(){return _(`Highs_getSizeofHighsInt`,1)(this._require(!1))}getObjectiveValue(){return _(`Highs_getObjectiveValue`,1)(this._require(!1))}getBasis(){let e=this._require(!1),t=this.getModelStatus();if(t===0||t===6)throw new d(`The model has not been solved`,`getBasis`);let n=J(e);return H(function(t){let r=t.outInts(n.numCols),i=t.outInts(n.numRows);return O(_(`Highs_getBasis`,3)(e,r,i),{colStatus:U(r,n.numCols),rowStatus:U(i,n.numRows)})})}setSparseSolution(e){let t=this._require(!1);if(!e)throw C(`solution is required`);let n=e.indices.length;return L(e.indices,null,`indices`,J(t).numCols),I(e.values,n,`values`),D(H(function(r){return _(`Highs_setSparseSolution`,4)(t,n,r.ints(e.indices),r.doubles(e.values))}))}setLogicalBasis(){return this._simple(`Highs_setLogicalBasis`)}getObjectiveSense(){let e=this._require(!1);return H(function(t){let n=t.outInts(1);return O(_(`Highs_getObjectiveSense`,2)(e,n),b()[n>>2])})}getLp(e){return ge(this,`Highs_getLp`,e,!1)}getIisLp(e){return ge(this,`Highs_getIisLp`,e,!1)}ensureColwise(){return this._simple(`Highs_ensureColwise`)}addVar(e,t){return F(e,`lower`),F(t,`upper`),D(_(`Highs_addVar`,3)(this._require(!1),e,t))}addRow(e,t,n){let r=this._require(!1);return F(e,`lower`),F(t,`upper`),_e(n,J(r).numCols),D(H(function(i){return _(`Highs_addRow`,6)(r,e,t,n.indices.length,i.ints(n.indices),i.doubles(n.values))}))}addRows(e){let t=this._require(!1),n=J(t).numCols;if(!e||!e.matrix)throw C(`row data and matrix are required`);let r=e.lower.length;if(I(e.lower,r,`lower`),I(e.upper,r,`upper`),e.matrix.format!==`csr`)throw C(`addRows requires a csr matrix`);let i=te(e.matrix,r,n,`matrix`);return D(H(function(n){return _(`Highs_addRows`,8)(t,r,n.doubles(e.lower),n.doubles(e.upper),i,n.ints(Array.prototype.slice.call(e.matrix.starts,0,-1)),n.ints(e.matrix.indices),n.doubles(e.matrix.values))}))}changeObjectiveOffset(e){return F(e,`offset`),D(_(`Highs_changeObjectiveOffset`,2)(this._require(!1),e))}clearIntegrality(){return this._simple(`Highs_clearIntegrality`)}changeColBounds(e,t,n){return A(e,`column`,0),F(t,`lower`),F(n,`upper`),D(_(`Highs_changeColBounds`,4)(this._require(!1),e,t,n))}changeCoeff(e,t,n){return A(e,`row`,0),A(t,`column`,0),F(n,`value`),D(_(`Highs_changeCoeff`,4)(this._require(!1),e,t,n))}changeColsCost(e,t){let n=J(this._require(!1)).numCols;return Y(this,`changeColsCost`,e,[t],[],n,`columns`)}changeRowsBounds(e,t,n){let r=J(this._require(!1)).numRows;return Y(this,`changeRowsBounds`,e,[t,n],[],r,`rows`)}deleteRows(e){return X(this,`Rows`,e,J(this._require(!1)).numRows)}scaleRow(e,t){return A(e,`row`,0),F(t,`factor`),D(_(`Highs_scaleRow`,3)(this._require(!1),e,t))}getRows(e){return Z(this,`Rows`,e)}getRowName(e){return ve(this,`Highs_js_getRowName`,e)}getPresolvedRowName(e){return ve(this,`Highs_js_getPresolvedRowName`,e)}getRowByName(e){return ye(this,`Row`,e)}getDualRay(){return be(this,`Highs_getDualRay`,J(this._require(!1)).numRows)}getBasicVariables(){let e=this._require(!1),t=J(e).numRows;return H(function(n){let r=n.outInts(t);return O(_(`Highs_getBasicVariables`,2)(e,r),U(r,t))})}getBasisInverseCol(e,t){return xe(this,`Highs_getBasisInverseCol`,e,J(this._require(!1)).numRows,t)}getBasisTransposeSolve(e,t){return Se(this,`Highs_getBasisTransposeSolve`,e,t)}getReducedColumn(e,t){return xe(this,`Highs_getReducedColumn`,e,J(this._require(!1)).numRows,t)}feasibilityRelaxation(e){let t=this._require(!1),n=J(t);if(!e)throw C(`relaxation input is required`);return F(e.globalLowerPenalty,`globalLowerPenalty`),F(e.globalUpperPenalty,`globalUpperPenalty`),F(e.globalRowPenalty,`globalRowPenalty`),D(H(function(r){function i(e,t,n){return e==null?0:(I(e,t,n),r.doubles(e))}return _(`Highs_feasibilityRelaxation`,7)(t,e.globalLowerPenalty,e.globalUpperPenalty,e.globalRowPenalty,i(e.localLowerPenalty,n.numCols,`localLowerPenalty`),i(e.localUpperPenalty,n.numCols,`localUpperPenalty`),i(e.localRowPenalty,n.numRows,`localRowPenalty`))}))}getIis(){let e=this._require(!1),t=J(e);return H(function(n){let r=n.outInts(1),i=n.outInts(1),a=n.outInts(t.numCols),o=n.outInts(t.numRows),s=n.outInts(t.numCols),c=n.outInts(t.numRows),l=n.outInts(t.numCols),u=n.outInts(t.numRows),d=_(`Highs_getIis`,9)(e,r,i,a,o,s,c,l,u);if(d===-1)return O(d);let f=b()[r>>2],p=b()[i>>2];if(f<0||f>t.numCols||p<0||p>t.numRows)throw RangeError(`HiGHS returned invalid IIS dimensions`);return O(d,{colIndex:U(a,f),rowIndex:U(o,p),colBound:U(s,f),rowBound:U(c,p),colStatus:U(l,t.numCols),rowStatus:U(u,t.numRows)})})}stopCallback(e){return ke(e),D(_(`Highs_stopCallback`,2)(this._require(!1),e))}}t=new WeakMap,n=new WeakMap;function pe(e,t,n){let r=e.matrix;return t.pack([{type:`f64`,values:e.colCost},{type:`f64`,values:e.colLower},{type:`f64`,values:e.colUpper},{type:`f64`,values:e.rowLower},{type:`f64`,values:e.rowUpper},{type:`i32`,values:Array.prototype.slice.call(r.starts,0,-1)},{type:`i32`,values:r.indices},{type:`f64`,values:r.values},...n?[{type:`i32`,values:e.integrality}]:[]])}function me(e,t){let n=B(e),a=e.matrix,o=e.hessian,s=t.pack([{type:`f64`,values:e.colCost},{type:`f64`,values:e.colLower},{type:`f64`,values:e.colUpper},{type:`f64`,values:e.rowLower},{type:`f64`,values:e.rowUpper},{type:`i32`,values:Array.prototype.slice.call(a.starts,0,-1)},{type:`i32`,values:a.indices},{type:`f64`,values:a.values},...o?[{type:`i32`,values:Array.prototype.slice.call(o.starts,0,-1)},{type:`i32`,values:o.indices},{type:`f64`,values:o.values}]:[],...e.integrality?[{type:`i32`,values:e.integrality}]:[]]),c=0,l=s[c++],u=s[c++],d=s[c++],f=s[c++],p=s[c++],m=s[c++],h=s[c++],g=s[c++],_=o?s[c++]:0,v=o?s[c++]:0,y=o?s[c++]:0,b=e.integrality?s[c]:0;return{shape:n,values:[n.numCols,n.numRows,n.numNonzeros,n.hessianNonzeros,r[a.format],o?i[o.format]:1,n.sense,e.offset==null?0:e.offset,l,u,d,f,p,m,h,g,_,v,y,b]}}function he(e,t){let n=0;if(t.modelName!=null&&(n=Math.max(n,v(`Highs_passModelName`,1,0)(e,String(t.modelName)))),t.colNames!=null){N(t.colNames,t.numCols,`colNames`);for(let r=0;r<t.colNames.length;r++){let i=v(`Highs_passColName`,2,0)(e,r,String(t.colNames[r]));if(i===-1)return i;n=Math.max(n,i)}}if(t.rowNames!=null){N(t.rowNames,t.numRows,`rowNames`);for(let r=0;r<t.rowNames.length;r++){let i=v(`Highs_passRowName`,2,0)(e,r,String(t.rowNames[r]));if(i===-1)return i;n=Math.max(n,i)}}return n}function ge(e,t,n,i){let a=e._require(!1),o=t!==`Highs_getFixedLp`,s=n??`csc`;if(!(s in r))throw C(`format must be 'csc' or 'csr'`);let c=t===`Highs_getModel`||t===`Highs_getLp`?J(a):t===`Highs_getPresolvedLp`?de(a):t===`Highs_getFixedLp`?J(a):void 0;return H(function(e){let n=e.outInts(1),l=e.outInts(1),u=e.outInts(1),d=i?e.outInts(1):0,f=e.outInts(1),p=e.outDoubles(1),m=i?21:o?16:15,h=0,g=c?.numCols??0,v=c?.numRows??0,y=c?.numNonzeros??0,S=i?c?.hessianNonzeros??0:0;if(!c){let e=i?[a,r[s],1,n,l,u,d,f,p]:[a,r[s],n,l,u,f,p],c=i?Array(12).fill(0):Array(o?9:8).fill(0);if(h=_(t,m).apply(null,e.concat(c)),h===-1)return O(h);g=b()[n>>2],v=b()[l>>2],y=b()[u>>2],S=i?b()[d>>2]:0}let C=s===`csc`?g:v,w=e.outDoubles(g),T=e.outDoubles(g),E=e.outDoubles(g),ee=e.outDoubles(v),D=e.outDoubles(v),k=e.outInts(C),A=e.outInts(y),j=e.outDoubles(y),M=o?e.outInts(g):0,N=i?e.outInts(g):0,P=i?e.outInts(S):0,F=i?e.outDoubles(S):0,I=i?[a,r[s],1,n,l,u,d,f,p,w,T,E,ee,D,k,A,j,N,P,F,M]:[a,r[s],n,l,u,f,p,w,T,E,ee,D,k,A,j].concat(o?[M]:[]);if(h=_(t,m).apply(null,I),h===-1)return O(h);let L=new Int32Array(C+1);L.set(U(k,C)),L[C]=y;let R={numCols:g,numRows:v,sense:b()[f>>2],offset:x()[p>>3],colCost:W(w,g),colLower:W(T,g),colUpper:W(E,g),rowLower:W(ee,v),rowUpper:W(D,v),matrix:{format:s,numRows:v,numCols:g,starts:L,indices:U(A,y),values:W(j,y)},integrality:o?U(M,g):new Int32Array(g)};if(i&&S){let e=new Int32Array(g+1);e.set(U(N,g)),e[g]=S,R.hessian={format:`triangular`,dimension:g,starts:e,indices:U(P,S),values:W(F,S)}}return O(h,R)})}function _e(e,t){if(!e)throw C(`entries are required`);L(e.indices,null,`entries.indices`,t),I(e.values,e.indices.length,`entries.values`)}function Y(e,t,n,r,i,a,o){let s=e._require(!1);return D(H(function(e){let c=q(n,a,e,o),l=c.suffix===`ByMask`?a:c.count,u=r.map(function(t,n){return I(t,l,o+` values `+n),e.doubles(t)}),d=i.map(function(t,n){return L(t,l,o+` integer values `+n),e.ints(t)}),f=[s].concat(c.prefix,u,d);return _(`Highs_`+t+c.suffix,f.length).apply(null,f)}))}function X(e,t,n,r){let i=e._require(!1);return D(H(function(e){let a=q(n,r,e,t.toLowerCase()),o=[i].concat(a.prefix);return _(`Highs_delete`+t+a.suffix,o.length).apply(null,o)}))}function Z(e,t,n){let r=e._require(!1),i=J(r),a=t===`Cols`,o=a?i.numCols:i.numRows;return H(function(e){let s=q(n,o,e,t.toLowerCase()),c=e.outInts(1),l=e.outInts(1),u=a?3:2,d=[r].concat(s.prefix,[c],Array(u).fill(0),[l,0,0,0]),f=`Highs_get`+t+s.suffix,p=_(f,d.length).apply(null,d);if(p===-1)return O(p);let m=b()[c>>2],h=b()[l>>2],g=a?e.outDoubles(m):0,v=e.outDoubles(m),y=e.outDoubles(m),x=e.outInts(m),S=e.outInts(h),C=e.outDoubles(h),w=[r].concat(s.prefix,[c],a?[g,v,y]:[v,y],[l,x,S,C]);if(p=_(f,w.length).apply(null,w),p===-1)return O(p);let T=new Int32Array(m+1);T.set(U(x,m)),T[m]=h;let E={format:a?`csc`:`csr`,numRows:a?i.numRows:m,numCols:a?m:i.numCols,starts:T,indices:U(S,h),values:W(C,h)};return O(p,a?{count:m,cost:W(g,m),lower:W(v,m),upper:W(y,m),matrix:E}:{count:m,lower:W(v,m),upper:W(y,m),matrix:E})})}function ve(e,t,n){let r=e._require(!1);return A(n,`index`,0),H(function(e){let i=e.outInts(1),a=_(t,5)(r,n,0,0,i);if(a===-1)return O(a);let o=b()[i>>2];if(o<=0)return O(a,``);let s=e.bytes(o);return a=_(t,5)(r,n,s,o,i),O(a,S(s))})}function ye(e,t,n){let r=e._require(!1);if(typeof n!=`string`)throw C(`name must be a string`);return H(function(e){let i=e.outInts(1);return O(v(`Highs_get`+t+`ByName`,1,1)(r,n,i),b()[i>>2])})}function be(e,t,n){let r=e._require(!1);return H(function(e){let i=e.outInts(1),a=e.outDoubles(n);return O(_(t,3)(r,i,a),b()[i>>2]?{values:W(a,n)}:void 0)})}function xe(e,t,n,r,i){let a=e._require(!1);return H(function(e){let o=e.outDoubles(r),s=e.outInts(1),c=e.outInts(r);if(n==null)throw C(`an index is required`);A(n,`index`,0);let l=[a,n,o,s,c],u=_(t,l.length).apply(null,l),d={values:W(o,r)};return i&&(d.nonzeroIndices=U(c,b()[s>>2])),O(u,d)})}function Se(e,t,n,r){let i=e._require(!1),a=J(i).numRows;return I(n,a,`rhs`),H(function(e){let o=e.outDoubles(a),s=e.outInts(1),c=e.outInts(a),l=_(t,5)(i,e.doubles(n),o,s,c),u={values:W(o,a)};return r&&(u.nonzeroIndices=U(c,b()[s>>2])),O(l,u)})}function Ce(e,t){return{valuePointer:e.outDoubles(t),objectivePointer:e.outDoubles(t),inPointer:e.outInts(t),outPointer:e.outInts(t),detach:function(){return{value:W(this.valuePointer,t),objective:W(this.objectivePointer,t),inVariable:U(this.inPointer,t),outVariable:U(this.outPointer,t)}}}}function we(e,t){return v(`Highs_getCallbackDataOutItem`,1,0)(e,t)}function Te(e,t,n){let r=we(e,t);if(r)return n===`double`?x()[r>>3]:n===`int64`?ie(r):b()[r>>2]}let Ee=[[`running_time`,`double`],[`objective_function_value`,`double`],[`mip_node_count`,`int64`],[`mip_total_lp_iterations`,`int64`],[`mip_primal_bound`,`double`],[`mip_dual_bound`,`double`],[`mip_gap`,`double`]];function De(e,t,n,r,i){let o=a.get(i);if(!o)return;let s=o.raw,c=o.callback,l=!0;function u(){if(!l)throw C(`callback controls expire when the callback returns`)}s._callbackDepth+=1;try{let i={numCols:s._callbackNumCols},a={};if((e===0?[[`log_type`,`int`]]:e===1?[[`simplex_iteration_count`,`int`]]:e===2?[[`ipm_iteration_count`,`int`]]:e>=3&&e<=9?Ee:[]).forEach(function(e){let t=Te(n,e[0],e[1]);t!==void 0&&(a[e[0]]=t)}),e===3||e===4){let e=we(n,`mip_solution`),t=_(`Highs_js_getCallbackMipSolutionSize`,1)(n);if(t<0)throw RangeError(`HiGHS returned an invalid MIP solution size`);if(e)a.mip_solution=W(e,t);else if(t)throw RangeError(`HiGHS returned a null MIP solution`)}if(e===7){let e=Te(n,`cutpool_num_cut`,`int`),t=Te(n,`cutpool_num_nz`,`int`),r=Te(n,`cutpool_num_col`,`int`);if(typeof e==`number`&&typeof t==`number`&&typeof r==`number`&&e>=0&&t>=0){let i=we(n,`cutpool_start`),o=we(n,`cutpool_index`),s=we(n,`cutpool_value`),c=we(n,`cutpool_lower`),l=we(n,`cutpool_upper`);i&&o&&s&&c&&l&&(a.cut_pool={numCols:r,numCuts:e,starts:U(i,e+1),indices:U(o,t),values:W(s,t),lower:W(c,e),upper:W(l,e)})}}let o={type:e,message:S(t),data:a};e===9?(o.setSolution=function(e){u();try{return e&&e.indices?(L(e.indices,null,`indices`,i.numCols),I(e.values,e.indices.length,`values`),D(H(function(t){return _(`Highs_setCallbackSparseSolution`,4)(r,e.indices.length,t.ints(e.indices),t.doubles(e.values))}))):(I(e,i.numCols,`solution`),D(H(function(t){return _(`Highs_setCallbackSolution`,3)(r,i.numCols,t.doubles(e))})))}catch(e){return s._rememberCallbackError(e),D(-1)}},o.repairSolution=function(){return u(),D(_(`Highs_repairCallbackSolution`,1)(r))}):(e===1||e===2||e===6)&&(o.interrupt=function(){u(),b()[r>>2]=1});let l=c(o);if(l&&(typeof l==`object`||typeof l==`function`)&&typeof l.then==`function`)throw Promise.resolve(l).catch(function(){}),C(`callbacks must be synchronous and return undefined`)}catch(t){s._rememberCallbackError(t),(e===1||e===2||e===6)&&r&&(b()[r>>2]=1)}finally{l=!1,--s._callbackDepth}}function Oe(){return u||=Rt(De,`viiiii`),u}function ke(e){if(A(e,`callback type`,0),e===8||e>9)throw C(`callback type must be one of 0..7 or 9`)}function Ae(e,t,n=void 0){if(e.status===-1)throw T(t);return n&&n._setLast(e.status,t),e.value}class je{constructor(e){this.raw=e,this.lastCall={status:0,warnings:[]},this.options=new Me(this),this.info=new Ne(this)}get disposed(){return this.raw.disposed}_setLast(e,t){return this.lastCall=k(e,t),this.lastCall}_value(e,t=[]){return Ae(this.raw[e].apply(this.raw,t||[]),e,this)}exportModel(e){return this._value(`exportModel`,[e])}exportSolution(e){return this._value(`exportSolution`,[e])}getPresolvedDimensions(){return this.raw.getPresolvedDimensions()}getModelStatus(){return this.raw.getModelStatus()}setSolution(e){if(e==null)throw C(`solution is required`);return this._status(e.indices?`setSparseSolution`:`setSolution`,[e])}setLogicalBasis(){return this._status(`setLogicalBasis`)}dispose(){this.raw.dispose()}_status(e,t=[]){let n=this.raw[e].apply(this.raw,t||[]);return this._setLast(n.status,e)}exportPresolvedModel(e){return this._value(`exportPresolvedModel`,[e])}getDimensions(){return this.raw.getDimensions()}getRunTime(){return this.raw.getRunTime()}getObjectiveValue(){return this.raw.getObjectiveValue()}getObjectiveSense(){return this._value(`getObjectiveSense`)}getObjectiveOffset(){return this._value(`getObjectiveOffset`)}setBasis(e){return e==null?this._status(`setLogicalBasis`):this._status(`setBasis`,[e])}run(e){let t=this.raw,n=[],r=!1;try{if(e&&Object.keys(e).length){if(t._callbackId)throw C(`run callbacks cannot replace a callback registered through model.raw`);if(t.setCallback(function(t){let n=e[t.type];if(n)return n(t)}).status===-1)throw T(`setCallback`);r=!0,Object.keys(e).forEach(function(e){let r=Number(e);if(ke(r),t.startCallback(r).status===-1)throw T(`startCallback`);n.push(r)})}let i=t.run(),a=this._setLast(i.status,`run`);return{status:a.status,warnings:a.warnings,modelStatus:t.getModelStatus()}}finally{try{for(let e=0;e<n.length;e++)t.stopCallback(n[e])}finally{r&&t.setCallback(void 0)}}}clear(...e){return this._status(`clear`,e)}clearModel(...e){return this._status(`clearModel`,e)}clearSolver(...e){return this._status(`clearSolver`,e)}releaseMemory(...e){return this._status(`releaseMemory`,e)}readModel(...e){return this._status(`readModel`,e)}passModel(...e){return this._status(`passModel`,e)}passHessian(...e){return this._status(`passHessian`,e)}passLinearObjectives(...e){return this._status(`passLinearObjectives`,e)}addLinearObjective(...e){return this._status(`addLinearObjective`,e)}clearLinearObjectives(...e){return this._status(`clearLinearObjectives`,e)}presolve(...e){return this._status(`presolve`,e)}postsolve(...e){return this._status(`postsolve`,e)}zeroAllClocks(...e){return this._status(`zeroAllClocks`,e)}addVar(...e){return this._status(`addVar`,e)}addVars(...e){return this._status(`addVars`,e)}addCol(...e){return this._status(`addCol`,e)}addCols(...e){return this._status(`addCols`,e)}addRow(...e){return this._status(`addRow`,e)}addRows(...e){return this._status(`addRows`,e)}ensureColwise(...e){return this._status(`ensureColwise`,e)}ensureRowwise(...e){return this._status(`ensureRowwise`,e)}changeObjectiveSense(...e){return this._status(`changeObjectiveSense`,e)}changeObjectiveOffset(...e){return this._status(`changeObjectiveOffset`,e)}changeColIntegrality(...e){return this._status(`changeColIntegrality`,e)}changeColsIntegrality(...e){return this._status(`changeColsIntegrality`,e)}clearIntegrality(...e){return this._status(`clearIntegrality`,e)}changeColCost(...e){return this._status(`changeColCost`,e)}changeColsCost(...e){return this._status(`changeColsCost`,e)}changeColBounds(...e){return this._status(`changeColBounds`,e)}changeColsBounds(...e){return this._status(`changeColsBounds`,e)}changeRowBounds(...e){return this._status(`changeRowBounds`,e)}changeRowsBounds(...e){return this._status(`changeRowsBounds`,e)}deleteCols(...e){return this._status(`deleteCols`,e)}deleteRows(...e){return this._status(`deleteRows`,e)}scaleCol(...e){return this._status(`scaleCol`,e)}scaleRow(...e){return this._status(`scaleRow`,e)}passColName(...e){return this._status(`passColName`,e)}passRowName(...e){return this._status(`passRowName`,e)}passModelName(...e){return this._status(`passModelName`,e)}crossover(...e){return this._status(`crossover`,e)}feasibilityRelaxation(...e){return this._status(`feasibilityRelaxation`,e)}changeCoefficient(...e){return this._status(`changeCoeff`,e)}getSolution(...e){return this._value(`getSolution`,e)}getBasis(...e){return this._value(`getBasis`,e)}getPrimalRay(...e){return this._value(`getPrimalRay`,e)}getDualRay(...e){return this._value(`getDualRay`,e)}getDualUnboundednessDirection(...e){return this._value(`getDualUnboundednessDirection`,e)}getModel(...e){return this._value(`getModel`,e)}getLp(...e){return this._value(`getLp`,e)}getPresolvedLp(...e){return this._value(`getPresolvedLp`,e)}getIisLp(...e){return this._value(`getIisLp`,e)}getFixedLp(...e){return this._value(`getFixedLp`,e)}getCols(...e){return this._value(`getCols`,e)}getRows(...e){return this._value(`getRows`,e)}getColName(...e){return this._value(`getColName`,e)}getRowName(...e){return this._value(`getRowName`,e)}getPresolvedColName(...e){return this._value(`getPresolvedColName`,e)}getPresolvedRowName(...e){return this._value(`getPresolvedRowName`,e)}getColByName(...e){return this._value(`getColByName`,e)}getRowByName(...e){return this._value(`getRowByName`,e)}getColIntegrality(...e){return this._value(`getColIntegrality`,e)}getBasicVariables(...e){return this._value(`getBasicVariables`,e)}getBasisInverseRow(...e){return this._value(`getBasisInverseRow`,e)}getBasisInverseCol(...e){return this._value(`getBasisInverseCol`,e)}getBasisSolve(...e){return this._value(`getBasisSolve`,e)}getBasisTransposeSolve(...e){return this._value(`getBasisTransposeSolve`,e)}getReducedRow(...e){return this._value(`getReducedRow`,e)}getReducedColumn(...e){return this._value(`getReducedColumn`,e)}getRanging(...e){return this._value(`getRanging`,e)}getIis(...e){return this._value(`getIis`,e)}}class Me{constructor(e){this._model=e}set(e,t){if(typeof e==`object`&&e){Object.keys(e).forEach(K);let t=0;return Object.keys(e).forEach(function(n){let r=this._model.raw.setOptionValue(n,e[n]);if(r.status===-1)throw T(`setOptionValue`);t=Math.max(t,r.status)}.bind(this)),this._model._setLast(t,`setOptionValue`)}return K(e),this._model._status(`setOptionValue`,[e,t])}describe(e){return K(e),this._model._value(`getOptionValues`,[e])}reset(){return this._model._status(`resetOptions`)}export(e){return this._model._value(`exportOptions`,[e])}get(e){return K(e),this._model._value(`getOptionValue`,[e])}names(){let e=this._model.raw.getNumOptions(),t=[];for(let n=0;n<e;n++){let e=this._model.raw.getOptionName(n);if(e.status===-1)throw T(`getOptionName`);G(e.value)||t.push(e.value)}return t}read(e){return ue(e),this._model._status(`readOptions`,[e])}}class Ne{constructor(e){this._model=e}get(e){return this._model._value(`getInfoValue`,[e])}type(e){return this._model._value(`getInfoType`,[e])}}function $(){let e=_(`Highs_create`,0)();if(!e)throw Error(`Highs_create failed`);let t=Ie(new fe(e));return v(`Highs_setIntOptionValue`,1,1)(e,`threads`,1),g(`Highs_setStringOptionValue`,`number`,[`number`,`string`,`string`])(e,`parallel`,`off`),t}function Fe(e){let t=Ie(new je($()));try{return e&&(e.format===`lp`||e.format===`mps`?t.readModel(e):t.passModel(e)),t}catch(e){throw t.dispose(),e}}function Ie(e){let t=Symbol.dispose;return t!==void 0&&Object.defineProperty(e,t,{configurable:!0,writable:!0,value:e.dispose}),e}function Le(e){return e!==null&&(typeof e==`object`||typeof e==`function`)&&typeof e.then==`function`}function Re(e,t=void 0){let n=typeof e!=`function`,r=n?e:void 0,i=n?t:e;if(typeof i!=`function`)throw C(`withModel requires a callback`);let a=Fe(r);try{let e=i(a);return Le(e)?Promise.resolve(e).finally(function(){a.dispose()}):(a.dispose(),e)}catch(e){throw a.dispose(),e}}function ze(e,t){let n=B(t);return H(function(a){let o=t.matrix,s=e===`Highs_mipCall`,c=a.outDoubles(n.numCols),l=s?0:a.outDoubles(n.numCols),u=a.outDoubles(n.numRows),d=s?0:a.outDoubles(n.numRows),f=s?0:a.outInts(n.numCols),p=s?0:a.outInts(n.numRows),m=a.outInts(1),h=pe(t,a,s),g=[n.numCols,n.numRows,n.numNonzeros,r[o.format],n.sense,t.offset==null?0:t.offset,...h.slice(0,8)],v;if(e===`Highs_mipCall`){if(!t.integrality)throw C(`mipCall requires integrality`);v=g.concat([h[8],c,u,m])}else if(e===`Highs_qpCall`){if(!t.hessian)throw C(`qpCall requires hessian`);let e=t.hessian;v=g.slice(0,3).concat([n.hessianNonzeros,r[o.format],i[e.format],n.sense,t.offset==null?0:t.offset,...h.slice(0,8),a.ints(Array.prototype.slice.call(e.starts,0,-1)),a.ints(e.indices),a.doubles(e.values),c,l,u,d,f,p,m])}else v=g.concat([c,l,u,d,f,p,m]);let y=_(e,v.length).apply(null,v);return s?O(y,{modelStatus:b()[m>>2],solution:{colValue:W(c,n.numCols),rowValue:W(u,n.numRows)}}):O(y,{modelStatus:b()[m>>2],solution:{colValue:W(c,n.numCols),rowValue:W(u,n.numRows),colDual:W(l,n.numCols),rowDual:W(d,n.numRows)},basis:{colStatus:U(f,n.numCols),rowStatus:U(p,n.numRows)}})})}let Be=Object.freeze({major:_(`Highs_versionMajor`,0)(),minor:_(`Highs_versionMinor`,0)(),patch:_(`Highs_versionPatch`,0)(),string:g(`Highs_version`,`string`,[])(),gitHash:g(`Highs_githash`,`string`,[])()}),Ve=Object.freeze({status:Object.freeze({error:-1,ok:0,warning:1}),variableType:Object.freeze({continuous:0,integer:1,semiContinuous:2,semiInteger:3,implicitInteger:4}),objectiveSense:Object.freeze({minimize:1,maximize:-1}),matrixFormat:Object.freeze({columnWise:1,rowWise:2}),hessianFormat:Object.freeze({triangular:1,square:2}),optionType:Object.freeze({boolean:0,integer:1,double:2,string:3}),infoType:Object.freeze({int64:-1,integer:1,double:2}),solutionStatus:Object.freeze({none:0,infeasible:1,feasible:2}),basisValidity:Object.freeze({invalid:0,valid:1}),basisStatus:Object.freeze({lower:0,basic:1,upper:2,zero:3,nonbasic:4}),callbackType:Object.freeze({logging:0,simplexInterrupt:1,ipmInterrupt:2,mipSolution:3,mipImprovingSolution:4,mipLogging:5,mipInterrupt:6,mipCutPool:7,mipUserSolution:9}),presolveStatus:Object.freeze({notPresolved:-1,notReduced:0,infeasible:1,unboundedOrInfeasible:2,reduced:3,reducedToEmpty:4,timeout:5,nullError:6,optionsError:7,outOfMemory:8}),modelStatus:Object.freeze({notSet:0,loadError:1,modelError:2,presolveError:3,solveError:4,postsolveError:5,empty:6,optimal:7,infeasible:8,unboundedOrInfeasible:9,unbounded:10,objectiveBound:11,objectiveTarget:12,timeLimit:13,iterationLimit:14,unknown:15,solutionLimit:16,interrupted:17}),iis:Object.freeze({strategyLight:0,strategyRowPriority:6,strategyColPriority:14,boundFree:1,boundLower:2,boundUpper:3,boundBoxed:4,notInConflict:-1,maybeInConflict:0,inConflict:1})}),He=$(),Ue=He.getInfinity(),We=He.getSizeofHighsInt();if(He.dispose(),We!==4)throw Error(`This highs-js runtime requires a 32-bit HighsInt build; received `+We*8+` bits`);e.version=Be,e.infinity=Ue,e.intBytes=We,e.intBits=We*8,Object.defineProperty(e,"memoryBytes",{enumerable:!0,get:function(){return y().buffer.byteLength}}),e.constants=Ve,e.errors=Object.freeze({HighsError:d,HighsDisposedError:f,HighsValidationError:p,HighsReentrancyError:m,HighsUnsupportedOptionError:h}),e.createModel=Fe,e.withModel=Re,e.raw=Object.freeze({version:function(){return Be},lpCall:function(e){return ze(`Highs_lpCall`,e)},mipCall:function(e){return ze(`Highs_mipCall`,e)},qpCall:function(e){return ze(`Highs_qpCall`,e)},createModel:$})})(n),n}})();typeof e==`object`&&typeof t==`object`?(t.exports=n,t.exports.default=n):typeof define==`function`&&define.amd&&define([],()=>n)})),ce=l({default:()=>G.default}),G,K=s((()=>{G=d(se(),1)})),le=`https://cdn.jsdelivr.net/npm/highs@1.15.3/build/highs.wasm`,ue=null,q=null,J=null;function de(e){J=e,ue=null,q=null}function fe(){return J}function pe(e){return e.length>=4&&e[0]===0&&e[1]===97&&e[2]===115&&e[3]===109}async function me(e){try{let t=await fetch(e,{headers:{Range:`bytes=0-3`}});if(!t.ok||(t.headers.get(`content-type`)||``).includes(`text/html`))return!1;if(!t.body)return!0;let n=t.body.getReader(),{value:r,done:i}=await n.read();return await n.cancel(),i||!r||r.length<4?!1:pe(r)}catch{return!1}}async function he(e){return e||J||oe()}async function ge(e={}){let t=await he(e.wasmUrl),n=t??`node`;if(ue&&q===n)return ue;q=n;let r=(async()=>{let e=(await Promise.resolve().then(()=>(K(),ce))).default;return await e({locateFile:e=>e.endsWith(`.wasm`)?t:e})})().catch(e=>{ue===r&&(ue=null,q=null);let n=e instanceof Error?e.message:String(e);throw Error(`[WaSHI] Failed to initialize HiGHS${t?` from "${t}"`:``}. Deploy the package's WASM asset or explicitly set wasmUrl; no CDN fallback is attempted. ${n}`,{cause:e})});return ue=r,r}async function _e(e,t={}){let n=await ge(t),r=performance.now(),i={output_flag:t.outputFlag??!1};return t.timeLimit!==void 0&&(i.time_limit=t.timeLimit),t.presolve!==void 0&&(i.presolve=t.presolve),t.solver!==void 0&&(i.solver=t.solver),t.relGap!==void 0&&(i.mip_rel_gap=t.relGap),t.absGap!==void 0&&(i.mip_abs_gap=t.absGap),{result:n.solve(e,i),runTime:(performance.now()-r)/1e3}}function Y(){let e=ae(`highs-worker.js`);if(new URL(e).origin===window.location.origin)return new Worker(e,{type:`module`});let t=URL.createObjectURL(new Blob([`import `+JSON.stringify(e)+`;`],{type:`text/javascript`}));try{let e=new Worker(t,{type:`module`}),n=()=>URL.revokeObjectURL(t);return e.addEventListener(`message`,n,{once:!0}),e.addEventListener(`error`,n,{once:!0}),e}catch(e){throw URL.revokeObjectURL(t),e}}var X=null,Z=0,ve=new Map;function ye(){if(typeof window>`u`||typeof Worker>`u`)return null;if(!X)try{X=Y();let e=X;X.onmessage=e=>{let{type:t,id:n,result:r,runTime:i,error:a}=e.data,o=ve.get(n);o&&(ve.delete(n),t===`SOLVE_SUCCESS`?o.resolve({result:r,runTime:i}):o.reject(Error(a||`Worker solve failed`)))};let t=t=>{if(X===e){X=null,e.terminate();for(let e of ve.values())e.reject(t);ve.clear()}};X.onerror=e=>t(Error(`[WaSHI] HiGHS Worker failed to load or execute. Check Worker assets, CORS and CSP. ${e?.message||``}`)),X.onmessageerror=()=>t(Error(`[WaSHI] Could not deserialize the HiGHS Worker response.`))}catch{X=null}return X}async function be(e,t={}){let n=await he(t.wasmUrl),r=t.useWorker??typeof window<`u`?ye():null;if(!r)return _e(e,t);let i={...t,wasmUrl:n},a=`req_${++Z}`;return new Promise((t,n)=>{ve.set(a,{resolve:t,reject:n});try{r.postMessage({type:`SOLVE`,id:a,lpString:e,options:i})}catch(e){ve.delete(a),n(e)}})}function xe(e){if(typeof e!=`string`)return`Unknown`;let t=e.trim();if(!t)return`Unknown`;switch(t){case`Optimal`:return`Optimal`;case`Infeasible`:return`Infeasible`;case`Unbounded`:return`Unbounded`;case`Primal infeasible or unbounded`:return`Unknown`;case`Time limit reached`:case`TimeLimit`:return`TimeLimit`;case`Iteration limit reached`:case`IterationLimit`:return`IterationLimit`;case`Bound on objective reached`:case`Target for objective reached`:case`Feasible`:return`Feasible`;case`Not Set`:return`NotSolved`;case`Load error`:case`Model error`:case`Presolve error`:case`Solve error`:case`Postsolve error`:case`Error`:return`Error`;case`Empty`:case`Unknown`:return`Unknown`}let n=t.toLowerCase();return n.includes(`infeasible`)&&n.includes(`unbounded`)?`Unknown`:n.includes(`infeasible`)?`Infeasible`:n.includes(`unbounded`)?`Unbounded`:n.includes(`time limit`)||n.includes(`timelimit`)?`TimeLimit`:n.includes(`iteration limit`)||n.includes(`iterationlimit`)?`IterationLimit`:n.includes(`error`)?`Error`:n===`optimal`?`Optimal`:`Unknown`}var Se=class e{static capabilities={supportsMIP:!0,supportsQP:!0};name=`HiGHS`;version=`1.15.3`;capabilities=e.capabilities;options;constructor(e={}){this.options=e}async solve(e,t,n={}){let r={...this.options,...n},{lpString:i,nameToVar:a,nameToConstraint:o}=t,{result:s,runTime:c}=await be(i,r),l=xe(s?.Status),u=s.ObjectiveValue,d=typeof u==`number`?u+e.objective.constant:null,f={},p={},m={},h={};if(s.Columns)for(let[e,t]of Object.entries(s.Columns)){let n=a.get(e);if(n){let e=Math.abs(t.Primal)<1e-9?0:t.Primal;f[n.name]=e,t.Dual!==void 0&&(m[n.name]=Math.abs(t.Dual)<1e-9?0:t.Dual)}}if(s.Rows){let e=Array.isArray(s.Rows)?s.Rows:Object.values(s.Rows);for(let t of e){let e=t.Name,n=o.get(e);if(n&&(t.Dual!==void 0&&(p[n.name]=Math.abs(t.Dual)<1e-9?0:t.Dual),t.Primal!==void 0)){let e=n.rhs-t.Primal;h[n.name]=Math.abs(e)<1e-9?0:e}}}return{status:l,objectiveValue:d,values:f,reducedCosts:m,duals:p,slacks:h,runTime:c,raw:s}}},Ce=Se;function we(){ne(`highs`,e=>new Se(e)),re(e=>new Se(e))}we();var Te=class{name;capabilities;options;constructor(e={}){this.name=e.name||`MockSolver`,this.capabilities=e.capabilities||{supportsMIP:!0,supportsQP:!0},this.options=e}async solve(e,t,n={}){let r={...this.options,...n};return r.delayMs&&r.delayMs>0&&await new Promise(e=>setTimeout(e,r.delayMs)),{status:r.status||`Optimal`,objectiveValue:r.objectiveValue??0,values:r.values||{},reducedCosts:r.reducedCosts,duals:r.duals,slacks:r.slacks,runTime:.001,raw:{mock:!0}}}};function Ee(){ne(`mock`,e=>new Te(e))}Ee();var De=class{name;sense;objective;variables=[];constraints=[];boolVars=[];logicalConstraints=[];unsatCore=[];values=new Map;varMapByName=new Map;constrMapByName=new Map;status=`NotSolved`;objectiveValue=null;runTime=0;solution=null;solver=null;constructor(e={},t){let n;n=typeof e==`string`?{...t,name:e}:e,this.name=n.name||`OptimizationModel`,this.sense=n.sense||`Minimize`,this.objective=new T,n.solver&&(this.solver=H(n.solver))}get vars(){return this.variables}get constrs(){return this.constraints}get numVars(){return this.variables.length}get numConstrs(){return this.constraints.length}addVar(e,t,n,r){let i;i=typeof e==`string`?{name:e,type:t,lb:n,ub:r}:e||{};let a=new k(i);if(this.varMapByName.has(a.name))throw Error(`Variable with name '${a.name}' already exists in model`);return this.variables.push(a),this.varMapByName.set(a.name,a),a}addVars(e,t,n){if(typeof t==`number`||Array.isArray(t)){let r=typeof e==`number`?Array.from({length:e},(e,t)=>t):e,i=typeof t==`number`?Array.from({length:t},(e,t)=>t):t,a=n||{},o=a.prefix||a.name||`x`,s={};for(let e of r){s[e]={};for(let t of i)s[e][t]=this.addVar({...a,name:`${o}_${e}_${t}`})}return s}let r=t||{},i=r.prefix||r.name;if(typeof e==`number`){let t=[],n=i||`x`;for(let i=0;i<e;i++)t.push(this.addVar({...r,name:`${n}_${i}`}));return t}{let t={};for(let n of e){let e=i?`${i}_${n}`:`${n}`;t[n]=this.addVar({...r,name:e})}return t}}addVars2D(e,t,n){let r={},i=n?.name||`x`;for(let a of e){r[a]={};for(let e of t)r[a][e]=this.addVar({...n,name:`${i}_${a}_${e}`})}return r}getVarByName(e){return this.varMapByName.get(e)}getConstraintByName(e){return this.constrMapByName.get(e)}setObjective(e,t){t&&(this.sense=t),this.objective=typeof e==`string`?M(e,e=>this.getVarByName(e)):typeof e==`number`?new T(new Map,e):e instanceof w||`terms`in e?e.clone():new T(new Map([[e,1]]),0)}maximize(e){this.setObjective(e,`Maximize`)}minimize(e){this.setObjective(e,`Minimize`)}addBoolVar(e){let t=new m(e);return this.boolVars.push(t),t}addConstraint(e,t){if(e instanceof p){let n=t||`lc_${this.logicalConstraints.length+1}`;return this.logicalConstraints.push({name:n,expr:e}),e}let n;if(typeof e==`string`?n=N(e,e=>this.getVarByName(e),t):(n=e,t&&(n.name=t)),this.constrMapByName.has(n.name))throw Error(`Constraint with name '${n.name}' already exists in model`);return this.constraints.push(n),this.constrMapByName.set(n.name,n),n}addConstr(e,t){return this.addConstraint(e,t)}addConstrs(e){return e.map(e=>this.addConstraint(e))}add(e,t){if(Array.isArray(e)){for(let t of e)this.add(t);return this}return e instanceof k?(this.varMapByName.has(e.name)||(this.variables.push(e),this.varMapByName.set(e.name,e)),this):(this.addConstraint(e,t),this)}addIndicator(e,t,n={}){let r=n.activeValue===void 0?1:n.activeValue,i=n.M===void 0?1e5:n.M,a=n.name||`ind_${e.name}_${t.name}`,o=[],{lhs:s,sense:c,rhs:l}=t;if(r===1){if(c===`<=`||c===`==`){let t=this.addConstraint(s.add(e.mul(i)).le(l+i),c===`==`?`${a}_le`:a);o.push(t)}if(c===`>=`||c===`==`){let t=this.addConstraint(s.sub(e.mul(i)).ge(l-i),c===`==`?`${a}_ge`:a);o.push(t)}}else{if(c===`<=`||c===`==`){let t=this.addConstraint(s.sub(e.mul(i)).le(l),c===`==`?`${a}_le`:a);o.push(t)}if(c===`>=`||c===`==`){let t=this.addConstraint(s.add(e.mul(i)).ge(l),c===`==`?`${a}_ge`:a);o.push(t)}}return o}toLpString(){let{lpString:e}=R({name:this.name,sense:this.sense,objective:this.objective,constraints:this.constraints,variables:this.variables});return e}async optimize(e,t){let n,r;if(e&&typeof e==`object`&&`solve`in e&&typeof e.solve==`function`?(n=e,r=t||{}):typeof e==`function`?(n=new e(t),r=t||{}):typeof e==`string`?(n=H(e,t),r=t||{}):(r={...e},r.solver?(n=H(r.solver,r),delete r.solver):n=this.solver||H()),this.objective instanceof w&&this.objective.quadTerms.size>0&&n.capabilities?.supportsQP===!1)throw Error(`Solver "${n.name}" does not support quadratic objectives (QP). Please use a QP-capable solver such as HiGHS or Clarabel.`);let i={name:this.name,sense:this.sense,objective:this.objective,constraints:this.constraints,variables:this.variables,logicalConstraints:this.logicalConstraints,boolVars:this.boolVars},a=R(i),o=await n.solve(i,a,r);this.runTime=o.runTime??0,this.status=o.status,this.objectiveValue=o.objectiveValue??null;let s={},c={},l={},u={};if(this.values.clear(),o.values)for(let[e,t]of Object.entries(o.values)){this.values.set(e,t);let n=this.getVarByName(e)||a.nameToVar.get(e);n&&(n.value=t,s[n.name]=t)}if(o.reducedCosts)for(let[e,t]of Object.entries(o.reducedCosts)){let n=this.getVarByName(e)||a.nameToVar.get(e);n&&(n.reducedCost=t,l[n.name]=t)}if(o.duals)for(let[e,t]of Object.entries(o.duals)){let n=this.getConstraintByName(e)||a.nameToConstraint.get(e);n&&(n.dual=t,c[n.name]=t)}if(o.slacks)for(let[e,t]of Object.entries(o.slacks)){let n=this.getConstraintByName(e)||a.nameToConstraint.get(e);n&&(n.slack=t,u[n.name]=t)}return this.solution={status:this.status,objectiveValue:this.objectiveValue,values:s,duals:c,reducedCosts:l,slacks:u,runTime:this.runTime,raw:o.raw},this.status}async solve(e,t){return this.optimize(e,t)}async check(e,t){let n,r;if(e&&typeof e==`object`&&`solve`in e&&typeof e.solve==`function`?(n=e,r=t||{}):typeof e==`function`?(n=new e(t),r=t||{}):typeof e==`string`?(n=H(e,t),r=t||{}):(r={...e},r.solver?(n=H(r.solver,r),delete r.solver):n=this.solver||H()),this.logicalConstraints.length>0&&n.capabilities?.supportsSMT!==!0)throw Error(`Solver "${n.name}" does not support SMT / logical constraints (or, implies, not, xor). Please use an SMT-capable solver such as Z3.`);if(typeof n.check==`function`){let e=await n.check({name:this.name,variables:this.variables,boolVars:this.boolVars,constraints:this.constraints,logicalConstraints:this.logicalConstraints},r);if(this.status=e.status,this.runTime=e.runTime??0,this.unsatCore=e.unsatCore||[],e.values){this.values.clear();for(let[t,n]of Object.entries(e.values)){this.values.set(t,n);let e=this.getVarByName(t);e&&typeof n==`number`&&(e.value=n)}}return e}let i=this.objective,a=this.sense;try{this.objective=new T,this.sense=`Minimize`;let e=await this.optimize(n,r),t=e===`Optimal`||e===`Feasible`,i=e===`Infeasible`,a={};for(let e of this.variables)a[e.name]=e.value??0;return{status:t?`Sat`:i?`Unsat`:`Unknown`,values:a,runTime:this.runTime}}finally{this.objective=i,this.sense=a}}},Oe=`Minimize`,ke=`Maximize`,Ae=`Continuous`,je=`Integer`,Me=`Binary`,Ne={Optimal:`Optimal`,Feasible:`Feasible`,Infeasible:`Infeasible`,Unbounded:`Unbounded`,TimeLimit:`Not Solved (Time Limit)`,IterationLimit:`Not Solved (Iteration Limit)`,Error:`Error`,NotSolved:`Not Solved`,Sat:`Sat`,Unsat:`Unsat`,Unknown:`Unknown`},Q=class e extends k{constructor(e,t,n,r=`Continuous`){super({name:e,lb:t===void 0?0:t,ub:n===void 0?1/0:n,type:r})}static dicts(t,n,r,i,a=`Continuous`){let o={};for(let s of n){let n=`${t}_${s}`;o[s]=new e(n,r,i,a)}return o}};function Pe(e){return e==null?null:typeof e==`number`?e:e.value}var $=class{model;constructor(e=`NoName`,t=Oe){this.model=new De({name:e,sense:t})}get name(){return this.model.name}get sense(){return this.model.sense}set sense(e){this.model.sense=e}get objective(){return this.model.objective}get variables(){return this.model.variables}get constraints(){return this.model.constraints}get status(){return this.model.status}get objectiveValue(){return this.model.objectiveValue}addVariable(e){return this.model.getVarByName(e.name)||(this.model.variables.push(e),this.model.varMapByName.set(e.name,e)),e}setObjective(e){if(typeof e==`object`&&e){if(`terms`in e)for(let[t]of e.terms)this.addVariable(t);else e instanceof k&&this.addVariable(e)}this.model.setObjective(e)}addConstraint(e,t){if(typeof e==`object`&&e&&`lhs`in e)for(let[t]of e.lhs.terms)this.addVariable(t);return this.model.addConstraint(e,t)}add(e,t){typeof e==`string`?/(<=|>=|==|=<|=>|=)/.test(e)?this.addConstraint(e,t):this.setObjective(e):e instanceof S?this.addConstraint(e,t):this.setObjective(e)}async solve(e,t){return this.model.optimize(e,t)}toLpString(){return this.model.toLpString()}},Fe=`Minimize`,Ie=`Maximize`,Le=`Binary`,Re=`Integer`,ze=`Continuous`;function Be(e){return{expr:e,sense:Ie}}function Ve(e){return{expr:e,sense:Fe}}var He=class extends De{constructor(e=`MipModel`,t=Fe){super({name:e,sense:t})}add_var(e={}){return this.addVar({name:e.name,type:e.var_type,lb:e.lb,ub:e.ub})}set objective_spec(e){this.setObjective(e.expr,e.sense)}get objective_value(){return this.objectiveValue}add_constr(e,t){return this.addConstraint(e,t)}};return e.BINARY=Le,e.BoolExpr=p,e.BoolOp=h,e.BoolVar=m,e.CONTINUOUS=ze,e.Constraint=S,e.HiGHS=Ce,e.HighsSolver=Se,e.INTEGER=Re,e.LinExpr=T,e.LpBinary=Me,e.LpContinuous=Ae,e.LpInteger=je,e.LpMaximize=ke,e.LpMinimize=Oe,e.LpProblem=$,e.LpStatus=Ne,e.LpVariable=Q,e.MAXIMIZE=Ie,e.MINIMIZE=Fe,e.MipModel=He,e.MockSolver=Te,e.Model=De,e.OFFICIAL_HIGHS_CDN_WASM_URL=le,e.QuadExpr=w,e.Var=k,e.and=g,e.c=F,e.expr=I,e.generateLpString=R,e.getHighs=ge,e.getHighsWasmUrl=fe,e.getSolver=H,e.implies=y,e.isValidWasmHeader=pe,e.listAvailableSolvers=U,e.lpSum=D,e.maximize=Be,e.minimize=Ve,e.not=v,e.or=_,e.parseConstraint=N,e.parseExpr=M,e.probeWasmUrl=me,e.registerSolver=ne,e.resolveBrowserWasmUrl=he,e.setDefaultSolver=re,e.setHighsWasmUrl=de,e.solveLpWithHighs=_e,e.sum=E,e.value=Pe,e.xor=b,e.xsum=ee,e})({});
|
|
@@ -0,0 +1,195 @@
|
|
|
1
|
+
//#region node_modules/async-mutex/index.mjs
|
|
2
|
+
var e = /* @__PURE__ */ Error("timeout while waiting for mutex to become available"), t = /* @__PURE__ */ Error("mutex already locked"), n = /* @__PURE__ */ Error("request for lock canceled"), r = function(e, t, n, r) {
|
|
3
|
+
function i(e) {
|
|
4
|
+
return e instanceof n ? e : new n(function(t) {
|
|
5
|
+
t(e);
|
|
6
|
+
});
|
|
7
|
+
}
|
|
8
|
+
return new (n ||= Promise)(function(n, a) {
|
|
9
|
+
function o(e) {
|
|
10
|
+
try {
|
|
11
|
+
c(r.next(e));
|
|
12
|
+
} catch (e) {
|
|
13
|
+
a(e);
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
function s(e) {
|
|
17
|
+
try {
|
|
18
|
+
c(r.throw(e));
|
|
19
|
+
} catch (e) {
|
|
20
|
+
a(e);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
function c(e) {
|
|
24
|
+
e.done ? n(e.value) : i(e.value).then(o, s);
|
|
25
|
+
}
|
|
26
|
+
c((r = r.apply(e, t || [])).next());
|
|
27
|
+
});
|
|
28
|
+
}, i = class {
|
|
29
|
+
constructor(e, t = n) {
|
|
30
|
+
if (this._maxConcurrency = e, this._cancelError = t, this._queue = [], this._waiters = [], e <= 0) throw Error("semaphore must be initialized to a positive value");
|
|
31
|
+
this._value = e;
|
|
32
|
+
}
|
|
33
|
+
acquire() {
|
|
34
|
+
let e = this.isLocked(), t = new Promise((e, t) => this._queue.push({
|
|
35
|
+
resolve: e,
|
|
36
|
+
reject: t
|
|
37
|
+
}));
|
|
38
|
+
return e || this._dispatch(), t;
|
|
39
|
+
}
|
|
40
|
+
runExclusive(e) {
|
|
41
|
+
return r(this, void 0, void 0, function* () {
|
|
42
|
+
let [t, n] = yield this.acquire();
|
|
43
|
+
try {
|
|
44
|
+
return yield e(t);
|
|
45
|
+
} finally {
|
|
46
|
+
n();
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
waitForUnlock() {
|
|
51
|
+
return r(this, void 0, void 0, function* () {
|
|
52
|
+
return this.isLocked() ? new Promise((e) => this._waiters.push({ resolve: e })) : Promise.resolve();
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
isLocked() {
|
|
56
|
+
return this._value <= 0;
|
|
57
|
+
}
|
|
58
|
+
release() {
|
|
59
|
+
if (this._maxConcurrency > 1) throw Error("this method is unavailable on semaphores with concurrency > 1; use the scoped release returned by acquire instead");
|
|
60
|
+
if (this._currentReleaser) {
|
|
61
|
+
let e = this._currentReleaser;
|
|
62
|
+
this._currentReleaser = void 0, e();
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
cancel() {
|
|
66
|
+
this._queue.forEach((e) => e.reject(this._cancelError)), this._queue = [];
|
|
67
|
+
}
|
|
68
|
+
_dispatch() {
|
|
69
|
+
let e = this._queue.shift();
|
|
70
|
+
if (!e) return;
|
|
71
|
+
let t = !1;
|
|
72
|
+
this._currentReleaser = () => {
|
|
73
|
+
t || (t = !0, this._value++, this._resolveWaiters(), this._dispatch());
|
|
74
|
+
}, e.resolve([this._value--, this._currentReleaser]);
|
|
75
|
+
}
|
|
76
|
+
_resolveWaiters() {
|
|
77
|
+
this._waiters.forEach((e) => e.resolve()), this._waiters = [];
|
|
78
|
+
}
|
|
79
|
+
}, a = function(e, t, n, r) {
|
|
80
|
+
function i(e) {
|
|
81
|
+
return e instanceof n ? e : new n(function(t) {
|
|
82
|
+
t(e);
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
return new (n ||= Promise)(function(n, a) {
|
|
86
|
+
function o(e) {
|
|
87
|
+
try {
|
|
88
|
+
c(r.next(e));
|
|
89
|
+
} catch (e) {
|
|
90
|
+
a(e);
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
function s(e) {
|
|
94
|
+
try {
|
|
95
|
+
c(r.throw(e));
|
|
96
|
+
} catch (e) {
|
|
97
|
+
a(e);
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
function c(e) {
|
|
101
|
+
e.done ? n(e.value) : i(e.value).then(o, s);
|
|
102
|
+
}
|
|
103
|
+
c((r = r.apply(e, t || [])).next());
|
|
104
|
+
});
|
|
105
|
+
}, o = class {
|
|
106
|
+
constructor(e) {
|
|
107
|
+
this._semaphore = new i(1, e);
|
|
108
|
+
}
|
|
109
|
+
acquire() {
|
|
110
|
+
return a(this, void 0, void 0, function* () {
|
|
111
|
+
let [, e] = yield this._semaphore.acquire();
|
|
112
|
+
return e;
|
|
113
|
+
});
|
|
114
|
+
}
|
|
115
|
+
runExclusive(e) {
|
|
116
|
+
return this._semaphore.runExclusive(() => e());
|
|
117
|
+
}
|
|
118
|
+
isLocked() {
|
|
119
|
+
return this._semaphore.isLocked();
|
|
120
|
+
}
|
|
121
|
+
waitForUnlock() {
|
|
122
|
+
return this._semaphore.waitForUnlock();
|
|
123
|
+
}
|
|
124
|
+
release() {
|
|
125
|
+
this._semaphore.release();
|
|
126
|
+
}
|
|
127
|
+
cancel() {
|
|
128
|
+
return this._semaphore.cancel();
|
|
129
|
+
}
|
|
130
|
+
}, s = function(e, t, n, r) {
|
|
131
|
+
function i(e) {
|
|
132
|
+
return e instanceof n ? e : new n(function(t) {
|
|
133
|
+
t(e);
|
|
134
|
+
});
|
|
135
|
+
}
|
|
136
|
+
return new (n ||= Promise)(function(n, a) {
|
|
137
|
+
function o(e) {
|
|
138
|
+
try {
|
|
139
|
+
c(r.next(e));
|
|
140
|
+
} catch (e) {
|
|
141
|
+
a(e);
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
function s(e) {
|
|
145
|
+
try {
|
|
146
|
+
c(r.throw(e));
|
|
147
|
+
} catch (e) {
|
|
148
|
+
a(e);
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
function c(e) {
|
|
152
|
+
e.done ? n(e.value) : i(e.value).then(o, s);
|
|
153
|
+
}
|
|
154
|
+
c((r = r.apply(e, t || [])).next());
|
|
155
|
+
});
|
|
156
|
+
};
|
|
157
|
+
function c(t, n, r = e) {
|
|
158
|
+
return {
|
|
159
|
+
acquire: () => new Promise((e, i) => s(this, void 0, void 0, function* () {
|
|
160
|
+
let a = !1, o = setTimeout(() => {
|
|
161
|
+
a = !0, i(r);
|
|
162
|
+
}, n);
|
|
163
|
+
try {
|
|
164
|
+
let n = yield t.acquire();
|
|
165
|
+
a ? (Array.isArray(n) ? n[1] : n)() : (clearTimeout(o), e(n));
|
|
166
|
+
} catch (e) {
|
|
167
|
+
a || (clearTimeout(o), i(e));
|
|
168
|
+
}
|
|
169
|
+
})),
|
|
170
|
+
runExclusive(e) {
|
|
171
|
+
return s(this, void 0, void 0, function* () {
|
|
172
|
+
let t = () => void 0;
|
|
173
|
+
try {
|
|
174
|
+
let n = yield this.acquire();
|
|
175
|
+
return Array.isArray(n) ? (t = n[1], yield e(n[0])) : (t = n, yield e());
|
|
176
|
+
} finally {
|
|
177
|
+
t();
|
|
178
|
+
}
|
|
179
|
+
});
|
|
180
|
+
},
|
|
181
|
+
release() {
|
|
182
|
+
t.release();
|
|
183
|
+
},
|
|
184
|
+
cancel() {
|
|
185
|
+
return t.cancel();
|
|
186
|
+
},
|
|
187
|
+
waitForUnlock: () => t.waitForUnlock(),
|
|
188
|
+
isLocked: () => t.isLocked()
|
|
189
|
+
};
|
|
190
|
+
}
|
|
191
|
+
function l(e, n = t) {
|
|
192
|
+
return c(e, 0, n);
|
|
193
|
+
}
|
|
194
|
+
//#endregion
|
|
195
|
+
export { t as E_ALREADY_LOCKED, n as E_CANCELED, e as E_TIMEOUT, o as Mutex, i as Semaphore, l as tryAcquire, c as withTimeout };
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
//#region src/modeler/boolean-expr.ts
|
|
2
|
+
var e = 0, t = class {
|
|
3
|
+
and(e) {
|
|
4
|
+
return new r("and", [this, e]);
|
|
5
|
+
}
|
|
6
|
+
or(e) {
|
|
7
|
+
return new r("or", [this, e]);
|
|
8
|
+
}
|
|
9
|
+
implies(e) {
|
|
10
|
+
return new r("implies", [this, e]);
|
|
11
|
+
}
|
|
12
|
+
xor(e) {
|
|
13
|
+
return new r("xor", [this, e]);
|
|
14
|
+
}
|
|
15
|
+
not() {
|
|
16
|
+
return new r("not", [this]);
|
|
17
|
+
}
|
|
18
|
+
}, n = class extends t {
|
|
19
|
+
id;
|
|
20
|
+
name;
|
|
21
|
+
value = null;
|
|
22
|
+
constructor(t) {
|
|
23
|
+
super(), this.id = ++e, this.name = t || `p_${this.id}`;
|
|
24
|
+
}
|
|
25
|
+
toString() {
|
|
26
|
+
return this.name;
|
|
27
|
+
}
|
|
28
|
+
}, r = class extends t {
|
|
29
|
+
op;
|
|
30
|
+
children;
|
|
31
|
+
constructor(e, t) {
|
|
32
|
+
super(), this.op = e, this.children = t;
|
|
33
|
+
}
|
|
34
|
+
toString() {
|
|
35
|
+
return this.op === "not" ? `not(${this.children[0].toString()})` : `(${this.children.map((e) => e.toString()).join(` ${this.op} `)})`;
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
function i(...e) {
|
|
39
|
+
if (e.length === 0) throw Error("and() requires at least one expression");
|
|
40
|
+
return new r("and", e);
|
|
41
|
+
}
|
|
42
|
+
function a(...e) {
|
|
43
|
+
if (e.length === 0) throw Error("or() requires at least one expression");
|
|
44
|
+
return new r("or", e);
|
|
45
|
+
}
|
|
46
|
+
function o(e) {
|
|
47
|
+
return new r("not", [e]);
|
|
48
|
+
}
|
|
49
|
+
function s(e, t) {
|
|
50
|
+
return new r("implies", [e, t]);
|
|
51
|
+
}
|
|
52
|
+
function c(...e) {
|
|
53
|
+
if (e.length === 0) throw Error("xor() requires at least one expression");
|
|
54
|
+
return new r("xor", e);
|
|
55
|
+
}
|
|
56
|
+
//#endregion
|
|
57
|
+
//#region src/modeler/constraint.ts
|
|
58
|
+
var l = 0, u = class {
|
|
59
|
+
id;
|
|
60
|
+
lhs;
|
|
61
|
+
sense;
|
|
62
|
+
rhs;
|
|
63
|
+
name;
|
|
64
|
+
slack = null;
|
|
65
|
+
dual = null;
|
|
66
|
+
constructor(e, t, n, r) {
|
|
67
|
+
this.id = ++l, this.lhs = e, this.sense = t, this.rhs = n, this.name = r || `c_${this.id}`;
|
|
68
|
+
}
|
|
69
|
+
get pi() {
|
|
70
|
+
return this.dual;
|
|
71
|
+
}
|
|
72
|
+
and(e) {
|
|
73
|
+
return new r("and", [this, e]);
|
|
74
|
+
}
|
|
75
|
+
or(e) {
|
|
76
|
+
return new r("or", [this, e]);
|
|
77
|
+
}
|
|
78
|
+
implies(e) {
|
|
79
|
+
return new r("implies", [this, e]);
|
|
80
|
+
}
|
|
81
|
+
xor(e) {
|
|
82
|
+
return new r("xor", [this, e]);
|
|
83
|
+
}
|
|
84
|
+
not() {
|
|
85
|
+
return new r("not", [this]);
|
|
86
|
+
}
|
|
87
|
+
toString() {
|
|
88
|
+
let e = this.sense === "==" ? "=" : this.sense;
|
|
89
|
+
return `${this.name}: ${this.lhs.toString()} ${e} ${this.rhs}`;
|
|
90
|
+
}
|
|
91
|
+
};
|
|
92
|
+
//#endregion
|
|
93
|
+
export { i as a, a as c, n as i, c as l, t as n, s as o, r, o as s, u as t };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export function getBundledWasmUrl() { return new URL("./highs.wasm", import.meta.url).href; }
|