@babsey/code-graph 0.6.0 → 0.6.1

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.
@@ -4,7 +4,7 @@ This is likely an internal issue. Please report it on GitHub.`);return t.get(n)}
4
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)}Ys(e+`
5
5
  Arguments: `+Array.prototype.slice.call(s).join("")+`
6
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}):Ve.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 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.addOutput("_calculationResults",new Z.NodeInterface("_calculationResults",void 0).setHidden(!0))}createProxyInterface(n,s){const a=new K(n.name,void 0);return new Proxy(a,{get:(o,i)=>{if(lu.includes(i)||i in o||typeof i=="string"&&i.startsWith("__v_"))return Reflect.get(o,i);let l;s?l=this.subgraph?.nodes.find(w=>Gn.isGraphInputNode(w)&&w.graphInterfaceId===n.id)?.outputs.placeholder.id:l=this.subgraph?.nodes.find(w=>jn.isGraphOutputNode(w)&&w.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 it extends Z.GraphTemplate{static fromGraph(t,n){return new it(t.save(),n)}constructor(t,n){super(t,n)}get shortId(){return this.id.slice(0,6)}createGraph(t){const n=new Map,s=_=>{const D=De.v4();return n.set(_,D),D},a=_=>{const D=n.get(_);if(!D)throw new Error(`Unable to create graph from template: Could not map old id ${_} to new id`);return D},o=_=>Eo(_,D=>({id:s(D.id),templateId:D.id,value:D.value})),i=this.nodes.map(_=>({..._,id:s(_.id),inputs:o(_.inputs),outputs:o(_.outputs)})),l=this.connections.map(_=>({id:s(_.id),from:a(_.from),to:a(_.to)})),d=this.inputs.map(_=>({id:_.id,name:_.name,nodeId:a(_.nodeId),nodeInterfaceId:a(_.nodeInterfaceId)})),c=this.outputs.map(_=>({id:_.id,name:_.name,nodeId:a(_.nodeId),nodeInterfaceId:a(_.nodeInterfaceId)})),h={id:De.v4(),nodes:i,connections:l,inputs:d,outputs:c};return t||(t=new ot(this.editor)),t.load(h).forEach(_=>console.warn(_)),t.template=this,t}}const du=e=>!(e instanceof ot);function Ra(e,t){return{switchGraph:s=>{let a;if(du(s))a=new ot(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 Gn{_title="Subgraph Input";inputs={_code:new K("_code","").use(G.setType,ne).setHidden(!0),name:new S.TextInputInterface("Name","Input").setPort(!1)};outputs={_code:new K("_code","").use(G.setType,ne).setHidden(!0),placeholder:new Z.NodeInterface("Connection",void 0)}}class Zn extends jn{_title="Subgraph Output";inputs={_code:new K("_code","").use(G.setType,ne).setHidden(!0),name:new S.TextInputInterface("Name","Output").setPort(!1),placeholder:new Z.NodeInterface("Connection",void 0)};outputs={_code:new K("_code","").use(G.setType,ne).setHidden(!0),output:new Z.NodeInterface("Output",void 0).setHidden(!0)}}const Pa="CREATE_SUBGRAPH",Ba=[Z.GRAPH_INPUT_NODE_TYPE,Z.GRAPH_OUTPUT_NODE_TYPE];function Va(e,t,n){const s=()=>e.value.selectedNodes.filter(o=>!Ba.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=>!Ba.includes(O.type)),c=d.flatMap(O=>Object.values(O.inputs)),h=d.flatMap(O=>Object.values(O.outputs)),w=i.connections.filter(O=>!h.includes(O.from)&&c.includes(O.to)),_=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)),k=d.map(O=>O.save()),M=D.map(O=>({id:O.id,from:O.from.id,to:O.to.id})),f=new Map,{xLeft:v,xRight:U,yTop:V}=cu(d);for(const[O,J]of w.entries()){const te=new zn;te.inputs.name.value=J.to.name,k.push({...te.save(),position:{x:U-o.value.settings.nodes.defaultWidth-100,y:V+O*200}}),M.push({id:De.v4(),from:te.outputs.placeholder.id,to:J.to.id}),f.set(J.to.id,te.graphInterfaceId)}for(const[O,J]of _.entries()){const te=new Zn;te.inputs.name.value=J.from.name,k.push({...te.save(),position:{x:v+100,y:V+O*200}}),M.push({id:De.v4(),from:J.from.id,to:te.inputs.placeholder.id}),f.set(J.from.id,te.graphInterfaceId)}const H=r.reactive(new it({connections:M,nodes:k,inputs:[],outputs:[]},l));l.addGraphTemplate(H);const Se=l.nodeTypes.get(Z.getGraphNodeTypeString(H));if(!Se)throw new Error("Unable to create subgraph: Could not find corresponding graph node type");i.activeTransactions++;const Oe=r.reactive(new Se.type);i.addNode(Oe);const lt=Math.round(d.map(O=>O.position.x).reduce((O,J)=>O+J,0)/d.length),_e=Math.round(d.map(O=>O.position.y).reduce((O,J)=>O+J,0)/d.length);Oe.position.x=lt,Oe.position.y=_e,w.forEach(O=>{i.removeConnection(O),i.addConnection(O.from,Oe.inputs[f.get(O.to.id)])}),_.forEach(O=>{i.removeConnection(O),i.addConnection(Oe.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(Pa,{canExecute:s,execute:a})}function cu(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 uu extends Z.Editor{code;graph;constructor(t){super(),this.code=t,this.graph=new ot(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=Ya(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 it(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 hu(e){const t=r.ref(e?.code??new ft),n=r.ref(e?.existingEditor??new uu(t.value)),s=Symbol("ViewModelToken"),a=r.ref(null),o=r.shallowReadonly(a),{switchGraph:i}=Ra(n,a),l=r.computed(()=>o.value&&o.value!==n.value.graph),d=r.reactive(S.DEFAULT_SETTINGS());d.nodes.defaultWidth=Pt;const c=S.useCommandHandler(),h=S.useHistory(o,c),w=S.useClipboard(o,n,c),_={renderNode:new Xn.SequentialHook(null),renderInterface:new Xn.SequentialHook(null)},D=r.reactive({clipboard:w,code:t,commandHandler:c,displayedGraph:o,editor:n,history:h,hooks:_,isSubgraph:l,onBeforeUnmount:()=>{},onMounted:()=>{},settings:d,switchGraph:i});return t.value.registerViewModel(D),Da(D),S.registerDeleteNodesCommand(o,c),Va(o,c,i),S.registerSaveSubgraphCommand(o,c),S.registerSwitchToMainGraphCommand(o,c,i),S.registerSidebarCommands(o,c),S.registerZoomToFitCommands(o,c,d),Ea(o,c,d),Ta(d),r.watch(n,(k,M)=>{M&&(M.events.registerGraph.unsubscribe(s),M.graphEvents.beforeAddNode.unsubscribe(s),k.nodeHooks.beforeLoad.unsubscribe(s),k.nodeHooks.afterSave.unsubscribe(s),k.graphTemplateHooks.beforeLoad.unsubscribe(s),k.graphTemplateHooks.afterSave.unsubscribe(s),k.graph.hooks.load.unsubscribe(s),k.graph.hooks.save.unsubscribe(s)),k&&(k.nodeHooks.beforeLoad.subscribe(s,(f,v)=>(v.position=f.position??{x:0,y:0},v.width=f.width??d.nodes.defaultWidth,v.twoColumn=f.twoColumn??!1,f)),k.nodeHooks.afterSave.subscribe(s,(f,v)=>(f.position=v.position,f.width=v.width,f.twoColumn=v.twoColumn,f)),k.graphTemplateHooks.beforeLoad.subscribe(s,(f,v)=>(v.panning=f.panning,v.scaling=f.scaling,f)),k.graphTemplateHooks.afterSave.subscribe(s,(f,v)=>(f.panning=v.panning,f.scaling=v.scaling,f)),k.graph.hooks.load.subscribe(s,(f,v)=>(v.panning=f.panning,v.scaling=f.scaling,f)),k.graph.hooks.save.subscribe(s,(f,v)=>(f.panning=v.panning,f.scaling=v.scaling,f)),k.graphEvents.beforeAddNode.subscribe(s,f=>S.setViewNodeProperties(f,{defaultWidth:d.nodes.defaultWidth})),n.value.registerNodeType(zn,{category:"Subgraphs"}),n.value.registerNodeType(Zn,{category:"Subgraphs"}),i(k.graph))},{immediate:!0}),D}const fu=Object.freeze(Object.defineProperty({__proto__:null,default:`{{ #modules }}
7
+ {{ /nodes }}`,this.events.update.emit(null)}renderCode(n){return this.subgraph?this.subgraph.renderCode({nodes:this.subgraph.scriptedCodeNodes}):Ve.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 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.addOutput("_calculationResults",new Z.NodeInterface("_calculationResults",void 0).setHidden(!0))}createProxyInterface(n,s){const a=new K(n.name,void 0);return new Proxy(a,{get:(o,i)=>{if(lu.includes(i)||i in o||typeof i=="string"&&i.startsWith("__v_"))return Reflect.get(o,i);let l;s?l=this.subgraph?.nodes.find(w=>Gn.isGraphInputNode(w)&&w.graphInterfaceId===n.id)?.outputs.placeholder.id:l=this.subgraph?.nodes.find(w=>jn.isGraphOutputNode(w)&&w.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 it extends Z.GraphTemplate{static fromGraph(t,n){return new it(t.save(),n)}constructor(t,n){super(t,n)}get shortId(){return this.id.slice(0,6)}createGraph(t){const n=new Map,s=_=>{const D=De.v4();return n.set(_,D),D},a=_=>{const D=n.get(_);if(!D)throw new Error(`Unable to create graph from template: Could not map old id ${_} to new id`);return D},o=_=>Eo(_,D=>({id:s(D.id),templateId:D.id,value:D.value})),i=this.nodes.map(_=>({..._,id:s(_.id),inputs:o(_.inputs),outputs:o(_.outputs)})),l=this.connections.map(_=>({id:s(_.id),from:a(_.from),to:a(_.to)})),d=this.inputs.map(_=>({id:_.id,name:_.name,nodeId:a(_.nodeId),nodeInterfaceId:a(_.nodeInterfaceId)})),c=this.outputs.map(_=>({id:_.id,name:_.name,nodeId:a(_.nodeId),nodeInterfaceId:a(_.nodeInterfaceId)})),h={id:De.v4(),nodes:i,connections:l,inputs:d,outputs:c};return t||(t=new ot(this.editor)),t.load(h).forEach(_=>console.warn(_)),t.template=this,t}}const du=e=>!(e instanceof ot);function Ra(e,t){return{switchGraph:s=>{let a;if(du(s))a=new ot(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 Gn{_title="Subgraph Input";inputs={_code:new K("_code","").use(G.setType,ne).setHidden(!0),name:new S.TextInputInterface("Name","Input").setPort(!1)};outputs={_code:new K("_code","").use(G.setType,ne).setHidden(!0),placeholder:new Z.NodeInterface("Connection",void 0)}}class Zn extends jn{_title="Subgraph Output";inputs={_code:new K("_code","").use(G.setType,ne).setHidden(!0),name:new S.TextInputInterface("Name","Output").setPort(!1),placeholder:new Z.NodeInterface("Connection",void 0)};outputs={_code:new K("_code","").use(G.setType,ne).setHidden(!0),output:new Z.NodeInterface("Output",void 0).setHidden(!0)}}const Pa="CREATE_SUBGRAPH",Ba=[Z.GRAPH_INPUT_NODE_TYPE,Z.GRAPH_OUTPUT_NODE_TYPE];function Va(e,t,n){const s=()=>e.value.selectedNodes.filter(o=>!Ba.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=>!Ba.includes(O.type)),c=d.flatMap(O=>Object.values(O.inputs)),h=d.flatMap(O=>Object.values(O.outputs)),w=i.connections.filter(O=>!h.includes(O.from)&&c.includes(O.to)),_=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)),k=d.map(O=>O.save()),M=D.map(O=>({id:O.id,from:O.from.id,to:O.to.id})),f=new Map,{xLeft:v,xRight:U,yTop:V}=cu(d);for(const[O,J]of w.entries()){const te=new zn;te.inputs.name.value=J.to.name,k.push({...te.save(),position:{x:U-o.value.settings.nodes.defaultWidth-100,y:V+O*200}}),M.push({id:De.v4(),from:te.outputs.placeholder.id,to:J.to.id}),f.set(J.to.id,te.graphInterfaceId)}for(const[O,J]of _.entries()){const te=new Zn;te.inputs.name.value=J.from.name,k.push({...te.save(),position:{x:v+100,y:V+O*200}}),M.push({id:De.v4(),from:J.from.id,to:te.inputs.placeholder.id}),f.set(J.from.id,te.graphInterfaceId)}const H=r.reactive(new it({connections:M,nodes:k,inputs:[],outputs:[]},l));l.addGraphTemplate(H);const Se=l.nodeTypes.get(Z.getGraphNodeTypeString(H));if(!Se)throw new Error("Unable to create subgraph: Could not find corresponding graph node type");i.activeTransactions++;const Oe=r.reactive(new Se.type);i.addNode(Oe);const lt=Math.round(d.map(O=>O.position.x).reduce((O,J)=>O+J,0)/d.length),_e=Math.round(d.map(O=>O.position.y).reduce((O,J)=>O+J,0)/d.length);Oe.position.x=lt,Oe.position.y=_e,w.forEach(O=>{i.removeConnection(O),i.addConnection(O.from,Oe.inputs[f.get(O.to.id)])}),_.forEach(O=>{i.removeConnection(O),i.addConnection(Oe.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(Pa,{canExecute:s,execute:a})}function cu(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 uu extends Z.Editor{code;graph;constructor(t){super(),this.code=t,this.graph=new ot(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=Ya(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 it(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 hu(e){const t=r.ref(e?.code??new ft),n=r.ref(e?.existingEditor??new uu(t.value)),s=Symbol("ViewModelToken"),a=r.ref(null),o=r.shallowReadonly(a),{switchGraph:i}=Ra(n,a),l=r.computed(()=>o.value&&o.value!==n.value.graph),d=r.reactive(S.DEFAULT_SETTINGS());d.nodes.defaultWidth=Pt;const c=S.useCommandHandler(),h=S.useHistory(o,c),w=S.useClipboard(o,n,c),_={renderNode:new Xn.SequentialHook(null),renderInterface:new Xn.SequentialHook(null)},D=r.reactive({clipboard:w,code:t,commandHandler:c,displayedGraph:o,editor:n,history:h,hooks:_,isReady:!1,isSubgraph:l,onBeforeUnmount:()=>{},onMounted:()=>{},settings:d,switchGraph:i});return t.value.registerViewModel(D),Da(D),S.registerDeleteNodesCommand(o,c),Va(o,c,i),S.registerSaveSubgraphCommand(o,c),S.registerSwitchToMainGraphCommand(o,c,i),S.registerSidebarCommands(o,c),S.registerZoomToFitCommands(o,c,d),Ea(o,c,d),Ta(d),r.watch(n,(k,M)=>{M&&(M.events.registerGraph.unsubscribe(s),M.graphEvents.beforeAddNode.unsubscribe(s),k.nodeHooks.beforeLoad.unsubscribe(s),k.nodeHooks.afterSave.unsubscribe(s),k.graphTemplateHooks.beforeLoad.unsubscribe(s),k.graphTemplateHooks.afterSave.unsubscribe(s),k.graph.hooks.load.unsubscribe(s),k.graph.hooks.save.unsubscribe(s)),k&&(k.nodeHooks.beforeLoad.subscribe(s,(f,v)=>(v.position=f.position??{x:0,y:0},v.width=f.width??d.nodes.defaultWidth,v.twoColumn=f.twoColumn??!1,f)),k.nodeHooks.afterSave.subscribe(s,(f,v)=>(f.position=v.position,f.width=v.width,f.twoColumn=v.twoColumn,f)),k.graphTemplateHooks.beforeLoad.subscribe(s,(f,v)=>(v.panning=f.panning,v.scaling=f.scaling,f)),k.graphTemplateHooks.afterSave.subscribe(s,(f,v)=>(f.panning=v.panning,f.scaling=v.scaling,f)),k.graph.hooks.load.subscribe(s,(f,v)=>(v.panning=f.panning,v.scaling=f.scaling,f)),k.graph.hooks.save.subscribe(s,(f,v)=>(f.panning=v.panning,f.scaling=v.scaling,f)),k.graphEvents.beforeAddNode.subscribe(s,f=>S.setViewNodeProperties(f,{defaultWidth:d.nodes.defaultWidth})),n.value.registerNodeType(zn,{category:"Subgraphs"}),n.value.registerNodeType(Zn,{category:"Subgraphs"}),i(k.graph))},{immediate:!0}),r.nextTick(()=>D.isReady=!0),D}const fu=Object.freeze(Object.defineProperty({__proto__:null,default:`{{ #modules }}
8
8
  {{ . }}
9
9
  {{ /modules }}
10
10
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@babsey/code-graph",
3
- "version": "0.6.0",
3
+ "version": "0.6.1",
4
4
  "author": "babsey <spreizer@web.de>",
5
5
  "license": "MIT",
6
6
  "type": "module",