diff --git a/actions/index.html b/actions/index.html index 67c6458d..048db04d 100644 --- a/actions/index.html +++ b/actions/index.html @@ -324,7 +324,7 @@

Install LMQL 0.7 Beta

Site template adapted from Nerfies by Keunhong Park et al. and uses Bulma.
- Last updated on Tue, Aug 29, 4:48 PM (UTC)
+ Last updated on Wed, Sep 6, 9:04 AM (UTC)
diff --git a/blog/index.html b/blog/index.html index 05c0335f..1d3004a5 100644 --- a/blog/index.html +++ b/blog/index.html @@ -694,7 +694,7 @@

Preview Site template adapted from Nerfies by Keunhong Park et al. and uses Bulma.
- Last updated on Tue, Aug 29, 4:48 PM (UTC)
+ Last updated on Wed, Sep 6, 9:04 AM (UTC)
diff --git a/blog/release-0.0.5.html b/blog/release-0.0.5.html index 34b74da0..c87766d2 100644 --- a/blog/release-0.0.5.html +++ b/blog/release-0.0.5.html @@ -222,7 +222,7 @@

Preview Site template adapted from Nerfies by Keunhong Park et al. and uses Bulma.
- Last updated on Tue, Aug 29, 4:48 PM (UTC)
+ Last updated on Wed, Sep 6, 9:04 AM (UTC)
diff --git a/blog/release-0.0.6.1.html b/blog/release-0.0.6.1.html index edf69545..88adbd4e 100644 --- a/blog/release-0.0.6.1.html +++ b/blog/release-0.0.6.1.html @@ -191,7 +191,7 @@

Site template adapted from Nerfies by Keunhong Park et al. and uses Bulma.
- Last updated on Tue, Aug 29, 4:48 PM (UTC)
+ Last updated on Wed, Sep 6, 9:04 AM (UTC)
diff --git a/blog/release-0.0.6.3.html b/blog/release-0.0.6.3.html index f184f652..1a81c217 100644 --- a/blog/release-0.0.6.3.html +++ b/blog/release-0.0.6.3.html @@ -214,7 +214,7 @@
Site template adapted from Nerfies by Keunhong Park et al. and uses Bulma.
- Last updated on Tue, Aug 29, 4:48 PM (UTC)
+ Last updated on Wed, Sep 6, 9:04 AM (UTC)
diff --git a/blog/release-0.0.6.4.html b/blog/release-0.0.6.4.html index 2a478cd4..3fab6ac8 100644 --- a/blog/release-0.0.6.4.html +++ b/blog/release-0.0.6.4.html @@ -218,7 +218,7 @@
Site template adapted from Nerfies by Keunhong Park et al. and uses Bulma.
- Last updated on Tue, Aug 29, 4:48 PM (UTC)
+ Last updated on Wed, Sep 6, 9:04 AM (UTC)
diff --git a/blog/release-0.0.6.5.html b/blog/release-0.0.6.5.html index f8fc5ad0..ece05dc2 100644 --- a/blog/release-0.0.6.5.html +++ b/blog/release-0.0.6.5.html @@ -290,7 +290,7 @@

Other Changes Site template adapted from Nerfies by Keunhong Park et al. and uses Bulma.
- Last updated on Tue, Aug 29, 4:48 PM (UTC)
+ Last updated on Wed, Sep 6, 9:04 AM (UTC)
diff --git a/blog/release-0.0.6.6.html b/blog/release-0.0.6.6.html index 06107dda..2e553217 100644 --- a/blog/release-0.0.6.6.html +++ b/blog/release-0.0.6.6.html @@ -205,7 +205,7 @@

Site template adapted from Nerfies by Keunhong Park et al. and uses Bulma.
- Last updated on Tue, Aug 29, 4:48 PM (UTC)
+ Last updated on Wed, Sep 6, 9:04 AM (UTC)
diff --git a/blog/release-0.0.6.html b/blog/release-0.0.6.html index 83f8aae8..9eb78d8d 100644 --- a/blog/release-0.0.6.html +++ b/blog/release-0.0.6.html @@ -272,7 +272,7 @@

Conclusion Site template adapted from Nerfies by Keunhong Park et al. and uses Bulma.
- Last updated on Tue, Aug 29, 4:48 PM (UTC)
+ Last updated on Wed, Sep 6, 9:04 AM (UTC)
diff --git a/index.html b/index.html index 5d7c90bd..9f26e498 100644 --- a/index.html +++ b/index.html @@ -1017,7 +1017,7 @@

BibTeX

