1(function(e){function t(t){for(var r,a,l=t[0],s=t[1],c=t[2],h=0,f=[];h<l.length;h++)a=l[h],Object.prototype.hasOwnProperty.call(o,a)&&o[a]&&f.push(o[a][0]),o[a]=0;for(r in s)Object.prototype.hasOwnProperty.call(s,r)&&(e[r]=s[r]);u&&u(t);while(f.length)f.shift()();return i.push.apply(i,c||[]),n()}function n(){for(var e,t=0;t<i.length;t++){for(var n=i[t],r=!0,l=1;l<n.length;l++){var s=n[l];0!==o[s]&&(r=!1)}r&&(i.splice(t--,1),e=a(a.s=n[0]))}return e}var r={},o={app:0},i=[];function a(t){if(r[t])return r[t].exports;var n=r[t]={i:t,l:!1,exports:{}};return e[t].call(n.exports,n,n.exports,a),n.l=!0,n.exports}a.m=e,a.c=r,a.d=function(e,t,n){a.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},a.r=function(e){"undefined"!==typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},a.t=function(e,t){if(1&t&&(e=a(e)),8&t)return e;if(4&t&&"object"===typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(a.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var r in e)a.d(n,r,function(t){return e[t]}.bind(null,r));return n},a.n=function(e){var t=e&&e.__esModule?function(){return e["default"]}:function(){return e};return a.d(t,"a",t),t},a.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},a.p="/";var l=window["webpackJsonp"]=window["webpackJsonp"]||[],s=l.push.bind(l);l.push=t,l=l.slice();for(var c=0;c<l.length;c++)t(l[c]);var u=s;i.push([0,"chunk-vendors"]),n()})({0:function(e,t,n){e.exports=n("cd49")},"034f":function(e,t,n){"use strict";n("85ec")},"0c4f":function(e,t,n){},"0f2b":function(e,t,n){var r,o,i;function a(e){return a="function"===typeof Symbol&&"symbol"===typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"===typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},a(e)}(function(n,l){"object"===a(t)&&"undefined"!==typeof e?l(t):(o=[t],r=l,i="function"===typeof r?r.apply(t,o):r,void 0===i||(e.exports=i))})(0,(function(e){"use strict";function t(e){return n(e)&&"function"===typeof e.from}function n(e){return"object"===a(e)&&"function"===typeof e.to}function r(e){e.parentElement.removeChild(e)}function o(e){return null!==e&&void 0!==e}function i(e){e.preventDefault()}function l(e){return e.filter((function(e){return!this[e]&&(this[e]=!0)}),{})}function s(e,t){return Math.round(e/t)*t}function c(e,t){var n=e.getBoundingClientRect(),r=e.ownerDocument,o=r.documentElement,i=g(r);return/webkit.*Chrome.*Mobile/i.test(navigator.userAgent)&&(i.x=0),t?n.top+i.y-o.clientTop:n.left+i.x-o.clientLeft}function u(e){return"number"===typeof e&&!isNaN(e)&&isFinite(e)}function h(e,t,n){n>0&&(y(e,t),setTimeout((function(){m(e,t)}),n))}function f(e){return Math.max(Math.min(e,100),0)}function d(e){return Array.isArray(e)?e:[e]}function p(e){e=String(e);var t=e.split(".");return t.length>1?t[1].length:0}function y(e,t){e.classList&&!/\s/.test(t)?e.classList.add(t):e.className+=" "+t}function m(e,t){e.classList&&!/\s/.test(t)?e.classList.remove(t):e.className=e.className.replace(new RegExp("(^|\\b)"+t.split(" ").join("|")+"(\\b|$)","gi")," ")}function v(e,t){return e.classList?e.classList.contains(t):new RegExp("\\b"+t+"\\b").test(e.className)}function g(e){var t=void 0!==window.pageXOffset,n="CSS1Compat"===(e.compatMode||""),r=t?window.pageXOffset:n?e.documentElement.scrollLeft:e.body.scrollLeft,o=t?window.pageYOffset:n?e.documentElement.scrollTop:e.body.scrollTop;return{x:r,y:o}}function w(){return window.navigator.pointerEnabled?{start:"pointerdown",move:"pointermove",end:"pointerup"}:window.navigator.msPointerEnabled?{start:"MSPointerDown",move:"MSPointerMove",end:"MSPointerUp"}:{start:"mousedown touchstart",move:"mousemove touchmove",end:"mouseup touchend"}}function b(){var e=!1;try{var t=Object.defineProperty({},"passive",{get:function(){e=!0}});window.addEventListener("test",null,t)}catch(n){}return e}function _(){return window.CSS&&CSS.supports&&CSS.supports("touch-action","none")}function P(e,t){return 100/(t-e)}
1function C(e,t,n){return 100*t/(e[n+1]-e[n])}function O(e,t){return C(e,e[0]<0?t+Math.abs(e[0]):t-e[0],0)}function S(e,t){return t*(e[1]-e[0])/100+e[0]}function D(e,t){var n=1;while(e>=t[n])n+=1;return n}function R(e,t,n){if(n>=e.slice(-1)[0])return 100;var r=D(n,e),o=e[r-1],i=e[r],a=t[r-1],l=t[r];return a+O([o,i],n)/P(a,l)}function T(e,t,n){if(n>=100)return e.slice(-1)[0];var r=D(n,t),o=e[r-1],i=e[r],a=t[r-1],l=t[r];return S([o,i],(n-a)*P(a,l))}function L(e,t,n,r){if(100===r)return r;var o=D(r,e),i=e[o-1],a=e[o];return n?r-i>(a-i)/2?a:i:t[o-1]?e[o-1]+s(r-e[o-1],t[o-1]):r}e.PipsMode=void 0,function(e){e["Range"]="range",e["Steps"]="steps",e["Positions"]="positions",e["Count"]="count",e["Values"]="values"}(e.PipsMode||(e.PipsMode={})),e.PipsType=void 0,function(e){e[e["None"]=-1]="None",e[e["NoValue"]=0]="NoValue",e[e["LargeValue"]=1]="LargeValue",e[e["SmallValue"]=2]="SmallValue"}(e.PipsType||(e.PipsType={}));var F=function(){function e(e,t,n){var r;this.xPct=[],this.xVal=[],this.xSteps=[],this.xNumSteps=[],this.xHighestCompleteStep=[],this.xSteps=[n||!1],this.xNumSteps=[!1],this.snap=t;var o=[];for(Object.keys(e).forEach((function(t){o.push([d(e[t]),t])})),o.sort((function(e,t){return e[0][0]-t[0][0]})),r=0;r<o.length;r++)this.handleEntryPoint(o[r][1],o[r][0]);for(this.xNumSteps=this.xSteps.slice(0),r=0;r<this.xNumSteps.length;r++)this.handleStepPoint(r,this.xNumSteps[r])}return e.prototype.getDistance=function(e){for(var t=[],n=0;n<this.xNumSteps.length-1;n++)t[n]=C(this.xVal,e,n);return t},e.prototype.getAbsoluteDistance=function(e,t,n){var r,o=0;if(e<this.xPct[this.xPct.length-1])while(e>this.xPct[o+1])o++;else e===this.xPct[this.xPct.length-1]&&(o=this.xPct.length-2);n||e!==this.xPct[o+1]||o++,null===t&&(t=[]);var i=1,a=t[o],l=0,s=0,c=0,u=0;r=n?(e-this.xPct[o])/(this.xPct[o+1]-this.xPct[o]):(this.xPct[o+1]-e)/(this.xPct[o+1]-this.xPct[o]);while(a>0)l=this.xPct[o+1+u]-this.xPct[o+u],t[o+u]*i+100-100*r>100?(s=l*r,i=(a-100*r)/t[o+u],r=1):(s=t[o+u]*l/100*i,i=0),n?(c-=s,this.xPct.length+u>=1&&u--):(c+=s,this.xPct.length-u>=1&&u++),a=t[o+u]*i;return e+c},e.prototype.toStepping=function(e){return e=R(this.xVal,this.xPct,e),e},e.prototype.fromStepping=function(e){return T(this.xVal,this.xPct,e)},e.prototype.getStep=function(e){return e=L(this.xPct,this.xSteps,this.snap,e),e},e.prototype.getDefaultStep=function(e,t,n){var r=D(e,this.xPct);return(100===e||t&&e===this.xPct[r-1])&&(r=Math.max(r-1,1)),(this.xVal[r]-this.xVal[r-1])/n},e.prototype.getNearbySteps=function(e){var t=D(e,this.xPct);return{stepBefore:{startValue:this.xVal[t-2],step:this.xNumSteps[t-2],highestStep:this.xHighestCompleteStep[t-2]},thisStep:{startValue:this.xVal[t-1],step:this.xNumSteps[t-1],highestStep:this.xHighestCompleteStep[t-1]},stepAfter:{startValue:this.xVal[t],step:this.xNumSteps[t],highestStep:this.xHighestCompleteStep[t]}}},e.prototype.countStepDecimals=function(){var e=this.xNumSteps.map(p);return Math.max.apply(null,e)},e.prototype.hasNoSize=function(){return this.xVal[0]===this.xVal[this.xVal.length-1]},e.prototype.convert=function(e){return this.getStep(this.toStepping(e))},e.prototype.handleEntryPoint=function(e,t){var n;if(n="min"===e?0:"max"===e?100:parseFloat(e),!u(n)||!u(t[0]))throw new Error("noUiSlider: 'range' value isn't numeric.");this.xPct.push(n),this.xVal.push(t[0]);var r=Number(t[1]);n?this.xSteps.push(!isNaN(r)&&r):isNaN(r)||(this.xSteps[0]=r),this.xHighestCompleteStep.push(0)},e.prototype.handleStepPoint=function(e,t){if(t)if(this.xVal[e]!==this.xVal[e+1]){this.xSteps[e]=C([this.xVal[e],this.xVal[e+1]],t,0)/P(this.xPct[e],this.xPct[e+1]);var n=(this.xVal[e+1]-this.xVal[e])/this.xNumSteps[e],r=Math.ceil(Number(n.toFixed(3))-1),o=this.xVal[e]+this.xNumSteps[e]*r;this.xHighestCompleteStep[e]=o}else this.xSteps[e]=this.xHighestCompleteStep[e]=this.xVal[e]},e}(),k={to:function(e){return void 0===e?"":e.toFixed(2)},from:Number},E={target:"target",base:"base",origin:"origin",handle:"handle",handleLower:"handle-lower",handleUpper:"handle-upper",touchArea:"touch-area",horizontal:"horizontal",vertical:"vertical",background:"background",connect:"connect",connects:"connects",ltr:"ltr",rtl:"rtl",textDirectionLtr:"txt-dir-ltr",textDirectionRtl:"txt-dir-rtl",draggable:"draggable",drag:"state-drag",tap:"state-tap",active:"active",tooltip:"tooltip",pips:"pips",pipsHorizontal:"pips-horizontal",pipsVertical:"pips-vertical",marker:"marker",markerHorizontal:"marker-horizontal",markerVertical:"marker-vertical",markerNormal:"marker-normal",markerLarge:"marker-large",markerSub:"marker-sub",value:"value",valueHorizontal:"value-horizontal",valueVertical:"value-vertical",valueNormal:"value-normal",valueLarge:"value-large",valueSub:"value-sub"},N={tooltips:".__tooltips",aria:".__aria"};function x(e,t){if(!u(t))throw new Error("noUiSlider: 'step' is not numeric.");e.singleStep=t}function M(e,t){if(!u(t))throw new Error("noUiSlider: 'keyboardPageMultiplier' is not numeric.");e.keyboardPageMultiplier=t}function I(e,t){if(!u(t))throw new Error("noUiSlider: 'keyboardMultiplier' is not numeric.");e.keyboardMultiplier=t}function W(e,t){if(!u(t))throw new Error("noUiSlider: 'keyboardDefaultStep' is not numeric.");e.keyboardDefaultStep=t}function A(e,t){if("object"!==a(t)||Array.isArray(t))throw new Error("noUiSlider: 'range' is not an object.");if(void 0===t.min||void 0===t.max)throw new Error("noUiSlider: Missing 'min' or 'max' in 'range'.");e.spectrum=new F(t,e.snap||!1,e.singleStep)}function j(e,t){if(t=d(t),!Array.isArray(t)||!t.length)throw new Error("noUiSlider: 'start' option is incorrect.");e.handles=t.length,e.start=t}function B(e,t){if("boolean"!==typeof t)throw new Error("noUiSlider: 'snap' option must be a boolean.");e.snap=t}function V(e,t){if("boolean"!==typeof t)throw new Error("noUiSlider: 'animate' option must be a boolean.");e.animate=t}function X(e,t){if("number"!==typeof t)throw new Error("noUiSlider: 'animationDuration' option must be a number.");e.animationDuration=t}function Y(e,t){var n,r=[!1];if("lower"===t?t=[!0,!1]:"upper"===t&&(t=[!1,!0]),!0===t||!1===t){for(n=1;n<e.handles;n++)r.push(t);r.push(!1)}else{if(!Array.isArray(t)||!t.length||t.length!==e.handles+1)throw new Error("noUiSlider: 'connect' option doesn't match handle count.");r=t}e.connect=r}function G(e,t){switch(t){case"horizontal":e.ort=0;break;case"vertical":e.ort=1;break;default:throw new Error("noUiSlider: 'orientation' option is invali
1d.")}}function U(e,t){if(!u(t))throw new Error("noUiSlider: 'margin' option must be numeric.");0!==t&&(e.margin=e.spectrum.getDistance(t))}function z(e,t){if(!u(t))throw new Error("noUiSlider: 'limit' option must be numeric.");if(e.limit=e.spectrum.getDistance(t),!e.limit||e.handles<2)throw new Error("noUiSlider: 'limit' option is only supported on linear sliders with 2 or more handles.")}function H(e,t){var n;if(!u(t)&&!Array.isArray(t))throw new Error("noUiSlider: 'padding' option must be numeric or array of exactly 2 numbers.");if(Array.isArray(t)&&2!==t.length&&!u(t[0])&&!u(t[1]))throw new Error("noUiSlider: 'padding' option must be numeric or array of exactly 2 numbers.");if(0!==t){for(Array.isArray(t)||(t=[t,t]),e.padding=[e.spectrum.getDistance(t[0]),e.spectrum.getDistance(t[1])],n=0;n<e.spectrum.xNumSteps.length-1;n++)if(e.padding[0][n]<0||e.padding[1][n]<0)throw new Error("noUiSlider: 'padding' option must be a positive number(s).");var r=t[0]+t[1],o=e.spectrum.xVal[0],i=e.spectrum.xVal[e.spectrum.xVal.length-1];if(r/(i-o)>1)throw new Error("noUiSlider: 'padding' option must not exceed 100% of the range.")}}function K(e,t){switch(t){case"ltr":e.dir=0;break;case"rtl":e.dir=1;break;default:throw new Error("noUiSlider: 'direction' option was not recognized.")}}function q(e,t){if("string"!==typeof t)throw new Error("noUiSlider: 'behaviour' must be a string containing options.");var n=t.indexOf("tap")>=0,r=t.indexOf("drag")>=0,o=t.indexOf("fixed")>=0,i=t.indexOf("snap")>=0,a=t.indexOf("hover")>=0,l=t.indexOf("unconstrained")>=0,s=t.indexOf("drag-all")>=0,c=t.indexOf("smooth-steps")>=0;if(o){if(2!==e.handles)throw new Error("noUiSlider: 'fixed' behaviour must be used with 2 handles");U(e,e.start[1]-e.start[0])}if(l&&(e.margin||e.limit))throw new Error("noUiSlider: 'unconstrained' behaviour cannot be used with margin or limit");e.events={tap:n||i,drag:r,dragAll:s,smoothSteps:c,fixed:o,snap:i,hover:a,unconstrained:l}}function J(e,t){if(!1!==t)if(!0===t||n(t)){e.tooltips=[];for(var r=0;r<e.handles;r++)e.tooltips.push(t)}else{if(t=d(t),t.length!==e.handles)throw new Error("noUiSlider: must pass a formatter for all handles.");t.forEach((function(e){if("boolean"!==typeof e&&!n(e))throw new Error("noUiSlider: 'tooltips' must be passed a formatter or 'false'.")})),e.tooltips=t}}function Z(e,t){if(t.length!==e.handles)throw new Error("noUiSlider: must pass a attributes for all handles.");e.handleAttributes=t}function $(e,t){if(!n(t))throw new Error("noUiSlider: 'ariaFormat' requires 'to' method.");e.ariaFormat=t}function Q(e,n){if(!t(n))throw new Error("noUiSlider: 'format' requires 'to' and 'from' methods.");e.format=n}function ee(e,t){if("boolean"!==typeof t)throw new Error("noUiSlider: 'keyboardSupport' option must be a boolean.");e.keyboardSupport=t}function te(e,t){e.documentElement=t}function ne(e,t){if("string"!==typeof t&&!1!==t)throw new Error("noUiSlider: 'cssPrefix' must be a string or `false`.");e.cssPrefix=t}function re(e,t){if("object"!==a(t))throw new Error("noUiSlider: 'cssClasses' must be an object.");"string"===typeof e.cssPrefix?(e.cssClasses={},Object.keys(t).forEach((function(n){e.cssClasses[n]=e.cssPrefix+t[n]}))):e.cssClasses=t}function oe(e){var t={margin:null,limit:null,padding:null,animate:!0,animationDuration:300,ariaFormat:k,format:k},n={step:{r:!1,t:x},keyboardPageMultiplier:{r:!1,t:M},keyboardMultiplier:{r:!1,t:I},keyboardDefaultStep:{r:!1,t:W},start:{r:!0,t:j},connect:{r:!0,t:Y},direction:{r:!0,t:K},snap:{r:!1,t:B},animate:{r:!1,t:V},animationDuration:{r:!1,t:X},range:{r:!0,t:A},orientation:{r:!1,t:G},margin:{r:!1,t:U},limit:{r:!1,t:z},padding:{r:!1,t:H},behaviour:{r:!0,t:q},ariaFormat:{r:!1,t:$},format:{r:!1,t:Q},tooltips:{r:!1,t:J},keyboardSupport:{r:!0,t:ee},documentElement:{r:!1,t:te},cssPrefix:{r:!0,t:ne},cssClasses:{r:!0,t:re},handleAttributes:{r:!1,t:Z}},r={connect:!1,direction:"ltr",behaviour:"tap",orientation:"horizontal",keyboardSupport:!0,cssPrefix:"noUi-",cssClasses:E,keyboardPageMultiplier:5,keyboardMultiplier:1,keyboardDefaultStep:10};e.format&&!e.ariaFormat&&(e.ariaFormat=e.format),Object.keys(n).forEac
vendor: 1,164 bytes, line 1
1h((function(i){if(o(e[i])||void 0!==r[i])n[i].t(t,o(e[i])?e[i]:r[i]);else if(n[i].r)throw new Error("noUiSlider: '"+i+"' is required.")})),t.pips=e.pips;var i=document.createElement("div"),a=void 0!==i.style.msTransform,l=void 0!==i.style.transform;t.transformRule=l?"transform":a?"msTransform":"webkitTransform";var s=[["left","top"],["right","bottom"]];return t.style=s[t.dir][t.ort],t}function ie(t,n,a){var s,u,p,P,C,O=w(),S=_(),D=S&&b(),R=t,T=n.spectrum,L=[],F=[],k=[],E=0,x={},M=t.ownerDocument,I=n.documentElement||M.documentElement,W=M.body,A="rtl"===M.dir||1===n.ort?0:100;function j(e,t){var n=M.createElement("div");return t&&y(n,t),e.appendChild(n),n}function B(e,t){var r=j(e,n.cssClasses.origin),o=j(r,n.cssClasses.handle);if(j(o,n.cssClasses.touchArea),o.setAttribute("data-handle",String(t)),n.keyboardSupport&&(o.setAttribute("tabindex","0"),o.addEventListener("keydown",(function(e){return pe(e,t)}))),void 0!==n.handleAttributes){var i=n.handleAttributes[t];Object.keys(i).forEach((function(e){o.setAttribute(e,i[e])}))}return o.setAttribute("role","slider"),o.setAttribute("aria-orientation",n.ort?"vertical":"horizontal"),0===t?y(o,n.cssClasse
1s.handleLower):t===n.handles-1&&y(o,n.cssClasses.handleUpper),r}function V(e,t){return!!t&&j(e,n.cssClasses.connect)}function X(e,t){var r=j(t,n.cssClasses.connects);u=[],p=[],p.push(V(r,e[0]));for(var o=0;o<n.handles;o++)u.push(B(t,o)),k[o]=o,p.push(V(r,e[o+1]))}function Y(e){y(e,n.cssClasses.target),0===n.dir?y(e,n.cssClasses.ltr):y(e,n.cssClasses.rtl),0===n.ort?y(e,n.cssClasses.horizontal):y(e,n.cssClasses.vertical);var t=getComputedStyle(e).direction;return y(e,"rtl"===t?n.cssClasses.textDirectionRtl:n.cssClasses.textDirectionLtr),j(e,n.cssClasses.base)}function G(e,t){return!(!n.tooltips||!n.tooltips[t])&&j(e.firstChild,n.cssClasses.tooltip)}function U(){return R.hasAttribute("disabled")}function z(e){var t=u[e];return t.hasAttribute("disabled")}function H(){C&&(ge("update"+N.tooltips),C.forEach((function(e){e&&r(e)})),C=null)}function K(){H(),C=u.map(G),me("update"+N.tooltips,(function(e,t,r){if(C&&n.tooltips&&!1!==C[t]){var o=e[t];!0!==n.tooltips[t]&&(o=n.tooltips[t].to(r[t])),C[t].innerHTML=o}}))}function q(){ge("update"+N.aria),me("update"+N.aria,(function(e,t,r,o,i){k.forEach((function(e){var t=u[e],o=be(F,e,0,!0,!0,!0),a=be(F,e,100,!0,!0,!0),l=i[e],s=String(n.ariaFormat.to(r[e]));o=T.fromStepping(o).toFixed(1),a=T.fromStepping(a).toFixed(1),l=T.fromStepping(l).toFixed(1),t.children[0].setAttribute("aria-valuemin",o),t.children[0].setAttribute("aria-valuemax",a),t.children[0].setAttribute("aria-valuenow",l),t.children[0].setAttribute("aria-valuetext",s)}))}))}function J(t){if(t.mode===e.PipsMode.Range||t.mode===e.PipsMode.Steps)return T.xVal;if(t.mode===e.PipsMode.Count){if(t.values<2)throw new Error("noUiSlider: 'values' (>= 2) required for mode 'count'.");var n=t.values-1,r=100/n,o=[];while(n--)o[n]=n*r;return o.push(100),Z(o,t.stepped)}return t.mode===e.PipsMode.Positions?Z(t.values,t.stepped):t.mode===e.PipsMode.Values?t.stepped?t.values.map((function(e){return T.fromStepping(T.getStep(T.toStepping(e)))})):t.values:[]}function Z(e,t){return e.map((function(e){return T.fromStepping(t?T.getStep(e):e)}))}function $(t){function n(e,t){return Number((e+t).toFixed(7))}var r=J(t),o={},i=T.xVal[0],a=T.xVal[T.xVal.length-1],s=!1,c=!1,u=0;return r=l(r.slice().sort((function(e,t){return e-t}))),r[0]!==i&&(r.unshift(i),s=!0),r[r.length-1]!==a&&(r.push(a),c=!0),r.forEach((function(i,a){var l,h,f,d,p,y,m,v,g,w,b=i,_=r[a+1],P=t.mode===e.PipsMode.Steps;for(P&&(l=T.xNumSteps[a]),l||(l=_-b),void 0===_&&(_=b),l=Math.max(l,1e-7),h=b;h<=_;h=n(h,l)){for(d=T.toStepping(h),p=d-u,v=p/(t.density||1),g=Math.round(v),w=p/g,f=1;f<=g;f+=1)y=u+f*w,o[y.toFixed(5)]=[T.fromStepping(y),0];m=r.indexOf(h)>-1?e.PipsType.LargeValue:P?e.PipsType.SmallValue:e.PipsType.NoValue,!a&&s&&h!==_&&(m=0),h===_&&c||(o[d.toFixed(5)]=[h,m]),u=d}})),o}function Q(t,r,o){var i,a,l=M.createElement("div"),s=(i={},i[e.PipsType.None]="",i[e.PipsType.NoValue]=n.cssClasses.valueNormal,i[e.PipsType.LargeValue]=n.cssClasses.valueLarge,i[e.PipsType.SmallValue]=n.cssClasses.valueSub,i),c=(a={},a[e.PipsType.None]="",a[e.PipsType.NoValue]=n.cssClasses.markerNormal,a[e.PipsType.LargeValue]=n.cssClasses.markerLarge,a[e.PipsType.SmallValue]=n.cssClasses.markerSub,a),u=[n.cssClasse
1s.valueHorizontal,n.cssClasses.valueVertical],h=[n.cssClasses.markerHorizontal,n.cssClasses.markerVertical];function f(e,t){var r=t===n.cssClasses.value,o=r?u:h,i=r?s:c;return t+" "+o[n.ort]+" "+i[e]}function d(t,i,a){if(a=r?r(i,a):a,a!==e.PipsType.None){var s=j(l,!1);s.className=f(a,n.cssClasses.marker),s.style[n.style]=t+"%",a>e.PipsType.NoValue&&(s=j(l,!1),s.className=f(a,n.cssClasses.value),s.setAttribute("data-value",String(i)),s.style[n.style]=t+"%",s.innerHTML=String(o.to(i)))}}return y(l,n.cssClasses.pips),y(l,0===n.ort?n.cssClasses.pipsHorizontal:n.cssClasses.pipsVertical),Object.keys(t).forEach((function(e){d(e,t[e][0],t[e][1])})),l}function ee(){P&&(r(P),P=null)}function te(e){ee();var t=$(e),n=e.filter,r=e.format||{to:function(e){return String(Math.round(e))}};return P=R.appendChild(Q(t,n,r)),P}function ne(){var e=s.getBoundingClientRect(),t="offset"+["Width","Height"][n.ort];return 0===n.ort?e.width||s[t]:e.height||s[t]}function re(e,t,r,o){var i=function(i){var a=ie(i,o.pageOffset,o.target||t);return!!a&&(!(U()&&!o.doNotReject)&&(!(v(R,n.cssClasse
1s.tap)&&!o.doNotReject)&&(!(e===O.start&&void 0!==a.buttons&&a.buttons>1)&&((!o.hover||!a.buttons)&&(D||a.preventDefault(),a.calcPoint=a.points[n.ort],void r(a,o))))))},a=[];return e.split(" ").forEach((function(e){t.addEventListener(e,i,!!D&&{passive:!0}),a.push([e,i])})),a}function ie(e,t,n){var r=0===e.type.indexOf("touch"),o=0===e.type.indexOf("mouse"),i=0===e.type.indexOf("pointer"),a=0,l=0;if(0===e.type.indexOf("MSPointer")&&(i=!0),"mousedown"===e.type&&!e.buttons&&!e.touches)return!1;if(r){var s=function(t){var r=t.target;return r===n||n.contains(r)||e.composed&&e.composedPath().shift()===n};if("touchstart"===e.type){var c=Array.prototype.filter.call(e.touches,s);if(c.length>1)return!1;a=c[0].pageX,l=c[0].pageY}else{var u=Array.prototype.find.call(e.changedTouches,s);if(!u)return!1;a=u.pageX,l=u.pageY}}return t=t||g(M),(o||i)&&(a=e.clientX+t.x,l=e.clientY+t.y),e.pageOffset=t,e.points=[a,l],e.cursor=o||i,e}function ae(e){var t=e-c(s,n.ort),r=100*t/ne();return r=f(r),n.dir?100-r:r}function le(e){var t=100,n=!1;return u.forEach((function(r,o){if(!z(o)){var i=F[o],a=Math.abs(i-e),l=100===a&&100===t,s=a<t,c=a<=t&&e>i;(s||c||l)&&(n=o,t=a)}})),n}function se(e,t){"mouseout"===e.type&&"HTML"===e.target.nodeName&&null===e.relatedTarget&&ue(e,t)}function ce(e,t){if(-1===navigator.appVersion.indexOf("MSIE 9")&&0===e.buttons&&0!==t.buttonsProperty)return ue(e,t);var r=(n.dir?-1:1)*(e.calcPoint-t.startCalcPoint),o=100*r/t.baseSize;Pe(r>0,o,t.locations,t.handleNumbers,t.connect)}function ue(e,t){t.handle&&(m(t.handle,n.cssClasses.active),E-=1),t.listeners.forEach((function(e){I.removeEventListener(e[0],e[1])}
1)),0===E&&(m(R,n.cssClasses.drag),Se(),e.cursor&&(W.style.cursor="",W.removeEventListener("selectstart",i))),n.events.smoothSteps&&(t.handleNumbers.forEach((function(e){De(e,F[e],!0,!0,!1,!1)})),t.handleNumbers.forEach((function(e){we("update",e)}))),t.handleNumbers.forEach((function(e){we("change",e),we("set",e),we("end",e)}))}function he(e,t){if(!t.handleNumbers.some(z)){var r;if(1===t.handleNumbers.length){var o=u[t.handleNumbers[0]];r=o.children[0],E+=1,y(r,n.cssClasses.active)}e.stopPropagation();var a=[],l=re(O.move,I,ce,{target:e.target,handle:r,connect:t.connect,listeners:a,startCalcPoint:e.calcPoint,baseSize:ne(),pageOffset:e.pageOffset,handleNumbers:t.handleNumbers,buttonsProperty:e.buttons,locations:F.slice()}),s=re(O.end,I,ue,{target:e.target,handle:r,listeners:a,doNotReject:!0,handleNumbers:t.handleNumbers}),c=re("mouseout",I,se,{target:e.target,handle:r,listeners:a,doNotReject:!0,handleNumbers:t.handleNumbers});a.push.apply(a,l.concat(s,c)),e.cursor&&(W.style.cursor=getComputedStyle(e.target).cursor,u.length>
11&&y(R,n.cssClasses.drag),W.addEventListener("selectstart",i,!1)),t.handleNumbers.forEach((function(e){we("start",e)}))}}function fe(e){e.stopPropagation();var t=ae(e.calcPoint),r=le(t);!1!==r&&(n.events.snap||h(R,n.cssClasses.tap,n.animationDuration),De(r,t,!0,!0),Se(),we("slide",r,!0),we("update",r,!0),n.events.snap?he(e,{handleNumbers:[r]}):(we("change",r,!0),we("set",r,!0)))}function de(e){var t=ae(e.calcPoint),n=T.getStep(t),r=T.fromStepping(n);Object.keys(x).forEach((function(e){"hover"===e.split(".")[0]&&x[e].forEach((function(e){e.call(Ae,r)}))}))}function pe(e,t){if(U()||z(t))return!1;var r=["Left","Right"],o=["Down","Up"],i=["PageDown","PageUp"],a=["Home","End"];n.dir&&!n.ort?r.reverse():n.ort&&!n.dir&&(o.reverse(),i.reverse());var l,s=e.key.replace("Arrow",""),c=s===i[0],u=s===i[1],h=s===o[0]||s===r[0]||c,f=s===o[1]||s===r[1]||u,d=s===a[0],p=s===a[1];if(!h&&!f&&!d&&!p)return!0;if(e.preventDefault(),f||h){var y=h?0:1,m=xe(t),v=m[y];if(null===v)return!1;!1===v&&(v=T.getDefaultStep(F[t],h,n.keyboardDefaultStep)),v*=u||c?n.keyboardPageMultiplier:n.keyboardMultiplier,v=Math.max(v,1e-7),v*=h?-1:1,l=L[t]+v}else l=p?n.spectrum.xVal[n.spectrum.xVal.length-1]:n.spectrum.xVal[0];return De(t,T.toStepping(l),!0,!0),we("slide",t),we("update",t),we("change",t),we("set",t),!1}function ye(e){e.fixed||u.forEach((function(e,t){re(O.start,e.children[0],he,{handleNumbers:[t]})}
vendor: 2,720 bytes, line 1
1)),e.tap&&re(O.start,s,fe,{}),e.hover&&re(O.move,s,de,{hover:!0}),e.drag&&p.forEach((function(t,r){if(!1!==t&&0!==r&&r!==p.length-1){var o=u[r-1],i=u[r],a=[t],l=[o,i],s=[r-1,r];y(t,n.cssClasses.draggable),e.fixed&&(a.push(o.children[0]),a.push(i.children[0])),e.dragAll&&(l=u,s=k),a.forEach((function(e){re(O.start,e,he,{handles:l,handleNumbers:s,connect:t})}))}}))}function me(e,t){x[e]=x[e]||[],x[e].push(t),"update"===e.split(".")[0]&&u.forEach((function(e,t){we("update",t)}))}function ve(e){return e===N.aria||e===N.tooltips}function ge(e){var t=e&&e.split(".")[0],n=t?e.substring(t.length):e;Object.keys(x).forEach((function(e){var r=e.split(".")[0],o=e.substring(r.length);t&&t!==r||n&&n!==o||ve(o)&&n!==o||delete x[e]}))}function we(e,t,r){Object.keys(x).forEach((function(o){var i=o.split(".")[0];e===i&&x[o].forEach((function(e){e.call(Ae,L.map(n.format.to),t,L.slice(),r||!1,F.slice(),Ae)}))}))}function be(e,t,r,o,i,a,l){var s;return u.length>1&&!n.events.unconstrained&&(o&&t>0&&(s=T.getAbsoluteDistance(e[t-1],n.margin,!1),r=Math.max(r,s)),i&&t<u.length-1&&(s=T.getAbsoluteDistance(e[t+1],n.margin,!0),r=Math.min(r,s))),u.length>1&&n.limit&&(o&&t>0&&(s=T.getAbsoluteDistance(e[t-1],n.limit,!1),r=Math.min(r,s)),i&&t<u.length-1&&(s=T.getAbsoluteDistance(e[t+1],n.limit,!0),r=Math.max(r,s))),n.padding&&(0===t&&(s=T.getAbsoluteDistance(0,n.padding[0],!1),r=Math.max(r,s)),t===u.length-1&&(s=T.getAbsoluteDistance(100,n.padding[1],!0),r=Math.min(r,s))),l||(r=T.getStep(r)),r=f(r),!(r===e[t]&&!a)&&r}function _e(e,t){var r=n.ort;return(r?t:e)+", "+(r?e:t)}function Pe(e,t,r,o,i){var a=r.slice(),l=o[0],s=n.events.smoothSteps,c=[!e,e],u=[e,!e];o=o.slice(),e&&o.reverse(),o.length>1?o.forEach((function(e,n){var r=be(a,e,a[e]+t,c[n],u[n],!1,s);!1===r?t=0:(t=r-a[e],a[e]=r)})):c=u=[!0];var h=!1;o.forEach((function(e,n){h=De(e,r[e]+t,c[n],u[n],!1,s)||h})),h&&(o.forEach((function(e){we("update",e),we("slide",e)})),void 0!=i&&we("drag",l))}function Ce(e,t){return n.dir?100-e-t:e}function Oe(e,t){F[e]=t,L[e]=T.fromStepping(t);var r=Ce(t,0)-A,o="translate("+_e(r+"%","0")+")";u[e].style[n.transformRule]=o,Re(e),Re(e+1)}function Se(){k.forEach((function(e){var t=F[e]>50?-1:1,n=3+(u.length+t*e);u[e].style.zIndex=String(n)}))}function De(e,t,n,r,o,i){return o||(t=be(F,e,t,n,r,!1,i)),!1!==t&&(Oe(e,t),!0)}function Re(e){if(p[e]){var t=0,r=100;0!==e&&(t=F[e-1]),e!==p.length-1&&(r=F[e]);var o=r-t,i="translate("+_e(Ce(t,o)+"%","0")+")",a="scale("+_e(o/100,"1")+")";p[e].style[n.transformRule]=i+" "+a}}function Te(e,t){return null===e||!1===e||void 0===e?F[t]:("number"===typeof e&&(e=String(e)),e=n.format.from(e),!1!==e&&(e=T.toStepping(e)),!1===e||isNaN(e)?F[t]:e)}function Le(e,t,r){var o=d(e),i=void 0===F[0];
1t=void 0===t||t,n.animate&&!i&&h(R,n.cssClasses.tap,n.animationDuration),k.forEach((function(e){De(e,Te(o[e],e),!0,!1,r)}));var a=1===k.length?0:1;if(i&&T.hasNoSize()&&(r=!0,F[0]=0,k.length>1)){var l=100/(k.length-1);k.forEach((function(e){F[e]=e*l}))}for(;a<k.length;++a)k.forEach((function(e){De(e,F[e],!0,!0,r)}));Se(),k.forEach((function(e){we("update",e),null!==o[e]&&t&&we("set",e)}))}function Fe(e){Le(n.start,e)}function ke(e,t,n,r){if(e=Number(e),!(e>=0&&e<k.length))throw new Error("noUiSlider: invalid handle number, got: "+e);De(e,Te(t,e),!0,!0,r),we("update",e),n&&we("set",e)}function Ee(e){if(void 0===e&&(e=!1),e)return 1===L.length?L[0]:L.slice(0);var t=L.map(n.format.to);return 1===t.length?t[0]:t}function Ne(){ge(N.aria),ge(N.tooltips),Object.keys(n.cssClasses).forEach((function(e){m(R,n.cssClasses[e])}));while(R.firstChild)R.removeChild(R.firstChild);delete R.noUiSlider}function xe(e){var t=F[e],r=T.getNearbySteps(t),o=L[e],i=r.thisStep.step,a=null;if(n.snap)return[o-r.stepBefore.startValue||null,r.stepAfter.startValue-o||null];!1!==i&&o+i>r.stepAfter.startValue&&(i=r.stepAfter.startValue-o),a=o>r.thisStep.startValue?r.thisStep.step:!1!==r.stepBefore.step&&o-r.stepBefore.highestStep,100===t?i=null:0===t&&(a=null);var l=T.countStepDecimals();return null!==i&&!1!==i&&(i=Number(i.toFixed(l))),null!==a&&!1!==a&&(a=Number(a.toFixed(l))),[a,i]}function Me(){return k.map(xe)}function Ie(e,t){var r=Ee(),i=["margin","limit","padding","range","animate","snap","step","format","pips","tooltips"];i.forEach((function(t){void 0!==e[t]&&(a[t]=e[t])}));var l=oe(a);i.forEach((function(t){void 0!==e[t]&&(n[t]=l[t])})),T=l.spectrum,n.margin=l.margin,n.limit=l.limit,n.padding=l.padding,n.pips?te(n.pips):ee(),n.tooltips?K():H(),F=[],Le(o(e.start)?e.start:r,t)}function We(){s=Y(R),X(n.connect,s),ye(n.events),Le(n.start),n.pips&&te(n.pips),n.tooltips&&K(),q()}We();var Ae={destroy:Ne,steps:Me,on:me,off:ge,get:Ee,set:Le,setHandle:ke,reset:Fe,__moveHandles:function(e,t,n){Pe(e,t,F,n)},options:a,updateOptions:Ie,target:R,removePips:ee,removeTooltips:H,getPositions:function(){return F.slice()},getTooltips:function(){return C},getOrigins:function(){return u},pips:te};return Ae}function ae(e,t){if(!e||!e.nodeName)throw new Error("noUiSlider: create requires a single element, got: "+e);if(e.noUiSlider)throw new Error("noUiSlider: Slider was already initialized.");var n=oe(t),r=ie(e,n,t);return e.noUiSlider=r,r}var le={__spectrum:F,cssClasses:E,create:ae};e.create=ae,e.cssClasses=E,e["default"]=le,Object.defineProperty(e,"__esModule",{value:!0})}))},1:function(e,t){},10:function(e,t){},11:function(e,t){},12:function(e,t){},13:function(e,t){},14:function(e,t){},15:function(e,t){},16:function(e,t){},"190a":function(e,t,n){},2:function(e,t){},"21d0":function(e,t,n){"use strict";n("91a7")},2480:function(e,t,n){"use strict";n("805c")},"257c":function(e,t,n){"use strict";n("e425")},2733:function(e,t,n){},2798:function(e,t,n){"use strict";n("b693")},"2cf0":function(e,t,n){"use strict";n("c3ba")},"2e60":function(e,t,n){"use strict";n("a89f")},3:function(e,t){},"30c0":function(e,t,n){"use strict";n("4a4c")},3758:function(e,t,n){"use strict";n("4b60")},"3d73":function(e,t,n){},4:function(e,t){},4073:function(e,t,n){},"439e":function(e,t,n){"use strict";n("190a")},"49ab":function(e,t,n){"use strict";n("2733")},"4a4c":function(e,t,n){},"4b60":function(e,t,n){},"4d81":function(e,t,n){"use strict";n("ecab")},5:function(e,t){},"570c":function(e,t,n){},6:function(e,t){},"653d":function(e,t,n){"use strict";n("570c")},7:function(e,t){},"736f":function(e,t,n){"use strict";n("741e")},"741e":function(e,t,n){},"7ac7":function(e,t,n){},"7d0a":function(e,t,n){},"7e94":function(e,t,n){},8:function(e,t){},"805c":function(e,t,n){},"85ec":function(e,t,n){},"899d":function(e,t,n){"use strict";n("7d0a")},9:function(e,t){},"91a7":function(e,t,n){},"93c0":function(e,t,n){},a200:function(e,t,n){"use strict";n("f249")},a89f:function(e,t,n){},abb3:function(e,t,n){"use strict";n("f6a8")},b693:function(e,t,n){},bb3d:function(e,t,n){"use strict";n("93c0")},c3ba:function(e,t,n){},cd49:function(e,t,n){"use strict";n.r(t);var r={};n.r(r),n.d(r,"example3",(function(){return cC})),n.d(r,"example1",(function(){return uC})),n.d(r,"UpdatedExample",(function(){return hC})),n.d(r,"dafdtemplate",(function(){return fC})),n.d(r,"default",(function(){return pC}));var o,i,a,l=n("2b0e"),s=function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("v-app",{attrs:{id:"3duf"}},[n("ConnectionEscHintBanner"),n("LayoutSidebar")],1)},c=[],u=function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("div",[n("div",{attrs:{id:"view-container"}},[n("div",{attrs:{id:"canvas_block"}},[n("canvas",{ref:"rendingcanvas",attrs:{id:"c",tabindex:"0",resize:""}}),e._t("default",(function(){return[n("ComponentContextMenu",{ref:"contextMenu",attrs:{id:"c
1ontextMenu"}})]})),e._t("default",(function(){return[n("ConnectionContextMenu",{ref:"contextMenu",attrs:{id:"contextMenu"}})]}))],2),n("div",{attrs:{id:"renderContainer"}})]),n("ResolutionToolbar"),n("ZoomSlider")],1)},h=[],f=n("7ecf"),d=n.n(f),p=n("2222"),y=n.n(p);function m(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function v(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function g(e,t,n){return t&&v(e.prototype,t),n&&v(e,n),e}(function(e){e["FLOW"]="FLOW",e["CONTROL"]="CONTROL",e["INTEGRATION"]="INTEGRATION"})(o||(o={})),function(e){e["NORMALLY_OPEN"]="NORMALLY_OPEN",e["NORMALLY_CLOSED"]="NORMALLY_CLOSED"}(i||(i={})),function(e){e["UNION"]="UNION",e["INTERSECTION"]="INTERSECTION",e["DIFFERENCE"]="SUBTRACTION",e["XOR"]="XOR"}(a||(a={}));var w,b=function(){function e(t,n,r,o){m(this,e),this._id=d.a.v1(),this._x=t,this._y=n,this._label=r,this._layer=o}return g(e,[{key:"layer",get:function(){return this._layer},set:function(e){this._layer=e}},{key:"label",get:function(){return this._label},set:function(e){this._label=e}},{key:"y",get:function(){return this._y},set:function(e){this._y=e}},{key:"x",get:function(){return this._x},set:function(e){this._x=e}},{key:"id",get:function(){return this._id},set:function(e){this._id=e}},{key:"toInterchangeV1",value:function(){return{x:this._x,y:this._y,layer:this._layer,label:this._label}}}],[{key:"calculateAbsolutePosition",value:function(e,t){var n,r=t.getDrawOrigin(),o=r[0],i=r[1],a=new y.a.Point(o+e.x,i+e.y);try{var l=t.getCenterPosition();n=new y.a.Point(l[0],l[1])}catch(h){n=new y.a.Point(o,i)}var s=t.getRotation();s&&(a=a.rotate(s,n));var c=a.x,u=a.y;return t.getMirrorByX()&&(c=2*n.x-c),t.getMirrorByY()&&(u=2*n.y-u),[c,u]}},{key:"insetTowardCenter",value:function(e,t,n){var r=e[0],o=e[1];try{var i=t.getCenterPosition();r=i[0],o=i[1]}catch(u){}var a=r-e[0],l=o-e[1],s=Math.hypot(a,l);if(s<1e-6)return[e[0],e[1]];var c=Math.min(Math.abs(n),.25*s)/s;return[e[0]+a*c,e[1]+l*c]}},{key:"mixerTerminalHinge",value:function(e,t,n){return[e[0],e[1]]}},{key:"fromInterchangeV1",value:function(t){var n=o.FLOW;return"FLOW"===t.layer?n=o.FLOW:"CONTROL"===t.layer?n=o.CONTROL:"INTEGRATION"===t.layer&&(n=o.INTEGRATION),new e(t.x,t.y,t.label,n)}}]),e}();function _(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function P(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?_(Object(n),!0).forEach((function(t){C(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):_(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function C(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function O(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function S(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function D(e,t,n){return t&&S(e.prototype,t),n&&S(e,n),e}(function(e){e["FEATURE_POSITION_TOOL"]="positionTool",e["COMPONENT_POSITION_TOOL"]="componentPositionTool",e["MULTILAYER_POSITION_TOOL"]="multilayerPositionTool",e["VALVE_INSERTION_TOOL"]="valveInsertionTool"})(w||(w={}));var R=function(){function e(){O(this,e),this.__unique=null,this.__heritable=null,this.__defaults=null,this.__minimum=null,this.__maximum=null,this.__units=null,this.__placementTool=null,this.__toolParams=null,this.__featureParams=null,this.__targetParams=null,this.__mint=null,this.__renderKeys=["FLOW"],this._previewImage="",this.__zOffsetKeys=null,this.__substrateOffset=null,this.__childFeatureMacros=[],this.__setupDefinitions()}return D(e,[{key:"mint",get:function(){if(null===this.__mint)throw new Error("User needs to provide unique MINT string for component type");return this.__mint}},{key:"zOffsetKey",value:function(e){if(null===this.__zOffsetKeys)throw new Error("zOffsetKey cannot be null instantiate in the __setupDefinitions");
1if(this.__zOffsetKeys.hasOwnProperty(e))return this.__zOffsetKeys[e];throw new Error("zOffsetKey does not contain key "+e)}},{key:"substrateOffset",value:function(e){if(null===this.__substrateOffset)throw new Error("substrateOffset cannot be null instantiate in the __setupDefinitions");if(this.__substrateOffset.hasOwnProperty(e))return this.__substrateOffset[e];throw new Error("substrateOffset does not contain key "+e)}},{key:"featureParams",get:function(){if(null===this.__featureParams)throw new Error("featureParams cannot be null instantiate in the __setupDefinitions");return this.__featureParams}},{key:"targetParams",get:function(){if(null===this.__targetParams)throw new Error("targetParams cannot be null instantiate in the __setupDefinitions");return this.__targetParams}},{key:"placementTool",get:function(){if(null===this.__placementTool)throw new Error("placementtool cannot be null instantiate in the __setupDefinitions");return this.__placementTool}},{key:"toolParams",get:function(){if(null===this.__toolParams)throw new Error("toolparams cannot be null instantiate in the __setupDefinitions");return this.__toolParams}},{key:"defaults",get:function(){if(null===this.__defaults)throw new Error("defaults cannot be null instantiate in the __setupDefinitions");return this.__defaults}},{key:"minimum",get:function(){if(null===this.__minimum)throw new Error("minimum cannot be null instantiate in the __setupDefinitions");return this.__minimum}},{key:"maximum",get:function(){if(null===this.__maximum)throw new Error("maximum cannot be null instantiate in the __setupDefinitions");return this.__maximum}},{key:"units",get:function(){if(null===this.__units)throw new Error("units cannot be null instantiate in the __setupDefinitions");return this.__units}},{key:"unique",get:function(){if(null===this.__unique)throw new Error("unique cannot be null instantiate in the __setupDefinitions");return this.__unique}},{key:"heritable",get:function(){if(null===this.__heritable)throw new Error("Heritable cannot be null instantiate in the __setupDefinitions");return this.__heritable}},{key:"renderKeys",get:function(){if(null===this.__renderKeys)throw new Error("renderKeys cannot be null instantiate in the __setupDefinitions");return this.__renderKeys}},{key:"previewImage",get:function(){return this._previewImage}},{key:"childFeatureMacros",get:function(){return this.__childFeatureMacros}},{key:"resetToFactoryParameterDefaults",value:function(){this.__setupDefinitions()}},{key:"__setupDefinitions",value:function(){this.__unique={position:"Point"},this.__heritable={componentSpacing:"Float",height:"Float"},this.__defaults={componentSpacing:2e3,height:250}
1,this.__units={componentSpacing:"μm",height:"μm"},this.__minimum={componentSpacing:0,height:10},this.__maximum={componentSpacing:1e4,height:1200},this.__featureParams={componentSpacing:"componentSpacing",position:"position"},this.__targetParams={},this.__placementTool="componentPositionTool",this.__toolParams={position:"position"},this.__renderKeys=["FLOW"],this.__mint="TEMPLATE",this.__zOffsetKeys={FLOW:"height"},this.__substrateOffset={FLOW:"0"}}},{key:"render2D",value:function(e,t){console.error("Default component template being used. User needs to provide method for component definition, look at examples");var n=e.xspan,r=e.yspan,o=e.position[0],i=e.position[1],a=new y.a.Path.Rectangle(new y.a.Point(o-n/2,i-r/2),new y.a.Size(n,r));return a.fillColor=e.color,a}},{key:"render2DTarget",value:function(e,t){throw new Error("User needs to provide method for component definition, look at examples")}},{key:"getPorts",value:function(e){console.error("User needs to provide method for component definition, look at examples");var t=[];return t.push(new b(0,0,"1",o.FLOW)),t}},{key:"getBounds",value:function(e){for(var t=this.renderKeys,n=[],r=0;r<t.length;r++){var o=this.render2D(e,t[r]);o.visible=!1,o instanceof y.a.PointText||n.push(o.bounds)}var i=n.reduce((function(e,t){return null===t||t instanceof y.a.PointText?e:e?e.unite(t):t}));return i||new y.a.Rectangle(0,0,0,0)}},{key:"getDimensions",value:function(e){tf&&y.a.setup(new y.a.Size([64e3,48e3]));var t=P(P({},e),{},{position:[0,0]}),n=this.getBounds(t);if(null===n)throw new Error("No bounds found for component");var r=n.width,o=n.height;return{xspan:r,yspan:o}}},{key:"getDrawOffset",value:function(e){var t=P(P({},e),{},{position:[0,0],rotation:0,mirrorByX:0,mirrorByY:0}),n=t.position,r=this.getBounds(t);if(null===r)throw new Error("unitedBounds is null");var o=n[0]-r.topLeft.x,i=n[1]-r.topLeft.y;return[o,i]}},{key:"getCenter",value:function(e){var t=P(P({},e),{},{rotation:0,mirrorByX:0,mirrorByY:0}),n=this.getDimensions(t),r=n.xspan/2,o=n.yspan/2;return{x:r,y:o}}},{key:"drawsAtPositionCenter",value:function(){return!1}},{key:"drawOriginFromCenter",value:function(e){var t=e.position,n=Number(Array.isArray(t)?t[0]:0),r=Number(Array.isArray(t)?t[1]:0),o=this.getDrawOffset(e),i=this.getCenter(e);return[n-(Number(i.x)-Number(o[0])),r-(Number(i.y)-Number(o[1]))]}},{key:"transformRender",value:function(e,t){var n,r,o=e.mirrorByX,i=e.mirrorByY,a=e.position[0],l=e.position[1],s=new y.a.Point(a,l),c=e.rotation,u=new y.a.Point(0,0);0==o&&0==i&&0==c||(r=this.getDrawOffset(e),r[0],s.x,n=this.getCenter(e),n.x,u.x=s.x-r[0]+n.x,u.y=s.y-r[1]+n.y),c&&t.rotate(c,u),o&&t.scale(-1,1,u),i&&t.scale(1,-1,u)}}]),e}();function T(e){return T="function"===typeof Symbol&&"symbol"===typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"===typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},T(e)}function L(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function F(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function k(e,t,n){return t&&F(e.prototype,t),n&&F(e,n),e}function E(e,t){if("function"!==typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&N(e,t)}function N(e,t){return N=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},N(e,t)}function x(e){var t=W();return function(){var n,r=A(e);if(t){var o=A(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return M(this,n)}}function M(e,t){if(t&&("object"===T(t)||"function"===typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return I(e)}function I(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function W(){if("undefined"===typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"===typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}function A(e){return A=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},A(e)}var j=function(e){E(n,e);var t=x(n);function n(){return L(this,n),t.call(this)}return k(n,[{key:"__setupDefinitions",value:function(){this.__unique={position:"Point"}
1,this.__heritable={text:"String",height:"Float",fontSize:"Float"},this.__defaults={fontSize:1e4/3,height:250},this.__units={fontSize:"μm",height:"μm"},this.__minimum={fontSize:1e4/3,height:1},this.__maximum={fontSize:1e4/3,height:1e4},this.__toolParams={position:"position"},this.__featureParams={position:"position",text:"text",fontSize:"fontSize",height:"height"},this.__targetParams={text:"text",fontSize:"fontSize",height:"height"},this.__placementTool="PositionTool",this.__renderKeys=["FLOW"],this.__mint="TEXT",this.__zOffsetKeys={FLOW:"height"},this.__substrateOffset={FLOW:"0"}}},{key:"render2D",value:function(e,t){var n=e.position,r=e.text,o=e.color,i=new y.a.PointText(new y.a.Point(n[0],n[1]));return i.justification="center",i.fillColor=o,i.content=r,i.fontSize=1e4/3,i}},{key:"render2DTarget",value:function(e,t){null===e&&(e=this.__renderKeys[0]);var n=this.render2D(t,e);return n.fillColor.alpha=.5,n}}]),n}(R);function B(e){return B="function"===typeof Symbol&&"symbol"===typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"===typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},B(e)}function V(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function X(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function Y(e,t,n){return t&&X(e.prototype,t),n&&X(e,n),e}function G(e,t){if("function"!==typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&U(e,t)}function U(e,t){return U=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},U(e,t)}function z(e){var t=q();return function(){var n,r=J(e);if(t){var o=J(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return H(this,n)}}function H(e,t){if(t&&("object"===B(t)||"function"===typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return K(e)}function K(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function q(){if("undefined"===typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"===typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}function J(e){return J=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},J(e)}var Z=function(e){G(n,e);var t=z(n);function n(){return V(this,n),t.call(this)}return Y(n,[{key:"__setupDefinitions",value:function(){this.__unique={position:"Point"},this.__heritable={componentSpacing:"Float",portRadius:"Float",height:"Float"},this.__defaults={componentSpacing:2e3,portRadius:1e3,height:1100},this.__units={componentSpacing:"μm",portRadius:"μm",height:"μm"},this.__minimum={componentSpacing:0,portRadius:8,height:10},this.__maximum={componentSpacing:1e4,portRadius:3e3,height:1200},this.__placementTool="componentPositionTool",this.__toolParams={position:"position"},this.__featureParams={componentSpacing:"componentSpacing",position:"position",portRadius:"portRadius"},this.__targetParams={componentSpacing:"componentSpacing",portRadius:"portRadius"},this.__renderKeys=["FLOW"],this.__mint="PORT",this.__zOffsetKeys={FLOW:"height"},this.__substrateOffset={FLOW:"0"}}},{key:"render2D",value:function(e,t){var n=e.position,r=e.portRadius,o=e.color,i=new y.a.Point(n[0],n[1]),a=new y.a.Path.Circle(i,r);return a.fillColor=o,a}},{key:"render2DTarget",value:function(e,t){null===e&&(e=this.__renderKeys[0]);var n=this.render2D(t,e);return n.fillColor.alpha=.5,n}},{key:"drawsAtPositionCenter",value:function(){return!0}},{key:"getPorts",value:function(e){var t=[];return t.push(new b(0,0,"1",o.FLOW)),t}}]),n}(R);function $(e){return $="function"===typeof Symbol&&"symbol"===typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"===typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},$(e)}function Q(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function ee(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function te(e,t,n){return t&&ee(e.prototype,t),n&&ee(e,n),e}function ne(e,t){if("function"!==typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&re(e,t)}function re(e,t){return re=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},re(e,t)}function oe(e){var t=le();return function(){var n,r=se(e);if(t){var o=se(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return ie(this,n)}}function ie(e,t){if(t&&("object"===$(t)||"function"===typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return ae(e)}function ae(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function le(){if("undefined"===typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"===typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}function se(e){return se=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},se(e)}var ce=function(e){ne(n,e);var t=oe(n);function n(){return Q(this,n),t.call(this)}return te(n,[{key:"__setupDefinitions",value:function(){this.__unique={position:"Point"},this.__heritable={componentSpacing:"Float",anodeRadius:"Float",pegHeight:"Float",pegWidth:"Float",height:"Float",rotation:"Float",mirrorByX:"Float",mirrorByY:"Float"},this.__defaults={componentSpacing:2e3,anodeRadius:900,pegHeight:200,pegWidth:700,height:1100,rotation:0},this.__units={componentSpacing:"μm",anodeRadius:"μm",pegHeight:"μm",pegWidth:"μm",he
1ight:"μm",rotation:"°"},this.__minimum={componentSpacing:0,anodeRadius:4,pegHeight:100,pegWidth:100,height:10,rotation:0},this.__maximum={componentSpacing:1e4,anodeRadius:2e3,pegHeight:2e3,pegWidth:2e3,height:1200,rotation:90},this.__placementTool="componentPositionTool",this.__toolParams={position:"position"},this.__featureParams={componentSpacing:"componentSpacing",position:"position",anodeRadius:"anodeRadius",pegHeight:"pegHeight",pegWidth:"pegWidth",rotation:"rotation"},this.__targetParams={componentSpacing:"componentSpacing",anodeRadius:"anodeRadius",pegHeight:"pegHeight",pegWidth:"pegWidth",rotation:"rotation"},this.__renderKeys=["FLOW"],this.__mint="ANODE"}},{key:"render2D",value:function(e,t){var n=e.position,r=e.anodeRadius,o=e.pegHeight,i=e.pegWidth,a=e.rotation,l=e.color,s=new y.a.Point(n[0],n[1]),c=new y.a.Path.Circle(s,r);c.fillColor=l;var u=new y.a.Path.Rectangle(new y.a.Rectangle(n[0]-i/2,n[1]-o/2,i,o)),h=c.subtract(u);return h.fillColor=l,c.remove(),u.remove(),h.rotate(a,s)}},{key:"render2DTarget",value:function(e,t){var n=this.render2D(t,e);return n.fillColor.alpha=.5,n}},{key:"getPorts",value:function(e){var t=[];return t.push(new b(0,0,"1",o.FLOW)),t}}]),n}(R);function ue(e){return ue="function"===typeof Symbol&&"symbol"===typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"===typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},ue(e)}function he(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function fe(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function de(e,t,n){return t&&fe(e.prototype,t),n&&fe(e,n),e}function pe(e,t){if("function"!==typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&ye(e,t)}function ye(e,t){return ye=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},ye(e,t)}function me(e){var t=we();return function(){var n,r=be(e);if(t){var o=be(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return ve(this,n)}}function ve(e,t){if(t&&("object"===ue(t)||"function"===typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return ge(e)}function ge(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function we(){if("undefined"===typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"===typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}function be(e){return be=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},be(e)}var _e=function(e){pe(n,e);var t=me(n);function n(){return he(this,n),t.call(this)}return de(n,[{key:"__setupDefinitions",value:function(){this.__unique={position:"Point"},this.__heritable={componentSpacing:"Float",cathodeRadius:"Float",pegRadius:"Float",pegThickness:"Float",height:"Float",rotation:"Float",mirrorByX:"Float",mirrorByY:"Float"},this.__defaults={componentSpacing:2e3,cathodeRadius:900,pegRadius:700,pegThickness:300,height:1100,rotation:0},this.__units={componentSpacing:"μm",cathodeRadius:"μm",pegRadius:"μm",pegThickness:"μm",height:"μm",rotation:"°"},this.__minimum={componentSpacing:0,cathodeRadius:4,pegRadius:100,pegThickness:100,height:10,rotation:0},this.__maximum={componentSpacing:1e4,cathodeRadius:2e3,pegRadius:2e3,pegThickness:2e3,height:1200,rotation:90},this.__placementTool="componentPositionTool",this.__toolParams={position:"position"},this.__featureParams={componentSpacing:"componentSpacing",position:"position",cathodeRadius:"cathodeRadius",pegRadius:"pegRadius",pegThickness:"pegThickness",rotation:"rotation"},this.__targetParams={componentSpacing:"componentSpacing",cathodeRadius:"cathodeRadius",pegRadius:"pegRadius",pegThickness:"pegThickness",rotation:"rotation"},this.__renderKeys=["FLOW"],this.__mint="CATHODE"}},{key:"render2D",value:function(e,t){var n=e.position,r=e.cathodeRadius,o=e.pegRadius,i=e.pegThickness,a=e.rotation,l=e.color,s=new y.a.Point(n[0],n[1]),c=new y.a.Path.Circle(s,r);c.fillColor=l;var u=new y.a.Path.Rectangle(new y.a.Rectangle(n[0]-o/2,n[1]-i/2,o,i)),h=new y.a.Path.Rectangle(new y.a.Rectangle(n[0]-i/2,n[1]-o/2,i,o)),f=c.subtract(u.unite(h));return f.fillColor=l,c.remove(),u.remove(),h.remove(),f.rotate(a,s)}},{key:"render2DTarget",value:function(e,t){null===e&&(e=this.__renderKeys[0]);var n=this.render2D(t,e);return n.fillColor.alpha=.5,n}},{key:"getPorts",value:function(e){var t=[];return t.push(new b(0,0,"1",o.FLOW)),t}}]),n}(R);function Pe(e){return Pe="function"===typeof Symbol&&"symbol"===typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"===typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Pe(e)}var Ce=600,Oe=Ce,Se=1400,De=2e3;new Set(["Channel","RoundedChannel","Connection"]);function Re(e){return Ce}function Te(e,t){var n=1===t?"edgeBend1":"edgeBend2",r=Number(e&&e[n]);if(Number.isFinite(r)&&r>=0)return r;var o=Number(e&&e.channelWidth);return Number.isFinite(o)&&o>0?o/2:Ce/2}function Le(e){var t=Number(e&&e.channelWidth)||Oe,n=Number(e&&e.bendLength)||De,r=Number(e&&e.bendSpacing)||Se,o=Number(e&&e.numberOfBends)||1,i=Te
1(e,1),a=Te(e,2),l=n+2*t,s=t+n/2,c=l,u=s-a,h=(2*o+1)*t+2*o*r;return{channelWidth:t,bendLength:n,e1:i,e2:a,portX:s,port1x:s,port2x:s,port1y:t/2,port2y:h-t/2,firstWidth:s+i,lastStart:u,lastWidth:c-u,lastEnd:c,openingY2:h,drawnWidth:l}}function Fe(e){if(e&&"object"===Pe(e)){var t=Number(e.channelWidth),n=Number.isFinite(t)&&t>0?t/2:Ce/2;void 0!==e.edgeBend1&&null!==e.edgeBend1||(e.edgeBend1=n),void 0!==e.edgeBend2&&null!==e.edgeBend2||(e.edgeBend2=n)}}function ke(e){return ke="function"===typeof Symbol&&"symbol"===typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"===typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},ke(e)}function Ee(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Ne(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function xe(e,t,n){return t&&Ne(e.prototype,t),n&&Ne(e,n),e}function Me(e,t){if("function"!==typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&Ie(e,t)}function Ie(e,t){return Ie=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},Ie(e,t)}function We(e){var t=Be();return function(){var n,r=Ve(e);if(t){var o=Ve(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return Ae(this,n)}}function Ae(e,t){if(t&&("object"===ke(t)||"function"===typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return je(e)}function je(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Be(){if("undefined"===typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"===typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}function Ve(e){return Ve=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},Ve(e)}var Xe=function(e){Me(n,e);var t=We(n);function n(){return Ee(this,n),t.call(this)}return xe(n,[{key:"__setupDefinitions",value:function(){this.__unique={start:"Point",end:"Point"},this.__defaults={channelWidth:Ce,height:250},this.__heritable={channelWidth:"Float",height:"Float"},this.__units={channelWidth:"μm",height:"μm"},this.__minimum={channelWidth:3,height:10},this.__maximum={channelWidth:12e3,height:1200},this.__placementTool="DragTool",this.__toolParams={start:"start",end:"end"},this.__featureParams={start:"start",end:"end",width:"channelWidth"},this.__targetParams={diameter:"channelWidth",channelWidth:"channelWidth"},this.__renderKeys=["FLOW"],this.__mint="CHANNEL",this.__zOffsetKeys={FLOW:"height"},this.__substrateOffset={FLOW:"0"}}},{key:"render2D",value:function(e,t){var n=e.start,r=e.end,o=e.color,i=e.width,a=(e.baseColor,new y.a.Point(n[0],n[1])),l=new y.a.Point(r[0],r[1]),s=l.subtract(a),c=new y.a.Path.Rectangle({size:[s.length,i],point:n,fillColor:o,strokeWidth:0});return c.translate(new y.a.Point(0,-i/2)),c.rotate(s.angle,n),c}},{key:"render2DTarget",value:function(e,t){var n=t.channelWidth/5,r=t.channelWidth,o=t.position[0],i=t.position[1],a=t.color,l=new y.a.Path.Rectangle(new y.a.Rectangle(o-r/2,i-n/2,r,n)),s=l.unite(new y.a.Path.Rectangle(new y.a.Rectangle(o-n/2,i-r/2,n,r)));return s.fillColor=a,s.fillColor.alpha=.5,l}}]),n}(R);function Ye(e){return Ye="function"===typeof Symbol&&"symbol"===typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"===typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Ye(e)}function Ge(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Ue(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function ze(e,t,n){return t&&Ue(e.prototype,t),n&&Ue(e,n),e}function He(e,t){if("function"!==typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&Ke(e,t)}function Ke(e,t){return Ke=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},Ke(e,t)}function qe(e){var t=$e();return function(){var n,r=Qe(e);if(t){var o=Qe(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return Je(this,n)}}function Je(e,t){if(t&&("object"===Ye(t)||"function"===typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return Ze(e)}function Ze(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function $e(){if("undefined"===typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"===typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}function Qe(e){return Qe=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},Qe(e)}var et=function(e){He(n,e);var t=qe(n);function n(){return Ge(this,n),t.call(this)}return ze(n,[{key:"__setupDefinitions",value:function(){this.__unique={position:"Point"},this.__heritable={componentSpacing:"Float",bendSpacing:"Float",numberOfBends:"Float",channelWidth:"Float",edgeBend1:"Float",edgeBend2:"Float",bendLength:"Float",rotation:"Float",height:"Float",mirrorByX:"Float",mirrorByY:"Float"}
1,this.__defaults={componentSpacing:2e3,rotation:0,channelWidth:Oe,edgeBend1:Oe/2,edgeBend2:Oe/2,bendSpacing:Se,numberOfBends:1,bendLength:De,height:250,mirrorByX:0,mirrorByY:0},this.__units={componentSpacing:"μm",rotation:"°",bendSpacing:"μm",numberOfBends:"",channelWidth:"μm",edgeBend1:"μm",edgeBend2:"μm",bendLength:"μm",height:"μm"},this.__minimum={componentSpacing:0,rotation:0,channelWidth:10,edgeBend1:0,edgeBend2:0,bendSpacing:10,numberOfBends:1,bendLength:10,height:10,mirrorByX:0,mirrorByY:0},this.__maximum={componentSpacing:1e4,rotation:360,channelWidth:2e3,edgeBend1:12e3,edgeBend2:12e3,bendSpacing:6e3,numberOfBends:20,bendLength:12e3,height:1200,mirrorByX:1,mirrorByY:1},this.__featureParams={componentSpacing:"componentSpacing",position:"position",channelWidth:"channelWidth",edgeBend1:"edgeBend1",edgeBend2:"edgeBend2",bendSpacing:"bendSpacing",numberOfBends:"numberOfBends",rotation:"rotation",bendLength:"bendLength",mirrorByX:"mirrorByX",mirrorByY:"mirrorByY"},this.__targetParams={componentSpacing:"componentSpacing",channelWidth:"channelWidth",edgeBend1:"edgeBend1",edgeBend2:"edgeBend2",bendSpacing:"bendSpacing",numberOfBends:"numberOfBends",rotation:"rotation",bendLength:"bendLength",mirrorByX:"mirrorByX",mirrorByY:"mirrorByY"},this.__placementTool="componentPositionTool",this.__toolParams={position:"position"},this.__renderKeys=["FLOW"],this.__mint="MIXER",this.__zOffsetKeys={FLOW:"height"},this.__substrateOffset={FLOW:"0"}}},{key:"getPorts",value:function(e){var t=Le(e),n=[];return n.push(new b(t.port1x,t.port1y,"1",o.FLOW)),n.push(new b(t.port2x,t.port2y,"2",o.FLOW)),n}},{key:"render2D",value:function(e,t){var n=e.channelWidth,r=e.bendLength,o=e.bendSpacing,i=(e.rotation,e.numberOfBends),a=e.position[0],l=e.position[1],s=e.color,c=Le(e),u=r+2*n,h=o+2*n,f=2*o+2*n,d=o+n,p=new y.a.CompoundPath("");p.addChild(new y.a.Path.Rectangle(new y.a.Rectangle(a,l,c.firstWidth,n)));for(var m=0;m<i;m++)p.addChild(new y.a.Path.Rectangle(new y.a.Rectangle(a,l+f*m,n,h))),p.addChild(new y.a.Path.Rectangle(new y.a.Rectangle(a,l+d+f*m,u,n))),p.addChild(new y.a.Path.Rectangle(new y.a.Rectangle(a+n+r,l+d+f*m,n,h))),m===i-1?p.addChild(new y.a.Path.Rectangle(new y.a.Rectangle(a+c.lastStart,l+f*(m+1),c.lastWidth,n))):p.addChild(new y.a.Path.Rectangle(new y.a.Rectangle(a,l+f*(m+1),u,n)));return p.fillColor=s,this.transformRender(e,p),p}},{key:"render2DTarget",value:function(e,t){null===e&&(e=this.__renderKeys[0]);var n=this.render2D(t,e);return n.fillColor.alpha=.5,n}}]),n}(R);function tt(e){return tt="function"===typeof Symbol&&"symbol"===typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"===typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},tt(e)}function nt(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function rt(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function ot(e,t,n){return t&&rt(e.prototype,t),n&&rt(e,n),e}function it(e,t){if("function"!==typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&at(e,t)}function at(e,t){return at=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},at(e,t)}function lt(e){var t=ut();return function(){var n,r=ht(e);if(t){var o=ht(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return st(this,n)}}function st(e,t){if(t&&("object"===tt(t)||"function"===typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return ct(e)}function ct(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function ut(){if("undefined"===typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"===typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}function ht(e){return ht=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},ht(e)}var ft=function(e){it(n,e);var t=lt(n);function n(){return nt(this,n),t.call(this)}return ot(n,[{key:"__setupDefinitions",value:function(){this.__unique={position:"Point"},this.__heritable={componentSpacing:"Float",rotation:"Float",radius:"Float",flowChannelWidth:"Float",controlChannelWidth:"Float",valveWidth:"Float",valveLength:"Float",valveSpacing:"Float",height:"Float",mirrorByX:"Float",mirrorByY:"Float"},this.__defaults={componentSpacing:2e3,rotation:0,radius:2e3,flowChannelWidth:1e3,controlChannelWidth:500,valveWidth:2400,valveLength:1e3,valveSpacing:300,valveRadius:1200,height:250,mirrorByX:0,mirrorByY:0},this.__units={componentSpacing:"μm",rotation:"°",radius:"μm",flowChannelWidth:"μm",controlChannelWidth:"μm",valveWidth:"μm",valveLength:"μm",valveSpacing:"μm",he
1ight:"μm"},this.__minimum={componentSpacing:0,radius:500,flowChannelWidth:100,controlChannelWidth:100,valveWidth:240,valveLength:240,valveSpacing:30,valveRadius:120,height:20,rotation:0,mirrorByX:0,mirrorByY:0},this.__maximum={componentSpacing:1e4,radius:5e4,flowChannelWidth:1e4,controlChannelWidth:1e4,valveWidth:24e3,valveLength:24e3,valveSpacing:3e3,valveRadius:12e3,height:2e3,rotation:360,mirrorByX:1,mirrorByY:1},this.__placementTool="multilayerPositionTool",this.__toolParams={position:"position"},this.__featureParams={componentSpacing:"componentSpacing",position:"position",rotation:"rotation",flowChannelWidth:"flowChannelWidth",controlChannelWidth:"controlChannelWidth",radius:"radius",valveWidth:"valveWidth",valveLength:"valveLength",valveSpacing:"valveSpacing",height:"height",mirrorByX:"mirrorByX",mirrorByY:"mirrorByY"},this.__targetParams={componentSpacing:"componentSpacing",position:"position",rotation:"rotation",flowChannelWidth:"flowChannelWidth",controlChannelWidth:"controlChannelWidth",radius:"radius",valveWidth:"valveWidth",valveLength:"valveLength",valveSpacing:"valveSpacing",height:"height",mirrorByX:"mirrorByX",mirrorByY:"mirrorByY"},this.__renderKeys=["FLOW","CONTROL"],this.__mint="ROTARY MIXER",this.__zOffsetKeys={FLOW:"height",CONTROL:"height"},this.__substrateOffset={FLOW:"0",CONTROL:"+1"}}},{key:"getPorts",value:function(e){var t=e.position,n=e.radius,r=e.valveSpacing,i=e.valveLength,a=e.valveWidth,l=e.flowChannelWidth,s=n+i+2*r+l,c=t[0],u=t[1],h=(new y.a.Point(c,u),[]);return h.push(new b(s,-n-l/2,"1",o.FLOW)),h.push(new b(-s,n+l/2,"2",o.FLOW)),h.push(new b(n+l+r+i/2,-n-l/2-a,"3",o.CONTROL)),h.push(new b(0,-n-l/2-a,"4",o.CONTROL)),h.push(new b(l/2+n+a,0,"5",o.CONTROL)),h.push(new b(0,n+l/2+a,"6",o.CONTROL)),h.push(new b(-n-r-i-l/2,n+l/2+a,"7",o.CONTROL)),h}},{key:"render2D",value:function(e,t){if("FLOW"===t)return this.__renderFlow(e);if("CONTROL"===t)return this.__renderControl(e);throw new Error("No valid key found")}},{key:"render2DTarget",value:function(e,t){var n=this.__renderFlow(t),r=this.__renderControl(t),o=new y.a.CompoundPath("");return o.addChild(n),o.addChild(r),o.fillColor=t.color,o.fillColor.alpha=.5,o}},{key:"__renderFlow",value:function(e){var t=e.position,n=e.radius,r=e.color,o=(e.rotation,e.valveSpacing),i=e.valveLength,a=e.valveWidth,l=e.flowChannelWidth,s=t[0],c=t[1],u=new y.a.Point(s,c),h=n+i+2*o+l,f=(e.mirrorByX,e.mirrorByY,new y.a.CompoundPath("")),d=new y.a.Path.Circle(u,n),p=new y.a.Path.Circle(u,n+l),m=p.subtract(d),v=new y.a.Point(s-i/2,c-n-l/2-a/2),g=new y.a.Path.Rectangle(v,new y.a.Size(i,a));m=m.subtract(g),v=new y.a.Point(s+n+l/2-a/2,c-i/2);var w=new y.a.Path.Rectangle(v,new y.a.Size(a,i));m=m.subtract(w),v=new y.a.Point(s-i/2,c+n+l/2-a/2);var b=new y.a.Path.Rectangle(v,new y.a.Size(i,a));m=m.subtract(b),f.addChild(m);var _=new y.a.Point(s,c-n-l),P=new y.a.Point(s+h,c-n),C=new y.a.Path.Rectangle(_,P);v=new y.a.Point(s+n+l+o,c-n-l/2-a/2);var O=new y.a.Path.Rectangle(v,new y.a.Size(i,a));C=C.subtract(O),C=C.subtract(g),f.addChild(C);var S=new y.a.Point(s-h,c+n),D=new y.a.Point(s,c+n+l),R=new y.a.Path.Rectangle(S,D);v=new y.a.Point(s-n-o-i-l,c+n+l/2-a/2);var T=new y.a.Path.Rectangle(v,new y.a.Size(i,a));return R=R.subtract(T),R=R.subtract(b),f.addChild(R),f.fillColor=r,this.transformRender(e,f),f}},{key:"__renderControl",value:function(e){var t=e.position,n=e.radius,r=e.color,o=(e.rotation,e.valveSpacing),i=e.valveLength,a=e.valveWidth,l=e.flowChannelWidth,s=e.controlChannelWidth,c=(e.mirrorByX,e.mirrorByY,t[0]),u=t[1],h=new y.a.CompoundPath(""),f=null;f=new y.a.Point(c+n+l+o,u-n-l/2-a/2);var d=new y.a.Path.Rectangle(f,new y.a.Size(i,a));h.addChild(d);var p=new y.a.Point(c+n+l+o+i/2-s/2,u-n-l/2-a),m=new y.a.Point(c+n+l+o+i/2+s/2,u-n);h.addChild(new y.a.Path.Rectangle(p,m)),f=new y.a.Point(c-i/2,u-n-l/2-a/2);var v=new y.a.Path.Rectangle(f,new y.a.Size(i,a));h.addChild(v),p=new y.a.Point(c-s/2,u-n-l/2-a),m=new y.a.Point(c+s/2,u-n),h.addChild(new y.a.Path.Rectangle(p,m)),f=new y.a.Point(c+n+l/2-a/2,u-i/2);var g=new y.a.Path.Rectangle(f,new y.a.Size(a,i));h.addChild(g),p=new y.a.Point(c+l/2+n,u-s/2),m=new y.a.Point(c+l/2+n+a,u+s/2),h.addChild(new y.a.Path.Rectangle(p,m)),f=new y.a.Point(c-i/2,u+n+l/2-a/2);var w=new y.a.Path.Rectangle(f,new y.a.Size(i,a));h.addChild(w),p=new y.a.Point(c-s/2,u+n+l/2),m=new y.a.Point(c+s/2,u+n+l/2+a),h.addChild(new y.a.Path.Rectangle(p,m)),f=new y.a.Point(c-n-o-i-l,u+n+l/2-a/2);var b=new y.a.Path.Rectangle(f,new y.a.Size(i,a));return h.addChild(b),p=new y.a.Point(c-n-o-i-l/2-s/2,u+n+l/2),m=new y.a.Point(c-n-o-i-l/2+s/2,u+n+l/2+a),h.addChild(new y.a.Path.Rectangle(p,m)),h.fillColor=r,this.transformRender(e,h),h}}]),n}(R);function dt(e){return dt="function"===typeof Symbol&&"symbol"===typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"===typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},dt(e)}function pt(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function yt(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function mt(e,t,n){return t&&yt(e.prototype,t),n&&yt(e,n),e}function vt(e,t){if("function"!==typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&>(e,t)}function gt(e,t){return gt=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},gt(e,t)}function wt(e){var t=Pt();return function(){var n,r=Ct(e);if(t){var o=Ct(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return bt(this,n)}}function bt(e,t){if(t&&("object"===dt(t)||"function"===typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return _t(e)}function _t(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Pt(){if("undefined"===typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"===typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}function Ct(e){return Ct=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},Ct(e)}var Ot=function(e){vt(n,e);var t=wt(n);function n(){return pt(this,n),t.call(this)}return mt(n,[{key:"__setupDefinitions",value:function(){this.__unique={position:"Point"},this.__heritable={componentSpacing:"Float",width:"Float",length:"Float",height:"Float"},this.__defaults={componentSpacing:2e3,width:4e3,length:4e3,height:250},this.__units={componentSpacing:"μm",width:"μm",length:"μm",he
1ight:"μm"},this.__minimum={componentSpacing:0,width:10,length:10,height:10},this.__maximum={componentSpacing:1e4,width:2e5,length:2e5,height:1200},this.__placementTool="multilayerPositionTool",this.__toolParams={position:"position"},this.__featureParams={position:"position",width:"width",length:"length"},this.__targetParams={width:"width",length:"length"},this.__renderKeys=["FLOW","CONTROL"],this.__mint="ALIGNMENT MARKS",this.__zOffsetKeys={FLOW:"height",CONTROL:"height"},this.__substrateOffset={FLOW:"0",CONTROL:"+1"}}},{key:"render2D",value:function(e,t){if("FLOW"===t)return this.__drawFlow(e);if("CONTROL"===t)return this.__drawControl(e);throw new Error("Unknown key: "+t)}},{key:"render2DTarget",value:function(e,t){var n=t.position,r=t.width,o=t.length,i=t.color,a=new y.a.Point(n[0],n[1]),l=new y.a.CompoundPath(""),s=new y.a.Point(n[0]-r,n[1]-o),c=new y.a.Point(n[0]+r,n[1]+o),u=new y.a.Path.Rectangle(s,a);l.addChild(u);var h=new y.a.Path.Rectangle(n,c);l.addChild(h);var f=new y.a.Point(n[0],n[1]-o),d=new y.a.Point(n[0]+r,n[1]),p=new y.a.Point(n[0]-r,n[1]),m=new y.a.Point(n[0],n[1]+o),v=new y.a.Path.Rectangle(f,d);l.addChild(v);var g=new y.a.Path.Rectangle(p,m);return l.addChild(g),l.fillColor=i,l.fillColor.alpha=.5,l}},{key:"__drawFlow",value:function(e){var t=e.position,n=e.width,r=e.length,o=e.color,i=new y.a.Point(t[0],t[1]),a=new y.a.CompoundPath(""),l=new y.a.Point(t[0]-n,t[1]-r),s=new y.a.Point(t[0]+n,t[1]+r),c=new y.a.Path.Rectangle(l,i);a.addChild(c);var u=new y.a.Path.Rectangle(t,s);return a.addChild(u),a.fillColor=o,a}},{key:"__drawControl",value:function(e){var t=e.position,n=e.width,r=e.length,o=e.color,i=(new y.a.Point(t[0],t[1]),new y.a.CompoundPath("")),a=new y.a.Point(t[0],t[1]-r),l=new y.a.Point(t[0]+n,t[1]),s=new y.a.Point(t[0]-n,t[1]),c=new y.a.Point(t[0],t[1]+r),u=new y.a.Path.Rectangle(a,l);i.addChild(u);var h=new y.a.Path.Rectangle(s,c);return i.addChild(h),i.fillColor=o,i}}]),n}(R);function St(e){return St="function"===typeof Symbol&&"symbol"===typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"===typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},St(e)}function Dt(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Rt(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function Tt(e,t,n){return t&&Rt(e.prototype,t),n&&Rt(e,n),e}function Lt(e,t){if("function"!==typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&Ft(e,t)}function Ft(e,t){return Ft=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},Ft(e,t)}function kt(e){var t=xt();return function(){var n,r=Mt(e);if(t){var o=Mt(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return Et(this,n)}}function Et(e,t){if(t&&("object"===St(t)||"function"===typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return Nt(e)}function Nt(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function xt(){if("undefined"===typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"===typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}function Mt(e){return Mt=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},Mt(e)}var It=function(e){Lt(n,e);var t=kt(n);function n(){return Dt(this,n),t.call(this)}return Tt(n,[{key:"__setupDefinitions",value:function(){this.__unique={position:"Point"},this.__heritable={componentSpacing:"Float",chamberLength:"Float",feedingChannelWidth:"Float",rotation:"Float",chamberWidth:"Float",numberOfChambers:"Float",chamberSpacing:"Float",height:"Float",mirrorByX:"Float",mirrorByY:"Float"},this.__defaults={componentSpacing:2e3,chamberLength:1200,feedingChannelWidth:410,rotation:270,chamberWidth:1230,numberOfChambers:6,chamberSpacing:2460,height:250,mirrorByX:0,mirrorByY:0},this.__units={componentSpacing:"μm",chamberLength:"μm",feedingChannelWidth:"μm",rotation:"°",chamberWidth:"μm",numberOfChambers:"",chamberSpacing:"μm",he
1ight:"μm"},this.__minimum={componentSpacing:0,chamberLength:30,feedingChannelWidth:10,chamberWidth:30,numberOfChambers:1,chamberSpacing:30,height:10,rotation:0,mirrorByX:0,mirrorByY:0},this.__maximum={componentSpacing:1e4,chamberLength:6e3,feedingChannelWidth:2e3,chamberWidth:6e3,numberOfChambers:100,chamberSpacing:12e3,height:1200,rotation:360,mirrorByX:1,mirrorByY:1},this.__featureParams={componentSpacing:"componentSpacing",position:"position",rotation:"rotation",chamberWidth:"chamberWidth",chamberLength:"chamberLength",numberOfChambers:"numberOfChambers",chamberSpacing:"chamberSpacing",feedingChannelWidth:"feedingChannelWidth",height:"height",mirrorByX:"mirrorByX",mirrorByY:"mirrorByY"},this.__targetParams={componentSpacing:"componentSpacing",rotation:"rotation",chamberWidth:"chamberWidth",chamberLength:"chamberLength",numberOfChambers:"numberOfChambers",chamberSpacing:"chamberSpacing",feedingChannelWidth:"feedingChannelWidth",height:"height",mirrorByX:"mirrorByX",mirrorByY:"mirrorByY"},this.__placementTool="CellPositionTool",this.__toolParams={position:"position"},this.__renderKeys=["FLOW","CELL"],this.__mint="LONG CELL TRAP",this.__zOffsetKeys={FLOW:"height",CELL:"height"},this.__substrateOffset={FLOW:"0",CELL:"0"}}},{key:"getPorts",value:function(e){var t=e.chamberLength,n=e.numberOfChambers,r=e.chamberWidth,i=e.feedingChannelWidth,a=e.chamberSpacing,l=[];return l.push(new b(0,t+i/2,"1",o.FLOW)),l.push(new b(n/2*(r+a)+a,t+i/2,"2",o.FLOW)),l}},{key:"render2D",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"FLOW";if("FLOW"===t)return this.__drawFlow(e);if("CELL"===t)return this.__drawCell(e);var n=this.__drawFlow(e),r=this.__drawCell(e),o=new y.a.CompoundPath("");return o.addChild(n),o.addChild(r),o}},{key:"render2DTarget",value:function(e,t){var n=this.__drawFlow(t);return n.addChild(this.__drawCell(t)),n.fillColor.alpha=.5,n}},{key:"__drawFlow",value:function(e){e.rotation;var t,n,r=e.position,o=e.chamberLength,i=e.numberOfChambers,a=e.chamberWidth,l=e.feedingChannelWidth,s=e.chamberSpacing,c=e.color,u=r[0],h=r[1],f=new y.a.CompoundPath("");f.fillColor=c;var d=new y.a.Point(u,h+o);return n=new y.a.Path.Rectangle({point:d,size:[i/2*(a+s)+s,l],fillColor:c,strokeWidth:0}),f.addChild(n),t=new y.a.CompoundPath(f),t.fillColor=c,this.transformRender(e,t),t}},{key:"__drawCell",value:function(e){e.rotation;for(var t,n=e.position,r=e.chamberLength,o=e.numberOfChambers,i=e.chamberWidth,a=e.feedingChannelWidth,l=e.chamberSpacing,s=e.color,c=n[0],u=n[1],h=new y.a.CompoundPath(""),f=0;f<o/2;f++){var d=new y.a.Point(c+f*(i+l)+l,u);t=new y.a.Path.Rectangle({size:[i,2*r+a],point:d,fillColor:s,strokeWidth:0}),h.addChild(t)}return h.fillColor=s,this.transformRender(e,h),h}}]),n}(R);function Wt(e){return Wt="function"===typeof Symbol&&"symbol"===typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"===typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Wt(e)}function At(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function jt(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function Bt(e,t,n){return t&&jt(e.prototype,t),n&&jt(e,n),e}function Vt(e,t){if("function"!==typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&Xt(e,t)}function Xt(e,t){return Xt=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},Xt(e,t)}function Yt(e){var t=zt();return function(){var n,r=Ht(e);if(t){var o=Ht(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return Gt(this,n)}}function Gt(e,t){if(t&&("object"===Wt(t)||"function"===typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return Ut(e)}function Ut(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function zt(){if("undefined"===typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"===typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}function Ht(e){return Ht=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},Ht(e)}var Kt=function(e){Vt(n,e);var t=Yt(n);function n(){return At(this,n),t.call(this)}return Bt(n,[{key:"__setupDefinitions",value:function(){this.__unique={position:"Point"},this.__heritable={componentSpacing:"Float",sideWidth:"Float",mainWidth:"Float",rotation:"Float",length:"Float",height:"Float",sidehe
1ight:"Float",mirrorByX:"Float",mirrorByY:"Float"},this.__defaults={componentSpacing:2e3,sideWidth:200,mainWidth:500,rotation:0,length:3e3,height:250,sideheight:50,mirrorByX:0,mirrorByY:0},this.__units={componentSpacing:"μm",sideWidth:"μm",mainWidth:"μm",rotation:"°",length:"μm",height:"μm",sideheight:"μm"},this.__minimum={componentSpacing:0,sideWidth:20,mainWidth:10,length:1e3,height:10,sideheight:10,rotation:0,mirrorByX:0,mirrorByY:0},this.__maximum={componentSpacing:1e4,sideWidth:500,mainWidth:500,length:1e5,height:1200,sideheight:1200,rotation:360,mirrorByX:1,mirrorByY:1},this.__featureParams={componentSpacing:"componentSpacing",position:"position",rotation:"rotation",length:"length",sideWidth:"sideWidth",mainWidth:"mainWidth",height:"height",sideheight:"sideheight",mirrorByX:"mirrorByX",mirrorByY:"mirrorByY"},this.__targetParams={componentSpacing:"componentSpacing",rotation:"rotation",length:"length",sideWidth:"sideWidth",mainWidth:"mainWidth",height:"height",sideheight:"sideheight",mirrorByX:"mirrorByX",mirrorByY:"mirrorByY"},this.__placementTool="CellPositionTool",this.__toolParams={position:"position"},this.__renderKeys=["FLOW","CELL"],this.__mint="GEL CHANNEL",this.__zOffsetKeys={FLOW:"height",CELL:"sideHeight"},this.__substrateOffset={FLOW:"0",CELL:"0"}}},{key:"getPorts",value:function(e){var t=[],n=e.sideWidth,r=2,i=e.length,a=e.mainWidth;return t.push(new b(0,n+a/2,"1",o.FLOW)),t.push(new b(r/2*(i+60)+60,n+a/2,"2",o.FLOW)),t}},{key:"render2D",value:function(e,t){if("FLOW"===t)return this.__drawFlow(e);if("CELL"===t)return this.__drawCell(e);throw new Error("Unknown key: "+t)}},{key:"render2DTarget",value:function(e,t){var n=this.__drawFlow(t);return n.addChild(this.__drawCell(t)),n.fillColor.alpha=.5,n}},{key:"__drawFlow",value:function(e){var t=e.rotation,n=e.position,r=e.sideWidth,o=2,i=e.length,a=e.mainWidth;console.log(t,n,r,o,i,a,60);var l,s,c=e.color,u=n[0],h=n[1],f=new y.a.CompoundPath("");f.fillColor=c;var d=new y.a.Point(u,h+r);s=new y.a.Path.Rectangle({point:d,size:[o/2*(i+60)+60,a],fillColor:c,strokeWidth:0}),f.addChild(s),l=new y.a.CompoundPath(f),l.fillColor=c;new y.a.Point(n[0],n[1]);return this.transformRender(e,l),l}},{key:"__drawCell",value:function(e){e.rotation;for(var t,n=e.position,r=e.sideWidth,o=2,i=e.length,a=e.mainWidth,l=e.color,s=n[0],c=n[1],u=new y.a.CompoundPath(""),h=0;h<o/2;h++){var f=new y.a.Point(s+h*(i+60)+60,c);t=new y.a.Path.Rectangle({size:[i,2*r+a],point:f,fillColor:l,strokeWidth:0}),u.addChild(t)}u.fillColor=l;new y.a.Point(s,c);return this.transformRender(e,u),u}}]),n}(R);function qt(e){return qt="function"===typeof Symbol&&"symbol"===typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"===typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},qt(e)}function Jt(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Zt(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function $t(e,t,n){return t&&Zt(e.prototype,t),n&&Zt(e,n),e}function Qt(e,t){if("function"!==typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&en(e,t)}function en(e,t){return en=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},en(e,t)}function tn(e){var t=on();return function(){var n,r=an(e);if(t){var o=an(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return nn(this,n)}}function nn(e,t){if(t&&("object"===qt(t)||"function"===typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return rn(e)}function rn(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function on(){if("undefined"===typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"===typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}
1function an(e){return an=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},an(e)}var ln=function(e){Qt(n,e);var t=tn(n);function n(){return Jt(this,n),t.call(this)}return $t(n,[{key:"__setupDefinitions",value:function(){this.__unique={position:"Point"},this.__heritable={componentSpacing:"Float",width:"Float",length:"Float",height:"Float",cornerRadius:"Float",rotation:"Float",mirrorByX:"Float",mirrorByY:"Float"},this.__defaults={componentSpacing:2e3,width:5e3,length:5e3,height:250,cornerRadius:200,rotation:0,mirrorByX:0,mirrorByY:0},this.__units={componentSpacing:"μm",width:"μm",length:"μm",height:"μm",cornerRadius:"μm",rotation:"°"},this.__minimum={componentSpacing:0,width:5,length:5,height:1,cornerRadius:1,rotation:0,mirrorByX:0,mirrorByY:0},this.__maximum={componentSpacing:1e4,width:5e4,length:5e4,height:5e4,cornerRadius:1e3,rotation:360,mirrorByX:1,mirrorByY:1},this.__featureParams={componentSpacing:"componentSpacing",position:"position",width:"width",length:"length",height:"height",cornerRadius:"cornerRadius",rotation:"rotation",mirrorByX:"mirrorByX",mirrorByY:"mirrorByY"},this.__targetParams={componentSpacing:"componentSpacing",position:"position",width:"width",length:"length",height:"height",cornerRadius:"cornerRadius",rotation:"rotation",mirrorByX:"mirrorByX",mirrorByY:"mirrorByY"},this.__placementTool="componentPositionTool",this.__toolParams={position:"position"},this.__renderKeys=["FLOW"],this.__mint="REACTION CHAMBER",this.__zOffsetKeys={FLOW:"height"},this.__substrateOffset={FLOW:"0"}}},{key:"getPorts",value:function(e){var t=e.length,n=e.width,r=[];return r.push(new b(0,-t/2,"1",o.FLOW)),r.push(new b(n/2,0,"2",o.FLOW)),r.push(new b(0,t/2,"3",o.FLOW)),r.push(new b(-n/2,0,"4",o.FLOW)),r}},{key:"render2D",value:function(e,t){var n=e.position,r=n[0],o=n[1],i=e.length,a=e.width,l=(e.rotation,e.color),s=e.cornerRadius,c=new y.a.CompoundPath(""),u=new y.a.Path.Rectangle({point:new y.a.Point(r-a/2,o-i/2),size:[a,i],radius:s});return c.addChild(u),c.fillColor=l,this.transformRender(e,c),c}},{key:"render2DTarget",value:function(e,t){null===e&&(e=this.__renderKeys[0]);var n=this.render2D(t,e);return n.fillColor.alpha=.5,n}}]),n}(R);function sn(e){return sn="function"===typeof Symbol&&"symbol"===typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"===typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},sn(e)}function cn(e,t){var n="undefined"!==typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=un(e))||t&&e&&"number"===typeof e.length){n&&(e=n);var r=0,o=function(){};return{s:o,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,l=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return a=e.done,e},e:function(e){l=!0,i=e},f:function(){try{a||null==n.return||n.return()}finally{if(l)throw i}}}}function un(e,t){if(e){if("string"===typeof e)return hn(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?hn(e,t):void 0}}function hn(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function fn(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function dn(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function pn(e,t,n){return t&&dn(e.prototype,t),n&&dn(e,n),e}function yn(e,t){if("function"!==typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&mn(e,t)}
1function mn(e,t){return mn=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},mn(e,t)}function vn(e){var t=bn();return function(){var n,r=_n(e);if(t){var o=_n(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return gn(this,n)}}function gn(e,t){if(t&&("object"===sn(t)||"function"===typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return wn(e)}function wn(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function bn(){if("undefined"===typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"===typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}function _n(e){return _n=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},_n(e)}var Pn=function(e){yn(n,e);var t=vn(n);function n(){return fn(this,n),t.call(this)}return pn(n,[{key:"__setupDefinitions",value:function(){this.__unique={start:"Point",end:"Point",wayPoints:"PointArray",segments:"SegmentArray"},this.__heritable={connectionSpacing:"Float",channelWidth:"Float",height:"Float",crossSection:"Float"},this.__defaults={connectionSpacing:1600,channelWidth:Ce,height:250,crossSection:0},this.__units={connectionSpacing:"μm",channelWidth:"μm",height:"μm",crossSection:""},this.__minimum={connectionSpacing:0,channelWidth:3,height:10,crossSection:0},this.__maximum={connectionSpacing:1e4,channelWidth:12e3,height:1200,crossSection:1},this.__featureParams={connectionSpacing:"connectionSpacing",start:"start",end:"end",wayPoints:"wayPoints",channelWidth:"channelWidth",segments:"segments",height:"height",crossSection:"crossSection"},this.__targetParams={connectionSpacing:"connectionSpacing",wayPoints:"wayPoints",channelWidth:"channelWidth",segments:"segments",height:"height",crossSection:"crossSection"},this.__placementTool="ConnectionTool",this.__toolParams={start:"start",end:"end"},this.__renderKeys=["FLOW"],this.__mint="CHANNEL",this.__zOffsetKeys={FLOW:"height"},this.__substrateOffset={FLOW:"0"}}},{key:"render2D",value:function(e,t){e.start,e.end;var n,r,o,i,a=e.color,l=e.wayPoints,s=Number(e.channelWidth||e.width)||Ce,c=e.segments,u=new y.a.CompoundPath("");u.fillRule="nonzero";var h=void 0!==e.crossSection&&null!==e.crossSection?Number(e.crossSection):0,f=h>=.5;if(!Array.isArray(c)||0===c.length)return console.warn("[3DuF] Connection render skipped: missing segments",e),u.fillColor=a,u;var d=this.__roundedCapLookup(c,l),p=new Set;for(var m in Array.isArray(l)&&l.length>=2&&(p.add(this.__pointKey(l[0])),p.add(this.__pointKey(l[l.length-1]))),c){var v=c[m];if(v&&!(v.length<2)&&v[0]&&v[1]){o=v[0],i=v[1],n=new y.a.Point(o[0],o[1]),r=new y.a.Point(i[0],i[1]);var g=this.__pointKey(o),w=this.__pointKey(i),b=f?d.has(g):p.has(g),_=f?d.has(w):p.has(w);this.__drawStraightConnection(u,n,r,s,f,b,_)}else console.warn("[3DuF] Connection render skipped a malformed segment",v)}return this.__fillSquareChannelCorners(u,c,s),u.fillRule="nonzero",u.fillColor=a,u}},{key:"__pointKey",value:function(e){return"".concat(Math.round(Number(e[0])),",").concat(Math.round(Number(e[1])))}},{key:"__roundedCapLookup",value:function(e,t){var n=new Set;if(Array.isArray(t)){var r,o=cn(t);try{for(o.s();!(r=o.n()).done;){var i=r.value;i&&i.length>=2&&n.add(this.__pointKey(i))}}catch(p){o.e(p)}finally{o.f()}}var a,l=new Map,s=cn(e);try{for(s.s();!(a=s.n()).done;){var c=a.value;if(c&&!(c.length<2))for(var u=0,h=[c[0],c[1]];u<h.length;u++){var f=h[u];if(f&&!(f.length<2)){var d=this.__pointKey(f);l.set(d,(l.get(d)||0)+1)}}}}catch(p){s.e(p)}finally{s.f()}return l.forEach((function(e,t){e>1&&n.add(t)})),n}},{key:"__fillSquareChannelCorners",value:function(e,t,n){if(Array.isArray(t)&&!(t.length<2)&&n){var r,o=n/2,i=[],a=cn(t);try{for(a.s();!(r=a.n()).done;){var l=r.value;if(l&&!(l.length<2)){var s=l[0],c=l[1];!s||!c||s.length<2||c.length<2||s[0]===c[0]&&s[1]===c[1]||i.push(l)}}}catch(w){a.e(w)}finally{a.f()}for(var u=1;u<i.length;u++){var h=i[u-1],f=i[u],d=Math.sign(h[1][0]-h[0][0]),p=Math.sign(h[1][1]-h[0][1]),m=Math.sign(f[1][0]-f[0][0]),v=Math.sign(f[1][1]-f[0][1]);if(d!==m||p!==v){var g=f[0];e.addChild(new y.a.Path.Rectangle({point:[g[0]-o,g[1]-o],size:[n,n]}))}}}}},{key:"__drawStraightConnection",value:function(e,t,n,r,o){var i=!(arguments.length>5&&void 0!==arguments[5])||arguments[5],a=!(arguments.length>6&&void 0!==arguments[6])||arguments[6],l=n.subtract(t),s=r/2,c=l.length;if(o){if(c>0){var u=new y.a.Path.Rectangle({point:t,size:[c,r]});u.translate([0,-s]),u.rotate(l.angle,t),e.addChild(u)}return i&&e.addChild(new y.a.Path.Circle(t,s)),void(a&&e.addChild(new y.a.Path.Circle(n,s)))}var h=new y.a.Path.Rectangle({point:t,size:[c,r]});h.translate([0,-s]),h.rotate(l.angle,t),e.addChild(h),i&&e.addChild(new y.a.Path.Rectangle({point:[t.x-s,t.y-s],size:[r,r]})),a&&e.addChild(new y.a.Path.Rectangle({point:[n.x-s,n.y-s],size:[r,r]}))}},{key:"render2DTarget",value:function(e,t){var n=t.channelWidth/5,r=t.channelWidth,o=t.position[0],i=t.position[1],a=t.color,l=new y.a.Path.Rectangle(new y.a.Rectangle(o-r/2,i-n/2,r,n)),s=l.unite(new y.a.Path.Rectangle(new y.a.Rectangle(o-n/2,i-r/2,n,r)));return s.fillColor=a,s.fillColor.alpha=.5,s}}]),n}(R);function Cn(e){return Cn="function"===typeof Symbol&&"symbol"===typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"===typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Cn(e)}function On(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Sn(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function Dn(e,t,n){return t&&Sn(e.prototype,t),n&&Sn(e,n),e}function Rn(e,t){if("function"!==typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&Tn(e,t)}
1function Tn(e,t){return Tn=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},Tn(e,t)}function Ln(e){var t=En();return function(){var n,r=Nn(e);if(t){var o=Nn(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return Fn(this,n)}}function Fn(e,t){if(t&&("object"===Cn(t)||"function"===typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return kn(e)}function kn(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function En(){if("undefined"===typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"===typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}function Nn(e){return Nn=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},Nn(e)}var xn=function(e){Rn(n,e);var t=Ln(n);function n(){return On(this,n),t.call(this)}return Dn(n,[{key:"__setupDefinitions",value:function(){this.__unique={position:"Point"},this.__heritable={componentSpacing:"Float",bendSpacing:"Float",numberOfBends:"Float",channelWidth:"Float",edgeBend1:"Float",edgeBend2:"Float",bendLength:"Float",rotation:"Float",height:"Float",mirrorByX:"Float",mirrorByY:"Float"},this.__defaults={componentSpacing:2e3,rotation:0,channelWidth:Oe,edgeBend1:Oe/2,edgeBend2:Oe/2,bendSpacing:Se,numberOfBends:1,bendLength:De,height:250,mirrorByX:0,mirrorByY:0},this.__units={componentSpacing:"μm",rotation:"°",bendSpacing:"μm",numberOfBends:"",channelWidth:"μm",edgeBend1:"μm",edgeBend2:"μm",bendLength:"μm",height:"μm"},this.__minimum={componentSpacing:0,rotation:0,channelWidth:10,edgeBend1:0,edgeBend2:0,bendSpacing:10,numberOfBends:1,bendLength:10,height:10,mirrorByX:0,mirrorByY:0},this.__maximum={componentSpacing:1e4,rotation:360,channelWidth:2e3,edgeBend1:12e3,edgeBend2:12e3,bendSpacing:6e3,numberOfBends:20,bendLength:12e3,height:1200,mirrorByX:1,mirrorByY:1},this.__featureParams={componentSpacing:"componentSpacing",position:"position",channelWidth:"channelWidth",edgeBend1:"edgeBend1",edgeBend2:"edgeBend2",bendSpacing:"bendSpacing",numberOfBends:"numberOfBends",rotation:"rotation",bendLength:"bendLength",mirrorByX:"mirrorByX",mirrorByY:"mirrorByY"},this.__targetParams={componentSpacing:"componentSpacing",channelWidth:"channelWidth",edgeBend1:"edgeBend1",edgeBend2:"edgeBend2",bendSpacing:"bendSpacing",numberOfBends:"numberOfBends",rotation:"rotation",bendLength:"bendLength",mirrorByX:"mirrorByX",mirrorByY:"mirrorByY"},this.__placementTool="componentPositionTool",this.__toolParams={position:"position"},this.__renderKeys=["FLOW"],this.__mint="CURVED MIXER",this.__zOffsetKeys={FLOW:"height"},this.__substrateOffset={FLOW:"0"}}},{key:"getPorts",value:function(e){var t=Le(e),n=[];return n.push(new b(t.port1x,t.port1y,"1",o.FLOW)),n.push(new b(t.port2x,t.port2y,"2",o.FLOW)),n}},{key:"render2D",value:function(e,t){var n=e.channelWidth,r=e.bendLength,o=e.bendSpacing,i=(e.rotation,e.numberOfBends),a=e.position[0],l=e.position[1],s=e.color,c=Le(e),u=2*o+2*n,h=o+n,f=new y.a.CompoundPath(""),d=new y.a.Path.Rectangle(new y.a.Rectangle(a+n-1,l,c.firstWidth-(n-1),n));d.closed=!0;for(var p=0;p<i;p++){var m=new y.a.Path.Arc({from:[a+n,l+u*p],through:[a+n-(n+o/2),l+u*p+o/2+n],to:[a+n,l+u*p+o+2*n]});m.closed=!0;var v=new y.a.Path.Arc({from:[a+n,l+u*p+o+n],through:[a+n-o/2,l+u*p+o/2+n],to:[a+n,l+u*p+n]});v.closed=!0,m=m.subtract(v),d=d.unite(m);var g=new y.a.Path.Rectangle(new y.a.Rectangle(a+n-1,l+h+u*p,r+2,n));d=d.unite(g);var w=new y.a.Path.Arc({from:[a+n+r,l+h+u*p],through:[a+n+r+(n+o/2),l+h+u*p+o/2+n],to:[a+n+r,l+h+u*p+o+2*n]});w.closed=!0;var b=new y.a.Path.Arc({from:[a+n+r,l+h+u*p+o+n],through:[a+n+r+o/2,l+h+u*p+o/2+n],to:[a+n+r,l+h+u*p+n]});b.closed=!0,w=w.subtract(b),d=d.unite(w),p===i-1?(g=new y.a.Path.Rectangle(new y.a.Rectangle(a+c.lastStart,l+u*(p+1),c.lastWidth,n)),d=d.unite(g)):(g=new y.a.Path.Rectangle(new y.a.Rectangle(a+n-1,l+u*(p+1),r+2,n)),d=d.unite(g)),d=d.unite(g)}return f.addChild(d),f.fillColor=s,this.transformRender(e,f),f}},{key:"render2DTarget",value:function(e,t){null===e&&(e=this.__renderKeys[0]);var n=this.render2D(t,e);return n.fillColor.alpha=.5,n}}]),n}(R);function Mn(e){return Mn="function"===typeof Symbol&&"symbol"===typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"===typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Mn(e)}function In(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Wn(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}
1function An(e,t,n){return t&&Wn(e.prototype,t),n&&Wn(e,n),e}function jn(e,t){if("function"!==typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&Bn(e,t)}function Bn(e,t){return Bn=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},Bn(e,t)}function Vn(e){var t=Gn();return function(){var n,r=Un(e);if(t){var o=Un(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return Xn(this,n)}}function Xn(e,t){if(t&&("object"===Mn(t)||"function"===typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return Yn(e)}function Yn(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Gn(){if("undefined"===typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"===typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}function Un(e){return Un=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},Un(e)}var zn=function(e){jn(n,e);var t=Vn(n);function n(){return In(this,n),t.call(this)}return An(n,[{key:"__setupDefinitions",value:function(){this.__unique={position:"Point"},this.__heritable={componentSpacing:"Float",rotation:"Float",channelWidth:"Float",length:"Float",width:"Float",height:"Float",mirrorByX:"Float",mirrorByY:"Float"},this.__defaults={componentSpacing:2e3,rotation:0,channelWidth:Ce,width:1230,length:4920,height:250,mirrorByX:0,mirrorByY:0},this.__units={componentSpacing:"μm",rotation:"°",channelWidth:"μm",length:"μm",width:"μm",height:"μm"},this.__minimum={componentSpacing:0,channelWidth:10,width:30,length:120,height:10,rotation:0,mirrorByX:0,mirrorByY:0},this.__maximum={componentSpacing:1e4,channelWidth:2e3,width:6e3,length:24e3,height:1200,rotation:360,mirrorByX:1,mirrorByY:1},this.__featureParams={componentSpacing:"componentSpacing",position:"position",rotation:"rotation",channelWidth:"channelWidth",length:"length",width:"width",mirrorByX:"mirrorByX",mirrorByY:"mirrorByY"},this.__targetParams={componentSpacing:"componentSpacing",channelWidth:"channelWidth",length:"length",width:"width",rotation:"rotation",mirrorByX:"mirrorByX",mirrorByY:"mirrorByY"},this.__placementTool="componentPositionTool",this.__toolParams={position:"position"},this.__renderKeys=["FLOW"],this.__mint="DIAMOND REACTION CHAMBER",this.__zOffsetKeys={FLOW:"height"},this.__substrateOffset={FLOW:"0"}}},{key:"getPorts",value:function(e){e.channelWidth;var t=e.length,n=(e.width,[]);return n.push(new b(-t/2,0,"1",o.FLOW)),n.push(new b(t/2,0,"2",o.FLOW)),n}},{key:"render2D",value:function(e,t){var n=e.position,r=n[0],o=n[1],i=e.channelWidth,a=e.length,l=e.width,s=e.rotation;console.log("Rotation",s);var c,u,h,f,d,p,m=e.color;c=[r-a/2,o-i/2],u=[r-a/2,o+i/2],h=[r,o+l+i/2],f=[r+a/2,o+i/2],d=[r+a/2,o-i/2],p=[r,o-i/2-l];var v=new y.a.Path;return v.add(new y.a.Point(c)),v.add(new y.a.Point(u)),v.add(new y.a.Point(h)),v.add(new y.a.Point(f)),v.add(new y.a.Point(d)),v.add(new y.a.Point(p)),v.closed=!0,v.fillColor=m,this.transformRender(e,v),v}},{key:"render2DTarget",value:function(e,t){null===e&&(e=this.__renderKeys[0]);var n=this.render2D(t,e);return n.fillColor.alpha=.5,n}}]),n}(R);function Hn(e){return Hn="function"===typeof Symbol&&"symbol"===typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"===typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Hn(e)}function Kn(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function qn(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function Jn(e,t,n){return t&&qn(e.prototype,t),n&&qn(e,n),e}function Zn(e,t){if("function"!==typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&$n(e,t)}
1function $n(e,t){return $n=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},$n(e,t)}function Qn(e){var t=nr();return function(){var n,r=rr(e);if(t){var o=rr(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return er(this,n)}}function er(e,t){if(t&&("object"===Hn(t)||"function"===typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return tr(e)}function tr(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function nr(){if("undefined"===typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"===typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}function rr(e){return rr=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},rr(e)}var or=function(e){Zn(n,e);var t=Qn(n);function n(){return Kn(this,n),t.call(this)}return Jn(n,[{key:"__setupDefinitions",value:function(){this.__unique={position:"Point"},this.__heritable={componentSpacing:"Float",orificeSize:"Float",orificeLength:"Float",oilInputWidth:"Float",waterInputWidth:"Float",outputWidth:"Float",outputLength:"Float",height:"Float",rotation:"Float",mirrorByX:"Float",mirrorByY:"Float"},this.__defaults={componentSpacing:2e3,orificeSize:200,orificeLength:400,oilInputWidth:800,waterInputWidth:600,outputWidth:600,outputLength:600,height:250,rotation:0,mirrorByX:0,mirrorByY:0}
1,this.__units={componentSpacing:"μm",orificeSize:"μm",height:"μm",orificeLength:"μm",oilInputWidth:"μm",waterInputWidth:"μm",outputWidth:"μm",outputLength:"μm",rotation:"°"},this.__minimum={componentSpacing:0,orificeSize:10,orificeLength:10,oilInputWidth:10,waterInputWidth:10,outputWidth:10,outputLength:10,height:10,rotation:0,mirrorByX:0,mirrorByY:0},this.__maximum={componentSpacing:1e4,orificeSize:2e3,orificeLength:2e3,oilInputWidth:2e3,waterInputWidth:2e3,outputWidth:2e3,outputLength:2e3,height:1200,rotation:360,mirrorByX:1,mirrorByY:1},this.__featureParams={componentSpacing:"componentSpacing",position:"position",orificeSize:"orificeSize",orificeLength:"orificeLength",oilInputWidth:"oilInputWidth",waterInputWidth:"waterInputWidth",outputWidth:"outputWidth",outputLength:"outputLength",height:"height",rotation:"rotation",mirrorByX:"mirrorByX",mirrorByY:"mirrorByY"},this.__targetParams={componentSpacing:"componentSpacing",orificeSize:"orificeSize",orificeLength:"orificeLength",oilInputWidth:"oilInputWidth",waterInputWidth:"waterInputWidth",outputWidth:"outputWidth",outputLength:"outputLength",height:"height",rotation:"rotation",mirrorByX:"mirrorByX",mirrorByY:"mirrorByY"},this.__placementTool="componentPositionTool",this.__toolParams={position:"position"},this.__renderKeys=["FLOW"],this.__mint="NOZZLE DROPLET GENERATOR",this.__zOffsetKeys={FLOW:"height"},this.__substrateOffset={FLOW:"0"}}},{key:"getPorts",value:function(e){e.orificeSize;var t=e.orificeLength,n=e.oilInputWidth,r=e.waterInputWidth,i=(e.outputWidth,e.outputLength),a=[];return a.push(new b(n/2,-r/2,"1",o.FLOW)),a.push(new b(n+t+i,0,"2",o.FLOW)),a.push(new b(n/2,r/2,"3",o.FLOW)),a.push(new b(0,0,"4",o.FLOW)),a}},{key:"render2D",value:function(e){var t=e.position,n=t[0],r=t[1],o=e.color,i=e.orificeSize,a=e.orificeLength,l=e.oilInputWidth,s=e.waterInputWidth,c=e.outputWidth,u=e.outputLength,h=(e.rotation,new y.a.Path),f=new y.a.Point(n,r-s/2),d=new y.a.Point(f.x+l,f.y),p=new y.a.Point(d.x,d.y+(s/2-i/2)),m=new y.a.Point(p.x+a,p.y),v=new y.a.Point(m.x,m.y-(c/2-i/2)),g=new y.a.Point(v.x+u,v.y),w=new y.a.Point(g.x,g.y+c),b=new y.a.Point(w.x-u,w.y),_=new y.a.Point(b.x,b.y-(c/2-i/2)),P=new y.a.Point(_.x-a,_.y),C=new y.a.Point(P.x,P.y+(s/2-i/2)),O=new y.a.Point(C.x-l,C.y);return h.add(f),h.add(d),h.add(p),h.add(m),h.add(v),h.add(g),h.add(w),h.add(b),h.add(_),h.add(P),h.add(C),h.add(O),this.transformRender(e,h),h.closed=!0,h.fillColor=o,h}},{key:"render2DTarget",value:function(e,t){null===e&&(e=this.__renderKeys[0]);var n=this.render2D(t,e);return n.fillColor.alpha=.5,n}}]),n}(R);function ir(e){return ir="function"===typeof Symbol&&"symbol"===typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"===typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},ir(e)}function ar(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function lr(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function sr(e,t,n){return t&&lr(e.prototype,t),n&&lr(e,n),e}function cr(e,t){if("function"!==typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&ur(e,t)}function ur(e,t){return ur=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},ur(e,t)}function hr(e){var t=pr();return function(){var n,r=yr(e);if(t){var o=yr(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return fr(this,n)}}function fr(e,t){if(t&&("object"===ir(t)||"function"===typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return dr(e)}function dr(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function pr(){if("undefined"===typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"===typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}function yr(e){return yr=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},yr(e)}var mr=function(e){cr(n,e);var t=hr(n);function n(){return ar(this,n),t.call(this)}return sr(n,[{key:"__setupDefinitions",value:function(){this.__unique={position:"Point"},this.__heritable={componentSpacing:"Float",bendSpacing:"Float",numberOfBends:"Float",channelWidth:"Float",bendLength:"Float",in:"Float",out:"Float",spacing:"Float",height:"Float",rotation:"Float",mirrorByX:"Float",mirrorByY:"Float"},this.__defaults={componentSpacing:2e3,channelWidth:Ce,bendSpacing:1230,numberOfBends:1,bendLength:2460,in:1,out:3,spacing:1e4,height:250,rotation:0,mirrorByX:0,mirrorByY:0},this.__units={componentSpacing:"μm",bendSpacing:"μm",numberOfBends:"",channelWidth:"μm",bendLength:"μm",in:"",out:"",spacing:"μm",he
1ight:"μm",rotation:"°"},this.__minimum={componentSpacing:0,channelWidth:10,bendSpacing:10,numberOfBends:1,bendLength:10,in:1,out:3,spacing:10,height:10,rotation:0,mirrorByX:0,mirrorByY:0},this.__maximum={componentSpacing:1e4,channelWidth:2e3,bendSpacing:6e3,numberOfBends:20,bendLength:12e3,in:30,out:90,spacing:9e4,height:1200,rotation:360,mirrorByX:1,mirrorByY:1},this.__featureParams={componentSpacing:"componentSpacing",position:"position",channelWidth:"channelWidth",bendSpacing:"bendSpacing",numberOfBends:"numberOfBends",rotation:"rotation",bendLength:"bendLength",in:"in",out:"out",spacing:"spacing",mirrorByX:"mirrorByX",mirrorByY:"mirrorByY"},this.__targetParams={componentSpacing:"componentSpacing",channelWidth:"channelWidth",bendSpacing:"bendSpacing",numberOfBends:"numberOfBends",rotation:"rotation",bendLength:"bendLength",in:"in",out:"out",spacing:"spacing",mirrorByX:"mirrorByX",mirrorByY:"mirrorByY"},this.__placementTool="componentPositionTool",this.__toolParams={position:"position"},this.__renderKeys=["FLOW"],this.__mint="GRADIENT GENERATOR",this.__zOffsetKeys={FLOW:"height"},this.__substrateOffset={FLOW:"0"}}},{key:"getPorts",value:function(e){for(var t=e.bendSpacing,n=e.numberOfBends,r=e.channelWidth,i=e.in,a=e.out,l=e.spacing,s=[],c=r*(2*n+1)+(2*n+2)*t+r,u=i,h=(u-1)*l,f=-h/2,d=c*(u-i),p=0;p<i;p++){var y=f+l*p+r/2;s.push(new b(y,0,(p+1).toString(),o.FLOW))}u=a,h=(u-1)*l,f=-h/2,d=c*(u-i+1);for(var m=0;m<a;m++){var v=f+l*m+r/2;s.push(new b(v,d+r,(i+1+m).toString(),o.FLOW))}return s}},{key:"render2D",value:function(e,t){for(var n=e.position,r=e.bendSpacing,o=e.numberOfBends,i=e.channelWidth,a=e.bendLength,l=(e.rotation,e.in),s=e.out,c=e.spacing,u=e.color,h=n[0],f=n[1],d=i*(2*o+1)+(2*o+2)*r+i,p=new y.a.CompoundPath(""),m=(l-1)*c,v=h-m/2,g
1=f,w=0;w<l;w++){var b=v+c*w,_=g;p.addChild(new y.a.Path.Rectangle({point:new y.a.Point(b,_),size:[i,d+i]}))}for(var P=l+1;P<=s;P++){var C=(P-1)*c;v=h-C/2,g=f+d*(P-l);for(var O=0;O<P;O++){var S=v+c*O,D=g;this.__insertMixer(p,r,o,i,a,S,D,u)}var R=new y.a.Path.Rectangle({point:new y.a.Point(v,g),size:[C,i],fillColor:u,strokeWidth:0});p.addChild(R)}return p.fillColor=u,this.transformRender(e,p),p}},{key:"__insertMixer",value:function(e,t,n,r,o,i,a,l){var s=o/2+r,c=o+2*r,u=t+2*r,h=2*t+2*r,f=t+r,d=o/2+r/2;i-=d,e.addChild(new y.a.Path.Rectangle(new y.a.Rectangle(i+d,a,r,2*r+t))),a+=r+t,e.addChild(new y.a.Path.Rectangle(new y.a.Rectangle(i,a,s+r/2,r)));for(var p=0;p<n;p++)e.addChild(new y.a.Path.Rectangle(new y.a.Rectangle(i,a+h*p,r,u))),e.addChild(new y.a.Path.Rectangle(new y.a.Rectangle(i,a+f+h*p,c,r))),e.addChild(new y.a.Path.Rectangle(new y.a.Rectangle(i+r+o,a+f+h*p,r,u))),p===n-1?e.addChild(new y.a.Path.Rectangle(new y.a.Rectangle(i+d,a+h*(p+1),s,r))):e.addChild(new y.a.Path.Rectangle(new y.a.Rectangle(i,a+h*(p+1),c,r)));return e.addChild(new y.a.Path.Rectangle(new y.a.Rectangle(i+d,a+h*n,r,2*r+t))),e}},{key:"render2DTarget",value:function(e,t){var n=this.render2D(t,"FLOW");return n.fillColor.alpha=.5,n}}]),n}(R);function vr(e){return vr="function"===typeof Symbol&&"symbol"===typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"===typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},vr(e)}function gr(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function wr(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function br(e,t,n){return t&&wr(e.prototype,t),n&&wr(e,n),e}function _r(e,t){if("function"!==typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&Pr(e,t)}function Pr(e,t){return Pr=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},Pr(e,t)}function Cr(e){var t=Dr();return function(){var n,r=Rr(e);if(t){var o=Rr(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return Or(this,n)}}function Or(e,t){if(t&&("object"===vr(t)||"function"===typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return Sr(e)}function Sr(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Dr(){if("undefined"===typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"===typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}function Rr(e){return Rr=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},Rr(e)}var Tr=function(e){_r(n,e);var t=Cr(n);function n(){return gr(this,n),t.call(this)}return br(n,[{key:"__setupDefinitions",value:function(){this.__unique={position:"Point"},this.__heritable={in:"Integer",out:"Integer",flowChannelWidth:"Float",controlChannelWidth:"Float",leafSpace:"Float",stageSpace:"Float",valveWidthX:"Float",valveWidthY:"Float",height:"Float",rotation:"Float",mirrorByX:"Float",mirrorByY:"Float",componentSpacing:"Float"},this.__defaults={in:1,out:8,flowChannelWidth:Ce,controlChannelWidth:Ce,leafSpace:4e3,stageSpace:4e3,valveWidthX:1800,valveWidthY:1e3,height:250,rotation:0,mirrorByX:0,mirrorByY:0,componentSpacing:2e3},this.__units={in:"",out:"",flowChannelWidth:"μm",controlChannelWidth:"μm",leafSpace:"μm",stageSpace:"μm",valveWidthX:"μm",valveWidthY:"μm",height:"μm",rotation:"°",componentSpacing:"μm"},this.__minimum={componentSpacing:0,flowChannelWidth:10,leafSpace:100,in:1,out:2,valveWidthX:60,valveWidthY:60,height:10,stageSpace:100,controlChannelWidth:10,rotation:0,mirrorByX:0,mirrorByY:0},this.__maximum={componentSpacing:1e4,flowChannelWidth:2e3,leafSpace:2e4,in:1,out:1024,valveWidthX:12e3,valveWidthY:12e3,height:1200,stageSpace:2e4,controlChannelWidth:2e3,rotation:360,mirrorByX:1,mirrorByY:1}
1,this.__featureParams={componentSpacing:"componentSpacing",position:"position",flowChannelWidth:"flowChannelWidth",controlChannelWidth:"controlChannelWidth",rotation:"rotation",leafSpace:"leafSpace",valveWidthX:"valveWidthX",valveWidthY:"valveWidthY",in:"in",out:"out",stageSpace:"stageSpace",mirrorByX:"mirrorByX",mirrorByY:"mirrorByY"},this.__targetParams={componentSpacing:"componentSpacing",position:"position",flowChannelWidth:"flowChannelWidth",controlChannelWidth:"controlChannelWidth",rotation:"rotation",leafSpace:"leafSpace",valveWidthX:"valveWidthX",valveWidthY:"valveWidthY",in:"in",out:"out",stageSpace:"stageSpace",mirrorByX:"mirrorByX",mirrorByY:"mirrorByY"},this.__placementTool="multilayerPositionTool",this.__toolParams={position:"position"},this.__renderKeys=["FLOW","CONTROL"],this.__mint="MUX",this.__zOffsetKeys={FLOW:"height",CONTROL:"height"},this.__substrateOffset={FLOW:"0",CONTROL:"+1"}}},{key:"__drawFlow",value:function(e){var t,n=e.position,r=e.flowChannelWidth,o=(e.rotation,e.in),i=e.out;o<i?t=i:t=o;var a=e.color,l=this.__muxStageSpace(e),s=n[0],c=n[1],u=Math.ceil(Math.log2(t));var h=this.__muxFanWidth(e,t,u),f=new y.a.CompoundPath("");return this.__generateMuxTwig(f,s,c,r,l,h,1,u),f.fillColor=a,this.transformRender(e,f),f}},{key:"__drawControl",value:function(e){var t,n=e.position,r=e.flowChannelWidth,o=e.controlChannelWidth,i=(e.rotation,e.in),a=e.out;i<a?t=a:t=i;var l=e.color,s=this.__muxStageSpace(e),c=this.__muxValveWidthY(e),u=this.__muxValveWidthX(e),h=n[0],f=n[1],d=Math.ceil(Math.log2(t)),p=this.__muxFanWidth(e,t,d),m=1*p*2*Math.pow(.5,d),v=this.__muxTreeWidth(m,t,r,u),g=h-v/2,w=h+v/2,b=new y.a.CompoundPath("");return this.__generateMuxControlTwig(b,h,f,r,o,s,p,1,d,u,c,g,w),b.fillColor=l,this.transformRender(e,b),b}},{key:"getPorts",value:function(e){var t,n=[],r=e.flowChannelWidth,i=e.in,a=e.out;t=i<a?a:i;var l=this.__muxStageSpace(e),s=Math.ceil(Math.log2(t)),c=this.__muxFanWidth(e,t,s),u=s*(r+l)+l,h=1*c*2*Math.pow(.5,s);n.push(new b(0,0,"1",o.FLOW));for(var f=0;f<t;f++)n.push(new b((t-1)*h/2-f*h,u,(2+f).toString(),o.FLOW));for(var d=2+t,p=l+r,y=this.__muxValveAlong(l,r,this.__muxValveWidthY(e)),m=this.__muxValveCenterOffsets(l,y),v=p+m.left,g=this.__muxValveWidthX(e),w=this.__muxTreeWidth(h,t,r,g),_=-w/2,P=w/2,C=l+r,O=C+m.right,S=0;S<Math.log2(t);S++)n.push(new b(_,S*(r+l)+v,d.toString(),o.CONTROL)),d++,n.push(new b(P,S*(r+l)+O,d.toString(),o.CONTROL)),d++;return n}},{key:"render2D",value:function(e,t){if("FLOW"===t)return this.__drawFlow(e);if("CONTROL"===t)return this.__drawControl(e);throw new Error("Unknown key: "+t)}},{key:"render2DTarget",value:function(e,t){var n=this.render2D(t,"FLOW");return null===n||void 0===n||n.addChild(this.render2D(t,"CONTROL")),n.fillColor.alpha=.5,n}},{key:"__generateMuxTwig",value:function(e,t,n,r,o,i,a,l){var s=arguments.length>8&&void 0!==arguments[8]&&arguments[8],c=i/2,u=t-.5*i,h=n+r+o,f=t+.5*i,d=n+r+o;a===l&&(s=!0),this.__drawmuxtwig(e,t,n,r,o,i,s),s||(this.__generateMuxTwig(e,u,h,r,o,c,a+1,l),this.__generateMuxTwig(e,f,d,r,o,c,a+1,l))}},{key:"__muxValveWidthX",value:function(e){var t=Number(e.valveWidthX);if(Number.isFinite(t)&&t>0)return t;var n=Number(e.valveWidth);if(Number.isFinite(n)&&n>0)return n;var r=Number(e.width);return Number.isFinite(r)&&r>0?r:1800}},{key:"__muxValveWidthY",value:function(e){var t=Number(e.valveWidthY);if(Number.isFinite(t)&&t>0)return t;var n=Number(e.length);return Number.isFinite(n)&&n>0?n:1e3}},{key:"__muxLeafSpace",value:function(e){var t=Number(e.leafSpace);if(Number.isFinite(t)&&t>0)return t;var n=Number(e.leafPitch);return Number.isFinite(n)&&n>0?n:0}},{key:"__muxStageSpace",value:function(e){var t=Number(e.stageSpace);if(Number.isFinite(t)&&t>0)return t;var n=Number(e.stageLength);return Number.isFinite(n)&&n>0?n:4e3}},{key:"__muxFanWidth",value:function(e,t,n){var r=this.__muxLeafSpace(e);if(r>0)return r*Math.pow(2,Math.max(n-1,0));var o=Number(e.spacing||0);return o>0?o*(t/2+1):4e3*Math.pow(2,Math.max(n-1,0))}},{key:"__muxTreeWidth",value:function(e,t,n,r){return(t-1)*e+r+2*n}},{key:"__muxValveAlong",value:function(e,t,n){var r=Math.max(e-2*Math.max(t,0),Math.max(t,1)),o=n>0?n:1e3;return Math.min(o,r)}},{key:"__muxValveAcross",value:function(e,t,n){return e>0?e:Math.max(2.8*n,1)}},{key:"__muxValveCenterOffsets",value:function(e,t){var n=Math.max(e-t,0),r=t/2;return{left:r+.3*n,right:r+.7*n}}},{key:"__drawmuxtwig",value:function(e,t,n,r,o,i){var a=arguments.length>6&&void 0!==arguments[6]&&arguments[6],l=new y.a.Point(t-r/2,n),s=new y.a.Point(t+r/2,n+o),c=new y.a.Path.Rectangle({from:l,to:s,radius:0,strokeWidth:0});e.addChild(c);var u=t-.5*(r+i),h=u+r,f=n+o+r,d=f+o,p=t+.5*(i-r),m=p+r,v=n+o+r,g=v+o;a&&(l=new y.a.Point(u,f),s=new y.a.Point(h,d),c=new y.a.Path.Rectangle({from:l,to:s,radius:0,strokeWidth:0}),e.addChild(c),l=new y.a.Point(p,v),s=new y.a.Point(m,g),c=new y.a.Path.Rectangle({from:l,to:s,radius:0,strokeWidth:0}),e.addChild(c));var w=t-.5*(r+i),b=m,_=n+o,P=_+r;return l=new y.a.Point(w,_),s=new y.a.Point(b,P),c=new y.a.Path.Rectangle({from:l,to:s,radius:0,strokeWidth:0}),e.addChild(c),e}},{key:"__generateMuxControlTwig",value:function(e,t,n,r,o,i,a,l,s,c,u,h,f){var d=arguments.length>13&&void 0!==arguments[13]&&arguments[13],p=a/2,y=t-.5*a,m=n+r+i,v=t+.5*a,g=n+r+i;l===s&&(d=!0),this.__drawmuxcontroltwig(e,t,n,r,o,i,a,c,u,h,f,d),d||(this.__generateMuxControlTwig(e,y,m,r,o,i,p,l+1,s,c,u,h,f),this.__generateMuxControlTwig(e,v,g,r,o,i,p,l+1,s,c,u,h,f))}},{key:"__drawmuxcontroltwig",value:function(e,t,n,r,o,i,a,l,s,c,u){var h=t-.5*(r+a),f=h+r,d=n+i+r,p=(h+f)/2,m=this.__muxValveAlong(i,r,s),v=this.__muxValveAcross(l,a,r),g=this.__muxValveCenterOffsets(i,m),w=d+g.left,b=t+.5*(a-r),_=b+r,P=n+i+r,C=(b+_)/2,O=P+g.right,S=new y.a.Point(p-v/2,w-m/2),D=new y.a.Point(p+v/2,w+m/2),R=new y.a.Path.Rectangle({from:S,to:D,radius:0,strokeWidth:0});e.addChild(R);var T=new y.a.Point(S.x,w-o/2),L=new y.a.Point(c,w+o/2),F=new y.a.Path.Rectangle({from:T,to:L,radius:0,strokeWidth:0});e.addChild(F),S=new y.a.Point(C-v/2,O-m/2),D=new y.a.Point(C+v/2,O+m/2),R=new y.a.Path.Rectangle({from:S,to:D,radius:0,strokeWidth:0}),e.addChild(R);var k=new y.a.Point(D.x,O-o/2),E=new y.a.Point(u,O+o/2),N=new y.a.Path.Rectangle({from:k,to:E,radius:0,strokeWidth:0});return e.addChild(N),e}}]),n}(R);function Lr(e){return Lr="function"===typeof Symbol&&"symbol"===typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"===typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Lr(e)}function Fr(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function kr(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function Er(e,t,n){return t&&kr(e.prototype,t),n&&kr(e,n),e}function Nr(e,t){if("function"!==typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&xr(e,t)}function xr(e,t){return xr=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},xr(e,t)}function Mr(e){var t=Ar();return function(){var n,r=jr(e);
1if(t){var o=jr(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return Ir(this,n)}}function Ir(e,t){if(t&&("object"===Lr(t)||"function"===typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return Wr(e)}function Wr(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Ar(){if("undefined"===typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"===typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}function jr(e){return jr=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},jr(e)}var Br=function(e){Nr(n,e);var t=Mr(n);function n(){return Fr(this,n),t.call(this)}return Er(n,[{key:"__setupDefinitions",value:function(){this.__unique={position:"Point"},this.__heritable={componentSpacing:"Float",rotation:"Float",length:"Float",width:"Float",height:"Float",spacing:"Float",flowChannelWidth:"Float",mirrorByX:"Float",mirrorByY:"Float"},this.__defaults={componentSpacing:2e3,rotation:0,width:600,length:300,height:250,spacing:1e3,flowChannelWidth:300,mirrorByX:0,mirrorByY:0},this.__units={componentSpacing:"μm",rotation:"°",length:"μm",width:"μm",height:"μm",spacing:"μm",flowChannelWidth:"μm"},this.__minimum={componentSpacing:0,rotation:0,width:30,length:120,height:10,spacing:10,flowChannelWidth:1,mirrorByX:0,mirrorByY:0},this.__maximum={componentSpacing:1e4,rotation:360,width:6e3,length:24e3,height:1200,spacing:1e4,flowChannelWidth:1e4,mirrorByX:1,mirrorByY:1},this.__featureParams={componentSpacing:"componentSpacing",position:"position",length:"length",width:"width",rotation:"rotation",spacing:"spacing",flowChannelWidth:"flowChannelWidth",mirrorByX:"mirrorByX",mirrorByY:"mirrorByY"},this.__targetParams={componentSpacing:"componentSpacing",length:"length",width:"width",rotation:"rotation",spacing:"spacing",flowChannelWidth:"flowChannelWidth",mirrorByX:"mirrorByX",mirrorByY:"mirrorByY"},this.__placementTool="multilayerPositionTool",this.__toolParams={position:"position"},this.__renderKeys=["FLOW","CONTROL"],this.__mint="PUMP",this.__zOffsetKeys={FLOW:"height",CONTROL:"height"},this.__substrateOffset={FLOW:"0",CONTROL:"+1"}}},{key:"getPorts",value:function(e){var t=e.length,n=(e.width,e.spacing),r=[];return r.push(new b(0,-t/2-n,"1",o.FLOW)),r.push(new b(0,t/2+n,"2",o.FLOW)),r.push(new b(0,-n,"3",o.CONTROL)),r.push(new b(0,0,"4",o.CONTROL)),r.push(new b(0,n,"5",o.CONTROL)),r}},{key:"__drawFlow",value:function(e){var t,n=e.position,r=n[0],o=n[1],i=e.length,a=e.width,l=e.color,s=(e.rotation,e.spacing),c=e.flowChannelWidth,u=r-a/2,h=o-i/2,f=r+a/2,d=o+i/2,p=new y.a.CompoundPath("");new y.a.Point(u,h),new y.a.Point(f,d);return t=new y.a.Path.Rectangle({from:new y.a.Point(r-c/2,o-s-i/2),to:new y.a.Point(r+c/2,o+s+i/2)}),p.addChild(t),p.fillColor=l,this.transformRender(e,p),p}},{key:"__drawControl",value:function(e){var t,n=e.position,r=n[0],o=n[1],i=e.length,a=e.width,l=e.color,s=(e.rotation,e.spacing),c=r-a/2,u=o-i/2,h=r+a/2,f=o+i/2,d=new y.a.CompoundPath(""),p=new y.a.Point(c,u),m=new y.a.Point(h,f);t=new y.a.Path.Rectangle({from:p,to:m,radius:0,fillColor:l,strokeWidth:0}),d.addChild(t);var v=new y.a.Point(r,o-s);t=new y.a.Path.Rectangle({from:new y.a.Point(v.x-a/2,v.y-i/2),to:new y.a.Point(v.x+a/2,v.y+i/2)}),d.addChild(t);var g=new y.a.Point(r,o+s);return t=new y.a.Path.Rectangle({from:new y.a.Point(g.x-a/2,g.y-i/2),to:new y.a.Point(g.x+a/2,g.y+i/2)}),d.addChild(t),d.fillColor=l,this.transformRender(e,d),d}},{key:"render2D",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"FLOW";if("FLOW"===t)return this.__drawFlow(e);if("CONTROL"===t)return this.__drawControl(e);throw new Error("Unknown key: "+t)}},{key:"render2DTarget",value:function(e,t){var n=new y.a.CompoundPath(""),r=this.render2D(t,"FLOW"),o=this.render2D(t,"CONTROL");return n.addChild(o),n.addChild(r),n.fillColor=t.color,n.fillColor.alpha=.5,n}}]),n}(R);function Vr(e){return Vr="function"===typeof Symbol&&"symbol"===typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"===typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Vr(e)}function Xr(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Yr(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function Gr(e,t,n){return t&&Yr(e.prototype,t),n&&Yr(e,n),e}function Ur(e,t){if("function"!==typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&zr(e,t)}function zr(e,t){return zr=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},zr(e,t)}function Hr(e){var t=Jr();return function(){var n,r=Zr(e);if(t){var o=Zr(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return Kr(this,n)}}function Kr(e,t){if(t&&("object"===Vr(t)||"function"===typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return qr(e)}function qr(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Jr(){if("undefined"===typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"===typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}function Zr(e){return Zr=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},Zr(e)}var $r=function(e){Ur(n,e);var t=Hr(n);function n(){return Xr(this,n),t.call(this)}return Gr(n,[{key:"__setupDefinitions",value:function(){this.__unique={position:"Point"},this.__heritable={componentSpacing:"Float",valveRadius:"Float",height:"Float",gap:"Float",rotation:"Float",spacing:"Float",flowChannelWidth:"Float",mirrorByX:"Float",mirrorByY:"Float"},this.__defaults={componentSpacing:2e3,valveRadius:1200,height:250,gap:600,width:2400,length:2400,rotation:90,spacing:5e3,flowChannelWidth:300,mirrorByX:0,mirrorByY:0}
1,this.__units={componentSpacing:"μm",valveRadius:"μm",height:"μm",gap:"μm",width:"μm",length:"μm",rotation:"°",spacing:"μm",flowChannelWidth:"μm"},this.__minimum={componentSpacing:0,valveRadius:10,height:10,gap:5,rotation:0,spacing:10,flowChannelWidth:1,mirrorByX:0,mirrorByY:0},this.__maximum={componentSpacing:1e4,valveRadius:2e3,height:1200,gap:1e3,rotation:360,spacing:1e4,flowChannelWidth:1e4,mirrorByX:1,mirrorByY:1},this.__featureParams={componentSpacing:"componentSpacing",position:"position",rotation:"rotation",valveRadius:"valveRadius",flowChannelWidth:"flowChannelWidth",spacing:"spacing",gap:"gap",mirrorByX:"mirrorByX",mirrorByY:"mirrorByY"},this.__targetParams={componentSpacing:"componentSpacing",rotation:"rotation",valveRadius:"valveRadius",flowChannelWidth:"flowChannelWidth",spacing:"spacing",gap:"gap",mirrorByX:"mirrorByX",mirrorByY:"mirrorByY"},this.__placementTool="multilayerPositionTool",this.__toolParams={position:"position"},this.__renderKeys=["FLOW","CONTROL","INVERSE"],this.__mint="PUMP3D",this.__zOffsetKeys={FLOW:"height",CONTROL:"height",INVERSE:"height"},this.__substrateOffset={FLOW:"0",CONTROL:"+1",INVERSE:"0"}}},{key:"getPorts",value:function(e){var t=e.valveRadius,n=e.spacing,r=[];return r.push(new b(0,-n-t,"1",o.FLOW)),r.push(new b(0,n+t,"2",o.FLOW)),r.push(new b(0,-n,"3",o.CONTROL)),r.push(new b(0,0,"4",o.CONTROL)),r.push(new b(0,n,"5",o.CONTROL)),r}},{key:"render2D",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"FLOW";if("FLOW"===t)return this.__drawFlow(e);if("CONTROL"===t)return this.__drawControl(e);if("INVERSE"===t)return this.__drawInverse(e);throw new Error("Unknown key: "+t)}},{key:"render2DTarget",value:function(e,t){var n=new y.a.CompoundPath(""),r=this.render2D(t,"FLOW"),o=this.render2D(t,"CONTROL");return n.addChild(o),n.addChild(r),n.fillColor=t.color,n.fillColor.alpha=.5,n}},{key:"__drawFlow",value:function(e){var t,n,r,o,i=new y.a.CompoundPath(""),a=e.position,l=e.gap,s=e.valveRadius,c=e.color,u=(e.rotation,e.spacing),h=e.flowChannelWidth;o=new y.a.Point(a[0],a[1]),r=new y.a.Path.Circle(o,s),n=new y.a.Path.Rectangle({from:new y.a.Point(a[0]-s,a[1]-l/2),to:new y.a.Point(a[0]+s,a[1]+l/2)}),t=r.subtract(n),i.addChild(t);var f=new y.a.Point(a[0],a[1]+u);r=new y.a.Path.Circle(f,s),n=new y.a.Path.Rectangle({from:new y.a.Point(f.x-s,f.y-l/2),to:new y.a.Point(f.x+s,f.y+l/2)}),t=r.subtract(n),i.addChild(t);var d=new y.a.Point(a[0],a[1]-u);r=new y.a.Path.Circle(d,s),n=new y.a.Path.Rectangle({from:new y.a.Point(d.x-s,d.y-l/2),to:new y.a.Point(d.x+s,d.y+l/2)}),t=r.subtract(n),i.addChild(t);var p=new y.a.Path.Rectangle({from:new y.a.Point(f.x-h/2,f.y-l/2),to:new y.a.Point(o.x+h/2,o.y+l/2)});i.addChild(p);var m=new y.a.Path.Rectangle({from:new y.a.Point(d.x-h/2,d.y+l/2),to:new y.a.Point(o.x+h/2,o.y-l/2)});return i.addChild(m),this.transformRender(e,i),i.fillColor=c,i}},{key:"__drawControl",value:function(e){var t,n=e.position,r=e.valveRadius,o=e.color,i=(e.rotation,e.spacing),a=new y.a.CompoundPath(""),l=new y.a.Point(n[0],n[1]);t=new y.a.Path.Circle(l,r),a.addChild(t);var s=new y.a.Point(n[0],n[1]-i);t=new y.a.Path.Circle(s,r),a.addChild(t);var c=new y.a.Point(n[0],n[1]+i);return t=new y.a.Path.Circle(c,r),a.addChild(t),this.transformRender(e,a),a.fillColor=o,a}},{key:"__drawInverse",value:function(e){var t,n=e.position,r=e.valveRadius,o=e.color,i=(e.rotation,e.spacing),a=new y.a.CompoundPath(""),l=new y.a.Point(n[0],n[1]);t=new y.a.Path.Circle(l,r),a.addChild(t);var s=new y.a.Point(n[0],n[1]-i);t=new y.a.Path.Circle(s,r),a.addChild(t);var c=new y.a.Point(n[0],n[1]+i);return t=new y.a.Path.Circle(c,r),a.addChild(t),this.transformRender(e,a),a.fillColor=o,a}}]),n}(R);function Qr(e){return Qr="function"===typeof Symbol&&"symbol"===typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"===typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Qr(e)}function eo(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function to(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function no(e,t,n){return t&&to(e.prototype,t),n&&to(e,n),e}function ro(e,t){if("function"!==typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&oo(e,t)}
1function oo(e,t){return oo=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},oo(e,t)}function io(e){var t=so();return function(){var n,r=co(e);if(t){var o=co(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return ao(this,n)}}function ao(e,t){if(t&&("object"===Qr(t)||"function"===typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return lo(e)}function lo(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function so(){if("undefined"===typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"===typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}function co(e){return co=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},co(e)}var uo=function(e){ro(n,e);var t=io(n);function n(){return eo(this,n),t.call(this)}return no(n,[{key:"__setupDefinitions",value:function(){this.__unique={start:"Point",end:"Point"},this.__heritable={channelWidth:"Float",height:"Float"},this.__defaults={channelWidth:Ce,height:250},this.__units={channelWidth:"μm",height:"μm"},this.__minimum={channelWidth:3,height:10},this.__maximum={channelWidth:2e3,height:1200},this.__featureParams={start:"start",end:"end",width:"channelWidth"},this.__targetParams={diameter:"channelWidth"},this.__placementTool="DragTool",this.__toolParams={start:"start",end:"end"},this.__renderKeys=["FLOW"],this.__mint="ROUNDED CHANNEL",this.__zOffsetKeys={FLOW:"height"},this.__substrateOffset={FLOW:"0"}}},{key:"render2D",value:function(e,t){var n=e.start,r=e.end,o=e.color,i=e.width,a=(e.baseColor,new y.a.Point(n[0],n[1])),l=new y.a.Point(r[0],r[1]),s=l.subtract(a),c=new y.a.Path.Rectangle({size:[s.length+i,i],point:n,radius:i/2,fillColor:o,strokeWidth:0});return c.translate([-i/2,-i/2]),c.rotate(s.angle,n),c}},{key:"render2DTarget",value:function(e,t){var n=t.position,r=t.diameter,o=t.color,i=new y.a.Point(n[0],n[1]),a=new y.a.Path.Circle(i,r);return a.fillColor=o,a}}]),n}(R);function ho(e){return ho="function"===typeof Symbol&&"symbol"===typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"===typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},ho(e)}function fo(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function po(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function yo(e,t,n){return t&&po(e.prototype,t),n&&po(e,n),e}function mo(e,t){if("function"!==typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&vo(e,t)}function vo(e,t){return vo=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},vo(e,t)}function go(e){var t=_o();return function(){var n,r=Po(e);if(t){var o=Po(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return wo(this,n)}}function wo(e,t){if(t&&("object"===ho(t)||"function"===typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return bo(e)}function bo(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function _o(){if("undefined"===typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"===typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}function Po(e){return Po=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},Po(e)}var Co=function(e){mo(n,e);var t=go(n);function n(){return fo(this,n),t.call(this)}return yo(n,[{key:"__setupDefinitions",value:function(){this.__unique={position:"Point"},this.__heritable={componentSpacing:"Float",rotation:"Float",width:"Float",length:"Float",height:"Float",temperature:"Float",mirrorByX:"Float",mirrorByY:"Float"},this.__defaults={componentSpacing:2e3,rotation:0,width:2e4,length:4e4,height:5e3,temperature:30,mirrorByX:0,mirrorByY:0},this.__units={componentSpacing:"μm",rotation:"°",width:"μm",length:"μm",he
1ight:"μm",temperature:"°C"},this.__minimum={componentSpacing:0,rotation:0,width:1e4,length:1e4,height:1250,temperature:0,mirrorByX:0,mirrorByY:0},this.__maximum={componentSpacing:1e4,rotation:90,width:6e4,length:6e4,height:1e4,temperature:100,mirrorByX:1,mirrorByY:1},this.__placementTool="multilayerPositionTool",this.__toolParams={position:"position"},this.__featureParams={componentSpacing:"componentSpacing",position:"position",rotation:"rotation",length:"length",width:"width",temperature:"temperature",mirrorByX:"mirrorByX",mirrorByY:"mirrorByY"},this.__targetParams={componentSpacing:"componentSpacing",rotation:"rotation",length:"length",width:"width",temperature:"temperature",mirrorByX:"mirrorByX",mirrorByY:"mirrorByY"},this.__renderKeys=["FLOW"],this.__mint="THERMO CYCLER",this.__zOffsetKeys={FLOW:"height"},this.__substrateOffset={FLOW:"0"}}},{key:"render2D",value:function(e,t){var n=e.position,r=(e.rotation,n[0]),o=n[1],i=e.length,a=e.width,l=e.color,s=r-a/2,c=o-i/2,u=r+a/2,h=o+i/2,f=new y.a.Point(s,c),d=new y.a.Point(u,h),p=new y.a.CompoundPath(""),m=(new y.a.Point(r-a,o-i),new y.a.Path.Rectangle({from:f,to:d,radius:0,fillColor:l,strokeWidth:0}));return p.addChild(m),p.fillColor=l,this.transformRender(e,p),p}},{key:"render2DTarget",value:function(e,t){null===e&&(e=this.__renderKeys[0]);var n=this.render2D(t,e);return n.fillColor.alpha=.5,n}},{key:"getPorts",value:function(e){var t=e.length,n=e.width,r=[];return r.push(new b(-n/2,-t/6,"1",o.CONTROL)),r.push(new b(-n/2,t/6,"2",o.CONTROL)),r}}]),n}(R);function Oo(e){return Oo="function"===typeof Symbol&&"symbol"===typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"===typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Oo(e)}function So(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Do(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function Ro(e,t,n){return t&&Do(e.prototype,t),n&&Do(e,n),e}function To(e,t){if("function"!==typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&Lo(e,t)}function Lo(e,t){return Lo=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},Lo(e,t)}function Fo(e){var t=No();return function(){var n,r=xo(e);if(t){var o=xo(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return ko(this,n)}}function ko(e,t){if(t&&("object"===Oo(t)||"function"===typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return Eo(e)}function Eo(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function No(){if("undefined"===typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"===typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}function xo(e){return xo=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},xo(e)}var Mo=function(e){To(n,e);var t=Fo(n);function n(){return So(this,n),t.call(this)}return Ro(n,[{key:"__setupDefinitions",value:function(){this.__unique={position:"Point"},this.__heritable={componentSpacing:"Float",cw1:"Float",cw2:"Float",length:"Float",rotation:"Float",height:"Float",mirrorByX:"Float",mirrorByY:"Float"},this.__defaults={componentSpacing:2e3,cw1:Ce,cw2:900,length:1e3,rotation:0,height:250,mirrorByX:0,mirrorByY:0},this.__units={componentSpacing:"μm",cw1:"μm",cw2:"μm",length:"μm",rotation:"°",height:"μm"},this.__minimum={componentSpacing:0,cw1:3,cw2:3,length:10,height:10,rotation:0,mirrorByX:0,mirrorByY:0},this.__maximum={componentSpacing:1e4,rotation:180,cw1:2e3,cw2:2e3,length:1200,height:1200,mirrorByX:1,mirrorByY:1},this.__featureParams={componentSpacing:"componentSpacing",position:"position",cw1:"cw1",cw2:"cw2",length:"length",rotation:"rotation",mirrorByX:"mirrorByX",mirrorByY:"mirrorByY"},this.__targetParams={componentSpacing:"componentSpacing",cw1:"cw1",cw2:"cw2",length:"length",rotation:"rotation",mirrorByX:"mirrorByX",mirrorByY:"mirrorByY"},this.__placementTool="PositionTool",this.__toolParams={position:"position"},this.__renderKeys=["FLOW"],this.__mint="TRANSITION",this.__zOffsetKeys={FLOW:"height"},this.__substrateOffset={FLOW:"0"}}},{key:"render2D",value:function(e,t){var n=e.position,r=e.cw1,o=e.cw2,i=e.length,a=(e.rotation,e.color),l=new y.a.Path;return l.add(new y.a.Point(n[0]-r/2,n[1])),l.add(new y.a.Point(n[0]+r/2,n[1])),l.add(new y.a.Point(n[0]+o/2,n[1]+i)),l.add(new y.a.Point(n[0]-o/2,n[1]+i)),l.closed=!0,l.fillColor=a,this.transformRender(e,l),l}},{key:"render2DTarget",value:function(e,t){null===e&&(e=this.__renderKeys[0]);var n=this.render2D(t,e);return n.fillColor.alpha=.5,n}}]),n}(R);function Io(e){return Io="function"===typeof Symbol&&"symbol"===typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"===typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Io(e)}function Wo(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Ao(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function jo(e,t,n){return t&&Ao(e.prototype,t),n&&Ao(e,n),e}function Bo(e,t){if("function"!==typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&Vo(e,t)}
1function Vo(e,t){return Vo=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},Vo(e,t)}function Xo(e){var t=Uo();return function(){var n,r=zo(e);if(t){var o=zo(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return Yo(this,n)}}function Yo(e,t){if(t&&("object"===Io(t)||"function"===typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return Go(e)}function Go(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Uo(){if("undefined"===typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"===typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}function zo(e){return zo=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},zo(e)}var Ho=function(e){Bo(n,e);var t=Xo(n);function n(){return Wo(this,n),t.call(this)}return jo(n,[{key:"__setupDefinitions",value:function(){this.__unique={position:"Point"},this.__heritable={componentSpacing:"Float",rotation:"Float",valveRadius:"Float",height:"Float",valveGap:"Float",valveSpacing:"Float",flowChannelWidth:"Float",controlChannelWidth:"Float",mirrorByX:"Float",mirrorByY:"Float"},this.__defaults={componentSpacing:2e3,rotation:0,valveRadius:1200,height:250,valveGap:600,valveSpacing:600,flowChannelWidth:500,controlChannelWidth:500,mirrorByX:0,mirrorByY:0},this.__units={componentSpacing:"μm",rotation:"°",valveRadius:"μm",height:"μm",valveGap:"μm",valveSpacing:"μm",flowChannelWidth:"μm",controlChannelWidth:"μm"},this.__minimum={componentSpacing:0,valveRadius:10,height:10,valveGap:5,valveSpacing:100,flowChannelWidth:.1,controlChannelWidth:.1,rotation:0,mirrorByX:0,mirrorByY:0},this.__maximum={componentSpacing:1e4,valveRadius:2e3,height:1200,valveGap:1e3,valveSpacing:1e3,flowChannelWidth:1e3,controlChannelWidth:1e3,rotation:360,mirrorByX:1,mirrorByY:1},this.__featureParams={componentSpacing:"componentSpacing",position:"position",rotation:"rotation",valveRadius:"valveRadius",valveGap:"valveGap",valveSpacing:"valveSpacing",flowChannelWidth:"flowChannelWidth",controlChannelWidth:"controlChannelWidth",mirrorByX:"mirrorByX",mirrorByY:"mirrorByY"},this.__targetParams={componentSpacing:"componentSpacing",position:"position",rotation:"rotation",valveRadius:"valveRadius",valveGap:"valveGap",valveSpacing:"valveSpacing",flowChannelWidth:"flowChannelWidth",controlChannelWidth:"controlChannelWidth",mirrorByX:"mirrorByX",mirrorByY:"mirrorByY"},this.__placementTool="multilayerPositionTool",this.__toolParams={position:"position"},this.__renderKeys=["FLOW","CONTROL"],this.__mint="TRANSPOSER",this.__zOffsetKeys={FLOW:"height",CONTROL:"height"},this.__substrateOffset={FLOW:"0",CONTROL:"+1"}}},{key:"getPorts",value:function(e){var t=[],n=e.valveRadius,r=e.flowChannelWidth,i=e.valveSpacing;return t.push(new b(0,0,"1",o.FLOW)),t.push(new b(6*i+4*n+3*r,0,"2",o.FLOW)),t.push(new b(0,2*r+4*i+4*n,"3",o.FLOW)),t.push(new b(6*i+4*n+3*r,2*r+4*i+4*n,"4",o.FLOW)),t.push(new b(-2*n-r/2,r+2*i+2*n,"5",o.CONTROL)),t.push(new b(5*i+6*n+3*r,r+2*i+2*n,"6",o.CONTROL)),t}},{key:"render2D",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"FLOW";if("FLOW"===t)return this.__drawFlow(e);if("CONTROL"===t)return this.__drawControl(e);throw new Error("Unknown key: "+t)}},{key:"render2DTarget",value:function(e,t){var n=new y.a.CompoundPath(""),r=this.render2D(t,"FLOW"),o=this.render2D(t,"CONTROL");return n.addChild(o),n.addChild(r),n.fillColor=t.color,n.fillColor.alpha=.5,n}},{key:"__drawFlow",value:function(e){var t=e.position,n=e.valveGap,r=e.valveRadius,o=e.color,i=(e.rotation,e.flowChannelWidth),a=e.valveSpacing,l=new y.a.CompoundPath(""),s=t[0],c=t[1],u=(e.mirrorByX,new y.a.Point(s,c-i/2)),h=new y.a.Point(s+4*a+2*r+2*i,c+i/2),f=new y.a.Path.Rectangle(u,h);return l.addChild(f),this.__createTransposerValve(l,h.x+r,u.y+i/2,n,r,"H",i),u=new y.a.Point(s+4*a+4*r+2*i,c-i/2),h=new y.a.Point(s+6*a+4*r+3*i,c+i/2),f=new y.a.Path.Rectangle(u,h),l.addChild(f),u=new y.a.Point(s+3*a+i+2*r,c+i/2),h=new y.a.Point(u.x+i,u.y+a),f=new y.a.Path.Rectangle(u,h),l.addChild(f),this.__createTransposerValve(l,u.x+i/2,h.y+r,n,r,"V",i),u=new y.a.Point(u.x,h.y+2*r),h=new y.a.Point(u.x+i,u.y+2*a+i),f=new y.a.Path.Rectangle(u,h),l.addChild(f),this.__createTransposerValve(l,u.x+i/2,h.y+r,n,r,"V",i),u=new y.a.Point(u.x,h.y+2*r),h=new y.a.Point(u.x+i,u.y+a),f=new y.a.Path.Rectangle(u,h),l.addChild(f),u=new y.a.Point(s,c+1.5*i+4*a+4*r),h=new y.a.Point(u.x+2*a+i,u.y+i),f=new y.a.Path.Rectangle(u,h),l.addChild(f),this.__createTransposerValve(l,h.x+r,u.y+i/2,n,r,"H",i),u=new y.a.Point(h.x+2*r,u.y),h=new y.a.Point(u.x+4*a+2*i+2*r,u.y+i),f=new y.a.Path.Rectangle(u,h),l.addChild(f),u=new y.a.Point(s+5*a+2*i+4*r,c+i/2),h=new y.a.Point(u.x+i,u.y+a),f=new y.a.Path.Rectangle(u,h),l.addChild(f),this.__createTransposerValve(l,u.x+i/2,h.y+r,n,r,"V",i),u=new y.a.Point(u.x,h.y+2*r),h=new y.a.Point(u.x+i,u.y+a+i),f=new y.a.Path.Rectangle(u,h),l.addChild(f),l.fillColor=o,u=new y.a.Point(s+a,c+1.5*i+2*a+2*r),h=new y.a.Point(u.x+i,u.y+a),f=new y.a.Path.Rectangle(u,h),l.addChild(f),this.__createTransposerValve(l,u.x+i/2,h.y+r,n,r,"V",i),u=new y.a.Point(u.x,h.y+2*r),h=new y.a.Point(u.x+i,u.y+a+i),f=new y.a.Path.Rectangle(u,h),l.addChild(f),l.fillColor=o,this.transformRender(e,l),l}},{key:"__createTransposerValve",value:function(e,t,n,r,o,i,a){var l=new y.a.Point(t,n),s=new y.a.Path.Circle(l,o),c=new y.a.Path.Rectangle({point:new y.a.Point(t-a/2,n-o),size:[a,o],stokeWidth:0});s=s.unite(c),c=new y.a.Path.Rectangle({point:new y.a.Point(t-a/2,n),size:[a,o],stokeWidth:0}),s=s.unite(c);var u=new y.a.Path.Rectangle({from:new y.a.Point(t-o,n-r/2),to:new y.a.Point(t+o,n+r/2)}),h=s.subtract(u);"H"===i&&h.rotate(90,l),e.addChild(h)}},{key:"__drawControl",value:function(e){var t=e.position,n=(e.valveGap,e.valveRadius),r=e.color,o=(e.rotation,e.controlChannelWidth),i=e.valveSpacing,a=new y.a.CompoundPath(""),l=t[0],s=t[1],c=(e.mirrorByX,new y.a.Point(l+4*i+2*o+2*n+n,s)),u=new y.a.Path.Circle(c,n);a.addChild(u);var h=new y.a.Point(l+4*i+2*o+2*n+n-o/2,s-2*n),f=new y.a.Point(l+4*i+2*o+2*n+n+o/2,s);a.addChild(new y.a.Path.Rectangle(h,f)),h=new y.a.Point(l-2*n,s-2*n-o/2),f=new y.a.Point(l+4*i+2*o+2*n+n+o/2,s-2*n+o/2),a.addChild(new y.a.Path.Rectangle(h,f)),c=new y.a.Point(l+1.5*o+3*i+2*n,s+o/2+i+n),u=new y.a.Path.Circle(c,n),a.addChild(u);var d=c;c=new y.a.Point(c.x+2*i+2*n+o,s+o/2+i+n),u=new y.a.Path.Circle(c,n),a.addChild(u);var p=c,m=new y.a.Path.Rectangle({from:new y.a.Point(d.x,d.y-o/2),to:new y.a.Point(p.x,d.y+o/2)});a.addChild(m),h=new y.a.Point(p.x,d.y-o/2),f=new y.a.Point(p.x+2*n,d.y+o/2),a.addChild(new y.a.Path.Rectangle(h,f)),h=new y.a.Point(p.x+2*n-o/2,d.y-o/2),f=new y.a.Point(p.x+2*n+o/2,s+1.5*o+3*i+2*n+n),a.addChild(new y.a.Path.Rectangle(h,f)),c=new y.a.Point(l+.5*o+i,s+1.5*o+3*i+2*n+n),u=new y.a.Path.Circle(c,n),a.addChild(u),d=c,c=new y.a.Point(c.x+2*i+2*n+o,c.y),u=new y.a.Path.Circle(c,n),a.addChild(u),p=c,m=new y.a.Path.Rectangle({from:new y.a.Point(d.x,d.y-o/2),to:new y.a.Point(p.x,d.y+o/2)}),a.addChild(m),h=new y.a.Point(p.x,d.y-o/2),f=new y.a.Point(c.x+2*i+4*n+o+o/2,d.y+o/2),a.addChild(new y.a.Path.Rectangle(h,f)),c=new y.a.Point(l+o+2*i+n,s+4*i+4*n+2*o),u=new y.a.Path.Circle(c,n),a.addChild(u),h=new y.a.Point(l-2*n-o/2,s-2*n-o/2),f=new y.a.Point(l-2*n+o/2,s+4*i+6*n+2*o),a.addChild(new y.a.Path.Rectangle(h,f)),h=new y.a.Point(l-2*n-o/2,s+4*i+6*n+2*o-o/2),f=new y.a.Point(l+o+2*i+n,s+4*i+6*n+2*o+o/2),a.addChild(new y.a.Path.Rectangle(h,f)),h=new y.a.Point(l+o+2*i+n-o/2,s+4*i+4*n+2*o),f=new y.a.Point(l+o+2*i+n+o/2,s+4*i+6*n+2*o+o/2),a.addChild(new y.a.Path.Rectangle(h,f));var v=new y.a.Point(l+i,s+o/2+2*n+2*i),g=new y.a.Point(v.x+4*i+3*o+4*n,v.y+o),w=new y.a.Path.Rectangle(v,g);return a.addChild(w),this.transformRender(e,a),a.fillColor=r,a}}]),n}(R);function Ko(e){return Ko="function"===typeof Symbol&&"symbol"===typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"===typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Ko(e)}function qo(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Jo(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}
1function Zo(e,t,n){return t&&Jo(e.prototype,t),n&&Jo(e,n),e}function $o(e,t){if("function"!==typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&Qo(e,t)}function Qo(e,t){return Qo=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},Qo(e,t)}function ei(e){var t=ri();return function(){var n,r=oi(e);if(t){var o=oi(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return ti(this,n)}}function ti(e,t){if(t&&("object"===Ko(t)||"function"===typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return ni(e)}function ni(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function ri(){if("undefined"===typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"===typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}function oi(e){return oi=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},oi(e)}var ii=function(e){$o(n,e);var t=ei(n);function n(e){var r;return qo(this,n),r=t.call(this),r._valveType=i.NORMALLY_OPEN,r._valveType=e,r}return Zo(n,[{key:"drawsAtPositionCenter",value:function(){return!0}},{key:"valveType",get:function(){return this._valveType}}]),n}(R);function ai(e){return ai="function"===typeof Symbol&&"symbol"===typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"===typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},ai(e)}function li(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function si(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function ci(e,t,n){return t&&si(e.prototype,t),n&&si(e,n),e}function ui(e,t){if("function"!==typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&hi(e,t)}function hi(e,t){return hi=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},hi(e,t)}function fi(e){var t=yi();return function(){var n,r=mi(e);if(t){var o=mi(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return di(this,n)}}function di(e,t){if(t&&("object"===ai(t)||"function"===typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return pi(e)}function pi(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function yi(){if("undefined"===typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"===typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}function mi(e){return mi=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},mi(e)}var vi=function(e){ui(n,e);var t=fi(n);function n(e){return li(this,n),t.call(this,e)}return ci(n,[{key:"__setupDefinitions",value:function(){this.__unique={position:"Point"},this.__heritable={componentSpacing:"Float",rotation:"Float",length:"Float",width:"Float",height:"Float",mirrorByX:"Float",mirrorByY:"Float"},this.__defaults={componentSpacing:2e3,rotation:0,width:1230,length:4920,height:250,mirrorByX:0,mirrorByY:0},this.__units={componentSpacing:"μm",rotation:"°",length:"μm",width:"μm",height:"μm"},this.__minimum={componentSpacing:0,rotation:0,width:30,length:120,height:10,mirrorByX:0,mirrorByY:0},this.__maximum={componentSpacing:1e4,rotation:180,width:6e3,length:24e3,height:1200,mirrorByX:1,mirrorByY:1},this.__featureParams={componentSpacing:"componentSpacing",position:"position",length:"length",width:"width",rotation:"rotation",mirrorByX:"mirrorByX",mirrorByY:"mirrorByY"},this.__targetParams={componentSpacing:"componentSpacing",length:"length",width:"width",rotation:"rotation",mirrorByX:"mirrorByX",mirrorByY:"mirrorByY"},this.__placementTool="valveInsertionTool",this.__toolParams={position:"position"},this.__renderKeys=["CONTROL"],this.__mint="VALVE",this.__zOffsetKeys={CONTROL:"height"},this.__substrateOffset={CONTROL:"+1"}}},{key:"getPorts",value:function(e){var t=e.length,n=e.width,r=[];return r.push(new b(0,-t/2,"1",o.CONTROL)),r.push(new b(n/2,0,"2",o.CONTROL)),r.push(new b(0,t/2,"3",o.CONTROL)),r.push(new b(-n/2,0,"4",o.CONTROL)),r}},{key:"render2D",value:function(e){var t=e.position,n=t[0],r=t[1],o=e.length,i=e.width,a=e.color,l=(e.rotation,n-i/2),s=r-o/2,c=n+i/2,u=r+o/2,h=new y.a.Point(l,s),f=new y.a.Point(c,u),d=new y.a.Path.Rectangle({from:h,to:f,radius:0,fillColor:a,strokeWidth:0}),p=new y.a.CompoundPath(d);return p.fillColor=a,this.transformRender(e,p),p}},{key:"render2DTarget",value:function(e,t){var n=this.render2D(t,"CONTROL");return n.fillColor=t.color,n.fillColor.alpha=.5,n}}]),n}(ii);function gi(e){return gi="function"===typeof Symbol&&"symbol"===typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"===typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},gi(e)}function wi(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function bi(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}
1function _i(e,t,n){return t&&bi(e.prototype,t),n&&bi(e,n),e}function Pi(e,t){if("function"!==typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&Ci(e,t)}function Ci(e,t){return Ci=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},Ci(e,t)}function Oi(e){var t=Ri();return function(){var n,r=Ti(e);if(t){var o=Ti(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return Si(this,n)}}function Si(e,t){if(t&&("object"===gi(t)||"function"===typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return Di(e)}function Di(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Ri(){if("undefined"===typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"===typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}function Ti(e){return Ti=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},Ti(e)}var Li=function(e){Pi(n,e);var t=Oi(n);function n(e){return wi(this,n),t.call(this,e)}return _i(n,[{key:"__setupDefinitions",value:function(){this.__unique={position:"Point"},this.__heritable={componentSpacing:"Float",rotation:"Float",valveRadius:"Float",height:"Float",gap:"Float",width:"Float",length:"Float"},this.__defaults={componentSpacing:2e3,rotation:0,valveRadius:1200,height:250,gap:600,width:2400,length:2400},this.__units={componentSpacing:"μm",valveRadius:"μm",height:"μm",gap:"μm",width:"μm",length:"μm",rotation:"°"},this.__minimum={componentSpacing:0,valveRadius:10,height:10,gap:5,rotation:0,width:10,length:10},this.__maximum={componentSpacing:1e4,valveRadius:3e3,height:1200,gap:1e3,rotation:180,width:3e3,length:3e3},this.__featureParams={componentSpacing:"componentSpacing",position:"position",rotation:"rotation",radius1:"valveRadius",radius2:"valveRadius",valveRadius:"valveRadius",gap:"gap"},this.__targetParams={componentSpacing:"componentSpacing",position:"position",rotation:"rotation",radius1:"valveRadius",radius2:"valveRadius",valveRadius:"valveRadius",gap:"gap"},this.__placementTool="valveInsertionTool",this.__toolParams={position:"position"},this.__renderKeys=["FLOW","CONTROL","INVERSE"],this.__mint="VALVE3D",this.__zOffsetKeys={FLOW:"height",CONTROL:"height",INVERSE:"height"},this.__substrateOffset={FLOW:"0",CONTROL:"+1",INVERSE:"0"},this.__childFeatureMacros=["VALVE3D GAP","VALVE3D FLOW"]}},{key:"getPorts",value:function(e){var t=[];return t.push(new b(0,0,"1",o.CONTROL)),t}},{key:"__drawFlow",value:function(e){var t=e.position,n=e.gap,r=e.valveRadius,o=e.color,i=e.rotation,a=new y.a.Point(t[0],t[1]),l=new y.a.Path.Circle(a,r),s=new y.a.Path.Rectangle({from:new y.a.Point(t[0]-r,t[1]-n/2),to:new y.a.Point(t[0]+r,t[1]+n/2)}),c=l.subtract(s);return c.rotate(i,a),c.fillColor=o,c}},{key:"__drawControl",value:function(e){var t=e.position,n=(e.gap,e.valveRadius),r=e.color,o=(e.rotation,new y.a.Point(t[0],t[1])),i=new y.a.Path.Circle(o,n);return i.fillColor=r,i}},{key:"render2D",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"FLOW";if("FLOW"===t)return this.__drawFlow(e);if("CONTROL"===t)return this.__drawControl(e);if("INVERSE"===t)return this.__drawInverseFlow(e);throw new Error("No render procedure defined for component:"+this.__mint+", key: "+t)}},{key:"render2DTarget",value:function(e,t){var n="CONTROL"===e?"CONTROL":"FLOW",r=this.render2D(t,n);return r.fillColor.alpha=.5,r}},{key:"__drawInverseFlow",value:function(e){var t=e.position,n=(e.gap,e.valveRadius),r=e.color;console.log("Color:",r);var o=e.rotation,i=new y.a.Point(t[0],t[1]),a=new y.a.Path.Circle(i,n);return a.fillColor=r,a.rotate(o,i)}}]),n}(ii);function Fi(e){return Fi="function"===typeof Symbol&&"symbol"===typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"===typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Fi(e)}function ki(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Ei(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function Ni(e,t,n){return t&&Ei(e.prototype,t),n&&Ei(e,n),e}function xi(e,t){if("function"!==typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&Mi(e,t)}
1function Mi(e,t){return Mi=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},Mi(e,t)}function Ii(e){var t=ji();return function(){var n,r=Bi(e);if(t){var o=Bi(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return Wi(this,n)}}function Wi(e,t){if(t&&("object"===Fi(t)||"function"===typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return Ai(e)}function Ai(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function ji(){if("undefined"===typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"===typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}function Bi(e){return Bi=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},Bi(e)}var Vi=function(e){xi(n,e);var t=Ii(n);function n(){return ki(this,n),t.call(this)}return Ni(n,[{key:"__setupDefinitions",value:function(){this.__unique={position:"Point"},this.__heritable={componentSpacing:"Float",flowChannelWidth:"Float",rotation:"Float",leafSpace:"Float",in:"Integer",out:"Integer",width:"Float",height:"Float",stageSpace:"Float",mirrorByX:"Float",mirrorByY:"Float"},this.__defaults={componentSpacing:2e3,flowChannelWidth:Ce,rotation:0,leafSpace:4e3,in:1,out:8,width:2460,height:250,stageSpace:4e3,mirrorByX:0,mirrorByY:0},this.__units={componentSpacing:"μm",flowChannelWidth:"μm",rotation:"°",leafSpace:"μm",in:"",out:"",width:"μm",height:"μm",stageSpace:"μm"},this.__minimum={componentSpacing:0,flowChannelWidth:10,leafSpace:30,in:1,out:2,width:60,height:10,stageSpace:100,rotation:0,mirrorByX:0,mirrorByY:0},this.__maximum={componentSpacing:1e4,flowChannelWidth:2e3,leafSpace:12e3,in:1,out:128,width:12e3,height:1200,stageSpace:6e3,rotation:360,mirrorByX:1,mirrorByY:1},this.__featureParams={componentSpacing:"componentSpacing",position:"position",flowChannelWidth:"flowChannelWidth",rotation:"rotation",leafSpace:"leafSpace",width:"width",in:"in",out:"out",stageSpace:"stageSpace",mirrorByX:"mirrorByX",mirrorByY:"mirrorByY"},this.__targetParams={componentSpacing:"componentSpacing",flowChannelWidth:"flowChannelWidth",rotation:"rotation",leafSpace:"leafSpace",width:"width",in:"in",out:"out",stageSpace:"stageSpace",mirrorByX:"mirrorByX",mirrorByY:"mirrorByY"},this.__placementTool="componentPositionTool",this.__toolParams={position:"position"},this.__renderKeys=["FLOW"],this.__mint="TREE",this.__zOffsetKeys={FLOW:"height"},this.__substrateOffset={FLOW:"0"}}},{key:"__treeLeafSpace",value:function(e){var t=Number(e.leafSpace);if(Number.isFinite(t)&&t>0)return t;var n=Number(e.spacing);return Number.isFinite(n)&&n>0?n:4e3}},{key:"__treeStageSpace",value:function(e){var t=Number(e.stageSpace);if(Number.isFinite(t)&&t>0)return t;var n=Number(e.stageLength);return Number.isFinite(n)&&n>0?n:4e3}},{key:"getPorts",value:function(e){var t,n=[],r=e.flowChannelWidth,i=this.__treeLeafSpace(e),a=e.in,l=e.out;t=a<l?l:a;var s=this.__treeStageSpace(e),c=Math.ceil(Math.log2(t)),u=i*(t/2+1),h=c*(r+s)+s,f=1*u*2*Math.pow(.5,c);n.push(new b(0,0,"1",o.FLOW));for(var d=0;d<t;d++)n.push(new b((t-1)*f/2-d*f,h,(2+d).toString(),o.FLOW));return n}},{key:"render2D",value:function(e,t){var n,r=e.position,o=e.flowChannelWidth,i=(e.rotation,this.__treeLeafSpace(e)),a=e.in,l=e.out;n=a<l?l:a;var s=e.color,c=this.__treeStageSpace(e),u=r[0],h=r[1],f=Math.ceil(Math.log2(n));var d=i*(n/2+1),p=new y.a.CompoundPath("");return this.__generateTwig(p,u,h,o,c,d,1,f),p.fillColor=s,this.transformRender(e,p),p}},{key:"__generateTwig",value:function(e,t,n,r,o,i,a,l){var s=arguments.length>8&&void 0!==arguments[8]&&arguments[8],c=i/2,u=t-.5*i,h=n+r+o,f=t+.5*i,d=n+r+o;a===l&&(s=!0),this.__drawtwig(e,t,n,r,o,i,s),s||(this.__generateTwig(e,u,h,r,o,c,a+1,l),this.__generateTwig(e,f,d,r,o,c,a+1,l))}},{key:"__drawtwig",value:function(e,t,n,r,o,i){var a=arguments.length>6&&void 0!==arguments[6]&&arguments[6],l=new y.a.Point(t-r/2,n),s=new y.a.Point(t+r/2,n+o),c=new y.a.Path.Rectangle({from:l,to:s,radius:0,strokeWidth:0});e.addChild(c);var u=t-.5*(r+i),h=u+r,f=n+o+r,d=f+o,p=t+.5*(i-r),m=p+r,v=n+o+r,g=v+o;a&&(l=new y.a.Point(u,f),s=new y.a.Point(h,d),c=new y.a.Path.Rectangle({from:l,to:s,radius:0,strokeWidth:0}),e.addChild(c),l=new y.a.Point(p,v),s=new y.a.Point(m,g),c=new y.a.Path.Rectangle({from:l,to:s,radius:0,strokeWidth:0}),e.addChild(c));var w=t-.5*(r+i),b=m,_=n+o,P=_+r;return l=new y.a.Point(w,_),s=new y.a.Point(b,P),c=new y.a.Path.Rectangle({from:l,to:s,radius:0,strokeWidth:0}),e.addChild(c),e}},{key:"render2DTarget",value:function(e,t){null===e&&(e=this.__renderKeys[0]);var n=this.render2D(t,e);return n.fillColor.alpha=.5,n}}]),n}(R);function Xi(e){return Xi="function"===typeof Symbol&&"symbol"===typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"===typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Xi(e)}function Yi(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Gi(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function Ui(e,t,n){return t&&Gi(e.prototype,t),n&&Gi(e,n),e}function zi(e,t){if("function"!==typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&Hi(e,t)}
1function Hi(e,t){return Hi=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},Hi(e,t)}function Ki(e){var t=Zi();return function(){var n,r=$i(e);if(t){var o=$i(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return qi(this,n)}}function qi(e,t){if(t&&("object"===Xi(t)||"function"===typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return Ji(e)}function Ji(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Zi(){if("undefined"===typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"===typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}function $i(e){return $i=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},$i(e)}var Qi=function(e){zi(n,e);var t=Ki(n);function n(){return Yi(this,n),t.call(this)}return Ui(n,[{key:"__setupDefinitions",value:function(){this.__unique={position:"Point"},this.__heritable={componentSpacing:"Float",flowChannelWidth:"Float",rotation:"Float",leafSpace:"Float",in:"Integer",out:"Integer",width:"Float",height:"Float",stageSpace:"Float",mirrorByX:"Float",mirrorByY:"Float"},this.__defaults={componentSpacing:2e3,flowChannelWidth:Ce,rotation:0,leafSpace:4e3,in:1,out:8,width:2460,height:250,stageSpace:4e3,mirrorByX:0,mirrorByY:0},this.__units={componentSpacing:"μm",flowChannelWidth:"μm",rotation:"°",leafSpace:"μm",in:"",out:"",width:"μm",height:"μm",stageSpace:"μm"},this.__minimum={componentSpacing:0,flowChannelWidth:10,leafSpace:30,in:1,out:2,width:60,height:10,stageSpace:100,rotation:0,mirrorByX:0,mirrorByY:0},this.__maximum={componentSpacing:1e4,flowChannelWidth:2e3,leafSpace:12e3,in:1,out:128,width:12e3,height:1200,stageSpace:6e3,rotation:360,mirrorByX:1,mirrorByY:1},this.__featureParams={componentSpacing:"componentSpacing",position:"position",flowChannelWidth:"flowChannelWidth",rotation:"rotation",leafSpace:"leafSpace",width:"width",in:"in",out:"out",stageSpace:"stageSpace",mirrorByX:"mirrorByX",mirrorByY:"mirrorByY"},this.__targetParams={componentSpacing:"componentSpacing",flowChannelWidth:"flowChannelWidth",rotation:"rotation",leafSpace:"leafSpace",in:"in",out:"out",stageSpace:"stageSpace",mirrorByX:"mirrorByX",mirrorByY:"mirrorByY"},this.__placementTool="componentPositionTool",this.__toolParams={position:"position"},this.__renderKeys=["FLOW"],this.__mint="YTREE",this.__zOffsetKeys={FLOW:"height"},this.__substrateOffset={FLOW:"0"}}},{key:"__treeLeafSpace",value:function(e){var t=Number(e.leafSpace);if(Number.isFinite(t)&&t>0)return t;var n=Number(e.spacing);return Number.isFinite(n)&&n>0?n:4e3}},{key:"__treeStageSpace",value:function(e){var t=Number(e.stageSpace);if(Number.isFinite(t)&&t>0)return t;var n=Number(e.stageLength);return Number.isFinite(n)&&n>0?n:4e3}},{key:"getPorts",value:function(e){var t,n=[],r=this.__treeLeafSpace(e),i=e.in,a=e.out;t=i<a?a:i;var l=this.__treeStageSpace(e),s=Math.ceil(Math.log2(t)),c=r*(t/2+1);n.push(new b(0,0,"1",o.FLOW));for(var u=this.__ytreeLeafTips(0,0,l,c,1,s),h=0;h<u.length;h++)n.push(new b(u[h][0],u[h][1],(2+h).toString(),o.FLOW));return n}},{key:"render2D",value:function(e,t){var n,r=e.position,o=e.flowChannelWidth,i=(e.rotation,this.__treeLeafSpace(e)),a=e.in,l=e.out;a<l?n=l:n=a;var s=e.color,c=this.__treeStageSpace(e),u=r[0],h=r[1],f=Math.ceil(Math.log2(n));var d=i*(n/2+1),p=new y.a.CompoundPath("");return this.__generateYTwig(p,u,h,o,c,d,1,f),p.fillColor=s,this.transformRender(e,p),p}},{key:"render2DTarget",value:function(e,t){null===e&&(e=this.__renderKeys[0]);var n=this.render2D(t,e);return n.fillColor.alpha=.5,n}},{key:"__ytreeLeafTips",value:function(e,t,n,r,o,i){var a=r/2,l=e-.5*r,s=t+n,c=e+.5*r,u=t+n;if(o===i){var h=.5*r;return[[e+h,t+n],[e-h,t+n]]}return this.__ytreeLeafTips(c,u,n,a,o+1,i).concat(this.__ytreeLeafTips(l,s,n,a,o+1,i))}},{key:"__generateYTwig",value:function(e,t,n,r,o,i,a,l){var s=arguments.length>8&&void 0!==arguments[8]&&arguments[8],c=i/2,u=t-.5*i,h=n+o,f=t+.5*i,d=n+o;a===l&&(s=!0),this.__drawYtwig(e,t,n,r,o,i,s),s||(this.__generateYTwig(e,u,h,r,o,c,a+1,l),this.__generateYTwig(e,f,d,r,o,c,a+1,l))}},{key:"__drawYtwig",value:function(e,t,n,r,o,i){var a=new y.a.Point(t,n),l=new y.a.Point(t-r/2,n-r/2),s=Math.atan(i/2/o),c=i/2/Math.sin(s)+r,u=new y.a.Path.Rectangle({size:[r,c],point:l,radius:r/2,stokeWidth:0});return u.rotate(180*s/Math.PI,a),e.addChild(u),u=new y.a.Path.Rectangle({size:[r,c],point:l,radius:r/2,stokeWidth:0}),u.rotate(180*-s/Math.PI,a),e.addChild(u),e}}]),n}(R);function ea(e){return ea="function"===typeof Symbol&&"symbol"===typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"===typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},ea(e)}function ta(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function na(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function ra(e,t,n){return t&&na(e.prototype,t),n&&na(e,n),e}function oa(e,t){if("function"!==typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&ia(e,t)}
1function ia(e,t){return ia=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},ia(e,t)}function aa(e){var t=ca();return function(){var n,r=ua(e);if(t){var o=ua(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return la(this,n)}}function la(e,t){if(t&&("object"===ea(t)||"function"===typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return sa(e)}function sa(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function ca(){if("undefined"===typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"===typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}function ua(e){return ua=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},ua(e)}var ha=function(e){oa(n,e);var t=aa(n);function n(){return ta(this,n),t.call(this)}return ra(n,[{key:"__setupDefinitions",value:function(){this.__unique={position:"Point"},this.__heritable={componentSpacing:"Float",width:"Float",length:"Float",height:"Float",rotation:"Float",spacing:"Float",numberOfChambers:"Integer",mirrorByX:"Float",mirrorByY:"Float"},this.__defaults={componentSpacing:2e3,width:400,length:5e3,height:250,spacing:2e3,numberOfChambers:4,rotation:0,mirrorByX:0,mirrorByY:0},this.__units={componentSpacing:"μm",width:"μm",length:"μm",height:"μm",spacing:"μm",numberOfChambers:"10",rotation:"°"},this.__minimum={componentSpacing:0,width:5,length:5,height:1,spacing:1,numberOfChambers:1,rotation:0,mirrorByX:0,mirrorByY:0},this.__maximum={componentSpacing:1e4,width:5e4,length:5e4,height:5e4,numberOfChambers:1e3,spacing:5e4,rotation:360,mirrorByX:1,mirrorByY:1},this.__featureParams={componentSpacing:"componentSpacing",position:"position",width:"width",length:"length",height:"height",numberOfChambers:"numberOfChambers",spacing:"spacing",rotation:"rotation",mirrorByX:"mirrorByX",mirrorByY:"mirrorByY"},this.__targetParams={componentSpacing:"componentSpacing",position:"position",width:"width",length:"length",height:"height",numberOfChambers:"numberOfChambers",spacing:"spacing",rotation:"rotation",mirrorByX:"mirrorByX",mirrorByY:"mirrorByY"},this.__placementTool="multilayerPositionTool",this.__toolParams={position:"position"},this.__mint="LL CHAMBER",this.__zOffsetKeys={FLOW:"height",CONTROL:"height"},this.__substrateOffset={FLOW:"0",CONTROL:"+1"}}},{key:"getPorts",value:function(e){var t=e.position,n=(t[0],t[1],e.length),r=e.width,i=(e.rotation,e.color,e.numberOfChambers),a=e.spacing,l=[];return l.push(new b(r/2,-r,"1",o.FLOW)),l.push(new b(i*r+(i+1)*a-r/2,-r,"2",o.FLOW)),l.push(new b(r/2,n+r,"3",o.FLOW)),l.push(new b(i*r+(i+1)*a-r/2,n+r,"4",o.FLOW)),l.push(new b(0,.2*n,"10",o.CONTROL)),l.push(new b(0,.5*n,"9",o.CONTROL)),l.push(new b(0,.8*n,"8",o.CONTROL)),l.push(new b(i*r+(i+1)*a,.2*n,"5",o.CONTROL)),l.push(new b(i*r+(i+1)*a,.5*n,"6",o.CONTROL)),l.push(new b(i*r+(i+1)*a,.8*n,"7",o.CONTROL)),l}},{key:"__renderFlow",value:function(e){for(var t,n=e.position,r=n[0],o=n[1],i=e.length,a=e.width,l=(e.rotation,e.color),s=e.numberOfChambers,c=e.spacing,u=new y.a.CompoundPath(""),h=0;h<s;h++)t=new y.a.Path.Rectangle({point:new y.a.Point(r+(h+1)*c+h*a,o-1),size:[a,i+2],radius:0}),u.addChild(t);var f=new y.a.Path.Rectangle({point:new y.a.Point(r,o-a),size:[s*a+(s+1)*c,a]});u.addChild(f);var d=new y.a.Path.Rectangle({point:new y.a.Point(r,o+i),size:[s*a+(s+1)*c,a]});return u.addChild(d),u.fillColor=l,this.transformRender(e,u),u}},{key:"__renderControl",value:function(e){var t=new y.a.CompoundPath(""),n=e.position,r=n[0],o=n[1],i=e.length,a=e.width,l=(e.rotation,e.color),s=e.numberOfChambers,c=e.spacing,u=new y.a.Path.Rectangle({point:new y.a.Point(r,o+.2*i-a/2),size:[s*a+(s+1)*c,a]});t.addChild(u);var h=new y.a.Path.Rectangle({point:new y.a.Point(r,o+.5*i-a/2),size:[s*a+(s+1)*c,a]});t.addChild(h);var f=new y.a.Path.Rectangle({point:new y.a.Point(r,o+.8*i-a/2),size:[s*a+(s+1)*c,a]});return t.addChild(f),t.fillColor=l,this.transformRender(e,t),t}},{key:"render2D",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"FLOW";if("FLOW"===t)return this.__renderFlow(e);if("CONTROL"===t)return this.__renderControl(e);throw new Error("Unknown render key found in LLCHAMBER: "+t)}},{key:"render2DTarget",value:function(e,t){var n=new y.a.CompoundPath(""),r=this.render2D(t,"FLOW"),o=this.render2D(t,"CONTROL");return n.addChild(o),n.addChild(r),n.fillColor=t.color,n.fillColor.alpha=.5,n}}]),n}(R);function fa(e){return fa="function"===typeof Symbol&&"symbol"===typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"===typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},fa(e)}function da(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function pa(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function ya(e,t,n){return t&&pa(e.prototype,t),n&&pa(e,n),e}function ma(e,t){if("function"!==typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&va(e,t)}
1function va(e,t){return va=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},va(e,t)}function ga(e){var t=_a();return function(){var n,r=Pa(e);if(t){var o=Pa(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return wa(this,n)}}function wa(e,t){if(t&&("object"===fa(t)||"function"===typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return ba(e)}function ba(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function _a(){if("undefined"===typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"===typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}function Pa(e){return Pa=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},Pa(e)}var Ca=function(e){ma(n,e);var t=ga(n);function n(){return da(this,n),t.call(this)}return ya(n,[{key:"__setupDefinitions",value:function(){this.__unique={position:"Point"},this.__heritable={componentSpacing:"Float",bendSpacing:"Float",numberOfBends:"Float",channelWidth:"Float",edgeBend1:"Float",edgeBend2:"Float",bendLength:"Float",rotation:"Float",height:"Float",mirrorByX:"Float",mirrorByY:"Float"},this.__defaults={componentSpacing:2e3,channelWidth:Oe,edgeBend1:Oe/2,edgeBend2:Oe/2,bendSpacing:Se,numberOfBends:1,rotation:0,bendLength:De,height:250,mirrorByX:0,mirrorByY:0},this.__units={componentSpacing:"μm",bendSpacing:"μm",numberOfBends:"",channelWidth:"μm",edgeBend1:"μm",edgeBend2:"μm",bendLength:"μm",rotation:"°",height:"μm"},this.__minimum={componentSpacing:0,channelWidth:10,edgeBend1:0,edgeBend2:0,bendSpacing:10,numberOfBends:1,rotation:0,bendLength:10,height:10,mirrorByX:0,mirrorByY:0},this.__maximum={componentSpacing:1e4,channelWidth:2e3,edgeBend1:12e3,edgeBend2:12e3,bendSpacing:6e3,numberOfBends:20,rotation:360,bendLength:12e3,height:1200,mirrorByX:1,mirrorByY:1},this.__placementTool="multilayerPositionTool",this.__toolParams={cursorPosition:"position"},this.__featureParams={componentSpacing:"componentSpacing",position:"position",channelWidth:"channelWidth",edgeBend1:"edgeBend1",edgeBend2:"edgeBend2",bendSpacing:"bendSpacing",numberOfBends:"numberOfBends",rotation:"rotation",bendLength:"bendLength",mirrorByX:"mirrorByX",mirrorByY:"mirrorByY"},this.__targetParams={componentSpacing:"componentSpacing",channelWidth:"channelWidth",edgeBend1:"edgeBend1",edgeBend2:"edgeBend2",bendSpacing:"bendSpacing",numberOfBends:"numberOfBends",rotation:"rotation",bendLength:"bendLength",mirrorByX:"mirrorByX",mirrorByY:"mirrorByY"},this.__renderKeys=["FLOW","CONTROL"],this.__mint="MIXER3D",this.__zOffsetKeys={FLOW:"height",CONTROL:"height"},this.__substrateOffset={FLOW:"0",CONTROL:"+1"}}},{key:"getPorts",value:function(e){var t=Le(e),n=[];return n.push(new b(t.port1x,t.port1y,"1",o.FLOW)),n.push(new b(t.port2x,t.port2y,"2",o.FLOW)),n}},{key:"render2D",value:function(e,t){var n=e.channelWidth,r=e.bendLength,o=e.bendSpacing,i=(e.rotation,e.numberOfBends),a=e.position[0],l=e.position[1],s=e.color,c=Le(e),u=r+2*n,h=o+2*n,f=2*o+2*n,d=o+n,p=new y.a.CompoundPath("");if("FLOW"===t){p.addChild(new y.a.Path.Rectangle(new y.a.Rectangle(a,l,c.firstWidth,n)));for(var m=0;m<i;m++)p.addChild(new y.a.Path.Rectangle(new y.a.Rectangle(a,l+f*m,n,h))),p.addChild(new y.a.Path.Rectangle(new y.a.Rectangle(a+n+r,l+d+f*m,n,h))),m===i-1?p.addChild(new y.a.Path.Rectangle(new y.a.Rectangle(a+c.lastStart,l+f*(m+1),c.lastWidth,n))):p.addChild(new y.a.Path.Rectangle(new y.a.Rectangle(a,l+f*(m+1),u,n)))}else for(var v=0;v<i;v++)p.addChild(new y.a.Path.Rectangle(new y.a.Rectangle(a,l+d+f*v,u,n)));return p.fillColor=s,this.transformRender(e,p),p}},{key:"render2DTarget",value:function(e,t){null===e&&(e=this.__renderKeys[0]);var n=this.render2D(t,e);return n.fillColor=t.color,n.fillColor.alpha=.5,n}}]),n}(R);function Oa(e){return Oa="function"===typeof Symbol&&"symbol"===typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"===typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Oa(e)}function Sa(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Da(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}
1function Ra(e,t,n){return t&&Da(e.prototype,t),n&&Da(e,n),e}function Ta(e,t){if("function"!==typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&La(e,t)}function La(e,t){return La=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},La(e,t)}function Fa(e){var t=Na();return function(){var n,r=xa(e);if(t){var o=xa(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return ka(this,n)}}function ka(e,t){if(t&&("object"===Oa(t)||"function"===typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return Ea(e)}function Ea(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Na(){if("undefined"===typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"===typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}function xa(e){return xa=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},xa(e)}var Ma=function(e){Ta(n,e);var t=Fa(n);function n(){return Sa(this,n),t.call(this)}return Ra(n,[{key:"__setupDefinitions",value:function(){this.__unique={position:"Point"},this.__heritable={componentSpacing:"Float",radius:"Float",height:"Float"},this.__defaults={componentSpacing:2e3,radius:700,height:0},this.__units={componentSpacing:"μm",radius:"μm",height:"μm"},this.__minimum={componentSpacing:0,radius:8,height:0},this.__maximum={componentSpacing:1e4,radius:2e3,height:0},this.__placementTool="componentPositionTool",this.__toolParams={position:"position"},this.__featureParams={componentSpacing:"componentSpacing",position:"position",radius:"radius"},this.__targetParams={componentSpacing:"componentSpacing",radius:"radius"},this.__renderKeys=["FLOW"],this.__mint="VIA",this.__zOffsetKeys={FLOW:"height"},this.__substrateOffset={FLOW:"0"}}},{key:"drawsAtPositionCenter",value:function(){return!0}},{key:"getPorts",value:function(e){e.radius;var t=[];return t.push(new b(0,0,"1",o.FLOW)),t}},{key:"render2D",value:function(e,t){var n=e.position,r=e.radius,o=e.color,i=new y.a.Point(n[0],n[1]),a=new y.a.Path.Circle(i,r);return a.fillColor=o,a}},{key:"render2DTarget",value:function(e,t){null===e&&(e=this.__renderKeys[0]);var n=this.render2D(t,e);return n.fillColor.alpha=.5,n}}]),n}(R);function Ia(e){return Ia="function"===typeof Symbol&&"symbol"===typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"===typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Ia(e)}function Wa(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Aa(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function ja(e,t,n){return t&&Aa(e.prototype,t),n&&Aa(e,n),e}function Ba(e,t){if("function"!==typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&Va(e,t)}function Va(e,t){return Va=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},Va(e,t)}function Xa(e){var t=Ua();return function(){var n,r=za(e);if(t){var o=za(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return Ya(this,n)}}function Ya(e,t){if(t&&("object"===Ia(t)||"function"===typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return Ga(e)}function Ga(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Ua(){if("undefined"===typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"===typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}
1function za(e){return za=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},za(e)}var Ha=function(e){Ba(n,e);var t=Xa(n);function n(){return Wa(this,n),t.call(this)}return ja(n,[{key:"__setupDefinitions",value:function(){this.__unique={position:"Point"},this.__heritable={componentSpacing:"Float",rotation:"Float",height:"Float",pillarDiameter:"Float",filterWidth:"Float",barrierWidth:"Float",filterLength:"Float",filterNumber:"Float",levelNumber:"Float",inletWidth:"Float",inletLength:"Float",outletWidth:"Float",outletLength:"Float",mirrorByX:"Float",mirrorByY:"Float"},this.__defaults={componentSpacing:2e3,rotation:0,height:250,pillarDiameter:2e3,filterWidth:1e3,barrierWidth:1e3,filterLength:3e3,filterNumber:5,levelNumber:2,inletWidth:1e3,inletLength:3e3,outletWidth:1e3,outletLength:3e3,mirrorByX:0,mirrorByY:0},this.__units={componentSpacing:"μm",rotation:"°",height:"μm",pillarDiameter:"μm",filterWidth:"μm",barrierWidth:"μm",filterLength:"μm",filterNumber:"",levelNumber:"",inletWidth:"μm",inletLength:"μm",outletWidth:"μm",outletLength:"μm"},this.__minimum={componentSpacing:0,rotation:0,height:10,pillarDiameter:1e3,filterWidth:500,barrierWidth:500,filterLength:2e3,filterNumber:2,levelNumber:1,inletWidth:500,inletLength:1e3,outletWidth:500,outletLength:1e3,mirrorByX:0,mirrorByY:0},this.__maximum={componentSpacing:1e4,rotation:360,height:1200,pillarDiameter:4e3,filterWidth:4e3,barrierWidth:6e3,filterLength:9e3,filterNumber:5,levelNumber:10,inletWidth:4e3,inletLength:8e3,outletWidth:4e3,outletLength:8e3,mirrorByX:1,mirrorByY:1},this.__placementTool="componentPositionTool",this.__toolParams={cursorPosition:"position"},this.__featureParams={componentSpacing:"componentSpacing",position:"position",rotation:"rotation",pillarDiameter:"pillarDiameter",filterWidth:"filterWidth",barrierWidth:"barrierWidth",filterLength:"filterLength",filterNumber:"filterNumber",levelNumber:"levelNumber",inletWidth:"inletWidth",inletLength:"inletLength",outletWidth:"outletWidth",outletLength:"outletLength",mirrorByX:"mirrorByX",mirrorByY:"mirrorByY"},this.__targetParams={componentSpacing:"componentSpacing",rotation:"rotation",pillarDiameter:"pillarDiameter",filterWidth:"filterWidth",barrierWidth:"barrierWidth",filterLength:"filterLength",filterNumber:"filterNumber",levelNumber:"levelNumber",inletWidth:"inletWidth",inletLength:"inletLength",outletWidth:"outletWidth",outletLength:"outletLength",mirrorByX:"mirrorByX",mirrorByY:"mirrorByY"},this.__renderKeys=["FLOW"],this.__mint="FILTER",this.__zOffsetKeys={FLOW:"height"},this.__substrateOffset={FLOW:"0"}}},{key:"getPorts",value:function(e){var t=e.inletLength,n=e.filterLength,r=e.outletLength,i=e.levelNumber,a=e.pillarDiameter,l=[];return l.push(new b(0,0,"1",o.FLOW)),l.push(new b(t+5*a+1.3*i*n+r,0,"2",o.FLOW)),l}},{key:"render2D",value:function(e,t){e.rotation;var n=e.position[0],r=e.position[1],o=e.color,i=e.pillarDiameter,a=e.filterWidth,l=e.barrierWidth,s=e.filterLength,c=e.filterNumber,u=e.levelNumber,h=e.inletWidth,f=e.inletLength,d=e.outletWidth,p=e.outletLength,m=new y.a.CompoundPath(""),v=c*a+(c-1)*l,g=new y.a.Point(n,r-h/2),w=new y.a.Point(n+f,r+h/2);m.addChild(new y.a.Path.Rectangle(g,w)),g=new y.a.Point(n+f,r-h/2);var b=new y.a.Point(n+f+2.5*i,r-v/2),_=new y.a.Point(n+f,r+h/2);w=new y.a.Point(n+f+2.5*i,r+v/2);var P=new y.a.Path;P.add(g),P.add(b),P.add(w),P.add(_);var C=new y.a.Path.Circle(new y.a.Point(n+f+1.5*i,r),i/2);P=P.subtract(C),m.addChild(P);for(var O=f+2.5*i,S=.3*s,D=0;D<u;D++){g=new y.a.Point(n+O,r-v/2),w=new y.a.Point(n+O+s+S,r+v/2);var R=new y.a.Path.Rectangle(g,w);if(D%2===0)for(var T=(v-(c-1)*l)/c,L=T,F=0;F<c-1;F++){g=new y.a.Point(n+O+S/2,r-v/2+L),L+=l,w=new y.a.Point(n+O+s,r-v/2+L);var k=new y.a.Path.Rectangle(g,w);R=R.subtract(k),L+=T}else for(var E=(v-(c-2)*l)/(c-1),N=E,x=0;x<c-2;x++){g=new y.a.Point(n+O+S/2,r-v/2+N),N+=l,w=new y.a.Point(n+O+s,r-v/2+N);var M=new y.a.Path.Rectangle(g,w);R=R.subtract(M),N+=E}m.addChild(R),O+=s+S}return g=new y.a.Point(n+O,r-v/2),b=new y.a.Point(n+O+2.5*i,r-d/2),w=new y.a.Point(n+O+2.5*i,r+d/2),_=new y.a.Point(n+O,r+v/2),P=new y.a.Path,P.add(g),P.add(b),P.add(w),P.add(_),O+=2.5*i,C=new y.a.Path.Circle(new y.a.Point(n+O-1.5*i,r),i/2),P=P.subtract(C),m.addChild(P),g=new y.a.Point(n+O,r-d/2),w=new y.a.Point(n+O+p,r+d/2),m.addChild(new y.a.Path.Rectangle(g,w)),this.transformRender(e,m),m.fillColor=o,m}},{key:"render2DTarget",value:function(e,t){null===e&&(e=this.__renderKeys[0]);var n=this.render2D(t,e);return n.fillColor.alpha=.5,n}}]),n}(R);function Ka(e){return Ka="function"===typeof Symbol&&"symbol"===typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"===typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Ka(e)}function qa(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Ja(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}
1function Za(e,t,n){return t&&Ja(e.prototype,t),n&&Ja(e,n),e}function $a(e,t){if("function"!==typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&Qa(e,t)}function Qa(e,t){return Qa=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},Qa(e,t)}function el(e){var t=rl();return function(){var n,r=ol(e);if(t){var o=ol(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return tl(this,n)}}function tl(e,t){if(t&&("object"===Ka(t)||"function"===typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return nl(e)}function nl(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function rl(){if("undefined"===typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"===typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}function ol(e){return ol=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},ol(e)}var il=function(e){$a(n,e);var t=el(n);function n(){return qa(this,n),t.call(this)}return Za(n,[{key:"__setupDefinitions",value:function(){this.__unique={position:"Point"},this.__heritable={componentSpacing:"Float",rotation:"Float",height:"Float",channelWidth:"Float",channelLength:"Float",chamberWidth:"Float",chamberLength:"Float",chamberHeight:"Float",mirrorByX:"Float",mirrorByY:"Float"},this.__defaults={componentSpacing:2e3,rotation:0,height:250,channelWidth:1e3,channelLength:4e3,chamberWidth:2500,chamberLength:2500,chamberHeight:250,mirrorByX:0,mirrorByY:0},this.__units={componentSpacing:"μm",rotation:"°",height:"μm",channelWidth:"μm",channelLength:"μm",chamberWidth:"μm",chamberLength:"μm",chamberHeight:"μm"},this.__minimum={componentSpacing:0,rotation:0,height:10,channelWidth:500,channelLength:2500,chamberWidth:1500,chamberLength:1500,chamberHeight:10,mirrorByX:0,mirrorByY:0},this.__maximum={componentSpacing:1e4,rotation:360,height:1200,channelWidth:2e3,channelLength:6e3,chamberWidth:4e3,chamberLength:4e3,chamberHeight:1200,mirrorByX:1,mirrorByY:1},this.__featureParams={componentSpacing:"componentSpacing",position:"position",rotation:"rotation",height:"height",channelWidth:"channelWidth",channelLength:"channelLength",chamberWidth:"chamberWidth",chamberLength:"chamberLength",chamberHeight:"chamberHeight",mirrorByX:"mirrorByX",mirrorByY:"mirrorByY"},this.__targetParams={componentSpacing:"componentSpacing",rotation:"rotation",height:"height",channelWidth:"channelWidth",channelLength:"channelLength",chamberWidth:"chamberWidth",chamberLength:"chamberLength",chamberHeight:"chamberHeight",mirrorByX:"mirrorByX",mirrorByY:"mirrorByY"},this.__placementTool="CellPositionTool",this.__toolParams={position:"position"},this.__renderKeys=["FLOW","CELL"],this.__mint="SQUARE CELL TRAP",this.__zOffsetKeys={FLOW:"height",CELL:"chamberHeight"},this.__substrateOffset={FLOW:"0",CELL:"0"}}},{key:"getPorts",value:function(e){var t=e.channelLength,n=[];return n.push(new b(-t/2,0,"1",o.FLOW)),n.push(new b(t/2,0,"2",o.FLOW)),n.push(new b(0,-t/2,"3",o.FLOW)),n.push(new b(0,t/2,"4",o.FLOW)),n}},{key:"render2D",value:function(e,t){if("FLOW"===t)return this.__drawFlow(e);if("CELL"===t)return this.__drawCell(e);throw new Error("Unknown key for celltrapS: "+t)}},{key:"render2DTarget",value:function(e,t){var n=this.__drawFlow(t);return n.addChild(this.__drawCell(t)),n.fillColor.alpha=.5,n}},{key:"__drawFlow",value:function(e){e.rotation;var t=e.position,n=e.color,r=t[0],o=t[1],i=e.channelWidth,a=e.channelLength,l=new y.a.CompoundPath(""),s=new y.a.Point(r-a/2,o-i/2),c=new y.a.Point(r+a/2,o+i/2);return l.addChild(new y.a.Path.Rectangle(s,c)),s=new y.a.Point(r-i/2,o-a/2),c=new y.a.Point(r+i/2,o+a/2),l.addChild(new y.a.Path.Rectangle(s,c)),l.fillColor=n,this.transformRender(e,l),l}},{key:"__drawCell",value:function(e){e.rotation;var t=e.color,n=e.position,r=n[0],o=n[1],i=e.chamberWidth,a=e.chamberLength,l=new y.a.CompoundPath(""),s=new y.a.Point(r-i/2,o-a/2),c=new y.a.Point(r+i/2,o+a/2);return l.addChild(new y.a.Path.Rectangle(s,c)),l.fillColor=t,this.transformRender(e,l),l}}]),n}(R);function al(e){return al="function"===typeof Symbol&&"symbol"===typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"===typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},al(e)}function ll(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function sl(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function cl(e,t,n){return t&&sl(e.prototype,t),n&&sl(e,n),e}function ul(e,t){if("function"!==typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&hl(e,t)}function hl(e,t){return hl=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},hl(e,t)}function fl(e){var t=yl();return function(){var n,r=ml(e);
1if(t){var o=ml(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return dl(this,n)}}function dl(e,t){if(t&&("object"===al(t)||"function"===typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return pl(e)}function pl(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function yl(){if("undefined"===typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"===typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}function ml(e){return ml=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},ml(e)}var vl=function(e){ul(n,e);var t=fl(n);function n(){return ll(this,n),t.call(this)}return cl(n,[{key:"__setupDefinitions",value:function(){this.__unique={position:"Point"},this.__heritable={componentSpacing:"Float",in:"Integer",out:"Integer",rotation:"Float",valveRadius:"Float",height:"Float",gap:"Float",width:"Float",length:"Float",valveSpacing:"Float",channelWidth:"Float",controlChannelWidth:"Float",mirrorByX:"Float",mirrorByY:"Float"},this.__defaults={componentSpacing:2e3,in:1,out:8,rotation:0,valveRadius:1200,height:800,gap:600,width:100,length:100,valveSpacing:600,channelWidth:500,controlChannelWidth:600,mirrorByX:0,mirrorByY:0},this.__units={componentSpacing:"μm",in:"",out:"",rotation:"°",valveRadius:"μm",height:"μm",gap:"μm",width:"μm",length:"μm",valveSpacing:"μm",channelWidth:"μm",controlChannelWidth:"μm"},this.__minimum={componentSpacing:0,in:1,out:2,rotation:0,valveRadius:10,height:10,gap:5,width:100,length:100,valveSpacing:100,channelWidth:25,controlChannelWidth:10,mirrorByX:0,mirrorByY:0},this.__maximum={componentSpacing:1e4,in:1,out:128,rotation:360,valveRadius:2e3,height:1200,gap:1e3,width:100,length:100,valveSpacing:1e3,channelWidth:25e3,controlChannelWidth:1e3,mirrorByX:1,mirrorByY:1},this.__featureParams={componentSpacing:"componentSpacing",in:"in",out:"out",position:"position",rotation:"rotation",radius1:"valveRadius",radius2:"valveRadius",valveRadius:"valveRadius",gap:"gap",width:"width",length:"length",valveSpacing:"valveSpacing",channelWidth:"channelWidth",controlChannelWidth:"controlChannelWidth",mirrorByX:"mirrorByX",mirrorByY:"mirrorByY"},this.__targetParams={componentSpacing:"componentSpacing",in:"in",out:"out",position:"position",rotation:"rotation",radius1:"valveRadius",radius2:"valveRadius",valveRadius:"valveRadius",gap:"gap",width:"width",length:"length",valveSpacing:"valveSpacing",channelWidth:"channelWidth",controlChannelWidth:"controlChannelWidth",mirrorByX:"mirrorByX",mirrorByY:"mirrorByY"},this.__placementTool="multilayerPositionTool",this.__toolParams={position:"position"},this.__renderKeys=["FLOW","CONTROL","INVERSE"],this.__mint="MUX3D",this.__zOffsetKeys={FLOW:"height",CONTROL:"height",INVERSE:"height"},this.__substrateOffset={FLOW:"0",CONTROL:"+1",INVERSE:"0"}}},{key:"render2D",value:function(e,t){if("FLOW"===t)return this.__drawFlow(e);if("CONTROL"===t)return this.__drawControl(e);if("INVERSE"===t)return this.__drawInverse(e);throw new Error("Unknown key threedmux: "+t)}},{key:"render2DTarget",value:function(e,t){var n=new y.a.CompoundPath(""),r=this.render2D(t,"FLOW"),o=this.render2D(t,"CONTROL");return n.addChild(o),n.addChild(r),n.fillColor=t.color,n.fillColor.alpha=.5,n}},{key:"getPorts",value:function(e){var t,n=e.in,r=e.out;e.channelWidth,e.rotation;n<r?t=r:t=n;for(var i=4e3*t,a=3e3*t,l=[],s=0;s<t;s++){var c=s*(i/(t-1));l.push(new b(c,0,(s+1).toString(),o.FLOW))}l.push(new b(i/2,a+1e3*t,(t+1).toString(),o.FLOW));for(var u=4e3*t,h=3e3*t,f=1e3*-t,d=u+1e3*t,p=Math.log(t)/Math.log(2),y=h/(2*p),m=t+2,v=0;v<2*p;v++)if(v%2===0){2;l.push(new b(f,y+v*h/(2*p+2),m.toString(),o.CONTROL)),console.log(m),m++}else l.push(new b(d,y+v*h/(2*p+2),m.toString(),o.CONTROL)),console.log(m),m++;return l}},{key:"__drawFlow",value:function(e){var t,n=e.position,r=e.gap,o=e.valveRadius,i=e.color,a=e.rotation,l=e.channelWidth,s=new y.a.CompoundPath(""),c=n[0],u=n[1],h=e.in,f=e.out;h<f?t=f:(t=h,a+=180);var d=4e3*t,p=3e3*t,m=new y.a.Point(c-l/2,u-l/2+p),v=new y.a.Point(c+d+l/2,u+l/2+p),g=new y.a.Path.Rectangle(m,v);s.addChild(g);for(var w=Math.log(t)/Math.log(2),b=p/(2*w),_=new Array(t),P=(new Array(t),0);P<t;P++){var C=P*(d/(t-1)),O=new y.a.Point(c+C-l/2,u+p),S=new y.a.Point(c+C+l/2,u);_[P]=new y.a.Path.Rectangle(O,S)}var D=new y.a.Point(c+d/2-l/2,u+p),R=new y.a.Point(c+d/2+l/2,u+p+1e3*t),T=new y.a.Path.Rectangle(D,R);s.addChild(T);for(var L=t,F=c,k=u+b,E=0;E<w;E++){var N=0,x=L/2;while(N<t){for(var M=0;M<L/2;M++){var I=F+(N+M)*d/(t-1),W=new y.a.Path.Rectangle({from:new y.a.Point(I-l/2,k-r/2),to:new y.a.Point(I+l/2,k+r/2)});this.__createthreedmuxValve(s,I,k,r,o,a,l),_[N+M]=_[N+M].subtract(W)}N+=2*x}var A=p/(2*w+2),j=0,B=L/2;k+=A;while(j<t){for(var V=0;V<L/2;V++){var X=F+d-(j+V)*d/(t-1),Y=new y.a.Path.Rectangle({from:new y.a.Point(X-l/2,k-r/2),to:new y.a.Point(X+l/2,k+r/2)});_[t-1-V-j]=_[t-1-V-j].subtract(Y),this.__createthreedmuxValve(s,X,k,r,o,a,l)}j+=B+L/2}k+=A,L/=2}for(var G=0;G<t;G++)s.addChild(_[G]);return s.fillColor=i,this.transformRender(e,s),s}},{key:"__createthreedmuxValve",value:function(e,t,n,r,o,i,a){var l=new y.a.Point(t,n),s=new y.a.Path.Circle(l,o),c=new y.a.Path.Rectangle({point:new y.a.Point(t-a/2,n-o),size:[a,o],stokeWidth:0});s=s.unite(c),c=new y.a.Path.Rectangle({point:new y.a.Point(t-a/2,n),size:[a,o],stokeWidth:0}),s=s.unite(c);var u=new y.a.Path.Rectangle({from:new y.a.Point(t-o,n-r/2),to:new y.a.Point(t+o,n+r/2)}),h=s.subtract(u);e.addChild(h)}},{key:"__drawControl",value:function(e){var t,n=e.position,r=e.valveRadius,o=e.color,
1i=(e.rotation,e.controlChannelWidth),a=new y.a.CompoundPath(""),l=n[0],s=n[1],c=e.in,u=e.out;c<u?t=u:t=c;for(var h=4e3*t,f=3e3*t,d=l-1e3*t,p=l+h+1e3*t,m=t,v=Math.log(t)/Math.log(2),g=f/(2*v),w=f/(2*v),b=0;b<2*v;b++)if(b%2===0){m/=2;var _=t-m-1,P=new y.a.Point(d,s+g+b*f/(2*v+2)-i/2),C=new y.a.Point(l+_*(h/(t-1)),s+g+b*f/(2*v+2)+i/2),O=new y.a.Path.Rectangle(P,C);a.addChild(O)}else{var S=m,D=new y.a.Point(l+S*(h/(t-1)),s+g+b*f/(2*v+2)-i/2),R=new y.a.Point(p,s+g+b*f/(2*v+2)+i/2),T=new y.a.Path.Rectangle(D,R);a.addChild(T)}for(var L=t,F=l,k=s+w,E=0;E<v;E++){var N=0,x=L/2;while(N<t){for(var M=0;M<L/2;M++){var I=F+(N+M)*h/(t-1),W=new y.a.Point(I,k),A=new y.a.Path.Circle(W,r);a.addChild(A)}N+=2*x}var j=f/(2*v+2),B=0,V=L/2;k+=j;while(B<t){for(var X=0;X<L/2;X++){var Y=F+h-(B+X)*h/(t-1),G=new y.a.Point(Y,k),U=new y.a.Path.Circle(G,r);a.addChild(U)}B+=V+L/2}k+=j,L/=2}return a.fillColor=o,this.transformRender(e,a),a}},{key:"__drawInverse",value:function(e){var t,n=e.position,r=e.valveRadius,o=e.color,i=(e.rotation,new y.a.CompoundPath("")),a=n[0],l=n[1],s=e.in,c=e.out;s<c?t=c:t=s;for(var u=4e3*t,h=3e3*t,f=Math.log(t)/Math.log(2),d=h/(2*f),p=t,m=a,v=l+d,g=0;g<f;g++){var w=0,b=p/2;while(w<t){for(var _=0;_<p/2;_++){var P=m+(w+_)*u/(t-1),C=new y.a.Point(P,v),O=new y.a.Path.Circle(C,r);i.addChild(O)}w+=2*b}var S=h/(2*f+2),D=0,R=p/2;v+=S;while(D<t){for(var T=0;T<p/2;T++){var L=m+u-(D+T)*u/(t-1),F=new y.a.Point(L,v),k=new y.a.Path.Circle(F,r);i.addChild(k)}D+=R+p/2}v+=S,p/=2}return i.fillColor=o,this.transformRender(e,i),i}}]),n}(R);function gl(e){return gl="function"===typeof Symbol&&"symbol"===typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"===typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},gl(e)}function wl(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function bl(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function _l(e,t,n){return t&&bl(e.prototype,t),n&&bl(e,n),e}function Pl(e,t){if("function"!==typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&Cl(e,t)}function Cl(e,t){return Cl=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},Cl(e,t)}function Ol(e){var t=Rl();return function(){var n,r=Tl(e);if(t){var o=Tl(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return Sl(this,n)}}function Sl(e,t){if(t&&("object"===gl(t)||"function"===typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return Dl(e)}function Dl(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Rl(){if("undefined"===typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"===typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}function Tl(e){return Tl=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},Tl(e)}var Ll=function(e){Pl(n,e);var t=Ol(n);function n(){return wl(this,n),t.call(this)}return _l(n,[{key:"__setupDefinitions",value:function(){this.__unique={position:"Point"},this.__heritable={componentSpacing:"Float",flowChannelWidth:"Float",controlChannelWidth:"Float",chemostatChannelWidth:"Float",radius:"Float",rotation:"Float",volume:"Float",height:"Float",mirrorByX:"Float",mirrorByY:"Float"},this.__defaults={componentSpacing:2e3,flowChannelWidth:100,controlChannelWidth:50,chemostatChannelWidth:100,radius:400,rotation:0,volume:3e7,height:20,mirrorByX:0,mirrorByY:0},this.__units={bendSpacing:"μm",numberOfBends:"",channelWidth:"μm",bendLength:"μm",componentSpacing:"μm",flowChannelWidth:"μm",controlChannelWidth:"μm",chemostatChannelWidth:"μm",radius:"μm",rotation:"°",volume:"μm3",height:"μm"},this.__minimum={componentSpacing:0,flowChannelWidth:100,controlChannelWidth:100,chemostatChannelWidth:200,radius:200,rotation:0,volume:8e7,height:200,mirrorByX:0,mirrorByY:0},this.__maximum={componentSpacing:1e4,flowChannelWidth:3e3,controlChannelWidth:1500,chemostatChannelWidth:5e3,radius:1e4,rotation:260,volume:2e12,height:1e4,mirrorByX:1,mirrorByY:1},this.__placementTool="multilayerPositionTool",this.__toolParams={cursorPosition:"position"}
1,this.__featureParams={position:"position",componentSpacing:"componentSpacing",flowChannelWidth:"flowChannelWidth",controlChannelWidth:"controlChannelWidth",chemostatChannelWidth:"chemostatChannelWidth",radius:"radius",rotation:"rotation",volume:"volume",height:"height",mirrorByX:"mirrorByX",mirrorByY:"mirrorByY"},this.__targetParams={componentSpacing:"componentSpacing",flowChannelWidth:"flowChannelWidth",controlChannelWidth:"controlChannelWidth",chemostatChannelWidth:"chemostatChannelWidth",radius:"radius",rotation:"rotation",volume:"volume",height:"height",mirrorByX:"mirrorByX",mirrorByY:"mirrorByY"},this.__renderKeys=["FLOW","CONTROL"],this.__mint="CHEMOSTAT RING",this.__zOffsetKeys={FLOW:"height",CONTROL:"height"},this.__substrateOffset={FLOW:"0",CONTROL:"+1"}}},{key:"getPorts",value:function(e){e.flowChannelWidth,e.controlChannelWidth;var t=e.chemostatChannelWidth,n=e.volume,r=e.height,i=e.radius,a=n/r,l=a/(4*t),s=l/10,c=-7*l/8,u=[];u.push(new b(-l/3-l/2,-l/3,"1",o.FLOW)),u.push(new b(-l/3-l/5,-l/3-l/3,"2",o.FLOW)),u.push(new b(-l/3+l/5,-l/3-l/3,"3",o.FLOW)),u.push(new b(-l/3+l/2,-l/3,"4",o.FLOW)),u.push(new b(-l/3-l/5-s-i,c,"5",o.CONTROL)),u.push(new b(-l/3-l/5+1.3*i,c,"6",o.CONTROL)),u.push(new b(-l/3-l/5+1.7*i,c,"7",o.CONTROL)),u.push(new b(-l/3+l/5-s-i,c,"8",o.CONTROL)),u.push(new b(-l/3+l/5+1.3*i,c,"9",o.CONTROL)),u.push(new b(-l/3+l/5+1.7*i,c,"10",o.CONTROL));var h=t/2+3*l/7,f=t/2;return u.push(new b(h-s-.5*i,c,"11",o.CONTROL)),u.push(new b(h+1.3*i,c,"12",o.CONTROL)),u.push(new b(h+1.7*i,c,"13",o.CONTROL)),h=5*l/6,f=t/2,u.push(new b(h-s-.5*i,c,"14",o.CONTROL)),u.push(new b(h+1.3*i,c,"15",o.CONTROL)),u.push(new b(h+1.7*i,c,"16",o.CONTROL)),h=t/2,f=l/5,u.push(new b(c,f-s-.5*i,"17",o.CONTROL)),u.push(new b(c,f+1.3*i,"18",o.CONTROL)),u.push(new b(c,f+1.7*i,"19",o.CONTROL)),h=t/2,f=l/5+l/2,u.push(new b(c,f-s-.5*i,"20",o.CONTROL)),u.push(new b(c,f+1.3*i,"21",o.CONTROL)),u.push(new b(c,f+1.7*i,"22",o.CONTROL)),h=t/2+l,f=t/2+2*l/5,u.push(new b(2*l,f-s-.5*i,"23",o.CONTROL)),u.push(new b(2*l,f+1.3*i,"24",o.CONTROL)),u.push(new b(2*l,f+1.7*i,"25",o.CONTROL)),h=t/2+l,f=t/2+4*l/5,u.push(new b(2*l,f-s-.5*i,"26",o.CONTROL)),u.push(new b(2*l,f+1.3*i,"27",o.CONTROL)),u.push(new b(2*l,f+1.7*i,"28",o.CONTROL)),h=t/2+l/4,f=l+t/2,u.push(new b(h-.3*s,2*l,"29",o.CONTROL)),u.push(new b(h+.5*s,2*l,"30",o.CONTROL)),u.push(new b(h+.4*s+.3*s,2*l,"31",o.CONTROL)),h=t/2+3*l/7,f=l+t/2,u.push(new b(h-.3*s,2*l,"32",o.CONTROL)),u.push(new b(h-.5*s,2*l,"33",o.CONTROL)),u.push(new b(h+.3*s,2*l,"34",o.CONTROL)),u.push(new b(h+.55*s,2*l,"35",o.CONTROL)),u.push(new b(h+.85*s,2*l,"36",o.CONTROL)),u.push(new b(h+1.15*s,2*l,"37",o.CONTROL)),h=t/2+3*l/5,f=l+t/2,u.push(new b(h-.3*s,2*l,"38",o.CONTROL)),u.push(new b(h+.5*s,2*l,"49",o.CONTROL)),u.push(new b(h+.4*s+.3*s,2*l,"40",o.CONTROL)),u}},{key:"render2D",value:function(e,t){if("FLOW"===t)return this.__drawFlow(e);if("CONTROL"===t)return this.__drawControl(e);throw new Error("Unknown key for computing chemostat ring: "+t)}},{key:"__drawFlow",value:function(e){var t=e.position[0],n=e.position[1],r=e.flowChannelWidth,o=(e.controlChannelWidth,e.chemostatChannelWidth),i=e.volume,a=e.height,l=e.radius,s=(e.rotation,e.color),c=new y.a.CompoundPath(""),u=i/a,h=u/(4*o),f=new y.a.Point(t+o,n),d=new y.a.Point(t+o+h,n+o);c.addChild(new y.a.Path.Rectangle(f,d)),f=new y.a.Point(t+h,n+o),d=new y.a.Point(t+o+h,n+o+h),c.addChild(new y.a.Path.Rectangle(f,d)),f=new y.a.Point(t,n+h),d=new y.a.Point(t+h,n+h+o),c.addChild(new y.a.Path.Rectangle(f,d)),f=new y.a.Point(t,n),d=new y.a.Point(t+o,n+h),c.addChild(new y.a.Path.Rectangle(f,d)),f=new y.a.Point(t+o/2+h/4-r/2,n+o/2),d=new y.a.Point(t+o/2+h/4+r/2,n+o/2+2*h/5),c.addChild(new y.a.Path.Rectangle(f,d)),f=new y.a.Point(t+o/2+3*h/5-r/2,n+o/2),d=new y.a.Point(t+o/2+3*h/5+r/2,n+o/2+2*h/5),c.addChild(new y.a.Path.Rectangle(f,d)),f=new y.a.Point(t+o/2+3*h/5,n+o/2+h/5-r/2),d=new y.a.Point(t+o/2+h,n+o/2+h/5+r/2),c.addChild(new y.a.Path.Rectangle(f,d)),f=new y.a.Point(t+o/2,n+o/2+2*h/5-r/2),d=new y.a.Point(t+o/2+3*h/5,n+o/2+2*h/5+r/2),c.addChild(new y.a.Path.Rectangle(f,d)),f=new y.a.Point(t+o/2,n+o/2+4*h/5-r/2),d=new y.a.Point(t+o/2+h/4,n+o/2+4*h/5+r/2),c.addChild(new y.a.Path.Rectangle(f,d)),f=new y.a.Point(t+o/2+h/4-r/2,n+o/2+h/2),d=new y.a.Point(t+o/2+h/4+r/2,n+o/2+4*h/5+r/2),c.addChild(new y.a.Path.Rectangle(f,d)),f=new y.a.Point(t+o/2+h/4-r/2,n+o/2+h/2-r/2),d=new y.a.Point(t+o/2+5*h/7,n+o/2+h/2+r/2),c.addChild(new y.a.Path.Rectangle(f,d));var p=new y.a.Point(t+o/2+5*h/7,n+o/2+h/2),m=new y.a.Path.Circle(p,l);c.addChild(m);var v=Math.abs(5*h/7-3*h/5),g=Math.abs(o/2+h/2-(o/2+2*h/5)),w=Math.sqrt(Math.pow(v,2)+Math.pow(g,2)),b=180*Math.asin(g/w)/Math.PI;return f=new y.a.Point(t+o/2+3*h/5-r/2,n+o/2+2*h/5-r/2),d=new y.a.Point(t+o/2+3*h/5-r/2+w,n+o/2+2*h/5+r/2),c.addChild(new y.a.Path.Rectangle(f,d).rotate(b,new y.a.Point(t+o/2+3*h/5,n+o/2+2*h/5))),f=new y.a.Point(t+o/2+5*h/7-r/2,n+o/2+h/2),d=new y.a.Point(t+o/2+5*h/7+r/2,n+o/2+7*h/11),c.addChild(new y.a.Path.Rectangle(f,d)),f=new y.a.Point(t+o/2+5*h/7-r/2,n+o/2+7*h/11-r/2),d=new y.a.Point(t+h,n+o/2+7*h/11+r/2),c.addChild(new y.a.Path.Rectangle(f,d)),f=new y.a.Point(t+5*h/6-r/2,n+o/2+7*h/11),d=new y.a.Point(t+5*h/6+r/2,n+o/2+h),c.addChild(new y.a.Path.Rectangle(f,d)),f=new y.a.Point(t+o/2+3*h/7-r/2,n+o/2+4*h/6),d=new y.a.Point(t+o/2+3*h/7+r/2,n+o/2+h),c.addChild(new y.a.Path.Rectangle(f,d)),p=new y.a.Point(t+o/2+3*h/7,n+o/2+4*h/6),c.addChild(new y.a.Path.Circle(p,l)),f=new y.a.Point(t-h/3,n+h/5-r/2),d=new y.a.Point(t,n+h/5+r/2),c.addChild(new y.a.Path.Rectangle(f,d)),f=new y.a.Point(t-h/3-r/2,n-h/3),d=new y.a.Point(t-h/3+r/2,n+h/5+r/2),c.addChild(new y.a.Path.Rectangle(f,d)),f=new y.a.Point(t-h/3-h/2,n-h/3-r/2),d=new y.a.Point(t-h/3+h/2,n-h/3+r/2),c.addChild(new y.a.Path.Rectangle(f,d)),f=new y.a.Point(t-h/3-h/5-r/2,n-h/3-h/3),d=new y.a.Point(t-h/3-h/5+r/2,n-h/3),c.addChild(new y.a.Path.Rectangle(f,d)),f=new y.a.Point(t-h/3+h/5-r/2,n-h/3-h/3),d=new y.a.Point(t-h/3+h/5+r/2,n-h/3),c.addChild(new y.a.Path.Rectangle(f,d)),f=new y.a.Point(t-h/5-r/2,n+h/5),d=new y.a.Point(t-h/5+r/2,n+h+o+h/5),c.addChild(new y.a.Path.Rectangle(f,d)),f=new y.a.Point(t-h/5,n+h/5+h/2-r/2),d=new y.a.Point(t,n+h/5+h/2+r/2),c.addChild(new y.a.Path.Rectangle(f,d)),f=new y.a.Point(t-h/5-r/2,n+h+o+h/5-r/2),d=new y.a.Point(t+o/2+3*h/5,n+h+o+h/5+r/2),c.addChild(new y.a.Path.Rectangle(f,d)),f=new y.a.Point(t+o/2+h/4-r/2,n+h+o/2),d=new y.a.Point(t+o/2+h/4+r/2,n+h+o+h/5),c.addChild(new y.a.Path.Rectangle(f,d)),f=new y.a.Point(t+o/2+3*h/5-r/2,n+h+o/2),d=new y.a.Point(t+o/2+3*h/5+r/2,n+h+o+2*h/5),c.addChild(new y.a.Path.Rectangle(f,d)),f=new y.a.Point(t+o/2+3*h/5-r/2,n+h+o+2*h/5-r/2),d=new y.a.Point(t+o+h+2*h/5,n+h+o+2*h/5+r/2),c.addChild(new y.a.Path.Rectangle(f,d)),f=new y.a.Point(t+o+h+2*h/5-r/2,n+o/2+7*h/11),d=new y.a.Point(t+o+h+2*h/5+r/2,n+h+o+2*h/5+r/2),c.addChild(new y.a.Path.Rectangle(f,d)),p=new y.a.Point(t+o+h+2*h/5,n+o/2+7*h/11-l),c.addChild(new y.a.Path.Circle(p,l)),f=new y.a.Point(t+o+h+h/5,n+h+o+h/5-r/2),d=new y.a.Point(t+o+h+2*h/5,n+h+o+h/5+r/2),c.addChild(new y.a.Path.Rectangle(f,d)),f=new y.a.Point(t+o+h+h/5-r/2,n-h/5),d=new y.a.Point(t+o+h+h/5+r/2,n+h+o+h/5+r/2),c.addChild(new y.a.Path.Rectangle(f,d)),f=new y.a.Point(t+o/2+h,n+o/2+4*h/5-r/2),d=new y.a.Point(t+o+h+h/5,n+o/2+4*h/5+r/2),c.addChild(new y.a.Path.Rectangle(f,d)),f=new y.a.Point(t+o/2+h,n+o/2+2*h/5-r/2),d=new y.a.Point(t+o+h+h/5,n+o/2+2*h/5+r/2),c.addChild(new y.a.Path.Rectangle(f,d)),f=new y.a.Point(t+o/2+3*h/7,n-h/5-r/2),d=new y.a.Point(t+o+h+h/5+r/2,n-h/5+r/2),c.addChild(new y.a.Path.Rectangle(f,d)),f=new y.a.Point(t+o/2+3*h/7-r/2,n-h/5-r/2),d=new y.a.Point(t+o/2+3*h/7+r/2,n),c.addChild(new y.a.Path.Rectangle(f,d)),f=new y.a.Point(t+5*h/6-r/2,n-h/5),d=new y.a.Point(t+5*h/6+r/2,n),c.addChild(new y.a.Path.Rectangle(f,d)),c.fillColor=s,this.transformRender(e,c),c}},{key:"__drawControl",value:function(e){var t=e.position[0],n=e.position[1],r=(e.flowChannelWidth,e.controlChannelWidth),o=e.chemostatChannelWidth,i=e.volume,a=e.height,l=e.radiu
1s,s=(e.rotation,e.color),c=i/a,u=c/(4*o),h=new y.a.CompoundPath(""),f=1.5*o,d=2*r,p=u/10,m=-7*u/8,v=u/15,g=new y.a.Point(t-u/3-u/5-r/2-p-l,n+m),w=new y.a.Point(t-u/3-u/5+r/2-p-l,n-u/3-v);h.addChild(new y.a.Path.Rectangle(g,w)),g=new y.a.Point(t-u/3-u/5-r/2-p-l,n-u/3-v-r/2),w=new y.a.Point(t-u/3-u/5-p,n-u/3-v+r/2),h.addChild(new y.a.Path.Rectangle(g,w)),g=new y.a.Point(t-u/3-u/5-p-r/2,n-u/3-v-r/2),w=new y.a.Point(t-u/3-u/5-p+r/2,n-u/3),h.addChild(new y.a.Path.Rectangle(g,w)),g=new y.a.Point(t-u/3-u/5-p-d/2,n-u/3-f/2),w=new y.a.Point(t-u/3-u/5-p+d/2,n-u/3+f/2),h.addChild(new y.a.Path.Rectangle(g,w)),g=new y.a.Point(t-u/3-u/5-f/2,n-u/3-p-d/2),w=new y.a.Point(t-u/3-u/5+f/2,n-u/3-p+d/2),h.addChild(new y.a.Path.Rectangle(g,w)),g=new y.a.Point(t-u/3-u/5,n-u/3-p-r/2),w=new y.a.Point(t-u/3-u/5+1.3*l,n-u/3-p+r/2),h.addChild(new y.a.Path.Rectangle(g,w)),g=new y.a.Point(t-u/3-u/5+1.3*l-r/2,n+m),w=new y.a.Point(t-u/3-u/5+1.3*l+r/2,n-u/3-p+r/2),h.addChild(new y.a.Path.Rectangle(g,w)),g=new y.a.Point(t-u/3-u/5+p-d/2,n-u/3-f/2),w=new y.a.Point(t-u/3-u/5+p+d/2,n-u/3+f/2),h.addChild(new y.a.Path.Rectangle(g,w)),g=new y.a.Point(t-u/3-u/5+p-r/2,n-u/3-v),w=new y.a.Point(t-u/3-u/5+p+r/2,n-u/3),h.addChild(new y.a.Path.Rectangle(g,w)),g=new y.a.Point(t-u/3-u/5+p-r/2,n-u/3-v-r/2),w=new y.a.Point(t-u/3-u/5+1.7*l,n-u/3-v+r/2),h.addChild(new y.a.Path.Rectangle(g,w)),g=new y.a.Point(t-u/3-u/5+1.7*l-r/2,n+m),w=new y.a.Point(t-u/3-u/5+1.7*l+r/2,n-u/3-v+r/2),h.addChild(new y.a.Path.Rectangle(g,w)),g=new y.a.Point(t-u/3+u/5-r/2-p-l,n+m),w=new y.a.Point(t-u/3+u/5+r/2-p-l,n-u/3-v),h.addChild(new y.a.Path.Rectangle(g,w)),g=new y.a.Point(t-u/3+u/5-r/2-p-l,n-u/3-v-r/2),w=new y.a.Point(t-u/3+u/5-p,n-u/3-v+r/2),h.addChild(new y.a.Path.Rectangle(g,w)),g=new y.a.Point(t-u/3+u/5-p-r/2,n-u/3-v-r/2),w=new y.a.Point(t-u/3+u/5-p+r/2,n-u/3),h.addChild(new y.a.Path.Rectangle(g,w)),g=new y.a.Point(t-u/3+u/5-p-d/2,n-u/3-f/2),w=new y.a.Point(t-u/3+u/5-p+d/2,n-u/3+f/2),h.addChild(new y.a.Path.Rectangle(g,w)),g=new y.a.Point(t-u/3+u/5-f/2,n-u/3-p-d/2),w=new y.a.Point(t-u/3+u/5+f/2,n-u/3-p+d/2),h.addChild(new y.a.Path.Rectangle(g,w)),g=new y.a.Point(t-u/3+u/5,n-u/3-p-r/2),w=new y.a.Point(t-u/3+u/5+1.3*l,n-u/3-p+r/2),h.addChild(new y.a.Path.Rectangle(g,w)),g=new y.a.Point(t-u/3+u/5+1.3*l-r/2,n+m),w=new y.a.Point(t-u/3+u/5+1.3*l+r/2,n-u/3-p+r/2),h.addChild(new y.a.Path.Rectangle(g,w)),g=new y.a.Point(t-u/3+u/5+p-d/2,n-u/3-f/2),w=new y.a.Point(t-u/3+u/5+p+d/2,n-u/3+f/2),h.addChild(new y.a.Path.Rectangle(g,w)),g=new y.a.Point(t-u/3+u/5+p-r/2,n-u/3-v),w=new y.a.Point(t-u/3+u/5+p+r/2,n-u/3),h.addChild(new y.a.Path.Rectangle(g,w)),g=new y.a.Point(t-u/3+u/5+p-r/2,n-u/3-v-r/2),w=new y.a.Point(t-u/3+u/5+1.7*l,n-u/3-v+r/2),h.addChild(new y.a.Path.Rectangle(g,w)),g=new y.a.Point(t-u/3+u/5+1.7*l-r/2,n+m),w=new y.a.Point(t-u/3+u/5+1.7*l+r/2,n-u/3-v+r/2),h.addChild(new y.a.Path.Rectangle(g,w));var b=o/2+3*u/7,_=o/2;return g=new y.a.Point(t+b-r/2-p-.5*l,n+m),w=new y.a.Point(t+b+r/2-p-.5*l,n+_-v),h.addChild(new y.a.Path.Rectangle(g,w)),g=new y.a.Point(t+b-r/2-p-.5*l,n+_-v-r/2),w=new y.a.Point(t+b-p,n+_-v+r/2),h.addChild(new y.a.Path.Rectangle(g,w)),g=new y.a.Point(t+b-p-r/2,n+_-v-r/2),w=new y.a.Point(t+b-p+r/2,n+_),h.addChild(new y.a.Path.Rectangle(g,w)),g=new y.a.Point(t+b-p-d/2,n+_-f/2),w=new y.a.Point(t+b-p+d/2,n+_+f/2),h.addChild(new y.a.Path.Rectangle(g,w)),g=new y.a.Point(t+b-f/2,n+_-p-d/2),w=new y.a.Point(t+b+f/2,n+_-p+d/2),h.addChild(new y.a.Path.Rectangle(g,w)),g=new y.a.Point(t+b,n+_-p-r/2),w=new y.a.Point(t+b+1.3*l,n+_-p+r/2),h.addChild(new y.a.Path.Rectangle(g,w)),g=new y.a.Point(t+b+1.3*l-r/2,n+m),w=new y.a.Point(t+b+1.3*l+r/2,n+_-p+r/2),h.addChild(new y.a.Path.Rectangle(g,w)),g=new y.a.Point(t+b+p-d/2,n+_-f/2),w=new y.a.Point(t+b+p+d/2,n+_+f/2),h.addChild(new y.a.Path.Rectangle(g,w)),g=new y.a.Point(t+b+p-r/2,n+_-v),w=new y.a.Point(t+b+p+r/2,n+_),h.addChild(new y.a.Path.Rectangle(g,w)),g=new y.a.Point(t+b+p-r/2,n+_-v-r/2),w=new y.a.Point(t+b+1.7*l,n+_-v+r/2),h.addChild(new y.a.Path.Rectangle(g,w)),g=new y.a.Point(t+b+1.7*l-r/2,n+m),w=new y.a.Point(t+b+1.7*l+r/2,n+_-v+r/2),h.addChild(new y.a.Path.Rectangle(g,w)),b=5*u/6,_=o/2,g=new y.a.Point(t+b-r/2-p-.5*l,n+m),w=new y.a.Point(t+b+r/2-p-.5*l,n+_-v),h.addChild(new y.a.Path.Rectangle(g,w)),g=new y.a.Point(t+b-r/2-p-.5*l,n+_-v-r/2),w=new y.a.Point(t+b-p,n+_-v+r/2),h.addChild(new y.a.Path.Rectangle(g,w)),g=new y.a.Point(t+b-p-r/2,n+_-v-r/2),w=new y.a.Point(t+b-p+r/2,n+_),h.addChild(new y.a.Path.Rectangle(g,w)),g=new y.a.Point(t+b-p-d/2,n+_-f/2),w=new y.a.Point(t+b-p+d/2,n+_+f/2),h.addChild(new y.a.Path.Rectangle(g,w)),g=new y.a.Point(t+b-f/2,n+_-p-d/2),w=new y.a.Point(t+b+f/2,n+_-p+d/2),h.addChild(new y.a.Path.Rectangle(g,w)),g=new y.a.Point(t+b,n+_-p-r/2),w=new y.a.Point(t+b+1.3*l,n+_-p+r/2),h.addChild(new y.a.Path.Rectangle(g,w)),g=new y.a.Point(t+b+1.3*l-r/2,n+m),w=new y.a.Point(t+b+1.3*l+r/2,n+_-p+r/2),h.addChild(new y.a.Path.Rectangle(g,w)),g=new y.a.Point(t+b+p-d/2,n+_-f/2),w=new y.a.Point(t+b+p+d/2,n+_+f/2),h.addChild(new y.a.Path.Rectangle(g,w)),g=new y.a.Point(t+b+p-r/2,n+_-v),w=new y.a.Point(t+b+p+r/2,n+_),h.addChild(new y.a.Path.Rectangle(g,w)),g=new y.a.Point(t+b+p-r/2,n+_-v-r/2),w=new y.a.Point(t+b+1.7*l,n+_-v+r/2),h.addChild(new y.a.Path.Rectangle(g,w)),g=new y.a.Point(t+b+1.7*l-r/2,n+m),w=new y.a.Point(t+b+1.7*l+r/2,n+_-v+r/2),h.addChild(new y.a.Path.Rectangle(g,w)),b=o
1/2,_=u/5,g=new y.a.Point(t+b-f/2,n+_-p-d/2),w=new y.a.Point(t+b+f/2,n+_-p+d/2),h.addChild(new y.a.Path.Rectangle(g,w)),g=new y.a.Point(t+b-v-r/2,n+_-p-r/2),w=new y.a.Point(t+b,n+_-p+r/2),h.addChild(new y.a.Path.Rectangle(g,w)),g=new y.a.Point(t+b-v-r/2,n+_-r/2-p-.5*l),w=new y.a.Point(t+b-v+r/2,n+_-p),h.addChild(new y.a.Path.Rectangle(g,w)),g=new y.a.Point(t+m,n+_-r/2-p-.5*l),w=new y.a.Point(t+b-v,n+_+r/2-p-.5*l),h.addChild(new y.a.Path.Rectangle(g,w)),g=new y.a.Point(t+b-p-d/2,n+_-f/2),w=new y.a.Point(t+b-p+d/2,n+_+f/2),h.addChild(new y.a.Path.Rectangle(g,w)),g=new y.a.Point(t+b-p-r/2,n+_),w=new y.a.Point(t+b-p+r/2,n+_+1.3*l),h.addChild(new y.a.Path.Rectangle(g,w)),g=new y.a.Point(t+m,n+_+1.3*l-r/2),w=new y.a.Point(t+b-p+r/2,n+_+1.3*l+r/2),h.addChild(new y.a.Path.Rectangle(g,w)),g=new y.a.Point(t+b-f/2,n+_+p-d/2),w=new y.a.Point(t+b+f/2,n+_+p+d/2),h.addChild(new y.a.Path.Rectangle(g,w)),g=new y.a.Point(t+b-v,n+_+p-r/2),w=new y.a.Point(t+b,n+_+p+r/2),h.addChild(new y.a.Path.Rectangle(g,w)),g=new y.a.Point(t+b-v-r/2,n+_+p-r/2),w=new y.a.Point(t+b-v+r/2,n+_+1.7*l),h.addChild(new y.a.Path.Rectangle(g,w)),g=new y.a.Point(t+m,n+_+1.7*l-r/2),w=new y.a.Point(t+b-v+r/2,n+_+1.7*l+r/2),h.addChild(new y.a.Path.Rectangle(g,w)),b=o/2,_=u/5+u/2,g=new y.a.Point(t+b-f/2,n+_-p-d/2),w=new y.a.Point(t+b+f/2,n+_-p+d/2),h.addChild(new y.a.Path.Rectangle(g,w)),g=new y.a.Point(t+b-v-r/2,n+_-p-r/2),w=new y.a.Point(t+b,n+_-p+r/2),h.addChild(new y.a.Path.Rectangle(g,w)),g=new y.a.Point(t+b-v-r/2,n+_-r/2-p-.5*l),w=new y.a.Point(t+b-v+r/2,n+_-p),h.addChild(new y.a.Path.Rectangle(g,w)),g=new y.a.Point(t+m,n+_-r/2-p-.5*l),w=new y.a.Point(t+b-v,n+_+r/2-p-.5*l),h.addChild(new y.a.Path.Rectangle(g,w)),g=new y.a.Point(t+b-p-d/2,n+_-f/2),w=new y.a.Point(t+b-p+d/2,n+_+f/2),h.addChild(new y.a.Path.Rectangle(g,w)),g=new y.a.Point(t+b-p-r/2,n+_),w=new y.a.Point(t+b-p+r/2,n+_+1.3*l),h.addChild(new y.a.Path.Rectangle(g,w)),g=new y.a.Point(t+m,n+_+1.3*l-r/2),w=new y.a.Point(t+b-p+r/2,n+_+1.3*l+r/2),h.addChild(new y.a.Path.Rectangle(g,w)),g=new y.a.Point(t+b-f/2,n+_+p-d/2),w=new y.a.Point(t+b+f/2,n+_+p+d/2),h.addChild(new y.a.Path.Rectangle(g,w)),g=new y.a.Point(t+b-v,n+_+p-r/2),w=new y.a.Point(t+b,n+_+p+r/2),h.addChild(new y.a.Path.Rectangle(g,w)),g=new y.a.Point(t+b-v-r/2,n+_+p-r/2),w=new y.a.Point(t+b-v+r/2,n+_+1.7*l),h.addChild(new y.a.Path.Rectangle(g,w)),g=new y.a.Point(t+m,n+_+1.7*l-r/2),w=new y.a.Point(t+b-v+r/2,n+_+1.7*l+r/2),h.addChild(new y.a.Path.Rectangle(g,w)),b=o/2+u,_=o/2+2*u/5,g=new y.a.Point(t+b-f/2,n+_-p-d/2),w=new y.a.Point(t+b+f/2,n+_-p+d/2),h.addChild(new y.a.Path.Rectangle(g,w)),g=new y.a.Point(t+b+v-r/2,n+_-p-r/2),w=new y.a.Point(t+b,n+_-p+r/2),h.addChild(new y.a.Path.Rectangle(g,w)),g=new y.a.Point(t+b+v-r/2,n+_-r/2-p-.5*l),w=new y.a.Point(t+b+v+r/2,n+_-p+r/2),h.addChild(new y.a.Path.Rectangle(g,w)),g=new y.a.Point(t+2*u,n+_-r/2-p-.5*l),w=new y.a.Point(t+b+v,n+_+r/2-p-.5*l),h.addChild(new y.a.Path.Rectangle(g,w)),g=new y.a.Point(t+b+p-d/2,n+_-f/2),w=new y.a.Point(t+b+p+d/2,n+_+f/2),h.addChild(new y.a.Path.Rectangle(g,w)),g=new y.a.Point(t+b+p-r/2,n+_),w=new y.a.Point(t+b+p+r/2,n+_+1.3*l),h.addChild(new y.a.Path.Rectangle(g,w)),g=new y.a.Point(t+2*u,n+_+1.3*l-r/2),w=new y.a.Point(t+b+p-r/2,n+_+1.3*l+r/2),h.addChild(new y.a.Path.Rectangle(g,w)),g=new y.a.Point(t+b-f/2,n+_+p-d/2),w=new y.a.Point(t+b+f/2,n+_+p+d/2),h.addChild(new y.a.Path.Rectangle(g,w)),g=new y.a.Point(t+b+v,n+_+p-r/2),w=new y.a.Point(t+b,n+_+p+r/2),h.addChild(new y.a.Path.Rectangle(g,w)),g=new y.a.Point(t+b+v-r/2,n+_+p-r/2),w=new y.a.Point(t+b+v+r/2,n+_+1.7*l),h.addChild(new y.a.Path.Rectangle(g,w)),g=new y.a.Point(t+2*u,n+_+1.7*l-r/2),w=new y.a.Point(t+b+v-r/2,n+_+1.7*l+r/2),h.addChild(new y.a.Path.Rectangle(g,w)),b=o/2+u,_=o/2+4*u/5,g=new y.a.Point(t+b-f/2,n+_-p-d/2),w=new y.a.Point(t+b+f/2,n+_-p+d/2),h.addChild(new y.a.Path.Rectangle(g,w)),g=new y.a.Point(t+b+v-r/2,n+_-p-r/2),w=new y.a.Point(t+b,n+_-p+r/2),h.addChild(new y.a.Path.Rectangle(g,w)),g=new y.a.Point(t+b+v-r/2,n+_-r/2-p-.5*l),w=new y.a.Point(t+b+v+r/2,n+_-p+r/2),h.addChild(new y.a.Path.Rectangle(g,w)),g=new y.a.Point(t+2*u,n+_-r/2-p-.5*l),w=new y.a.Point(t+b+v,n+_+r/2-p-.5*l),h.addChild(new y.a.Path.Rectangle(g,w)),g=new y.a.Point(t+b+p-d/2,n+_-f/2),w=new y.a.Point(t+b+p+d/2,n+_+f/2),h.addChild(new y.a.Path.Rectangle(g,w)),g=new y.a.Point(t+b+p-r/2,n+_),w=new y.a.Point(t+b+p+r/2,n+_+1.3*l),h.addChild(new y.a.Path.Rectangle(g,w)),g=new y.a.Point(t+2*u,n+_+1.3*l-r/2),w=new y.a.Point(t+b+p-r/2,n+_+1.3*l+r/2),h.addChild(new y.a.Path.Rectangle(g,w)),g=new y.a.Point(t+b-f/2,n+_+p-d/2),w=new y.a.Point(t+b+f/2,n+_+p+d/2),h.addChild(new y.a.Path.Rectangle(g,w)),g=new y.a.Point(t+b+v,n+_+p-r/2),w=new y.a.Point(t+b,n+_+p+r/2),h.addChild(new y.a.Path.Rectangle(g,w)),g=new y.a.Point(t+b+v-r/2,n+_+p-r/2),w=new y.a.Point(t+b+v+r/2,n+_+1.7*l),h.addChild(new y.a.Path.Rectangle(g,w)),g=new y.a.Point(t+2*u,n+_+1.7*l-r/2),w=new y.a.Point(t+b+v-r/2,n+_+1.7*l+r/2),h.addChild(new y.a.Path.Rectangle(g,w)),b=o
1/2+u/4,_=u+o/2,g=new y.a.Point(t+b-.3*p-d/2,n+_-f/2),w=new y.a.Point(t+b-.3*p+d/2,n+_+f/2),h.addChild(new y.a.Path.Rectangle(g,w)),g=new y.a.Point(t+b-r/2-.3*p,n+_),w=new y.a.Point(t+b+r/2-.3*p,n+2*u),h.addChild(new y.a.Path.Rectangle(g,w)),g=new y.a.Point(t+b-f/2,n+_+p-d/2),w=new y.a.Point(t+b+f/2,n+_+p+d/2),h.addChild(new y.a.Path.Rectangle(g,w)),g=new y.a.Point(t+b,n+_+p-r/2),w=new y.a.Point(t+b+.5*p,n+_+p+r/2),h.addChild(new y.a.Path.Rectangle(g,w)),g=new y.a.Point(t+b+.5*p-r/2,n+_+p-r/2),w=new y.a.Point(t+b+.5*p+r/2,n+2*u),h.addChild(new y.a.Path.Rectangle(g,w)),g=new y.a.Point(t+b+.3*p-d/2,n+_-f/2),w=new y.a.Point(t+b+.3*p+d/2,n+_+f/2),h.addChild(new y.a.Path.Rectangle(g,w)),g=new y.a.Point(t+b+.3*p-r/2,n+_),w=new y.a.Point(t+b+.3*p+r/2,n+_+v),h.addChild(new y.a.Path.Rectangle(g,w)),g=new y.a.Point(t+b+.3*p-r/2,n+_+v-r/2),w=new y.a.Point(t+b+.3*p+.4*p,n+_+v+r/2),h.addChild(new y.a.Path.Rectangle(g,w)),g=new y.a.Point(t+b-r/2+.4*p+.3*p,n+_-r/2+v),w=new y.a.Point(t+b+r/2+.4*p+.3*p,n+2*u),h.addChild(new y.a.Path.Rectangle(g,w)),b=o/2+3*u/7,_=u+o/2,g=new y.a.Point(t+b-.3*p-d/2,n+_-f/2),w=new y.a.Point(t+b-.3*p+d/2,n+_+f/2),h.addChild(new y.a.Path.Rectangle(g,w)),g=new y.a.Point(t+b-r/2-.3*p,n+_),w=new y.a.Point(t+b+r/2-.3*p,n+2*u),h.addChild(new y.a.Path.Rectangle(g,w)),g=new y.a.Point(t+b-f/2,n+_-p-d/2),w=new y.a.Point(t+b+f/2,n+_-p+d/2),h.addChild(new y.a.Path.Rectangle(g,w)),g=new y.a.Point(t+b,n+_-p-r/2),w=new y.a.Point(t+b-.5*p,n+_-p+r/2),h.addChild(new y.a.Path.Rectangle(g,w)),g=new y.a.Point(t+b-.5*p-r/2,n+_-p-r/2),w=new y.a.Point(t+b-.5*p+r/2,n+2*u),h.addChild(new y.a.Path.Rectangle(g,w)),g=new y.a.Point(t+b+.3*p-d/2,n+_-f/2),w=new y.a.Point(t+b+.3*p+d/2,n+_+f/2),h.addChild(new y.a.Path.Rectangle(g,w)),g=new y.a.Point(t+b-r/2+.3*p,n+_),w=new y.a.Point(t+b+r/2+.3*p,n+2*u),h.addChild(new y.a.Path.Rectangle(g,w)),g=new y.a.Point(t+b+.55*p-d/2,n+_-f),w=new y.a.Point(t+b+.55*p+d/2,n+_+f),h.addChild(new y.a.Path.Rectangle(g,w)),g=new y.a.Point(t+b+.55*p-r/2,n+_),w=new y.a.Point(t+b+.55*p+r/2,n+2*u),h.addChild(new y.a.Path.Rectangle(g,w)),g=new y.a.Point(t+b+.85*p-d/2,n+_-f),w=new y.a.Point(t+b+.85*p+d/2,n+_+f),h.addChild(new y.a.Path.Rectangle(g,w)),g=new y.a.Point(t+b+.85*p-r/2,n+_),w=new y.a.Point(t+b+.85*p+r/2,n+2*u),h.addChild(new y.a.Path.Rectangle(g,w)),g=new y.a.Point(t+b+1.15*p-d/2,n+_-f),w=new y.a.Point(t+b+1.15*p+d/2,n+_+f),h.addChild(new y.a.Path.Rectangle(g,w)),g=new y.a.Point(t+b+1.15*p-r/2,n+_),w=new y.a.Point(t+b+1.15*p+r/2,n+2*u),h.addChild(new y.a.Path.Rectangle(g,w)),b=o/2+3*u/5,_=u+o/2,g=new y.a.Point(t+b-.3*p-d/2,n+_-f/2),w=new y.a.Point(t+b-.3*p+d/2,n+_+f/2),h.addChild(new y.a.Path.Rectangle(g,w)),g=new y.a.Point(t+b-r/2-.3*p,n+_),w=new y.a.Point(t+b+r/2-.3*p,n+2*u),h.addChild(new y.a.Path.Rectangle(g,w)),g=new y.a.Point(t+b-f/2,n+_+p-d/2),w=new y.a.Point(t+b+f/2,n+_+p+d/2),h.addChild(new y.a.Path.Rectangle(g,w)),g=new y.a.Point(t+b,n+_+p-r/2),w=new y.a.Point(t+b+.5*p,n+_+p+r/2),h.addChild(new y.a.Path.Rectangle(g,w)),g=new y.a.Point(t+b+.5*p-r/2,n+_+p-r/2),w=new y.a.Point(t+b+.5*p+r/2,n+2*u),h.addChild(new y.a.Path.Rectangle(g,w)),g=new y.a.Point(t+b+.3*p-d/2,n+_-f/2),w=new y.a.Point(t+b+.3*p+d/2,n+_+f/2),h.addChild(new y.a.Path.Rectangle(g,w)),g=new y.a.Point(t+b+.3*p-r/2,n+_),w=new y.a.Point(t+b+.3*p+r/2,n+_+v),h.addChild(new y.a.Path.Rectangle(g,w)),g=new y.a.Point(t+b+.3*p-r/2,n+_+v-r/2),w=new y.a.Point(t+b+.3*p+.4*p,n+_+v+r/2),h.addChild(new y.a.Path.Rectangle(g,w)),g=new y.a.Point(t+b-r/2+.4*p+.3*p,n+_-r/2+v),w=new y.a.Point(t+b+r/2+.4*p+.3*p,n+2*u),h.addChild(new y.a.Path.Rectangle(g,w)),h.fillColor=s,this.transformRender(e,h),h}},{key:"render2DTarget",value:function(e,t){var n=this.__drawFlow(t);return n.addChild(this.__drawControl(t)),n.fillColor.alpha=.5,n}}]),n}(R);function Fl(e){return Fl="function"===typeof Symbol&&"symbol"===typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"===typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Fl(e)}function kl(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function El(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function Nl(e,t,n){return t&&El(e.prototype,t),n&&El(e,n),e}function xl(e,t){if("function"!==typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&Ml(e,t)}
1function Ml(e,t){return Ml=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},Ml(e,t)}function Il(e){var t=jl();return function(){var n,r=Bl(e);if(t){var o=Bl(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return Wl(this,n)}}function Wl(e,t){if(t&&("object"===Fl(t)||"function"===typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return Al(e)}function Al(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function jl(){if("undefined"===typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"===typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}function Bl(e){return Bl=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},Bl(e)}var Vl=function(e){xl(n,e);var t=Il(n);function n(){return kl(this,n),t.call(this)}return Nl(n,[{key:"__setupDefinitions",value:function(){this.__unique={position:"Point"},this.__heritable={componentSpacing:"Float",rotation:"Float",channelWidth:"Float",length:"Float",width:"Float",height:"Float",mirrorByX:"Float",mirrorByY:"Float"},this.__defaults={componentSpacing:2e3,rotation:0,channelWidth:Ce,width:1230,length:4920,height:250,mirrorByX:0,mirrorByY:0},this.__units={componentSpacing:"μm",rotation:"°",channelWidth:"μm",length:"μm",width:"μm",height:"μm"},this.__minimum={componentSpacing:0,rotation:0,channelWidth:10,width:30,length:120,height:10,mirrorByX:0,mirrorByY:0},this.__maximum={componentSpacing:1e4,rotation:360,channelWidth:2e3,width:6e3,length:24e3,height:1200,mirrorByX:1,mirrorByY:1},this.__featureParams={componentSpacing:"componentSpacing",position:"position",rotation:"rotation",channelWidth:"channelWidth",length:"length",width:"width",mirrorByX:"mirrorByX",mirrorByY:"mirrorByY"},this.__targetParams={componentSpacing:"componentSpacing",channelWidth:"channelWidth",length:"length",width:"width",rotation:"rotation",mirrorByX:"mirrorByX",mirrorByY:"mirrorByY"},this.__placementTool="componentPositionTool",this.__toolParams={position:"position"},this.__renderKeys=["FLOW"],this.__mint="INCUBATION",this.__zOffsetKeys={FLOW:"height"},this.__substrateOffset={FLOW:"0"}}},{key:"getPorts",value:function(e){var t=e.length,n=[];return n.push(new b(0,-t/2,"1",o.FLOW)),n.push(new b(0,t/2,"2",o.FLOW)),n}},{key:"render2D",value:function(e,t){var n,r,o,i,a,l,s=e.position,c=s[0],u=s[1],h=e.channelWidth,f=e.length,d=e.width,p=(e.rotation,e.color);n=[c-h/2,u-f/2],r=[c+h/2,u-f/2],o=[c+d+h/2,u],i=[c+h/2,u+f/2],a=[c-h/2,u+f/2],l=[c-h/2-d,u];var m=new y.a.Path;return m.add(new y.a.Point(n)),m.add(new y.a.Point(r)),m.add(new y.a.Point(o)),m.add(new y.a.Point(i)),m.add(new y.a.Point(a)),m.add(new y.a.Point(l)),m.closed=!0,m.fillColor=p,this.transformRender(e,m),m}},{key:"render2DTarget",value:function(e,t){null===e&&(e=this.__renderKeys[0]);var n=this.render2D(t,e);return n.fillColor.alpha=.5,n}}]),n}(R);function Xl(e){return Xl="function"===typeof Symbol&&"symbol"===typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"===typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Xl(e)}function Yl(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Gl(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function Ul(e,t,n){return t&&Gl(e.prototype,t),n&&Gl(e,n),e}function zl(e,t){if("function"!==typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&Hl(e,t)}function Hl(e,t){return Hl=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},Hl(e,t)}function Kl(e){var t=Zl();return function(){var n,r=$l(e);if(t){var o=$l(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return ql(this,n)}}function ql(e,t){if(t&&("object"===Xl(t)||"function"===typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return Jl(e)}function Jl(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Zl(){if("undefined"===typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"===typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}function $l(e){return $l=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},$l(e)}var Ql=function(e){zl(n,e);var t=Kl(n);function n(){return Yl(this,n),t.call(this)}return Ul(n,[{key:"__setupDefinitions",value:function(){this.__unique={position:"Point"},this.__heritable={componentSpacing:"Float",rotation:"Float",height:"Float",inletWidth:"Float",inletLength:"Float",electrodeWidth:"Float",electrodeLength:"Float",electrodeDistance:"Float",outletWidth:"Float",outletLength:"Float",chamberHeight:"Float",chamberLength:"Float",channelDepth:"Float",electrodeDepth:"Float",mirrorByX:"Float",mirrorByY:"Float"},this.__defaults={componentSpacing:2e3,rotation:0,height:250,inletWidth:2e3,inletLength:4e3,electrodeWidth:1e3,electrodeLength:5e3,electrodeDistance:1e3,outletWidth:2e3,outletLength:4e3,chamberHeight:2700,chamberLength:2e3,channelDepth:1e3,electrodeDepth:1e3,mirrorByX:0,mirrorByY:0},this.__units={componentSpacing:"μm",rotation:"°",height:"μm",inletWidth:"μm",inletLength:"μm",electrodeWidth:"μm",electrodeLength:"μm",electrodeDistance:"μm",outletWidth:"μm",outletLength:"μm",chamberHeight:"μm",chamberLength:"μm",channelDepth:"μm",electrodeDepth:"μm"},this.__minimum={componentSpacing:0,rotation:0,height:10,inletWidth:1e3,inletLength:1e3,electrodeWidth:500,electrodeLength:3e3,electrodeDistance:500,outletWidth:1e3,outletLength:1e3,chamberHeight:1e3,chamberLength:1e3,channelDepth:1e3,electrodeDepth:1e3,mirrorByX:0,mirrorByY:0},this.__maximum={componentSpacing:1e4,rotation:360,height:1200,inletWidth:3e3,inletLength:6e3,electrodeWidth:3e3,electrodeLength:7e3,electrodeDistance:1500,outletWidth:3e3,outletLength:6e3,chamberHeight:4e3,chamberLength:4e3,channelDepth:1e3,electrodeDepth:1e3,mirrorByX:1,mirrorByY:1},this.__placementTool="multilayerPositionTool",this.__toolParams={cursorPosition:"position"}
1,this.__featureParams={componentSpacing:"componentSpacing",position:"position",rotation:"rotation",inletWidth:"inletWidth",inletLength:"inletLength",electrodeWidth:"electrodeWidth",electrodeLength:"electrodeLength",electrodeDistance:"electrodeDistance",outletWidth:"outletWidth",outletLength:"outletLength",chamberHeight:"chamberHeight",chamberLength:"chamberLength",channelDepth:"channelDepth",electrodeDepth:"electrodeDepth",mirrorByX:"mirrorByX",mirrorByY:"mirrorByY"},this.__targetParams={componentSpacing:"componentSpacing",rotation:"rotation",inletWidth:"inletWidth",inletLength:"inletLength",electrodeWidth:"electrodeWidth",electrodeLength:"electrodeLength",electrodeDistance:"electrodeDistance",outletWidth:"outletWidth",outletLength:"outletLength",chamberHeight:"chamberHeight",chamberLength:"chamberLength",channelDepth:"channelDepth",electrodeDepth:"electrodeDepth",mirrorByX:"mirrorByX",mirrorByY:"mirrorByY"},this.__renderKeys=["FLOW","INTEGRATION"],this.__mint="DROPLET MERGER",this.__zOffsetKeys={FLOW:"height",INTEGRATION:"electrodeDepth"},this.__substrateOffset={FLOW:"0",INTEGRATION:"+1"}}},{key:"getPorts",value:function(e){var t=e.inletLength,n=e.outletLength,r=e.chamberLength,i=[];return i.push(new b(0,0,"1",o.FLOW)),i.push(new b(t+r+n,0,"2",o.FLOW)),i}},{key:"__renderFlow",value:function(e){e.rotation;var t=e.position[0],n=e.position[1],r=e.color,o=e.inletWidth,i=e.inletLength,a=e.outletWidth,l=e.outletLength,s=e.chamberHeight,c=e.chamberLength,u=(e.channelDepth,e.electrodeDepth,new y.a.CompoundPath("")),h=new y.a.Point(t,n-o/2),f=new y.a.Point(t+i,n+o/2);return u.addChild(new y.a.Path.Rectangle(h,f)),h=new y.a.Point(t+i,n-s/2),f=new y.a.Point(t+i+c,n+s/2),u.addChild(new y.a.Path.Rectangle(h,f)),h=new y.a.Point(t+i+c,n-a/2),f=new y.a.Point(t+i+c+l,n+a/2),u.addChild(new y.a.Path.Rectangle(h,f)),this.transformRender(e,u),u.fillColor=r,u}},{key:"__renderIntegrate",value:function(e){e.rotation;var t=e.position[0],n=e.position[1],r=e.color,o=e.inletLength,i=e.electrodeWidth,a=e.electrodeLength,l=e.electrodeDistance,s=(e.channelDepth,e.electrodeDepth,new y.a.CompoundPath("")),c=new y.a.Point(t+o,n-a/2),u=new y.a.Point(t+o+i,n+a/2);return s.addChild(new y.a.Path.Rectangle(c,u)),c=new y.a.Point(t+o+i+l,n-a/2),u=new y.a.Point(t+o+2*i+l,n+a/2),s.addChild(new y.a.Path.Rectangle(c,u)),this.transformRender(e,s),s.fillColor=r,s}},{key:"render2D",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"FLOW";if("FLOW"===t)return this.__renderFlow(e);if("INTEGRATION"===t)return this.__renderIntegrate(e);throw new Error("Unknown render key found in DROPLET MERGER: "+t)}},{key:"render2DTarget",value:function(e,t){var n=new y.a.CompoundPath(""),r=this.render2D(t,"FLOW"),o=this.render2D(t,"INTEGRATION");return n.addChild(o),n.addChild(r),n.fillColor=t.color,n.fillColor.alpha=.5,n}}]),n}(R);function es(e){return es="function"===typeof Symbol&&"symbol"===typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"===typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},es(e)}function ts(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function ns(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function rs(e,t,n){return t&&ns(e.prototype,t),n&&ns(e,n),e}function os(e,t){if("function"!==typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&is(e,t)}function is(e,t){return is=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},is(e,t)}function as(e){var t=cs();return function(){var n,r=us(e);if(t){var o=us(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return ls(this,n)}}function ls(e,t){if(t&&("object"===es(t)||"function"===typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return ss(e)}function ss(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function cs(){if("undefined"===typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"===typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}
1function us(e){return us=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},us(e)}var hs=function(e){os(n,e);var t=as(n);function n(){return ts(this,n),t.call(this)}return rs(n,[{key:"__setupDefinitions",value:function(){this.__unique={position:"Point"},this.__heritable={componentSpacing:"Float",channelWidth:"Float",outputWidth:"Float",stabilizationLength:"Float",rotation:"Float",height:"Float",mirrorByX:"Float",mirrorByY:"Float"},this.__defaults={componentSpacing:2e3,channelWidth:400,outputWidth:400,stabilizationLength:1200,rotation:0,height:250,mirrorByX:0,mirrorByY:0},this.__units={componentSpacing:"μm",channelWidth:"μm",outputWidth:"μm",stabilizationLength:"μm",rotation:"°",height:"μm"},this.__minimum={componentSpacing:0,channelWidth:1,outputWidth:1,stabilizationLength:10,rotation:0,height:10,mirrorByX:0,mirrorByY:0},this.__maximum={componentSpacing:1e4,channelWidth:4e3,outputWidth:4e3,stabilizationLength:5e4,rotation:360,height:1e4,mirrorByX:1,mirrorByY:1},this.__placementTool="componentPositionTool",this.__toolParams={cursorPosition:"position"},this.__featureParams={componentSpacing:"componentSpacing",position:"position",channelWidth:"channelWidth",outputWidth:"outputWidth",stabilizationLength:"stabilizationLength",rotation:"rotation",height:"height",mirrorByX:"mirrorByX",mirrorByY:"mirrorByY"},this.__targetParams={componentSpacing:"componentSpacing",channelWidth:"channelWidth",outputWidth:"outputWidth",stabilizationLength:"stabilizationLength",rotation:"rotation",mirrorByX:"mirrorByX",mirrorByY:"mirrorByY"},this.__renderKeys=["FLOW"],this.__mint="DROPLET MERGER JUNCTION",this.__zOffsetKeys={FLOW:"height"},this.__substrateOffset={FLOW:"0"}}},{key:"_arm",value:function(e){var t=Number(e.channelWidth)||400,n=Number(e.outputWidth)||t,r=Math.max(t,n),o=Number(e.stabilizationLength);return Math.max(3*r,Number.isFinite(o)?o/2:3*r)}},{key:"getPorts",value:function(e){var t=this._arm(e),n=[];return n.push(new b(0,t,"1",o.FLOW)),n.push(new b(t,0,"2",o.FLOW)),n.push(new b(2*t,t,"3",o.FLOW)),n}},{key:"render2D",value:function(e,t){var n=e.position[0],r=e.position[1],o=e.color,i=Number(e.channelWidth)||400,a=Number(e.outputWidth)||i,l=this._arm(e),s=new y.a.CompoundPath("");return s.addChild(new y.a.Path.Rectangle(new y.a.Rectangle(n,r+l-i/2,2*l,i))),s.addChild(new y.a.Path.Rectangle(new y.a.Rectangle(n+l-a/2,r,a,l+i/2))),s.fillColor=o,this.transformRender(e,s),s}},{key:"render2DTarget",value:function(e,t){null===e&&(e=this.__renderKeys[0]);var n=this.render2D(t,e);return n.fillColor.alpha=.5,n}}]),n}(R);function fs(e){return fs="function"===typeof Symbol&&"symbol"===typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"===typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},fs(e)}function ds(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function ps(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function ys(e,t,n){return t&&ps(e.prototype,t),n&&ps(e,n),e}function ms(e,t){if("function"!==typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&vs(e,t)}function vs(e,t){return vs=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},vs(e,t)}function gs(e){var t=_s();return function(){var n,r=Ps(e);if(t){var o=Ps(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return ws(this,n)}}function ws(e,t){if(t&&("object"===fs(t)||"function"===typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return bs(e)}function bs(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function _s(){if("undefined"===typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"===typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}
1function Ps(e){return Ps=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},Ps(e)}var Cs=function(e){ms(n,e);var t=gs(n);function n(){return ds(this,n),t.call(this)}return ys(n,[{key:"__setupDefinitions",value:function(){this.__unique={position:"Point"},this.__heritable={componentSpacing:"Float",height:"Float",width:"Float",injectorWidth:"Float",injectorLength:"Float",dropletWidth:"Float",nozzleWidth:"Float",nozzleLength:"Float",electrodeDistance:"Float",electrodeWidth:"Float",electrodeLength:"Float",rotation:"Float",mirrorByX:"Float",mirrorByY:"Float"},this.__defaults={componentSpacing:2e3,height:250,width:1e4,injectorWidth:2e3,injectorLength:3e3,dropletWidth:800,nozzleWidth:400,nozzleLength:400,electrodeDistance:800,electrodeWidth:800,electrodeLength:3e3,rotation:0,mirrorByX:0,mirrorByY:0},this.__units={componentSpacing:"μm",height:"μm",width:"μm",injectorWidth:"μm",injectorLength:"μm",dropletWidth:"μm",nozzleWidth:"μm",nozzleLength:"μm",electrodeDistance:"μm",electrodeWidth:"μm",electrodeLength:"μm",rotation:"°"},this.__minimum={componentSpacing:0,height:10,width:5e3,injectorWidth:1e3,injectorLength:1e3,dropletWidth:100,nozzleWidth:80,nozzleLength:80,electrodeDistance:100,electrodeWidth:100,electrodeLength:1e3,rotation:0,mirrorByX:0,mirrorByY:0},this.__maximum={componentSpacing:1e4,height:1200,width:2e4,injectorWidth:4e3,injectorLength:5e3,dropletWidth:2e3,nozzleWidth:1e3,nozzleLength:500,electrodeDistance:2e3,electrodeWidth:2e3,electrodeLength:5e3,rotation:360,mirrorByX:1,mirrorByY:1},this.__placementTool="multilayerPositionTool",this.__toolParams={cursorPosition:"position"},this.__featureParams={componentSpacing:"componentSpacing",position:"position",width:"width",injectorWidth:"injectorWidth",injectorLength:"injectorLength",dropletWidth:"dropletWidth",nozzleWidth:"nozzleWidth",nozzleLength:"nozzleLength",electrodeDistance:"electrodeDistance",electrodeWidth:"electrodeWidth",electrodeLength:"electrodeLength",rotation:"rotation",mirrorByX:"mirrorByX",mirrorByY:"mirrorByY"},this.__targetParams={componentSpacing:"componentSpacing",width:"width",injectorWidth:"injectorWidth",injectorLength:"injectorLength",dropletWidth:"dropletWidth",nozzleWidth:"nozzleWidth",nozzleLength:"nozzleLength",electrodeDistance:"electrodeDistance",electrodeWidth:"electrodeWidth",electrodeLength:"electrodeLength",rotation:"rotation",mirrorByX:"mirrorByX",mirrorByY:"mirrorByY"},this.__renderKeys=["FLOW","INTEGRATION"],this.__mint="PICOINJECTOR",this.__zOffsetKeys={FLOW:"height",INTEGRATION:"height"},this.__substrateOffset={FLOW:"0",INTEGRATION:"0"}}},{key:"getPorts",value:function(e){var t=e.width,n=e.injectorLength,r=e.dropletWidth,i=e.nozzleLength,a=(e.electrodeDistance,e.electrodeWidth,e.electrodeLength,[]);return a.push(new b(-t/2,0,"1",o.FLOW)),a.push(new b(t/2,0,"2",o.FLOW)),a.push(new b(0,-r/2-i-n,"3",o.FLOW)),a}},{key:"__renderFlow",value:function(e){e.rotation;var t=e.position[0],n=e.position[1],r=e.color,o=e.width,i=e.injectorWidth,a=e.injectorLength,l=e.dropletWidth,s=e.nozzleWidth,c=e.nozzleLength,u=new y.a.CompoundPath(""),h=new y.a.Point(t-o/2,n-l/2),f=new y.a.Point(t+o/2,n+l/2);return u.addChild(new y.a.Path.Rectangle(h,f)),h=new y.a.Point(t-s/2,n-l/2-c),f=new y.a.Point(t+s/2,n-l/2),u.addChild(new y.a.Path.Rectangle(h,f)),h=new y.a.Point(t-i/2,n-l/2-c-a),f=new y.a.Point(t+i/2,n-l/2-c),u.addChild(new y.a.Path.Rectangle(h,f)),this.transformRender(e,u),u.fillColor=r,u}},{key:"__renderIntegrate",value:function(e){e.rotation;var t=e.position[0],n=e.position[1],r=e.color,o=e.electrodeDistance,i=e.electrodeWidth,a=e.electrodeLength,l=new y.a.CompoundPath(""),s=new y.a.Point(t-i/2,n+o),c=new y.a.Point(t+i/2,n+o+a);return l.addChild(new y.a.Path.Rectangle(s,c)),s=new y.a.Point(t-i/2-2*i,n+o),c=new y.a.Point(t+i/2-2*i,n+o+a),l.addChild(new y.a.Path.Rectangle(s,c)),s=new y.a.Point(t-i/2+2*i,n+o),c=new y.a.Point(t+i/2+2*i,n+o+a),l.addChild(new y.a.Path.Rectangle(s,c)),this.transformRender(e,l),l.fillColor=r,l}},{key:"render2D",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"FLOW";if("FLOW"===t)return this.__renderFlow(e);
1if("INTEGRATION"===t)return this.__renderIntegrate(e);throw new Error("Unknown render key found in PICOINJECTOR: "+t)}},{key:"render2DTarget",value:function(e,t){var n=new y.a.CompoundPath(""),r=this.render2D(t,"FLOW"),o=this.render2D(t,"INTEGRATION");return n.addChild(o),n.addChild(r),n.fillColor=t.color,n.fillColor.alpha=.5,n}}]),n}(R);function Os(e){return Os="function"===typeof Symbol&&"symbol"===typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"===typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Os(e)}function Ss(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Ds(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function Rs(e,t,n){return t&&Ds(e.prototype,t),n&&Ds(e,n),e}function Ts(e,t){if("function"!==typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&Ls(e,t)}function Ls(e,t){return Ls=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},Ls(e,t)}function Fs(e){var t=Ns();return function(){var n,r=xs(e);if(t){var o=xs(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return ks(this,n)}}function ks(e,t){if(t&&("object"===Os(t)||"function"===typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return Es(e)}function Es(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Ns(){if("undefined"===typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"===typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}function xs(e){return xs=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},xs(e)}var Ms=function(e){Ts(n,e);var t=Fs(n);function n(){return Ss(this,n),t.call(this)}return Rs(n,[{key:"__setupDefinitions",value:function(){this.__unique={position:"Point"},this.__heritable={componentSpacing:"Float",rotation:"Float",height:"Float",inletWidth:"Float",inletLength:"Float",electrodeDistance:"Float",electrodeWidth:"Float",electrodeLength:"Float",outletWidth:"Float",angle:"Float",wasteWidth:"Float",outputLength:"Float",keepWidth:"Float",pressureWidth:"Float",pressureSpacing:"Float",numberofDistributors:"Float",channelDepth:"Float",electrodeDepth:"Float",pressureDepth:"Float"},this.__defaults={componentSpacing:2e3,rotation:0,height:250,inletWidth:800,inletLength:4e3,electrodeDistance:1e3,electrodeWidth:700,electrodeLength:5e3,outletWidth:800,angle:45,wasteWidth:1200,outputLength:4e3,keepWidth:2e3,pressureWidth:400,pressureSpacing:1500,numberofDistributors:5,channelDepth:1e3,electrodeDepth:1e3,pressureDepth:1e3,mirrorByX:0,mirrorByY:0},this.__units={componentSpacing:"μm",rotation:"°",height:"μm",inletWidth:"μm",inletLength:"μm",electrodeDistance:"μm",electrodeWidth:"μm",electrodeLength:"μm",outletWidth:"μm",angle:"°",wasteWidth:"μm",outputLength:"μm",keepWidth:"μm",pressureWidth:"μm",pressureSpacing:"μm",numberofDistributors:"μm",channelDepth:"μm",electrodeDepth:"μm",pressureDepth:"μm"},this.__minimum={componentSpacing:0,rotation:0,height:10,inletWidth:500,inletLength:2e3,electrodeDistance:500,electrodeWidth:500,electrodeLength:2500,outletWidth:500,angle:0,wasteWidth:500,outputLength:2e3,keepWidth:2e3,pressureWidth:200,pressureSpacing:500,numberofDistributors:1,channelDepth:1e3,electrodeDepth:1e3,pressureDepth:1e3,mirrorByX:0,mirrorByY:0},this.__maximum={componentSpacing:1e4,rotation:360,height:1200,inletWidth:2e3,inletLength:6e3,electrodeDistance:1500,electrodeWidth:1500,electrodeLength:7500,outletWidth:2e3,angle:180,wasteWidth:1500,outputLength:6e3,keepWidth:3500,pressureWidth:1e3,pressureSpacing:2e3,numberofDistributors:10,channelDepth:1e3,electrodeDepth:1e3,pressureDepth:1e3,mirrorByX:1,mirrorByY:1},this.__placementTool="multilayerPositionTool",this.__toolParams={cursorPosition:"position"}
1,this.__featureParams={componentSpacing:"componentSpacing",position:"position",rotation:"rotation",inletWidth:"inletWidth",inletLength:"inletLength",electrodeDistance:"electrodeDistance",electrodeWidth:"electrodeWidth",electrodeLength:"electrodeLength",outletWidth:"outletWidth",angle:"angle",wasteWidth:"wasteWidth",outputLength:"outputLength",keepWidth:"keepWidth",pressureWidth:"pressureWidth",pressureSpacing:"pressureSpacing",numberofDistributors:"numberofDistributors",channelDepth:"channelDepth",electrodeDepth:"electrodeDepth",pressureDepth:"pressureDepth",mirrorByX:"mirrorByX",mirrorByY:"mirrorByY"},this.__targetParams={componentSpacing:"componentSpacing",rotation:"rotation",inletWidth:"inletWidth",inletLength:"inletLength",electrodeDistance:"electrodeDistance",electrodeWidth:"electrodeWidth",electrodeLength:"electrodeLength",outletWidth:"outletWidth",angle:"angle",wasteWidth:"wasteWidth",outputLength:"outputLength",keepWidth:"keepWidth",pressureWidth:"pressureWidth",pressureSpacing:"pressureSpacing",numberofDistributors:"numberofDistributors",channelDepth:"channelDepth",electrodeDepth:"electrodeDepth",pressureDepth:"pressureDepth",mirrorByX:"mirrorByX",mirrorByY:"mirrorByY"},this.__renderKeys=["FLOW","INTEGRATION"],this.__mint="DROPLET SORTER",this.__zOffsetKeys={FLOW:"height",INTEGRATION:"electrodeDepth"},this.__substrateOffset={FLOW:"0",INTEGRATION:"0"}}},{key:"getPorts",value:function(e){var t=e.inletLength,n=e.angle,r=e.outputLength,i=e.pressureWidth,a=e.pressureSpacing,l=e.numberofDistributors,s=(l+.5)*(a+i)/Math.cos(n/2*Math.PI/180),c=[];return c.push(new b(-t,0,"1",o.FLOW)),c.push(new b(s*Math.cos(n/2*Math.PI/180)+r,-((l+.5)*(a+i)-i/2)*Math.tan(n/2*Math.PI/180),"2",o.FLOW)),c.push(new b(s*Math.cos(n/2*Math.PI/180)+r,((l+.5)*(a+i)-i/2)*Math.tan(n/2*Math.PI/180),"3",o.FLOW)),c}},{key:"__renderFlow",value:function(e){e.rotation;for(var t=e.position[0],n=e.position[1],r=e.color,o=e.inletWidth,i=e.inletLength,a=e.outletWidth,l=e.angle,s=e.wasteWidth,c=e.outputLength,u=e.keepWidth,h=e.pressureWidth,f=e.pressureSpacing,d=e.numberofDistributors,p=new y.a.CompoundPath(""),m=0;m<d;m++){var v=(m+1.5)*(f+h),g=v-h,w=(v-h/2)*Math.tan(l/2*Math.PI/180),b=new y.a.Point(t+g,n-w),_=new y.a.Point(t+v,n);p.addChild(new y.a.Path.Rectangle(b,_)),b=new y.a.Point(t+g,n+w),_=new y.a.Point(t+v,n),p.addChild(new y.a.Path.Rectangle(b,_))}var P=(d+.5)*(f+h)/Math.cos(l/2*Math.PI/180),C=new y.a.Point(t,n-a/2),O=new y.a.Point(t+P,n+a/2),S=new y.a.Path.Rectangle(C,O);return S.rotate(-l/2,new y.a.Point(t,n)),p.addChild(S),S=new y.a.Path.Rectangle(C,O),S.rotate(l/2,new y.a.Point(t,n)),p.addChild(S),C=new y.a.Point(t-i,n-o/2),O=new y.a.Point(t,n+o/2),p.addChild(new y.a.Path.Rectangle(C,O)),C=new y.a.Point(t+P*Math.cos(l/2*Math.PI/180),n-((d+.5)*(f+h)-h/2)*Math.tan(l/2*Math.PI/180)-s/2),O=new y.a.Point(t+P*Math.cos(l/2*Math.PI/180)+c,n-((d+.5)*(f+h)-h/2)*Math.tan(l/2*Math.PI/180)+s/2),p.addChild(new y.a.Path.Rectangle(C,O)),C=new y.a.Point(t+P*Math.cos(l/2*Math.PI/180),n+((d+.5)*(f+h)-h/2)*Math.tan(l/2*Math.PI/180)-u/2),O=new y.a.Point(t+P*Math.cos(l/2*Math.PI/180)+c,n+((d+.5)*(f+h)-h/2)*Math.tan(l/2*Math.PI/180)+u/2),p.addChild(new y.a.Path.Rectangle(C,O)),this.transformRender(e,p),p.fillColor=r,p}},{key:"__renderIntegrate",value:function(e){e.rotation;var t=e.position[0],n=e.position[1],r=e.color,o=e.electrodeDistance,i=e.electrodeWidth,a=e.electrodeLength,l=e.angle,s=new y.a.CompoundPath(""),c=new y.a.Point(t-i/2,n+o),u=new y.a.Point(t+i/2,n+o+a);return s.addChild(new y.a.Path.Rectangle(c,u)),c=new y.a.Point(t-i/2-2*i,n+o),u=new y.a.Point(t+i/2-2*i,n+o+a),s.addChild(new y.a.Path.Rectangle(c,u)),c=new y.a.Point(t-i/2+2*i,n+o+2*i*Math.tan(l/2*Math.PI/180)),u=new y.a.Point(t+i/2+2*i,n+o+2*i*Math.tan(l/2*Math.PI/180)+a),s.addChild(new y.a.Path.Rectangle(c,u)),this.transformRender(e,s),s.fillColor=r,s}},{key:"render2D",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"FLOW";if("FLOW"===t)return this.__renderFlow(e);if("INTEGRATION"===t)return this.__renderIntegrate(e);throw new Error("Unknown render key found in DROPLET SORTER: "+t)}},{key:"render2DTarget",value:function(e,t){var n=new y.a.CompoundPath(""),r=this.render2D(t,"FLOW"),o=this.render2D(t,"INTEGRATION");return n.addChild(o),n.addChild(r),n.fillColor=t.color,n.fillColor.alpha=.5,n}}]),n}(R);function Is(e){return Is="function"===typeof Symbol&&"symbol"===typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"===typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Is(e)}function Ws(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function As(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function js(e,t,n){return t&&As(e.prototype,t),n&&As(e,n),e}function Bs(e,t){if("function"!==typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&Vs(e,t)}
1function Vs(e,t){return Vs=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},Vs(e,t)}function Xs(e){var t=Us();return function(){var n,r=zs(e);if(t){var o=zs(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return Ys(this,n)}}function Ys(e,t){if(t&&("object"===Is(t)||"function"===typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return Gs(e)}function Gs(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Us(){if("undefined"===typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"===typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}function zs(e){return zs=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},zs(e)}var Hs=function(e){Bs(n,e);var t=Xs(n);function n(){return Ws(this,n),t.call(this)}return js(n,[{key:"__setupDefinitions",value:function(){this.__unique={position:"Point"},this.__heritable={componentSpacing:"Float",rotation:"Float",height:"Float",inletWidth:"Float",inletLength:"Float",electrodeWidth:"Float",electrodeLength:"Float",electrodeDistance:"Float",sensorWidth:"Float",sensorLength:"Float",channelDepth:"Float",electrodeDepth:"Float",mirrorByX:"Float",mirrorByY:"Float"},this.__defaults={componentSpacing:2e3,rotation:0,height:250,inletWidth:1e3,inletLength:1e4,electrodeWidth:1500,electrodeLength:4e3,electrodeDistance:2e3,sensorWidth:1e3,sensorLength:3e3,channelDepth:1e3,electrodeDepth:1e3,mirrorByX:0,mirrorByY:0},this.__units={componentSpacing:"μm",rotation:"°",height:"μm",inletWidth:"μm",inletLength:"μm",electrodeWidth:"μm",electrodeLength:"μm",electrodeDistance:"μm",sensorWidth:"μm",sensorLength:"μm",channelDepth:"μm",electrodeDepth:"μm"},this.__minimum={componentSpacing:0,rotation:0,height:10,inletWidth:500,inletLength:5e3,electrodeWidth:1e3,electrodeLength:2e3,electrodeDistance:1e3,sensorWidth:500,sensorLength:1500,channelDepth:1e3,electrodeDepth:1e3,mirrorByX:0,mirrorByY:0},this.__maximum={componentSpacing:1e4,rotation:360,height:1200,inletWidth:2e3,inletLength:15e3,electrodeWidth:3e3,electrodeLength:6e3,electrodeDistance:3e3,sensorWidth:1500,sensorLength:4500,channelDepth:1e3,electrodeDepth:1e3,mirrorByX:1,mirrorByY:1},this.__placementTool="multilayerPositionTool",this.__toolParams={cursorPosition:"position"},this.__featureParams={componentSpacing:"componentSpacing",position:"position",rotation:"rotation",inletWidth:"inletWidth",inletLength:"inletLength",electrodeWidth:"electrodeWidth",electrodeLength:"electrodeLength",electrodeDistance:"electrodeDistance",sensorWidth:"sensorWidth",sensorLength:"sensorLength",channelDepth:"channelDepth",electrodeDepth:"electrodeDepth",mirrorByX:"mirrorByX",mirrorByY:"mirrorByY"},this.__targetParams={componentSpacing:"componentSpacing",rotation:"rotation",inletWidth:"inletWidth",inletLength:"inletLength",electrodeWidth:"electrodeWidth",electrodeLength:"electrodeLength",electrodeDistance:"electrodeDistance",sensorWidth:"sensorWidth",sensorLength:"sensorLength",channelDepth:"channelDepth",electrodeDepth:"electrodeDepth",mirrorByX:"mirrorByX",mirrorByY:"mirrorByY"},this.__renderKeys=["FLOW","INTEGRATION"],this.__mint="DROPLET CAPACITANCE SENSOR",this.__zOffsetKeys={FLOW:"height",INTEGRATION:"electrodeDepth"},this.__substrateOffset={FLOW:"0",INTEGRATION:"0"}}},{key:"getPorts",value:function(e){var t=e.inletLength,n=[];return n.push(new b(-t/2,0,"1",o.FLOW)),n.push(new b(t/2,0,"2",o.FLOW)),n}},{key:"__renderFlow",value:function(e){e.rotation;var t=e.position[0],n=e.position[1],r=e.color,o=e.inletWidth,i=e.inletLength,a=new y.a.CompoundPath(""),l=new y.a.Point(t-i/2,n-o/2),s=new y.a.Point(t+i/2,n+o/2);return a.addChild(new y.a.Path.Rectangle(l,s)),a.fillColor=r,this.transformRender(e,a),a}},{key:"__renderIntegrate",value:function(e){e.rotation;var t=e.position[0],n=e.position[1],r=e.color,o=e.inletWidth,i=e.electrodeWidth,a=e.electrodeLength,l=e.electrodeDistance,s=e.sensorWidth,c=e.sensorLength,u=new y.a.CompoundPath(""),h=new y.a.Point(t-i/2,n-o/2-l-s/2-a),f=new y.a.Point(t+i/2,n-o/2-l-s/2);u.addChild(new y.a.Path.Rectangle(h,f));var d=new y.a.Path.Ellipse({point:[t-c/2,n-o/2-l-s],size:[c,s]});return u.addChild(d),h=new y.a.Point(t-i/2,n+o/2+l+s/2+a),f=new y.a.Point(t+i/2,n+o/2+l+s/2),u.addChild(new y.a.Path.Rectangle(h,f)),d=new y.a.Path.Ellipse({point:[t-c/2,n+o/2+l],size:[c,s]}),u.addChild(d),u.fillColor=r,this.transformRender(e,u),u}},{key:"render2D",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"FLOW";if("FLOW"===t)return this.__renderFlow(e);
1if("INTEGRATION"===t)return this.__renderIntegrate(e);throw new Error("Unknown render key found in DROPLET CAPACITANCE SENSOR: "+t)}},{key:"render2DTarget",value:function(e,t){var n=new y.a.CompoundPath(""),r=this.render2D(t,"FLOW"),o=this.render2D(t,"INTEGRATION");return n.addChild(o),n.addChild(r),n.fillColor=t.color,n.fillColor.alpha=.5,n}}]),n}(R);function Ks(e){return Ks="function"===typeof Symbol&&"symbol"===typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"===typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Ks(e)}function qs(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Js(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function Zs(e,t,n){return t&&Js(e.prototype,t),n&&Js(e,n),e}function $s(e,t){if("function"!==typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&Qs(e,t)}function Qs(e,t){return Qs=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},Qs(e,t)}function ec(e){var t=rc();return function(){var n,r=oc(e);if(t){var o=oc(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return tc(this,n)}}function tc(e,t){if(t&&("object"===Ks(t)||"function"===typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return nc(e)}function nc(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function rc(){if("undefined"===typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"===typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}function oc(e){return oc=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},oc(e)}var ic=function(e){$s(n,e);var t=ec(n);function n(){return qs(this,n),t.call(this)}return Zs(n,[{key:"__setupDefinitions",value:function(){this.__unique={position:"Point"},this.__heritable={componentSpacing:"Float",rotation:"Float",height:"Float",inletWidth:"Float",inletLength:"Float",outletWidth1:"Float",outletLength1:"Float",outletWidth2:"Float",outletLength2:"Float",mirrorByX:"Float",mirrorByY:"Float"},this.__defaults={componentSpacing:2e3,rotation:0,height:250,inletWidth:2e3,inletLength:6e3,outletWidth1:1e3,outletLength1:3e3,outletWidth2:2e3,outletLength2:3e3,mirrorByX:0,mirrorByY:0},this.__units={componentSpacing:"μm",rotation:"°",height:"μm",inletWidth:"μm",inletLength:"μm",outletWidth1:"μm",outletLength1:"μm",outletWidth2:"μm",outletLength2:"μm"},this.__minimum={componentSpacing:0,rotation:0,height:10,inletWidth:1e3,inletLength:3e3,outletWidth1:500,outletLength1:2e3,outletWidth2:500,outletLength2:2e3,mirrorByX:0,mirrorByY:0},this.__maximum={componentSpacing:1e4,rotation:360,height:1200,inletWidth:3e3,inletLength:8e3,outletWidth1:3e3,outletLength1:5e3,outletWidth2:3e3,outletLength2:5e3,mirrorByX:1,mirrorByY:1},this.__placementTool="componentPositionTool",this.__toolParams={cursorPosition:"position"},this.__featureParams={componentSpacing:"componentSpacing",position:"position",rotation:"rotation",height:"height",inletWidth:"inletWidth",inletLength:"inletLength",outletWidth1:"outletWidth1",outletLength1:"outletLength1",outletWidth2:"outletWidth2",outletLength2:"outletLength2",mirrorByX:"mirrorByX",mirrorByY:"mirrorByY"},this.__targetParams={componentSpacing:"componentSpacing",rotation:"rotation",height:"height",inletWidth:"inletWidth",inletLength:"inletLength",outletWidth1:"outletWidth1",outletLength1:"outletLength1",outletWidth2:"outletWidth2",outletLength2:"outletLength2",mirrorByX:"mirrorByX",mirrorByY:"mirrorByY"},this.__renderKeys=["FLOW"],this.__mint="DROPLET SPLITTER",this.__zOffsetKeys={FLOW:"height"},this.__substrateOffset={FLOW:"0"}}},{key:"getPorts",value:function(e){var t=e.inletWidth,n=e.inletLength,r=e.outletWidth1,i=e.outletLength1,a=e.outletWidth2,l=e.outletLength2,s=[];return s.push(new b(0,0,"1",o.FLOW)),s.push(new b(n-r/2,-t/2-i,"2",o.FLOW)),s.push(new b(n-a/2,t/2+l,"3",o.FLOW)),s}},{key:"render2D",value:function(e,t){e.rotation;
1var n=e.position[0],r=e.position[1],o=e.color,i=e.inletWidth,a=e.inletLength,l=e.outletWidth1,s=e.outletLength1,c=e.outletWidth2,u=e.outletLength2,h=new y.a.CompoundPath(""),f=new y.a.Point(n,r-i/2),d=new y.a.Point(n+a,r+i/2);return h.addChild(new y.a.Path.Rectangle(f,d)),f=new y.a.Point(n+a-l,r-i/2-s),d=new y.a.Point(n+a,r-i/2),h.addChild(new y.a.Path.Rectangle(f,d)),f=new y.a.Point(n+a-c,r+i/2),d=new y.a.Point(n+a,r+i/2+u),h.addChild(new y.a.Path.Rectangle(f,d)),this.transformRender(e,h),h.fillColor=o,h}},{key:"render2DTarget",value:function(e,t){null===e&&(e=this.__renderKeys[0]);var n=this.render2D(t,e);return n.fillColor.alpha=.5,n}}]),n}(R);function ac(e){return ac="function"===typeof Symbol&&"symbol"===typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"===typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},ac(e)}function lc(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function sc(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function cc(e,t,n){return t&&sc(e.prototype,t),n&&sc(e,n),e}function uc(e,t){if("function"!==typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&hc(e,t)}function hc(e,t){return hc=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},hc(e,t)}function fc(e){var t=yc();return function(){var n,r=mc(e);if(t){var o=mc(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return dc(this,n)}}function dc(e,t){if(t&&("object"===ac(t)||"function"===typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return pc(e)}function pc(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function yc(){if("undefined"===typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"===typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}function mc(e){return mc=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},mc(e)}var vc=function(e){uc(n,e);var t=fc(n);function n(){return lc(this,n),t.call(this)}return cc(n,[{key:"__setupDefinitions",value:function(){this.__unique={position:"Point"},this.__heritable={componentSpacing:"Float",height:"Float"},this.__defaults={componentSpacing:2e3,height:100}
1,this.__units={componentSpacing:"μm",height:"μm"},this.__minimum={componentSpacing:10,height:10},this.__maximum={componentSpacing:1e4,height:1e3},this.__placementTool="componentPositionTool",this.__toolParams={position:"position"},this.__featureParams={componentSpacing:"componentSpacing"},this.__targetParams={componentSpacing:"componentSpacing"},this.__renderKeys=["FLOW"],this.__mint="NODE",this.__zOffsetKeys={FLOW:"height"},this.__substrateOffset={FLOW:"0"}}},{key:"drawsAtPositionCenter",value:function(){return!0}},{key:"getPorts",value:function(e){var t=[];return t.push(new b(0,0,"1",o.FLOW)),t}},{key:"render2D",value:function(e,t){var n=new y.a.Point(0,0),r=new y.a.Path.Circle(n,0);return r}},{key:"render2DTarget",value:function(e,t){null===e&&(e=this.__renderKeys[0]);var n=this.render2D(t,e);return n.fillColor.alpha=.5,n}}]),n}(R);function gc(e){return gc="function"===typeof Symbol&&"symbol"===typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"===typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},gc(e)}function wc(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function bc(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function _c(e,t,n){return t&&bc(e.prototype,t),n&&bc(e,n),e}function Pc(e,t){if("function"!==typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&Cc(e,t)}function Cc(e,t){return Cc=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},Cc(e,t)}function Oc(e){var t=Rc();return function(){var n,r=Tc(e);if(t){var o=Tc(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return Sc(this,n)}}function Sc(e,t){if(t&&("object"===gc(t)||"function"===typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return Dc(e)}function Dc(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Rc(){if("undefined"===typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"===typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}function Tc(e){return Tc=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},Tc(e)}var Lc=function(e){Pc(n,e);var t=Oc(n);function n(){return wc(this,n),t.call(this)}return _c(n,[{key:"__setupDefinitions",value:function(){this.__unique={position:"Point"},this.__heritable={componentSpacing:"Float",oilChannelWidth:"Float",waterChannelWidth:"Float",length:"Float",radius:"Float",height:"Float",rotation:"Float",mirrorByX:"Float",mirrorByY:"Float"},this.__defaults={componentSpacing:2e3,oilChannelWidth:600,waterChannelWidth:300,length:5e3,radius:500,height:250,rotation:0,mirrorByX:0,mirrorByY:0},this.__units={componentSpacing:"μm",oilChannelWidth:"μm",height:"μm",waterChannelWidth:"μm",radius:"μm",rotation:"°",length:"μm"},this.__minimum={componentSpacing:0,oilChannelWidth:1,waterChannelWidth:1,radius:1,rotation:0,length:0,mirrorByX:0,mirrorByY:0},this.__maximum={componentSpacing:1e4,oilChannelWidth:2e3,waterChannelWidth:2e3,height:1200,radius:2e3,rotation:360,length:8e3,mirrorByX:1,mirrorByY:1},this.__featureParams={componentSpacing:"componentSpacing",position:"position",oilChannelWidth:"oilChannelWidth",waterChannelWidth:"waterChannelWidth",height:"height",rotation:"rotation",radius:"radius",length:"length",mirrorByX:"mirrorByX",mirrorByY:"mirrorByY"},this.__targetParams={componentSpacing:"componentSpacing",oilChannelWidth:"oilChannelWidth",waterChannelWidth:"waterChannelWidth",height:"height",rotation:"rotation",radius:"radius",length:"length",mirrorByX:"mirrorByX",mirrorByY:"mirrorByY"},this.__placementTool="componentPositionTool",this.__toolParams={position:"position"},this.__renderKeys=["FLOW"],this.__mint="DROPLET GENERATOR T",this.__zOffsetKeys={FLOW:"height"},this.__substrateOffset={FLOW:"0"}}},{key:"getPorts",value:function(e){var t=e.length,n=[];return n.push(new b(t/2,0,"1",o.FLOW)),n}},{key:"render2D",value:function(e,t){var n=e.position,r=n[0],o=n[1],i=e.color,a=e.oilChannelWidth,l=e.waterChannelWidth,s=e.radius,c=(e.rotation,e.length),u=new y.a.CompoundPath(""),h=new y.a.Point(r-c/2,o-a/2),f=new y.a.Point(r+c/2,o+a/2);u.addChild(new y.a.Path.Rectangle(h,f));var d=new y.a.Path.Circle(new y.a.Point(r-c/2,o),s);return u.addChild(d),h=new y.a.Point(r-l/2,o),f=new y.a.Point(r+l/2,o+c/2),u.addChild(new y.a.Path.Rectangle(h,f)),d=new y.a.Path.Circle(new y.a.Point(r,o+c/2),s),u.addChild(d),u.closed=!0,this.transformRender(e,u),u.fillColor=i,u}},{key:"render2DTarget",value:function(e,t){null===e&&(e=this.__renderKeys[0]);var n=this.render2D(t,e);return n.fillColor.alpha=.5,n}}]),n}(R);function Fc(e){return Fc="function"===typeof Symbol&&"symbol"===typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"===typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Fc(e)}function kc(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Ec(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function Nc(e,t,n){return t&&Ec(e.prototype,t),n&&Ec(e,n),e}function xc(e,t){if("function"!==typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&Mc(e,t)}
1function Mc(e,t){return Mc=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},Mc(e,t)}function Ic(e){var t=jc();return function(){var n,r=Bc(e);if(t){var o=Bc(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return Wc(this,n)}}function Wc(e,t){if(t&&("object"===Fc(t)||"function"===typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return Ac(e)}function Ac(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function jc(){if("undefined"===typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"===typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}function Bc(e){return Bc=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},Bc(e)}var Vc=function(e){xc(n,e);var t=Ic(n);function n(){return kc(this,n),t.call(this)}return Nc(n,[{key:"__setupDefinitions",value:function(){this.__unique={position:"Point"},this.__heritable={componentSpacing:"Float",oilChannelWidth:"Float",waterChannelWidth:"Float",length:"Float",radius:"Float",angle:"Float",height:"Float",rotation:"Float",mirrorByX:"Float",mirrorByY:"Float"},this.__defaults={componentSpacing:2e3,oilChannelWidth:400,waterChannelWidth:200,length:3e3,radius:500,angle:45,height:250,rotation:0,mirrorByX:0,mirrorByY:0},this.__units={componentSpacing:"μm",oilChannelWidth:"μm",height:"μm",waterChannelWidth:"μm",radius:"μm",length:"μm",rotation:"°",angle:"°"},this.__minimum={componentSpacing:0,oilChannelWidth:1,waterChannelWidth:1,length:1,radius:1,angle:1,rotation:0,mirrorByX:0,mirrorByY:0},this.__maximum={componentSpacing:1e4,oilChannelWidth:2e3,waterChannelWidth:2e3,length:2e4,angle:360,height:1200,radius:2e3,rotation:360,mirrorByX:1,mirrorByY:1},this.__featureParams={componentSpacing:"componentSpacing",position:"position",oilChannelWidth:"oilChannelWidth",waterChannelWidth:"waterChannelWidth",length:"length",angle:"angle",height:"height",rotation:"rotation",radius:"radius",mirrorByX:"mirrorByX",mirrorByY:"mirrorByY"},this.__targetParams={componentSpacing:"componentSpacing",oilChannelWidth:"oilChannelWidth",waterChannelWidth:"waterChannelWidth",length:"length",angle:"angle",height:"height",rotation:"rotation",radius:"radius",mirrorByX:"mirrorByX",mirrorByY:"mirrorByY"},this.__placementTool="componentPositionTool",this.__toolParams={position:"position"},this.__renderKeys=["FLOW"],this.__mint="DROPLET GENERATOR FLOW FOCUS",this.__zOffsetKeys={FLOW:"height"},this.__substrateOffset={FLOW:"0"}}},{key:"getPorts",value:function(e){var t=[];return t.push(new b(0,0,"1",o.FLOW)),t}},{key:"render2D",value:function(e,t){var n=e.position,r=n[0],o=n[1],i=e.color,a=e.oilChannelWidth,l=e.waterChannelWidth,s=e.length,c=e.angle,u=e.radius,h=(e.rotation,new y.a.CompoundPath("")),f=new y.a.Point(r-s/3-2*s,o-l/2),d=new y.a.Point(r,o+l/2);h.addChild(new y.a.Path.Rectangle(f,d));var p=new y.a.Path.Circle(new y.a.Point(r-s/3-2*s,o),u);h.addChild(p);var m=s/Math.cos(c*Math.PI/180);f=new y.a.Point(r-s/3-m,o-a/2),d=new y.a.Point(r-s/3,o+a/2);var v=new y.a.Path.Rectangle(f,d);v.rotate(c,new y.a.Point(r-s/3,o)),h.addChild(v),v=new y.a.Path.Rectangle(f,d),v.rotate(-c,new y.a.Point(r-s/3,o)),h.addChild(v);var g=m*Math.sin(c*Math.PI/180),w=90-c,b=a/2*Math.tan(w*Math.PI/180);return f=new y.a.Point(r-s/3-s-a/2,o-g-2*s/3+b),d=new y.a.Point(r-s/3-s+a/2,o-g+b),h.addChild(new y.a.Path.Rectangle(f,d)),f=new y.a.Point(r-s/3-2*s,o-g-2*s/3+b),d=new y.a.Point(r-s/3-s-a/2,o-g-2*s/3+a+b),h.addChild(new y.a.Path.Rectangle(f,d)),p=new y.a.Path.Circle(new y.a.Point(r-s/3-2*s,o-g-2*s/3+b+a/2),u),h.addChild(p),f=new y.a.Point(r-s/3-s-a/2,o+g+2*s/3-b),d=new y.a.Point(r-s/3-s+a/2,o+g-b),h.addChild(new y.a.Path.Rectangle(f,d)),f=new y.a.Point(r-s/3-2*s,o+g+2*s/3-b),d=new y.a.Point(r-s/3-s-a/2,o+g+2*s/3-a-b),h.addChild(new y.a.Path.Rectangle(f,d)),p=new y.a.Path.Circle(new y.a.Point(r-s/3-2*s,o+g+2*s/3-b-a/2),u),h.addChild(p),this.transformRender(e,h),h.closed=!0,h.fillColor=i,h}},{key:"render2DTarget",value:function(e,t){null===e&&(e=this.__renderKeys[0]);var n=this.render2D(t,e);return n.fillColor.alpha=.5,n}}]),n}(R);function Xc(e){return Xc="function"===typeof Symbol&&"symbol"===typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"===typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Xc(e)}function Yc(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Gc(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function Uc(e,t,n){return t&&Gc(e.prototype,t),n&&Gc(e,n),e}function zc(e,t){if("function"!==typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&Hc(e,t)}
1function Hc(e,t){return Hc=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},Hc(e,t)}function Kc(e){var t=Zc();return function(){var n,r=$c(e);if(t){var o=$c(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return qc(this,n)}}function qc(e,t){if(t&&("object"===Xc(t)||"function"===typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return Jc(e)}function Jc(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Zc(){if("undefined"===typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"===typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}function $c(e){return $c=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},$c(e)}var Qc=function(e){zc(n,e);var t=Kc(n);function n(){return Yc(this,n),t.call(this)}return Uc(n,[{key:"__setupDefinitions",value:function(){this.__unique={position:"Point"},this.__heritable={componentSpacing:"Float",chamberWidth:"Float",height:"Float",chamberLength:"Float",flowChannelWidth:"Float",controlChannelWidth:"Float",portRadius:"Float",rotation:"Float",mirrorByX:"Float",mirrorByY:"Float"},this.__defaults={componentSpacing:2e3,height:1100,chamberWidth:1500,chamberLength:1500,flowChannelWidth:600,controlChannelWidth:400,portRadius:1e3,rotation:0,mirrorByX:0,mirrorByY:0},this.__units={componentSpacing:"μm",chamberWidth:"μm",chamberLength:"μm",flowChannelWidth:"μm",controlChannelWidth:"μm",portRadius:"μm",height:"μm",rotation:"°"},this.__minimum={componentSpacing:0,height:1,chamberWidth:1,chamberLength:1,flowChannelWidth:1,controlChannelWidth:1,portRadius:1,rotation:0,mirrorByX:0,mirrorByY:0},this.__maximum={componentSpacing:1e4,height:11e3,chamberWidth:1e4,chamberLength:1e4,flowChannelWidth:1e4,controlChannelWidth:1e4,portRadius:1e4,rotation:360,mirrorByX:1,mirrorByY:1},this.__placementTool="multilayerPositionTool",this.__toolParams={position:"position"},this.__featureParams={componentSpacing:"componentSpacing",chamberWidth:"chamberWidth",flowChannelWidth:"flowChannelWidth",controlChannelWidth:"controlChannelWidth",portRadius:"portRadius",chamberLength:"chamberLength",height:"height",position:"position",rotation:"rotation",mirrorByX:"mirrorByX",mirrorByY:"mirrorByY"},this.__targetParams={componentSpacing:"componentSpacing",chamberWidth:"chamberWidth",flowChannelWidth:"flowChannelWidth",controlChannelWidth:"controlChannelWidth",portRadius:"portRadius",chamberLength:"chamberLength",height:"height",rotation:"rotation",mirrorByX:"mirrorByX",mirrorByY:"mirrorByY"},this.__renderKeys=["FLOW","CONTROL","CELL"],this.__mint="LOGIC ARRAY",this.__zOffsetKeys={FLOW:"height",CONTROL:"height",CELL:"height"},this.__substrateOffset={FLOW:"0",CONTROL:"+1",CELL:"0"}}},{key:"render2D",value:function(e,t){if("FLOW"===t)return this.__drawFlow(e);if("CONTROL"===t)return this.__drawControl(e);if("CELL"===t)return console.log("cell"),this.__drawCell(e);throw new Error("Invalid key passed to LogicArray render2D")}},{key:"__drawFlow",value:function(e){var t=e.position[0],n=e.position[1],r=e.color,o=e.componentSpacing,i=(e.chamberWidth,e.flowChannelWidth),a=e.controlChannelWidth,l=e.portRadius,s=(e.chamberLength,e.rotation,new y.a.CompoundPath("")),c=14*o,u=5*o,h=20*o,f=2*o,d=new y.a.Point(t,n-i/2),p=new y.a.Point(t+h,n+i/2),m=new y.a.Path.Rectangle(d,p);d=new y.a.Point(t+2*u/3-a,n-i/2-a),p=new y.a.Point(t+2*u/3+a,n+i/2+a),m=m.subtract(new y.a.Path.Rectangle(d,p)),d=new y.a.Point(t+u+h/2-f-a,n-i/2-a),p=new y.a.Point(t+u+h/2-f+a,n+i/2+a),m=m.subtract(new y.a.Path.Rectangle(d,p)),d=new y.a.Point(t+u+h/2+f-a,n-i/2-a),p=new y.a.Point(t+u+h/2+f+a,n+i/2+a),m=m.subtract(new y.a.Path.Rectangle(d,p)),s.addChild(m),d=new y.a.Point(t,n-c-i/2),p=new y.a.Point(t+u,n-c+i/2),m=new y.a.Path.Rectangle(d,p),d=new y.a.Point(t+u/3-a,n-c-i/2-a),p=new y.a.Point(t+u/3+a,n-c+i/2+a);var v=new y.a.Path.Rectangle(d,p);m=m.subtract(v),s.addChild(m),d=new y.a.Point(t+u-i/2,n-c-c/2),p=new y.a.Point(t+u+i/2,n-c+c/2),s.addChild(new y.a.Path.Rectangle(d,p)),d=new y.a.Point(t+u,n-c-c/2),p=new y.a.Point(t+u+h,n-c-c/2+i),s.addChild(new y.a.Path.Rectangle(d,p)),d=new y.a.Point(t+u+h-i,n-c-c/2),p=new y.a.Point(t+u+h,n-c+c/2),s.addChild(new y.a.Path.Rectangle(d,p)),d=new y.a.Point(t+u,n-c+c/2-i),p=new y.a.Point(t+u+h,n-c+c/2),m=new y.a.Path.Rectangle(d,p),d=new y.a.Point(t+h/2-f-a,n-c/2-i-a),p=new y.a.Point(t+h/2-f+a,n-c/2+a),m=m.subtract(new y.a.Path.Rectangle(d,p)),d=new y.a.Point(t+u+h/2-f-a,n-c/2-i-a),p=new y.a.Point(t+u+h/2-f+a,n-c/2+a),m=m.subtract(new y.a.Path.Rectangle(d,p)),d=new y.a.Point(t+u+h/2+f-a,n-c/2-i-a),p=new y.a.Point(t+u+h/2+f+a,n-c/2+a),m=m.subtract(new y.a.Path.Rectangle(d,p)),d=new y.a.Point(t+2*u+h/2+f-a,n-c/2-i-a),p=new y.a.Point(t+2*u+h/2+f+a,n-c/2+a),m=m.subtract(new y.a.Path.Rectangle(d,p)),s.addChild(m),d=new y.a.Point(t,n+c+i/2),p=new y.a.Point(t+u,n+c-i/2),m=new y.a.Path.Rectangle(d,p),d=new y.a.Point(t+u/3-a,n+c-i/2-a),p=new y.a.Point(t+u/3+a,n+c+i/2+
1a),m=m.subtract(new y.a.Path.Rectangle(d,p)),s.addChild(m),d=new y.a.Point(t+u-i/2,n+c+c/2),p=new y.a.Point(t+u+i/2,n+c-c/2),s.addChild(new y.a.Path.Rectangle(d,p)),d=new y.a.Point(t+u,n+c+c/2),p=new y.a.Point(t+u+h,n+c+c/2-i),s.addChild(new y.a.Path.Rectangle(d,p)),d=new y.a.Point(t+u+h-i,n+c+c/2),p=new y.a.Point(t+u+h,n+c-c/2),s.addChild(new y.a.Path.Rectangle(d,p)),d=new y.a.Point(t+u,n+c-c/2+i),p=new y.a.Point(t+u+h,n+c-c/2),m=new y.a.Path.Rectangle(d,p),d=new y.a.Point(t+h/2-f-a,n+c/2-a),p=new y.a.Point(t+h/2-f+a,n+c/2+i+a),m=m.subtract(new y.a.Path.Rectangle(d,p)),d=new y.a.Point(t+u+h/2-f-a,n+c/2-a),p=new y.a.Point(t+u+h/2-f+a,n+c/2+i+a),m=m.subtract(new y.a.Path.Rectangle(d,p)),d=new y.a.Point(t+u+h/2+f-a,n+c/2-a),p=new y.a.Point(t+u+h/2+f+a,n+c/2+i+a),m=m.subtract(new y.a.Path.Rectangle(d,p)),d=new y.a.Point(t+2*u+h/2+f-a,n+c/2-a),p=new y.a.Point(t+2*u+h/2+f+a,n+c/2+i+a),m=m.subtract(new y.a.Path.Rectangle(d,p)),s.addChild(m),d=new y.a.Point(t+u+h/2-i/2,n-c/2),p=new y.a.Point(t+u+h/2+i/2,n+c/2),m=new y.a.Path.Rectangle(d,p),d=new y.a.Point(t+u+h/2-i/2-a,n-c/2+4*o-a),p=new y.a.Point(t+u+h/2+i/2+a,n-c/2+4*o+a),m=m.subtract(new y.a.Path.Rectangle(d,p)),d=new y.a.Point(t+u+h/2-i/2-a,n+c/2-4*o-a),p=new y.a.Point(t+u+h/2+i/2+a,n+c/2-4*o+a),m=m.subtract(new y.a.Path.Rectangle(d,p)),s.addChild(m),d=new y.a.Point(t+h/2-i/2,n-c-c/4),p=new y.a.Point(t+h/2+i/2,n+c+c/4),m=new y.a.Path.Rectangle(d,p),d=new y.a.Point(t+h/2-i/2-a,n-c/2-5*o-a),p=new y.a.Point(t+h/2+i/2+a,n-c/2-5*o+a),m=m.subtract(new y.a.Path.Rectangle(d,p)),d=new y.a.Point(t+h/2-i/2-a,n-c/2+3*o-a),p=new y.a.Point(t+h/2+i/2+a,n-c/2+3*o+a),m=m.subtract(new y.a.Path.Rectangle(d,p)),d=new y.a.Point(t+h/2-i/2-a,n+c/2-3*o-a),p=new y.a.Point(t+h/2+i/2+a,n+c/2-3*o+a),m=m.subtract(new y.a.Path.Rectangle(d,p)),d=new y.a.Point(t+h/2-i/2-a,n+c/2+5*o-a),p=new y.a.Point(t+h/2+i/2+a,n+c/2+5*o+a),m=m.subtract(new y.a.Path.Rectangle(d,p)),s.addChild(m);var g=new y.a.Path.Circle(new y.a.Point(t+h/2,n-c-c/4),l);return s.addChild(g),g=new y.a.Path.Circle(new y.a.Point(t+h/2,n+c+c/4),l),s.addChild(g),d=new y.a.Point(t+2*u+h/2-i,n-c-c/4),p=new y.a.Point(t+2*u+h/2,n+c+c/4),m=new y.a.Path.Rectangle(d,p),d=new y.a.Point(t+2*u+h/2-i-a,n-c/2-2*o-a),p=new y.a.Point(t+2*u+h/2+a,n-c/2-2*o+a),m=m.subtract(new y.a.Path.Rectangle(d,p)),d=new y.a.Point(t+2*u+h/2-i-a,n-c/2+5*o-a),p=new y.a.Point(t+2*u+h/2+a,n-c/2+5*o+a),m=m.subtract(new y.a.Path.Rectangle(d,p)),d=new y.a.Point(t+2*u+h/2-i-a,n+c/2-5*o-a),p=new y.a.Point(t+2*u+h/2+a,n+c/2-5*o+a),m=m.subtract(new y.a.Path.Rectangle(d,p)),d=new y.a.Point(t+2*u+h/2-i-a,n+c/2+2*o-a),p=new y.a.Point(t+2*u+h/2+a,n+c/2+2*o+a),m=m.subtract(new y.a.Path.Rectangle(d,p)),s.addChild(m),g=new y.a.Path.Circle(new y.a.Point(t+2*u+h/2-i/2,n-c-c/4),l),s.addChild(g),g=new y.a.Path.Circle(new y.a.Point(t+2*u+h/2-i/2,n+c+c/4),l),s.addChild(g),s.fillColor=r,this.transformRender(e,s),s}},{key:"__drawControl",value:function(e){var t=e.position[0],n=e.position[1],r=e.color,o=e.componentSpacing,i=(e.chamberWidth,e.flowChannelWidth),a=e.controlChannelWidth,l=(e.portRadius,e.chamberLength,e.rotation,new y.a.CompoundPath(""),14*o),s=5*o,c=20*o,u=2*o,h=new y.a.CompoundPath(""),f=new y.a.Point(t+s/3-a/2,n-l-l/2-u),d=new y.a.Point(t+s/3+a/2,n-l);return h.addChild(new y.a.Path.Rectangle(f,d)),f=new y.a.Point(t+s/3-a,n-l-i/2-a),d=new y.a.Point(t+s/3+a,n-l+i/2+a),h.addChild(new y.a.Path.Rectangle(f,d)),f=new y.a.Point(t+2*s/3-a/2,n-l-l/2-u),d=new y.a.Point(t+2*s/3+a/2,n),h.addChild(new y.a.Path.Rectangle(f,d)),f=new y.a.Point(t+2*s/3-a,n-i/2-a),d=new y.a.Point(t+2*s/3+a,n+i/2+a),h.addChild(new y.a.Path.Rectangle(f,d)),f=new y.a.Point(t+s/3-a/2,n+l+l/2+u),d=new y.a.Point(t+s/3+a/2,n+l),h.addChild(new y.a.Path.Rectangle(f,d)),f=new y.a.Point(t+s/3-a,n+l-i/2-a),d=new y.a.Point(t+s/3+a,n+l+i/2+a),h.addChild(new y.a.Path.Rectangle(f,d)),f=new y.a.Point(t+2*s+c/2-i/2,n-l/2-2*o-a/2),d=new y.a.Point(t+s+c+u,n-l/2-2*o+a/2),h.addChild(new y.a.Path.Rectangle(f,d)),f=new y.a.Point(t+2*s+c/2-i-a,n-l/2-2*o-a),d=new y.a.Point(t+2*s+c/2+a,n-l/2-2*o+a),h.addChild(new y.a.Path.Rectangle(f,d)),f=new y.a.Point(t+s+c/2+u,n-l/2-3*o-a/2),d=new y.a.Point(t+s+c+u,n-l/2-3*o+a/2),h.addChild(new y.a.Path.Rectangle(f,d)),f=new y.a.Point(t+s+c/2+u-a/2,n-l/2-3*o-a/2),d=new y.a.Point(t+s+c/2+u+a/2,n-l/2),h.addChild(new y.a.Path.Rectangle(f,d)),f=new y.a.Point(t+s+c/2+u-a,n-l/2-i-a),d=new y.a.Point(t+s+c/2+u+a,n-l/2+a),h.addChild(new y.a.Path.Rectangle(f,d)),f=new y.a.Point(t+s+c/2-u,n-l/2-4*o-a/2),d=new y.a.Point(t+s+c+u,n-l/2-4*o+a/2),h.addChild(new y.a.Path.Rectangle(f,d)),f=new y.a.Point(t+s+c/2-u-a/2,n-l/2-4*o-a/2),d=new y.a.Point(t+s+c/2-u+a/2,n-l/2),h.addChild(new y.a.Path.Rectangle(f,d)),f=new y.a.Point(t+s+c/2-u-a,n-l/2-i-a),d=new y.a.Point(t+s+c/2-u+a,n-l/2+a),h.addChild(new y.a.Path.Rectangle(f,d)),f=new y.a.Point(t+c/2,n-l/2-5*o-a/2),d=new y.a.Point(t+s+c+u,n-l/2-5*o+a/2),h.addChild(new y.a.Path.Rectangle(f,d)),f=new y.a.Point(t+c/2-i/2-a,n-l/2-5*o-a),d=new y.a.Point(t+c/2+i/2+a,n-l/2-5*o+a),h.addChild(new y.a.Path.Rectangle(f,d)),f=new y.a.Point(t+c/2-u,n-l/2-6*o-a/2),d=new y.a.Point(t+s+c+u,n-l/2-6*o+a/2),h.addChild(new y.a.Path.Rectangle(f,d)),f=new y.a.Point(t+c/2-u-a/2,n-l/2-6*o-a/2),d=new y.a.Point(t+c/2-u+a/2,n-l/2),h.addChild(new y.a.Path.Rectangle(f,d)),f=new y.a.Point(t+c/2-u-a,n-l/2-i-a),d=new y.a.Point(t+c/2-u+a,n-l/2+a),h.addChild(new y.a.Path.Rectangle(f,d)),f=new y.a.Point(t+2*s+c/2-i/2,n+l/2+2*o+a/2),d=new y.a.Point(t+s+c+u,n+l/2+2*o-a/2),h.addChild(new y.a.Path.Rectangle(f,d)),f=new y.a.Point(t+2*s+c/2-i-a,n+l/2+2*o-a),d=new y.a.Point(t+2*s+c/2+a,n+l/2+2*o+a),h.addChild(new y.a.Path.Rectangle(f,d)),f=new y.a.Point(t+s+c/2+u,n+l/2+3*o+a/2),d=new y.a.Point(t+s+c+u,n+l/2+3*o-a/2),h.addChild(new y.a.Path.Rectangle(f,d)),f=new y.a.Point(t+s+c/2+u-a/2,n+l/2+3*o+a/2),d=new y.a.Point(t+s+c/2+u+a/2,n+l/2),h.addChild(new y.a.Path.Rectangle(f,d)),f=new y.a.Point(t+s+c/2+u-a,n+l/2-a),d=new y.a.Point(t+s+c/2+u+a,n+l/2+i+a),h.addChild(new y.a.Path.Rectangle(f,d)),f=new y.a.Point(t+s+c/2-u,n+l/2+4*o+a/2),d=new y.a.Point(t+s+c+u,n+l/2+4*o-a/2),h.addChild(new y.a.Path.Rectangle(f,d)),f=new y.a.Point(t+s+c/2-u-a/2,n+l/2+4*o+a/2),d=new y.a.Point(t+s+c/2-u+a/2,n+l/2),h.addChild(new y.a.Path.Rectangle(f,d)),f=new y.a.Point(t+s+c/2-u-a,n+l/2-a),d=new y.a.Point(t+s+c/2-u+a,n+l/2+i+a),h.addChild(new y.a.Path.Rectangle(f,d)),f=new y.a.Point(t+c/2,n+l/2+5*o+a/2),d=new y.a.Point(t+s+c+u,n+l/2+5*o-a/2),h.addChild(new y.a.Path.Rectangle(f,d)),f=new y.a.Point(t+c/2-i/2-a,n+l/2+5*o-a),d=new y.a.Point(t+c/2+i/2+a,n+l/2+5*o+a),h.addChild(new y.a.Path.Rectangle(f,d)),f=new y.a.Point(t+c/2-u,n+l/2+6*o+a/2),d=new y.a.Point(t+s+c+u,n+l/2+6*o-a/2),h.addChild(new y.a.Path.Rectangle(f,d)),f=new y.a.Point(t+c/2-u-a/2,n+l/2+6*o+a/2),d=new y.a.Point(t+c/2-u+a/2,n+l/2),h.addChild(new y.a.Path.Rectangle(f,d)),f=new y.a.Point(t+c/2-u-a,n+l/2-a),d=new y.a.Point(t+c/2-u+a,n+l/2+i+a),h.addChild(new y.a.Path.Rectangle(f,d)),f=new y.a.Point(t+2*s+c/2+u,n-l/2+2*o-a/2),d=new y.a.Point(t+s+c+u,n-l/2+2*o+a/2),h.addChild(new y.a.Path.Rectangle(f,d)),f=new y.a.Point(t+2*s+c/2+u-a/2,n-l/2),d=new y.a.Point(t+2*s+c/2+u+a/2,n-l/2+2*o+a/2),h.addChild(new y.a.Path.Rectangle(f,d)),f=new y.a.Point(t+2*s+c/2+u-a,n-l/2-i-a),d=new y.a.Point(t+2*s+c/2+u+a,n-l/2+a),h.addChild(new y.a.Path.Rectangle(f,d)),f=new y.a.Point(t+2*s+c/2+u,n+l/2-2*o-a/2),d=new y.a.Point(t+s+c+u,n+l/2-2*o+a/2),h.addChild(new y.a.Path.Rectangle(f,d)),f=new y.a.Point(t+2*s+c/2+u-a/2,n+l/2),d=new y.a.Point(t+2*s+c/2+u+a/2,n+l/2-2*o-a/2),h.addChild(new y.a.Path.Rectangle(f,d)),f=new y.a.Point(t+2*s+c/2+u-a,n+l/2-a),d=new y.a.Point(t+2*s+c/2+u+a,n+l/2+i+a),h.addChild(new y.a.Path.Rectangle(f,d)),f=new y.a.Point(t+c/2,n-l/2+3*o-a/2),d=new y.a.Point(t+s+c+u,n-l/2+3*o+a/2),h.addChild(new y.a.Path.Rectangle(f,d)),f=new y.a.Point(t+c/2-i/2-a,n-l/2+3*o-a),d=new y.a.Point(t+c/2+i/2+a,n-l/2+3*o+a),h.addChild(new y.a.Path.Rectangle(f,d)),f=new y.a.Point(t+c/2,n+l/2-3*o-a/2),d=new y.a.Point(t+s+c+u,n+l/2-3*o+a/2),h.addChild(new y.a.Path.Rectangle(f,d)),f=new y.a.Point(t+c/2-i/2-a,n+l/2-3*o-a),d=new y.a.Point(t+c/2+i/2+a,n+l/2-3*o+a),h.addChild(new y.a.Path.Rectangle(f,d)),f=new y.a.Point(t+s+c/2,n-l/2+4*o-a/2),d=new y.a.Point(t+s+c+u,n-l/2+4*o+a/2),h.addChild(new y.a.Path.Rectangle(f,d)),f=new y.a.Point(t+s+c/2-i/2-a,n-l/2+4*o-a),d=new y.a.Point(t+s+c/2+i/2+a,n-l/2+4*o+a),h.addChild(new y.a.Path.Rectangle(f,d)),f=new y.a.Point(t+s+c/2,n+l/2-4*o-a/2),d=new y.a.Point(t+s+c+u,n+l/2-4*o+a/2),h.addChild(new y.a.Path.Rectangle(f,d)),f=new y.a.Point(t+s+c/2-i/2-a,n+l/2-4*o-a),d=new y.a.Point(t+s+c/2+i/2+a,n+l/2-4*o+a),h.addChild(new y.a.Path.Rectangle(f,d)),f=new y.a.Point(t+2*s+c/2,n-l/2+5*o-a/2),d=new y.a.Point(t+s+c+u,n-l/2+5*o+a/2),h.addChild(new y.a.Path.Rectangle(f,d)),f=new y.a.Point(t+2*s+c/2-i-a,n-l/2+5*o-a),d=new y.a.Point(t+2*s+c/2+a,n-l/2+5*o+a),h.addChild(new y.a.Path.Rectangle(f,d)),f=new y.a.Point(t+2*s+c/2,n+l/2-5*o-a/2),d=new y.a.Point(t+s+c+u,n+l/2-5*o+a/2),h.addChild(new y.a.Path.Rectangle(f,d)),f=new y.a.Point(t+2*s+c/2-i-a,n+l/2-5*o-a),d=new y.a.Point(t+2*s+c/2+a,n+l/2-5*o+a),h.addChild(new y.a.Path.Rectangle(f,d)),f=new y.a.Point(t+s+c/2-u,n-l/2+6*o-a/2),d=new y.a.Point(t+s+c+u,n-l/2+6*o+a/2),h.addChild(new y.a.Path.Rectangle(f,d)),f=new y.a.Point(t+s+c/2-u-a/2,n-l/2+6*o-a/2),d=new y.a.Point(t+s+c/2-u+a/2,n+a/2),h.addChild(new y.a.Path.Rectangle(f,d)),f=new y.a.Point(t+s+c/2-u-a,n-i/2-a),d=new y.a.Point(t+s+c/2-u+a,n+i/2+a),h.addChild(new y.a.Path.Rectangle(f,d)),f=new y.a.Point(t+s+c/2+u,n+l/2-6*o-a/2),d=new y.a.Point(t+s+c+u,n+l/2-6*o+a/2),h.addChild(new y.a.Path.Rectangle(f,d)),f=new y.a.Point(t+s+c/2+u-a/2,n),d=new y.a.Point(t+s+c/2+u+a/2,n+l/2-6*o+a/2),h.addChild(new y.a.Path.Rectangle(f,d)),f=new y.a.Point(t+s+c/2+u-a,n-i/2-a),d=new y.a.Point(t+s+c/2+u+a,n+i/2+a),h.addChild(new y.a.Path.Rectangle(f,d)),h.fillColor=r,this.transformRender(e,h),h}},{key:"getPorts",value:function(e){var t=[],n=(e.chamberWidth,e.flowChannelWidth,e.controlChannelWidth,e.portRadius,e.chamberLength,e.rotation,e.componentSpacing),r=14*n,i=5*n,a=20*n,l=2*n;return t.push(new b(0,-r,"1",o.FLOW)),t.push(new b(0,0,"2",o.FLOW)),t.push(new b(0,r,"3",o.FLOW)),t.push(new b(i+a+l,-r/2-6*n,"4",o.CONTROL)),t.push(new b(i+a+l,-r/2-5*n,"5",o.CONTROL)),t.push(new b(i+a+l,-r/2-4*n,"6",o.CONTROL)),t.push(new b(i+a+l,-r/2-3*n,"7",o.CONTROL)),t.push(new b(i+a+l,-r/2-2*n,"8",o.CONTROL)),t.push(new b(i+a+l,-r/2+2*n,"9",o.CONTROL)),t.push(new b(i+a+l,-r/2+3*n,"10",o.CONTROL)),t.push(new b(i+a+l,-r/2+4*n,"11",o.CONTROL)),t.push(new b(i+a+l,-r/2+5*n,"12",o.CONTROL)),t.push(new b(i+a+l,-r/2+6*n,"13",o.CONTROL)),t.push(new b(i+a+l,r/2-6*n,"14",o.CONTROL)),t.push(new b(i+a+l,r/2-5*n,"15",o.CONTROL)),t.push(new b(i+a+l,r/2-4*n,"16",o.CONTROL)),t.push(new b(i+a+l,r/2-3*n,"17",o.CONTROL)),t.push(new b(i+a+l,r/2-2*n,"18",o.CONTROL)),t.push(new b(i+a+l,r/2+2*n,"19",o.CONTROL)),t.push(new b(i+a+l,r/2+3*n,"20",o.CONTROL)),t.push(new b(i+a+l,r/2+4*n,"21",o.CONTROL)),t.push(new b(i+a+l,r/2+5*n,"22",o.CONTROL)),t.push(new b(i+a+l,r/2+6*n,"23",o.CONTROL)),t.push(new b(i/3,-r-r/2-l,"24",o.CONTROL)),t.push(new b(2*i/3,-r-r/2-l,"25",o.CONTROL)),t.push(new b(i/3,r+r/2+l,"26",o.CONTROL)),t}},{key:"__drawCell",value:function(e){var t=e.position[0],n=e.position[1],r=e.color,o=e.componentSpacing,i=e.chamberWidth,a=e.flowChannelWidth,l=(e.controlChannelWidth,e.portRadius,e.chamberLength),s=(e.rotation,new y.a.CompoundPath(""),14*o),c=5*o,u=20*o,h=new y.a.CompoundPath(""),f=new y.a.Point(t+u/2-i/2,n-s/2-l/2-a/2),d=new y.a.Point(t+u/2+i/2,n-s/2+l/2-a/2);return h.addChild(new y.a.Path.Rectangle(f,d)),f=new y.a.Point(t+2*c+u/2-i/2-a/2,n-s/2-l/2-a/2),d=new y.a.Point(t+2*c+u/2+i/2-a/2,n-s/2+l/2-a/2),h.addChild(new y.a.Path.Rectangle(f,d)),f=new y.a.Point(t+u/2-i/2,n+s/2-l/2+a/2),d=new y.a.Point(t+u/2+i/2,n+s/2+l/2+a/2),h.addChild(new y.a.Path.Rectangle(f,d)),f=new y.a.Point(t+2*c+u/2-i/2-a/2,n+s/2-l/2+a/2),d=new y.a.Point(t+2*c+u/2+i/2-a/2,n+s/2+l/2+a/2),h.addChild(new y.a.Path.Rectangle(f,d)),h.fillColor=r,this.transformRender(e,h),h}},{key:"render2DTarget",value:function(e,t){var n=this.__drawFlow(t);return n.addChild(this.__drawControl(t)),n.addChild(this.__drawCell(t)),n.fillColor.alpha=.5,n}}]),n}(R);function eu(e){return eu="function"===typeof Symbol&&"symbol"===typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"===typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},eu(e)}function tu(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function nu(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function ru(e,t,n){return t&&nu(e.prototype,t),n&&nu(e,n),e}function ou(e,t){if("function"!==typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&iu(e,t)}function iu(e,t){return iu=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},iu(e,t)}function au(e){var t=cu();return function(){var n,r=uu(e);
1if(t){var o=uu(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return lu(this,n)}}function lu(e,t){if(t&&("object"===eu(t)||"function"===typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return su(e)}function su(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function cu(){if("undefined"===typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"===typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}function uu(e){return uu=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},uu(e)}var hu=function(e){ou(n,e);var t=au(n);function n(){return tu(this,n),t.call(this)}return ru(n,[{key:"__setupDefinitions",value:function(){this.__unique={position:"Point"},this.__heritable={componentSpacing:"Float",neckAngle:"Float",neckLength:"Float",neckWidth:"Float",numberOfMixers:"Float",channelWidth:"Float",innerDiameter:"Float",rotation:"Float",height:"Float",mirrorByX:"Float",mirrorByY:"Float"},this.__defaults={componentSpacing:2e3,rotation:0,channelWidth:Ce,neckAngle:120,neckLength:1e3,neckWidth:800,numberOfMixers:1,innerDiameter:2460,height:250,mirrorByX:0,mirrorByY:0},this.__units={componentSpacing:"μm",rotation:"°",neckAngle:"°",neckLength:"μm",neckWidth:"μm",numberOfMixers:"",channelWidth:"μm",innerDiameter:"μm",height:"μm"},this.__minimum={componentSpacing:0,rotation:0,channelWidth:10,neckAngle:0,neckLength:0,neckWidth:10,numberOfMixers:1,innerDiameter:10,height:10,mirrorByX:0,mirrorByY:0},this.__maximum={componentSpacing:1e4,rotation:360,channelWidth:2e3,neckAngle:360,neckLength:1e4,neckWidth:2e3,numberOfMixers:20,innerDiameter:12e3,height:1200,mirrorByX:1,mirrorByY:1},this.__featureParams={componentSpacing:"componentSpacing",position:"position",channelWidth:"channelWidth",neckAngle:"neckAngle",neckLength:"neckLength",neckWidth:"neckWidth",numberOfMixers:"numberOfMixers",rotation:"rotation",innerDiameter:"innerDiameter",mirrorByX:"mirrorByX",mirrorByY:"mirrorByY"},this.__targetParams={componentSpacing:"componentSpacing",channelWidth:"channelWidth",neckAngle:"neckAngle",neckLength:"neckLength",neckWidth:"neckWidth",numberOfMixers:"numberOfMixers",rotation:"rotation",innerDiameter:"innerDiameter",mirrorByX:"mirrorByX",mirrorByY:"mirrorByY"},this.__placementTool="componentPositionTool",this.__toolParams={position:"position"},this.__renderKeys=["FLOW"],this.__mint="TOROIDAL MIXER",this.__zOffsetKeys={FLOW:"height"},this.__substrateOffset={FLOW:"0"}}},{key:"getPorts",value:function(e){var t=e.position[1],n=e.channelWidth,r=e.innerDiameter,i=e.neckLength,a=e.neckAngle,l=e.numberOfMixers,s=t+Math.abs((i+n+.5*r)*Math.sin(.5*a*Math.PI/180)),c=2*(s-t),u=i*Math.sin(.5*a*Math.PI/180),h=[];return h.push(new b(0,0,"1",o.FLOW)),l%2==1?h.push(new b(0,(l-1)*c-(l-2)*u+c-i*Math.sin(.5*a*Math.PI/180),"2",o.FLOW)):h.push(new b(-1*i*Math.cos(.5*a*Math.PI/180),(l-1)*c-(l-2)*u+c-i*Math.sin(.5*a*Math.PI/180),"2",o.FLOW)),h}},{key:"render2D",value:function(e,t){var n,r=e.channelWidth,o=e.innerDiameter,i=e.neckAngle,a=e.neckWidth,l=(e.rotation,e.neckLength),s=e.numberOfMixers,c=e.position[0],u=e.position[1],h=e.color,f=new y.a.CompoundPath([]),d=c-(l+r+.5*o)*Math.cos(.5*i*Math.PI/180),p=u+Math.abs((l+r+.5*o)*Math.sin(.5*i*Math.PI/180)),m=new y.a.Point(d,p),v=2*(p-u),g=l*Math.sin(.5*i*Math.PI/180),w=new y.a.Path.Circle(m,.5*o+r),b=new y.a.Path.Circle(m,.5*o);n=w.subtract(b);var _,P,C,O,S=new y.a.Path.Rectangle(new y.a.Point(c-l-r,u-.5*a),new y.a.Size(l+r,a));S.rotate(-1*i/2,new y.a.Point(c,u)),n=n.unite(S),S=new y.a.Path.Rectangle(new y.a.Point(c-l-r,u-.5*a+v),new y.a.Size(l+r,a)),S.rotate(i/2,new y.a.Point(c,u+v)),n=n.unite(S);for(var D=s-1,R=1;R<=D;R++)_=u+R*v-(R-1)*g,R%2==1?(P=c+(r+.5*o)*Math.cos(.5*i*Math.PI/180),C=_+Math.abs((r+.5*o)*Math.sin(.5*i*Math.PI/180)),O=new y.a.Point(P,C),w=new y.a.Path.Circle(O,.5*o+r),b=new y.a.Path.Circle(O,.5*o),n=n.unite(w.subtract(b)),S=new y.a.Path.Rectangle(new y.a.Point(c,_-.5*a),new y.a.Size(r,a)),S.rotate(i/2,new y.a.Point(c,_)),n=n.unite(S),S=new y.a.Path.Rectangle(new y.a.Point(c-l,_-.5*a+(2*r+o)*Math.sin(.5*i*Math.PI/180)
1),new y.a.Size(l+r,a)),S.rotate(-1*i/2,new y.a.Point(c,_+(2*r+o)*Math.sin(.5*i*Math.PI/180))),n=n.unite(S)):(C=_+Math.abs((r+.5*o)*Math.sin(.5*i*Math.PI/180)),O=new y.a.Point(d,C),w=new y.a.Path.Circle(O,.5*o+r),b=new y.a.Path.Circle(O,.5*o),n=n.unite(w.subtract(b)),S=new y.a.Path.Rectangle(new y.a.Point(c-r-l*Math.cos(.5*i*Math.PI/180),_-.5*a),new y.a.Size(r,a)),S.rotate(-1*i/2,new y.a.Point(c-l*Math.cos(.5*i*Math.PI/180),_)),n=n.unite(S),S=new y.a.Path.Rectangle(new y.a.Point(c-l-r,_-.5*a+v-l*Math.sin(.5*i*Math.PI/180)),new y.a.Size(l+r,a)),S.rotate(i/2,new y.a.Point(c,_+v-l*Math.sin(.5*i*Math.PI/180))),n=n.unite(S));return f.addChild(n),f.fillColor=h,this.transformRender(e,f),f}},{key:"render2DTarget",value:function(e,t){null===e&&(e=this.__renderKeys[0]);var n=this.render2D(t,e);return null!==n.fillColor&&(n.fillColor.alpha=.5),n}}]),n}(R);function fu(e){return fu="function"===typeof Symbol&&"symbol"===typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"===typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},fu(e)}function du(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function pu(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function yu(e,t,n){return t&&pu(e.prototype,t),n&&pu(e,n),e}function mu(e,t){if("function"!==typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&vu(e,t)}function vu(e,t){return vu=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},vu(e,t)}function gu(e){var t=_u();return function(){var n,r=Pu(e);if(t){var o=Pu(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return wu(this,n)}}function wu(e,t){if(t&&("object"===fu(t)||"function"===typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return bu(e)}function bu(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function _u(){if("undefined"===typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"===typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}function Pu(e){return Pu=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},Pu(e)}var Cu=function(e){mu(n,e);var t=gu(n);function n(){return du(this,n),t.call(this)}return yu(n,[{key:"__setupDefinitions",value:function(){this.__unique={position:"Point"},this.__heritable={componentSpacing:"Float",rotation:"Float",length:"Float",innerRadius:"Float",outerRadius:"Float",height:"Float",mirrorByX:"Float",mirrorByY:"Float"},this.__defaults={componentSpacing:2e3,rotation:0,innerRadius:400,outerRadius:800,length:7200,height:250,mirrorByX:0,mirrorByY:0},this.__units={componentSpacing:"μm",rotation:"°",length:"μm",innerRadius:"μm",outerRadius:"μm",height:"μm"},this.__minimum={componentSpacing:0,innerRadius:1,outerRadius:1,length:120,height:10,rotation:0,mirrorByX:0,mirrorByY:0},this.__maximum={componentSpacing:1e4,innerRadius:1e3,outerRadius:1e3,length:24e3,height:1200,rotation:360,mirrorByX:1,mirrorByY:1},this.__featureParams={componentSpacing:"componentSpacing",position:"position",rotation:"rotation",length:"length",innerRadius:"innerRadius",outerRadius:"outerRadius",mirrorByX:"mirrorByX",mirrorByY:"mirrorByY"},this.__targetParams={componentSpacing:"componentSpacing",length:"length",innerRadius:"innerRadius",outerRadius:"outerRadius",rotation:"rotation",mirrorByX:"mirrorByX",mirrorByY:"mirrorByY"},this.__placementTool="componentPositionTool",this.__toolParams={position:"position"},this.__renderKeys=["FLOW"],this.__mint="DOGBONE INSERT",this.__zOffsetKeys={FLOW:"height"},this.__substrateOffset={FLOW:"0"}}},{key:"getPorts",value:function(e){var t=e.length,n=[];return n.push(new b(-t/2,0,"1",o.FLOW)),n.push(new b(t/2,0,"2",o.FLOW)),n}},{key:"render2D",value:function(e,t){var n=e.position,r=n[0],o=n[1],i=e.length,a=e.innerRadius,l=e.outerRadius,s=(e.rotation,e.color),c=i+2*a+2*l,u=2*a+4*l,h=new y.a.CompoundPath([]),f=new y.a.PathItem,d=new y.a.Path.Rectangle(new y.a.Point(r-c/2+l,o-u/2),new y.a.Size(c-2*l,u)),p=new y.a.Path.Arc({from:[r-c/2+l,o+u/2],through:[r-c/2,o+u/2-l],to:[r-c/2+l,o+a]});return p.closed=!0,f=d.unite(p),p=new y.a.Path.Arc({from:[r-c/2+l,o-u/2],through:[r-c/2,o-u/2+l],to:[r-c/2+l,o-a]}),p.closed=!0,f=f.unite(p),p=new y.a.Path.Arc({from:[r+c/2-l,o+u/2],through:[r+c/2,o+u/2-l],to:[r+c/2-l,o+a]}),p.closed=!0,f=f.unite(p),p=new y.a.Path.Arc({from:[r+c/2-l,o-u/2],through:[r+c/2,o-u/2+l],to:[r+c/2-l,o-a]}),p.closed=!0,f=f.unite(p),p=new y.a.Path.Arc({from:[r-c/2+l,o+a],through:[r-c/2+a+l,o],to:[r-c/2+l,o-a]}),p.closed=!0,f=f.subtract(p),p=new y.a.Path.Arc({from:[r+c/2-l,o+a],through:[r+c/2-a-l,o],to:[r+c/2-l,o-a]}),p.closed=!0,f=f.subtract(p),h.addChild(f),h.fillColor=s,this.transformRender(e,h),h}},{key:"render2DTarget",value:function(e,t){null===e&&(e=this.__renderKeys[0]);var n=this.render2D(t,e);return n.fillColor.alpha=.5,n}}]),n}(R);function Ou(e){return Ou="function"===typeof Symbol&&"symbol"===typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"===typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Ou(e)}function Su(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Du(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function Ru(e,t,n){return t&&Du(e.prototype,t),n&&Du(e,n),e}function Tu(e,t){if("function"!==typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&Lu(e,t)}function Lu(e,t){return Lu=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},Lu(e,t)}function Fu(e){var t=Nu();return function(){var n,r=xu(e);if(t){var o=xu(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return ku(this,n)}}function ku(e,t){if(t&&("object"===Ou(t)||"function"===typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return Eu(e)}function Eu(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}
1function Nu(){if("undefined"===typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"===typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}function xu(e){return xu=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},xu(e)}var Mu=function(e){Tu(n,e);var t=Fu(n);function n(){return Su(this,n),t.call(this)}return Ru(n,[{key:"__setupDefinitions",value:function(){this.__unique={position:"Point"},this.__heritable={componentSpacing:"Float",width:"Float",length:"Float",height:"Float",cornerRadius:"Float",rotation:"Float",mirrorByX:"Float",mirrorByY:"Float"},this.__defaults={componentSpacing:2e3,width:5e3,length:5e3,height:250,cornerRadius:200,rotation:0,mirrorByX:0,mirrorByY:0},this.__units={componentSpacing:"μm",width:"μm",length:"μm",height:"μm",cornerRadius:"μm",rotation:"°"},this.__minimum={componentSpacing:0,width:5,length:5,height:1,cornerRadius:1,rotation:0,mirrorByX:0,mirrorByY:0},this.__maximum={componentSpacing:1e4,width:5e4,length:5e4,height:5e4,cornerRadius:1e3,rotation:360,mirrorByX:1,mirrorByY:1},this.__featureParams={componentSpacing:"componentSpacing",position:"position",width:"width",length:"length",height:"height",cornerRadius:"cornerRadius",rotation:"rotation",mirrorByX:"mirrorByX",mirrorByY:"mirrorByY"},this.__targetParams={componentSpacing:"componentSpacing",position:"position",width:"width",length:"length",height:"height",cornerRadius:"cornerRadius",rotation:"rotation",mirrorByX:"mirrorByX",mirrorByY:"mirrorByY"},this.__placementTool="componentPositionTool",this.__toolParams={position:"position"},this.__renderKeys=["FLOW"],this.__mint="BLACK BOX",this.__zOffsetKeys={FLOW:"height"},this.__substrateOffset={FLOW:"0"}}},{key:"getPorts",value:function(e){var t=e.length,n=e.width,r=[];return r.push(new b(0,-t/2,"1",o.FLOW)),r.push(new b(n/2,0,"2",o.FLOW)),r.push(new b(0,t/2,"3",o.FLOW)),r.push(new b(-n/2,0,"4",o.FLOW)),r}},{key:"render2D",value:function(e,t){var n=e.position,r=n[0],o=n[1],i=e.length,a=e.width,l=(e.rotation,e.color),s=(e.cornerRadius,new y.a.CompoundPath("")),c=new y.a.Path.Rectangle({point:new y.a.Point(r-a/2,o-i/2),size:[a,i]}),u=new y.a.Point(r,o),h=new y.a.Path.Circle(u,500),f=c.subtract(h);return s.addChild(f),s.fillColor=l,this.transformRender(e,s),s}},{key:"render2DTarget",value:function(e,t){null===e&&(e=this.__renderKeys[0]);var n=this.render2D(t,e);return n.fillColor.alpha=.5,n}}]),n}(R);function Iu(e){return Iu="function"===typeof Symbol&&"symbol"===typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"===typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Iu(e)}function Wu(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Au(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function ju(e,t,n){return t&&Au(e.prototype,t),n&&Au(e,n),e}function Bu(e,t,n){return Bu="undefined"!==typeof Reflect&&Reflect.get?Reflect.get:function(e,t,n){var r=Vu(e,t);if(r){var o=Object.getOwnPropertyDescriptor(r,t);return o.get?o.get.call(n):o.value}},Bu(e,t,n||e)}function Vu(e,t){while(!Object.prototype.hasOwnProperty.call(e,t))if(e=Ku(e),null===e)break;return e}function Xu(e,t){if("function"!==typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&Yu(e,t)}function Yu(e,t){return Yu=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},Yu(e,t)}function Gu(e){var t=Hu();return function(){var n,r=Ku(e);if(t){var o=Ku(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return Uu(this,n)}}function Uu(e,t){if(t&&("object"===Iu(t)||"function"===typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return zu(e)}function zu(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Hu(){if("undefined"===typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"===typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}function Ku(e){return Ku=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},Ku(e)}var qu=function(e){Xu(n,e);var t=Gu(n);function n(){return Wu(this,n),t.apply(this,arguments)}return ju(n,[{key:"__setupDefinitions",value:function(){Bu(Ku(n.prototype),"__setupDefinitions",this).call(this),this.__mint="DIYCOMPONENT"}}]),n}(Mu);function Ju(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Zu(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function $u(e,t,n){return t&&Zu(e.prototype,t),n&&Zu(e,n),e}var Qu=function(){function e(){Ju(this,e),this._macro="FeatureTemplate",this._geometricOperation=a.UNION,this.__unique=null,this.__heritable=null,this.__defaults=null,this.__minimum=null,this.__maximum=null,this.__units=null,this.__toolParams=null,this.__featureParam
1s=null,this.__targetParams=null,this.__zOffsetKeys=null,this.__substrateOffset=null,this.__setupDefinitions(),this.__checkDefinitions()}return $u(e,[{key:"__setupDefinitions",value:function(){throw new Error("Method not implemented.")}},{key:"__checkDefinitions",value:function(){if(null===this._macro)throw new Error("Macro not defined: "+this._macro);if(null===this.__unique)throw new Error("Unique parameters not defined: "+this._macro);if(null===this.__heritable)throw new Error("Heritable parameters not defined: "+this._macro);if(null===this.__defaults)throw new Error("Default parameters not defined: "+this._macro);if(null===this.__minimum)throw new Error("Minimum parameters not defined: "+this._macro);if(null===this.__maximum)throw new Error("Maximum parameters not defined: "+this._macro);if(null===this.__units)throw new Error("Units not defined: "+this._macro);if(null===this.__toolParams)throw new Error("Tool parameters not defined: "+this._macro);if(null===this.__featureParams)throw new Error("Feature parameters not defined: "+this._macro);if(null===this.__targetParams)throw new Error("Target parameters not defined: "+this._macro)}},{key:"geometricOperation",get:function(){return this._geometricOperation}},{key:"macro",get:function(){return this._macro}},{key:"render2d",value:function(e){throw new Error("Method not implemented.")}}]),e}();function eh(e){return eh="function"===typeof Symbol&&"symbol"===typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"===typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},eh(e)}function th(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function nh(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function rh(e,t,n){return t&&nh(e.prototype,t),n&&nh(e,n),e}function oh(e,t){if("function"!==typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&ih(e,t)}function ih(e,t){return ih=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},ih(e,t)}function ah(e){var t=ch();return function(){var n,r=uh(e);if(t){var o=uh(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return lh(this,n)}}function lh(e,t){if(t&&("object"===eh(t)||"function"===typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return sh(e)}function sh(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function ch(){if("undefined"===typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"===typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}function uh(e){return uh=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},uh(e)}var hh=function(e){oh(n,e);var t=ah(n);function n(){return th(this,n),t.call(this)}return rh(n,[{key:"__setupDefinitions",value:function(){this._macro="VALVE3D FLOW",this.__unique={position:"Point"},this.__heritable={componentSpacing:"Float",rotation:"Float",valveRadius:"Float",height:"Float",gap:"Float",width:"Float",length:"Float"},this.__defaults={componentSpacing:2e3,rotation:0,valveRadius:1200,height:250,gap:600,width:2400,length:2400},this.__units={componentSpacing:"μm",valveRadius:"μm",height:"μm",gap:"μm",width:"μm",length:"μm",rotation:"°"},this.__minimum={componentSpacing:0,valveRadius:10,height:10,gap:5,rotation:0,width:10,length:10},this.__maximum={componentSpacing:1e4,valveRadius:3e3,height:1200,gap:1e3,rotation:180,width:3e3,length:3e3},this.__featureParams={componentSpacing:"componentSpacing",position:"position",rotation:"rotation",radius1:"valveRadius",radius2:"valveRadius",valveRadius:"valveRadius",gap:"gap"},this.__targetParams={componentSpacing:"componentSpacing",position:"position",rotation:"rotation",radius1:"valveRadius",radius2:"valveRadius",valveRadius:"valveRadius",gap:"gap"},this.__toolParams={position:"position"},this._geometricOperation=a.UNION}}]),n}(Qu);function fh(e){return fh="function"===typeof Symbol&&"symbol"===typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"===typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},fh(e)}function dh(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function ph(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}
1function yh(e,t,n){return t&&ph(e.prototype,t),n&&ph(e,n),e}function mh(e,t){if("function"!==typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&vh(e,t)}function vh(e,t){return vh=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},vh(e,t)}function gh(e){var t=_h();return function(){var n,r=Ph(e);if(t){var o=Ph(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return wh(this,n)}}function wh(e,t){if(t&&("object"===fh(t)||"function"===typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return bh(e)}function bh(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function _h(){if("undefined"===typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"===typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}function Ph(e){return Ph=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},Ph(e)}var Ch=function(e){mh(n,e);var t=gh(n);function n(){return dh(this,n),t.call(this)}return yh(n,[{key:"__setupDefinitions",value:function(){this._macro="VALVE3D GAP",this.__unique={position:"Point"},this.__heritable={componentSpacing:"Float",rotation:"Float",valveRadius:"Float",height:"Float",gap:"Float",width:"Float",length:"Float"},this.__defaults={componentSpacing:2e3,rotation:0,valveRadius:1200,height:250,gap:600,width:2400,length:2400},this.__units={componentSpacing:"μm",valveRadius:"μm",height:"μm",gap:"μm",width:"μm",length:"μm",rotation:"°"},this.__minimum={componentSpacing:0,valveRadius:10,height:10,gap:5,rotation:0,width:10,length:10},this.__maximum={componentSpacing:1e4,valveRadius:3e3,height:1200,gap:1e3,rotation:180,width:3e3,length:3e3},this.__featureParams={componentSpacing:"componentSpacing",position:"position",rotation:"rotation",radius1:"valveRadius",radius2:"valveRadius",valveRadius:"valveRadius",gap:"gap"},this.__targetParams={componentSpacing:"componentSpacing",position:"position",rotation:"rotation",radius1:"valveRadius",radius2:"valveRadius",valveRadius:"valveRadius",gap:"gap"},this.__toolParams={position:"position"},this._geometricOperation=a.DIFFERENCE}}]),n}(Qu);function Oh(e){return Oh="function"===typeof Symbol&&"symbol"===typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"===typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Oh(e)}function Sh(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Dh(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function Rh(e,t,n){return t&&Dh(e.prototype,t),n&&Dh(e,n),e}function Th(e,t){if("function"!==typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&Lh(e,t)}function Lh(e,t){return Lh=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},Lh(e,t)}function Fh(e){var t=Nh();return function(){var n,r=xh(e);if(t){var o=xh(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return kh(this,n)}}function kh(e,t){if(t&&("object"===Oh(t)||"function"===typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return Eh(e)}function Eh(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Nh(){if("undefined"===typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"===typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}
1function xh(e){return xh=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},xh(e)}var Mh=function(e){Th(n,e);var t=Fh(n);function n(){return Sh(this,n),t.call(this)}return Rh(n,[{key:"__setupDefinitions",value:function(){this.__unique={position:"Point"},this.__heritable={componentSpacing:"Float",insideRadius:"Float",outsideRadius:"Float",length:"Float",height:"Float"},this.__defaults={componentSpacing:2e3,insideRadius:700,outsideRadius:1e3,length:4e3,height:1100},this.__units={componentSpacing:"μm",insideRadius:"μm",outsideRadius:"μm",height:"μm"},this.__minimum={componentSpacing:0,insideRadius:5,outsideRadius:8,length:10,height:10},this.__maximum={componentSpacing:1e4,insideRadius:5e3,outsideRadius:5e3,length:2e4,height:1200},this.__placementTool="componentPositionTool",this.__toolParams={position:"position"},this.__featureParams={componentSpacing:"componentSpacing",position:"position",insideRadius:"insideRadius",outsideRadius:"outsideRadius",length:"length"},this.__targetParams={componentSpacing:"componentSpacing",insideRadius:"insideRadius",outsideRadius:"outsideRadius",length:"length"},this.__renderKeys=["FLOW"],this.__mint="TERRACE",this.__zOffsetKeys={FLOW:"height"},this.__substrateOffset={FLOW:"0"}}},{key:"render2D",value:function(e,t){var n=e.position,r=e.outsideRadius,o=e.insideRadius,i=e.length,a=e.color,l=new y.a.Point(n[0],n[1]),s=(new y.a.Path.Circle(l,r),new y.a.Point(r*Math.cos(5*Math.PI/6),r*Math.sin(5*Math.PI/6))),c=new y.a.Point(s.x-s.y/Math.tan(Math.PI/3),0),u=new y.a.Point(0,-c.x*Math.tan(Math.PI/3)),h=new y.a.Point(-c.x,c.y),f=new y.a.Point(u.x,-u.y),d=new y.a.Path.Circle(l,o),p=new y.a.Path;p.add(c),p.add(u),p.add(h),p.add(f),p.closed=!0,p.translate(l);var m=p.subtract(d),v=m.bounds,g=new y.a.Path.Rectangle(m.bounds);return g.translate(new y.a.Point(0,v.height/2+i/2)),m=m.subtract(g),g.scale(1,-1,new y.a.Point(n)),m=m.subtract(g),m.fillColor=a,this.transformRender(e,m),m}},{key:"render2DTarget",value:function(e,t){null===e&&(e=this.__renderKeys[0]);var n=this.render2D(t,e);return n.fillColor.alpha=.5,n}},{key:"getPorts",value:function(e){var t=this.render2D(e,"FLOW"),n=t.bounds,r=[];return r.push(new b(0,-n.height/2,"1",o.FLOW)),r.push(new b(0,n.height/2,"2",o.FLOW)),r}}]),n}(R);function Ih(e){return Ih="function"===typeof Symbol&&"symbol"===typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"===typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Ih(e)}function Wh(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Ah(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function jh(e,t,n){return t&&Ah(e.prototype,t),n&&Ah(e,n),e}function Bh(e,t){if("function"!==typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&Vh(e,t)}function Vh(e,t){return Vh=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},Vh(e,t)}function Xh(e){var t=Uh();return function(){var n,r=zh(e);if(t){var o=zh(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return Yh(this,n)}}function Yh(e,t){if(t&&("object"===Ih(t)||"function"===typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return Gh(e)}function Gh(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Uh(){if("undefined"===typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"===typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}function zh(e){return zh=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},zh(e)}var Hh=function(e){Bh(n,e);var t=Xh(n);function n(){return Wh(this,n),t.call(this)}return jh(n,[{key:"__setupDefinitions",value:function(){this.__unique={},this.__heritable={channelFloorZ:"Float",channelTopZ:"Float",channelWidth:"Float",crossSection:"Float",height:"Float"},this.__defaults={channelFloorZ:0,channelTopZ:2,channelWidth:1e3,crossSection:1,height:250},this.__units={channelFloorZ:"mm",channelTopZ:"mm",channelWidth:"μm",crossSection:"",height:"μm"},this.__minimum={channelFloorZ:0,channelTopZ:.1,channelWidth:3,crossSection:0,height:10},this.__maximum={channelFloorZ:1e3,channelTopZ:1e3,channelWidth:12e3,crossSection:1,height:1200},this.__toolParams={}
1,this.__featureParams={channelFloorZ:"channelFloorZ",channelTopZ:"channelTopZ",channelWidth:"channelWidth",crossSection:"crossSection",height:"height"},this.__targetParams={},this.__placementTool="PositionTool",this.__renderKeys=["FLOW"],this.__mint="DXF_SKETCH",this.__zOffsetKeys={FLOW:"channelTopZ"},this.__substrateOffset={FLOW:"0"}}},{key:"render2D",value:function(e,t){return new y.a.CompoundPath("")}},{key:"render2DTarget",value:function(e,t){return new y.a.CompoundPath("")}}]),n}(R);function Kh(e){return Kh="function"===typeof Symbol&&"symbol"===typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"===typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Kh(e)}function qh(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function Jh(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?qh(Object(n),!0).forEach((function(t){Zh(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):qh(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function Zh(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function $h(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Qh(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function ef(e,t,n){return t&&Qh(e.prototype,t),n&&Qh(e,n),e}var tf=!1;var nf,rf=function(){function e(){$h(this,e)}return ef(e,null,[{key:"getAllComponents",value:function(){var t=[];for(var n in e.library){var r=e.library[n].object;t.push(r)}return t}},{key:"normalizeMint",value:function(e,t){var n=String(e||"").trim().toUpperCase().replace(/_/g," ").replace(/\s+/g," "),r={"IN MUX":"MUX","OUT MUX":"MUX","INPUT MUX":"MUX","OUTPUT MUX":"MUX","HORIZONTAL MUX":"MUX","VERTICAL MUX":"MUX","LONG CELL TRAPPER":"LONG CELL TRAP"};return"CELL TRAP"===n||"CELL TRAPPER"===n?!t||null==t.numberOfChambers&&null==t.feedingChannelWidth&&null==t.chamberSpacing?"SQUARE CELL TRAP":"LONG CELL TRAP":r[n]||n}},{key:"getComponentWithMINT",value:function(t,n){var r=e.normalizeMint(t,n);for(var o in this.library)if(r==this.library[o].object.mint)return console.log("Check"),console.log(e.library[o].object),e.library[o].object;return null}},{key:"getFeatureWithMINT",value:function(t){var n=t;for(var r in this.featureLibrary)if(n==this.featureLibrary[r].object.macro)return e.featureLibrary[r].object;return null}},{key:"getDefinitionForMINT",value:function(t,n){var r=e.normalizeMint(t,n),o=null;for(var i in this.library)r==this.library[i].object.mint&&(o={unique:this.library[i].object.unique,heritable:this.library[i].object.heritable,units:this.library[i].object.units,defaults:this.library[i].object.defaults,minimum:this.library[i].object.minimum,maximum:this.library[i].object.maximum,mint:this.library[i].object.mint});return o}},{key:"getDefinition",value:function(t){if(Object.prototype.hasOwnProperty.call(e.library,t)){var n=e.library[t].object,r={unique:n.unique,heritable:n.heritable,units:n.units,defaults:n.defaults,minimum:n.minimum,maximum:n.maximum,mint:n.mint};return r}return null}},{key:"getTypeForMINT",value:function(t,n){var r=e.normalizeMint(t,n);for(var o in e.library)if(r===e.library[o].object.mint)return o;return null}},{key:"snapshotFactoryDefaultsForMint",value:function(t){var n=e.getTypeForMINT(t);if(!n||!Object.prototype.hasOwnProperty.call(e.library,n))return null;var r=e.library[n],o=r.object.constructor,i=new o;return Jh({},i.defaults)}},{key:"fillMissingHeritableDefaults",value:function(t,n){var r=t&&"object"===Kh(t)?t:{},o=e.getDefinitionForMINT(n);if(!o)return r;var i=o.defaults||{};for(var a in Fe(r),o.heritable)void 0!==r[a]&&null!==r[a]||(r[a]=i[a]);return r}},{key:"getMINTForType",value:function(t){for(var n in e.library)if(t===n)return e.library[n].object.mint;return null}}
1,{key:"getRenderTypeKeysForMINT",value:function(t,n){var r=e.normalizeMint(t,n),o=[];for(var i in e.library)r===e.library[i].object.mint&&o.push(i);if(o.length>0)return o;throw new Error("No render type found for mint type: "+t)}},{key:"getComponentPorts",value:function(t,n){var r=e.getTypeForMINT(n);null===r&&(console.error("Component Ports of: "+r+" not found in library. Using default Template"),r="Template");var o=e.library[r].object,i={};t.forEach((function(e,t){i[t]=e}));var a=o.getPorts(i);return a}},{key:"hasInverseRenderLayer",value:function(t){var n=e.library[t].object,r=n.renderKeys;return r.includes("INVERSE")}},{key:"getDefaultsForType",value:function(t){if(Object.prototype.hasOwnProperty.call(e.library,t))return Jh({},e.library[t].object.defaults);throw new Error("Component Type definition: "+t+" not found in library")}},{key:"getHeritableForType",value:function(t){if(Object.prototype.hasOwnProperty.call(e.library,t))return e.library[t].object.heritable;throw new Error("Component Type definition: "+t+" not found in library")}},{key:"getUniqueForType",value:function(t){if(Object.prototype.hasOwnProperty.call(e.library,t))return e.library[t].object.unique;throw new Error("Component Type definition: "+t+" not found in library")}},{key:"isCustomType",value:function(t){return t in e.customTypes.keys()}},{key:"generateID",value:function(){return d.a.v1()}},{key:"getRenderer",value:function(t){if(Object.prototype.hasOwnProperty.call(e.library,t))return e.library[t].object;throw new Error("Component Type definition: "+t+" not found in library")}},{key:"getRendererForMINT",value:function(t,n){var r=e.normalizeMint(t,n);for(var o in e.library)if(e.library[o].object.mint===r)return e.library[o].object;for(var i in e.connectionLibrary)if(e.connectionLibrary[i].object.mint===r)return e.connectionLibrary[i].object;return e.library["BlackBox"].object}},{key:"getRendererInfo",value:function(t){if(Object.prototype.hasOwnProperty.call(e.library,t))return e.library[t];throw new Error("Component Type definition: "+t+" not found in library")}},{key:"getAllRenderKeys",value:function(t){return e.library[t].object.renderKeys}},{key:"getConnectionTypes",value:function(){var t=[];for(var n in e.connectionLibrary){var r=e.connectionLibrary[n];t.push(r.object.mint)}return t}},{key:"getBlackBoxDefinition",value:function(t,n,r){var o=e.blackboxEntryFlow.object,i={unique:o.unique,heritable:o.heritable,units:o.units,defaults:o.defaults,minimum:o.minimum,maximum:o.maximum,mint:o.mint};return i}}]),e}();function of(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function af(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?of(Object(n),!0).forEach((function(t){lf(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):of(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function lf(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function sf(e){return sf="function"===typeof Symbol&&"symbol"===typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"===typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},sf(e)}function cf(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function uf(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function hf(e,t,n){return t&&uf(e.prototype,t),n&&uf(e,n),e}rf.blackboxEntryFlow={object:new Mu,key:"FLOW"},rf.blackboxEntryControl={object:new Mu,key:"CONTROL"},rf.blackboxEntryIntegration={object:new Mu,key:"INTEGRATION"},rf.library={Template:{object:new R,key:"FLOW"},Text:{object:new j,key:"FLOW"},DxfSketch:{object:new Hh,key:"FLOW"},Port:{object:new Z,key:"FLOW"},Anode:{object:new ce,key:"INTEGRATION"},Cathode:{object:new _e,key:"INTEGRATION"},Channel:{object:new Xe,key:"FLOW"},BetterMixer:{object:new et,key:"FLOW"},RotaryMixer:{object:new ft,key:"FLOW"},RotaryMixer_control:{object:new ft,key:"CONTROL"},AlignmentMarks:{object:new Ot,key:"FLOW"},AlignmentMarks_control:{object:new Ot,key:"CONTROL"},CellTrapL:{object:new It,key:"FLOW"},CellTrapL_cell:{object:new It,key:"CELL"},Gelchannel:{object:new Kt,key:"FLOW"},Gelchannel_cell:{object:new Kt,key:"CELL"},Chamber:{object:new ln,key:"FLOW"},CurvedMixer:{object:new xn,key:"FLOW"},ToroidalMixer:{object:new hu,key:"FLOW"},DiamondReactionChamber:{object:new zn,key:"FLOW"},Connection:{object:new Pn,key:"FLOW"},DropletGen:{object:new or,key:"FLOW"},GradientGenerator:{object:new mr,key:"FLOW"},Mux:{object:new Tr,key:"FLOW"},Mux_control:{object:new Tr,key:"CONTROL"},Pump:{object:new Br,key:"FLOW"},Pump_control:{object:new Br,key:"CONTROL"}
1,Pump3D:{object:new $r,key:"FLOW"},Pump3D_control:{object:new $r,key:"CONTROL"},RoundedChannel:{object:new uo,key:"FLOW"},thermoCycler:{object:new Co,key:"FLOW"},Transition:{object:new Mo,key:"FLOW"},Transposer:{object:new Ho,key:"FLOW"},Transposer_control:{object:new Ho,key:"CONTROL"},Tree:{object:new Vi,key:"FLOW"},YTree:{object:new Qi,key:"FLOW"},Valve:{object:new vi(i.NORMALLY_OPEN),key:"CONTROL"},Valve3D_control:{object:new Li(i.NORMALLY_CLOSED),key:"CONTROL"},Valve3D:{object:new Li(i.NORMALLY_CLOSED),key:"FLOW"},LLChamber:{object:new ha,key:"FLOW"},LLChamber_control:{object:new ha,key:"CONTROL"},"3DMixer":{object:new Ca,key:"FLOW"},"3DMixer_control":{object:new Ca,key:"CONTROL"},Via:{object:new Ma,key:"FLOW"},DogboneInsert:{object:new Cu,key:"FLOW"},Filter:{object:new Ha,key:"FLOW"},CellTrapS:{object:new il,key:"FLOW"},CellTrapS_cell:{object:new il,key:"CELL"},"3DMux":{object:new vl,key:"FLOW"},"3DMux_control":{object:new vl,key:"CONTROL"},ChemostatRing:{object:new Ll,key:"FLOW"},ChemostatRing_control:{object:new Ll,key:"CONTROL"},Incubation:{object:new Vl,key:"FLOW"},Merger:{object:new Ql,key:"FLOW"},Merger_integration:{object:new Ql,key:"INTEGRATION"},DropletMergerJunction:{object:new hs,key:"FLOW"},PicoInjection:{object:new Cs,key:"FLOW"},PicoInjection_integration:{object:new Cs,key:"INTEGRATION"},Sorter:{object:new Ms,key:"FLOW"},Sorter_integration:{object:new Ms,key:"INTEGRATION"},Splitter:{object:new ic,key:"FLOW"},CapacitanceSensor:{object:new Hs,key:"FLOW"},CapacitanceSensor_integration:{object:new Hs,key:"INTEGRATION"},Node:{object:new vc,key:"FLOW"},DropletGenT:{object:new Lc,key:"FLOW"},DropletGenFlow:{object:new Vc,key:"FLOW"},LogicArray:{object:new Qc,key:"FLOW"},LogicArray_control:{object:new Qc,key:"CONTROL"},LogicArray_cell:{object:new Qc,key:"CELL"},BlackBox:{object:new Mu,key:"FLOW"},DIYCOMPONENT:{object:new qu,key:"FLOW"},Terrace:{object:new Mh,key:"FLOW"}},rf.connectionLibrary={Connection:{object:new Pn,key:"FLOW"},RoundedChannelConnection:{object:new uo,key:"FLOW"}},rf.featureLibrary={NormallyClosedValveModifications:{object:new hh,key:"FLOW"},NormallyClosedValveModifications_Gap:{object:new Ch,key:"GAP"}},rf.customTypes=new Map,function(e){e["EDGE"]="EDGE",e["XYZ"]="XYZ",e["XY"]="XY",e["Z"]="Z"}(nf||(nf={}));var ff=function(){function e(t){cf(this,e),this._rootObject=t,this._type=t.type}return hf(e,[{key:"setType",value:function(e){this._type=e,this._rootObject.type=e}},{key:"getType",value:function(){return this._type}},{key:"getData",value:function(){return this._rootObject}},{key:"addData",value:function(e,t){this._rootObject[e]=t}},{key:"toJSON",value:function(){return this._rootObject}}],[{key:"fromJSON",value:function(t){var n=t;if(n&&"object"===sf(n)&&Object.prototype.hasOwnProperty.call(n,"__rootObject")){var r=n.__rootObject||{};return new e(af(af({},r),{},{type:n.__type||r.type}))}return new e(t)}}]),e}();function df(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function pf(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function yf(e,t,n){return t&&pf(e.prototype,t),n&&pf(e,n),e}var mf=function(){function e(t,n){df(this,e),("string"===typeof n&&"Float"===t||"string"===typeof n&&"Integer"===t)&&(n=parseInt(n)),this.__type=t,this.__value=n}return yf(e,[{key:"toJSON",value:function(){return this.__value}},{key:"value",get:function(){return this.__value}},{key:"type",get:function(){return this.__type}},{key:"updateValue",value:function(e){this.__value=e}},{key:"resetValue",value:function(){}}]),e}();function vf(e){return vf="function"===typeof Symbol&&"symbol"===typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"===typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},vf(e)}function gf(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function wf(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function bf(e,t,n){return t&&wf(e.prototype,t),n&&wf(e,n),e}var _f=function(){function e(t,n,r){for(var o in gf(this,e),this.__unique=n,this.__heritable=r,this.__parameters={},t)this.__parameters[o]=new mf(vf(t[o]),t[o])}return bf(e,[{key:"parameters",get:function(){return this.__parameters}},{key:"updateParameter",value:function(e,t){this.__parameters.hasOwnProperty(e)?this.__parameters[e].updateV
1alue(t):this.__parameters[e]=new mf(vf(t),t)}},{key:"__ensureHasKey",value:function(e){if(!this.__parameters.hasOwnProperty(e))throw new Error(e+" parameter not found in Params object.")}},{key:"getValue",value:function(e){return this.__ensureHasKey(e),this.__parameters[e].value}},{key:"isUnique",value:function(e){return this.__unique.has(e)}},{key:"isHeritable",value:function(e){return this.__heritable.has(e)}},{key:"toJSON",value:function(){var e={};for(var t in this.__parameters)void 0!=this.__parameters[t]&&(e[t]=this.__parameters[t].value);return e}},{key:"hasParam",value:function(e){return this.__parameters.hasOwnProperty(e)}},{key:"toMap",value:function(){var e=new Map;for(var t in this.__parameters)void 0!=this.__parameters[t]&&e.set(t,this.__parameters[t].value);return e}},{key:"loadParameters",value:function(e){for(var t in e)this.__parameters[t]=e[t]}},{key:"unique",get:function(){return Array.from(this.__unique.keys())}},{key:"heritable",get:function(){return Array.from(this.__heritable.keys())}}],[{key:"fromJSON",value:function(t,n,r){return new e(t,n,r)}}]),e}();function Pf(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Cf(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function Of(e,t,n){return t&&Cf(e.prototype,t),n&&Cf(e,n),e}var Sf=function(){function e(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"New Layer",r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:o.FLOW,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"0",a=arguments.length>4?arguments[4]:void 0;Pf(this,e),this.__type=o.FLOW,this.params=new _f(t,e.getUniqueParameters(),e.getHeritableParameters()),this.name=n,this.features={},this.featureCount=0,this.device=a,this.__id=rf.generateID(),this.__type=r,this.__group=i}return Of(e,[{key:"type",get:function(){return this.__type}},{key:"id",get:function(){return this.__id},set:function(e){this.__id=e}},{key:"group",get:function(){return this.__group}},{key:"addFeature",value:function(e){this.__ensureIsAFeature(e),this.features[e.ID]=e,this.featureCount+=1,e.layer=this,e.setManufacturingInfoLayer()}},{key:"getIndex",value:function(){if(this.device)return this.device.layers.indexOf(this);throw new Error("No device referenced on this layer")}},{key:"__ensureIsAFeature",value:function(e){if(!(e instanceof am)&&!(e instanceof gm))throw new Error("Provided value"+e+" is not a Feature! Did you pass an ID by mistake?")}},{key:"__ensureFeatureExists",value:function(e){if(!this.containsFeature(e))throw new Error("Layer does not contain the specified feature!")}},{key:"__ensureFeatureIDExists",value:function(e){if(!this.containsFeatureID(e))throw new Error("Layer does not contain a feature with the specified ID!")}},{key:"getFeature",value:function(e){return this.__ensureFeatureIDExists(e),this.features[e]}},{key:"removeFeature",value:function(e){var t;(this.removeFeatureByID(e.ID),console.log("Device: ",this.device),null!==this.device||void 0!==this.device)&&(null===(t=this.device)||void 0===t||t.removeFeature(e))}},{key:"removeFeatureByID",value:function(e){this.__ensureFeatureIDExists(e);this.features[e];this.featureCount-=1,delete this.features[e]}},{key:"containsFeature",value:function(e){return this.__ensureIsAFeature(e),this.features.hasOwnProperty(e.ID)}},{key:"containsFeatureID",value:function(e){return this.features.hasOwnProperty(e)}},{key:"getAllFeaturesFromLayer",value:function(){return this.features}},{key:"__featuresToJSON",value:function(){var e={};for(var t in this.features)e[t]=this.features[t].toJSON();return e}},{key:"__featuresInterchangeV1",value:function(){var e=[];for(var t in this.features)e.push(this.features[t].toInterchangeV1());return e}},{key:"__loadFeaturesFromJSON",value:function(e){for(var t in e)this.addFeature(am.fromJSON(e[t]))}},{key:"__loadFeaturesFromInterchangeV1",value:function(e){for(var t in e)this.addFeature(am.fromInterchangeV1(e[t]))}},{key:"toJSON",value:function(){var e={};return e.name=this.name,e.params=this.params.toJSON(),e.features=this.__featuresToJSON(),e}},{key:"toInterchangeV1",value:function(){var e="FLOW";
1if(this.type===o.FLOW)e="FLOW";else if(this.type===o.CONTROL)e="CONTROL";else{if(this.type!==o.INTEGRATION)throw new Error("Unknown layer type: "+this.type);e="INTEGRATION"}var t={id:this.__id,name:this.name,type:e,group:this.__group,params:this.params.toJSON(),features:this.__featuresInterchangeV1()};return t}},{key:"toFeatureLayerJSON",value:function(){var e={};return e.name=this.name,e.params=this.params.toJSON(),e.features=this.__featuresInterchangeV1(),e}}],[{key:"getUniqueParameters",value:function(){var e=new Map;return e.set("z_offset","Float"),e.set("flip","Boolean"),e}},{key:"getHeritableParameters",value:function(){return new Map}},{key:"fromInterchangeV1",value:function(t,n){var r=o.FLOW;if(Object.prototype.hasOwnProperty.call(t,"type"))if("FLOW"===t.type)r=o.FLOW;else if("CONTROL"===t.type)r=o.CONTROL;else{if("INTEGRATION"!==t.type)throw new Error("Unknown layer type: "+t.type);r=o.INTEGRATION}var i=new e(t.params,t.name,r,t.group,n);return i.__loadFeaturesFromInterchangeV1(t.features),i}}]),e}();function Df(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Rf(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function Tf(e,t,n){return t&&Rf(e.prototype,t),n&&Rf(e,n),e}var Lf=function(){function e(){Df(this,e),this.head=null,this.tail=null,this.count=0,this.current=null}return Tf(e,[{key:"currentData",value:function(){var e;return null===(e=this.current)||void 0===e?void 0:e.data}},{key:"removeCurrent",value:function(){var e=this.current.prev,t=this.current.next;e.next=t,t.prev=e}},{key:"removeNode",value:function(t){var n=this.head;if(t.id===(null===n||void 0===n?void 0:n.id)){var r=n.prev,o=n.next;r.next=o,o&&(o.prev=r)}else{var i=e.getNextNode(n);while(i){if(i.id===t.id){var a=i.prev,l=i.next;a.next=l,l&&(l.prev=a);break}i=e.getNextNode(i)}}this.count--}},{key:"length",get:function(){return this.count}},{key:"push",value:function(e){if(0===this.count){var t=new Ff(e);this.head=t,this.tail=t}else{var n=this.head,r=new Ff(e);r.id=this.count,r.next=n,n.prev=r,this.head=r}this.count++}},{key:"getArray",value:function(){var t=[];t.push(this.head.data);var n=e.getNextNode(this.head);while(n)t.push(n.data),n=e.getNextNode(n);return t}}],[{key:"getNextNode",value:function(e){return e.next}},{key:"getPreviousNode",value:function(e){return e.prev}}]),e}(),Ff=function e(t){Df(this,e),this.prev=null,this.data=t,this.next=null,this.id=0};function kf(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Ef(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function Nf(e,t,n){return t&&Ef(e.prototype,t),n&&Ef(e,n),e}var xf=function(){function e(t,n,r,o,i){kf(this,e),this.__start=t,this.__end=n,this.__type=r,this.__id=o,this.__dxfData=i}return Nf(e,[{key:"id",get:function(){return this.__id}},{key:"start",get:function(){return this.__start}},{key:"end",get:function(){return this.__end}},{key:"type",get:function(){return this.__type}},{key:"dxfData",get:function(){return this.__dxfData}}]),e}(),Mf=n("3fcd"),If=n.n(Mf);function Wf(e,t){var n="undefined"!==typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=Af(e))||t&&e&&"number"===typeof e.length){n&&(e=n);var r=0,o=function(){};return{s:o,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,l=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return a=e.done,e},e:function(e){l=!0,i=e},f:function(){try{a||null==n.return||n.return()}finally{if(l)throw i}}}}function Af(e,t){if(e){if("string"===typeof e)return jf(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?jf(e,t):void 0}}function jf(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function Bf(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Vf(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function Xf(e,t,n){return t&&Vf(e.prototype,t),n&&Vf(e,n),e}var Yf=function(){function e(){Bf(this,e),this.__nodes=new Map,this.__nodecount=0,this.__edgecount=0,this.__edgeData=new Map,this.__networkGraph=new If.a.Graph({directed:!1})}return Xf(e,[{key:"addEdge",value:function(e,t,n){var r=this.findNode(e),o=this.findNode(t),i=new xf(r,o,n.type,String(this.__edgecount++),n);this.__edgeData.set(i.id,i),this.__networkGraph.setEdge(r,o,i.id)}},{key:"findNode",value:function(t){var n,r=Wf(this.__nodes.keys());try{for(r.s();!(n=r.n()).done;){var o=n.value,i=this.__nodes.get(o);if(e.computeDistance(t,i)<1e-6)return o}}catch(l){r.e(l)}finally{r.f()}var a=String(this.__nodecount++);return this.__nodes.set(a,t),a}},{key:"generateGeometry",value:function(){var e,t=new y.a.CompoundPath(""),n=If.a.alg.components(this.__networkGraph),r=Wf(n);try{for(r.s();!(e=r.n()).done;){var o=e.value;this.drawComponent(o,t)}}catch(i){r.e(i)}finally{r.f()}return t}},{key:"drawComponent",value:function(e,t){this.__nodes.get(e[0]);for(var n=If.a.alg.preorder(this.__networkGraph,e[0]),r=new y.a.Path,o=0;o<n.length;o++){var i=n[o],a=this.__nodes.get(i),l=void 0;l=o+1===n.length?n[0]:n[o+1];var s=this.__getEdge(i,l);if(s)switch(s.type){case"LINE":r.add(new y.a.Point(a.x,a.y));break;case"ARC":r.add(new y.a.Point(a.x,a.y));var c=this.__nodes.get(l),u=new y.a.Point(c.x,c.y),h=this.getARCMidpoint(s.dxfData);r.arcTo(h,u);break}else r.add(new y.a.Point(a.x,a.y))}t.addChild(r)}},{key:"getARCMidpoint",value:function(e){var t=new y.a.Point(e.center.x,e.center.y),n=e.radius,r=e.startAngle,o=e.endAngle,i=(r+o)/2,a=new y.a.Point(t.x+n*Math.cos(i),t.y+n*Math.sin(i));return a}},{key:"__getEdge",value:function(e,t){var n=this.__networkGraph.edge(e,t);return this.__edgeData.get(n)}}
1],[{key:"computeDistance",value:function(e,t){var n=Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2);return Math.sqrt(n)}}]),e}();function Gf(e,t){var n=e.getValue("position"),r=e.getValue("rotation"),o=Zf(e.dxfObjects);return o.translate(new y.a.Point(n[0],n[1])),o.rotate(r),o.fillColor=new y.a.Color(t),o}function Uf(e,t){var n=t.position,r=new y.a.Color(t.color),o=t.rotation,i=new y.a.Point(n[0],n[1]),a=Zf(e.dxfData);return a.fillColor=r,a.fillColor.alpha=.5,a.translate(i),a.rotate(o),a}function zf(e){var t=e.getData();return t.shape}function Hf(e,t){var n=new y.a.Point(1e3*t.center.x,1e3*t.center.y),r=1e3*t.radius,o=t.startAngle,i=t.endAngle,a=new y.a.Point(n.x+r*Math.cos(o),n.y+r*Math.sin(o)),l=new y.a.Point(n.x+r*Math.cos(i),n.y+r*Math.sin(i));e.addEdge(a,l,t)}function Kf(e){for(var t=new y.a.Path,n=0;n<e.vertices.length;n++){var r=e.vertices[n];t.add(new y.a.Point(1e3*r.x,1e3*r.y))}t.closed=!0;var o=t;return o.origin="POLYLINE",o}function qf(e,t){console.warn("Implement this function !!")}function Jf(e,t){var n=t.vertices[0],r=t.vertices[1];e.addEdge(n,r,t)}function Zf(e){if(void 0===e)throw new Error("Cannot find DXF DATA");new Lf;var t=[],n=new Yf;for(var r in e){var o=e[r];if("ARC"===o.getType())Hf(n,o.getData());else if("LINE"===o.getType())Jf(n,o.getData());else if("LWPOLYLINE"===o.getType()||"POLYLINE"===o.getType())zf(o)?t.push(Kf(o.getData())):qf(n,o.getData());else if("ELLIPSE"===o.getType())t.push($f(o.getData()));else if("CIRCLE"===o.getType())t.push(Qf(o.getData()));else if("POINT"===o.getType())t.push(ed(o.getData()));else{if("SPLINE"===o.getType())throw alert("The current version of the DXF Parser does not support SPLINE objects. Support will be added in future versions"),new Error("Unsupported DXF render object - SPLINE");if("DIMENSION"===o.getType())console.warn("DIMENSION entry in DXF will be ignored. Please ensure that all the designs are of the correct dimensions");else if("MTEXT"===o.getType())console.warn("MTEXT entry in DXF will be ignored. Please ensure that none of the features require text ");else{if("INSERT"===o.getType())throw alert("The current version of the DXF Parser does not support INSERT and BLOCK design references."),new Error("Unsupported render object");alert("Unsupported DXF Entity Type for Component Import : "+o.getType()),console.error("Unsupported DXF Entity Type for Component Import : "+o.getType())}}}for(var i=n.generateGeometry(),a=0,l=t;a<l.length;a++){var s=l[a];i.addChild(s)}i.closed=!0,i.fillColor=new y.a.Color("#ff7606"),i.fillRule="evenodd";var c=i.bounds.topLeft;return i.translate(new y.a.Point(-c.x,-c.y)),i.scale(1,-1),i.scale(1e3,1e3),i}function $f(e){var t=new y.a.Point(1e3*e.center.x,1e3*e.center.y),n=e.axisRatio,r=Math.sqrt(Math.pow(1e3*e.majorAxisEndPoint.x,2)+Math.pow(1e3*e.majorAxisEndPoint.y,2)),o=r*n,i=180*Math.atan(e.majorAxisEndPoint.y/e.majorAxisEndPoint.x)/Math.PI;Number.isNaN(i)&&(i=0);var a=new y.a.Path.Ellipse({center:[t.x,t.y],radius:[r,o]});return a.rotate(i,t),a}function Qf(e){var t=new y.a.Point(1e3*e.center.x,1e3*e.center.y),n=new y.a.Path.Circle(t,1e3*e.radius);return n}function ed(e){var t=100,n=new y.a.Point(1e3*e.position.x,1e3*e.position.y),r=new y.a.Path.Circle(n,t);return r}var td="#F44336",nd="#673AB7",rd="#e3f2fd",od="#BBDEFB",id="#2196F3",ad="#616161",ld="#000000",sd="#FFFFFF",cd=["300","400","500","600","700","800","900"],ud={900:"#1A237E",800:"#283593",700:"#303F9F",600:"#3949AB",500:"#3F51B5",400:"#5C6BC0",300:"#7986CB",200:"#9FA8DA",100:"#C5CAE9",50:"#E8EAF6",A100:"#8C9EFF",A200:"#536DFE",A400:"#3D5AFE",A700:"#304FFE"},hd={900:"#B71C1C",800:"#C62828",700:"#D32F2F",600:"#E53935",500:"#F44336",400:"#EF5350",300:"#E57373",200:"#EF9A9A",100:"#FFCDD2",50:"#FFEBEE",A100:"#FF8A80",A200:"#FF5252",A400:"#FF1744",A700:"#D50000"},fd={900:"#1A237E",800:"#283593",700:"#303F9F",600:"#3949AB",500:"#3F51B5",400:"#5C6BC0",300:"#7986CB",200:"#9FA8DA",100:"#C5CAE9",50:"#E8EAF6",A100:"#8C9EFF",A200:"#536DFE",A400:"#3D5AFE",A700:"#304FFE"},dd={900:"#006200",800:"#007600",700:"#008900",600:"#009d00",500:"#00b100",400:"#00d800",300:"#00ff00",200:"#3bff3b",100:"#62ff62",50:"#b1ffb1",A100:"#ebffeb",A200:"#9dff9d",A400:"#14ff14",A700:"#00b100"},pd={indigo:ud,red:hd,blue:fd,green:dd},yd=function(e,t){return Math.round((t-1)*e)};function md(e,t,n){var r=yd(e,n.length);n[r];return t["700"]}function vd(e){if(!e)throw new Error("Undefined color");
1if(e==o.FLOW)return pd.indigo;if(e==o.CONTROL)return pd.red;if(e==o.INTEGRATION)return pd.green;throw new Error("Undefined LogicalLayerType")}function gd(e,t){if(t){var n=500,r=vd(t.type);return md(n,r,cd)}return md(0,pd.indigo,cd)}function wd(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var bd=function e(){wd(this,e),this.id_counter=0,this.threeRenderer=null,this.currentDevice=null,this.canvasManager=null,this.currentTextLayer=null,this.currentGrid=null,this.view=null,this.viewManager=null},_d=new bd,Pd=_d;function Cd(e){var t=new y.a.CompoundPath("");for(var n in e.getDXFObjects()){var r=e.getDXFObjects()[n];"ARC"===r.getType()?Ld(r.getData(),t):"LWPOLYLINE"===r.getType()||"LINE"===r.getType()||"POLYLINE"===r.getType()?Td(r.getData(),t):"SPLINE"===r.getType()?Sd(r.getData(),t):"ELLIPSE"===r.getType()?Od(r.getData(),t):"CIRCLE"===r.getType()?Dd(r.getData(),t):"POINT"===r.getType()?Rd(r.getData(),t):console.error("Unsupported DXF Entity Type for Outline Generation : "+r.getType())}t.strokeColor=new y.a.Color("#ff7606"),t.strokeWidth=200,t.scale(1,-1);var o=t.bounds.topLeft;t.translate(new y.a.Point(-o.x,-o.y));var i=t;return i.featureID=e.ID,i}function Od(e,t){var n=new y.a.Point(1e3*e.center.x,1e3*e.center.y),r=e.axisRatio,o=Math.sqrt(Math.pow(1e3*e.majorAxisEndPoint.x,2)+Math.pow(1e3*e.majorAxisEndPoint.y,2)),i=o*r,a=180*Math.atan(e.majorAxisEndPoint.y/e.majorAxisEndPoint.x)/Math.PI;Number.isNaN(a)&&(a=0);var l=new y.a.Path.Ellipse({center:[n.x,n.y],radius:[o,i]});l.rotate(a,n),t.addChild(l)}function Sd(e,t){throw new Error("Not Implemented")}function Dd(e,t){var n=new y.a.Point(1e3*e.center.x,1e3*e.center.y),r=new y.a.Path.Circle(n,1e3*e.radius);t.addChild(r)}function Rd(e,t){var n=100,r=new y.a.Point(1e3*e.position.x,1e3*e.position.y),o=new y.a.Path.Circle(r,n);t.addChild(o)}function Td(e,t){for(var n,r,o=0;o<e.vertices.length;o++)if(e.vertices[o].bulge)e.vertices[o].bulge,n=e.vertices[o],r=o+1<e.vertices.length?e.vertices[o+1]:e.vertices[0],console.log("Start Point:",n),console.log("End Point:",r);else{var i=e.vertices[o],a=e.vertices[o+1<e.vertices.length?o+1:0],l=new y.a.Point(1e3*i.x,1e3*i.y),s=new y.a.Point(1e3*a.x,1e3*a.y),c=new y.a.Path.Line(l,s);t.addChild(c)}}function Ld(e,t){var n=new y.a.Point(1e3*e.center.x,1e3*e.center.y),r=1e3*e.radius,o=e.startAngle,i=e.endAngle,a=(o+i)/2,l=new y.a.Point(n.x+r*Math.cos(o),n.y+r*Math.sin(o)),s=new y.a.Point(n.x+r*Math.cos(a),n.y+r*Math.sin(a)),c=new y.a.Point(n.x+r*Math.cos(i),n.y+r*Math.sin(i)),u=new y.a.Path.Arc(l,s,c);t.addChild(u)}function Fd(e){return Nd(e)||Ed(e)||Wd(e)||kd()}function kd(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function Ed(e){if("undefined"!==typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}function Nd(e){if(Array.isArray(e))return Ad(e)}function xd(e,t){var n="undefined"!==typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=Wd(e))||t&&e&&"number"===typeof e.length){n&&(e=n);var r=0,o=function(){};return{s:o,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,l=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return a=e.done,e},e:function(e){l=!0,i=e},f:function(){try{a||null==n.return||n.return()}finally{if(l)throw i}}}}function Md(e,t){return Bd(e)||jd(e,t)||Wd(e,t)||Id()}function Id(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function Wd(e,t){if(e){if("string"===typeof e)return Ad(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Ad(e,t):void 0}}function Ad(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}
1function jd(e,t){var n=null==e?null:"undefined"!==typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,i=[],a=!0,l=!1;try{for(n=n.call(e);!(a=(r=n.next()).done);a=!0)if(i.push(r.value),t&&i.length===t)break}catch(s){l=!0,o=s}finally{try{a||null==n["return"]||n["return"]()}finally{if(l)throw o}}return i}}function Bd(e){if(Array.isArray(e))return e}var Vd=1e-9,Xd=1;function Yd(e,t,n){var r=n.rotation*Math.PI/180,o=e-n.cx,i=t-n.cy,a=Math.cos(r),l=Math.sin(r);return[o*a+i*l,-o*l+i*a]}function Gd(e,t,n){var r=n.rotation*Math.PI/180,o=Math.cos(r),i=Math.sin(r);return[n.cx+e*o-t*i,n.cy+e*i+t*o]}function Ud(e,t){var n=e[0]-t[0],r=e[1]-t[1];return Math.hypot(n,r)}function zd(e,t,n,r,o,i){for(var a=0,l=1,s=t[0]-e[0],c=t[1]-e[1],u=[-s,s,-c,c],h=[e[0]-n,r-e[0],e[1]-o,i-e[1]],f=0;f<4;f++)if(Math.abs(u[f])<Vd){if(h[f]<0)return null}else{var d=h[f]/u[f];if(u[f]<0){if(d>l)return null;d>a&&(a=d)}else{if(d<a)return null;d<l&&(l=d)}}return a>l?null:[a,l]}function Hd(e,t){if(!e||e.length<2||!e[0]||!e[1])return[];var n=[Number(e[0][0]),Number(e[0][1])],r=[Number(e[1][0]),Number(e[1][1])];if(!Number.isFinite(n[0])||!Number.isFinite(n[1])||!Number.isFinite(r[0])||!Number.isFinite(r[1]))return[];if(Ud(n,r)<Xd)return[];var o=Yd(n[0],n[1],t),i=Yd(r[0],r[1],t),a=zd(o,i,-t.radius,t.radius,-t.gap/2,t.gap/2);if(!a)return[e];var l=Md(a,2),s=l[0],c=l[1],u=function(e){var n=o[0]+e*(i[0]-o[0]),r=o[1]+e*(i[1]-o[1]);return Gd(n,r,t)},h=[];if(s>Vd){var f=u(s);Ud(n,f)>=Xd&&h.push([n,f])}if(c<1-Vd){var d=u(c);Ud(d,r)>=Xd&&h.push([d,r])}return h}function Kd(e,t){if(!Array.isArray(e)||0===e.length||!Array.isArray(t)||0===t.length)return Array.isArray(e)?e.slice():[];var n,r=e.slice(),o=xd(t);try{for(o.s();!(n=o.n()).done;){var i=n.value;if(i&&Number.isFinite(i.cx)&&Number.isFinite(i.cy)&&Number.isFinite(i.radius)&&!(i.radius<=0)&&(Number.isFinite(i.gap)&&!(i.gap<=0))){var a,l=[],s=xd(r);try{for(s.s();!(a=s.n()).done;){var c=a.value;l.push.apply(l,Fd(Hd(c,i)))}}catch(u){s.e(u)}finally{s.f()}r=l}}}catch(u){o.e(u)}finally{o.f()}return r}function qd(e,t,n,r){if(!e||e.length<2)return null;var o=Number(e[0]),i=Number(e[1]),a=Number(t),l=Number(n),s=Number(r);return!Number.isFinite(o)||!Number.isFinite(i)||!Number.isFinite(a)||a<=0||!Number.isFinite(l)||l<=0?null:{cx:o,cy:i,radius:a,gap:l,rotation:Number.isFinite(s)?s:0}}function Jd(e,t){var n="undefined"!==typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=Zd(e))||t&&e&&"number"===typeof e.length){n&&(e=n);var r=0,o=function(){};return{s:o,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,l=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return a=e.done,e},e:function(e){l=!0,i=e},f:function(){try{a||null==n.return||n.return()}finally{if(l)throw i}}}}function Zd(e,t){if(e){if("string"===typeof e)return $d(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?$d(e,t):void 0}}function $d(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var Qd=.5,ep=new Set(["Valve","Valve3D_control","Valve3D"]),tp=new Set(["Valve3D_control","Valve3D"]),np=new Set(["Connection","Channel","RoundedChannel","Text","EDGE","DxfSketch"]);function rp(e,t){t.position&&"function"===typeof e.drawOriginFromCenter&&("function"===typeof e.drawsAtPositionCenter&&e.drawsAtPositionCenter()||(t.position=e.drawOriginFromCenter(t)))}function op(e){var t=Pd.currentDevice,n=e.referenceID;if(!t||!n)return[];var r=null;try{r=t.getConnectionByID(n)}catch(m){r=null}if(!r)return[];var o,i=[],a=new Set,l=function(e){if(e){var t="".concat(e.cx,",").concat(e.cy,",").concat(e.radius,",").concat(e.gap,",").concat(e.rotation);a.has(t)||(a.add(t),i.push(e))}},s=t.getValvesForConnection(r),c=Jd(s);try{for(c.s();!(o=c.n()).done;){var u,h=o.value,f=!1,d=Jd(h.featureIDs);try{for(d.s();!(u=d.n()).done;){var p=u.value;try{var y=t.getFeatureByID(p);if(!tp.has(y.getType()))continue;l(qd(y.getValue("position"),y.getValue("valveRadius"),y.getValue("gap"),y.getValue("rotation"))),f=!0}catch(v){continue}}}catch(g){d.e(g)}finally{d.f()}if(!f)try{l(qd(h.getValue("position"),h.getValue("valveRadius"),h.getValue("gap"),h.getValue("rotation")))}catch(w){continue}}}catch(g){c.e(g)}finally{c.f()}return i}function ip(e,t){if(!e.layer||e.layer.type!==o.FLOW)return t;if("Connection"!==e.getType())return t;if(!Array.isArray(t)||0===t.length)return t;var n=op(e);return 0===n.length?t:Kd(t,n)}function ap(e,t,n){var r=t.getType();if(ep.has(r))if(null!==n&&void 0!==n&&n.neutralValveOpacity)e.opacity=1;else{var o=Pd.viewManager;if(null!==o&&void 0!==o&&o.currentLayer&&t.layer){var i=o.currentLayer.type===t.layer.type;e.opacity=i?1:Qd}else e.opacity=1}}var lp=function(e){var t=e.getValue("height"),n=1,r=t/n;if(r>1&&(r=1),console.log("feature Object:",e),console.log("feature layer:",e.layer),console.log("feature layer type:",e.layer.type),!e.layer)throw new Error("Feature layer is null");var o=vd(e.layer.type);return md(r,o,cd)},sp=function(e){var t=0;if(!e.layer)throw new Error("Feature layer is null");var n=vd(e.layer.type);return md(t,n,cd)};function cp(e,t){return rf.getDefaultsForType(e)[t]}function up(e,t){var n,r,o,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;if(null===(null===(n=Pd.viewManager)||void 0===n?void 0:n.currentLayer)||void 0===(null===(r=Pd.viewManager)||void 0===r?void 0:r.currentLayer))throw console.error("No current layer"),new Error("No current layer");var a=rf.getRendererInfo(e),l=a.object,s=l.targetParams,c={};if(null!==i){var u,h=Jd(i);try{for(h.s();!(u=h.n()).done;){var f=u.value;c[f.name]=f.value}}catch(w){h.e(w)}finally{h.f()}}else for(var d in s)c[d]=cp(e,s[d]);c["position"]=t,np.has(e)||rp(l,c),c["color"]=new y.a.Color(gd(e,null===(o=Pd.viewManager)||void 0===o?void 0:o.currentLayer));var p=null;try{var m=Pd.viewManager.currentLayer.type,v=l.renderKeys;v&&v.includes(m)&&(p=m)}catch(b){p=null}var g=l.render2DTarget(p,c);return g}function hp(e,t){if(null===Pd.viewManager)throw console.error("Registry.viewManager is null"),new Error("Registry.viewManager is null");var n=new y.a.PointText(new y.a.Point(t[0],t[1]));return n.justification="center",n.fillColor=new y.a.Color(nd),n.content=Pd.viewManager.tools.InsertTextTool.text,n.fontSize=1e4,n}function fp(e){return Cd(e)}function dp(e){var t=e.getValue("position"),n=new y.a.PointText(new y.a.Point(t[0],t[1]));if(n.justification="center",void 0!=e.getParams().color){var r=e.getParams().color.value;if("white"==r||"White"==r||"WHITE"==r)n.fillColor=new y.a.Color(sd);else if("black"==r||"Black"==r||"BLACK"==r)n.fillColor=new y.a.Color(ld);else if("blue"==r||"Blue"==r||"BLUE"==r)n.fillColor=new y.a.Color(id);else{if("red"!=r&&"Red"!=r&&"RED"!=r)throw new Error("Color choice "+r+" not enabled");n.fillColor=new y.a.Color(td)}}else n.fillColor=new y.a.Color(lp(e));n.content=e.getValue("text"),n.fontSize=e.getValue("fontSize");var o=n;return o["featureID"]=e.ID,o}function pp(e,t,n){var r,i;console.log("RenderFeature beginning",e),console.log(t);var a=e.getType();if(rf.isCustomType(a)){"Custom",r=Gf(e,sp(e));var l=r;return l["featureID"]=e.ID,l}if("EDGE"===a)return fp(e);if("DxfSketch"===a){var s=new y.a.CompoundPath(""),c=s;return c.featureID=e.ID,c}if("Text"===a)return dp(e);var u=rf.getRendererInfo(a),h=rf.getRenderer(a);
1t&&null!==t||(t=u.key),"Valve3D_control"===a&&e.layer&&e.layer.type===o.FLOW&&"CONTROL"===t&&(t="FLOW"),h?i=h.featureParams:console.error("Could not find renderer method for feature:",e);var f={};for(var d in i)f[d]=e.getValue(i[d]);"Connection"===e.getType()&&Array.isArray(f.segments)&&(f.segments=ip(e,f.segments)),f.color=lp(e),f.baseColor=sp(e),!np.has(a)&&h&&rp(h,f),r=h.render2D(f,t);var p=r;return p["featureID"]=e.ID,ap(r,e,n),p}function yp(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function mp(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function vp(e,t,n){return t&&mp(e.prototype,t),n&&mp(e,n),e}var gp=function(){function e(){yp(this,e)}return vp(e,null,[{key:"getFeatureFromID",value:function(e){return Pd.currentDevice.getFeatureByID(e)}},{key:"getRenderedFeature",value:function(e){return Pd.viewManager.view.getRenderedFeature(e)}},{key:"generateDeviceName",value:function(e){return Pd.currentDevice.generateNewName(e)}},{key:"getDeviceLayers",value:function(){return Pd.currentDevice.layers}},{key:"getDeviceLayerFromID",value:function(e){return Pd.currentDevice.getLayerFromFeatureID(e)}}]),e}();function wp(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function bp(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function _p(e,t,n){return t&&bp(e.prototype,t),n&&bp(e,n),e}var Pp=function(){function e(){wp(this,e)}return _p(e,null,[{key:"toMap",value:function(e){var t=new Map;for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.set(n,e[n]);return t}}]),e}();function Cp(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function Op(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Cp(Object(n),!0).forEach((function(t){Sp(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Cp(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function Sp(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Dp(e,t){var n="undefined"!==typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=Rp(e))||t&&e&&"number"===typeof e.length){n&&(e=n);var r=0,o=function(){};return{s:o,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,l=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return a=e.done,e},e:function(e){l=!0,i=e},f:function(){try{a||null==n.return||n.return()}finally{if(l)throw i}}}}function Rp(e,t){if(e){if("string"===typeof e)return Tp(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Tp(e,t):void 0}}function Tp(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function Lp(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Fp(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function kp(e,t,n){return t&&Fp(e.prototype,t),n&&Fp(e,n),e}var Ep=function(){function e(t,n,r){var o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:rf.generateID();Lp(this,e),this._params=t,this._name=n,this._id=o,this._entity=r,this._featureIDs=[],this._bounds=null,this._placed=!1,this._ports=new Map,this._componentPortTRenders=new Map,this._xspan=0,this._yspan=0,this._renderOffset=[0,0];var i=this._params.toMap();if(""!==r&&"TEXT"!==r||null===r){var a=rf.getComponentPorts(i,r);if(void 0!=a&&a.length>=0&&null!==a){var l,s=Dp(a);try{for(s.s();!(l=s.n()).done;){var c=l.value;this.setPort(c.label,c)}}catch(u){s.e(u)}finally{s.f()}}}else console.warn("Component mint is empty")}return kp(e,[{key:"mint",get:function(){return this._entity}},{key:"offset",get:function(){return this._renderOffset}},{key:"ports",get:function(){return this._ports},set:function(e){this._ports=e}},{key:"placed",get:function(){return this._placed},set:function(e){this._placed=e}},{key:"featureIDs",get:function(){return this._featureIDs}},{key:"setBounds",value:function(e){this._bounds=e;var t=e.topLeft;this._params.updateParameter("position",[t.x,t.y]),this._params.updateParameter("xspan",e.width),this._params.updateParameter("yspan",e.height)}},{key:"updateParameter",value:function(e,t){"position"==e&&console.error("Use updateComponentPosition instead of updateParameter when changing position"),this._params.updateParameter(e,t);var n,r=Dp(this._featureIDs);try{for(r.s();!(n=r.n()).done;){var o=n.value,i=gp.getFeatureFromID(o);i.updateParameter(e,t)}}catch(a){r.e(a)}finally{r.f()}gp.getFeatureFromID(this._featureIDs[0]).getValue("position");this.setPosition(),this.setOffset(),this.updateComponentPorts()}},{key:"toInterchangeV1",value:function(){var e=this.getBoundingRectangle(),t=[],n=this.ports;if(null!==n){var r,o=Dp(n.keys());try{for(o.s();!(r=o.n()).done;){var i=r.value,a=n.get(i);if(void 0!=a){var l=a.toInterchangeV1();t.push(l)}}}catch(c){o.e(c)}finally{o.f()}}var s={id:this._id,name:this._name,entity:this._entity,params:this._params.toJSON(),"x-span":e.width,"y-span":e.height,ports:t,layers:this.findLayerReferences()};return s}},{key:"findLayerReferences",value:function(){var e,t=gp.getDeviceLayers(),n=[],r=Dp(t);try{for(r.s();!(e=r.n()).done;){var o=e.value,i=void 0;for(var a in o.features)i=o.features[a],i.referenceID==this.id&&n.push(o.id)}}catch(l){r.e(l)}finally{r.f()}return n}},{key:"id",get:function(){return this._id}},{key:"name",get:function(){return this._name},set:function(e){this._name=e}},{key:"getPosition",value:function(){return this._params.getValue("position")}},{key:"getValue",value:function(e){try{return this._params.getValue(e)}catch(t){throw new Error("Unable to get value for key: "+e)}}},{key:"addFeatureID",value:function(e){this._featureIDs.push(e)}},{key:"updateBounds",value:function(){var e,t=null,n=null,r=null,o=Dp(this._featureIDs);try{for(o.s();!(e=o.n()).done;){var i=e.value;n=gp.getFeatureFromID(i),r=pp(n,null),t=null===t?r.bounds:t.unite(r.bounds)}}catch(a){o.e(a)}finally{o.f()}this._bounds=t}},{key:"params",get:function(){return this._params}},{key:"getBoundingRectangle",value:function(){0!=this._featureIDs.length&&null!==this._featureIDs&&void 0!=this._featureIDs||console.error("No features associated with the component");var e,t=null,n=Dp(this._featureIDs);try{for(n.s();!(e=n.n()).done;){var r=e.value,o=gp.getRenderedFeature(r);console.log(o),console.log(r),console.log(o.bounds),t=t&&o?t.unite(o.bounds):o.bounds}}catch(i){n.e(i)}finally{n.f()}if(null!==t)return t;throw new Error("Component "+this._name+" "+this._id+" cannot have bounds of null")}},{key:"updateComponentPosition",value:function(e){var t=[Number(e[0]),Number(e[1])];this._params.updateParameter("position",t);var n,r=Dp(this._featureIDs);try{for(r.s();!(n=r.n()).done;){var o=n.value,i=gp.getFeatureFromID(o);i.updateParameter("position",t)}}catch(a){r.e(a)}finally{r.f()}this.updateComponentPorts()}},{key:"adoptFeaturePosition",value:function(e){this._params.updateParameter("position",[Number(e[0]),Number(e[1])]),this.updateComponentPorts()}},{key:"setInitialOffset",value:function(){var e=this.getBoundingRectangle();this._renderOffset=[e.x,e.y]}},{key:"setOffset",value:function(){var e=this.getBoundingRectangle(),t=gp.getFeatureFromID(this._featureIDs[0]).getValue("position");this._renderOffset=[e.x-t[0],e.y-t[1]]}},{key:"setPosition",value:function(){this._params.updateParameter("position",this.getCenterPosition())}},{key:"replicate",value:function(t,n){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:gp.generateDeviceName(this._entity),o=rf.getDefinitionForMINT(this._entity);if(null===o)throw new Error("Unable to find definition for component type: "+this._entity);var i=this._params.parameters,a=Pp.toMap(o.unique),l=Pp.toMap(o.heritable),s=new _f(i,a,l),c=new e(s,r,this._entity);console.log("Checking what the new component params are:",c._params);var u,h=Dp(this._featureIDs);try{for(h.s();!(u=h.n()).done;){var f=u.value,d=gp.getFeatureFromID(f),p=d.replicate(this.getPosition()[0],this.getPosition()[1]);p.referenceID=c.id,c.featureIDs.push(p.ID);var y=gp.getDeviceLayerFromID(f);y.addFeature(p)}}catch(m){h.e(m)}finally{h.f()}return console.warn("TODO: Generate renders for the new Features for this new component"),c.updateComponentPosition([t,n]),c}},{key:"getDrawOrigin",value:function(){try{var e=rf.getRendererForMINT(this._entity);return"function"===typeof e.drawsAtPositionCenter&&e.drawsAtPositionCenter()?this.getPosition():e.drawOriginFromCenter(Op(Op({},this._params.toJSON()),{},{position:this.getPosition()}))}catch(t){return this.getPosition()}}},{key:"getCenterPosition",value:function(){return this.getPosition()}},{key:"getTopLeftPosition",value:function(){var e=this.getBoundingRectangle();return[e.topLeft.x,e.topLeft.y]}},{key:"setPort",value:function(e,t){this._ports.set(e,t)}},{key:"getRotation",value:function(){if(this._params.hasParam("rotation"))return this.getValue("rotation");if(this._params.hasParam("orientation")){var e=this.getValue("orientation");return"V"===e?0:270}return console.warn("Returning rotation = 0 since no rotation was found for component: ",this),0}},{key:"getMirrorByX",value:function(){return this._params.hasParam("mirrorByX")?this.getValue("mirrorByX"):(console.warn("Returning mirrorByX = 0 since no rotation was found for component: ",this),0)}},{key:"getMirrorByY",value:function(){return this._params.hasParam("mirrorByY")?this.getValue("mirrorByY"):(console.warn("Returning mirrorByY = 0 since no rotation was found for component: ",this),0)}},{key:"attachComponentPortRender",value:function(e,t){this._componentPortTRenders.set(e,t)}},{key:"updateComponentPorts",value:function(){var e=this.params.toMap(),t=e.get("position");e.set("position",[t[0]-this._renderOffset[0],t[1]-this._renderOffset[1]]);var n,r=rf.getComponentPorts(e,this._entity),o=Dp(r);try{for(o.s();!(n=o.n()).done;){var i=n.value;this.setPort(i.label,i)}}catch(a){o.e(a)}finally{o.f()}}}],[{key:"fromInterchangeV1",value:function(t){var n,r,o,i=!1,a=t.name,l=t.id,s=rf.normalizeMint(t.entity,t.params),c=(t["x-span"],t["y-span"],rf.fillMissingHeritableDefaults(t.params,s));if(n=i?Iy.defaultParameterDefinitions():rf.getDefinitionForMINT(s),null===n)throw Error("Could not find definition for type: "+s);for(var u in t.params)Object.prototype.hasOwnProperty.call(n.heritable,u)?r=n.heritable[u]:Object.prototype.hasOwnProperty.call(n.unique,u)&&(r=n.unique[u]),o=t.params[u],"Float"===r&&"string"===typeof o&&(o=parseFloat(o)),c[u]=o;Object.prototype.hasOwnProperty.call(c,"position")||(c.position=[0,0]);var h=Pp.toMap(n.unique),f=Pp.toMap(n.heritable),d=new _f(c,h,f),p=new e(d,a,s,l);if(0===p.ports.size&&Array.isArray(t.ports)){var y,m=new Map,v=Dp(t.ports);try{for(v.s();!(y=v.n()).done;){var g=y.value,w=b.fromInterchangeV1(g);m.set(w.label,w)}}catch(_){v.e(_)}finally{v.f()}p.ports=m}return p}}]),e}();function Np(e){return Np="function"===typeof Symbol&&"symbol"===typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"===typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Np(e)}function xp(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Mp(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function Ip(e,t,n){return t&&Mp(e.prototype,t),n&&Mp(e,n),e}var Wp=function(){function e(t,n){xp(this,e),this._component=t,this._portLabel=n}return Ip(e,[{key:"portLabel",get:function(){return this._portLabel}},{key:"component",get:function(){return this._component}},{key:"toJSON",value:function(){return this._component instanceof Ep?{component:this._component.id,port:this._portLabel}:{component:this._component,port:this._portLabel}}}],[{key:"fromJSON",value:function(t,n){var r=null,o=n.component;if("string"===typeof o?r=o:o&&"object"===Np(o)&&(r=o.__id||o.id||null),null===r)throw new Error("Component not found");var i=t.getComponentByID(r);if(null!==i)return new e(i,n.port);throw new Error("Component not found")}}]),e}();function Ap(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function jp(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}
1function Bp(e,t,n){return t&&jp(e.prototype,t),n&&jp(e,n),e}var Vp=function(){function e(){Ap(this,e)}return Bp(e,null,[{key:"getDefinition",value:function(e){return rf.getDefinition("Connection")}},{key:"getFeatureFromID",value:function(e){return Pd.currentDevice.getFeatureByID(e)}}]),e}();function Xp(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function Yp(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Xp(Object(n),!0).forEach((function(t){Gp(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Xp(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function Gp(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Up(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function zp(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function Hp(e,t,n){return t&&zp(e.prototype,t),n&&zp(e,n),e}var Kp=function(){function e(t,n,r){Up(this,e),this.message=t,this.element=n,this.jsonData=r}return Hp(e,[{key:"toText",value:function(){var e="Error: ".concat(this.message,"\n");return e+="Element: ".concat(this.element,"\n"),e+="JSON Data:\n",e+="```\n",e+=this.jsonData,e+="\n```\n",e}}]),e}(),qp=function(){function e(){Up(this,e)}return Hp(e,null,[{key:"toInterchangeV1_2",value:function(t,n){if(null===t.currentDevice)throw new Error("No device selected");var r=[];if(null===t)throw new Error("Registry or viewManager not initialized");for(var o=0;o<t.renderLayers.length;o++)r.push(t.renderLayers[o].toInterchangeV1());var i=t.currentDevice.toInterchangeV1(n),a=Yp({},i.params||{});Object.prototype.hasOwnProperty.call(a,"dxfImport")&&delete a.dxfImport;var l={name:i.name,params:a,renderLayers:r,layers:i.layers,groups:i.groups,components:i.components,connections:i.connections,valves:i.valves,features:e.featuresToInterchangeV1_2(t.currentDevice.parchmintFeatures),version:"1.2"};return l}},{key:"featuresToInterchangeV1_2",value:function(e){var t=[];return e.forEach((function(e){t.push(e.toInterchageV1_2())})),t}},{key:"toConnectionTargetInterchangeV1",value:function(e){var t={component:e.component.id,port:e.portLabel};return t}}]),e}();function Jp(e,t){var n="undefined"!==typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=Zp(e))||t&&e&&"number"===typeof e.length){n&&(e=n);var r=0,o=function(){};return{s:o,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,l=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return a=e.done,e},e:function(e){l=!0,i=e},f:function(){try{a||null==n.return||n.return()}finally{if(l)throw i}}}}function Zp(e,t){if(e){if("string"===typeof e)return $p(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?$p(e,t):void 0}}function $p(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function Qp(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function ey(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function ty(e,t,n){return t&&ey(e.prototype,t),n&&ey(e,n),e}var ny=function(){function e(t,n,r,o,i){var a=arguments.length>5&&void 0!==arguments[5]?arguments[5]:rf.generateID();Qp(this,e),this.features=[],this._params=n,this._name=r,this._id=a,this._type=t,this._entity=o,this._featureIDs=[],this._nodes=[],this._bounds=null,this._source=null,this._sinks=[],this._paths=[],this._objects=[],this._routed=!1,this._layer=i}return ty(e,[{key:"layer",get:function(){return this._layer},set:function(e){this._layer=e}},{key:"sinks",get:function(){return this._sinks}},{key:"source",get:function(){return this._source}},{key:"routed",get:function(){return this._routed},set:function(e){this._routed=e}},{key:"featureIDs",get:function(){return this._featureIDs}},{key:"params",get:function(){return this._params},set:function(e){for(var t in this._params=e,e){var n,r=e.getValue(t),o=Jp(this._featureIDs);try{for(o.s();!(n=o.n()).done;){var i=n.value,a=Vp.getFeatureFromID(i);a.updateParameter(t,r.getValue())}}catch(l){o.e(l)}finally{o.f()}}}},{key:"setBounds",value:function(e){this._bounds=e;var t=e.topLeft;this._params.updateParameter("position",[t.x,t.y]),this._params.updateParameter("xspan",e.width),this._params.updateParameter("yspan",e.height)}},{key:"updateParameter",value:function(e,t){if(this._params.updateParameter(e,t),console.log("Key: ",e," Val: ",t),"segments"!=e){var n,r=Jp(this._featureIDs);try{for(r.s();!(n=r.n()).done;){var o=n.value,i=Vp.getFeatureFromID(o),a=i.getParams();Object.prototype.hasOwnProperty.call(a,e)&&i.updateParameter(e,t)}}catch(l){r.e(l)}finally{r.f()}}}},{key:"toInterchangeV1",value:function(){if(null===this._source)throw new Error("Source is null, cannot convert connection to interchange format:"+this._id);for(var e=[],t=0;t<this._paths.length;t++){var n=this._paths[t],r={source:null!==this._source?this._source.toJSON():null,sink:this.sinks.length>t?this._sinks[t].toJSON():null,wayPoints:n,features:this.features.map((function(e){return e.id}))};e.push(r)}var o={id:this._id,name:this._name,entity:this._entity,source:this._source.toJSON(),sinks:[],paths:e,params:this._params.toJSON(),layer:this._layer.id};if(null!==this._source&&(o.source=this._source.toJSON()),null!==this._sinks&&this._sinks.length>0){var i,a=[],l=Jp(this._sinks);try{for(l.s();!(i=l.n()).done;){var s=i.value;a.push(s.toJSON())}}catch(c){l.e(c)}finally{l.f()}o.sinks=this._sinks.map((function(e){return qp.toConnectionTargetInterchangeV1(e)}))}return o}},{key:"id",get:function(){return this._id}},{key:"name",get:function(){return this._name},set:function(e){this._name=e}},{key:"type",get:function(){return this._type}},{key:"getValue",value:function(e){try{return this._params.getValue(e)}catch(t){throw new Error("Unable to get value for key: "+e)}}},{key:"addFeatureID",value:function(e){this._featureIDs.push(e)}},{key:"updateBounds",value:function(){console.log("test");var e,t=null,n=null,r=null,o=Jp(this._featureIDs);try{for(o.s();!(e=o.n()).done;){var i=e.value;
1n=Vp.getFeatureFromID(i),console.log(n),r=pp(n,null),console.log("rendered:"),console.log(r),t=null===t?r.bounds:t.unite(r.bounds)}}catch(a){o.e(a)}finally{o.f()}this._bounds=t}},{key:"getPaths",value:function(){return this._paths}},{key:"updateSegments",value:function(e){this.updateParameter("segments",new mf("SegmentArray",e));var t,n=Jp(this._featureIDs);try{for(n.s();!(t=n.n()).done;){var r=t.value,o=Vp.getFeatureFromID(r);o.updateParameter("segments",e)}}catch(i){n.e(i)}finally{n.f()}}},{key:"insertFeatureGap",value:function(e){var t,n=this,r=!1,o=!1;e instanceof y.a.Rectangle?(t=new y.a.Path.Rectangle(e),o=!0):t=e;var i=this.getValue("segments"),a=function(e){var o=i[e],a=new y.a.Path.Line(new y.a.Point(o[0]),new y.a.Point(o[1])),l=a.getIntersections(t);if(l.length>=2){var s=l.map((function(e){return e.point})).sort((function(e,t){var n=a.firstSegment.point;return n.getDistance(e)-n.getDistance(t)})),c=s[0],u=s[s.length-1],h=n.breakSegment(o,c,u);if(console.log("breaking:",o,h),2!==h.length)throw new Error("Could not break the segments correctly");i.splice(e,1,h[0],h[1]),r=!0}else 1===l.length?(console.error("Only found 1 intersection point so going to use a different method"),console.log("Found Intersection:",l),console.log("Segments:",i),console.log("line:",a),console.log("Gap geometry:",t)):(console.error("No intersections found so going to use a different method"),console.log("Found Intersection:",l),console.log("Segments:",i),console.log("line:",a),console.log("Gap geometry:",t));a.remove()};for(var l in i)a(l);if(!r)throw console.error("There's something funky going on with the intersection,no intersections found"),console.log("Segments:",i),console.log("Gap geometry:",t),o&&t.remove(),new Error("Could not find 2 intersection points, hence aborting the whole thing");return this.updateSegments(i),o&&t.remove(),r}},{key:"insertValveGapsGeometric",value:function(e){if(!Array.isArray(e)||0===e.length)return!1;var t=this.getValue("segments");if(!Array.isArray(t)||0===t.length)return!1;var n=Kd(t,e);return this.updateSegments(n),n.length!==t.length}},{key:"breakSegment",value:function(e,t,n){var r,o,i=new y.a.Point(e[0]),a=new y.a.Point(e[1]),l=i.getDistance(t),s=a.getDistance(t),c=i.getDistance(n),u=a.getDistance(n);return l+u<s+c?(r=[[Math.round(i.x),Math.round(i.y)],[Math.round(t.x),Math.round(t.y)]],o=[[Math.round(a.x),Math.round(a.y)],[Math.round(n.x),Math.round(n.y)]]):(r=[[Math.round(a.x),Math.round(a.y)],[Math.round(t.x),Math.round(t.y)]],o=[[Math.round(i.x),Math.round(i.y)],[Math.round(n.x),Math.round(n.y)]]),[r,o]}},{key:"regenerateSegments",value:function(){var e,t=this.getPaths(),n=[];for(var r in t){e=t[r];for(var o=0;o<e.length-1;o++){var i=[e[o],e[o+1]];n.push(i)}}this.updateSegments(n)}},{key:"addConnectionTarget",value:function(e){e instanceof Wp&&null!==e&&void 0!=e||console.error("Cannot add non-ConnectionTarget object as source or sink"),null===this._source?this._source=e:this._sinks.push(e)}},{key:"tryDeleteConnectionTarget",value:function(e){var t=!1,n=this._source;for(var r in null!==n&&n.component.id==e&&(this._source=null,t=!0),this._sinks){var o=this._sinks[r];o.component.id==e&&(this._sinks.splice(+r,1),t=!0)}return t}},{key:"addWayPoints",value:function(e){this._paths.push(e)}},{key:"snapImportedTerminals",value:function(){if(null===this._source&&0===this._sinks.length)return!1;var e=Ce;try{e=Number(this.getValue("channelWidth")||Ce)}catch(c){try{e=Number(this.getValue("width")||Ce)}catch(u){e=Ce}}var t=Math.max(e/2,16),n=function(n,r){if(!n)return r;var o=n.component.ports.get(String(n.portLabel));if(!o)return r;var i=b.calculateAbsolutePosition(o,n.component),a=String(n.component.mint||n.component._entity||"").toUpperCase();return"MIXER"===a||"CURVED MIXER"===a||"MIXER3D"===a?b.mixerTerminalHinge(i,n.component,e):b.insetTowardCenter(i,n.component,t)};if(0===this._paths.length)try{var r=this.getValue("wayPoints");Array.isArray(r)&&r.length>=2&&this._paths.push(r.map((function(e){return[e[0],e[1]]})))}catch(h){}var o,i=!1,a=Jp(this._paths);try{for(a.s();!(o=a.n()).done;){var l=o.value;!l||l.length<2||(l[0]=n(this._source,l[0]),l[l.length-1]=n(this._sinks[0],l[l.length-1]),i=!0)}}catch(f){a.e(f)}finally{a.f()}if(!i)return!1;this.regenerateSegments();var s=this._paths[0];return s&&s.length>=2&&(this.updateParameter("wayPoints",s),this.updateParameter("start",s[0]),this.updateParameter("end",s[s.length-1])),!0}},{key:"mergeConnection",value:function(e){console.error("Merge the newly found connection with the new connection")}},{key:"setSourceFromJSON",value:function(e,t){var n=Wp.fromJSON(e,t);this._source=n}},{key:"addSinkFromJSON",value:function(e,t){var n=Wp.fromJSON(e,t);this._sinks.push(n)}},{key:"addFeature",value:function(e){this.features.push(e)}},{key:"removeFeature",value:function(e){this.features.splice(this.features.indexOf(e),1)}}],[{key:"fromInterchangeV1",value:function(t,n){var r=n.name,o=n.id,i=n.entity,a=n.params,l=t.getLayer(n.layer);
1if(null===l)throw new Error("Could not find layer with id: "+n.layer);Object.prototype.hasOwnProperty.call(a,"start")||(a.start=[0,0]),Object.prototype.hasOwnProperty.call(a,"end")||(a.end=[0,0]),Object.prototype.hasOwnProperty.call(a,"wayPoints")||(a.wayPoints=[[0,0],[1,2]]),Object.prototype.hasOwnProperty.call(a,"segments")||(a.segments=[[[0,0],[0,0]],[[0,0],[0,0]]]);var s=rf.getDefinition("Connection");if(null===s||void 0===s)throw new Error("Could not find the definition for the Connection");var c=new _f(a,Pp.toMap(s.unique),Pp.toMap(s.heritable)),u=new e(i,c,r,i,l,o);if(Object.prototype.hasOwnProperty.call(n,"source")&&null!==n.source&&void 0!==n.source&&u.setSourceFromJSON(t,n.source),Object.prototype.hasOwnProperty.call(n,"sinks")&&null!==n.sinks&&void 0!==n.sinks)for(var h in n.sinks){var f=n.sinks[h];u.addSinkFromJSON(t,f)}if(Object.prototype.hasOwnProperty.call(n,"paths")&&null!==n.paths&&void 0!==n.paths)for(var d in n.paths)u.addWayPoints(n.paths[d].wayPoints);return u}}]),e}();function ry(e){console.log("json to map");var t=new Map;for(var n in e){var r=e[n];console.log("Setting:",n,r),t.set(n,r)}return t}function oy(e){if(Object.prototype.hasOwnProperty.call(e,"params")){if(Object.prototype.hasOwnProperty.call(e.params,"width")){var t=e.params.width;e.params.xspan=t,delete e.params.width,console.warn("Fixed issue with incorrect device xspan param")}if(Object.prototype.hasOwnProperty.call(e.params,"length")){var n=e.params.length;e.params.yspan=n,delete e.params.length,console.warn("Fixed issue with incorrect device yspan param")}}}function iy(e){oy(e)}function ay(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function ly(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function sy(e,t,n){return t&&ly(e.prototype,t),n&&ly(e,n),e}var cy=function(){function e(){ay(this,e)}return sy(e,null,[{key:"addLayer",value:function(e,t){Pd.viewManager.addLayer(e,t)}},{key:"generateNewName",value:function(t){var n=e.__nameMap.get(t);return void 0!=n?(this.__nameMap.set(t,n+1),t+"_"+String(n+1)):(this.__nameMap.set(t,1),t+"_1")}}]),e}();function uy(e,t){return dy(e)||fy(e,t)||yy(e,t)||hy()}function hy(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function fy(e,t){var n=null==e?null:"undefined"!==typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,i=[],a=!0,l=!1;try{for(n=n.call(e);!(a=(r=n.next()).done);a=!0)if(i.push(r.value),t&&i.length===t)break}catch(s){l=!0,o=s}finally{try{a||null==n["return"]||n["return"]()}finally{if(l)throw o}}return i}}function dy(e){if(Array.isArray(e))return e}function py(e,t){var n="undefined"!==typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=yy(e))||t&&e&&"number"===typeof e.length){n&&(e=n);var r=0,o=function(){};return{s:o,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,l=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return a=e.done,e},e:function(e){l=!0,i=e},f:function(){try{a||null==n.return||n.return()}finally{if(l)throw i}}}}function yy(e,t){if(e){if("string"===typeof e)return my(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?my(e,t):void 0}}function my(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function vy(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function gy(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};
1t%2?vy(Object(n),!0).forEach((function(t){wy(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):vy(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function wy(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function by(e){return by="function"===typeof Symbol&&"symbol"===typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"===typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},by(e)}function _y(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Py(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function Cy(e,t,n){return t&&Py(e.prototype,t),n&&Py(e,n),e}cy.__nameMap=new Map;var Oy=function(){function e(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"New Device";_y(this,e),this.__layers=[],this.__textLayers=[],this.__groups=[];var r=t&&"object"===by(t)?gy({},t):{},o=null!=r["x-span"]?r["x-span"]:null!=r.width?r.width:r.xspan,i=null!=r["y-span"]?r["y-span"]:null!=r.length?r.length:r.yspan;null!=o&&(r["x-span"]=o),null!=i&&(r["y-span"]=i),this.__params=new _f(r,e.getUniqueParameters(),e.getHeritableParameters()),this.__name=n,this.__components=[],this.__nameMap=new Map,this.__connections=[],this.__valveMap=new Map,this.__valveTypeMap=new Map,this.__parchmintFeatures=[]}return Cy(e,[{key:"addValve",value:function(e,t,n){this.__valveMap.set(e,t),this.__valveTypeMap.set(e,n)}},{key:"name",get:function(){return this.__name},set:function(e){this.__name=e}},{key:"nameMap",set:function(e){this.__nameMap=e}},{key:"layers",get:function(){return this.__layers}},{key:"parchmintFeatures",get:function(){return this.__parchmintFeatures}},{key:"addConnection",value:function(e){this.__connections.push(e)}},{key:"removeConnection",value:function(e){var t=this.__connections.indexOf(e);-1!=t&&this.__connections.splice(t,1)}},{key:"addComponent",value:function(e){if(!(e instanceof Ep))throw new Error("Tried to add a component that isn't a component to the device");this.__components.push(e),console.log("component",e)}},{key:"removeComponent",value:function(e){var t,n,r=e.id,o=null,i=py(this.__connections);try{for(i.s();!(n=i.n()).done;){var a=n.value;try{t=a.tryDeleteConnectionTarget(r),t&&console.log("Removed Component from Connection : ",a.id)}catch(c){console.error(c)}}}catch(u){i.e(u)}finally{i.f()}var l=this.__valveMap.get(r);void 0!=l&&(o=this.getConnectionByID(l),this.__valveMap.delete(r));var s=this.__components.indexOf(e);return-1!=s&&this.__components.splice(s,1),o}},{key:"components",get:function(){return this.__components}},{key:"syncComponentPositionsToFeatures",value:function(){var e,t=py(this.__components);try{for(t.s();!(e=t.n()).done;){var n=e.value,r=n.featureIDs;if(r&&0!==r.length)try{var o=this.getFeatureByID(r[0]),i=o.getValue("position");if(!Array.isArray(i)||i.length<2)continue;var a=n.getPosition();if(Number(a[0])===Number(i[0])&&Number(a[1])===Number(i[1]))continue;n.adoptFeaturePosition([Number(i[0]),Number(i[1])])}catch(l){console.warn("Could not sync component position to feature:",n.id,l)}}}catch(l){t.e(l)}finally{t.f()}}},{key:"updateParameter",value:function(e,t){this.__params.updateParameter(e,t)}},{key:"getLayer",value:function(e){for(var t in this.__layers){var n=this.__layers[t];if(n.id==e)return n}return null}},{key:"getLayerFromFeatureID",value:function(e){for(var t=0;t<this.__layers.length;t++){var n=this.__layers[t];if(n.containsFeatureID(e))return n}for(var r=0;r<this.__textLayers.length;r++){var o=this.__textLayers[r];if(o.containsFeatureID(e))return o}throw new Error("FeatureID "+e+" not found in any layer.")}},{key:"containsFeatureID",value:function(e){for(var t=0;t<this.__layers.length;t++)if(this.__layers[t].containsFeatureID(e))return!0;return!1}},{key:"getAllFeaturesFromDevice",value:function(){var e=[];for(var t in this.__layers){var n=this.__layers[t];for(var r in n.features)e.push(n.getFeature(r))}return e}},{key:"getFeatureByID",value:function(e){var t=this.getLayerFromFeatureID(e);return t.getFeature(e)}},{key:"getFeatureByName",value:function(e){for(var t,n,r=0;r<this.__layers.length;r++)for(var o in t=this.__layers[r],n=t.getAllFeaturesFromLayer(),n){var i=n[o];if(i.getName()===e)return i}for(var a=0;a<this.__textLayers.length;a++)for(var l in t=this.__layers[a],n=t.getAllFeaturesFromLayer(),n){var s=n[l];if(s.getName()===e)return s}throw new Error("FeatureID "+e+" not found in any layer.")}},{key:"addLayer",value:function(e){e.device=this,this.__layers.push(e),cy.addLayer(e,this.__layers.indexOf(e))}},{key:"addLayerAtIndex",value:function(e,t){e.device=this,this.__layers.splice(t,0,e),cy.addLayer(e,this.__layers.indexOf(e))}},{key:"removeFeature",value:function(e){if("Connection"==e.type)for(var t=0;t<this.__connections.length;t++)for(var n=this.__connections[t].featureIDs,r=0;r<n.length;r++)this.__connections[t].featureIDs[r]==e.ID&&(this.__connections[t].featureIDs.splice(r,1),0==this.__connections[t].featureIDs.length&&this.__connections.splice(t,1)
1);else for(var o=0;o<this.__components.length;o++)for(var i=this.__components[o].featureIDs,a=0;a<i.length;a++)this.__components[o].featureIDs[a]==e.ID&&(this.__components[o].featureIDs.splice(a,1),0==this.__components[o].featureIDs.length&&this.__components.splice(o,1))}},{key:"updateObjectReference",value:function(e,t){var n,r=!1,o=py(this.__components);try{for(o.s();!(n=o.n()).done;){var i=n.value;e==i.id&&(i.addFeatureID(t),i.placed=!0,r=!0)}}catch(c){o.e(c)}finally{o.f()}var a,l=py(this.__connections);try{for(l.s();!(a=l.n()).done;){var s=a.value;e==s.id&&(s.addFeatureID(t),s.routed=!0,r=!0)}}catch(c){l.e(c)}finally{l.f()}r||console.error("Could not find object to update reference: "+t)}},{key:"__groupsToJSON",value:function(){var e=[];for(var t in this.__groups)e.push(this.__groups[t]);return e}},{key:"__layersToJSON",value:function(){var e=[];for(var t in this.__layers)e.push(this.__layers[t].toJSON());return e}},{key:"__componentsToInterchangeV1",value:function(e){var t=[];for(var n in this.__components)try{t.push(this.__components[n].toInterchangeV1())}catch(r){console.error(r),e.push(new Kp(r.message,"Component ".concat(this.__components[n].id," could not be converted to InterchangeV1"),JSON.stringify(this.__components[n])))}return t}},{key:"__connectionToInterchangeV1",value:function(e){var t=[];for(var n in this.__connections)try{t.push(this.__connections[n].toInterchangeV1())}catch(r){console.error(r),e.push(new Kp(r.message,"Connection : ".concat(this.__connections[n].id," could not be converted to InterchangeV1"),JSON.stringify(this.__connections[n])))}return t}},{key:"__valvesToInterchangeV1",value:function(e){var t=this,n=[];return this.__valveMap.forEach((function(r,o){var a=t.__valveTypeMap.get(o);void 0===a&&(console.warn("Valve type not found for valve: "+o+" , setting default to NORMALLY_OPEN"),a=i.NORMALLY_OPEN);try{n.push({componentid:o,connectionid:r,type:a,params:{}})}catch(l){console.error(l),e.push(new Kp(l.message,"Valve : ".concat(o," could not be converted to InterchangeV1"),JSON.stringify(o)))}})),n}},{key:"__featureLayersToInterchangeV1",value:function(){var e=[];for(var t in this.__layers)e.push(this.__layers[t].toInterchangeV1());return e}},{key:"__layersToInterchangeV1",value:function(e){var t=[];for(var n in this.__layers)try{t.push(this.__layers[n].toInterchangeV1())}catch(r){console.error(r),e.push(new Kp(r.message,"Layer ".concat(this.__layers[n].id," could not be converted to InterchangeV1"),JSON.stringify(this.__layers[n])))}return t}},{key:"__loadLayersFromInterchangeV1",value:function(e){for(var t in e){var n=Sf.fromInterchangeV1(e[t],this);this.addLayer(n)}}},{key:"__loadComponentsFromInterchangeV1",value:function(e){var t;for(var n in e)t=Ep.fromInterchangeV1(e[n]),this.__components.push(t)}},{key:"__loadConnectionsFromInterchangeV1",value:function(e){var t;for(var n in e)t=ny.fromInterchangeV1(this,e[n]),this.__connections.push(t)}},{key:"toInterchangeV1",value:function(e){var t={width:this.getXSpan(),length:this.getYSpan()},n=this.getOptionalParam("dxfImport");n&&(t.dxfImport=n);var r={name:this.__name,params:t,layers:this.__layersToInterchangeV1(e),components:this.__componentsToInterchangeV1(e),connections:this.__connectionToInterchangeV1(e),valves:this.__valvesToInterchangeV1(e),version:"1",groups:this.__groupsToJSON()};return r}},{key:"toInterchangeV1_1",value:function(e){var t={name:this.__name,params:{width:this.getXSpan(),length:this.getYSpan()},layers:this.__layersToInterchangeV1(e),components:this.__componentsToInterchangeV1(e),connections:this.__connectionToInterchangeV1(e),version:"1.1",groups:this.__groupsToJSON()};return t}},{key:"setXSpan",value:function(e){this.__params.updateParameter("x-span",e)}},{key:"setYSpan",value:function(e){this.__params.updateParameter("y-span",e)}},{key:"getXSpan",value:function(){return this.__params.getValue("x-span")}},{key:"getYSpan",value:function(){return this.__params.getValue("y-span")}},{key:"getOptionalParam",value:function(e){return Object.prototype.hasOwnProperty.call(this.__params.parameters,e)?this.__params.getValue(e):null}},{key:"createNewLayerBlock",value:function(e){for(var t in e)this.addLayer(e[t])}},{key:"deleteLayer",value:function(e){var t=this.__layers[e];
1for(var n in t.features)this.removeFeature(t.features[n]);-1!=e&&this.__layers.splice(e,1)}},{key:"getComponentForFeatureID",value:function(e){for(var t in this.__components){var n=this.__components[t];for(var r in n.featureIDs){var o=n.featureIDs[r];if(o===e)return n}}return null}},{key:"generateNewName",value:function(e){var t=this.__nameMap.get(e);return void 0!=t?(this.__nameMap.set(e,t+1),e+"_"+String(t+1)):(this.__nameMap.set(e,1),e+"_1")}},{key:"getConnectionForFeatureID",value:function(e){for(var t in this.__connections){var n=this.__connections[t];for(var r in n.featureIDs){var o=n.featureIDs[r];if(o===e)return n}}return null}},{key:"insertValve",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:i.NORMALLY_OPEN;this.__valveMap.set(e.id,t.id),this.__valveTypeMap.set(e.id,n)}},{key:"connections",get:function(){return this.__connections}},{key:"getValvesForConnection",value:function(e){var t,n=e.id,r=[],o=py(this.__valveMap);try{for(o.s();!(t=o.n()).done;){var i=uy(t.value,2),a=i[0],l=i[1];if(n===l){var s=this.getComponentByID(a);null!==s&&r.push(s)}}}catch(c){o.e(c)}finally{o.f()}return r}},{key:"getValveType",value:function(e){var t=e.id,n=this.__valveTypeMap.get(t);if(void 0===n)throw new Error("Valve not found");return n}},{key:"getComponentByID",value:function(e){for(var t in this.__components){var n=this.__components[t];if(n.id===e)return n}return null}},{key:"getConnectionByID",value:function(e){for(var t in this.__connections){var n=this.__connections[t];if(n.id===e)return n}return null}},{key:"getComponentByName",value:function(e){var t,n=this.__components,r=py(n);try{for(r.s();!(t=r.n()).done;){var o=t.value;if(e==o.name)return o}}catch(i){r.e(i)}finally{r.f()}throw new Error("Component with name "+e+"does not exist")}},{key:"getUnroutedConnections",value:function(){var e,t=[],n=this.__connections,r=py(n);try{for(r.s();!(e=r.n()).done;){var o=e.value;o.routed||t.push(o)}}catch(i){r.e(i)}finally{r.f()}return t}},{key:"getPositionOfComponentPort",value:function(e){var t,n=this.__components,r=py(n);try{for(r.s();!(t=r.n()).done;){var o,i=t.value,a=py(i.ports.keys());try{for(a.s();!(o=a.n()).done;){var l=o.value,s=i.ports.get(l);if(void 0!=s&&e.id==s.id)return b.calculateAbsolutePosition(e,i)}}catch(c){a.e(c)}finally{a.f()}}}catch(c){r.e(c)}finally{r.f()}}},{key:"textLayers",get:function(){return this.__textLayers}}],[{key:"getUniqueParameters",value:function(){var e=new Map;return e.set("x-span","Float"),e.set("y-span","Float"),e}},{key:"getHeritableParameters",value:function(){return new Map}},{key:"fromInterchangeV1",value:function(t){var n;if(Object.prototype.hasOwnProperty.call(t,"params")?n=Object.prototype.hasOwnProperty.call(t.params,"width")&&Object.prototype.hasOwnProperty.call(t.params,"length")?new e({width:t.params.width,length:t.params.length},t.name):new e({width:135e3,length:85e3},t.name):(console.warn("Could not find device params, using some default values for device size"),n=new e({width:135e3,length:85e3},t.name)),n.__loadComponentsFromInterchangeV1(t.components),n.__loadConnectionsFromInterchangeV1(t.connections),Object.prototype.hasOwnProperty.call(t,"layers"))n.__loadLayersFromInterchangeV1(t.layers);else{var r=new Sf({},"flow",o.FLOW,"0",n);n.addLayer(r),r=new Sf({},"control",o.CONTROL,"0",n),n.addLayer(r)}var i,a=n.getAllFeaturesFromDevice();for(var l in a)i=a[l],null!==i.referenceID&&n.updateObjectReference(i.referenceID,i.ID);return n.syncComponentPositionsToFeatures(),n}},{key:"fromInterchangeV1_1",value:function(t){var n,r,a;if(iy(t),Object.prototype.hasOwnProperty.call(t,"params")?n=Object.prototype.hasOwnProperty.call(t.params,"xspan")&&Object.prototype.hasOwnProperty.call(t.params,"yspan")?new e({width:t.params.xspan,length:t.params.yspan},t.name):new e({width:135e3,length:85e3},t.name):(console.warn("Could not find device params, using some default values for device size"),n=new e({width:135e3,length:85e3},t.name)),n.__loadComponentsFromInterchangeV1(t.components),n.__loadConnectionsFromInterchangeV1(t.connections),Object.prototype.hasOwnProperty.call(t.params,"valveMap")&&Object.prototype.hasOwnProperty.call(t.params,"valveTypeMap")){r=ry(t.params.valveMap),console.log("Imported valvemap",r),console.log("Loaded valvetypemap",t.params.valveTypeMap),a=ry(t.params.valveTypeMap),c
1onsole.log(t.params.valveTypeMap,a);var l,s=py(r);try{for(s.s();!(l=s.n()).done;){var c=uy(l.value,2),u=c[0],h=c[1],f=n.getComponentByID(u);if(null===f)throw console.error("Could not find valve with id:",u),new Error("Could not find valve with id: "+u);var d=n.getConnectionByID(h);if(null===d)throw console.error("Could not find connection with id:",h),new Error("Could not find connection with id: "+h);var p=a.get(u);i.NORMALLY_OPEN;if("NORMALLY_OPEN"===p)i.NORMALLY_OPEN;else{if("NORMALLY_CLOSED"!==p)throw console.warn("Could not find valve type for valve with id:",u),new Error("Could not find valve type for valve with id: "+u);i.NORMALLY_CLOSED}n.insertValve(f,d,a.get(u))}}catch(w){s.e(w)}finally{s.f()}}if(Object.prototype.hasOwnProperty.call(t,"features"))n.__loadLayersFromInterchangeV1(t.layers);else{var y=new Sf({},"flow",o.FLOW,"0",n);n.addLayer(y),y=new Sf({},"control",o.CONTROL,"0",n),n.addLayer(y)}var m,v=n.getAllFeaturesFromDevice();for(var g in v)m=v[g],null!==m.referenceID&&n.updateObjectReference(m.referenceID,m.ID);return n.syncComponentPositionsToFeatures(),n}},{key:"makeFeature",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"New Feature",r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:void 0,o=arguments.length>5?arguments[5]:void 0,i=new _f(new Map,new Map,new Map);if("EDGE"===e){var a=new gm(null,i,r);if(o)for(var l=0;l<o.length;l++){var s=o[l];s&&a.addDXFObject(ff.fromJSON(s))}return a}var c=rf.getDefinition(e);if(t&&c)"BetterMixer"!==e&&"CurvedMixer"!==e&&"3DMixer"!==e||Fe(t),am.checkDefaults(t,c.heritable,rf.getDefaultsForType(e)),i=new _f(t,Pp.toMap(c.unique),Pp.toMap(c.heritable));else{var u=new Map;i=new _f(t,u.set("position","Point"),new Map)}var h=new am(e,i,n,r);if(o)for(var f=0;f<o.length;f++)h.addDXFObject(ff.fromJSON(o[f]));return h}}]),e}();function Sy(e){return Sy="function"===typeof Symbol&&"symbol"===typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"===typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Sy(e)}function Dy(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Ry(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function Ty(e,t,n){return t&&Ry(e.prototype,t),n&&Ry(e,n),e}function Ly(e,t){if("function"!==typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&Fy(e,t)}function Fy(e,t){return Fy=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},Fy(e,t)}function ky(e){var t=xy();return function(){var n,r=My(e);if(t){var o=My(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return Ey(this,n)}}function Ey(e,t){if(t&&("object"===Sy(t)||"function"===typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return Ny(e)}function Ny(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function xy(){if("undefined"===typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"===typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}function My(e){return My=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},My(e)}var Iy=function(e){Ly(n,e);var t=ky(n);function n(e,r){var o,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:e.toUpperCase();return Dy(this,n),o=t.call(this),o.dxfData=null,o._type="",o._entity="",o._renderData=null,o._params=new _f({},new Map,new Map),o._type=e,o._entity=i,o.dxfData=r,o}return Ty(n,[{key:"entity",get:function(){return this._entity}},{key:"type",get:function(){return this._type}},{key:"renderData",set:function(e){this._renderData=e}},{key:"generateComponent",value:function(){var e={}
1,t=Oy.makeFeature(this.type,e,cy.generateNewName(this.type),rf.generateID(),"XY",this.dxfData);return t}},{key:"toJSON",value:function(){var e=[];for(var t in this.dxfData)e.push(this.dxfData[t].getData());var n={type:this.type,entity:this.entity,params:this._params.toJSON(),dxfData:e};return n}}],[{key:"fromInterchangeV1",value:function(e){var t=[];for(var r in e.dxfData)t.push(new ff(e.dxfData[r]));var o=new n(e.type,t,e.entity);return o}},{key:"defaultParameterDefinitions",value:function(){var e={unique:{position:"Point"},heritable:{rotation:"Float",height:"Float"},units:{rotation:"°",height:"μm"},defaults:{rotation:0,height:100},minimum:{rotation:0,height:1},maximum:{rotation:359,height:1200},mint:""};return e}}]),n}(R),Wy=n("ba10"),Ay=n.n(Wy);function jy(e){return jy="function"===typeof Symbol&&"symbol"===typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"===typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},jy(e)}function By(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Vy(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function Xy(e,t,n){return t&&Vy(e.prototype,t),n&&Vy(e,n),e}function Yy(e,t){if("function"!==typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&Gy(e,t)}
1function Gy(e,t){return Gy=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},Gy(e,t)}function Uy(e){var t=Ky();return function(){var n,r=qy(e);if(t){var o=qy(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return zy(this,n)}}function zy(e,t){if(t&&("object"===jy(t)||"function"===typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return Hy(e)}function Hy(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Ky(){if("undefined"===typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"===typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}function qy(e){return qy=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},qy(e)}var Jy=function(e){Yy(n,e);var t=Uy(n);function n(){return By(this,n),t.apply(this,arguments)}return Xy(n,null,[{key:"get",value:function(){return null===n.instance&&(n.instance=new n),n.instance}}]),n}(Ay.a);Jy.instance=null,Jy.NAVBAR_SCROLL_EVENT="navbar_scroll_event",Jy.SHOW_COMPONENT_PARAMS="show_component_params_event",Jy.SHOW_CONNECTION_PARAMS="show_connection_params_event",Jy.UPDATE_GRID_SIZE="update_grid_size",Jy.EDIT_CONNECTION="edit_connection",Jy.DBL_CLICK_COMPONENT="dbl_click_component",Jy.DBL_CLICK_ELEMENT="dbl_click_element",Jy.DBL_CLICK_CONNECTION="dbl_click_connection",Jy.DBL_CLICK_FEATURE="dbl_click_connection",Jy.UPDATE_RENDERS="update_renders",Jy.RIGHT_CLICK="right_click",Jy.CLOSE_ALL_WINDOWS="close_all_windows",Jy.SIDEBAR_COMPONENT_ACTIVATED="sidebar_component_activated",Jy.SIDEBAR_SETTINGS_OPENED="sidebar_settings_opened",Jy.SIDEBAR_PLACEMENT_SETTINGS_REPOSITION="sidebar_placement_settings_reposition",Jy.CONNECTION_ESC_HINT="connection_esc_hint",Jy.ACTIVE_RENDER_LAYER_CHANGED="active_render_layer_changed",Jy.PORTS_ONLY_VIEW_CHANGED="ports_only_view_changed",Jy.UPDATE_ZOOM="update_zoom";var Zy="__SIDEBAR_CONNECTION__",$y=Jy;function Qy(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function em(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function tm(e,t,n){return t&&em(e.prototype,t),n&&em(e,n),e}var nm=function(){function e(){Qy(this,e)}return tm(e,null,[{key:"setSubstrate",value:function(e,t){var n,r=e.layer;if(null===r)throw new Error("Layer never set for feature "+e.ID);if(null===Pd.currentDevice)throw new Error("Current device has not been set in registry");if(r.type==o.FLOW)n=t.includes("-")?~~(Pd.currentDevice.layers.indexOf(r)/3)-parseInt(t):~~(Pd.currentDevice.layers.indexOf(r)/3)+parseInt(t);else if(r.type==o.CONTROL)n=t.includes("-")?~~(Pd.currentDevice.layers.indexOf(r)/3)-parseInt(t):"0"!=t?~~(Pd.currentDevice.layers.indexOf(r)/3)+parseInt(t):1+~~(Pd.currentDevice.layers.indexOf(r)/3);else{if(r.type!=o.INTEGRATION)throw new Error("Layer type"+r.type+"not recognized");n=t.includes("-")?~~(Pd.currentDevice.layers.indexOf(r)/3)-parseInt(t):~~(Pd.currentDevice.layers.indexOf(r)/3)+parseInt(t)}return n}}]),e}();function rm(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function om(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function im(e,t,n){return t&&om(e.prototype,t),n&&om(e,n),e}var am=function(){function e(t,n,r){var o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:rf.generateID(),i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:nf.XY;rm(this,e),this._type=t,this._params=n,this._name=r,this._id=o,this._type=t,this._fabtype=i,this._dxfObjects=[],this._referenceID=null,this.layer=null;var a,l=rf.library[this.type],s=this.deriveRenderName();a="Port"==this.type?"PORT":"COMPONENT",console.log("rendName: ",s);var c=l?l.object.zOffsetKey(s):"height",u=0;if(l)try{u=this.getValue(c)}catch(h){u=0}this._manufacturingInfo={fabtype:i,layertype:null,rendername:s,z_offset_key:c,depth:u,substrate_offset:l?l.object.substrateOffset(s):"0",substrate:null,modifier:a}}return im(e,[{key:"id",get:function(){return this._id}},{key:"type",get:function(){return this._type}},{key:"referenceID",get:function(){return this._referenceID},set:function(e){this._referenceID=e}},{key:"dxfObjects",get:function(){return this._dxfObjects},set:function(e){this._dxfObjects=e}},{key:"fabType",get:function(){return this._fabtype}},{key:"manufacturingInfo",get:function(){return this.setManufacturingInfoLayer(),this._manufacturingInfo}},{key:"setManufacturingInfoLayer",value:function(){var e=rf.library[this.type];if(e){if(this._manufacturingInfo.depth=this.getValue(e.object.zOffsetKey(this.deriveRenderName())),null===this.layer)throw new Error("Layer not set in feature "+this.ID+" so manufacturingInfo cannot be set");this._manufacturingInfo.layertype=this.layer.type,this._manufacturingInfo.substrate=nm.setSubstrate(this,this._manufacturingInfo.substrate_offset)}}},{key:"updateParameter",value:function(e,t){this._params.updateParameter(e,t),$y.get().emit($y.UPDATE_RENDERS,this,!0,e)}},{key:"toJSON",value:function(){var e={id:this._id,name:this._name,type:this._type,params:this._params.toJSON()};return e}},{key:"toInterchangeV1",value:function(){var e,t,n={id:this._id,name:this._name,macro:this._type,params:this._params.toJSON(),type:this._fabtype,referenceID:this._referenceID,dxfData:this._dxfObjects.map((function(e){return e.toJSON()})),layerID:null!==(e=null===(t=this.layer)||void 0===t?void 0:t.id)&&void 0!==e?e:""};return n}},{key:"ID",get:function(){return this._id}},{key:"setName",value:function(e){this._name=e}},{key:"getName",value:function(){return this._name}},{key:"getType",value:function(){return this._type}},{key:"getValue",value:function(e){try{return this._params.getValue(e)}catch(t){if(this.hasDefaultParam(e))return this.getDefaults()[e];throw new Error("Unable to get value for key: "+e)}}},{key:"hasDefaultParam",value:function(e){return!!this.getDefaults().hasOwnProperty(e)}},{key:"hasUniqueParam",value:function(e){return this._params.isUnique(e)}},{key:"hasHeritableParam",value:function(e){return this._params.isHeritable(e)}},{key:"getHeritableParams",value:function(){return rf.getHeritableForType(this.getType())}},{key:"getUniqueParams",value:function(){return rf.getUniqueForType(this.getType())}},{key:"getDefaults",value:function(){return rf.getDefaultsForType(this.getType())}},{key:"getParams",value:function(){return this._params.parameters}},{key:"setParams",value:function(e){this._params.loadParameters(e)}},{key:"replicate",value:function(e,t){this._params;var n={position:[e,t]};for(var r in this._params.parameters)n[r]=this.getValue(r);var o=Oy.makeFeature(this._type,n,this._name,rf.generateID(),"XY",this._dxfObjects.map((function(e){return e.toJSON()})));return o}},{key:"deriveRenderName",value:function(){var e=rf.library[this.type];return e?e.key:(console.error("Type unrecognized, defaulting render key to FLOW:",this.type),"FLOW")}},{key:"getDXFObjects",value:function(){return this._dxfObjects}},{key:"addDXFObject",value:function(e){this._dxfObjects.push(e)}}],[{key:"checkDefaults",value:function(e,t,n){for(var r in t)Object.prototype.hasOwnProperty.call(e,r)||(e[r]=n[r]);return e}},{key:"fromJSON",value:function(e){return Oy.makeFeature(e.type,e.params,e.name,e.id,"XY",[])}},{key:"fromInterchangeV1",value:function(e){var t;return t=Oy.makeFeature(e.macro,e.params,e.name,e.id,e.type,e.dxfData),Object.prototype.hasOwnProperty.call(e,"referenceID")&&(t.referenceID=e.referenceID),t}},{key:"makeCustomComponentFeature",value:function(t,n,r){var o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"New Feature",i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:void 0,a=Iy.defaultParameterDefinitions();e.checkDefaults(r,a.heritable,rf.getDefaultsForType(t.type));var l=new _f(r,Pp.toMap(a.unique),Pp.toMap(a.heritable)),s=new e(t.type,l,o,i,nf.XY);return s.dxfObjects=t.dxfData,s}}]),e}();function lm(e){return lm="function"===typeof Symbol&&"symbol"===typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"===typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},lm(e)}function sm(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function cm(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function um(e,t,n){return t&&cm(e.prototype,t),n&&cm(e,n),e}function hm(e,t){if("function"!==typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&fm(e,t)}function fm(e,t){return fm=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},fm(e,t)}function dm(e){var t=mm();return function(){var n,r=vm(e);
1if(t){var o=vm(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return pm(this,n)}}function pm(e,t){if(t&&("object"===lm(t)||"function"===typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return ym(e)}function ym(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function mm(){if("undefined"===typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"===typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}function vm(e){return vm=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},vm(e)}var gm=function(e){hm(n,e);var t=dm(n);function n(e,r){var o,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:rf.generateID();return sm(this,n),o=t.call(this,"EDGE",r,i,i,nf.EDGE),o._edgeObjects=e||[],o}return um(n,[{key:"generateRectEdge",value:function(e,t){e/=1e3,t/=1e3;var n=new ff({type:"POLYLINE",vertices:[{x:0,y:0,z:0},{x:e,y:0,z:0},{x:e,y:t,z:0},{x:0,y:t,z:0},{x:0,y:0,z:0}]});this.addDXFObject(n)}}]),n}(am);function wm(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function bm(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function _m(e,t,n){return t&&bm(e.prototype,t),n&&bm(e,n),e}var Pm=function(){function e(){wm(this,e)}return _m(e,null,[{key:"renderGrid",value:function(t){var n=new y.a.Group;return n.addChild(e.makeHorizontalLines(t)),n.addChild(e.makeVerticalLines(t)),n}},{key:"vertLineSymbol",value:function(t,n){return e.lineSymbol(y.a.view.bounds.topLeft,y.a.view.bounds.bottomLeft,t,n)}},{key:"horizLineSymbol",value:function(t,n){return e.lineSymbol(y.a.view.bounds.topLeft,y.a.view.bounds.topRight,t,n)}},{key:"lineSymbol",value:function(e,t,n,r){r.alpha=.25;var o=new y.a.Path.Line({from:e,to:t,strokeWidth:n,strokeColor:r});return o.remove(),new y.a.SymbolDefinition(o)}},{key:"isThick",value:function(e,t,n,r){var o=Math.abs(e-t),i=o%(n*r);return i<n}},{key:"makeVerticalLines",value:function(t){for(var n=t.getSpacing(),r=e.vertLineSymbol(t.getThinWidth(),t.color),o=e.vertLineSymbol(t.getThickWidth(),t.color),i=y.a.view.bounds.topLeft,a=y.a.view.bounds.topRight,l=y.a.view.bounds.height,s=new y.a.Group,c=Math.floor((i.x-t.origin.x)/n)*n+t.origin.x,u=c;u<a.x;u+=n){var h=new y.a.Point(u,i.y+l/2);e.isThick(u,t.origin.x,n,t.thickCount)?s.addChild(o.place(h)):s.addChild(r.place(h))}for(var f=c;f>=a.x;f-=n){var d=new y.a.Point(f,i.y+l/2);e.isThick(f,t.origin.x,n,t.thickCount)?s.addChild(o.place(d)):s.addChild(r.place(d))}return s}},{key:"makeHorizontalLines",value:function(t){for(var n=t.getSpacing(),r=e.horizLineSymbol(t.getThinWidth(),t.color),o=e.horizLineSymbol(t.getThickWidth(),t.color),i=y.a.view.bounds.topLeft,a=y.a.view.bounds.bottomLeft,l=y.a.view.bounds.width,s=new y.a.Group,c=Math.floor((i.y-t.origin.y)/n)*n+t.origin.y,u=c;u<a.y;u+=n){var h=new y.a.Point(i.x+l/2,u);e.isThick(u,t.origin.y,n,t.thickCount)?s.addChild(o.place(h)):s.addChild(r.place(h))}for(var f=c;f>=a.y;f-=n){var d=new y.a.Point(i.x+l/2,f);e.isThick(f,t.origin.y,n,t.thickCount)?s.addChild(o.place(d)):s.addChild(r.place(d))}return s}}]),e}();function Cm(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Om(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function Sm(e,t,n){return t&&Om(e.prototype,t),n&&Om(e,n),e}var Dm=ad,Rm=5,Tm=function(){function e(){Cm(this,e)}return Sm(e,null,[{key:"renderLayerMask",value:function(e){var t=e.getXSpan(),n=e.getYSpan(),r=new y.a.Color(sd);r.alpha=.5;var o=new y.a.Path.Rectangle({from:new y.a.Point(0,0),to:new y.a.Point(t,n),fillColor:r,strokeColor:null});return o}},{key:"renderDevice",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Dm,n=new y.a.Path.Rectangle({from:y.a.view.bounds.topLeft.subtract(new y.a.Point(y.a.view.size)),to:y.a.view.bounds.bottomRight.add(new y.a.Point(y.a.view.size)),fillColor:new y.a.Color(rd),strokeColor:null}),r=Rm/y.a.view.zoom,o=e.getXSpan(),i=e.getYSpan(),a=new y.a.Path.Rectangle({from:new y.a.Point(0,0),to:new y.a.Point(o,i),fillColor:sd,strokeColor:t,strokeWidth:r}),l=new y.a.Group([n,a]);return l}}]),e}();function Lm(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Fm(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function km(e,t,n){return t&&Fm(e.prototype,t),n&&Fm(e,n),e}var Em=function(){function e(t){Lm(this,e),this.view=t}return km(e,[{key:"stableZoom",value:function(e,t){var n=e,r=t,o=this.view.getCenter(),i=this.view.getZoom()/n,a=r.subtract(o),l=r.subtract(a.multiply(i)).subtract(o);this.view.setCenter(this.view.getCenter().add(l)),this.view.setZoom(n)}}
1,{key:"adjustZoom",value:function(e,t){this.stableZoom(this.calcZoom(e),t)}},{key:"calcZoom",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1.177827941003;return e<0?this.view.getZoom()*t:e>0?this.view.getZoom()/t:this.view.getZoom()}},{key:"moveCenter",value:function(e){this.view.setCenter(this.calcCenter(e))}},{key:"calcCenter",value:function(e){return this.view.getCenter().subtract(e)}}]),e}();function Nm(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function xm(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function Mm(e,t,n){return t&&xm(e.prototype,t),n&&xm(e,n),e}var Im=function(){function e(t){var n=arguments.length>1&&void 0!==arguments[1]&&arguments[1];Nm(this,e),this.__features=[],this.__name=t,this.__paperGroup=new y.a.Group,this.__flip=n}return Mm(e,[{key:"name",get:function(){return this.__name}},{key:"flip",get:function(){return this.__flip}},{key:"addFeature",value:function(e){if(null===e||void 0===e)return!1;var t=e.clone();return console.log("Copied feature",t),this.__features.push(t),this.__paperGroup.addChild(t),!0}},{key:"generateFeatureRender",value:function(e,t){console.log("Generating Render for invisible feature",e);var n=pp(e,t,{neutralValveOpacity:!0});return this.__features.push(n),this.__paperGroup.addChild(n),!0}},{key:"flipX",value:function(){var e=Pd.currentDevice;if(null!==e){var t=e.getYSpan(),n=e.getXSpan();console.log("Flipping stuff:",n,t);var r=new y.a.Point(n/2,t/2);this.__paperGroup.scale(-1,1,r)}}},{key:"exportToSVG",value:function(){var t=Pd.currentDevice;if(null!==t){var n=t.getYSpan(),r=t.getXSpan(),o=this.__paperGroup.exportSVG({asString:!0});return o=e.generateSVGTextPrepend(r,n)+o+e.generateSVGTextAppend(),o}throw new Error("Registry.currentDevice is null")}},{key:"flushData",value:function(){this.__paperGroup.removeChildren()}}],[{key:"generateSVGTextPrepend",value:function(e,t){var n='<svg width="'.concat(e/1e3,'mm" height="').concat(t/1e3,'mm" viewBox="0 0 ').concat(e," ").concat(t,'">');return n}},{key:"generateSVGTextAppend",value:function(){return"</svg>"}}]),e}();function Wm(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Am(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function jm(e,t,n){return t&&Am(e.prototype,t),n&&Am(e,n),e}var Bm=function(){function e(){Wm(this,e)}return jm(e,null,[{key:"renderRatsNest",value:function(t,n){var r,o,i,a,l=new y.a.Group;for(var s in t){var c=t[s],u=c.source;if(null!==u){var h=c.sinks;for(var f in h){i=h[f];var d=u.component,p=i.component;r=d.getCenterPosition(),o=p.getCenterPosition(),a=e.renderRatsNestConnection(r,o),l.addChild(a)}}else console.error("source ".concat(c.id," is null, cannot render rats nest"))}return l}},{key:"renderRatsNestConnection",value:function(e,t){var n=new y.a.Point(e[0],e[1]),r=new y.a.Point(t[0],t[1]),o=new y.a.Path([n,r]);return o.strokeColor=new y.a.Color("#696965"),o.strokeWidth=500,o.strokeCap="round",o.dashArray=[1e3,1300],o}}]),e}();function Vm(e,t){var n="undefined"!==typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=Xm(e))||t&&e&&"number"===typeof e.length){n&&(e=n);var r=0,o=function(){};return{s:o,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,l=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return a=e.done,e},e:function(e){l=!0,i=e},f:function(){try{a||null==n.return||n.return()}finally{if(l)throw i}}}}function Xm(e,t){if(e){if("string"===typeof e)return Ym(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Ym(e,t):void 0}}function Ym(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function Gm(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Um(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function zm(e,t,n){return t&&Um(e.prototype,t),n&&Um(e,n),e}var Hm=function(){function e(){Gm(this,e)}return zm(e,null,[{key:"renderComponentPort",value:function(e,t,n,r,o,i){var a=arguments.length>6&&void 0!==arguments[6]?arguments[6]:500,l=t[0],s=t[1],c=new y.a.Point(l+e.x,s+e.y),u=new y.a.Path.Circle(c,a);return u.rotate(r,new y.a.Point(n[0],n[1])),c=u.bounds.center,console.log(c),o&&(c.x=2*n[0]-u.position.x),i&&(c.y=2*n[1]-u.position.y),u.bounds.center=c,u.fillColor=new y.a.Color(ld),u}},{key:"getSizeforZoomLevel",value:function(){var e=y.a.view.zoom,t=5/e;return t>500&&(t=500),t}},{key:"renderComponentPorts",value:function(t){if("VALVE"===t.mint||"VALVE3D"===t.mint||"NODE"===t.mint)return[];var n=e.getSizeforZoomLevel(),r=t.ports,o=[],i=t.getRotation(),a=t.getMirrorByX(),l=t.getMirrorByY(),s=t.getCenterPosition(),c=t.getDrawOrigin();t.updateComponentPorts();var u,h=Vm(r.keys());try{for(h.s();!(u=h.n()).done;){var f=u.value,d=r.get(f);if(void 0!==d){var p=e.renderComponentPort(d,c,s,i,a,l,n);t.attachComponentPortRender(f,p),o.push(p)}else console.error("component ".concat(t.id," has no port ").concat(f))}}catch(y){h.e(y)}finally{h.f()}return o}}]),e}();function Km(e,t){var n="undefined"!==typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];
1if(!n){if(Array.isArray(e)||(n=qm(e))||t&&e&&"number"===typeof e.length){n&&(e=n);var r=0,o=function(){};return{s:o,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,l=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return a=e.done,e},e:function(e){l=!0,i=e},f:function(){try{a||null==n.return||n.return()}finally{if(l)throw i}}}}function qm(e,t){if(e){if("string"===typeof e)return Jm(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Jm(e,t):void 0}}function Jm(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function Zm(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function $m(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function Qm(e,t,n){return t&&$m(e.prototype,t),n&&$m(e,n),e}var ev=function(){function e(t,n){Zm(this,e),this._paperlayer=t,this._componentAndRenderMap=new Map,this._activeRenders=[],this._viewManagerDelegate=n,this._enabled=!0}return Qm(e,[{key:"addComponentPortElements",value:function(e){this._componentAndRenderMap.has(e.id)||this._componentAndRenderMap.set(e.id,[]);var t=this._componentAndRenderMap.get(e.id);if(void 0!==t){var n,r=Km(e.ports.keys());try{for(r.s();!(n=r.n()).done;){var o=n.value,i=e.ports.get(o);void 0!==i||console.error("component ".concat(e.id," has no port ").concat(o))}}catch(a){r.e(a)}finally{r.f()}}else console.error("component ".concat(e.id," has no port renders"))}},{key:"updateRenders",value:function(){if(null!==this._viewManagerDelegate.currentDevice)if(this._enabled){this.clearActiveRenders();var e=this._viewManagerDelegate.currentDevice.components;for(var t in e){var n=e[t],r=Hm.renderComponentPorts(n);for(var o in r)this._activeRenders.push(r[o]),this._paperlayer.addChild(r[o])}}else this.clearActiveRenders();else console.error("No device selected, not rendering component ports")}},{key:"clearActiveRenders",value:function(){if(this._enabled){if(this._activeRenders)for(var e in this._activeRenders)this._activeRenders[e].remove();this._activeRenders=[]}}},{key:"enable",value:function(){this._enabled=!0}},{key:"disable",value:function(){this.clearActiveRenders(),this._enabled=!1}}]),e}();function tv(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function nv(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function rv(e,t,n){return t&&nv(e.prototype,t),n&&nv(e,n),e}var ov=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:rf.generateID();tv(this,e),this.__position=[0,0],this.__height=0,this.__type="BlankUIElement",this.__featureIDs=[],this.__id=t}return rv(e,[{key:"type",get:function(){return this.__type}},{key:"featureIDs",get:function(){return this.__featureIDs}},{key:"position",get:function(){return this.__position}},{key:"id",get:function(){return this.__id}},{key:"hasFeatureID",value:function(e){return!!this.__featureIDs.includes(e)}},{key:"draw",value:function(){console.log("Drawing at ".concat(this.__position[0],", ").concat(this.__position[1]))}}]),e}();function iv(e){return iv="function"===typeof Symbol&&"symbol"===typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"===typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},iv(e)}function av(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function lv(e,t){if("function"!==typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&sv(e,t)}function sv(e,t){return sv=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},sv(e,t)}function cv(e){var t=fv();return function(){var n,r=dv(e);if(t){var o=dv(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return uv(this,n)}}function uv(e,t){if(t&&("object"===iv(t)||"function"===typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return hv(e)}function hv(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function fv(){if("undefined"===typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"===typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}function dv(e){return dv=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},dv(e)}var pv=function(e){lv(n,e);var t=cv(n);function n(e,r,o){var i,a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:rf.generateID();return av(this,n),i=t.call(this,a),i.__position=r.position.value,i.__height=r.height.value,i.__type=e,i.__featureIDs=o,i}return n}(ov);function yv(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function mv(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};
1t%2?yv(Object(n),!0).forEach((function(t){vv(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):yv(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function vv(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function gv(e,t){var n="undefined"!==typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=wv(e))||t&&e&&"number"===typeof e.length){n&&(e=n);var r=0,o=function(){};return{s:o,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,l=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return a=e.done,e},e:function(e){l=!0,i=e},f:function(){try{a||null==n.return||n.return()}finally{if(l)throw i}}}}function wv(e,t){if(e){if("string"===typeof e)return bv(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?bv(e,t):void 0}}function bv(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function _v(e){return _v="function"===typeof Symbol&&"symbol"===typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"===typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},_v(e)}function Pv(e){return"PORT"===String(e||"").trim().toUpperCase()}function Cv(e){var t=String(e||"").trim().toUpperCase();return"FLOW"===t||"CONTROL"===t}function Ov(e){if(!e)return!1;if(!Pv(e.getType()))return!1;var t=e.layer?e.layer.type:null;return!t||(t===o.FLOW||t===o.CONTROL)}function Sv(e){return!(!e||"object"!==_v(e))&&(Pv(e.macro)||Pv(e.type))}function Dv(e){if(Array.isArray(e))return e.filter(Sv);if(e&&"object"===_v(e)){for(var t={},n=0,r=Object.keys(e);n<r.length;n++){var o=r[n];Sv(e[o])&&(t[o]=e[o])}return t}return e}function Rv(e){return null==e?"":"string"===typeof e||"number"===typeof e?String(e):"object"===_v(e)&&null!=e.id?String(e.id):""}function Tv(e){var t,n=JSON.parse(JSON.stringify(e)),r=Array.isArray(n.layers)?n.layers:[],o=r.filter((function(e){return Cv(e.type)})),i=new Set(o.map((function(e){return String(e.id)}))),a=gv(o);try{for(a.s();!(t=a.n()).done;){var l=t.value;l.features=Dv(l.features)}}catch(s){a.e(s)}finally{a.f()}return n.layers=o,n.components=(n.components||[]).filter((function(e){if(!Pv(e.entity))return!1;var t=e.layers;return!Array.isArray(t)||0===t.length||t.some((function(e){return i.has(Rv(e))}))})),n.connections=[],n.valves=[],Array.isArray(n.renderLayers)&&(n.renderLayers=n.renderLayers.filter((function(e){return Cv(e.type)||i.has(String(e.modellayer))})).map((function(e){return mv(mv({},e),{},{features:Dv(e.features)})}))),Array.isArray(n.features)&&(n.features=[]),n}function Lv(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Fv(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function kv(e,t,n){return t&&Fv(e.prototype,t),n&&Fv(e,n),e}var Ev=function(){function e(t,n){Lv(this,e),this.lastTargetSet=null,this.__ratsNestRender=null,this.alignmentMarks=null,y.a.setup(t);var r=document.getElementById(t);this.panAndZoom=new Em(this),this.center=y.a.view.center,this.zoom=y.a.view.zoom,this.canvas=r,this.paperFeatures={},this.paperLayers=[],this.paperGrid=null,this.paperDevice=null,this.activeLayer=null,this.gridLayer=new y.a.Group,this.deviceLayer=new y.a.Group,this.gridLayer.insertAbove(this.deviceLayer),this.featureLayer=new y.a.Group,this.featureLayer.insertAbove(this.gridLayer),this.textFeatureLayer=new y.a.Group,this.textFeatureLayer.insertAbove(this.featureLayer),this.alignmentMarksLayer=new y.a.Group,this.alignmentMarksLayer.insertAbove(this.textFeatureLayer),this.uiLayer=new y.a.Group,this.uiLayer.insertAbove(this.featureLayer),this.ratsNestLayer=new y.a.Group,this.ratsNestLayer.insertAbove(this.featureLayer),this.componentPortsLayer=new y.a.Group,this.componentPortsLayer.insertAbove(this.featureLayer),this.currentTarget=null,this.lastTargetType=null,this.lastTargetPosition=null,this.selectedComponents=[],this.selectedConnections=[],this.inactiveAlpha=.5,this.__viewManagerDelegate=n,this.featureRegistry=new Map,this._paperComponentPortView=new ev(this.componentPortsLayer,n),this.disableContextMenu()}return kv(e,[{key:"getSelectedFeatures",value:function(){for(var e=[],t=y.a.project.selectedItems,n=0;n<t.length;n++)e.push(this.__viewManagerDelegate.getFeatureByID(t[n].featureID));return e}},{key:"clearSelectedItems",value:function(){y.a.project.deselectAll(),this.selectedConnections=[],this.selectedComponents=[]}},{key:"deleteSelectedFeatures",value:function(){var e=y.a.project.selectedItems;if(e&&e.length>0){for(var t=0;t<e.length;t++)this.__viewManagerDelegate.removeFeatureByID(e[t].featureID);var n;for(var r in this.selectedComponents)n=this.__viewManagerDelegate.currentDevice.removeComponent(this.selectedComponents[r]),n&&this.__viewManagerDelegate.updatesConnectionRender(n);for(var o in this.selectedConnections)this.__viewManagerDelegate.currentDevice.removeConnection(this.selectedConnections[o])}}},{key:"selectAllActive",value:function(){var e=this.paperLayers[this.activeLayer];for(var t in e.children)e.children[t].selected=!0}},{key:"layersToSVGStrings",value:function(){for(var e=[],t=0;t<this.featureLayer.children.length;t++){var n=this.featureLayer.children[t],r=this.postProcessLayerToSVG(n);e.push(r)}return e}},{key:"postProcessLayerToSVG",value:function(e){var t=e.clone();t.bounds.topLeft=new y.a.Point(0,0);var n=this.__viewManagerDelegate.currentDevice.getXSpan(),r=this.__viewManagerDelegate.currentDevice.getYSpan();t.bounds.topLeft=new y.a.Point(0,0),t.bounds.bottomRight=new y.a.Point(n,r);var o=e.exportSVG({asString:!0}),i=n,a=r,l=i/1e3,s=a/1e3,c=Im.generateSVGTextPrepend(l,s),u=Im.generateSVGTextAppend(),h=c+o+u;return t.remove(),h}},{key:"getCanvasWidth",value:function(){if(null===this.canvas)throw new Error("Canvas is null");return this.canvas.clientWidth}},{key:"getCanvasHeight",value:function(){if(null===this.canvas)throw new Error("Canvas is null");return this.canvas.clientHeight}},{key:"getViewCenterInMillimeters",value:function(){return[y.a.view.center.x/1e3,y.a.view.center.y/1e3]}},{key:"getDeviceHeightInPixels",value:function(){return this.__viewManagerDelegate.currentDevice.getYSpan()*y.a.view.zoom}},{key:"clear",value:function(){this.activeLayer=null,this.featureLayer.removeChildren(),this.deviceLayer.removeChildren(),this.gridLayer.removeChildren(),this.alignmentMarksLayer.removeChildren(),this.textFeatureLayer&&this.textFeatureLayer.removeChildren(),this.uiLayer&&this.uiLayer.removeChildren(),this.ratsNestLayer&&this.ratsNestLayer.removeChildren(),this.componentPortsLayer&&this.componentPortsLayer.removeChildren(),this.paperLayers=[],this.paperFeatures={},this.featureRegistry=new Map,this.paperDevice=null,this.paperGrid=null,this.currentTarget=null,this.selectedComponents=[],this.selectedConnections=[],this.__ratsNestRender=null,this.layerMask=null,this.alignmentMarks=null}},{key:"getCenter",value:function(){return this.center}},{key:"setCenter",value:function(e){this.center=e,this.updateCenter()}},{key:"updateCenter",value:function(){y.a.view.center=this.center}},{key:"getZoom",value:function(){return this.zoom}},{key:"setZoom",value:function(e){this.zoom=e,this.updateZoom(),$y.get().emit($y.UPDATE_ZOOM)}},{key:"updateZoom",value:function(){y.a.view.zoom=this.zoom}},{key:"canvasToProject",value:function(e,t){if(null===this.canvas)throw new Error("Canvas is null");var n=this.canvas.getBoundingClientRect(),r=e-n.left,o=t-n.top;return y.a.view.viewToProject(new y.a.Point(r,o))}},{key:"getProjectPosition",value:function(e,t){return this.canvasToProject(e,t)}},{key:"setMouseWheelFunction",value:function(e){if(null===this.canvas)throw new Error("Canvas is null");this.canvas.addEventListener("wheel",e)}},{key:"setMouseDownFunction",value:function(e){if(null===this.canvas)throw new Error("Canvas is null");this.canvas.onmousedown=e}},{key:"setMouseUpFunction",value:function(e){if(null===this.canvas)throw new Error("Canvas is null");this.canvas.onmouseup=e}},{key:"setMouseMoveFunction",value:function(e){if(null===this.canvas)throw new Error("Canvas is null");this.canvas.onmousemove=e}},{key:"setKeyPressFunction",value:function(e){if(null===this.canvas)throw new Error("Canvas is null");this.canvas.onkeypress=e}},{key:"setKeyDownFunction",value:function(e){if(null===this.canvas)throw new Error("Canvas is null");this.canvas.onkeydown=e}},{key:"setResizeFunction",value:function(e){if(null===this.canvas)throw new Error("Canvas is null");y.a.view.onResize=e}},{key:"disableContextMenu",value:function(){if(null===this.canvas)throw new Error("Canvas is null");this.canvas.oncontextmenu=function(e){e.preventDefault()}}},{key:"refresh",value:function(){y.a.view.update()}},{key:"addDevice",value:function(e){this.updateDevice(e)}},{key:"updateDevice",value:function(e){this.removeDevice();var t=Tm.renderDevice(e);this.paperDevice=t,this.deviceLayer.addChild(t)}},{key:"removeDevice",value:function(){this.paperDevice&&this.paperDevice.remove(),this.paperDevice=null}},{key:"addLayer",value:function(e,t){this.paperLayers[t]=new y.a.Group,this.featureLayer.addChild(this.paperLayers[t])}},{key:"removeLayer",value:function(e){if(-1!==e){for(var t=0;t<this.paperLayers[e].children.length;t++)this.featureRegistry.delete(this.paperLayers[e].children[t].featureID);this.paperLayers.splice(e,1)}}}
1,{key:"addFeature",value:function(e){this.updateFeature(e)}},{key:"setActiveLayer",value:function(e){this.activeLayer=e,null!==this.activeLayer&&this.activeLayer>=0&&this.showActiveLayer()}},{key:"showActiveLayer",value:function(){this.featureLayer.remove(),this.featureLayer=new y.a.Group;for(var e=0;e<this.paperLayers.length;e++)this.featureLayer.addChild(this.paperLayers[e]);this.layerMask&&this.layerMask.remove(),this.layerMask=Tm.renderLayerMask(this.__viewManagerDelegate.currentDevice),this.featureLayer.addChild(this.layerMask);var t=this.paperLayers[this.activeLayer];t.bringToFront(),this.__viewManagerDelegate&&this.__viewManagerDelegate.portsOnlyView&&this.applyPortsOnlyVisibility(!0)}},{key:"applyPortsOnlyVisibility",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};for(var n in this.paperFeatures){var r=this.paperFeatures[n];if(r){var o=null;try{o=this.__viewManagerDelegate.getFeatureByID(n)}catch(i){o=null}r.visible=!e||Ov(o),e&&r.visible&&r.bringToFront()}}this.componentPortsLayer.visible=!e,this.ratsNestLayer.visible=!e,this.alignmentMarksLayer.visible=!e,this.textFeatureLayer.visible=!e,this.uiLayer.visible=!e,this.layerMask&&(this.layerMask.visible=!e),!1!==t.update&&y.a.view&&y.a.view.update()}},{key:"captureSVGString",value:function(e){var t=Boolean(this.__viewManagerDelegate&&this.__viewManagerDelegate.portsOnlyView);if(!e){this.applyPortsOnlyVisibility(!1,{update:!1});try{return this.firstSvgString(this.layersToSVGStrings())}finally{this.applyPortsOnlyVisibility(t,{update:!1})}}var n=new y.a.Group;for(var r in this.paperDevice&&n.addChild(this.paperDevice.clone()),this.paperFeatures){var o=this.paperFeatures[r];if(o){var i=null;try{i=this.__viewManagerDelegate.getFeatureByID(r)}catch(p){i=null}if(Ov(i)){var a=o.clone();a.visible=!0,n.addChild(a)}}}if(!n.children.length)return n.remove(),null;try{if(this.__viewManagerDelegate.currentDevice){var l=this.__viewManagerDelegate.currentDevice.getXSpan(),s=this.__viewManagerDelegate.currentDevice.getYSpan();n.bounds.topLeft=new y.a.Point(0,0),n.bounds.bottomRight=new y.a.Point(l,s);var c=n.exportSVG({asString:!0}),u=l/1e3,h=s/1e3,f=Im.generateSVGTextPrepend(u,h),d=Im.generateSVGTextAppend();return f+c+d}return n.exportSVG({asString:!0})}finally{n.remove()}}},{key:"firstSvgString",value:function(e){for(var t=0;t<e.length;t++)if(e[t]&&"string"===typeof e[t]&&-1!==e[t].indexOf("<svg"))return e[t];return null}},{key:"showChosenFeatures",value:function(e){this.resetFeatureLayers(),this.featureLayer.remove(),this.featureLayer=new y.a.Group;for(var t=0;t<this.paperLayers.length;t++)this.featureLayer.addChild(this.paperLayers[t]);this.layerMask&&this.layerMask.remove(),this.layerMask=Tm.renderLayerMask(this.__viewManagerDelegate.currentDevice),this.featureLayer.addChild(this.layerMask);for(var n=new y.a.Group,r=0;r<e.length;r++)n.addChild(e[r]);n.bringToFront();var o=this.getNonphysText();o.bringToFront()}},{key:"hideChosenFeatures",value:function(e){this.resetFeatureLayers(),this.featureLayer.remove(),this.featureLayer=new y.a.Group,this.layerMask&&this.layerMask.remove(),this.layerMask=Tm.renderLayerMask(this.__viewManagerDelegate.currentDevice),this.featureLayer.addChild(this.layerMask);for(var t=0;t<this.paperLayers.length;t++)this.featureLayer.addChild(this.paperLayers[t]);for(var n=new y.a.Group,r=0;r<e.length;r++)n.addChild(e[r]);n.insertAbove(this.gridLayer);var o=this.getNonphysText();o.bringToFront()}},{key:"showAllFeatures",value:function(){this.resetFeatureLayers(),this.featureLayer.remove(),this.featureLayer=new y.a.Group,this.layerMask&&this.layerMask.remove(),this.layerMask=Tm.renderLayerMask(this.__viewManagerDelegate.currentDevice),this.featureLayer.addChild(this.layerMask);for(var e=0;e<this.paperLayers.length;e++)this.featureLayer.addChild(this.paperLayers[e]);var t=this.getNonphysText();t.bringToFront()}},{key:"resetFeatureLayers",value:function(){for(var e=this,t=function(t){e.featureRegistry.forEach((function(n,r){e.paperLayers[t].id==n&&e.paperLayers[t].addChild(e.paperFeatures[r])}))},n=0;n<this.paperLayers.length;n++)t(n)}},{key:"getNonphysText",value:function(){if(void 0===Pd.viewManager||null===Pd.viewManager)throw new Error("Registry.viewManager is undefined");for(var e=new y.a.Group,t=Pd.viewManager.nonphysElements,n=0;n<t.length;n++)for(var r in this.paperFeatures)"Text"==t[n].type&&t[n].featureIDs.includes(this.paperFeatures[r].featureID)&&e.addChild(this.paperFeatures[r]);return e}},{key:"generateNonphysText",value:function(e,t,n,r){var o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:this.activeLayer,i=Oy.makeFeature("Text",{position:t,height:20,text:e,fontSize:n,color:r},"TEXT_"+e,d.a.v1(),"XY",null);this.__viewManagerDelegate.addFeature(i,o,!1);var a=this.addUIElement("Text",i.getParams(),[i.ID]);i.referenceID=a.id,this.__viewManagerDelegate.saveDeviceState()}},{key:"addUIElement",value:function(e,t,n){if(void 0===Pd.viewManager||null===Pd.viewManager)throw console.log("ViewManager is not defined"),new Error("ViewManager is not defined");var r;return r="Text"==e?new pv(e,t,n):new ov,Pd.viewManager.nonphysElements.push(r),r}},{key:"insertUIFeature",value:function(e){this.uiLayer.insertChild(0,e)}},{key:"addComponent",value:function(e,t,n,r){if(void 0===Pd.viewManager||null===Pd.viewManager)throw console.error("ViewManager is not defined"),new Error("ViewManager is not defined");if(void 0===Pd.currentDevice||null===Pd.currentDevice)throw console.error("Current Device is not defined"),new Error("Current Device is not defined");var o=rf.getDefinition(e);if(void 0===o||null===o)throw new Error("Component definition not found");var i={};for(var a in t)i[a]=t[a].value;var l,s=new _f(i,Pp.toMap(o.unique),Pp.toMap(o.heritable)),c=rf.generateID(),u=Pd.currentDevice.generateNewName(e),h=new Ep(s,u,o.mint,c);for(var f in n)h.addFeatureID(n[f]),l=this.__viewManagerDelegate.getFeatureByID(n[f]),l.referenceID=c;return Pd.currentDevice.addComponent(h),h}},{key:"comparePaperFeatureHeights",value:function(e,t){var n,r,o=this.__viewManagerDelegate.getFeatureByID(e.featureID),i=this.__viewManagerDelegate.getFeatureByID(t.featureID);try{r=o.getValue("height")}catch(a){r=9999}try{n=i.getValue("height")}catch(a){n=9999}return r-n}},{key:"insertChildByHeight",value:function(e,t){var n;e&&t&&(n=e.children&&e.children.length>0?this.getIndexByHeight(e.children,t):0,e.insertChild(n,t))}},{key:"getIndexByHeight",value:function(e,t){for(var n=0;n<e.length;n++){var r=this.comparePaperFeatureHeights(e[n],t);
1if(r>=0)return n}return e.length}},{key:"updateFeature",value:function(e){var t,n,r=this.paperFeatures[e.ID];if(t=!!r&&r.selected,this.removeFeature(e),e instanceof gm)return n=Cd(e),n.selected=t,this.paperFeatures[n.featureID]=n,console.log(n),this.insertEdgeFeatures(n),void(this.__viewManagerDelegate&&this.__viewManagerDelegate.portsOnlyView&&(n.visible=!1));n=pp(e,null),n.selected=t,console.log(n),this.paperFeatures[n.featureID]=n;var o=this.__viewManagerDelegate.renderLayers.indexOf(this.__viewManagerDelegate.getRenderLayerByID(e.ID)),i=this.paperLayers[o];this.insertChildByHeight(i,n),this.featureRegistry.set(n.featureID,i.id),this.__viewManagerDelegate&&this.__viewManagerDelegate.portsOnlyView&&(n.visible=Ov(e))}},{key:"removeTarget",value:function(){this.currentTarget&&this.currentTarget.remove(),this.currentTarget=null}},{key:"clearTargetState",value:function(){this.removeTarget(),this.lastTargetType=null,this.lastTargetPosition=null,this.lastTargetParameters=null,this.lastTargetSet=null}},{key:"addTarget",value:function(e,t,n,r){this.removeTarget(),this.lastTargetParameters=r,this.lastTargetType=e,this.lastTargetPosition=n,this.lastTargetSet=t,this.updateTarget()}},{key:"updateTarget",value:function(){if(null===this.__viewManagerDelegate.currentLayer)throw console.error("No layer selected"),new Error("No layer selected");if(this.removeTarget(),this.lastTargetType&&this.lastTargetPosition)if("TEXT"===this.lastTargetType)this.currentTarget=hp(this.lastTargetType,this.lastTargetPosition),this.uiLayer.addChild(this.currentTarget);else if("Custom"===this.lastTargetSet){var e=this.__viewManagerDelegate.customComponentManager.getCustomComponent(this.lastTargetType),t=Pd.featureDefaults[this.lastTargetSet][this.lastTargetType];t.position=this.lastTargetPosition,t.color=gd(this.lastTargetType,this.__viewManagerDelegate.currentLayer),this.currentTarget=Uf(e,t),this.uiLayer.addChild(this.currentTarget)}else this.currentTarget=up(this.lastTargetType,this.lastTargetPosition,this.lastTargetParameters),this.uiLayer.addChild(this.currentTarget)}},{key:"removeFeature",value:function(e){var t=this.paperFeatures[e.ID];t&&t.remove(),this.paperFeatures[e.ID]=null,this.featureRegistry.delete(e.ID)}},{key:"removeGrid",value:function(){this.paperGrid&&this.paperGrid.remove(),this.paperGrid=null}},{key:"updateGrid",value:function(e){this.removeGrid();var t=Pm.renderGrid(e);this.paperGrid=t,this.gridLayer.addChild(t)}},{key:"updateAlignmentMarks",value:function(){}},{key:"removeAlignmentMarks",value:function(){this.alignmentMarks&&this.alignmentMarks.removeChildren(),this.alignmentMarks=null}},{key:"updateRatsNest",value:function(){this.removeRatsNest();var e=this.__viewManagerDelegate.currentDevice.getUnroutedConnections(),t=Bm.renderRatsNest(e,this.__viewManagerDelegate.currentDevice);this.__ratsNestRender=t,this.ratsNestLayer.addChild(this.__ratsNestRender)}},{key:"removeRatsNest",value:function(){this.__ratsNestRender&&this.__ratsNestRender.remove(),this.__ratsNestRender=null}},{key:"moveCenter",value:function(e){this.panAndZoom.moveCenter(e)}},{key:"adjustZoom",value:function(e,t){this.panAndZoom.adjustZoom(e,t)}},{key:"getFeaturesByViewElements",value:function(e){for(var t=[],n=0;n<e.length;n++)t.push(this.__viewManagerDelegate.getFeatureByID(e[n].featureID));return t}},{key:"initializeView",value:function(){var e=this.getDeviceCenter(),t=this.computeOptimalZoom();this.setCenter(e),this.setZoom(t)}},{key:"getDeviceCenter",value:function(){var e=this.__viewManagerDelegate.currentDevice.getXSpan(),t=this.__viewManagerDelegate.currentDevice.getYSpan();return new y.a.Point(e/2,t/2)}},{key:"computeOptimalZoom",value:function(){var e,t,n=200,r=this.__viewManagerDelegate.currentDevice.getXSpan(),o=this.__viewManagerDelegate.currentDevice.getYSpan(),i=this.getCanvasWidth(),a=this.getCanvasHeight();e=i-n<=0?i:i-n,t=a-n<=0?a:a-n;var l=r/e,s=o/t;return l>s?1/l:1/s}},{key:"hitFeature",value:function(e){var t,n=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],r=arguments.length>2&&void 0!==arguments[2]&&arguments[2],o={fill:!0,tolerance:5,guides:!1};if(n&&null!==this.activeLayer&&!r){t=this.paperLayers[this.activeLayer];var i=t.hitTest(e,o);if(i)return i.item}else if(n&&r){t=this.getNonphysText();var a=t.hitTest(e,o);if(a)return a.item}else for(var l=this.paperLayers.length-1;l>=0;l--){t=this.paperLayers[l];var s=t.hitTest(e,o);if(s)return s.item}return null}},{key:"hitFeaturesWithViewElement",value:function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],n=[];if(t&&null!==this.activeLayer)for(var r=this.paperLayers[this.activeLayer],o=0;o<r.children.length;o++){var i=r.children[o];(e.intersects(i)||i.isInside(e.bounds))&&n.push(i)}else for(var a=0;a<this.paperLayers.length;a++)for(var l=this.paperLayers[a],s=0;s<l.children.length;s++){var c=l.children[s];(e.intersects(c)||c.isInside(e.bounds))&&n.push(c)}return n}},{key:"insertEdgeFeatures",value:function(e){var t=this.paperLayers[0];t.insertChild(0,e)}},{key:"getRenderedFeature",value:function(e){return console.log("getRenderedFeature"),console.log(this.paperFeatures[e]),this.paperFeatures[e]}},{key:"updateComponentPortsRender",value:function(){this._paperComponentPortView.updateRenders()}},{key:"enableSnapRender",value:function(){this._paperComponentPortView.enable()}},{key:"disableSnapRender",value:function(){this._paperComponentPortView.disable()}},{key:"getRender",value:function(e){return this.paperFeatures[e]}}]),e}();function Nv(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function xv(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function Mv(e,t,n){return t&&xv(e.prototype,t),n&&xv(e,n),e}var Iv=function(){function e(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:5,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:100,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:10,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:[0,0],a=arguments.length>5&&void 0!==arguments[5]?arguments[5]:1,l=arguments.length>6&&void 0!==arguments[6]?arguments[6]:3,s=arguments.length>7&&void 0!==arguments[7]?arguments[7]:od;Nv(this,e),this.__viewManagerDelegate=t,this.origin=new y.a.Point(i[0],i[1]),this.thinWidth=a,this.thickWidth=l,this.minSpacing=n,this.maxSpacing=r,this.thickCount=o,this.__spacing=500,this.__isAutomaticEnabled=!0,this.color=new y.a.Color(s)}return Mv(e,[{key:"spacing",get:function(){return this.__spacing},set:function(t){console.log(e.isValidZoom(t)),this.__spacing=t}},{key:"enableAdaptiveGrid",value:function(){this.__isAutomaticEnabled=!0}},{key:"disableAdaptiveGrid",value:function(){this.__isAutomaticEnabled=!1}},{key:"getClosestGridPoint",value:function(e){var t=Math.round((e.x-this.origin.x)/this.__spacing)*this.__spacing+this.origin.x,n=Math.round((e.y-this.origin.y)/this.__spacing)*this.__spacing+this.origin.y;return new y.a.Point(t,n)}},{key:"setOrigin",value:function(e){this.origin=new y.a.Point(e[0],e[1]),this.notifyViewManagerToUpdateView()}},{key:"setThinWidth",value:function(e){this.thinWidth=e,this.notifyViewManagerToUpdateView()}},{key:"setThickWidth",value:function(e){this.thickWidth=e,this.notifyViewManagerToUpdateView()}},{key:"setMinSpacing",value:function(e){this.__spacing=e,this.notifyViewManagerToUpdateView()}},{key:"setMaxSpacing",value:function(e){this.maxSpacing=e,this.notifyViewManagerToUpdateView()}},{key:"setColor",value:function(e){this.color=new y.a.Color(e),this.notifyViewManagerToUpdateView()}},{key:"getSpacing",value:function(){if(this.__isAutomaticEnabled){var e=y.a.view.zoom;
1return this.__spacing=e<=.02?1e3:e<=.05?500:e<=.1?100:e<=.6?50:5,this.__spacing}return this.__spacing}},{key:"updateGridSpacing",value:function(t){return e.isValidZoom(t)?(console.log("New spacing value:",t),this.__spacing=t,!0):(console.error("Inavlid Grid Spacing"),!1)}},{key:"getThinWidth",value:function(){return this.thinWidth/y.a.view.zoom}},{key:"getThickWidth",value:function(){return this.thickWidth/y.a.view.zoom}},{key:"notifyViewManagerToUpdateView",value:function(){this.__viewManagerDelegate?this.__viewManagerDelegate.updateGrid():console.error("Could not find view manager to send update grid signal")}}],[{key:"isValidZoom",value:function(e){return!0}}]),e}(),Wv=n("21a6");function Av(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function jv(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function Bv(e,t,n){return t&&jv(e.prototype,t),n&&jv(e,n),e}var Vv=function(){function e(t){Av(this,e),this.viewManagerDelegate=t}return Bv(e,[{key:"up",value:function(t){e.defaultFunction("up")}},{key:"down",value:function(t){e.defaultFunction("down")}},{key:"move",value:function(t){e.defaultFunction("move")}},{key:"rightdown",value:function(t){e.defaultFunction("rightdown")}},{key:"deactivate",value:function(){}},{key:"cleanup",value:function(){console.log("Default Message: You have to implement the method cleanup!")}}],[{key:"defaultFunction",value:function(e){return function(){console.log("No "+e+" function set.")}}},{key:"getEventPosition",value:function(e){if(null!==Pd.viewManager)return Pd.viewManager.getEventPosition(e);throw new Error("No view manager set!")}}]),e}();function Xv(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Yv(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function Gv(e,t,n){return t&&Yv(e.prototype,t),n&&Yv(e,n),e}var Uv=function(){function e(t,n){var r=arguments.length>2&&void 0!==arguments[2]&&arguments[2];Xv(this,e),this.timeout=n,this.func=t,this.waiting=!1,this.queued=!0,this.counter=0,this.report=r}return Gv(e,[{key:"run",value:function(){this.waiting?(this.counter++,this.queued||(this.queued=!0)):(this.report&&console.log("Waited "+this.counter+" times."),this.func(),this.startTimer(),this.counter=0)}},{key:"endTimer",value:function(){this.waiting=!1,this.queued&&(this.queued=!1,this.run())}},{key:"startTimer",value:function(){var e=this;this.waiting=!0,window.setTimeout((function(){e.endTimer()}),this.timeout)}}]),e}();function zv(e){return zv="function"===typeof Symbol&&"symbol"===typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"===typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},zv(e)}function Hv(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Kv(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function qv(e,t,n){return t&&Kv(e.prototype,t),n&&Kv(e,n),e}function Jv(e,t){if("function"!==typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&Zv(e,t)}function Zv(e,t){return Zv=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},Zv(e,t)}function $v(e){var t=tg();return function(){var n,r=ng(e);if(t){var o=ng(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return Qv(this,n)}}function Qv(e,t){if(t&&("object"===zv(t)||"function"===typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return eg(e)}function eg(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function tg(){if("undefined"===typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"===typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}function ng(e){return ng=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},ng(e)}var rg=function(e){Jv(n,e);var t=$v(n);function n(e){var r;Hv(this,n),r=t.call(this,e),r.dragging=!1,r.dragStart=null,r.lastPoint=null,r.currentSelectBox=null,r.currentSelection=[];var o=eg(r);return r.updateQueue=new Uv((function(){o.dragHandler()}),20),r.down=function(e){var t;
1null===(t=Pd.viewManager)||void 0===t||t.killParamsWindow(),o.mouseDownHandler(e),o.dragging=!0,o.showTarget()},r.move=function(e){o.dragging&&(o.lastPoint=Vv.getEventPosition(e),o.updateQueue.run()),o.showTarget()},r.up=function(e){o.dragging=!1,o.mouseUpHandler(Vv.getEventPosition(e)),o.showTarget()},r}return qv(n,[{key:"keyHandler",value:function(e){"delete"!==e.key&&"backspace"!==e.key||(console.log("Removing feature"),this.removeFeatures()),"c"===e.key&&(console.log("Detected a ctrlC"),console.log(this.currentSelection))}},{key:"dragHandler",value:function(){this.dragStart&&(this.currentSelectBox&&this.currentSelectBox.remove(),this.currentSelectBox=this.rectSelect(this.dragStart,this.lastPoint))}},{key:"showTarget",value:function(){var e;null===(e=Pd.viewManager)||void 0===e||e.removeTarget()}},{key:"mouseUpHandler",value:function(e){this.currentSelectBox&&(this.currentSelection=Pd.viewManager.hitFeaturesWithViewElement(this.currentSelectBox),this.selectFeatures()),this.killSelectBox()}},{key:"removeFeatures",value:function(){if(this.currentSelection.length>0){for(var e=0;e<this.currentSelection.length;e++){var t=this.currentSelection[e],n=Pd.currentDevice.getFeatureByID(t.featureID);Pd.currentDevice.removeFeature(n)}this.currentSelection=[]}}},{key:"mouseDownHandler",value:function(e){var t=Vv.getEventPosition(e),n=this.hitFeature(t);if(n)if(n.selected){var r=Pd.currentDevice.getFeatureByID(n.featureID);Pd.viewManager.updateDefaultsFromFeature(r)}else this.deselectFeatures(),this.selectFeature(n);else this.deselectFeatures(),this.dragStart=t}},{key:"killSelectBox",value:function(){this.currentSelectBox&&(this.currentSelectBox.remove(),this.currentSelectBox=null),this.dragStart=null}},{key:"hitFeature",value:function(e){var t=Pd.viewManager.hitFeature(e);return t}},{key:"selectFeature",value:function(e){this.currentSelection.push(e);var t=this.__getComponentWithFeatureID(e.featureID);if(null===t)e.selected=!0;else{var n=t.featureIDs;for(var r in n){var o=n[r],i=Pd.viewManager.view.paperFeatures[o];i.selected=!0}Pd.viewManager.view.selectedComponents.push(t)}}},{key:"__getComponentWithFeatureID",value:function(e){var t=Pd.currentDevice.components;for(var n in t){var r=t[n],o=r.featureIDs,i=o.indexOf(e);if(-1!==i)return console.log("Found Feature: "+e+" in component: "+r.id),r}return null}},{key:"selectFeatures",value:function(){if(this.currentSelection)for(var e=0;e<this.currentSelection.length;e++){var t=this.currentSelection[e],n=this.__getComponentWithFeatureID(t.featureID);if(null===n)t.selected=!0;else{var r=n.featureIDs;for(var o in r){var i=r[o],a=Pd.viewManager.view.paperFeatures[i];a.selected=!0}Pd.viewManager.view.selectedComponents.push(n)}}}},{key:"deselectFeatures",value:function(){y.a.project.deselectAll(),this.currentSelection=[]}},{key:"abort",value:function(){this.deselectFeatures(),this.killSelectBox()}},{key:"rectSelect",value:function(e,t){var n=new y.a.Path.Rectangle(e,t);return n.fillColor=new y.a.Color(0,.3,1,.4),n.strokeColor=new y.a.Color(0,0,0),n.strokeWidth=2,n.selected=!0,n}}]),n}(Vv);function og(e){return og="function"===typeof Symbol&&"symbol"===typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"===typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},og(e)}function ig(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function ag(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function lg(e,t,n){return t&&ag(e.prototype,t),n&&ag(e,n),e}function sg(e,t){if("function"!==typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&cg(e,t)}function cg(e,t){return cg=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},cg(e,t)}function ug(e){var t=dg();return function(){var n,r=pg(e);if(t){var o=pg(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return hg(this,n)}}function hg(e,t){if(t&&("object"===og(t)||"function"===typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return fg(e)}function fg(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function dg(){if("undefined"===typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"===typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}function pg(e){return pg=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},pg(e)}var yg=function(e){sg(n,e);var t=ug(n);function n(e,r){var o,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;ig(this,n),o=t.call(this,e),o.lastPoint=[0,0],o.viewManagerDelegate=e,o.typeString=r,o.setString="Basic",o.currentFeatureID=null,o.currentParameters=i;var a=fg(o);return o.lastPoint=[0,0],o.showQueue=new Uv((function(){a.showTarget()}),20,!1),o.up=function(e){},o.move=function(e){var t=Vv.getEventPosition(e);null!==t&&(a.lastPoint=[t.x,t.y],a.showQueue.run())}
1,o.down=function(e){a.viewManagerDelegate.killParamsWindow(),y.a.project.deselectAll(),a.createNewFeature(Vv.getEventPosition(e))},o}return lg(n,[{key:"createNewFeature",value:function(e){var t,r=null===(t=this.viewManagerDelegate.currentDevice)||void 0===t?void 0:t.generateNewName(this.typeString),o=Oy.makeFeature(this.typeString,{position:n.getTarget([e.x,e.y])},r);this.currentFeatureID=o.ID,this.viewManagerDelegate.addFeature(o)}},{key:"showTarget",value:function(){if(null!==this.lastPoint){var e=n.getTarget(this.lastPoint);this.viewManagerDelegate.updateTarget(this.typeString,this.setString,e,this.currentParameters)}}},{key:"createNewComponent",value:function(e,t,n){var r=rf.getDefinition(e),o={};for(var i in t)o[i]=t[i].value;o["position"]=[0,0];var a,l=new _f(o,Pp.toMap(r.unique),Pp.toMap(r.heritable)),s=rf.generateID(),c=Pd.currentDevice.generateNewName(e),u=new Ep(l,c,r.mint,s);for(var h in n)u.addFeatureID(n[h]),a=Pd.currentDevice.getFeatureByID(n[h]),a.referenceID=s;return u.setInitialOffset(),u.updateComponentPosition(t["position"].value),this.viewManagerDelegate.currentDevice.addComponent(u),u}},{key:"deactivate",value:function(){this.viewManagerDelegate.removeTarget()}},{key:"cleanup",value:function(){this.viewManagerDelegate.removeTarget()}},{key:"getCreationParameters",value:function(e){if(null===this.currentParameters)throw new Error("No parameters to create a new feature");var t={position:n.getTarget([e.x,e.y])};for(var r in this.currentParameters){var o=this.currentParameters[r],i=o.name,a=o.value;t[i]=a}return t}}],[{key:"getTarget",value:function(e){if(null===Pd.viewManager)throw new Error("View Manager is null");var t=Pd.viewManager.snapToGrid(e);return t}},{key:"getMinTarget",value:function(e){var t=[Math.round(e[0]),Math.round(e[1])];return t}}]),n}(Vv);function mg(e){return mg="function"===typeof Symbol&&"symbol"===typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"===typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},mg(e)}function vg(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function gg(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function wg(e,t,n){return t&&gg(e.prototype,t),n&&gg(e,n),e}function bg(e,t){if("function"!==typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&_g(e,t)}function _g(e,t){return _g=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},_g(e,t)}function Pg(e){var t=Sg();return function(){var n,r=Dg(e);if(t){var o=Dg(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return Cg(this,n)}}function Cg(e,t){if(t&&("object"===mg(t)||"function"===typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return Og(e)}function Og(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Sg(){if("undefined"===typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"===typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}function Dg(e){return Dg=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},Dg(e)}var Rg=function(e){bg(n,e);var t=Pg(n);function n(e){var r;vg(this,n),r=t.call(this,e),r.typeString="TEXT",r.setString="Standard",r.currentFeatureID=null;var o=Og(r);return r.lastPoint=null,r._text="TESTING-TEXT",r.fontSize=12,r.viewManagerDelegate=e,r.showQueue=new Uv((function(){o.showTarget()}),20,!1),r.up=function(e){},r.move=function(e){var t=Vv.getEventPosition(e);null!==t&&(o.lastPoint=[t.x,t.y],o.showQueue.run())},r.down=function(e){var t;null===(t=Pd.viewManager)||void 0===t||t.killParamsWindow(),y.a.project.deselectAll(),o.createNewFeature(Vv.getEventPosition(e))},r}return wg(n,[{key:"createNewFeature",value:function(e){var t=yg.getTarget([e.x,e.y]),n=Oy.makeFeature("Text",{position:t,height:200,text:this._text,fontSize:1e4*this.fontSize},"TEXT_"+this._text,rf.generateID(),"XY",null);this.viewManagerDelegate.addFeature(n,this.viewManagerDelegate.activeRenderLayerIndex),this.viewManagerDelegate.view.addComponent("Text",n.getParams(),[n.ID],!0),this.viewManagerDelegate.saveDeviceState()}},{key:"showTarget",value:function(){var e;if(null!==this.lastPoint){var t=yg.getTarget(this.lastPoint);null===(e=Pd.viewManager)||void 0===e||e.updateTarget(this.typeString,this.setString,t,{})}}},{key:"text",get:function(){return this._text},set:function(e){this._text=e}}]),n}(Vv);function Tg(e){return Tg="function"===typeof Symbol&&"symbol"===typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"===typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Tg(e)}function Lg(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Fg(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function kg(e,t,n){return t&&Fg(e.prototype,t),n&&Fg(e,n),e}function Eg(e,t){if("function"!==typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&Ng(e,t)}function Ng(e,t){return Ng=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},Ng(e,t)}function xg(e){var t=Wg();return function(){var n,r=Ag(e);if(t){var o=Ag(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return Mg(this,n)}}function Mg(e,t){if(t&&("object"===Tg(t)||"function"===typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return Ig(e)}function Ig(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Wg(){if("undefined"===typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"===typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}function Ag(e){return Ag=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},Ag(e)}var jg=function(e){Eg(n,e);var t=xg(n);function n(e,r){var o;Lg(this,n),o=t.call(this,e),o.viewManagerDelegate=e,o.paperView=r,o.dragging=!1,o.dragStart=null,o.lastPoint=null,o.currentSelectBox=null,o.currentSelection=[];var i=Ig(o);return o.updateQueue=new Uv((function(){i.dragHandler()}
1),20),o.down=function(e){i.viewManagerDelegate.killParamsWindow(),i.mouseDownHandler(e),i.dragging=!0,i.showTarget()},o.move=function(e){i.dragging&&(i.lastPoint=Vv.getEventPosition(e),i.updateQueue.run()),i.showTarget()},o.up=function(e){i.dragging=!1,i.mouseUpHandler(Vv.getEventPosition(e)),i.showTarget()},o}return kg(n,[{key:"keyHandler",value:function(e){"delete"!==e.key&&"backspace"!==e.key||(console.log("Removing feature"),this.removeFeatures()),"c"===e.key&&(console.log("Detected a ctrlC"),console.log(this.currentSelection))}},{key:"dragHandler",value:function(){this.dragStart&&(this.currentSelectBox&&this.currentSelectBox.remove(),this.currentSelectBox=this.rectSelect(this.dragStart,this.lastPoint))}},{key:"showTarget",value:function(){this.viewManagerDelegate.removeTarget()}},{key:"mouseUpHandler",value:function(e){this.currentSelectBox&&(this.currentSelection=this.viewManagerDelegate.hitFeaturesWithViewElement(this.currentSelectBox),this.selectFeatures()),this.killSelectBox()}},{key:"removeFeatures",value:function(){if(this.currentSelection.length>0){for(var e=0;e<this.currentSelection.length;e++){var t,n,r=this.currentSelection[e],o=null===(t=Pd.currentDevice)||void 0===t?void 0:t.getFeatureByID(r.featureID);null===(n=Pd.currentDevice)||void 0===n||n.removeFeature(o)}this.currentSelection=[]}}},{key:"mouseDownHandler",value:function(e){var t=Vv.getEventPosition(e),n=this.hitFeature(t);if(n)if(n.selected){var r,o,i,a,l,s=this.viewManagerDelegate.getFeatureByID(n.featureID);if(this.viewManagerDelegate.updateDefaultsFromFeature(s),null===s.referenceID)r=null===(i=Pd.currentDevice)||void 0===i?void 0:i.getComponentForFeatureID(s.ID),null!==r&&void 0!==r?$y.get().emit($y.DBL_CLICK_COMPONENT,e,r):$y.get().emit($y.DBL_CLICK_FEATURE,e,s);else r=null===(a=Pd.currentDevice)||void 0===a?void 0:a.getComponentByID(s.referenceID),o=null===(l=Pd.currentDevice)||void 0===l?void 0:l.getConnectionByID(s.referenceID),null!==r?$y.get().emit($y.DBL_CLICK_COMPONENT,e,r):null!==o?$y.get().emit($y.DBL_CLICK_CONNECTION,e,o):$y.get().emit($y.DBL_CLICK_FEATURE,e,s)}else this.deselectFeatures(),this.selectFeature(n);else this.deselectFeatures(),this.dragStart=t}},{key:"killSelectBox",value:function(){this.currentSelectBox&&(this.currentSelectBox.remove(),this.currentSelectBox=null),this.dragStart=null}},{key:"hitFeature",value:function(e){var t=this.viewManagerDelegate.hitFeature(e);return t}},{key:"selectFeature",value:function(e){this.currentSelection.push(e);var t=this.__getComponentWithFeatureID(e.featureID),n=this.__getConnectionWithFeatureID(e.featureID);if(null===t&&null===n)e.selected=!0;else if(null!==t){var r=t.featureIDs;for(var o in r){var i=r[o],a=this.viewManagerDelegate.view.paperFeatures[i];a.selected=!0}this.viewManagerDelegate.view.selectedComponents.push(t)}else{if(null===n)throw new Error("Totally got the selection logic wrong, reimplement this");var l=n.featureIDs;for(var s in l){var c=l[s],u=this.viewManagerDelegate.view.paperFeatures[c];u.selected=!0}this.viewManagerDelegate.view.selectedConnections.push(n)}}},{key:"__getComponentWithFeatureID",value:function(e){var t=Pd.currentDevice.components;for(var n in t){var r=t[n],o=r.featureIDs,i=o.indexOf(e);if(-1!==i)return r}return null}},{key:"__getConnectionWithFeatureID",value:function(e){var t=Pd.currentDevice.connections;for(var n in t){var r=t[n],o=r.featureIDs,i=o.indexOf(e);if(-1!==i)return r}return null}},{key:"selectFeatures",value:function(){if(this.currentSelection)for(var e=0;e<this.currentSelection.length;e++){var t=this.currentSelection[e],n=this.__getComponentWithFeatureID(t.featureID);if(null===n)t.selected=!0;else{var r=n.featureIDs;for(var o in r){var i=r[o],a=this.viewManagerDelegate.view.paperFeatures[i];a.selected=!0}this.viewManagerDelegate.view.selectedComponents.push(n)}}}},{key:"deselectFeatures",value:function(){this.paperView.clearSelectedItems(),this.currentSelection=[]}},{key:"abort",value:function(){this.deselectFeatures(),this.killSelectBox()}},{key:"rectSelect",value:function(e,t){var n=new y.a.Path.Rectangle(e,t);return n.fillColor=new y.a.Color(0,.3,1,.4),n.strokeColor=new y.a.Color(0,0,0),n.strokeWidth=2,n.selected=!0,n}}]),n}(Vv);function Bg(e,t){e.classList?e.classList.remove(t):e.className=e.className.replace(new RegExp("(^|\\b)"+t.split(" ").join("|")+"(\\b|$)","gi")," ")}function Vg(e,t){e.classList?e.classList.add(t):e.className+=" "+t}function Xg(e,t){var n=document.querySelector(e);this.dragenter=function(e){e.stopPropagation(),e.preventDefault(),null===n||void 0===n||n.classList.add("dropping")},this.dragover=function(e){e.stopPropagation(),e.preventDefault()},this.dragleave=function(e){e.stopPropagation(),e.preventDefault()},this.drop=function(e){var r;e.stopPropagation(),e.preventDefault(),null===n||void 0===n||n.classList.remove("dropping"),t(null===(r=e.dataTransfer)||void 0===r?void 0:r.files,e)},null===n||void 0===n||n.addEventListener("dragenter",this.dragenter,!1),null===n||void 0===n||n.addEventListener("dragover",this.dragover,!1),null===n||void 0===n||n.addEventListener("dragleave",this.dragleave,!1),null===n||void 0===n||n.addEventListener("drop",this.drop,!1)}function Yg(e){return Yg="function"===typeof Symbol&&"symbol"===typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"===typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Yg(e)}function Gg(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Ug(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function zg(e,t,n){return t&&Ug(e.prototype,t),n&&Ug(e,n),e}function Hg(e,t){if("function"!==typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&Kg(e,t)}function Kg(e,t){return Kg=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},Kg(e,t)}function qg(e){var t=$g();return function(){var n,r=Qg(e);
1if(t){var o=Qg(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return Jg(this,n)}}function Jg(e,t){if(t&&("object"===Yg(t)||"function"===typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return Zg(e)}function Zg(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function $g(){if("undefined"===typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"===typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}function Qg(e){return Qg=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},Qg(e)}var ew=function(e){Hg(n,e);var t=qg(n);function n(e){var r;Gg(this,n),r=t.call(this,e),r.startPoint=null,r.lastPoint=null,r.startCenter=null;var o=Zg(r);return r.updateQueue=new Uv((function(){o.pan()}),10),r.down=function(e){o.startPan(Vv.getEventPosition(e)),o.showTarget()},r.up=function(e){o.endPan(Vv.getEventPosition(e)),o.showTarget()},r.move=function(e){o.moveHandler(Vv.getEventPosition(e)),o.showTarget()},r}return zg(n,[{key:"startPan",value:function(e){this.dragging=!0,this.startPoint=e}},{key:"moveHandler",value:function(e){this.dragging&&(this.lastPoint=e,this.updateQueue.run())}},{key:"endPan",value:function(e){this.pan(),this.lastPoint=null,this.dragging=!1,this.startPoint=null}},{key:"showTarget",value:function(){var e;null===(e=Pd.viewManager)||void 0===e||e.removeTarget()}},{key:"pan",value:function(){if(this.lastPoint){var e,t=this.lastPoint.subtract(this.startPoint);null===(e=Pd.viewManager)||void 0===e||e.moveCenter([t.x,t.y])}}}]),n}(Vv);function tw(){y.a.project.deselectAll();var e=Pd.viewManager;if(e){try{e.deactivateComponentPlacementTool()}catch(t){e.resetToDefaultTool()}try{e.tools&&e.tools.MoveTool&&e.tools.MoveTool.deactivate()}catch(n){}e.removeTarget(),e.view.clearSelectedItems()}$y.get().emit($y.SIDEBAR_COMPONENT_ACTIVATED,{mint:null}),$y.get().emit($y.SIDEBAR_SETTINGS_OPENED,{mint:null}),$y.get().emit($y.CLOSE_ALL_WINDOWS)}function nw(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function rw(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function ow(e,t,n){return t&&rw(e.prototype,t),n&&rw(e,n),e}var iw=function(){function e(t){nw(this,e),this.viewManagerDelegate=t,this.__leftMouseTool=null,this.__rightMouseTool=null,this.__middleMouseTool=new ew(t),window.onkeydown=function(e){var t=e.keyCode||e.which;46===t&&e.preventDefault()},this.__setupDefaultKeyboardShortcuts()}return ow(e,[{key:"leftMouseTool",get:function(){return this.__leftMouseTool},set:function(e){this.__leftMouseTool=e}},{key:"rightMouseTool",get:function(){return this.__rightMouseTool},set:function(e){this.__rightMouseTool=e}},{key:"__setupDefaultKeyboardShortcuts",value:function(){var e=this.viewManagerDelegate;window.addEventListener("keydown",(function(t){var n=t.keyCode||t.which;(t.ctrlKey||t.metaKey)&&83===n&&(t.preventDefault(),e.downloadJSON()),70===n&&(e.view.initializeView(),e.updateGrid(),e.view.updateAlignmentMarks(),t.preventDefault()),27===n&&tw()})),e.view.setKeyDownFunction((function(t){var n,r=t.keyCode||t.which;if(46!==r&&8!==r||(e.saveDeviceState(),e.view.deleteSelectedFeatures()),(t.ctrlKey||t.metaKey)&&67===r&&e.initiateCopy(),(t.ctrlKey||t.metaKey)&&88===r){var o=e.view.getSelectedFeatures();o.length>0&&(e.pasteboard[0]=o[0]),e.saveDeviceState(),e.view.deleteSelectedFeatures()}if((t.ctrlKey||t.metaKey)&&86===r){var i=e.pasteboard;i.length>0&&(e.updateDefaultsFromFeature(i[0]),e.activateTool(i[0].getType()))}if(90===t.keyCode&&(t.metaKey||t.ctrlKey)&&(console.log("Undo executed"),e.undo()),37===r&&(n=t.shiftKey?10:t.ctrlKey?.1:1,e.view.moveCenter(new y.a.Point(1e3*n,0)),e.updateGrid(),e.view.updateAlignmentMarks()),38===r&&(n=t.shiftKey?10:t.ctrlKey?.1:1,e.view.moveCenter(new y.a.Point(0,1e3*n)),e.updateGrid(),e.view.updateAlignmentMarks()),39===r&&(n=t.shiftKey?10:t.ctrlKey?.1:1,e.view.moveCenter(new y.a.Point(-1e3*n,0)),e.updateGrid(),e.view.updateAlignmentMarks()),40===r&&(n=t.shiftKey?10:t.ctrlKey?.1:1,e.view.moveCenter(new y.a.Point(0,-1e3*n)),e.updateGrid(),e.view.updateAlignmentMarks()),(t.ctrlKey||t.metaKey)&&65===r)return e.view.selectAllActive(),!1}))}},{key:"updateViewMouseEvents",value:function(){this.viewManagerDelegate.view.setMouseDownFunction(this.constructMouseDownEvent(this.__leftMouseTool,this.__middleMouseTool,this.__leftMouseTool)),this.viewManagerDelegate.view.setMouseUpFunction(this.constructMouseUpEvent(this.__leftMouseTool,this.__middleMouseTool,this.__leftMouseTool)),this.viewManagerDelegate.view.setMouseMoveFunction(this.constructMouseMoveEvent(this.__leftMouseTool,this.__middleMouseTool,this.__leftMouseTool))}},{key:"__mouseDownCallback",value:function(e){console.log("testing down callback",e)}},{key:"__mouseUpCallback",value:function(e){console.log("testing up callback",e)}},{key:"__mouseMoveCallback",value:function(e){console.log("testing move callback",e)}},{key:"constructMouseDownEvent",value:function(e,t,n){return console.log("Tool1: ",e,"Tool2: ",t,"Tool3: ",n),e===n?(console.log("Both right and left tool is the same"),this.constructMouseEvent(e.down,t.down,n.rightdown,this.__mouseDownCallback)):this.constructMouseEvent(e.down,t.down,n.down)}},{key:"constructMouseMoveEvent",value:function(e,t,n){return this.constructMouseEvent(e.move,t.move,n.move,this.__mouseUpCallback)}},{key:"constructMouseUpEvent",value:function(e,t,n){return this.constructMouseEvent(e.up,t.up,n.up,this.__mouseMoveCallback)}},{key:"constructMouseEvent",value:function(t,n,r,o){return console.log("construct mouse event!"),function(i){var a;i.buttons?(o(i),a=e.__eventButtonsToWhich(i.buttons)):a=i.which,2===a?n(i):3===a?r(i):1!==a&&0!==a||t(i)}}}],[{key:"__eventButtonsToWhich",value:function(e){return 1===e?1:2===e?3:4===e||3===e?2:void 0}}]),e}(),aw=n("6821"),lw=n.n(aw);function sw(e){return sw="function"===typeof Symbol&&"symbol"===typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"===typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},sw(e)}function cw(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function uw(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}
1function hw(e,t,n){return t&&uw(e.prototype,t),n&&uw(e,n),e}var fw=50,dw=function(){function e(){cw(this,e),this.deviceData=[],this.__mostRecentMD5=null}return hw(e,[{key:"pushDesign",value:function(e){var t=lw()(e);this.__mostRecentMD5&&t===this.__mostRecentMD5||(this.deviceData.length>fw&&this.deviceData.splice(0,1),this.deviceData.push(e),this.__mostRecentMD5=t,console.log("Saved new state:",t))}},{key:"popDesign",value:function(){if(this.deviceData.length>0){var e=this.deviceData.pop();return e}return null}},{key:"__cloneObject",value:function(e){var t={};for(var n in e)null!==e[n]&&"object"===sw(e[n])?t[n]=this.__cloneObject(e[n]):t[n]=e[n];return t}}]),e}();function pw(e){return pw="function"===typeof Symbol&&"symbol"===typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"===typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},pw(e)}function yw(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function mw(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function vw(e,t,n){return t&&mw(e.prototype,t),n&&mw(e,n),e}function gw(e,t){if("function"!==typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&ww(e,t)}function ww(e,t){return ww=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},ww(e,t)}function bw(e){var t=Cw();return function(){var n,r=Ow(e);if(t){var o=Ow(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return _w(this,n)}}function _w(e,t){if(t&&("object"===pw(t)||"function"===typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return Pw(e)}function Pw(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Cw(){if("undefined"===typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"===typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}
1function Ow(e){return Ow=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},Ow(e)}var Sw=function(e){gw(n,e);var t=bw(n);function n(e){var r;yw(this,n),r=t.call(this,e),r.__dragOriginCenter=null,r.__originalPosition=null,r.__startPoint=null,r.__dragging=!1,r.callback=null,r.__emittedCloseUiOnMove=!1,r._viewManagerDelegate=e;var o=Pw(r);return r.down=function(e){o.mouseDownHandler(e)},r.move=function(e){o.dragHandler(e)},r.up=function(e){o.mouseUpHandler(e)},r}return vw(n,[{key:"activate",value:function(e,t){this.__currentComponent=e,this.__emittedCloseUiOnMove=!1;var n=e.getCenterPosition();this.__originalPosition=[Math.round(Number(n[0])),Math.round(Number(n[1]))],this.__dragOriginCenter=this.__originalPosition,this.callback=t}},{key:"deactivate",value:function(){this._viewManagerDelegate.resetToDefaultTool()}},{key:"processUIPosition",value:function(e,t){var n=Math.round(Number(e)),r=Math.round(Number(t));this.__emittedCloseUiOnMove||($y.get().emit($y.SIDEBAR_SETTINGS_OPENED,{mint:null}),this.__emittedCloseUiOnMove=!0),this.__currentComponent.updateComponentPosition([n,r]),this.callback(n,r)}},{key:"__updatePosition",value:function(e,t){this.processUIPosition(e,t)}},{key:"revertToOriginalPosition",value:function(){this.__currentComponent.updateComponentPosition(this.__originalPosition)}},{key:"dragHandler",value:function(e){if(null===this._viewManagerDelegate)throw new Error("No view manager set!");if(this.__dragging){var t=Vv.getEventPosition(e);if(null===t||void 0===t||null===this.__startPoint||null===this.__dragOriginCenter)return;var n=this._viewManagerDelegate.snapToGrid([t.x,t.y]),r=[Math.round(n[0]),Math.round(n[1])],o=[this.__dragOriginCenter[0]+(r[0]-this.__startPoint[0]),this.__dragOriginCenter[1]+(r[1]-this.__startPoint[1])];this.__updatePosition(o[0],o[1])}}},{key:"mouseUpHandler",value:function(e){var t=Vv.getEventPosition(e);if(null===t)throw new Error("Point is null for move tool event handler");var n=[t.x,t.y];this._viewManagerDelegate.snapToGrid(n);this.__dragging=!1}},{key:"mouseDownHandler",value:function(e){var t=Vv.getEventPosition(e);if(null===t)throw new Error("Point is null for move tool event handler");var n=[t.x,t.y],r=this._viewManagerDelegate.snapToGrid(n);this.__startPoint=[Math.round(r[0]),Math.round(r[1])];var o=this.__currentComponent.getCenterPosition();this.__dragOriginCenter=[Math.round(Number(o[0])),Math.round(Number(o[1]))],this.__dragging=!0}}]),n}(Vv);function Dw(e){return Dw="function"===typeof Symbol&&"symbol"===typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"===typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Dw(e)}function Rw(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Tw(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function Lw(e,t,n){return t&&Tw(e.prototype,t),n&&Tw(e,n),e}function Fw(e,t,n){return Fw="undefined"!==typeof Reflect&&Reflect.get?Reflect.get:function(e,t,n){var r=kw(e,t);if(r){var o=Object.getOwnPropertyDescriptor(r,t);return o.get?o.get.call(n):o.value}},Fw(e,t,n||e)}function kw(e,t){while(!Object.prototype.hasOwnProperty.call(e,t))if(e=Aw(e),null===e)break;return e}function Ew(e,t){if("function"!==typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&Nw(e,t)}function Nw(e,t){return Nw=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},Nw(e,t)}function xw(e){var t=Ww();return function(){var n,r=Aw(e);if(t){var o=Aw(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return Mw(this,n)}}function Mw(e,t){if(t&&("object"===Dw(t)||"function"===typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return Iw(e)}function Iw(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Ww(){if("undefined"===typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"===typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}
1function Aw(e){return Aw=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},Aw(e)}var jw=function(e){Ew(n,e);var t=xw(n);function n(e,r,o){var i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;return Rw(this,n),t.call(this,e,r,i)}return Lw(n,[{key:"createNewFeature",value:function(e){var t,r=[],o=this.getCreationParameters(new y.a.Point(0,0)),i=Oy.makeFeature(this.typeString,o);this.currentFeatureID=i.ID,this.viewManagerDelegate.addFeature(i),r.push(i.ID);var a=yg.getTarget([e.x,e.y]),l=i.getParams();l["position"]=new mf("position",a),Fw(Aw(n.prototype),"createNewComponent",this).call(this,this.typeString,l,r),null===(t=Pd.viewManager)||void 0===t||t.saveDeviceState()}}]),n}(yg);function Bw(e){return Bw="function"===typeof Symbol&&"symbol"===typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"===typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Bw(e)}function Vw(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Xw(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function Yw(e,t,n){return t&&Xw(e.prototype,t),n&&Xw(e,n),e}function Gw(e,t,n){return Gw="undefined"!==typeof Reflect&&Reflect.get?Reflect.get:function(e,t,n){var r=Uw(e,t);if(r){var o=Object.getOwnPropertyDescriptor(r,t);return o.get?o.get.call(n):o.value}},Gw(e,t,n||e)}function Uw(e,t){while(!Object.prototype.hasOwnProperty.call(e,t))if(e=$w(e),null===e)break;return e}function zw(e,t){if("function"!==typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&Hw(e,t)}function Hw(e,t){return Hw=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},Hw(e,t)}function Kw(e){var t=Zw();return function(){var n,r=$w(e);if(t){var o=$w(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return qw(this,n)}}function qw(e,t){if(t&&("object"===Bw(t)||"function"===typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return Jw(e)}function Jw(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Zw(){if("undefined"===typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"===typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}function $w(e){return $w=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},$w(e)}var Qw=function(e){zw(n,e);var t=Kw(n);function n(e,r,o){var i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;return Vw(this,n),t.call(this,e,r,i)}return Yw(n,[{key:"createNewFeature",value:function(e){var t,r=[],o=Math.floor(Pd.viewManager.renderLayers.indexOf(this.viewManagerDelegate.currentLayer)/3),i=3*o,a=3*o+1,l=3*o+2,s=this.getCreationParameters(new y.a.Point(0,0)),c=Oy.makeFeature(this.typeString,s);this.currentFeatureID=c.ID,this.viewManagerDelegate.addFeature(c,i);var u,h=c.getParams();
1r.push(c.ID),rf.library[this.typeString+"_control"]&&(u=this.typeString+"_control",c=Oy.makeFeature(u,s),this.currentFeatureID=c.ID,this.viewManagerDelegate.addFeature(c,a),r.push(c.ID)),rf.library[this.typeString+"_integration"]&&(u=this.typeString+"_integration",c=Oy.makeFeature(u,s),this.currentFeatureID=c.ID,this.viewManagerDelegate.addFeature(c,l),r.push(c.ID)),h["position"]=new mf("position",[e.x,e.y]),Gw($w(n.prototype),"createNewComponent",this).call(this,this.typeString,h,r),null===(t=Pd.viewManager)||void 0===t||t.saveDeviceState()}},{key:"showTarget",value:function(){if(null!==this.lastPoint){var e=yg.getTarget(this.lastPoint);this.viewManagerDelegate.updateTarget(this.typeString,this.setString,e,this.currentParameters)}}}]),n}(yg);function eb(e){return eb="function"===typeof Symbol&&"symbol"===typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"===typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},eb(e)}function tb(e,t){return ab(e)||ib(e,t)||rb(e,t)||nb()}function nb(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function rb(e,t){if(e){if("string"===typeof e)return ob(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?ob(e,t):void 0}}function ob(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function ib(e,t){var n=null==e?null:"undefined"!==typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,i=[],a=!0,l=!1;try{for(n=n.call(e);!(a=(r=n.next()).done);a=!0)if(i.push(r.value),t&&i.length===t)break}catch(s){l=!0,o=s}finally{try{a||null==n["return"]||n["return"]()}finally{if(l)throw o}}return i}}function ab(e){if(Array.isArray(e))return e}function lb(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function sb(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function cb(e,t,n){return t&&sb(e.prototype,t),n&&sb(e,n),e}function ub(e,t,n){return ub="undefined"!==typeof Reflect&&Reflect.get?Reflect.get:function(e,t,n){var r=hb(e,t);if(r){var o=Object.getOwnPropertyDescriptor(r,t);return o.get?o.get.call(n):o.value}},ub(e,t,n||e)}function hb(e,t){while(!Object.prototype.hasOwnProperty.call(e,t))if(e=gb(e),null===e)break;return e}function fb(e,t){if("function"!==typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&db(e,t)}function db(e,t){return db=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},db(e,t)}function pb(e){var t=vb();return function(){var n,r=gb(e);if(t){var o=gb(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return yb(this,n)}}function yb(e,t){if(t&&("object"===eb(t)||"function"===typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return mb(e)}function mb(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function vb(){if("undefined"===typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"===typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}function gb(e){return gb=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},gb(e)}var wb=function(e){fb(n,e);var t=pb(n);function n(e,r,o){var i,a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;lb(this,n),i=t.call(this,e,r,a);var l=i.viewManagerDelegate.getCurrentLevelRenderLayers(),s=tb(l,3),c=s[0],u=s[1],h=s[2];if(null===c)throw new Error("Flow layer is null");if(i.flowlayer=c,null===u)throw new Error("Control layer is null");if(null===h)throw new Error("Integration layer is null");return i.controllayer=u,i.intlayer=h,i}return cb(n,[{key:"createNewFeature",value:function(e){var t=[],r=this.getCreationParameters(e),o=Oy.makeFeature(this.t
1ypeString,r);this.currentFeatureID=o.ID,null!==this.flowlayer&&this.viewManagerDelegate.addFeature(o,this.viewManagerDelegate.renderLayers.indexOf(this.flowlayer)),t.push(o.ID);var i,a=o.getParams(),l=o.getParams();rf.library[this.typeString+"_control"]&&(o.setParams(l),this.currentFeatureID=o.ID,null!==this.controllayer&&this.viewManagerDelegate.addFeature(o,this.viewManagerDelegate.renderLayers.indexOf(this.controllayer)),t.push(o.ID)),rf.library[this.typeString+"_integration"]&&(i=this.typeString+"_integration",o=Oy.makeFeature(i,r),o.setParams(l),this.currentFeatureID=o.ID,null!==this.intlayer&&this.viewManagerDelegate.addFeature(o,this.viewManagerDelegate.renderLayers.indexOf(this.intlayer)),t.push(o.ID)),ub(gb(n.prototype),"createNewComponent",this).call(this,this.typeString,a,t),this.viewManagerDelegate.saveDeviceState()}},{key:"showTarget",value:function(){if(null!==this.lastPoint){if(null===this.currentParameters)throw new Error("No parameters set");var e=yg.getTarget(this.lastPoint);this.viewManagerDelegate.updateTarget(this.typeString,this.setString,e,this.currentParameters)}}}]),n}(yg);function bb(e){return bb="function"===typeof Symbol&&"symbol"===typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"===typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},bb(e)}function _b(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Pb(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function Cb(e,t,n){return t&&Pb(e.prototype,t),n&&Pb(e,n),e}function Ob(e,t,n){return Ob="undefined"!==typeof Reflect&&Reflect.get?Reflect.get:function(e,t,n){var r=Sb(e,t);if(r){var o=Object.getOwnPropertyDescriptor(r,t);return o.get?o.get.call(n):o.value}},Ob(e,t,n||e)}function Sb(e,t){while(!Object.prototype.hasOwnProperty.call(e,t))if(e=Eb(e),null===e)break;return e}function Db(e,t){if("function"!==typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&Rb(e,t)}function Rb(e,t){return Rb=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},Rb(e,t)}function Tb(e){var t=kb();return function(){var n,r=Eb(e);if(t){var o=Eb(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return Lb(this,n)}}function Lb(e,t){if(t&&("object"===bb(t)||"function"===typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return Fb(e)}function Fb(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function kb(){if("undefined"===typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"===typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}function Eb(e){return Eb=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},Eb(e)}var Nb=function(e){Db(n,e);var t=Tb(n);function n(e,r,o){var i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;return _b(this,n),t.call(this,e,r,i)}return Cb(n,[{key:"createNewFeature",value:function(e){var t=[],r=Math.floor(Pd.viewManager.renderLayers.indexOf(this.viewManagerDelegate.currentLayer)/3),o=3*r,i=3*r,a=this.getCreationParameters(new y.a.Point(0,0)),l=Oy.makeFeature(this.typeString,a);this.currentFeatureID=l.ID,this.viewManagerDelegate.addFeature(l,o),t.push(l.ID);var s=l.getParams(),c=yg.getTarget([e.x,e.y]),u=this.typeString+"_cell",h=l.getParams();h["position"]=new mf("position",c),l=Oy.makeFeature(u,a),l.setParams(h),this.currentFeatureID=l.ID,this.viewManagerDelegate.addFeature(l,i),t.push(l.ID),Ob(Eb(n.prototype),"createNewComponent",this).call(this,this.typeString,s,t),Pd.viewManager.saveDeviceState()}},{key:"showTarget",value:function(){if(null!==this.lastPoint){if(null===this.currentParameters)throw new Error("No parameters set");var e=yg.getTarget(this.lastPoint);this.viewManagerDelegate.updateTarget(this.typeString,this.setString,e,this.currentParameters)}}}]),n}(yg);function xb(e){return xb="function"===typeof Symbol&&"symbol"===typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"===typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},xb(e)}function Mb(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Ib(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function Wb(e,t,n){return t&&Ib(e.prototype,t),n&&Ib(e,n),e}function Ab(e,t,n){return Ab="undefined"!==typeof Reflect&&Reflect.get?Reflect.get:function(e,t,n){var r=jb(e,t);if(r){var o=Object.getOwnPropertyDescriptor(r,t);return o.get?o.get.call(n):o.value}},Ab(e,t,n||e)}function jb(e,t){while(!Object.prototype.hasOwnProperty.call(e,t))if(e=zb(e),null===e)break;return e}function Bb(e,t){if("function"!==typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&Vb(e,t)}function Vb(e,t){return Vb=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},Vb(e,t)}
1function Xb(e){var t=Ub();return function(){var n,r=zb(e);if(t){var o=zb(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return Yb(this,n)}}function Yb(e,t){if(t&&("object"===xb(t)||"function"===typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return Gb(e)}function Gb(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Ub(){if("undefined"===typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"===typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}function zb(e){return zb=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},zb(e)}var Hb,Kb=function(e){Bb(n,e);var t=Xb(n);function n(e,r,o,a){var l,s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:i.NORMALLY_OPEN;Mb(this,n);var c=rf.getTypeForMINT(r);if(!c)throw new Error("Could not find type for MINT type "+r);l=t.call(this,e,c,o,a),l.valveType="VALVE3D"===r.toUpperCase()?i.NORMALLY_CLOSED:s;var u=Gb(l);return l.down=function(e){console.log(e);var t=Vv.getEventPosition(e);if(null!==t){var n=yg.getTarget([t.x,t.y]),r=u.checkIfConnectionExistsAt(new y.a.Point(n[0],n[1]));r?u.insertValve(t,r):e.ctrlKey||e.metaKey?(console.warn("Forcing placement of valve, a lot of things will not work correct if done this way"),u.forceInsertValve(t)):console.log("Could not find connection at this location")}},l}return Wb(n,[{key:"createNewFeature",value:function(e){var t,r,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,i=[];r=o?{position:yg.getTarget([e.x,e.y]),rotation:o}:{position:yg.getTarget([e.x,e.y])};var a=Math.floor(this.viewManagerDelegate.renderLayers.indexOf(this.viewManagerDelegate.currentLayer)/3),l=3*a,s=3*a+1,c=Oy.makeFeature(this.typeString,r);this.currentFeatureID=c.ID,this.viewManagerDelegate.addFeature(c,s),i.push(c.ID);var u=c.getParams();if("VALVE3D"===(null===(t=rf.library[this.typeString])||void 0===t?void 0:t.object.mint)&&rf.library.Valve3D){var h=Oy.makeFeature("Valve3D",r);this.viewManagerDelegate.addFeature(h,l),i.push(h.ID)}var f=Ab(zb(n.prototype),"createNewComponent",this).call(this,this.typeString,u,i);return f}},{key:"createNewMultiLayerFeature",value:function(e){var t,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,o=[];t=r?{position:yg.getTarget([e.x,e.y]),rotation:r}:{position:yg.getTarget([e.x,e.y])};var i=Math.floor(Pd.viewManager.renderLayers.indexOf(this.viewManagerDelegate.currentLayer)/3),a=3*i,l=3*i+1,s=Oy.makeFeature("Valve3D",t);this.currentFeatureID=s.ID,this.viewManagerDelegate.addFeature(s,a),o.push(s.ID);var c=s.getParams(),u="Valve3D"===this.typeString?"Valve3D_control":this.typeString,h=s.getParams();s=Oy.makeFeature(u,t),s.setParams(h),this.currentFeatureID=s.ID,this.viewManagerDelegate.addFeature(s,l),o.push(s.ID);var f=Ab(zb(n.prototype),"createNewComponent",this).call(this,this.typeString,c,o);return f}},{key:"showTarget",value:function(){if(null!==this.lastPoint){var e=yg.getTarget(this.lastPoint);this.viewManagerDelegate.updateTarget(this.typeString,this.setString,e,this.currentParameters)}}},{key:"checkIfConnectionExistsAt",value:function(e){var t=Pd.viewManager.view.hitFeature(e,!1);if(t){var n=Pd.currentDevice.getConnectionForFeatureID(t.featureID);return n}return null}},{key:"insertValve",value:function(e,t){var n,r=this.__getRotation(e,t);r<0&&(r+=180),this.valveType===i.NORMALLY_OPEN?(n=this.createNewFeature(e,r),this.viewManagerDelegate.currentDevice.insertValve(n,t,this.valveType)):this.valveType===i.NORMALLY_CLOSED&&(r+=90,n=this.createNewMultiLayerFeature(e,r),this.viewManagerDelegate.currentDevice.insertValve(n,t,this.valveType));try{Pd.viewManager.updatesConnectionRender(t)}catch(o){console.warn("Could not break connection at valve placement:",o)}Pd.viewManager.saveDeviceState()}},{key:"forceInsertValve",value:function(e){"Valve3D"==this.typeString?this.createNewMultiLayerFeature(e):this.createNewFeature(e),Pd.viewManager.saveDeviceState()}},{key:"__getRotation",value:function(e,t){var n,r,o,i,a=1e21,l=t.getPaths(),s=[];for(var c in l){n=l[c];for(var u=0;u<n.length;u++)s.push(n[u]);for(var h=0;h<s.length-1;h++){r=s[h],o=s[h+1];var f=this.__calculateNormalDistance(e,r,o);(f<a||0===h)&&(i=h,a=f)}r=s[i],o=s[i+1]}var d=new y.a.Point(r[0],r[1]),p=new y.a.Point(o[0],o[1]),m=p.subtract(d);return m.angle}},{key:"__calculateNormalDistance",value:function(e,t,n){var r=new y.a.Path.Line(new y.a.Point(t[0],t[1]),new y.a.Point(n[0],n[1])),o=new y.a.Point(e.x,e.y),i=r.getNearestPoint(o),a=i.getDistance(e);return a}}]),n}(Qw);function qb(e){return qb="function"===typeof Symbol&&"symbol"===typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"===typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},qb(e)}function Jb(e){return Qb(e)||$b(e)||t_(e)||Zb()}function Zb(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function $b(e){if("undefined"!==typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}function Qb(e){if(Array.isArray(e))return n_(e)}function e_(e,t){var n="undefined"!==typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];
1if(!n){if(Array.isArray(e)||(n=t_(e))||t&&e&&"number"===typeof e.length){n&&(e=n);var r=0,o=function(){};return{s:o,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,l=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return a=e.done,e},e:function(e){l=!0,i=e},f:function(){try{a||null==n.return||n.return()}finally{if(l)throw i}}}}function t_(e,t){if(e){if("string"===typeof e)return n_(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?n_(e,t):void 0}}function n_(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function r_(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o_(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function i_(e,t,n){return t&&o_(e.prototype,t),n&&o_(e,n),e}function a_(e,t){if("function"!==typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&l_(e,t)}function l_(e,t){return l_=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},l_(e,t)}function s_(e){var t=h_();return function(){var n,r=f_(e);if(t){var o=f_(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return c_(this,n)}}function c_(e,t){if(t&&("object"===qb(t)||"function"===typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return u_(e)}function u_(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function h_(){if("undefined"===typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"===typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}function f_(e){return f_=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},f_(e)}(function(e){e[e["PLACE_FIRST_POINT"]=0]="PLACE_FIRST_POINT",e[e["TARGET_PLACED_START_AGAIN"]=1]="TARGET_PLACED_START_AGAIN",e[e["PLACE_WAYPOINT"]=2]="PLACE_WAYPOINT",e[e["INTERSECTION_AWAITING_USER_INPUT"]=3]="INTERSECTION_AWAITING_USER_INPUT"})(Hb||(Hb={}));var d_=function(e){a_(n,e);var t=s_(n);function n(e,r,o){var i;r_(this,n),i=t.call(this,e),i.__STATE=Hb.PLACE_FIRST_POINT,i.typeString=r,i.setString=o,i.startPoint=null,i.lastPoint=[0,0],i.wayPoints=[],i.currentChannelID=null,i.currentTarget=null,i.dragging=!1,i.source=null,i.sinks=[],i.__currentConnectionObject=null,i.crossSection=0;var a=u_(i);return i.showQueue=new Uv((function(){null!==a.lastPoint&&a.showTarget(new y.a.Point(a.lastPoint))}),20,!1),i.updateQueue=new Uv((function(){a.updateChannel()}),20,!1),i.down=function(e){var t;switch(null===(t=Pd.viewManager)||void 0===t||t.killParamsWindow(),y.a.project.deselectAll(),console.log("Current State:",a.__STATE),a.__STATE){case Hb.PLACE_FIRST_POINT:a.__STATE=Hb.PLACE_WAYPOINT,a.dragging=!0,a.initChannel(),$y.get().emit($y.CONNECTION_ESC_HINT,!0);break;case Hb.PLACE_WAYPOINT:a.addWayPoint(e,e.altKey);break;case Hb.TARGET_PLACED_START_AGAIN:a.__STATE=Hb.PLACE_WAYPOINT,a.dragging=!0,a.initChannel();break}},i.rightdown=function(e){a.__STATE=Hb.TARGET_PLACED_START_AGAIN,a.dragging=!1;var t=a.wayPoints.pop();a.lastPoint=t,a.finishChannel(),$y.get().emit($y.RIGHT_CLICK)},i.move=function(e){var t=Vv.getEventPosition(e);if(null!==t){var n=yg.getTarget([t.x,t.y]);if(e.altKey&&a.__STATE===Hb.PLACE_WAYPOINT){var r=a.startPoint;if(a.wayPoints.length>0&&(r=a.wayPoints[a.wayPoints.length-1]),null===r)throw new Error("Last waypoint is null");var o=a.getNextOrthogonalPoint(r,n);a.lastPoint=[o[0],o[1]]}else a.lastPoint=[n[0],n[1]];a.dragging&&a.updateQueue.run(),a.showQueue.run()}},i}return i_(n,[{key:"state",get:function(){return this.__STATE}},{key:"showTarget",value:function(e){var t,n=yg.getTarget([e.x,e.y]);null===(t=Pd.viewManager)||void 0===t||t.updateTarget(this.typeString,this.setString,n)}},{key:"initChannel",value:function(){if(null===this.lastPoint)throw new Error("No last point to init channel");var e=this.__isPointOnComponent(new y.a.Point(this.lastPoint)),t=this.__isPointOnConnection(new y.a.Point(this.lastPoint));if(this.startPoint=yg.getTarget(this.lastPoint),this.lastPoint=this.startPoint,e){var n=this.__getClosestComponentPort(e,this.startPoint,this.startPoint);if(null!==n){var r=this.__portTerminal(e,n);this.source=new Wp(e,n.label),this.startPoint=r,this.lastPoint=this.startPoint,this.wayPoints.push(r)}else this.source=new Wp(e,""),this.wayPoints.push(this.startPoint)}else t?(console.warn("Implement method to make the connection connections"),this.__currentConnectionObject=t,this.wayPoints.push(this.startPoint)):this.wayPoints.push(this.startPoint)}},{key:"updateChannel",value:function(){if(this.lastPoint&&this.startPoint)if(this.currentChannelID){var e,t=yg.getTarget(this.lastPoint),n=null===(e=this.viewManagerDelegate.currentLayer)||void 0===e?void 0:e.getFeature(this.currentChannelID);null===n||void 0===n||n.updateParameter("end",t),null===n||void 0===n||n.updateParameter("wayPoints",this.wayPoints),null===n||void 0===n||n.updateParameter("segments",this.generateSegments())}else{var r;if(null===this.startPoint)throw new Error("No start point to update the channel");var o=this.createChannel(new y.a.Point(this.startPoint),new y.a.Point(this.startPoint));this.currentChannelID=o.ID,null===(r=Pd.viewManager)||void 0===r||r.addFeature(o)}}},{key:"finishChannel",value:function(){var e;if(this.currentChannelID){var t;this.wayPoints.push(this.lastPoint);var n=this.viewManagerDelegate.currentLayer.getFeature(this.currentChannelID);null===n||void 0===n||n.updateParameter("end",this.lastPoint),null===n||void 0===n||n.updateParameter("segments",this.generateSegments());var r=null===n||void 0===n?void 0:n.getParams(),o={};for(var i in r)o[i]=r[i].value;var a=rf.getDefinition("Connection"),l=new _f(o,Pp.toMap(a.unique),Pp.toMap(a.heritable));if(null===this.__currentConnectionObject||void 0===this.__currentConnectionObject){var s;if(null===this.viewManagerDelegate.currentLayer.physicalLayer)throw new Error("Error: Attempting to add connection on non-physical layer");var c=new ny("Connection",l,Pd.currentDevice.generateNewName("CHANNEL"),"CHANNEL",this.viewManagerDelegate.currentLayer.physicalLayer);c.routed=!0,c.addFeatureID(n.ID),c.addWayPoints(this.wayPoints),n.referenceID=c.id,this.__addConnectionTargets(c),null===(s=Pd.currentDevice)||void 0===s||s.addConnection(c)}else this.__currentConnectionObject.addFeatureID(n.ID),n.referenceID=this.__currentConnectionObject.id,this.__currentConnectionObject.addWayPoints(this.wayPoints),n.referenceID=this.__currentConnectionObject.id,this.__addConnectionTargets(this.__currentConnectionObject);this.currentChannelID=null,this.wayPoints=[],this.source=null,this.sinks=[],this.__currentConnectionObject=null,null===(t=Pd.viewManager)||void 0===t||t.saveDeviceState()}else console.error("Something is wrong here, unable to finish the connection");null===(e=Pd.viewManager)||void 0===e||e.saveDeviceState()}},{key:"cleanup",value:function(){var e;switch(console.log("Running Cleanup for the Connection Tool"),this.__STATE){case Hb.PLACE_FIRST_POINT:break;case Hb.PLACE_WAYPOINT:this.dragging=!1,this.currentChannelID=null,this.wayPoints=[],this.startPoint=null,this.lastPoint=[0,0],this.source=null,this.sinks=[],this.__currentConnectionObject=null,this.__STATE=Hb.PLACE_FIRST_POINT;break;case Hb.TARGET_PLACED_START_AGAIN:this.__STATE=Hb.PLACE_FIRST_POINT,this.dragging=!1;break;default:this.__STATE=Hb.PLACE_FIRST_POINT,this.dragging=!1;break}$y.get().emit($y.CONNECTION_ESC_HINT,!1),null===(e=Pd.viewManager)||void 0===e||e.removeTarget()}},{key:"addWayPoint",value:function(e,t){var n,r=Vv.getEventPosition(e),o=this.__isPointOnComponent(r),i=this.__isPointOnConnection(r);if(null!==r){var a=yg.getTarget([r.x,r.y]),l=a;if(t&&a){var s=this.startPoint;if(this.wayPoints.length>0&&(s=this.wayPoints[this.wayPoints.length-1]),null===s)throw new Error("Target is null");a=this.getNextOrthogonalPoint(s,a)}var c=this.wayPoints.length>0?this.wayPoints[this.wayPoints.length-1]:this.startPoint;if(2==a.length&&this.wayPoints.push(a),o){if(null===this.startPoint||null===c)throw new Error("No start point to update the channel");var u=this.__getClosestComponentPort(o,c,l);if(null!==u){var h=this.__portTerminal(o,u);n=new Wp(o,u.label),this.wayPoints.pop(),this.lastPoint=h}else n=new Wp(o,""),this.lastPoint=this.wayPoints.pop();null===this.source?this.source=n:this.sinks.push(n),this.__STATE=Hb.TARGET_PLACED_START_AGAIN,this.dragging=!1,this.finishChannel()}else i&&(console.log("There is connection at the waypoint path"),null===this.__currentConnectionObject?this.__currentConnectionObject=i:this.__currentConnectionObject.mergeConnection(i),this.__STATE=Hb.TARGET_PLACED_START_AGAIN,this.dragging=!1,this.lastPoint=this.wayPoints.pop(),this.finishChannel())}}},{key:"__isPointOnConnection",value:function(e){var t,n=null===(t=Pd.viewManager)||void 0===t?void 0:t.hitFeature
1(e);if(!1!==n&&null!==n&&void 0!==n){var r,o,i,a=null===(r=Pd.viewManager)||void 0===r?void 0:r.getFeatureByID(n.featureID);return null!==a.referenceID&&(o=null===(i=Pd.currentDevice)||void 0===i?void 0:i.getConnectionByID(a.referenceID),o)}return!1}},{key:"__isPointOnComponent",value:function(e){var t,n=null===(t=Pd.viewManager)||void 0===t?void 0:t.hitFeature(e);if(!1!==n&&null!==n&&void 0!==n){var r,o,i,a=null===(r=Pd.viewManager)||void 0===r?void 0:r.getFeatureByID(n.featureID);return null!==a.referenceID&&(o=null===(i=Pd.currentDevice)||void 0===i?void 0:i.getComponentByID(a.referenceID),(null!==o||void 0!==o)&&o)}return!1}},{key:"createChannel",value:function(e,t){var n;return Oy.makeFeature(this.typeString,{start:e,end:t,wayPoints:this.wayPoints,segments:this.generateSegments(),crossSection:this.crossSection,channelWidth:Re(null===(n=this.viewManagerDelegate.currentLayer)||void 0===n?void 0:n.type)})}},{key:"getNextOrthogonalPoint",value:function(e,t){if(t[0]===e[0]||t[1]===e[1])return t;var n=[t[0],t[1]],r=Math.abs(t[0]-e[0]),o=Math.abs(t[1]-e[1]);return r<o?n[0]=e[0]:n[1]=e[1],n}},{key:"generateSegments",value:function(){var e=[];e.push(this.startPoint),this.wayPoints.forEach((function(t){e.push(t)})),Array.isArray(this.lastPoint),e.push(this.lastPoint);for(var t=[],n=0;n<e.length-1;n++){var r=[e[n],e[n+1]];t.push(r)}return t}},{key:"__addConnectionTargets",value:function(e){for(var t in null!==this.source&&void 0!==this.source&&e.addConnectionTarget(this.source),this.sinks)console.log("Sinks: ",this.sinks),e.addConnectionTarget(this.sinks[t])}},{key:"__getClosestComponentPort",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,r=this.__locatedPortsOnCurrentLayer(e);if(0===r.length)return null;if(null!==n){var o=this.__uniquelyClosestPort(r,n,e);if(null!==o)return o}return this.__portFacingPoint(e,r,t)}},{key:"__currentConnectionLayer",value:function(){return this.viewManagerDelegate.currentLayer.type===o.CONTROL?"CONTROL":this.viewManagerDelegate.currentLayer.type===o.FLOW?"FLOW":this.viewManagerDelegate.currentLayer.type===o.INTEGRATION?"INTEGRATION":null}},{key:"__locatedPortsOnCurrentLayer",value:function(e){var t=this.__currentConnectionLayer();null===t&&console.warn("Could not find the current layer type, searching through all the component ports without filtering");var n,r=[],o=e_(e.ports.keys());try{for(o.s();!(n=o.n()).done;){var i=n.value,a=e.ports.get(i);null!==t&&a.layer!==t||r.push({port:a,loc:b.calculateAbsolutePosition(a,e)})}}catch(l){o.e(l)}finally{o.f()}return r}},{key:"__componentSpan",value:function(e){try{var t=e.getBoundingRectangle();return Math.max(t.width,t.height,1)}catch(n){return 1e3}}},{key:"__uniquelyClosestPort",value:function(e,t,n){var r=this;if(1===e.length)return e[0].port;var o=Jb(e).sort((function(e,n){return r.__euclidean(t,e.loc)-r.__euclidean(t,n.loc)})),i=Math.max(.15*this.__componentSpan(n),1);return this.__euclidean(t,o[1].loc)-this.__euclidean(t,o[0].loc)>i?o[0].port:null}},{key:"__portFacingPoint",value:function(e,t,n){var r;try{r=e.getCenterPosition()}catch(g){r=n}var o,i=n[0]-r[0],a=n[1]-r[1],l=Math.hypot(i,a),s=t[0],c=Number.NEGATIVE_INFINITY,u=Number.POSITIVE_INFINITY,h=e_(t);try{for(h.s();!(o=h.n()).done;){var f=o.value,d=this.__euclidean(n,f.loc),p=f.loc[0]-r[0],y=f.loc[1]-r[1],m=Math.hypot(p,y),v=l<1e-6||m<1e-6?-d:(p*i+y*a)/(m*l);(v>c+1e-9||Math.abs(v-c)<=1e-9&&d<u)&&(c=v,u=d,s=f)}}catch(w){h.e(w)}finally{h.f()}return s.port}},{key:"__euclidean",value:function(e,t){return Math.hypot(e[0]-t[0],e[1]-t[1])}},{key:"__portTerminal",value:function(e,t){var n=b.calculateAbsolutePosition(t,e),r=String((null===e||void 0===e?void 0:e.mint)||(null===e||void 0===e?void 0:e._entity)||"").toUpperCase();return"MIXER"===r||"CURVED MIXER"===r||"MIXER3D"===r?b.mixerTerminalHinge(n,e,2*this.__channelOverlap()):b.insetTowardCenter(n,e,this.__channelOverlap())}},{key:"__channelOverlap",value:function(){var e,t=rf.getDefaultsForType(this.typeString)||{},n=Number(null!==(e=t.channelWidth)&&void 0!==e?e:Ce);return Math.max(n/2,16)}},{key:"updateParameter",value:function(e,t){if("crossSection"===e&&(this.crossSection=Number(t)),null!==this.currentChannelID){var n=this.viewManagerDelegate.currentLayer.getFeature(this.currentChannelID);null===n||void 0===n||n.updateParameter(e,t)}}}]),n}(Vv);function p_(e){return p_="function"===typeof Symbol&&"symbol"===typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"===typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},p_(e)}function y_(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function m_(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function v_(e,t,n){return t&&m_(e.prototype,t),n&&m_(e,n),e}function g_(e,t){if("function"!==typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&w_(e,t)}function w_(e,t){return w_=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},w_(e,t)}function b_(e){var t=C_();return function(){var n,r=O_(e);if(t){var o=O_(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return __(this,n)}}function __(e,t){if(t&&("object"===p_(t)||"function"===typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return P_(e)}function P_(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}
1function C_(){if("undefined"===typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"===typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}function O_(e){return O_=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},O_(e)}var S_=function(e){g_(n,e);var t=b_(n);function n(e){var r;y_(this,n),r=t.call(this,e);var o=P_(r);return r.down=function(e){o.mouseDownHandler(e)},r.move=function(e){},r.up=function(e){o.mouseUpHandler(e)},r}return v_(n,[{key:"activate",value:function(e){console.log("Activating the tool for a new component",e),this.__currentComponent=e}},{key:"deactivate",value:function(){var e;null===(e=Pd.viewManager)||void 0===e||e.resetToDefaultTool()}},{key:"generateArray",value:function(e,t,n,r){var o;console.log("Generate array:",e,t,n,r);var i=this.__currentComponent.getPosition()[0],a=this.__currentComponent.getPosition()[1],l=this.__currentComponent.name;this.__currentComponent.name=l+"_1_1";for(var s=[],c=0;c<t;c++)for(var u=0;u<e;u++)if(0!==u||0!==c){var h=i+u*n,f=a+c*r;console.log("Current Component",this.__currentComponent.name);var d=this.__currentComponent.replicate(h,f,l+"_"+String(u+1)+"_"+String(c+1));console.log("replica",d),s.push(this.__currentComponent.replicate(h,f,l+"_"+String(u+1)+"_"+String(c+1)))}console.log("replicas",s),s.forEach((function(e){var t;null===(t=Pd.currentDevice)||void 0===t||t.addComponent(e)})),null===(o=Pd.viewManager)||void 0===o||o.saveDeviceState()}},{key:"revertToOriginalPosition",value:function(){this.__currentComponent.updateComponentPosition(this.__originalPosition)}},{key:"dragHandler",value:function(){}},{key:"mouseUpHandler",value:function(e){console.log("Up event",e)}},{key:"mouseDownHandler",value:function(e){console.log("Down event",e)}}]),n}(Vv);function D_(e){return D_="function"===typeof Symbol&&"symbol"===typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"===typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},D_(e)}function R_(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function T_(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function L_(e,t,n){return t&&T_(e.prototype,t),n&&T_(e,n),e}function F_(e,t){if("function"!==typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&k_(e,t)}function k_(e,t){return k_=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},k_(e,t)}function E_(e){var t=M_();return function(){var n,r=I_(e);if(t){var o=I_(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return N_(this,n)}}function N_(e,t){if(t&&("object"===D_(t)||"function"===typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return x_(e)}function x_(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function M_(){if("undefined"===typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"===typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}function I_(e){return I_=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},I_(e)}var W_=function(e){F_(n,e);var t=E_(n);function n(e,r,o){var i;return R_(this,n),i=t.call(this,e,r.type),i.__customComponent=r,i}return L_(n,[{key:"createNewFeature",value:function(e){var t,n,r=[],o=am.makeCustomComponentFeature(this.__customComponent,this.setString,{position:yg.getTarget([e.x,e.y])});this.currentFeatureID=o.ID,null===(t=Pd.viewManager)||void 0===t||t.addFeature(o),r.push(o.ID);var i=o.getParams();this.createNewCustomComponent(i,r),null===(n=Pd.viewManager)||void 0===n||n.saveDeviceState()}},{key:"showTarget",value:function(){var e;if(null===this.lastPoint)throw new Error("No last point");var t=yg.getTarget(this.lastPoint);null===(e=Pd.viewManager)||void 0===e||e.updateTarget(this.typeString,this.setString,t,{})}},{key:"createNewCustomComponent",value:function(e,t){var n,r=Iy.defaultParameterDefinitions(),o={};for(var i in e)o[i]=e[i].value;var a=new _f(o,r.unique,r.heritable),l=rf.generateID();if(console.log(this.__customComponent.entity,this.__customComponent.type),null===Pd.currentDevice)throw new Error("No current device");var s,c=Pd.currentDevice.generateNewName(this.__customComponent.entity),u=new Ep(a,c,this.__customComponent.entity,l);for(var h in t){var f;u.addFeatureID(t[h]),s=null===(f=Pd.currentDevice)||void 0===f?void 0:f.getFeatureByID(t[h]),s.referenceID=l}return null===(n=Pd.currentDevice)||void 0===n||n.addComponent(u),u}}]),n}(yg);function A_(e){return A_="function"===typeof Symbol&&"symbol"===typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"===typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},A_(e)}function j_(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function B_(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function V_(e,t,n){return t&&B_(e.prototype,t),n&&B_(e,n),e}function X_(e,t){if("function"!==typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&Y_(e,t)}function Y_(e,t){return Y_=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},Y_(e,t)}function G_(e){var t=H_();return function(){var n,r=K_(e);if(t){var o=K_(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return U_(this,n)}}function U_(e,t){if(t&&("object"===A_(t)||"function"===typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return z_(e)}function z_(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function H_(){if("undefined"===typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"===typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}function K_(e){return K_=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},K_(e)}var q_=function(e){X_(n,e);var t=G_(n);function n(e,r,o){var i;j_(this,n),i=t.call(this,e),i.typeString=r,i.setString=o,i.startPoint=null,i.lastPoint=null,i.currentChannelID=null,i.currentTarget=null,i.dragging=!1;var a=z_(i);return i.showQueue=new Uv((function(){null!==a.lastPoint&&a.showTarget(new y.a.Point(a.lastPoint))}),20,!1),i.updateQueue=new Uv((function(){a.updateChannel()}),20,!1),i.down=function(e){var t;
1null===(t=Pd.viewManager)||void 0===t||t.killParamsWindow(),y.a.project.deselectAll(),a.dragging=!0,a.initChannel()},i.up=function(e){a.dragging=!1,a.finishChannel(Vv.getEventPosition(e))},i.move=function(e){a.lastPoint=Vv.getEventPosition(e),a.dragging&&a.updateQueue.run(),a.showQueue.run()},i}return V_(n,[{key:"abort",value:function(){var e;(this.dragging=!1,this.currentTarget&&this.currentTarget.remove(),this.currentChannelID)&&(null===(e=Pd.viewManager)||void 0===e||e.removeFeatureByID(this.currentChannelID))}},{key:"showTarget",value:function(e){var t,r=n.getTarget(this.lastPoint);null===(t=Pd.viewManager)||void 0===t||t.updateTarget(this.typeString,this.setString,r,{})}},{key:"initChannel",value:function(){this.startPoint=n.getTarget(this.lastPoint),this.lastPoint=this.startPoint}},{key:"updateChannel",value:function(){if(this.lastPoint&&this.startPoint)if(this.currentChannelID){var e=n.getTarget(this.lastPoint),t=this.viewManagerDelegate.currentLayer.getFeature(this.currentChannelID);null===t||void 0===t||t.updateParameter("end",e)}else{var r,o=n.createChannel(this.startPoint,this.startPoint,this.typeString,this.setString);this.currentChannelID=o.ID,null===(r=Pd.viewManager)||void 0===r||r.addFeature(o)}}},{key:"finishChannel",value:function(e){var t,r,o=n.getTarget(e);this.currentChannelID?this.startPoint[0]===o[0]&&this.startPoint[1]===o[1]&&(null===(r=Pd.viewManager)||void 0===r||r.removeFeatureByID(this.currentChannelID)):this.updateChannel();this.currentChannelID=null,this.startPoint=null,null===(t=Pd.viewManager)||void 0===t||t.saveDeviceState()}}],[{key:"makeReticle",value:function(e){var t=10/y.a.view.zoom,n=new y.a.Path.Circle(e,t);return n.fillColor=new y.a.Color(.5,0,1,.5),n}},{key:"createChannel",value:function(e,t){var n,r,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;return Oy.makeFeature(o,{start:e,end:t,channelWidth:Re(null===(n=Pd.viewManager)||void 0===n||null===(r=n.currentLayer)||void 0===r?void 0:r.type)})}},{key:"getTarget",value:function(e){if(null===Pd.viewManager)throw new Error("ViewManager not initialized");var t=Pd.viewManager.snapToGrid(e);return t}}]),n}(Vv);function J_(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Z_(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function $_(e,t,n){return t&&Z_(e.prototype,t),n&&Z_(e,n),e}var Q_=function(){function e(){J_(this,e)}return $_(e,null,[{key:"fixLayout",value:function(e){var t,n,r,o,i,a,l,s,c,u,h,f,d,p,y=e.orificeSize,m=e.orificeLength,v=e.oilInputWidth,g=e.waterInputWidth,w=e.outputWidth,_=e.outputLength,P=e.height,C=null===(t=Pd.currentDevice)||void 0===t?void 0:t.getComponentByName("DropletGen_1"),O=null===(n=Pd.currentDevice)||void 0===n?void 0:n.getComponentByName("Port_in"),S=null===(r=Pd.currentDevice)||void 0===r?void 0:r.getComponentByName("Port_oil1"),D=null===(o=Pd.currentDevice)||void 0===o?void 0:o.getComponentByName("Port_oil2"),R=null===(i=Pd.currentDevice)||void 0===i?void 0:i.getComponentByName("Port_out"),T=null===(a=Pd.currentDevice)||void 0===a?void 0:a.getFeatureByName("Transition_3"),L=null===(l=Pd.currentDevice)||void 0===l?void 0:l.getFeatureByName("Transition_6"),F=null===(s=Pd.currentDevice)||void 0===s?void 0:s.getFeatureByName("Transition_5"),k=null===(c=Pd.currentDevice)||void 0===c?void 0:c.getFeatureByName("Transition_4");null===C||void 0===C||C.updateParameter("orificeSize",y),null===C||void 0===C||C.updateParameter("orificeLength",m),null===C||void 0===C||C.updateParameter("oilInputWidth",v),null===C||void 0===C||C.updateParameter("waterInputWidth",g),null===C||void 0===C||C.updateParameter("outputWidth",w),null===C||void 0===C||C.updateParameter("outputLength",_),null===C||void 0===C||C.updateParameter("height",P),null===k||void 0===k||k.updateParameter("cw2",w),null===T||void 0===T||T.updateParameter("cw2",g),null===L||void 0===L||L.updateParameter("cw2",v),null===F||void 0===F||F.updateParameter("cw2",v);var E,N,x,M=null===C||void 0===C?void 0:C.ports;console.log("component ports:",M);var I=null===C||void 0===C?void 0:C.getPosition()[0],W=I+v/2,A=null===S||void 0===S?void 0:S.getCenterPosition()[1];null===S||void 0===S||S.updateComponentPosition([W,A]),A=null===D||void 0===D?void 0:D.getCenterPosition()[1],null===D||void 0===D||D.updateComponentPosition([W,A]),A=null===S||void 0===S?void 0:S.getValue("position")[1],null===L||void 0===L||L.updateParameter("position",[W,A]),A=null===D||void 0===D?void 0:D.getValue("position")[1],null===F||void 0===F||F.updateParameter("position",[W,A]);var j=null===O||void 0===O?void 0:O.getValue("position"),B=null===R||void 0===R?void 0:R.getValue("position");null===T||void 0===T||T.updateParameter("position",j),null===k||void 0===k||k.updateParameter("position",B),E=null===O||void 0===O?void 0:O.getCenterPosition(),x=null===M||void 0===M?void 0:M.get("4"),N=b.calculateAbsolutePosition(x,C),console.log("endpoint",N);var V=q_.createChannel(E,N,"RoundedChannel","Basic");p=V.getID(),null===(u=Pd.viewManager)||void 0===u||u.addFeature(V),V=Pd.currentDevice.getFeatureByID(p),V.updateParameter("channelWidth",g),E=null===S||void 0===S?void 0:S.getCenterPosition(),x=null===M||void 0===M?void 0:M.get("1"),N=b.calculateAbsolutePosition(x,C),console.log("endpoint",N),V=q_.createChannel(E,N,"RoundedChannel","Basic"),p=V.getID(),null===(h=Pd.viewManager)||void 0===h||h.addFeature(V),V=Pd.currentDevice.getFeatureByID(p),V.updateParameter("channelWidth",v),E=null===R||void 0===R?void 0:R.getCenterPosition(),x=null===M||void 0===M?void 0:M.get("2"),N=b.calculateAbsolutePosition(x,C),console.log("endpoint",N),V=q_.createChannel(E,N,"RoundedChannel","Basic"),p=V.getID(),null===(f=Pd.viewManager)||void 0===f||f.addFeature(V),V=Pd.currentDevice.getFeatureByID(p),V.updateParameter("channelWidth",w),E=null===D||void 0===D?void 0:D.getCenterPosition(),x=null===M||void 0===M?void 0:M.get("3"),console.log("cp",x),N=b.calculateAbsolutePosition(x,C),console.log("endpoint",N),V=q_.createChannel(E,N,"RoundedChannel","Basic"),p=V.getID(),null===(d=Pd.viewManager)||void 0===d||d.addFeature(V),V=Pd.currentDevice.getFeatureByID(p),V.updateParameter("channelWidth",v)}}]),e}();function eP(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function tP(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function nP(e,t,n){return t&&tP(e.prototype,t),n&&tP(e,n),e}var rP=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"New Layer",n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:o.FLOW;eP(this,e),this.__type=r,this.features={},this.featureCount=0,this.name=t,this.params=n?n.params:new _f([],Sf.getUniqueParameters(),new Map),this._physicalLayer=n,r==o.FLOW?this.color="indigo":r==o.CONTROL?this.color="red":r==o.INTEGRATION?this.color="green":this.color=void 0,this.__id=rf.generateID()}return nP(e,[{key:"physicalLayer",get:function(){return this._physicalLayer},set:function(e){this._physicalLayer=e}},{key:"type",get:function(){return this.__type}},{key:"id",get:function(){return this.__id}},{key:"addFeature",value:function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];this.__ensureIsAFeature(e),this.features[e.ID]=e,this.featureCount+=1,null!==this.physicalLayer&&1==t?(this.physicalLayer.addFeature(e),e.layer=this.physicalLayer):e.layer=this.physicalLayer,e.setManufacturingInfoLayer()}},{key:"__ensureIsAFeature",value:function(e){if(!(e instanceof am)&&!(e instanceof gm))throw new Error("Provided value"+e+" is not a Feature! Did you pass an ID by mistake?")}},{key:"__ensureFeatureExists",value:function(e){if(!this.containsFeature(e))throw new Error("Layer does not contain the specified feature!")}},{key:"__ensureFeatureIDExists",value:function(e){if(!this.containsFeatureID(e))throw new Error("Layer does not contain a feature with the specified ID!")}},{key:"getFeature",value:function(e){return this.__ensureFeatureIDExists(e),this.features[e]}},{key:"removeFeature",value:function(e){this.removeFeatureByID(e.ID)}},{key:"removeFeatureByID",value:function(e){this.__ensureFeatureIDExists(e),this.featureCount-=1;var t=this._physicalLayer;null!==t&&t.containsFeatureID(e)&&t.removeFeatureByID(e),delete this.features[e]}},{key:"containsFeature",value:function(e){return this.__ensureIsAFeature(e),this.features.hasOwnProperty(e.ID)}},{key:"containsFeatureID",value:function(e){return this.features.hasOwnProperty(e)}},{key:"getAllFeaturesFromLayer",value:function(){return this.features}},{key:"__featuresToJSON",value:function(){var e={};for(var t in this.features)e[t]=this.features[t].toJSON();return e}},{key:"__featuresInterchangeV1",value:function(){var e=[];for(var t in this.features)e.push(this.features[t].toInterchangeV1());return e}},{key:"__loadFeaturesFromJSON",value:function(e){for(var t in e)this.addFeature(am.fromJSON(e[t]))}},{key:"__loadFeaturesFromInterchangeV1",value:function(e){for(var t in e)this.addFeature(am.fromInterchangeV1(e[t]))}},{key:"__layerToInterchangeV1",value:function(){return null!==this._physicalLayer?this._physicalLayer.toInterchangeV1():null}},{key:"toInterchangeV1",value:function(){var e;e=this.physicalLayer?this.physicalLayer.id:null;var t={id:this.__id,name:this.name,modellayer:e,type:this.__type,features:this.__featuresInterchangeV1(),color:this.color};return t}}],[{key:"fromJSON",value:function(t){if(!Object.prototype.hasOwnProperty.call(t,"features"))throw new Error("JSON layer has no features!");var n=new e(t.name,null,t.type);return n.__loadFeaturesFromJSON(t.features),t.color&&(n.color=t.color),n}},{key:"fromInterchangeV1",value:function(t){var n;if(Object.prototype.hasOwnProperty.call(t,"type"))if("FLOW"===t.type)n=o.FLOW;else if("CONTROL"===t.type)n=o.CONTROL;else{if("INTEGRATION"!==t.type)throw new Error("Unknown layer type: "+t.type);n=o.INTEGRATION}
1var r=new e(t.name,null,n);return r.__loadFeaturesFromInterchangeV1(t.features),t.color&&(r.color=t.color),r}}]),e}();function oP(e,t){var n="undefined"!==typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=iP(e))||t&&e&&"number"===typeof e.length){n&&(e=n);var r=0,o=function(){};return{s:o,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,l=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return a=e.done,e},e:function(e){l=!0,i=e},f:function(){try{a||null==n.return||n.return()}finally{if(l)throw i}}}}function iP(e,t){if(e){if("string"===typeof e)return aP(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?aP(e,t):void 0}}function aP(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function lP(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function sP(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?lP(Object(n),!0).forEach((function(t){cP(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):lP(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function cP(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function uP(e){return uP="function"===typeof Symbol&&"symbol"===typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"===typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},uP(e)}var hP={flow:"FLOW",control:"CONTROL",integration:"INTEGRATION",cells:"INTEGRATION"};function fP(e){if(null==e)return null;if("string"===typeof e)return e;if("object"===uP(e)){var t=e;return t.__id||t.id||null}return null}function dP(e){if(!e||"object"!==uP(e))return e;if(Object.prototype.hasOwnProperty.call(e,"__rootObject")){var t=e.__rootObject||{};return sP(sP({},t),{},{type:e.__type||t.type})}return e}function pP(e){if(e&&Object.prototype.hasOwnProperty.call(e,"orientation")){var t=e.orientation;e.rotation="V"===t?0:270,delete e.orientation}}function yP(e){e&&"object"===uP(e)&&(!e.macro&&e.type&&(e.macro=e.type),pP(e.params),Array.isArray(e.dxfData)&&(e.dxfData=e.dxfData.map(dP)))}function mP(e){if(e)if(Array.isArray(e)){var t,n=oP(e);try{for(n.s();!(t=n.n()).done;){var r=t.value;yP(r)}}catch(i){n.e(i)}finally{n.f()}}else for(var o in e)yP(e[o])}function vP(e){if(!Object.prototype.hasOwnProperty.call(e,"layers")){var t=e.features;Array.isArray(t)&&0!==t.length&&t[0]&&Object.prototype.hasOwnProperty.call(t[0],"features")&&(e.layers=t.map((function(e,t){var n=String(e.name||"layer-".concat(t)).toLowerCase(),r=e.type||hP[n]||"FLOW";return{id:e.id||"".concat(n,"-layer-").concat(t),name:e.name||n,type:r,group:e.group||"0",params:e.params||{z_offset:0,flip:!1},features:e.features||{}}})))}}function gP(e){if(e.layers&&0!==e.layers.length){var t,n=new Set(e.layers.map((function(e){var t;return String(null!==(t=e.group)&&void 0!==t?t:"0")}))),r=oP(n);try{var o=function(){var n=t.value,r=e.layers.filter((function(e){var t;return String(null!==(t=e.group)&&void 0!==t?t:"0")===n})),o=r.some((function(e){return"INTEGRATION"===e.type}));o||e.layers.push({id:"integration-layer-".concat(n),name:"integration",type:"INTEGRATION",group:n,params:{z_offset:0,flip:!1}})};for(r.s();!(t=r.n()).done;)o()}catch(i){r.e(i)}finally{r.f()}}}function wP(e){var t,n;if(Array.isArray(e.connections)){var r,o=(null===(t=e.layers)||void 0===t?void 0:t.find((function(e){return"FLOW"===e.type}
1)))||(null===(n=e.layers)||void 0===n?void 0:n[0]),i=oP(e.connections);try{for(i.s();!(r=i.n()).done;){var a=r.value;if(!a.layer&&o&&(a.layer=o.id),a.source){var l=fP(a.source.component);l&&(a.source.component=l)}if(Array.isArray(a.sinks)){var s,c=oP(a.sinks);try{for(c.s();!(s=c.n()).done;){var u=s.value,h=fP(u.component);h&&(u.component=h)}}catch(f){c.e(f)}finally{c.f()}}}}catch(f){i.e(f)}finally{i.f()}}else e.connections=[]}function bP(e){if(Array.isArray(e.components)){var t,n=oP(e.components);try{for(n.s();!(t=n.n()).done;){var r=t.value;"TEST MINT"===r.entity&&(r.entity="PUMP"),pP(r.params),Array.isArray(r.ports)||(r.ports=[])}}catch(o){n.e(o)}finally{n.f()}}else e.components=[]}function _P(e){if(e.params||(e.params={width:135e3,length:85e3}),Array.isArray(e.components)||(e.components=[]),Array.isArray(e.connections)||(e.connections=[]),Array.isArray(e.valves)||(e.valves=[]),vP(e),gP(e),e.layers){var t,n=oP(e.layers);try{for(n.s();!(t=n.n()).done;){var r=t.value;mP(r.features)}}catch(o){n.e(o)}finally{n.f()}}return bP(e),wP(e),e}function PP(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function CP(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?PP(Object(n),!0).forEach((function(t){OP(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):PP(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function OP(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function SP(e){return SP="function"===typeof Symbol&&"symbol"===typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"===typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},SP(e)}function DP(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function RP(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function TP(e,t,n){return t&&RP(e.prototype,t),n&&RP(e,n),e}function LP(e){var t=e&&(null!=e.channelWidth?e.channelWidth:e.width),n=Number(t);return Number.isFinite(n)&&n>0?n:Ce}var FP=function(){function e(){DP(this,e)}return TP(e,null,[{key:"featurePositionFromParchmint",value:function(e){var t=e.params||{},n=t.position;return Array.isArray(n)&&n.length>=2?[Number(n[0]),Number(n[1])]:[0,0]}},{key:"layerHasStoredFeatures",value:function(e){var t=e.features;return null!=t&&(Array.isArray(t)?t.length>0:"object"===SP(t)&&Object.keys(t).length>0)}},{key:"loadFromScratch",value:function(t){_P(t),e.normalizeParchmintLayerGroups(t);var n=e.loadDeviceFromInterchangeV1_2(t),r=[];if(t.renderLayers)for(var i=0;i<t.renderLayers.length;i++)r.push(e.loadRenderLayerFromInterchangeV1(t.renderLayers[i],n));else if(Object.prototype.hasOwnProperty.call(t,"layers"))for(var a=0;a<t.layers.length;a++)r.push(e.generateRenderLayerFromLayerInterchangeV1(t.layers[a],n));else r.push(new rP(n.generateNewName("RenderLayerFlow"),n.layers[0],o.FLOW)),r.push(new rP(n.generateNewName("RenderLayerControl"),n.layers[1],o.CONTROL)),r.push(new rP(n.generateNewName("RenderLayerIntegration"),n.layers[0],o.INTEGRATION));for(var l=new Map,s=0;s<n.layers.length;s++)if(l.has(n.layers[s].group)){var c=l.get(n.layers[s].group);c&&l.set(n.layers[s].group,c+1)}else l.set(n.layers[s].group,1);l.forEach((function(i,a){var l=parseInt(a,10);if(3==i)console.log("All layers accounted for in group "+a);else{var s=["FLOW","CONTROL","INTEGRATION"];for(var c in t.layers)if(String(t.layers[c].group)===String(a)){var u=s.indexOf(t.layers[c].type);u>=0&&s.splice(u,1)}for(var h in console.log(s.length+" layers missing from group "+a+", these will be generated"),s){var f=e.generateMissingLayerFeaturesV1(t,s[h],a);if("FLOW"==s[h]){var d=new Sf({},n.generateNewName("LayerFlow"),o.FLOW,a,n);for(var p in f)d.features[f[p].ID]=f[p];d.featureCount=f.length,n.addLayerAtIndex(d,3*l),r.splice(3*l,0,new rP(n.generateNewName("Ren
1derLayerFlow"),n.layers[3*l],o.FLOW))}else if("CONTROL"==s[h]){var y=new Sf({},n.generateNewName("LayerControl"),o.CONTROL,a,n);for(var m in f)y.features[f[m].ID]=f[m];y.featureCount=f.length,n.addLayerAtIndex(y,3*l+1),r.splice(3*l+1,0,new rP(n.generateNewName("RenderLayerControl"),n.layers[3*l+1],o.CONTROL))}else if("INTEGRATION"==s[h]){var v=new Sf({},n.generateNewName("LayerIntegration"),o.INTEGRATION,a,n);for(var g in f)v.features[f[g].ID]=f[g];v.featureCount=f.length,n.addLayerAtIndex(v,3*l+2),r.splice(3*l+2,0,new rP(n.generateNewName("RenderLayerIntegration"),n.layers[3*l+2],o.INTEGRATION))}}}}));var u=n.getAllFeaturesFromDevice();for(var h in u){var f=u[h];null!==f.referenceID&&n.updateObjectReference(f.referenceID,f.ID)}return[n,r]}},{key:"normalizeParchmintLayerGroups",value:function(e){if(e&&Array.isArray(e.layers)&&0!==e.layers.length){var t=e.layers.filter((function(e){return"FLOW"===String(e.type||"").toUpperCase()}));if(t.length<=1)e.layers.forEach((function(e){e.group="0"}));else{var n=t.map((function(e,t){return String(null!=e.group?e.group:t)}));e.layers.forEach((function(e){var t=String(e.type||"").toUpperCase();if("FLOW"!==t){var r=String(null!=e.group?e.group:"");n.indexOf(r)>=0?e.group=r:e.group=n[0]||"0"}else e.group=String(null!=e.group?e.group:"0")}))}}}},{key:"deviceSpanFromParams",value:function(e){var t,n,r=e&&"object"===SP(e)?e:{},o=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];for(var o=0,i=t;o<i.length;o++){var a=i[o];if(Object.prototype.hasOwnProperty.call(r,a)&&null!=r[a]&&""!==r[a]){var l=Number(r[a]);if(Number.isFinite(l)&&l>0)return l}}return null};return{"x-span":null!==(t=o("x-span","width","xspan"))&&void 0!==t?t:135e3,"y-span":null!==(n=o("y-span","length","yspan"))&&void 0!==n?n:85e3}}},{key:"loadDeviceFromInterchangeV1_2",value:function(t){var n;if(Object.prototype.hasOwnProperty.call(t,"params")){var r=e.deviceSpanFromParams(t.params);Object.prototype.hasOwnProperty.call(t.params,"dxfImport")&&(r.dxfImport=t.params.dxfImport),n=new Oy(r,t.name)}else console.warn("Could not find device params, using some default values for device size"),n=new Oy({"x-span":135e3,"y-span":85e3},t.name);if(Object.prototype.hasOwnProperty.call(t,"layers"))for(var i in t.layers)n.addLayer(e.loadLayerFromInterchangeV1(t,t.layers[i],n));else{var a=new Sf({},n.generateNewName("LayerFlow"),o.FLOW,"0",n);n.addLayer(a),a=new Sf({},n.generateNewName("LayerControl"),o.CONTROL,"0",n),n.addLayer(a),a=new Sf({},n.generateNewName("LayerIntegration"),o.INTEGRATION,"0",n),n.addLayer(a)}for(var l in t.components){var s=e.loadComponentFromInterchangeV1(t.components[l]);n.addComponent(s)}for(var c in t.connections){var u=e.loadConnectionFromInterchangeV1(n,t.connections[c]);n.addConnection(u)}if(Object.prototype.hasOwnProperty.call(t,"valves"))for(var h in t.valves){var f=t.valves[h],d=n.getComponentByID(f.componentid),p=n.getConnectionByID(f.connectionid);null!==d?null!==p?n.insertValve(d,p,f.type):console.warn("Could not find connection with ID "+f.connectionid+" for valve "+f.componentid):console.warn("Could not find component with ID "+f.componentid+" for valve "+f.componentid)}else console.warn("Could not find valve map, using default valve map");return n}},{key:"loadLayerFromInterchangeV1",value:function(t,n,r){var i=o.FLOW;if(Object.prototype.hasOwnProperty.call(n,"type"))if("FLOW"===n.type)i=o.FLOW;else if("CONTROL"===n.type)i=o.CONTROL;else{if("INTEGRATION"!==n.type)throw new Error("Unknown layer type: "+n.type);i=o.INTEGRATION}var a=new Sf(n.params,n.name,i,String(null!=n.group?n.group:"0"),r),l=e.layerHasStoredFeatures(n);if(l){for(var s in n.features)a.features[n.features[s].id]=e.loadFeatureFromInterchangeV1(n.features[s]);a.featureCount=Array.isArray(n.features)?n.features.length:Object.keys(n.features).length}else{var c=e.loadFeaturesFromComponentInterchangeV1(t,n);for(var u in c)a.features[c[u].ID]=c[u];a.featureCount=c.length;var h=e.loadFeaturesFromConnectionInterchangeV1(t,n);for(var f in h)a.features[h[f].ID]=h[f];a.featureCount=a.featureCount+h.length}return a.id=n.id,a}},{key:"loadFeatureFromInterchangeV1",value:function(e){console.log("PARAMS: ",e.params);var t=Oy.makeFeature(e.macro,e.params,e.name,e.id,e.type,e.dxfData);return Object.prototype.hasOwnProperty.call(e,"referenceID")&&(t.referenceID=e.referenceID),t}},{key:"loadFeaturesFromComponentInterchangeV1",value:function(t,n){var r=[];for(var o in t.components){var i=String(t.components[o].entity||"").toUpperCase();if("VALVE3D"!==i){var a=rf.getTypeForMINT(t.components[o].entity,t.components[o].params);if(null!==a){var l=void 0,s=rf.getAllRenderKeys(a),c=null;
1for(var u in t.layers)t.layers[u].id==t.components[o].layers[0]&&(c=t.layers[u].group);if(null!==c)if(1==s.length){if(t.components[o].layers[0]==n.id){console.log("Assuming default type feature can be placed on current layer");var h=CP({},t.components[o].params||{});h.position=e.featurePositionFromParchmint(t.components[o]),l=Oy.makeFeature(a,h),l.referenceID=t.components[o].id,r.push(l)}}else for(var f in s)if(s[f]==n.type&&c==n.group){var d=CP({},t.components[o].params||{});d.position=e.featurePositionFromParchmint(t.components[o]),rf.library[a].key==n.type?l=Oy.makeFeature(a,d):rf.library[a+"_"+n.type.toLowerCase()]?l=Oy.makeFeature(a+"_"+n.type.toLowerCase(),d):(console.log("Assuming default type feature can be placed on current layer"),l=Oy.makeFeature(a,d)),l.referenceID=t.components[o].id,r.push(l)}}else console.log("Mint "+t.components[o].entity+"not supported")}else{var p=CP({},t.components[o].params||{});if(p.position=e.featurePositionFromParchmint(t.components[o]),"FLOW"===n.type){var y=Oy.makeFeature("Valve3D",p);y.referenceID=t.components[o].id,r.push(y)}else if("CONTROL"===n.type){var m=Oy.makeFeature("Valve3D_control",p);m.referenceID=t.components[o].id,r.push(m)}}}return r}},{key:"loadFeaturesFromConnectionInterchangeV1",value:function(e,t){var n=[],r="Connection",o=rf.getDefaultsForType(r).height;for(var i in e.connections){var a,l,s=e.connections[i];if(t.id==s.layer){var c=String(s.entity||"CHANNEL"),u=c.toUpperCase().includes("ROUND")?1:0,h=s.params||{},f=null===(a=s.paths)||void 0===a||null===(l=a[0])||void 0===l?void 0:l.wayPoints,d=Array.isArray(f)&&f.length>=2?f:Array.isArray(h.wayPoints)&&h.wayPoints.length>=2?h.wayPoints:null;if(d){for(var p=[],y=0;y<d.length-1;y++){var m=d[y],v=d[y+1];!m||!v||m.length<2||v.length<2?console.warn("[3DuF] Connection has a malformed waypoint, skip segment:",s.id,y):p.push([m,v])}if(p.length){var g=d[0],w=d[d.length-1],b={start:[g[0],g[1]],end:[w[0],w[1]],wayPoints:d,segments:p,connectionSpacing:h.connectionSpacing,channelWidth:LP(h),width:LP(h),height:Object.prototype.hasOwnProperty.call(h,"height")?h.height:o,crossSection:Object.prototype.hasOwnProperty.call(h,"crossSection")?h.crossSection:u};try{var _=Oy.makeFeature(r,b);_.referenceID=s.id,n.push(_)}catch(P){console.error("[3DuF] Failed to create Connection feature:",s.id||s.name,P)}}else console.warn("[3DuF] Connection produced zero segments, skip render:",s.id||s.name)}else console.warn("[3DuF] Connection missing path / wayPoints, skip render:",s.id||s.name)}}return n}},{key:"generateMissingLayerFeaturesV1",value:function(e,t,n){var r=[];for(var o in e.components){var i=rf.getTypeForMINT(e.components[o].entity,e.components[o].params);if(null!==i){if("FLOW"==t){var a=rf.library[i];if(void 0!=a&&"FLOW"==a.key){var l=null;for(var s in e.layers)e.layers[s].id==e.components[o].layers[0]&&(l=e.layers[s].group);if(null!==l&&l==n){var c=Oy.makeFeature(i,e.components[o].params);c.referenceID=e.components[o].id,r.push(c)}}}else if(rf.library[i+"_"+t.toLowerCase()]){var u=null;for(var h in e.layers)e.layers[h].id==e.components[o].layers[0]&&(u=e.layers[h].group);if(null!==u&&u==n){var f=Oy.makeFeature(i+"_"+t.toLowerCase(),e.components[o].params);f.referenceID=e.components[o].id,r.push(f)}}}else console.log("Mint "+e.components[o].entity+"not supported")}return r}},{key:"loadConnectionFromInterchangeV1",value:function(e,t){var n=t.name,r=t.id,i=t.entity,a=String(i||"CHANNEL"),l=a.toUpperCase().includes("ROUND")?1:0,s=t.params,c=t.layer?e.getLayer(t.layer):null;if(null===c)for(var u=0;u<e.layers.length;u++)if(e.layers[u].type===o.FLOW){c=e.layers[u];break}if(null===c)throw new Error("Could not find layer with id: "+t.layer);if(i){var h,f,d,p=Array.isArray(t.paths)?t.paths[0]:void 0;if(!Object.prototype.hasOwnProperty.call(s,"start"))null!==p&&void 0!==p&&null!==(h=p.wayPoints)&&void 0!==h&&h[0]?s.start=["Point",p.wayPoints[0][0],p.wayPoints[0][1]]:s.start=[0,0];if(!Object.prototype.hasOwnProperty.call(s,"end"))null!==p&&void 0!==p&&null!==(f=p.wayPoints)&&void 0!==f&&f.length?s.end=p.wayPoints[p.wayPoints.length-1]:s.end=[0,0];if(Object.prototype.hasOwnProperty.call(s,"wayPoints")||(null!==p&&void 0!==p&&p.wayPoints?s.wayPoints=p.wayPoints:s.wayPoints=[[0,0],[1,2]]),!Object.prototype.hasOwnProperty.call(s,"segments"))if(null!==p&&void 0!==p&&null!==(d=p.wayPoints)&&void 0!==d&&d.length){for(var y=[],m=0;m<p.wayPoints.length-1;m++)y[m]=[p.wayPoints[m],p.wayPoints[m+1]];s.segments=y}else s.segments=[[[0,0],[0,0]],[[0,0],[0,0]]];Object.prototype.hasOwnProperty.call(s,"height")||(s.height=rf.getDefaultsForType("Connection").height),Object.prototype.hasOwnProperty.call(s,"crossSection")||(s.crossSection=l)}else{var v;if(null!==(v=t.paths)&&void 0!==v&&v[0]){for(var g=t.paths[0].wayPoints,w=t.params,b=[],_=0;_<g.length-1;_++)b[_]=[g[_],g[_+1]];var P="Connection";s={start:["Point",g[0][0],g[0][1]],end:g[g.length-1],wayPoints:g,segments:b,connectionSpacing:w.connectionSpacing,channelWidth:LP(w),width:LP(w),height:rf.getDefaultsForType(P).height,crossSection:l}}else console.log("Connection missing path description")}var C=Vp.getDefinition("Connection");if(null===C||void 0===C)throw new Error("Could not find the definition for the Connection");var O=new _f(s,Pp.toMap(C.unique),Pp.toMap(C.heritable)),S=new ny(i,O,n,i,c,r);if(Object.prototype.hasOwnProperty.call(t,"source")&&null!==t.source&&void 0!==t.source&&S.setSourceFromJSON(e,t.source),Object.prototype.hasOwnProperty.call(t,"sinks")&&null!==t.sinks&&void 0!==t.sinks)for(var D in t.sinks){var R=t.sinks[D];S.addSinkFromJSON(e,R)}if(Object.prototype.hasOwnProperty.call(t,"paths")&&null!==t.paths&&void 0!==t.paths)for(var T in t.paths)S.addWayPoints(t.paths[T].wayPoints);return S}},{key:"loadComponentFromInterchangeV1",value:function(t){var n,r=t.name,o=t.id,i=rf.normalizeMint(t.entity,t.params);console.log("Entity here:"),console.log(i),null===rf.getComponentWithMINT(i,t.params)?(n=!0,console.log("is custom component")):(n=!1,console.log("is not custom component"));var a,l,s,c=t["x-span"],u=t["y-span"],h=rf.fillMissingHeritableDefaults(t.params,i);if(a=n?rf.getBlackBoxDefinition(c,u,[]):rf.getDefinitionForMINT(i),null===a&&(a=rf.getDefinition("Template"),console.log("Def: ",a)),null===a)throw Error("Could not find definition for type: "+i);for(var f in t.params)Object.prototype.hasOwnProperty.call(a.heritable,f)?l=a.heritable[f]:Object.prototype.hasOwnProperty.call(a.unique,f)&&(l=a.unique[f]),s=t.params[f],"Float"===l&&"string"===typeof s&&(s=parseFloat(s)),h[f]=s;
1n||(h.blackBoxLength=c,h.blackBoxWidth=u,console.log("Params here:"),console.log(h),console.log(c),console.log(u)),Object.prototype.hasOwnProperty.call(h,"position")||(h.position=[0,0]);var d=Pp.toMap(a.unique),p=Pp.toMap(a.heritable),y=new _f(h,d,p),m=new Ep(y,r,i,o),v=new Map;for(var g in t.ports){var w=e.loadComponentPortFromInterchangeV1(t.ports[g]);v.set(w.label,w)}return m.ports=v,console.log("Component here"),console.log(m),m}},{key:"loadComponentPortFromInterchangeV1",value:function(e){var t=o.FLOW;return"FLOW"===e.layer?t=o.FLOW:"CONTROL"===e.layer?t=o.CONTROL:"INTEGRATION"===e.layer&&(t=o.INTEGRATION),new b(e.x,e.y,e.label,t)}},{key:"loadRenderLayerFromInterchangeV1",value:function(t,n){var r;if(Object.prototype.hasOwnProperty.call(t,"type"))if("FLOW"===t.type)r=o.FLOW;else if("CONTROL"===t.type)r=o.CONTROL;else{if("INTEGRATION"!==t.type)throw new Error("Unknown layer type: "+t.type);r=o.INTEGRATION}var i=new rP(t.name,null,r);for(var a in t.features)i.features[t.features[a].id]=e.loadFeatureFromInterchangeV1(t.features[a]);if(t.modellayer)for(var l=0;l<n.layers.length;l++)n.layers[l].id==t.modellayer&&(i.physicalLayer=n.layers[l]);return t.color&&(i.color=t.color),i}},{key:"generateRenderLayerFromLayerInterchangeV1",value:function(t,n){var r;if(Object.prototype.hasOwnProperty.call(t,"type"))if("FLOW"===t.type)r=o.FLOW;else if("CONTROL"===t.type)r=o.CONTROL;else{if("INTEGRATION"!==t.type)throw new Error("Unknown layer type: "+t.type);r=o.INTEGRATION}var i=new rP(t.name,null,r);for(var a in t.features)i.features[t.features[a].id]=e.loadFeatureFromInterchangeV1(t.features[a]);for(var l=0;l<n.layers.length;l++)n.layers[l].id==t.id&&(i.physicalLayer=n.layers[l]);if(Object.prototype.hasOwnProperty.call(t,"type"))if("FLOW"===t.type)i.color="indigo";else if("CONTROL"===t.type)i.color="red";else{if("INTEGRATION"!==t.type)throw new Error("Unknown layer type: "+t.type);i.color="green"}return i}}]),e}();function kP(e,t){var n="undefined"!==typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=EP(e))||t&&e&&"number"===typeof e.length){n&&(e=n);var r=0,o=function(){};return{s:o,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,l=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return a=e.done,e},e:function(e){l=!0,i=e},f:function(){try{a||null==n.return||n.return()}finally{if(l)throw i}}}}function EP(e,t){if(e){if("string"===typeof e)return NP(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?NP(e,t):void 0}}function NP(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function xP(e){return xP="function"===typeof Symbol&&"symbol"===typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"===typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},xP(e)}function MP(e){return JSON.parse(JSON.stringify(e))}function IP(e){if(!e||"object"!==xP(e))return[];var t=[],n=function(e){null!=e&&""!==e&&t.push(String(e))};n(e.id),n(e.name);var r=e.params;return r&&"object"===xP(r)&&(n(r.ID),n(r.id)),t}function WP(e,t){var n=String(t||"");return!!n&&IP(e).includes(n)}function AP(e){if(!e||"object"!==xP(e))return null;try{return MP(e)}catch(t){return null}}function jP(e,t){var n,r=e&&Array.isArray(e.components)?e.components:[],o=kP(r);try{for(o.s();!(n=o.n()).done;){var i=n.value;if(WP(i,t))return i}}catch(a){o.e(a)}finally{o.f()}return null}function BP(e,t){var n,r=e&&Array.isArray(e.connections)?e.connections:[],o=kP(r);try{for(o.s();!(n=o.n()).done;){var i=n.value;if(WP(i,t))return i}}catch(a){o.e(a)}finally{o.f()}return null}function VP(e,t,n){var r=n&&"object"===xP(n)?n:{},o=rf.getDefinitionForMINT(t);if(o&&o.heritable)for(var i in o.heritable)if("position"!==i){var a=r[i];if(null!=a&&""!==a){var l=Number(a);Number.isFinite(l)&&(e[i]=l)}}var s=String(t||"").toUpperCase();if("MUX"===s||"TREE"===s||"YTREE"===s){if(null==r.leafSpace){var c=Number(null!=r.leafPitch?r.leafPitch:r.spacing);Number.isFinite(c)&&c>0&&(e.leafSpace=c)}if(null==r.stageSpace){var u=Number(r.stageLength);Number.isFinite(u)&&u>0&&(e.stageSpace=u)}}if("MUX"===s){if(null==r.valveWidthX){var h=Number(null!=r.valveWidth?r.valveWidth:r.width);Number.isFinite(h)&&h>0&&(e.valveWidthX=h)}if(null==r.valveWidthY){var f=Number(r.length);Number.isFinite(f)&&f>0&&(e.valveWidthY=f)}}return e}function XP(e,t,n){var r=rf.snapshotFactoryDefaultsForMint(e);if(!r)return null;var o={};for(var i in r)if("position"!==i){var a=Number(r[i]);Number.isFinite(a)&&(o[i]=a)}return n&&VP(o,e,t),o}var YP=n("c4e3"),GP=n.n(YP);function UP(e){var t=[];
1t.push(new rP(e.generateNewName("RenderLayerFlow"),e.layers[0],o.FLOW)),t.push(new rP(e.generateNewName("RenderLayerControl"),e.layers[1],o.CONTROL)),t.push(new rP(e.generateNewName("RenderLayerIntegration"),e.layers[0],o.INTEGRATION));for(var n=new Map,r=0;r<e.layers.length;r++)if(n.has(e.layers[r].group)){var i=n.get(e.layers[r].group);i&&n.set(e.layers[r].group,i+1)}else n.set(e.layers[r].group,1);return t}function zP(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function HP(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?zP(Object(n),!0).forEach((function(t){KP(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):zP(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function KP(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function qP(e){return qP="function"===typeof Symbol&&"symbol"===typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"===typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},qP(e)}function JP(e,t){var n="undefined"!==typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=QP(e))||t&&e&&"number"===typeof e.length){n&&(e=n);var r=0,o=function(){};return{s:o,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,l=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return a=e.done,e},e:function(e){l=!0,i=e},f:function(){try{a||null==n.return||n.return()}finally{if(l)throw i}}}}function ZP(e,t){return nC(e)||tC(e,t)||QP(e,t)||$P()}function $P(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function QP(e,t){if(e){if("string"===typeof e)return eC(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?eC(e,t):void 0}}function eC(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function tC(e,t){var n=null==e?null:"undefined"!==typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,i=[],a=!0,l=!1;try{for(n=n.call(e);!(a=(r=n.next()).done);a=!0)if(i.push(r.value),t&&i.length===t)break}catch(s){l=!0,o=s}finally{try{a||null==n["return"]||n["return"]()}finally{if(l)throw o}}return i}}function nC(e){if(Array.isArray(e))return e}function rC(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function oC(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function iC(e,t,n){return t&&oC(e.prototype,t),n&&oC(e,n),e}var aC=new Set(["Valve","Valve3D","Valve3D_control"]),lC=new Set(["position","rotation","gap","valveRadius","width","length"]),sC=function(){function e(){rC(this,e),this.portsOnlyView=!1,this.importedSourceJson=null,this.view=new Ev("c",this),this.__grid=new Iv(this),Pd.currentGrid=this.__grid,this.renderLayers=[],this.nonphysElements=[],this.tools={},this.rightMouseTool=new rg(this),this.__currentDevice=null;var t=this;this.updateQueue=new Uv((function(){t.view.refresh()}),20),this.saveQueue=new Uv((function(){t.saveToStorage()})),this.undoStack=new dw,this.pasteboard=[],this.mouseAndKeyboardHandler=new iw(this),this.view.setResizeFunction((function(){t.updateGrid(),t.updateAlignmentMarks(),t.view.updateRatsNest(),t.view.updateComponentPortsRender(),t.updateDevice(Pd.currentDevice)}));var n=function(e){t.adjustZoom(e.deltaY,t.getEventPosition(e))};this.view.setMouseWheelFunction(n),this.minZoom=1e-4,this.maxZoom=5,this.setupTools();var r=this;$y.get().on($y.UPDATE_RENDERS,(function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;
1r.ensureFeatureExists(e)&&(r.view.updateFeature(e),r.syncConnectionBreaksForFeatureUpdate(e,n),r.refresh(t))})),this.__grid.setColor(id),this.threeD=!1,this.renderer=Pd.threeRenderer,this.currentLayer=this.renderLayers[0],this.activeRenderLayerIndex=0}return iC(e,[{key:"currentDevice",get:function(){return this.__currentDevice}},{key:"initiateCopy",value:function(){var e=this.view.getSelectedFeatures();e.length>0&&(this.pasteboard[0]=e[0])}},{key:"setupToolBars",value:function(){this.resetToDefaultTool()}},{key:"setNameMap",value:function(){for(var e=new Map,t=0;t<this.currentDevice.layers.length;t++){var n=this.currentDevice.layers[t].name.split("_"),r=ZP(n,2),o=r[0],i=r[1];e.has(o)?e.get(o)<i&&e.set(o,parseInt(i)):e.set(o,parseInt(i))}for(var a=0;a<this.currentDevice.connections.length;a++){var l=this.currentDevice.connections[a].name.split("_"),s=ZP(l,2),c=s[0],u=s[1];e.has(c)?e.get(c)<u&&e.set(c,parseInt(u)):e.set(c,parseInt(u))}for(var h=0;h<this.currentDevice.components.length;h++){var f=this.currentDevice.components[h].name.split("_"),d=ZP(f,2),p=d[0],y=d[1];e.has(p)?e.get(p)<y&&e.set(p,parseInt(y)):e.set(p,parseInt(y))}for(var m=0;m<this.renderLayers.length;m++){var v=this.renderLayers[m].name.split("_"),g=ZP(v,2),w=g[0],b=g[1];e.has(w)?e.get(w)<b&&e.set(w,parseInt(b)):e.set(w,parseInt(b))}this.currentDevice.nameMap=e}},{key:"addDevice",value:function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];this.view.addDevice(e),this.__addAllDeviceLayers(e,!1),this.refresh(t)}},{key:"__addAllDeviceLayers",value:function(e){for(var t=0;t<e.layers.length;t++){var n=e.layers[t];this.addLayer(n,t,!1)}}},{key:"__removeAllDeviceLayers",value:function(e){for(var t=0;t<e.layers.length;t++){var n=e.layers[t];this.removeLayer(n,t,!1)}}},{key:"removeDevice",value:function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];this.view.removeDevice(),this.__removeAllDeviceLayers(e,!1),this.refresh(t)}},{key:"updateDevice",value:function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];this.view.updateDevice(e),this.refresh(t)}},{key:"addFeature",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.activeRenderLayerIndex,n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],r=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];this.renderLayers[t].addFeature(e,n),this.ensureFeatureExists(e)&&(this.view.addFeature(e),this.refresh(r))}},{key:"getNonphysElementFromFeatureID",value:function(e){for(var t in this.nonphysElements){var n=this.nonphysElements[t];for(var r in n.featureIDs)if(n.featureIDs[r]===e)return n}return null}},{key:"updateFeature",value:function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];this.ensureFeatureExists(e)&&(this.view.updateFeature(e),this.refresh(t))}},{key:"removeFeature",value:function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],n=this.getRenderLayerByID(e.ID);this.ensureFeatureExists(e)&&(this.view.removeFeature(e),this.refresh(t)),n.removeFeatureByID(e.ID)}},{key:"removeFeatureByID",value:function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],n=this.getRenderLayerByID(e),r=n.getFeature(e);this.ensureFeatureExists(r)&&(this.view.removeFeature(r),this.refresh(t)),n.removeFeatureByID(e)}},{key:"addLayer",value:function(e,t){var n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.__isLayerInCurrentDevice(e)&&(this.view.addLayer(e,t),this.__addAllLayerFeatures(e,t,!1),this.refresh(n))}},{key:"createNewLayerBlock",value:function(){var e,t,n,r,i,a,l;if(null===this.__currentDevice)throw new Error("No device set on ViewManager");var s=this.__currentDevice.layers.length;0!=s&&(s/=3);var c=[];c[0]=new Sf({z_offset:0,flip:!1},null===(e=this.currentDevice)||void 0===e?void 0:e.generateNewName("LayerFlow"),o.FLOW,s.toString()),c[1]=new Sf({z_offset:0,flip:!1},null===(t=this.currentDevice)||void 0===t?void 0:t.generateNewName("LayerControl"),o.CONTROL,s.toString()),c[2]=new Sf({z_offset:0,flip:!1},null===(n=this.currentDevice)||void 0===n?void 0:n.generateNewName("LayerIntegration"),o.INTEGRATION,s.toString()),this.__currentDevice.createNewLayerBlock(c);var u,h=[],f=null===(r=Pd.currentDevice)||void 0===r?void 0:r.layers[0].features;for(var d in f)u=f[d],"EDGE"===u.fabType&&h.push(u);for(var p in c)for(var y in h)c[p].addFeature(h[y]);for(var m in c){var v=c[m],g=this.view.paperLayers.length;this.addLayer(v,g,!0)}for(var w in this.renderLayers[this.renderLayers.length]=new rP(null===(i=this.currentDevice)||void 0===i?void 0:i.generateNewName("Ren
1derLayerFlow"),c[0],o.FLOW),this.renderLayers[this.renderLayers.length]=new rP(null===(a=this.currentDevice)||void 0===a?void 0:a.generateNewName("RenderLayerControl"),c[1],o.CONTROL),this.renderLayers[this.renderLayers.length]=new rP(null===(l=this.currentDevice)||void 0===l?void 0:l.generateNewName("RenderLayerIntegration"),c[2],o.INTEGRATION),h)this.renderLayers[this.renderLayers.length-3].addFeature(h[w]),this.renderLayers[this.renderLayers.length-2].addFeature(h[w]),this.renderLayers[this.renderLayers.length-1].addFeature(h[w]);console.log("Active Layer",this.activeRenderLayerIndex),this.setActiveRenderLayer(this.renderLayers.length-3)}},{key:"deleteLayerBlock",value:function(e){var t,n,r;null===(t=Pd.currentDevice)||void 0===t||t.deleteLayer(3*e),null===(n=Pd.currentDevice)||void 0===n||n.deleteLayer(3*e),null===(r=Pd.currentDevice)||void 0===r||r.deleteLayer(3*e),this.renderLayers.splice(3*e,3),this.activeRenderLayerIndex>3*e+2?this.setActiveRenderLayer(this.activeRenderLayerIndex-3):this.activeRenderLayerIndex<3*e?console.log("No change"):0==e?0==this.renderLayers.length?this.setActiveRenderLayer(e):this.setActiveRenderLayer(0):this.setActiveRenderLayer(3*(e-1)),this.view.removeLayer(3*e),this.view.removeLayer(3*e),this.view.removeLayer(3*e),this.updateActiveLayer(),this.refresh()}},{key:"setActiveRenderLayer",value:function(e){this.activeRenderLayerIndex=e,this.currentLayer=this.renderLayers[e],this.updateActiveLayer(),this.refreshValveCrossLayerOpacity(),$y.get().emit($y.ACTIVE_RENDER_LAYER_CHANGED),this.portsOnlyView&&this.view.applyPortsOnlyVisibility(!0)}},{key:"setPortsOnlyView",value:function(e){this.portsOnlyView=Boolean(e),this.view.applyPortsOnlyVisibility(this.portsOnlyView),this.refresh(!0),$y.get().emit($y.PORTS_ONLY_VIEW_CHANGED,this.portsOnlyView)}},{key:"resetPortsOnlyView",value:function(){this.portsOnlyView=!1,$y.get().emit($y.PORTS_ONLY_VIEW_CHANGED,!1)}},{key:"refreshValveCrossLayerOpacity",value:function(){var e=this.currentDevice;if(e){var t,n=!1,r=JP(e.getAllFeaturesFromDevice());try{for(r.s();!(t=r.n()).done;){var o=t.value,i=o.getType();"Valve"!==i&&"Valve3D_control"!==i&&"Valve3D"!==i||this.ensureFeatureExists(o)&&(this.view.updateFeature(o),n=!0)}}catch(a){r.e(a)}finally{r.f()}n&&this.refresh(!1)}}},{key:"removeLayer",value:function(e,t){var n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.__isLayerInCurrentDevice(e)&&(this.view.removeLayer(t),this.__removeAllLayerFeatures(e),this.refresh(n))}},{key:"layersToSVGStrings",value:function(){return this.view.layersToSVGStrings()}},{key:"exportSVGString",value:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return this.view.captureSVGString(e)}},{key:"__addAllLayerFeatures",value:function(e,t){var n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];for(var r in e.features){var o=e.features[r];this.addFeature(o,t,!1),this.refresh(n)}}},{key:"__updateAllLayerFeatures",value:function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];for(var n in e.features){var r=e.features[n];this.updateFeature(r,!1),this.refresh(t)}}},{key:"__removeAllLayerFeatures",value:function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];for(var n in e.features){var r=e.features[n];this.removeFeature(r,!1),this.refresh(t)}}},{key:"updateLayer",value:function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];this.__isLayerInCurrentDevice(e)&&this.refresh(t)}},{key:"updateActiveLayer",value:function(){var e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];null!==this.activeRenderLayerIndex?(this.view.setActiveLayer(this.activeRenderLayerIndex),this.refresh(e)):console.warn("Attempting update active layer in view manager with no active layer value")}},{key:"removeGrid",value:function(){var e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];this.__hasCurrentGrid()&&(this.view.removeGrid(),this.refresh(e))}},{key:"updateGrid",value:function(){var e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];this.__hasCurrentGrid()&&(this.view.updateGrid(Pd.currentGrid),this.refresh(e),$y.get().emit($y.UPDATE_GRID_SIZE))}},{key:"updateAlignmentMarks",value:function(){this.view.updateAlignmentMarks()}},{key:"clear",value:function(){this.view.clear()}},{key:"setZoom",value:function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];e>this.maxZoom?e=this.maxZoom:e<this.minZoom&&(e=this.minZoom),this.view.setZoom(e),this.updateGrid(!1),this.updateAlignmentMarks(),this.view.updateRatsNest(),this.view.updateComponentPortsRender(),this.updateDevice(Pd.currentDevice,!1),this.__updateViewTarget(!1),this.refresh(t)}},{key:"generateBorder",value:function(){var e,t,n=new gm(null,new _f({},new Map,new Map)),r=null===(e=Pd.currentDevice)||void 0===e?void 0:e.getXSpan(),o=null===(t=Pd.currentDevice)||void 0===t?void 0:t.getYSpan();
1for(var i in n.generateRectEdge(r,o),Pd.currentDevice.layers){var a=Pd.currentDevice.layers[i];a.addFeature(n)}}},{key:"importBorder",value:function(e){var t,n,r,o,i=new gm(null,new _f({},new Map,new Map));for(var a in e.entities){var l=new ff(e.entities[a]);i.addDXFObject(l)}if(null===Pd.currentDevice)throw new Error("No device selected");for(var s in Pd.currentDevice.layers){var c=Pd.currentDevice.layers[s];c.addFeature(i)}var u=this.view.getRenderedFeature(i.ID).bounds;null===(t=Pd.currentDevice)||void 0===t||t.setXSpan(u.width),null===(n=Pd.currentDevice)||void 0===n||n.setYSpan(u.height),null===(r=Pd.viewManager)||void 0===r||r.view.initializeView(),null===(o=Pd.viewManager)||void 0===o||o.view.refresh()}},{key:"deleteBorder",value:function(){var e;console.log("Deleting border...");var t=null===(e=Pd.currentDevice)||void 0===e?void 0:e.getAllFeaturesFromDevice();console.log("All features",t);var n=[];if(void 0===t)throw new Error("No features found");for(var r in t)"EDGE"===t[r].fabType&&n.push(t[r]);for(var o in n)this.removeFeatureByID(n[o].ID);console.log("Edgefeatures",n)}},{key:"removeTarget",value:function(){this.view.clearTargetState()}},{key:"updateTarget",value:function(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,o=!(arguments.length>4&&void 0!==arguments[4])||arguments[4];this.view.addTarget(e,t,n,r),this.view.updateAlignmentMarks(),this.view.updateRatsNest(),this.refresh(o)}},{key:"__updateViewTarget",value:function(){var e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];this.view.updateTarget(),this.updateAlignmentMarks(),this.view.updateRatsNest(),this.view.updateComponentPortsRender(),this.refresh(e)}},{key:"adjustZoom",value:function(e,t){var n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],r=this.view.getZoom()>=this.maxZoom&&e<0,o=this.view.getZoom()<=this.minZoom&&e>0;o||r||(this.view.adjustZoom(e,new y.a.Point(t)),this.updateGrid(!1),this.view.updateRatsNest(),this.view.updateComponentPortsRender(),this.updateDevice(Pd.currentDevice,!1),this.__updateViewTarget(!1)),this.refresh(n)}},{key:"setCenter",value:function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];this.view.setCenter(e),this.updateGrid(!1),this.updateDevice(Pd.currentDevice,!1),this.refresh(t)}},{key:"moveCenter",value:function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];this.view.moveCenter(e),this.updateGrid(!1),this.view.updateRatsNest(),this.view.updateComponentPortsRender(),this.updateDevice(Pd.currentDevice,!1),this.refresh(t)}},{key:"saveToStorage",value:function(){if(Pd.viewManager)try{localStorage.setItem("currentDevice",JSON.stringify(Pd.viewManager.generateExportJSON()))}catch(e){}}},{key:"refresh",value:function(){var e;this.updateQueue.run();null===(e=Pd.currentGrid)||void 0===e||e.getSpacing()}},{key:"getEventPosition",value:function(e){return this.view.getProjectPosition(e.clientX,e.clientY)}},{key:"__hasCurrentGrid",value:function(){return!!Pd.currentGrid}},{key:"__isLayerInCurrentDevice",value:function(e){return!(!Pd.currentDevice||e.device!==Pd.currentDevice)}},{key:"isFeatureInCurrentDevice",value:function(e){return!(!Pd.currentDevice||!this.__isLayerInCurrentDevice(e.layer))}},{key:"ensureFeatureExists",value:function(e){for(var t=0;t<this.renderLayers.length;t++)if(this.renderLayers[t].containsFeature(e))return!0;return!1}},{key:"loadDeviceFromJSON",value:function(e){var t,n,r=this;try{tw()}catch(v){try{this.deactivateComponentPlacementTool()}catch(g){this.resetToDefaultTool()}try{this.tools&&this.tools.MoveTool&&this.tools.MoveTool.deactivate()}catch(w){}this.removeTarget();try{this.view.clearSelectedItems()}catch(b){}}this.importedSourceJson=AP(e),this.resetPortsOnlyView(),null===(t=Pd.viewManager)||void 0===t||t.clear(),this.renderLayers=[],this.activeRenderLayerIndex=0,this.__currentDevice=null;var o=e.version;e.params&&"object"===qP(e.params)||(e.params={width:135e3,length:85e3});var i=null!=e.params["x-span"]?e.params["x-span"]:e.params.width,a=null!=e.params["y-span"]?e.params["y-span"]:e.params.length;e.params=HP(HP({},e.params),{},{width:null!=i?i:135e3,length:null!=a?a:85e3}),delete e.params["x-span"],delete e.params["y-span"],Array.isArray(e.components)||(e.components=[]);var l,s=JP(e.components);try{for(s.s();!(l=s.n()).done;){var c=l.value,u=String(rf.getTypeForMINT(c.entity,c.params));"Node"===u&&(c["x-span"]=0,c["y-span"]=0)}}catch(_){s.e(_)}finally{s.f()}if(requestAnimationFrame((function(){r.view.updateComponentPortsRender()})),null===o||void 0===o||"1"===o||"1.1"==o||"1.2"==o){var h=FP.loadFromScratch(e);
1n=h[0],Pd.currentDevice=n,this.__currentDevice=n,n.syncComponentPositionsToFeatures(),this.renderLayers=h[1],this.setNameMap()}else if("1.1"==o)for(var f in n=Oy.fromInterchangeV1_1(e),Pd.currentDevice=n,this.__currentDevice=n,n.syncComponentPositionsToFeatures(),e.layers){var d=rP.fromInterchangeV1(e.renderLayers[f]);this.renderLayers.push(d)}else alert("Version '"+o+"' is not supported by 3DuF !");if(this.currentLayer=this.renderLayers[0],this.activeRenderLayerIndex=0,this.addDevice(Pd.currentDevice),this.__initializeRatsNest(),this.reapplyValveConnectionBreaks(),this.logImportedDeviceDiagnostics(e),this.view.initializeView(),this.updateGrid(),this.updateDevice(Pd.currentDevice),this.refresh(!0),this.currentLayer=this.renderLayers[0],this.updateActiveLayer(),"undefined"!==typeof window&&"function"===typeof window.dispatchEvent&&window.dispatchEvent(new CustomEvent("threeduf-device-loaded")),console.log(e.version),null!==this.__currentDevice&&(console.log("version: ",e.version),"1"==e.version||"1.1"==e.version))for(var p in this.__currentDevice.components){var y=this.__currentDevice.components[p].getBoundingRectangle(),m=this.__currentDevice.components[p].getPosition();this.__currentDevice.components[p].updateComponentPosition([m[0]+(m[0]-y.x),m[1]+(m[1]-y.y)])}}},{key:"snapImportedConnectionTerminals",value:function(){var e=this.currentDevice;if(e){var t,n=JP(e.connections);try{for(n.s();!(t=n.n()).done;){var r=t.value;try{r.snapImportedTerminals()}catch(o){console.warn("Could not snap connection terminals during JSON load:",r.id,o)}}}catch(o){n.e(o)}finally{n.f()}}}},{key:"reapplyValveConnectionBreaks",value:function(){var e=this.currentDevice;if(e){this.ensureValveFlowFeatures(),this.ensureValveControlFeatures(),this.ensureValveComponentsFromLooseFeatures();var t,n=JP(e.connections);try{for(n.s();!(t=n.n()).done;){var r=t.value;try{this.updatesConnectionRender(r)}catch(o){console.warn("Could not re-apply valve gap for connection during JSON load:",r.id,o)}}}catch(o){n.e(o)}finally{n.f()}}}},{key:"logImportedDeviceDiagnostics",value:function(e){var t=this.currentDevice,n="[3DuF import]";if(t){var r,o=t.connections||[],i=t.components||[],a=o.filter((function(e){return!e.routed})).map((function(e){return e.id||e.name})),l={},s=JP(i);try{for(s.s();!(r=s.n()).done;){var c=r.value,u=String(c.mint||"UNKNOWN");l[u]=(l[u]||0)+1}}catch(D){s.e(D)}finally{s.f()}var h=[],f=o.map((function(e){var t,n,r,o=null,i=null,a=0;try{var l=e.getValue("wayPoints");Array.isArray(l)&&l.length&&(o=l[0],i=l[l.length-1])}catch(d){}try{var s=e.getValue("segments");a=Array.isArray(s)?s.length:0}catch(p){a=0}var c=e.featureIDs?e.featureIDs.length:0;0!==c&&0!==a||h.push(String(e.id||e.name));var u=e.source?(null===(t=e.source.component)||void 0===t?void 0:t.id)||(null===(n=e.source.component)||void 0===n?void 0:n.name):null,f=(e.sinks||[]).map((function(e){var t,n;return(null===(t=e.component)||void 0===t?void 0:t.id)||(null===(n=e.component)||void 0===n?void 0:n.name)}));return{id:e.id,name:e.name,layer:null===(r=e.layer)||void 0===r?void 0:r.id,routed:e.routed,features:c,segments:a,start:o,end:i,source:u,sinks:f}}));console.groupCollapsed("".concat(n," ").concat(e.name||t.name)),console.log("components by entity",l),console.log("connections",f),a.length&&console.warn(n,"unrouted connections (will show as rats-nest, not a solid pipe):",a),h.length&&console.error(n,"connections with no feature or no segments (pipe will not render):",h);var d,p=JP(i);try{for(p.s();!(d=p.n()).done;){var y=d.value,m=String(y.mint||"").toUpperCase();if("PORT"===m||"VALVE3D"===m){var v=null;try{v=y.getValue("position")}catch(R){v=null}var g=[];if(v&&v.length>=2){var w,b=JP(o);try{for(b.s();!(w=b.n()).done;){var _=w.value,P=[];try{P=_.getValue("wayPoints")||[]}catch(T){P=[]}var C,O=JP(P);try{for(O.s();!(C=O.n()).done;){var S=C.value;if(Array.isArray(S)&&Math.abs(Number(S[0])-Number(v[0]))<1&&Math.abs(Number(S[1])-Number(v[1]))<1){g.push(String(_.id||_.name));break}}}catch(D){O.e(D)}finally{O.f()}}}catch(D){b.e(D)}finally{b.f()}}g.length||"PORT"!==m||console.warn(n,"PORT position does not sit on any connection waypoint (looks disconnected):",y.id||y.name,v)}}}catch(D){p.e(D)}finally{p.f()}console.groupEnd()}else console.error(n,"no device after load")}},{key:"ensureValveFlowFeatures",value:function(){var e=this,t=this.currentDevice;if(t){var n,r=JP(t.components);try{var i=function(){var r=n.value;if("VALVE3D"!==r.mint)return"continue";var i,a=[],l=JP(r.featureIDs);try{for(l.s();!(i=l.n()).done;){var s=i.value;try{a.push(t.getFeatureByID(s))}catch(y){continue}}}catch(m){l.e(m)}finally{l.f()}var c=a.some((function(e){var t;return"Valve3D"===e.getType()&&(null===(t=e.layer)||void 0===t?void 0:t.type)===o.FLOW}));if(c)return"continue";
1var u=a.find((function(e){return("Valve3D_control"===e.getType()||"Valve3D"===e.getType())&&null!==e.layer}));if(!u||!u.layer)return"continue";var h=e.renderLayers.find((function(e){return e.type===o.FLOW&&null!==e.physicalLayer&&e.physicalLayer.group===u.layer.group}));if(!h)return"continue";var f={position:u.getValue("position"),rotation:u.getValue("rotation"),componentSpacing:u.getValue("componentSpacing"),valveRadius:u.getValue("valveRadius"),height:u.getValue("height"),gap:u.getValue("gap"),width:u.getValue("width"),length:u.getValue("length")},d=Oy.makeFeature("Valve3D",f);d.referenceID=r.id;var p=e.renderLayers.indexOf(h);p>=0&&(e.addFeature(d,p,!0,!1),r.addFeatureID(d.ID))};for(r.s();!(n=r.n()).done;)i()}catch(a){r.e(a)}finally{r.f()}}}},{key:"ensureValveControlFeatures",value:function(){var e=this,t=this.currentDevice;if(t){var n,r=JP(t.layers);try{var i=function(){var r=n.value;if(r.type!==o.FLOW)return"continue";var i=t.layers.find((function(e){return e.type===o.CONTROL&&e.group===r.group}));if(!i)return"continue";var a=e.renderLayers.find((function(e){return e.type===o.CONTROL&&null!==e.physicalLayer&&e.physicalLayer.id===i.id}));if(!a)return"continue";var l=r.getAllFeaturesFromLayer(),s=function(n){var r=l[n];if("Valve3D"!==r.getType())return"continue";var o=r.getValue("position"),s=Number(r.getValue("rotation")),c=r.referenceID,u=Object.values(i.getAllFeaturesFromLayer()).some((function(e){if("Valve3D_control"!==e.getType())return!1;if(c&&e.referenceID===c)return!0;var t=e.getValue("position"),n=Number(e.getValue("rotation"));return t&&t[0]===o[0]&&t[1]===o[1]&&n===s}));if(u)return"continue";var h={position:r.getValue("position"),rotation:r.getValue("rotation"),componentSpacing:r.getValue("componentSpacing"),valveRadius:r.getValue("valveRadius"),height:r.getValue("height"),gap:r.getValue("gap"),width:r.getValue("width"),length:r.getValue("length")},f=Oy.makeFeature("Valve3D_control",h);f.referenceID=c;var d=e.renderLayers.indexOf(a);if(d>=0&&(e.addFeature(f,d,!0,!1),c)){var p=t.getComponentByID(c);p&&p.addFeatureID(f.ID)}};for(var c in l)s(c)};for(r.s();!(n=r.n()).done;)i()}catch(a){r.e(a)}finally{r.f()}}}},{key:"findNearestConnectionForValvePoint",value:function(e,t){if(!this.currentDevice)return null;var n,r=new y.a.Point(e[0],e[1]),i=null,a=Number.POSITIVE_INFINITY,l=JP(this.currentDevice.connections);try{for(l.s();!(n=l.n()).done;){var s=n.value;if(s.layer&&s.layer.group===t&&s.layer.type!==o.CONTROL){var c=s.getValue("segments");if(Array.isArray(c)){var u,h=JP(c);try{for(h.s();!(u=h.n()).done;){var f=u.value,d=new y.a.Path.Line(new y.a.Point(f[0][0],f[0][1]),new y.a.Point(f[1][0],f[1][1])),p=d.getNearestPoint(r),m=p.getDistance(r);d.remove(),m<a&&(a=m,i=s)}}catch(v){h.e(v)}finally{h.f()}}}}}catch(v){l.e(v)}finally{l.f()}return i}},{key:"ensureValveComponentsFromLooseFeatures",value:function(){var e=this,t=this.currentDevice;if(t){var n,r=JP(t.layers);try{var a=function(){var r=n.value;if(r.type!==o.FLOW)return"continue";var a=t.layers.find((function(e){return e.type===o.CONTROL&&e.group===r.group})),l=r.getAllFeaturesFromLayer();for(var s in l){var c=l[s];if("Valve3D"===c.getType()&&null===c.referenceID){var u=c.getValue("position"),h=Number(c.getValue("rotation")),f=null;if(a)for(var d in a.getAllFeaturesFromLayer()){var p=a.getAllFeaturesFromLayer()[d];if("Valve3D_control"===p.getType()&&null===p.referenceID){var y=p.getValue("position"),m=Number(p.getValue("rotation"));if(y&&y[0]===u[0]&&y[1]===u[1]&&m===h){f=p;break}}}var v=rf.getDefinition("Valve3D_control")||rf.getDefinition("Valve3D");if(v){var g={},w=c.getParams();for(var b in w)g[b]=w[b].value;g.position=[0,0];var _=new _f(g,Pp.toMap(v.unique),Pp.toMap(v.heritable)),P=rf.generateID(),C=new Ep(_,t.generateNewName("Valve3D"),v.mint,P);C.addFeatureID(c.ID),c.referenceID=P,f&&(C.addFeatureID(f.ID),f.referenceID=P),C.setInitialOffset(),C.updateComponentPosition(u),t.addComponent(C);var O=e.findNearestConnectionForValvePoint(u,r.group);O&&t.insertValve(C,O,i.NORMALLY_CLOSED)}}}};for(r.s();!(n=r.n()).done;)a()}catch(l){r.e(l)}finally{r.f()}}}},{key:"removeFeaturesByPaperElements",value:function(e){if(e.length>0){for(var t=0;t<e.length;t++){var n=e[t];this.removeFeatureByID(n.featureID)}this.currentSelection=[]}}},{key:"updateComponentParameters",value:function(e,t){var n,r=null===(n=this.__currentDevice)||void 0===n?void 0:n.getComponentByName(e);for(var o in t)null===r||void 0===r||r.updateParameter(o,t[o])}}
1,{key:"snapToGrid",value:function(e){if(Pd.currentGrid){var t=Pd.currentGrid.getClosestGridPoint(new y.a.Point(e[0],e[1]));return[t.x,t.y]}return e}},{key:"getFeaturesOfType",value:function(e,t){for(var n=[],r=0;r<t.length;r++){var o=t[r];o.getType()===e&&n.push(o)}return n}},{key:"adjustAllFeatureParams",value:function(e,t,n){for(var r=0;r<n.length;r++){var o=n[r];o.updateParameter(e,t)}}},{key:"adjustParams",value:function(e,t,n){var r=this.view.getSelectedFeatures();if(r.length>0){var o=this.getFeaturesOfType(e,r);for(var i in o.length>0&&this.adjustAllFeatureParams(t,n,o),this.view.selectedComponents)this.view.selectedComponents[i].updateParameter(t,n);for(var a in this.view.selectedConnections)this.view.selectedConnections[a].updateParameter(t,n)}else this.updateDefault(e,t,n)}},{key:"updateDefault",value:function(e,t,n){var r=rf.getDefaultsForType(e);r[t]=n}},{key:"updateDefaultsFromFeature",value:function(e){var t=e.getHeritableParams();for(var n in t)this.updateDefault(e.getType(),n,e.getValue(n))}},{key:"revertFieldToDefault",value:function(e,t){t.updateParameter(e,rf.getDefaultsForType(t.getType())[e])}},{key:"revertFeatureToDefaults",value:function(e){var t=e.getHeritableParams();for(var n in t)this.revertFieldToDefault(n,e)}},{key:"revertFeaturesToDefaults",value:function(e){var t,n=JP(e);try{for(n.s();!(t=n.n()).done;){var r=t.value;this.revertFeatureToDefaults(r)}}catch(o){n.e(o)}finally{n.f()}}},{key:"hitFeature",value:function(e){return this.view.hitFeature(e)}},{key:"getFeatureByID",value:function(e){var t=this.getRenderLayerByID(e);return t.getFeature(e)}},{key:"getRenderLayerByID",value:function(e){for(var t=0;t<this.renderLayers.length;t++){var n=this.renderLayers[t];if(n.containsFeatureID(e))return n}throw new Error("FeatureID "+e+" not found in any renderLayer.")}},{key:"hitFeaturesWithViewElement",value:function(e){return this.view.hitFeaturesWithViewElement(e)}},{key:"activateTool",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"SelectTool";if(null===this.tools[e])throw new Error("Could not find tool with the matching string");this.view.clearSelectedItems(),this.mouseAndKeyboardHandler.leftMouseTool=this.tools[e],this.mouseAndKeyboardHandler.rightMouseTool=this.tools[t],this.mouseAndKeyboardHandler.updateViewMouseEvents()}},{key:"switchTo2D",value:function(){if(null===Pd.currentDevice)throw new Error("No device selected");if(this.threeD){this.threeD=!1;var e=this.renderer.getCameraCenterInMicrometers(),t=this.renderer.getZoom(),n=e[0];n<0?n=0:n>Pd.currentDevice.getXSpan()&&(n=Pd.currentDevice.getXSpan());var r=y.a.view.center.y-e[1];r<0?r=0:r>Pd.currentDevice.getYSpan()&&(r=Pd.currentDevice.getYSpan()),Pd.viewManager.setCenter(new y.a.Point(n,r)),Pd.viewManager.setZoom(t)}}},{key:"switchTo3D",value:function(){if(!this.threeD){this.threeD=!0,this.renderer.loadJSON(Pd.currentDevice.toJSON());var e=this.view.getViewCenterInMillimeters(),t=Pd.currentDevice.params.getValue("height")/1e3,n=this.view.getDeviceHeightInPixels();this.renderer.setupCamera(e[0],e[1],t,n,y.a.view.zoom),this.renderer.showMockup(),Bg(this.__renderBlock,"hidden-block"),Vg(this.__canvasBlock,"hidden-block"),Vg(this.__renderBlock,"shown-block"),Bg(this.__canvasBlock,"shown-block")}}},{key:"setupDragAndDropLoad",value:function(e){Xg(e,(function(e){var t=e[0],n=new FileReader;n.onloadend=function(e){var t,n=this.result,r=JSON.parse(n);null===(t=Pd.viewManager)||void 0===t||t.loadDeviceFromJSON(r)};try{n.readAsText(t)}catch(r){console.log("unable to load JSON: "+t)}}))}},{key:"killParamsWindow",value:function(){var e,t=document.getElementById("parameter_menu");t&&(null===(e=t.parentElement)||void 0===e||e.removeChild(t))}},{key:"saveDeviceState",value:function(){var e;console.log("Saving to stack");var t=JSON.stringify(null===(e=Pd.currentDevice)||void 0===e?void 0:e.toInterchangeV1([]));this.undoStack.pushDesign(t)}},{key:"undo",value:function(){var e=this.undoStack.popDesign();if(console.log(e),e){var t=JSON.parse(e);this.loadDeviceFromJSON(t)}}},{key:"resetToDefaultTool",value:function(){this.cleanupActiveTools(),this.activateTool("MouseSelectTool")}},{key:"cleanupActiveTools",value:function(){this.mouseAndKeyboardHandler.leftMouseTool&&this.mouseAndKeyboardHandler.leftMouseTool.cleanup(),this.mouseAndKeyboardHandler.rightMouseTool&&this.mouseAndKeyboardHandler.rightMouseTool.cleanup()}},{key:"valveGlyphCenter",value:function(e,t){var n=t.getValue("position");return new y.a.Point(Number(n[0]),Number(n[1]))}},{key:"getValveFlowClipRect",value:function(e){if(!this.currentDevice)return null;var t,n=JP(e.featureIDs);try{for(n.s();!(t=n.n()).done;){var r=t.value,i=void 0;try{i=this.currentDevice.getFeatureByID(r)}catch(l){continue}if(i.layer&&i.layer.type===o.FLOW&&("Valve3D"===i.getType()||"Valve3D_control"
1===i.getType())){var a=this.valveGlyphCenter(e,i);return qd([a.x,a.y],i.getValue("valveRadius"),i.getValue("gap"),i.getValue("rotation"))}}}catch(s){n.e(s)}finally{n.f()}try{return qd(e.getValue("position"),e.getValue("valveRadius"),e.getValue("gap"),e.getValue("rotation"))}catch(c){return null}}},{key:"getValveFlowGapPath",value:function(e,t){if(!this.currentDevice)return null;var n,r=JP(e.featureIDs);try{for(r.s();!(n=r.n()).done;){var i=n.value,a=this.currentDevice.getFeatureByID(i);if(a.layer&&a.layer.type===o.FLOW&&("Valve3D"===a.getType()||"Valve3D_control"===a.getType())){var l=a.getValue("valveRadius"),s=a.getValue("gap"),c=a.getValue("rotation"),u=0;if(t)try{var h=Number(t.getValue("channelWidth"));Number.isFinite(h)&&h>0&&(u=h/2)}catch(p){u=0}var f=this.valveGlyphCenter(e,a),d=new y.a.Path.Rectangle({from:new y.a.Point(f.x-l,f.y-s/2-u),to:new y.a.Point(f.x+l,f.y+s/2+u)});return d.rotate(c,f),d}}}catch(m){r.e(m)}finally{r.f()}return null}},{key:"getValveFlowGapInfo",value:function(e){if(!this.currentDevice)return null;var t,n=JP(e.featureIDs);try{for(n.s();!(t=n.n()).done;){var r=t.value,i=this.currentDevice.getFeatureByID(r);if(i.layer&&i.layer.type===o.FLOW&&("Valve3D"===i.getType()||"Valve3D_control"===i.getType())){var a=Number(i.getValue("rotation")),l=Number(i.getValue("gap"));return!Number.isFinite(a)||!Number.isFinite(l)||l<=0?null:{center:this.valveGlyphCenter(e,i),rotation:a,gap:l}}}}catch(s){n.e(s)}finally{n.f()}return null}},{key:"insertGapByProjectionInfo",value:function(e,t){var n=e.getValue("segments");if(!Array.isArray(n)||0===n.length)return!1;var r=t.rotation*Math.PI/180,o=new y.a.Point(Math.sin(r),Math.cos(r)),i=0;try{var a=Number(e.getValue("channelWidth"));Number.isFinite(a)&&a>0&&(i=a)}catch(Y){i=0}for(var l=t.gap/2+i/2,s=-1,c=Number.POSITIVE_INFINITY,u=new y.a.Point(0,0),h=new y.a.Point(0,0),f=new y.a.Point(0,0),d=0;d<n.length;d++){var p=n[d],m=new y.a.Point(p[0][0],p[0][1]),v=new y.a.Point(p[1][0],p[1][1]),g=v.subtract(m),w=g.dot(g);if(0!==w){var b=t.center.subtract(m).dot(g)/w;b=Math.max(0,Math.min(1,b));var _=m.add(g.multiply(b)),P=_.getDistance(t.center);P<c&&(c=P,s=d,u=m,h=v,f=_)}}if(s<0)return!1;var C=f.subtract(o.multiply(l)),O=f.add(o.multiply(l)),S=h.subtract(u),D=S.dot(S);if(0===D)return!1;var R=function(e){var t=e.subtract(u).dot(S)/D;return t=Math.max(0,Math.min(1,t)),u.add(S.multiply(t))},T=R(C),L=R(O),F=u.getDistance(T),k=h.getDistance(L),E=u.getDistance(L),N=h.getDistance(T),x=T,M=L;F+k>E+N&&(x=L,M=T);var I=[Math.round(u.x),Math.round(u.y)],W=[Math.round(h.x),Math.round(h.y)],A=[Math.round(x.x),Math.round(x.y)],j=[Math.round(M.x),Math.round(M.y)];if(I[0]===A[0]&&I[1]===A[1]||W[0]===j[0]&&W[1]===j[1])return!1;var B=[I,A],V=[W,j],X=n.slice();return X.splice(s,1,B,V),e.updateSegments(X),!0}},{key:"insertValveGapByProjection",value:function(e,t){var n=this.getValveFlowGapInfo(t);return!!n&&this.insertGapByProjectionInfo(e,n)}},{key:"getUnmappedFlowValveFeaturesForConnection",value:function(e){var t=[];if(!e.layer)return t;var n=e.layer.getAllFeaturesFromLayer();for(var r in n){var o=n[r];null===o.referenceID&&("Valve3D"!==o.getType()&&"Valve3D_control"!==o.getType()||t.push(o))}return t}},{key:"getGapInfoFromValveFeature",value:function(e){var t=e.getValue("position"),n=Number(e.getValue("rotation")),r=Number(e.getValue("gap"));return!t||!Number.isFinite(n)||!Number.isFinite(r)||r<=0?null:{center:new y.a.Point(t[0],t[1]),rotation:n,gap:r}}},{key:"findMappedConnectionForValve",value:function(e){if(!this.currentDevice)return null;var t,n=JP(this.currentDevice.connections);try{for(n.s();!(t=n.n()).done;){var r=t.value,o=this.currentDevice.getValvesForConnection(r);if(o.some((function(t){return t.id===e.id})))return r}}catch(i){n.e(i)}finally{n.f()}return null}},{key:"syncConnectionBreaksForFeatureUpdate",value:function(e,t){if(this.currentDevice)if(aC.has(e.getType())&&e.referenceID&&(null===t||lC.has(t))){var n=this.currentDevice.getComponentByID(e.referenceID);if(!n)return;var r=this.findMappedConnectionForValve(n);if(!r)return;try{this.updatesConnectionRender(r)}catch(a){console.warn("Could not sync valve connection break after parameter update:",a)}}else if("Connection"===e.getType()&&"channelWidth"===t){var o=this.currentDevice.getConnectionForFeatureID(e.ID);if(!o)return;var i=this.currentDevice.getValvesForConnection(o);if(!i||0===i.length)return;try{this.updatesConnectionRender(o)}catch(a){console.warn("Could not sync valve connection break after channel width update:",a)}}}},{key:"updatesConnectionRender",value:function(e){var t;if(e.regenerateSegments(),!e.layer||e.layer.type!==o.CONTROL){var n=null===(t=Pd.currentDevice)||void 0===t?void 0:t.getValvesForConnection(e);if(void 0===n||null===n)throw new Error("Valves are undefined or null when updating connection: "+e.id);var r=[];for(var i in n){var a=n[i],l=this.getValveFlowClipRect(a);l&&r.push(l)}var s,c=this.getUnmappedFlowValveFeaturesForConnection(e),u=JP(c);try{for(u.s();!(s=u.n()).done;){var h=s.value,f=qd(h.getValue("position"),h.getValue("valveRadius"),h.getValue("gap"),h.getValue("rotation"));f&&r.push(f)}}catch(d){u.e(d)}finally{u.f()}r.length>0&&e.insertValveGapsGeometric(r)}}},{key:"showUIMessage",value:function(e){this.messageBox.MaterialSnackbar.showSnackbar({message:e})}},{key:"setupTools",value:function(){this.tools.MouseSelectTool=new jg(this,this.view),this.tools.InsertTextTool=new Rg(this),this.tools.Connection=new d_(this,"Connection","Basic"),this.tools.MoveTool=new Sw(this),this.tools.GenerateArrayTool=new S_(this)}},{key:"addCustomComponentTool",value:function(e){var t,n=null===(t=this.customComponentManager)||void 0===t?void 0:t.getCustomComponent(e);this.tools[e]=new W_(this,n,"Custom")}},{key:"__initializeRatsNest",value:function(){var e,t=null===(e=this.currentDevice)||void 0===e?void 0:e.components,n=1e4,r=1e4;for(var o in t){var i=t[parseInt(o)],a=i.getPosition();0===a[0]&&0===a[1]?i.placed||this.__generateDefaultPlacementForComponent(i,n
1*(parseInt(o)+1),r*(Math.floor(parseInt(o)/5)+1)):i.placed||this.__generateDefaultPlacementForComponent(i,a[0],a[1])}this.view.updateRatsNest(),this.view.updateComponentPortsRender()}},{key:"__generateDefaultPlacementForComponent",value:function(e,t,n){var r,o=e.params.toJSON();o.position=[t,n];for(var i="function"===typeof(null===(r=e.params)||void 0===r?void 0:r.toJSON)?e.params.toJSON():void 0,a=rf.getRenderTypeKeysForMINT(e.mint,i),l=0;l<(null===a||void 0===a?void 0:a.length);l++){var s=a[l],c=Oy.makeFeature(s,o);e.addFeatureID(c.ID),this.currentLayer.addFeature(c)}e.updateComponentPosition([t,n])}},{key:"generateExportJSON",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=qp.toInterchangeV1_2(this,e);return t}},{key:"loadCustomComponents",value:function(e){var t;Object.prototype.hasOwnProperty.call(e,"customComponents")&&(null===(t=this.customComponentManager)||void 0===t||t.loadFromJSON(e.customComponents))}},{key:"activateDAFDPlugin",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;this.loadDeviceFromJSON(JSON.parse(r.dafdtemplate)),null===e&&(e={orificeSize:750,orificeLength:200,oilInputWidth:800,waterInputWidth:900,outputWidth:900,outputLength:500,height:100}),Q_.fixLayout(e)}},{key:"createValveMapFromSelection",value:function(){var e,t=this.tools.MouseSelectTool.currentSelection,n=[],r=null,o=JP(t);try{for(o.s();!(e=o.n()).done;){var a=e.value,l=this.currentDevice.getComponentForFeatureID(a.featureID);if(null!==l){console.log("Component Type:",l.mint);var s=l.getType();"VALVE3D"!==s&&"VALVE"!==s||n.push(l)}r=this.currentDevice.getConnectionForFeatureID(a.featureID)}}catch(d){o.e(d)}finally{o.f()}for(var c=0,u=n;c<u.length;c++){var h=u[c],f=i.NORMALLY_OPEN;"VALVE3D"===h.mint&&(f=i.NORMALLY_CLOSED),console.log("Adding Valve: ",h),this.currentDevice.insertValve(h,r,f)}}},{key:"activateComponentPlacementTool",value:function(e,t){var n=rf.getTypeForMINT(e);if(null===n)throw new Error("Found null when looking for MINT Type");this.view.clearSelectedItems();var r=this.mouseAndKeyboardHandler.leftMouseTool;r instanceof d_&&$y.get().emit($y.CONNECTION_ESC_HINT,!1);var o=null,i=rf.getRendererForMINT(e);if("componentPositionTool"===i.placementTool)o=new jw(this,n,"Basic",t);else if("customComponentPositionTool"===i.placementTool);else if("positionTool"===i.placementTool)o=new yg(this,n,t);else if("multilayerPositionTool"===i.placementTool)o=new Qw(this,n,"Basic",t);else if("valveInsertionTool"===i.placementTool)o=new Kb(this,e,"Basic",t);else if("CellPositionTool"===i.placementTool)o=new Nb(this,n,"Basic",t);else{if("multilevelPositionTool"===i.placementTool)throw o=new wb(this,n,"Basic",t),new Error("multilevel position tool ui/input elements not set up");"connectionTool"===i.placementTool&&(o=new d_(this,n,"Basic"))}if(null===o)throw new Error("Could not initialize the tool ".concat(e));return this.mouseAndKeyboardHandler.leftMouseTool=o,this.mouseAndKeyboardHandler.rightMouseTool=o,this.mouseAndKeyboardHandler.updateViewMouseEvents(),o}},{key:"deactivateComponentPlacementTool",value:function(){console.log("Deactivating Component Placement Tool");var e=this.mouseAndKeyboardHandler.leftMouseTool,t=this.mouseAndKeyboardHandler.rightMouseTool;null!=e&&e.deactivate(),null!=t&&t!==e&&t.deactivate(),this.resetToDefaultTool()}},{key:"getGridSize",value:function(){return null===this.__grid?0:this.__grid.spacing}},{key:"updateGridSpacing",value:function(e){this.__grid.updateGridSpacing(e),this.updateGrid()}},{key:"downloadJSON",value:function(){if(null===this.currentDevice)throw new Error("No device loaded");var e=[],t=this.generateExportJSON(e),n=this.currentDevice.name||"device",r=JSON.stringify(t),o=Tv(t),i=new GP.a;if(i.file("".concat(n,".json"),r),i.file("".concat(n,"_ports.json"),JSON.stringify(o)),i.generateAsync({type:"blob"}).then((function(e){Object(Wv["saveAs"])(e,"".concat(n,"_json.zip"))})).catch((function(e){console.error("[Export JSON]",e);var t=e&&e.message?e.message:String(e);alert("Unable to export JSON: ".concat(t))})),e.length>0){var a,l="",s=JP(e);try{for(s.s();!(a=s.n()).done;){var c=a.value;l+=c.toText()+"\n\n"}}catch(h){s.e(h)}finally{s.f()}var u=new Blob([l],{type:"text/plain"});Object(Wv["saveAs"])(u,this.currentDevice.name+"_errors.txt")}}},{key:"findImportedComponentById",value:function(e){return jP(this.importedSourceJson,e)}},{key:"findImportedConnectionById",value:function(e){return BP(this.importedSourceJson,e)}},{key:"resolveComponentResetParams",value:function(e){if(!e)return null;var t=this.findImportedComponentById(e.id);return XP(e.mint,t&&t.params,!!t)}},{key:"resolveConnectionResetParams",value:function(e){if(!e)return null;var t=this.findImportedConnectionById(e.id);return XP("CHANNEL",t&&t.params,!!t)}},{key:"createNewDevice",value:function(e){this.importedSourceJson=null;var t=new Oy({"x-span":135e3,"y-span":85e3},e);console.log("Created new device: ",t.getXSpan(),t.getYSpan()),this.clear(),this.__currentDevice=t,this.resetPortsOnlyView(),this.activeRenderLayerIndex=0,this.createNewLayerBlock(),UP(this.__currentDevice),this.setNameMap(),Pd.currentDevice=t,this.activeRenderLayerIndex=0,this.addDevice(t),this.__initializeRatsNest(),this.view.initializeView(),this.updateGrid(),this.updateDevice(Pd.currentDevice),this.refresh(!0),this.currentLayer=this.renderLayers[0],this.updateActiveLayer()}},{key:"getCurrentLevelRenderLayers",value:function(){var e=this.activeRenderLayerIndex%3,t=3*e+0,n=3*e+1,r=3*e+2;return[this.renderLayers[t],this.renderLayers[n],this.renderLayers[r]]}}]),e}(),cC='{"name":"My Device","params":{"width":75800,"length":51000},"layers":[{"name":"flow","color":"indigo","params":{"z_offset":0,"flip":false},"features":{"97f1fd20-3ea6-11e5-8298-1b576ed4eb08":{"id":"97f1fd20-3ea6-11e5-8298-1b576ed4eb08","name":"New Port","type":"Port","params":{"position":[30000,40000],"radius1":700,"radiu
1s2":700,"height":100}},"97f1fd21-3ea6-11e5-8298-1b576ed4eb08":{"id":"97f1fd21-3ea6-11e5-8298-1b576ed4eb08","name":"New Port","type":"Port","params":{"position":[40000,40000],"radius1":700,"radius2":700,"height":100}},"97f22430-3ea6-11e5-8298-1b576ed4eb08":{"id":"97f22430-3ea6-11e5-8298-1b576ed4eb08","name":"New Port","type":"Port","params":{"position":[50000,40000],"radius1":700,"radius2":700,"height":100}},"97f22431-3ea6-11e5-8298-1b576ed4eb08":{"id":"97f22431-3ea6-11e5-8298-1b576ed4eb08","name":"New Port","type":"Port","params":{"position":[20000,40000],"radius1":700,"radius2":700,"height":100}},"97f22432-3ea6-11e5-8298-1b576ed4eb08":{"id":"97f22432-3ea6-11e5-8298-1b576ed4eb08","name":"New Channel","type":"Channel","params":{"start":[20000,40000],"end":[20000,35000],"width":400,"height":100}},"97f22433-3ea6-11e5-8298-1b576ed4eb08":{"id":"97f22433-3ea6-11e5-8298-1b576ed4eb08","name":"New Channel","type":"Channel","params":{"start":[20000,38000],"end":[17000,38000],"width":400,"height":100}},"97f22434-3ea6-11e5-8298-1b576ed4eb08":{"id":"97f22434-3ea6-11e5-8298-1b576ed4eb08","name":"New Channel","type":"Channel","params":{"start":[17000,38000],"end":[17000,35000],"width":400,"height":100}},"97f22435-3ea6-11e5-8298-1b576ed4eb08":{"id":"97f22435-3ea6-11e5-8298-1b576ed4eb08","name":"New Channel","type":"Channel","params":{"start":[20000,35000],"end":[20000,20000],"width":400,"height":100}},"97f22436-3ea6-11e5-8298-1b576ed4eb08":{"id":"97f22436-3ea6-11e5-8298-1b576ed4eb08","name":"New Channel","type":"Channel","params":{"start":[20000,20000],"end":[10000,10000],"width":400,"height":100}},"97f22437-3ea6-11e5-8298-1b576ed4eb08":{"id":"97f22437-3ea6-11e5-8298-1b576ed4eb08","name":"New Channel","type":"Channel","params":{"start":[17000,35000],"end":[15000,30000],"width":400,"height":100}},"97f22438-3ea6-11e5-8298-1b576ed4eb08":{"id":"97f22438-3ea6-11e5-8298-1b576ed4eb08","name":"New Channel","type":"Channel","params":{"start":[15000,30000],"end":[10000,30000],"width":400,"height":100}},"97f22439-3ea6-11e5-8298-1b576ed4eb08":{"id":"97f22439-3ea6-11e5-8298-1b576ed4eb08","name":"New Channel","type":"Channel","params":{"start":[10000,30000],"end":[10000,28000],"width":400,"height":100}},"97f2243a-3ea6-11e5-8298-1b576ed4eb08":{"id":"97f2243a-3ea6-11e5-8298-1b576ed4eb08","name":"New Channel","type":"Channel","params":{"start":[10000,28000],"end":[15000,28000],"width":400,"height":100}},"97f2243b-3ea6-11e5-8298-1b576ed4eb08":{"id":"97f2243b-3ea6-11e5-8298-1b576ed4eb08","name":"New Channel","type":"Channel","params":{"start":[15000,28000],"end":[15000,25000],"width":400,"height":100}},"97f2243c-3ea6-11e5-8298-1b576ed4eb08":{"id":"97f2243c-3ea6-11e5-8298-1b576ed4eb08","name":"New Channel","type":"Channel","params":{"start":[15000,25000],"end":[8000,25000],"width":400,"height":100}},"97f2243d-3ea6-11e5-8298-1b576ed4eb08":{"id":"97f2243d-3ea6-11e5-8298-1b576ed4eb08","name":"New Port","type":"Port","params":{"position":[8000,25000],"radius1":700,"radius2":700,"height":100}},"97f2243e-3ea6-11e5-8298-1b576ed4eb08":{"id":"97f2243e-3ea6-11e5-8298-1b576ed4eb08","name":"New Port","type":"Port","params":{"position":[10000,10000],"radius1":700,"radius2":700,"height":100}},"97f2243f-3ea6-11e5-8298-1b576ed4eb08":{"id":"97f2243f-3ea6-11e5-8298-1b576ed4eb08","name":"New Channel","type":"Channel","params":{"start":[30000,40000],"end":[30000,20000],"width":400,"height":100}},"97f22440-3ea6-11e5-8298-1b576ed4eb08":{"id":"97f22440-3ea6-11e5-8298-1b576ed4eb08","name":"New Channel","type":"Channel","params":{"start":[30000,20000],"end":[20000,10000],"width":400,"height":100}},"97f22441-3ea6-11e5-8298-1b576ed4eb08":{"id":"97f22441-3ea6-11e5-8298-1b576ed4eb08","name":"New Port","type":"Port","params":{"position":[20000,10000],"radius1":700,"radius2":700,"height":100}},"97f22442-3ea6-11e5-8298-1b576ed4eb08":{"id":"97f22442-3ea6-11e5-8298-1b576ed4eb08","name":"New Channel","type":"Channel","params":{"start":[30000,38000],"end":[27000,38000],"width":400,"height":100}},"97f22443-3ea6-11e5-8298-1b576ed4eb08":{"id":"97f22443-3ea6-11e5-8298-1b576ed4eb08","name":"New Channel","type":"Channel","params":{"start":[27000,38000],"end":[27000,30000],"width":400,"height":100}},"97f22444-3ea6-11e5-8298-1b576ed4eb08":{"id":"97f22444-3ea6-11e5-8298-1b576ed4eb08","name":"New Channel","type":"Channel","params":{"start":[27000,30000],"end":[22000,30000],"width":400,"height":100}},"97f22445-3ea6-11e5-8298-1b576ed4eb08":{"id":"97f22445-3ea6-11e5-8298-1b576ed4eb08","name":"New Channel","type":"Channel","params":{"start":[22000,30000],"end":[22000,28000],"width":400,"height":100}},"97f22446-3ea6-11e5-8298-1b576ed4eb08":{"id":"97f22446-3ea6-11e5-8298-1b576ed4eb08","name":"New Channel","type":"Channel","params":{"start":[22000,28000],"end":[27000,28000],"width":400,"height":100}},"97f24b40-3ea6-11e5-8298-1b576ed4eb08":{"id":"97f24b40-3ea6-11e5-8298-1b576ed4eb08","name":"New Channel","type":"Channel","params":{"start":[27000,28000],"end":[27000,26000],"width":400,"height":100}},"97f24b41-3ea6-11e5-8298-1b576ed4eb08":{"id":"97f24b41-3ea6-11e5-8298-1b576ed4eb08","name":"New Channel","type":"Channel","params":{"start":[27000,26000],"end":[22000,26000],"width":400,"height":100}},"97f24b42-3ea6-11e5-8298-1b576ed4eb08":{"id":"97f24b42-3ea6-11e5-8298-1b576ed4eb08","name":"New Channel","type":"Channel","params":{"start":[22000,26000],"end":[22000,24000],"width":400,"height":100}},"97f24b43-3ea6-11e5-8298-1b576ed4eb08":{"id":"97f24b43-3ea6-11e5-8298-1b576ed4eb08","name":"New Channel","type":"Channel","params":{"start":[22000,24000],"end":[27000,24000],"width":400,"height":100}},"97f24b44-3ea6-11e5-8298-1b576ed4eb08":{"id":"97f24b44-3ea6-11e5-8298-1b576ed4eb08","name":"New Channel","type":"Channel","params":{"start":[27000,24000],"end":[27000,22000],"width":400,"height":100}},"97f24b45-3ea6-11e5-8298-1b576ed4eb08":{"id":"97f24b45-3ea6-11e5-8298-1b576ed4eb08","name":"New Channel","type":"Channel","params":{"start":[27000,22000],"end":[22000,22000],"width":400,"height":100}},"97f24b46-3ea6-11e5-8298-1b576ed4eb08":{"id":"97f24b46-3ea6-11e5-8298-1b576ed4eb08","name":"New Channel","type":"Channel","params":{"start":[22000,22000],"end":[22000,20000],"width":400,"height":100}},"97f24b47-3ea6-11e5-8298-1b576ed4eb08":{"id":"97f24b47-3ea6-11e5-8298-1b576ed4eb08","name":"New Channel","type":"Channel","params":{"start":[22000,20000],"end":[25000,20000],"width":400,"height":100}},"97f24b48-3ea6-11e5-8298-1b576ed4eb08":{"id":"97f24b48-3ea6-11e5-8298-1b576ed4eb08","name":"New Channel","type":"Channel","params":{"start":[25000,20000],"end":[25000,17000],"width":400,"height":100}},"97f24b49-3ea6-11e5-8298-1b576ed4eb08":{"id":"97f24b49-3ea6-11e5-8298-1b576ed4eb08","name":"New Channel","type":"Channel","params":{"start":[25000,17000],"end":[21000,17000],"width":400,"height":100}},"97f24b4a-3ea6-11e5-8298-1b576ed4eb08":{"id":"97f24b4a-3ea6-11e5-8298-1b576ed4eb08","name":"New Port","type":"Port","params":{"position":[21000,17000],"radius1":700,"radiu
1s2":700,"height":100}},"97f24b4b-3ea6-11e5-8298-1b576ed4eb08":{"id":"97f24b4b-3ea6-11e5-8298-1b576ed4eb08","name":"New Channel","type":"Channel","params":{"start":[40000,40000],"end":[40000,20000],"width":400,"height":100}},"97f24b4c-3ea6-11e5-8298-1b576ed4eb08":{"id":"97f24b4c-3ea6-11e5-8298-1b576ed4eb08","name":"New Channel","type":"Channel","params":{"start":[40000,20000],"end":[50000,10000],"width":400,"height":100}},"97f24b4d-3ea6-11e5-8298-1b576ed4eb08":{"id":"97f24b4d-3ea6-11e5-8298-1b576ed4eb08","name":"New Channel","type":"Channel","params":{"start":[40000,38000],"end":[43000,38000],"width":400,"height":100}},"97f24b4e-3ea6-11e5-8298-1b576ed4eb08":{"id":"97f24b4e-3ea6-11e5-8298-1b576ed4eb08","name":"New Channel","type":"Channel","params":{"start":[43000,38000],"end":[43000,30000],"width":400,"height":100}},"97f24b4f-3ea6-11e5-8298-1b576ed4eb08":{"id":"97f24b4f-3ea6-11e5-8298-1b576ed4eb08","name":"New Channel","type":"Channel","params":{"start":[43000,30000],"end":[48000,30000],"width":400,"height":100}},"97f24b50-3ea6-11e5-8298-1b576ed4eb08":{"id":"97f24b50-3ea6-11e5-8298-1b576ed4eb08","name":"New Channel","type":"Channel","params":{"start":[48000,30000],"end":[48000,28000],"width":400,"height":100}},"97f24b51-3ea6-11e5-8298-1b576ed4eb08":{"id":"97f24b51-3ea6-11e5-8298-1b576ed4eb08","name":"New Channel","type":"Channel","params":{"start":[48000,28000],"end":[43000,28000],"width":400,"height":100}},"97f24b52-3ea6-11e5-8298-1b576ed4eb08":{"id":"97f24b52-3ea6-11e5-8298-1b576ed4eb08","name":"New Channel","type":"Channel","params":{"start":[43000,28000],"end":[43000,26000],"width":400,"height":100}},"97f24b53-3ea6-11e5-8298-1b576ed4eb08":{"id":"97f24b53-3ea6-11e5-8298-1b576ed4eb08","name":"New Channel","type":"Channel","params":{"start":[43000,26000],"end":[48000,26000],"width":400,"height":100}},"97f24b54-3ea6-11e5-8298-1b576ed4eb08":{"id":"97f24b54-3ea6-11e5-8298-1b576ed4eb08","name":"New Channel","type":"Channel","params":{"start":[48000,26000],"end":[48000,24000],"width":400,"height":100}},"97f24b55-3ea6-11e5-8298-1b576ed4eb08":{"id":"97f24b55-3ea6-11e5-8298-1b576ed4eb08","name":"New Channel","type":"Channel","params":{"start":[48000,24000],"end":[43000,24000],"width":400,"height":100}},"97f24b56-3ea6-11e5-8298-1b576ed4eb08":{"id":"97f24b56-3ea6-11e5-8298-1b576ed4eb08","name":"New Channel","type":"Channel","params":{"start":[43000,24000],"end":[43000,22000],"width":400,"height":100}},"97f24b57-3ea6-11e5-8298-1b576ed4eb08":{"id":"97f24b57-3ea6-11e5-8298-1b576ed4eb08","name":"New Channel","type":"Channel","params":{"start":[43000,22000],"end":[48000,22000],"width":400,"height":100}},"97f24b58-3ea6-11e5-8298-1b576ed4eb08":{"id":"97f24b58-3ea6-11e5-8298-1b576ed4eb08","name":"New Channel","type":"Channel","params":{"start":[48000,22000],"end":[48000,20000],"width":400,"height":100}},"97f24b59-3ea6-11e5-8298-1b576ed4eb08":{"id":"97f24b59-3ea6-11e5-8298-1b576ed4eb08","name":"New Channel","type":"Channel","params":{"start":[48000,20000],"end":[45000,20000],"width":400,"height":100}},"97f24b5a-3ea6-11e5-8298-1b576ed4eb08":{"id":"97f24b5a-3ea6-11e5-8298-1b576ed4eb08","name":"New Channel","type":"Channel","params":{"start":[45000,20000],"end":[45000,17000],"width":400,"height":100}},"97f24b5b-3ea6-11e5-8298-1b576ed4eb08":{"id":"97f24b5b-3ea6-11e5-8298-1b576ed4eb08","name":"New Channel","type":"Channel","params":{"start":[45000,17000],"end":[49000,17000],"width":400,"height":100}},"97f24b5c-3ea6-11e5-8298-1b576ed4eb08":{"id":"97f24b5c-3ea6-11e5-8298-1b576ed4eb08","name":"New Port","type":"Port","params":{"position":[50000,10000],"radius1":700,"radius2":700,"height":100}},"97f24b5d-3ea6-11e5-8298-1b576ed4eb08":{"id":"97f24b5d-3ea6-11e5-8298-1b576ed4eb08","name":"New Port","type":"Port","params":{"position":[49000,17000],"radius1":700,"radius2":700,"height":100}},"97f24b5e-3ea6-11e5-8298-1b576ed4eb08":{"id":"97f24b5e-3ea6-11e5-8298-1b576ed4eb08","name":"New Channel","type":"Channel","params":{"start":[50000,40000],"end":[50000,20000],"width":400,"height":100}},"97f24b5f-3ea6-11e5-8298-1b576ed4eb08":{"id":"97f24b5f-3ea6-11e5-8298-1b576ed4eb08","name":"New Channel","type":"Channel","params":{"start":[50000,20000],"end":[60000,10000],"width":400,"height":100}},"97f24b60-3ea6-11e5-8298-1b576ed4eb08":{"id":"97f24b60-3ea6-11e5-8298-1b576ed4eb08","name":"New Port","type":"Port","params":{"position":[60000,10000],"radius1":700,"radiu
1s2":700,"height":100}},"97f27250-3ea6-11e5-8298-1b576ed4eb08":{"id":"97f27250-3ea6-11e5-8298-1b576ed4eb08","name":"New Channel","type":"Channel","params":{"start":[50000,38000],"end":[53000,38000],"width":400,"height":100}},"97f27251-3ea6-11e5-8298-1b576ed4eb08":{"id":"97f27251-3ea6-11e5-8298-1b576ed4eb08","name":"New Channel","type":"Channel","params":{"start":[53000,38000],"end":[53000,35000],"width":400,"height":100}},"97f27252-3ea6-11e5-8298-1b576ed4eb08":{"id":"97f27252-3ea6-11e5-8298-1b576ed4eb08","name":"New Channel","type":"Channel","params":{"start":[53000,35000],"end":[55000,30000],"width":400,"height":100}},"97f27253-3ea6-11e5-8298-1b576ed4eb08":{"id":"97f27253-3ea6-11e5-8298-1b576ed4eb08","name":"New Channel","type":"Channel","params":{"start":[55000,30000],"end":[60000,30000],"width":400,"height":100}},"97f27254-3ea6-11e5-8298-1b576ed4eb08":{"id":"97f27254-3ea6-11e5-8298-1b576ed4eb08","name":"New Channel","type":"Channel","params":{"start":[60000,30000],"end":[60000,28000],"width":400,"height":100}},"97f27255-3ea6-11e5-8298-1b576ed4eb08":{"id":"97f27255-3ea6-11e5-8298-1b576ed4eb08","name":"New Channel","type":"Channel","params":{"start":[60000,28000],"end":[55000,28000],"width":400,"height":100}},"97f27256-3ea6-11e5-8298-1b576ed4eb08":{"id":"97f27256-3ea6-11e5-8298-1b576ed4eb08","name":"New Channel","type":"Channel","params":{"start":[55000,28000],"end":[55000,25000],"width":400,"height":100}},"97f27257-3ea6-11e5-8298-1b576ed4eb08":{"id":"97f27257-3ea6-11e5-8298-1b576ed4eb08","name":"New Channel","type":"Channel","params":{"start":[55000,25000],"end":[62000,25000],"width":400,"height":100}},"97f27258-3ea6-11e5-8298-1b576ed4eb08":{"id":"97f27258-3ea6-11e5-8298-1b576ed4eb08","name":"New Port","type":"Port","params":{"position":[62000,25000],"radius1":700,"radius2":700,"height":100}},"97f27259-3ea6-11e5-8298-1b576ed4eb08":{"id":"97f27259-3ea6-11e5-8298-1b576ed4eb08","name":"New Channel","type":"Channel","params":{"start":[15000,15000],"end":[15000,12000],"width":400,"height":100}},"97f2725a-3ea6-11e5-8298-1b576ed4eb08":{"id":"97f2725a-3ea6-11e5-8298-1b576ed4eb08","name":"New Via","type":"Via","params":{"position":[15000,12000],"radius1":800,"radiu
1s2":700,"height":1100}},"97f2725b-3ea6-11e5-8298-1b576ed4eb08":{"id":"97f2725b-3ea6-11e5-8298-1b576ed4eb08","name":"New Via","type":"Via","params":{"position":[26000,12000],"radius1":800,"radius2":700,"height":1100}},"97f2725c-3ea6-11e5-8298-1b576ed4eb08":{"id":"97f2725c-3ea6-11e5-8298-1b576ed4eb08","name":"New Via","type":"Via","params":{"position":[44000,12000],"radius1":800,"radius2":700,"height":1100}},"97f2725d-3ea6-11e5-8298-1b576ed4eb08":{"id":"97f2725d-3ea6-11e5-8298-1b576ed4eb08","name":"New Via","type":"Via","params":{"position":[55000,12000],"radius1":800,"radius2":700,"height":1100}},"97f2725e-3ea6-11e5-8298-1b576ed4eb08":{"id":"97f2725e-3ea6-11e5-8298-1b576ed4eb08","name":"New Channel","type":"Channel","params":{"start":[55000,12000],"end":[55000,15000],"width":400,"height":100}},"97f2725f-3ea6-11e5-8298-1b576ed4eb08":{"id":"97f2725f-3ea6-11e5-8298-1b576ed4eb08","name":"New Channel","type":"Channel","params":{"start":[26000,12000],"end":[30000,10000],"width":400,"height":100}},"97f27260-3ea6-11e5-8298-1b576ed4eb08":{"id":"97f27260-3ea6-11e5-8298-1b576ed4eb08","name":"New Channel","type":"Channel","params":{"start":[44000,12000],"end":[40000,10000],"width":400,"height":100}},"97f27261-3ea6-11e5-8298-1b576ed4eb08":{"id":"97f27261-3ea6-11e5-8298-1b576ed4eb08","name":"New Channel","type":"Channel","params":{"start":[40000,10000],"end":[38000,7000],"width":400,"height":100}},"97f27262-3ea6-11e5-8298-1b576ed4eb08":{"id":"97f27262-3ea6-11e5-8298-1b576ed4eb08","name":"New Channel","type":"Channel","params":{"start":[30000,10000],"end":[32000,7000],"width":400,"height":100}},"97f27263-3ea6-11e5-8298-1b576ed4eb08":{"id":"97f27263-3ea6-11e5-8298-1b576ed4eb08","name":"New Port","type":"Port","params":{"position":[32000,7000],"radius1":700,"radius2":700,"height":100}},"97f27264-3ea6-11e5-8298-1b576ed4eb08":{"id":"97f27264-3ea6-11e5-8298-1b576ed4eb08","name":"New Port","type":"Port","params":{"position":[38000,7000],"radius1":700,"radius2":700,"height":100}},"97f27265-3ea6-11e5-8298-1b576ed4eb08":{"id":"97f27265-3ea6-11e5-8298-1b576ed4eb08","name":"New CircleValve","type":"CircleValve","params":{"position":[35000,10000],"radius1":1400,"radius2":1200,"height":800}},"97f27266-3ea6-11e5-8298-1b576ed4eb08":{"id":"97f27266-3ea6-11e5-8298-1b576ed4eb08","name":"New Channel","type":"Channel","params":{"start":[35000,10000],"end":[35000,30000],"width":400,"height":100}},"97f27267-3ea6-11e5-8298-1b576ed4eb08":{"id":"97f27267-3ea6-11e5-8298-1b576ed4eb08","name":"New Port","type":"Port","params":{"position":[35000,30000],"radius1":700,"radius2":700,"height":100}},"97f27268-3ea6-11e5-8298-1b576ed4eb08":{"id":"97f27268-3ea6-11e5-8298-1b576ed4eb08","name":"New Channel","type":"Channel","params":{"start":[35000,17000],"end":[38000,23000],"width":400,"height":100}},"97f27269-3ea6-11e5-8298-1b576ed4eb08":{"id":"97f27269-3ea6-11e5-8298-1b576ed4eb08","name":"New Channel","type":"Channel","params":{"start":[38000,23000],"end":[36000,25000],"width":400,"height":100}},"97f2726a-3ea6-11e5-8298-1b576ed4eb08":{"id":"97f2726a-3ea6-11e5-8298-1b576ed4eb08","name":"New Channel","type":"Channel","params":{"start":[36000,25000],"end":[35000,30000],"width":400,"height":100}},"97f2726b-3ea6-11e5-8298-1b576ed4eb08":{"id":"97f2726b-3ea6-11e5-8298-1b576ed4eb08","name":"New Channel","type":"Channel","params":{"start":[35000,17000],"end":[32000,23000],"width":400,"height":100}},"97f2726c-3ea6-11e5-8298-1b576ed4eb08":{"id":"97f2726c-3ea6-11e5-8298-1b576ed4eb08","name":"New Channel","type":"Channel","params":{"start":[32000,23000],"end":[34000,25000],"width":400,"height":100}},"97f2726d-3ea6-11e5-8298-1b576ed4eb08":{"id":"97f2726d-3ea6-11e5-8298-1b576ed4eb08","name":"New Channel","type":"Channel","params":{"start":[34000,25000],"end":[35000,30000],"width":400,"height":100}},"97f2726e-3ea6-11e5-8298-1b576ed4eb08":{"id":"97f2726e-3ea6-11e5-8298-1b576ed4eb08","name":"New Channel","type":"Channel","params":{"start":[32000,23000],"end":[35000,24000],"width":400,"height":100}},"97f2726f-3ea6-11e5-8298-1b576ed4eb08":{"id":"97f2726f-3ea6-11e5-8298-1b576ed4eb08","name":"New Channel","type":"Channel","params":{"start":[38000,23000],"end":[35000,24000],"width":400,"height":100}},"97f27270-3ea6-11e5-8298-1b576ed4eb08":{"id":"97f27270-3ea6-11e5-8298-1b576ed4eb08","name":"New Channel","type":"Channel","params":{"start":[25000,20000],"end":[28000,20000],"width":400,"height":100}},"97f27271-3ea6-11e5-8298-1b576ed4eb08":{"id":"97f27271-3ea6-11e5-8298-1b576ed4eb08","name":"New Channel","type":"Channel","params":{"start":[28000,20000],"end":[28000,22000],"width":400,"height":100}},"97f27272-3ea6-11e5-8298-1b576ed4eb08":{"id":"97f27272-3ea6-11e5-8298-1b576ed4eb08","name":"New Channel","type":"Channel","params":{"start":[28000,22000],"end":[27000,22000],"width":400,"height":100}},"97f27273-3ea6-11e5-8298-1b576ed4eb08":{"id":"97f27273-3ea6-11e5-8298-1b576ed4eb08","name":"New Channel","type":"Channel","params":{"start":[45000,20000],"end":[42000,20000],"width":400,"height":100}},"97f27274-3ea6-11e5-8298-1b576ed4eb08":{"id":"97f27274-3ea6-11e5-8298-1b576ed4eb08","name":"New Channel","type":"Channel","params":{"start":[42000,20000],"end":[42000,22000],"width":400,"height":100}},"97f27275-3ea6-11e5-8298-1b576ed4eb08":{"id":"97f27275-3ea6-11e5-8298-1b576ed4eb08","name":"New Channel","type":"Channel","params":{"start":[42000,22000],"end":[44000,22000],"width":400,"height":100}},"97f27276-3ea6-11e5-8298-1b576ed4eb08":{"id":"97f27276-3ea6-11e5-8298-1b576ed4eb08","name":"New Via","type":"Via","params":{"position":[35000,30000],"radius1":800,"radiu
1s2":700,"height":1100}},"97f27277-3ea6-11e5-8298-1b576ed4eb08":{"id":"97f27277-3ea6-11e5-8298-1b576ed4eb08","name":"New Via","type":"Via","params":{"position":[32000,20000],"radius1":800,"radius2":700,"height":1100}},"97f27278-3ea6-11e5-8298-1b576ed4eb08":{"id":"97f27278-3ea6-11e5-8298-1b576ed4eb08","name":"New Via","type":"Via","params":{"position":[38000,20000],"radius1":800,"radius2":700,"height":1100}},"a2de7790-3ea6-11e5-8298-1b576ed4eb08":{"id":"a2de7790-3ea6-11e5-8298-1b576ed4eb08","name":"New CircleValve","type":"CircleValve","params":{"position":[10000,20000],"radius1":1400,"radius2":1200,"height":800}},"a3d819d0-3ea6-11e5-8298-1b576ed4eb08":{"id":"a3d819d0-3ea6-11e5-8298-1b576ed4eb08","name":"New CircleValve","type":"CircleValve","params":{"position":[60000,20000],"radius1":1400,"radius2":1200,"height":800}}}},{"name":"control","color":"red","params":{"z_offset":1200,"flip":true},"features":{"97f27279-3ea6-11e5-8298-1b576ed4eb08":{"id":"97f27279-3ea6-11e5-8298-1b576ed4eb08","name":"New CircleValve","type":"CircleValve","params":{"position":[20000,34000],"radius1":1400,"radius2":1200,"height":800}},"97f2727a-3ea6-11e5-8298-1b576ed4eb08":{"id":"97f2727a-3ea6-11e5-8298-1b576ed4eb08","name":"New CircleValve","type":"CircleValve","params":{"position":[30000,34000],"radius1":1400,"radius2":1200,"height":800}},"97f2727b-3ea6-11e5-8298-1b576ed4eb08":{"id":"97f2727b-3ea6-11e5-8298-1b576ed4eb08","name":"New CircleValve","type":"CircleValve","params":{"position":[40000,34000],"radius1":1400,"radius2":1200,"height":800}},"97f2727c-3ea6-11e5-8298-1b576ed4eb08":{"id":"97f2727c-3ea6-11e5-8298-1b576ed4eb08","name":"New CircleValve","type":"CircleValve","params":{"position":[50000,34000],"radius1":1400,"radius2":1200,"height":800}},"97f2727d-3ea6-11e5-8298-1b576ed4eb08":{"id":"97f2727d-3ea6-11e5-8298-1b576ed4eb08","name":"New Channel","type":"Channel","params":{"start":[20000,34000],"end":[24000,34000],"width":400,"height":100}},"97f2727e-3ea6-11e5-8298-1b576ed4eb08":{"id":"97f2727e-3ea6-11e5-8298-1b576ed4eb08","name":"New Channel","type":"Channel","params":{"start":[24000,34000],"end":[24000,47000],"width":400,"height":100}},"97f29960-3ea6-11e5-8298-1b576ed4eb08":{"id":"97f29960-3ea6-11e5-8298-1b576ed4eb08","name":"New Channel","type":"Channel","params":{"start":[30000,34000],"end":[34000,34000],"width":400,"height":100}},"97f29961-3ea6-11e5-8298-1b576ed4eb08":{"id":"97f29961-3ea6-11e5-8298-1b576ed4eb08","name":"New Channel","type":"Channel","params":{"start":[34000,34000],"end":[34000,47000],"width":400,"height":100}},"97f29962-3ea6-11e5-8298-1b576ed4eb08":{"id":"97f29962-3ea6-11e5-8298-1b576ed4eb08","name":"New Channel","type":"Channel","params":{"start":[40000,34000],"end":[37000,34000],"width":400,"height":100}},"97f29963-3ea6-11e5-8298-1b576ed4eb08":{"id":"97f29963-3ea6-11e5-8298-1b576ed4eb08","name":"New Channel","type":"Channel","params":{"start":[37000,34000],"end":[36000,34000],"width":400,"height":100}},"97f29964-3ea6-11e5-8298-1b576ed4eb08":{"id":"97f29964-3ea6-11e5-8298-1b576ed4eb08","name":"New Channel","type":"Channel","params":{"start":[36000,34000],"end":[36000,47000],"width":400,"height":100}},"97f29965-3ea6-11e5-8298-1b576ed4eb08":{"id":"97f29965-3ea6-11e5-8298-1b576ed4eb08","name":"New Channel","type":"Channel","params":{"start":[50000,34000],"end":[46000,34000],"width":400,"height":100}},"97f29966-3ea6-11e5-8298-1b576ed4eb08":{"id":"97f29966-3ea6-11e5-8298-1b576ed4eb08","name":"New Channel","type":"Channel","params":{"start":[46000,34000],"end":[46000,47000],"width":400,"height":100}},"97f29967-3ea6-11e5-8298-1b576ed4eb08":{"id":"97f29967-3ea6-11e5-8298-1b576ed4eb08","name":"New Port","type":"Port","params":{"position":[24000,47000],"radius1":700,"radius2":700,"height":100}},"97f29968-3ea6-11e5-8298-1b576ed4eb08":{"id":"97f29968-3ea6-11e5-8298-1b576ed4eb08","name":"New Port","type":"Port","params":{"position":[34000,47000],"radius1":700,"radius2":700,"height":100}},"97f29969-3ea6-11e5-8298-1b576ed4eb08":{"id":"97f29969-3ea6-11e5-8298-1b576ed4eb08","name":"New Port","type":"Port","params":{"position":[36000,47000],"radius1":700,"radiu
1s2":700,"height":100}},"97f2996a-3ea6-11e5-8298-1b576ed4eb08":{"id":"97f2996a-3ea6-11e5-8298-1b576ed4eb08","name":"New Port","type":"Port","params":{"position":[46000,47000],"radius1":700,"radius2":700,"height":100}},"97f2996b-3ea6-11e5-8298-1b576ed4eb08":{"id":"97f2996b-3ea6-11e5-8298-1b576ed4eb08","name":"New Channel","type":"Channel","params":{"start":[15000,12000],"end":[26000,12000],"width":400,"height":100}},"97f2996c-3ea6-11e5-8298-1b576ed4eb08":{"id":"97f2996c-3ea6-11e5-8298-1b576ed4eb08","name":"New Channel","type":"Channel","params":{"start":[44000,12000],"end":[55000,12000],"width":400,"height":100}},"97f2996d-3ea6-11e5-8298-1b576ed4eb08":{"id":"97f2996d-3ea6-11e5-8298-1b576ed4eb08","name":"New Port","type":"Port","params":{"position":[15000,12000],"radius1":700,"radius2":700,"height":100}},"97f2996e-3ea6-11e5-8298-1b576ed4eb08":{"id":"97f2996e-3ea6-11e5-8298-1b576ed4eb08","name":"New Port","type":"Port","params":{"position":[26000,12000],"radius1":700,"radius2":700,"height":100}},"97f2996f-3ea6-11e5-8298-1b576ed4eb08":{"id":"97f2996f-3ea6-11e5-8298-1b576ed4eb08","name":"New Port","type":"Port","params":{"position":[44000,12000],"radius1":700,"radius2":700,"height":100}},"97f29970-3ea6-11e5-8298-1b576ed4eb08":{"id":"97f29970-3ea6-11e5-8298-1b576ed4eb08","name":"New Port","type":"Port","params":{"position":[55000,12000],"radius1":700,"radius2":700,"height":100}},"97f29971-3ea6-11e5-8298-1b576ed4eb08":{"id":"97f29971-3ea6-11e5-8298-1b576ed4eb08","name":"New Port","type":"Port","params":{"position":[25000,21000],"radius1":700,"radius2":700,"height":100}},"97f29972-3ea6-11e5-8298-1b576ed4eb08":{"id":"97f29972-3ea6-11e5-8298-1b576ed4eb08","name":"New Port","type":"Port","params":{"position":[45000,21000],"radius1":700,"radius2":700,"height":100}},"a54e6620-3ea6-11e5-8298-1b576ed4eb08":{"id":"a54e6620-3ea6-11e5-8298-1b576ed4eb08","name":"New Channel","type":"Channel","params":{"start":[10000,20000],"end":[15000,12000],"width":400,"height":100}},"a63ff210-3ea6-11e5-8298-1b576ed4eb08":{"id":"a63ff210-3ea6-11e5-8298-1b576ed4eb08","name":"New Channel","type":"Channel","params":{"start":[55000,12000],"end":[60000,20000],"width":400,"height":100}},"a7efc4f0-3ea6-11e5-8298-1b576ed4eb08":{"id":"a7efc4f0-3ea6-11e5-8298-1b576ed4eb08","name":"New Port","type":"Port","params":{"position":[10000,20000],"radius1":700,"radius2":700,"height":100}},"a8879820-3ea6-11e5-8298-1b576ed4eb08":{"id":"a8879820-3ea6-11e5-8298-1b576ed4eb08","name":"New Port","type":"Port","params":{"position":[60000,20000],"radius1":700,"radius2":700,"height":100}}}}],"groups":[],"defaults":{}}',uC='{"name":"My Other Device","params":{"width":135000,"length":85000},"layers":[{"name":"flow","color":"indigo","params":{"z_offset":0,"flip":false},"features":{"7d4dce00-4f92-11e7-b516-0963e7d642b6":{"id":"7d4dce00-4f92-11e7-b516-0963e7d642b6","name":"New Feature","type":"Channel","set":"Basic","params":{"start":[0,0],"end":[135000,0],"channelWidth":800,"height":100}},"802dbc70-4f92-11e7-b516-0963e7d642b6":{"id":"802dbc70-4f92-11e7-b516-0963e7d642b6","name":"New Feature","type":"Channel","set":"Basic","params":{"start":[135000,0],"end":[135000,85000],"channelWidth":800,"height":100}},"84122290-4f92-11e7-b516-0963e7d642b6":{"id":"84122290-4f92-11e7-b516-0963e7d642b6","name":"New Feature","type":"Channel","set":"Basic","params":{"start":[135000,85000],"end":[0,85000],"channelWidth":800,"height":100}},"8791ac60-4f92-11e7-b516-0963e7d642b6":{"id":"8791ac60-4f92-11e7-b516-0963e7d642b6","name":"New Feature","type":"Channel","set":"Basic","params":{"start":[0,85000],"end":[0,0],"channelWidth":800,"height":100}}}},{"name":"control","color":"red","params":{"z_offset":1200,"flip":true},"features":{"a937dec0-4f92-11e7-b516-0963e7d642b6":{"id":"a937dec0-4f92-11e7-b516-0963e7d642b6","name":"New Feature","type":"Channel","set":"Basic","params":{"start":[0,0],"end":[0,85000],"channelWidth":800,"height":100}},"ab87e940-4f92-11e7-b516-0963e7d642b6":{"id":"ab87e940-4f92-11e7-b516-0963e7d642b6","name":"New Feature","type":"Channel","set":"Basic","params":{"start":[0,85000],"end":[135000,85000],"channelWidth":800,"height":100}},"ad94f750-4f92-11e7-b516-0963e7d642b6":{"id":"ad94f750-4f92-11e7-b516-0963e7d642b6","name":"New Feature","type":"Channel","set":"Basic","params":{"start":[135000,85000],"end":[135000,
10],"channelWidth":800,"height":100}},"af694220-4f92-11e7-b516-0963e7d642b6":{"id":"af694220-4f92-11e7-b516-0963e7d642b6","name":"New Feature","type":"Channel","set":"Basic","params":{"start":[135000,0],"end":[0,0],"channelWidth":800,"height":100}}}}],"groups":[]}',hC='{"name":"My Other Device","params":{"width":135000,"length":85000},"renderLayers":[{"id":"d51fc900-e923-11ec-baa7-bf96f82ad573","name":"RenderLayerFlow_1","modellayer":"4952d7a0-f16c-11eb-8c04-ff751cb31c4c","type":"FLOW","features":[],"color":"indigo"},{"id":"d51fc901-e923-11ec-baa7-bf96f82ad573","name":"RenderLayerControl_1","modellayer":"4952feb0-f16c-11eb-8c04-ff751cb31c4c","type":"CONTROL","features":[],"color":"red"},{"id":"d51fc902-e923-11ec-baa7-bf96f82ad573","name":"RenderLayerIntegration_1","modellayer":"4952feb1-f16c-11eb-8c04-ff751cb31c4c","type":"INTEGRATION","features":[],"color":"green"}],"layers":[{"id":"4952d7a0-f16c-11eb-8c04-ff751cb31c4c","name":"LayerFlow_1","type":"FLOW","group":"0","params":{"z_offset":0,"flip":false},"features":[]},{"id":"4952feb0-f16c-11eb-8c04-ff751cb31c4c","name":"LayerControl_1","type":"CONTROL","group":"0","params":{"z_offset":0,"flip":false},"features":[]},{"id":"4952feb1-f16c-11eb-8c04-ff751cb31c4c","name":"LayerIntegration_1","type":"INTEGRATION","group":"0","params":{"z_offset":0,"flip":false},"features":[]}],"groups":[],"components":[],"connections":[],"valves":[],"version":"1.2"}',fC='{"name":"DAFD Template","params":{"width":70000,"length":70000},"components":[{"id":"e958b4d0-6155-11e9-89ad-d58be75aeb6f","name":"Port_in","entity":"PORT","params":{"position":[10000,35000],"portRadius":1998,"height":1100},"xspan":3996,"yspan":3996,"ports":[]},{"id":"eadf7be0-6155-11e9-89ad-d58be75aeb6f","name":"Port_out","entity":"PORT","params":{"position":[60000,35000],"portRadius":1998,"height":1100},"xspan":3996,"yspan":3996,"ports":[]},{"id":"ec125690-6155-11e9-89ad-d58be75aeb6f","name":"Port_oil1","entity":"PORT","params":{"position":[35075,10000],"portRadius":1998,"height":1100},"xspan":3996,"yspan":3996,"ports":[]},{"id":"f0839360-6155-11e9-89ad-d58be75aeb6f","name":"Port_oil2","entity":"PORT","params":{"position":[35075,60000],"portRadius":1998,"height":1100},"xspan":3996,"yspan":3996,"ports":[]},{"id":"b6d5c690-d628-11e9-9185-859b5727feb8","name":"DropletGen_1","entity":"NOZZLE DROPLET GENERATOR","params":{"position":[40000,35000],"orificeSize":75,"orificeLength":75,"oilInputWidth":150,"waterInputWidth":150,"outputWidth":150,"outputLength":5000,"height":75},"xspan":5225,"yspan":150,"ports":[{"x":75,"y":-75,"layer":"FLOW","label":"1"},{"x":5225,"y":0,"layer":"FLOW","label":"2"},{"x":75,"y":75,"layer":"FLOW","label":"3"},{"x":0,"y":0,"layer":"FLOW","label":"4"}]}],"connections":[],"features":[{"name":"flow","color":"indigo","params":{"z_offset":0,"flip":false},"features":{"e957f180-6155-11e9-89ad-d58be75aeb6f":{"id":"e957f180-6155-11e9-89ad-d58be75aeb6f","name":"New Feature","macro":"Port","set":"Basic","referenceID":"e958b4d0-6155-11e9-89ad-d58be75aeb6f","params":{"position":[10000,35000],"portRadius":1998,"height":1100},"dxfData":[],"type":"XY"},"eadf06b0-6155-11e9-89ad-d58be75aeb6f":{"id":"eadf06b0-6155-11e9-89ad-d58be75aeb6f","name":"New Feature","macro":"Port","set":"Basic","referenceID":"eadf7be0-6155-11e9-89ad-d58be75aeb6f","params":{"position":[60000,35000],"portRadius":1998,"height":1100},"dxfData":[],"type":"XY"},"ec119340-6155-11e9-89ad-d58be75aeb6f":{"id":"ec119340-6155-11e9-89ad-d58be75aeb6f","name":"New Feature","macro":"Port","set":"Basic","referenceID":"ec125690-6155-11e9-89ad-d58be75aeb6f","params":{"position":[35075,10000],"portRadius":1998,"height":1100},"dxfData":[],"type":"XY"},"f082f720-6155-11e9-89ad-d58be75aeb6f":{"id":"f082f720-6155-11e9-89ad-d58be75aeb6f","name":"New Feature","macro":"Port","set":"Basic","referenceID":"f0839360-6155-11e9-89ad-d58be75aeb6f","params":{"position":[35075,60000],"portRadius":1998,"height":1100},"dxfData":[],"type":"XY"},"1643a8b0-d3f2-11e9-ad52-c581dcc5e148":{"id":"1643a8b0-d3f2-11e9-ad52-c581dcc5e148","name":"Transition_3","macro":"Transition","set":"Basic","params":{"position":[10000,35000],"cw1":2000,"cw2":150,"length":10000,"rotation":270,"height":250},"dxfData":[],"type":"XY"}
1,"2e07a4b0-d3f2-11e9-ad52-c581dcc5e148":{"id":"2e07a4b0-d3f2-11e9-ad52-c581dcc5e148","name":"Transition_4","macro":"Transition","set":"Basic","params":{"position":[60000,35000],"cw1":2000,"cw2":150,"length":10000,"rotation":90,"height":250},"dxfData":[],"type":"XY"},"313eb3d0-d3f2-11e9-ad52-c581dcc5e148":{"id":"313eb3d0-d3f2-11e9-ad52-c581dcc5e148","name":"Transition_5","macro":"Transition","set":"Basic","params":{"position":[35075,60000],"cw1":2000,"cw2":150,"length":10000,"rotation":180,"height":250},"dxfData":[],"type":"XY"},"336b57d0-d3f2-11e9-ad52-c581dcc5e148":{"id":"336b57d0-d3f2-11e9-ad52-c581dcc5e148","name":"Transition_6","macro":"Transition","set":"Basic","params":{"position":[35075,10000],"cw1":2000,"cw2":150,"length":10000,"height":250},"dxfData":[],"type":"XY"},"b6d50340-d628-11e9-9185-859b5727feb8":{"id":"b6d50340-d628-11e9-9185-859b5727feb8","name":"New Feature","macro":"DropletGen","set":"Basic","referenceID":"b6d5c690-d628-11e9-9185-859b5727feb8","params":{"position":[40000,35000],"orificeSize":75,"orificeLength":75,"oilInputWidth":150,"waterInputWidth":150,"outputWidth":150,"outputLength":5000,"height":75},"dxfData":[],"type":"XY"},"e1a50cd0-f506-11e9-b6c5-c5f0545f0b4a":{"id":"e1a50cd0-f506-11e9-b6c5-c5f0545f0b4a","name":"e1a50cd0-f506-11e9-b6c5-c5f0545f0b4a","macro":"EDGE","set":"Basic","dxfData":[],"type":"EDGE"},"48225b40-f50a-11e9-a170-c3e417364f96":{"id":"48225b40-f50a-11e9-a170-c3e417364f96","name":"48225b40-f50a-11e9-a170-c3e417364f96","macro":"EDGE","set":"Basic","dxfData":[],"type":"EDGE"}}},{"name":"control","color":"red","params":{"z_offset":1200,"flip":true},"features":{"e1a50cd0-f506-11e9-b6c5-c5f0545f0b4a":{"id":"e1a50cd0-f506-11e9-b6c5-c5f0545f0b4a","name":"e1a50cd0-f506-11e9-b6c5-c5f0545f0b4a","macro":"EDGE","set":"Basic","dxfData":[],"type":"EDGE"},"48225b40-f50a-11e9-a170-c3e417364f96":{"id":"48225b40-f50a-11e9-a170-c3e417364f96","name":"48225b40-f50a-11e9-a170-c3e417364f96","macro":"EDGE","set":"Basic","dxfData":[],"type":"EDGE"}}},{"name":"cells","color":"indigo","params":{"z_offset":2000,"flip":false},"features":{"e1a50cd0-f506-11e9-b6c5-c5f0545f0b4a":{"id":"e1a50cd0-f506-11e9-b6c5-c5f0545f0b4a","name":"e1a50cd0-f506-11e9-b6c5-c5f0545f0b4a","macro":"EDGE","set":"Basic","dxfData":[],"type":"EDGE"},"48225b40-f50a-11e9-a170-c3e417364f96":{"id":"48225b40-f50a-11e9-a170-c3e417364f96","name":"48225b40-f50a-11e9-a170-c3e417364f96","macro":"EDGE","set":"Basic","dxfData":[],"type":"EDGE"}}}],"version":"1.2","groups":[],"customComponents":{}}',dC={example1:uC,example2:hC,example3:cC},pC=dC,yC=function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("div",[n("v-tooltip",{attrs:{left:""},scopedSlots:e._u([{key:"activator",fn:function(t){var r=t.on,o=t.attrs;return[n("v-btn",e._g(e._b({staticClass:"pink white--text",attrs:{id:"grid-button",fab:""},on:{click:function(t){return e.showProperties()}},nativeOn:{mouseenter:function(t){e.hover=!0},mouseleave:function(t){e.hover=!1}}},"v-btn",o,!1),r),[n("span",{staticClass:"material-icons"},[e._v("grid_on")])])]}}])},[n("span",[e._v("Grid Settings")])]),n("v-card",{directives:[{name:"show",rawName:"v-show",value:e.activated,expression:"activated"}],attrs:{id:"resolution-toolbar"}},[n("v-card-text",[n("v-switch",{attrs:{color:"#304FFE","hide-details":""},on:{change:e.clickedGrid},scopedSlots:e._u([{key:"label",fn:function(){return[e._v("Enable Automatic Grid")]},proxy:!0}]),model:{value:e.isAdaptiveGridEnabled,callback:function(t){e.isAdaptiveGridEnabled=t},expression:"isAdaptiveGridEnabled"}}),n("v-switch",{attrs:{color:"#304FFE"},on:{change:e.clickedSnap},scopedSlots:e._u([{key:"label",fn:function(){return[e._v("Render Snap Points")]},proxy:!0}]),model:{value:e.renderSnap,callback:function(t){e.renderSnap=t},expression:"renderSnap"}}),n("br"),n("div",{ref:"gridslider",attrs:{disabled:e.isAdaptiveGridEnabled}})],1)],1),n("div",{attrs:{id:"bottom-info-bar"}},[e._v("Grid Size: "+e._s(e.gridSizeValue)+" μm")])],1)},mC=[],vC=(n("0c4f"),n("0f2b")),gC=n.n(vC),wC=n("5070"),bC=n.n(wC),_C={name:"ResolutionToolbar",components:{},data:function(){return{suffix:bC()({suffix:"μm"}),activated:!1,hover:!1,isAdaptiveGridEnabled:!0,renderSnap:!0,isUserGeneratedEvent:!1,ignoreUpdate:!1,gridSizeValue:0}},computed:{directGridSpacingRead:function(){return null===Pd.viewManager?0:Pd.viewManager.getGridSize()}},mounted:function(){var e=this;gC.a.create(this.$refs.gridslider,{start:[500],connect:"lower",range:{min:[1,1],"10%":[10,10],"3
10%":[100,100],"90%":[1e3,1e3],max:[5e3]},pips:{mode:"range",density:5,format:bC()({suffix:"μm"})},tooltips:[!0]}),setTimeout((function(){Pd.currentGrid.spacing,e.$refs.gridslider.noUiSlider.on("change",(function(t){var n=parseFloat(t[0]);console.log("grid size: "+n),e.ignoreUpdate||Pd.viewManager.updateGridSpacing(n)}));var t=Pd.viewManager.getGridSize();e.ignoreUpdate=!0,e.$refs.gridslider.noUiSlider.set(t),e.ignoreUpdate=!1,e.gridSizeValue=t,$y.get().on($y.UPDATE_GRID_SIZE,(function(){var t=Pd.viewManager.getGridSize();e.gridSizeValue=t,e.ignoreUpdate=!0,e.$refs.gridslider.noUiSlider.set(t),e.ignoreUpdate=!1}))}),100)},methods:{showProperties:function(){this.activated=!this.activated,console.log("grid clicked")},clickedGrid:function(){console.log(this.isAdaptiveGridEnabled),this.isAdaptiveGridEnabled?Pd.currentGrid.enableAdaptiveGrid():Pd.currentGrid.disableAdaptiveGrid()},clickedSnap:function(){this.renderSnap?Pd.viewManager.view.enableSnapRender():Pd.viewManager.view.disableSnapRender()}}},PC=_C,CC=(n("2480"),n("2877")),OC=n("6544"),SC=n.n(OC),DC=n("8336"),RC=n("b0af"),TC=n("99d9"),LC=n("b73d"),FC=n("3a2f"),kC=Object(CC["a"])(PC,yC,mC,!1,null,"17cb0ead",null),EC=kC.exports;SC()(kC,{VBtn:DC["a"],VCard:RC["a"],VCardText:TC["b"],VSwitch:LC["a"],VTooltip:FC["a"]});var NC=function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("div",{staticClass:"zoomsliderbase"},[n("div",{ref:"zoomslider",staticClass:"zslidermain",attrs:{height:"300px"}})])},xC=[],MC=n("f528"),IC=n.n(MC),WC={name:"ZoomSlider",components:{},data:function(){return{zoomOptimal:[.1],ignoreUpdate:!1,currentGridSpacing:500,currentZoom:-3.5}},mounted:function(){var e=this;IC.a.create(this.$refs.zoomslider,{start:40,orientation:"vertical",connect:[!1,!0],range:{min:-3.61,max:.6545}}),this.$refs.zoomslider.noUiSlider.updateOptions({range:{min:-3.61,max:.6545}},!1);var t=0;setTimeout((function(){e.$refs.zoomslider.noUiSlider.on("update",(function(t){var n=parseFloat(t[0]);e.ignoreUpdate||e.updateViewManagerZoom(n)})),t=Math.log10(Pd.viewManager.view.computeOptimalZoom()),e.$refs.zoomslider.noUiSlider.set(t)}),100),$y.get().on($y.UPDATE_ZOOM,(function(){var t=e.convertZoomtoLinearScale(Pd.viewManager.view.getZoom());e.ignoreUpdate=!0,e.$refs.zoomslider.noUiSlider.set(t),e.ignoreUpdate=!1}))},methods:{convertLinearToZoomScale:function(e){return Math.pow(10,e)},updateViewManagerZoom:function(e){Pd.viewManager.setZoom(this.convertLinearToZoomScale(e))},convertZoomtoLinearScale:function(e){return Math.log10(e)}}},AC=WC,jC=(n("feac"),Object(CC["a"])(AC,NC,xC,!1,null,"1a7b3dea",null)),BC=jC.exports,VC=function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("v-card",{directives:[{name:"show",rawName:"v-show",value:e.activeMenu,expression:"activeMenu"}],ref:"RightClickMenu",staticClass:"component-context-card settings-panel-card settings-panel-card--chrome",style:e.cardPositionStyle,attrs:{scrollable:""}},[n("div",{directives:[{name:"show",rawName:"v-show",value:e.showRename,expression:"showRename"}],staticClass:"component-context-rename px-4 pt-3 pb-0"},[n("v-row",{attrs:{align:"center",dense:"","no-gutters":""}},[n("v-text-field",{staticClass:"mr-2",attrs:{dense:"","hide-details":"",label:"Name",outlined:""},model:{value:e.componentName,callback:function(t){e.componentName=t},expression:"componentName"}}),n("v-btn",{staticClass:"mr-1",attrs:{icon:"",small:""},on:{click:e.cancelRename}},[n("span",{staticClass:"material-icons"},[e._v("close")])]),n("v-btn",{attrs:{icon:"",small:""},on:{click:e.saveName}},[n("span",{staticClass:"material-icons"},[e._v("check")])])],1)],1),n("v-btn",{staticClass:"settings-corner-close",attrs:{type:"button",fab:"","x-small":"",dark:"",ripple:!1,"aria-label":"Close"},on:{click:e.closeCanvasSettingsCard}},[n("v-icon",{attrs:{size:"16",color:"white"}},[e._v("mdi-close")])],1),n("div",{staticClass:"settings-panel-heading",on:{mousedown:e.startMenuDrag,contextmenu:function(e){e.preventDefault()}}},[n("span",{staticClass:"settings-panel-heading__title"},[e._v(e._s(e.mint))]),n("v-spacer"),n("v-btn",{staticClass:"settings-panel-apply-btn",attrs:{small:"",depressed:"",dark:"",color:"primary",disabled:!e.hasPendingSpecChanges},on:{click:e.applySettingsChanges}},[e._v(" Apply ")]),n("v-btn",{staticClass:"settings-panel-reset-btn",attrs:{small:"",depressed:"",dark:"",color:"orange darken-2"},on:{click:e.resetCanvasComponentToFactoryDefaults}},[e._v(" Reset ")])],1),e.isSidebarPlacementDefaultsPanel?e._e():n("div",{staticClass:"context-action-toolbar context-action-toolbar--panel"},[n("v-tooltip",{attrs:{bottom:""},scopedSlots:e._u([{key:"activator",fn:function(t){var r=t.on,o=t.attrs;return[n("v-btn",e._g(e._b({staticClass:"context-icon-btn",attrs:{id:"c
1ontext_button_copy",color:"white",depressed:""},on:{click:e.copyButton}},"v-btn",o,!1),r),[n("span",{staticClass:"material-icons primary--text"},[e._v("file_copy")])])]}}],null,!1,1136018289)},[n("span",[e._v("Duplicate the selected component (copy / paste flow)")])]),n("v-tooltip",{attrs:{bottom:""},scopedSlots:e._u([{key:"activator",fn:function(t){var r=t.on,o=t.attrs;return[n("v-btn",e._g(e._b({staticClass:"context-icon-btn",attrs:{id:"context_button_delete",color:"white",depressed:""},on:{click:e.deleteButton}},"v-btn",o,!1),r),[n("span",{staticClass:"material-icons primary--text"},[e._v("delete")])])]}}],null,!1,2427338900)},[n("span",[e._v("Remove this component from the device")])]),n("MoveDialog",{attrs:{component:e.currentComponent,"dialog-anchor":e.dialogAnchor},on:{close:e.closeContextMenu}}),n("ChangeAllDialog",{attrs:{component:e.currentComponent,"dialog-anchor":e.dialogAnchor},on:{close:e.closeContextMenu}}),n("v-tooltip",{attrs:{bottom:""},scopedSlots:e._u([{key:"activator",fn:function(t){var r=t.on,o=t.attrs;return[n("v-btn",e._g(e._b({staticClass:"context-icon-btn",attrs:{id:"context_button_showRename",color:"white",depressed:""},on:{click:function(t){e.showRename=!0}}},"v-btn",o,!1),r),[n("span",{staticClass:"material-icons primary--text"},[e._v("title")])])]}}],null,!1,2154860541)},[n("span",[e._v("Edit the component display name")])]),n("GenerateArrayDialog",{attrs:{component:e.currentComponent,"dialog-anchor":e.dialogAnchor},on:{close:e.closeContextMenu}})],1),n("v-card-text",{staticClass:"settings-panel-body component-context-settings-body"},[n("PropertyBlock",{attrs:{density:"sidebar",title:e.mint,"entity-id":e.canvasEntityId,spec:e.spec},on:{update:e.updateParameter}})],1)],1)},XC=[],YC=function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("v-dialog",{attrs:{"content-class":"draggable-dialog topleft-dialog move-component-context-dialog","hide-overlay":"",persistent:"","no-click-animation":"",width:"420"},scopedSlots:e._u([{key:"activator",fn:function(t){var r=t.on,o=t.attrs;return[n("v-tooltip",{attrs:{bottom:""},scopedSlots:e._u([{key:"activator",fn:function(t){var i=t.on,a=t.attrs;return[n("v-btn",e._g(e._b({staticClass:"context-icon-btn",attrs:{id:"context_button_move",color:"white",depressed:""}},"v-btn",Object.assign({},o,a),!1),Object.assign({},r,i)),[n("span",{staticClass:"material-icons primary--text"},[e._v("open_with")])])]}}],null,!0)},[n("span",[e._v("Move this component on the canvas (opens move tool)")])])]}}]),model:{value:e.dialog,callback:function(t){e.dialog=t},expression:"dialog"}},[n("v-card",[n("v-card-title",{staticClass:"text-h5 lighten-2"},[e._v("Move component")]),n("v-card-text",[n("v-row",{attrs:{align:"center"}},[n("v-col",{attrs:{cols:"12"}},[n("v-text-field",{attrs:{label:"X",suffix:"µm",dense:"","hide-details":"",outlined:"",placeholder:"0",type:"number",step:1},on:{change:e.updateComponent},model:{value:e.posX,callback:function(t){e.posX=t},expression:"posX"}})],1)],1),n("v-row",{attrs:{align:"center"}},[n("v-col",{attrs:{cols:"12"}},[n("v-text-field",{attrs:{label:"Y",suffix:"µm",dense:"","hide-details":"",outlined:"",placeholder:"0",type:"number",step:1},on:{change:e.updateComponent},model:{value:e.posY,callback:function(t){e.posY=t},expression:"posY"}})],1)],1)],1),n("v-divider"),n("v-card-actions",[n("v-spacer"),n("v-btn",{staticClass:"white--text",attrs:{color:"green"},on:{click:function(t){e.dialog=!1}}},[e._v("Save")]),n("v-btn",{staticClass:"white--text ml-9",attrs:{color:"red"},on:{click:e.cancelMove}},[e._v("Cancel")])],1)],1)],1)},GC=[];n("5363");function UC(e,t){var n="undefined"!==typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=zC(e))||t&&e&&"number"===typeof e.length){n&&(e=n);var r=0,o=function(){};return{s:o,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,l=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return a=e.done,e},e:function(e){l=!0,i=e},f:function(){try{a||null==n.return||n.return()}finally{if(l)throw i}}}}function zC(e,t){if(e){if("string"===typeof e)return HC(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?HC(e,t):void 0}}function HC(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function KC(e){var t,n,r=null===(t=Pd.viewManager)||void 0===t?void 0:t.view;if(!r||"function"!==typeof r.getRenderedFeature||null===e||void 0===e||null===(n=e.featureIDs)||void 0===n||!n.length)return null;var o,i=1/0,a=1/0,l=-1/0,s=-1/0,c=UC(e.featureIDs);try{for(c.s();!(o=c.n()).done;){var u=o.value,h=r.getRenderedFeature(u);if(h&&h.bounds)for(var f=h.bounds,d=h.parent,p=[f.topLeft,f.topRight,f.bottomLeft,f.bottomRight],m=0;m<p.length;m++){var v=d&&d.localToGlobal?d.localToGlobal(p[m]):h.localToGlobal(p[m]);v.x<i&&(i=v.x),v.y<a&&(a=v.y),v.x>l&&(l=v.x),v.y>s&&(s=v.y)}}}catch(g){c.e(g)}finally{c.f()}return Number.isFinite(i)&&Number.isFinite(a)?new y.a.Rectangle(i,a,l-i,s-a):null}function qC(e){try{var t,n,r;if(!e)return null;var o=KC(e);if(!o)return null;var i=o.bottomRight,a=y.a.view.projectToView(i),l=(null===(t=y.a.view)||void 0===t?void 0:t.element)||(null===(n=Pd.viewManager)||void 0===n||null===(r=n.view)||void 0===r?void 0:r.canvas);if(!l)return null;var s=l.getBoundingClientRect();return{left:s.left+a.x,top:s.top+a.y}}catch(c){return null}}function JC(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:8,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:12;if(e&&t){var o=function(){var o=document.querySelector(".".concat(t));if(o){var i=o.getBoundingClientRect(),a=i.width||400,l=e.left+n,s=Math.max(r,e.top+n);l+a+r>window.innerWidth&&(l=Math.max(r,window.innerWidth-a-r)),l=Math.max(r,l),o.style.position="fixed",o.style.left="".concat(l,"px"),o.style.top="".concat(s,"px"),o.style.margin="0"}};requestAnimationFrame((function(){o(),requestAnimationFrame(o)}))}}var ZC={name:"MoveDialog",props:{component:{type:Ep,required:!0,default:null},dialogAnchor:{type:Object,default:null}},data:function(){return{dialog:!1,callbacks:{},posX:0,posY:0}},watch:{dialog:function(e){var t=this;e?(this.syncPositionFieldsFromComponent(),$y.get().emit($y.SIDEBAR_SETTINGS_OPENED,{mint:null}),this.$emit("close"),Pd.viewManager.activateTool("MoveTool"),Pd.viewManager.tools.MoveTool.activate(this.component,this.toolCallback),$y.get().on($y.UPDATE_RENDERS,this._onMoveCanvasUpdate),$y.get().on($y.UPDATE_ZOOM,this._onMoveCanvasUpdate),this.$nextTick((function(){t.repositionMoveDialog(),t.$nextTick((function(){return t.repositionMoveDialog()}))}))):($y.get().off($y.UPDATE_RENDERS,this._onMoveCanvasUpdate),$y.get().off($y.UPDATE_ZOOM,this._onMoveCanvasUpdate),Pd.viewManager.tools.MoveTool.deactivate(),Pd.viewManager.view.clearSelectedItems(),$y.get().emit($y.SIDEBAR_COMPONENT_ACTIVATED,{mint:null}),$y.get().emit($y.SIDEBAR_SETTINGS_OPENED,{mint:null}))},dialogAnchor:function(){var e=this;this.dialog&&this.$nextTick((function(){return e.repositionMoveDialog()}))}},created:function(){var e=this;this._onMoveCanvasUpdate=function(){e.dialog&&e.$nextTick((function(){return e.repositionMoveDialog()}))}},mounted:function(){(function(){var e={};document.addEventListener("mousedown",(function(t){var n=t.target.closest(".move-component-context-dialog.draggable-dialog");0===t.button&&null!==n&&t.target.classList.contains("v-card__title")&&(e.el=n,e.mouseStartX=t.clientX,e.mouseStartY=t.clientY,e.elStartX=e.el.getBoundingClientRect().left,e.elStartY=e.el.getBoundingClientRect().top,e.el.style.position="fixed",e.el.style.margin=0,e.oldTransition=e.el.style.transition,e.el.style.transition="none")})),document.addEventListener("mousemove",(function(t){void 0!==e.el&&(e.el.style.left=Math.min(Math.max(e.elStartX+t.clientX-e.mouseStartX,0),window.innerWidth-e.el.getBoundingClientRect().width)+"px",e.el.style.top=Math.min(Math.max(e.elStartY+t.clientY-e.mouseStartY,0),window.innerHeight-e.el.getBoundingClientRect().height)+"px")})),document.addEventListener("mouseup",(function(){void 0!==e.el&&(e.el.style.transition=e.oldTransition,e.el=void 0)}))})()},beforeDestroy:function(){$y.get().off($y.UPDATE_RENDERS,this._onMoveCanvasUpdate),$y.get().off($y.UPDATE_ZOOM,this._onMoveCanvasUpdate)},methods:{repositionMoveDialog:function(){var e=qC(this.component)||this.dialogAnchor;JC(e,"move-component-context-dialog")},syncPositionFieldsFromComponent:function(){var e=this.component.getCenterPosition(),t=Array.isArray(e)?e[0]:null===e||void 0===e?void 0:e.x,n=Array.isArray(e)?e[1]:null===e||void 0===e?void 0:e.y;this.posX=Math.round(Number(t)||0),this.posY=Math.round(Number(n)||0)},cancelMove:function(){Pd.viewManager.tools.MoveTool.revertToOriginalPosition(),this.syncPositionFieldsFromComponent(),this.dialog=!1},toolCallback:function(e,t){this.posX=Math.round(Number(e)),this.posY=Math.round(Number(t))},updateComponent:function(){var e=Math.round(Number(this.posX)),t=Math.round(Number(this.posY));this.posX=e,this.posY=t,this.component.updateComponentPosition([e,t])}}},$C=ZC,QC=(n("49ab"),n("62ad")),eO=n("169a"),tO=n("ce7e"),nO=n("0fd9"),rO=n("2fa4"),oO=n("8654"),iO=Object(CC["a"])($C,YC,GC,!1,null,"19b0e9ca",null),aO=iO.exports;SC()(iO,{VBtn:DC["a"],VCard:RC["a"],VCardActions:TC["a"],VCardText:TC["b"],VCardTitle:TC["c"],VCol:QC["a"],VDialog:eO["a"],VDivider:tO["a"],VRow:nO["a"],VSpacer:rO["a"],VTextField:oO["a"],VTooltip:FC["a"]});var lO=function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("v-dialog",{attrs:{"content-class":"change-all-context-dialog",width:"500"},scopedSlots:e._u([{key:"activator",fn:function(t){var r=t.on,o=t.attrs;return[n("v-tooltip",{attrs:{bottom:""},scopedSlots:e._u([{key:"activator",fn:function(t){var i=t.on,a=t.attrs;return[n("v-btn",e._g(e._b({staticClass:"context-icon-btn",attrs:{id:"c
1ontext_button_copytoall",color:"white",depressed:""}},"v-btn",Object.assign({},o,a),!1),Object.assign({},r,i)),[n("span",{staticClass:"material-icons primary--text"},[e._v("select_all")])])]}}],null,!0)},[n("span",[e._v("Copy this component's parameters to other instances of the same type")])])]}}]),model:{value:e.dialog,callback:function(t){e.dialog=t},expression:"dialog"}},[n("v-card",[n("v-card-title",{staticClass:"text-h5 lighten-2"},[e._v(" Change All Components: ")]),n("v-card-text"),n("table",[n("tr",[n("th",{staticClass:"font-weight-bold pl-10 pt-4 pb-2"},[n("input",{directives:[{name:"model",rawName:"v-model",value:e.selectAll,expression:"selectAll"}],attrs:{type:"checkbox"},domProps:{checked:Array.isArray(e.selectAll)?e._i(e.selectAll,null)>-1:e.selectAll},on:{change:function(t){var n=e.selectAll,r=t.target,o=!!r.checked;if(Array.isArray(n)){var i=null,a=e._i(n,i);r.checked?a<0&&(e.selectAll=n.concat([i])):a>-1&&(e.selectAll=n.slice(0,a).concat(n.slice(a+1)))}else e.selectAll=o}}}),n("span",{staticClass:"pl-1"},[e._v("Select")])]),n("th",{staticClass:"font-weight-bold pl-15 pt-4 pb-2"},[e._v("Name")])]),e._l(e.components,(function(t){return n("tr",{key:t.id},[n("td",{staticClass:"pl-15 pb-2"},[n("input",{directives:[{name:"model",rawName:"v-model",value:e.selected,expression:"selected"}],attrs:{type:"checkbox"},domProps:{value:t.id,checked:Array.isArray(e.selected)?e._i(e.selected,t.id)>-1:e.selected},on:{change:function(n){var r=e.selected,o=n.target,i=!!o.checked;if(Array.isArray(r)){var a=t.id,l=e._i(r,a);o.checked?l<0&&(e.selected=r.concat([a])):l>-1&&(e.selected=r.slice(0,l).concat(r.slice(l+1)))}else e.selected=i}}})]),n("td",{staticClass:"pl-15 pb-2"},[e._v(e._s(t.name))])])}))],2),n("v-divider"),n("v-card-actions",[n("v-spacer"),n("v-btn",{staticClass:"white--text",attrs:{color:"green"},on:{click:e.onSave}},[e._v(" Change ")]),n("v-btn",{staticClass:"white--text ml-9",attrs:{color:"red"},on:{click:function(t){e.dialog=!1}}},[e._v(" Cancel ")])],1)],1)],1)},sO=[];function cO(e,t){var n="undefined"!==typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=uO(e))||t&&e&&"number"===typeof e.length){n&&(e=n);var r=0,o=function(){};return{s:o,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,l=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return a=e.done,e},e:function(e){l=!0,i=e},f:function(){try{a||null==n.return||n.return()}finally{if(l)throw i}}}}function uO(e,t){if(e){if("string"===typeof e)return hO(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?hO(e,t):void 0}}function hO(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var fO={name:"ChangeAllDialog",props:{component:{type:Ep,required:!0},dialogAnchor:{type:Object,default:null}},data:function(){return{activated:!1,components:[{id:"Bettercomponent_1",name:"Bettercomponent_1"},{id:"Bettercomponent_2",name:"Bettercomponent_2"}],selected:[],callbacks:{},dialog:!1}},computed:{selectAll:{get:function(){return!!this.components&&this.selected.length==this.components.length},set:function(e){var t=[];e&&this.components.forEach((function(e){t.push(e.id)})),this.selected=t}}},watch:{dialog:function(e){var t=this;if(e){$y.get().emit($y.SIDEBAR_SETTINGS_OPENED,{mint:null}),this.$emit("close");for(var n=this.component.mint,r=Pd.currentDevice.components,o=[],i=0;i<r.length;i++)r[i].mint===n&&this.component.id!==r[i].id&&o.push(r[i]);this.components=o.map((function(e){return{id:e.id,name:e.name}})),$y.get().on($y.UPDATE_RENDERS,this._onChangeAllCanvasUpdate),$y.get().on($y.UPDATE_ZOOM,this._onChangeAllCanvasUpdate),this.$nextTick((function(){t.repositionChangeAllDialog(),t.$nextTick((function(){return t.repositionChangeAllDialog()}))}))}else $y.get().off($y.UPDATE_RENDERS,this._onChangeAllCanvasUpdate),$y.get().off($y.UPDATE_ZOOM,this._onChangeAllCanvasUpdate),this.components=[]},dialogAnchor:function(){var e=this;this.dialog&&this.$nextTick((function(){return e.repositionChangeAllDialog()}))}},created:function(){var e=this;this._onChangeAllCanvasUpdate=function(){e.dialog&&e.$nextTick((function(){return e.repositionChangeAllDialog()}))}},mounted:function(){var e=this;this._closeAllHandler=function(){e.dialog=!1},$y.get().on($y.CLOSE_ALL_WINDOWS,this._closeAllHandler),l["default"].set(this.callbacks,"close",(function(t){t&&t(),e.dialog=!1,e.selected=[]}))},beforeDestroy:function(){this._closeAllHandler&&$y.get().off($y.CLOSE_ALL_WINDOWS,this._closeAllHandler),$y.get().off($y.UPDATE_RENDERS,this._onChangeAllCanvasUpdate),$y.get().off($y.UPDATE_ZOOM,this._onChangeAllCanvasUpdate)},methods:{repositionChangeAllDialog:function(){var e=qC(this.component)||this.dialogAnchor;JC(e,"change-all-context-dialog")},onSave:function(){console.log("Saved data for Change All Components");var e=this.component.params;for(var t in this.selected){var n,r=Pd.currentDevice.getComponentByID(this.selected[t]),o=cO(e.heritable);try{for(o.s();!(n=o.n()).done;){var i=n.value,a=e.getValue(i);r.updateParameter(i,a)}}catch(l){o.e(l)}finally{o.f()}}this.dialog=!1}}},dO=fO,pO=(n("a200"),Object(CC["a"])(dO,lO,sO,!1,null,"7d310357",null)),yO=pO.exports;SC()(pO,{VBtn:DC["a"],VCard:RC["a"],VCardActions:TC["a"],VCardText:TC["b"],VCardTitle:TC["c"],VDialog:eO["a"],VDivider:tO["a"],VSpacer:rO["a"],VTooltip:FC["a"]});var mO=function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("div",{staticClass:"property-block-scroll-shell",class:{"property-block-scroll-shell--limited":e.shouldLimitScroll}},[n("v-simple-table",{class:e.tableClass,attrs:{dense:"","fixed-header":""}},[[n("thead",[n("tr",[n("th",{staticClass:"param-col"},[e._v("Parameter")]),n("th",{staticClass:"value-col"},[e._v("Value")])])]),n("tbody",[e.entityId?n("tr",[n("td",{staticClass:"param-col"},[n("div",{staticClass:"d-flex align-center flex-nowrap param-name-with-help"},[n("code",{staticClass:"param-name-code"},[e._v("ID")]),n("v-tooltip",{attrs:{bottom:"","max-width":"320"},scopedSlots:e._u([{key:"activator",fn:function(t){var r=t.on,o=t.attrs;return[n("v-icon",e._g(e._b({staticClass:"param-help-icon ml-1",attrs:{small:"",dense:"",color:"grey darken-1"}},"v-icon",o,!1),r),[e._v(" mdi-help-circle-outline ")])]}}],null,!1,1619185510)}
1,[n("span",[e._v(e._s(e.parameterHelp("ID")))])])],1)]),n("td",{staticClass:"value-col"},[n("v-text-field",{staticClass:"param-id-field",attrs:{value:e.entityId,dense:"","hide-details":"",outlined:"",readonly:""}})],1)]):e._e(),e._l(e.displaySpec,(function(t){return n("tr",{key:t.name},[n("td",{staticClass:"param-col"},[n("div",{staticClass:"d-flex align-center flex-nowrap param-name-with-help"},[n("code",{staticClass:"param-name-code"},[e._v(e._s(t.name))]),n("v-tooltip",{attrs:{bottom:"","max-width":"320"},scopedSlots:e._u([{key:"activator",fn:function(t){var r=t.on,o=t.attrs;return[n("v-icon",e._g(e._b({staticClass:"param-help-icon ml-1",attrs:{small:"",dense:"",color:"grey darken-1"}},"v-icon",o,!1),r),[e._v(" mdi-help-circle-outline ")])]}}],null,!0)},[n("span",[e._v(e._s(e.parameterHelp(t.name)))])])],1)]),n("td",{staticClass:"value-col"},[n("div",{staticClass:"value-with-unit"},[n("v-text-field",{attrs:{step:"any",type:"number",dense:"","hide-details":"",outlined:""},on:{change:function(n){return e.paramChanged(t.value,t.name)}},model:{value:t.value,callback:function(n){e.$set(t,"value",n)},expression:"item.value"}}),t.units?n("span",{staticClass:"param-unit"},[e._v(e._s(t.units))]):e._e()],1)])])}))],2)]],2)],1)},vO=[],gO={crossSection:"Channel type for Connection routes: 0 = rectangular cross-section with square (flat) ends in the layout view; 1 = rounded type with semicircular ends (stadium outline), consistent with a circular channel cross-section. JSON keeps this key; MINT writes RoundedChannel=1/0.",channelWidth:"In-plane width of the microfluidic channel (perpendicular to flow in the top view).",height:"Vertical depth (z-span) of the feature on the active layer, used for 3D export and layer offsets.",connectionSpacing:"Minimum spacing kept between separate connection routes when autorouting or editing.",componentSpacing:"Keepout halo around the component body (µm). Place-and-route keeps other components and channel bodies outside this band. Users and DIY components may override the default.",channelRadius:"Radius of a circular channel cross-section; the tool keeps width and depth consistent with this radius.",bendSpacing:"Distance between consecutive bends in a serpentine or curved path.",numberOfBends:"Count of 180° bends in the mixer or channel path.",bendLength:"Straight segment length used for each full mixer bend.",edgeBend1:"Length of the incomplete tip stub past mixer port 1 (outward from the port). Independent of edgeBend2. Set to half the connecting channel width so the tip wraps that pipe.",edgeBend2:"Length of the incomplete tip stub past mixer port 2 (outward from the port). Independent of edgeBend1. Set to half the connecting channel width so the tip wraps that pipe.",rotation:"Rotation angle of the placed feature in the layout plane.",position:"Placement anchor position of the component or feature.",length:"Overall length along the dominant axis. On a MUX this is the valve pad (use valveWidthY). On CHANNEL this is a minimum route length. On old 3DuF device JSON, length was canvas height (now y-span).",width:"Overall width of the geometry in the layout plane.",depth:"Depth or thickness of the structure where applicable.",radius:"Corner or fillet radius for rounded geometry.",diameter:"Diameter of circular ports, chambers, or pillars.",spacing:"BANK instance spacing, or a pump/chamber pitch. MUX/TREE/YTREE use leafSpace.",leafPitch:"Legacy MUX leaf spacing; use leafSpace.",leafSpace:"Leaf spacing of MUX, TREE, and YTREE. This sets how far apart adjacent leaves sit. Independent of BANK spacing.",stageLength:"Legacy along-tree stage spacing; use stageSpace.",stageSpace:"Along-tree spacing of successive MUX/TREE/YTREE flow stages.",valveRadius:"Radius of the circular valve membrane or actuation region.",flowChannelWidth:"Width of the primary fluidic channel on the flow layer.",controlChannelWidth:"Width of the pneumatic control channel on the control layer.",chamberLength:"Length of the reaction or trapping chamber.",chamberWidth:"Width of the reaction or trapping chamber.",inletLength:"Length of the inlet channel segment before the main body.",outletLength:"Length of the outlet channel segment after the main body.",portRadius:"Radius of a circular port opening.",numberOfCells:"Number of trapping cells or chambers in the array.",cellWidth:"Width of a single cell trap or compartment.",cellHeight:"Height of a single cell trap or compartment.",pillarDiameter:"Diameter of filter or mixer pillars.",filterLength:"Length of the porous filter region along flow.",levelNumber:"Number of stacked filter or routing levels.",valvespacing:"Center-to-center spacing between adjacent valves.",numberOfLeafs:"Number of outlet branches in a tree or mux.",leafs:"Number of branches (legacy parameter name) in a distribution tree.",oilInputWidth:"Width of the oil inlet arm in droplet generators.",waterInputWidth:"Width of the aqueous inlet arm in droplet generators.",orificeLength:"Length of the nozzle orifice where droplets pinch off.",outputLength:"Length of the outlet channel after the nozzle.",nozzleLength:"Length of the injection nozzle in picoinjector or merger layouts.",injectorLength:"Length of the side injection channel.",dropletWidth:"Target droplet diameter or width in droplet circuits.",chemostatLength:"Characteristic length of the chemostat ring segment.",chemostatChannelWidth:"Channel width inside the chemostat ring.",gradientSpacing:"Spacing between parallel branches in a gradient generator.",numberOfSteps:"Number of dilution or mixing steps in a gradient network.",valveWidth:"Width of a rectangular valve pad or seat in the layout plane.",valveWidthX:"Left-right size of the MUX valve pad.",valveWidthY:"Up-down size of the MUX valve pad.",valveLength:"Length of the valve channel segment.",pumpRadius:"Radius of the pump chamber or rotor feature.",pumpSpacing:"Spacing between pump stages or chambers.",membraneThickness:"Thickness of the deformable membrane in valve models.",text:"Text label rendered on the device layout.",fontSize:"Font size for rendered text labels.",xspan:"Horizontal span of the device or bounding region.",yspan:"Vertical span of the device or bounding region.",borderWidth:"Width of the device border outline.",borderColor:"Color key or index used for the device border.",ID:"Netlist identifier from the imported JSON (component or connection id). Use this to find the same object in the Parchmint file."},wO={Connection:{connectionSpacing:"Minimum clearance enforced between separate connection paths on the canvas.",channelWidth:"Drawn width of the routed connection segment in the plane of the flow layer.",height:"Extruded depth used when exp
1orting or stacking this connection geometry.",channelRadius:"For a rounded channel type, half of the effective channel width; width and depth follow this radius."},"ALIGNMENT MARKS":{width:"Width of the alignment mark pattern.",height:"Height of the alignment mark pattern."},MUX:{leafPitch:"Legacy MUX leaf spacing; use leafSpace.",leafSpace:"Distance between adjacent MUX leaf ports. Edit this to widen or tighten the tree.",valveWidthX:"Left-right size of each control valve pad. Increase this to stretch the valve horizontally.",valveWidthY:"Up-down size of each control valve pad. Increase this to stretch the valve vertically.",valveWidth:"Legacy single valve width; use valveWidthX.",width:"Legacy left-right valve size; use valveWidthX.",length:"Legacy up-down valve size; use valveWidthY.",stageLength:"Legacy MUX/TREE stage spacing; use stageSpace.",stageSpace:"Along-tree spacing of successive flow stages."}};function bO(e){return"Controls the â".concat(e,"â parameter for this feature. Adjust the slider or numeric field to tune geometry or layout.")}function _O(e,t){var n=(e||"").trim(),r=t,o=wO[n];if(o&&o[r])return o[r];if(gO[r])return gO[r];for(var i=n.toUpperCase(),a=0,l=Object.keys(wO);a<l.length;a++){var s=l[a];if(s.toUpperCase()===i&&wO[s][r])return wO[s][r]}return bO(r)}function PO(e){return DO(e)||SO(e)||OO(e)||CO()}function CO(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function OO(e,t){if(e){if("string"===typeof e)return RO(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?RO(e,t):void 0}}function SO(e){if("undefined"!==typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}function DO(e){if(Array.isArray(e))return RO(e)}function RO(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var TO={in:10,out:11,leafs:12,numberOfBends:13,flowChannelWidth:20,controlChannelWidth:21,channelWidth:22,channelRadius:23,gap:24,oilInputWidth:25,waterInputWidth:26,outputWidth:27,outputLength:28,orificeSize:29,orificeLength:30,leafPitch:35,leafSpace:35,stageLength:36,stageSpace:36,spacing:37,valveWidthX:40,valveWidthY:41,valveWidth:42,width:43,length:44,valveRadius:45,bendSpacing:50,bendLength:51,edgeBend:52,edgeBend1:53,edgeBend2:54,portRadius:60,height:61,radius:62,rotation:80,mirrorByX:81,mirrorByY:82,componentSpacing:900,connectionSpacing:901};function LO(e){return Object.prototype.hasOwnProperty.call(TO,e)?TO[e]:100}function FO(e){return PO(e).sort((function(e,t){var n=String(e&&e.name?e.name:""),r=String(t&&t.name?t.name:""),o=LO(n),i=LO(r);return o!==i?o-i:n.localeCompare(r)}))}var kO=new Set(["connectionSpacing","ID"]),EO=5,NO={name:"PropertyBlock",props:{title:{type:String,required:!0,default:"UnSet"},density:{type:String,default:"default",validator:function(e){return-1!==["default","context","sidebar"].indexOf(e)}},entityId:{type:String,default:""},spec:{type:Array,required:!0,validator:function(e){return Array.isArray(e)?(e.forEach((function(e){["min","max","units","value"].forEach((function(t){if(!Object.hasOwnProperty.call(e,t))return console.error("Missing key "+t+" from item",e),"danger"}))})),"success"):(console.error("PropertyDrawer: Spec is not an array, unable to validate"),"danger")}}},data:function(){return{}},computed:{tableClass:function(){return["table","property-block-settings","property-block--".concat(this.density)]},displaySpec:function(){return FO(this.spec.filter((function(e){return e&&e.name&&!kO.has(e.name)})))},shouldLimitScroll:function(){return this.displaySpec.length>EO}},methods:{parameterHelp:function(e){return _O(this.title,e)},paramChanged:function(e,t){console.log("paramChanged",e,t),this.$emit("update",e,t)}}},xO=NO,MO=(n("439e"),n("132d")),IO=n("1f4f"),WO=Object(CC["a"])(xO,mO,vO,!1,null,"82cc2bf2",null),AO=WO.exports;SC()(WO,{VIcon:MO["a"],VSimpleTable:IO["a"],VTextField:oO["a"],VTooltip:FC["a"]});var jO=function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("v-dialog",{attrs:{"content-class":"draggable-dialog topleft-dialog generate-array-context-dialog","hide-overlay":"",persistent:"","no-click-animation":"",width:"300px"},scopedSlots:e._u([{key:"activator",fn:function(t){var r=t.on,o=t.attrs;return[n("v-tooltip",{attrs:{bottom:""},scopedSlots:e._u([{key:"activator",fn:function(t){var i=t.on,a=t.attrs;return[n("v-btn",e._g(e._b({staticClass:"context-icon-btn",attrs:{id:"c
1ontext_button_array",color:"white",depressed:""}},"v-btn",Object.assign({},o,a),!1),Object.assign({},r,i)),[n("span",{staticClass:"material-icons primary--text"},[e._v("view_comfy")])])]}}],null,!0)},[n("span",[e._v("Create a grid of copies with spacing you choose (opens array tool)")])])]}}]),model:{value:e.dialog,callback:function(t){e.dialog=t},expression:"dialog"}},[n("v-card",[n("v-card-title",{staticClass:"text-h5 lighten-2"},[e._v(" Generate Array ")]),n("v-card-text",[n("v-row",[e._v(" Generate: ")]),n("v-row",[n("v-text-field",{attrs:{label:"Dim X",type:"number",step:"1",min:"1",required:""},model:{value:e.dimx,callback:function(t){e.dimx=t},expression:"dimx"}}),n("v-text-field",{attrs:{label:"Dim Y",type:"number",step:"1",min:"1",required:""},model:{value:e.dimy,callback:function(t){e.dimy=t},expression:"dimy"}})],1),n("v-row",[e._v(" Spacing: ")]),n("v-row",[n("v-text-field",{attrs:{label:"X Spacing (mm)",type:"number",step:"1",min:"0",required:""},model:{value:e.spacingX,callback:function(t){e.spacingX=t},expression:"spacingX"}}),n("v-text-field",{attrs:{label:"Y Spacing (mm)",type:"number",step:"1",min:"0",required:""},model:{value:e.spacingY,callback:function(t){e.spacingY=t},expression:"spacingY"}})],1)],1),n("v-divider"),n("v-card-actions",[n("v-spacer"),n("v-btn",{staticClass:"white--text",attrs:{color:"green"},on:{click:e.onSave}},[e._v(" Save ")]),n("v-btn",{staticClass:"white--text ml-9",attrs:{color:"red"},on:{click:function(t){e.dialog=!1}}},[e._v(" Cancel ")])],1)],1)],1)},BO=[],VO={name:"GenerateArrayDialog",props:{component:{type:Ep,required:!0},dialogAnchor:{type:Object,default:null}},data:function(){return{dialog:!1,activated:!1,callbacks:{},number:0,dimx:1,dimy:1,spacingX:10,spacingY:10}},watch:{dialog:function(e){var t=this;e?($y.get().emit($y.SIDEBAR_SETTINGS_OPENED,{mint:null}),this.$emit("close"),Pd.viewManager.activateTool("GenerateArrayTool"),Pd.viewManager.tools.GenerateArrayTool.activate(this.component),$y.get().on($y.UPDATE_RENDERS,this._onArrayCanvasUpdate),$y.get().on($y.UPDATE_ZOOM,this._onArrayCanvasUpdate),this.$nextTick((function(){t.repositionArrayDialog(),t.$nextTick((function(){return t.repositionArrayDialog()}))}))):($y.get().off($y.UPDATE_RENDERS,this._onArrayCanvasUpdate),$y.get().off($y.UPDATE_ZOOM,this._onArrayCanvasUpdate),Pd.viewManager.tools.GenerateArrayTool.deactivate())},dialogAnchor:function(){var e=this;this.dialog&&this.$nextTick((function(){return e.repositionArrayDialog()}))}},created:function(){var e=this;this._onArrayCanvasUpdate=function(){e.dialog&&e.$nextTick((function(){return e.repositionArrayDialog()}))}},mounted:function(){var e=this;l["default"].set(this.callbacks,"close",(function(t){t&&t(),e.activated=!1})),function(){var e={};document.addEventListener("mousedown",(function(t){var n=t.target.closest(".generate-array-context-dialog.draggable-dialog");0===t.button&&null!==n&&t.target.classList.contains("v-card__title")&&(e.el=n,e.mouseStartX=t.clientX,e.mouseStartY=t.clientY,e.elStartX=e.el.getBoundingClientRect().left,e.elStartY=e.el.getBoundingClientRect().top,e.el.style.position="fixed",e.el.style.margin=0,e.oldTransition=e.el.style.transition,e.el.style.transition="none")})),document.addEventListener("mousemove",(function(t){void 0!==e.el&&(e.el.style.left=Math.min(Math.max(e.elStartX+t.clientX-e.mouseStartX,0),window.innerWidth-e.el.getBoundingClientRect().width)+"px",e.el.style.top=Math.min(Math.max(e.elStartY+t.clientY-e.mouseStartY,0),window.innerHeight-e.el.getBoundingClientRect().height)+"px")})),document.addEventListener("mouseup",(function(){void 0!==e.el&&(e.el.style.transition=e.oldTransition,e.el=void 0)})),setInterval((function(){var e=document.querySelector(".generate-array-context-dialog.draggable-dialog");if(null!==e){var t=parseInt(e.style.left,10);Number.isNaN(t)||(e.style.left=Math.min(Math.max(t,0),window.innerWidth-e.getBoundingClientRect().width)+"px")}}),100)}()},beforeDestroy:function(){$y.get().off($y.UPDATE_RENDERS,this._onArrayCanvasUpdate),$y.get().off($y.UPDATE_ZOOM,this._onArrayCanvasUpdate)},methods:{repositionArrayDialog:function(){var e=qC(this.component)||this.dialogAnchor;JC(e,"generate-array-context-dialog")},onSave:function(){console.log("Saved data for Generate array"),Pd.viewManager.tools.GenerateArrayTool.generateArray(this.dimx,this.dimy,1e3*this.spacingX,1e3*this.spacingY),this.dialog=!1}}},XO=VO,YO=(n("899d"),Object(CC["a"])(XO,jO,BO,!1,null,"2d5726a4",null)),GO=YO.exports;function UO(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function zO(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};
1t%2?UO(Object(n),!0).forEach((function(t){HO(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):UO(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function HO(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function KO(e,t){var n="undefined"!==typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=qO(e))||t&&e&&"number"===typeof e.length){n&&(e=n);var r=0,o=function(){};return{s:o,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,l=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return a=e.done,e},e:function(e){l=!0,i=e},f:function(){try{a||null==n.return||n.return()}finally{if(l)throw i}}}}function qO(e,t){if(e){if("string"===typeof e)return JO(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?JO(e,t):void 0}}function JO(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}SC()(YO,{VBtn:DC["a"],VCard:RC["a"],VCardActions:TC["a"],VCardText:TC["b"],VCardTitle:TC["c"],VDialog:eO["a"],VDivider:tO["a"],VRow:nO["a"],VSpacer:rO["a"],VTextField:oO["a"],VTooltip:FC["a"]});var ZO={name:"ComponentContextMenu",components:{MoveDialog:aO,ChangeAllDialog:yO,PropertyBlock:AO,GenerateArrayDialog:GO},data:function(){return{mint:"",spec:[{min:0,max:110,units:"",value:0}],activeMenu:!1,activeChange:!1,activeMove:!1,activeCopy:!1,showRename:!1,componentName:"",featureRef:null,marginLeft:500,marginTop:100,currentComponent:new Ep(new _f({},new Map,new Map),"",""),dialogAnchor:null,menuPointerAnchor:null,isSidebarPlacementDefaultsPanel:!1,sidebarPlacementAnchor:null,appliedSidebarSpecSnapshot:{},appliedCanvasSpecSnapshot:{},isManualMenuPosition:!1,isDraggingMenu:!1,dragStartPointer:null,dragStartMenuPosition:null}},computed:{hasPendingPlacementSpecChanges:function(){if(!this.isSidebarPlacementDefaultsPanel)return!1;var e=this.specToValueSnapshot(this.spec),t=this.appliedSidebarSpecSnapshot||{};return JSON.stringify(e)!==JSON.stringify(t)},hasPendingCanvasSpecChanges:function(){if(this.isSidebarPlacementDefaultsPanel)return!1;var e=this.specToValueSnapshot(this.spec),t=this.appliedCanvasSpecSnapshot||{};return JSON.stringify(e)!==JSON.stringify(t)},hasPendingSpecChanges:function(){return this.isSidebarPlacementDefaultsPanel?this.hasPendingPlacementSpecChanges:this.hasPendingCanvasSpecChanges},canvasEntityId:function(){if(this.isSidebarPlacementDefaultsPanel)return"";var e=this.currentComponent;return e&&(e.id||e.name)||""},cardPositionStyle:function(){var e="min(420px, calc(100vw - 24px))";return{position:"fixed",left:this.marginLeft+"px",top:this.marginTop+"px",zIndex:200,maxWidth:e,width:e}}},mounted:function(){var e=this;this._onCloseAllWindows=function(){e.dismissCanvasSettingsPopup()},this._onConnectionSettingsOpened=function(){e.activeMenu&&e.dismissCanvasSettingsPopup()},this._onSidebarSettingsOpened=function(t){e.applySidebarSettingsOpenedPayload(t)},this._onPlacementSettingsReposition=function(t){if(e.activeMenu&&e.isSidebarPlacementDefaultsPanel&&!e.isManualMenuPosition){var n=t&&t.anchor;n&&(e.sidebarPlacementAnchor=n,e.$nextTick((function(){return e.positionMenuForSidebarAnchor(n)})))}},this._onSidebarPlacementForClose=function(t){var n=t&&t.mint;if(null!=n&&""!==n&&(!e.isSidebarPlacementDefaultsPanel||n!==e.mint)){var r=e.isSidebarPlacementDefaultsPanel;e.activeMenu&&e.dismissCanvasSettingsPopup(),r&&$y.get().emit($y.SIDEBAR_SETTINGS_OPENED,{mint:null})}},$y.get().on($y.CLOSE_ALL_WINDOWS,this._onCloseAllWindows),$y.get().on($y.DBL_CLICK_COMPONENT,this.activateMenu),$y.get().on($y.DBL_CLICK_CONNECTION,this._onConnectionSettingsOpened),$y.get().on($y.SIDEBAR_SETTINGS_OPENED,this._onSidebarSettingsOpened),$y.get().on($y.SIDEBAR_PLACEMENT_SETTINGS_REPOSITION,this._onPlacementSettingsReposition),$y.get().on($y.SIDEBAR_COMPONENT_ACTIVATED,this._onSidebarPlacementForClose),this._onUpdateZoom=function(){e.activeMenu&&e.$nextTick((function(){e.isManualMenuPosition||(e.isSidebarPlacementDefaultsPanel&&e.sidebarPlacementAnchor?e.positionMenuForSidebarAnchor(e.sidebarPlacementAnchor):e.positionMenuNearComponent())}))},this._onUpdateRenders=function(){e.activeMenu&&e.$nextTick((function(){e.isManualMenuPosition||(e.isSidebarPlacementDefaultsPanel&&e.sidebarPlacementAnchor?e.positionMenuForSidebarAnchor(e.sidebarPlacementAnchor):e.positionMenuNearComponent())}))},$y.get().on($y.UPDATE_ZOOM,this._onUpdateZoom),$y.get().on($y.UPDATE_RENDERS,this._onUpdateRenders)},beforeDestroy:function(){$y.get().off($y.CLOSE_ALL_WINDOWS,this._onCloseAllWindows),$y.get().off($y.DBL_CLICK_COMPONENT,this.activateMenu),$y.get().off($y.DBL_CLICK_CONNECTION,this._onConnectionSettingsOpened),$y.get().off($y.SIDEBAR_SETTINGS_OPENED,this._onSidebarSettingsOpened),$y.get().off($y.SIDEBAR_PLACEMENT_SETTINGS_REPOSITION,this._onPlacementSettingsReposition),$y.get().off($y.SIDEBAR_COMPONENT_ACTIVATED,this._onSidebarPlacementForClose),$y.get().off($y.UPDATE_ZOOM,this._onUpdateZoom),$y.get().off($y.UPDATE_RENDERS,this._onUpdateRenders),this.stopMenuDrag()},methods:{startMenuDrag:function(e){if(e&&(0===e.button||2===e.button)){var t=e.target;t&&"function"===typeof t.closest&&t.closest(".settings-panel-heading")&&(t.closest(".v-btn, button, input, textarea, select, .v-input, .v-slider, .property-block-scroll-shell--limited")||(this.isDraggingMenu=!0,this.isManualMenuPosition=!0,this.dragStartPointer={x:e.clientX,y:e.clientY},this.dragStartMenuPosition={left:this.marginLeft,top:this.marginTop},window.addEventListener("mousemove",this.onMenuDragMove),window.addEventListener("mouseup",this.stopMenuDrag),e.stopPropagation(),e.preventDefault()))}},onMenuDragMove:function(e){if(this.isDraggingMenu&&this.dragStartPointer&&this.dragStartMenuPosition){var t=this._getContextMenuRootEl(),n=t&&"function"===typeof t.getBoundingClientRect?t.getBoundingClientRect():null,r=n?n.width:Math.min(420,window.innerWidth-24),o=n?n.height:320,i=12,a=e.clientX-this.dragStartPointer.x,l=e.clientY-this.dragStartPointer.y,s=this.dragStartMenuPosition.left+a,c=this.dragStartMenuPosition.top+l,u=Math.max(i,window.innerWidth-r-i),h=Math.max(i,window.innerHeight-o-i);this.marginLeft=Math.max(i,Math.min(s,u)),this.marginTop=Math.max(i,Math.min(c,h)),e.preventDefault()}},stopMenuDrag:function(){this.isDraggingMenu&&(this.isDraggingMenu=!1,this.dragStartPointer=null,this.dragStartMenuPosition=null,window.removeEventListener("mousemove",this.onMenuDragMove),window.removeEventListener("mouseup",this.stopMenuDrag))}
1,dismissCanvasSettingsPopup:function(){this.stopMenuDrag(),this.activeMenu=!1,this.showRename=!1,this.isSidebarPlacementDefaultsPanel=!1,this.sidebarPlacementAnchor=null,this.appliedSidebarSpecSnapshot={},this.appliedCanvasSpecSnapshot={},this.isManualMenuPosition=!1},closeSettingsPanel:function(){$y.get().emit($y.SIDEBAR_SETTINGS_OPENED,{mint:null})},closeContextMenu:function(){this.dismissCanvasSettingsPopup()},_getContextMenuRootEl:function(){var e=this.$refs.RightClickMenu;return e?e.$el||e:null},_applyMenuPositionFromAnchor:function(e){var t=this._getContextMenuRootEl();if(t&&"function"===typeof t.getBoundingClientRect){var n=t.getBoundingClientRect(),r=n.width||Math.min(420,window.innerWidth-24),o=12,i=8;if(!e)return this.marginLeft=o,void(this.marginTop=o);var a=e.left+i,l=Math.max(o,e.top+i);a+r+o>window.innerWidth&&(a=Math.max(o,window.innerWidth-r-o)),a=Math.max(o,a),this.marginLeft=a,this.marginTop=l}},positionMenuForSidebarAnchor:function(e){var t=this._getContextMenuRootEl();if(t&&"function"===typeof t.getBoundingClientRect){var n=t.getBoundingClientRect(),r=n.width||Math.min(420,window.innerWidth-24),o=12,i=8;if(!e)return this.marginLeft=o,void(this.marginTop=o);var a=(e.left||0)+i,l=Math.max(o,(e.top||0)+i);a+r+o>window.innerWidth&&(a=Math.max(o,window.innerWidth-r-o)),a=Math.max(o,a),this.marginLeft=a,this.marginTop=l}},libraryDefaultSpecForMint:function(e){var t=rf.getDefinitionForMINT(e);if(!t)return[];var n=[];for(var r in t.heritable)n.push({min:t.minimum[r],max:t.maximum[r],value:t.defaults[r],units:t.units[r],steps:(t.maximum[r]-t.minimum[r])/10,step:(t.maximum[r]-t.minimum[r])/10,name:r});return n},specToValueSnapshot:function(e){var t={};if(!Array.isArray(e))return t;var n,r=KO(e);try{for(r.s();!(n=r.n()).done;){var o=n.value;o&&o.name&&(t[o.name]=Number(o.value))}}catch(i){r.e(i)}finally{r.f()}return t},cloneSpecRows:function(e){return Array.isArray(e)?e.map((function(e){return zO({},e)})):[]},syncPlacementToolAndTarget:function(e,t){var n,r,o,i=this.cloneSpecRows(t),a=null===(n=Pd.viewManager)||void 0===n||null===(r=n.mouseAndKeyboardHandler)||void 0===r?void 0:r.leftMouseTool;a&&Object.prototype.hasOwnProperty.call(a,"currentParameters")&&(a.currentParameters=i);var l=null===(o=Pd.viewManager)||void 0===o?void 0:o.view;l&&l.lastTargetPosition&&Pd.viewManager.updateTarget(e,"Basic",l.lastTargetPosition,i)},applySidebarPlacementChanges:function(){if(this.isSidebarPlacementDefaultsPanel){var e=rf.getTypeForMINT(this.mint);if(e){var t,n=KO(this.spec);try{for(n.s();!(t=n.n()).done;){var r=t.value;if(r&&r.name){var o=Number(r.value);Number.isNaN(o)||(Pd.viewManager.adjustParams(e,r.name,o),this.$set(r,"value",o))}}}catch(i){n.e(i)}finally{n.f()}this.appliedSidebarSpecSnapshot=this.specToValueSnapshot(this.spec),this.syncPlacementToolAndTarget(e,this.spec)}}},applyCanvasComponentChanges:function(){if(!this.isSidebarPlacementDefaultsPanel&&this.currentComponent){var e,t=rf.getTypeForMINT(this.currentComponent.mint),n=KO(this.spec);try{for(n.s();!(e=n.n()).done;){var r=e.value;if(r&&r.name){var o=Number(r.value),i=Number.isNaN(o)?r.value:o;this.currentComponent.updateParameter(r.name,i),t&&Pd.viewManager.updateDefault(t,r.name,i),this.$set(r,"value",i)}}}catch(a){n.e(a)}finally{n.f()}this.appliedCanvasSpecSnapshot=this.specToValueSnapshot(this.spec)}},applySettingsChanges:function(){this.isSidebarPlacementDefaultsPanel?this.applySidebarPlacementChanges():this.applyCanvasComponentChanges()},applySidebarSettingsOpenedPayload:function(e){var t=this,n=e&&e.mint,r=e&&e.placementPanelAnchor;if(null!=n&&""!==n){if(n!==Zy)return r?(this.isSidebarPlacementDefaultsPanel=!0,this.sidebarPlacementAnchor=r,this.menuPointerAnchor=null,this.mint=n,this.spec=this.libraryDefaultSpecForMint(n),this.appliedSidebarSpecSnapshot=this.specToValueSnapshot(this.spec),this.activeMenu=!0,this.showRename=!1,this.isManualMenuPosition=!1,this.dialogAnchor=r,void this.$nextTick((function(){t.positionMenuForSidebarAnchor(r),requestAnimationFrame((function(){t.positionMenuForSidebarAnchor(r)}))}))):void(null!=n&&""!==n&&this.dismissCanvasSettingsPopup());this.dismissCanvasSettingsPopup()}else this.dismissCanvasSettingsPopup()},positionMenuNearComponent:function(){var e=this,t=qC(this.currentComponent);!t&&this.menuPointerAnchor&&(t=this.menuPointerAnchor),this.dialogAnchor=t;var n=function(){return e._applyMenuPositionFromAnchor(t)};this.$nextTick((function(){n(),requestAnimationFrame((function(){n(),requestAnimationFrame(n)}))}))},resetSidebarPlacementLibraryDefaults:function(){var e=rf.getTypeForMINT(this.mint);if(e){var t=rf.library[e]&&rf.library[e].object;t&&"function"===typeof t.resetToFactoryParameterDefaults&&(t.resetToFactoryParameterDefaults(),this.spec=this.libraryDefaultSpecForMint(this.mint),this.appliedSidebarSpecSnapshot=this.specToValueSnapshot(this.spec),this.syncPlacementToolAndTarget(e,this.spec))}},resetCanvasComponentToFactoryDefaults:function(){if(this.isSidebarPlacementDefaultsPanel)this.resetSidebarPlacementLibraryDefaults();else if(this.currentComponent&&this.currentComponent.mint){var e=rf.getTypeForMINT(this.currentComponent.mint);if(e){var t=Pd.viewManager,n=t&&"function"===typeof t.findImportedComponentById?t.findImportedComponentById(this.currentComponent.id):null,r=null;
1if(n)r=t.resolveComponentResetParams(this.currentComponent);else{var o=rf.library[e]&&rf.library[e].object;o&&"function"===typeof o.resetToFactoryParameterDefaults&&o.resetToFactoryParameterDefaults(),r=rf.snapshotFactoryDefaultsForMint(this.currentComponent.mint)}if(r){for(var i in r)if(Object.prototype.hasOwnProperty.call(r,i)&&"position"!==i){var a=Number(r[i]);Number.isFinite(a)&&(this.currentComponent.updateParameter(i,a),n||Pd.viewManager.updateDefault(e,i,a))}this.spec=this.computeSpec(this.currentComponent.mint,this.currentComponent.params),this.appliedCanvasSpecSnapshot=this.specToValueSnapshot(this.spec),Pd.viewManager&&"function"===typeof Pd.viewManager.refresh&&Pd.viewManager.refresh(!0)}}}},closeCanvasSettingsCard:function(){var e=this.isSidebarPlacementDefaultsPanel;this.dismissCanvasSettingsPopup(),e||$y.get().emit($y.SIDEBAR_COMPONENT_ACTIVATED,{mint:null}),$y.get().emit($y.SIDEBAR_SETTINGS_OPENED,{mint:null})},updateParameter:function(e,t){var n=Number(e),r=Number.isNaN(n)?e:n,o=this.spec.find((function(e){return e.name===t}));o&&this.$set(o,"value",r)},computeSpec:function(e,t){var n=[],r=rf.getDefinitionForMINT(e);if(!r||!t)return n;for(var o in t.heritable){var i=t.heritable[o],a=void 0;if("function"===typeof t.hasParam&&t.hasParam(i))a=t.getValue(i);else{if(!r.defaults||void 0===r.defaults[i])continue;a=r.defaults[i],"function"===typeof t.updateParameter&&t.updateParameter(i,a)}var l={min:r.minimum[i],max:r.maximum[i],value:a,units:r.units[i],steps:(r.maximum[i]-r.minimum[i])/10,step:(r.maximum[i]-r.minimum[i])/10,name:i};n.push(l)}return n},activateMenu:function(e,t){var n=this;this.isSidebarPlacementDefaultsPanel=!1,this.sidebarPlacementAnchor=null,this.currentComponent=t,this.featureRef=t,this.componentName=t.name,this.activeMenu=!0,this.showRename=!1,e&&"number"===typeof e.clientX&&"number"===typeof e.clientY?this.menuPointerAnchor={left:e.clientX,top:e.clientY}:this.menuPointerAnchor=null,this.isManualMenuPosition=!1;var r=this.computeSpec(t.mint,t.params);this.mint=t.mint,this.spec=r,this.appliedCanvasSpecSnapshot=this.specToValueSnapshot(r),this.$nextTick((function(){n.positionMenuNearComponent()}))},deleteButton:function(){var e=Pd.viewManager.view,t=y.a.project&&y.a.project.selectedItems,n=t&&t.length>0;if(n)e.deleteSelectedFeatures();else if(this.currentComponent&&this.currentComponent.id){for(var r=this.currentComponent.featureIDs.slice(),o=0;o<r.length;o++)Pd.viewManager.removeFeatureByID(r[o]);var i=Pd.currentDevice.removeComponent(this.currentComponent);i&&Pd.viewManager.updatesConnectionRender(i),e.clearSelectedItems()}else e.deleteSelectedFeatures();this.closeSettingsPanel(),this.closeContextMenu()},copyButton:function(){Pd.viewManager.initiateCopy()},copyToAllButton:function(){this.activeCopy=!this.activeCopy,console.log("Change all the component parameters")},generateArrayButton:function(){Pd.viewManager.activateTool("GenerateArrayTool"),Pd.viewManager.tools.GenerateArrayTool.activate(this.currentComponent)},handleScroll:function(){this.setDrawerPosition()},setDrawerPosition:function(){if(this.activated){var e=this.$refs.activator.$el.getBoundingClientRect();this.$refs.drawer.style.top=e.bottom-e.height+"px"}},saveName:function(){this.currentComponent.name=this.componentName,this.showRename=!1},closeDialog:function(){this.activeMenu=!1},cancelRename:function(){this.showRename=!1,this.componentName=this.currentComponent.name}}},$O=ZO,QO=(n("2798"),n("fd39"),Object(CC["a"])($O,VC,XC,!1,null,"1355b512",null)),eS=QO.exports;SC()(QO,{VBtn:DC["a"],VCard:RC["a"],VCardText:TC["b"],VIcon:MO["a"],VRow:nO["a"],VSpacer:rO["a"],VTextField:oO["a"],VTooltip:FC["a"]});var tS=function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("v-card",{directives:[{name:"show",rawName:"v-show",value:e.activeMenu,expression:"activeMenu"}],ref:"RightClickMenu",staticClass:"connection-context-card settings-panel-card settings-panel-card--chrome",style:e.cardPositionStyle,attrs:{scrollable:""}},[n("div",{directives:[{name:"show",rawName:"v-show",value:e.showRename,expression:"showRename"}],staticClass:"connection-context-rename px-4 pt-3 pb-0"},[n("v-row",{attrs:{align:"center",dense:"","no-gutters":""}},[n("v-text-field",{staticClass:"mr-2",attrs:{dense:"","hide-details":"",label:"Name",outlined:""},model:{value:e.connectionName,callback:function(t){e.connectionName=t},expression:"connectionName"}}),n("v-btn",{staticClass:"mr-1",attrs:{icon:"",small:""},on:{click:e.cancelRename}},[n("span",{staticClass:"material-icons"},[e._v("close")])]),n("v-btn",{attrs:{icon:"",small:""},on:{click:e.saveName}},[n("span",{staticClass:"material-icons"},[e._v("check")])])],1)],1),n("v-btn",{staticClass:"settings-corner-close",attrs:{type:"button",fab:"","x-small":"",dark:"",ripple:!1,"aria-label":"Close"},on:{click:e.closeCanvasSettingsCard}},[n("v-icon",{attrs:{size:"16",color:"white"}},[e._v("mdi-close")])],1),n("div",{staticClass:"settings-panel-heading",on:{mousedown:e.startMenuDrag,contextmenu:function(e){e.preventDefault()}}},[n("span",{staticClass:"settings-panel-heading__title"},[e._v(e._s(e.mint))]),n("v-spacer"),e.hasPendingSpecChanges?n("v-btn",{staticClass:"settings-panel-apply-btn",attrs:{small:"",depressed:"",dark:"",color:"primary"},on:{click:e.applySettingsChanges}}
1,[e._v(" Apply ")]):e._e(),n("v-btn",{staticClass:"settings-panel-reset-btn",attrs:{small:"",depressed:"",dark:"",color:"orange darken-2"},on:{click:e.resetCanvasConnectionToFactoryDefaults}},[e._v(" Reset ")])],1),n("div",{staticClass:"context-action-toolbar context-action-toolbar--panel"},[n("v-tooltip",{attrs:{bottom:""},scopedSlots:e._u([{key:"activator",fn:function(t){var r=t.on,o=t.attrs;return[n("v-btn",e._g(e._b({staticClass:"context-icon-btn",attrs:{id:"context_button_delete",color:"white",depressed:""},on:{click:e.deleteButton}},"v-btn",o,!1),r),[n("span",{staticClass:"material-icons primary--text"},[e._v("delete")])])]}}])},[n("span",[e._v("Remove this connection from the device")])]),n("v-tooltip",{attrs:{bottom:""},scopedSlots:e._u([{key:"activator",fn:function(t){var r=t.on,o=t.attrs;return[n("v-btn",e._g(e._b({staticClass:"context-icon-btn",attrs:{id:"context_button_showRename",color:"white",depressed:""},on:{click:function(t){e.showRename=!0}}},"v-btn",o,!1),r),[n("span",{staticClass:"material-icons primary--text"},[e._v("title")])])]}}])},[n("span",[e._v("Edit the connection display name")])])],1),n("v-card-text",{staticClass:"settings-panel-body connection-context-settings-body"},[n("v-select",{staticClass:"mb-3 connection-profile-select",attrs:{items:e.connectionProfiles,dense:"","hide-details":"",label:"Channel type",outlined:"","menu-props":{contentClass:"connection-context-profile-menu"}},model:{value:e.selectedProfile,callback:function(t){e.selectedProfile=t},expression:"selectedProfile"}}),n("PropertyBlock",{attrs:{density:"sidebar",title:e.mint,"entity-id":e.canvasEntityId,spec:e.spec},on:{update:e.updateParameter}})],1)],1)},nS=[];function rS(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function oS(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?rS(Object(n),!0).forEach((function(t){iS(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):rS(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function iS(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function aS(e,t){var n="undefined"!==typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=lS(e))||t&&e&&"number"===typeof e.length){n&&(e=n);var r=0,o=function(){};return{s:o,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,l=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return a=e.done,e},e:function(e){l=!0,i=e},f:function(){try{a||null==n.return||n.return()}finally{if(l)throw i}}}}function lS(e,t){if(e){if("string"===typeof e)return sS(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?sS(e,t):void 0}}function sS(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function cS(e,t,n){var r=void 0!==n?n:e.defaults[t];return{name:t,min:e.minimum[t],max:e.maximum[t],value:r,units:e.units[t],steps:(e.maximum[t]-e.minimum[t])/10,step:(e.maximum[t]-e.minimum[t])/10}}function uS(e,t){var n=Number(e);return Number.isFinite(n)?n:t}function hS(e){return String(e||"").trim().toUpperCase()}var fS={name:"ConnectionContextMenu",components:{PropertyBlock:AO},data:function(){return{mint:"CHANNEL",spec:[{min:0,max:110,units:"",value:0}],activeMenu:!1,activeChange:!1,activeMove:!1,activeCopy:!1,showRename:!1,connectionName:"",featureRef:null,marginLeft:500,marginTop:100,currentConnection:new ny("",new _f({},new Map,new Map),"","",new Sf({},Pd.currentDevice)),menuPointerAnchor:null,appliedSettingsSnapshot:null,connectionProfiles:[],selectedProfile:"CHANNEL",snapshot:{connectionSpacing:1600,channelWidth:800,height:250},isManualMenuPosition:!1,isDraggingMenu:!1,dragStartPointer:null,dragStartMenuPosition:null}},computed:{cardPositionStyle:function(){var e="min(420px, calc(100vw - 24px))";
1return{position:"fixed",left:this.marginLeft+"px",top:this.marginTop+"px",zIndex:200,maxWidth:e,width:e}},hasPendingSpecChanges:function(){var e=this.buildAppliedSettingsSnapshot(),t=this.appliedSettingsSnapshot||null;return JSON.stringify(e)!==JSON.stringify(t)},canvasEntityId:function(){var e=this.currentConnection;return e&&(e.id||e.name)||""}},mounted:function(){var e=this;this._onCloseAllWindows=function(){e.dismissCanvasSettingsPopup()},this._onComponentSettingsOpened=function(){e.activeMenu&&e.dismissCanvasSettingsPopup()},this._onUpdateZoom=function(){e.activeMenu&&(e.isManualMenuPosition||e.$nextTick((function(){return e.positionMenuNearConnection()})))},this._onUpdateRenders=function(){e.activeMenu&&(e.isManualMenuPosition||e.$nextTick((function(){return e.positionMenuNearConnection()})))},this._onSidebarPlacementActivated=function(t){var n=t&&t.mint;null!=n&&""!==n&&e.activeMenu&&e.dismissCanvasSettingsPopup()},$y.get().on($y.CLOSE_ALL_WINDOWS,this._onCloseAllWindows),$y.get().on($y.DBL_CLICK_CONNECTION,this.activateMenu),$y.get().on($y.DBL_CLICK_COMPONENT,this._onComponentSettingsOpened),$y.get().on($y.UPDATE_ZOOM,this._onUpdateZoom),$y.get().on($y.UPDATE_RENDERS,this._onUpdateRenders),$y.get().on($y.SIDEBAR_COMPONENT_ACTIVATED,this._onSidebarPlacementActivated),this.connectionProfiles=rf.getConnectionTypes()},beforeDestroy:function(){$y.get().off($y.CLOSE_ALL_WINDOWS,this._onCloseAllWindows),$y.get().off($y.DBL_CLICK_CONNECTION,this.activateMenu),$y.get().off($y.DBL_CLICK_COMPONENT,this._onComponentSettingsOpened),$y.get().off($y.UPDATE_ZOOM,this._onUpdateZoom),$y.get().off($y.UPDATE_RENDERS,this._onUpdateRenders),$y.get().off($y.SIDEBAR_COMPONENT_ACTIVATED,this._onSidebarPlacementActivated),this.stopMenuDrag()},methods:{startMenuDrag:function(e){if(e&&(0===e.button||2===e.button)){var t=e.target;t&&"function"===typeof t.closest&&t.closest(".settings-panel-heading")&&(t.closest(".v-btn, button, input, textarea, select, .v-input, .v-slider, .property-block-scroll-shell--limited")||(this.isDraggingMenu=!0,this.isManualMenuPosition=!0,this.dragStartPointer={x:e.clientX,y:e.clientY},this.dragStartMenuPosition={left:this.marginLeft,top:this.marginTop},window.addEventListener("mousemove",this.onMenuDragMove),window.addEventListener("mouseup",this.stopMenuDrag),e.stopPropagation(),e.preventDefault()))}},onMenuDragMove:function(e){if(this.isDraggingMenu&&this.dragStartPointer&&this.dragStartMenuPosition){var t=this._getContextMenuRootEl(),n=t&&"function"===typeof t.getBoundingClientRect?t.getBoundingClientRect():null,r=n?n.width:Math.min(420,window.innerWidth-24),o=n?n.height:320,i=12,a=e.clientX-this.dragStartPointer.x,l=e.clientY-this.dragStartPointer.y,s=this.dragStartMenuPosition.left+a,c=this.dragStartMenuPosition.top+l,u=Math.max(i,window.innerWidth-r-i),h=Math.max(i,window.innerHeight-o-i);this.marginLeft=Math.max(i,Math.min(s,u)),this.marginTop=Math.max(i,Math.min(c,h)),e.preventDefault()}},stopMenuDrag:function(){this.isDraggingMenu&&(this.isDraggingMenu=!1,this.dragStartPointer=null,this.dragStartMenuPosition=null,window.removeEventListener("mousemove",this.onMenuDragMove),window.removeEventListener("mouseup",this.stopMenuDrag))},dismissCanvasSettingsPopup:function(){this.stopMenuDrag(),this.activeMenu=!1,this.showRename=!1,this.appliedSettingsSnapshot=null,this.menuPointerAnchor=null,this.isManualMenuPosition=!1},profileMintToCrossSection:function(e){var t=hS(e);return t.includes("ROUND")?1:0},crossSectionToProfileMint:function(e){var t=Number(e)>=.5;return this.resolveProfileMintByCrossSection(t)},resolveProfileMintByCrossSection:function(e){var t=Array.isArray(this.connectionProfiles)?this.connectionProfiles:[];if(0===t.length)return e?"ROUNDED CHANNEL":"CHANNEL";var n=t.find((function(e){return hS(e).includes("ROUND")})),r=t.find((function(e){return!hS(e).includes("ROUND")}));return e?n||r||t[0]:r||n||t[0]},getConnectionDefinition:function(){return rf.getDefinition("Connection")||rf.getDefinitionForMINT("CHANNEL")},initSnapshotFromConnection:function(){if(this.currentConnection){var e=this.currentConnection.params,t={},n=Array.isArray(this.currentConnection.featureIDs)&&this.currentConnection.featureIDs.length>0?this.currentConnection.featureIDs[0]:null;if(n&&Pd.currentDevice)try{var r=Pd.currentDevice.getFeatureByID(n);t.connectionSpacing=r.getValue("connectionSpacing"),t.channelWidth=r.getValue("channelWidth"),t.height=r.getValue("height"),t.crossSection=r.getValue("crossSection")}catch(a){}var o=function(n,r){try{return Object.prototype.hasOwnProperty.call(t,n)?uS(t[n],r):uS(e.getValue(n),r)}catch(o){return r}};this.snapshot={connectionSpacing:o("connectionSpacing",1600),channelWidth:o("channelWidth",800),height:o("height",250)};var i=0;try{i=Object.prototype.hasOwnProperty.call(t,"crossSection")?t.crossSection:e.getValue("crossSection")}catch(l){i=0}this.selectedProfile=this.crossSectionToProfileMint(i)}},rebuildSettingsSpec:function(){var e=this.getConnectionDefinition();if(e)if(this.profileMintToCrossSection(this.selectedProfile)>=.5){var t=this.snapshot.channelWidth/2;this.spec=[cS(e,"connectionSpacing",this.snapshot.connectionSpacing),{name:"channelRadius",min:e.minimum.channelWidth/2,max:e.maximum.channelWidth/2,value:t,units:e.units.channelWidth,steps:(e.maximum.channelWidth/2-e.minimum.channelWidth/2)/10,step:(e.maximum.channelWidth/2-e.minimum.channelWidth/2)/10}]}else this.spec=[cS(e,"connectionSpacing",this.snapshot.connectionSpacing),cS(e,"channelWidth",this.snapshot.channelWidth),cS(e,"height",this.snapshot.height)];else this.spec=[]},syncSpecItemToSnapshot:function(e,t){var n=Number(t);Number.isFinite(n)&&("connectionSpacing"===e?this.snapshot.connectionSpacing=n:"channelWidth"===e?this.snapshot.channelWidth=n:"height"===e?this.snapshot.height=n:"channelRadius"===e&&(this.snapshot.channelWidth=2*n,this.snapshot.height=2*n))},_getContextMenuRootEl:function(){var e=this.$refs.RightClickMenu;return e?e.$el||e:null},_applyMenuPositionFromAnchor:function(e){var t=this._getContextMenuRootEl();if(t&&"function"===typeof t.getBoundingClientRect){var n=t.getBoundingClientRect(),r=n.width||Math.min(420,window.innerWidth-24),o=12,i=8;if(!e)return this.marginLeft=o,void(this.marginTop=o);var a=e.left+i,l=Math.max(o,e.top+i);a+r+o>window.innerWidth&&(a=Math.max(o,window.innerWidth-r-o)),a=Math.max(o,a),this.marginLeft=a,this.marginTop=l}},positionMenuNearConnection:function(){var e=this,t=qC(this.currentConnection);!t&&this.menuPointerAnchor&&(t=this.menuPointerAnchor);var n=function(){return e._applyMenuPositionFromAnchor(t)};this.$nextTick((function(){n(),requestAnimationFrame((function(){n(),requestAnimationFrame(n)}))}))},specToValueSnapshot:function(e){var t={};if(!Array.isArray(e))return t;var n,r=aS(e);try{for(r.s();!(n=r.n()).done;){var o=n.value;o&&o.name&&(t[o.name]=Number(o.value))}}catch(i){r.e(i)}finally{r.f()}return t},cloneSpecRows:function(e){return Array.isArray(e)?e.map((function(e){return oS({},e)})):[]},buildAppliedSettingsSnapshot:function(){return{profile:hS(this.selectedProfile),values:this.specToValueSnapshot(this.spec)}},applyConnectionChanges:function(){if(this.currentConnection){var e,t=aS(this.spec);try{for(t.s();!(e=t.n()).done;){var n=e.value;n&&n.name&&this.syncSpecItemToSnapshot(n.name,n.value)}}catch(r){t.e(r)}finally{t.f()}this.currentConnection.updateParameter("connectionSpacing",this.snapshot.connectionSpacing),this.currentConnection.updateParameter("channelWidth",this.snapshot.channelWidth),this.currentConnection.updateParameter("height",this.snapshot.height),this.currentConnection.updateParameter("crossSection",this.profileMintToCrossSection(this.selectedProfile)),this.refreshConnectionRender(),this.rebuildSettingsSpec(),this.appliedSettingsSnapshot=this.buildAppliedSettingsSnapshot()}},applySettingsChanges:function(){this.applyConnectionChanges()},updateParameter:function(e,t){var n=Number(e),r=Number.isNaN(n)?e:n,o=this.spec.find((function(e){return e.name===t}));o&&(this.$set(o,"value",r),this.syncSpecItemToSnapshot(t,r))},computeSpec:function(e,t){var n=[],r=rf.getDefinitionForMINT(e);if(!r||!t)return n;for(var o in t.heritable){var i=t.heritable[o],a=void 0;if("function"===typeof t.hasParam&&t.hasParam(i))a=t.getValue(i);else{if(!r.defaults||void 0===r.defaults[i])continue;a=r.defaults[i],"function"===typeof t.updateParameter&&t.updateParameter(i,a)}var l={min:r.minimum[i],max:r.maximum[i],value:a,units:r.units[i],steps:(r.maximum[i]-r.minimum[i])/10,step:(r.maximum[i]-r.minimum[i])/10,name:i};n.push(l)}return n},resetCanvasConnectionToFactoryDefaults:function(){if(this.currentConnection){var e=Pd.viewManager,t=e&&"function"===typeof e.findImportedConnectionById?e.findImportedConnectionById(this.currentConnection.id):null,n=t&&e&&"function"===typeof e.resolve
1ConnectionResetParams?e.resolveConnectionResetParams(this.currentConnection):rf.snapshotFactoryDefaultsForMint("CHANNEL");if(n){for(var r in n)if(Object.prototype.hasOwnProperty.call(n,r)&&"position"!==r&&"start"!==r&&"end"!==r&&"wayPoints"!==r&&"segments"!==r){var o=Number(n[r]);Number.isFinite(o)&&this.currentConnection.updateParameter(r,o)}this.refreshConnectionRender(),this.initSnapshotFromConnection(),this.rebuildSettingsSpec(),this.appliedSettingsSnapshot=this.buildAppliedSettingsSnapshot()}}},refreshConnectionRender:function(){if(this.currentConnection&&Pd.viewManager&&Pd.currentDevice){try{Pd.viewManager.updatesConnectionRender(this.currentConnection)}catch(o){console.warn("Could not recompute connection render after applying settings:",o)}var e,t=aS(this.currentConnection.featureIDs);try{for(t.s();!(e=t.n()).done;){var n=e.value;try{var r=Pd.currentDevice.getFeatureByID(n);Pd.viewManager.updateFeature(r,!1)}catch(o){console.warn("Could not refresh connection feature after apply:",n,o)}}}catch(o){t.e(o)}finally{t.f()}Pd.viewManager.refresh(!0)}},closeCanvasSettingsCard:function(){this.dismissCanvasSettingsPopup(),$y.get().emit($y.SIDEBAR_COMPONENT_ACTIVATED,{mint:null}),$y.get().emit($y.SIDEBAR_SETTINGS_OPENED,{mint:null})},activateMenu:function(e,t){var n=this;this.currentConnection=t,this.featureRef=t,this.connectionName=t.name,this.activeMenu=!0,this.showRename=!1,this.mint="Connection",e&&"number"===typeof e.clientX&&"number"===typeof e.clientY?this.menuPointerAnchor={left:e.clientX,top:e.clientY}:this.menuPointerAnchor=null,this.isManualMenuPosition=!1,this.initSnapshotFromConnection(),this.rebuildSettingsSpec(),Array.isArray(this.spec)&&0!==this.spec.length||(this.spec=this.computeSpec("CHANNEL",t.params)),this.appliedSettingsSnapshot=this.buildAppliedSettingsSnapshot(),this.$nextTick((function(){n.positionMenuNearConnection()}))},deleteButton:function(){var e=Pd.viewManager.view,t=y.a.project&&y.a.project.selectedItems,n=t&&t.length>0;n?e.deleteSelectedFeatures():this.currentConnection&&this.currentConnection.id?(Pd.currentDevice.removeConnection(this.currentConnection),e.clearSelectedItems()):e.deleteSelectedFeatures(),this.closeCanvasSettingsCard()},saveName:function(){this.currentConnection.name=this.connectionName,this.showRename=!1},cancelRename:function(){this.showRename=!1,this.connectionName=this.currentConnection.name},onSelectedProfileChanged:function(e,t){e!==t&&(this.profileMintToCrossSection(t)<.5&&this.profileMintToCrossSection(e)>=.5&&(this.snapshot.height=this.snapshot.channelWidth),this.rebuildSettingsSpec())}},watch:{selectedProfile:"onSelectedProfileChanged"}},dS=fS,pS=(n("2cf0"),n("2e60"),n("b974")),yS=Object(CC["a"])(dS,tS,nS,!1,null,"2db45828",null),mS=yS.exports;function vS(e){return vS="function"===typeof Symbol&&"symbol"===typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"===typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},vS(e)}SC()(yS,{VBtn:DC["a"],VCard:RC["a"],VCardText:TC["b"],VIcon:MO["a"],VRow:nO["a"],VSelect:pS["a"],VSpacer:rO["a"],VTextField:oO["a"],VTooltip:FC["a"]});var gS={components:{ResolutionToolbar:EC,ComponentContextMenu:eS,ConnectionContextMenu:mS,ZoomSlider:BC},data:function(){return{}},computed:{},mounted:function(){var e=new sC;Pd.viewManager=e,e.loadDeviceFromJSON(JSON.parse(r.UpdatedExample)),e.updateGrid(),e.refresh(),window.dev=Pd.currentDevice,window.Registry=Pd,window.view=Pd.viewManager.view,Pd.viewManager.setupToolBars(),this.setupDragAndDropOnCanvas(),this._postMessageHandler=function(e){var t=e&&e.data?e.data:null;if(t&&"object"===vS(t)){if("loadDeviceFromJSON"===t.type)try{var n=t.json;if("string"===typeof n&&(n=JSON.parse(n)),!n)return;if(Pd.viewManager&&Pd.viewManager.loadDeviceFromJSON){var r=JSON.parse(JSON.stringify(n));Pd.viewManager.loadDeviceFromJSON(r),Pd.viewManager.updateGrid(),Pd.viewManager.refresh();try{window.opener&&!window.opener.closed&&window.opener.postMessage({type:"threeduf-device-loaded"},"*")}catch(i){console.warn("3DuF: failed to ack device load",i)}}}catch(a){console.error("3DuF: failed to load JSON from postMessage",a);var o=a&&a.message?a.message:String(a);alert("3DuF could not load the JSON: "+o)}if("clearDevice"===t.type)try{Pd.viewManager&&Pd.viewManager.clear&&(Pd.viewManager.clear(),Pd.viewManager.updateGrid(),Pd.viewManager.refresh())}catch(a){console.error("3DuF: failed to clear device",a)}}},window.addEventListener("message",this._postMessageHandler);try{var t={type:"threeduf-ready"};window.opener&&!window.opener.closed&&window.opener.postMessage(t,"*"),window.postMessage(t,window.location.origin)}catch(n){console.warn("3DuF: failed to announce threeduf-ready",n)}},beforeDestroy:function(){this._postMessageHandler&&(window.removeEventListener("message",this._postMessageHandler),this._postMessageHandler=null)},methods:{setupDragAndDropOnCanvas:function(){function e(e,t){var n=function(t){t.stopPropagation(),t.preventDefault(),e.classList.add("dropping")},r=function(e){e.stopPropagation(),e.preventDefault()},o=function(e){e.stopPropagation(),e.preventDefault()},i=function(n){n.stopPropagation(),n.preventDefault(),e.classList.remove("dropping"),t(n.dataTransfer.files,n)};e.addEventListener("dragenter",n,!1),e.addEventListener("dragover",r,!1),e.addEventListener("dragleave",o,!1),e.addEventListener("drop",i,!1)}e(this.$refs.rendingcanvas,(function(e){var t=e[0],n=new FileReader;n.onloadend=function(e){var t=this.result,n=JSON.parse(t);Pd.viewManager.loadDeviceFromJSON(n)};try{n.readAsText(t)}catch(r){console.log("unable to load JSON: "+t)}}))}}},wS=gS,bS=(n("abb3"),Object(CC["a"])(wS,u,h,!1,null,"3ad291f3",null)),_S=bS.exports,PS=function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("v-row",[n("v-col",[n("v-navigation-drawer",{staticClass:"pt-4",attrs:{app:"",permanent:"",color:"grey lighten-3"}},[n("div",{staticClass:"d-flex flex-column mx-2"},[n("v-img",{staticClass:"mx-auto",staticStyle:{width:"90%"},attrs:{src:"img/logo.png",alt:"3DuF Logo"}}),n("v-divider",{staticClass:"mb-1"}),n("IntroHelpDialog"),n("v-divider"),n("EditDeviceDialog"),n("InsertTextDialog"),n("ImportDXFDialog"),n("v-divider"),n("LayerToolbar"),n("ComponentToolbar"),n("ManufacturingPanel"),n("v-divider"),n("HelpDialog"),n("v-divider"),n("br")],1)])],1),n("v-col",[n("div",[n("Visualiser")],1)])],1)},CS=[],OS=function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("v-dialog",{attrs:{persistent:"","max-width":"500"},scopedSlots:e._u([{key:"activator",fn:function(t){var r=t.on,o=t.attrs;
1return[n("v-btn",e._g(e._b({attrs:{text:"",color:"pink darken-1"}},"v-btn",o,!1),r),[e._v(" About/Help ")])]}}]),model:{value:e.dialog,callback:function(t){e.dialog=t},expression:"dialog"}},[n("v-card",[n("v-card-title",{staticClass:"headline"},[e._v(e._s(e.pageTitle))]),n("v-card-text",[e.selectedVersion?n("div",[n("img",{attrs:{src:"img/cidar_logo.png",width:"100%"}}),e._v(" 3DuF is microfluidic design environment developed by "),n("a",{attrs:{href:"http://cidarlab.org",target:"_blank",rel:"noopener noreferrer"}},[e._v("CIDAR")]),e._v(". "),n("br"),e._v(" For any help or queries, please send an email to "),n("a",{attrs:{href:"mailto:[email protected]"}},[e._v("[email protected]")]),e._v(". "),n("br"),e._v(" Developed by: "+e._s(e.selectedVersion.developers)+". "),e.selectedVersion.paperUrl?n("div",[e._v(" Publication: "),n("a",{attrs:{href:e.selectedVersion.paperUrl,target:"_blank",rel:"noopener noreferrer"}},[e._v(e._s(e.selectedVersion.paperTitle))]),e._v(". ")]):e._e(),n("hr"),e._v(" Error Tracking powered by "),n("a",{attrs:{href:"https://trackjs.com"}},[e._v("https://trackjs.com")]),e._v(". "),n("hr"),n("div",{staticClass:"version-section"},[n("div",{staticClass:"branch-link"},[e._v(" Source code, issue tracking and feature requests: "),n("a",{attrs:{href:e.selectedVersion.branchUrl,target:"_blank",rel:"noopener noreferrer"}},[e._v("Github ("+e._s(e.selectedVersion.branch)+")")])]),e.selectedVersion.changes.length?n("div",[e._v(" Changes since "+e._s(e.selectedVersion.previousVersion)+": "),n("ul",e._l(e.selectedVersion.changes,(function(t,r){return n("li",{key:e.selectedVersion.label+"-"+r},[e._v(" "+e._s(t)+" ")])})),0)]):n("div",[e._v(" Initial release baseline (no previous version to compare). ")])])]):e._e()]),n("v-card-actions",[n("v-spacer"),n("div",e._l(e.versions,(function(t,r){return n("v-btn",{key:t.label,attrs:{text:"",color:e.page===r+1?"pink darken-1":""},on:{click:function(t){e.page=r+1}}},[e._v(" "+e._s(t.label)+" ")])})),1),n("v-spacer"),n("v-btn",{attrs:{color:"green darken-1",text:""},on:{click:function(t){e.dialog=!1}}},[e._v("Close")])],1)],1)],1)},SS=[],DS={data:function(){return{dialog:!1,page:1,versions:[{label:"v1.0",previousVersion:null,developers:"Aaron Heuckroth, Joshua Lippai and Radhakrishna Sanka",branch:"main",branchUrl:"https://github.com/CIDARLAB/3DuF/tree/main",paperTitle:'Scientific Reports (2019): "3DuF: A Design Environment for Digital Microfluidic Biochips"',paperUrl:"https://www.nature.com/articles/s41598-019-45623-z",changes:[]},{label:"v1.1",previousVersion:"v1.0",developers:"Yangruirui Zhou, Eric Xie and Radhakrishna Sanka",branch:"webpack-build-2",branchUrl:"https://github.com/CIDARLAB/3DuF/tree/webpack-build-2",changes:["Added blackbox rendering for unknown/unsupported components, with sidebar cleanup so blackbox is no longer listed as a normal feature tool.","Added terrace as a new primitive component.","Added geometric reflection controls (mirrorByX / mirrorByY) across components, with rotation and mirroring about geoCenter.","Fixed port rendering when loading designs from JSON.","Corrected primitive-server device rendering behavior.","Enabled Neptune â 3DuF JSON bridge (postMessage load of designs from Neptune).","Added a local-development CLI workflow for checking the 3DuF frontend on localhost."]},{label:"v1.2",previousVersion:"v1.1",developers:"Yangruirui Zhou",branch:"Neptune_Render",branchUrl:"https://github.com/CIDARLAB/3DuF/tree/Neptune_Render",changes:["Unified JSON and DXF import into a single Import dialog (drop zone + file picker, Confirm/Cancel), replacing separate sidebar import entries.","Expanded the DXF pipeline: multilayer designs export as a DXF zip, round-trip import/export is hardened, and device border / channel wall widths export correctly.","Reworked the manufacturing Export panel for JSON · 3DuF, DXF, SVG, and flow-feature GCode (multilayer biochips use per-layer DXF/SVG instead of GCode).","Added an All/Ports canvas toggle above Export: Ports keeps only flow (blue) and control (red) port circles so a cover layer can be prepared; All restores the full design. JSON, DXF, SVG, and GCode downloads include a matching ports-only file.","Added connection cross-section controls (square vs rounded stadium ends) with reliable c
1anvas Apply, rounded endcap geometry, and filled 90° joints on square CHANNEL segments.","Registered DIYCOMPONENT as a built-in black-box placeholder so Neptune LFR user-designed parts round-trip without a custom library entry.","Updated the default port radius to 1 mm and unified the default channel / valve-gap width to 600 µm across library components.","Stored component position as the geometric / rotation center; circular glyphs (PORT, VIA, VALVE) draw at that center without a second offset.","Settings panels show the imported netlist ID so components and connections can be matched back to Parchmint / Neptune JSON.","Mixer serpentine ends expose edgeBend1 / edgeBend2; ports sit at the incomplete-end tip-square center. Connecting channels (rounded or square, any width) terminate on that same center. Default bendSpacing is 1400 µm and bendLength is 2000 µm.","YTREE trunk/leaf ports sit at RoundedChannel stadium-cap centers so rounded connections fully cover the openings.","Clipped VALVE3D FLOW gaps geometrically (without paper.js boolean failures) so imported valves interrupt the host channel correctly; CONTROL routes are not split by FLOW valve rectangles.","Normalized Parchmint layer groups so FLOW and CONTROL stay on the same physical level instead of opening as separate levels.","Filled missing heritable defaults when loading older JSON so new parameters still appear in the settings table.","Hardened Neptune / JSON load: skip broken valve maps, tolerate missing device params, clear placement ghosts on import, and surface a clear alert when postMessage load fails.","Made the floating settings panel draggable, with Apply / Reset that target the clicked component or connection.","Reset on imported objects restores uploaded JSON parameters (by netlist ID); hand-placed objects still use library defaults.","Renamed MUX/TREE/YTREE spacing to leafSpace and stageSpace, with valveWidthX/valveWidthY for MUX pads; legacy spacing/leafPitch/stageLength/width/length still load.","Default componentSpacing keepout is 2000 µm and is editable in settings; parameter tables sort related keys together.","Edit Device syncs name/spans on open and after design load; Move / Specify Position uses µm; connection UI labels Channel type for square vs rounded profiles.","Improved Valve3D placement and layer-aware rendering (CONTROL full circle vs FLOW crescents) plus precise flow-gap connection breaks.","Added legacy / paper-design JSON normalization so literature designs load into the current interchange format, with a Tutorial link to 3DuF-Paper-Designs.","Versioned About/Help and Tutorial dialogs (v1.0âv1.2) with current-version labeling."]}]}},created:function(){this.page=this.versions.length},computed:{selectedVersion:function(){return this.versions[this.page-1]||null},currentVersionLabel:function(){var e=this.versions[this.versions.length-1];return e?e.label:""},pageTitle:function(){if(!this.selectedVersion)return"3DuF Help";var e=this.selectedVersion.label===this.currentVersionLabel?" (current version)":"";return"3DuF ".concat(this.selectedVersion.label).concat(e)}}},RS=DS,TS=(n("cf08"),Object(CC["a"])(RS,OS,SS,!1,null,"74e5ae6f",null)),LS=TS.exports;SC()(TS,{VBtn:DC["a"],VCard:RC["a"],VCardActions:TC["a"],VCardText:TC["b"],VCardTitle:TC["c"],VDialog:eO["a"],VSpacer:rO["a"]});var FS=function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("v-dialog",{attrs:{persistent:"","max-width":"600"},scopedSlots:e._u([{key:"activator",fn:function(t){var r=t.on,o=t.attrs;return[n("v-btn",e._g(e._b({staticClass:"white pink--text text--darken-1 mb-2 feature-button button-row tutorial-font"},"v-btn",o,!1),r),[e._v(" Tutorial ")])]}}]),model:{value:e.dialog,callback:function(t){e.dialog=t},expression:"dialog"}},[n("v-card",{staticClass:"tutorial-font"},[n("v-card-title",{staticClass:"headline dialog-title"},[e._v(e._s(e.pageTitle))]),n("v-card-text",[n("div",{staticClass:"section-title"},[e._v("Developer")]),n("p",{staticClass:"body-text"},[e._v(e._s(e.selectedVersion.developers))]),e.selectedVersion.publicationTitle?n("div",[n("div",{staticClass:"subsection-title"},[e._v("Academic Publications:")]),n("p",{staticClass:"body-text"},[e._v(e._s(e.selectedVersion.publicationTitle))]),n("a",{staticClass:"body-text",attrs:{href:e.selectedVersion.publicationUrl,target:"_blank",rel:"noopener noreferrer"}}
1,[e._v(e._s(e.selectedVersion.publicationUrl))])]):e._e(),e.selectedVersion.showVideos?n("div",[n("div",{staticClass:"section-title"},[e._v("Videos")]),n("div",{staticClass:"video-block"},[n("div",{staticClass:"video-label"},[e._v("Introduction")]),n("iframe",{attrs:{width:"355",height:"200",src:e.selectedVersion.introductionVideoUrl,frameborder:"0",allow:"accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture",allowfullscreen:""}})]),n("div",{staticClass:"video-block"},[n("div",{staticClass:"video-label"},[e._v("Long Tutorial")]),n("iframe",{attrs:{width:"355",height:"200",src:e.selectedVersion.longTutorialVideoUrl,frameborder:"0",allow:"accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture",allowfullscreen:""}})]),n("br")]):e._e(),e.selectedVersion.guiDifferences&&e.selectedVersion.guiDifferences.length?n("div",[n("div",{staticClass:"section-title"},[e._v("GUI Differences vs "+e._s(e.selectedVersion.previousVersion))]),n("ul",e._l(e.selectedVersion.guiDifferences,(function(t,r){return n("li",{key:"gui-"+e.selectedVersion.label+"-"+r},[e._v(" "+e._s(t)+" ")])})),0)]):e._e(),e.selectedVersion.workflowImprovements&&e.selectedVersion.workflowImprovements.length?n("div",[n("div",{staticClass:"section-title"},[e._v("Workflow Improvements")]),n("ul",e._l(e.selectedVersion.workflowImprovements,(function(t,r){return n("li",{key:"workflow-"+e.selectedVersion.label+"-"+r},[e._v(" "+e._s(t)+" ")])})),0)]):e._e(),e.selectedVersion.showDesignsFromLiterature?n("div",[n("div",{staticClass:"section-title"},[e._v("Designs From Literature")]),n("p",{staticClass:"body-text"},[e._v(" Check the various designs from microfluidic literature recreated in 3DµF can be found "),n("a",{attrs:{href:"https://cidarlab.github.io/3DuF-Paper-Designs/",target:"_blank",rel:"noopener noreferrer"}},[e._v("here")]),e._v(". ")])]):e._e(),e.selectedVersion.showUsage?n("div",[n("div",{staticClass:"section-title"},[e._v("Usage")]),n("table",{staticClass:"tg"},[n("tr",[n("td",{staticClass:"tg-yw4l"},[n("pre",[e._v("del")])]),n("td",{staticClass:"tg-yw4l"},[e._v("- Delete Feature")])]),n("tr",[n("td",{staticClass:"tg-yw4l"},[n("pre",[e._v("F")])]),n("td",{staticClass:"tg-yw4l"},[e._v("- Reset Canvas")])]),n("tr",[n("td",{staticClass:"tg-yw4l"},[n("pre",[e._v("Esc")])]),n("td",{staticClass:"tg-yw4l"},[e._v("- Activate Select Tool/ Deselect Selected Components")])]),n("tr",[n("td",{staticClass:"tg-yw4l"},[n("pre",[e._v("ctrl+C, ctrl+V")])]),n("td",{staticClass:"tg-yw4l"},[e._v("- Activate Component Copy Mode")])]),n("tr",[n("td",{staticClass:"tg-yw4l"},[n("pre",[e._v("ctrl+Z")])]),n("td",{staticClass:"tg-yw4l"},[e._v("- Undo Last Edit")])]),n("tr",[n("td",{staticClass:"tg-yw4l"},[n("pre",[e._v("ctrl+A")])]),n("td",{staticClass:"tg-yw4l"},[e._v("- Select All")])]),n("tr",[n("td",{staticClass:"tg-yw4l"},[n("pre",[e._v("ctrl+S")])]),n("td",{staticClass:"tg-yw4l"},[e._v("- Save JSON file")])]),n("tr",[n("td",{staticClass:"tg-yw4l"},[n("pre",[e._v("left click")])]),n("td",{staticClass:"tg-yw4l"},[e._v("- Place Feature")])]),n("tr",[n("td",{staticClass:"tg-yw4l"},[n("pre",[e._v("right click")])]),n("td",{staticClass:"tg-yw4l"},[e._v("- Select Feature")])]),n("tr",[n("td",{staticClass:"tg-yw4l"},[n("pre",[e._v("mouse scroll")])]),n("td",{staticClass:"tg-yw4l"},[e._v("- Zoom")])]),n("tr",[n("td",{staticClass:"tg-yw4l"},[n("pre",[e._v("arrow keys")])]),n("td",{staticClass:"tg-yw4l"},[e._v("- Pan")])])])]):e._e(),n("p",{staticClass:"body-text contact-line"},[n("b",[e._v("Send in comments, suggestions and issues to ")]),n("a",{attrs:{href:"mailto: [email protected]"}},[e._v("[email protected]")]),e._v(". ")])]),n("v-card-actions",[n("v-spacer"),n("div",e._l(e.versions,(function(t,r){return n("v-btn",{key:t.label,attrs:{text:"",color:e.page===r+1?"pink darken-1":""},on:{click:function(t){e.page=r+1}}},[e._v(" "+e._s(t.label)+" ")])})),1),n("v-spacer"),n("v-btn",{attrs:{color:"green darken-1",text:""},on:{click:function(t){e.dialog=!1}}},[e._v(" Close ")])],1)],1)],1)},kS=[],ES={data:function(){return{dialog:!1,page:1,versions:[{label:"V1.0",previousVersion:null,developers:"Aaron Heuckroth, Joshua Lippai and Radhakrishna Sanka",publicationTitle:"Sanka, Radhakrishna, Joshua Lippai, Dinithi Samarasekera, Sarah Nemsick, and Douglas Densmore. â3DμF - Interactive Design Environment for Continuous Flow Microfluidic Devices.â Scientific Reports 9, no. 1 (December 2019).",publicationUrl:"https://doi.org/10.1038/s41598-019-45623-z",showVideos:!0,showUsage:!0,showDesignsFromLiterature:!1,introductionVideoUrl:"https://www.youtube.com/embed/05nU8eQ73U8",longTutorialVideoUrl:"https://www.youtube.com/embed/YOrnnZjma28"}
1,{label:"V1.1",previousVersion:"V1.0",developers:"Yangruirui Zhou, Eric Xie and Radhakrishna Sanka",showVideos:!1,showUsage:!1,showDesignsFromLiterature:!1,guiDifferences:["Added blackbox rendering for unsupported/unknown components so incomplete imports stay visible on canvas; blackbox was cleaned out of the normal Features sidebar.","Added the terrace primitive alongside existing library components.","Extended feature settings with mirrorByX / mirrorByY reflection controls, including rotation and mirroring about geoCenter.","Improved renderer behavior so mirrored/transformed features and ports load more consistently from JSON in 2D views."],workflowImprovements:["Unknown components remain editable as placeholders instead of silently disappearing from visual output.","Reflection and geoCenter transforms reduce manual redraw work when creating symmetric layouts.","Primitive-server device rendering corrections make final layout checks and export preparation more reliable.","Neptune can open a design in 3DuF with one click via the JSON postMessage bridge.","A local-development CLI helps verify the 3DuF frontend when running on localhost."],introductionVideoUrl:"https://www.youtube.com/embed/05nU8eQ73U8",longTutorialVideoUrl:"https://www.youtube.com/embed/YOrnnZjma28"},{label:"V1.2",previousVersion:"V1.1",developers:"Yangruirui Zhou",showVideos:!0,showUsage:!0,showDesignsFromLiterature:!0,guiDifferences:["Added an All/Ports toggle above Export (same interaction pattern as FLOW/CTRL). Ports shows only flow (blue) and control (red) port circles; All restores the full layout.","Neptune LFR DIYCOMPONENT parts now render as built-in black-box placeholders instead of disappearing when the custom library entry is missing.","Square-profile channels fill the outer corner at 90° turns, so compiled CHANNEL JSON no longer shows a gap at the joint.","Component and connection settings show the netlist ID from the imported JSON for cross-checking with Parchmint / Neptune.","Mixer settings include edgeBend1 / edgeBend2; ports sit at the tip-square center. Connecting channels (rounded or square, any width) terminate on that same center. Default bendSpacing is 1400 µm and bendLength is 2000 µm.","MUX / TREE / YTREE settings use leafSpace and stageSpace; MUX valve pads use valveWidthX / valveWidthY. YTREE ports sit at RoundedChannel stadium-cap centers.","Parameter tables sort related keys together, and componentSpacing keepout is visible with a 2000 µm default.","Connection sidebar labels Channel type (square vs rounded); Edit Device refreshes spans when opened after a load; Move / Specify Position uses µm.","Parchmint FLOW and CONTROL layers open on the same physical level in the layer toolbar instead of as separate levels."],workflowImprovements:["Use Ports view when preparing a cover layer: even droplet devices need a closed second layer so fluid can flow inside channels instead of open grooves.","For cover-layer fabrication, JSON, DXF, SVG, and GCode downloads include a ports-only file in the same format as the full design.","Newly placed ports default to a 1 mm radius; channels and valve gaps default to 600 µm so FLOW pipes and VALVE3D slots match.","A channel terminates on the mixer tip-square center (and on its own tip-circle / tip-square center) regardless of which side is wider.","VALVE3D flow gaps are clipped geometrically on import so the host channel stays interrupted at the valve slit.","Reset on an imported object restores its uploaded JSON parameters; hand-placed objects still reset to library defaults.","Import / Escape clears placement ghosts so zoom cannot resurrect a stale component. Older JSON is filled with missing library defaults so new parameters still appear after you reopen a design."],introductionVideoUrl:"https://www.youtube.com/embed/05nU8eQ73U8",longTutorialVideoUrl:"https://www.youtube.com/embed/YOrnnZjma28"}]}},created:function(){this.page=this.versions.length},computed:{selectedVersion:function(){return this.versions[this.page-1]||this.versions[0]},currentVersionLabel:function(){var e=this.versions[this.versions.length-1];return e?e.label:""},pageTitle:function(){var e=this.selectedVersion.label===this.currentVersionLabel?" (Current Version)":"";return"Tutorial ".concat(this.selectedVersion.label).concat(e)}}},NS=ES,xS=(n("21d0"),Object(CC["a"])(NS,FS,kS,!1,null,"44807cc5",null)),MS=xS.exports;SC()(xS,{VBtn:DC["a"],VCard:RC["a"],VCardActions:TC["a"],VCardText:TC["b"],VCardTitle:TC["c"],VDialog:eO["a"],VSpacer:rO["a"]});var IS=function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("Dialog",{attrs:{title:"Edit Device"},on:{opened:e.syncFromDevice},scopedSlots:e._u([{key:"content",fn:function(){return[n("tr",[n("h4",{staticClass:"text--primary subtitle-1"},[e._v("Rename:")]),n("td",[n("form",{attrs:{action:"#"}},[n("div",{staticClass:"mdl-textfield mdl-js-textfield mdl-textfield--floating-label"},[n("td",[n("v-text-field",{attrs:{type:"text",label:"Device Name"},model:{value:e.deviceName,callback:function(t){e.deviceName=t},expression:"deviceName"}})],1)])])])]),n("tr",[n("h4",{staticClass:"text--primary subtitle-1"},[e._v("Resize:")]),n("td",[n("form",{attrs:{action:"#"}},[n("div",{staticClass:"mdl-textfield mdl-js-textfield mdl-textfield--floating-label"},[n("v-text-field",{attrs:{pattern:"-?[0-9]*(\\.[0-9]+)?",label:"X-Span (mm)"},model:{value:e.xspan,callback:function(t){e.xspan=t},expression:"xspan"}})],1),n("div",{staticClass:"mdl-textfield mdl-js-textfield mdl-textfield--floating-label"},[n("v-text-field",{attrs:{pattern:"-?[0-9]*(\\.[0-9]+)?",label:"Y-Span (mm)"}
1,model:{value:e.yspan,callback:function(t){e.yspan=t},expression:"yspan"}})],1)])])])]},proxy:!0},{key:"actions",fn:function(t){var r=t.callbacks;return[n("v-btn",{attrs:{dark:"",color:"green dark",elevation:"2"},on:{click:function(t){return r.close(e.onSave)}}},[e._v(" Save ")]),n("v-btn",{attrs:{dark:"",color:"red dark",elevation:"2"},on:{click:function(e){return r.close()}}},[e._v(" Cancel ")])]}}])})},WS=[],AS=function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("v-dialog",{attrs:{persistent:"","max-width":"600"},scopedSlots:e._u([{key:"activator",fn:function(t){var r=t.on,o=t.attrs;return[n("v-btn",e._g(e._b({class:e.buttonClasses,attrs:{id:e.buttonID}},"v-btn",o,!1),r),[e._v(" "+e._s(e.title)+" ")])]}}]),model:{value:e.dialog,callback:function(t){e.dialog=t},expression:"dialog"}},[n("v-card",[n("v-card-title",{staticClass:"headline"},[e._v(" "+e._s(e.title)+" ")]),n("v-card-text",[e._t("content",(function(){return[e._v(" Dialog content goes here ")]}))],2),n("v-card-actions",[n("v-spacer"),e._t("actions",(function(){return[n("v-btn",{attrs:{color:"green darken-1",text:""},on:{click:function(t){return e.callbacks.close()}}},[e._v(" Close ")])]}),{callbacks:e.callbacks})],2)],1)],1)},jS=[],BS={name:"Dialog",props:{title:{type:String,required:!0},color:{type:String,required:!1,default:""},textColor:{type:String,required:!1,default:""}},data:function(){return{dialog:!1,callbacks:{}}},computed:{buttonID:function(){return this.title.toLowerCase().replace(" ","_")+"_dialog_button"},buttonClasses:function(){return[this.color&&this.color.length>0?this.color:"white",this.textColor&&this.textColor.length>0?this.textColor:"blue--text","mb-2","feature-button","button-row"]}},mounted:function(){var e=this,t=this;$y.get().on($y.CLOSE_ALL_WINDOWS,(function(){t.dialog=!1})),l["default"].set(this.callbacks,"close",(function(t){t&&t(),e.dialog=!1}))},watch:{dialog:function(e){e&&this.$emit("opened")}}},VS=BS,XS=Object(CC["a"])(VS,AS,jS,!1,null,"6dde4036",null),YS=XS.exports;SC()(XS,{VBtn:DC["a"],VCard:RC["a"],VCardActions:TC["a"],VCardText:TC["b"],VCardTitle:TC["c"],VDialog:eO["a"],VSpacer:rO["a"]});var GS={components:{Dialog:YS},data:function(){return{dialog:!1,deviceName:"",xspan:"",yspan:""}},mounted:function(){this.syncFromDevice(),"undefined"!==typeof window&&"function"===typeof window.addEventListener&&window.addEventListener("threeduf-device-loaded",this.syncFromDevice)},beforeDestroy:function(){"undefined"!==typeof window&&"function"===typeof window.removeEventListener&&window.removeEventListener("threeduf-device-loaded",this.syncFromDevice)},methods:{syncFromDevice:function(){var e=Pd.currentDevice;if(e){this.deviceName=e.name||"";var t=Number(e.getXSpan()),n=Number(e.getYSpan());this.xspan=Number.isFinite(t)?t/1e3:"",this.yspan=Number.isFinite(n)?n/1e3:""}},onSave:function(){Pd.currentDevice.name=this.deviceName,Pd.currentDevice.setXSpan(1e3*this.xspan),Pd.currentDevice.setYSpan(1e3*this.yspan),Pd.viewManager.view.showActiveLayer(),Pd.viewManager.updateDevice(Pd.currentDevice,!1)}}},US=GS,zS=Object(CC["a"])(US,IS,WS,!1,null,"1c011fc6",null),HS=zS.exports;SC()(zS,{VBtn:DC["a"],VTextField:oO["a"]});var KS=function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("Dialog",{attrs:{title:"Import (.json / .dxf)"},scopedSlots:e._u([{key:"content",fn:function(){return[n("h4",[e._v("Supported input formats: JSON and DXF only")]),n("div",{staticClass:"mdl-dialog__content"},[n("v-card",{staticClass:"mx-auto d-flex align-center justify-center text-body-2",attrs:{id:"drop_box_import",tile:"",outlined:"",width:"400",color:"grey lighten-2",height:"200"},on:{dragover:function(e){e.preventDefault()},drop:function(t){return t.preventDefault(),e.onDrop.apply(null,arguments)}}},[e._v(" Drop a .json or .dxf file here ")]),n("input",{ref:"file",staticClass:"hidden-import-input",attrs:{id:"import_input",type:"file",accept:".json,.dxf,application/json"},on:{change:e.onFileChange}}),n("div",{staticClass:"import-file-picker"},[n("v-btn",{staticClass:"mr-2",attrs:{small:""},on:{click:e.selectFile}},[e._v(" Choose File ")]),n("span",{staticClass:"text-caption"},[e._v(e._s(e.selectedFileName||"No file chosen"))])],1)],1)]},proxy:!0},{key:"actions",fn:function(t){var r=t.callbacks;return[n("v-btn",{staticClass:"white--text",attrs:{color:"green dark"},on:{click:function(t){return e.importSelectedFile(r)}}},[e._v(" Confirm ")]),n("v-btn",{staticClass:"white--text",attrs:{color:"red dar
1k"},on:{click:function(e){return r.close()}}},[e._v(" Cancel ")])]}}])})},qS=[],JS=n("0d37"),ZS=n.n(JS);function $S(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function QS(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?$S(Object(n),!0).forEach((function(t){eD(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):$S(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function eD(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function tD(e){return oD(e)||rD(e)||uD(e)||nD()}function nD(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function rD(e){if("undefined"!==typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}function oD(e){if(Array.isArray(e))return hD(e)}function iD(e,t){return sD(e)||lD(e,t)||uD(e,t)||aD()}function aD(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function lD(e,t){var n=null==e?null:"undefined"!==typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,i=[],a=!0,l=!1;try{for(n=n.call(e);!(a=(r=n.next()).done);a=!0)if(i.push(r.value),t&&i.length===t)break}catch(s){l=!0,o=s}finally{try{a||null==n["return"]||n["return"]()}finally{if(l)throw o}}return i}}function sD(e){if(Array.isArray(e))return e}function cD(e,t){var n="undefined"!==typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=uD(e))||t&&e&&"number"===typeof e.length){n&&(e=n);var r=0,o=function(){};return{s:o,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,l=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return a=e.done,e},e:function(e){l=!0,i=e},f:function(){try{a||null==n.return||n.return()}finally{if(l)throw i}}}}function uD(e,t){if(e){if("string"===typeof e)return hD(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?hD(e,t):void 0}}function hD(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var fD=1e3,dD=.001,pD=.05;function yD(e){return"".concat(Math.round(e.x/pD),"_").concat(Math.round(e.y/pD),"_").concat(Math.round(e.z/pD))}function mD(e){if(e.vertices&&e.vertices.length>=2){var t,n,r,o=e.vertices[0],i=e.vertices[e.vertices.length-1];return[{x:o.x,y:o.y,z:null!==(t=o.z)&&void 0!==t?t:0},{x:i.x,y:i.y,z:null!==(n=null!==(r=i.z)&&void 0!==r?r:o.z)&&void 0!==n?n:0}]}var a,l;return e.startPoint&&e.endPoint?[{x:e.startPoint.x,y:e.startPoint.y,z:null!==(a=e.startPoint.z)&&void 0!==a?a:0},{x:e.endPoint.x,y:e.endPoint.y,z:null!==(l=e.endPoint.z)&&void 0!==l?l:0}]:null}function vD(e,t,n){e.minX=Math.min(e.minX,t),e.maxX=Math.max(e.maxX,t),e.minY=Math.min(e.minY,n),e.maxY=Math.max(e.maxY,n)}function gD(e,t){var n,r=[],o=[],i=0,a=cD(t);try{for(a.s();!(n=a.n()).done;){var l=n.value;if("LINE"===l.type){var s=mD(l);if(!s)continue;var c=iD(s,2),u=c[0],h=c[1];i=u.z,r.push({a:u,b:h,layer:e}),vD({minX:1/0,maxX:-1/0,minY:1/0,maxY:-1/0},u.x,u.y)}else if("CIRCLE"===l.type&&l.center){var f,d={x:l.center.x,y:l.center.y,z:null!==(f=l.center.z)&&void 0!==f?f:0};i=d.z,o.push({center:d,radius:l.radius,layer:e})}}}catch(p){a.e(p)}finally{a.f()}return{name:e,z:i,lines:r,circles:o}}function wD(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:.5;if(4!==e.lines.length)return!1;var n,r=new Set,o=new Set,i=cD(e.lines);try{for(i.s();!(n=i.n()).done;){var a=n.value;r.add(Math.round(a.a.x/t)*t),r.add(Math.round(a.b.x/t)*t),o.add(Math.round(a.a.y/t)*t),o.add(Math.round(a.b.y/t)*t)}}catch(l){i.e(l)}finally{i.f()}return 2===r.size&&2===o.size}function bD(e){var t=e.lines.flatMap((function(e){return[e.a.x,e.b.x]}
1)),n=e.lines.flatMap((function(e){return[e.a.y,e.b.y]}));return t.length&&n.length?Math.max(0,Math.max.apply(Math,tD(t))-Math.min.apply(Math,tD(t)))*Math.max(0,Math.max.apply(Math,tD(n))-Math.min.apply(Math,tD(n))):0}function _D(e){if(0===e.length)return null;var t=e.filter((function(e){return/border/i.test(e.name)})),n=t.length>0?t:e;return n.reduce((function(e,t){return bD(t)>bD(e)?t:e}))}function PD(e){var t,n={minX:1/0,maxX:-1/0,minY:1/0,maxY:-1/0},r=cD(e);try{for(r.s();!(t=r.n()).done;){var o,i=t.value,a=cD(i.lines);try{for(a.s();!(o=a.n()).done;){var l=o.value;vD(n,l.a.x,l.a.y),vD(n,l.b.x,l.b.y)}}catch(h){a.e(h)}finally{a.f()}var s,c=cD(i.circles);try{for(c.s();!(s=c.n()).done;){var u=s.value;vD(n,u.center.x-u.radius,u.center.y-u.radius),vD(n,u.center.x+u.radius,u.center.y+u.radius)}}catch(h){c.e(h)}finally{c.f()}}}catch(h){r.e(h)}finally{r.f()}return Number.isFinite(n.minX)?n:{minX:0,minY:0,maxX:100,maxY:100}}function CD(e){var t,n=new Map,r=cD(e);try{for(r.s();!(t=r.n()).done;){var o=t.value,i=yD(o.center);n.has(i)||n.set(i,o)}}catch(a){r.e(a)}finally{r.f()}return Array.from(n.values())}function OD(e,t){var n,r=[],o=new Map,i=0,a=cD(e);try{for(a.s();!(n=a.n()).done;){var l=n.value;i=Math.max(i,l.z);var s,c=cD(l.lines);try{for(c.s();!(s=c.n()).done;){var u=s.value;DD(u,l)||r.push(u)}}catch(p){c.e(p)}finally{c.f()}var h,f=cD(l.circles);try{for(f.s();!(h=f.n()).done;){var d=h.value;o.set(yD(d.center),d)}}catch(p){f.e(p)}finally{f.f()}}}catch(p){a.e(p)}finally{a.f()}return{name:"channel_merged",z:i,lines:LD(SD(r),t),circles:Array.from(o.values())}}function SD(e){var t,n=new Set,r=[],o=cD(e);try{for(o.s();!(t=o.n()).done;){var i=t.value,a=[Math.round(1e3*i.a.x),Math.round(1e3*i.a.y),Math.round(1e3*i.b.x),Math.round(1e3*i.b.y)].sort().join("_");n.has(a)||(n.add(a),r.push(i))}}catch(l){o.e(l)}finally{o.f()}return r}function DD(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:.5;if(!wD(t))return!1;var r=t.lines.flatMap((function(e){return[e.a.x,e.b.x]})),o=t.lines.flatMap((function(e){return[e.a.y,e.b.y]})),i=Math.min.apply(Math,tD(r)),a=Math.max.apply(Math,tD(r)),l=Math.min.apply(Math,tD(o)),s=Math.max.apply(Math,tD(o));return TD(e,{minX:i,maxX:a,minY:l,maxY:s},n)}function RD(e){if(!e||0===e.lines.length)return null;var t=e.lines.flatMap((function(e){return[e.a.x,e.b.x]})),n=e.lines.flatMap((function(e){return[e.a.y,e.b.y]}));return{minX:Math.min.apply(Math,tD(t)),maxX:Math.max.apply(Math,tD(t)),minY:Math.min.apply(Math,tD(n)),maxY:Math.max.apply(Math,tD(n))}}function TD(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:.6,r=Math.abs(e.a.x-t.minX)<n&&Math.abs(e.b.x-t.minX)<n,o=Math.abs(e.a.x-t.maxX)<n&&Math.abs(e.b.x-t.maxX)<n,i=Math.abs(e.a.y-t.minY)<n&&Math.abs(e.b.y-t.minY)<n,a=Math.abs(e.a.y-t.maxY)<n&&Math.abs(e.b.y-t.maxY)<n;return r||o||i||a}function LD(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:.6,r=RD(t);return r?e.filter((function(e){return!TD(e,r,n)})):e}function FD(e){var t,n,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"imported",o=null!==(t=null===e||void 0===e?void 0:e.entities)&&void 0!==t?t:[],i=new Map,a=cD(o);try{for(a.s();!(n=a.n()).done;){var l=n.value;if("POINT"!==l.type&&"DIMENSION"!==l.type&&"MTEXT"!==l.type){var s=l.layer||"default";i.has(s)||i.set(s,[]),i.get(s).push(l)}}}catch(E){a.e(E)}finally{a.f()}var c,u=[],h=cD(i.entries());try{for(h.s();!(c=h.n()).done;){var f=iD(c.value,2),d=f[0],p=f[1];u.push(gD(d,p))}}catch(E){h.e(E)}finally{h.f()}u.sort((function(e,t){return e.z-t.z||e.name.localeCompare(t.name)}));for(var y=PD(u),m=u.length>0?Math.min.apply(Math,tD(u.map((function(e){return e.z})))):0,v=null,g=[],w=[],b=0,_=u;b<_.length;b++){var P=_[b];P.z<=m+.01&&wD(P)?w.push(P):(P.lines.length>0||P.circles.length>0)&&g.push(P)}v=_D(w);for(var C=0,O=w;C<O.length;C++){var S=O[C];v&&S.name===v.name||(S.lines.length>0||S.circles.length>0)&&g.push(S)}!v&&u.length>0&&(v=u[0]);var D=u.map((function(e){return e.z})),R=Math.min.apply(Math,tD(D).concat([0])),T=g.length>0?Math.min.apply(Math,tD(g.map((function(e){return e.z})))):R,L=Math.max.apply(Math,tD(D)),F=L;L-R>=8&&(F=L+2);var k=Math.max(F-T,.5);return{sourceName:r,sketches:u,borderSketch:v,channelSketches:g,bounds:y,baseZ:R,channelFloorZ:T,channelTopZ:F,channelHeight:k,entities:o}}function kD(e,t){return[ED(e.x-t.bounds.minX),ED(t.bounds.maxY-e.y)]}function ED(e){return e*fD}function ND(e,t){return Math.hypot(e[0]-t[0],e[1]-t[1])}function xD(e){if(0===e.channelSketches.length)return{name:"empty",z:e.channelFloorZ,lines:[],circles:[]};if(1===e.channelSketches.length){var t=e.channelSketches[0],n=t.lines.filter((function(e){return!D
1D(e,t)}));return QS(QS({},t),{},{lines:LD(n,e.borderSketch),circles:CD(t.circles)})}return OD(e.channelSketches,e.borderSketch)}function MD(e,t){var n=t.b.x-t.a.x,r=t.b.y-t.a.y,o=Math.hypot(n,r);if(o<dD)return 1;var i,a=-r/o,l=n/o,s=1,c=cD(e);try{for(c.s();!(i=c.n()).done;){var u=i.value;if(u!==t){var h=u.b.x-u.a.x,f=u.b.y-u.a.y,d=Math.hypot(h,f);if(!(d<dD)){var p=Math.abs((n*h+r*f)/(o*d));if(!(p<.98)){var y=Math.abs(a*(u.a.x-t.a.x)+l*(u.a.y-t.a.y));y>.2&&y<20&&y<1.5*s&&(s=y)}}}}}catch(m){c.e(m)}finally{c.f()}return s}function ID(e){return{sourceName:e.sourceName,bounds:e.bounds,baseZ:e.baseZ,channelFloorZ:e.channelFloorZ,channelTopZ:e.channelTopZ,channelHeight:e.channelHeight,entities:e.entities}}function WD(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function AD(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?WD(Object(n),!0).forEach((function(t){jD(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):WD(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function jD(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function BD(e,t){return YD(e)||XD(e,t)||qD(e,t)||VD()}function VD(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function XD(e,t){var n=null==e?null:"undefined"!==typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,i=[],a=!0,l=!1;try{for(n=n.call(e);!(a=(r=n.next()).done);a=!0)if(i.push(r.value),t&&i.length===t)break}catch(s){l=!0,o=s}finally{try{a||null==n["return"]||n["return"]()}finally{if(l)throw o}}return i}}function YD(e){if(Array.isArray(e))return e}function GD(e){return HD(e)||zD(e)||qD(e)||UD()}function UD(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function zD(e){if("undefined"!==typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}function HD(e){if(Array.isArray(e))return JD(e)}function KD(e,t){var n="undefined"!==typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=qD(e))||t&&e&&"number"===typeof e.length){n&&(e=n);var r=0,o=function(){};return{s:o,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,l=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return a=e.done,e},e:function(e){l=!0,i=e},f:function(){try{a||null==n.return||n.return()}finally{if(l)throw i}}}}function qD(e,t){if(e){if("string"===typeof e)return JD(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?JD(e,t):void 0}}function JD(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var ZD=1e3,$D=2e3,QD=2e3;function eR(e){var t=xD(e);if(!t.lines.length)return ZD;var n,r=0,o=0,i=KD(t.lines);try{for(i.s();!(n=i.n()).done;){var a=n.value,l=MD(t.lines,a);l>.2&&l<20&&(r+=l,o+=1)}}catch(s){i.e(s)}finally{i.f()}return 0===o?ZD:Math.max(100,Math.round(ED(r/o)))}function tR(){return rf.generateID()}function nR(e){for(var t=[],n=0;n<e.length-1;n++)t.push([e[n],e[n+1]]);return t}function rR(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:25;if(0===e.length)return e;for(var n=[e[0]],r=1;r<e.length;r++){var o=n[n.length-1],i=e[r];ND(o,i)>t&&n.push(i)}return n}function oR(e,t){var n,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1500,o=[],i=[],a=new Map,l=function(e){for(var t=0;t<o.length;t++)if(ND(o[t],e)<r){var n=i[t];return o[t]=[(o[t][0]*n+e[0])/(n+1),(o[t][1]*n+e[1])/(n+1)],i[t]=n+1,t}return o.push(e),i.push(1),o.length-1},s=function(e,t){e!==t&&(a.has(e)||a.set(e,new Set),a.has(t)||a.set(t,new Set),a.get(e).add(t),a.get(t).add(e))},c=KD(e);try{for(c.s();!(n=c.n()).done;){var u=n.value;s(l(kD(u.a,t)),l(kD(u.b,t)))}}catch(h){c.e(h)}finally{c.f()}return{graph:a,nodes:o}}function iR(e,t){for(var n=0,r=1/0,o=0;o<t.length;o++){var i=ND(t[o],e);i<r&&(r=i,n=o)}return n}
1function aR(e,t,n){var r,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:2500,i=[],a=KD(t);try{for(a.s();!(r=a.n()).done;)for(var l=r.value,s=function(){var r=u[c],a=kD(r,n),l=ND(a,e);if(l>o)return"continue";var s,h=0,f=KD(t);try{for(f.s();!(s=f.n()).done;)for(var d=s.value,p=0,y=[d.a,d.b];p<y.length;p++){var m=y[p];ND(kD(m,n),a)<500&&h++}}catch(v){f.e(v)}finally{f.f()}i.some((function(e){return ND(e.um,a)<100}))||i.push({um:a,mmY:r.y,lineCount:h,dist:l})},c=0,u=[l.a,l.b];c<u.length;c++)s()}catch(h){a.e(h)}finally{a.f()}return 0===i.length?e:(i.sort((function(e,t){return t.lineCount!==e.lineCount?t.lineCount-e.lineCount:t.mmY!==e.mmY?t.mmY-e.mmY:e.dist-t.dist})),i[0].um)}function lR(e,t){var n=xD(e),r=[];if(t.length<2||0===n.lines.length)return r;var o=oR(n.lines,e),i=o.graph,a=o.nodes,l=t.map((function(t){return kD(t.center,e)})),s=l.map((function(e){return iR(e,a)})),c=new Set,u=t.map((function(e){return e.center.y})),h=Math.min.apply(Math,GD(u)),f=Math.max.apply(Math,GD(u)),d=t.filter((function(e){return e.center.y<=h+.5})),p=t.filter((function(e){return e.center.y>=f-.5})),y=[];if(d.length>0&&p.length>0&&d.length!==t.length)for(var m=0;m<d.length;m++)for(var v=0;v<p.length;v++)y.push([t.indexOf(d[m]),t.indexOf(p[v])]);else for(var g=0;g<s.length;g++)for(var w=g+1;w<s.length;w++)y.push([g,w]);function b(e,t){var n=[{node:e,path:[e]}],r=new Set([e]);while(n.length>0){var o=n.shift(),a=o.node,l=o.path;if(a===t)return l;var s,c=KD(i.get(a)||[]);try{for(c.s();!(s=c.n()).done;){var u=s.value;r.has(u)||(r.add(u),n.push({node:u,path:[].concat(GD(l),[u])}))}}catch(h){c.e(h)}finally{c.f()}}return null}for(var _=0,P=y;_<P.length;_++){var C=BD(P[_],2),O=C[0],S=C[1],D=s[O],R=s[S],T=[D,R].sort((function(e,t){return e-t})).join("|");if(!c.has(T)){var L=b(D,R);if(L&&!(L.length<2)){c.add(T);var F=L.slice(1,-1).map((function(t){return aR(a[t],n.lines,e)})),k=rR([l[O]].concat(GD(F),[l[S]])),E=tR(),N=tR();r.push({featureId:E,connectionId:N,sourceComponentId:t[O].id,sinkComponentId:t[S].id,wayPoints:k,segments:nR(k)})}}}return r}function sR(e){return e.map((function(e){return new ff(e).toJSON()}))}function cR(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"DXF Import",n=FD(e,t.replace(/\.dxf$/i,"")),r=xD(n),o=eR(n),i=ED(n.bounds.maxX-n.bounds.minX),a=ED(n.bounds.maxY-n.bounds.minY),l=tR(),s=tR(),c=tR(),u=tR(),h=tR(),f=tR(),d=[],p=[],y=[];if(n.borderSketch){var m=tR(),v=n.borderSketch.lines.map((function(e){return{type:"LINE",vertices:[{x:e.a.x,y:e.a.y,z:e.a.z},{x:e.b.x,y:e.b.y,z:e.b.z}],layer:e.layer}}));d.push({id:m,name:"Border",macro:"EDGE",params:{},type:"EDGE",referenceID:m,dxfData:sR(v),layerID:l})}var g,w=[],b=KD(r.circles);try{for(b.s();!(g=b.n()).done;){var _=g.value,P=tR(),C=tR(),O=kD(_.center,n),S=ED(_.radius),D=[O[0]-S,O[1]-S];p.push({id:P,name:"Port_".concat(w.length+1),entity:"PORT",params:{position:D,portRadius:S,height:QD,componentSpacing:2e3},"x-span":2*S,"y-span":2*S,ports:[{x:0,y:0,layer:"FLOW",label:"1"}],layers:[l]}),d.push({id:C,name:"Port_".concat(w.length+1),macro:"Port",params:{position:O,portRadius:S,height:QD,componentSpacing:2e3},type:"XY",referenceID:P,dxfData:[],layerID:l}),w.push({id:P,center:_.center})}}catch(N){b.e(N)}finally{b.f()}for(var R=lR(n,w),T=0;T<R.length;T++){var L=R[T],F=L.featureId,k=L.connectionId;y.push({id:k,name:"CHANNEL_".concat(T+1),entity:"CHANNEL",source:{component:L.sourceComponentId,port:"1"},sinks:[{component:L.sinkComponentId,port:"1"}],paths:[{source:{component:L.sourceComponentId,port:"1"},sink:{component:L.sinkComponentId,port:"1"},wayPoints:L.wayPoints,features:[]}],params:{start:["Point",L.wayPoints[0][0],L.wayPoints[0][1]],end:L.wayPoints[L.wayPoints.length-1],wayPoints:L.wayPoints,segments:L.segments,crossSection:1,connectionSpacing:o+600,channelWidth:o,height:$D},layer:l}),d.push({id:F,name:"CHANNEL_".concat(T+1),macro:"Connection",params:{start:["Point",L.wayPoints[0][0],L.wayPoints[0][1]],end:L.wayPoints[L.wayPoints.length-1],wayPoints:L.wayPoints,segments:L.segments,crossSection:1,connectionSpacing:o+600,channelWidth:o,height:$D},type:"XY",referenceID:k,dxfData:[],layerID:l})}var E={name:n.sourceName,params:{width:i,length:a,dxfImport:ID(n)},layers:[{id:l,name:"LayerFlow_1",type:"FLOW",group:"0",params:{z_offset:0,flip:!1},features:d},{id:s,name:"LayerControl_1",type:"CONTROL",group:"0",params:{z_offset:0,flip:!1},features:[]},{id:c,name:"LayerIntegration_1",type:"INTEGRATION",group:"0",params:{z_offset:0,flip:!1},features:[]}],groups:["0"],components:p,connections:y,valves:[],version:"1.2",renderLayers:[{id:u,name:"RenderLayerFlow_1",modellayer:l,type:"FLOW",features:d.map((function(e){return AD({},e)})),color:"indigo"},{id:h,name:"RenderLayerControl_1",modellayer:s,type:"CONTROL",features:[],color:"red"},{id:f,name:"RenderLayerIntegration_1",modellayer:c,type:"INTEGRATION",features:[],color:"green"}],features:[]};return E}function uR(e){if(!e||!e.dxfImport)return null;var t=e.dxfImport;return t.entities?FD({entities:t.entities},t.sourceName||"device"):null}function hR(e){var t=e.getOptionalParam("dxfImport");return t?uR({dxfImport:t}):null}function fR(e){return fR="function"===typeof Symbol&&"symbol"===typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"===typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},fR(e)}var dR={components:{Dialog:YS},data:function(){return{selectedFile:null,selectedFileName:"",parsedDXF:null}},methods:{selectFile:function(){this.$refs.file&&this.$refs.file.click()},onDrop:function(e){var t,n=null===e||void 0===e||null===(t=e.dataTransfer)||void 0===t?void 0:t.files;n&&0!==n.length&&this.consumeFile(n[0])},onFileChange:function(){var e,t,n=null===(e=this.$refs.file)||void 0===e||null===(t=e.files)||void 0===t?void 0:t[0];n&&this.consumeFile(n)},getFileExtension:function(e){var t=String(e||"").toLowerCase().split(".");return t.length>1?t.pop():""},consumeFile:function(e){var t=String((null===e||void 0===e?void 0:e.name)||""),n=this.getFileExtension(t);if("json"!==n&&"dxf"!==n)return this.selectedFile=null,this.selectedFileName="",this.$refs.file&&(this.$refs.file.value=""),void alert("Only .json and .dxf files are supported.");this.selectedFile=e,this.selectedFileName=t,this.parsedDXF=null},readSelectedFileText:function(){var e=this;if(!this.selectedFile)throw new Error("No file selected.");return new Promise((function(t,n){var r=new FileReader;r.onload=function(){return t(String(r.result||""))},r.onerror=function(){return n(new Error("Failed to read file."))},r.readAsText(e.selectedFile)}))},parseJsonFor3DuF:function(e){if(null!=e&&"object"===fR(e))return e;if("string"!==typeof e)throw new Error("File content is not a JSON string.");var t,n=e.trim();if(!n)throw new Error("JSON file is empty.");if(n.toLowerCase().startsWith("<!doctype html")||n.toLowerCase().startsWith("<html"))throw new Error("Received HTML instead of JSON.");if("[object Object]"===n)throw new Error("JSON content is corrupted as [object Object].");try{t=JSON.parse(n)}catch(r){throw new Error("Invalid JSON format.")}if("string"===typeof t)try{t=JSON.parse(t)}catch(r){throw new Error("JSON payload is double-encoded but invalid.")}if(!t||"object"!==fR(t))throw new Error("Parsed JSON must be an object.");return t},parseSelectedDXF:function(){var e=this;if(!this.selectedFile)throw new Error("No DXF file selected.");var t=new ZS.a;return new Promise((function(n,r){var o=new FileReader;o.onload=function(){try{var e=String(o.result||""),i=t.parseSync(e);n(i)}catch(a){r(a)}},o.onerror=function(){return r(new Error("Failed to read DXF file."))},o.readAsText(e.selectedFile)}))},importSelectedFile:function(e){var t,n=this.getFileExtension(this.selectedFileName);this.selectedFile&&n?(t="dxf"===n?this.importDXF():"json"===n?this.importJSON():Promise.reject(new Error("Unsupported file type.")),t.then((function(){e&&e.close&&e.close()})).catch((function(e){var t=e&&e.message?e.message:String(e);alert("Import failed: "+t)}))):alert("Please choose a .json or .dxf file first.")},importDXF:function(){var e=this;if(null==Pd.viewManager)throw new Error("3DuF view manager is not ready.");return this.parseSelectedDXF().then((function(t){e.parsedDXF=t;var n=cR(t,e.selectedFileName);Pd.viewManager.loadDeviceFromJSON(n),Pd.viewManager.updateGrid(),Pd.viewManager.refresh()}))},importJSON:function(){var e=this;if(null==Pd.viewManager||!Pd.viewManager.loadDeviceFromJSON)throw new Error("3DuF view manager is not ready.");return this.readSelectedFileText().then((function(t){var n=e.parseJsonFor3DuF(t);Pd.viewManager.loadDeviceFromJSON(n),Pd.viewManager.updateGrid(),Pd.viewManager.refresh()}))}}},pR=dR,yR=(n("257c"),Object(CC["a"])(pR,KS,qS,!1,null,"0120caff",null)),mR=yR.exports;SC()(yR,{VBtn:DC["a"],VCard:RC["a"]});var vR=function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("Dialog",{attrs:{title:"Insert Text"},scopedSlots:e._u([{key:"content",fn:function(){return[n("form",{attrs:{action:"#"}},[n("tr",[n("td",[n("v-card-text",[n("p",{staticClass:"text--primary subtitle-1"},[e._v("Text:")])])],1),n("td",{attrs:{width:"125px"}},[n("v-text-field",{model:{value:e.text,callback:function(t){e.text=t},expression:"text"}})],1),n("td",[n("v-card-text",[n("p",{staticClass:"text--primary subtitle-1"},[e._v("Font Size:")])])],1),n("td",{attrs:{width:"125px"}},[n("v-text-field",{attrs:{step:1,type:"number"},model:{value:e.fontSize,callback:function(t){e.fontSize=t},expression:"fontSize"}})],1)]),n("tr",[n("td",{attrs:{width:"100px"}},[n("v-card-text")],1),n("td",[n("v-card-text")],1),n("td",[n("v-card-text",[n("p",{staticClass:"text--primary subtitle-1"},[e._v("Select Layer:")])])],1),n("td",[n("v-select",{attrs:{items:e.displayLayers,label:"Dropdown"}})],1)])])]},proxy:!0},{key:"actions",fn:function(t){var r=t.callbacks;return[n("v-spacer"),n("v-col",[n("v-btn",{staticClass:"pa-2",style:{right:"75%",transform:"translateX(-100%)"}
1,attrs:{color:"red darken-1",dark:""},on:{click:function(e){return r.close()}}},[e._v(" Cancel ")]),n("v-spacer")],1),n("v-btn",{staticClass:"pa-2",style:{right:"30%",transform:"translateX(-30%)"},attrs:{color:"green darken-1",dark:""},on:{click:function(t){return r.close(e.insertText)}}},[e._v(" Insert ")])]}}])},[n("v-card-title",{staticClass:"h6"},[e._v("Insert")])],1)},gR=[],wR={components:{Dialog:YS},data:function(){return{text:"",fontSize:"12",layers:[]}},computed:{displayLayers:function(){var e=this.layers.map((function(e,t){var n="Layer ".concat(Math.floor(t/3)+1," - ").concat(e.name);return n}));return e}},mounted:function(){var e=this;setTimeout((function(){e.layers=Pd.currentDevice.layers,e.fontSize=Pd.viewManager.tools.InsertTextTool.fontSize}),1e3)},methods:{insertText:function(){Pd.viewManager.tools.InsertTextTool.text=this.text,Pd.viewManager.tools.fontSize=parseInt(this.fontSize),Pd.viewManager.activateTool("InsertTextTool")}}},bR=wR,_R=Object(CC["a"])(bR,vR,gR,!1,null,null,null),PR=_R.exports;SC()(_R,{VBtn:DC["a"],VCardText:TC["b"],VCardTitle:TC["c"],VCol:QC["a"],VSelect:pS["a"],VSpacer:rO["a"],VTextField:oO["a"]});var CR=function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("v-card",{attrs:{elevation:"0"}},[n("v-card-title",{staticClass:"py-2"},[n("span",[e._v("Levels")]),n("v-btn",{attrs:{icon:"",small:"",fab:"",color:"primary"},on:{click:e.addLevel}},[n("v-icon",[e._v("mdi-plus")])],1)],1),n("v-card-text",{staticClass:"px-1"},e._l(e.levels,(function(t){return n("div",{key:t.id,staticClass:"my-1 mx-3"},[n("v-btn",{attrs:{disabled:0===t.id,icon:"",small:""},on:{click:function(n){return e.deleteLevel(t)}}},[n("v-icon",[e._v("mdi-delete")])],1),n("v-btn-toggle",{attrs:{tile:"",borderless:""}},[n("v-btn",{class:e.getButtonTextClass(t,0),attrs:{small:"",depressed:"",color:e.getButtonColor(t,0)},on:{click:function(n){return e.layerModeClicked(t,0)}}},[n("span",[e._v("FLOW")])]),n("v-btn",{class:e.getButtonTextClass(t,1),attrs:{small:"",depressed:"",color:e.getButtonColor(t,1)},on:{click:function(n){return e.layerModeClicked(t,1)}}},[n("span",[e._v("CTRL")])])],1)],1)})),0)],1)},OR=[],SR={name:"LayerToolbar",data:function(){return{selectedMode:0,disabled:!1,renderLayers:[],layers:[],levels:[],toggleMode:[0],toolbarActiveLayerIndex:0}},computed:{selectedLevel:function(){var e=this.toolbarActiveLayerIndex,t=e%3;return(e-t)/3}},watch:{layers:{handler:function(e){console.log("layers changed",e),this.rebuildLevelsFromLayers(e)}}},mounted:function(){var e=this;this._onDeviceLoaded=function(){Pd.currentDevice&&(e.layers=Pd.currentDevice.layers,e.syncToolbarActiveIndex(),e.rebuildLevelsFromLayers(e.layers))},window.addEventListener("threeduf-device-loaded",this._onDeviceLoaded),setTimeout(this._onDeviceLoaded,1e3)},beforeDestroy:function(){this._onDeviceLoaded&&window.removeEventListener("threeduf-device-loaded",this._onDeviceLoaded)},methods:{syncToolbarActiveIndex:function(){var e=Pd.viewManager.activeRenderLayerIndex;e%3===2&&(e=3*Math.floor(e/3),Pd.viewManager.setActiveRenderLayer(e)),this.toolbarActiveLayerIndex=e},rebuildLevelsFromLayers:function(e){this.syncToolbarActiveIndex();var t=Array.isArray(e)?e:[],n=[],r=new Set;t.forEach((function(e){var t=String(e&&null!=e.group?e.group:"0");r.has(t)||(r.add(t),n.push(t))})),n.sort((function(e,t){return Number(e)-Number(t)}));var o=this.toolbarActiveLayerIndex,i=Math.floor(o/3),a=o%3;2===a&&(a=0),this.levels=n.map((function(e){var t=Number(e);return{id:Number.isFinite(t)?t:0,mode:t===i?a:null}}))},addLevel:function(){Pd.viewManager.createNewLayerBlock(),this.layers=Pd.currentDevice.layers,this.rebuildLevelsFromLayers(this.layers)},layerModeClicked:function(e,t){for(var n in this.levels)this.levels[n].id==e.id?this.levels[n].mode=t:this.levels[n].mode=null;this.levels[e.id].mode=t,Pd.viewManager.setActiveRenderLayer(3*e.id+t),this.toolbarActiveLayerIndex=3*e.id+t},deleteLevel:function(e){Pd.viewManager.deleteLayerBlock(e.id),this.layers=Pd.currentDevice.layers,this.rebuildLevelsFromLayers(this.layers)},getButtonColor:function(e,t){var n=this.toolbarActiveLayerIndex,r=Math.floor(n/3),o=n%3;return 2===o&&(o=0),e.id!==r?"grey lighten-2":o===t?0===t?"blue":"red":"grey lighten-2"},getButtonTextClass:function(e,t){var n=this.toolbarActiveLayerIndex,r=Math.floor(n/3),o=n%3;return 2===o&&(o=0),e.id===r&&o===t?"white--text":"grey--text text--darken-2"}}},DR=SR,RR=(n("ef8c"),n("a609")),TR=Object(CC["a"])(DR,CR,OR,!1,null,"4972d510",null),LR=TR.exports;SC()(TR,{VBtn:DC["a"],VBtnToggle:RR["a"],VCard:RC["a"],VCardText:TC["b"],VCardTitle:TC["c"],VIcon:MO["a"]});var FR=function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("div",[n("v-divider"),n("v-card",{attrs:{elevation:"0"}},[n("v-card-title",{staticClass:"py-2"},[n("span",[e._v("Features")])]),n("v-card-text",{staticClass:"px-1"},[n("ConnectionPropertyDrawer",{attrs:{"active-sidebar-mint":e.activeSidebarMint,"active-settings-mint":e.activeSettingsMint}}),n("PropertyDrawer",{attrs:{mint:"ALIGNMENT MARKS",spec:e.alignmentMarksSpec,"active-sidebar-mint":e.activeSidebarMint,"active-settings-mint":e.activeSettingsMint}})],1)],1),n("v-divider"),e._l(e.toolCategoryOrder,(function(t){return n("v-card",{key:t,attrs:{elevation:"0"}},[n("v-card-title",{staticClass:"py-2"},[n("span",[e._v(e._s(t))])]),n("v-card-text",{staticClass:"px-1"},e._l(e.toolTree[t],(function(t){return n("PropertyDrawer",{key:t,attrs:{mint:t,"active-sidebar-mint":e.activeSidebarMint,"active-settings-mint":e.activeSettingsMint}})})),1),n("v-divider")],1)}))],2)},kR=[],ER=function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("div",{staticClass:"property-drawer-parent"},[n("div",{ref:"settingsAnchor",staticClass:"property-drawer-row"},[n("v-tooltip",{attrs:{bottom:"","max-width":"300"},scopedSlots:e._u([{key:"activator",fn:function(t){var r=t.on,o=t.attrs;return[n("v-btn",e._g(e._b({ref:"activator",class:e.buttonClasse
1s,attrs:{medium:""},on:{click:function(t){return e.activateTool()}}},"v-btn",o,!1),r),[e._v(" "+e._s(e.shortenedMINT)+" ")])]}}])},[n("span",[e._v(e._s(e.mintTooltip))])]),n("v-btn",{staticClass:"settings-gear-btn",class:{"settings-gear-btn--open":e.isSettingsRowOpen},attrs:{icon:"",medium:"",text:"",ripple:!1,elevation:"0"},on:{click:function(t){return t.stopPropagation(),e.showProperties()}}},[n("v-icon",{staticClass:"settings-gear-icon"},[e._v("mdi-cog")])],1)],1)])},NR=[],xR={"ALIGNMENT MARKS":"Add lithography or layer alignment fiducial marks.",MIXER:"Serpentine mixer for diffusive or chaotic mixing.",MIXER3D:"Three-dimensional mixer geometry.","TOROIDAL MIXER":"Toroidal (ring-shaped) mixing structure.","GRADIENT GENERATOR":"Network to split and recombine flows for concentration gradients.","CURVED MIXER":"Curved-path mixer for longer residence time.","ROTARY MIXER":"Rotary or annular mixer layout.",VALVE3D:"Three-dimensional pneumatic membrane valve.",VALVE:"Planar pneumatic valve (control layer).",PUMP3D:"3D peristaltic or displacement pump layout.",PUMP:"Planar peristaltic pump (control + flow).","LONG CELL TRAP":"Elongated trap for capturing or culturing cells.","SQUARE CELL TRAP":"Square chamber for cell trapping or imaging.","REACTION CHAMBER":"Enclosed volume for on-chip reactions or incubation.","DIAMOND REACTION CHAMBER":"Diamond-shaped reaction chamber.",TERRACE:"Stepped terrace structure for droplets or reagents.","LL CHAMBER":"Ladder-like or multi-step chamber layout.",FILTER:"Pillar or weir filter for particles or beads.","DOGBONE INSERT":"Dogbone-shaped mechanical test or insert region.","LOGIC ARRAY":"Array of pneumatic logic (AND/OR-style) units.","DROPLET SORTER":"Sort droplets by size or property using bifurcations.",PORT:"Fluid inlet/outlet port on the flow layer.",VIA:"Vertical interconnect between layers.",YTREE:"Y-junction tree to split one stream into many branches.",TREE:"Binary or multi-branch fluid distribution tree.",MUX:"Multiplexer to route one of many inputs to an output.",TRANSPOSER:"Reconfigurable valve array for routing (transposer).",MUX3D:"Three-dimensional multiplexer structure.","NOZZLE DROPLET GENERATOR":"Nozzle-based droplet generation (e.g. oil/water).","DROPLET CAPACITANCE SENSOR":"Electrode pair for droplet or fill sensing.","DROPLET MERGER":"Merge two droplet streams into one.",PICOINJECTOR:"Inject a small plug into a passing droplet.","DROPLET SPLITTER":"Split droplets at a junction.","DROPLET GENERATOR FLOW FOCUS":"Flow-focusing geometry for droplet formation."};function MR(e){return xR[e]||"Place or edit a ".concat(e," feature on the device.")}var IR={name:"PropertyDrawer",props:{mint:{type:String,required:!0},spec:{type:Array,required:!1,default:function(){return[{min:0,max:110,units:"",value:0}]}},activatedColor:{type:String,required:!1,default:"primary"},activatedTextColor:{type:String,required:!1,default:"white--text"},activeSidebarMint:{type:String,default:""},activeSettingsMint:{type:String,default:""}},data:function(){return{storedSpec:[{min:0,max:110,units:"",value:0}],activeTool:null}},computed:{buttonClasses:function(){return[this.isPlacementRowActive?this.activatedColor:"white",this.isPlacementRowActive?this.activatedTextColor:"blue--text","my-1","component-tool-btn-main"]},isPlacementRowActive:function(){return this.activeSidebarMint===this.mint},isSettingsRowOpen:function(){return this.activeSettingsMint===this.mint},shortenedMINT:function(){return this.mint.substring(0,15)},mintTooltip:function(){return MR(this.mint)}},mounted:function(){$y.get().on($y.NAVBAR_SCROLL_EVENT,this.emitPlacementSettingsRepositionIfOpen)},beforeDestroy:function(){$y.get().off($y.NAVBAR_SCROLL_EVENT,this.emitPlacementSettingsRepositionIfOpen)},methods:{getPlacementPanelAnchor:function(){var e=this.$refs.settingsAnchor;if(!e||"function"!==typeof e.getBoundingClientRect)return{left:240,top:120};var t=e.getBoundingClientRect();return{left:t.right,top:t.top}},emitPlacementSettingsRepositionIfOpen:function(){this.isSettingsRowOpen&&$y.get().emit($y.SIDEBAR_PLACEMENT_SETTINGS_REPOSITION,{anchor:this.getPlacementPanelAnchor()})},showProperties:function(){var e=this;if(this.isSettingsRowOpen)$y.get().emit($y.SIDEBAR_SETTINGS_OPENED,{mint:null});else{this.storedSpec=this.spec,this.storedSpec=this.computedSpecForMINT(this.mint);var t=this.getPlacementPanelAnchor();$y.get().emit($y.SIDEBAR_SETTINGS_OPENED,{mint:this.mint,placementPanelAnchor:t}),this.$nextTick((function(){$y.get().emit($y.SIDEBAR_COMPONENT_ACTIVATED,{mint:null}),Pd.viewManager.deactivateComponentPlacementTool(),e.$nextTick((function(){$y.get().emit($y.SIDEBAR_COMPONENT_ACTIVATED,{mint:e.mint}),e.activeTool=Pd.viewManager.activateComponentPlacementTool(e.mint,e.storedSpec)}))}))}},enterPlacementMode:function(){Pd.viewManager.deactivateComponentPlacementTool(),$y.get().emit($y.SIDEBAR_COMPONENT_ACTIVATED,{mint:this.mint}),this.storedSpec=this.spec,this.storedSpec=this.computedSpecForMINT(this.mint),this.activeTool=Pd.viewManager.activateComponentPlacementTool(this.mint,this.storedSpec)},activateTool:function(){if($y.get().emit($y.SIDEBAR_SETTINGS_OPENED,{mint:null}),this.isPlacementRowActive)return Pd.viewManager.deactivateComponentPlacementTool(),this.activeTool=null,void $y.get().emit($y.SIDEBAR_COMPONENT_ACTIVATED,{mint:null});this.enterPlacementMode()},computedSpecForMINT:function(e){var t=rf.getDefinitionForMINT(e),n=[];for(var r in t.heritable){var o={min:t.minimum[r],max:t.maximum[r],value:t.defaults[r],units:t.units[r],steps:(t.maximum[r]-t.minimum[r])/10,step:(t.maximum[r]-t.minimum[r])/10,name:r};n.push(o)}return FO(n)}}},WR=IR,AR=(n("30c0"),Object(CC["a"])(WR,ER,NR,!1,null,"2c1dde88",null)),jR=AR.exports;SC()(AR,{VBtn:DC["a"],VIcon:MO["a"],VTooltip:FC["a"]});var BR=function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("div",{staticClass:"property-drawer-parent"},[n("div",{staticClass:"property-drawer-row"},[n("v-tooltip",{attrs:{bottom:"","max-width":"280"},scopedSlots:e._u([{key:"activator",fn:function(t){var r=t.on,o=t.attrs;return[n("v-btn",e._g(e._b({ref:"activator",class:e.buttonClasse
1s,attrs:{medium:""},on:{click:e.toggleConnectionTool}},"v-btn",o,!1),r),[e._v(" Connection ")])]}}])},[n("span",[e._v(" Route fluid connections between ports by placing channel segments; use waypoints and right-click to finish each segment. ")])]),n("v-btn",{ref:"settingsActivator",staticClass:"settings-gear-btn",class:{"settings-gear-btn--open":e.isSettingsRowOpen},attrs:{icon:"",medium:"",text:"",ripple:!1},on:{click:function(t){return t.stopPropagation(),e.toggleSettingsDrawer.apply(null,arguments)}}},[n("v-icon",{staticClass:"settings-gear-icon"},[e._v("mdi-cog")])],1)],1),n("div",{ref:"drawer",staticClass:"connection-property-drawer",style:e.drawerPositionStyle},[e.isSettingsRowOpen?n("v-card",{staticClass:"settings-panel-card settings-panel-card--chrome",on:{mousedown:e.startDrawerDrag}},[n("v-btn",{staticClass:"settings-corner-close",attrs:{type:"button",fab:"","x-small":"",dark:"",ripple:!1,"aria-label":"Close"},on:{click:e.closeConnectionSettingsPanel}},[n("v-icon",{attrs:{size:"16",color:"white"}},[e._v("mdi-close")])],1),n("div",{staticClass:"settings-panel-heading"},[n("span",{staticClass:"settings-panel-heading__title"},[e._v("Connection settings")]),n("v-spacer"),n("v-btn",{staticClass:"settings-panel-reset-btn",attrs:{small:"",depressed:"",dark:"",color:"orange darken-2"},on:{click:e.resetConnectionDefaults}},[e._v(" Reset ")])],1),n("v-card-text",{staticClass:"settings-panel-body pt-2"},[n("v-alert",{staticClass:"mb-3 connection-settings-hint",attrs:{dense:"",text:"",type:"info"}},[e._v(" "+e._s(e.current_connection_suggestion)+" ")]),n("v-row",{attrs:{justify:"start",align:"start"}},[n("v-col",{staticClass:"connection-settings-params-col",attrs:{cols:"12",md:"auto"}},[n("div",{staticClass:"connection-settings-property-wrap"},[n("PropertyBlock",{attrs:{density:"sidebar",title:"Connection",spec:e.settingsSpec},on:{update:e.updateParameter}})],1)]),n("v-col",{staticClass:"connection-settings-preview-col",attrs:{cols:"12",md:"6"}},[n("div",{staticClass:"settings-section-label mb-1"},[e._v("Cross-section preview")]),n("v-select",{staticClass:"mb-3",attrs:{items:e.connectionProfiles,dense:"","hide-details":"",label:"Channel type",outlined:""},model:{value:e.selectedProfile,callback:function(t){e.selectedProfile=t},expression:"selectedProfile"}}),n("div",{staticClass:"cross-section-frame"},[n("div",{staticClass:"cross-section-diagram"},[e.isRectCrossSection?n("svg",{staticClass:"cross-section-svg",attrs:{viewBox:"0 0 260 155"}},[n("g",{staticClass:"cross-section-diagram-shift"},[n("g",{attrs:{opacity:e.crossSectionFlowOpacity}},[n("rect",{staticClass:"cross-section-shape",attrs:{x:e.rectGeom.x,y:e.rectGeom.y,width:e.rectGeom.w,height:e.rectGeom.h}}),n("line",{staticClass:"cross-section-dim-line cross-section-dim-line--flow",attrs:{x1:e.rectGeom.wLineX1,y1:e.rectGeom.wy,x2:e.rectGeom.wLineX2,y2:e.rectGeom.wy}}),n("polygon",{staticClass:"cross-section-arrow cross-section-arrow--flow",attrs:{points:e.rectGeom.wArrowLeft}}),n("polygon",{staticClass:"cross-section-arrow cross-section-arrow--flow",attrs:{points:e.rectGeom.wArrowRight}}),n("text",{staticClass:"param-svg-name param-svg-name--center param-svg-name--flow",attrs:{x:e.rectGeom.wTextX,y:e.rectGeom.wTextY}},[e._v(" channelWidth ")])]),n("g",{attrs:{opacity:e.crossSectionControlOpacity}},[n("line",{staticClass:"cross-section-dim-line cross-section-dim-line--control",attrs:{x1:e.rectGeom.hx,y1:e.rectGeom.hLineY1,x2:e.rectGeom.hx,y2:e.rectGeom.hLineY2}}),n("polygon",{staticClass:"cross-section-arrow cross-section-arrow--control",attrs:{points:e.rectGeom.hArrowTop}}),n("polygon",{staticClass:"cross-section-arrow cross-section-arrow--control",attrs:{points:e.rectGeom.hArrowBottom}}),n("text",{staticClass:"param-svg-name param-svg-name--control",attrs:{x:e.rectGeom.hTextX,y:e.rectGeom.hTextY}},[e._v(" height ")])])])]):n("svg",{staticClass:"cross-section-svg",attrs:{viewBox:"0 0 260 155"}},[n("g",{staticClass:"cross-section-diagram-shift"},[n("g",{attrs:{opacity:e.crossSectionFlowOpacity}},[n("circle",{staticClass:"cross-section-shape",attrs:{cx:e.circleGeom.cx,cy:e.circleGeom.cy,r:e.circleGeom.r}}),n("line",{staticClass:"cross-section-dim-line cross-section-dim-line--flow",attrs:{x1:e.circleGeom.lLineX1,y1:e.circleGeom.ly,x2:e.circleGeom.lLineX2,y2:e.circleGeom.ly}}),n("polygon",{staticClass:"cross-section-arrow cross-section-arrow--flow",attrs:{points:e.circleGeom.cArrowLeft}}),n("polygon",{staticClass:"cross-section-arrow cross-section-arrow--flow",attrs:{points:e.circleGeom.cArrowRight}}),n("text",{staticClass:"param-svg-name param-svg-name--center param-svg-name--flow",attrs:{x:e.circleGeom.textX,y:e.circleGeom.textY}}
1,[e._v(" channelRadius ")])])])])])])],1)],1)],1)],1):e._e()],1)])},VR=[];function XR(e,t){var n="undefined"!==typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=YR(e))||t&&e&&"number"===typeof e.length){n&&(e=n);var r=0,o=function(){};return{s:o,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,l=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return a=e.done,e},e:function(e){l=!0,i=e},f:function(){try{a||null==n.return||n.return()}finally{if(l)throw i}}}}function YR(e,t){if(e){if("string"===typeof e)return GR(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?GR(e,t):void 0}}function GR(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var UR=.5;function zR(e,t,n){var r=void 0!==n?n:e.defaults[t];return{name:t,min:e.minimum[t],max:e.maximum[t],value:r,units:e.units[t],steps:(e.maximum[t]-e.minimum[t])/10,step:(e.maximum[t]-e.minimum[t])/10}}var HR={name:"ConnectionPropertyDrawer",components:{PropertyBlock:AO},props:{activeSidebarMint:{type:String,default:""},activeSettingsMint:{type:String,default:""}},icons:{iconfont:"mdi"},data:function(){return{spec:this.computedSpec("Connection"),connectionProfiles:[],selectedProfile:"",activeTool:null,settingsSpec:[],snapshot:{connectionSpacing:1600,channelWidth:800,height:250},layerSyncTick:0,drawerLeft:225,drawerTop:10,isManualDrawerPosition:!1,isDraggingDrawer:!1,drawerDragStartPointer:null,drawerDragStartPosition:null}},computed:{buttonClasses:function(){return[this.isPlacementRowActive?"primary":"white",this.isPlacementRowActive?"white--text":"blue--text","my-1","component-tool-btn-main"]},isPlacementRowActive:function(){return this.activeSidebarMint===Zy},isSettingsRowOpen:function(){return this.activeSettingsMint===Zy},isRectCrossSection:function(){return"ROUNDED CHANNEL"!==this.selectedProfile},crossSectionFlowOpacity:function(){var e,t;this.layerSyncTick;var n=null===(e=Pd.viewManager)||void 0===e||null===(t=e.currentLayer)||void 0===t?void 0:t.type;return void 0===n||null===n||n===o.FLOW?1:UR},crossSectionControlOpacity:function(){var e,t;this.layerSyncTick;var n=null===(e=Pd.viewManager)||void 0===e||null===(t=e.currentLayer)||void 0===t?void 0:t.type;return void 0===n||null===n||n===o.CONTROL?1:UR},rectGeom:function(){var e=88,t=22,n=46,r=58,o=r+t+20,i=n+e+18,a=6,l=6,s=4,c=n,u=n+e,h=r,f=r+t,d=c+a,p=u-a,y=5,m=12;return{x:n,y:r,w:e,h:t,wy:o,hx:i,wLineX1:d,wLineX2:p,wArrowLeft:"".concat(c,",").concat(o," ").concat(c+l,",").concat(o-s," ").concat(c+l,",").concat(o+s),wArrowRight:"".concat(u,",").concat(o," ").concat(u-l,",").concat(o-s," ").concat(u-l,",").concat(o+s),wTextX:(d+p)/2,wTextY:o+y+m,hLineY1:h+a,hLineY2:f-a,hArrowTop:"".concat(i,",").concat(h," ").concat(i-s,",").concat(h+l," ").concat(i+s,",").concat(h+l),hArrowBottom:"".concat(i,",").concat(f," ").concat(i-s,",").concat(f-l," ").concat(i+s,",").concat(f-l),hTextX:i+12,hTextY:r+t/2+4}},circleGeom:function(){var e=118,t=76,n=38,r=6,o=6,i=4,a=e-n,l=e,s=a+r,c=l-r,u=5,h=12;return{cx:e,cy:t,r:n,ly:t,lLineX1:s,lLineX2:c,cArrowLeft:"".concat(a,",").concat(t," ").concat(a+o,",").concat(t-i," ").concat(a+o,",").concat(t+i),cArrowRight:"".concat(l,",").concat(t," ").concat(l-o,",").concat(t-i," ").concat(l+o,",").concat(t+i),textX:e,textY:t+n+u+h}},current_connection_suggestion:function(){var e,t,n="Unable to test the connection tool state",r="Left Click to choose a Start Point",o="Left Click to place waypoint, Right Click to end Connection",i=this.activeTool||(null===(e=Pd.viewManager)||void 0===e||null===(t=e.tools)||void 0===t?void 0:t.Connection);return null===i||void 0===i?n:i.state===Hb.PLACE_FIRST_POINT?r:i.state===Hb.PLACE_WAYPOINT?o:i.state===Hb.TARGET_PLACED_START_AGAIN?r:"Unknown State, suggestion error"},drawerPositionStyle:function(){return{left:this.drawerLeft+"px",to
1p:this.drawerTop+"px"}}},watch:{selectedProfile:function(e,t){t&&t!==e&&"CHANNEL"===t&&"ROUNDED CHANNEL"===e&&(this.snapshot.height=this.snapshot.channelWidth),this.rebuildSettingsSpec(),this.applyProfileToTool()},isSettingsRowOpen:function(e){var t=this;e&&(this.isManualDrawerPosition=!1,this.initSnapshotFromSpec(),this.rebuildSettingsSpec(),this.layerSyncTick+=1,this.$nextTick((function(){t.attachSettingsDrawerToApp()})))}},mounted:function(){$y.get().on($y.CLOSE_ALL_WINDOWS,this.onCloseAllWindows),$y.get().on($y.RIGHT_CLICK,this.endConnection),$y.get().on($y.NAVBAR_SCROLL_EVENT,this.setDrawerPosition),$y.get().on($y.ACTIVE_RENDER_LAYER_CHANGED,this.onActiveRenderLayerChanged),this.connectionProfiles=rf.getConnectionTypes(),this.initSnapshotFromSpec(),this.selectedProfile=this.connectionProfiles[0]||"CHANNEL",this.layerSyncTick+=1,this.applyProfileToTool()},beforeDestroy:function(){$y.get().off($y.CLOSE_ALL_WINDOWS,this.onCloseAllWindows),$y.get().off($y.RIGHT_CLICK,this.endConnection),$y.get().off($y.NAVBAR_SCROLL_EVENT,this.setDrawerPosition),$y.get().off($y.ACTIVE_RENDER_LAYER_CHANGED,this.onActiveRenderLayerChanged),this.stopDrawerDrag()},methods:{startDrawerDrag:function(e){if(e&&0===e.button&&this.isSettingsRowOpen){var t=e.target;t&&"function"===typeof t.closest&&(t.closest(".v-btn, button, input, textarea, select, .v-input, .v-slider, .property-block-scroll-shell--limited")||(this.isDraggingDrawer=!0,this.isManualDrawerPosition=!0,this.drawerDragStartPointer={x:e.clientX,y:e.clientY},this.drawerDragStartPosition={left:this.drawerLeft,top:this.drawerTop},window.addEventListener("mousemove",this.onDrawerDragMove),window.addEventListener("mouseup",this.stopDrawerDrag),e.stopPropagation(),e.preventDefault()))}},onDrawerDragMove:function(e){if(this.isDraggingDrawer&&this.drawerDragStartPointer&&this.drawerDragStartPosition){var t=this.$refs.drawer,n=t&&"function"===typeof t.getBoundingClientRect?t.getBoundingClientRect():null,r=n?n.width:720,o=n?n.height:360,i=12,a=e.clientX-this.drawerDragStartPointer.x,l=e.clientY-this.drawerDragStartPointer.y,s=this.drawerDragStartPosition.left+a,c=this.drawerDragStartPosition.top+l,u=Math.max(i,window.innerWidth-r-i),h=Math.max(i,window.innerHeight-o-i);this.drawerLeft=Math.max(i,Math.min(s,u)),this.drawerTop=Math.max(i,Math.min(c,h)),e.preventDefault()}},stopDrawerDrag:function(){this.isDraggingDrawer&&(this.isDraggingDrawer=!1,this.drawerDragStartPointer=null,this.drawerDragStartPosition=null,window.removeEventListener("mousemove",this.onDrawerDragMove),window.removeEventListener("mouseup",this.stopDrawerDrag))},profileMintToCrossSection:function(e){return"ROUNDED CHANNEL"===e?1:0},applyProfileToTool:function(){var e=Pd.viewManager,t=e&&e.tools?e.tools.Connection:null,n=this.profileMintToCrossSection(this.selectedProfile);t&&(t.crossSection=n,t.currentChannelID&&t.updateParameter("crossSection",n))},onActiveRenderLayerChanged:function(){this.layerSyncTick+=1},onCloseAllWindows:function(){var e=Pd.viewManager;e&&e.mouseAndKeyboardHandler&&e.mouseAndKeyboardHandler.leftMouseTool===e.tools.Connection&&e.resetToDefaultTool(),this.activeTool=null},initSnapshotFromSpec:function(){var e,t=this.computedSpec("Connection"),n={connectionSpacing:1600,channelWidth:800,height:250},r=XR(t);try{for(r.s();!(e=r.n()).done;){var o=e.value;Object.prototype.hasOwnProperty.call(n,o.name)&&(n[o.name]=Number(o.value))}}catch(i){r.e(i)}finally{r.f()}this.snapshot=n},rebuildSettingsSpec:function(){var e=rf.getDefinition("Connection");if(e)if("ROUNDED CHANNEL"===this.selectedProfile){var t=this.snapshot.channelWidth/2;this.settingsSpec=[zR(e,"connectionSpacing",this.snapshot.connectionSpacing),{name:"channelRadius",min:e.minimum.channelWidth/2,max:e.maximum.channelWidth/2,value:t,units:e.units.channelWidth,steps:(e.maximum.channelWidth/2-e.minimum.channelWidth/2)/10,step:(e.maximum.channelWidth/2-e.minimum.channelWidth/2)/10}]}else this.settingsSpec=[zR(e,"connectionSpacing",this.snapshot.connectionSpacing),zR(e,"channelWidth",this.snapshot.channelWidth),zR(e,"height",this.snapshot.height)];else this.settingsSpec=[]},syncSpecItemToSnapshot:function(e,t){var n=Number(t);"connectionSpacing"===e?this.snapshot.connectionSpacing=n:"channelWidth"===e?this.snapshot.channelWidth=n:"height"===e?this.snapshot.height=n:"channelRadius"===e&&(this.snapshot.channelWidth=2*n,this.snapshot.height=2*n)},updateParameter:function(e,t){this.syncSpecItemToSnapshot(t,e);var n=this.activeTool||Pd.viewManager.tools.Connection;"channelRadius"===t?n&&(n.updateParameter("channelWidth",this.snapshot.channelWidth),n.updateParameter("height",this.snapshot.height)):n&&n.updateParameter(t,Number(e)),"channelWidth"!==t&&"height"!==t&&"channelRadius"!==t||this.$forceUpdate()},computedSpec:function(e){var t=rf.getDefinition(e),n=[];for(var r in t.heritable){var o={mint:r,min:t.minimum[r],max:t.maximum[r],value:t.defaults[r],units:t.units[r],steps:(t.maximum[r]-t.minimum[r])/10,name:r};n.push(o)}return FO(n)},toggleConnectionTool:function(){if($y.get().emit($y.SIDEBAR_SETTINGS_OPENED,{mint:null}),this.isPlacementRowActive)return Pd.viewManager.resetToDefaultTool(),this.activeTool=null,void $y.get().emit($y.SIDEBAR_COMPONENT_ACTIVATED,{mint:null});Pd.viewManager.deactivateComponentPlacementTool(),$y.get().emit($y.SIDEBAR_COMPONENT_ACTIVATED,{mint:Zy}),this.startConnection(),this.activeTool=Pd.viewManager.tools.Connection},toggleSettingsDrawer:function(){var e=this;this.isSettingsRowOpen?$y.get().emit($y.SIDEBAR_SETTINGS_OPENED,{mint:null}):($y.get().emit($y.SIDEBAR_SETTINGS_OPENED,{mint:Zy}),this.$nextTick((function(){$y.get().emit($y.SIDEBAR_COMPONENT_ACTIVATED,{mint:null}),Pd.viewManager.deactivateComponentPlacementTool(),e.$nextTick((function(){$y.get().emit($y.SIDEBAR_COMPONENT_ACTIVATED,{mint:Zy}),e.startConnection(),e.activeTool=Pd.viewManager.tools.Connection}))}
1)))},attachSettingsDrawerToApp:function(){var e=document.querySelector("[data-app]");e&&this.$refs.drawer&&(this.setDrawerPosition(),e.appendChild(this.$refs.drawer))},handleScroll:function(){this.setDrawerPosition()},setDrawerPosition:function(){if(this.isSettingsRowOpen&&this.$refs.activator&&this.$refs.drawer&&!this.isManualDrawerPosition){var e=this.$refs.settingsActivator||this.$refs.activator,t=e.$el.getBoundingClientRect(),n=this.$refs.drawer,r=n&&"function"===typeof n.getBoundingClientRect?n.getBoundingClientRect():null,o=r?r.width:720,i=12,a=8,l=t.right+a;l+o+i>window.innerWidth&&(l=Math.max(i,window.innerWidth-o-i)),this.drawerLeft=Math.max(i,l),this.drawerTop=Math.max(i,t.top)}},closeConnectionSettingsPanel:function(){$y.get().emit($y.SIDEBAR_SETTINGS_OPENED,{mint:null})},resetConnectionDefaults:function(){var e=rf.library.Connection&&rf.library.Connection.object;e&&"function"===typeof e.resetToFactoryParameterDefaults&&e.resetToFactoryParameterDefaults(),this.initSnapshotFromSpec(),this.rebuildSettingsSpec();var t=this.activeTool||Pd.viewManager&&Pd.viewManager.tools&&Pd.viewManager.tools.Connection;t&&"function"===typeof t.updateParameter&&(t.updateParameter("connectionSpacing",this.snapshot.connectionSpacing),t.updateParameter("channelWidth",this.snapshot.channelWidth),t.updateParameter("height",this.snapshot.height),this.selectedProfile=this.connectionProfiles[0]||"CHANNEL",t.crossSection=0,t.updateParameter("crossSection",0),this.$forceUpdate())},startConnection:function(){Pd.viewManager.activateTool("Connection","Connection")},endConnection:function(){}}},KR=HR,qR=(n("736f"),n("0798")),JR=Object(CC["a"])(KR,BR,VR,!1,null,"0355cfb6",null),ZR=JR.exports;SC()(JR,{VAlert:qR["a"],VBtn:DC["a"],VCard:RC["a"],VCardText:TC["b"],VCol:QC["a"],VIcon:MO["a"],VRow:nO["a"],VSelect:pS["a"],VSpacer:rO["a"],VTooltip:FC["a"]});var $R={name:"ComponentToolBar",components:{ConnectionPropertyDrawer:ZR,PropertyDrawer:jR},data:function(){return{activeSidebarMint:"",activeSettingsMint:"",toolCategoryOrder:["Distribute","Control","Mix","Storage","Process","Droplet"],toolTree:{Mix:["MIXER","MIXER3D","TOROIDAL MIXER","GRADIENT GENERATOR","CURVED MIXER","ROTARY MIXER"],Control:["VALVE3D","VALVE","PUMP3D","PUMP"],Storage:["LONG CELL TRAP","SQUARE CELL TRAP","REACTION CHAMBER","DIAMOND REACTION CHAMBER","TERRACE"],Process:["LL CHAMBER","FILTER","DOGBONE INSERT","LOGIC ARRAY","DROPLET SORTER"],Distribute:["PORT","VIA","YTREE","TREE","MUX","TRANSPOSER","MUX3D"],Droplet:["NOZZLE DROPLET GENERATOR","DROPLET CAPACITANCE SENSOR","DROPLET MERGER","DROPLET MERGER JUNCTION","PICOINJECTOR","DROPLET SPLITTER","DROPLET GENERATOR FLOW FOCUS"]},alignmentMarksSpec:this.computedSpec("AlignmentMarks")}},mounted:function(){var e=this;this._onSidebarPlacement=function(t){var n=t&&t.mint;e.activeSidebarMint=null==n?"":String(n)},this._onSidebarSettings=function(t){var n=t&&t.mint;e.activeSettingsMint=null==n?"":String(n)},this._onCloseAllToolbar=function(){e.activeSidebarMint="",e.activeSettingsMint=""},$y.get().on($y.SIDEBAR_COMPONENT_ACTIVATED,this._onSidebarPlacement),$
1y.get().on($y.SIDEBAR_SETTINGS_OPENED,this._onSidebarSettings),$y.get().on($y.CLOSE_ALL_WINDOWS,this._onCloseAllToolbar)},beforeDestroy:function(){$y.get().off($y.SIDEBAR_COMPONENT_ACTIVATED,this._onSidebarPlacement),$y.get().off($y.SIDEBAR_SETTINGS_OPENED,this._onSidebarSettings),$y.get().off($y.CLOSE_ALL_WINDOWS,this._onCloseAllToolbar)},methods:{activateTool:function(e){console.log(e),Pd.viewManager.activateTool(e)},getEntry:function(e){return{mint:e,spec:this.computedSpecForMINT(e)}},computedSpecForMINT:function(e){return this.computedSpec(e)},computedSpec:function(e){var t=rf.getDefinition(e),n=[];for(var r in t.heritable){var o={mint:r,min:t.minimum[r],max:t.maximum[r],value:t.defaults[r],units:t.units[r],steps:(t.maximum[r]-t.minimum[r])/10,step:(t.maximum[r]-t.minimum[r])/10,name:r};n.push(o)}return FO(n)}}},QR=$R,eT=(n("3758"),Object(CC["a"])(QR,FR,kR,!1,null,"87243dcc",null)),tT=eT.exports;SC()(eT,{VCard:RC["a"],VCardText:TC["b"],VCardTitle:TC["c"],VDivider:tO["a"]});var nT=function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("div",[n("v-divider",{staticClass:"mb-1"}),n("div",{staticClass:"export-section-label px-1 mb-1"},[e._v("View")]),n("v-tooltip",{attrs:{bottom:"","max-width":"300"},scopedSlots:e._u([{key:"activator",fn:function(t){var r=t.on,o=t.attrs;return[n("div",e._g(e._b({staticClass:"ports-view-toggle-wrap mb-2 mx-1"},"div",o,!1),r),[n("v-btn-toggle",{staticClass:"ports-view-toggle",attrs:{tile:"",borderless:""}},[n("v-btn",{class:e.portsOnlyView?"grey--text text--darken-2":"white--text",attrs:{small:"",depressed:"",color:e.portsOnlyView?"grey lighten-2":"blue"},on:{click:function(t){return e.setPortsOnlyView(!1)}}},[e._v(" ALL ")]),n("v-btn",{class:e.portsOnlyView?"white--text":"grey--text text--darken-2",attrs:{small:"",depressed:"",color:e.portsOnlyView?"indigo":"grey lighten-2"},on:{click:function(t){return e.setPortsOnlyView(!0)}}},[e._v(" PORTS ")])],1)],1)]}}])},[n("span",[e._v(e._s(e.portsOnlyTooltip))])]),n("v-divider",{staticClass:"mb-1"}),n("div",{staticClass:"export-section-label px-1 mb-1"},[e._v("Export")]),e._l(e.exportItems,(function(t){return n("div",{key:t.id},[n("v-tooltip",{attrs:{bottom:"","max-width":"280"},scopedSlots:e._u([{key:"activator",fn:function(r){var o=r.on,i=r.attrs;return[n("v-btn",e._g(e._b({staticClass:"white blue--text mb-2 feature-button button-row",on:{click:function(n){return e.runExport(t.id)}}},"v-btn",i,!1),o),[n("v-icon",{attrs:{left:"",small:""}},[e._v(e._s(t.icon))]),e._v(" "+e._s(t.label)+" ")],1)]}}],null,!0)},[n("span",[e._v(e._s(t.tooltip))])])],1)}))],2)},rT=[];function oT(e){return lT(e)||aT(e)||hT(e)||iT()}function iT(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function aT(e){if("undefined"!==typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}function lT(e){if(Array.isArray(e))return fT(e)}function sT(e,t){var n="undefined"!==typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=hT(e))||t&&e&&"number"===typeof e.length){n&&(e=n);var r=0,o=function(){};return{s:o,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,l=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return a=e.done,e},e:function(e){l=!0,i=e},f:function(){try{a||null==n.return||n.return()}finally{if(l)throw i}}}}function cT(e,t){return pT(e)||dT(e,t)||hT(e,t)||uT()}function uT(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function hT(e,t){if(e){if("string"===typeof e)return fT(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?fT(e,t):void 0}}function fT(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function dT(e,t){var n=null==e?null:"undefined"!==typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,i=[],a=!0,l=!1;try{for(n=n.call(e);!(a=(r=n.next()).done);a=!0)if(i.push(r.value),t&&i.length===t)break}catch(s){l=!0,o=s}finally{try{a||null==n["return"]||n["return"]()}finally{if(l)throw o}}return i}}function pT(e){if(Array.isArray(e))return e}var yT=.001;function mT(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:3,n=e.toFixed(t);
1return n==="-0."+"0".repeat(t)?"0."+"0".repeat(t):n}function vT(e){return"number"===typeof e&&Number.isFinite(e)}function gT(e,t,n){return{x:e*yT,y:(n-t)*yT}}function wT(e,t){try{var n=Number(e.getValue(t));return Number.isFinite(n)?n:null}catch(r){return null}}function bT(e){var t=e*yT;return t>=1.2?.25:t>=1?.15:t>=.6?.1:.075}function _T(e){for(var t=bT(e),n=e*yT,r=[t],o=0,i=[.075,.1,.125,.15];o<i.length;o++){var a=i[o];a<.6*n&&!r.includes(a)&&r.push(a)}return r.sort((function(e,t){return e-t}))}function PT(e){var t=2*e*yT;return t>=.9?{label:"1-32",diameterMm:.792}:t>=.4?{label:"250",diameterMm:.25}:{label:"125",diameterMm:.125}}function CT(e){if(Math.abs(e-.792)<1e-6)return"1-32";if(Math.abs(e-3.175)<1e-6)return"1-8";var t=Math.round(1e3*e);return String(t)}function OT(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:16e3;return["(".concat(e,")"),"(T1 D=".concat(mT(t,3)," CR=0. - ZMIN=").concat(mT(n,2)," - FLAT END MILL)"),"G0 G90 G94 G17","G21","M5","G53 G0 Z0.","","(".concat(e,")"),"T1","M3 S".concat(r),"G90 G94 G17","G55","M8"]}function ST(){return["M9","M5","G53 G0 Z0.","M30"]}function DT(e,t,n){var r,o,i,a,l=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};if(!(t.length<2)){var s=null!==(r=l.safeZ)&&void 0!==r?r:1.5,c=null!==(o=l.approachZ)&&void 0!==o?o:.5,u=null!==(i=l.plungeF)&&void 0!==i?i:16,h=null!==(a=l.cutF)&&void 0!==a?a:210;e.push("G0 X".concat(mT(t[0].x,3)," Y").concat(mT(t[0].y,3))),e.push("Z".concat(mT(s,1))),e.push("G0 Z".concat(mT(c,1))),e.push("G1 Z".concat(mT(n,2)," F").concat(u,"."));for(var f=1;f<t.length;f++)e.push("X".concat(mT(t[f].x,3)," Y").concat(mT(t[f].y,3)," F").concat(h,"."));l.measure&&e.push("X".concat(mT(t[0].x,3)," Y").concat(mT(t[0].y,3)," F").concat(h,".")),e.push("G0 Z".concat(mT(c,1)))}}function RT(e,t,n){for(var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:36,o=[],i=0;i<=r;i++){var a=i/r*Math.PI*2;o.push({x:e+Math.cos(a)*n,y:t+Math.sin(a)*n})}return o}function TT(e){var t=e.channelWidth,n=e.bendLength,r=e.bendSpacing,o=Math.max(1,Math.round(e.numberOfBends)),i=cT(e.position,2),a=i[0],l=i[1],s=Le(e),c=n+2*t,u=r+2*t,h=2*r+2*t,f=r+t,d=[],p=l+t/2;d.push([[a,p],[a+s.firstWidth,p]]);for(var y=0;y<o;y++){var m=l+h*y;d.push([[a+t/2,m+t],[a+t/2,m+u]]);var v=l+f+h*y+t/2;d.push([[a+t/2,v],[a+c-t/2,v]]);var g=a+t+n+t/2;d.push([[g,v],[g,l+f+h*y+u-t/2]]);var w=l+h*(y+1)+t/2;y===o-1?d.push([[g,w],[a+s.lastStart,w]]):d.push([[g,w],[a+t/2,w]])}return d}function LT(e){var t,n=[],r=sT(e.layers);try{for(r.s();!(t=r.n()).done;){var i=t.value;if(i.type===o.FLOW||i.type===o.CONTROL)for(var a in i.features){var l=i.features[a];if("Port"===l.getType())try{var s,c=l.getValue("position"),u=wT(l,"portRadius"),h=null!==(s=wT(l,"height"))&&void 0!==s?s:1100;Array.isArray(c)&&null!=u&&u>0&&n.push({xUm:c[0],yUm:c[1],radiusUm:u,heightUm:h})}catch(f){}}}}catch(d){r.e(d)}finally{r.f()}return n}function FT(e){var t=LT(e),n=e.getYSpan(),r=[];if(t.length){var o=Math.max.apply(Math,oT(t.map((function(e){return e.radiusUm})))),i=PT(o);r.push({filename:"".concat(i.label,"_ports.gcode"),content:NT(n,t,i,!1)}),r.push({filename:"".concat(i.label,"_MEASURE_ports.gcode"),content:NT(n,t,i,!0)})}return r.length||r.push({filename:"".concat(e.name||"device","_ports_empty.gcode"),content:OT("EMPTY_PORTS",.125,-.01).join("\r\n")+"\r\n"+ST().join("\r\n")+"\r\n"}),r}
1function kT(e){var t,n=[],r=[],i=sT(e.layers);try{for(i.s();!(t=i.n()).done;){var a=t.value;if(a.type===o.FLOW)for(var l in a.features){var s=a.features[l],c=s.getType();if("Port"===c){var u,h=s.getValue("position"),f=wT(s,"portRadius"),d=null!==(u=wT(s,"height"))&&void 0!==u?u:1100;Array.isArray(h)&&null!=f&&f>0&&r.push({xUm:h[0],yUm:h[1],radiusUm:f,heightUm:d})}else if("Connection"===c){var p,y,m=s.getValue("segments"),v=null!==(p=wT(s,"height"))&&void 0!==p?p:250,g=null!==(y=wT(s,"channelWidth"))&&void 0!==y?y:Ce;Array.isArray(m)&&m.length&&n.push({segments:m,heightUm:v,channelWidthUm:g,label:"channel"})}else if("BetterMixer"===c||"Mixer"===c||"CurvedMixer"===c){var w,b,_,P,C,O,S,D=s.getValue("position"),R=null!==(w=wT(s,"channelWidth"))&&void 0!==w?w:Ce,T=null!==(b=wT(s,"bendLength"))&&void 0!==b?b:2460,L=null!==(_=wT(s,"bendSpacing"))&&void 0!==_?_:1230,F=null!==(P=wT(s,"numberOfBends"))&&void 0!==P?P:1,k=null!==(C=wT(s,"height"))&&void 0!==C?C:250,E=null!==(O=wT(s,"edgeBend1"))&&void 0!==O?O:void 0,N=null!==(S=wT(s,"edgeBend2"))&&void 0!==S?S:void 0;Array.isArray(D)&&n.push({segments:TT({position:D,channelWidth:R,bendLength:T,bendSpacing:L,numberOfBends:F,edgeBend1:E,edgeBend2:N}),heightUm:k,channelWidthUm:R,label:"mixer"})}}}}catch(x){i.e(x)}finally{i.f()}return{channels:n,ports:r}}function ET(e,t,n,r,o){var i,a,l=Math.max.apply(Math,oT(n.map((function(e){return e.heightUm*yT}))).concat([.1])),s=o?-.01:-Math.min(l,r),c=(null===(i=n[0])||void 0===i?void 0:i.label)||"channel",u=CT(r),h=o?"".concat(u,"_MEASURE_").concat(c).toUpperCase().replace(/[^A-Z0-9_]/g,"_"):"".concat(u,"UM_").concat(c).toUpperCase().replace(/[^A-Z0-9_]/g,"_"),f=OT(h,r,s),d=sT(n);try{for(d.s();!(a=d.n()).done;){var p,y=a.value,m=sT(y.segments);try{for(m.s();!(p=m.n()).done;){var v=p.value;if(v&&!(v.length<2)){var g=v[0],w=v[1];if(Array.isArray(g)&&Array.isArray(w)&&vT(g[0])&&vT(g[1])&&vT(w[0])&&vT(w[1])&&!(Math.hypot(g[0]-w[0],g[1]-w[1])<1)){var b=gT(g[0],g[1],t),_=gT(w[0],w[1],t);DT(f,[b,_],s,{measure:o,plungeF:o?4:16,cutF:o?128:210,safeZ:o?1.2:1.5,approachZ:o?.2:.5})}}}}catch(P){m.e(P)}finally{m.f()}}}catch(P){d.e(P)}finally{d.f()}return f.push("G0 Z".concat(o?"1.2":"1.5")),f.push.apply(f,oT(ST())),f.join("\r\n")+"\r\n"}function NT(e,t,n,r){var o,i=Math.max.apply(Math,oT(t.map((function(e){return e.heightUm*yT}))).concat([.5])),a=r?-.01:-Math.min(i,2.9),l=r?"".concat(n.label,"_MEASURE_PORTS").toUpperCase().replace(/[^A-Z0-9_]/g,"_"):"".concat(n.label,"_PORTS").toUpperCase().replace(/[^A-Z0-9_]/g,"_"),s=OT(l,n.diameterMm,a,16500),c=sT(t);try{for(c.s();!(o=c.n()).done;){var u=o.value,h=gT(u.xUm,u.yUm,e),f=Math.max(u.radiusUm*yT-n.diameterMm/2,n.diameterMm/2),d=RT(h.x,h.y,f);DT(s,d,a,{measure:r,plungeF:r?16:356,cutF:r?300:210,safeZ:r?1.5:17,approachZ:r?.5:5.921})}}catch(p){c.e(p)}finally{c.f()}return s.push("G0 Z".concat(r?"1.5":"17")),s.push.apply(s,oT(ST()
1)),s.join("\r\n")+"\r\n"}function xT(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(t.portsOnly)return FT(e);var n=kT(e),r=n.channels,o=n.ports,i=e.getYSpan(),a=[];if(r.length){var l,s=Math.min.apply(Math,oT(r.map((function(e){return e.channelWidthUm})))),c=r.every((function(e){return"mixer"===e.label}))?"mixer":r.some((function(e){return"mixer"===e.label}))?"channel_mixer":"channel",u=sT(_T(s));try{for(u.s();!(l=u.n()).done;){var h=l.value,f=CT(h);a.push({filename:"".concat(f,"um_").concat(c,".gcode"),content:ET(e.name,i,r,h,!1)}),a.push({filename:"".concat(f,"_measure_").concat(c,".gcode"),content:ET(e.name,i,r,h,!0)})}}catch(y){u.e(y)}finally{u.f()}}if(o.length){var d=Math.max.apply(Math,oT(o.map((function(e){return e.radiusUm})))),p=PT(d);a.push({filename:"".concat(p.label,"_ports.gcode"),content:NT(i,o,p,!1)}),a.push({filename:"".concat(p.label,"_MEASURE_ports.gcode"),content:NT(i,o,p,!0)})}return a.length||a.push({filename:"".concat(e.name||"device","_empty.gcode"),content:OT("EMPTY",.125,-.01).join("\r\n")+"\r\n"+ST().join("\r\n")+"\r\n"}),a}function MT(e){var t=xT(e);if(1===t.length)return t[0].content;var n=t.find((function(e){return/um_/.test(e.filename)&&!/measure/i.test(e.filename)}));return(n||t[0]).content}function IT(e){return IT="function"===typeof Symbol&&"symbol"===typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"===typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},IT(e)}function WT(e,t){return BT(e)||jT(e,t)||XT(e,t)||AT()}function AT(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function jT(e,t){var n=null==e?null:"undefined"!==typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,i=[],a=!0,l=!1;try{for(n=n.call(e);!(a=(r=n.next()).done);a=!0)if(i.push(r.value),t&&i.length===t)break}catch(s){l=!0,o=s}finally{try{a||null==n["return"]||n["return"]()}finally{if(l)throw o}}return i}}function BT(e){if(Array.isArray(e))return e}function VT(e,t){var n="undefined"!==typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=XT(e))||t&&e&&"number"===typeof e.length){n&&(e=n);var r=0,o=function(){};return{s:o,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,l=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return a=e.done,e},e:function(e){l=!0,i=e},f:function(){try{a||null==n.return||n.return()}finally{if(l)throw i}}}}function XT(e,t){if(e){if("string"===typeof e)return YT(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?YT(e,t):void 0}}function YT(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var GT=.001;function UT(e){return e.replace(/(\.[^.]+)$/,"_ports$1")}function zT(e,t){return"".concat(e,"\n").concat(t,"\n")}function HT(){var e="0\nSECTION\n2\nHEADER\n";return e+=zT(9,"$ACADVER"),e+=zT(1,"AC1015"),e+=zT(9,"$INSUNITS"),e+=zT(70,4),e+="0\nENDSEC\n",e}function KT(e){return HT()+"0\nSECTION\n2\nENTITIES\n"+e+"0\nENDSEC\n0\nEOF\n"}function qT(e,t){var n,r,o,i,a,l,s,c=null!==(n=null===(r=e.vertices)||void 0===r?void 0:r[0])&&void 0!==n?n:e.startPoint,u=null!==(o=null===(i=e.vertices)||void 0===i?void 0:i[e.vertices.length-1])&&void 0!==o?o:e.endPoint;if(!c||!u)return"";var h="0\nLINE\n";return h+=zT(8,t),h+=zT(10,c.x),h+=zT(20,c.y),h+=zT(30,null!==(a=c.z)&&void 0!==a?a:0),h+=zT(11,u.x),h+=zT(21,u.y),h+=zT(31,null!==(l=null!==(s=u.z)&&void 0!==s?s:c.z)&&void 0!==l?l:0),h}function JT(e,t){var n;if(!e.center||null==e.radius)return"";var r="0\nCIRCLE\n";return r+=zT(8,t),r+=zT(10,e.center.x),r+=zT(20,e.center.y),r+=zT(30,null!==(n=e.center.z)&&void 0!==n?n:0),r+=zT(40,e.radius),r}function ZT(e,t){var n=e.layer||t;if("LINE"===e.type||"LWPOLYLINE"===e.type||"POLYLINE"===e.type){if("LINE"===e.type)return qT(e,n);if(e.vertices&&e.vertices.length>=2){for(var r="",o=0;o<e.vertices.length-1;o++)r+=qT({type:"LINE",vertices:[e.vertices[o],e.vertices[o+1]]},n);return r}return qT(e,n)}return"CIRCLE"===e.type?JT(e,n):""}function $T(e){return e.getData()}function QT(e,t,n){return{x:e*GT,y:(n-t)*GT}}function eL(e){return qT({type:"LINE",vertices:[{x:0,y:0,z:0},{x:e.getXSpan()*GT,y:0,z:0}]},"3DuF_empty")}function tL(e){var t=0,n=function(e){var n=Number(e);Number.isFinite(n)&&n>t&&(t=n)};try{var r,o=VT(e.components||[]);try{for(o.s();!(r=o.n()).done;){var i=r.value;try{"function"===typeof i.getValue&&n(i.getValue("height"))}catch(m){}}}catch(v){o.e(v)}finally{o.f()}}catch(m){}var a,l=VT(e.layers||[]);try{for(l.s();!(a=l.n()).done;){var s=a.value,c=s.features||{};for(var u in c){var h,f=c[u];if(f){var d=String((null===(h=f.getType)||void 0===h?void 0:h.call(f))||f.type||"");if("EDGE"!==d&&"DxfSketch"!==d){var p=aL(f,"height");null!=p&&n(p);try{var y=f.manufacturingInfo;y&&null!=y.depth&&n(y.depth)}catch(m){}}}}}}catch(v){l.e(v)}finally{l.f()}return t}function nL(e){return tL(e)*GT+1}function rL(e,t,n,r){for(var o=[[0,0],[e,0],[e,t],[0,t],[0,0]],i="",a=0;a<o.length-1;a++){var l=QT(o[a][0],o[a][1],t),s=QT(o[a+1][0],o[a+1][1],t);i+=qT({type:"LINE",vertices:[{x:l.x,y:l.y,z:n},{x:s.x,y:s.y,z:n}]},r)}return i}function oL(e,t){var n=e.getXSpan(),r=e.getYSpan();if(!Number.isFinite(n)||!Number.isFinite(r)||n<=0||r<=0)return"";
1var o=nL(e),i=t+"_border",a=rL(n,r,0,i);a+=rL(n,r,o,i);for(var l=[[0,0],[n,0],[n,r],[0,r]],s=0,c=l;s<c.length;s++){var u=WT(c[s],2),h=u[0],f=u[1],d=QT(h,f,r);a+=qT({type:"LINE",vertices:[{x:d.x,y:d.y,z:0},{x:d.x,y:d.y,z:o}]},i)}return a}function iL(e){for(var t=["portRadius","valveRadius","radius1","radius"],n=0,r=t;n<r.length;n++){var o=r[n];try{var i=Number(e.getValue(o));if(Number.isFinite(i)&&i>0)return i}catch(a){}}return null}function aL(e,t){try{var n=Number(e.getValue(t));return Number.isFinite(n)?n:null}catch(r){return null}}function lL(e){if(!Array.isArray(e)||e.length<2)return null;if(e.length>=3&&"Point"===e[0]){var t=Number(e[1]),n=Number(e[2]);return Number.isFinite(t)&&Number.isFinite(n)?[t,n]:null}var r=Number(e[0]),o=Number(e[1]);return Number.isFinite(r)&&Number.isFinite(o)?[r,o]:null}function sL(e,t,n,r,o,i){if(!(n>0))return"";var a=t[0]-e[0],l=t[1]-e[1],s=Math.hypot(a,l);if(s<1e-9)return"";var c=a/s,u=l/s,h=-u,f=c,d=n/2,p=[e[0]-h*d,e[1]-f*d],y=[t[0]-h*d,t[1]-f*d],m=[e[0]+h*d,e[1]+f*d],v=[t[0]+h*d,t[1]+f*d],g=QT(p[0],p[1],r),w=QT(y[0],y[1],r),b=QT(m[0],m[1],r),_=QT(v[0],v[1],r),P="";return P+=qT({type:"LINE",vertices:[{x:g.x,y:g.y,z:i},{x:w.x,y:w.y,z:i}]},o),P+=qT({type:"LINE",vertices:[{x:b.x,y:b.y,z:i},{x:_.x,y:_.y,z:i}]},o),P}function cL(e){return"Port"===e||"Connection"===e||"Channel"===e||"RoundedChannel"===e||"RoundedChannelConnection"===e||"BetterMixer"===e||"Mixer"===e||"CurvedMixer"===e||"Valve3D"===e||"Valve3D_control"===e||"CircleValve"===e||"Valve"===e}function uL(e){for(var t in e.features)if(cL(e.features[t].getType()))return!0;return!1}function hL(e,t,n,r){var o=e.getType(),i="";if("EDGE"===o)return i;if("DxfSketch"===o){if(!r)return i;var a,l=VT(e.dxfObjects);try{for(l.s();!(a=l.n()).done;){var s=a.value;i+=ZT($T(s),t)}}catch(B){l.e(B)}finally{l.f()}return i}if("Port"===o||"Valve3D"===o||"Valve3D_control"===o||"CircleValve"===o||"Valve"===o){var c=null;try{c=e.getValue("position")}catch(V){return i}var u=iL(e);if(!Array.isArray(c)||null==u)return i;var h=QT(c[0],c[1],n),f="Port"===o?"_ports":"_valves";return i+=JT({type:"CIRCLE",center:{x:h.x,y:h.y,z:0},radius:u*GT},t+f),i}if("Connection"===o||"Channel"===o||"RoundedChannel"===o||"RoundedChannelConnection"===o){var d=aL(e,"channelWidth");if(null==d||!(d>0))return i;var p=0,y=t+"_channels",m=[];if("Connection"===o||"RoundedChannelConnection"===o){try{var v=e.getValue("segments");Array.isArray(v)&&(m=v)}catch(V){}if(!m.length)try{var g=lL(e.getValue("start")),w=lL(e.getValue("end"));g&&w&&(m=[[g,w]])}catch(V){return i}}else{var b=null,_=null;try{b=lL(e.getValue("start")),_=lL(e.getValue("end"))}catch(V){return i}b&&_&&(m=[[b,_]])}var P,C=VT(m);try{for(C.s();!(P=C.n()).done;){var O=P.value;if(O&&!(O.length<2)){var S=lL(O[0]),D=lL(O[1]);S&&D&&(i+=sL(S,D,d,n,y,p))}}}catch(B){C.e(B)}finally{C.f()}return i}if("BetterMixer"===o||"Mixer"===o||"CurvedMixer"===o)try{var R,T,L=e.getValue("position"),F=Number(e.getValue("channelWidth")),k=Number(e.getValue("bendLength")),E=Number(e.getValue("bendSpacing")),N=Number(e.getValue("numberOfBends"));try{var x=Number(e.getValue("edgeBend1")),M=Number(e.getValue("edgeBend2"));Number.isFinite(x)&&(R=x),Number.isFinite(M)&&(T=M)}catch(X){}if(!Array.isArray(L)||!Number.isFinite(F)||!(F>0))return i;var I,W=TT({position:L,channelWidth:F,bendLength:Number.isFinite(k)?k:2460,bendSpacing:Number.isFinite(E)?E:1230,numberOfBends:Number.isFinite(N)?N:1,edgeBend1:R,edgeBend2:T}),A=VT(W);try{for(A.s();!(I=A.n()).done;){var j=I.value;i+=sL(j[0],j[1],F,n,t+"_mixer",0)}}catch(B){A.e(B)}finally{A.f()}}catch(V){}return i}function fL(e,t){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=e.getYSpan(),o=t.name||t.type||"LAYER",i=!n&&!uL(t),a="",l=t.features;for(var s in l)try{var c=l[s];if(n&&"Port"!==c.getType())continue;a+=hL(c,o,r,i)}catch(u){console.warn("[DXF export] Skipping feature",s,u)}return a+=oL(e,o),a||(a=eL(e)),a}function dL(e,t,n){return e.type===o.CONTROL?"_ctrl".concat(n):"_flow".concat(t)}function pL(e){if(!e||!Array.isArray(e.layers))return!1;var t,n=VT(e.layers);try{for(n.s();!(t=n.n()).done;){var r=t.value;if(r.type===o.CONTROL&&Object.keys(r.features||{}).length>0)return!0}}catch(y){n.e(y)}finally{n.f()}try{var i=e.valves;if(Array.isArray(i)&&i.length>0)return!0}catch(m){}var a,l=VT(e.components||[]);try{for(l.s();!(a=l.n()).done;){var s=a.value,c=s.layers;if(Array.isArray(c)&&c.length){var u,h=VT(c);try{var f=function(){var t=u.value,n="string"===typeof t?t:null===t||void 0===t?void 0:t.id,r=e.layers.find((function(e){return e.id===n}));if(r&&r.type===o.CONTROL)return{v:!0}};for(h.s();!(u=h.n()).done;){var d=f();if("object"===IT(d))return d.v}}catch(y){h.e(y)}finally{h.f()}var p=String(s.mint||s.entity||"").toUpperCase();if(p.includes("VALVE"))return!0}}}catch(y){l.e(y)}finally{l.f()}return!1}function yL(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!e)throw new Error("No device loaded");
1if(!Array.isArray(e.layers))throw new Error("Device has no layers to export");var n=Boolean(t.portsOnly),r=e.layers.filter((function(e){if(e.type!==o.FLOW&&e.type!==o.CONTROL)return!1;if(n){for(var t in e.features||{})if("Port"===e.features[t].getType())return!0;return!1}return Object.keys(e.features||{}).length>0}));if(0===r.length&&(r=e.layers.filter((function(e){return e.type===o.FLOW||e.type===o.CONTROL})).slice(0,1)),0===r.length){var i="".concat(e.name,".dxf");return[{filename:n?UT(i):i,content:KT(eL(e))}]}if(1===r.length){var a="".concat(e.name,".dxf");return[{filename:n?UT(a):a,content:KT(fL(e,r[0],n))}]}var l,s=[],c=0,u=0,h=VT(r);try{for(h.s();!(l=h.n()).done;){var f=l.value;f.type===o.FLOW?c+=1:u+=1;var d=dL(f,c,u),p="".concat(e.name).concat(d,".dxf");s.push({filename:n?UT(p):p,content:KT(fL(e,f,n))})}}catch(y){h.e(y)}finally{h.f()}return s}function mL(e,t){var n="undefined"!==typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=vL(e))||t&&e&&"number"===typeof e.length){n&&(e=n);var r=0,o=function(){};return{s:o,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,l=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return a=e.done,e},e:function(e){l=!0,i=e},f:function(){try{a||null==n.return||n.return()}finally{if(l)throw i}}}}function vL(e,t){if(e){if("string"===typeof e)return gL(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?gL(e,t):void 0}}function gL(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function wL(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:3,n=e.toFixed(t);return"-0.000"===n?"0.000":n}function bL(e,t,n){for(var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:36,o=[],i=0;i<=r;i++){var a=i/r*Math.PI*2;o.push({x:e+Math.cos(a)*n,y:t+Math.sin(a)*n})}return o}function _L(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:.125,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=hR(e);if(!r){if(n.portsOnly){var o=xT(e,{portsOnly:!0});return o[0]&&o[0].content||""}return MT(e)}var i=Boolean(n.portsOnly),a=(e.name||"3DUF_EXPORT").toUpperCase().replace(/[^A-Z0-9_]/g,"_")+(i?"_PORTS":""),l=-Math.min(t,Math.max(r.channelHeight||.2,.1)),s=xD(r),c=["(".concat(a,")"),"(T1 D=".concat(wL(t,3)," CR=0. - ZMIN=").concat(wL(l,2)," - FLAT END MILL)"),"G0 G90 G94 G17","G21","M5","G53 G0 Z0.","","(".concat(a,")"),"T1","M3 S16000","G90 G94 G17","G55","M8"],u=[];if(!i){var h,f=s.lines.filter((function(e){return!DD(e,s)})),d=mL(f);try{for(d.s();!(h=d.n()).done;){var p=h.value;u.push([{x:p.a.x,y:p.a.y},{x:p.b.x,y:p.b.y},{x:p.a.x,y:p.a.y}])}}catch(_){d.e(_)}finally{d.f()}}var y,m=mL(s.circles);try{for(m.s();!(y=m.n()).done;){var v=y.value;u.push(bL(v.center.x,v.center.y,v.radius))}}catch(_){m.e(_)}finally{m.f()}for(var g=0;g<u.length;g++){var w=u[g];if(!(w.length<2)){c.push("G0 X".concat(wL(w[0].x,3)," Y").concat(wL(w[0].y,3))),c.push("Z1.5"),c.push("G0 Z0.5"),c.push("G1 Z".concat(wL(l,2)," F300."));for(var b=1;b<w.length;b++)c.push("X".concat(wL(w[b].x,3)," Y").concat(wL(w[b].y,3)," F210."));c.push("G0 Z0.5")}}return c.push("M9"),c.push("M5"),c.push("G53 G0 Z0."),c.push("M30"),c.join("\r\n")+"\r\n"}function PL(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=hR(e);if(!n)return"";var r,o=Boolean(t.portsOnly),i=n.bounds,a=i.minX,l=i.minY,s=i.maxX,c=i.maxY,u=s-a,h=c-l,f=[],d=mL(n.sketches);try{for(d.s();!(r=d.n()).done;){var p=r.value;if(!o){var y,m=mL(p.lines);try{for(m.s();!(y=m.n()).done;){var v=y.value;f.push('<path data-z="'.concat(v.a.z,'" data-depth="').concat(n.channelHeight,'" d="M ').concat(v.a.x," ").concat(v.a.y," L ").concat(v.b.x," ").concat(v.b.y,'" fill="none" stroke="#1565c0" stroke-width="0.15"/>'))}}catch(_){m.e(_)}finally{m.f()}}var g,w=mL(p.circles);try{for(w.s();!(g=w.n()).done;){var b=g.value;f.push('<circle data-z="'.concat(b.center.z,'" data-depth="').concat(n.channelHeight,'" cx="').concat(b.center.x,'" cy="').concat(b.center.y,'" r="').concat(b.radius,'" fill="none" stroke="#c62828" stroke-width="0.15"/>'))}}catch(_){w.e(_)}finally{w.f()}}}catch(_){d.e(_)}finally{d.f()}return'<?xml version="1.0" encoding="UTF-8"?>\n'+'<svg xmlns="http://www.w3.org/2000/svg" width="'.concat(u,'mm" height="').concat(h,'mm" viewBox="').concat(a," ").concat(l," ").concat(u," ").concat(h,'">\n')+'<g transform="scale(1,-1) translate(0 '.concat(-(l+c),')">\n')+f.join("\n")+"\n</g>\n</svg>\n"}function CL(e,t){var n="undefined"!==typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];
1if(!n){if(Array.isArray(e)||(n=OL(e))||t&&e&&"number"===typeof e.length){n&&(e=n);var r=0,o=function(){};return{s:o,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,l=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return a=e.done,e},e:function(e){l=!0,i=e},f:function(){try{a||null==n.return||n.return()}finally{if(l)throw i}}}}function OL(e,t){if(e){if("string"===typeof e)return SL(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?SL(e,t):void 0}}function SL(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var DL="Multilayer biochips do not provide GCode export. Please export each layer as DXF (or SVG) instead.",RL={name:"ManufacturingPanel",data:function(){return{portsOnlyView:!1}},computed:{portsOnlyTooltip:function(){return"Fabricated chips need a cover so fluid can flow inside closed channels â an open groove cannot be used experimentally. PORTS keeps only the current flow (blue) and control (red) ports and hides every other component and connection; ALL restores the full design."},exportItems:function(){return[{id:"json",label:"JSON · 3DuF",icon:"mdi-code-json",tooltip:"3DuF default design format (.json). Save, reopen, and share designs in 3DuF â the primary format for this tool. Downloads as a zip with the full design and a ports-only JSON for the cover layer."},{id:"dxf",label:"DXF",icon:"mdi-file-cad",tooltip:"CAD sketch (.dxf). Open in AutoCAD, Fusion 360, and other CAD / CAM tools. Downloads as a zip with the full design and a ports-only DXF for the cover layer."},{id:"svg",label:"SVG",icon:"mdi-vector-line",tooltip:"Vector graphics (.svg). Use for documentation, illustrations, laser cutting prep, and web graphics. Downloads as a zip with the full design and a ports-only SVG."},{id:"gcode",label:"GCode",icon:"mdi-axis-arrow",tooltip:"CNC / router (.gcode). Use for milling or routing flow-layer geometry. Downloads as a zip with the full programs and a ports-only GCode. Not available for multilayer biochips."}]}},mounted:function(){var e=this;this.syncPortsOnlyView(),this._onPortsOnlyViewChanged=function(t){e.portsOnlyView=Boolean(t)},$y.get().on($y.PORTS_ONLY_VIEW_CHANGED,this._onPortsOnlyViewChanged)},beforeDestroy:function(){this._onPortsOnlyViewChanged&&$y.get().off($y.PORTS_ONLY_VIEW_CHANGED,this._onPortsOnlyViewChanged)},methods:{syncPortsOnlyView:function(){var e=Pd.viewManager;this.portsOnlyView=Boolean(e&&e.portsOnlyView)},setPortsOnlyView:function(e){var t=Pd.viewManager;t&&(t.setPortsOnlyView(e),this.portsOnlyView=Boolean(e))},runExport:function(e){"json"===e?this.downloadJSON():"dxf"===e?this.downloadDXF():"svg"===e?this.downloadSVG():"gcode"===e&&this.downloadGCode()},requireDevice:function(){var e=Pd.currentDevice;if(!e)throw new Error("No device loaded. Create or import a design first.");return e},requireViewManager:function(){var e=Pd.viewManager;if(!e)throw new Error("View manager is not ready yet. Try again in a moment.");return e},downloadBlob:function(e,t,n){var r=e instanceof Blob?e:new Blob([e],{type:n});Object(Wv["saveAs"])(r,t)},downloadZip:function(e,t){var n,r=new GP.a,o=CL(e);try{for(o.s();!(n=o.n()).done;){var i=n.value;r.file(i.filename,i.content)}}catch(a){o.e(a)}finally{o.f()}return r.generateAsync({type:"blob"}).then((function(e){Object(Wv["saveAs"])(e,t)}))},reportExportError:function(e,t){console.error("[Export ".concat(e,"]"),t);var n=t&&t.message?t.message:String(t);alert("Unable to export ".concat(e,": ").concat(n))},downloadJSON:function(){try{this.requireViewManager().downloadJSON()}catch(e){this.reportExportError("JSON",e)}},downloadDXF:function(){var e=this;try{var t=this.requireDevice(),n=yL(t),r=yL(t,{portsOnly:!0});if(!n||0===n.length)throw new Error("DXF generator returned no files.");var o=n.concat(r||[]);if(1===o.length)return void this.downloadBlob(o[0].content,o[0].filename,"application/dxf;charset=utf-8");this.downloadZip(o,"".concat(t.name||"device","_dxf.zip")).catch((function(t){e.reportExportError("DXF",t)}))}catch(i){this.reportExportError("DXF",i)}},captureSvgContent:function(e,t,n){var r=e.exportSVGString?e.exportSVGString(n):null;if(r)return r;var o=t.getXSpan(),i=t.getYSpan(),a=Im.generateSVGTextPrepend(o,i),l=Im.generateSVGTextAppend();if(!n)for(var s=e.layersToSVGStrings(),c=0;c<s.length;c++)if(s[c]&&"<svg"===s[c].slice(0,4))return a+s[c]+l;var u=PL(t,{portsOnly:n});return u||null},downloadSVG:function(){var e=this;try{var t=this.requireDevice(),n=this.requireViewManager(),r=t.name||"device",o=this.captureSvgContent(n,t,!1),i=this.captureSvgContent(n,t,!0);if(!o&&!i)throw new Error("Unable to generate SVG. Does the design have at least one visible feature?");var a=[];
1if(o&&a.push({filename:"".concat(r,".svg"),content:o}),i&&a.push({filename:"".concat(r,"_ports.svg"),content:i}),1===a.length)return void this.downloadBlob(a[0].content,a[0].filename,"image/svg+xml;charset=utf-8");this.downloadZip(a,"".concat(r,"_svg.zip")).catch((function(t){e.reportExportError("SVG",t)}))}catch(l){this.reportExportError("SVG",l)}},downloadGCode:function(){var e=this;try{var t=this.requireDevice();if(pL(t))return void alert(DL);var n=t.name||"device",r=null!==hR(t);if(r&&!this.deviceHasStructuredFlowFeatures(t)){var o=_L(t),i=_L(t,.125,{portsOnly:!0});return void this.downloadZip([{filename:"".concat(n,".gcode"),content:o},{filename:"".concat(n,"_ports.gcode"),content:i}],"".concat(n,"_gcode.zip")).catch((function(t){e.reportExportError("GCode",t)}))}var a=xT(t),l=xT(t,{portsOnly:!0});if(!a||0===a.length)throw new Error("GCode generator returned no files.");var s,c=new GP.a,u=c.folder(n)||c,h=CL(a);try{for(h.s();!(s=h.n()).done;){var f=s.value;u.file(f.filename,f.content)}}catch(v){h.e(v)}finally{h.f()}var d,p=u.folder("ports")||u,y=CL(l||[]);try{for(y.s();!(d=y.n()).done;){var m=d.value;p.file(m.filename,m.content)}}catch(v){y.e(v)}finally{y.f()}c.generateAsync({type:"blob"}).then((function(e){Object(Wv["saveAs"])(e,"".concat(n,"_gcode.zip"))})).catch((function(t){e.reportExportError("GCode",t)}))}catch(v){this.reportExportError("GCode",v)}},deviceHasStructuredFlowFeatures:function(e){var t,n=new Set(["Port","Connection","BetterMixer","Mixer","CurvedMixer"]),r=CL(e.layers||[]);try{for(r.s();!(t=r.n()).done;){var o=t.value;if("FLOW"===o.type||"flow"===o.type)for(var i in o.features||{}){var a=o.features[i],l=a.getType?a.getType():a.type;if(n.has(l))return!0}}}catch(s){r.e(s)}finally{r.f()}return!1}}},TL=RL,LL=(n("653d"),Object(CC["a"])(TL,nT,rT,!1,null,"554ef903",null)),FL=LL.exports;SC()(LL,{VBtn:DC["a"],VBtnToggle:RR["a"],VDivider:tO["a"],VIcon:MO["a"],VTooltip:FC["a"]});var kL={components:{HelpDialog:LS,IntroHelpDialog:MS,EditDeviceDialog:HS,ImportDXFDialog:mR,InsertTextDialog:PR,LayerToolbar:LR,ComponentToolbar:tT,ManufacturingPanel:FL,Visualiser:_S},data:function(){return{}},mounted:function(){var e=document.querySelector(".v-navigation-drawer__content");e.addEventListener("scroll",this.handleScroll),window.addEventListener("scroll",(function(){window.scrollTo(0,0)}))},destroyed:function(){},methods:{handleScroll:function(){$y.get().emit($y.NAVBAR_SCROLL_EVENT)}}},EL=kL,NL=(n("bb3d"),n("adda")),xL=n("f774"),ML=Object(CC["a"])(EL,PS,CS,!1,null,"21b5ca60",null),IL=ML.exports;SC()(ML,{VCol:QC["a"],VDivider:tO["a"],VImg:NL["a"],VNavigationDrawer:xL["a"],VRow:nO["a"]});var WL=function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("v-slide-y-transition",[e.visible?n("div",{staticClass:"connection-esc-hint-banner",attrs:{role:"status"}},[e._v(" You are drawing a connection. Press "),n("kbd",{staticClass:"connection-esc-hint-kbd"},[e._v("Esc")]),e._v(" on your keyboard to stop drawing and exit the connection tool. ")]):e._e()])},AL=[],jL={name:"ConnectionEscHintBanner",data:function(){return{visible:!1}},mounted:function(){var e=this;this._onEscHint=function(t){e.visible=Boolean(t)},$y.get().on($y.CONNECTION_ESC_HINT,this._onEscHint)},beforeDestroy:function(){$y.get().off($y.CONNECTION_ESC_HINT,this._onEscHint)}},BL=jL,VL=(n("4d81"),n("0789")),XL=Object(CC["a"])(BL,WL,AL,!1,null,"f0c647f2",null),YL=XL.exports;SC()(XL,{VSlideYTransition:VL["f"]});var GL={name:"App",components:{LayoutSidebar:IL,ConnectionEscHintBanner:YL}},UL=GL,zL=(n("034f"),n("7496")),HL=Object(CC["a"])(UL,s,c,!1,null,null,null),KL=HL.exports;SC()(HL,{VApp:zL["a"]});var qL=n("ce5b"),JL=n.n(qL);l["default"].use(JL.a);var ZL=new JL.a({});n("d5e8");l["default"].config.productionTip=!1,l["default"].use(JL.a);t["default"]=new JL.a({icons:{iconfont:"mdiSvg"}});new l["default"]({vuetify:ZL,render:function(e){return e(KL)}}).$mount("#app")},cf08:function(e,t,n){"use strict";n("7e94")},e425:function(e,t,n){},ecab:function(e,t,n){},ef8c:function(e,t,n){"use strict";n("7ac7")},f249:function(e,t,n){},f6a8:function(e,t,n){},fd39:function(e,t,n){"use strict";n("4073")},feac:function(e,t,n){"use strict";n("3d73")}}); 2//# sourceMappingURL=app.ee013f0d.js.map
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.