@babsey/code-graph 0.6.3 → 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/code-graph.css +1 -1
- package/dist/code-graph.js +1788 -1785
- package/dist/code-graph.umd.cjs +8 -8
- package/package.json +5 -8
package/dist/code-graph.umd.cjs
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
(function(p,r){typeof exports=="object"&&typeof module<"u"?r(exports,require("vue"),require("@baklavajs/renderer-vue"),require("@baklavajs/core"),require("@vueuse/core"),require("mustache"),require("uuid"),require("@baklavajs/interface-types"),require("@baklavajs/engine"),require("toposort"),require("@baklavajs/events")):typeof define=="function"&&define.amd?define(["exports","vue","@baklavajs/renderer-vue","@baklavajs/core","@vueuse/core","mustache","uuid","@baklavajs/interface-types","@baklavajs/engine","toposort","@baklavajs/events"],r):(p=typeof globalThis<"u"?globalThis:p||self,r(p["@babsey/code-graph"]={},p.vue,p["@baklavajs/renderer-vue"],p["@baklavajs/core"],p["@vueuse/core"],p.mustache,p.uuid,p["@baklavajs/interface-types"],p["@baklavajs/engine"],p.toposort,p["@baklavajs/events"]))})(this,(function(p,r,S,Z,La,Ve,De,G,ue,Aa,Xn){"use strict";const j=(e,t)=>{const n=e.__vccOpts||e;for(const[s,a]of t)n[s]=a;return n},Ua={},Wa={xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"baklava-icon icon icon-tabler icons-tabler-outline icon-tabler-check"};function $a(e,t){return r.openBlock(),r.createElementBlock("svg",Wa,[...t[0]||(t[0]=[r.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),r.createElementVNode("path",{d:"M5 12l5 5l10 -10"},null,-1)])])}const Kn=j(Ua,[["render",$a]]),Ha={},Fa={xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"baklava-icon icon icon-tabler icons-tabler-outline icon-tabler-code-variable"};function Ga(e,t){return r.openBlock(),r.createElementBlock("svg",Fa,[...t[0]||(t[0]=[r.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),r.createElementVNode("path",{d:"M4 8m0 2a2 2 0 0 1 2 -2h12a2 2 0 0 1 2 2v4a2 2 0 0 1 -2 2h-12a2 2 0 0 1 -2 -2z"},null,-1)])])}const Qn=j(Ha,[["render",Ga]]),ja={},za={xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"baklava-icon icon icon-tabler icons-tabler-outline icon-tabler-copy"};function Za(e,t){return r.openBlock(),r.createElementBlock("svg",za,[...t[0]||(t[0]=[r.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),r.createElementVNode("path",{d:"M7 7m0 2.667a2.667 2.667 0 0 1 2.667 -2.667h8.666a2.667 2.667 0 0 1 2.667 2.667v8.666a2.667 2.667 0 0 1 -2.667 2.667h-8.666a2.667 2.667 0 0 1 -2.667 -2.667z"},null,-1),r.createElementVNode("path",{d:"M4.012 16.737a2.005 2.005 0 0 1 -1.012 -1.737v-10c0 -1.1 .9 -2 2 -2h10c.75 0 1.158 .385 1.5 1"},null,-1)])])}const es=j(ja,[["render",Za]]),qa={},Ja={xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"baklava-icon icon icon-tabler icons-tabler-outline icon-tabler-dots-vertical"};function Xa(e,t){return r.openBlock(),r.createElementBlock("svg",Ja,[...t[0]||(t[0]=[r.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),r.createElementVNode("path",{d:"M12 12m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0"},null,-1),r.createElementVNode("path",{d:"M12 19m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0"},null,-1),r.createElementVNode("path",{d:"M12 5m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0"},null,-1)])])}const ts=j(qa,[["render",Xa]]),Ka={},Qa={xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"baklava-icon icon icon-tabler icons-tabler-outline icon-tabler-download"};function er(e,t){return r.openBlock(),r.createElementBlock("svg",Qa,[...t[0]||(t[0]=[r.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),r.createElementVNode("path",{d:"M4 17v2a2 2 0 0 0 2 2h12a2 2 0 0 0 2 -2v-2"},null,-1),r.createElementVNode("path",{d:"M7 11l5 5l5 -5"},null,-1),r.createElementVNode("path",{d:"M12 4l0 12"},null,-1)])])}const ns=j(Ka,[["render",er]]),tr={},nr={xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"currentColor",class:"baklava-icon icon icon-tabler icons-tabler-filled icon-tabler-layout-sidebar-left-collapse"};function sr(e,t){return r.openBlock(),r.createElementBlock("svg",nr,[...t[0]||(t[0]=[r.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),r.createElementVNode("path",{d:"M18 3a3 3 0 0 1 2.995 2.824l.005 .176v12a3 3 0 0 1 -2.824 2.995l-.176 .005h-12a3 3 0 0 1 -2.995 -2.824l-.005 -.176v-12a3 3 0 0 1 2.824 -2.995l.176 -.005h12zm0 2h-9v14h9a1 1 0 0 0 .993 -.883l.007 -.117v-12a1 1 0 0 0 -.883 -.993l-.117 -.007zm-2.293 4.293a1 1 0 0 1 .083 1.32l-.083 .094l-1.292 1.293l1.292 1.293a1 1 0 0 1 .083 1.32l-.083 .094a1 1 0 0 1 -1.32 .083l-.094 -.083l-2 -2a1 1 0 0 1 -.083 -1.32l.083 -.094l2 -2a1 1 0 0 1 1.414 0z"},null,-1)])])}const ss=j(tr,[["render",sr]]),ar={},rr={xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"currentColor",class:"baklava-icon icon icon-tabler icons-tabler-filled icon-tabler-layout-sidebar-left-expand"};function or(e,t){return r.openBlock(),r.createElementBlock("svg",rr,[...t[0]||(t[0]=[r.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),r.createElementVNode("path",{d:"M18 3a3 3 0 0 1 2.995 2.824l.005 .176v12a3 3 0 0 1 -2.824 2.995l-.176 .005h-12a3 3 0 0 1 -2.995 -2.824l-.005 -.176v-12a3 3 0 0 1 2.824 -2.995l.176 -.005h12zm0 2h-9v14h9a1 1 0 0 0 .993 -.883l.007 -.117v-12a1 1 0 0 0 -.883 -.993l-.117 -.007zm-4.387 4.21l.094 .083l2 2a1 1 0 0 1 .083 1.32l-.083 .094l-2 2a1 1 0 0 1 -1.497 -1.32l.083 -.094l1.292 -1.293l-1.292 -1.293a1 1 0 0 1 -.083 -1.32l.083 -.094a1 1 0 0 1 1.32 -.083z"},null,-1)])])}const as=j(ar,[["render",or]]),ir={},lr={xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"currentColor",class:"baklava-icon icon icon-tabler icons-tabler-filled icon-tabler-layout-sidebar-right"};function dr(e,t){return r.openBlock(),r.createElementBlock("svg",lr,[...t[0]||(t[0]=[r.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),r.createElementVNode("path",{d:"M6 21a3 3 0 0 1 -3 -3v-12a3 3 0 0 1 3 -3h12a3 3 0 0 1 3 3v12a3 3 0 0 1 -3 3zm8 -16h-8a1 1 0 0 0 -1 1v12a1 1 0 0 0 1 1h8z"},null,-1)])])}const rs=j(ir,[["render",dr]]),cr={},ur={xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"currentColor",class:"baklava-icon icon icon-tabler icons-tabler-filled icon-tabler-layout-sidebar-right-collapse"};function hr(e,t){return r.openBlock(),r.createElementBlock("svg",ur,[...t[0]||(t[0]=[r.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),r.createElementVNode("path",{d:"M18 3a3 3 0 0 1 2.995 2.824l.005 .176v12a3 3 0 0 1 -2.824 2.995l-.176 .005h-12a3 3 0 0 1 -2.995 -2.824l-.005 -.176v-12a3 3 0 0 1 2.824 -2.995l.176 -.005h12zm-3 2h-9a1 1 0 0 0 -.993 .883l-.007 .117v12a1 1 0 0 0 .883 .993l.117 .007h9v-14zm-5.387 4.21l.094 .083l2 2a1 1 0 0 1 .083 1.32l-.083 .094l-2 2a1 1 0 0 1 -1.497 -1.32l.083 -.094l1.292 -1.293l-1.292 -1.293a1 1 0 0 1 -.083 -1.32l.083 -.094a1 1 0 0 1 1.32 -.083z"},null,-1)])])}const os=j(cr,[["render",hr]]),fr={},pr={xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"currentColor",class:"baklava-icon icon icon-tabler icons-tabler-filled icon-tabler-layout-sidebar-right-expand"};function mr(e,t){return r.openBlock(),r.createElementBlock("svg",pr,[...t[0]||(t[0]=[r.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),r.createElementVNode("path",{d:"M18 3a3 3 0 0 1 2.995 2.824l.005 .176v12a3 3 0 0 1 -2.824 2.995l-.176 .005h-12a3 3 0 0 1 -2.995 -2.824l-.005 -.176v-12a3 3 0 0 1 2.824 -2.995l.176 -.005h12zm-3 2h-9a1 1 0 0 0 -.993 .883l-.007 .117v12a1 1 0 0 0 .883 .993l.117 .007h9v-14zm-3.293 4.293a1 1 0 0 1 .083 1.32l-.083 .094l-1.292 1.293l1.292 1.293a1 1 0 0 1 .083 1.32l-.083 .094a1 1 0 0 1 -1.32 .083l-.094 -.083l-2 -2a1 1 0 0 1 -.083 -1.32l.083 -.094l2 -2a1 1 0 0 1 1.414 0z"},null,-1)])])}const is=j(fr,[["render",mr]]),_r={},yr={xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"baklava-icon icon icon-tabler icons-tabler-outline icon-tabler-lock-code"};function gr(e,t){return r.openBlock(),r.createElementBlock("svg",yr,[...t[0]||(t[0]=[r.createStaticVNode('<path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M11.5 21h-4.5a2 2 0 0 1 -2 -2v-6a2 2 0 0 1 2 -2h10a2 2 0 0 1 2 2"></path><path d="M11 16a1 1 0 1 0 2 0a1 1 0 0 0 -2 0"></path><path d="M8 11v-4a4 4 0 1 1 8 0v4"></path><path d="M20 21l2 -2l-2 -2"></path><path d="M17 17l-2 2l2 2"></path>',6)])])}const Wt=j(_r,[["render",gr]]),kr={},wr={xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"baklava-icon icon icon-tabler icons-tabler-outline icon-tabler-player-play"};function br(e,t){return r.openBlock(),r.createElementBlock("svg",wr,[...t[0]||(t[0]=[r.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),r.createElementVNode("path",{d:"M7 4v16l13 -8z"},null,-1)])])}const vr=j(kr,[["render",br]]),Nr={},Cr={xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"baklava-icon icon icon-tabler icons-tabler-outline icon-tabler-plus"};function Mr(e,t){return r.openBlock(),r.createElementBlock("svg",Cr,[...t[0]||(t[0]=[r.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),r.createElementVNode("path",{d:"M12 5l0 14"},null,-1),r.createElementVNode("path",{d:"M5 12l14 0"},null,-1)])])}const ls=j(Nr,[["render",Mr]]),Sr={},Or={xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"baklava-icon icon icon-tabler icons-tabler-outline icon-tabler-restore"};function Er(e,t){return r.openBlock(),r.createElementBlock("svg",Or,[...t[0]||(t[0]=[r.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),r.createElementVNode("path",{d:"M3.06 13a9 9 0 1 0 .49 -4.087"},null,-1),r.createElementVNode("path",{d:"M3 4.001v5h5"},null,-1),r.createElementVNode("path",{d:"M12 12m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0"},null,-1)])])}const ds=j(Sr,[["render",Er]]),Tr={},Ir={xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"baklava-icon icon icon-tabler icons-tabler-outline icon-tabler-schema"};function Dr(e,t){return r.openBlock(),r.createElementBlock("svg",Ir,[...t[0]||(t[0]=[r.createStaticVNode('<path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M5 2h5v4h-5z"></path><path d="M15 10h5v4h-5z"></path><path d="M5 18h5v4h-5z"></path><path d="M5 10h5v4h-5z"></path><path d="M10 12h5"></path><path d="M7.5 6v4"></path><path d="M7.5 14v4"></path>',8)])])}const cs=j(Tr,[["render",Dr]]),xr={},Yr={xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"baklava-icon icon icon-tabler icons-tabler-outline icon-tabler-schema-off"};function Rr(e,t){return r.openBlock(),r.createElementBlock("svg",Yr,[...t[0]||(t[0]=[r.createStaticVNode('<path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M6 2h4v4m-4 0h-1v-1"></path><path d="M15 11v-1h5v4h-2"></path><path d="M5 18h5v4h-5z"></path><path d="M5 10h5v4h-5z"></path><path d="M10 12h2"></path><path d="M7.5 7.5v2.5"></path><path d="M7.5 14v4"></path><path d="M3 3l18 18"></path>',9)])])}const us=j(xr,[["render",Rr]]),Pr={},Br={xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"baklava-icon icon icon-tabler icons-tabler-outline icon-tabler-transition-bottom"};function Vr(e,t){return r.openBlock(),r.createElementBlock("svg",Br,[...t[0]||(t[0]=[r.createStaticVNode('<path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M21 18a3 3 0 0 1 -3 3h-12a3 3 0 0 1 -3 -3"></path><path d="M3 3m0 3a3 3 0 0 1 3 -3h12a3 3 0 0 1 3 3v0a3 3 0 0 1 -3 3h-12a3 3 0 0 1 -3 -3z"></path><path d="M12 9v8"></path><path d="M9 14l3 3l3 -3"></path>',5)])])}const hs=j(Pr,[["render",Vr]]),Lr={},Ar={xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"baklava-icon icon icon-tabler icons-tabler-outline icon-tabler-upload"};function Ur(e,t){return r.openBlock(),r.createElementBlock("svg",Ar,[...t[0]||(t[0]=[r.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),r.createElementVNode("path",{d:"M4 17v2a2 2 0 0 0 2 2h12a2 2 0 0 0 2 -2v-2"},null,-1),r.createElementVNode("path",{d:"M7 9l5 -5l5 5"},null,-1),r.createElementVNode("path",{d:"M12 4l0 12"},null,-1)])])}const fs=j(Lr,[["render",Ur]]),Wr={},$r={xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"baklava-icon icon icon-tabler icons-tabler-outline icon-tabler-x"};function Hr(e,t){return r.openBlock(),r.createElementBlock("svg",$r,[...t[0]||(t[0]=[r.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),r.createElementVNode("path",{d:"M18 6l-12 12"},null,-1),r.createElementVNode("path",{d:"M6 6l12 12"},null,-1)])])}const ps=j(Wr,[["render",Hr]]),Fr=Object.freeze(Object.defineProperty({__proto__:null,Check:Kn,CodeVariable:Qn,Copy:es,DotsVertical:ts,Download:ns,LayoutSidebarLeftCollapse:ss,LayoutSidebarLeftExpand:as,LayoutSidebarRight:rs,LayoutSidebarRightCollapse:os,LayoutSidebarRightExpand:is,LockCode:Wt,PlayerPlay:vr,Plus:ls,Restore:ds,Schema:cs,SchemaOff:us,TransitionBottom:hs,Upload:fs,X:ps},Symbol.toStringTag,{value:"Module"}));function Gr(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var ct={exports:{}};var jr=ct.exports,ms;function zr(){return ms||(ms=1,(function(e,t){(function(s,a){e.exports=a()})(jr,function(){return(function(){var n={686:(function(o,i,l){l.d(i,{default:function(){return L}});var d=l(279),c=l.n(d),h=l(370),w=l.n(h),_=l(817),D=l.n(_);function k(b){try{return document.execCommand(b)}catch{return!1}}var M=function(m){var N=D()(m);return k("cut"),N},f=M;function v(b){var m=document.documentElement.getAttribute("dir")==="rtl",N=document.createElement("textarea");N.style.fontSize="12pt",N.style.border="0",N.style.padding="0",N.style.margin="0",N.style.position="absolute",N.style[m?"right":"left"]="-9999px";var E=window.pageYOffset||document.documentElement.scrollTop;return N.style.top="".concat(E,"px"),N.setAttribute("readonly",""),N.value=b,N}var U=function(m,N){var E=v(m);N.container.appendChild(E);var I=D()(E);return k("copy"),E.remove(),I},V=function(m){var N=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{container:document.body},E="";return typeof m=="string"?E=U(m,N):m instanceof HTMLInputElement&&!["text","search","url","tel","password"].includes(m?.type)?E=U(m.value,N):(E=D()(m),k("copy")),E},H=V;function Se(b){"@babel/helpers - typeof";return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Se=function(N){return typeof N}:Se=function(N){return N&&typeof Symbol=="function"&&N.constructor===Symbol&&N!==Symbol.prototype?"symbol":typeof N},Se(b)}var Oe=function(){var m=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},N=m.action,E=N===void 0?"copy":N,I=m.container,R=m.target,ce=m.text;if(E!=="copy"&&E!=="cut")throw new Error('Invalid "action" value, use either "copy" or "cut"');if(R!==void 0)if(R&&Se(R)==="object"&&R.nodeType===1){if(E==="copy"&&R.hasAttribute("disabled"))throw new Error('Invalid "target" attribute. Please use "readonly" instead of "disabled" attribute');if(E==="cut"&&(R.hasAttribute("readonly")||R.hasAttribute("disabled")))throw new Error(`Invalid "target" attribute. You can't cut text from elements with "readonly" or "disabled" attributes`)}else throw new Error('Invalid "target" value, use a valid Element');if(ce)return H(ce,{container:I});if(R)return E==="cut"?f(R):H(R,{container:I})},lt=Oe;function _e(b){"@babel/helpers - typeof";return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?_e=function(N){return typeof N}:_e=function(N){return N&&typeof Symbol=="function"&&N.constructor===Symbol&&N!==Symbol.prototype?"symbol":typeof N},_e(b)}function O(b,m){if(!(b instanceof m))throw new TypeError("Cannot call a class as a function")}function J(b,m){for(var N=0;N<m.length;N++){var E=m[N];E.enumerable=E.enumerable||!1,E.configurable=!0,"value"in E&&(E.writable=!0),Object.defineProperty(b,E.key,E)}}function te(b,m,N){return m&&J(b.prototype,m),N&&J(b,N),b}function Bt(b,m){if(typeof m!="function"&&m!==null)throw new TypeError("Super expression must either be null or a function");b.prototype=Object.create(m&&m.prototype,{constructor:{value:b,writable:!0,configurable:!0}}),m&&dt(b,m)}function dt(b,m){return dt=Object.setPrototypeOf||function(E,I){return E.__proto__=I,E},dt(b,m)}function qn(b){var m=Jn();return function(){var E=Be(b),I;if(m){var R=Be(this).constructor;I=Reflect.construct(E,arguments,R)}else I=E.apply(this,arguments);return Vt(this,I)}}function Vt(b,m){return m&&(_e(m)==="object"||typeof m=="function")?m:Lt(b)}function Lt(b){if(b===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return b}function Jn(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch{return!1}}function Be(b){return Be=Object.setPrototypeOf?Object.getPrototypeOf:function(N){return N.__proto__||Object.getPrototypeOf(N)},Be(b)}function Ze(b,m){var N="data-clipboard-".concat(b);if(m.hasAttribute(N))return m.getAttribute(N)}var At=(function(b){Bt(N,b);var m=qn(N);function N(E,I){var R;return O(this,N),R=m.call(this),R.resolveOptions(I),R.listenClick(E),R}return te(N,[{key:"resolveOptions",value:function(){var I=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this.action=typeof I.action=="function"?I.action:this.defaultAction,this.target=typeof I.target=="function"?I.target:this.defaultTarget,this.text=typeof I.text=="function"?I.text:this.defaultText,this.container=_e(I.container)==="object"?I.container:document.body}},{key:"listenClick",value:function(I){var R=this;this.listener=w()(I,"click",function(ce){return R.onClick(ce)})}},{key:"onClick",value:function(I){var R=I.delegateTarget||I.currentTarget,ce=this.action(R)||"copy",Ut=lt({action:ce,container:this.container,target:this.target(R),text:this.text(R)});this.emit(Ut?"success":"error",{action:ce,text:Ut,trigger:R,clearSelection:function(){R&&R.focus(),window.getSelection().removeAllRanges()}})}},{key:"defaultAction",value:function(I){return Ze("action",I)}},{key:"defaultTarget",value:function(I){var R=Ze("target",I);if(R)return document.querySelector(R)}},{key:"defaultText",value:function(I){return Ze("text",I)}},{key:"destroy",value:function(){this.listener.destroy()}}],[{key:"copy",value:function(I){var R=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{container:document.body};return H(I,R)}},{key:"cut",value:function(I){return f(I)}},{key:"isSupported",value:function(){var I=arguments.length>0&&arguments[0]!==void 0?arguments[0]:["copy","cut"],R=typeof I=="string"?[I]:I,ce=!!document.queryCommandSupported;return R.forEach(function(Ut){ce=ce&&!!document.queryCommandSupported(Ut)}),ce}}]),N})(c()),L=At}),828:(function(o){var i=9;if(typeof Element<"u"&&!Element.prototype.matches){var l=Element.prototype;l.matches=l.matchesSelector||l.mozMatchesSelector||l.msMatchesSelector||l.oMatchesSelector||l.webkitMatchesSelector}function d(c,h){for(;c&&c.nodeType!==i;){if(typeof c.matches=="function"&&c.matches(h))return c;c=c.parentNode}}o.exports=d}),438:(function(o,i,l){var d=l(828);function c(_,D,k,M,f){var v=w.apply(this,arguments);return _.addEventListener(k,v,f),{destroy:function(){_.removeEventListener(k,v,f)}}}function h(_,D,k,M,f){return typeof _.addEventListener=="function"?c.apply(null,arguments):typeof k=="function"?c.bind(null,document).apply(null,arguments):(typeof _=="string"&&(_=document.querySelectorAll(_)),Array.prototype.map.call(_,function(v){return c(v,D,k,M,f)}))}function w(_,D,k,M){return function(f){f.delegateTarget=d(f.target,D),f.delegateTarget&&M.call(_,f)}}o.exports=h}),879:(function(o,i){i.node=function(l){return l!==void 0&&l instanceof HTMLElement&&l.nodeType===1},i.nodeList=function(l){var d=Object.prototype.toString.call(l);return l!==void 0&&(d==="[object NodeList]"||d==="[object HTMLCollection]")&&"length"in l&&(l.length===0||i.node(l[0]))},i.string=function(l){return typeof l=="string"||l instanceof String},i.fn=function(l){var d=Object.prototype.toString.call(l);return d==="[object Function]"}}),370:(function(o,i,l){var d=l(879),c=l(438);function h(k,M,f){if(!k&&!M&&!f)throw new Error("Missing required arguments");if(!d.string(M))throw new TypeError("Second argument must be a String");if(!d.fn(f))throw new TypeError("Third argument must be a Function");if(d.node(k))return w(k,M,f);if(d.nodeList(k))return _(k,M,f);if(d.string(k))return D(k,M,f);throw new TypeError("First argument must be a String, HTMLElement, HTMLCollection, or NodeList")}function w(k,M,f){return k.addEventListener(M,f),{destroy:function(){k.removeEventListener(M,f)}}}function _(k,M,f){return Array.prototype.forEach.call(k,function(v){v.addEventListener(M,f)}),{destroy:function(){Array.prototype.forEach.call(k,function(v){v.removeEventListener(M,f)})}}}function D(k,M,f){return c(document.body,k,M,f)}o.exports=h}),817:(function(o){function i(l){var d;if(l.nodeName==="SELECT")l.focus(),d=l.value;else if(l.nodeName==="INPUT"||l.nodeName==="TEXTAREA"){var c=l.hasAttribute("readonly");c||l.setAttribute("readonly",""),l.select(),l.setSelectionRange(0,l.value.length),c||l.removeAttribute("readonly"),d=l.value}else{l.hasAttribute("contenteditable")&&l.focus();var h=window.getSelection(),w=document.createRange();w.selectNodeContents(l),h.removeAllRanges(),h.addRange(w),d=h.toString()}return d}o.exports=i}),279:(function(o){function i(){}i.prototype={on:function(l,d,c){var h=this.e||(this.e={});return(h[l]||(h[l]=[])).push({fn:d,ctx:c}),this},once:function(l,d,c){var h=this;function w(){h.off(l,w),d.apply(c,arguments)}return w._=d,this.on(l,w,c)},emit:function(l){var d=[].slice.call(arguments,1),c=((this.e||(this.e={}))[l]||[]).slice(),h=0,w=c.length;for(h;h<w;h++)c[h].fn.apply(c[h].ctx,d);return this},off:function(l,d){var c=this.e||(this.e={}),h=c[l],w=[];if(h&&d)for(var _=0,D=h.length;_<D;_++)h[_].fn!==d&&h[_].fn._!==d&&w.push(h[_]);return w.length?c[l]=w:delete c[l],this}},o.exports=i,o.exports.TinyEmitter=i})},s={};function a(o){if(s[o])return s[o].exports;var i=s[o]={exports:{}};return n[o](i,i.exports,a),i.exports}return(function(){a.n=function(o){var i=o&&o.__esModule?function(){return o.default}:function(){return o};return a.d(i,{a:i}),i}})(),(function(){a.d=function(o,i){for(var l in i)a.o(i,l)&&!a.o(o,l)&&Object.defineProperty(o,l,{enumerable:!0,get:i[l]})}})(),(function(){a.o=function(o,i){return Object.prototype.hasOwnProperty.call(o,i)}})(),a(686)})().default})})(ct)),ct.exports}var Zr=zr();const qr=Gr(Zr),Jr=e=>({toClipboard(t,n){return new Promise((s,a)=>{const o=document.createElement("button"),i=new qr(o,{text:()=>t,action:()=>"copy",container:n!==void 0?n:document.body});i.on("success",l=>{i.destroy(),s(l)}),i.on("error",l=>{i.destroy(),a(l)}),document.body.appendChild(o),o.click(),document.body.removeChild(o)})}}),Xr={key:0,class:"baklava-button"},_s=r.defineComponent({__name:"CopyToClipboard",props:{text:String},setup(e){const{toClipboard:t}=Jr(),n=e,s=r.toRef(n,"text"),a=r.ref(!1),o=async()=>{try{await t(s.value),a.value=!0,setTimeout(()=>a.value=!1,1500),console.log("Copied to clipboard")}catch(i){console.error(i)}};return(i,l)=>(r.openBlock(),r.createElementBlock("div",null,[a.value?(r.openBlock(),r.createElementBlock("button",Xr,[r.createVNode(r.unref(Kn))])):(r.openBlock(),r.createElementBlock("button",{key:1,onClick:o,class:"baklava-button"},[r.createVNode(r.unref(es))]))]))}}),Kr={class:"code-editor"},Qr={class:"code-buttons"},eo=r.defineComponent({__name:"CodeEditor",props:r.mergeModels({locked:{type:Boolean},extensions:{}},{modelValue:{required:!0},modelModifiers:{}}),emits:r.mergeModels(["update:locked"],["update:modelValue"]),setup(e,{emit:t}){const n=r.useModel(e,"modelValue"),s=t,a=o=>s("update:locked",o);return(o,i)=>{const l=r.resolveComponent("codemirror");return r.openBlock(),r.createElementBlock("div",Kr,[r.createElementVNode("div",Qr,[e.locked?(r.openBlock(),r.createElementBlock("button",{key:0,class:"baklava-button",title:"The code is locked.",onClick:i[0]||(i[0]=d=>a(!1))},[r.createVNode(r.unref(Wt))])):r.createCommentVNode("",!0),r.createVNode(_s,{text:e.modelValue},null,8,["text"])]),r.createVNode(l,{modelValue:n.value,"onUpdate:modelValue":i[1]||(i[1]=d=>n.value=d),extensions:e.extensions,class:"codemirror",style:{height:"100%"},onKeydown:i[2]||(i[2]=d=>a(!0))},null,8,["modelValue","extensions"])])}}}),to=r.defineComponent({__name:"CodeGraphEditor",props:{viewModel:{}},setup(e){const t=e,n=r.toRef(t,"viewModel"),s=a=>a.events.update.emit(null);return r.onMounted(n.value.onMounted),r.onBeforeUnmount(n.value.onBeforeUnmount),r.watch(n,(a,o)=>{o&&o.onBeforeUnmount(),a&&a.onMounted()}),(a,o)=>(r.openBlock(),r.createBlock(r.unref(S.BaklavaEditor),{"view-model":n.value},{palette:r.withCtx(()=>[r.createVNode(r.unref(ks))]),node:r.withCtx(i=>[r.createVNode(r.unref(ys),r.mergeProps(i,{onUpdate:l=>s(i.node)}),null,16,["onUpdate"])]),sidebar:r.withCtx(i=>[r.createVNode(r.unref(gs),r.normalizeProps(r.guardReactiveProps(i)),{codeEditor:r.withCtx(({node:l})=>[r.renderSlot(a.$slots,"sidebarCodeEditor",{node:l})]),_:3},16)]),_:3},8,["view-model"]))}}),no={class:"code-graph-info"},so=r.defineComponent({__name:"CodeGraphInfo",props:{viewModel:{}},setup(e){return(t,n)=>(r.openBlock(),r.createElementBlock("div",no,[r.createElementVNode("div",null,"Editor graph: "+r.toDisplayString(e.viewModel.editor.graph.shortId),1),r.createElementVNode("div",null,"Displayed graph: "+r.toDisplayString(e.viewModel.displayedGraph.shortId),1),r.createElementVNode("div",null,"Graphs: "+r.toDisplayString(e.viewModel.editor.graphIds),1),r.createElementVNode("div",null,"Graph templates: "+r.toDisplayString(e.viewModel.editor.graphTemplateIds),1),r.createElementVNode("div",null,"Engine status: "+r.toDisplayString(e.viewModel.engine?.status),1)]))}}),ao=["data-node-type","id"],ro={class:"__title-label",style:{"flex-grow":"1"}},oo={key:0},io={class:"__menu",style:{display:"flex"}},lo={class:"__outputs"},co={key:0},uo=["id","title"],ho={class:"__inputs"},fo={key:0},po=["id","title"],ys=r.defineComponent({__name:"CodeGraphNode",props:{node:{},selected:{type:Boolean,default:!1},dragging:{type:Boolean}},emits:["select","start-drag","update"],setup(e,{emit:t}){const n=S.Components.ContextMenu,s=S.Components.NodeInterface,a=e,o=r.computed(()=>a.node),i=t,{viewModel:l}=S.useViewModel(),{graph:d,switchGraph:c}=S.useGraph(),h=r.ref(null),w=r.ref(!1),_=r.ref(""),D=r.ref(null),k=r.ref(!1);let M=0,f=0;const v=r.ref(!1),U=r.computed(()=>{const L=[{value:"edit",label:"Edit"},{value:"rename",label:"Rename"},{value:"delete",label:"Delete"}];return a.node.type.startsWith(Z.GRAPH_NODE_TYPE_PREFIX)&&L.push({value:"editSubgraph",label:"Edit Subgraph"}),L}),V=r.computed(()=>({"--selected":a.selected,"--dragging":a.dragging,"--two-column":!!a.node.twoColumn,"--hidden":o.value.state?.hidden})),H=r.computed(()=>({"--reverse-y":a.node.reverseY??l.value.settings.nodes.reverseY})),Se=r.computed(()=>({top:`${a.node.position?.y??0}px`,left:`${a.node.position?.x??0}px`,"--width":`${a.node.width??l.value.settings.nodes.defaultWidth}px`})),Oe=r.computed(()=>Object.values(a.node.inputs).filter(L=>!L.hidden)),lt=r.computed(()=>Object.values(a.node.outputs).filter(L=>!L.hidden)),_e=()=>{i("select")},O=L=>{a.selected||_e(),i("start-drag",L)},J=()=>{v.value=!0},te=()=>{const L=l.value.displayedGraph.sidebar;L.nodeId="",L.visible=!1},Bt=()=>{const L=l.value.displayedGraph.sidebar;L.nodeId=a.node.id,L.visible=!0},dt=()=>{const L=l.value.displayedGraph.sidebar;L.nodeId=a.node.id},qn=async L=>{switch(L){case"edit":Bt();break;case"delete":d.value.removeNode(a.node);break;case"rename":_.value=a.node.title,w.value=!0,await r.nextTick(),D.value?.focus();break;case"editSubgraph":c(a.node.template);break}},Vt=()=>{o.value.title=_.value,w.value=!1},Lt=()=>{h.value&&l.value.hooks.renderNode.execute({node:a.node,el:h.value})},Jn=L=>{k.value=!0,M=a.node.width,f=L.clientX,L.preventDefault()},Be=L=>{o.value.state&&(o.value.state.integrated=L,i("update"))},Ze=L=>{if(!k.value)return;const b=L.clientX-f,m=M+b/d.value.scaling,N=l.value.settings.nodes.minWidth,E=l.value.settings.nodes.maxWidth;o.value.width=Math.max(N,Math.min(E,m))},At=()=>{k.value=!1};return r.onMounted(()=>{Lt(),window.addEventListener("mousemove",Ze),window.addEventListener("mouseup",At)}),r.onUpdated(Lt),r.onBeforeUnmount(()=>{window.removeEventListener("mousemove",Ze),window.removeEventListener("mouseup",At)}),(L,b)=>(r.openBlock(),r.createElementBlock("div",{class:r.normalizeClass([V.value,"baklava-node"]),"data-node-type":o.value.type,id:o.value.id,style:r.normalizeStyle(Se.value),ref_key:"el",ref:h,onPointerdown:_e},[r.unref(l).settings.nodes.resizable?(r.openBlock(),r.createElementBlock("div",{key:0,class:"__resize-handle",onMousedown:Jn},null,32)):r.createCommentVNode("",!0),r.createElementVNode("div",{class:"__title",onPointerdown:r.withModifiers(O,["self","stop"]),onContextmenu:r.withModifiers(J,["prevent"])},[o.value.inputs._code?(r.openBlock(),r.createBlock(r.unref($t),{key:0,intf:o.value.inputs._code,node:o.value,title:o.value.inputs._code.value,class:"--input","data-interface-type":"node",style:{"flex-grow":"0"}},null,8,["intf","node","title"])):r.createCommentVNode("",!0),w.value?r.withDirectives((r.openBlock(),r.createElementBlock("input",{key:2,ref_key:"renameInputEl",ref:D,"onUpdate:modelValue":b[4]||(b[4]=m=>_.value=m),class:"baklava-input",placeholder:"Node Name",style:{"flex-grow":"1"},type:"text",onBlur:Vt,onKeydown:r.withKeys(Vt,["enter"])},null,544)),[[r.vModelText,_.value]]):(r.openBlock(),r.createElementBlock(r.Fragment,{key:1},[r.createElementVNode("div",ro,[o.value.idx>-1?(r.openBlock(),r.createElementBlock("span",oo,r.toDisplayString(o.value.idx+1)+" > ",1)):r.createCommentVNode("",!0),r.createTextVNode(r.toDisplayString(o.value.title),1)]),r.createElementVNode("div",io,[o.value.isCodeNode?(r.openBlock(),r.createElementBlock(r.Fragment,{key:0},[o.value.state.lockCode?(r.openBlock(),r.createBlock(r.unref(Wt),{key:0,class:"--clickable mx-1",onClick:b[0]||(b[0]=m=>o.value.lockCode=!1)})):r.createCommentVNode("",!0),o.value.state.integrated?(r.openBlock(),r.createBlock(r.unref(Qn),{key:1,class:"--clickable mx-1",onClick:b[1]||(b[1]=m=>Be(!1))})):(r.openBlock(),r.createBlock(r.unref(hs),{key:2,class:"--clickable mx-1",onClick:b[2]||(b[2]=m=>Be(!0))})),!r.unref(l).displayedGraph.sidebar.visible&&r.unref(l).displayedGraph.sidebar.nodeId!==o.value.id?(r.openBlock(),r.createBlock(r.unref(is),{key:3,class:"--clickable mx-1",onClick:Bt})):r.unref(l).displayedGraph.sidebar.visible&&r.unref(l).displayedGraph.sidebar.nodeId!==o.value.id?(r.openBlock(),r.createBlock(r.unref(rs),{key:4,class:"--clickable mx-1",onClick:dt})):(r.openBlock(),r.createBlock(r.unref(os),{key:5,class:"--clickable mx-1",onClick:te}))],64)):r.createCommentVNode("",!0),r.createVNode(r.unref(ts),{class:"--clickable mx-1",onClick:J}),r.createVNode(r.unref(n),{modelValue:v.value,"onUpdate:modelValue":b[3]||(b[3]=m=>v.value=m),x:0,y:0,items:U.value,onClick:qn},null,8,["modelValue","items"])])],64)),o.value.outputs._code?(r.openBlock(),r.createBlock(r.unref($t),{key:3,node:o.value,intf:o.value.outputs._code,class:"--output",title:o.value.outputs._code.value,"data-interface-type":"node"},null,8,["node","intf","title"])):r.createCommentVNode("",!0)],32),r.createElementVNode("div",{class:r.normalizeClass(["__content",H.value]),onKeydown:b[5]||(b[5]=r.withKeys(r.withModifiers(()=>{},["stop"]),["delete"])),onContextmenu:b[6]||(b[6]=r.withModifiers(()=>{},["prevent"]))},[r.createElementVNode("div",lo,[(r.openBlock(!0),r.createElementBlock(r.Fragment,null,r.renderList(lt.value,m=>(r.openBlock(),r.createElementBlock(r.Fragment,{key:m.id},[o.value.state?.hidden?(r.openBlock(),r.createElementBlock("div",co,[m.port?(r.openBlock(),r.createElementBlock("div",{key:0,id:m.id,title:m.name,class:"baklava-node-interface --output --connected"},[...b[7]||(b[7]=[r.createElementVNode("div",{class:"__port"},null,-1)])],8,uo)):r.createCommentVNode("",!0)])):r.renderSlot(L.$slots,"nodeInterface",{key:1,type:"output",node:o.value,intf:m},()=>[r.createVNode(r.unref(s),{node:o.value,intf:m,title:m.value},null,8,["node","intf","title"])])],64))),128))]),r.createElementVNode("div",ho,[(r.openBlock(!0),r.createElementBlock(r.Fragment,null,r.renderList(Oe.value,m=>(r.openBlock(),r.createElementBlock(r.Fragment,{key:m.id},[o.value.state?.hidden?(r.openBlock(),r.createElementBlock("div",fo,[m.port?(r.openBlock(),r.createElementBlock("div",{key:0,id:m.id,title:m.name,class:"baklava-node-interface --input --connected"},[...b[8]||(b[8]=[r.createElementVNode("div",{class:"__port"},null,-1)])],8,po)):r.createCommentVNode("",!0)])):r.renderSlot(L.$slots,"nodeInterface",{key:1,node:o.value,intf:m,type:"input"},()=>[r.createVNode(r.unref(s),{node:o.value,intf:m,title:m.value},null,8,["node","intf","title"])])],64))),128))])],34)],46,ao))}}),mo=["id"],_o={class:"align-middle"},$t=r.defineComponent({__name:"CodeGraphNodeInterface",props:{node:{},intf:{}},setup(e){const t=e,{viewModel:n}=S.useViewModel(),{hoveredOver:s,temporaryConnection:a}=S.useTemporaryConnection(),o=r.ref(null),i=r.computed(()=>t.intf.connectionCount>0),l=r.computed(()=>({"--connected":i.value})),d=()=>{s(t.intf)},c=()=>{s(void 0)},h=()=>{o.value&&n.value.hooks.renderInterface.execute({intf:t.intf,el:o.value})};return r.onMounted(h),r.onUpdated(h),(w,_)=>(r.openBlock(),r.createElementBlock("div",{id:e.intf.id,ref_key:"el",ref:o,class:r.normalizeClass(["baklava-node-interface",l.value])},[e.intf.port?(r.openBlock(),r.createElementBlock("div",{key:0,class:r.normalizeClass([{"--selected":r.unref(a)?.from===e.intf},"__port"]),onPointerover:d,onPointerout:c},null,34)):r.createCommentVNode("",!0),r.createElementVNode("span",_o,[r.renderSlot(w.$slots,"default")])],10,mo))}}),yo=["title"],go={key:0,class:"__label"},Ht=r.defineComponent({__name:"SidebarCheckbox",props:{disabled:{type:Boolean},inversed:{type:Boolean},modelValue:{type:Boolean},name:{}},emits:["update:modelValue"],setup(e,{emit:t}){const n=t;return(s,a)=>(r.openBlock(),r.createElementBlock("div",{class:r.normalizeClass(["baklava-checkbox",{"--checked":e.inversed?!e.modelValue:e.modelValue,"--disabled":e.disabled}]),title:e.name,onClick:a[0]||(a[0]=o=>n("update:modelValue",!e.modelValue))},[a[1]||(a[1]=r.createElementVNode("div",{class:"__checkmark-container"},[r.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",viewBox:"0 0 18 18"},[r.createElementVNode("path",{class:"__checkmark",d:"M 6 5 L 6 10 L 16 10",transform:"rotate(-45 10 10)"})])],-1)),e.name?(r.openBlock(),r.createElementBlock("div",go,r.toDisplayString(e.name),1)):r.createCommentVNode("",!0)],10,yo))}}),ko={class:"__header"},wo={class:"__node-name"},bo={class:"__interfaces"},vo={class:"__inputs"},No={style:{display:"flex"}},Co={class:"__outputs"},Mo={key:0,class:"__interface"},So={style:{display:"flex"}},gs=r.defineComponent({__name:"CodeGraphSidebar",setup(e){const{viewModel:t}=S.useViewModel(),{graph:n}=S.useGraph(),s=r.ref(null),a=r.toRef(t.value.settings.sidebar,"width"),o=r.computed(()=>t.value.settings.sidebar.resizable);let i=0,l=0;const d=r.computed(()=>{const v=n.value.sidebar.nodeId;return n.value.nodes.find(U=>U.id===v)}),c=r.computed(()=>d.value),h=r.computed(()=>({width:`${a.value}px`})),w=r.computed(()=>c.value?Object.values(c.value.inputs).filter(v=>v.displayInSidebar&&v.component):[]),_=r.computed(()=>c.value?Object.values(c.value.outputs).filter(v=>v.displayInSidebar&&v.component):[]),D=()=>{n.value.sidebar.visible=!1},k=()=>{d.value?.events.update.emit(null)},M=v=>{i=a.value,l=v.clientX,window.addEventListener("mousemove",f),window.addEventListener("mouseup",()=>{window.removeEventListener("mousemove",f)},{once:!0})},f=v=>{const U=s.value?.parentElement?.getBoundingClientRect().width??500,V=v.clientX-l;let H=i-V;H<300?H=300:H>.9*U&&(H=.9*U),a.value=H};return(v,U)=>(r.openBlock(),r.createElementBlock("div",{class:r.normalizeClass([{"--open":r.unref(n).sidebar.visible},"baklava-sidebar"]),style:r.normalizeStyle(h.value),ref_key:"el",ref:s},[o.value?(r.openBlock(),r.createElementBlock("div",{key:0,class:"__resizer",onMousedown:M},null,32)):r.createCommentVNode("",!0),d.value?(r.openBlock(),r.createElementBlock(r.Fragment,{key:1},[r.createElementVNode("div",ko,[r.createElementVNode("button",{tabindex:"-1",class:"__close",onClick:D},"×"),r.createElementVNode("div",wo,[r.createElementVNode("b",null,r.toDisplayString(d.value.title),1)])]),r.createElementVNode("div",bo,[r.createElementVNode("div",vo,[(r.openBlock(!0),r.createElementBlock(r.Fragment,null,r.renderList(w.value,V=>(r.openBlock(),r.createElementBlock("div",{key:V.id,class:"__interface"},[r.createElementVNode("div",No,[r.createVNode(Ht,{modelValue:V.hidden,"onUpdate:modelValue":[H=>V.hidden=H,U[0]||(U[0]=()=>d.value?.events.update.emit(null))],disabled:!V.optional,inversed:"",style:{"padding-right":"8px"}},null,8,["modelValue","onUpdate:modelValue","disabled"]),(r.openBlock(),r.createBlock(r.resolveDynamicComponent(V.component),{modelValue:V.value,"onUpdate:modelValue":H=>V.value=H,node:d.value,intf:V,style:{width:"100%"}},null,8,["modelValue","onUpdate:modelValue","node","intf"]))])]))),128))]),r.createElementVNode("div",Co,[c.value&&c.value.state?(r.openBlock(),r.createElementBlock("div",Mo,[U[3]||(U[3]=r.createElementVNode("label",null,"Variable name",-1)),r.withDirectives(r.createElementVNode("input",{"onUpdate:modelValue":U[1]||(U[1]=V=>c.value.state.variableName=V),type:"text",class:"baklava-input",title:"Variable name",onBlur:k,onKeydown:r.withKeys(k,["enter"])},null,544),[[r.vModelText,c.value.state.variableName]])])):r.createCommentVNode("",!0),(r.openBlock(!0),r.createElementBlock(r.Fragment,null,r.renderList(_.value,V=>(r.openBlock(),r.createElementBlock("div",{key:V.id,class:"__interface"},[r.createElementVNode("div",So,[r.createVNode(Ht,{modelValue:V.hidden,"onUpdate:modelValue":[H=>V.hidden=H,U[2]||(U[2]=()=>d.value?.events.update.emit(null))],disabled:!V.optional,inversed:"",style:{"padding-right":"8px"}},null,8,["modelValue","onUpdate:modelValue","disabled"]),(r.openBlock(),r.createBlock(r.resolveDynamicComponent(V.component),{modelValue:V.value,"onUpdate:modelValue":H=>V.value=H,node:d.value,intf:V,style:{width:"100%"}},null,8,["modelValue","onUpdate:modelValue","node","intf"]))])]))),128))])]),r.renderSlot(v.$slots,"codeEditor",{node:d.value})],64)):r.createCommentVNode("",!0)],6))}});function Oo(e,t){return Object.fromEntries(Object.entries(e).filter(t))}function Eo(e,t){return Object.fromEntries(Object.entries(e).map(([n,s])=>[n,t(s)]))}const To={class:"baklava-node --palette",style:{"margin-top":"-20px","margin-bottom":"20px"}},Io={key:0,style:{display:"flex","justify-content":"space-between"}},Do=["onClick"],xo={key:0,style:{margin:"auto 0","font-size":"12px"}},ks=r.defineComponent({__name:"CodeNodePalette",setup(e){const t=S.Components.PaletteEntry,{viewModel:n}=S.useViewModel(),{x:s,y:a}=La.usePointer(),{transform:o}=S.useTransform(),i=S.useNodeCategories(n),l=r.inject("editorEl"),d=r.ref(""),c=r.ref(null),h=()=>d.value?i.value.filter(k=>k.name.toLowerCase().includes(d.value.toLowerCase())||Object.values(k.nodeTypes).some(M=>M.title.toLowerCase().includes(d.value.toLowerCase()))):i.value,w=k=>d.value?Oo(k,M=>{const f=M[1];return f.category.includes(d.value.toLowerCase())||f.title?.toLowerCase().includes(d.value.toLowerCase())}):k,_=r.computed(()=>{if(!c.value||!l?.value)return{};const{left:k,top:M}=l.value.getBoundingClientRect();return{top:`${a.value-M}px`,left:`${s.value-k}px`}}),D=(k,M)=>{c.value={type:k,nodeInformation:M};const f=()=>{const v=r.reactive(new M.type);n.value.displayedGraph.addNode(v);const U=l.value.getBoundingClientRect(),[V,H]=o(s.value-U.left,a.value-U.top);v.position.x=V,v.position.y=H,c.value=null,document.removeEventListener("pointerup",f)};document.addEventListener("pointerup",f)};return(k,M)=>(r.openBlock(),r.createElementBlock(r.Fragment,null,[r.createElementVNode("div",{class:r.normalizeClass([{"--open":r.unref(n).settings.palette.enabled},"baklava-node-palette"]),onContextmenu:M[1]||(M[1]=r.withModifiers(()=>{},["stop","prevent"]))},[r.createElementVNode("div",To,[r.withDirectives(r.createElementVNode("input",{"onUpdate:modelValue":M[0]||(M[0]=f=>d.value=f),type:"text",class:"baklava-input",title:"Filter nodes",onKeyup:h},null,544),[[r.vModelText,d.value]])]),(r.openBlock(!0),r.createElementBlock(r.Fragment,null,r.renderList(h(),f=>(r.openBlock(),r.createElementBlock("section",{key:f.name},[f.name!=="default"?(r.openBlock(),r.createElementBlock("h3",Io,[r.createElementVNode("div",{onClick:v=>d.value=f.name,style:{cursor:"pointer"}},r.toDisplayString(f.name),9,Do),Object.keys(w(f.nodeTypes)).length<Object.values(f.nodeTypes).length?(r.openBlock(),r.createElementBlock("div",xo," ( "+r.toDisplayString(Object.keys(w(f.nodeTypes)).length)+" / "+r.toDisplayString(Object.values(f.nodeTypes).length)+" ) ",1)):r.createCommentVNode("",!0)])):r.createCommentVNode("",!0),(r.openBlock(!0),r.createElementBlock(r.Fragment,null,r.renderList(w(f.nodeTypes),(v,U)=>(r.openBlock(),r.createBlock(r.unref(t),{key:U,title:v.title,type:U,onPointerdown:V=>D(U,v)},null,8,["title","type","onPointerdown"]))),128))]))),128))],34),r.createVNode(r.Transition,{name:"fade"},{default:r.withCtx(()=>[c.value?(r.openBlock(),r.createElementBlock("div",{key:0,class:"baklava-dragged-node",style:r.normalizeStyle(_.value)},[r.createVNode(r.unref(t),{type:c.value.type,title:c.value.nodeInformation.title},null,8,["type","title"])],4)):r.createCommentVNode("",!0)]),_:1})],64))}}),Yo={},Ro={class:"prependIcon"},Po={class:"appendIcon"};function Bo(e,t){const n=r.resolveComponent("router-link");return r.openBlock(),r.createBlock(n,{class:"navItem"},{default:r.withCtx(()=>[r.createElementVNode("span",Ro,[r.renderSlot(e.$slots,"prependIcon")]),r.renderSlot(e.$slots,"default"),r.createElementVNode("span",Po,[r.renderSlot(e.$slots,"appendIcon")])]),_:3})}const Ft=j(Yo,[["render",Bo]]),Vo={class:"navbar"},Lo=["onClick"],Ao=r.defineComponent({__name:"NavBar",props:{viewModel:{},editorStates:{},routes:{}},emits:["click:remove"],setup(e,{emit:t}){const n=t,s=a=>{n("click:remove",a)};return(a,o)=>(r.openBlock(),r.createElementBlock("nav",Vo,[r.renderSlot(a.$slots,"prepend"),(r.openBlock(!0),r.createElementBlock(r.Fragment,null,r.renderList(e.editorStates,i=>(r.openBlock(),r.createBlock(Ft,{key:i.graph.id,class:r.normalizeClass({active:i.graph.id===e.viewModel.displayedGraph.id}),to:{name:e.routes?.edit??"edit",params:{editorId:i.graph.id}}},{appendIcon:r.withCtx(()=>[r.createElementVNode("button",{class:"remove",onClick:r.withModifiers(l=>s(i.graph.id),["prevent"])},[r.createVNode(r.unref(ps))],8,Lo)]),default:r.withCtx(()=>[r.createTextVNode(r.toDisplayString(i.graph.id.slice(0,6))+" ",1)]),_:2},1032,["class","to"]))),128)),r.renderSlot(a.$slots,"append",{},()=>[r.createVNode(Ft,{to:{name:e.routes?.new??"new"},class:"navItem"},{default:r.withCtx(()=>[r.createVNode(r.unref(ls),{class:"plus"})]),_:1},8,["to"])])]))}}),Uo=r.defineComponent({props:{intf:{type:Object,required:!0},modelValue:{type:String,required:!0}},emits:["update:modelValue"],setup(e,{emit:t}){return{v:r.computed({get:()=>e.modelValue,set:s=>{t("update:modelValue",s)}})}}}),Wo={style:{position:"relative"}},$o={style:{"font-size":"12px",padding:"0 6px",position:"absolute",top:"-8px","background-color":"var(--baklava-node-color-background)"}},Ho=["placeholder","title"];function Fo(e,t,n,s,a,o){return r.openBlock(),r.createElementBlock("div",Wo,[r.createElementVNode("label",$o,r.toDisplayString(e.intf.name),1),r.withDirectives(r.createElementVNode("input",{"onUpdate:modelValue":t[0]||(t[0]=i=>e.v=i),type:"text",class:"baklava-input",placeholder:e.intf.name,title:e.intf.name},null,8,Ho),[[r.vModelText,e.v]])])}const Gt=j(Uo,[["render",Fo]]),Go=Object.freeze(Object.defineProperty({__proto__:null,CodeEditor:eo,CodeGraphEditor:to,CodeGraphInfo:so,CodeGraphNode:ys,CodeGraphNodeInterface:$t,CodeGraphSidebar:gs,CodeNodePalette:ks,CopyToClipboard:_s,NavBar:Ao,NavItem:Ft,SidebarCheckbox:Ht,TextInputInterface:Gt},Symbol.toStringTag,{value:"Module"}));Ve.escape=e=>e;class jt extends Z.AbstractNode{codeTemplate;isCodeNode=!0;mask=null;name="";state;inputs={};outputs={};constructor(){super(),this.initializeIo(),this.twoColumn=!0,this.state=r.reactive({codeTemplate:"",hidden:!1,integrated:!1,lockCode:!1,modules:[],props:null,script:"",variableName:""}),this.codeTemplate=function(){return`${this.name}(${ws(this.codeNodeInputs).join(", ")})`}}get code(){return this.graph.code}get codeNodeInputs(){return Object.fromEntries(Object.entries(this.inputs).filter(t=>t[1].isCodeNode&&t[1].type!="node"))}get codeNodeOutputs(){return Object.fromEntries(Object.entries(this.outputs).filter(t=>t[1].isCodeNode&&t[1].type!="node"))}get graph(){return super.graph}get idx(){return this.graph.nodes.filter(t=>!t.state.integrated).indexOf(this)??-1}get idxByType(){return this.graph.getNodesByType(this.type).indexOf(this)??-1}get idxByVariableNames(){return this.graph.getNodesByVariableName(this.state.variableName).filter(t=>!t.state.integrated).indexOf(this)??-1}get lockCode(){return this.state.lockCode}set lockCode(t){this.state.lockCode=t,this.events.update.emit(null)}get optionalInputs(){return Object.fromEntries(Object.entries(this.codeNodeInputs).filter(t=>t[1].optional))}get requiredInputs(){return Object.fromEntries(Object.entries(this.codeNodeInputs).filter(t=>!t[1].optional))}get script(){return this.outputs._code?.value??""}set script(t){this.outputs._code&&(this.outputs._code.value=t),this.events.update.emit(null)}get shortId(){return this.id.slice(0,6)}get subgraph(){}get variableName(){return this.state.variableName?this.state.variableName+(this.idxByVariableNames+1):""}getConnectedNodeByInterface(t,n){const s=this.getConnectedNodesByInterface(t,n);return s.length>0?s[0]:null}getConnectedNodes(t){let n=[];if(t!=="inputs"){const s=this.graph.connections.filter(a=>a.from.name!=="_code").filter(a=>a.from.nodeId===this.id).map(a=>a.to.nodeId);s&&(n=n.concat(s))}if(t!=="outputs"){const s=this.graph.connections.filter(a=>a.from.name!=="_code").filter(a=>a.to.nodeId===this.id).map(a=>a.from.nodeId);s&&(n=n.concat(s))}return!n||n.length==0?[]:n.map(s=>this.graph.findNodeById(s))}getConnectedNodesByInterface(t,n){let s=[];if(n!=="outputs"&&this.inputs[t]){const a=this.graph.connections.filter(o=>o.to.id===this.inputs[t]?.id||o.from.id===this.inputs[t]?.id).map(o=>o.from.nodeId);a&&(s=s.concat(a))}if(n!=="inputs"&&this.outputs[t]){const a=this.graph.connections.filter(o=>o.from.id===this.outputs[t]?.id||o.from.id===this.outputs[t]?.id).map(o=>o.to.nodeId);a&&(s=s.concat(a))}return!s||s.length==0?[]:s.map(a=>this.graph.findNodeById(a))}remove(){this.graph?.removeNode(this)}renderCode(t){return Ve.render(this.state.codeTemplate,t)}updateCodeTemplate(){this.state.codeTemplate=this.codeTemplate.call(this)}updateModules(t){if(t)this.state.modules=t;else if(this.type.includes(".")){const n=this.type.split(".");this.state.modules.push(n.slice(0,n.length-1).join("."))}}updateOutputNames(){Object.values(this.codeNodeOutputs).forEach(t=>{t.name=this.state.integrated?"":this.variableName+t.suffix})}updateOutputValues(t){Object.keys(this.outputs).forEach(n=>{n!=="_code"&&(t[n]=this.state.integrated?t._code:this.outputs[n].name)})}updateProps(t){this.state.props=t}updateInputValues(t){const n=Object.keys(this.inputs);Object.keys(t).forEach(s=>{!n.includes(s)||!this.inputs[s]||(this.inputs[s].value=t[s],this.inputs[s].setHidden(!1))})}}class ut extends jt{calculate=(t,n)=>{const s={};return this.lockCode||(s._code=this.renderCode({inputs:t,...n})),this.updateOutputValues(s),s};load(t){super.load(t),zt(this.graph,t),this.afterLoaded()}save(){const t=super.save();return bs(this.graph,t),t}}const ws=(e,t=!0)=>{const n=[],s=Object.keys(e);return s.forEach(a=>{if(e[a]?.hidden)return;const i=t&&n.length<s.indexOf(a)?`${a}=`:"";n.push(`${i}{{ inputs.${a} }}`)}),n},zt=(e,t)=>{if(!e)return;const n=e.findNodeById(t.id);if(!n||n.subgraph)return;const s=n;s.state&&(s.state.integrated=t.integrated,s.state.props=t.props),Object.entries(t.inputs).forEach(([a,o])=>{a!=="_code"&&s.inputs[a]&&(s.inputs[a].hidden=o.hidden,o.optional&&(s.inputs[a].state.optional=o.optional))}),Object.entries(t.outputs).forEach(([a,o])=>{a!=="_code"&&s.outputs[a]&&(s.outputs[a].hidden=o.hidden,o.optional&&(s.outputs[a].state.optional=o.optional))})},bs=(e,t)=>{if(!e)return;const n=e.findNodeById(t.id);if(!n||n.subgraph)return;const s=n;s.state&&(t.integrated=s.state.integrated,s.state.props&&(t.props=s.state.props)),Object.entries(t.inputs).forEach(([a,o])=>{if(a!=="_code"&&s.inputs[a]){const i=s.inputs[a];o.hidden=i.hidden,i.state?.optional&&(o.optional=i.state.optional),i.component?.__name&&(o.component=i.component.__name)}}),Object.entries(t.outputs).forEach(([a,o])=>{a!=="_code"&&s.outputs[a]&&(o.hidden=s.outputs[a].hidden)})},vs=(e,t)=>{switch(e){case"CheckBoxInterface":return new Cs(t.id,t.value);case"IntegerInterface":return new en(t.id,t.value,t.min,t.max);case"NumberInterface":return new Ss(t.id,t.value,t.min,t.max);case"SelectInterface":return new Os(t.id,t.value,t.items);default:return new nn(t.id,t.value)}},jo=["title"],ht=r.defineComponent({__name:"CodeNodeInterface",props:{intf:{}},setup(e){return(t,n)=>(r.openBlock(),r.createElementBlock("div",{title:e.intf.value},r.toDisplayString(e.intf.name),9,jo))}});class K extends Z.NodeInterface{isCodeNode=!0;code;state;type=null;constructor(t,n){super(t,n),this.setComponent(r.markRaw(ht)),this.state=r.reactive({optional:!1})}get optional(){return this.state.optional}get shortId(){return this.id.slice(0,6)}getValue=()=>`${this.value??"None"}`;setOptional(t){return this.state.optional=t,this.setHidden(t),this}}class Le extends K{constructor(t="",n){super(t,n),this.setComponent(r.markRaw(ht)),this.use(S.displayInSidebar,!0)}get value(){return super.value}set value(t){super.value=t,this.name!=="_code"&&this.setHidden(!1)}}const Zt=new G.NodeInterfaceType("boolean"),Ns=new G.NodeInterfaceType("dict"),qt=new G.NodeInterfaceType("list"),ne=new G.NodeInterfaceType("node"),Jt=new G.NodeInterfaceType("number"),Xt=new G.NodeInterfaceType("string"),Kt=new G.NodeInterfaceType("tuple"),zo=e=>{new G.BaklavaInterfaceTypes(e.editor,{viewPlugin:e}).addTypes(Zt,Ns,qt,ne,Jt,Xt,Kt)};class Cs extends Le{constructor(t,n){super(t,n),this.setComponent(r.markRaw(S.CheckboxInterfaceComponent)),this.use(G.setType,Zt)}getValue=()=>this.value?"True":"False"}class Ms extends K{isCodeNodeOutput=!0;suffix="";constructor(t="",n=""){super(t,""),this.suffix=n,this.setComponent(r.markRaw(ht))}get codeValue(){return this.node?.outputs._code.value??""}get node(){const{graph:t}=S.useGraph();return t.value.findNodeById(this.nodeId)}}class Qt extends Le{min;max;constructor(t,n,s,a){super(t,n),this.min=s,this.max=a,this.use(G.setType,Jt)}validate(t){return(this.min===void 0||t>=this.min)&&(this.max===void 0||t<=this.max)}}class en extends Qt{component=r.markRaw(S.IntegerInterfaceComponent);validate(t){return Number.isInteger(t)&&super.validate(t)}}class Zo extends Le{constructor(t="",n=""){super(t,n),this.setComponent(r.markRaw(S.TextInputInterfaceComponent)),this.use(G.setType,qt)}getValue=()=>`[${this.value}]`}class Ss extends Qt{component=r.markRaw(S.NumberInterfaceComponent)}class tn extends Le{constructor(t,n){super(t,n),this.use(G.setType,Xt)}getValue=()=>`"${this.value}"`}class Os extends tn{component=r.markRaw(S.SelectInterfaceComponent);items;constructor(t,n,s){super(t,n),this.items=s}}class qo extends Qt{component=r.markRaw(S.SliderInterfaceComponent);min;max;constructor(t,n,s,a){super(t,n,s,a),this.min=s,this.max=a}getValue=()=>`${Math.round(this.value*1e3)/1e3}`}class nn extends tn{component=r.markRaw(Gt)}class Jo extends tn{component=r.markRaw(S.TextareaInputInterfaceComponent)}class Xo extends Le{constructor(t="",n=""){super(t,n),this.setComponent(r.markRaw(S.TextInputInterfaceComponent)),this.use(G.setType,Kt)}getValue=()=>`(${this.value})`}function Ko(e){return class extends ut{type=e.type;inputs={};outputs={};constructor(){super(),this._title=e.title??e.type,this.executeFactory("input",e.inputs),this.executeFactory("output",e.outputs),e.calculate&&(this.calculate=(t,n)=>e.calculate.call(this,{inputs:t,...n})),e.onCreate?.call(this),this.name=e.name??e.type,this.updateModules(e.modules),e.variableName!=null&&(this.state.variableName=e.variableName),e.codeTemplate&&(this.codeTemplate=e.codeTemplate),this.addInput("_code",new K("_code",[]).use(G.setType,ne).use(ue.allowMultipleConnections).setHidden(!0)),this.addOutput("_code",new K("_code",[]).use(G.setType,ne).use(ue.allowMultipleConnections).setHidden(!0))}afterGraphLoaded(){e.afterGraphLoaded?.call(this)}afterLoaded(){e.afterLoaded?.call(this)}onPlaced(){e.onPlaced?.call(this)}onConnected(){e.onConnected?.call(this)}onDestroy(){e.onDestroy?.call(this)}onGraphUpdate(){e.onGraphUpdate?.call(this)}onUnconnected(){e.onUnconnected?.call(this)}update(){e.update?.call(this)}executeFactory(t,n){Object.keys(n||{}).forEach(s=>{const a=n[s]();t==="input"?this.addInput(s,a):this.addOutput(s,a)})}}}class Es extends ut{}function Qo(e){return class extends Es{type=e.type;inputs={};outputs={};preventUpdate=!1;staticInputKeys=Object.keys(e.inputs??{});staticOutputKeys=Object.keys(e.outputs??{});constructor(){super(),this._title=e.title??e.type,this.executeFactory("input",e.inputs),this.executeFactory("output",e.outputs),e.calculate&&(this.calculate=(t,n)=>e.calculate?.call(this,t,n)),e.onCreate?.call(this),this.name=e.name??e.type,this.updateModules(e.modules),e.codeTemplate&&(this.codeTemplate=e.codeTemplate),e.variableName&&(this.state.variableName=e.variableName),this.addInput("_code",new K("_code",[]).use(G.setType,ne).use(ue.allowMultipleConnections).setHidden(!0)),this.addOutput("_code",new K("_code",[]).use(G.setType,ne).use(ue.allowMultipleConnections).setHidden(!0)),this.staticInputKeys.push("_code"),this.staticOutputKeys.push("_code")}afterGraphLoaded(){e.afterGraphLoaded?.call(this)}afterLoaded(){e.afterLoaded?.call(this)}onPlaced(){this.events.update.subscribe(this,t=>{t&&(t.type==="input"&&this.staticInputKeys.includes(t.name)||t.type==="output"&&this.staticOutputKeys.includes(t.name))&&this.onUpdate()}),this.onUpdate(),e.onPlaced?.call(this)}onConnected(){e.onConnected?.call(this)}onDestroy(){e.onDestroy?.call(this)}onGraphUpdate(){e.onGraphUpdate?.call(this)}onUnconnected(){e.onUnconnected?.call(this)}update(){e.update?.call(this)}load(t){this.preventUpdate=!0,this.hooks.beforeLoad.execute(t),this.id=t.id,this.title=t.title;for(const n of this.staticInputKeys)this.inputs[n].load(t.inputs[n]),this.inputs[n].nodeId=this.id,n!=="_code"&&(this.inputs[n].hidden=t.inputs[n].hidden);for(const n of this.staticOutputKeys)this.outputs[n].load(t.outputs[n]),this.outputs[n].nodeId=this.id,n!=="_code"&&(this.outputs[n].hidden=t.outputs[n].hidden);this.preventUpdate=!1,this.onUpdate(),this.preventUpdate=!0;for(const n of Object.keys(t.inputs))if(!(this.staticInputKeys.includes(n)||!t.inputs[n])){if(!this.inputs[n]){const s=t.inputs[n],a=s.value;let o;s.component?o=vs(s.component,{...s,id:n}):typeof a=="number"?o=new en(n,a):o=new nn(n,JSON.stringify(a)),o.use(S.displayInSidebar,!0),o.setOptional(s.optional??!1),o.setHidden(s.hidden??!1),this.addInput(n,o)}this.inputs[n]&&(this.inputs[n].load(t.inputs[n]),this.inputs[n].nodeId=this.id)}for(const n of Object.keys(t.outputs))if(!(this.staticOutputKeys.includes(n)||!t.outputs[n])){if(!this.outputs[n]){const s=new Ms(n);this.addOutput(n,s)}this.outputs[n]&&(this.outputs[n].load(t.outputs[n]),this.outputs[n].nodeId=this.id)}zt(this.graph,t),this.preventUpdate=!1,this.events.loaded.emit(this)}onUpdate(){if(!e.onUpdate||this.preventUpdate)return;this.graph&&this.graph.activeTransactions++;const t=this.getStaticValues(this.staticInputKeys,this.inputs),n=this.getStaticValues(this.staticOutputKeys,this.outputs),s=e.onUpdate.call(this,t,n);this.updateInterfaces("input",s.inputs??{},s.forceUpdateInputs??[]),this.updateInterfaces("output",s.outputs??{},s.forceUpdateOutputs??[]),this.graph&&this.graph.activeTransactions--}getStaticValues(t,n){const s={};for(const a of t)s[a]=n[a].value;return s}updateInputInterfaces(t={},n=[]){this.updateInterfaces("input",t,n)}updateInterfaces(t,n={},s=[]){const a=t==="input"?this.staticInputKeys:this.staticOutputKeys,o=t==="input"?this.inputs:this.outputs;for(const i of Object.keys(o))a.includes(i)||n[i]&&!s.includes(i)||(t==="input"?this.removeInput(i):this.removeOutput(i));for(const i of Object.keys(n)){if(o[i])continue;const l=n[i]();t==="input"?this.addInput(i,l):this.addOutput(i,l)}}updateProps(t){this.state.props=t,this.onUpdate()}executeFactory(t,n){Object.keys(n||{}).forEach(s=>{const a=n[s]();t==="input"?this.addInput(s,a):this.addOutput(s,a)})}}}Ve.escape=e=>e;class ft{_id;_state;viewModel;constructor(){this._id=De.v4(),this._state=r.reactive({lockCode:!1,modules:{},script:"",template:""})}get engine(){return this.viewModel?.engine}get graph(){return this.viewModel?.editor.graph}get id(){return this._id}get lockCode(){return this.state.lockCode}set lockCode(t){this.state.lockCode=t,this.engine?.runOnce(null)}get modules(){const t=[];return this.graph?.codeNodes.filter(n=>n.state.modules?.length>0).forEach(n=>t.push(...n.state.modules)),t?(t.sort(),Array.from(new Set(t.map(n=>this.state.modules[n])))):[]}get script(){return this.state.script}set script(t){this.state.script=t,this.engine?.runOnce(null)}get shortId(){return this.id.slice(0,6)}get state(){return this._state}clear(){this.state.script=""}async loadTemplate(t){t.then(n=>{this._state.template=n.default??""})}registerViewModel(t){this.viewModel=t}renderCode(t){this.state.script=Ve.render(this.state.template||"",t??{})}}class ei extends ft{constructor(){super(),this.loadTemplate(Promise.resolve().then(()=>fu))}}class ti extends ft{constructor(){super(),this.loadTemplate(Promise.resolve().then(()=>pu))}}const ni=e=>{e.allowMultipleConnections=!0};class Ts extends ue.BaseEngine{order=new Map;constructor(t){super(t)}start(){super.start(),this.recalculateOrder=!0,this.calculateWithoutData()}async runGraph(t,n,s){this.order.has(t.id)||this.order.set(t.id,ue.sortTopologically(t));const{calculationOrder:a,connectionsFromNode:o}=this.order.get(t.id),i=new Map;for(const l of a){const d={};Object.entries(l.inputs).forEach(([h,w])=>{d[h]=this.getInterfaceValue(n,w.id)}),l.isCodeNode&&(l.updateCodeTemplate(),l.updateOutputNames()),this.events.beforeNodeCalculation.emit({inputValues:d,node:l});let c;if(l.calculate){if(c=await l.calculate(d,{globalValues:s,engine:this}),o.has(l))for(const[h,w]of Object.entries(c))this.hooks.transferData.execute(c[h],w),o.get(l).forEach(_=>n.set(_.to.id,w))}else{c={};for(const[h,w]of Object.entries(l.outputs))c[h]=this.getInterfaceValue(n,w.id)}this.events.afterNodeCalculation.emit({outputValues:c,node:l}),i.set(l.id,new Map(Object.entries(c))),o.has(l)&&o.get(l).forEach(h=>{const w=Object.entries(l.outputs).find(([,D])=>D.id===h.from.id)?.[0];if(!w)throw new Error(`Could not find key for interface ${h.from.id}
|
|
2
|
-
This is likely an internal issue. Please report it on GitHub.`);const
|
|
3
|
-
This is likely an internal issue. Please report it on GitHub.`);return t.get(n)}}var
|
|
4
|
-
[`+o+"] ";for(i in arguments[0])P(arguments[0],i)&&(a+=i+": "+arguments[0][i]+", ");a=a.slice(0,-2)}else a=arguments[o];s.push(a)}
|
|
1
|
+
(function(p,r){typeof exports=="object"&&typeof module<"u"?r(exports,require("vue"),require("@baklavajs/renderer-vue"),require("@baklavajs/core"),require("@vueuse/core"),require("mustache"),require("uuid"),require("@baklavajs/interface-types"),require("@baklavajs/engine"),require("toposort"),require("@baklavajs/events")):typeof define=="function"&&define.amd?define(["exports","vue","@baklavajs/renderer-vue","@baklavajs/core","@vueuse/core","mustache","uuid","@baklavajs/interface-types","@baklavajs/engine","toposort","@baklavajs/events"],r):(p=typeof globalThis<"u"?globalThis:p||self,r(p["@babsey/code-graph"]={},p.vue,p["@baklavajs/renderer-vue"],p["@baklavajs/core"],p["@vueuse/core"],p.mustache,p.uuid,p["@baklavajs/interface-types"],p["@baklavajs/engine"],p.toposort,p["@baklavajs/events"]))})(this,(function(p,r,S,q,Pa,Le,xe,G,he,Ba,Kn){"use strict";const z=(e,t)=>{const n=e.__vccOpts||e;for(const[s,a]of t)n[s]=a;return n},Va={},La={xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"baklava-icon icon icon-tabler icons-tabler-outline icon-tabler-check"};function Aa(e,t){return r.openBlock(),r.createElementBlock("svg",La,[...t[0]||(t[0]=[r.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),r.createElementVNode("path",{d:"M5 12l5 5l10 -10"},null,-1)])])}const Qn=z(Va,[["render",Aa]]),Ua={},$a={xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"baklava-icon icon icon-tabler icons-tabler-outline icon-tabler-code-variable"};function Wa(e,t){return r.openBlock(),r.createElementBlock("svg",$a,[...t[0]||(t[0]=[r.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),r.createElementVNode("path",{d:"M4 8m0 2a2 2 0 0 1 2 -2h12a2 2 0 0 1 2 2v4a2 2 0 0 1 -2 2h-12a2 2 0 0 1 -2 -2z"},null,-1)])])}const es=z(Ua,[["render",Wa]]),Ha={},Fa={xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"baklava-icon icon icon-tabler icons-tabler-outline icon-tabler-copy"};function Ga(e,t){return r.openBlock(),r.createElementBlock("svg",Fa,[...t[0]||(t[0]=[r.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),r.createElementVNode("path",{d:"M7 7m0 2.667a2.667 2.667 0 0 1 2.667 -2.667h8.666a2.667 2.667 0 0 1 2.667 2.667v8.666a2.667 2.667 0 0 1 -2.667 2.667h-8.666a2.667 2.667 0 0 1 -2.667 -2.667z"},null,-1),r.createElementVNode("path",{d:"M4.012 16.737a2.005 2.005 0 0 1 -1.012 -1.737v-10c0 -1.1 .9 -2 2 -2h10c.75 0 1.158 .385 1.5 1"},null,-1)])])}const ts=z(Ha,[["render",Ga]]),ja={},za={xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"baklava-icon icon icon-tabler icons-tabler-outline icon-tabler-dots-vertical"};function Za(e,t){return r.openBlock(),r.createElementBlock("svg",za,[...t[0]||(t[0]=[r.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),r.createElementVNode("path",{d:"M12 12m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0"},null,-1),r.createElementVNode("path",{d:"M12 19m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0"},null,-1),r.createElementVNode("path",{d:"M12 5m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0"},null,-1)])])}const ns=z(ja,[["render",Za]]),qa={},Ja={xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"baklava-icon icon icon-tabler icons-tabler-outline icon-tabler-download"};function Xa(e,t){return r.openBlock(),r.createElementBlock("svg",Ja,[...t[0]||(t[0]=[r.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),r.createElementVNode("path",{d:"M4 17v2a2 2 0 0 0 2 2h12a2 2 0 0 0 2 -2v-2"},null,-1),r.createElementVNode("path",{d:"M7 11l5 5l5 -5"},null,-1),r.createElementVNode("path",{d:"M12 4l0 12"},null,-1)])])}const ss=z(qa,[["render",Xa]]),Ka={},Qa={xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"currentColor",class:"baklava-icon icon icon-tabler icons-tabler-filled icon-tabler-layout-sidebar-left-collapse"};function er(e,t){return r.openBlock(),r.createElementBlock("svg",Qa,[...t[0]||(t[0]=[r.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),r.createElementVNode("path",{d:"M18 3a3 3 0 0 1 2.995 2.824l.005 .176v12a3 3 0 0 1 -2.824 2.995l-.176 .005h-12a3 3 0 0 1 -2.995 -2.824l-.005 -.176v-12a3 3 0 0 1 2.824 -2.995l.176 -.005h12zm0 2h-9v14h9a1 1 0 0 0 .993 -.883l.007 -.117v-12a1 1 0 0 0 -.883 -.993l-.117 -.007zm-2.293 4.293a1 1 0 0 1 .083 1.32l-.083 .094l-1.292 1.293l1.292 1.293a1 1 0 0 1 .083 1.32l-.083 .094a1 1 0 0 1 -1.32 .083l-.094 -.083l-2 -2a1 1 0 0 1 -.083 -1.32l.083 -.094l2 -2a1 1 0 0 1 1.414 0z"},null,-1)])])}const tr=z(Ka,[["render",er]]),nr={},sr={xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"currentColor",class:"baklava-icon icon icon-tabler icons-tabler-filled icon-tabler-layout-sidebar-left-expand"};function ar(e,t){return r.openBlock(),r.createElementBlock("svg",sr,[...t[0]||(t[0]=[r.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),r.createElementVNode("path",{d:"M18 3a3 3 0 0 1 2.995 2.824l.005 .176v12a3 3 0 0 1 -2.824 2.995l-.176 .005h-12a3 3 0 0 1 -2.995 -2.824l-.005 -.176v-12a3 3 0 0 1 2.824 -2.995l.176 -.005h12zm0 2h-9v14h9a1 1 0 0 0 .993 -.883l.007 -.117v-12a1 1 0 0 0 -.883 -.993l-.117 -.007zm-4.387 4.21l.094 .083l2 2a1 1 0 0 1 .083 1.32l-.083 .094l-2 2a1 1 0 0 1 -1.497 -1.32l.083 -.094l1.292 -1.293l-1.292 -1.293a1 1 0 0 1 -.083 -1.32l.083 -.094a1 1 0 0 1 1.32 -.083z"},null,-1)])])}const rr=z(nr,[["render",ar]]),or={},ir={xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"currentColor",class:"baklava-icon icon icon-tabler icons-tabler-filled icon-tabler-layout-sidebar-right"};function lr(e,t){return r.openBlock(),r.createElementBlock("svg",ir,[...t[0]||(t[0]=[r.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),r.createElementVNode("path",{d:"M6 21a3 3 0 0 1 -3 -3v-12a3 3 0 0 1 3 -3h12a3 3 0 0 1 3 3v12a3 3 0 0 1 -3 3zm8 -16h-8a1 1 0 0 0 -1 1v12a1 1 0 0 0 1 1h8z"},null,-1)])])}const dr=z(or,[["render",lr]]),cr={},ur={xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"currentColor",class:"baklava-icon icon icon-tabler icons-tabler-filled icon-tabler-layout-sidebar-right-collapse"};function hr(e,t){return r.openBlock(),r.createElementBlock("svg",ur,[...t[0]||(t[0]=[r.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),r.createElementVNode("path",{d:"M18 3a3 3 0 0 1 2.995 2.824l.005 .176v12a3 3 0 0 1 -2.824 2.995l-.176 .005h-12a3 3 0 0 1 -2.995 -2.824l-.005 -.176v-12a3 3 0 0 1 2.824 -2.995l.176 -.005h12zm-3 2h-9a1 1 0 0 0 -.993 .883l-.007 .117v12a1 1 0 0 0 .883 .993l.117 .007h9v-14zm-5.387 4.21l.094 .083l2 2a1 1 0 0 1 .083 1.32l-.083 .094l-2 2a1 1 0 0 1 -1.497 -1.32l.083 -.094l1.292 -1.293l-1.292 -1.293a1 1 0 0 1 -.083 -1.32l.083 -.094a1 1 0 0 1 1.32 -.083z"},null,-1)])])}const as=z(cr,[["render",hr]]),fr={},pr={xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"currentColor",class:"baklava-icon icon icon-tabler icons-tabler-filled icon-tabler-layout-sidebar-right-expand"};function mr(e,t){return r.openBlock(),r.createElementBlock("svg",pr,[...t[0]||(t[0]=[r.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),r.createElementVNode("path",{d:"M18 3a3 3 0 0 1 2.995 2.824l.005 .176v12a3 3 0 0 1 -2.824 2.995l-.176 .005h-12a3 3 0 0 1 -2.995 -2.824l-.005 -.176v-12a3 3 0 0 1 2.824 -2.995l.176 -.005h12zm-3 2h-9a1 1 0 0 0 -.993 .883l-.007 .117v12a1 1 0 0 0 .883 .993l.117 .007h9v-14zm-3.293 4.293a1 1 0 0 1 .083 1.32l-.083 .094l-1.292 1.293l1.292 1.293a1 1 0 0 1 .083 1.32l-.083 .094a1 1 0 0 1 -1.32 .083l-.094 -.083l-2 -2a1 1 0 0 1 -.083 -1.32l.083 -.094l2 -2a1 1 0 0 1 1.414 0z"},null,-1)])])}const $t=z(fr,[["render",mr]]),_r={},yr={xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"baklava-icon icon icon-tabler icons-tabler-outline icon-tabler-lock-code"};function gr(e,t){return r.openBlock(),r.createElementBlock("svg",yr,[...t[0]||(t[0]=[r.createStaticVNode('<path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M11.5 21h-4.5a2 2 0 0 1 -2 -2v-6a2 2 0 0 1 2 -2h10a2 2 0 0 1 2 2"></path><path d="M11 16a1 1 0 1 0 2 0a1 1 0 0 0 -2 0"></path><path d="M8 11v-4a4 4 0 1 1 8 0v4"></path><path d="M20 21l2 -2l-2 -2"></path><path d="M17 17l-2 2l2 2"></path>',6)])])}const Wt=z(_r,[["render",gr]]),kr={},br={xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"baklava-icon icon icon-tabler icons-tabler-outline icon-tabler-player-play"};function wr(e,t){return r.openBlock(),r.createElementBlock("svg",br,[...t[0]||(t[0]=[r.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),r.createElementVNode("path",{d:"M7 4v16l13 -8z"},null,-1)])])}const vr=z(kr,[["render",wr]]),Nr={},Cr={xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"baklava-icon icon icon-tabler icons-tabler-outline icon-tabler-plus"};function Mr(e,t){return r.openBlock(),r.createElementBlock("svg",Cr,[...t[0]||(t[0]=[r.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),r.createElementVNode("path",{d:"M12 5l0 14"},null,-1),r.createElementVNode("path",{d:"M5 12l14 0"},null,-1)])])}const rs=z(Nr,[["render",Mr]]),Sr={},Or={xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"baklava-icon icon icon-tabler icons-tabler-outline icon-tabler-restore"};function Er(e,t){return r.openBlock(),r.createElementBlock("svg",Or,[...t[0]||(t[0]=[r.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),r.createElementVNode("path",{d:"M3.06 13a9 9 0 1 0 .49 -4.087"},null,-1),r.createElementVNode("path",{d:"M3 4.001v5h5"},null,-1),r.createElementVNode("path",{d:"M12 12m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0"},null,-1)])])}const os=z(Sr,[["render",Er]]),Tr={},Ir={xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"baklava-icon icon icon-tabler icons-tabler-outline icon-tabler-schema"};function Dr(e,t){return r.openBlock(),r.createElementBlock("svg",Ir,[...t[0]||(t[0]=[r.createStaticVNode('<path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M5 2h5v4h-5z"></path><path d="M15 10h5v4h-5z"></path><path d="M5 18h5v4h-5z"></path><path d="M5 10h5v4h-5z"></path><path d="M10 12h5"></path><path d="M7.5 6v4"></path><path d="M7.5 14v4"></path>',8)])])}const is=z(Tr,[["render",Dr]]),xr={},Yr={xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"baklava-icon icon icon-tabler icons-tabler-outline icon-tabler-schema-off"};function Rr(e,t){return r.openBlock(),r.createElementBlock("svg",Yr,[...t[0]||(t[0]=[r.createStaticVNode('<path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M6 2h4v4m-4 0h-1v-1"></path><path d="M15 11v-1h5v4h-2"></path><path d="M5 18h5v4h-5z"></path><path d="M5 10h5v4h-5z"></path><path d="M10 12h2"></path><path d="M7.5 7.5v2.5"></path><path d="M7.5 14v4"></path><path d="M3 3l18 18"></path>',9)])])}const ls=z(xr,[["render",Rr]]),Pr={},Br={xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"baklava-icon icon icon-tabler icons-tabler-outline icon-tabler-transition-bottom"};function Vr(e,t){return r.openBlock(),r.createElementBlock("svg",Br,[...t[0]||(t[0]=[r.createStaticVNode('<path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M21 18a3 3 0 0 1 -3 3h-12a3 3 0 0 1 -3 -3"></path><path d="M3 3m0 3a3 3 0 0 1 3 -3h12a3 3 0 0 1 3 3v0a3 3 0 0 1 -3 3h-12a3 3 0 0 1 -3 -3z"></path><path d="M12 9v8"></path><path d="M9 14l3 3l3 -3"></path>',5)])])}const ds=z(Pr,[["render",Vr]]),Lr={},Ar={xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"baklava-icon icon icon-tabler icons-tabler-outline icon-tabler-upload"};function Ur(e,t){return r.openBlock(),r.createElementBlock("svg",Ar,[...t[0]||(t[0]=[r.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),r.createElementVNode("path",{d:"M4 17v2a2 2 0 0 0 2 2h12a2 2 0 0 0 2 -2v-2"},null,-1),r.createElementVNode("path",{d:"M7 9l5 -5l5 5"},null,-1),r.createElementVNode("path",{d:"M12 4l0 12"},null,-1)])])}const cs=z(Lr,[["render",Ur]]),$r={},Wr={xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"baklava-icon icon icon-tabler icons-tabler-outline icon-tabler-x"};function Hr(e,t){return r.openBlock(),r.createElementBlock("svg",Wr,[...t[0]||(t[0]=[r.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),r.createElementVNode("path",{d:"M18 6l-12 12"},null,-1),r.createElementVNode("path",{d:"M6 6l12 12"},null,-1)])])}const us=z($r,[["render",Hr]]),Fr=Object.freeze(Object.defineProperty({__proto__:null,Check:Qn,CodeVariable:es,Copy:ts,DotsVertical:ns,Download:ss,LayoutSidebarLeftCollapse:tr,LayoutSidebarLeftExpand:rr,LayoutSidebarRight:dr,LayoutSidebarRightCollapse:as,LayoutSidebarRightExpand:$t,LockCode:Wt,PlayerPlay:vr,Plus:rs,Restore:os,Schema:is,SchemaOff:ls,TransitionBottom:ds,Upload:cs,X:us},Symbol.toStringTag,{value:"Module"}));function Gr(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var ut={exports:{}};var jr=ut.exports,hs;function zr(){return hs||(hs=1,(function(e,t){(function(s,a){e.exports=a()})(jr,function(){return(function(){var n={686:(function(o,i,l){l.d(i,{default:function(){return j}});var d=l(279),c=l.n(d),h=l(370),b=l.n(h),m=l(817),D=l.n(m);function g(k){try{return document.execCommand(k)}catch{return!1}}var M=function(N){var v=D()(N);return g("cut"),v},f=M;function w(k){var N=document.documentElement.getAttribute("dir")==="rtl",v=document.createElement("textarea");v.style.fontSize="12pt",v.style.border="0",v.style.padding="0",v.style.margin="0",v.style.position="absolute",v.style[N?"right":"left"]="-9999px";var E=window.pageYOffset||document.documentElement.scrollTop;return v.style.top="".concat(E,"px"),v.setAttribute("readonly",""),v.value=k,v}var A=function(N,v){var E=w(N);v.container.appendChild(E);var I=D()(E);return g("copy"),E.remove(),I},V=function(N){var v=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{container:document.body},E="";return typeof N=="string"?E=A(N,v):N instanceof HTMLInputElement&&!["text","search","url","tel","password"].includes(N?.type)?E=A(N.value,v):(E=D()(N),g("copy")),E},H=V;function Oe(k){"@babel/helpers - typeof";return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Oe=function(v){return typeof v}:Oe=function(v){return v&&typeof Symbol=="function"&&v.constructor===Symbol&&v!==Symbol.prototype?"symbol":typeof v},Oe(k)}var Ee=function(){var N=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},v=N.action,E=v===void 0?"copy":v,I=N.container,R=N.target,ue=N.text;if(E!=="copy"&&E!=="cut")throw new Error('Invalid "action" value, use either "copy" or "cut"');if(R!==void 0)if(R&&Oe(R)==="object"&&R.nodeType===1){if(E==="copy"&&R.hasAttribute("disabled"))throw new Error('Invalid "target" attribute. Please use "readonly" instead of "disabled" attribute');if(E==="cut"&&(R.hasAttribute("readonly")||R.hasAttribute("disabled")))throw new Error(`Invalid "target" attribute. You can't cut text from elements with "readonly" or "disabled" attributes`)}else throw new Error('Invalid "target" value, use a valid Element');if(ue)return H(ue,{container:I});if(R)return E==="cut"?f(R):H(R,{container:I})},dt=Ee;function ye(k){"@babel/helpers - typeof";return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?ye=function(v){return typeof v}:ye=function(v){return v&&typeof Symbol=="function"&&v.constructor===Symbol&&v!==Symbol.prototype?"symbol":typeof v},ye(k)}function O(k,N){if(!(k instanceof N))throw new TypeError("Cannot call a class as a function")}function X(k,N){for(var v=0;v<N.length;v++){var E=N[v];E.enumerable=E.enumerable||!1,E.configurable=!0,"value"in E&&(E.writable=!0),Object.defineProperty(k,E.key,E)}}function te(k,N,v){return N&&X(k.prototype,N),v&&X(k,v),k}function Jn(k,N){if(typeof N!="function"&&N!==null)throw new TypeError("Super expression must either be null or a function");k.prototype=Object.create(N&&N.prototype,{constructor:{value:k,writable:!0,configurable:!0}}),N&&ct(k,N)}function ct(k,N){return ct=Object.setPrototypeOf||function(E,I){return E.__proto__=I,E},ct(k,N)}function Vt(k){var N=At();return function(){var E=Ve(k),I;if(N){var R=Ve(this).constructor;I=Reflect.construct(E,arguments,R)}else I=E.apply(this,arguments);return Lt(this,I)}}function Lt(k,N){return N&&(ye(N)==="object"||typeof N=="function")?N:Xn(k)}function Xn(k){if(k===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return k}function At(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch{return!1}}function Ve(k){return Ve=Object.setPrototypeOf?Object.getPrototypeOf:function(v){return v.__proto__||Object.getPrototypeOf(v)},Ve(k)}function qe(k,N){var v="data-clipboard-".concat(k);if(N.hasAttribute(v))return N.getAttribute(v)}var U=(function(k){Jn(v,k);var N=Vt(v);function v(E,I){var R;return O(this,v),R=N.call(this),R.resolveOptions(I),R.listenClick(E),R}return te(v,[{key:"resolveOptions",value:function(){var I=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this.action=typeof I.action=="function"?I.action:this.defaultAction,this.target=typeof I.target=="function"?I.target:this.defaultTarget,this.text=typeof I.text=="function"?I.text:this.defaultText,this.container=ye(I.container)==="object"?I.container:document.body}},{key:"listenClick",value:function(I){var R=this;this.listener=b()(I,"click",function(ue){return R.onClick(ue)})}},{key:"onClick",value:function(I){var R=I.delegateTarget||I.currentTarget,ue=this.action(R)||"copy",Ut=dt({action:ue,container:this.container,target:this.target(R),text:this.text(R)});this.emit(Ut?"success":"error",{action:ue,text:Ut,trigger:R,clearSelection:function(){R&&R.focus(),window.getSelection().removeAllRanges()}})}},{key:"defaultAction",value:function(I){return qe("action",I)}},{key:"defaultTarget",value:function(I){var R=qe("target",I);if(R)return document.querySelector(R)}},{key:"defaultText",value:function(I){return qe("text",I)}},{key:"destroy",value:function(){this.listener.destroy()}}],[{key:"copy",value:function(I){var R=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{container:document.body};return H(I,R)}},{key:"cut",value:function(I){return f(I)}},{key:"isSupported",value:function(){var I=arguments.length>0&&arguments[0]!==void 0?arguments[0]:["copy","cut"],R=typeof I=="string"?[I]:I,ue=!!document.queryCommandSupported;return R.forEach(function(Ut){ue=ue&&!!document.queryCommandSupported(Ut)}),ue}}]),v})(c()),j=U}),828:(function(o){var i=9;if(typeof Element<"u"&&!Element.prototype.matches){var l=Element.prototype;l.matches=l.matchesSelector||l.mozMatchesSelector||l.msMatchesSelector||l.oMatchesSelector||l.webkitMatchesSelector}function d(c,h){for(;c&&c.nodeType!==i;){if(typeof c.matches=="function"&&c.matches(h))return c;c=c.parentNode}}o.exports=d}),438:(function(o,i,l){var d=l(828);function c(m,D,g,M,f){var w=b.apply(this,arguments);return m.addEventListener(g,w,f),{destroy:function(){m.removeEventListener(g,w,f)}}}function h(m,D,g,M,f){return typeof m.addEventListener=="function"?c.apply(null,arguments):typeof g=="function"?c.bind(null,document).apply(null,arguments):(typeof m=="string"&&(m=document.querySelectorAll(m)),Array.prototype.map.call(m,function(w){return c(w,D,g,M,f)}))}function b(m,D,g,M){return function(f){f.delegateTarget=d(f.target,D),f.delegateTarget&&M.call(m,f)}}o.exports=h}),879:(function(o,i){i.node=function(l){return l!==void 0&&l instanceof HTMLElement&&l.nodeType===1},i.nodeList=function(l){var d=Object.prototype.toString.call(l);return l!==void 0&&(d==="[object NodeList]"||d==="[object HTMLCollection]")&&"length"in l&&(l.length===0||i.node(l[0]))},i.string=function(l){return typeof l=="string"||l instanceof String},i.fn=function(l){var d=Object.prototype.toString.call(l);return d==="[object Function]"}}),370:(function(o,i,l){var d=l(879),c=l(438);function h(g,M,f){if(!g&&!M&&!f)throw new Error("Missing required arguments");if(!d.string(M))throw new TypeError("Second argument must be a String");if(!d.fn(f))throw new TypeError("Third argument must be a Function");if(d.node(g))return b(g,M,f);if(d.nodeList(g))return m(g,M,f);if(d.string(g))return D(g,M,f);throw new TypeError("First argument must be a String, HTMLElement, HTMLCollection, or NodeList")}function b(g,M,f){return g.addEventListener(M,f),{destroy:function(){g.removeEventListener(M,f)}}}function m(g,M,f){return Array.prototype.forEach.call(g,function(w){w.addEventListener(M,f)}),{destroy:function(){Array.prototype.forEach.call(g,function(w){w.removeEventListener(M,f)})}}}function D(g,M,f){return c(document.body,g,M,f)}o.exports=h}),817:(function(o){function i(l){var d;if(l.nodeName==="SELECT")l.focus(),d=l.value;else if(l.nodeName==="INPUT"||l.nodeName==="TEXTAREA"){var c=l.hasAttribute("readonly");c||l.setAttribute("readonly",""),l.select(),l.setSelectionRange(0,l.value.length),c||l.removeAttribute("readonly"),d=l.value}else{l.hasAttribute("contenteditable")&&l.focus();var h=window.getSelection(),b=document.createRange();b.selectNodeContents(l),h.removeAllRanges(),h.addRange(b),d=h.toString()}return d}o.exports=i}),279:(function(o){function i(){}i.prototype={on:function(l,d,c){var h=this.e||(this.e={});return(h[l]||(h[l]=[])).push({fn:d,ctx:c}),this},once:function(l,d,c){var h=this;function b(){h.off(l,b),d.apply(c,arguments)}return b._=d,this.on(l,b,c)},emit:function(l){var d=[].slice.call(arguments,1),c=((this.e||(this.e={}))[l]||[]).slice(),h=0,b=c.length;for(h;h<b;h++)c[h].fn.apply(c[h].ctx,d);return this},off:function(l,d){var c=this.e||(this.e={}),h=c[l],b=[];if(h&&d)for(var m=0,D=h.length;m<D;m++)h[m].fn!==d&&h[m].fn._!==d&&b.push(h[m]);return b.length?c[l]=b:delete c[l],this}},o.exports=i,o.exports.TinyEmitter=i})},s={};function a(o){if(s[o])return s[o].exports;var i=s[o]={exports:{}};return n[o](i,i.exports,a),i.exports}return(function(){a.n=function(o){var i=o&&o.__esModule?function(){return o.default}:function(){return o};return a.d(i,{a:i}),i}})(),(function(){a.d=function(o,i){for(var l in i)a.o(i,l)&&!a.o(o,l)&&Object.defineProperty(o,l,{enumerable:!0,get:i[l]})}})(),(function(){a.o=function(o,i){return Object.prototype.hasOwnProperty.call(o,i)}})(),a(686)})().default})})(ut)),ut.exports}var Zr=zr();const qr=Gr(Zr),Jr=e=>({toClipboard(t,n){return new Promise((s,a)=>{const o=document.createElement("button"),i=new qr(o,{text:()=>t,action:()=>"copy",container:n!==void 0?n:document.body});i.on("success",l=>{i.destroy(),s(l)}),i.on("error",l=>{i.destroy(),a(l)}),document.body.appendChild(o),o.click(),document.body.removeChild(o)})}}),Xr={key:0,class:"baklava-button"},fs=r.defineComponent({__name:"CopyToClipboard",props:{text:String},setup(e){const{toClipboard:t}=Jr(),n=e,s=r.toRef(n,"text"),a=r.ref(!1),o=async()=>{try{await t(s.value),a.value=!0,setTimeout(()=>a.value=!1,1500),console.log("Copied to clipboard")}catch(i){console.error(i)}};return(i,l)=>(r.openBlock(),r.createElementBlock("div",null,[a.value?(r.openBlock(),r.createElementBlock("button",Xr,[r.createVNode(r.unref(Qn))])):(r.openBlock(),r.createElementBlock("button",{key:1,onClick:o,class:"baklava-button"},[r.createVNode(r.unref(ts))]))]))}}),Kr={class:"code-editor"},Qr={class:"code-buttons"},eo=r.defineComponent({__name:"CodeEditor",props:r.mergeModels({locked:{type:Boolean},extensions:{}},{modelValue:{required:!0},modelModifiers:{}}),emits:r.mergeModels(["update:locked"],["update:modelValue"]),setup(e,{emit:t}){const n=r.useModel(e,"modelValue"),s=t,a=o=>s("update:locked",o);return(o,i)=>{const l=r.resolveComponent("codemirror");return r.openBlock(),r.createElementBlock("div",Kr,[r.createElementVNode("div",Qr,[e.locked?(r.openBlock(),r.createElementBlock("button",{key:0,class:"baklava-button",title:"The code is locked.",onClick:i[0]||(i[0]=d=>a(!1))},[r.createVNode(r.unref(Wt))])):r.createCommentVNode("",!0),r.createVNode(fs,{text:e.modelValue},null,8,["text"])]),r.createVNode(l,{modelValue:n.value,"onUpdate:modelValue":i[1]||(i[1]=d=>n.value=d),extensions:e.extensions,class:"codemirror",style:{height:"100%"},onKeydown:i[2]||(i[2]=d=>a(!0))},null,8,["modelValue","extensions"])])}}}),to=r.defineComponent({__name:"CodeGraphEditor",props:{viewModel:{}},setup(e){const t=e,n=r.toRef(t,"viewModel"),s=a=>a.events.update.emit(null);return r.onMounted(n.value.onMounted),r.onBeforeUnmount(n.value.onBeforeUnmount),r.watch(n,(a,o)=>{o&&o.onBeforeUnmount(),a&&a.onMounted()}),(a,o)=>(r.openBlock(),r.createBlock(r.unref(S.BaklavaEditor),{viewModel:n.value},{palette:r.withCtx(()=>[r.createVNode(r.unref(_s))]),node:r.withCtx(i=>[r.createVNode(r.unref(ps),r.mergeProps(i,{onUpdate:l=>s(i.node)}),null,16,["onUpdate"])]),sidebar:r.withCtx(i=>[r.createVNode(r.unref(ms),r.normalizeProps(r.guardReactiveProps(i)),{codeEditor:r.withCtx(({node:l})=>[r.renderSlot(a.$slots,"sidebarCodeEditor",{node:l})]),_:3},16)]),_:3},8,["viewModel"]))}}),no={class:"code-graph-info"},so=r.defineComponent({__name:"CodeGraphInfo",props:{viewModel:{}},setup(e){return(t,n)=>(r.openBlock(),r.createElementBlock("div",no,[r.createElementVNode("div",null,"Editor graph: "+r.toDisplayString(e.viewModel.editor.graph.shortId),1),r.createElementVNode("div",null,"Displayed graph: "+r.toDisplayString(e.viewModel.displayedGraph.shortId),1),r.createElementVNode("div",null,"Graphs: "+r.toDisplayString(e.viewModel.editor.graphIds),1),r.createElementVNode("div",null,"Graph templates: "+r.toDisplayString(e.viewModel.editor.graphTemplateIds),1),r.createElementVNode("div",null,"Engine status: "+r.toDisplayString(e.viewModel.engine?.status),1)]))}}),ao=["data-node-type","id"],ro={class:"__title-label",style:{"flex-grow":"1"}},oo={key:0},io={class:"__menu",style:{display:"flex"}},lo={class:"__outputs"},co={key:0},uo=["id","title"],ho={class:"__inputs"},fo={key:0},po=["id","title"],ps=r.defineComponent({__name:"CodeGraphNode",props:{node:{},selected:{type:Boolean,default:!1},dragging:{type:Boolean}},emits:["select","start-drag","update"],setup(e,{emit:t}){const n=S.Components.ContextMenu,s=S.Components.NodeInterface,a=e,o=r.computed(()=>a.node),i=t,{viewModel:l}=S.useViewModel(),{graph:d,switchGraph:c}=S.useGraph(),h=r.ref(null),b=r.ref(!1),m=r.ref(""),D=r.ref(null),g=r.ref(!1);let M=0,f=0;const w=r.ref(!1),A=r.computed(()=>{const U=[{value:"edit",label:"Edit"},{value:"rename",label:"Rename"},{value:"delete",label:"Delete"}];return a.node.type.startsWith(q.GRAPH_NODE_TYPE_PREFIX)&&U.push({value:"editSubgraph",label:"Edit Subgraph"}),U}),V=r.computed(()=>({"--selected":a.selected,"--dragging":a.dragging,"--two-column":!!a.node.twoColumn,"--hidden":o.value.state?.hidden})),H=r.computed(()=>({"--reverse-y":a.node.reverseY??l.value.settings.nodes.reverseY})),Oe=r.computed(()=>({top:`${a.node.position?.y??0}px`,left:`${a.node.position?.x??0}px`,"--width":`${a.node.width??l.value.settings.nodes.defaultWidth}px`})),Ee=r.computed(()=>Object.values(a.node.inputs).filter(U=>!U.hidden)),dt=r.computed(()=>Object.values(a.node.outputs).filter(U=>!U.hidden)),ye=()=>{Jn(),i("select")},O=U=>{a.selected||ye(),i("start-drag",U)},X=()=>{w.value=!0},te=()=>{const U=l.value.displayedGraph.sidebar;U.nodeId=a.node.id,U.visible=!0},Jn=()=>{const U=l.value.displayedGraph.sidebar;U.nodeId=a.node.id},ct=async U=>{switch(U){case"edit":te();break;case"delete":d.value.removeNode(a.node);break;case"rename":m.value=a.node.state.variableName,b.value=!0,await r.nextTick(),D.value?.focus();break;case"editSubgraph":c(a.node.template);break}},Vt=()=>{o.value.state.variableName=m.value,o.value.events.titleChanged.emit(o.value.state.variableName),b.value=!1},Lt=()=>{h.value&&l.value.hooks.renderNode.execute({node:a.node,el:h.value})},Xn=U=>{g.value=!0,M=a.node.width,f=U.clientX,U.preventDefault()},At=U=>{o.value.state&&(o.value.state.integrated=U,i("update"))},Ve=U=>{if(!g.value)return;const j=U.clientX-f,k=M+j/d.value.scaling,N=l.value.settings.nodes.minWidth,v=l.value.settings.nodes.maxWidth;o.value.width=Math.max(N,Math.min(v,k))},qe=()=>{g.value=!1};return r.onMounted(()=>{Lt(),window.addEventListener("mousemove",Ve),window.addEventListener("mouseup",qe)}),r.onUpdated(Lt),r.onBeforeUnmount(()=>{window.removeEventListener("mousemove",Ve),window.removeEventListener("mouseup",qe)}),(U,j)=>(r.openBlock(),r.createElementBlock("div",{class:r.normalizeClass([V.value,"baklava-node"]),"data-node-type":o.value.type,id:o.value.id,style:r.normalizeStyle(Oe.value),ref_key:"el",ref:h,onPointerdown:ye},[r.unref(l).settings.nodes.resizable?(r.openBlock(),r.createElementBlock("div",{key:0,class:"__resize-handle",onMousedown:Xn},null,32)):r.createCommentVNode("",!0),r.createElementVNode("div",{class:"__title",onPointerdown:r.withModifiers(O,["self","stop"]),onContextmenu:r.withModifiers(X,["prevent"])},[o.value.inputs._code?(r.openBlock(),r.createBlock(r.unref(Ht),{key:0,intf:o.value.inputs._code,node:o.value,title:o.value.inputs._code.value,class:"--input","data-interface-type":"node",style:{"flex-grow":"0"}},null,8,["intf","node","title"])):r.createCommentVNode("",!0),b.value?r.withDirectives((r.openBlock(),r.createElementBlock("input",{key:2,ref_key:"renameInputEl",ref:D,"onUpdate:modelValue":j[4]||(j[4]=k=>m.value=k),class:"baklava-input",placeholder:"Node Name",style:{"flex-grow":"1"},type:"text",onBlur:Vt,onKeydown:r.withKeys(Vt,["enter"])},null,544)),[[r.vModelText,m.value]]):(r.openBlock(),r.createElementBlock(r.Fragment,{key:1},[r.createElementVNode("div",ro,[o.value.idx>-1?(r.openBlock(),r.createElementBlock("span",oo,r.toDisplayString(o.value.idx+1)+" > ",1)):r.createCommentVNode("",!0),r.createTextVNode(" "+r.toDisplayString(o.value.state.variableName.length>0?o.value.state.variableName:o.value.title),1)]),r.createElementVNode("div",io,[o.value.isCodeNode?(r.openBlock(),r.createElementBlock(r.Fragment,{key:0},[o.value.state.lockCode?(r.openBlock(),r.createBlock(r.unref(Wt),{key:0,class:"--clickable mx-1",onClick:j[0]||(j[0]=k=>o.value.lockCode=!1)})):r.createCommentVNode("",!0),o.value.hasConnectedOutputNodes?(r.openBlock(),r.createElementBlock(r.Fragment,{key:1},[o.value.state.integrated?(r.openBlock(),r.createBlock(r.unref(es),{key:1,class:"--clickable mx-1",onClick:j[2]||(j[2]=k=>At(!1))})):(r.openBlock(),r.createBlock(r.unref(ds),{key:0,class:"--clickable mx-1",onClick:j[1]||(j[1]=k=>At(!0))}))],64)):r.createCommentVNode("",!0),o.value.isSelected&&!r.unref(l).displayedGraph.sidebar.visible?(r.openBlock(),r.createBlock(r.unref($t),{key:2,class:"--clickable mx-1",onClick:te})):r.createCommentVNode("",!0)],64)):r.createCommentVNode("",!0),r.createVNode(r.unref(ns),{class:"--clickable mx-1",onClick:X}),r.createVNode(r.unref(n),{modelValue:w.value,"onUpdate:modelValue":j[3]||(j[3]=k=>w.value=k),x:0,y:0,items:A.value,onClick:ct},null,8,["modelValue","items"])])],64)),o.value.outputs._code?(r.openBlock(),r.createBlock(r.unref(Ht),{key:3,node:o.value,intf:o.value.outputs._code,class:"--output",title:o.value.outputs._code.value,"data-interface-type":"node"},null,8,["node","intf","title"])):r.createCommentVNode("",!0)],32),r.createElementVNode("div",{class:r.normalizeClass(["__content",H.value]),onKeydown:j[5]||(j[5]=r.withKeys(r.withModifiers(()=>{},["stop"]),["delete"])),onContextmenu:j[6]||(j[6]=r.withModifiers(()=>{},["prevent"]))},[r.createElementVNode("div",lo,[(r.openBlock(!0),r.createElementBlock(r.Fragment,null,r.renderList(dt.value,k=>(r.openBlock(),r.createElementBlock(r.Fragment,{key:k.id},[o.value.state?.hidden?(r.openBlock(),r.createElementBlock("div",co,[k.port?(r.openBlock(),r.createElementBlock("div",{key:0,id:k.id,title:k.name,class:"baklava-node-interface --output --connected"},[...j[7]||(j[7]=[r.createElementVNode("div",{class:"__port"},null,-1)])],8,uo)):r.createCommentVNode("",!0)])):r.renderSlot(U.$slots,"nodeInterface",{key:1,type:"output",node:o.value,intf:k},()=>[r.createVNode(r.unref(s),{node:o.value,intf:k,title:k.value},null,8,["node","intf","title"])])],64))),128))]),r.createElementVNode("div",ho,[(r.openBlock(!0),r.createElementBlock(r.Fragment,null,r.renderList(Ee.value,k=>(r.openBlock(),r.createElementBlock(r.Fragment,{key:k.id},[o.value.state?.hidden?(r.openBlock(),r.createElementBlock("div",fo,[k.port?(r.openBlock(),r.createElementBlock("div",{key:0,id:k.id,title:k.name,class:"baklava-node-interface --input --connected"},[...j[8]||(j[8]=[r.createElementVNode("div",{class:"__port"},null,-1)])],8,po)):r.createCommentVNode("",!0)])):r.renderSlot(U.$slots,"nodeInterface",{key:1,node:o.value,intf:k,type:"input"},()=>[r.createVNode(r.unref(s),{node:o.value,intf:k,title:k.value},null,8,["node","intf","title"])])],64))),128))])],34)],46,ao))}}),mo=["id"],_o={class:"align-middle"},Ht=r.defineComponent({__name:"CodeGraphNodeInterface",props:{node:{},intf:{}},setup(e){const t=e,{viewModel:n}=S.useViewModel(),{hoveredOver:s,temporaryConnection:a}=S.useTemporaryConnection(),o=r.ref(null),i=r.computed(()=>t.intf.connectionCount>0),l=r.computed(()=>({"--connected":i.value})),d=()=>{s(t.intf)},c=()=>{s(void 0)},h=()=>{o.value&&n.value.hooks.renderInterface.execute({intf:t.intf,el:o.value})};return r.onMounted(h),r.onUpdated(h),(b,m)=>(r.openBlock(),r.createElementBlock("div",{id:e.intf.id,ref_key:"el",ref:o,class:r.normalizeClass(["baklava-node-interface",l.value])},[e.intf.port?(r.openBlock(),r.createElementBlock("div",{key:0,class:r.normalizeClass([{"--selected":r.unref(a)?.from===e.intf},"__port"]),onPointerover:d,onPointerout:c},null,34)):r.createCommentVNode("",!0),r.createElementVNode("span",_o,[r.renderSlot(b.$slots,"default")])],10,mo))}}),yo=["title"],go={key:0,class:"__label"},Ft=r.defineComponent({__name:"SidebarCheckbox",props:{disabled:{type:Boolean},inversed:{type:Boolean},modelValue:{type:Boolean},name:{}},emits:["update:modelValue"],setup(e,{emit:t}){const n=t;return(s,a)=>(r.openBlock(),r.createElementBlock("div",{class:r.normalizeClass(["baklava-checkbox",{"--checked":e.inversed?!e.modelValue:e.modelValue,"--disabled":e.disabled}]),title:e.name,onClick:a[0]||(a[0]=o=>n("update:modelValue",!e.modelValue))},[a[1]||(a[1]=r.createElementVNode("div",{class:"__checkmark-container"},[r.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",viewBox:"0 0 18 18"},[r.createElementVNode("path",{class:"__checkmark",d:"M 6 5 L 6 10 L 16 10",transform:"rotate(-45 10 10)"})])],-1)),e.name?(r.openBlock(),r.createElementBlock("div",go,r.toDisplayString(e.name),1)):r.createCommentVNode("",!0)],10,yo))}}),ko={class:"__header"},bo={class:"__node-name"},wo={class:"__interfaces"},vo={class:"__inputs"},No={style:{display:"flex"}},Co={class:"__outputs"},Mo={key:0,class:"__interface"},So=["placeholder"],Oo={style:{display:"flex"}},ms=r.defineComponent({__name:"CodeGraphSidebar",setup(e){const{viewModel:t}=S.useViewModel(),{graph:n}=S.useGraph(),s=r.ref(null),a=r.toRef(t.value.settings.sidebar,"width"),o=r.computed(()=>t.value.settings.sidebar.resizable);let i=0,l=0;const d=r.computed(()=>{const w=n.value.sidebar.nodeId;return n.value.nodes.find(A=>A.id===w)}),c=r.computed(()=>d.value),h=r.computed(()=>({width:`${a.value}px`})),b=r.computed(()=>c.value?Object.values(c.value.inputs).filter(w=>w.displayInSidebar&&w.component):[]),m=r.computed(()=>c.value?Object.values(c.value.outputs).filter(w=>w.displayInSidebar&&w.component):[]),D=()=>{n.value.sidebar.visible=!1},g=()=>{d.value?.events.update.emit(null)},M=w=>{i=a.value,l=w.clientX,window.addEventListener("mousemove",f),window.addEventListener("mouseup",()=>{window.removeEventListener("mousemove",f)},{once:!0})},f=w=>{const A=s.value?.parentElement?.getBoundingClientRect().width??500,V=w.clientX-l;let H=i-V;H<300?H=300:H>.9*A&&(H=.9*A),a.value=H};return(w,A)=>(r.openBlock(),r.createElementBlock("div",{class:r.normalizeClass([{"--open":r.unref(n).sidebar.visible},"baklava-sidebar"]),style:r.normalizeStyle(h.value),ref_key:"el",ref:s},[o.value?(r.openBlock(),r.createElementBlock("div",{key:0,class:"__resizer",onMousedown:M},null,32)):r.createCommentVNode("",!0),d.value?(r.openBlock(),r.createElementBlock(r.Fragment,{key:1},[r.createElementVNode("div",ko,[r.createElementVNode("button",{tabindex:"-1",class:"__close",onClick:D},"×"),r.createElementVNode("div",bo,[r.createElementVNode("b",null,r.toDisplayString(d.value.title),1)])]),r.createElementVNode("div",wo,[r.createElementVNode("div",vo,[(r.openBlock(!0),r.createElementBlock(r.Fragment,null,r.renderList(b.value,V=>(r.openBlock(),r.createElementBlock("div",{key:V.id,class:"__interface"},[r.createElementVNode("div",No,[r.createVNode(Ft,{modelValue:V.hidden,"onUpdate:modelValue":[H=>V.hidden=H,A[0]||(A[0]=()=>d.value?.events.update.emit(null))],disabled:!V.optional,inversed:"",style:{"padding-right":"8px"}},null,8,["modelValue","onUpdate:modelValue","disabled"]),(r.openBlock(),r.createBlock(r.resolveDynamicComponent(V.component),{modelValue:V.value,"onUpdate:modelValue":H=>V.value=H,node:d.value,intf:V,style:{width:"100%"}},null,8,["modelValue","onUpdate:modelValue","node","intf"]))])]))),128))]),r.createElementVNode("div",Co,[c.value&&c.value.state?(r.openBlock(),r.createElementBlock("div",Mo,[A[3]||(A[3]=r.createElementVNode("label",null,"Variable name",-1)),r.withDirectives(r.createElementVNode("input",{"onUpdate:modelValue":A[1]||(A[1]=V=>c.value.state.variableName=V),placeholder:c.value.variableName,type:"text",class:"baklava-input",title:"Variable name",onBlur:g,onKeydown:r.withKeys(g,["enter"])},null,40,So),[[r.vModelText,c.value.state.variableName]])])):r.createCommentVNode("",!0),(r.openBlock(!0),r.createElementBlock(r.Fragment,null,r.renderList(m.value,V=>(r.openBlock(),r.createElementBlock("div",{key:V.id,class:"__interface"},[r.createElementVNode("div",Oo,[r.createVNode(Ft,{modelValue:V.hidden,"onUpdate:modelValue":[H=>V.hidden=H,A[2]||(A[2]=()=>d.value?.events.update.emit(null))],disabled:!V.optional,inversed:"",style:{"padding-right":"8px"}},null,8,["modelValue","onUpdate:modelValue","disabled"]),(r.openBlock(),r.createBlock(r.resolveDynamicComponent(V.component),{modelValue:V.value,"onUpdate:modelValue":H=>V.value=H,node:d.value,intf:V,style:{width:"100%"}},null,8,["modelValue","onUpdate:modelValue","node","intf"]))])]))),128))])]),r.renderSlot(w.$slots,"codeEditor",{node:d.value})],64)):r.createCommentVNode("",!0)],6))}});function Eo(e,t){return Object.fromEntries(Object.entries(e).filter(t))}function To(e,t){return Object.fromEntries(Object.entries(e).map(([n,s])=>[n,t(s)]))}const Io={class:"baklava-node --palette",style:{"margin-top":"-20px","margin-bottom":"20px"}},Do={key:0,style:{display:"flex","justify-content":"space-between"}},xo=["onClick"],Yo={key:0,style:{margin:"auto 0","font-size":"12px"}},_s=r.defineComponent({__name:"CodeNodePalette",setup(e){const t=S.Components.PaletteEntry,{viewModel:n}=S.useViewModel(),{x:s,y:a}=Pa.usePointer(),{transform:o}=S.useTransform(),i=S.useNodeCategories(n),l=r.inject("editorEl"),d=r.ref(""),c=r.ref(null),h=()=>d.value?i.value.filter(g=>g.name.toLowerCase().includes(d.value.toLowerCase())||Object.values(g.nodeTypes).some(M=>M.title.toLowerCase().includes(d.value.toLowerCase()))):i.value,b=g=>d.value?Eo(g,M=>{const f=M[1];return f.category.includes(d.value.toLowerCase())||f.title?.toLowerCase().includes(d.value.toLowerCase())}):g,m=r.computed(()=>{if(!c.value||!l?.value)return{};const{left:g,top:M}=l.value.getBoundingClientRect();return{top:`${a.value-M}px`,left:`${s.value-g}px`}}),D=(g,M)=>{c.value={type:g,nodeInformation:M};const f=()=>{const w=r.reactive(new M.type);n.value.displayedGraph.addNode(w);const A=l.value.getBoundingClientRect(),[V,H]=o(s.value-A.left,a.value-A.top);w.position.x=V,w.position.y=H,c.value=null,document.removeEventListener("pointerup",f)};document.addEventListener("pointerup",f)};return(g,M)=>(r.openBlock(),r.createElementBlock(r.Fragment,null,[r.createElementVNode("div",{class:r.normalizeClass([{"--open":r.unref(n).settings.palette.enabled},"baklava-node-palette"]),onContextmenu:M[1]||(M[1]=r.withModifiers(()=>{},["stop","prevent"]))},[r.createElementVNode("div",Io,[r.withDirectives(r.createElementVNode("input",{"onUpdate:modelValue":M[0]||(M[0]=f=>d.value=f),type:"text",class:"baklava-input",title:"Filter nodes",onKeyup:h},null,544),[[r.vModelText,d.value]])]),(r.openBlock(!0),r.createElementBlock(r.Fragment,null,r.renderList(h(),f=>(r.openBlock(),r.createElementBlock("section",{key:f.name},[f.name!=="default"?(r.openBlock(),r.createElementBlock("h3",Do,[r.createElementVNode("div",{onClick:w=>d.value=f.name,style:{cursor:"pointer"}},r.toDisplayString(f.name),9,xo),Object.keys(b(f.nodeTypes)).length<Object.values(f.nodeTypes).length?(r.openBlock(),r.createElementBlock("div",Yo," ( "+r.toDisplayString(Object.keys(b(f.nodeTypes)).length)+" / "+r.toDisplayString(Object.values(f.nodeTypes).length)+" ) ",1)):r.createCommentVNode("",!0)])):r.createCommentVNode("",!0),(r.openBlock(!0),r.createElementBlock(r.Fragment,null,r.renderList(b(f.nodeTypes),(w,A)=>(r.openBlock(),r.createBlock(r.unref(t),{key:A,title:w.title,type:A,onPointerdown:V=>D(A,w)},null,8,["title","type","onPointerdown"]))),128))]))),128))],34),r.createVNode(r.Transition,{name:"fade"},{default:r.withCtx(()=>[c.value?(r.openBlock(),r.createElementBlock("div",{key:0,class:"baklava-dragged-node",style:r.normalizeStyle(m.value)},[r.createVNode(r.unref(t),{type:c.value.type,title:c.value.nodeInformation.title},null,8,["type","title"])],4)):r.createCommentVNode("",!0)]),_:1})],64))}}),Ro={},Po={class:"prependIcon"},Bo={class:"appendIcon"};function Vo(e,t){const n=r.resolveComponent("router-link");return r.openBlock(),r.createBlock(n,{class:"navItem"},{default:r.withCtx(()=>[r.createElementVNode("span",Po,[r.renderSlot(e.$slots,"prependIcon")]),r.renderSlot(e.$slots,"default"),r.createElementVNode("span",Bo,[r.renderSlot(e.$slots,"appendIcon")])]),_:3})}const Gt=z(Ro,[["render",Vo]]),Lo={class:"navbar"},Ao=["onClick"],Uo=r.defineComponent({__name:"NavBar",props:{viewModel:{},editorStates:{},routes:{}},emits:["click:remove"],setup(e,{emit:t}){const n=t,s=a=>{n("click:remove",a)};return(a,o)=>(r.openBlock(),r.createElementBlock("nav",Lo,[r.renderSlot(a.$slots,"prepend"),(r.openBlock(!0),r.createElementBlock(r.Fragment,null,r.renderList(e.editorStates,i=>(r.openBlock(),r.createBlock(Gt,{key:i.graph.id,class:r.normalizeClass({active:i.graph.id===e.viewModel.displayedGraph.id}),to:{name:e.routes?.edit??"edit",params:{editorId:i.graph.id}}},{appendIcon:r.withCtx(()=>[r.createElementVNode("button",{class:"remove",onClick:r.withModifiers(l=>s(i.graph.id),["prevent"])},[r.createVNode(r.unref(us))],8,Ao)]),default:r.withCtx(()=>[r.createTextVNode(r.toDisplayString(i.graph.id.slice(0,6))+" ",1)]),_:2},1032,["class","to"]))),128)),r.renderSlot(a.$slots,"append",{},()=>[r.createVNode(Gt,{to:{name:e.routes?.new??"new"},class:"navItem"},{default:r.withCtx(()=>[r.createVNode(r.unref(rs),{class:"plus"})]),_:1},8,["to"])])]))}}),$o=r.defineComponent({props:{intf:{type:Object,required:!0},modelValue:{type:String,required:!0}},emits:["update:modelValue"],setup(e,{emit:t}){return{v:r.computed({get:()=>e.modelValue,set:s=>{t("update:modelValue",s)}})}}}),Wo={style:{position:"relative"}},Ho={style:{"font-size":"12px",padding:"0 6px",position:"absolute",top:"-8px","background-color":"var(--baklava-node-color-background)"}},Fo=["placeholder","title"];function Go(e,t,n,s,a,o){return r.openBlock(),r.createElementBlock("div",Wo,[r.createElementVNode("label",Ho,r.toDisplayString(e.intf.name),1),r.withDirectives(r.createElementVNode("input",{"onUpdate:modelValue":t[0]||(t[0]=i=>e.v=i),type:"text",class:"baklava-input",placeholder:e.intf.name,title:e.intf.name},null,8,Fo),[[r.vModelText,e.v]])])}const jt=z($o,[["render",Go]]),jo=Object.freeze(Object.defineProperty({__proto__:null,CodeEditor:eo,CodeGraphEditor:to,CodeGraphInfo:so,CodeGraphNode:ps,CodeGraphNodeInterface:Ht,CodeGraphSidebar:ms,CodeNodePalette:_s,CopyToClipboard:fs,NavBar:Uo,NavItem:Gt,SidebarCheckbox:Ft,TextInputInterface:jt},Symbol.toStringTag,{value:"Module"}));Le.escape=e=>e;class zt extends q.AbstractNode{codeTemplate;isCodeNode=!0;mask=null;name="";state;_variableName="";inputs={};outputs={};constructor(){super(),this.initializeIo(),this.twoColumn=!0,this.state=r.reactive({codeTemplate:"",hidden:!1,integrated:!1,lockCode:!1,modules:[],props:null,script:"",variableName:""}),this.codeTemplate=function(){return`${this.name}(${ys(this.codeNodeInputs).join(", ")})`}}get code(){return this.graph.code}get codeNodeInputs(){return Object.fromEntries(Object.entries(this.inputs).filter(t=>t[1].isCodeNode&&t[1].type!="node"))}get codeNodeOutputs(){return Object.fromEntries(Object.entries(this.outputs).filter(t=>t[1].isCodeNode&&t[1].type!="node"))}get graph(){return super.graph}get hasConnectedOutputNodes(){return this.getConnectedNodes("outputs").length>0}get idx(){return this.graph.nodes.filter(t=>!t.state.integrated).indexOf(this)??-1}get idxByType(){return this.graph.getNodesByType(this.type).indexOf(this)??-1}get idxByVariableNames(){return this.graph.getNodesByVariableName(this.state.variableName??this._variableName).filter(t=>!t.state.integrated).indexOf(this)??-1}get isSelected(){return this.graph.selectedNodeIds.includes(this.id)}get lockCode(){return this.state.lockCode}set lockCode(t){this.state.lockCode=t,this.events.update.emit(null)}get optionalInputs(){return Object.fromEntries(Object.entries(this.codeNodeInputs).filter(t=>t[1].optional))}get requiredInputs(){return Object.fromEntries(Object.entries(this.codeNodeInputs).filter(t=>!t[1].optional))}get script(){return this.outputs._code?.value??""}set script(t){this.outputs._code&&(this.outputs._code.value=t),this.events.update.emit(null)}get shortId(){return this.id.slice(0,6)}get shownInSidebar(){return this.graph.sidebar.nodeId===this.id}get subgraph(){}get variableName(){return(this.state.variableName?this.state.variableName:this._variableName)+(this.idxByVariableNames+1)}getConnectedNodeByInterface(t,n){const s=this.getConnectedNodesByInterface(t,n);return s.length>0?s[0]:null}getConnectedNodes(t){let n=[];if(t!=="inputs"){const s=this.graph.connections.filter(a=>a.from.name!=="_code").filter(a=>a.from.nodeId===this.id).map(a=>a.to.nodeId);s&&(n=n.concat(s))}if(t!=="outputs"){const s=this.graph.connections.filter(a=>a.from.name!=="_code").filter(a=>a.to.nodeId===this.id).map(a=>a.from.nodeId);s&&(n=n.concat(s))}return!n||n.length==0?[]:n.map(s=>this.graph.findNodeById(s))}getConnectedNodesByInterface(t,n){let s=[];if(n!=="outputs"&&this.inputs[t]){const a=this.graph.connections.filter(o=>o.to.id===this.inputs[t]?.id||o.from.id===this.inputs[t]?.id).map(o=>o.from.nodeId);a&&(s=s.concat(a))}if(n!=="inputs"&&this.outputs[t]){const a=this.graph.connections.filter(o=>o.from.id===this.outputs[t]?.id||o.from.id===this.outputs[t]?.id).map(o=>o.to.nodeId);a&&(s=s.concat(a))}return!s||s.length==0?[]:s.map(a=>this.graph.findNodeById(a))}remove(){this.graph?.removeNode(this)}renderCode(t){return Le.render(this.state.codeTemplate,t)}updateCodeTemplate(){this.state.codeTemplate=this.codeTemplate.call(this)}updateModules(t){if(t)this.state.modules=t;else if(this.type.includes(".")){const n=this.type.split(".");this.state.modules.push(n.slice(0,n.length-1).join("."))}}updateOutputNames(){Object.values(this.codeNodeOutputs).forEach(t=>{t.name=this.state.integrated?"":this.variableName+t.suffix})}updateOutputValues(t){Object.keys(this.outputs).forEach(n=>{n!=="_code"&&(t[n]=this.state.integrated?t._code:this.outputs[n].name)})}updateProps(t){this.state.props=t}updateInputValues(t){const n=Object.keys(this.inputs);Object.keys(t).forEach(s=>{!n.includes(s)||!this.inputs[s]||(this.inputs[s].value=t[s],this.inputs[s].setHidden(!1))})}}class ht extends zt{calculate=(t,n)=>{const s={};return this.lockCode||(s._code=this.renderCode({inputs:t,...n})),this.updateOutputValues(s),s};executeFactory(t,n){Object.keys(n||{}).forEach(s=>{const a=n[s]();t==="input"?this.addInput(s,a):this.addOutput(s,a)})}load(t){super.load(t),Zt(this.graph,t),this.afterLoaded()}save(){const t=super.save();return gs(this.graph,t),t}}const ys=(e,t=!0)=>{const n=[],s=Object.keys(e);return s.forEach(a=>{if(e[a]?.hidden)return;const i=t&&n.length<s.indexOf(a)?`${a}=`:"";n.push(`${i}{{ inputs.${a} }}`)}),n},Zt=(e,t)=>{if(!e)return;const n=e.findNodeById(t.id);if(!n||n.subgraph)return;const s=n;s.state&&(s.state.integrated=t.integrated,t.props&&(s.state.props=t.props),t.variableName&&(s.state.variableName=t.variableName)),Object.entries(t.inputs).forEach(([a,o])=>{a!=="_code"&&s.inputs[a]&&(s.inputs[a].hidden=o.hidden,o.optional&&(s.inputs[a].state.optional=o.optional))}),Object.entries(t.outputs).forEach(([a,o])=>{a!=="_code"&&s.outputs[a]&&(s.outputs[a].hidden=o.hidden,o.optional&&(s.outputs[a].state.optional=o.optional))})},gs=(e,t)=>{if(!e)return;const n=e.findNodeById(t.id);if(!n||n.subgraph)return;const s=n;s.state&&(t.integrated=s.state.integrated,s.state.props&&(t.props=s.state.props),s.state.variableName&&(t.variableName=s.state.variableName)),Object.entries(t.inputs).forEach(([a,o])=>{if(a!=="_code"&&s.inputs[a]){const i=s.inputs[a];o.hidden=i.hidden,i.state?.optional&&(o.optional=i.state.optional),i.component?.__name&&(o.component=i.component.__name)}}),Object.entries(t.outputs).forEach(([a,o])=>{a!=="_code"&&s.outputs[a]&&(o.hidden=s.outputs[a].hidden)})},ks=(e,t)=>{switch(e){case"CheckBoxInterface":return new ws(t.id,t.value);case"IntegerInterface":return new tn(t.id,t.value,t.min,t.max);case"NumberInterface":return new Ns(t.id,t.value,t.min,t.max);case"SelectInterface":return new Cs(t.id,t.value,t.items);default:return new sn(t.id,t.value)}},zo=["title"],ft=r.defineComponent({__name:"CodeNodeInterface",props:{intf:{}},setup(e){return(t,n)=>(r.openBlock(),r.createElementBlock("div",{title:e.intf.value},r.toDisplayString(e.intf.name),9,zo))}});class Q extends q.NodeInterface{isCodeNode=!0;code;state;type=null;constructor(t,n){super(t,n),this.setComponent(r.markRaw(ft)),this.state=r.reactive({optional:!1})}get optional(){return this.state.optional}get shortId(){return this.id.slice(0,6)}getValue=()=>`${this.value??"None"}`;setOptional(t){return this.state.optional=t,this.setHidden(t),this}}class Ae extends Q{constructor(t="",n){super(t,n),this.setComponent(r.markRaw(ft)),this.use(S.displayInSidebar,!0)}get value(){return super.value}set value(t){super.value=t,this.name!=="_code"&&this.setHidden(!1)}}const qt=new G.NodeInterfaceType("boolean"),bs=new G.NodeInterfaceType("dict"),Jt=new G.NodeInterfaceType("list"),se=new G.NodeInterfaceType("node"),Xt=new G.NodeInterfaceType("number"),Kt=new G.NodeInterfaceType("string"),Qt=new G.NodeInterfaceType("tuple"),Zo=e=>{new G.BaklavaInterfaceTypes(e.editor,{viewPlugin:e}).addTypes(qt,bs,Jt,se,Xt,Kt,Qt)};class ws extends Ae{constructor(t,n){super(t,n),this.setComponent(r.markRaw(S.CheckboxInterfaceComponent)),this.use(G.setType,qt)}getValue=()=>this.value?"True":"False"}class vs extends Q{isCodeNodeOutput=!0;suffix="";constructor(t="",n=""){super(t,""),this.suffix=n,this.setComponent(r.markRaw(ft))}get codeValue(){return this.node?.outputs._code.value??""}get node(){const{graph:t}=S.useGraph();return t.value.findNodeById(this.nodeId)}}class en extends Ae{min;max;constructor(t,n,s,a){super(t,n),this.min=s,this.max=a,this.use(G.setType,Xt)}validate(t){return(this.min===void 0||t>=this.min)&&(this.max===void 0||t<=this.max)}}class tn extends en{component=r.markRaw(S.IntegerInterfaceComponent);validate(t){return Number.isInteger(t)&&super.validate(t)}}class qo extends Ae{constructor(t="",n=""){super(t,n),this.setComponent(r.markRaw(S.TextInputInterfaceComponent)),this.use(G.setType,Jt)}getValue=()=>`[${this.value}]`}class Ns extends en{component=r.markRaw(S.NumberInterfaceComponent)}class nn extends Ae{constructor(t,n){super(t,n),this.use(G.setType,Kt)}getValue=()=>`"${this.value}"`}class Cs extends nn{component=r.markRaw(S.SelectInterfaceComponent);items;constructor(t,n,s){super(t,n),this.items=s}}class Jo extends en{component=r.markRaw(S.SliderInterfaceComponent);min;max;constructor(t,n,s,a){super(t,n,s,a),this.min=s,this.max=a}getValue=()=>`${Math.round(this.value*1e3)/1e3}`}class sn extends nn{component=r.markRaw(jt)}class Xo extends nn{component=r.markRaw(S.TextareaInputInterfaceComponent)}class Ko extends Ae{constructor(t="",n=""){super(t,n),this.setComponent(r.markRaw(S.TextInputInterfaceComponent)),this.use(G.setType,Qt)}getValue=()=>`(${this.value})`}function Qo(e){return class extends ht{type=e.type;inputs={};outputs={};constructor(){super(),this._title=e.title??e.type,this.executeFactory("input",e.inputs),this.executeFactory("output",e.outputs),e.calculate&&(this.calculate=(t,n)=>e.calculate.call(this,t,n)),e.onCreate?.call(this),this.name=e.name??e.type,this.updateModules(e.modules),e.codeTemplate&&(this.codeTemplate=e.codeTemplate),e.variableName!=null&&(this._variableName=e.variableName),this.addInput("_code",new Q("_code",[]).use(G.setType,se).use(he.allowMultipleConnections).setHidden(!0)),this.addOutput("_code",new Q("_code",[]).use(G.setType,se).use(he.allowMultipleConnections).setHidden(!0))}afterGraphLoaded(){e.afterGraphLoaded?.call(this)}afterLoaded(){e.afterLoaded?.call(this)}onPlaced(){e.onPlaced?.call(this)}onConnected(){e.onConnected?.call(this)}onDestroy(){e.onDestroy?.call(this)}onGraphUpdate(){e.onGraphUpdate?.call(this)}onUnconnected(){e.onUnconnected?.call(this)}update(){e.update?.call(this)}}}class Ms extends ht{}function ei(e){return class extends Ms{type=e.type;inputs={};outputs={};preventUpdate=!1;staticInputKeys=Object.keys(e.inputs??{});staticOutputKeys=Object.keys(e.outputs??{});constructor(){super(),this._title=e.title??e.type,this.executeFactory("input",e.inputs),this.executeFactory("output",e.outputs),e.calculate&&(this.calculate=(t,n)=>e.calculate?.call(this,t,n)),e.onCreate?.call(this),this.name=e.name??e.type,this.updateModules(e.modules),e.codeTemplate&&(this.codeTemplate=e.codeTemplate),e.variableName&&(this._variableName=e.variableName),this.addInput("_code",new Q("_code",[]).use(G.setType,se).use(he.allowMultipleConnections).setHidden(!0)),this.addOutput("_code",new Q("_code",[]).use(G.setType,se).use(he.allowMultipleConnections).setHidden(!0)),this.staticInputKeys.push("_code"),this.staticOutputKeys.push("_code")}afterGraphLoaded(){e.afterGraphLoaded?.call(this)}afterLoaded(){e.afterLoaded?.call(this)}onPlaced(){this.events.update.subscribe(this,t=>{t&&(t.type==="input"&&this.staticInputKeys.includes(t.name)||t.type==="output"&&this.staticOutputKeys.includes(t.name))&&this.onUpdate()}),this.onUpdate(),e.onPlaced?.call(this)}onConnected(){e.onConnected?.call(this)}onDestroy(){e.onDestroy?.call(this)}onGraphUpdate(){e.onGraphUpdate?.call(this)}onUnconnected(){e.onUnconnected?.call(this)}update(){e.update?.call(this)}load(t){this.preventUpdate=!0,this.hooks.beforeLoad.execute(t),this.id=t.id,this.title=t.title;for(const n of this.staticInputKeys)this.inputs[n].load(t.inputs[n]),this.inputs[n].nodeId=this.id,n!=="_code"&&(this.inputs[n].hidden=t.inputs[n].hidden);for(const n of this.staticOutputKeys)this.outputs[n].load(t.outputs[n]),this.outputs[n].nodeId=this.id,n!=="_code"&&(this.outputs[n].hidden=t.outputs[n].hidden);this.preventUpdate=!1,this.onUpdate(),this.preventUpdate=!0;for(const n of Object.keys(t.inputs))if(!(this.staticInputKeys.includes(n)||!t.inputs[n])){if(!this.inputs[n]){const s=t.inputs[n],a=s.value;let o;s.component?o=ks(s.component,{...s,id:n}):typeof a=="number"?o=new tn(n,a):o=new sn(n,JSON.stringify(a)),o.use(S.displayInSidebar,!0),o.setOptional(s.optional??!1),o.setHidden(s.hidden??!1),this.addInput(n,o)}this.inputs[n]&&(this.inputs[n].load(t.inputs[n]),this.inputs[n].nodeId=this.id)}for(const n of Object.keys(t.outputs))if(!(this.staticOutputKeys.includes(n)||!t.outputs[n])){if(!this.outputs[n]){const s=new vs(n);this.addOutput(n,s)}this.outputs[n]&&(this.outputs[n].load(t.outputs[n]),this.outputs[n].nodeId=this.id)}Zt(this.graph,t),this.preventUpdate=!1,this.events.loaded.emit(this)}onUpdate(){if(!e.onUpdate||this.preventUpdate)return;this.graph&&this.graph.activeTransactions++;const t=this.getStaticValues(this.staticInputKeys,this.inputs),n=this.getStaticValues(this.staticOutputKeys,this.outputs),s=e.onUpdate.call(this,t,n);this.updateInterfaces("input",s.inputs??{},s.forceUpdateInputs??[]),this.updateInterfaces("output",s.outputs??{},s.forceUpdateOutputs??[]),this.graph&&this.graph.activeTransactions--}getStaticValues(t,n){const s={};for(const a of t)s[a]=n[a].value;return s}updateInputInterfaces(t={},n=[]){this.updateInterfaces("input",t,n)}updateInterfaces(t,n={},s=[]){const a=t==="input"?this.staticInputKeys:this.staticOutputKeys,o=t==="input"?this.inputs:this.outputs;for(const i of Object.keys(o))a.includes(i)||n[i]&&!s.includes(i)||(t==="input"?this.removeInput(i):this.removeOutput(i));for(const i of Object.keys(n)){if(o[i])continue;const l=n[i]();t==="input"?this.addInput(i,l):this.addOutput(i,l)}}updateProps(t){this.state.props=t,this.onUpdate()}}}Le.escape=e=>e;class pt{_id;_state;viewModel;constructor(){this._id=xe.v4(),this._state=r.reactive({lockCode:!1,modules:{},script:"",template:""})}get engine(){return this.viewModel?.engine}get graph(){return this.viewModel?.editor.graph}get id(){return this._id}get lockCode(){return this.state.lockCode}set lockCode(t){this.state.lockCode=t,this.engine?.runOnce(null)}get modules(){const t=[];return this.graph?.codeNodes.filter(n=>n.state.modules?.length>0).forEach(n=>t.push(...n.state.modules)),t?(t.sort(),Array.from(new Set(t.map(n=>this.state.modules[n])))):[]}get script(){return this.state.script}set script(t){this.state.script=t,this.engine?.runOnce(null)}get shortId(){return this.id.slice(0,6)}get state(){return this._state}clear(){this.state.script=""}async loadTemplate(t){t.then(n=>{this._state.template=n.default??""})}registerViewModel(t){this.viewModel=t}renderCode(t){this.state.script=Le.render(this.state.template||"",t??{})}}class ti extends pt{constructor(){super(),this.loadTemplate(Promise.resolve().then(()=>pu))}}class ni extends pt{constructor(){super(),this.loadTemplate(Promise.resolve().then(()=>mu))}}const si=e=>{e.allowMultipleConnections=!0};class Ss extends he.BaseEngine{order=new Map;constructor(t){super(t)}start(){super.start(),this.recalculateOrder=!0,this.calculateWithoutData()}async runGraph(t,n,s){this.order.has(t.id)||this.order.set(t.id,he.sortTopologically(t));const{calculationOrder:a,connectionsFromNode:o}=this.order.get(t.id),i=new Map;for(const l of a){const d={};Object.entries(l.inputs).forEach(([h,b])=>{d[h]=this.getInterfaceValue(n,b.id)}),l.isCodeNode&&(l.updateCodeTemplate(),l.updateOutputNames()),this.events.beforeNodeCalculation.emit({inputValues:d,node:l});let c;if(l.calculate){if(c=await l.calculate(d,{globalValues:s,engine:this}),o.has(l))for(const[h,b]of Object.entries(c))this.hooks.transferData.execute(c[h],b),o.get(l).forEach(m=>n.set(m.to.id,b))}else{c={};for(const[h,b]of Object.entries(l.outputs))c[h]=this.getInterfaceValue(n,b.id)}this.events.afterNodeCalculation.emit({outputValues:c,node:l}),i.set(l.id,new Map(Object.entries(c))),o.has(l)&&o.get(l).forEach(h=>{const b=Object.entries(l.outputs).find(([,D])=>D.id===h.from.id)?.[0];if(!b)throw new Error(`Could not find key for interface ${h.from.id}
|
|
2
|
+
This is likely an internal issue. Please report it on GitHub.`);const m=this.hooks.transferData.execute(c[b],h);b!=="_code"&&(h.to.allowMultipleConnections?n.has(h.to.id)?n.get(h.to.id).push(m):n.set(h.to.id,[m]):n.set(h.to.id,m))})}return i}async execute(t){this.recalculateOrder&&(this.order.clear(),this.recalculateOrder=!1);const n=this.getInputValues(this.editor.graph);return await this.runGraph(this.editor.graph,n,t)}getInputValues(t){const n=new Map;for(const s of t.nodes)Object.values(s.inputs).forEach(a=>{a.connectionCount===0&&n.set(a.id,a.getValue?a.getValue():a.value)}),s.calculate||Object.values(s.outputs).forEach(a=>{n.set(a.id,a.getValue?a.getValue():a.value)});return n}onChange(t){this.recalculateOrder=t||this.recalculateOrder,this.calculateWithoutData()}getInterfaceValue(t,n){if(!t.has(n))throw new Error(`Could not find value for interface ${n}
|
|
3
|
+
This is likely an internal issue. Please report it on GitHub.`);return t.get(n)}}var Os;function _(){return Os.apply(null,arguments)}function ai(e){Os=e}function ie(e){return e instanceof Array||Object.prototype.toString.call(e)==="[object Array]"}function Ye(e){return e!=null&&Object.prototype.toString.call(e)==="[object Object]"}function P(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function an(e){if(Object.getOwnPropertyNames)return Object.getOwnPropertyNames(e).length===0;var t;for(t in e)if(P(e,t))return!1;return!0}function ee(e){return e===void 0}function ge(e){return typeof e=="number"||Object.prototype.toString.call(e)==="[object Number]"}function Je(e){return e instanceof Date||Object.prototype.toString.call(e)==="[object Date]"}function Es(e,t){var n=[],s,a=e.length;for(s=0;s<a;++s)n.push(t(e[s],s));return n}function Te(e,t){for(var n in t)P(t,n)&&(e[n]=t[n]);return P(t,"toString")&&(e.toString=t.toString),P(t,"valueOf")&&(e.valueOf=t.valueOf),e}function fe(e,t,n,s){return ta(e,t,n,s,!0).utc()}function ri(){return{empty:!1,unusedTokens:[],unusedInput:[],overflow:-2,charsLeftOver:0,nullInput:!1,invalidEra:null,invalidMonth:null,invalidFormat:!1,userInvalidated:!1,iso:!1,parsedDateParts:[],era:null,meridiem:null,rfc2822:!1,weekdayMismatch:!1}}function T(e){return e._pf==null&&(e._pf=ri()),e._pf}var rn;Array.prototype.some?rn=Array.prototype.some:rn=function(e){var t=Object(this),n=t.length>>>0,s;for(s=0;s<n;s++)if(s in t&&e.call(this,t[s],s,t))return!0;return!1};function on(e){var t=null,n=!1,s=e._d&&!isNaN(e._d.getTime());if(s&&(t=T(e),n=rn.call(t.parsedDateParts,function(a){return a!=null}),s=t.overflow<0&&!t.empty&&!t.invalidEra&&!t.invalidMonth&&!t.invalidWeekday&&!t.weekdayMismatch&&!t.nullInput&&!t.invalidFormat&&!t.userInvalidated&&(!t.meridiem||t.meridiem&&n),e._strict&&(s=s&&t.charsLeftOver===0&&t.unusedTokens.length===0&&t.bigHour===void 0)),Object.isFrozen==null||!Object.isFrozen(e))e._isValid=s;else return s;return e._isValid}function mt(e){var t=fe(NaN);return e!=null?Te(T(t),e):T(t).userInvalidated=!0,t}var Ts=_.momentProperties=[],ln=!1;function dn(e,t){var n,s,a,o=Ts.length;if(ee(t._isAMomentObject)||(e._isAMomentObject=t._isAMomentObject),ee(t._i)||(e._i=t._i),ee(t._f)||(e._f=t._f),ee(t._l)||(e._l=t._l),ee(t._strict)||(e._strict=t._strict),ee(t._tzm)||(e._tzm=t._tzm),ee(t._isUTC)||(e._isUTC=t._isUTC),ee(t._offset)||(e._offset=t._offset),ee(t._pf)||(e._pf=T(t)),ee(t._locale)||(e._locale=t._locale),o>0)for(n=0;n<o;n++)s=Ts[n],a=t[s],ee(a)||(e[s]=a);return e}function Xe(e){dn(this,e),this._d=new Date(e._d!=null?e._d.getTime():NaN),this.isValid()||(this._d=new Date(NaN)),ln===!1&&(ln=!0,_.updateOffset(this),ln=!1)}function le(e){return e instanceof Xe||e!=null&&e._isAMomentObject!=null}function Is(e){_.suppressDeprecationWarnings===!1&&typeof console<"u"&&console.warn&&console.warn("Deprecation warning: "+e)}function ae(e,t){var n=!0;return Te(function(){if(_.deprecationHandler!=null&&_.deprecationHandler(null,e),n){var s=[],a,o,i,l=arguments.length;for(o=0;o<l;o++){if(a="",typeof arguments[o]=="object"){a+=`
|
|
4
|
+
[`+o+"] ";for(i in arguments[0])P(arguments[0],i)&&(a+=i+": "+arguments[0][i]+", ");a=a.slice(0,-2)}else a=arguments[o];s.push(a)}Is(e+`
|
|
5
5
|
Arguments: `+Array.prototype.slice.call(s).join("")+`
|
|
6
|
-
`+new Error().stack),n=!1}return t.apply(this,arguments)},t)}var Rs={};function Ps(e,t){y.deprecationHandler!=null&&y.deprecationHandler(e,t),Rs[e]||(Ys(t),Rs[e]=!0)}y.suppressDeprecationWarnings=!1,y.deprecationHandler=null;function fe(e){return typeof Function<"u"&&e instanceof Function||Object.prototype.toString.call(e)==="[object Function]"}function ri(e){var t,n;for(n in e)P(e,n)&&(t=e[n],fe(t)?this[n]=t:this["_"+n]=t);this._config=e,this._dayOfMonthOrdinalParseLenient=new RegExp((this._dayOfMonthOrdinalParse.source||this._ordinalParse.source)+"|"+/\d{1,2}/.source)}function dn(e,t){var n=Ee({},e),s;for(s in t)P(t,s)&&(xe(e[s])&&xe(t[s])?(n[s]={},Ee(n[s],e[s]),Ee(n[s],t[s])):t[s]!=null?n[s]=t[s]:delete n[s]);for(s in e)P(e,s)&&!P(t,s)&&xe(e[s])&&(n[s]=Ee({},n[s]));return n}function cn(e){e!=null&&this.set(e)}var un;Object.keys?un=Object.keys:un=function(e){var t,n=[];for(t in e)P(e,t)&&n.push(t);return n};var oi={sameDay:"[Today at] LT",nextDay:"[Tomorrow at] LT",nextWeek:"dddd [at] LT",lastDay:"[Yesterday at] LT",lastWeek:"[Last] dddd [at] LT",sameElse:"L"};function ii(e,t,n){var s=this._calendar[e]||this._calendar.sameElse;return fe(s)?s.call(t,n):s}function pe(e,t,n){var s=""+Math.abs(e),a=t-s.length,o=e>=0;return(o?n?"+":"":"-")+Math.pow(10,Math.max(0,a)).toString().substr(1)+s}var hn=/(\[[^\[]*\])|(\\)?([Hh]mm(ss)?|Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|W[o|W]?|Qo?|N{1,5}|YYYYYY|YYYYY|YYYY|YY|y{2,4}|yo?|gg(ggg?)?|GG(GGG?)?|e|E|a|A|hh?|HH?|kk?|mm?|ss?|S{1,9}|x|X|zz?|ZZ?|.)/g,mt=/(\[[^\[]*\])|(\\)?(LTS|LT|LL?L?L?|l{1,4})/g,fn={},Ae={};function C(e,t,n,s){var a=s;typeof s=="string"&&(a=function(){return this[s]()}),e&&(Ae[e]=a),t&&(Ae[t[0]]=function(){return pe(a.apply(this,arguments),t[1],t[2])}),n&&(Ae[n]=function(){return this.localeData().ordinal(a.apply(this,arguments),e)})}function li(e){return e.match(/\[[\s\S]/)?e.replace(/^\[|\]$/g,""):e.replace(/\\/g,"")}function di(e){var t=e.match(hn),n,s;for(n=0,s=t.length;n<s;n++)Ae[t[n]]?t[n]=Ae[t[n]]:t[n]=li(t[n]);return function(a){var o="",i;for(i=0;i<s;i++)o+=fe(t[i])?t[i].call(a,e):t[i];return o}}function _t(e,t){return e.isValid()?(t=Bs(t,e.localeData()),fn[t]=fn[t]||di(t),fn[t](e)):e.localeData().invalidDate()}function Bs(e,t){var n=5;function s(a){return t.longDateFormat(a)||a}for(mt.lastIndex=0;n>=0&&mt.test(e);)e=e.replace(mt,s),mt.lastIndex=0,n-=1;return e}var ci={LTS:"h:mm:ss A",LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY h:mm A",LLLL:"dddd, MMMM D, YYYY h:mm A"};function ui(e){var t=this._longDateFormat[e],n=this._longDateFormat[e.toUpperCase()];return t||!n?t:(this._longDateFormat[e]=n.match(hn).map(function(s){return s==="MMMM"||s==="MM"||s==="DD"||s==="dddd"?s.slice(1):s}).join(""),this._longDateFormat[e])}var hi="Invalid date";function fi(){return this._invalidDate}var pi="%d",mi=/\d{1,2}/;function _i(e){return this._ordinal.replace("%d",e)}var yi={future:"in %s",past:"%s ago",s:"a few seconds",ss:"%d seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",w:"a week",ww:"%d weeks",M:"a month",MM:"%d months",y:"a year",yy:"%d years"};function gi(e,t,n,s){var a=this._relativeTime[n];return fe(a)?a(e,t,n,s):a.replace(/%d/i,e)}function ki(e,t){var n=this._relativeTime[e>0?"future":"past"];return fe(n)?n(t):n.replace(/%s/i,t)}var Vs={D:"date",dates:"date",date:"date",d:"day",days:"day",day:"day",e:"weekday",weekdays:"weekday",weekday:"weekday",E:"isoWeekday",isoweekdays:"isoWeekday",isoweekday:"isoWeekday",DDD:"dayOfYear",dayofyears:"dayOfYear",dayofyear:"dayOfYear",h:"hour",hours:"hour",hour:"hour",ms:"millisecond",milliseconds:"millisecond",millisecond:"millisecond",m:"minute",minutes:"minute",minute:"minute",M:"month",months:"month",month:"month",Q:"quarter",quarters:"quarter",quarter:"quarter",s:"second",seconds:"second",second:"second",gg:"weekYear",weekyears:"weekYear",weekyear:"weekYear",GG:"isoWeekYear",isoweekyears:"isoWeekYear",isoweekyear:"isoWeekYear",w:"week",weeks:"week",week:"week",W:"isoWeek",isoweeks:"isoWeek",isoweek:"isoWeek",y:"year",years:"year",year:"year"};function ae(e){return typeof e=="string"?Vs[e]||Vs[e.toLowerCase()]:void 0}function pn(e){var t={},n,s;for(s in e)P(e,s)&&(n=ae(s),n&&(t[n]=e[s]));return t}var wi={date:9,day:11,weekday:11,isoWeekday:11,dayOfYear:4,hour:13,millisecond:16,minute:14,month:8,quarter:7,second:15,weekYear:1,isoWeekYear:1,week:5,isoWeek:5,year:1};function bi(e){var t=[],n;for(n in e)P(e,n)&&t.push({unit:n,priority:wi[n]});return t.sort(function(s,a){return s.priority-a.priority}),t}var Ls=/\d/,ee=/\d\d/,As=/\d{3}/,mn=/\d{4}/,yt=/[+-]?\d{6}/,W=/\d\d?/,Us=/\d\d\d\d?/,Ws=/\d\d\d\d\d\d?/,gt=/\d{1,3}/,_n=/\d{1,4}/,kt=/[+-]?\d{1,6}/,Ue=/\d+/,wt=/[+-]?\d+/,vi=/Z|[+-]\d\d:?\d\d/gi,bt=/Z|[+-]\d\d(?::?\d\d)?/gi,Ni=/[+-]?\d+(\.\d{1,3})?/,Xe=/[0-9]{0,256}['a-z\u00A0-\u05FF\u0700-\uD7FF\uF900-\uFDCF\uFDF0-\uFF07\uFF10-\uFFEF]{1,256}|[\u0600-\u06FF\/]{1,256}(\s*?[\u0600-\u06FF]{1,256}){1,2}/i,We=/^[1-9]\d?/,yn=/^([1-9]\d|\d)/,vt;vt={};function g(e,t,n){vt[e]=fe(t)?t:function(s,a){return s&&n?n:t}}function Ci(e,t){return P(vt,e)?vt[e](t._strict,t._locale):new RegExp(Mi(e))}function Mi(e){return ge(e.replace("\\","").replace(/\\(\[)|\\(\])|\[([^\]\[]*)\]|\\(.)/g,function(t,n,s,a,o){return n||s||a||o}))}function ge(e){return e.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&")}function re(e){return e<0?Math.ceil(e)||0:Math.floor(e)}function x(e){var t=+e,n=0;return t!==0&&isFinite(t)&&(n=re(t)),n}var gn={};function A(e,t){var n,s=t,a;for(typeof e=="string"&&(e=[e]),ye(t)&&(s=function(o,i){i[t]=x(o)}),a=e.length,n=0;n<a;n++)gn[e[n]]=s}function Ke(e,t){A(e,function(n,s,a,o){a._w=a._w||{},t(n,a._w,a,o)})}function Si(e,t,n){t!=null&&P(gn,e)&&gn[e](t,n._a,n,e)}function Nt(e){return e%4===0&&e%100!==0||e%400===0}var X=0,ke=1,me=2,q=3,le=4,we=5,Ye=6,Oi=7,Ei=8;C("Y",0,0,function(){var e=this.year();return e<=9999?pe(e,4):"+"+e}),C(0,["YY",2],0,function(){return this.year()%100}),C(0,["YYYY",4],0,"year"),C(0,["YYYYY",5],0,"year"),C(0,["YYYYYY",6,!0],0,"year"),g("Y",wt),g("YY",W,ee),g("YYYY",_n,mn),g("YYYYY",kt,yt),g("YYYYYY",kt,yt),A(["YYYYY","YYYYYY"],X),A("YYYY",function(e,t){t[X]=e.length===2?y.parseTwoDigitYear(e):x(e)}),A("YY",function(e,t){t[X]=y.parseTwoDigitYear(e)}),A("Y",function(e,t){t[X]=parseInt(e,10)});function Qe(e){return Nt(e)?366:365}y.parseTwoDigitYear=function(e){return x(e)+(x(e)>68?1900:2e3)};var $s=$e("FullYear",!0);function Ti(){return Nt(this.year())}function $e(e,t){return function(n){return n!=null?(Hs(this,e,n),y.updateOffset(this,t),this):et(this,e)}}function et(e,t){if(!e.isValid())return NaN;var n=e._d,s=e._isUTC;switch(t){case"Milliseconds":return s?n.getUTCMilliseconds():n.getMilliseconds();case"Seconds":return s?n.getUTCSeconds():n.getSeconds();case"Minutes":return s?n.getUTCMinutes():n.getMinutes();case"Hours":return s?n.getUTCHours():n.getHours();case"Date":return s?n.getUTCDate():n.getDate();case"Day":return s?n.getUTCDay():n.getDay();case"Month":return s?n.getUTCMonth():n.getMonth();case"FullYear":return s?n.getUTCFullYear():n.getFullYear();default:return NaN}}function Hs(e,t,n){var s,a,o,i,l;if(!(!e.isValid()||isNaN(n))){switch(s=e._d,a=e._isUTC,t){case"Milliseconds":return void(a?s.setUTCMilliseconds(n):s.setMilliseconds(n));case"Seconds":return void(a?s.setUTCSeconds(n):s.setSeconds(n));case"Minutes":return void(a?s.setUTCMinutes(n):s.setMinutes(n));case"Hours":return void(a?s.setUTCHours(n):s.setHours(n));case"Date":return void(a?s.setUTCDate(n):s.setDate(n));case"FullYear":break;default:return}o=n,i=e.month(),l=e.date(),l=l===29&&i===1&&!Nt(o)?28:l,a?s.setUTCFullYear(o,i,l):s.setFullYear(o,i,l)}}function Ii(e){return e=ae(e),fe(this[e])?this[e]():this}function Di(e,t){if(typeof e=="object"){e=pn(e);var n=bi(e),s,a=n.length;for(s=0;s<a;s++)this[n[s].unit](e[n[s].unit])}else if(e=ae(e),fe(this[e]))return this[e](t);return this}function xi(e,t){return(e%t+t)%t}var z;Array.prototype.indexOf?z=Array.prototype.indexOf:z=function(e){var t;for(t=0;t<this.length;++t)if(this[t]===e)return t;return-1};function kn(e,t){if(isNaN(e)||isNaN(t))return NaN;var n=xi(t,12);return e+=(t-n)/12,n===1?Nt(e)?29:28:31-n%7%2}C("M",["MM",2],"Mo",function(){return this.month()+1}),C("MMM",0,0,function(e){return this.localeData().monthsShort(this,e)}),C("MMMM",0,0,function(e){return this.localeData().months(this,e)}),g("M",W,We),g("MM",W,ee),g("MMM",function(e,t){return t.monthsShortRegex(e)}),g("MMMM",function(e,t){return t.monthsRegex(e)}),A(["M","MM"],function(e,t){t[ke]=x(e)-1}),A(["MMM","MMMM"],function(e,t,n,s){var a=n._locale.monthsParse(e,s,n._strict);a!=null?t[ke]=a:T(n).invalidMonth=e});var Yi="January_February_March_April_May_June_July_August_September_October_November_December".split("_"),Fs="Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec".split("_"),Gs=/D[oD]?(\[[^\[\]]*\]|\s)+MMMM?/,Ri=Xe,Pi=Xe;function Bi(e,t){return e?oe(this._months)?this._months[e.month()]:this._months[(this._months.isFormat||Gs).test(t)?"format":"standalone"][e.month()]:oe(this._months)?this._months:this._months.standalone}function Vi(e,t){return e?oe(this._monthsShort)?this._monthsShort[e.month()]:this._monthsShort[Gs.test(t)?"format":"standalone"][e.month()]:oe(this._monthsShort)?this._monthsShort:this._monthsShort.standalone}function Li(e,t,n){var s,a,o,i=e.toLocaleLowerCase();if(!this._monthsParse)for(this._monthsParse=[],this._longMonthsParse=[],this._shortMonthsParse=[],s=0;s<12;++s)o=he([2e3,s]),this._shortMonthsParse[s]=this.monthsShort(o,"").toLocaleLowerCase(),this._longMonthsParse[s]=this.months(o,"").toLocaleLowerCase();return n?t==="MMM"?(a=z.call(this._shortMonthsParse,i),a!==-1?a:null):(a=z.call(this._longMonthsParse,i),a!==-1?a:null):t==="MMM"?(a=z.call(this._shortMonthsParse,i),a!==-1?a:(a=z.call(this._longMonthsParse,i),a!==-1?a:null)):(a=z.call(this._longMonthsParse,i),a!==-1?a:(a=z.call(this._shortMonthsParse,i),a!==-1?a:null))}function Ai(e,t,n){var s,a,o;if(this._monthsParseExact)return Li.call(this,e,t,n);for(this._monthsParse||(this._monthsParse=[],this._longMonthsParse=[],this._shortMonthsParse=[]),s=0;s<12;s++){if(a=he([2e3,s]),n&&!this._longMonthsParse[s]&&(this._longMonthsParse[s]=new RegExp("^"+this.months(a,"").replace(".","")+"$","i"),this._shortMonthsParse[s]=new RegExp("^"+this.monthsShort(a,"").replace(".","")+"$","i")),!n&&!this._monthsParse[s]&&(o="^"+this.months(a,"")+"|^"+this.monthsShort(a,""),this._monthsParse[s]=new RegExp(o.replace(".",""),"i")),n&&t==="MMMM"&&this._longMonthsParse[s].test(e))return s;if(n&&t==="MMM"&&this._shortMonthsParse[s].test(e))return s;if(!n&&this._monthsParse[s].test(e))return s}}function js(e,t){if(!e.isValid())return e;if(typeof t=="string"){if(/^\d+$/.test(t))t=x(t);else if(t=e.localeData().monthsParse(t),!ye(t))return e}var n=t,s=e.date();return s=s<29?s:Math.min(s,kn(e.year(),n)),e._isUTC?e._d.setUTCMonth(n,s):e._d.setMonth(n,s),e}function zs(e){return e!=null?(js(this,e),y.updateOffset(this,!0),this):et(this,"Month")}function Ui(){return kn(this.year(),this.month())}function Wi(e){return this._monthsParseExact?(P(this,"_monthsRegex")||Zs.call(this),e?this._monthsShortStrictRegex:this._monthsShortRegex):(P(this,"_monthsShortRegex")||(this._monthsShortRegex=Ri),this._monthsShortStrictRegex&&e?this._monthsShortStrictRegex:this._monthsShortRegex)}function $i(e){return this._monthsParseExact?(P(this,"_monthsRegex")||Zs.call(this),e?this._monthsStrictRegex:this._monthsRegex):(P(this,"_monthsRegex")||(this._monthsRegex=Pi),this._monthsStrictRegex&&e?this._monthsStrictRegex:this._monthsRegex)}function Zs(){function e(d,c){return c.length-d.length}var t=[],n=[],s=[],a,o,i,l;for(a=0;a<12;a++)o=he([2e3,a]),i=ge(this.monthsShort(o,"")),l=ge(this.months(o,"")),t.push(i),n.push(l),s.push(l),s.push(i);t.sort(e),n.sort(e),s.sort(e),this._monthsRegex=new RegExp("^("+s.join("|")+")","i"),this._monthsShortRegex=this._monthsRegex,this._monthsStrictRegex=new RegExp("^("+n.join("|")+")","i"),this._monthsShortStrictRegex=new RegExp("^("+t.join("|")+")","i")}function Hi(e,t,n,s,a,o,i){var l;return e<100&&e>=0?(l=new Date(e+400,t,n,s,a,o,i),isFinite(l.getFullYear())&&l.setFullYear(e)):l=new Date(e,t,n,s,a,o,i),l}function tt(e){var t,n;return e<100&&e>=0?(n=Array.prototype.slice.call(arguments),n[0]=e+400,t=new Date(Date.UTC.apply(null,n)),isFinite(t.getUTCFullYear())&&t.setUTCFullYear(e)):t=new Date(Date.UTC.apply(null,arguments)),t}function Ct(e,t,n){var s=7+t-n,a=(7+tt(e,0,s).getUTCDay()-t)%7;return-a+s-1}function qs(e,t,n,s,a){var o=(7+n-s)%7,i=Ct(e,s,a),l=1+7*(t-1)+o+i,d,c;return l<=0?(d=e-1,c=Qe(d)+l):l>Qe(e)?(d=e+1,c=l-Qe(e)):(d=e,c=l),{year:d,dayOfYear:c}}function nt(e,t,n){var s=Ct(e.year(),t,n),a=Math.floor((e.dayOfYear()-s-1)/7)+1,o,i;return a<1?(i=e.year()-1,o=a+be(i,t,n)):a>be(e.year(),t,n)?(o=a-be(e.year(),t,n),i=e.year()+1):(i=e.year(),o=a),{week:o,year:i}}function be(e,t,n){var s=Ct(e,t,n),a=Ct(e+1,t,n);return(Qe(e)-s+a)/7}C("w",["ww",2],"wo","week"),C("W",["WW",2],"Wo","isoWeek"),g("w",W,We),g("ww",W,ee),g("W",W,We),g("WW",W,ee),Ke(["w","ww","W","WW"],function(e,t,n,s){t[s.substr(0,1)]=x(e)});function Fi(e){return nt(e,this._week.dow,this._week.doy).week}var Gi={dow:0,doy:6};function ji(){return this._week.dow}function zi(){return this._week.doy}function Zi(e){var t=this.localeData().week(this);return e==null?t:this.add((e-t)*7,"d")}function qi(e){var t=nt(this,1,4).week;return e==null?t:this.add((e-t)*7,"d")}C("d",0,"do","day"),C("dd",0,0,function(e){return this.localeData().weekdaysMin(this,e)}),C("ddd",0,0,function(e){return this.localeData().weekdaysShort(this,e)}),C("dddd",0,0,function(e){return this.localeData().weekdays(this,e)}),C("e",0,0,"weekday"),C("E",0,0,"isoWeekday"),g("d",W),g("e",W),g("E",W),g("dd",function(e,t){return t.weekdaysMinRegex(e)}),g("ddd",function(e,t){return t.weekdaysShortRegex(e)}),g("dddd",function(e,t){return t.weekdaysRegex(e)}),Ke(["dd","ddd","dddd"],function(e,t,n,s){var a=n._locale.weekdaysParse(e,s,n._strict);a!=null?t.d=a:T(n).invalidWeekday=e}),Ke(["d","e","E"],function(e,t,n,s){t[s]=x(e)});function Ji(e,t){return typeof e!="string"?e:isNaN(e)?(e=t.weekdaysParse(e),typeof e=="number"?e:null):parseInt(e,10)}function Xi(e,t){return typeof e=="string"?t.weekdaysParse(e)%7||7:isNaN(e)?null:e}function wn(e,t){return e.slice(t,7).concat(e.slice(0,t))}var Ki="Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),Js="Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_"),Qi="Su_Mo_Tu_We_Th_Fr_Sa".split("_"),el=Xe,tl=Xe,nl=Xe;function sl(e,t){var n=oe(this._weekdays)?this._weekdays:this._weekdays[e&&e!==!0&&this._weekdays.isFormat.test(t)?"format":"standalone"];return e===!0?wn(n,this._week.dow):e?n[e.day()]:n}function al(e){return e===!0?wn(this._weekdaysShort,this._week.dow):e?this._weekdaysShort[e.day()]:this._weekdaysShort}function rl(e){return e===!0?wn(this._weekdaysMin,this._week.dow):e?this._weekdaysMin[e.day()]:this._weekdaysMin}function ol(e,t,n){var s,a,o,i=e.toLocaleLowerCase();if(!this._weekdaysParse)for(this._weekdaysParse=[],this._shortWeekdaysParse=[],this._minWeekdaysParse=[],s=0;s<7;++s)o=he([2e3,1]).day(s),this._minWeekdaysParse[s]=this.weekdaysMin(o,"").toLocaleLowerCase(),this._shortWeekdaysParse[s]=this.weekdaysShort(o,"").toLocaleLowerCase(),this._weekdaysParse[s]=this.weekdays(o,"").toLocaleLowerCase();return n?t==="dddd"?(a=z.call(this._weekdaysParse,i),a!==-1?a:null):t==="ddd"?(a=z.call(this._shortWeekdaysParse,i),a!==-1?a:null):(a=z.call(this._minWeekdaysParse,i),a!==-1?a:null):t==="dddd"?(a=z.call(this._weekdaysParse,i),a!==-1||(a=z.call(this._shortWeekdaysParse,i),a!==-1)?a:(a=z.call(this._minWeekdaysParse,i),a!==-1?a:null)):t==="ddd"?(a=z.call(this._shortWeekdaysParse,i),a!==-1||(a=z.call(this._weekdaysParse,i),a!==-1)?a:(a=z.call(this._minWeekdaysParse,i),a!==-1?a:null)):(a=z.call(this._minWeekdaysParse,i),a!==-1||(a=z.call(this._weekdaysParse,i),a!==-1)?a:(a=z.call(this._shortWeekdaysParse,i),a!==-1?a:null))}function il(e,t,n){var s,a,o;if(this._weekdaysParseExact)return ol.call(this,e,t,n);for(this._weekdaysParse||(this._weekdaysParse=[],this._minWeekdaysParse=[],this._shortWeekdaysParse=[],this._fullWeekdaysParse=[]),s=0;s<7;s++){if(a=he([2e3,1]).day(s),n&&!this._fullWeekdaysParse[s]&&(this._fullWeekdaysParse[s]=new RegExp("^"+this.weekdays(a,"").replace(".","\\.?")+"$","i"),this._shortWeekdaysParse[s]=new RegExp("^"+this.weekdaysShort(a,"").replace(".","\\.?")+"$","i"),this._minWeekdaysParse[s]=new RegExp("^"+this.weekdaysMin(a,"").replace(".","\\.?")+"$","i")),this._weekdaysParse[s]||(o="^"+this.weekdays(a,"")+"|^"+this.weekdaysShort(a,"")+"|^"+this.weekdaysMin(a,""),this._weekdaysParse[s]=new RegExp(o.replace(".",""),"i")),n&&t==="dddd"&&this._fullWeekdaysParse[s].test(e))return s;if(n&&t==="ddd"&&this._shortWeekdaysParse[s].test(e))return s;if(n&&t==="dd"&&this._minWeekdaysParse[s].test(e))return s;if(!n&&this._weekdaysParse[s].test(e))return s}}function ll(e){if(!this.isValid())return e!=null?this:NaN;var t=et(this,"Day");return e!=null?(e=Ji(e,this.localeData()),this.add(e-t,"d")):t}function dl(e){if(!this.isValid())return e!=null?this:NaN;var t=(this.day()+7-this.localeData()._week.dow)%7;return e==null?t:this.add(e-t,"d")}function cl(e){if(!this.isValid())return e!=null?this:NaN;if(e!=null){var t=Xi(e,this.localeData());return this.day(this.day()%7?t:t-7)}else return this.day()||7}function ul(e){return this._weekdaysParseExact?(P(this,"_weekdaysRegex")||bn.call(this),e?this._weekdaysStrictRegex:this._weekdaysRegex):(P(this,"_weekdaysRegex")||(this._weekdaysRegex=el),this._weekdaysStrictRegex&&e?this._weekdaysStrictRegex:this._weekdaysRegex)}function hl(e){return this._weekdaysParseExact?(P(this,"_weekdaysRegex")||bn.call(this),e?this._weekdaysShortStrictRegex:this._weekdaysShortRegex):(P(this,"_weekdaysShortRegex")||(this._weekdaysShortRegex=tl),this._weekdaysShortStrictRegex&&e?this._weekdaysShortStrictRegex:this._weekdaysShortRegex)}function fl(e){return this._weekdaysParseExact?(P(this,"_weekdaysRegex")||bn.call(this),e?this._weekdaysMinStrictRegex:this._weekdaysMinRegex):(P(this,"_weekdaysMinRegex")||(this._weekdaysMinRegex=nl),this._weekdaysMinStrictRegex&&e?this._weekdaysMinStrictRegex:this._weekdaysMinRegex)}function bn(){function e(h,w){return w.length-h.length}var t=[],n=[],s=[],a=[],o,i,l,d,c;for(o=0;o<7;o++)i=he([2e3,1]).day(o),l=ge(this.weekdaysMin(i,"")),d=ge(this.weekdaysShort(i,"")),c=ge(this.weekdays(i,"")),t.push(l),n.push(d),s.push(c),a.push(l),a.push(d),a.push(c);t.sort(e),n.sort(e),s.sort(e),a.sort(e),this._weekdaysRegex=new RegExp("^("+a.join("|")+")","i"),this._weekdaysShortRegex=this._weekdaysRegex,this._weekdaysMinRegex=this._weekdaysRegex,this._weekdaysStrictRegex=new RegExp("^("+s.join("|")+")","i"),this._weekdaysShortStrictRegex=new RegExp("^("+n.join("|")+")","i"),this._weekdaysMinStrictRegex=new RegExp("^("+t.join("|")+")","i")}function vn(){return this.hours()%12||12}function pl(){return this.hours()||24}C("H",["HH",2],0,"hour"),C("h",["hh",2],0,vn),C("k",["kk",2],0,pl),C("hmm",0,0,function(){return""+vn.apply(this)+pe(this.minutes(),2)}),C("hmmss",0,0,function(){return""+vn.apply(this)+pe(this.minutes(),2)+pe(this.seconds(),2)}),C("Hmm",0,0,function(){return""+this.hours()+pe(this.minutes(),2)}),C("Hmmss",0,0,function(){return""+this.hours()+pe(this.minutes(),2)+pe(this.seconds(),2)});function Xs(e,t){C(e,0,0,function(){return this.localeData().meridiem(this.hours(),this.minutes(),t)})}Xs("a",!0),Xs("A",!1);function Ks(e,t){return t._meridiemParse}g("a",Ks),g("A",Ks),g("H",W,yn),g("h",W,We),g("k",W,We),g("HH",W,ee),g("hh",W,ee),g("kk",W,ee),g("hmm",Us),g("hmmss",Ws),g("Hmm",Us),g("Hmmss",Ws),A(["H","HH"],q),A(["k","kk"],function(e,t,n){var s=x(e);t[q]=s===24?0:s}),A(["a","A"],function(e,t,n){n._isPm=n._locale.isPM(e),n._meridiem=e}),A(["h","hh"],function(e,t,n){t[q]=x(e),T(n).bigHour=!0}),A("hmm",function(e,t,n){var s=e.length-2;t[q]=x(e.substr(0,s)),t[le]=x(e.substr(s)),T(n).bigHour=!0}),A("hmmss",function(e,t,n){var s=e.length-4,a=e.length-2;t[q]=x(e.substr(0,s)),t[le]=x(e.substr(s,2)),t[we]=x(e.substr(a)),T(n).bigHour=!0}),A("Hmm",function(e,t,n){var s=e.length-2;t[q]=x(e.substr(0,s)),t[le]=x(e.substr(s))}),A("Hmmss",function(e,t,n){var s=e.length-4,a=e.length-2;t[q]=x(e.substr(0,s)),t[le]=x(e.substr(s,2)),t[we]=x(e.substr(a))});function ml(e){return(e+"").toLowerCase().charAt(0)==="p"}var _l=/[ap]\.?m?\.?/i,yl=$e("Hours",!0);function gl(e,t,n){return e>11?n?"pm":"PM":n?"am":"AM"}var Qs={calendar:oi,longDateFormat:ci,invalidDate:hi,ordinal:pi,dayOfMonthOrdinalParse:mi,relativeTime:yi,months:Yi,monthsShort:Fs,week:Gi,weekdays:Ki,weekdaysMin:Qi,weekdaysShort:Js,meridiemParse:_l},F={},st={},at;function kl(e,t){var n,s=Math.min(e.length,t.length);for(n=0;n<s;n+=1)if(e[n]!==t[n])return n;return s}function ea(e){return e&&e.toLowerCase().replace("_","-")}function wl(e){for(var t=0,n,s,a,o;t<e.length;){for(o=ea(e[t]).split("-"),n=o.length,s=ea(e[t+1]),s=s?s.split("-"):null;n>0;){if(a=Mt(o.slice(0,n).join("-")),a)return a;if(s&&s.length>=n&&kl(o,s)>=n-1)break;n--}t++}return at}function bl(e){return!!(e&&e.match("^[^/\\\\]*$"))}function Mt(e){var t=null,n;if(F[e]===void 0&&typeof module<"u"&&module&&module.exports&&bl(e))try{t=at._abbr,n=require,n("./locale/"+e),Te(t)}catch{F[e]=null}return F[e]}function Te(e,t){var n;return e&&(Q(t)?n=ve(e):n=Nn(e,t),n?at=n:typeof console<"u"&&console.warn&&console.warn("Locale "+e+" not found. Did you forget to load it?")),at._abbr}function Nn(e,t){if(t!==null){var n,s=Qs;if(t.abbr=e,F[e]!=null)Ps("defineLocaleOverride","use moment.updateLocale(localeName, config) to change an existing locale. moment.defineLocale(localeName, config) should only be used for creating a new locale See http://momentjs.com/guides/#/warnings/define-locale/ for more info."),s=F[e]._config;else if(t.parentLocale!=null)if(F[t.parentLocale]!=null)s=F[t.parentLocale]._config;else if(n=Mt(t.parentLocale),n!=null)s=n._config;else return st[t.parentLocale]||(st[t.parentLocale]=[]),st[t.parentLocale].push({name:e,config:t}),null;return F[e]=new cn(dn(s,t)),st[e]&&st[e].forEach(function(a){Nn(a.name,a.config)}),Te(e),F[e]}else return delete F[e],null}function vl(e,t){if(t!=null){var n,s,a=Qs;F[e]!=null&&F[e].parentLocale!=null?F[e].set(dn(F[e]._config,t)):(s=Mt(e),s!=null&&(a=s._config),t=dn(a,t),s==null&&(t.abbr=e),n=new cn(t),n.parentLocale=F[e],F[e]=n),Te(e)}else F[e]!=null&&(F[e].parentLocale!=null?(F[e]=F[e].parentLocale,e===Te()&&Te(e)):F[e]!=null&&delete F[e]);return F[e]}function ve(e){var t;if(e&&e._locale&&e._locale._abbr&&(e=e._locale._abbr),!e)return at;if(!oe(e)){if(t=Mt(e),t)return t;e=[e]}return wl(e)}function Nl(){return un(F)}function Cn(e){var t,n=e._a;return n&&T(e).overflow===-2&&(t=n[ke]<0||n[ke]>11?ke:n[me]<1||n[me]>kn(n[X],n[ke])?me:n[q]<0||n[q]>24||n[q]===24&&(n[le]!==0||n[we]!==0||n[Ye]!==0)?q:n[le]<0||n[le]>59?le:n[we]<0||n[we]>59?we:n[Ye]<0||n[Ye]>999?Ye:-1,T(e)._overflowDayOfYear&&(t<X||t>me)&&(t=me),T(e)._overflowWeeks&&t===-1&&(t=Oi),T(e)._overflowWeekday&&t===-1&&(t=Ei),T(e).overflow=t),e}var Cl=/^\s*((?:[+-]\d{6}|\d{4})-(?:\d\d-\d\d|W\d\d-\d|W\d\d|\d\d\d|\d\d))(?:(T| )(\d\d(?::\d\d(?::\d\d(?:[.,]\d+)?)?)?)([+-]\d\d(?::?\d\d)?|\s*Z)?)?$/,Ml=/^\s*((?:[+-]\d{6}|\d{4})(?:\d\d\d\d|W\d\d\d|W\d\d|\d\d\d|\d\d|))(?:(T| )(\d\d(?:\d\d(?:\d\d(?:[.,]\d+)?)?)?)([+-]\d\d(?::?\d\d)?|\s*Z)?)?$/,Sl=/Z|[+-]\d\d(?::?\d\d)?/,St=[["YYYYYY-MM-DD",/[+-]\d{6}-\d\d-\d\d/],["YYYY-MM-DD",/\d{4}-\d\d-\d\d/],["GGGG-[W]WW-E",/\d{4}-W\d\d-\d/],["GGGG-[W]WW",/\d{4}-W\d\d/,!1],["YYYY-DDD",/\d{4}-\d{3}/],["YYYY-MM",/\d{4}-\d\d/,!1],["YYYYYYMMDD",/[+-]\d{10}/],["YYYYMMDD",/\d{8}/],["GGGG[W]WWE",/\d{4}W\d{3}/],["GGGG[W]WW",/\d{4}W\d{2}/,!1],["YYYYDDD",/\d{7}/],["YYYYMM",/\d{6}/,!1],["YYYY",/\d{4}/,!1]],Mn=[["HH:mm:ss.SSSS",/\d\d:\d\d:\d\d\.\d+/],["HH:mm:ss,SSSS",/\d\d:\d\d:\d\d,\d+/],["HH:mm:ss",/\d\d:\d\d:\d\d/],["HH:mm",/\d\d:\d\d/],["HHmmss.SSSS",/\d\d\d\d\d\d\.\d+/],["HHmmss,SSSS",/\d\d\d\d\d\d,\d+/],["HHmmss",/\d\d\d\d\d\d/],["HHmm",/\d\d\d\d/],["HH",/\d\d/]],Ol=/^\/?Date\((-?\d+)/i,El=/^(?:(Mon|Tue|Wed|Thu|Fri|Sat|Sun),?\s)?(\d{1,2})\s(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s(\d{2,4})\s(\d\d):(\d\d)(?::(\d\d))?\s(?:(UT|GMT|[ECMP][SD]T)|([Zz])|([+-]\d{4}))$/,Tl={UT:0,GMT:0,EDT:-240,EST:-300,CDT:-300,CST:-360,MDT:-360,MST:-420,PDT:-420,PST:-480};function ta(e){var t,n,s=e._i,a=Cl.exec(s)||Ml.exec(s),o,i,l,d,c=St.length,h=Mn.length;if(a){for(T(e).iso=!0,t=0,n=c;t<n;t++)if(St[t][1].exec(a[1])){i=St[t][0],o=St[t][2]!==!1;break}if(i==null){e._isValid=!1;return}if(a[3]){for(t=0,n=h;t<n;t++)if(Mn[t][1].exec(a[3])){l=(a[2]||" ")+Mn[t][0];break}if(l==null){e._isValid=!1;return}}if(!o&&l!=null){e._isValid=!1;return}if(a[4])if(Sl.exec(a[4]))d="Z";else{e._isValid=!1;return}e._f=i+(l||"")+(d||""),On(e)}else e._isValid=!1}function Il(e,t,n,s,a,o){var i=[Dl(e),Fs.indexOf(t),parseInt(n,10),parseInt(s,10),parseInt(a,10)];return o&&i.push(parseInt(o,10)),i}function Dl(e){var t=parseInt(e,10);return t<=49?2e3+t:t<=999?1900+t:t}function xl(e){return e.replace(/\([^()]*\)|[\n\t]/g," ").replace(/(\s\s+)/g," ").replace(/^\s\s*/,"").replace(/\s\s*$/,"")}function Yl(e,t,n){if(e){var s=Js.indexOf(e),a=new Date(t[0],t[1],t[2]).getDay();if(s!==a)return T(n).weekdayMismatch=!0,n._isValid=!1,!1}return!0}function Rl(e,t,n){if(e)return Tl[e];if(t)return 0;var s=parseInt(n,10),a=s%100,o=(s-a)/100;return o*60+a}function na(e){var t=El.exec(xl(e._i)),n;if(t){if(n=Il(t[4],t[3],t[2],t[5],t[6],t[7]),!Yl(t[1],n,e))return;e._a=n,e._tzm=Rl(t[8],t[9],t[10]),e._d=tt.apply(null,e._a),e._d.setUTCMinutes(e._d.getUTCMinutes()-e._tzm),T(e).rfc2822=!0}else e._isValid=!1}function Pl(e){var t=Ol.exec(e._i);if(t!==null){e._d=new Date(+t[1]);return}if(ta(e),e._isValid===!1)delete e._isValid;else return;if(na(e),e._isValid===!1)delete e._isValid;else return;e._strict?e._isValid=!1:y.createFromInputFallback(e)}y.createFromInputFallback=se("value provided is not in a recognized RFC2822 or ISO format. moment construction falls back to js Date(), which is not reliable across all browsers and versions. Non RFC2822/ISO date formats are discouraged. Please refer to http://momentjs.com/guides/#/warnings/js-date/ for more info.",function(e){e._d=new Date(e._i+(e._useUTC?" UTC":""))});function He(e,t,n){return e??t??n}function Bl(e){var t=new Date(y.now());return e._useUTC?[t.getUTCFullYear(),t.getUTCMonth(),t.getUTCDate()]:[t.getFullYear(),t.getMonth(),t.getDate()]}function Sn(e){var t,n,s=[],a,o,i;if(!e._d){for(a=Bl(e),e._w&&e._a[me]==null&&e._a[ke]==null&&Vl(e),e._dayOfYear!=null&&(i=He(e._a[X],a[X]),(e._dayOfYear>Qe(i)||e._dayOfYear===0)&&(T(e)._overflowDayOfYear=!0),n=tt(i,0,e._dayOfYear),e._a[ke]=n.getUTCMonth(),e._a[me]=n.getUTCDate()),t=0;t<3&&e._a[t]==null;++t)e._a[t]=s[t]=a[t];for(;t<7;t++)e._a[t]=s[t]=e._a[t]==null?t===2?1:0:e._a[t];e._a[q]===24&&e._a[le]===0&&e._a[we]===0&&e._a[Ye]===0&&(e._nextDay=!0,e._a[q]=0),e._d=(e._useUTC?tt:Hi).apply(null,s),o=e._useUTC?e._d.getUTCDay():e._d.getDay(),e._tzm!=null&&e._d.setUTCMinutes(e._d.getUTCMinutes()-e._tzm),e._nextDay&&(e._a[q]=24),e._w&&typeof e._w.d<"u"&&e._w.d!==o&&(T(e).weekdayMismatch=!0)}}function Vl(e){var t,n,s,a,o,i,l,d,c;t=e._w,t.GG!=null||t.W!=null||t.E!=null?(o=1,i=4,n=He(t.GG,e._a[X],nt($(),1,4).year),s=He(t.W,1),a=He(t.E,1),(a<1||a>7)&&(d=!0)):(o=e._locale._week.dow,i=e._locale._week.doy,c=nt($(),o,i),n=He(t.gg,e._a[X],c.year),s=He(t.w,c.week),t.d!=null?(a=t.d,(a<0||a>6)&&(d=!0)):t.e!=null?(a=t.e+o,(t.e<0||t.e>6)&&(d=!0)):a=o),s<1||s>be(n,o,i)?T(e)._overflowWeeks=!0:d!=null?T(e)._overflowWeekday=!0:(l=qs(n,s,a,o,i),e._a[X]=l.year,e._dayOfYear=l.dayOfYear)}y.ISO_8601=function(){},y.RFC_2822=function(){};function On(e){if(e._f===y.ISO_8601){ta(e);return}if(e._f===y.RFC_2822){na(e);return}e._a=[],T(e).empty=!0;var t=""+e._i,n,s,a,o,i,l=t.length,d=0,c,h;for(a=Bs(e._f,e._locale).match(hn)||[],h=a.length,n=0;n<h;n++)o=a[n],s=(t.match(Ci(o,e))||[])[0],s&&(i=t.substr(0,t.indexOf(s)),i.length>0&&T(e).unusedInput.push(i),t=t.slice(t.indexOf(s)+s.length),d+=s.length),Ae[o]?(s?T(e).empty=!1:T(e).unusedTokens.push(o),Si(o,s,e)):e._strict&&!s&&T(e).unusedTokens.push(o);T(e).charsLeftOver=l-d,t.length>0&&T(e).unusedInput.push(t),e._a[q]<=12&&T(e).bigHour===!0&&e._a[q]>0&&(T(e).bigHour=void 0),T(e).parsedDateParts=e._a.slice(0),T(e).meridiem=e._meridiem,e._a[q]=Ll(e._locale,e._a[q],e._meridiem),c=T(e).era,c!==null&&(e._a[X]=e._locale.erasConvertYear(c,e._a[X])),Sn(e),Cn(e)}function Ll(e,t,n){var s;return n==null?t:e.meridiemHour!=null?e.meridiemHour(t,n):(e.isPM!=null&&(s=e.isPM(n),s&&t<12&&(t+=12),!s&&t===12&&(t=0)),t)}function Al(e){var t,n,s,a,o,i,l=!1,d=e._f.length;if(d===0){T(e).invalidFormat=!0,e._d=new Date(NaN);return}for(a=0;a<d;a++)o=0,i=!1,t=ln({},e),e._useUTC!=null&&(t._useUTC=e._useUTC),t._f=e._f[a],On(t),rn(t)&&(i=!0),o+=T(t).charsLeftOver,o+=T(t).unusedTokens.length*10,T(t).score=o,l?o<s&&(s=o,n=t):(s==null||o<s||i)&&(s=o,n=t,i&&(l=!0));Ee(e,n||t)}function Ul(e){if(!e._d){var t=pn(e._i),n=t.day===void 0?t.date:t.day;e._a=Ds([t.year,t.month,n,t.hour,t.minute,t.second,t.millisecond],function(s){return s&&parseInt(s,10)}),Sn(e)}}function Wl(e){var t=new Je(Cn(sa(e)));return t._nextDay&&(t.add(1,"d"),t._nextDay=void 0),t}function sa(e){var t=e._i,n=e._f;return e._locale=e._locale||ve(e._l),t===null||n===void 0&&t===""?pt({nullInput:!0}):(typeof t=="string"&&(e._i=t=e._locale.preparse(t)),ie(t)?new Je(Cn(t)):(qe(t)?e._d=t:oe(n)?Al(e):n?On(e):$l(e),rn(e)||(e._d=null),e))}function $l(e){var t=e._i;Q(t)?e._d=new Date(y.now()):qe(t)?e._d=new Date(t.valueOf()):typeof t=="string"?Pl(e):oe(t)?(e._a=Ds(t.slice(0),function(n){return parseInt(n,10)}),Sn(e)):xe(t)?Ul(e):ye(t)?e._d=new Date(t):y.createFromInputFallback(e)}function aa(e,t,n,s,a){var o={};return(t===!0||t===!1)&&(s=t,t=void 0),(n===!0||n===!1)&&(s=n,n=void 0),(xe(e)&&sn(e)||oe(e)&&e.length===0)&&(e=void 0),o._isAMomentObject=!0,o._useUTC=o._isUTC=a,o._l=n,o._i=e,o._f=t,o._strict=s,Wl(o)}function $(e,t,n,s){return aa(e,t,n,s,!1)}var Hl=se("moment().min is deprecated, use moment.max instead. http://momentjs.com/guides/#/warnings/min-max/",function(){var e=$.apply(null,arguments);return this.isValid()&&e.isValid()?e<this?this:e:pt()}),Fl=se("moment().max is deprecated, use moment.min instead. http://momentjs.com/guides/#/warnings/min-max/",function(){var e=$.apply(null,arguments);return this.isValid()&&e.isValid()?e>this?this:e:pt()});function ra(e,t){var n,s;if(t.length===1&&oe(t[0])&&(t=t[0]),!t.length)return $();for(n=t[0],s=1;s<t.length;++s)(!t[s].isValid()||t[s][e](n))&&(n=t[s]);return n}function Gl(){var e=[].slice.call(arguments,0);return ra("isBefore",e)}function jl(){var e=[].slice.call(arguments,0);return ra("isAfter",e)}var zl=function(){return Date.now?Date.now():+new Date},rt=["year","quarter","month","week","day","hour","minute","second","millisecond"];function Zl(e){var t,n=!1,s,a=rt.length;for(t in e)if(P(e,t)&&!(z.call(rt,t)!==-1&&(e[t]==null||!isNaN(e[t]))))return!1;for(s=0;s<a;++s)if(e[rt[s]]){if(n)return!1;parseFloat(e[rt[s]])!==x(e[rt[s]])&&(n=!0)}return!0}function ql(){return this._isValid}function Jl(){return de(NaN)}function Ot(e){var t=pn(e),n=t.year||0,s=t.quarter||0,a=t.month||0,o=t.week||t.isoWeek||0,i=t.day||0,l=t.hour||0,d=t.minute||0,c=t.second||0,h=t.millisecond||0;this._isValid=Zl(t),this._milliseconds=+h+c*1e3+d*6e4+l*1e3*60*60,this._days=+i+o*7,this._months=+a+s*3+n*12,this._data={},this._locale=ve(),this._bubble()}function Et(e){return e instanceof Ot}function En(e){return e<0?Math.round(-1*e)*-1:Math.round(e)}function Xl(e,t,n){var s=Math.min(e.length,t.length),a=Math.abs(e.length-t.length),o=0,i;for(i=0;i<s;i++)x(e[i])!==x(t[i])&&o++;return o+a}function oa(e,t){C(e,0,0,function(){var n=this.utcOffset(),s="+";return n<0&&(n=-n,s="-"),s+pe(~~(n/60),2)+t+pe(~~n%60,2)})}oa("Z",":"),oa("ZZ",""),g("Z",bt),g("ZZ",bt),A(["Z","ZZ"],function(e,t,n){n._useUTC=!0,n._tzm=Tn(bt,e)});var Kl=/([\+\-]|\d\d)/gi;function Tn(e,t){var n=(t||"").match(e),s,a,o;return n===null?null:(s=n[n.length-1]||[],a=(s+"").match(Kl)||["-",0,0],o=+(a[1]*60)+x(a[2]),o===0?0:a[0]==="+"?o:-o)}function In(e,t){var n,s;return t._isUTC?(n=t.clone(),s=(ie(e)||qe(e)?e.valueOf():$(e).valueOf())-n.valueOf(),n._d.setTime(n._d.valueOf()+s),y.updateOffset(n,!1),n):$(e).local()}function Dn(e){return-Math.round(e._d.getTimezoneOffset())}y.updateOffset=function(){};function Ql(e,t,n){var s=this._offset||0,a;if(!this.isValid())return e!=null?this:NaN;if(e!=null){if(typeof e=="string"){if(e=Tn(bt,e),e===null)return this}else Math.abs(e)<16&&!n&&(e=e*60);return!this._isUTC&&t&&(a=Dn(this)),this._offset=e,this._isUTC=!0,a!=null&&this.add(a,"m"),s!==e&&(!t||this._changeInProgress?ca(this,de(e-s,"m"),1,!1):this._changeInProgress||(this._changeInProgress=!0,y.updateOffset(this,!0),this._changeInProgress=null)),this}else return this._isUTC?s:Dn(this)}function ed(e,t){return e!=null?(typeof e!="string"&&(e=-e),this.utcOffset(e,t),this):-this.utcOffset()}function td(e){return this.utcOffset(0,e)}function nd(e){return this._isUTC&&(this.utcOffset(0,e),this._isUTC=!1,e&&this.subtract(Dn(this),"m")),this}function sd(){if(this._tzm!=null)this.utcOffset(this._tzm,!1,!0);else if(typeof this._i=="string"){var e=Tn(vi,this._i);e!=null?this.utcOffset(e):this.utcOffset(0,!0)}return this}function ad(e){return this.isValid()?(e=e?$(e).utcOffset():0,(this.utcOffset()-e)%60===0):!1}function rd(){return this.utcOffset()>this.clone().month(0).utcOffset()||this.utcOffset()>this.clone().month(5).utcOffset()}function od(){if(!Q(this._isDSTShifted))return this._isDSTShifted;var e={},t;return ln(e,this),e=sa(e),e._a?(t=e._isUTC?he(e._a):$(e._a),this._isDSTShifted=this.isValid()&&Xl(e._a,t.toArray())>0):this._isDSTShifted=!1,this._isDSTShifted}function id(){return this.isValid()?!this._isUTC:!1}function ld(){return this.isValid()?this._isUTC:!1}function ia(){return this.isValid()?this._isUTC&&this._offset===0:!1}var dd=/^(-|\+)?(?:(\d*)[. ])?(\d+):(\d+)(?::(\d+)(\.\d*)?)?$/,cd=/^(-|\+)?P(?:([-+]?[0-9,.]*)Y)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)W)?(?:([-+]?[0-9,.]*)D)?(?:T(?:([-+]?[0-9,.]*)H)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)S)?)?$/;function de(e,t){var n=e,s=null,a,o,i;return Et(e)?n={ms:e._milliseconds,d:e._days,M:e._months}:ye(e)||!isNaN(+e)?(n={},t?n[t]=+e:n.milliseconds=+e):(s=dd.exec(e))?(a=s[1]==="-"?-1:1,n={y:0,d:x(s[me])*a,h:x(s[q])*a,m:x(s[le])*a,s:x(s[we])*a,ms:x(En(s[Ye]*1e3))*a}):(s=cd.exec(e))?(a=s[1]==="-"?-1:1,n={y:Re(s[2],a),M:Re(s[3],a),w:Re(s[4],a),d:Re(s[5],a),h:Re(s[6],a),m:Re(s[7],a),s:Re(s[8],a)}):n==null?n={}:typeof n=="object"&&("from"in n||"to"in n)&&(i=ud($(n.from),$(n.to)),n={},n.ms=i.milliseconds,n.M=i.months),o=new Ot(n),Et(e)&&P(e,"_locale")&&(o._locale=e._locale),Et(e)&&P(e,"_isValid")&&(o._isValid=e._isValid),o}de.fn=Ot.prototype,de.invalid=Jl;function Re(e,t){var n=e&&parseFloat(e.replace(",","."));return(isNaN(n)?0:n)*t}function la(e,t){var n={};return n.months=t.month()-e.month()+(t.year()-e.year())*12,e.clone().add(n.months,"M").isAfter(t)&&--n.months,n.milliseconds=+t-+e.clone().add(n.months,"M"),n}function ud(e,t){var n;return e.isValid()&&t.isValid()?(t=In(t,e),e.isBefore(t)?n=la(e,t):(n=la(t,e),n.milliseconds=-n.milliseconds,n.months=-n.months),n):{milliseconds:0,months:0}}function da(e,t){return function(n,s){var a,o;return s!==null&&!isNaN(+s)&&(Ps(t,"moment()."+t+"(period, number) is deprecated. Please use moment()."+t+"(number, period). See http://momentjs.com/guides/#/warnings/add-inverted-param/ for more info."),o=n,n=s,s=o),a=de(n,s),ca(this,a,e),this}}function ca(e,t,n,s){var a=t._milliseconds,o=En(t._days),i=En(t._months);e.isValid()&&(s=s??!0,i&&js(e,et(e,"Month")+i*n),o&&Hs(e,"Date",et(e,"Date")+o*n),a&&e._d.setTime(e._d.valueOf()+a*n),s&&y.updateOffset(e,o||i))}var hd=da(1,"add"),fd=da(-1,"subtract");function ua(e){return typeof e=="string"||e instanceof String}function pd(e){return ie(e)||qe(e)||ua(e)||ye(e)||_d(e)||md(e)||e===null||e===void 0}function md(e){var t=xe(e)&&!sn(e),n=!1,s=["years","year","y","months","month","M","days","day","d","dates","date","D","hours","hour","h","minutes","minute","m","seconds","second","s","milliseconds","millisecond","ms"],a,o,i=s.length;for(a=0;a<i;a+=1)o=s[a],n=n||P(e,o);return t&&n}function _d(e){var t=oe(e),n=!1;return t&&(n=e.filter(function(s){return!ye(s)&&ua(e)}).length===0),t&&n}function yd(e){var t=xe(e)&&!sn(e),n=!1,s=["sameDay","nextDay","lastDay","nextWeek","lastWeek","sameElse"],a,o;for(a=0;a<s.length;a+=1)o=s[a],n=n||P(e,o);return t&&n}function gd(e,t){var n=e.diff(t,"days",!0);return n<-6?"sameElse":n<-1?"lastWeek":n<0?"lastDay":n<1?"sameDay":n<2?"nextDay":n<7?"nextWeek":"sameElse"}function kd(e,t){arguments.length===1&&(arguments[0]?pd(arguments[0])?(e=arguments[0],t=void 0):yd(arguments[0])&&(t=arguments[0],e=void 0):(e=void 0,t=void 0));var n=e||$(),s=In(n,this).startOf("day"),a=y.calendarFormat(this,s)||"sameElse",o=t&&(fe(t[a])?t[a].call(this,n):t[a]);return this.format(o||this.localeData().calendar(a,this,$(n)))}function wd(){return new Je(this)}function bd(e,t){var n=ie(e)?e:$(e);return this.isValid()&&n.isValid()?(t=ae(t)||"millisecond",t==="millisecond"?this.valueOf()>n.valueOf():n.valueOf()<this.clone().startOf(t).valueOf()):!1}function vd(e,t){var n=ie(e)?e:$(e);return this.isValid()&&n.isValid()?(t=ae(t)||"millisecond",t==="millisecond"?this.valueOf()<n.valueOf():this.clone().endOf(t).valueOf()<n.valueOf()):!1}function Nd(e,t,n,s){var a=ie(e)?e:$(e),o=ie(t)?t:$(t);return this.isValid()&&a.isValid()&&o.isValid()?(s=s||"()",(s[0]==="("?this.isAfter(a,n):!this.isBefore(a,n))&&(s[1]===")"?this.isBefore(o,n):!this.isAfter(o,n))):!1}function Cd(e,t){var n=ie(e)?e:$(e),s;return this.isValid()&&n.isValid()?(t=ae(t)||"millisecond",t==="millisecond"?this.valueOf()===n.valueOf():(s=n.valueOf(),this.clone().startOf(t).valueOf()<=s&&s<=this.clone().endOf(t).valueOf())):!1}function Md(e,t){return this.isSame(e,t)||this.isAfter(e,t)}function Sd(e,t){return this.isSame(e,t)||this.isBefore(e,t)}function Od(e,t,n){var s,a,o;if(!this.isValid())return NaN;if(s=In(e,this),!s.isValid())return NaN;switch(a=(s.utcOffset()-this.utcOffset())*6e4,t=ae(t),t){case"year":o=Tt(this,s)/12;break;case"month":o=Tt(this,s);break;case"quarter":o=Tt(this,s)/3;break;case"second":o=(this-s)/1e3;break;case"minute":o=(this-s)/6e4;break;case"hour":o=(this-s)/36e5;break;case"day":o=(this-s-a)/864e5;break;case"week":o=(this-s-a)/6048e5;break;default:o=this-s}return n?o:re(o)}function Tt(e,t){if(e.date()<t.date())return-Tt(t,e);var n=(t.year()-e.year())*12+(t.month()-e.month()),s=e.clone().add(n,"months"),a,o;return t-s<0?(a=e.clone().add(n-1,"months"),o=(t-s)/(s-a)):(a=e.clone().add(n+1,"months"),o=(t-s)/(a-s)),-(n+o)||0}y.defaultFormat="YYYY-MM-DDTHH:mm:ssZ",y.defaultFormatUtc="YYYY-MM-DDTHH:mm:ss[Z]";function Ed(){return this.clone().locale("en").format("ddd MMM DD YYYY HH:mm:ss [GMT]ZZ")}function Td(e){if(!this.isValid())return null;var t=e!==!0,n=t?this.clone().utc():this;return n.year()<0||n.year()>9999?_t(n,t?"YYYYYY-MM-DD[T]HH:mm:ss.SSS[Z]":"YYYYYY-MM-DD[T]HH:mm:ss.SSSZ"):fe(Date.prototype.toISOString)?t?this.toDate().toISOString():new Date(this.valueOf()+this.utcOffset()*60*1e3).toISOString().replace("Z",_t(n,"Z")):_t(n,t?"YYYY-MM-DD[T]HH:mm:ss.SSS[Z]":"YYYY-MM-DD[T]HH:mm:ss.SSSZ")}function Id(){if(!this.isValid())return"moment.invalid(/* "+this._i+" */)";var e="moment",t="",n,s,a,o;return this.isLocal()||(e=this.utcOffset()===0?"moment.utc":"moment.parseZone",t="Z"),n="["+e+'("]',s=0<=this.year()&&this.year()<=9999?"YYYY":"YYYYYY",a="-MM-DD[T]HH:mm:ss.SSS",o=t+'[")]',this.format(n+s+a+o)}function Dd(e){e||(e=this.isUtc()?y.defaultFormatUtc:y.defaultFormat);var t=_t(this,e);return this.localeData().postformat(t)}function xd(e,t){return this.isValid()&&(ie(e)&&e.isValid()||$(e).isValid())?de({to:this,from:e}).locale(this.locale()).humanize(!t):this.localeData().invalidDate()}function Yd(e){return this.from($(),e)}function Rd(e,t){return this.isValid()&&(ie(e)&&e.isValid()||$(e).isValid())?de({from:this,to:e}).locale(this.locale()).humanize(!t):this.localeData().invalidDate()}function Pd(e){return this.to($(),e)}function ha(e){var t;return e===void 0?this._locale._abbr:(t=ve(e),t!=null&&(this._locale=t),this)}var fa=se("moment().lang() is deprecated. Instead, use moment().localeData() to get the language configuration. Use moment().locale() to change languages.",function(e){return e===void 0?this.localeData():this.locale(e)});function pa(){return this._locale}var It=1e3,Fe=60*It,Dt=60*Fe,ma=(365*400+97)*24*Dt;function Ge(e,t){return(e%t+t)%t}function _a(e,t,n){return e<100&&e>=0?new Date(e+400,t,n)-ma:new Date(e,t,n).valueOf()}function ya(e,t,n){return e<100&&e>=0?Date.UTC(e+400,t,n)-ma:Date.UTC(e,t,n)}function Bd(e){var t,n;if(e=ae(e),e===void 0||e==="millisecond"||!this.isValid())return this;switch(n=this._isUTC?ya:_a,e){case"year":t=n(this.year(),0,1);break;case"quarter":t=n(this.year(),this.month()-this.month()%3,1);break;case"month":t=n(this.year(),this.month(),1);break;case"week":t=n(this.year(),this.month(),this.date()-this.weekday());break;case"isoWeek":t=n(this.year(),this.month(),this.date()-(this.isoWeekday()-1));break;case"day":case"date":t=n(this.year(),this.month(),this.date());break;case"hour":t=this._d.valueOf(),t-=Ge(t+(this._isUTC?0:this.utcOffset()*Fe),Dt);break;case"minute":t=this._d.valueOf(),t-=Ge(t,Fe);break;case"second":t=this._d.valueOf(),t-=Ge(t,It);break}return this._d.setTime(t),y.updateOffset(this,!0),this}function Vd(e){var t,n;if(e=ae(e),e===void 0||e==="millisecond"||!this.isValid())return this;switch(n=this._isUTC?ya:_a,e){case"year":t=n(this.year()+1,0,1)-1;break;case"quarter":t=n(this.year(),this.month()-this.month()%3+3,1)-1;break;case"month":t=n(this.year(),this.month()+1,1)-1;break;case"week":t=n(this.year(),this.month(),this.date()-this.weekday()+7)-1;break;case"isoWeek":t=n(this.year(),this.month(),this.date()-(this.isoWeekday()-1)+7)-1;break;case"day":case"date":t=n(this.year(),this.month(),this.date()+1)-1;break;case"hour":t=this._d.valueOf(),t+=Dt-Ge(t+(this._isUTC?0:this.utcOffset()*Fe),Dt)-1;break;case"minute":t=this._d.valueOf(),t+=Fe-Ge(t,Fe)-1;break;case"second":t=this._d.valueOf(),t+=It-Ge(t,It)-1;break}return this._d.setTime(t),y.updateOffset(this,!0),this}function Ld(){return this._d.valueOf()-(this._offset||0)*6e4}function Ad(){return Math.floor(this.valueOf()/1e3)}function Ud(){return new Date(this.valueOf())}function Wd(){var e=this;return[e.year(),e.month(),e.date(),e.hour(),e.minute(),e.second(),e.millisecond()]}function $d(){var e=this;return{years:e.year(),months:e.month(),date:e.date(),hours:e.hours(),minutes:e.minutes(),seconds:e.seconds(),milliseconds:e.milliseconds()}}function Hd(){return this.isValid()?this.toISOString():null}function Fd(){return rn(this)}function Gd(){return Ee({},T(this))}function jd(){return T(this).overflow}function zd(){return{input:this._i,format:this._f,locale:this._locale,isUTC:this._isUTC,strict:this._strict}}C("N",0,0,"eraAbbr"),C("NN",0,0,"eraAbbr"),C("NNN",0,0,"eraAbbr"),C("NNNN",0,0,"eraName"),C("NNNNN",0,0,"eraNarrow"),C("y",["y",1],"yo","eraYear"),C("y",["yy",2],0,"eraYear"),C("y",["yyy",3],0,"eraYear"),C("y",["yyyy",4],0,"eraYear"),g("N",xn),g("NN",xn),g("NNN",xn),g("NNNN",ac),g("NNNNN",rc),A(["N","NN","NNN","NNNN","NNNNN"],function(e,t,n,s){var a=n._locale.erasParse(e,s,n._strict);a?T(n).era=a:T(n).invalidEra=e}),g("y",Ue),g("yy",Ue),g("yyy",Ue),g("yyyy",Ue),g("yo",oc),A(["y","yy","yyy","yyyy"],X),A(["yo"],function(e,t,n,s){var a;n._locale._eraYearOrdinalRegex&&(a=e.match(n._locale._eraYearOrdinalRegex)),n._locale.eraYearOrdinalParse?t[X]=n._locale.eraYearOrdinalParse(e,a):t[X]=parseInt(e,10)});function Zd(e,t){var n,s,a,o=this._eras||ve("en")._eras;for(n=0,s=o.length;n<s;++n)switch(typeof o[n].since==="string"&&(a=y(o[n].since).startOf("day"),o[n].since=a.valueOf()),typeof o[n].until){case"undefined":o[n].until=1/0;break;case"string":a=y(o[n].until).startOf("day").valueOf(),o[n].until=a.valueOf();break}return o}function qd(e,t,n){var s,a,o=this.eras(),i,l,d;for(e=e.toUpperCase(),s=0,a=o.length;s<a;++s)if(i=o[s].name.toUpperCase(),l=o[s].abbr.toUpperCase(),d=o[s].narrow.toUpperCase(),n)switch(t){case"N":case"NN":case"NNN":if(l===e)return o[s];break;case"NNNN":if(i===e)return o[s];break;case"NNNNN":if(d===e)return o[s];break}else if([i,l,d].indexOf(e)>=0)return o[s]}function Jd(e,t){var n=e.since<=e.until?1:-1;return t===void 0?y(e.since).year():y(e.since).year()+(t-e.offset)*n}function Xd(){var e,t,n,s=this.localeData().eras();for(e=0,t=s.length;e<t;++e)if(n=this.clone().startOf("day").valueOf(),s[e].since<=n&&n<=s[e].until||s[e].until<=n&&n<=s[e].since)return s[e].name;return""}function Kd(){var e,t,n,s=this.localeData().eras();for(e=0,t=s.length;e<t;++e)if(n=this.clone().startOf("day").valueOf(),s[e].since<=n&&n<=s[e].until||s[e].until<=n&&n<=s[e].since)return s[e].narrow;return""}function Qd(){var e,t,n,s=this.localeData().eras();for(e=0,t=s.length;e<t;++e)if(n=this.clone().startOf("day").valueOf(),s[e].since<=n&&n<=s[e].until||s[e].until<=n&&n<=s[e].since)return s[e].abbr;return""}function ec(){var e,t,n,s,a=this.localeData().eras();for(e=0,t=a.length;e<t;++e)if(n=a[e].since<=a[e].until?1:-1,s=this.clone().startOf("day").valueOf(),a[e].since<=s&&s<=a[e].until||a[e].until<=s&&s<=a[e].since)return(this.year()-y(a[e].since).year())*n+a[e].offset;return this.year()}function tc(e){return P(this,"_erasNameRegex")||Yn.call(this),e?this._erasNameRegex:this._erasRegex}function nc(e){return P(this,"_erasAbbrRegex")||Yn.call(this),e?this._erasAbbrRegex:this._erasRegex}function sc(e){return P(this,"_erasNarrowRegex")||Yn.call(this),e?this._erasNarrowRegex:this._erasRegex}function xn(e,t){return t.erasAbbrRegex(e)}function ac(e,t){return t.erasNameRegex(e)}function rc(e,t){return t.erasNarrowRegex(e)}function oc(e,t){return t._eraYearOrdinalRegex||Ue}function Yn(){var e=[],t=[],n=[],s=[],a,o,i,l,d,c=this.eras();for(a=0,o=c.length;a<o;++a)i=ge(c[a].name),l=ge(c[a].abbr),d=ge(c[a].narrow),t.push(i),e.push(l),n.push(d),s.push(i),s.push(l),s.push(d);this._erasRegex=new RegExp("^("+s.join("|")+")","i"),this._erasNameRegex=new RegExp("^("+t.join("|")+")","i"),this._erasAbbrRegex=new RegExp("^("+e.join("|")+")","i"),this._erasNarrowRegex=new RegExp("^("+n.join("|")+")","i")}C(0,["gg",2],0,function(){return this.weekYear()%100}),C(0,["GG",2],0,function(){return this.isoWeekYear()%100});function xt(e,t){C(0,[e,e.length],0,t)}xt("gggg","weekYear"),xt("ggggg","weekYear"),xt("GGGG","isoWeekYear"),xt("GGGGG","isoWeekYear"),g("G",wt),g("g",wt),g("GG",W,ee),g("gg",W,ee),g("GGGG",_n,mn),g("gggg",_n,mn),g("GGGGG",kt,yt),g("ggggg",kt,yt),Ke(["gggg","ggggg","GGGG","GGGGG"],function(e,t,n,s){t[s.substr(0,2)]=x(e)}),Ke(["gg","GG"],function(e,t,n,s){t[s]=y.parseTwoDigitYear(e)});function ic(e){return ga.call(this,e,this.week(),this.weekday()+this.localeData()._week.dow,this.localeData()._week.dow,this.localeData()._week.doy)}function lc(e){return ga.call(this,e,this.isoWeek(),this.isoWeekday(),1,4)}function dc(){return be(this.year(),1,4)}function cc(){return be(this.isoWeekYear(),1,4)}function uc(){var e=this.localeData()._week;return be(this.year(),e.dow,e.doy)}function hc(){var e=this.localeData()._week;return be(this.weekYear(),e.dow,e.doy)}function ga(e,t,n,s,a){var o;return e==null?nt(this,s,a).year:(o=be(e,s,a),t>o&&(t=o),fc.call(this,e,t,n,s,a))}function fc(e,t,n,s,a){var o=qs(e,t,n,s,a),i=tt(o.year,0,o.dayOfYear);return this.year(i.getUTCFullYear()),this.month(i.getUTCMonth()),this.date(i.getUTCDate()),this}C("Q",0,"Qo","quarter"),g("Q",Ls),A("Q",function(e,t){t[ke]=(x(e)-1)*3});function pc(e){return e==null?Math.ceil((this.month()+1)/3):this.month((e-1)*3+this.month()%3)}C("D",["DD",2],"Do","date"),g("D",W,We),g("DD",W,ee),g("Do",function(e,t){return e?t._dayOfMonthOrdinalParse||t._ordinalParse:t._dayOfMonthOrdinalParseLenient}),A(["D","DD"],me),A("Do",function(e,t){t[me]=x(e.match(W)[0])});var ka=$e("Date",!0);C("DDD",["DDDD",3],"DDDo","dayOfYear"),g("DDD",gt),g("DDDD",As),A(["DDD","DDDD"],function(e,t,n){n._dayOfYear=x(e)});function mc(e){var t=Math.round((this.clone().startOf("day")-this.clone().startOf("year"))/864e5)+1;return e==null?t:this.add(e-t,"d")}C("m",["mm",2],0,"minute"),g("m",W,yn),g("mm",W,ee),A(["m","mm"],le);var _c=$e("Minutes",!1);C("s",["ss",2],0,"second"),g("s",W,yn),g("ss",W,ee),A(["s","ss"],we);var yc=$e("Seconds",!1);C("S",0,0,function(){return~~(this.millisecond()/100)}),C(0,["SS",2],0,function(){return~~(this.millisecond()/10)}),C(0,["SSS",3],0,"millisecond"),C(0,["SSSS",4],0,function(){return this.millisecond()*10}),C(0,["SSSSS",5],0,function(){return this.millisecond()*100}),C(0,["SSSSSS",6],0,function(){return this.millisecond()*1e3}),C(0,["SSSSSSS",7],0,function(){return this.millisecond()*1e4}),C(0,["SSSSSSSS",8],0,function(){return this.millisecond()*1e5}),C(0,["SSSSSSSSS",9],0,function(){return this.millisecond()*1e6}),g("S",gt,Ls),g("SS",gt,ee),g("SSS",gt,As);var Ie,wa;for(Ie="SSSS";Ie.length<=9;Ie+="S")g(Ie,Ue);function gc(e,t){t[Ye]=x(("0."+e)*1e3)}for(Ie="S";Ie.length<=9;Ie+="S")A(Ie,gc);wa=$e("Milliseconds",!1),C("z",0,0,"zoneAbbr"),C("zz",0,0,"zoneName");function kc(){return this._isUTC?"UTC":""}function wc(){return this._isUTC?"Coordinated Universal Time":""}var u=Je.prototype;u.add=hd,u.calendar=kd,u.clone=wd,u.diff=Od,u.endOf=Vd,u.format=Dd,u.from=xd,u.fromNow=Yd,u.to=Rd,u.toNow=Pd,u.get=Ii,u.invalidAt=jd,u.isAfter=bd,u.isBefore=vd,u.isBetween=Nd,u.isSame=Cd,u.isSameOrAfter=Md,u.isSameOrBefore=Sd,u.isValid=Fd,u.lang=fa,u.locale=ha,u.localeData=pa,u.max=Fl,u.min=Hl,u.parsingFlags=Gd,u.set=Di,u.startOf=Bd,u.subtract=fd,u.toArray=Wd,u.toObject=$d,u.toDate=Ud,u.toISOString=Td,u.inspect=Id,typeof Symbol<"u"&&Symbol.for!=null&&(u[Symbol.for("nodejs.util.inspect.custom")]=function(){return"Moment<"+this.format()+">"}),u.toJSON=Hd,u.toString=Ed,u.unix=Ad,u.valueOf=Ld,u.creationData=zd,u.eraName=Xd,u.eraNarrow=Kd,u.eraAbbr=Qd,u.eraYear=ec,u.year=$s,u.isLeapYear=Ti,u.weekYear=ic,u.isoWeekYear=lc,u.quarter=u.quarters=pc,u.month=zs,u.daysInMonth=Ui,u.week=u.weeks=Zi,u.isoWeek=u.isoWeeks=qi,u.weeksInYear=uc,u.weeksInWeekYear=hc,u.isoWeeksInYear=dc,u.isoWeeksInISOWeekYear=cc,u.date=ka,u.day=u.days=ll,u.weekday=dl,u.isoWeekday=cl,u.dayOfYear=mc,u.hour=u.hours=yl,u.minute=u.minutes=_c,u.second=u.seconds=yc,u.millisecond=u.milliseconds=wa,u.utcOffset=Ql,u.utc=td,u.local=nd,u.parseZone=sd,u.hasAlignedHourOffset=ad,u.isDST=rd,u.isLocal=id,u.isUtcOffset=ld,u.isUtc=ia,u.isUTC=ia,u.zoneAbbr=kc,u.zoneName=wc,u.dates=se("dates accessor is deprecated. Use date instead.",ka),u.months=se("months accessor is deprecated. Use month instead",zs),u.years=se("years accessor is deprecated. Use year instead",$s),u.zone=se("moment().zone is deprecated, use moment().utcOffset instead. http://momentjs.com/guides/#/warnings/zone/",ed),u.isDSTShifted=se("isDSTShifted is deprecated. See http://momentjs.com/guides/#/warnings/dst-shifted/ for more information",od);function bc(e){return $(e*1e3)}function vc(){return $.apply(null,arguments).parseZone()}function ba(e){return e}var B=cn.prototype;B.calendar=ii,B.longDateFormat=ui,B.invalidDate=fi,B.ordinal=_i,B.preparse=ba,B.postformat=ba,B.relativeTime=gi,B.pastFuture=ki,B.set=ri,B.eras=Zd,B.erasParse=qd,B.erasConvertYear=Jd,B.erasAbbrRegex=nc,B.erasNameRegex=tc,B.erasNarrowRegex=sc,B.months=Bi,B.monthsShort=Vi,B.monthsParse=Ai,B.monthsRegex=$i,B.monthsShortRegex=Wi,B.week=Fi,B.firstDayOfYear=zi,B.firstDayOfWeek=ji,B.weekdays=sl,B.weekdaysMin=rl,B.weekdaysShort=al,B.weekdaysParse=il,B.weekdaysRegex=ul,B.weekdaysShortRegex=hl,B.weekdaysMinRegex=fl,B.isPM=ml,B.meridiem=gl;function Yt(e,t,n,s){var a=ve(),o=he().set(s,t);return a[n](o,e)}function va(e,t,n){if(ye(e)&&(t=e,e=void 0),e=e||"",t!=null)return Yt(e,t,n,"month");var s,a=[];for(s=0;s<12;s++)a[s]=Yt(e,s,n,"month");return a}function Rn(e,t,n,s){typeof e=="boolean"?(ye(t)&&(n=t,t=void 0),t=t||""):(t=e,n=t,e=!1,ye(t)&&(n=t,t=void 0),t=t||"");var a=ve(),o=e?a._week.dow:0,i,l=[];if(n!=null)return Yt(t,(n+o)%7,s,"day");for(i=0;i<7;i++)l[i]=Yt(t,(i+o)%7,s,"day");return l}function Nc(e,t){return va(e,t,"months")}function Cc(e,t){return va(e,t,"monthsShort")}function Mc(e,t,n){return Rn(e,t,n,"weekdays")}function Sc(e,t,n){return Rn(e,t,n,"weekdaysShort")}function Oc(e,t,n){return Rn(e,t,n,"weekdaysMin")}Te("en",{eras:[{since:"0001-01-01",until:1/0,offset:1,name:"Anno Domini",narrow:"AD",abbr:"AD"},{since:"0000-12-31",until:-1/0,offset:1,name:"Before Christ",narrow:"BC",abbr:"BC"}],dayOfMonthOrdinalParse:/\d{1,2}(th|st|nd|rd)/,ordinal:function(e){var t=e%10,n=x(e%100/10)===1?"th":t===1?"st":t===2?"nd":t===3?"rd":"th";return e+n}}),y.lang=se("moment.lang is deprecated. Use moment.locale instead.",Te),y.langData=se("moment.langData is deprecated. Use moment.localeData instead.",ve);var Ne=Math.abs;function Ec(){var e=this._data;return this._milliseconds=Ne(this._milliseconds),this._days=Ne(this._days),this._months=Ne(this._months),e.milliseconds=Ne(e.milliseconds),e.seconds=Ne(e.seconds),e.minutes=Ne(e.minutes),e.hours=Ne(e.hours),e.months=Ne(e.months),e.years=Ne(e.years),this}function Na(e,t,n,s){var a=de(t,n);return e._milliseconds+=s*a._milliseconds,e._days+=s*a._days,e._months+=s*a._months,e._bubble()}function Tc(e,t){return Na(this,e,t,1)}function Ic(e,t){return Na(this,e,t,-1)}function Ca(e){return e<0?Math.floor(e):Math.ceil(e)}function Dc(){var e=this._milliseconds,t=this._days,n=this._months,s=this._data,a,o,i,l,d;return e>=0&&t>=0&&n>=0||e<=0&&t<=0&&n<=0||(e+=Ca(Pn(n)+t)*864e5,t=0,n=0),s.milliseconds=e%1e3,a=re(e/1e3),s.seconds=a%60,o=re(a/60),s.minutes=o%60,i=re(o/60),s.hours=i%24,t+=re(i/24),d=re(Ma(t)),n+=d,t-=Ca(Pn(d)),l=re(n/12),n%=12,s.days=t,s.months=n,s.years=l,this}function Ma(e){return e*4800/146097}function Pn(e){return e*146097/4800}function xc(e){if(!this.isValid())return NaN;var t,n,s=this._milliseconds;if(e=ae(e),e==="month"||e==="quarter"||e==="year")switch(t=this._days+s/864e5,n=this._months+Ma(t),e){case"month":return n;case"quarter":return n/3;case"year":return n/12}else switch(t=this._days+Math.round(Pn(this._months)),e){case"week":return t/7+s/6048e5;case"day":return t+s/864e5;case"hour":return t*24+s/36e5;case"minute":return t*1440+s/6e4;case"second":return t*86400+s/1e3;case"millisecond":return Math.floor(t*864e5)+s;default:throw new Error("Unknown unit "+e)}}function Ce(e){return function(){return this.as(e)}}var Sa=Ce("ms"),Yc=Ce("s"),Rc=Ce("m"),Pc=Ce("h"),Bc=Ce("d"),Vc=Ce("w"),Lc=Ce("M"),Ac=Ce("Q"),Uc=Ce("y"),Wc=Sa;function $c(){return de(this)}function Hc(e){return e=ae(e),this.isValid()?this[e+"s"]():NaN}function Pe(e){return function(){return this.isValid()?this._data[e]:NaN}}var Fc=Pe("milliseconds"),Gc=Pe("seconds"),jc=Pe("minutes"),zc=Pe("hours"),Zc=Pe("days"),qc=Pe("months"),Jc=Pe("years");function Xc(){return re(this.days()/7)}var Me=Math.round,je={ss:44,s:45,m:45,h:22,d:26,w:null,M:11};function Kc(e,t,n,s,a){return a.relativeTime(t||1,!!n,e,s)}function Qc(e,t,n,s){var a=de(e).abs(),o=Me(a.as("s")),i=Me(a.as("m")),l=Me(a.as("h")),d=Me(a.as("d")),c=Me(a.as("M")),h=Me(a.as("w")),w=Me(a.as("y")),_=o<=n.ss&&["s",o]||o<n.s&&["ss",o]||i<=1&&["m"]||i<n.m&&["mm",i]||l<=1&&["h"]||l<n.h&&["hh",l]||d<=1&&["d"]||d<n.d&&["dd",d];return n.w!=null&&(_=_||h<=1&&["w"]||h<n.w&&["ww",h]),_=_||c<=1&&["M"]||c<n.M&&["MM",c]||w<=1&&["y"]||["yy",w],_[2]=t,_[3]=+e>0,_[4]=s,Kc.apply(null,_)}function eu(e){return e===void 0?Me:typeof e=="function"?(Me=e,!0):!1}function tu(e,t){return je[e]===void 0?!1:t===void 0?je[e]:(je[e]=t,e==="s"&&(je.ss=t-1),!0)}function nu(e,t){if(!this.isValid())return this.localeData().invalidDate();var n=!1,s=je,a,o;return typeof e=="object"&&(t=e,e=!1),typeof e=="boolean"&&(n=e),typeof t=="object"&&(s=Object.assign({},je,t),t.s!=null&&t.ss==null&&(s.ss=t.s-1)),a=this.localeData(),o=Qc(this,!n,s,a),n&&(o=a.pastFuture(+this,o)),a.postformat(o)}var Bn=Math.abs;function ze(e){return(e>0)-(e<0)||+e}function Rt(){if(!this.isValid())return this.localeData().invalidDate();var e=Bn(this._milliseconds)/1e3,t=Bn(this._days),n=Bn(this._months),s,a,o,i,l=this.asSeconds(),d,c,h,w;return l?(s=re(e/60),a=re(s/60),e%=60,s%=60,o=re(n/12),n%=12,i=e?e.toFixed(3).replace(/\.?0+$/,""):"",d=l<0?"-":"",c=ze(this._months)!==ze(l)?"-":"",h=ze(this._days)!==ze(l)?"-":"",w=ze(this._milliseconds)!==ze(l)?"-":"",d+"P"+(o?c+o+"Y":"")+(n?c+n+"M":"")+(t?h+t+"D":"")+(a||s||e?"T":"")+(a?w+a+"H":"")+(s?w+s+"M":"")+(e?w+i+"S":"")):"P0D"}var Y=Ot.prototype;Y.isValid=ql,Y.abs=Ec,Y.add=Tc,Y.subtract=Ic,Y.as=xc,Y.asMilliseconds=Sa,Y.asSeconds=Yc,Y.asMinutes=Rc,Y.asHours=Pc,Y.asDays=Bc,Y.asWeeks=Vc,Y.asMonths=Lc,Y.asQuarters=Ac,Y.asYears=Uc,Y.valueOf=Wc,Y._bubble=Dc,Y.clone=$c,Y.get=Hc,Y.milliseconds=Fc,Y.seconds=Gc,Y.minutes=jc,Y.hours=zc,Y.days=Zc,Y.weeks=Xc,Y.months=qc,Y.years=Jc,Y.humanize=nu,Y.toISOString=Rt,Y.toString=Rt,Y.toJSON=Rt,Y.locale=ha,Y.localeData=pa,Y.toIsoString=se("toIsoString() is deprecated. Please use toISOString() instead (notice the capitals)",Rt),Y.lang=fa,C("X",0,0,"unix"),C("x",0,0,"valueOf"),g("x",wt),g("X",Ni),A("X",function(e,t,n){n._d=new Date(parseFloat(e)*1e3)}),A("x",function(e,t,n){n._d=new Date(x(e))});y.version="2.30.1",si($),y.fn=u,y.min=Gl,y.max=jl,y.now=zl,y.utc=he,y.unix=bc,y.months=Nc,y.isDate=qe,y.locale=Te,y.invalid=pt,y.duration=de,y.isMoment=ie,y.weekdays=Mc,y.parseZone=vc,y.localeData=ve,y.isDuration=Et,y.monthsShort=Cc,y.weekdaysMin=Oc,y.defineLocale=Nn,y.updateLocale=vl,y.locales=Nl,y.weekdaysShort=Sc,y.normalizeUnits=ae,y.relativeTimeRounding=eu,y.relativeTimeThreshold=tu,y.calendarFormat=gd,y.prototype=u,y.HTML5_FMT={DATETIME_LOCAL:"YYYY-MM-DDTHH:mm",DATETIME_LOCAL_SECONDS:"YYYY-MM-DDTHH:mm:ss",DATETIME_LOCAL_MS:"YYYY-MM-DDTHH:mm:ss.SSS",DATE:"YYYY-MM-DD",TIME:"HH:mm",TIME_SECONDS:"HH:mm:ss",TIME_MS:"HH:mm:ss.SSS",WEEK:"GGGG-[W]WW",MONTH:"YYYY-MM"};const su="code-graph",au=(e,t="",n="json")=>{const s=document.createElement("a");s.setAttribute("href",`data:text/${n};charset=UTF-8,${encodeURIComponent(e)}`);const a=y().format("YYMMDD_HHMMSS");s.setAttribute("download",`${su}_${a}_${t}.${n}`),s.style.display="none",document.body.appendChild(s),s.click(),document.body.removeChild(s)},ru=(e="json")=>{const t=document.createElement("input");return t.setAttribute("type","file"),t.setAttribute("id","fileElem"),t.setAttribute("multiple","true"),t.setAttribute("accept",`${e}/*`),t.style.display="none",document.body.appendChild(t),t.click(),t},Vn="CLEAR_ALL",Ln="DOWNLOAD_EDITOR_STATE",Oa="RUN_ENGINE",An="TOGGLE_MINIMAP",Un="TOGGLE_PALETTE",Wn="UPLOAD_EDITOR_STATE",Ea=(e,t,n)=>{const s=n.zoomToFit.paddingLeft;t.registerCommand(Vn,{execute:()=>{t.executeCommand(S.Commands.CLEAR_CLIPBOARD_COMMAND),t.executeCommand(S.Commands.CLEAR_HISTORY_COMMAND),e.value.clear(),e.value.editor.code.clear()},canExecute:()=>e.value.nodes.length>0}),t.registerCommand(Ln,{execute:()=>{const a=e.value.editor.save();au(JSON.stringify(a,null,2),e.value.shortId)},canExecute:()=>e.value.nodes.length>0}),t.registerCommand(Un,{execute:()=>{n.palette.enabled=!n.palette.enabled,n.zoomToFit.paddingLeft=n.palette.enabled?s:50},canExecute:()=>!0}),t.registerCommand(An,{execute:()=>n.enableMinimap=!n.enableMinimap,canExecute:()=>e.value.nodes.length>1}),t.registerCommand(Wn,{execute:()=>{const a=ru();a.addEventListener("change",()=>{document.body.removeChild(a);const o=a.files;if(!o||o.length<=0)return!1;const i=new FileReader;i.onload=l=>{if(l.target?.result){const d=l.target.result;if(d.length===0)return;const c=JSON.parse(d);e.value.editor.load(c),e.value.code?.engine?.runOnce(null)}},i.readAsText(o.item(0))})},canExecute:()=>!0})},Ta=e=>{const t={command:Vn,title:"Clear all",icon:r.computed(()=>ds)},n={command:Ln,title:"Download editor state",icon:r.computed(()=>ns)},s={command:An,title:"Toggle minimap",icon:r.computed(()=>e.enableMinimap?us:cs)},a={command:Un,title:"Toggle palette",icon:r.computed(()=>e.palette.enabled?ss:as)},o={command:Wn,title:"Upload editor state",icon:r.computed(()=>fs)};e.toolbar.commands=[a,t,o,n,...S.DEFAULT_TOOLBAR_COMMANDS,s]},Ia=(e,t,n)=>{n.registerCommand(Oa,{execute:()=>t.runOnce(null),canExecute:()=>e.nodes.length>0})};function Da(e){const t=Symbol("CodeEngineToken");e.engine=new Ts(e.editor),Ia(e.editor.graph,e.engine,e.commandHandler),e.loadEditor=n=>{e.engine?.pause(),e.displayedGraph.clear(),e.editor.load(n),e.commandHandler.executeCommand(S.Commands.CLEAR_CLIPBOARD_COMMAND),e.commandHandler.executeCommand(S.Commands.CLEAR_HISTORY_COMMAND),e.engine?.resume(),e.engine?.runOnce(null)},e.newGraph=()=>{e.engine?.pause(),e.displayedGraph.clear(),e.commandHandler.executeCommand(S.Commands.CLEAR_CLIPBOARD_COMMAND),e.commandHandler.executeCommand(S.Commands.CLEAR_HISTORY_COMMAND),e.displayedGraph.id=De.v4(),e.engine?.resume(),e.engine?.runOnce(null)},e.subscribe=()=>{e.displayedGraph.events.addConnection.subscribe(t,n=>{const s=e.displayedGraph.findNodeById(n.to.nodeId);s&&s.isCodeNode&&s.onConnected();const a=e.displayedGraph.findNodeById(n.from.nodeId);a&&a.isCodeNode&&a.onConnected()}),e.displayedGraph.events.removeConnection.subscribe(t,n=>{const s=e.displayedGraph.findNodeById(n.to.nodeId);s&&s.isCodeNode&&s.onUnconnected();const a=e.displayedGraph.findNodeById(n.from.nodeId);a&&a.isCodeNode&&a.onUnconnected()}),e.engine?.events.beforeRun.subscribe(t,()=>{e.displayedGraph.onUpdate(),e.engine?.pause(),e.displayedGraph.sortNodes(),e.engine?.resume()}),e.engine?.events.afterRun.subscribe(t,n=>{e.engine?.pause(),ue.applyResult(n,e.editor),e.code.state.lockCode||e.code.renderCode({nodes:e.editor.graph.scriptedCodeNodes,modules:e.editor.code.modules}),e.engine?.resume()})},e.unsubscribe=()=>{e.displayedGraph.events.addConnection.unsubscribe(t),e.displayedGraph.events.removeConnection.unsubscribe(t),e.engine?.events.beforeRun.unsubscribe(t),e.engine?.events.afterRun.unsubscribe(t)}}const Pt=350;class ot extends Z.Graph{code=null;editor;_state=r.reactive({codeTemplate:"{{ #nodes }}{{ script }}{{ /nodes }}",lockCode:!1});constructor(t,n){super(t,n),this.editor=t,this.template=n,t.code&&(this.code=t.code)}get codeNodes(){return $n(this)}get connections(){return super.connections}set connections(t){this._connections=t}get nodeIds(){return this.nodes.map(t=>t.id)}get nodes(){return super.nodes}set nodes(t){this._nodes=t}get scriptedCodeNodes(){return this.nodes.filter(t=>!t.state?.integrated)}get shortId(){return this.id.slice(0,6)}get state(){return this._state}get visibleNodes(){return this.nodes.filter(t=>!t.state?.hidden)}addNode(t,n){return t.state&&n&&(t.state.props=n),super.addNode(t)}addNodeAtCoordinates=(t,n={x:0,y:0},s)=>(this.addNode(t,s),t.position&&(t.position=n),t);addConnection(t,n){t&&t?.name!=="_code"&&(t.hidden=!1),n&&n?.name!=="_code"&&(n.hidden=!1),super.addConnection(t,n)}clear(){this.selectedNodes=[],this._nodes=[],this._connections=[]}findNodeByType(t){return this.nodes.find(n=>n.type===t)}getNodesByType(t){return this.nodes.filter(n=>n.type===t)}getNodesByVariableName(t){return this.nodes.filter(n=>n.state?.variableName===t)}hasConnection(t,n){return this.connections.some(s=>s.from.id===t.id&&s.to.id===n.id)}load(t){const n=super.load(t);return this.nodes.forEach(s=>s.afterGraphLoaded()),n}onUpdate(){this.nodes.forEach(t=>t.onGraphUpdate())}renderCode(t){return Ve.render(this.state?.codeTemplate||"",t)}sortNodes(){if(!(this.nodes.length===0||this.connections.length===0))try{let t=this.nodeIds;const n=this.connections.filter(o=>t.includes(o.to.nodeId)&&t.includes(o.from.nodeId)).map(o=>[o.to.nodeId,o.from.nodeId]);t.reverse(),t=Aa.array(t,n),t.reverse();const s=this.nodes.map(o=>o.id).filter(o=>!t.includes(o));t=[...t,...s];const a=t.map(o=>this.findNodeById(o));a&&(this.nodes=a)}catch{console.warn("Failed to sort nodes.")}}}const $n=e=>{const t=[];return e.nodes.length===0||e.nodes.forEach(n=>{n&&(n.hasOwnProperty("subgraph")?t.push(...$n(n.subgraph)):n.hasOwnProperty("isCodeNode")&&t.push(n))}),t},ou=(e=0,t=100)=>({x:e*(Pt+70),y:t}),iu=e=>{const t={...e.position};return t.x-=Pt+70,t.y+=50,t},Hn="__baklava_SubgraphInputNode",Fn="__baklava_SubgraphOutputNode";class xa extends ut{graphInterfaceId;constructor(){super(),this.graphInterfaceId=De.v4()}onPlaced(){super.onPlaced(),this.initializeIo()}load(t){super.load(t),this.graphInterfaceId=t.graphInterfaceId}save(){return{...super.save(),graphInterfaceId:this.graphInterfaceId}}update(){}}class Gn extends xa{static isGraphInputNode(t){return t.type===Hn}type=Hn;inputs={name:new Z.NodeInterface("Name","Input")};outputs={placeholder:new Z.NodeInterface("Value",void 0)}}class jn extends xa{static isGraphOutputNode(t){return t.type===Fn}type=Fn;inputs={name:new Z.NodeInterface("Name","Output"),placeholder:new Z.NodeInterface("Value",void 0)};outputs={output:new Z.NodeInterface("Output",void 0).setHidden(!0)};calculate=({placeholder:t})=>({output:t})}const lu=["component","connectionCount","events","hidden","hooks","id","isCodeNode","isInput","name","nodeId","port","templateId","value"];function Ya(e){return class extends jt{type=Z.getGraphNodeTypeString(e);get title(){return this._title}set title(n){this.template.name=n}inputs={};outputs={};template=e;subgraph;update(){}onConnected(){}onUnconnected(){}calculate=async(n,s)=>{if(!this.subgraph)throw new Error(`GraphNode ${this.id}: calculate called without subgraph being initialized`);if(!s.engine||typeof s.engine!="object")throw new Error(`GraphNode ${this.id}: calculate called but no engine provided in context`);const a=s.engine.getInputValues(this.subgraph);for(const l of this.subgraph.inputs)a.set(l.nodeInterfaceId,n[l.id]);const o=await s.engine.runGraph(this.subgraph,a,s.globalValues);s.engine.pause(),ue.applyResult(o,s.engine.editor),s.engine.resume();const i={};for(const l of this.subgraph.outputs)i[l.id]=o.get(l.nodeId)?.get("output");return i._calculationResults=o,this.lockCode||(i._code=this.renderCode({inputs:n,...s.globalValues})),this.updateOutputValues(i),i};load(n){if(!this.subgraph)throw new Error("Cannot load a graph node without a graph");if(!this.template)throw new Error("Unable to load graph node without graph template");this.subgraph.load(n.graphState),super.load(n)}save(){if(!this.subgraph)throw new Error("Cannot save a graph node without a graph");return{...super.save(),graphState:this.subgraph.save()}}onPlaced(){this.template.events.updated.subscribe(this,()=>this.initialize()),this.template.events.nameChanged.subscribe(this,n=>{this._title=n}),this.initialize()}onDestroy(){this.template.events.updated.unsubscribe(this),this.template.events.nameChanged.unsubscribe(this),this.subgraph?.destroy()}initialize(){this.subgraph&&this.subgraph.destroy(),this.subgraph=this.template.createGraph(),this._title=this.template.name,this.updateInterfaces(),this.state.codeTemplate=`{{ #nodes }}{{ script }}
|
|
7
|
-
{{ /nodes }}`,this.events.update.emit(null)}renderCode(n){return this.subgraph?this.subgraph.renderCode({nodes:this.subgraph.scriptedCodeNodes}):
|
|
6
|
+
`+new Error().stack),n=!1}return t.apply(this,arguments)},t)}var Ds={};function xs(e,t){_.deprecationHandler!=null&&_.deprecationHandler(e,t),Ds[e]||(Is(t),Ds[e]=!0)}_.suppressDeprecationWarnings=!1,_.deprecationHandler=null;function pe(e){return typeof Function<"u"&&e instanceof Function||Object.prototype.toString.call(e)==="[object Function]"}function oi(e){var t,n;for(n in e)P(e,n)&&(t=e[n],pe(t)?this[n]=t:this["_"+n]=t);this._config=e,this._dayOfMonthOrdinalParseLenient=new RegExp((this._dayOfMonthOrdinalParse.source||this._ordinalParse.source)+"|"+/\d{1,2}/.source)}function cn(e,t){var n=Te({},e),s;for(s in t)P(t,s)&&(Ye(e[s])&&Ye(t[s])?(n[s]={},Te(n[s],e[s]),Te(n[s],t[s])):t[s]!=null?n[s]=t[s]:delete n[s]);for(s in e)P(e,s)&&!P(t,s)&&Ye(e[s])&&(n[s]=Te({},n[s]));return n}function un(e){e!=null&&this.set(e)}var hn;Object.keys?hn=Object.keys:hn=function(e){var t,n=[];for(t in e)P(e,t)&&n.push(t);return n};var ii={sameDay:"[Today at] LT",nextDay:"[Tomorrow at] LT",nextWeek:"dddd [at] LT",lastDay:"[Yesterday at] LT",lastWeek:"[Last] dddd [at] LT",sameElse:"L"};function li(e,t,n){var s=this._calendar[e]||this._calendar.sameElse;return pe(s)?s.call(t,n):s}function me(e,t,n){var s=""+Math.abs(e),a=t-s.length,o=e>=0;return(o?n?"+":"":"-")+Math.pow(10,Math.max(0,a)).toString().substr(1)+s}var fn=/(\[[^\[]*\])|(\\)?([Hh]mm(ss)?|Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|W[o|W]?|Qo?|N{1,5}|YYYYYY|YYYYY|YYYY|YY|y{2,4}|yo?|gg(ggg?)?|GG(GGG?)?|e|E|a|A|hh?|HH?|kk?|mm?|ss?|S{1,9}|x|X|zz?|ZZ?|.)/g,_t=/(\[[^\[]*\])|(\\)?(LTS|LT|LL?L?L?|l{1,4})/g,pn={},Ue={};function C(e,t,n,s){var a=s;typeof s=="string"&&(a=function(){return this[s]()}),e&&(Ue[e]=a),t&&(Ue[t[0]]=function(){return me(a.apply(this,arguments),t[1],t[2])}),n&&(Ue[n]=function(){return this.localeData().ordinal(a.apply(this,arguments),e)})}function di(e){return e.match(/\[[\s\S]/)?e.replace(/^\[|\]$/g,""):e.replace(/\\/g,"")}function ci(e){var t=e.match(fn),n,s;for(n=0,s=t.length;n<s;n++)Ue[t[n]]?t[n]=Ue[t[n]]:t[n]=di(t[n]);return function(a){var o="",i;for(i=0;i<s;i++)o+=pe(t[i])?t[i].call(a,e):t[i];return o}}function yt(e,t){return e.isValid()?(t=Ys(t,e.localeData()),pn[t]=pn[t]||ci(t),pn[t](e)):e.localeData().invalidDate()}function Ys(e,t){var n=5;function s(a){return t.longDateFormat(a)||a}for(_t.lastIndex=0;n>=0&&_t.test(e);)e=e.replace(_t,s),_t.lastIndex=0,n-=1;return e}var ui={LTS:"h:mm:ss A",LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY h:mm A",LLLL:"dddd, MMMM D, YYYY h:mm A"};function hi(e){var t=this._longDateFormat[e],n=this._longDateFormat[e.toUpperCase()];return t||!n?t:(this._longDateFormat[e]=n.match(fn).map(function(s){return s==="MMMM"||s==="MM"||s==="DD"||s==="dddd"?s.slice(1):s}).join(""),this._longDateFormat[e])}var fi="Invalid date";function pi(){return this._invalidDate}var mi="%d",_i=/\d{1,2}/;function yi(e){return this._ordinal.replace("%d",e)}var gi={future:"in %s",past:"%s ago",s:"a few seconds",ss:"%d seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",w:"a week",ww:"%d weeks",M:"a month",MM:"%d months",y:"a year",yy:"%d years"};function ki(e,t,n,s){var a=this._relativeTime[n];return pe(a)?a(e,t,n,s):a.replace(/%d/i,e)}function bi(e,t){var n=this._relativeTime[e>0?"future":"past"];return pe(n)?n(t):n.replace(/%s/i,t)}var Rs={D:"date",dates:"date",date:"date",d:"day",days:"day",day:"day",e:"weekday",weekdays:"weekday",weekday:"weekday",E:"isoWeekday",isoweekdays:"isoWeekday",isoweekday:"isoWeekday",DDD:"dayOfYear",dayofyears:"dayOfYear",dayofyear:"dayOfYear",h:"hour",hours:"hour",hour:"hour",ms:"millisecond",milliseconds:"millisecond",millisecond:"millisecond",m:"minute",minutes:"minute",minute:"minute",M:"month",months:"month",month:"month",Q:"quarter",quarters:"quarter",quarter:"quarter",s:"second",seconds:"second",second:"second",gg:"weekYear",weekyears:"weekYear",weekyear:"weekYear",GG:"isoWeekYear",isoweekyears:"isoWeekYear",isoweekyear:"isoWeekYear",w:"week",weeks:"week",week:"week",W:"isoWeek",isoweeks:"isoWeek",isoweek:"isoWeek",y:"year",years:"year",year:"year"};function re(e){return typeof e=="string"?Rs[e]||Rs[e.toLowerCase()]:void 0}function mn(e){var t={},n,s;for(s in e)P(e,s)&&(n=re(s),n&&(t[n]=e[s]));return t}var wi={date:9,day:11,weekday:11,isoWeekday:11,dayOfYear:4,hour:13,millisecond:16,minute:14,month:8,quarter:7,second:15,weekYear:1,isoWeekYear:1,week:5,isoWeek:5,year:1};function vi(e){var t=[],n;for(n in e)P(e,n)&&t.push({unit:n,priority:wi[n]});return t.sort(function(s,a){return s.priority-a.priority}),t}var Ps=/\d/,ne=/\d\d/,Bs=/\d{3}/,_n=/\d{4}/,gt=/[+-]?\d{6}/,$=/\d\d?/,Vs=/\d\d\d\d?/,Ls=/\d\d\d\d\d\d?/,kt=/\d{1,3}/,yn=/\d{1,4}/,bt=/[+-]?\d{1,6}/,$e=/\d+/,wt=/[+-]?\d+/,Ni=/Z|[+-]\d\d:?\d\d/gi,vt=/Z|[+-]\d\d(?::?\d\d)?/gi,Ci=/[+-]?\d+(\.\d{1,3})?/,Ke=/[0-9]{0,256}['a-z\u00A0-\u05FF\u0700-\uD7FF\uF900-\uFDCF\uFDF0-\uFF07\uFF10-\uFFEF]{1,256}|[\u0600-\u06FF\/]{1,256}(\s*?[\u0600-\u06FF]{1,256}){1,2}/i,We=/^[1-9]\d?/,gn=/^([1-9]\d|\d)/,Nt;Nt={};function y(e,t,n){Nt[e]=pe(t)?t:function(s,a){return s&&n?n:t}}function Mi(e,t){return P(Nt,e)?Nt[e](t._strict,t._locale):new RegExp(Si(e))}function Si(e){return ke(e.replace("\\","").replace(/\\(\[)|\\(\])|\[([^\]\[]*)\]|\\(.)/g,function(t,n,s,a,o){return n||s||a||o}))}function ke(e){return e.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&")}function oe(e){return e<0?Math.ceil(e)||0:Math.floor(e)}function x(e){var t=+e,n=0;return t!==0&&isFinite(t)&&(n=oe(t)),n}var kn={};function L(e,t){var n,s=t,a;for(typeof e=="string"&&(e=[e]),ge(t)&&(s=function(o,i){i[t]=x(o)}),a=e.length,n=0;n<a;n++)kn[e[n]]=s}function Qe(e,t){L(e,function(n,s,a,o){a._w=a._w||{},t(n,a._w,a,o)})}function Oi(e,t,n){t!=null&&P(kn,e)&&kn[e](t,n._a,n,e)}function Ct(e){return e%4===0&&e%100!==0||e%400===0}var K=0,be=1,_e=2,J=3,de=4,we=5,Re=6,Ei=7,Ti=8;C("Y",0,0,function(){var e=this.year();return e<=9999?me(e,4):"+"+e}),C(0,["YY",2],0,function(){return this.year()%100}),C(0,["YYYY",4],0,"year"),C(0,["YYYYY",5],0,"year"),C(0,["YYYYYY",6,!0],0,"year"),y("Y",wt),y("YY",$,ne),y("YYYY",yn,_n),y("YYYYY",bt,gt),y("YYYYYY",bt,gt),L(["YYYYY","YYYYYY"],K),L("YYYY",function(e,t){t[K]=e.length===2?_.parseTwoDigitYear(e):x(e)}),L("YY",function(e,t){t[K]=_.parseTwoDigitYear(e)}),L("Y",function(e,t){t[K]=parseInt(e,10)});function et(e){return Ct(e)?366:365}_.parseTwoDigitYear=function(e){return x(e)+(x(e)>68?1900:2e3)};var As=He("FullYear",!0);function Ii(){return Ct(this.year())}function He(e,t){return function(n){return n!=null?(Us(this,e,n),_.updateOffset(this,t),this):tt(this,e)}}function tt(e,t){if(!e.isValid())return NaN;var n=e._d,s=e._isUTC;switch(t){case"Milliseconds":return s?n.getUTCMilliseconds():n.getMilliseconds();case"Seconds":return s?n.getUTCSeconds():n.getSeconds();case"Minutes":return s?n.getUTCMinutes():n.getMinutes();case"Hours":return s?n.getUTCHours():n.getHours();case"Date":return s?n.getUTCDate():n.getDate();case"Day":return s?n.getUTCDay():n.getDay();case"Month":return s?n.getUTCMonth():n.getMonth();case"FullYear":return s?n.getUTCFullYear():n.getFullYear();default:return NaN}}function Us(e,t,n){var s,a,o,i,l;if(!(!e.isValid()||isNaN(n))){switch(s=e._d,a=e._isUTC,t){case"Milliseconds":return void(a?s.setUTCMilliseconds(n):s.setMilliseconds(n));case"Seconds":return void(a?s.setUTCSeconds(n):s.setSeconds(n));case"Minutes":return void(a?s.setUTCMinutes(n):s.setMinutes(n));case"Hours":return void(a?s.setUTCHours(n):s.setHours(n));case"Date":return void(a?s.setUTCDate(n):s.setDate(n));case"FullYear":break;default:return}o=n,i=e.month(),l=e.date(),l=l===29&&i===1&&!Ct(o)?28:l,a?s.setUTCFullYear(o,i,l):s.setFullYear(o,i,l)}}function Di(e){return e=re(e),pe(this[e])?this[e]():this}function xi(e,t){if(typeof e=="object"){e=mn(e);var n=vi(e),s,a=n.length;for(s=0;s<a;s++)this[n[s].unit](e[n[s].unit])}else if(e=re(e),pe(this[e]))return this[e](t);return this}function Yi(e,t){return(e%t+t)%t}var Z;Array.prototype.indexOf?Z=Array.prototype.indexOf:Z=function(e){var t;for(t=0;t<this.length;++t)if(this[t]===e)return t;return-1};function bn(e,t){if(isNaN(e)||isNaN(t))return NaN;var n=Yi(t,12);return e+=(t-n)/12,n===1?Ct(e)?29:28:31-n%7%2}C("M",["MM",2],"Mo",function(){return this.month()+1}),C("MMM",0,0,function(e){return this.localeData().monthsShort(this,e)}),C("MMMM",0,0,function(e){return this.localeData().months(this,e)}),y("M",$,We),y("MM",$,ne),y("MMM",function(e,t){return t.monthsShortRegex(e)}),y("MMMM",function(e,t){return t.monthsRegex(e)}),L(["M","MM"],function(e,t){t[be]=x(e)-1}),L(["MMM","MMMM"],function(e,t,n,s){var a=n._locale.monthsParse(e,s,n._strict);a!=null?t[be]=a:T(n).invalidMonth=e});var Ri="January_February_March_April_May_June_July_August_September_October_November_December".split("_"),$s="Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec".split("_"),Ws=/D[oD]?(\[[^\[\]]*\]|\s)+MMMM?/,Pi=Ke,Bi=Ke;function Vi(e,t){return e?ie(this._months)?this._months[e.month()]:this._months[(this._months.isFormat||Ws).test(t)?"format":"standalone"][e.month()]:ie(this._months)?this._months:this._months.standalone}function Li(e,t){return e?ie(this._monthsShort)?this._monthsShort[e.month()]:this._monthsShort[Ws.test(t)?"format":"standalone"][e.month()]:ie(this._monthsShort)?this._monthsShort:this._monthsShort.standalone}function Ai(e,t,n){var s,a,o,i=e.toLocaleLowerCase();if(!this._monthsParse)for(this._monthsParse=[],this._longMonthsParse=[],this._shortMonthsParse=[],s=0;s<12;++s)o=fe([2e3,s]),this._shortMonthsParse[s]=this.monthsShort(o,"").toLocaleLowerCase(),this._longMonthsParse[s]=this.months(o,"").toLocaleLowerCase();return n?t==="MMM"?(a=Z.call(this._shortMonthsParse,i),a!==-1?a:null):(a=Z.call(this._longMonthsParse,i),a!==-1?a:null):t==="MMM"?(a=Z.call(this._shortMonthsParse,i),a!==-1?a:(a=Z.call(this._longMonthsParse,i),a!==-1?a:null)):(a=Z.call(this._longMonthsParse,i),a!==-1?a:(a=Z.call(this._shortMonthsParse,i),a!==-1?a:null))}function Ui(e,t,n){var s,a,o;if(this._monthsParseExact)return Ai.call(this,e,t,n);for(this._monthsParse||(this._monthsParse=[],this._longMonthsParse=[],this._shortMonthsParse=[]),s=0;s<12;s++){if(a=fe([2e3,s]),n&&!this._longMonthsParse[s]&&(this._longMonthsParse[s]=new RegExp("^"+this.months(a,"").replace(".","")+"$","i"),this._shortMonthsParse[s]=new RegExp("^"+this.monthsShort(a,"").replace(".","")+"$","i")),!n&&!this._monthsParse[s]&&(o="^"+this.months(a,"")+"|^"+this.monthsShort(a,""),this._monthsParse[s]=new RegExp(o.replace(".",""),"i")),n&&t==="MMMM"&&this._longMonthsParse[s].test(e))return s;if(n&&t==="MMM"&&this._shortMonthsParse[s].test(e))return s;if(!n&&this._monthsParse[s].test(e))return s}}function Hs(e,t){if(!e.isValid())return e;if(typeof t=="string"){if(/^\d+$/.test(t))t=x(t);else if(t=e.localeData().monthsParse(t),!ge(t))return e}var n=t,s=e.date();return s=s<29?s:Math.min(s,bn(e.year(),n)),e._isUTC?e._d.setUTCMonth(n,s):e._d.setMonth(n,s),e}function Fs(e){return e!=null?(Hs(this,e),_.updateOffset(this,!0),this):tt(this,"Month")}function $i(){return bn(this.year(),this.month())}function Wi(e){return this._monthsParseExact?(P(this,"_monthsRegex")||Gs.call(this),e?this._monthsShortStrictRegex:this._monthsShortRegex):(P(this,"_monthsShortRegex")||(this._monthsShortRegex=Pi),this._monthsShortStrictRegex&&e?this._monthsShortStrictRegex:this._monthsShortRegex)}function Hi(e){return this._monthsParseExact?(P(this,"_monthsRegex")||Gs.call(this),e?this._monthsStrictRegex:this._monthsRegex):(P(this,"_monthsRegex")||(this._monthsRegex=Bi),this._monthsStrictRegex&&e?this._monthsStrictRegex:this._monthsRegex)}function Gs(){function e(d,c){return c.length-d.length}var t=[],n=[],s=[],a,o,i,l;for(a=0;a<12;a++)o=fe([2e3,a]),i=ke(this.monthsShort(o,"")),l=ke(this.months(o,"")),t.push(i),n.push(l),s.push(l),s.push(i);t.sort(e),n.sort(e),s.sort(e),this._monthsRegex=new RegExp("^("+s.join("|")+")","i"),this._monthsShortRegex=this._monthsRegex,this._monthsStrictRegex=new RegExp("^("+n.join("|")+")","i"),this._monthsShortStrictRegex=new RegExp("^("+t.join("|")+")","i")}function Fi(e,t,n,s,a,o,i){var l;return e<100&&e>=0?(l=new Date(e+400,t,n,s,a,o,i),isFinite(l.getFullYear())&&l.setFullYear(e)):l=new Date(e,t,n,s,a,o,i),l}function nt(e){var t,n;return e<100&&e>=0?(n=Array.prototype.slice.call(arguments),n[0]=e+400,t=new Date(Date.UTC.apply(null,n)),isFinite(t.getUTCFullYear())&&t.setUTCFullYear(e)):t=new Date(Date.UTC.apply(null,arguments)),t}function Mt(e,t,n){var s=7+t-n,a=(7+nt(e,0,s).getUTCDay()-t)%7;return-a+s-1}function js(e,t,n,s,a){var o=(7+n-s)%7,i=Mt(e,s,a),l=1+7*(t-1)+o+i,d,c;return l<=0?(d=e-1,c=et(d)+l):l>et(e)?(d=e+1,c=l-et(e)):(d=e,c=l),{year:d,dayOfYear:c}}function st(e,t,n){var s=Mt(e.year(),t,n),a=Math.floor((e.dayOfYear()-s-1)/7)+1,o,i;return a<1?(i=e.year()-1,o=a+ve(i,t,n)):a>ve(e.year(),t,n)?(o=a-ve(e.year(),t,n),i=e.year()+1):(i=e.year(),o=a),{week:o,year:i}}function ve(e,t,n){var s=Mt(e,t,n),a=Mt(e+1,t,n);return(et(e)-s+a)/7}C("w",["ww",2],"wo","week"),C("W",["WW",2],"Wo","isoWeek"),y("w",$,We),y("ww",$,ne),y("W",$,We),y("WW",$,ne),Qe(["w","ww","W","WW"],function(e,t,n,s){t[s.substr(0,1)]=x(e)});function Gi(e){return st(e,this._week.dow,this._week.doy).week}var ji={dow:0,doy:6};function zi(){return this._week.dow}function Zi(){return this._week.doy}function qi(e){var t=this.localeData().week(this);return e==null?t:this.add((e-t)*7,"d")}function Ji(e){var t=st(this,1,4).week;return e==null?t:this.add((e-t)*7,"d")}C("d",0,"do","day"),C("dd",0,0,function(e){return this.localeData().weekdaysMin(this,e)}),C("ddd",0,0,function(e){return this.localeData().weekdaysShort(this,e)}),C("dddd",0,0,function(e){return this.localeData().weekdays(this,e)}),C("e",0,0,"weekday"),C("E",0,0,"isoWeekday"),y("d",$),y("e",$),y("E",$),y("dd",function(e,t){return t.weekdaysMinRegex(e)}),y("ddd",function(e,t){return t.weekdaysShortRegex(e)}),y("dddd",function(e,t){return t.weekdaysRegex(e)}),Qe(["dd","ddd","dddd"],function(e,t,n,s){var a=n._locale.weekdaysParse(e,s,n._strict);a!=null?t.d=a:T(n).invalidWeekday=e}),Qe(["d","e","E"],function(e,t,n,s){t[s]=x(e)});function Xi(e,t){return typeof e!="string"?e:isNaN(e)?(e=t.weekdaysParse(e),typeof e=="number"?e:null):parseInt(e,10)}function Ki(e,t){return typeof e=="string"?t.weekdaysParse(e)%7||7:isNaN(e)?null:e}function wn(e,t){return e.slice(t,7).concat(e.slice(0,t))}var Qi="Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),zs="Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_"),el="Su_Mo_Tu_We_Th_Fr_Sa".split("_"),tl=Ke,nl=Ke,sl=Ke;function al(e,t){var n=ie(this._weekdays)?this._weekdays:this._weekdays[e&&e!==!0&&this._weekdays.isFormat.test(t)?"format":"standalone"];return e===!0?wn(n,this._week.dow):e?n[e.day()]:n}function rl(e){return e===!0?wn(this._weekdaysShort,this._week.dow):e?this._weekdaysShort[e.day()]:this._weekdaysShort}function ol(e){return e===!0?wn(this._weekdaysMin,this._week.dow):e?this._weekdaysMin[e.day()]:this._weekdaysMin}function il(e,t,n){var s,a,o,i=e.toLocaleLowerCase();if(!this._weekdaysParse)for(this._weekdaysParse=[],this._shortWeekdaysParse=[],this._minWeekdaysParse=[],s=0;s<7;++s)o=fe([2e3,1]).day(s),this._minWeekdaysParse[s]=this.weekdaysMin(o,"").toLocaleLowerCase(),this._shortWeekdaysParse[s]=this.weekdaysShort(o,"").toLocaleLowerCase(),this._weekdaysParse[s]=this.weekdays(o,"").toLocaleLowerCase();return n?t==="dddd"?(a=Z.call(this._weekdaysParse,i),a!==-1?a:null):t==="ddd"?(a=Z.call(this._shortWeekdaysParse,i),a!==-1?a:null):(a=Z.call(this._minWeekdaysParse,i),a!==-1?a:null):t==="dddd"?(a=Z.call(this._weekdaysParse,i),a!==-1||(a=Z.call(this._shortWeekdaysParse,i),a!==-1)?a:(a=Z.call(this._minWeekdaysParse,i),a!==-1?a:null)):t==="ddd"?(a=Z.call(this._shortWeekdaysParse,i),a!==-1||(a=Z.call(this._weekdaysParse,i),a!==-1)?a:(a=Z.call(this._minWeekdaysParse,i),a!==-1?a:null)):(a=Z.call(this._minWeekdaysParse,i),a!==-1||(a=Z.call(this._weekdaysParse,i),a!==-1)?a:(a=Z.call(this._shortWeekdaysParse,i),a!==-1?a:null))}function ll(e,t,n){var s,a,o;if(this._weekdaysParseExact)return il.call(this,e,t,n);for(this._weekdaysParse||(this._weekdaysParse=[],this._minWeekdaysParse=[],this._shortWeekdaysParse=[],this._fullWeekdaysParse=[]),s=0;s<7;s++){if(a=fe([2e3,1]).day(s),n&&!this._fullWeekdaysParse[s]&&(this._fullWeekdaysParse[s]=new RegExp("^"+this.weekdays(a,"").replace(".","\\.?")+"$","i"),this._shortWeekdaysParse[s]=new RegExp("^"+this.weekdaysShort(a,"").replace(".","\\.?")+"$","i"),this._minWeekdaysParse[s]=new RegExp("^"+this.weekdaysMin(a,"").replace(".","\\.?")+"$","i")),this._weekdaysParse[s]||(o="^"+this.weekdays(a,"")+"|^"+this.weekdaysShort(a,"")+"|^"+this.weekdaysMin(a,""),this._weekdaysParse[s]=new RegExp(o.replace(".",""),"i")),n&&t==="dddd"&&this._fullWeekdaysParse[s].test(e))return s;if(n&&t==="ddd"&&this._shortWeekdaysParse[s].test(e))return s;if(n&&t==="dd"&&this._minWeekdaysParse[s].test(e))return s;if(!n&&this._weekdaysParse[s].test(e))return s}}function dl(e){if(!this.isValid())return e!=null?this:NaN;var t=tt(this,"Day");return e!=null?(e=Xi(e,this.localeData()),this.add(e-t,"d")):t}function cl(e){if(!this.isValid())return e!=null?this:NaN;var t=(this.day()+7-this.localeData()._week.dow)%7;return e==null?t:this.add(e-t,"d")}function ul(e){if(!this.isValid())return e!=null?this:NaN;if(e!=null){var t=Ki(e,this.localeData());return this.day(this.day()%7?t:t-7)}else return this.day()||7}function hl(e){return this._weekdaysParseExact?(P(this,"_weekdaysRegex")||vn.call(this),e?this._weekdaysStrictRegex:this._weekdaysRegex):(P(this,"_weekdaysRegex")||(this._weekdaysRegex=tl),this._weekdaysStrictRegex&&e?this._weekdaysStrictRegex:this._weekdaysRegex)}function fl(e){return this._weekdaysParseExact?(P(this,"_weekdaysRegex")||vn.call(this),e?this._weekdaysShortStrictRegex:this._weekdaysShortRegex):(P(this,"_weekdaysShortRegex")||(this._weekdaysShortRegex=nl),this._weekdaysShortStrictRegex&&e?this._weekdaysShortStrictRegex:this._weekdaysShortRegex)}function pl(e){return this._weekdaysParseExact?(P(this,"_weekdaysRegex")||vn.call(this),e?this._weekdaysMinStrictRegex:this._weekdaysMinRegex):(P(this,"_weekdaysMinRegex")||(this._weekdaysMinRegex=sl),this._weekdaysMinStrictRegex&&e?this._weekdaysMinStrictRegex:this._weekdaysMinRegex)}function vn(){function e(h,b){return b.length-h.length}var t=[],n=[],s=[],a=[],o,i,l,d,c;for(o=0;o<7;o++)i=fe([2e3,1]).day(o),l=ke(this.weekdaysMin(i,"")),d=ke(this.weekdaysShort(i,"")),c=ke(this.weekdays(i,"")),t.push(l),n.push(d),s.push(c),a.push(l),a.push(d),a.push(c);t.sort(e),n.sort(e),s.sort(e),a.sort(e),this._weekdaysRegex=new RegExp("^("+a.join("|")+")","i"),this._weekdaysShortRegex=this._weekdaysRegex,this._weekdaysMinRegex=this._weekdaysRegex,this._weekdaysStrictRegex=new RegExp("^("+s.join("|")+")","i"),this._weekdaysShortStrictRegex=new RegExp("^("+n.join("|")+")","i"),this._weekdaysMinStrictRegex=new RegExp("^("+t.join("|")+")","i")}function Nn(){return this.hours()%12||12}function ml(){return this.hours()||24}C("H",["HH",2],0,"hour"),C("h",["hh",2],0,Nn),C("k",["kk",2],0,ml),C("hmm",0,0,function(){return""+Nn.apply(this)+me(this.minutes(),2)}),C("hmmss",0,0,function(){return""+Nn.apply(this)+me(this.minutes(),2)+me(this.seconds(),2)}),C("Hmm",0,0,function(){return""+this.hours()+me(this.minutes(),2)}),C("Hmmss",0,0,function(){return""+this.hours()+me(this.minutes(),2)+me(this.seconds(),2)});function Zs(e,t){C(e,0,0,function(){return this.localeData().meridiem(this.hours(),this.minutes(),t)})}Zs("a",!0),Zs("A",!1);function qs(e,t){return t._meridiemParse}y("a",qs),y("A",qs),y("H",$,gn),y("h",$,We),y("k",$,We),y("HH",$,ne),y("hh",$,ne),y("kk",$,ne),y("hmm",Vs),y("hmmss",Ls),y("Hmm",Vs),y("Hmmss",Ls),L(["H","HH"],J),L(["k","kk"],function(e,t,n){var s=x(e);t[J]=s===24?0:s}),L(["a","A"],function(e,t,n){n._isPm=n._locale.isPM(e),n._meridiem=e}),L(["h","hh"],function(e,t,n){t[J]=x(e),T(n).bigHour=!0}),L("hmm",function(e,t,n){var s=e.length-2;t[J]=x(e.substr(0,s)),t[de]=x(e.substr(s)),T(n).bigHour=!0}),L("hmmss",function(e,t,n){var s=e.length-4,a=e.length-2;t[J]=x(e.substr(0,s)),t[de]=x(e.substr(s,2)),t[we]=x(e.substr(a)),T(n).bigHour=!0}),L("Hmm",function(e,t,n){var s=e.length-2;t[J]=x(e.substr(0,s)),t[de]=x(e.substr(s))}),L("Hmmss",function(e,t,n){var s=e.length-4,a=e.length-2;t[J]=x(e.substr(0,s)),t[de]=x(e.substr(s,2)),t[we]=x(e.substr(a))});function _l(e){return(e+"").toLowerCase().charAt(0)==="p"}var yl=/[ap]\.?m?\.?/i,gl=He("Hours",!0);function kl(e,t,n){return e>11?n?"pm":"PM":n?"am":"AM"}var Js={calendar:ii,longDateFormat:ui,invalidDate:fi,ordinal:mi,dayOfMonthOrdinalParse:_i,relativeTime:gi,months:Ri,monthsShort:$s,week:ji,weekdays:Qi,weekdaysMin:el,weekdaysShort:zs,meridiemParse:yl},F={},at={},rt;function bl(e,t){var n,s=Math.min(e.length,t.length);for(n=0;n<s;n+=1)if(e[n]!==t[n])return n;return s}function Xs(e){return e&&e.toLowerCase().replace("_","-")}function wl(e){for(var t=0,n,s,a,o;t<e.length;){for(o=Xs(e[t]).split("-"),n=o.length,s=Xs(e[t+1]),s=s?s.split("-"):null;n>0;){if(a=St(o.slice(0,n).join("-")),a)return a;if(s&&s.length>=n&&bl(o,s)>=n-1)break;n--}t++}return rt}function vl(e){return!!(e&&e.match("^[^/\\\\]*$"))}function St(e){var t=null,n;if(F[e]===void 0&&typeof module<"u"&&module&&module.exports&&vl(e))try{t=rt._abbr,n=require,n("./locale/"+e),Ie(t)}catch{F[e]=null}return F[e]}function Ie(e,t){var n;return e&&(ee(t)?n=Ne(e):n=Cn(e,t),n?rt=n:typeof console<"u"&&console.warn&&console.warn("Locale "+e+" not found. Did you forget to load it?")),rt._abbr}function Cn(e,t){if(t!==null){var n,s=Js;if(t.abbr=e,F[e]!=null)xs("defineLocaleOverride","use moment.updateLocale(localeName, config) to change an existing locale. moment.defineLocale(localeName, config) should only be used for creating a new locale See http://momentjs.com/guides/#/warnings/define-locale/ for more info."),s=F[e]._config;else if(t.parentLocale!=null)if(F[t.parentLocale]!=null)s=F[t.parentLocale]._config;else if(n=St(t.parentLocale),n!=null)s=n._config;else return at[t.parentLocale]||(at[t.parentLocale]=[]),at[t.parentLocale].push({name:e,config:t}),null;return F[e]=new un(cn(s,t)),at[e]&&at[e].forEach(function(a){Cn(a.name,a.config)}),Ie(e),F[e]}else return delete F[e],null}function Nl(e,t){if(t!=null){var n,s,a=Js;F[e]!=null&&F[e].parentLocale!=null?F[e].set(cn(F[e]._config,t)):(s=St(e),s!=null&&(a=s._config),t=cn(a,t),s==null&&(t.abbr=e),n=new un(t),n.parentLocale=F[e],F[e]=n),Ie(e)}else F[e]!=null&&(F[e].parentLocale!=null?(F[e]=F[e].parentLocale,e===Ie()&&Ie(e)):F[e]!=null&&delete F[e]);return F[e]}function Ne(e){var t;if(e&&e._locale&&e._locale._abbr&&(e=e._locale._abbr),!e)return rt;if(!ie(e)){if(t=St(e),t)return t;e=[e]}return wl(e)}function Cl(){return hn(F)}function Mn(e){var t,n=e._a;return n&&T(e).overflow===-2&&(t=n[be]<0||n[be]>11?be:n[_e]<1||n[_e]>bn(n[K],n[be])?_e:n[J]<0||n[J]>24||n[J]===24&&(n[de]!==0||n[we]!==0||n[Re]!==0)?J:n[de]<0||n[de]>59?de:n[we]<0||n[we]>59?we:n[Re]<0||n[Re]>999?Re:-1,T(e)._overflowDayOfYear&&(t<K||t>_e)&&(t=_e),T(e)._overflowWeeks&&t===-1&&(t=Ei),T(e)._overflowWeekday&&t===-1&&(t=Ti),T(e).overflow=t),e}var Ml=/^\s*((?:[+-]\d{6}|\d{4})-(?:\d\d-\d\d|W\d\d-\d|W\d\d|\d\d\d|\d\d))(?:(T| )(\d\d(?::\d\d(?::\d\d(?:[.,]\d+)?)?)?)([+-]\d\d(?::?\d\d)?|\s*Z)?)?$/,Sl=/^\s*((?:[+-]\d{6}|\d{4})(?:\d\d\d\d|W\d\d\d|W\d\d|\d\d\d|\d\d|))(?:(T| )(\d\d(?:\d\d(?:\d\d(?:[.,]\d+)?)?)?)([+-]\d\d(?::?\d\d)?|\s*Z)?)?$/,Ol=/Z|[+-]\d\d(?::?\d\d)?/,Ot=[["YYYYYY-MM-DD",/[+-]\d{6}-\d\d-\d\d/],["YYYY-MM-DD",/\d{4}-\d\d-\d\d/],["GGGG-[W]WW-E",/\d{4}-W\d\d-\d/],["GGGG-[W]WW",/\d{4}-W\d\d/,!1],["YYYY-DDD",/\d{4}-\d{3}/],["YYYY-MM",/\d{4}-\d\d/,!1],["YYYYYYMMDD",/[+-]\d{10}/],["YYYYMMDD",/\d{8}/],["GGGG[W]WWE",/\d{4}W\d{3}/],["GGGG[W]WW",/\d{4}W\d{2}/,!1],["YYYYDDD",/\d{7}/],["YYYYMM",/\d{6}/,!1],["YYYY",/\d{4}/,!1]],Sn=[["HH:mm:ss.SSSS",/\d\d:\d\d:\d\d\.\d+/],["HH:mm:ss,SSSS",/\d\d:\d\d:\d\d,\d+/],["HH:mm:ss",/\d\d:\d\d:\d\d/],["HH:mm",/\d\d:\d\d/],["HHmmss.SSSS",/\d\d\d\d\d\d\.\d+/],["HHmmss,SSSS",/\d\d\d\d\d\d,\d+/],["HHmmss",/\d\d\d\d\d\d/],["HHmm",/\d\d\d\d/],["HH",/\d\d/]],El=/^\/?Date\((-?\d+)/i,Tl=/^(?:(Mon|Tue|Wed|Thu|Fri|Sat|Sun),?\s)?(\d{1,2})\s(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s(\d{2,4})\s(\d\d):(\d\d)(?::(\d\d))?\s(?:(UT|GMT|[ECMP][SD]T)|([Zz])|([+-]\d{4}))$/,Il={UT:0,GMT:0,EDT:-240,EST:-300,CDT:-300,CST:-360,MDT:-360,MST:-420,PDT:-420,PST:-480};function Ks(e){var t,n,s=e._i,a=Ml.exec(s)||Sl.exec(s),o,i,l,d,c=Ot.length,h=Sn.length;if(a){for(T(e).iso=!0,t=0,n=c;t<n;t++)if(Ot[t][1].exec(a[1])){i=Ot[t][0],o=Ot[t][2]!==!1;break}if(i==null){e._isValid=!1;return}if(a[3]){for(t=0,n=h;t<n;t++)if(Sn[t][1].exec(a[3])){l=(a[2]||" ")+Sn[t][0];break}if(l==null){e._isValid=!1;return}}if(!o&&l!=null){e._isValid=!1;return}if(a[4])if(Ol.exec(a[4]))d="Z";else{e._isValid=!1;return}e._f=i+(l||"")+(d||""),En(e)}else e._isValid=!1}function Dl(e,t,n,s,a,o){var i=[xl(e),$s.indexOf(t),parseInt(n,10),parseInt(s,10),parseInt(a,10)];return o&&i.push(parseInt(o,10)),i}function xl(e){var t=parseInt(e,10);return t<=49?2e3+t:t<=999?1900+t:t}function Yl(e){return e.replace(/\([^()]*\)|[\n\t]/g," ").replace(/(\s\s+)/g," ").replace(/^\s\s*/,"").replace(/\s\s*$/,"")}function Rl(e,t,n){if(e){var s=zs.indexOf(e),a=new Date(t[0],t[1],t[2]).getDay();if(s!==a)return T(n).weekdayMismatch=!0,n._isValid=!1,!1}return!0}function Pl(e,t,n){if(e)return Il[e];if(t)return 0;var s=parseInt(n,10),a=s%100,o=(s-a)/100;return o*60+a}function Qs(e){var t=Tl.exec(Yl(e._i)),n;if(t){if(n=Dl(t[4],t[3],t[2],t[5],t[6],t[7]),!Rl(t[1],n,e))return;e._a=n,e._tzm=Pl(t[8],t[9],t[10]),e._d=nt.apply(null,e._a),e._d.setUTCMinutes(e._d.getUTCMinutes()-e._tzm),T(e).rfc2822=!0}else e._isValid=!1}function Bl(e){var t=El.exec(e._i);if(t!==null){e._d=new Date(+t[1]);return}if(Ks(e),e._isValid===!1)delete e._isValid;else return;if(Qs(e),e._isValid===!1)delete e._isValid;else return;e._strict?e._isValid=!1:_.createFromInputFallback(e)}_.createFromInputFallback=ae("value provided is not in a recognized RFC2822 or ISO format. moment construction falls back to js Date(), which is not reliable across all browsers and versions. Non RFC2822/ISO date formats are discouraged. Please refer to http://momentjs.com/guides/#/warnings/js-date/ for more info.",function(e){e._d=new Date(e._i+(e._useUTC?" UTC":""))});function Fe(e,t,n){return e??t??n}function Vl(e){var t=new Date(_.now());return e._useUTC?[t.getUTCFullYear(),t.getUTCMonth(),t.getUTCDate()]:[t.getFullYear(),t.getMonth(),t.getDate()]}function On(e){var t,n,s=[],a,o,i;if(!e._d){for(a=Vl(e),e._w&&e._a[_e]==null&&e._a[be]==null&&Ll(e),e._dayOfYear!=null&&(i=Fe(e._a[K],a[K]),(e._dayOfYear>et(i)||e._dayOfYear===0)&&(T(e)._overflowDayOfYear=!0),n=nt(i,0,e._dayOfYear),e._a[be]=n.getUTCMonth(),e._a[_e]=n.getUTCDate()),t=0;t<3&&e._a[t]==null;++t)e._a[t]=s[t]=a[t];for(;t<7;t++)e._a[t]=s[t]=e._a[t]==null?t===2?1:0:e._a[t];e._a[J]===24&&e._a[de]===0&&e._a[we]===0&&e._a[Re]===0&&(e._nextDay=!0,e._a[J]=0),e._d=(e._useUTC?nt:Fi).apply(null,s),o=e._useUTC?e._d.getUTCDay():e._d.getDay(),e._tzm!=null&&e._d.setUTCMinutes(e._d.getUTCMinutes()-e._tzm),e._nextDay&&(e._a[J]=24),e._w&&typeof e._w.d<"u"&&e._w.d!==o&&(T(e).weekdayMismatch=!0)}}function Ll(e){var t,n,s,a,o,i,l,d,c;t=e._w,t.GG!=null||t.W!=null||t.E!=null?(o=1,i=4,n=Fe(t.GG,e._a[K],st(W(),1,4).year),s=Fe(t.W,1),a=Fe(t.E,1),(a<1||a>7)&&(d=!0)):(o=e._locale._week.dow,i=e._locale._week.doy,c=st(W(),o,i),n=Fe(t.gg,e._a[K],c.year),s=Fe(t.w,c.week),t.d!=null?(a=t.d,(a<0||a>6)&&(d=!0)):t.e!=null?(a=t.e+o,(t.e<0||t.e>6)&&(d=!0)):a=o),s<1||s>ve(n,o,i)?T(e)._overflowWeeks=!0:d!=null?T(e)._overflowWeekday=!0:(l=js(n,s,a,o,i),e._a[K]=l.year,e._dayOfYear=l.dayOfYear)}_.ISO_8601=function(){},_.RFC_2822=function(){};function En(e){if(e._f===_.ISO_8601){Ks(e);return}if(e._f===_.RFC_2822){Qs(e);return}e._a=[],T(e).empty=!0;var t=""+e._i,n,s,a,o,i,l=t.length,d=0,c,h;for(a=Ys(e._f,e._locale).match(fn)||[],h=a.length,n=0;n<h;n++)o=a[n],s=(t.match(Mi(o,e))||[])[0],s&&(i=t.substr(0,t.indexOf(s)),i.length>0&&T(e).unusedInput.push(i),t=t.slice(t.indexOf(s)+s.length),d+=s.length),Ue[o]?(s?T(e).empty=!1:T(e).unusedTokens.push(o),Oi(o,s,e)):e._strict&&!s&&T(e).unusedTokens.push(o);T(e).charsLeftOver=l-d,t.length>0&&T(e).unusedInput.push(t),e._a[J]<=12&&T(e).bigHour===!0&&e._a[J]>0&&(T(e).bigHour=void 0),T(e).parsedDateParts=e._a.slice(0),T(e).meridiem=e._meridiem,e._a[J]=Al(e._locale,e._a[J],e._meridiem),c=T(e).era,c!==null&&(e._a[K]=e._locale.erasConvertYear(c,e._a[K])),On(e),Mn(e)}function Al(e,t,n){var s;return n==null?t:e.meridiemHour!=null?e.meridiemHour(t,n):(e.isPM!=null&&(s=e.isPM(n),s&&t<12&&(t+=12),!s&&t===12&&(t=0)),t)}function Ul(e){var t,n,s,a,o,i,l=!1,d=e._f.length;if(d===0){T(e).invalidFormat=!0,e._d=new Date(NaN);return}for(a=0;a<d;a++)o=0,i=!1,t=dn({},e),e._useUTC!=null&&(t._useUTC=e._useUTC),t._f=e._f[a],En(t),on(t)&&(i=!0),o+=T(t).charsLeftOver,o+=T(t).unusedTokens.length*10,T(t).score=o,l?o<s&&(s=o,n=t):(s==null||o<s||i)&&(s=o,n=t,i&&(l=!0));Te(e,n||t)}function $l(e){if(!e._d){var t=mn(e._i),n=t.day===void 0?t.date:t.day;e._a=Es([t.year,t.month,n,t.hour,t.minute,t.second,t.millisecond],function(s){return s&&parseInt(s,10)}),On(e)}}function Wl(e){var t=new Xe(Mn(ea(e)));return t._nextDay&&(t.add(1,"d"),t._nextDay=void 0),t}function ea(e){var t=e._i,n=e._f;return e._locale=e._locale||Ne(e._l),t===null||n===void 0&&t===""?mt({nullInput:!0}):(typeof t=="string"&&(e._i=t=e._locale.preparse(t)),le(t)?new Xe(Mn(t)):(Je(t)?e._d=t:ie(n)?Ul(e):n?En(e):Hl(e),on(e)||(e._d=null),e))}function Hl(e){var t=e._i;ee(t)?e._d=new Date(_.now()):Je(t)?e._d=new Date(t.valueOf()):typeof t=="string"?Bl(e):ie(t)?(e._a=Es(t.slice(0),function(n){return parseInt(n,10)}),On(e)):Ye(t)?$l(e):ge(t)?e._d=new Date(t):_.createFromInputFallback(e)}function ta(e,t,n,s,a){var o={};return(t===!0||t===!1)&&(s=t,t=void 0),(n===!0||n===!1)&&(s=n,n=void 0),(Ye(e)&&an(e)||ie(e)&&e.length===0)&&(e=void 0),o._isAMomentObject=!0,o._useUTC=o._isUTC=a,o._l=n,o._i=e,o._f=t,o._strict=s,Wl(o)}function W(e,t,n,s){return ta(e,t,n,s,!1)}var Fl=ae("moment().min is deprecated, use moment.max instead. http://momentjs.com/guides/#/warnings/min-max/",function(){var e=W.apply(null,arguments);return this.isValid()&&e.isValid()?e<this?this:e:mt()}),Gl=ae("moment().max is deprecated, use moment.min instead. http://momentjs.com/guides/#/warnings/min-max/",function(){var e=W.apply(null,arguments);return this.isValid()&&e.isValid()?e>this?this:e:mt()});function na(e,t){var n,s;if(t.length===1&&ie(t[0])&&(t=t[0]),!t.length)return W();for(n=t[0],s=1;s<t.length;++s)(!t[s].isValid()||t[s][e](n))&&(n=t[s]);return n}function jl(){var e=[].slice.call(arguments,0);return na("isBefore",e)}function zl(){var e=[].slice.call(arguments,0);return na("isAfter",e)}var Zl=function(){return Date.now?Date.now():+new Date},ot=["year","quarter","month","week","day","hour","minute","second","millisecond"];function ql(e){var t,n=!1,s,a=ot.length;for(t in e)if(P(e,t)&&!(Z.call(ot,t)!==-1&&(e[t]==null||!isNaN(e[t]))))return!1;for(s=0;s<a;++s)if(e[ot[s]]){if(n)return!1;parseFloat(e[ot[s]])!==x(e[ot[s]])&&(n=!0)}return!0}function Jl(){return this._isValid}function Xl(){return ce(NaN)}function Et(e){var t=mn(e),n=t.year||0,s=t.quarter||0,a=t.month||0,o=t.week||t.isoWeek||0,i=t.day||0,l=t.hour||0,d=t.minute||0,c=t.second||0,h=t.millisecond||0;this._isValid=ql(t),this._milliseconds=+h+c*1e3+d*6e4+l*1e3*60*60,this._days=+i+o*7,this._months=+a+s*3+n*12,this._data={},this._locale=Ne(),this._bubble()}function Tt(e){return e instanceof Et}function Tn(e){return e<0?Math.round(-1*e)*-1:Math.round(e)}function Kl(e,t,n){var s=Math.min(e.length,t.length),a=Math.abs(e.length-t.length),o=0,i;for(i=0;i<s;i++)x(e[i])!==x(t[i])&&o++;return o+a}function sa(e,t){C(e,0,0,function(){var n=this.utcOffset(),s="+";return n<0&&(n=-n,s="-"),s+me(~~(n/60),2)+t+me(~~n%60,2)})}sa("Z",":"),sa("ZZ",""),y("Z",vt),y("ZZ",vt),L(["Z","ZZ"],function(e,t,n){n._useUTC=!0,n._tzm=In(vt,e)});var Ql=/([\+\-]|\d\d)/gi;function In(e,t){var n=(t||"").match(e),s,a,o;return n===null?null:(s=n[n.length-1]||[],a=(s+"").match(Ql)||["-",0,0],o=+(a[1]*60)+x(a[2]),o===0?0:a[0]==="+"?o:-o)}function Dn(e,t){var n,s;return t._isUTC?(n=t.clone(),s=(le(e)||Je(e)?e.valueOf():W(e).valueOf())-n.valueOf(),n._d.setTime(n._d.valueOf()+s),_.updateOffset(n,!1),n):W(e).local()}function xn(e){return-Math.round(e._d.getTimezoneOffset())}_.updateOffset=function(){};function ed(e,t,n){var s=this._offset||0,a;if(!this.isValid())return e!=null?this:NaN;if(e!=null){if(typeof e=="string"){if(e=In(vt,e),e===null)return this}else Math.abs(e)<16&&!n&&(e=e*60);return!this._isUTC&&t&&(a=xn(this)),this._offset=e,this._isUTC=!0,a!=null&&this.add(a,"m"),s!==e&&(!t||this._changeInProgress?ia(this,ce(e-s,"m"),1,!1):this._changeInProgress||(this._changeInProgress=!0,_.updateOffset(this,!0),this._changeInProgress=null)),this}else return this._isUTC?s:xn(this)}function td(e,t){return e!=null?(typeof e!="string"&&(e=-e),this.utcOffset(e,t),this):-this.utcOffset()}function nd(e){return this.utcOffset(0,e)}function sd(e){return this._isUTC&&(this.utcOffset(0,e),this._isUTC=!1,e&&this.subtract(xn(this),"m")),this}function ad(){if(this._tzm!=null)this.utcOffset(this._tzm,!1,!0);else if(typeof this._i=="string"){var e=In(Ni,this._i);e!=null?this.utcOffset(e):this.utcOffset(0,!0)}return this}function rd(e){return this.isValid()?(e=e?W(e).utcOffset():0,(this.utcOffset()-e)%60===0):!1}function od(){return this.utcOffset()>this.clone().month(0).utcOffset()||this.utcOffset()>this.clone().month(5).utcOffset()}function id(){if(!ee(this._isDSTShifted))return this._isDSTShifted;var e={},t;return dn(e,this),e=ea(e),e._a?(t=e._isUTC?fe(e._a):W(e._a),this._isDSTShifted=this.isValid()&&Kl(e._a,t.toArray())>0):this._isDSTShifted=!1,this._isDSTShifted}function ld(){return this.isValid()?!this._isUTC:!1}function dd(){return this.isValid()?this._isUTC:!1}function aa(){return this.isValid()?this._isUTC&&this._offset===0:!1}var cd=/^(-|\+)?(?:(\d*)[. ])?(\d+):(\d+)(?::(\d+)(\.\d*)?)?$/,ud=/^(-|\+)?P(?:([-+]?[0-9,.]*)Y)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)W)?(?:([-+]?[0-9,.]*)D)?(?:T(?:([-+]?[0-9,.]*)H)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)S)?)?$/;function ce(e,t){var n=e,s=null,a,o,i;return Tt(e)?n={ms:e._milliseconds,d:e._days,M:e._months}:ge(e)||!isNaN(+e)?(n={},t?n[t]=+e:n.milliseconds=+e):(s=cd.exec(e))?(a=s[1]==="-"?-1:1,n={y:0,d:x(s[_e])*a,h:x(s[J])*a,m:x(s[de])*a,s:x(s[we])*a,ms:x(Tn(s[Re]*1e3))*a}):(s=ud.exec(e))?(a=s[1]==="-"?-1:1,n={y:Pe(s[2],a),M:Pe(s[3],a),w:Pe(s[4],a),d:Pe(s[5],a),h:Pe(s[6],a),m:Pe(s[7],a),s:Pe(s[8],a)}):n==null?n={}:typeof n=="object"&&("from"in n||"to"in n)&&(i=hd(W(n.from),W(n.to)),n={},n.ms=i.milliseconds,n.M=i.months),o=new Et(n),Tt(e)&&P(e,"_locale")&&(o._locale=e._locale),Tt(e)&&P(e,"_isValid")&&(o._isValid=e._isValid),o}ce.fn=Et.prototype,ce.invalid=Xl;function Pe(e,t){var n=e&&parseFloat(e.replace(",","."));return(isNaN(n)?0:n)*t}function ra(e,t){var n={};return n.months=t.month()-e.month()+(t.year()-e.year())*12,e.clone().add(n.months,"M").isAfter(t)&&--n.months,n.milliseconds=+t-+e.clone().add(n.months,"M"),n}function hd(e,t){var n;return e.isValid()&&t.isValid()?(t=Dn(t,e),e.isBefore(t)?n=ra(e,t):(n=ra(t,e),n.milliseconds=-n.milliseconds,n.months=-n.months),n):{milliseconds:0,months:0}}function oa(e,t){return function(n,s){var a,o;return s!==null&&!isNaN(+s)&&(xs(t,"moment()."+t+"(period, number) is deprecated. Please use moment()."+t+"(number, period). See http://momentjs.com/guides/#/warnings/add-inverted-param/ for more info."),o=n,n=s,s=o),a=ce(n,s),ia(this,a,e),this}}function ia(e,t,n,s){var a=t._milliseconds,o=Tn(t._days),i=Tn(t._months);e.isValid()&&(s=s??!0,i&&Hs(e,tt(e,"Month")+i*n),o&&Us(e,"Date",tt(e,"Date")+o*n),a&&e._d.setTime(e._d.valueOf()+a*n),s&&_.updateOffset(e,o||i))}var fd=oa(1,"add"),pd=oa(-1,"subtract");function la(e){return typeof e=="string"||e instanceof String}function md(e){return le(e)||Je(e)||la(e)||ge(e)||yd(e)||_d(e)||e===null||e===void 0}function _d(e){var t=Ye(e)&&!an(e),n=!1,s=["years","year","y","months","month","M","days","day","d","dates","date","D","hours","hour","h","minutes","minute","m","seconds","second","s","milliseconds","millisecond","ms"],a,o,i=s.length;for(a=0;a<i;a+=1)o=s[a],n=n||P(e,o);return t&&n}function yd(e){var t=ie(e),n=!1;return t&&(n=e.filter(function(s){return!ge(s)&&la(e)}).length===0),t&&n}function gd(e){var t=Ye(e)&&!an(e),n=!1,s=["sameDay","nextDay","lastDay","nextWeek","lastWeek","sameElse"],a,o;for(a=0;a<s.length;a+=1)o=s[a],n=n||P(e,o);return t&&n}function kd(e,t){var n=e.diff(t,"days",!0);return n<-6?"sameElse":n<-1?"lastWeek":n<0?"lastDay":n<1?"sameDay":n<2?"nextDay":n<7?"nextWeek":"sameElse"}function bd(e,t){arguments.length===1&&(arguments[0]?md(arguments[0])?(e=arguments[0],t=void 0):gd(arguments[0])&&(t=arguments[0],e=void 0):(e=void 0,t=void 0));var n=e||W(),s=Dn(n,this).startOf("day"),a=_.calendarFormat(this,s)||"sameElse",o=t&&(pe(t[a])?t[a].call(this,n):t[a]);return this.format(o||this.localeData().calendar(a,this,W(n)))}function wd(){return new Xe(this)}function vd(e,t){var n=le(e)?e:W(e);return this.isValid()&&n.isValid()?(t=re(t)||"millisecond",t==="millisecond"?this.valueOf()>n.valueOf():n.valueOf()<this.clone().startOf(t).valueOf()):!1}function Nd(e,t){var n=le(e)?e:W(e);return this.isValid()&&n.isValid()?(t=re(t)||"millisecond",t==="millisecond"?this.valueOf()<n.valueOf():this.clone().endOf(t).valueOf()<n.valueOf()):!1}function Cd(e,t,n,s){var a=le(e)?e:W(e),o=le(t)?t:W(t);return this.isValid()&&a.isValid()&&o.isValid()?(s=s||"()",(s[0]==="("?this.isAfter(a,n):!this.isBefore(a,n))&&(s[1]===")"?this.isBefore(o,n):!this.isAfter(o,n))):!1}function Md(e,t){var n=le(e)?e:W(e),s;return this.isValid()&&n.isValid()?(t=re(t)||"millisecond",t==="millisecond"?this.valueOf()===n.valueOf():(s=n.valueOf(),this.clone().startOf(t).valueOf()<=s&&s<=this.clone().endOf(t).valueOf())):!1}function Sd(e,t){return this.isSame(e,t)||this.isAfter(e,t)}function Od(e,t){return this.isSame(e,t)||this.isBefore(e,t)}function Ed(e,t,n){var s,a,o;if(!this.isValid())return NaN;if(s=Dn(e,this),!s.isValid())return NaN;switch(a=(s.utcOffset()-this.utcOffset())*6e4,t=re(t),t){case"year":o=It(this,s)/12;break;case"month":o=It(this,s);break;case"quarter":o=It(this,s)/3;break;case"second":o=(this-s)/1e3;break;case"minute":o=(this-s)/6e4;break;case"hour":o=(this-s)/36e5;break;case"day":o=(this-s-a)/864e5;break;case"week":o=(this-s-a)/6048e5;break;default:o=this-s}return n?o:oe(o)}function It(e,t){if(e.date()<t.date())return-It(t,e);var n=(t.year()-e.year())*12+(t.month()-e.month()),s=e.clone().add(n,"months"),a,o;return t-s<0?(a=e.clone().add(n-1,"months"),o=(t-s)/(s-a)):(a=e.clone().add(n+1,"months"),o=(t-s)/(a-s)),-(n+o)||0}_.defaultFormat="YYYY-MM-DDTHH:mm:ssZ",_.defaultFormatUtc="YYYY-MM-DDTHH:mm:ss[Z]";function Td(){return this.clone().locale("en").format("ddd MMM DD YYYY HH:mm:ss [GMT]ZZ")}function Id(e){if(!this.isValid())return null;var t=e!==!0,n=t?this.clone().utc():this;return n.year()<0||n.year()>9999?yt(n,t?"YYYYYY-MM-DD[T]HH:mm:ss.SSS[Z]":"YYYYYY-MM-DD[T]HH:mm:ss.SSSZ"):pe(Date.prototype.toISOString)?t?this.toDate().toISOString():new Date(this.valueOf()+this.utcOffset()*60*1e3).toISOString().replace("Z",yt(n,"Z")):yt(n,t?"YYYY-MM-DD[T]HH:mm:ss.SSS[Z]":"YYYY-MM-DD[T]HH:mm:ss.SSSZ")}function Dd(){if(!this.isValid())return"moment.invalid(/* "+this._i+" */)";var e="moment",t="",n,s,a,o;return this.isLocal()||(e=this.utcOffset()===0?"moment.utc":"moment.parseZone",t="Z"),n="["+e+'("]',s=0<=this.year()&&this.year()<=9999?"YYYY":"YYYYYY",a="-MM-DD[T]HH:mm:ss.SSS",o=t+'[")]',this.format(n+s+a+o)}function xd(e){e||(e=this.isUtc()?_.defaultFormatUtc:_.defaultFormat);var t=yt(this,e);return this.localeData().postformat(t)}function Yd(e,t){return this.isValid()&&(le(e)&&e.isValid()||W(e).isValid())?ce({to:this,from:e}).locale(this.locale()).humanize(!t):this.localeData().invalidDate()}function Rd(e){return this.from(W(),e)}function Pd(e,t){return this.isValid()&&(le(e)&&e.isValid()||W(e).isValid())?ce({from:this,to:e}).locale(this.locale()).humanize(!t):this.localeData().invalidDate()}function Bd(e){return this.to(W(),e)}function da(e){var t;return e===void 0?this._locale._abbr:(t=Ne(e),t!=null&&(this._locale=t),this)}var ca=ae("moment().lang() is deprecated. Instead, use moment().localeData() to get the language configuration. Use moment().locale() to change languages.",function(e){return e===void 0?this.localeData():this.locale(e)});function ua(){return this._locale}var Dt=1e3,Ge=60*Dt,xt=60*Ge,ha=(365*400+97)*24*xt;function je(e,t){return(e%t+t)%t}function fa(e,t,n){return e<100&&e>=0?new Date(e+400,t,n)-ha:new Date(e,t,n).valueOf()}function pa(e,t,n){return e<100&&e>=0?Date.UTC(e+400,t,n)-ha:Date.UTC(e,t,n)}function Vd(e){var t,n;if(e=re(e),e===void 0||e==="millisecond"||!this.isValid())return this;switch(n=this._isUTC?pa:fa,e){case"year":t=n(this.year(),0,1);break;case"quarter":t=n(this.year(),this.month()-this.month()%3,1);break;case"month":t=n(this.year(),this.month(),1);break;case"week":t=n(this.year(),this.month(),this.date()-this.weekday());break;case"isoWeek":t=n(this.year(),this.month(),this.date()-(this.isoWeekday()-1));break;case"day":case"date":t=n(this.year(),this.month(),this.date());break;case"hour":t=this._d.valueOf(),t-=je(t+(this._isUTC?0:this.utcOffset()*Ge),xt);break;case"minute":t=this._d.valueOf(),t-=je(t,Ge);break;case"second":t=this._d.valueOf(),t-=je(t,Dt);break}return this._d.setTime(t),_.updateOffset(this,!0),this}function Ld(e){var t,n;if(e=re(e),e===void 0||e==="millisecond"||!this.isValid())return this;switch(n=this._isUTC?pa:fa,e){case"year":t=n(this.year()+1,0,1)-1;break;case"quarter":t=n(this.year(),this.month()-this.month()%3+3,1)-1;break;case"month":t=n(this.year(),this.month()+1,1)-1;break;case"week":t=n(this.year(),this.month(),this.date()-this.weekday()+7)-1;break;case"isoWeek":t=n(this.year(),this.month(),this.date()-(this.isoWeekday()-1)+7)-1;break;case"day":case"date":t=n(this.year(),this.month(),this.date()+1)-1;break;case"hour":t=this._d.valueOf(),t+=xt-je(t+(this._isUTC?0:this.utcOffset()*Ge),xt)-1;break;case"minute":t=this._d.valueOf(),t+=Ge-je(t,Ge)-1;break;case"second":t=this._d.valueOf(),t+=Dt-je(t,Dt)-1;break}return this._d.setTime(t),_.updateOffset(this,!0),this}function Ad(){return this._d.valueOf()-(this._offset||0)*6e4}function Ud(){return Math.floor(this.valueOf()/1e3)}function $d(){return new Date(this.valueOf())}function Wd(){var e=this;return[e.year(),e.month(),e.date(),e.hour(),e.minute(),e.second(),e.millisecond()]}function Hd(){var e=this;return{years:e.year(),months:e.month(),date:e.date(),hours:e.hours(),minutes:e.minutes(),seconds:e.seconds(),milliseconds:e.milliseconds()}}function Fd(){return this.isValid()?this.toISOString():null}function Gd(){return on(this)}function jd(){return Te({},T(this))}function zd(){return T(this).overflow}function Zd(){return{input:this._i,format:this._f,locale:this._locale,isUTC:this._isUTC,strict:this._strict}}C("N",0,0,"eraAbbr"),C("NN",0,0,"eraAbbr"),C("NNN",0,0,"eraAbbr"),C("NNNN",0,0,"eraName"),C("NNNNN",0,0,"eraNarrow"),C("y",["y",1],"yo","eraYear"),C("y",["yy",2],0,"eraYear"),C("y",["yyy",3],0,"eraYear"),C("y",["yyyy",4],0,"eraYear"),y("N",Yn),y("NN",Yn),y("NNN",Yn),y("NNNN",rc),y("NNNNN",oc),L(["N","NN","NNN","NNNN","NNNNN"],function(e,t,n,s){var a=n._locale.erasParse(e,s,n._strict);a?T(n).era=a:T(n).invalidEra=e}),y("y",$e),y("yy",$e),y("yyy",$e),y("yyyy",$e),y("yo",ic),L(["y","yy","yyy","yyyy"],K),L(["yo"],function(e,t,n,s){var a;n._locale._eraYearOrdinalRegex&&(a=e.match(n._locale._eraYearOrdinalRegex)),n._locale.eraYearOrdinalParse?t[K]=n._locale.eraYearOrdinalParse(e,a):t[K]=parseInt(e,10)});function qd(e,t){var n,s,a,o=this._eras||Ne("en")._eras;for(n=0,s=o.length;n<s;++n)switch(typeof o[n].since==="string"&&(a=_(o[n].since).startOf("day"),o[n].since=a.valueOf()),typeof o[n].until){case"undefined":o[n].until=1/0;break;case"string":a=_(o[n].until).startOf("day").valueOf(),o[n].until=a.valueOf();break}return o}function Jd(e,t,n){var s,a,o=this.eras(),i,l,d;for(e=e.toUpperCase(),s=0,a=o.length;s<a;++s)if(i=o[s].name.toUpperCase(),l=o[s].abbr.toUpperCase(),d=o[s].narrow.toUpperCase(),n)switch(t){case"N":case"NN":case"NNN":if(l===e)return o[s];break;case"NNNN":if(i===e)return o[s];break;case"NNNNN":if(d===e)return o[s];break}else if([i,l,d].indexOf(e)>=0)return o[s]}function Xd(e,t){var n=e.since<=e.until?1:-1;return t===void 0?_(e.since).year():_(e.since).year()+(t-e.offset)*n}function Kd(){var e,t,n,s=this.localeData().eras();for(e=0,t=s.length;e<t;++e)if(n=this.clone().startOf("day").valueOf(),s[e].since<=n&&n<=s[e].until||s[e].until<=n&&n<=s[e].since)return s[e].name;return""}function Qd(){var e,t,n,s=this.localeData().eras();for(e=0,t=s.length;e<t;++e)if(n=this.clone().startOf("day").valueOf(),s[e].since<=n&&n<=s[e].until||s[e].until<=n&&n<=s[e].since)return s[e].narrow;return""}function ec(){var e,t,n,s=this.localeData().eras();for(e=0,t=s.length;e<t;++e)if(n=this.clone().startOf("day").valueOf(),s[e].since<=n&&n<=s[e].until||s[e].until<=n&&n<=s[e].since)return s[e].abbr;return""}function tc(){var e,t,n,s,a=this.localeData().eras();for(e=0,t=a.length;e<t;++e)if(n=a[e].since<=a[e].until?1:-1,s=this.clone().startOf("day").valueOf(),a[e].since<=s&&s<=a[e].until||a[e].until<=s&&s<=a[e].since)return(this.year()-_(a[e].since).year())*n+a[e].offset;return this.year()}function nc(e){return P(this,"_erasNameRegex")||Rn.call(this),e?this._erasNameRegex:this._erasRegex}function sc(e){return P(this,"_erasAbbrRegex")||Rn.call(this),e?this._erasAbbrRegex:this._erasRegex}function ac(e){return P(this,"_erasNarrowRegex")||Rn.call(this),e?this._erasNarrowRegex:this._erasRegex}function Yn(e,t){return t.erasAbbrRegex(e)}function rc(e,t){return t.erasNameRegex(e)}function oc(e,t){return t.erasNarrowRegex(e)}function ic(e,t){return t._eraYearOrdinalRegex||$e}function Rn(){var e=[],t=[],n=[],s=[],a,o,i,l,d,c=this.eras();for(a=0,o=c.length;a<o;++a)i=ke(c[a].name),l=ke(c[a].abbr),d=ke(c[a].narrow),t.push(i),e.push(l),n.push(d),s.push(i),s.push(l),s.push(d);this._erasRegex=new RegExp("^("+s.join("|")+")","i"),this._erasNameRegex=new RegExp("^("+t.join("|")+")","i"),this._erasAbbrRegex=new RegExp("^("+e.join("|")+")","i"),this._erasNarrowRegex=new RegExp("^("+n.join("|")+")","i")}C(0,["gg",2],0,function(){return this.weekYear()%100}),C(0,["GG",2],0,function(){return this.isoWeekYear()%100});function Yt(e,t){C(0,[e,e.length],0,t)}Yt("gggg","weekYear"),Yt("ggggg","weekYear"),Yt("GGGG","isoWeekYear"),Yt("GGGGG","isoWeekYear"),y("G",wt),y("g",wt),y("GG",$,ne),y("gg",$,ne),y("GGGG",yn,_n),y("gggg",yn,_n),y("GGGGG",bt,gt),y("ggggg",bt,gt),Qe(["gggg","ggggg","GGGG","GGGGG"],function(e,t,n,s){t[s.substr(0,2)]=x(e)}),Qe(["gg","GG"],function(e,t,n,s){t[s]=_.parseTwoDigitYear(e)});function lc(e){return ma.call(this,e,this.week(),this.weekday()+this.localeData()._week.dow,this.localeData()._week.dow,this.localeData()._week.doy)}function dc(e){return ma.call(this,e,this.isoWeek(),this.isoWeekday(),1,4)}function cc(){return ve(this.year(),1,4)}function uc(){return ve(this.isoWeekYear(),1,4)}function hc(){var e=this.localeData()._week;return ve(this.year(),e.dow,e.doy)}function fc(){var e=this.localeData()._week;return ve(this.weekYear(),e.dow,e.doy)}function ma(e,t,n,s,a){var o;return e==null?st(this,s,a).year:(o=ve(e,s,a),t>o&&(t=o),pc.call(this,e,t,n,s,a))}function pc(e,t,n,s,a){var o=js(e,t,n,s,a),i=nt(o.year,0,o.dayOfYear);return this.year(i.getUTCFullYear()),this.month(i.getUTCMonth()),this.date(i.getUTCDate()),this}C("Q",0,"Qo","quarter"),y("Q",Ps),L("Q",function(e,t){t[be]=(x(e)-1)*3});function mc(e){return e==null?Math.ceil((this.month()+1)/3):this.month((e-1)*3+this.month()%3)}C("D",["DD",2],"Do","date"),y("D",$,We),y("DD",$,ne),y("Do",function(e,t){return e?t._dayOfMonthOrdinalParse||t._ordinalParse:t._dayOfMonthOrdinalParseLenient}),L(["D","DD"],_e),L("Do",function(e,t){t[_e]=x(e.match($)[0])});var _a=He("Date",!0);C("DDD",["DDDD",3],"DDDo","dayOfYear"),y("DDD",kt),y("DDDD",Bs),L(["DDD","DDDD"],function(e,t,n){n._dayOfYear=x(e)});function _c(e){var t=Math.round((this.clone().startOf("day")-this.clone().startOf("year"))/864e5)+1;return e==null?t:this.add(e-t,"d")}C("m",["mm",2],0,"minute"),y("m",$,gn),y("mm",$,ne),L(["m","mm"],de);var yc=He("Minutes",!1);C("s",["ss",2],0,"second"),y("s",$,gn),y("ss",$,ne),L(["s","ss"],we);var gc=He("Seconds",!1);C("S",0,0,function(){return~~(this.millisecond()/100)}),C(0,["SS",2],0,function(){return~~(this.millisecond()/10)}),C(0,["SSS",3],0,"millisecond"),C(0,["SSSS",4],0,function(){return this.millisecond()*10}),C(0,["SSSSS",5],0,function(){return this.millisecond()*100}),C(0,["SSSSSS",6],0,function(){return this.millisecond()*1e3}),C(0,["SSSSSSS",7],0,function(){return this.millisecond()*1e4}),C(0,["SSSSSSSS",8],0,function(){return this.millisecond()*1e5}),C(0,["SSSSSSSSS",9],0,function(){return this.millisecond()*1e6}),y("S",kt,Ps),y("SS",kt,ne),y("SSS",kt,Bs);var De,ya;for(De="SSSS";De.length<=9;De+="S")y(De,$e);function kc(e,t){t[Re]=x(("0."+e)*1e3)}for(De="S";De.length<=9;De+="S")L(De,kc);ya=He("Milliseconds",!1),C("z",0,0,"zoneAbbr"),C("zz",0,0,"zoneName");function bc(){return this._isUTC?"UTC":""}function wc(){return this._isUTC?"Coordinated Universal Time":""}var u=Xe.prototype;u.add=fd,u.calendar=bd,u.clone=wd,u.diff=Ed,u.endOf=Ld,u.format=xd,u.from=Yd,u.fromNow=Rd,u.to=Pd,u.toNow=Bd,u.get=Di,u.invalidAt=zd,u.isAfter=vd,u.isBefore=Nd,u.isBetween=Cd,u.isSame=Md,u.isSameOrAfter=Sd,u.isSameOrBefore=Od,u.isValid=Gd,u.lang=ca,u.locale=da,u.localeData=ua,u.max=Gl,u.min=Fl,u.parsingFlags=jd,u.set=xi,u.startOf=Vd,u.subtract=pd,u.toArray=Wd,u.toObject=Hd,u.toDate=$d,u.toISOString=Id,u.inspect=Dd,typeof Symbol<"u"&&Symbol.for!=null&&(u[Symbol.for("nodejs.util.inspect.custom")]=function(){return"Moment<"+this.format()+">"}),u.toJSON=Fd,u.toString=Td,u.unix=Ud,u.valueOf=Ad,u.creationData=Zd,u.eraName=Kd,u.eraNarrow=Qd,u.eraAbbr=ec,u.eraYear=tc,u.year=As,u.isLeapYear=Ii,u.weekYear=lc,u.isoWeekYear=dc,u.quarter=u.quarters=mc,u.month=Fs,u.daysInMonth=$i,u.week=u.weeks=qi,u.isoWeek=u.isoWeeks=Ji,u.weeksInYear=hc,u.weeksInWeekYear=fc,u.isoWeeksInYear=cc,u.isoWeeksInISOWeekYear=uc,u.date=_a,u.day=u.days=dl,u.weekday=cl,u.isoWeekday=ul,u.dayOfYear=_c,u.hour=u.hours=gl,u.minute=u.minutes=yc,u.second=u.seconds=gc,u.millisecond=u.milliseconds=ya,u.utcOffset=ed,u.utc=nd,u.local=sd,u.parseZone=ad,u.hasAlignedHourOffset=rd,u.isDST=od,u.isLocal=ld,u.isUtcOffset=dd,u.isUtc=aa,u.isUTC=aa,u.zoneAbbr=bc,u.zoneName=wc,u.dates=ae("dates accessor is deprecated. Use date instead.",_a),u.months=ae("months accessor is deprecated. Use month instead",Fs),u.years=ae("years accessor is deprecated. Use year instead",As),u.zone=ae("moment().zone is deprecated, use moment().utcOffset instead. http://momentjs.com/guides/#/warnings/zone/",td),u.isDSTShifted=ae("isDSTShifted is deprecated. See http://momentjs.com/guides/#/warnings/dst-shifted/ for more information",id);function vc(e){return W(e*1e3)}function Nc(){return W.apply(null,arguments).parseZone()}function ga(e){return e}var B=un.prototype;B.calendar=li,B.longDateFormat=hi,B.invalidDate=pi,B.ordinal=yi,B.preparse=ga,B.postformat=ga,B.relativeTime=ki,B.pastFuture=bi,B.set=oi,B.eras=qd,B.erasParse=Jd,B.erasConvertYear=Xd,B.erasAbbrRegex=sc,B.erasNameRegex=nc,B.erasNarrowRegex=ac,B.months=Vi,B.monthsShort=Li,B.monthsParse=Ui,B.monthsRegex=Hi,B.monthsShortRegex=Wi,B.week=Gi,B.firstDayOfYear=Zi,B.firstDayOfWeek=zi,B.weekdays=al,B.weekdaysMin=ol,B.weekdaysShort=rl,B.weekdaysParse=ll,B.weekdaysRegex=hl,B.weekdaysShortRegex=fl,B.weekdaysMinRegex=pl,B.isPM=_l,B.meridiem=kl;function Rt(e,t,n,s){var a=Ne(),o=fe().set(s,t);return a[n](o,e)}function ka(e,t,n){if(ge(e)&&(t=e,e=void 0),e=e||"",t!=null)return Rt(e,t,n,"month");var s,a=[];for(s=0;s<12;s++)a[s]=Rt(e,s,n,"month");return a}function Pn(e,t,n,s){typeof e=="boolean"?(ge(t)&&(n=t,t=void 0),t=t||""):(t=e,n=t,e=!1,ge(t)&&(n=t,t=void 0),t=t||"");var a=Ne(),o=e?a._week.dow:0,i,l=[];if(n!=null)return Rt(t,(n+o)%7,s,"day");for(i=0;i<7;i++)l[i]=Rt(t,(i+o)%7,s,"day");return l}function Cc(e,t){return ka(e,t,"months")}function Mc(e,t){return ka(e,t,"monthsShort")}function Sc(e,t,n){return Pn(e,t,n,"weekdays")}function Oc(e,t,n){return Pn(e,t,n,"weekdaysShort")}function Ec(e,t,n){return Pn(e,t,n,"weekdaysMin")}Ie("en",{eras:[{since:"0001-01-01",until:1/0,offset:1,name:"Anno Domini",narrow:"AD",abbr:"AD"},{since:"0000-12-31",until:-1/0,offset:1,name:"Before Christ",narrow:"BC",abbr:"BC"}],dayOfMonthOrdinalParse:/\d{1,2}(th|st|nd|rd)/,ordinal:function(e){var t=e%10,n=x(e%100/10)===1?"th":t===1?"st":t===2?"nd":t===3?"rd":"th";return e+n}}),_.lang=ae("moment.lang is deprecated. Use moment.locale instead.",Ie),_.langData=ae("moment.langData is deprecated. Use moment.localeData instead.",Ne);var Ce=Math.abs;function Tc(){var e=this._data;return this._milliseconds=Ce(this._milliseconds),this._days=Ce(this._days),this._months=Ce(this._months),e.milliseconds=Ce(e.milliseconds),e.seconds=Ce(e.seconds),e.minutes=Ce(e.minutes),e.hours=Ce(e.hours),e.months=Ce(e.months),e.years=Ce(e.years),this}function ba(e,t,n,s){var a=ce(t,n);return e._milliseconds+=s*a._milliseconds,e._days+=s*a._days,e._months+=s*a._months,e._bubble()}function Ic(e,t){return ba(this,e,t,1)}function Dc(e,t){return ba(this,e,t,-1)}function wa(e){return e<0?Math.floor(e):Math.ceil(e)}function xc(){var e=this._milliseconds,t=this._days,n=this._months,s=this._data,a,o,i,l,d;return e>=0&&t>=0&&n>=0||e<=0&&t<=0&&n<=0||(e+=wa(Bn(n)+t)*864e5,t=0,n=0),s.milliseconds=e%1e3,a=oe(e/1e3),s.seconds=a%60,o=oe(a/60),s.minutes=o%60,i=oe(o/60),s.hours=i%24,t+=oe(i/24),d=oe(va(t)),n+=d,t-=wa(Bn(d)),l=oe(n/12),n%=12,s.days=t,s.months=n,s.years=l,this}function va(e){return e*4800/146097}function Bn(e){return e*146097/4800}function Yc(e){if(!this.isValid())return NaN;var t,n,s=this._milliseconds;if(e=re(e),e==="month"||e==="quarter"||e==="year")switch(t=this._days+s/864e5,n=this._months+va(t),e){case"month":return n;case"quarter":return n/3;case"year":return n/12}else switch(t=this._days+Math.round(Bn(this._months)),e){case"week":return t/7+s/6048e5;case"day":return t+s/864e5;case"hour":return t*24+s/36e5;case"minute":return t*1440+s/6e4;case"second":return t*86400+s/1e3;case"millisecond":return Math.floor(t*864e5)+s;default:throw new Error("Unknown unit "+e)}}function Me(e){return function(){return this.as(e)}}var Na=Me("ms"),Rc=Me("s"),Pc=Me("m"),Bc=Me("h"),Vc=Me("d"),Lc=Me("w"),Ac=Me("M"),Uc=Me("Q"),$c=Me("y"),Wc=Na;function Hc(){return ce(this)}function Fc(e){return e=re(e),this.isValid()?this[e+"s"]():NaN}function Be(e){return function(){return this.isValid()?this._data[e]:NaN}}var Gc=Be("milliseconds"),jc=Be("seconds"),zc=Be("minutes"),Zc=Be("hours"),qc=Be("days"),Jc=Be("months"),Xc=Be("years");function Kc(){return oe(this.days()/7)}var Se=Math.round,ze={ss:44,s:45,m:45,h:22,d:26,w:null,M:11};function Qc(e,t,n,s,a){return a.relativeTime(t||1,!!n,e,s)}function eu(e,t,n,s){var a=ce(e).abs(),o=Se(a.as("s")),i=Se(a.as("m")),l=Se(a.as("h")),d=Se(a.as("d")),c=Se(a.as("M")),h=Se(a.as("w")),b=Se(a.as("y")),m=o<=n.ss&&["s",o]||o<n.s&&["ss",o]||i<=1&&["m"]||i<n.m&&["mm",i]||l<=1&&["h"]||l<n.h&&["hh",l]||d<=1&&["d"]||d<n.d&&["dd",d];return n.w!=null&&(m=m||h<=1&&["w"]||h<n.w&&["ww",h]),m=m||c<=1&&["M"]||c<n.M&&["MM",c]||b<=1&&["y"]||["yy",b],m[2]=t,m[3]=+e>0,m[4]=s,Qc.apply(null,m)}function tu(e){return e===void 0?Se:typeof e=="function"?(Se=e,!0):!1}function nu(e,t){return ze[e]===void 0?!1:t===void 0?ze[e]:(ze[e]=t,e==="s"&&(ze.ss=t-1),!0)}function su(e,t){if(!this.isValid())return this.localeData().invalidDate();var n=!1,s=ze,a,o;return typeof e=="object"&&(t=e,e=!1),typeof e=="boolean"&&(n=e),typeof t=="object"&&(s=Object.assign({},ze,t),t.s!=null&&t.ss==null&&(s.ss=t.s-1)),a=this.localeData(),o=eu(this,!n,s,a),n&&(o=a.pastFuture(+this,o)),a.postformat(o)}var Vn=Math.abs;function Ze(e){return(e>0)-(e<0)||+e}function Pt(){if(!this.isValid())return this.localeData().invalidDate();var e=Vn(this._milliseconds)/1e3,t=Vn(this._days),n=Vn(this._months),s,a,o,i,l=this.asSeconds(),d,c,h,b;return l?(s=oe(e/60),a=oe(s/60),e%=60,s%=60,o=oe(n/12),n%=12,i=e?e.toFixed(3).replace(/\.?0+$/,""):"",d=l<0?"-":"",c=Ze(this._months)!==Ze(l)?"-":"",h=Ze(this._days)!==Ze(l)?"-":"",b=Ze(this._milliseconds)!==Ze(l)?"-":"",d+"P"+(o?c+o+"Y":"")+(n?c+n+"M":"")+(t?h+t+"D":"")+(a||s||e?"T":"")+(a?b+a+"H":"")+(s?b+s+"M":"")+(e?b+i+"S":"")):"P0D"}var Y=Et.prototype;Y.isValid=Jl,Y.abs=Tc,Y.add=Ic,Y.subtract=Dc,Y.as=Yc,Y.asMilliseconds=Na,Y.asSeconds=Rc,Y.asMinutes=Pc,Y.asHours=Bc,Y.asDays=Vc,Y.asWeeks=Lc,Y.asMonths=Ac,Y.asQuarters=Uc,Y.asYears=$c,Y.valueOf=Wc,Y._bubble=xc,Y.clone=Hc,Y.get=Fc,Y.milliseconds=Gc,Y.seconds=jc,Y.minutes=zc,Y.hours=Zc,Y.days=qc,Y.weeks=Kc,Y.months=Jc,Y.years=Xc,Y.humanize=su,Y.toISOString=Pt,Y.toString=Pt,Y.toJSON=Pt,Y.locale=da,Y.localeData=ua,Y.toIsoString=ae("toIsoString() is deprecated. Please use toISOString() instead (notice the capitals)",Pt),Y.lang=ca,C("X",0,0,"unix"),C("x",0,0,"valueOf"),y("x",wt),y("X",Ci),L("X",function(e,t,n){n._d=new Date(parseFloat(e)*1e3)}),L("x",function(e,t,n){n._d=new Date(x(e))});_.version="2.30.1",ai(W),_.fn=u,_.min=jl,_.max=zl,_.now=Zl,_.utc=fe,_.unix=vc,_.months=Cc,_.isDate=Je,_.locale=Ie,_.invalid=mt,_.duration=ce,_.isMoment=le,_.weekdays=Sc,_.parseZone=Nc,_.localeData=Ne,_.isDuration=Tt,_.monthsShort=Mc,_.weekdaysMin=Ec,_.defineLocale=Cn,_.updateLocale=Nl,_.locales=Cl,_.weekdaysShort=Oc,_.normalizeUnits=re,_.relativeTimeRounding=tu,_.relativeTimeThreshold=nu,_.calendarFormat=kd,_.prototype=u,_.HTML5_FMT={DATETIME_LOCAL:"YYYY-MM-DDTHH:mm",DATETIME_LOCAL_SECONDS:"YYYY-MM-DDTHH:mm:ss",DATETIME_LOCAL_MS:"YYYY-MM-DDTHH:mm:ss.SSS",DATE:"YYYY-MM-DD",TIME:"HH:mm",TIME_SECONDS:"HH:mm:ss",TIME_MS:"HH:mm:ss.SSS",WEEK:"GGGG-[W]WW",MONTH:"YYYY-MM"};const au="code-graph",ru=(e,t="",n="json")=>{const s=document.createElement("a");s.setAttribute("href",`data:text/${n};charset=UTF-8,${encodeURIComponent(e)}`);const a=_().format("YYMMDD_HHMMSS");s.setAttribute("download",`${au}_${a}_${t}.${n}`),s.style.display="none",document.body.appendChild(s),s.click(),document.body.removeChild(s)},ou=(e="json")=>{const t=document.createElement("input");return t.setAttribute("type","file"),t.setAttribute("id","fileElem"),t.setAttribute("multiple","true"),t.setAttribute("accept",`${e}/*`),t.style.display="none",document.body.appendChild(t),t.click(),t},Ln="CLEAR_ALL",An="DOWNLOAD_EDITOR_STATE",Ca="RUN_ENGINE",Un="TOGGLE_MINIMAP",$n="TOGGLE_PALETTE",Wn="UPLOAD_EDITOR_STATE",Ma=(e,t,n)=>{const s=n.zoomToFit.paddingLeft;t.registerCommand(Ln,{execute:()=>{t.executeCommand(S.Commands.CLEAR_CLIPBOARD_COMMAND),t.executeCommand(S.Commands.CLEAR_HISTORY_COMMAND),e.value.clear(),e.value.editor.code.clear()},canExecute:()=>e.value.nodes.length>0}),t.registerCommand(An,{execute:()=>{const a=e.value.editor.save();ru(JSON.stringify(a,null,2),e.value.shortId)},canExecute:()=>e.value.nodes.length>0}),t.registerCommand(Un,{execute:()=>n.enableMinimap=!n.enableMinimap,canExecute:()=>e.value.nodes.length>1}),t.registerCommand($n,{execute:()=>{n.palette.enabled=!n.palette.enabled,n.zoomToFit.paddingLeft=n.palette.enabled?s:50},canExecute:()=>!0}),t.registerCommand(Wn,{execute:()=>{const a=ou();a.addEventListener("change",()=>{document.body.removeChild(a);const o=a.files;if(!o||o.length<=0)return!1;const i=new FileReader;i.onload=l=>{if(l.target?.result){const d=l.target.result;if(d.length===0)return;const c=JSON.parse(d);e.value.editor.load(c),e.value.code?.engine?.runOnce(null)}},i.readAsText(o.item(0))})},canExecute:()=>!0})},Sa=e=>{const t={command:Ln,title:"Clear all",icon:r.computed(()=>os)},n={command:An,title:"Download editor state",icon:r.computed(()=>ss)},s={command:Un,title:"Toggle minimap",icon:r.computed(()=>e.enableMinimap?ls:is)},a={command:$n,title:"Toggle palette",icon:r.computed(()=>e.palette.enabled?as:$t)},o={command:Wn,title:"Upload editor state",icon:r.computed(()=>cs)};e.toolbar.commands=[a,t,o,n,...S.DEFAULT_TOOLBAR_COMMANDS,s]},Oa=(e,t,n)=>{n.registerCommand(Ca,{execute:()=>t.runOnce(null),canExecute:()=>e.nodes.length>0})};function Ea(e){const t=Symbol("CodeEngineToken");e.engine=new Ss(e.editor),Oa(e.editor.graph,e.engine,e.commandHandler),e.loadEditor=n=>{e.engine?.pause(),e.displayedGraph.clear(),e.editor.load(n),e.commandHandler.executeCommand(S.Commands.CLEAR_CLIPBOARD_COMMAND),e.commandHandler.executeCommand(S.Commands.CLEAR_HISTORY_COMMAND),e.engine?.resume(),e.engine?.runOnce(null)},e.newGraph=()=>{e.engine?.pause(),e.displayedGraph.clear(),e.commandHandler.executeCommand(S.Commands.CLEAR_CLIPBOARD_COMMAND),e.commandHandler.executeCommand(S.Commands.CLEAR_HISTORY_COMMAND),e.displayedGraph.id=xe.v4(),e.engine?.resume(),e.engine?.runOnce(null)},e.subscribe=(n=t)=>{e.displayedGraph.nodeEvents.titleChanged.subscribe(n,()=>{e.engine?.runOnce(null)}),e.displayedGraph.events.addConnection.subscribe(n,s=>{const a=e.displayedGraph.findNodeById(s.to.nodeId);a&&a.isCodeNode&&a.onConnected();const o=e.displayedGraph.findNodeById(s.from.nodeId);o&&o.isCodeNode&&o.onConnected()}),e.displayedGraph.events.removeConnection.subscribe(n,s=>{const a=e.displayedGraph.findNodeById(s.to.nodeId);a&&a.isCodeNode&&a.onUnconnected();const o=e.displayedGraph.findNodeById(s.from.nodeId);o&&o.isCodeNode&&o.onUnconnected()}),e.engine?.events.beforeRun.subscribe(n,()=>{e.displayedGraph.onUpdate(),e.engine?.pause(),e.displayedGraph.sortNodes(),e.engine?.resume()}),e.engine?.events.afterRun.subscribe(n,s=>{e.engine?.pause(),he.applyResult(s,e.editor),e.code.state.lockCode||e.code.renderCode({nodes:e.editor.graph.scriptedCodeNodes,modules:e.editor.code.modules}),e.engine?.resume()})},e.unsubscribe=(n=t)=>{e.displayedGraph.events.addConnection.unsubscribe(n),e.displayedGraph.events.removeConnection.unsubscribe(n),e.engine?.events.beforeRun.unsubscribe(n),e.engine?.events.afterRun.unsubscribe(n)}}const Bt=350;class it extends q.Graph{code=null;editor;_state=r.reactive({codeTemplate:"{{ #nodes }}{{ script }}{{ /nodes }}",lockCode:!1});constructor(t,n){super(t,n),this.editor=t,this.template=n,t.code&&(this.code=t.code)}get codeNodes(){return Hn(this)}get connections(){return super.connections}set connections(t){this._connections=t}get nodeIds(){return this.nodes.map(t=>t.id)}get nodes(){return super.nodes}set nodes(t){this._nodes=t}get scriptedCodeNodes(){return this.nodes.filter(t=>!t.state?.integrated)}get selectedNodeIds(){return this.selectedNodes.map(t=>t.id)}get shortId(){return this.id.slice(0,6)}get state(){return this._state}get visibleNodes(){return this.nodes.filter(t=>!t.state?.hidden)}addNode(t,n){return t.state&&n&&(t.state.props=n),super.addNode(t)}addNodeAtCoordinates=(t,n={x:0,y:0},s)=>(this.addNode(t,s),t.position&&(t.position=n),t);addConnection(t,n){t&&t?.name!=="_code"&&(t.hidden=!1),n&&n?.name!=="_code"&&(n.hidden=!1),super.addConnection(t,n)}clear(){this.selectedNodes=[],this._nodes=[],this._connections=[]}findNodeByType(t){return this.nodes.find(n=>n.type===t)}getNodesByType(t){return this.nodes.filter(n=>n.type===t)}getNodesByVariableName(t){return this.nodes.filter(n=>n.state?.variableName===t)}hasConnection(t,n){return this.connections.some(s=>s.from.id===t.id&&s.to.id===n.id)}load(t){const n=super.load(t);return this.nodes.forEach(s=>s.afterGraphLoaded()),n}onUpdate(){this.nodes.forEach(t=>t.onGraphUpdate())}renderCode(t){return Le.render(this.state?.codeTemplate||"",t)}sortNodes(){if(!(this.nodes.length===0||this.connections.length===0))try{let t=this.nodeIds;const n=this.connections.filter(o=>t.includes(o.to.nodeId)&&t.includes(o.from.nodeId)).map(o=>[o.to.nodeId,o.from.nodeId]);t.reverse(),t=Ba.array(t,n),t.reverse();const s=this.nodes.map(o=>o.id).filter(o=>!t.includes(o));t=[...t,...s];const a=t.map(o=>this.findNodeById(o));a&&(this.nodes=a)}catch{console.warn("Failed to sort nodes.")}}}const Hn=e=>{const t=[];return e.nodes.length===0||e.nodes.forEach(n=>{n&&(n.hasOwnProperty("subgraph")?t.push(...Hn(n.subgraph)):n.hasOwnProperty("isCodeNode")&&t.push(n))}),t},iu=(e=0,t=100)=>({x:e*(Bt+70),y:t}),lu=e=>{const t={...e.position};return t.x-=Bt+70,t.y+=50,t},Fn="__baklava_SubgraphInputNode",Gn="__baklava_SubgraphOutputNode";class Ta extends ht{graphInterfaceId;constructor(){super(),this.graphInterfaceId=xe.v4()}onPlaced(){super.onPlaced(),this.initializeIo()}load(t){super.load(t),this.graphInterfaceId=t.graphInterfaceId}save(){return{...super.save(),graphInterfaceId:this.graphInterfaceId}}update(){}}class jn extends Ta{static isGraphInputNode(t){return t.type===Fn}type=Fn;inputs={name:new q.NodeInterface("Name","Input")};outputs={placeholder:new q.NodeInterface("Value",void 0)}}class zn extends Ta{static isGraphOutputNode(t){return t.type===Gn}type=Gn;inputs={name:new q.NodeInterface("Name","Output"),placeholder:new q.NodeInterface("Value",void 0)};outputs={output:new q.NodeInterface("Output",void 0).setHidden(!0)};calculate=({placeholder:t})=>({output:t})}const du=["component","connectionCount","events","hidden","hooks","id","isCodeNode","isInput","name","nodeId","port","templateId","value"];function Ia(e){return class extends zt{type=q.getGraphNodeTypeString(e);get title(){return this._title}set title(n){this.template.name=n}inputs={};outputs={};template=e;subgraph;update(){}onConnected(){}onUnconnected(){}calculate=async(n,s)=>{if(!this.subgraph)throw new Error(`GraphNode ${this.id}: calculate called without subgraph being initialized`);if(!s.engine||typeof s.engine!="object")throw new Error(`GraphNode ${this.id}: calculate called but no engine provided in context`);const a=s.engine.getInputValues(this.subgraph);for(const l of this.subgraph.inputs)a.set(l.nodeInterfaceId,n[l.id]);const o=await s.engine.runGraph(this.subgraph,a,s.globalValues);s.engine.pause(),he.applyResult(o,s.engine.editor),s.engine.resume();const i={};for(const l of this.subgraph.outputs)i[l.id]=o.get(l.nodeId)?.get("output");return i._calculationResults=o,this.lockCode||(i._code=this.renderCode({inputs:n,...s.globalValues})),this.updateOutputValues(i),i};load(n){if(!this.subgraph)throw new Error("Cannot load a graph node without a graph");if(!this.template)throw new Error("Unable to load graph node without graph template");this.subgraph.load(n.graphState),super.load(n)}save(){if(!this.subgraph)throw new Error("Cannot save a graph node without a graph");return{...super.save(),graphState:this.subgraph.save()}}onPlaced(){this.template.events.updated.subscribe(this,()=>this.initialize()),this.template.events.nameChanged.subscribe(this,n=>{this._title=n}),this.initialize()}onDestroy(){this.template.events.updated.unsubscribe(this),this.template.events.nameChanged.unsubscribe(this),this.subgraph?.destroy()}initialize(){this.subgraph&&this.subgraph.destroy(),this.subgraph=this.template.createGraph(),this._title=this.template.name,this.updateInterfaces(),this.state.codeTemplate=`{{ #nodes }}{{ script }}
|
|
7
|
+
{{ /nodes }}`,this.events.update.emit(null)}renderCode(n){return this.subgraph?this.subgraph.renderCode({nodes:this.subgraph.scriptedCodeNodes}):Le.render(this.state.codeTemplate,n)}updateInterfaces(){if(!this.subgraph)throw new Error("Trying to update interfaces without graph instance");for(const n of this.subgraph.inputs)n.id in this.inputs?this.inputs[n.id].name=n.name:this.addInput(n.id,this.createProxyInterface(n,!0));for(const n of Object.keys(this.inputs))this.subgraph.inputs.some(s=>s.id===n)||this.removeInput(n);for(const n of this.subgraph.outputs)n.id in this.outputs?this.outputs[n.id].name=n.name:this.addOutput(n.id,this.createProxyInterface(n,!1));for(const n of Object.keys(this.outputs))this.subgraph.outputs.some(s=>s.id===n)||this.removeOutput(n);this.addInput("_code",new Q("_code",[]).use(G.setType,se).use(he.allowMultipleConnections).setHidden(!0)),this.addOutput("_code",new Q("_code",[]).use(G.setType,se).use(he.allowMultipleConnections).setHidden(!0)),this.addOutput("_calculationResults",new q.NodeInterface("_calculationResults",void 0).setHidden(!0))}createProxyInterface(n,s){const a=new Q(n.name,void 0);return new Proxy(a,{get:(o,i)=>{if(du.includes(i)||i in o||typeof i=="string"&&i.startsWith("__v_"))return Reflect.get(o,i);let l;s?l=this.subgraph?.nodes.find(b=>jn.isGraphInputNode(b)&&b.graphInterfaceId===n.id)?.outputs.placeholder.id:l=this.subgraph?.nodes.find(b=>zn.isGraphOutputNode(b)&&b.graphInterfaceId===n.id)?.inputs.placeholder.id;const d=this.subgraph?.connections.find(h=>l===(s?h.from:h.to)?.id),c=s?d?.to:d?.from;if(c)return Reflect.get(c,i)}})}}}class lt extends q.GraphTemplate{static fromGraph(t,n){return new lt(t.save(),n)}constructor(t,n){super(t,n)}get shortId(){return this.id.slice(0,6)}createGraph(t){const n=new Map,s=m=>{const D=xe.v4();return n.set(m,D),D},a=m=>{const D=n.get(m);if(!D)throw new Error(`Unable to create graph from template: Could not map old id ${m} to new id`);return D},o=m=>To(m,D=>({id:s(D.id),templateId:D.id,value:D.value})),i=this.nodes.map(m=>({...m,id:s(m.id),inputs:o(m.inputs),outputs:o(m.outputs)})),l=this.connections.map(m=>({id:s(m.id),from:a(m.from),to:a(m.to)})),d=this.inputs.map(m=>({id:m.id,name:m.name,nodeId:a(m.nodeId),nodeInterfaceId:a(m.nodeInterfaceId)})),c=this.outputs.map(m=>({id:m.id,name:m.name,nodeId:a(m.nodeId),nodeInterfaceId:a(m.nodeInterfaceId)})),h={id:xe.v4(),nodes:i,connections:l,inputs:d,outputs:c};return t||(t=new it(this.editor)),t.load(h).forEach(m=>console.warn(m)),t.template=this,t}}const cu=e=>!(e instanceof it);function Da(e,t){return{switchGraph:s=>{let a;if(cu(s))a=new it(e.value),s.createGraph(a);else{if(s!==e.value.graph)throw new Error("Can only switch using 'Graph' instance when it is the root graph. Otherwise a 'GraphTemplate' must be used.");a=s}t.value&&t.value!==e.value.graph&&t.value.destroy(),a.panning=a.panning??s.panning??{x:0,y:0},a.scaling=a.scaling??s.scaling??1,a.selectedNodes=a.selectedNodes??[],a.sidebar=a.sidebar??{visible:!1,nodeId:"",optionName:""},t.value=a,a.code?.engine?.runOnce(null)}}}class Zn extends jn{_title="Subgraph Input";inputs={_code:new Q("_code","").use(G.setType,se).setHidden(!0),name:new S.TextInputInterface("Name","Input").setPort(!1)};outputs={_code:new Q("_code","").use(G.setType,se).setHidden(!0),placeholder:new q.NodeInterface("Connection",void 0)}}class qn extends zn{_title="Subgraph Output";inputs={_code:new Q("_code","").use(G.setType,se).setHidden(!0),name:new S.TextInputInterface("Name","Output").setPort(!1),placeholder:new q.NodeInterface("Connection",void 0)};outputs={_code:new Q("_code","").use(G.setType,se).setHidden(!0),output:new q.NodeInterface("Output",void 0).setHidden(!0)}}const xa="CREATE_SUBGRAPH",Ya=[q.GRAPH_INPUT_NODE_TYPE,q.GRAPH_OUTPUT_NODE_TYPE];function Ra(e,t,n){const s=()=>e.value.selectedNodes.filter(o=>!Ya.includes(o.type)).length>0,a=()=>{const{viewModel:o}=S.useViewModel(),i=e.value,l=e.value.editor;if(i.selectedNodes.length===0)return;const d=i.selectedNodes.filter(O=>!Ya.includes(O.type)),c=d.flatMap(O=>Object.values(O.inputs)),h=d.flatMap(O=>Object.values(O.outputs)),b=i.connections.filter(O=>!h.includes(O.from)&&c.includes(O.to)),m=i.connections.filter(O=>h.includes(O.from)&&!c.includes(O.to)),D=i.connections.filter(O=>h.includes(O.from)&&c.includes(O.to)),g=d.map(O=>O.save()),M=D.map(O=>({id:O.id,from:O.from.id,to:O.to.id})),f=new Map,{xLeft:w,xRight:A,yTop:V}=uu(d);for(const[O,X]of b.entries()){const te=new Zn;te.inputs.name.value=X.to.name,g.push({...te.save(),position:{x:A-o.value.settings.nodes.defaultWidth-100,y:V+O*200}}),M.push({id:xe.v4(),from:te.outputs.placeholder.id,to:X.to.id}),f.set(X.to.id,te.graphInterfaceId)}for(const[O,X]of m.entries()){const te=new qn;te.inputs.name.value=X.from.name,g.push({...te.save(),position:{x:w+100,y:V+O*200}}),M.push({id:xe.v4(),from:X.from.id,to:te.inputs.placeholder.id}),f.set(X.from.id,te.graphInterfaceId)}const H=r.reactive(new lt({connections:M,nodes:g,inputs:[],outputs:[]},l));l.addGraphTemplate(H);const Oe=l.nodeTypes.get(q.getGraphNodeTypeString(H));if(!Oe)throw new Error("Unable to create subgraph: Could not find corresponding graph node type");i.activeTransactions++;const Ee=r.reactive(new Oe.type);i.addNode(Ee);const dt=Math.round(d.map(O=>O.position.x).reduce((O,X)=>O+X,0)/d.length),ye=Math.round(d.map(O=>O.position.y).reduce((O,X)=>O+X,0)/d.length);Ee.position.x=dt,Ee.position.y=ye,b.forEach(O=>{i.removeConnection(O),i.addConnection(O.from,Ee.inputs[f.get(O.to.id)])}),m.forEach(O=>{i.removeConnection(O),i.addConnection(Ee.outputs[f.get(O.from.id)],O.to)}),d.forEach(O=>i.removeNode(O)),i.activeTransactions--,t.canExecuteCommand(S.Commands.SAVE_SUBGRAPH_COMMAND)&&t.executeCommand(S.Commands.SAVE_SUBGRAPH_COMMAND),n(H),e.value.panning={...i.panning},e.value.scaling=i.scaling};t.registerCommand(xa,{canExecute:s,execute:a})}function uu(e){const t=e.reduce((a,o)=>{const i=o.position.x;return i<a?i:a},1/0),n=e.reduce((a,o)=>{const i=o.position.y;return i<a?i:a},1/0);return{xLeft:e.reduce((a,o)=>{const i=o.position.x+o.width;return i>a?i:a},-1/0),xRight:t,yTop:n}}class hu extends q.Editor{code;graph;constructor(t){super(),this.code=t,this.graph=new it(this)}get graphIds(){const t=[];return this.graphs.forEach(n=>t.push(n.id)),t.map(n=>n.slice(0,6)).join(", ")}get graphTemplateIds(){const t=[];return this.graphTemplates.forEach(n=>t.push(n.id)),t.map(n=>n.slice(0,6)).join(", ")}addGraphTemplate(t){if(this.events.beforeAddGraphTemplate.emit(t).prevented)return;this._graphTemplates.push(t),this.graphTemplateEvents.addTarget(t.events),this.graphTemplateHooks.addTarget(t.hooks);const n=Ia(t);this.registerNodeType(n,{category:"Subgraphs",title:t.name}),this.events.addGraphTemplate.emit(t)}load(t){try{for(super._loading=!0,t=this.hooks.load.execute(t);this.graphTemplates.length>0;)this.removeGraphTemplate(this.graphTemplates[0]);t.graphTemplates.forEach(s=>{const a=new lt(s,this);this.addGraphTemplate(a)});const n=this.graph.load(t.graph);return this.events.loaded.emit(),n.forEach(s=>console.warn(s)),n}finally{super._loading=!1}}registerCategoryModule(t,n){this.code.state.modules[t]=n}}function fu(e){const t=r.ref(e?.code??new pt),n=r.ref(e?.existingEditor??new hu(t.value)),s=Symbol("ViewModelToken"),a=r.ref(null),o=r.shallowReadonly(a),{switchGraph:i}=Da(n,a),l=r.computed(()=>o.value&&o.value!==n.value.graph),d=r.reactive(S.DEFAULT_SETTINGS());d.nodes.defaultWidth=Bt;const c=S.useCommandHandler(),h=S.useHistory(o,c),b=S.useClipboard(o,n,c),m={renderNode:new Kn.SequentialHook(null),renderInterface:new Kn.SequentialHook(null)},D=r.reactive({clipboard:b,code:t,commandHandler:c,displayedGraph:o,editor:n,history:h,hooks:m,isReady:!1,isSubgraph:l,onBeforeUnmount:()=>{},onMounted:()=>{},settings:d,switchGraph:i});return t.value.registerViewModel(D),Ea(D),S.registerDeleteNodesCommand(o,c),Ra(o,c,i),S.registerSaveSubgraphCommand(o,c),S.registerSwitchToMainGraphCommand(o,c,i),S.registerSidebarCommands(o,c),S.registerZoomToFitCommands(o,c,d),Ma(o,c,d),Sa(d),r.watch(n,(g,M)=>{M&&(M.events.registerGraph.unsubscribe(s),M.graphEvents.beforeAddNode.unsubscribe(s),g.nodeHooks.beforeLoad.unsubscribe(s),g.nodeHooks.afterSave.unsubscribe(s),g.graphTemplateHooks.beforeLoad.unsubscribe(s),g.graphTemplateHooks.afterSave.unsubscribe(s),g.graph.hooks.load.unsubscribe(s),g.graph.hooks.save.unsubscribe(s)),g&&(g.nodeHooks.beforeLoad.subscribe(s,(f,w)=>(w.position=f.position??{x:0,y:0},w.width=f.width??d.nodes.defaultWidth,w.twoColumn=f.twoColumn??!1,f)),g.nodeHooks.afterSave.subscribe(s,(f,w)=>(f.position=w.position,f.width=w.width,f.twoColumn=w.twoColumn,f)),g.graphTemplateHooks.beforeLoad.subscribe(s,(f,w)=>(w.panning=f.panning,w.scaling=f.scaling,f)),g.graphTemplateHooks.afterSave.subscribe(s,(f,w)=>(f.panning=w.panning,f.scaling=w.scaling,f)),g.graph.hooks.load.subscribe(s,(f,w)=>(w.panning=f.panning,w.scaling=f.scaling,f)),g.graph.hooks.save.subscribe(s,(f,w)=>(f.panning=w.panning,f.scaling=w.scaling,f)),g.graphEvents.beforeAddNode.subscribe(s,f=>S.setViewNodeProperties(f,{defaultWidth:d.nodes.defaultWidth})),n.value.registerNodeType(Zn,{category:"Subgraphs"}),n.value.registerNodeType(qn,{category:"Subgraphs"}),i(g.graph))},{immediate:!0}),r.nextTick(()=>D.isReady=!0),D}const pu=Object.freeze(Object.defineProperty({__proto__:null,default:`{{ #modules }}
|
|
8
8
|
{{ . }}
|
|
9
9
|
{{ /modules }}
|
|
10
10
|
|
|
11
11
|
{{ #nodes }}
|
|
12
12
|
{{ #commented }}# {{ /commented }}{{ #variableName }}{{ variableName }} = {{ /variableName }}{{ script }}
|
|
13
|
-
{{ /nodes }}`},Symbol.toStringTag,{value:"Module"})),
|
|
13
|
+
{{ /nodes }}`},Symbol.toStringTag,{value:"Module"})),mu=Object.freeze(Object.defineProperty({__proto__:null,default:`{{ #modules }}
|
|
14
14
|
{{ . }}
|
|
15
15
|
{{ /modules }}
|
|
16
16
|
|
|
17
17
|
{{ #nodes }}
|
|
18
18
|
{{ #commented }}// {{ /commented }}{{ #variableName }}var {{ variableName }} = {{ /variableName }}{{ script }};
|
|
19
|
-
{{ /nodes }}`},Symbol.toStringTag,{value:"Module"}));p.AbstractCodeNode=
|
|
19
|
+
{{ /nodes }}`},Symbol.toStringTag,{value:"Module"}));p.AbstractCodeNode=zt,p.CLEAR_ALL_COMMAND=Ln,p.CREATE_SUBGRAPH_COMMAND=xa,p.CheckboxInterface=ws,p.Code=pt,p.CodeEngine=Ss,p.CodeGraph=it,p.CodeGraphInputNode=jn,p.CodeGraphOutputNode=zn,p.CodeGraphTemplate=lt,p.CodeNode=ht,p.CodeNodeInputInterface=Ae,p.CodeNodeInterface=Q,p.CodeNodeInterfaceComponent=ft,p.CodeNodeOutputInterface=vs,p.DOWNLOAD_EDITOR_STATE_COMMAND=An,p.DynamicCodeNode=Ms,p.GRAPH_INPUT_NODE_TYPE=Fn,p.GRAPH_OUTPUT_NODE_TYPE=Gn,p.IntegerInterface=tn,p.JavascriptCode=ni,p.ListInputInterface=qo,p.NODE_DEFAULT_WITH=Bt,p.NumberInterface=Ns,p.PythonCode=ti,p.RUN_ENGINE_COMMAND=Ca,p.SelectInterface=Cs,p.SliderInterface=Jo,p.SubgraphInputNode=Zn,p.SubgraphOutputNode=qn,p.TOGGLE_MINIMAP_COMMAND=Un,p.TOGGLE_PALETTE_COMMAND=$n,p.TextInputInterface=sn,p.TextInputInterfaceComponent=jt,p.TextareaInputInterface=Xo,p.TupleInputInterface=Ko,p.UPLOAD_EDITOR_STATE_COMMAND=Wn,p.addDefaultInterfaceTypes=Zo,p.allowMultipleConnections=si,p.booleanType=qt,p.components=jo,p.createCodeGraphNodeType=Ia,p.createInterface=ks,p.defineCodeNode=Qo,p.defineDynamicCodeNode=ei,p.dictType=bs,p.formatInputs=ys,p.getCodeNodes=Hn,p.getPositionAtColumn=iu,p.getPositionBeforeNode=lu,p.icons=Fr,p.listType=Jt,p.loadNodeState=Zt,p.nodeType=se,p.numberType=Xt,p.registerCodeEngine=Ea,p.registerCreateSubgraphCommand=Ra,p.registerCustomCommands=Ma,p.registerRunEngineCommands=Oa,p.saveNodeState=gs,p.stringType=Kt,p.tupleType=Qt,p.updateToolbarItems=Sa,p.useCodeGraph=fu,p.useSwitchCodeGraph=Da,Object.defineProperty(p,Symbol.toStringTag,{value:"Module"})}));
|