Site template adapted from Nerfies by Keunhong Park et al. and uses Bulma.
- Last updated on Tue, Aug 29, 4:48 PM (UTC)
+ Last updated on Wed, Sep 6, 9:04 AM (UTC)
diff --git a/playground/asset-manifest.json b/playground/asset-manifest.json index 50238a8a..dda0938a 100644 --- a/playground/asset-manifest.json +++ b/playground/asset-manifest.json @@ -1,17 +1,17 @@ { "files": { "main.css": "./static/css/main.dea811a7.css", - "main.js": "./static/js/main.222f4f7f.js", + "main.js": "./static/js/main.e68d925b.js", "static/js/357.c90ecd93.chunk.js": "./static/js/357.c90ecd93.chunk.js", "static/js/787.d1d4a2c2.chunk.js": "./static/js/787.d1d4a2c2.chunk.js", "static/media/explore.svg": "./static/media/explore.d648d98579c69615ae83ee55d57efe3b.svg", "index.html": "./index.html", "main.dea811a7.css.map": "./static/css/main.dea811a7.css.map", - "main.222f4f7f.js.map": "./static/js/main.222f4f7f.js.map", + "main.e68d925b.js.map": "./static/js/main.e68d925b.js.map", "787.d1d4a2c2.chunk.js.map": "./static/js/787.d1d4a2c2.chunk.js.map" }, "entrypoints": [ "static/css/main.dea811a7.css", - "static/js/main.222f4f7f.js" + "static/js/main.e68d925b.js" ] } \ No newline at end of file diff --git a/playground/index.html b/playground/index.html index 312d7a8d..19d838b4 100644 --- a/playground/index.html +++ b/playground/index.html @@ -1 +1 @@ -LMQL Playground
\ No newline at end of file +LMQL Playground
\ No newline at end of file diff --git a/playground/static/js/main.222f4f7f.js b/playground/static/js/main.e68d925b.js similarity index 99% rename from playground/static/js/main.222f4f7f.js rename to playground/static/js/main.e68d925b.js index fe63d4a7..f1b680a1 100644 --- a/playground/static/js/main.222f4f7f.js +++ b/playground/static/js/main.e68d925b.js @@ -1,3 +1,3 @@ -/*! For license information please see main.222f4f7f.js.LICENSE.txt */ -(function(){var __webpack_modules__={5591:function(e,t,n){"use strict";n.d(t,{uk:function(){return Ue},DN:function(){return Fe},gk:function(){return Ve}});var r={};n.r(r),n.d(r,{Decoder:function(){return Oe},Encoder:function(){return Te},PacketType:function(){return Ce},protocol:function(){return Pe}});var i=n(885),o=n(5671),a=n(3144),s=n(8068),l=function(){function e(t){var n=this;(0,o.Z)(this,e),this.worker=t,this.processWorker=new Worker(t),this.setup(),this.hasSecret=!1,this.secret=null,window.localStorage.getItem("openai-secret")&&(this.hasSecret=""!=this.secret,this.secret=window.localStorage.getItem("openai-secret")),"undefined"!==typeof window.SharedArrayBuffer?(this.interruptBuffer=new Uint8Array(new window.SharedArrayBuffer(1)),this.processWorker.postMessage({func:"set_interrupt_buffer",args:this.interruptBuffer})):this.interruptBuffer=null,this.consoleListeners=[],this.renderers=[],this.statusListeners=[],this.connectionListeners=[],this.runListeners=[],this.remotePid=null,this.killCounter=0,this.hardKillTimer=null,this.ready=!1,this.status={connected:!1,label:""},this.addStatusListener((function(e){"idle"==e.status&&(n.killCounter=0,n.status=Object.assign({},e),n.ready||(n.ready=!0,n.connectionListeners.forEach((function(e){e(!0)}))))}))}return(0,a.Z)(e,[{key:"setup",value:function(){var e=this;this.processWorker.onmessage=function(t){"app-result"==t.data.type?e.onAppResult(t.data.data):"app-status"==t.data.type?e.statusListeners.forEach((function(e){e(t.data.data)})):console.log("Received unhandled message type from worker",t.data)}}},{key:"on",value:function(e,t){"console"===e?this.addConsoleListener(t):"status"===e?this.addStatusListener(t):"connection"===e?this.addConnectionListener(t):"render"===e?this.addRenderer(t):"run"===e?this.addRunListener(t):console.error("Unknown event",e)}},{key:"remove",value:function(e,t){"console"===e?this.consoleListeners=this.consoleListeners.filter((function(e){return e!==t})):"status"===e?this.statusListeners=this.statusListeners.filter((function(e){return e!==t})):"connection"===e?this.connectionListeners=this.connectionListeners.filter((function(e){return e!==t})):"render"===e?this.renderers=this.renderers.filter((function(e){return e!==t})):"run"===e?this.runListeners=this.runListeners.filter((function(e){return e!==t})):console.error("Unknown event",e)}},{key:"addRunListener",value:function(e){this.runListeners.push(e)}},{key:"addConnectionListener",value:function(e){this.connectionListeners.push(e)}},{key:"addStatusListener",value:function(e){this.statusListeners.push(e)}},{key:"addConsoleListener",value:function(e){this.consoleListeners.push(e)}},{key:"addRenderer",value:function(e){this.renderers.push(e)}},{key:"logToConsole",value:function(e){this.consoleListeners.forEach((function(t){t(e)}))}},{key:"listener_stats",value:function(){console.log("console listeners",this.consoleListeners.length),console.log("render listeners",this.renderers.length),console.log("status listeners",this.statusListeners.length),console.log("connection listeners",this.connectionListeners.length),console.log("renderers",this.renderers.length),console.log("run listeners",this.runListeners.length)}},{key:"onAppResult",value:function(e){if(e.startsWith("DEBUGGER OUTPUT"))try{e=JSON.parse(e.substr("DEBUGGER OUTPUT".length)),this.renderers.forEach((function(t){t.add_result(e)}))}catch(d){this.logToConsole("Failed to parse debugger output "+e.substr("DEBUGGER OUTPUT".length)+"\n")}else if(e.startsWith("BUILD_INFO")){var t=e.substr("BUILD_INFO ".length).split(", "),n=(0,i.Z)(t,2),r=n[0],o=n[1],a=r.split(" "),l=a[1].substr(0,7);"dirty"==a[a.length-1]&&(l+=" (dirty)"),s.n.setInfo({commit:l,date:o})}else if(e.startsWith("APP EXIT")){var u=e.substr("APP EXIT ".length);this.onAppExit(u)}else if(e.startsWith("APP ERROR")){var c=e.substr("APP ERROR ".length);this.onAppError(c)}else"string"==typeof e?this.logToConsole(e+"\n"):this.logToConsole(JSON.stringify(e)+"\n")}},{key:"onAppError",value:function(e){this.logToConsole(e),this.statusListeners.forEach((function(t){t({status:"error",error:e})}))}},{key:"onAppExit",value:function(e){this.logToConsole(e),this.statusListeners.forEach((function(t){t({status:"exit",error:e})})),this.remotePid=null}},{key:"run",value:function(e){if(this.hasSecret){this.processWorker.postMessage({func:"set_openai_secret",args:this.secret}),this.renderers.forEach((function(e){e.clear_results()})),this.interruptBuffer&&(this.interruptBuffer[0]=0),this.killCounter=0;var t=[e.name,e.app_input,e.app_arguments];this.processWorker.postMessage({func:"live",args:t})}else this.statusListeners.forEach((function(e){e({status:"secret-missing",error:"No OpenAI secret set."})}))}},{key:"sendInput",value:function(e){this.processWorker.postMessage({func:"send_input",args:e})}},{key:"setSecret",value:function(e){e.startsWith("transient-")?e=e.substring("transient-".length):localStorage.setItem("openai-secret",e),this.secret=e,this.hasSecret=""!=this.secret,console.log("Setting OpenAI secret in browser process",e,"secret"),this.processWorker.postMessage({func:"set_openai_secret",args:this.secret})}},{key:"kill",value:function(){var e=this;if(0==this.killCounter){this.statusListeners.forEach((function(e){e({status:"stopping"})})),this.processWorker.postMessage({func:"kill",args:[]});var t=1+parseInt(1e6*Math.random());this.killCounter=t,console.log("Killing in-browser process"),this.hardKillTimer&&(clearTimeout(this.hardKillTimer),this.hardKillTimer=null),this.hardKillTimer=setTimeout((function(){e.killCounter==t&&(e.hardKillTimer=null,e.processWorker.terminate(),e.processWorker=new Worker(e.worker),e.setup())}),2e3)}}}]),e}();l.registry=window.BrowserProcessConnectionRegistry={},l.get=function(e){return l.registry[e]||(l.registry[e]=new l("lmql.web.min.js")),l.registry[e]};var u=n(7326),c=n(136),d=n(7277),f=n(1120);function h(){return h="undefined"!==typeof Reflect&&Reflect.get?Reflect.get.bind():function(e,t,n){var r=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=(0,f.Z)(e)););return e}(e,t);if(r){var i=Object.getOwnPropertyDescriptor(r,t);return i.get?i.get.call(arguments.length<3?e:n):i.value}},h.apply(this,arguments)}var p=n(9611);var g=n(8814);function v(e,t,n){return v=(0,g.Z)()?Reflect.construct.bind():function(e,t,n){var r=[null];r.push.apply(r,t);var i=new(Function.bind.apply(e,r));return n&&(0,p.Z)(i,n.prototype),i},v.apply(null,arguments)}function m(e){var t="function"===typeof Map?new Map:void 0;return m=function(e){if(null===e||(n=e,-1===Function.toString.call(n).indexOf("[native code]")))return e;var n;if("function"!==typeof e)throw new TypeError("Super expression must either be null or a function");if("undefined"!==typeof t){if(t.has(e))return t.get(e);t.set(e,r)}function r(){return v(e,arguments,(0,f.Z)(this).constructor)}return r.prototype=Object.create(e.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),(0,p.Z)(r,e)},m(e)}var y=Object.create(null);y.open="0",y.close="1",y.ping="2",y.pong="3",y.message="4",y.upgrade="5",y.noop="6";var b=Object.create(null);Object.keys(y).forEach((function(e){b[y[e]]=e}));for(var x={type:"error",data:"parser error"},_="function"===typeof Blob||"undefined"!==typeof Blob&&"[object BlobConstructor]"===Object.prototype.toString.call(Blob),w="function"===typeof ArrayBuffer,k=function(e,t){var n=new FileReader;return n.onload=function(){var e=n.result.split(",")[1];t("b"+(e||""))},n.readAsDataURL(e)},E=function(e,t,n){var r,i=e.type,o=e.data;return _&&o instanceof Blob?t?n(o):k(o,n):w&&(o instanceof ArrayBuffer||(r=o,"function"===typeof ArrayBuffer.isView?ArrayBuffer.isView(r):r&&r.buffer instanceof ArrayBuffer))?t?n(o):k(new Blob([o]),n):n(y[i]+(o||""))},S="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",C="undefined"===typeof Uint8Array?[]:new Uint8Array(256),P=0;P>4,c[l++]=(15&r)<<4|i>>2,c[l++]=(3&i)<<6|63&o;return u}(e);return M(n,t)}return{base64:!0,data:e}},M=function(e,t){return"blob"===t&&e instanceof ArrayBuffer?new Blob([e]):e},D=function(e,t){if("string"!==typeof e)return{type:"message",data:M(e,t)};var n=e.charAt(0);return"b"===n?{type:"message",data:O(e.substring(1),t)}:b[n]?e.length>1?{type:b[n],data:e.substring(1)}:{type:b[n]}:x},N=String.fromCharCode(30);function A(e){if(e)return function(e){for(var t in A.prototype)e[t]=A.prototype[t];return e}(e)}A.prototype.on=A.prototype.addEventListener=function(e,t){return this._callbacks=this._callbacks||{},(this._callbacks["$"+e]=this._callbacks["$"+e]||[]).push(t),this},A.prototype.once=function(e,t){function n(){this.off(e,n),t.apply(this,arguments)}return n.fn=t,this.on(e,n),this},A.prototype.off=A.prototype.removeListener=A.prototype.removeAllListeners=A.prototype.removeEventListener=function(e,t){if(this._callbacks=this._callbacks||{},0==arguments.length)return this._callbacks={},this;var n,r=this._callbacks["$"+e];if(!r)return this;if(1==arguments.length)return delete this._callbacks["$"+e],this;for(var i=0;i1?t-1:0),r=1;r0);return t}function X(){var e=Y(+new Date);return e!==F?(H=0,F=e):e+"."+Y(H++)}for(;K0&&void 0!==arguments[0]?arguments[0]:{};return Object.assign(e,{xd:this.xd,xs:this.xs},this.opts),new re(this.uri(),e)}},{key:"doWrite",value:function(e,t){var n=this,r=this.request({method:"POST",data:e});r.on("success",t),r.on("error",(function(e,t){n.onError("xhr post error",e,t)}))}},{key:"doPoll",value:function(){var e=this,t=this.request();t.on("data",this.onData.bind(this)),t.on("error",(function(t,n){e.onError("xhr poll error",t,n)})),this.pollXhr=t}}]),n}(V),re=function(e){(0,c.Z)(n,e);var t=(0,d.Z)(n);function n(e,r){var i;return(0,o.Z)(this,n),i=t.call(this),B((0,u.Z)(i),r),i.opts=r,i.method=r.method||"GET",i.uri=e,i.async=!1!==r.async,i.data=void 0!==r.data?r.data:null,i.create(),i}return(0,a.Z)(n,[{key:"create",value:function(){var e=this,t=j(this.opts,"agent","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","autoUnref");t.xdomain=!!this.opts.xd,t.xscheme=!!this.opts.xs;var r=this.xhr=new J(t);try{r.open(this.method,this.uri,this.async);try{if(this.opts.extraHeaders)for(var i in r.setDisableHeaderCheck&&r.setDisableHeaderCheck(!0),this.opts.extraHeaders)this.opts.extraHeaders.hasOwnProperty(i)&&r.setRequestHeader(i,this.opts.extraHeaders[i])}catch(o){}if("POST"===this.method)try{r.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch(o){}try{r.setRequestHeader("Accept","*/*")}catch(o){}"withCredentials"in r&&(r.withCredentials=this.opts.withCredentials),this.opts.requestTimeout&&(r.timeout=this.opts.requestTimeout),r.onreadystatechange=function(){4===r.readyState&&(200===r.status||1223===r.status?e.onLoad():e.setTimeoutFn((function(){e.onError("number"===typeof r.status?r.status:0)}),0))},r.send(this.data)}catch(o){return void this.setTimeoutFn((function(){e.onError(o)}),0)}"undefined"!==typeof document&&(this.index=n.requestsCount++,n.requests[this.index]=this)}},{key:"onError",value:function(e){this.emitReserved("error",e,this.xhr),this.cleanup(!0)}},{key:"cleanup",value:function(e){if("undefined"!==typeof this.xhr&&null!==this.xhr){if(this.xhr.onreadystatechange=ee,e)try{this.xhr.abort()}catch(t){}"undefined"!==typeof document&&delete n.requests[this.index],this.xhr=null}}},{key:"onLoad",value:function(){var e=this.xhr.responseText;null!==e&&(this.emitReserved("data",e),this.emitReserved("success"),this.cleanup())}},{key:"abort",value:function(){this.cleanup()}}]),n}(A);if(re.requestsCount=0,re.requests={},"undefined"!==typeof document)if("function"===typeof attachEvent)attachEvent("onunload",ie);else if("function"===typeof addEventListener){addEventListener("onpagehide"in L?"pagehide":"unload",ie,!1)}function ie(){for(var e in re.requests)re.requests.hasOwnProperty(e)&&re.requests[e].abort()}var oe="function"===typeof Promise&&"function"===typeof Promise.resolve?function(e){return Promise.resolve().then(e)}:function(e,t){return t(e,0)},ae=L.WebSocket||L.MozWebSocket,se="undefined"!==typeof navigator&&"string"===typeof navigator.product&&"reactnative"===navigator.product.toLowerCase(),le=function(e){(0,c.Z)(n,e);var t=(0,d.Z)(n);function n(e){var r;return(0,o.Z)(this,n),(r=t.call(this,e)).supportsBinary=!e.forceBase64,r}return(0,a.Z)(n,[{key:"name",get:function(){return"websocket"}},{key:"doOpen",value:function(){if(this.check()){var e=this.uri(),t=this.opts.protocols,n=se?{}:j(this.opts,"agent","perMessageDeflate","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","localAddress","protocolVersion","origin","maxPayload","family","checkServerIdentity");this.opts.extraHeaders&&(n.headers=this.opts.extraHeaders);try{this.ws=se?new ae(e,t,n):t?new ae(e,t):new ae(e)}catch(We){return this.emitReserved("error",We)}this.ws.binaryType=this.socket.binaryType||"arraybuffer",this.addEventListeners()}}},{key:"addEventListeners",value:function(){var e=this;this.ws.onopen=function(){e.opts.autoUnref&&e.ws._socket.unref(),e.onOpen()},this.ws.onclose=function(t){return e.onClose({description:"websocket connection closed",context:t})},this.ws.onmessage=function(t){return e.onData(t.data)},this.ws.onerror=function(t){return e.onError("websocket error",t)}}},{key:"write",value:function(e){var t=this;this.writable=!1;for(var n=function(){var n=e[r],i=r===e.length-1;E(n,t.supportsBinary,(function(e){try{t.ws.send(e)}catch(n){}i&&oe((function(){t.writable=!0,t.emitReserved("drain")}),t.setTimeoutFn)}))},r=0;r1&&void 0!==arguments[1]?arguments[1]:{};return(0,o.Z)(this,n),(r=t.call(this)).writeBuffer=[],e&&"object"===typeof e&&(i=e,e=null),e?(e=fe(e),i.hostname=e.host,i.secure="https"===e.protocol||"wss"===e.protocol,i.port=e.port,e.query&&(i.query=e.query)):i.host&&(i.hostname=fe(i.host).host),B((0,u.Z)(r),i),r.secure=null!=i.secure?i.secure:"undefined"!==typeof location&&"https:"===location.protocol,i.hostname&&!i.port&&(i.port=r.secure?"443":"80"),r.hostname=i.hostname||("undefined"!==typeof location?location.hostname:"localhost"),r.port=i.port||("undefined"!==typeof location&&location.port?location.port:r.secure?"443":"80"),r.transports=i.transports||["polling","websocket"],r.writeBuffer=[],r.prevBufferLen=0,r.opts=Object.assign({path:"/engine.io",agent:!1,withCredentials:!1,upgrade:!0,timestampParam:"t",rememberUpgrade:!1,addTrailingSlash:!0,rejectUnauthorized:!0,perMessageDeflate:{threshold:1024},transportOptions:{},closeOnBeforeunload:!0},i),r.opts.path=r.opts.path.replace(/\/$/,"")+(r.opts.addTrailingSlash?"/":""),"string"===typeof r.opts.query&&(r.opts.query=function(e){for(var t={},n=e.split("&"),r=0,i=n.length;r1))return this.writeBuffer;for(var e,t=1,n=0;n=57344?n+=3:(r++,n+=4);return n}(e):Math.ceil((e.byteLength||e.size)*z)),n>0&&t>this.maxPayload)return this.writeBuffer.slice(0,n);t+=2}return this.writeBuffer}},{key:"write",value:function(e,t,n){return this.sendPacket("message",e,t,n),this}},{key:"send",value:function(e,t,n){return this.sendPacket("message",e,t,n),this}},{key:"sendPacket",value:function(e,t,n,r){if("function"===typeof t&&(r=t,t=void 0),"function"===typeof n&&(r=n,n=null),"closing"!==this.readyState&&"closed"!==this.readyState){(n=n||{}).compress=!1!==n.compress;var i={type:e,data:t,options:n};this.emitReserved("packetCreate",i),this.writeBuffer.push(i),r&&this.once("flush",r),this.flush()}}},{key:"close",value:function(){var e=this,t=function(){e.onClose("forced close"),e.transport.close()},n=function n(){e.off("upgrade",n),e.off("upgradeError",n),t()},r=function(){e.once("upgrade",n),e.once("upgradeError",n)};return"opening"!==this.readyState&&"open"!==this.readyState||(this.readyState="closing",this.writeBuffer.length?this.once("drain",(function(){e.upgrading?r():t()})):this.upgrading?r():t()),this}},{key:"onError",value:function(e){n.priorWebsocketSuccess=!1,this.emitReserved("error",e),this.onClose("transport error",e)}},{key:"onClose",value:function(e,t){"opening"!==this.readyState&&"open"!==this.readyState&&"closing"!==this.readyState||(this.clearTimeoutFn(this.pingTimeoutTimer),this.transport.removeAllListeners("close"),this.transport.close(),this.transport.removeAllListeners(),"function"===typeof removeEventListener&&(removeEventListener("beforeunload",this.beforeunloadEventListener,!1),removeEventListener("offline",this.offlineEventListener,!1)),this.readyState="closed",this.id=null,this.emitReserved("close",e,t),this.writeBuffer=[],this.prevBufferLen=0)}},{key:"filterUpgrades",value:function(e){for(var t=[],n=0,r=e.length;n=0&&e.num0;case Ce.ACK:case Ce.BINARY_ACK:return Array.isArray(t)}}}]),n}(A),Me=function(){function e(t){(0,o.Z)(this,e),this.packet=t,this.buffers=[],this.reconPack=t}return(0,a.Z)(e,[{key:"takeBinaryData",value:function(e){if(this.buffers.push(e),this.buffers.length===this.reconPack.attachments){var t=Ee(this.reconPack,this.buffers);return this.finishedReconstruction(),t}return null}},{key:"finishedReconstruction",value:function(){this.reconPack=null,this.buffers=[]}}]),e}();function De(e,t,n){return e.on(t,n),function(){e.off(t,n)}}var Ne=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1}),Ae=function(e){(0,c.Z)(n,e);var t=(0,d.Z)(n);function n(e,r,i){var a;return(0,o.Z)(this,n),(a=t.call(this)).connected=!1,a.recovered=!1,a.receiveBuffer=[],a.sendBuffer=[],a._queue=[],a._queueSeq=0,a.ids=0,a.acks={},a.flags={},a.io=e,a.nsp=r,i&&i.auth&&(a.auth=i.auth),a._opts=Object.assign({},i),a.io._autoConnect&&a.open(),a}return(0,a.Z)(n,[{key:"disconnected",get:function(){return!this.connected}},{key:"subEvents",value:function(){if(!this.subs){var e=this.io;this.subs=[De(e,"open",this.onopen.bind(this)),De(e,"packet",this.onpacket.bind(this)),De(e,"error",this.onerror.bind(this)),De(e,"close",this.onclose.bind(this))]}}},{key:"active",get:function(){return!!this.subs}},{key:"connect",value:function(){return this.connected||(this.subEvents(),this.io._reconnecting||this.io.open(),"open"===this.io._readyState&&this.onopen()),this}},{key:"open",value:function(){return this.connect()}},{key:"send",value:function(){for(var e=arguments.length,t=new Array(e),n=0;n1?t-1:0),r=1;r1?n-1:0),i=1;in._opts.retries&&(n._queue.shift(),t&&t(e));else if(n._queue.shift(),t){for(var i=arguments.length,o=new Array(i>1?i-1:0),a=1;a0&&void 0!==arguments[0]&&arguments[0];if(this.connected&&0!==this._queue.length){var t=this._queue[0];t.pending&&!e||(t.pending=!0,t.tryCount++,this.flags=t.flags,this.emit.apply(this,t.args))}}},{key:"packet",value:function(e){e.nsp=this.nsp,this.io._packet(e)}},{key:"onopen",value:function(){var e=this;"function"==typeof this.auth?this.auth((function(t){e._sendConnectPacket(t)})):this._sendConnectPacket(this.auth)}},{key:"_sendConnectPacket",value:function(e){this.packet({type:Ce.CONNECT,data:this._pid?Object.assign({pid:this._pid,offset:this._lastOffset},e):e})}},{key:"onerror",value:function(e){this.connected||this.emitReserved("connect_error",e)}},{key:"onclose",value:function(e,t){this.connected=!1,delete this.id,this.emitReserved("disconnect",e,t)}},{key:"onpacket",value:function(e){if(e.nsp===this.nsp)switch(e.type){case Ce.CONNECT:e.data&&e.data.sid?this.onconnect(e.data.sid,e.data.pid):this.emitReserved("connect_error",new Error("It seems you are trying to reach a Socket.IO server in v2.x with a v3.x client, but they are not compatible (more information here: https://socket.io/docs/v3/migrating-from-2-x-to-3-0/)"));break;case Ce.EVENT:case Ce.BINARY_EVENT:this.onevent(e);break;case Ce.ACK:case Ce.BINARY_ACK:this.onack(e);break;case Ce.DISCONNECT:this.ondisconnect();break;case Ce.CONNECT_ERROR:this.destroy();var t=new Error(e.data.message);t.data=e.data.data,this.emitReserved("connect_error",t)}}},{key:"onevent",value:function(e){var t=e.data||[];null!=e.id&&t.push(this.ack(e.id)),this.connected?this.emitEvent(t):this.receiveBuffer.push(Object.freeze(t))}},{key:"emitEvent",value:function(e){if(this._anyListeners&&this._anyListeners.length){var t,r=this._anyListeners.slice(),i=(0,pe.Z)(r);try{for(i.s();!(t=i.n()).done;){t.value.apply(this,e)}}catch(We){i.e(We)}finally{i.f()}}h((0,f.Z)(n.prototype),"emit",this).apply(this,e),this._pid&&e.length&&"string"===typeof e[e.length-1]&&(this._lastOffset=e[e.length-1])}},{key:"ack",value:function(e){var t=this,n=!1;return function(){if(!n){n=!0;for(var r=arguments.length,i=new Array(r),o=0;o0&&e.jitter<=1?e.jitter:0,this.attempts=0}Le.prototype.duration=function(){var e=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var t=Math.random(),n=Math.floor(t*this.jitter*e);e=0==(1&Math.floor(10*t))?e-n:e+n}return 0|Math.min(e,this.max)},Le.prototype.reset=function(){this.attempts=0},Le.prototype.setMin=function(e){this.ms=e},Le.prototype.setMax=function(e){this.max=e},Le.prototype.setJitter=function(e){this.jitter=e};var je=function(e){(0,c.Z)(n,e);var t=(0,d.Z)(n);function n(e,i){var a,s;(0,o.Z)(this,n),(a=t.call(this)).nsps={},a.subs=[],e&&"object"===typeof e&&(i=e,e=void 0),(i=i||{}).path=i.path||"/socket.io",a.opts=i,B((0,u.Z)(a),i),a.reconnection(!1!==i.reconnection),a.reconnectionAttempts(i.reconnectionAttempts||1/0),a.reconnectionDelay(i.reconnectionDelay||1e3),a.reconnectionDelayMax(i.reconnectionDelayMax||5e3),a.randomizationFactor(null!==(s=i.randomizationFactor)&&void 0!==s?s:.5),a.backoff=new Le({min:a.reconnectionDelay(),max:a.reconnectionDelayMax(),jitter:a.randomizationFactor()}),a.timeout(null==i.timeout?2e4:i.timeout),a._readyState="closed",a.uri=e;var l=i.parser||r;return a.encoder=new l.Encoder,a.decoder=new l.Decoder,a._autoConnect=!1!==i.autoConnect,a._autoConnect&&a.open(),a}return(0,a.Z)(n,[{key:"reconnection",value:function(e){return arguments.length?(this._reconnection=!!e,this):this._reconnection}},{key:"reconnectionAttempts",value:function(e){return void 0===e?this._reconnectionAttempts:(this._reconnectionAttempts=e,this)}},{key:"reconnectionDelay",value:function(e){var t;return void 0===e?this._reconnectionDelay:(this._reconnectionDelay=e,null===(t=this.backoff)||void 0===t||t.setMin(e),this)}},{key:"randomizationFactor",value:function(e){var t;return void 0===e?this._randomizationFactor:(this._randomizationFactor=e,null===(t=this.backoff)||void 0===t||t.setJitter(e),this)}},{key:"reconnectionDelayMax",value:function(e){var t;return void 0===e?this._reconnectionDelayMax:(this._reconnectionDelayMax=e,null===(t=this.backoff)||void 0===t||t.setMax(e),this)}},{key:"timeout",value:function(e){return arguments.length?(this._timeout=e,this):this._timeout}},{key:"maybeReconnectOnOpen",value:function(){!this._reconnecting&&this._reconnection&&0===this.backoff.attempts&&this.reconnect()}},{key:"open",value:function(e){var t=this;if(~this._readyState.indexOf("open"))return this;this.engine=new he(this.uri,this.opts);var n=this.engine,r=this;this._readyState="opening",this.skipReconnect=!1;var i=De(n,"open",(function(){r.onopen(),e&&e()})),o=De(n,"error",(function(n){r.cleanup(),r._readyState="closed",t.emitReserved("error",n),e?e(n):r.maybeReconnectOnOpen()}));if(!1!==this._timeout){var a=this._timeout;0===a&&i();var s=this.setTimeoutFn((function(){i(),n.close(),n.emit("error",new Error("timeout"))}),a);this.opts.autoUnref&&s.unref(),this.subs.push((function(){clearTimeout(s)}))}return this.subs.push(i),this.subs.push(o),this}},{key:"connect",value:function(e){return this.open(e)}},{key:"onopen",value:function(){this.cleanup(),this._readyState="open",this.emitReserved("open");var e=this.engine;this.subs.push(De(e,"ping",this.onping.bind(this)),De(e,"data",this.ondata.bind(this)),De(e,"error",this.onerror.bind(this)),De(e,"close",this.onclose.bind(this)),De(this.decoder,"decoded",this.ondecoded.bind(this)))}},{key:"onping",value:function(){this.emitReserved("ping")}},{key:"ondata",value:function(e){try{this.decoder.add(e)}catch(t){this.onclose("parse error",t)}}},{key:"ondecoded",value:function(e){var t=this;oe((function(){t.emitReserved("packet",e)}),this.setTimeoutFn)}},{key:"onerror",value:function(e){this.emitReserved("error",e)}},{key:"socket",value:function(e,t){var n=this.nsps[e];return n?this._autoConnect&&!n.active&&n.connect():(n=new Ae(this,e,t),this.nsps[e]=n),n}},{key:"_destroy",value:function(e){for(var t=0,n=Object.keys(this.nsps);t=this._reconnectionAttempts)this.backoff.reset(),this.emitReserved("reconnect_failed"),this._reconnecting=!1;else{var n=this.backoff.duration();this._reconnecting=!0;var r=this.setTimeoutFn((function(){t.skipReconnect||(e.emitReserved("reconnect_attempt",t.backoff.attempts),t.skipReconnect||t.open((function(n){n?(t._reconnecting=!1,t.reconnect(),e.emitReserved("reconnect_error",n)):t.onreconnect()})))}),n);this.opts.autoUnref&&r.unref(),this.subs.push((function(){clearTimeout(r)}))}}},{key:"onreconnect",value:function(){var e=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),this.emitReserved("reconnect",e)}}]),n}(A),Re={};function Ie(e,t){"object"===typeof e&&(t=e,e=void 0);var n,r=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",n=arguments.length>2?arguments[2]:void 0,r=e;n=n||"undefined"!==typeof location&&location,null==e&&(e=n.protocol+"//"+n.host),"string"===typeof e&&("/"===e.charAt(0)&&(e="/"===e.charAt(1)?n.protocol+e:n.host+e),/^(https?|wss?):\/\//.test(e)||(e="undefined"!==typeof n?n.protocol+"//"+e:"https://"+e),r=fe(e)),r.port||(/^(http|ws)$/.test(r.protocol)?r.port="80":/^(http|ws)s$/.test(r.protocol)&&(r.port="443")),r.path=r.path||"/";var i=-1!==r.host.indexOf(":")?"["+r.host+"]":r.host;return r.id=r.protocol+"://"+i+":"+r.port+t,r.href=r.protocol+"://"+i+(n&&n.port===r.port?"":":"+r.port),r}(e,(t=t||{}).path||"/socket.io"),i=r.source,o=r.id,a=r.path,s=Re[o]&&a in Re[o].nsps;return t.forceNew||t["force new connection"]||!1===t.multiplex||s?n=new je(i,t):(Re[o]||(Re[o]=new je(i,t)),n=Re[o]),r.query&&!t.query&&(t.query=r.queryKey),n.socket(r.path,t)}Object.assign(Ie,{Manager:je,Socket:Ae,io:Ie,connect:Ie});var Be=function(){function e(){var t=this;(0,o.Z)(this,e);var n={NODE_ENV:"production",PUBLIC_URL:".",WDS_SOCKET_HOST:void 0,WDS_SOCKET_PATH:void 0,WDS_SOCKET_PORT:void 0,FAST_REFRESH:!0,REACT_APP_WEB_BUILD:"1",REACT_APP_BUILD_COMMIT:"8ccabd3"}.REACT_APP_SOCKET_PORT||null;this.socket=null==n?Ie.connect():Ie.connect(":"+n),this.socket.on("connect",(function(){t.socket.on("app-result",(function(e){t.onAppResult(e)})),t.socket.on("app-pid",(function(e){t.remotePid=e.pid})),t.socket.on("app-error",(function(e){t.onAppError(e)})),t.socket.on("app-exit",(function(e){t.onAppExit(e)})),t.connectionListeners.forEach((function(e){e(!0)})),t.statusListeners.forEach((function(e){e({status:"idle"})})),t.socket.on("disconnect",(function(){t.connectionListeners.forEach((function(e){e(!1)}))}))})),this.consoleListeners=[],this.renderers=[],this.statusListeners=[],this.connectionListeners=[],this.runListeners=[],this.remotePid=null,this.status={connected:!1,label:""},this.addStatusListener((function(e){"idle"===e.status&&(t.killCounter=0,t.status=Object.assign({},e))}))}return(0,a.Z)(e,[{key:"on",value:function(e,t){"console"===e?this.addConsoleListener(t):"status"===e?this.addStatusListener(t):"connection"===e?this.addConnectionListener(t):"render"===e?this.addRenderer(t):"run"===e?this.addRunListener(t):console.error("Unknown event",e)}},{key:"remove",value:function(e,t){"console"===e?this.consoleListeners=this.consoleListeners.filter((function(e){return e!==t})):"status"===e?this.statusListeners=this.statusListeners.filter((function(e){return e!==t})):"connection"===e?this.connectionListeners=this.connectionListeners.filter((function(e){return e!==t})):"render"===e?this.renderers=this.renderers.filter((function(e){return e!==t})):"run"===e?this.runListeners=this.runListeners.filter((function(e){return e!==t})):console.error("Unknown event",e)}},{key:"addRunListener",value:function(e){this.runListeners.push(e)}},{key:"addConnectionListener",value:function(e){this.connectionListeners.push(e)}},{key:"addStatusListener",value:function(e){this.statusListeners.push(e)}},{key:"addConsoleListener",value:function(e){this.consoleListeners.push(e)}},{key:"addRenderer",value:function(e){this.renderers.push(e)}},{key:"logToConsole",value:function(e){this.consoleListeners.forEach((function(t){t(e)}))}},{key:"onAppResult",value:function(e){if(e.startsWith("DEBUGGER OUTPUT"))try{e=JSON.parse(e.substr("DEBUGGER OUTPUT".length)),this.renderers.forEach((function(t){t.add_result(e)}))}catch(t){this.logToConsole("Failed to parse debugger output "+e.substr("DEBUGGER OUTPUT".length)+"\n")}else"string"==typeof e?this.logToConsole(e+"\n"):this.logToConsole(JSON.stringify(e)+"\n")}},{key:"sendInput",value:function(e){this.socket.emit("app-input",{pid:this.remotePid,text:e})}},{key:"onAppError",value:function(e){this.logToConsole(e)}},{key:"onAppExit",value:function(e){this.logToConsole(e),this.statusListeners.forEach((function(t){t({status:"idle",error:e})})),this.remotePid=null}},{key:"run",value:function(e){this.remotePid?console.error("Cannot run multiple processes at once"):(this.runListeners.forEach((function(e){return e()})),this.statusListeners.forEach((function(e){e({status:"running",error:null})})),console.log("Running with parameters",e),this.renderers.forEach((function(e){e.clear_results()})),this.socket.emit("app",e))}},{key:"kill",value:function(){console.log("Killing remote process",this.remotePid),this.socket.emit("app-kill",{pid:this.remotePid})}}]),e}();window.RemoteProcessConnectionRegistry?Be.registry=window.RemoteProcessConnectionRegistry:Be.registry=window.RemoteProcessConnectionRegistry={},Be.get=function(e){return Be.registry[e]||(Be.registry[e]=new Be),Be.registry[e]};var ze=window.location.host.includes("next")||window.location.hash.includes("is-next"),Fe={DEMO_MODE:!0,BROWSER_MODE:!1,DEV_MODE:!0,NEXT_MODE:ze,ProcessConnection:Be},qe=!0;function Ve(){return qe}qe=!1;var Ue=(Fe={DEMO_MODE:!0,BROWSER_MODE:!0,DEV_MODE:!0,NEXT_MODE:ze,ProcessConnection:l}).ProcessConnection.get("lmql");Fe.ProcessConnection},7495:function(__unused_webpack_module,__webpack_exports__,__webpack_require__){"use strict";__webpack_require__.d(__webpack_exports__,{Vq:function(){return Dialog},lX:function(){return PromptPopup},r3:function(){return Explore},uy:function(){return ExploreState}});var _home_runner_work_lmql_lmql_src_lmql_ui_playground_node_modules_babel_runtime_helpers_esm_slicedToArray_js__WEBPACK_IMPORTED_MODULE_8__=__webpack_require__(885),_home_runner_work_lmql_lmql_src_lmql_ui_playground_node_modules_babel_runtime_helpers_esm_taggedTemplateLiteral_js__WEBPACK_IMPORTED_MODULE_7__=__webpack_require__(1766),react__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__(2791),styled_components__WEBPACK_IMPORTED_MODULE_6__=__webpack_require__(6444),_queries__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__(9126),_queries__WEBPACK_IMPORTED_MODULE_1___default=__webpack_require__.n(_queries__WEBPACK_IMPORTED_MODULE_1__),_State__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__(318),_Configuration__WEBPACK_IMPORTED_MODULE_3__=__webpack_require__(5591),_build_info__WEBPACK_IMPORTED_MODULE_4__=__webpack_require__(8068),react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__=__webpack_require__(184),_templateObject,_templateObject2,_templateObject3,_templateObject4,_templateObject5,_templateObject6,_templateObject7,_templateObject8,_templateObject9,PromptPopup=styled_components__WEBPACK_IMPORTED_MODULE_6__.ZP.div(_templateObject||(_templateObject=(0,_home_runner_work_lmql_lmql_src_lmql_ui_playground_node_modules_babel_runtime_helpers_esm_taggedTemplateLiteral_js__WEBPACK_IMPORTED_MODULE_7__.Z)(["\n position: absolute;\n top: 0;\n left: 0;\n width: 100vw;\n height: 100vh;\n background-color: #000000c2;\n z-index: 999;\n display: flex;\n flex-direction: column;\n overflow: hidden;\n\n animation: fade-in 0.2s;\n\n @keyframes fade-in {\n 0% {\n opacity: 0;\n }\n 100% {\n opacity: 1;\n }\n }\n\n .click-handler {\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n z-index: -1;\n }\n"]))),Dialog=styled_components__WEBPACK_IMPORTED_MODULE_6__.ZP.div(_templateObject2||(_templateObject2=(0,_home_runner_work_lmql_lmql_src_lmql_ui_playground_node_modules_babel_runtime_helpers_esm_taggedTemplateLiteral_js__WEBPACK_IMPORTED_MODULE_7__.Z)(['\n background-color: #ffffff;\n border-radius: 4pt;\n overflow: hidden;\n padding: 10pt;\n margin: auto;\n max-width: 1100pt;\n max-height: 500pt;\n color: black;\n\n font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica;\n\n input {\n border: none;\n background-color: #dfdfdf;\n border-radius: 4pt;\n font-size: 14pt;\n outline: none;\n padding: 5pt;\n margin: 10pt;\n margin-left: 0pt;\n border: 2pt solid transparent;\n\n :focus {\n border: 2pt solid #8e98ea;\n }\n }\n\n &.embed {\n width: calc(100% - 22pt) !important;\n margin: 0;\n max-width: 100% !important;\n height: 100%;\n max-height: 100%;\n border: 1pt solid grey;\n font-size: 8pt !important;\n }\n\n label {\n font-size: 10pt;\n position: relative;\n top: 8pt;\n left: 2pt;\n }\n']))),ExploreDialog=(0,styled_components__WEBPACK_IMPORTED_MODULE_6__.ZP)(Dialog)(_templateObject3||(_templateObject3=(0,_home_runner_work_lmql_lmql_src_lmql_ui_playground_node_modules_babel_runtime_helpers_esm_taggedTemplateLiteral_js__WEBPACK_IMPORTED_MODULE_7__.Z)(["\n width: 800pt;\n height: 700pt;\n max-height: calc(100vh - 40pt);\n max-width: 100vw;\n overflow-y: auto;\n\n /* invisible scroll bar */\n ::-webkit-scrollbar {\n width: 0px;\n background: transparent;\n }\n\n position: relative;\n padding: 0pt;\n \n\n @media (max-width: 800pt) {\n border-radius: 0 !important;\n width: 100vw !important;\n height: 100vh !important;\n max-height: 100vh !important;\n max-width: 100vw !important;\n }\n \n\n @media (max-width: 450pt) {\n width: calc(100vw - 20pt);\n height: calc(100vh - 20pt);\n max-height: 100vh;\n max-width: 100vw;\n overflow-y: auto;\n position: relative;\n padding: 10pt;\n padding-bottom: 80pt;\n padding-left: 0;\n margin: 0;\n\n div.tile {\n display: block !important;\n height: 40pt;\n width: 100% !important;\n\n &:hover {\n transform: none !important;\n border: 1pt solid #ababab;\n }\n }\n }\n\n >div {\n padding: 5pt 20pt;\n position: relative;\n }\n\n >div .sidenote a {\n padding-left: 2pt;\n }\n\n >div .sidenote {\n position: absolute;\n top: 15pt;\n right: 15pt;\n font-size: 8pt;\n }\n\n div.highlight {\n background-color: #f5f5f5;\n margin: 5pt;\n border-radius: 4pt;\n }\n\n >div>div {\n display: flex;\n flex-direction: row;\n flex-wrap: wrap;\n }\n\n p {\n text-align: justify;\n }\n\n h1 {\n margin: 0;\n padding: 20pt;\n font-weight: bold;\n padding-bottom: 10pt;\n }\n\n h1 img {\n width: 20pt;\n height: 20pt;\n margin-right: 8pt;\n position: relative;\n top: 2pt;\n }\n\n h2 {\n font-size: 12pt;\n }\n\n h3 {\n font-size: 12pt;\n color: #373737;\n margin: 0;\n z-index: 999;\n font-weight: 700;\n }\n\n .close {\n position: absolute;\n top: 10pt;\n right: 10pt;\n width: 30pt;\n height: 30pt;\n text-align: center;\n line-height: 30pt;\n font-size: 20pt;\n cursor: pointer;\n }\n"]))),Tile=styled_components__WEBPACK_IMPORTED_MODULE_6__.ZP.div.attrs({className:"tile"})(_templateObject4||(_templateObject4=(0,_home_runner_work_lmql_lmql_src_lmql_ui_playground_node_modules_babel_runtime_helpers_esm_taggedTemplateLiteral_js__WEBPACK_IMPORTED_MODULE_7__.Z)(["\n background-color: white;\n border-radius: 4pt;\n padding: 10pt;\n margin: 10pt;\n margin-left: 0pt;\n margin-top: 0pt;\n cursor: pointer;\n height: 80pt;\n width: 100pt;\n border: 1pt solid #d4d4d4;\n opacity: 0.9;\n position: relative;\n display: flex;\n flex-direction: column;\n \n align-items: flex-start;\n justify-content: flex-start;\n\n transition: 0.1s linear transform;\n\n :hover {\n transform: scale(1.05);\n opacity: 1.0;\n border: 1pt solid #9b9a9a;\n }\n\n h3 {\n color: #212121;\n }\n\n code {\n opacity: 0.3;\n }\n\n p {\n color: #010101;\n font-size: 10pt;\n font-style: italic;\n z-index: 999;\n text-align: left;\n }\n\n .badge {\n color: #212121;\n position: absolute;\n top: 6pt;\n right: 6pt;\n font-size: 5pt;\n background-color: #e2e0e1;\n padding: 2pt;\n z-index: 9;\n }\n"]))),ExploreState={visible:"#explore"===window.location.hash,setVisibility:function(e){ExploreState.visible=e,ExploreState.listeners.forEach((function(t){return t(e)}))},listeners:[]},CodeContainer=styled_components__WEBPACK_IMPORTED_MODULE_6__.ZP.div.attrs({className:"code-container"})(_templateObject5||(_templateObject5=(0,_home_runner_work_lmql_lmql_src_lmql_ui_playground_node_modules_babel_runtime_helpers_esm_taggedTemplateLiteral_js__WEBPACK_IMPORTED_MODULE_7__.Z)(['\n background-color: transparent;\n padding: 10pt;\n margin: 0pt;\n overflow: hidden;\n transform: scale(0.8);\n transform-origin: top left;\n max-height: 50pt;\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n color: #323232;\n\n .keyword {\n color: #ff79c6;\n font-weight: bold;\n }\n\n code {\n width: 1024pt;\n margin: 0;\n padding: 0;\n white-space: pre-wrap;\n color: #f1fa8c;\n\n font-size: 4pt;\n line-height: 4pt;\n overflow-x: hidden;\n overflow-y: hidden;\n width: 100%;\n max-height: 60pt;\n white-space: pre-wrap;\n display: block;\n }\n\n /* fade out bottom */\n :after {\n content: "";\n position: absolute;\n bottom: -2px;\n left: 0;\n right: 0;\n height: 20pt;\n /* background: linear-gradient(180deg, transparent 0%, #f5f5f561 100%); */\n }\n'])));function BasicHighlighted(e){var t=e.code,n=["argmax","where","from","and","or","not","sample","beam_search"],r=t.split(/(\s+|[()\t])/g).map((function(e,t){return n.includes(e.toLowerCase())?(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)("span",{className:"keyword",children:e},e+t):(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)("span",{children:e},e+t)}));return(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(CodeContainer,{children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)("code",{children:r})})}var Description=styled_components__WEBPACK_IMPORTED_MODULE_6__.ZP.p(_templateObject6||(_templateObject6=(0,_home_runner_work_lmql_lmql_src_lmql_ui_playground_node_modules_babel_runtime_helpers_esm_taggedTemplateLiteral_js__WEBPACK_IMPORTED_MODULE_7__.Z)(["\n font-size: 14pt;\n color: #696969;\n padding: 0pt 20pt;\n font-weight: 500;\n margin-top: 0pt;\n"]))),LinkBox=styled_components__WEBPACK_IMPORTED_MODULE_6__.ZP.div(_templateObject7||(_templateObject7=(0,_home_runner_work_lmql_lmql_src_lmql_ui_playground_node_modules_babel_runtime_helpers_esm_taggedTemplateLiteral_js__WEBPACK_IMPORTED_MODULE_7__.Z)(["\n display: flex;\n flex-direction: row;\n\n a.button {\n display: block;\n border: 1pt solid #6b77ff;\n padding: 5pt;\n margin-top: 15pt;\n margin-right: 5pt;\n border-radius: 2pt;\n color: #6b77ff;\n\n font-size: 10pt;\n }\n\n a.button:first-child {\n color: white;\n background-color: #6b77ff;\n\n &:hover {\n background-color: #8e98ea;\n text-decoration: none;\n }\n }\n"]))),CiteBox=styled_components__WEBPACK_IMPORTED_MODULE_6__.ZP.code(_templateObject8||(_templateObject8=(0,_home_runner_work_lmql_lmql_src_lmql_ui_playground_node_modules_babel_runtime_helpers_esm_taggedTemplateLiteral_js__WEBPACK_IMPORTED_MODULE_7__.Z)(["\n display: block;\n background-color: #f5f5f5;\n padding: 4pt;\n border-radius: 4pt;\n"]))),PoweredBy=styled_components__WEBPACK_IMPORTED_MODULE_6__.ZP.div(_templateObject9||(_templateObject9=(0,_home_runner_work_lmql_lmql_src_lmql_ui_playground_node_modules_babel_runtime_helpers_esm_taggedTemplateLiteral_js__WEBPACK_IMPORTED_MODULE_7__.Z)(["\n font-size: 8pt;\n color: #696969;\n text-align: center;\n margin: auto;\n\n display: flex;\n justify-content: center;\n align-items: center;\n padding: 10pt;\n\n >div:nth-child(2) {\n margin-left: 5pt;\n }\n"]))),didLoadAnchor=!1,PreviewQueries={queries:[],listeners:[]};function Explore(){var _useState=(0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(ExploreState.visible),_useState2=(0,_home_runner_work_lmql_lmql_src_lmql_ui_playground_node_modules_babel_runtime_helpers_esm_slicedToArray_js__WEBPACK_IMPORTED_MODULE_8__.Z)(_useState,2),visible=_useState2[0],setVisible=_useState2[1],onClickTile=function(e){ExploreState.setVisibility(!1),e.state?fetch(e.state).then((function(e){return e.text()})).then((function(t){_State__WEBPACK_IMPORTED_MODULE_2__.Rs.load(t),_State__WEBPACK_IMPORTED_MODULE_2__.Rs.setItem("lmql-editor-contents",e.code),window.setTimeout((function(){return _State__WEBPACK_IMPORTED_MODULE_2__.l$.setTrackMostLikely(!0)}),10)})).catch((function(e){console.error(e),alert("Error loading example.")})):_State__WEBPACK_IMPORTED_MODULE_2__.Rs.setItem("lmql-editor-contents",e.code)},_useState3=(0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(_Configuration__WEBPACK_IMPORTED_MODULE_3__.DN.NEXT_MODE?PreviewQueries.queries:_queries__WEBPACK_IMPORTED_MODULE_1__.queries),_useState4=(0,_home_runner_work_lmql_lmql_src_lmql_ui_playground_node_modules_babel_runtime_helpers_esm_slicedToArray_js__WEBPACK_IMPORTED_MODULE_8__.Z)(_useState3,2),exploreQueries=_useState4[0],setExploreQueries=_useState4[1];if((0,react__WEBPACK_IMPORTED_MODULE_0__.useEffect)((function(){if(_Configuration__WEBPACK_IMPORTED_MODULE_3__.DN.NEXT_MODE){var url="https://raw.githubusercontent.com/lmql-lang/awesome-lmql/main/next/showcase-playground.js";url+="?nocache="+Math.random(),fetch(url).then((function(e){return e.text()})).then((function(r){var queries=eval(r).queries;PreviewQueries.queries=queries,PreviewQueries.listeners.forEach((function(e){return e()})),console.log("Loaded list of Preview release queries.",queries)})).catch((function(e){console.error(e),console.error("Error loading list of Preview release queries.")}))}}),[]),(0,react__WEBPACK_IMPORTED_MODULE_0__.useEffect)((function(){ExploreState.listeners.push(setVisible);var e=window.localStorage.getItem("lmql-editor-contents");if((null===e||"string"===typeof e&&0===e.trim().length)&&ExploreState.setVisibility(!_State__WEBPACK_IMPORTED_MODULE_2__.YR.preloaded),window.location.hash&&!didLoadAnchor){didLoadAnchor=!0;var t=window.location.hash.substring(1),n=_queries__WEBPACK_IMPORTED_MODULE_1__.queries.filter((function(e){return e.queries.find((function(e){return e.state.includes(t)}))}));if(1===n.length){var r=n[0].queries.find((function(e){return e.state.includes(t)}));window.setTimeout((function(){return onClickTile(r)}),10)}}return function(){ExploreState.listeners=ExploreState.listeners.filter((function(e){return e!==setVisible}))}}),[]),(0,react__WEBPACK_IMPORTED_MODULE_0__.useEffect)((function(){if(_Configuration__WEBPACK_IMPORTED_MODULE_3__.DN.NEXT_MODE){var e=function(){setExploreQueries(PreviewQueries.queries)};return PreviewQueries.listeners.push(e),function(){PreviewQueries.listeners=PreviewQueries.listeners.filter((function(t){return t!==e}))}}}),[]),!visible)return null;var description=(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsxs)(react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.Fragment,{children:["LMQL is a query language for large language models. Explore the examples below to get started.",(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsxs)(LinkBox,{children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)("a",{className:"button",target:"_blank",rel:"noreferrer",href:"https://docs.lmql.ai",children:"Documentation"}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)("a",{className:"button",target:"_blank",rel:"noreferrer",href:"https://lmql.ai",children:"Overview"})]})]});return _Configuration__WEBPACK_IMPORTED_MODULE_3__.DN.NEXT_MODE&&(description=(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsxs)(react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.Fragment,{children:["This is the preview channel of LMQL. It contains the latest features, but may be unstable. If you are looking for the stable version, please visit ",(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)("a",{href:"https://lmql.ai/playground",children:"the stable Playground IDE"}),"."]})),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsxs)(PromptPopup,{children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)("div",{className:"click-handler",onClick:function(){return ExploreState.setVisibility(!1)}}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsxs)(ExploreDialog,{children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsxs)("h1",{children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)("img",{src:"/lmql.svg",alt:"LMQL Logo"}),"Welcome To LMQL"]},"welcome"),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(Description,{children:description}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)("span",{className:"close",onClick:function(){return ExploreState.setVisibility(!1)},children:"\xd7"}),exploreQueries.map((function(e){return(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsxs)("div",{className:e.highlight?"highlight":"",children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)("h2",{children:e.category},e.category),e.highlight&&(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)("span",{class:"sidenote",children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)("a",{href:"https://github.com/eth-sri/lmql/issues",target:"_blank",rel:"noreferrer",title:"Please report any issue you find with Preview features to help us improve LMQL.",children:" Report Issues"})}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)("div",{children:e.queries.map((function(t,n){return(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsxs)(Tile,{onClick:function(){return onClickTile(t)},children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(BasicHighlighted,{code:t.code}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)("h3",{children:t.name}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)("p",{children:t.description})]},e.category+"-"+n)}))},e.category+"-div")]},e.category+"-container")})),!_Configuration__WEBPACK_IMPORTED_MODULE_3__.DN.NEXT_MODE&&(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.Fragment,{children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsxs)("div",{children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)("h2",{children:"Read More"},"read-paper"),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsxs)(CiteBox,{children:['Beurer-Kellner, Luca, Marc Fischer, and Martin Vechev. "Prompting Is Programming: A Query Language For Large Language Models."',(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)("a",{target:"_blank",rel:"noreferrer",href:"https://arxiv.org/pdf/2212.06094",children:"arXiv preprint arXiv:2212.06094"})," (2022)."]},"cite"),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)("br",{}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsxs)(PoweredBy,{children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsxs)("div",{children:["LMQL ",_build_info__WEBPACK_IMPORTED_MODULE_4__.n.info().commit]}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsxs)("div",{children:[_Configuration__WEBPACK_IMPORTED_MODULE_3__.DN.BROWSER_MODE&&!(0,_Configuration__WEBPACK_IMPORTED_MODULE_3__.gk)()&&(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsxs)("span",{children:[" In-Browser, Made with \u2764\ufe0f + ",(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)("a",{href:"https://pyodide.org",target:"_blank",rel:"noreferrer",children:"Pyodide"})," + ",(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)("a",{href:"https://webassembly.org/",target:"_blank",rel:"noreferrer",children:"WebAssembly"})]}),"-"!=_build_info__WEBPACK_IMPORTED_MODULE_4__.n.info().date?(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsxs)(react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.Fragment,{children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)("br",{}),"Build on ",_build_info__WEBPACK_IMPORTED_MODULE_4__.n.info().date]}):null]})]})]})})]})]})}},318:function(e,t,n){"use strict";n.d(t,{Hj:function(){return d},Rs:function(){return u},YR:function(){return s},l$:function(){return c}});var r=n(5671),i=n(3144),o=n(9126);function a(){var e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],t=window.location.href;if(-1===t.indexOf("?"))return null;var n=t.split("?")[1];return n.startsWith("embed=")?n.substr(6):n.startsWith("snippet=")&&e?n.substr(8):null}var s={mode:a(!1)?"embed":"playground",preloaded:!!a(!0),embedFile:null},l=function(){function e(){(0,r.Z)(this,e),this.items={},this.listeners={},this.restore(),this.saveQueue={}}return(0,i.Z)(e,[{key:"persist",value:function(e){var t=this;Object.keys(this.items).forEach((function(n){n&&n!==e||window.localStorage.setItem(n,t.items[n])}))}},{key:"restore",value:function(){var e=this;Object.keys(this.items).forEach((function(t){e.items[t]=window.localStorage.getItem(t)}));var t=a();if(t){var n=!0;console.log("loading snippet from",t);var r=o.queries.filter((function(e){return e.queries.find((function(e){return e.state=="precomputed/"+t+".json"}))}));if(1===r.length){var i=r[0].queries.find((function(e){return e.state=="precomputed/"+t+".json"}));t=i.state}if(t.startsWith("gist:"))try{var l=t.split(":"),u=l[1].split("/")[0],c=l[1].split("/")[1],d=l[1].split("/")[3];t="https://gist.githubusercontent.com/".concat(u,"/").concat(c,"/raw/").concat(d),n=d.endsWith(".json")}catch(f){return void console.error("error parsing github gist URL",f)}fetch(t).then((function(e){return e.text()})).then((function(r){t.includes("gist.github")||window.history.replaceState({},document.title,window.location.pathname),r&&(n||(r=JSON.stringify({"lmql-editor-contents":r,"decoder-graph":'{"nodes":[],"edges":[]}'})),s.embedFile=t,e.load(r))}))}}},{key:"load",value:function(e){var t=this;e=JSON.parse(e),this.items={},Object.keys(e).forEach((function(n){t.items[n]=e[n],t.listeners[n]&&t.listeners[n].forEach((function(e){return e(t.items[n])}))}))}},{key:"dump",value:function(){return JSON.stringify(this.items)}},{key:"on",value:function(e,t){t&&(this.listeners[e]||(this.listeners[e]=[]),this.listeners[e].push(t))}},{key:"remove",value:function(e,t){this.listeners[e]&&(this.listeners[e]=this.listeners[e].filter((function(e){return e!==t})))}},{key:"getItem",value:function(e){if(e in this.items)return this.items[e];var t=window.localStorage.getItem(e);return t?(this.items[e]=t,t):null}},{key:"setItem",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;this.items[e]=t,this.persist(e),this.listeners[e]&&this.listeners[e].forEach((function(e){e!==n&&e(t)}))}},{key:"queueSetItem",value:function(e,t){var n=this,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;this.saveQueue[e]&&clearTimeout(this.saveQueue[e]),this.saveQueue[e]=setTimeout((function(){n.setItem(e,t,r)}))}}]),e}(),u=new l,c={setTrackMostLikely:function(){},getTrackMostLikely:function(){return!1},setSelectedNode:function(){}},d={addListener:function(e){d.listeners.push(e)},listeners:[],error:null,setError:function(e){d.error=e,d.listeners.forEach((function(t){return t(e)}))},removeListener:function(e){d.listeners=d.listeners.filter((function(t){return t!==e}))},showErrorOutput:function(){}}},8068:function(e,t,n){"use strict";n.d(t,{n:function(){return o}});var r=n(5671),i=n(3144),o=new(function(){function e(){(0,r.Z)(this,e),this.listeners=[],window.BUILD_COMMIT||(window.BUILD_COMMIT="8ccabd3"),window.BUILD_DATE||(window.BUILD_DATE={NODE_ENV:"production",PUBLIC_URL:".",WDS_SOCKET_HOST:void 0,WDS_SOCKET_PATH:void 0,WDS_SOCKET_PORT:void 0,FAST_REFRESH:!0,REACT_APP_WEB_BUILD:"1",REACT_APP_BUILD_COMMIT:"8ccabd3"}.REACT_APP_BUILD_DATE?{NODE_ENV:"production",PUBLIC_URL:".",WDS_SOCKET_HOST:void 0,WDS_SOCKET_PATH:void 0,WDS_SOCKET_PORT:void 0,FAST_REFRESH:!0,REACT_APP_WEB_BUILD:"1",REACT_APP_BUILD_COMMIT:"8ccabd3"}.REACT_APP_BUILD_DATE:"")}return(0,i.Z)(e,[{key:"info",value:function(){return{commit:window.BUILD_COMMIT,date:window.BUILD_DATE||"-"}}},{key:"addListener",value:function(e){this.listeners.push(e)}},{key:"removeListener",value:function(e){this.listeners=this.listeners.filter((function(t){return t!==e}))}},{key:"setInfo",value:function(e){var t=this;window.BUILD_COMMIT=e.commit,window.BUILD_DATE=e.date,this.listeners.forEach((function(e){e(t.info())}))}}]),e}())},9126:function(e){e.exports={queries:[{category:"Introductory Examples",queries:[{name:"\ud83d\udc4b Hello World",description:"Who This?",code:'argmax \n "Say \'this is a test\':[RESPONSE]" \nfrom \n "openai/text-ada-001" \nwhere \n len(TOKENS(RESPONSE)) < 10',state:"precomputed/hello.json"},{name:"\ud83d\udc74 Tell A Joke",description:"Few-Shot Samples & Constraints",code:'argmax\n """A list of good dad jokes. A indicates the punchline\n Q: How does a penguin build its house?\n A: Igloos it together.\n Q: Which knight invented King Arthur\'s Round Table?\n A: Sir Cumference.\n Q:[JOKE]\n A:[PUNCHLINE]"""\nfrom\n "openai/text-davinci-003"\nwhere\n len(JOKE) < 120 and \n STOPS_AT(JOKE, "?") and \n STOPS_AT(PUNCHLINE, "\\n") and \n len(PUNCHLINE) > 1',state:"precomputed/joke.json"},{name:"\ud83c\udf34 Packing List",description:"Control-Flow Guided Generation",code:'sample(temperature=0.8)\n "A list of things not to forget when going to the sea (not travelling): \\n"\n "- Sunglasses \\n"\n for i in range(4):\n "- [THING] \\n"\nfrom\n \'openai/text-ada-001\'\nwhere\n THING in set(["Volleyball", "Sunscreen", "Bathing Suite"])',state:"precomputed/list.json"},{name:"\ud83d\udcdd Templates",description:"Template-Based Generation for JSON data",code:'argmax \n """\n Write a summary of Bruno Mars, the singer:\n {{\n "name": "[STRING_VALUE]",\n "age": [INT_VALUE],\n "top_songs": [[\n "[STRING_VALUE]",\n "[STRING_VALUE]"\n ]]\n }}\n """\nfrom\n "openai/text-davinci-003" \nwhere\n STOPS_BEFORE(STRING_VALUE, \'"\') and INT(INT_VALUE) and len(TOKENS(INT_VALUE)) < 2\n \n ',state:"precomputed/json-template.json"}]},{category:"Features In Preview",highlight:!0,queries:[{name:"\ud83d\udc68\u200d\ud83d\udc69\u200d\ud83d\udc67 Types / JSON",description:"Generate schema-safe, typed data.",code:'import lmql\nfrom dataclasses import dataclass\n\n@dataclass\nclass Employer:\n employer_name: str\n location: str\n\n@dataclass\nclass Person:\n name: str\n age: int\n employer: Employer\n job: str\n\nargmax\n "Alice is a 21 years old and works as an engineer at LMQL Inc in Zurich, Switzerland.\\n"\n "Structured: [PERSON_DATA]\\n"\n "Their name is {PERSON_DATA.name} and she works in {PERSON_DATA.employer.location}."\nfrom \n "openai/text-davinci-003" \nwhere \n type(PERSON_DATA) is Person\n \n',state:"precomputed/json-robust.json"},{name:"\ud83d\udee0\ufe0f Multi-Tool Use",description:"Simply expose Python functions as LLM tools.",code:'from lmql.lib.actions import inline_use, calc, wiki\n\nargmax\n "Q: What is the population of the US and Germany combined?\\n"\n "A: Let\'s think step by step\\n"\n "[REASONING]\\n"\n "Therefore the answer is[ANSWER]"\nfrom \n \'openai/text-davinci-003\'\nwhere\n inline_use(REASONING, [wiki, calc]) and INT(ANSWER)\n ',state:""},{name:"\ud83d\udd24 Regex Constraints",description:"Specify constraints using regex.",code:'"It\'s the last day of June so today is [RESPONSE]" where REGEX(RESPONSE, r"[0-9]{2}/[0-9]{2}")',state:"precomputed/date-regex.json"},{name:"\u2764\ufe0f Sentiment Constraints",description:"Affect sentiment with in-context instructions.",code:'@lmql.query(cache="mood.tokens", model="chatgpt")\nasync def mood_description(m: str):\n \'\'\'lmql\n print("Generating mood for", m)\n """Provide a one sentence instruction that prompts a model to write text that \n is written in a {m} tone, addressing some previously provided question.\\n"""\n "[SUMMARY]\\n"\n return SUMMARY.strip();\n \'\'\'\n\n@lmql.query\nasync def mood(m: str):\n \'\'\'lmql\n """\n Instruction: {await mood_description(m)}\n Answer: [RESPONSE]\n """ where stops_at(RESPONSE, ".") and stops_at(RESPONSE, "\\n")\n\n return RESPONSE.strip(); \n \'\'\'\n\n# main query\nargmax\n for q in ["Hi", "Who are you", "How is your day going?"]:\n "Q: {q}\\n"\n "A: [RESPONSE]\\n"\nfrom \n "chatgpt" \nwhere \n mood(RESPONSE, "loving like a partner")\n \n',state:""},{name:"\ud83d\udcdd Write A Poem",description:"Insert dynamic instructions during generation.",code:'@lmql.query\nasync def rhyme():\n \'\'\'\n """\n Above is the beginning of the poem. Generate the next verse that rhymes with the last line and has the same number of syllables.\n [VERSE]\n """ where stops_before(VERSE, "\\n")\n return VERSE\n \'\'\'\n\n@lmql.query\nasync def first_verse():\n \'\'\'\n """\n Generate a verse that would be perfect for the start of a beautiful rhyme. \n [VERSE]\n """ where stops_before(VERSE, "\\n")\n return VERSE\n \'\'\'\n\nargmax\n "[FIRST_VERSE]\\n"\n for i in range(5):\n "[VERSE]\\n"\nfrom \n "chatgpt" \nwhere \n rhyme(VERSE) and first_verse(FIRST_VERSE)\n',state:""}]},{category:"LLM Reasoning",queries:[{name:"\ud83e\udde0 Chain-Of-Thought",description:"CoT with robust result extraction.",code:'# zero-shot cot based on https://arxiv.org/pdf/2205.11916.pdf\nargmax\n """Q: It was Sept. 1st, 2021 a week ago. What is the date 10 days ago in MM/DD/YYYY?\n Answer Choices: (A) 08/29/2021 (B) 08/28/2021 (C) 08/29/1925 (D) 08/30/2021 (E) 05/25/2021 (F) 09/19/2021\n A: Let\'s think step by step."""\n "[REASONING]\\n"\n "Therefore, among A through F, the answer is[RESULT]"\nfrom\n "openai/text-davinci-003"\nwhere\n RESULT in ["A", "B", "C", "D", "E", "F"]',state:"precomputed/cot.json"},{name:"\ud83d\udc69\u200d\ud83d\udd2c Meta Prompting",description:"Asking an expert to answer.",code:'# metaprompting based on https://arxiv.org/pdf/2102.07350.pdf\nbeam(n=2)\n "Q: What are Large Language Models?\\n\\n"\n "A good person to answer this question would be[EXPERT]\\n\\n"\n expert_name = EXPERT.rstrip(".\\n")\n "For instance,{expert_name} would answer[ANSWER]"\nfrom \n "openai/text-davinci-001"\nwhere\n STOPS_AT(EXPERT, ".") and STOPS_AT(EXPERT, "\\n") and STOPS_AT(ANSWER, ".")',state:"precomputed/meta.json"}]},{category:"Tool-Augmented Queries",queries:[{name:"\ud83e\uddee Calculator",description:"On-the-fly arithmetic evaluation using Python.",code:'import re\nfrom lmql.demo import gsm8k_samples\n\ndef calc(expr):\n expr = re.sub(r"[^0-9+\\-*/().]", "", expr)\n return eval(expr)\n\nargmax(openai_chunksize=64, max_len=2048)\n QUESTION = "Josh decides to try flipping a house. He buys a house for $80,000 and then puts in $50,000 in repairs. This increased the value of the house by 150%. How much profit did he make?"\n # few shot samples\n "{gsm8k_samples()}"\n # prompt template\n "Q: {QUESTION}\\n"\n "Let\'s think step by step.\\n"\n for i in range(4):\n "[REASON_OR_CALC]"\n if REASON_OR_CALC.endswith("<<"):\n " [EXPR]"\n " {calc(EXPR)}>>"\n elif REASON_OR_CALC.endswith("So the answer"):\n break\n "is[RESULT]"\nfrom \n \'openai/text-davinci-003\'\nwhere\n STOPS_AT(REASON_OR_CALC, "<<") and\n STOPS_AT(EXPR, "=") and\n STOPS_AT(REASON_OR_CALC, "So the answer")',state:"precomputed/calc.json"},{name:"\ud83c\udf0e Wikipedia Search",description:"Interactive LM-driven Wikipedia search.",code:'async def wikipedia(q):\n from lmql.http import fetch\n try:\n q = q.strip("\\n \'.")\n pages = await fetch(f"https://en.wikipedia.org/w/api.php?format=json&action=query&prop=extracts&exintro&explaintext&redirects=1&titles={q}&origin=*", "query.pages")\n return list(pages.values())[0]["extract"][:280]\n except:\n return "No results"\n\nargmax\n "Q: From which countries did the Norse originate?\\n"\n "Action: Let\'s search Wikipedia for the term \'[TERM]\\n"\n result = await wikipedia(TERM)\n "Result: {result}\\n"\n "Final Answer:[ANSWER]"\nfrom \n "openai/text-davinci-003"\nwhere\n STOPS_AT(TERM, "\'")',state:"precomputed/wiki.json"},{name:"\ud83d\udcd6 Key-Value Memory",description:"Augment the LM with a key-value storage.",code:'# simple kv storage\nstorage = {}\ndef assign(key, value): storage[key] = value; return f\'{{{key}: "{value}"}}\'\ndef get(key): return storage.get(key)\n\nargmax(n=1, openai_chunksize=128, max_len=2048, step_budget=4*2048)\n """In your reasoning you can use actions. You do this as follows:\n `action_name() # result: `\n To remember things, you can use \'assign\'/\'get\':\n - To remember something:\n `assign("Alice", "banana") # result: "banana"`\n - To retrieve a stored value:\n `get("Alice") # result: "banana"`\n Always tail calls with " # result". Using these actions, let\'s solve the following question.\n \n Q: Alice, Bob, and Claire are playing a game. At the start of the game, they are each holding a ball: Alice has a black ball, Bob has a brown ball, and Claire has a blue ball. \\n\\nAs the game progresses, pairs of players trade balls. First, Bob and Claire swap balls. Then, Alice and Bob swap balls. Finally, Claire and Bob swap balls. At the end of the game, what ball does Alice have?\n A: Let\'s think step by step.\\n"""\n for i in range(32):\n "[REASONING]"\n if REASONING.endswith("# result"):\n cmd = REASONING.rsplit("`",1)[-1]\n cmd = cmd[:-len("# result")]\n "{eval(cmd)}`\\n"\n else:\n break\n """Therefore at the end of the game, Alice has the[OBJECT]"""\n assert "blue ball." in OBJECT\nfrom \n "openai/text-davinci-003"\nwhere\n STOPS_AT(REASONING, "# result") and STOPS_BEFORE(REASONING, "Therefore") and\n STOPS_AT(OBJECT, ".") and STOPS_AT(OBJECT, ",") \n',state:"precomputed/kv.json"}]},{category:"Decoding",queries:[{name:"\ud83d\udd0d Visualize Decoding",description:"Inspect the decoding tree of beam search.",code:'beam(n=4)\n """English to French Translation:\n English: I am going to the store\n French: [TRANSLATION]\n """\nfrom \n "openai/text-davinci-001"\nwhere\n STOPS_AT(TRANSLATION, "\\n")',state:"precomputed/translation.json"},{name:"\ud83d\udcca Distributions",description:"Classification via LM-based conditional distributions.",code:'argmax\n """Review: We had a great stay. Hiking in the mountains was fabulous and the food is really good.\\n\n Q: What is the underlying sentiment of this review and why?\\n\n A:[ANALYSIS]\\n\n Based on this, the overall sentiment of the message can be considered to be[CLASSIFICATION]"""\nfrom \n "openai/text-davinci-003"\ndistribution\n CLASSIFICATION in [" positive", " neutral", " negative"]',state:"precomputed/distribution.json"}]},{category:"Chatbots",requires_input:!0,queries:[{name:"\ud83d\udde3\ufe0f Chatbot",description:"Build a chatbot using interactive querying.",code:'argmax \n "{:system} You are a marketing chatbot for the language model query language (LMQL)."\n for i in range(10):\n "{:user} {await input()}"\n "{:assistant} [ANSWER]"\nfrom\n "chatgpt"',state:"precomputed/chat.json"}]}]}},3915:function(e,t,n){var r;r=function(e){return function(e){var t={};function n(r){if(t[r])return t[r].exports;var i=t[r]={i:r,l:!1,exports:{}};return e[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!==typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"===typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)n.d(r,i,function(t){return e[t]}.bind(null,i));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=0)}([function(e,t,n){var r=n(1),i=function(e){e&&e("layout","dagre",r)};"undefined"!==typeof cytoscape&&i(cytoscape),e.exports=i},function(e,t,n){function r(e){return r="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},r(e)}var i=function(e){return"function"===typeof e},o=n(2),a=n(3),s=n(4);function l(e){this.options=a({},o,e)}l.prototype.run=function(){var e=this.options,t=e.cy,n=e.eles,o=function(e,t){return i(t)?t.apply(e,[e]):t},a=e.boundingBox||{x1:0,y1:0,w:t.width(),h:t.height()};void 0===a.x2&&(a.x2=a.x1+a.w),void 0===a.w&&(a.w=a.x2-a.x1),void 0===a.y2&&(a.y2=a.y1+a.h),void 0===a.h&&(a.h=a.y2-a.y1);var l=new s.graphlib.Graph({multigraph:!0,compound:!0}),u={},c=function(e,t){null!=t&&(u[e]=t)};c("nodesep",e.nodeSep),c("edgesep",e.edgeSep),c("ranksep",e.rankSep),c("rankdir",e.rankDir),c("align",e.align),c("ranker",e.ranker),c("acyclicer",e.acyclicer),l.setGraph(u),l.setDefaultEdgeLabel((function(){return{}})),l.setDefaultNodeLabel((function(){return{}}));var d=n.nodes();i(e.sort)&&(d=d.sort(e.sort));for(var f=0;f1?t-1:0),r=1;re.length)&&(t=e.length);for(var n=0,r=new Array(t);nt?1:0},J=null!=Object.assign?Object.assign.bind(Object):function(e){for(var t=arguments,n=1;n255)return;t.push(Math.floor(o))}var a=r[1]||r[2]||r[3],s=r[1]&&r[2]&&r[3];if(a&&!s)return;var l=n[4];if(void 0!==l){if((l=parseFloat(l))<0||l>1)return;t.push(l)}}return t}(e)||function(e){var t,n,r,i,o,a,s,l;function u(e,t,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?e+6*(t-e)*n:n<.5?t:n<2/3?e+(t-e)*(2/3-n)*6:e}var c=new RegExp("^"+$+"$").exec(e);if(c){if((n=parseInt(c[1]))<0?n=(360- -1*n%360)%360:n>360&&(n%=360),n/=360,(r=parseFloat(c[2]))<0||r>100)return;if(r/=100,(i=parseFloat(c[3]))<0||i>100)return;if(i/=100,void 0!==(o=c[4])&&((o=parseFloat(o))<0||o>1))return;if(0===r)a=s=l=Math.round(255*i);else{var d=i<.5?i*(1+r):i+r-i*r,f=2*i-d;a=Math.round(255*u(f,d,n+1/3)),s=Math.round(255*u(f,d,n)),l=Math.round(255*u(f,d,n-1/3))}t=[a,s,l,o]}return t}(e)},te={transparent:[0,0,0,0],aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],grey:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]},ne=function(e){for(var t=e.map,n=e.keys,r=n.length,i=0;i1&&void 0!==arguments[1]?arguments[1]:ue;!(t=e.next()).done;)n=65599*n+t.value|0;return n},fe=function(e){return 65599*(arguments.length>1&&void 0!==arguments[1]?arguments[1]:ue)+e|0},he=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:ce;return(t<<5)+t+e|0},pe=function(e){return 2097152*e[0]+e[1]},ge=function(e,t){return[fe(e[0],t[0]),he(e[1],t[1])]},ve=function(e,t){var n={value:0,done:!1},r=0,i=e.length;return de({next:function(){return r=0&&(e[r]!==t||(e.splice(r,1),!n));r--);},Re=function(e){e.splice(0,e.length)},Ie=function(e,t,n){return n&&(t=Z(n,t)),e[t]},Be=function(e,t,n,r){n&&(t=Z(n,t)),e[t]=r},ze="undefined"!==typeof Map?Map:function(){function e(){g(this,e),this._obj={}}return m(e,[{key:"set",value:function(e,t){return this._obj[e]=t,this}},{key:"delete",value:function(e){return this._obj[e]=void 0,this}},{key:"clear",value:function(){this._obj={}}},{key:"has",value:function(e){return void 0!==this._obj[e]}},{key:"get",value:function(e){return this._obj[e]}}]),e}(),Fe=function(){function e(t){if(g(this,e),this._obj=Object.create(null),this.size=0,null!=t){var n;n=null!=t.instanceString&&t.instanceString()===this.instanceString()?t.toArray():t;for(var r=0;r2&&void 0!==arguments[2])||arguments[2];if(void 0!==e&&void 0!==t&&I(e)){var r=t.group;if(null==r&&(r=t.data&&null!=t.data.source&&null!=t.data.target?"edges":"nodes"),"nodes"===r||"edges"===r){this.length=1,this[0]=this;var i=this._private={cy:e,single:!0,data:t.data||{},position:t.position||{x:0,y:0},autoWidth:void 0,autoHeight:void 0,autoPadding:void 0,compoundBoundsClean:!1,listeners:[],group:r,style:{},rstyle:{},styleCxts:[],styleKeys:{},removed:!0,selected:!!t.selected,selectable:void 0===t.selectable||!!t.selectable,locked:!!t.locked,grabbed:!1,grabbable:void 0===t.grabbable||!!t.grabbable,pannable:void 0===t.pannable?"edges"===r:!!t.pannable,active:!1,classes:new qe,animation:{current:[],queue:[]},rscratch:{},scratch:t.scratch||{},edges:[],children:[],parent:t.parent&&t.parent.isNode()?t.parent:null,traversalCache:{},backgrounding:!1,bbCache:null,bbCacheShift:{x:0,y:0},bodyBounds:null,overlayBounds:null,labelBounds:{all:null,source:null,target:null,main:null},arrowBounds:{source:null,target:null,"mid-source":null,"mid-target":null}};if(null==i.position.x&&(i.position.x=0),null==i.position.y&&(i.position.y=0),t.renderedPosition){var o=t.renderedPosition,a=e.pan(),s=e.zoom();i.position={x:(o.x-a.x)/s,y:(o.y-a.y)/s}}var l=[];M(t.classes)?l=t.classes:T(t.classes)&&(l=t.classes.split(/\s+/));for(var u=0,c=l.length;u0;){var w=y.pop(),k=v(w),E=w.id();if(f[E]=k,k!==1/0)for(var S=w.neighborhood().intersect(p),C=0;C0)for(n.unshift(t);d[i];){var o=d[i];n.unshift(o.edge),n.unshift(o.node),i=(r=o.node).id()}return a.spawn(n)}}}},Ke={kruskal:function(e){e=e||function(e){return 1};for(var t=this.byGroup(),n=t.nodes,r=t.edges,i=n.length,o=new Array(i),a=n,s=function(e){for(var t=0;t0;){if(l=v.pop(),u=l.id(),m.delete(u),w++,u===f){for(var k=[],E=i,S=f,C=b[S];k.unshift(E),null!=C&&k.unshift(C),null!=(E=y[S]);)C=b[S=E.id()];return{found:!0,distance:h[u],path:this.spawn(k),steps:w}}g[u]=!0;for(var P=l._private.edges,T=0;TC&&(h[S]=C,m[S]=E,y[S]=x),!i){var P=E*u+k;!i&&h[P]>C&&(h[P]=C,m[P]=k,y[P]=x)}}}for(var O=0;O1&&void 0!==arguments[1]?arguments[1]:o,r=[],i=y(e);;){if(null==i)return t.spawn();var a=m(i),l=a.edge,u=a.pred;if(r.unshift(i[0]),i.same(n)&&r.length>0)break;null!=l&&r.unshift(l),i=u}return s.spawn(r)},hasNegativeWeightCycle:p,negativeWeightCycles:g}}},et=Math.sqrt(2),tt=function(e,t,n){0===n.length&&Pe("Karger-Stein must be run on a connected (sub)graph");for(var r=n[e],i=r[1],o=r[2],a=t[i],s=t[o],l=n,u=l.length-1;u>=0;u--){var c=l[u],d=c[1],f=c[2];(t[d]===a&&t[f]===s||t[d]===s&&t[f]===a)&&l.splice(u,1)}for(var h=0;hr;){var i=Math.floor(Math.random()*t.length);t=tt(i,e,t),n--}return t},rt={kargerStein:function(){var e=this,t=this.byGroup(),n=t.nodes,r=t.edges;r.unmergeBy((function(e){return e.isLoop()}));var i=n.length,o=r.length,a=Math.ceil(Math.pow(Math.log(i)/Math.LN2,2)),s=Math.floor(i/et);if(!(i<2)){for(var l=[],u=0;u0?1:e<0?-1:0},ct=function(e,t){return Math.sqrt(dt(e,t))},dt=function(e,t){var n=t.x-e.x,r=t.y-e.y;return n*n+r*r},ft=function(e){for(var t=e.length,n=0,r=0;r=e.x1&&e.y2>=e.y1)return{x1:e.x1,y1:e.y1,x2:e.x2,y2:e.y2,w:e.x2-e.x1,h:e.y2-e.y1};if(null!=e.w&&null!=e.h&&e.w>=0&&e.h>=0)return{x1:e.x1,y1:e.y1,x2:e.x1+e.w,y2:e.y1+e.h,w:e.w,h:e.h}}},mt=function(e,t,n){e.x1=Math.min(e.x1,t),e.x2=Math.max(e.x2,t),e.w=e.x2-e.x1,e.y1=Math.min(e.y1,n),e.y2=Math.max(e.y2,n),e.h=e.y2-e.y1},yt=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return e.x1-=t,e.x2+=t,e.y1-=t,e.y2+=t,e.w=e.x2-e.x1,e.h=e.y2-e.y1,e},bt=function(e){var t,n,r,i,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[0];if(1===o.length)t=n=r=i=o[0];else if(2===o.length)t=r=o[0],i=n=o[1];else if(4===o.length){var a=b(o,4);t=a[0],n=a[1],r=a[2],i=a[3]}return e.x1-=i,e.x2+=n,e.y1-=t,e.y2+=r,e.w=e.x2-e.x1,e.h=e.y2-e.y1,e},xt=function(e,t){e.x1=t.x1,e.y1=t.y1,e.x2=t.x2,e.y2=t.y2,e.w=e.x2-e.x1,e.h=e.y2-e.y1},_t=function(e,t){return!(e.x1>t.x2)&&(!(t.x1>e.x2)&&(!(e.x2t.y2)&&!(t.y1>e.y2)))))))},wt=function(e,t,n){return e.x1<=t&&t<=e.x2&&e.y1<=n&&n<=e.y2},kt=function(e,t){return wt(e,t.x1,t.y1)&&wt(e,t.x2,t.y2)},Et=function(e,t,n,r,i,o,a){var s,l=Vt(i,o),u=i/2,c=o/2,d=r-c-a;if((s=Rt(e,t,n,r,n-u+l-a,d,n+u-l+a,d,!1)).length>0)return s;var f=n+u+a;if((s=Rt(e,t,n,r,f,r-c+l-a,f,r+c-l+a,!1)).length>0)return s;var h=r+c+a;if((s=Rt(e,t,n,r,n-u+l-a,h,n+u-l+a,h,!1)).length>0)return s;var p,g=n-u-a;if((s=Rt(e,t,n,r,g,r-c+l-a,g,r+c-l+a,!1)).length>0)return s;var v=n-u+l,m=r-c+l;if((p=Lt(e,t,n,r,v,m,l+a)).length>0&&p[0]<=v&&p[1]<=m)return[p[0],p[1]];var y=n+u-l,b=r-c+l;if((p=Lt(e,t,n,r,y,b,l+a)).length>0&&p[0]>=y&&p[1]<=b)return[p[0],p[1]];var x=n+u-l,_=r+c-l;if((p=Lt(e,t,n,r,x,_,l+a)).length>0&&p[0]>=x&&p[1]>=_)return[p[0],p[1]];var w=n-u+l,k=r+c-l;return(p=Lt(e,t,n,r,w,k,l+a)).length>0&&p[0]<=w&&p[1]>=k?[p[0],p[1]]:[]},St=function(e,t,n,r,i,o,a){var s=a,l=Math.min(n,i),u=Math.max(n,i),c=Math.min(r,o),d=Math.max(r,o);return l-s<=e&&e<=u+s&&c-s<=t&&t<=d+s},Ct=function(e,t,n,r,i,o,a,s,l){var u=Math.min(n,a,i)-l,c=Math.max(n,a,i)+l,d=Math.min(r,s,o)-l,f=Math.max(r,s,o)+l;return!(ec||tf)},Pt=function(e,t,n,r,i,o,a,s){var l=[];!function(e,t,n,r,i){var o,a,s,l,u,c,d,f;0===e&&(e=1e-5),s=-27*(r/=e)+(t/=e)*(9*(n/=e)-t*t*2),o=(a=(3*n-t*t)/9)*a*a+(s/=54)*s,i[1]=0,d=t/3,o>0?(u=(u=s+Math.sqrt(o))<0?-Math.pow(-u,1/3):Math.pow(u,1/3),c=(c=s-Math.sqrt(o))<0?-Math.pow(-c,1/3):Math.pow(c,1/3),i[0]=-d+u+c,d+=(u+c)/2,i[4]=i[2]=-d,d=Math.sqrt(3)*(-c+u)/2,i[3]=d,i[5]=-d):(i[5]=i[3]=0,0===o?(f=s<0?-Math.pow(-s,1/3):Math.pow(s,1/3),i[0]=2*f-d,i[4]=i[2]=-(f+d)):(l=(a=-a)*a*a,l=Math.acos(s/Math.sqrt(l)),f=2*Math.sqrt(a),i[0]=-d+f*Math.cos(l/3),i[2]=-d+f*Math.cos((l+2*Math.PI)/3),i[4]=-d+f*Math.cos((l+4*Math.PI)/3)))}(1*n*n-4*n*i+2*n*a+4*i*i-4*i*a+a*a+r*r-4*r*o+2*r*s+4*o*o-4*o*s+s*s,9*n*i-3*n*n-3*n*a-6*i*i+3*i*a+9*r*o-3*r*r-3*r*s-6*o*o+3*o*s,3*n*n-6*n*i+n*a-n*e+2*i*i+2*i*e-a*e+3*r*r-6*r*o+r*s-r*t+2*o*o+2*o*t-s*t,1*n*i-n*n+n*e-i*e+r*o-r*r+r*t-o*t,l);for(var u=[],c=0;c<6;c+=2)Math.abs(l[c+1])<1e-7&&l[c]>=0&&l[c]<=1&&u.push(l[c]);u.push(1),u.push(0);for(var d,f,h,p=-1,g=0;g=0?hl?(e-i)*(e-i)+(t-o)*(t-o):u-d},Ot=function(e,t,n){for(var r,i,o,a,s=0,l=0;l=e&&e>=o||r<=e&&e<=o))continue;(e-r)/(o-r)*(a-i)+i>t&&s++}return s%2!==0},Mt=function(e,t,n,r,i,o,a,s,l){var u,c=new Array(n.length);null!=s[0]?(u=Math.atan(s[1]/s[0]),s[0]<0?u+=Math.PI/2:u=-u-Math.PI/2):u=s;for(var d,f=Math.cos(-u),h=Math.sin(-u),p=0;p0){var g=Nt(c,-l);d=Dt(g)}else d=c;return Ot(e,t,d)},Dt=function(e){for(var t,n,r,i,o,a,s,l,u=new Array(e.length/2),c=0;c=0&&p<=1&&v.push(p),g>=0&&g<=1&&v.push(g),0===v.length)return[];var m=v[0]*s[0]+e,y=v[0]*s[1]+t;return v.length>1?v[0]==v[1]?[m,y]:[m,y,v[1]*s[0]+e,v[1]*s[1]+t]:[m,y]},jt=function(e,t,n){return t<=e&&e<=n||n<=e&&e<=t?e:e<=t&&t<=n||n<=t&&t<=e?t:n},Rt=function(e,t,n,r,i,o,a,s,l){var u=e-i,c=n-e,d=a-i,f=t-o,h=r-t,p=s-o,g=d*f-p*u,v=c*f-h*u,m=p*c-d*h;if(0!==m){var y=g/m,b=v/m,x=-.001;return x<=y&&y<=1.001&&x<=b&&b<=1.001||l?[e+y*c,t+y*h]:[]}return 0===g||0===v?jt(e,n,a)===a?[a,s]:jt(e,n,i)===i?[i,o]:jt(i,a,n)===n?[n,r]:[]:[]},It=function(e,t,n,r,i,o,a,s){var l,u,c,d,f,h,p=[],g=new Array(n.length),v=!0;if(null==o&&(v=!1),v){for(var m=0;m0){var y=Nt(g,-s);u=Dt(y)}else u=g}else u=n;for(var b=0;bu&&(u=t)},f=function(e){return l[e]},h=0;h0?x.edgesTo(b)[0]:b.edgesTo(x)[0];var w=r(_);b=b.id(),h[b]>h[m]+w&&(h[b]=h[m]+w,p.nodes.indexOf(b)<0?p.push(b):p.updateItem(b),u[b]=0,l[b]=[]),h[b]==h[m]+w&&(u[b]=u[b]+u[m],l[b].push(m))}else for(var k=0;k0;){for(var P=n.pop(),T=0;T0&&a.push(n[s]);0!==a.length&&i.push(r.collection(a))}return i}(c,l,t,r);return b=function(e){for(var t=0;t5&&void 0!==arguments[5]?arguments[5]:cn,a=r,s=0;s=2?vn(e,t,n,0,hn,pn):vn(e,t,n,0,fn)},squaredEuclidean:function(e,t,n){return vn(e,t,n,0,hn)},manhattan:function(e,t,n){return vn(e,t,n,0,fn)},max:function(e,t,n){return vn(e,t,n,-1/0,gn)}};function yn(e,t,n,r,i,o){var a;return a=O(e)?e:mn[e]||mn.euclidean,0===t&&O(e)?a(i,o):a(t,n,r,i,o)}mn["squared-euclidean"]=mn.squaredEuclidean,mn.squaredeuclidean=mn.squaredEuclidean;var bn=Le({k:2,m:2,sensitivityThreshold:1e-4,distance:"euclidean",maxIterations:10,attributes:[],testMode:!1,testCentroids:null}),xn=function(e){return bn(e)},_n=function(e,t,n,r,i){var o="kMedoids"!==i?function(e){return n[e]}:function(e){return r[e](n)},a=n,s=t;return yn(e,r.length,o,(function(e){return r[e](t)}),a,s)},wn=function(e,t,n){for(var r=n.length,i=new Array(r),o=new Array(r),a=new Array(t),s=null,l=0;ln)return!1}return!0},Cn=function(e,t,n){for(var r=0;ri&&(i=t[l][u],o=u);a[o].push(e[l])}for(var c=0;c=i.threshold||"dendrogram"===i.mode&&1===e.length)return!1;var h,p=t[a],g=t[r[a]];h="dendrogram"===i.mode?{left:p,right:g,key:p.key}:{value:p.value.concat(g.value),key:p.key},e[p.index]=h,e.splice(g.index,1),t[p.key]=h;for(var v=0;vn[g.key][m.key]&&(o=n[g.key][m.key])):"max"===i.linkage?(o=n[p.key][m.key],n[p.key][m.key]1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:e.length,r=!(arguments.length>4&&void 0!==arguments[4])||arguments[4],i=!(arguments.length>5&&void 0!==arguments[5])||arguments[5];arguments.length>3&&void 0!==arguments[3]&&!arguments[3]?(n0&&e.splice(0,t)):e=e.slice(t,n);for(var o=0,a=e.length-1;a>=0;a--){var s=e[a];i?isFinite(s)||(e[a]=-1/0,o++):e.splice(a,1)}r&&e.sort((function(e,t){return e-t}));var l=e.length,u=Math.floor(l/2);return l%2!==0?e[u+1+o]:(e[u-1+o]+e[u+o])/2}(e):"mean"===t?function(e){for(var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:e.length,r=0,i=0,o=t;o1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:e.length,r=1/0,i=t;i1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:e.length,r=-1/0,i=t;ia&&(o=l,a=t[i*e+l])}o>0&&r.push(o)}for(var u=0;u=C?(P=C,C=O,T=M):O>P&&(P=O);for(var D=0;D0?1:0;k[w%u.minIterations*t+B]=z,I+=z}if(I>0&&(w>=u.minIterations-1||w==u.maxIterations-1)){for(var F=0,q=0;q0&&r.push(i);return r}(t,o,a),W=function(e,t,n){for(var r=Wn(e,t,n),i=0;il&&(s=u,l=c)}n[i]=o[s]}return Wn(e,t,n)}(t,r,U),Z={},H=0;H1||a>1)&&(u=!0),c[t]=[],e.outgoers().forEach((function(e){e.isEdge()&&c[t].push(e.id())}))}else d[t]=[void 0,e.target().id()]})):l.forEach((function(e){var t=e.id();e.isNode()?(e.degree(!0)%2&&(n?r?u=!0:r=t:n=t),c[t]=[],e.connectedEdges().forEach((function(e){return c[t].push(e.id())}))):d[t]=[e.source().id(),e.target().id()]}));var f={found:!1,trail:void 0};if(u)return f;if(r&&n)if(s){if(i&&r!=i)return f;i=r}else{if(i&&r!=i&&n!=i)return f;i||(i=r)}else i||(i=l[0].id());var h=function(e){for(var t,n,r,i=e,o=[e];c[i].length;)t=c[i].shift(),n=d[t][0],i!=(r=d[t][1])?(c[r]=c[r].filter((function(e){return e!=t})),i=r):s||i==n||(c[n]=c[n].filter((function(e){return e!=t})),i=n),o.unshift(t),o.unshift(i);return o},p=[],g=[];for(g=h(i);1!=g.length;)0==c[g[0]].length?(p.unshift(l.getElementById(g.shift())),p.unshift(l.getElementById(g.shift()))):g=h(g.shift()).concat(g);for(var v in p.unshift(l.getElementById(g.shift())),c)if(c[v].length)return f;return f.found=!0,f.trail=this.spawn(p,!0),f}},Xn=function(){var e=this,t={},n=0,r=0,i=[],o=[],a={},s=function s(l,u,c){l===c&&(r+=1),t[u]={id:n,low:n++,cutVertex:!1};var d,f,h,p,g=e.getElementById(u).connectedEdges().intersection(e);0===g.size()?i.push(e.spawn(e.getElementById(u))):g.forEach((function(n){d=n.source().id(),f=n.target().id(),(h=d===u?f:d)!==c&&(p=n.id(),a[p]||(a[p]=!0,o.push({x:u,y:h,edge:n})),h in t?t[u].low=Math.min(t[u].low,t[h].id):(s(l,h,u),t[u].low=Math.min(t[u].low,t[h].low),t[u].id<=t[h].low&&(t[u].cutVertex=!0,function(n,r){for(var a=o.length-1,s=[],l=e.spawn();o[a].x!=n||o[a].y!=r;)s.push(o.pop().edge),a--;s.push(o.pop().edge),s.forEach((function(n){var r=n.connectedNodes().intersection(e);l.merge(n),r.forEach((function(n){var r=n.id(),i=n.connectedEdges().intersection(e);l.merge(n),t[r].cutVertex?l.merge(i.filter((function(e){return e.isLoop()}))):l.merge(i)}))})),i.push(l)}(u,h))))}))};e.forEach((function(e){if(e.isNode()){var n=e.id();n in t||(r=0,s(n,n),t[n].cutVertex=r>1)}}));var l=Object.keys(t).filter((function(e){return t[e].cutVertex})).map((function(t){return e.getElementById(t)}));return{cut:e.spawn(l),components:i}},$n=function(){var e=this,t={},n=0,r=[],i=[],o=e.spawn(e),a=function a(s){if(i.push(s),t[s]={index:n,low:n++,explored:!1},e.getElementById(s).connectedEdges().intersection(e).forEach((function(e){var n=e.target().id();n!==s&&(n in t||a(n),t[n].explored||(t[s].low=Math.min(t[s].low,t[n].low)))})),t[s].index===t[s].low){for(var l=e.spawn();;){var u=i.pop();if(l.merge(e.getElementById(u)),t[u].low=t[s].index,t[u].explored=!0,u===s)break}var c=l.edgesWith(l),d=l.merge(c);r.push(d),o=o.difference(d)}};return e.forEach((function(e){if(e.isNode()){var n=e.id();n in t||a(n)}})),{cut:o,components:r}},Gn={};[We,He,Ke,Xe,Ge,Je,rt,Ht,Yt,$t,Qt,un,Nn,Fn,Hn,Yn,{hopcroftTarjanBiconnected:Xn,htbc:Xn,htb:Xn,hopcroftTarjanBiconnectedComponents:Xn},{tarjanStronglyConnected:$n,tsc:$n,tscc:$n,tarjanStronglyConnectedComponents:$n}].forEach((function(e){J(Gn,e)}));var Qn=function e(t){if(!(this instanceof e))return new e(t);this.id="Thenable/1.0.7",this.state=0,this.fulfillValue=void 0,this.rejectReason=void 0,this.onFulfilled=[],this.onRejected=[],this.proxy={then:this.then.bind(this)},"function"===typeof t&&t.call(this,this.fulfill.bind(this),this.reject.bind(this))};Qn.prototype={fulfill:function(e){return Jn(this,1,"fulfillValue",e)},reject:function(e){return Jn(this,2,"rejectReason",e)},then:function(e,t){var n=this,r=new Qn;return n.onFulfilled.push(nr(e,r,"fulfill")),n.onRejected.push(nr(t,r,"reject")),er(n),r.proxy}};var Jn=function(e,t,n,r){return 0===e.state&&(e.state=t,e[n]=r,er(e)),e},er=function(e){1===e.state?tr(e,"onFulfilled",e.fulfillValue):2===e.state&&tr(e,"onRejected",e.rejectReason)},tr=function(e,t,n){if(0!==e[t].length){var r=e[t];e[t]=[];var i=function(){for(var e=0;e0:void 0}},clearQueue:function(){return function(){var e=this,t=void 0!==e.length?e:[e];if(!(this._private.cy||this).styleEnabled())return this;for(var n=0;n0&&this.spawn(r).updateStyle().emit("class"),t},addClass:function(e){return this.toggleClass(e,!0)},hasClass:function(e){var t=this[0];return null!=t&&t._private.classes.has(e)},toggleClass:function(e,t){M(e)||(e=e.match(/\S+/g)||[]);for(var n=this,r=void 0===t,i=[],o=0,a=n.length;o0&&this.spawn(i).updateStyle().emit("class"),n},removeClass:function(e){return this.toggleClass(e,!1)},flashClass:function(e,t){var n=this;if(null==t)t=250;else if(0===t)return n;return n.addClass(e),setTimeout((function(){n.removeClass(e)}),t),n}};fr.className=fr.classNames=fr.classes;var hr={metaChar:"[\\!\\\"\\#\\$\\%\\&\\'\\(\\)\\*\\+\\,\\.\\/\\:\\;\\<\\=\\>\\?\\@\\[\\]\\^\\`\\{\\|\\}\\~]",comparatorOp:"=|\\!=|>|>=|<|<=|\\$=|\\^=|\\*=",boolOp:"\\?|\\!|\\^",string:"\"(?:\\\\\"|[^\"])*\"|'(?:\\\\'|[^'])*'",number:K,meta:"degree|indegree|outdegree",separator:"\\s*,\\s*",descendant:"\\s+",child:"\\s+>\\s+",subject:"\\$",group:"node|edge|\\*",directedEdge:"\\s+->\\s+",undirectedEdge:"\\s+<->\\s+"};hr.variable="(?:[\\w-.]|(?:\\\\"+hr.metaChar+"))+",hr.className="(?:[\\w-]|(?:\\\\"+hr.metaChar+"))+",hr.value=hr.string+"|"+hr.number,hr.id=hr.variable,function(){var e,t,n;for(e=hr.comparatorOp.split("|"),n=0;n=0||"="!==t&&(hr.comparatorOp+="|\\!"+t)}();var pr=0,gr=1,vr=2,mr=3,yr=4,br=5,xr=6,_r=7,wr=8,kr=9,Er=10,Sr=11,Cr=12,Pr=13,Tr=14,Or=15,Mr=16,Dr=17,Nr=18,Ar=19,Lr=20,jr=[{selector:":selected",matches:function(e){return e.selected()}},{selector:":unselected",matches:function(e){return!e.selected()}},{selector:":selectable",matches:function(e){return e.selectable()}},{selector:":unselectable",matches:function(e){return!e.selectable()}},{selector:":locked",matches:function(e){return e.locked()}},{selector:":unlocked",matches:function(e){return!e.locked()}},{selector:":visible",matches:function(e){return e.visible()}},{selector:":hidden",matches:function(e){return!e.visible()}},{selector:":transparent",matches:function(e){return e.transparent()}},{selector:":grabbed",matches:function(e){return e.grabbed()}},{selector:":free",matches:function(e){return!e.grabbed()}},{selector:":removed",matches:function(e){return e.removed()}},{selector:":inside",matches:function(e){return!e.removed()}},{selector:":grabbable",matches:function(e){return e.grabbable()}},{selector:":ungrabbable",matches:function(e){return!e.grabbable()}},{selector:":animated",matches:function(e){return e.animated()}},{selector:":unanimated",matches:function(e){return!e.animated()}},{selector:":parent",matches:function(e){return e.isParent()}},{selector:":childless",matches:function(e){return e.isChildless()}},{selector:":child",matches:function(e){return e.isChild()}},{selector:":orphan",matches:function(e){return e.isOrphan()}},{selector:":nonorphan",matches:function(e){return e.isChild()}},{selector:":compound",matches:function(e){return e.isNode()?e.isParent():e.source().isParent()||e.target().isParent()}},{selector:":loop",matches:function(e){return e.isLoop()}},{selector:":simple",matches:function(e){return e.isSimple()}},{selector:":active",matches:function(e){return e.active()}},{selector:":inactive",matches:function(e){return!e.active()}},{selector:":backgrounding",matches:function(e){return e.backgrounding()}},{selector:":nonbackgrounding",matches:function(e){return!e.backgrounding()}}].sort((function(e,t){return function(e,t){return-1*Q(e,t)}(e.selector,t.selector)})),Rr=function(){for(var e,t={},n=0;n0&&u.edgeCount>0)return Oe("The selector `"+e+"` is invalid because it uses both a compound selector and an edge selector"),!1;if(u.edgeCount>1)return Oe("The selector `"+e+"` is invalid because it uses multiple edge selectors"),!1;1===u.edgeCount&&Oe("The selector `"+e+"` is deprecated. Edge selectors do not take effect on changes to source and target nodes after an edge is added, for performance reasons. Use a class or data selector on edges instead, updating the class or data of an edge when your app detects a change in source or target nodes.")}return!0},toString:function(){if(null!=this.toStringCache)return this.toStringCache;for(var e=function(e){return null==e?"":e},t=function(t){return T(t)?'"'+t+'"':e(t)},n=function(e){return" "+e+" "},r=function(r,o){var a=r.type,s=r.value;switch(a){case pr:var l=e(s);return l.substring(0,l.length-1);case mr:var u=r.field,c=r.operator;return"["+u+n(e(c))+t(s)+"]";case br:var d=r.operator,f=r.field;return"["+e(d)+f+"]";case yr:return"["+r.field+"]";case xr:var h=r.operator;return"[["+r.field+n(e(h))+t(s)+"]]";case _r:return s;case wr:return"#"+s;case kr:return"."+s;case Dr:case Or:return i(r.parent,o)+n(">")+i(r.child,o);case Nr:case Mr:return i(r.ancestor,o)+" "+i(r.descendant,o);case Ar:var p=i(r.left,o),g=i(r.subject,o),v=i(r.right,o);return p+(p.length>0?" ":"")+g+v;case Lr:return""}},i=function(e,t){return e.checks.reduce((function(n,i,o){return n+(t===e&&0===o?"$":"")+r(i,t)}),"")},o="",a=0;a1&&a=0&&(t=t.replace("!",""),c=!0),t.indexOf("@")>=0&&(t=t.replace("@",""),u=!0),(a||l||u)&&(i=a||s?""+e:"",o=""+n),u&&(e=i=i.toLowerCase(),n=o=o.toLowerCase()),t){case"*=":r=i.indexOf(o)>=0;break;case"$=":r=i.indexOf(o,i.length-o.length)>=0;break;case"^=":r=0===i.indexOf(o);break;case"=":r=e===n;break;case">":d=!0,r=e>n;break;case">=":d=!0,r=e>=n;break;case"<":d=!0,r=e0;){var u=i.shift();t(u),o.add(u.id()),a&&r(i,o,u)}return e}function ni(e,t,n){if(n.isParent())for(var r=n._private.children,i=0;i1&&void 0!==arguments[1])||arguments[1],ni)},ei.forEachUp=function(e){return ti(this,e,!(arguments.length>1&&void 0!==arguments[1])||arguments[1],ri)},ei.forEachUpAndDown=function(e){return ti(this,e,!(arguments.length>1&&void 0!==arguments[1])||arguments[1],ii)},ei.ancestors=ei.parents,(Gr=Qr={data:cr.data({field:"data",bindingEvent:"data",allowBinding:!0,allowSetting:!0,settingEvent:"data",settingTriggersEvent:!0,triggerFnName:"trigger",allowGetting:!0,immutableKeys:{id:!0,source:!0,target:!0,parent:!0},updateStyle:!0}),removeData:cr.removeData({field:"data",event:"data",triggerFnName:"trigger",triggerEvent:!0,immutableKeys:{id:!0,source:!0,target:!0,parent:!0},updateStyle:!0}),scratch:cr.data({field:"scratch",bindingEvent:"scratch",allowBinding:!0,allowSetting:!0,settingEvent:"scratch",settingTriggersEvent:!0,triggerFnName:"trigger",allowGetting:!0,updateStyle:!0}),removeScratch:cr.removeData({field:"scratch",event:"scratch",triggerFnName:"trigger",triggerEvent:!0,updateStyle:!0}),rscratch:cr.data({field:"rscratch",allowBinding:!1,allowSetting:!0,settingTriggersEvent:!1,allowGetting:!0}),removeRscratch:cr.removeData({field:"rscratch",triggerEvent:!1}),id:function(){var e=this[0];if(e)return e._private.data.id}}).attr=Gr.data,Gr.removeAttr=Gr.removeData;var oi,ai,si=Qr,li={};function ui(e){return function(t){var n=this;if(void 0===t&&(t=!0),0!==n.length&&n.isNode()&&!n.removed()){for(var r=0,i=n[0],o=i._private.edges,a=0;at})),minIndegree:ci("indegree",(function(e,t){return et})),minOutdegree:ci("outdegree",(function(e,t){return et}))}),J(li,{totalDegree:function(e){for(var t=0,n=this.nodes(),r=0;r0,c=u;u&&(l=l[0]);var d=c?l.position():{x:0,y:0};return i={x:s.x-d.x,y:s.y-d.y},void 0===e?i:i[e]}for(var f=0;f0,v=g;g&&(p=p[0]);var m=v?p.position():{x:0,y:0};void 0!==t?h.position(e,t+m[e]):void 0!==i&&h.position({x:i.x+m.x,y:i.y+m.y})}}else if(!o)return;return this}},oi.modelPosition=oi.point=oi.position,oi.modelPositions=oi.points=oi.positions,oi.renderedPoint=oi.renderedPosition,oi.relativePoint=oi.relativePosition;var hi,pi,gi=ai;hi=pi={},pi.renderedBoundingBox=function(e){var t=this.boundingBox(e),n=this.cy(),r=n.zoom(),i=n.pan(),o=t.x1*r+i.x,a=t.x2*r+i.x,s=t.y1*r+i.y,l=t.y2*r+i.y;return{x1:o,x2:a,y1:s,y2:l,w:a-o,h:l-s}},pi.dirtyCompoundBoundsCache=function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=this.cy();return t.styleEnabled()&&t.hasCompoundNodes()?(this.forEachUp((function(t){if(t.isParent()){var n=t._private;n.compoundBoundsClean=!1,n.bbCache=null,e||t.emitAndNotify("bounds")}})),this):this},pi.updateCompoundBounds=function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=this.cy();if(!t.styleEnabled()||!t.hasCompoundNodes())return this;if(!e&&t.batching())return this;function n(e){if(e.isParent()){var t=e._private,n=e.children(),r="include"===e.pstyle("compound-sizing-wrt-labels").value,i={width:{val:e.pstyle("min-width").pfValue,left:e.pstyle("min-width-bias-left"),right:e.pstyle("min-width-bias-right")},height:{val:e.pstyle("min-height").pfValue,top:e.pstyle("min-height-bias-top"),bottom:e.pstyle("min-height-bias-bottom")}},o=n.boundingBox({includeLabels:r,includeOverlays:!1,useCache:!1}),a=t.position;0!==o.w&&0!==o.h||((o={w:e.pstyle("width").pfValue,h:e.pstyle("height").pfValue}).x1=a.x-o.w/2,o.x2=a.x+o.w/2,o.y1=a.y-o.h/2,o.y2=a.y+o.h/2);var s=i.width.left.value;"px"===i.width.left.units&&i.width.val>0&&(s=100*s/i.width.val);var l=i.width.right.value;"px"===i.width.right.units&&i.width.val>0&&(l=100*l/i.width.val);var u=i.height.top.value;"px"===i.height.top.units&&i.height.val>0&&(u=100*u/i.height.val);var c=i.height.bottom.value;"px"===i.height.bottom.units&&i.height.val>0&&(c=100*c/i.height.val);var d=m(i.width.val-o.w,s,l),f=d.biasDiff,h=d.biasComplementDiff,p=m(i.height.val-o.h,u,c),g=p.biasDiff,v=p.biasComplementDiff;t.autoPadding=function(e,t,n,r){if("%"!==n.units)return"px"===n.units?n.pfValue:0;switch(r){case"width":return e>0?n.pfValue*e:0;case"height":return t>0?n.pfValue*t:0;case"average":return e>0&&t>0?n.pfValue*(e+t)/2:0;case"min":return e>0&&t>0?e>t?n.pfValue*t:n.pfValue*e:0;case"max":return e>0&&t>0?e>t?n.pfValue*e:n.pfValue*t:0;default:return 0}}(o.w,o.h,e.pstyle("padding"),e.pstyle("padding-relative-to").value),t.autoWidth=Math.max(o.w,i.width.val),a.x=(-f+o.x1+o.x2+h)/2,t.autoHeight=Math.max(o.h,i.height.val),a.y=(-g+o.y1+o.y2+v)/2}function m(e,t,n){var r=0,i=0,o=t+n;return e>0&&o>0&&(r=t/o*e,i=n/o*e),{biasDiff:r,biasComplementDiff:i}}}for(var r=0;re.x2?r:e.x2,e.y1=ne.y2?i:e.y2,e.w=e.x2-e.x1,e.h=e.y2-e.y1)},yi=function(e,t){return null==t?e:mi(e,t.x1,t.y1,t.x2,t.y2)},bi=function(e,t,n){return Ie(e,t,n)},xi=function(e,t,n){if(!t.cy().headless()){var r,i,o=t._private,a=o.rstyle,s=a.arrowWidth/2;if("none"!==t.pstyle(n+"-arrow-shape").value){"source"===n?(r=a.srcX,i=a.srcY):"target"===n?(r=a.tgtX,i=a.tgtY):(r=a.midX,i=a.midY);var l=o.arrowBounds=o.arrowBounds||{},u=l[n]=l[n]||{};u.x1=r-s,u.y1=i-s,u.x2=r+s,u.y2=i+s,u.w=u.x2-u.x1,u.h=u.y2-u.y1,yt(u,1),mi(e,u.x1,u.y1,u.x2,u.y2)}}},_i=function(e,t,n){if(!t.cy().headless()){var r;r=n?n+"-":"";var i=t._private,o=i.rstyle;if(t.pstyle(r+"label").strValue){var a,s,l,u,c=t.pstyle("text-halign"),d=t.pstyle("text-valign"),f=bi(o,"labelWidth",n),h=bi(o,"labelHeight",n),p=bi(o,"labelX",n),g=bi(o,"labelY",n),v=t.pstyle(r+"text-margin-x").pfValue,m=t.pstyle(r+"text-margin-y").pfValue,y=t.isEdge(),b=t.pstyle(r+"text-rotation"),x=t.pstyle("text-outline-width").pfValue,_=t.pstyle("text-border-width").pfValue/2,w=t.pstyle("text-background-padding").pfValue,k=h,E=f,S=E/2,C=k/2;if(y)a=p-S,s=p+S,l=g-C,u=g+C;else{switch(c.value){case"left":a=p-E,s=p;break;case"center":a=p-S,s=p+S;break;case"right":a=p,s=p+E}switch(d.value){case"top":l=g-k,u=g;break;case"center":l=g-C,u=g+C;break;case"bottom":l=g,u=g+k}}a+=v-Math.max(x,_)-w-2,s+=v+Math.max(x,_)+w+2,l+=m-Math.max(x,_)-w-2,u+=m+Math.max(x,_)+w+2;var P=n||"main",T=i.labelBounds,O=T[P]=T[P]||{};O.x1=a,O.y1=l,O.x2=s,O.y2=u,O.w=s-a,O.h=u-l;var M=y&&"autorotate"===b.strValue,D=null!=b.pfValue&&0!==b.pfValue;if(M||D){var N=M?bi(i.rstyle,"labelAngle",n):b.pfValue,A=Math.cos(N),L=Math.sin(N),j=(a+s)/2,R=(l+u)/2;if(!y){switch(c.value){case"left":j=s;break;case"right":j=a}switch(d.value){case"top":R=u;break;case"bottom":R=l}}var I=function(e,t){return{x:(e-=j)*A-(t-=R)*L+j,y:e*L+t*A+R}},B=I(a,l),z=I(a,u),F=I(s,l),q=I(s,u);a=Math.min(B.x,z.x,F.x,q.x),s=Math.max(B.x,z.x,F.x,q.x),l=Math.min(B.y,z.y,F.y,q.y),u=Math.max(B.y,z.y,F.y,q.y)}var V=P+"Rot",U=T[V]=T[V]||{};U.x1=a,U.y1=l,U.x2=s,U.y2=u,U.w=s-a,U.h=u-l,mi(e,a,l,s,u),mi(i.labelBounds.all,a,l,s,u)}return e}},wi=function(e){var t=0,n=function(e){return(e?1:0)<(r=T[1].x)){var O=n;n=r,r=O}if(i>(o=T[1].y)){var M=i;i=o,o=M}mi(f,n-k,i-k,r+k,o+k)}}else if("bezier"===P||"unbundled-bezier"===P||"segments"===P||"taxi"===P){var D;switch(P){case"bezier":case"unbundled-bezier":D=v.bezierPts;break;case"segments":case"taxi":D=v.linePts}if(null!=D)for(var N=0;N(r=j.x)){var R=n;n=r,r=R}if((i=L.y)>(o=j.y)){var I=i;i=o,o=I}mi(f,n-=k,i-=k,r+=k,o+=k)}if(c&&t.includeEdges&&g&&(xi(f,e,"mid-source"),xi(f,e,"mid-target"),xi(f,e,"source"),xi(f,e,"target")),c&&"yes"===e.pstyle("ghost").value){var B=e.pstyle("ghost-offset-x").pfValue,z=e.pstyle("ghost-offset-y").pfValue;mi(f,f.x1+B,f.y1+z,f.x2+B,f.y2+z)}var F=h.bodyBounds=h.bodyBounds||{};xt(F,f),bt(F,m),yt(F,1),c&&(n=f.x1,r=f.x2,i=f.y1,o=f.y2,mi(f,n-w,i-w,r+w,o+w));var q=h.overlayBounds=h.overlayBounds||{};xt(q,f),bt(q,m),yt(q,1);var V=h.labelBounds=h.labelBounds||{};null!=V.all?((l=V.all).x1=1/0,l.y1=1/0,l.x2=-1/0,l.y2=-1/0,l.w=0,l.h=0):V.all=vt(),c&&t.includeLabels&&(t.includeMainLabels&&_i(f,e,null),g&&(t.includeSourceLabels&&_i(f,e,"source"),t.includeTargetLabels&&_i(f,e,"target")))}return f.x1=vi(f.x1),f.y1=vi(f.y1),f.x2=vi(f.x2),f.y2=vi(f.y2),f.w=vi(f.x2-f.x1),f.h=vi(f.y2-f.y1),f.w>0&&f.h>0&&b&&(bt(f,m),yt(f,1)),f}(e,Si),r.bbCache=n,r.bbCachePosKey=a):n=r.bbCache,!o){var c=e.isNode();n=vt(),(t.includeNodes&&c||t.includeEdges&&!c)&&(t.includeOverlays?yi(n,r.overlayBounds):yi(n,r.bodyBounds)),t.includeLabels&&(t.includeMainLabels&&(!i||t.includeSourceLabels&&t.includeTargetLabels)?yi(n,r.labelBounds.all):(t.includeMainLabels&&yi(n,r.labelBounds.mainRot),t.includeSourceLabels&&yi(n,r.labelBounds.sourceRot),t.includeTargetLabels&&yi(n,r.labelBounds.targetRot))),n.w=n.x2-n.x1,n.h=n.y2-n.y1}return n},Si={includeNodes:!0,includeEdges:!0,includeLabels:!0,includeMainLabels:!0,includeSourceLabels:!0,includeTargetLabels:!0,includeOverlays:!0,includeUnderlays:!0,useCache:!0},Ci=wi(Si),Pi=Le(Si);pi.boundingBox=function(e){var t;if(1!==this.length||null==this[0]._private.bbCache||this[0]._private.styleDirty||void 0!==e&&void 0!==e.useCache&&!0!==e.useCache){t=vt();var n=Pi(e=e||Si),r=this;if(r.cy().styleEnabled())for(var i=0;i0&&void 0!==arguments[0]?arguments[0]:Vi,t=arguments.length>1?arguments[1]:void 0,n=0;n=0;s--)a(s);return this},Wi.removeAllListeners=function(){return this.removeListener("*")},Wi.emit=Wi.trigger=function(e,t,n){var r=this.listeners,i=r.length;return this.emitting++,M(t)||(t=[t]),Ki(this,(function(e,o){null!=n&&(r=[{event:o.event,type:o.type,namespace:o.namespace,callback:n}],i=r.length);for(var a=function(n){var i=r[n];if(i.type===o.type&&(!i.namespace||i.namespace===o.namespace||".*"===i.namespace)&&e.eventMatches(e.context,i,o)){var a=[o];null!=t&&function(e,t){for(var n=0;n1&&!r){var i=this.length-1,o=this[i],a=o._private.data.id;this[i]=void 0,this[e]=o,n.set(a,{ele:o,index:e})}return this.length--,this},unmergeOne:function(e){e=e[0];var t=this._private,n=e._private.data.id,r=t.map.get(n);if(!r)return this;var i=r.index;return this.unmergeAt(i),this},unmerge:function(e){var t=this._private.cy;if(!e)return this;if(e&&T(e)){var n=e;e=t.mutableElements().filter(n)}for(var r=0;r=0;t--){e(this[t])&&this.unmergeAt(t)}return this},map:function(e,t){for(var n=[],r=this,i=0;ir&&(r=s,n=a)}return{value:r,ele:n}},min:function(e,t){for(var n,r=1/0,i=this,o=0;o=0&&i1&&void 0!==arguments[1])||arguments[1],n=this[0],r=n.cy();if(r.styleEnabled()&&n){this.cleanStyle();var i=n._private.style[e];return null!=i?i:t?r.style().getDefaultProperty(e):null}},numericStyle:function(e){var t=this[0];if(t.cy().styleEnabled()&&t){var n=t.pstyle(e);return void 0!==n.pfValue?n.pfValue:n.value}},numericStyleUnits:function(e){var t=this[0];if(t.cy().styleEnabled())return t?t.pstyle(e).units:void 0},renderedStyle:function(e){var t=this.cy();if(!t.styleEnabled())return this;var n=this[0];return n?t.style().getRenderedStyle(n,e):void 0},style:function(e,t){var n=this.cy();if(!n.styleEnabled())return this;var r=n.style();if(D(e)){var i=e;r.applyBypass(this,i,false),this.emitAndNotify("style")}else if(T(e)){if(void 0===t){var o=this[0];return o?r.getStylePropertyValue(o,e):void 0}r.applyBypass(this,e,t,false),this.emitAndNotify("style")}else if(void 0===e){var a=this[0];return a?r.getRawStyle(a):void 0}return this},removeStyle:function(e){var t=this.cy();if(!t.styleEnabled())return this;var n=t.style(),r=this;if(void 0===e)for(var i=0;i0&&t.push(c[0]),t.push(s[0])}return this.spawn(t,!0).filter(e)}),"neighborhood"),closedNeighborhood:function(e){return this.neighborhood().add(this).filter(e)},openNeighborhood:function(e){return this.neighborhood(e)}}),yo.neighbourhood=yo.neighborhood,yo.closedNeighbourhood=yo.closedNeighborhood,yo.openNeighbourhood=yo.openNeighborhood,J(yo,{source:Jr((function(e){var t,n=this[0];return n&&(t=n._private.source||n.cy().collection()),t&&e?t.filter(e):t}),"source"),target:Jr((function(e){var t,n=this[0];return n&&(t=n._private.target||n.cy().collection()),t&&e?t.filter(e):t}),"target"),sources:wo({attr:"source"}),targets:wo({attr:"target"})}),J(yo,{edgesWith:Jr(ko(),"edgesWith"),edgesTo:Jr(ko({thisIsSrc:!0}),"edgesTo")}),J(yo,{connectedEdges:Jr((function(e){for(var t=[],n=0;n0);return o},component:function(){var e=this[0];return e.cy().mutableElements().components(e)[0]}}),yo.componentsOf=yo.components;var So=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=arguments.length>3&&void 0!==arguments[3]&&arguments[3];if(void 0!==e){var i=new ze,o=!1;if(t){if(t.length>0&&D(t[0])&&!j(t[0])){o=!0;for(var a=[],s=new qe,l=0,u=t.length;l0&&void 0!==arguments[0])||arguments[0],r=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],i=this,o=i.cy(),a=o._private,s=[],l=[],u=0,c=i.length;u0){for(var R=e.length===i.length?i:new So(o,e),I=0;I0&&void 0!==arguments[0])||arguments[0],t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],n=this,r=[],i={},o=n._private.cy;function a(e){var n=i[e.id()];t&&e.removed()||n||(i[e.id()]=!0,e.isNode()?(r.push(e),function(e){for(var t=e._private.edges,n=0;n0&&(e?k.emitAndNotify("remove"):t&&k.emit("remove"));for(var E=0;E=o?function(t,r){for(var o=0;o0?i=l:r=l}while(Math.abs(o)>a&&++ud&&Math.abs(s.v)>d;);return o?function(e){return u[e*(u.length-1)|0]}:c}}(),Mo=function(e,t,n,r){var i=To(e,t,n,r);return function(e,t,n){return e+(t-e)*i(n)}},Do={linear:function(e,t,n){return e+(t-e)*n},ease:Mo(.25,.1,.25,1),"ease-in":Mo(.42,0,1,1),"ease-out":Mo(0,0,.58,1),"ease-in-out":Mo(.42,0,.58,1),"ease-in-sine":Mo(.47,0,.745,.715),"ease-out-sine":Mo(.39,.575,.565,1),"ease-in-out-sine":Mo(.445,.05,.55,.95),"ease-in-quad":Mo(.55,.085,.68,.53),"ease-out-quad":Mo(.25,.46,.45,.94),"ease-in-out-quad":Mo(.455,.03,.515,.955),"ease-in-cubic":Mo(.55,.055,.675,.19),"ease-out-cubic":Mo(.215,.61,.355,1),"ease-in-out-cubic":Mo(.645,.045,.355,1),"ease-in-quart":Mo(.895,.03,.685,.22),"ease-out-quart":Mo(.165,.84,.44,1),"ease-in-out-quart":Mo(.77,0,.175,1),"ease-in-quint":Mo(.755,.05,.855,.06),"ease-out-quint":Mo(.23,1,.32,1),"ease-in-out-quint":Mo(.86,0,.07,1),"ease-in-expo":Mo(.95,.05,.795,.035),"ease-out-expo":Mo(.19,1,.22,1),"ease-in-out-expo":Mo(1,0,0,1),"ease-in-circ":Mo(.6,.04,.98,.335),"ease-out-circ":Mo(.075,.82,.165,1),"ease-in-out-circ":Mo(.785,.135,.15,.86),spring:function(e,t,n){if(0===n)return Do.linear;var r=Oo(e,t,n);return function(e,t,n){return e+(t-e)*r(n)}},"cubic-bezier":Mo};function No(e,t,n,r,i){if(1===r)return n;if(t===n)return n;var o=i(t,n,r);return null==e||((e.roundValue||e.color)&&(o=Math.round(o)),void 0!==e.min&&(o=Math.max(o,e.min)),void 0!==e.max&&(o=Math.min(o,e.max))),o}function Ao(e,t){return null!=e.pfValue||null!=e.value?null==e.pfValue||null!=t&&"%"===t.type.units?e.value:e.pfValue:e}function Lo(e,t,n,r,i){var o=null!=i?i.type:null;n<0?n=0:n>1&&(n=1);var a=Ao(e,i),s=Ao(t,i);if(N(a)&&N(s))return No(o,a,s,n,r);if(M(a)&&M(s)){for(var l=[],u=0;u0?("spring"===d&&f.push(a.duration),a.easingImpl=Do[d].apply(null,f)):a.easingImpl=Do[d]}var h,p=a.easingImpl;if(h=0===a.duration?1:(n-l)/a.duration,a.applying&&(h=a.progress),h<0?h=0:h>1&&(h=1),null==a.delay){var g=a.startPosition,v=a.position;if(v&&i&&!e.locked()){var m={};Ro(g.x,v.x)&&(m.x=Lo(g.x,v.x,h,p)),Ro(g.y,v.y)&&(m.y=Lo(g.y,v.y,h,p)),e.position(m)}var y=a.startPan,b=a.pan,x=o.pan,_=null!=b&&r;_&&(Ro(y.x,b.x)&&(x.x=Lo(y.x,b.x,h,p)),Ro(y.y,b.y)&&(x.y=Lo(y.y,b.y,h,p)),e.emit("pan"));var w=a.startZoom,k=a.zoom,E=null!=k&&r;E&&(Ro(w,k)&&(o.zoom=gt(o.minZoom,Lo(w,k,h,p),o.maxZoom)),e.emit("zoom")),(_||E)&&e.emit("viewport");var S=a.style;if(S&&S.length>0&&i){for(var C=0;C=0;t--){(0,e[t])()}e.splice(0,e.length)},c=o.length-1;c>=0;c--){var d=o[c],f=d._private;f.stopped?(o.splice(c,1),f.hooked=!1,f.playing=!1,f.started=!1,u(f.frames)):(f.playing||f.applying)&&(f.playing&&f.applying&&(f.applying=!1),f.started||Io(0,d,e),jo(t,d,e,n),f.applying&&(f.applying=!1),u(f.frames),null!=f.step&&f.step(e),d.completed()&&(o.splice(c,1),f.hooked=!1,f.playing=!1,f.started=!1,u(f.completes)),s=!0)}return n||0!==o.length||0!==a.length||r.push(t),s}for(var o=!1,a=0;a0?t.notify("draw",n):t.notify("draw")),n.unmerge(r),t.emit("step")}var zo={animate:cr.animate(),animation:cr.animation(),animated:cr.animated(),clearQueue:cr.clearQueue(),delay:cr.delay(),delayAnimation:cr.delayAnimation(),stop:cr.stop(),addToAnimationPool:function(e){this.styleEnabled()&&this._private.aniEles.merge(e)},stopAnimationLoop:function(){this._private.animationsRunning=!1},startAnimationLoop:function(){var e=this;if(e._private.animationsRunning=!0,e.styleEnabled()){var t=e.renderer();t&&t.beforeRender?t.beforeRender((function(t,n){Bo(n,e)}),t.beforeRenderPriorities.animations):function t(){e._private.animationsRunning&&se((function(n){Bo(n,e),t()}))}()}}},Fo={qualifierCompare:function(e,t){return null==e||null==t?null==e&&null==t:e.sameText(t)},eventMatches:function(e,t,n){var r=t.qualifier;return null==r||e!==n.target&&j(n.target)&&r.matches(n.target)},addEventFields:function(e,t){t.cy=e,t.target=e},callbackContext:function(e,t,n){return null!=t.qualifier?n.target:e}},qo=function(e){return T(e)?new Yr(e):e},Vo={createEmitter:function(){var e=this._private;return e.emitter||(e.emitter=new Ui(Fo,this)),this},emitter:function(){return this._private.emitter},on:function(e,t,n){return this.emitter().on(e,qo(t),n),this},removeListener:function(e,t,n){return this.emitter().removeListener(e,qo(t),n),this},removeAllListeners:function(){return this.emitter().removeAllListeners(),this},one:function(e,t,n){return this.emitter().one(e,qo(t),n),this},once:function(e,t,n){return this.emitter().one(e,qo(t),n),this},emit:function(e,t){return this.emitter().emit(e,t),this},emitAndNotify:function(e,t){return this.emit(e),this.notify(e,t),this}};cr.eventAliasesOn(Vo);var Uo={png:function(e){return e=e||{},this._private.renderer.png(e)},jpg:function(e){var t=this._private.renderer;return(e=e||{}).bg=e.bg||"#fff",t.jpg(e)}};Uo.jpeg=Uo.jpg;var Wo={layout:function(e){var t=this;if(null!=e)if(null!=e.name){var n=e.name,r=t.extension("layout",n);if(null!=r){var i;i=T(e.eles)?t.$(e.eles):null!=e.eles?e.eles:t.$();var o=new r(J({},e,{cy:t,eles:i}));return o}Pe("No such layout `"+n+"` found. Did you forget to import it and `cytoscape.use()` it?")}else Pe("A `name` must be specified to make a layout");else Pe("Layout options must be specified to make a layout")}};Wo.createLayout=Wo.makeLayout=Wo.layout;var Zo={notify:function(e,t){var n=this._private;if(this.batching()){n.batchNotifications=n.batchNotifications||{};var r=n.batchNotifications[e]=n.batchNotifications[e]||this.collection();null!=t&&r.merge(t)}else if(n.notificationsEnabled){var i=this.renderer();!this.destroyed()&&i&&i.notify(e,t)}},notifications:function(e){var t=this._private;return void 0===e?t.notificationsEnabled:(t.notificationsEnabled=!!e,this)},noNotifications:function(e){this.notifications(!1),e(),this.notifications(!0)},batching:function(){return this._private.batchCount>0},startBatch:function(){var e=this._private;return null==e.batchCount&&(e.batchCount=0),0===e.batchCount&&(e.batchStyleEles=this.collection(),e.batchNotifications={}),e.batchCount++,this},endBatch:function(){var e=this._private;if(0===e.batchCount)return this;if(e.batchCount--,0===e.batchCount){e.batchStyleEles.updateStyle();var t=this.renderer();Object.keys(e.batchNotifications).forEach((function(n){var r=e.batchNotifications[n];r.empty()?t.notify(n):t.notify(n,r)}))}return this},batch:function(e){return this.startBatch(),e(),this.endBatch(),this},batchData:function(e){var t=this;return this.batch((function(){for(var n=Object.keys(e),r=0;r0;)t.removeChild(t.childNodes[0]);e._private.renderer=null,e.mutableElements().forEach((function(e){var t=e._private;t.rscratch={},t.rstyle={},t.animation.current=[],t.animation.queue=[]}))},onRender:function(e){return this.on("render",e)},offRender:function(e){return this.off("render",e)}};Ko.invalidateDimensions=Ko.resize;var Yo={collection:function(e,t){return T(e)?this.$(e):L(e)?e.collection():M(e)?(t||(t={}),new So(this,e,t.unique,t.removed)):new So(this)},nodes:function(e){var t=this.$((function(e){return e.isNode()}));return e?t.filter(e):t},edges:function(e){var t=this.$((function(e){return e.isEdge()}));return e?t.filter(e):t},$:function(e){var t=this._private.elements;return e?t.filter(e):t.spawnSelf()},mutableElements:function(){return this._private.elements}};Yo.elements=Yo.filter=Yo.$;var Xo={},$o="t";Xo.apply=function(e){for(var t=this,n=t._private.cy.collection(),r=0;r0;if(f||d&&h){var p=void 0;f&&h||f?p=u.properties:h&&(p=u.mappedProperties);for(var g=0;g1&&(v=1),s.color){var _=i.valueMin[0],w=i.valueMax[0],k=i.valueMin[1],E=i.valueMax[1],S=i.valueMin[2],C=i.valueMax[2],P=null==i.valueMin[3]?1:i.valueMin[3],T=null==i.valueMax[3]?1:i.valueMax[3],O=[Math.round(_+(w-_)*v),Math.round(k+(E-k)*v),Math.round(S+(C-S)*v),Math.round(P+(T-P)*v)];n={bypass:i.bypass,name:i.name,value:O,strValue:"rgb("+O[0]+", "+O[1]+", "+O[2]+")"}}else{if(!s.number)return!1;var M=i.valueMin+(i.valueMax-i.valueMin)*v;n=this.parse(i.name,M,i.bypass,f)}if(!n)return g(),!1;n.mapping=i,i=n;break;case a.data:for(var D=i.field.split("."),A=d.data,L=0;L0&&o>0){for(var s={},l=!1,u=0;u0?e.delayAnimation(a).play().promise().then(t):t()})).then((function(){return e.animation({style:s,duration:o,easing:e.pstyle("transition-timing-function").value,queue:!1}).play().promise()})).then((function(){n.removeBypasses(e,i),e.emitAndNotify("style"),r.transitioning=!1}))}else r.transitioning&&(this.removeBypasses(e,i),e.emitAndNotify("style"),r.transitioning=!1)},Xo.checkTrigger=function(e,t,n,r,i,o){var a=this.properties[t],s=i(a);null!=s&&s(n,r)&&o(a)},Xo.checkZOrderTrigger=function(e,t,n,r){var i=this;this.checkTrigger(e,t,n,r,(function(e){return e.triggersZOrder}),(function(){i._private.cy.notify("zorder",e)}))},Xo.checkBoundsTrigger=function(e,t,n,r){this.checkTrigger(e,t,n,r,(function(e){return e.triggersBounds}),(function(i){e.dirtyCompoundBoundsCache(),e.dirtyBoundingBoxCache(),!i.triggersBoundsOfParallelBeziers||("curve-style"!==t||"bezier"!==n&&"bezier"!==r)&&("display"!==t||"none"!==n&&"none"!==r)||e.parallelEdges().forEach((function(e){e.isBundledBezier()&&e.dirtyBoundingBoxCache()}))}))},Xo.checkTriggers=function(e,t,n,r){e.dirtyStyleCache(),this.checkZOrderTrigger(e,t,n,r),this.checkBoundsTrigger(e,t,n,r)};var Go={applyBypass:function(e,t,n,r){var i=[];if("*"===t||"**"===t){if(void 0!==n)for(var o=0;ot.length?o.substr(t.length):""}function s(){n=n.length>r.length?n.substr(r.length):""}for(o=o.replace(/[/][*](\s|.)+?[*][/]/g,"");;){if(o.match(/^\s*$/))break;var l=o.match(/^\s*((?:.|\s)+?)\s*\{((?:.|\s)+?)\}/);if(!l){Oe("Halting stylesheet parsing: String stylesheet contains more to parse but no selector and block found in: "+o);break}t=l[0];var u=l[1];if("core"!==u)if(new Yr(u).invalid){Oe("Skipping parsing of block: Invalid selector found in string stylesheet: "+u),a();continue}var c=l[2],d=!1;n=c;for(var f=[];;){if(n.match(/^\s*$/))break;var h=n.match(/^\s*(.+?)\s*:\s*(.+?)(?:\s*;|\s*$)/);if(!h){Oe("Skipping parsing of block: Invalid formatting of style property and value definitions found in:"+c),d=!0;break}r=h[0];var p=h[1],g=h[2];if(this.properties[p])i.parse(p,g)?(f.push({name:p,val:g}),s()):(Oe("Skipping property: Invalid property definition in: "+r),s());else Oe("Skipping property: Invalid property name in: "+r),s()}if(d){a();break}i.selector(u);for(var v=0;v=7&&"d"===t[0]&&(u=new RegExp(s.data.regex).exec(t))){if(n)return!1;var f=s.data;return{name:e,value:u,strValue:""+t,mapped:f,field:u[1],bypass:n}}if(t.length>=10&&"m"===t[0]&&(c=new RegExp(s.mapData.regex).exec(t))){if(n)return!1;if(d.multiple)return!1;var h=s.mapData;if(!d.color&&!d.number)return!1;var p=this.parse(e,c[4]);if(!p||p.mapped)return!1;var g=this.parse(e,c[5]);if(!g||g.mapped)return!1;if(p.pfValue===g.pfValue||p.strValue===g.strValue)return Oe("`"+e+": "+t+"` is not a valid mapper because the output range is zero; converting to `"+e+": "+p.strValue+"`"),this.parse(e,p.strValue);if(d.color){var v=p.value,m=g.value;if(v[0]===m[0]&&v[1]===m[1]&&v[2]===m[2]&&(v[3]===m[3]||(null==v[3]||1===v[3])&&(null==m[3]||1===m[3])))return!1}return{name:e,value:c,strValue:""+t,mapped:h,field:c[1],fieldMin:parseFloat(c[2]),fieldMax:parseFloat(c[3]),valueMin:p.value,valueMax:g.value,bypass:n}}}if(d.multiple&&"multiple"!==r){var y;if(y=l?t.split(/\s+/):M(t)?t:[t],d.evenMultiple&&y.length%2!==0)return null;for(var b=[],x=[],_=[],w="",k=!1,E=0;E0?" ":"")+S.strValue}return d.validate&&!d.validate(b,x)?null:d.singleEnum&&k?1===b.length&&T(b[0])?{name:e,value:b[0],strValue:b[0],bypass:n}:null:{name:e,value:b,pfValue:_,strValue:w,bypass:n,units:x}}var C,P,D=function(){for(var r=0;rd.max||d.strictMax&&t===d.max))return null;var I={name:e,value:t,strValue:""+t+(A||""),units:A,bypass:n};return d.unitless||"px"!==A&&"em"!==A?I.pfValue=t:I.pfValue="px"!==A&&A?this.getEmSizeInPixels()*t:t,"ms"!==A&&"s"!==A||(I.pfValue="ms"===A?t:1e3*t),"deg"!==A&&"rad"!==A||(I.pfValue="rad"===A?t:(C=t,Math.PI*C/180)),"%"===A&&(I.pfValue=t/100),I}if(d.propList){var B=[],z=""+t;if("none"===z);else{for(var F=z.split(/\s*,\s*|\s+/),q=0;q0&&l>0&&!isNaN(n.w)&&!isNaN(n.h)&&n.w>0&&n.h>0)return{zoom:a=(a=(a=Math.min((s-2*t)/n.w,(l-2*t)/n.h))>this._private.maxZoom?this._private.maxZoom:a)=n.minZoom&&(n.maxZoom=t),this},minZoom:function(e){return void 0===e?this._private.minZoom:this.zoomRange({min:e})},maxZoom:function(e){return void 0===e?this._private.maxZoom:this.zoomRange({max:e})},getZoomedViewport:function(e){var t,n,r=this._private,i=r.pan,o=r.zoom,a=!1;if(r.zoomingEnabled||(a=!0),N(e)?n=e:D(e)&&(n=e.level,null!=e.position?t=it(e.position,o,i):null!=e.renderedPosition&&(t=e.renderedPosition),null==t||r.panningEnabled||(a=!0)),n=(n=n>r.maxZoom?r.maxZoom:n)t.maxZoom||!t.zoomingEnabled?o=!0:(t.zoom=s,i.push("zoom"))}if(r&&(!o||!e.cancelOnFailedZoom)&&t.panningEnabled){var l=e.pan;N(l.x)&&(t.pan.x=l.x,a=!1),N(l.y)&&(t.pan.y=l.y,a=!1),a||i.push("pan")}return i.length>0&&(i.push("viewport"),this.emit(i.join(" ")),this.notify("viewport")),this},center:function(e){var t=this.getCenterPan(e);return t&&(this._private.pan=t,this.emit("pan viewport"),this.notify("viewport")),this},getCenterPan:function(e,t){if(this._private.panningEnabled){if(T(e)){var n=e;e=this.mutableElements().filter(n)}else L(e)||(e=this.mutableElements());if(0!==e.length){var r=e.boundingBox(),i=this.width(),o=this.height();return{x:(i-(t=void 0===t?this._private.zoom:t)*(r.x1+r.x2))/2,y:(o-t*(r.y1+r.y2))/2}}}},reset:function(){return this._private.panningEnabled&&this._private.zoomingEnabled?(this.viewport({pan:{x:0,y:0},zoom:1}),this):this},invalidateSize:function(){this._private.sizeCache=null},size:function(){var e=this._private,t=e.container;return e.sizeCache=e.sizeCache||(t?function(){var e=_.getComputedStyle(t),n=function(t){return parseFloat(e.getPropertyValue(t))};return{width:t.clientWidth-n("padding-left")-n("padding-right"),height:t.clientHeight-n("padding-top")-n("padding-bottom")}}():{width:1,height:1})},width:function(){return this.size().width},height:function(){return this.size().height},extent:function(){var e=this._private.pan,t=this._private.zoom,n=this.renderedExtent(),r={x1:(n.x1-e.x)/t,x2:(n.x2-e.x)/t,y1:(n.y1-e.y)/t,y2:(n.y2-e.y)/t};return r.w=r.x2-r.x1,r.h=r.y2-r.y1,r},renderedExtent:function(){var e=this.width(),t=this.height();return{x1:0,y1:0,x2:e,y2:t,w:e,h:t}},multiClickDebounceTime:function(e){return e?(this._private.multiClickDebounceTime=e,this):this._private.multiClickDebounceTime}};sa.centre=sa.center,sa.autolockNodes=sa.autolock,sa.autoungrabifyNodes=sa.autoungrabify;var la={data:cr.data({field:"data",bindingEvent:"data",allowBinding:!0,allowSetting:!0,settingEvent:"data",settingTriggersEvent:!0,triggerFnName:"trigger",allowGetting:!0,updateStyle:!0}),removeData:cr.removeData({field:"data",event:"data",triggerFnName:"trigger",triggerEvent:!0,updateStyle:!0}),scratch:cr.data({field:"scratch",bindingEvent:"scratch",allowBinding:!0,allowSetting:!0,settingEvent:"scratch",settingTriggersEvent:!0,triggerFnName:"trigger",allowGetting:!0,updateStyle:!0}),removeScratch:cr.removeData({field:"scratch",event:"scratch",triggerFnName:"trigger",triggerEvent:!0,updateStyle:!0})};la.attr=la.data,la.removeAttr=la.removeData;var ua=function(e){var t=this,n=(e=J({},e)).container;n&&!A(n)&&A(n[0])&&(n=n[0]);var r=n?n._cyreg:null;(r=r||{})&&r.cy&&(r.cy.destroy(),r={});var i=r.readies=r.readies||[];n&&(n._cyreg=r),r.cy=t;var o=void 0!==_&&void 0!==n&&!e.headless,a=e;a.layout=J({name:o?"grid":"null"},a.layout),a.renderer=J({name:o?"canvas":"null"},a.renderer);var s=function(e,t,n){return void 0!==t?t:void 0!==n?n:e},l=this._private={container:n,ready:!1,options:a,elements:new So(this),listeners:[],aniEles:new So(this),data:a.data||{},scratch:{},layout:null,renderer:null,destroyed:!1,notificationsEnabled:!0,minZoom:1e-50,maxZoom:1e50,zoomingEnabled:s(!0,a.zoomingEnabled),userZoomingEnabled:s(!0,a.userZoomingEnabled),panningEnabled:s(!0,a.panningEnabled),userPanningEnabled:s(!0,a.userPanningEnabled),boxSelectionEnabled:s(!0,a.boxSelectionEnabled),autolock:s(!1,a.autolock,a.autolockNodes),autoungrabify:s(!1,a.autoungrabify,a.autoungrabifyNodes),autounselectify:s(!1,a.autounselectify),styleEnabled:void 0===a.styleEnabled?o:a.styleEnabled,zoom:N(a.zoom)?a.zoom:1,pan:{x:D(a.pan)&&N(a.pan.x)?a.pan.x:0,y:D(a.pan)&&N(a.pan.y)?a.pan.y:0},animation:{current:[],queue:[]},hasCompoundNodes:!1,multiClickDebounceTime:s(250,a.multiClickDebounceTime)};this.createEmitter(),this.selectionType(a.selectionType),this.zoomRange({min:a.minZoom,max:a.maxZoom});l.styleEnabled&&t.setStyle([]);var u=J({},a,a.renderer);t.initRenderer(u);!function(e,t){if(e.some(F))return ir.all(e).then(t);t(e)}([a.style,a.elements],(function(e){var n=e[0],o=e[1];l.styleEnabled&&t.style().append(n),function(e,n,r){t.notifications(!1);var i=t.mutableElements();i.length>0&&i.remove(),null!=e&&(D(e)||M(e))&&t.add(e),t.one("layoutready",(function(e){t.notifications(!0),t.emit(e),t.one("load",n),t.emitAndNotify("load")})).one("layoutstop",(function(){t.one("done",r),t.emit("done")}));var o=J({},t._private.options.layout);o.eles=t.elements(),t.layout(o).run()}(o,(function(){t.startAnimationLoop(),l.ready=!0,O(a.ready)&&t.on("ready",a.ready);for(var e=0;e0,u=vt(n.boundingBox?n.boundingBox:{x1:0,y1:0,w:r.width(),h:r.height()});if(L(n.roots))e=n.roots;else if(M(n.roots)){for(var c=[],d=0;d0;){var D=C.shift(),N=S(D,P);if(N)D.outgoers().filter((function(e){return e.isNode()&&i.has(e)})).forEach(O);else if(null===N){Oe("Detected double maximal shift for node `"+D.id()+"`. Bailing maximal adjustment due to cycle. Use `options.maximal: true` only on DAGs.");break}}}E();var A=0;if(n.avoidOverlap)for(var j=0;j0&&m[0].length<=3?l/2:0),d=2*Math.PI/m[r].length*i;return 0===r&&1===m[0].length&&(c=1),{x:K+c*Math.cos(d),y:Y+c*Math.sin(d)}}return{x:K+(i+1-(o+1)/2)*a,y:(r+1)*s}})),this};var ga={fit:!0,padding:30,boundingBox:void 0,avoidOverlap:!0,nodeDimensionsIncludeLabels:!1,spacingFactor:void 0,radius:void 0,startAngle:1.5*Math.PI,sweep:void 0,clockwise:!0,sort:void 0,animate:!1,animationDuration:500,animationEasing:void 0,animateFilter:function(e,t){return!0},ready:void 0,stop:void 0,transform:function(e,t){return t}};function va(e){this.options=J({},ga,e)}va.prototype.run=function(){var e=this.options,t=e,n=e.cy,r=t.eles,i=void 0!==t.counterclockwise?!t.counterclockwise:t.clockwise,o=r.nodes().not(":parent");t.sort&&(o=o.sort(t.sort));for(var a,s=vt(t.boundingBox?t.boundingBox:{x1:0,y1:0,w:n.width(),h:n.height()}),l=s.x1+s.w/2,u=s.y1+s.h/2,c=(void 0===t.sweep?2*Math.PI-2*Math.PI/o.length:t.sweep)/Math.max(1,o.length-1),d=0,f=0;f1&&t.avoidOverlap){d*=1.75;var v=Math.cos(c)-Math.cos(0),m=Math.sin(c)-Math.sin(0),y=Math.sqrt(d*d/(v*v+m*m));a=Math.max(y,a)}return r.nodes().layoutPositions(this,t,(function(e,n){var r=t.startAngle+n*c*(i?1:-1),o=a*Math.cos(r),s=a*Math.sin(r);return{x:l+o,y:u+s}})),this};var ma,ya={fit:!0,padding:30,startAngle:1.5*Math.PI,sweep:void 0,clockwise:!0,equidistant:!1,minNodeSpacing:10,boundingBox:void 0,avoidOverlap:!0,nodeDimensionsIncludeLabels:!1,height:void 0,width:void 0,spacingFactor:void 0,concentric:function(e){return e.degree()},levelWidth:function(e){return e.maxDegree()/4},animate:!1,animationDuration:500,animationEasing:void 0,animateFilter:function(e,t){return!0},ready:void 0,stop:void 0,transform:function(e,t){return t}};function ba(e){this.options=J({},ya,e)}ba.prototype.run=function(){for(var e=this.options,t=e,n=void 0!==t.counterclockwise?!t.counterclockwise:t.clockwise,r=e.cy,i=t.eles,o=i.nodes().not(":parent"),a=vt(t.boundingBox?t.boundingBox:{x1:0,y1:0,w:r.width(),h:r.height()}),s=a.x1+a.w/2,l=a.y1+a.h/2,u=[],c=0,d=0;d0)Math.abs(y[0].value-x.value)>=v&&(y=[],m.push(y));y.push(x)}var _=c+t.minNodeSpacing;if(!t.avoidOverlap){var w=m.length>0&&m[0].length>1,k=(Math.min(a.w,a.h)/2-_)/(m.length+w?1:0);_=Math.min(_,k)}for(var E=0,S=0;S1&&t.avoidOverlap){var O=Math.cos(T)-Math.cos(0),M=Math.sin(T)-Math.sin(0),D=Math.sqrt(_*_/(O*O+M*M));E=Math.max(D,E)}C.r=E,E+=_}if(t.equidistant){for(var N=0,A=0,L=0;L=e.numIter)&&(Ta(r,e),r.temperature=r.temperature*e.coolingFactor,!(r.temperature=e.animationThreshold&&o(),se(t)):(Fa(r,e),s())}()}else{for(;u;)u=a(l),l++;Fa(r,e),s()}return this},_a.prototype.stop=function(){return this.stopped=!0,this.thread&&this.thread.stop(),this.emit("layoutstop"),this},_a.prototype.destroy=function(){return this.thread&&this.thread.stop(),this};var wa=function(e,t,n){for(var r=n.eles.edges(),i=n.eles.nodes(),o={isCompound:e.hasCompoundNodes(),layoutNodes:[],idToIndex:{},nodeSize:i.size(),graphSet:[],indexToGraph:[],layoutEdges:[],edgeSize:r.size(),temperature:n.initialTemp,clientWidth:e.width(),clientHeight:e.width(),boundingBox:vt(n.boundingBox?n.boundingBox:{x1:0,y1:0,w:e.width(),h:e.height()})},a=n.eles.components(),s={},l=0;l0){o.graphSet.push(x);for(l=0;lr.count?0:r.graph},Ea=function e(t,n,r,i){var o=i.graphSet[r];if(-10)var s=(u=r.nodeOverlap*a)*i/(g=Math.sqrt(i*i+o*o)),l=u*o/g;else{var u,c=Aa(e,i,o),d=Aa(t,-1*i,-1*o),f=d.x-c.x,h=d.y-c.y,p=f*f+h*h,g=Math.sqrt(p);s=(u=(e.nodeRepulsion+t.nodeRepulsion)/p)*f/g,l=u*h/g}e.isLocked||(e.offsetX-=s,e.offsetY-=l),t.isLocked||(t.offsetX+=s,t.offsetY+=l)}},Na=function(e,t,n,r){if(n>0)var i=e.maxX-t.minX;else i=t.maxX-e.minX;if(r>0)var o=e.maxY-t.minY;else o=t.maxY-e.minY;return i>=0&&o>=0?Math.sqrt(i*i+o*o):0},Aa=function(e,t,n){var r=e.positionX,i=e.positionY,o=e.height||1,a=e.width||1,s=n/t,l=o/a,u={};return 0===t&&0n?(u.x=r,u.y=i+o/2,u):0t&&-1*l<=s&&s<=l?(u.x=r-a/2,u.y=i-a*n/2/t,u):0=l)?(u.x=r+o*t/2/n,u.y=i+o/2,u):0>n&&(s<=-1*l||s>=l)?(u.x=r-o*t/2/n,u.y=i-o/2,u):u},La=function(e,t){for(var n=0;n1){var p=t.gravity*d/h,g=t.gravity*f/h;c.offsetX+=p,c.offsetY+=g}}}}},Ra=function(e,t){var n=[],r=0,i=-1;for(n.push.apply(n,e.graphSet[0]),i+=e.graphSet[0].length;r<=i;){var o=n[r++],a=e.idToIndex[o],s=e.layoutNodes[a],l=s.children;if(0n)var i={x:n*e/r,y:n*t/r};else i={x:e,y:t};return i},za=function e(t,n){var r=t.parentId;if(null!=r){var i=n.layoutNodes[n.idToIndex[r]],o=!1;return(null==i.maxX||t.maxX+i.padRight>i.maxX)&&(i.maxX=t.maxX+i.padRight,o=!0),(null==i.minX||t.minX-i.padLefti.maxY)&&(i.maxY=t.maxY+i.padBottom,o=!0),(null==i.minY||t.minY-i.padTopp&&(d+=h+t.componentSpacing,c=0,f=0,h=0)}}},qa={fit:!0,padding:30,boundingBox:void 0,avoidOverlap:!0,avoidOverlapPadding:10,nodeDimensionsIncludeLabels:!1,spacingFactor:void 0,condense:!1,rows:void 0,cols:void 0,position:function(e){},sort:void 0,animate:!1,animationDuration:500,animationEasing:void 0,animateFilter:function(e,t){return!0},ready:void 0,stop:void 0,transform:function(e,t){return t}};function Va(e){this.options=J({},qa,e)}Va.prototype.run=function(){var e=this.options,t=e,n=e.cy,r=t.eles,i=r.nodes().not(":parent");t.sort&&(i=i.sort(t.sort));var o=vt(t.boundingBox?t.boundingBox:{x1:0,y1:0,w:n.width(),h:n.height()});if(0===o.h||0===o.w)r.nodes().layoutPositions(this,t,(function(e){return{x:o.x1,y:o.y1}}));else{var a=i.size(),s=Math.sqrt(a*o.h/o.w),l=Math.round(s),u=Math.round(o.w/o.h*s),c=function(e){if(null==e)return Math.min(l,u);Math.min(l,u)==l?l=e:u=e},d=function(e){if(null==e)return Math.max(l,u);Math.max(l,u)==l?l=e:u=e},f=t.rows,h=null!=t.cols?t.cols:t.columns;if(null!=f&&null!=h)l=f,u=h;else if(null!=f&&null==h)l=f,u=Math.ceil(a/l);else if(null==f&&null!=h)u=h,l=Math.ceil(a/u);else if(u*l>a){var p=c(),g=d();(p-1)*g>=a?c(p-1):(g-1)*p>=a&&d(g-1)}else for(;u*l=a?d(m+1):c(v+1)}var y=o.w/u,b=o.h/l;if(t.condense&&(y=0,b=0),t.avoidOverlap)for(var x=0;x=u&&(D=0,M++)},A={},L=0;L(r=Tt(e,t,x[_],x[_+1],x[_+2],x[_+3])))return v(n,r),!0}else if("bezier"===o.edgeType||"multibezier"===o.edgeType||"self"===o.edgeType||"compound"===o.edgeType)for(x=o.allpts,_=0;_+5(r=Pt(e,t,x[_],x[_+1],x[_+2],x[_+3],x[_+4],x[_+5])))return v(n,r),!0;y=y||i.source,b=b||i.target;var w=a.getArrowWidth(l,c),k=[{name:"source",x:o.arrowStartX,y:o.arrowStartY,angle:o.srcArrowAngle},{name:"target",x:o.arrowEndX,y:o.arrowEndY,angle:o.tgtArrowAngle},{name:"mid-source",x:o.midX,y:o.midY,angle:o.midsrcArrowAngle},{name:"mid-target",x:o.midX,y:o.midY,angle:o.midtgtArrowAngle}];for(_=0;_0&&(m(y),m(b))}function b(e,t,n){return Ie(e,t,n)}function x(n,r){var i,o=n._private,a=p;i=r?r+"-":"",n.boundingBox();var s=o.labelBounds[r||"main"],l=n.pstyle(i+"label").value;if("yes"===n.pstyle("text-events").strValue&&l){var u=b(o.rscratch,"labelX",r),c=b(o.rscratch,"labelY",r),d=b(o.rscratch,"labelAngle",r),f=n.pstyle(i+"text-margin-x").pfValue,h=n.pstyle(i+"text-margin-y").pfValue,g=s.x1-a-f,m=s.x2+a-f,y=s.y1-a-h,x=s.y2+a-h;if(d){var _=Math.cos(d),w=Math.sin(d),k=function(e,t){return{x:(e-=u)*_-(t-=c)*w+u,y:e*w+t*_+c}},E=k(g,y),S=k(g,x),C=k(m,y),P=k(m,x),T=[E.x+f,E.y+h,C.x+f,C.y+h,P.x+f,P.y+h,S.x+f,S.y+h];if(Ot(e,t,T))return v(n),!0}else if(wt(s,e,t))return v(n),!0}}n&&(l=l.interactive);for(var _=l.length-1;_>=0;_--){var w=l[_];w.isNode()?m(w)||x(w):y(w)||x(w)||x(w,"source")||x(w,"target")}return u},getAllInBox:function(e,t,n,r){for(var i,o,a=this.getCachedZSortedEles().interactive,s=[],l=Math.min(e,n),u=Math.max(e,n),c=Math.min(t,r),d=Math.max(t,r),f=vt({x1:e=l,y1:t=c,x2:n=u,y2:r=d}),h=0;h0?Math.max(e-t,0):Math.min(e+t,0)},P=C(E,w),T=C(S,k),O=!1;"auto"===v?g=Math.abs(P)>Math.abs(T)?i:r:v===l||v===s?(g=r,O=!0):v!==o&&v!==a||(g=i,O=!0);var M,D=g===r,N=D?T:P,A=D?S:E,L=ut(A),j=!1;(O&&(y||x)||!(v===s&&A<0||v===l&&A>0||v===o&&A>0||v===a&&A<0)||(N=(L*=-1)*Math.abs(N),j=!0),y)?M=(b<0?1+b:b)*N:M=(b<0?N:0)+b*L;var R=function(e){return Math.abs(e)<_||Math.abs(e)>=Math.abs(N)},I=R(M),B=R(Math.abs(N)-Math.abs(M));if((I||B)&&!j)if(D){var z=Math.abs(A)<=d/2,F=Math.abs(E)<=f/2;if(z){var q=(u.x1+u.x2)/2,V=u.y1,U=u.y2;n.segpts=[q,V,q,U]}else if(F){var W=(u.y1+u.y2)/2,Z=u.x1,H=u.x2;n.segpts=[Z,W,H,W]}else n.segpts=[u.x1,u.y2]}else{var K=Math.abs(A)<=c/2,Y=Math.abs(S)<=h/2;if(K){var X=(u.y1+u.y2)/2,$=u.x1,G=u.x2;n.segpts=[$,X,G,X]}else if(Y){var Q=(u.x1+u.x2)/2,J=u.y1,ee=u.y2;n.segpts=[Q,J,Q,ee]}else n.segpts=[u.x2,u.y1]}else if(D){var te=u.y1+M+(p?d/2*L:0),ne=u.x1,re=u.x2;n.segpts=[ne,te,re,te]}else{var ie=u.x1+M+(p?c/2*L:0),oe=u.y1,ae=u.y2;n.segpts=[ie,oe,ie,ae]}},ns.tryToCorrectInvalidPoints=function(e,t){var n=e._private.rscratch;if("bezier"===n.edgeType){var r=t.srcPos,i=t.tgtPos,o=t.srcW,a=t.srcH,s=t.tgtW,l=t.tgtH,u=t.srcShape,c=t.tgtShape,d=!N(n.startX)||!N(n.startY),f=!N(n.arrowStartX)||!N(n.arrowStartY),h=!N(n.endX)||!N(n.endY),p=!N(n.arrowEndX)||!N(n.arrowEndY),g=3*(this.getArrowWidth(e.pstyle("width").pfValue,e.pstyle("arrow-scale").value)*this.arrowShapeWidth),v=ct({x:n.ctrlpts[0],y:n.ctrlpts[1]},{x:n.startX,y:n.startY}),m=vf.poolIndex()){var h=d;d=f,f=h}var p=s.srcPos=d.position(),g=s.tgtPos=f.position(),v=s.srcW=d.outerWidth(),m=s.srcH=d.outerHeight(),y=s.tgtW=f.outerWidth(),b=s.tgtH=f.outerHeight(),x=s.srcShape=n.nodeShapes[t.getNodeShape(d)],_=s.tgtShape=n.nodeShapes[t.getNodeShape(f)];s.dirCounts={north:0,west:0,south:0,east:0,northwest:0,southwest:0,northeast:0,southeast:0};for(var w=0;w0){var V=u,U=dt(V,at(t)),W=dt(V,at(q)),Z=U;if(W2)dt(V,{x:q[2],y:q[3]})0){var ie=c,oe=dt(ie,at(t)),ae=dt(ie,at(re)),se=oe;if(ae2)dt(ie,{x:re[2],y:re[3]})=u||y){c={cp:g,segment:m};break}}if(c)break}var b=c.cp,x=c.segment,_=(u-f)/x.length,w=x.t1-x.t0,k=s?x.t0+w*_:x.t1-w*_;k=gt(0,k,1),t=pt(b.p0,b.p1,b.p2,k),i=function(e,t,n,r){var i=gt(0,r-.001,1),o=gt(0,r+.001,1),a=pt(e,t,n,i),s=pt(e,t,n,o);return us(a,s)}(b.p0,b.p1,b.p2,k);break;case"straight":case"segments":case"haystack":for(var E,S,C,P,T=0,O=r.allpts.length,M=0;M+3=u));M+=2);var D=(u-S)/E;D=gt(0,D,1),t=function(e,t,n,r){var i=t.x-e.x,o=t.y-e.y,a=ct(e,t),s=i/a,l=o/a;return n=null==n?0:n,r=null!=r?r:n*a,{x:e.x+s*r,y:e.y+l*r}}(C,P,D),i=us(C,P)}a("labelX",n,t.x),a("labelY",n,t.y),a("labelAutoAngle",n,i)}};u("source"),u("target"),this.applyLabelDimensions(e)}},ss.applyLabelDimensions=function(e){this.applyPrefixedLabelDimensions(e),e.isEdge()&&(this.applyPrefixedLabelDimensions(e,"source"),this.applyPrefixedLabelDimensions(e,"target"))},ss.applyPrefixedLabelDimensions=function(e,t){var n=e._private,r=this.getLabelText(e,t),i=this.calculateLabelDimensions(e,r),o=e.pstyle("line-height").pfValue,a=e.pstyle("text-wrap").strValue,s=Ie(n.rscratch,"labelWrapCachedLines",t)||[],l="wrap"!==a?1:Math.max(s.length,1),u=i.height/l,c=u*o,d=i.width,f=i.height+(l-1)*(o-1)*u;Be(n.rstyle,"labelWidth",t,d),Be(n.rscratch,"labelWidth",t,d),Be(n.rstyle,"labelHeight",t,f),Be(n.rscratch,"labelHeight",t,f),Be(n.rscratch,"labelLineHeight",t,c)},ss.getLabelText=function(e,t){var n=e._private,r=t?t+"-":"",i=e.pstyle(r+"label").strValue,o=e.pstyle("text-transform").value,a=function(e,r){return r?(Be(n.rscratch,e,t,r),r):Ie(n.rscratch,e,t)};if(!i)return"";"none"==o||("uppercase"==o?i=i.toUpperCase():"lowercase"==o&&(i=i.toLowerCase()));var s=e.pstyle("text-wrap").value;if("wrap"===s){var l=a("labelKey");if(null!=l&&a("labelWrapKey")===l)return a("labelWrapCachedText");for(var u=i.split("\n"),c=e.pstyle("text-max-width").pfValue,d="anywhere"===e.pstyle("text-overflow-wrap").value,f=[],h=/[\s\u200b]+/,p=d?"":" ",g=0;gc){for(var b=v.split(h),x="",_=0;_E)break;S+=i[P],P===i.length-1&&(C=!0)}return C||(S+="\u2026"),S}return i},ss.getLabelJustification=function(e){var t=e.pstyle("text-justification").strValue,n=e.pstyle("text-halign").strValue;if("auto"!==t)return t;if(!e.isNode())return"center";switch(n){case"left":return"right";case"right":return"left";default:return"center"}},ss.calculateLabelDimensions=function(e,t){var n=ve(t,e._private.labelDimsKey),r=this.labelDimCache||(this.labelDimCache=[]),i=r[n];if(null!=i)return i;var o=e.pstyle("font-style").strValue,a=e.pstyle("font-size").pfValue,s=e.pstyle("font-family").strValue,l=e.pstyle("font-weight").strValue,u=this.labelCalcCanvas,c=this.labelCalcCanvasContext;if(!u){u=this.labelCalcCanvas=document.createElement("canvas"),c=this.labelCalcCanvasContext=u.getContext("2d");var d=u.style;d.position="absolute",d.left="-9999px",d.top="-9999px",d.zIndex="-1",d.visibility="hidden",d.pointerEvents="none"}c.font="".concat(o," ").concat(l," ").concat(a,"px ").concat(s);for(var f=0,h=0,p=t.split("\n"),g=0;g1&&void 0!==arguments[1])||arguments[1];if(t.merge(e),n)for(var r=0;r=e.desktopTapThreshold2}var C=r(t);v&&(e.hoverData.tapholdCancelled=!0);o=!0,n(g,["mousemove","vmousemove","tapdrag"],t,{x:c[0],y:c[1]});var P=function(){e.data.bgActivePosistion=void 0,e.hoverData.selecting||a.emit({originalEvent:t,type:"boxstart",position:{x:c[0],y:c[1]}}),p[4]=1,e.hoverData.selecting=!0,e.redrawHint("select",!0),e.redraw()};if(3===e.hoverData.which){if(v){var T={originalEvent:t,type:"cxtdrag",position:{x:c[0],y:c[1]}};y?y.emit(T):a.emit(T),e.hoverData.cxtDragged=!0,e.hoverData.cxtOver&&g===e.hoverData.cxtOver||(e.hoverData.cxtOver&&e.hoverData.cxtOver.emit({originalEvent:t,type:"cxtdragout",position:{x:c[0],y:c[1]}}),e.hoverData.cxtOver=g,g&&g.emit({originalEvent:t,type:"cxtdragover",position:{x:c[0],y:c[1]}}))}}else if(e.hoverData.dragging){if(o=!0,a.panningEnabled()&&a.userPanningEnabled()){var O;if(e.hoverData.justStartedPan){var M=e.hoverData.mdownPos;O={x:(c[0]-M[0])*s,y:(c[1]-M[1])*s},e.hoverData.justStartedPan=!1}else O={x:b[0]*s,y:b[1]*s};a.panBy(O),a.emit("dragpan"),e.hoverData.dragged=!0}c=e.projectIntoViewport(t.clientX,t.clientY)}else if(1!=p[4]||null!=y&&!y.pannable()){if(y&&y.pannable()&&y.active()&&y.unactivate(),y&&y.grabbed()||g==m||(m&&n(m,["mouseout","tapdragout"],t,{x:c[0],y:c[1]}),g&&n(g,["mouseover","tapdragover"],t,{x:c[0],y:c[1]}),e.hoverData.last=g),y)if(v){if(a.boxSelectionEnabled()&&C)y&&y.grabbed()&&(d(x),y.emit("freeon"),x.emit("free"),e.dragData.didDrag&&(y.emit("dragfreeon"),x.emit("dragfree"))),P();else if(y&&y.grabbed()&&e.nodeIsDraggable(y)){var D=!e.dragData.didDrag;D&&e.redrawHint("eles",!0),e.dragData.didDrag=!0,e.hoverData.draggingEles||l(x,{inDragLayer:!0});var A={x:0,y:0};if(N(b[0])&&N(b[1])&&(A.x+=b[0],A.y+=b[1],D)){var L=e.hoverData.dragDelta;L&&N(L[0])&&N(L[1])&&(A.x+=L[0],A.y+=L[1])}e.hoverData.draggingEles=!0,x.silentShift(A).emit("position drag"),e.redrawHint("drag",!0),e.redraw()}}else!function(){var t=e.hoverData.dragDelta=e.hoverData.dragDelta||[];0===t.length?(t.push(b[0]),t.push(b[1])):(t[0]+=b[0],t[1]+=b[1])}();o=!0}else if(v){if(e.hoverData.dragging||!a.boxSelectionEnabled()||!C&&a.panningEnabled()&&a.userPanningEnabled()){if(!e.hoverData.selecting&&a.panningEnabled()&&a.userPanningEnabled()){i(y,e.hoverData.downs)&&(e.hoverData.dragging=!0,e.hoverData.justStartedPan=!0,p[4]=0,e.data.bgActivePosistion=at(f),e.redrawHint("select",!0),e.redraw())}}else P();y&&y.pannable()&&y.active()&&y.unactivate()}return p[2]=c[0],p[3]=c[1],o?(t.stopPropagation&&t.stopPropagation(),t.preventDefault&&t.preventDefault(),!1):void 0}}),!1),e.registerBinding(window,"mouseup",(function(i){if(e.hoverData.capture){e.hoverData.capture=!1;var o=e.cy,a=e.projectIntoViewport(i.clientX,i.clientY),s=e.selection,l=e.findNearestElement(a[0],a[1],!0,!1),u=e.dragData.possibleDragElements,c=e.hoverData.down,f=r(i);if(e.data.bgActivePosistion&&(e.redrawHint("select",!0),e.redraw()),e.hoverData.tapholdCancelled=!0,e.data.bgActivePosistion=void 0,c&&c.unactivate(),3===e.hoverData.which){var h={originalEvent:i,type:"cxttapend",position:{x:a[0],y:a[1]}};if(c?c.emit(h):o.emit(h),!e.hoverData.cxtDragged){var p={originalEvent:i,type:"cxttap",position:{x:a[0],y:a[1]}};c?c.emit(p):o.emit(p)}e.hoverData.cxtDragged=!1,e.hoverData.which=null}else if(1===e.hoverData.which){if(n(l,["mouseup","tapend","vmouseup"],i,{x:a[0],y:a[1]}),e.dragData.didDrag||e.hoverData.dragged||e.hoverData.selecting||e.hoverData.isOverThresholdDrag||(n(c,["click","tap","vclick"],i,{x:a[0],y:a[1]}),b=!1,i.timeStamp-x<=o.multiClickDebounceTime()?(y&&clearTimeout(y),b=!0,x=null,n(c,["dblclick","dbltap","vdblclick"],i,{x:a[0],y:a[1]})):(y=setTimeout((function(){b||n(c,["oneclick","onetap","voneclick"],i,{x:a[0],y:a[1]})}),o.multiClickDebounceTime()),x=i.timeStamp)),null!=c||e.dragData.didDrag||e.hoverData.selecting||e.hoverData.dragged||r(i)||(o.$(t).unselect(["tapunselect"]),u.length>0&&e.redrawHint("eles",!0),e.dragData.possibleDragElements=u=o.collection()),l!=c||e.dragData.didDrag||e.hoverData.selecting||null!=l&&l._private.selectable&&(e.hoverData.dragging||("additive"===o.selectionType()||f?l.selected()?l.unselect(["tapunselect"]):l.select(["tapselect"]):f||(o.$(t).unmerge(l).unselect(["tapunselect"]),l.select(["tapselect"]))),e.redrawHint("eles",!0)),e.hoverData.selecting){var g=o.collection(e.getAllInBox(s[0],s[1],s[2],s[3]));e.redrawHint("select",!0),g.length>0&&e.redrawHint("eles",!0),o.emit({type:"boxend",originalEvent:i,position:{x:a[0],y:a[1]}});var v=function(e){return e.selectable()&&!e.selected()};"additive"===o.selectionType()||f||o.$(t).unmerge(g).unselect(),g.emit("box").stdFilter(v).select().emit("boxselect"),e.redraw()}if(e.hoverData.dragging&&(e.hoverData.dragging=!1,e.redrawHint("select",!0),e.redrawHint("eles",!0),e.redraw()),!s[4]){e.redrawHint("drag",!0),e.redrawHint("eles",!0);var m=c&&c.grabbed();d(u),m&&(c.emit("freeon"),u.emit("free"),e.dragData.didDrag&&(c.emit("dragfreeon"),u.emit("dragfree")))}}s[4]=0,e.hoverData.down=null,e.hoverData.cxtStarted=!1,e.hoverData.draggingEles=!1,e.hoverData.selecting=!1,e.hoverData.isOverThresholdDrag=!1,e.dragData.didDrag=!1,e.hoverData.dragged=!1,e.hoverData.dragDelta=[],e.hoverData.mdownPos=null,e.hoverData.mdownGPos=null}}),!1);var w,k,E,S,C,P,T,O,M,D,A,L,j,R=function(t){if(!e.scrollingPage){var n=e.cy,r=n.zoom(),i=n.pan(),o=e.projectIntoViewport(t.clientX,t.clientY),a=[o[0]*r+i.x,o[1]*r+i.y];if(e.hoverData.draggingEles||e.hoverData.dragging||e.hoverData.cxtStarted||0!==e.selection[4])t.preventDefault();else if(n.panningEnabled()&&n.userPanningEnabled()&&n.zoomingEnabled()&&n.userZoomingEnabled()){var s;t.preventDefault(),e.data.wheelZooming=!0,clearTimeout(e.data.wheelTimeout),e.data.wheelTimeout=setTimeout((function(){e.data.wheelZooming=!1,e.redrawHint("eles",!0),e.redraw()}),150),s=null!=t.deltaY?t.deltaY/-250:null!=t.wheelDeltaY?t.wheelDeltaY/1e3:t.wheelDelta/1e3,s*=e.wheelSensitivity,1===t.deltaMode&&(s*=33);var l=n.zoom()*Math.pow(10,s);"gesturechange"===t.type&&(l=e.gestureStartZoom*t.scale),n.zoom({level:l,renderedPosition:{x:a[0],y:a[1]}}),n.emit("gesturechange"===t.type?"pinchzoom":"scrollzoom")}}};e.registerBinding(e.container,"wheel",R,!0),e.registerBinding(window,"scroll",(function(t){e.scrollingPage=!0,clearTimeout(e.scrollingPageTimeout),e.scrollingPageTimeout=setTimeout((function(){e.scrollingPage=!1}),250)}),!0),e.registerBinding(e.container,"gesturestart",(function(t){e.gestureStartZoom=e.cy.zoom(),e.hasTouchStarted||t.preventDefault()}),!0),e.registerBinding(e.container,"gesturechange",(function(t){e.hasTouchStarted||R(t)}),!0),e.registerBinding(e.container,"mouseout",(function(t){var n=e.projectIntoViewport(t.clientX,t.clientY);e.cy.emit({originalEvent:t,type:"mouseout",position:{x:n[0],y:n[1]}})}),!1),e.registerBinding(e.container,"mouseover",(function(t){var n=e.projectIntoViewport(t.clientX,t.clientY);e.cy.emit({originalEvent:t,type:"mouseover",position:{x:n[0],y:n[1]}})}),!1);var I,B,z,F,q,V,U,W=function(e,t,n,r){return Math.sqrt((n-e)*(n-e)+(r-t)*(r-t))},Z=function(e,t,n,r){return(n-e)*(n-e)+(r-t)*(r-t)};if(e.registerBinding(e.container,"touchstart",I=function(t){if(e.hasTouchStarted=!0,_(t)){h(),e.touchData.capture=!0,e.data.bgActivePosistion=void 0;var r=e.cy,i=e.touchData.now,o=e.touchData.earlier;if(t.touches[0]){var s=e.projectIntoViewport(t.touches[0].clientX,t.touches[0].clientY);i[0]=s[0],i[1]=s[1]}if(t.touches[1]){s=e.projectIntoViewport(t.touches[1].clientX,t.touches[1].clientY);i[2]=s[0],i[3]=s[1]}if(t.touches[2]){s=e.projectIntoViewport(t.touches[2].clientX,t.touches[2].clientY);i[4]=s[0],i[5]=s[1]}if(t.touches[1]){e.touchData.singleTouchMoved=!0,d(e.dragData.touchDragEles);var u=e.findContainerClientCoords();M=u[0],D=u[1],A=u[2],L=u[3],w=t.touches[0].clientX-M,k=t.touches[0].clientY-D,E=t.touches[1].clientX-M,S=t.touches[1].clientY-D,j=0<=w&&w<=A&&0<=E&&E<=A&&0<=k&&k<=L&&0<=S&&S<=L;var f=r.pan(),p=r.zoom();C=W(w,k,E,S),P=Z(w,k,E,S),O=[((T=[(w+E)/2,(k+S)/2])[0]-f.x)/p,(T[1]-f.y)/p];if(P<4e4&&!t.touches[2]){var g=e.findNearestElement(i[0],i[1],!0,!0),v=e.findNearestElement(i[2],i[3],!0,!0);return g&&g.isNode()?(g.activate().emit({originalEvent:t,type:"cxttapstart",position:{x:i[0],y:i[1]}}),e.touchData.start=g):v&&v.isNode()?(v.activate().emit({originalEvent:t,type:"cxttapstart",position:{x:i[0],y:i[1]}}),e.touchData.start=v):r.emit({originalEvent:t,type:"cxttapstart",position:{x:i[0],y:i[1]}}),e.touchData.start&&(e.touchData.start._private.grabbed=!1),e.touchData.cxt=!0,e.touchData.cxtDragged=!1,e.data.bgActivePosistion=void 0,void e.redraw()}}if(t.touches[2])r.boxSelectionEnabled()&&t.preventDefault();else if(t.touches[1]);else if(t.touches[0]){var m=e.findNearestElements(i[0],i[1],!0,!0),y=m[0];if(null!=y&&(y.activate(),e.touchData.start=y,e.touchData.starts=m,e.nodeIsGrabbable(y))){var b=e.dragData.touchDragEles=r.collection(),x=null;e.redrawHint("eles",!0),e.redrawHint("drag",!0),y.selected()?(x=r.$((function(t){return t.selected()&&e.nodeIsGrabbable(t)})),l(x,{addToList:b})):c(y,{addToList:b}),a(y);var N=function(e){return{originalEvent:t,type:e,position:{x:i[0],y:i[1]}}};y.emit(N("grabon")),x?x.forEach((function(e){e.emit(N("grab"))})):y.emit(N("grab"))}n(y,["touchstart","tapstart","vmousedown"],t,{x:i[0],y:i[1]}),null==y&&(e.data.bgActivePosistion={x:s[0],y:s[1]},e.redrawHint("select",!0),e.redraw()),e.touchData.singleTouchMoved=!1,e.touchData.singleTouchStartTime=+new Date,clearTimeout(e.touchData.tapholdTimeout),e.touchData.tapholdTimeout=setTimeout((function(){!1!==e.touchData.singleTouchMoved||e.pinching||e.touchData.selecting||n(e.touchData.start,["taphold"],t,{x:i[0],y:i[1]})}),e.tapholdDuration)}if(t.touches.length>=1){for(var R=e.touchData.startPosition=[],I=0;I=e.touchTapThreshold2}if(r&&e.touchData.cxt){t.preventDefault();var x=t.touches[0].clientX-M,T=t.touches[0].clientY-D,A=t.touches[1].clientX-M,L=t.touches[1].clientY-D,R=Z(x,T,A,L);if(R/P>=2.25||R>=22500){e.touchData.cxt=!1,e.data.bgActivePosistion=void 0,e.redrawHint("select",!0);var I={originalEvent:t,type:"cxttapend",position:{x:s[0],y:s[1]}};e.touchData.start?(e.touchData.start.unactivate().emit(I),e.touchData.start=null):a.emit(I)}}if(r&&e.touchData.cxt){I={originalEvent:t,type:"cxtdrag",position:{x:s[0],y:s[1]}};e.data.bgActivePosistion=void 0,e.redrawHint("select",!0),e.touchData.start?e.touchData.start.emit(I):a.emit(I),e.touchData.start&&(e.touchData.start._private.grabbed=!1),e.touchData.cxtDragged=!0;var B=e.findNearestElement(s[0],s[1],!0,!0);e.touchData.cxtOver&&B===e.touchData.cxtOver||(e.touchData.cxtOver&&e.touchData.cxtOver.emit({originalEvent:t,type:"cxtdragout",position:{x:s[0],y:s[1]}}),e.touchData.cxtOver=B,B&&B.emit({originalEvent:t,type:"cxtdragover",position:{x:s[0],y:s[1]}}))}else if(r&&t.touches[2]&&a.boxSelectionEnabled())t.preventDefault(),e.data.bgActivePosistion=void 0,this.lastThreeTouch=+new Date,e.touchData.selecting||a.emit({originalEvent:t,type:"boxstart",position:{x:s[0],y:s[1]}}),e.touchData.selecting=!0,e.touchData.didSelect=!0,o[4]=1,o&&0!==o.length&&void 0!==o[0]?(o[2]=(s[0]+s[2]+s[4])/3,o[3]=(s[1]+s[3]+s[5])/3):(o[0]=(s[0]+s[2]+s[4])/3,o[1]=(s[1]+s[3]+s[5])/3,o[2]=(s[0]+s[2]+s[4])/3+1,o[3]=(s[1]+s[3]+s[5])/3+1),e.redrawHint("select",!0),e.redraw();else if(r&&t.touches[1]&&!e.touchData.didSelect&&a.zoomingEnabled()&&a.panningEnabled()&&a.userZoomingEnabled()&&a.userPanningEnabled()){if(t.preventDefault(),e.data.bgActivePosistion=void 0,e.redrawHint("select",!0),ee=e.dragData.touchDragEles){e.redrawHint("drag",!0);for(var z=0;z0&&!e.hoverData.draggingEles&&!e.swipePanning&&null!=e.data.bgActivePosistion&&(e.data.bgActivePosistion=void 0,e.redrawHint("select",!0),e.redraw())}},!1),e.registerBinding(window,"touchcancel",z=function(t){var n=e.touchData.start;e.touchData.capture=!1,n&&n.unactivate()}),e.registerBinding(window,"touchend",F=function(r){var i=e.touchData.start;if(e.touchData.capture){0===r.touches.length&&(e.touchData.capture=!1),r.preventDefault();var o=e.selection;e.swipePanning=!1,e.hoverData.draggingEles=!1;var a,s=e.cy,l=s.zoom(),u=e.touchData.now,c=e.touchData.earlier;if(r.touches[0]){var f=e.projectIntoViewport(r.touches[0].clientX,r.touches[0].clientY);u[0]=f[0],u[1]=f[1]}if(r.touches[1]){f=e.projectIntoViewport(r.touches[1].clientX,r.touches[1].clientY);u[2]=f[0],u[3]=f[1]}if(r.touches[2]){f=e.projectIntoViewport(r.touches[2].clientX,r.touches[2].clientY);u[4]=f[0],u[5]=f[1]}if(i&&i.unactivate(),e.touchData.cxt){if(a={originalEvent:r,type:"cxttapend",position:{x:u[0],y:u[1]}},i?i.emit(a):s.emit(a),!e.touchData.cxtDragged){var h={originalEvent:r,type:"cxttap",position:{x:u[0],y:u[1]}};i?i.emit(h):s.emit(h)}return e.touchData.start&&(e.touchData.start._private.grabbed=!1),e.touchData.cxt=!1,e.touchData.start=null,void e.redraw()}if(!r.touches[2]&&s.boxSelectionEnabled()&&e.touchData.selecting){e.touchData.selecting=!1;var p=s.collection(e.getAllInBox(o[0],o[1],o[2],o[3]));o[0]=void 0,o[1]=void 0,o[2]=void 0,o[3]=void 0,o[4]=0,e.redrawHint("select",!0),s.emit({type:"boxend",originalEvent:r,position:{x:u[0],y:u[1]}});p.emit("box").stdFilter((function(e){return e.selectable()&&!e.selected()})).select().emit("boxselect"),p.nonempty()&&e.redrawHint("eles",!0),e.redraw()}if(null!=i&&i.unactivate(),r.touches[2])e.data.bgActivePosistion=void 0,e.redrawHint("select",!0);else if(r.touches[1]);else if(r.touches[0]);else if(!r.touches[0]){e.data.bgActivePosistion=void 0,e.redrawHint("select",!0);var g=e.dragData.touchDragEles;if(null!=i){var v=i._private.grabbed;d(g),e.redrawHint("drag",!0),e.redrawHint("eles",!0),v&&(i.emit("freeon"),g.emit("free"),e.dragData.didDrag&&(i.emit("dragfreeon"),g.emit("dragfree"))),n(i,["touchend","tapend","vmouseup","tapdragout"],r,{x:u[0],y:u[1]}),i.unactivate(),e.touchData.start=null}else{var m=e.findNearestElement(u[0],u[1],!0,!0);n(m,["touchend","tapend","vmouseup","tapdragout"],r,{x:u[0],y:u[1]})}var y=e.touchData.startPosition[0]-u[0],b=y*y,x=e.touchData.startPosition[1]-u[1],_=(b+x*x)*l*l;e.touchData.singleTouchMoved||(i||s.$(":selected").unselect(["tapunselect"]),n(i,["tap","vclick"],r,{x:u[0],y:u[1]}),q=!1,r.timeStamp-U<=s.multiClickDebounceTime()?(V&&clearTimeout(V),q=!0,U=null,n(i,["dbltap","vdblclick"],r,{x:u[0],y:u[1]})):(V=setTimeout((function(){q||n(i,["onetap","voneclick"],r,{x:u[0],y:u[1]})}),s.multiClickDebounceTime()),U=r.timeStamp)),null!=i&&!e.dragData.didDrag&&i._private.selectable&&_2){for(var T=[u[0],u[1]],O=Math.pow(T[0]-e,2)+Math.pow(T[1]-t,2),M=1;M0)return g[0]}return null},f=Object.keys(c),h=0;h0?l:Et(i,o,e,t,n,r,a)},checkPoint:function(e,t,n,r,i,o,a){var s=Vt(r,i),l=2*s;if(Mt(e,t,this.points,o,a,r,i-l,[0,-1],n))return!0;if(Mt(e,t,this.points,o,a,r-l,i,[0,-1],n))return!0;var u=r/2+2*n,c=i/2+2*n;return!!Ot(e,t,[o-u,a-c,o-u,a,o+u,a,o+u,a-c])||(!!At(e,t,l,l,o+r/2-s,a+i/2-s,n)||!!At(e,t,l,l,o-r/2+s,a+i/2-s,n))}}},ms.registerNodeShapes=function(){var e=this.nodeShapes={},t=this;this.generateEllipse(),this.generatePolygon("triangle",zt(3,0)),this.generateRoundPolygon("round-triangle",zt(3,0)),this.generatePolygon("rectangle",zt(4,0)),e.square=e.rectangle,this.generateRoundRectangle(),this.generateCutRectangle(),this.generateBarrel(),this.generateBottomRoundrectangle();var n=[0,1,1,0,0,-1,-1,0];this.generatePolygon("diamond",n),this.generateRoundPolygon("round-diamond",n),this.generatePolygon("pentagon",zt(5,0)),this.generateRoundPolygon("round-pentagon",zt(5,0)),this.generatePolygon("hexagon",zt(6,0)),this.generateRoundPolygon("round-hexagon",zt(6,0)),this.generatePolygon("heptagon",zt(7,0)),this.generateRoundPolygon("round-heptagon",zt(7,0)),this.generatePolygon("octagon",zt(8,0)),this.generateRoundPolygon("round-octagon",zt(8,0));var r=new Array(20),i=qt(5,0),o=qt(5,Math.PI/5),a=.5*(3-Math.sqrt(5));a*=1.57;for(var s=0;s=e.deqFastCost*g)break}else if(i){if(h>=e.deqCost*l||h>=e.deqAvgCost*s)break}else if(p>=e.deqNoDrawCost*ws)break;var v=e.deq(t,d,c);if(!(v.length>0))break;for(var m=0;m0&&(e.onDeqd(t,u),!i&&e.shouldRedraw(t,u,d,c)&&r())}),i(t))}}},Es=function(){function e(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Ee;g(this,e),this.idsByKey=new ze,this.keyForId=new ze,this.cachesByLvl=new ze,this.lvls=[],this.getKey=t,this.doesEleInvalidateKey=n}return m(e,[{key:"getIdsFor",value:function(e){null==e&&Pe("Can not get id list for null key");var t=this.idsByKey,n=this.idsByKey.get(e);return n||(n=new qe,t.set(e,n)),n}},{key:"addIdForKey",value:function(e,t){null!=e&&this.getIdsFor(e).add(t)}},{key:"deleteIdForKey",value:function(e,t){null!=e&&this.getIdsFor(e).delete(t)}},{key:"getNumberOfIdsForKey",value:function(e){return null==e?0:this.getIdsFor(e).size}},{key:"updateKeyMappingFor",value:function(e){var t=e.id(),n=this.keyForId.get(t),r=this.getKey(e);this.deleteIdForKey(n,t),this.addIdForKey(r,t),this.keyForId.set(t,r)}},{key:"deleteKeyMappingFor",value:function(e){var t=e.id(),n=this.keyForId.get(t);this.deleteIdForKey(n,t),this.keyForId.delete(t)}},{key:"keyHasChangedFor",value:function(e){var t=e.id();return this.keyForId.get(t)!==this.getKey(e)}},{key:"isInvalid",value:function(e){return this.keyHasChangedFor(e)||this.doesEleInvalidateKey(e)}},{key:"getCachesAt",value:function(e){var t=this.cachesByLvl,n=this.lvls,r=t.get(e);return r||(r=new ze,t.set(e,r),n.push(e)),r}},{key:"getCache",value:function(e,t){return this.getCachesAt(t).get(e)}},{key:"get",value:function(e,t){var n=this.getKey(e),r=this.getCache(n,t);return null!=r&&this.updateKeyMappingFor(e),r}},{key:"getForCachedKey",value:function(e,t){var n=this.keyForId.get(e.id());return this.getCache(n,t)}},{key:"hasCache",value:function(e,t){return this.getCachesAt(t).has(e)}},{key:"has",value:function(e,t){var n=this.getKey(e);return this.hasCache(n,t)}},{key:"setCache",value:function(e,t,n){n.key=e,this.getCachesAt(t).set(e,n)}},{key:"set",value:function(e,t,n){var r=this.getKey(e);this.setCache(r,t,n),this.updateKeyMappingFor(e)}},{key:"deleteCache",value:function(e,t){this.getCachesAt(t).delete(e)}},{key:"delete",value:function(e,t){var n=this.getKey(e);this.deleteCache(n,t)}},{key:"invalidateKey",value:function(e){var t=this;this.lvls.forEach((function(n){return t.deleteCache(e,n)}))}},{key:"invalidate",value:function(e){var t=e.id(),n=this.keyForId.get(t);this.deleteKeyMappingFor(e);var r=this.doesEleInvalidateKey(e);return r&&this.invalidateKey(n),r||0===this.getNumberOfIdsForKey(n)}}]),e}(),Ss={dequeue:"dequeue",downscale:"downscale",highQuality:"highQuality"},Cs=Le({getKey:null,doesEleInvalidateKey:Ee,drawElement:null,getBoundingBox:null,getRotationPoint:null,getRotationOffset:null,isVisible:ke,allowEdgeTxrCaching:!0,allowParentTxrCaching:!0}),Ps=function(e,t){var n=this;n.renderer=e,n.onDequeues=[];var r=Cs(t);J(n,r),n.lookup=new Es(r.getKey,r.doesEleInvalidateKey),n.setupDequeueing()},Ts=Ps.prototype;Ts.reasons=Ss,Ts.getTextureQueue=function(e){var t=this;return t.eleImgCaches=t.eleImgCaches||{},t.eleImgCaches[e]=t.eleImgCaches[e]||[]},Ts.getRetiredTextureQueue=function(e){var t=this.eleImgCaches.retired=this.eleImgCaches.retired||{};return t[e]=t[e]||[]},Ts.getElementQueue=function(){return this.eleCacheQueue=this.eleCacheQueue||new c.default((function(e,t){return t.reqs-e.reqs}))},Ts.getElementKeyToQueue=function(){return this.eleKeyToCacheQueue=this.eleKeyToCacheQueue||{}},Ts.getElement=function(e,t,n,r,i){var o=this,a=this.renderer,s=a.cy.zoom(),l=this.lookup;if(!t||0===t.w||0===t.h||isNaN(t.w)||isNaN(t.h)||!e.visible()||e.removed())return null;if(!o.allowEdgeTxrCaching&&e.isEdge()||!o.allowParentTxrCaching&&e.isParent())return null;if(null==r&&(r=Math.ceil(lt(s*n))),r<-4)r=-4;else if(s>=7.99||r>3)return null;var u=Math.pow(2,r),c=t.h*u,d=t.w*u,f=a.eleTextBiggerThanMin(e,u);if(!this.isVisible(e,f))return null;var h,p=l.get(e,r);if(p&&p.invalidated&&(p.invalidated=!1,p.texture.invalidatedWidth-=p.width),p)return p;if(h=c<=25?25:c<=50?50:50*Math.ceil(c/50),c>1024||d>1024)return null;var g=o.getTextureQueue(h),v=g[g.length-2],m=function(){return o.recycleTexture(h,d)||o.addTexture(h,d)};v||(v=g[g.length-1]),v||(v=m()),v.width-v.usedWidthr;P--)S=o.getElement(e,t,n,P,Ss.downscale);C()}else{var T;if(!x&&!_&&!w)for(var O=r-1;O>=-4;O--){var M=l.get(e,O);if(M){T=M;break}}if(b(T))return o.queueElement(e,r),T;v.context.translate(v.usedWidth,0),v.context.scale(u,u),this.drawElement(v.context,e,t,f,!1),v.context.scale(1/u,1/u),v.context.translate(-v.usedWidth,0)}return p={x:v.usedWidth,texture:v,level:r,scale:u,width:d,height:c,scaledLabelShown:f},v.usedWidth+=Math.ceil(d+8),v.eleCaches.push(p),l.set(e,r,p),o.checkTextureFullness(v),p},Ts.invalidateElements=function(e){for(var t=0;t=.2*e.width&&this.retireTexture(e)},Ts.checkTextureFullness=function(e){var t=this.getTextureQueue(e.height);e.usedWidth/e.width>.8&&e.fullnessChecks>=10?je(t,e):e.fullnessChecks++},Ts.retireTexture=function(e){var t=e.height,n=this.getTextureQueue(t),r=this.lookup;je(n,e),e.retired=!0;for(var i=e.eleCaches,o=0;o=t)return o.retired=!1,o.usedWidth=0,o.invalidatedWidth=0,o.fullnessChecks=0,Re(o.eleCaches),o.context.setTransform(1,0,0,1,0,0),o.context.clearRect(0,0,o.width,o.height),je(r,o),n.push(o),o}},Ts.queueElement=function(e,t){var n=this.getElementQueue(),r=this.getElementKeyToQueue(),i=this.getKey(e),o=r[i];if(o)o.level=Math.max(o.level,t),o.eles.merge(e),o.reqs++,n.updateItem(o);else{var a={eles:e.spawn().merge(e),level:t,reqs:1,key:i};n.push(a),r[i]=a}},Ts.dequeue=function(e){for(var t=this,n=t.getElementQueue(),r=t.getElementKeyToQueue(),i=[],o=t.lookup,a=0;a<1&&n.size()>0;a++){var s=n.pop(),l=s.key,u=s.eles[0],c=o.hasCache(u,s.level);if(r[l]=null,!c){i.push(s);var d=t.getBoundingBox(u);t.getElement(u,d,e,s.level,Ss.dequeue)}}return i},Ts.removeFromQueue=function(e){var t=this.getElementQueue(),n=this.getElementKeyToQueue(),r=this.getKey(e),i=n[r];null!=i&&(1===i.eles.length?(i.reqs=we,t.updateItem(i),t.pop(),n[r]=null):i.eles.unmerge(e))},Ts.onDequeue=function(e){this.onDequeues.push(e)},Ts.offDequeue=function(e){je(this.onDequeues,e)},Ts.setupDequeueing=ks({deqRedrawThreshold:100,deqCost:.15,deqAvgCost:.1,deqNoDrawCost:.9,deqFastCost:.9,deq:function(e,t,n){return e.dequeue(t,n)},onDeqd:function(e,t){for(var n=0;n=3.99||n>2)return null;r.validateLayersElesOrdering(n,e);var a,s,l=r.layersByLevel,u=Math.pow(2,n),c=l[n]=l[n]||[];if(r.levelIsComplete(n,e))return c;!function(){var t=function(t){if(r.validateLayersElesOrdering(t,e),r.levelIsComplete(t,e))return s=l[t],!0},i=function(e){if(!s)for(var r=n+e;-4<=r&&r<=2&&!t(r);r+=e);};i(1),i(-1);for(var o=c.length-1;o>=0;o--){var a=c[o];a.invalid&&je(c,a)}}();var d=function(t){var i=(t=t||{}).after;if(function(){if(!a){a=vt();for(var t=0;t16e6)return null;var o=r.makeLayer(a,n);if(null!=i){var s=c.indexOf(i)+1;c.splice(s,0,o)}else(void 0===t.insert||t.insert)&&c.unshift(o);return o};if(r.skipping&&!o)return null;for(var f=null,h=e.length/1,p=!o,g=0;g=h||!kt(f.bb,v.boundingBox()))&&!(f=d({insert:!0,after:f})))return null;s||p?r.queueLayer(f,v):r.drawEleInLayer(f,v,n,t),f.eles.push(v),y[n]=f}}return s||(p?null:c)},Ms.getEleLevelForLayerLevel=function(e,t){return e},Ms.drawEleInLayer=function(e,t,n,r){var i=this.renderer,o=e.context,a=t.boundingBox();0!==a.w&&0!==a.h&&t.visible()&&(n=this.getEleLevelForLayerLevel(n,r),i.setImgSmoothing(o,!1),i.drawCachedElement(o,t,null,null,n,true),i.setImgSmoothing(o,!0))},Ms.levelIsComplete=function(e,t){var n=this.layersByLevel[e];if(!n||0===n.length)return!1;for(var r=0,i=0;i0)return!1;if(o.invalid)return!1;r+=o.eles.length}return r===t.length},Ms.validateLayersElesOrdering=function(e,t){var n=this.layersByLevel[e];if(n)for(var r=0;r0){e=!0;break}}return e},Ms.invalidateElements=function(e){var t=this;0!==e.length&&(t.lastInvalidationTime=le(),0!==e.length&&t.haveLayers()&&t.updateElementsInLayers(e,(function(e,n,r){t.invalidateLayer(e)})))},Ms.invalidateLayer=function(e){if(this.lastInvalidationTime=le(),!e.invalid){var t=e.level,n=e.eles,r=this.layersByLevel[t];je(r,e),e.elesQueue=[],e.invalid=!0,e.replacement&&(e.replacement.invalid=!0);for(var i=0;i3&&void 0!==arguments[3])||arguments[3],i=!(arguments.length>4&&void 0!==arguments[4])||arguments[4],o=!(arguments.length>5&&void 0!==arguments[5])||arguments[5],a=this,s=t._private.rscratch;if((!o||t.visible())&&!s.badLine&&null!=s.allpts&&!isNaN(s.allpts[0])){var l;n&&(l=n,e.translate(-l.x1,-l.y1));var u=o?t.pstyle("opacity").value:1,c=o?t.pstyle("line-opacity").value:1,d=t.pstyle("curve-style").value,f=t.pstyle("line-style").value,h=t.pstyle("width").pfValue,p=t.pstyle("line-cap").value,g=u*c,v=u*c,m=function(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:g;"straight-triangle"===d?(a.eleStrokeStyle(e,t,n),a.drawEdgeTrianglePath(t,e,s.allpts)):(e.lineWidth=h,e.lineCap=p,a.eleStrokeStyle(e,t,n),a.drawEdgePath(t,e,s.allpts,f),e.lineCap="butt")},y=function(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:v;a.drawArrowheads(e,t,n)};if(e.lineJoin="round","yes"===t.pstyle("ghost").value){var b=t.pstyle("ghost-offset-x").pfValue,x=t.pstyle("ghost-offset-y").pfValue,_=t.pstyle("ghost-opacity").value,w=g*_;e.translate(b,x),m(w),y(w),e.translate(-b,-x)}i&&a.drawEdgeUnderlay(e,t),m(),y(),i&&a.drawEdgeOverlay(e,t),a.drawElementText(e,t,null,r),n&&e.translate(l.x1,l.y1)}}},Ys=function(e){if(!["overlay","underlay"].includes(e))throw new Error("Invalid state");return function(t,n){if(n.visible()){var r=n.pstyle("".concat(e,"-opacity")).value;if(0!==r){var i=this,o=i.usePaths(),a=n._private.rscratch,s=2*n.pstyle("".concat(e,"-padding")).pfValue,l=n.pstyle("".concat(e,"-color")).value;t.lineWidth=s,"self"!==a.edgeType||o?t.lineCap="round":t.lineCap="butt",i.colorStrokeStyle(t,l[0],l[1],l[2],r),i.drawEdgePath(n,t,a.allpts,"solid")}}}};Ks.drawEdgeOverlay=Ys("overlay"),Ks.drawEdgeUnderlay=Ys("underlay"),Ks.drawEdgePath=function(e,t,n,r){var i,o=e._private.rscratch,a=t,s=!1,l=this.usePaths(),u=e.pstyle("line-dash-pattern").pfValue,c=e.pstyle("line-dash-offset").pfValue;if(l){var d=n.join("$");o.pathCacheKey&&o.pathCacheKey===d?(i=t=o.pathCache,s=!0):(i=t=new Path2D,o.pathCacheKey=d,o.pathCache=i)}if(a.setLineDash)switch(r){case"dotted":a.setLineDash([1,1]);break;case"dashed":a.setLineDash(u),a.lineDashOffset=c;break;case"solid":a.setLineDash([])}if(!s&&!o.badLine)switch(t.beginPath&&t.beginPath(),t.moveTo(n[0],n[1]),o.edgeType){case"bezier":case"self":case"compound":case"multibezier":for(var f=2;f+35&&void 0!==arguments[5])||arguments[5],a=this;if(null==r){if(o&&!a.eleTextBiggerThanMin(t))return}else if(!1===r)return;if(t.isNode()){var s=t.pstyle("label");if(!s||!s.value)return;var l=a.getLabelJustification(t);e.textAlign=l,e.textBaseline="bottom"}else{var u=t.element()._private.rscratch.badLine,c=t.pstyle("label"),d=t.pstyle("source-label"),f=t.pstyle("target-label");if(u||(!c||!c.value)&&(!d||!d.value)&&(!f||!f.value))return;e.textAlign="center",e.textBaseline="bottom"}var h,p=!n;n&&(h=n,e.translate(-h.x1,-h.y1)),null==i?(a.drawText(e,t,null,p,o),t.isEdge()&&(a.drawText(e,t,"source",p,o),a.drawText(e,t,"target",p,o))):a.drawText(e,t,i,p,o),n&&e.translate(h.x1,h.y1)},$s.getFontCache=function(e){var t;this.fontCaches=this.fontCaches||[];for(var n=0;n2&&void 0!==arguments[2])||arguments[2],r=t.pstyle("font-style").strValue,i=t.pstyle("font-size").pfValue+"px",o=t.pstyle("font-family").strValue,a=t.pstyle("font-weight").strValue,s=n?t.effectiveOpacity()*t.pstyle("text-opacity").value:1,l=t.pstyle("text-outline-opacity").value*s,u=t.pstyle("color").value,c=t.pstyle("text-outline-color").value;e.font=r+" "+a+" "+i+" "+o,e.lineJoin="round",this.colorFillStyle(e,u[0],u[1],u[2],s),this.colorStrokeStyle(e,c[0],c[1],c[2],l)},$s.getTextAngle=function(e,t){var n=e._private.rscratch,r=t?t+"-":"",i=e.pstyle(r+"text-rotation"),o=Ie(n,"labelAngle",t);return"autorotate"===i.strValue?e.isEdge()?o:0:"none"===i.strValue?0:i.pfValue},$s.drawText=function(e,t,n){var r=!(arguments.length>3&&void 0!==arguments[3])||arguments[3],i=!(arguments.length>4&&void 0!==arguments[4])||arguments[4],o=t._private.rscratch,a=i?t.effectiveOpacity():1;if(!i||0!==a&&0!==t.pstyle("text-opacity").value){"main"===n&&(n=null);var s,l,u=Ie(o,"labelX",n),c=Ie(o,"labelY",n),d=this.getLabelText(t,n);if(null!=d&&""!==d&&!isNaN(u)&&!isNaN(c)){this.setupTextStyle(e,t,i);var f,h=n?n+"-":"",p=Ie(o,"labelWidth",n),g=Ie(o,"labelHeight",n),v=t.pstyle(h+"text-margin-x").pfValue,m=t.pstyle(h+"text-margin-y").pfValue,y=t.isEdge(),b=t.pstyle("text-halign").value,x=t.pstyle("text-valign").value;switch(y&&(b="center",x="center"),u+=v,c+=m,0!==(f=r?this.getTextAngle(t,n):0)&&(s=u,l=c,e.translate(s,l),e.rotate(f),u=0,c=0),x){case"top":break;case"center":c+=g/2;break;case"bottom":c+=g}var _=t.pstyle("text-background-opacity").value,w=t.pstyle("text-border-opacity").value,k=t.pstyle("text-border-width").pfValue,E=t.pstyle("text-background-padding").pfValue;if(_>0||k>0&&w>0){var S=u-E;switch(b){case"left":S-=p;break;case"center":S-=p/2}var C=c-g-E,P=p+2*E,T=g+2*E;if(_>0){var O=e.fillStyle,M=t.pstyle("text-background-color").value;e.fillStyle="rgba("+M[0]+","+M[1]+","+M[2]+","+_*a+")",0===t.pstyle("text-background-shape").strValue.indexOf("round")?function(e,t,n,r,i){var o=arguments.length>5&&void 0!==arguments[5]?arguments[5]:5;e.beginPath(),e.moveTo(t+o,n),e.lineTo(t+r-o,n),e.quadraticCurveTo(t+r,n,t+r,n+o),e.lineTo(t+r,n+i-o),e.quadraticCurveTo(t+r,n+i,t+r-o,n+i),e.lineTo(t+o,n+i),e.quadraticCurveTo(t,n+i,t,n+i-o),e.lineTo(t,n+o),e.quadraticCurveTo(t,n,t+o,n),e.closePath(),e.fill()}(e,S,C,P,T,2):e.fillRect(S,C,P,T),e.fillStyle=O}if(k>0&&w>0){var D=e.strokeStyle,N=e.lineWidth,A=t.pstyle("text-border-color").value,L=t.pstyle("text-border-style").value;if(e.strokeStyle="rgba("+A[0]+","+A[1]+","+A[2]+","+w*a+")",e.lineWidth=k,e.setLineDash)switch(L){case"dotted":e.setLineDash([1,1]);break;case"dashed":e.setLineDash([4,2]);break;case"double":e.lineWidth=k/4,e.setLineDash([]);break;case"solid":e.setLineDash([])}if(e.strokeRect(S,C,P,T),"double"===L){var j=k/2;e.strokeRect(S+j,C+j,P-2*j,T-2*j)}e.setLineDash&&e.setLineDash([]),e.lineWidth=N,e.strokeStyle=D}}var R=2*t.pstyle("text-outline-width").pfValue;if(R>0&&(e.lineWidth=R),"wrap"===t.pstyle("text-wrap").value){var I=Ie(o,"labelWrapCachedLines",n),B=Ie(o,"labelLineHeight",n),z=p/2,F=this.getLabelJustification(t);switch("auto"===F||("left"===b?"left"===F?u+=-p:"center"===F&&(u+=-z):"center"===b?"left"===F?u+=-z:"right"===F&&(u+=z):"right"===b&&("center"===F?u+=z:"right"===F&&(u+=p))),x){case"top":case"center":case"bottom":c-=(I.length-1)*B}for(var q=0;q0&&e.strokeText(I[q],u,c),e.fillText(I[q],u,c),c+=B}else R>0&&e.strokeText(d,u,c),e.fillText(d,u,c);0!==f&&(e.rotate(-f),e.translate(-s,-l))}}};var Gs={drawNode:function(e,t,n){var r,i,o=!(arguments.length>3&&void 0!==arguments[3])||arguments[3],a=!(arguments.length>4&&void 0!==arguments[4])||arguments[4],s=!(arguments.length>5&&void 0!==arguments[5])||arguments[5],l=this,u=t._private,c=u.rscratch,d=t.position();if(N(d.x)&&N(d.y)&&(!s||t.visible())){var f,h,p=s?t.effectiveOpacity():1,g=l.usePaths(),v=!1,m=t.padding();r=t.width()+2*m,i=t.height()+2*m,n&&(h=n,e.translate(-h.x1,-h.y1));for(var y=t.pstyle("background-image").value,b=new Array(y.length),x=new Array(y.length),_=0,w=0;w0&&void 0!==arguments[0]?arguments[0]:P;l.eleFillStyle(e,t,n)},A=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:M;l.colorStrokeStyle(e,T[0],T[1],T[2],t)},L=t.pstyle("shape").strValue,j=t.pstyle("shape-polygon-points").pfValue;if(g){e.translate(d.x,d.y);var R=l.nodePathCache=l.nodePathCache||[],I=me("polygon"===L?L+","+j.join(","):L,""+i,""+r),B=R[I];null!=B?(f=B,v=!0,c.pathCache=f):(f=new Path2D,R[I]=c.pathCache=f)}var z=function(){if(!v){var n=d;g&&(n={x:0,y:0}),l.nodeShapes[l.getNodeShape(t)].draw(f||e,n.x,n.y,r,i)}g?e.fill(f):e.fill()},F=function(){for(var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:p,r=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],i=u.backgrounding,o=0,a=0;a0&&void 0!==arguments[0]&&arguments[0],o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:p;l.hasPie(t)&&(l.drawPie(e,t,o),n&&(g||l.nodeShapes[l.getNodeShape(t)].draw(e,d.x,d.y,r,i)))},V=function(){var t=(S>0?S:-S)*(arguments.length>0&&void 0!==arguments[0]?arguments[0]:p),n=S>0?0:255;0!==S&&(l.colorFillStyle(e,n,n,n,t),g?e.fill(f):e.fill())},U=function(){if(C>0){if(e.lineWidth=C,e.lineCap="butt",e.setLineDash)switch(O){case"dotted":e.setLineDash([1,1]);break;case"dashed":e.setLineDash([4,2]);break;case"solid":case"double":e.setLineDash([])}if(g?e.stroke(f):e.stroke(),"double"===O){e.lineWidth=C/3;var t=e.globalCompositeOperation;e.globalCompositeOperation="destination-out",g?e.stroke(f):e.stroke(),e.globalCompositeOperation=t}e.setLineDash&&e.setLineDash([])}};if("yes"===t.pstyle("ghost").value){var W=t.pstyle("ghost-offset-x").pfValue,Z=t.pstyle("ghost-offset-y").pfValue,H=t.pstyle("ghost-opacity").value,K=H*p;e.translate(W,Z),D(H*P),z(),F(K,!0),A(H*M),U(),q(0!==S||0!==C),F(K,!1),V(K),e.translate(-W,-Z)}g&&e.translate(-d.x,-d.y),a&&l.drawNodeUnderlay(e,t,d,r,i),g&&e.translate(d.x,d.y),D(),z(),F(p,!0),A(),U(),q(0!==S||0!==C),F(p,!1),V(),g&&e.translate(-d.x,-d.y),l.drawElementText(e,t,null,o),a&&l.drawNodeOverlay(e,t,d,r,i),n&&e.translate(h.x1,h.y1)}}},Qs=function(e){if(!["overlay","underlay"].includes(e))throw new Error("Invalid state");return function(t,n,r,i,o){if(n.visible()){var a=n.pstyle("".concat(e,"-padding")).pfValue,s=n.pstyle("".concat(e,"-opacity")).value,l=n.pstyle("".concat(e,"-color")).value,u=n.pstyle("".concat(e,"-shape")).value;if(s>0){if(r=r||n.position(),null==i||null==o){var c=n.padding();i=n.width()+2*c,o=n.height()+2*c}this.colorFillStyle(t,l[0],l[1],l[2],s),this.nodeShapes[u].draw(t,r.x,r.y,i+2*a,o+2*a),t.fill()}}}};Gs.drawNodeOverlay=Qs("overlay"),Gs.drawNodeUnderlay=Qs("underlay"),Gs.hasPie=function(e){return(e=e[0])._private.hasPie},Gs.drawPie=function(e,t,n,r){t=t[0],r=r||t.position();var i=t.cy().style(),o=t.pstyle("pie-size"),a=r.x,s=r.y,l=t.width(),u=t.height(),c=Math.min(l,u)/2,d=0;this.usePaths()&&(a=0,s=0),"%"===o.units?c*=o.pfValue:void 0!==o.pfValue&&(c=o.pfValue/2);for(var f=1;f<=i.pieBackgroundN;f++){var h=t.pstyle("pie-"+f+"-background-size").value,p=t.pstyle("pie-"+f+"-background-color").value,g=t.pstyle("pie-"+f+"-background-opacity").value*n,v=h/100;v+d>1&&(v=1-d);var m=1.5*Math.PI+2*Math.PI*d,y=m+2*Math.PI*v;0===h||d>=1||d+v>1||(e.beginPath(),e.moveTo(a,s),e.arc(a,s,c,m,y),e.closePath(),this.colorFillStyle(e,p[0],p[1],p[2],g),e.fill(),d+=v)}};var Js={};Js.getPixelRatio=function(){var e=this.data.contexts[0];if(null!=this.forcedPixelRatio)return this.forcedPixelRatio;var t=e.backingStorePixelRatio||e.webkitBackingStorePixelRatio||e.mozBackingStorePixelRatio||e.msBackingStorePixelRatio||e.oBackingStorePixelRatio||e.backingStorePixelRatio||1;return(window.devicePixelRatio||1)/t},Js.paintCache=function(e){for(var t,n=this.paintCaches=this.paintCaches||[],r=!0,i=0;ia.minMbLowQualFrames&&(a.motionBlurPxRatio=a.mbPxRBlurry)),a.clearingMotionBlur&&(a.motionBlurPxRatio=1),a.textureDrawLastFrame&&!d&&(c[a.NODE]=!0,c[a.SELECT_BOX]=!0);var y=l.style(),b=l.zoom(),x=void 0!==i?i:b,_=l.pan(),w={x:_.x,y:_.y},k={zoom:b,pan:{x:_.x,y:_.y}},E=a.prevViewport;void 0===E||k.zoom!==E.zoom||k.pan.x!==E.pan.x||k.pan.y!==E.pan.y||g&&!p||(a.motionBlurPxRatio=1),o&&(w=o),x*=s,w.x*=s,w.y*=s;var S=a.getCachedZSortedEles();function C(e,t,n,r,i){var o=e.globalCompositeOperation;e.globalCompositeOperation="destination-out",a.colorFillStyle(e,255,255,255,a.motionBlurTransparency),e.fillRect(t,n,r,i),e.globalCompositeOperation=o}function P(e,r){var s,l,c,d;a.clearingMotionBlur||e!==u.bufferContexts[a.MOTIONBLUR_BUFFER_NODE]&&e!==u.bufferContexts[a.MOTIONBLUR_BUFFER_DRAG]?(s=w,l=x,c=a.canvasWidth,d=a.canvasHeight):(s={x:_.x*h,y:_.y*h},l=b*h,c=a.canvasWidth*h,d=a.canvasHeight*h),e.setTransform(1,0,0,1,0,0),"motionBlur"===r?C(e,0,0,c,d):t||void 0!==r&&!r||e.clearRect(0,0,c,d),n||(e.translate(s.x,s.y),e.scale(l,l)),o&&e.translate(o.x,o.y),i&&e.scale(i,i)}if(d||(a.textureDrawLastFrame=!1),d){if(a.textureDrawLastFrame=!0,!a.textureCache){a.textureCache={},a.textureCache.bb=l.mutableElements().boundingBox(),a.textureCache.texture=a.data.bufferCanvases[a.TEXTURE_BUFFER];var T=a.data.bufferContexts[a.TEXTURE_BUFFER];T.setTransform(1,0,0,1,0,0),T.clearRect(0,0,a.canvasWidth*a.textureMult,a.canvasHeight*a.textureMult),a.render({forcedContext:T,drawOnlyNodeLayer:!0,forcedPxRatio:s*a.textureMult}),(k=a.textureCache.viewport={zoom:l.zoom(),pan:l.pan(),width:a.canvasWidth,height:a.canvasHeight}).mpan={x:(0-k.pan.x)/k.zoom,y:(0-k.pan.y)/k.zoom}}c[a.DRAG]=!1,c[a.NODE]=!1;var O=u.contexts[a.NODE],M=a.textureCache.texture;k=a.textureCache.viewport;O.setTransform(1,0,0,1,0,0),f?C(O,0,0,k.width,k.height):O.clearRect(0,0,k.width,k.height);var D=y.core("outside-texture-bg-color").value,N=y.core("outside-texture-bg-opacity").value;a.colorFillStyle(O,D[0],D[1],D[2],N),O.fillRect(0,0,k.width,k.height);b=l.zoom();P(O,!1),O.clearRect(k.mpan.x,k.mpan.y,k.width/k.zoom/s,k.height/k.zoom/s),O.drawImage(M,k.mpan.x,k.mpan.y,k.width/k.zoom/s,k.height/k.zoom/s)}else a.textureOnViewport&&!t&&(a.textureCache=null);var A=l.extent(),L=a.pinching||a.hoverData.dragging||a.swipePanning||a.data.wheelZooming||a.hoverData.draggingEles||a.cy.animated(),j=a.hideEdgesOnViewport&&L,R=[];if(R[a.NODE]=!c[a.NODE]&&f&&!a.clearedForMotionBlur[a.NODE]||a.clearingMotionBlur,R[a.NODE]&&(a.clearedForMotionBlur[a.NODE]=!0),R[a.DRAG]=!c[a.DRAG]&&f&&!a.clearedForMotionBlur[a.DRAG]||a.clearingMotionBlur,R[a.DRAG]&&(a.clearedForMotionBlur[a.DRAG]=!0),c[a.NODE]||n||r||R[a.NODE]){var I=f&&!R[a.NODE]&&1!==h;P(O=t||(I?a.data.bufferContexts[a.MOTIONBLUR_BUFFER_NODE]:u.contexts[a.NODE]),f&&!I?"motionBlur":void 0),j?a.drawCachedNodes(O,S.nondrag,s,A):a.drawLayeredElements(O,S.nondrag,s,A),a.debug&&a.drawDebugPoints(O,S.nondrag),n||f||(c[a.NODE]=!1)}if(!r&&(c[a.DRAG]||n||R[a.DRAG])){I=f&&!R[a.DRAG]&&1!==h;P(O=t||(I?a.data.bufferContexts[a.MOTIONBLUR_BUFFER_DRAG]:u.contexts[a.DRAG]),f&&!I?"motionBlur":void 0),j?a.drawCachedNodes(O,S.drag,s,A):a.drawCachedElements(O,S.drag,s,A),a.debug&&a.drawDebugPoints(O,S.drag),n||f||(c[a.DRAG]=!1)}if(a.showFps||!r&&c[a.SELECT_BOX]&&!n){if(P(O=t||u.contexts[a.SELECT_BOX]),1==a.selection[4]&&(a.hoverData.selecting||a.touchData.selecting)){b=a.cy.zoom();var B=y.core("selection-box-border-width").value/b;O.lineWidth=B,O.fillStyle="rgba("+y.core("selection-box-color").value[0]+","+y.core("selection-box-color").value[1]+","+y.core("selection-box-color").value[2]+","+y.core("selection-box-opacity").value+")",O.fillRect(a.selection[0],a.selection[1],a.selection[2]-a.selection[0],a.selection[3]-a.selection[1]),B>0&&(O.strokeStyle="rgba("+y.core("selection-box-border-color").value[0]+","+y.core("selection-box-border-color").value[1]+","+y.core("selection-box-border-color").value[2]+","+y.core("selection-box-opacity").value+")",O.strokeRect(a.selection[0],a.selection[1],a.selection[2]-a.selection[0],a.selection[3]-a.selection[1]))}if(u.bgActivePosistion&&!a.hoverData.selecting){b=a.cy.zoom();var z=u.bgActivePosistion;O.fillStyle="rgba("+y.core("active-bg-color").value[0]+","+y.core("active-bg-color").value[1]+","+y.core("active-bg-color").value[2]+","+y.core("active-bg-opacity").value+")",O.beginPath(),O.arc(z.x,z.y,y.core("active-bg-size").pfValue/b,0,2*Math.PI),O.fill()}var F=a.lastRedrawTime;if(a.showFps&&F){F=Math.round(F);var q=Math.round(1e3/F);O.setTransform(1,0,0,1,0,0),O.fillStyle="rgba(255, 0, 0, 0.75)",O.strokeStyle="rgba(255, 0, 0, 0.75)",O.lineWidth=1,O.fillText("1 frame = "+F+" ms = "+q+" fps",0,20);O.strokeRect(0,30,250,20),O.fillRect(0,30,250*Math.min(q/60,1),20)}n||(c[a.SELECT_BOX]=!1)}if(f&&1!==h){var V=u.contexts[a.NODE],U=a.data.bufferCanvases[a.MOTIONBLUR_BUFFER_NODE],W=u.contexts[a.DRAG],Z=a.data.bufferCanvases[a.MOTIONBLUR_BUFFER_DRAG],H=function(e,t,n){e.setTransform(1,0,0,1,0,0),n||!m?e.clearRect(0,0,a.canvasWidth,a.canvasHeight):C(e,0,0,a.canvasWidth,a.canvasHeight);var r=h;e.drawImage(t,0,0,a.canvasWidth*r,a.canvasHeight*r,0,0,a.canvasWidth,a.canvasHeight)};(c[a.NODE]||R[a.NODE])&&(H(V,U,R[a.NODE]),c[a.NODE]=!1),(c[a.DRAG]||R[a.DRAG])&&(H(W,Z,R[a.DRAG]),c[a.DRAG]=!1)}a.prevViewport=k,a.clearingMotionBlur&&(a.clearingMotionBlur=!1,a.motionBlurCleared=!0,a.motionBlur=!0),f&&(a.motionBlurTimeout=setTimeout((function(){a.motionBlurTimeout=null,a.clearedForMotionBlur[a.NODE]=!1,a.clearedForMotionBlur[a.DRAG]=!1,a.motionBlur=!1,a.clearingMotionBlur=!d,a.mbFrames=0,c[a.NODE]=!0,c[a.DRAG]=!0,a.redraw()}),100)),t||l.emit("render")};for(var el={drawPolygonPath:function(e,t,n,r,i,o){var a=r/2,s=i/2;e.beginPath&&e.beginPath(),e.moveTo(t+a*o[0],n+s*o[1]);for(var l=1;l0&&o>0){f.clearRect(0,0,i,o),f.globalCompositeOperation="source-over";var h=this.getCachedZSortedEles();if(e.full)f.translate(-n.x1*l,-n.y1*l),f.scale(l,l),this.drawElements(f,h),f.scale(1/l,1/l),f.translate(n.x1*l,n.y1*l);else{var p=t.pan(),g={x:p.x*l,y:p.y*l};l*=t.zoom(),f.translate(g.x,g.y),f.scale(l,l),this.drawElements(f,h),f.scale(1/l,1/l),f.translate(-g.x,-g.y)}e.bg&&(f.globalCompositeOperation="destination-over",f.fillStyle=e.bg,f.rect(0,0,i,o),f.fill())}return d},sl.png=function(e){return ul(e,this.bufferCanvasImage(e),"image/png")},sl.jpg=function(e){return ul(e,this.bufferCanvasImage(e),"image/jpeg")};var cl={nodeShapeImpl:function(e,t,n,r,i,o,a){switch(e){case"ellipse":return this.drawEllipsePath(t,n,r,i,o);case"polygon":return this.drawPolygonPath(t,n,r,i,o,a);case"round-polygon":return this.drawRoundPolygonPath(t,n,r,i,o,a);case"roundrectangle":case"round-rectangle":return this.drawRoundRectanglePath(t,n,r,i,o);case"cutrectangle":case"cut-rectangle":return this.drawCutRectanglePath(t,n,r,i,o);case"bottomroundrectangle":case"bottom-round-rectangle":return this.drawBottomRoundRectanglePath(t,n,r,i,o);case"barrel":return this.drawBarrelPath(t,n,r,i,o)}}},dl=hl,fl=hl.prototype;function hl(e){var t=this;t.data={canvases:new Array(fl.CANVAS_LAYERS),contexts:new Array(fl.CANVAS_LAYERS),canvasNeedsRedraw:new Array(fl.CANVAS_LAYERS),bufferCanvases:new Array(fl.BUFFER_COUNT),bufferContexts:new Array(fl.CANVAS_LAYERS)};var n="-webkit-tap-highlight-color",r="rgba(0,0,0,0)";t.data.canvasContainer=document.createElement("div");var i=t.data.canvasContainer.style;t.data.canvasContainer.style[n]=r,i.position="relative",i.zIndex="0",i.overflow="hidden";var o=e.cy.container();o.appendChild(t.data.canvasContainer),o.style[n]=r;var a={"-webkit-user-select":"none","-moz-user-select":"-moz-none","user-select":"none","-webkit-tap-highlight-color":"rgba(0,0,0,0)","outline-style":"none"};q()&&(a["-ms-touch-action"]="none",a["touch-action"]="none");for(var s=0;s0;--l)if(r=t[l].dequeue()){i=i.concat(s(e,t,n,r,!0));break}}return i}(n.graph,n.buckets,n.zeroIdx);return r.flatten(r.map(u,(function(t){return e.outEdges(t.v,t.w)})),!0)};var a=r.constant(1);function s(e,t,n,i,o){var a=o?[]:void 0;return r.forEach(e.inEdges(i.v),(function(r){var i=e.edge(r),s=e.node(r.v);o&&a.push({v:r.v,w:r.w}),s.out-=i,l(t,n,s)})),r.forEach(e.outEdges(i.v),(function(r){var i=e.edge(r),o=r.w,a=e.node(o);a.in-=i,l(t,n,a)})),e.removeNode(i.v),a}function l(e,t,n){n.out?n.in?e[n.out-n.in+t].enqueue(n):e[e.length-1].enqueue(n):e[0].enqueue(n)}},6456:function(e,t,n){"use strict";var r=n(8899),i=n(2212),o=n(1898),a=n(6744),s=n(8392).normalizeRanks,l=n(7652),u=n(8392).removeEmptyRanks,c=n(1652),d=n(4093),f=n(5384),h=n(7348),p=n(3090),g=n(8392),v=n(2990).Graph;e.exports=function(e,t){var n=t&&t.debugTiming?g.time:g.notime;n("layout",(function(){var t=n(" buildLayoutGraph",(function(){return function(e){var t=new v({multigraph:!0,compound:!0}),n=C(e.graph());return t.setGraph(r.merge({},y,S(n,m),r.pick(n,b))),r.forEach(e.nodes(),(function(n){var i=C(e.node(n));t.setNode(n,r.defaults(S(i,x),_)),t.setParent(n,e.parent(n))})),r.forEach(e.edges(),(function(n){var i=C(e.edge(n));t.setEdge(n,r.merge({},k,S(i,w),r.pick(i,E)))})),t}(e)}));n(" runLayout",(function(){!function(e,t){t(" makeSpaceForEdgeLabels",(function(){!function(e){var t=e.graph();t.ranksep/=2,r.forEach(e.edges(),(function(n){var r=e.edge(n);r.minlen*=2,"c"!==r.labelpos.toLowerCase()&&("TB"===t.rankdir||"BT"===t.rankdir?r.width+=r.labeloffset:r.height+=r.labeloffset)}))}(e)})),t(" removeSelfEdges",(function(){!function(e){r.forEach(e.edges(),(function(t){if(t.v===t.w){var n=e.node(t.v);n.selfEdges||(n.selfEdges=[]),n.selfEdges.push({e:t,label:e.edge(t)}),e.removeEdge(t)}}))}(e)})),t(" acyclic",(function(){i.run(e)})),t(" nestingGraph.run",(function(){c.run(e)})),t(" rank",(function(){a(g.asNonCompoundGraph(e))})),t(" injectEdgeLabelProxies",(function(){!function(e){r.forEach(e.edges(),(function(t){var n=e.edge(t);if(n.width&&n.height){var r=e.node(t.v),i={rank:(e.node(t.w).rank-r.rank)/2+r.rank,e:t};g.addDummyNode(e,"edge-proxy",i,"_ep")}}))}(e)})),t(" removeEmptyRanks",(function(){u(e)})),t(" nestingGraph.cleanup",(function(){c.cleanup(e)})),t(" normalizeRanks",(function(){s(e)})),t(" assignRankMinMax",(function(){!function(e){var t=0;r.forEach(e.nodes(),(function(n){var i=e.node(n);i.borderTop&&(i.minRank=e.node(i.borderTop).rank,i.maxRank=e.node(i.borderBottom).rank,t=r.max(t,i.maxRank))})),e.graph().maxRank=t}(e)})),t(" removeEdgeLabelProxies",(function(){!function(e){r.forEach(e.nodes(),(function(t){var n=e.node(t);"edge-proxy"===n.dummy&&(e.edge(n.e).labelRank=n.rank,e.removeNode(t))}))}(e)})),t(" normalize.run",(function(){o.run(e)})),t(" parentDummyChains",(function(){l(e)})),t(" addBorderSegments",(function(){d(e)})),t(" order",(function(){h(e)})),t(" insertSelfEdges",(function(){!function(e){var t=g.buildLayerMatrix(e);r.forEach(t,(function(t){var n=0;r.forEach(t,(function(t,i){var o=e.node(t);o.order=i+n,r.forEach(o.selfEdges,(function(t){g.addDummyNode(e,"selfedge",{width:t.label.width,height:t.label.height,rank:o.rank,order:i+ ++n,e:t.e,label:t.label},"_se")})),delete o.selfEdges}))}))}(e)})),t(" adjustCoordinateSystem",(function(){f.adjust(e)})),t(" position",(function(){p(e)})),t(" positionSelfEdges",(function(){!function(e){r.forEach(e.nodes(),(function(t){var n=e.node(t);if("selfedge"===n.dummy){var r=e.node(n.e.v),i=r.x+r.width/2,o=r.y,a=n.x-i,s=r.height/2;e.setEdge(n.e,n.label),e.removeNode(t),n.label.points=[{x:i+2*a/3,y:o-s},{x:i+5*a/6,y:o-s},{x:i+a,y:o},{x:i+5*a/6,y:o+s},{x:i+2*a/3,y:o+s}],n.label.x=n.x,n.label.y=n.y}}))}(e)})),t(" removeBorderNodes",(function(){!function(e){r.forEach(e.nodes(),(function(t){if(e.children(t).length){var n=e.node(t),i=e.node(n.borderTop),o=e.node(n.borderBottom),a=e.node(r.last(n.borderLeft)),s=e.node(r.last(n.borderRight));n.width=Math.abs(s.x-a.x),n.height=Math.abs(o.y-i.y),n.x=a.x+n.width/2,n.y=i.y+n.height/2}})),r.forEach(e.nodes(),(function(t){"border"===e.node(t).dummy&&e.removeNode(t)}))}(e)})),t(" normalize.undo",(function(){o.undo(e)})),t(" fixupEdgeLabelCoords",(function(){!function(e){r.forEach(e.edges(),(function(t){var n=e.edge(t);if(r.has(n,"x"))switch("l"!==n.labelpos&&"r"!==n.labelpos||(n.width-=n.labeloffset),n.labelpos){case"l":n.x-=n.width/2+n.labeloffset;break;case"r":n.x+=n.width/2+n.labeloffset}}))}(e)})),t(" undoCoordinateSystem",(function(){f.undo(e)})),t(" translateGraph",(function(){!function(e){var t=Number.POSITIVE_INFINITY,n=0,i=Number.POSITIVE_INFINITY,o=0,a=e.graph(),s=a.marginx||0,l=a.marginy||0;function u(e){var r=e.x,a=e.y,s=e.width,l=e.height;t=Math.min(t,r-s/2),n=Math.max(n,r+s/2),i=Math.min(i,a-l/2),o=Math.max(o,a+l/2)}r.forEach(e.nodes(),(function(t){u(e.node(t))})),r.forEach(e.edges(),(function(t){var n=e.edge(t);r.has(n,"x")&&u(n)})),t-=s,i-=l,r.forEach(e.nodes(),(function(n){var r=e.node(n);r.x-=t,r.y-=i})),r.forEach(e.edges(),(function(n){var o=e.edge(n);r.forEach(o.points,(function(e){e.x-=t,e.y-=i})),r.has(o,"x")&&(o.x-=t),r.has(o,"y")&&(o.y-=i)})),a.width=n-t+s,a.height=o-i+l}(e)})),t(" assignNodeIntersects",(function(){!function(e){r.forEach(e.edges(),(function(t){var n,r,i=e.edge(t),o=e.node(t.v),a=e.node(t.w);i.points?(n=i.points[0],r=i.points[i.points.length-1]):(i.points=[],n=a,r=o),i.points.unshift(g.intersectRect(o,n)),i.points.push(g.intersectRect(a,r))}))}(e)})),t(" reversePoints",(function(){!function(e){r.forEach(e.edges(),(function(t){var n=e.edge(t);n.reversed&&n.points.reverse()}))}(e)})),t(" acyclic.undo",(function(){i.undo(e)}))}(t,n)})),n(" updateInputGraph",(function(){!function(e,t){r.forEach(e.nodes(),(function(n){var r=e.node(n),i=t.node(n);r&&(r.x=i.x,r.y=i.y,t.children(n).length&&(r.width=i.width,r.height=i.height))})),r.forEach(e.edges(),(function(n){var i=e.edge(n),o=t.edge(n);i.points=o.points,r.has(o,"x")&&(i.x=o.x,i.y=o.y)})),e.graph().width=t.graph().width,e.graph().height=t.graph().height}(e,t)}))}))};var m=["nodesep","edgesep","ranksep","marginx","marginy"],y={ranksep:50,edgesep:20,nodesep:50,rankdir:"tb"},b=["acyclicer","ranker","rankdir","align"],x=["width","height"],_={width:0,height:0},w=["minlen","weight","width","height","labeloffset"],k={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},E=["labelpos"];function S(e,t){return r.mapValues(r.pick(e,t),Number)}function C(e){var t={};return r.forEach(e,(function(e,n){t[n.toLowerCase()]=e})),t}},8899:function(e,t,n){var r;try{r={cloneDeep:n(8121),constant:n(1547),defaults:n(6933),each:n(9430),filter:n(86),find:n(1211),flatten:n(5506),forEach:n(6514),forIn:n(9144),has:n(7805),isUndefined:n(2530),last:n(5727),map:n(2034),mapValues:n(7702),max:n(9627),merge:n(9286),min:n(6452),minBy:n(3638),now:n(72),pick:n(6460),range:n(6222),reduce:n(5080),sortBy:n(4286),uniqueId:n(804),values:n(2063),zipObject:n(4827)}}catch(i){}r||(r=window._),e.exports=r},1652:function(e,t,n){var r=n(8899),i=n(8392);function o(e,t,n,a,s,l,u){var c=e.children(u);if(c.length){var d=i.addBorderNode(e,"_bt"),f=i.addBorderNode(e,"_bb"),h=e.node(u);e.setParent(d,u),h.borderTop=d,e.setParent(f,u),h.borderBottom=f,r.forEach(c,(function(r){o(e,t,n,a,s,l,r);var i=e.node(r),c=i.borderTop?i.borderTop:r,h=i.borderBottom?i.borderBottom:r,p=i.borderTop?a:2*a,g=c!==h?1:s-l[u]+1;e.setEdge(d,c,{weight:p,minlen:g,nestingEdge:!0}),e.setEdge(h,f,{weight:p,minlen:g,nestingEdge:!0})})),e.parent(u)||e.setEdge(t,d,{weight:0,minlen:s+l[u]})}else u!==t&&e.setEdge(t,u,{weight:0,minlen:n})}e.exports={run:function(e){var t=i.addDummyNode(e,"root",{},"_root"),n=function(e){var t={};function n(i,o){var a=e.children(i);a&&a.length&&r.forEach(a,(function(e){n(e,o+1)})),t[i]=o}return r.forEach(e.children(),(function(e){n(e,1)})),t}(e),a=r.max(r.values(n))-1,s=2*a+1;e.graph().nestingRoot=t,r.forEach(e.edges(),(function(t){e.edge(t).minlen*=s}));var l=function(e){return r.reduce(e.edges(),(function(t,n){return t+e.edge(n).weight}),0)}(e)+1;r.forEach(e.children(),(function(r){o(e,t,s,l,a,n,r)})),e.graph().nodeRankFactor=s},cleanup:function(e){var t=e.graph();e.removeNode(t.nestingRoot),delete t.nestingRoot,r.forEach(e.edges(),(function(t){e.edge(t).nestingEdge&&e.removeEdge(t)}))}}},1898:function(e,t,n){"use strict";var r=n(8899),i=n(8392);e.exports={run:function(e){e.graph().dummyChains=[],r.forEach(e.edges(),(function(t){!function(e,t){var n,r,o,a=t.v,s=e.node(a).rank,l=t.w,u=e.node(l).rank,c=t.name,d=e.edge(t),f=d.labelRank;if(u===s+1)return;for(e.removeEdge(t),o=0,++s;s0;)t%2&&(n+=l[t+1]),l[t=t-1>>1]+=e.weight;u+=e.weight*n}))),u}e.exports=function(e,t){for(var n=0,r=1;r=2),s=c.buildLayerMatrix(e);var v=o(e,s);v=e.barycenter)&&function(e,t){var n=0,r=0;e.weight&&(n+=e.barycenter*e.weight,r+=e.weight);t.weight&&(n+=t.barycenter*t.weight,r+=t.weight);e.vs=t.vs.concat(e.vs),e.barycenter=n/r,e.weight=r,e.i=Math.min(t.i,e.i),t.merged=!0}(e,t)}}function i(t){return function(n){n.in.push(t),0===--n.indegree&&e.push(n)}}for(;e.length;){var o=e.pop();t.push(o),r.forEach(o.in.reverse(),n(o)),r.forEach(o.out,i(o))}return r.map(r.filter(t,(function(e){return!e.merged})),(function(e){return r.pick(e,["vs","i","barycenter","weight"])}))}(r.filter(n,(function(e){return!e.indegree})))}},3616:function(e,t,n){var r=n(8899),i=n(5213),o=n(1982),a=n(4929);e.exports=function e(t,n,s,l){var u=t.children(n),c=t.node(n),d=c?c.borderLeft:void 0,f=c?c.borderRight:void 0,h={};d&&(u=r.filter(u,(function(e){return e!==d&&e!==f})));var p=i(t,u);r.forEach(p,(function(n){if(t.children(n.v).length){var i=e(t,n.v,s,l);h[n.v]=i,r.has(i,"barycenter")&&(o=n,a=i,r.isUndefined(o.barycenter)?(o.barycenter=a.barycenter,o.weight=a.weight):(o.barycenter=(o.barycenter*o.weight+a.barycenter*a.weight)/(o.weight+a.weight),o.weight+=a.weight))}var o,a}));var g=o(p,s);!function(e,t){r.forEach(e,(function(e){e.vs=r.flatten(e.vs.map((function(e){return t[e]?t[e].vs:e})),!0)}))}(g,h);var v=a(g,l);if(d&&(v.vs=r.flatten([d,v.vs,f],!0),t.predecessors(d).length)){var m=t.node(t.predecessors(d)[0]),y=t.node(t.predecessors(f)[0]);r.has(v,"barycenter")||(v.barycenter=0,v.weight=0),v.barycenter=(v.barycenter*v.weight+m.order+y.order)/(v.weight+2),v.weight+=2}return v}},4929:function(e,t,n){var r=n(8899),i=n(8392);function o(e,t,n){for(var i;t.length&&(i=r.last(t)).i<=n;)t.pop(),e.push(i.vs),n++;return n}e.exports=function(e,t){var n=i.partition(e,(function(e){return r.has(e,"barycenter")})),a=n.lhs,s=r.sortBy(n.rhs,(function(e){return-e.i})),l=[],u=0,c=0,d=0;a.sort((f=!!t,function(e,t){return e.barycentert.barycenter?1:f?t.i-e.i:e.i-t.i})),d=o(l,s,d),r.forEach(a,(function(e){d+=e.vs.length,l.push(e.vs),u+=e.barycenter*e.weight,c+=e.weight,d=o(l,s,d)}));var f;var h={vs:r.flatten(l,!0)};c&&(h.barycenter=u/c,h.weight=c);return h}},7652:function(e,t,n){var r=n(8899);e.exports=function(e){var t=function(e){var t={},n=0;function i(o){var a=n;r.forEach(e.children(o),i),t[o]={low:a,lim:n++}}return r.forEach(e.children(),i),t}(e);r.forEach(e.graph().dummyChains,(function(n){for(var r=e.node(n),i=r.edgeObj,o=function(e,t,n,r){var i,o,a=[],s=[],l=Math.min(t[n].low,t[r].low),u=Math.max(t[n].lim,t[r].lim);i=n;do{i=e.parent(i),a.push(i)}while(i&&(t[i].low>l||u>t[i].lim));o=i,i=r;for(;(i=e.parent(i))!==o;)s.push(i);return{path:a.concat(s.reverse()),lca:o}}(e,t,i.v,i.w),a=o.path,s=o.lca,l=0,u=a[l],c=!0;n!==i.w;){if(r=e.node(n),c){for(;(u=a[l])!==s&&e.node(u).maxRanks)&&l(n,t,u)}))}))}return r.reduce(t,(function(t,n){var o,a=-1,s=0;return r.forEach(n,(function(r,l){if("border"===e.node(r).dummy){var u=e.predecessors(r);u.length&&(o=e.node(u[0]).order,i(n,s,l,a,o),s=l,a=o)}i(n,s,n.length,o,t.length)})),n})),n}function l(e,t,n){if(t>n){var r=t;t=n,n=r}var i=e[t];i||(e[t]=i={}),i[n]=!0}function u(e,t,n){if(t>n){var i=t;t=n,n=i}return r.has(e[t],n)}function c(e,t,n,i){var o={},a={},s={};return r.forEach(t,(function(e){r.forEach(e,(function(e,t){o[e]=e,a[e]=e,s[e]=t}))})),r.forEach(t,(function(e){var t=-1;r.forEach(e,(function(e){var l=i(e);if(l.length){l=r.sortBy(l,(function(e){return s[e]}));for(var c=(l.length-1)/2,d=Math.floor(c),f=Math.ceil(c);d<=f;++d){var h=l[d];a[e]===e&&tl.lim&&(u=l,c=!0);var d=r.filter(t.edges(),(function(t){return c===y(e,e.node(t.v),u)&&c!==y(e,e.node(t.w),u)}));return r.minBy(d,(function(e){return o(t,e)}))}function m(e,t,n,i){var o=n.v,a=n.w;e.removeEdge(o,a),e.setEdge(i.v,i.w,{}),h(e),d(e,t),function(e,t){var n=r.find(e.nodes(),(function(e){return!t.node(e).parent})),i=s(e,n);i=i.slice(1),r.forEach(i,(function(n){var r=e.node(n).parent,i=t.edge(n,r),o=!1;i||(i=t.edge(r,n),o=!0),t.node(n).rank=t.node(r).rank+(o?i.minlen:-i.minlen)}))}(e,t)}function y(e,t,n){return n.low<=t.lim&&t.lim<=n.lim}e.exports=c,c.initLowLimValues=h,c.initCutValues=d,c.calcCutValue=f,c.leaveEdge=g,c.enterEdge=v,c.exchangeEdges=m},4441:function(e,t,n){"use strict";var r=n(8899);e.exports={longestPath:function(e){var t={};r.forEach(e.sources(),(function n(i){var o=e.node(i);if(r.has(t,i))return o.rank;t[i]=!0;var a=r.min(r.map(e.outEdges(i),(function(t){return n(t.w)-e.edge(t).minlen})));return a!==Number.POSITIVE_INFINITY&&void 0!==a&&null!==a||(a=0),o.rank=a}))},slack:function(e,t){return e.node(t.w).rank-e.node(t.v).rank-e.edge(t).minlen}}},8392:function(e,t,n){"use strict";var r=n(8899),i=n(2990).Graph;function o(e,t,n,i){var o;do{o=r.uniqueId(i)}while(e.hasNode(o));return n.dummy=t,e.setNode(o,n),o}function a(e){return r.max(r.map(e.nodes(),(function(t){var n=e.node(t).rank;if(!r.isUndefined(n))return n})))}e.exports={addDummyNode:o,simplify:function(e){var t=(new i).setGraph(e.graph());return r.forEach(e.nodes(),(function(n){t.setNode(n,e.node(n))})),r.forEach(e.edges(),(function(n){var r=t.edge(n.v,n.w)||{weight:0,minlen:1},i=e.edge(n);t.setEdge(n.v,n.w,{weight:r.weight+i.weight,minlen:Math.max(r.minlen,i.minlen)})})),t},asNonCompoundGraph:function(e){var t=new i({multigraph:e.isMultigraph()}).setGraph(e.graph());return r.forEach(e.nodes(),(function(n){e.children(n).length||t.setNode(n,e.node(n))})),r.forEach(e.edges(),(function(n){t.setEdge(n,e.edge(n))})),t},successorWeights:function(e){var t=r.map(e.nodes(),(function(t){var n={};return r.forEach(e.outEdges(t),(function(t){n[t.w]=(n[t.w]||0)+e.edge(t).weight})),n}));return r.zipObject(e.nodes(),t)},predecessorWeights:function(e){var t=r.map(e.nodes(),(function(t){var n={};return r.forEach(e.inEdges(t),(function(t){n[t.v]=(n[t.v]||0)+e.edge(t).weight})),n}));return r.zipObject(e.nodes(),t)},intersectRect:function(e,t){var n,r,i=e.x,o=e.y,a=t.x-i,s=t.y-o,l=e.width/2,u=e.height/2;if(!a&&!s)throw new Error("Not possible to find intersection inside of the rectangle");Math.abs(s)*l>Math.abs(a)*u?(s<0&&(u=-u),n=u*a/s,r=u):(a<0&&(l=-l),n=l,r=l*s/a);return{x:i+n,y:o+r}},buildLayerMatrix:function(e){var t=r.map(r.range(a(e)+1),(function(){return[]}));return r.forEach(e.nodes(),(function(n){var i=e.node(n),o=i.rank;r.isUndefined(o)||(t[o][i.order]=n)})),t},normalizeRanks:function(e){var t=r.min(r.map(e.nodes(),(function(t){return e.node(t).rank})));r.forEach(e.nodes(),(function(n){var i=e.node(n);r.has(i,"rank")&&(i.rank-=t)}))},removeEmptyRanks:function(e){var t=r.min(r.map(e.nodes(),(function(t){return e.node(t).rank}))),n=[];r.forEach(e.nodes(),(function(r){var i=e.node(r).rank-t;n[i]||(n[i]=[]),n[i].push(r)}));var i=0,o=e.graph().nodeRankFactor;r.forEach(n,(function(t,n){r.isUndefined(t)&&n%o!==0?--i:i&&r.forEach(t,(function(t){e.node(t).rank+=i}))}))},addBorderNode:function(e,t,n,r){var i={width:0,height:0};arguments.length>=4&&(i.rank=n,i.order=r);return o(e,"border",i,t)},maxRank:a,partition:function(e,t){var n={lhs:[],rhs:[]};return r.forEach(e,(function(e){t(e)?n.lhs.push(e):n.rhs.push(e)})),n},time:function(e,t){var n=r.now();try{return t()}finally{console.log(e+" time: "+(r.now()-n)+"ms")}},notime:function(e,t){return t()}}},6206:function(e){e.exports="0.8.5"},6118:function(e,t,n){var r=n(5828);e.exports={Graph:r.Graph,json:n(5710),alg:n(5280),version:r.version}},6666:function(e,t,n){var r=n(980);e.exports=function(e){var t,n={},i=[];function o(i){r.has(n,i)||(n[i]=!0,t.push(i),r.each(e.successors(i),o),r.each(e.predecessors(i),o))}return r.each(e.nodes(),(function(e){t=[],o(e),t.length&&i.push(t)})),i}},672:function(e,t,n){var r=n(980);function i(e,t,n,o,a,s){r.has(o,t)||(o[t]=!0,n||s.push(t),r.each(a(t),(function(t){i(e,t,n,o,a,s)})),n&&s.push(t))}e.exports=function(e,t,n){r.isArray(t)||(t=[t]);var o=(e.isDirected()?e.successors:e.neighbors).bind(e),a=[],s={};return r.each(t,(function(t){if(!e.hasNode(t))throw new Error("Graph does not have node: "+t);i(e,t,"post"===n,s,o,a)})),a}},9919:function(e,t,n){var r=n(4871),i=n(980);e.exports=function(e,t,n){return i.transform(e.nodes(),(function(i,o){i[o]=r(e,o,t,n)}),{})}},4871:function(e,t,n){var r=n(980),i=n(6071);e.exports=function(e,t,n,r){return function(e,t,n,r){var o,a,s={},l=new i,u=function(e){var t=e.v!==o?e.v:e.w,r=s[t],i=n(e),u=a.distance+i;if(i<0)throw new Error("dijkstra does not allow negative edge weights. Bad edge: "+e+" Weight: "+i);u0&&(o=l.removeMin(),(a=s[o]).distance!==Number.POSITIVE_INFINITY);)r(o).forEach(u);return s}(e,String(t),n||o,r||function(t){return e.outEdges(t)})};var o=r.constant(1)},6953:function(e,t,n){var r=n(980),i=n(8172);e.exports=function(e){return r.filter(i(e),(function(t){return t.length>1||1===t.length&&e.hasEdge(t[0],t[0])}))}},5053:function(e,t,n){var r=n(980);e.exports=function(e,t,n){return function(e,t,n){var r={},i=e.nodes();return i.forEach((function(e){r[e]={},r[e][e]={distance:0},i.forEach((function(t){e!==t&&(r[e][t]={distance:Number.POSITIVE_INFINITY})})),n(e).forEach((function(n){var i=n.v===e?n.w:n.v,o=t(n);r[e][i]={distance:o,predecessor:e}}))})),i.forEach((function(e){var t=r[e];i.forEach((function(n){var o=r[n];i.forEach((function(n){var r=o[e],i=t[n],a=o[n],s=r.distance+i.distance;s0;){if(n=l.removeMin(),r.has(s,n))a.setEdge(n,s[n]);else{if(c)throw new Error("Input graph is not connected: "+e);c=!0}e.nodeEdges(n).forEach(u)}return a}},8172:function(e,t,n){var r=n(980);e.exports=function(e){var t=0,n=[],i={},o=[];function a(s){var l=i[s]={onStack:!0,lowlink:t,index:t++};if(n.push(s),e.successors(s).forEach((function(e){r.has(i,e)?i[e].onStack&&(l.lowlink=Math.min(l.lowlink,i[e].index)):(a(e),l.lowlink=Math.min(l.lowlink,i[e].lowlink))})),l.lowlink===l.index){var u,c=[];do{u=n.pop(),i[u].onStack=!1,c.push(u)}while(s!==u);o.push(c)}}return e.nodes().forEach((function(e){r.has(i,e)||a(e)})),o}},1731:function(e,t,n){var r=n(980);function i(e){var t={},n={},i=[];if(r.each(e.sinks(),(function a(s){if(r.has(n,s))throw new o;r.has(t,s)||(n[s]=!0,t[s]=!0,r.each(e.predecessors(s),a),delete n[s],i.push(s))})),r.size(t)!==e.nodeCount())throw new o;return i}function o(){}e.exports=i,i.CycleException=o,o.prototype=new Error},6071:function(e,t,n){var r=n(980);function i(){this._arr=[],this._keyIndices={}}e.exports=i,i.prototype.size=function(){return this._arr.length},i.prototype.keys=function(){return this._arr.map((function(e){return e.key}))},i.prototype.has=function(e){return r.has(this._keyIndices,e)},i.prototype.priority=function(e){var t=this._keyIndices[e];if(void 0!==t)return this._arr[t].priority},i.prototype.min=function(){if(0===this.size())throw new Error("Queue underflow");return this._arr[0].key},i.prototype.add=function(e,t){var n=this._keyIndices;if(e=String(e),!r.has(n,e)){var i=this._arr,o=i.length;return n[e]=o,i.push({key:e,priority:t}),this._decrease(o),!0}return!1},i.prototype.removeMin=function(){this._swap(0,this._arr.length-1);var e=this._arr.pop();return delete this._keyIndices[e.key],this._heapify(0),e.key},i.prototype.decrease=function(e,t){var n=this._keyIndices[e];if(t>this._arr[n].priority)throw new Error("New priority is greater than current priority. Key: "+e+" Old: "+this._arr[n].priority+" New: "+t);this._arr[n].priority=t,this._decrease(n)},i.prototype._heapify=function(e){var t=this._arr,n=2*e,r=n+1,i=e;n>1].priorityl){var u=s;s=l,l=u}return s+a+l+a+(r.isUndefined(o)?i:o)}function d(e,t){return c(e,t.v,t.w,t.name)}s.prototype._nodeCount=0,s.prototype._edgeCount=0,s.prototype.isDirected=function(){return this._isDirected},s.prototype.isMultigraph=function(){return this._isMultigraph},s.prototype.isCompound=function(){return this._isCompound},s.prototype.setGraph=function(e){return this._label=e,this},s.prototype.graph=function(){return this._label},s.prototype.setDefaultNodeLabel=function(e){return r.isFunction(e)||(e=r.constant(e)),this._defaultNodeLabelFn=e,this},s.prototype.nodeCount=function(){return this._nodeCount},s.prototype.nodes=function(){return r.keys(this._nodes)},s.prototype.sources=function(){var e=this;return r.filter(this.nodes(),(function(t){return r.isEmpty(e._in[t])}))},s.prototype.sinks=function(){var e=this;return r.filter(this.nodes(),(function(t){return r.isEmpty(e._out[t])}))},s.prototype.setNodes=function(e,t){var n=arguments,i=this;return r.each(e,(function(e){n.length>1?i.setNode(e,t):i.setNode(e)})),this},s.prototype.setNode=function(e,t){return r.has(this._nodes,e)?(arguments.length>1&&(this._nodes[e]=t),this):(this._nodes[e]=arguments.length>1?t:this._defaultNodeLabelFn(e),this._isCompound&&(this._parent[e]=o,this._children[e]={},this._children[o][e]=!0),this._in[e]={},this._preds[e]={},this._out[e]={},this._sucs[e]={},++this._nodeCount,this)},s.prototype.node=function(e){return this._nodes[e]},s.prototype.hasNode=function(e){return r.has(this._nodes,e)},s.prototype.removeNode=function(e){var t=this;if(r.has(this._nodes,e)){var n=function(e){t.removeEdge(t._edgeObjs[e])};delete this._nodes[e],this._isCompound&&(this._removeFromParentsChildList(e),delete this._parent[e],r.each(this.children(e),(function(e){t.setParent(e)})),delete this._children[e]),r.each(r.keys(this._in[e]),n),delete this._in[e],delete this._preds[e],r.each(r.keys(this._out[e]),n),delete this._out[e],delete this._sucs[e],--this._nodeCount}return this},s.prototype.setParent=function(e,t){if(!this._isCompound)throw new Error("Cannot set parent in a non-compound graph");if(r.isUndefined(t))t=o;else{for(var n=t+="";!r.isUndefined(n);n=this.parent(n))if(n===e)throw new Error("Setting "+t+" as parent of "+e+" would create a cycle");this.setNode(t)}return this.setNode(e),this._removeFromParentsChildList(e),this._parent[e]=t,this._children[t][e]=!0,this},s.prototype._removeFromParentsChildList=function(e){delete this._children[this._parent[e]][e]},s.prototype.parent=function(e){if(this._isCompound){var t=this._parent[e];if(t!==o)return t}},s.prototype.children=function(e){if(r.isUndefined(e)&&(e=o),this._isCompound){var t=this._children[e];if(t)return r.keys(t)}else{if(e===o)return this.nodes();if(this.hasNode(e))return[]}},s.prototype.predecessors=function(e){var t=this._preds[e];if(t)return r.keys(t)},s.prototype.successors=function(e){var t=this._sucs[e];if(t)return r.keys(t)},s.prototype.neighbors=function(e){var t=this.predecessors(e);if(t)return r.union(t,this.successors(e))},s.prototype.isLeaf=function(e){return 0===(this.isDirected()?this.successors(e):this.neighbors(e)).length},s.prototype.filterNodes=function(e){var t=new this.constructor({directed:this._isDirected,multigraph:this._isMultigraph,compound:this._isCompound});t.setGraph(this.graph());var n=this;r.each(this._nodes,(function(n,r){e(r)&&t.setNode(r,n)})),r.each(this._edgeObjs,(function(e){t.hasNode(e.v)&&t.hasNode(e.w)&&t.setEdge(e,n.edge(e))}));var i={};function o(e){var r=n.parent(e);return void 0===r||t.hasNode(r)?(i[e]=r,r):r in i?i[r]:o(r)}return this._isCompound&&r.each(t.nodes(),(function(e){t.setParent(e,o(e))})),t},s.prototype.setDefaultEdgeLabel=function(e){return r.isFunction(e)||(e=r.constant(e)),this._defaultEdgeLabelFn=e,this},s.prototype.edgeCount=function(){return this._edgeCount},s.prototype.edges=function(){return r.values(this._edgeObjs)},s.prototype.setPath=function(e,t){var n=this,i=arguments;return r.reduce(e,(function(e,r){return i.length>1?n.setEdge(e,r,t):n.setEdge(e,r),r})),this},s.prototype.setEdge=function(){var e,t,n,i,o=!1,a=arguments[0];"object"===typeof a&&null!==a&&"v"in a?(e=a.v,t=a.w,n=a.name,2===arguments.length&&(i=arguments[1],o=!0)):(e=a,t=arguments[1],n=arguments[3],arguments.length>2&&(i=arguments[2],o=!0)),e=""+e,t=""+t,r.isUndefined(n)||(n=""+n);var s=c(this._isDirected,e,t,n);if(r.has(this._edgeLabels,s))return o&&(this._edgeLabels[s]=i),this;if(!r.isUndefined(n)&&!this._isMultigraph)throw new Error("Cannot set a named edge when isMultigraph = false");this.setNode(e),this.setNode(t),this._edgeLabels[s]=o?i:this._defaultEdgeLabelFn(e,t,n);var u=function(e,t,n,r){var i=""+t,o=""+n;if(!e&&i>o){var a=i;i=o,o=a}var s={v:i,w:o};r&&(s.name=r);return s}(this._isDirected,e,t,n);return e=u.v,t=u.w,Object.freeze(u),this._edgeObjs[s]=u,l(this._preds[t],e),l(this._sucs[e],t),this._in[t][s]=u,this._out[e][s]=u,this._edgeCount++,this},s.prototype.edge=function(e,t,n){var r=1===arguments.length?d(this._isDirected,arguments[0]):c(this._isDirected,e,t,n);return this._edgeLabels[r]},s.prototype.hasEdge=function(e,t,n){var i=1===arguments.length?d(this._isDirected,arguments[0]):c(this._isDirected,e,t,n);return r.has(this._edgeLabels,i)},s.prototype.removeEdge=function(e,t,n){var r=1===arguments.length?d(this._isDirected,arguments[0]):c(this._isDirected,e,t,n),i=this._edgeObjs[r];return i&&(e=i.v,t=i.w,delete this._edgeLabels[r],delete this._edgeObjs[r],u(this._preds[t],e),u(this._sucs[e],t),delete this._in[t][r],delete this._out[e][r],this._edgeCount--),this},s.prototype.inEdges=function(e,t){var n=this._in[e];if(n){var i=r.values(n);return t?r.filter(i,(function(e){return e.v===t})):i}},s.prototype.outEdges=function(e,t){var n=this._out[e];if(n){var i=r.values(n);return t?r.filter(i,(function(e){return e.w===t})):i}},s.prototype.nodeEdges=function(e,t){var n=this.inEdges(e,t);if(n)return n.concat(this.outEdges(e,t))}},5828:function(e,t,n){e.exports={Graph:n(1311),version:n(4161)}},5710:function(e,t,n){var r=n(980),i=n(1311);function o(e){return r.map(e.nodes(),(function(t){var n=e.node(t),i=e.parent(t),o={v:t};return r.isUndefined(n)||(o.value=n),r.isUndefined(i)||(o.parent=i),o}))}function a(e){return r.map(e.edges(),(function(t){var n=e.edge(t),i={v:t.v,w:t.w};return r.isUndefined(t.name)||(i.name=t.name),r.isUndefined(n)||(i.value=n),i}))}e.exports={write:function(e){var t={options:{directed:e.isDirected(),multigraph:e.isMultigraph(),compound:e.isCompound()},nodes:o(e),edges:a(e)};r.isUndefined(e.graph())||(t.value=r.clone(e.graph()));return t},read:function(e){var t=new i(e.options).setGraph(e.value);return r.each(e.nodes,(function(e){t.setNode(e.v,e.value),e.parent&&t.setParent(e.v,e.parent)})),r.each(e.edges,(function(e){t.setEdge({v:e.v,w:e.w,name:e.name},e.value)})),t}}},980:function(e,t,n){var r;try{r={clone:n(8787),constant:n(1547),each:n(9430),filter:n(86),has:n(7805),isArray:n(3629),isEmpty:n(6364),isFunction:n(4786),isUndefined:n(2530),keys:n(2742),map:n(2034),reduce:n(5080),size:n(9467),transform:n(5653),union:n(6310),values:n(2063)}}catch(i){}r||(r=window._),e.exports=r},4161:function(e){e.exports="2.1.8"},5641:function(e,t,n){e.exports=n(2132)},2132:function(e,t){var n,r,i;(function(){var o,a,s,l,u,c,d,f,h,p,g,v,m,y,b;s=Math.floor,p=Math.min,a=function(e,t){return et?1:0},h=function(e,t,n,r,i){var o;if(null==n&&(n=0),null==i&&(i=a),n<0)throw new Error("lo must be non-negative");for(null==r&&(r=e.length);nn;0<=n?t++:t--)u.push(t);return u}.apply(this).reverse(),l=[],r=0,i=o.length;rg;0<=g?++c:--c)v.push(u(e,n));return v},y=function(e,t,n,r){var i,o,s;for(null==r&&(r=a),i=e[n];n>t&&r(i,o=e[s=n-1>>1])<0;)e[n]=o,n=s;return e[n]=i},b=function(e,t,n){var r,i,o,s,l;for(null==n&&(n=a),i=e.length,l=t,o=e[t],r=2*t+1;r-1}},2683:function(e){e.exports=function(e,t,n){for(var r=-1,i=null==e?0:e.length;++r0&&o(c)?n>1?e(c,n-1,o,a,s):r(s,c):a||(s[s.length]=c)}return s}},5099:function(e,t,n){var r=n(372)();e.exports=r},5358:function(e,t,n){var r=n(5099),i=n(2742);e.exports=function(e,t){return e&&r(e,t,i)}},8667:function(e,t,n){var r=n(3082),i=n(9793);e.exports=function(e,t){for(var n=0,o=(t=r(t,e)).length;null!=e&&nt}},7852:function(e){var t=Object.prototype.hasOwnProperty;e.exports=function(e,n){return null!=e&&t.call(e,n)}},529:function(e){e.exports=function(e,t){return null!=e&&t in Object(e)}},4842:function(e,t,n){var r=n(2045),i=n(505),o=n(7167);e.exports=function(e,t,n){return t===t?o(e,t,n):r(e,i,n)}},4906:function(e,t,n){var r=n(9066),i=n(3141),o="[object Arguments]";e.exports=function(e){return i(e)&&r(e)==o}},1848:function(e,t,n){var r=n(3355),i=n(3141);e.exports=function e(t,n,o,a,s){return t===n||(null==t||null==n||!i(t)&&!i(n)?t!==t&&n!==n:r(t,n,o,a,e,s))}},3355:function(e,t,n){var r=n(2854),i=n(5305),o=n(2206),a=n(8078),s=n(8383),l=n(3629),u=n(5174),c=n(9102),d=1,f="[object Arguments]",h="[object Array]",p="[object Object]",g=Object.prototype.hasOwnProperty;e.exports=function(e,t,n,v,m,y){var b=l(e),x=l(t),_=b?h:s(e),w=x?h:s(t),k=(_=_==f?p:_)==p,E=(w=w==f?p:w)==p,S=_==w;if(S&&u(e)){if(!u(t))return!1;b=!0,k=!1}if(S&&!k)return y||(y=new r),b||c(e)?i(e,t,n,v,m,y):o(e,t,_,n,v,m,y);if(!(n&d)){var C=k&&g.call(e,"__wrapped__"),P=E&&g.call(t,"__wrapped__");if(C||P){var T=C?e.value():e,O=P?t.value():t;return y||(y=new r),m(T,O,n,v,y)}}return!!S&&(y||(y=new r),a(e,t,n,v,m,y))}},3085:function(e,t,n){var r=n(8383),i=n(3141),o="[object Map]";e.exports=function(e){return i(e)&&r(e)==o}},8856:function(e,t,n){var r=n(2854),i=n(1848),o=1,a=2;e.exports=function(e,t,n,s){var l=n.length,u=l,c=!s;if(null==e)return!u;for(e=Object(e);l--;){var d=n[l];if(c&&d[2]?d[1]!==e[d[0]]:!(d[0]in e))return!1}for(;++l=u){var v=t?null:s(e);if(v)return l(v);h=!1,d=a,g=new r}else g=t?[]:p;e:for(;++ct||a&&s&&u&&!l&&!c||i&&s&&u||!n&&u||!o)return 1;if(!i&&!a&&!c&&e=l?u:u*("desc"==n[i]?-1:1)}return e.index-t.index}},291:function(e){e.exports=function(e,t){var n=-1,r=e.length;for(t||(t=Array(r));++n1?n[o-1]:void 0,s=o>2?n[2]:void 0;for(a=e.length>3&&"function"==typeof a?(o--,a):void 0,s&&i(n[0],n[1],s)&&(a=o<3?void 0:a,o=1),t=Object(t);++r-1?s[l?t[u]:u]:void 0}}},6381:function(e,t,n){var r=n(7255),i=n(3195),o=n(1495);e.exports=function(e){return function(t,n,a){return a&&"number"!=typeof a&&i(t,n,a)&&(n=a=void 0),t=o(t),void 0===n?(n=t,t=0):n=o(n),a=void 0===a?tf))return!1;var p=c.get(e),g=c.get(t);if(p&&g)return p==t&&g==e;var v=-1,m=!0,y=n&s?new r:void 0;for(c.set(e,t),c.set(t,e);++v-1&&e%1==0&&e-1}},7109:function(e,t,n){var r=n(7112);e.exports=function(e,t){var n=this.__data__,i=r(n,e);return i<0?(++this.size,n.push([e,t])):n[i][1]=t,this}},4086:function(e,t,n){var r=n(9676),i=n(8384),o=n(5797);e.exports=function(){this.size=0,this.__data__={hash:new r,map:new(o||i),string:new r}}},9255:function(e,t,n){var r=n(2799);e.exports=function(e){var t=r(this,e).delete(e);return this.size-=t?1:0,t}},9186:function(e,t,n){var r=n(2799);e.exports=function(e){return r(this,e).get(e)}},3423:function(e,t,n){var r=n(2799);e.exports=function(e){return r(this,e).has(e)}},3739:function(e,t,n){var r=n(2799);e.exports=function(e,t){var n=r(this,e),i=n.size;return n.set(e,t),this.size+=n.size==i?0:1,this}},234:function(e){e.exports=function(e){var t=-1,n=Array(e.size);return e.forEach((function(e,r){n[++t]=[r,e]})),n}},284:function(e){e.exports=function(e,t){return function(n){return null!=n&&(n[e]===t&&(void 0!==t||e in Object(n)))}}},4634:function(e,t,n){var r=n(9151),i=500;e.exports=function(e){var t=r(e,(function(e){return n.size===i&&n.clear(),e})),n=t.cache;return t}},9620:function(e,t,n){var r=n(8136)(Object,"create");e.exports=r},8836:function(e,t,n){var r=n(2709)(Object.keys,Object);e.exports=r},4221:function(e){e.exports=function(e){var t=[];if(null!=e)for(var n in Object(e))t.push(n);return t}},9494:function(e,t,n){e=n.nmd(e);var r=n(1032),i=t&&!t.nodeType&&t,o=i&&e&&!e.nodeType&&e,a=o&&o.exports===i&&r.process,s=function(){try{var e=o&&o.require&&o.require("util").types;return e||a&&a.binding&&a.binding("util")}catch(t){}}();e.exports=s},3581:function(e){var t=Object.prototype.toString;e.exports=function(e){return t.call(e)}},2709:function(e){e.exports=function(e,t){return function(n){return e(t(n))}}},4262:function(e,t,n){var r=n(3665),i=Math.max;e.exports=function(e,t,n){return t=i(void 0===t?e.length-1:t,0),function(){for(var o=arguments,a=-1,s=i(o.length-t,0),l=Array(s);++a0){if(++i>=t)return arguments[0]}else i=0;return e.apply(void 0,arguments)}}},511:function(e,t,n){var r=n(8384);e.exports=function(){this.__data__=new r,this.size=0}},835:function(e){e.exports=function(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n}},707:function(e){e.exports=function(e){return this.__data__.get(e)}},8832:function(e){e.exports=function(e){return this.__data__.has(e)}},5077:function(e,t,n){var r=n(8384),i=n(5797),o=n(8059),a=200;e.exports=function(e,t){var n=this.__data__;if(n instanceof r){var s=n.__data__;if(!i||s.length=t||n<0||m&&e-g>=d}function _(){var e=i();if(x(e))return w(e);h=setTimeout(_,function(e){var n=t-(e-p);return m?l(n,d-(e-g)):n}(e))}function w(e){return h=void 0,y&&u?b(e):(u=c=void 0,f)}function k(){var e=i(),n=x(e);if(u=arguments,c=this,p=e,n){if(void 0===h)return function(e){return g=e,h=setTimeout(_,t),v?b(e):f}(p);if(m)return clearTimeout(h),h=setTimeout(_,t),b(p)}return void 0===h&&(h=setTimeout(_,t)),f}return t=o(t)||0,r(n)&&(v=!!n.leading,d=(m="maxWait"in n)?s(o(n.maxWait)||0,t):d,y="trailing"in n?!!n.trailing:y),k.cancel=function(){void 0!==h&&clearTimeout(h),g=0,u=p=c=h=void 0},k.flush=function(){return void 0===h?f:w(i())},k}},6933:function(e,t,n){var r=n(8794),i=n(9231),o=n(3195),a=n(3961),s=Object.prototype,l=s.hasOwnProperty,u=r((function(e,t){e=Object(e);var n=-1,r=t.length,u=r>2?t[2]:void 0;for(u&&o(t[0],t[1],u)&&(r=1);++n-1&&e%1==0&&e<=t}},103:function(e,t,n){var r=n(3085),i=n(6194),o=n(9494),a=o&&o.isMap,s=a?i(a):r;e.exports=s},8092:function(e){e.exports=function(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}},3141:function(e){e.exports=function(e){return null!=e&&"object"==typeof e}},3977:function(e,t,n){var r=n(9066),i=n(1137),o=n(3141),a="[object Object]",s=Function.prototype,l=Object.prototype,u=s.toString,c=l.hasOwnProperty,d=u.call(Object);e.exports=function(e){if(!o(e)||r(e)!=a)return!1;var t=i(e);if(null===t)return!0;var n=c.call(t,"constructor")&&t.constructor;return"function"==typeof n&&n instanceof n&&u.call(n)==d}},6995:function(e,t,n){var r=n(8680),i=n(6194),o=n(9494),a=o&&o.isSet,s=a?i(a):r;e.exports=s},6769:function(e,t,n){var r=n(9066),i=n(3629),o=n(3141),a="[object String]";e.exports=function(e){return"string"==typeof e||!i(e)&&o(e)&&r(e)==a}},152:function(e,t,n){var r=n(9066),i=n(3141),o="[object Symbol]";e.exports=function(e){return"symbol"==typeof e||i(e)&&r(e)==o}},9102:function(e,t,n){var r=n(8150),i=n(6194),o=n(9494),a=o&&o.isTypedArray,s=a?i(a):r;e.exports=s},2530:function(e){e.exports=function(e){return void 0===e}},2742:function(e,t,n){var r=n(7538),i=n(3654),o=n(1473);e.exports=function(e){return o(e)?r(e):i(e)}},3961:function(e,t,n){var r=n(7538),i=n(8664),o=n(1473);e.exports=function(e){return o(e)?r(e,!0):i(e)}},5727:function(e){e.exports=function(e){var t=null==e?0:e.length;return t?e[t-1]:void 0}},2034:function(e,t,n){var r=n(8950),i=n(6025),o=n(3849),a=n(3629);e.exports=function(e,t){return(a(e)?r:o)(e,i(t,3))}},7702:function(e,t,n){var r=n(2526),i=n(5358),o=n(6025);e.exports=function(e,t){var n={};return t=o(t,3),i(e,(function(e,i,o){r(n,i,t(e,i,o))})),n}},9627:function(e,t,n){var r=n(3079),i=n(1954),o=n(2100);e.exports=function(e){return e&&e.length?r(e,o,i):void 0}},9151:function(e,t,n){var r=n(8059),i="Expected a function";function o(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new TypeError(i);var n=function n(){var r=arguments,i=t?t.apply(this,r):r[0],o=n.cache;if(o.has(i))return o.get(i);var a=e.apply(this,r);return n.cache=o.set(i,a)||o,a};return n.cache=new(o.Cache||r),n}o.Cache=r,e.exports=o},9286:function(e,t,n){var r=n(4173),i=n(9934)((function(e,t,n){r(e,t,n)}));e.exports=i},6452:function(e,t,n){var r=n(3079),i=n(2580),o=n(2100);e.exports=function(e){return e&&e.length?r(e,o,i):void 0}},3638:function(e,t,n){var r=n(3079),i=n(6025),o=n(2580);e.exports=function(e,t){return e&&e.length?r(e,i(t,2),o):void 0}},9694:function(e){e.exports=function(){}},72:function(e,t,n){var r=n(7009);e.exports=function(){return r.Date.now()}},6460:function(e,t,n){var r=n(4980),i=n(7038)((function(e,t){return null==e?{}:r(e,t)}));e.exports=i},38:function(e,t,n){var r=n(9586),i=n(4084),o=n(5823),a=n(9793);e.exports=function(e){return o(e)?r(a(e)):i(e)}},6222:function(e,t,n){var r=n(6381)();e.exports=r},5080:function(e,t,n){var r=n(2095),i=n(7927),o=n(6025),a=n(750),s=n(3629);e.exports=function(e,t,n){var l=s(e)?r:a,u=arguments.length<3;return l(e,o(t,4),n,u,i)}},4485:function(e,t,n){var r=n(379);e.exports=function(e,t,n){return null==e?e:r(e,t,n)}},9467:function(e,t,n){var r=n(3654),i=n(8383),o=n(1473),a=n(6769),s=n(4651),l="[object Map]",u="[object Set]";e.exports=function(e){if(null==e)return 0;if(o(e))return a(e)?s(e):e.length;var t=i(e);return t==l||t==u?e.size:r(e).length}},4286:function(e,t,n){var r=n(5182),i=n(3226),o=n(8794),a=n(3195),s=o((function(e,t){if(null==e)return[];var n=t.length;return n>1&&a(e,t[0],t[1])?t=[]:n>2&&a(t[0],t[1],t[2])&&(t=[t[0]]),i(e,r(t,1),[])}));e.exports=s},8174:function(e){e.exports=function(){return[]}},9488:function(e){e.exports=function(){return!1}},1495:function(e,t,n){var r=n(2582),i=1/0,o=17976931348623157e292;e.exports=function(e){return e?(e=r(e))===i||e===-i?(e<0?-1:1)*o:e===e?e:0:0===e?e:0}},9753:function(e,t,n){var r=n(1495);e.exports=function(e){var t=r(e),n=t%1;return t===t?n?t-n:t:0}},2582:function(e,t,n){var r=n(821),i=n(8092),o=n(152),a=NaN,s=/^[-+]0x[0-9a-f]+$/i,l=/^0b[01]+$/i,u=/^0o[0-7]+$/i,c=parseInt;e.exports=function(e){if("number"==typeof e)return e;if(o(e))return a;if(i(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=i(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=r(e);var n=l.test(e);return n||u.test(e)?c(e.slice(2),n?2:8):s.test(e)?a:+e}},168:function(e,t,n){var r=n(8950),i=n(291),o=n(3629),a=n(152),s=n(170),l=n(9793),u=n(3518);e.exports=function(e){return o(e)?r(e,l):a(e)?[e]:i(s(u(e)))}},6576:function(e,t,n){var r=n(4503),i=n(3961);e.exports=function(e){return r(e,i(e))}},3518:function(e,t,n){var r=n(2446);e.exports=function(e){return null==e?"":r(e)}},5653:function(e,t,n){var r=n(4550),i=n(5763),o=n(5358),a=n(6025),s=n(1137),l=n(3629),u=n(5174),c=n(4786),d=n(8092),f=n(9102);e.exports=function(e,t,n){var h=l(e),p=h||u(e)||f(e);if(t=a(t,4),null==n){var g=e&&e.constructor;n=p?h?new g:[]:d(e)&&c(g)?i(s(e)):{}}return(p?r:o)(e,(function(e,r,i){return t(n,e,r,i)})),n}},6310:function(e,t,n){var r=n(5182),i=n(8794),o=n(9602),a=n(6279),s=i((function(e){return o(r(e,1,a,!0))}));e.exports=s},804:function(e,t,n){var r=n(3518),i=0;e.exports=function(e){var t=++i;return r(e)+t}},2063:function(e,t,n){var r=n(8019),i=n(2742);e.exports=function(e){return null==e?[]:r(e,i(e))}},4827:function(e,t,n){var r=n(8463),i=n(2971);e.exports=function(e,t){return i(e||[],t||[],r)}},888:function(e,t,n){"use strict";var r=n(9047);function i(){}function o(){}o.resetWarningCache=i,e.exports=function(){function e(e,t,n,i,o,a){if(a!==r){var s=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw s.name="Invariant Violation",s}}function t(){return e}e.isRequired=e;var n={array:e,bigint:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,elementType:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t,checkPropTypes:o,resetWarningCache:i};return n.PropTypes=n,n}},2007:function(e,t,n){e.exports=n(888)()},9047:function(e){"use strict";e.exports="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"},4463:function(e,t,n){"use strict";var r=n(2791),i=n(5296);function o(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,n=1;n