diff --git a/main.js b/main.js index 689149d..6ad67c3 100644 --- a/main.js +++ b/main.js @@ -6,9 +6,9 @@ if you want to view the source, please visit the github repository of this plugi var A_e=Object.create;var fM=Object.defineProperty;var g_e=Object.getOwnPropertyDescriptor;var v_e=Object.getOwnPropertyNames;var y_e=Object.getPrototypeOf,b_e=Object.prototype.hasOwnProperty;var vn=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),dM=(e,t)=>{for(var r in t)fM(e,r,{get:t[r],enumerable:!0})},cM=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of v_e(t))!b_e.call(e,i)&&i!==r&&fM(e,i,{get:()=>t[i],enumerable:!(n=g_e(t,i))||n.enumerable});return e},li=(e,t,r)=>(cM(e,t,"default"),r&&cM(r,t,"default")),Ae=(e,t,r)=>(r=e!=null?A_e(y_e(e)):{},cM(t||!e||!e.__esModule?fM(r,"default",{value:e,enumerable:!0}):r,e)),x_e=e=>cM(fM({},"__esModule",{value:!0}),e);var w_e=(()=>{for(var e=new Uint8Array(128),t=0;t<64;t++)e[t<26?t+65:t<52?t+71:t<62?t-4:t*4-205]=t;return r=>{for(var n=r.length,i=new Uint8Array((n-(r[n-1]=="=")-(r[n-2]=="="))*3/4|0),a=0,o=0;a>4,i[o++]=l<<4|u>>2,i[o++]=u<<6|c}return i}})();var Ya=vn((Dnt,pM)=>{(function(){"use strict";var e={}.hasOwnProperty;function t(){for(var i="",a=0;a{(function(e,t){typeof Y$=="object"&&typeof Ex<"u"?Ex.exports=t():typeof define=="function"&&define.amd?define(t):e.moment=t()})(Y$,function(){"use strict";var e;function t(){return e.apply(null,arguments)}function r(M){e=M}function n(M){return M instanceof Array||Object.prototype.toString.call(M)==="[object Array]"}function i(M){return M!=null&&Object.prototype.toString.call(M)==="[object Object]"}function a(M,B){return Object.prototype.hasOwnProperty.call(M,B)}function o(M){if(Object.getOwnPropertyNames)return Object.getOwnPropertyNames(M).length===0;var B;for(B in M)if(a(M,B))return!1;return!0}function s(M){return M===void 0}function l(M){return typeof M=="number"||Object.prototype.toString.call(M)==="[object Number]"}function u(M){return M instanceof Date||Object.prototype.toString.call(M)==="[object Date]"}function c(M,B){var X=[],ne,de=M.length;for(ne=0;ne>>0,ne;for(ne=0;ne0)for(X=0;X=0;return(Re?X?"+":"":"-")+Math.pow(10,Math.max(0,de)).toString().substr(1)+ne}var _=/(\[[^\[]*\])|(\\)?([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,Y=/(\[[^\[]*\])|(\\)?(LTS|LT|LL?L?L?|l{1,4})/g,oe={},te={};function Q(M,B,X,ne){var de=ne;typeof ne=="string"&&(de=function(){return this[ne]()}),M&&(te[M]=de),B&&(te[B[0]]=function(){return L(de.apply(this,arguments),B[1],B[2])}),X&&(te[X]=function(){return this.localeData().ordinal(de.apply(this,arguments),M)})}function fe(M){return M.match(/\[[\s\S]/)?M.replace(/^\[|\]$/g,""):M.replace(/\\/g,"")}function Ie(M){var B=M.match(_),X,ne;for(X=0,ne=B.length;X=0&&Y.test(M);)M=M.replace(Y,ne),Y.lastIndex=0,X-=1;return M}var ve={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 ye(M){var B=this._longDateFormat[M],X=this._longDateFormat[M.toUpperCase()];return B||!X?B:(this._longDateFormat[M]=X.match(_).map(function(ne){return ne==="MMMM"||ne==="MM"||ne==="DD"||ne==="dddd"?ne.slice(1):ne}).join(""),this._longDateFormat[M])}var me="Invalid date";function ke(){return this._invalidDate}var $="%d",ae=/\d{1,2}/;function ce(M){return this._ordinal.replace("%d",M)}var U={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 R(M,B,X,ne){var de=this._relativeTime[X];return N(de)?de(M,B,X,ne):de.replace(/%d/i,M)}function J(M,B){var X=this._relativeTime[M>0?"future":"past"];return N(X)?X(B):X.replace(/%s/i,B)}var ee={};function ie(M,B){var X=M.toLowerCase();ee[X]=ee[X+"s"]=ee[B]=M}function re(M){return typeof M=="string"?ee[M]||ee[M.toLowerCase()]:void 0}function Ee(M){var B={},X,ne;for(ne in M)a(M,ne)&&(X=re(ne),X&&(B[X]=M[ne]));return B}var Ce={};function _e(M,B){Ce[M]=B}function he(M){var B=[],X;for(X in M)a(M,X)&&B.push({unit:X,priority:Ce[X]});return B.sort(function(ne,de){return ne.priority-de.priority}),B}function ze(M){return M%4===0&&M%100!==0||M%400===0}function Ye(M){return M<0?Math.ceil(M)||0:Math.floor(M)}function tt(M){var B=+M,X=0;return B!==0&&isFinite(B)&&(X=Ye(B)),X}function Ct(M,B){return function(X){return X!=null?(Be(this,M,X),t.updateOffset(this,B),this):we(this,M)}}function we(M,B){return M.isValid()?M._d["get"+(M._isUTC?"UTC":"")+B]():NaN}function Be(M,B,X){M.isValid()&&!isNaN(X)&&(B==="FullYear"&&ze(M.year())&&M.month()===1&&M.date()===29?(X=tt(X),M._d["set"+(M._isUTC?"UTC":"")+B](X,M.month(),Hf(X,M.month()))):M._d["set"+(M._isUTC?"UTC":"")+B](X))}function Le(M){return M=re(M),N(this[M])?this[M]():this}function Ze(M,B){if(typeof M=="object"){M=Ee(M);var X=he(M),ne,de=X.length;for(ne=0;ne68?1900:2e3)};var ll=Ct("FullYear",!0);function r1(){return ze(this.year())}function n1(M,B,X,ne,de,Re,Je){var ar;return M<100&&M>=0?(ar=new Date(M+400,B,X,ne,de,Re,Je),isFinite(ar.getFullYear())&&ar.setFullYear(M)):ar=new Date(M,B,X,ne,de,Re,Je),ar}function ym(M){var B,X;return M<100&&M>=0?(X=Array.prototype.slice.call(arguments),X[0]=M+400,B=new Date(Date.UTC.apply(null,X)),isFinite(B.getUTCFullYear())&&B.setUTCFullYear(M)):B=new Date(Date.UTC.apply(null,arguments)),B}function Gf(M,B,X){var ne=7+B-X,de=(7+ym(M,0,ne).getUTCDay()-B)%7;return-de+ne-1}function i1(M,B,X,ne,de){var Re=(7+X-ne)%7,Je=Gf(M,ne,de),ar=1+7*(B-1)+Re+Je,Hr,Jn;return ar<=0?(Hr=M-1,Jn=ku(Hr)+ar):ar>ku(M)?(Hr=M+1,Jn=ar-ku(M)):(Hr=M,Jn=ar),{year:Hr,dayOfYear:Jn}}function Qf(M,B,X){var ne=Gf(M.year(),B,X),de=Math.floor((M.dayOfYear()-ne-1)/7)+1,Re,Je;return de<1?(Je=M.year()-1,Re=de+Hl(Je,B,X)):de>Hl(M.year(),B,X)?(Re=de-Hl(M.year(),B,X),Je=M.year()+1):(Je=M.year(),Re=de),{week:Re,year:Je}}function Hl(M,B,X){var ne=Gf(M,B,X),de=Gf(M+1,B,X);return(ku(M)-ne+de)/7}Q("w",["ww",2],"wo","week"),Q("W",["WW",2],"Wo","isoWeek"),ie("week","w"),ie("isoWeek","W"),_e("week",5),_e("isoWeek",5),Dt("w",ue),Dt("ww",ue,Qe),Dt("W",ue),Dt("WW",ue,Qe),Ul(["w","ww","W","WW"],function(M,B,X,ne){B[ne.substr(0,1)]=tt(M)});function Yh(M){return Qf(M,this._week.dow,this._week.doy).week}var ul={dow:0,doy:6};function jg(){return this._week.dow}function Ng(){return this._week.doy}function Zh(M){var B=this.localeData().week(this);return M==null?B:this.add((M-B)*7,"d")}function qb(M){var B=Qf(this,1,4).week;return M==null?B:this.add((M-B)*7,"d")}Q("d",0,"do","day"),Q("dd",0,0,function(M){return this.localeData().weekdaysMin(this,M)}),Q("ddd",0,0,function(M){return this.localeData().weekdaysShort(this,M)}),Q("dddd",0,0,function(M){return this.localeData().weekdays(this,M)}),Q("e",0,0,"weekday"),Q("E",0,0,"isoWeekday"),ie("day","d"),ie("weekday","e"),ie("isoWeekday","E"),_e("day",11),_e("weekday",11),_e("isoWeekday",11),Dt("d",ue),Dt("e",ue),Dt("E",ue),Dt("dd",function(M,B){return B.weekdaysMinRegex(M)}),Dt("ddd",function(M,B){return B.weekdaysShortRegex(M)}),Dt("dddd",function(M,B){return B.weekdaysRegex(M)}),Ul(["dd","ddd","dddd"],function(M,B,X,ne){var de=X._locale.weekdaysParse(M,ne,X._strict);de!=null?B.d=de:h(X).invalidWeekday=M}),Ul(["d","e","E"],function(M,B,X,ne){B[ne]=tt(M)});function Lb(M,B){return typeof M!="string"?M:isNaN(M)?(M=B.weekdaysParse(M),typeof M=="number"?M:null):parseInt(M,10)}function Tg(M,B){return typeof M=="string"?B.weekdaysParse(M)%7||7:isNaN(M)?null:M}function Fg(M,B){return M.slice(B,7).concat(M.slice(0,B))}var zb="Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),Ub="Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_"),Wb="Su_Mo_Tu_We_Th_Fr_Sa".split("_"),Xh=Qi,_g=Qi,Hb=Qi;function Kh(M,B){var X=n(this._weekdays)?this._weekdays:this._weekdays[M&&M!==!0&&this._weekdays.isFormat.test(B)?"format":"standalone"];return M===!0?Fg(X,this._week.dow):M?X[M.day()]:X}function Jh(M){return M===!0?Fg(this._weekdaysShort,this._week.dow):M?this._weekdaysShort[M.day()]:this._weekdaysShort}function Cu(M){return M===!0?Fg(this._weekdaysMin,this._week.dow):M?this._weekdaysMin[M.day()]:this._weekdaysMin}function Pg(M,B,X){var ne,de,Re,Je=M.toLocaleLowerCase();if(!this._weekdaysParse)for(this._weekdaysParse=[],this._shortWeekdaysParse=[],this._minWeekdaysParse=[],ne=0;ne<7;++ne)Re=d([2e3,1]).day(ne),this._minWeekdaysParse[ne]=this.weekdaysMin(Re,"").toLocaleLowerCase(),this._shortWeekdaysParse[ne]=this.weekdaysShort(Re,"").toLocaleLowerCase(),this._weekdaysParse[ne]=this.weekdays(Re,"").toLocaleLowerCase();return X?B==="dddd"?(de=_n.call(this._weekdaysParse,Je),de!==-1?de:null):B==="ddd"?(de=_n.call(this._shortWeekdaysParse,Je),de!==-1?de:null):(de=_n.call(this._minWeekdaysParse,Je),de!==-1?de:null):B==="dddd"?(de=_n.call(this._weekdaysParse,Je),de!==-1||(de=_n.call(this._shortWeekdaysParse,Je),de!==-1)?de:(de=_n.call(this._minWeekdaysParse,Je),de!==-1?de:null)):B==="ddd"?(de=_n.call(this._shortWeekdaysParse,Je),de!==-1||(de=_n.call(this._weekdaysParse,Je),de!==-1)?de:(de=_n.call(this._minWeekdaysParse,Je),de!==-1?de:null)):(de=_n.call(this._minWeekdaysParse,Je),de!==-1||(de=_n.call(this._weekdaysParse,Je),de!==-1)?de:(de=_n.call(this._shortWeekdaysParse,Je),de!==-1?de:null))}function Vb(M,B,X){var ne,de,Re;if(this._weekdaysParseExact)return Pg.call(this,M,B,X);for(this._weekdaysParse||(this._weekdaysParse=[],this._minWeekdaysParse=[],this._shortWeekdaysParse=[],this._fullWeekdaysParse=[]),ne=0;ne<7;ne++){if(de=d([2e3,1]).day(ne),X&&!this._fullWeekdaysParse[ne]&&(this._fullWeekdaysParse[ne]=new RegExp("^"+this.weekdays(de,"").replace(".","\\.?")+"$","i"),this._shortWeekdaysParse[ne]=new RegExp("^"+this.weekdaysShort(de,"").replace(".","\\.?")+"$","i"),this._minWeekdaysParse[ne]=new RegExp("^"+this.weekdaysMin(de,"").replace(".","\\.?")+"$","i")),this._weekdaysParse[ne]||(Re="^"+this.weekdays(de,"")+"|^"+this.weekdaysShort(de,"")+"|^"+this.weekdaysMin(de,""),this._weekdaysParse[ne]=new RegExp(Re.replace(".",""),"i")),X&&B==="dddd"&&this._fullWeekdaysParse[ne].test(M))return ne;if(X&&B==="ddd"&&this._shortWeekdaysParse[ne].test(M))return ne;if(X&&B==="dd"&&this._minWeekdaysParse[ne].test(M))return ne;if(!X&&this._weekdaysParse[ne].test(M))return ne}}function W(M){if(!this.isValid())return M!=null?this:NaN;var B=this._isUTC?this._d.getUTCDay():this._d.getDay();return M!=null?(M=Lb(M,this.localeData()),this.add(M-B,"d")):B}function K(M){if(!this.isValid())return M!=null?this:NaN;var B=(this.day()+7-this.localeData()._week.dow)%7;return M==null?B:this.add(M-B,"d")}function se(M){if(!this.isValid())return M!=null?this:NaN;if(M!=null){var B=Tg(M,this.localeData());return this.day(this.day()%7?B:B-7)}else return this.day()||7}function xe(M){return this._weekdaysParseExact?(a(this,"_weekdaysRegex")||ot.call(this),M?this._weekdaysStrictRegex:this._weekdaysRegex):(a(this,"_weekdaysRegex")||(this._weekdaysRegex=Xh),this._weekdaysStrictRegex&&M?this._weekdaysStrictRegex:this._weekdaysRegex)}function je(M){return this._weekdaysParseExact?(a(this,"_weekdaysRegex")||ot.call(this),M?this._weekdaysShortStrictRegex:this._weekdaysShortRegex):(a(this,"_weekdaysShortRegex")||(this._weekdaysShortRegex=_g),this._weekdaysShortStrictRegex&&M?this._weekdaysShortStrictRegex:this._weekdaysShortRegex)}function Ke(M){return this._weekdaysParseExact?(a(this,"_weekdaysRegex")||ot.call(this),M?this._weekdaysMinStrictRegex:this._weekdaysMinRegex):(a(this,"_weekdaysMinRegex")||(this._weekdaysMinRegex=Hb),this._weekdaysMinStrictRegex&&M?this._weekdaysMinStrictRegex:this._weekdaysMinRegex)}function ot(){function M(fl,td){return td.length-fl.length}var B=[],X=[],ne=[],de=[],Re,Je,ar,Hr,Jn;for(Re=0;Re<7;Re++)Je=d([2e3,1]).day(Re),ar=Va(this.weekdaysMin(Je,"")),Hr=Va(this.weekdaysShort(Je,"")),Jn=Va(this.weekdays(Je,"")),B.push(ar),X.push(Hr),ne.push(Jn),de.push(ar),de.push(Hr),de.push(Jn);B.sort(M),X.sort(M),ne.sort(M),de.sort(M),this._weekdaysRegex=new RegExp("^("+de.join("|")+")","i"),this._weekdaysShortRegex=this._weekdaysRegex,this._weekdaysMinRegex=this._weekdaysRegex,this._weekdaysStrictRegex=new RegExp("^("+ne.join("|")+")","i"),this._weekdaysShortStrictRegex=new RegExp("^("+X.join("|")+")","i"),this._weekdaysMinStrictRegex=new RegExp("^("+B.join("|")+")","i")}function xr(){return this.hours()%12||12}function Pn(){return this.hours()||24}Q("H",["HH",2],0,"hour"),Q("h",["hh",2],0,xr),Q("k",["kk",2],0,Pn),Q("hmm",0,0,function(){return""+xr.apply(this)+L(this.minutes(),2)}),Q("hmmss",0,0,function(){return""+xr.apply(this)+L(this.minutes(),2)+L(this.seconds(),2)}),Q("Hmm",0,0,function(){return""+this.hours()+L(this.minutes(),2)}),Q("Hmmss",0,0,function(){return""+this.hours()+L(this.minutes(),2)+L(this.seconds(),2)});function sn(M,B){Q(M,0,0,function(){return this.localeData().meridiem(this.hours(),this.minutes(),B)})}sn("a",!0),sn("A",!1),ie("hour","h"),_e("hour",13);function aa(M,B){return B._meridiemParse}Dt("a",aa),Dt("A",aa),Dt("H",ue),Dt("h",ue),Dt("k",ue),Dt("HH",ue,Qe),Dt("hh",ue,Qe),Dt("kk",ue,Qe),Dt("hmm",Pe),Dt("hmmss",De),Dt("Hmm",Pe),Dt("Hmmss",De),Yr(["H","HH"],ia),Yr(["k","kk"],function(M,B,X){var ne=tt(M);B[ia]=ne===24?0:ne}),Yr(["a","A"],function(M,B,X){X._isPm=X._locale.isPM(M),X._meridiem=M}),Yr(["h","hh"],function(M,B,X){B[ia]=tt(M),h(X).bigHour=!0}),Yr("hmm",function(M,B,X){var ne=M.length-2;B[ia]=tt(M.substr(0,ne)),B[Fs]=tt(M.substr(ne)),h(X).bigHour=!0}),Yr("hmmss",function(M,B,X){var ne=M.length-4,de=M.length-2;B[ia]=tt(M.substr(0,ne)),B[Fs]=tt(M.substr(ne,2)),B[Wl]=tt(M.substr(de)),h(X).bigHour=!0}),Yr("Hmm",function(M,B,X){var ne=M.length-2;B[ia]=tt(M.substr(0,ne)),B[Fs]=tt(M.substr(ne))}),Yr("Hmmss",function(M,B,X){var ne=M.length-4,de=M.length-2;B[ia]=tt(M.substr(0,ne)),B[Fs]=tt(M.substr(ne,2)),B[Wl]=tt(M.substr(de))});function Ju(M){return(M+"").toLowerCase().charAt(0)==="p"}var Gb=/[ap]\.?m?\.?/i,co=Ct("Hours",!0);function Ig(M,B,X){return M>11?X?"pm":"PM":X?"am":"AM"}var Yf={calendar:I,longDateFormat:ve,invalidDate:me,ordinal:$,dayOfMonthOrdinalParse:ae,relativeTime:U,months:Dg,monthsShort:Vh,week:ul,weekdays:zb,weekdaysMin:Wb,weekdaysShort:Ub,meridiemParse:Gb},gi={},lp={},Lo;function Qb(M,B){var X,ne=Math.min(M.length,B.length);for(X=0;X0;){if(de=eA(Re.slice(0,X).join("-")),de)return de;if(ne&&ne.length>=X&&Qb(Re,ne)>=X-1)break;X--}B++}return Lo}function Zb(M){return M.match("^[^/\\\\]*$")!=null}function eA(M){var B=null,X;if(gi[M]===void 0&&typeof Ex<"u"&&Ex&&Ex.exports&&Zb(M))try{B=Lo._abbr,X=require,X("./locale/"+M),Qc(B)}catch{gi[M]=null}return gi[M]}function Qc(M,B){var X;return M&&(s(B)?X=Ba(M):X=zo(M,B),X?Lo=X:typeof console<"u"&&console.warn&&console.warn("Locale "+M+" not found. Did you forget to load it?")),Lo._abbr}function zo(M,B){if(B!==null){var X,ne=Yf;if(B.abbr=M,gi[M]!=null)C("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."),ne=gi[M]._config;else if(B.parentLocale!=null)if(gi[B.parentLocale]!=null)ne=gi[B.parentLocale]._config;else if(X=eA(B.parentLocale),X!=null)ne=X._config;else return lp[B.parentLocale]||(lp[B.parentLocale]=[]),lp[B.parentLocale].push({name:M,config:B}),null;return gi[M]=new q(P(ne,B)),lp[M]&&lp[M].forEach(function(de){zo(de.name,de.config)}),Qc(M),gi[M]}else return delete gi[M],null}function NE(M,B){if(B!=null){var X,ne,de=Yf;gi[M]!=null&&gi[M].parentLocale!=null?gi[M].set(P(gi[M]._config,B)):(ne=eA(M),ne!=null&&(de=ne._config),B=P(de,B),ne==null&&(B.abbr=M),X=new q(B),X.parentLocale=gi[M],gi[M]=X),Qc(M)}else gi[M]!=null&&(gi[M].parentLocale!=null?(gi[M]=gi[M].parentLocale,M===Qc()&&Qc(M)):gi[M]!=null&&delete gi[M]);return gi[M]}function Ba(M){var B;if(M&&M._locale&&M._locale._abbr&&(M=M._locale._abbr),!M)return Lo;if(!n(M)){if(B=eA(M),B)return B;M=[M]}return Yb(M)}function TE(){return z(gi)}function Bg(M){var B,X=M._a;return X&&h(M).overflow===-2&&(B=X[is]<0||X[is]>11?is:X[Ts]<1||X[Ts]>Hf(X[fi],X[is])?Ts:X[ia]<0||X[ia]>24||X[ia]===24&&(X[Fs]!==0||X[Wl]!==0||X[ol]!==0)?ia:X[Fs]<0||X[Fs]>59?Fs:X[Wl]<0||X[Wl]>59?Wl:X[ol]<0||X[ol]>999?ol:-1,h(M)._overflowDayOfYear&&(BTs)&&(B=Ts),h(M)._overflowWeeks&&B===-1&&(B=kg),h(M)._overflowWeekday&&B===-1&&(B=Vc),h(M).overflow=B),M}var Zf=/^\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)?)?$/,Rg=/^\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)?)?$/,o1=/Z|[+-]\d\d(?::?\d\d)?/,si=[["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]],ec=[["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/]],s1=/^\/?Date\((-?\d+)/i,FE=/^(?:(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}))$/,l1={UT:0,GMT:0,EDT:-4*60,EST:-5*60,CDT:-5*60,CST:-6*60,MDT:-6*60,MST:-7*60,PDT:-7*60,PST:-8*60};function Xb(M){var B,X,ne=M._i,de=Zf.exec(ne)||Rg.exec(ne),Re,Je,ar,Hr,Jn=si.length,fl=ec.length;if(de){for(h(M).iso=!0,B=0,X=Jn;Bku(Je)||M._dayOfYear===0)&&(h(M)._overflowDayOfYear=!0),X=ym(Je,0,M._dayOfYear),M._a[is]=X.getUTCMonth(),M._a[Ts]=X.getUTCDate()),B=0;B<3&&M._a[B]==null;++B)M._a[B]=ne[B]=de[B];for(;B<7;B++)M._a[B]=ne[B]=M._a[B]==null?B===2?1:0:M._a[B];M._a[ia]===24&&M._a[Fs]===0&&M._a[Wl]===0&&M._a[ol]===0&&(M._nextDay=!0,M._a[ia]=0),M._d=(M._useUTC?ym:n1).apply(null,ne),Re=M._useUTC?M._d.getUTCDay():M._d.getDay(),M._tzm!=null&&M._d.setUTCMinutes(M._d.getUTCMinutes()-M._tzm),M._nextDay&&(M._a[ia]=24),M._w&&typeof M._w.d<"u"&&M._w.d!==Re&&(h(M).weekdayMismatch=!0)}}function Jt(M){var B,X,ne,de,Re,Je,ar,Hr,Jn;B=M._w,B.GG!=null||B.W!=null||B.E!=null?(Re=1,Je=4,X=up(B.GG,M._a[fi],Qf(On(),1,4).year),ne=up(B.W,1),de=up(B.E,1),(de<1||de>7)&&(Hr=!0)):(Re=M._locale._week.dow,Je=M._locale._week.doy,Jn=Qf(On(),Re,Je),X=up(B.gg,M._a[fi],Jn.year),ne=up(B.w,Jn.week),B.d!=null?(de=B.d,(de<0||de>6)&&(Hr=!0)):B.e!=null?(de=B.e+Re,(B.e<0||B.e>6)&&(Hr=!0)):de=Re),ne<1||ne>Hl(X,Re,Je)?h(M)._overflowWeeks=!0:Hr!=null?h(M)._overflowWeekday=!0:(ar=i1(X,ne,de,Re,Je),M._a[fi]=ar.year,M._dayOfYear=ar.dayOfYear)}t.ISO_8601=function(){},t.RFC_2822=function(){};function hr(M){if(M._f===t.ISO_8601){Xb(M);return}if(M._f===t.RFC_2822){tA(M);return}M._a=[],h(M).empty=!0;var B=""+M._i,X,ne,de,Re,Je,ar=B.length,Hr=0,Jn,fl;for(de=Oe(M._f,M._locale).match(_)||[],fl=de.length,X=0;X0&&h(M).unusedInput.push(Je),B=B.slice(B.indexOf(ne)+ne.length),Hr+=ne.length),te[Re]?(ne?h(M).empty=!1:h(M).unusedTokens.push(Re),Am(Re,ne,M)):M._strict&&!ne&&h(M).unusedTokens.push(Re);h(M).charsLeftOver=ar-Hr,B.length>0&&h(M).unusedInput.push(B),M._a[ia]<=12&&h(M).bigHour===!0&&M._a[ia]>0&&(h(M).bigHour=void 0),h(M).parsedDateParts=M._a.slice(0),h(M).meridiem=M._meridiem,M._a[ia]=Ur(M._locale,M._a[ia],M._meridiem),Jn=h(M).era,Jn!==null&&(M._a[fi]=M._locale.erasConvertYear(Jn,M._a[fi])),ft(M),Bg(M)}function Ur(M,B,X){var ne;return X==null?B:M.meridiemHour!=null?M.meridiemHour(B,X):(M.isPM!=null&&(ne=M.isPM(X),ne&&B<12&&(B+=12),!ne&&B===12&&(B=0)),B)}function Dn(M){var B,X,ne,de,Re,Je,ar=!1,Hr=M._f.length;if(Hr===0){h(M).invalidFormat=!0,M._d=new Date(NaN);return}for(de=0;dethis?this:M:A()});function yO(M,B){var X,ne;if(B.length===1&&n(B[0])&&(B=B[0]),!B.length)return On();for(X=B[0],ne=1;nethis.clone().month(0).utcOffset()||this.utcOffset()>this.clone().month(5).utcOffset()}function rt(){if(!s(this._isDSTShifted))return this._isDSTShifted;var M={},B;return x(M,this),M=Oi(M),M._a?(B=M._isUTC?d(M._a):On(M._a),this._isDSTShifted=this.isValid()&&xR(M._a,B.toArray())>0):this._isDSTShifted=!1,this._isDSTShifted}function Xe(){return this.isValid()?!this._isUTC:!1}function Ut(){return this.isValid()?this._isUTC:!1}function Fr(){return this.isValid()?this._isUTC&&this._offset===0:!1}var Kn=/^(-|\+)?(?:(\d*)[. ])?(\d+):(\d+)(?::(\d+)(\.\d*)?)?$/,ko=/^(-|\+)?P(?:([-+]?[0-9,.]*)Y)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)W)?(?:([-+]?[0-9,.]*)D)?(?:T(?:([-+]?[0-9,.]*)H)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)S)?)?$/;function ln(M,B){var X=M,ne=null,de,Re,Je;return Yc(M)?X={ms:M._milliseconds,d:M._days,M:M._months}:l(M)||!isNaN(+M)?(X={},B?X[B]=+M:X.milliseconds=+M):(ne=Kn.exec(M))?(de=ne[1]==="-"?-1:1,X={y:0,d:tt(ne[Ts])*de,h:tt(ne[ia])*de,m:tt(ne[Fs])*de,s:tt(ne[Wl])*de,ms:tt(qg(ne[ol]*1e3))*de}):(ne=ko.exec(M))?(de=ne[1]==="-"?-1:1,X={y:cp(ne[2],de),M:cp(ne[3],de),w:cp(ne[4],de),d:cp(ne[5],de),h:cp(ne[6],de),m:cp(ne[7],de),s:cp(ne[8],de)}):X==null?X={}:typeof X=="object"&&("from"in X||"to"in X)&&(Je=nc(On(X.from),On(X.to)),X={},X.ms=Je.milliseconds,X.M=Je.months),Re=new c1(X),Yc(M)&&a(M,"_locale")&&(Re._locale=M._locale),Yc(M)&&a(M,"_isValid")&&(Re._isValid=M._isValid),Re}ln.fn=c1.prototype,ln.invalid=PE;function cp(M,B){var X=M&&parseFloat(M.replace(",","."));return(isNaN(X)?0:X)*B}function xO(M,B){var X={};return X.months=B.month()-M.month()+(B.year()-M.year())*12,M.clone().add(X.months,"M").isAfter(B)&&--X.months,X.milliseconds=+B-+M.clone().add(X.months,"M"),X}function nc(M,B){var X;return M.isValid()&&B.isValid()?(B=Du(B,M),M.isBefore(B)?X=xO(M,B):(X=xO(B,M),X.milliseconds=-X.milliseconds,X.months=-X.months),X):{milliseconds:0,months:0}}function f1(M,B){return function(X,ne){var de,Re;return ne!==null&&!isNaN(+ne)&&(C(B,"moment()."+B+"(period, number) is deprecated. Please use moment()."+B+"(number, period). See http://momentjs.com/guides/#/warnings/add-inverted-param/ for more info."),Re=X,X=ne,ne=Re),de=ln(X,ne),wO(this,de,M),this}}function wO(M,B,X,ne){var de=B._milliseconds,Re=qg(B._days),Je=qg(B._months);!M.isValid()||(ne=ne??!0,Je&&Cn(M,we(M,"Month")+Je*X),Re&&Be(M,"Date",we(M,"Date")+Re*X),de&&M._d.setTime(M._d.valueOf()+de*X),ne&&t.updateOffset(M,Re||Je))}var Lg=f1(1,"add"),rx=f1(-1,"subtract");function d1(M){return typeof M=="string"||M instanceof String}function di(M){return S(M)||u(M)||d1(M)||l(M)||SO(M)||OR(M)||M===null||M===void 0}function OR(M){var B=i(M)&&!o(M),X=!1,ne=["years","year","y","months","month","M","days","day","d","dates","date","D","hours","hour","h","minutes","minute","m","seconds","second","s","milliseconds","millisecond","ms"],de,Re,Je=ne.length;for(de=0;deX.valueOf():X.valueOf()9999?Se(X,B?"YYYYYY-MM-DD[T]HH:mm:ss.SSS[Z]":"YYYYYY-MM-DD[T]HH:mm:ss.SSSZ"):N(Date.prototype.toISOString)?B?this.toDate().toISOString():new Date(this.valueOf()+this.utcOffset()*60*1e3).toISOString().replace("Z",Se(X,"Z")):Se(X,B?"YYYY-MM-DD[T]HH:mm:ss.SSS[Z]":"YYYY-MM-DD[T]HH:mm:ss.SSSZ")}function nA(){if(!this.isValid())return"moment.invalid(/* "+this._i+" */)";var M="moment",B="",X,ne,de,Re;return this.isLocal()||(M=this.utcOffset()===0?"moment.utc":"moment.parseZone",B="Z"),X="["+M+'("]',ne=0<=this.year()&&this.year()<=9999?"YYYY":"YYYYYY",de="-MM-DD[T]HH:mm:ss.SSS",Re=B+'[")]',this.format(X+ne+de+Re)}function sx(M){M||(M=this.isUtc()?t.defaultFormatUtc:t.defaultFormat);var B=Se(this,M);return this.localeData().postformat(B)}function TR(M,B){return this.isValid()&&(S(M)&&M.isValid()||On(M).isValid())?ln({to:this,from:M}).locale(this.locale()).humanize(!B):this.localeData().invalidDate()}function FR(M){return this.from(On(),M)}function _R(M,B){return this.isValid()&&(S(M)&&M.isValid()||On(M).isValid())?ln({from:this,to:M}).locale(this.locale()).humanize(!B):this.localeData().invalidDate()}function lx(M){return this.to(On(),M)}function m1(M){var B;return M===void 0?this._locale._abbr:(B=Ba(M),B!=null&&(this._locale=B),this)}var ux=j("moment().lang() is deprecated. Instead, use moment().localeData() to get the language configuration. Use moment().locale() to change languages.",function(M){return M===void 0?this.localeData():this.locale(M)});function OO(){return this._locale}var h1=1e3,zg=60*h1,cx=60*zg,fo=(365*400+97)*24*cx;function Ga(M,B){return(M%B+B)%B}function MO(M,B,X){return M<100&&M>=0?new Date(M+400,B,X)-fo:new Date(M,B,X).valueOf()}function jO(M,B,X){return M<100&&M>=0?Date.UTC(M+400,B,X)-fo:Date.UTC(M,B,X)}function NO(M){var B,X;if(M=re(M),M===void 0||M==="millisecond"||!this.isValid())return this;switch(X=this._isUTC?jO:MO,M){case"year":B=X(this.year(),0,1);break;case"quarter":B=X(this.year(),this.month()-this.month()%3,1);break;case"month":B=X(this.year(),this.month(),1);break;case"week":B=X(this.year(),this.month(),this.date()-this.weekday());break;case"isoWeek":B=X(this.year(),this.month(),this.date()-(this.isoWeekday()-1));break;case"day":case"date":B=X(this.year(),this.month(),this.date());break;case"hour":B=this._d.valueOf(),B-=Ga(B+(this._isUTC?0:this.utcOffset()*zg),cx);break;case"minute":B=this._d.valueOf(),B-=Ga(B,zg);break;case"second":B=this._d.valueOf(),B-=Ga(B,h1);break}return this._d.setTime(B),t.updateOffset(this,!0),this}function PR(M){var B,X;if(M=re(M),M===void 0||M==="millisecond"||!this.isValid())return this;switch(X=this._isUTC?jO:MO,M){case"year":B=X(this.year()+1,0,1)-1;break;case"quarter":B=X(this.year(),this.month()-this.month()%3+3,1)-1;break;case"month":B=X(this.year(),this.month()+1,1)-1;break;case"week":B=X(this.year(),this.month(),this.date()-this.weekday()+7)-1;break;case"isoWeek":B=X(this.year(),this.month(),this.date()-(this.isoWeekday()-1)+7)-1;break;case"day":case"date":B=X(this.year(),this.month(),this.date()+1)-1;break;case"hour":B=this._d.valueOf(),B+=cx-Ga(B+(this._isUTC?0:this.utcOffset()*zg),cx)-1;break;case"minute":B=this._d.valueOf(),B+=zg-Ga(B,zg)-1;break;case"second":B=this._d.valueOf(),B+=h1-Ga(B,h1)-1;break}return this._d.setTime(B),t.updateOffset(this,!0),this}function IE(){return this._d.valueOf()-(this._offset||0)*6e4}function A1(){return Math.floor(this.valueOf()/1e3)}function BE(){return new Date(this.valueOf())}function Ug(){var M=this;return[M.year(),M.month(),M.date(),M.hour(),M.minute(),M.second(),M.millisecond()]}function g1(){var M=this;return{years:M.year(),months:M.month(),date:M.date(),hours:M.hours(),minutes:M.minutes(),seconds:M.seconds(),milliseconds:M.milliseconds()}}function v1(){return this.isValid()?this.toISOString():null}function fx(){return g(this)}function Wg(){return f({},h(this))}function IR(){return h(this).overflow}function BR(){return{input:this._i,format:this._f,locale:this._locale,isUTC:this._isUTC,strict:this._strict}}Q("N",0,0,"eraAbbr"),Q("NN",0,0,"eraAbbr"),Q("NNN",0,0,"eraAbbr"),Q("NNNN",0,0,"eraName"),Q("NNNNN",0,0,"eraNarrow"),Q("y",["y",1],"yo","eraYear"),Q("y",["yy",2],0,"eraYear"),Q("y",["yyy",3],0,"eraYear"),Q("y",["yyyy",4],0,"eraYear"),Dt("N",rn),Dt("NN",rn),Dt("NNN",rn),Dt("NNNN",LR),Dt("NNNNN",zR),Yr(["N","NN","NNN","NNNN","NNNNN"],function(M,B,X,ne){var de=X._locale.erasParse(M,ne,X._strict);de?h(X).era=de:h(X).invalidEra=M}),Dt("y",Wr),Dt("yy",Wr),Dt("yyy",Wr),Dt("yyyy",Wr),Dt("yo",UR),Yr(["y","yy","yyy","yyyy"],fi),Yr(["yo"],function(M,B,X,ne){var de;X._locale._eraYearOrdinalRegex&&(de=M.match(X._locale._eraYearOrdinalRegex)),X._locale.eraYearOrdinalParse?B[fi]=X._locale.eraYearOrdinalParse(M,de):B[fi]=parseInt(M,10)});function RR(M,B){var X,ne,de,Re=this._eras||Ba("en")._eras;for(X=0,ne=Re.length;X=0)return Re[ne]}function qR(M,B){var X=M.since<=M.until?1:-1;return B===void 0?t(M.since).year():t(M.since).year()+(B-M.offset)*X}function dx(){var M,B,X,ne=this.localeData().eras();for(M=0,B=ne.length;MRe&&(B=Re),YR.call(this,M,B,X,ne,de))}function YR(M,B,X,ne,de){var Re=i1(M,B,X,ne,de),Je=ym(Re.year,0,Re.dayOfYear);return this.year(Je.getUTCFullYear()),this.month(Je.getUTCMonth()),this.date(Je.getUTCDate()),this}Q("Q",0,"Qo","quarter"),ie("quarter","Q"),_e("quarter",7),Dt("Q",He),Yr("Q",function(M,B){B[is]=(tt(M)-1)*3});function ZR(M){return M==null?Math.ceil((this.month()+1)/3):this.month((M-1)*3+this.month()%3)}Q("D",["DD",2],"Do","date"),ie("date","D"),_e("date",9),Dt("D",ue),Dt("DD",ue,Qe),Dt("Do",function(M,B){return M?B._dayOfMonthOrdinalParse||B._ordinalParse:B._dayOfMonthOrdinalParseLenient}),Yr(["D","DD"],Ts),Yr("Do",function(M,B){B[Ts]=tt(M.match(ue)[0])});var _O=Ct("Date",!0);Q("DDD",["DDDD",3],"DDDo","dayOfYear"),ie("dayOfYear","DDD"),_e("dayOfYear",4),Dt("DDD",at),Dt("DDDD",et),Yr(["DDD","DDDD"],function(M,B,X){X._dayOfYear=tt(M)});function pp(M){var B=Math.round((this.clone().startOf("day")-this.clone().startOf("year"))/864e5)+1;return M==null?B:this.add(M-B,"d")}Q("m",["mm",2],0,"minute"),ie("minute","m"),_e("minute",14),Dt("m",ue),Dt("mm",ue,Qe),Yr(["m","mm"],Fs);var XR=Ct("Minutes",!1);Q("s",["ss",2],0,"second"),ie("second","s"),_e("second",15),Dt("s",ue),Dt("ss",ue,Qe),Yr(["s","ss"],Wl);var KR=Ct("Seconds",!1);Q("S",0,0,function(){return~~(this.millisecond()/100)}),Q(0,["SS",2],0,function(){return~~(this.millisecond()/10)}),Q(0,["SSS",3],0,"millisecond"),Q(0,["SSSS",4],0,function(){return this.millisecond()*10}),Q(0,["SSSSS",5],0,function(){return this.millisecond()*100}),Q(0,["SSSSSS",6],0,function(){return this.millisecond()*1e3}),Q(0,["SSSSSSS",7],0,function(){return this.millisecond()*1e4}),Q(0,["SSSSSSSS",8],0,function(){return this.millisecond()*1e5}),Q(0,["SSSSSSSSS",9],0,function(){return this.millisecond()*1e6}),ie("millisecond","ms"),_e("millisecond",16),Dt("S",at,He),Dt("SS",at,Qe),Dt("SSS",at,et);var Em,PO;for(Em="SSSS";Em.length<=9;Em+="S")Dt(Em,Wr);function JR(M,B){B[ol]=tt(("0."+M)*1e3)}for(Em="S";Em.length<=9;Em+="S")Yr(Em,JR);PO=Ct("Milliseconds",!1),Q("z",0,0,"zoneAbbr"),Q("zz",0,0,"zoneName");function iA(){return this._isUTC?"UTC":""}function e$(){return this._isUTC?"Coordinated Universal Time":""}var bt=w.prototype;bt.add=Lg,bt.calendar=jR,bt.clone=NR,bt.diff=CO,bt.endOf=PR,bt.format=sx,bt.from=TR,bt.fromNow=FR,bt.to=_R,bt.toNow=lx,bt.get=Le,bt.invalidAt=IR,bt.isAfter=ix,bt.isBefore=Sm,bt.isBetween=ax,bt.isSame=EO,bt.isSameOrAfter=ox,bt.isSameOrBefore=kO,bt.isValid=fx,bt.lang=ux,bt.locale=m1,bt.localeData=OO,bt.max=hR,bt.min=ex,bt.parsingFlags=Wg,bt.set=Ze,bt.startOf=NO,bt.subtract=rx,bt.toArray=Ug,bt.toObject=g1,bt.toDate=BE,bt.toISOString=p1,bt.inspect=nA,typeof Symbol<"u"&&Symbol.for!=null&&(bt[Symbol.for("nodejs.util.inspect.custom")]=function(){return"Moment<"+this.format()+">"}),bt.toJSON=v1,bt.toString=DO,bt.unix=A1,bt.valueOf=IE,bt.creationData=BR,bt.eraName=dx,bt.eraNarrow=y1,bt.eraAbbr=TO,bt.eraYear=pe,bt.year=ll,bt.isLeapYear=r1,bt.weekYear=WR,bt.isoWeekYear=HR,bt.quarter=bt.quarters=ZR,bt.month=sl,bt.daysInMonth=sp,bt.week=bt.weeks=Zh,bt.isoWeek=bt.isoWeeks=qb,bt.weeksInYear=dp,bt.weeksInWeekYear=QR,bt.isoWeeksInYear=VR,bt.isoWeeksInISOWeekYear=GR,bt.date=_O,bt.day=bt.days=W,bt.weekday=K,bt.isoWeekday=se,bt.dayOfYear=pp,bt.hour=bt.hours=co,bt.minute=bt.minutes=XR,bt.second=bt.seconds=KR,bt.millisecond=bt.milliseconds=PO,bt.utcOffset=SR,bt.utc=kR,bt.local=CR,bt.parseZone=DR,bt.hasAlignedHourOffset=wm,bt.isDST=Ue,bt.isLocal=Xe,bt.isUtcOffset=Ut,bt.isUtc=Fr,bt.isUTC=Fr,bt.zoneAbbr=iA,bt.zoneName=e$,bt.dates=j("dates accessor is deprecated. Use date instead.",_O),bt.months=j("months accessor is deprecated. Use month instead",sl),bt.years=j("years accessor is deprecated. Use year instead",ll),bt.zone=j("moment().zone is deprecated, use moment().utcOffset instead. http://momentjs.com/guides/#/warnings/zone/",ER),bt.isDSTShifted=j("isDSTShifted is deprecated. See http://momentjs.com/guides/#/warnings/dst-shifted/ for more information",rt);function Zc(M){return On(M*1e3)}function t$(){return On.apply(null,arguments).parseZone()}function IO(M){return M}var Un=q.prototype;Un.calendar=T,Un.longDateFormat=ye,Un.invalidDate=ke,Un.ordinal=ce,Un.preparse=IO,Un.postformat=IO,Un.relativeTime=R,Un.pastFuture=J,Un.set=D,Un.eras=RR,Un.erasParse=$R,Un.erasConvertYear=qR,Un.erasAbbrRegex=px,Un.erasNameRegex=Hg,Un.erasNarrowRegex=ic,Un.months=Vf,Un.monthsShort=kn,Un.monthsParse=Qh,Un.monthsRegex=Mg,Un.monthsShortRegex=Gc,Un.week=Yh,Un.firstDayOfYear=Ng,Un.firstDayOfWeek=jg,Un.weekdays=Kh,Un.weekdaysMin=Cu,Un.weekdaysShort=Jh,Un.weekdaysParse=Vb,Un.weekdaysRegex=xe,Un.weekdaysShortRegex=je,Un.weekdaysMinRegex=Ke,Un.isPM=Ju,Un.meridiem=Ig;function hx(M,B,X,ne){var de=Ba(),Re=d().set(ne,B);return de[X](Re,M)}function BO(M,B,X){if(l(M)&&(B=M,M=void 0),M=M||"",B!=null)return hx(M,B,X,"month");var ne,de=[];for(ne=0;ne<12;ne++)de[ne]=hx(M,ne,X,"month");return de}function Ax(M,B,X,ne){typeof M=="boolean"?(l(B)&&(X=B,B=void 0),B=B||""):(B=M,X=B,M=!1,l(B)&&(X=B,B=void 0),B=B||"");var de=Ba(),Re=M?de._week.dow:0,Je,ar=[];if(X!=null)return hx(B,(X+Re)%7,ne,"day");for(Je=0;Je<7;Je++)ar[Je]=hx(B,(Je+Re)%7,ne,"day");return ar}function RO(M,B){return BO(M,B,"months")}function r$(M,B){return BO(M,B,"monthsShort")}function n$(M,B,X){return Ax(M,B,X,"weekdays")}function RE(M,B,X){return Ax(M,B,X,"weekdaysShort")}function b1(M,B,X){return Ax(M,B,X,"weekdaysMin")}Qc("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(M){var B=M%10,X=tt(M%100/10)===1?"th":B===1?"st":B===2?"nd":B===3?"rd":"th";return M+X}}),t.lang=j("moment.lang is deprecated. Use moment.locale instead.",Qc),t.langData=j("moment.langData is deprecated. Use moment.localeData instead.",Ba);var ac=Math.abs;function i$(){var M=this._data;return this._milliseconds=ac(this._milliseconds),this._days=ac(this._days),this._months=ac(this._months),M.milliseconds=ac(M.milliseconds),M.seconds=ac(M.seconds),M.minutes=ac(M.minutes),M.hours=ac(M.hours),M.months=ac(M.months),M.years=ac(M.years),this}function $E(M,B,X,ne){var de=ln(B,X);return M._milliseconds+=ne*de._milliseconds,M._days+=ne*de._days,M._months+=ne*de._months,M._bubble()}function a$(M,B){return $E(this,M,B,1)}function mp(M,B){return $E(this,M,B,-1)}function gx(M){return M<0?Math.floor(M):Math.ceil(M)}function aA(){var M=this._milliseconds,B=this._days,X=this._months,ne=this._data,de,Re,Je,ar,Hr;return M>=0&&B>=0&&X>=0||M<=0&&B<=0&&X<=0||(M+=gx(qE(X)+B)*864e5,B=0,X=0),ne.milliseconds=M%1e3,de=Ye(M/1e3),ne.seconds=de%60,Re=Ye(de/60),ne.minutes=Re%60,Je=Ye(Re/60),ne.hours=Je%24,B+=Ye(Je/24),Hr=Ye(Ou(B)),X+=Hr,B-=gx(qE(Hr)),ar=Ye(X/12),X%=12,ne.days=B,ne.months=X,ne.years=ar,this}function Ou(M){return M*4800/146097}function qE(M){return M*146097/4800}function $O(M){if(!this.isValid())return NaN;var B,X,ne=this._milliseconds;if(M=re(M),M==="month"||M==="quarter"||M==="year")switch(B=this._days+ne/864e5,X=this._months+Ou(B),M){case"month":return X;case"quarter":return X/3;case"year":return X/12}else switch(B=this._days+Math.round(qE(this._months)),M){case"week":return B/7+ne/6048e5;case"day":return B+ne/864e5;case"hour":return B*24+ne/36e5;case"minute":return B*1440+ne/6e4;case"second":return B*86400+ne/1e3;case"millisecond":return Math.floor(B*864e5)+ne;default:throw new Error("Unknown unit "+M)}}function qO(){return this.isValid()?this._milliseconds+this._days*864e5+this._months%12*2592e6+tt(this._months/12)*31536e6:NaN}function Mu(M){return function(){return this.as(M)}}var km=Mu("ms"),LO=Mu("s"),o$=Mu("m"),vx=Mu("h"),s$=Mu("d"),zO=Mu("w"),as=Mu("M"),LE=Mu("Q"),UO=Mu("y");function Kf(){return ln(this)}function zE(M){return M=re(M),this.isValid()?this[M+"s"]():NaN}function Jf(M){return function(){return this.isValid()?this._data[M]:NaN}}var oA=Jf("milliseconds"),WO=Jf("seconds"),cl=Jf("minutes"),UE=Jf("hours"),l$=Jf("days"),u$=Jf("months"),c$=Jf("years");function WE(){return Ye(this.days()/7)}var hp=Math.round,ed={ss:44,s:45,m:45,h:22,d:26,w:null,M:11};function HO(M,B,X,ne,de){return de.relativeTime(B||1,!!X,M,ne)}function f$(M,B,X,ne){var de=ln(M).abs(),Re=hp(de.as("s")),Je=hp(de.as("m")),ar=hp(de.as("h")),Hr=hp(de.as("d")),Jn=hp(de.as("M")),fl=hp(de.as("w")),td=hp(de.as("y")),Ap=Re<=X.ss&&["s",Re]||Re0,Ap[4]=ne,HO.apply(null,Ap)}function d$(M){return M===void 0?hp:typeof M=="function"?(hp=M,!0):!1}function x1(M,B){return ed[M]===void 0?!1:B===void 0?ed[M]:(ed[M]=B,M==="s"&&(ed.ss=B-1),!0)}function p$(M,B){if(!this.isValid())return this.localeData().invalidDate();var X=!1,ne=ed,de,Re;return typeof M=="object"&&(B=M,M=!1),typeof M=="boolean"&&(X=M),typeof B=="object"&&(ne=Object.assign({},ed,B),B.s!=null&&B.ss==null&&(ne.ss=B.s-1)),de=this.localeData(),Re=f$(this,!X,ne,de),X&&(Re=de.pastFuture(+this,Re)),de.postformat(Re)}var HE=Math.abs;function Cm(M){return(M>0)-(M<0)||+M}function w1(){if(!this.isValid())return this.localeData().invalidDate();var M=HE(this._milliseconds)/1e3,B=HE(this._days),X=HE(this._months),ne,de,Re,Je,ar=this.asSeconds(),Hr,Jn,fl,td;return ar?(ne=Ye(M/60),de=Ye(ne/60),M%=60,ne%=60,Re=Ye(X/12),X%=12,Je=M?M.toFixed(3).replace(/\.?0+$/,""):"",Hr=ar<0?"-":"",Jn=Cm(this._months)!==Cm(ar)?"-":"",fl=Cm(this._days)!==Cm(ar)?"-":"",td=Cm(this._milliseconds)!==Cm(ar)?"-":"",Hr+"P"+(Re?Jn+Re+"Y":"")+(X?Jn+X+"M":"")+(B?fl+B+"D":"")+(de||ne||M?"T":"")+(de?td+de+"H":"")+(ne?td+ne+"M":"")+(M?td+Je+"S":"")):"P0D"}var Mn=c1.prototype;Mn.isValid=bR,Mn.abs=i$,Mn.add=a$,Mn.subtract=mp,Mn.as=$O,Mn.asMilliseconds=km,Mn.asSeconds=LO,Mn.asMinutes=o$,Mn.asHours=vx,Mn.asDays=s$,Mn.asWeeks=zO,Mn.asMonths=as,Mn.asQuarters=LE,Mn.asYears=UO,Mn.valueOf=qO,Mn._bubble=aA,Mn.clone=Kf,Mn.get=zE,Mn.milliseconds=oA,Mn.seconds=WO,Mn.minutes=cl,Mn.hours=UE,Mn.days=l$,Mn.weeks=WE,Mn.months=u$,Mn.years=c$,Mn.humanize=p$,Mn.toISOString=w1,Mn.toString=w1,Mn.toJSON=w1,Mn.locale=m1,Mn.localeData=OO,Mn.toIsoString=j("toIsoString() is deprecated. Please use toISOString() instead (notice the capitals)",w1),Mn.lang=ux,Q("X",0,0,"unix"),Q("x",0,0,"valueOf"),Dt("x",en),Dt("X",ns),Yr("X",function(M,B,X){X._d=new Date(parseFloat(M)*1e3)}),Yr("x",function(M,B,X){X._d=new Date(tt(M))});return t.version="2.29.4",r(On),t.fn=bt,t.min=AR,t.max=gR,t.now=vR,t.utc=d,t.unix=Zc,t.months=RO,t.isDate=u,t.locale=Qc,t.invalid=A,t.duration=ln,t.isMoment=S,t.weekdays=n$,t.parseZone=t$,t.localeData=Ba,t.isDuration=Yc,t.monthsShort=r$,t.weekdaysMin=b1,t.defineLocale=zo,t.updateLocale=NE,t.locales=TE,t.weekdaysShort=RE,t.normalizeUnits=re,t.relativeTimeRounding=d$,t.relativeTimeThreshold=x1,t.calendarFormat=MR,t.prototype=bt,t.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"},t})});var yi=vn((Wx,ck)=>{(function(){var e,t="4.17.21",r=200,n="Unsupported core-js use. Try https://npms.io/search?q=ponyfill.",i="Expected a function",a="Invalid `variable` option passed into `_.template`",o="__lodash_hash_undefined__",s=500,l="__lodash_placeholder__",u=1,c=2,f=4,d=1,p=2,h=1,m=2,g=4,A=8,b=16,v=32,x=64,w=128,S=256,k=512,j=30,O="...",C=800,N=16,D=1,P=2,q=3,z=1/0,I=9007199254740991,T=17976931348623157e292,L=0/0,_=4294967295,Y=_-1,oe=_>>>1,te=[["ary",w],["bind",h],["bindKey",m],["curry",A],["curryRight",b],["flip",k],["partial",v],["partialRight",x],["rearg",S]],Q="[object Arguments]",fe="[object Array]",Ie="[object AsyncFunction]",Se="[object Boolean]",Oe="[object Date]",ve="[object DOMException]",ye="[object Error]",me="[object Function]",ke="[object GeneratorFunction]",$="[object Map]",ae="[object Number]",ce="[object Null]",U="[object Object]",R="[object Promise]",J="[object Proxy]",ee="[object RegExp]",ie="[object Set]",re="[object String]",Ee="[object Symbol]",Ce="[object Undefined]",_e="[object WeakMap]",he="[object WeakSet]",ze="[object ArrayBuffer]",Ye="[object DataView]",tt="[object Float32Array]",Ct="[object Float64Array]",we="[object Int8Array]",Be="[object Int16Array]",Le="[object Int32Array]",Ze="[object Uint8Array]",He="[object Uint8ClampedArray]",Qe="[object Uint16Array]",et="[object Uint32Array]",Ge=/\b__p \+= '';/g,G=/\b(__p \+=) '' \+/g,ue=/(__e\(.*?\)|\b__t\)) \+\n'';/g,Pe=/&(?:amp|lt|gt|quot|#39);/g,De=/[&<>"']/g,at=RegExp(Pe.source),ht=RegExp(De.source),Zt=/<%-([\s\S]+?)%>/g,Wr=/<%([\s\S]+?)%>/g,en=/<%=([\s\S]+?)%>/g,tn=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,ci=/^\w*$/,ns=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Qi=/[\\^$.*+?()[\]{}|]/g,Pa=RegExp(Qi.source),Dt=/^\s+/,Hc=/\s/,Wf=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,Va=/\{\n\/\* \[wrapped with (.+)\] \*/,Eu=/,? & /,Yr=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,Ul=/[()=,{}\[\]\/\s]/,Am=/\\(\\)?/g,fi=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,is=/\w*$/,Ts=/^[-+]0x[0-9a-f]+$/i,ia=/^0b[01]+$/i,Fs=/^\[object .+?Constructor\]$/,Wl=/^0o[0-7]+$/i,ol=/^(?:0|[1-9]\d*)$/,kg=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,Vc=/($^)/,Cg=/['\n\r\u2028\u2029\\]/g,_n="\\ud800-\\udfff",Hf="\\u0300-\\u036f",Dg="\\ufe20-\\ufe2f",Vh="\\u20d0-\\u20ff",gm=Hf+Dg+Vh,Og="\\u2700-\\u27bf",Gh="a-z\\xdf-\\xf6\\xf8-\\xff",Vf="\\xac\\xb1\\xd7\\xf7",kn="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",Ia="\\u2000-\\u206f",Qh=" \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",Cn="A-Z\\xc0-\\xd6\\xd8-\\xde",sl="\\ufe0e\\ufe0f",sp=Vf+kn+Ia+Qh,Gc="['\u2019]",Mg="["+_n+"]",vm="["+sp+"]",ku="["+gm+"]",ll="\\d+",r1="["+Og+"]",n1="["+Gh+"]",ym="[^"+_n+sp+ll+Og+Gh+Cn+"]",Gf="\\ud83c[\\udffb-\\udfff]",i1="(?:"+ku+"|"+Gf+")",Qf="[^"+_n+"]",Hl="(?:\\ud83c[\\udde6-\\uddff]){2}",Yh="[\\ud800-\\udbff][\\udc00-\\udfff]",ul="["+Cn+"]",jg="\\u200d",Ng="(?:"+n1+"|"+ym+")",Zh="(?:"+ul+"|"+ym+")",qb="(?:"+Gc+"(?:d|ll|m|re|s|t|ve))?",Lb="(?:"+Gc+"(?:D|LL|M|RE|S|T|VE))?",Tg=i1+"?",Fg="["+sl+"]?",zb="(?:"+jg+"(?:"+[Qf,Hl,Yh].join("|")+")"+Fg+Tg+")*",Ub="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",Wb="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",Xh=Fg+Tg+zb,_g="(?:"+[r1,Hl,Yh].join("|")+")"+Xh,Hb="(?:"+[Qf+ku+"?",ku,Hl,Yh,Mg].join("|")+")",Kh=RegExp(Gc,"g"),Jh=RegExp(ku,"g"),Cu=RegExp(Gf+"(?="+Gf+")|"+Hb+Xh,"g"),Pg=RegExp([ul+"?"+n1+"+"+qb+"(?="+[vm,ul,"$"].join("|")+")",Zh+"+"+Lb+"(?="+[vm,ul+Ng,"$"].join("|")+")",ul+"?"+Ng+"+"+qb,ul+"+"+Lb,Wb,Ub,ll,_g].join("|"),"g"),Vb=RegExp("["+jg+_n+gm+sl+"]"),W=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,K=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],se=-1,xe={};xe[tt]=xe[Ct]=xe[we]=xe[Be]=xe[Le]=xe[Ze]=xe[He]=xe[Qe]=xe[et]=!0,xe[Q]=xe[fe]=xe[ze]=xe[Se]=xe[Ye]=xe[Oe]=xe[ye]=xe[me]=xe[$]=xe[ae]=xe[U]=xe[ee]=xe[ie]=xe[re]=xe[_e]=!1;var je={};je[Q]=je[fe]=je[ze]=je[Ye]=je[Se]=je[Oe]=je[tt]=je[Ct]=je[we]=je[Be]=je[Le]=je[$]=je[ae]=je[U]=je[ee]=je[ie]=je[re]=je[Ee]=je[Ze]=je[He]=je[Qe]=je[et]=!0,je[ye]=je[me]=je[_e]=!1;var Ke={\u00C0:"A",\u00C1:"A",\u00C2:"A",\u00C3:"A",\u00C4:"A",\u00C5:"A",\u00E0:"a",\u00E1:"a",\u00E2:"a",\u00E3:"a",\u00E4:"a",\u00E5:"a",\u00C7:"C",\u00E7:"c",\u00D0:"D",\u00F0:"d",\u00C8:"E",\u00C9:"E",\u00CA:"E",\u00CB:"E",\u00E8:"e",\u00E9:"e",\u00EA:"e",\u00EB:"e",\u00CC:"I",\u00CD:"I",\u00CE:"I",\u00CF:"I",\u00EC:"i",\u00ED:"i",\u00EE:"i",\u00EF:"i",\u00D1:"N",\u00F1:"n",\u00D2:"O",\u00D3:"O",\u00D4:"O",\u00D5:"O",\u00D6:"O",\u00D8:"O",\u00F2:"o",\u00F3:"o",\u00F4:"o",\u00F5:"o",\u00F6:"o",\u00F8:"o",\u00D9:"U",\u00DA:"U",\u00DB:"U",\u00DC:"U",\u00F9:"u",\u00FA:"u",\u00FB:"u",\u00FC:"u",\u00DD:"Y",\u00FD:"y",\u00FF:"y",\u00C6:"Ae",\u00E6:"ae",\u00DE:"Th",\u00FE:"th",\u00DF:"ss",\u0100:"A",\u0102:"A",\u0104:"A",\u0101:"a",\u0103:"a",\u0105:"a",\u0106:"C",\u0108:"C",\u010A:"C",\u010C:"C",\u0107:"c",\u0109:"c",\u010B:"c",\u010D:"c",\u010E:"D",\u0110:"D",\u010F:"d",\u0111:"d",\u0112:"E",\u0114:"E",\u0116:"E",\u0118:"E",\u011A:"E",\u0113:"e",\u0115:"e",\u0117:"e",\u0119:"e",\u011B:"e",\u011C:"G",\u011E:"G",\u0120:"G",\u0122:"G",\u011D:"g",\u011F:"g",\u0121:"g",\u0123:"g",\u0124:"H",\u0126:"H",\u0125:"h",\u0127:"h",\u0128:"I",\u012A:"I",\u012C:"I",\u012E:"I",\u0130:"I",\u0129:"i",\u012B:"i",\u012D:"i",\u012F:"i",\u0131:"i",\u0134:"J",\u0135:"j",\u0136:"K",\u0137:"k",\u0138:"k",\u0139:"L",\u013B:"L",\u013D:"L",\u013F:"L",\u0141:"L",\u013A:"l",\u013C:"l",\u013E:"l",\u0140:"l",\u0142:"l",\u0143:"N",\u0145:"N",\u0147:"N",\u014A:"N",\u0144:"n",\u0146:"n",\u0148:"n",\u014B:"n",\u014C:"O",\u014E:"O",\u0150:"O",\u014D:"o",\u014F:"o",\u0151:"o",\u0154:"R",\u0156:"R",\u0158:"R",\u0155:"r",\u0157:"r",\u0159:"r",\u015A:"S",\u015C:"S",\u015E:"S",\u0160:"S",\u015B:"s",\u015D:"s",\u015F:"s",\u0161:"s",\u0162:"T",\u0164:"T",\u0166:"T",\u0163:"t",\u0165:"t",\u0167:"t",\u0168:"U",\u016A:"U",\u016C:"U",\u016E:"U",\u0170:"U",\u0172:"U",\u0169:"u",\u016B:"u",\u016D:"u",\u016F:"u",\u0171:"u",\u0173:"u",\u0174:"W",\u0175:"w",\u0176:"Y",\u0177:"y",\u0178:"Y",\u0179:"Z",\u017B:"Z",\u017D:"Z",\u017A:"z",\u017C:"z",\u017E:"z",\u0132:"IJ",\u0133:"ij",\u0152:"Oe",\u0153:"oe",\u0149:"'n",\u017F:"s"},ot={"&":"&","<":"<",">":">",'"':""","'":"'"},xr={"&":"&","<":"<",">":">",""":'"',"'":"'"},Pn={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},sn=parseFloat,aa=parseInt,Ju=typeof global=="object"&&global&&global.Object===Object&&global,Gb=typeof self=="object"&&self&&self.Object===Object&&self,co=Ju||Gb||Function("return this")(),Ig=typeof Wx=="object"&&Wx&&!Wx.nodeType&&Wx,Yf=Ig&&typeof ck=="object"&&ck&&!ck.nodeType&&ck,gi=Yf&&Yf.exports===Ig,lp=gi&&Ju.process,Lo=function(){try{var Ue=Yf&&Yf.require&&Yf.require("util").types;return Ue||lp&&lp.binding&&lp.binding("util")}catch{}}(),Qb=Lo&&Lo.isArrayBuffer,a1=Lo&&Lo.isDate,Yb=Lo&&Lo.isMap,Zb=Lo&&Lo.isRegExp,eA=Lo&&Lo.isSet,Qc=Lo&&Lo.isTypedArray;function zo(Ue,rt,Xe){switch(Xe.length){case 0:return Ue.call(rt);case 1:return Ue.call(rt,Xe[0]);case 2:return Ue.call(rt,Xe[0],Xe[1]);case 3:return Ue.call(rt,Xe[0],Xe[1],Xe[2])}return Ue.apply(rt,Xe)}function NE(Ue,rt,Xe,Ut){for(var Fr=-1,Kn=Ue==null?0:Ue.length;++Fr-1}function o1(Ue,rt,Xe){for(var Ut=-1,Fr=Ue==null?0:Ue.length;++Ut-1;);return Xe}function ex(Ue,rt){for(var Xe=Ue.length;Xe--&&bm(rt,Ue[Xe],0)>-1;);return Xe}function hR(Ue,rt){for(var Xe=Ue.length,Ut=0;Xe--;)Ue[Xe]===rt&&++Ut;return Ut}var yO=ft(Ke),AR=ft(ot);function gR(Ue){return"\\"+Pn[Ue]}function vR(Ue,rt){return Ue==null?e:Ue[rt]}function Xf(Ue){return Vb.test(Ue)}function yR(Ue){return W.test(Ue)}function bR(Ue){for(var rt,Xe=[];!(rt=Ue.next()).done;)Xe.push(rt.value);return Xe}function PE(Ue){var rt=-1,Xe=Array(Ue.size);return Ue.forEach(function(Ut,Fr){Xe[++rt]=[Fr,Ut]}),Xe}function c1(Ue,rt){return function(Xe){return Ue(rt(Xe))}}function Yc(Ue,rt){for(var Xe=-1,Ut=Ue.length,Fr=0,Kn=[];++Xe-1}function _O(y,E){var F=this.__data__,Z=ac(F,y);return Z<0?(++this.size,F.push([y,E])):F[Z][1]=E,this}dp.prototype.clear=QR,dp.prototype.delete=FO,dp.prototype.get=YR,dp.prototype.has=ZR,dp.prototype.set=_O;function pp(y){var E=-1,F=y==null?0:y.length;for(this.clear();++E=E?y:E)),y}function Ou(y,E,F,Z,le,be){var Fe,$e=E&u,We=E&c,st=E&f;if(F&&(Fe=le?F(y,Z,le,be):F(y)),Fe!==e)return Fe;if(!Qa(y))return y;var lt=Vr(y);if(lt){if(Fe=Hje(y),!$e)return oc(y,Fe)}else{var At=Vl(y),Pt=At==me||At==ke;if(Yg(y))return aK(y,$e);if(At==U||At==Q||Pt&&!le){if(Fe=We||Pt?{}:EK(y),!$e)return We?_je(y,a$(Fe,y)):Fje(y,$E(Fe,y))}else{if(!je[At])return le?y:{};Fe=Vje(y,At,$e)}}be||(be=new Zc);var rr=be.get(y);if(rr)return rr;be.set(y,Fe),JK(y)?y.forEach(function(Sr){Fe.add(Ou(Sr,E,F,Sr,y,be))}):XK(y)&&y.forEach(function(Sr,gn){Fe.set(gn,Ou(Sr,E,F,gn,y,be))});var wr=st?We?C$:k$:We?lc:Is,nn=lt?e:wr(y);return Ba(nn||y,function(Sr,gn){nn&&(gn=Sr,Sr=y[gn]),b1(Fe,gn,Ou(Sr,E,F,gn,y,be))}),Fe}function qE(y){var E=Is(y);return function(F){return $O(F,y,E)}}function $O(y,E,F){var Z=F.length;if(y==null)return!Z;for(y=ln(y);Z--;){var le=F[Z],be=E[le],Fe=y[le];if(Fe===e&&!(le in y)||!be(Fe))return!1}return!0}function qO(y,E,F){if(typeof y!="function")throw new nc(i);return YE(function(){y.apply(e,F)},E)}function Mu(y,E,F,Z){var le=-1,be=Rg,Fe=!0,$e=y.length,We=[],st=E.length;if(!$e)return We;F&&(E=si(E,Oi(F))),Z?(be=o1,Fe=!1):E.length>=r&&(be=rc,Fe=!1,E=new iA(E));e:for(;++le<$e;){var lt=y[le],At=F==null?lt:F(lt);if(lt=Z||lt!==0?lt:0,Fe&&At===At){for(var Pt=st;Pt--;)if(E[Pt]===At)continue e;We.push(lt)}else be(E,At,Z)||We.push(lt)}return We}var km=cK(Kf),LO=cK(zE,!0);function o$(y,E){var F=!0;return km(y,function(Z,le,be){return F=!!E(Z,le,be),F}),F}function vx(y,E,F){for(var Z=-1,le=y.length;++Zle?0:le+F),Z=Z===e||Z>le?le:Xr(Z),Z<0&&(Z+=le),Z=F>Z?0:tJ(Z);F0&&F($e)?E>1?as($e,E-1,F,Z,le):ec(le,$e):Z||(le[le.length]=$e)}return le}var LE=fK(),UO=fK(!0);function Kf(y,E){return y&&LE(y,E,Is)}function zE(y,E){return y&&UO(y,E,Is)}function Jf(y,E){return Zf(E,function(F){return cA(y[F])})}function oA(y,E){E=Gg(E,y);for(var F=0,Z=E.length;y!=null&&FE}function l$(y,E){return y!=null&&di.call(y,E)}function u$(y,E){return y!=null&&E in ln(y)}function c$(y,E,F){return y>=Ga(E,F)&&y=120&<.length>=120)?new iA(Fe&<):e}lt=y[0];var At=-1,Pt=$e[0];e:for(;++At-1;)$e!==y&&rA.call($e,We,1),rA.call(y,We,1);return y}function XX(y,E){for(var F=y?E.length:0,Z=F-1;F--;){var le=E[F];if(F==Z||le!==be){var be=le;uA(le)?rA.call(y,le,1):v$(y,le)}}return y}function h$(y,E){return y+m1(NO()*(E-y+1))}function wje(y,E,F,Z){for(var le=-1,be=fo(lx((E-y)/(F||1)),0),Fe=Xe(be);be--;)Fe[Z?be:++le]=y,y+=F;return Fe}function A$(y,E){var F="";if(!y||E<1||E>I)return F;do E%2&&(F+=y),E=m1(E/2),E&&(y+=y);while(E);return F}function un(y,E){return F$(DK(y,E,uc),y+"")}function Sje(y){return RO(Sx(y))}function Eje(y,E){var F=Sx(y);return tM(F,aA(E,0,F.length))}function VE(y,E,F,Z){if(!Qa(y))return y;E=Gg(E,y);for(var le=-1,be=E.length,Fe=be-1,$e=y;$e!=null&&++lele?0:le+E),F=F>le?le:F,F<0&&(F+=le),le=E>F?0:F-E>>>0,E>>>=0;for(var be=Xe(le);++Z>>1,Fe=y[be];Fe!==null&&!Kc(Fe)&&(F?Fe<=E:Fe=r){var st=E?null:Rje(y);if(st)return qg(st);Fe=!1,le=rc,We=new iA}else We=E?[]:$e;e:for(;++Z=Z?y:rd(y,E,F)}var iK=TR||function(y){return co.clearTimeout(y)};function aK(y,E){if(E)return y.slice();var F=y.length,Z=EO?EO(F):new y.constructor(F);return y.copy(Z),Z}function w$(y){var E=new y.constructor(y.byteLength);return new ax(E).set(new ax(y)),E}function Mje(y,E){var F=E?w$(y.buffer):y.buffer;return new y.constructor(F,y.byteOffset,y.byteLength)}function jje(y){var E=new y.constructor(y.source,is.exec(y));return E.lastIndex=y.lastIndex,E}function Nje(y){return y1?ln(y1.call(y)):{}}function oK(y,E){var F=E?w$(y.buffer):y.buffer;return new y.constructor(F,y.byteOffset,y.length)}function sK(y,E){if(y!==E){var F=y!==e,Z=y===null,le=y===y,be=Kc(y),Fe=E!==e,$e=E===null,We=E===E,st=Kc(E);if(!$e&&!st&&!be&&y>E||be&&Fe&&We&&!$e&&!st||Z&&Fe&&We||!F&&We||!le)return 1;if(!Z&&!be&&!st&&y=$e)return We;var st=F[Z];return We*(st=="desc"?-1:1)}}return y.index-E.index}function lK(y,E,F,Z){for(var le=-1,be=y.length,Fe=F.length,$e=-1,We=E.length,st=fo(be-Fe,0),lt=Xe(We+st),At=!Z;++$e1?F[le-1]:e,Fe=le>2?F[2]:e;for(be=y.length>3&&typeof be=="function"?(le--,be):e,Fe&&ju(F[0],F[1],Fe)&&(be=le<3?e:be,le=1),E=ln(E);++Z-1?le[be?E[Fe]:Fe]:e}}function mK(y){return lA(function(E){var F=E.length,Z=F,le=ic.prototype.thru;for(y&&E.reverse();Z--;){var be=E[Z];if(typeof be!="function")throw new nc(i);if(le&&!Fe&&JO(be)=="wrapper")var Fe=new ic([],!0)}for(Z=Fe?Z:F;++Z1&&In.reverse(),lt&&We$e))return!1;var st=be.get(y),lt=be.get(E);if(st&<)return st==E&<==y;var At=-1,Pt=!0,rr=F&p?new iA:e;for(be.set(y,E),be.set(E,y);++At<$e;){var wr=y[At],nn=E[At];if(Z)var Sr=Fe?Z(nn,wr,At,E,y,be):Z(wr,nn,At,y,E,be);if(Sr!==e){if(Sr)continue;Pt=!1;break}if(rr){if(!l1(E,function(gn,In){if(!rc(rr,In)&&(wr===gn||le(wr,gn,F,Z,be)))return rr.push(In)})){Pt=!1;break}}else if(!(wr===nn||le(wr,nn,F,Z,be))){Pt=!1;break}}return be.delete(y),be.delete(E),Pt}function qje(y,E,F,Z,le,be,Fe){switch(F){case Ye:if(y.byteLength!=E.byteLength||y.byteOffset!=E.byteOffset)return!1;y=y.buffer,E=E.buffer;case ze:return!(y.byteLength!=E.byteLength||!be(new ax(y),new ax(E)));case Se:case Oe:case ae:return gp(+y,+E);case ye:return y.name==E.name&&y.message==E.message;case ee:case re:return y==E+"";case $:var $e=PE;case ie:var We=Z&d;if($e||($e=qg),y.size!=E.size&&!We)return!1;var st=Fe.get(y);if(st)return st==E;Z|=p,Fe.set(y,E);var lt=xK($e(y),$e(E),Z,le,be,Fe);return Fe.delete(y),lt;case Ee:if(y1)return y1.call(y)==y1.call(E)}return!1}function Lje(y,E,F,Z,le,be){var Fe=F&d,$e=k$(y),We=$e.length,st=k$(E),lt=st.length;if(We!=lt&&!Fe)return!1;for(var At=We;At--;){var Pt=$e[At];if(!(Fe?Pt in E:di.call(E,Pt)))return!1}var rr=be.get(y),wr=be.get(E);if(rr&&wr)return rr==E&&wr==y;var nn=!0;be.set(y,E),be.set(E,y);for(var Sr=Fe;++At1?"& ":"")+E[Z],E=E.join(F>2?", ":" "),y.replace(Wf,`{ +`+new Error().stack),X=!1}return B.apply(this,arguments)},B)}var O={};function C(M,B){t.deprecationHandler!=null&&t.deprecationHandler(M,B),O[M]||(k(B),O[M]=!0)}t.suppressDeprecationWarnings=!1,t.deprecationHandler=null;function N(M){return typeof Function<"u"&&M instanceof Function||Object.prototype.toString.call(M)==="[object Function]"}function D(M){var B,X;for(X in M)a(M,X)&&(B=M[X],N(B)?this[X]=B:this["_"+X]=B);this._config=M,this._dayOfMonthOrdinalParseLenient=new RegExp((this._dayOfMonthOrdinalParse.source||this._ordinalParse.source)+"|"+/\d{1,2}/.source)}function P(M,B){var X=f({},M),ne;for(ne in B)a(B,ne)&&(i(M[ne])&&i(B[ne])?(X[ne]={},f(X[ne],M[ne]),f(X[ne],B[ne])):B[ne]!=null?X[ne]=B[ne]:delete X[ne]);for(ne in M)a(M,ne)&&!a(B,ne)&&i(M[ne])&&(X[ne]=f({},X[ne]));return X}function q(M){M!=null&&this.set(M)}var z;Object.keys?z=Object.keys:z=function(M){var B,X=[];for(B in M)a(M,B)&&X.push(B);return X};var I={sameDay:"[Today at] LT",nextDay:"[Tomorrow at] LT",nextWeek:"dddd [at] LT",lastDay:"[Yesterday at] LT",lastWeek:"[Last] dddd [at] LT",sameElse:"L"};function T(M,B,X){var ne=this._calendar[M]||this._calendar.sameElse;return N(ne)?ne.call(B,X):ne}function L(M,B,X){var ne=""+Math.abs(M),de=B-ne.length,Re=M>=0;return(Re?X?"+":"":"-")+Math.pow(10,Math.max(0,de)).toString().substr(1)+ne}var _=/(\[[^\[]*\])|(\\)?([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,Y=/(\[[^\[]*\])|(\\)?(LTS|LT|LL?L?L?|l{1,4})/g,oe={},te={};function Q(M,B,X,ne){var de=ne;typeof ne=="string"&&(de=function(){return this[ne]()}),M&&(te[M]=de),B&&(te[B[0]]=function(){return L(de.apply(this,arguments),B[1],B[2])}),X&&(te[X]=function(){return this.localeData().ordinal(de.apply(this,arguments),M)})}function fe(M){return M.match(/\[[\s\S]/)?M.replace(/^\[|\]$/g,""):M.replace(/\\/g,"")}function Ie(M){var B=M.match(_),X,ne;for(X=0,ne=B.length;X=0&&Y.test(M);)M=M.replace(Y,ne),Y.lastIndex=0,X-=1;return M}var ve={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 ye(M){var B=this._longDateFormat[M],X=this._longDateFormat[M.toUpperCase()];return B||!X?B:(this._longDateFormat[M]=X.match(_).map(function(ne){return ne==="MMMM"||ne==="MM"||ne==="DD"||ne==="dddd"?ne.slice(1):ne}).join(""),this._longDateFormat[M])}var me="Invalid date";function ke(){return this._invalidDate}var $="%d",ae=/\d{1,2}/;function ce(M){return this._ordinal.replace("%d",M)}var U={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 R(M,B,X,ne){var de=this._relativeTime[X];return N(de)?de(M,B,X,ne):de.replace(/%d/i,M)}function J(M,B){var X=this._relativeTime[M>0?"future":"past"];return N(X)?X(B):X.replace(/%s/i,B)}var ee={};function ie(M,B){var X=M.toLowerCase();ee[X]=ee[X+"s"]=ee[B]=M}function re(M){return typeof M=="string"?ee[M]||ee[M.toLowerCase()]:void 0}function Ee(M){var B={},X,ne;for(ne in M)a(M,ne)&&(X=re(ne),X&&(B[X]=M[ne]));return B}var Ce={};function _e(M,B){Ce[M]=B}function he(M){var B=[],X;for(X in M)a(M,X)&&B.push({unit:X,priority:Ce[X]});return B.sort(function(ne,de){return ne.priority-de.priority}),B}function ze(M){return M%4===0&&M%100!==0||M%400===0}function Ye(M){return M<0?Math.ceil(M)||0:Math.floor(M)}function tt(M){var B=+M,X=0;return B!==0&&isFinite(B)&&(X=Ye(B)),X}function Ct(M,B){return function(X){return X!=null?(Be(this,M,X),t.updateOffset(this,B),this):we(this,M)}}function we(M,B){return M.isValid()?M._d["get"+(M._isUTC?"UTC":"")+B]():NaN}function Be(M,B,X){M.isValid()&&!isNaN(X)&&(B==="FullYear"&&ze(M.year())&&M.month()===1&&M.date()===29?(X=tt(X),M._d["set"+(M._isUTC?"UTC":"")+B](X,M.month(),Hf(X,M.month()))):M._d["set"+(M._isUTC?"UTC":"")+B](X))}function Le(M){return M=re(M),N(this[M])?this[M]():this}function Ze(M,B){if(typeof M=="object"){M=Ee(M);var X=he(M),ne,de=X.length;for(ne=0;ne68?1900:2e3)};var ll=Ct("FullYear",!0);function r1(){return ze(this.year())}function n1(M,B,X,ne,de,Re,Je){var ar;return M<100&&M>=0?(ar=new Date(M+400,B,X,ne,de,Re,Je),isFinite(ar.getFullYear())&&ar.setFullYear(M)):ar=new Date(M,B,X,ne,de,Re,Je),ar}function bm(M){var B,X;return M<100&&M>=0?(X=Array.prototype.slice.call(arguments),X[0]=M+400,B=new Date(Date.UTC.apply(null,X)),isFinite(B.getUTCFullYear())&&B.setUTCFullYear(M)):B=new Date(Date.UTC.apply(null,arguments)),B}function Gf(M,B,X){var ne=7+B-X,de=(7+bm(M,0,ne).getUTCDay()-B)%7;return-de+ne-1}function i1(M,B,X,ne,de){var Re=(7+X-ne)%7,Je=Gf(M,ne,de),ar=1+7*(B-1)+Re+Je,Hr,Jn;return ar<=0?(Hr=M-1,Jn=ku(Hr)+ar):ar>ku(M)?(Hr=M+1,Jn=ar-ku(M)):(Hr=M,Jn=ar),{year:Hr,dayOfYear:Jn}}function Qf(M,B,X){var ne=Gf(M.year(),B,X),de=Math.floor((M.dayOfYear()-ne-1)/7)+1,Re,Je;return de<1?(Je=M.year()-1,Re=de+Hl(Je,B,X)):de>Hl(M.year(),B,X)?(Re=de-Hl(M.year(),B,X),Je=M.year()+1):(Je=M.year(),Re=de),{week:Re,year:Je}}function Hl(M,B,X){var ne=Gf(M,B,X),de=Gf(M+1,B,X);return(ku(M)-ne+de)/7}Q("w",["ww",2],"wo","week"),Q("W",["WW",2],"Wo","isoWeek"),ie("week","w"),ie("isoWeek","W"),_e("week",5),_e("isoWeek",5),Dt("w",ue),Dt("ww",ue,Qe),Dt("W",ue),Dt("WW",ue,Qe),Ul(["w","ww","W","WW"],function(M,B,X,ne){B[ne.substr(0,1)]=tt(M)});function Yh(M){return Qf(M,this._week.dow,this._week.doy).week}var ul={dow:0,doy:6};function jg(){return this._week.dow}function Ng(){return this._week.doy}function Zh(M){var B=this.localeData().week(this);return M==null?B:this.add((M-B)*7,"d")}function qb(M){var B=Qf(this,1,4).week;return M==null?B:this.add((M-B)*7,"d")}Q("d",0,"do","day"),Q("dd",0,0,function(M){return this.localeData().weekdaysMin(this,M)}),Q("ddd",0,0,function(M){return this.localeData().weekdaysShort(this,M)}),Q("dddd",0,0,function(M){return this.localeData().weekdays(this,M)}),Q("e",0,0,"weekday"),Q("E",0,0,"isoWeekday"),ie("day","d"),ie("weekday","e"),ie("isoWeekday","E"),_e("day",11),_e("weekday",11),_e("isoWeekday",11),Dt("d",ue),Dt("e",ue),Dt("E",ue),Dt("dd",function(M,B){return B.weekdaysMinRegex(M)}),Dt("ddd",function(M,B){return B.weekdaysShortRegex(M)}),Dt("dddd",function(M,B){return B.weekdaysRegex(M)}),Ul(["dd","ddd","dddd"],function(M,B,X,ne){var de=X._locale.weekdaysParse(M,ne,X._strict);de!=null?B.d=de:h(X).invalidWeekday=M}),Ul(["d","e","E"],function(M,B,X,ne){B[ne]=tt(M)});function Lb(M,B){return typeof M!="string"?M:isNaN(M)?(M=B.weekdaysParse(M),typeof M=="number"?M:null):parseInt(M,10)}function Tg(M,B){return typeof M=="string"?B.weekdaysParse(M)%7||7:isNaN(M)?null:M}function Fg(M,B){return M.slice(B,7).concat(M.slice(0,B))}var zb="Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),Ub="Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_"),Wb="Su_Mo_Tu_We_Th_Fr_Sa".split("_"),Xh=Qi,_g=Qi,Hb=Qi;function Kh(M,B){var X=n(this._weekdays)?this._weekdays:this._weekdays[M&&M!==!0&&this._weekdays.isFormat.test(B)?"format":"standalone"];return M===!0?Fg(X,this._week.dow):M?X[M.day()]:X}function Jh(M){return M===!0?Fg(this._weekdaysShort,this._week.dow):M?this._weekdaysShort[M.day()]:this._weekdaysShort}function Cu(M){return M===!0?Fg(this._weekdaysMin,this._week.dow):M?this._weekdaysMin[M.day()]:this._weekdaysMin}function Pg(M,B,X){var ne,de,Re,Je=M.toLocaleLowerCase();if(!this._weekdaysParse)for(this._weekdaysParse=[],this._shortWeekdaysParse=[],this._minWeekdaysParse=[],ne=0;ne<7;++ne)Re=d([2e3,1]).day(ne),this._minWeekdaysParse[ne]=this.weekdaysMin(Re,"").toLocaleLowerCase(),this._shortWeekdaysParse[ne]=this.weekdaysShort(Re,"").toLocaleLowerCase(),this._weekdaysParse[ne]=this.weekdays(Re,"").toLocaleLowerCase();return X?B==="dddd"?(de=_n.call(this._weekdaysParse,Je),de!==-1?de:null):B==="ddd"?(de=_n.call(this._shortWeekdaysParse,Je),de!==-1?de:null):(de=_n.call(this._minWeekdaysParse,Je),de!==-1?de:null):B==="dddd"?(de=_n.call(this._weekdaysParse,Je),de!==-1||(de=_n.call(this._shortWeekdaysParse,Je),de!==-1)?de:(de=_n.call(this._minWeekdaysParse,Je),de!==-1?de:null)):B==="ddd"?(de=_n.call(this._shortWeekdaysParse,Je),de!==-1||(de=_n.call(this._weekdaysParse,Je),de!==-1)?de:(de=_n.call(this._minWeekdaysParse,Je),de!==-1?de:null)):(de=_n.call(this._minWeekdaysParse,Je),de!==-1||(de=_n.call(this._weekdaysParse,Je),de!==-1)?de:(de=_n.call(this._shortWeekdaysParse,Je),de!==-1?de:null))}function Vb(M,B,X){var ne,de,Re;if(this._weekdaysParseExact)return Pg.call(this,M,B,X);for(this._weekdaysParse||(this._weekdaysParse=[],this._minWeekdaysParse=[],this._shortWeekdaysParse=[],this._fullWeekdaysParse=[]),ne=0;ne<7;ne++){if(de=d([2e3,1]).day(ne),X&&!this._fullWeekdaysParse[ne]&&(this._fullWeekdaysParse[ne]=new RegExp("^"+this.weekdays(de,"").replace(".","\\.?")+"$","i"),this._shortWeekdaysParse[ne]=new RegExp("^"+this.weekdaysShort(de,"").replace(".","\\.?")+"$","i"),this._minWeekdaysParse[ne]=new RegExp("^"+this.weekdaysMin(de,"").replace(".","\\.?")+"$","i")),this._weekdaysParse[ne]||(Re="^"+this.weekdays(de,"")+"|^"+this.weekdaysShort(de,"")+"|^"+this.weekdaysMin(de,""),this._weekdaysParse[ne]=new RegExp(Re.replace(".",""),"i")),X&&B==="dddd"&&this._fullWeekdaysParse[ne].test(M))return ne;if(X&&B==="ddd"&&this._shortWeekdaysParse[ne].test(M))return ne;if(X&&B==="dd"&&this._minWeekdaysParse[ne].test(M))return ne;if(!X&&this._weekdaysParse[ne].test(M))return ne}}function W(M){if(!this.isValid())return M!=null?this:NaN;var B=this._isUTC?this._d.getUTCDay():this._d.getDay();return M!=null?(M=Lb(M,this.localeData()),this.add(M-B,"d")):B}function K(M){if(!this.isValid())return M!=null?this:NaN;var B=(this.day()+7-this.localeData()._week.dow)%7;return M==null?B:this.add(M-B,"d")}function se(M){if(!this.isValid())return M!=null?this:NaN;if(M!=null){var B=Tg(M,this.localeData());return this.day(this.day()%7?B:B-7)}else return this.day()||7}function xe(M){return this._weekdaysParseExact?(a(this,"_weekdaysRegex")||ot.call(this),M?this._weekdaysStrictRegex:this._weekdaysRegex):(a(this,"_weekdaysRegex")||(this._weekdaysRegex=Xh),this._weekdaysStrictRegex&&M?this._weekdaysStrictRegex:this._weekdaysRegex)}function je(M){return this._weekdaysParseExact?(a(this,"_weekdaysRegex")||ot.call(this),M?this._weekdaysShortStrictRegex:this._weekdaysShortRegex):(a(this,"_weekdaysShortRegex")||(this._weekdaysShortRegex=_g),this._weekdaysShortStrictRegex&&M?this._weekdaysShortStrictRegex:this._weekdaysShortRegex)}function Ke(M){return this._weekdaysParseExact?(a(this,"_weekdaysRegex")||ot.call(this),M?this._weekdaysMinStrictRegex:this._weekdaysMinRegex):(a(this,"_weekdaysMinRegex")||(this._weekdaysMinRegex=Hb),this._weekdaysMinStrictRegex&&M?this._weekdaysMinStrictRegex:this._weekdaysMinRegex)}function ot(){function M(fl,td){return td.length-fl.length}var B=[],X=[],ne=[],de=[],Re,Je,ar,Hr,Jn;for(Re=0;Re<7;Re++)Je=d([2e3,1]).day(Re),ar=Va(this.weekdaysMin(Je,"")),Hr=Va(this.weekdaysShort(Je,"")),Jn=Va(this.weekdays(Je,"")),B.push(ar),X.push(Hr),ne.push(Jn),de.push(ar),de.push(Hr),de.push(Jn);B.sort(M),X.sort(M),ne.sort(M),de.sort(M),this._weekdaysRegex=new RegExp("^("+de.join("|")+")","i"),this._weekdaysShortRegex=this._weekdaysRegex,this._weekdaysMinRegex=this._weekdaysRegex,this._weekdaysStrictRegex=new RegExp("^("+ne.join("|")+")","i"),this._weekdaysShortStrictRegex=new RegExp("^("+X.join("|")+")","i"),this._weekdaysMinStrictRegex=new RegExp("^("+B.join("|")+")","i")}function xr(){return this.hours()%12||12}function Pn(){return this.hours()||24}Q("H",["HH",2],0,"hour"),Q("h",["hh",2],0,xr),Q("k",["kk",2],0,Pn),Q("hmm",0,0,function(){return""+xr.apply(this)+L(this.minutes(),2)}),Q("hmmss",0,0,function(){return""+xr.apply(this)+L(this.minutes(),2)+L(this.seconds(),2)}),Q("Hmm",0,0,function(){return""+this.hours()+L(this.minutes(),2)}),Q("Hmmss",0,0,function(){return""+this.hours()+L(this.minutes(),2)+L(this.seconds(),2)});function sn(M,B){Q(M,0,0,function(){return this.localeData().meridiem(this.hours(),this.minutes(),B)})}sn("a",!0),sn("A",!1),ie("hour","h"),_e("hour",13);function aa(M,B){return B._meridiemParse}Dt("a",aa),Dt("A",aa),Dt("H",ue),Dt("h",ue),Dt("k",ue),Dt("HH",ue,Qe),Dt("hh",ue,Qe),Dt("kk",ue,Qe),Dt("hmm",Pe),Dt("hmmss",De),Dt("Hmm",Pe),Dt("Hmmss",De),Yr(["H","HH"],ia),Yr(["k","kk"],function(M,B,X){var ne=tt(M);B[ia]=ne===24?0:ne}),Yr(["a","A"],function(M,B,X){X._isPm=X._locale.isPM(M),X._meridiem=M}),Yr(["h","hh"],function(M,B,X){B[ia]=tt(M),h(X).bigHour=!0}),Yr("hmm",function(M,B,X){var ne=M.length-2;B[ia]=tt(M.substr(0,ne)),B[Fs]=tt(M.substr(ne)),h(X).bigHour=!0}),Yr("hmmss",function(M,B,X){var ne=M.length-4,de=M.length-2;B[ia]=tt(M.substr(0,ne)),B[Fs]=tt(M.substr(ne,2)),B[Wl]=tt(M.substr(de)),h(X).bigHour=!0}),Yr("Hmm",function(M,B,X){var ne=M.length-2;B[ia]=tt(M.substr(0,ne)),B[Fs]=tt(M.substr(ne))}),Yr("Hmmss",function(M,B,X){var ne=M.length-4,de=M.length-2;B[ia]=tt(M.substr(0,ne)),B[Fs]=tt(M.substr(ne,2)),B[Wl]=tt(M.substr(de))});function Ju(M){return(M+"").toLowerCase().charAt(0)==="p"}var Gb=/[ap]\.?m?\.?/i,co=Ct("Hours",!0);function Ig(M,B,X){return M>11?X?"pm":"PM":X?"am":"AM"}var Yf={calendar:I,longDateFormat:ve,invalidDate:me,ordinal:$,dayOfMonthOrdinalParse:ae,relativeTime:U,months:Dg,monthsShort:Vh,week:ul,weekdays:zb,weekdaysMin:Wb,weekdaysShort:Ub,meridiemParse:Gb},gi={},lp={},Lo;function Qb(M,B){var X,ne=Math.min(M.length,B.length);for(X=0;X0;){if(de=eA(Re.slice(0,X).join("-")),de)return de;if(ne&&ne.length>=X&&Qb(Re,ne)>=X-1)break;X--}B++}return Lo}function Zb(M){return M.match("^[^/\\\\]*$")!=null}function eA(M){var B=null,X;if(gi[M]===void 0&&typeof Ex<"u"&&Ex&&Ex.exports&&Zb(M))try{B=Lo._abbr,X=require,X("./locale/"+M),Qc(B)}catch{gi[M]=null}return gi[M]}function Qc(M,B){var X;return M&&(s(B)?X=Ba(M):X=zo(M,B),X?Lo=X:typeof console<"u"&&console.warn&&console.warn("Locale "+M+" not found. Did you forget to load it?")),Lo._abbr}function zo(M,B){if(B!==null){var X,ne=Yf;if(B.abbr=M,gi[M]!=null)C("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."),ne=gi[M]._config;else if(B.parentLocale!=null)if(gi[B.parentLocale]!=null)ne=gi[B.parentLocale]._config;else if(X=eA(B.parentLocale),X!=null)ne=X._config;else return lp[B.parentLocale]||(lp[B.parentLocale]=[]),lp[B.parentLocale].push({name:M,config:B}),null;return gi[M]=new q(P(ne,B)),lp[M]&&lp[M].forEach(function(de){zo(de.name,de.config)}),Qc(M),gi[M]}else return delete gi[M],null}function NE(M,B){if(B!=null){var X,ne,de=Yf;gi[M]!=null&&gi[M].parentLocale!=null?gi[M].set(P(gi[M]._config,B)):(ne=eA(M),ne!=null&&(de=ne._config),B=P(de,B),ne==null&&(B.abbr=M),X=new q(B),X.parentLocale=gi[M],gi[M]=X),Qc(M)}else gi[M]!=null&&(gi[M].parentLocale!=null?(gi[M]=gi[M].parentLocale,M===Qc()&&Qc(M)):gi[M]!=null&&delete gi[M]);return gi[M]}function Ba(M){var B;if(M&&M._locale&&M._locale._abbr&&(M=M._locale._abbr),!M)return Lo;if(!n(M)){if(B=eA(M),B)return B;M=[M]}return Yb(M)}function TE(){return z(gi)}function Bg(M){var B,X=M._a;return X&&h(M).overflow===-2&&(B=X[is]<0||X[is]>11?is:X[Ts]<1||X[Ts]>Hf(X[fi],X[is])?Ts:X[ia]<0||X[ia]>24||X[ia]===24&&(X[Fs]!==0||X[Wl]!==0||X[ol]!==0)?ia:X[Fs]<0||X[Fs]>59?Fs:X[Wl]<0||X[Wl]>59?Wl:X[ol]<0||X[ol]>999?ol:-1,h(M)._overflowDayOfYear&&(BTs)&&(B=Ts),h(M)._overflowWeeks&&B===-1&&(B=kg),h(M)._overflowWeekday&&B===-1&&(B=Vc),h(M).overflow=B),M}var Zf=/^\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)?)?$/,Rg=/^\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)?)?$/,o1=/Z|[+-]\d\d(?::?\d\d)?/,si=[["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]],ec=[["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/]],s1=/^\/?Date\((-?\d+)/i,FE=/^(?:(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}))$/,l1={UT:0,GMT:0,EDT:-4*60,EST:-5*60,CDT:-5*60,CST:-6*60,MDT:-6*60,MST:-7*60,PDT:-7*60,PST:-8*60};function Xb(M){var B,X,ne=M._i,de=Zf.exec(ne)||Rg.exec(ne),Re,Je,ar,Hr,Jn=si.length,fl=ec.length;if(de){for(h(M).iso=!0,B=0,X=Jn;Bku(Je)||M._dayOfYear===0)&&(h(M)._overflowDayOfYear=!0),X=bm(Je,0,M._dayOfYear),M._a[is]=X.getUTCMonth(),M._a[Ts]=X.getUTCDate()),B=0;B<3&&M._a[B]==null;++B)M._a[B]=ne[B]=de[B];for(;B<7;B++)M._a[B]=ne[B]=M._a[B]==null?B===2?1:0:M._a[B];M._a[ia]===24&&M._a[Fs]===0&&M._a[Wl]===0&&M._a[ol]===0&&(M._nextDay=!0,M._a[ia]=0),M._d=(M._useUTC?bm:n1).apply(null,ne),Re=M._useUTC?M._d.getUTCDay():M._d.getDay(),M._tzm!=null&&M._d.setUTCMinutes(M._d.getUTCMinutes()-M._tzm),M._nextDay&&(M._a[ia]=24),M._w&&typeof M._w.d<"u"&&M._w.d!==Re&&(h(M).weekdayMismatch=!0)}}function Jt(M){var B,X,ne,de,Re,Je,ar,Hr,Jn;B=M._w,B.GG!=null||B.W!=null||B.E!=null?(Re=1,Je=4,X=up(B.GG,M._a[fi],Qf(On(),1,4).year),ne=up(B.W,1),de=up(B.E,1),(de<1||de>7)&&(Hr=!0)):(Re=M._locale._week.dow,Je=M._locale._week.doy,Jn=Qf(On(),Re,Je),X=up(B.gg,M._a[fi],Jn.year),ne=up(B.w,Jn.week),B.d!=null?(de=B.d,(de<0||de>6)&&(Hr=!0)):B.e!=null?(de=B.e+Re,(B.e<0||B.e>6)&&(Hr=!0)):de=Re),ne<1||ne>Hl(X,Re,Je)?h(M)._overflowWeeks=!0:Hr!=null?h(M)._overflowWeekday=!0:(ar=i1(X,ne,de,Re,Je),M._a[fi]=ar.year,M._dayOfYear=ar.dayOfYear)}t.ISO_8601=function(){},t.RFC_2822=function(){};function hr(M){if(M._f===t.ISO_8601){Xb(M);return}if(M._f===t.RFC_2822){tA(M);return}M._a=[],h(M).empty=!0;var B=""+M._i,X,ne,de,Re,Je,ar=B.length,Hr=0,Jn,fl;for(de=Oe(M._f,M._locale).match(_)||[],fl=de.length,X=0;X0&&h(M).unusedInput.push(Je),B=B.slice(B.indexOf(ne)+ne.length),Hr+=ne.length),te[Re]?(ne?h(M).empty=!1:h(M).unusedTokens.push(Re),gm(Re,ne,M)):M._strict&&!ne&&h(M).unusedTokens.push(Re);h(M).charsLeftOver=ar-Hr,B.length>0&&h(M).unusedInput.push(B),M._a[ia]<=12&&h(M).bigHour===!0&&M._a[ia]>0&&(h(M).bigHour=void 0),h(M).parsedDateParts=M._a.slice(0),h(M).meridiem=M._meridiem,M._a[ia]=Ur(M._locale,M._a[ia],M._meridiem),Jn=h(M).era,Jn!==null&&(M._a[fi]=M._locale.erasConvertYear(Jn,M._a[fi])),ft(M),Bg(M)}function Ur(M,B,X){var ne;return X==null?B:M.meridiemHour!=null?M.meridiemHour(B,X):(M.isPM!=null&&(ne=M.isPM(X),ne&&B<12&&(B+=12),!ne&&B===12&&(B=0)),B)}function Dn(M){var B,X,ne,de,Re,Je,ar=!1,Hr=M._f.length;if(Hr===0){h(M).invalidFormat=!0,M._d=new Date(NaN);return}for(de=0;dethis?this:M:A()});function yO(M,B){var X,ne;if(B.length===1&&n(B[0])&&(B=B[0]),!B.length)return On();for(X=B[0],ne=1;nethis.clone().month(0).utcOffset()||this.utcOffset()>this.clone().month(5).utcOffset()}function rt(){if(!s(this._isDSTShifted))return this._isDSTShifted;var M={},B;return x(M,this),M=Oi(M),M._a?(B=M._isUTC?d(M._a):On(M._a),this._isDSTShifted=this.isValid()&&xR(M._a,B.toArray())>0):this._isDSTShifted=!1,this._isDSTShifted}function Xe(){return this.isValid()?!this._isUTC:!1}function Ut(){return this.isValid()?this._isUTC:!1}function Fr(){return this.isValid()?this._isUTC&&this._offset===0:!1}var Kn=/^(-|\+)?(?:(\d*)[. ])?(\d+):(\d+)(?::(\d+)(\.\d*)?)?$/,ko=/^(-|\+)?P(?:([-+]?[0-9,.]*)Y)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)W)?(?:([-+]?[0-9,.]*)D)?(?:T(?:([-+]?[0-9,.]*)H)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)S)?)?$/;function ln(M,B){var X=M,ne=null,de,Re,Je;return Yc(M)?X={ms:M._milliseconds,d:M._days,M:M._months}:l(M)||!isNaN(+M)?(X={},B?X[B]=+M:X.milliseconds=+M):(ne=Kn.exec(M))?(de=ne[1]==="-"?-1:1,X={y:0,d:tt(ne[Ts])*de,h:tt(ne[ia])*de,m:tt(ne[Fs])*de,s:tt(ne[Wl])*de,ms:tt(qg(ne[ol]*1e3))*de}):(ne=ko.exec(M))?(de=ne[1]==="-"?-1:1,X={y:cp(ne[2],de),M:cp(ne[3],de),w:cp(ne[4],de),d:cp(ne[5],de),h:cp(ne[6],de),m:cp(ne[7],de),s:cp(ne[8],de)}):X==null?X={}:typeof X=="object"&&("from"in X||"to"in X)&&(Je=nc(On(X.from),On(X.to)),X={},X.ms=Je.milliseconds,X.M=Je.months),Re=new c1(X),Yc(M)&&a(M,"_locale")&&(Re._locale=M._locale),Yc(M)&&a(M,"_isValid")&&(Re._isValid=M._isValid),Re}ln.fn=c1.prototype,ln.invalid=PE;function cp(M,B){var X=M&&parseFloat(M.replace(",","."));return(isNaN(X)?0:X)*B}function xO(M,B){var X={};return X.months=B.month()-M.month()+(B.year()-M.year())*12,M.clone().add(X.months,"M").isAfter(B)&&--X.months,X.milliseconds=+B-+M.clone().add(X.months,"M"),X}function nc(M,B){var X;return M.isValid()&&B.isValid()?(B=Du(B,M),M.isBefore(B)?X=xO(M,B):(X=xO(B,M),X.milliseconds=-X.milliseconds,X.months=-X.months),X):{milliseconds:0,months:0}}function f1(M,B){return function(X,ne){var de,Re;return ne!==null&&!isNaN(+ne)&&(C(B,"moment()."+B+"(period, number) is deprecated. Please use moment()."+B+"(number, period). See http://momentjs.com/guides/#/warnings/add-inverted-param/ for more info."),Re=X,X=ne,ne=Re),de=ln(X,ne),wO(this,de,M),this}}function wO(M,B,X,ne){var de=B._milliseconds,Re=qg(B._days),Je=qg(B._months);!M.isValid()||(ne=ne??!0,Je&&Cn(M,we(M,"Month")+Je*X),Re&&Be(M,"Date",we(M,"Date")+Re*X),de&&M._d.setTime(M._d.valueOf()+de*X),ne&&t.updateOffset(M,Re||Je))}var Lg=f1(1,"add"),rx=f1(-1,"subtract");function d1(M){return typeof M=="string"||M instanceof String}function di(M){return S(M)||u(M)||d1(M)||l(M)||SO(M)||OR(M)||M===null||M===void 0}function OR(M){var B=i(M)&&!o(M),X=!1,ne=["years","year","y","months","month","M","days","day","d","dates","date","D","hours","hour","h","minutes","minute","m","seconds","second","s","milliseconds","millisecond","ms"],de,Re,Je=ne.length;for(de=0;deX.valueOf():X.valueOf()9999?Se(X,B?"YYYYYY-MM-DD[T]HH:mm:ss.SSS[Z]":"YYYYYY-MM-DD[T]HH:mm:ss.SSSZ"):N(Date.prototype.toISOString)?B?this.toDate().toISOString():new Date(this.valueOf()+this.utcOffset()*60*1e3).toISOString().replace("Z",Se(X,"Z")):Se(X,B?"YYYY-MM-DD[T]HH:mm:ss.SSS[Z]":"YYYY-MM-DD[T]HH:mm:ss.SSSZ")}function nA(){if(!this.isValid())return"moment.invalid(/* "+this._i+" */)";var M="moment",B="",X,ne,de,Re;return this.isLocal()||(M=this.utcOffset()===0?"moment.utc":"moment.parseZone",B="Z"),X="["+M+'("]',ne=0<=this.year()&&this.year()<=9999?"YYYY":"YYYYYY",de="-MM-DD[T]HH:mm:ss.SSS",Re=B+'[")]',this.format(X+ne+de+Re)}function sx(M){M||(M=this.isUtc()?t.defaultFormatUtc:t.defaultFormat);var B=Se(this,M);return this.localeData().postformat(B)}function TR(M,B){return this.isValid()&&(S(M)&&M.isValid()||On(M).isValid())?ln({to:this,from:M}).locale(this.locale()).humanize(!B):this.localeData().invalidDate()}function FR(M){return this.from(On(),M)}function _R(M,B){return this.isValid()&&(S(M)&&M.isValid()||On(M).isValid())?ln({from:this,to:M}).locale(this.locale()).humanize(!B):this.localeData().invalidDate()}function lx(M){return this.to(On(),M)}function m1(M){var B;return M===void 0?this._locale._abbr:(B=Ba(M),B!=null&&(this._locale=B),this)}var ux=j("moment().lang() is deprecated. Instead, use moment().localeData() to get the language configuration. Use moment().locale() to change languages.",function(M){return M===void 0?this.localeData():this.locale(M)});function OO(){return this._locale}var h1=1e3,zg=60*h1,cx=60*zg,fo=(365*400+97)*24*cx;function Ga(M,B){return(M%B+B)%B}function MO(M,B,X){return M<100&&M>=0?new Date(M+400,B,X)-fo:new Date(M,B,X).valueOf()}function jO(M,B,X){return M<100&&M>=0?Date.UTC(M+400,B,X)-fo:Date.UTC(M,B,X)}function NO(M){var B,X;if(M=re(M),M===void 0||M==="millisecond"||!this.isValid())return this;switch(X=this._isUTC?jO:MO,M){case"year":B=X(this.year(),0,1);break;case"quarter":B=X(this.year(),this.month()-this.month()%3,1);break;case"month":B=X(this.year(),this.month(),1);break;case"week":B=X(this.year(),this.month(),this.date()-this.weekday());break;case"isoWeek":B=X(this.year(),this.month(),this.date()-(this.isoWeekday()-1));break;case"day":case"date":B=X(this.year(),this.month(),this.date());break;case"hour":B=this._d.valueOf(),B-=Ga(B+(this._isUTC?0:this.utcOffset()*zg),cx);break;case"minute":B=this._d.valueOf(),B-=Ga(B,zg);break;case"second":B=this._d.valueOf(),B-=Ga(B,h1);break}return this._d.setTime(B),t.updateOffset(this,!0),this}function PR(M){var B,X;if(M=re(M),M===void 0||M==="millisecond"||!this.isValid())return this;switch(X=this._isUTC?jO:MO,M){case"year":B=X(this.year()+1,0,1)-1;break;case"quarter":B=X(this.year(),this.month()-this.month()%3+3,1)-1;break;case"month":B=X(this.year(),this.month()+1,1)-1;break;case"week":B=X(this.year(),this.month(),this.date()-this.weekday()+7)-1;break;case"isoWeek":B=X(this.year(),this.month(),this.date()-(this.isoWeekday()-1)+7)-1;break;case"day":case"date":B=X(this.year(),this.month(),this.date()+1)-1;break;case"hour":B=this._d.valueOf(),B+=cx-Ga(B+(this._isUTC?0:this.utcOffset()*zg),cx)-1;break;case"minute":B=this._d.valueOf(),B+=zg-Ga(B,zg)-1;break;case"second":B=this._d.valueOf(),B+=h1-Ga(B,h1)-1;break}return this._d.setTime(B),t.updateOffset(this,!0),this}function IE(){return this._d.valueOf()-(this._offset||0)*6e4}function A1(){return Math.floor(this.valueOf()/1e3)}function BE(){return new Date(this.valueOf())}function Ug(){var M=this;return[M.year(),M.month(),M.date(),M.hour(),M.minute(),M.second(),M.millisecond()]}function g1(){var M=this;return{years:M.year(),months:M.month(),date:M.date(),hours:M.hours(),minutes:M.minutes(),seconds:M.seconds(),milliseconds:M.milliseconds()}}function v1(){return this.isValid()?this.toISOString():null}function fx(){return g(this)}function Wg(){return f({},h(this))}function IR(){return h(this).overflow}function BR(){return{input:this._i,format:this._f,locale:this._locale,isUTC:this._isUTC,strict:this._strict}}Q("N",0,0,"eraAbbr"),Q("NN",0,0,"eraAbbr"),Q("NNN",0,0,"eraAbbr"),Q("NNNN",0,0,"eraName"),Q("NNNNN",0,0,"eraNarrow"),Q("y",["y",1],"yo","eraYear"),Q("y",["yy",2],0,"eraYear"),Q("y",["yyy",3],0,"eraYear"),Q("y",["yyyy",4],0,"eraYear"),Dt("N",rn),Dt("NN",rn),Dt("NNN",rn),Dt("NNNN",LR),Dt("NNNNN",zR),Yr(["N","NN","NNN","NNNN","NNNNN"],function(M,B,X,ne){var de=X._locale.erasParse(M,ne,X._strict);de?h(X).era=de:h(X).invalidEra=M}),Dt("y",Wr),Dt("yy",Wr),Dt("yyy",Wr),Dt("yyyy",Wr),Dt("yo",UR),Yr(["y","yy","yyy","yyyy"],fi),Yr(["yo"],function(M,B,X,ne){var de;X._locale._eraYearOrdinalRegex&&(de=M.match(X._locale._eraYearOrdinalRegex)),X._locale.eraYearOrdinalParse?B[fi]=X._locale.eraYearOrdinalParse(M,de):B[fi]=parseInt(M,10)});function RR(M,B){var X,ne,de,Re=this._eras||Ba("en")._eras;for(X=0,ne=Re.length;X=0)return Re[ne]}function qR(M,B){var X=M.since<=M.until?1:-1;return B===void 0?t(M.since).year():t(M.since).year()+(B-M.offset)*X}function dx(){var M,B,X,ne=this.localeData().eras();for(M=0,B=ne.length;MRe&&(B=Re),YR.call(this,M,B,X,ne,de))}function YR(M,B,X,ne,de){var Re=i1(M,B,X,ne,de),Je=bm(Re.year,0,Re.dayOfYear);return this.year(Je.getUTCFullYear()),this.month(Je.getUTCMonth()),this.date(Je.getUTCDate()),this}Q("Q",0,"Qo","quarter"),ie("quarter","Q"),_e("quarter",7),Dt("Q",He),Yr("Q",function(M,B){B[is]=(tt(M)-1)*3});function ZR(M){return M==null?Math.ceil((this.month()+1)/3):this.month((M-1)*3+this.month()%3)}Q("D",["DD",2],"Do","date"),ie("date","D"),_e("date",9),Dt("D",ue),Dt("DD",ue,Qe),Dt("Do",function(M,B){return M?B._dayOfMonthOrdinalParse||B._ordinalParse:B._dayOfMonthOrdinalParseLenient}),Yr(["D","DD"],Ts),Yr("Do",function(M,B){B[Ts]=tt(M.match(ue)[0])});var _O=Ct("Date",!0);Q("DDD",["DDDD",3],"DDDo","dayOfYear"),ie("dayOfYear","DDD"),_e("dayOfYear",4),Dt("DDD",at),Dt("DDDD",et),Yr(["DDD","DDDD"],function(M,B,X){X._dayOfYear=tt(M)});function pp(M){var B=Math.round((this.clone().startOf("day")-this.clone().startOf("year"))/864e5)+1;return M==null?B:this.add(M-B,"d")}Q("m",["mm",2],0,"minute"),ie("minute","m"),_e("minute",14),Dt("m",ue),Dt("mm",ue,Qe),Yr(["m","mm"],Fs);var XR=Ct("Minutes",!1);Q("s",["ss",2],0,"second"),ie("second","s"),_e("second",15),Dt("s",ue),Dt("ss",ue,Qe),Yr(["s","ss"],Wl);var KR=Ct("Seconds",!1);Q("S",0,0,function(){return~~(this.millisecond()/100)}),Q(0,["SS",2],0,function(){return~~(this.millisecond()/10)}),Q(0,["SSS",3],0,"millisecond"),Q(0,["SSSS",4],0,function(){return this.millisecond()*10}),Q(0,["SSSSS",5],0,function(){return this.millisecond()*100}),Q(0,["SSSSSS",6],0,function(){return this.millisecond()*1e3}),Q(0,["SSSSSSS",7],0,function(){return this.millisecond()*1e4}),Q(0,["SSSSSSSS",8],0,function(){return this.millisecond()*1e5}),Q(0,["SSSSSSSSS",9],0,function(){return this.millisecond()*1e6}),ie("millisecond","ms"),_e("millisecond",16),Dt("S",at,He),Dt("SS",at,Qe),Dt("SSS",at,et);var km,PO;for(km="SSSS";km.length<=9;km+="S")Dt(km,Wr);function JR(M,B){B[ol]=tt(("0."+M)*1e3)}for(km="S";km.length<=9;km+="S")Yr(km,JR);PO=Ct("Milliseconds",!1),Q("z",0,0,"zoneAbbr"),Q("zz",0,0,"zoneName");function iA(){return this._isUTC?"UTC":""}function e$(){return this._isUTC?"Coordinated Universal Time":""}var bt=w.prototype;bt.add=Lg,bt.calendar=jR,bt.clone=NR,bt.diff=CO,bt.endOf=PR,bt.format=sx,bt.from=TR,bt.fromNow=FR,bt.to=_R,bt.toNow=lx,bt.get=Le,bt.invalidAt=IR,bt.isAfter=ix,bt.isBefore=Em,bt.isBetween=ax,bt.isSame=EO,bt.isSameOrAfter=ox,bt.isSameOrBefore=kO,bt.isValid=fx,bt.lang=ux,bt.locale=m1,bt.localeData=OO,bt.max=hR,bt.min=ex,bt.parsingFlags=Wg,bt.set=Ze,bt.startOf=NO,bt.subtract=rx,bt.toArray=Ug,bt.toObject=g1,bt.toDate=BE,bt.toISOString=p1,bt.inspect=nA,typeof Symbol<"u"&&Symbol.for!=null&&(bt[Symbol.for("nodejs.util.inspect.custom")]=function(){return"Moment<"+this.format()+">"}),bt.toJSON=v1,bt.toString=DO,bt.unix=A1,bt.valueOf=IE,bt.creationData=BR,bt.eraName=dx,bt.eraNarrow=y1,bt.eraAbbr=TO,bt.eraYear=pe,bt.year=ll,bt.isLeapYear=r1,bt.weekYear=WR,bt.isoWeekYear=HR,bt.quarter=bt.quarters=ZR,bt.month=sl,bt.daysInMonth=sp,bt.week=bt.weeks=Zh,bt.isoWeek=bt.isoWeeks=qb,bt.weeksInYear=dp,bt.weeksInWeekYear=QR,bt.isoWeeksInYear=VR,bt.isoWeeksInISOWeekYear=GR,bt.date=_O,bt.day=bt.days=W,bt.weekday=K,bt.isoWeekday=se,bt.dayOfYear=pp,bt.hour=bt.hours=co,bt.minute=bt.minutes=XR,bt.second=bt.seconds=KR,bt.millisecond=bt.milliseconds=PO,bt.utcOffset=SR,bt.utc=kR,bt.local=CR,bt.parseZone=DR,bt.hasAlignedHourOffset=Sm,bt.isDST=Ue,bt.isLocal=Xe,bt.isUtcOffset=Ut,bt.isUtc=Fr,bt.isUTC=Fr,bt.zoneAbbr=iA,bt.zoneName=e$,bt.dates=j("dates accessor is deprecated. Use date instead.",_O),bt.months=j("months accessor is deprecated. Use month instead",sl),bt.years=j("years accessor is deprecated. Use year instead",ll),bt.zone=j("moment().zone is deprecated, use moment().utcOffset instead. http://momentjs.com/guides/#/warnings/zone/",ER),bt.isDSTShifted=j("isDSTShifted is deprecated. See http://momentjs.com/guides/#/warnings/dst-shifted/ for more information",rt);function Zc(M){return On(M*1e3)}function t$(){return On.apply(null,arguments).parseZone()}function IO(M){return M}var Un=q.prototype;Un.calendar=T,Un.longDateFormat=ye,Un.invalidDate=ke,Un.ordinal=ce,Un.preparse=IO,Un.postformat=IO,Un.relativeTime=R,Un.pastFuture=J,Un.set=D,Un.eras=RR,Un.erasParse=$R,Un.erasConvertYear=qR,Un.erasAbbrRegex=px,Un.erasNameRegex=Hg,Un.erasNarrowRegex=ic,Un.months=Vf,Un.monthsShort=kn,Un.monthsParse=Qh,Un.monthsRegex=Mg,Un.monthsShortRegex=Gc,Un.week=Yh,Un.firstDayOfYear=Ng,Un.firstDayOfWeek=jg,Un.weekdays=Kh,Un.weekdaysMin=Cu,Un.weekdaysShort=Jh,Un.weekdaysParse=Vb,Un.weekdaysRegex=xe,Un.weekdaysShortRegex=je,Un.weekdaysMinRegex=Ke,Un.isPM=Ju,Un.meridiem=Ig;function hx(M,B,X,ne){var de=Ba(),Re=d().set(ne,B);return de[X](Re,M)}function BO(M,B,X){if(l(M)&&(B=M,M=void 0),M=M||"",B!=null)return hx(M,B,X,"month");var ne,de=[];for(ne=0;ne<12;ne++)de[ne]=hx(M,ne,X,"month");return de}function Ax(M,B,X,ne){typeof M=="boolean"?(l(B)&&(X=B,B=void 0),B=B||""):(B=M,X=B,M=!1,l(B)&&(X=B,B=void 0),B=B||"");var de=Ba(),Re=M?de._week.dow:0,Je,ar=[];if(X!=null)return hx(B,(X+Re)%7,ne,"day");for(Je=0;Je<7;Je++)ar[Je]=hx(B,(Je+Re)%7,ne,"day");return ar}function RO(M,B){return BO(M,B,"months")}function r$(M,B){return BO(M,B,"monthsShort")}function n$(M,B,X){return Ax(M,B,X,"weekdays")}function RE(M,B,X){return Ax(M,B,X,"weekdaysShort")}function b1(M,B,X){return Ax(M,B,X,"weekdaysMin")}Qc("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(M){var B=M%10,X=tt(M%100/10)===1?"th":B===1?"st":B===2?"nd":B===3?"rd":"th";return M+X}}),t.lang=j("moment.lang is deprecated. Use moment.locale instead.",Qc),t.langData=j("moment.langData is deprecated. Use moment.localeData instead.",Ba);var ac=Math.abs;function i$(){var M=this._data;return this._milliseconds=ac(this._milliseconds),this._days=ac(this._days),this._months=ac(this._months),M.milliseconds=ac(M.milliseconds),M.seconds=ac(M.seconds),M.minutes=ac(M.minutes),M.hours=ac(M.hours),M.months=ac(M.months),M.years=ac(M.years),this}function $E(M,B,X,ne){var de=ln(B,X);return M._milliseconds+=ne*de._milliseconds,M._days+=ne*de._days,M._months+=ne*de._months,M._bubble()}function a$(M,B){return $E(this,M,B,1)}function mp(M,B){return $E(this,M,B,-1)}function gx(M){return M<0?Math.floor(M):Math.ceil(M)}function aA(){var M=this._milliseconds,B=this._days,X=this._months,ne=this._data,de,Re,Je,ar,Hr;return M>=0&&B>=0&&X>=0||M<=0&&B<=0&&X<=0||(M+=gx(qE(X)+B)*864e5,B=0,X=0),ne.milliseconds=M%1e3,de=Ye(M/1e3),ne.seconds=de%60,Re=Ye(de/60),ne.minutes=Re%60,Je=Ye(Re/60),ne.hours=Je%24,B+=Ye(Je/24),Hr=Ye(Ou(B)),X+=Hr,B-=gx(qE(Hr)),ar=Ye(X/12),X%=12,ne.days=B,ne.months=X,ne.years=ar,this}function Ou(M){return M*4800/146097}function qE(M){return M*146097/4800}function $O(M){if(!this.isValid())return NaN;var B,X,ne=this._milliseconds;if(M=re(M),M==="month"||M==="quarter"||M==="year")switch(B=this._days+ne/864e5,X=this._months+Ou(B),M){case"month":return X;case"quarter":return X/3;case"year":return X/12}else switch(B=this._days+Math.round(qE(this._months)),M){case"week":return B/7+ne/6048e5;case"day":return B+ne/864e5;case"hour":return B*24+ne/36e5;case"minute":return B*1440+ne/6e4;case"second":return B*86400+ne/1e3;case"millisecond":return Math.floor(B*864e5)+ne;default:throw new Error("Unknown unit "+M)}}function qO(){return this.isValid()?this._milliseconds+this._days*864e5+this._months%12*2592e6+tt(this._months/12)*31536e6:NaN}function Mu(M){return function(){return this.as(M)}}var Cm=Mu("ms"),LO=Mu("s"),o$=Mu("m"),vx=Mu("h"),s$=Mu("d"),zO=Mu("w"),as=Mu("M"),LE=Mu("Q"),UO=Mu("y");function Kf(){return ln(this)}function zE(M){return M=re(M),this.isValid()?this[M+"s"]():NaN}function Jf(M){return function(){return this.isValid()?this._data[M]:NaN}}var oA=Jf("milliseconds"),WO=Jf("seconds"),cl=Jf("minutes"),UE=Jf("hours"),l$=Jf("days"),u$=Jf("months"),c$=Jf("years");function WE(){return Ye(this.days()/7)}var hp=Math.round,ed={ss:44,s:45,m:45,h:22,d:26,w:null,M:11};function HO(M,B,X,ne,de){return de.relativeTime(B||1,!!X,M,ne)}function f$(M,B,X,ne){var de=ln(M).abs(),Re=hp(de.as("s")),Je=hp(de.as("m")),ar=hp(de.as("h")),Hr=hp(de.as("d")),Jn=hp(de.as("M")),fl=hp(de.as("w")),td=hp(de.as("y")),Ap=Re<=X.ss&&["s",Re]||Re0,Ap[4]=ne,HO.apply(null,Ap)}function d$(M){return M===void 0?hp:typeof M=="function"?(hp=M,!0):!1}function x1(M,B){return ed[M]===void 0?!1:B===void 0?ed[M]:(ed[M]=B,M==="s"&&(ed.ss=B-1),!0)}function p$(M,B){if(!this.isValid())return this.localeData().invalidDate();var X=!1,ne=ed,de,Re;return typeof M=="object"&&(B=M,M=!1),typeof M=="boolean"&&(X=M),typeof B=="object"&&(ne=Object.assign({},ed,B),B.s!=null&&B.ss==null&&(ne.ss=B.s-1)),de=this.localeData(),Re=f$(this,!X,ne,de),X&&(Re=de.pastFuture(+this,Re)),de.postformat(Re)}var HE=Math.abs;function Dm(M){return(M>0)-(M<0)||+M}function w1(){if(!this.isValid())return this.localeData().invalidDate();var M=HE(this._milliseconds)/1e3,B=HE(this._days),X=HE(this._months),ne,de,Re,Je,ar=this.asSeconds(),Hr,Jn,fl,td;return ar?(ne=Ye(M/60),de=Ye(ne/60),M%=60,ne%=60,Re=Ye(X/12),X%=12,Je=M?M.toFixed(3).replace(/\.?0+$/,""):"",Hr=ar<0?"-":"",Jn=Dm(this._months)!==Dm(ar)?"-":"",fl=Dm(this._days)!==Dm(ar)?"-":"",td=Dm(this._milliseconds)!==Dm(ar)?"-":"",Hr+"P"+(Re?Jn+Re+"Y":"")+(X?Jn+X+"M":"")+(B?fl+B+"D":"")+(de||ne||M?"T":"")+(de?td+de+"H":"")+(ne?td+ne+"M":"")+(M?td+Je+"S":"")):"P0D"}var Mn=c1.prototype;Mn.isValid=bR,Mn.abs=i$,Mn.add=a$,Mn.subtract=mp,Mn.as=$O,Mn.asMilliseconds=Cm,Mn.asSeconds=LO,Mn.asMinutes=o$,Mn.asHours=vx,Mn.asDays=s$,Mn.asWeeks=zO,Mn.asMonths=as,Mn.asQuarters=LE,Mn.asYears=UO,Mn.valueOf=qO,Mn._bubble=aA,Mn.clone=Kf,Mn.get=zE,Mn.milliseconds=oA,Mn.seconds=WO,Mn.minutes=cl,Mn.hours=UE,Mn.days=l$,Mn.weeks=WE,Mn.months=u$,Mn.years=c$,Mn.humanize=p$,Mn.toISOString=w1,Mn.toString=w1,Mn.toJSON=w1,Mn.locale=m1,Mn.localeData=OO,Mn.toIsoString=j("toIsoString() is deprecated. Please use toISOString() instead (notice the capitals)",w1),Mn.lang=ux,Q("X",0,0,"unix"),Q("x",0,0,"valueOf"),Dt("x",en),Dt("X",ns),Yr("X",function(M,B,X){X._d=new Date(parseFloat(M)*1e3)}),Yr("x",function(M,B,X){X._d=new Date(tt(M))});return t.version="2.29.4",r(On),t.fn=bt,t.min=AR,t.max=gR,t.now=vR,t.utc=d,t.unix=Zc,t.months=RO,t.isDate=u,t.locale=Qc,t.invalid=A,t.duration=ln,t.isMoment=S,t.weekdays=n$,t.parseZone=t$,t.localeData=Ba,t.isDuration=Yc,t.monthsShort=r$,t.weekdaysMin=b1,t.defineLocale=zo,t.updateLocale=NE,t.locales=TE,t.weekdaysShort=RE,t.normalizeUnits=re,t.relativeTimeRounding=d$,t.relativeTimeThreshold=x1,t.calendarFormat=MR,t.prototype=bt,t.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"},t})});var yi=vn((Wx,ck)=>{(function(){var e,t="4.17.21",r=200,n="Unsupported core-js use. Try https://npms.io/search?q=ponyfill.",i="Expected a function",a="Invalid `variable` option passed into `_.template`",o="__lodash_hash_undefined__",s=500,l="__lodash_placeholder__",u=1,c=2,f=4,d=1,p=2,h=1,m=2,g=4,A=8,b=16,v=32,x=64,w=128,S=256,k=512,j=30,O="...",C=800,N=16,D=1,P=2,q=3,z=1/0,I=9007199254740991,T=17976931348623157e292,L=0/0,_=4294967295,Y=_-1,oe=_>>>1,te=[["ary",w],["bind",h],["bindKey",m],["curry",A],["curryRight",b],["flip",k],["partial",v],["partialRight",x],["rearg",S]],Q="[object Arguments]",fe="[object Array]",Ie="[object AsyncFunction]",Se="[object Boolean]",Oe="[object Date]",ve="[object DOMException]",ye="[object Error]",me="[object Function]",ke="[object GeneratorFunction]",$="[object Map]",ae="[object Number]",ce="[object Null]",U="[object Object]",R="[object Promise]",J="[object Proxy]",ee="[object RegExp]",ie="[object Set]",re="[object String]",Ee="[object Symbol]",Ce="[object Undefined]",_e="[object WeakMap]",he="[object WeakSet]",ze="[object ArrayBuffer]",Ye="[object DataView]",tt="[object Float32Array]",Ct="[object Float64Array]",we="[object Int8Array]",Be="[object Int16Array]",Le="[object Int32Array]",Ze="[object Uint8Array]",He="[object Uint8ClampedArray]",Qe="[object Uint16Array]",et="[object Uint32Array]",Ge=/\b__p \+= '';/g,G=/\b(__p \+=) '' \+/g,ue=/(__e\(.*?\)|\b__t\)) \+\n'';/g,Pe=/&(?:amp|lt|gt|quot|#39);/g,De=/[&<>"']/g,at=RegExp(Pe.source),ht=RegExp(De.source),Zt=/<%-([\s\S]+?)%>/g,Wr=/<%([\s\S]+?)%>/g,en=/<%=([\s\S]+?)%>/g,tn=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,ci=/^\w*$/,ns=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Qi=/[\\^$.*+?()[\]{}|]/g,Pa=RegExp(Qi.source),Dt=/^\s+/,Hc=/\s/,Wf=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,Va=/\{\n\/\* \[wrapped with (.+)\] \*/,Eu=/,? & /,Yr=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,Ul=/[()=,{}\[\]\/\s]/,gm=/\\(\\)?/g,fi=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,is=/\w*$/,Ts=/^[-+]0x[0-9a-f]+$/i,ia=/^0b[01]+$/i,Fs=/^\[object .+?Constructor\]$/,Wl=/^0o[0-7]+$/i,ol=/^(?:0|[1-9]\d*)$/,kg=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,Vc=/($^)/,Cg=/['\n\r\u2028\u2029\\]/g,_n="\\ud800-\\udfff",Hf="\\u0300-\\u036f",Dg="\\ufe20-\\ufe2f",Vh="\\u20d0-\\u20ff",vm=Hf+Dg+Vh,Og="\\u2700-\\u27bf",Gh="a-z\\xdf-\\xf6\\xf8-\\xff",Vf="\\xac\\xb1\\xd7\\xf7",kn="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",Ia="\\u2000-\\u206f",Qh=" \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",Cn="A-Z\\xc0-\\xd6\\xd8-\\xde",sl="\\ufe0e\\ufe0f",sp=Vf+kn+Ia+Qh,Gc="['\u2019]",Mg="["+_n+"]",ym="["+sp+"]",ku="["+vm+"]",ll="\\d+",r1="["+Og+"]",n1="["+Gh+"]",bm="[^"+_n+sp+ll+Og+Gh+Cn+"]",Gf="\\ud83c[\\udffb-\\udfff]",i1="(?:"+ku+"|"+Gf+")",Qf="[^"+_n+"]",Hl="(?:\\ud83c[\\udde6-\\uddff]){2}",Yh="[\\ud800-\\udbff][\\udc00-\\udfff]",ul="["+Cn+"]",jg="\\u200d",Ng="(?:"+n1+"|"+bm+")",Zh="(?:"+ul+"|"+bm+")",qb="(?:"+Gc+"(?:d|ll|m|re|s|t|ve))?",Lb="(?:"+Gc+"(?:D|LL|M|RE|S|T|VE))?",Tg=i1+"?",Fg="["+sl+"]?",zb="(?:"+jg+"(?:"+[Qf,Hl,Yh].join("|")+")"+Fg+Tg+")*",Ub="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",Wb="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",Xh=Fg+Tg+zb,_g="(?:"+[r1,Hl,Yh].join("|")+")"+Xh,Hb="(?:"+[Qf+ku+"?",ku,Hl,Yh,Mg].join("|")+")",Kh=RegExp(Gc,"g"),Jh=RegExp(ku,"g"),Cu=RegExp(Gf+"(?="+Gf+")|"+Hb+Xh,"g"),Pg=RegExp([ul+"?"+n1+"+"+qb+"(?="+[ym,ul,"$"].join("|")+")",Zh+"+"+Lb+"(?="+[ym,ul+Ng,"$"].join("|")+")",ul+"?"+Ng+"+"+qb,ul+"+"+Lb,Wb,Ub,ll,_g].join("|"),"g"),Vb=RegExp("["+jg+_n+vm+sl+"]"),W=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,K=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],se=-1,xe={};xe[tt]=xe[Ct]=xe[we]=xe[Be]=xe[Le]=xe[Ze]=xe[He]=xe[Qe]=xe[et]=!0,xe[Q]=xe[fe]=xe[ze]=xe[Se]=xe[Ye]=xe[Oe]=xe[ye]=xe[me]=xe[$]=xe[ae]=xe[U]=xe[ee]=xe[ie]=xe[re]=xe[_e]=!1;var je={};je[Q]=je[fe]=je[ze]=je[Ye]=je[Se]=je[Oe]=je[tt]=je[Ct]=je[we]=je[Be]=je[Le]=je[$]=je[ae]=je[U]=je[ee]=je[ie]=je[re]=je[Ee]=je[Ze]=je[He]=je[Qe]=je[et]=!0,je[ye]=je[me]=je[_e]=!1;var Ke={\u00C0:"A",\u00C1:"A",\u00C2:"A",\u00C3:"A",\u00C4:"A",\u00C5:"A",\u00E0:"a",\u00E1:"a",\u00E2:"a",\u00E3:"a",\u00E4:"a",\u00E5:"a",\u00C7:"C",\u00E7:"c",\u00D0:"D",\u00F0:"d",\u00C8:"E",\u00C9:"E",\u00CA:"E",\u00CB:"E",\u00E8:"e",\u00E9:"e",\u00EA:"e",\u00EB:"e",\u00CC:"I",\u00CD:"I",\u00CE:"I",\u00CF:"I",\u00EC:"i",\u00ED:"i",\u00EE:"i",\u00EF:"i",\u00D1:"N",\u00F1:"n",\u00D2:"O",\u00D3:"O",\u00D4:"O",\u00D5:"O",\u00D6:"O",\u00D8:"O",\u00F2:"o",\u00F3:"o",\u00F4:"o",\u00F5:"o",\u00F6:"o",\u00F8:"o",\u00D9:"U",\u00DA:"U",\u00DB:"U",\u00DC:"U",\u00F9:"u",\u00FA:"u",\u00FB:"u",\u00FC:"u",\u00DD:"Y",\u00FD:"y",\u00FF:"y",\u00C6:"Ae",\u00E6:"ae",\u00DE:"Th",\u00FE:"th",\u00DF:"ss",\u0100:"A",\u0102:"A",\u0104:"A",\u0101:"a",\u0103:"a",\u0105:"a",\u0106:"C",\u0108:"C",\u010A:"C",\u010C:"C",\u0107:"c",\u0109:"c",\u010B:"c",\u010D:"c",\u010E:"D",\u0110:"D",\u010F:"d",\u0111:"d",\u0112:"E",\u0114:"E",\u0116:"E",\u0118:"E",\u011A:"E",\u0113:"e",\u0115:"e",\u0117:"e",\u0119:"e",\u011B:"e",\u011C:"G",\u011E:"G",\u0120:"G",\u0122:"G",\u011D:"g",\u011F:"g",\u0121:"g",\u0123:"g",\u0124:"H",\u0126:"H",\u0125:"h",\u0127:"h",\u0128:"I",\u012A:"I",\u012C:"I",\u012E:"I",\u0130:"I",\u0129:"i",\u012B:"i",\u012D:"i",\u012F:"i",\u0131:"i",\u0134:"J",\u0135:"j",\u0136:"K",\u0137:"k",\u0138:"k",\u0139:"L",\u013B:"L",\u013D:"L",\u013F:"L",\u0141:"L",\u013A:"l",\u013C:"l",\u013E:"l",\u0140:"l",\u0142:"l",\u0143:"N",\u0145:"N",\u0147:"N",\u014A:"N",\u0144:"n",\u0146:"n",\u0148:"n",\u014B:"n",\u014C:"O",\u014E:"O",\u0150:"O",\u014D:"o",\u014F:"o",\u0151:"o",\u0154:"R",\u0156:"R",\u0158:"R",\u0155:"r",\u0157:"r",\u0159:"r",\u015A:"S",\u015C:"S",\u015E:"S",\u0160:"S",\u015B:"s",\u015D:"s",\u015F:"s",\u0161:"s",\u0162:"T",\u0164:"T",\u0166:"T",\u0163:"t",\u0165:"t",\u0167:"t",\u0168:"U",\u016A:"U",\u016C:"U",\u016E:"U",\u0170:"U",\u0172:"U",\u0169:"u",\u016B:"u",\u016D:"u",\u016F:"u",\u0171:"u",\u0173:"u",\u0174:"W",\u0175:"w",\u0176:"Y",\u0177:"y",\u0178:"Y",\u0179:"Z",\u017B:"Z",\u017D:"Z",\u017A:"z",\u017C:"z",\u017E:"z",\u0132:"IJ",\u0133:"ij",\u0152:"Oe",\u0153:"oe",\u0149:"'n",\u017F:"s"},ot={"&":"&","<":"<",">":">",'"':""","'":"'"},xr={"&":"&","<":"<",">":">",""":'"',"'":"'"},Pn={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},sn=parseFloat,aa=parseInt,Ju=typeof global=="object"&&global&&global.Object===Object&&global,Gb=typeof self=="object"&&self&&self.Object===Object&&self,co=Ju||Gb||Function("return this")(),Ig=typeof Wx=="object"&&Wx&&!Wx.nodeType&&Wx,Yf=Ig&&typeof ck=="object"&&ck&&!ck.nodeType&&ck,gi=Yf&&Yf.exports===Ig,lp=gi&&Ju.process,Lo=function(){try{var Ue=Yf&&Yf.require&&Yf.require("util").types;return Ue||lp&&lp.binding&&lp.binding("util")}catch{}}(),Qb=Lo&&Lo.isArrayBuffer,a1=Lo&&Lo.isDate,Yb=Lo&&Lo.isMap,Zb=Lo&&Lo.isRegExp,eA=Lo&&Lo.isSet,Qc=Lo&&Lo.isTypedArray;function zo(Ue,rt,Xe){switch(Xe.length){case 0:return Ue.call(rt);case 1:return Ue.call(rt,Xe[0]);case 2:return Ue.call(rt,Xe[0],Xe[1]);case 3:return Ue.call(rt,Xe[0],Xe[1],Xe[2])}return Ue.apply(rt,Xe)}function NE(Ue,rt,Xe,Ut){for(var Fr=-1,Kn=Ue==null?0:Ue.length;++Fr-1}function o1(Ue,rt,Xe){for(var Ut=-1,Fr=Ue==null?0:Ue.length;++Ut-1;);return Xe}function ex(Ue,rt){for(var Xe=Ue.length;Xe--&&xm(rt,Ue[Xe],0)>-1;);return Xe}function hR(Ue,rt){for(var Xe=Ue.length,Ut=0;Xe--;)Ue[Xe]===rt&&++Ut;return Ut}var yO=ft(Ke),AR=ft(ot);function gR(Ue){return"\\"+Pn[Ue]}function vR(Ue,rt){return Ue==null?e:Ue[rt]}function Xf(Ue){return Vb.test(Ue)}function yR(Ue){return W.test(Ue)}function bR(Ue){for(var rt,Xe=[];!(rt=Ue.next()).done;)Xe.push(rt.value);return Xe}function PE(Ue){var rt=-1,Xe=Array(Ue.size);return Ue.forEach(function(Ut,Fr){Xe[++rt]=[Fr,Ut]}),Xe}function c1(Ue,rt){return function(Xe){return Ue(rt(Xe))}}function Yc(Ue,rt){for(var Xe=-1,Ut=Ue.length,Fr=0,Kn=[];++Xe-1}function _O(y,E){var F=this.__data__,Z=ac(F,y);return Z<0?(++this.size,F.push([y,E])):F[Z][1]=E,this}dp.prototype.clear=QR,dp.prototype.delete=FO,dp.prototype.get=YR,dp.prototype.has=ZR,dp.prototype.set=_O;function pp(y){var E=-1,F=y==null?0:y.length;for(this.clear();++E=E?y:E)),y}function Ou(y,E,F,Z,le,be){var Fe,$e=E&u,We=E&c,st=E&f;if(F&&(Fe=le?F(y,Z,le,be):F(y)),Fe!==e)return Fe;if(!Qa(y))return y;var lt=Vr(y);if(lt){if(Fe=Hje(y),!$e)return oc(y,Fe)}else{var At=Vl(y),Pt=At==me||At==ke;if(Yg(y))return aK(y,$e);if(At==U||At==Q||Pt&&!le){if(Fe=We||Pt?{}:EK(y),!$e)return We?_je(y,a$(Fe,y)):Fje(y,$E(Fe,y))}else{if(!je[At])return le?y:{};Fe=Vje(y,At,$e)}}be||(be=new Zc);var rr=be.get(y);if(rr)return rr;be.set(y,Fe),JK(y)?y.forEach(function(Sr){Fe.add(Ou(Sr,E,F,Sr,y,be))}):XK(y)&&y.forEach(function(Sr,gn){Fe.set(gn,Ou(Sr,E,F,gn,y,be))});var wr=st?We?C$:k$:We?lc:Is,nn=lt?e:wr(y);return Ba(nn||y,function(Sr,gn){nn&&(gn=Sr,Sr=y[gn]),b1(Fe,gn,Ou(Sr,E,F,gn,y,be))}),Fe}function qE(y){var E=Is(y);return function(F){return $O(F,y,E)}}function $O(y,E,F){var Z=F.length;if(y==null)return!Z;for(y=ln(y);Z--;){var le=F[Z],be=E[le],Fe=y[le];if(Fe===e&&!(le in y)||!be(Fe))return!1}return!0}function qO(y,E,F){if(typeof y!="function")throw new nc(i);return YE(function(){y.apply(e,F)},E)}function Mu(y,E,F,Z){var le=-1,be=Rg,Fe=!0,$e=y.length,We=[],st=E.length;if(!$e)return We;F&&(E=si(E,Oi(F))),Z?(be=o1,Fe=!1):E.length>=r&&(be=rc,Fe=!1,E=new iA(E));e:for(;++le<$e;){var lt=y[le],At=F==null?lt:F(lt);if(lt=Z||lt!==0?lt:0,Fe&&At===At){for(var Pt=st;Pt--;)if(E[Pt]===At)continue e;We.push(lt)}else be(E,At,Z)||We.push(lt)}return We}var Cm=cK(Kf),LO=cK(zE,!0);function o$(y,E){var F=!0;return Cm(y,function(Z,le,be){return F=!!E(Z,le,be),F}),F}function vx(y,E,F){for(var Z=-1,le=y.length;++Zle?0:le+F),Z=Z===e||Z>le?le:Xr(Z),Z<0&&(Z+=le),Z=F>Z?0:tJ(Z);F0&&F($e)?E>1?as($e,E-1,F,Z,le):ec(le,$e):Z||(le[le.length]=$e)}return le}var LE=fK(),UO=fK(!0);function Kf(y,E){return y&&LE(y,E,Is)}function zE(y,E){return y&&UO(y,E,Is)}function Jf(y,E){return Zf(E,function(F){return cA(y[F])})}function oA(y,E){E=Gg(E,y);for(var F=0,Z=E.length;y!=null&&FE}function l$(y,E){return y!=null&&di.call(y,E)}function u$(y,E){return y!=null&&E in ln(y)}function c$(y,E,F){return y>=Ga(E,F)&&y=120&<.length>=120)?new iA(Fe&<):e}lt=y[0];var At=-1,Pt=$e[0];e:for(;++At-1;)$e!==y&&rA.call($e,We,1),rA.call(y,We,1);return y}function XX(y,E){for(var F=y?E.length:0,Z=F-1;F--;){var le=E[F];if(F==Z||le!==be){var be=le;uA(le)?rA.call(y,le,1):v$(y,le)}}return y}function h$(y,E){return y+m1(NO()*(E-y+1))}function wje(y,E,F,Z){for(var le=-1,be=fo(lx((E-y)/(F||1)),0),Fe=Xe(be);be--;)Fe[Z?be:++le]=y,y+=F;return Fe}function A$(y,E){var F="";if(!y||E<1||E>I)return F;do E%2&&(F+=y),E=m1(E/2),E&&(y+=y);while(E);return F}function un(y,E){return F$(DK(y,E,uc),y+"")}function Sje(y){return RO(Sx(y))}function Eje(y,E){var F=Sx(y);return tM(F,aA(E,0,F.length))}function VE(y,E,F,Z){if(!Qa(y))return y;E=Gg(E,y);for(var le=-1,be=E.length,Fe=be-1,$e=y;$e!=null&&++lele?0:le+E),F=F>le?le:F,F<0&&(F+=le),le=E>F?0:F-E>>>0,E>>>=0;for(var be=Xe(le);++Z>>1,Fe=y[be];Fe!==null&&!Kc(Fe)&&(F?Fe<=E:Fe=r){var st=E?null:Rje(y);if(st)return qg(st);Fe=!1,le=rc,We=new iA}else We=E?[]:$e;e:for(;++Z=Z?y:rd(y,E,F)}var iK=TR||function(y){return co.clearTimeout(y)};function aK(y,E){if(E)return y.slice();var F=y.length,Z=EO?EO(F):new y.constructor(F);return y.copy(Z),Z}function w$(y){var E=new y.constructor(y.byteLength);return new ax(E).set(new ax(y)),E}function Mje(y,E){var F=E?w$(y.buffer):y.buffer;return new y.constructor(F,y.byteOffset,y.byteLength)}function jje(y){var E=new y.constructor(y.source,is.exec(y));return E.lastIndex=y.lastIndex,E}function Nje(y){return y1?ln(y1.call(y)):{}}function oK(y,E){var F=E?w$(y.buffer):y.buffer;return new y.constructor(F,y.byteOffset,y.length)}function sK(y,E){if(y!==E){var F=y!==e,Z=y===null,le=y===y,be=Kc(y),Fe=E!==e,$e=E===null,We=E===E,st=Kc(E);if(!$e&&!st&&!be&&y>E||be&&Fe&&We&&!$e&&!st||Z&&Fe&&We||!F&&We||!le)return 1;if(!Z&&!be&&!st&&y=$e)return We;var st=F[Z];return We*(st=="desc"?-1:1)}}return y.index-E.index}function lK(y,E,F,Z){for(var le=-1,be=y.length,Fe=F.length,$e=-1,We=E.length,st=fo(be-Fe,0),lt=Xe(We+st),At=!Z;++$e1?F[le-1]:e,Fe=le>2?F[2]:e;for(be=y.length>3&&typeof be=="function"?(le--,be):e,Fe&&ju(F[0],F[1],Fe)&&(be=le<3?e:be,le=1),E=ln(E);++Z-1?le[be?E[Fe]:Fe]:e}}function mK(y){return lA(function(E){var F=E.length,Z=F,le=ic.prototype.thru;for(y&&E.reverse();Z--;){var be=E[Z];if(typeof be!="function")throw new nc(i);if(le&&!Fe&&JO(be)=="wrapper")var Fe=new ic([],!0)}for(Z=Fe?Z:F;++Z1&&In.reverse(),lt&&We$e))return!1;var st=be.get(y),lt=be.get(E);if(st&<)return st==E&<==y;var At=-1,Pt=!0,rr=F&p?new iA:e;for(be.set(y,E),be.set(E,y);++At<$e;){var wr=y[At],nn=E[At];if(Z)var Sr=Fe?Z(nn,wr,At,E,y,be):Z(wr,nn,At,y,E,be);if(Sr!==e){if(Sr)continue;Pt=!1;break}if(rr){if(!l1(E,function(gn,In){if(!rc(rr,In)&&(wr===gn||le(wr,gn,F,Z,be)))return rr.push(In)})){Pt=!1;break}}else if(!(wr===nn||le(wr,nn,F,Z,be))){Pt=!1;break}}return be.delete(y),be.delete(E),Pt}function qje(y,E,F,Z,le,be,Fe){switch(F){case Ye:if(y.byteLength!=E.byteLength||y.byteOffset!=E.byteOffset)return!1;y=y.buffer,E=E.buffer;case ze:return!(y.byteLength!=E.byteLength||!be(new ax(y),new ax(E)));case Se:case Oe:case ae:return gp(+y,+E);case ye:return y.name==E.name&&y.message==E.message;case ee:case re:return y==E+"";case $:var $e=PE;case ie:var We=Z&d;if($e||($e=qg),y.size!=E.size&&!We)return!1;var st=Fe.get(y);if(st)return st==E;Z|=p,Fe.set(y,E);var lt=xK($e(y),$e(E),Z,le,be,Fe);return Fe.delete(y),lt;case Ee:if(y1)return y1.call(y)==y1.call(E)}return!1}function Lje(y,E,F,Z,le,be){var Fe=F&d,$e=k$(y),We=$e.length,st=k$(E),lt=st.length;if(We!=lt&&!Fe)return!1;for(var At=We;At--;){var Pt=$e[At];if(!(Fe?Pt in E:di.call(E,Pt)))return!1}var rr=be.get(y),wr=be.get(E);if(rr&&wr)return rr==E&&wr==y;var nn=!0;be.set(y,E),be.set(E,y);for(var Sr=Fe;++At1?"& ":"")+E[Z],E=E.join(F>2?", ":" "),y.replace(Wf,`{ /* [wrapped with `+E+`] */ -`)}function Qje(y){return Vr(y)||k1(y)||!!(DO&&y&&y[DO])}function uA(y,E){var F=typeof y;return E=E??I,!!E&&(F=="number"||F!="symbol"&&ol.test(y))&&y>-1&&y%1==0&&y0){if(++E>=C)return arguments[0]}else E=0;return y.apply(e,arguments)}}function tM(y,E){var F=-1,Z=y.length,le=Z-1;for(E=E===e?Z:E;++F1?y[E-1]:e;return F=typeof F=="function"?(y.pop(),F):e,$K(y,F)});function qK(y){var E=pe(y);return E.__chain__=!0,E}function aTe(y,E){return E(y),y}function rM(y,E){return E(y)}var oTe=lA(function(y){var E=y.length,F=E?y[0]:0,Z=this.__wrapped__,le=function(be){return gx(be,y)};return E>1||this.__actions__.length||!(Z instanceof rn)||!uA(F)?this.thru(le):(Z=Z.slice(F,+F+(E?1:0)),Z.__actions__.push({func:rM,args:[le],thisArg:e}),new ic(Z,this.__chain__).thru(function(be){return E&&!be.length&&be.push(e),be}))});function sTe(){return qK(this)}function lTe(){return new ic(this.value(),this.__chain__)}function uTe(){this.__values__===e&&(this.__values__=eJ(this.value()));var y=this.__index__>=this.__values__.length,E=y?e:this.__values__[this.__index__++];return{done:y,value:E}}function cTe(){return this}function fTe(y){for(var E,F=this;F instanceof px;){var Z=FK(F);Z.__index__=0,Z.__values__=e,E?le.__wrapped__=Z:E=Z;var le=Z;F=F.__wrapped__}return le.__wrapped__=y,E}function dTe(){var y=this.__wrapped__;if(y instanceof rn){var E=y;return this.__actions__.length&&(E=new rn(this)),E=E.reverse(),E.__actions__.push({func:rM,args:[_$],thisArg:e}),new ic(E,this.__chain__)}return this.thru(_$)}function pTe(){return rK(this.__wrapped__,this.__actions__)}var mTe=QO(function(y,E,F){di.call(y,F)?++y[F]:mp(y,F,1)});function hTe(y,E,F){var Z=Vr(y)?Bg:o$;return F&&ju(y,E,F)&&(E=e),Z(y,Ar(E,3))}function ATe(y,E){var F=Vr(y)?Zf:zO;return F(y,Ar(E,3))}var gTe=pK(_K),vTe=pK(PK);function yTe(y,E){return as(nM(y,E),1)}function bTe(y,E){return as(nM(y,E),z)}function xTe(y,E,F){return F=F===e?1:Xr(F),as(nM(y,E),F)}function LK(y,E){var F=Vr(y)?Ba:km;return F(y,Ar(E,3))}function zK(y,E){var F=Vr(y)?TE:LO;return F(y,Ar(E,3))}var wTe=QO(function(y,E,F){di.call(y,F)?y[F].push(E):mp(y,F,[E])});function STe(y,E,F,Z){y=sc(y)?y:Sx(y),F=F&&!Z?Xr(F):0;var le=y.length;return F<0&&(F=fo(le+F,0)),lM(y)?F<=le&&y.indexOf(E,F)>-1:!!le&&bm(y,E,F)>-1}var ETe=un(function(y,E,F){var Z=-1,le=typeof E=="function",be=sc(y)?Xe(y.length):[];return km(y,function(Fe){be[++Z]=le?zo(E,Fe,F):ed(Fe,E,F)}),be}),kTe=QO(function(y,E,F){mp(y,F,E)});function nM(y,E){var F=Vr(y)?si:Je;return F(y,Ar(E,3))}function CTe(y,E,F,Z){return y==null?[]:(Vr(E)||(E=E==null?[]:[E]),F=Z?e:F,Vr(F)||(F=F==null?[]:[F]),Ap(y,E,F))}var DTe=QO(function(y,E,F){y[F?0:1].push(E)},function(){return[[],[]]});function OTe(y,E,F){var Z=Vr(y)?s1:Jt,le=arguments.length<3;return Z(y,Ar(E,4),F,le,km)}function MTe(y,E,F){var Z=Vr(y)?FE:Jt,le=arguments.length<3;return Z(y,Ar(E,4),F,le,LO)}function jTe(y,E){var F=Vr(y)?Zf:zO;return F(y,oM(Ar(E,3)))}function NTe(y){var E=Vr(y)?RO:Sje;return E(y)}function TTe(y,E,F){(F?ju(y,E,F):E===e)?E=1:E=Xr(E);var Z=Vr(y)?r$:Eje;return Z(y,E)}function FTe(y){var E=Vr(y)?n$:Cje;return E(y)}function _Te(y){if(y==null)return 0;if(sc(y))return lM(y)?xm(y):y.length;var E=Vl(y);return E==$||E==ie?y.size:ne(y).length}function PTe(y,E,F){var Z=Vr(y)?l1:Dje;return F&&ju(y,E,F)&&(E=e),Z(y,Ar(E,3))}var ITe=un(function(y,E){if(y==null)return[];var F=E.length;return F>1&&ju(y,E[0],E[1])?E=[]:F>2&&ju(E[0],E[1],E[2])&&(E=[E[0]]),Ap(y,as(E,1),[])}),iM=FR||function(){return co.Date.now()};function BTe(y,E){if(typeof E!="function")throw new nc(i);return y=Xr(y),function(){if(--y<1)return E.apply(this,arguments)}}function UK(y,E,F){return E=F?e:E,E=y&&E==null?y.length:E,sA(y,w,e,e,e,e,E)}function WK(y,E){var F;if(typeof E!="function")throw new nc(i);return y=Xr(y),function(){return--y>0&&(F=E.apply(this,arguments)),y<=1&&(E=e),F}}var I$=un(function(y,E,F){var Z=h;if(F.length){var le=Yc(F,xx(I$));Z|=v}return sA(y,Z,E,F,le)}),HK=un(function(y,E,F){var Z=h|m;if(F.length){var le=Yc(F,xx(HK));Z|=v}return sA(E,Z,y,F,le)});function VK(y,E,F){E=F?e:E;var Z=sA(y,A,e,e,e,e,e,E);return Z.placeholder=VK.placeholder,Z}function GK(y,E,F){E=F?e:E;var Z=sA(y,b,e,e,e,e,e,E);return Z.placeholder=GK.placeholder,Z}function QK(y,E,F){var Z,le,be,Fe,$e,We,st=0,lt=!1,At=!1,Pt=!0;if(typeof y!="function")throw new nc(i);E=id(E)||0,Qa(F)&&(lt=!!F.leading,At="maxWait"in F,be=At?fo(id(F.maxWait)||0,E):be,Pt="trailing"in F?!!F.trailing:Pt);function rr(Do){var vp=Z,dA=le;return Z=le=e,st=Do,Fe=y.apply(dA,vp),Fe}function wr(Do){return st=Do,$e=YE(gn,E),lt?rr(Do):Fe}function nn(Do){var vp=Do-We,dA=Do-st,pJ=E-vp;return At?Ga(pJ,be-dA):pJ}function Sr(Do){var vp=Do-We,dA=Do-st;return We===e||vp>=E||vp<0||At&&dA>=be}function gn(){var Do=iM();if(Sr(Do))return In(Do);$e=YE(gn,nn(Do))}function In(Do){return $e=e,Pt&&Z?rr(Do):(Z=le=e,Fe)}function Jc(){$e!==e&&iK($e),st=0,Z=We=le=$e=e}function Nu(){return $e===e?Fe:In(iM())}function ef(){var Do=iM(),vp=Sr(Do);if(Z=arguments,le=this,We=Do,vp){if($e===e)return wr(We);if(At)return iK($e),$e=YE(gn,E),rr(We)}return $e===e&&($e=YE(gn,E)),Fe}return ef.cancel=Jc,ef.flush=Nu,ef}var RTe=un(function(y,E){return qO(y,1,E)}),$Te=un(function(y,E,F){return qO(y,id(E)||0,F)});function qTe(y){return sA(y,k)}function aM(y,E){if(typeof y!="function"||E!=null&&typeof E!="function")throw new nc(i);var F=function(){var Z=arguments,le=E?E.apply(this,Z):Z[0],be=F.cache;if(be.has(le))return be.get(le);var Fe=y.apply(this,Z);return F.cache=be.set(le,Fe)||be,Fe};return F.cache=new(aM.Cache||pp),F}aM.Cache=pp;function oM(y){if(typeof y!="function")throw new nc(i);return function(){var E=arguments;switch(E.length){case 0:return!y.call(this);case 1:return!y.call(this,E[0]);case 2:return!y.call(this,E[0],E[1]);case 3:return!y.call(this,E[0],E[1],E[2])}return!y.apply(this,E)}}function LTe(y){return WK(2,y)}var zTe=Oje(function(y,E){E=E.length==1&&Vr(E[0])?si(E[0],Oi(Ar())):si(as(E,1),Oi(Ar()));var F=E.length;return un(function(Z){for(var le=-1,be=Ga(Z.length,F);++le=E}),k1=HO(function(){return arguments}())?HO:function(y){return po(y)&&di.call(y,"callee")&&!CO.call(y,"callee")},Vr=Xe.isArray,nFe=Qb?Oi(Qb):f$;function sc(y){return y!=null&&sM(y.length)&&!cA(y)}function Co(y){return po(y)&&sc(y)}function iFe(y){return y===!0||y===!1||po(y)&&cl(y)==Se}var Yg=OO||Q$,aFe=a1?Oi(a1):d$;function oFe(y){return po(y)&&y.nodeType===1&&!ZE(y)}function sFe(y){if(y==null)return!0;if(sc(y)&&(Vr(y)||typeof y=="string"||typeof y.splice=="function"||Yg(y)||wx(y)||k1(y)))return!y.length;var E=Vl(y);if(E==$||E==ie)return!y.size;if(QE(y))return!ne(y).length;for(var F in y)if(di.call(y,F))return!1;return!0}function lFe(y,E){return x1(y,E)}function uFe(y,E,F){F=typeof F=="function"?F:e;var Z=F?F(y,E):e;return Z===e?x1(y,E,e,F):!!Z}function R$(y){if(!po(y))return!1;var E=cl(y);return E==ye||E==ve||typeof y.message=="string"&&typeof y.name=="string"&&!ZE(y)}function cFe(y){return typeof y=="number"&&h1(y)}function cA(y){if(!Qa(y))return!1;var E=cl(y);return E==me||E==ke||E==Ie||E==J}function ZK(y){return typeof y=="number"&&y==Xr(y)}function sM(y){return typeof y=="number"&&y>-1&&y%1==0&&y<=I}function Qa(y){var E=typeof y;return y!=null&&(E=="object"||E=="function")}function po(y){return y!=null&&typeof y=="object"}var XK=Yb?Oi(Yb):HE;function fFe(y,E){return y===E||Cm(y,E,O$(E))}function dFe(y,E,F){return F=typeof F=="function"?F:e,Cm(y,E,O$(E),F)}function pFe(y){return KK(y)&&y!=+y}function mFe(y){if(Xje(y))throw new Fr(n);return w1(y)}function hFe(y){return y===null}function AFe(y){return y==null}function KK(y){return typeof y=="number"||po(y)&&cl(y)==ae}function ZE(y){if(!po(y)||cl(y)!=U)return!1;var E=ox(y);if(E===null)return!0;var F=di.call(E,"constructor")&&E.constructor;return typeof F=="function"&&F instanceof F&&d1.call(F)==MR}var $$=Zb?Oi(Zb):Mn;function gFe(y){return ZK(y)&&y>=-I&&y<=I}var JK=eA?Oi(eA):M;function lM(y){return typeof y=="string"||!Vr(y)&&po(y)&&cl(y)==re}function Kc(y){return typeof y=="symbol"||po(y)&&cl(y)==Ee}var wx=Qc?Oi(Qc):B;function vFe(y){return y===e}function yFe(y){return po(y)&&Vl(y)==_e}function bFe(y){return po(y)&&cl(y)==he}var xFe=KO(Re),wFe=KO(function(y,E){return y<=E});function eJ(y){if(!y)return[];if(sc(y))return lM(y)?Du(y):oc(y);if(p1&&y[p1])return bR(y[p1]());var E=Vl(y),F=E==$?PE:E==ie?qg:Sx;return F(y)}function fA(y){if(!y)return y===0?y:0;if(y=id(y),y===z||y===-z){var E=y<0?-1:1;return E*T}return y===y?y:0}function Xr(y){var E=fA(y),F=E%1;return E===E?F?E-F:E:0}function tJ(y){return y?aA(Xr(y),0,_):0}function id(y){if(typeof y=="number")return y;if(Kc(y))return L;if(Qa(y)){var E=typeof y.valueOf=="function"?y.valueOf():y;y=Qa(E)?E+"":E}if(typeof y!="string")return y===0?y:+y;y=_s(y);var F=ia.test(y);return F||Wl.test(y)?aa(y.slice(2),F?2:8):Ts.test(y)?L:+y}function rJ(y){return Dm(y,lc(y))}function SFe(y){return y?aA(Xr(y),-I,I):y===0?y:0}function vi(y){return y==null?"":Xc(y)}var EFe=yx(function(y,E){if(QE(E)||sc(E)){Dm(E,Is(E),y);return}for(var F in E)di.call(E,F)&&b1(y,F,E[F])}),nJ=yx(function(y,E){Dm(E,lc(E),y)}),uM=yx(function(y,E,F,Z){Dm(E,lc(E),y,Z)}),kFe=yx(function(y,E,F,Z){Dm(E,Is(E),y,Z)}),CFe=lA(gx);function DFe(y,E){var F=Hg(y);return E==null?F:$E(F,E)}var OFe=un(function(y,E){y=ln(y);var F=-1,Z=E.length,le=Z>2?E[2]:e;for(le&&ju(E[0],E[1],le)&&(Z=1);++F1),be}),Dm(y,C$(y),F),Z&&(F=Ou(F,u|c|f,$je));for(var le=E.length;le--;)v$(F,E[le]);return F});function VFe(y,E){return aJ(y,oM(Ar(E)))}var GFe=lA(function(y,E){return y==null?{}:bje(y,E)});function aJ(y,E){if(y==null)return{};var F=si(C$(y),function(Z){return[Z]});return E=Ar(E),ZX(y,F,function(Z,le){return E(Z,le[0])})}function QFe(y,E,F){E=Gg(E,y);var Z=-1,le=E.length;for(le||(le=1,y=e);++ZE){var Z=y;y=E,E=Z}if(F||y%1||E%1){var le=NO();return Ga(y+le*(E-y+sn("1e-"+((le+"").length-1))),E)}return h$(y,E)}var a3e=bx(function(y,E,F){return E=E.toLowerCase(),y+(F?lJ(E):E)});function lJ(y){return z$(vi(y).toLowerCase())}function uJ(y){return y=vi(y),y&&y.replace(kg,yO).replace(Jh,"")}function o3e(y,E,F){y=vi(y),E=Xc(E);var Z=y.length;F=F===e?Z:aA(Xr(F),0,Z);var le=F;return F-=E.length,F>=0&&y.slice(F,le)==E}function s3e(y){return y=vi(y),y&&ht.test(y)?y.replace(De,AR):y}function l3e(y){return y=vi(y),y&&Pa.test(y)?y.replace(Qi,"\\$&"):y}var u3e=bx(function(y,E,F){return y+(F?"-":"")+E.toLowerCase()}),c3e=bx(function(y,E,F){return y+(F?" ":"")+E.toLowerCase()}),f3e=dK("toLowerCase");function d3e(y,E,F){y=vi(y),E=Xr(E);var Z=E?xm(y):0;if(!E||Z>=E)return y;var le=(E-Z)/2;return XO(m1(le),F)+y+XO(lx(le),F)}function p3e(y,E,F){y=vi(y),E=Xr(E);var Z=E?xm(y):0;return E&&Z>>0,F?(y=vi(y),y&&(typeof E=="string"||E!=null&&!$$(E))&&(E=Xc(E),!E&&Xf(y))?Qg(Du(y),0,F):y.split(E,F)):[]}var b3e=bx(function(y,E,F){return y+(F?" ":"")+z$(E)});function x3e(y,E,F){return y=vi(y),F=F==null?0:aA(Xr(F),0,y.length),E=Xc(E),y.slice(F,F+E.length)==E}function w3e(y,E,F){var Z=pe.templateSettings;F&&ju(y,E,F)&&(E=e),y=vi(y),E=uM({},E,Z,yK);var le=uM({},E.imports,Z.imports,yK),be=Is(le),Fe=Ps(le,be),$e,We,st=0,lt=E.interpolate||Vc,At="__p += '",Pt=cp((E.escape||Vc).source+"|"+lt.source+"|"+(lt===en?fi:Vc).source+"|"+(E.evaluate||Vc).source+"|$","g"),rr="//# sourceURL="+(di.call(E,"sourceURL")?(E.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++se+"]")+` +`)}function Qje(y){return Vr(y)||k1(y)||!!(DO&&y&&y[DO])}function uA(y,E){var F=typeof y;return E=E??I,!!E&&(F=="number"||F!="symbol"&&ol.test(y))&&y>-1&&y%1==0&&y0){if(++E>=C)return arguments[0]}else E=0;return y.apply(e,arguments)}}function tM(y,E){var F=-1,Z=y.length,le=Z-1;for(E=E===e?Z:E;++F1?y[E-1]:e;return F=typeof F=="function"?(y.pop(),F):e,$K(y,F)});function qK(y){var E=pe(y);return E.__chain__=!0,E}function aTe(y,E){return E(y),y}function rM(y,E){return E(y)}var oTe=lA(function(y){var E=y.length,F=E?y[0]:0,Z=this.__wrapped__,le=function(be){return gx(be,y)};return E>1||this.__actions__.length||!(Z instanceof rn)||!uA(F)?this.thru(le):(Z=Z.slice(F,+F+(E?1:0)),Z.__actions__.push({func:rM,args:[le],thisArg:e}),new ic(Z,this.__chain__).thru(function(be){return E&&!be.length&&be.push(e),be}))});function sTe(){return qK(this)}function lTe(){return new ic(this.value(),this.__chain__)}function uTe(){this.__values__===e&&(this.__values__=eJ(this.value()));var y=this.__index__>=this.__values__.length,E=y?e:this.__values__[this.__index__++];return{done:y,value:E}}function cTe(){return this}function fTe(y){for(var E,F=this;F instanceof px;){var Z=FK(F);Z.__index__=0,Z.__values__=e,E?le.__wrapped__=Z:E=Z;var le=Z;F=F.__wrapped__}return le.__wrapped__=y,E}function dTe(){var y=this.__wrapped__;if(y instanceof rn){var E=y;return this.__actions__.length&&(E=new rn(this)),E=E.reverse(),E.__actions__.push({func:rM,args:[_$],thisArg:e}),new ic(E,this.__chain__)}return this.thru(_$)}function pTe(){return rK(this.__wrapped__,this.__actions__)}var mTe=QO(function(y,E,F){di.call(y,F)?++y[F]:mp(y,F,1)});function hTe(y,E,F){var Z=Vr(y)?Bg:o$;return F&&ju(y,E,F)&&(E=e),Z(y,Ar(E,3))}function ATe(y,E){var F=Vr(y)?Zf:zO;return F(y,Ar(E,3))}var gTe=pK(_K),vTe=pK(PK);function yTe(y,E){return as(nM(y,E),1)}function bTe(y,E){return as(nM(y,E),z)}function xTe(y,E,F){return F=F===e?1:Xr(F),as(nM(y,E),F)}function LK(y,E){var F=Vr(y)?Ba:Cm;return F(y,Ar(E,3))}function zK(y,E){var F=Vr(y)?TE:LO;return F(y,Ar(E,3))}var wTe=QO(function(y,E,F){di.call(y,F)?y[F].push(E):mp(y,F,[E])});function STe(y,E,F,Z){y=sc(y)?y:Sx(y),F=F&&!Z?Xr(F):0;var le=y.length;return F<0&&(F=fo(le+F,0)),lM(y)?F<=le&&y.indexOf(E,F)>-1:!!le&&xm(y,E,F)>-1}var ETe=un(function(y,E,F){var Z=-1,le=typeof E=="function",be=sc(y)?Xe(y.length):[];return Cm(y,function(Fe){be[++Z]=le?zo(E,Fe,F):ed(Fe,E,F)}),be}),kTe=QO(function(y,E,F){mp(y,F,E)});function nM(y,E){var F=Vr(y)?si:Je;return F(y,Ar(E,3))}function CTe(y,E,F,Z){return y==null?[]:(Vr(E)||(E=E==null?[]:[E]),F=Z?e:F,Vr(F)||(F=F==null?[]:[F]),Ap(y,E,F))}var DTe=QO(function(y,E,F){y[F?0:1].push(E)},function(){return[[],[]]});function OTe(y,E,F){var Z=Vr(y)?s1:Jt,le=arguments.length<3;return Z(y,Ar(E,4),F,le,Cm)}function MTe(y,E,F){var Z=Vr(y)?FE:Jt,le=arguments.length<3;return Z(y,Ar(E,4),F,le,LO)}function jTe(y,E){var F=Vr(y)?Zf:zO;return F(y,oM(Ar(E,3)))}function NTe(y){var E=Vr(y)?RO:Sje;return E(y)}function TTe(y,E,F){(F?ju(y,E,F):E===e)?E=1:E=Xr(E);var Z=Vr(y)?r$:Eje;return Z(y,E)}function FTe(y){var E=Vr(y)?n$:Cje;return E(y)}function _Te(y){if(y==null)return 0;if(sc(y))return lM(y)?wm(y):y.length;var E=Vl(y);return E==$||E==ie?y.size:ne(y).length}function PTe(y,E,F){var Z=Vr(y)?l1:Dje;return F&&ju(y,E,F)&&(E=e),Z(y,Ar(E,3))}var ITe=un(function(y,E){if(y==null)return[];var F=E.length;return F>1&&ju(y,E[0],E[1])?E=[]:F>2&&ju(E[0],E[1],E[2])&&(E=[E[0]]),Ap(y,as(E,1),[])}),iM=FR||function(){return co.Date.now()};function BTe(y,E){if(typeof E!="function")throw new nc(i);return y=Xr(y),function(){if(--y<1)return E.apply(this,arguments)}}function UK(y,E,F){return E=F?e:E,E=y&&E==null?y.length:E,sA(y,w,e,e,e,e,E)}function WK(y,E){var F;if(typeof E!="function")throw new nc(i);return y=Xr(y),function(){return--y>0&&(F=E.apply(this,arguments)),y<=1&&(E=e),F}}var I$=un(function(y,E,F){var Z=h;if(F.length){var le=Yc(F,xx(I$));Z|=v}return sA(y,Z,E,F,le)}),HK=un(function(y,E,F){var Z=h|m;if(F.length){var le=Yc(F,xx(HK));Z|=v}return sA(E,Z,y,F,le)});function VK(y,E,F){E=F?e:E;var Z=sA(y,A,e,e,e,e,e,E);return Z.placeholder=VK.placeholder,Z}function GK(y,E,F){E=F?e:E;var Z=sA(y,b,e,e,e,e,e,E);return Z.placeholder=GK.placeholder,Z}function QK(y,E,F){var Z,le,be,Fe,$e,We,st=0,lt=!1,At=!1,Pt=!0;if(typeof y!="function")throw new nc(i);E=id(E)||0,Qa(F)&&(lt=!!F.leading,At="maxWait"in F,be=At?fo(id(F.maxWait)||0,E):be,Pt="trailing"in F?!!F.trailing:Pt);function rr(Do){var vp=Z,dA=le;return Z=le=e,st=Do,Fe=y.apply(dA,vp),Fe}function wr(Do){return st=Do,$e=YE(gn,E),lt?rr(Do):Fe}function nn(Do){var vp=Do-We,dA=Do-st,pJ=E-vp;return At?Ga(pJ,be-dA):pJ}function Sr(Do){var vp=Do-We,dA=Do-st;return We===e||vp>=E||vp<0||At&&dA>=be}function gn(){var Do=iM();if(Sr(Do))return In(Do);$e=YE(gn,nn(Do))}function In(Do){return $e=e,Pt&&Z?rr(Do):(Z=le=e,Fe)}function Jc(){$e!==e&&iK($e),st=0,Z=We=le=$e=e}function Nu(){return $e===e?Fe:In(iM())}function ef(){var Do=iM(),vp=Sr(Do);if(Z=arguments,le=this,We=Do,vp){if($e===e)return wr(We);if(At)return iK($e),$e=YE(gn,E),rr(We)}return $e===e&&($e=YE(gn,E)),Fe}return ef.cancel=Jc,ef.flush=Nu,ef}var RTe=un(function(y,E){return qO(y,1,E)}),$Te=un(function(y,E,F){return qO(y,id(E)||0,F)});function qTe(y){return sA(y,k)}function aM(y,E){if(typeof y!="function"||E!=null&&typeof E!="function")throw new nc(i);var F=function(){var Z=arguments,le=E?E.apply(this,Z):Z[0],be=F.cache;if(be.has(le))return be.get(le);var Fe=y.apply(this,Z);return F.cache=be.set(le,Fe)||be,Fe};return F.cache=new(aM.Cache||pp),F}aM.Cache=pp;function oM(y){if(typeof y!="function")throw new nc(i);return function(){var E=arguments;switch(E.length){case 0:return!y.call(this);case 1:return!y.call(this,E[0]);case 2:return!y.call(this,E[0],E[1]);case 3:return!y.call(this,E[0],E[1],E[2])}return!y.apply(this,E)}}function LTe(y){return WK(2,y)}var zTe=Oje(function(y,E){E=E.length==1&&Vr(E[0])?si(E[0],Oi(Ar())):si(as(E,1),Oi(Ar()));var F=E.length;return un(function(Z){for(var le=-1,be=Ga(Z.length,F);++le=E}),k1=HO(function(){return arguments}())?HO:function(y){return po(y)&&di.call(y,"callee")&&!CO.call(y,"callee")},Vr=Xe.isArray,nFe=Qb?Oi(Qb):f$;function sc(y){return y!=null&&sM(y.length)&&!cA(y)}function Co(y){return po(y)&&sc(y)}function iFe(y){return y===!0||y===!1||po(y)&&cl(y)==Se}var Yg=OO||Q$,aFe=a1?Oi(a1):d$;function oFe(y){return po(y)&&y.nodeType===1&&!ZE(y)}function sFe(y){if(y==null)return!0;if(sc(y)&&(Vr(y)||typeof y=="string"||typeof y.splice=="function"||Yg(y)||wx(y)||k1(y)))return!y.length;var E=Vl(y);if(E==$||E==ie)return!y.size;if(QE(y))return!ne(y).length;for(var F in y)if(di.call(y,F))return!1;return!0}function lFe(y,E){return x1(y,E)}function uFe(y,E,F){F=typeof F=="function"?F:e;var Z=F?F(y,E):e;return Z===e?x1(y,E,e,F):!!Z}function R$(y){if(!po(y))return!1;var E=cl(y);return E==ye||E==ve||typeof y.message=="string"&&typeof y.name=="string"&&!ZE(y)}function cFe(y){return typeof y=="number"&&h1(y)}function cA(y){if(!Qa(y))return!1;var E=cl(y);return E==me||E==ke||E==Ie||E==J}function ZK(y){return typeof y=="number"&&y==Xr(y)}function sM(y){return typeof y=="number"&&y>-1&&y%1==0&&y<=I}function Qa(y){var E=typeof y;return y!=null&&(E=="object"||E=="function")}function po(y){return y!=null&&typeof y=="object"}var XK=Yb?Oi(Yb):HE;function fFe(y,E){return y===E||Dm(y,E,O$(E))}function dFe(y,E,F){return F=typeof F=="function"?F:e,Dm(y,E,O$(E),F)}function pFe(y){return KK(y)&&y!=+y}function mFe(y){if(Xje(y))throw new Fr(n);return w1(y)}function hFe(y){return y===null}function AFe(y){return y==null}function KK(y){return typeof y=="number"||po(y)&&cl(y)==ae}function ZE(y){if(!po(y)||cl(y)!=U)return!1;var E=ox(y);if(E===null)return!0;var F=di.call(E,"constructor")&&E.constructor;return typeof F=="function"&&F instanceof F&&d1.call(F)==MR}var $$=Zb?Oi(Zb):Mn;function gFe(y){return ZK(y)&&y>=-I&&y<=I}var JK=eA?Oi(eA):M;function lM(y){return typeof y=="string"||!Vr(y)&&po(y)&&cl(y)==re}function Kc(y){return typeof y=="symbol"||po(y)&&cl(y)==Ee}var wx=Qc?Oi(Qc):B;function vFe(y){return y===e}function yFe(y){return po(y)&&Vl(y)==_e}function bFe(y){return po(y)&&cl(y)==he}var xFe=KO(Re),wFe=KO(function(y,E){return y<=E});function eJ(y){if(!y)return[];if(sc(y))return lM(y)?Du(y):oc(y);if(p1&&y[p1])return bR(y[p1]());var E=Vl(y),F=E==$?PE:E==ie?qg:Sx;return F(y)}function fA(y){if(!y)return y===0?y:0;if(y=id(y),y===z||y===-z){var E=y<0?-1:1;return E*T}return y===y?y:0}function Xr(y){var E=fA(y),F=E%1;return E===E?F?E-F:E:0}function tJ(y){return y?aA(Xr(y),0,_):0}function id(y){if(typeof y=="number")return y;if(Kc(y))return L;if(Qa(y)){var E=typeof y.valueOf=="function"?y.valueOf():y;y=Qa(E)?E+"":E}if(typeof y!="string")return y===0?y:+y;y=_s(y);var F=ia.test(y);return F||Wl.test(y)?aa(y.slice(2),F?2:8):Ts.test(y)?L:+y}function rJ(y){return Om(y,lc(y))}function SFe(y){return y?aA(Xr(y),-I,I):y===0?y:0}function vi(y){return y==null?"":Xc(y)}var EFe=yx(function(y,E){if(QE(E)||sc(E)){Om(E,Is(E),y);return}for(var F in E)di.call(E,F)&&b1(y,F,E[F])}),nJ=yx(function(y,E){Om(E,lc(E),y)}),uM=yx(function(y,E,F,Z){Om(E,lc(E),y,Z)}),kFe=yx(function(y,E,F,Z){Om(E,Is(E),y,Z)}),CFe=lA(gx);function DFe(y,E){var F=Hg(y);return E==null?F:$E(F,E)}var OFe=un(function(y,E){y=ln(y);var F=-1,Z=E.length,le=Z>2?E[2]:e;for(le&&ju(E[0],E[1],le)&&(Z=1);++F1),be}),Om(y,C$(y),F),Z&&(F=Ou(F,u|c|f,$je));for(var le=E.length;le--;)v$(F,E[le]);return F});function VFe(y,E){return aJ(y,oM(Ar(E)))}var GFe=lA(function(y,E){return y==null?{}:bje(y,E)});function aJ(y,E){if(y==null)return{};var F=si(C$(y),function(Z){return[Z]});return E=Ar(E),ZX(y,F,function(Z,le){return E(Z,le[0])})}function QFe(y,E,F){E=Gg(E,y);var Z=-1,le=E.length;for(le||(le=1,y=e);++ZE){var Z=y;y=E,E=Z}if(F||y%1||E%1){var le=NO();return Ga(y+le*(E-y+sn("1e-"+((le+"").length-1))),E)}return h$(y,E)}var a3e=bx(function(y,E,F){return E=E.toLowerCase(),y+(F?lJ(E):E)});function lJ(y){return z$(vi(y).toLowerCase())}function uJ(y){return y=vi(y),y&&y.replace(kg,yO).replace(Jh,"")}function o3e(y,E,F){y=vi(y),E=Xc(E);var Z=y.length;F=F===e?Z:aA(Xr(F),0,Z);var le=F;return F-=E.length,F>=0&&y.slice(F,le)==E}function s3e(y){return y=vi(y),y&&ht.test(y)?y.replace(De,AR):y}function l3e(y){return y=vi(y),y&&Pa.test(y)?y.replace(Qi,"\\$&"):y}var u3e=bx(function(y,E,F){return y+(F?"-":"")+E.toLowerCase()}),c3e=bx(function(y,E,F){return y+(F?" ":"")+E.toLowerCase()}),f3e=dK("toLowerCase");function d3e(y,E,F){y=vi(y),E=Xr(E);var Z=E?wm(y):0;if(!E||Z>=E)return y;var le=(E-Z)/2;return XO(m1(le),F)+y+XO(lx(le),F)}function p3e(y,E,F){y=vi(y),E=Xr(E);var Z=E?wm(y):0;return E&&Z>>0,F?(y=vi(y),y&&(typeof E=="string"||E!=null&&!$$(E))&&(E=Xc(E),!E&&Xf(y))?Qg(Du(y),0,F):y.split(E,F)):[]}var b3e=bx(function(y,E,F){return y+(F?" ":"")+z$(E)});function x3e(y,E,F){return y=vi(y),F=F==null?0:aA(Xr(F),0,y.length),E=Xc(E),y.slice(F,F+E.length)==E}function w3e(y,E,F){var Z=pe.templateSettings;F&&ju(y,E,F)&&(E=e),y=vi(y),E=uM({},E,Z,yK);var le=uM({},E.imports,Z.imports,yK),be=Is(le),Fe=Ps(le,be),$e,We,st=0,lt=E.interpolate||Vc,At="__p += '",Pt=cp((E.escape||Vc).source+"|"+lt.source+"|"+(lt===en?fi:Vc).source+"|"+(E.evaluate||Vc).source+"|$","g"),rr="//# sourceURL="+(di.call(E,"sourceURL")?(E.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++se+"]")+` `;y.replace(Pt,function(Sr,gn,In,Jc,Nu,ef){return In||(In=Jc),At+=y.slice(st,ef).replace(Cg,gR),gn&&($e=!0,At+=`' + __e(`+gn+`) + '`),Nu&&(We=!0,At+=`'; @@ -25,28 +25,28 @@ __p += '`),In&&(At+=`' + function print() { __p += __j.call(arguments, '') } `:`; `)+At+`return __p -}`;var nn=fJ(function(){return Kn(be,rr+"return "+At).apply(e,Fe)});if(nn.source=At,R$(nn))throw nn;return nn}function S3e(y){return vi(y).toLowerCase()}function E3e(y){return vi(y).toUpperCase()}function k3e(y,E,F){if(y=vi(y),y&&(F||E===e))return _s(y);if(!y||!(E=Xc(E)))return y;var Z=Du(y),le=Du(E),be=On(Z,le),Fe=ex(Z,le)+1;return Qg(Z,be,Fe).join("")}function C3e(y,E,F){if(y=vi(y),y&&(F||E===e))return y.slice(0,tx(y)+1);if(!y||!(E=Xc(E)))return y;var Z=Du(y),le=ex(Z,Du(E))+1;return Qg(Z,0,le).join("")}function D3e(y,E,F){if(y=vi(y),y&&(F||E===e))return y.replace(Dt,"");if(!y||!(E=Xc(E)))return y;var Z=Du(y),le=On(Z,Du(E));return Qg(Z,le).join("")}function O3e(y,E){var F=j,Z=O;if(Qa(E)){var le="separator"in E?E.separator:le;F="length"in E?Xr(E.length):F,Z="omission"in E?Xc(E.omission):Z}y=vi(y);var be=y.length;if(Xf(y)){var Fe=Du(y);be=Fe.length}if(F>=be)return y;var $e=F-xm(Z);if($e<1)return Z;var We=Fe?Qg(Fe,0,$e).join(""):y.slice(0,$e);if(le===e)return We+Z;if(Fe&&($e+=We.length-$e),$$(le)){if(y.slice($e).search(le)){var st,lt=We;for(le.global||(le=cp(le.source,vi(is.exec(le))+"g")),le.lastIndex=0;st=le.exec(lt);)var At=st.index;We=We.slice(0,At===e?$e:At)}}else if(y.indexOf(Xc(le),$e)!=$e){var Pt=We.lastIndexOf(le);Pt>-1&&(We=We.slice(0,Pt))}return We+Z}function M3e(y){return y=vi(y),y&&at.test(y)?y.replace(Pe,SR):y}var j3e=bx(function(y,E,F){return y+(F?" ":"")+E.toUpperCase()}),z$=dK("toUpperCase");function cJ(y,E,F){return y=vi(y),E=F?e:E,E===e?yR(y)?CR(y):Kb(y):y.match(E)||[]}var fJ=un(function(y,E){try{return zo(y,e,E)}catch(F){return R$(F)?F:new Fr(F)}}),N3e=lA(function(y,E){return Ba(E,function(F){F=Om(F),mp(y,F,I$(y[F],y))}),y});function T3e(y){var E=y==null?0:y.length,F=Ar();return y=E?si(y,function(Z){if(typeof Z[1]!="function")throw new nc(i);return[F(Z[0]),Z[1]]}):[],un(function(Z){for(var le=-1;++leI)return[];var F=_,Z=Ga(y,_);E=Ar(E),y-=_;for(var le=Dn(Z,E);++F0||E<0)?new rn(F):(y<0?F=F.takeRight(-y):y&&(F=F.drop(y)),E!==e&&(E=Xr(E),F=E<0?F.dropRight(-E):F.take(E-y)),F)},rn.prototype.takeRightWhile=function(y){return this.reverse().takeWhile(y).reverse()},rn.prototype.toArray=function(){return this.take(_)},Kf(rn.prototype,function(y,E){var F=/^(?:filter|find|map|reject)|While$/.test(E),Z=/^(?:head|last)$/.test(E),le=pe[Z?"take"+(E=="last"?"Right":""):E],be=Z||/^find/.test(E);!le||(pe.prototype[E]=function(){var Fe=this.__wrapped__,$e=Z?[1]:arguments,We=Fe instanceof rn,st=$e[0],lt=We||Vr(Fe),At=function(gn){var In=le.apply(pe,ec([gn],$e));return Z&&Pt?In[0]:In};lt&&F&&typeof st=="function"&&st.length!=1&&(We=lt=!1);var Pt=this.__chain__,rr=!!this.__actions__.length,wr=be&&!Pt,nn=We&&!rr;if(!be&<){Fe=nn?Fe:new rn(this);var Sr=y.apply(Fe,$e);return Sr.__actions__.push({func:rM,args:[At],thisArg:e}),new ic(Sr,Pt)}return wr&&nn?y.apply(this,$e):(Sr=this.thru(At),wr?Z?Sr.value()[0]:Sr.value():Sr)})}),Ba(["pop","push","shift","sort","splice","unshift"],function(y){var E=f1[y],F=/^(?:push|sort|unshift)$/.test(y)?"tap":"thru",Z=/^(?:pop|shift)$/.test(y);pe.prototype[y]=function(){var le=arguments;if(Z&&!this.__chain__){var be=this.value();return E.apply(Vr(be)?be:[],le)}return this[F](function(Fe){return E.apply(Vr(Fe)?Fe:[],le)})}}),Kf(rn.prototype,function(y,E){var F=pe[E];if(F){var Z=F.name+"";di.call(Wg,Z)||(Wg[Z]=[]),Wg[Z].push({name:E,func:F})}}),Wg[YO(e,m).name]=[{name:"wrapper",func:e}],rn.prototype.clone=LR,rn.prototype.reverse=zR,rn.prototype.value=UR,pe.prototype.at=oTe,pe.prototype.chain=sTe,pe.prototype.commit=lTe,pe.prototype.next=uTe,pe.prototype.plant=fTe,pe.prototype.reverse=dTe,pe.prototype.toJSON=pe.prototype.valueOf=pe.prototype.value=pTe,pe.prototype.first=pe.prototype.head,p1&&(pe.prototype[p1]=cTe),pe},wm=DR();typeof define=="function"&&typeof define.amd=="object"&&define.amd?(co._=wm,define(function(){return wm})):Yf?((Yf.exports=wm)._=wm,Ig._=wm):co._=wm}).call(Wx)});var xre=vn(Tn=>{"use strict";var Rk=Symbol.for("react.element"),wIe=Symbol.for("react.portal"),SIe=Symbol.for("react.fragment"),EIe=Symbol.for("react.strict_mode"),kIe=Symbol.for("react.profiler"),CIe=Symbol.for("react.provider"),DIe=Symbol.for("react.context"),OIe=Symbol.for("react.forward_ref"),MIe=Symbol.for("react.suspense"),jIe=Symbol.for("react.memo"),NIe=Symbol.for("react.lazy"),fre=Symbol.iterator;function TIe(e){return e===null||typeof e!="object"?null:(e=fre&&e[fre]||e["@@iterator"],typeof e=="function"?e:null)}var mre={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},hre=Object.assign,Are={};function ow(e,t,r){this.props=e,this.context=t,this.refs=Are,this.updater=r||mre}ow.prototype.isReactComponent={};ow.prototype.setState=function(e,t){if(typeof e!="object"&&typeof e!="function"&&e!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,e,t,"setState")};ow.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function gre(){}gre.prototype=ow.prototype;function mL(e,t,r){this.props=e,this.context=t,this.refs=Are,this.updater=r||mre}var hL=mL.prototype=new gre;hL.constructor=mL;hre(hL,ow.prototype);hL.isPureReactComponent=!0;var dre=Array.isArray,vre=Object.prototype.hasOwnProperty,AL={current:null},yre={key:!0,ref:!0,__self:!0,__source:!0};function bre(e,t,r){var n,i={},a=null,o=null;if(t!=null)for(n in t.ref!==void 0&&(o=t.ref),t.key!==void 0&&(a=""+t.key),t)vre.call(t,n)&&!yre.hasOwnProperty(n)&&(i[n]=t[n]);var s=arguments.length-2;if(s===1)i.children=r;else if(1{"use strict";wre.exports=xre()});var Tre=vn(ca=>{"use strict";function xL(e,t){var r=e.length;e.push(t);e:for(;0>>1,i=e[n];if(0>>1;nfj(s,r))lfj(u,s)?(e[n]=u,e[l]=r,n=l):(e[n]=s,e[o]=r,n=o);else if(lfj(u,r))e[n]=u,e[l]=r,n=l;else break e}}return t}function fj(e,t){var r=e.sortIndex-t.sortIndex;return r!==0?r:e.id-t.id}typeof performance=="object"&&typeof performance.now=="function"?(Sre=performance,ca.unstable_now=function(){return Sre.now()}):(vL=Date,Ere=vL.now(),ca.unstable_now=function(){return vL.now()-Ere});var Sre,vL,Ere,Bm=[],m0=[],BIe=1,Ad=null,Kl=3,mj=!1,G1=!1,qk=!1,Dre=typeof setTimeout=="function"?setTimeout:null,Ore=typeof clearTimeout=="function"?clearTimeout:null,kre=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function wL(e){for(var t=Ep(m0);t!==null;){if(t.callback===null)pj(m0);else if(t.startTime<=e)pj(m0),t.sortIndex=t.expirationTime,xL(Bm,t);else break;t=Ep(m0)}}function SL(e){if(qk=!1,wL(e),!G1)if(Ep(Bm)!==null)G1=!0,kL(EL);else{var t=Ep(m0);t!==null&&CL(SL,t.startTime-e)}}function EL(e,t){G1=!1,qk&&(qk=!1,Ore(Lk),Lk=-1),mj=!0;var r=Kl;try{for(wL(t),Ad=Ep(Bm);Ad!==null&&(!(Ad.expirationTime>t)||e&&!Nre());){var n=Ad.callback;if(typeof n=="function"){Ad.callback=null,Kl=Ad.priorityLevel;var i=n(Ad.expirationTime<=t);t=ca.unstable_now(),typeof i=="function"?Ad.callback=i:Ad===Ep(Bm)&&pj(Bm),wL(t)}else pj(Bm);Ad=Ep(Bm)}if(Ad!==null)var a=!0;else{var o=Ep(m0);o!==null&&CL(SL,o.startTime-t),a=!1}return a}finally{Ad=null,Kl=r,mj=!1}}var hj=!1,dj=null,Lk=-1,Mre=5,jre=-1;function Nre(){return!(ca.unstable_now()-jree||125n?(e.sortIndex=r,xL(m0,e),Ep(Bm)===null&&e===Ep(m0)&&(qk?(Ore(Lk),Lk=-1):qk=!0,CL(SL,r-n))):(e.sortIndex=i,xL(Bm,e),G1||mj||(G1=!0,kL(EL))),e};ca.unstable_shouldYield=Nre;ca.unstable_wrapCallback=function(e){var t=Kl;return function(){var r=Kl;Kl=t;try{return e.apply(this,arguments)}finally{Kl=r}}}});var _re=vn((Lmt,Fre)=>{"use strict";Fre.exports=Tre()});var qae=vn(hf=>{"use strict";var Lne=Te(),pf=_re();function xt(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,r=1;r"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),YL=Object.prototype.hasOwnProperty,RIe=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,Pre={},Ire={};function $Ie(e){return YL.call(Ire,e)?!0:YL.call(Pre,e)?!1:RIe.test(e)?Ire[e]=!0:(Pre[e]=!0,!1)}function qIe(e,t,r,n){if(r!==null&&r.type===0)return!1;switch(typeof t){case"function":case"symbol":return!0;case"boolean":return n?!1:r!==null?!r.acceptsBooleans:(e=e.toLowerCase().slice(0,5),e!=="data-"&&e!=="aria-");default:return!1}}function LIe(e,t,r,n){if(t===null||typeof t>"u"||qIe(e,t,r,n))return!0;if(n)return!1;if(r!==null)switch(r.type){case 3:return!t;case 4:return t===!1;case 5:return isNaN(t);case 6:return isNaN(t)||1>t}return!1}function qu(e,t,r,n,i,a,o){this.acceptsBooleans=t===2||t===3||t===4,this.attributeName=n,this.attributeNamespace=i,this.mustUseProperty=r,this.propertyName=e,this.type=t,this.sanitizeURL=a,this.removeEmptyString=o}var yl={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){yl[e]=new qu(e,0,!1,e,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];yl[t]=new qu(t,1,!1,e[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(e){yl[e]=new qu(e,2,!1,e.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){yl[e]=new qu(e,2,!1,e,null,!1,!1)});"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(e){yl[e]=new qu(e,3,!1,e.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(e){yl[e]=new qu(e,3,!0,e,null,!1,!1)});["capture","download"].forEach(function(e){yl[e]=new qu(e,4,!1,e,null,!1,!1)});["cols","rows","size","span"].forEach(function(e){yl[e]=new qu(e,6,!1,e,null,!1,!1)});["rowSpan","start"].forEach(function(e){yl[e]=new qu(e,5,!1,e.toLowerCase(),null,!1,!1)});var Lz=/[\-:]([a-z])/g;function zz(e){return e[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(e){var t=e.replace(Lz,zz);yl[t]=new qu(t,1,!1,e,null,!1,!1)});"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(e){var t=e.replace(Lz,zz);yl[t]=new qu(t,1,!1,e,"http://www.w3.org/1999/xlink",!1,!1)});["xml:base","xml:lang","xml:space"].forEach(function(e){var t=e.replace(Lz,zz);yl[t]=new qu(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(e){yl[e]=new qu(e,1,!1,e.toLowerCase(),null,!1,!1)});yl.xlinkHref=new qu("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(e){yl[e]=new qu(e,1,!1,e.toLowerCase(),null,!0,!0)});function Uz(e,t,r,n){var i=yl.hasOwnProperty(t)?yl[t]:null;(i!==null?i.type!==0:n||!(2=be)return y;var $e=F-wm(Z);if($e<1)return Z;var We=Fe?Qg(Fe,0,$e).join(""):y.slice(0,$e);if(le===e)return We+Z;if(Fe&&($e+=We.length-$e),$$(le)){if(y.slice($e).search(le)){var st,lt=We;for(le.global||(le=cp(le.source,vi(is.exec(le))+"g")),le.lastIndex=0;st=le.exec(lt);)var At=st.index;We=We.slice(0,At===e?$e:At)}}else if(y.indexOf(Xc(le),$e)!=$e){var Pt=We.lastIndexOf(le);Pt>-1&&(We=We.slice(0,Pt))}return We+Z}function M3e(y){return y=vi(y),y&&at.test(y)?y.replace(Pe,SR):y}var j3e=bx(function(y,E,F){return y+(F?" ":"")+E.toUpperCase()}),z$=dK("toUpperCase");function cJ(y,E,F){return y=vi(y),E=F?e:E,E===e?yR(y)?CR(y):Kb(y):y.match(E)||[]}var fJ=un(function(y,E){try{return zo(y,e,E)}catch(F){return R$(F)?F:new Fr(F)}}),N3e=lA(function(y,E){return Ba(E,function(F){F=Mm(F),mp(y,F,I$(y[F],y))}),y});function T3e(y){var E=y==null?0:y.length,F=Ar();return y=E?si(y,function(Z){if(typeof Z[1]!="function")throw new nc(i);return[F(Z[0]),Z[1]]}):[],un(function(Z){for(var le=-1;++leI)return[];var F=_,Z=Ga(y,_);E=Ar(E),y-=_;for(var le=Dn(Z,E);++F0||E<0)?new rn(F):(y<0?F=F.takeRight(-y):y&&(F=F.drop(y)),E!==e&&(E=Xr(E),F=E<0?F.dropRight(-E):F.take(E-y)),F)},rn.prototype.takeRightWhile=function(y){return this.reverse().takeWhile(y).reverse()},rn.prototype.toArray=function(){return this.take(_)},Kf(rn.prototype,function(y,E){var F=/^(?:filter|find|map|reject)|While$/.test(E),Z=/^(?:head|last)$/.test(E),le=pe[Z?"take"+(E=="last"?"Right":""):E],be=Z||/^find/.test(E);!le||(pe.prototype[E]=function(){var Fe=this.__wrapped__,$e=Z?[1]:arguments,We=Fe instanceof rn,st=$e[0],lt=We||Vr(Fe),At=function(gn){var In=le.apply(pe,ec([gn],$e));return Z&&Pt?In[0]:In};lt&&F&&typeof st=="function"&&st.length!=1&&(We=lt=!1);var Pt=this.__chain__,rr=!!this.__actions__.length,wr=be&&!Pt,nn=We&&!rr;if(!be&<){Fe=nn?Fe:new rn(this);var Sr=y.apply(Fe,$e);return Sr.__actions__.push({func:rM,args:[At],thisArg:e}),new ic(Sr,Pt)}return wr&&nn?y.apply(this,$e):(Sr=this.thru(At),wr?Z?Sr.value()[0]:Sr.value():Sr)})}),Ba(["pop","push","shift","sort","splice","unshift"],function(y){var E=f1[y],F=/^(?:push|sort|unshift)$/.test(y)?"tap":"thru",Z=/^(?:pop|shift)$/.test(y);pe.prototype[y]=function(){var le=arguments;if(Z&&!this.__chain__){var be=this.value();return E.apply(Vr(be)?be:[],le)}return this[F](function(Fe){return E.apply(Vr(Fe)?Fe:[],le)})}}),Kf(rn.prototype,function(y,E){var F=pe[E];if(F){var Z=F.name+"";di.call(Wg,Z)||(Wg[Z]=[]),Wg[Z].push({name:E,func:F})}}),Wg[YO(e,m).name]=[{name:"wrapper",func:e}],rn.prototype.clone=LR,rn.prototype.reverse=zR,rn.prototype.value=UR,pe.prototype.at=oTe,pe.prototype.chain=sTe,pe.prototype.commit=lTe,pe.prototype.next=uTe,pe.prototype.plant=fTe,pe.prototype.reverse=dTe,pe.prototype.toJSON=pe.prototype.valueOf=pe.prototype.value=pTe,pe.prototype.first=pe.prototype.head,p1&&(pe.prototype[p1]=cTe),pe},Sm=DR();typeof define=="function"&&typeof define.amd=="object"&&define.amd?(co._=Sm,define(function(){return Sm})):Yf?((Yf.exports=Sm)._=Sm,Ig._=Sm):co._=Sm}).call(Wx)});var xre=vn(Tn=>{"use strict";var Rk=Symbol.for("react.element"),wIe=Symbol.for("react.portal"),SIe=Symbol.for("react.fragment"),EIe=Symbol.for("react.strict_mode"),kIe=Symbol.for("react.profiler"),CIe=Symbol.for("react.provider"),DIe=Symbol.for("react.context"),OIe=Symbol.for("react.forward_ref"),MIe=Symbol.for("react.suspense"),jIe=Symbol.for("react.memo"),NIe=Symbol.for("react.lazy"),fre=Symbol.iterator;function TIe(e){return e===null||typeof e!="object"?null:(e=fre&&e[fre]||e["@@iterator"],typeof e=="function"?e:null)}var mre={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},hre=Object.assign,Are={};function ow(e,t,r){this.props=e,this.context=t,this.refs=Are,this.updater=r||mre}ow.prototype.isReactComponent={};ow.prototype.setState=function(e,t){if(typeof e!="object"&&typeof e!="function"&&e!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,e,t,"setState")};ow.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function gre(){}gre.prototype=ow.prototype;function mL(e,t,r){this.props=e,this.context=t,this.refs=Are,this.updater=r||mre}var hL=mL.prototype=new gre;hL.constructor=mL;hre(hL,ow.prototype);hL.isPureReactComponent=!0;var dre=Array.isArray,vre=Object.prototype.hasOwnProperty,AL={current:null},yre={key:!0,ref:!0,__self:!0,__source:!0};function bre(e,t,r){var n,i={},a=null,o=null;if(t!=null)for(n in t.ref!==void 0&&(o=t.ref),t.key!==void 0&&(a=""+t.key),t)vre.call(t,n)&&!yre.hasOwnProperty(n)&&(i[n]=t[n]);var s=arguments.length-2;if(s===1)i.children=r;else if(1{"use strict";wre.exports=xre()});var Tre=vn(ca=>{"use strict";function xL(e,t){var r=e.length;e.push(t);e:for(;0>>1,i=e[n];if(0>>1;nfj(s,r))lfj(u,s)?(e[n]=u,e[l]=r,n=l):(e[n]=s,e[o]=r,n=o);else if(lfj(u,r))e[n]=u,e[l]=r,n=l;else break e}}return t}function fj(e,t){var r=e.sortIndex-t.sortIndex;return r!==0?r:e.id-t.id}typeof performance=="object"&&typeof performance.now=="function"?(Sre=performance,ca.unstable_now=function(){return Sre.now()}):(vL=Date,Ere=vL.now(),ca.unstable_now=function(){return vL.now()-Ere});var Sre,vL,Ere,Bm=[],m0=[],BIe=1,Ad=null,Kl=3,mj=!1,G1=!1,qk=!1,Dre=typeof setTimeout=="function"?setTimeout:null,Ore=typeof clearTimeout=="function"?clearTimeout:null,kre=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function wL(e){for(var t=kp(m0);t!==null;){if(t.callback===null)pj(m0);else if(t.startTime<=e)pj(m0),t.sortIndex=t.expirationTime,xL(Bm,t);else break;t=kp(m0)}}function SL(e){if(qk=!1,wL(e),!G1)if(kp(Bm)!==null)G1=!0,kL(EL);else{var t=kp(m0);t!==null&&CL(SL,t.startTime-e)}}function EL(e,t){G1=!1,qk&&(qk=!1,Ore(Lk),Lk=-1),mj=!0;var r=Kl;try{for(wL(t),Ad=kp(Bm);Ad!==null&&(!(Ad.expirationTime>t)||e&&!Nre());){var n=Ad.callback;if(typeof n=="function"){Ad.callback=null,Kl=Ad.priorityLevel;var i=n(Ad.expirationTime<=t);t=ca.unstable_now(),typeof i=="function"?Ad.callback=i:Ad===kp(Bm)&&pj(Bm),wL(t)}else pj(Bm);Ad=kp(Bm)}if(Ad!==null)var a=!0;else{var o=kp(m0);o!==null&&CL(SL,o.startTime-t),a=!1}return a}finally{Ad=null,Kl=r,mj=!1}}var hj=!1,dj=null,Lk=-1,Mre=5,jre=-1;function Nre(){return!(ca.unstable_now()-jree||125n?(e.sortIndex=r,xL(m0,e),kp(Bm)===null&&e===kp(m0)&&(qk?(Ore(Lk),Lk=-1):qk=!0,CL(SL,r-n))):(e.sortIndex=i,xL(Bm,e),G1||mj||(G1=!0,kL(EL))),e};ca.unstable_shouldYield=Nre;ca.unstable_wrapCallback=function(e){var t=Kl;return function(){var r=Kl;Kl=t;try{return e.apply(this,arguments)}finally{Kl=r}}}});var _re=vn((Lmt,Fre)=>{"use strict";Fre.exports=Tre()});var qae=vn(hf=>{"use strict";var Lne=Te(),pf=_re();function xt(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,r=1;r"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),YL=Object.prototype.hasOwnProperty,RIe=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,Pre={},Ire={};function $Ie(e){return YL.call(Ire,e)?!0:YL.call(Pre,e)?!1:RIe.test(e)?Ire[e]=!0:(Pre[e]=!0,!1)}function qIe(e,t,r,n){if(r!==null&&r.type===0)return!1;switch(typeof t){case"function":case"symbol":return!0;case"boolean":return n?!1:r!==null?!r.acceptsBooleans:(e=e.toLowerCase().slice(0,5),e!=="data-"&&e!=="aria-");default:return!1}}function LIe(e,t,r,n){if(t===null||typeof t>"u"||qIe(e,t,r,n))return!0;if(n)return!1;if(r!==null)switch(r.type){case 3:return!t;case 4:return t===!1;case 5:return isNaN(t);case 6:return isNaN(t)||1>t}return!1}function qu(e,t,r,n,i,a,o){this.acceptsBooleans=t===2||t===3||t===4,this.attributeName=n,this.attributeNamespace=i,this.mustUseProperty=r,this.propertyName=e,this.type=t,this.sanitizeURL=a,this.removeEmptyString=o}var yl={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){yl[e]=new qu(e,0,!1,e,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];yl[t]=new qu(t,1,!1,e[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(e){yl[e]=new qu(e,2,!1,e.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){yl[e]=new qu(e,2,!1,e,null,!1,!1)});"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(e){yl[e]=new qu(e,3,!1,e.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(e){yl[e]=new qu(e,3,!0,e,null,!1,!1)});["capture","download"].forEach(function(e){yl[e]=new qu(e,4,!1,e,null,!1,!1)});["cols","rows","size","span"].forEach(function(e){yl[e]=new qu(e,6,!1,e,null,!1,!1)});["rowSpan","start"].forEach(function(e){yl[e]=new qu(e,5,!1,e.toLowerCase(),null,!1,!1)});var Lz=/[\-:]([a-z])/g;function zz(e){return e[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(e){var t=e.replace(Lz,zz);yl[t]=new qu(t,1,!1,e,null,!1,!1)});"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(e){var t=e.replace(Lz,zz);yl[t]=new qu(t,1,!1,e,"http://www.w3.org/1999/xlink",!1,!1)});["xml:base","xml:lang","xml:space"].forEach(function(e){var t=e.replace(Lz,zz);yl[t]=new qu(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(e){yl[e]=new qu(e,1,!1,e.toLowerCase(),null,!1,!1)});yl.xlinkHref=new qu("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(e){yl[e]=new qu(e,1,!1,e.toLowerCase(),null,!0,!0)});function Uz(e,t,r,n){var i=yl.hasOwnProperty(t)?yl[t]:null;(i!==null?i.type!==0:n||!(2s||i[o]!==a[s]){var l=` -`+i[o].replace(" at new "," at ");return e.displayName&&l.includes("")&&(l=l.replace("",e.displayName)),l}while(1<=o&&0<=s);break}}}finally{OL=!1,Error.prepareStackTrace=r}return(e=e?e.displayName||e.name:"")?Zk(e):""}function zIe(e){switch(e.tag){case 5:return Zk(e.type);case 16:return Zk("Lazy");case 13:return Zk("Suspense");case 19:return Zk("SuspenseList");case 0:case 2:case 15:return e=ML(e.type,!1),e;case 11:return e=ML(e.type.render,!1),e;case 1:return e=ML(e.type,!0),e;default:return""}}function JL(e){if(e==null)return null;if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case cw:return"Fragment";case uw:return"Portal";case ZL:return"Profiler";case Wz:return"StrictMode";case XL:return"Suspense";case KL:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case Wne:return(e.displayName||"Context")+".Consumer";case Une:return(e._context.displayName||"Context")+".Provider";case Hz:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case Vz:return t=e.displayName||null,t!==null?t:JL(e.type)||"Memo";case A0:t=e._payload,e=e._init;try{return JL(e(t))}catch{}}return null}function UIe(e){var t=e.type;switch(e.tag){case 24:return"Cache";case 9:return(t.displayName||"Context")+".Consumer";case 10:return(t._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return e=t.render,e=e.displayName||e.name||"",t.displayName||(e!==""?"ForwardRef("+e+")":"ForwardRef");case 7:return"Fragment";case 5:return t;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return JL(t);case 8:return t===Wz?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t}return null}function j0(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function Vne(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function WIe(e){var t=Vne(e)?"checked":"value",r=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),n=""+e[t];if(!e.hasOwnProperty(t)&&typeof r<"u"&&typeof r.get=="function"&&typeof r.set=="function"){var i=r.get,a=r.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return i.call(this)},set:function(o){n=""+o,a.call(this,o)}}),Object.defineProperty(e,t,{enumerable:r.enumerable}),{getValue:function(){return n},setValue:function(o){n=""+o},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function gj(e){e._valueTracker||(e._valueTracker=WIe(e))}function Gne(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var r=t.getValue(),n="";return e&&(n=Vne(e)?e.checked?"true":"false":e.value),e=n,e!==r?(t.setValue(e),!0):!1}function Hj(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}function ez(e,t){var r=t.checked;return eo({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:r??e._wrapperState.initialChecked})}function Rre(e,t){var r=t.defaultValue==null?"":t.defaultValue,n=t.checked!=null?t.checked:t.defaultChecked;r=j0(t.value!=null?t.value:r),e._wrapperState={initialChecked:n,initialValue:r,controlled:t.type==="checkbox"||t.type==="radio"?t.checked!=null:t.value!=null}}function Qne(e,t){t=t.checked,t!=null&&Uz(e,"checked",t,!1)}function tz(e,t){Qne(e,t);var r=j0(t.value),n=t.type;if(r!=null)n==="number"?(r===0&&e.value===""||e.value!=r)&&(e.value=""+r):e.value!==""+r&&(e.value=""+r);else if(n==="submit"||n==="reset"){e.removeAttribute("value");return}t.hasOwnProperty("value")?rz(e,t.type,r):t.hasOwnProperty("defaultValue")&&rz(e,t.type,j0(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function $re(e,t,r){if(t.hasOwnProperty("value")||t.hasOwnProperty("defaultValue")){var n=t.type;if(!(n!=="submit"&&n!=="reset"||t.value!==void 0&&t.value!==null))return;t=""+e._wrapperState.initialValue,r||t===e.value||(e.value=t),e.defaultValue=t}r=e.name,r!==""&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,r!==""&&(e.name=r)}function rz(e,t,r){(t!=="number"||Hj(e.ownerDocument)!==e)&&(r==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+r&&(e.defaultValue=""+r))}var Xk=Array.isArray;function xw(e,t,r,n){if(e=e.options,t){t={};for(var i=0;i"+t.valueOf().toString()+"",t=vj.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function c6(e,t){if(t){var r=e.firstChild;if(r&&r===e.lastChild&&r.nodeType===3){r.nodeValue=t;return}}e.textContent=t}var e6={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},HIe=["Webkit","ms","Moz","O"];Object.keys(e6).forEach(function(e){HIe.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),e6[t]=e6[e]})});function Kne(e,t,r){return t==null||typeof t=="boolean"||t===""?"":r||typeof t!="number"||t===0||e6.hasOwnProperty(e)&&e6[e]?(""+t).trim():t+"px"}function Jne(e,t){e=e.style;for(var r in t)if(t.hasOwnProperty(r)){var n=r.indexOf("--")===0,i=Kne(r,t[r],n);r==="float"&&(r="cssFloat"),n?e.setProperty(r,i):e[r]=i}}var VIe=eo({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function az(e,t){if(t){if(VIe[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(xt(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(xt(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(xt(61))}if(t.style!=null&&typeof t.style!="object")throw Error(xt(62))}}function oz(e,t){if(e.indexOf("-")===-1)return typeof t.is=="string";switch(e){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var sz=null;function Gz(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var lz=null,ww=null,Sw=null;function zre(e){if(e=O6(e)){if(typeof lz!="function")throw Error(xt(280));var t=e.stateNode;t&&(t=yN(t),lz(e.stateNode,e.type,t))}}function eie(e){ww?Sw?Sw.push(e):Sw=[e]:ww=e}function tie(){if(ww){var e=ww,t=Sw;if(Sw=ww=null,zre(e),t)for(e=0;e>>=0,e===0?32:31-(nBe(e)/iBe|0)|0}var yj=64,bj=4194304;function Kk(e){switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return e&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return e&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return e}}function Yj(e,t){var r=e.pendingLanes;if(r===0)return 0;var n=0,i=e.suspendedLanes,a=e.pingedLanes,o=r&268435455;if(o!==0){var s=o&~i;s!==0?n=Kk(s):(a&=o,a!==0&&(n=Kk(a)))}else o=r&~i,o!==0?n=Kk(o):a!==0&&(n=Kk(a));if(n===0)return 0;if(t!==0&&t!==n&&(t&i)===0&&(i=n&-n,a=t&-t,i>=a||i===16&&(a&4194240)!==0))return t;if((n&4)!==0&&(n|=r&16),t=e.entangledLanes,t!==0)for(e=e.entanglements,t&=n;0r;r++)t.push(e);return t}function C6(e,t,r){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-Mp(t),e[t]=r}function lBe(e,t){var r=e.pendingLanes&~t;e.pendingLanes=t,e.suspendedLanes=0,e.pingedLanes=0,e.expiredLanes&=t,e.mutableReadLanes&=t,e.entangledLanes&=t,t=e.entanglements;var n=e.eventTimes;for(e=e.expirationTimes;0=r6),Xre=String.fromCharCode(32),Kre=!1;function xie(e,t){switch(e){case"keyup":return IBe.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function wie(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var fw=!1;function RBe(e,t){switch(e){case"compositionend":return wie(t);case"keypress":return t.which!==32?null:(Kre=!0,Xre);case"textInput":return e=t.data,e===Xre&&Kre?null:e;default:return null}}function $Be(e,t){if(fw)return e==="compositionend"||!tU&&xie(e,t)?(e=yie(),Ij=Kz=b0=null,fw=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1=t)return{node:r,offset:t-e};e=n}e:{for(;r;){if(r.nextSibling){r=r.nextSibling;break e}r=r.parentNode}r=void 0}r=tne(r)}}function Cie(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Cie(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Die(){for(var e=window,t=Hj();t instanceof e.HTMLIFrameElement;){try{var r=typeof t.contentWindow.location.href=="string"}catch{r=!1}if(r)e=t.contentWindow;else break;t=Hj(e.document)}return t}function rU(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||t==="textarea"||e.contentEditable==="true")}function QBe(e){var t=Die(),r=e.focusedElem,n=e.selectionRange;if(t!==r&&r&&r.ownerDocument&&Cie(r.ownerDocument.documentElement,r)){if(n!==null&&rU(r)){if(t=n.start,e=n.end,e===void 0&&(e=t),"selectionStart"in r)r.selectionStart=t,r.selectionEnd=Math.min(e,r.value.length);else if(e=(t=r.ownerDocument||document)&&t.defaultView||window,e.getSelection){e=e.getSelection();var i=r.textContent.length,a=Math.min(n.start,i);n=n.end===void 0?a:Math.min(n.end,i),!e.extend&&a>n&&(i=n,n=a,a=i),i=rne(r,a);var o=rne(r,n);i&&o&&(e.rangeCount!==1||e.anchorNode!==i.node||e.anchorOffset!==i.offset||e.focusNode!==o.node||e.focusOffset!==o.offset)&&(t=t.createRange(),t.setStart(i.node,i.offset),e.removeAllRanges(),a>n?(e.addRange(t),e.extend(o.node,o.offset)):(t.setEnd(o.node,o.offset),e.addRange(t)))}}for(t=[],e=r;e=e.parentNode;)e.nodeType===1&&t.push({element:e,left:e.scrollLeft,top:e.scrollTop});for(typeof r.focus=="function"&&r.focus(),r=0;r=document.documentMode,dw=null,mz=null,i6=null,hz=!1;function nne(e,t,r){var n=r.window===r?r.document:r.nodeType===9?r:r.ownerDocument;hz||dw==null||dw!==Hj(n)||(n=dw,"selectionStart"in n&&rU(n)?n={start:n.selectionStart,end:n.selectionEnd}:(n=(n.ownerDocument&&n.ownerDocument.defaultView||window).getSelection(),n={anchorNode:n.anchorNode,anchorOffset:n.anchorOffset,focusNode:n.focusNode,focusOffset:n.focusOffset}),i6&&A6(i6,n)||(i6=n,n=Kj(mz,"onSelect"),0hw||(e.current=xz[hw],xz[hw]=null,hw--)}function fa(e,t){hw++,xz[hw]=e.current,e.current=t}var N0={},ru=F0(N0),gc=F0(!1),ty=N0;function Ow(e,t){var r=e.type.contextTypes;if(!r)return N0;var n=e.stateNode;if(n&&n.__reactInternalMemoizedUnmaskedChildContext===t)return n.__reactInternalMemoizedMaskedChildContext;var i={},a;for(a in r)i[a]=t[a];return n&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=i),i}function vc(e){return e=e.childContextTypes,e!=null}function eN(){ka(gc),ka(ru)}function dne(e,t,r){if(ru.current!==N0)throw Error(xt(168));fa(ru,t),fa(gc,r)}function Iie(e,t,r){var n=e.stateNode;if(t=t.childContextTypes,typeof n.getChildContext!="function")return r;n=n.getChildContext();for(var i in n)if(!(i in t))throw Error(xt(108,UIe(e)||"Unknown",i));return eo({},r,n)}function tN(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||N0,ty=ru.current,fa(ru,e),fa(gc,gc.current),!0}function pne(e,t,r){var n=e.stateNode;if(!n)throw Error(xt(169));r?(e=Iie(e,t,ty),n.__reactInternalMemoizedMergedChildContext=e,ka(gc),ka(ru),fa(ru,e)):ka(gc),fa(gc,r)}var OA=null,bN=!1,qL=!1;function Bie(e){OA===null?OA=[e]:OA.push(e)}function i5e(e){bN=!0,Bie(e)}function _0(){if(!qL&&OA!==null){qL=!0;var e=0,t=Ni;try{var r=OA;for(Ni=1;e>=o,i-=o,MA=1<<32-Mp(t)+i|r<j?(O=k,k=null):O=k.sibling;var C=d(A,k,v[j],x);if(C===null){k===null&&(k=O);break}e&&k&&C.alternate===null&&t(A,k),b=a(C,b,j),S===null?w=C:S.sibling=C,S=C,k=O}if(j===v.length)return r(A,k),$a&&Q1(A,j),w;if(k===null){for(;jj?(O=k,k=null):O=k.sibling;var N=d(A,k,C.value,x);if(N===null){k===null&&(k=O);break}e&&k&&N.alternate===null&&t(A,k),b=a(N,b,j),S===null?w=N:S.sibling=N,S=N,k=O}if(C.done)return r(A,k),$a&&Q1(A,j),w;if(k===null){for(;!C.done;j++,C=v.next())C=f(A,C.value,x),C!==null&&(b=a(C,b,j),S===null?w=C:S.sibling=C,S=C);return $a&&Q1(A,j),w}for(k=n(A,k);!C.done;j++,C=v.next())C=p(k,A,j,C.value,x),C!==null&&(e&&C.alternate!==null&&k.delete(C.key===null?j:C.key),b=a(C,b,j),S===null?w=C:S.sibling=C,S=C);return e&&k.forEach(function(D){return t(A,D)}),$a&&Q1(A,j),w}function g(A,b,v,x){if(typeof v=="object"&&v!==null&&v.type===cw&&v.key===null&&(v=v.props.children),typeof v=="object"&&v!==null){switch(v.$$typeof){case Aj:e:{for(var w=v.key,S=b;S!==null;){if(S.key===w){if(w=v.type,w===cw){if(S.tag===7){r(A,S.sibling),b=i(S,v.props.children),b.return=A,A=b;break e}}else if(S.elementType===w||typeof w=="object"&&w!==null&&w.$$typeof===A0&&bne(w)===S.type){r(A,S.sibling),b=i(S,v.props),b.ref=Vk(A,S,v),b.return=A,A=b;break e}r(A,S);break}else t(A,S);S=S.sibling}v.type===cw?(b=ey(v.props.children,A.mode,x,v.key),b.return=A,A=b):(x=Wj(v.type,v.key,v.props,null,A.mode,x),x.ref=Vk(A,b,v),x.return=A,A=x)}return o(A);case uw:e:{for(S=v.key;b!==null;){if(b.key===S)if(b.tag===4&&b.stateNode.containerInfo===v.containerInfo&&b.stateNode.implementation===v.implementation){r(A,b.sibling),b=i(b,v.children||[]),b.return=A,A=b;break e}else{r(A,b);break}else t(A,b);b=b.sibling}b=QL(v,A.mode,x),b.return=A,A=b}return o(A);case A0:return S=v._init,g(A,b,S(v._payload),x)}if(Xk(v))return h(A,b,v,x);if(zk(v))return m(A,b,v,x);Nj(A,v)}return typeof v=="string"&&v!==""||typeof v=="number"?(v=""+v,b!==null&&b.tag===6?(r(A,b.sibling),b=i(b,v),b.return=A,A=b):(r(A,b),b=GL(v,A.mode,x),b.return=A,A=b),o(A)):r(A,b)}return g}var jw=Hie(!0),Vie=Hie(!1),M6={},zm=F0(M6),b6=F0(M6),x6=F0(M6);function K1(e){if(e===M6)throw Error(xt(174));return e}function fU(e,t){switch(fa(x6,t),fa(b6,e),fa(zm,M6),e=t.nodeType,e){case 9:case 11:t=(t=t.documentElement)?t.namespaceURI:iz(null,"");break;default:e=e===8?t.parentNode:t,t=e.namespaceURI||null,e=e.tagName,t=iz(t,e)}ka(zm),fa(zm,t)}function Nw(){ka(zm),ka(b6),ka(x6)}function Gie(e){K1(x6.current);var t=K1(zm.current),r=iz(t,e.type);t!==r&&(fa(b6,e),fa(zm,r))}function dU(e){b6.current===e&&(ka(zm),ka(b6))}var Ka=F0(0);function sN(e){for(var t=e;t!==null;){if(t.tag===13){var r=t.memoizedState;if(r!==null&&(r=r.dehydrated,r===null||r.data==="$?"||r.data==="$!"))return t}else if(t.tag===19&&t.memoizedProps.revealOrder!==void 0){if((t.flags&128)!==0)return t}else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}var LL=[];function pU(){for(var e=0;er?r:4,e(!0);var n=zL.transition;zL.transition={};try{e(!1),t()}finally{Ni=r,zL.transition=n}}function uae(){return wd().memoizedState}function l5e(e,t,r){var n=O0(e);if(r={lane:n,action:r,hasEagerState:!1,eagerState:null,next:null},cae(e))fae(t,r);else if(r=Lie(e,t,r,n),r!==null){var i=$u();jp(r,e,n,i),dae(r,t,n)}}function u5e(e,t,r){var n=O0(e),i={lane:n,action:r,hasEagerState:!1,eagerState:null,next:null};if(cae(e))fae(t,i);else{var a=e.alternate;if(e.lanes===0&&(a===null||a.lanes===0)&&(a=t.lastRenderedReducer,a!==null))try{var o=t.lastRenderedState,s=a(o,r);if(i.hasEagerState=!0,i.eagerState=s,Np(s,o)){var l=t.interleaved;l===null?(i.next=i,uU(t)):(i.next=l.next,l.next=i),t.interleaved=i;return}}catch{}finally{}r=Lie(e,t,i,n),r!==null&&(i=$u(),jp(r,e,n,i),dae(r,t,n))}}function cae(e){var t=e.alternate;return e===Ja||t!==null&&t===Ja}function fae(e,t){a6=lN=!0;var r=e.pending;r===null?t.next=t:(t.next=r.next,r.next=t),e.pending=t}function dae(e,t,r){if((r&4194240)!==0){var n=t.lanes;n&=e.pendingLanes,r|=n,t.lanes=r,Yz(e,r)}}var uN={readContext:xd,useCallback:Jl,useContext:Jl,useEffect:Jl,useImperativeHandle:Jl,useInsertionEffect:Jl,useLayoutEffect:Jl,useMemo:Jl,useReducer:Jl,useRef:Jl,useState:Jl,useDebugValue:Jl,useDeferredValue:Jl,useTransition:Jl,useMutableSource:Jl,useSyncExternalStore:Jl,useId:Jl,unstable_isNewReconciler:!1},c5e={readContext:xd,useCallback:function(e,t){return $m().memoizedState=[e,t===void 0?null:t],e},useContext:xd,useEffect:wne,useImperativeHandle:function(e,t,r){return r=r!=null?r.concat([e]):null,qj(4194308,4,iae.bind(null,t,e),r)},useLayoutEffect:function(e,t){return qj(4194308,4,e,t)},useInsertionEffect:function(e,t){return qj(4,2,e,t)},useMemo:function(e,t){var r=$m();return t=t===void 0?null:t,e=e(),r.memoizedState=[e,t],e},useReducer:function(e,t,r){var n=$m();return t=r!==void 0?r(t):t,n.memoizedState=n.baseState=t,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:t},n.queue=e,e=e.dispatch=l5e.bind(null,Ja,e),[n.memoizedState,e]},useRef:function(e){var t=$m();return e={current:e},t.memoizedState=e},useState:xne,useDebugValue:vU,useDeferredValue:function(e){return $m().memoizedState=e},useTransition:function(){var e=xne(!1),t=e[0];return e=s5e.bind(null,e[1]),$m().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,r){var n=Ja,i=$m();if($a){if(r===void 0)throw Error(xt(407));r=r()}else{if(r=t(),Ls===null)throw Error(xt(349));(ny&30)!==0||Zie(n,t,r)}i.memoizedState=r;var a={value:r,getSnapshot:t};return i.queue=a,wne(Kie.bind(null,n,a,e),[e]),n.flags|=2048,E6(9,Xie.bind(null,n,a,r,t),void 0,null),r},useId:function(){var e=$m(),t=Ls.identifierPrefix;if($a){var r=jA,n=MA;r=(n&~(1<<32-Mp(n)-1)).toString(32)+r,t=":"+t+"R"+r,r=w6++,0")&&(l=l.replace("",e.displayName)),l}while(1<=o&&0<=s);break}}}finally{OL=!1,Error.prepareStackTrace=r}return(e=e?e.displayName||e.name:"")?Zk(e):""}function zIe(e){switch(e.tag){case 5:return Zk(e.type);case 16:return Zk("Lazy");case 13:return Zk("Suspense");case 19:return Zk("SuspenseList");case 0:case 2:case 15:return e=ML(e.type,!1),e;case 11:return e=ML(e.type.render,!1),e;case 1:return e=ML(e.type,!0),e;default:return""}}function JL(e){if(e==null)return null;if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case cw:return"Fragment";case uw:return"Portal";case ZL:return"Profiler";case Wz:return"StrictMode";case XL:return"Suspense";case KL:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case Wne:return(e.displayName||"Context")+".Consumer";case Une:return(e._context.displayName||"Context")+".Provider";case Hz:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case Vz:return t=e.displayName||null,t!==null?t:JL(e.type)||"Memo";case A0:t=e._payload,e=e._init;try{return JL(e(t))}catch{}}return null}function UIe(e){var t=e.type;switch(e.tag){case 24:return"Cache";case 9:return(t.displayName||"Context")+".Consumer";case 10:return(t._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return e=t.render,e=e.displayName||e.name||"",t.displayName||(e!==""?"ForwardRef("+e+")":"ForwardRef");case 7:return"Fragment";case 5:return t;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return JL(t);case 8:return t===Wz?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t}return null}function j0(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function Vne(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function WIe(e){var t=Vne(e)?"checked":"value",r=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),n=""+e[t];if(!e.hasOwnProperty(t)&&typeof r<"u"&&typeof r.get=="function"&&typeof r.set=="function"){var i=r.get,a=r.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return i.call(this)},set:function(o){n=""+o,a.call(this,o)}}),Object.defineProperty(e,t,{enumerable:r.enumerable}),{getValue:function(){return n},setValue:function(o){n=""+o},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function gj(e){e._valueTracker||(e._valueTracker=WIe(e))}function Gne(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var r=t.getValue(),n="";return e&&(n=Vne(e)?e.checked?"true":"false":e.value),e=n,e!==r?(t.setValue(e),!0):!1}function Hj(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}function ez(e,t){var r=t.checked;return eo({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:r??e._wrapperState.initialChecked})}function Rre(e,t){var r=t.defaultValue==null?"":t.defaultValue,n=t.checked!=null?t.checked:t.defaultChecked;r=j0(t.value!=null?t.value:r),e._wrapperState={initialChecked:n,initialValue:r,controlled:t.type==="checkbox"||t.type==="radio"?t.checked!=null:t.value!=null}}function Qne(e,t){t=t.checked,t!=null&&Uz(e,"checked",t,!1)}function tz(e,t){Qne(e,t);var r=j0(t.value),n=t.type;if(r!=null)n==="number"?(r===0&&e.value===""||e.value!=r)&&(e.value=""+r):e.value!==""+r&&(e.value=""+r);else if(n==="submit"||n==="reset"){e.removeAttribute("value");return}t.hasOwnProperty("value")?rz(e,t.type,r):t.hasOwnProperty("defaultValue")&&rz(e,t.type,j0(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function $re(e,t,r){if(t.hasOwnProperty("value")||t.hasOwnProperty("defaultValue")){var n=t.type;if(!(n!=="submit"&&n!=="reset"||t.value!==void 0&&t.value!==null))return;t=""+e._wrapperState.initialValue,r||t===e.value||(e.value=t),e.defaultValue=t}r=e.name,r!==""&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,r!==""&&(e.name=r)}function rz(e,t,r){(t!=="number"||Hj(e.ownerDocument)!==e)&&(r==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+r&&(e.defaultValue=""+r))}var Xk=Array.isArray;function xw(e,t,r,n){if(e=e.options,t){t={};for(var i=0;i"+t.valueOf().toString()+"",t=vj.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function c6(e,t){if(t){var r=e.firstChild;if(r&&r===e.lastChild&&r.nodeType===3){r.nodeValue=t;return}}e.textContent=t}var e6={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},HIe=["Webkit","ms","Moz","O"];Object.keys(e6).forEach(function(e){HIe.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),e6[t]=e6[e]})});function Kne(e,t,r){return t==null||typeof t=="boolean"||t===""?"":r||typeof t!="number"||t===0||e6.hasOwnProperty(e)&&e6[e]?(""+t).trim():t+"px"}function Jne(e,t){e=e.style;for(var r in t)if(t.hasOwnProperty(r)){var n=r.indexOf("--")===0,i=Kne(r,t[r],n);r==="float"&&(r="cssFloat"),n?e.setProperty(r,i):e[r]=i}}var VIe=eo({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function az(e,t){if(t){if(VIe[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(xt(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(xt(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(xt(61))}if(t.style!=null&&typeof t.style!="object")throw Error(xt(62))}}function oz(e,t){if(e.indexOf("-")===-1)return typeof t.is=="string";switch(e){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var sz=null;function Gz(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var lz=null,ww=null,Sw=null;function zre(e){if(e=O6(e)){if(typeof lz!="function")throw Error(xt(280));var t=e.stateNode;t&&(t=yN(t),lz(e.stateNode,e.type,t))}}function eie(e){ww?Sw?Sw.push(e):Sw=[e]:ww=e}function tie(){if(ww){var e=ww,t=Sw;if(Sw=ww=null,zre(e),t)for(e=0;e>>=0,e===0?32:31-(nBe(e)/iBe|0)|0}var yj=64,bj=4194304;function Kk(e){switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return e&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return e&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return e}}function Yj(e,t){var r=e.pendingLanes;if(r===0)return 0;var n=0,i=e.suspendedLanes,a=e.pingedLanes,o=r&268435455;if(o!==0){var s=o&~i;s!==0?n=Kk(s):(a&=o,a!==0&&(n=Kk(a)))}else o=r&~i,o!==0?n=Kk(o):a!==0&&(n=Kk(a));if(n===0)return 0;if(t!==0&&t!==n&&(t&i)===0&&(i=n&-n,a=t&-t,i>=a||i===16&&(a&4194240)!==0))return t;if((n&4)!==0&&(n|=r&16),t=e.entangledLanes,t!==0)for(e=e.entanglements,t&=n;0r;r++)t.push(e);return t}function C6(e,t,r){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-jp(t),e[t]=r}function lBe(e,t){var r=e.pendingLanes&~t;e.pendingLanes=t,e.suspendedLanes=0,e.pingedLanes=0,e.expiredLanes&=t,e.mutableReadLanes&=t,e.entangledLanes&=t,t=e.entanglements;var n=e.eventTimes;for(e=e.expirationTimes;0=r6),Xre=String.fromCharCode(32),Kre=!1;function xie(e,t){switch(e){case"keyup":return IBe.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function wie(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var fw=!1;function RBe(e,t){switch(e){case"compositionend":return wie(t);case"keypress":return t.which!==32?null:(Kre=!0,Xre);case"textInput":return e=t.data,e===Xre&&Kre?null:e;default:return null}}function $Be(e,t){if(fw)return e==="compositionend"||!tU&&xie(e,t)?(e=yie(),Ij=Kz=b0=null,fw=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1=t)return{node:r,offset:t-e};e=n}e:{for(;r;){if(r.nextSibling){r=r.nextSibling;break e}r=r.parentNode}r=void 0}r=tne(r)}}function Cie(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Cie(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Die(){for(var e=window,t=Hj();t instanceof e.HTMLIFrameElement;){try{var r=typeof t.contentWindow.location.href=="string"}catch{r=!1}if(r)e=t.contentWindow;else break;t=Hj(e.document)}return t}function rU(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||t==="textarea"||e.contentEditable==="true")}function QBe(e){var t=Die(),r=e.focusedElem,n=e.selectionRange;if(t!==r&&r&&r.ownerDocument&&Cie(r.ownerDocument.documentElement,r)){if(n!==null&&rU(r)){if(t=n.start,e=n.end,e===void 0&&(e=t),"selectionStart"in r)r.selectionStart=t,r.selectionEnd=Math.min(e,r.value.length);else if(e=(t=r.ownerDocument||document)&&t.defaultView||window,e.getSelection){e=e.getSelection();var i=r.textContent.length,a=Math.min(n.start,i);n=n.end===void 0?a:Math.min(n.end,i),!e.extend&&a>n&&(i=n,n=a,a=i),i=rne(r,a);var o=rne(r,n);i&&o&&(e.rangeCount!==1||e.anchorNode!==i.node||e.anchorOffset!==i.offset||e.focusNode!==o.node||e.focusOffset!==o.offset)&&(t=t.createRange(),t.setStart(i.node,i.offset),e.removeAllRanges(),a>n?(e.addRange(t),e.extend(o.node,o.offset)):(t.setEnd(o.node,o.offset),e.addRange(t)))}}for(t=[],e=r;e=e.parentNode;)e.nodeType===1&&t.push({element:e,left:e.scrollLeft,top:e.scrollTop});for(typeof r.focus=="function"&&r.focus(),r=0;r=document.documentMode,dw=null,mz=null,i6=null,hz=!1;function nne(e,t,r){var n=r.window===r?r.document:r.nodeType===9?r:r.ownerDocument;hz||dw==null||dw!==Hj(n)||(n=dw,"selectionStart"in n&&rU(n)?n={start:n.selectionStart,end:n.selectionEnd}:(n=(n.ownerDocument&&n.ownerDocument.defaultView||window).getSelection(),n={anchorNode:n.anchorNode,anchorOffset:n.anchorOffset,focusNode:n.focusNode,focusOffset:n.focusOffset}),i6&&A6(i6,n)||(i6=n,n=Kj(mz,"onSelect"),0hw||(e.current=xz[hw],xz[hw]=null,hw--)}function fa(e,t){hw++,xz[hw]=e.current,e.current=t}var N0={},ru=F0(N0),gc=F0(!1),ty=N0;function Ow(e,t){var r=e.type.contextTypes;if(!r)return N0;var n=e.stateNode;if(n&&n.__reactInternalMemoizedUnmaskedChildContext===t)return n.__reactInternalMemoizedMaskedChildContext;var i={},a;for(a in r)i[a]=t[a];return n&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=i),i}function vc(e){return e=e.childContextTypes,e!=null}function eN(){ka(gc),ka(ru)}function dne(e,t,r){if(ru.current!==N0)throw Error(xt(168));fa(ru,t),fa(gc,r)}function Iie(e,t,r){var n=e.stateNode;if(t=t.childContextTypes,typeof n.getChildContext!="function")return r;n=n.getChildContext();for(var i in n)if(!(i in t))throw Error(xt(108,UIe(e)||"Unknown",i));return eo({},r,n)}function tN(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||N0,ty=ru.current,fa(ru,e),fa(gc,gc.current),!0}function pne(e,t,r){var n=e.stateNode;if(!n)throw Error(xt(169));r?(e=Iie(e,t,ty),n.__reactInternalMemoizedMergedChildContext=e,ka(gc),ka(ru),fa(ru,e)):ka(gc),fa(gc,r)}var OA=null,bN=!1,qL=!1;function Bie(e){OA===null?OA=[e]:OA.push(e)}function i5e(e){bN=!0,Bie(e)}function _0(){if(!qL&&OA!==null){qL=!0;var e=0,t=Ni;try{var r=OA;for(Ni=1;e>=o,i-=o,MA=1<<32-jp(t)+i|r<j?(O=k,k=null):O=k.sibling;var C=d(A,k,v[j],x);if(C===null){k===null&&(k=O);break}e&&k&&C.alternate===null&&t(A,k),b=a(C,b,j),S===null?w=C:S.sibling=C,S=C,k=O}if(j===v.length)return r(A,k),$a&&Q1(A,j),w;if(k===null){for(;jj?(O=k,k=null):O=k.sibling;var N=d(A,k,C.value,x);if(N===null){k===null&&(k=O);break}e&&k&&N.alternate===null&&t(A,k),b=a(N,b,j),S===null?w=N:S.sibling=N,S=N,k=O}if(C.done)return r(A,k),$a&&Q1(A,j),w;if(k===null){for(;!C.done;j++,C=v.next())C=f(A,C.value,x),C!==null&&(b=a(C,b,j),S===null?w=C:S.sibling=C,S=C);return $a&&Q1(A,j),w}for(k=n(A,k);!C.done;j++,C=v.next())C=p(k,A,j,C.value,x),C!==null&&(e&&C.alternate!==null&&k.delete(C.key===null?j:C.key),b=a(C,b,j),S===null?w=C:S.sibling=C,S=C);return e&&k.forEach(function(D){return t(A,D)}),$a&&Q1(A,j),w}function g(A,b,v,x){if(typeof v=="object"&&v!==null&&v.type===cw&&v.key===null&&(v=v.props.children),typeof v=="object"&&v!==null){switch(v.$$typeof){case Aj:e:{for(var w=v.key,S=b;S!==null;){if(S.key===w){if(w=v.type,w===cw){if(S.tag===7){r(A,S.sibling),b=i(S,v.props.children),b.return=A,A=b;break e}}else if(S.elementType===w||typeof w=="object"&&w!==null&&w.$$typeof===A0&&bne(w)===S.type){r(A,S.sibling),b=i(S,v.props),b.ref=Vk(A,S,v),b.return=A,A=b;break e}r(A,S);break}else t(A,S);S=S.sibling}v.type===cw?(b=ey(v.props.children,A.mode,x,v.key),b.return=A,A=b):(x=Wj(v.type,v.key,v.props,null,A.mode,x),x.ref=Vk(A,b,v),x.return=A,A=x)}return o(A);case uw:e:{for(S=v.key;b!==null;){if(b.key===S)if(b.tag===4&&b.stateNode.containerInfo===v.containerInfo&&b.stateNode.implementation===v.implementation){r(A,b.sibling),b=i(b,v.children||[]),b.return=A,A=b;break e}else{r(A,b);break}else t(A,b);b=b.sibling}b=QL(v,A.mode,x),b.return=A,A=b}return o(A);case A0:return S=v._init,g(A,b,S(v._payload),x)}if(Xk(v))return h(A,b,v,x);if(zk(v))return m(A,b,v,x);Nj(A,v)}return typeof v=="string"&&v!==""||typeof v=="number"?(v=""+v,b!==null&&b.tag===6?(r(A,b.sibling),b=i(b,v),b.return=A,A=b):(r(A,b),b=GL(v,A.mode,x),b.return=A,A=b),o(A)):r(A,b)}return g}var jw=Hie(!0),Vie=Hie(!1),M6={},zm=F0(M6),b6=F0(M6),x6=F0(M6);function K1(e){if(e===M6)throw Error(xt(174));return e}function fU(e,t){switch(fa(x6,t),fa(b6,e),fa(zm,M6),e=t.nodeType,e){case 9:case 11:t=(t=t.documentElement)?t.namespaceURI:iz(null,"");break;default:e=e===8?t.parentNode:t,t=e.namespaceURI||null,e=e.tagName,t=iz(t,e)}ka(zm),fa(zm,t)}function Nw(){ka(zm),ka(b6),ka(x6)}function Gie(e){K1(x6.current);var t=K1(zm.current),r=iz(t,e.type);t!==r&&(fa(b6,e),fa(zm,r))}function dU(e){b6.current===e&&(ka(zm),ka(b6))}var Ka=F0(0);function sN(e){for(var t=e;t!==null;){if(t.tag===13){var r=t.memoizedState;if(r!==null&&(r=r.dehydrated,r===null||r.data==="$?"||r.data==="$!"))return t}else if(t.tag===19&&t.memoizedProps.revealOrder!==void 0){if((t.flags&128)!==0)return t}else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}var LL=[];function pU(){for(var e=0;er?r:4,e(!0);var n=zL.transition;zL.transition={};try{e(!1),t()}finally{Ni=r,zL.transition=n}}function uae(){return wd().memoizedState}function l5e(e,t,r){var n=O0(e);if(r={lane:n,action:r,hasEagerState:!1,eagerState:null,next:null},cae(e))fae(t,r);else if(r=Lie(e,t,r,n),r!==null){var i=$u();Np(r,e,n,i),dae(r,t,n)}}function u5e(e,t,r){var n=O0(e),i={lane:n,action:r,hasEagerState:!1,eagerState:null,next:null};if(cae(e))fae(t,i);else{var a=e.alternate;if(e.lanes===0&&(a===null||a.lanes===0)&&(a=t.lastRenderedReducer,a!==null))try{var o=t.lastRenderedState,s=a(o,r);if(i.hasEagerState=!0,i.eagerState=s,Tp(s,o)){var l=t.interleaved;l===null?(i.next=i,uU(t)):(i.next=l.next,l.next=i),t.interleaved=i;return}}catch{}finally{}r=Lie(e,t,i,n),r!==null&&(i=$u(),Np(r,e,n,i),dae(r,t,n))}}function cae(e){var t=e.alternate;return e===Ja||t!==null&&t===Ja}function fae(e,t){a6=lN=!0;var r=e.pending;r===null?t.next=t:(t.next=r.next,r.next=t),e.pending=t}function dae(e,t,r){if((r&4194240)!==0){var n=t.lanes;n&=e.pendingLanes,r|=n,t.lanes=r,Yz(e,r)}}var uN={readContext:xd,useCallback:Jl,useContext:Jl,useEffect:Jl,useImperativeHandle:Jl,useInsertionEffect:Jl,useLayoutEffect:Jl,useMemo:Jl,useReducer:Jl,useRef:Jl,useState:Jl,useDebugValue:Jl,useDeferredValue:Jl,useTransition:Jl,useMutableSource:Jl,useSyncExternalStore:Jl,useId:Jl,unstable_isNewReconciler:!1},c5e={readContext:xd,useCallback:function(e,t){return $m().memoizedState=[e,t===void 0?null:t],e},useContext:xd,useEffect:wne,useImperativeHandle:function(e,t,r){return r=r!=null?r.concat([e]):null,qj(4194308,4,iae.bind(null,t,e),r)},useLayoutEffect:function(e,t){return qj(4194308,4,e,t)},useInsertionEffect:function(e,t){return qj(4,2,e,t)},useMemo:function(e,t){var r=$m();return t=t===void 0?null:t,e=e(),r.memoizedState=[e,t],e},useReducer:function(e,t,r){var n=$m();return t=r!==void 0?r(t):t,n.memoizedState=n.baseState=t,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:t},n.queue=e,e=e.dispatch=l5e.bind(null,Ja,e),[n.memoizedState,e]},useRef:function(e){var t=$m();return e={current:e},t.memoizedState=e},useState:xne,useDebugValue:vU,useDeferredValue:function(e){return $m().memoizedState=e},useTransition:function(){var e=xne(!1),t=e[0];return e=s5e.bind(null,e[1]),$m().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,r){var n=Ja,i=$m();if($a){if(r===void 0)throw Error(xt(407));r=r()}else{if(r=t(),Ls===null)throw Error(xt(349));(ny&30)!==0||Zie(n,t,r)}i.memoizedState=r;var a={value:r,getSnapshot:t};return i.queue=a,wne(Kie.bind(null,n,a,e),[e]),n.flags|=2048,E6(9,Xie.bind(null,n,a,r,t),void 0,null),r},useId:function(){var e=$m(),t=Ls.identifierPrefix;if($a){var r=jA,n=MA;r=(n&~(1<<32-jp(n)-1)).toString(32)+r,t=":"+t+"R"+r,r=w6++,0<\/script>",e=e.removeChild(e.firstChild)):typeof n.is=="string"?e=o.createElement(r,{is:n.is}):(e=o.createElement(r),r==="select"&&(o=e,n.multiple?o.multiple=!0:n.size&&(o.size=n.size))):e=o.createElementNS(e,r),e[qm]=t,e[y6]=n,xae(e,t,!1,!1),t.stateNode=e;e:{switch(o=oz(r,n),r){case"dialog":Ea("cancel",e),Ea("close",e),i=n;break;case"iframe":case"object":case"embed":Ea("load",e),i=n;break;case"video":case"audio":for(i=0;iFw&&(t.flags|=128,n=!0,Gk(a,!1),t.lanes=4194304)}else{if(!n)if(e=sN(o),e!==null){if(t.flags|=128,n=!0,r=e.updateQueue,r!==null&&(t.updateQueue=r,t.flags|=4),Gk(a,!0),a.tail===null&&a.tailMode==="hidden"&&!o.alternate&&!$a)return eu(t),null}else 2*jo()-a.renderingStartTime>Fw&&r!==1073741824&&(t.flags|=128,n=!0,Gk(a,!1),t.lanes=4194304);a.isBackwards?(o.sibling=t.child,t.child=o):(r=a.last,r!==null?r.sibling=o:t.child=o,a.last=o)}return a.tail!==null?(t=a.tail,a.rendering=t,a.tail=t.sibling,a.renderingStartTime=jo(),t.sibling=null,r=Ka.current,fa(Ka,n?r&1|2:r&1),t):(eu(t),null);case 22:case 23:return EU(),n=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==n&&(t.flags|=8192),n&&(t.mode&1)!==0?(cf&1073741824)!==0&&(eu(t),t.subtreeFlags&6&&(t.flags|=8192)):eu(t),null;case 24:return null;case 25:return null}throw Error(xt(156,t.tag))}function v5e(e,t){switch(iU(t),t.tag){case 1:return vc(t.type)&&eN(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Nw(),ka(gc),ka(ru),pU(),e=t.flags,(e&65536)!==0&&(e&128)===0?(t.flags=e&-65537|128,t):null;case 5:return dU(t),null;case 13:if(ka(Ka),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(xt(340));Mw()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return ka(Ka),null;case 4:return Nw(),null;case 10:return lU(t.type._context),null;case 22:case 23:return EU(),null;case 24:return null;default:return null}}var Fj=!1,tu=!1,y5e=typeof WeakSet=="function"?WeakSet:Set,Gt=null;function yw(e,t){var r=e.ref;if(r!==null)if(typeof r=="function")try{r(null)}catch(n){go(e,t,n)}else r.current=null}function Fz(e,t,r){try{r()}catch(n){go(e,t,n)}}var Nne=!1;function b5e(e,t){if(Az=Zj,e=Die(),rU(e)){if("selectionStart"in e)var r={start:e.selectionStart,end:e.selectionEnd};else e:{r=(r=e.ownerDocument)&&r.defaultView||window;var n=r.getSelection&&r.getSelection();if(n&&n.rangeCount!==0){r=n.anchorNode;var i=n.anchorOffset,a=n.focusNode;n=n.focusOffset;try{r.nodeType,a.nodeType}catch{r=null;break e}var o=0,s=-1,l=-1,u=0,c=0,f=e,d=null;t:for(;;){for(var p;f!==r||i!==0&&f.nodeType!==3||(s=o+i),f!==a||n!==0&&f.nodeType!==3||(l=o+n),f.nodeType===3&&(o+=f.nodeValue.length),(p=f.firstChild)!==null;)d=f,f=p;for(;;){if(f===e)break t;if(d===r&&++u===i&&(s=o),d===a&&++c===n&&(l=o),(p=f.nextSibling)!==null)break;f=d,d=f.parentNode}f=p}r=s===-1||l===-1?null:{start:s,end:l}}else r=null}r=r||{start:0,end:0}}else r=null;for(gz={focusedElem:e,selectionRange:r},Zj=!1,Gt=t;Gt!==null;)if(t=Gt,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,Gt=e;else for(;Gt!==null;){t=Gt;try{var h=t.alternate;if((t.flags&1024)!==0)switch(t.tag){case 0:case 11:case 15:break;case 1:if(h!==null){var m=h.memoizedProps,g=h.memoizedState,A=t.stateNode,b=A.getSnapshotBeforeUpdate(t.elementType===t.type?m:Cp(t.type,m),g);A.__reactInternalSnapshotBeforeUpdate=b}break;case 3:var v=t.stateNode.containerInfo;v.nodeType===1?v.textContent="":v.nodeType===9&&v.documentElement&&v.removeChild(v.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(xt(163))}}catch(x){go(t,t.return,x)}if(e=t.sibling,e!==null){e.return=t.return,Gt=e;break}Gt=t.return}return h=Nne,Nne=!1,h}function o6(e,t,r){var n=t.updateQueue;if(n=n!==null?n.lastEffect:null,n!==null){var i=n=n.next;do{if((i.tag&e)===e){var a=i.destroy;i.destroy=void 0,a!==void 0&&Fz(t,r,a)}i=i.next}while(i!==n)}}function SN(e,t){if(t=t.updateQueue,t=t!==null?t.lastEffect:null,t!==null){var r=t=t.next;do{if((r.tag&e)===e){var n=r.create;r.destroy=n()}r=r.next}while(r!==t)}}function _z(e){var t=e.ref;if(t!==null){var r=e.stateNode;switch(e.tag){case 5:e=r;break;default:e=r}typeof t=="function"?t(e):t.current=e}}function Eae(e){var t=e.alternate;t!==null&&(e.alternate=null,Eae(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[qm],delete t[y6],delete t[bz],delete t[r5e],delete t[n5e])),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}function kae(e){return e.tag===5||e.tag===3||e.tag===4}function Tne(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||kae(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function Pz(e,t,r){var n=e.tag;if(n===5||n===6)e=e.stateNode,t?r.nodeType===8?r.parentNode.insertBefore(e,t):r.insertBefore(e,t):(r.nodeType===8?(t=r.parentNode,t.insertBefore(e,r)):(t=r,t.appendChild(e)),r=r._reactRootContainer,r!=null||t.onclick!==null||(t.onclick=Jj));else if(n!==4&&(e=e.child,e!==null))for(Pz(e,t,r),e=e.sibling;e!==null;)Pz(e,t,r),e=e.sibling}function Iz(e,t,r){var n=e.tag;if(n===5||n===6)e=e.stateNode,t?r.insertBefore(e,t):r.appendChild(e);else if(n!==4&&(e=e.child,e!==null))for(Iz(e,t,r),e=e.sibling;e!==null;)Iz(e,t,r),e=e.sibling}var gl=null,Dp=!1;function h0(e,t,r){for(r=r.child;r!==null;)Cae(e,t,r),r=r.sibling}function Cae(e,t,r){if(Lm&&typeof Lm.onCommitFiberUnmount=="function")try{Lm.onCommitFiberUnmount(hN,r)}catch{}switch(r.tag){case 5:tu||yw(r,t);case 6:var n=gl,i=Dp;gl=null,h0(e,t,r),gl=n,Dp=i,gl!==null&&(Dp?(e=gl,r=r.stateNode,e.nodeType===8?e.parentNode.removeChild(r):e.removeChild(r)):gl.removeChild(r.stateNode));break;case 18:gl!==null&&(Dp?(e=gl,r=r.stateNode,e.nodeType===8?$L(e.parentNode,r):e.nodeType===1&&$L(e,r),m6(e)):$L(gl,r.stateNode));break;case 4:n=gl,i=Dp,gl=r.stateNode.containerInfo,Dp=!0,h0(e,t,r),gl=n,Dp=i;break;case 0:case 11:case 14:case 15:if(!tu&&(n=r.updateQueue,n!==null&&(n=n.lastEffect,n!==null))){i=n=n.next;do{var a=i,o=a.destroy;a=a.tag,o!==void 0&&((a&2)!==0||(a&4)!==0)&&Fz(r,t,o),i=i.next}while(i!==n)}h0(e,t,r);break;case 1:if(!tu&&(yw(r,t),n=r.stateNode,typeof n.componentWillUnmount=="function"))try{n.props=r.memoizedProps,n.state=r.memoizedState,n.componentWillUnmount()}catch(s){go(r,t,s)}h0(e,t,r);break;case 21:h0(e,t,r);break;case 22:r.mode&1?(tu=(n=tu)||r.memoizedState!==null,h0(e,t,r),tu=n):h0(e,t,r);break;default:h0(e,t,r)}}function Fne(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var r=e.stateNode;r===null&&(r=e.stateNode=new y5e),t.forEach(function(n){var i=M5e.bind(null,e,n);r.has(n)||(r.add(n),n.then(i,i))})}}function kp(e,t){var r=t.deletions;if(r!==null)for(var n=0;ni&&(i=o),n&=~a}if(n=i,n=jo()-n,n=(120>n?120:480>n?480:1080>n?1080:1920>n?1920:3e3>n?3e3:4320>n?4320:1960*w5e(n/1960))-n,10e?16:e,x0===null)var n=!1;else{if(e=x0,x0=null,dN=0,(ti&6)!==0)throw Error(xt(331));var i=ti;for(ti|=4,Gt=e.current;Gt!==null;){var a=Gt,o=a.child;if((Gt.flags&16)!==0){var s=a.deletions;if(s!==null){for(var l=0;ljo()-wU?J1(e,0):xU|=r),yc(e,t)}function _ae(e,t){t===0&&((e.mode&1)===0?t=1:(t=bj,bj<<=1,(bj&130023424)===0&&(bj=4194304)));var r=$u();e=_A(e,t),e!==null&&(C6(e,t,r),yc(e,r))}function O5e(e){var t=e.memoizedState,r=0;t!==null&&(r=t.retryLane),_ae(e,r)}function M5e(e,t){var r=0;switch(e.tag){case 13:var n=e.stateNode,i=e.memoizedState;i!==null&&(r=i.retryLane);break;case 19:n=e.stateNode;break;default:throw Error(xt(314))}n!==null&&n.delete(t),_ae(e,r)}var Pae;Pae=function(e,t,r){if(e!==null)if(e.memoizedProps!==t.pendingProps||gc.current)Ac=!0;else{if((e.lanes&r)===0&&(t.flags&128)===0)return Ac=!1,A5e(e,t,r);Ac=(e.flags&131072)!==0}else Ac=!1,$a&&(t.flags&1048576)!==0&&Rie(t,nN,t.index);switch(t.lanes=0,t.tag){case 2:var n=t.type;Lj(e,t),e=t.pendingProps;var i=Ow(t,ru.current);kw(t,r),i=hU(null,t,n,e,i,r);var a=AU();return t.flags|=1,typeof i=="object"&&i!==null&&typeof i.render=="function"&&i.$$typeof===void 0?(t.tag=1,t.memoizedState=null,t.updateQueue=null,vc(n)?(a=!0,tN(t)):a=!1,t.memoizedState=i.state!==null&&i.state!==void 0?i.state:null,cU(t),i.updater=xN,t.stateNode=i,i._reactInternals=t,Cz(t,n,e,r),t=Mz(null,t,n,!0,a,r)):(t.tag=0,$a&&a&&nU(t),Ru(null,t,i,r),t=t.child),t;case 16:n=t.elementType;e:{switch(Lj(e,t),e=t.pendingProps,i=n._init,n=i(n._payload),t.type=n,i=t.tag=N5e(n),e=Cp(n,e),i){case 0:t=Oz(null,t,n,e,r);break e;case 1:t=One(null,t,n,e,r);break e;case 11:t=Cne(null,t,n,e,r);break e;case 14:t=Dne(null,t,n,Cp(n.type,e),r);break e}throw Error(xt(306,n,""))}return t;case 0:return n=t.type,i=t.pendingProps,i=t.elementType===n?i:Cp(n,i),Oz(e,t,n,i,r);case 1:return n=t.type,i=t.pendingProps,i=t.elementType===n?i:Cp(n,i),One(e,t,n,i,r);case 3:e:{if(vae(t),e===null)throw Error(xt(387));n=t.pendingProps,a=t.memoizedState,i=a.element,zie(e,t),oN(t,n,null,r);var o=t.memoizedState;if(n=o.element,a.isDehydrated)if(a={element:n,isDehydrated:!1,cache:o.cache,pendingSuspenseBoundaries:o.pendingSuspenseBoundaries,transitions:o.transitions},t.updateQueue.baseState=a,t.memoizedState=a,t.flags&256){i=Tw(Error(xt(423)),t),t=Mne(e,t,n,r,i);break e}else if(n!==i){i=Tw(Error(xt(424)),t),t=Mne(e,t,n,r,i);break e}else for(ff=k0(t.stateNode.containerInfo.firstChild),df=t,$a=!0,Op=null,r=Vie(t,null,n,r),t.child=r;r;)r.flags=r.flags&-3|4096,r=r.sibling;else{if(Mw(),n===i){t=PA(e,t,r);break e}Ru(e,t,n,r)}t=t.child}return t;case 5:return Gie(t),e===null&&Sz(t),n=t.type,i=t.pendingProps,a=e!==null?e.memoizedProps:null,o=i.children,vz(n,i)?o=null:a!==null&&vz(n,a)&&(t.flags|=32),gae(e,t),Ru(e,t,o,r),t.child;case 6:return e===null&&Sz(t),null;case 13:return yae(e,t,r);case 4:return fU(t,t.stateNode.containerInfo),n=t.pendingProps,e===null?t.child=jw(t,null,n,r):Ru(e,t,n,r),t.child;case 11:return n=t.type,i=t.pendingProps,i=t.elementType===n?i:Cp(n,i),Cne(e,t,n,i,r);case 7:return Ru(e,t,t.pendingProps,r),t.child;case 8:return Ru(e,t,t.pendingProps.children,r),t.child;case 12:return Ru(e,t,t.pendingProps.children,r),t.child;case 10:e:{if(n=t.type._context,i=t.pendingProps,a=t.memoizedProps,o=i.value,fa(iN,n._currentValue),n._currentValue=o,a!==null)if(Np(a.value,o)){if(a.children===i.children&&!gc.current){t=PA(e,t,r);break e}}else for(a=t.child,a!==null&&(a.return=t);a!==null;){var s=a.dependencies;if(s!==null){o=a.child;for(var l=s.firstContext;l!==null;){if(l.context===n){if(a.tag===1){l=NA(-1,r&-r),l.tag=2;var u=a.updateQueue;if(u!==null){u=u.shared;var c=u.pending;c===null?l.next=l:(l.next=c.next,c.next=l),u.pending=l}}a.lanes|=r,l=a.alternate,l!==null&&(l.lanes|=r),Ez(a.return,r,t),s.lanes|=r;break}l=l.next}}else if(a.tag===10)o=a.type===t.type?null:a.child;else if(a.tag===18){if(o=a.return,o===null)throw Error(xt(341));o.lanes|=r,s=o.alternate,s!==null&&(s.lanes|=r),Ez(o,r,t),o=a.sibling}else o=a.child;if(o!==null)o.return=a;else for(o=a;o!==null;){if(o===t){o=null;break}if(a=o.sibling,a!==null){a.return=o.return,o=a;break}o=o.return}a=o}Ru(e,t,i.children,r),t=t.child}return t;case 9:return i=t.type,n=t.pendingProps.children,kw(t,r),i=xd(i),n=n(i),t.flags|=1,Ru(e,t,n,r),t.child;case 14:return n=t.type,i=Cp(n,t.pendingProps),i=Cp(n.type,i),Dne(e,t,n,i,r);case 15:return hae(e,t,t.type,t.pendingProps,r);case 17:return n=t.type,i=t.pendingProps,i=t.elementType===n?i:Cp(n,i),Lj(e,t),t.tag=1,vc(n)?(e=!0,tN(t)):e=!1,kw(t,r),Wie(t,n,i),Cz(t,n,i,r),Mz(null,t,n,!0,e,r);case 19:return bae(e,t,r);case 22:return Aae(e,t,r)}throw Error(xt(156,t.tag))};function Iae(e,t){return lie(e,t)}function j5e(e,t,r,n){this.tag=e,this.key=r,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=n,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function yd(e,t,r,n){return new j5e(e,t,r,n)}function CU(e){return e=e.prototype,!(!e||!e.isReactComponent)}function N5e(e){if(typeof e=="function")return CU(e)?1:0;if(e!=null){if(e=e.$$typeof,e===Hz)return 11;if(e===Vz)return 14}return 2}function M0(e,t){var r=e.alternate;return r===null?(r=yd(e.tag,t,e.key,e.mode),r.elementType=e.elementType,r.type=e.type,r.stateNode=e.stateNode,r.alternate=e,e.alternate=r):(r.pendingProps=t,r.type=e.type,r.flags=0,r.subtreeFlags=0,r.deletions=null),r.flags=e.flags&14680064,r.childLanes=e.childLanes,r.lanes=e.lanes,r.child=e.child,r.memoizedProps=e.memoizedProps,r.memoizedState=e.memoizedState,r.updateQueue=e.updateQueue,t=e.dependencies,r.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},r.sibling=e.sibling,r.index=e.index,r.ref=e.ref,r}function Wj(e,t,r,n,i,a){var o=2;if(n=e,typeof e=="function")CU(e)&&(o=1);else if(typeof e=="string")o=5;else e:switch(e){case cw:return ey(r.children,i,a,t);case Wz:o=8,i|=8;break;case ZL:return e=yd(12,r,t,i|2),e.elementType=ZL,e.lanes=a,e;case XL:return e=yd(13,r,t,i),e.elementType=XL,e.lanes=a,e;case KL:return e=yd(19,r,t,i),e.elementType=KL,e.lanes=a,e;case Hne:return kN(r,i,a,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case Une:o=10;break e;case Wne:o=9;break e;case Hz:o=11;break e;case Vz:o=14;break e;case A0:o=16,n=null;break e}throw Error(xt(130,e==null?e:typeof e,""))}return t=yd(o,r,t,i),t.elementType=e,t.type=n,t.lanes=a,t}function ey(e,t,r,n){return e=yd(7,e,n,t),e.lanes=r,e}function kN(e,t,r,n){return e=yd(22,e,n,t),e.elementType=Hne,e.lanes=r,e.stateNode={isHidden:!1},e}function GL(e,t,r){return e=yd(6,e,null,t),e.lanes=r,e}function QL(e,t,r){return t=yd(4,e.children!==null?e.children:[],e.key,t),t.lanes=r,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function T5e(e,t,r,n,i){this.tag=t,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=NL(0),this.expirationTimes=NL(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=NL(0),this.identifierPrefix=n,this.onRecoverableError=i,this.mutableSourceEagerHydrationData=null}function DU(e,t,r,n,i,a,o,s,l){return e=new T5e(e,t,r,s,l),t===1?(t=1,a===!0&&(t|=8)):t=0,a=yd(3,null,null,t),e.current=a,a.stateNode=e,a.memoizedState={element:n,isDehydrated:r,cache:null,transitions:null,pendingSuspenseBoundaries:null},cU(a),e}function F5e(e,t,r){var n=3{"use strict";function Lae(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(Lae)}catch(e){console.error(e)}}Lae(),zae.exports=qae()});var sT=vn((ZU,XU)=>{(function(e,t){typeof ZU=="object"&&typeof XU<"u"?XU.exports=t():typeof define=="function"&&define.amd?define(t):(e=typeof globalThis<"u"?globalThis:e||self,e["'typed'"]=t())})(ZU,function(){"use strict";function e(){return!0}function t(){return!1}function r(){}let n="Argument is not a typed-function.";function i(){function o(we){return typeof we=="object"&&we!==null&&we.constructor===Object}let s=[{name:"number",test:function(we){return typeof we=="number"}},{name:"string",test:function(we){return typeof we=="string"}},{name:"boolean",test:function(we){return typeof we=="boolean"}},{name:"Function",test:function(we){return typeof we=="function"}},{name:"Array",test:Array.isArray},{name:"Date",test:function(we){return we instanceof Date}},{name:"RegExp",test:function(we){return we instanceof RegExp}},{name:"Object",test:o},{name:"null",test:function(we){return we===null}},{name:"undefined",test:function(we){return we===void 0}}],l={name:"any",test:e,isAny:!0},u,c,f=0,d={createCount:0};function p(we){let Be=u.get(we);if(Be)return Be;let Le='Unknown type "'+we+'"',Ze=we.toLowerCase(),He;for(He of c)if(He.toLowerCase()===Ze){Le+='. Did you mean "'+He+'" ?';break}throw new TypeError(Le)}function h(we){let Be=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"any",Le=Be?p(Be).index:c.length,Ze=[];for(let Qe=0;Qe{let Ze=u.get(Le);return!Ze.isAny&&Ze.test(we)});return Be.length?Be:["any"]}function b(we){return we&&typeof we=="function"&&"_typedFunctionData"in we}function v(we,Be,Le){if(!b(we))throw new TypeError(n);let Ze=Le&&Le.exact,He=Array.isArray(Be)?Be.join(","):Be,Qe=C(He),et=S(Qe);if(!Ze||et in we.signatures){let Pe=we._typedFunctionData.signatureMap.get(et);if(Pe)return Pe}let Ge=Qe.length,G;if(Ze){G=[];let Pe;for(Pe in we.signatures)G.push(we._typedFunctionData.signatureMap.get(Pe))}else G=we._typedFunctionData.signatures;for(let Pe=0;Pe!Wr.has(en.name)))continue}at.push(ht)}}if(G=at,G.length===0)break}let ue;for(ue of G)if(ue.params.length<=Ge)return ue;throw new TypeError("Signature not found (signature: "+(we.name||"unnamed")+"("+S(Qe,", ")+"))")}function x(we,Be,Le){return v(we,Be,Le).implementation}function w(we,Be){let Le=p(Be);if(Le.test(we))return we;let Ze=Le.conversionsTo;if(Ze.length===0)throw new Error("There are no conversions to "+Be+" defined.");for(let He=0;He1&&arguments[1]!==void 0?arguments[1]:",";return we.map(Le=>Le.name).join(Be)}function k(we){let Be=we.indexOf("...")===0,Ze=(Be?we.length>3?we.slice(3):"any":we).split("|").map(Ge=>p(Ge.trim())),He=!1,Qe=Be?"...":"";return{types:Ze.map(function(Ge){return He=Ge.isAny||He,Qe+=Ge.name+"|",{name:Ge.name,typeIndex:Ge.index,test:Ge.test,isAny:Ge.isAny,conversion:null,conversionIndex:-1}}),name:Qe.slice(0,-1),hasAny:He,hasConversion:!1,restParam:Be}}function j(we){let Be=we.types.map(et=>et.name),Le=Q(Be),Ze=we.hasAny,He=we.name,Qe=Le.map(function(et){let Ge=p(et.from);return Ze=Ge.isAny||Ze,He+="|"+et.from,{name:et.from,typeIndex:Ge.index,test:Ge.test,isAny:Ge.isAny,conversion:et,conversionIndex:et.index}});return{types:we.types.concat(Qe),name:He,hasAny:Ze,hasConversion:Qe.length>0,restParam:we.restParam}}function O(we){return we.typeSet||(we.typeSet=new Set,we.types.forEach(Be=>we.typeSet.add(Be.name))),we.typeSet}function C(we){let Be=[];if(typeof we!="string")throw new TypeError("Signatures must be strings");let Le=we.trim();if(Le==="")return Be;let Ze=Le.split(",");for(let He=0;He=He+1}}else return we.length===0?function(Qe){return Qe.length===0}:we.length===1?(Le=D(we[0]),function(Qe){return Le(Qe[0])&&Qe.length===1}):we.length===2?(Le=D(we[0]),Ze=D(we[1]),function(Qe){return Le(Qe[0])&&Ze(Qe[1])&&Qe.length===2}):(Be=we.map(D),function(Qe){for(let et=0;et{let He=z(Ze.params,Be),Qe;for(Qe of He)Le.add(Qe)}),Le.has("any")?["any"]:Array.from(Le)}function L(we,Be,Le){let Ze,He,Qe=we||"unnamed",et=Le,Ge;for(Ge=0;Ge{let ht=q(at.params,Ge),Zt=D(ht);(Ge0){let at=A(Be[Ge]);return Ze=new TypeError("Unexpected type of argument in function "+Qe+" (expected: "+He.join(" or ")+", actual: "+at.join(" | ")+", index: "+Ge+")"),Ze.data={category:"wrongType",fn:Qe,index:Ge,actual:at,expected:He},Ze}}else et=De}let G=et.map(function(De){return N(De.params)?1/0:De.params.length});if(Be.lengthue)return Ze=new TypeError("Too many arguments in function "+Qe+" (expected: "+ue+", actual: "+Be.length+")"),Ze.data={category:"tooManyArgs",fn:Qe,index:Be.length,expectedLength:ue},Ze;let Pe=[];for(let De=0;De0)return 1;let Ze=Y(we)-Y(Be);return Ze<0?-1:Ze>0?1:0}function te(we,Be){let Le=we.params,Ze=Be.params,He=U(Le),Qe=U(Ze),et=N(Le),Ge=N(Ze);if(et&&He.hasAny){if(!Ge||!Qe.hasAny)return 1}else if(Ge&&Qe.hasAny)return-1;let G=0,ue=0,Pe;for(Pe of Le)Pe.hasAny&&++G,Pe.hasConversion&&++ue;let De=0,at=0;for(Pe of Ze)Pe.hasAny&&++De,Pe.hasConversion&&++at;if(G!==De)return G-De;if(et&&He.hasConversion){if(!Ge||!Qe.hasConversion)return 1}else if(Ge&&Qe.hasConversion)return-1;if(ue!==at)return ue-at;if(et){if(!Ge)return 1}else if(Ge)return-1;let ht=(Le.length-Ze.length)*(et?-1:1);if(ht!==0)return ht;let Zt=[],Wr=0;for(let tn=0;tn1&&Be.sort((He,Qe)=>He.index-Qe.index);let Le=Be[0].conversionsTo;if(we.length===1)return Le;Le=Le.concat([]);let Ze=new Set(we);for(let He=1;HeHe.hasConversion)){let He=N(we),Qe=we.map(Ie);Le=function(){let Ge=[],G=He?arguments.length-1:arguments.length;for(let ue=0;ueG.name).join("|"),hasAny:Ge.some(G=>G.isAny),hasConversion:!1,restParam:!0}),et.push(Qe)}else et=Qe.types.map(function(Ge){return{types:[Ge],name:Ge.name,hasAny:Ge.isAny,hasConversion:Ge.conversion,restParam:!1}});return ee(et,function(Ge){return Be(Le,Ze+1,He.concat([Ge]))})}else return[He]}return Be(we,0,[])}function Oe(we,Be){let Le=Math.max(we.length,Be.length);for(let Ge=0;Ge=Ze:et?Ze>=He:Ze===He}function ve(we){return we.map(Be=>_e(Be)?Ee(Be.referToSelf.callback):Ce(Be)?re(Be.referTo.references,Be.referTo.callback):Be)}function ye(we,Be,Le){let Ze=[],He;for(He of we){let Qe=Le[He];if(typeof Qe!="number")throw new TypeError('No definition for referenced signature "'+He+'"');if(Qe=Be[Qe],typeof Qe!="function")return!1;Ze.push(Qe)}return Ze}function me(we,Be,Le){let Ze=ve(we),He=new Array(Ze.length).fill(!1),Qe=!0;for(;Qe;){Qe=!1;let et=!0;for(let Ge=0;Ge{let Ze=we[Le];if(Be.test(Ze.toString()))throw new SyntaxError("Using `this` to self-reference a function is deprecated since typed-function@3. Use typed.referTo and typed.referToSelf instead.")})}function $(we,Be){if(d.createCount++,Object.keys(Be).length===0)throw new SyntaxError("No signatures provided");d.warnAgainstDeprecatedThis&&ke(Be);let Le=[],Ze=[],He={},Qe=[],et;for(et in Be){if(!Object.prototype.hasOwnProperty.call(Be,et))continue;let kn=C(et);if(!kn)continue;Le.forEach(function(sl){if(Oe(sl,kn))throw new TypeError('Conflicting signatures "'+S(sl)+'" and "'+S(kn)+'".')}),Le.push(kn);let Ia=Ze.length;Ze.push(Be[et]);let Qh=kn.map(j),Cn;for(Cn of Se(Qh)){let sl=S(Cn);Qe.push({params:Cn,name:sl,fn:Ia}),Cn.every(sp=>!sp.hasConversion)&&(He[sl]=Ia)}}Qe.sort(te);let Ge=me(Ze,He,Vf),G;for(G in He)Object.prototype.hasOwnProperty.call(He,G)&&(He[G]=Ge[He[G]]);let ue=[],Pe=new Map;for(G of Qe)Pe.has(G.name)||(G.fn=Ge[G.fn],ue.push(G),Pe.set(G.name,G));let De=ue[0]&&ue[0].params.length<=2&&!N(ue[0].params),at=ue[1]&&ue[1].params.length<=2&&!N(ue[1].params),ht=ue[2]&&ue[2].params.length<=2&&!N(ue[2].params),Zt=ue[3]&&ue[3].params.length<=2&&!N(ue[3].params),Wr=ue[4]&&ue[4].params.length<=2&&!N(ue[4].params),en=ue[5]&&ue[5].params.length<=2&&!N(ue[5].params),tn=De&&at&&ht&&Zt&&Wr&&en;for(let kn=0;knkn.test),Og=ue.map(kn=>kn.implementation),Gh=function(){for(let Ia=Dg;IaS(C(Le))),Be=U(arguments);if(typeof Be!="function")throw new TypeError("Callback function expected as last argument");return re(we,Be)}function re(we,Be){return{referTo:{references:we,callback:Be}}}function Ee(we){if(typeof we!="function")throw new TypeError("Callback function expected as first argument");return{referToSelf:{callback:we}}}function Ce(we){return we&&typeof we.referTo=="object"&&Array.isArray(we.referTo.references)&&typeof we.referTo.callback=="function"}function _e(we){return we&&typeof we.referToSelf=="object"&&typeof we.referToSelf.callback=="function"}function he(we,Be){if(!we)return Be;if(Be&&Be!==we){let Le=new Error("Function names do not match (expected: "+we+", actual: "+Be+")");throw Le.data={actual:Be,expected:we},Le}return we}function ze(we){let Be;for(let Le in we)Object.prototype.hasOwnProperty.call(we,Le)&&(b(we[Le])||typeof we[Le].signature=="string")&&(Be=he(Be,we[Le].name));return Be}function Ye(we,Be){let Le;for(Le in Be)if(Object.prototype.hasOwnProperty.call(Be,Le)){if(Le in we&&Be[Le]!==we[Le]){let Ze=new Error('Signature "'+Le+'" is defined twice');throw Ze.data={signature:Le,sourceFunction:Be[Le],destFunction:we[Le]},Ze}we[Le]=Be[Le]}}let tt=d;d=function(we){let Be=typeof we=="string",Le=Be?1:0,Ze=Be?we:"",He={};for(let Qe=Le;QeHe.from===we.from);if(!Le)throw new Error("Attempt to remove nonexistent conversion from "+we.from+" to "+we.to);if(Le.convert!==we.convert)throw new Error("Conversion to remove does not match existing conversion");let Ze=Be.conversionsTo.indexOf(Le);Be.conversionsTo.splice(Ze,1)},d.resolve=function(we,Be){if(!b(we))throw new TypeError(n);let Le=we._typedFunctionData.signatures;for(let Ze=0;Ze{(function(e){"use strict";var t=Math.cosh||function(u){return Math.abs(u)<1e-9?1-u:(Math.exp(u)+Math.exp(-u))*.5},r=Math.sinh||function(u){return Math.abs(u)<1e-9?u:(Math.exp(u)-Math.exp(-u))*.5},n=function(u){var c=Math.PI/4;if(-c>u||u>c)return Math.cos(u)-1;var f=u*u;return f*(f*(f*(f*(f*(f*(f*(f/20922789888e3-1/87178291200)+1/479001600)-1/3628800)+1/40320)-1/720)+1/24)-1/2)},i=function(u,c){var f=Math.abs(u),d=Math.abs(c);return f<3e3&&d<3e3?Math.sqrt(f*f+d*d):(f0&&a();break;case"number":f.im=0,f.re=u;break;default:a()}return isNaN(f.re)||isNaN(f.im),f};function l(u,c){if(!(this instanceof l))return new l(u,c);var f=s(u,c);this.re=f.re,this.im=f.im}l.prototype={re:0,im:0,sign:function(){var u=this.abs();return new l(this.re/u,this.im/u)},add:function(u,c){var f=new l(u,c);return this.isInfinite()&&f.isInfinite()?l.NAN:this.isInfinite()||f.isInfinite()?l.INFINITY:new l(this.re+f.re,this.im+f.im)},sub:function(u,c){var f=new l(u,c);return this.isInfinite()&&f.isInfinite()?l.NAN:this.isInfinite()||f.isInfinite()?l.INFINITY:new l(this.re-f.re,this.im-f.im)},mul:function(u,c){var f=new l(u,c);return this.isInfinite()&&f.isZero()||this.isZero()&&f.isInfinite()?l.NAN:this.isInfinite()||f.isInfinite()?l.INFINITY:f.im===0&&this.im===0?new l(this.re*f.re,0):new l(this.re*f.re-this.im*f.im,this.re*f.im+this.im*f.re)},div:function(u,c){var f=new l(u,c);if(this.isZero()&&f.isZero()||this.isInfinite()&&f.isInfinite())return l.NAN;if(this.isInfinite()||f.isZero())return l.INFINITY;if(this.isZero()||f.isInfinite())return l.ZERO;u=this.re,c=this.im;var d=f.re,p=f.im,h,m;return p===0?new l(u/d,c/d):Math.abs(d)0)return new l(Math.pow(u,f.re),0);if(u===0)switch((f.re%4+4)%4){case 0:return new l(Math.pow(c,f.re),0);case 1:return new l(0,Math.pow(c,f.re));case 2:return new l(-Math.pow(c,f.re),0);case 3:return new l(0,-Math.pow(c,f.re))}}if(u===0&&c===0&&f.re>0&&f.im>=0)return l.ZERO;var d=Math.atan2(c,u),p=o(u,c);return u=Math.exp(f.re*p-f.im*d),c=f.im*p+f.re*d,new l(u*Math.cos(c),u*Math.sin(c))},sqrt:function(){var u=this.re,c=this.im,f=this.abs(),d,p;if(u>=0){if(c===0)return new l(Math.sqrt(u),0);d=.5*Math.sqrt(2*(f+u))}else d=Math.abs(c)/Math.sqrt(2*(f-u));return u<=0?p=.5*Math.sqrt(2*(f-u)):p=Math.abs(c)/Math.sqrt(2*(f+u)),new l(d,c<0?-p:p)},exp:function(){var u=Math.exp(this.re);return this.im,new l(u*Math.cos(this.im),u*Math.sin(this.im))},expm1:function(){var u=this.re,c=this.im;return new l(Math.expm1(u)*Math.cos(c)+n(c),Math.exp(u)*Math.sin(c))},log:function(){var u=this.re,c=this.im;return c===0&&u>0,new l(o(u,c),Math.atan2(c,u))},abs:function(){return i(this.re,this.im)},arg:function(){return Math.atan2(this.im,this.re)},sin:function(){var u=this.re,c=this.im;return new l(Math.sin(u)*t(c),Math.cos(u)*r(c))},cos:function(){var u=this.re,c=this.im;return new l(Math.cos(u)*t(c),-Math.sin(u)*r(c))},tan:function(){var u=2*this.re,c=2*this.im,f=Math.cos(u)+t(c);return new l(Math.sin(u)/f,r(c)/f)},cot:function(){var u=2*this.re,c=2*this.im,f=Math.cos(u)-t(c);return new l(-Math.sin(u)/f,r(c)/f)},sec:function(){var u=this.re,c=this.im,f=.5*t(2*c)+.5*Math.cos(2*u);return new l(Math.cos(u)*t(c)/f,Math.sin(u)*r(c)/f)},csc:function(){var u=this.re,c=this.im,f=.5*t(2*c)-.5*Math.cos(2*u);return new l(Math.sin(u)*t(c)/f,-Math.cos(u)*r(c)/f)},asin:function(){var u=this.re,c=this.im,f=new l(c*c-u*u+1,-2*u*c).sqrt(),d=new l(f.re-c,f.im+u).log();return new l(d.im,-d.re)},acos:function(){var u=this.re,c=this.im,f=new l(c*c-u*u+1,-2*u*c).sqrt(),d=new l(f.re-c,f.im+u).log();return new l(Math.PI/2-d.im,d.re)},atan:function(){var u=this.re,c=this.im;if(u===0){if(c===1)return new l(0,1/0);if(c===-1)return new l(0,-1/0)}var f=u*u+(1-c)*(1-c),d=new l((1-c*c-u*u)/f,-2*u/f).log();return new l(-.5*d.im,.5*d.re)},acot:function(){var u=this.re,c=this.im;if(c===0)return new l(Math.atan2(1,u),0);var f=u*u+c*c;return f!==0?new l(u/f,-c/f).atan():new l(u!==0?u/0:0,c!==0?-c/0:0).atan()},asec:function(){var u=this.re,c=this.im;if(u===0&&c===0)return new l(0,1/0);var f=u*u+c*c;return f!==0?new l(u/f,-c/f).acos():new l(u!==0?u/0:0,c!==0?-c/0:0).acos()},acsc:function(){var u=this.re,c=this.im;if(u===0&&c===0)return new l(Math.PI/2,1/0);var f=u*u+c*c;return f!==0?new l(u/f,-c/f).asin():new l(u!==0?u/0:0,c!==0?-c/0:0).asin()},sinh:function(){var u=this.re,c=this.im;return new l(r(u)*Math.cos(c),t(u)*Math.sin(c))},cosh:function(){var u=this.re,c=this.im;return new l(t(u)*Math.cos(c),r(u)*Math.sin(c))},tanh:function(){var u=2*this.re,c=2*this.im,f=t(u)+Math.cos(c);return new l(r(u)/f,Math.sin(c)/f)},coth:function(){var u=2*this.re,c=2*this.im,f=t(u)-Math.cos(c);return new l(r(u)/f,-Math.sin(c)/f)},csch:function(){var u=this.re,c=this.im,f=Math.cos(2*c)-t(2*u);return new l(-2*r(u)*Math.cos(c)/f,2*t(u)*Math.sin(c)/f)},sech:function(){var u=this.re,c=this.im,f=Math.cos(2*c)+t(2*u);return new l(2*t(u)*Math.cos(c)/f,-2*r(u)*Math.sin(c)/f)},asinh:function(){var u=this.im;this.im=-this.re,this.re=u;var c=this.asin();return this.re=-this.im,this.im=u,u=c.re,c.re=-c.im,c.im=u,c},acosh:function(){var u=this.acos();if(u.im<=0){var c=u.re;u.re=-u.im,u.im=c}else{var c=u.im;u.im=-u.re,u.re=c}return u},atanh:function(){var u=this.re,c=this.im,f=u>1&&c===0,d=1-u,p=1+u,h=d*d+c*c,m=h!==0?new l((p*d-c*c)/h,(c*d+p*c)/h):new l(u!==-1?u/0:0,c!==0?c/0:0),g=m.re;return m.re=o(m.re,m.im)/2,m.im=Math.atan2(m.im,g)/2,f&&(m.im=-m.im),m},acoth:function(){var u=this.re,c=this.im;if(u===0&&c===0)return new l(0,Math.PI/2);var f=u*u+c*c;return f!==0?new l(u/f,-c/f).atanh():new l(u!==0?u/0:0,c!==0?-c/0:0).atanh()},acsch:function(){var u=this.re,c=this.im;if(c===0)return new l(u!==0?Math.log(u+Math.sqrt(u*u+1)):1/0,0);var f=u*u+c*c;return f!==0?new l(u/f,-c/f).asinh():new l(u!==0?u/0:0,c!==0?-c/0:0).asinh()},asech:function(){var u=this.re,c=this.im;if(this.isZero())return l.INFINITY;var f=u*u+c*c;return f!==0?new l(u/f,-c/f).acosh():new l(u!==0?u/0:0,c!==0?-c/0:0).acosh()},inverse:function(){if(this.isZero())return l.INFINITY;if(this.isInfinite())return l.ZERO;var u=this.re,c=this.im,f=u*u+c*c;return new l(u/f,-c/f)},conjugate:function(){return new l(this.re,-this.im)},neg:function(){return new l(-this.re,-this.im)},ceil:function(u){return u=Math.pow(10,u||0),new l(Math.ceil(this.re*u)/u,Math.ceil(this.im*u)/u)},floor:function(u){return u=Math.pow(10,u||0),new l(Math.floor(this.re*u)/u,Math.floor(this.im*u)/u)},round:function(u){return u=Math.pow(10,u||0),new l(Math.round(this.re*u)/u,Math.round(this.im*u)/u)},equals:function(u,c){var f=new l(u,c);return Math.abs(f.re-this.re)<=l.EPSILON&&Math.abs(f.im-this.im)<=l.EPSILON},clone:function(){return new l(this.re,this.im)},toString:function(){var u=this.re,c=this.im,f="";return this.isNaN()?"NaN":this.isInfinite()?"Infinity":(Math.abs(u){(function(e){"use strict";var t=2e3,r={s:1,n:0,d:1};function n(m,g){if(isNaN(m=parseInt(m,10)))throw p();return m*g}function i(m,g){if(g===0)throw d();var A=Object.create(f.prototype);A.s=m<0?-1:1,m=m<0?-m:m;var b=c(m,g);return A.n=m/b,A.d=g/b,A}function a(m){for(var g={},A=m,b=2,v=4;v<=A;){for(;A%b===0;)A/=b,g[b]=(g[b]||0)+1;v+=1+2*b++}return A!==m?A>1&&(g[A]=(g[A]||0)+1):g[m]=(g[m]||0)+1,g}var o=function(m,g){var A=0,b=1,v=1,x=0,w=0,S=0,k=1,j=1,O=0,C=1,N=1,D=1,P=1e7,q;if(m!=null)if(g!==void 0){if(A=m,b=g,v=A*b,A%1!==0||b%1!==0)throw h()}else switch(typeof m){case"object":{if("d"in m&&"n"in m)A=m.n,b=m.d,"s"in m&&(A*=m.s);else if(0 in m)A=m[0],1 in m&&(b=m[1]);else throw p();v=A*b;break}case"number":{if(m<0&&(v=m,m=-m),m%1===0)A=m;else if(m>0){for(m>=1&&(j=Math.pow(10,Math.floor(1+Math.log(m)/Math.LN10)),m/=j);C<=P&&D<=P;)if(q=(O+N)/(C+D),m===q){C+D<=P?(A=O+N,b=C+D):D>C?(A=N,b=D):(A=O,b=C);break}else m>q?(O+=N,C+=D):(N+=O,D+=C),C>P?(A=N,b=D):(A=O,b=C);A*=j}else(isNaN(m)||isNaN(g))&&(b=A=NaN);break}case"string":{if(C=m.match(/\d+|./g),C===null)throw p();if(C[O]==="-"?(v=-1,O++):C[O]==="+"&&O++,C.length===O+1?w=n(C[O++],v):C[O+1]==="."||C[O]==="."?(C[O]!=="."&&(x=n(C[O++],v)),O++,(O+1===C.length||C[O+1]==="("&&C[O+3]===")"||C[O+1]==="'"&&C[O+3]==="'")&&(w=n(C[O],v),k=Math.pow(10,C[O].length),O++),(C[O]==="("&&C[O+2]===")"||C[O]==="'"&&C[O+2]==="'")&&(S=n(C[O+1],v),j=Math.pow(10,C[O+1].length)-1,O+=3)):C[O+1]==="/"||C[O+1]===":"?(w=n(C[O],v),k=n(C[O+2],1),O+=3):C[O+3]==="/"&&C[O+1]===" "&&(x=n(C[O],v),w=n(C[O+2],v),k=n(C[O+4],1),O+=5),C.length<=O){b=k*j,v=A=S+b*x+j*w;break}}default:throw p()}if(b===0)throw d();r.s=v<0?-1:1,r.n=Math.abs(A),r.d=Math.abs(b)};function s(m,g,A){for(var b=1;g>0;m=m*m%A,g>>=1)g&1&&(b=b*m%A);return b}function l(m,g){for(;g%2===0;g/=2);for(;g%5===0;g/=5);if(g===1)return 0;for(var A=10%g,b=1;A!==1;b++)if(A=A*10%g,b>t)return 0;return b}function u(m,g,A){for(var b=1,v=s(10,A,g),x=0;x<300;x++){if(b===v)return x;b=b*10%g,v=v*10%g}return 0}function c(m,g){if(!m)return g;if(!g)return m;for(;;){if(m%=g,!m)return g;if(g%=m,!g)return m}}function f(m,g){if(o(m,g),this instanceof f)m=c(r.d,r.n),this.s=r.s,this.n=r.n/m,this.d=r.d/m;else return i(r.s*r.n,r.d)}var d=function(){return new Error("Division by Zero")},p=function(){return new Error("Invalid argument")},h=function(){return new Error("Parameters must be integer")};f.prototype={s:1,n:0,d:1,abs:function(){return i(this.n,this.d)},neg:function(){return i(-this.s*this.n,this.d)},add:function(m,g){return o(m,g),i(this.s*this.n*r.d+r.s*this.d*r.n,this.d*r.d)},sub:function(m,g){return o(m,g),i(this.s*this.n*r.d-r.s*this.d*r.n,this.d*r.d)},mul:function(m,g){return o(m,g),i(this.s*r.s*this.n*r.n,this.d*r.d)},div:function(m,g){return o(m,g),i(this.s*r.s*this.n*r.d,this.d*r.n)},clone:function(){return i(this.s*this.n,this.d)},mod:function(m,g){if(isNaN(this.n)||isNaN(this.d))return new f(NaN);if(m===void 0)return i(this.s*this.n%this.d,1);if(o(m,g),r.n===0&&this.d===0)throw d();return i(this.s*(r.d*this.n)%(r.n*this.d),r.d*this.d)},gcd:function(m,g){return o(m,g),i(c(r.n,this.n)*c(r.d,this.d),r.d*this.d)},lcm:function(m,g){return o(m,g),r.n===0&&this.n===0?i(0,1):i(r.n*this.n,c(r.n,this.n)*c(r.d,this.d))},ceil:function(m){return m=Math.pow(10,m||0),isNaN(this.n)||isNaN(this.d)?new f(NaN):i(Math.ceil(m*this.s*this.n/this.d),m)},floor:function(m){return m=Math.pow(10,m||0),isNaN(this.n)||isNaN(this.d)?new f(NaN):i(Math.floor(m*this.s*this.n/this.d),m)},round:function(m){return m=Math.pow(10,m||0),isNaN(this.n)||isNaN(this.d)?new f(NaN):i(Math.round(m*this.s*this.n/this.d),m)},inverse:function(){return i(this.s*this.d,this.n)},pow:function(m,g){if(o(m,g),r.d===1)return r.s<0?i(Math.pow(this.s*this.d,r.n),Math.pow(this.n,r.n)):i(Math.pow(this.s*this.n,r.n),Math.pow(this.d,r.n));if(this.s<0)return null;var A=a(this.n),b=a(this.d),v=1,x=1;for(var w in A)if(w!=="1"){if(w==="0"){v=0;break}if(A[w]*=r.n,A[w]%r.d===0)A[w]/=r.d;else return null;v*=Math.pow(w,A[w])}for(var w in b)if(w!=="1"){if(b[w]*=r.n,b[w]%r.d===0)b[w]/=r.d;else return null;x*=Math.pow(w,b[w])}return r.s<0?i(x,v):i(v,x)},equals:function(m,g){return o(m,g),this.s*this.n*r.d===r.s*r.n*this.d},compare:function(m,g){o(m,g);var A=this.s*this.n*r.d-r.s*r.n*this.d;return(0=0;x--)v=v.inverse().add(A[x]);if(Math.abs(v.sub(g).valueOf())0&&(A+=g,A+=" ",b%=v),A+=b,A+="/",A+=v),A},toLatex:function(m){var g,A="",b=this.n,v=this.d;return this.s<0&&(A+="-"),v===1?A+=b:(m&&(g=Math.floor(b/v))>0&&(A+=g,b%=v),A+="\\frac{",A+=b,A+="}{",A+=v,A+="}"),A},toContinued:function(){var m,g=this.n,A=this.d,b=[];if(isNaN(g)||isNaN(A))return b;do b.push(Math.floor(g/A)),m=g%A,g=A,A=m;while(g!==1);return b},toString:function(m){var g=this.n,A=this.d;if(isNaN(g)||isNaN(A))return"NaN";m=m||15;var b=l(g,A),v=u(g,A,b),x=this.s<0?"-":"";if(x+=g/A|0,g%=A,g*=10,g&&(x+="."),b){for(var w=v;w--;)x+=g/A|0,g%=A,g*=10;x+="(";for(var w=b;w--;)x+=g/A|0,g%=A,g*=10;x+=")"}else for(var w=m;g&&w--;)x+=g/A|0,g%=A,g*=10;return x}},typeof bW=="object"?(Object.defineProperty(f,"__esModule",{value:!0}),f.default=f,f.Fraction=f,Hse.exports=f):e.Fraction=f})(bW)});var sce=vn((akt,oce)=>{oce.exports=function e(t,r){"use strict";var n=/(^([+\-]?(?:0|[1-9]\d*)(?:\.\d*)?(?:[eE][+\-]?\d+)?)?$|^0x[0-9a-f]+$|\d+)/gi,i=/(^[ ]*|[ ]*$)/g,a=/(^([\w ]+,?[\w ]+)?[\w ]+,?[\w ]+\d+:\d+(:\d+)?[\w ]?|^\d{1,4}[\/\-]\d{1,4}[\/\-]\d{1,4}|^\w+, \w+ \d+, \d{4})/,o=/^0x[0-9a-f]+$/i,s=/^0/,l=function(v){return e.insensitive&&(""+v).toLowerCase()||""+v},u=l(t).replace(i,"")||"",c=l(r).replace(i,"")||"",f=u.replace(n,"\0$1\0").replace(/\0$/,"").replace(/^\0/,"").split("\0"),d=c.replace(n,"\0$1\0").replace(/\0$/,"").replace(/^\0/,"").split("\0"),p=parseInt(u.match(o),16)||f.length!==1&&u.match(a)&&Date.parse(u),h=parseInt(c.match(o),16)||p&&c.match(a)&&Date.parse(c)||null,m,g;if(h){if(ph)return 1}for(var A=0,b=Math.max(f.length,d.length);Ag)return 1}return 0}});var cfe=vn((wMt,ufe)=>{"use strict";var kH=Object.assign||function(e){for(var t=1;t1&&arguments[1]!==void 0?arguments[1]:{},r=t.preserveFormatting,n=r===void 0?!1:r,i=t.escapeMapFn,a=i===void 0?iUe:i,o=String(e),s="",l=a(kH({},rUe),n?kH({},nUe):{}),u=Object.keys(l),c=function(){var d=!1;u.forEach(function(p,h){d||o.length>=p.length&&o.slice(0,p.length)===p&&(s+=l[u[h]],o=o.slice(p.length,o.length),d=!0)}),d||(s+=o.slice(0,1),o=o.slice(1,o.length))};o;)c();return s}});var qAe=vn(($Ae,FH)=>{(function(e,t,r){function n(s){var l=this,u=o();l.next=function(){var c=2091639*l.s0+l.c*23283064365386963e-26;return l.s0=l.s1,l.s1=l.s2,l.s2=c-(l.c=c|0)},l.c=1,l.s0=u(" "),l.s1=u(" "),l.s2=u(" "),l.s0-=u(s),l.s0<0&&(l.s0+=1),l.s1-=u(s),l.s1<0&&(l.s1+=1),l.s2-=u(s),l.s2<0&&(l.s2+=1),u=null}function i(s,l){return l.c=s.c,l.s0=s.s0,l.s1=s.s1,l.s2=s.s2,l}function a(s,l){var u=new n(s),c=l&&l.state,f=u.next;return f.int32=function(){return u.next()*4294967296|0},f.double=function(){return f()+(f()*2097152|0)*11102230246251565e-32},f.quick=f,c&&(typeof c=="object"&&i(c,u),f.state=function(){return i(u,{})}),f}function o(){var s=4022871197,l=function(u){u=String(u);for(var c=0;c>>0,f-=s,f*=s,s=f>>>0,f-=s,s+=f*4294967296}return(s>>>0)*23283064365386963e-26};return l}t&&t.exports?t.exports=a:r&&r.amd?r(function(){return a}):this.alea=a})($Ae,typeof FH=="object"&&FH,typeof define=="function"&&define)});var zAe=vn((LAe,_H)=>{(function(e,t,r){function n(o){var s=this,l="";s.x=0,s.y=0,s.z=0,s.w=0,s.next=function(){var c=s.x^s.x<<11;return s.x=s.y,s.y=s.z,s.z=s.w,s.w^=s.w>>>19^c^c>>>8},o===(o|0)?s.x=o:l+=o;for(var u=0;u>>0)/4294967296};return c.double=function(){do var f=l.next()>>>11,d=(l.next()>>>0)/4294967296,p=(f+d)/(1<<21);while(p===0);return p},c.int32=l.next,c.quick=c,u&&(typeof u=="object"&&i(u,l),c.state=function(){return i(l,{})}),c}t&&t.exports?t.exports=a:r&&r.amd?r(function(){return a}):this.xor128=a})(LAe,typeof _H=="object"&&_H,typeof define=="function"&&define)});var WAe=vn((UAe,PH)=>{(function(e,t,r){function n(o){var s=this,l="";s.next=function(){var c=s.x^s.x>>>2;return s.x=s.y,s.y=s.z,s.z=s.w,s.w=s.v,(s.d=s.d+362437|0)+(s.v=s.v^s.v<<4^(c^c<<1))|0},s.x=0,s.y=0,s.z=0,s.w=0,s.v=0,o===(o|0)?s.x=o:l+=o;for(var u=0;u>>4),s.next()}function i(o,s){return s.x=o.x,s.y=o.y,s.z=o.z,s.w=o.w,s.v=o.v,s.d=o.d,s}function a(o,s){var l=new n(o),u=s&&s.state,c=function(){return(l.next()>>>0)/4294967296};return c.double=function(){do var f=l.next()>>>11,d=(l.next()>>>0)/4294967296,p=(f+d)/(1<<21);while(p===0);return p},c.int32=l.next,c.quick=c,u&&(typeof u=="object"&&i(u,l),c.state=function(){return i(l,{})}),c}t&&t.exports?t.exports=a:r&&r.amd?r(function(){return a}):this.xorwow=a})(UAe,typeof PH=="object"&&PH,typeof define=="function"&&define)});var VAe=vn((HAe,IH)=>{(function(e,t,r){function n(o){var s=this;s.next=function(){var u=s.x,c=s.i,f,d,p;return f=u[c],f^=f>>>7,d=f^f<<24,f=u[c+1&7],d^=f^f>>>10,f=u[c+3&7],d^=f^f>>>3,f=u[c+4&7],d^=f^f<<7,f=u[c+7&7],f=f^f<<13,d^=f^f<<9,u[c]=d,s.i=c+1&7,d};function l(u,c){var f,d,p=[];if(c===(c|0))d=p[0]=c;else for(c=""+c,f=0;f0;--f)u.next()}l(s,o)}function i(o,s){return s.x=o.x.slice(),s.i=o.i,s}function a(o,s){o==null&&(o=+new Date);var l=new n(o),u=s&&s.state,c=function(){return(l.next()>>>0)/4294967296};return c.double=function(){do var f=l.next()>>>11,d=(l.next()>>>0)/4294967296,p=(f+d)/(1<<21);while(p===0);return p},c.int32=l.next,c.quick=c,u&&(u.x&&i(u,l),c.state=function(){return i(l,{})}),c}t&&t.exports?t.exports=a:r&&r.amd?r(function(){return a}):this.xorshift7=a})(HAe,typeof IH=="object"&&IH,typeof define=="function"&&define)});var QAe=vn((GAe,BH)=>{(function(e,t,r){function n(o){var s=this;s.next=function(){var u=s.w,c=s.X,f=s.i,d,p;return s.w=u=u+1640531527|0,p=c[f+34&127],d=c[f=f+1&127],p^=p<<13,d^=d<<17,p^=p>>>15,d^=d>>>12,p=c[f]=p^d,s.i=f,p+(u^u>>>16)|0};function l(u,c){var f,d,p,h,m,g=[],A=128;for(c===(c|0)?(d=c,c=null):(c=c+"\0",d=0,A=Math.max(A,c.length)),p=0,h=-32;h>>15,d^=d<<4,d^=d>>>13,h>=0&&(m=m+1640531527|0,f=g[h&127]^=d+m,p=f==0?p+1:0);for(p>=128&&(g[(c&&c.length||0)&127]=-1),p=127,h=4*128;h>0;--h)d=g[p+34&127],f=g[p=p+1&127],d^=d<<13,f^=f<<17,d^=d>>>15,f^=f>>>12,g[p]=d^f;u.w=m,u.X=g,u.i=p}l(s,o)}function i(o,s){return s.i=o.i,s.w=o.w,s.X=o.X.slice(),s}function a(o,s){o==null&&(o=+new Date);var l=new n(o),u=s&&s.state,c=function(){return(l.next()>>>0)/4294967296};return c.double=function(){do var f=l.next()>>>11,d=(l.next()>>>0)/4294967296,p=(f+d)/(1<<21);while(p===0);return p},c.int32=l.next,c.quick=c,u&&(u.X&&i(u,l),c.state=function(){return i(l,{})}),c}t&&t.exports?t.exports=a:r&&r.amd?r(function(){return a}):this.xor4096=a})(GAe,typeof BH=="object"&&BH,typeof define=="function"&&define)});var ZAe=vn((YAe,RH)=>{(function(e,t,r){function n(o){var s=this,l="";s.next=function(){var c=s.b,f=s.c,d=s.d,p=s.a;return c=c<<25^c>>>7^f,f=f-d|0,d=d<<24^d>>>8^p,p=p-c|0,s.b=c=c<<20^c>>>12^f,s.c=f=f-d|0,s.d=d<<16^f>>>16^p,s.a=p-c|0},s.a=0,s.b=0,s.c=-1640531527,s.d=1367130551,o===Math.floor(o)?(s.a=o/4294967296|0,s.b=o|0):l+=o;for(var u=0;u>>0)/4294967296};return c.double=function(){do var f=l.next()>>>11,d=(l.next()>>>0)/4294967296,p=(f+d)/(1<<21);while(p===0);return p},c.int32=l.next,c.quick=c,u&&(typeof u=="object"&&i(u,l),c.state=function(){return i(l,{})}),c}t&&t.exports?t.exports=a:r&&r.amd?r(function(){return a}):this.tychei=a})(YAe,typeof RH=="object"&&RH,typeof define=="function"&&define)});var KAe=vn((XAe,SP)=>{(function(e,t,r){var n=256,i=6,a=52,o="random",s=r.pow(n,i),l=r.pow(2,a),u=l*2,c=n-1,f;function d(v,x,w){var S=[];x=x==!0?{entropy:!0}:x||{};var k=g(m(x.entropy?[v,b(t)]:v??A(),3),S),j=new p(S),O=function(){for(var C=j.g(i),N=s,D=0;C=u;)C/=2,N/=2,D>>>=1;return(C+D)/N};return O.int32=function(){return j.g(4)|0},O.quick=function(){return j.g(4)/4294967296},O.double=O,g(b(j.S),t),(x.pass||w||function(C,N,D,P){return P&&(P.S&&h(P,j),C.state=function(){return h(j,{})}),D?(r[o]=C,N):C})(O,k,"global"in x?x.global:this==r,x.state)}function p(v){var x,w=v.length,S=this,k=0,j=S.i=S.j=0,O=S.S=[];for(w||(v=[w++]);k{var xWe=qAe(),wWe=zAe(),SWe=WAe(),EWe=VAe(),kWe=QAe(),CWe=ZAe(),Dy=KAe();Dy.alea=xWe;Dy.xor128=wWe;Dy.xorwow=SWe;Dy.xorshift7=EWe;Dy.xor4096=kWe;Dy.tychei=CWe;JAe.exports=Dy});var tye=vn((oGt,_V)=>{function FV(){}FV.prototype={on:function(e,t,r){var n=this.e||(this.e={});return(n[e]||(n[e]=[])).push({fn:t,ctx:r}),this},once:function(e,t,r){var n=this;function i(){n.off(e,i),t.apply(r,arguments)}return i._=t,this.on(e,i,r)},emit:function(e){var t=[].slice.call(arguments,1),r=((this.e||(this.e={}))[e]||[]).slice(),n=0,i=r.length;for(n;n{"use strict";var uVe=Te(),cVe=Symbol.for("react.element"),fVe=Symbol.for("react.fragment"),dVe=Object.prototype.hasOwnProperty,pVe=uVe.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,mVe={key:!0,ref:!0,__self:!0,__source:!0};function Lye(e,t,r){var n,i={},a=null,o=null;r!==void 0&&(a=""+r),t.key!==void 0&&(a=""+t.key),t.ref!==void 0&&(o=t.ref);for(n in t)dVe.call(t,n)&&!mVe.hasOwnProperty(n)&&(i[n]=t[n]);if(e&&e.defaultProps)for(n in t=e.defaultProps,t)i[n]===void 0&&(i[n]=t[n]);return{$$typeof:cVe,type:e,key:a,ref:o,props:i,_owner:pVe.current}}JB.Fragment=fVe;JB.jsx=Lye;JB.jsxs=Lye});var XA=vn((YQt,Uye)=>{"use strict";Uye.exports=zye()});var hCe=vn((Twr,mCe)=>{"use strict";var mtt="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";mCe.exports=mtt});var yCe=vn((Fwr,vCe)=>{"use strict";var htt=hCe();function ACe(){}function gCe(){}gCe.resetWarningCache=ACe;vCe.exports=function(){function e(n,i,a,o,s,l){if(l!==htt){var u=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw u.name="Invariant Violation",u}}e.isRequired=e;function t(){return e}var r={array:e,bigint:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,elementType:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t,checkPropTypes:gCe,resetWarningCache:ACe};return r.PropTypes=r,r}});var xCe=vn((Iwr,bCe)=>{bCe.exports=yCe()();var _wr,Pwr});var CCe=vn($Z=>{"use strict";$Z.__esModule=!0;$Z.default=function(e,t){if(e&&t){var r=Array.isArray(t)?t:t.split(","),n=e.name||"",i=(e.type||"").toLowerCase(),a=i.replace(/\/.*$/,"");return r.some(function(o){var s=o.trim().toLowerCase();return s.charAt(0)==="."?n.toLowerCase().endsWith(s):s.endsWith("/*")?a===s.replace(/\/.*$/,""):i===s})}return!0}});var sDe=vn(oE=>{"use strict";Object.defineProperty(oE,"__esModule",{value:!0});var lm=Te(),KZ=lm.createContext(null),XZ={didCatch:!1,error:null},V8=class extends lm.Component{constructor(t){super(t),this.resetErrorBoundary=this.resetErrorBoundary.bind(this),this.state=XZ}static getDerivedStateFromError(t){return{didCatch:!0,error:t}}resetErrorBoundary(){let{error:t}=this.state;if(t!==null){for(var r,n,i=arguments.length,a=new Array(i),o=0;o0&&arguments[0]!==void 0?arguments[0]:[],t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[];return e.length!==t.length||e.some((r,n)=>!Object.is(r,t[n]))}function srt(e){if(e==null||typeof e.didCatch!="boolean"||typeof e.resetErrorBoundary!="function")throw new Error("ErrorBoundaryContext not found")}function lrt(){let e=lm.useContext(KZ);srt(e);let[t,r]=lm.useState({error:null,hasError:!1}),n=lm.useMemo(()=>({resetBoundary:()=>{e.resetErrorBoundary(),r({error:null,hasError:!1})},showBoundary:i=>r({error:i,hasError:!0})}),[e.resetErrorBoundary]);if(t.hasError)throw t.error;return n}function urt(e,t){let r=lm.forwardRef((i,a)=>lm.createElement(V8,t,lm.createElement(e,{...i,ref:a}))),n=e.displayName||e.name||"Unknown";return r.displayName="withErrorBoundary(".concat(n,")"),r}oE.ErrorBoundary=V8;oE.ErrorBoundaryContext=KZ;oE.useErrorBoundary=lrt;oE.withErrorBoundary=urt});var gDe=vn((pEr,ADe)=>{"use strict";var Z8={boxFlex:!0,boxFlexGroup:!0,columnCount:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,strokeDashoffset:!0,strokeOpacity:!0,strokeWidth:!0};function drt(e,t){return e+t.charAt(0).toUpperCase()+t.substring(1)}var prt=["Webkit","ms","Moz","O"];Object.keys(Z8).forEach(function(e){prt.forEach(function(t){Z8[drt(t,e)]=Z8[e]})});var mrt={background:{backgroundImage:!0,backgroundPosition:!0,backgroundRepeat:!0,backgroundColor:!0},border:{borderWidth:!0,borderStyle:!0,borderColor:!0},borderBottom:{borderBottomWidth:!0,borderBottomStyle:!0,borderBottomColor:!0},borderLeft:{borderLeftWidth:!0,borderLeftStyle:!0,borderLeftColor:!0},borderRight:{borderRightWidth:!0,borderRightStyle:!0,borderRightColor:!0},borderTop:{borderTopWidth:!0,borderTopStyle:!0,borderTopColor:!0},font:{fontStyle:!0,fontVariant:!0,fontWeight:!0,fontSize:!0,lineHeight:!0,fontFamily:!0}},hrt={isUnitlessNumber:Z8,shorthandPropertyExpansions:mrt};ADe.exports=hrt});var yDe=vn((mEr,vDe)=>{"use strict";var Art=/^ms-/,grt=/([A-Z])/g;function vrt(e){return e.replace(grt,"-$1").toLowerCase()}function yrt(e){return vrt(e).replace(Art,"-ms-")}vDe.exports=yrt});var SDe=vn((hEr,wDe)=>{"use strict";var brt=gDe().isUnitlessNumber,xrt=yDe(),wrt=Array.isArray,bDe=Object.keys,Srt=/^(normal|none|(\b(url\([^)]*\)|chapter_counter|attr\([^)]*\)|(no-)?(open|close)-quote|inherit)((\b\s*)|$|\s+))+)$/;function xDe(e,t){return!brt[e]&&typeof t=="number"?t=""+t+"px":e==="content"&&!Srt.test(t)&&(t="'"+t.replace(/'/g,"\\'")+"'"),xrt(e)+": "+t+"; "}function Ert(e){var t="";if(!e||bDe(e).length===0)return t;for(var r=bDe(e),n=0,i=r.length;n{(function(e){typeof sOe=="object"&&typeof fX<"u"?fX.exports=e():typeof define=="function"&&define.amd?define([],e):(typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:this).JSZip=e()})(function(){return function e(t,r,n){function i(s,l){if(!r[s]){if(!t[s]){var u=typeof require=="function"&&require;if(!l&&u)return u(s,!0);if(a)return a(s,!0);var c=new Error("Cannot find module '"+s+"'");throw c.code="MODULE_NOT_FOUND",c}var f=r[s]={exports:{}};t[s][0].call(f.exports,function(d){var p=t[s][1][d];return i(p||d)},f,f.exports,e,t,r,n)}return r[s].exports}for(var a=typeof require=="function"&&require,o=0;o>2,f=(3&s)<<4|l>>4,d=1>6:64,p=2>4,l=(15&c)<<4|(f=a.indexOf(o.charAt(p++)))>>2,u=(3&f)<<6|(d=a.indexOf(o.charAt(p++))),g[h++]=s,f!==64&&(g[h++]=l),d!==64&&(g[h++]=u);return g}},{"./support":30,"./utils":32}],2:[function(e,t,r){"use strict";var n=e("./external"),i=e("./stream/DataWorker"),a=e("./stream/Crc32Probe"),o=e("./stream/DataLengthProbe");function s(l,u,c,f,d){this.compressedSize=l,this.uncompressedSize=u,this.crc32=c,this.compression=f,this.compressedContent=d}s.prototype={getContentWorker:function(){var l=new i(n.Promise.resolve(this.compressedContent)).pipe(this.compression.uncompressWorker()).pipe(new o("data_length")),u=this;return l.on("end",function(){if(this.streamInfo.data_length!==u.uncompressedSize)throw new Error("Bug : uncompressed data size mismatch")}),l},getCompressedWorker:function(){return new i(n.Promise.resolve(this.compressedContent)).withStreamInfo("compressedSize",this.compressedSize).withStreamInfo("uncompressedSize",this.uncompressedSize).withStreamInfo("crc32",this.crc32).withStreamInfo("compression",this.compression)}},s.createWorkerFrom=function(l,u,c){return l.pipe(new a).pipe(new o("uncompressedSize")).pipe(u.compressWorker(c)).pipe(new o("compressedSize")).withStreamInfo("compression",u)},t.exports=s},{"./external":6,"./stream/Crc32Probe":25,"./stream/DataLengthProbe":26,"./stream/DataWorker":27}],3:[function(e,t,r){"use strict";var n=e("./stream/GenericWorker");r.STORE={magic:"\0\0",compressWorker:function(){return new n("STORE compression")},uncompressWorker:function(){return new n("STORE decompression")}},r.DEFLATE=e("./flate")},{"./flate":7,"./stream/GenericWorker":28}],4:[function(e,t,r){"use strict";var n=e("./utils"),i=function(){for(var a,o=[],s=0;s<256;s++){a=s;for(var l=0;l<8;l++)a=1&a?3988292384^a>>>1:a>>>1;o[s]=a}return o}();t.exports=function(a,o){return a!==void 0&&a.length?n.getTypeOf(a)!=="string"?function(s,l,u,c){var f=i,d=c+u;s^=-1;for(var p=c;p>>8^f[255&(s^l[p])];return-1^s}(0|o,a,a.length,0):function(s,l,u,c){var f=i,d=c+u;s^=-1;for(var p=c;p>>8^f[255&(s^l.charCodeAt(p))];return-1^s}(0|o,a,a.length,0):0}},{"./utils":32}],5:[function(e,t,r){"use strict";r.base64=!1,r.binary=!1,r.dir=!1,r.createFolders=!0,r.date=null,r.compression=null,r.compressionOptions=null,r.comment=null,r.unixPermissions=null,r.dosPermissions=null},{}],6:[function(e,t,r){"use strict";var n=null;n=typeof Promise<"u"?Promise:e("lie"),t.exports={Promise:n}},{lie:37}],7:[function(e,t,r){"use strict";var n=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Uint32Array<"u",i=e("pako"),a=e("./utils"),o=e("./stream/GenericWorker"),s=n?"uint8array":"array";function l(u,c){o.call(this,"FlateWorker/"+u),this._pako=null,this._pakoAction=u,this._pakoOptions=c,this.meta={}}r.magic="\b\0",a.inherits(l,o),l.prototype.processChunk=function(u){this.meta=u.meta,this._pako===null&&this._createPako(),this._pako.push(a.transformTo(s,u.data),!1)},l.prototype.flush=function(){o.prototype.flush.call(this),this._pako===null&&this._createPako(),this._pako.push([],!0)},l.prototype.cleanUp=function(){o.prototype.cleanUp.call(this),this._pako=null},l.prototype._createPako=function(){this._pako=new i[this._pakoAction]({raw:!0,level:this._pakoOptions.level||-1});var u=this;this._pako.onData=function(c){u.push({data:c,meta:u.meta})}},r.compressWorker=function(u){return new l("Deflate",u)},r.uncompressWorker=function(){return new l("Inflate",{})}},{"./stream/GenericWorker":28,"./utils":32,pako:38}],8:[function(e,t,r){"use strict";function n(f,d){var p,h="";for(p=0;p>>=8;return h}function i(f,d,p,h,m,g){var A,b,v=f.file,x=f.compression,w=g!==s.utf8encode,S=a.transformTo("string",g(v.name)),k=a.transformTo("string",s.utf8encode(v.name)),j=v.comment,O=a.transformTo("string",g(j)),C=a.transformTo("string",s.utf8encode(j)),N=k.length!==v.name.length,D=C.length!==j.length,P="",q="",z="",I=v.dir,T=v.date,L={crc32:0,compressedSize:0,uncompressedSize:0};d&&!p||(L.crc32=f.crc32,L.compressedSize=f.compressedSize,L.uncompressedSize=f.uncompressedSize);var _=0;d&&(_|=8),w||!N&&!D||(_|=2048);var Y=0,oe=0;I&&(Y|=16),m==="UNIX"?(oe=798,Y|=function(Q,fe){var Ie=Q;return Q||(Ie=fe?16893:33204),(65535&Ie)<<16}(v.unixPermissions,I)):(oe=20,Y|=function(Q){return 63&(Q||0)}(v.dosPermissions)),A=T.getUTCHours(),A<<=6,A|=T.getUTCMinutes(),A<<=5,A|=T.getUTCSeconds()/2,b=T.getUTCFullYear()-1980,b<<=4,b|=T.getUTCMonth()+1,b<<=5,b|=T.getUTCDate(),N&&(q=n(1,1)+n(l(S),4)+k,P+="up"+n(q.length,2)+q),D&&(z=n(1,1)+n(l(O),4)+C,P+="uc"+n(z.length,2)+z);var te="";return te+=` -\0`,te+=n(_,2),te+=x.magic,te+=n(A,2),te+=n(b,2),te+=n(L.crc32,4),te+=n(L.compressedSize,4),te+=n(L.uncompressedSize,4),te+=n(S.length,2),te+=n(P.length,2),{fileRecord:u.LOCAL_FILE_HEADER+te+S+P,dirRecord:u.CENTRAL_FILE_HEADER+n(oe,2)+te+n(O.length,2)+"\0\0\0\0"+n(Y,4)+n(h,4)+S+P+O}}var a=e("../utils"),o=e("../stream/GenericWorker"),s=e("../utf8"),l=e("../crc32"),u=e("../signature");function c(f,d,p,h){o.call(this,"ZipFileWorker"),this.bytesWritten=0,this.zipComment=d,this.zipPlatform=p,this.encodeFileName=h,this.streamFiles=f,this.accumulate=!1,this.contentBuffer=[],this.dirRecords=[],this.currentSourceOffset=0,this.entriesCount=0,this.currentFile=null,this._sources=[]}a.inherits(c,o),c.prototype.push=function(f){var d=f.meta.percent||0,p=this.entriesCount,h=this._sources.length;this.accumulate?this.contentBuffer.push(f):(this.bytesWritten+=f.data.length,o.prototype.push.call(this,{data:f.data,meta:{currentFile:this.currentFile,percent:p?(d+100*(p-h-1))/p:100}}))},c.prototype.openedSource=function(f){this.currentSourceOffset=this.bytesWritten,this.currentFile=f.file.name;var d=this.streamFiles&&!f.file.dir;if(d){var p=i(f,d,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:p.fileRecord,meta:{percent:0}})}else this.accumulate=!0},c.prototype.closedSource=function(f){this.accumulate=!1;var d=this.streamFiles&&!f.file.dir,p=i(f,d,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(p.dirRecord),d)this.push({data:function(h){return u.DATA_DESCRIPTOR+n(h.crc32,4)+n(h.compressedSize,4)+n(h.uncompressedSize,4)}(f),meta:{percent:100}});else for(this.push({data:p.fileRecord,meta:{percent:0}});this.contentBuffer.length;)this.push(this.contentBuffer.shift());this.currentFile=null},c.prototype.flush=function(){for(var f=this.bytesWritten,d=0;d=this.index;o--)s=(s<<8)+this.byteAt(o);return this.index+=a,s},readString:function(a){return n.transformTo("string",this.readData(a))},readData:function(){},lastIndexOfSignature:function(){},readAndCheckSignature:function(){},readDate:function(){var a=this.readInt(4);return new Date(Date.UTC(1980+(a>>25&127),(a>>21&15)-1,a>>16&31,a>>11&31,a>>5&63,(31&a)<<1))}},t.exports=i},{"../utils":32}],19:[function(e,t,r){"use strict";var n=e("./Uint8ArrayReader");function i(a){n.call(this,a)}e("../utils").inherits(i,n),i.prototype.readData=function(a){this.checkOffset(a);var o=this.data.slice(this.zero+this.index,this.zero+this.index+a);return this.index+=a,o},t.exports=i},{"../utils":32,"./Uint8ArrayReader":21}],20:[function(e,t,r){"use strict";var n=e("./DataReader");function i(a){n.call(this,a)}e("../utils").inherits(i,n),i.prototype.byteAt=function(a){return this.data.charCodeAt(this.zero+a)},i.prototype.lastIndexOfSignature=function(a){return this.data.lastIndexOf(a)-this.zero},i.prototype.readAndCheckSignature=function(a){return a===this.readData(4)},i.prototype.readData=function(a){this.checkOffset(a);var o=this.data.slice(this.zero+this.index,this.zero+this.index+a);return this.index+=a,o},t.exports=i},{"../utils":32,"./DataReader":18}],21:[function(e,t,r){"use strict";var n=e("./ArrayReader");function i(a){n.call(this,a)}e("../utils").inherits(i,n),i.prototype.readData=function(a){if(this.checkOffset(a),a===0)return new Uint8Array(0);var o=this.data.subarray(this.zero+this.index,this.zero+this.index+a);return this.index+=a,o},t.exports=i},{"../utils":32,"./ArrayReader":17}],22:[function(e,t,r){"use strict";var n=e("../utils"),i=e("../support"),a=e("./ArrayReader"),o=e("./StringReader"),s=e("./NodeBufferReader"),l=e("./Uint8ArrayReader");t.exports=function(u){var c=n.getTypeOf(u);return n.checkSupport(c),c!=="string"||i.uint8array?c==="nodebuffer"?new s(u):i.uint8array?new l(n.transformTo("uint8array",u)):new a(n.transformTo("array",u)):new o(u)}},{"../support":30,"../utils":32,"./ArrayReader":17,"./NodeBufferReader":19,"./StringReader":20,"./Uint8ArrayReader":21}],23:[function(e,t,r){"use strict";r.LOCAL_FILE_HEADER="PK",r.CENTRAL_FILE_HEADER="PK",r.CENTRAL_DIRECTORY_END="PK",r.ZIP64_CENTRAL_DIRECTORY_LOCATOR="PK\x07",r.ZIP64_CENTRAL_DIRECTORY_END="PK",r.DATA_DESCRIPTOR="PK\x07\b"},{}],24:[function(e,t,r){"use strict";var n=e("./GenericWorker"),i=e("../utils");function a(o){n.call(this,"ConvertWorker to "+o),this.destType=o}i.inherits(a,n),a.prototype.processChunk=function(o){this.push({data:i.transformTo(this.destType,o.data),meta:o.meta})},t.exports=a},{"../utils":32,"./GenericWorker":28}],25:[function(e,t,r){"use strict";var n=e("./GenericWorker"),i=e("../crc32");function a(){n.call(this,"Crc32Probe"),this.withStreamInfo("crc32",0)}e("../utils").inherits(a,n),a.prototype.processChunk=function(o){this.streamInfo.crc32=i(o.data,this.streamInfo.crc32||0),this.push(o)},t.exports=a},{"../crc32":4,"../utils":32,"./GenericWorker":28}],26:[function(e,t,r){"use strict";var n=e("../utils"),i=e("./GenericWorker");function a(o){i.call(this,"DataLengthProbe for "+o),this.propName=o,this.withStreamInfo(o,0)}n.inherits(a,i),a.prototype.processChunk=function(o){if(o){var s=this.streamInfo[this.propName]||0;this.streamInfo[this.propName]=s+o.data.length}i.prototype.processChunk.call(this,o)},t.exports=a},{"../utils":32,"./GenericWorker":28}],27:[function(e,t,r){"use strict";var n=e("../utils"),i=e("./GenericWorker");function a(o){i.call(this,"DataWorker");var s=this;this.dataIsReady=!1,this.index=0,this.max=0,this.data=null,this.type="",this._tickScheduled=!1,o.then(function(l){s.dataIsReady=!0,s.data=l,s.max=l&&l.length||0,s.type=n.getTypeOf(l),s.isPaused||s._tickAndRepeat()},function(l){s.error(l)})}n.inherits(a,i),a.prototype.cleanUp=function(){i.prototype.cleanUp.call(this),this.data=null},a.prototype.resume=function(){return!!i.prototype.resume.call(this)&&(!this._tickScheduled&&this.dataIsReady&&(this._tickScheduled=!0,n.delay(this._tickAndRepeat,[],this)),!0)},a.prototype._tickAndRepeat=function(){this._tickScheduled=!1,this.isPaused||this.isFinished||(this._tick(),this.isFinished||(n.delay(this._tickAndRepeat,[],this),this._tickScheduled=!0))},a.prototype._tick=function(){if(this.isPaused||this.isFinished)return!1;var o=null,s=Math.min(this.max,this.index+16384);if(this.index>=this.max)return this.end();switch(this.type){case"string":o=this.data.substring(this.index,s);break;case"uint8array":o=this.data.subarray(this.index,s);break;case"array":case"nodebuffer":o=this.data.slice(this.index,s)}return this.index=s,this.push({data:o,meta:{percent:this.max?this.index/this.max*100:0}})},t.exports=a},{"../utils":32,"./GenericWorker":28}],28:[function(e,t,r){"use strict";function n(i){this.name=i||"default",this.streamInfo={},this.generatedError=null,this.extraStreamInfo={},this.isPaused=!0,this.isFinished=!1,this.isLocked=!1,this._listeners={data:[],end:[],error:[]},this.previous=null}n.prototype={push:function(i){this.emit("data",i)},end:function(){if(this.isFinished)return!1;this.flush();try{this.emit("end"),this.cleanUp(),this.isFinished=!0}catch(i){this.emit("error",i)}return!0},error:function(i){return!this.isFinished&&(this.isPaused?this.generatedError=i:(this.isFinished=!0,this.emit("error",i),this.previous&&this.previous.error(i),this.cleanUp()),!0)},on:function(i,a){return this._listeners[i].push(a),this},cleanUp:function(){this.streamInfo=this.generatedError=this.extraStreamInfo=null,this._listeners=[]},emit:function(i,a){if(this._listeners[i])for(var o=0;o "+i:i}},t.exports=n},{}],29:[function(e,t,r){"use strict";var n=e("../utils"),i=e("./ConvertWorker"),a=e("./GenericWorker"),o=e("../base64"),s=e("../support"),l=e("../external"),u=null;if(s.nodestream)try{u=e("../nodejs/NodejsStreamOutputAdapter")}catch{}function c(d,p){return new l.Promise(function(h,m){var g=[],A=d._internalType,b=d._outputType,v=d._mimeType;d.on("data",function(x,w){g.push(x),p&&p(w)}).on("error",function(x){g=[],m(x)}).on("end",function(){try{var x=function(w,S,k){switch(w){case"blob":return n.newBlob(n.transformTo("arraybuffer",S),k);case"base64":return o.encode(S);default:return n.transformTo(w,S)}}(b,function(w,S){var k,j=0,O=null,C=0;for(k=0;k"u")r.blob=!1;else{var n=new ArrayBuffer(0);try{r.blob=new Blob([n],{type:"application/zip"}).size===0}catch{try{var i=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);i.append(n),r.blob=i.getBlob("application/zip").size===0}catch{r.blob=!1}}}try{r.nodestream=!!e("readable-stream").Readable}catch{r.nodestream=!1}},{"readable-stream":16}],31:[function(e,t,r){"use strict";for(var n=e("./utils"),i=e("./support"),a=e("./nodejsUtils"),o=e("./stream/GenericWorker"),s=new Array(256),l=0;l<256;l++)s[l]=252<=l?6:248<=l?5:240<=l?4:224<=l?3:192<=l?2:1;s[254]=s[254]=1;function u(){o.call(this,"utf-8 decode"),this.leftOver=null}function c(){o.call(this,"utf-8 encode")}r.utf8encode=function(f){return i.nodebuffer?a.newBufferFrom(f,"utf-8"):function(d){var p,h,m,g,A,b=d.length,v=0;for(g=0;g>>6:(h<65536?p[A++]=224|h>>>12:(p[A++]=240|h>>>18,p[A++]=128|h>>>12&63),p[A++]=128|h>>>6&63),p[A++]=128|63&h);return p}(f)},r.utf8decode=function(f){return i.nodebuffer?n.transformTo("nodebuffer",f).toString("utf-8"):function(d){var p,h,m,g,A=d.length,b=new Array(2*A);for(p=h=0;p>10&1023,b[h++]=56320|1023&m)}return b.length!==h&&(b.subarray?b=b.subarray(0,h):b.length=h),n.applyFromCharCode(b)}(f=n.transformTo(i.uint8array?"uint8array":"array",f))},n.inherits(u,o),u.prototype.processChunk=function(f){var d=n.transformTo(i.uint8array?"uint8array":"array",f.data);if(this.leftOver&&this.leftOver.length){if(i.uint8array){var p=d;(d=new Uint8Array(p.length+this.leftOver.length)).set(this.leftOver,0),d.set(p,this.leftOver.length)}else d=this.leftOver.concat(d);this.leftOver=null}var h=function(g,A){var b;for((A=A||g.length)>g.length&&(A=g.length),b=A-1;0<=b&&(192&g[b])==128;)b--;return b<0||b===0?A:b+s[g[b]]>A?b:A}(d),m=d;h!==d.length&&(i.uint8array?(m=d.subarray(0,h),this.leftOver=d.subarray(h,d.length)):(m=d.slice(0,h),this.leftOver=d.slice(h,d.length))),this.push({data:r.utf8decode(m),meta:f.meta})},u.prototype.flush=function(){this.leftOver&&this.leftOver.length&&(this.push({data:r.utf8decode(this.leftOver),meta:{}}),this.leftOver=null)},r.Utf8DecodeWorker=u,n.inherits(c,o),c.prototype.processChunk=function(f){this.push({data:r.utf8encode(f.data),meta:f.meta})},r.Utf8EncodeWorker=c},{"./nodejsUtils":14,"./stream/GenericWorker":28,"./support":30,"./utils":32}],32:[function(e,t,r){"use strict";var n=e("./support"),i=e("./base64"),a=e("./nodejsUtils"),o=e("./external");function s(p){return p}function l(p,h){for(var m=0;m>8;this.dir=!!(16&this.externalFileAttributes),f==0&&(this.dosPermissions=63&this.externalFileAttributes),f==3&&(this.unixPermissions=this.externalFileAttributes>>16&65535),this.dir||this.fileNameStr.slice(-1)!=="/"||(this.dir=!0)},parseZIP64ExtraField:function(){if(this.extraFields[1]){var f=n(this.extraFields[1].value);this.uncompressedSize===i.MAX_VALUE_32BITS&&(this.uncompressedSize=f.readInt(8)),this.compressedSize===i.MAX_VALUE_32BITS&&(this.compressedSize=f.readInt(8)),this.localHeaderOffset===i.MAX_VALUE_32BITS&&(this.localHeaderOffset=f.readInt(8)),this.diskNumberStart===i.MAX_VALUE_32BITS&&(this.diskNumberStart=f.readInt(4))}},readExtraFields:function(f){var d,p,h,m=f.index+this.extraFieldsLength;for(this.extraFields||(this.extraFields={});f.index+4>>6:(f<65536?c[h++]=224|f>>>12:(c[h++]=240|f>>>18,c[h++]=128|f>>>12&63),c[h++]=128|f>>>6&63),c[h++]=128|63&f);return c},r.buf2binstring=function(u){return l(u,u.length)},r.binstring2buf=function(u){for(var c=new n.Buf8(u.length),f=0,d=c.length;f>10&1023,g[d++]=56320|1023&p)}return l(g,d)},r.utf8border=function(u,c){var f;for((c=c||u.length)>u.length&&(c=u.length),f=c-1;0<=f&&(192&u[f])==128;)f--;return f<0||f===0?c:f+o[u[f]]>c?f:c}},{"./common":41}],43:[function(e,t,r){"use strict";t.exports=function(n,i,a,o){for(var s=65535&n|0,l=n>>>16&65535|0,u=0;a!==0;){for(a-=u=2e3>>1:i>>>1;a[o]=i}return a}();t.exports=function(i,a,o,s){var l=n,u=s+o;i^=-1;for(var c=s;c>>8^l[255&(i^a[c])];return-1^i}},{}],46:[function(e,t,r){"use strict";var n,i=e("../utils/common"),a=e("./trees"),o=e("./adler32"),s=e("./crc32"),l=e("./messages"),u=0,c=4,f=0,d=-2,p=-1,h=4,m=2,g=8,A=9,b=286,v=30,x=19,w=2*b+1,S=15,k=3,j=258,O=j+k+1,C=42,N=113,D=1,P=2,q=3,z=4;function I($,ae){return $.msg=l[ae],ae}function T($){return($<<1)-(4<$?9:0)}function L($){for(var ae=$.length;0<=--ae;)$[ae]=0}function _($){var ae=$.state,ce=ae.pending;ce>$.avail_out&&(ce=$.avail_out),ce!==0&&(i.arraySet($.output,ae.pending_buf,ae.pending_out,ce,$.next_out),$.next_out+=ce,ae.pending_out+=ce,$.total_out+=ce,$.avail_out-=ce,ae.pending-=ce,ae.pending===0&&(ae.pending_out=0))}function Y($,ae){a._tr_flush_block($,0<=$.block_start?$.block_start:-1,$.strstart-$.block_start,ae),$.block_start=$.strstart,_($.strm)}function oe($,ae){$.pending_buf[$.pending++]=ae}function te($,ae){$.pending_buf[$.pending++]=ae>>>8&255,$.pending_buf[$.pending++]=255&ae}function Q($,ae){var ce,U,R=$.max_chain_length,J=$.strstart,ee=$.prev_length,ie=$.nice_match,re=$.strstart>$.w_size-O?$.strstart-($.w_size-O):0,Ee=$.window,Ce=$.w_mask,_e=$.prev,he=$.strstart+j,ze=Ee[J+ee-1],Ye=Ee[J+ee];$.prev_length>=$.good_match&&(R>>=2),ie>$.lookahead&&(ie=$.lookahead);do if(Ee[(ce=ae)+ee]===Ye&&Ee[ce+ee-1]===ze&&Ee[ce]===Ee[J]&&Ee[++ce]===Ee[J+1]){J+=2,ce++;do;while(Ee[++J]===Ee[++ce]&&Ee[++J]===Ee[++ce]&&Ee[++J]===Ee[++ce]&&Ee[++J]===Ee[++ce]&&Ee[++J]===Ee[++ce]&&Ee[++J]===Ee[++ce]&&Ee[++J]===Ee[++ce]&&Ee[++J]===Ee[++ce]&&Jre&&--R!=0);return ee<=$.lookahead?ee:$.lookahead}function fe($){var ae,ce,U,R,J,ee,ie,re,Ee,Ce,_e=$.w_size;do{if(R=$.window_size-$.lookahead-$.strstart,$.strstart>=_e+(_e-O)){for(i.arraySet($.window,$.window,_e,_e,0),$.match_start-=_e,$.strstart-=_e,$.block_start-=_e,ae=ce=$.hash_size;U=$.head[--ae],$.head[ae]=_e<=U?U-_e:0,--ce;);for(ae=ce=_e;U=$.prev[--ae],$.prev[ae]=_e<=U?U-_e:0,--ce;);R+=_e}if($.strm.avail_in===0)break;if(ee=$.strm,ie=$.window,re=$.strstart+$.lookahead,Ee=R,Ce=void 0,Ce=ee.avail_in,Ee=k)for(J=$.strstart-$.insert,$.ins_h=$.window[J],$.ins_h=($.ins_h<<$.hash_shift^$.window[J+1])&$.hash_mask;$.insert&&($.ins_h=($.ins_h<<$.hash_shift^$.window[J+k-1])&$.hash_mask,$.prev[J&$.w_mask]=$.head[$.ins_h],$.head[$.ins_h]=J,J++,$.insert--,!($.lookahead+$.insert=k&&($.ins_h=($.ins_h<<$.hash_shift^$.window[$.strstart+k-1])&$.hash_mask,ce=$.prev[$.strstart&$.w_mask]=$.head[$.ins_h],$.head[$.ins_h]=$.strstart),ce!==0&&$.strstart-ce<=$.w_size-O&&($.match_length=Q($,ce)),$.match_length>=k)if(U=a._tr_tally($,$.strstart-$.match_start,$.match_length-k),$.lookahead-=$.match_length,$.match_length<=$.max_lazy_match&&$.lookahead>=k){for($.match_length--;$.strstart++,$.ins_h=($.ins_h<<$.hash_shift^$.window[$.strstart+k-1])&$.hash_mask,ce=$.prev[$.strstart&$.w_mask]=$.head[$.ins_h],$.head[$.ins_h]=$.strstart,--$.match_length!=0;);$.strstart++}else $.strstart+=$.match_length,$.match_length=0,$.ins_h=$.window[$.strstart],$.ins_h=($.ins_h<<$.hash_shift^$.window[$.strstart+1])&$.hash_mask;else U=a._tr_tally($,0,$.window[$.strstart]),$.lookahead--,$.strstart++;if(U&&(Y($,!1),$.strm.avail_out===0))return D}return $.insert=$.strstart=k&&($.ins_h=($.ins_h<<$.hash_shift^$.window[$.strstart+k-1])&$.hash_mask,ce=$.prev[$.strstart&$.w_mask]=$.head[$.ins_h],$.head[$.ins_h]=$.strstart),$.prev_length=$.match_length,$.prev_match=$.match_start,$.match_length=k-1,ce!==0&&$.prev_length<$.max_lazy_match&&$.strstart-ce<=$.w_size-O&&($.match_length=Q($,ce),$.match_length<=5&&($.strategy===1||$.match_length===k&&4096<$.strstart-$.match_start)&&($.match_length=k-1)),$.prev_length>=k&&$.match_length<=$.prev_length){for(R=$.strstart+$.lookahead-k,U=a._tr_tally($,$.strstart-1-$.prev_match,$.prev_length-k),$.lookahead-=$.prev_length-1,$.prev_length-=2;++$.strstart<=R&&($.ins_h=($.ins_h<<$.hash_shift^$.window[$.strstart+k-1])&$.hash_mask,ce=$.prev[$.strstart&$.w_mask]=$.head[$.ins_h],$.head[$.ins_h]=$.strstart),--$.prev_length!=0;);if($.match_available=0,$.match_length=k-1,$.strstart++,U&&(Y($,!1),$.strm.avail_out===0))return D}else if($.match_available){if((U=a._tr_tally($,0,$.window[$.strstart-1]))&&Y($,!1),$.strstart++,$.lookahead--,$.strm.avail_out===0)return D}else $.match_available=1,$.strstart++,$.lookahead--}return $.match_available&&(U=a._tr_tally($,0,$.window[$.strstart-1]),$.match_available=0),$.insert=$.strstart$.pending_buf_size-5&&(ce=$.pending_buf_size-5);;){if($.lookahead<=1){if(fe($),$.lookahead===0&&ae===u)return D;if($.lookahead===0)break}$.strstart+=$.lookahead,$.lookahead=0;var U=$.block_start+ce;if(($.strstart===0||$.strstart>=U)&&($.lookahead=$.strstart-U,$.strstart=U,Y($,!1),$.strm.avail_out===0)||$.strstart-$.block_start>=$.w_size-O&&(Y($,!1),$.strm.avail_out===0))return D}return $.insert=0,ae===c?(Y($,!0),$.strm.avail_out===0?q:z):($.strstart>$.block_start&&(Y($,!1),$.strm.avail_out),D)}),new Oe(4,4,8,4,Ie),new Oe(4,5,16,8,Ie),new Oe(4,6,32,32,Ie),new Oe(4,4,16,16,Se),new Oe(8,16,32,32,Se),new Oe(8,16,128,128,Se),new Oe(8,32,128,256,Se),new Oe(32,128,258,1024,Se),new Oe(32,258,258,4096,Se)],r.deflateInit=function($,ae){return ke($,ae,g,15,8,0)},r.deflateInit2=ke,r.deflateReset=me,r.deflateResetKeep=ye,r.deflateSetHeader=function($,ae){return $&&$.state?$.state.wrap!==2?d:($.state.gzhead=ae,f):d},r.deflate=function($,ae){var ce,U,R,J;if(!$||!$.state||5>8&255),oe(U,U.gzhead.time>>16&255),oe(U,U.gzhead.time>>24&255),oe(U,U.level===9?2:2<=U.strategy||U.level<2?4:0),oe(U,255&U.gzhead.os),U.gzhead.extra&&U.gzhead.extra.length&&(oe(U,255&U.gzhead.extra.length),oe(U,U.gzhead.extra.length>>8&255)),U.gzhead.hcrc&&($.adler=s($.adler,U.pending_buf,U.pending,0)),U.gzindex=0,U.status=69):(oe(U,0),oe(U,0),oe(U,0),oe(U,0),oe(U,0),oe(U,U.level===9?2:2<=U.strategy||U.level<2?4:0),oe(U,3),U.status=N);else{var ee=g+(U.w_bits-8<<4)<<8;ee|=(2<=U.strategy||U.level<2?0:U.level<6?1:U.level===6?2:3)<<6,U.strstart!==0&&(ee|=32),ee+=31-ee%31,U.status=N,te(U,ee),U.strstart!==0&&(te(U,$.adler>>>16),te(U,65535&$.adler)),$.adler=1}if(U.status===69)if(U.gzhead.extra){for(R=U.pending;U.gzindex<(65535&U.gzhead.extra.length)&&(U.pending!==U.pending_buf_size||(U.gzhead.hcrc&&U.pending>R&&($.adler=s($.adler,U.pending_buf,U.pending-R,R)),_($),R=U.pending,U.pending!==U.pending_buf_size));)oe(U,255&U.gzhead.extra[U.gzindex]),U.gzindex++;U.gzhead.hcrc&&U.pending>R&&($.adler=s($.adler,U.pending_buf,U.pending-R,R)),U.gzindex===U.gzhead.extra.length&&(U.gzindex=0,U.status=73)}else U.status=73;if(U.status===73)if(U.gzhead.name){R=U.pending;do{if(U.pending===U.pending_buf_size&&(U.gzhead.hcrc&&U.pending>R&&($.adler=s($.adler,U.pending_buf,U.pending-R,R)),_($),R=U.pending,U.pending===U.pending_buf_size)){J=1;break}J=U.gzindexR&&($.adler=s($.adler,U.pending_buf,U.pending-R,R)),J===0&&(U.gzindex=0,U.status=91)}else U.status=91;if(U.status===91)if(U.gzhead.comment){R=U.pending;do{if(U.pending===U.pending_buf_size&&(U.gzhead.hcrc&&U.pending>R&&($.adler=s($.adler,U.pending_buf,U.pending-R,R)),_($),R=U.pending,U.pending===U.pending_buf_size)){J=1;break}J=U.gzindexR&&($.adler=s($.adler,U.pending_buf,U.pending-R,R)),J===0&&(U.status=103)}else U.status=103;if(U.status===103&&(U.gzhead.hcrc?(U.pending+2>U.pending_buf_size&&_($),U.pending+2<=U.pending_buf_size&&(oe(U,255&$.adler),oe(U,$.adler>>8&255),$.adler=0,U.status=N)):U.status=N),U.pending!==0){if(_($),$.avail_out===0)return U.last_flush=-1,f}else if($.avail_in===0&&T(ae)<=T(ce)&&ae!==c)return I($,-5);if(U.status===666&&$.avail_in!==0)return I($,-5);if($.avail_in!==0||U.lookahead!==0||ae!==u&&U.status!==666){var ie=U.strategy===2?function(re,Ee){for(var Ce;;){if(re.lookahead===0&&(fe(re),re.lookahead===0)){if(Ee===u)return D;break}if(re.match_length=0,Ce=a._tr_tally(re,0,re.window[re.strstart]),re.lookahead--,re.strstart++,Ce&&(Y(re,!1),re.strm.avail_out===0))return D}return re.insert=0,Ee===c?(Y(re,!0),re.strm.avail_out===0?q:z):re.last_lit&&(Y(re,!1),re.strm.avail_out===0)?D:P}(U,ae):U.strategy===3?function(re,Ee){for(var Ce,_e,he,ze,Ye=re.window;;){if(re.lookahead<=j){if(fe(re),re.lookahead<=j&&Ee===u)return D;if(re.lookahead===0)break}if(re.match_length=0,re.lookahead>=k&&0re.lookahead&&(re.match_length=re.lookahead)}if(re.match_length>=k?(Ce=a._tr_tally(re,1,re.match_length-k),re.lookahead-=re.match_length,re.strstart+=re.match_length,re.match_length=0):(Ce=a._tr_tally(re,0,re.window[re.strstart]),re.lookahead--,re.strstart++),Ce&&(Y(re,!1),re.strm.avail_out===0))return D}return re.insert=0,Ee===c?(Y(re,!0),re.strm.avail_out===0?q:z):re.last_lit&&(Y(re,!1),re.strm.avail_out===0)?D:P}(U,ae):n[U.level].func(U,ae);if(ie!==q&&ie!==z||(U.status=666),ie===D||ie===q)return $.avail_out===0&&(U.last_flush=-1),f;if(ie===P&&(ae===1?a._tr_align(U):ae!==5&&(a._tr_stored_block(U,0,0,!1),ae===3&&(L(U.head),U.lookahead===0&&(U.strstart=0,U.block_start=0,U.insert=0))),_($),$.avail_out===0))return U.last_flush=-1,f}return ae!==c?f:U.wrap<=0?1:(U.wrap===2?(oe(U,255&$.adler),oe(U,$.adler>>8&255),oe(U,$.adler>>16&255),oe(U,$.adler>>24&255),oe(U,255&$.total_in),oe(U,$.total_in>>8&255),oe(U,$.total_in>>16&255),oe(U,$.total_in>>24&255)):(te(U,$.adler>>>16),te(U,65535&$.adler)),_($),0=ce.w_size&&(J===0&&(L(ce.head),ce.strstart=0,ce.block_start=0,ce.insert=0),Ee=new i.Buf8(ce.w_size),i.arraySet(Ee,ae,Ce-ce.w_size,ce.w_size,0),ae=Ee,Ce=ce.w_size),ee=$.avail_in,ie=$.next_in,re=$.input,$.avail_in=Ce,$.next_in=0,$.input=ae,fe(ce);ce.lookahead>=k;){for(U=ce.strstart,R=ce.lookahead-(k-1);ce.ins_h=(ce.ins_h<>>=k=S>>>24,A-=k,(k=S>>>16&255)===0)P[l++]=65535&S;else{if(!(16&k)){if((64&k)==0){S=b[(65535&S)+(g&(1<>>=k,A-=k),A<15&&(g+=D[o++]<>>=k=S>>>24,A-=k,!(16&(k=S>>>16&255))){if((64&k)==0){S=v[(65535&S)+(g&(1<>>=k,A-=k,(k=l-u)>3,g&=(1<<(A-=j<<3))-1,n.next_in=o,n.next_out=l,n.avail_in=o>>24&255)+(C>>>8&65280)+((65280&C)<<8)+((255&C)<<24)}function g(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new n.Buf16(320),this.work=new n.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function A(C){var N;return C&&C.state?(N=C.state,C.total_in=C.total_out=N.total=0,C.msg="",N.wrap&&(C.adler=1&N.wrap),N.mode=d,N.last=0,N.havedict=0,N.dmax=32768,N.head=null,N.hold=0,N.bits=0,N.lencode=N.lendyn=new n.Buf32(p),N.distcode=N.distdyn=new n.Buf32(h),N.sane=1,N.back=-1,c):f}function b(C){var N;return C&&C.state?((N=C.state).wsize=0,N.whave=0,N.wnext=0,A(C)):f}function v(C,N){var D,P;return C&&C.state?(P=C.state,N<0?(D=0,N=-N):(D=1+(N>>4),N<48&&(N&=15)),N&&(N<8||15=z.wsize?(n.arraySet(z.window,N,D-z.wsize,z.wsize,0),z.wnext=0,z.whave=z.wsize):(P<(q=z.wsize-z.wnext)&&(q=P),n.arraySet(z.window,N,D-P,q,z.wnext),(P-=q)?(n.arraySet(z.window,N,D-P,P,0),z.wnext=P,z.whave=z.wsize):(z.wnext+=q,z.wnext===z.wsize&&(z.wnext=0),z.whave>>8&255,D.check=a(D.check,J,2,0),Y=_=0,D.mode=2;break}if(D.flags=0,D.head&&(D.head.done=!1),!(1&D.wrap)||(((255&_)<<8)+(_>>8))%31){C.msg="incorrect header check",D.mode=30;break}if((15&_)!=8){C.msg="unknown compression method",D.mode=30;break}if(Y-=4,$=8+(15&(_>>>=4)),D.wbits===0)D.wbits=$;else if($>D.wbits){C.msg="invalid window size",D.mode=30;break}D.dmax=1<<$,C.adler=D.check=1,D.mode=512&_?10:12,Y=_=0;break;case 2:for(;Y<16;){if(T===0)break e;T--,_+=P[z++]<>8&1),512&D.flags&&(J[0]=255&_,J[1]=_>>>8&255,D.check=a(D.check,J,2,0)),Y=_=0,D.mode=3;case 3:for(;Y<32;){if(T===0)break e;T--,_+=P[z++]<>>8&255,J[2]=_>>>16&255,J[3]=_>>>24&255,D.check=a(D.check,J,4,0)),Y=_=0,D.mode=4;case 4:for(;Y<16;){if(T===0)break e;T--,_+=P[z++]<>8),512&D.flags&&(J[0]=255&_,J[1]=_>>>8&255,D.check=a(D.check,J,2,0)),Y=_=0,D.mode=5;case 5:if(1024&D.flags){for(;Y<16;){if(T===0)break e;T--,_+=P[z++]<>>8&255,D.check=a(D.check,J,2,0)),Y=_=0}else D.head&&(D.head.extra=null);D.mode=6;case 6:if(1024&D.flags&&(T<(Q=D.length)&&(Q=T),Q&&(D.head&&($=D.head.extra_len-D.length,D.head.extra||(D.head.extra=new Array(D.head.extra_len)),n.arraySet(D.head.extra,P,z,Q,$)),512&D.flags&&(D.check=a(D.check,P,Q,z)),T-=Q,z+=Q,D.length-=Q),D.length))break e;D.length=0,D.mode=7;case 7:if(2048&D.flags){if(T===0)break e;for(Q=0;$=P[z+Q++],D.head&&$&&D.length<65536&&(D.head.name+=String.fromCharCode($)),$&&Q>9&1,D.head.done=!0),C.adler=D.check=0,D.mode=12;break;case 10:for(;Y<32;){if(T===0)break e;T--,_+=P[z++]<>>=7&Y,Y-=7&Y,D.mode=27;break}for(;Y<3;){if(T===0)break e;T--,_+=P[z++]<>>=1)){case 0:D.mode=14;break;case 1:if(j(D),D.mode=20,N!==6)break;_>>>=2,Y-=2;break e;case 2:D.mode=17;break;case 3:C.msg="invalid block type",D.mode=30}_>>>=2,Y-=2;break;case 14:for(_>>>=7&Y,Y-=7&Y;Y<32;){if(T===0)break e;T--,_+=P[z++]<>>16^65535)){C.msg="invalid stored block lengths",D.mode=30;break}if(D.length=65535&_,Y=_=0,D.mode=15,N===6)break e;case 15:D.mode=16;case 16:if(Q=D.length){if(T>>=5,Y-=5,D.ndist=1+(31&_),_>>>=5,Y-=5,D.ncode=4+(15&_),_>>>=4,Y-=4,286>>=3,Y-=3}for(;D.have<19;)D.lens[ee[D.have++]]=0;if(D.lencode=D.lendyn,D.lenbits=7,ce={bits:D.lenbits},ae=s(0,D.lens,0,19,D.lencode,0,D.work,ce),D.lenbits=ce.bits,ae){C.msg="invalid code lengths set",D.mode=30;break}D.have=0,D.mode=19;case 19:for(;D.have>>16&255,ve=65535&R,!((Se=R>>>24)<=Y);){if(T===0)break e;T--,_+=P[z++]<>>=Se,Y-=Se,D.lens[D.have++]=ve;else{if(ve===16){for(U=Se+2;Y>>=Se,Y-=Se,D.have===0){C.msg="invalid bit length repeat",D.mode=30;break}$=D.lens[D.have-1],Q=3+(3&_),_>>>=2,Y-=2}else if(ve===17){for(U=Se+3;Y>>=Se)),_>>>=3,Y-=3}else{for(U=Se+7;Y>>=Se)),_>>>=7,Y-=7}if(D.have+Q>D.nlen+D.ndist){C.msg="invalid bit length repeat",D.mode=30;break}for(;Q--;)D.lens[D.have++]=$}}if(D.mode===30)break;if(D.lens[256]===0){C.msg="invalid code -- missing end-of-block",D.mode=30;break}if(D.lenbits=9,ce={bits:D.lenbits},ae=s(l,D.lens,0,D.nlen,D.lencode,0,D.work,ce),D.lenbits=ce.bits,ae){C.msg="invalid literal/lengths set",D.mode=30;break}if(D.distbits=6,D.distcode=D.distdyn,ce={bits:D.distbits},ae=s(u,D.lens,D.nlen,D.ndist,D.distcode,0,D.work,ce),D.distbits=ce.bits,ae){C.msg="invalid distances set",D.mode=30;break}if(D.mode=20,N===6)break e;case 20:D.mode=21;case 21:if(6<=T&&258<=L){C.next_out=I,C.avail_out=L,C.next_in=z,C.avail_in=T,D.hold=_,D.bits=Y,o(C,te),I=C.next_out,q=C.output,L=C.avail_out,z=C.next_in,P=C.input,T=C.avail_in,_=D.hold,Y=D.bits,D.mode===12&&(D.back=-1);break}for(D.back=0;Oe=(R=D.lencode[_&(1<>>16&255,ve=65535&R,!((Se=R>>>24)<=Y);){if(T===0)break e;T--,_+=P[z++]<>ye)])>>>16&255,ve=65535&R,!(ye+(Se=R>>>24)<=Y);){if(T===0)break e;T--,_+=P[z++]<>>=ye,Y-=ye,D.back+=ye}if(_>>>=Se,Y-=Se,D.back+=Se,D.length=ve,Oe===0){D.mode=26;break}if(32&Oe){D.back=-1,D.mode=12;break}if(64&Oe){C.msg="invalid literal/length code",D.mode=30;break}D.extra=15&Oe,D.mode=22;case 22:if(D.extra){for(U=D.extra;Y>>=D.extra,Y-=D.extra,D.back+=D.extra}D.was=D.length,D.mode=23;case 23:for(;Oe=(R=D.distcode[_&(1<>>16&255,ve=65535&R,!((Se=R>>>24)<=Y);){if(T===0)break e;T--,_+=P[z++]<>ye)])>>>16&255,ve=65535&R,!(ye+(Se=R>>>24)<=Y);){if(T===0)break e;T--,_+=P[z++]<>>=ye,Y-=ye,D.back+=ye}if(_>>>=Se,Y-=Se,D.back+=Se,64&Oe){C.msg="invalid distance code",D.mode=30;break}D.offset=ve,D.extra=15&Oe,D.mode=24;case 24:if(D.extra){for(U=D.extra;Y>>=D.extra,Y-=D.extra,D.back+=D.extra}if(D.offset>D.dmax){C.msg="invalid distance too far back",D.mode=30;break}D.mode=25;case 25:if(L===0)break e;if(Q=te-L,D.offset>Q){if((Q=D.offset-Q)>D.whave&&D.sane){C.msg="invalid distance too far back",D.mode=30;break}fe=Q>D.wnext?(Q-=D.wnext,D.wsize-Q):D.wnext-Q,Q>D.length&&(Q=D.length),Ie=D.window}else Ie=q,fe=I-D.offset,Q=D.length;for(Lw?(k=fe[Ie+h[N]],Y[oe+h[N]]):(k=96,0),g=1<>I)+(A-=g)]=S<<24|k<<16|j|0,A!==0;);for(g=1<>=1;if(g!==0?(_&=g-1,_+=g):_=0,N++,--te[C]==0){if(C===P)break;C=u[c+h[N]]}if(q>>7)]}function oe(R,J){R.pending_buf[R.pending++]=255&J,R.pending_buf[R.pending++]=J>>>8&255}function te(R,J,ee){R.bi_valid>m-ee?(R.bi_buf|=J<>m-R.bi_valid,R.bi_valid+=ee-m):(R.bi_buf|=J<>>=1,ee<<=1,0<--J;);return ee>>>1}function Ie(R,J,ee){var ie,re,Ee=new Array(h+1),Ce=0;for(ie=1;ie<=h;ie++)Ee[ie]=Ce=Ce+ee[ie-1]<<1;for(re=0;re<=J;re++){var _e=R[2*re+1];_e!==0&&(R[2*re]=fe(Ee[_e]++,_e))}}function Se(R){var J;for(J=0;J>1;1<=ee;ee--)ye(R,Ee,ee);for(re=he;ee=R.heap[1],R.heap[1]=R.heap[R.heap_len--],ye(R,Ee,1),ie=R.heap[1],R.heap[--R.heap_max]=ee,R.heap[--R.heap_max]=ie,Ee[2*re]=Ee[2*ee]+Ee[2*ie],R.depth[re]=(R.depth[ee]>=R.depth[ie]?R.depth[ee]:R.depth[ie])+1,Ee[2*ee+1]=Ee[2*ie+1]=re,R.heap[1]=re++,ye(R,Ee,1),2<=R.heap_len;);R.heap[--R.heap_max]=R.heap[1],function(Ye,tt){var Ct,we,Be,Le,Ze,He,Qe=tt.dyn_tree,et=tt.max_code,Ge=tt.stat_desc.static_tree,G=tt.stat_desc.has_stree,ue=tt.stat_desc.extra_bits,Pe=tt.stat_desc.extra_base,De=tt.stat_desc.max_length,at=0;for(Le=0;Le<=h;Le++)Ye.bl_count[Le]=0;for(Qe[2*Ye.heap[Ye.heap_max]+1]=0,Ct=Ye.heap_max+1;Ct>=7;re>>=1)if(1&ze&&_e.dyn_ltree[2*he]!==0)return i;if(_e.dyn_ltree[18]!==0||_e.dyn_ltree[20]!==0||_e.dyn_ltree[26]!==0)return a;for(he=32;he>>3,(Ee=R.static_len+3+7>>>3)<=re&&(re=Ee)):re=Ee=ee+5,ee+4<=re&&J!==-1?U(R,J,ee,ie):R.strategy===4||Ee===re?(te(R,2+(ie?1:0),3),me(R,O,C)):(te(R,4+(ie?1:0),3),function(_e,he,ze,Ye){var tt;for(te(_e,he-257,5),te(_e,ze-1,5),te(_e,Ye-4,4),tt=0;tt>>8&255,R.pending_buf[R.d_buf+2*R.last_lit+1]=255&J,R.pending_buf[R.l_buf+R.last_lit]=255&ee,R.last_lit++,J===0?R.dyn_ltree[2*ee]++:(R.matches++,J--,R.dyn_ltree[2*(D[ee]+u+1)]++,R.dyn_dtree[2*Y(J)]++),R.last_lit===R.lit_bufsize-1},r._tr_align=function(R){te(R,2,3),Q(R,A,O),function(J){J.bi_valid===16?(oe(J,J.bi_buf),J.bi_buf=0,J.bi_valid=0):8<=J.bi_valid&&(J.pending_buf[J.pending++]=255&J.bi_buf,J.bi_buf>>=8,J.bi_valid-=8)}(R)}},{"../utils/common":41}],53:[function(e,t,r){"use strict";t.exports=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}},{}],54:[function(e,t,r){(function(n){(function(i,a){"use strict";if(!i.setImmediate){var o,s,l,u,c=1,f={},d=!1,p=i.document,h=Object.getPrototypeOf&&Object.getPrototypeOf(i);h=h&&h.setTimeout?h:i,o={}.toString.call(i.process)==="[object process]"?function(b){process.nextTick(function(){g(b)})}:function(){if(i.postMessage&&!i.importScripts){var b=!0,v=i.onmessage;return i.onmessage=function(){b=!1},i.postMessage("","*"),i.onmessage=v,b}}()?(u="setImmediate$"+Math.random()+"$",i.addEventListener?i.addEventListener("message",A,!1):i.attachEvent("onmessage",A),function(b){i.postMessage(u+b,"*")}):i.MessageChannel?((l=new MessageChannel).port1.onmessage=function(b){g(b.data)},function(b){l.port2.postMessage(b)}):p&&"onreadystatechange"in p.createElement("script")?(s=p.documentElement,function(b){var v=p.createElement("script");v.onreadystatechange=function(){g(b),v.onreadystatechange=null,s.removeChild(v),v=null},s.appendChild(v)}):function(b){setTimeout(g,0,b)},h.setImmediate=function(b){typeof b!="function"&&(b=new Function(""+b));for(var v=new Array(arguments.length-1),x=0;x"u"?n===void 0?this:n:self)}).call(this,typeof global<"u"?global:typeof self<"u"?self:typeof window<"u"?window:{})},{}]},{},[10])(10)})});var gOe=vn((v7,Nb)=>{var A7=void 0,g7=function(e){return A7||(A7=new Promise(function(t,r){var n=typeof e<"u"?e:{},i=n.onAbort;n.onAbort=function(W){r(new Error(W)),i&&i(W)},n.postRun=n.postRun||[],n.postRun.push(function(){t(n)}),Nb=void 0;var a;a||(a=typeof n<"u"?n:{}),a.onRuntimeInitialized=function(){function W(Ve,ft){switch(typeof ft){case"boolean":bm(Ve,ft?1:0);break;case"number":_E(Ve,ft);break;case"string":Jb(Ve,ft,-1,-1);break;case"object":if(ft===null)Kb(Ve);else if(ft.length!=null){var Jt=Tg(ft);$g(Ve,Jt,ft.length,-1),_g(Jt)}else tA(Ve,"Wrong API use : tried to return a value of an unknown type ("+ft+").",-1);break;default:Kb(Ve)}}function K(Ve,ft){for(var Jt=[],hr=0;hr>>0),Ve!=null){var ft=this.filename,Jt="/",hr=ft;if(Jt&&(Jt=typeof Jt=="string"?Jt:Zt(Jt),hr=ft?Ce(Jt+"/"+ft):Jt),ft=kn(!0,!0),hr=Am(hr,(ft!==void 0?ft:438)&4095|32768,0),Ve){if(typeof Ve=="string"){Jt=Array(Ve.length);for(var Ur=0,Dn=Ve.length;Ur{g||(m=require("fs"),g=require("path"))},d=function(W,K){return A(),W=g.normalize(W),m.readFileSync(W,K?void 0:"utf8")},h=W=>(W=d(W,!0),W.buffer||(W=new Uint8Array(W)),W),p=(W,K,se)=>{A(),W=g.normalize(W),m.readFile(W,function(xe,je){xe?se(xe):K(je.buffer)})},1{var K=new XMLHttpRequest;return K.open("GET",W,!1),K.send(null),K.responseText},u&&(h=W=>{var K=new XMLHttpRequest;return K.open("GET",W,!1),K.responseType="arraybuffer",K.send(null),new Uint8Array(K.response)}),p=(W,K,se)=>{var xe=new XMLHttpRequest;xe.open("GET",W,!0),xe.responseType="arraybuffer",xe.onload=()=>{xe.status==200||xe.status==0&&xe.response?K(xe.response):se()},xe.onerror=se,xe.send(null)});var b=a.print||console.log.bind(console),v=a.printErr||console.warn.bind(console);Object.assign(a,o),o=null,a.thisProgram&&(s=a.thisProgram);var x;a.wasmBinary&&(x=a.wasmBinary);var w=a.noExitRuntime||!0;typeof WebAssembly!="object"&&me("no native wasm support detected");var S,k=!1,j=typeof TextDecoder<"u"?new TextDecoder("utf8"):void 0;function O(W,K,se){var xe=K+se;for(se=K;W[se]&&!(se>=xe);)++se;if(16je?xe+=String.fromCharCode(je):(je-=65536,xe+=String.fromCharCode(55296|je>>10,56320|je&1023))}}else xe+=String.fromCharCode(je)}return xe}function C(W,K){return W?O(z,W,K):""}function N(W,K,se,xe){if(!(0=ot){var xr=W.charCodeAt(++Ke);ot=65536+((ot&1023)<<10)|xr&1023}if(127>=ot){if(se>=xe)break;K[se++]=ot}else{if(2047>=ot){if(se+1>=xe)break;K[se++]=192|ot>>6}else{if(65535>=ot){if(se+2>=xe)break;K[se++]=224|ot>>12}else{if(se+3>=xe)break;K[se++]=240|ot>>18,K[se++]=128|ot>>12&63}K[se++]=128|ot>>6&63}K[se++]=128|ot&63}}return K[se]=0,se-je}function D(W){for(var K=0,se=0;se=xe?K++:2047>=xe?K+=2:55296<=xe&&57343>=xe?(K+=4,++se):K+=3}return K}var P,q,z,I,T,L,_,Y;function oe(){var W=S.buffer;P=W,a.HEAP8=q=new Int8Array(W),a.HEAP16=I=new Int16Array(W),a.HEAP32=T=new Int32Array(W),a.HEAPU8=z=new Uint8Array(W),a.HEAPU16=new Uint16Array(W),a.HEAPU32=L=new Uint32Array(W),a.HEAPF32=_=new Float32Array(W),a.HEAPF64=Y=new Float64Array(W)}var te,Q=[],fe=[],Ie=[];function Se(){var W=a.preRun.shift();Q.unshift(W)}var Oe=0,ve=null,ye=null;function me(W){throw a.onAbort&&a.onAbort(W),W="Aborted("+W+")",v(W),k=!0,new WebAssembly.RuntimeError(W+". Build with -sASSERTIONS for more info.")}function ke(){return $.startsWith("data:application/octet-stream;base64,")}var $;if($="sql-wasm.wasm",!ke()){var ae=$;$=a.locateFile?a.locateFile(ae,f):f+ae}function ce(){var W=$;try{if(W==$&&x)return new Uint8Array(x);if(h)return h(W);throw"both async and sync fetching of the wasm failed"}catch(K){me(K)}}function U(){if(!x&&(l||u)){if(typeof fetch=="function"&&!$.startsWith("file://"))return fetch($,{credentials:"same-origin"}).then(function(W){if(!W.ok)throw"failed to load wasm binary file at '"+$+"'";return W.arrayBuffer()}).catch(function(){return ce()});if(p)return new Promise(function(W,K){p($,function(se){W(new Uint8Array(se))},K)})}return Promise.resolve().then(function(){return ce()})}var R,J;function ee(W){for(;0>0];case"i8":return q[W>>0];case"i16":return I[W>>1];case"i32":return T[W>>2];case"i64":return T[W>>2];case"float":return _[W>>2];case"double":return Y[W>>3];case"*":return L[W>>2];default:me("invalid type for getValue: "+K)}return null}function re(W){var K="i32";switch(K.endsWith("*")&&(K="*"),K){case"i1":q[W>>0]=0;break;case"i8":q[W>>0]=0;break;case"i16":I[W>>1]=0;break;case"i32":T[W>>2]=0;break;case"i64":J=[0,(R=0,1<=+Math.abs(R)?0>>0:~~+Math.ceil((R-+(~~R>>>0))/4294967296)>>>0:0)],T[W>>2]=J[0],T[W+4>>2]=J[1];break;case"float":_[W>>2]=0;break;case"double":Y[W>>3]=0;break;case"*":L[W>>2]=0;break;default:me("invalid type for setValue: "+K)}}var Ee=(W,K)=>{for(var se=0,xe=W.length-1;0<=xe;xe--){var je=W[xe];je==="."?W.splice(xe,1):je===".."?(W.splice(xe,1),se++):se&&(W.splice(xe,1),se--)}if(K)for(;se;se--)W.unshift("..");return W},Ce=W=>{var K=W.charAt(0)==="/",se=W.substr(-1)==="/";return(W=Ee(W.split("/").filter(xe=>!!xe),!K).join("/"))||K||(W="."),W&&se&&(W+="/"),(K?"/":"")+W},_e=W=>{var K=/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/.exec(W).slice(1);return W=K[0],K=K[1],!W&&!K?".":(K&&(K=K.substr(0,K.length-1)),W+K)},he=W=>{if(W==="/")return"/";W=Ce(W),W=W.replace(/\/$/,"");var K=W.lastIndexOf("/");return K===-1?W:W.substr(K+1)};function ze(){if(typeof crypto=="object"&&typeof crypto.getRandomValues=="function"){var W=new Uint8Array(1);return()=>(crypto.getRandomValues(W),W[0])}if(c)try{var K=require("crypto");return()=>K.randomBytes(1)[0]}catch{}return()=>me("randomDevice")}function Ye(){for(var W="",K=!1,se=arguments.length-1;-1<=se&&!K;se--){if(K=0<=se?arguments[se]:"/",typeof K!="string")throw new TypeError("Arguments to path.resolve must be strings");if(!K)return"";W=K+"/"+W,K=K.charAt(0)==="/"}return W=Ee(W.split("/").filter(xe=>!!xe),!K).join("/"),(K?"/":"")+W||"."}function tt(W,K){var se=Array(D(W)+1);return W=N(W,se,0,se.length),K&&(se.length=W),se}var Ct=[];function we(W,K){Ct[W]={input:[],output:[],Xa:K},Yr(W,Be)}var Be={open:function(W){var K=Ct[W.node.rdev];if(!K)throw new De(43);W.tty=K,W.seekable=!1},close:function(W){W.tty.Xa.fsync(W.tty)},fsync:function(W){W.tty.Xa.fsync(W.tty)},read:function(W,K,se,xe){if(!W.tty||!W.tty.Xa.tb)throw new De(60);for(var je=0,Ke=0;Ke<\/script>",e=e.removeChild(e.firstChild)):typeof n.is=="string"?e=o.createElement(r,{is:n.is}):(e=o.createElement(r),r==="select"&&(o=e,n.multiple?o.multiple=!0:n.size&&(o.size=n.size))):e=o.createElementNS(e,r),e[qm]=t,e[y6]=n,xae(e,t,!1,!1),t.stateNode=e;e:{switch(o=oz(r,n),r){case"dialog":Ea("cancel",e),Ea("close",e),i=n;break;case"iframe":case"object":case"embed":Ea("load",e),i=n;break;case"video":case"audio":for(i=0;iFw&&(t.flags|=128,n=!0,Gk(a,!1),t.lanes=4194304)}else{if(!n)if(e=sN(o),e!==null){if(t.flags|=128,n=!0,r=e.updateQueue,r!==null&&(t.updateQueue=r,t.flags|=4),Gk(a,!0),a.tail===null&&a.tailMode==="hidden"&&!o.alternate&&!$a)return eu(t),null}else 2*jo()-a.renderingStartTime>Fw&&r!==1073741824&&(t.flags|=128,n=!0,Gk(a,!1),t.lanes=4194304);a.isBackwards?(o.sibling=t.child,t.child=o):(r=a.last,r!==null?r.sibling=o:t.child=o,a.last=o)}return a.tail!==null?(t=a.tail,a.rendering=t,a.tail=t.sibling,a.renderingStartTime=jo(),t.sibling=null,r=Ka.current,fa(Ka,n?r&1|2:r&1),t):(eu(t),null);case 22:case 23:return EU(),n=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==n&&(t.flags|=8192),n&&(t.mode&1)!==0?(cf&1073741824)!==0&&(eu(t),t.subtreeFlags&6&&(t.flags|=8192)):eu(t),null;case 24:return null;case 25:return null}throw Error(xt(156,t.tag))}function v5e(e,t){switch(iU(t),t.tag){case 1:return vc(t.type)&&eN(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Nw(),ka(gc),ka(ru),pU(),e=t.flags,(e&65536)!==0&&(e&128)===0?(t.flags=e&-65537|128,t):null;case 5:return dU(t),null;case 13:if(ka(Ka),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(xt(340));Mw()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return ka(Ka),null;case 4:return Nw(),null;case 10:return lU(t.type._context),null;case 22:case 23:return EU(),null;case 24:return null;default:return null}}var Fj=!1,tu=!1,y5e=typeof WeakSet=="function"?WeakSet:Set,Gt=null;function yw(e,t){var r=e.ref;if(r!==null)if(typeof r=="function")try{r(null)}catch(n){go(e,t,n)}else r.current=null}function Fz(e,t,r){try{r()}catch(n){go(e,t,n)}}var Nne=!1;function b5e(e,t){if(Az=Zj,e=Die(),rU(e)){if("selectionStart"in e)var r={start:e.selectionStart,end:e.selectionEnd};else e:{r=(r=e.ownerDocument)&&r.defaultView||window;var n=r.getSelection&&r.getSelection();if(n&&n.rangeCount!==0){r=n.anchorNode;var i=n.anchorOffset,a=n.focusNode;n=n.focusOffset;try{r.nodeType,a.nodeType}catch{r=null;break e}var o=0,s=-1,l=-1,u=0,c=0,f=e,d=null;t:for(;;){for(var p;f!==r||i!==0&&f.nodeType!==3||(s=o+i),f!==a||n!==0&&f.nodeType!==3||(l=o+n),f.nodeType===3&&(o+=f.nodeValue.length),(p=f.firstChild)!==null;)d=f,f=p;for(;;){if(f===e)break t;if(d===r&&++u===i&&(s=o),d===a&&++c===n&&(l=o),(p=f.nextSibling)!==null)break;f=d,d=f.parentNode}f=p}r=s===-1||l===-1?null:{start:s,end:l}}else r=null}r=r||{start:0,end:0}}else r=null;for(gz={focusedElem:e,selectionRange:r},Zj=!1,Gt=t;Gt!==null;)if(t=Gt,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,Gt=e;else for(;Gt!==null;){t=Gt;try{var h=t.alternate;if((t.flags&1024)!==0)switch(t.tag){case 0:case 11:case 15:break;case 1:if(h!==null){var m=h.memoizedProps,g=h.memoizedState,A=t.stateNode,b=A.getSnapshotBeforeUpdate(t.elementType===t.type?m:Dp(t.type,m),g);A.__reactInternalSnapshotBeforeUpdate=b}break;case 3:var v=t.stateNode.containerInfo;v.nodeType===1?v.textContent="":v.nodeType===9&&v.documentElement&&v.removeChild(v.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(xt(163))}}catch(x){go(t,t.return,x)}if(e=t.sibling,e!==null){e.return=t.return,Gt=e;break}Gt=t.return}return h=Nne,Nne=!1,h}function o6(e,t,r){var n=t.updateQueue;if(n=n!==null?n.lastEffect:null,n!==null){var i=n=n.next;do{if((i.tag&e)===e){var a=i.destroy;i.destroy=void 0,a!==void 0&&Fz(t,r,a)}i=i.next}while(i!==n)}}function SN(e,t){if(t=t.updateQueue,t=t!==null?t.lastEffect:null,t!==null){var r=t=t.next;do{if((r.tag&e)===e){var n=r.create;r.destroy=n()}r=r.next}while(r!==t)}}function _z(e){var t=e.ref;if(t!==null){var r=e.stateNode;switch(e.tag){case 5:e=r;break;default:e=r}typeof t=="function"?t(e):t.current=e}}function Eae(e){var t=e.alternate;t!==null&&(e.alternate=null,Eae(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[qm],delete t[y6],delete t[bz],delete t[r5e],delete t[n5e])),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}function kae(e){return e.tag===5||e.tag===3||e.tag===4}function Tne(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||kae(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function Pz(e,t,r){var n=e.tag;if(n===5||n===6)e=e.stateNode,t?r.nodeType===8?r.parentNode.insertBefore(e,t):r.insertBefore(e,t):(r.nodeType===8?(t=r.parentNode,t.insertBefore(e,r)):(t=r,t.appendChild(e)),r=r._reactRootContainer,r!=null||t.onclick!==null||(t.onclick=Jj));else if(n!==4&&(e=e.child,e!==null))for(Pz(e,t,r),e=e.sibling;e!==null;)Pz(e,t,r),e=e.sibling}function Iz(e,t,r){var n=e.tag;if(n===5||n===6)e=e.stateNode,t?r.insertBefore(e,t):r.appendChild(e);else if(n!==4&&(e=e.child,e!==null))for(Iz(e,t,r),e=e.sibling;e!==null;)Iz(e,t,r),e=e.sibling}var gl=null,Op=!1;function h0(e,t,r){for(r=r.child;r!==null;)Cae(e,t,r),r=r.sibling}function Cae(e,t,r){if(Lm&&typeof Lm.onCommitFiberUnmount=="function")try{Lm.onCommitFiberUnmount(hN,r)}catch{}switch(r.tag){case 5:tu||yw(r,t);case 6:var n=gl,i=Op;gl=null,h0(e,t,r),gl=n,Op=i,gl!==null&&(Op?(e=gl,r=r.stateNode,e.nodeType===8?e.parentNode.removeChild(r):e.removeChild(r)):gl.removeChild(r.stateNode));break;case 18:gl!==null&&(Op?(e=gl,r=r.stateNode,e.nodeType===8?$L(e.parentNode,r):e.nodeType===1&&$L(e,r),m6(e)):$L(gl,r.stateNode));break;case 4:n=gl,i=Op,gl=r.stateNode.containerInfo,Op=!0,h0(e,t,r),gl=n,Op=i;break;case 0:case 11:case 14:case 15:if(!tu&&(n=r.updateQueue,n!==null&&(n=n.lastEffect,n!==null))){i=n=n.next;do{var a=i,o=a.destroy;a=a.tag,o!==void 0&&((a&2)!==0||(a&4)!==0)&&Fz(r,t,o),i=i.next}while(i!==n)}h0(e,t,r);break;case 1:if(!tu&&(yw(r,t),n=r.stateNode,typeof n.componentWillUnmount=="function"))try{n.props=r.memoizedProps,n.state=r.memoizedState,n.componentWillUnmount()}catch(s){go(r,t,s)}h0(e,t,r);break;case 21:h0(e,t,r);break;case 22:r.mode&1?(tu=(n=tu)||r.memoizedState!==null,h0(e,t,r),tu=n):h0(e,t,r);break;default:h0(e,t,r)}}function Fne(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var r=e.stateNode;r===null&&(r=e.stateNode=new y5e),t.forEach(function(n){var i=M5e.bind(null,e,n);r.has(n)||(r.add(n),n.then(i,i))})}}function Cp(e,t){var r=t.deletions;if(r!==null)for(var n=0;ni&&(i=o),n&=~a}if(n=i,n=jo()-n,n=(120>n?120:480>n?480:1080>n?1080:1920>n?1920:3e3>n?3e3:4320>n?4320:1960*w5e(n/1960))-n,10e?16:e,x0===null)var n=!1;else{if(e=x0,x0=null,dN=0,(ti&6)!==0)throw Error(xt(331));var i=ti;for(ti|=4,Gt=e.current;Gt!==null;){var a=Gt,o=a.child;if((Gt.flags&16)!==0){var s=a.deletions;if(s!==null){for(var l=0;ljo()-wU?J1(e,0):xU|=r),yc(e,t)}function _ae(e,t){t===0&&((e.mode&1)===0?t=1:(t=bj,bj<<=1,(bj&130023424)===0&&(bj=4194304)));var r=$u();e=_A(e,t),e!==null&&(C6(e,t,r),yc(e,r))}function O5e(e){var t=e.memoizedState,r=0;t!==null&&(r=t.retryLane),_ae(e,r)}function M5e(e,t){var r=0;switch(e.tag){case 13:var n=e.stateNode,i=e.memoizedState;i!==null&&(r=i.retryLane);break;case 19:n=e.stateNode;break;default:throw Error(xt(314))}n!==null&&n.delete(t),_ae(e,r)}var Pae;Pae=function(e,t,r){if(e!==null)if(e.memoizedProps!==t.pendingProps||gc.current)Ac=!0;else{if((e.lanes&r)===0&&(t.flags&128)===0)return Ac=!1,A5e(e,t,r);Ac=(e.flags&131072)!==0}else Ac=!1,$a&&(t.flags&1048576)!==0&&Rie(t,nN,t.index);switch(t.lanes=0,t.tag){case 2:var n=t.type;Lj(e,t),e=t.pendingProps;var i=Ow(t,ru.current);kw(t,r),i=hU(null,t,n,e,i,r);var a=AU();return t.flags|=1,typeof i=="object"&&i!==null&&typeof i.render=="function"&&i.$$typeof===void 0?(t.tag=1,t.memoizedState=null,t.updateQueue=null,vc(n)?(a=!0,tN(t)):a=!1,t.memoizedState=i.state!==null&&i.state!==void 0?i.state:null,cU(t),i.updater=xN,t.stateNode=i,i._reactInternals=t,Cz(t,n,e,r),t=Mz(null,t,n,!0,a,r)):(t.tag=0,$a&&a&&nU(t),Ru(null,t,i,r),t=t.child),t;case 16:n=t.elementType;e:{switch(Lj(e,t),e=t.pendingProps,i=n._init,n=i(n._payload),t.type=n,i=t.tag=N5e(n),e=Dp(n,e),i){case 0:t=Oz(null,t,n,e,r);break e;case 1:t=One(null,t,n,e,r);break e;case 11:t=Cne(null,t,n,e,r);break e;case 14:t=Dne(null,t,n,Dp(n.type,e),r);break e}throw Error(xt(306,n,""))}return t;case 0:return n=t.type,i=t.pendingProps,i=t.elementType===n?i:Dp(n,i),Oz(e,t,n,i,r);case 1:return n=t.type,i=t.pendingProps,i=t.elementType===n?i:Dp(n,i),One(e,t,n,i,r);case 3:e:{if(vae(t),e===null)throw Error(xt(387));n=t.pendingProps,a=t.memoizedState,i=a.element,zie(e,t),oN(t,n,null,r);var o=t.memoizedState;if(n=o.element,a.isDehydrated)if(a={element:n,isDehydrated:!1,cache:o.cache,pendingSuspenseBoundaries:o.pendingSuspenseBoundaries,transitions:o.transitions},t.updateQueue.baseState=a,t.memoizedState=a,t.flags&256){i=Tw(Error(xt(423)),t),t=Mne(e,t,n,r,i);break e}else if(n!==i){i=Tw(Error(xt(424)),t),t=Mne(e,t,n,r,i);break e}else for(ff=k0(t.stateNode.containerInfo.firstChild),df=t,$a=!0,Mp=null,r=Vie(t,null,n,r),t.child=r;r;)r.flags=r.flags&-3|4096,r=r.sibling;else{if(Mw(),n===i){t=PA(e,t,r);break e}Ru(e,t,n,r)}t=t.child}return t;case 5:return Gie(t),e===null&&Sz(t),n=t.type,i=t.pendingProps,a=e!==null?e.memoizedProps:null,o=i.children,vz(n,i)?o=null:a!==null&&vz(n,a)&&(t.flags|=32),gae(e,t),Ru(e,t,o,r),t.child;case 6:return e===null&&Sz(t),null;case 13:return yae(e,t,r);case 4:return fU(t,t.stateNode.containerInfo),n=t.pendingProps,e===null?t.child=jw(t,null,n,r):Ru(e,t,n,r),t.child;case 11:return n=t.type,i=t.pendingProps,i=t.elementType===n?i:Dp(n,i),Cne(e,t,n,i,r);case 7:return Ru(e,t,t.pendingProps,r),t.child;case 8:return Ru(e,t,t.pendingProps.children,r),t.child;case 12:return Ru(e,t,t.pendingProps.children,r),t.child;case 10:e:{if(n=t.type._context,i=t.pendingProps,a=t.memoizedProps,o=i.value,fa(iN,n._currentValue),n._currentValue=o,a!==null)if(Tp(a.value,o)){if(a.children===i.children&&!gc.current){t=PA(e,t,r);break e}}else for(a=t.child,a!==null&&(a.return=t);a!==null;){var s=a.dependencies;if(s!==null){o=a.child;for(var l=s.firstContext;l!==null;){if(l.context===n){if(a.tag===1){l=NA(-1,r&-r),l.tag=2;var u=a.updateQueue;if(u!==null){u=u.shared;var c=u.pending;c===null?l.next=l:(l.next=c.next,c.next=l),u.pending=l}}a.lanes|=r,l=a.alternate,l!==null&&(l.lanes|=r),Ez(a.return,r,t),s.lanes|=r;break}l=l.next}}else if(a.tag===10)o=a.type===t.type?null:a.child;else if(a.tag===18){if(o=a.return,o===null)throw Error(xt(341));o.lanes|=r,s=o.alternate,s!==null&&(s.lanes|=r),Ez(o,r,t),o=a.sibling}else o=a.child;if(o!==null)o.return=a;else for(o=a;o!==null;){if(o===t){o=null;break}if(a=o.sibling,a!==null){a.return=o.return,o=a;break}o=o.return}a=o}Ru(e,t,i.children,r),t=t.child}return t;case 9:return i=t.type,n=t.pendingProps.children,kw(t,r),i=xd(i),n=n(i),t.flags|=1,Ru(e,t,n,r),t.child;case 14:return n=t.type,i=Dp(n,t.pendingProps),i=Dp(n.type,i),Dne(e,t,n,i,r);case 15:return hae(e,t,t.type,t.pendingProps,r);case 17:return n=t.type,i=t.pendingProps,i=t.elementType===n?i:Dp(n,i),Lj(e,t),t.tag=1,vc(n)?(e=!0,tN(t)):e=!1,kw(t,r),Wie(t,n,i),Cz(t,n,i,r),Mz(null,t,n,!0,e,r);case 19:return bae(e,t,r);case 22:return Aae(e,t,r)}throw Error(xt(156,t.tag))};function Iae(e,t){return lie(e,t)}function j5e(e,t,r,n){this.tag=e,this.key=r,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=n,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function yd(e,t,r,n){return new j5e(e,t,r,n)}function CU(e){return e=e.prototype,!(!e||!e.isReactComponent)}function N5e(e){if(typeof e=="function")return CU(e)?1:0;if(e!=null){if(e=e.$$typeof,e===Hz)return 11;if(e===Vz)return 14}return 2}function M0(e,t){var r=e.alternate;return r===null?(r=yd(e.tag,t,e.key,e.mode),r.elementType=e.elementType,r.type=e.type,r.stateNode=e.stateNode,r.alternate=e,e.alternate=r):(r.pendingProps=t,r.type=e.type,r.flags=0,r.subtreeFlags=0,r.deletions=null),r.flags=e.flags&14680064,r.childLanes=e.childLanes,r.lanes=e.lanes,r.child=e.child,r.memoizedProps=e.memoizedProps,r.memoizedState=e.memoizedState,r.updateQueue=e.updateQueue,t=e.dependencies,r.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},r.sibling=e.sibling,r.index=e.index,r.ref=e.ref,r}function Wj(e,t,r,n,i,a){var o=2;if(n=e,typeof e=="function")CU(e)&&(o=1);else if(typeof e=="string")o=5;else e:switch(e){case cw:return ey(r.children,i,a,t);case Wz:o=8,i|=8;break;case ZL:return e=yd(12,r,t,i|2),e.elementType=ZL,e.lanes=a,e;case XL:return e=yd(13,r,t,i),e.elementType=XL,e.lanes=a,e;case KL:return e=yd(19,r,t,i),e.elementType=KL,e.lanes=a,e;case Hne:return kN(r,i,a,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case Une:o=10;break e;case Wne:o=9;break e;case Hz:o=11;break e;case Vz:o=14;break e;case A0:o=16,n=null;break e}throw Error(xt(130,e==null?e:typeof e,""))}return t=yd(o,r,t,i),t.elementType=e,t.type=n,t.lanes=a,t}function ey(e,t,r,n){return e=yd(7,e,n,t),e.lanes=r,e}function kN(e,t,r,n){return e=yd(22,e,n,t),e.elementType=Hne,e.lanes=r,e.stateNode={isHidden:!1},e}function GL(e,t,r){return e=yd(6,e,null,t),e.lanes=r,e}function QL(e,t,r){return t=yd(4,e.children!==null?e.children:[],e.key,t),t.lanes=r,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function T5e(e,t,r,n,i){this.tag=t,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=NL(0),this.expirationTimes=NL(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=NL(0),this.identifierPrefix=n,this.onRecoverableError=i,this.mutableSourceEagerHydrationData=null}function DU(e,t,r,n,i,a,o,s,l){return e=new T5e(e,t,r,s,l),t===1?(t=1,a===!0&&(t|=8)):t=0,a=yd(3,null,null,t),e.current=a,a.stateNode=e,a.memoizedState={element:n,isDehydrated:r,cache:null,transitions:null,pendingSuspenseBoundaries:null},cU(a),e}function F5e(e,t,r){var n=3{"use strict";function Lae(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(Lae)}catch(e){console.error(e)}}Lae(),zae.exports=qae()});var sT=vn((ZU,XU)=>{(function(e,t){typeof ZU=="object"&&typeof XU<"u"?XU.exports=t():typeof define=="function"&&define.amd?define(t):(e=typeof globalThis<"u"?globalThis:e||self,e["'typed'"]=t())})(ZU,function(){"use strict";function e(){return!0}function t(){return!1}function r(){}let n="Argument is not a typed-function.";function i(){function o(we){return typeof we=="object"&&we!==null&&we.constructor===Object}let s=[{name:"number",test:function(we){return typeof we=="number"}},{name:"string",test:function(we){return typeof we=="string"}},{name:"boolean",test:function(we){return typeof we=="boolean"}},{name:"Function",test:function(we){return typeof we=="function"}},{name:"Array",test:Array.isArray},{name:"Date",test:function(we){return we instanceof Date}},{name:"RegExp",test:function(we){return we instanceof RegExp}},{name:"Object",test:o},{name:"null",test:function(we){return we===null}},{name:"undefined",test:function(we){return we===void 0}}],l={name:"any",test:e,isAny:!0},u,c,f=0,d={createCount:0};function p(we){let Be=u.get(we);if(Be)return Be;let Le='Unknown type "'+we+'"',Ze=we.toLowerCase(),He;for(He of c)if(He.toLowerCase()===Ze){Le+='. Did you mean "'+He+'" ?';break}throw new TypeError(Le)}function h(we){let Be=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"any",Le=Be?p(Be).index:c.length,Ze=[];for(let Qe=0;Qe{let Ze=u.get(Le);return!Ze.isAny&&Ze.test(we)});return Be.length?Be:["any"]}function b(we){return we&&typeof we=="function"&&"_typedFunctionData"in we}function v(we,Be,Le){if(!b(we))throw new TypeError(n);let Ze=Le&&Le.exact,He=Array.isArray(Be)?Be.join(","):Be,Qe=C(He),et=S(Qe);if(!Ze||et in we.signatures){let Pe=we._typedFunctionData.signatureMap.get(et);if(Pe)return Pe}let Ge=Qe.length,G;if(Ze){G=[];let Pe;for(Pe in we.signatures)G.push(we._typedFunctionData.signatureMap.get(Pe))}else G=we._typedFunctionData.signatures;for(let Pe=0;Pe!Wr.has(en.name)))continue}at.push(ht)}}if(G=at,G.length===0)break}let ue;for(ue of G)if(ue.params.length<=Ge)return ue;throw new TypeError("Signature not found (signature: "+(we.name||"unnamed")+"("+S(Qe,", ")+"))")}function x(we,Be,Le){return v(we,Be,Le).implementation}function w(we,Be){let Le=p(Be);if(Le.test(we))return we;let Ze=Le.conversionsTo;if(Ze.length===0)throw new Error("There are no conversions to "+Be+" defined.");for(let He=0;He1&&arguments[1]!==void 0?arguments[1]:",";return we.map(Le=>Le.name).join(Be)}function k(we){let Be=we.indexOf("...")===0,Ze=(Be?we.length>3?we.slice(3):"any":we).split("|").map(Ge=>p(Ge.trim())),He=!1,Qe=Be?"...":"";return{types:Ze.map(function(Ge){return He=Ge.isAny||He,Qe+=Ge.name+"|",{name:Ge.name,typeIndex:Ge.index,test:Ge.test,isAny:Ge.isAny,conversion:null,conversionIndex:-1}}),name:Qe.slice(0,-1),hasAny:He,hasConversion:!1,restParam:Be}}function j(we){let Be=we.types.map(et=>et.name),Le=Q(Be),Ze=we.hasAny,He=we.name,Qe=Le.map(function(et){let Ge=p(et.from);return Ze=Ge.isAny||Ze,He+="|"+et.from,{name:et.from,typeIndex:Ge.index,test:Ge.test,isAny:Ge.isAny,conversion:et,conversionIndex:et.index}});return{types:we.types.concat(Qe),name:He,hasAny:Ze,hasConversion:Qe.length>0,restParam:we.restParam}}function O(we){return we.typeSet||(we.typeSet=new Set,we.types.forEach(Be=>we.typeSet.add(Be.name))),we.typeSet}function C(we){let Be=[];if(typeof we!="string")throw new TypeError("Signatures must be strings");let Le=we.trim();if(Le==="")return Be;let Ze=Le.split(",");for(let He=0;He=He+1}}else return we.length===0?function(Qe){return Qe.length===0}:we.length===1?(Le=D(we[0]),function(Qe){return Le(Qe[0])&&Qe.length===1}):we.length===2?(Le=D(we[0]),Ze=D(we[1]),function(Qe){return Le(Qe[0])&&Ze(Qe[1])&&Qe.length===2}):(Be=we.map(D),function(Qe){for(let et=0;et{let He=z(Ze.params,Be),Qe;for(Qe of He)Le.add(Qe)}),Le.has("any")?["any"]:Array.from(Le)}function L(we,Be,Le){let Ze,He,Qe=we||"unnamed",et=Le,Ge;for(Ge=0;Ge{let ht=q(at.params,Ge),Zt=D(ht);(Ge0){let at=A(Be[Ge]);return Ze=new TypeError("Unexpected type of argument in function "+Qe+" (expected: "+He.join(" or ")+", actual: "+at.join(" | ")+", index: "+Ge+")"),Ze.data={category:"wrongType",fn:Qe,index:Ge,actual:at,expected:He},Ze}}else et=De}let G=et.map(function(De){return N(De.params)?1/0:De.params.length});if(Be.lengthue)return Ze=new TypeError("Too many arguments in function "+Qe+" (expected: "+ue+", actual: "+Be.length+")"),Ze.data={category:"tooManyArgs",fn:Qe,index:Be.length,expectedLength:ue},Ze;let Pe=[];for(let De=0;De0)return 1;let Ze=Y(we)-Y(Be);return Ze<0?-1:Ze>0?1:0}function te(we,Be){let Le=we.params,Ze=Be.params,He=U(Le),Qe=U(Ze),et=N(Le),Ge=N(Ze);if(et&&He.hasAny){if(!Ge||!Qe.hasAny)return 1}else if(Ge&&Qe.hasAny)return-1;let G=0,ue=0,Pe;for(Pe of Le)Pe.hasAny&&++G,Pe.hasConversion&&++ue;let De=0,at=0;for(Pe of Ze)Pe.hasAny&&++De,Pe.hasConversion&&++at;if(G!==De)return G-De;if(et&&He.hasConversion){if(!Ge||!Qe.hasConversion)return 1}else if(Ge&&Qe.hasConversion)return-1;if(ue!==at)return ue-at;if(et){if(!Ge)return 1}else if(Ge)return-1;let ht=(Le.length-Ze.length)*(et?-1:1);if(ht!==0)return ht;let Zt=[],Wr=0;for(let tn=0;tn1&&Be.sort((He,Qe)=>He.index-Qe.index);let Le=Be[0].conversionsTo;if(we.length===1)return Le;Le=Le.concat([]);let Ze=new Set(we);for(let He=1;HeHe.hasConversion)){let He=N(we),Qe=we.map(Ie);Le=function(){let Ge=[],G=He?arguments.length-1:arguments.length;for(let ue=0;ueG.name).join("|"),hasAny:Ge.some(G=>G.isAny),hasConversion:!1,restParam:!0}),et.push(Qe)}else et=Qe.types.map(function(Ge){return{types:[Ge],name:Ge.name,hasAny:Ge.isAny,hasConversion:Ge.conversion,restParam:!1}});return ee(et,function(Ge){return Be(Le,Ze+1,He.concat([Ge]))})}else return[He]}return Be(we,0,[])}function Oe(we,Be){let Le=Math.max(we.length,Be.length);for(let Ge=0;Ge=Ze:et?Ze>=He:Ze===He}function ve(we){return we.map(Be=>_e(Be)?Ee(Be.referToSelf.callback):Ce(Be)?re(Be.referTo.references,Be.referTo.callback):Be)}function ye(we,Be,Le){let Ze=[],He;for(He of we){let Qe=Le[He];if(typeof Qe!="number")throw new TypeError('No definition for referenced signature "'+He+'"');if(Qe=Be[Qe],typeof Qe!="function")return!1;Ze.push(Qe)}return Ze}function me(we,Be,Le){let Ze=ve(we),He=new Array(Ze.length).fill(!1),Qe=!0;for(;Qe;){Qe=!1;let et=!0;for(let Ge=0;Ge{let Ze=we[Le];if(Be.test(Ze.toString()))throw new SyntaxError("Using `this` to self-reference a function is deprecated since typed-function@3. Use typed.referTo and typed.referToSelf instead.")})}function $(we,Be){if(d.createCount++,Object.keys(Be).length===0)throw new SyntaxError("No signatures provided");d.warnAgainstDeprecatedThis&&ke(Be);let Le=[],Ze=[],He={},Qe=[],et;for(et in Be){if(!Object.prototype.hasOwnProperty.call(Be,et))continue;let kn=C(et);if(!kn)continue;Le.forEach(function(sl){if(Oe(sl,kn))throw new TypeError('Conflicting signatures "'+S(sl)+'" and "'+S(kn)+'".')}),Le.push(kn);let Ia=Ze.length;Ze.push(Be[et]);let Qh=kn.map(j),Cn;for(Cn of Se(Qh)){let sl=S(Cn);Qe.push({params:Cn,name:sl,fn:Ia}),Cn.every(sp=>!sp.hasConversion)&&(He[sl]=Ia)}}Qe.sort(te);let Ge=me(Ze,He,Vf),G;for(G in He)Object.prototype.hasOwnProperty.call(He,G)&&(He[G]=Ge[He[G]]);let ue=[],Pe=new Map;for(G of Qe)Pe.has(G.name)||(G.fn=Ge[G.fn],ue.push(G),Pe.set(G.name,G));let De=ue[0]&&ue[0].params.length<=2&&!N(ue[0].params),at=ue[1]&&ue[1].params.length<=2&&!N(ue[1].params),ht=ue[2]&&ue[2].params.length<=2&&!N(ue[2].params),Zt=ue[3]&&ue[3].params.length<=2&&!N(ue[3].params),Wr=ue[4]&&ue[4].params.length<=2&&!N(ue[4].params),en=ue[5]&&ue[5].params.length<=2&&!N(ue[5].params),tn=De&&at&&ht&&Zt&&Wr&&en;for(let kn=0;knkn.test),Og=ue.map(kn=>kn.implementation),Gh=function(){for(let Ia=Dg;IaS(C(Le))),Be=U(arguments);if(typeof Be!="function")throw new TypeError("Callback function expected as last argument");return re(we,Be)}function re(we,Be){return{referTo:{references:we,callback:Be}}}function Ee(we){if(typeof we!="function")throw new TypeError("Callback function expected as first argument");return{referToSelf:{callback:we}}}function Ce(we){return we&&typeof we.referTo=="object"&&Array.isArray(we.referTo.references)&&typeof we.referTo.callback=="function"}function _e(we){return we&&typeof we.referToSelf=="object"&&typeof we.referToSelf.callback=="function"}function he(we,Be){if(!we)return Be;if(Be&&Be!==we){let Le=new Error("Function names do not match (expected: "+we+", actual: "+Be+")");throw Le.data={actual:Be,expected:we},Le}return we}function ze(we){let Be;for(let Le in we)Object.prototype.hasOwnProperty.call(we,Le)&&(b(we[Le])||typeof we[Le].signature=="string")&&(Be=he(Be,we[Le].name));return Be}function Ye(we,Be){let Le;for(Le in Be)if(Object.prototype.hasOwnProperty.call(Be,Le)){if(Le in we&&Be[Le]!==we[Le]){let Ze=new Error('Signature "'+Le+'" is defined twice');throw Ze.data={signature:Le,sourceFunction:Be[Le],destFunction:we[Le]},Ze}we[Le]=Be[Le]}}let tt=d;d=function(we){let Be=typeof we=="string",Le=Be?1:0,Ze=Be?we:"",He={};for(let Qe=Le;QeHe.from===we.from);if(!Le)throw new Error("Attempt to remove nonexistent conversion from "+we.from+" to "+we.to);if(Le.convert!==we.convert)throw new Error("Conversion to remove does not match existing conversion");let Ze=Be.conversionsTo.indexOf(Le);Be.conversionsTo.splice(Ze,1)},d.resolve=function(we,Be){if(!b(we))throw new TypeError(n);let Le=we._typedFunctionData.signatures;for(let Ze=0;Ze{(function(e){"use strict";var t=Math.cosh||function(u){return Math.abs(u)<1e-9?1-u:(Math.exp(u)+Math.exp(-u))*.5},r=Math.sinh||function(u){return Math.abs(u)<1e-9?u:(Math.exp(u)-Math.exp(-u))*.5},n=function(u){var c=Math.PI/4;if(-c>u||u>c)return Math.cos(u)-1;var f=u*u;return f*(f*(f*(f*(f*(f*(f*(f/20922789888e3-1/87178291200)+1/479001600)-1/3628800)+1/40320)-1/720)+1/24)-1/2)},i=function(u,c){var f=Math.abs(u),d=Math.abs(c);return f<3e3&&d<3e3?Math.sqrt(f*f+d*d):(f0&&a();break;case"number":f.im=0,f.re=u;break;default:a()}return isNaN(f.re)||isNaN(f.im),f};function l(u,c){if(!(this instanceof l))return new l(u,c);var f=s(u,c);this.re=f.re,this.im=f.im}l.prototype={re:0,im:0,sign:function(){var u=this.abs();return new l(this.re/u,this.im/u)},add:function(u,c){var f=new l(u,c);return this.isInfinite()&&f.isInfinite()?l.NAN:this.isInfinite()||f.isInfinite()?l.INFINITY:new l(this.re+f.re,this.im+f.im)},sub:function(u,c){var f=new l(u,c);return this.isInfinite()&&f.isInfinite()?l.NAN:this.isInfinite()||f.isInfinite()?l.INFINITY:new l(this.re-f.re,this.im-f.im)},mul:function(u,c){var f=new l(u,c);return this.isInfinite()&&f.isZero()||this.isZero()&&f.isInfinite()?l.NAN:this.isInfinite()||f.isInfinite()?l.INFINITY:f.im===0&&this.im===0?new l(this.re*f.re,0):new l(this.re*f.re-this.im*f.im,this.re*f.im+this.im*f.re)},div:function(u,c){var f=new l(u,c);if(this.isZero()&&f.isZero()||this.isInfinite()&&f.isInfinite())return l.NAN;if(this.isInfinite()||f.isZero())return l.INFINITY;if(this.isZero()||f.isInfinite())return l.ZERO;u=this.re,c=this.im;var d=f.re,p=f.im,h,m;return p===0?new l(u/d,c/d):Math.abs(d)0)return new l(Math.pow(u,f.re),0);if(u===0)switch((f.re%4+4)%4){case 0:return new l(Math.pow(c,f.re),0);case 1:return new l(0,Math.pow(c,f.re));case 2:return new l(-Math.pow(c,f.re),0);case 3:return new l(0,-Math.pow(c,f.re))}}if(u===0&&c===0&&f.re>0&&f.im>=0)return l.ZERO;var d=Math.atan2(c,u),p=o(u,c);return u=Math.exp(f.re*p-f.im*d),c=f.im*p+f.re*d,new l(u*Math.cos(c),u*Math.sin(c))},sqrt:function(){var u=this.re,c=this.im,f=this.abs(),d,p;if(u>=0){if(c===0)return new l(Math.sqrt(u),0);d=.5*Math.sqrt(2*(f+u))}else d=Math.abs(c)/Math.sqrt(2*(f-u));return u<=0?p=.5*Math.sqrt(2*(f-u)):p=Math.abs(c)/Math.sqrt(2*(f+u)),new l(d,c<0?-p:p)},exp:function(){var u=Math.exp(this.re);return this.im,new l(u*Math.cos(this.im),u*Math.sin(this.im))},expm1:function(){var u=this.re,c=this.im;return new l(Math.expm1(u)*Math.cos(c)+n(c),Math.exp(u)*Math.sin(c))},log:function(){var u=this.re,c=this.im;return c===0&&u>0,new l(o(u,c),Math.atan2(c,u))},abs:function(){return i(this.re,this.im)},arg:function(){return Math.atan2(this.im,this.re)},sin:function(){var u=this.re,c=this.im;return new l(Math.sin(u)*t(c),Math.cos(u)*r(c))},cos:function(){var u=this.re,c=this.im;return new l(Math.cos(u)*t(c),-Math.sin(u)*r(c))},tan:function(){var u=2*this.re,c=2*this.im,f=Math.cos(u)+t(c);return new l(Math.sin(u)/f,r(c)/f)},cot:function(){var u=2*this.re,c=2*this.im,f=Math.cos(u)-t(c);return new l(-Math.sin(u)/f,r(c)/f)},sec:function(){var u=this.re,c=this.im,f=.5*t(2*c)+.5*Math.cos(2*u);return new l(Math.cos(u)*t(c)/f,Math.sin(u)*r(c)/f)},csc:function(){var u=this.re,c=this.im,f=.5*t(2*c)-.5*Math.cos(2*u);return new l(Math.sin(u)*t(c)/f,-Math.cos(u)*r(c)/f)},asin:function(){var u=this.re,c=this.im,f=new l(c*c-u*u+1,-2*u*c).sqrt(),d=new l(f.re-c,f.im+u).log();return new l(d.im,-d.re)},acos:function(){var u=this.re,c=this.im,f=new l(c*c-u*u+1,-2*u*c).sqrt(),d=new l(f.re-c,f.im+u).log();return new l(Math.PI/2-d.im,d.re)},atan:function(){var u=this.re,c=this.im;if(u===0){if(c===1)return new l(0,1/0);if(c===-1)return new l(0,-1/0)}var f=u*u+(1-c)*(1-c),d=new l((1-c*c-u*u)/f,-2*u/f).log();return new l(-.5*d.im,.5*d.re)},acot:function(){var u=this.re,c=this.im;if(c===0)return new l(Math.atan2(1,u),0);var f=u*u+c*c;return f!==0?new l(u/f,-c/f).atan():new l(u!==0?u/0:0,c!==0?-c/0:0).atan()},asec:function(){var u=this.re,c=this.im;if(u===0&&c===0)return new l(0,1/0);var f=u*u+c*c;return f!==0?new l(u/f,-c/f).acos():new l(u!==0?u/0:0,c!==0?-c/0:0).acos()},acsc:function(){var u=this.re,c=this.im;if(u===0&&c===0)return new l(Math.PI/2,1/0);var f=u*u+c*c;return f!==0?new l(u/f,-c/f).asin():new l(u!==0?u/0:0,c!==0?-c/0:0).asin()},sinh:function(){var u=this.re,c=this.im;return new l(r(u)*Math.cos(c),t(u)*Math.sin(c))},cosh:function(){var u=this.re,c=this.im;return new l(t(u)*Math.cos(c),r(u)*Math.sin(c))},tanh:function(){var u=2*this.re,c=2*this.im,f=t(u)+Math.cos(c);return new l(r(u)/f,Math.sin(c)/f)},coth:function(){var u=2*this.re,c=2*this.im,f=t(u)-Math.cos(c);return new l(r(u)/f,-Math.sin(c)/f)},csch:function(){var u=this.re,c=this.im,f=Math.cos(2*c)-t(2*u);return new l(-2*r(u)*Math.cos(c)/f,2*t(u)*Math.sin(c)/f)},sech:function(){var u=this.re,c=this.im,f=Math.cos(2*c)+t(2*u);return new l(2*t(u)*Math.cos(c)/f,-2*r(u)*Math.sin(c)/f)},asinh:function(){var u=this.im;this.im=-this.re,this.re=u;var c=this.asin();return this.re=-this.im,this.im=u,u=c.re,c.re=-c.im,c.im=u,c},acosh:function(){var u=this.acos();if(u.im<=0){var c=u.re;u.re=-u.im,u.im=c}else{var c=u.im;u.im=-u.re,u.re=c}return u},atanh:function(){var u=this.re,c=this.im,f=u>1&&c===0,d=1-u,p=1+u,h=d*d+c*c,m=h!==0?new l((p*d-c*c)/h,(c*d+p*c)/h):new l(u!==-1?u/0:0,c!==0?c/0:0),g=m.re;return m.re=o(m.re,m.im)/2,m.im=Math.atan2(m.im,g)/2,f&&(m.im=-m.im),m},acoth:function(){var u=this.re,c=this.im;if(u===0&&c===0)return new l(0,Math.PI/2);var f=u*u+c*c;return f!==0?new l(u/f,-c/f).atanh():new l(u!==0?u/0:0,c!==0?-c/0:0).atanh()},acsch:function(){var u=this.re,c=this.im;if(c===0)return new l(u!==0?Math.log(u+Math.sqrt(u*u+1)):1/0,0);var f=u*u+c*c;return f!==0?new l(u/f,-c/f).asinh():new l(u!==0?u/0:0,c!==0?-c/0:0).asinh()},asech:function(){var u=this.re,c=this.im;if(this.isZero())return l.INFINITY;var f=u*u+c*c;return f!==0?new l(u/f,-c/f).acosh():new l(u!==0?u/0:0,c!==0?-c/0:0).acosh()},inverse:function(){if(this.isZero())return l.INFINITY;if(this.isInfinite())return l.ZERO;var u=this.re,c=this.im,f=u*u+c*c;return new l(u/f,-c/f)},conjugate:function(){return new l(this.re,-this.im)},neg:function(){return new l(-this.re,-this.im)},ceil:function(u){return u=Math.pow(10,u||0),new l(Math.ceil(this.re*u)/u,Math.ceil(this.im*u)/u)},floor:function(u){return u=Math.pow(10,u||0),new l(Math.floor(this.re*u)/u,Math.floor(this.im*u)/u)},round:function(u){return u=Math.pow(10,u||0),new l(Math.round(this.re*u)/u,Math.round(this.im*u)/u)},equals:function(u,c){var f=new l(u,c);return Math.abs(f.re-this.re)<=l.EPSILON&&Math.abs(f.im-this.im)<=l.EPSILON},clone:function(){return new l(this.re,this.im)},toString:function(){var u=this.re,c=this.im,f="";return this.isNaN()?"NaN":this.isInfinite()?"Infinity":(Math.abs(u){(function(e){"use strict";var t=2e3,r={s:1,n:0,d:1};function n(m,g){if(isNaN(m=parseInt(m,10)))throw p();return m*g}function i(m,g){if(g===0)throw d();var A=Object.create(f.prototype);A.s=m<0?-1:1,m=m<0?-m:m;var b=c(m,g);return A.n=m/b,A.d=g/b,A}function a(m){for(var g={},A=m,b=2,v=4;v<=A;){for(;A%b===0;)A/=b,g[b]=(g[b]||0)+1;v+=1+2*b++}return A!==m?A>1&&(g[A]=(g[A]||0)+1):g[m]=(g[m]||0)+1,g}var o=function(m,g){var A=0,b=1,v=1,x=0,w=0,S=0,k=1,j=1,O=0,C=1,N=1,D=1,P=1e7,q;if(m!=null)if(g!==void 0){if(A=m,b=g,v=A*b,A%1!==0||b%1!==0)throw h()}else switch(typeof m){case"object":{if("d"in m&&"n"in m)A=m.n,b=m.d,"s"in m&&(A*=m.s);else if(0 in m)A=m[0],1 in m&&(b=m[1]);else throw p();v=A*b;break}case"number":{if(m<0&&(v=m,m=-m),m%1===0)A=m;else if(m>0){for(m>=1&&(j=Math.pow(10,Math.floor(1+Math.log(m)/Math.LN10)),m/=j);C<=P&&D<=P;)if(q=(O+N)/(C+D),m===q){C+D<=P?(A=O+N,b=C+D):D>C?(A=N,b=D):(A=O,b=C);break}else m>q?(O+=N,C+=D):(N+=O,D+=C),C>P?(A=N,b=D):(A=O,b=C);A*=j}else(isNaN(m)||isNaN(g))&&(b=A=NaN);break}case"string":{if(C=m.match(/\d+|./g),C===null)throw p();if(C[O]==="-"?(v=-1,O++):C[O]==="+"&&O++,C.length===O+1?w=n(C[O++],v):C[O+1]==="."||C[O]==="."?(C[O]!=="."&&(x=n(C[O++],v)),O++,(O+1===C.length||C[O+1]==="("&&C[O+3]===")"||C[O+1]==="'"&&C[O+3]==="'")&&(w=n(C[O],v),k=Math.pow(10,C[O].length),O++),(C[O]==="("&&C[O+2]===")"||C[O]==="'"&&C[O+2]==="'")&&(S=n(C[O+1],v),j=Math.pow(10,C[O+1].length)-1,O+=3)):C[O+1]==="/"||C[O+1]===":"?(w=n(C[O],v),k=n(C[O+2],1),O+=3):C[O+3]==="/"&&C[O+1]===" "&&(x=n(C[O],v),w=n(C[O+2],v),k=n(C[O+4],1),O+=5),C.length<=O){b=k*j,v=A=S+b*x+j*w;break}}default:throw p()}if(b===0)throw d();r.s=v<0?-1:1,r.n=Math.abs(A),r.d=Math.abs(b)};function s(m,g,A){for(var b=1;g>0;m=m*m%A,g>>=1)g&1&&(b=b*m%A);return b}function l(m,g){for(;g%2===0;g/=2);for(;g%5===0;g/=5);if(g===1)return 0;for(var A=10%g,b=1;A!==1;b++)if(A=A*10%g,b>t)return 0;return b}function u(m,g,A){for(var b=1,v=s(10,A,g),x=0;x<300;x++){if(b===v)return x;b=b*10%g,v=v*10%g}return 0}function c(m,g){if(!m)return g;if(!g)return m;for(;;){if(m%=g,!m)return g;if(g%=m,!g)return m}}function f(m,g){if(o(m,g),this instanceof f)m=c(r.d,r.n),this.s=r.s,this.n=r.n/m,this.d=r.d/m;else return i(r.s*r.n,r.d)}var d=function(){return new Error("Division by Zero")},p=function(){return new Error("Invalid argument")},h=function(){return new Error("Parameters must be integer")};f.prototype={s:1,n:0,d:1,abs:function(){return i(this.n,this.d)},neg:function(){return i(-this.s*this.n,this.d)},add:function(m,g){return o(m,g),i(this.s*this.n*r.d+r.s*this.d*r.n,this.d*r.d)},sub:function(m,g){return o(m,g),i(this.s*this.n*r.d-r.s*this.d*r.n,this.d*r.d)},mul:function(m,g){return o(m,g),i(this.s*r.s*this.n*r.n,this.d*r.d)},div:function(m,g){return o(m,g),i(this.s*r.s*this.n*r.d,this.d*r.n)},clone:function(){return i(this.s*this.n,this.d)},mod:function(m,g){if(isNaN(this.n)||isNaN(this.d))return new f(NaN);if(m===void 0)return i(this.s*this.n%this.d,1);if(o(m,g),r.n===0&&this.d===0)throw d();return i(this.s*(r.d*this.n)%(r.n*this.d),r.d*this.d)},gcd:function(m,g){return o(m,g),i(c(r.n,this.n)*c(r.d,this.d),r.d*this.d)},lcm:function(m,g){return o(m,g),r.n===0&&this.n===0?i(0,1):i(r.n*this.n,c(r.n,this.n)*c(r.d,this.d))},ceil:function(m){return m=Math.pow(10,m||0),isNaN(this.n)||isNaN(this.d)?new f(NaN):i(Math.ceil(m*this.s*this.n/this.d),m)},floor:function(m){return m=Math.pow(10,m||0),isNaN(this.n)||isNaN(this.d)?new f(NaN):i(Math.floor(m*this.s*this.n/this.d),m)},round:function(m){return m=Math.pow(10,m||0),isNaN(this.n)||isNaN(this.d)?new f(NaN):i(Math.round(m*this.s*this.n/this.d),m)},inverse:function(){return i(this.s*this.d,this.n)},pow:function(m,g){if(o(m,g),r.d===1)return r.s<0?i(Math.pow(this.s*this.d,r.n),Math.pow(this.n,r.n)):i(Math.pow(this.s*this.n,r.n),Math.pow(this.d,r.n));if(this.s<0)return null;var A=a(this.n),b=a(this.d),v=1,x=1;for(var w in A)if(w!=="1"){if(w==="0"){v=0;break}if(A[w]*=r.n,A[w]%r.d===0)A[w]/=r.d;else return null;v*=Math.pow(w,A[w])}for(var w in b)if(w!=="1"){if(b[w]*=r.n,b[w]%r.d===0)b[w]/=r.d;else return null;x*=Math.pow(w,b[w])}return r.s<0?i(x,v):i(v,x)},equals:function(m,g){return o(m,g),this.s*this.n*r.d===r.s*r.n*this.d},compare:function(m,g){o(m,g);var A=this.s*this.n*r.d-r.s*r.n*this.d;return(0=0;x--)v=v.inverse().add(A[x]);if(Math.abs(v.sub(g).valueOf())0&&(A+=g,A+=" ",b%=v),A+=b,A+="/",A+=v),A},toLatex:function(m){var g,A="",b=this.n,v=this.d;return this.s<0&&(A+="-"),v===1?A+=b:(m&&(g=Math.floor(b/v))>0&&(A+=g,b%=v),A+="\\frac{",A+=b,A+="}{",A+=v,A+="}"),A},toContinued:function(){var m,g=this.n,A=this.d,b=[];if(isNaN(g)||isNaN(A))return b;do b.push(Math.floor(g/A)),m=g%A,g=A,A=m;while(g!==1);return b},toString:function(m){var g=this.n,A=this.d;if(isNaN(g)||isNaN(A))return"NaN";m=m||15;var b=l(g,A),v=u(g,A,b),x=this.s<0?"-":"";if(x+=g/A|0,g%=A,g*=10,g&&(x+="."),b){for(var w=v;w--;)x+=g/A|0,g%=A,g*=10;x+="(";for(var w=b;w--;)x+=g/A|0,g%=A,g*=10;x+=")"}else for(var w=m;g&&w--;)x+=g/A|0,g%=A,g*=10;return x}},typeof bW=="object"?(Object.defineProperty(f,"__esModule",{value:!0}),f.default=f,f.Fraction=f,Hse.exports=f):e.Fraction=f})(bW)});var sce=vn((akt,oce)=>{oce.exports=function e(t,r){"use strict";var n=/(^([+\-]?(?:0|[1-9]\d*)(?:\.\d*)?(?:[eE][+\-]?\d+)?)?$|^0x[0-9a-f]+$|\d+)/gi,i=/(^[ ]*|[ ]*$)/g,a=/(^([\w ]+,?[\w ]+)?[\w ]+,?[\w ]+\d+:\d+(:\d+)?[\w ]?|^\d{1,4}[\/\-]\d{1,4}[\/\-]\d{1,4}|^\w+, \w+ \d+, \d{4})/,o=/^0x[0-9a-f]+$/i,s=/^0/,l=function(v){return e.insensitive&&(""+v).toLowerCase()||""+v},u=l(t).replace(i,"")||"",c=l(r).replace(i,"")||"",f=u.replace(n,"\0$1\0").replace(/\0$/,"").replace(/^\0/,"").split("\0"),d=c.replace(n,"\0$1\0").replace(/\0$/,"").replace(/^\0/,"").split("\0"),p=parseInt(u.match(o),16)||f.length!==1&&u.match(a)&&Date.parse(u),h=parseInt(c.match(o),16)||p&&c.match(a)&&Date.parse(c)||null,m,g;if(h){if(ph)return 1}for(var A=0,b=Math.max(f.length,d.length);Ag)return 1}return 0}});var cfe=vn((wMt,ufe)=>{"use strict";var kH=Object.assign||function(e){for(var t=1;t1&&arguments[1]!==void 0?arguments[1]:{},r=t.preserveFormatting,n=r===void 0?!1:r,i=t.escapeMapFn,a=i===void 0?iUe:i,o=String(e),s="",l=a(kH({},rUe),n?kH({},nUe):{}),u=Object.keys(l),c=function(){var d=!1;u.forEach(function(p,h){d||o.length>=p.length&&o.slice(0,p.length)===p&&(s+=l[u[h]],o=o.slice(p.length,o.length),d=!0)}),d||(s+=o.slice(0,1),o=o.slice(1,o.length))};o;)c();return s}});var qAe=vn(($Ae,FH)=>{(function(e,t,r){function n(s){var l=this,u=o();l.next=function(){var c=2091639*l.s0+l.c*23283064365386963e-26;return l.s0=l.s1,l.s1=l.s2,l.s2=c-(l.c=c|0)},l.c=1,l.s0=u(" "),l.s1=u(" "),l.s2=u(" "),l.s0-=u(s),l.s0<0&&(l.s0+=1),l.s1-=u(s),l.s1<0&&(l.s1+=1),l.s2-=u(s),l.s2<0&&(l.s2+=1),u=null}function i(s,l){return l.c=s.c,l.s0=s.s0,l.s1=s.s1,l.s2=s.s2,l}function a(s,l){var u=new n(s),c=l&&l.state,f=u.next;return f.int32=function(){return u.next()*4294967296|0},f.double=function(){return f()+(f()*2097152|0)*11102230246251565e-32},f.quick=f,c&&(typeof c=="object"&&i(c,u),f.state=function(){return i(u,{})}),f}function o(){var s=4022871197,l=function(u){u=String(u);for(var c=0;c>>0,f-=s,f*=s,s=f>>>0,f-=s,s+=f*4294967296}return(s>>>0)*23283064365386963e-26};return l}t&&t.exports?t.exports=a:r&&r.amd?r(function(){return a}):this.alea=a})($Ae,typeof FH=="object"&&FH,typeof define=="function"&&define)});var zAe=vn((LAe,_H)=>{(function(e,t,r){function n(o){var s=this,l="";s.x=0,s.y=0,s.z=0,s.w=0,s.next=function(){var c=s.x^s.x<<11;return s.x=s.y,s.y=s.z,s.z=s.w,s.w^=s.w>>>19^c^c>>>8},o===(o|0)?s.x=o:l+=o;for(var u=0;u>>0)/4294967296};return c.double=function(){do var f=l.next()>>>11,d=(l.next()>>>0)/4294967296,p=(f+d)/(1<<21);while(p===0);return p},c.int32=l.next,c.quick=c,u&&(typeof u=="object"&&i(u,l),c.state=function(){return i(l,{})}),c}t&&t.exports?t.exports=a:r&&r.amd?r(function(){return a}):this.xor128=a})(LAe,typeof _H=="object"&&_H,typeof define=="function"&&define)});var WAe=vn((UAe,PH)=>{(function(e,t,r){function n(o){var s=this,l="";s.next=function(){var c=s.x^s.x>>>2;return s.x=s.y,s.y=s.z,s.z=s.w,s.w=s.v,(s.d=s.d+362437|0)+(s.v=s.v^s.v<<4^(c^c<<1))|0},s.x=0,s.y=0,s.z=0,s.w=0,s.v=0,o===(o|0)?s.x=o:l+=o;for(var u=0;u>>4),s.next()}function i(o,s){return s.x=o.x,s.y=o.y,s.z=o.z,s.w=o.w,s.v=o.v,s.d=o.d,s}function a(o,s){var l=new n(o),u=s&&s.state,c=function(){return(l.next()>>>0)/4294967296};return c.double=function(){do var f=l.next()>>>11,d=(l.next()>>>0)/4294967296,p=(f+d)/(1<<21);while(p===0);return p},c.int32=l.next,c.quick=c,u&&(typeof u=="object"&&i(u,l),c.state=function(){return i(l,{})}),c}t&&t.exports?t.exports=a:r&&r.amd?r(function(){return a}):this.xorwow=a})(UAe,typeof PH=="object"&&PH,typeof define=="function"&&define)});var VAe=vn((HAe,IH)=>{(function(e,t,r){function n(o){var s=this;s.next=function(){var u=s.x,c=s.i,f,d,p;return f=u[c],f^=f>>>7,d=f^f<<24,f=u[c+1&7],d^=f^f>>>10,f=u[c+3&7],d^=f^f>>>3,f=u[c+4&7],d^=f^f<<7,f=u[c+7&7],f=f^f<<13,d^=f^f<<9,u[c]=d,s.i=c+1&7,d};function l(u,c){var f,d,p=[];if(c===(c|0))d=p[0]=c;else for(c=""+c,f=0;f0;--f)u.next()}l(s,o)}function i(o,s){return s.x=o.x.slice(),s.i=o.i,s}function a(o,s){o==null&&(o=+new Date);var l=new n(o),u=s&&s.state,c=function(){return(l.next()>>>0)/4294967296};return c.double=function(){do var f=l.next()>>>11,d=(l.next()>>>0)/4294967296,p=(f+d)/(1<<21);while(p===0);return p},c.int32=l.next,c.quick=c,u&&(u.x&&i(u,l),c.state=function(){return i(l,{})}),c}t&&t.exports?t.exports=a:r&&r.amd?r(function(){return a}):this.xorshift7=a})(HAe,typeof IH=="object"&&IH,typeof define=="function"&&define)});var QAe=vn((GAe,BH)=>{(function(e,t,r){function n(o){var s=this;s.next=function(){var u=s.w,c=s.X,f=s.i,d,p;return s.w=u=u+1640531527|0,p=c[f+34&127],d=c[f=f+1&127],p^=p<<13,d^=d<<17,p^=p>>>15,d^=d>>>12,p=c[f]=p^d,s.i=f,p+(u^u>>>16)|0};function l(u,c){var f,d,p,h,m,g=[],A=128;for(c===(c|0)?(d=c,c=null):(c=c+"\0",d=0,A=Math.max(A,c.length)),p=0,h=-32;h>>15,d^=d<<4,d^=d>>>13,h>=0&&(m=m+1640531527|0,f=g[h&127]^=d+m,p=f==0?p+1:0);for(p>=128&&(g[(c&&c.length||0)&127]=-1),p=127,h=4*128;h>0;--h)d=g[p+34&127],f=g[p=p+1&127],d^=d<<13,f^=f<<17,d^=d>>>15,f^=f>>>12,g[p]=d^f;u.w=m,u.X=g,u.i=p}l(s,o)}function i(o,s){return s.i=o.i,s.w=o.w,s.X=o.X.slice(),s}function a(o,s){o==null&&(o=+new Date);var l=new n(o),u=s&&s.state,c=function(){return(l.next()>>>0)/4294967296};return c.double=function(){do var f=l.next()>>>11,d=(l.next()>>>0)/4294967296,p=(f+d)/(1<<21);while(p===0);return p},c.int32=l.next,c.quick=c,u&&(u.X&&i(u,l),c.state=function(){return i(l,{})}),c}t&&t.exports?t.exports=a:r&&r.amd?r(function(){return a}):this.xor4096=a})(GAe,typeof BH=="object"&&BH,typeof define=="function"&&define)});var ZAe=vn((YAe,RH)=>{(function(e,t,r){function n(o){var s=this,l="";s.next=function(){var c=s.b,f=s.c,d=s.d,p=s.a;return c=c<<25^c>>>7^f,f=f-d|0,d=d<<24^d>>>8^p,p=p-c|0,s.b=c=c<<20^c>>>12^f,s.c=f=f-d|0,s.d=d<<16^f>>>16^p,s.a=p-c|0},s.a=0,s.b=0,s.c=-1640531527,s.d=1367130551,o===Math.floor(o)?(s.a=o/4294967296|0,s.b=o|0):l+=o;for(var u=0;u>>0)/4294967296};return c.double=function(){do var f=l.next()>>>11,d=(l.next()>>>0)/4294967296,p=(f+d)/(1<<21);while(p===0);return p},c.int32=l.next,c.quick=c,u&&(typeof u=="object"&&i(u,l),c.state=function(){return i(l,{})}),c}t&&t.exports?t.exports=a:r&&r.amd?r(function(){return a}):this.tychei=a})(YAe,typeof RH=="object"&&RH,typeof define=="function"&&define)});var KAe=vn((XAe,SP)=>{(function(e,t,r){var n=256,i=6,a=52,o="random",s=r.pow(n,i),l=r.pow(2,a),u=l*2,c=n-1,f;function d(v,x,w){var S=[];x=x==!0?{entropy:!0}:x||{};var k=g(m(x.entropy?[v,b(t)]:v??A(),3),S),j=new p(S),O=function(){for(var C=j.g(i),N=s,D=0;C=u;)C/=2,N/=2,D>>>=1;return(C+D)/N};return O.int32=function(){return j.g(4)|0},O.quick=function(){return j.g(4)/4294967296},O.double=O,g(b(j.S),t),(x.pass||w||function(C,N,D,P){return P&&(P.S&&h(P,j),C.state=function(){return h(j,{})}),D?(r[o]=C,N):C})(O,k,"global"in x?x.global:this==r,x.state)}function p(v){var x,w=v.length,S=this,k=0,j=S.i=S.j=0,O=S.S=[];for(w||(v=[w++]);k{var xWe=qAe(),wWe=zAe(),SWe=WAe(),EWe=VAe(),kWe=QAe(),CWe=ZAe(),Dy=KAe();Dy.alea=xWe;Dy.xor128=wWe;Dy.xorwow=SWe;Dy.xorshift7=EWe;Dy.xor4096=kWe;Dy.tychei=CWe;JAe.exports=Dy});var tye=vn((oGt,_V)=>{function FV(){}FV.prototype={on:function(e,t,r){var n=this.e||(this.e={});return(n[e]||(n[e]=[])).push({fn:t,ctx:r}),this},once:function(e,t,r){var n=this;function i(){n.off(e,i),t.apply(r,arguments)}return i._=t,this.on(e,i,r)},emit:function(e){var t=[].slice.call(arguments,1),r=((this.e||(this.e={}))[e]||[]).slice(),n=0,i=r.length;for(n;n{"use strict";var uVe=Te(),cVe=Symbol.for("react.element"),fVe=Symbol.for("react.fragment"),dVe=Object.prototype.hasOwnProperty,pVe=uVe.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,mVe={key:!0,ref:!0,__self:!0,__source:!0};function Lye(e,t,r){var n,i={},a=null,o=null;r!==void 0&&(a=""+r),t.key!==void 0&&(a=""+t.key),t.ref!==void 0&&(o=t.ref);for(n in t)dVe.call(t,n)&&!mVe.hasOwnProperty(n)&&(i[n]=t[n]);if(e&&e.defaultProps)for(n in t=e.defaultProps,t)i[n]===void 0&&(i[n]=t[n]);return{$$typeof:cVe,type:e,key:a,ref:o,props:i,_owner:pVe.current}}JB.Fragment=fVe;JB.jsx=Lye;JB.jsxs=Lye});var XA=vn((YQt,Uye)=>{"use strict";Uye.exports=zye()});var hCe=vn((Twr,mCe)=>{"use strict";var mtt="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";mCe.exports=mtt});var yCe=vn((Fwr,vCe)=>{"use strict";var htt=hCe();function ACe(){}function gCe(){}gCe.resetWarningCache=ACe;vCe.exports=function(){function e(n,i,a,o,s,l){if(l!==htt){var u=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw u.name="Invariant Violation",u}}e.isRequired=e;function t(){return e}var r={array:e,bigint:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,elementType:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t,checkPropTypes:gCe,resetWarningCache:ACe};return r.PropTypes=r,r}});var xCe=vn((Iwr,bCe)=>{bCe.exports=yCe()();var _wr,Pwr});var CCe=vn($Z=>{"use strict";$Z.__esModule=!0;$Z.default=function(e,t){if(e&&t){var r=Array.isArray(t)?t:t.split(","),n=e.name||"",i=(e.type||"").toLowerCase(),a=i.replace(/\/.*$/,"");return r.some(function(o){var s=o.trim().toLowerCase();return s.charAt(0)==="."?n.toLowerCase().endsWith(s):s.endsWith("/*")?a===s.replace(/\/.*$/,""):i===s})}return!0}});var sDe=vn(oE=>{"use strict";Object.defineProperty(oE,"__esModule",{value:!0});var um=Te(),KZ=um.createContext(null),XZ={didCatch:!1,error:null},V8=class extends um.Component{constructor(t){super(t),this.resetErrorBoundary=this.resetErrorBoundary.bind(this),this.state=XZ}static getDerivedStateFromError(t){return{didCatch:!0,error:t}}resetErrorBoundary(){let{error:t}=this.state;if(t!==null){for(var r,n,i=arguments.length,a=new Array(i),o=0;o0&&arguments[0]!==void 0?arguments[0]:[],t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[];return e.length!==t.length||e.some((r,n)=>!Object.is(r,t[n]))}function srt(e){if(e==null||typeof e.didCatch!="boolean"||typeof e.resetErrorBoundary!="function")throw new Error("ErrorBoundaryContext not found")}function lrt(){let e=um.useContext(KZ);srt(e);let[t,r]=um.useState({error:null,hasError:!1}),n=um.useMemo(()=>({resetBoundary:()=>{e.resetErrorBoundary(),r({error:null,hasError:!1})},showBoundary:i=>r({error:i,hasError:!0})}),[e.resetErrorBoundary]);if(t.hasError)throw t.error;return n}function urt(e,t){let r=um.forwardRef((i,a)=>um.createElement(V8,t,um.createElement(e,{...i,ref:a}))),n=e.displayName||e.name||"Unknown";return r.displayName="withErrorBoundary(".concat(n,")"),r}oE.ErrorBoundary=V8;oE.ErrorBoundaryContext=KZ;oE.useErrorBoundary=lrt;oE.withErrorBoundary=urt});var gDe=vn((pEr,ADe)=>{"use strict";var Z8={boxFlex:!0,boxFlexGroup:!0,columnCount:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,strokeDashoffset:!0,strokeOpacity:!0,strokeWidth:!0};function drt(e,t){return e+t.charAt(0).toUpperCase()+t.substring(1)}var prt=["Webkit","ms","Moz","O"];Object.keys(Z8).forEach(function(e){prt.forEach(function(t){Z8[drt(t,e)]=Z8[e]})});var mrt={background:{backgroundImage:!0,backgroundPosition:!0,backgroundRepeat:!0,backgroundColor:!0},border:{borderWidth:!0,borderStyle:!0,borderColor:!0},borderBottom:{borderBottomWidth:!0,borderBottomStyle:!0,borderBottomColor:!0},borderLeft:{borderLeftWidth:!0,borderLeftStyle:!0,borderLeftColor:!0},borderRight:{borderRightWidth:!0,borderRightStyle:!0,borderRightColor:!0},borderTop:{borderTopWidth:!0,borderTopStyle:!0,borderTopColor:!0},font:{fontStyle:!0,fontVariant:!0,fontWeight:!0,fontSize:!0,lineHeight:!0,fontFamily:!0}},hrt={isUnitlessNumber:Z8,shorthandPropertyExpansions:mrt};ADe.exports=hrt});var yDe=vn((mEr,vDe)=>{"use strict";var Art=/^ms-/,grt=/([A-Z])/g;function vrt(e){return e.replace(grt,"-$1").toLowerCase()}function yrt(e){return vrt(e).replace(Art,"-ms-")}vDe.exports=yrt});var SDe=vn((hEr,wDe)=>{"use strict";var brt=gDe().isUnitlessNumber,xrt=yDe(),wrt=Array.isArray,bDe=Object.keys,Srt=/^(normal|none|(\b(url\([^)]*\)|chapter_counter|attr\([^)]*\)|(no-)?(open|close)-quote|inherit)((\b\s*)|$|\s+))+)$/;function xDe(e,t){return!brt[e]&&typeof t=="number"?t=""+t+"px":e==="content"&&!Srt.test(t)&&(t="'"+t.replace(/'/g,"\\'")+"'"),xrt(e)+": "+t+"; "}function Ert(e){var t="";if(!e||bDe(e).length===0)return t;for(var r=bDe(e),n=0,i=r.length;n{(function(e){typeof sOe=="object"&&typeof fX<"u"?fX.exports=e():typeof define=="function"&&define.amd?define([],e):(typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:this).JSZip=e()})(function(){return function e(t,r,n){function i(s,l){if(!r[s]){if(!t[s]){var u=typeof require=="function"&&require;if(!l&&u)return u(s,!0);if(a)return a(s,!0);var c=new Error("Cannot find module '"+s+"'");throw c.code="MODULE_NOT_FOUND",c}var f=r[s]={exports:{}};t[s][0].call(f.exports,function(d){var p=t[s][1][d];return i(p||d)},f,f.exports,e,t,r,n)}return r[s].exports}for(var a=typeof require=="function"&&require,o=0;o>2,f=(3&s)<<4|l>>4,d=1>6:64,p=2>4,l=(15&c)<<4|(f=a.indexOf(o.charAt(p++)))>>2,u=(3&f)<<6|(d=a.indexOf(o.charAt(p++))),g[h++]=s,f!==64&&(g[h++]=l),d!==64&&(g[h++]=u);return g}},{"./support":30,"./utils":32}],2:[function(e,t,r){"use strict";var n=e("./external"),i=e("./stream/DataWorker"),a=e("./stream/Crc32Probe"),o=e("./stream/DataLengthProbe");function s(l,u,c,f,d){this.compressedSize=l,this.uncompressedSize=u,this.crc32=c,this.compression=f,this.compressedContent=d}s.prototype={getContentWorker:function(){var l=new i(n.Promise.resolve(this.compressedContent)).pipe(this.compression.uncompressWorker()).pipe(new o("data_length")),u=this;return l.on("end",function(){if(this.streamInfo.data_length!==u.uncompressedSize)throw new Error("Bug : uncompressed data size mismatch")}),l},getCompressedWorker:function(){return new i(n.Promise.resolve(this.compressedContent)).withStreamInfo("compressedSize",this.compressedSize).withStreamInfo("uncompressedSize",this.uncompressedSize).withStreamInfo("crc32",this.crc32).withStreamInfo("compression",this.compression)}},s.createWorkerFrom=function(l,u,c){return l.pipe(new a).pipe(new o("uncompressedSize")).pipe(u.compressWorker(c)).pipe(new o("compressedSize")).withStreamInfo("compression",u)},t.exports=s},{"./external":6,"./stream/Crc32Probe":25,"./stream/DataLengthProbe":26,"./stream/DataWorker":27}],3:[function(e,t,r){"use strict";var n=e("./stream/GenericWorker");r.STORE={magic:"\0\0",compressWorker:function(){return new n("STORE compression")},uncompressWorker:function(){return new n("STORE decompression")}},r.DEFLATE=e("./flate")},{"./flate":7,"./stream/GenericWorker":28}],4:[function(e,t,r){"use strict";var n=e("./utils"),i=function(){for(var a,o=[],s=0;s<256;s++){a=s;for(var l=0;l<8;l++)a=1&a?3988292384^a>>>1:a>>>1;o[s]=a}return o}();t.exports=function(a,o){return a!==void 0&&a.length?n.getTypeOf(a)!=="string"?function(s,l,u,c){var f=i,d=c+u;s^=-1;for(var p=c;p>>8^f[255&(s^l[p])];return-1^s}(0|o,a,a.length,0):function(s,l,u,c){var f=i,d=c+u;s^=-1;for(var p=c;p>>8^f[255&(s^l.charCodeAt(p))];return-1^s}(0|o,a,a.length,0):0}},{"./utils":32}],5:[function(e,t,r){"use strict";r.base64=!1,r.binary=!1,r.dir=!1,r.createFolders=!0,r.date=null,r.compression=null,r.compressionOptions=null,r.comment=null,r.unixPermissions=null,r.dosPermissions=null},{}],6:[function(e,t,r){"use strict";var n=null;n=typeof Promise<"u"?Promise:e("lie"),t.exports={Promise:n}},{lie:37}],7:[function(e,t,r){"use strict";var n=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Uint32Array<"u",i=e("pako"),a=e("./utils"),o=e("./stream/GenericWorker"),s=n?"uint8array":"array";function l(u,c){o.call(this,"FlateWorker/"+u),this._pako=null,this._pakoAction=u,this._pakoOptions=c,this.meta={}}r.magic="\b\0",a.inherits(l,o),l.prototype.processChunk=function(u){this.meta=u.meta,this._pako===null&&this._createPako(),this._pako.push(a.transformTo(s,u.data),!1)},l.prototype.flush=function(){o.prototype.flush.call(this),this._pako===null&&this._createPako(),this._pako.push([],!0)},l.prototype.cleanUp=function(){o.prototype.cleanUp.call(this),this._pako=null},l.prototype._createPako=function(){this._pako=new i[this._pakoAction]({raw:!0,level:this._pakoOptions.level||-1});var u=this;this._pako.onData=function(c){u.push({data:c,meta:u.meta})}},r.compressWorker=function(u){return new l("Deflate",u)},r.uncompressWorker=function(){return new l("Inflate",{})}},{"./stream/GenericWorker":28,"./utils":32,pako:38}],8:[function(e,t,r){"use strict";function n(f,d){var p,h="";for(p=0;p>>=8;return h}function i(f,d,p,h,m,g){var A,b,v=f.file,x=f.compression,w=g!==s.utf8encode,S=a.transformTo("string",g(v.name)),k=a.transformTo("string",s.utf8encode(v.name)),j=v.comment,O=a.transformTo("string",g(j)),C=a.transformTo("string",s.utf8encode(j)),N=k.length!==v.name.length,D=C.length!==j.length,P="",q="",z="",I=v.dir,T=v.date,L={crc32:0,compressedSize:0,uncompressedSize:0};d&&!p||(L.crc32=f.crc32,L.compressedSize=f.compressedSize,L.uncompressedSize=f.uncompressedSize);var _=0;d&&(_|=8),w||!N&&!D||(_|=2048);var Y=0,oe=0;I&&(Y|=16),m==="UNIX"?(oe=798,Y|=function(Q,fe){var Ie=Q;return Q||(Ie=fe?16893:33204),(65535&Ie)<<16}(v.unixPermissions,I)):(oe=20,Y|=function(Q){return 63&(Q||0)}(v.dosPermissions)),A=T.getUTCHours(),A<<=6,A|=T.getUTCMinutes(),A<<=5,A|=T.getUTCSeconds()/2,b=T.getUTCFullYear()-1980,b<<=4,b|=T.getUTCMonth()+1,b<<=5,b|=T.getUTCDate(),N&&(q=n(1,1)+n(l(S),4)+k,P+="up"+n(q.length,2)+q),D&&(z=n(1,1)+n(l(O),4)+C,P+="uc"+n(z.length,2)+z);var te="";return te+=` +\0`,te+=n(_,2),te+=x.magic,te+=n(A,2),te+=n(b,2),te+=n(L.crc32,4),te+=n(L.compressedSize,4),te+=n(L.uncompressedSize,4),te+=n(S.length,2),te+=n(P.length,2),{fileRecord:u.LOCAL_FILE_HEADER+te+S+P,dirRecord:u.CENTRAL_FILE_HEADER+n(oe,2)+te+n(O.length,2)+"\0\0\0\0"+n(Y,4)+n(h,4)+S+P+O}}var a=e("../utils"),o=e("../stream/GenericWorker"),s=e("../utf8"),l=e("../crc32"),u=e("../signature");function c(f,d,p,h){o.call(this,"ZipFileWorker"),this.bytesWritten=0,this.zipComment=d,this.zipPlatform=p,this.encodeFileName=h,this.streamFiles=f,this.accumulate=!1,this.contentBuffer=[],this.dirRecords=[],this.currentSourceOffset=0,this.entriesCount=0,this.currentFile=null,this._sources=[]}a.inherits(c,o),c.prototype.push=function(f){var d=f.meta.percent||0,p=this.entriesCount,h=this._sources.length;this.accumulate?this.contentBuffer.push(f):(this.bytesWritten+=f.data.length,o.prototype.push.call(this,{data:f.data,meta:{currentFile:this.currentFile,percent:p?(d+100*(p-h-1))/p:100}}))},c.prototype.openedSource=function(f){this.currentSourceOffset=this.bytesWritten,this.currentFile=f.file.name;var d=this.streamFiles&&!f.file.dir;if(d){var p=i(f,d,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:p.fileRecord,meta:{percent:0}})}else this.accumulate=!0},c.prototype.closedSource=function(f){this.accumulate=!1;var d=this.streamFiles&&!f.file.dir,p=i(f,d,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(p.dirRecord),d)this.push({data:function(h){return u.DATA_DESCRIPTOR+n(h.crc32,4)+n(h.compressedSize,4)+n(h.uncompressedSize,4)}(f),meta:{percent:100}});else for(this.push({data:p.fileRecord,meta:{percent:0}});this.contentBuffer.length;)this.push(this.contentBuffer.shift());this.currentFile=null},c.prototype.flush=function(){for(var f=this.bytesWritten,d=0;d=this.index;o--)s=(s<<8)+this.byteAt(o);return this.index+=a,s},readString:function(a){return n.transformTo("string",this.readData(a))},readData:function(){},lastIndexOfSignature:function(){},readAndCheckSignature:function(){},readDate:function(){var a=this.readInt(4);return new Date(Date.UTC(1980+(a>>25&127),(a>>21&15)-1,a>>16&31,a>>11&31,a>>5&63,(31&a)<<1))}},t.exports=i},{"../utils":32}],19:[function(e,t,r){"use strict";var n=e("./Uint8ArrayReader");function i(a){n.call(this,a)}e("../utils").inherits(i,n),i.prototype.readData=function(a){this.checkOffset(a);var o=this.data.slice(this.zero+this.index,this.zero+this.index+a);return this.index+=a,o},t.exports=i},{"../utils":32,"./Uint8ArrayReader":21}],20:[function(e,t,r){"use strict";var n=e("./DataReader");function i(a){n.call(this,a)}e("../utils").inherits(i,n),i.prototype.byteAt=function(a){return this.data.charCodeAt(this.zero+a)},i.prototype.lastIndexOfSignature=function(a){return this.data.lastIndexOf(a)-this.zero},i.prototype.readAndCheckSignature=function(a){return a===this.readData(4)},i.prototype.readData=function(a){this.checkOffset(a);var o=this.data.slice(this.zero+this.index,this.zero+this.index+a);return this.index+=a,o},t.exports=i},{"../utils":32,"./DataReader":18}],21:[function(e,t,r){"use strict";var n=e("./ArrayReader");function i(a){n.call(this,a)}e("../utils").inherits(i,n),i.prototype.readData=function(a){if(this.checkOffset(a),a===0)return new Uint8Array(0);var o=this.data.subarray(this.zero+this.index,this.zero+this.index+a);return this.index+=a,o},t.exports=i},{"../utils":32,"./ArrayReader":17}],22:[function(e,t,r){"use strict";var n=e("../utils"),i=e("../support"),a=e("./ArrayReader"),o=e("./StringReader"),s=e("./NodeBufferReader"),l=e("./Uint8ArrayReader");t.exports=function(u){var c=n.getTypeOf(u);return n.checkSupport(c),c!=="string"||i.uint8array?c==="nodebuffer"?new s(u):i.uint8array?new l(n.transformTo("uint8array",u)):new a(n.transformTo("array",u)):new o(u)}},{"../support":30,"../utils":32,"./ArrayReader":17,"./NodeBufferReader":19,"./StringReader":20,"./Uint8ArrayReader":21}],23:[function(e,t,r){"use strict";r.LOCAL_FILE_HEADER="PK",r.CENTRAL_FILE_HEADER="PK",r.CENTRAL_DIRECTORY_END="PK",r.ZIP64_CENTRAL_DIRECTORY_LOCATOR="PK\x07",r.ZIP64_CENTRAL_DIRECTORY_END="PK",r.DATA_DESCRIPTOR="PK\x07\b"},{}],24:[function(e,t,r){"use strict";var n=e("./GenericWorker"),i=e("../utils");function a(o){n.call(this,"ConvertWorker to "+o),this.destType=o}i.inherits(a,n),a.prototype.processChunk=function(o){this.push({data:i.transformTo(this.destType,o.data),meta:o.meta})},t.exports=a},{"../utils":32,"./GenericWorker":28}],25:[function(e,t,r){"use strict";var n=e("./GenericWorker"),i=e("../crc32");function a(){n.call(this,"Crc32Probe"),this.withStreamInfo("crc32",0)}e("../utils").inherits(a,n),a.prototype.processChunk=function(o){this.streamInfo.crc32=i(o.data,this.streamInfo.crc32||0),this.push(o)},t.exports=a},{"../crc32":4,"../utils":32,"./GenericWorker":28}],26:[function(e,t,r){"use strict";var n=e("../utils"),i=e("./GenericWorker");function a(o){i.call(this,"DataLengthProbe for "+o),this.propName=o,this.withStreamInfo(o,0)}n.inherits(a,i),a.prototype.processChunk=function(o){if(o){var s=this.streamInfo[this.propName]||0;this.streamInfo[this.propName]=s+o.data.length}i.prototype.processChunk.call(this,o)},t.exports=a},{"../utils":32,"./GenericWorker":28}],27:[function(e,t,r){"use strict";var n=e("../utils"),i=e("./GenericWorker");function a(o){i.call(this,"DataWorker");var s=this;this.dataIsReady=!1,this.index=0,this.max=0,this.data=null,this.type="",this._tickScheduled=!1,o.then(function(l){s.dataIsReady=!0,s.data=l,s.max=l&&l.length||0,s.type=n.getTypeOf(l),s.isPaused||s._tickAndRepeat()},function(l){s.error(l)})}n.inherits(a,i),a.prototype.cleanUp=function(){i.prototype.cleanUp.call(this),this.data=null},a.prototype.resume=function(){return!!i.prototype.resume.call(this)&&(!this._tickScheduled&&this.dataIsReady&&(this._tickScheduled=!0,n.delay(this._tickAndRepeat,[],this)),!0)},a.prototype._tickAndRepeat=function(){this._tickScheduled=!1,this.isPaused||this.isFinished||(this._tick(),this.isFinished||(n.delay(this._tickAndRepeat,[],this),this._tickScheduled=!0))},a.prototype._tick=function(){if(this.isPaused||this.isFinished)return!1;var o=null,s=Math.min(this.max,this.index+16384);if(this.index>=this.max)return this.end();switch(this.type){case"string":o=this.data.substring(this.index,s);break;case"uint8array":o=this.data.subarray(this.index,s);break;case"array":case"nodebuffer":o=this.data.slice(this.index,s)}return this.index=s,this.push({data:o,meta:{percent:this.max?this.index/this.max*100:0}})},t.exports=a},{"../utils":32,"./GenericWorker":28}],28:[function(e,t,r){"use strict";function n(i){this.name=i||"default",this.streamInfo={},this.generatedError=null,this.extraStreamInfo={},this.isPaused=!0,this.isFinished=!1,this.isLocked=!1,this._listeners={data:[],end:[],error:[]},this.previous=null}n.prototype={push:function(i){this.emit("data",i)},end:function(){if(this.isFinished)return!1;this.flush();try{this.emit("end"),this.cleanUp(),this.isFinished=!0}catch(i){this.emit("error",i)}return!0},error:function(i){return!this.isFinished&&(this.isPaused?this.generatedError=i:(this.isFinished=!0,this.emit("error",i),this.previous&&this.previous.error(i),this.cleanUp()),!0)},on:function(i,a){return this._listeners[i].push(a),this},cleanUp:function(){this.streamInfo=this.generatedError=this.extraStreamInfo=null,this._listeners=[]},emit:function(i,a){if(this._listeners[i])for(var o=0;o "+i:i}},t.exports=n},{}],29:[function(e,t,r){"use strict";var n=e("../utils"),i=e("./ConvertWorker"),a=e("./GenericWorker"),o=e("../base64"),s=e("../support"),l=e("../external"),u=null;if(s.nodestream)try{u=e("../nodejs/NodejsStreamOutputAdapter")}catch{}function c(d,p){return new l.Promise(function(h,m){var g=[],A=d._internalType,b=d._outputType,v=d._mimeType;d.on("data",function(x,w){g.push(x),p&&p(w)}).on("error",function(x){g=[],m(x)}).on("end",function(){try{var x=function(w,S,k){switch(w){case"blob":return n.newBlob(n.transformTo("arraybuffer",S),k);case"base64":return o.encode(S);default:return n.transformTo(w,S)}}(b,function(w,S){var k,j=0,O=null,C=0;for(k=0;k"u")r.blob=!1;else{var n=new ArrayBuffer(0);try{r.blob=new Blob([n],{type:"application/zip"}).size===0}catch{try{var i=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);i.append(n),r.blob=i.getBlob("application/zip").size===0}catch{r.blob=!1}}}try{r.nodestream=!!e("readable-stream").Readable}catch{r.nodestream=!1}},{"readable-stream":16}],31:[function(e,t,r){"use strict";for(var n=e("./utils"),i=e("./support"),a=e("./nodejsUtils"),o=e("./stream/GenericWorker"),s=new Array(256),l=0;l<256;l++)s[l]=252<=l?6:248<=l?5:240<=l?4:224<=l?3:192<=l?2:1;s[254]=s[254]=1;function u(){o.call(this,"utf-8 decode"),this.leftOver=null}function c(){o.call(this,"utf-8 encode")}r.utf8encode=function(f){return i.nodebuffer?a.newBufferFrom(f,"utf-8"):function(d){var p,h,m,g,A,b=d.length,v=0;for(g=0;g>>6:(h<65536?p[A++]=224|h>>>12:(p[A++]=240|h>>>18,p[A++]=128|h>>>12&63),p[A++]=128|h>>>6&63),p[A++]=128|63&h);return p}(f)},r.utf8decode=function(f){return i.nodebuffer?n.transformTo("nodebuffer",f).toString("utf-8"):function(d){var p,h,m,g,A=d.length,b=new Array(2*A);for(p=h=0;p>10&1023,b[h++]=56320|1023&m)}return b.length!==h&&(b.subarray?b=b.subarray(0,h):b.length=h),n.applyFromCharCode(b)}(f=n.transformTo(i.uint8array?"uint8array":"array",f))},n.inherits(u,o),u.prototype.processChunk=function(f){var d=n.transformTo(i.uint8array?"uint8array":"array",f.data);if(this.leftOver&&this.leftOver.length){if(i.uint8array){var p=d;(d=new Uint8Array(p.length+this.leftOver.length)).set(this.leftOver,0),d.set(p,this.leftOver.length)}else d=this.leftOver.concat(d);this.leftOver=null}var h=function(g,A){var b;for((A=A||g.length)>g.length&&(A=g.length),b=A-1;0<=b&&(192&g[b])==128;)b--;return b<0||b===0?A:b+s[g[b]]>A?b:A}(d),m=d;h!==d.length&&(i.uint8array?(m=d.subarray(0,h),this.leftOver=d.subarray(h,d.length)):(m=d.slice(0,h),this.leftOver=d.slice(h,d.length))),this.push({data:r.utf8decode(m),meta:f.meta})},u.prototype.flush=function(){this.leftOver&&this.leftOver.length&&(this.push({data:r.utf8decode(this.leftOver),meta:{}}),this.leftOver=null)},r.Utf8DecodeWorker=u,n.inherits(c,o),c.prototype.processChunk=function(f){this.push({data:r.utf8encode(f.data),meta:f.meta})},r.Utf8EncodeWorker=c},{"./nodejsUtils":14,"./stream/GenericWorker":28,"./support":30,"./utils":32}],32:[function(e,t,r){"use strict";var n=e("./support"),i=e("./base64"),a=e("./nodejsUtils"),o=e("./external");function s(p){return p}function l(p,h){for(var m=0;m>8;this.dir=!!(16&this.externalFileAttributes),f==0&&(this.dosPermissions=63&this.externalFileAttributes),f==3&&(this.unixPermissions=this.externalFileAttributes>>16&65535),this.dir||this.fileNameStr.slice(-1)!=="/"||(this.dir=!0)},parseZIP64ExtraField:function(){if(this.extraFields[1]){var f=n(this.extraFields[1].value);this.uncompressedSize===i.MAX_VALUE_32BITS&&(this.uncompressedSize=f.readInt(8)),this.compressedSize===i.MAX_VALUE_32BITS&&(this.compressedSize=f.readInt(8)),this.localHeaderOffset===i.MAX_VALUE_32BITS&&(this.localHeaderOffset=f.readInt(8)),this.diskNumberStart===i.MAX_VALUE_32BITS&&(this.diskNumberStart=f.readInt(4))}},readExtraFields:function(f){var d,p,h,m=f.index+this.extraFieldsLength;for(this.extraFields||(this.extraFields={});f.index+4>>6:(f<65536?c[h++]=224|f>>>12:(c[h++]=240|f>>>18,c[h++]=128|f>>>12&63),c[h++]=128|f>>>6&63),c[h++]=128|63&f);return c},r.buf2binstring=function(u){return l(u,u.length)},r.binstring2buf=function(u){for(var c=new n.Buf8(u.length),f=0,d=c.length;f>10&1023,g[d++]=56320|1023&p)}return l(g,d)},r.utf8border=function(u,c){var f;for((c=c||u.length)>u.length&&(c=u.length),f=c-1;0<=f&&(192&u[f])==128;)f--;return f<0||f===0?c:f+o[u[f]]>c?f:c}},{"./common":41}],43:[function(e,t,r){"use strict";t.exports=function(n,i,a,o){for(var s=65535&n|0,l=n>>>16&65535|0,u=0;a!==0;){for(a-=u=2e3>>1:i>>>1;a[o]=i}return a}();t.exports=function(i,a,o,s){var l=n,u=s+o;i^=-1;for(var c=s;c>>8^l[255&(i^a[c])];return-1^i}},{}],46:[function(e,t,r){"use strict";var n,i=e("../utils/common"),a=e("./trees"),o=e("./adler32"),s=e("./crc32"),l=e("./messages"),u=0,c=4,f=0,d=-2,p=-1,h=4,m=2,g=8,A=9,b=286,v=30,x=19,w=2*b+1,S=15,k=3,j=258,O=j+k+1,C=42,N=113,D=1,P=2,q=3,z=4;function I($,ae){return $.msg=l[ae],ae}function T($){return($<<1)-(4<$?9:0)}function L($){for(var ae=$.length;0<=--ae;)$[ae]=0}function _($){var ae=$.state,ce=ae.pending;ce>$.avail_out&&(ce=$.avail_out),ce!==0&&(i.arraySet($.output,ae.pending_buf,ae.pending_out,ce,$.next_out),$.next_out+=ce,ae.pending_out+=ce,$.total_out+=ce,$.avail_out-=ce,ae.pending-=ce,ae.pending===0&&(ae.pending_out=0))}function Y($,ae){a._tr_flush_block($,0<=$.block_start?$.block_start:-1,$.strstart-$.block_start,ae),$.block_start=$.strstart,_($.strm)}function oe($,ae){$.pending_buf[$.pending++]=ae}function te($,ae){$.pending_buf[$.pending++]=ae>>>8&255,$.pending_buf[$.pending++]=255&ae}function Q($,ae){var ce,U,R=$.max_chain_length,J=$.strstart,ee=$.prev_length,ie=$.nice_match,re=$.strstart>$.w_size-O?$.strstart-($.w_size-O):0,Ee=$.window,Ce=$.w_mask,_e=$.prev,he=$.strstart+j,ze=Ee[J+ee-1],Ye=Ee[J+ee];$.prev_length>=$.good_match&&(R>>=2),ie>$.lookahead&&(ie=$.lookahead);do if(Ee[(ce=ae)+ee]===Ye&&Ee[ce+ee-1]===ze&&Ee[ce]===Ee[J]&&Ee[++ce]===Ee[J+1]){J+=2,ce++;do;while(Ee[++J]===Ee[++ce]&&Ee[++J]===Ee[++ce]&&Ee[++J]===Ee[++ce]&&Ee[++J]===Ee[++ce]&&Ee[++J]===Ee[++ce]&&Ee[++J]===Ee[++ce]&&Ee[++J]===Ee[++ce]&&Ee[++J]===Ee[++ce]&&Jre&&--R!=0);return ee<=$.lookahead?ee:$.lookahead}function fe($){var ae,ce,U,R,J,ee,ie,re,Ee,Ce,_e=$.w_size;do{if(R=$.window_size-$.lookahead-$.strstart,$.strstart>=_e+(_e-O)){for(i.arraySet($.window,$.window,_e,_e,0),$.match_start-=_e,$.strstart-=_e,$.block_start-=_e,ae=ce=$.hash_size;U=$.head[--ae],$.head[ae]=_e<=U?U-_e:0,--ce;);for(ae=ce=_e;U=$.prev[--ae],$.prev[ae]=_e<=U?U-_e:0,--ce;);R+=_e}if($.strm.avail_in===0)break;if(ee=$.strm,ie=$.window,re=$.strstart+$.lookahead,Ee=R,Ce=void 0,Ce=ee.avail_in,Ee=k)for(J=$.strstart-$.insert,$.ins_h=$.window[J],$.ins_h=($.ins_h<<$.hash_shift^$.window[J+1])&$.hash_mask;$.insert&&($.ins_h=($.ins_h<<$.hash_shift^$.window[J+k-1])&$.hash_mask,$.prev[J&$.w_mask]=$.head[$.ins_h],$.head[$.ins_h]=J,J++,$.insert--,!($.lookahead+$.insert=k&&($.ins_h=($.ins_h<<$.hash_shift^$.window[$.strstart+k-1])&$.hash_mask,ce=$.prev[$.strstart&$.w_mask]=$.head[$.ins_h],$.head[$.ins_h]=$.strstart),ce!==0&&$.strstart-ce<=$.w_size-O&&($.match_length=Q($,ce)),$.match_length>=k)if(U=a._tr_tally($,$.strstart-$.match_start,$.match_length-k),$.lookahead-=$.match_length,$.match_length<=$.max_lazy_match&&$.lookahead>=k){for($.match_length--;$.strstart++,$.ins_h=($.ins_h<<$.hash_shift^$.window[$.strstart+k-1])&$.hash_mask,ce=$.prev[$.strstart&$.w_mask]=$.head[$.ins_h],$.head[$.ins_h]=$.strstart,--$.match_length!=0;);$.strstart++}else $.strstart+=$.match_length,$.match_length=0,$.ins_h=$.window[$.strstart],$.ins_h=($.ins_h<<$.hash_shift^$.window[$.strstart+1])&$.hash_mask;else U=a._tr_tally($,0,$.window[$.strstart]),$.lookahead--,$.strstart++;if(U&&(Y($,!1),$.strm.avail_out===0))return D}return $.insert=$.strstart=k&&($.ins_h=($.ins_h<<$.hash_shift^$.window[$.strstart+k-1])&$.hash_mask,ce=$.prev[$.strstart&$.w_mask]=$.head[$.ins_h],$.head[$.ins_h]=$.strstart),$.prev_length=$.match_length,$.prev_match=$.match_start,$.match_length=k-1,ce!==0&&$.prev_length<$.max_lazy_match&&$.strstart-ce<=$.w_size-O&&($.match_length=Q($,ce),$.match_length<=5&&($.strategy===1||$.match_length===k&&4096<$.strstart-$.match_start)&&($.match_length=k-1)),$.prev_length>=k&&$.match_length<=$.prev_length){for(R=$.strstart+$.lookahead-k,U=a._tr_tally($,$.strstart-1-$.prev_match,$.prev_length-k),$.lookahead-=$.prev_length-1,$.prev_length-=2;++$.strstart<=R&&($.ins_h=($.ins_h<<$.hash_shift^$.window[$.strstart+k-1])&$.hash_mask,ce=$.prev[$.strstart&$.w_mask]=$.head[$.ins_h],$.head[$.ins_h]=$.strstart),--$.prev_length!=0;);if($.match_available=0,$.match_length=k-1,$.strstart++,U&&(Y($,!1),$.strm.avail_out===0))return D}else if($.match_available){if((U=a._tr_tally($,0,$.window[$.strstart-1]))&&Y($,!1),$.strstart++,$.lookahead--,$.strm.avail_out===0)return D}else $.match_available=1,$.strstart++,$.lookahead--}return $.match_available&&(U=a._tr_tally($,0,$.window[$.strstart-1]),$.match_available=0),$.insert=$.strstart$.pending_buf_size-5&&(ce=$.pending_buf_size-5);;){if($.lookahead<=1){if(fe($),$.lookahead===0&&ae===u)return D;if($.lookahead===0)break}$.strstart+=$.lookahead,$.lookahead=0;var U=$.block_start+ce;if(($.strstart===0||$.strstart>=U)&&($.lookahead=$.strstart-U,$.strstart=U,Y($,!1),$.strm.avail_out===0)||$.strstart-$.block_start>=$.w_size-O&&(Y($,!1),$.strm.avail_out===0))return D}return $.insert=0,ae===c?(Y($,!0),$.strm.avail_out===0?q:z):($.strstart>$.block_start&&(Y($,!1),$.strm.avail_out),D)}),new Oe(4,4,8,4,Ie),new Oe(4,5,16,8,Ie),new Oe(4,6,32,32,Ie),new Oe(4,4,16,16,Se),new Oe(8,16,32,32,Se),new Oe(8,16,128,128,Se),new Oe(8,32,128,256,Se),new Oe(32,128,258,1024,Se),new Oe(32,258,258,4096,Se)],r.deflateInit=function($,ae){return ke($,ae,g,15,8,0)},r.deflateInit2=ke,r.deflateReset=me,r.deflateResetKeep=ye,r.deflateSetHeader=function($,ae){return $&&$.state?$.state.wrap!==2?d:($.state.gzhead=ae,f):d},r.deflate=function($,ae){var ce,U,R,J;if(!$||!$.state||5>8&255),oe(U,U.gzhead.time>>16&255),oe(U,U.gzhead.time>>24&255),oe(U,U.level===9?2:2<=U.strategy||U.level<2?4:0),oe(U,255&U.gzhead.os),U.gzhead.extra&&U.gzhead.extra.length&&(oe(U,255&U.gzhead.extra.length),oe(U,U.gzhead.extra.length>>8&255)),U.gzhead.hcrc&&($.adler=s($.adler,U.pending_buf,U.pending,0)),U.gzindex=0,U.status=69):(oe(U,0),oe(U,0),oe(U,0),oe(U,0),oe(U,0),oe(U,U.level===9?2:2<=U.strategy||U.level<2?4:0),oe(U,3),U.status=N);else{var ee=g+(U.w_bits-8<<4)<<8;ee|=(2<=U.strategy||U.level<2?0:U.level<6?1:U.level===6?2:3)<<6,U.strstart!==0&&(ee|=32),ee+=31-ee%31,U.status=N,te(U,ee),U.strstart!==0&&(te(U,$.adler>>>16),te(U,65535&$.adler)),$.adler=1}if(U.status===69)if(U.gzhead.extra){for(R=U.pending;U.gzindex<(65535&U.gzhead.extra.length)&&(U.pending!==U.pending_buf_size||(U.gzhead.hcrc&&U.pending>R&&($.adler=s($.adler,U.pending_buf,U.pending-R,R)),_($),R=U.pending,U.pending!==U.pending_buf_size));)oe(U,255&U.gzhead.extra[U.gzindex]),U.gzindex++;U.gzhead.hcrc&&U.pending>R&&($.adler=s($.adler,U.pending_buf,U.pending-R,R)),U.gzindex===U.gzhead.extra.length&&(U.gzindex=0,U.status=73)}else U.status=73;if(U.status===73)if(U.gzhead.name){R=U.pending;do{if(U.pending===U.pending_buf_size&&(U.gzhead.hcrc&&U.pending>R&&($.adler=s($.adler,U.pending_buf,U.pending-R,R)),_($),R=U.pending,U.pending===U.pending_buf_size)){J=1;break}J=U.gzindexR&&($.adler=s($.adler,U.pending_buf,U.pending-R,R)),J===0&&(U.gzindex=0,U.status=91)}else U.status=91;if(U.status===91)if(U.gzhead.comment){R=U.pending;do{if(U.pending===U.pending_buf_size&&(U.gzhead.hcrc&&U.pending>R&&($.adler=s($.adler,U.pending_buf,U.pending-R,R)),_($),R=U.pending,U.pending===U.pending_buf_size)){J=1;break}J=U.gzindexR&&($.adler=s($.adler,U.pending_buf,U.pending-R,R)),J===0&&(U.status=103)}else U.status=103;if(U.status===103&&(U.gzhead.hcrc?(U.pending+2>U.pending_buf_size&&_($),U.pending+2<=U.pending_buf_size&&(oe(U,255&$.adler),oe(U,$.adler>>8&255),$.adler=0,U.status=N)):U.status=N),U.pending!==0){if(_($),$.avail_out===0)return U.last_flush=-1,f}else if($.avail_in===0&&T(ae)<=T(ce)&&ae!==c)return I($,-5);if(U.status===666&&$.avail_in!==0)return I($,-5);if($.avail_in!==0||U.lookahead!==0||ae!==u&&U.status!==666){var ie=U.strategy===2?function(re,Ee){for(var Ce;;){if(re.lookahead===0&&(fe(re),re.lookahead===0)){if(Ee===u)return D;break}if(re.match_length=0,Ce=a._tr_tally(re,0,re.window[re.strstart]),re.lookahead--,re.strstart++,Ce&&(Y(re,!1),re.strm.avail_out===0))return D}return re.insert=0,Ee===c?(Y(re,!0),re.strm.avail_out===0?q:z):re.last_lit&&(Y(re,!1),re.strm.avail_out===0)?D:P}(U,ae):U.strategy===3?function(re,Ee){for(var Ce,_e,he,ze,Ye=re.window;;){if(re.lookahead<=j){if(fe(re),re.lookahead<=j&&Ee===u)return D;if(re.lookahead===0)break}if(re.match_length=0,re.lookahead>=k&&0re.lookahead&&(re.match_length=re.lookahead)}if(re.match_length>=k?(Ce=a._tr_tally(re,1,re.match_length-k),re.lookahead-=re.match_length,re.strstart+=re.match_length,re.match_length=0):(Ce=a._tr_tally(re,0,re.window[re.strstart]),re.lookahead--,re.strstart++),Ce&&(Y(re,!1),re.strm.avail_out===0))return D}return re.insert=0,Ee===c?(Y(re,!0),re.strm.avail_out===0?q:z):re.last_lit&&(Y(re,!1),re.strm.avail_out===0)?D:P}(U,ae):n[U.level].func(U,ae);if(ie!==q&&ie!==z||(U.status=666),ie===D||ie===q)return $.avail_out===0&&(U.last_flush=-1),f;if(ie===P&&(ae===1?a._tr_align(U):ae!==5&&(a._tr_stored_block(U,0,0,!1),ae===3&&(L(U.head),U.lookahead===0&&(U.strstart=0,U.block_start=0,U.insert=0))),_($),$.avail_out===0))return U.last_flush=-1,f}return ae!==c?f:U.wrap<=0?1:(U.wrap===2?(oe(U,255&$.adler),oe(U,$.adler>>8&255),oe(U,$.adler>>16&255),oe(U,$.adler>>24&255),oe(U,255&$.total_in),oe(U,$.total_in>>8&255),oe(U,$.total_in>>16&255),oe(U,$.total_in>>24&255)):(te(U,$.adler>>>16),te(U,65535&$.adler)),_($),0=ce.w_size&&(J===0&&(L(ce.head),ce.strstart=0,ce.block_start=0,ce.insert=0),Ee=new i.Buf8(ce.w_size),i.arraySet(Ee,ae,Ce-ce.w_size,ce.w_size,0),ae=Ee,Ce=ce.w_size),ee=$.avail_in,ie=$.next_in,re=$.input,$.avail_in=Ce,$.next_in=0,$.input=ae,fe(ce);ce.lookahead>=k;){for(U=ce.strstart,R=ce.lookahead-(k-1);ce.ins_h=(ce.ins_h<>>=k=S>>>24,A-=k,(k=S>>>16&255)===0)P[l++]=65535&S;else{if(!(16&k)){if((64&k)==0){S=b[(65535&S)+(g&(1<>>=k,A-=k),A<15&&(g+=D[o++]<>>=k=S>>>24,A-=k,!(16&(k=S>>>16&255))){if((64&k)==0){S=v[(65535&S)+(g&(1<>>=k,A-=k,(k=l-u)>3,g&=(1<<(A-=j<<3))-1,n.next_in=o,n.next_out=l,n.avail_in=o>>24&255)+(C>>>8&65280)+((65280&C)<<8)+((255&C)<<24)}function g(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new n.Buf16(320),this.work=new n.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function A(C){var N;return C&&C.state?(N=C.state,C.total_in=C.total_out=N.total=0,C.msg="",N.wrap&&(C.adler=1&N.wrap),N.mode=d,N.last=0,N.havedict=0,N.dmax=32768,N.head=null,N.hold=0,N.bits=0,N.lencode=N.lendyn=new n.Buf32(p),N.distcode=N.distdyn=new n.Buf32(h),N.sane=1,N.back=-1,c):f}function b(C){var N;return C&&C.state?((N=C.state).wsize=0,N.whave=0,N.wnext=0,A(C)):f}function v(C,N){var D,P;return C&&C.state?(P=C.state,N<0?(D=0,N=-N):(D=1+(N>>4),N<48&&(N&=15)),N&&(N<8||15=z.wsize?(n.arraySet(z.window,N,D-z.wsize,z.wsize,0),z.wnext=0,z.whave=z.wsize):(P<(q=z.wsize-z.wnext)&&(q=P),n.arraySet(z.window,N,D-P,q,z.wnext),(P-=q)?(n.arraySet(z.window,N,D-P,P,0),z.wnext=P,z.whave=z.wsize):(z.wnext+=q,z.wnext===z.wsize&&(z.wnext=0),z.whave>>8&255,D.check=a(D.check,J,2,0),Y=_=0,D.mode=2;break}if(D.flags=0,D.head&&(D.head.done=!1),!(1&D.wrap)||(((255&_)<<8)+(_>>8))%31){C.msg="incorrect header check",D.mode=30;break}if((15&_)!=8){C.msg="unknown compression method",D.mode=30;break}if(Y-=4,$=8+(15&(_>>>=4)),D.wbits===0)D.wbits=$;else if($>D.wbits){C.msg="invalid window size",D.mode=30;break}D.dmax=1<<$,C.adler=D.check=1,D.mode=512&_?10:12,Y=_=0;break;case 2:for(;Y<16;){if(T===0)break e;T--,_+=P[z++]<>8&1),512&D.flags&&(J[0]=255&_,J[1]=_>>>8&255,D.check=a(D.check,J,2,0)),Y=_=0,D.mode=3;case 3:for(;Y<32;){if(T===0)break e;T--,_+=P[z++]<>>8&255,J[2]=_>>>16&255,J[3]=_>>>24&255,D.check=a(D.check,J,4,0)),Y=_=0,D.mode=4;case 4:for(;Y<16;){if(T===0)break e;T--,_+=P[z++]<>8),512&D.flags&&(J[0]=255&_,J[1]=_>>>8&255,D.check=a(D.check,J,2,0)),Y=_=0,D.mode=5;case 5:if(1024&D.flags){for(;Y<16;){if(T===0)break e;T--,_+=P[z++]<>>8&255,D.check=a(D.check,J,2,0)),Y=_=0}else D.head&&(D.head.extra=null);D.mode=6;case 6:if(1024&D.flags&&(T<(Q=D.length)&&(Q=T),Q&&(D.head&&($=D.head.extra_len-D.length,D.head.extra||(D.head.extra=new Array(D.head.extra_len)),n.arraySet(D.head.extra,P,z,Q,$)),512&D.flags&&(D.check=a(D.check,P,Q,z)),T-=Q,z+=Q,D.length-=Q),D.length))break e;D.length=0,D.mode=7;case 7:if(2048&D.flags){if(T===0)break e;for(Q=0;$=P[z+Q++],D.head&&$&&D.length<65536&&(D.head.name+=String.fromCharCode($)),$&&Q>9&1,D.head.done=!0),C.adler=D.check=0,D.mode=12;break;case 10:for(;Y<32;){if(T===0)break e;T--,_+=P[z++]<>>=7&Y,Y-=7&Y,D.mode=27;break}for(;Y<3;){if(T===0)break e;T--,_+=P[z++]<>>=1)){case 0:D.mode=14;break;case 1:if(j(D),D.mode=20,N!==6)break;_>>>=2,Y-=2;break e;case 2:D.mode=17;break;case 3:C.msg="invalid block type",D.mode=30}_>>>=2,Y-=2;break;case 14:for(_>>>=7&Y,Y-=7&Y;Y<32;){if(T===0)break e;T--,_+=P[z++]<>>16^65535)){C.msg="invalid stored block lengths",D.mode=30;break}if(D.length=65535&_,Y=_=0,D.mode=15,N===6)break e;case 15:D.mode=16;case 16:if(Q=D.length){if(T>>=5,Y-=5,D.ndist=1+(31&_),_>>>=5,Y-=5,D.ncode=4+(15&_),_>>>=4,Y-=4,286>>=3,Y-=3}for(;D.have<19;)D.lens[ee[D.have++]]=0;if(D.lencode=D.lendyn,D.lenbits=7,ce={bits:D.lenbits},ae=s(0,D.lens,0,19,D.lencode,0,D.work,ce),D.lenbits=ce.bits,ae){C.msg="invalid code lengths set",D.mode=30;break}D.have=0,D.mode=19;case 19:for(;D.have>>16&255,ve=65535&R,!((Se=R>>>24)<=Y);){if(T===0)break e;T--,_+=P[z++]<>>=Se,Y-=Se,D.lens[D.have++]=ve;else{if(ve===16){for(U=Se+2;Y>>=Se,Y-=Se,D.have===0){C.msg="invalid bit length repeat",D.mode=30;break}$=D.lens[D.have-1],Q=3+(3&_),_>>>=2,Y-=2}else if(ve===17){for(U=Se+3;Y>>=Se)),_>>>=3,Y-=3}else{for(U=Se+7;Y>>=Se)),_>>>=7,Y-=7}if(D.have+Q>D.nlen+D.ndist){C.msg="invalid bit length repeat",D.mode=30;break}for(;Q--;)D.lens[D.have++]=$}}if(D.mode===30)break;if(D.lens[256]===0){C.msg="invalid code -- missing end-of-block",D.mode=30;break}if(D.lenbits=9,ce={bits:D.lenbits},ae=s(l,D.lens,0,D.nlen,D.lencode,0,D.work,ce),D.lenbits=ce.bits,ae){C.msg="invalid literal/lengths set",D.mode=30;break}if(D.distbits=6,D.distcode=D.distdyn,ce={bits:D.distbits},ae=s(u,D.lens,D.nlen,D.ndist,D.distcode,0,D.work,ce),D.distbits=ce.bits,ae){C.msg="invalid distances set",D.mode=30;break}if(D.mode=20,N===6)break e;case 20:D.mode=21;case 21:if(6<=T&&258<=L){C.next_out=I,C.avail_out=L,C.next_in=z,C.avail_in=T,D.hold=_,D.bits=Y,o(C,te),I=C.next_out,q=C.output,L=C.avail_out,z=C.next_in,P=C.input,T=C.avail_in,_=D.hold,Y=D.bits,D.mode===12&&(D.back=-1);break}for(D.back=0;Oe=(R=D.lencode[_&(1<>>16&255,ve=65535&R,!((Se=R>>>24)<=Y);){if(T===0)break e;T--,_+=P[z++]<>ye)])>>>16&255,ve=65535&R,!(ye+(Se=R>>>24)<=Y);){if(T===0)break e;T--,_+=P[z++]<>>=ye,Y-=ye,D.back+=ye}if(_>>>=Se,Y-=Se,D.back+=Se,D.length=ve,Oe===0){D.mode=26;break}if(32&Oe){D.back=-1,D.mode=12;break}if(64&Oe){C.msg="invalid literal/length code",D.mode=30;break}D.extra=15&Oe,D.mode=22;case 22:if(D.extra){for(U=D.extra;Y>>=D.extra,Y-=D.extra,D.back+=D.extra}D.was=D.length,D.mode=23;case 23:for(;Oe=(R=D.distcode[_&(1<>>16&255,ve=65535&R,!((Se=R>>>24)<=Y);){if(T===0)break e;T--,_+=P[z++]<>ye)])>>>16&255,ve=65535&R,!(ye+(Se=R>>>24)<=Y);){if(T===0)break e;T--,_+=P[z++]<>>=ye,Y-=ye,D.back+=ye}if(_>>>=Se,Y-=Se,D.back+=Se,64&Oe){C.msg="invalid distance code",D.mode=30;break}D.offset=ve,D.extra=15&Oe,D.mode=24;case 24:if(D.extra){for(U=D.extra;Y>>=D.extra,Y-=D.extra,D.back+=D.extra}if(D.offset>D.dmax){C.msg="invalid distance too far back",D.mode=30;break}D.mode=25;case 25:if(L===0)break e;if(Q=te-L,D.offset>Q){if((Q=D.offset-Q)>D.whave&&D.sane){C.msg="invalid distance too far back",D.mode=30;break}fe=Q>D.wnext?(Q-=D.wnext,D.wsize-Q):D.wnext-Q,Q>D.length&&(Q=D.length),Ie=D.window}else Ie=q,fe=I-D.offset,Q=D.length;for(Lw?(k=fe[Ie+h[N]],Y[oe+h[N]]):(k=96,0),g=1<>I)+(A-=g)]=S<<24|k<<16|j|0,A!==0;);for(g=1<>=1;if(g!==0?(_&=g-1,_+=g):_=0,N++,--te[C]==0){if(C===P)break;C=u[c+h[N]]}if(q>>7)]}function oe(R,J){R.pending_buf[R.pending++]=255&J,R.pending_buf[R.pending++]=J>>>8&255}function te(R,J,ee){R.bi_valid>m-ee?(R.bi_buf|=J<>m-R.bi_valid,R.bi_valid+=ee-m):(R.bi_buf|=J<>>=1,ee<<=1,0<--J;);return ee>>>1}function Ie(R,J,ee){var ie,re,Ee=new Array(h+1),Ce=0;for(ie=1;ie<=h;ie++)Ee[ie]=Ce=Ce+ee[ie-1]<<1;for(re=0;re<=J;re++){var _e=R[2*re+1];_e!==0&&(R[2*re]=fe(Ee[_e]++,_e))}}function Se(R){var J;for(J=0;J>1;1<=ee;ee--)ye(R,Ee,ee);for(re=he;ee=R.heap[1],R.heap[1]=R.heap[R.heap_len--],ye(R,Ee,1),ie=R.heap[1],R.heap[--R.heap_max]=ee,R.heap[--R.heap_max]=ie,Ee[2*re]=Ee[2*ee]+Ee[2*ie],R.depth[re]=(R.depth[ee]>=R.depth[ie]?R.depth[ee]:R.depth[ie])+1,Ee[2*ee+1]=Ee[2*ie+1]=re,R.heap[1]=re++,ye(R,Ee,1),2<=R.heap_len;);R.heap[--R.heap_max]=R.heap[1],function(Ye,tt){var Ct,we,Be,Le,Ze,He,Qe=tt.dyn_tree,et=tt.max_code,Ge=tt.stat_desc.static_tree,G=tt.stat_desc.has_stree,ue=tt.stat_desc.extra_bits,Pe=tt.stat_desc.extra_base,De=tt.stat_desc.max_length,at=0;for(Le=0;Le<=h;Le++)Ye.bl_count[Le]=0;for(Qe[2*Ye.heap[Ye.heap_max]+1]=0,Ct=Ye.heap_max+1;Ct>=7;re>>=1)if(1&ze&&_e.dyn_ltree[2*he]!==0)return i;if(_e.dyn_ltree[18]!==0||_e.dyn_ltree[20]!==0||_e.dyn_ltree[26]!==0)return a;for(he=32;he>>3,(Ee=R.static_len+3+7>>>3)<=re&&(re=Ee)):re=Ee=ee+5,ee+4<=re&&J!==-1?U(R,J,ee,ie):R.strategy===4||Ee===re?(te(R,2+(ie?1:0),3),me(R,O,C)):(te(R,4+(ie?1:0),3),function(_e,he,ze,Ye){var tt;for(te(_e,he-257,5),te(_e,ze-1,5),te(_e,Ye-4,4),tt=0;tt>>8&255,R.pending_buf[R.d_buf+2*R.last_lit+1]=255&J,R.pending_buf[R.l_buf+R.last_lit]=255&ee,R.last_lit++,J===0?R.dyn_ltree[2*ee]++:(R.matches++,J--,R.dyn_ltree[2*(D[ee]+u+1)]++,R.dyn_dtree[2*Y(J)]++),R.last_lit===R.lit_bufsize-1},r._tr_align=function(R){te(R,2,3),Q(R,A,O),function(J){J.bi_valid===16?(oe(J,J.bi_buf),J.bi_buf=0,J.bi_valid=0):8<=J.bi_valid&&(J.pending_buf[J.pending++]=255&J.bi_buf,J.bi_buf>>=8,J.bi_valid-=8)}(R)}},{"../utils/common":41}],53:[function(e,t,r){"use strict";t.exports=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}},{}],54:[function(e,t,r){(function(n){(function(i,a){"use strict";if(!i.setImmediate){var o,s,l,u,c=1,f={},d=!1,p=i.document,h=Object.getPrototypeOf&&Object.getPrototypeOf(i);h=h&&h.setTimeout?h:i,o={}.toString.call(i.process)==="[object process]"?function(b){process.nextTick(function(){g(b)})}:function(){if(i.postMessage&&!i.importScripts){var b=!0,v=i.onmessage;return i.onmessage=function(){b=!1},i.postMessage("","*"),i.onmessage=v,b}}()?(u="setImmediate$"+Math.random()+"$",i.addEventListener?i.addEventListener("message",A,!1):i.attachEvent("onmessage",A),function(b){i.postMessage(u+b,"*")}):i.MessageChannel?((l=new MessageChannel).port1.onmessage=function(b){g(b.data)},function(b){l.port2.postMessage(b)}):p&&"onreadystatechange"in p.createElement("script")?(s=p.documentElement,function(b){var v=p.createElement("script");v.onreadystatechange=function(){g(b),v.onreadystatechange=null,s.removeChild(v),v=null},s.appendChild(v)}):function(b){setTimeout(g,0,b)},h.setImmediate=function(b){typeof b!="function"&&(b=new Function(""+b));for(var v=new Array(arguments.length-1),x=0;x"u"?n===void 0?this:n:self)}).call(this,typeof global<"u"?global:typeof self<"u"?self:typeof window<"u"?window:{})},{}]},{},[10])(10)})});var gOe=vn((v7,Nb)=>{var A7=void 0,g7=function(e){return A7||(A7=new Promise(function(t,r){var n=typeof e<"u"?e:{},i=n.onAbort;n.onAbort=function(W){r(new Error(W)),i&&i(W)},n.postRun=n.postRun||[],n.postRun.push(function(){t(n)}),Nb=void 0;var a;a||(a=typeof n<"u"?n:{}),a.onRuntimeInitialized=function(){function W(Ve,ft){switch(typeof ft){case"boolean":xm(Ve,ft?1:0);break;case"number":_E(Ve,ft);break;case"string":Jb(Ve,ft,-1,-1);break;case"object":if(ft===null)Kb(Ve);else if(ft.length!=null){var Jt=Tg(ft);$g(Ve,Jt,ft.length,-1),_g(Jt)}else tA(Ve,"Wrong API use : tried to return a value of an unknown type ("+ft+").",-1);break;default:Kb(Ve)}}function K(Ve,ft){for(var Jt=[],hr=0;hr>>0),Ve!=null){var ft=this.filename,Jt="/",hr=ft;if(Jt&&(Jt=typeof Jt=="string"?Jt:Zt(Jt),hr=ft?Ce(Jt+"/"+ft):Jt),ft=kn(!0,!0),hr=gm(hr,(ft!==void 0?ft:438)&4095|32768,0),Ve){if(typeof Ve=="string"){Jt=Array(Ve.length);for(var Ur=0,Dn=Ve.length;Ur{g||(m=require("fs"),g=require("path"))},d=function(W,K){return A(),W=g.normalize(W),m.readFileSync(W,K?void 0:"utf8")},h=W=>(W=d(W,!0),W.buffer||(W=new Uint8Array(W)),W),p=(W,K,se)=>{A(),W=g.normalize(W),m.readFile(W,function(xe,je){xe?se(xe):K(je.buffer)})},1{var K=new XMLHttpRequest;return K.open("GET",W,!1),K.send(null),K.responseText},u&&(h=W=>{var K=new XMLHttpRequest;return K.open("GET",W,!1),K.responseType="arraybuffer",K.send(null),new Uint8Array(K.response)}),p=(W,K,se)=>{var xe=new XMLHttpRequest;xe.open("GET",W,!0),xe.responseType="arraybuffer",xe.onload=()=>{xe.status==200||xe.status==0&&xe.response?K(xe.response):se()},xe.onerror=se,xe.send(null)});var b=a.print||console.log.bind(console),v=a.printErr||console.warn.bind(console);Object.assign(a,o),o=null,a.thisProgram&&(s=a.thisProgram);var x;a.wasmBinary&&(x=a.wasmBinary);var w=a.noExitRuntime||!0;typeof WebAssembly!="object"&&me("no native wasm support detected");var S,k=!1,j=typeof TextDecoder<"u"?new TextDecoder("utf8"):void 0;function O(W,K,se){var xe=K+se;for(se=K;W[se]&&!(se>=xe);)++se;if(16je?xe+=String.fromCharCode(je):(je-=65536,xe+=String.fromCharCode(55296|je>>10,56320|je&1023))}}else xe+=String.fromCharCode(je)}return xe}function C(W,K){return W?O(z,W,K):""}function N(W,K,se,xe){if(!(0=ot){var xr=W.charCodeAt(++Ke);ot=65536+((ot&1023)<<10)|xr&1023}if(127>=ot){if(se>=xe)break;K[se++]=ot}else{if(2047>=ot){if(se+1>=xe)break;K[se++]=192|ot>>6}else{if(65535>=ot){if(se+2>=xe)break;K[se++]=224|ot>>12}else{if(se+3>=xe)break;K[se++]=240|ot>>18,K[se++]=128|ot>>12&63}K[se++]=128|ot>>6&63}K[se++]=128|ot&63}}return K[se]=0,se-je}function D(W){for(var K=0,se=0;se=xe?K++:2047>=xe?K+=2:55296<=xe&&57343>=xe?(K+=4,++se):K+=3}return K}var P,q,z,I,T,L,_,Y;function oe(){var W=S.buffer;P=W,a.HEAP8=q=new Int8Array(W),a.HEAP16=I=new Int16Array(W),a.HEAP32=T=new Int32Array(W),a.HEAPU8=z=new Uint8Array(W),a.HEAPU16=new Uint16Array(W),a.HEAPU32=L=new Uint32Array(W),a.HEAPF32=_=new Float32Array(W),a.HEAPF64=Y=new Float64Array(W)}var te,Q=[],fe=[],Ie=[];function Se(){var W=a.preRun.shift();Q.unshift(W)}var Oe=0,ve=null,ye=null;function me(W){throw a.onAbort&&a.onAbort(W),W="Aborted("+W+")",v(W),k=!0,new WebAssembly.RuntimeError(W+". Build with -sASSERTIONS for more info.")}function ke(){return $.startsWith("data:application/octet-stream;base64,")}var $;if($="sql-wasm.wasm",!ke()){var ae=$;$=a.locateFile?a.locateFile(ae,f):f+ae}function ce(){var W=$;try{if(W==$&&x)return new Uint8Array(x);if(h)return h(W);throw"both async and sync fetching of the wasm failed"}catch(K){me(K)}}function U(){if(!x&&(l||u)){if(typeof fetch=="function"&&!$.startsWith("file://"))return fetch($,{credentials:"same-origin"}).then(function(W){if(!W.ok)throw"failed to load wasm binary file at '"+$+"'";return W.arrayBuffer()}).catch(function(){return ce()});if(p)return new Promise(function(W,K){p($,function(se){W(new Uint8Array(se))},K)})}return Promise.resolve().then(function(){return ce()})}var R,J;function ee(W){for(;0>0];case"i8":return q[W>>0];case"i16":return I[W>>1];case"i32":return T[W>>2];case"i64":return T[W>>2];case"float":return _[W>>2];case"double":return Y[W>>3];case"*":return L[W>>2];default:me("invalid type for getValue: "+K)}return null}function re(W){var K="i32";switch(K.endsWith("*")&&(K="*"),K){case"i1":q[W>>0]=0;break;case"i8":q[W>>0]=0;break;case"i16":I[W>>1]=0;break;case"i32":T[W>>2]=0;break;case"i64":J=[0,(R=0,1<=+Math.abs(R)?0>>0:~~+Math.ceil((R-+(~~R>>>0))/4294967296)>>>0:0)],T[W>>2]=J[0],T[W+4>>2]=J[1];break;case"float":_[W>>2]=0;break;case"double":Y[W>>3]=0;break;case"*":L[W>>2]=0;break;default:me("invalid type for setValue: "+K)}}var Ee=(W,K)=>{for(var se=0,xe=W.length-1;0<=xe;xe--){var je=W[xe];je==="."?W.splice(xe,1):je===".."?(W.splice(xe,1),se++):se&&(W.splice(xe,1),se--)}if(K)for(;se;se--)W.unshift("..");return W},Ce=W=>{var K=W.charAt(0)==="/",se=W.substr(-1)==="/";return(W=Ee(W.split("/").filter(xe=>!!xe),!K).join("/"))||K||(W="."),W&&se&&(W+="/"),(K?"/":"")+W},_e=W=>{var K=/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/.exec(W).slice(1);return W=K[0],K=K[1],!W&&!K?".":(K&&(K=K.substr(0,K.length-1)),W+K)},he=W=>{if(W==="/")return"/";W=Ce(W),W=W.replace(/\/$/,"");var K=W.lastIndexOf("/");return K===-1?W:W.substr(K+1)};function ze(){if(typeof crypto=="object"&&typeof crypto.getRandomValues=="function"){var W=new Uint8Array(1);return()=>(crypto.getRandomValues(W),W[0])}if(c)try{var K=require("crypto");return()=>K.randomBytes(1)[0]}catch{}return()=>me("randomDevice")}function Ye(){for(var W="",K=!1,se=arguments.length-1;-1<=se&&!K;se--){if(K=0<=se?arguments[se]:"/",typeof K!="string")throw new TypeError("Arguments to path.resolve must be strings");if(!K)return"";W=K+"/"+W,K=K.charAt(0)==="/"}return W=Ee(W.split("/").filter(xe=>!!xe),!K).join("/"),(K?"/":"")+W||"."}function tt(W,K){var se=Array(D(W)+1);return W=N(W,se,0,se.length),K&&(se.length=W),se}var Ct=[];function we(W,K){Ct[W]={input:[],output:[],Xa:K},Yr(W,Be)}var Be={open:function(W){var K=Ct[W.node.rdev];if(!K)throw new De(43);W.tty=K,W.seekable=!1},close:function(W){W.tty.Xa.fsync(W.tty)},fsync:function(W){W.tty.Xa.fsync(W.tty)},read:function(W,K,se,xe){if(!W.tty||!W.tty.Xa.tb)throw new De(60);for(var je=0,Ke=0;Ke=K||(K=Math.max(K,se*(1048576>se?2:1.125)>>>0),se!=0&&(K=Math.max(K,256)),se=W.Ia,W.Ia=new Uint8Array(K),0=W.node.Ma)return 0;if(W=Math.min(W.node.Ma-je,xe),8K)throw new De(28);return K},lb:function(W,K,se){He.qb(W.node,K+se),W.node.Ma=Math.max(W.node.Ma,K+se)},bb:function(W,K,se,xe,je){if((W.node.mode&61440)!==32768)throw new De(43);if(W=W.node.Ia,je&2||W.buffer!==P){if((0{if(W=Ye("/",W),!W)return{path:"",node:null};if(K=Object.assign({rb:!0,kb:0},K),8!!ot),!1);for(var se=Qe,xe="/",je=0;je{for(var K;;){if(W===W.parent)return W=W.Ra.ub,K?W[W.length-1]!=="/"?W+"/"+K:W+K:W;K=K?W.name+"/"+K:W.name,W=W.parent}},Wr=(W,K)=>{for(var se=0,xe=0;xe>>0)%ue.length},en=W=>{var K=Wr(W.parent.id,W.name);if(ue[K]===W)ue[K]=W.Wa;else for(K=ue[K];K;){if(K.Wa===W){K.Wa=W.Wa;break}K=K.Wa}},tn=(W,K)=>{var se;if(se=(se=Pa(W,"x"))?se:W.Ga.lookup?0:2)throw new De(se,W);for(se=ue[Wr(W.id,K)];se;se=se.Wa){var xe=se.name;if(se.parent.id===W.id&&xe===K)return se}return W.Ga.lookup(W,K)},ci=(W,K,se,xe)=>(W=new zb(W,K,se,xe),K=Wr(W.parent.id,W.name),W.Wa=ue[K],ue[K]=W),ns={r:0,"r+":2,w:577,"w+":578,a:1089,"a+":1090},Qi=W=>{var K=["r","w","rw"][W&3];return W&512&&(K+="w"),K},Pa=(W,K)=>{if(Pe)return 0;if(!K.includes("r")||W.mode&292){if(K.includes("w")&&!(W.mode&146)||K.includes("x")&&!(W.mode&73))return 2}else return 2;return 0},Dt=(W,K)=>{try{return tn(W,K),20}catch{}return Pa(W,"wx")},Hc=(W,K,se)=>{try{var xe=tn(W,K)}catch(je){return je.Ka}if(W=Pa(W,"wx"))return W;if(se){if((xe.mode&61440)!==16384)return 54;if(xe===xe.parent||Zt(xe)==="/")return 10}else if((xe.mode&61440)===16384)return 31;return 0},Wf=(W=0)=>{for(;4096>=W;W++)if(!Ge[W])return W;throw new De(33)},Va=(W,K)=>(sl||(sl=function(){this.$a={}},sl.prototype={},Object.defineProperties(sl.prototype,{object:{get:function(){return this.node},set:function(se){this.node=se}},flags:{get:function(){return this.$a.flags},set:function(se){this.$a.flags=se}},position:{get:function(){return this.$a.position},set:function(se){this.$a.position=se}}})),W=Object.assign(new sl,W),K=Wf(K),W.fd=K,Ge[K]=W),Eu={open:W=>{W.Ha=et[W.node.rdev].Ha,W.Ha.open&&W.Ha.open(W)},Ta:()=>{throw new De(70)}},Yr=(W,K)=>{et[W]={Ha:K}},Ul=(W,K)=>{var se=K==="/",xe=!K;if(se&&Qe)throw new De(10);if(!se&&!xe){var je=ht(K,{rb:!1});if(K=je.path,je=je.node,je.Va)throw new De(10);if((je.mode&61440)!==16384)throw new De(54)}K={type:W,Kb:{},ub:K,Eb:[]},W=W.Ra(K),W.Ra=K,K.root=W,se?Qe=W:je&&(je.Va=K,je.Ra&&je.Ra.Eb.push(K))},Am=(W,K,se)=>{var xe=ht(W,{parent:!0}).node;if(W=he(W),!W||W==="."||W==="..")throw new De(28);var je=Dt(xe,W);if(je)throw new De(je);if(!xe.Ga.ab)throw new De(63);return xe.Ga.ab(xe,W,K,se)},fi=(W,K)=>Am(W,(K!==void 0?K:511)&1023|16384,0),is=(W,K,se)=>{typeof se>"u"&&(se=K,K=438),Am(W,K|8192,se)},Ts=(W,K)=>{if(!Ye(W))throw new De(44);var se=ht(K,{parent:!0}).node;if(!se)throw new De(44);K=he(K);var xe=Dt(se,K);if(xe)throw new De(xe);if(!se.Ga.symlink)throw new De(63);se.Ga.symlink(se,K,W)},ia=W=>{var K=ht(W,{parent:!0}).node;W=he(W);var se=tn(K,W),xe=Hc(K,W,!0);if(xe)throw new De(xe);if(!K.Ga.rmdir)throw new De(63);if(se.Va)throw new De(10);K.Ga.rmdir(K,W),en(se)},Fs=W=>{var K=ht(W,{parent:!0}).node;if(!K)throw new De(44);W=he(W);var se=tn(K,W),xe=Hc(K,W,!1);if(xe)throw new De(xe);if(!K.Ga.unlink)throw new De(63);if(se.Va)throw new De(10);K.Ga.unlink(K,W),en(se)},Wl=W=>{if(W=ht(W).node,!W)throw new De(44);if(!W.Ga.readlink)throw new De(28);return Ye(Zt(W.parent),W.Ga.readlink(W))},ol=(W,K)=>{if(W=ht(W,{Sa:!K}).node,!W)throw new De(44);if(!W.Ga.Pa)throw new De(63);return W.Ga.Pa(W)},kg=W=>ol(W,!0),Vc=(W,K)=>{if(W=typeof W=="string"?ht(W,{Sa:!0}).node:W,!W.Ga.Oa)throw new De(63);W.Ga.Oa(W,{mode:K&4095|W.mode&-4096,timestamp:Date.now()})},Cg=(W,K)=>{if(0>K)throw new De(28);if(W=typeof W=="string"?ht(W,{Sa:!0}).node:W,!W.Ga.Oa)throw new De(63);if((W.mode&61440)===16384)throw new De(31);if((W.mode&61440)!==32768)throw new De(28);var se=Pa(W,"w");if(se)throw new De(se);W.Ga.Oa(W,{size:K,timestamp:Date.now()})},_n=(W,K,se)=>{if(W==="")throw new De(44);if(typeof K=="string"){var xe=ns[K];if(typeof xe>"u")throw Error("Unknown file open mode: "+K);K=xe}if(se=K&64?(typeof se>"u"?438:se)&4095|32768:0,typeof W=="object")var je=W;else{W=Ce(W);try{je=ht(W,{Sa:!(K&131072)}).node}catch{}}if(xe=!1,K&64)if(je){if(K&128)throw new De(20)}else je=Am(W,se,0),xe=!0;if(!je)throw new De(44);if((je.mode&61440)===8192&&(K&=-513),K&65536&&(je.mode&61440)!==16384)throw new De(54);if(!xe&&(se=je?(je.mode&61440)===40960?32:(je.mode&61440)===16384&&(Qi(K)!=="r"||K&512)?31:Pa(je,Qi(K)):44))throw new De(se);return K&512&&!xe&&Cg(je,0),K&=-131713,je=Va({node:je,path:Zt(je),flags:K,seekable:!0,position:0,Ha:je.Ha,Ib:[],error:!1}),je.Ha.open&&je.Ha.open(je),!a.logReadFiles||K&1||(sp||(sp={}),W in sp||(sp[W]=1)),je},Hf=W=>{if(W.fd===null)throw new De(8);W.hb&&(W.hb=null);try{W.Ha.close&&W.Ha.close(W)}catch(K){throw K}finally{Ge[W.fd]=null}W.fd=null},Dg=(W,K,se)=>{if(W.fd===null)throw new De(8);if(!W.seekable||!W.Ha.Ta)throw new De(70);if(se!=0&&se!=1&&se!=2)throw new De(28);W.position=W.Ha.Ta(W,K,se),W.Ib=[]},Vh=(W,K,se,xe,je)=>{if(0>xe||0>je)throw new De(28);if(W.fd===null)throw new De(8);if((W.flags&2097155)===1)throw new De(8);if((W.node.mode&61440)===16384)throw new De(31);if(!W.Ha.read)throw new De(28);var Ke=typeof je<"u";if(!Ke)je=W.position;else if(!W.seekable)throw new De(70);return K=W.Ha.read(W,K,se,xe,je),Ke||(W.position+=K),K},gm=(W,K,se,xe,je)=>{if(0>xe||0>je)throw new De(28);if(W.fd===null)throw new De(8);if((W.flags&2097155)===0)throw new De(8);if((W.node.mode&61440)===16384)throw new De(31);if(!W.Ha.write)throw new De(28);W.seekable&&W.flags&1024&&Dg(W,0,2);var Ke=typeof je<"u";if(!Ke)je=W.position;else if(!W.seekable)throw new De(70);return K=W.Ha.write(W,K,se,xe,je,void 0),Ke||(W.position+=K),K},Og=W=>{var K="binary";if(K!=="utf8"&&K!=="binary")throw Error('Invalid encoding type "'+K+'"');var se,xe=_n(W,xe||0);W=ol(W).size;var je=new Uint8Array(W);return Vh(xe,je,0,W,0),K==="utf8"?se=O(je,0):K==="binary"&&(se=je),Hf(xe),se},Gh=()=>{De||(De=function(W,K){this.node=K,this.Hb=function(se){this.Ka=se},this.Hb(W),this.message="FS error"},De.prototype=Error(),De.prototype.constructor=De,[44].forEach(W=>{at[W]=new De(W),at[W].stack=""}))},Vf,kn=(W,K)=>{var se=0;return W&&(se|=365),K&&(se|=146),se},Ia=(W,K,se)=>{W=Ce("/dev/"+W);var xe=kn(!!K,!!se);Qh||(Qh=64);var je=Qh++<<8|0;Yr(je,{open:Ke=>{Ke.seekable=!1},close:()=>{se&&se.buffer&&se.buffer.length&&se(10)},read:(Ke,ot,xr,Pn)=>{for(var sn=0,aa=0;aa{for(var sn=0;sn>2]=xe.dev,T[se+8>>2]=xe.ino,T[se+12>>2]=xe.mode,L[se+16>>2]=xe.nlink,T[se+20>>2]=xe.uid,T[se+24>>2]=xe.gid,T[se+28>>2]=xe.rdev,J=[xe.size>>>0,(R=xe.size,1<=+Math.abs(R)?0>>0:~~+Math.ceil((R-+(~~R>>>0))/4294967296)>>>0:0)],T[se+40>>2]=J[0],T[se+44>>2]=J[1],T[se+48>>2]=4096,T[se+52>>2]=xe.blocks,J=[Math.floor(xe.atime.getTime()/1e3)>>>0,(R=Math.floor(xe.atime.getTime()/1e3),1<=+Math.abs(R)?0>>0:~~+Math.ceil((R-+(~~R>>>0))/4294967296)>>>0:0)],T[se+56>>2]=J[0],T[se+60>>2]=J[1],L[se+64>>2]=0,J=[Math.floor(xe.mtime.getTime()/1e3)>>>0,(R=Math.floor(xe.mtime.getTime()/1e3),1<=+Math.abs(R)?0>>0:~~+Math.ceil((R-+(~~R>>>0))/4294967296)>>>0:0)],T[se+72>>2]=J[0],T[se+76>>2]=J[1],L[se+80>>2]=0,J=[Math.floor(xe.ctime.getTime()/1e3)>>>0,(R=Math.floor(xe.ctime.getTime()/1e3),1<=+Math.abs(R)?0>>0:~~+Math.ceil((R-+(~~R>>>0))/4294967296)>>>0:0)],T[se+88>>2]=J[0],T[se+92>>2]=J[1],L[se+96>>2]=0,J=[xe.ino>>>0,(R=xe.ino,1<=+Math.abs(R)?0>>0:~~+Math.ceil((R-+(~~R>>>0))/4294967296)>>>0:0)],T[se+104>>2]=J[0],T[se+108>>2]=J[1],0}var vm=void 0;function ku(){return vm+=4,T[vm-4>>2]}function ll(W){if(W=Ge[W],!W)throw new De(8);return W}function r1(W){return L[W>>2]+4294967296*T[W+4>>2]}function n1(W){var K=D(W)+1,se=Xh(K);return se&&N(W,q,se,K),se}function ym(W,K,se){function xe(Pn){return(Pn=Pn.toTimeString().match(/\(([A-Za-z ]+)\)$/))?Pn[1]:"GMT"}var je=new Date().getFullYear(),Ke=new Date(je,0,1),ot=new Date(je,6,1);je=Ke.getTimezoneOffset();var xr=ot.getTimezoneOffset();T[W>>2]=60*Math.max(je,xr),T[K>>2]=Number(je!=xr),W=xe(Ke),K=xe(ot),W=n1(W),K=n1(K),xr>2]=W,L[se+4>>2]=K):(L[se>>2]=K,L[se+4>>2]=W)}function Gf(W,K,se){Gf.Bb||(Gf.Bb=!0,ym(W,K,se))}var i1;i1=c?()=>{var W=process.hrtime();return 1e3*W[0]+W[1]/1e6}:()=>performance.now();var Qf={};function Hl(){if(!Yh){var W={USER:"web_user",LOGNAME:"web_user",PATH:"/",PWD:"/",HOME:"/home/web_user",LANG:(typeof navigator=="object"&&navigator.languages&&navigator.languages[0]||"C").replace("-","_")+".UTF-8",_:s||"./this.program"},K;for(K in Qf)Qf[K]===void 0?delete W[K]:W[K]=Qf[K];var se=[];for(K in W)se.push(K+"="+W[K]);Yh=se}return Yh}var Yh,ul=void 0,jg=[];function Ng(W,K){if(!ul){ul=new WeakMap;var se=te.length;if(ul)for(var xe=0;xe<0+se;xe++){var je=te.get(xe);je&&ul.set(je,xe)}}if(ul.has(W))return ul.get(W);if(jg.length)se=jg.pop();else{try{te.grow(1)}catch(xr){throw xr instanceof RangeError?"Unable to grow wasm table. Set ALLOW_TABLE_GROWTH.":xr}se=te.length-1}try{te.set(se,W)}catch(xr){if(!(xr instanceof TypeError))throw xr;if(typeof WebAssembly.Function=="function"){xe=WebAssembly.Function,je={i:"i32",j:"i64",f:"f32",d:"f64",p:"i32"};for(var Ke={parameters:[],results:K[0]=="v"?[]:[je[K[0]]]},ot=1;otot?xe.push(ot):xe.push(ot%128|128,ot>>7),ot=0;otje?K.push(je):K.push(je%128|128,je>>7),K.push.apply(K,xe),K.push(2,7,1,1,101,1,102,0,0,7,5,1,1,102,0,0),K=new WebAssembly.Module(new Uint8Array(K)),K=new WebAssembly.Instance(K,{e:{f:W}}).exports.f}te.set(se,K)}return ul.set(W,se),se}function Zh(W){ul.delete(te.get(W)),jg.push(W)}var qb=0,Lb=1;function Tg(W){var K=qb==Lb?Cu(W.length):Xh(W.length);return W.subarray||W.slice||(W=new Uint8Array(W)),z.set(W,K),K}function Fg(W,K,se,xe){var je={string:sn=>{var aa=0;if(sn!=null&&sn!==0){var Ju=(sn.length<<2)+1;aa=Cu(Ju),N(sn,z,aa,Ju)}return aa},array:sn=>{var aa=Cu(sn.length);return q.set(sn,aa),aa}};W=a["_"+W];var Ke=[],ot=0;if(xe)for(var xr=0;xr{fi("/dev"),Yr(259,{read:()=>0,write:(K,se,xe,je)=>je}),is("/dev/null",259),we(1280,Le),we(1536,Ze),is("/dev/tty",1280),is("/dev/tty1",1536);var W=ze();Ia("random",W),Ia("urandom",W),fi("/dev/shm"),fi("/dev/shm/tmp")})(),(()=>{fi("/proc");var W=fi("/proc/self");fi("/proc/self/fd"),Ul({Ra:()=>{var K=ci(W,"fd",16895,73);return K.Ga={lookup:(se,xe)=>{var je=Ge[+xe];if(!je)throw new De(8);return se={parent:null,Ra:{ub:"fake"},Ga:{readlink:()=>je.path}},se.parent=se}},K}},"/proc/self/fd")})();var Ub={a:function(W,K,se,xe){me("Assertion failed: "+C(W)+", at: "+[K?C(K):"unknown filename",se,xe?C(xe):"unknown function"])},h:function(W,K){try{return W=C(W),Vc(W,K),0}catch(se){if(typeof Cn>"u"||!(se instanceof De))throw se;return-se.Ka}},H:function(W,K,se){try{if(K=C(K),K=Gc(W,K),se&-8)return-28;var xe=ht(K,{Sa:!0}).node;return xe?(W="",se&4&&(W+="r"),se&2&&(W+="w"),se&1&&(W+="x"),W&&Pa(xe,W)?-2:0):-44}catch(je){if(typeof Cn>"u"||!(je instanceof De))throw je;return-je.Ka}},i:function(W,K){try{var se=Ge[W];if(!se)throw new De(8);return Vc(se.node,K),0}catch(xe){if(typeof Cn>"u"||!(xe instanceof De))throw xe;return-xe.Ka}},g:function(W){try{var K=Ge[W];if(!K)throw new De(8);var se=K.node,xe=typeof se=="string"?ht(se,{Sa:!0}).node:se;if(!xe.Ga.Oa)throw new De(63);return xe.Ga.Oa(xe,{timestamp:Date.now()}),0}catch(je){if(typeof Cn>"u"||!(je instanceof De))throw je;return-je.Ka}},b:function(W,K,se){vm=se;try{var xe=ll(W);switch(K){case 0:var je=ku();return 0>je?-28:Va(xe,je).fd;case 1:case 2:return 0;case 3:return xe.flags;case 4:return je=ku(),xe.flags|=je,0;case 5:return je=ku(),I[je+0>>1]=2,0;case 6:case 7:return 0;case 16:case 8:return-28;case 9:return T[Wb()>>2]=28,-1;default:return-28}}catch(Ke){if(typeof Cn>"u"||!(Ke instanceof De))throw Ke;return-Ke.Ka}},G:function(W,K){try{var se=ll(W);return Mg(ol,se.path,K)}catch(xe){if(typeof Cn>"u"||!(xe instanceof De))throw xe;return-xe.Ka}},l:function(W,K,se){try{if(K=se+2097152>>>0<4194305-!!K?(K>>>0)+4294967296*se:NaN,isNaN(K))return-61;var xe=Ge[W];if(!xe)throw new De(8);if((xe.flags&2097155)===0)throw new De(28);return Cg(xe.node,K),0}catch(je){if(typeof Cn>"u"||!(je instanceof De))throw je;return-je.Ka}},B:function(W,K){try{if(K===0)return-28;var se=D("/")+1;return K"u"||!(xe instanceof De))throw xe;return-xe.Ka}},E:function(W,K){try{return W=C(W),Mg(kg,W,K)}catch(se){if(typeof Cn>"u"||!(se instanceof De))throw se;return-se.Ka}},y:function(W,K,se){try{return K=C(K),K=Gc(W,K),K=Ce(K),K[K.length-1]==="/"&&(K=K.substr(0,K.length-1)),fi(K,se),0}catch(xe){if(typeof Cn>"u"||!(xe instanceof De))throw xe;return-xe.Ka}},D:function(W,K,se,xe){try{K=C(K);var je=xe&256;return K=Gc(W,K,xe&4096),Mg(je?kg:ol,K,se)}catch(Ke){if(typeof Cn>"u"||!(Ke instanceof De))throw Ke;return-Ke.Ka}},v:function(W,K,se,xe){vm=xe;try{K=C(K),K=Gc(W,K);var je=xe?ku():0;return _n(K,se,je).fd}catch(Ke){if(typeof Cn>"u"||!(Ke instanceof De))throw Ke;return-Ke.Ka}},t:function(W,K,se,xe){try{if(K=C(K),K=Gc(W,K),0>=xe)return-28;var je=Wl(K),Ke=Math.min(xe,D(je)),ot=q[se+Ke];return N(je,z,se,xe+1),q[se+Ke]=ot,Ke}catch(xr){if(typeof Cn>"u"||!(xr instanceof De))throw xr;return-xr.Ka}},s:function(W){try{return W=C(W),ia(W),0}catch(K){if(typeof Cn>"u"||!(K instanceof De))throw K;return-K.Ka}},F:function(W,K){try{return W=C(W),Mg(ol,W,K)}catch(se){if(typeof Cn>"u"||!(se instanceof De))throw se;return-se.Ka}},p:function(W,K,se){try{return K=C(K),K=Gc(W,K),se===0?Fs(K):se===512?ia(K):me("Invalid flags passed to unlinkat"),0}catch(xe){if(typeof Cn>"u"||!(xe instanceof De))throw xe;return-xe.Ka}},o:function(W,K,se){try{if(K=C(K),K=Gc(W,K,!0),se){var xe=r1(se),je=T[se+8>>2];Ke=1e3*xe+je/1e6,se+=16,xe=r1(se),je=T[se+8>>2],ot=1e3*xe+je/1e6}else var Ke=Date.now(),ot=Ke;W=Ke;var xr=ht(K,{Sa:!0}).node;return xr.Ga.Oa(xr,{timestamp:Math.max(W,ot)}),0}catch(Pn){if(typeof Cn>"u"||!(Pn instanceof De))throw Pn;return-Pn.Ka}},e:function(){return Date.now()},j:function(W,K){W=new Date(1e3*r1(W)),T[K>>2]=W.getSeconds(),T[K+4>>2]=W.getMinutes(),T[K+8>>2]=W.getHours(),T[K+12>>2]=W.getDate(),T[K+16>>2]=W.getMonth(),T[K+20>>2]=W.getFullYear()-1900,T[K+24>>2]=W.getDay();var se=new Date(W.getFullYear(),0,1);T[K+28>>2]=(W.getTime()-se.getTime())/864e5|0,T[K+36>>2]=-(60*W.getTimezoneOffset());var xe=new Date(W.getFullYear(),6,1).getTimezoneOffset();se=se.getTimezoneOffset(),T[K+32>>2]=(xe!=se&&W.getTimezoneOffset()==Math.min(se,xe))|0},w:function(W,K,se,xe,je,Ke){try{var ot=ll(xe);if((K&2)!==0&&(se&2)===0&&(ot.flags&2097155)!==2)throw new De(2);if((ot.flags&2097155)===1)throw new De(2);if(!ot.Ha.bb)throw new De(43);var xr=ot.Ha.bb(ot,W,je,K,se),Pn=xr.Fb;return T[Ke>>2]=xr.vb,Pn}catch(sn){if(typeof Cn>"u"||!(sn instanceof De))throw sn;return-sn.Ka}},x:function(W,K,se,xe,je,Ke){try{var ot=ll(je);if(se&2){var xr=z.slice(W,W+K);ot&&ot.Ha.cb&&ot.Ha.cb(ot,xr,Ke,K,xe)}}catch(Pn){if(typeof Cn>"u"||!(Pn instanceof De))throw Pn;return-Pn.Ka}},n:Gf,q:function(){return 2147483648},d:i1,c:function(W){var K=z.length;if(W>>>=0,2147483648=se;se*=2){var xe=K*(1+.2/se);xe=Math.min(xe,W+100663296);var je=Math;xe=Math.max(W,xe),je=je.min.call(je,2147483648,xe+(65536-xe%65536)%65536);e:{try{S.grow(je-P.byteLength+65535>>>16),oe();var Ke=1;break e}catch{}Ke=void 0}if(Ke)return!0}return!1},z:function(W,K){var se=0;return Hl().forEach(function(xe,je){var Ke=K+se;for(je=L[W+4*je>>2]=Ke,Ke=0;Ke>0]=xe.charCodeAt(Ke);q[je>>0]=0,se+=xe.length+1}),0},A:function(W,K){var se=Hl();L[W>>2]=se.length;var xe=0;return se.forEach(function(je){xe+=je.length+1}),L[K>>2]=xe,0},f:function(W){try{var K=ll(W);return Hf(K),0}catch(se){if(typeof Cn>"u"||!(se instanceof De))throw se;return se.Ka}},m:function(W,K){try{var se=ll(W);return q[K>>0]=se.tty?2:(se.mode&61440)===16384?3:(se.mode&61440)===40960?7:4,0}catch(xe){if(typeof Cn>"u"||!(xe instanceof De))throw xe;return xe.Ka}},u:function(W,K,se,xe){try{e:{var je=ll(W);W=K;for(var Ke=K=0;Ke>2],xr=L[W+4>>2];W+=8;var Pn=Vh(je,q,ot,xr);if(0>Pn){var sn=-1;break e}if(K+=Pn,Pn>2]=sn,0}catch(aa){if(typeof Cn>"u"||!(aa instanceof De))throw aa;return aa.Ka}},k:function(W,K,se,xe,je){try{if(K=se+2097152>>>0<4194305-!!K?(K>>>0)+4294967296*se:NaN,isNaN(K))return 61;var Ke=ll(W);return Dg(Ke,K,xe),J=[Ke.position>>>0,(R=Ke.position,1<=+Math.abs(R)?0>>0:~~+Math.ceil((R-+(~~R>>>0))/4294967296)>>>0:0)],T[je>>2]=J[0],T[je+4>>2]=J[1],Ke.hb&&K===0&&xe===0&&(Ke.hb=null),0}catch(ot){if(typeof Cn>"u"||!(ot instanceof De))throw ot;return ot.Ka}},C:function(W){try{var K=ll(W);return K.Ha&&K.Ha.fsync?K.Ha.fsync(K):0}catch(se){if(typeof Cn>"u"||!(se instanceof De))throw se;return se.Ka}},r:function(W,K,se,xe){try{e:{var je=ll(W);W=K;for(var Ke=K=0;Ke>2],xr=L[W+4>>2];W+=8;var Pn=gm(je,q,ot,xr);if(0>Pn){var sn=-1;break e}K+=Pn}sn=K}return L[xe>>2]=sn,0}catch(aa){if(typeof Cn>"u"||!(aa instanceof De))throw aa;return aa.Ka}}};(function(){function W(je){a.asm=je.exports,S=a.asm.I,oe(),te=a.asm.Aa,fe.unshift(a.asm.J),Oe--,a.monitorRunDependencies&&a.monitorRunDependencies(Oe),Oe==0&&(ve!==null&&(clearInterval(ve),ve=null),ye&&(je=ye,ye=null,je()))}function K(je){W(je.instance)}function se(je){return U().then(function(Ke){return WebAssembly.instantiate(Ke,xe)}).then(function(Ke){return Ke}).then(je,function(Ke){v("failed to asynchronously prepare wasm: "+Ke),me(Ke)})}var xe={a:Ub};if(Oe++,a.monitorRunDependencies&&a.monitorRunDependencies(Oe),a.instantiateWasm)try{return a.instantiateWasm(xe,W)}catch(je){return v("Module.instantiateWasm callback failed with error: "+je),!1}return function(){return x||typeof WebAssembly.instantiateStreaming!="function"||ke()||$.startsWith("file://")||c||typeof fetch!="function"?se(K):fetch($,{credentials:"same-origin"}).then(function(je){return WebAssembly.instantiateStreaming(je,xe).then(K,function(Ke){return v("wasm streaming compile failed: "+Ke),v("falling back to ArrayBuffer instantiation"),se(K)})})}(),{}})(),a.___wasm_call_ctors=function(){return(a.___wasm_call_ctors=a.asm.J).apply(null,arguments)},a._sqlite3_free=function(){return(a._sqlite3_free=a.asm.K).apply(null,arguments)},a._sqlite3_value_double=function(){return(a._sqlite3_value_double=a.asm.L).apply(null,arguments)},a._sqlite3_value_text=function(){return(a._sqlite3_value_text=a.asm.M).apply(null,arguments)};var Wb=a.___errno_location=function(){return(Wb=a.___errno_location=a.asm.N).apply(null,arguments)};a._sqlite3_prepare_v2=function(){return(a._sqlite3_prepare_v2=a.asm.O).apply(null,arguments)},a._sqlite3_step=function(){return(a._sqlite3_step=a.asm.P).apply(null,arguments)},a._sqlite3_finalize=function(){return(a._sqlite3_finalize=a.asm.Q).apply(null,arguments)},a._sqlite3_reset=function(){return(a._sqlite3_reset=a.asm.R).apply(null,arguments)},a._sqlite3_value_int=function(){return(a._sqlite3_value_int=a.asm.S).apply(null,arguments)},a._sqlite3_clear_bindings=function(){return(a._sqlite3_clear_bindings=a.asm.T).apply(null,arguments)},a._sqlite3_value_blob=function(){return(a._sqlite3_value_blob=a.asm.U).apply(null,arguments)},a._sqlite3_value_bytes=function(){return(a._sqlite3_value_bytes=a.asm.V).apply(null,arguments)},a._sqlite3_value_type=function(){return(a._sqlite3_value_type=a.asm.W).apply(null,arguments)},a._sqlite3_result_blob=function(){return(a._sqlite3_result_blob=a.asm.X).apply(null,arguments)},a._sqlite3_result_double=function(){return(a._sqlite3_result_double=a.asm.Y).apply(null,arguments)},a._sqlite3_result_error=function(){return(a._sqlite3_result_error=a.asm.Z).apply(null,arguments)},a._sqlite3_result_int=function(){return(a._sqlite3_result_int=a.asm._).apply(null,arguments)},a._sqlite3_result_int64=function(){return(a._sqlite3_result_int64=a.asm.$).apply(null,arguments)},a._sqlite3_result_null=function(){return(a._sqlite3_result_null=a.asm.aa).apply(null,arguments)},a._sqlite3_result_text=function(){return(a._sqlite3_result_text=a.asm.ba).apply(null,arguments)},a._sqlite3_sql=function(){return(a._sqlite3_sql=a.asm.ca).apply(null,arguments)},a._sqlite3_aggregate_context=function(){return(a._sqlite3_aggregate_context=a.asm.da).apply(null,arguments)},a._sqlite3_column_count=function(){return(a._sqlite3_column_count=a.asm.ea).apply(null,arguments)},a._sqlite3_data_count=function(){return(a._sqlite3_data_count=a.asm.fa).apply(null,arguments)},a._sqlite3_column_blob=function(){return(a._sqlite3_column_blob=a.asm.ga).apply(null,arguments)},a._sqlite3_column_bytes=function(){return(a._sqlite3_column_bytes=a.asm.ha).apply(null,arguments)},a._sqlite3_column_double=function(){return(a._sqlite3_column_double=a.asm.ia).apply(null,arguments)},a._sqlite3_column_text=function(){return(a._sqlite3_column_text=a.asm.ja).apply(null,arguments)},a._sqlite3_column_type=function(){return(a._sqlite3_column_type=a.asm.ka).apply(null,arguments)},a._sqlite3_column_name=function(){return(a._sqlite3_column_name=a.asm.la).apply(null,arguments)},a._sqlite3_bind_blob=function(){return(a._sqlite3_bind_blob=a.asm.ma).apply(null,arguments)},a._sqlite3_bind_double=function(){return(a._sqlite3_bind_double=a.asm.na).apply(null,arguments)},a._sqlite3_bind_int=function(){return(a._sqlite3_bind_int=a.asm.oa).apply(null,arguments)},a._sqlite3_bind_text=function(){return(a._sqlite3_bind_text=a.asm.pa).apply(null,arguments)},a._sqlite3_bind_parameter_index=function(){return(a._sqlite3_bind_parameter_index=a.asm.qa).apply(null,arguments)},a._sqlite3_normalized_sql=function(){return(a._sqlite3_normalized_sql=a.asm.ra).apply(null,arguments)},a._sqlite3_errmsg=function(){return(a._sqlite3_errmsg=a.asm.sa).apply(null,arguments)},a._sqlite3_exec=function(){return(a._sqlite3_exec=a.asm.ta).apply(null,arguments)},a._sqlite3_changes=function(){return(a._sqlite3_changes=a.asm.ua).apply(null,arguments)},a._sqlite3_close_v2=function(){return(a._sqlite3_close_v2=a.asm.va).apply(null,arguments)},a._sqlite3_create_function_v2=function(){return(a._sqlite3_create_function_v2=a.asm.wa).apply(null,arguments)},a._sqlite3_open=function(){return(a._sqlite3_open=a.asm.xa).apply(null,arguments)};var Xh=a._malloc=function(){return(Xh=a._malloc=a.asm.ya).apply(null,arguments)},_g=a._free=function(){return(_g=a._free=a.asm.za).apply(null,arguments)};a._RegisterExtensionFunctions=function(){return(a._RegisterExtensionFunctions=a.asm.Ba).apply(null,arguments)};var Hb=a._emscripten_builtin_memalign=function(){return(Hb=a._emscripten_builtin_memalign=a.asm.Ca).apply(null,arguments)},Kh=a.stackSave=function(){return(Kh=a.stackSave=a.asm.Da).apply(null,arguments)},Jh=a.stackRestore=function(){return(Jh=a.stackRestore=a.asm.Ea).apply(null,arguments)},Cu=a.stackAlloc=function(){return(Cu=a.stackAlloc=a.asm.Fa).apply(null,arguments)};a.UTF8ToString=C,a.stackAlloc=Cu,a.stackSave=Kh,a.stackRestore=Jh,a.cwrap=function(W,K,se,xe){se=se||[];var je=se.every(Ke=>Ke==="number"||Ke==="boolean");return K!=="string"&&je&&!xe?a["_"+W]:function(){return Fg(W,K,se,arguments)}};var Pg;ye=function W(){Pg||Vb(),Pg||(ye=W)};function Vb(){function W(){if(!Pg&&(Pg=!0,a.calledRun=!0,!k)){if(a.noFSInit||Vf||(Vf=!0,Gh(),a.stdin=a.stdin,a.stdout=a.stdout,a.stderr=a.stderr,a.stdin?Ia("stdin",a.stdin):Ts("/dev/tty","/dev/stdin"),a.stdout?Ia("stdout",null,a.stdout):Ts("/dev/tty","/dev/stdout"),a.stderr?Ia("stderr",null,a.stderr):Ts("/dev/tty1","/dev/stderr"),_n("/dev/stdin",0),_n("/dev/stdout",1),_n("/dev/stderr",1)),Pe=!1,ee(fe),a.onRuntimeInitialized&&a.onRuntimeInitialized(),a.postRun)for(typeof a.postRun=="function"&&(a.postRun=[a.postRun]);a.postRun.length;){var K=a.postRun.shift();Ie.unshift(K)}ee(Ie)}}if(!(0{"use strict";var $Oe=bl();yX.createRoot=$Oe.createRoot,yX.hydrateRoot=$Oe.hydrateRoot;var GDr});var rMe=vn((tMe,jX)=>{(function(e){if(typeof tMe=="object"&&typeof jX<"u")jX.exports=e();else if(typeof define=="function"&&define.amd)define([],e);else{var t;typeof window<"u"?t=window:typeof global<"u"?t=global:typeof self<"u"?t=self:t=this,t.pica=e()}})(function(){var e,t,r;return function(){function n(i,a,o){function s(c,f){if(!a[c]){if(!i[c]){var d=typeof require=="function"&&require;if(!f&&d)return d(c,!0);if(l)return l(c,!0);var p=new Error("Cannot find module '"+c+"'");throw p.code="MODULE_NOT_FOUND",p}var h=a[c]={exports:{}};i[c][0].call(h.exports,function(m){var g=i[c][1][m];return s(g||m)},h,h.exports,n,i,a,o)}return a[c].exports}for(var l=typeof require=="function"&&require,u=0;u=0,wasm:f.indexOf("wasm")>=0};o.call(this,d),this.features={js:d.js,wasm:d.wasm&&this.has_wasm()},this.use(s),this.use(l)}u.prototype=Object.create(o.prototype),u.prototype.constructor=u,u.prototype.resizeAndUnsharp=function(f,d){var p=this.resize(f,d);return f.unsharpAmount&&this.unsharp_mask(p,f.toWidth,f.toHeight,f.unsharpAmount,f.unsharpRadius,f.unsharpThreshold),p},i.exports=u},{"./mm_resize":4,"./mm_unsharp_mask":9,multimath:19}],2:[function(n,i,a){"use strict";function o(d){return d<0?0:d>255?255:d}function s(d){return d>=0?d:0}function l(d,p,h,m,g,A){var b,v,x,w,S,k,j,O,C,N,D,P=0,q=0;for(C=0;C0;j--)D=A[S++],w=w+D*d[O+3]|0,x=x+D*d[O+2]|0,v=v+D*d[O+1]|0,b=b+D*d[O]|0,O=O+4|0;p[q+3]=s(w>>7),p[q+2]=s(x>>7),p[q+1]=s(v>>7),p[q]=s(b>>7),q=q+m*4|0}q=(C+1)*4|0,P=(C+1)*h*4|0}}function u(d,p,h,m,g,A){var b,v,x,w,S,k,j,O,C,N,D,P=0,q=0;for(C=0;C0;j--)D=A[S++],w=w+D*d[O+3]|0,x=x+D*d[O+2]|0,v=v+D*d[O+1]|0,b=b+D*d[O]|0,O=O+4|0;b>>=7,v>>=7,x>>=7,w>>=7,p[q+3]=o(w+(1<<13)>>14),p[q+2]=o(x+(1<<13)>>14),p[q+1]=o(v+(1<<13)>>14),p[q]=o(b+(1<<13)>>14),q=q+m*4|0}q=(C+1)*4|0,P=(C+1)*h*4|0}}function c(d,p,h,m,g,A){var b,v,x,w,S,k,j,O,C,N,D,P,q=0,z=0;for(N=0;N0;O--)P=A[k++],S=d[C+3],w=w+P*S|0,x=x+P*d[C+2]*S|0,v=v+P*d[C+1]*S|0,b=b+P*d[C]*S|0,C=C+4|0;x=x/255|0,v=v/255|0,b=b/255|0,p[z+3]=s(w>>7),p[z+2]=s(x>>7),p[z+1]=s(v>>7),p[z]=s(b>>7),z=z+m*4|0}z=(N+1)*4|0,q=(N+1)*h*4|0}}function f(d,p,h,m,g,A){var b,v,x,w,S,k,j,O,C,N,D,P=0,q=0;for(C=0;C0;j--)D=A[S++],w=w+D*d[O+3]|0,x=x+D*d[O+2]|0,v=v+D*d[O+1]|0,b=b+D*d[O]|0,O=O+4|0;b>>=7,v>>=7,x>>=7,w>>=7,w=o(w+(1<<13)>>14),w>0&&(b=b*255/w|0,v=v*255/w|0,x=x*255/w|0),p[q+3]=w,p[q+2]=o(x+(1<<13)>>14),p[q+1]=o(v+(1<<13)>>14),p[q]=o(b+(1<<13)>>14),q=q+m*4|0}q=(C+1)*4|0,P=(C+1)*h*4|0}}i.exports={convolveHor:l,convolveVert:u,convolveHorWithPre:c,convolveVertWithPre:f}},{}],3:[function(n,i,a){"use strict";i.exports="AGFzbQEAAAAADAZkeWxpbmsAAAAAAAEYA2AGf39/f39/AGAAAGAIf39/f39/f38AAg8BA2VudgZtZW1vcnkCAAADBwYBAAAAAAIGBgF/AEEACweUAQgRX193YXNtX2NhbGxfY3RvcnMAAAtjb252b2x2ZUhvcgABDGNvbnZvbHZlVmVydAACEmNvbnZvbHZlSG9yV2l0aFByZQADE2NvbnZvbHZlVmVydFdpdGhQcmUABApjb252b2x2ZUhWAAUMX19kc29faGFuZGxlAwAYX193YXNtX2FwcGx5X2RhdGFfcmVsb2NzAAAKyA4GAwABC4wDARB/AkAgA0UNACAERQ0AIANBAnQhFQNAQQAhE0EAIQsDQCALQQJqIQcCfyALQQF0IAVqIgYuAQIiC0UEQEEAIQhBACEGQQAhCUEAIQogBwwBCyASIAYuAQBqIQhBACEJQQAhCiALIRRBACEOIAchBkEAIQ8DQCAFIAZBAXRqLgEAIhAgACAIQQJ0aigCACIRQRh2bCAPaiEPIBFB/wFxIBBsIAlqIQkgEUEQdkH/AXEgEGwgDmohDiARQQh2Qf8BcSAQbCAKaiEKIAhBAWohCCAGQQFqIQYgFEEBayIUDQALIAlBB3UhCCAKQQd1IQYgDkEHdSEJIA9BB3UhCiAHIAtqCyELIAEgDEEBdCIHaiAIQQAgCEEAShs7AQAgASAHQQJyaiAGQQAgBkEAShs7AQAgASAHQQRyaiAJQQAgCUEAShs7AQAgASAHQQZyaiAKQQAgCkEAShs7AQAgDCAVaiEMIBNBAWoiEyAERw0ACyANQQFqIg0gAmwhEiANQQJ0IQwgAyANRw0ACwsL2gMBD38CQCADRQ0AIARFDQAgAkECdCEUA0AgCyEMQQAhE0EAIQIDQCACQQJqIQYCfyACQQF0IAVqIgcuAQIiAkUEQEEAIQhBACEHQQAhCkEAIQkgBgwBCyAHLgEAQQJ0IBJqIQhBACEJIAIhCkEAIQ0gBiEHQQAhDkEAIQ8DQCAFIAdBAXRqLgEAIhAgACAIQQF0IhFqLwEAbCAJaiEJIAAgEUEGcmovAQAgEGwgDmohDiAAIBFBBHJqLwEAIBBsIA9qIQ8gACARQQJyai8BACAQbCANaiENIAhBBGohCCAHQQFqIQcgCkEBayIKDQALIAlBB3UhCCANQQd1IQcgDkEHdSEKIA9BB3UhCSACIAZqCyECIAEgDEECdGogB0GAQGtBDnUiBkH/ASAGQf8BSBsiBkEAIAZBAEobQQh0QYD+A3EgCUGAQGtBDnUiBkH/ASAGQf8BSBsiBkEAIAZBAEobQRB0QYCA/AdxIApBgEBrQQ51IgZB/wEgBkH/AUgbIgZBACAGQQBKG0EYdHJyIAhBgEBrQQ51IgZB/wEgBkH/AUgbIgZBACAGQQBKG3I2AgAgAyAMaiEMIBNBAWoiEyAERw0ACyAUIAtBAWoiC2whEiADIAtHDQALCwuSAwEQfwJAIANFDQAgBEUNACADQQJ0IRUDQEEAIRNBACEGA0AgBkECaiEIAn8gBkEBdCAFaiIGLgECIgdFBEBBACEJQQAhDEEAIQ1BACEOIAgMAQsgEiAGLgEAaiEJQQAhDkEAIQ1BACEMIAchFEEAIQ8gCCEGA0AgBSAGQQF0ai4BACAAIAlBAnRqKAIAIhBBGHZsIhEgD2ohDyARIBBBEHZB/wFxbCAMaiEMIBEgEEEIdkH/AXFsIA1qIQ0gESAQQf8BcWwgDmohDiAJQQFqIQkgBkEBaiEGIBRBAWsiFA0ACyAPQQd1IQkgByAIagshBiABIApBAXQiCGogDkH/AW1BB3UiB0EAIAdBAEobOwEAIAEgCEECcmogDUH/AW1BB3UiB0EAIAdBAEobOwEAIAEgCEEEcmogDEH/AW1BB3UiB0EAIAdBAEobOwEAIAEgCEEGcmogCUEAIAlBAEobOwEAIAogFWohCiATQQFqIhMgBEcNAAsgC0EBaiILIAJsIRIgC0ECdCEKIAMgC0cNAAsLC4IEAQ9/AkAgA0UNACAERQ0AIAJBAnQhFANAIAshDEEAIRJBACEHA0AgB0ECaiEKAn8gB0EBdCAFaiICLgECIhNFBEBBACEIQQAhCUEAIQYgCiEHQQAMAQsgAi4BAEECdCARaiEJQQAhByATIQJBACENIAohBkEAIQ5BACEPA0AgBSAGQQF0ai4BACIIIAAgCUEBdCIQai8BAGwgB2ohByAAIBBBBnJqLwEAIAhsIA5qIQ4gACAQQQRyai8BACAIbCAPaiEPIAAgEEECcmovAQAgCGwgDWohDSAJQQRqIQkgBkEBaiEGIAJBAWsiAg0ACyAHQQd1IQggDUEHdSEJIA9BB3UhBiAKIBNqIQcgDkEHdQtBgEBrQQ51IgJB/wEgAkH/AUgbIgJBACACQQBKGyIKQf8BcQRAIAlB/wFsIAJtIQkgCEH/AWwgAm0hCCAGQf8BbCACbSEGCyABIAxBAnRqIAlBgEBrQQ51IgJB/wEgAkH/AUgbIgJBACACQQBKG0EIdEGA/gNxIAZBgEBrQQ51IgJB/wEgAkH/AUgbIgJBACACQQBKG0EQdEGAgPwHcSAKQRh0ciAIQYBAa0EOdSICQf8BIAJB/wFIGyICQQAgAkEAShtycjYCACADIAxqIQwgEkEBaiISIARHDQALIBQgC0EBaiILbCERIAMgC0cNAAsLC0AAIAcEQEEAIAIgAyAEIAUgABADIAJBACAEIAUgBiABEAQPC0EAIAIgAyAEIAUgABABIAJBACAEIAUgBiABEAIL"},{}],4:[function(n,i,a){"use strict";i.exports={name:"resize",fn:n("./resize"),wasm_fn:n("./resize_wasm"),wasm_src:n("./convolve_wasm_base64")}},{"./convolve_wasm_base64":3,"./resize":5,"./resize_wasm":8}],5:[function(n,i,a){"use strict";var o=n("./resize_filter_gen"),s=n("./convolve"),l=s.convolveHor,u=s.convolveVert,c=s.convolveHorWithPre,f=s.convolveVertWithPre;function d(h,m,g){for(var A=3,b=m*g*4|0;A"u"?"mks2013":m.filter,N=o(C,A,v,w,k),D=o(C,b,x,S,j),P=new Uint16Array(v*b*4);return d(g,A,b)?(c(g,P,A,b,v,N),f(P,O,b,v,x,D)):(l(g,P,A,b,v,N),u(P,O,b,v,x,D),p(O,v,x)),O}},{"./convolve":2,"./resize_filter_gen":6}],6:[function(n,i,a){"use strict";var o=n("./resize_filter_info"),s=14;function l(u){return Math.round(u*((1<>1]+=l(1-q),I=0;I0&&O[T]===0;)T--;if(L=w+I,_=T-I+1,oe[te++]=L,oe[te++]=_,!Q)oe.set(O.subarray(I,T+1),te),te+=_;else for(D=I;D<=T;D++)oe[te++]=O[D]}else oe[te++]=0,oe[te++]=0}return oe}},{"./resize_filter_info":7}],7:[function(n,i,a){"use strict";var o={box:{win:.5,fn:function(l){return l<0&&(l=-l),l<.5?1:0}},hamming:{win:1,fn:function(l){if(l<0&&(l=-l),l>=1)return 0;if(l<11920929e-14)return 1;var u=l*Math.PI;return Math.sin(u)/u*(.54+.46*Math.cos(u/1))}},lanczos2:{win:2,fn:function(l){if(l<0&&(l=-l),l>=2)return 0;if(l<11920929e-14)return 1;var u=l*Math.PI;return Math.sin(u)/u*Math.sin(u/2)/(u/2)}},lanczos3:{win:3,fn:function(l){if(l<0&&(l=-l),l>=3)return 0;if(l<11920929e-14)return 1;var u=l*Math.PI;return Math.sin(u)/u*Math.sin(u/3)/(u/3)}},mks2013:{win:2.5,fn:function(l){return l<0&&(l=-l),l>=2.5?0:l>=1.5?-.125*(l-2.5)*(l-2.5):l>=.5?.25*(4*l*l-11*l+7):1.0625-1.75*l*l}}};i.exports={filter:o,f2q:{box:0,hamming:1,lanczos2:2,lanczos3:3},q2f:["box","hamming","lanczos2","lanczos3"]}},{}],8:[function(n,i,a){"use strict";var o=n("./resize_filter_gen");function s(d,p,h){for(var m=3,g=p*h*4|0;m>8&255}}i.exports=function(p){var h=p.src,m=p.width,g=p.height,A=p.toWidth,b=p.toHeight,v=p.scaleX||p.toWidth/p.width,x=p.scaleY||p.toHeight/p.height,w=p.offsetX||0,S=p.offsetY||0,k=p.dest||new Uint8Array(A*b*4),j=typeof p.filter>"u"?"mks2013":p.filter,O=o(j,m,A,v,w),C=o(j,g,b,x,S),N=0,D=Math.max(h.byteLength,k.byteLength),P=this.__align(N+D),q=g*A*4*2,z=this.__align(P+q),I=this.__align(z+O.byteLength),T=I+C.byteLength,L=this.__instance("resize",T),_=new Uint8Array(this.__memory.buffer),Y=new Uint32Array(this.__memory.buffer),oe=new Uint32Array(h.buffer);Y.set(oe),f(O,_,z),f(C,_,I);var te=L.exports.convolveHV||L.exports._convolveHV;s(h,m,g)?te(z,I,P,m,g,A,b,1):(te(z,I,P,m,g,A,b,0),l(k,A,b));var Q=new Uint32Array(k.buffer);return Q.set(new Uint32Array(this.__memory.buffer,0,b*A)),k}},{"./resize_filter_gen":6}],9:[function(n,i,a){"use strict";i.exports={name:"unsharp_mask",fn:n("./unsharp_mask"),wasm_fn:n("./unsharp_mask_wasm"),wasm_src:n("./unsharp_mask_wasm_base64")}},{"./unsharp_mask":10,"./unsharp_mask_wasm":11,"./unsharp_mask_wasm_base64":12}],10:[function(n,i,a){"use strict";var o=n("glur/mono16");function s(l,u,c){for(var f=u*c,d=new Uint16Array(f),p,h,m,g,A=0;A=h&&p>=m?p:h>=m&&h>=p?h:m,d[A]=g<<8;return d}i.exports=function(u,c,f,d,p,h){var m,g,A,b,v;if(!(d===0||p<.5)){p>2&&(p=2);var x=s(u,c,f),w=new Uint16Array(x);o(w,c,f,p);for(var S=d/100*4096+.5|0,k=h<<8,j=c*f,O=0;O=k&&(g=m+(S*b+2048>>12),g=g>65280?65280:g,g=g<0?0:g,m=m!==0?m:1,A=(g<<12)/m|0,v=O*4,u[v]=u[v]*A+2048>>12,u[v+1]=u[v+1]*A+2048>>12,u[v+2]=u[v+2]*A+2048>>12)}}},{"glur/mono16":18}],11:[function(n,i,a){"use strict";i.exports=function(s,l,u,c,f,d){if(!(c===0||f<.5)){f>2&&(f=2);var p=l*u,h=p*4,m=p*2,g=p*2,A=Math.max(l,u)*4,b=8*4,v=0,x=h,w=x+m,S=w+g,k=S+g,j=k+A,O=this.__instance("unsharp_mask",h+m+g*2+A+b,{exp:Math.exp}),C=new Uint32Array(s.buffer),N=new Uint32Array(this.__memory.buffer);N.set(C);var D=O.exports.hsv_v16||O.exports._hsv_v16;D(v,x,l,u),D=O.exports.blurMono16||O.exports._blurMono16,D(x,w,S,k,j,l,u,f),D=O.exports.unsharp||O.exports._unsharp,D(v,v,x,w,l,u,c,d),C.set(new Uint32Array(this.__memory.buffer,0,p))}}},{}],12:[function(n,i,a){"use strict";i.exports="AGFzbQEAAAAADAZkeWxpbmsAAAAAAAE0B2AAAGAEf39/fwBgBn9/f39/fwBgCH9/f39/f39/AGAIf39/f39/f30AYAJ9fwBgAXwBfAIZAgNlbnYDZXhwAAYDZW52Bm1lbW9yeQIAAAMHBgAFAgQBAwYGAX8AQQALB4oBCBFfX3dhc21fY2FsbF9jdG9ycwABFl9fYnVpbGRfZ2F1c3NpYW5fY29lZnMAAg5fX2dhdXNzMTZfbGluZQADCmJsdXJNb25vMTYABAdoc3ZfdjE2AAUHdW5zaGFycAAGDF9fZHNvX2hhbmRsZQMAGF9fd2FzbV9hcHBseV9kYXRhX3JlbG9jcwABCsUMBgMAAQvWAQEHfCABRNuGukOCGvs/IAC7oyICRAAAAAAAAADAohAAIgW2jDgCFCABIAKaEAAiAyADoCIGtjgCECABRAAAAAAAAPA/IAOhIgQgBKIgAyACIAKgokQAAAAAAADwP6AgBaGjIgS2OAIAIAEgBSAEmqIiB7Y4AgwgASADIAJEAAAAAAAA8D+gIASioiIItjgCCCABIAMgAkQAAAAAAADwv6AgBKKiIgK2OAIEIAEgByAIoCAFRAAAAAAAAPA/IAahoCIDo7Y4AhwgASAEIAKgIAOjtjgCGAuGBQMGfwl8An0gAyoCDCEVIAMqAgghFiADKgIUuyERIAMqAhC7IRACQCAEQQFrIghBAEgiCQRAIAIhByAAIQYMAQsgAiAALwEAuCIPIAMqAhi7oiIMIBGiIg0gDCAQoiAPIAMqAgS7IhOiIhQgAyoCALsiEiAPoqCgoCIOtjgCACACQQRqIQcgAEECaiEGIAhFDQAgCEEBIAhBAUgbIgpBf3MhCwJ/IAQgCmtBAXFFBEAgDiENIAgMAQsgAiANIA4gEKIgFCASIAAvAQK4Ig+ioKCgIg22OAIEIAJBCGohByAAQQRqIQYgDiEMIARBAmsLIQIgC0EAIARrRg0AA0AgByAMIBGiIA0gEKIgDyAToiASIAYvAQC4Ig6ioKCgIgy2OAIAIAcgDSARoiAMIBCiIA4gE6IgEiAGLwECuCIPoqCgoCINtjgCBCAHQQhqIQcgBkEEaiEGIAJBAkohACACQQJrIQIgAA0ACwsCQCAJDQAgASAFIAhsQQF0aiIAAn8gBkECay8BACICuCINIBW7IhKiIA0gFrsiE6KgIA0gAyoCHLuiIgwgEKKgIAwgEaKgIg8gB0EEayIHKgIAu6AiDkQAAAAAAADwQWMgDkQAAAAAAAAAAGZxBEAgDqsMAQtBAAs7AQAgCEUNACAGQQRrIQZBACAFa0EBdCEBA0ACfyANIBKiIAJB//8DcbgiDSAToqAgDyIOIBCioCAMIBGioCIPIAdBBGsiByoCALugIgxEAAAAAAAA8EFjIAxEAAAAAAAAAABmcQRAIAyrDAELQQALIQMgBi8BACECIAAgAWoiACADOwEAIAZBAmshBiAIQQFKIQMgDiEMIAhBAWshCCADDQALCwvRAgIBfwd8AkAgB0MAAAAAWw0AIARE24a6Q4Ia+z8gB0MAAAA/l7ujIglEAAAAAAAAAMCiEAAiDLaMOAIUIAQgCZoQACIKIAqgIg22OAIQIAREAAAAAAAA8D8gCqEiCyALoiAKIAkgCaCiRAAAAAAAAPA/oCAMoaMiC7Y4AgAgBCAMIAuaoiIOtjgCDCAEIAogCUQAAAAAAADwP6AgC6KiIg+2OAIIIAQgCiAJRAAAAAAAAPC/oCALoqIiCbY4AgQgBCAOIA+gIAxEAAAAAAAA8D8gDaGgIgqjtjgCHCAEIAsgCaAgCqO2OAIYIAYEQANAIAAgBSAIbEEBdGogAiAIQQF0aiADIAQgBSAGEAMgCEEBaiIIIAZHDQALCyAFRQ0AQQAhCANAIAIgBiAIbEEBdGogASAIQQF0aiADIAQgBiAFEAMgCEEBaiIIIAVHDQALCwtxAQN/IAIgA2wiBQRAA0AgASAAKAIAIgRBEHZB/wFxIgIgAiAEQQh2Qf8BcSIDIAMgBEH/AXEiBEkbIAIgA0sbIgYgBiAEIAIgBEsbIAMgBEsbQQh0OwEAIAFBAmohASAAQQRqIQAgBUEBayIFDQALCwuZAgIDfwF8IAQgBWwhBAJ/IAazQwAAgEWUQwAAyEKVu0QAAAAAAADgP6AiC5lEAAAAAAAA4EFjBEAgC6oMAQtBgICAgHgLIQUgBARAIAdBCHQhCUEAIQYDQCAJIAIgBkEBdCIHai8BACIBIAMgB2ovAQBrIgcgB0EfdSIIaiAIc00EQCAAIAZBAnQiCGoiCiAFIAdsQYAQakEMdSABaiIHQYD+AyAHQYD+A0gbIgdBACAHQQBKG0EMdCABQQEgARtuIgEgCi0AAGxBgBBqQQx2OgAAIAAgCEEBcmoiByABIActAABsQYAQakEMdjoAACAAIAhBAnJqIgcgASAHLQAAbEGAEGpBDHY6AAALIAZBAWoiBiAERw0ACwsL"},{}],13:[function(n,i,a){"use strict";var o=100;function s(l,u){this.create=l,this.available=[],this.acquired={},this.lastId=1,this.timeoutId=0,this.idle=u||2e3}s.prototype.acquire=function(){var l=this,u;return this.available.length!==0?u=this.available.pop():(u=this.create(),u.id=this.lastId++,u.release=function(){return l.release(u)}),this.acquired[u.id]=u,u},s.prototype.release=function(l){var u=this;delete this.acquired[l.id],l.lastUsed=Date.now(),this.available.push(l),this.timeoutId===0&&(this.timeoutId=setTimeout(function(){return u.gc()},o))},s.prototype.gc=function(){var l=this,u=Date.now();this.available=this.available.filter(function(c){return u-c.lastUsed>l.idle?(c.destroy(),!1):!0}),this.available.length!==0?this.timeoutId=setTimeout(function(){return l.gc()},o):this.timeoutId=0},i.exports=s},{}],14:[function(n,i,a){"use strict";var o=2;i.exports=function(l,u,c,f,d,p){var h=c/l,m=f/u,g=(2*p+o+1)/d;if(g>.5)return[[c,f]];var A=Math.ceil(Math.log(Math.min(h,m))/Math.log(g));if(A<=1)return[[c,f]];for(var b=[],v=0;v=c.toWidth&&(v=c.toWidth-m),g=b-c.destTileBorder,g<0&&(g=0),x=b+h+c.destTileBorder-g,g+x>=c.toHeight&&(x=c.toHeight-g),S={toX:m,toY:g,toWidth:v,toHeight:x,toInnerX:A,toInnerY:b,toInnerWidth:p,toInnerHeight:h,offsetX:m/f-s(m/f),offsetY:g/d-s(g/d),scaleX:f,scaleY:d,x:s(m/f),y:s(g/d),width:l(v/f),height:l(x/d)},w.push(S);return w}},{}],16:[function(n,i,a){"use strict";function o(s){return Object.prototype.toString.call(s)}i.exports.isCanvas=function(l){var u=o(l);return u==="[object HTMLCanvasElement]"||u==="[object OffscreenCanvas]"||u==="[object Canvas]"},i.exports.isImage=function(l){return o(l)==="[object HTMLImageElement]"},i.exports.isImageBitmap=function(l){return o(l)==="[object ImageBitmap]"},i.exports.limiter=function(l){var u=0,c=[];function f(){u"u")return!1;var u=l(100,100);return createImageBitmap(u,0,0,100,100,{resizeWidth:10,resizeHeight:10,resizeQuality:"high"}).then(function(c){var f=c.width===10;return c.close(),u=null,f})}).catch(function(){return!1})},i.exports.worker_offscreen_canvas_support=function(){return new Promise(function(l,u){if(typeof OffscreenCanvas>"u"){l(!1);return}function c(p){if(typeof createImageBitmap>"u"){p.postMessage(!1);return}Promise.resolve().then(function(){var h=new OffscreenCanvas(10,10),m=h.getContext("2d");return m.rect(0,0,1,1),createImageBitmap(h,0,0,1,1)}).then(function(){return p.postMessage(!0)},function(){return p.postMessage(!1)})}var f=btoa("(".concat(c.toString(),")(self);")),d=new Worker("data:text/javascript;base64,".concat(f));d.onmessage=function(p){return l(p.data)},d.onerror=u}).then(function(l){return l},function(){return!1})},i.exports.can_use_canvas=function(l){var u=!1;try{var c=l(2,1),f=c.getContext("2d"),d=f.createImageData(2,1);d.data[0]=12,d.data[1]=23,d.data[2]=34,d.data[3]=255,d.data[4]=45,d.data[5]=56,d.data[6]=67,d.data[7]=255,f.putImageData(d,0,0),d=null,d=f.getImageData(0,0,2,1),d.data[0]===12&&d.data[1]===23&&d.data[2]===34&&d.data[3]===255&&d.data[4]===45&&d.data[5]===56&&d.data[6]===67&&d.data[7]===255&&(u=!0)}catch{}return u},i.exports.cib_can_use_region=function(){return new Promise(function(l){if(typeof Image>"u"||typeof createImageBitmap>"u"){l(!1);return}var u=new Image;u.src="data:image/jpeg;base64,/9j/4QBiRXhpZgAATU0AKgAAAAgABQESAAMAAAABAAYAAAEaAAUAAAABAAAASgEbAAUAAAABAAAAUgEoAAMAAAABAAIAAAITAAMAAAABAAEAAAAAAAAAAABIAAAAAQAAAEgAAAAB/9sAQwAEAwMEAwMEBAMEBQQEBQYKBwYGBgYNCQoICg8NEBAPDQ8OERMYFBESFxIODxUcFRcZGRsbGxAUHR8dGh8YGhsa/9sAQwEEBQUGBQYMBwcMGhEPERoaGhoaGhoaGhoaGhoaGhoaGhoaGhoaGhoaGhoaGhoaGhoaGhoaGhoaGhoaGhoaGhoa/8IAEQgAAQACAwERAAIRAQMRAf/EABQAAQAAAAAAAAAAAAAAAAAAAAf/xAAUAQEAAAAAAAAAAAAAAAAAAAAA/9oADAMBAAIQAxAAAAF/P//EABQQAQAAAAAAAAAAAAAAAAAAAAD/2gAIAQEAAQUCf//EABQRAQAAAAAAAAAAAAAAAAAAAAD/2gAIAQMBAT8Bf//EABQRAQAAAAAAAAAAAAAAAAAAAAD/2gAIAQIBAT8Bf//EABQQAQAAAAAAAAAAAAAAAAAAAAD/2gAIAQEABj8Cf//EABQQAQAAAAAAAAAAAAAAAAAAAAD/2gAIAQEAAT8hf//aAAwDAQACAAMAAAAQH//EABQRAQAAAAAAAAAAAAAAAAAAAAD/2gAIAQMBAT8Qf//EABQRAQAAAAAAAAAAAAAAAAAAAAD/2gAIAQIBAT8Qf//EABQQAQAAAAAAAAAAAAAAAAAAAAD/2gAIAQEAAT8Qf//Z",u.onload=function(){createImageBitmap(u,0,0,u.width,u.height).then(function(c){c.width===u.width&&c.height===u.height?l(!0):l(!1)},function(){return l(!1)})},u.onerror=function(){return l(!1)}})}},{}],17:[function(n,i,a){"use strict";i.exports=function(){var o=n("./mathlib"),s;onmessage=function(u){var c=u.data.opts,f=!1;if(!c.src&&c.srcBitmap){var d=new OffscreenCanvas(c.width,c.height),p=d.getContext("2d");p.drawImage(c.srcBitmap,0,0),c.src=p.getImageData(0,0,c.width,c.height).data,d.width=d.height=0,d=null,c.srcBitmap.close(),c.srcBitmap=null}s||(s=new o(u.data.features));var h=s.resizeAndUnsharp(c);if(f){var m=new ImageData(new Uint8ClampedArray(h),c.toWidth,c.toHeight),g=new OffscreenCanvas(c.toWidth,c.toHeight),A=g.getContext("2d");A.putImageData(m,0,0),createImageBitmap(g).then(function(b){postMessage({bitmap:b},[b])})}else postMessage({data:h},[h.buffer])}}},{"./mathlib":1}],18:[function(n,i,a){var o,s,l,u,c,f,d,p;function h(A){A<.5&&(A=.5);var b=Math.exp(.726*.726)/A,v=Math.exp(-b),x=Math.exp(-2*b),w=(1-v)*(1-v)/(1+2*b*v-x);return o=w,s=w*(b-1)*v,l=w*(b+1)*v,u=-w*x,c=2*v,f=-x,d=(o+s)/(1-c-f),p=(l+u)/(1-c-f),new Float32Array([o,s,l,u,c,f,d,p])}function m(A,b,v,x,w,S){var k,j,O,C,N,D,P,q,z,I,T,L,_,Y;for(z=0;z=0;I--)O=j*T+k*L+C*_+N*Y,N=C,C=O,k=j,j=A[D],b[P]=v[q]+C,D--,q--,P-=S}}function g(A,b,v,x){if(!!x){var w=new Uint16Array(A.length),S=new Float32Array(Math.max(b,v)),k=h(x);m(A,w,S,k,b,v,x),m(w,A,S,k,v,b,x)}}i.exports=g},{}],19:[function(n,i,a){"use strict";var o=n("object-assign"),s=n("./lib/base64decode"),l=n("./lib/wa_detect"),u={js:!0,wasm:!0};function c(f){if(!(this instanceof c))return new c(f);var d=o({},u,f||{});if(this.options=d,this.__cache={},this.__init_promise=null,this.__modules=d.modules||{},this.__memory=null,this.__wasm={},this.__isLE=new Uint32Array(new Uint8Array([1,0,0,0]).buffer)[0]===1,!this.options.js&&!this.options.wasm)throw new Error('mathlib: at least "js" or "wasm" should be enabled')}c.prototype.has_wasm=l,c.prototype.use=function(f){return this.__modules[f.name]=f,this.options.wasm&&this.has_wasm()&&f.wasm_fn?this[f.name]=f.wasm_fn:this[f.name]=f.fn,this},c.prototype.init=function(){if(this.__init_promise)return this.__init_promise;if(!this.options.js&&this.options.wasm&&!this.has_wasm())return Promise.reject(new Error(`mathlib: only "wasm" was enabled, but it's not supported`));var f=this;return this.__init_promise=Promise.all(Object.keys(f.__modules).map(function(d){var p=f.__modules[d];return!f.options.wasm||!f.has_wasm()||!p.wasm_fn||f.__wasm[d]?null:WebAssembly.compile(f.__base64decode(p.wasm_src)).then(function(h){f.__wasm[d]=h})})).then(function(){return f}),this.__init_promise},c.prototype.__base64decode=s,c.prototype.__reallocate=function(d){if(!this.__memory)return this.__memory=new WebAssembly.Memory({initial:Math.ceil(d/(64*1024))}),this.__memory;var p=this.__memory.buffer.byteLength;return p>2),d=0,p=0,h=0;h>16&255,f[p++]=d>>8&255,f[p++]=d&255),d=d<<6|o.indexOf(u.charAt(h));var m=c%4*6;return m===0?(f[p++]=d>>16&255,f[p++]=d>>8&255,f[p++]=d&255):m===18?(f[p++]=d>>10&255,f[p++]=d>>2&255):m===12&&(f[p++]=d>>4&255),f}},{}],21:[function(n,i,a){"use strict";var o;i.exports=function(){if(typeof o<"u"||(o=!1,typeof WebAssembly>"u"))return o;try{var l=new Uint8Array([0,97,115,109,1,0,0,0,1,6,1,96,1,127,1,127,3,2,1,0,5,3,1,0,1,7,8,1,4,116,101,115,116,0,0,10,16,1,14,0,32,0,65,1,54,2,0,32,0,40,2,0,11]),u=new WebAssembly.Module(l),c=new WebAssembly.Instance(u,{});return c.exports.test(4)!==0&&(o=!0),o}catch{}return o}},{}],22:[function(n,i,a){"use strict";var o=Object.getOwnPropertySymbols,s=Object.prototype.hasOwnProperty,l=Object.prototype.propertyIsEnumerable;function u(f){if(f==null)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(f)}function c(){try{if(!Object.assign)return!1;var f=new String("abc");if(f[5]="de",Object.getOwnPropertyNames(f)[0]==="5")return!1;for(var d={},p=0;p<10;p++)d["_"+String.fromCharCode(p)]=p;var h=Object.getOwnPropertyNames(d).map(function(g){return d[g]});if(h.join("")!=="0123456789")return!1;var m={};return"abcdefghijklmnopqrst".split("").forEach(function(g){m[g]=g}),Object.keys(Object.assign({},m)).join("")==="abcdefghijklmnopqrst"}catch{return!1}}i.exports=c()?Object.assign:function(f,d){for(var p,h=u(f),m,g=1;gT.length)&&(L=T.length);for(var _=0,Y=new Array(L);_=0)}catch{}var k=1;typeof navigator<"u"&&(k=Math.min(navigator.hardwareConcurrency||1,4));var j={tile:1024,concurrency:k,features:["js","wasm","ww"],idle:2e3,createCanvas:function(L,_){var Y=document.createElement("canvas");return Y.width=L,Y.height=_,Y}},O={filter:"mks2013",unsharpAmount:0,unsharpRadius:0,unsharpThreshold:0},C=!1,N=!1,D=!1,P=!1,q=!1;function z(){return{value:p(A),destroy:function(){if(this.value.terminate(),typeof window<"u"){var L=window.URL||window.webkitURL||window.mozURL||window.msURL;L&&L.revokeObjectURL&&this.value.objectURL&&L.revokeObjectURL(this.value.objectURL)}}}}function I(T){if(!(this instanceof I))return new I(T);this.options=d({},j,T||{});var L="lk_".concat(this.options.concurrency);this.__limit=w[L]||g.limiter(this.options.concurrency),w[L]||(w[L]=this.__limit),this.features={js:!1,wasm:!1,cib:!1,ww:!1},this.__workersPool=null,this.__requested_features=[],this.__mathlib=null}I.prototype.init=function(){var T=this;if(this.__initPromise)return this.__initPromise;if(typeof ImageData<"u"&&typeof Uint8ClampedArray<"u")try{new ImageData(new Uint8ClampedArray(400),10,10),C=!0}catch{}typeof ImageBitmap<"u"&&(ImageBitmap.prototype&&ImageBitmap.prototype.close?N=!0:this.debug("ImageBitmap does not support .close(), disabled"));var L=this.options.features.slice();if(L.indexOf("all")>=0&&(L=["cib","wasm","js","ww"]),this.__requested_features=L,this.__mathlib=new h(L),L.indexOf("ww")>=0&&typeof window<"u"&&"Worker"in window)try{var _=n("webworkify")(function(){});_.terminate(),this.features.ww=!0;var Y="wp_".concat(JSON.stringify(this.options));w[Y]?this.__workersPool=w[Y]:(this.__workersPool=new m(z,this.options.idle),w[Y]=this.__workersPool)}catch{}var oe=this.__mathlib.init().then(function(Ie){d(T.features,Ie.features)}),te;N?te=g.cib_support(this.options.createCanvas).then(function(Ie){if(T.features.cib&&L.indexOf("cib")<0){T.debug("createImageBitmap() resize supported, but disabled by config");return}L.indexOf("cib")>=0&&(T.features.cib=Ie)}):te=Promise.resolve(!1),D=g.can_use_canvas(this.options.createCanvas);var Q;N&&C&&L.indexOf("ww")!==-1?Q=g.worker_offscreen_canvas_support():Q=Promise.resolve(!1),Q=Q.then(function(Ie){P=Ie});var fe=g.cib_can_use_region().then(function(Ie){q=Ie});return this.__initPromise=Promise.all([oe,te,Q,fe]).then(function(){return T}),this.__initPromise},I.prototype.__invokeResize=function(T,L){var _=this;return L.__mathCache=L.__mathCache||{},Promise.resolve().then(function(){return _.features.ww?new Promise(function(Y,oe){var te=_.__workersPool.acquire();L.cancelToken&&L.cancelToken.catch(function(fe){return oe(fe)}),te.value.onmessage=function(fe){te.release(),fe.data.err?oe(fe.data.err):Y(fe.data)};var Q=[];T.src&&Q.push(T.src.buffer),T.srcBitmap&&Q.push(T.srcBitmap),te.value.postMessage({opts:T,features:_.__requested_features,preload:{wasm_nodule:_.__mathlib.__}},Q)}):{data:_.__mathlib.resizeAndUnsharp(T,L.__mathCache)}})},I.prototype.__extractTileData=function(T,L,_,Y,oe){if(this.features.ww&&P&&(g.isCanvas(L)||q))return this.debug("Create tile for OffscreenCanvas"),createImageBitmap(Y.srcImageBitmap||L,T.x,T.y,T.width,T.height).then(function(fe){return oe.srcBitmap=fe,oe});if(g.isCanvas(L))return Y.srcCtx||(Y.srcCtx=L.getContext("2d")),this.debug("Get tile pixel data"),oe.src=Y.srcCtx.getImageData(T.x,T.y,T.width,T.height).data,oe;this.debug("Draw tile imageBitmap/image to temporary canvas");var te=this.options.createCanvas(T.width,T.height),Q=te.getContext("2d");return Q.globalCompositeOperation="copy",Q.drawImage(Y.srcImageBitmap||L,T.x,T.y,T.width,T.height,0,0,T.width,T.height),this.debug("Get tile pixel data"),oe.src=Q.getImageData(0,0,T.width,T.height).data,te.width=te.height=0,oe},I.prototype.__landTileData=function(T,L,_){var Y;if(this.debug("Convert raw rgba tile result to ImageData"),L.bitmap)return _.toCtx.drawImage(L.bitmap,T.toX,T.toY),null;if(C)Y=new ImageData(new Uint8ClampedArray(L.data),T.toWidth,T.toHeight);else if(Y=_.toCtx.createImageData(T.toWidth,T.toHeight),Y.data.set)Y.data.set(L.data);else for(var oe=Y.data.length-1;oe>=0;oe--)Y.data[oe]=L.data[oe];return this.debug("Draw tile"),S?_.toCtx.putImageData(Y,T.toX,T.toY,T.toInnerX-T.toX,T.toInnerY-T.toY,T.toInnerWidth+1e-5,T.toInnerHeight+1e-5):_.toCtx.putImageData(Y,T.toX,T.toY,T.toInnerX-T.toX,T.toInnerY-T.toY,T.toInnerWidth,T.toInnerHeight),null},I.prototype.__tileAndResize=function(T,L,_){var Y=this,oe={srcCtx:null,srcImageBitmap:null,isImageBitmapReused:!1,toCtx:null},te=function(fe){return Y.__limit(function(){if(_.canceled)return _.cancelToken;var Ie={width:fe.width,height:fe.height,toWidth:fe.toWidth,toHeight:fe.toHeight,scaleX:fe.scaleX,scaleY:fe.scaleY,offsetX:fe.offsetX,offsetY:fe.offsetY,filter:_.filter,unsharpAmount:_.unsharpAmount,unsharpRadius:_.unsharpRadius,unsharpThreshold:_.unsharpThreshold};return Y.debug("Invoke resize math"),Promise.resolve(Ie).then(function(Se){return Y.__extractTileData(fe,T,_,oe,Se)}).then(function(Se){return Y.debug("Invoke resize math"),Y.__invokeResize(Se,_)}).then(function(Se){return _.canceled?_.cancelToken:(oe.srcImageData=null,Y.__landTileData(fe,Se,oe))})})};return Promise.resolve().then(function(){if(oe.toCtx=L.getContext("2d"),g.isCanvas(T))return null;if(g.isImageBitmap(T))return oe.srcImageBitmap=T,oe.isImageBitmapReused=!0,null;if(g.isImage(T))return N?(Y.debug("Decode image via createImageBitmap"),createImageBitmap(T).then(function(Q){oe.srcImageBitmap=Q}).catch(function(Q){return null})):null;throw new Error('Pica: ".from" should be Image, Canvas or ImageBitmap')}).then(function(){if(_.canceled)return _.cancelToken;Y.debug("Calculate tiles");var Q=v({width:_.width,height:_.height,srcTileSize:Y.options.tile,toWidth:_.toWidth,toHeight:_.toHeight,destTileBorder:_.__destTileBorder}),fe=Q.map(function(Se){return te(Se)});function Ie(Se){Se.srcImageBitmap&&(Se.isImageBitmapReused||Se.srcImageBitmap.close(),Se.srcImageBitmap=null)}return Y.debug("Process tiles"),Promise.all(fe).then(function(){return Y.debug("Finished!"),Ie(oe),L},function(Se){throw Ie(oe),Se})})},I.prototype.__processStages=function(T,L,_,Y){var oe=this;if(Y.canceled)return Y.cancelToken;var te=T.shift(),Q=o(te,2),fe=Q[0],Ie=Q[1],Se=T.length===0,Oe;Se||x.q2f.indexOf(Y.filter)<0?Oe=Y.filter:Y.filter==="box"?Oe="box":Oe="hamming",Y=d({},Y,{toWidth:fe,toHeight:Ie,filter:Oe});var ve;return Se||(ve=this.options.createCanvas(fe,Ie)),this.__tileAndResize(L,Se?_:ve,Y).then(function(){return Se?_:(Y.width=fe,Y.height=Ie,oe.__processStages(T,ve,_,Y))}).then(function(ye){return ve&&(ve.width=ve.height=0),ye})},I.prototype.__resizeViaCreateImageBitmap=function(T,L,_){var Y=this,oe=L.getContext("2d");return this.debug("Resize via createImageBitmap()"),createImageBitmap(T,{resizeWidth:_.toWidth,resizeHeight:_.toHeight,resizeQuality:g.cib_quality_name(x.f2q[_.filter])}).then(function(te){if(_.canceled)return _.cancelToken;if(!_.unsharpAmount)return oe.drawImage(te,0,0),te.close(),oe=null,Y.debug("Finished!"),L;Y.debug("Unsharp result");var Q=Y.options.createCanvas(_.toWidth,_.toHeight),fe=Q.getContext("2d");fe.drawImage(te,0,0),te.close();var Ie=fe.getImageData(0,0,_.toWidth,_.toHeight);return Y.__mathlib.unsharp_mask(Ie.data,_.toWidth,_.toHeight,_.unsharpAmount,_.unsharpRadius,_.unsharpThreshold),oe.putImageData(Ie,0,0),Q.width=Q.height=0,Ie=fe=Q=oe=null,Y.debug("Finished!"),L})},I.prototype.resize=function(T,L,_){var Y=this;this.debug("Start resize...");var oe=d({},O);if(isNaN(_)?_&&(oe=d(oe,_)):oe=d(oe,{quality:_}),oe.toWidth=L.width,oe.toHeight=L.height,oe.width=T.naturalWidth||T.width,oe.height=T.naturalHeight||T.height,Object.prototype.hasOwnProperty.call(oe,"quality")){if(oe.quality<0||oe.quality>3)throw new Error("Pica: .quality should be [0..3], got ".concat(oe.quality));oe.filter=x.q2f[oe.quality]}if(L.width===0||L.height===0)return Promise.reject(new Error("Invalid output size: ".concat(L.width,"x").concat(L.height)));oe.unsharpRadius>2&&(oe.unsharpRadius=2),oe.canceled=!1,oe.cancelToken&&(oe.cancelToken=oe.cancelToken.then(function(Q){throw oe.canceled=!0,Q},function(Q){throw oe.canceled=!0,Q}));var te=3;return oe.__destTileBorder=Math.ceil(Math.max(te,2.5*oe.unsharpRadius|0)),this.init().then(function(){if(oe.canceled)return oe.cancelToken;if(Y.features.cib){if(x.q2f.indexOf(oe.filter)>=0)return Y.__resizeViaCreateImageBitmap(T,L,oe);Y.debug("cib is enabled, but not supports provided filter, fallback to manual math")}if(!D){var Q=new Error("Pica: cannot use getImageData on canvas, make sure fingerprinting protection isn't enabled");throw Q.code="ERR_GET_IMAGE_DATA",Q}var fe=b(oe.width,oe.height,oe.toWidth,oe.toHeight,Y.options.tile,oe.__destTileBorder);return Y.__processStages(fe,T,L,oe)})},I.prototype.resizeBuffer=function(T){var L=this,_=d({},O,T);if(Object.prototype.hasOwnProperty.call(_,"quality")){if(_.quality<0||_.quality>3)throw new Error("Pica: .quality should be [0..3], got ".concat(_.quality));_.filter=x.q2f[_.quality]}return this.init().then(function(){return L.__mathlib.resizeAndUnsharp(_)})},I.prototype.toBlob=function(T,L,_){return L=L||"image/png",new Promise(function(Y){if(T.toBlob){T.toBlob(function(Ie){return Y(Ie)},L,_);return}if(T.convertToBlob){Y(T.convertToBlob({type:L,quality:_}));return}for(var oe=atob(T.toDataURL(L,_).split(",")[1]),te=oe.length,Q=new Uint8Array(te),fe=0;femR});module.exports=x_e(knt);var MDe=Ae(Ya());var hJ=Ae(mJ()),Z$=class{constructor(){this.lang="en";this.all={en:{hintText:{fileName:"Enter File Name",alias:"Enter Display Name",dragDropModifierKeys:"Hold ${1} to Pin and ${2} to Copy",createListItem:"Select/Create List Item Frame",dragDropProperties:"Drag and drop properties to link them into the list",newItem:"+ New",selectNote:"Select Note...",newFrame:"New"},defaults:{spaceNote:"Current Note",spaceContext:"Current Space"},commands:{h1:"Heading 1",h2:"Heading 2",h3:"Heading 3",h4:"Heading 4",h5:"Heading 5",h6:"Heading 6",columns:"Columns",tabs:"Tabs",button:"Button",label:"Label",column:"Column",idea:"New",group:"Group",paragraph:"Text",card:"Card",progress:"Progress",rating:"Rating",circularProgress:"Circular Progress",list:"Bullet List","ordered-list":"Numbered List",todo:"To-do List",quote:"Quote",internal:"Link to Note",context:"Embed Existing Context",flow:"Embed Note or Space",board:"New Board",divider:"Divider",note:"Note Block",link:"Web Link",internalLink:"Link",callout:"Callout",bookmark:"Bookmark",table:"New Table",codeblock:"Code Block",toggle:"Toggle",emoji:"Emoji",image:"Image",newNote:"Note",tag:"Tag",makeMenu:"Flow Menu",selectStyle:"Style",toggleKeyboard:"Toggle Keyboard",rows:"Rows",masonry:"Gallery"},styles:{bold:"Bold",italics:"Italics",strikethrough:"Strikethrough",code:"Code",link:"Web Link",blocklink:"Link to Note",textColor:"Text Color",highlight:"Highlight"},commandsSuggest:{noResult:"No result"},commandPalette:{enable:"Enable",disabled:"Disable",openFlow:"Open Flow Blocks in Selection",closeFlow:"Close Flow Blocks in Selection",toggleBold:"Toggle Bold",toggleItalics:"Toggle Italics",openSpaces:"Open Navigator",blink:"Blink",openFileContext:"Open Explorer",convertPathToSpace:"Convert to Space",revealFile:"Reveal File in Navigator",releaseNotes:"Release Notes",getStarted:"Get Started",toggleBacklinks:"Toggle Backlinks",collapseAllFolders:"Collapse All Folders",addFileSpace:"Add File to Space",removeFileSpace:"Remove File from Space"},frames:{sections:{kit:"Kit",paths:"Paths"},label:{label:"Label",description:"Label"},note:{label:"Note",description:"Link to a note"},table:{label:"Table",description:"Table"},context:{label:"Context",description:"Display a context view from another space"},calendar:{label:"Calendar View"},field:{label:"Field",description:"Dynamic node that displays a value based on property type"},event:{label:"Event"},divider:{label:"Divider",description:"Divider to separate your content"},button:{label:"Button",description:"Buttons can perform actions and open links"},callout:{label:"Callout",description:"Callout to highlight important information"},toggle:{label:"Toggle",description:"Toggle to show/hide content"}},menu:{layout:"Layout",enterFlowState:"Enter Flow State",exitFlowState:"Exit Flow State",newView:"New View",calendarView:"Calendar View",dayView:"Day View",closeSpace:"Close Space in Focus",customView:"Custom View",detailsView:"Details View",catalogView:"Catalog View",galleryView:"Gallery View",deleteContext:"Delete Context",openSpace:"Open",revealInDefault:"Reveal in Finder",revealInExplorer:"Reveal in Explorer",setNone:"None",fileMetadataDescription:"This note only",openFilePane:"Open in a new pane",rename:"Rename",changeToFolderNote:"New Space from Note",moveFile:"Move file to...",moveFolder:"Move folder to...",duplicate:"Make a copy",edit:"Edit",delete:"Delete",getHelp:"Make.md Community",vault:"Vault",openVault:"Open Another Vault",openVaultInFolder:"Open Vault Folder",obSettings:"Obsidian Settings",commandPalette:"Command Palette",backToSpace:"Back to Navigator",collapseAllSections:"Collapse All Spaces",expandAllSections:"Expand All Spaces",collapseAllFolders:"Collapse All Folders",expandAllFolders:"Expand All Folders",spaceTitle:"Add/Remove in Space",home:"Home",none:"None",tableView:"Table View",cardView:"Card View",boardView:"Board View",listView:"List View",flowView:"Flow View",groupBy:"Group",sortBy:"Sort",filters:"Filters",newFilter:"New Filter",clearFilters:"Clear Filters",hide:"Hide",unhideFields:"Unhide All Properties",importDataview:"Import All Dataview Properties",saveAllProperties:"Save All Properties to Files",mergeProperties:"Merge Properties",removeFromSpace:"Unpin from Space",editCode:"Edit Code",editProperties:"Edit Properties",properties:"Properties",deleteProperty:"Delete Property",hideProperty:"Hide Property",unhideProperty:"Unhide Property",saveProperty:"Save Property",sortAscending:"Sort Ascending",sortDescending:"Sort Descending",deleteRow:"Delete Item",collapseAll:"Collapse All",customSort:"Custom Sort",groupSpaces:"Group Spaces",recurisveSort:"Apply to Subfolders",fileNameSortAlphaAsc:"File Name (A to Z)",fileNameSortAlphaDesc:"File Name (Z to A)",fileNameSortNumericalAsc:"File Name (1 to 9)",fileNameSortNumericalDesc:"File Name (9 to 1)",createdTimeSortAsc:"Created Time (new to old)",createdTimeSortDesc:"Created Time (old to new)",modifiedTimeSortAsc:"Modified Time (new to old)",modifiedTimeSortDesc:"Modified Time (old to new)",sizeSortAsc:"Size (smallest to largest)",sizeSortDesc:"Size (largest to smallest)",spaces:"Spaces",tags:"Tags",manageHiddenFiles:"Manage Hidden Files",manageActions:"Manage Actions",deleteSpace:"Delete",changeColor:"Change Color",changePropertyType:"Change Type",deleteFiles:"Delete Files",createFolderSpace:"Create Space from Folder",folder:"Folder",syncToContext:"Add Property to Context",setIcon:"Set Icon",copyEmbedLink:"Copy Embed Link",moveUp:"Move Up",moveDown:"Move Down",moveTo:"Move To",groupNodes:"Group Nodes",moveFrame:"Move Frame",renameFrame:"Rename Frame",deleteFrame:"Delete Frame",insertAbove:"Insert Above",insertBelow:"Insert Below"},editor:{rows:"Rows",columns:"Columns",catalog:"Catalog",gallery:"Gallery",grid:"Grid",scaleToFit:"Change to Fit",scaleToFill:"Change to Fill",fit:"Fit",strokeNone:"None",strokeSolid:"Solid",strokeDotted:"Dotted",strokeDashed:"Dashed",size:"Size",gap:"Gap",marginLeft:"Left",marginTop:"Top",marginRight:"Right",marginBottom:"Bottom",minimize:"Minimize",paddingLeft:"Left",paddingTop:"Top",paddingRight:"Right",paddingBottom:"Bottom",unlinkProperty:"Unlink Property",linkedProperty:"Linked Property",linkProperty:"Link Property",currentSpace:"Current Space",linkName:"${1} Link",linkThumbnail:"${1} Thumbnail",linkSticker:"${1} Sticker",opacity:"Opacity",shadowSpread:"Spread",shadowBlur:"Blur",width:"Width",height:"Height",margin:"Margin",padding:"Padding",bold:"Bold",italic:"Italic",underline:"Underline",alignLeft:"Align Left",alignCenter:"Align Center",alignRight:"Align Right",alignJustify:"Align Justify",numberOfLines:"Lines",createVerticalSection:"Create Vertical Section",createHorizontalSection:"Create Horizontal Section",themeColors:"Theme Colors",uiColors:"UI Colors",hex:"Hex"},buttons:{add:"Add",togglePin:"Toggle Pin",refresh:"Refresh",showHidden:"Show Hidden",alias:"Alias",addFilter:"Add Filter",loadMore:"Load More",addCondition:"Add Condition",customize:"Customize",moreOptions:"More Options",saveProperty:"Save Property",newNote:"New Note",changeIcon:"Change Sticker",removeIcon:"Remove Sticker",addIcon:"Add Sticker",addCover:"Add Cover",addDisplay:"Display Name",changeBanner:"Change Cover",changeBannerShort:"Cover",saveChanges:"Save Changes",removeBanner:"Remove Cover",rename:"Change Name",editFrame:"Edit Frame",saveSpace:"Save Space",createSpace:"New Space",createFolder:"New Folder",createNote:"New Note",createCanvas:"New Canvas",addIntoSpace:"New Pin",addSmartSearch:"Add Live Search",subFolders:"Sub Folders",addItem:"Add Item",addProperty:"Add Property",editProperty:"Edit Property",addContext:"Add Context",cancel:"Cancel",search:"Search",delete:"Delete",toggleFlow:"Toggle Flow",openFlow:"Open Flow",hideFlow:"Hide Flow",openLink:"Open Link",addToSpace:"Add to Space",addToSpaceShort:"Pin",addTag:"Add Tag",tag:"Tag",syncFields:"Sync Properties",convertTable:"Convert to Markdown",cutTable:"Cut Table",deleteTable:"Delete From Note",blink:"Blink",addFile:"Add Item",merge:"Merge",saveView:"Save View",saveTable:"Save Table",renameView:"Rename View",deleteView:"Delete View",renameTable:"Rename Table",renameTag:"Rename Tag",createTag:"Create Tag",currentFolder:"Current Folder",sync:"Sync",pasteCSS:"Paste CSS",save:"Save",run:"Run"},metadataTypes:{fileName:"File Name",contexts:"Contexts",path:"Path",folder:"Folder",sticker:"Sticker",color:"Color",created:"Created",lastModified:"Last Modified",extension:"Extension",size:"Size",tags:"Tags",inlinks:"Linked Mentions",outlinks:"Links",label:"Label",fileMetadata:"File Metadata",frontmatter:"Frontmatter"},filterTypes:{contains:"contains",notContains:"does not contain",is:"is",isNot:"is not",before:"before",after:"on or after",anyOf:"is any of",noneOf:"is none of",checked:"is checked",unchecked:"is unchecked",isEmpty:"is empty",isNotEmpty:"is not empty",isSameDate:"is same date",isSameDateAsToday:"today"},sortTypes:{alphaAsc:"A to Z",alphaDesc:"Z to A",earliest:"Earliest",latest:"Latest",checkAsc:"Checked \u2192 Unchecked",checkDesc:"Unchecked \u2192 Checked",itemsAsc:"Least Items",itemsDesc:"Most Items"},properties:{defaultField:"Name",aggregate:{label:"Aggregate",description:"Aggregate functions to calculate values"},audio:{label:"Audio",description:"Audio"},text:{label:"Text",description:"Text field"},number:{label:"Number",description:"Number field with optional unit"},boolean:{label:"Yes/No",description:"Yes or No toggle to indicate the status"},date:{label:"Date",description:"Select a date from a calendar"},option:{label:"Option",description:"Select one or multiple option from a list"},file:{label:"File"},link:{label:"Link",description:"Link to another note or a website"},tags:{label:"Tags",description:"Use tags to quickly organize your items"},object:{label:"Object",description:"Store any complex objects"},context:{label:"Relation",description:"Connect to another context property and create a relation"},image:{label:"Image",description:"Select any image from your system or from the internet"},color:{label:"Color",description:"Use colors to label your items or status"},space:{label:"Context",description:"Link to a context"},icon:{label:"Sticker",description:"Use stickers to uniquely label your items or status"},super:{label:"Super Property",links:"Open Link",properties:"Update Property",api:"API",obsidianCommands:"Run Command",runCommand:"Run Command",performAction:"Perform Action",whenClicked:"When Clicked"},fileProperty:{name:"Name",label:"Formula",createdTime:"Created",modifiedTime:"Last Edited",sticker:"Sticker",links:"Links",tags:"Tags",spaces:"Spaces",extension:"Extension",size:"Size",preview:"Note Preview",parentFolder:"Folder",description:"Use a formula to dynamically display a property"}},views:{navigator:"Navigator",explorer:"Explorer",space:"Space"},subViews:{spaceItems:"Items",spaceContext:"Context",spaceLists:"Lists",spaceActions:"Actions",spaceTemplates:"Templates",smartSearch:"Live Searches",filesAndFolders:"Files and Folders"},labels:{duplicateTable:"Duplicate Table",aggregateBy:"Aggregate By",pinned:"Pinned",live:"Pinned by Live Search",moveTable:"Move Table",editFormula:"Edit Formula",editObject:"Edit Object",properties:"Properties",newAction:"Action",newTable:"List",template:"Template",createFolder:"New Folder Name",rename:"Rename",createNew:"New",default:"Default",done:"Done",changeCoverShort:"Change",reposition:"Reposition",tables:"Tables",selectDateFormat:"Select/Type Date Format",renameSection:"Edit Space",createSection:"New Folder",createNote:"New Note",contextMaker:"Context Maker",select:"Select",pinnedItems:"Pinned Items",collapse:"Collapse",expand:"Expand",all:"All",none:"None",view:"View",findStickers:"Find Sticker",mergeProperties:"Merge Properties",placeholder:"Type '${1}' for commands",notePlaceholder:"New Note for ${1}",itemsSelected:"${1} Selected",selectNote:"Select Note",selectIcon:"Select Icon",selectImage:"Select Image",selectSpace:"Select Space",styleSmall:"Small",styleMedium:"Medium",styleLarge:"Large",hiddenFilePattern:"Name, Suffixes and Extension",hiddenFileSpecific:"Exclude specific files and folders",textPlaceholder:"Enter Text",noFile:"is not created yet. Click to create.",navigatorSearchPlaceholder:"Search by Text or Filters",blinkPlaceholder:"Search for notes, spaces...",searchPlaceholder:"Type to search...",contextItemSelectPlaceholder:"Find Item",linkItemSelectPlaceholder:"Find or Create Note",pinNotePlaceholder:"Select a Note or Space to Pin",optionItemSelectPlaceholder:"Select Option",viewItemSelectPlaceholder:"Select View",tagItemSelectPlaceholder:"Find Tag",spaceSelectPlaceholder:"Select any Folder or Tag",propertyItemSelectPlaceholder:"Select Property",sortItemSelectPlaceholder:"Select Sort",filterItemSelectPlaceholder:"Select Filter",imageSelectPlaceholder:"Select an image or paste a URL",imageNotFoundPlaceholder:"No Images Found",syncFrontmatterProperty:"Sync Frontmatter Property",newProperty:"New Property",newPropertyShort:"New Property",propertyType:"Type",propertyDynamic:"Dyanmic",propertyValueSpace:"Space",propertyValueReference:"Related Property",propertyValueAggregate:"Aggregate Property",propertyValueProperty:"Property",propertyLookup:"Edit Formula",existingFrontmatter:"Existing Property",dateFormat:"Date Format",propertyFileProp:"Property",multiple:"Multiple",filesCount:"{$1} Files",hiddenFiles:"Hidden Files",addExtension:"Add Rule",saveView:"Save View",saveTable:"Save Table",renameView:"Rename View",renameTable:"Rename Table",syncMetadata:"Sync Metadata",syncProperties:"Sync Properties",selectContext:"Select Context",metadata:"Metadata",backlinks:"Backlinks",spaces:"Spaces",contexts:"Contexts",content:"Content",deleteSpace:"Delete Space",deleteFiles:"Delete Files",outgoingLinks:"Outgoing Links",moveTo:"Move to",addTo:"Pin to",copyTo:"Copy to",reorderIn:"Reorder in",border:"Border",corners:"Corners",color:"Color",backgroundColor:"Background",cornerRadius:"Radius",onClick:"On Click",layout:"Layout",element:"Element",name:"Name",display:"Display",alignment:"Alignment",margin:"Margin",padding:"Padding",gap:"Gap",width:"Width",height:"Height",opacity:"Opacity",shadow:"Shadow",shadowBlur:"Blur",shadowSpread:"Spread",typography:"Typography",layers:"Layers",fontSize:"Size",props:"Props",styles:"Styles",events:"Events",code:"Code",selectedLayers:"${1} Layers"},descriptions:{spaceActions:"Create actions that runs when you press a button",spaceLists:"Create lists to track data and organize them in your space",spaceItems:"Add new items to the space or pin items to the space",spaceTemplates:"Create templates to quickly add items to your space",smartSearch:"Automatically pin notes to this space based on a set of searches",hiddenFileOptions:"Exclude any files and folders by name, suffix or extension.",deleteSpace:"Deleting the space will also delete the folder and its contents.",deleteFiles:"Delete ${1} files/folders and their contents?",addContext:"Contexts lets you connect properties from your tags",spaceProperties:"Define Properties for your Space Items",syncMetadata:"Select which fields from your notes to start syncing with the context.",syncProperties:"Contexts defines and syncs the same fields across your notes depending on their folder or tag.",selectContext:"Select which folder or tag context you want to sync the fields."},flowView:{emptyDoc:"Empty Document",itemsCount:" Items",emptyFolder:"This Folder is Empty"},notice:{duplicateFile:"Folder already contains note with same name",addedToSection:"Added to Space",fileExists:"File Already Exists",folderExists:"Folder Already Exists",noPropertyName:"Property Name is Required",noPropertiesFound:"No Properties Found",duplicatePropertyName:"Duplicate Property Name",newSpaceName:"Enter a name for your space",duplicateSpaceName:"Space name already exists",cantConvertNoteToSpace:"The view is not a note",templateSaved:"Template saved to space: ",tableDeleted:"Table removed from note, you can find the table in the folder space"},settings:{sections:{general:"General",navigator:"Navigator",appearance:"Appearance",interaction:"Preferences",context:"Context",label:"Labels",tags:"Tags",space:"Spaces",performance:"Performance",advanced:"Advanced",folderNote:"Folder Note",notes:"Notes"},searchWorker:{name:"Background Search",desc:"Search in background to improve reponsiveness while searching"},cacheIndex:{name:"Cache Search Index",desc:"Cache the index for faster search results"},layoutVertical:"Vertical",layoutHorizontal:"Horizontal",sectionGeneral:"General",sectionSidebar:"Spaces",sectionEditor:"Maker Mode",sectionFlow:"Flow",sectionAdvanced:"Advanced",sectionDataview:"Dataview",sectionContext:"Context",sectionStickers:"Labels",sectionNavigator:"Navigator",sectionDefault:"Default Spaces",sectionSpaceView:"Space View",sectionBlink:"Blink",sectionInlineContext:"Inline Context",sectionFlowBlock:"Flow Block",sectionFlowMenu:"Flow Menu",sectionFlowStyler:"Flow Styler",experimental:{name:"Experimental",desc:"Experimental features that are subject to change and may not be optimized for performance"},imageThumbnails:{name:"Generate Thumbnails",desc:"Create thumbnails for images to speed up performance"},minimalThemeFix:{name:"Minimal Theme Fix",description:"Apply fixes for the popular theme Minimal"},inlineStickerMenu:{name:"Inline Stickers",desc:"Add inline stickers by typing :"},openSpacesOnLaunch:{name:"Open Navigator as Default Tab",desc:"Open the Navigator tab when Obsidian launches"},spacesRightSplit:{name:"Navigator on Right Side",desc:"Open the Navigator in the right panel"},defaultSpaceTemplate:{name:"Default Space Template",desc:"Select the default template for new spaces"},defaultDateFormat:{name:"Default Date Format",desc:"Set the default date format, example: yyyy-MM-dd (see https://date-fns.org/v2.30.0/docs/format)"},defaultTimeFormat:{name:"Default Time Format",desc:"Set the default time format, example: h:mm a (see https://date-fns.org/v2.30.0/docs/format)"},autoAddContextsToSubtags:{name:"Apply Properties to Subtags",desc:"Automatically apply context properties to subtags"},newNotePlaceholder:{name:"New Note Placeholder",desc:"Default name for new notes"},folderIndentationLines:{name:"Show Folder Indentation Lines",desc:"Turn on to show a line on the left of folders to indicate indentation"},folderNoteLocation:{name:"Folder Note Location Inside Folder",desc:"Turn on to have folder notes inside the folder, turn off to have it outside"},folderViewDefault:{name:"Show Folder Note by Default",desc:"Show the folder note by default when opening a folder"},internalLinkFlowEditor:{name:"Show Toggles to Open Flow Editor on Links",desc:"Turn on to toggle Flow Blocks directly in inline links"},internalLinkSticker:{name:"Show Stickers on Links",desc:"Turn on to toggle stickers shown directly by beside internal links"},saveAllContextToFrontmatter:{name:"Sync Context Fields to Frontmatter",desc:"Turn on to automatically save all context fields to frontmatter fields, not just existing frontmatter fields."},syncFormulaToFrontmatter:{name:"Sync Formula Fields to Frontmatter",desc:"Turn on to save calculated formula values to frontmatter fields."},spaceSubFolder:{name:"Space Folder Name",desc:"Name of the folder for spaces"},basics:{name:"Make.md Basics",desc:"Enable features from Make.md Basics including styler and flow blocks"},spacesFolder:{name:"Tag Space Folder",desc:"Name of the folder for tag spaces"},dataviewInlineContext:{name:"Show Dataview in Inline Context",desc:"Show dataview when inline context is enabled"},inlineContext:{name:"Notes Header",desc:"Show a header to display labels and properties"},banners:{name:"Cover Image",desc:"Show a cover image for notes and spaces"},inlineContextProperties:{name:"Show Context Properties in Header",desc:"Show the properties in the header for notes and spaces"},inlineContextExpanded:{name:"Auto Expand Context Properties",desc:"Expand the inline context sections when opening a note"},inlineContextNameLayout:{name:"Title and Sticker Layout",desc:"Layout for inline title and sticker in Inline Context"},hideFrontmatter:{name:"Hide Context Properties",desc:"Hide properties you have added in context from the Obsidian properties panel"},autoOpenFileContext:{name:"Auto Open Explorer",desc:"Automatically open explorer panel in the right panel"},enableFolderNote:{name:"Enable Folder Note",desc:"Access the folder note in the folder page and hide the folder note from spaces"},folderNoteName:{name:"Folder Note Name",desc:"Name of the folder note, keep blank to use the same name as the folder"},expandFolderOnClick:{name:"Auto Expand Folder",desc:"Auto expand folders on click"},filePreviewOnHover:{name:"Preview on Hover",desc:"Preview on Hover while holding Control/Command key"},revealActiveFile:{name:"Reveal Active File",desc:"Automatically reveal the active file in Navigator"},contextEnabled:{name:"Contexts",desc:"Contexts allows you to have full control over the metadata of your files"},navigatorEnabled:{name:"Navigator",desc:"The navigator lets you create and organize your spaces"},spacesStickers:{name:"Stickers",desc:"Use Emojis to make it easier to find your notes"},spacesUseAlias:{name:"Alias",desc:"Use the alias metadata to show in Navigator"},spacesDisablePatch:{name:"Compatibility Mode",desc:"This will improve the compatibility of plugins while using the Navigator"},deleteFileOption:{name:"Delete File Option",desc:"Select how you want files to be deleted"},spacesDeleteOptions:{permanant:"Delete Permanently",trash:"Move to Obsidian Trash","system-trash":"Move to System Trash"},flowState:{name:"Flow State",desc:"Toggle the flow state"},showRibbon:{name:"App Ribbon",desc:"Show/hide the left menu aka. ribbon"},spaceViewEnabled:{name:"Spaces",desc:"Customize your folders and tags with properties and views"},defaultSpaces:{name:"Default Spaces",desc:"Recommended spaces for quickly organizing your vault"},homeSpace:{name:"Home Space",desc:"An easy-to-access space where you can add/organize your other spaces"},enableDefaultSpaces:{name:"Tag Spaces",desc:"Automatically create spaces for each of your tags"},readableLineWidth:{name:"Readable Line Width",desc:"Use Readable Line Width"},sidebarTabs:{name:"Sidebar Tabs",desc:"Show/hide other sidebar tabs"},spacesPerformance:{name:"Navigator Scroll Performance",desc:"Turn on performance mode for Navigator, may affect scrolling appearance. Requires Restart"},indexSVG:{name:"Use SVGs as Stickers",desc:"Use any svg file in your vault as a sticker"},inlineStyler:{name:"Flow Styler",desc:"Select text to add styling"},inlineStylerColor:{name:"Text and Highlight Colors \u{1F9EA}",desc:"Select text color and highlight color, (this may change in the future because of the limitations with HTML and Obsidian)"},spaceRowHeight:{name:"Row Height",desc:"The height for each row in navigator (in pixels), default is 29"},contextPagination:{name:"Table View Pagination",desc:"Number of items per page in table view"},bannerHeight:{name:"Cover Height",desc:"The height for the cover of the note or space, default is 200"},makeChar:{name:"Flow Menu Trigger",desc:"Character to open the Flow Menu"},mobileMakeBar:{name:"Flow Styler (Mobile)",desc:"Replaces the mobile toolbar"},editorMarkSans:{name:"Mark Sans \u{1F9EA}",desc:"Use the editor without Markdown."},editorMakerMode:{name:"Flow (Beta)",desc:"An integrated and intuitive editor experience"},editorMakePlacholder:{name:"Flow Menu Hint Text",desc:"Show a hint text on how to open the Flow Menu Shortcut"},blinkEnabled:{name:"Blink",desc:"A faster way to search and edit your notes"},editorMakeMenu:{name:"Flow Menu",desc:"Open the Flow menu to quickly add content"},editorMakeMenuTrigger:{name:"Flow Menu Shortcut",desc:"Trigger key to use flow menu"},editorFlowReplace:{name:"Flow Block",desc:"Open your internal links or toggle your embeds in the flow block."},editorFlowStyle:{name:"Flow Block Style",desc:"Select a theme for your flow block",seamless:"Seamless",minimal:"Minimal"}}}};this.lang="en";let t=hJ.default.locale();["en"].includes(t)&&(this.lang=t)}get texts(){return this.all.en}},H=new Z$().texts;var pA=(e,t)=>JSON.stringify({...t,options:e.map(r=>({name:r.name,value:r.value,color:r.color}))});var Zg="spaces://$",kx="spaces://$tags";var Er="files",yp={id:Er,name:"Items",type:"db",primary:"true"};var Cx=(e,t,r)=>!t||t<=0?[r,...e]:[...e.slice(0,t),r,...e.slice(t)],Dx=(e,t,r)=>!t||t<=0?[...r,...e]:[...e.slice(0,t),...r,...e.slice(t)],kr=e=>[...new Set(e)],mM=e=>[...new Map(e.map(t=>[t.toLowerCase(),t])).values()],Mi=(e,t)=>{let r=e;if(t.includes(r)){let n=1;for(;t.includes(r);)r=e+n.toString(),n+=1}return r},AJ=e=>(t,r,n)=>n.findIndex(i=>t[e]==i[e])===r;var gJ=(e,t,r)=>e.sort(function(n,i){let a=t.indexOf(n[r]),o=t.indexOf(i[r]);return a>o?a!=-1&&o==-1?-1:1:o!=-1&&a==-1?1:-1});var Tu=e=>e=="/"?e:e.slice(-1)=="/"?e.substring(0,e.length-1):e;var cc=e=>{let t=e,r="",n=A=>{let b={};return A.split("&").forEach(v=>{let[x,w]=v.split("=");b[decodeURIComponent(x)]=decodeURIComponent(w)}),b},i=(A,b)=>b?A==="^"?"context":A==="*"?"frame":A===";"?"action":null:A==="^"?"block":"heading",a=null,o=null,s=null,l=null,u=null,c=null,f="vault";if(t.indexOf("://")!=-1){f=e.slice(0,e.indexOf("://"));let A=e.slice(e.indexOf("://")+3);if(A.charAt(0)=="#"||A.charAt(0)=="$"){let b=A.split("/")[0].lastIndexOf("#");b>0?(a=Tu(A.slice(0,b)),e=A.slice(b)):(a=A.split("/")[0],e=A.replace(a,""),e.length>0&&(e=e.slice(1)),e==""&&(e="/"))}else{let b=A.split("/");a=b[0],e=b.slice(1).join("/")||""}}let d=e.lastIndexOf("/"),p=e.lastIndexOf("#"),h=e.lastIndexOf("|"),m=e.lastIndexOf("?"),g=!1;if(m!==-1&&(c=n(e.slice(m+1)),e=e.slice(0,m)),p!==-1&&p>d){p==d+1&&(g=!0);let A=e.slice(p+1);u=i(A[0],g),(u||p!=d+1)&&(r=A[0],l=u?A.slice(1):A,e=e.slice(0,p))}return h!==-1&&h>d&&(s=e.slice(h+1),e=e.slice(0,h)),e.charAt(e.length-1)=="/"&&(g=!0),o=e,{basePath:Tu(`${a?`${f}://${a}/${o!="/"?o:""}`:o}`),authority:a,fullPath:t,scheme:f,path:Tu(e),alias:s,ref:l,refType:u,refStr:u?r+l:l,query:c,trailSlash:g}},Mm=(e,t)=>{let r=e.split("/");return t+"/"+r[r.length-1]},vJ=(e,t)=>{let r=e.substring(0,e.lastIndexOf("/"));return r.length>0?`${r}/${t}`:`${t}`},yJ=(e,t)=>{let r=e.substring(0,e.lastIndexOf("/")),n=e.lastIndexOf(".")!=-1?e.substring(e.lastIndexOf(".")):"";return r.length>0?`${r}/${t}${n}`:`${t}${n}`};var hM=(e,t)=>!e||e.length==0?t:e;function dl(e){return Array.isArray(e)?e:typeof e=="string"?[e]:[]}function bJ(e,t,r){let n=Bs(e);return t.some(i=>i==n)?n:r}function Bs(e){if(!e)return"";if(typeof e!="string"){let t=e.toString();return typeof t=="string"?t:""}return e}function XE(e){return!!e}var xJ=(e,t)=>t.indexOf(e)>0?t.indexOf(e):t.length,wJ=(e,t)=>t.spacesIndex.get(e)?.name??e,SJ=e=>"spaces://"+KE(e),KE=e=>e?.replace(/\//g,"+"),Wn=e=>"spaces://"+e;var EJ=e=>e?`(${e})`:null,jr=e=>e?`"${e.replace(/"/g,'\\"').replace(/\n/g,"\\n")}"`:null,X$=e=>{if(!e)return e;if(e.startsWith("(")){if(e.endsWith(")"))return e.substring(1,e.length-1);if(e.endsWith(");"))return e.substring(1,e.length-2)}return e},wa=e=>{if(!e)return e;if(typeof e=="number")return e.toString();let t=e.startsWith("'")&&(e.endsWith("';")||e.endsWith("'")),r=e.startsWith('"')&&(e.endsWith('";')||e.endsWith('"'));return t||r?(e=e.substring(1,e.length-1),(e.endsWith('"')||e.endsWith("'"))&&(e=e.substring(0,e.length-1)),e.replace(/\\"/g,'"')):e.replace(/\\"/g,'"')},mA=(e,t)=>!e||e.length==0?t:e,AM=e=>e.charAt(0)=="/"?e.substring(1):e,kJ=e=>AM(e.substring(0,e.lastIndexOf("/")))||e;function Rs(e){return Rs=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Rs(e)}function Cr(e){if(e===null||e===!0||e===!1)return NaN;var t=Number(e);return isNaN(t)?t:t<0?Math.ceil(t):Math.floor(t)}function ut(e,t){if(t.length1?"s":"")+" required, but only "+t.length+" present")}function Mt(e){ut(1,arguments);var t=Object.prototype.toString.call(e);return e instanceof Date||Rs(e)==="object"&&t==="[object Date]"?new Date(e.getTime()):typeof e=="number"||t==="[object Number]"?new Date(e):((typeof e=="string"||t==="[object String]")&&typeof console<"u"&&(console.warn("Starting with v2.0.0-beta.1 date-fns doesn't accept strings as date arguments. Please use `parseISO` to parse strings. See: https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#string-arguments"),console.warn(new Error().stack)),new Date(NaN))}function oa(e,t){ut(2,arguments);var r=Mt(e),n=Cr(t);return isNaN(n)?new Date(NaN):(n&&r.setDate(r.getDate()+n),r)}function Uo(e,t){ut(2,arguments);var r=Mt(e),n=Cr(t);if(isNaN(n))return new Date(NaN);if(!n)return r;var i=r.getDate(),a=new Date(r.getTime());a.setMonth(r.getMonth()+n+1,0);var o=a.getDate();return i>=o?a:(r.setFullYear(a.getFullYear(),a.getMonth(),i),r)}function Sa(e,t){if(ut(2,arguments),!t||Rs(t)!=="object")return new Date(NaN);var r=t.years?Cr(t.years):0,n=t.months?Cr(t.months):0,i=t.weeks?Cr(t.weeks):0,a=t.days?Cr(t.days):0,o=t.hours?Cr(t.hours):0,s=t.minutes?Cr(t.minutes):0,l=t.seconds?Cr(t.seconds):0,u=Mt(e),c=n||r?Uo(u,n+r*12):u,f=a||i?oa(c,a+i*7):c,d=s+o*60,p=l+d*60,h=p*1e3,m=new Date(f.getTime()+h);return m}function ad(e,t){ut(2,arguments);var r=Mt(e).getTime(),n=Cr(t);return new Date(r+n)}var S_e=36e5;function Ox(e,t){ut(2,arguments);var r=Cr(t);return ad(e,r*S_e)}var E_e={};function Gl(){return E_e}function mo(e,t){var r,n,i,a,o,s,l,u;ut(1,arguments);var c=Gl(),f=Cr((r=(n=(i=(a=t?.weekStartsOn)!==null&&a!==void 0?a:t==null||(o=t.locale)===null||o===void 0||(s=o.options)===null||s===void 0?void 0:s.weekStartsOn)!==null&&i!==void 0?i:c.weekStartsOn)!==null&&n!==void 0?n:(l=c.locale)===null||l===void 0||(u=l.options)===null||u===void 0?void 0:u.weekStartsOn)!==null&&r!==void 0?r:0);if(!(f>=0&&f<=6))throw new RangeError("weekStartsOn must be between 0 and 6 inclusively");var d=Mt(e),p=d.getDay(),h=(p=i.getTime()?r+1:t.getTime()>=o.getTime()?r:r-1}function J$(e){ut(1,arguments);var t=K$(e),r=new Date(0);r.setFullYear(t,0,4),r.setHours(0,0,0,0);var n=tf(r);return n}function hA(e){var t=new Date(Date.UTC(e.getFullYear(),e.getMonth(),e.getDate(),e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds()));return t.setUTCFullYear(e.getFullYear()),e.getTime()-t.getTime()}function Hn(e){ut(1,arguments);var t=Mt(e);return t.setHours(0,0,0,0),t}var k_e=864e5;function od(e,t){ut(2,arguments);var r=Hn(e),n=Hn(t),i=r.getTime()-hA(r),a=n.getTime()-hA(n);return Math.round((i-a)/k_e)}var C_e=6e4;function JE(e,t){ut(2,arguments);var r=Cr(t);return ad(e,r*C_e)}function Xg(e,t){ut(2,arguments);var r=Cr(t),n=r*7;return oa(e,n)}function gM(e,t){ut(2,arguments);var r=Cr(t);return Uo(e,r*12)}function vM(e){ut(1,arguments);var t;if(e&&typeof e.forEach=="function")t=e;else if(Rs(e)==="object"&&e!==null)t=Array.prototype.slice.call(e);else return new Date(NaN);var r;return t.forEach(function(n){var i=Mt(n);(r===void 0||ri||isNaN(i.getDate()))&&(r=i)}),r||new Date(NaN)}var D_e=365.2425,O_e=Math.pow(10,8)*24*60*60*1e3,eq=6e4,tq=36e5;var iat=-O_e;var M_e=3600;var CJ=M_e*24,aat=CJ*7,j_e=CJ*D_e,N_e=j_e/12,oat=N_e*3;function pl(e,t){ut(2,arguments);var r=Hn(e),n=Hn(t);return r.getTime()===n.getTime()}function C1(e){return ut(1,arguments),e instanceof Date||Rs(e)==="object"&&Object.prototype.toString.call(e)==="[object Date]"}function rq(e){if(ut(1,arguments),!C1(e)&&typeof e!="number")return!1;var t=Mt(e);return!isNaN(Number(t))}function Kg(e,t){ut(2,arguments);var r=Mt(e),n=Mt(t),i=r.getFullYear()-n.getFullYear(),a=r.getMonth()-n.getMonth();return i*12+a}var T_e=6048e5;function nq(e,t,r){ut(2,arguments);var n=mo(e,r),i=mo(t,r),a=n.getTime()-hA(n),o=i.getTime()-hA(i);return Math.round((a-o)/T_e)}function Mx(e){ut(1,arguments);var t=Mt(e);return t.setHours(23,59,59,999),t}function Jg(e){ut(1,arguments);var t=Mt(e),r=t.getMonth();return t.setFullYear(t.getFullYear(),r+1,0),t.setHours(23,59,59,999),t}function Wo(e){ut(1,arguments);var t=Mt(e);return t.setDate(1),t.setHours(0,0,0,0),t}function bM(e){ut(1,arguments);var t=Mt(e),r=new Date(0);return r.setFullYear(t.getFullYear(),0,1),r.setHours(0,0,0,0),r}function AA(e,t){var r,n,i,a,o,s,l,u;ut(1,arguments);var c=Gl(),f=Cr((r=(n=(i=(a=t?.weekStartsOn)!==null&&a!==void 0?a:t==null||(o=t.locale)===null||o===void 0||(s=o.options)===null||s===void 0?void 0:s.weekStartsOn)!==null&&i!==void 0?i:c.weekStartsOn)!==null&&n!==void 0?n:(l=c.locale)===null||l===void 0||(u=l.options)===null||u===void 0?void 0:u.weekStartsOn)!==null&&r!==void 0?r:0);if(!(f>=0&&f<=6))throw new RangeError("weekStartsOn must be between 0 and 6 inclusively");var d=Mt(e),p=d.getDay(),h=(p=i.getTime()?r+1:t.getTime()>=o.getTime()?r:r-1}function oq(e){ut(1,arguments);var t=tk(e),r=new Date(0);r.setUTCFullYear(t,0,4),r.setUTCHours(0,0,0,0);var n=e0(r);return n}var __e=6048e5;function sq(e){ut(1,arguments);var t=Mt(e),r=e0(t).getTime()-oq(t).getTime();return Math.round(r/__e)+1}function t0(e,t){var r,n,i,a,o,s,l,u;ut(1,arguments);var c=Gl(),f=Cr((r=(n=(i=(a=t?.weekStartsOn)!==null&&a!==void 0?a:t==null||(o=t.locale)===null||o===void 0||(s=o.options)===null||s===void 0?void 0:s.weekStartsOn)!==null&&i!==void 0?i:c.weekStartsOn)!==null&&n!==void 0?n:(l=c.locale)===null||l===void 0||(u=l.options)===null||u===void 0?void 0:u.weekStartsOn)!==null&&r!==void 0?r:0);if(!(f>=0&&f<=6))throw new RangeError("weekStartsOn must be between 0 and 6 inclusively");var d=Mt(e),p=d.getUTCDay(),h=(p=1&&p<=7))throw new RangeError("firstWeekContainsDate must be between 1 and 7 inclusively");var h=new Date(0);h.setUTCFullYear(f+1,0,p),h.setUTCHours(0,0,0,0);var m=t0(h,t),g=new Date(0);g.setUTCFullYear(f,0,p),g.setUTCHours(0,0,0,0);var A=t0(g,t);return c.getTime()>=m.getTime()?f+1:c.getTime()>=A.getTime()?f:f-1}function lq(e,t){var r,n,i,a,o,s,l,u;ut(1,arguments);var c=Gl(),f=Cr((r=(n=(i=(a=t?.firstWeekContainsDate)!==null&&a!==void 0?a:t==null||(o=t.locale)===null||o===void 0||(s=o.options)===null||s===void 0?void 0:s.firstWeekContainsDate)!==null&&i!==void 0?i:c.firstWeekContainsDate)!==null&&n!==void 0?n:(l=c.locale)===null||l===void 0||(u=l.options)===null||u===void 0?void 0:u.firstWeekContainsDate)!==null&&r!==void 0?r:1),d=rk(e,t),p=new Date(0);p.setUTCFullYear(d,0,f),p.setUTCHours(0,0,0,0);var h=t0(p,t);return h}var P_e=6048e5;function uq(e,t){ut(1,arguments);var r=Mt(e),n=t0(r,t).getTime()-lq(r,t).getTime();return Math.round(n/P_e)+1}function ui(e,t){for(var r=e<0?"-":"",n=Math.abs(e).toString();n.length0?n:1-n;return ui(r==="yy"?i%100:i,r.length)},M:function(t,r){var n=t.getUTCMonth();return r==="M"?String(n+1):ui(n+1,2)},d:function(t,r){return ui(t.getUTCDate(),r.length)},a:function(t,r){var n=t.getUTCHours()/12>=1?"pm":"am";switch(r){case"a":case"aa":return n.toUpperCase();case"aaa":return n;case"aaaaa":return n[0];case"aaaa":default:return n==="am"?"a.m.":"p.m."}},h:function(t,r){return ui(t.getUTCHours()%12||12,r.length)},H:function(t,r){return ui(t.getUTCHours(),r.length)},m:function(t,r){return ui(t.getUTCMinutes(),r.length)},s:function(t,r){return ui(t.getUTCSeconds(),r.length)},S:function(t,r){var n=r.length,i=t.getUTCMilliseconds(),a=Math.floor(i*Math.pow(10,n-3));return ui(a,r.length)}},gA=I_e;var jx={am:"am",pm:"pm",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},B_e={G:function(t,r,n){var i=t.getUTCFullYear()>0?1:0;switch(r){case"G":case"GG":case"GGG":return n.era(i,{width:"abbreviated"});case"GGGGG":return n.era(i,{width:"narrow"});case"GGGG":default:return n.era(i,{width:"wide"})}},y:function(t,r,n){if(r==="yo"){var i=t.getUTCFullYear(),a=i>0?i:1-i;return n.ordinalNumber(a,{unit:"year"})}return gA.y(t,r)},Y:function(t,r,n,i){var a=rk(t,i),o=a>0?a:1-a;if(r==="YY"){var s=o%100;return ui(s,2)}return r==="Yo"?n.ordinalNumber(o,{unit:"year"}):ui(o,r.length)},R:function(t,r){var n=tk(t);return ui(n,r.length)},u:function(t,r){var n=t.getUTCFullYear();return ui(n,r.length)},Q:function(t,r,n){var i=Math.ceil((t.getUTCMonth()+1)/3);switch(r){case"Q":return String(i);case"QQ":return ui(i,2);case"Qo":return n.ordinalNumber(i,{unit:"quarter"});case"QQQ":return n.quarter(i,{width:"abbreviated",context:"formatting"});case"QQQQQ":return n.quarter(i,{width:"narrow",context:"formatting"});case"QQQQ":default:return n.quarter(i,{width:"wide",context:"formatting"})}},q:function(t,r,n){var i=Math.ceil((t.getUTCMonth()+1)/3);switch(r){case"q":return String(i);case"qq":return ui(i,2);case"qo":return n.ordinalNumber(i,{unit:"quarter"});case"qqq":return n.quarter(i,{width:"abbreviated",context:"standalone"});case"qqqqq":return n.quarter(i,{width:"narrow",context:"standalone"});case"qqqq":default:return n.quarter(i,{width:"wide",context:"standalone"})}},M:function(t,r,n){var i=t.getUTCMonth();switch(r){case"M":case"MM":return gA.M(t,r);case"Mo":return n.ordinalNumber(i+1,{unit:"month"});case"MMM":return n.month(i,{width:"abbreviated",context:"formatting"});case"MMMMM":return n.month(i,{width:"narrow",context:"formatting"});case"MMMM":default:return n.month(i,{width:"wide",context:"formatting"})}},L:function(t,r,n){var i=t.getUTCMonth();switch(r){case"L":return String(i+1);case"LL":return ui(i+1,2);case"Lo":return n.ordinalNumber(i+1,{unit:"month"});case"LLL":return n.month(i,{width:"abbreviated",context:"standalone"});case"LLLLL":return n.month(i,{width:"narrow",context:"standalone"});case"LLLL":default:return n.month(i,{width:"wide",context:"standalone"})}},w:function(t,r,n,i){var a=uq(t,i);return r==="wo"?n.ordinalNumber(a,{unit:"week"}):ui(a,r.length)},I:function(t,r,n){var i=sq(t);return r==="Io"?n.ordinalNumber(i,{unit:"week"}):ui(i,r.length)},d:function(t,r,n){return r==="do"?n.ordinalNumber(t.getUTCDate(),{unit:"date"}):gA.d(t,r)},D:function(t,r,n){var i=aq(t);return r==="Do"?n.ordinalNumber(i,{unit:"dayOfYear"}):ui(i,r.length)},E:function(t,r,n){var i=t.getUTCDay();switch(r){case"E":case"EE":case"EEE":return n.day(i,{width:"abbreviated",context:"formatting"});case"EEEEE":return n.day(i,{width:"narrow",context:"formatting"});case"EEEEEE":return n.day(i,{width:"short",context:"formatting"});case"EEEE":default:return n.day(i,{width:"wide",context:"formatting"})}},e:function(t,r,n,i){var a=t.getUTCDay(),o=(a-i.weekStartsOn+8)%7||7;switch(r){case"e":return String(o);case"ee":return ui(o,2);case"eo":return n.ordinalNumber(o,{unit:"day"});case"eee":return n.day(a,{width:"abbreviated",context:"formatting"});case"eeeee":return n.day(a,{width:"narrow",context:"formatting"});case"eeeeee":return n.day(a,{width:"short",context:"formatting"});case"eeee":default:return n.day(a,{width:"wide",context:"formatting"})}},c:function(t,r,n,i){var a=t.getUTCDay(),o=(a-i.weekStartsOn+8)%7||7;switch(r){case"c":return String(o);case"cc":return ui(o,r.length);case"co":return n.ordinalNumber(o,{unit:"day"});case"ccc":return n.day(a,{width:"abbreviated",context:"standalone"});case"ccccc":return n.day(a,{width:"narrow",context:"standalone"});case"cccccc":return n.day(a,{width:"short",context:"standalone"});case"cccc":default:return n.day(a,{width:"wide",context:"standalone"})}},i:function(t,r,n){var i=t.getUTCDay(),a=i===0?7:i;switch(r){case"i":return String(a);case"ii":return ui(a,r.length);case"io":return n.ordinalNumber(a,{unit:"day"});case"iii":return n.day(i,{width:"abbreviated",context:"formatting"});case"iiiii":return n.day(i,{width:"narrow",context:"formatting"});case"iiiiii":return n.day(i,{width:"short",context:"formatting"});case"iiii":default:return n.day(i,{width:"wide",context:"formatting"})}},a:function(t,r,n){var i=t.getUTCHours(),a=i/12>=1?"pm":"am";switch(r){case"a":case"aa":return n.dayPeriod(a,{width:"abbreviated",context:"formatting"});case"aaa":return n.dayPeriod(a,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return n.dayPeriod(a,{width:"narrow",context:"formatting"});case"aaaa":default:return n.dayPeriod(a,{width:"wide",context:"formatting"})}},b:function(t,r,n){var i=t.getUTCHours(),a;switch(i===12?a=jx.noon:i===0?a=jx.midnight:a=i/12>=1?"pm":"am",r){case"b":case"bb":return n.dayPeriod(a,{width:"abbreviated",context:"formatting"});case"bbb":return n.dayPeriod(a,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return n.dayPeriod(a,{width:"narrow",context:"formatting"});case"bbbb":default:return n.dayPeriod(a,{width:"wide",context:"formatting"})}},B:function(t,r,n){var i=t.getUTCHours(),a;switch(i>=17?a=jx.evening:i>=12?a=jx.afternoon:i>=4?a=jx.morning:a=jx.night,r){case"B":case"BB":case"BBB":return n.dayPeriod(a,{width:"abbreviated",context:"formatting"});case"BBBBB":return n.dayPeriod(a,{width:"narrow",context:"formatting"});case"BBBB":default:return n.dayPeriod(a,{width:"wide",context:"formatting"})}},h:function(t,r,n){if(r==="ho"){var i=t.getUTCHours()%12;return i===0&&(i=12),n.ordinalNumber(i,{unit:"hour"})}return gA.h(t,r)},H:function(t,r,n){return r==="Ho"?n.ordinalNumber(t.getUTCHours(),{unit:"hour"}):gA.H(t,r)},K:function(t,r,n){var i=t.getUTCHours()%12;return r==="Ko"?n.ordinalNumber(i,{unit:"hour"}):ui(i,r.length)},k:function(t,r,n){var i=t.getUTCHours();return i===0&&(i=24),r==="ko"?n.ordinalNumber(i,{unit:"hour"}):ui(i,r.length)},m:function(t,r,n){return r==="mo"?n.ordinalNumber(t.getUTCMinutes(),{unit:"minute"}):gA.m(t,r)},s:function(t,r,n){return r==="so"?n.ordinalNumber(t.getUTCSeconds(),{unit:"second"}):gA.s(t,r)},S:function(t,r){return gA.S(t,r)},X:function(t,r,n,i){var a=i._originalDate||t,o=a.getTimezoneOffset();if(o===0)return"Z";switch(r){case"X":return OJ(o);case"XXXX":case"XX":return D1(o);case"XXXXX":case"XXX":default:return D1(o,":")}},x:function(t,r,n,i){var a=i._originalDate||t,o=a.getTimezoneOffset();switch(r){case"x":return OJ(o);case"xxxx":case"xx":return D1(o);case"xxxxx":case"xxx":default:return D1(o,":")}},O:function(t,r,n,i){var a=i._originalDate||t,o=a.getTimezoneOffset();switch(r){case"O":case"OO":case"OOO":return"GMT"+DJ(o,":");case"OOOO":default:return"GMT"+D1(o,":")}},z:function(t,r,n,i){var a=i._originalDate||t,o=a.getTimezoneOffset();switch(r){case"z":case"zz":case"zzz":return"GMT"+DJ(o,":");case"zzzz":default:return"GMT"+D1(o,":")}},t:function(t,r,n,i){var a=i._originalDate||t,o=Math.floor(a.getTime()/1e3);return ui(o,r.length)},T:function(t,r,n,i){var a=i._originalDate||t,o=a.getTime();return ui(o,r.length)}};function DJ(e,t){var r=e>0?"-":"+",n=Math.abs(e),i=Math.floor(n/60),a=n%60;if(a===0)return r+String(i);var o=t||"";return r+String(i)+o+ui(a,2)}function OJ(e,t){if(e%60===0){var r=e>0?"-":"+";return r+ui(Math.abs(e)/60,2)}return D1(e,t)}function D1(e,t){var r=t||"",n=e>0?"-":"+",i=Math.abs(e),a=ui(Math.floor(i/60),2),o=ui(i%60,2);return n+a+r+o}var MJ=B_e;var jJ=function(t,r){switch(t){case"P":return r.date({width:"short"});case"PP":return r.date({width:"medium"});case"PPP":return r.date({width:"long"});case"PPPP":default:return r.date({width:"full"})}},NJ=function(t,r){switch(t){case"p":return r.time({width:"short"});case"pp":return r.time({width:"medium"});case"ppp":return r.time({width:"long"});case"pppp":default:return r.time({width:"full"})}},R_e=function(t,r){var n=t.match(/(P+)(p+)?/)||[],i=n[1],a=n[2];if(!a)return jJ(t,r);var o;switch(i){case"P":o=r.dateTime({width:"short"});break;case"PP":o=r.dateTime({width:"medium"});break;case"PPP":o=r.dateTime({width:"long"});break;case"PPPP":default:o=r.dateTime({width:"full"});break}return o.replace("{{date}}",jJ(i,r)).replace("{{time}}",NJ(a,r))},$_e={p:NJ,P:R_e},TJ=$_e;var q_e=["D","DD"],L_e=["YY","YYYY"];function FJ(e){return q_e.indexOf(e)!==-1}function _J(e){return L_e.indexOf(e)!==-1}function cq(e,t,r){if(e==="YYYY")throw new RangeError("Use `yyyy` instead of `YYYY` (in `".concat(t,"`) for formatting years to the input `").concat(r,"`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md"));if(e==="YY")throw new RangeError("Use `yy` instead of `YY` (in `".concat(t,"`) for formatting years to the input `").concat(r,"`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md"));if(e==="D")throw new RangeError("Use `d` instead of `D` (in `".concat(t,"`) for formatting days of the month to the input `").concat(r,"`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md"));if(e==="DD")throw new RangeError("Use `dd` instead of `DD` (in `".concat(t,"`) for formatting days of the month to the input `").concat(r,"`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md"))}var z_e={lessThanXSeconds:{one:"less than a second",other:"less than {{count}} seconds"},xSeconds:{one:"1 second",other:"{{count}} seconds"},halfAMinute:"half a minute",lessThanXMinutes:{one:"less than a minute",other:"less than {{count}} minutes"},xMinutes:{one:"1 minute",other:"{{count}} minutes"},aboutXHours:{one:"about 1 hour",other:"about {{count}} hours"},xHours:{one:"1 hour",other:"{{count}} hours"},xDays:{one:"1 day",other:"{{count}} days"},aboutXWeeks:{one:"about 1 week",other:"about {{count}} weeks"},xWeeks:{one:"1 week",other:"{{count}} weeks"},aboutXMonths:{one:"about 1 month",other:"about {{count}} months"},xMonths:{one:"1 month",other:"{{count}} months"},aboutXYears:{one:"about 1 year",other:"about {{count}} years"},xYears:{one:"1 year",other:"{{count}} years"},overXYears:{one:"over 1 year",other:"over {{count}} years"},almostXYears:{one:"almost 1 year",other:"almost {{count}} years"}},U_e=function(t,r,n){var i,a=z_e[t];return typeof a=="string"?i=a:r===1?i=a.one:i=a.other.replace("{{count}}",r.toString()),n!=null&&n.addSuffix?n.comparison&&n.comparison>0?"in "+i:i+" ago":i},PJ=U_e;function nk(e){return function(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},r=t.width?String(t.width):e.defaultWidth,n=e.formats[r]||e.formats[e.defaultWidth];return n}}var W_e={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},H_e={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},V_e={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},G_e={date:nk({formats:W_e,defaultWidth:"full"}),time:nk({formats:H_e,defaultWidth:"full"}),dateTime:nk({formats:V_e,defaultWidth:"full"})},IJ=G_e;var Q_e={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},Y_e=function(t,r,n,i){return Q_e[t]},BJ=Y_e;function O1(e){return function(t,r){var n=r!=null&&r.context?String(r.context):"standalone",i;if(n==="formatting"&&e.formattingValues){var a=e.defaultFormattingWidth||e.defaultWidth,o=r!=null&&r.width?String(r.width):a;i=e.formattingValues[o]||e.formattingValues[a]}else{var s=e.defaultWidth,l=r!=null&&r.width?String(r.width):e.defaultWidth;i=e.values[l]||e.values[s]}var u=e.argumentCallback?e.argumentCallback(t):t;return i[u]}}var Z_e={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},X_e={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},K_e={narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],wide:["January","February","March","April","May","June","July","August","September","October","November","December"]},J_e={narrow:["S","M","T","W","T","F","S"],short:["Su","Mo","Tu","We","Th","Fr","Sa"],abbreviated:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],wide:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},e4e={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"}},t4e={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"}},r4e=function(t,r){var n=Number(t),i=n%100;if(i>20||i<10)switch(i%10){case 1:return n+"st";case 2:return n+"nd";case 3:return n+"rd"}return n+"th"},n4e={ordinalNumber:r4e,era:O1({values:Z_e,defaultWidth:"wide"}),quarter:O1({values:X_e,defaultWidth:"wide",argumentCallback:function(t){return t-1}}),month:O1({values:K_e,defaultWidth:"wide"}),day:O1({values:J_e,defaultWidth:"wide"}),dayPeriod:O1({values:e4e,defaultWidth:"wide",formattingValues:t4e,defaultFormattingWidth:"wide"})},RJ=n4e;function M1(e){return function(t){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=r.width,i=n&&e.matchPatterns[n]||e.matchPatterns[e.defaultMatchWidth],a=t.match(i);if(!a)return null;var o=a[0],s=n&&e.parsePatterns[n]||e.parsePatterns[e.defaultParseWidth],l=Array.isArray(s)?a4e(s,function(f){return f.test(o)}):i4e(s,function(f){return f.test(o)}),u;u=e.valueCallback?e.valueCallback(l):l,u=r.valueCallback?r.valueCallback(u):u;var c=t.slice(o.length);return{value:u,rest:c}}}function i4e(e,t){for(var r in e)if(e.hasOwnProperty(r)&&t(e[r]))return r}function a4e(e,t){for(var r=0;r1&&arguments[1]!==void 0?arguments[1]:{},n=t.match(e.matchPattern);if(!n)return null;var i=n[0],a=t.match(e.parsePattern);if(!a)return null;var o=e.valueCallback?e.valueCallback(a[0]):a[0];o=r.valueCallback?r.valueCallback(o):o;var s=t.slice(i.length);return{value:o,rest:s}}}var o4e=/^(\d+)(th|st|nd|rd)?/i,s4e=/\d+/i,l4e={narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},u4e={any:[/^b/i,/^(a|c)/i]},c4e={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},f4e={any:[/1/i,/2/i,/3/i,/4/i]},d4e={narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},p4e={narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},m4e={narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},h4e={narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},A4e={narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},g4e={any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},v4e={ordinalNumber:fq({matchPattern:o4e,parsePattern:s4e,valueCallback:function(t){return parseInt(t,10)}}),era:M1({matchPatterns:l4e,defaultMatchWidth:"wide",parsePatterns:u4e,defaultParseWidth:"any"}),quarter:M1({matchPatterns:c4e,defaultMatchWidth:"wide",parsePatterns:f4e,defaultParseWidth:"any",valueCallback:function(t){return t+1}}),month:M1({matchPatterns:d4e,defaultMatchWidth:"wide",parsePatterns:p4e,defaultParseWidth:"any"}),day:M1({matchPatterns:m4e,defaultMatchWidth:"wide",parsePatterns:h4e,defaultParseWidth:"any"}),dayPeriod:M1({matchPatterns:A4e,defaultMatchWidth:"any",parsePatterns:g4e,defaultParseWidth:"any"})},$J=v4e;var y4e={code:"en-US",formatDistance:PJ,formatLong:IJ,formatRelative:BJ,localize:RJ,match:$J,options:{weekStartsOn:0,firstWeekContainsDate:1}},ik=y4e;var qJ=ik;var b4e=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,x4e=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,w4e=/^'([^]*?)'?$/,S4e=/''/g,E4e=/[a-zA-Z]/;function Za(e,t,r){var n,i,a,o,s,l,u,c,f,d,p,h,m,g,A,b,v,x;ut(2,arguments);var w=String(t),S=Gl(),k=(n=(i=r?.locale)!==null&&i!==void 0?i:S.locale)!==null&&n!==void 0?n:qJ,j=Cr((a=(o=(s=(l=r?.firstWeekContainsDate)!==null&&l!==void 0?l:r==null||(u=r.locale)===null||u===void 0||(c=u.options)===null||c===void 0?void 0:c.firstWeekContainsDate)!==null&&s!==void 0?s:S.firstWeekContainsDate)!==null&&o!==void 0?o:(f=S.locale)===null||f===void 0||(d=f.options)===null||d===void 0?void 0:d.firstWeekContainsDate)!==null&&a!==void 0?a:1);if(!(j>=1&&j<=7))throw new RangeError("firstWeekContainsDate must be between 1 and 7 inclusively");var O=Cr((p=(h=(m=(g=r?.weekStartsOn)!==null&&g!==void 0?g:r==null||(A=r.locale)===null||A===void 0||(b=A.options)===null||b===void 0?void 0:b.weekStartsOn)!==null&&m!==void 0?m:S.weekStartsOn)!==null&&h!==void 0?h:(v=S.locale)===null||v===void 0||(x=v.options)===null||x===void 0?void 0:x.weekStartsOn)!==null&&p!==void 0?p:0);if(!(O>=0&&O<=6))throw new RangeError("weekStartsOn must be between 0 and 6 inclusively");if(!k.localize)throw new RangeError("locale must contain localize property");if(!k.formatLong)throw new RangeError("locale must contain formatLong property");var C=Mt(e);if(!rq(C))throw new RangeError("Invalid time value");var N=hA(C),D=iq(C,N),P={firstWeekContainsDate:j,weekStartsOn:O,locale:k,_originalDate:C},q=w.match(x4e).map(function(z){var I=z[0];if(I==="p"||I==="P"){var T=TJ[I];return T(z,k.formatLong)}return z}).join("").match(b4e).map(function(z){if(z==="''")return"'";var I=z[0];if(I==="'")return k4e(z);var T=MJ[I];if(T)return!(r!=null&&r.useAdditionalWeekYearTokens)&&_J(z)&&cq(z,t,String(e)),!(r!=null&&r.useAdditionalDayOfYearTokens)&&FJ(z)&&cq(z,t,String(e)),T(D,z,k.localize,P);if(I.match(E4e))throw new RangeError("Format string contains an unescaped latin alphabet character `"+I+"`");return z}).join("");return q}function k4e(e){var t=e.match(w4e);return t?t[1].replace(S4e,"'"):e}function dq(e){ut(1,arguments);var t=Mt(e),r=t.getFullYear(),n=t.getMonth(),i=new Date(0);return i.setFullYear(r,n+1,0),i.setHours(0,0,0,0),i.getDate()}var C4e=6048e5;function xM(e){ut(1,arguments);var t=Mt(e),r=tf(t).getTime()-J$(t).getTime();return Math.round(r/C4e)+1}function pq(e){ut(1,arguments);var t=Mt(e),r=t.getTime();return r}function wM(e){return ut(1,arguments),Math.floor(pq(e)/1e3)}function mq(e,t){var r,n,i,a,o,s,l,u;ut(1,arguments);var c=Mt(e),f=c.getFullYear(),d=Gl(),p=Cr((r=(n=(i=(a=t?.firstWeekContainsDate)!==null&&a!==void 0?a:t==null||(o=t.locale)===null||o===void 0||(s=o.options)===null||s===void 0?void 0:s.firstWeekContainsDate)!==null&&i!==void 0?i:d.firstWeekContainsDate)!==null&&n!==void 0?n:(l=d.locale)===null||l===void 0||(u=l.options)===null||u===void 0?void 0:u.firstWeekContainsDate)!==null&&r!==void 0?r:1);if(!(p>=1&&p<=7))throw new RangeError("firstWeekContainsDate must be between 1 and 7 inclusively");var h=new Date(0);h.setFullYear(f+1,0,p),h.setHours(0,0,0,0);var m=mo(h,t),g=new Date(0);g.setFullYear(f,0,p),g.setHours(0,0,0,0);var A=mo(g,t);return c.getTime()>=m.getTime()?f+1:c.getTime()>=A.getTime()?f:f-1}function hq(e,t){var r,n,i,a,o,s,l,u;ut(1,arguments);var c=Gl(),f=Cr((r=(n=(i=(a=t?.firstWeekContainsDate)!==null&&a!==void 0?a:t==null||(o=t.locale)===null||o===void 0||(s=o.options)===null||s===void 0?void 0:s.firstWeekContainsDate)!==null&&i!==void 0?i:c.firstWeekContainsDate)!==null&&n!==void 0?n:(l=c.locale)===null||l===void 0||(u=l.options)===null||u===void 0?void 0:u.firstWeekContainsDate)!==null&&r!==void 0?r:1),d=mq(e,t),p=new Date(0);p.setFullYear(d,0,f),p.setHours(0,0,0,0);var h=mo(p,t);return h}var D4e=6048e5;function SM(e,t){ut(1,arguments);var r=Mt(e),n=mo(r,t).getTime()-hq(r,t).getTime();return Math.round(n/D4e)+1}function Aq(e){ut(1,arguments);var t=Mt(e),r=t.getMonth();return t.setFullYear(t.getFullYear(),r+1,0),t.setHours(0,0,0,0),t}function EM(e,t){return ut(1,arguments),nq(Aq(e),Wo(e),t)+1}function Nx(e,t){ut(2,arguments);var r=Mt(e),n=Mt(t);return r.getTime()>n.getTime()}function ak(e,t){ut(2,arguments);var r=Mt(e),n=Mt(t);return r.getTime()2)return t;if(/:/.test(r[0])?n=r[0]:(t.date=r[0],n=r[1],CM.timeZoneDelimiter.test(t.date)&&(t.date=e.split(CM.timeZoneDelimiter)[0],n=e.substr(t.date.length,e.length))),n){var i=CM.timezone.exec(n);i?(t.time=n.replace(i[1],""),t.timezone=i[1]):t.time=n}return t}function T4e(e,t){var r=new RegExp("^(?:(\\d{4}|[+-]\\d{"+(4+t)+"})|(\\d{2}|[+-]\\d{"+(2+t)+"})$)"),n=e.match(r);if(!n)return{year:NaN,restDateString:""};var i=n[1]?parseInt(n[1]):null,a=n[2]?parseInt(n[2]):null;return{year:a===null?i:a*100,restDateString:e.slice((n[1]||n[2]).length)}}function F4e(e,t){if(t===null)return new Date(NaN);var r=e.match(O4e);if(!r)return new Date(NaN);var n=!!r[4],i=sk(r[1]),a=sk(r[2])-1,o=sk(r[3]),s=sk(r[4]),l=sk(r[5])-1;if(n)return q4e(t,s,l)?I4e(t,s,l):new Date(NaN);var u=new Date(0);return!R4e(t,a,o)||!$4e(t,i)?new Date(NaN):(u.setUTCFullYear(t,a,Math.max(i,o)),u)}function sk(e){return e?parseInt(e):1}function _4e(e){var t=e.match(M4e);if(!t)return NaN;var r=yq(t[1]),n=yq(t[2]),i=yq(t[3]);return L4e(r,n,i)?r*tq+n*eq+i*1e3:NaN}function yq(e){return e&&parseFloat(e.replace(",","."))||0}function P4e(e){if(e==="Z")return 0;var t=e.match(j4e);if(!t)return 0;var r=t[1]==="+"?-1:1,n=parseInt(t[2]),i=t[3]&&parseInt(t[3])||0;return z4e(n,i)?r*(n*tq+i*eq):NaN}function I4e(e,t,r){var n=new Date(0);n.setUTCFullYear(e,0,4);var i=n.getUTCDay()||7,a=(t-1)*7+r+1-i;return n.setUTCDate(n.getUTCDate()+a),n}var B4e=[31,null,31,30,31,30,31,31,30,31,30,31];function LJ(e){return e%400===0||e%4===0&&e%100!==0}function R4e(e,t,r){return t>=0&&t<=11&&r>=1&&r<=(B4e[t]||(LJ(e)?29:28))}function $4e(e,t){return t>=1&&t<=(LJ(e)?366:365)}function q4e(e,t,r){return t>=1&&t<=53&&r>=0&&r<=6}function L4e(e,t,r){return e===24?t===0&&r===0:r>=0&&r<60&&t>=0&&t<60&&e>=0&&e<25}function z4e(e,t){return t>=0&&t<=59}function _x(e,t){ut(2,arguments);var r=Mt(e),n=Cr(t),i=r.getFullYear(),a=r.getDate(),o=new Date(0);o.setFullYear(i,n,15),o.setHours(0,0,0,0);var s=dq(o);return r.setMonth(n,Math.min(a,s)),r}function lk(e,t){ut(2,arguments);var r=Mt(e),n=Cr(t);return isNaN(r.getTime())?new Date(NaN):(r.setFullYear(n),r)}var mt="File";var bq=(e,t)=>{let r=n=>n=="builtin"?"Builtin":n=="api"?"Spaces":"Action";return[...(e.actionsIndex.get(t)??[]).map(n=>({name:n.schema.name,description:"Action",value:`${t}/#;${n.schema.id}`,section:"Action"}))??[],...[...e.cli.allCommands()].map(n=>({name:n.schema.name,description:r(n.schema.type),value:n.path,section:r(n.schema.type)}))]};var zJ=({field:e,value:t})=>t=="ctime"?{value:"parseDate(prop('File')['metadata']['ctime'])",type:"date"}:{value:"",type:"string"},pr=(e,t,r,n)=>{let i=or(e);if(i)return t=="fileprop"&&i.field?zJ(i):(t=="option"&&i.source?.length>0&&(i.source=="$commands"?i.options=r.cli.allCommands():i.source=="$links"?i.options=r.spaceManager.allPaths().map(a=>({name:a,value:a})):i.source=="$super"?i.options=bq(r,n):i.source=="$properties"&&(i.options=r.contextsIndex.get(n)?.contextTable?.cols?.map(a=>({name:a.name,value:a.name}))??[])),[...fc(t).configKeys??[],"alias","default"].reduce((a,o)=>({...a,[o]:i[o]}),{}));if(!t)return{};if(!i)if(t=="context")e?.length>0?i={space:e}:i={};else if(t.startsWith("date"))e?.length>0?i={format:e}:i={};else if(t.startsWith("fileprop"))if(e?.length>0){let[a,o]=e.split(".");i=zJ({field:a,value:o})}else i={};else t.startsWith("option")&&(e?.length>0?i={options:sr(e).map(o=>({name:o,value:o}))}:i={});return i??{}};var sa={uniques:["name,schemaId"],cols:["name","schemaId","type","value","attrs","hidden","unique","primary"]},sd={...sa,rows:[{name:mt,schemaId:Er,type:"file",primary:"true",hidden:"",unique:"",attrs:"",value:""},{name:"Created",schemaId:Er,type:"fileprop",value:mt+".ctime",hidden:"",unique:"",attrs:"",primary:"true"}]},xq=e=>sd,Px=[{name:"Name",schemaId:"",type:"text",primary:"true"}],OM={...sa,rows:[{name:mt,schemaId:Er,type:"file",primary:"true",hidden:"",unique:"",attrs:"",value:""}]};var ho=e=>e?e.type=="fileprop"?pr(e.value,"fileprop")?.type??"text":e.type:null,Ii=e=>e.attrs?.length>0?or(e.attrs)?.icon??fc(e.type,e.name)?.icon:fc(e.type,e.name)?.icon,Ix=e=>e.def?.icon?.length>0?e.def?.icon:"ui//layout-list",UJ=e=>or(e?.def)?.icon??"ui//layout-list",fc=(e,t)=>t==mt?ml.find(r=>r.type=="file"):t=="tags"?ml.find(r=>r.type=="tags-multi"):t=="aliases"?ml.find(r=>r.type=="option-multi"):t=="sticker"?ml.find(r=>e=="icon"):ml.find(r=>e==r.type)||ml.find(r=>e==r.multiType),ml=[{type:"unknown",label:"",restricted:!0,icon:"ui//file-question"},{type:"any",label:"",restricted:!0,icon:"ui//wildcard",multi:!0,multiType:"any-multi"},{type:"text",label:H.properties.text.label,metadata:!0,icon:"ui//text",primative:!0,description:H.properties.text.description},{type:"number",label:H.properties.number.label,metadata:!0,icon:"ui//binary",configKeys:["unit"],primative:!0,description:H.properties.number.description},{type:"boolean",label:H.properties.boolean.label,metadata:!0,icon:"ui//check-square",primative:!0,description:H.properties.boolean.description},{type:"date",label:H.properties.date.label,metadata:!0,icon:"ui//calendar",configKeys:["format"],primative:!0,description:H.properties.date.description},{type:"option",label:H.properties.option.label,multi:!0,multiType:"option-multi",icon:"ui//list",configKeys:["options","source"],description:H.properties.option.description},{type:"tags-multi",label:H.properties.tags.label,icon:"ui//tags",description:H.properties.tags.description},{type:"file",label:H.properties.file.label,restricted:!0,icon:"ui//mk-make-h3"},{type:"fileprop",label:H.properties.fileProperty.label,icon:"ui//formula",configKeys:["field","value","type"],description:H.properties.fileProperty.description},{type:"link",label:H.properties.link.label,multi:!0,multiType:"link-multi",metadata:!0,icon:"ui//file-text",primative:!0,description:H.properties.link.description},{type:"context",label:H.properties.context.label,icon:"ui//mk-make-note",multi:!0,multiType:"context-multi",configKeys:["space","field"],description:H.properties.context.description},{type:"aggregate",label:H.properties.aggregate.label,icon:"ui//mk-make-note",multi:!1,configKeys:["ref","field","fn"],description:H.properties.aggregate.description},{type:"object",label:H.properties.object.label,multi:!0,multiType:"object-multi",metadata:!0,icon:"ui//list-tree",configKeys:["type","typeName"],description:H.properties.object.description},{type:"icon",label:H.properties.icon.label,multi:!0,multiType:"icon-multi",icon:"ui//gem",restricted:!0,primative:!0,description:H.properties.icon.description},{type:"image",label:H.properties.image.label,multi:!0,multiType:"image-multi",metadata:!0,icon:"ui//mk-make-image",primative:!0,description:H.properties.image.description},{type:"color",label:H.properties.color.label,icon:"ui//mk-make-image",restricted:!0,description:H.properties.color.description},{type:"space",label:H.properties.space.label,icon:"ui//layout-grid",restricted:!0,description:H.properties.space.description},{type:"table",label:H.properties.space.label,icon:"ui//layout-grid",restricted:!0,description:H.properties.space.description},{type:"super",label:H.properties.super.label,icon:"ui//zap",restricted:!0,configKeys:["dynamic","field"]},{type:"input",label:H.properties.super.label,icon:"ui//input",restricted:!0}];var r0="filesView",bp={id:r0,name:"All",type:"view",def:JSON.stringify({db:Er,icon:"ui//file-stack"})},j1="main",MM=e=>({id:e,name:e,type:"frame",def:"",predicate:"",primary:"true"}),WJ={uniques:[],cols:["id","name","type","def","predicate","primary"],rows:[MM(j1),bp]},vA={uniques:[],cols:["id","name","type","def","predicate","primary"],rows:[yp]},HJ=e=>U4e,U4e={schema:yp,cols:sd.rows,rows:[]},Gut={schema:yp,cols:sd.rows,rows:[]},Qut={schema:yp,cols:OM.rows,rows:[]},VJ=(e,t)=>e.filter(r=>t.find(n=>n.id==r.schemaId&&n.type=="db")).reduce((r,n)=>({...r,...r[n.schemaId]?{[n.schemaId]:{uniques:n.unique=="true"?[...r[n.schemaId].uniques,n.name]:r[n.schemaId].uniques,cols:[...r[n.schemaId].cols,n.name],rows:[]}}:{[n.schemaId]:{uniques:n.unique=="true"?[n.name]:[],cols:[n.name],rows:[]}}}),{}),GJ=e=>W4e,W4e={m_schema:vA,m_fields:sd,...VJ(sd.rows,vA.rows)},Yut={m_schema:vA,m_fields:OM,...VJ(OM.rows,vA.rows)};var yA=(e,t)=>{if(e instanceof Date)return"date";if(typeof e=="string"){if(/\/\/(\S+?(?:jpe?g|png|gif|svg))/gi.test(e)||e.includes("unsplash"))return"image";if(/^\d{4}-\d{2}-\d{2}$/.test(e))return"date";if(t=="tag"||t=="tags")return"tags-multi";if(/\[\[.*?\]\]/.test(e))return"link"}else{if(typeof e=="number")return"number";if(typeof e=="boolean")return"boolean";if(e)if(Array.isArray(e)||typeof e=="string"&&e.indexOf(",")>-1){let r=Array.isArray(e)?e:[];if(typeof e=="string"&&e.indexOf(",")>-1&&(r=sr(e)),t=="tag"||t=="tags")return"tags-multi";if(r.length==1&&Array.isArray(r[0])&&r[0].length==1&&typeof r[0][0]=="string")return"link";let n=kr(r.map(i=>yA(i,t)));return n.length==1&&n[0]=="link"?"link-multi":n.some(i=>i=="object")?"object-multi":"option-multi"}else return e.isLuxonDateTime?"date":e.isLuxonDuration?"duration":e.type=="file"?"link":typeof e=="object"&&!Array.isArray(e)&&e!==null?"object":"unknown";else return"unknown"}return"text"},Bx=e=>{if(e=="date")return Za(Date.now(),"yyyy-MM-dd");if(e=="number")return 0;if(e=="boolean")return!0;if(e=="link")return"[[Select Note]]";if(e=="option")return"one, two";if(e=="text")return" ";if(e=="image")return"https://images.unsplash.com/photo-1675789652575-0a5d2425b6c2?ixlib=rb-4.0.3&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=2070&q=80"};var wq=(e,t)=>t?t=="number"?parseFloat(e):t=="boolean"?e=="true":t.includes("-multi")?sr(e).map(r=>la(t.replace("-multi",""),r,!1)):e:e,la=(e,t,r)=>e?e=="object"||e=="object-multi"?JSON.parse(t):e=="number"?parseFloat(t):e=="boolean"?t=="true":e.includes("-multi")?sr(t).map(n=>la(e.replace("-multi",""),n,r)):(e.includes("link")||e.includes("context"))&&r?`[[${t}]]`:t:t,Sq=e=>{switch(e){case"duration":return"text";case"unknown":return"text"}return e},Rx=e=>e.type=="object"||e.type=="object-multi"||e.type=="super";var os=e=>e.map(t=>t.replace(",","\\,")).join(", "),Bi=e=>JSON.stringify(e),Eq=e=>e.join(", "),QJ=e=>e.join("; "),YJ=e=>e.join(",");var sr=e=>e?.startsWith("[")?dl(or(e)).map(t=>Bs(t)):qx(e),qx=e=>(e?.replace("\\,",",")?.match(/(\\.|[^,])+/g)??[]).map(t=>t.trim()),Ri=(e,t,r)=>{let n=r??yA(t,e);if(!t)return"";switch(n){case"tags-multi":return t;case"object":case"object-multi":{if(Array.isArray(t)){if(t[0].path)return JSON.stringify(t.map(i=>i.path))}else if(t.path)return t.path;return JSON.stringify(t)}break;case"number":return t.toString();case"boolean":return t?"true":"false";case"date":{if(t instanceof Date){let i=Za(t,"yyyy-MM-dd");return typeof i=="string"?i:""}return typeof t!="string"?"":t}break;case"duration":return os(Object.keys(t.values).reduce((i,a)=>[...i,...t.values[a]>0?[t.values[a]+" "+a]:[]],[]));case"option-multi":case"link-multi":case"context-multi":return typeof t=="string"?$x(t):Bi(t.map(i=>i?typeof i=="string"?$x(i):i.path?i.path:Array.isArray(t)&&i.length==1&&Array.isArray(i[0])&&i[0].length==1&&typeof i[0][0]=="string"?i[0][0]:JSON.stringify(i):""));case"link":case"context":return Array.isArray(t)&&t.length==1&&Array.isArray(t[0])&&t[0].length==1&&typeof t[0][0]=="string"?t[0][0]:typeof t=="string"?$x(t):t.path;case"text":case"tag":case"option":case"image":return t}return""},jm=(e,t)=>t?dl(or(e)):or(e)??{},or=e=>{let t;try{t=JSON.parse(e)}catch{}return t};var $x=e=>{if(!e)return"";let t=/\[\[(.*?)\]\]/g.exec(e),r=t?.length>1?t[1].substring(0,xJ("|",t[1])):e;return r||e};var uk=class{constructor(){this.spaceAdapters=[];this.readSystemCommands=()=>this.primarySpaceAdapter.readSystemCommands();this.saveSystemCommand=(t,r)=>this.primarySpaceAdapter.saveSystemCommand(t,r).then(n=>this.superstate.reloadSystemActions());this.onFocusesUpdated=()=>{this.readFocuses().then(t=>{this.superstate.focuses=t,this.superstate.dispatchEvent("focusesChanged",null)})};this.onPathCreated=async t=>{this.superstate.onPathCreated(t)};this.onPathDeleted=async t=>{this.superstate.onPathDeleted(t)};this.onPathChanged=async(t,r)=>{this.superstate.onPathRename(r,t)};this.onSpaceCreated=async t=>{if(t.startsWith(this.superstate.settings.spacesFolder)){await this.onSpaceCreated(t.replace(this.superstate.settings.spacesFolder,"spaces:/"));return}let r=await this.superstate.reloadSpace(this.spaceInfoForPath(t),null,!0);await this.superstate.onSpaceDefinitionChanged(r),await this.superstate.onPathCreated(t)};this.onSpaceRenamed=async(t,r)=>{await this.superstate.onSpaceRenamed(r,this.spaceInfoForPath(t)),await this.superstate.onPathRename(r,t)};this.onSpaceDeleted=async t=>{this.superstate.onSpaceDeleted(t),this.superstate.onPathDeleted(t)};this.onPathPropertyChanged=async t=>{this.superstate.onMetadataChange(t)};this.spaceTypeByString=t=>t.fullPath.startsWith(Zg)?"default":t.scheme=="space"?"folder":t.authority?.charAt(0)=="#"?"tag":t.path.charAt(t.path.length-1)=="/"&&t.path=="/"?"vault":"folder"}onSpaceUpdated(t,r){!this.superstate.spacesIndex.has(t)||(r=="context"&&this.superstate.reloadContextByPath(t),r=="frame"&&this.superstate.dispatchEvent("frameStateUpdated",{path:t}),r=="action"&&this.superstate.reloadActions(this.spaceInfoForPath(t)))}saveFrameKit(t,r){return this.primarySpaceAdapter.saveFrameKit(t,r)}saveSpaceTemplate(t,r){return this.primarySpaceAdapter.saveSpaceTemplate(t,r)}resolvePath(t,r){if(!r||!t||t.indexOf("http")==0)return t;if(t.indexOf("|")!=-1&&(t=t.split("|")[0]),t.indexOf("./")==0&&r)return this.superstate.spacesIndex.has(r)?r+t.slice(1):r.slice(0,r.lastIndexOf("/"))+t.slice(1);if(t.indexOf("../")==0&&r){let n=r.split("/"),i=t.split("/");for(;i[0]==="..";)n.pop(),i.shift();return[...n,...i].join("/")}return this.superstate.pathsIndex.has(t)?t:this.primarySpaceAdapter.resolvePath(t,r)??t}uriByString(t,r){return!t||r&&(t=this.resolvePath(t,r),!t)?null:cc(t)}async allCaches(){let t=new Map,r=this.primarySpaceAdapter.allCaches().keys();for(let n of r){let i=await this.readPathCache(n);t.set(n,i)}return t}keysForCacheType(t){return this.primarySpaceAdapter.keysForCacheType(t)}pathExists(t){return this.primarySpaceAdapter.pathExists(t)}addSpaceAdapter(t,r){t.initiateAdapter(this),r&&(this.primarySpaceAdapter=t),this.spaceAdapters.push(t)}adapterForPath(t){let r=this.uriByString(t);return r?this.spaceAdapters.find(n=>n.schemes.includes(r.scheme))??this.primarySpaceAdapter:this.primarySpaceAdapter}createSpace(t,r,n){return this.adapterForPath(r).createSpace(t,r,n)}saveSpace(t,r,n){return this.adapterForPath(t).saveSpace(t,r,n)}renameSpace(t,r){return this.adapterForPath(t).renameSpace(t,r)}deleteSpace(t){return this.adapterForPath(t).deleteSpace(t)}childrenForSpace(t){return this.adapterForPath(t).childrenForSpace(t)}contextForSpace(t){return this.adapterForPath(t).contextForSpace(t)}async tablesForSpace(t){return this.adapterForPath(t).tablesForSpace(t)}spaceInitiated(t){return this.adapterForPath(t).spaceInitiated(t)}contextInitiated(t){return this.adapterForPath(t).contextInitiated(t)}readTable(t,r){return this.adapterForPath(t).readTable(t,r)}createTable(t,r){return this.adapterForPath(t).createTable(t,r).then(n=>this.superstate.reloadContextByPath(t,!0))}saveTableSchema(t,r,n){return this.adapterForPath(t).saveTableSchema(t,r,n).then(i=>i&&this.superstate.reloadContextByPath(t,!0))}saveTable(t,r,n){return this.adapterForPath(t).saveTable(t,r,n)}deleteTable(t,r){return this.adapterForPath(t).deleteTable(t,r).then(n=>this.superstate.reloadContextByPath(t,!0))}readAllKits(){return this.primarySpaceAdapter.readAllKits()}readAllTemplates(){return this.primarySpaceAdapter.readAllTemplates()}readAllTables(t){return this.adapterForPath(t).readAllTables(t)}framesForSpace(t){return this.adapterForPath(t).framesForSpace(t)}readFrame(t,r){return this.adapterForPath(t).readFrame(t,r)}readAllFrames(t){return this.adapterForPath(t).readAllFrames(t)}createFrame(t,r){return this.adapterForPath(t).createFrame(t,r).then(n=>this.superstate.dispatchEvent("frameStateUpdated",{path:this.spaceInfoForPath(t).path,schemaId:r.id}))}deleteFrame(t,r){return this.adapterForPath(t).deleteFrame(t,r)}saveFrameSchema(t,r,n){return this.adapterForPath(t).saveFrameSchema(t,r,n).then(i=>this.superstate.dispatchEvent("frameStateUpdated",{path:this.spaceInfoForPath(t).path,schemaId:r}))}saveFrame(t,r){return this.adapterForPath(t).saveFrame(t,r).then(n=>this.superstate.dispatchEvent("frameStateUpdated",{path:this.spaceInfoForPath(t).path,schemaId:r.schema.id}))}commandsForSpace(t){return this.adapterForPath(t).commandsForSpace(t)}runCommand(t,r,n){return this.adapterForPath(t).runCommand(t,r,n)}createCommand(t,r){return this.adapterForPath(t).createCommand(t,r).then(n=>this.superstate.reloadActions(this.spaceInfoForPath(t)))}deleteCommand(t,r){return this.adapterForPath(t).deleteCommand(t,r).then(n=>this.superstate.reloadActions(this.spaceInfoForPath(t)))}saveCommand(t,r,n){return this.adapterForPath(t).saveCommand(t,r,n).then(i=>this.superstate.reloadActions(this.spaceInfoForPath(t)))}allPaths(t){return this.spaceAdapters.flatMap(r=>r.allPaths(t))}createItemAtPath(t,r,n,i){return this.adapterForPath(t).createItemAtPath(t,r,n,i)}renamePath(t,r){return this.adapterForPath(t).renamePath(t,r)}copyPath(t,r,n){return this.adapterForPath(t).copyPath(t,r,n)}getPathInfo(t){return this.adapterForPath(t).getPathInfo(t)}deletePath(t){return this.adapterForPath(t).deletePath(t)}readPath(t){return this.adapterForPath(t).readPath(t)}writeToPath(t,r,n){return this.adapterForPath(t).writeToPath(t,r,n)}parentPathForPath(t){return this.adapterForPath(t).parentPathForPath(t)}async readPathCache(t){let r=await this.adapterForPath(t).readPathCache(t);if(r&&r.type=="space"&&!this.superstate.settings.enableFolderNote){let n=this.spaceInfoForPath(t).defPath;r.label={...r.label,...await this.readLabel(n)},r.property=await this.readProperties(n)}return r}allSpaces(){return this.primarySpaceAdapter.allSpaces()}spaceInfoForPath(t){return this.adapterForPath(t).spaceInfoForPath(t)}spaceDefForSpace(t){return this.adapterForPath(t).spaceDefForSpace(t)}readLabel(t){return this.adapterForPath(t).readLabel(t)}saveLabel(t,r,n){return this.adapterForPath(t).saveLabel(t,r,n)}addProperty(t,r){return this.adapterForPath(t).addProperty(t,r)}saveProperties(t,r){if(!!t)return this.adapterForPath(t).saveProperties(t,r)}readProperties(t){return this.adapterForPath(t).readProperties(t)}renameProperty(t,r,n){return this.adapterForPath(t).renameProperty(t,r,n)}deleteProperty(t,r){return this.adapterForPath(t).deleteProperty(t,r)}addSpaceProperty(t,r){if(r.schemaId==Er&&r.type.startsWith("option")){let n=kr([...this.superstate.spacesMap.getInverse(t)??[]].flatMap(a=>sr(this.superstate.pathsIndex.get(a)?.metadata?.property?.[r.name])??[])),i=pA(n.map(a=>({value:a,name:a})),{});r.value=i}return this.adapterForPath(t).addSpaceProperty(t,r).then(n=>this.superstate.reloadContextByPath(t,!0))}deleteSpaceProperty(t,r){return this.adapterForPath(t).deleteSpaceProperty(t,r).then(n=>this.superstate.reloadContextByPath(t,!0))}saveSpaceProperty(t,r,n){return this.adapterForPath(t).saveSpaceProperty(t,r,n).then(i=>(n.name!=r.name&&this.superstate.getSpaceItems(t).forEach(a=>{this.renameProperty(a.path,n.name,r.name)}),this.superstate.reloadContextByPath(t,!0)))}addTag(t,r){return this.adapterForPath(t).addTag(t,r)}deleteTag(t,r){return this.adapterForPath(t).deleteTag(t,r)}renameTag(t,r,n){return this.adapterForPath(t).renameTag(t,r,n)}readTags(){return this.primarySpaceAdapter.readTags()}pathsForTag(t){return this.primarySpaceAdapter.pathsForTag(t)}childrenForPath(t,r){return this.adapterForPath(t).childrenForPath(t,r)}readFocuses(){return this.primarySpaceAdapter.readFocuses()}saveFocuses(t){return this.superstate.focuses=t,this.superstate.dispatchEvent("focusesChanged",null),this.primarySpaceAdapter.saveFocuses(t)}readTemplates(t){return this.adapterForPath(t).readTemplates(t)}saveTemplate(t,r){return this.adapterForPath(t).saveTemplate(t,r).then(n=>this.superstate.reloadSpace(this.spaceInfoForPath(r),null,!0)).then(n=>n.path)}deleteTemplate(t,r){return this.primarySpaceAdapter.deleteTemplate(t,r).then(n=>this.superstate.reloadSpace(this.spaceInfoForPath(r),null,!0)).then(n=>null)}};var n0=class{constructor(){this.listeners=new Map}addListener(t,r,n=0,i){let a={callback:r,priority:n,once:!1,context:i},o=this.listeners.get(t)||[];o.push(a),o.sort((s,l)=>l.priority-s.priority),this.listeners.set(t,o)}addOnceListener(t,r,n=0,i){let a={callback:r,priority:n,once:!0,context:i},o=this.listeners.get(t)||[];o.push(a),o.sort((s,l)=>l.priority-s.priority),this.listeners.set(t,o)}removeListener(t,r){let n=this.listeners.get(t);n&&this.listeners.set(t,n.filter(i=>i.callback!==r))}async dispatchEvent(t,r){let n=this.listeners.get(t);if(n)for(let i of n){try{await i.callback.call(i.context,r)}catch(a){console.error(`Error in listener for event '${String(t)}':`,a)}i.once&&this.removeListener(t,i.callback)}}};var N1=class{constructor(){this.filesystems=[];this.filetypes=[];this.eventDispatch=new n0}static create(){return new N1}resolvePath(t,r){return this.primary.resolvePath(t,r)}keysForCacheType(t){return this.primary.keysForCacheType(t)}allTags(){return this.primary.readAllTags()}fileFragmentChanged(t){this.eventDispatch.dispatchEvent("onFileFragmentChanged",{file:t})}initiateFileSystemAdapter(t,r){t.initiate(this),r&&(this.primary=t),this.filesystems.push(t)}initiateFiletypeAdapter(t){t.initiate(this),this.filetypes.push(t)}filetypeAdaptersForFile(t){return t?this.filetypes.filter(r=>r.supportedFileTypes.includes(t.extension)):[]}filetypeAdaptersForFileFragments(t,r){return this.filetypeAdaptersForFile(t).filter(n=>n.contentTypes?n.contentTypes(t).includes(r):!1)}getFileCacheTypeByRefString(t,r){return this.filetypeAdaptersForFile(t).reduce((i,a)=>i||a.getCacheTypeByRefString(t,r),null)}allCaches(){return this.primary.cache}allFiles(){return this.primary.allFiles()}resourcePathForPath(t){return this.adapterForPath(t).resourcePathForPath(t)}parentPathForPath(t){return this.adapterForPath(t).parentPathForPath(t)}async createFileCache(t){let r=await this.getFile(t);for(let n of this.filetypeAdaptersForFile(r))n.parseCache&&await n.parseCache(r,!1)}getFileCache(t){return this.adapterForPath(t).getFileCache(t)}getFileContent(t,r,n){let i=this.filetypeAdaptersForFile(t).filter(a=>a.contentTypes(t).includes(r));if(i.length>=1)return i[0].readContent(t,r,n)}updateFileCache(t,r,n){this.adapterForPath(t).updateFileCache(t,r,n)}readFileFragments(t,r,n){let i=this.filetypeAdaptersForFileFragments(t,r);if(i.length>=1)return i[0].readContent(t,r,n)}async newFile(t,r,n,i){let a=this.filetypes.find(o=>o.supportedFileTypes.includes(n));if(a)return a.newFile(t,r,n,i)}newFileFragment(t,r,n,i,a){let o=this.filetypeAdaptersForFileFragments(t,r);if(o.length>=1)return o[0].newContent(t,r,n,i,a)}saveFileLabel(t,r,n){let i=this.filetypeAdaptersForFileFragments(t,"label");return i.length>=1?i[0].saveContent(t,"label",r,()=>n):this.primary.updateFileLabel(t.path,r,n)}saveFileFragment(t,r,n,i){let a=this.filetypeAdaptersForFileFragments(t,r);return a.length>=1?a[0].saveContent(t,r,n,i):!1}deleteFileFragment(t,r,n){let i=this.filetypeAdaptersForFileFragments(t,r);if(i.length>=1)return i[0].deleteContent(t,r,n)}onCreate(t){this.eventDispatch.dispatchEvent("onCreate",{file:t})}onModify(t){this.eventDispatch.dispatchEvent("onModify",{file:t})}onRename(t,r){this.eventDispatch.dispatchEvent("onRename",{file:t,oldPath:r})}onDelete(t){this.eventDispatch.dispatchEvent("onDelete",{file:t})}onSpaceUpdated(t,r){this.eventDispatch.dispatchEvent("onSpaceUpdated",{path:t,type:r})}onFocusesUpdated(){this.eventDispatch.dispatchEvent("onFocusesUpdated",null)}adapterForPath(t){return this.primary}async getRoot(){return this.adapterForPath().getRoot()}async copyFile(t,r,n){return this.adapterForPath(t).copyFile(t,r,n)}async writeTextToFile(t,r){return this.adapterForPath(t).writeTextToFile(t,r)}async readTextFromFile(t){return this.adapterForPath(t).readTextFromFile(t)}async writeBinaryToFile(t,r){return this.adapterForPath(t).writeBinaryToFile(t,r)}async readBinaryToFile(t){return this.adapterForPath(t).readBinaryToFile(t)}async renameFile(t,r){return this.adapterForPath(t).renameFile(t,r)}async createFolder(t){return this.adapterForPath(t).createFolder(t)}async childrenForFolder(t,r){return this.adapterForPath(t).childrenForFolder(t,r)}async fileExists(t){return this.adapterForPath(t).fileExists(t)}async getFile(t,r){return this.adapterForPath(t).getFile(t,r)}async deleteFile(t){return this.adapterForPath(t).deleteFile(t)}async addTagToFile(t,r){return this.adapterForPath(t).addTagToFile(t,r)}async renameTagForFile(t,r,n){return this.adapterForPath(t).renameTagForFile(t,r,n)}async removeTagFromFile(t,r){return this.adapterForPath(t).removeTagFromFile(t,r)}filesForTag(t){return this.primary.filesForTag(t)}};var T1=(e,t)=>{if(!e)return"";let r=t.spaceManager.uriByString(e);if(r.refType){if(r.refType=="context"){let n=t.contextsIndex.get(r.basePath)?.schemas.find(a=>a.id==r.ref),i=t.spacesIndex.get(r.basePath);return n&&i?`${i.name} / ${n.name}`:""}return r.refType=="action"?t.actionsIndex.get(r.basePath)?.find(n=>n.schema.id==r.ref)?.schema.name:r.ref}return t.pathsIndex.get(r.basePath)?.name||e},i0=e=>AM(e.substring(e.lastIndexOf("/")))||e,ZJ=e=>{let t=[],r=e.split("/"),n="";for(let i=0;ie.lastIndexOf("/")!=-1?e.lastIndexOf(".")!=-1?AM(e.substring(e.lastIndexOf("/")+1,e.lastIndexOf("."))):e.substring(e.lastIndexOf("/")+1):e.lastIndexOf(".")!=-1?e.substring(0,e.lastIndexOf(".")):e,Lx=e=>e.substring(0,e.lastIndexOf("."))||e,Fu=e=>{let t=e.lastIndexOf("/");return t==-1?"/":e.substring(0,t+1)};var kq=async(e,t,r)=>{let n=H4e(e,t),i=zx(Cq(r)),a=e.spaceManager.pathsForTag(t);for(let o of a)e.spaceManager.renameTag(o,t,i);await JJ(e,t,i);for(let o of n)await kq(e,o,o.replace(t,i));return i},XJ=e=>{e.startsWith("#")&&(e=e.slice(1));let t=e.split("/"),r=[];for(let n=0;ne.trim(),H4e=(e,t)=>e.spaceManager.readTags().filter(n=>n.startsWith(t)&&n!=t),KJ=e=>KE(zx(e)),jM=e=>rf(e).replace(/\+/g,"/"),zx=e=>{if(!e)return null;let t=e;return t.charAt(0)!="#"&&(t="#"+t),t.toLowerCase()},hl=e=>e.charAt(0)=="#"?e.charAt(1)=="#"?e.substring(2,e.length):e.substring(1,e.length):e;var Ux=async(e,t,r)=>{if(e.spacesIndex.has(t)){let n=e.spacesIndex.get(t);return n.type=="tag"?kq(e,n.name,r):e.spaceManager.renameSpace(t,vJ(t,r))}else return e.spaceManager.renamePath(t,yJ(t,r))},NM=async(e,t)=>{e.settings.hiddenFiles=kr([...e.settings.hiddenFiles,t]),e.ui.notify("Item is now hidden in the Navigator, you can manage hidden items in the Navigator menu."),e.saveSettings(),e.reloadPath(t,!0).then(r=>e.dispatchEvent("superstateUpdated",null))},eee=async(e,t)=>{e.settings.hiddenFiles=kr([...e.settings.hiddenFiles,...t]),e.saveSettings(),Promise.all(t.map(r=>{e.reloadPath(r,!0)})).then(r=>e.dispatchEvent("superstateUpdated",null))},F1=async(e,t)=>{e.spaceManager.deletePath(t),e.onPathDeleted(t)},tee=async(e,t,r)=>e.spaceManager.renamePath(t,Mm(t,r)),TM=async(e,t,r)=>{let n=e.pathsIndex.get(t);if(!n)return;let i=n.parent+"/"+n.name;await e.spaceManager.createSpace(n.name,n.parent,{}),await e.spaceManager.renamePath(t,i+"/"+n.metadata?.file?.name+".md"),e.ui.viewsByPath(t).forEach(a=>{a.openPath(i)}),r&&e.ui.openPath(i,!1)};var ree=(e,t)=>t?e.spacesIndex.has(t):!1,nf=(e,t)=>t.superstate.settings.spacesMDBInHidden?e=="/"?t.superstate.settings.spaceSubFolder+"/":e+t.superstate.settings.spaceSubFolder+"/":e;var FM=(e,t)=>t.spacesFolder+"/"+e;var zee=Ae(yi());var Zx=Ae(yi());var fk=["MO","TU","WE","TH","FR","SA","SU"],Ho=function(){function e(t,r){if(r===0)throw new Error("Can't create weekday with n == 0");this.weekday=t,this.n=r}return e.fromStr=function(t){return new e(fk.indexOf(t))},e.prototype.nth=function(t){return this.n===t?this:new e(this.weekday,t)},e.prototype.equals=function(t){return this.weekday===t.weekday&&this.n===t.n},e.prototype.toString=function(){var t=fk[this.weekday];return this.n&&(t=(this.n>0?"+":"")+String(this.n)+t),t},e.prototype.getJsWeekday=function(){return this.weekday===6?0:this.weekday+1},e}();var ua=function(e){return e!=null},af=function(e){return typeof e=="number"},Dq=function(e){return typeof e=="string"&&fk.includes(e)},Al=Array.isArray,ld=function(e,t){t===void 0&&(t=e),arguments.length===1&&(t=e,e=0);for(var r=[],n=e;n>0,n.length>t?String(n):(t=t-n.length,t>r.length&&(r+=jn(r,t/r.length)),r.slice(0,t)+String(n))}var iee=function(e,t,r){var n=e.split(t);return r?n.slice(0,r).concat([n.slice(r).join(t)]):n},Ql=function(e,t){var r=e%t;return r*t<0?r+t:r},_M=function(e,t){return{div:Math.floor(e/t),mod:Ql(e,t)}},of=function(e){return!ua(e)||e.length===0},Oo=function(e){return!of(e)},Bn=function(e,t){return Oo(e)&&e.indexOf(t)!==-1};var Nm=function(e,t,r,n,i,a){return n===void 0&&(n=0),i===void 0&&(i=0),a===void 0&&(a=0),new Date(Date.UTC(e,t-1,r,n,i,a))},V4e=[31,28,31,30,31,30,31,31,30,31,30,31],oee=1e3*60*60*24,PM=9999,see=Nm(1970,1,1),G4e=[6,0,1,2,3,4,5];var Hx=function(e){return e%4===0&&e%100!==0||e%400===0},Oq=function(e){return e instanceof Date},P1=function(e){return Oq(e)&&!isNaN(e.getTime())};var Q4e=function(e,t){var r=e.getTime(),n=t.getTime(),i=r-n;return Math.round(i/oee)},dk=function(e){return Q4e(e,see)},IM=function(e){return new Date(see.getTime()+e*oee)},Y4e=function(e){var t=e.getUTCMonth();return t===1&&Hx(e.getUTCFullYear())?29:V4e[t]},bA=function(e){return G4e[e.getUTCDay()]},Mq=function(e,t){var r=Nm(e,t+1,1);return[bA(r),Y4e(r)]},BM=function(e,t){return t=t||e,new Date(Date.UTC(e.getUTCFullYear(),e.getUTCMonth(),e.getUTCDate(),t.getHours(),t.getMinutes(),t.getSeconds(),t.getMilliseconds()))},RM=function(e){var t=new Date(e.getTime());return t},jq=function(e){for(var t=[],r=0;rthis.maxDate;if(this.method==="between"){if(r)return!0;if(n)return!1}else if(this.method==="before"){if(n)return!1}else if(this.method==="after")return r?!0:(this.add(t),!1);return this.add(t)},e.prototype.add=function(t){return this._result.push(t),!0},e.prototype.getValue=function(){var t=this._result;switch(this.method){case"all":case"between":return t;case"before":case"after":default:return t.length?t[t.length-1]:null}},e.prototype.clone=function(){return new e(this.method,this.args)},e}(),wA=Z4e;var Nq=function(e,t){return Nq=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,n){r.__proto__=n}||function(r,n){for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(r[i]=n[i])},Nq(e,t)};function Gx(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");Nq(e,t);function r(){this.constructor=e}e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}var ji=function(){return ji=Object.assign||function(t){for(var r,n=1,i=arguments.length;n0&&a[a.length-1])&&(u[0]===6||u[0]===2)){r=0;continue}if(u[0]===3&&(!a||u[1]>a[0]&&u[1]0)&&!(i=n.next()).done;)a.push(i.value)}catch(s){o={error:s}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(o)throw o.error}}return a}function kt(e,t,r){if(r||arguments.length===2)for(var n=0,i=t.length,a;nt[0].length)&&(t=a,r=i)}if(t!=null&&(this.text=this.text.substr(t[0].length),this.text===""&&(this.done=!0)),t==null){this.done=!0,this.symbol=null,this.value=null;return}}while(r==="SKIP");return this.symbol=r,this.value=t,!0},e.prototype.accept=function(t){if(this.symbol===t){if(this.value){var r=this.value;return this.nextSymbol(),r}return this.nextSymbol(),!0}return!1},e.prototype.acceptNumber=function(){return this.accept("number")},e.prototype.expect=function(t){if(this.accept(t))return!0;throw new Error("expected "+t+" but found "+this.symbol)},e}();function mk(e,t){t===void 0&&(t=R1);var r={},n=new rPe(t.tokens);if(!n.start(e))return null;return i(),r;function i(){n.expect("every");var d=n.acceptNumber();if(d&&(r.interval=parseInt(d[0],10)),n.isDone())throw new Error("Unexpected end");switch(n.symbol){case"day(s)":r.freq=Wt.DAILY,n.nextSymbol()&&(o(),f());break;case"weekday(s)":r.freq=Wt.WEEKLY,r.byweekday=[Wt.MO,Wt.TU,Wt.WE,Wt.TH,Wt.FR],n.nextSymbol(),o(),f();break;case"week(s)":r.freq=Wt.WEEKLY,n.nextSymbol()&&(a(),o(),f());break;case"hour(s)":r.freq=Wt.HOURLY,n.nextSymbol()&&(a(),f());break;case"minute(s)":r.freq=Wt.MINUTELY,n.nextSymbol()&&(a(),f());break;case"month(s)":r.freq=Wt.MONTHLY,n.nextSymbol()&&(a(),f());break;case"year(s)":r.freq=Wt.YEARLY,n.nextSymbol()&&(a(),f());break;case"monday":case"tuesday":case"wednesday":case"thursday":case"friday":case"saturday":case"sunday":r.freq=Wt.WEEKLY;var p=n.symbol.substr(0,2).toUpperCase();if(r.byweekday=[Wt[p]],!n.nextSymbol())return;for(;n.accept("comma");){if(n.isDone())throw new Error("Unexpected end");var h=l();if(!h)throw new Error("Unexpected symbol "+n.symbol+", expected weekday");r.byweekday.push(Wt[h]),n.nextSymbol()}o(),c(),f();break;case"january":case"february":case"march":case"april":case"may":case"june":case"july":case"august":case"september":case"october":case"november":case"december":if(r.freq=Wt.YEARLY,r.bymonth=[s()],!n.nextSymbol())return;for(;n.accept("comma");){if(n.isDone())throw new Error("Unexpected end");var m=s();if(!m)throw new Error("Unexpected symbol "+n.symbol+", expected month");r.bymonth.push(m),n.nextSymbol()}a(),f();break;default:throw new Error("Unknown symbol")}}function a(){var d=n.accept("on"),p=n.accept("the");if(!!(d||p))do{var h=u(),m=l(),g=s();if(h)m?(n.nextSymbol(),r.byweekday||(r.byweekday=[]),r.byweekday.push(Wt[m].nth(h))):(r.bymonthday||(r.bymonthday=[]),r.bymonthday.push(h),n.accept("day(s)"));else if(m)n.nextSymbol(),r.byweekday||(r.byweekday=[]),r.byweekday.push(Wt[m]);else if(n.symbol==="weekday(s)")n.nextSymbol(),r.byweekday||(r.byweekday=[Wt.MO,Wt.TU,Wt.WE,Wt.TH,Wt.FR]);else if(n.symbol==="week(s)"){n.nextSymbol();var A=n.acceptNumber();if(!A)throw new Error("Unexpected symbol "+n.symbol+", expected week number");for(r.byweekno=[parseInt(A[0],10)];n.accept("comma");){if(A=n.acceptNumber(),!A)throw new Error("Unexpected symbol "+n.symbol+"; expected monthday");r.byweekno.push(parseInt(A[0],10))}}else if(g)n.nextSymbol(),r.bymonth||(r.bymonth=[]),r.bymonth.push(g);else return}while(n.accept("comma")||n.accept("the")||n.accept("on"))}function o(){var d=n.accept("at");if(!!d)do{var p=n.acceptNumber();if(!p)throw new Error("Unexpected symbol "+n.symbol+", expected hour");for(r.byhour=[parseInt(p[0],10)];n.accept("comma");){if(p=n.acceptNumber(),!p)throw new Error("Unexpected symbol "+n.symbol+"; expected hour");r.byhour.push(parseInt(p[0],10))}}while(n.accept("comma")||n.accept("at"))}function s(){switch(n.symbol){case"january":return 1;case"february":return 2;case"march":return 3;case"april":return 4;case"may":return 5;case"june":return 6;case"july":return 7;case"august":return 8;case"september":return 9;case"october":return 10;case"november":return 11;case"december":return 12;default:return!1}}function l(){switch(n.symbol){case"monday":case"tuesday":case"wednesday":case"thursday":case"friday":case"saturday":case"sunday":return n.symbol.substr(0,2).toUpperCase();default:return!1}}function u(){switch(n.symbol){case"last":return n.nextSymbol(),-1;case"first":return n.nextSymbol(),1;case"second":return n.nextSymbol(),n.accept("last")?-2:2;case"third":return n.nextSymbol(),n.accept("last")?-3:3;case"nth":var d=parseInt(n.value[1],10);if(d<-366||d>366)throw new Error("Nth out of range: "+d);return n.nextSymbol(),n.accept("last")?-d:d;default:return!1}}function c(){n.accept("on"),n.accept("the");var d=u();if(!!d)for(r.bymonthday=[d],n.nextSymbol();n.accept("comma");){if(d=u(),!d)throw new Error("Unexpected symbol "+n.symbol+"; expected monthday");r.bymonthday.push(d),n.nextSymbol()}}function f(){if(n.symbol==="until"){var d=Date.parse(n.text);if(!d)throw new Error("Cannot parse until date:"+n.text);r.until=new Date(d)}else n.accept("for")&&(r.count=parseInt(n.value[0],10),n.expect("number"))}}var pn;(function(e){e[e.YEARLY=0]="YEARLY",e[e.MONTHLY=1]="MONTHLY",e[e.WEEKLY=2]="WEEKLY",e[e.DAILY=3]="DAILY",e[e.HOURLY=4]="HOURLY",e[e.MINUTELY=5]="MINUTELY",e[e.SECONDLY=6]="SECONDLY"})(pn||(pn={}));function hk(e){return e12){var n=Math.floor(this.month/12),i=Ql(this.month,12);this.month=i,this.year+=n,this.month===0&&(this.month=12,--this.year)}},t.prototype.addWeekly=function(r,n){n>this.getWeekday()?this.day+=-(this.getWeekday()+1+(6-n))+r*7:this.day+=-(this.getWeekday()-n)+r*7,this.fixDay()},t.prototype.addDaily=function(r){this.day+=r,this.fixDay()},t.prototype.addHours=function(r,n,i){for(n&&(this.hour+=Math.floor((23-this.hour)/r)*r);;){this.hour+=r;var a=_M(this.hour,24),o=a.div,s=a.mod;if(o&&(this.hour=s,this.addDaily(o)),of(i)||Bn(i,this.hour))break}},t.prototype.addMinutes=function(r,n,i,a){for(n&&(this.minute+=Math.floor((1439-(this.hour*60+this.minute))/r)*r);;){this.minute+=r;var o=_M(this.minute,60),s=o.div,l=o.mod;if(s&&(this.minute=l,this.addHours(s,!1,i)),(of(i)||Bn(i,this.hour))&&(of(a)||Bn(a,this.minute)))break}},t.prototype.addSeconds=function(r,n,i,a,o){for(n&&(this.second+=Math.floor((86399-(this.hour*3600+this.minute*60+this.second))/r)*r);;){this.second+=r;var s=_M(this.second,60),l=s.div,u=s.mod;if(l&&(this.second=u,this.addMinutes(l,!1,i,a)),(of(i)||Bn(i,this.hour))&&(of(a)||Bn(a,this.minute))&&(of(o)||Bn(o,this.second)))break}},t.prototype.fixDay=function(){if(!(this.day<=28)){var r=Mq(this.year,this.month-1)[1];if(!(this.day<=r))for(;this.day>r;){if(this.day-=r,++this.month,this.month===13&&(this.month=1,++this.year,this.year>PM))return;r=Mq(this.year,this.month-1)[1]}}},t.prototype.add=function(r,n){var i=r.freq,a=r.interval,o=r.wkst,s=r.byhour,l=r.byminute,u=r.bysecond;switch(i){case pn.YEARLY:return this.addYears(a);case pn.MONTHLY:return this.addMonths(a);case pn.WEEKLY:return this.addWeekly(a,o);case pn.DAILY:return this.addDaily(a);case pn.HOURLY:return this.addHours(a,n,s);case pn.MINUTELY:return this.addMinutes(a,n,s,l);case pn.SECONDLY:return this.addSeconds(a,n,s,l,u)}},t}(Yx);function _q(e){for(var t=[],r=Object.keys(e),n=0,i=r;n=-366&&n<=366))throw new Error("bysetpos must be between 1 and 366, or between -366 and -1")}}if(!(Boolean(t.byweekno)||Oo(t.byweekno)||Oo(t.byyearday)||Boolean(t.bymonthday)||Oo(t.bymonthday)||ua(t.byweekday)||ua(t.byeaster)))switch(t.freq){case Wt.YEARLY:t.bymonth||(t.bymonth=t.dtstart.getUTCMonth()+1),t.bymonthday=t.dtstart.getUTCDate();break;case Wt.MONTHLY:t.bymonthday=t.dtstart.getUTCDate();break;case Wt.WEEKLY:t.byweekday=[bA(t.dtstart)];break}if(ua(t.bymonth)&&!Al(t.bymonth)&&(t.bymonth=[t.bymonth]),ua(t.byyearday)&&!Al(t.byyearday)&&af(t.byyearday)&&(t.byyearday=[t.byyearday]),!ua(t.bymonthday))t.bymonthday=[],t.bynmonthday=[];else if(Al(t.bymonthday)){for(var i=[],a=[],r=0;r0?i.push(n):n<0&&a.push(n)}t.bymonthday=i,t.bynmonthday=a}else t.bymonthday<0?(t.bynmonthday=[t.bymonthday],t.bymonthday=[]):(t.bynmonthday=[],t.bymonthday=[t.bymonthday]);if(ua(t.byweekno)&&!Al(t.byweekno)&&(t.byweekno=[t.byweekno]),!ua(t.byweekday))t.bynweekday=null;else if(af(t.byweekday))t.byweekday=[t.byweekday],t.bynweekday=null;else if(Dq(t.byweekday))t.byweekday=[Ho.fromStr(t.byweekday).weekday],t.bynweekday=null;else if(t.byweekday instanceof Ho)!t.byweekday.n||t.freq>Wt.MONTHLY?(t.byweekday=[t.byweekday.weekday],t.bynweekday=null):(t.bynweekday=[[t.byweekday.weekday,t.byweekday.n]],t.byweekday=null);else{for(var o=[],s=[],r=0;rWt.MONTHLY?o.push(l.weekday):s.push([l.weekday,l.n])}t.byweekday=Oo(o)?o:null,t.bynweekday=Oo(s)?s:null}return ua(t.byhour)?af(t.byhour)&&(t.byhour=[t.byhour]):t.byhour=t.freq=K||(K=Math.max(K,se*(1048576>se?2:1.125)>>>0),se!=0&&(K=Math.max(K,256)),se=W.Ia,W.Ia=new Uint8Array(K),0=W.node.Ma)return 0;if(W=Math.min(W.node.Ma-je,xe),8K)throw new De(28);return K},lb:function(W,K,se){He.qb(W.node,K+se),W.node.Ma=Math.max(W.node.Ma,K+se)},bb:function(W,K,se,xe,je){if((W.node.mode&61440)!==32768)throw new De(43);if(W=W.node.Ia,je&2||W.buffer!==P){if((0{if(W=Ye("/",W),!W)return{path:"",node:null};if(K=Object.assign({rb:!0,kb:0},K),8!!ot),!1);for(var se=Qe,xe="/",je=0;je{for(var K;;){if(W===W.parent)return W=W.Ra.ub,K?W[W.length-1]!=="/"?W+"/"+K:W+K:W;K=K?W.name+"/"+K:W.name,W=W.parent}},Wr=(W,K)=>{for(var se=0,xe=0;xe>>0)%ue.length},en=W=>{var K=Wr(W.parent.id,W.name);if(ue[K]===W)ue[K]=W.Wa;else for(K=ue[K];K;){if(K.Wa===W){K.Wa=W.Wa;break}K=K.Wa}},tn=(W,K)=>{var se;if(se=(se=Pa(W,"x"))?se:W.Ga.lookup?0:2)throw new De(se,W);for(se=ue[Wr(W.id,K)];se;se=se.Wa){var xe=se.name;if(se.parent.id===W.id&&xe===K)return se}return W.Ga.lookup(W,K)},ci=(W,K,se,xe)=>(W=new zb(W,K,se,xe),K=Wr(W.parent.id,W.name),W.Wa=ue[K],ue[K]=W),ns={r:0,"r+":2,w:577,"w+":578,a:1089,"a+":1090},Qi=W=>{var K=["r","w","rw"][W&3];return W&512&&(K+="w"),K},Pa=(W,K)=>{if(Pe)return 0;if(!K.includes("r")||W.mode&292){if(K.includes("w")&&!(W.mode&146)||K.includes("x")&&!(W.mode&73))return 2}else return 2;return 0},Dt=(W,K)=>{try{return tn(W,K),20}catch{}return Pa(W,"wx")},Hc=(W,K,se)=>{try{var xe=tn(W,K)}catch(je){return je.Ka}if(W=Pa(W,"wx"))return W;if(se){if((xe.mode&61440)!==16384)return 54;if(xe===xe.parent||Zt(xe)==="/")return 10}else if((xe.mode&61440)===16384)return 31;return 0},Wf=(W=0)=>{for(;4096>=W;W++)if(!Ge[W])return W;throw new De(33)},Va=(W,K)=>(sl||(sl=function(){this.$a={}},sl.prototype={},Object.defineProperties(sl.prototype,{object:{get:function(){return this.node},set:function(se){this.node=se}},flags:{get:function(){return this.$a.flags},set:function(se){this.$a.flags=se}},position:{get:function(){return this.$a.position},set:function(se){this.$a.position=se}}})),W=Object.assign(new sl,W),K=Wf(K),W.fd=K,Ge[K]=W),Eu={open:W=>{W.Ha=et[W.node.rdev].Ha,W.Ha.open&&W.Ha.open(W)},Ta:()=>{throw new De(70)}},Yr=(W,K)=>{et[W]={Ha:K}},Ul=(W,K)=>{var se=K==="/",xe=!K;if(se&&Qe)throw new De(10);if(!se&&!xe){var je=ht(K,{rb:!1});if(K=je.path,je=je.node,je.Va)throw new De(10);if((je.mode&61440)!==16384)throw new De(54)}K={type:W,Kb:{},ub:K,Eb:[]},W=W.Ra(K),W.Ra=K,K.root=W,se?Qe=W:je&&(je.Va=K,je.Ra&&je.Ra.Eb.push(K))},gm=(W,K,se)=>{var xe=ht(W,{parent:!0}).node;if(W=he(W),!W||W==="."||W==="..")throw new De(28);var je=Dt(xe,W);if(je)throw new De(je);if(!xe.Ga.ab)throw new De(63);return xe.Ga.ab(xe,W,K,se)},fi=(W,K)=>gm(W,(K!==void 0?K:511)&1023|16384,0),is=(W,K,se)=>{typeof se>"u"&&(se=K,K=438),gm(W,K|8192,se)},Ts=(W,K)=>{if(!Ye(W))throw new De(44);var se=ht(K,{parent:!0}).node;if(!se)throw new De(44);K=he(K);var xe=Dt(se,K);if(xe)throw new De(xe);if(!se.Ga.symlink)throw new De(63);se.Ga.symlink(se,K,W)},ia=W=>{var K=ht(W,{parent:!0}).node;W=he(W);var se=tn(K,W),xe=Hc(K,W,!0);if(xe)throw new De(xe);if(!K.Ga.rmdir)throw new De(63);if(se.Va)throw new De(10);K.Ga.rmdir(K,W),en(se)},Fs=W=>{var K=ht(W,{parent:!0}).node;if(!K)throw new De(44);W=he(W);var se=tn(K,W),xe=Hc(K,W,!1);if(xe)throw new De(xe);if(!K.Ga.unlink)throw new De(63);if(se.Va)throw new De(10);K.Ga.unlink(K,W),en(se)},Wl=W=>{if(W=ht(W).node,!W)throw new De(44);if(!W.Ga.readlink)throw new De(28);return Ye(Zt(W.parent),W.Ga.readlink(W))},ol=(W,K)=>{if(W=ht(W,{Sa:!K}).node,!W)throw new De(44);if(!W.Ga.Pa)throw new De(63);return W.Ga.Pa(W)},kg=W=>ol(W,!0),Vc=(W,K)=>{if(W=typeof W=="string"?ht(W,{Sa:!0}).node:W,!W.Ga.Oa)throw new De(63);W.Ga.Oa(W,{mode:K&4095|W.mode&-4096,timestamp:Date.now()})},Cg=(W,K)=>{if(0>K)throw new De(28);if(W=typeof W=="string"?ht(W,{Sa:!0}).node:W,!W.Ga.Oa)throw new De(63);if((W.mode&61440)===16384)throw new De(31);if((W.mode&61440)!==32768)throw new De(28);var se=Pa(W,"w");if(se)throw new De(se);W.Ga.Oa(W,{size:K,timestamp:Date.now()})},_n=(W,K,se)=>{if(W==="")throw new De(44);if(typeof K=="string"){var xe=ns[K];if(typeof xe>"u")throw Error("Unknown file open mode: "+K);K=xe}if(se=K&64?(typeof se>"u"?438:se)&4095|32768:0,typeof W=="object")var je=W;else{W=Ce(W);try{je=ht(W,{Sa:!(K&131072)}).node}catch{}}if(xe=!1,K&64)if(je){if(K&128)throw new De(20)}else je=gm(W,se,0),xe=!0;if(!je)throw new De(44);if((je.mode&61440)===8192&&(K&=-513),K&65536&&(je.mode&61440)!==16384)throw new De(54);if(!xe&&(se=je?(je.mode&61440)===40960?32:(je.mode&61440)===16384&&(Qi(K)!=="r"||K&512)?31:Pa(je,Qi(K)):44))throw new De(se);return K&512&&!xe&&Cg(je,0),K&=-131713,je=Va({node:je,path:Zt(je),flags:K,seekable:!0,position:0,Ha:je.Ha,Ib:[],error:!1}),je.Ha.open&&je.Ha.open(je),!a.logReadFiles||K&1||(sp||(sp={}),W in sp||(sp[W]=1)),je},Hf=W=>{if(W.fd===null)throw new De(8);W.hb&&(W.hb=null);try{W.Ha.close&&W.Ha.close(W)}catch(K){throw K}finally{Ge[W.fd]=null}W.fd=null},Dg=(W,K,se)=>{if(W.fd===null)throw new De(8);if(!W.seekable||!W.Ha.Ta)throw new De(70);if(se!=0&&se!=1&&se!=2)throw new De(28);W.position=W.Ha.Ta(W,K,se),W.Ib=[]},Vh=(W,K,se,xe,je)=>{if(0>xe||0>je)throw new De(28);if(W.fd===null)throw new De(8);if((W.flags&2097155)===1)throw new De(8);if((W.node.mode&61440)===16384)throw new De(31);if(!W.Ha.read)throw new De(28);var Ke=typeof je<"u";if(!Ke)je=W.position;else if(!W.seekable)throw new De(70);return K=W.Ha.read(W,K,se,xe,je),Ke||(W.position+=K),K},vm=(W,K,se,xe,je)=>{if(0>xe||0>je)throw new De(28);if(W.fd===null)throw new De(8);if((W.flags&2097155)===0)throw new De(8);if((W.node.mode&61440)===16384)throw new De(31);if(!W.Ha.write)throw new De(28);W.seekable&&W.flags&1024&&Dg(W,0,2);var Ke=typeof je<"u";if(!Ke)je=W.position;else if(!W.seekable)throw new De(70);return K=W.Ha.write(W,K,se,xe,je,void 0),Ke||(W.position+=K),K},Og=W=>{var K="binary";if(K!=="utf8"&&K!=="binary")throw Error('Invalid encoding type "'+K+'"');var se,xe=_n(W,xe||0);W=ol(W).size;var je=new Uint8Array(W);return Vh(xe,je,0,W,0),K==="utf8"?se=O(je,0):K==="binary"&&(se=je),Hf(xe),se},Gh=()=>{De||(De=function(W,K){this.node=K,this.Hb=function(se){this.Ka=se},this.Hb(W),this.message="FS error"},De.prototype=Error(),De.prototype.constructor=De,[44].forEach(W=>{at[W]=new De(W),at[W].stack=""}))},Vf,kn=(W,K)=>{var se=0;return W&&(se|=365),K&&(se|=146),se},Ia=(W,K,se)=>{W=Ce("/dev/"+W);var xe=kn(!!K,!!se);Qh||(Qh=64);var je=Qh++<<8|0;Yr(je,{open:Ke=>{Ke.seekable=!1},close:()=>{se&&se.buffer&&se.buffer.length&&se(10)},read:(Ke,ot,xr,Pn)=>{for(var sn=0,aa=0;aa{for(var sn=0;sn>2]=xe.dev,T[se+8>>2]=xe.ino,T[se+12>>2]=xe.mode,L[se+16>>2]=xe.nlink,T[se+20>>2]=xe.uid,T[se+24>>2]=xe.gid,T[se+28>>2]=xe.rdev,J=[xe.size>>>0,(R=xe.size,1<=+Math.abs(R)?0>>0:~~+Math.ceil((R-+(~~R>>>0))/4294967296)>>>0:0)],T[se+40>>2]=J[0],T[se+44>>2]=J[1],T[se+48>>2]=4096,T[se+52>>2]=xe.blocks,J=[Math.floor(xe.atime.getTime()/1e3)>>>0,(R=Math.floor(xe.atime.getTime()/1e3),1<=+Math.abs(R)?0>>0:~~+Math.ceil((R-+(~~R>>>0))/4294967296)>>>0:0)],T[se+56>>2]=J[0],T[se+60>>2]=J[1],L[se+64>>2]=0,J=[Math.floor(xe.mtime.getTime()/1e3)>>>0,(R=Math.floor(xe.mtime.getTime()/1e3),1<=+Math.abs(R)?0>>0:~~+Math.ceil((R-+(~~R>>>0))/4294967296)>>>0:0)],T[se+72>>2]=J[0],T[se+76>>2]=J[1],L[se+80>>2]=0,J=[Math.floor(xe.ctime.getTime()/1e3)>>>0,(R=Math.floor(xe.ctime.getTime()/1e3),1<=+Math.abs(R)?0>>0:~~+Math.ceil((R-+(~~R>>>0))/4294967296)>>>0:0)],T[se+88>>2]=J[0],T[se+92>>2]=J[1],L[se+96>>2]=0,J=[xe.ino>>>0,(R=xe.ino,1<=+Math.abs(R)?0>>0:~~+Math.ceil((R-+(~~R>>>0))/4294967296)>>>0:0)],T[se+104>>2]=J[0],T[se+108>>2]=J[1],0}var ym=void 0;function ku(){return ym+=4,T[ym-4>>2]}function ll(W){if(W=Ge[W],!W)throw new De(8);return W}function r1(W){return L[W>>2]+4294967296*T[W+4>>2]}function n1(W){var K=D(W)+1,se=Xh(K);return se&&N(W,q,se,K),se}function bm(W,K,se){function xe(Pn){return(Pn=Pn.toTimeString().match(/\(([A-Za-z ]+)\)$/))?Pn[1]:"GMT"}var je=new Date().getFullYear(),Ke=new Date(je,0,1),ot=new Date(je,6,1);je=Ke.getTimezoneOffset();var xr=ot.getTimezoneOffset();T[W>>2]=60*Math.max(je,xr),T[K>>2]=Number(je!=xr),W=xe(Ke),K=xe(ot),W=n1(W),K=n1(K),xr>2]=W,L[se+4>>2]=K):(L[se>>2]=K,L[se+4>>2]=W)}function Gf(W,K,se){Gf.Bb||(Gf.Bb=!0,bm(W,K,se))}var i1;i1=c?()=>{var W=process.hrtime();return 1e3*W[0]+W[1]/1e6}:()=>performance.now();var Qf={};function Hl(){if(!Yh){var W={USER:"web_user",LOGNAME:"web_user",PATH:"/",PWD:"/",HOME:"/home/web_user",LANG:(typeof navigator=="object"&&navigator.languages&&navigator.languages[0]||"C").replace("-","_")+".UTF-8",_:s||"./this.program"},K;for(K in Qf)Qf[K]===void 0?delete W[K]:W[K]=Qf[K];var se=[];for(K in W)se.push(K+"="+W[K]);Yh=se}return Yh}var Yh,ul=void 0,jg=[];function Ng(W,K){if(!ul){ul=new WeakMap;var se=te.length;if(ul)for(var xe=0;xe<0+se;xe++){var je=te.get(xe);je&&ul.set(je,xe)}}if(ul.has(W))return ul.get(W);if(jg.length)se=jg.pop();else{try{te.grow(1)}catch(xr){throw xr instanceof RangeError?"Unable to grow wasm table. Set ALLOW_TABLE_GROWTH.":xr}se=te.length-1}try{te.set(se,W)}catch(xr){if(!(xr instanceof TypeError))throw xr;if(typeof WebAssembly.Function=="function"){xe=WebAssembly.Function,je={i:"i32",j:"i64",f:"f32",d:"f64",p:"i32"};for(var Ke={parameters:[],results:K[0]=="v"?[]:[je[K[0]]]},ot=1;otot?xe.push(ot):xe.push(ot%128|128,ot>>7),ot=0;otje?K.push(je):K.push(je%128|128,je>>7),K.push.apply(K,xe),K.push(2,7,1,1,101,1,102,0,0,7,5,1,1,102,0,0),K=new WebAssembly.Module(new Uint8Array(K)),K=new WebAssembly.Instance(K,{e:{f:W}}).exports.f}te.set(se,K)}return ul.set(W,se),se}function Zh(W){ul.delete(te.get(W)),jg.push(W)}var qb=0,Lb=1;function Tg(W){var K=qb==Lb?Cu(W.length):Xh(W.length);return W.subarray||W.slice||(W=new Uint8Array(W)),z.set(W,K),K}function Fg(W,K,se,xe){var je={string:sn=>{var aa=0;if(sn!=null&&sn!==0){var Ju=(sn.length<<2)+1;aa=Cu(Ju),N(sn,z,aa,Ju)}return aa},array:sn=>{var aa=Cu(sn.length);return q.set(sn,aa),aa}};W=a["_"+W];var Ke=[],ot=0;if(xe)for(var xr=0;xr{fi("/dev"),Yr(259,{read:()=>0,write:(K,se,xe,je)=>je}),is("/dev/null",259),we(1280,Le),we(1536,Ze),is("/dev/tty",1280),is("/dev/tty1",1536);var W=ze();Ia("random",W),Ia("urandom",W),fi("/dev/shm"),fi("/dev/shm/tmp")})(),(()=>{fi("/proc");var W=fi("/proc/self");fi("/proc/self/fd"),Ul({Ra:()=>{var K=ci(W,"fd",16895,73);return K.Ga={lookup:(se,xe)=>{var je=Ge[+xe];if(!je)throw new De(8);return se={parent:null,Ra:{ub:"fake"},Ga:{readlink:()=>je.path}},se.parent=se}},K}},"/proc/self/fd")})();var Ub={a:function(W,K,se,xe){me("Assertion failed: "+C(W)+", at: "+[K?C(K):"unknown filename",se,xe?C(xe):"unknown function"])},h:function(W,K){try{return W=C(W),Vc(W,K),0}catch(se){if(typeof Cn>"u"||!(se instanceof De))throw se;return-se.Ka}},H:function(W,K,se){try{if(K=C(K),K=Gc(W,K),se&-8)return-28;var xe=ht(K,{Sa:!0}).node;return xe?(W="",se&4&&(W+="r"),se&2&&(W+="w"),se&1&&(W+="x"),W&&Pa(xe,W)?-2:0):-44}catch(je){if(typeof Cn>"u"||!(je instanceof De))throw je;return-je.Ka}},i:function(W,K){try{var se=Ge[W];if(!se)throw new De(8);return Vc(se.node,K),0}catch(xe){if(typeof Cn>"u"||!(xe instanceof De))throw xe;return-xe.Ka}},g:function(W){try{var K=Ge[W];if(!K)throw new De(8);var se=K.node,xe=typeof se=="string"?ht(se,{Sa:!0}).node:se;if(!xe.Ga.Oa)throw new De(63);return xe.Ga.Oa(xe,{timestamp:Date.now()}),0}catch(je){if(typeof Cn>"u"||!(je instanceof De))throw je;return-je.Ka}},b:function(W,K,se){ym=se;try{var xe=ll(W);switch(K){case 0:var je=ku();return 0>je?-28:Va(xe,je).fd;case 1:case 2:return 0;case 3:return xe.flags;case 4:return je=ku(),xe.flags|=je,0;case 5:return je=ku(),I[je+0>>1]=2,0;case 6:case 7:return 0;case 16:case 8:return-28;case 9:return T[Wb()>>2]=28,-1;default:return-28}}catch(Ke){if(typeof Cn>"u"||!(Ke instanceof De))throw Ke;return-Ke.Ka}},G:function(W,K){try{var se=ll(W);return Mg(ol,se.path,K)}catch(xe){if(typeof Cn>"u"||!(xe instanceof De))throw xe;return-xe.Ka}},l:function(W,K,se){try{if(K=se+2097152>>>0<4194305-!!K?(K>>>0)+4294967296*se:NaN,isNaN(K))return-61;var xe=Ge[W];if(!xe)throw new De(8);if((xe.flags&2097155)===0)throw new De(28);return Cg(xe.node,K),0}catch(je){if(typeof Cn>"u"||!(je instanceof De))throw je;return-je.Ka}},B:function(W,K){try{if(K===0)return-28;var se=D("/")+1;return K"u"||!(xe instanceof De))throw xe;return-xe.Ka}},E:function(W,K){try{return W=C(W),Mg(kg,W,K)}catch(se){if(typeof Cn>"u"||!(se instanceof De))throw se;return-se.Ka}},y:function(W,K,se){try{return K=C(K),K=Gc(W,K),K=Ce(K),K[K.length-1]==="/"&&(K=K.substr(0,K.length-1)),fi(K,se),0}catch(xe){if(typeof Cn>"u"||!(xe instanceof De))throw xe;return-xe.Ka}},D:function(W,K,se,xe){try{K=C(K);var je=xe&256;return K=Gc(W,K,xe&4096),Mg(je?kg:ol,K,se)}catch(Ke){if(typeof Cn>"u"||!(Ke instanceof De))throw Ke;return-Ke.Ka}},v:function(W,K,se,xe){ym=xe;try{K=C(K),K=Gc(W,K);var je=xe?ku():0;return _n(K,se,je).fd}catch(Ke){if(typeof Cn>"u"||!(Ke instanceof De))throw Ke;return-Ke.Ka}},t:function(W,K,se,xe){try{if(K=C(K),K=Gc(W,K),0>=xe)return-28;var je=Wl(K),Ke=Math.min(xe,D(je)),ot=q[se+Ke];return N(je,z,se,xe+1),q[se+Ke]=ot,Ke}catch(xr){if(typeof Cn>"u"||!(xr instanceof De))throw xr;return-xr.Ka}},s:function(W){try{return W=C(W),ia(W),0}catch(K){if(typeof Cn>"u"||!(K instanceof De))throw K;return-K.Ka}},F:function(W,K){try{return W=C(W),Mg(ol,W,K)}catch(se){if(typeof Cn>"u"||!(se instanceof De))throw se;return-se.Ka}},p:function(W,K,se){try{return K=C(K),K=Gc(W,K),se===0?Fs(K):se===512?ia(K):me("Invalid flags passed to unlinkat"),0}catch(xe){if(typeof Cn>"u"||!(xe instanceof De))throw xe;return-xe.Ka}},o:function(W,K,se){try{if(K=C(K),K=Gc(W,K,!0),se){var xe=r1(se),je=T[se+8>>2];Ke=1e3*xe+je/1e6,se+=16,xe=r1(se),je=T[se+8>>2],ot=1e3*xe+je/1e6}else var Ke=Date.now(),ot=Ke;W=Ke;var xr=ht(K,{Sa:!0}).node;return xr.Ga.Oa(xr,{timestamp:Math.max(W,ot)}),0}catch(Pn){if(typeof Cn>"u"||!(Pn instanceof De))throw Pn;return-Pn.Ka}},e:function(){return Date.now()},j:function(W,K){W=new Date(1e3*r1(W)),T[K>>2]=W.getSeconds(),T[K+4>>2]=W.getMinutes(),T[K+8>>2]=W.getHours(),T[K+12>>2]=W.getDate(),T[K+16>>2]=W.getMonth(),T[K+20>>2]=W.getFullYear()-1900,T[K+24>>2]=W.getDay();var se=new Date(W.getFullYear(),0,1);T[K+28>>2]=(W.getTime()-se.getTime())/864e5|0,T[K+36>>2]=-(60*W.getTimezoneOffset());var xe=new Date(W.getFullYear(),6,1).getTimezoneOffset();se=se.getTimezoneOffset(),T[K+32>>2]=(xe!=se&&W.getTimezoneOffset()==Math.min(se,xe))|0},w:function(W,K,se,xe,je,Ke){try{var ot=ll(xe);if((K&2)!==0&&(se&2)===0&&(ot.flags&2097155)!==2)throw new De(2);if((ot.flags&2097155)===1)throw new De(2);if(!ot.Ha.bb)throw new De(43);var xr=ot.Ha.bb(ot,W,je,K,se),Pn=xr.Fb;return T[Ke>>2]=xr.vb,Pn}catch(sn){if(typeof Cn>"u"||!(sn instanceof De))throw sn;return-sn.Ka}},x:function(W,K,se,xe,je,Ke){try{var ot=ll(je);if(se&2){var xr=z.slice(W,W+K);ot&&ot.Ha.cb&&ot.Ha.cb(ot,xr,Ke,K,xe)}}catch(Pn){if(typeof Cn>"u"||!(Pn instanceof De))throw Pn;return-Pn.Ka}},n:Gf,q:function(){return 2147483648},d:i1,c:function(W){var K=z.length;if(W>>>=0,2147483648=se;se*=2){var xe=K*(1+.2/se);xe=Math.min(xe,W+100663296);var je=Math;xe=Math.max(W,xe),je=je.min.call(je,2147483648,xe+(65536-xe%65536)%65536);e:{try{S.grow(je-P.byteLength+65535>>>16),oe();var Ke=1;break e}catch{}Ke=void 0}if(Ke)return!0}return!1},z:function(W,K){var se=0;return Hl().forEach(function(xe,je){var Ke=K+se;for(je=L[W+4*je>>2]=Ke,Ke=0;Ke>0]=xe.charCodeAt(Ke);q[je>>0]=0,se+=xe.length+1}),0},A:function(W,K){var se=Hl();L[W>>2]=se.length;var xe=0;return se.forEach(function(je){xe+=je.length+1}),L[K>>2]=xe,0},f:function(W){try{var K=ll(W);return Hf(K),0}catch(se){if(typeof Cn>"u"||!(se instanceof De))throw se;return se.Ka}},m:function(W,K){try{var se=ll(W);return q[K>>0]=se.tty?2:(se.mode&61440)===16384?3:(se.mode&61440)===40960?7:4,0}catch(xe){if(typeof Cn>"u"||!(xe instanceof De))throw xe;return xe.Ka}},u:function(W,K,se,xe){try{e:{var je=ll(W);W=K;for(var Ke=K=0;Ke>2],xr=L[W+4>>2];W+=8;var Pn=Vh(je,q,ot,xr);if(0>Pn){var sn=-1;break e}if(K+=Pn,Pn>2]=sn,0}catch(aa){if(typeof Cn>"u"||!(aa instanceof De))throw aa;return aa.Ka}},k:function(W,K,se,xe,je){try{if(K=se+2097152>>>0<4194305-!!K?(K>>>0)+4294967296*se:NaN,isNaN(K))return 61;var Ke=ll(W);return Dg(Ke,K,xe),J=[Ke.position>>>0,(R=Ke.position,1<=+Math.abs(R)?0>>0:~~+Math.ceil((R-+(~~R>>>0))/4294967296)>>>0:0)],T[je>>2]=J[0],T[je+4>>2]=J[1],Ke.hb&&K===0&&xe===0&&(Ke.hb=null),0}catch(ot){if(typeof Cn>"u"||!(ot instanceof De))throw ot;return ot.Ka}},C:function(W){try{var K=ll(W);return K.Ha&&K.Ha.fsync?K.Ha.fsync(K):0}catch(se){if(typeof Cn>"u"||!(se instanceof De))throw se;return se.Ka}},r:function(W,K,se,xe){try{e:{var je=ll(W);W=K;for(var Ke=K=0;Ke>2],xr=L[W+4>>2];W+=8;var Pn=vm(je,q,ot,xr);if(0>Pn){var sn=-1;break e}K+=Pn}sn=K}return L[xe>>2]=sn,0}catch(aa){if(typeof Cn>"u"||!(aa instanceof De))throw aa;return aa.Ka}}};(function(){function W(je){a.asm=je.exports,S=a.asm.I,oe(),te=a.asm.Aa,fe.unshift(a.asm.J),Oe--,a.monitorRunDependencies&&a.monitorRunDependencies(Oe),Oe==0&&(ve!==null&&(clearInterval(ve),ve=null),ye&&(je=ye,ye=null,je()))}function K(je){W(je.instance)}function se(je){return U().then(function(Ke){return WebAssembly.instantiate(Ke,xe)}).then(function(Ke){return Ke}).then(je,function(Ke){v("failed to asynchronously prepare wasm: "+Ke),me(Ke)})}var xe={a:Ub};if(Oe++,a.monitorRunDependencies&&a.monitorRunDependencies(Oe),a.instantiateWasm)try{return a.instantiateWasm(xe,W)}catch(je){return v("Module.instantiateWasm callback failed with error: "+je),!1}return function(){return x||typeof WebAssembly.instantiateStreaming!="function"||ke()||$.startsWith("file://")||c||typeof fetch!="function"?se(K):fetch($,{credentials:"same-origin"}).then(function(je){return WebAssembly.instantiateStreaming(je,xe).then(K,function(Ke){return v("wasm streaming compile failed: "+Ke),v("falling back to ArrayBuffer instantiation"),se(K)})})}(),{}})(),a.___wasm_call_ctors=function(){return(a.___wasm_call_ctors=a.asm.J).apply(null,arguments)},a._sqlite3_free=function(){return(a._sqlite3_free=a.asm.K).apply(null,arguments)},a._sqlite3_value_double=function(){return(a._sqlite3_value_double=a.asm.L).apply(null,arguments)},a._sqlite3_value_text=function(){return(a._sqlite3_value_text=a.asm.M).apply(null,arguments)};var Wb=a.___errno_location=function(){return(Wb=a.___errno_location=a.asm.N).apply(null,arguments)};a._sqlite3_prepare_v2=function(){return(a._sqlite3_prepare_v2=a.asm.O).apply(null,arguments)},a._sqlite3_step=function(){return(a._sqlite3_step=a.asm.P).apply(null,arguments)},a._sqlite3_finalize=function(){return(a._sqlite3_finalize=a.asm.Q).apply(null,arguments)},a._sqlite3_reset=function(){return(a._sqlite3_reset=a.asm.R).apply(null,arguments)},a._sqlite3_value_int=function(){return(a._sqlite3_value_int=a.asm.S).apply(null,arguments)},a._sqlite3_clear_bindings=function(){return(a._sqlite3_clear_bindings=a.asm.T).apply(null,arguments)},a._sqlite3_value_blob=function(){return(a._sqlite3_value_blob=a.asm.U).apply(null,arguments)},a._sqlite3_value_bytes=function(){return(a._sqlite3_value_bytes=a.asm.V).apply(null,arguments)},a._sqlite3_value_type=function(){return(a._sqlite3_value_type=a.asm.W).apply(null,arguments)},a._sqlite3_result_blob=function(){return(a._sqlite3_result_blob=a.asm.X).apply(null,arguments)},a._sqlite3_result_double=function(){return(a._sqlite3_result_double=a.asm.Y).apply(null,arguments)},a._sqlite3_result_error=function(){return(a._sqlite3_result_error=a.asm.Z).apply(null,arguments)},a._sqlite3_result_int=function(){return(a._sqlite3_result_int=a.asm._).apply(null,arguments)},a._sqlite3_result_int64=function(){return(a._sqlite3_result_int64=a.asm.$).apply(null,arguments)},a._sqlite3_result_null=function(){return(a._sqlite3_result_null=a.asm.aa).apply(null,arguments)},a._sqlite3_result_text=function(){return(a._sqlite3_result_text=a.asm.ba).apply(null,arguments)},a._sqlite3_sql=function(){return(a._sqlite3_sql=a.asm.ca).apply(null,arguments)},a._sqlite3_aggregate_context=function(){return(a._sqlite3_aggregate_context=a.asm.da).apply(null,arguments)},a._sqlite3_column_count=function(){return(a._sqlite3_column_count=a.asm.ea).apply(null,arguments)},a._sqlite3_data_count=function(){return(a._sqlite3_data_count=a.asm.fa).apply(null,arguments)},a._sqlite3_column_blob=function(){return(a._sqlite3_column_blob=a.asm.ga).apply(null,arguments)},a._sqlite3_column_bytes=function(){return(a._sqlite3_column_bytes=a.asm.ha).apply(null,arguments)},a._sqlite3_column_double=function(){return(a._sqlite3_column_double=a.asm.ia).apply(null,arguments)},a._sqlite3_column_text=function(){return(a._sqlite3_column_text=a.asm.ja).apply(null,arguments)},a._sqlite3_column_type=function(){return(a._sqlite3_column_type=a.asm.ka).apply(null,arguments)},a._sqlite3_column_name=function(){return(a._sqlite3_column_name=a.asm.la).apply(null,arguments)},a._sqlite3_bind_blob=function(){return(a._sqlite3_bind_blob=a.asm.ma).apply(null,arguments)},a._sqlite3_bind_double=function(){return(a._sqlite3_bind_double=a.asm.na).apply(null,arguments)},a._sqlite3_bind_int=function(){return(a._sqlite3_bind_int=a.asm.oa).apply(null,arguments)},a._sqlite3_bind_text=function(){return(a._sqlite3_bind_text=a.asm.pa).apply(null,arguments)},a._sqlite3_bind_parameter_index=function(){return(a._sqlite3_bind_parameter_index=a.asm.qa).apply(null,arguments)},a._sqlite3_normalized_sql=function(){return(a._sqlite3_normalized_sql=a.asm.ra).apply(null,arguments)},a._sqlite3_errmsg=function(){return(a._sqlite3_errmsg=a.asm.sa).apply(null,arguments)},a._sqlite3_exec=function(){return(a._sqlite3_exec=a.asm.ta).apply(null,arguments)},a._sqlite3_changes=function(){return(a._sqlite3_changes=a.asm.ua).apply(null,arguments)},a._sqlite3_close_v2=function(){return(a._sqlite3_close_v2=a.asm.va).apply(null,arguments)},a._sqlite3_create_function_v2=function(){return(a._sqlite3_create_function_v2=a.asm.wa).apply(null,arguments)},a._sqlite3_open=function(){return(a._sqlite3_open=a.asm.xa).apply(null,arguments)};var Xh=a._malloc=function(){return(Xh=a._malloc=a.asm.ya).apply(null,arguments)},_g=a._free=function(){return(_g=a._free=a.asm.za).apply(null,arguments)};a._RegisterExtensionFunctions=function(){return(a._RegisterExtensionFunctions=a.asm.Ba).apply(null,arguments)};var Hb=a._emscripten_builtin_memalign=function(){return(Hb=a._emscripten_builtin_memalign=a.asm.Ca).apply(null,arguments)},Kh=a.stackSave=function(){return(Kh=a.stackSave=a.asm.Da).apply(null,arguments)},Jh=a.stackRestore=function(){return(Jh=a.stackRestore=a.asm.Ea).apply(null,arguments)},Cu=a.stackAlloc=function(){return(Cu=a.stackAlloc=a.asm.Fa).apply(null,arguments)};a.UTF8ToString=C,a.stackAlloc=Cu,a.stackSave=Kh,a.stackRestore=Jh,a.cwrap=function(W,K,se,xe){se=se||[];var je=se.every(Ke=>Ke==="number"||Ke==="boolean");return K!=="string"&&je&&!xe?a["_"+W]:function(){return Fg(W,K,se,arguments)}};var Pg;ye=function W(){Pg||Vb(),Pg||(ye=W)};function Vb(){function W(){if(!Pg&&(Pg=!0,a.calledRun=!0,!k)){if(a.noFSInit||Vf||(Vf=!0,Gh(),a.stdin=a.stdin,a.stdout=a.stdout,a.stderr=a.stderr,a.stdin?Ia("stdin",a.stdin):Ts("/dev/tty","/dev/stdin"),a.stdout?Ia("stdout",null,a.stdout):Ts("/dev/tty","/dev/stdout"),a.stderr?Ia("stderr",null,a.stderr):Ts("/dev/tty1","/dev/stderr"),_n("/dev/stdin",0),_n("/dev/stdout",1),_n("/dev/stderr",1)),Pe=!1,ee(fe),a.onRuntimeInitialized&&a.onRuntimeInitialized(),a.postRun)for(typeof a.postRun=="function"&&(a.postRun=[a.postRun]);a.postRun.length;){var K=a.postRun.shift();Ie.unshift(K)}ee(Ie)}}if(!(0{"use strict";var $Oe=bl();yX.createRoot=$Oe.createRoot,yX.hydrateRoot=$Oe.hydrateRoot;var GDr});var rMe=vn((tMe,jX)=>{(function(e){if(typeof tMe=="object"&&typeof jX<"u")jX.exports=e();else if(typeof define=="function"&&define.amd)define([],e);else{var t;typeof window<"u"?t=window:typeof global<"u"?t=global:typeof self<"u"?t=self:t=this,t.pica=e()}})(function(){var e,t,r;return function(){function n(i,a,o){function s(c,f){if(!a[c]){if(!i[c]){var d=typeof require=="function"&&require;if(!f&&d)return d(c,!0);if(l)return l(c,!0);var p=new Error("Cannot find module '"+c+"'");throw p.code="MODULE_NOT_FOUND",p}var h=a[c]={exports:{}};i[c][0].call(h.exports,function(m){var g=i[c][1][m];return s(g||m)},h,h.exports,n,i,a,o)}return a[c].exports}for(var l=typeof require=="function"&&require,u=0;u=0,wasm:f.indexOf("wasm")>=0};o.call(this,d),this.features={js:d.js,wasm:d.wasm&&this.has_wasm()},this.use(s),this.use(l)}u.prototype=Object.create(o.prototype),u.prototype.constructor=u,u.prototype.resizeAndUnsharp=function(f,d){var p=this.resize(f,d);return f.unsharpAmount&&this.unsharp_mask(p,f.toWidth,f.toHeight,f.unsharpAmount,f.unsharpRadius,f.unsharpThreshold),p},i.exports=u},{"./mm_resize":4,"./mm_unsharp_mask":9,multimath:19}],2:[function(n,i,a){"use strict";function o(d){return d<0?0:d>255?255:d}function s(d){return d>=0?d:0}function l(d,p,h,m,g,A){var b,v,x,w,S,k,j,O,C,N,D,P=0,q=0;for(C=0;C0;j--)D=A[S++],w=w+D*d[O+3]|0,x=x+D*d[O+2]|0,v=v+D*d[O+1]|0,b=b+D*d[O]|0,O=O+4|0;p[q+3]=s(w>>7),p[q+2]=s(x>>7),p[q+1]=s(v>>7),p[q]=s(b>>7),q=q+m*4|0}q=(C+1)*4|0,P=(C+1)*h*4|0}}function u(d,p,h,m,g,A){var b,v,x,w,S,k,j,O,C,N,D,P=0,q=0;for(C=0;C0;j--)D=A[S++],w=w+D*d[O+3]|0,x=x+D*d[O+2]|0,v=v+D*d[O+1]|0,b=b+D*d[O]|0,O=O+4|0;b>>=7,v>>=7,x>>=7,w>>=7,p[q+3]=o(w+(1<<13)>>14),p[q+2]=o(x+(1<<13)>>14),p[q+1]=o(v+(1<<13)>>14),p[q]=o(b+(1<<13)>>14),q=q+m*4|0}q=(C+1)*4|0,P=(C+1)*h*4|0}}function c(d,p,h,m,g,A){var b,v,x,w,S,k,j,O,C,N,D,P,q=0,z=0;for(N=0;N0;O--)P=A[k++],S=d[C+3],w=w+P*S|0,x=x+P*d[C+2]*S|0,v=v+P*d[C+1]*S|0,b=b+P*d[C]*S|0,C=C+4|0;x=x/255|0,v=v/255|0,b=b/255|0,p[z+3]=s(w>>7),p[z+2]=s(x>>7),p[z+1]=s(v>>7),p[z]=s(b>>7),z=z+m*4|0}z=(N+1)*4|0,q=(N+1)*h*4|0}}function f(d,p,h,m,g,A){var b,v,x,w,S,k,j,O,C,N,D,P=0,q=0;for(C=0;C0;j--)D=A[S++],w=w+D*d[O+3]|0,x=x+D*d[O+2]|0,v=v+D*d[O+1]|0,b=b+D*d[O]|0,O=O+4|0;b>>=7,v>>=7,x>>=7,w>>=7,w=o(w+(1<<13)>>14),w>0&&(b=b*255/w|0,v=v*255/w|0,x=x*255/w|0),p[q+3]=w,p[q+2]=o(x+(1<<13)>>14),p[q+1]=o(v+(1<<13)>>14),p[q]=o(b+(1<<13)>>14),q=q+m*4|0}q=(C+1)*4|0,P=(C+1)*h*4|0}}i.exports={convolveHor:l,convolveVert:u,convolveHorWithPre:c,convolveVertWithPre:f}},{}],3:[function(n,i,a){"use strict";i.exports="AGFzbQEAAAAADAZkeWxpbmsAAAAAAAEYA2AGf39/f39/AGAAAGAIf39/f39/f38AAg8BA2VudgZtZW1vcnkCAAADBwYBAAAAAAIGBgF/AEEACweUAQgRX193YXNtX2NhbGxfY3RvcnMAAAtjb252b2x2ZUhvcgABDGNvbnZvbHZlVmVydAACEmNvbnZvbHZlSG9yV2l0aFByZQADE2NvbnZvbHZlVmVydFdpdGhQcmUABApjb252b2x2ZUhWAAUMX19kc29faGFuZGxlAwAYX193YXNtX2FwcGx5X2RhdGFfcmVsb2NzAAAKyA4GAwABC4wDARB/AkAgA0UNACAERQ0AIANBAnQhFQNAQQAhE0EAIQsDQCALQQJqIQcCfyALQQF0IAVqIgYuAQIiC0UEQEEAIQhBACEGQQAhCUEAIQogBwwBCyASIAYuAQBqIQhBACEJQQAhCiALIRRBACEOIAchBkEAIQ8DQCAFIAZBAXRqLgEAIhAgACAIQQJ0aigCACIRQRh2bCAPaiEPIBFB/wFxIBBsIAlqIQkgEUEQdkH/AXEgEGwgDmohDiARQQh2Qf8BcSAQbCAKaiEKIAhBAWohCCAGQQFqIQYgFEEBayIUDQALIAlBB3UhCCAKQQd1IQYgDkEHdSEJIA9BB3UhCiAHIAtqCyELIAEgDEEBdCIHaiAIQQAgCEEAShs7AQAgASAHQQJyaiAGQQAgBkEAShs7AQAgASAHQQRyaiAJQQAgCUEAShs7AQAgASAHQQZyaiAKQQAgCkEAShs7AQAgDCAVaiEMIBNBAWoiEyAERw0ACyANQQFqIg0gAmwhEiANQQJ0IQwgAyANRw0ACwsL2gMBD38CQCADRQ0AIARFDQAgAkECdCEUA0AgCyEMQQAhE0EAIQIDQCACQQJqIQYCfyACQQF0IAVqIgcuAQIiAkUEQEEAIQhBACEHQQAhCkEAIQkgBgwBCyAHLgEAQQJ0IBJqIQhBACEJIAIhCkEAIQ0gBiEHQQAhDkEAIQ8DQCAFIAdBAXRqLgEAIhAgACAIQQF0IhFqLwEAbCAJaiEJIAAgEUEGcmovAQAgEGwgDmohDiAAIBFBBHJqLwEAIBBsIA9qIQ8gACARQQJyai8BACAQbCANaiENIAhBBGohCCAHQQFqIQcgCkEBayIKDQALIAlBB3UhCCANQQd1IQcgDkEHdSEKIA9BB3UhCSACIAZqCyECIAEgDEECdGogB0GAQGtBDnUiBkH/ASAGQf8BSBsiBkEAIAZBAEobQQh0QYD+A3EgCUGAQGtBDnUiBkH/ASAGQf8BSBsiBkEAIAZBAEobQRB0QYCA/AdxIApBgEBrQQ51IgZB/wEgBkH/AUgbIgZBACAGQQBKG0EYdHJyIAhBgEBrQQ51IgZB/wEgBkH/AUgbIgZBACAGQQBKG3I2AgAgAyAMaiEMIBNBAWoiEyAERw0ACyAUIAtBAWoiC2whEiADIAtHDQALCwuSAwEQfwJAIANFDQAgBEUNACADQQJ0IRUDQEEAIRNBACEGA0AgBkECaiEIAn8gBkEBdCAFaiIGLgECIgdFBEBBACEJQQAhDEEAIQ1BACEOIAgMAQsgEiAGLgEAaiEJQQAhDkEAIQ1BACEMIAchFEEAIQ8gCCEGA0AgBSAGQQF0ai4BACAAIAlBAnRqKAIAIhBBGHZsIhEgD2ohDyARIBBBEHZB/wFxbCAMaiEMIBEgEEEIdkH/AXFsIA1qIQ0gESAQQf8BcWwgDmohDiAJQQFqIQkgBkEBaiEGIBRBAWsiFA0ACyAPQQd1IQkgByAIagshBiABIApBAXQiCGogDkH/AW1BB3UiB0EAIAdBAEobOwEAIAEgCEECcmogDUH/AW1BB3UiB0EAIAdBAEobOwEAIAEgCEEEcmogDEH/AW1BB3UiB0EAIAdBAEobOwEAIAEgCEEGcmogCUEAIAlBAEobOwEAIAogFWohCiATQQFqIhMgBEcNAAsgC0EBaiILIAJsIRIgC0ECdCEKIAMgC0cNAAsLC4IEAQ9/AkAgA0UNACAERQ0AIAJBAnQhFANAIAshDEEAIRJBACEHA0AgB0ECaiEKAn8gB0EBdCAFaiICLgECIhNFBEBBACEIQQAhCUEAIQYgCiEHQQAMAQsgAi4BAEECdCARaiEJQQAhByATIQJBACENIAohBkEAIQ5BACEPA0AgBSAGQQF0ai4BACIIIAAgCUEBdCIQai8BAGwgB2ohByAAIBBBBnJqLwEAIAhsIA5qIQ4gACAQQQRyai8BACAIbCAPaiEPIAAgEEECcmovAQAgCGwgDWohDSAJQQRqIQkgBkEBaiEGIAJBAWsiAg0ACyAHQQd1IQggDUEHdSEJIA9BB3UhBiAKIBNqIQcgDkEHdQtBgEBrQQ51IgJB/wEgAkH/AUgbIgJBACACQQBKGyIKQf8BcQRAIAlB/wFsIAJtIQkgCEH/AWwgAm0hCCAGQf8BbCACbSEGCyABIAxBAnRqIAlBgEBrQQ51IgJB/wEgAkH/AUgbIgJBACACQQBKG0EIdEGA/gNxIAZBgEBrQQ51IgJB/wEgAkH/AUgbIgJBACACQQBKG0EQdEGAgPwHcSAKQRh0ciAIQYBAa0EOdSICQf8BIAJB/wFIGyICQQAgAkEAShtycjYCACADIAxqIQwgEkEBaiISIARHDQALIBQgC0EBaiILbCERIAMgC0cNAAsLC0AAIAcEQEEAIAIgAyAEIAUgABADIAJBACAEIAUgBiABEAQPC0EAIAIgAyAEIAUgABABIAJBACAEIAUgBiABEAIL"},{}],4:[function(n,i,a){"use strict";i.exports={name:"resize",fn:n("./resize"),wasm_fn:n("./resize_wasm"),wasm_src:n("./convolve_wasm_base64")}},{"./convolve_wasm_base64":3,"./resize":5,"./resize_wasm":8}],5:[function(n,i,a){"use strict";var o=n("./resize_filter_gen"),s=n("./convolve"),l=s.convolveHor,u=s.convolveVert,c=s.convolveHorWithPre,f=s.convolveVertWithPre;function d(h,m,g){for(var A=3,b=m*g*4|0;A"u"?"mks2013":m.filter,N=o(C,A,v,w,k),D=o(C,b,x,S,j),P=new Uint16Array(v*b*4);return d(g,A,b)?(c(g,P,A,b,v,N),f(P,O,b,v,x,D)):(l(g,P,A,b,v,N),u(P,O,b,v,x,D),p(O,v,x)),O}},{"./convolve":2,"./resize_filter_gen":6}],6:[function(n,i,a){"use strict";var o=n("./resize_filter_info"),s=14;function l(u){return Math.round(u*((1<>1]+=l(1-q),I=0;I0&&O[T]===0;)T--;if(L=w+I,_=T-I+1,oe[te++]=L,oe[te++]=_,!Q)oe.set(O.subarray(I,T+1),te),te+=_;else for(D=I;D<=T;D++)oe[te++]=O[D]}else oe[te++]=0,oe[te++]=0}return oe}},{"./resize_filter_info":7}],7:[function(n,i,a){"use strict";var o={box:{win:.5,fn:function(l){return l<0&&(l=-l),l<.5?1:0}},hamming:{win:1,fn:function(l){if(l<0&&(l=-l),l>=1)return 0;if(l<11920929e-14)return 1;var u=l*Math.PI;return Math.sin(u)/u*(.54+.46*Math.cos(u/1))}},lanczos2:{win:2,fn:function(l){if(l<0&&(l=-l),l>=2)return 0;if(l<11920929e-14)return 1;var u=l*Math.PI;return Math.sin(u)/u*Math.sin(u/2)/(u/2)}},lanczos3:{win:3,fn:function(l){if(l<0&&(l=-l),l>=3)return 0;if(l<11920929e-14)return 1;var u=l*Math.PI;return Math.sin(u)/u*Math.sin(u/3)/(u/3)}},mks2013:{win:2.5,fn:function(l){return l<0&&(l=-l),l>=2.5?0:l>=1.5?-.125*(l-2.5)*(l-2.5):l>=.5?.25*(4*l*l-11*l+7):1.0625-1.75*l*l}}};i.exports={filter:o,f2q:{box:0,hamming:1,lanczos2:2,lanczos3:3},q2f:["box","hamming","lanczos2","lanczos3"]}},{}],8:[function(n,i,a){"use strict";var o=n("./resize_filter_gen");function s(d,p,h){for(var m=3,g=p*h*4|0;m>8&255}}i.exports=function(p){var h=p.src,m=p.width,g=p.height,A=p.toWidth,b=p.toHeight,v=p.scaleX||p.toWidth/p.width,x=p.scaleY||p.toHeight/p.height,w=p.offsetX||0,S=p.offsetY||0,k=p.dest||new Uint8Array(A*b*4),j=typeof p.filter>"u"?"mks2013":p.filter,O=o(j,m,A,v,w),C=o(j,g,b,x,S),N=0,D=Math.max(h.byteLength,k.byteLength),P=this.__align(N+D),q=g*A*4*2,z=this.__align(P+q),I=this.__align(z+O.byteLength),T=I+C.byteLength,L=this.__instance("resize",T),_=new Uint8Array(this.__memory.buffer),Y=new Uint32Array(this.__memory.buffer),oe=new Uint32Array(h.buffer);Y.set(oe),f(O,_,z),f(C,_,I);var te=L.exports.convolveHV||L.exports._convolveHV;s(h,m,g)?te(z,I,P,m,g,A,b,1):(te(z,I,P,m,g,A,b,0),l(k,A,b));var Q=new Uint32Array(k.buffer);return Q.set(new Uint32Array(this.__memory.buffer,0,b*A)),k}},{"./resize_filter_gen":6}],9:[function(n,i,a){"use strict";i.exports={name:"unsharp_mask",fn:n("./unsharp_mask"),wasm_fn:n("./unsharp_mask_wasm"),wasm_src:n("./unsharp_mask_wasm_base64")}},{"./unsharp_mask":10,"./unsharp_mask_wasm":11,"./unsharp_mask_wasm_base64":12}],10:[function(n,i,a){"use strict";var o=n("glur/mono16");function s(l,u,c){for(var f=u*c,d=new Uint16Array(f),p,h,m,g,A=0;A=h&&p>=m?p:h>=m&&h>=p?h:m,d[A]=g<<8;return d}i.exports=function(u,c,f,d,p,h){var m,g,A,b,v;if(!(d===0||p<.5)){p>2&&(p=2);var x=s(u,c,f),w=new Uint16Array(x);o(w,c,f,p);for(var S=d/100*4096+.5|0,k=h<<8,j=c*f,O=0;O=k&&(g=m+(S*b+2048>>12),g=g>65280?65280:g,g=g<0?0:g,m=m!==0?m:1,A=(g<<12)/m|0,v=O*4,u[v]=u[v]*A+2048>>12,u[v+1]=u[v+1]*A+2048>>12,u[v+2]=u[v+2]*A+2048>>12)}}},{"glur/mono16":18}],11:[function(n,i,a){"use strict";i.exports=function(s,l,u,c,f,d){if(!(c===0||f<.5)){f>2&&(f=2);var p=l*u,h=p*4,m=p*2,g=p*2,A=Math.max(l,u)*4,b=8*4,v=0,x=h,w=x+m,S=w+g,k=S+g,j=k+A,O=this.__instance("unsharp_mask",h+m+g*2+A+b,{exp:Math.exp}),C=new Uint32Array(s.buffer),N=new Uint32Array(this.__memory.buffer);N.set(C);var D=O.exports.hsv_v16||O.exports._hsv_v16;D(v,x,l,u),D=O.exports.blurMono16||O.exports._blurMono16,D(x,w,S,k,j,l,u,f),D=O.exports.unsharp||O.exports._unsharp,D(v,v,x,w,l,u,c,d),C.set(new Uint32Array(this.__memory.buffer,0,p))}}},{}],12:[function(n,i,a){"use strict";i.exports="AGFzbQEAAAAADAZkeWxpbmsAAAAAAAE0B2AAAGAEf39/fwBgBn9/f39/fwBgCH9/f39/f39/AGAIf39/f39/f30AYAJ9fwBgAXwBfAIZAgNlbnYDZXhwAAYDZW52Bm1lbW9yeQIAAAMHBgAFAgQBAwYGAX8AQQALB4oBCBFfX3dhc21fY2FsbF9jdG9ycwABFl9fYnVpbGRfZ2F1c3NpYW5fY29lZnMAAg5fX2dhdXNzMTZfbGluZQADCmJsdXJNb25vMTYABAdoc3ZfdjE2AAUHdW5zaGFycAAGDF9fZHNvX2hhbmRsZQMAGF9fd2FzbV9hcHBseV9kYXRhX3JlbG9jcwABCsUMBgMAAQvWAQEHfCABRNuGukOCGvs/IAC7oyICRAAAAAAAAADAohAAIgW2jDgCFCABIAKaEAAiAyADoCIGtjgCECABRAAAAAAAAPA/IAOhIgQgBKIgAyACIAKgokQAAAAAAADwP6AgBaGjIgS2OAIAIAEgBSAEmqIiB7Y4AgwgASADIAJEAAAAAAAA8D+gIASioiIItjgCCCABIAMgAkQAAAAAAADwv6AgBKKiIgK2OAIEIAEgByAIoCAFRAAAAAAAAPA/IAahoCIDo7Y4AhwgASAEIAKgIAOjtjgCGAuGBQMGfwl8An0gAyoCDCEVIAMqAgghFiADKgIUuyERIAMqAhC7IRACQCAEQQFrIghBAEgiCQRAIAIhByAAIQYMAQsgAiAALwEAuCIPIAMqAhi7oiIMIBGiIg0gDCAQoiAPIAMqAgS7IhOiIhQgAyoCALsiEiAPoqCgoCIOtjgCACACQQRqIQcgAEECaiEGIAhFDQAgCEEBIAhBAUgbIgpBf3MhCwJ/IAQgCmtBAXFFBEAgDiENIAgMAQsgAiANIA4gEKIgFCASIAAvAQK4Ig+ioKCgIg22OAIEIAJBCGohByAAQQRqIQYgDiEMIARBAmsLIQIgC0EAIARrRg0AA0AgByAMIBGiIA0gEKIgDyAToiASIAYvAQC4Ig6ioKCgIgy2OAIAIAcgDSARoiAMIBCiIA4gE6IgEiAGLwECuCIPoqCgoCINtjgCBCAHQQhqIQcgBkEEaiEGIAJBAkohACACQQJrIQIgAA0ACwsCQCAJDQAgASAFIAhsQQF0aiIAAn8gBkECay8BACICuCINIBW7IhKiIA0gFrsiE6KgIA0gAyoCHLuiIgwgEKKgIAwgEaKgIg8gB0EEayIHKgIAu6AiDkQAAAAAAADwQWMgDkQAAAAAAAAAAGZxBEAgDqsMAQtBAAs7AQAgCEUNACAGQQRrIQZBACAFa0EBdCEBA0ACfyANIBKiIAJB//8DcbgiDSAToqAgDyIOIBCioCAMIBGioCIPIAdBBGsiByoCALugIgxEAAAAAAAA8EFjIAxEAAAAAAAAAABmcQRAIAyrDAELQQALIQMgBi8BACECIAAgAWoiACADOwEAIAZBAmshBiAIQQFKIQMgDiEMIAhBAWshCCADDQALCwvRAgIBfwd8AkAgB0MAAAAAWw0AIARE24a6Q4Ia+z8gB0MAAAA/l7ujIglEAAAAAAAAAMCiEAAiDLaMOAIUIAQgCZoQACIKIAqgIg22OAIQIAREAAAAAAAA8D8gCqEiCyALoiAKIAkgCaCiRAAAAAAAAPA/oCAMoaMiC7Y4AgAgBCAMIAuaoiIOtjgCDCAEIAogCUQAAAAAAADwP6AgC6KiIg+2OAIIIAQgCiAJRAAAAAAAAPC/oCALoqIiCbY4AgQgBCAOIA+gIAxEAAAAAAAA8D8gDaGgIgqjtjgCHCAEIAsgCaAgCqO2OAIYIAYEQANAIAAgBSAIbEEBdGogAiAIQQF0aiADIAQgBSAGEAMgCEEBaiIIIAZHDQALCyAFRQ0AQQAhCANAIAIgBiAIbEEBdGogASAIQQF0aiADIAQgBiAFEAMgCEEBaiIIIAVHDQALCwtxAQN/IAIgA2wiBQRAA0AgASAAKAIAIgRBEHZB/wFxIgIgAiAEQQh2Qf8BcSIDIAMgBEH/AXEiBEkbIAIgA0sbIgYgBiAEIAIgBEsbIAMgBEsbQQh0OwEAIAFBAmohASAAQQRqIQAgBUEBayIFDQALCwuZAgIDfwF8IAQgBWwhBAJ/IAazQwAAgEWUQwAAyEKVu0QAAAAAAADgP6AiC5lEAAAAAAAA4EFjBEAgC6oMAQtBgICAgHgLIQUgBARAIAdBCHQhCUEAIQYDQCAJIAIgBkEBdCIHai8BACIBIAMgB2ovAQBrIgcgB0EfdSIIaiAIc00EQCAAIAZBAnQiCGoiCiAFIAdsQYAQakEMdSABaiIHQYD+AyAHQYD+A0gbIgdBACAHQQBKG0EMdCABQQEgARtuIgEgCi0AAGxBgBBqQQx2OgAAIAAgCEEBcmoiByABIActAABsQYAQakEMdjoAACAAIAhBAnJqIgcgASAHLQAAbEGAEGpBDHY6AAALIAZBAWoiBiAERw0ACwsL"},{}],13:[function(n,i,a){"use strict";var o=100;function s(l,u){this.create=l,this.available=[],this.acquired={},this.lastId=1,this.timeoutId=0,this.idle=u||2e3}s.prototype.acquire=function(){var l=this,u;return this.available.length!==0?u=this.available.pop():(u=this.create(),u.id=this.lastId++,u.release=function(){return l.release(u)}),this.acquired[u.id]=u,u},s.prototype.release=function(l){var u=this;delete this.acquired[l.id],l.lastUsed=Date.now(),this.available.push(l),this.timeoutId===0&&(this.timeoutId=setTimeout(function(){return u.gc()},o))},s.prototype.gc=function(){var l=this,u=Date.now();this.available=this.available.filter(function(c){return u-c.lastUsed>l.idle?(c.destroy(),!1):!0}),this.available.length!==0?this.timeoutId=setTimeout(function(){return l.gc()},o):this.timeoutId=0},i.exports=s},{}],14:[function(n,i,a){"use strict";var o=2;i.exports=function(l,u,c,f,d,p){var h=c/l,m=f/u,g=(2*p+o+1)/d;if(g>.5)return[[c,f]];var A=Math.ceil(Math.log(Math.min(h,m))/Math.log(g));if(A<=1)return[[c,f]];for(var b=[],v=0;v=c.toWidth&&(v=c.toWidth-m),g=b-c.destTileBorder,g<0&&(g=0),x=b+h+c.destTileBorder-g,g+x>=c.toHeight&&(x=c.toHeight-g),S={toX:m,toY:g,toWidth:v,toHeight:x,toInnerX:A,toInnerY:b,toInnerWidth:p,toInnerHeight:h,offsetX:m/f-s(m/f),offsetY:g/d-s(g/d),scaleX:f,scaleY:d,x:s(m/f),y:s(g/d),width:l(v/f),height:l(x/d)},w.push(S);return w}},{}],16:[function(n,i,a){"use strict";function o(s){return Object.prototype.toString.call(s)}i.exports.isCanvas=function(l){var u=o(l);return u==="[object HTMLCanvasElement]"||u==="[object OffscreenCanvas]"||u==="[object Canvas]"},i.exports.isImage=function(l){return o(l)==="[object HTMLImageElement]"},i.exports.isImageBitmap=function(l){return o(l)==="[object ImageBitmap]"},i.exports.limiter=function(l){var u=0,c=[];function f(){u"u")return!1;var u=l(100,100);return createImageBitmap(u,0,0,100,100,{resizeWidth:10,resizeHeight:10,resizeQuality:"high"}).then(function(c){var f=c.width===10;return c.close(),u=null,f})}).catch(function(){return!1})},i.exports.worker_offscreen_canvas_support=function(){return new Promise(function(l,u){if(typeof OffscreenCanvas>"u"){l(!1);return}function c(p){if(typeof createImageBitmap>"u"){p.postMessage(!1);return}Promise.resolve().then(function(){var h=new OffscreenCanvas(10,10),m=h.getContext("2d");return m.rect(0,0,1,1),createImageBitmap(h,0,0,1,1)}).then(function(){return p.postMessage(!0)},function(){return p.postMessage(!1)})}var f=btoa("(".concat(c.toString(),")(self);")),d=new Worker("data:text/javascript;base64,".concat(f));d.onmessage=function(p){return l(p.data)},d.onerror=u}).then(function(l){return l},function(){return!1})},i.exports.can_use_canvas=function(l){var u=!1;try{var c=l(2,1),f=c.getContext("2d"),d=f.createImageData(2,1);d.data[0]=12,d.data[1]=23,d.data[2]=34,d.data[3]=255,d.data[4]=45,d.data[5]=56,d.data[6]=67,d.data[7]=255,f.putImageData(d,0,0),d=null,d=f.getImageData(0,0,2,1),d.data[0]===12&&d.data[1]===23&&d.data[2]===34&&d.data[3]===255&&d.data[4]===45&&d.data[5]===56&&d.data[6]===67&&d.data[7]===255&&(u=!0)}catch{}return u},i.exports.cib_can_use_region=function(){return new Promise(function(l){if(typeof Image>"u"||typeof createImageBitmap>"u"){l(!1);return}var u=new Image;u.src="data:image/jpeg;base64,/9j/4QBiRXhpZgAATU0AKgAAAAgABQESAAMAAAABAAYAAAEaAAUAAAABAAAASgEbAAUAAAABAAAAUgEoAAMAAAABAAIAAAITAAMAAAABAAEAAAAAAAAAAABIAAAAAQAAAEgAAAAB/9sAQwAEAwMEAwMEBAMEBQQEBQYKBwYGBgYNCQoICg8NEBAPDQ8OERMYFBESFxIODxUcFRcZGRsbGxAUHR8dGh8YGhsa/9sAQwEEBQUGBQYMBwcMGhEPERoaGhoaGhoaGhoaGhoaGhoaGhoaGhoaGhoaGhoaGhoaGhoaGhoaGhoaGhoaGhoaGhoa/8IAEQgAAQACAwERAAIRAQMRAf/EABQAAQAAAAAAAAAAAAAAAAAAAAf/xAAUAQEAAAAAAAAAAAAAAAAAAAAA/9oADAMBAAIQAxAAAAF/P//EABQQAQAAAAAAAAAAAAAAAAAAAAD/2gAIAQEAAQUCf//EABQRAQAAAAAAAAAAAAAAAAAAAAD/2gAIAQMBAT8Bf//EABQRAQAAAAAAAAAAAAAAAAAAAAD/2gAIAQIBAT8Bf//EABQQAQAAAAAAAAAAAAAAAAAAAAD/2gAIAQEABj8Cf//EABQQAQAAAAAAAAAAAAAAAAAAAAD/2gAIAQEAAT8hf//aAAwDAQACAAMAAAAQH//EABQRAQAAAAAAAAAAAAAAAAAAAAD/2gAIAQMBAT8Qf//EABQRAQAAAAAAAAAAAAAAAAAAAAD/2gAIAQIBAT8Qf//EABQQAQAAAAAAAAAAAAAAAAAAAAD/2gAIAQEAAT8Qf//Z",u.onload=function(){createImageBitmap(u,0,0,u.width,u.height).then(function(c){c.width===u.width&&c.height===u.height?l(!0):l(!1)},function(){return l(!1)})},u.onerror=function(){return l(!1)}})}},{}],17:[function(n,i,a){"use strict";i.exports=function(){var o=n("./mathlib"),s;onmessage=function(u){var c=u.data.opts,f=!1;if(!c.src&&c.srcBitmap){var d=new OffscreenCanvas(c.width,c.height),p=d.getContext("2d");p.drawImage(c.srcBitmap,0,0),c.src=p.getImageData(0,0,c.width,c.height).data,d.width=d.height=0,d=null,c.srcBitmap.close(),c.srcBitmap=null}s||(s=new o(u.data.features));var h=s.resizeAndUnsharp(c);if(f){var m=new ImageData(new Uint8ClampedArray(h),c.toWidth,c.toHeight),g=new OffscreenCanvas(c.toWidth,c.toHeight),A=g.getContext("2d");A.putImageData(m,0,0),createImageBitmap(g).then(function(b){postMessage({bitmap:b},[b])})}else postMessage({data:h},[h.buffer])}}},{"./mathlib":1}],18:[function(n,i,a){var o,s,l,u,c,f,d,p;function h(A){A<.5&&(A=.5);var b=Math.exp(.726*.726)/A,v=Math.exp(-b),x=Math.exp(-2*b),w=(1-v)*(1-v)/(1+2*b*v-x);return o=w,s=w*(b-1)*v,l=w*(b+1)*v,u=-w*x,c=2*v,f=-x,d=(o+s)/(1-c-f),p=(l+u)/(1-c-f),new Float32Array([o,s,l,u,c,f,d,p])}function m(A,b,v,x,w,S){var k,j,O,C,N,D,P,q,z,I,T,L,_,Y;for(z=0;z=0;I--)O=j*T+k*L+C*_+N*Y,N=C,C=O,k=j,j=A[D],b[P]=v[q]+C,D--,q--,P-=S}}function g(A,b,v,x){if(!!x){var w=new Uint16Array(A.length),S=new Float32Array(Math.max(b,v)),k=h(x);m(A,w,S,k,b,v,x),m(w,A,S,k,v,b,x)}}i.exports=g},{}],19:[function(n,i,a){"use strict";var o=n("object-assign"),s=n("./lib/base64decode"),l=n("./lib/wa_detect"),u={js:!0,wasm:!0};function c(f){if(!(this instanceof c))return new c(f);var d=o({},u,f||{});if(this.options=d,this.__cache={},this.__init_promise=null,this.__modules=d.modules||{},this.__memory=null,this.__wasm={},this.__isLE=new Uint32Array(new Uint8Array([1,0,0,0]).buffer)[0]===1,!this.options.js&&!this.options.wasm)throw new Error('mathlib: at least "js" or "wasm" should be enabled')}c.prototype.has_wasm=l,c.prototype.use=function(f){return this.__modules[f.name]=f,this.options.wasm&&this.has_wasm()&&f.wasm_fn?this[f.name]=f.wasm_fn:this[f.name]=f.fn,this},c.prototype.init=function(){if(this.__init_promise)return this.__init_promise;if(!this.options.js&&this.options.wasm&&!this.has_wasm())return Promise.reject(new Error(`mathlib: only "wasm" was enabled, but it's not supported`));var f=this;return this.__init_promise=Promise.all(Object.keys(f.__modules).map(function(d){var p=f.__modules[d];return!f.options.wasm||!f.has_wasm()||!p.wasm_fn||f.__wasm[d]?null:WebAssembly.compile(f.__base64decode(p.wasm_src)).then(function(h){f.__wasm[d]=h})})).then(function(){return f}),this.__init_promise},c.prototype.__base64decode=s,c.prototype.__reallocate=function(d){if(!this.__memory)return this.__memory=new WebAssembly.Memory({initial:Math.ceil(d/(64*1024))}),this.__memory;var p=this.__memory.buffer.byteLength;return p>2),d=0,p=0,h=0;h>16&255,f[p++]=d>>8&255,f[p++]=d&255),d=d<<6|o.indexOf(u.charAt(h));var m=c%4*6;return m===0?(f[p++]=d>>16&255,f[p++]=d>>8&255,f[p++]=d&255):m===18?(f[p++]=d>>10&255,f[p++]=d>>2&255):m===12&&(f[p++]=d>>4&255),f}},{}],21:[function(n,i,a){"use strict";var o;i.exports=function(){if(typeof o<"u"||(o=!1,typeof WebAssembly>"u"))return o;try{var l=new Uint8Array([0,97,115,109,1,0,0,0,1,6,1,96,1,127,1,127,3,2,1,0,5,3,1,0,1,7,8,1,4,116,101,115,116,0,0,10,16,1,14,0,32,0,65,1,54,2,0,32,0,40,2,0,11]),u=new WebAssembly.Module(l),c=new WebAssembly.Instance(u,{});return c.exports.test(4)!==0&&(o=!0),o}catch{}return o}},{}],22:[function(n,i,a){"use strict";var o=Object.getOwnPropertySymbols,s=Object.prototype.hasOwnProperty,l=Object.prototype.propertyIsEnumerable;function u(f){if(f==null)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(f)}function c(){try{if(!Object.assign)return!1;var f=new String("abc");if(f[5]="de",Object.getOwnPropertyNames(f)[0]==="5")return!1;for(var d={},p=0;p<10;p++)d["_"+String.fromCharCode(p)]=p;var h=Object.getOwnPropertyNames(d).map(function(g){return d[g]});if(h.join("")!=="0123456789")return!1;var m={};return"abcdefghijklmnopqrst".split("").forEach(function(g){m[g]=g}),Object.keys(Object.assign({},m)).join("")==="abcdefghijklmnopqrst"}catch{return!1}}i.exports=c()?Object.assign:function(f,d){for(var p,h=u(f),m,g=1;gT.length)&&(L=T.length);for(var _=0,Y=new Array(L);_=0)}catch{}var k=1;typeof navigator<"u"&&(k=Math.min(navigator.hardwareConcurrency||1,4));var j={tile:1024,concurrency:k,features:["js","wasm","ww"],idle:2e3,createCanvas:function(L,_){var Y=document.createElement("canvas");return Y.width=L,Y.height=_,Y}},O={filter:"mks2013",unsharpAmount:0,unsharpRadius:0,unsharpThreshold:0},C=!1,N=!1,D=!1,P=!1,q=!1;function z(){return{value:p(A),destroy:function(){if(this.value.terminate(),typeof window<"u"){var L=window.URL||window.webkitURL||window.mozURL||window.msURL;L&&L.revokeObjectURL&&this.value.objectURL&&L.revokeObjectURL(this.value.objectURL)}}}}function I(T){if(!(this instanceof I))return new I(T);this.options=d({},j,T||{});var L="lk_".concat(this.options.concurrency);this.__limit=w[L]||g.limiter(this.options.concurrency),w[L]||(w[L]=this.__limit),this.features={js:!1,wasm:!1,cib:!1,ww:!1},this.__workersPool=null,this.__requested_features=[],this.__mathlib=null}I.prototype.init=function(){var T=this;if(this.__initPromise)return this.__initPromise;if(typeof ImageData<"u"&&typeof Uint8ClampedArray<"u")try{new ImageData(new Uint8ClampedArray(400),10,10),C=!0}catch{}typeof ImageBitmap<"u"&&(ImageBitmap.prototype&&ImageBitmap.prototype.close?N=!0:this.debug("ImageBitmap does not support .close(), disabled"));var L=this.options.features.slice();if(L.indexOf("all")>=0&&(L=["cib","wasm","js","ww"]),this.__requested_features=L,this.__mathlib=new h(L),L.indexOf("ww")>=0&&typeof window<"u"&&"Worker"in window)try{var _=n("webworkify")(function(){});_.terminate(),this.features.ww=!0;var Y="wp_".concat(JSON.stringify(this.options));w[Y]?this.__workersPool=w[Y]:(this.__workersPool=new m(z,this.options.idle),w[Y]=this.__workersPool)}catch{}var oe=this.__mathlib.init().then(function(Ie){d(T.features,Ie.features)}),te;N?te=g.cib_support(this.options.createCanvas).then(function(Ie){if(T.features.cib&&L.indexOf("cib")<0){T.debug("createImageBitmap() resize supported, but disabled by config");return}L.indexOf("cib")>=0&&(T.features.cib=Ie)}):te=Promise.resolve(!1),D=g.can_use_canvas(this.options.createCanvas);var Q;N&&C&&L.indexOf("ww")!==-1?Q=g.worker_offscreen_canvas_support():Q=Promise.resolve(!1),Q=Q.then(function(Ie){P=Ie});var fe=g.cib_can_use_region().then(function(Ie){q=Ie});return this.__initPromise=Promise.all([oe,te,Q,fe]).then(function(){return T}),this.__initPromise},I.prototype.__invokeResize=function(T,L){var _=this;return L.__mathCache=L.__mathCache||{},Promise.resolve().then(function(){return _.features.ww?new Promise(function(Y,oe){var te=_.__workersPool.acquire();L.cancelToken&&L.cancelToken.catch(function(fe){return oe(fe)}),te.value.onmessage=function(fe){te.release(),fe.data.err?oe(fe.data.err):Y(fe.data)};var Q=[];T.src&&Q.push(T.src.buffer),T.srcBitmap&&Q.push(T.srcBitmap),te.value.postMessage({opts:T,features:_.__requested_features,preload:{wasm_nodule:_.__mathlib.__}},Q)}):{data:_.__mathlib.resizeAndUnsharp(T,L.__mathCache)}})},I.prototype.__extractTileData=function(T,L,_,Y,oe){if(this.features.ww&&P&&(g.isCanvas(L)||q))return this.debug("Create tile for OffscreenCanvas"),createImageBitmap(Y.srcImageBitmap||L,T.x,T.y,T.width,T.height).then(function(fe){return oe.srcBitmap=fe,oe});if(g.isCanvas(L))return Y.srcCtx||(Y.srcCtx=L.getContext("2d")),this.debug("Get tile pixel data"),oe.src=Y.srcCtx.getImageData(T.x,T.y,T.width,T.height).data,oe;this.debug("Draw tile imageBitmap/image to temporary canvas");var te=this.options.createCanvas(T.width,T.height),Q=te.getContext("2d");return Q.globalCompositeOperation="copy",Q.drawImage(Y.srcImageBitmap||L,T.x,T.y,T.width,T.height,0,0,T.width,T.height),this.debug("Get tile pixel data"),oe.src=Q.getImageData(0,0,T.width,T.height).data,te.width=te.height=0,oe},I.prototype.__landTileData=function(T,L,_){var Y;if(this.debug("Convert raw rgba tile result to ImageData"),L.bitmap)return _.toCtx.drawImage(L.bitmap,T.toX,T.toY),null;if(C)Y=new ImageData(new Uint8ClampedArray(L.data),T.toWidth,T.toHeight);else if(Y=_.toCtx.createImageData(T.toWidth,T.toHeight),Y.data.set)Y.data.set(L.data);else for(var oe=Y.data.length-1;oe>=0;oe--)Y.data[oe]=L.data[oe];return this.debug("Draw tile"),S?_.toCtx.putImageData(Y,T.toX,T.toY,T.toInnerX-T.toX,T.toInnerY-T.toY,T.toInnerWidth+1e-5,T.toInnerHeight+1e-5):_.toCtx.putImageData(Y,T.toX,T.toY,T.toInnerX-T.toX,T.toInnerY-T.toY,T.toInnerWidth,T.toInnerHeight),null},I.prototype.__tileAndResize=function(T,L,_){var Y=this,oe={srcCtx:null,srcImageBitmap:null,isImageBitmapReused:!1,toCtx:null},te=function(fe){return Y.__limit(function(){if(_.canceled)return _.cancelToken;var Ie={width:fe.width,height:fe.height,toWidth:fe.toWidth,toHeight:fe.toHeight,scaleX:fe.scaleX,scaleY:fe.scaleY,offsetX:fe.offsetX,offsetY:fe.offsetY,filter:_.filter,unsharpAmount:_.unsharpAmount,unsharpRadius:_.unsharpRadius,unsharpThreshold:_.unsharpThreshold};return Y.debug("Invoke resize math"),Promise.resolve(Ie).then(function(Se){return Y.__extractTileData(fe,T,_,oe,Se)}).then(function(Se){return Y.debug("Invoke resize math"),Y.__invokeResize(Se,_)}).then(function(Se){return _.canceled?_.cancelToken:(oe.srcImageData=null,Y.__landTileData(fe,Se,oe))})})};return Promise.resolve().then(function(){if(oe.toCtx=L.getContext("2d"),g.isCanvas(T))return null;if(g.isImageBitmap(T))return oe.srcImageBitmap=T,oe.isImageBitmapReused=!0,null;if(g.isImage(T))return N?(Y.debug("Decode image via createImageBitmap"),createImageBitmap(T).then(function(Q){oe.srcImageBitmap=Q}).catch(function(Q){return null})):null;throw new Error('Pica: ".from" should be Image, Canvas or ImageBitmap')}).then(function(){if(_.canceled)return _.cancelToken;Y.debug("Calculate tiles");var Q=v({width:_.width,height:_.height,srcTileSize:Y.options.tile,toWidth:_.toWidth,toHeight:_.toHeight,destTileBorder:_.__destTileBorder}),fe=Q.map(function(Se){return te(Se)});function Ie(Se){Se.srcImageBitmap&&(Se.isImageBitmapReused||Se.srcImageBitmap.close(),Se.srcImageBitmap=null)}return Y.debug("Process tiles"),Promise.all(fe).then(function(){return Y.debug("Finished!"),Ie(oe),L},function(Se){throw Ie(oe),Se})})},I.prototype.__processStages=function(T,L,_,Y){var oe=this;if(Y.canceled)return Y.cancelToken;var te=T.shift(),Q=o(te,2),fe=Q[0],Ie=Q[1],Se=T.length===0,Oe;Se||x.q2f.indexOf(Y.filter)<0?Oe=Y.filter:Y.filter==="box"?Oe="box":Oe="hamming",Y=d({},Y,{toWidth:fe,toHeight:Ie,filter:Oe});var ve;return Se||(ve=this.options.createCanvas(fe,Ie)),this.__tileAndResize(L,Se?_:ve,Y).then(function(){return Se?_:(Y.width=fe,Y.height=Ie,oe.__processStages(T,ve,_,Y))}).then(function(ye){return ve&&(ve.width=ve.height=0),ye})},I.prototype.__resizeViaCreateImageBitmap=function(T,L,_){var Y=this,oe=L.getContext("2d");return this.debug("Resize via createImageBitmap()"),createImageBitmap(T,{resizeWidth:_.toWidth,resizeHeight:_.toHeight,resizeQuality:g.cib_quality_name(x.f2q[_.filter])}).then(function(te){if(_.canceled)return _.cancelToken;if(!_.unsharpAmount)return oe.drawImage(te,0,0),te.close(),oe=null,Y.debug("Finished!"),L;Y.debug("Unsharp result");var Q=Y.options.createCanvas(_.toWidth,_.toHeight),fe=Q.getContext("2d");fe.drawImage(te,0,0),te.close();var Ie=fe.getImageData(0,0,_.toWidth,_.toHeight);return Y.__mathlib.unsharp_mask(Ie.data,_.toWidth,_.toHeight,_.unsharpAmount,_.unsharpRadius,_.unsharpThreshold),oe.putImageData(Ie,0,0),Q.width=Q.height=0,Ie=fe=Q=oe=null,Y.debug("Finished!"),L})},I.prototype.resize=function(T,L,_){var Y=this;this.debug("Start resize...");var oe=d({},O);if(isNaN(_)?_&&(oe=d(oe,_)):oe=d(oe,{quality:_}),oe.toWidth=L.width,oe.toHeight=L.height,oe.width=T.naturalWidth||T.width,oe.height=T.naturalHeight||T.height,Object.prototype.hasOwnProperty.call(oe,"quality")){if(oe.quality<0||oe.quality>3)throw new Error("Pica: .quality should be [0..3], got ".concat(oe.quality));oe.filter=x.q2f[oe.quality]}if(L.width===0||L.height===0)return Promise.reject(new Error("Invalid output size: ".concat(L.width,"x").concat(L.height)));oe.unsharpRadius>2&&(oe.unsharpRadius=2),oe.canceled=!1,oe.cancelToken&&(oe.cancelToken=oe.cancelToken.then(function(Q){throw oe.canceled=!0,Q},function(Q){throw oe.canceled=!0,Q}));var te=3;return oe.__destTileBorder=Math.ceil(Math.max(te,2.5*oe.unsharpRadius|0)),this.init().then(function(){if(oe.canceled)return oe.cancelToken;if(Y.features.cib){if(x.q2f.indexOf(oe.filter)>=0)return Y.__resizeViaCreateImageBitmap(T,L,oe);Y.debug("cib is enabled, but not supports provided filter, fallback to manual math")}if(!D){var Q=new Error("Pica: cannot use getImageData on canvas, make sure fingerprinting protection isn't enabled");throw Q.code="ERR_GET_IMAGE_DATA",Q}var fe=b(oe.width,oe.height,oe.toWidth,oe.toHeight,Y.options.tile,oe.__destTileBorder);return Y.__processStages(fe,T,L,oe)})},I.prototype.resizeBuffer=function(T){var L=this,_=d({},O,T);if(Object.prototype.hasOwnProperty.call(_,"quality")){if(_.quality<0||_.quality>3)throw new Error("Pica: .quality should be [0..3], got ".concat(_.quality));_.filter=x.q2f[_.quality]}return this.init().then(function(){return L.__mathlib.resizeAndUnsharp(_)})},I.prototype.toBlob=function(T,L,_){return L=L||"image/png",new Promise(function(Y){if(T.toBlob){T.toBlob(function(Ie){return Y(Ie)},L,_);return}if(T.convertToBlob){Y(T.convertToBlob({type:L,quality:_}));return}for(var oe=atob(T.toDataURL(L,_).split(",")[1]),te=oe.length,Q=new Uint8Array(te),fe=0;femR});module.exports=x_e(knt);var MDe=Ae(Ya());var hJ=Ae(mJ()),Z$=class{constructor(){this.lang="en";this.all={en:{hintText:{fileName:"Enter File Name",alias:"Enter Display Name",dragDropModifierKeys:"Hold ${1} to Pin and ${2} to Copy",createListItem:"Select/Create List Item Frame",dragDropProperties:"Drag and drop properties to link them into the list",newItem:"+ New",selectNote:"Select Note...",newFrame:"New"},defaults:{spaceNote:"Current Note",spaceContext:"Current Space"},commands:{h1:"Heading 1",h2:"Heading 2",h3:"Heading 3",h4:"Heading 4",h5:"Heading 5",h6:"Heading 6",columns:"Columns",tabs:"Tabs",button:"Button",label:"Label",column:"Column",idea:"New",group:"Group",paragraph:"Text",card:"Card",progress:"Progress",rating:"Rating",circularProgress:"Circular Progress",list:"Bullet List","ordered-list":"Numbered List",todo:"To-do List",quote:"Quote",internal:"Link to Note",context:"Embed Existing Context",flow:"Embed Note or Space",board:"New Board",divider:"Divider",note:"Note Block",link:"Web Link",internalLink:"Link",callout:"Callout",bookmark:"Bookmark",table:"New Table",codeblock:"Code Block",toggle:"Toggle",emoji:"Emoji",image:"Image",newNote:"Note",tag:"Tag",makeMenu:"Flow Menu",selectStyle:"Style",toggleKeyboard:"Toggle Keyboard",rows:"Rows",masonry:"Gallery"},styles:{bold:"Bold",italics:"Italics",strikethrough:"Strikethrough",code:"Code",link:"Web Link",blocklink:"Link to Note",textColor:"Text Color",highlight:"Highlight"},commandsSuggest:{noResult:"No result"},commandPalette:{enable:"Enable",disabled:"Disable",openFlow:"Open Flow Blocks in Selection",closeFlow:"Close Flow Blocks in Selection",toggleBold:"Toggle Bold",toggleItalics:"Toggle Italics",openSpaces:"Open Navigator",blink:"Blink",openFileContext:"Open Explorer",convertPathToSpace:"Convert to Space",revealFile:"Reveal File in Navigator",releaseNotes:"Release Notes",getStarted:"Get Started",toggleBacklinks:"Toggle Backlinks",collapseAllFolders:"Collapse All Folders",addFileSpace:"Add File to Space",removeFileSpace:"Remove File from Space"},frames:{sections:{kit:"Kit",paths:"Paths"},label:{label:"Label",description:"Label"},note:{label:"Note",description:"Link to a note"},table:{label:"Table",description:"Table"},context:{label:"Context",description:"Display a context view from another space"},calendar:{label:"Calendar View"},field:{label:"Field",description:"Dynamic node that displays a value based on property type"},event:{label:"Event"},divider:{label:"Divider",description:"Divider to separate your content"},button:{label:"Button",description:"Buttons can perform actions and open links"},callout:{label:"Callout",description:"Callout to highlight important information"},toggle:{label:"Toggle",description:"Toggle to show/hide content"}},menu:{layout:"Layout",enterFlowState:"Enter Flow State",exitFlowState:"Exit Flow State",newView:"New View",calendarView:"Calendar View",dayView:"Day View",closeSpace:"Close Space in Focus",customView:"Custom View",detailsView:"Details View",catalogView:"Catalog View",galleryView:"Gallery View",deleteContext:"Delete Context",openSpace:"Open",revealInDefault:"Reveal in Finder",revealInExplorer:"Reveal in Explorer",setNone:"None",fileMetadataDescription:"This note only",openFilePane:"Open in a new pane",rename:"Rename",changeToFolderNote:"New Space from Note",moveFile:"Move file to...",moveFolder:"Move folder to...",duplicate:"Make a copy",edit:"Edit",delete:"Delete",getHelp:"Make.md Community",vault:"Vault",openVault:"Open Another Vault",openVaultInFolder:"Open Vault Folder",obSettings:"Obsidian Settings",commandPalette:"Command Palette",backToSpace:"Back to Navigator",collapseAllSections:"Collapse All Spaces",expandAllSections:"Expand All Spaces",collapseAllFolders:"Collapse All Folders",expandAllFolders:"Expand All Folders",spaceTitle:"Add/Remove in Space",home:"Home",none:"None",tableView:"Table View",cardView:"Card View",boardView:"Board View",listView:"List View",flowView:"Flow View",groupBy:"Group",sortBy:"Sort",filters:"Filters",newFilter:"New Filter",clearFilters:"Clear Filters",hide:"Hide",unhideFields:"Unhide All Properties",importDataview:"Import All Dataview Properties",saveAllProperties:"Save All Properties to Files",mergeProperties:"Merge Properties",removeFromSpace:"Unpin from Space",editCode:"Edit Code",editProperties:"Edit Properties",properties:"Properties",deleteProperty:"Delete Property",hideProperty:"Hide Property",unhideProperty:"Unhide Property",saveProperty:"Save Property",sortAscending:"Sort Ascending",sortDescending:"Sort Descending",deleteRow:"Delete Item",collapseAll:"Collapse All",customSort:"Custom Sort",groupSpaces:"Group Spaces",recurisveSort:"Apply to Subfolders",fileNameSortAlphaAsc:"File Name (A to Z)",fileNameSortAlphaDesc:"File Name (Z to A)",fileNameSortNumericalAsc:"File Name (1 to 9)",fileNameSortNumericalDesc:"File Name (9 to 1)",createdTimeSortAsc:"Created Time (new to old)",createdTimeSortDesc:"Created Time (old to new)",modifiedTimeSortAsc:"Modified Time (new to old)",modifiedTimeSortDesc:"Modified Time (old to new)",sizeSortAsc:"Size (smallest to largest)",sizeSortDesc:"Size (largest to smallest)",spaces:"Spaces",tags:"Tags",manageHiddenFiles:"Manage Hidden Files",manageActions:"Manage Actions",deleteSpace:"Delete",changeColor:"Change Color",changePropertyType:"Change Type",deleteFiles:"Delete Files",createFolderSpace:"Create Space from Folder",folder:"Folder",syncToContext:"Add Property to Context",setIcon:"Set Icon",copyEmbedLink:"Copy Embed Link",moveUp:"Move Up",moveDown:"Move Down",moveTo:"Move To",groupNodes:"Group Nodes",moveFrame:"Move Frame",renameFrame:"Rename Frame",deleteFrame:"Delete Frame",insertAbove:"Insert Above",insertBelow:"Insert Below"},editor:{rows:"Rows",columns:"Columns",catalog:"Catalog",gallery:"Gallery",grid:"Grid",scaleToFit:"Change to Fit",scaleToFill:"Change to Fill",fit:"Fit",strokeNone:"None",strokeSolid:"Solid",strokeDotted:"Dotted",strokeDashed:"Dashed",size:"Size",gap:"Gap",marginLeft:"Left",marginTop:"Top",marginRight:"Right",marginBottom:"Bottom",minimize:"Minimize",paddingLeft:"Left",paddingTop:"Top",paddingRight:"Right",paddingBottom:"Bottom",unlinkProperty:"Unlink Property",linkedProperty:"Linked Property",linkProperty:"Link Property",currentSpace:"Current Space",linkName:"${1} Link",linkThumbnail:"${1} Thumbnail",linkSticker:"${1} Sticker",opacity:"Opacity",shadowSpread:"Spread",shadowBlur:"Blur",width:"Width",height:"Height",margin:"Margin",padding:"Padding",bold:"Bold",italic:"Italic",underline:"Underline",alignLeft:"Align Left",alignCenter:"Align Center",alignRight:"Align Right",alignJustify:"Align Justify",numberOfLines:"Lines",createVerticalSection:"Create Vertical Section",createHorizontalSection:"Create Horizontal Section",themeColors:"Theme Colors",uiColors:"UI Colors",hex:"Hex"},buttons:{add:"Add",togglePin:"Toggle Pin",refresh:"Refresh",showHidden:"Show Hidden",alias:"Alias",addFilter:"Add Filter",loadMore:"Load More",addCondition:"Add Condition",customize:"Customize",moreOptions:"More Options",saveProperty:"Save Property",newNote:"New Note",changeIcon:"Change Sticker",removeIcon:"Remove Sticker",addIcon:"Add Sticker",addCover:"Add Cover",addDisplay:"Display Name",changeBanner:"Change Cover",changeBannerShort:"Cover",saveChanges:"Save Changes",removeBanner:"Remove Cover",rename:"Change Name",editFrame:"Edit Frame",saveSpace:"Save Space",createSpace:"New Space",createFolder:"New Folder",createNote:"New Note",createCanvas:"New Canvas",addIntoSpace:"New Pin",addSmartSearch:"Add Live Search",subFolders:"Sub Folders",addItem:"Add Item",addProperty:"Add Property",editProperty:"Edit Property",addContext:"Add Context",cancel:"Cancel",search:"Search",delete:"Delete",toggleFlow:"Toggle Flow",openFlow:"Open Flow",hideFlow:"Hide Flow",openLink:"Open Link",addToSpace:"Add to Space",addToSpaceShort:"Pin",addTag:"Add Tag",tag:"Tag",syncFields:"Sync Properties",convertTable:"Convert to Markdown",cutTable:"Cut Table",deleteTable:"Delete From Note",blink:"Blink",addFile:"Add Item",merge:"Merge",saveView:"Save View",saveTable:"Save Table",renameView:"Rename View",deleteView:"Delete View",renameTable:"Rename Table",renameTag:"Rename Tag",createTag:"Create Tag",currentFolder:"Current Folder",sync:"Sync",pasteCSS:"Paste CSS",save:"Save",run:"Run"},metadataTypes:{fileName:"File Name",contexts:"Contexts",path:"Path",folder:"Folder",sticker:"Sticker",color:"Color",created:"Created",lastModified:"Last Modified",extension:"Extension",size:"Size",tags:"Tags",inlinks:"Linked Mentions",outlinks:"Links",label:"Label",fileMetadata:"File Metadata",frontmatter:"Frontmatter"},filterTypes:{contains:"contains",notContains:"does not contain",is:"is",isNot:"is not",before:"before",after:"on or after",anyOf:"is any of",noneOf:"is none of",checked:"is checked",unchecked:"is unchecked",isEmpty:"is empty",isNotEmpty:"is not empty",isSameDate:"is same date",isSameDateAsToday:"today"},sortTypes:{alphaAsc:"A to Z",alphaDesc:"Z to A",earliest:"Earliest",latest:"Latest",checkAsc:"Checked \u2192 Unchecked",checkDesc:"Unchecked \u2192 Checked",itemsAsc:"Least Items",itemsDesc:"Most Items"},properties:{defaultField:"Name",aggregate:{label:"Aggregate",description:"Aggregate functions to calculate values"},audio:{label:"Audio",description:"Audio"},text:{label:"Text",description:"Text field"},number:{label:"Number",description:"Number field with optional unit"},boolean:{label:"Yes/No",description:"Yes or No toggle to indicate the status"},date:{label:"Date",description:"Select a date from a calendar"},option:{label:"Option",description:"Select one or multiple option from a list"},file:{label:"File"},link:{label:"Link",description:"Link to another note or a website"},tags:{label:"Tags",description:"Use tags to quickly organize your items"},object:{label:"Object",description:"Store any complex objects"},context:{label:"Relation",description:"Connect to another context property and create a relation"},image:{label:"Image",description:"Select any image from your system or from the internet"},color:{label:"Color",description:"Use colors to label your items or status"},space:{label:"Context",description:"Link to a context"},icon:{label:"Sticker",description:"Use stickers to uniquely label your items or status"},super:{label:"Super Property",links:"Open Link",properties:"Update Property",api:"API",obsidianCommands:"Run Command",runCommand:"Run Command",performAction:"Perform Action",whenClicked:"When Clicked"},fileProperty:{name:"Name",label:"Formula",createdTime:"Created",modifiedTime:"Last Edited",sticker:"Sticker",links:"Links",tags:"Tags",spaces:"Spaces",extension:"Extension",size:"Size",preview:"Note Preview",parentFolder:"Folder",description:"Use a formula to dynamically display a property"}},views:{navigator:"Navigator",explorer:"Explorer",space:"Space"},subViews:{spaceItems:"Items",spaceContext:"Context",spaceLists:"Lists",spaceActions:"Actions",spaceTemplates:"Templates",smartSearch:"Live Searches",filesAndFolders:"Files and Folders"},labels:{duplicateTable:"Duplicate Table",aggregateBy:"Aggregate By",pinned:"Pinned",live:"Pinned by Live Search",moveTable:"Move Table",editFormula:"Edit Formula",editObject:"Edit Object",properties:"Properties",newAction:"Action",newTable:"List",template:"Template",createFolder:"New Folder Name",rename:"Rename",createNew:"New",default:"Default",done:"Done",changeCoverShort:"Change",reposition:"Reposition",tables:"Tables",selectDateFormat:"Select/Type Date Format",renameSection:"Edit Space",createSection:"New Folder",createNote:"New Note",contextMaker:"Context Maker",select:"Select",pinnedItems:"Pinned Items",collapse:"Collapse",expand:"Expand",all:"All",none:"None",view:"View",findStickers:"Find Sticker",mergeProperties:"Merge Properties",placeholder:"Type '${1}' for commands",notePlaceholder:"New Note for ${1}",itemsSelected:"${1} Selected",selectNote:"Select Note",selectIcon:"Select Icon",selectImage:"Select Image",selectSpace:"Select Space",styleSmall:"Small",styleMedium:"Medium",styleLarge:"Large",hiddenFilePattern:"Name, Suffixes and Extension",hiddenFileSpecific:"Exclude specific files and folders",textPlaceholder:"Enter Text",noFile:"is not created yet. Click to create.",navigatorSearchPlaceholder:"Search by Text or Filters",blinkPlaceholder:"Search for notes, spaces...",searchPlaceholder:"Type to search...",contextItemSelectPlaceholder:"Find Item",linkItemSelectPlaceholder:"Find or Create Note",pinNotePlaceholder:"Select a Note or Space to Pin",optionItemSelectPlaceholder:"Select Option",viewItemSelectPlaceholder:"Select View",tagItemSelectPlaceholder:"Find Tag",spaceSelectPlaceholder:"Select any Folder or Tag",propertyItemSelectPlaceholder:"Select Property",sortItemSelectPlaceholder:"Select Sort",filterItemSelectPlaceholder:"Select Filter",imageSelectPlaceholder:"Select an image or paste a URL",imageNotFoundPlaceholder:"No Images Found",syncFrontmatterProperty:"Sync Frontmatter Property",newProperty:"New Property",newPropertyShort:"New Property",propertyType:"Type",propertyDynamic:"Dyanmic",propertyValueSpace:"Space",propertyValueReference:"Related Property",propertyValueAggregate:"Aggregate Property",propertyValueProperty:"Property",propertyLookup:"Edit Formula",existingFrontmatter:"Existing Property",dateFormat:"Date Format",propertyFileProp:"Property",multiple:"Multiple",filesCount:"{$1} Files",hiddenFiles:"Hidden Files",addExtension:"Add Rule",saveView:"Save View",saveTable:"Save Table",renameView:"Rename View",renameTable:"Rename Table",syncMetadata:"Sync Metadata",syncProperties:"Sync Properties",selectContext:"Select Context",metadata:"Metadata",backlinks:"Backlinks",spaces:"Spaces",contexts:"Contexts",content:"Content",deleteSpace:"Delete Space",deleteFiles:"Delete Files",outgoingLinks:"Outgoing Links",moveTo:"Move to",addTo:"Pin to",copyTo:"Copy to",reorderIn:"Reorder in",border:"Border",corners:"Corners",color:"Color",backgroundColor:"Background",cornerRadius:"Radius",onClick:"On Click",layout:"Layout",element:"Element",name:"Name",display:"Display",alignment:"Alignment",margin:"Margin",padding:"Padding",gap:"Gap",width:"Width",height:"Height",opacity:"Opacity",shadow:"Shadow",shadowBlur:"Blur",shadowSpread:"Spread",typography:"Typography",layers:"Layers",fontSize:"Size",props:"Props",styles:"Styles",events:"Events",code:"Code",selectedLayers:"${1} Layers"},descriptions:{spaceActions:"Create actions that runs when you press a button",spaceLists:"Create lists to track data and organize them in your space",spaceItems:"Add new items to the space or pin items to the space",spaceTemplates:"Create templates to quickly add items to your space",smartSearch:"Automatically pin notes to this space based on a set of searches",hiddenFileOptions:"Exclude any files and folders by name, suffix or extension.",deleteSpace:"Deleting the space will also delete the folder and its contents.",deleteFiles:"Delete ${1} files/folders and their contents?",addContext:"Contexts lets you connect properties from your tags",spaceProperties:"Define Properties for your Space Items",syncMetadata:"Select which fields from your notes to start syncing with the context.",syncProperties:"Contexts defines and syncs the same fields across your notes depending on their folder or tag.",selectContext:"Select which folder or tag context you want to sync the fields."},flowView:{emptyDoc:"Empty Document",itemsCount:" Items",emptyFolder:"This Folder is Empty"},notice:{duplicateFile:"Folder already contains note with same name",addedToSection:"Added to Space",fileExists:"File Already Exists",folderExists:"Folder Already Exists",noPropertyName:"Property Name is Required",noPropertiesFound:"No Properties Found",duplicatePropertyName:"Duplicate Property Name",newSpaceName:"Enter a name for your space",duplicateSpaceName:"Space name already exists",cantConvertNoteToSpace:"The view is not a note",templateSaved:"Template saved to space: ",tableDeleted:"Table removed from note, you can find the table in the folder space"},settings:{sections:{general:"General",navigator:"Navigator",appearance:"Appearance",interaction:"Preferences",context:"Context",label:"Labels",tags:"Tags",space:"Spaces",performance:"Performance",advanced:"Advanced",folderNote:"Folder Note",notes:"Notes"},searchWorker:{name:"Background Search",desc:"Search in background to improve reponsiveness while searching"},cacheIndex:{name:"Cache Search Index",desc:"Cache the index for faster search results"},layoutVertical:"Vertical",layoutHorizontal:"Horizontal",sectionGeneral:"General",sectionSidebar:"Spaces",sectionEditor:"Maker Mode",sectionFlow:"Flow",sectionAdvanced:"Advanced",sectionDataview:"Dataview",sectionContext:"Context",sectionStickers:"Labels",sectionNavigator:"Navigator",sectionDefault:"Default Spaces",sectionSpaceView:"Space View",sectionBlink:"Blink",sectionInlineContext:"Inline Context",sectionFlowBlock:"Flow Block",sectionFlowMenu:"Flow Menu",sectionFlowStyler:"Flow Styler",experimental:{name:"Experimental",desc:"Experimental features that are subject to change and may not be optimized for performance"},imageThumbnails:{name:"Generate Thumbnails",desc:"Create thumbnails for images to speed up performance"},minimalThemeFix:{name:"Minimal Theme Fix",description:"Apply fixes for the popular theme Minimal"},inlineStickerMenu:{name:"Inline Stickers",desc:"Add inline stickers by typing :"},openSpacesOnLaunch:{name:"Open Navigator as Default Tab",desc:"Open the Navigator tab when Obsidian launches"},spacesRightSplit:{name:"Navigator on Right Side",desc:"Open the Navigator in the right panel"},defaultSpaceTemplate:{name:"Default Space Template",desc:"Select the default template for new spaces"},defaultDateFormat:{name:"Default Date Format",desc:"Set the default date format, example: yyyy-MM-dd (see https://date-fns.org/v2.30.0/docs/format)"},defaultTimeFormat:{name:"Default Time Format",desc:"Set the default time format, example: h:mm a (see https://date-fns.org/v2.30.0/docs/format)"},autoAddContextsToSubtags:{name:"Apply Properties to Subtags",desc:"Automatically apply context properties to subtags"},newNotePlaceholder:{name:"New Note Placeholder",desc:"Default name for new notes"},folderIndentationLines:{name:"Show Folder Indentation Lines",desc:"Turn on to show a line on the left of folders to indicate indentation"},folderNoteLocation:{name:"Folder Note Location Inside Folder",desc:"Turn on to have folder notes inside the folder, turn off to have it outside"},folderViewDefault:{name:"Show Folder Note by Default",desc:"Show the folder note by default when opening a folder"},internalLinkFlowEditor:{name:"Show Toggles to Open Flow Editor on Links",desc:"Turn on to toggle Flow Blocks directly in inline links"},internalLinkSticker:{name:"Show Stickers on Links",desc:"Turn on to toggle stickers shown directly by beside internal links"},saveAllContextToFrontmatter:{name:"Sync Context Fields to Frontmatter",desc:"Turn on to automatically save all context fields to frontmatter fields, not just existing frontmatter fields."},syncFormulaToFrontmatter:{name:"Sync Formula Fields to Frontmatter",desc:"Turn on to save calculated formula values to frontmatter fields."},spaceSubFolder:{name:"Space Folder Name",desc:"Name of the folder for spaces"},basics:{name:"Make.md Basics",desc:"Enable features from Make.md Basics including styler and flow blocks"},spacesFolder:{name:"Tag Space Folder",desc:"Name of the folder for tag spaces"},dataviewInlineContext:{name:"Show Dataview in Inline Context",desc:"Show dataview when inline context is enabled"},inlineContext:{name:"Notes Header",desc:"Show a header to display labels and properties"},banners:{name:"Cover Image",desc:"Show a cover image for notes and spaces"},inlineContextProperties:{name:"Show Context Properties in Header",desc:"Show the properties in the header for notes and spaces"},inlineContextExpanded:{name:"Auto Expand Context Properties",desc:"Expand the inline context sections when opening a note"},inlineContextNameLayout:{name:"Title and Sticker Layout",desc:"Layout for inline title and sticker in Inline Context"},hideFrontmatter:{name:"Hide Context Properties",desc:"Hide properties you have added in context from the Obsidian properties panel"},autoOpenFileContext:{name:"Auto Open Explorer",desc:"Automatically open explorer panel in the right panel"},enableFolderNote:{name:"Enable Folder Note",desc:"Access the folder note in the folder page and hide the folder note from spaces"},folderNoteName:{name:"Folder Note Name",desc:"Name of the folder note, keep blank to use the same name as the folder"},expandFolderOnClick:{name:"Auto Expand Folder",desc:"Auto expand folders on click"},filePreviewOnHover:{name:"Preview on Hover",desc:"Preview on Hover while holding Control/Command key"},revealActiveFile:{name:"Reveal Active File",desc:"Automatically reveal the active file in Navigator"},contextEnabled:{name:"Contexts",desc:"Contexts allows you to have full control over the metadata of your files"},navigatorEnabled:{name:"Navigator",desc:"The navigator lets you create and organize your spaces"},spacesStickers:{name:"Stickers",desc:"Use Emojis to make it easier to find your notes"},spacesUseAlias:{name:"Alias",desc:"Use the alias metadata to show in Navigator"},spacesDisablePatch:{name:"Compatibility Mode",desc:"This will improve the compatibility of plugins while using the Navigator"},deleteFileOption:{name:"Delete File Option",desc:"Select how you want files to be deleted"},spacesDeleteOptions:{permanant:"Delete Permanently",trash:"Move to Obsidian Trash","system-trash":"Move to System Trash"},flowState:{name:"Flow State",desc:"Toggle the flow state"},showRibbon:{name:"App Ribbon",desc:"Show/hide the left menu aka. ribbon"},spaceViewEnabled:{name:"Spaces",desc:"Customize your folders and tags with properties and views"},defaultSpaces:{name:"Default Spaces",desc:"Recommended spaces for quickly organizing your vault"},homeSpace:{name:"Home Space",desc:"An easy-to-access space where you can add/organize your other spaces"},enableDefaultSpaces:{name:"Tag Spaces",desc:"Automatically create spaces for each of your tags"},readableLineWidth:{name:"Readable Line Width",desc:"Use Readable Line Width"},sidebarTabs:{name:"Sidebar Tabs",desc:"Show/hide other sidebar tabs"},spacesPerformance:{name:"Navigator Scroll Performance",desc:"Turn on performance mode for Navigator, may affect scrolling appearance. Requires Restart"},indexSVG:{name:"Use SVGs as Stickers",desc:"Use any svg file in your vault as a sticker"},inlineStyler:{name:"Flow Styler",desc:"Select text to add styling"},inlineStylerColor:{name:"Text and Highlight Colors \u{1F9EA}",desc:"Select text color and highlight color, (this may change in the future because of the limitations with HTML and Obsidian)"},spaceRowHeight:{name:"Row Height",desc:"The height for each row in navigator (in pixels), default is 29"},contextPagination:{name:"Table View Pagination",desc:"Number of items per page in table view"},bannerHeight:{name:"Cover Height",desc:"The height for the cover of the note or space, default is 200"},makeChar:{name:"Flow Menu Trigger",desc:"Character to open the Flow Menu"},mobileMakeBar:{name:"Flow Styler (Mobile)",desc:"Replaces the mobile toolbar"},editorMarkSans:{name:"Mark Sans \u{1F9EA}",desc:"Use the editor without Markdown."},editorMakePlacholder:{name:"Flow Menu Hint Text",desc:"Show a hint text on how to open the Flow Menu Shortcut"},blinkEnabled:{name:"Blink",desc:"A faster way to search and edit your notes"},editorMakeMenu:{name:"Flow Menu",desc:"Open the Flow menu to quickly add content"},editorMakeMenuTrigger:{name:"Flow Menu Shortcut",desc:"Trigger key to use flow menu"},editorFlowReplace:{name:"Flow Block",desc:"Open your internal links or toggle your embeds in the flow block."},editorFlowStyle:{name:"Flow Block Style",desc:"Select a theme for your flow block",seamless:"Seamless",minimal:"Minimal"}}}};this.lang="en";let t=hJ.default.locale();["en"].includes(t)&&(this.lang=t)}get texts(){return this.all.en}},H=new Z$().texts;var pA=(e,t)=>JSON.stringify({...t,options:e.map(r=>({name:r.name,value:r.value,color:r.color}))});var Zg="spaces://$",kx="spaces://$tags";var Er="files",yp={id:Er,name:"Items",type:"db",primary:"true"};var Cx=(e,t,r)=>!t||t<=0?[r,...e]:[...e.slice(0,t),r,...e.slice(t)],Dx=(e,t,r)=>!t||t<=0?[...r,...e]:[...e.slice(0,t),...r,...e.slice(t)],kr=e=>[...new Set(e)],mM=e=>[...new Map(e.map(t=>[t.toLowerCase(),t])).values()],Mi=(e,t)=>{let r=e;if(t.includes(r)){let n=1;for(;t.includes(r);)r=e+n.toString(),n+=1}return r},AJ=e=>(t,r,n)=>n.findIndex(i=>t[e]==i[e])===r;var gJ=(e,t,r)=>e.sort(function(n,i){let a=t.indexOf(n[r]),o=t.indexOf(i[r]);return a>o?a!=-1&&o==-1?-1:1:o!=-1&&a==-1?1:-1});var Tu=e=>e=="/"?e:e.slice(-1)=="/"?e.substring(0,e.length-1):e;var cc=e=>{let t=e,r="",n=A=>{let b={};return A.split("&").forEach(v=>{let[x,w]=v.split("=");b[decodeURIComponent(x)]=decodeURIComponent(w)}),b},i=(A,b)=>b?A==="^"?"context":A==="*"?"frame":A===";"?"action":null:A==="^"?"block":"heading",a=null,o=null,s=null,l=null,u=null,c=null,f="vault";if(t.indexOf("://")!=-1){f=e.slice(0,e.indexOf("://"));let A=e.slice(e.indexOf("://")+3);if(A.charAt(0)=="#"||A.charAt(0)=="$"){let b=A.split("/")[0].lastIndexOf("#");b>0?(a=Tu(A.slice(0,b)),e=A.slice(b)):(a=A.split("/")[0],e=A.replace(a,""),e.length>0&&(e=e.slice(1)),e==""&&(e="/"))}else{let b=A.split("/");a=b[0],e=b.slice(1).join("/")||""}}let d=e.lastIndexOf("/"),p=e.lastIndexOf("#"),h=e.lastIndexOf("|"),m=e.lastIndexOf("?"),g=!1;if(m!==-1&&(c=n(e.slice(m+1)),e=e.slice(0,m)),p!==-1&&p>d){p==d+1&&(g=!0);let A=e.slice(p+1);u=i(A[0],g),(u||p!=d+1)&&(r=A[0],l=u?A.slice(1):A,e=e.slice(0,p))}return h!==-1&&h>d&&(s=e.slice(h+1),e=e.slice(0,h)),e.charAt(e.length-1)=="/"&&(g=!0),o=e,{basePath:Tu(`${a?`${f}://${a}/${o!="/"?o:""}`:o}`),authority:a,fullPath:t,scheme:f,path:Tu(e),alias:s,ref:l,refType:u,refStr:u?r+l:l,query:c,trailSlash:g}},jm=(e,t)=>{let r=e.split("/");return t+"/"+r[r.length-1]},vJ=(e,t)=>{let r=e.substring(0,e.lastIndexOf("/"));return r.length>0?`${r}/${t}`:`${t}`},yJ=(e,t)=>{let r=e.substring(0,e.lastIndexOf("/")),n=e.lastIndexOf(".")!=-1?e.substring(e.lastIndexOf(".")):"";return r.length>0?`${r}/${t}${n}`:`${t}${n}`};var hM=(e,t)=>!e||e.length==0?t:e;function dl(e){return Array.isArray(e)?e:typeof e=="string"?[e]:[]}function bJ(e,t,r){let n=Bs(e);return t.some(i=>i==n)?n:r}function Bs(e){if(!e)return"";if(typeof e!="string"){let t=e.toString();return typeof t=="string"?t:""}return e}function XE(e){return!!e}var xJ=(e,t)=>t.indexOf(e)>0?t.indexOf(e):t.length,wJ=(e,t)=>t.spacesIndex.get(e)?.name??e,SJ=e=>"spaces://"+KE(e),KE=e=>e?.replace(/\//g,"+"),Wn=e=>"spaces://"+e;var EJ=e=>e?`(${e})`:null,jr=e=>e?`"${e.replace(/"/g,'\\"').replace(/\n/g,"\\n")}"`:null,X$=e=>{if(!e)return e;if(e.startsWith("(")){if(e.endsWith(")"))return e.substring(1,e.length-1);if(e.endsWith(");"))return e.substring(1,e.length-2)}return e},wa=e=>{if(!e)return e;if(typeof e=="number")return e.toString();let t=e.startsWith("'")&&(e.endsWith("';")||e.endsWith("'")),r=e.startsWith('"')&&(e.endsWith('";')||e.endsWith('"'));return t||r?(e=e.substring(1,e.length-1),(e.endsWith('"')||e.endsWith("'"))&&(e=e.substring(0,e.length-1)),e.replace(/\\"/g,'"')):e.replace(/\\"/g,'"')},mA=(e,t)=>!e||e.length==0?t:e,AM=e=>e.charAt(0)=="/"?e.substring(1):e,kJ=e=>AM(e.substring(0,e.lastIndexOf("/")))||e;function Rs(e){return Rs=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Rs(e)}function Cr(e){if(e===null||e===!0||e===!1)return NaN;var t=Number(e);return isNaN(t)?t:t<0?Math.ceil(t):Math.floor(t)}function ut(e,t){if(t.length1?"s":"")+" required, but only "+t.length+" present")}function Mt(e){ut(1,arguments);var t=Object.prototype.toString.call(e);return e instanceof Date||Rs(e)==="object"&&t==="[object Date]"?new Date(e.getTime()):typeof e=="number"||t==="[object Number]"?new Date(e):((typeof e=="string"||t==="[object String]")&&typeof console<"u"&&(console.warn("Starting with v2.0.0-beta.1 date-fns doesn't accept strings as date arguments. Please use `parseISO` to parse strings. See: https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#string-arguments"),console.warn(new Error().stack)),new Date(NaN))}function oa(e,t){ut(2,arguments);var r=Mt(e),n=Cr(t);return isNaN(n)?new Date(NaN):(n&&r.setDate(r.getDate()+n),r)}function Uo(e,t){ut(2,arguments);var r=Mt(e),n=Cr(t);if(isNaN(n))return new Date(NaN);if(!n)return r;var i=r.getDate(),a=new Date(r.getTime());a.setMonth(r.getMonth()+n+1,0);var o=a.getDate();return i>=o?a:(r.setFullYear(a.getFullYear(),a.getMonth(),i),r)}function Sa(e,t){if(ut(2,arguments),!t||Rs(t)!=="object")return new Date(NaN);var r=t.years?Cr(t.years):0,n=t.months?Cr(t.months):0,i=t.weeks?Cr(t.weeks):0,a=t.days?Cr(t.days):0,o=t.hours?Cr(t.hours):0,s=t.minutes?Cr(t.minutes):0,l=t.seconds?Cr(t.seconds):0,u=Mt(e),c=n||r?Uo(u,n+r*12):u,f=a||i?oa(c,a+i*7):c,d=s+o*60,p=l+d*60,h=p*1e3,m=new Date(f.getTime()+h);return m}function ad(e,t){ut(2,arguments);var r=Mt(e).getTime(),n=Cr(t);return new Date(r+n)}var S_e=36e5;function Ox(e,t){ut(2,arguments);var r=Cr(t);return ad(e,r*S_e)}var E_e={};function Gl(){return E_e}function mo(e,t){var r,n,i,a,o,s,l,u;ut(1,arguments);var c=Gl(),f=Cr((r=(n=(i=(a=t?.weekStartsOn)!==null&&a!==void 0?a:t==null||(o=t.locale)===null||o===void 0||(s=o.options)===null||s===void 0?void 0:s.weekStartsOn)!==null&&i!==void 0?i:c.weekStartsOn)!==null&&n!==void 0?n:(l=c.locale)===null||l===void 0||(u=l.options)===null||u===void 0?void 0:u.weekStartsOn)!==null&&r!==void 0?r:0);if(!(f>=0&&f<=6))throw new RangeError("weekStartsOn must be between 0 and 6 inclusively");var d=Mt(e),p=d.getDay(),h=(p=i.getTime()?r+1:t.getTime()>=o.getTime()?r:r-1}function J$(e){ut(1,arguments);var t=K$(e),r=new Date(0);r.setFullYear(t,0,4),r.setHours(0,0,0,0);var n=tf(r);return n}function hA(e){var t=new Date(Date.UTC(e.getFullYear(),e.getMonth(),e.getDate(),e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds()));return t.setUTCFullYear(e.getFullYear()),e.getTime()-t.getTime()}function Hn(e){ut(1,arguments);var t=Mt(e);return t.setHours(0,0,0,0),t}var k_e=864e5;function od(e,t){ut(2,arguments);var r=Hn(e),n=Hn(t),i=r.getTime()-hA(r),a=n.getTime()-hA(n);return Math.round((i-a)/k_e)}var C_e=6e4;function JE(e,t){ut(2,arguments);var r=Cr(t);return ad(e,r*C_e)}function Xg(e,t){ut(2,arguments);var r=Cr(t),n=r*7;return oa(e,n)}function gM(e,t){ut(2,arguments);var r=Cr(t);return Uo(e,r*12)}function vM(e){ut(1,arguments);var t;if(e&&typeof e.forEach=="function")t=e;else if(Rs(e)==="object"&&e!==null)t=Array.prototype.slice.call(e);else return new Date(NaN);var r;return t.forEach(function(n){var i=Mt(n);(r===void 0||ri||isNaN(i.getDate()))&&(r=i)}),r||new Date(NaN)}var D_e=365.2425,O_e=Math.pow(10,8)*24*60*60*1e3,eq=6e4,tq=36e5;var iat=-O_e;var M_e=3600;var CJ=M_e*24,aat=CJ*7,j_e=CJ*D_e,N_e=j_e/12,oat=N_e*3;function pl(e,t){ut(2,arguments);var r=Hn(e),n=Hn(t);return r.getTime()===n.getTime()}function C1(e){return ut(1,arguments),e instanceof Date||Rs(e)==="object"&&Object.prototype.toString.call(e)==="[object Date]"}function rq(e){if(ut(1,arguments),!C1(e)&&typeof e!="number")return!1;var t=Mt(e);return!isNaN(Number(t))}function Kg(e,t){ut(2,arguments);var r=Mt(e),n=Mt(t),i=r.getFullYear()-n.getFullYear(),a=r.getMonth()-n.getMonth();return i*12+a}var T_e=6048e5;function nq(e,t,r){ut(2,arguments);var n=mo(e,r),i=mo(t,r),a=n.getTime()-hA(n),o=i.getTime()-hA(i);return Math.round((a-o)/T_e)}function Mx(e){ut(1,arguments);var t=Mt(e);return t.setHours(23,59,59,999),t}function Jg(e){ut(1,arguments);var t=Mt(e),r=t.getMonth();return t.setFullYear(t.getFullYear(),r+1,0),t.setHours(23,59,59,999),t}function Wo(e){ut(1,arguments);var t=Mt(e);return t.setDate(1),t.setHours(0,0,0,0),t}function bM(e){ut(1,arguments);var t=Mt(e),r=new Date(0);return r.setFullYear(t.getFullYear(),0,1),r.setHours(0,0,0,0),r}function AA(e,t){var r,n,i,a,o,s,l,u;ut(1,arguments);var c=Gl(),f=Cr((r=(n=(i=(a=t?.weekStartsOn)!==null&&a!==void 0?a:t==null||(o=t.locale)===null||o===void 0||(s=o.options)===null||s===void 0?void 0:s.weekStartsOn)!==null&&i!==void 0?i:c.weekStartsOn)!==null&&n!==void 0?n:(l=c.locale)===null||l===void 0||(u=l.options)===null||u===void 0?void 0:u.weekStartsOn)!==null&&r!==void 0?r:0);if(!(f>=0&&f<=6))throw new RangeError("weekStartsOn must be between 0 and 6 inclusively");var d=Mt(e),p=d.getDay(),h=(p=i.getTime()?r+1:t.getTime()>=o.getTime()?r:r-1}function oq(e){ut(1,arguments);var t=tk(e),r=new Date(0);r.setUTCFullYear(t,0,4),r.setUTCHours(0,0,0,0);var n=e0(r);return n}var __e=6048e5;function sq(e){ut(1,arguments);var t=Mt(e),r=e0(t).getTime()-oq(t).getTime();return Math.round(r/__e)+1}function t0(e,t){var r,n,i,a,o,s,l,u;ut(1,arguments);var c=Gl(),f=Cr((r=(n=(i=(a=t?.weekStartsOn)!==null&&a!==void 0?a:t==null||(o=t.locale)===null||o===void 0||(s=o.options)===null||s===void 0?void 0:s.weekStartsOn)!==null&&i!==void 0?i:c.weekStartsOn)!==null&&n!==void 0?n:(l=c.locale)===null||l===void 0||(u=l.options)===null||u===void 0?void 0:u.weekStartsOn)!==null&&r!==void 0?r:0);if(!(f>=0&&f<=6))throw new RangeError("weekStartsOn must be between 0 and 6 inclusively");var d=Mt(e),p=d.getUTCDay(),h=(p=1&&p<=7))throw new RangeError("firstWeekContainsDate must be between 1 and 7 inclusively");var h=new Date(0);h.setUTCFullYear(f+1,0,p),h.setUTCHours(0,0,0,0);var m=t0(h,t),g=new Date(0);g.setUTCFullYear(f,0,p),g.setUTCHours(0,0,0,0);var A=t0(g,t);return c.getTime()>=m.getTime()?f+1:c.getTime()>=A.getTime()?f:f-1}function lq(e,t){var r,n,i,a,o,s,l,u;ut(1,arguments);var c=Gl(),f=Cr((r=(n=(i=(a=t?.firstWeekContainsDate)!==null&&a!==void 0?a:t==null||(o=t.locale)===null||o===void 0||(s=o.options)===null||s===void 0?void 0:s.firstWeekContainsDate)!==null&&i!==void 0?i:c.firstWeekContainsDate)!==null&&n!==void 0?n:(l=c.locale)===null||l===void 0||(u=l.options)===null||u===void 0?void 0:u.firstWeekContainsDate)!==null&&r!==void 0?r:1),d=rk(e,t),p=new Date(0);p.setUTCFullYear(d,0,f),p.setUTCHours(0,0,0,0);var h=t0(p,t);return h}var P_e=6048e5;function uq(e,t){ut(1,arguments);var r=Mt(e),n=t0(r,t).getTime()-lq(r,t).getTime();return Math.round(n/P_e)+1}function ui(e,t){for(var r=e<0?"-":"",n=Math.abs(e).toString();n.length0?n:1-n;return ui(r==="yy"?i%100:i,r.length)},M:function(t,r){var n=t.getUTCMonth();return r==="M"?String(n+1):ui(n+1,2)},d:function(t,r){return ui(t.getUTCDate(),r.length)},a:function(t,r){var n=t.getUTCHours()/12>=1?"pm":"am";switch(r){case"a":case"aa":return n.toUpperCase();case"aaa":return n;case"aaaaa":return n[0];case"aaaa":default:return n==="am"?"a.m.":"p.m."}},h:function(t,r){return ui(t.getUTCHours()%12||12,r.length)},H:function(t,r){return ui(t.getUTCHours(),r.length)},m:function(t,r){return ui(t.getUTCMinutes(),r.length)},s:function(t,r){return ui(t.getUTCSeconds(),r.length)},S:function(t,r){var n=r.length,i=t.getUTCMilliseconds(),a=Math.floor(i*Math.pow(10,n-3));return ui(a,r.length)}},gA=I_e;var jx={am:"am",pm:"pm",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},B_e={G:function(t,r,n){var i=t.getUTCFullYear()>0?1:0;switch(r){case"G":case"GG":case"GGG":return n.era(i,{width:"abbreviated"});case"GGGGG":return n.era(i,{width:"narrow"});case"GGGG":default:return n.era(i,{width:"wide"})}},y:function(t,r,n){if(r==="yo"){var i=t.getUTCFullYear(),a=i>0?i:1-i;return n.ordinalNumber(a,{unit:"year"})}return gA.y(t,r)},Y:function(t,r,n,i){var a=rk(t,i),o=a>0?a:1-a;if(r==="YY"){var s=o%100;return ui(s,2)}return r==="Yo"?n.ordinalNumber(o,{unit:"year"}):ui(o,r.length)},R:function(t,r){var n=tk(t);return ui(n,r.length)},u:function(t,r){var n=t.getUTCFullYear();return ui(n,r.length)},Q:function(t,r,n){var i=Math.ceil((t.getUTCMonth()+1)/3);switch(r){case"Q":return String(i);case"QQ":return ui(i,2);case"Qo":return n.ordinalNumber(i,{unit:"quarter"});case"QQQ":return n.quarter(i,{width:"abbreviated",context:"formatting"});case"QQQQQ":return n.quarter(i,{width:"narrow",context:"formatting"});case"QQQQ":default:return n.quarter(i,{width:"wide",context:"formatting"})}},q:function(t,r,n){var i=Math.ceil((t.getUTCMonth()+1)/3);switch(r){case"q":return String(i);case"qq":return ui(i,2);case"qo":return n.ordinalNumber(i,{unit:"quarter"});case"qqq":return n.quarter(i,{width:"abbreviated",context:"standalone"});case"qqqqq":return n.quarter(i,{width:"narrow",context:"standalone"});case"qqqq":default:return n.quarter(i,{width:"wide",context:"standalone"})}},M:function(t,r,n){var i=t.getUTCMonth();switch(r){case"M":case"MM":return gA.M(t,r);case"Mo":return n.ordinalNumber(i+1,{unit:"month"});case"MMM":return n.month(i,{width:"abbreviated",context:"formatting"});case"MMMMM":return n.month(i,{width:"narrow",context:"formatting"});case"MMMM":default:return n.month(i,{width:"wide",context:"formatting"})}},L:function(t,r,n){var i=t.getUTCMonth();switch(r){case"L":return String(i+1);case"LL":return ui(i+1,2);case"Lo":return n.ordinalNumber(i+1,{unit:"month"});case"LLL":return n.month(i,{width:"abbreviated",context:"standalone"});case"LLLLL":return n.month(i,{width:"narrow",context:"standalone"});case"LLLL":default:return n.month(i,{width:"wide",context:"standalone"})}},w:function(t,r,n,i){var a=uq(t,i);return r==="wo"?n.ordinalNumber(a,{unit:"week"}):ui(a,r.length)},I:function(t,r,n){var i=sq(t);return r==="Io"?n.ordinalNumber(i,{unit:"week"}):ui(i,r.length)},d:function(t,r,n){return r==="do"?n.ordinalNumber(t.getUTCDate(),{unit:"date"}):gA.d(t,r)},D:function(t,r,n){var i=aq(t);return r==="Do"?n.ordinalNumber(i,{unit:"dayOfYear"}):ui(i,r.length)},E:function(t,r,n){var i=t.getUTCDay();switch(r){case"E":case"EE":case"EEE":return n.day(i,{width:"abbreviated",context:"formatting"});case"EEEEE":return n.day(i,{width:"narrow",context:"formatting"});case"EEEEEE":return n.day(i,{width:"short",context:"formatting"});case"EEEE":default:return n.day(i,{width:"wide",context:"formatting"})}},e:function(t,r,n,i){var a=t.getUTCDay(),o=(a-i.weekStartsOn+8)%7||7;switch(r){case"e":return String(o);case"ee":return ui(o,2);case"eo":return n.ordinalNumber(o,{unit:"day"});case"eee":return n.day(a,{width:"abbreviated",context:"formatting"});case"eeeee":return n.day(a,{width:"narrow",context:"formatting"});case"eeeeee":return n.day(a,{width:"short",context:"formatting"});case"eeee":default:return n.day(a,{width:"wide",context:"formatting"})}},c:function(t,r,n,i){var a=t.getUTCDay(),o=(a-i.weekStartsOn+8)%7||7;switch(r){case"c":return String(o);case"cc":return ui(o,r.length);case"co":return n.ordinalNumber(o,{unit:"day"});case"ccc":return n.day(a,{width:"abbreviated",context:"standalone"});case"ccccc":return n.day(a,{width:"narrow",context:"standalone"});case"cccccc":return n.day(a,{width:"short",context:"standalone"});case"cccc":default:return n.day(a,{width:"wide",context:"standalone"})}},i:function(t,r,n){var i=t.getUTCDay(),a=i===0?7:i;switch(r){case"i":return String(a);case"ii":return ui(a,r.length);case"io":return n.ordinalNumber(a,{unit:"day"});case"iii":return n.day(i,{width:"abbreviated",context:"formatting"});case"iiiii":return n.day(i,{width:"narrow",context:"formatting"});case"iiiiii":return n.day(i,{width:"short",context:"formatting"});case"iiii":default:return n.day(i,{width:"wide",context:"formatting"})}},a:function(t,r,n){var i=t.getUTCHours(),a=i/12>=1?"pm":"am";switch(r){case"a":case"aa":return n.dayPeriod(a,{width:"abbreviated",context:"formatting"});case"aaa":return n.dayPeriod(a,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return n.dayPeriod(a,{width:"narrow",context:"formatting"});case"aaaa":default:return n.dayPeriod(a,{width:"wide",context:"formatting"})}},b:function(t,r,n){var i=t.getUTCHours(),a;switch(i===12?a=jx.noon:i===0?a=jx.midnight:a=i/12>=1?"pm":"am",r){case"b":case"bb":return n.dayPeriod(a,{width:"abbreviated",context:"formatting"});case"bbb":return n.dayPeriod(a,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return n.dayPeriod(a,{width:"narrow",context:"formatting"});case"bbbb":default:return n.dayPeriod(a,{width:"wide",context:"formatting"})}},B:function(t,r,n){var i=t.getUTCHours(),a;switch(i>=17?a=jx.evening:i>=12?a=jx.afternoon:i>=4?a=jx.morning:a=jx.night,r){case"B":case"BB":case"BBB":return n.dayPeriod(a,{width:"abbreviated",context:"formatting"});case"BBBBB":return n.dayPeriod(a,{width:"narrow",context:"formatting"});case"BBBB":default:return n.dayPeriod(a,{width:"wide",context:"formatting"})}},h:function(t,r,n){if(r==="ho"){var i=t.getUTCHours()%12;return i===0&&(i=12),n.ordinalNumber(i,{unit:"hour"})}return gA.h(t,r)},H:function(t,r,n){return r==="Ho"?n.ordinalNumber(t.getUTCHours(),{unit:"hour"}):gA.H(t,r)},K:function(t,r,n){var i=t.getUTCHours()%12;return r==="Ko"?n.ordinalNumber(i,{unit:"hour"}):ui(i,r.length)},k:function(t,r,n){var i=t.getUTCHours();return i===0&&(i=24),r==="ko"?n.ordinalNumber(i,{unit:"hour"}):ui(i,r.length)},m:function(t,r,n){return r==="mo"?n.ordinalNumber(t.getUTCMinutes(),{unit:"minute"}):gA.m(t,r)},s:function(t,r,n){return r==="so"?n.ordinalNumber(t.getUTCSeconds(),{unit:"second"}):gA.s(t,r)},S:function(t,r){return gA.S(t,r)},X:function(t,r,n,i){var a=i._originalDate||t,o=a.getTimezoneOffset();if(o===0)return"Z";switch(r){case"X":return OJ(o);case"XXXX":case"XX":return D1(o);case"XXXXX":case"XXX":default:return D1(o,":")}},x:function(t,r,n,i){var a=i._originalDate||t,o=a.getTimezoneOffset();switch(r){case"x":return OJ(o);case"xxxx":case"xx":return D1(o);case"xxxxx":case"xxx":default:return D1(o,":")}},O:function(t,r,n,i){var a=i._originalDate||t,o=a.getTimezoneOffset();switch(r){case"O":case"OO":case"OOO":return"GMT"+DJ(o,":");case"OOOO":default:return"GMT"+D1(o,":")}},z:function(t,r,n,i){var a=i._originalDate||t,o=a.getTimezoneOffset();switch(r){case"z":case"zz":case"zzz":return"GMT"+DJ(o,":");case"zzzz":default:return"GMT"+D1(o,":")}},t:function(t,r,n,i){var a=i._originalDate||t,o=Math.floor(a.getTime()/1e3);return ui(o,r.length)},T:function(t,r,n,i){var a=i._originalDate||t,o=a.getTime();return ui(o,r.length)}};function DJ(e,t){var r=e>0?"-":"+",n=Math.abs(e),i=Math.floor(n/60),a=n%60;if(a===0)return r+String(i);var o=t||"";return r+String(i)+o+ui(a,2)}function OJ(e,t){if(e%60===0){var r=e>0?"-":"+";return r+ui(Math.abs(e)/60,2)}return D1(e,t)}function D1(e,t){var r=t||"",n=e>0?"-":"+",i=Math.abs(e),a=ui(Math.floor(i/60),2),o=ui(i%60,2);return n+a+r+o}var MJ=B_e;var jJ=function(t,r){switch(t){case"P":return r.date({width:"short"});case"PP":return r.date({width:"medium"});case"PPP":return r.date({width:"long"});case"PPPP":default:return r.date({width:"full"})}},NJ=function(t,r){switch(t){case"p":return r.time({width:"short"});case"pp":return r.time({width:"medium"});case"ppp":return r.time({width:"long"});case"pppp":default:return r.time({width:"full"})}},R_e=function(t,r){var n=t.match(/(P+)(p+)?/)||[],i=n[1],a=n[2];if(!a)return jJ(t,r);var o;switch(i){case"P":o=r.dateTime({width:"short"});break;case"PP":o=r.dateTime({width:"medium"});break;case"PPP":o=r.dateTime({width:"long"});break;case"PPPP":default:o=r.dateTime({width:"full"});break}return o.replace("{{date}}",jJ(i,r)).replace("{{time}}",NJ(a,r))},$_e={p:NJ,P:R_e},TJ=$_e;var q_e=["D","DD"],L_e=["YY","YYYY"];function FJ(e){return q_e.indexOf(e)!==-1}function _J(e){return L_e.indexOf(e)!==-1}function cq(e,t,r){if(e==="YYYY")throw new RangeError("Use `yyyy` instead of `YYYY` (in `".concat(t,"`) for formatting years to the input `").concat(r,"`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md"));if(e==="YY")throw new RangeError("Use `yy` instead of `YY` (in `".concat(t,"`) for formatting years to the input `").concat(r,"`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md"));if(e==="D")throw new RangeError("Use `d` instead of `D` (in `".concat(t,"`) for formatting days of the month to the input `").concat(r,"`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md"));if(e==="DD")throw new RangeError("Use `dd` instead of `DD` (in `".concat(t,"`) for formatting days of the month to the input `").concat(r,"`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md"))}var z_e={lessThanXSeconds:{one:"less than a second",other:"less than {{count}} seconds"},xSeconds:{one:"1 second",other:"{{count}} seconds"},halfAMinute:"half a minute",lessThanXMinutes:{one:"less than a minute",other:"less than {{count}} minutes"},xMinutes:{one:"1 minute",other:"{{count}} minutes"},aboutXHours:{one:"about 1 hour",other:"about {{count}} hours"},xHours:{one:"1 hour",other:"{{count}} hours"},xDays:{one:"1 day",other:"{{count}} days"},aboutXWeeks:{one:"about 1 week",other:"about {{count}} weeks"},xWeeks:{one:"1 week",other:"{{count}} weeks"},aboutXMonths:{one:"about 1 month",other:"about {{count}} months"},xMonths:{one:"1 month",other:"{{count}} months"},aboutXYears:{one:"about 1 year",other:"about {{count}} years"},xYears:{one:"1 year",other:"{{count}} years"},overXYears:{one:"over 1 year",other:"over {{count}} years"},almostXYears:{one:"almost 1 year",other:"almost {{count}} years"}},U_e=function(t,r,n){var i,a=z_e[t];return typeof a=="string"?i=a:r===1?i=a.one:i=a.other.replace("{{count}}",r.toString()),n!=null&&n.addSuffix?n.comparison&&n.comparison>0?"in "+i:i+" ago":i},PJ=U_e;function nk(e){return function(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},r=t.width?String(t.width):e.defaultWidth,n=e.formats[r]||e.formats[e.defaultWidth];return n}}var W_e={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},H_e={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},V_e={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},G_e={date:nk({formats:W_e,defaultWidth:"full"}),time:nk({formats:H_e,defaultWidth:"full"}),dateTime:nk({formats:V_e,defaultWidth:"full"})},IJ=G_e;var Q_e={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},Y_e=function(t,r,n,i){return Q_e[t]},BJ=Y_e;function O1(e){return function(t,r){var n=r!=null&&r.context?String(r.context):"standalone",i;if(n==="formatting"&&e.formattingValues){var a=e.defaultFormattingWidth||e.defaultWidth,o=r!=null&&r.width?String(r.width):a;i=e.formattingValues[o]||e.formattingValues[a]}else{var s=e.defaultWidth,l=r!=null&&r.width?String(r.width):e.defaultWidth;i=e.values[l]||e.values[s]}var u=e.argumentCallback?e.argumentCallback(t):t;return i[u]}}var Z_e={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},X_e={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},K_e={narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],wide:["January","February","March","April","May","June","July","August","September","October","November","December"]},J_e={narrow:["S","M","T","W","T","F","S"],short:["Su","Mo","Tu","We","Th","Fr","Sa"],abbreviated:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],wide:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},e4e={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"}},t4e={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"}},r4e=function(t,r){var n=Number(t),i=n%100;if(i>20||i<10)switch(i%10){case 1:return n+"st";case 2:return n+"nd";case 3:return n+"rd"}return n+"th"},n4e={ordinalNumber:r4e,era:O1({values:Z_e,defaultWidth:"wide"}),quarter:O1({values:X_e,defaultWidth:"wide",argumentCallback:function(t){return t-1}}),month:O1({values:K_e,defaultWidth:"wide"}),day:O1({values:J_e,defaultWidth:"wide"}),dayPeriod:O1({values:e4e,defaultWidth:"wide",formattingValues:t4e,defaultFormattingWidth:"wide"})},RJ=n4e;function M1(e){return function(t){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=r.width,i=n&&e.matchPatterns[n]||e.matchPatterns[e.defaultMatchWidth],a=t.match(i);if(!a)return null;var o=a[0],s=n&&e.parsePatterns[n]||e.parsePatterns[e.defaultParseWidth],l=Array.isArray(s)?a4e(s,function(f){return f.test(o)}):i4e(s,function(f){return f.test(o)}),u;u=e.valueCallback?e.valueCallback(l):l,u=r.valueCallback?r.valueCallback(u):u;var c=t.slice(o.length);return{value:u,rest:c}}}function i4e(e,t){for(var r in e)if(e.hasOwnProperty(r)&&t(e[r]))return r}function a4e(e,t){for(var r=0;r1&&arguments[1]!==void 0?arguments[1]:{},n=t.match(e.matchPattern);if(!n)return null;var i=n[0],a=t.match(e.parsePattern);if(!a)return null;var o=e.valueCallback?e.valueCallback(a[0]):a[0];o=r.valueCallback?r.valueCallback(o):o;var s=t.slice(i.length);return{value:o,rest:s}}}var o4e=/^(\d+)(th|st|nd|rd)?/i,s4e=/\d+/i,l4e={narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},u4e={any:[/^b/i,/^(a|c)/i]},c4e={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},f4e={any:[/1/i,/2/i,/3/i,/4/i]},d4e={narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},p4e={narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},m4e={narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},h4e={narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},A4e={narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},g4e={any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},v4e={ordinalNumber:fq({matchPattern:o4e,parsePattern:s4e,valueCallback:function(t){return parseInt(t,10)}}),era:M1({matchPatterns:l4e,defaultMatchWidth:"wide",parsePatterns:u4e,defaultParseWidth:"any"}),quarter:M1({matchPatterns:c4e,defaultMatchWidth:"wide",parsePatterns:f4e,defaultParseWidth:"any",valueCallback:function(t){return t+1}}),month:M1({matchPatterns:d4e,defaultMatchWidth:"wide",parsePatterns:p4e,defaultParseWidth:"any"}),day:M1({matchPatterns:m4e,defaultMatchWidth:"wide",parsePatterns:h4e,defaultParseWidth:"any"}),dayPeriod:M1({matchPatterns:A4e,defaultMatchWidth:"any",parsePatterns:g4e,defaultParseWidth:"any"})},$J=v4e;var y4e={code:"en-US",formatDistance:PJ,formatLong:IJ,formatRelative:BJ,localize:RJ,match:$J,options:{weekStartsOn:0,firstWeekContainsDate:1}},ik=y4e;var qJ=ik;var b4e=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,x4e=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,w4e=/^'([^]*?)'?$/,S4e=/''/g,E4e=/[a-zA-Z]/;function Za(e,t,r){var n,i,a,o,s,l,u,c,f,d,p,h,m,g,A,b,v,x;ut(2,arguments);var w=String(t),S=Gl(),k=(n=(i=r?.locale)!==null&&i!==void 0?i:S.locale)!==null&&n!==void 0?n:qJ,j=Cr((a=(o=(s=(l=r?.firstWeekContainsDate)!==null&&l!==void 0?l:r==null||(u=r.locale)===null||u===void 0||(c=u.options)===null||c===void 0?void 0:c.firstWeekContainsDate)!==null&&s!==void 0?s:S.firstWeekContainsDate)!==null&&o!==void 0?o:(f=S.locale)===null||f===void 0||(d=f.options)===null||d===void 0?void 0:d.firstWeekContainsDate)!==null&&a!==void 0?a:1);if(!(j>=1&&j<=7))throw new RangeError("firstWeekContainsDate must be between 1 and 7 inclusively");var O=Cr((p=(h=(m=(g=r?.weekStartsOn)!==null&&g!==void 0?g:r==null||(A=r.locale)===null||A===void 0||(b=A.options)===null||b===void 0?void 0:b.weekStartsOn)!==null&&m!==void 0?m:S.weekStartsOn)!==null&&h!==void 0?h:(v=S.locale)===null||v===void 0||(x=v.options)===null||x===void 0?void 0:x.weekStartsOn)!==null&&p!==void 0?p:0);if(!(O>=0&&O<=6))throw new RangeError("weekStartsOn must be between 0 and 6 inclusively");if(!k.localize)throw new RangeError("locale must contain localize property");if(!k.formatLong)throw new RangeError("locale must contain formatLong property");var C=Mt(e);if(!rq(C))throw new RangeError("Invalid time value");var N=hA(C),D=iq(C,N),P={firstWeekContainsDate:j,weekStartsOn:O,locale:k,_originalDate:C},q=w.match(x4e).map(function(z){var I=z[0];if(I==="p"||I==="P"){var T=TJ[I];return T(z,k.formatLong)}return z}).join("").match(b4e).map(function(z){if(z==="''")return"'";var I=z[0];if(I==="'")return k4e(z);var T=MJ[I];if(T)return!(r!=null&&r.useAdditionalWeekYearTokens)&&_J(z)&&cq(z,t,String(e)),!(r!=null&&r.useAdditionalDayOfYearTokens)&&FJ(z)&&cq(z,t,String(e)),T(D,z,k.localize,P);if(I.match(E4e))throw new RangeError("Format string contains an unescaped latin alphabet character `"+I+"`");return z}).join("");return q}function k4e(e){var t=e.match(w4e);return t?t[1].replace(S4e,"'"):e}function dq(e){ut(1,arguments);var t=Mt(e),r=t.getFullYear(),n=t.getMonth(),i=new Date(0);return i.setFullYear(r,n+1,0),i.setHours(0,0,0,0),i.getDate()}var C4e=6048e5;function xM(e){ut(1,arguments);var t=Mt(e),r=tf(t).getTime()-J$(t).getTime();return Math.round(r/C4e)+1}function pq(e){ut(1,arguments);var t=Mt(e),r=t.getTime();return r}function wM(e){return ut(1,arguments),Math.floor(pq(e)/1e3)}function mq(e,t){var r,n,i,a,o,s,l,u;ut(1,arguments);var c=Mt(e),f=c.getFullYear(),d=Gl(),p=Cr((r=(n=(i=(a=t?.firstWeekContainsDate)!==null&&a!==void 0?a:t==null||(o=t.locale)===null||o===void 0||(s=o.options)===null||s===void 0?void 0:s.firstWeekContainsDate)!==null&&i!==void 0?i:d.firstWeekContainsDate)!==null&&n!==void 0?n:(l=d.locale)===null||l===void 0||(u=l.options)===null||u===void 0?void 0:u.firstWeekContainsDate)!==null&&r!==void 0?r:1);if(!(p>=1&&p<=7))throw new RangeError("firstWeekContainsDate must be between 1 and 7 inclusively");var h=new Date(0);h.setFullYear(f+1,0,p),h.setHours(0,0,0,0);var m=mo(h,t),g=new Date(0);g.setFullYear(f,0,p),g.setHours(0,0,0,0);var A=mo(g,t);return c.getTime()>=m.getTime()?f+1:c.getTime()>=A.getTime()?f:f-1}function hq(e,t){var r,n,i,a,o,s,l,u;ut(1,arguments);var c=Gl(),f=Cr((r=(n=(i=(a=t?.firstWeekContainsDate)!==null&&a!==void 0?a:t==null||(o=t.locale)===null||o===void 0||(s=o.options)===null||s===void 0?void 0:s.firstWeekContainsDate)!==null&&i!==void 0?i:c.firstWeekContainsDate)!==null&&n!==void 0?n:(l=c.locale)===null||l===void 0||(u=l.options)===null||u===void 0?void 0:u.firstWeekContainsDate)!==null&&r!==void 0?r:1),d=mq(e,t),p=new Date(0);p.setFullYear(d,0,f),p.setHours(0,0,0,0);var h=mo(p,t);return h}var D4e=6048e5;function SM(e,t){ut(1,arguments);var r=Mt(e),n=mo(r,t).getTime()-hq(r,t).getTime();return Math.round(n/D4e)+1}function Aq(e){ut(1,arguments);var t=Mt(e),r=t.getMonth();return t.setFullYear(t.getFullYear(),r+1,0),t.setHours(0,0,0,0),t}function EM(e,t){return ut(1,arguments),nq(Aq(e),Wo(e),t)+1}function Nx(e,t){ut(2,arguments);var r=Mt(e),n=Mt(t);return r.getTime()>n.getTime()}function ak(e,t){ut(2,arguments);var r=Mt(e),n=Mt(t);return r.getTime()2)return t;if(/:/.test(r[0])?n=r[0]:(t.date=r[0],n=r[1],CM.timeZoneDelimiter.test(t.date)&&(t.date=e.split(CM.timeZoneDelimiter)[0],n=e.substr(t.date.length,e.length))),n){var i=CM.timezone.exec(n);i?(t.time=n.replace(i[1],""),t.timezone=i[1]):t.time=n}return t}function T4e(e,t){var r=new RegExp("^(?:(\\d{4}|[+-]\\d{"+(4+t)+"})|(\\d{2}|[+-]\\d{"+(2+t)+"})$)"),n=e.match(r);if(!n)return{year:NaN,restDateString:""};var i=n[1]?parseInt(n[1]):null,a=n[2]?parseInt(n[2]):null;return{year:a===null?i:a*100,restDateString:e.slice((n[1]||n[2]).length)}}function F4e(e,t){if(t===null)return new Date(NaN);var r=e.match(O4e);if(!r)return new Date(NaN);var n=!!r[4],i=sk(r[1]),a=sk(r[2])-1,o=sk(r[3]),s=sk(r[4]),l=sk(r[5])-1;if(n)return q4e(t,s,l)?I4e(t,s,l):new Date(NaN);var u=new Date(0);return!R4e(t,a,o)||!$4e(t,i)?new Date(NaN):(u.setUTCFullYear(t,a,Math.max(i,o)),u)}function sk(e){return e?parseInt(e):1}function _4e(e){var t=e.match(M4e);if(!t)return NaN;var r=yq(t[1]),n=yq(t[2]),i=yq(t[3]);return L4e(r,n,i)?r*tq+n*eq+i*1e3:NaN}function yq(e){return e&&parseFloat(e.replace(",","."))||0}function P4e(e){if(e==="Z")return 0;var t=e.match(j4e);if(!t)return 0;var r=t[1]==="+"?-1:1,n=parseInt(t[2]),i=t[3]&&parseInt(t[3])||0;return z4e(n,i)?r*(n*tq+i*eq):NaN}function I4e(e,t,r){var n=new Date(0);n.setUTCFullYear(e,0,4);var i=n.getUTCDay()||7,a=(t-1)*7+r+1-i;return n.setUTCDate(n.getUTCDate()+a),n}var B4e=[31,null,31,30,31,30,31,31,30,31,30,31];function LJ(e){return e%400===0||e%4===0&&e%100!==0}function R4e(e,t,r){return t>=0&&t<=11&&r>=1&&r<=(B4e[t]||(LJ(e)?29:28))}function $4e(e,t){return t>=1&&t<=(LJ(e)?366:365)}function q4e(e,t,r){return t>=1&&t<=53&&r>=0&&r<=6}function L4e(e,t,r){return e===24?t===0&&r===0:r>=0&&r<60&&t>=0&&t<60&&e>=0&&e<25}function z4e(e,t){return t>=0&&t<=59}function _x(e,t){ut(2,arguments);var r=Mt(e),n=Cr(t),i=r.getFullYear(),a=r.getDate(),o=new Date(0);o.setFullYear(i,n,15),o.setHours(0,0,0,0);var s=dq(o);return r.setMonth(n,Math.min(a,s)),r}function lk(e,t){ut(2,arguments);var r=Mt(e),n=Cr(t);return isNaN(r.getTime())?new Date(NaN):(r.setFullYear(n),r)}var mt="File";var bq=(e,t)=>{let r=n=>n=="builtin"?"Builtin":n=="api"?"Spaces":"Action";return[...(e.actionsIndex.get(t)??[]).map(n=>({name:n.schema.name,description:"Action",value:`${t}/#;${n.schema.id}`,section:"Action"}))??[],...[...e.cli.allCommands()].map(n=>({name:n.schema.name,description:r(n.schema.type),value:n.path,section:r(n.schema.type)}))]};var zJ=({field:e,value:t})=>t=="ctime"?{value:"parseDate(prop('File')['metadata']['ctime'])",type:"date"}:{value:"",type:"string"},pr=(e,t,r,n)=>{let i=or(e);if(i)return t=="fileprop"&&i.field?zJ(i):(t=="option"&&i.source?.length>0&&(i.source=="$commands"?i.options=r.cli.allCommands():i.source=="$links"?i.options=r.spaceManager.allPaths().map(a=>({name:a,value:a})):i.source=="$super"?i.options=bq(r,n):i.source=="$properties"&&(i.options=r.contextsIndex.get(n)?.contextTable?.cols?.map(a=>({name:a.name,value:a.name}))??[])),[...fc(t).configKeys??[],"alias","default"].reduce((a,o)=>({...a,[o]:i[o]}),{}));if(!t)return{};if(!i)if(t=="context")e?.length>0?i={space:e}:i={};else if(t.startsWith("date"))e?.length>0?i={format:e}:i={};else if(t.startsWith("fileprop"))if(e?.length>0){let[a,o]=e.split(".");i=zJ({field:a,value:o})}else i={};else t.startsWith("option")&&(e?.length>0?i={options:sr(e).map(o=>({name:o,value:o}))}:i={});return i??{}};var sa={uniques:["name,schemaId"],cols:["name","schemaId","type","value","attrs","hidden","unique","primary"]},sd={...sa,rows:[{name:mt,schemaId:Er,type:"file",primary:"true",hidden:"",unique:"",attrs:"",value:""},{name:"Created",schemaId:Er,type:"fileprop",value:mt+".ctime",hidden:"",unique:"",attrs:"",primary:"true"}]},xq=e=>sd,Px=[{name:"Name",schemaId:"",type:"text",primary:"true"}],OM={...sa,rows:[{name:mt,schemaId:Er,type:"file",primary:"true",hidden:"",unique:"",attrs:"",value:""}]};var ho=e=>e?e.type=="fileprop"?pr(e.value,"fileprop")?.type??"text":e.type:null,Ii=e=>e.attrs?.length>0?or(e.attrs)?.icon??fc(e.type,e.name)?.icon:fc(e.type,e.name)?.icon,Ix=e=>e.def?.icon?.length>0?e.def?.icon:"ui//layout-list",UJ=e=>or(e?.def)?.icon??"ui//layout-list",fc=(e,t)=>t==mt?ml.find(r=>r.type=="file"):t=="tags"?ml.find(r=>r.type=="tags-multi"):t=="aliases"?ml.find(r=>r.type=="option-multi"):t=="sticker"?ml.find(r=>e=="icon"):ml.find(r=>e==r.type)||ml.find(r=>e==r.multiType),ml=[{type:"unknown",label:"",restricted:!0,icon:"ui//file-question"},{type:"any",label:"",restricted:!0,icon:"ui//wildcard",multi:!0,multiType:"any-multi"},{type:"text",label:H.properties.text.label,metadata:!0,icon:"ui//text",primative:!0,description:H.properties.text.description},{type:"number",label:H.properties.number.label,metadata:!0,icon:"ui//binary",configKeys:["unit"],primative:!0,description:H.properties.number.description},{type:"boolean",label:H.properties.boolean.label,metadata:!0,icon:"ui//check-square",primative:!0,description:H.properties.boolean.description},{type:"date",label:H.properties.date.label,metadata:!0,icon:"ui//calendar",configKeys:["format"],primative:!0,description:H.properties.date.description},{type:"option",label:H.properties.option.label,multi:!0,multiType:"option-multi",icon:"ui//list",configKeys:["options","source"],description:H.properties.option.description},{type:"tags-multi",label:H.properties.tags.label,icon:"ui//tags",description:H.properties.tags.description},{type:"file",label:H.properties.file.label,restricted:!0,icon:"ui//mk-make-h3"},{type:"fileprop",label:H.properties.fileProperty.label,icon:"ui//formula",configKeys:["field","value","type"],description:H.properties.fileProperty.description},{type:"link",label:H.properties.link.label,multi:!0,multiType:"link-multi",metadata:!0,icon:"ui//file-text",primative:!0,description:H.properties.link.description},{type:"context",label:H.properties.context.label,icon:"ui//mk-make-note",multi:!0,multiType:"context-multi",configKeys:["space","field"],description:H.properties.context.description},{type:"aggregate",label:H.properties.aggregate.label,icon:"ui//mk-make-note",multi:!1,configKeys:["ref","field","fn"],description:H.properties.aggregate.description},{type:"object",label:H.properties.object.label,multi:!0,multiType:"object-multi",metadata:!0,icon:"ui//list-tree",configKeys:["type","typeName"],description:H.properties.object.description},{type:"icon",label:H.properties.icon.label,multi:!0,multiType:"icon-multi",icon:"ui//gem",restricted:!0,primative:!0,description:H.properties.icon.description},{type:"image",label:H.properties.image.label,multi:!0,multiType:"image-multi",metadata:!0,icon:"ui//mk-make-image",primative:!0,description:H.properties.image.description},{type:"color",label:H.properties.color.label,icon:"ui//mk-make-image",restricted:!0,description:H.properties.color.description},{type:"space",label:H.properties.space.label,icon:"ui//layout-grid",restricted:!0,description:H.properties.space.description},{type:"table",label:H.properties.space.label,icon:"ui//layout-grid",restricted:!0,description:H.properties.space.description},{type:"super",label:H.properties.super.label,icon:"ui//zap",restricted:!0,configKeys:["dynamic","field"]},{type:"input",label:H.properties.super.label,icon:"ui//input",restricted:!0}];var r0="filesView",bp={id:r0,name:"All",type:"view",def:JSON.stringify({db:Er,icon:"ui//file-stack"})},j1="main",MM=e=>({id:e,name:e,type:"frame",def:"",predicate:"",primary:"true"}),WJ={uniques:[],cols:["id","name","type","def","predicate","primary"],rows:[MM(j1),bp]},vA={uniques:[],cols:["id","name","type","def","predicate","primary"],rows:[yp]},HJ=e=>U4e,U4e={schema:yp,cols:sd.rows,rows:[]},Gut={schema:yp,cols:sd.rows,rows:[]},Qut={schema:yp,cols:OM.rows,rows:[]},VJ=(e,t)=>e.filter(r=>t.find(n=>n.id==r.schemaId&&n.type=="db")).reduce((r,n)=>({...r,...r[n.schemaId]?{[n.schemaId]:{uniques:n.unique=="true"?[...r[n.schemaId].uniques,n.name]:r[n.schemaId].uniques,cols:[...r[n.schemaId].cols,n.name],rows:[]}}:{[n.schemaId]:{uniques:n.unique=="true"?[n.name]:[],cols:[n.name],rows:[]}}}),{}),GJ=e=>W4e,W4e={m_schema:vA,m_fields:sd,...VJ(sd.rows,vA.rows)},Yut={m_schema:vA,m_fields:OM,...VJ(OM.rows,vA.rows)};var yA=(e,t)=>{if(e instanceof Date)return"date";if(typeof e=="string"){if(/\/\/(\S+?(?:jpe?g|png|gif|svg))/gi.test(e)||e.includes("unsplash"))return"image";if(/^\d{4}-\d{2}-\d{2}$/.test(e))return"date";if(t=="tag"||t=="tags")return"tags-multi";if(/\[\[.*?\]\]/.test(e))return"link"}else{if(typeof e=="number")return"number";if(typeof e=="boolean")return"boolean";if(e)if(Array.isArray(e)||typeof e=="string"&&e.indexOf(",")>-1){let r=Array.isArray(e)?e:[];if(typeof e=="string"&&e.indexOf(",")>-1&&(r=sr(e)),t=="tag"||t=="tags")return"tags-multi";if(r.length==1&&Array.isArray(r[0])&&r[0].length==1&&typeof r[0][0]=="string")return"link";let n=kr(r.map(i=>yA(i,t)));return n.length==1&&n[0]=="link"?"link-multi":n.some(i=>i=="object")?"object-multi":"option-multi"}else return e.isLuxonDateTime?"date":e.isLuxonDuration?"duration":e.type=="file"?"link":typeof e=="object"&&!Array.isArray(e)&&e!==null?"object":"unknown";else return"unknown"}return"text"},Bx=e=>{if(e=="date")return Za(Date.now(),"yyyy-MM-dd");if(e=="number")return 0;if(e=="boolean")return!0;if(e=="link")return"[[Select Note]]";if(e=="option")return"one, two";if(e=="text")return" ";if(e=="image")return"https://images.unsplash.com/photo-1675789652575-0a5d2425b6c2?ixlib=rb-4.0.3&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=2070&q=80"};var wq=(e,t)=>t?t=="number"?parseFloat(e):t=="boolean"?e=="true":t.includes("-multi")?sr(e).map(r=>la(t.replace("-multi",""),r,!1)):e:e,la=(e,t,r)=>e?e=="object"||e=="object-multi"?JSON.parse(t):e=="number"?parseFloat(t):e=="boolean"?t=="true":e.includes("-multi")?sr(t).map(n=>la(e.replace("-multi",""),n,r)):(e.includes("link")||e.includes("context"))&&r?`[[${t}]]`:t:t,Sq=e=>{switch(e){case"duration":return"text";case"unknown":return"text"}return e},Rx=e=>e.type=="object"||e.type=="object-multi"||e.type=="super";var os=e=>e.map(t=>t.replace(",","\\,")).join(", "),Bi=e=>JSON.stringify(e),Eq=e=>e.join(", "),QJ=e=>e.join("; "),YJ=e=>e.join(",");var sr=e=>e?.startsWith("[")?dl(or(e)).map(t=>Bs(t)):qx(e),qx=e=>(e?.replace("\\,",",")?.match(/(\\.|[^,])+/g)??[]).map(t=>t.trim()),Ri=(e,t,r)=>{let n=r??yA(t,e);if(!t)return"";switch(n){case"tags-multi":return t;case"object":case"object-multi":{if(Array.isArray(t)){if(t[0].path)return JSON.stringify(t.map(i=>i.path))}else if(t.path)return t.path;return JSON.stringify(t)}break;case"number":return t.toString();case"boolean":return t?"true":"false";case"date":{if(t instanceof Date){let i=Za(t,"yyyy-MM-dd");return typeof i=="string"?i:""}return typeof t!="string"?"":t}break;case"duration":return os(Object.keys(t.values).reduce((i,a)=>[...i,...t.values[a]>0?[t.values[a]+" "+a]:[]],[]));case"option-multi":case"link-multi":case"context-multi":return typeof t=="string"?$x(t):Bi(t.map(i=>i?typeof i=="string"?$x(i):i.path?i.path:Array.isArray(t)&&i.length==1&&Array.isArray(i[0])&&i[0].length==1&&typeof i[0][0]=="string"?i[0][0]:JSON.stringify(i):""));case"link":case"context":return Array.isArray(t)&&t.length==1&&Array.isArray(t[0])&&t[0].length==1&&typeof t[0][0]=="string"?t[0][0]:typeof t=="string"?$x(t):t.path;case"text":case"tag":case"option":case"image":return t}return""},Nm=(e,t)=>t?dl(or(e)):or(e)??{},or=e=>{let t;try{t=JSON.parse(e)}catch{}return t};var $x=e=>{if(!e)return"";let t=/\[\[(.*?)\]\]/g.exec(e),r=t?.length>1?t[1].substring(0,xJ("|",t[1])):e;return r||e};var uk=class{constructor(){this.spaceAdapters=[];this.readSystemCommands=()=>this.primarySpaceAdapter.readSystemCommands();this.saveSystemCommand=(t,r)=>this.primarySpaceAdapter.saveSystemCommand(t,r).then(n=>this.superstate.reloadSystemActions());this.onFocusesUpdated=()=>{this.readFocuses().then(t=>{this.superstate.focuses=t,this.superstate.dispatchEvent("focusesChanged",null)})};this.onPathCreated=async t=>{this.superstate.onPathCreated(t)};this.onPathDeleted=async t=>{this.superstate.onPathDeleted(t)};this.onPathChanged=async(t,r)=>{this.superstate.onPathRename(r,t)};this.onSpaceCreated=async t=>{if(t.startsWith(this.superstate.settings.spacesFolder)){await this.onSpaceCreated(t.replace(this.superstate.settings.spacesFolder,"spaces:/"));return}let r=await this.superstate.reloadSpace(this.spaceInfoForPath(t),null,!0);await this.superstate.onSpaceDefinitionChanged(r),await this.superstate.onPathCreated(t)};this.onSpaceRenamed=async(t,r)=>{await this.superstate.onSpaceRenamed(r,this.spaceInfoForPath(t)),await this.superstate.onPathRename(r,t)};this.onSpaceDeleted=async t=>{this.superstate.onSpaceDeleted(t),this.superstate.onPathDeleted(t)};this.onPathPropertyChanged=async t=>{this.superstate.onMetadataChange(t)};this.spaceTypeByString=t=>t.fullPath.startsWith(Zg)?"default":t.scheme=="space"?"folder":t.authority?.charAt(0)=="#"?"tag":t.path.charAt(t.path.length-1)=="/"&&t.path=="/"?"vault":"folder"}onSpaceUpdated(t,r){!this.superstate.spacesIndex.has(t)||(r=="context"&&this.superstate.reloadContextByPath(t),r=="frame"&&this.superstate.dispatchEvent("frameStateUpdated",{path:t}),r=="action"&&this.superstate.reloadActions(this.spaceInfoForPath(t)))}saveFrameKit(t,r){return this.primarySpaceAdapter.saveFrameKit(t,r)}saveSpaceTemplate(t,r){return this.primarySpaceAdapter.saveSpaceTemplate(t,r)}resolvePath(t,r){if(!r||!t||t.indexOf("http")==0)return t;if(t.indexOf("|")!=-1&&(t=t.split("|")[0]),t.indexOf("./")==0&&r)return this.superstate.spacesIndex.has(r)?r+t.slice(1):r.slice(0,r.lastIndexOf("/"))+t.slice(1);if(t.indexOf("../")==0&&r){let n=r.split("/"),i=t.split("/");for(;i[0]==="..";)n.pop(),i.shift();return[...n,...i].join("/")}return this.superstate.pathsIndex.has(t)?t:this.primarySpaceAdapter.resolvePath(t,r)??t}uriByString(t,r){return!t||r&&(t=this.resolvePath(t,r),!t)?null:cc(t)}async allCaches(){let t=new Map,r=this.primarySpaceAdapter.allCaches().keys();for(let n of r){let i=await this.readPathCache(n);t.set(n,i)}return t}keysForCacheType(t){return this.primarySpaceAdapter.keysForCacheType(t)}pathExists(t){return this.primarySpaceAdapter.pathExists(t)}addSpaceAdapter(t,r){t.initiateAdapter(this),r&&(this.primarySpaceAdapter=t),this.spaceAdapters.push(t)}adapterForPath(t){let r=this.uriByString(t);return r?this.spaceAdapters.find(n=>n.schemes.includes(r.scheme))??this.primarySpaceAdapter:this.primarySpaceAdapter}createSpace(t,r,n){return this.adapterForPath(r).createSpace(t,r,n)}saveSpace(t,r,n){return this.adapterForPath(t).saveSpace(t,r,n)}renameSpace(t,r){return this.adapterForPath(t).renameSpace(t,r)}deleteSpace(t){return this.adapterForPath(t).deleteSpace(t)}childrenForSpace(t){return this.adapterForPath(t).childrenForSpace(t)}contextForSpace(t){return this.adapterForPath(t).contextForSpace(t)}async tablesForSpace(t){return this.adapterForPath(t).tablesForSpace(t)}spaceInitiated(t){return this.adapterForPath(t).spaceInitiated(t)}contextInitiated(t){return this.adapterForPath(t).contextInitiated(t)}readTable(t,r){return this.adapterForPath(t).readTable(t,r)}createTable(t,r){return this.adapterForPath(t).createTable(t,r).then(n=>this.superstate.reloadContextByPath(t,!0))}saveTableSchema(t,r,n){return this.adapterForPath(t).saveTableSchema(t,r,n).then(i=>i&&this.superstate.reloadContextByPath(t,!0))}saveTable(t,r,n){return this.adapterForPath(t).saveTable(t,r,n)}deleteTable(t,r){return this.adapterForPath(t).deleteTable(t,r).then(n=>this.superstate.reloadContextByPath(t,!0))}readAllKits(){return this.primarySpaceAdapter.readAllKits()}readAllTemplates(){return this.primarySpaceAdapter.readAllTemplates()}readAllTables(t){return this.adapterForPath(t).readAllTables(t)}framesForSpace(t){return this.adapterForPath(t).framesForSpace(t)}readFrame(t,r){return this.adapterForPath(t).readFrame(t,r)}readAllFrames(t){return this.adapterForPath(t).readAllFrames(t)}createFrame(t,r){return this.adapterForPath(t).createFrame(t,r).then(n=>this.superstate.dispatchEvent("frameStateUpdated",{path:this.spaceInfoForPath(t).path,schemaId:r.id}))}deleteFrame(t,r){return this.adapterForPath(t).deleteFrame(t,r)}saveFrameSchema(t,r,n){return this.adapterForPath(t).saveFrameSchema(t,r,n).then(i=>this.superstate.dispatchEvent("frameStateUpdated",{path:this.spaceInfoForPath(t).path,schemaId:r}))}saveFrame(t,r){return this.adapterForPath(t).saveFrame(t,r).then(n=>this.superstate.dispatchEvent("frameStateUpdated",{path:this.spaceInfoForPath(t).path,schemaId:r.schema.id}))}commandsForSpace(t){return this.adapterForPath(t).commandsForSpace(t)}runCommand(t,r,n){return this.adapterForPath(t).runCommand(t,r,n)}createCommand(t,r){return this.adapterForPath(t).createCommand(t,r).then(n=>this.superstate.reloadActions(this.spaceInfoForPath(t)))}deleteCommand(t,r){return this.adapterForPath(t).deleteCommand(t,r).then(n=>this.superstate.reloadActions(this.spaceInfoForPath(t)))}saveCommand(t,r,n){return this.adapterForPath(t).saveCommand(t,r,n).then(i=>this.superstate.reloadActions(this.spaceInfoForPath(t)))}allPaths(t){return this.spaceAdapters.flatMap(r=>r.allPaths(t))}createItemAtPath(t,r,n,i){return this.adapterForPath(t).createItemAtPath(t,r,n,i)}renamePath(t,r){return this.adapterForPath(t).renamePath(t,r)}copyPath(t,r,n){return this.adapterForPath(t).copyPath(t,r,n)}getPathInfo(t){return this.adapterForPath(t).getPathInfo(t)}deletePath(t){return this.adapterForPath(t).deletePath(t)}readPath(t){return this.adapterForPath(t).readPath(t)}writeToPath(t,r,n){return this.adapterForPath(t).writeToPath(t,r,n)}parentPathForPath(t){return this.adapterForPath(t).parentPathForPath(t)}async readPathCache(t){let r=await this.adapterForPath(t).readPathCache(t);if(r&&r.type=="space"&&!this.superstate.settings.enableFolderNote){let n=this.spaceInfoForPath(t).defPath;r.label={...r.label,...await this.readLabel(n)},r.property=await this.readProperties(n)}return r}allSpaces(){return this.primarySpaceAdapter.allSpaces()}spaceInfoForPath(t){return this.adapterForPath(t).spaceInfoForPath(t)}spaceDefForSpace(t){return this.adapterForPath(t).spaceDefForSpace(t)}readLabel(t){return this.adapterForPath(t).readLabel(t)}saveLabel(t,r,n){return this.adapterForPath(t).saveLabel(t,r,n)}addProperty(t,r){return this.adapterForPath(t).addProperty(t,r)}saveProperties(t,r){if(!!t)return this.adapterForPath(t).saveProperties(t,r)}readProperties(t){return this.adapterForPath(t).readProperties(t)}renameProperty(t,r,n){return this.adapterForPath(t).renameProperty(t,r,n)}deleteProperty(t,r){return this.adapterForPath(t).deleteProperty(t,r)}addSpaceProperty(t,r){if(r.schemaId==Er&&r.type.startsWith("option")){let n=kr([...this.superstate.spacesMap.getInverse(t)??[]].flatMap(a=>sr(this.superstate.pathsIndex.get(a)?.metadata?.property?.[r.name])??[])),i=pA(n.map(a=>({value:a,name:a})),{});r.value=i}return this.adapterForPath(t).addSpaceProperty(t,r).then(n=>this.superstate.reloadContextByPath(t,!0))}deleteSpaceProperty(t,r){return this.adapterForPath(t).deleteSpaceProperty(t,r).then(n=>this.superstate.reloadContextByPath(t,!0))}saveSpaceProperty(t,r,n){return this.adapterForPath(t).saveSpaceProperty(t,r,n).then(i=>(n.name!=r.name&&this.superstate.getSpaceItems(t).forEach(a=>{this.renameProperty(a.path,n.name,r.name)}),this.superstate.reloadContextByPath(t,!0)))}addTag(t,r){return this.adapterForPath(t).addTag(t,r)}deleteTag(t,r){return this.adapterForPath(t).deleteTag(t,r)}renameTag(t,r,n){return this.adapterForPath(t).renameTag(t,r,n)}readTags(){return this.primarySpaceAdapter.readTags()}pathsForTag(t){return this.primarySpaceAdapter.pathsForTag(t)}childrenForPath(t,r){return this.adapterForPath(t).childrenForPath(t,r)}readFocuses(){return this.primarySpaceAdapter.readFocuses()}saveFocuses(t){return this.superstate.focuses=t,this.superstate.dispatchEvent("focusesChanged",null),this.primarySpaceAdapter.saveFocuses(t)}readTemplates(t){return this.adapterForPath(t).readTemplates(t)}saveTemplate(t,r){return this.adapterForPath(t).saveTemplate(t,r).then(n=>this.superstate.reloadSpace(this.spaceInfoForPath(r),null,!0)).then(n=>n.path)}deleteTemplate(t,r){return this.primarySpaceAdapter.deleteTemplate(t,r).then(n=>this.superstate.reloadSpace(this.spaceInfoForPath(r),null,!0)).then(n=>null)}};var n0=class{constructor(){this.listeners=new Map}addListener(t,r,n=0,i){let a={callback:r,priority:n,once:!1,context:i},o=this.listeners.get(t)||[];o.push(a),o.sort((s,l)=>l.priority-s.priority),this.listeners.set(t,o)}addOnceListener(t,r,n=0,i){let a={callback:r,priority:n,once:!0,context:i},o=this.listeners.get(t)||[];o.push(a),o.sort((s,l)=>l.priority-s.priority),this.listeners.set(t,o)}removeListener(t,r){let n=this.listeners.get(t);n&&this.listeners.set(t,n.filter(i=>i.callback!==r))}async dispatchEvent(t,r){let n=this.listeners.get(t);if(n)for(let i of n){try{await i.callback.call(i.context,r)}catch(a){console.error(`Error in listener for event '${String(t)}':`,a)}i.once&&this.removeListener(t,i.callback)}}};var N1=class{constructor(){this.filesystems=[];this.filetypes=[];this.eventDispatch=new n0}static create(){return new N1}resolvePath(t,r){return this.primary.resolvePath(t,r)}keysForCacheType(t){return this.primary.keysForCacheType(t)}allTags(){return this.primary.readAllTags()}fileFragmentChanged(t){this.eventDispatch.dispatchEvent("onFileFragmentChanged",{file:t})}initiateFileSystemAdapter(t,r){t.initiate(this),r&&(this.primary=t),this.filesystems.push(t)}initiateFiletypeAdapter(t){t.initiate(this),this.filetypes.push(t)}filetypeAdaptersForFile(t){return t?this.filetypes.filter(r=>r.supportedFileTypes.includes(t.extension)):[]}filetypeAdaptersForFileFragments(t,r){return this.filetypeAdaptersForFile(t).filter(n=>n.contentTypes?n.contentTypes(t).includes(r):!1)}getFileCacheTypeByRefString(t,r){return this.filetypeAdaptersForFile(t).reduce((i,a)=>i||a.getCacheTypeByRefString(t,r),null)}allCaches(){return this.primary.cache}allFiles(){return this.primary.allFiles()}resourcePathForPath(t){return this.adapterForPath(t).resourcePathForPath(t)}parentPathForPath(t){return this.adapterForPath(t).parentPathForPath(t)}async createFileCache(t){let r=await this.getFile(t);for(let n of this.filetypeAdaptersForFile(r))n.parseCache&&await n.parseCache(r,!1)}getFileCache(t){return this.adapterForPath(t).getFileCache(t)}getFileContent(t,r,n){let i=this.filetypeAdaptersForFile(t).filter(a=>a.contentTypes(t).includes(r));if(i.length>=1)return i[0].readContent(t,r,n)}updateFileCache(t,r,n){this.adapterForPath(t).updateFileCache(t,r,n)}readFileFragments(t,r,n){let i=this.filetypeAdaptersForFileFragments(t,r);if(i.length>=1)return i[0].readContent(t,r,n)}async newFile(t,r,n,i){let a=this.filetypes.find(o=>o.supportedFileTypes.includes(n));if(a)return a.newFile(t,r,n,i)}newFileFragment(t,r,n,i,a){let o=this.filetypeAdaptersForFileFragments(t,r);if(o.length>=1)return o[0].newContent(t,r,n,i,a)}saveFileLabel(t,r,n){let i=this.filetypeAdaptersForFileFragments(t,"label");return i.length>=1?i[0].saveContent(t,"label",r,()=>n):this.primary.updateFileLabel(t.path,r,n)}saveFileFragment(t,r,n,i){let a=this.filetypeAdaptersForFileFragments(t,r);return a.length>=1?a[0].saveContent(t,r,n,i):!1}deleteFileFragment(t,r,n){let i=this.filetypeAdaptersForFileFragments(t,r);if(i.length>=1)return i[0].deleteContent(t,r,n)}onCreate(t){this.eventDispatch.dispatchEvent("onCreate",{file:t})}onModify(t){this.eventDispatch.dispatchEvent("onModify",{file:t})}onRename(t,r){this.eventDispatch.dispatchEvent("onRename",{file:t,oldPath:r})}onDelete(t){this.eventDispatch.dispatchEvent("onDelete",{file:t})}onSpaceUpdated(t,r){this.eventDispatch.dispatchEvent("onSpaceUpdated",{path:t,type:r})}onFocusesUpdated(){this.eventDispatch.dispatchEvent("onFocusesUpdated",null)}adapterForPath(t){return this.primary}async getRoot(){return this.adapterForPath().getRoot()}async copyFile(t,r,n){return this.adapterForPath(t).copyFile(t,r,n)}async writeTextToFile(t,r){return this.adapterForPath(t).writeTextToFile(t,r)}async readTextFromFile(t){return this.adapterForPath(t).readTextFromFile(t)}async writeBinaryToFile(t,r){return this.adapterForPath(t).writeBinaryToFile(t,r)}async readBinaryToFile(t){return this.adapterForPath(t).readBinaryToFile(t)}async renameFile(t,r){return this.adapterForPath(t).renameFile(t,r)}async createFolder(t){return this.adapterForPath(t).createFolder(t)}async childrenForFolder(t,r){return this.adapterForPath(t).childrenForFolder(t,r)}async fileExists(t){return this.adapterForPath(t).fileExists(t)}async getFile(t,r){return this.adapterForPath(t).getFile(t,r)}async deleteFile(t){return this.adapterForPath(t).deleteFile(t)}async addTagToFile(t,r){return this.adapterForPath(t).addTagToFile(t,r)}async renameTagForFile(t,r,n){return this.adapterForPath(t).renameTagForFile(t,r,n)}async removeTagFromFile(t,r){return this.adapterForPath(t).removeTagFromFile(t,r)}filesForTag(t){return this.primary.filesForTag(t)}};var T1=(e,t)=>{if(!e)return"";let r=t.spaceManager.uriByString(e);if(r.refType){if(r.refType=="context"){let n=t.contextsIndex.get(r.basePath)?.schemas.find(a=>a.id==r.ref),i=t.spacesIndex.get(r.basePath);return n&&i?`${i.name} / ${n.name}`:""}return r.refType=="action"?t.actionsIndex.get(r.basePath)?.find(n=>n.schema.id==r.ref)?.schema.name:r.ref}return t.pathsIndex.get(r.basePath)?.name||e},i0=e=>AM(e.substring(e.lastIndexOf("/")))||e,ZJ=e=>{let t=[],r=e.split("/"),n="";for(let i=0;ie.lastIndexOf("/")!=-1?e.lastIndexOf(".")!=-1?AM(e.substring(e.lastIndexOf("/")+1,e.lastIndexOf("."))):e.substring(e.lastIndexOf("/")+1):e.lastIndexOf(".")!=-1?e.substring(0,e.lastIndexOf(".")):e,Lx=e=>e.substring(0,e.lastIndexOf("."))||e,Fu=e=>{let t=e.lastIndexOf("/");return t==-1?"/":e.substring(0,t+1)};var kq=async(e,t,r)=>{let n=H4e(e,t),i=zx(Cq(r)),a=e.spaceManager.pathsForTag(t);for(let o of a)e.spaceManager.renameTag(o,t,i);await JJ(e,t,i);for(let o of n)await kq(e,o,o.replace(t,i));return i},XJ=e=>{e.startsWith("#")&&(e=e.slice(1));let t=e.split("/"),r=[];for(let n=0;ne.trim(),H4e=(e,t)=>e.spaceManager.readTags().filter(n=>n.startsWith(t)&&n!=t),KJ=e=>KE(zx(e)),jM=e=>rf(e).replace(/\+/g,"/"),zx=e=>{if(!e)return null;let t=e;return t.charAt(0)!="#"&&(t="#"+t),t.toLowerCase()},hl=e=>e.charAt(0)=="#"?e.charAt(1)=="#"?e.substring(2,e.length):e.substring(1,e.length):e;var Ux=async(e,t,r)=>{if(e.spacesIndex.has(t)){let n=e.spacesIndex.get(t);return n.type=="tag"?kq(e,n.name,r):e.spaceManager.renameSpace(t,vJ(t,r))}else return e.spaceManager.renamePath(t,yJ(t,r))},NM=async(e,t)=>{e.settings.hiddenFiles=kr([...e.settings.hiddenFiles,t]),e.ui.notify("Item is now hidden in the Navigator, you can manage hidden items in the Navigator menu."),e.saveSettings(),e.reloadPath(t,!0).then(r=>e.dispatchEvent("superstateUpdated",null))},eee=async(e,t)=>{e.settings.hiddenFiles=kr([...e.settings.hiddenFiles,...t]),e.saveSettings(),Promise.all(t.map(r=>{e.reloadPath(r,!0)})).then(r=>e.dispatchEvent("superstateUpdated",null))},F1=async(e,t)=>{e.spaceManager.deletePath(t),e.onPathDeleted(t)},tee=async(e,t,r)=>e.spaceManager.renamePath(t,jm(t,r)),TM=async(e,t,r)=>{let n=e.pathsIndex.get(t);if(!n)return;let i=n.parent+"/"+n.name;await e.spaceManager.createSpace(n.name,n.parent,{}),await e.spaceManager.renamePath(t,i+"/"+n.metadata?.file?.name+".md"),e.ui.viewsByPath(t).forEach(a=>{a.openPath(i)}),r&&e.ui.openPath(i,!1)};var ree=(e,t)=>t?e.spacesIndex.has(t):!1,nf=(e,t)=>t.superstate.settings.spacesMDBInHidden?e=="/"?t.superstate.settings.spaceSubFolder+"/":e+t.superstate.settings.spaceSubFolder+"/":e;var FM=(e,t)=>t.spacesFolder+"/"+e;var zee=Ae(yi());var Zx=Ae(yi());var fk=["MO","TU","WE","TH","FR","SA","SU"],Ho=function(){function e(t,r){if(r===0)throw new Error("Can't create weekday with n == 0");this.weekday=t,this.n=r}return e.fromStr=function(t){return new e(fk.indexOf(t))},e.prototype.nth=function(t){return this.n===t?this:new e(this.weekday,t)},e.prototype.equals=function(t){return this.weekday===t.weekday&&this.n===t.n},e.prototype.toString=function(){var t=fk[this.weekday];return this.n&&(t=(this.n>0?"+":"")+String(this.n)+t),t},e.prototype.getJsWeekday=function(){return this.weekday===6?0:this.weekday+1},e}();var ua=function(e){return e!=null},af=function(e){return typeof e=="number"},Dq=function(e){return typeof e=="string"&&fk.includes(e)},Al=Array.isArray,ld=function(e,t){t===void 0&&(t=e),arguments.length===1&&(t=e,e=0);for(var r=[],n=e;n>0,n.length>t?String(n):(t=t-n.length,t>r.length&&(r+=jn(r,t/r.length)),r.slice(0,t)+String(n))}var iee=function(e,t,r){var n=e.split(t);return r?n.slice(0,r).concat([n.slice(r).join(t)]):n},Ql=function(e,t){var r=e%t;return r*t<0?r+t:r},_M=function(e,t){return{div:Math.floor(e/t),mod:Ql(e,t)}},of=function(e){return!ua(e)||e.length===0},Oo=function(e){return!of(e)},Bn=function(e,t){return Oo(e)&&e.indexOf(t)!==-1};var Tm=function(e,t,r,n,i,a){return n===void 0&&(n=0),i===void 0&&(i=0),a===void 0&&(a=0),new Date(Date.UTC(e,t-1,r,n,i,a))},V4e=[31,28,31,30,31,30,31,31,30,31,30,31],oee=1e3*60*60*24,PM=9999,see=Tm(1970,1,1),G4e=[6,0,1,2,3,4,5];var Hx=function(e){return e%4===0&&e%100!==0||e%400===0},Oq=function(e){return e instanceof Date},P1=function(e){return Oq(e)&&!isNaN(e.getTime())};var Q4e=function(e,t){var r=e.getTime(),n=t.getTime(),i=r-n;return Math.round(i/oee)},dk=function(e){return Q4e(e,see)},IM=function(e){return new Date(see.getTime()+e*oee)},Y4e=function(e){var t=e.getUTCMonth();return t===1&&Hx(e.getUTCFullYear())?29:V4e[t]},bA=function(e){return G4e[e.getUTCDay()]},Mq=function(e,t){var r=Tm(e,t+1,1);return[bA(r),Y4e(r)]},BM=function(e,t){return t=t||e,new Date(Date.UTC(e.getUTCFullYear(),e.getUTCMonth(),e.getUTCDate(),t.getHours(),t.getMinutes(),t.getSeconds(),t.getMilliseconds()))},RM=function(e){var t=new Date(e.getTime());return t},jq=function(e){for(var t=[],r=0;rthis.maxDate;if(this.method==="between"){if(r)return!0;if(n)return!1}else if(this.method==="before"){if(n)return!1}else if(this.method==="after")return r?!0:(this.add(t),!1);return this.add(t)},e.prototype.add=function(t){return this._result.push(t),!0},e.prototype.getValue=function(){var t=this._result;switch(this.method){case"all":case"between":return t;case"before":case"after":default:return t.length?t[t.length-1]:null}},e.prototype.clone=function(){return new e(this.method,this.args)},e}(),wA=Z4e;var Nq=function(e,t){return Nq=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,n){r.__proto__=n}||function(r,n){for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(r[i]=n[i])},Nq(e,t)};function Gx(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");Nq(e,t);function r(){this.constructor=e}e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}var ji=function(){return ji=Object.assign||function(t){for(var r,n=1,i=arguments.length;n0&&a[a.length-1])&&(u[0]===6||u[0]===2)){r=0;continue}if(u[0]===3&&(!a||u[1]>a[0]&&u[1]0)&&!(i=n.next()).done;)a.push(i.value)}catch(s){o={error:s}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(o)throw o.error}}return a}function kt(e,t,r){if(r||arguments.length===2)for(var n=0,i=t.length,a;nt[0].length)&&(t=a,r=i)}if(t!=null&&(this.text=this.text.substr(t[0].length),this.text===""&&(this.done=!0)),t==null){this.done=!0,this.symbol=null,this.value=null;return}}while(r==="SKIP");return this.symbol=r,this.value=t,!0},e.prototype.accept=function(t){if(this.symbol===t){if(this.value){var r=this.value;return this.nextSymbol(),r}return this.nextSymbol(),!0}return!1},e.prototype.acceptNumber=function(){return this.accept("number")},e.prototype.expect=function(t){if(this.accept(t))return!0;throw new Error("expected "+t+" but found "+this.symbol)},e}();function mk(e,t){t===void 0&&(t=R1);var r={},n=new rPe(t.tokens);if(!n.start(e))return null;return i(),r;function i(){n.expect("every");var d=n.acceptNumber();if(d&&(r.interval=parseInt(d[0],10)),n.isDone())throw new Error("Unexpected end");switch(n.symbol){case"day(s)":r.freq=Wt.DAILY,n.nextSymbol()&&(o(),f());break;case"weekday(s)":r.freq=Wt.WEEKLY,r.byweekday=[Wt.MO,Wt.TU,Wt.WE,Wt.TH,Wt.FR],n.nextSymbol(),o(),f();break;case"week(s)":r.freq=Wt.WEEKLY,n.nextSymbol()&&(a(),o(),f());break;case"hour(s)":r.freq=Wt.HOURLY,n.nextSymbol()&&(a(),f());break;case"minute(s)":r.freq=Wt.MINUTELY,n.nextSymbol()&&(a(),f());break;case"month(s)":r.freq=Wt.MONTHLY,n.nextSymbol()&&(a(),f());break;case"year(s)":r.freq=Wt.YEARLY,n.nextSymbol()&&(a(),f());break;case"monday":case"tuesday":case"wednesday":case"thursday":case"friday":case"saturday":case"sunday":r.freq=Wt.WEEKLY;var p=n.symbol.substr(0,2).toUpperCase();if(r.byweekday=[Wt[p]],!n.nextSymbol())return;for(;n.accept("comma");){if(n.isDone())throw new Error("Unexpected end");var h=l();if(!h)throw new Error("Unexpected symbol "+n.symbol+", expected weekday");r.byweekday.push(Wt[h]),n.nextSymbol()}o(),c(),f();break;case"january":case"february":case"march":case"april":case"may":case"june":case"july":case"august":case"september":case"october":case"november":case"december":if(r.freq=Wt.YEARLY,r.bymonth=[s()],!n.nextSymbol())return;for(;n.accept("comma");){if(n.isDone())throw new Error("Unexpected end");var m=s();if(!m)throw new Error("Unexpected symbol "+n.symbol+", expected month");r.bymonth.push(m),n.nextSymbol()}a(),f();break;default:throw new Error("Unknown symbol")}}function a(){var d=n.accept("on"),p=n.accept("the");if(!!(d||p))do{var h=u(),m=l(),g=s();if(h)m?(n.nextSymbol(),r.byweekday||(r.byweekday=[]),r.byweekday.push(Wt[m].nth(h))):(r.bymonthday||(r.bymonthday=[]),r.bymonthday.push(h),n.accept("day(s)"));else if(m)n.nextSymbol(),r.byweekday||(r.byweekday=[]),r.byweekday.push(Wt[m]);else if(n.symbol==="weekday(s)")n.nextSymbol(),r.byweekday||(r.byweekday=[Wt.MO,Wt.TU,Wt.WE,Wt.TH,Wt.FR]);else if(n.symbol==="week(s)"){n.nextSymbol();var A=n.acceptNumber();if(!A)throw new Error("Unexpected symbol "+n.symbol+", expected week number");for(r.byweekno=[parseInt(A[0],10)];n.accept("comma");){if(A=n.acceptNumber(),!A)throw new Error("Unexpected symbol "+n.symbol+"; expected monthday");r.byweekno.push(parseInt(A[0],10))}}else if(g)n.nextSymbol(),r.bymonth||(r.bymonth=[]),r.bymonth.push(g);else return}while(n.accept("comma")||n.accept("the")||n.accept("on"))}function o(){var d=n.accept("at");if(!!d)do{var p=n.acceptNumber();if(!p)throw new Error("Unexpected symbol "+n.symbol+", expected hour");for(r.byhour=[parseInt(p[0],10)];n.accept("comma");){if(p=n.acceptNumber(),!p)throw new Error("Unexpected symbol "+n.symbol+"; expected hour");r.byhour.push(parseInt(p[0],10))}}while(n.accept("comma")||n.accept("at"))}function s(){switch(n.symbol){case"january":return 1;case"february":return 2;case"march":return 3;case"april":return 4;case"may":return 5;case"june":return 6;case"july":return 7;case"august":return 8;case"september":return 9;case"october":return 10;case"november":return 11;case"december":return 12;default:return!1}}function l(){switch(n.symbol){case"monday":case"tuesday":case"wednesday":case"thursday":case"friday":case"saturday":case"sunday":return n.symbol.substr(0,2).toUpperCase();default:return!1}}function u(){switch(n.symbol){case"last":return n.nextSymbol(),-1;case"first":return n.nextSymbol(),1;case"second":return n.nextSymbol(),n.accept("last")?-2:2;case"third":return n.nextSymbol(),n.accept("last")?-3:3;case"nth":var d=parseInt(n.value[1],10);if(d<-366||d>366)throw new Error("Nth out of range: "+d);return n.nextSymbol(),n.accept("last")?-d:d;default:return!1}}function c(){n.accept("on"),n.accept("the");var d=u();if(!!d)for(r.bymonthday=[d],n.nextSymbol();n.accept("comma");){if(d=u(),!d)throw new Error("Unexpected symbol "+n.symbol+"; expected monthday");r.bymonthday.push(d),n.nextSymbol()}}function f(){if(n.symbol==="until"){var d=Date.parse(n.text);if(!d)throw new Error("Cannot parse until date:"+n.text);r.until=new Date(d)}else n.accept("for")&&(r.count=parseInt(n.value[0],10),n.expect("number"))}}var pn;(function(e){e[e.YEARLY=0]="YEARLY",e[e.MONTHLY=1]="MONTHLY",e[e.WEEKLY=2]="WEEKLY",e[e.DAILY=3]="DAILY",e[e.HOURLY=4]="HOURLY",e[e.MINUTELY=5]="MINUTELY",e[e.SECONDLY=6]="SECONDLY"})(pn||(pn={}));function hk(e){return e12){var n=Math.floor(this.month/12),i=Ql(this.month,12);this.month=i,this.year+=n,this.month===0&&(this.month=12,--this.year)}},t.prototype.addWeekly=function(r,n){n>this.getWeekday()?this.day+=-(this.getWeekday()+1+(6-n))+r*7:this.day+=-(this.getWeekday()-n)+r*7,this.fixDay()},t.prototype.addDaily=function(r){this.day+=r,this.fixDay()},t.prototype.addHours=function(r,n,i){for(n&&(this.hour+=Math.floor((23-this.hour)/r)*r);;){this.hour+=r;var a=_M(this.hour,24),o=a.div,s=a.mod;if(o&&(this.hour=s,this.addDaily(o)),of(i)||Bn(i,this.hour))break}},t.prototype.addMinutes=function(r,n,i,a){for(n&&(this.minute+=Math.floor((1439-(this.hour*60+this.minute))/r)*r);;){this.minute+=r;var o=_M(this.minute,60),s=o.div,l=o.mod;if(s&&(this.minute=l,this.addHours(s,!1,i)),(of(i)||Bn(i,this.hour))&&(of(a)||Bn(a,this.minute)))break}},t.prototype.addSeconds=function(r,n,i,a,o){for(n&&(this.second+=Math.floor((86399-(this.hour*3600+this.minute*60+this.second))/r)*r);;){this.second+=r;var s=_M(this.second,60),l=s.div,u=s.mod;if(l&&(this.second=u,this.addMinutes(l,!1,i,a)),(of(i)||Bn(i,this.hour))&&(of(a)||Bn(a,this.minute))&&(of(o)||Bn(o,this.second)))break}},t.prototype.fixDay=function(){if(!(this.day<=28)){var r=Mq(this.year,this.month-1)[1];if(!(this.day<=r))for(;this.day>r;){if(this.day-=r,++this.month,this.month===13&&(this.month=1,++this.year,this.year>PM))return;r=Mq(this.year,this.month-1)[1]}}},t.prototype.add=function(r,n){var i=r.freq,a=r.interval,o=r.wkst,s=r.byhour,l=r.byminute,u=r.bysecond;switch(i){case pn.YEARLY:return this.addYears(a);case pn.MONTHLY:return this.addMonths(a);case pn.WEEKLY:return this.addWeekly(a,o);case pn.DAILY:return this.addDaily(a);case pn.HOURLY:return this.addHours(a,n,s);case pn.MINUTELY:return this.addMinutes(a,n,s,l);case pn.SECONDLY:return this.addSeconds(a,n,s,l,u)}},t}(Yx);function _q(e){for(var t=[],r=Object.keys(e),n=0,i=r;n=-366&&n<=366))throw new Error("bysetpos must be between 1 and 366, or between -366 and -1")}}if(!(Boolean(t.byweekno)||Oo(t.byweekno)||Oo(t.byyearday)||Boolean(t.bymonthday)||Oo(t.bymonthday)||ua(t.byweekday)||ua(t.byeaster)))switch(t.freq){case Wt.YEARLY:t.bymonth||(t.bymonth=t.dtstart.getUTCMonth()+1),t.bymonthday=t.dtstart.getUTCDate();break;case Wt.MONTHLY:t.bymonthday=t.dtstart.getUTCDate();break;case Wt.WEEKLY:t.byweekday=[bA(t.dtstart)];break}if(ua(t.bymonth)&&!Al(t.bymonth)&&(t.bymonth=[t.bymonth]),ua(t.byyearday)&&!Al(t.byyearday)&&af(t.byyearday)&&(t.byyearday=[t.byyearday]),!ua(t.bymonthday))t.bymonthday=[],t.bynmonthday=[];else if(Al(t.bymonthday)){for(var i=[],a=[],r=0;r0?i.push(n):n<0&&a.push(n)}t.bymonthday=i,t.bynmonthday=a}else t.bymonthday<0?(t.bynmonthday=[t.bymonthday],t.bymonthday=[]):(t.bynmonthday=[],t.bymonthday=[t.bymonthday]);if(ua(t.byweekno)&&!Al(t.byweekno)&&(t.byweekno=[t.byweekno]),!ua(t.byweekday))t.bynweekday=null;else if(af(t.byweekday))t.byweekday=[t.byweekday],t.bynweekday=null;else if(Dq(t.byweekday))t.byweekday=[Ho.fromStr(t.byweekday).weekday],t.bynweekday=null;else if(t.byweekday instanceof Ho)!t.byweekday.n||t.freq>Wt.MONTHLY?(t.byweekday=[t.byweekday.weekday],t.bynweekday=null):(t.bynweekday=[[t.byweekday.weekday,t.byweekday.n]],t.byweekday=null);else{for(var o=[],s=[],r=0;rWt.MONTHLY?o.push(l.weekday):s.push([l.weekday,l.n])}t.byweekday=Oo(o)?o:null,t.bynweekday=Oo(s)?s:null}return ua(t.byhour)?af(t.byhour)&&(t.byhour=[t.byhour]):t.byhour=t.freq=4?(c=0,u=s.yearlen+Ql(o-t.wkst,7)):u=n-c;for(var f=Math.floor(u/7),d=Ql(u,7),p=Math.floor(f+d/4),h=0;h0&&m<=p){var g=void 0;m>1?(g=c+(m-1)*7,c!==l&&(g-=7-l)):g=c;for(var A=0;A<7&&(s.wnomask[g]=1,g++,s.wdaymask[g]!==t.wkst);A++);}}if(Bn(t.byweekno,1)){var g=c+p*7;if(c!==l&&(g-=7-l),g=4?(x=0,S=w+Ql(v-t.wkst,7)):S=n-c,b=Math.floor(52+Ql(S,7)/4)}if(Bn(t.byweekno,b))for(var g=0;ga)return SA(e);if(b>=r){var v=Fee(b,t);if(!e.accept(v)||s&&(--s,!s))return SA(e)}}else for(var A=p;Aa)return SA(e);if(b>=r){var v=Fee(b,t);if(!e.accept(v)||s&&(--s,!s))return SA(e)}}}if(t.interval===0||(l.add(t,m),l.year>PM))return SA(e);hk(n)||(c=u.gettimeset(n)(l.hour,l.minute,l.second,0)),u.rebuild(l.year,l.month)}}function mPe(e,t,r){var n=r.bymonth,i=r.byweekno,a=r.byweekday,o=r.byeaster,s=r.bymonthday,l=r.bynmonthday,u=r.byyearday;return Oo(n)&&!Bn(n,e.mmask[t])||Oo(i)&&!e.wnomask[t]||Oo(a)&&!Bn(a,e.wdaymask[t])||Oo(e.nwdaymask)&&!e.nwdaymask[t]||o!==null&&!Bn(e.eastermask,t)||(Oo(s)||Oo(l))&&!Bn(s,e.mdaymask[t])&&!Bn(l,e.nmdaymask[t])||Oo(u)&&(t=e.yearlen&&!Bn(u,t+1-e.yearlen)&&!Bn(u,-e.nextyearlen+t-e.yearlen))}function Fee(e,t){return new $1(e,t.tzid).rezonedDate()}function SA(e){return e.getValue()}function hPe(e,t,r,n,i){for(var a=!1,o=t;o=Wt.HOURLY&&Oo(i)&&!Bn(i,t.hour)||n>=Wt.MINUTELY&&Oo(a)&&!Bn(a,t.minute)||n>=Wt.SECONDLY&&Oo(o)&&!Bn(o,t.second)?[]:e.gettimeset(n)(t.hour,t.minute,t.second,t.millisecond)}var ud={MO:new Ho(0),TU:new Ho(1),WE:new Ho(2),TH:new Ho(3),FR:new Ho(4),SA:new Ho(5),SU:new Ho(6)},Ak={freq:pn.YEARLY,dtstart:null,interval:1,wkst:ud.MO,count:null,until:null,tzid:null,bysetpos:null,bymonth:null,bymonthday:null,bynmonthday:null,byyearday:null,byweekno:null,byweekday:null,bynweekday:null,byhour:null,byminute:null,bysecond:null,byeaster:null},Aee=Object.keys(Ak),Wt=function(){function e(t,r){t===void 0&&(t={}),r===void 0&&(r=!1),this._cache=r?null:new yee,this.origOptions=_q(t);var n=mee(t).parsedOptions;this.options=n}return e.parseText=function(t,r){return mk(t,r)},e.fromText=function(t,r){return cee(t,r)},e.fromString=function(t){return new e(e.parseString(t)||void 0)},e.prototype._iter=function(t){return qM(t,this.options)},e.prototype._cacheGet=function(t,r){return this._cache?this._cache._cacheGet(t,r):!1},e.prototype._cacheAdd=function(t,r,n){if(!!this._cache)return this._cache._cacheAdd(t,r,n)},e.prototype.all=function(t){if(t)return this._iter(new Fq("all",{},t));var r=this._cacheGet("all");return r===!1&&(r=this._iter(new wA("all",{})),this._cacheAdd("all",r)),r},e.prototype.between=function(t,r,n,i){if(n===void 0&&(n=!1),!P1(t)||!P1(r))throw new Error("Invalid date passed in to RRule.between");var a={before:r,after:t,inc:n};if(i)return this._iter(new Fq("between",a,i));var o=this._cacheGet("between",a);return o===!1&&(o=this._iter(new wA("between",a)),this._cacheAdd("between",o,a)),o},e.prototype.before=function(t,r){if(r===void 0&&(r=!1),!P1(t))throw new Error("Invalid date passed in to RRule.before");var n={dt:t,inc:r},i=this._cacheGet("before",n);return i===!1&&(i=this._iter(new wA("before",n)),this._cacheAdd("before",i,n)),i},e.prototype.after=function(t,r){if(r===void 0&&(r=!1),!P1(t))throw new Error("Invalid date passed in to RRule.after");var n={dt:t,inc:r},i=this._cacheGet("after",n);return i===!1&&(i=this._iter(new wA("after",n)),this._cacheAdd("after",i,n)),i},e.prototype.count=function(){return this.all().length},e.prototype.toString=function(){return yk(this.origOptions)},e.prototype.toText=function(t,r,n){return fee(this,t,r,n)},e.prototype.isFullyConvertibleToText=function(){return dee(this)},e.prototype.clone=function(){return new e(this.origOptions)},e.FREQUENCIES=["YEARLY","MONTHLY","WEEKLY","DAILY","HOURLY","MINUTELY","SECONDLY"],e.YEARLY=pn.YEARLY,e.MONTHLY=pn.MONTHLY,e.WEEKLY=pn.WEEKLY,e.DAILY=pn.DAILY,e.HOURLY=pn.HOURLY,e.MINUTELY=pn.MINUTELY,e.SECONDLY=pn.SECONDLY,e.MO=ud.MO,e.TU=ud.TU,e.WE=ud.WE,e.TH=ud.TH,e.FR=ud.FR,e.SA=ud.SA,e.SU=ud.SU,e.parseString=vk,e.optionsToString=yk,e}();function _ee(e,t,r,n,i,a){var o={},s=e.accept;function l(d,p){r.forEach(function(h){h.between(d,p,!0).forEach(function(m){o[Number(m)]=!0})})}i.forEach(function(d){var p=new $1(d,a).rezonedDate();o[Number(p)]=!0}),e.accept=function(d){var p=Number(d);return isNaN(p)?s.call(this,d):!o[p]&&(l(new Date(p-1),new Date(p+1)),!o[p])?(o[p]=!0,s.call(this,d)):!0},e.method==="between"&&(l(e.args.after,e.args.before),e.accept=function(d){var p=Number(d);return o[p]?!0:(o[p]=!0,s.call(this,d))});for(var u=0;u1||i.length||a.length||o.length){var c=new Bq(u);return c.dtstart(s),c.tzid(l||void 0),n.forEach(function(d){c.rrule(new Wt(Iq(d,s,l),u))}),i.forEach(function(d){c.rdate(d)}),a.forEach(function(d){c.exrule(new Wt(Iq(d,s,l),u))}),o.forEach(function(d){c.exdate(d)}),t.compatible&&t.dtstart&&c.rdate(s),c}var f=n[0]||{};return new Wt(Iq(f,f.dtstart||t.dtstart||s,f.tzid||t.tzid||l),u)}function LM(e,t){return t===void 0&&(t={}),vPe(e,yPe(t))}function Iq(e,t,r){return ji(ji({},e),{dtstart:t,tzid:r})}function yPe(e){var t=[],r=Object.keys(e),n=Object.keys(Pee);if(r.forEach(function(i){Bn(n,i)||t.push(i)}),t.length)throw new Error("Invalid options: "+t.join(", "));return ji(ji({},Pee),e)}function bPe(e){if(e.indexOf(":")===-1)return{name:"RRULE",value:e};var t=iee(e,":",1),r=t[0],n=t[1];return{name:r,value:n}}function xPe(e){var t=bPe(e),r=t.name,n=t.value,i=r.split(";");if(!i)throw new Error("empty property name");return{name:i[0].toUpperCase(),parms:i.slice(1),value:n}}function wPe(e,t){if(t===void 0&&(t=!1),e=e&&e.trim(),!e)throw new Error("Invalid empty string");if(!t)return e.split(/\s/);for(var r=e.split(` +`)}function oPe(e,t){return e?"DTSTART"+new $1(new Date(e),t).toString():""}function sPe(e,t){return Array.isArray(e)?!Array.isArray(t)||e.length!==t.length?!1:e.every(function(r,n){return r.getTime()===t[n].getTime()}):e instanceof Date?t instanceof Date&&e.getTime()===t.getTime():e===t}var yee=function(){function e(){this.all=!1,this.before=[],this.after=[],this.between=[]}return e.prototype._cacheAdd=function(t,r,n){r&&(r=r instanceof Date?RM(r):jq(r)),t==="all"?this.all=r:(n._value=r,this[t].push(n))},e.prototype._cacheGet=function(t,r){var n=!1,i=r?Object.keys(r):[],a=function(c){for(var f=0;f=4?(c=0,u=s.yearlen+Ql(o-t.wkst,7)):u=n-c;for(var f=Math.floor(u/7),d=Ql(u,7),p=Math.floor(f+d/4),h=0;h0&&m<=p){var g=void 0;m>1?(g=c+(m-1)*7,c!==l&&(g-=7-l)):g=c;for(var A=0;A<7&&(s.wnomask[g]=1,g++,s.wdaymask[g]!==t.wkst);A++);}}if(Bn(t.byweekno,1)){var g=c+p*7;if(c!==l&&(g-=7-l),g=4?(x=0,S=w+Ql(v-t.wkst,7)):S=n-c,b=Math.floor(52+Ql(S,7)/4)}if(Bn(t.byweekno,b))for(var g=0;ga)return SA(e);if(b>=r){var v=Fee(b,t);if(!e.accept(v)||s&&(--s,!s))return SA(e)}}else for(var A=p;Aa)return SA(e);if(b>=r){var v=Fee(b,t);if(!e.accept(v)||s&&(--s,!s))return SA(e)}}}if(t.interval===0||(l.add(t,m),l.year>PM))return SA(e);hk(n)||(c=u.gettimeset(n)(l.hour,l.minute,l.second,0)),u.rebuild(l.year,l.month)}}function mPe(e,t,r){var n=r.bymonth,i=r.byweekno,a=r.byweekday,o=r.byeaster,s=r.bymonthday,l=r.bynmonthday,u=r.byyearday;return Oo(n)&&!Bn(n,e.mmask[t])||Oo(i)&&!e.wnomask[t]||Oo(a)&&!Bn(a,e.wdaymask[t])||Oo(e.nwdaymask)&&!e.nwdaymask[t]||o!==null&&!Bn(e.eastermask,t)||(Oo(s)||Oo(l))&&!Bn(s,e.mdaymask[t])&&!Bn(l,e.nmdaymask[t])||Oo(u)&&(t=e.yearlen&&!Bn(u,t+1-e.yearlen)&&!Bn(u,-e.nextyearlen+t-e.yearlen))}function Fee(e,t){return new $1(e,t.tzid).rezonedDate()}function SA(e){return e.getValue()}function hPe(e,t,r,n,i){for(var a=!1,o=t;o=Wt.HOURLY&&Oo(i)&&!Bn(i,t.hour)||n>=Wt.MINUTELY&&Oo(a)&&!Bn(a,t.minute)||n>=Wt.SECONDLY&&Oo(o)&&!Bn(o,t.second)?[]:e.gettimeset(n)(t.hour,t.minute,t.second,t.millisecond)}var ud={MO:new Ho(0),TU:new Ho(1),WE:new Ho(2),TH:new Ho(3),FR:new Ho(4),SA:new Ho(5),SU:new Ho(6)},Ak={freq:pn.YEARLY,dtstart:null,interval:1,wkst:ud.MO,count:null,until:null,tzid:null,bysetpos:null,bymonth:null,bymonthday:null,bynmonthday:null,byyearday:null,byweekno:null,byweekday:null,bynweekday:null,byhour:null,byminute:null,bysecond:null,byeaster:null},Aee=Object.keys(Ak),Wt=function(){function e(t,r){t===void 0&&(t={}),r===void 0&&(r=!1),this._cache=r?null:new yee,this.origOptions=_q(t);var n=mee(t).parsedOptions;this.options=n}return e.parseText=function(t,r){return mk(t,r)},e.fromText=function(t,r){return cee(t,r)},e.fromString=function(t){return new e(e.parseString(t)||void 0)},e.prototype._iter=function(t){return qM(t,this.options)},e.prototype._cacheGet=function(t,r){return this._cache?this._cache._cacheGet(t,r):!1},e.prototype._cacheAdd=function(t,r,n){if(!!this._cache)return this._cache._cacheAdd(t,r,n)},e.prototype.all=function(t){if(t)return this._iter(new Fq("all",{},t));var r=this._cacheGet("all");return r===!1&&(r=this._iter(new wA("all",{})),this._cacheAdd("all",r)),r},e.prototype.between=function(t,r,n,i){if(n===void 0&&(n=!1),!P1(t)||!P1(r))throw new Error("Invalid date passed in to RRule.between");var a={before:r,after:t,inc:n};if(i)return this._iter(new Fq("between",a,i));var o=this._cacheGet("between",a);return o===!1&&(o=this._iter(new wA("between",a)),this._cacheAdd("between",o,a)),o},e.prototype.before=function(t,r){if(r===void 0&&(r=!1),!P1(t))throw new Error("Invalid date passed in to RRule.before");var n={dt:t,inc:r},i=this._cacheGet("before",n);return i===!1&&(i=this._iter(new wA("before",n)),this._cacheAdd("before",i,n)),i},e.prototype.after=function(t,r){if(r===void 0&&(r=!1),!P1(t))throw new Error("Invalid date passed in to RRule.after");var n={dt:t,inc:r},i=this._cacheGet("after",n);return i===!1&&(i=this._iter(new wA("after",n)),this._cacheAdd("after",i,n)),i},e.prototype.count=function(){return this.all().length},e.prototype.toString=function(){return yk(this.origOptions)},e.prototype.toText=function(t,r,n){return fee(this,t,r,n)},e.prototype.isFullyConvertibleToText=function(){return dee(this)},e.prototype.clone=function(){return new e(this.origOptions)},e.FREQUENCIES=["YEARLY","MONTHLY","WEEKLY","DAILY","HOURLY","MINUTELY","SECONDLY"],e.YEARLY=pn.YEARLY,e.MONTHLY=pn.MONTHLY,e.WEEKLY=pn.WEEKLY,e.DAILY=pn.DAILY,e.HOURLY=pn.HOURLY,e.MINUTELY=pn.MINUTELY,e.SECONDLY=pn.SECONDLY,e.MO=ud.MO,e.TU=ud.TU,e.WE=ud.WE,e.TH=ud.TH,e.FR=ud.FR,e.SA=ud.SA,e.SU=ud.SU,e.parseString=vk,e.optionsToString=yk,e}();function _ee(e,t,r,n,i,a){var o={},s=e.accept;function l(d,p){r.forEach(function(h){h.between(d,p,!0).forEach(function(m){o[Number(m)]=!0})})}i.forEach(function(d){var p=new $1(d,a).rezonedDate();o[Number(p)]=!0}),e.accept=function(d){var p=Number(d);return isNaN(p)?s.call(this,d):!o[p]&&(l(new Date(p-1),new Date(p+1)),!o[p])?(o[p]=!0,s.call(this,d)):!0},e.method==="between"&&(l(e.args.after,e.args.before),e.accept=function(d){var p=Number(d);return o[p]?!0:(o[p]=!0,s.call(this,d))});for(var u=0;u1||i.length||a.length||o.length){var c=new Bq(u);return c.dtstart(s),c.tzid(l||void 0),n.forEach(function(d){c.rrule(new Wt(Iq(d,s,l),u))}),i.forEach(function(d){c.rdate(d)}),a.forEach(function(d){c.exrule(new Wt(Iq(d,s,l),u))}),o.forEach(function(d){c.exdate(d)}),t.compatible&&t.dtstart&&c.rdate(s),c}var f=n[0]||{};return new Wt(Iq(f,f.dtstart||t.dtstart||s,f.tzid||t.tzid||l),u)}function LM(e,t){return t===void 0&&(t={}),vPe(e,yPe(t))}function Iq(e,t,r){return ji(ji({},e),{dtstart:t,tzid:r})}function yPe(e){var t=[],r=Object.keys(e),n=Object.keys(Pee);if(r.forEach(function(i){Bn(n,i)||t.push(i)}),t.length)throw new Error("Invalid options: "+t.join(", "));return ji(ji({},Pee),e)}function bPe(e){if(e.indexOf(":")===-1)return{name:"RRULE",value:e};var t=iee(e,":",1),r=t[0],n=t[1];return{name:r,value:n}}function xPe(e){var t=bPe(e),r=t.name,n=t.value,i=r.split(";");if(!i)throw new Error("empty property name");return{name:i[0].toUpperCase(),parms:i.slice(1),value:n}}function wPe(e,t){if(t===void 0&&(t=!1),e=e&&e.trim(),!e)throw new Error("Invalid empty string");if(!t)return e.split(/\s/);for(var r=e.split(` `),n=0;n0&&i[0]===" "?(r[n-1]+=i.slice(1),r.splice(n,1)):n+=1:r.splice(n,1)}return r}function SPe(e){e.forEach(function(t){if(!/(VALUE=DATE(-TIME)?)|(TZID=)/.test(t))throw new Error("unsupported RDATE/EXDATE parm: "+t)})}function Iee(e,t){return SPe(t),e.split(",").map(function(r){return pk(r)})}function Bee(e){var t=this;return function(r){if(r!==void 0&&(t["_".concat(e)]=r),t["_".concat(e)]!==void 0)return t["_".concat(e)];for(var n=0;ne instanceof Date&&!isNaN(e),$s="yyyy-MM-dd'T'HH:mm:ss",_r=(e,t,r)=>{let n;try{let i=t.getHours()>0||t.getMinutes()>0||t.getSeconds()>0;n=Za(t,r?.length>0?r:i?`${e.settings.defaultDateFormat} ${e.settings.defaultTimeFormat}`:e.settings.defaultDateFormat)}catch{n=""}return n},Yi=e=>e?(0,Zx.isFinite)(e)?new Date(e):(0,Zx.isString)(e)?DM(e):(0,Zx.isDate)(e)?e:null:null,zM=e=>{if(e=="DAILY")return Wt.DAILY;if(e=="WEEKLY")return Wt.WEEKLY;if(e=="MONTHLY")return Wt.MONTHLY;if(e=="YEARLY")return Wt.YEARLY;if(e=="HOURLY")return Wt.HOURLY},Xx=e=>{if(e=="SU")return 6;if(e=="MO")return 0;if(e=="TU")return 1;if(e=="WE")return 2;if(e=="TH")return 3;if(e=="FR")return 4;if(e=="SA")return 5};var Uee=(e,t)=>kr(t?.rows.reduce((r,n)=>(0,zee.isString)(n[e])?[...r,...sr(n[e])]:[...r],[])??[]),Kx=(e,t)=>{let r=[...e.getSpaceItems(t.path,!0)];return{...HJ(t),rows:r.map(n=>({[mt]:n.path,Created:_r(e,Yi(n.metadata?.ctime),"yyyy-MM-dd")}))}},bk=(e,t,r)=>r?{...e,rows:Cx(e.rows,r,t)}:{...e,rows:[...e.rows,t]},JJ=async(e,t,r)=>{let n=FM(t,e.settings);await e.spaceManager.pathExists(n)?e.spaceManager.renamePath(n,kJ(n)+"/"+r):F1(e,n),e.onTagRenamed(t,r)};var EPe=[509,0,227,0,150,4,294,9,1368,2,2,1,6,3,41,2,5,0,166,1,574,3,9,9,370,1,81,2,71,10,50,3,123,2,54,14,32,10,3,1,11,3,46,10,8,0,46,9,7,2,37,13,2,9,6,1,45,0,13,2,49,13,9,3,2,11,83,11,7,0,3,0,158,11,6,9,7,3,56,1,2,6,3,1,3,2,10,0,11,1,3,6,4,4,193,17,10,9,5,0,82,19,13,9,214,6,3,8,28,1,83,16,16,9,82,12,9,9,84,14,5,9,243,14,166,9,71,5,2,1,3,3,2,0,2,1,13,9,120,6,3,6,4,0,29,9,41,6,2,3,9,0,10,10,47,15,406,7,2,7,17,9,57,21,2,13,123,5,4,0,2,1,2,6,2,0,9,9,49,4,2,1,2,4,9,9,330,3,10,1,2,0,49,6,4,4,14,9,5351,0,7,14,13835,9,87,9,39,4,60,6,26,9,1014,0,2,54,8,3,82,0,12,1,19628,1,4706,45,3,22,543,4,4,5,9,7,3,6,31,3,149,2,1418,49,513,54,5,49,9,0,15,0,23,4,2,14,1361,6,2,16,3,6,2,1,2,4,101,0,161,6,10,9,357,0,62,13,499,13,983,6,110,6,6,9,4759,9,787719,239],Yee=[0,11,2,25,2,18,2,1,2,14,3,13,35,122,70,52,268,28,4,48,48,31,14,29,6,37,11,29,3,35,5,7,2,4,43,157,19,35,5,35,5,39,9,51,13,10,2,14,2,6,2,1,2,10,2,14,2,6,2,1,68,310,10,21,11,7,25,5,2,41,2,8,70,5,3,0,2,43,2,1,4,0,3,22,11,22,10,30,66,18,2,1,11,21,11,25,71,55,7,1,65,0,16,3,2,2,2,28,43,28,4,28,36,7,2,27,28,53,11,21,11,18,14,17,111,72,56,50,14,50,14,35,349,41,7,1,79,28,11,0,9,21,43,17,47,20,28,22,13,52,58,1,3,0,14,44,33,24,27,35,30,0,3,0,9,34,4,0,13,47,15,3,22,0,2,0,36,17,2,24,20,1,64,6,2,0,2,3,2,14,2,9,8,46,39,7,3,1,3,21,2,6,2,1,2,4,4,0,19,0,13,4,159,52,19,3,21,2,31,47,21,1,2,0,185,46,42,3,37,47,21,0,60,42,14,0,72,26,38,6,186,43,117,63,32,7,3,0,3,7,2,1,2,23,16,0,2,0,95,7,3,38,17,0,2,0,29,0,11,39,8,0,22,0,12,45,20,0,19,72,264,8,2,36,18,0,50,29,113,6,2,1,2,37,22,0,26,5,2,1,2,31,15,0,328,18,16,0,2,12,2,33,125,0,80,921,103,110,18,195,2637,96,16,1071,18,5,4026,582,8634,568,8,30,18,78,18,29,19,47,17,3,32,20,6,18,689,63,129,74,6,0,67,12,65,1,2,0,29,6135,9,1237,43,8,8936,3,2,6,2,1,2,290,16,0,30,2,3,0,15,3,9,395,2309,106,6,12,4,8,8,9,5991,84,2,70,2,1,3,0,3,1,3,3,2,11,2,0,2,6,2,64,2,3,3,7,2,6,2,27,2,3,2,4,2,0,4,6,2,339,3,24,2,24,2,30,2,24,2,30,2,24,2,30,2,24,2,30,2,24,2,7,1845,30,7,5,262,61,147,44,11,6,17,0,322,29,19,43,485,27,757,6,2,3,2,1,2,14,2,196,60,67,8,0,1205,3,2,26,2,1,2,0,3,0,2,9,2,3,2,0,2,0,7,0,5,0,2,0,2,0,2,2,2,1,2,0,3,0,2,0,2,0,2,0,2,0,2,1,2,0,3,3,2,6,2,3,2,3,2,0,2,9,2,16,6,2,2,4,2,16,4421,42719,33,4153,7,221,3,5761,15,7472,16,621,2467,541,1507,4938,6,4191],kPe="\u200C\u200D\xB7\u0300-\u036F\u0387\u0483-\u0487\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u0610-\u061A\u064B-\u0669\u0670\u06D6-\u06DC\u06DF-\u06E4\u06E7\u06E8\u06EA-\u06ED\u06F0-\u06F9\u0711\u0730-\u074A\u07A6-\u07B0\u07C0-\u07C9\u07EB-\u07F3\u07FD\u0816-\u0819\u081B-\u0823\u0825-\u0827\u0829-\u082D\u0859-\u085B\u0898-\u089F\u08CA-\u08E1\u08E3-\u0903\u093A-\u093C\u093E-\u094F\u0951-\u0957\u0962\u0963\u0966-\u096F\u0981-\u0983\u09BC\u09BE-\u09C4\u09C7\u09C8\u09CB-\u09CD\u09D7\u09E2\u09E3\u09E6-\u09EF\u09FE\u0A01-\u0A03\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A66-\u0A71\u0A75\u0A81-\u0A83\u0ABC\u0ABE-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AE2\u0AE3\u0AE6-\u0AEF\u0AFA-\u0AFF\u0B01-\u0B03\u0B3C\u0B3E-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B55-\u0B57\u0B62\u0B63\u0B66-\u0B6F\u0B82\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD7\u0BE6-\u0BEF\u0C00-\u0C04\u0C3C\u0C3E-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C62\u0C63\u0C66-\u0C6F\u0C81-\u0C83\u0CBC\u0CBE-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CE2\u0CE3\u0CE6-\u0CEF\u0CF3\u0D00-\u0D03\u0D3B\u0D3C\u0D3E-\u0D44\u0D46-\u0D48\u0D4A-\u0D4D\u0D57\u0D62\u0D63\u0D66-\u0D6F\u0D81-\u0D83\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DE6-\u0DEF\u0DF2\u0DF3\u0E31\u0E34-\u0E3A\u0E47-\u0E4E\u0E50-\u0E59\u0EB1\u0EB4-\u0EBC\u0EC8-\u0ECE\u0ED0-\u0ED9\u0F18\u0F19\u0F20-\u0F29\u0F35\u0F37\u0F39\u0F3E\u0F3F\u0F71-\u0F84\u0F86\u0F87\u0F8D-\u0F97\u0F99-\u0FBC\u0FC6\u102B-\u103E\u1040-\u1049\u1056-\u1059\u105E-\u1060\u1062-\u1064\u1067-\u106D\u1071-\u1074\u1082-\u108D\u108F-\u109D\u135D-\u135F\u1369-\u1371\u1712-\u1715\u1732-\u1734\u1752\u1753\u1772\u1773\u17B4-\u17D3\u17DD\u17E0-\u17E9\u180B-\u180D\u180F-\u1819\u18A9\u1920-\u192B\u1930-\u193B\u1946-\u194F\u19D0-\u19DA\u1A17-\u1A1B\u1A55-\u1A5E\u1A60-\u1A7C\u1A7F-\u1A89\u1A90-\u1A99\u1AB0-\u1ABD\u1ABF-\u1ACE\u1B00-\u1B04\u1B34-\u1B44\u1B50-\u1B59\u1B6B-\u1B73\u1B80-\u1B82\u1BA1-\u1BAD\u1BB0-\u1BB9\u1BE6-\u1BF3\u1C24-\u1C37\u1C40-\u1C49\u1C50-\u1C59\u1CD0-\u1CD2\u1CD4-\u1CE8\u1CED\u1CF4\u1CF7-\u1CF9\u1DC0-\u1DFF\u200C\u200D\u203F\u2040\u2054\u20D0-\u20DC\u20E1\u20E5-\u20F0\u2CEF-\u2CF1\u2D7F\u2DE0-\u2DFF\u302A-\u302F\u3099\u309A\u30FB\uA620-\uA629\uA66F\uA674-\uA67D\uA69E\uA69F\uA6F0\uA6F1\uA802\uA806\uA80B\uA823-\uA827\uA82C\uA880\uA881\uA8B4-\uA8C5\uA8D0-\uA8D9\uA8E0-\uA8F1\uA8FF-\uA909\uA926-\uA92D\uA947-\uA953\uA980-\uA983\uA9B3-\uA9C0\uA9D0-\uA9D9\uA9E5\uA9F0-\uA9F9\uAA29-\uAA36\uAA43\uAA4C\uAA4D\uAA50-\uAA59\uAA7B-\uAA7D\uAAB0\uAAB2-\uAAB4\uAAB7\uAAB8\uAABE\uAABF\uAAC1\uAAEB-\uAAEF\uAAF5\uAAF6\uABE3-\uABEA\uABEC\uABED\uABF0-\uABF9\uFB1E\uFE00-\uFE0F\uFE20-\uFE2F\uFE33\uFE34\uFE4D-\uFE4F\uFF10-\uFF19\uFF3F\uFF65",Zee="\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0560-\u0588\u05D0-\u05EA\u05EF-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u0860-\u086A\u0870-\u0887\u0889-\u088E\u08A0-\u08C9\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u09FC\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C5D\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D04-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E86-\u0E8A\u0E8C-\u0EA3\u0EA5\u0EA7-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u1711\u171F-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1878\u1880-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4C\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C88\u1C90-\u1CBA\u1CBD-\u1CBF\u1CE9-\u1CEC\u1CEE-\u1CF3\u1CF5\u1CF6\u1CFA\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2118-\u211D\u2124\u2126\u2128\u212A-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309B-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312F\u3131-\u318E\u31A0-\u31BF\u31F0-\u31FF\u3400-\u4DBF\u4E00-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA7CA\uA7D0\uA7D1\uA7D3\uA7D5-\uA7D9\uA7F2-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA8FE\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB69\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC",Rq={3:"abstract boolean byte char class double enum export extends final float goto implements import int interface long native package private protected public short static super synchronized throws transient volatile",5:"class enum extends super const export import",6:"enum",strict:"implements interface let package private protected public static yield",strictBind:"eval arguments"},$q="break case catch continue debugger default do else finally for function if return switch throw try var while with null true false instanceof typeof void delete new in this",CPe={5:$q,"5module":$q+" export import",6:$q+" const class extends export import super"},DPe=/^in(stanceof)?$/,OPe=new RegExp("["+Zee+"]"),MPe=new RegExp("["+Zee+kPe+"]");function Lq(e,t){for(var r=65536,n=0;ne)return!1;if(r+=t[n+1],r>=e)return!0}return!1}function EA(e,t){return e<65?e===36:e<91?!0:e<97?e===95:e<123?!0:e<=65535?e>=170&&OPe.test(String.fromCharCode(e)):t===!1?!1:Lq(e,Yee)}function Jx(e,t){return e<48?e===36:e<58?!0:e<65?!1:e<91?!0:e<97?e===95:e<123?!0:e<=65535?e>=170&&MPe.test(String.fromCharCode(e)):t===!1?!1:Lq(e,Yee)||Lq(e,EPe)}var ei=function(t,r){r===void 0&&(r={}),this.label=t,this.keyword=r.keyword,this.beforeExpr=!!r.beforeExpr,this.startsExpr=!!r.startsExpr,this.isLoop=!!r.isLoop,this.isAssign=!!r.isAssign,this.prefix=!!r.prefix,this.postfix=!!r.postfix,this.binop=r.binop||null,this.updateContext=null};function cd(e,t){return new ei(e,{beforeExpr:!0,binop:t})}var fd={beforeExpr:!0},dc={startsExpr:!0},Wq={};function Rn(e,t){return t===void 0&&(t={}),t.keyword=e,Wq[e]=new ei(e,t)}var ge={num:new ei("num",dc),regexp:new ei("regexp",dc),string:new ei("string",dc),name:new ei("name",dc),privateId:new ei("privateId",dc),eof:new ei("eof"),bracketL:new ei("[",{beforeExpr:!0,startsExpr:!0}),bracketR:new ei("]"),braceL:new ei("{",{beforeExpr:!0,startsExpr:!0}),braceR:new ei("}"),parenL:new ei("(",{beforeExpr:!0,startsExpr:!0}),parenR:new ei(")"),comma:new ei(",",fd),semi:new ei(";",fd),colon:new ei(":",fd),dot:new ei("."),question:new ei("?",fd),questionDot:new ei("?."),arrow:new ei("=>",fd),template:new ei("template"),invalidTemplate:new ei("invalidTemplate"),ellipsis:new ei("...",fd),backQuote:new ei("`",dc),dollarBraceL:new ei("${",{beforeExpr:!0,startsExpr:!0}),eq:new ei("=",{beforeExpr:!0,isAssign:!0}),assign:new ei("_=",{beforeExpr:!0,isAssign:!0}),incDec:new ei("++/--",{prefix:!0,postfix:!0,startsExpr:!0}),prefix:new ei("!/~",{beforeExpr:!0,prefix:!0,startsExpr:!0}),logicalOR:cd("||",1),logicalAND:cd("&&",2),bitwiseOR:cd("|",3),bitwiseXOR:cd("^",4),bitwiseAND:cd("&",5),equality:cd("==/!=/===/!==",6),relational:cd("/<=/>=",7),bitShift:cd("<>/>>>",8),plusMin:new ei("+/-",{beforeExpr:!0,binop:9,prefix:!0,startsExpr:!0}),modulo:cd("%",10),star:cd("*",10),slash:cd("/",10),starstar:new ei("**",{beforeExpr:!0}),coalesce:cd("??",1),_break:Rn("break"),_case:Rn("case",fd),_catch:Rn("catch"),_continue:Rn("continue"),_debugger:Rn("debugger"),_default:Rn("default",fd),_do:Rn("do",{isLoop:!0,beforeExpr:!0}),_else:Rn("else",fd),_finally:Rn("finally"),_for:Rn("for",{isLoop:!0}),_function:Rn("function",dc),_if:Rn("if"),_return:Rn("return",fd),_switch:Rn("switch"),_throw:Rn("throw",fd),_try:Rn("try"),_var:Rn("var"),_const:Rn("const"),_while:Rn("while",{isLoop:!0}),_with:Rn("with"),_new:Rn("new",{beforeExpr:!0,startsExpr:!0}),_this:Rn("this",dc),_super:Rn("super",dc),_class:Rn("class",dc),_extends:Rn("extends",fd),_export:Rn("export"),_import:Rn("import",dc),_null:Rn("null",dc),_true:Rn("true",dc),_false:Rn("false",dc),_in:Rn("in",{beforeExpr:!0,binop:7}),_instanceof:Rn("instanceof",{beforeExpr:!0,binop:7}),_typeof:Rn("typeof",{beforeExpr:!0,prefix:!0,startsExpr:!0}),_void:Rn("void",{beforeExpr:!0,prefix:!0,startsExpr:!0}),_delete:Rn("delete",{beforeExpr:!0,prefix:!0,startsExpr:!0})},md=/\r\n?|\n|\u2028|\u2029/,jPe=new RegExp(md.source,"g");function ew(e){return e===10||e===13||e===8232||e===8233}function Xee(e,t,r){r===void 0&&(r=e.length);for(var n=t;n>10)+55296,(e&1023)+56320))}var FPe=/(?:[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])/,wk=function(t,r){this.line=t,this.column=r};wk.prototype.offset=function(t){return new wk(this.line,this.column+t)};var GM=function(t,r,n){this.start=r,this.end=n,t.sourceFile!==null&&(this.source=t.sourceFile)};function ete(e,t){for(var r=1,n=0;;){var i=Xee(e,n,t);if(i<0)return new wk(r,t-n);++r,n=i}}var zq={ecmaVersion:null,sourceType:"script",onInsertedSemicolon:null,onTrailingComma:null,allowReserved:null,allowReturnOutsideFunction:!1,allowImportExportEverywhere:!1,allowAwaitOutsideFunction:null,allowSuperOutsideMethod:null,allowHashBang:!1,checkPrivateFields:!0,locations:!1,onToken:null,onComment:null,ranges:!1,program:null,sourceFile:null,directSourceFile:null,preserveParens:!1},Vee=!1;function _Pe(e){var t={};for(var r in zq)t[r]=e&&Ek(e,r)?e[r]:zq[r];if(t.ecmaVersion==="latest"?t.ecmaVersion=1e8:t.ecmaVersion==null?(!Vee&&typeof console=="object"&&console.warn&&(Vee=!0,console.warn(`Since Acorn 8.0.0, options.ecmaVersion is required. Defaulting to 2020, but this will stop working in the future.`)),t.ecmaVersion=11):t.ecmaVersion>=2015&&(t.ecmaVersion-=2009),t.allowReserved==null&&(t.allowReserved=t.ecmaVersion<5),(!e||e.allowHashBang==null)&&(t.allowHashBang=t.ecmaVersion>=14),Wee(t.onToken)){var n=t.onToken;t.onToken=function(i){return n.push(i)}}return Wee(t.onComment)&&(t.onComment=PPe(t,t.onComment)),t}function PPe(e,t){return function(r,n,i,a,o,s){var l={type:r?"Block":"Line",value:n,start:i,end:a};e.locations&&(l.loc=new GM(this,o,s)),e.ranges&&(l.range=[i,a]),t.push(l)}}var Sk=1,tw=2,Hq=4,tte=8,rte=16,nte=32,Vq=64,ite=128,kk=256,Gq=Sk|tw|kk;function Qq(e,t){return tw|(e?Hq:0)|(t?tte:0)}var WM=0,Yq=1,CA=2,ate=3,ote=4,ste=5,ss=function(t,r,n){this.options=t=_Pe(t),this.sourceFile=t.sourceFile,this.keywords=s0(CPe[t.ecmaVersion>=6?6:t.sourceType==="module"?"5module":5]);var i="";t.allowReserved!==!0&&(i=Rq[t.ecmaVersion>=6?6:t.ecmaVersion===5?5:3],t.sourceType==="module"&&(i+=" await")),this.reservedWords=s0(i);var a=(i?i+" ":"")+Rq.strict;this.reservedWordsStrict=s0(a),this.reservedWordsStrictBind=s0(a+" "+Rq.strictBind),this.input=String(r),this.containsEsc=!1,n?(this.pos=n,this.lineStart=this.input.lastIndexOf(` -`,n-1)+1,this.curLine=this.input.slice(0,this.lineStart).split(md).length):(this.pos=this.lineStart=0,this.curLine=1),this.type=ge.eof,this.value=null,this.start=this.end=this.pos,this.startLoc=this.endLoc=this.curPosition(),this.lastTokEndLoc=this.lastTokStartLoc=null,this.lastTokStart=this.lastTokEnd=this.pos,this.context=this.initialContext(),this.exprAllowed=!0,this.inModule=t.sourceType==="module",this.strict=this.inModule||this.strictDirective(this.pos),this.potentialArrowAt=-1,this.potentialArrowInForAwait=!1,this.yieldPos=this.awaitPos=this.awaitIdentPos=0,this.labels=[],this.undefinedExports=Object.create(null),this.pos===0&&t.allowHashBang&&this.input.slice(0,2)==="#!"&&this.skipLineComment(2),this.scopeStack=[],this.enterScope(Sk),this.regexpState=null,this.privateNameStack=[]},Fm={inFunction:{configurable:!0},inGenerator:{configurable:!0},inAsync:{configurable:!0},canAwait:{configurable:!0},allowSuper:{configurable:!0},allowDirectSuper:{configurable:!0},treatFunctionsAsVar:{configurable:!0},allowNewDotTarget:{configurable:!0},inClassStaticBlock:{configurable:!0}};ss.prototype.parse=function(){var t=this.options.program||this.startNode();return this.nextToken(),this.parseTopLevel(t)};Fm.inFunction.get=function(){return(this.currentVarScope().flags&tw)>0};Fm.inGenerator.get=function(){return(this.currentVarScope().flags&tte)>0&&!this.currentVarScope().inClassFieldInit};Fm.inAsync.get=function(){return(this.currentVarScope().flags&Hq)>0&&!this.currentVarScope().inClassFieldInit};Fm.canAwait.get=function(){for(var e=this.scopeStack.length-1;e>=0;e--){var t=this.scopeStack[e];if(t.inClassFieldInit||t.flags&kk)return!1;if(t.flags&tw)return(t.flags&Hq)>0}return this.inModule&&this.options.ecmaVersion>=13||this.options.allowAwaitOutsideFunction};Fm.allowSuper.get=function(){var e=this.currentThisScope(),t=e.flags,r=e.inClassFieldInit;return(t&Vq)>0||r||this.options.allowSuperOutsideMethod};Fm.allowDirectSuper.get=function(){return(this.currentThisScope().flags&ite)>0};Fm.treatFunctionsAsVar.get=function(){return this.treatFunctionsAsVarInScope(this.currentScope())};Fm.allowNewDotTarget.get=function(){var e=this.currentThisScope(),t=e.flags,r=e.inClassFieldInit;return(t&(tw|kk))>0||r};Fm.inClassStaticBlock.get=function(){return(this.currentVarScope().flags&kk)>0};ss.extend=function(){for(var t=[],r=arguments.length;r--;)t[r]=arguments[r];for(var n=this,i=0;i=,?^&]/.test(i)||i==="!"&&this.input.charAt(n+1)==="=")}e+=t[0].length,dd.lastIndex=e,e+=dd.exec(this.input)[0].length,this.input[e]===";"&&e++}};_u.eat=function(e){return this.type===e?(this.next(),!0):!1};_u.isContextual=function(e){return this.type===ge.name&&this.value===e&&!this.containsEsc};_u.eatContextual=function(e){return this.isContextual(e)?(this.next(),!0):!1};_u.expectContextual=function(e){this.eatContextual(e)||this.unexpected()};_u.canInsertSemicolon=function(){return this.type===ge.eof||this.type===ge.braceR||md.test(this.input.slice(this.lastTokEnd,this.start))};_u.insertSemicolon=function(){if(this.canInsertSemicolon())return this.options.onInsertedSemicolon&&this.options.onInsertedSemicolon(this.lastTokEnd,this.lastTokEndLoc),!0};_u.semicolon=function(){!this.eat(ge.semi)&&!this.insertSemicolon()&&this.unexpected()};_u.afterTrailingComma=function(e,t){if(this.type===e)return this.options.onTrailingComma&&this.options.onTrailingComma(this.lastTokStart,this.lastTokStartLoc),t||this.next(),!0};_u.expect=function(e){this.eat(e)||this.unexpected()};_u.unexpected=function(e){this.raise(e??this.start,"Unexpected token")};var QM=function(){this.shorthandAssign=this.trailingComma=this.parenthesizedAssign=this.parenthesizedBind=this.doubleProto=-1};_u.checkPatternErrors=function(e,t){if(!!e){e.trailingComma>-1&&this.raiseRecoverable(e.trailingComma,"Comma is not permitted after the rest element");var r=t?e.parenthesizedAssign:e.parenthesizedBind;r>-1&&this.raiseRecoverable(r,t?"Assigning to rvalue":"Parenthesized pattern")}};_u.checkExpressionErrors=function(e,t){if(!e)return!1;var r=e.shorthandAssign,n=e.doubleProto;if(!t)return r>=0||n>=0;r>=0&&this.raise(r,"Shorthand property assignments are valid only in destructuring patterns"),n>=0&&this.raiseRecoverable(n,"Redefinition of __proto__ property")};_u.checkYieldAwaitInDefaultParams=function(){this.yieldPos&&(!this.awaitPos||this.yieldPos55295&&n<56320)return!0;if(EA(n,!0)){for(var i=r+1;Jx(n=this.input.charCodeAt(i),!0);)++i;if(n===92||n>55295&&n<56320)return!0;var a=this.input.slice(r,i);if(!DPe.test(a))return!0}return!1};lr.isAsyncFunction=function(){if(this.options.ecmaVersion<8||!this.isContextual("async"))return!1;dd.lastIndex=this.pos;var e=dd.exec(this.input),t=this.pos+e[0].length,r;return!md.test(this.input.slice(this.pos,t))&&this.input.slice(t,t+8)==="function"&&(t+8===this.input.length||!(Jx(r=this.input.charCodeAt(t+8))||r>55295&&r<56320))};lr.parseStatement=function(e,t,r){var n=this.type,i=this.startNode(),a;switch(this.isLet(e)&&(n=ge._var,a="let"),n){case ge._break:case ge._continue:return this.parseBreakContinueStatement(i,n.keyword);case ge._debugger:return this.parseDebuggerStatement(i);case ge._do:return this.parseDoStatement(i);case ge._for:return this.parseForStatement(i);case ge._function:return e&&(this.strict||e!=="if"&&e!=="label")&&this.options.ecmaVersion>=6&&this.unexpected(),this.parseFunctionStatement(i,!1,!e);case ge._class:return e&&this.unexpected(),this.parseClass(i,!0);case ge._if:return this.parseIfStatement(i);case ge._return:return this.parseReturnStatement(i);case ge._switch:return this.parseSwitchStatement(i);case ge._throw:return this.parseThrowStatement(i);case ge._try:return this.parseTryStatement(i);case ge._const:case ge._var:return a=a||this.value,e&&a!=="var"&&this.unexpected(),this.parseVarStatement(i,a);case ge._while:return this.parseWhileStatement(i);case ge._with:return this.parseWithStatement(i);case ge.braceL:return this.parseBlock(!0,i);case ge.semi:return this.parseEmptyStatement(i);case ge._export:case ge._import:if(this.options.ecmaVersion>10&&n===ge._import){dd.lastIndex=this.pos;var o=dd.exec(this.input),s=this.pos+o[0].length,l=this.input.charCodeAt(s);if(l===40||l===46)return this.parseExpressionStatement(i,this.parseExpression())}return this.options.allowImportExportEverywhere||(t||this.raise(this.start,"'import' and 'export' may only appear at the top level"),this.inModule||this.raise(this.start,"'import' and 'export' may appear only with 'sourceType: module'")),n===ge._import?this.parseImport(i):this.parseExport(i,r);default:if(this.isAsyncFunction())return e&&this.unexpected(),this.next(),this.parseFunctionStatement(i,!0,!e);var u=this.value,c=this.parseExpression();return n===ge.name&&c.type==="Identifier"&&this.eat(ge.colon)?this.parseLabeledStatement(i,u,c,e):this.parseExpressionStatement(i,c)}};lr.parseBreakContinueStatement=function(e,t){var r=t==="break";this.next(),this.eat(ge.semi)||this.insertSemicolon()?e.label=null:this.type!==ge.name?this.unexpected():(e.label=this.parseIdent(),this.semicolon());for(var n=0;n=6?this.eat(ge.semi):this.semicolon(),this.finishNode(e,"DoWhileStatement")};lr.parseForStatement=function(e){this.next();var t=this.options.ecmaVersion>=9&&this.canAwait&&this.eatContextual("await")?this.lastTokStart:-1;if(this.labels.push(Zq),this.enterScope(0),this.expect(ge.parenL),this.type===ge.semi)return t>-1&&this.unexpected(t),this.parseFor(e,null);var r=this.isLet();if(this.type===ge._var||this.type===ge._const||r){var n=this.startNode(),i=r?"let":this.value;return this.next(),this.parseVar(n,!0,i),this.finishNode(n,"VariableDeclaration"),(this.type===ge._in||this.options.ecmaVersion>=6&&this.isContextual("of"))&&n.declarations.length===1?(this.options.ecmaVersion>=9&&(this.type===ge._in?t>-1&&this.unexpected(t):e.await=t>-1),this.parseForIn(e,n)):(t>-1&&this.unexpected(t),this.parseFor(e,n))}var a=this.isContextual("let"),o=!1,s=new QM,l=this.parseExpression(t>-1?"await":!0,s);return this.type===ge._in||(o=this.options.ecmaVersion>=6&&this.isContextual("of"))?(this.options.ecmaVersion>=9&&(this.type===ge._in?t>-1&&this.unexpected(t):e.await=t>-1),a&&o&&this.raise(l.start,"The left-hand side of a for-of loop may not start with 'let'."),this.toAssignable(l,!1,s),this.checkLValPattern(l),this.parseForIn(e,l)):(this.checkExpressionErrors(s,!0),t>-1&&this.unexpected(t),this.parseFor(e,l))};lr.parseFunctionStatement=function(e,t,r){return this.next(),this.parseFunction(e,xk|(r?0:Uq),!1,t)};lr.parseIfStatement=function(e){return this.next(),e.test=this.parseParenExpression(),e.consequent=this.parseStatement("if"),e.alternate=this.eat(ge._else)?this.parseStatement("if"):null,this.finishNode(e,"IfStatement")};lr.parseReturnStatement=function(e){return!this.inFunction&&!this.options.allowReturnOutsideFunction&&this.raise(this.start,"'return' outside of function"),this.next(),this.eat(ge.semi)||this.insertSemicolon()?e.argument=null:(e.argument=this.parseExpression(),this.semicolon()),this.finishNode(e,"ReturnStatement")};lr.parseSwitchStatement=function(e){this.next(),e.discriminant=this.parseParenExpression(),e.cases=[],this.expect(ge.braceL),this.labels.push(BPe),this.enterScope(0);for(var t,r=!1;this.type!==ge.braceR;)if(this.type===ge._case||this.type===ge._default){var n=this.type===ge._case;t&&this.finishNode(t,"SwitchCase"),e.cases.push(t=this.startNode()),t.consequent=[],this.next(),n?t.test=this.parseExpression():(r&&this.raiseRecoverable(this.lastTokStart,"Multiple default clauses"),r=!0,t.test=null),this.expect(ge.colon)}else t||this.unexpected(),t.consequent.push(this.parseStatement(null));return this.exitScope(),t&&this.finishNode(t,"SwitchCase"),this.next(),this.labels.pop(),this.finishNode(e,"SwitchStatement")};lr.parseThrowStatement=function(e){return this.next(),md.test(this.input.slice(this.lastTokEnd,this.start))&&this.raise(this.lastTokEnd,"Illegal newline after throw"),e.argument=this.parseExpression(),this.semicolon(),this.finishNode(e,"ThrowStatement")};var RPe=[];lr.parseCatchClauseParam=function(){var e=this.parseBindingAtom(),t=e.type==="Identifier";return this.enterScope(t?nte:0),this.checkLValPattern(e,t?ote:CA),this.expect(ge.parenR),e};lr.parseTryStatement=function(e){if(this.next(),e.block=this.parseBlock(),e.handler=null,this.type===ge._catch){var t=this.startNode();this.next(),this.eat(ge.parenL)?t.param=this.parseCatchClauseParam():(this.options.ecmaVersion<10&&this.unexpected(),t.param=null,this.enterScope(0)),t.body=this.parseBlock(!1),this.exitScope(),e.handler=this.finishNode(t,"CatchClause")}return e.finalizer=this.eat(ge._finally)?this.parseBlock():null,!e.handler&&!e.finalizer&&this.raise(e.start,"Missing catch or finally clause"),this.finishNode(e,"TryStatement")};lr.parseVarStatement=function(e,t,r){return this.next(),this.parseVar(e,!1,t,r),this.semicolon(),this.finishNode(e,"VariableDeclaration")};lr.parseWhileStatement=function(e){return this.next(),e.test=this.parseParenExpression(),this.labels.push(Zq),e.body=this.parseStatement("while"),this.labels.pop(),this.finishNode(e,"WhileStatement")};lr.parseWithStatement=function(e){return this.strict&&this.raise(this.start,"'with' in strict mode"),this.next(),e.object=this.parseParenExpression(),e.body=this.parseStatement("with"),this.finishNode(e,"WithStatement")};lr.parseEmptyStatement=function(e){return this.next(),this.finishNode(e,"EmptyStatement")};lr.parseLabeledStatement=function(e,t,r,n){for(var i=0,a=this.labels;i=0;l--){var u=this.labels[l];if(u.statementStart===e.start)u.statementStart=this.start,u.kind=s;else break}return this.labels.push({name:t,kind:s,statementStart:this.start}),e.body=this.parseStatement(n?n.indexOf("label")===-1?n+"label":n:"label"),this.labels.pop(),e.label=r,this.finishNode(e,"LabeledStatement")};lr.parseExpressionStatement=function(e,t){return e.expression=t,this.semicolon(),this.finishNode(e,"ExpressionStatement")};lr.parseBlock=function(e,t,r){for(e===void 0&&(e=!0),t===void 0&&(t=this.startNode()),t.body=[],this.expect(ge.braceL),e&&this.enterScope(0);this.type!==ge.braceR;){var n=this.parseStatement(null);t.body.push(n)}return r&&(this.strict=!1),this.next(),e&&this.exitScope(),this.finishNode(t,"BlockStatement")};lr.parseFor=function(e,t){return e.init=t,this.expect(ge.semi),e.test=this.type===ge.semi?null:this.parseExpression(),this.expect(ge.semi),e.update=this.type===ge.parenR?null:this.parseExpression(),this.expect(ge.parenR),e.body=this.parseStatement("for"),this.exitScope(),this.labels.pop(),this.finishNode(e,"ForStatement")};lr.parseForIn=function(e,t){var r=this.type===ge._in;return this.next(),t.type==="VariableDeclaration"&&t.declarations[0].init!=null&&(!r||this.options.ecmaVersion<8||this.strict||t.kind!=="var"||t.declarations[0].id.type!=="Identifier")&&this.raise(t.start,(r?"for-in":"for-of")+" loop variable declaration may not have an initializer"),e.left=t,e.right=r?this.parseExpression():this.parseMaybeAssign(),this.expect(ge.parenR),e.body=this.parseStatement("for"),this.exitScope(),this.labels.pop(),this.finishNode(e,r?"ForInStatement":"ForOfStatement")};lr.parseVar=function(e,t,r,n){for(e.declarations=[],e.kind=r;;){var i=this.startNode();if(this.parseVarId(i,r),this.eat(ge.eq)?i.init=this.parseMaybeAssign(t):!n&&r==="const"&&!(this.type===ge._in||this.options.ecmaVersion>=6&&this.isContextual("of"))?this.unexpected():!n&&i.id.type!=="Identifier"&&!(t&&(this.type===ge._in||this.isContextual("of")))?this.raise(this.lastTokEnd,"Complex binding patterns require an initialization value"):i.init=null,e.declarations.push(this.finishNode(i,"VariableDeclarator")),!this.eat(ge.comma))break}return e};lr.parseVarId=function(e,t){e.id=this.parseBindingAtom(),this.checkLValPattern(e.id,t==="var"?Yq:CA,!1)};var xk=1,Uq=2,lte=4;lr.parseFunction=function(e,t,r,n,i){this.initFunction(e),(this.options.ecmaVersion>=9||this.options.ecmaVersion>=6&&!n)&&(this.type===ge.star&&t&Uq&&this.unexpected(),e.generator=this.eat(ge.star)),this.options.ecmaVersion>=8&&(e.async=!!n),t&xk&&(e.id=t<e&&this.type!==ge.name?null:this.parseIdent(),e.id&&!(t&Uq)&&this.checkLValSimple(e.id,this.strict||e.generator||e.async?this.treatFunctionsAsVar?Yq:CA:ate));var a=this.yieldPos,o=this.awaitPos,s=this.awaitIdentPos;return this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0,this.enterScope(Qq(e.async,e.generator)),t&xk||(e.id=this.type===ge.name?this.parseIdent():null),this.parseFunctionParams(e),this.parseFunctionBody(e,r,!1,i),this.yieldPos=a,this.awaitPos=o,this.awaitIdentPos=s,this.finishNode(e,t&xk?"FunctionDeclaration":"FunctionExpression")};lr.parseFunctionParams=function(e){this.expect(ge.parenL),e.params=this.parseBindingList(ge.parenR,!1,this.options.ecmaVersion>=8),this.checkYieldAwaitInDefaultParams()};lr.parseClass=function(e,t){this.next();var r=this.strict;this.strict=!0,this.parseClassId(e,t),this.parseClassSuper(e);var n=this.enterClassBody(),i=this.startNode(),a=!1;for(i.body=[],this.expect(ge.braceL);this.type!==ge.braceR;){var o=this.parseClassElement(e.superClass!==null);o&&(i.body.push(o),o.type==="MethodDefinition"&&o.kind==="constructor"?(a&&this.raiseRecoverable(o.start,"Duplicate constructor in the same class"),a=!0):o.key&&o.key.type==="PrivateIdentifier"&&$Pe(n,o)&&this.raiseRecoverable(o.key.start,"Identifier '#"+o.key.name+"' has already been declared"))}return this.strict=r,this.next(),e.body=this.finishNode(i,"ClassBody"),this.exitClassBody(),this.finishNode(e,t?"ClassDeclaration":"ClassExpression")};lr.parseClassElement=function(e){if(this.eat(ge.semi))return null;var t=this.options.ecmaVersion,r=this.startNode(),n="",i=!1,a=!1,o="method",s=!1;if(this.eatContextual("static")){if(t>=13&&this.eat(ge.braceL))return this.parseClassStaticBlock(r),r;this.isClassElementNameStart()||this.type===ge.star?s=!0:n="static"}if(r.static=s,!n&&t>=8&&this.eatContextual("async")&&((this.isClassElementNameStart()||this.type===ge.star)&&!this.canInsertSemicolon()?a=!0:n="async"),!n&&(t>=9||!a)&&this.eat(ge.star)&&(i=!0),!n&&!a&&!i){var l=this.value;(this.eatContextual("get")||this.eatContextual("set"))&&(this.isClassElementNameStart()?o=l:n=l)}if(n?(r.computed=!1,r.key=this.startNodeAt(this.lastTokStart,this.lastTokStartLoc),r.key.name=n,this.finishNode(r.key,"Identifier")):this.parseClassElementName(r),t<13||this.type===ge.parenL||o!=="method"||i||a){var u=!r.static&&HM(r,"constructor"),c=u&&e;u&&o!=="method"&&this.raise(r.key.start,"Constructor can't have get/set modifier"),r.kind=u?"constructor":o,this.parseClassMethod(r,i,a,c)}else this.parseClassField(r);return r};lr.isClassElementNameStart=function(){return this.type===ge.name||this.type===ge.privateId||this.type===ge.num||this.type===ge.string||this.type===ge.bracketL||this.type.keyword};lr.parseClassElementName=function(e){this.type===ge.privateId?(this.value==="constructor"&&this.raise(this.start,"Classes can't have an element named '#constructor'"),e.computed=!1,e.key=this.parsePrivateIdent()):this.parsePropertyName(e)};lr.parseClassMethod=function(e,t,r,n){var i=e.key;e.kind==="constructor"?(t&&this.raise(i.start,"Constructor can't be a generator"),r&&this.raise(i.start,"Constructor can't be an async method")):e.static&&HM(e,"prototype")&&this.raise(i.start,"Classes may not have a static property named prototype");var a=e.value=this.parseMethod(t,r,n);return e.kind==="get"&&a.params.length!==0&&this.raiseRecoverable(a.start,"getter should have no params"),e.kind==="set"&&a.params.length!==1&&this.raiseRecoverable(a.start,"setter should have exactly one param"),e.kind==="set"&&a.params[0].type==="RestElement"&&this.raiseRecoverable(a.params[0].start,"Setter cannot use rest params"),this.finishNode(e,"MethodDefinition")};lr.parseClassField=function(e){if(HM(e,"constructor")?this.raise(e.key.start,"Classes can't have a field named 'constructor'"):e.static&&HM(e,"prototype")&&this.raise(e.key.start,"Classes can't have a static field named 'prototype'"),this.eat(ge.eq)){var t=this.currentThisScope(),r=t.inClassFieldInit;t.inClassFieldInit=!0,e.value=this.parseMaybeAssign(),t.inClassFieldInit=r}else e.value=null;return this.semicolon(),this.finishNode(e,"PropertyDefinition")};lr.parseClassStaticBlock=function(e){e.body=[];var t=this.labels;for(this.labels=[],this.enterScope(kk|Vq);this.type!==ge.braceR;){var r=this.parseStatement(null);e.body.push(r)}return this.next(),this.exitScope(),this.labels=t,this.finishNode(e,"StaticBlock")};lr.parseClassId=function(e,t){this.type===ge.name?(e.id=this.parseIdent(),t&&this.checkLValSimple(e.id,CA,!1)):(t===!0&&this.unexpected(),e.id=null)};lr.parseClassSuper=function(e){e.superClass=this.eat(ge._extends)?this.parseExprSubscripts(null,!1):null};lr.enterClassBody=function(){var e={declared:Object.create(null),used:[]};return this.privateNameStack.push(e),e.declared};lr.exitClassBody=function(){var e=this.privateNameStack.pop(),t=e.declared,r=e.used;if(!!this.options.checkPrivateFields)for(var n=this.privateNameStack.length,i=n===0?null:this.privateNameStack[n-1],a=0;a=11&&(this.eatContextual("as")?(e.exported=this.parseModuleExportName(),this.checkExport(t,e.exported,this.lastTokStart)):e.exported=null),this.expectContextual("from"),this.type!==ge.string&&this.unexpected(),e.source=this.parseExprAtom(),this.semicolon(),this.finishNode(e,"ExportAllDeclaration")};lr.parseExport=function(e,t){if(this.next(),this.eat(ge.star))return this.parseExportAllDeclaration(e,t);if(this.eat(ge._default))return this.checkExport(t,"default",this.lastTokStart),e.declaration=this.parseExportDefaultDeclaration(),this.finishNode(e,"ExportDefaultDeclaration");if(this.shouldParseExportStatement())e.declaration=this.parseExportDeclaration(e),e.declaration.type==="VariableDeclaration"?this.checkVariableExport(t,e.declaration.declarations):this.checkExport(t,e.declaration.id,e.declaration.id.start),e.specifiers=[],e.source=null;else{if(e.declaration=null,e.specifiers=this.parseExportSpecifiers(t),this.eatContextual("from"))this.type!==ge.string&&this.unexpected(),e.source=this.parseExprAtom();else{for(var r=0,n=e.specifiers;r=13&&this.type===ge.string){var e=this.parseLiteral(this.value);return FPe.test(e.value)&&this.raise(e.start,"An export name cannot include a lone surrogate."),e}return this.parseIdent(!0)};lr.adaptDirectivePrologue=function(e){for(var t=0;t=5&&e.type==="ExpressionStatement"&&e.expression.type==="Literal"&&typeof e.expression.value=="string"&&(this.input[e.start]==='"'||this.input[e.start]==="'")};var hd=ss.prototype;hd.toAssignable=function(e,t,r){if(this.options.ecmaVersion>=6&&e)switch(e.type){case"Identifier":this.inAsync&&e.name==="await"&&this.raise(e.start,"Cannot use 'await' as identifier inside an async function");break;case"ObjectPattern":case"ArrayPattern":case"AssignmentPattern":case"RestElement":break;case"ObjectExpression":e.type="ObjectPattern",r&&this.checkPatternErrors(r,!0);for(var n=0,i=e.properties;n=8&&!s&&l.name==="async"&&!this.canInsertSemicolon()&&this.eat(ge._function))return this.overrideContext(Ra.f_expr),this.parseFunction(this.startNodeAt(a,o),0,!1,!0,t);if(i&&!this.canInsertSemicolon()){if(this.eat(ge.arrow))return this.parseArrowExpression(this.startNodeAt(a,o),[l],!1,t);if(this.options.ecmaVersion>=8&&l.name==="async"&&this.type===ge.name&&!s&&(!this.potentialArrowInForAwait||this.value!=="of"||this.containsEsc))return l=this.parseIdent(!1),(this.canInsertSemicolon()||!this.eat(ge.arrow))&&this.unexpected(),this.parseArrowExpression(this.startNodeAt(a,o),[l],!0,t)}return l;case ge.regexp:var u=this.value;return n=this.parseLiteral(u.value),n.regex={pattern:u.pattern,flags:u.flags},n;case ge.num:case ge.string:return this.parseLiteral(this.value);case ge._null:case ge._true:case ge._false:return n=this.startNode(),n.value=this.type===ge._null?null:this.type===ge._true,n.raw=this.type.keyword,this.next(),this.finishNode(n,"Literal");case ge.parenL:var c=this.start,f=this.parseParenAndDistinguishExpression(i,t);return e&&(e.parenthesizedAssign<0&&!this.isSimpleAssignTarget(f)&&(e.parenthesizedAssign=c),e.parenthesizedBind<0&&(e.parenthesizedBind=c)),f;case ge.bracketL:return n=this.startNode(),this.next(),n.elements=this.parseExprList(ge.bracketR,!0,!0,e),this.finishNode(n,"ArrayExpression");case ge.braceL:return this.overrideContext(Ra.b_expr),this.parseObj(!1,e);case ge._function:return n=this.startNode(),this.next(),this.parseFunction(n,0);case ge._class:return this.parseClass(this.startNode(),!1);case ge._new:return this.parseNew();case ge.backQuote:return this.parseTemplate();case ge._import:return this.options.ecmaVersion>=11?this.parseExprImport(r):this.unexpected();default:return this.parseExprAtomDefault()}};Pr.parseExprAtomDefault=function(){this.unexpected()};Pr.parseExprImport=function(e){var t=this.startNode();if(this.containsEsc&&this.raiseRecoverable(this.start,"Escape sequence in keyword import"),this.next(),this.type===ge.parenL&&!e)return this.parseDynamicImport(t);if(this.type===ge.dot){var r=this.startNodeAt(t.start,t.loc&&t.loc.start);return r.name="import",t.meta=this.finishNode(r,"Identifier"),this.parseImportMeta(t)}else this.unexpected()};Pr.parseDynamicImport=function(e){if(this.next(),e.source=this.parseMaybeAssign(),!this.eat(ge.parenR)){var t=this.start;this.eat(ge.comma)&&this.eat(ge.parenR)?this.raiseRecoverable(t,"Trailing comma is not allowed in import()"):this.unexpected(t)}return this.finishNode(e,"ImportExpression")};Pr.parseImportMeta=function(e){this.next();var t=this.containsEsc;return e.property=this.parseIdent(!0),e.property.name!=="meta"&&this.raiseRecoverable(e.property.start,"The only valid meta property for import is 'import.meta'"),t&&this.raiseRecoverable(e.start,"'import.meta' must not contain escaped characters"),this.options.sourceType!=="module"&&!this.options.allowImportExportEverywhere&&this.raiseRecoverable(e.start,"Cannot use 'import.meta' outside a module"),this.finishNode(e,"MetaProperty")};Pr.parseLiteral=function(e){var t=this.startNode();return t.value=e,t.raw=this.input.slice(this.start,this.end),t.raw.charCodeAt(t.raw.length-1)===110&&(t.bigint=t.raw.slice(0,-1).replace(/_/g,"")),this.next(),this.finishNode(t,"Literal")};Pr.parseParenExpression=function(){this.expect(ge.parenL);var e=this.parseExpression();return this.expect(ge.parenR),e};Pr.shouldParseArrow=function(e){return!this.canInsertSemicolon()};Pr.parseParenAndDistinguishExpression=function(e,t){var r=this.start,n=this.startLoc,i,a=this.options.ecmaVersion>=8;if(this.options.ecmaVersion>=6){this.next();var o=this.start,s=this.startLoc,l=[],u=!0,c=!1,f=new QM,d=this.yieldPos,p=this.awaitPos,h;for(this.yieldPos=0,this.awaitPos=0;this.type!==ge.parenR;)if(u?u=!1:this.expect(ge.comma),a&&this.afterTrailingComma(ge.parenR,!0)){c=!0;break}else if(this.type===ge.ellipsis){h=this.start,l.push(this.parseParenItem(this.parseRestBinding())),this.type===ge.comma&&this.raiseRecoverable(this.start,"Comma is not permitted after the rest element");break}else l.push(this.parseMaybeAssign(!1,f,this.parseParenItem));var m=this.lastTokEnd,g=this.lastTokEndLoc;if(this.expect(ge.parenR),e&&this.shouldParseArrow(l)&&this.eat(ge.arrow))return this.checkPatternErrors(f,!1),this.checkYieldAwaitInDefaultParams(),this.yieldPos=d,this.awaitPos=p,this.parseParenArrowList(r,n,l,t);(!l.length||c)&&this.unexpected(this.lastTokStart),h&&this.unexpected(h),this.checkExpressionErrors(f,!0),this.yieldPos=d||this.yieldPos,this.awaitPos=p||this.awaitPos,l.length>1?(i=this.startNodeAt(o,s),i.expressions=l,this.finishNodeAt(i,"SequenceExpression",m,g)):i=l[0]}else i=this.parseParenExpression();if(this.options.preserveParens){var A=this.startNodeAt(r,n);return A.expression=i,this.finishNode(A,"ParenthesizedExpression")}else return i};Pr.parseParenItem=function(e){return e};Pr.parseParenArrowList=function(e,t,r,n){return this.parseArrowExpression(this.startNodeAt(e,t),r,!1,n)};var qPe=[];Pr.parseNew=function(){this.containsEsc&&this.raiseRecoverable(this.start,"Escape sequence in keyword new");var e=this.startNode();if(this.next(),this.options.ecmaVersion>=6&&this.type===ge.dot){var t=this.startNodeAt(e.start,e.loc&&e.loc.start);t.name="new",e.meta=this.finishNode(t,"Identifier"),this.next();var r=this.containsEsc;return e.property=this.parseIdent(!0),e.property.name!=="target"&&this.raiseRecoverable(e.property.start,"The only valid meta property for new is 'new.target'"),r&&this.raiseRecoverable(e.start,"'new.target' must not contain escaped characters"),this.allowNewDotTarget||this.raiseRecoverable(e.start,"'new.target' can only be used in functions and class static block"),this.finishNode(e,"MetaProperty")}var n=this.start,i=this.startLoc;return e.callee=this.parseSubscripts(this.parseExprAtom(null,!1,!0),n,i,!0,!1),this.eat(ge.parenL)?e.arguments=this.parseExprList(ge.parenR,this.options.ecmaVersion>=8,!1):e.arguments=qPe,this.finishNode(e,"NewExpression")};Pr.parseTemplateElement=function(e){var t=e.isTagged,r=this.startNode();return this.type===ge.invalidTemplate?(t||this.raiseRecoverable(this.start,"Bad escape sequence in untagged template literal"),r.value={raw:this.value,cooked:null}):r.value={raw:this.input.slice(this.start,this.end).replace(/\r\n?/g,` -`),cooked:this.value},this.next(),r.tail=this.type===ge.backQuote,this.finishNode(r,"TemplateElement")};Pr.parseTemplate=function(e){e===void 0&&(e={});var t=e.isTagged;t===void 0&&(t=!1);var r=this.startNode();this.next(),r.expressions=[];var n=this.parseTemplateElement({isTagged:t});for(r.quasis=[n];!n.tail;)this.type===ge.eof&&this.raise(this.pos,"Unterminated template literal"),this.expect(ge.dollarBraceL),r.expressions.push(this.parseExpression()),this.expect(ge.braceR),r.quasis.push(n=this.parseTemplateElement({isTagged:t}));return this.next(),this.finishNode(r,"TemplateLiteral")};Pr.isAsyncProp=function(e){return!e.computed&&e.key.type==="Identifier"&&e.key.name==="async"&&(this.type===ge.name||this.type===ge.num||this.type===ge.string||this.type===ge.bracketL||this.type.keyword||this.options.ecmaVersion>=9&&this.type===ge.star)&&!md.test(this.input.slice(this.lastTokEnd,this.start))};Pr.parseObj=function(e,t){var r=this.startNode(),n=!0,i={};for(r.properties=[],this.next();!this.eat(ge.braceR);){if(n)n=!1;else if(this.expect(ge.comma),this.options.ecmaVersion>=5&&this.afterTrailingComma(ge.braceR))break;var a=this.parseProperty(e,t);e||this.checkPropClash(a,i,t),r.properties.push(a)}return this.finishNode(r,e?"ObjectPattern":"ObjectExpression")};Pr.parseProperty=function(e,t){var r=this.startNode(),n,i,a,o;if(this.options.ecmaVersion>=9&&this.eat(ge.ellipsis))return e?(r.argument=this.parseIdent(!1),this.type===ge.comma&&this.raiseRecoverable(this.start,"Comma is not permitted after the rest element"),this.finishNode(r,"RestElement")):(r.argument=this.parseMaybeAssign(!1,t),this.type===ge.comma&&t&&t.trailingComma<0&&(t.trailingComma=this.start),this.finishNode(r,"SpreadElement"));this.options.ecmaVersion>=6&&(r.method=!1,r.shorthand=!1,(e||t)&&(a=this.start,o=this.startLoc),e||(n=this.eat(ge.star)));var s=this.containsEsc;return this.parsePropertyName(r),!e&&!s&&this.options.ecmaVersion>=8&&!n&&this.isAsyncProp(r)?(i=!0,n=this.options.ecmaVersion>=9&&this.eat(ge.star),this.parsePropertyName(r)):i=!1,this.parsePropertyValue(r,e,n,i,a,o,t,s),this.finishNode(r,"Property")};Pr.parseGetterSetter=function(e){e.kind=e.key.name,this.parsePropertyName(e),e.value=this.parseMethod(!1);var t=e.kind==="get"?0:1;if(e.value.params.length!==t){var r=e.value.start;e.kind==="get"?this.raiseRecoverable(r,"getter should have no params"):this.raiseRecoverable(r,"setter should have exactly one param")}else e.kind==="set"&&e.value.params[0].type==="RestElement"&&this.raiseRecoverable(e.value.params[0].start,"Setter cannot use rest params")};Pr.parsePropertyValue=function(e,t,r,n,i,a,o,s){(r||n)&&this.type===ge.colon&&this.unexpected(),this.eat(ge.colon)?(e.value=t?this.parseMaybeDefault(this.start,this.startLoc):this.parseMaybeAssign(!1,o),e.kind="init"):this.options.ecmaVersion>=6&&this.type===ge.parenL?(t&&this.unexpected(),e.kind="init",e.method=!0,e.value=this.parseMethod(r,n)):!t&&!s&&this.options.ecmaVersion>=5&&!e.computed&&e.key.type==="Identifier"&&(e.key.name==="get"||e.key.name==="set")&&this.type!==ge.comma&&this.type!==ge.braceR&&this.type!==ge.eq?((r||n)&&this.unexpected(),this.parseGetterSetter(e)):this.options.ecmaVersion>=6&&!e.computed&&e.key.type==="Identifier"?((r||n)&&this.unexpected(),this.checkUnreserved(e.key),e.key.name==="await"&&!this.awaitIdentPos&&(this.awaitIdentPos=i),e.kind="init",t?e.value=this.parseMaybeDefault(i,a,this.copyNode(e.key)):this.type===ge.eq&&o?(o.shorthandAssign<0&&(o.shorthandAssign=this.start),e.value=this.parseMaybeDefault(i,a,this.copyNode(e.key))):e.value=this.copyNode(e.key),e.shorthand=!0):this.unexpected()};Pr.parsePropertyName=function(e){if(this.options.ecmaVersion>=6){if(this.eat(ge.bracketL))return e.computed=!0,e.key=this.parseMaybeAssign(),this.expect(ge.bracketR),e.key;e.computed=!1}return e.key=this.type===ge.num||this.type===ge.string?this.parseExprAtom():this.parseIdent(this.options.allowReserved!=="never")};Pr.initFunction=function(e){e.id=null,this.options.ecmaVersion>=6&&(e.generator=e.expression=!1),this.options.ecmaVersion>=8&&(e.async=!1)};Pr.parseMethod=function(e,t,r){var n=this.startNode(),i=this.yieldPos,a=this.awaitPos,o=this.awaitIdentPos;return this.initFunction(n),this.options.ecmaVersion>=6&&(n.generator=e),this.options.ecmaVersion>=8&&(n.async=!!t),this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0,this.enterScope(Qq(t,n.generator)|Vq|(r?ite:0)),this.expect(ge.parenL),n.params=this.parseBindingList(ge.parenR,!1,this.options.ecmaVersion>=8),this.checkYieldAwaitInDefaultParams(),this.parseFunctionBody(n,!1,!0,!1),this.yieldPos=i,this.awaitPos=a,this.awaitIdentPos=o,this.finishNode(n,"FunctionExpression")};Pr.parseArrowExpression=function(e,t,r,n){var i=this.yieldPos,a=this.awaitPos,o=this.awaitIdentPos;return this.enterScope(Qq(r,!1)|rte),this.initFunction(e),this.options.ecmaVersion>=8&&(e.async=!!r),this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0,e.params=this.toAssignableList(t,!0),this.parseFunctionBody(e,!0,!1,n),this.yieldPos=i,this.awaitPos=a,this.awaitIdentPos=o,this.finishNode(e,"ArrowFunctionExpression")};Pr.parseFunctionBody=function(e,t,r,n){var i=t&&this.type!==ge.braceL,a=this.strict,o=!1;if(i)e.body=this.parseMaybeAssign(n),e.expression=!0,this.checkParams(e,!1);else{var s=this.options.ecmaVersion>=7&&!this.isSimpleParamList(e.params);(!a||s)&&(o=this.strictDirective(this.end),o&&s&&this.raiseRecoverable(e.start,"Illegal 'use strict' directive in function with non-simple parameter list"));var l=this.labels;this.labels=[],o&&(this.strict=!0),this.checkParams(e,!a&&!o&&!t&&!r&&this.isSimpleParamList(e.params)),this.strict&&e.id&&this.checkLValSimple(e.id,ste),e.body=this.parseBlock(!1,void 0,o&&!a),e.expression=!1,this.adaptDirectivePrologue(e.body.body),this.labels=l}this.exitScope()};Pr.isSimpleParamList=function(e){for(var t=0,r=e;t-1||i.functions.indexOf(e)>-1||i.var.indexOf(e)>-1,i.lexical.push(e),this.inModule&&i.flags&Sk&&delete this.undefinedExports[e]}else if(t===ote){var a=this.currentScope();a.lexical.push(e)}else if(t===ate){var o=this.currentScope();this.treatFunctionsAsVar?n=o.lexical.indexOf(e)>-1:n=o.lexical.indexOf(e)>-1||o.var.indexOf(e)>-1,o.functions.push(e)}else for(var s=this.scopeStack.length-1;s>=0;--s){var l=this.scopeStack[s];if(l.lexical.indexOf(e)>-1&&!(l.flags&nte&&l.lexical[0]===e)||!this.treatFunctionsAsVarInScope(l)&&l.functions.indexOf(e)>-1){n=!0;break}if(l.var.push(e),this.inModule&&l.flags&Sk&&delete this.undefinedExports[e],l.flags&Gq)break}n&&this.raiseRecoverable(r,"Identifier '"+e+"' has already been declared")};u0.checkLocalExport=function(e){this.scopeStack[0].lexical.indexOf(e.name)===-1&&this.scopeStack[0].var.indexOf(e.name)===-1&&(this.undefinedExports[e.name]=e)};u0.currentScope=function(){return this.scopeStack[this.scopeStack.length-1]};u0.currentVarScope=function(){for(var e=this.scopeStack.length-1;;e--){var t=this.scopeStack[e];if(t.flags&Gq)return t}};u0.currentThisScope=function(){for(var e=this.scopeStack.length-1;;e--){var t=this.scopeStack[e];if(t.flags&Gq&&!(t.flags&rte))return t}};var YM=function(t,r,n){this.type="",this.start=r,this.end=0,t.options.locations&&(this.loc=new GM(t,n)),t.options.directSourceFile&&(this.sourceFile=t.options.directSourceFile),t.options.ranges&&(this.range=[r,0])},Ck=ss.prototype;Ck.startNode=function(){return new YM(this,this.start,this.startLoc)};Ck.startNodeAt=function(e,t){return new YM(this,e,t)};function cte(e,t,r,n){return e.type=t,e.end=r,this.options.locations&&(e.loc.end=n),this.options.ranges&&(e.range[1]=r),e}Ck.finishNode=function(e,t){return cte.call(this,e,t,this.lastTokEnd,this.lastTokEndLoc)};Ck.finishNodeAt=function(e,t,r,n){return cte.call(this,e,t,r,n)};Ck.copyNode=function(e){var t=new YM(this,e.start,this.startLoc);for(var r in e)t[r]=e[r];return t};var fte="ASCII ASCII_Hex_Digit AHex Alphabetic Alpha Any Assigned Bidi_Control Bidi_C Bidi_Mirrored Bidi_M Case_Ignorable CI Cased Changes_When_Casefolded CWCF Changes_When_Casemapped CWCM Changes_When_Lowercased CWL Changes_When_NFKC_Casefolded CWKCF Changes_When_Titlecased CWT Changes_When_Uppercased CWU Dash Default_Ignorable_Code_Point DI Deprecated Dep Diacritic Dia Emoji Emoji_Component Emoji_Modifier Emoji_Modifier_Base Emoji_Presentation Extender Ext Grapheme_Base Gr_Base Grapheme_Extend Gr_Ext Hex_Digit Hex IDS_Binary_Operator IDSB IDS_Trinary_Operator IDST ID_Continue IDC ID_Start IDS Ideographic Ideo Join_Control Join_C Logical_Order_Exception LOE Lowercase Lower Math Noncharacter_Code_Point NChar Pattern_Syntax Pat_Syn Pattern_White_Space Pat_WS Quotation_Mark QMark Radical Regional_Indicator RI Sentence_Terminal STerm Soft_Dotted SD Terminal_Punctuation Term Unified_Ideograph UIdeo Uppercase Upper Variation_Selector VS White_Space space XID_Continue XIDC XID_Start XIDS",dte=fte+" Extended_Pictographic",pte=dte,mte=pte+" EBase EComp EMod EPres ExtPict",hte=mte,zPe=hte,UPe={9:fte,10:dte,11:pte,12:mte,13:hte,14:zPe},WPe="Basic_Emoji Emoji_Keycap_Sequence RGI_Emoji_Modifier_Sequence RGI_Emoji_Flag_Sequence RGI_Emoji_Tag_Sequence RGI_Emoji_ZWJ_Sequence RGI_Emoji",HPe={9:"",10:"",11:"",12:"",13:"",14:WPe},Gee="Cased_Letter LC Close_Punctuation Pe Connector_Punctuation Pc Control Cc cntrl Currency_Symbol Sc Dash_Punctuation Pd Decimal_Number Nd digit Enclosing_Mark Me Final_Punctuation Pf Format Cf Initial_Punctuation Pi Letter L Letter_Number Nl Line_Separator Zl Lowercase_Letter Ll Mark M Combining_Mark Math_Symbol Sm Modifier_Letter Lm Modifier_Symbol Sk Nonspacing_Mark Mn Number N Open_Punctuation Ps Other C Other_Letter Lo Other_Number No Other_Punctuation Po Other_Symbol So Paragraph_Separator Zp Private_Use Co Punctuation P punct Separator Z Space_Separator Zs Spacing_Mark Mc Surrogate Cs Symbol S Titlecase_Letter Lt Unassigned Cn Uppercase_Letter Lu",Ate="Adlam Adlm Ahom Anatolian_Hieroglyphs Hluw Arabic Arab Armenian Armn Avestan Avst Balinese Bali Bamum Bamu Bassa_Vah Bass Batak Batk Bengali Beng Bhaiksuki Bhks Bopomofo Bopo Brahmi Brah Braille Brai Buginese Bugi Buhid Buhd Canadian_Aboriginal Cans Carian Cari Caucasian_Albanian Aghb Chakma Cakm Cham Cham Cherokee Cher Common Zyyy Coptic Copt Qaac Cuneiform Xsux Cypriot Cprt Cyrillic Cyrl Deseret Dsrt Devanagari Deva Duployan Dupl Egyptian_Hieroglyphs Egyp Elbasan Elba Ethiopic Ethi Georgian Geor Glagolitic Glag Gothic Goth Grantha Gran Greek Grek Gujarati Gujr Gurmukhi Guru Han Hani Hangul Hang Hanunoo Hano Hatran Hatr Hebrew Hebr Hiragana Hira Imperial_Aramaic Armi Inherited Zinh Qaai Inscriptional_Pahlavi Phli Inscriptional_Parthian Prti Javanese Java Kaithi Kthi Kannada Knda Katakana Kana Kayah_Li Kali Kharoshthi Khar Khmer Khmr Khojki Khoj Khudawadi Sind Lao Laoo Latin Latn Lepcha Lepc Limbu Limb Linear_A Lina Linear_B Linb Lisu Lisu Lycian Lyci Lydian Lydi Mahajani Mahj Malayalam Mlym Mandaic Mand Manichaean Mani Marchen Marc Masaram_Gondi Gonm Meetei_Mayek Mtei Mende_Kikakui Mend Meroitic_Cursive Merc Meroitic_Hieroglyphs Mero Miao Plrd Modi Mongolian Mong Mro Mroo Multani Mult Myanmar Mymr Nabataean Nbat New_Tai_Lue Talu Newa Newa Nko Nkoo Nushu Nshu Ogham Ogam Ol_Chiki Olck Old_Hungarian Hung Old_Italic Ital Old_North_Arabian Narb Old_Permic Perm Old_Persian Xpeo Old_South_Arabian Sarb Old_Turkic Orkh Oriya Orya Osage Osge Osmanya Osma Pahawh_Hmong Hmng Palmyrene Palm Pau_Cin_Hau Pauc Phags_Pa Phag Phoenician Phnx Psalter_Pahlavi Phlp Rejang Rjng Runic Runr Samaritan Samr Saurashtra Saur Sharada Shrd Shavian Shaw Siddham Sidd SignWriting Sgnw Sinhala Sinh Sora_Sompeng Sora Soyombo Soyo Sundanese Sund Syloti_Nagri Sylo Syriac Syrc Tagalog Tglg Tagbanwa Tagb Tai_Le Tale Tai_Tham Lana Tai_Viet Tavt Takri Takr Tamil Taml Tangut Tang Telugu Telu Thaana Thaa Thai Thai Tibetan Tibt Tifinagh Tfng Tirhuta Tirh Ugaritic Ugar Vai Vaii Warang_Citi Wara Yi Yiii Zanabazar_Square Zanb",gte=Ate+" Dogra Dogr Gunjala_Gondi Gong Hanifi_Rohingya Rohg Makasar Maka Medefaidrin Medf Old_Sogdian Sogo Sogdian Sogd",vte=gte+" Elymaic Elym Nandinagari Nand Nyiakeng_Puachue_Hmong Hmnp Wancho Wcho",yte=vte+" Chorasmian Chrs Diak Dives_Akuru Khitan_Small_Script Kits Yezi Yezidi",bte=yte+" Cypro_Minoan Cpmn Old_Uyghur Ougr Tangsa Tnsa Toto Vithkuqi Vith",VPe=bte+" Hrkt Katakana_Or_Hiragana Kawi Nag_Mundari Nagm Unknown Zzzz",GPe={9:Ate,10:gte,11:vte,12:yte,13:bte,14:VPe},xte={};function QPe(e){var t=xte[e]={binary:s0(UPe[e]+" "+Gee),binaryOfStrings:s0(HPe[e]),nonBinary:{General_Category:s0(Gee),Script:s0(GPe[e])}};t.nonBinary.Script_Extensions=t.nonBinary.Script,t.nonBinary.gc=t.nonBinary.General_Category,t.nonBinary.sc=t.nonBinary.Script,t.nonBinary.scx=t.nonBinary.Script_Extensions}for(UM=0,qq=[9,10,11,12,13,14];UM=6?"uy":"")+(t.options.ecmaVersion>=9?"s":"")+(t.options.ecmaVersion>=13?"d":"")+(t.options.ecmaVersion>=15?"v":""),this.unicodeProperties=xte[t.options.ecmaVersion>=14?14:t.options.ecmaVersion],this.source="",this.flags="",this.start=0,this.switchU=!1,this.switchV=!1,this.switchN=!1,this.pos=0,this.lastIntValue=0,this.lastStringValue="",this.lastAssertionIsQuantifiable=!1,this.numCapturingParens=0,this.maxBackReference=0,this.groupNames=[],this.backReferenceNames=[]};_m.prototype.reset=function(t,r,n){var i=n.indexOf("v")!==-1,a=n.indexOf("u")!==-1;this.start=t|0,this.source=r+"",this.flags=n,i&&this.parser.options.ecmaVersion>=15?(this.switchU=!0,this.switchV=!0,this.switchN=!0):(this.switchU=a&&this.parser.options.ecmaVersion>=6,this.switchV=!1,this.switchN=a&&this.parser.options.ecmaVersion>=9)};_m.prototype.raise=function(t){this.parser.raiseRecoverable(this.start,"Invalid regular expression: /"+this.source+"/: "+t)};_m.prototype.at=function(t,r){r===void 0&&(r=!1);var n=this.source,i=n.length;if(t>=i)return-1;var a=n.charCodeAt(t);if(!(r||this.switchU)||a<=55295||a>=57344||t+1>=i)return a;var o=n.charCodeAt(t+1);return o>=56320&&o<=57343?(a<<10)+o-56613888:a};_m.prototype.nextIndex=function(t,r){r===void 0&&(r=!1);var n=this.source,i=n.length;if(t>=i)return i;var a=n.charCodeAt(t),o;return!(r||this.switchU)||a<=55295||a>=57344||t+1>=i||(o=n.charCodeAt(t+1))<56320||o>57343?t+1:t+2};_m.prototype.current=function(t){return t===void 0&&(t=!1),this.at(this.pos,t)};_m.prototype.lookahead=function(t){return t===void 0&&(t=!1),this.at(this.nextIndex(this.pos,t),t)};_m.prototype.advance=function(t){t===void 0&&(t=!1),this.pos=this.nextIndex(this.pos,t)};_m.prototype.eat=function(t,r){return r===void 0&&(r=!1),this.current(r)===t?(this.advance(r),!0):!1};_m.prototype.eatChars=function(t,r){r===void 0&&(r=!1);for(var n=this.pos,i=0,a=t;i-1&&this.raise(e.start,"Duplicate regular expression flag"),o==="u"&&(n=!0),o==="v"&&(i=!0)}this.options.ecmaVersion>=15&&n&&i&&this.raise(e.start,"Invalid regular expression flag")};er.validateRegExpPattern=function(e){this.regexp_pattern(e),!e.switchN&&this.options.ecmaVersion>=9&&e.groupNames.length>0&&(e.switchN=!0,this.regexp_pattern(e))};er.regexp_pattern=function(e){e.pos=0,e.lastIntValue=0,e.lastStringValue="",e.lastAssertionIsQuantifiable=!1,e.numCapturingParens=0,e.maxBackReference=0,e.groupNames.length=0,e.backReferenceNames.length=0,this.regexp_disjunction(e),e.pos!==e.source.length&&(e.eat(41)&&e.raise("Unmatched ')'"),(e.eat(93)||e.eat(125))&&e.raise("Lone quantifier brackets")),e.maxBackReference>e.numCapturingParens&&e.raise("Invalid escape");for(var t=0,r=e.backReferenceNames;t=9&&(r=e.eat(60)),e.eat(61)||e.eat(33))return this.regexp_disjunction(e),e.eat(41)||e.raise("Unterminated group"),e.lastAssertionIsQuantifiable=!r,!0}return e.pos=t,!1};er.regexp_eatQuantifier=function(e,t){return t===void 0&&(t=!1),this.regexp_eatQuantifierPrefix(e,t)?(e.eat(63),!0):!1};er.regexp_eatQuantifierPrefix=function(e,t){return e.eat(42)||e.eat(43)||e.eat(63)||this.regexp_eatBracedQuantifier(e,t)};er.regexp_eatBracedQuantifier=function(e,t){var r=e.pos;if(e.eat(123)){var n=0,i=-1;if(this.regexp_eatDecimalDigits(e)&&(n=e.lastIntValue,e.eat(44)&&this.regexp_eatDecimalDigits(e)&&(i=e.lastIntValue),e.eat(125)))return i!==-1&&i=9?this.regexp_groupSpecifier(e):e.current()===63&&e.raise("Invalid group"),this.regexp_disjunction(e),e.eat(41))return e.numCapturingParens+=1,!0;e.raise("Unterminated group")}return!1};er.regexp_eatExtendedAtom=function(e){return e.eat(46)||this.regexp_eatReverseSolidusAtomEscape(e)||this.regexp_eatCharacterClass(e)||this.regexp_eatUncapturingGroup(e)||this.regexp_eatCapturingGroup(e)||this.regexp_eatInvalidBracedQuantifier(e)||this.regexp_eatExtendedPatternCharacter(e)};er.regexp_eatInvalidBracedQuantifier=function(e){return this.regexp_eatBracedQuantifier(e,!0)&&e.raise("Nothing to repeat"),!1};er.regexp_eatSyntaxCharacter=function(e){var t=e.current();return wte(t)?(e.lastIntValue=t,e.advance(),!0):!1};function wte(e){return e===36||e>=40&&e<=43||e===46||e===63||e>=91&&e<=94||e>=123&&e<=125}er.regexp_eatPatternCharacters=function(e){for(var t=e.pos,r=0;(r=e.current())!==-1&&!wte(r);)e.advance();return e.pos!==t};er.regexp_eatExtendedPatternCharacter=function(e){var t=e.current();return t!==-1&&t!==36&&!(t>=40&&t<=43)&&t!==46&&t!==63&&t!==91&&t!==94&&t!==124?(e.advance(),!0):!1};er.regexp_groupSpecifier=function(e){if(e.eat(63)){if(this.regexp_eatGroupName(e)){e.groupNames.indexOf(e.lastStringValue)!==-1&&e.raise("Duplicate capture group name"),e.groupNames.push(e.lastStringValue);return}e.raise("Invalid group")}};er.regexp_eatGroupName=function(e){if(e.lastStringValue="",e.eat(60)){if(this.regexp_eatRegExpIdentifierName(e)&&e.eat(62))return!0;e.raise("Invalid capture group name")}return!1};er.regexp_eatRegExpIdentifierName=function(e){if(e.lastStringValue="",this.regexp_eatRegExpIdentifierStart(e)){for(e.lastStringValue+=l0(e.lastIntValue);this.regexp_eatRegExpIdentifierPart(e);)e.lastStringValue+=l0(e.lastIntValue);return!0}return!1};er.regexp_eatRegExpIdentifierStart=function(e){var t=e.pos,r=this.options.ecmaVersion>=11,n=e.current(r);return e.advance(r),n===92&&this.regexp_eatRegExpUnicodeEscapeSequence(e,r)&&(n=e.lastIntValue),YPe(n)?(e.lastIntValue=n,!0):(e.pos=t,!1)};function YPe(e){return EA(e,!0)||e===36||e===95}er.regexp_eatRegExpIdentifierPart=function(e){var t=e.pos,r=this.options.ecmaVersion>=11,n=e.current(r);return e.advance(r),n===92&&this.regexp_eatRegExpUnicodeEscapeSequence(e,r)&&(n=e.lastIntValue),ZPe(n)?(e.lastIntValue=n,!0):(e.pos=t,!1)};function ZPe(e){return Jx(e,!0)||e===36||e===95||e===8204||e===8205}er.regexp_eatAtomEscape=function(e){return this.regexp_eatBackReference(e)||this.regexp_eatCharacterClassEscape(e)||this.regexp_eatCharacterEscape(e)||e.switchN&&this.regexp_eatKGroupName(e)?!0:(e.switchU&&(e.current()===99&&e.raise("Invalid unicode escape"),e.raise("Invalid escape")),!1)};er.regexp_eatBackReference=function(e){var t=e.pos;if(this.regexp_eatDecimalEscape(e)){var r=e.lastIntValue;if(e.switchU)return r>e.maxBackReference&&(e.maxBackReference=r),!0;if(r<=e.numCapturingParens)return!0;e.pos=t}return!1};er.regexp_eatKGroupName=function(e){if(e.eat(107)){if(this.regexp_eatGroupName(e))return e.backReferenceNames.push(e.lastStringValue),!0;e.raise("Invalid named reference")}return!1};er.regexp_eatCharacterEscape=function(e){return this.regexp_eatControlEscape(e)||this.regexp_eatCControlLetter(e)||this.regexp_eatZero(e)||this.regexp_eatHexEscapeSequence(e)||this.regexp_eatRegExpUnicodeEscapeSequence(e,!1)||!e.switchU&&this.regexp_eatLegacyOctalEscapeSequence(e)||this.regexp_eatIdentityEscape(e)};er.regexp_eatCControlLetter=function(e){var t=e.pos;if(e.eat(99)){if(this.regexp_eatControlLetter(e))return!0;e.pos=t}return!1};er.regexp_eatZero=function(e){return e.current()===48&&!ZM(e.lookahead())?(e.lastIntValue=0,e.advance(),!0):!1};er.regexp_eatControlEscape=function(e){var t=e.current();return t===116?(e.lastIntValue=9,e.advance(),!0):t===110?(e.lastIntValue=10,e.advance(),!0):t===118?(e.lastIntValue=11,e.advance(),!0):t===102?(e.lastIntValue=12,e.advance(),!0):t===114?(e.lastIntValue=13,e.advance(),!0):!1};er.regexp_eatControlLetter=function(e){var t=e.current();return Ste(t)?(e.lastIntValue=t%32,e.advance(),!0):!1};function Ste(e){return e>=65&&e<=90||e>=97&&e<=122}er.regexp_eatRegExpUnicodeEscapeSequence=function(e,t){t===void 0&&(t=!1);var r=e.pos,n=t||e.switchU;if(e.eat(117)){if(this.regexp_eatFixedHexDigits(e,4)){var i=e.lastIntValue;if(n&&i>=55296&&i<=56319){var a=e.pos;if(e.eat(92)&&e.eat(117)&&this.regexp_eatFixedHexDigits(e,4)){var o=e.lastIntValue;if(o>=56320&&o<=57343)return e.lastIntValue=(i-55296)*1024+(o-56320)+65536,!0}e.pos=a,e.lastIntValue=i}return!0}if(n&&e.eat(123)&&this.regexp_eatHexDigits(e)&&e.eat(125)&&XPe(e.lastIntValue))return!0;n&&e.raise("Invalid unicode escape"),e.pos=r}return!1};function XPe(e){return e>=0&&e<=1114111}er.regexp_eatIdentityEscape=function(e){if(e.switchU)return this.regexp_eatSyntaxCharacter(e)?!0:e.eat(47)?(e.lastIntValue=47,!0):!1;var t=e.current();return t!==99&&(!e.switchN||t!==107)?(e.lastIntValue=t,e.advance(),!0):!1};er.regexp_eatDecimalEscape=function(e){e.lastIntValue=0;var t=e.current();if(t>=49&&t<=57){do e.lastIntValue=10*e.lastIntValue+(t-48),e.advance();while((t=e.current())>=48&&t<=57);return!0}return!1};var Ete=0,kA=1,pd=2;er.regexp_eatCharacterClassEscape=function(e){var t=e.current();if(KPe(t))return e.lastIntValue=-1,e.advance(),kA;var r=!1;if(e.switchU&&this.options.ecmaVersion>=9&&((r=t===80)||t===112)){e.lastIntValue=-1,e.advance();var n;if(e.eat(123)&&(n=this.regexp_eatUnicodePropertyValueExpression(e))&&e.eat(125))return r&&n===pd&&e.raise("Invalid property name"),n;e.raise("Invalid property name")}return Ete};function KPe(e){return e===100||e===68||e===115||e===83||e===119||e===87}er.regexp_eatUnicodePropertyValueExpression=function(e){var t=e.pos;if(this.regexp_eatUnicodePropertyName(e)&&e.eat(61)){var r=e.lastStringValue;if(this.regexp_eatUnicodePropertyValue(e)){var n=e.lastStringValue;return this.regexp_validateUnicodePropertyNameAndValue(e,r,n),kA}}if(e.pos=t,this.regexp_eatLoneUnicodePropertyNameOrValue(e)){var i=e.lastStringValue;return this.regexp_validateUnicodePropertyNameOrValue(e,i)}return Ete};er.regexp_validateUnicodePropertyNameAndValue=function(e,t,r){Ek(e.unicodeProperties.nonBinary,t)||e.raise("Invalid property name"),e.unicodeProperties.nonBinary[t].test(r)||e.raise("Invalid property value")};er.regexp_validateUnicodePropertyNameOrValue=function(e,t){if(e.unicodeProperties.binary.test(t))return kA;if(e.switchV&&e.unicodeProperties.binaryOfStrings.test(t))return pd;e.raise("Invalid property name")};er.regexp_eatUnicodePropertyName=function(e){var t=0;for(e.lastStringValue="";kte(t=e.current());)e.lastStringValue+=l0(t),e.advance();return e.lastStringValue!==""};function kte(e){return Ste(e)||e===95}er.regexp_eatUnicodePropertyValue=function(e){var t=0;for(e.lastStringValue="";JPe(t=e.current());)e.lastStringValue+=l0(t),e.advance();return e.lastStringValue!==""};function JPe(e){return kte(e)||ZM(e)}er.regexp_eatLoneUnicodePropertyNameOrValue=function(e){return this.regexp_eatUnicodePropertyValue(e)};er.regexp_eatCharacterClass=function(e){if(e.eat(91)){var t=e.eat(94),r=this.regexp_classContents(e);return e.eat(93)||e.raise("Unterminated character class"),t&&r===pd&&e.raise("Negated character class may contain strings"),!0}return!1};er.regexp_classContents=function(e){return e.current()===93?kA:e.switchV?this.regexp_classSetExpression(e):(this.regexp_nonEmptyClassRanges(e),kA)};er.regexp_nonEmptyClassRanges=function(e){for(;this.regexp_eatClassAtom(e);){var t=e.lastIntValue;if(e.eat(45)&&this.regexp_eatClassAtom(e)){var r=e.lastIntValue;e.switchU&&(t===-1||r===-1)&&e.raise("Invalid character class"),t!==-1&&r!==-1&&t>r&&e.raise("Range out of order in character class")}}};er.regexp_eatClassAtom=function(e){var t=e.pos;if(e.eat(92)){if(this.regexp_eatClassEscape(e))return!0;if(e.switchU){var r=e.current();(r===99||Ote(r))&&e.raise("Invalid class escape"),e.raise("Invalid escape")}e.pos=t}var n=e.current();return n!==93?(e.lastIntValue=n,e.advance(),!0):!1};er.regexp_eatClassEscape=function(e){var t=e.pos;if(e.eat(98))return e.lastIntValue=8,!0;if(e.switchU&&e.eat(45))return e.lastIntValue=45,!0;if(!e.switchU&&e.eat(99)){if(this.regexp_eatClassControlLetter(e))return!0;e.pos=t}return this.regexp_eatCharacterClassEscape(e)||this.regexp_eatCharacterEscape(e)};er.regexp_classSetExpression=function(e){var t=kA,r;if(!this.regexp_eatClassSetRange(e))if(r=this.regexp_eatClassSetOperand(e)){r===pd&&(t=pd);for(var n=e.pos;e.eatChars([38,38]);){if(e.current()!==38&&(r=this.regexp_eatClassSetOperand(e))){r!==pd&&(t=kA);continue}e.raise("Invalid character in character class")}if(n!==e.pos)return t;for(;e.eatChars([45,45]);)this.regexp_eatClassSetOperand(e)||e.raise("Invalid character in character class");if(n!==e.pos)return t}else e.raise("Invalid character in character class");for(;;)if(!this.regexp_eatClassSetRange(e)){if(r=this.regexp_eatClassSetOperand(e),!r)return t;r===pd&&(t=pd)}};er.regexp_eatClassSetRange=function(e){var t=e.pos;if(this.regexp_eatClassSetCharacter(e)){var r=e.lastIntValue;if(e.eat(45)&&this.regexp_eatClassSetCharacter(e)){var n=e.lastIntValue;return r!==-1&&n!==-1&&r>n&&e.raise("Range out of order in character class"),!0}e.pos=t}return!1};er.regexp_eatClassSetOperand=function(e){return this.regexp_eatClassSetCharacter(e)?kA:this.regexp_eatClassStringDisjunction(e)||this.regexp_eatNestedClass(e)};er.regexp_eatNestedClass=function(e){var t=e.pos;if(e.eat(91)){var r=e.eat(94),n=this.regexp_classContents(e);if(e.eat(93))return r&&n===pd&&e.raise("Negated character class may contain strings"),n;e.pos=t}if(e.eat(92)){var i=this.regexp_eatCharacterClassEscape(e);if(i)return i;e.pos=t}return null};er.regexp_eatClassStringDisjunction=function(e){var t=e.pos;if(e.eatChars([92,113])){if(e.eat(123)){var r=this.regexp_classStringDisjunctionContents(e);if(e.eat(125))return r}else e.raise("Invalid escape");e.pos=t}return null};er.regexp_classStringDisjunctionContents=function(e){for(var t=this.regexp_classString(e);e.eat(124);)this.regexp_classString(e)===pd&&(t=pd);return t};er.regexp_classString=function(e){for(var t=0;this.regexp_eatClassSetCharacter(e);)t++;return t===1?kA:pd};er.regexp_eatClassSetCharacter=function(e){var t=e.pos;if(e.eat(92))return this.regexp_eatCharacterEscape(e)||this.regexp_eatClassSetReservedPunctuator(e)?!0:e.eat(98)?(e.lastIntValue=8,!0):(e.pos=t,!1);var r=e.current();return r<0||r===e.lookahead()&&eIe(r)||tIe(r)?!1:(e.advance(),e.lastIntValue=r,!0)};function eIe(e){return e===33||e>=35&&e<=38||e>=42&&e<=44||e===46||e>=58&&e<=64||e===94||e===96||e===126}function tIe(e){return e===40||e===41||e===45||e===47||e>=91&&e<=93||e>=123&&e<=125}er.regexp_eatClassSetReservedPunctuator=function(e){var t=e.current();return rIe(t)?(e.lastIntValue=t,e.advance(),!0):!1};function rIe(e){return e===33||e===35||e===37||e===38||e===44||e===45||e>=58&&e<=62||e===64||e===96||e===126}er.regexp_eatClassControlLetter=function(e){var t=e.current();return ZM(t)||t===95?(e.lastIntValue=t%32,e.advance(),!0):!1};er.regexp_eatHexEscapeSequence=function(e){var t=e.pos;if(e.eat(120)){if(this.regexp_eatFixedHexDigits(e,2))return!0;e.switchU&&e.raise("Invalid escape"),e.pos=t}return!1};er.regexp_eatDecimalDigits=function(e){var t=e.pos,r=0;for(e.lastIntValue=0;ZM(r=e.current());)e.lastIntValue=10*e.lastIntValue+(r-48),e.advance();return e.pos!==t};function ZM(e){return e>=48&&e<=57}er.regexp_eatHexDigits=function(e){var t=e.pos,r=0;for(e.lastIntValue=0;Cte(r=e.current());)e.lastIntValue=16*e.lastIntValue+Dte(r),e.advance();return e.pos!==t};function Cte(e){return e>=48&&e<=57||e>=65&&e<=70||e>=97&&e<=102}function Dte(e){return e>=65&&e<=70?10+(e-65):e>=97&&e<=102?10+(e-97):e-48}er.regexp_eatLegacyOctalEscapeSequence=function(e){if(this.regexp_eatOctalDigit(e)){var t=e.lastIntValue;if(this.regexp_eatOctalDigit(e)){var r=e.lastIntValue;t<=3&&this.regexp_eatOctalDigit(e)?e.lastIntValue=t*64+r*8+e.lastIntValue:e.lastIntValue=t*8+r}else e.lastIntValue=t;return!0}return!1};er.regexp_eatOctalDigit=function(e){var t=e.current();return Ote(t)?(e.lastIntValue=t-48,e.advance(),!0):(e.lastIntValue=0,!1)};function Ote(e){return e>=48&&e<=55}er.regexp_eatFixedHexDigits=function(e,t){var r=e.pos;e.lastIntValue=0;for(var n=0;n=this.input.length)return this.finishToken(ge.eof);if(e.override)return e.override(this);this.readToken(this.fullCharCodeAtPos())};Nn.readToken=function(e){return EA(e,this.options.ecmaVersion>=6)||e===92?this.readWord():this.getTokenFromCode(e)};Nn.fullCharCodeAtPos=function(){var e=this.input.charCodeAt(this.pos);if(e<=55295||e>=56320)return e;var t=this.input.charCodeAt(this.pos+1);return t<=56319||t>=57344?e:(e<<10)+t-56613888};Nn.skipBlockComment=function(){var e=this.options.onComment&&this.curPosition(),t=this.pos,r=this.input.indexOf("*/",this.pos+=2);if(r===-1&&this.raise(this.pos-2,"Unterminated comment"),this.pos=r+2,this.options.locations)for(var n=void 0,i=t;(n=Xee(this.input,i,this.pos))>-1;)++this.curLine,i=this.lineStart=n;this.options.onComment&&this.options.onComment(!0,this.input.slice(t+2,r),t,this.pos,e,this.curPosition())};Nn.skipLineComment=function(e){for(var t=this.pos,r=this.options.onComment&&this.curPosition(),n=this.input.charCodeAt(this.pos+=e);this.pos8&&e<14||e>=5760&&Kee.test(String.fromCharCode(e)))++this.pos;else break e}}};Nn.finishToken=function(e,t){this.end=this.pos,this.options.locations&&(this.endLoc=this.curPosition());var r=this.type;this.type=e,this.value=t,this.updateContext(r)};Nn.readToken_dot=function(){var e=this.input.charCodeAt(this.pos+1);if(e>=48&&e<=57)return this.readNumber(!0);var t=this.input.charCodeAt(this.pos+2);return this.options.ecmaVersion>=6&&e===46&&t===46?(this.pos+=3,this.finishToken(ge.ellipsis)):(++this.pos,this.finishToken(ge.dot))};Nn.readToken_slash=function(){var e=this.input.charCodeAt(this.pos+1);return this.exprAllowed?(++this.pos,this.readRegexp()):e===61?this.finishOp(ge.assign,2):this.finishOp(ge.slash,1)};Nn.readToken_mult_modulo_exp=function(e){var t=this.input.charCodeAt(this.pos+1),r=1,n=e===42?ge.star:ge.modulo;return this.options.ecmaVersion>=7&&e===42&&t===42&&(++r,n=ge.starstar,t=this.input.charCodeAt(this.pos+2)),t===61?this.finishOp(ge.assign,r+1):this.finishOp(n,r)};Nn.readToken_pipe_amp=function(e){var t=this.input.charCodeAt(this.pos+1);if(t===e){if(this.options.ecmaVersion>=12){var r=this.input.charCodeAt(this.pos+2);if(r===61)return this.finishOp(ge.assign,3)}return this.finishOp(e===124?ge.logicalOR:ge.logicalAND,2)}return t===61?this.finishOp(ge.assign,2):this.finishOp(e===124?ge.bitwiseOR:ge.bitwiseAND,1)};Nn.readToken_caret=function(){var e=this.input.charCodeAt(this.pos+1);return e===61?this.finishOp(ge.assign,2):this.finishOp(ge.bitwiseXOR,1)};Nn.readToken_plus_min=function(e){var t=this.input.charCodeAt(this.pos+1);return t===e?t===45&&!this.inModule&&this.input.charCodeAt(this.pos+2)===62&&(this.lastTokEnd===0||md.test(this.input.slice(this.lastTokEnd,this.pos)))?(this.skipLineComment(3),this.skipSpace(),this.nextToken()):this.finishOp(ge.incDec,2):t===61?this.finishOp(ge.assign,2):this.finishOp(ge.plusMin,1)};Nn.readToken_lt_gt=function(e){var t=this.input.charCodeAt(this.pos+1),r=1;return t===e?(r=e===62&&this.input.charCodeAt(this.pos+2)===62?3:2,this.input.charCodeAt(this.pos+r)===61?this.finishOp(ge.assign,r+1):this.finishOp(ge.bitShift,r)):t===33&&e===60&&!this.inModule&&this.input.charCodeAt(this.pos+2)===45&&this.input.charCodeAt(this.pos+3)===45?(this.skipLineComment(4),this.skipSpace(),this.nextToken()):(t===61&&(r=2),this.finishOp(ge.relational,r))};Nn.readToken_eq_excl=function(e){var t=this.input.charCodeAt(this.pos+1);return t===61?this.finishOp(ge.equality,this.input.charCodeAt(this.pos+2)===61?3:2):e===61&&t===62&&this.options.ecmaVersion>=6?(this.pos+=2,this.finishToken(ge.arrow)):this.finishOp(e===61?ge.eq:ge.prefix,1)};Nn.readToken_question=function(){var e=this.options.ecmaVersion;if(e>=11){var t=this.input.charCodeAt(this.pos+1);if(t===46){var r=this.input.charCodeAt(this.pos+2);if(r<48||r>57)return this.finishOp(ge.questionDot,2)}if(t===63){if(e>=12){var n=this.input.charCodeAt(this.pos+2);if(n===61)return this.finishOp(ge.assign,3)}return this.finishOp(ge.coalesce,2)}}return this.finishOp(ge.question,1)};Nn.readToken_numberSign=function(){var e=this.options.ecmaVersion,t=35;if(e>=13&&(++this.pos,t=this.fullCharCodeAtPos(),EA(t,!0)||t===92))return this.finishToken(ge.privateId,this.readWord1());this.raise(this.pos,"Unexpected character '"+l0(t)+"'")};Nn.getTokenFromCode=function(e){switch(e){case 46:return this.readToken_dot();case 40:return++this.pos,this.finishToken(ge.parenL);case 41:return++this.pos,this.finishToken(ge.parenR);case 59:return++this.pos,this.finishToken(ge.semi);case 44:return++this.pos,this.finishToken(ge.comma);case 91:return++this.pos,this.finishToken(ge.bracketL);case 93:return++this.pos,this.finishToken(ge.bracketR);case 123:return++this.pos,this.finishToken(ge.braceL);case 125:return++this.pos,this.finishToken(ge.braceR);case 58:return++this.pos,this.finishToken(ge.colon);case 96:if(this.options.ecmaVersion<6)break;return++this.pos,this.finishToken(ge.backQuote);case 48:var t=this.input.charCodeAt(this.pos+1);if(t===120||t===88)return this.readRadixNumber(16);if(this.options.ecmaVersion>=6){if(t===111||t===79)return this.readRadixNumber(8);if(t===98||t===66)return this.readRadixNumber(2)}case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:return this.readNumber(!1);case 34:case 39:return this.readString(e);case 47:return this.readToken_slash();case 37:case 42:return this.readToken_mult_modulo_exp(e);case 124:case 38:return this.readToken_pipe_amp(e);case 94:return this.readToken_caret();case 43:case 45:return this.readToken_plus_min(e);case 60:case 62:return this.readToken_lt_gt(e);case 61:case 33:return this.readToken_eq_excl(e);case 63:return this.readToken_question();case 126:return this.finishOp(ge.prefix,1);case 35:return this.readToken_numberSign()}this.raise(this.pos,"Unexpected character '"+l0(e)+"'")};Nn.finishOp=function(e,t){var r=this.input.slice(this.pos,this.pos+t);return this.pos+=t,this.finishToken(e,r)};Nn.readRegexp=function(){for(var e,t,r=this.pos;;){this.pos>=this.input.length&&this.raise(r,"Unterminated regular expression");var n=this.input.charAt(this.pos);if(md.test(n)&&this.raise(r,"Unterminated regular expression"),e)e=!1;else{if(n==="[")t=!0;else if(n==="]"&&t)t=!1;else if(n==="/"&&!t)break;e=n==="\\"}++this.pos}var i=this.input.slice(r,this.pos);++this.pos;var a=this.pos,o=this.readWord1();this.containsEsc&&this.unexpected(a);var s=this.regexpState||(this.regexpState=new _m(this));s.reset(r,i,o),this.validateRegExpFlags(s),this.validateRegExpPattern(s);var l=null;try{l=new RegExp(i,o)}catch{}return this.finishToken(ge.regexp,{pattern:i,flags:o,value:l})};Nn.readInt=function(e,t,r){for(var n=this.options.ecmaVersion>=12&&t===void 0,i=r&&this.input.charCodeAt(this.pos)===48,a=this.pos,o=0,s=0,l=0,u=t??1/0;l=97?f=c-97+10:c>=65?f=c-65+10:c>=48&&c<=57?f=c-48:f=1/0,f>=e)break;s=c,o=o*e+f}return n&&s===95&&this.raiseRecoverable(this.pos-1,"Numeric separator is not allowed at the last of digits"),this.pos===a||t!=null&&this.pos-a!==t?null:o};function nIe(e,t){return t?parseInt(e,8):parseFloat(e.replace(/_/g,""))}function Mte(e){return typeof BigInt!="function"?null:BigInt(e.replace(/_/g,""))}Nn.readRadixNumber=function(e){var t=this.pos;this.pos+=2;var r=this.readInt(e);return r==null&&this.raise(this.start+2,"Expected number in radix "+e),this.options.ecmaVersion>=11&&this.input.charCodeAt(this.pos)===110?(r=Mte(this.input.slice(t,this.pos)),++this.pos):EA(this.fullCharCodeAtPos())&&this.raise(this.pos,"Identifier directly after number"),this.finishToken(ge.num,r)};Nn.readNumber=function(e){var t=this.pos;!e&&this.readInt(10,void 0,!0)===null&&this.raise(t,"Invalid number");var r=this.pos-t>=2&&this.input.charCodeAt(t)===48;r&&this.strict&&this.raise(t,"Invalid number");var n=this.input.charCodeAt(this.pos);if(!r&&!e&&this.options.ecmaVersion>=11&&n===110){var i=Mte(this.input.slice(t,this.pos));return++this.pos,EA(this.fullCharCodeAtPos())&&this.raise(this.pos,"Identifier directly after number"),this.finishToken(ge.num,i)}r&&/[89]/.test(this.input.slice(t,this.pos))&&(r=!1),n===46&&!r&&(++this.pos,this.readInt(10),n=this.input.charCodeAt(this.pos)),(n===69||n===101)&&!r&&(n=this.input.charCodeAt(++this.pos),(n===43||n===45)&&++this.pos,this.readInt(10)===null&&this.raise(t,"Invalid number")),EA(this.fullCharCodeAtPos())&&this.raise(this.pos,"Identifier directly after number");var a=nIe(this.input.slice(t,this.pos),r);return this.finishToken(ge.num,a)};Nn.readCodePoint=function(){var e=this.input.charCodeAt(this.pos),t;if(e===123){this.options.ecmaVersion<6&&this.unexpected();var r=++this.pos;t=this.readHexChar(this.input.indexOf("}",this.pos)-this.pos),++this.pos,t>1114111&&this.invalidStringToken(r,"Code point out of bounds")}else t=this.readHexChar(4);return t};Nn.readString=function(e){for(var t="",r=++this.pos;;){this.pos>=this.input.length&&this.raise(this.start,"Unterminated string constant");var n=this.input.charCodeAt(this.pos);if(n===e)break;n===92?(t+=this.input.slice(r,this.pos),t+=this.readEscapedChar(!1),r=this.pos):n===8232||n===8233?(this.options.ecmaVersion<10&&this.raise(this.start,"Unterminated string constant"),++this.pos,this.options.locations&&(this.curLine++,this.lineStart=this.pos)):(ew(n)&&this.raise(this.start,"Unterminated string constant"),++this.pos)}return t+=this.input.slice(r,this.pos++),this.finishToken(ge.string,t)};var jte={};Nn.tryReadTemplateToken=function(){this.inTemplateElement=!0;try{this.readTmplToken()}catch(e){if(e===jte)this.readInvalidTemplateToken();else throw e}this.inTemplateElement=!1};Nn.invalidStringToken=function(e,t){if(this.inTemplateElement&&this.options.ecmaVersion>=9)throw jte;this.raise(e,t)};Nn.readTmplToken=function(){for(var e="",t=this.pos;;){this.pos>=this.input.length&&this.raise(this.start,"Unterminated template");var r=this.input.charCodeAt(this.pos);if(r===96||r===36&&this.input.charCodeAt(this.pos+1)===123)return this.pos===this.start&&(this.type===ge.template||this.type===ge.invalidTemplate)?r===36?(this.pos+=2,this.finishToken(ge.dollarBraceL)):(++this.pos,this.finishToken(ge.backQuote)):(e+=this.input.slice(t,this.pos),this.finishToken(ge.template,e));if(r===92)e+=this.input.slice(t,this.pos),e+=this.readEscapedChar(!0),t=this.pos;else if(ew(r)){switch(e+=this.input.slice(t,this.pos),++this.pos,r){case 13:this.input.charCodeAt(this.pos)===10&&++this.pos;case 10:e+=` +`,n-1)+1,this.curLine=this.input.slice(0,this.lineStart).split(md).length):(this.pos=this.lineStart=0,this.curLine=1),this.type=ge.eof,this.value=null,this.start=this.end=this.pos,this.startLoc=this.endLoc=this.curPosition(),this.lastTokEndLoc=this.lastTokStartLoc=null,this.lastTokStart=this.lastTokEnd=this.pos,this.context=this.initialContext(),this.exprAllowed=!0,this.inModule=t.sourceType==="module",this.strict=this.inModule||this.strictDirective(this.pos),this.potentialArrowAt=-1,this.potentialArrowInForAwait=!1,this.yieldPos=this.awaitPos=this.awaitIdentPos=0,this.labels=[],this.undefinedExports=Object.create(null),this.pos===0&&t.allowHashBang&&this.input.slice(0,2)==="#!"&&this.skipLineComment(2),this.scopeStack=[],this.enterScope(Sk),this.regexpState=null,this.privateNameStack=[]},_m={inFunction:{configurable:!0},inGenerator:{configurable:!0},inAsync:{configurable:!0},canAwait:{configurable:!0},allowSuper:{configurable:!0},allowDirectSuper:{configurable:!0},treatFunctionsAsVar:{configurable:!0},allowNewDotTarget:{configurable:!0},inClassStaticBlock:{configurable:!0}};ss.prototype.parse=function(){var t=this.options.program||this.startNode();return this.nextToken(),this.parseTopLevel(t)};_m.inFunction.get=function(){return(this.currentVarScope().flags&tw)>0};_m.inGenerator.get=function(){return(this.currentVarScope().flags&tte)>0&&!this.currentVarScope().inClassFieldInit};_m.inAsync.get=function(){return(this.currentVarScope().flags&Hq)>0&&!this.currentVarScope().inClassFieldInit};_m.canAwait.get=function(){for(var e=this.scopeStack.length-1;e>=0;e--){var t=this.scopeStack[e];if(t.inClassFieldInit||t.flags&kk)return!1;if(t.flags&tw)return(t.flags&Hq)>0}return this.inModule&&this.options.ecmaVersion>=13||this.options.allowAwaitOutsideFunction};_m.allowSuper.get=function(){var e=this.currentThisScope(),t=e.flags,r=e.inClassFieldInit;return(t&Vq)>0||r||this.options.allowSuperOutsideMethod};_m.allowDirectSuper.get=function(){return(this.currentThisScope().flags&ite)>0};_m.treatFunctionsAsVar.get=function(){return this.treatFunctionsAsVarInScope(this.currentScope())};_m.allowNewDotTarget.get=function(){var e=this.currentThisScope(),t=e.flags,r=e.inClassFieldInit;return(t&(tw|kk))>0||r};_m.inClassStaticBlock.get=function(){return(this.currentVarScope().flags&kk)>0};ss.extend=function(){for(var t=[],r=arguments.length;r--;)t[r]=arguments[r];for(var n=this,i=0;i=,?^&]/.test(i)||i==="!"&&this.input.charAt(n+1)==="=")}e+=t[0].length,dd.lastIndex=e,e+=dd.exec(this.input)[0].length,this.input[e]===";"&&e++}};_u.eat=function(e){return this.type===e?(this.next(),!0):!1};_u.isContextual=function(e){return this.type===ge.name&&this.value===e&&!this.containsEsc};_u.eatContextual=function(e){return this.isContextual(e)?(this.next(),!0):!1};_u.expectContextual=function(e){this.eatContextual(e)||this.unexpected()};_u.canInsertSemicolon=function(){return this.type===ge.eof||this.type===ge.braceR||md.test(this.input.slice(this.lastTokEnd,this.start))};_u.insertSemicolon=function(){if(this.canInsertSemicolon())return this.options.onInsertedSemicolon&&this.options.onInsertedSemicolon(this.lastTokEnd,this.lastTokEndLoc),!0};_u.semicolon=function(){!this.eat(ge.semi)&&!this.insertSemicolon()&&this.unexpected()};_u.afterTrailingComma=function(e,t){if(this.type===e)return this.options.onTrailingComma&&this.options.onTrailingComma(this.lastTokStart,this.lastTokStartLoc),t||this.next(),!0};_u.expect=function(e){this.eat(e)||this.unexpected()};_u.unexpected=function(e){this.raise(e??this.start,"Unexpected token")};var QM=function(){this.shorthandAssign=this.trailingComma=this.parenthesizedAssign=this.parenthesizedBind=this.doubleProto=-1};_u.checkPatternErrors=function(e,t){if(!!e){e.trailingComma>-1&&this.raiseRecoverable(e.trailingComma,"Comma is not permitted after the rest element");var r=t?e.parenthesizedAssign:e.parenthesizedBind;r>-1&&this.raiseRecoverable(r,t?"Assigning to rvalue":"Parenthesized pattern")}};_u.checkExpressionErrors=function(e,t){if(!e)return!1;var r=e.shorthandAssign,n=e.doubleProto;if(!t)return r>=0||n>=0;r>=0&&this.raise(r,"Shorthand property assignments are valid only in destructuring patterns"),n>=0&&this.raiseRecoverable(n,"Redefinition of __proto__ property")};_u.checkYieldAwaitInDefaultParams=function(){this.yieldPos&&(!this.awaitPos||this.yieldPos55295&&n<56320)return!0;if(EA(n,!0)){for(var i=r+1;Jx(n=this.input.charCodeAt(i),!0);)++i;if(n===92||n>55295&&n<56320)return!0;var a=this.input.slice(r,i);if(!DPe.test(a))return!0}return!1};lr.isAsyncFunction=function(){if(this.options.ecmaVersion<8||!this.isContextual("async"))return!1;dd.lastIndex=this.pos;var e=dd.exec(this.input),t=this.pos+e[0].length,r;return!md.test(this.input.slice(this.pos,t))&&this.input.slice(t,t+8)==="function"&&(t+8===this.input.length||!(Jx(r=this.input.charCodeAt(t+8))||r>55295&&r<56320))};lr.parseStatement=function(e,t,r){var n=this.type,i=this.startNode(),a;switch(this.isLet(e)&&(n=ge._var,a="let"),n){case ge._break:case ge._continue:return this.parseBreakContinueStatement(i,n.keyword);case ge._debugger:return this.parseDebuggerStatement(i);case ge._do:return this.parseDoStatement(i);case ge._for:return this.parseForStatement(i);case ge._function:return e&&(this.strict||e!=="if"&&e!=="label")&&this.options.ecmaVersion>=6&&this.unexpected(),this.parseFunctionStatement(i,!1,!e);case ge._class:return e&&this.unexpected(),this.parseClass(i,!0);case ge._if:return this.parseIfStatement(i);case ge._return:return this.parseReturnStatement(i);case ge._switch:return this.parseSwitchStatement(i);case ge._throw:return this.parseThrowStatement(i);case ge._try:return this.parseTryStatement(i);case ge._const:case ge._var:return a=a||this.value,e&&a!=="var"&&this.unexpected(),this.parseVarStatement(i,a);case ge._while:return this.parseWhileStatement(i);case ge._with:return this.parseWithStatement(i);case ge.braceL:return this.parseBlock(!0,i);case ge.semi:return this.parseEmptyStatement(i);case ge._export:case ge._import:if(this.options.ecmaVersion>10&&n===ge._import){dd.lastIndex=this.pos;var o=dd.exec(this.input),s=this.pos+o[0].length,l=this.input.charCodeAt(s);if(l===40||l===46)return this.parseExpressionStatement(i,this.parseExpression())}return this.options.allowImportExportEverywhere||(t||this.raise(this.start,"'import' and 'export' may only appear at the top level"),this.inModule||this.raise(this.start,"'import' and 'export' may appear only with 'sourceType: module'")),n===ge._import?this.parseImport(i):this.parseExport(i,r);default:if(this.isAsyncFunction())return e&&this.unexpected(),this.next(),this.parseFunctionStatement(i,!0,!e);var u=this.value,c=this.parseExpression();return n===ge.name&&c.type==="Identifier"&&this.eat(ge.colon)?this.parseLabeledStatement(i,u,c,e):this.parseExpressionStatement(i,c)}};lr.parseBreakContinueStatement=function(e,t){var r=t==="break";this.next(),this.eat(ge.semi)||this.insertSemicolon()?e.label=null:this.type!==ge.name?this.unexpected():(e.label=this.parseIdent(),this.semicolon());for(var n=0;n=6?this.eat(ge.semi):this.semicolon(),this.finishNode(e,"DoWhileStatement")};lr.parseForStatement=function(e){this.next();var t=this.options.ecmaVersion>=9&&this.canAwait&&this.eatContextual("await")?this.lastTokStart:-1;if(this.labels.push(Zq),this.enterScope(0),this.expect(ge.parenL),this.type===ge.semi)return t>-1&&this.unexpected(t),this.parseFor(e,null);var r=this.isLet();if(this.type===ge._var||this.type===ge._const||r){var n=this.startNode(),i=r?"let":this.value;return this.next(),this.parseVar(n,!0,i),this.finishNode(n,"VariableDeclaration"),(this.type===ge._in||this.options.ecmaVersion>=6&&this.isContextual("of"))&&n.declarations.length===1?(this.options.ecmaVersion>=9&&(this.type===ge._in?t>-1&&this.unexpected(t):e.await=t>-1),this.parseForIn(e,n)):(t>-1&&this.unexpected(t),this.parseFor(e,n))}var a=this.isContextual("let"),o=!1,s=new QM,l=this.parseExpression(t>-1?"await":!0,s);return this.type===ge._in||(o=this.options.ecmaVersion>=6&&this.isContextual("of"))?(this.options.ecmaVersion>=9&&(this.type===ge._in?t>-1&&this.unexpected(t):e.await=t>-1),a&&o&&this.raise(l.start,"The left-hand side of a for-of loop may not start with 'let'."),this.toAssignable(l,!1,s),this.checkLValPattern(l),this.parseForIn(e,l)):(this.checkExpressionErrors(s,!0),t>-1&&this.unexpected(t),this.parseFor(e,l))};lr.parseFunctionStatement=function(e,t,r){return this.next(),this.parseFunction(e,xk|(r?0:Uq),!1,t)};lr.parseIfStatement=function(e){return this.next(),e.test=this.parseParenExpression(),e.consequent=this.parseStatement("if"),e.alternate=this.eat(ge._else)?this.parseStatement("if"):null,this.finishNode(e,"IfStatement")};lr.parseReturnStatement=function(e){return!this.inFunction&&!this.options.allowReturnOutsideFunction&&this.raise(this.start,"'return' outside of function"),this.next(),this.eat(ge.semi)||this.insertSemicolon()?e.argument=null:(e.argument=this.parseExpression(),this.semicolon()),this.finishNode(e,"ReturnStatement")};lr.parseSwitchStatement=function(e){this.next(),e.discriminant=this.parseParenExpression(),e.cases=[],this.expect(ge.braceL),this.labels.push(BPe),this.enterScope(0);for(var t,r=!1;this.type!==ge.braceR;)if(this.type===ge._case||this.type===ge._default){var n=this.type===ge._case;t&&this.finishNode(t,"SwitchCase"),e.cases.push(t=this.startNode()),t.consequent=[],this.next(),n?t.test=this.parseExpression():(r&&this.raiseRecoverable(this.lastTokStart,"Multiple default clauses"),r=!0,t.test=null),this.expect(ge.colon)}else t||this.unexpected(),t.consequent.push(this.parseStatement(null));return this.exitScope(),t&&this.finishNode(t,"SwitchCase"),this.next(),this.labels.pop(),this.finishNode(e,"SwitchStatement")};lr.parseThrowStatement=function(e){return this.next(),md.test(this.input.slice(this.lastTokEnd,this.start))&&this.raise(this.lastTokEnd,"Illegal newline after throw"),e.argument=this.parseExpression(),this.semicolon(),this.finishNode(e,"ThrowStatement")};var RPe=[];lr.parseCatchClauseParam=function(){var e=this.parseBindingAtom(),t=e.type==="Identifier";return this.enterScope(t?nte:0),this.checkLValPattern(e,t?ote:CA),this.expect(ge.parenR),e};lr.parseTryStatement=function(e){if(this.next(),e.block=this.parseBlock(),e.handler=null,this.type===ge._catch){var t=this.startNode();this.next(),this.eat(ge.parenL)?t.param=this.parseCatchClauseParam():(this.options.ecmaVersion<10&&this.unexpected(),t.param=null,this.enterScope(0)),t.body=this.parseBlock(!1),this.exitScope(),e.handler=this.finishNode(t,"CatchClause")}return e.finalizer=this.eat(ge._finally)?this.parseBlock():null,!e.handler&&!e.finalizer&&this.raise(e.start,"Missing catch or finally clause"),this.finishNode(e,"TryStatement")};lr.parseVarStatement=function(e,t,r){return this.next(),this.parseVar(e,!1,t,r),this.semicolon(),this.finishNode(e,"VariableDeclaration")};lr.parseWhileStatement=function(e){return this.next(),e.test=this.parseParenExpression(),this.labels.push(Zq),e.body=this.parseStatement("while"),this.labels.pop(),this.finishNode(e,"WhileStatement")};lr.parseWithStatement=function(e){return this.strict&&this.raise(this.start,"'with' in strict mode"),this.next(),e.object=this.parseParenExpression(),e.body=this.parseStatement("with"),this.finishNode(e,"WithStatement")};lr.parseEmptyStatement=function(e){return this.next(),this.finishNode(e,"EmptyStatement")};lr.parseLabeledStatement=function(e,t,r,n){for(var i=0,a=this.labels;i=0;l--){var u=this.labels[l];if(u.statementStart===e.start)u.statementStart=this.start,u.kind=s;else break}return this.labels.push({name:t,kind:s,statementStart:this.start}),e.body=this.parseStatement(n?n.indexOf("label")===-1?n+"label":n:"label"),this.labels.pop(),e.label=r,this.finishNode(e,"LabeledStatement")};lr.parseExpressionStatement=function(e,t){return e.expression=t,this.semicolon(),this.finishNode(e,"ExpressionStatement")};lr.parseBlock=function(e,t,r){for(e===void 0&&(e=!0),t===void 0&&(t=this.startNode()),t.body=[],this.expect(ge.braceL),e&&this.enterScope(0);this.type!==ge.braceR;){var n=this.parseStatement(null);t.body.push(n)}return r&&(this.strict=!1),this.next(),e&&this.exitScope(),this.finishNode(t,"BlockStatement")};lr.parseFor=function(e,t){return e.init=t,this.expect(ge.semi),e.test=this.type===ge.semi?null:this.parseExpression(),this.expect(ge.semi),e.update=this.type===ge.parenR?null:this.parseExpression(),this.expect(ge.parenR),e.body=this.parseStatement("for"),this.exitScope(),this.labels.pop(),this.finishNode(e,"ForStatement")};lr.parseForIn=function(e,t){var r=this.type===ge._in;return this.next(),t.type==="VariableDeclaration"&&t.declarations[0].init!=null&&(!r||this.options.ecmaVersion<8||this.strict||t.kind!=="var"||t.declarations[0].id.type!=="Identifier")&&this.raise(t.start,(r?"for-in":"for-of")+" loop variable declaration may not have an initializer"),e.left=t,e.right=r?this.parseExpression():this.parseMaybeAssign(),this.expect(ge.parenR),e.body=this.parseStatement("for"),this.exitScope(),this.labels.pop(),this.finishNode(e,r?"ForInStatement":"ForOfStatement")};lr.parseVar=function(e,t,r,n){for(e.declarations=[],e.kind=r;;){var i=this.startNode();if(this.parseVarId(i,r),this.eat(ge.eq)?i.init=this.parseMaybeAssign(t):!n&&r==="const"&&!(this.type===ge._in||this.options.ecmaVersion>=6&&this.isContextual("of"))?this.unexpected():!n&&i.id.type!=="Identifier"&&!(t&&(this.type===ge._in||this.isContextual("of")))?this.raise(this.lastTokEnd,"Complex binding patterns require an initialization value"):i.init=null,e.declarations.push(this.finishNode(i,"VariableDeclarator")),!this.eat(ge.comma))break}return e};lr.parseVarId=function(e,t){e.id=this.parseBindingAtom(),this.checkLValPattern(e.id,t==="var"?Yq:CA,!1)};var xk=1,Uq=2,lte=4;lr.parseFunction=function(e,t,r,n,i){this.initFunction(e),(this.options.ecmaVersion>=9||this.options.ecmaVersion>=6&&!n)&&(this.type===ge.star&&t&Uq&&this.unexpected(),e.generator=this.eat(ge.star)),this.options.ecmaVersion>=8&&(e.async=!!n),t&xk&&(e.id=t<e&&this.type!==ge.name?null:this.parseIdent(),e.id&&!(t&Uq)&&this.checkLValSimple(e.id,this.strict||e.generator||e.async?this.treatFunctionsAsVar?Yq:CA:ate));var a=this.yieldPos,o=this.awaitPos,s=this.awaitIdentPos;return this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0,this.enterScope(Qq(e.async,e.generator)),t&xk||(e.id=this.type===ge.name?this.parseIdent():null),this.parseFunctionParams(e),this.parseFunctionBody(e,r,!1,i),this.yieldPos=a,this.awaitPos=o,this.awaitIdentPos=s,this.finishNode(e,t&xk?"FunctionDeclaration":"FunctionExpression")};lr.parseFunctionParams=function(e){this.expect(ge.parenL),e.params=this.parseBindingList(ge.parenR,!1,this.options.ecmaVersion>=8),this.checkYieldAwaitInDefaultParams()};lr.parseClass=function(e,t){this.next();var r=this.strict;this.strict=!0,this.parseClassId(e,t),this.parseClassSuper(e);var n=this.enterClassBody(),i=this.startNode(),a=!1;for(i.body=[],this.expect(ge.braceL);this.type!==ge.braceR;){var o=this.parseClassElement(e.superClass!==null);o&&(i.body.push(o),o.type==="MethodDefinition"&&o.kind==="constructor"?(a&&this.raiseRecoverable(o.start,"Duplicate constructor in the same class"),a=!0):o.key&&o.key.type==="PrivateIdentifier"&&$Pe(n,o)&&this.raiseRecoverable(o.key.start,"Identifier '#"+o.key.name+"' has already been declared"))}return this.strict=r,this.next(),e.body=this.finishNode(i,"ClassBody"),this.exitClassBody(),this.finishNode(e,t?"ClassDeclaration":"ClassExpression")};lr.parseClassElement=function(e){if(this.eat(ge.semi))return null;var t=this.options.ecmaVersion,r=this.startNode(),n="",i=!1,a=!1,o="method",s=!1;if(this.eatContextual("static")){if(t>=13&&this.eat(ge.braceL))return this.parseClassStaticBlock(r),r;this.isClassElementNameStart()||this.type===ge.star?s=!0:n="static"}if(r.static=s,!n&&t>=8&&this.eatContextual("async")&&((this.isClassElementNameStart()||this.type===ge.star)&&!this.canInsertSemicolon()?a=!0:n="async"),!n&&(t>=9||!a)&&this.eat(ge.star)&&(i=!0),!n&&!a&&!i){var l=this.value;(this.eatContextual("get")||this.eatContextual("set"))&&(this.isClassElementNameStart()?o=l:n=l)}if(n?(r.computed=!1,r.key=this.startNodeAt(this.lastTokStart,this.lastTokStartLoc),r.key.name=n,this.finishNode(r.key,"Identifier")):this.parseClassElementName(r),t<13||this.type===ge.parenL||o!=="method"||i||a){var u=!r.static&&HM(r,"constructor"),c=u&&e;u&&o!=="method"&&this.raise(r.key.start,"Constructor can't have get/set modifier"),r.kind=u?"constructor":o,this.parseClassMethod(r,i,a,c)}else this.parseClassField(r);return r};lr.isClassElementNameStart=function(){return this.type===ge.name||this.type===ge.privateId||this.type===ge.num||this.type===ge.string||this.type===ge.bracketL||this.type.keyword};lr.parseClassElementName=function(e){this.type===ge.privateId?(this.value==="constructor"&&this.raise(this.start,"Classes can't have an element named '#constructor'"),e.computed=!1,e.key=this.parsePrivateIdent()):this.parsePropertyName(e)};lr.parseClassMethod=function(e,t,r,n){var i=e.key;e.kind==="constructor"?(t&&this.raise(i.start,"Constructor can't be a generator"),r&&this.raise(i.start,"Constructor can't be an async method")):e.static&&HM(e,"prototype")&&this.raise(i.start,"Classes may not have a static property named prototype");var a=e.value=this.parseMethod(t,r,n);return e.kind==="get"&&a.params.length!==0&&this.raiseRecoverable(a.start,"getter should have no params"),e.kind==="set"&&a.params.length!==1&&this.raiseRecoverable(a.start,"setter should have exactly one param"),e.kind==="set"&&a.params[0].type==="RestElement"&&this.raiseRecoverable(a.params[0].start,"Setter cannot use rest params"),this.finishNode(e,"MethodDefinition")};lr.parseClassField=function(e){if(HM(e,"constructor")?this.raise(e.key.start,"Classes can't have a field named 'constructor'"):e.static&&HM(e,"prototype")&&this.raise(e.key.start,"Classes can't have a static field named 'prototype'"),this.eat(ge.eq)){var t=this.currentThisScope(),r=t.inClassFieldInit;t.inClassFieldInit=!0,e.value=this.parseMaybeAssign(),t.inClassFieldInit=r}else e.value=null;return this.semicolon(),this.finishNode(e,"PropertyDefinition")};lr.parseClassStaticBlock=function(e){e.body=[];var t=this.labels;for(this.labels=[],this.enterScope(kk|Vq);this.type!==ge.braceR;){var r=this.parseStatement(null);e.body.push(r)}return this.next(),this.exitScope(),this.labels=t,this.finishNode(e,"StaticBlock")};lr.parseClassId=function(e,t){this.type===ge.name?(e.id=this.parseIdent(),t&&this.checkLValSimple(e.id,CA,!1)):(t===!0&&this.unexpected(),e.id=null)};lr.parseClassSuper=function(e){e.superClass=this.eat(ge._extends)?this.parseExprSubscripts(null,!1):null};lr.enterClassBody=function(){var e={declared:Object.create(null),used:[]};return this.privateNameStack.push(e),e.declared};lr.exitClassBody=function(){var e=this.privateNameStack.pop(),t=e.declared,r=e.used;if(!!this.options.checkPrivateFields)for(var n=this.privateNameStack.length,i=n===0?null:this.privateNameStack[n-1],a=0;a=11&&(this.eatContextual("as")?(e.exported=this.parseModuleExportName(),this.checkExport(t,e.exported,this.lastTokStart)):e.exported=null),this.expectContextual("from"),this.type!==ge.string&&this.unexpected(),e.source=this.parseExprAtom(),this.semicolon(),this.finishNode(e,"ExportAllDeclaration")};lr.parseExport=function(e,t){if(this.next(),this.eat(ge.star))return this.parseExportAllDeclaration(e,t);if(this.eat(ge._default))return this.checkExport(t,"default",this.lastTokStart),e.declaration=this.parseExportDefaultDeclaration(),this.finishNode(e,"ExportDefaultDeclaration");if(this.shouldParseExportStatement())e.declaration=this.parseExportDeclaration(e),e.declaration.type==="VariableDeclaration"?this.checkVariableExport(t,e.declaration.declarations):this.checkExport(t,e.declaration.id,e.declaration.id.start),e.specifiers=[],e.source=null;else{if(e.declaration=null,e.specifiers=this.parseExportSpecifiers(t),this.eatContextual("from"))this.type!==ge.string&&this.unexpected(),e.source=this.parseExprAtom();else{for(var r=0,n=e.specifiers;r=13&&this.type===ge.string){var e=this.parseLiteral(this.value);return FPe.test(e.value)&&this.raise(e.start,"An export name cannot include a lone surrogate."),e}return this.parseIdent(!0)};lr.adaptDirectivePrologue=function(e){for(var t=0;t=5&&e.type==="ExpressionStatement"&&e.expression.type==="Literal"&&typeof e.expression.value=="string"&&(this.input[e.start]==='"'||this.input[e.start]==="'")};var hd=ss.prototype;hd.toAssignable=function(e,t,r){if(this.options.ecmaVersion>=6&&e)switch(e.type){case"Identifier":this.inAsync&&e.name==="await"&&this.raise(e.start,"Cannot use 'await' as identifier inside an async function");break;case"ObjectPattern":case"ArrayPattern":case"AssignmentPattern":case"RestElement":break;case"ObjectExpression":e.type="ObjectPattern",r&&this.checkPatternErrors(r,!0);for(var n=0,i=e.properties;n=8&&!s&&l.name==="async"&&!this.canInsertSemicolon()&&this.eat(ge._function))return this.overrideContext(Ra.f_expr),this.parseFunction(this.startNodeAt(a,o),0,!1,!0,t);if(i&&!this.canInsertSemicolon()){if(this.eat(ge.arrow))return this.parseArrowExpression(this.startNodeAt(a,o),[l],!1,t);if(this.options.ecmaVersion>=8&&l.name==="async"&&this.type===ge.name&&!s&&(!this.potentialArrowInForAwait||this.value!=="of"||this.containsEsc))return l=this.parseIdent(!1),(this.canInsertSemicolon()||!this.eat(ge.arrow))&&this.unexpected(),this.parseArrowExpression(this.startNodeAt(a,o),[l],!0,t)}return l;case ge.regexp:var u=this.value;return n=this.parseLiteral(u.value),n.regex={pattern:u.pattern,flags:u.flags},n;case ge.num:case ge.string:return this.parseLiteral(this.value);case ge._null:case ge._true:case ge._false:return n=this.startNode(),n.value=this.type===ge._null?null:this.type===ge._true,n.raw=this.type.keyword,this.next(),this.finishNode(n,"Literal");case ge.parenL:var c=this.start,f=this.parseParenAndDistinguishExpression(i,t);return e&&(e.parenthesizedAssign<0&&!this.isSimpleAssignTarget(f)&&(e.parenthesizedAssign=c),e.parenthesizedBind<0&&(e.parenthesizedBind=c)),f;case ge.bracketL:return n=this.startNode(),this.next(),n.elements=this.parseExprList(ge.bracketR,!0,!0,e),this.finishNode(n,"ArrayExpression");case ge.braceL:return this.overrideContext(Ra.b_expr),this.parseObj(!1,e);case ge._function:return n=this.startNode(),this.next(),this.parseFunction(n,0);case ge._class:return this.parseClass(this.startNode(),!1);case ge._new:return this.parseNew();case ge.backQuote:return this.parseTemplate();case ge._import:return this.options.ecmaVersion>=11?this.parseExprImport(r):this.unexpected();default:return this.parseExprAtomDefault()}};Pr.parseExprAtomDefault=function(){this.unexpected()};Pr.parseExprImport=function(e){var t=this.startNode();if(this.containsEsc&&this.raiseRecoverable(this.start,"Escape sequence in keyword import"),this.next(),this.type===ge.parenL&&!e)return this.parseDynamicImport(t);if(this.type===ge.dot){var r=this.startNodeAt(t.start,t.loc&&t.loc.start);return r.name="import",t.meta=this.finishNode(r,"Identifier"),this.parseImportMeta(t)}else this.unexpected()};Pr.parseDynamicImport=function(e){if(this.next(),e.source=this.parseMaybeAssign(),!this.eat(ge.parenR)){var t=this.start;this.eat(ge.comma)&&this.eat(ge.parenR)?this.raiseRecoverable(t,"Trailing comma is not allowed in import()"):this.unexpected(t)}return this.finishNode(e,"ImportExpression")};Pr.parseImportMeta=function(e){this.next();var t=this.containsEsc;return e.property=this.parseIdent(!0),e.property.name!=="meta"&&this.raiseRecoverable(e.property.start,"The only valid meta property for import is 'import.meta'"),t&&this.raiseRecoverable(e.start,"'import.meta' must not contain escaped characters"),this.options.sourceType!=="module"&&!this.options.allowImportExportEverywhere&&this.raiseRecoverable(e.start,"Cannot use 'import.meta' outside a module"),this.finishNode(e,"MetaProperty")};Pr.parseLiteral=function(e){var t=this.startNode();return t.value=e,t.raw=this.input.slice(this.start,this.end),t.raw.charCodeAt(t.raw.length-1)===110&&(t.bigint=t.raw.slice(0,-1).replace(/_/g,"")),this.next(),this.finishNode(t,"Literal")};Pr.parseParenExpression=function(){this.expect(ge.parenL);var e=this.parseExpression();return this.expect(ge.parenR),e};Pr.shouldParseArrow=function(e){return!this.canInsertSemicolon()};Pr.parseParenAndDistinguishExpression=function(e,t){var r=this.start,n=this.startLoc,i,a=this.options.ecmaVersion>=8;if(this.options.ecmaVersion>=6){this.next();var o=this.start,s=this.startLoc,l=[],u=!0,c=!1,f=new QM,d=this.yieldPos,p=this.awaitPos,h;for(this.yieldPos=0,this.awaitPos=0;this.type!==ge.parenR;)if(u?u=!1:this.expect(ge.comma),a&&this.afterTrailingComma(ge.parenR,!0)){c=!0;break}else if(this.type===ge.ellipsis){h=this.start,l.push(this.parseParenItem(this.parseRestBinding())),this.type===ge.comma&&this.raiseRecoverable(this.start,"Comma is not permitted after the rest element");break}else l.push(this.parseMaybeAssign(!1,f,this.parseParenItem));var m=this.lastTokEnd,g=this.lastTokEndLoc;if(this.expect(ge.parenR),e&&this.shouldParseArrow(l)&&this.eat(ge.arrow))return this.checkPatternErrors(f,!1),this.checkYieldAwaitInDefaultParams(),this.yieldPos=d,this.awaitPos=p,this.parseParenArrowList(r,n,l,t);(!l.length||c)&&this.unexpected(this.lastTokStart),h&&this.unexpected(h),this.checkExpressionErrors(f,!0),this.yieldPos=d||this.yieldPos,this.awaitPos=p||this.awaitPos,l.length>1?(i=this.startNodeAt(o,s),i.expressions=l,this.finishNodeAt(i,"SequenceExpression",m,g)):i=l[0]}else i=this.parseParenExpression();if(this.options.preserveParens){var A=this.startNodeAt(r,n);return A.expression=i,this.finishNode(A,"ParenthesizedExpression")}else return i};Pr.parseParenItem=function(e){return e};Pr.parseParenArrowList=function(e,t,r,n){return this.parseArrowExpression(this.startNodeAt(e,t),r,!1,n)};var qPe=[];Pr.parseNew=function(){this.containsEsc&&this.raiseRecoverable(this.start,"Escape sequence in keyword new");var e=this.startNode();if(this.next(),this.options.ecmaVersion>=6&&this.type===ge.dot){var t=this.startNodeAt(e.start,e.loc&&e.loc.start);t.name="new",e.meta=this.finishNode(t,"Identifier"),this.next();var r=this.containsEsc;return e.property=this.parseIdent(!0),e.property.name!=="target"&&this.raiseRecoverable(e.property.start,"The only valid meta property for new is 'new.target'"),r&&this.raiseRecoverable(e.start,"'new.target' must not contain escaped characters"),this.allowNewDotTarget||this.raiseRecoverable(e.start,"'new.target' can only be used in functions and class static block"),this.finishNode(e,"MetaProperty")}var n=this.start,i=this.startLoc;return e.callee=this.parseSubscripts(this.parseExprAtom(null,!1,!0),n,i,!0,!1),this.eat(ge.parenL)?e.arguments=this.parseExprList(ge.parenR,this.options.ecmaVersion>=8,!1):e.arguments=qPe,this.finishNode(e,"NewExpression")};Pr.parseTemplateElement=function(e){var t=e.isTagged,r=this.startNode();return this.type===ge.invalidTemplate?(t||this.raiseRecoverable(this.start,"Bad escape sequence in untagged template literal"),r.value={raw:this.value,cooked:null}):r.value={raw:this.input.slice(this.start,this.end).replace(/\r\n?/g,` +`),cooked:this.value},this.next(),r.tail=this.type===ge.backQuote,this.finishNode(r,"TemplateElement")};Pr.parseTemplate=function(e){e===void 0&&(e={});var t=e.isTagged;t===void 0&&(t=!1);var r=this.startNode();this.next(),r.expressions=[];var n=this.parseTemplateElement({isTagged:t});for(r.quasis=[n];!n.tail;)this.type===ge.eof&&this.raise(this.pos,"Unterminated template literal"),this.expect(ge.dollarBraceL),r.expressions.push(this.parseExpression()),this.expect(ge.braceR),r.quasis.push(n=this.parseTemplateElement({isTagged:t}));return this.next(),this.finishNode(r,"TemplateLiteral")};Pr.isAsyncProp=function(e){return!e.computed&&e.key.type==="Identifier"&&e.key.name==="async"&&(this.type===ge.name||this.type===ge.num||this.type===ge.string||this.type===ge.bracketL||this.type.keyword||this.options.ecmaVersion>=9&&this.type===ge.star)&&!md.test(this.input.slice(this.lastTokEnd,this.start))};Pr.parseObj=function(e,t){var r=this.startNode(),n=!0,i={};for(r.properties=[],this.next();!this.eat(ge.braceR);){if(n)n=!1;else if(this.expect(ge.comma),this.options.ecmaVersion>=5&&this.afterTrailingComma(ge.braceR))break;var a=this.parseProperty(e,t);e||this.checkPropClash(a,i,t),r.properties.push(a)}return this.finishNode(r,e?"ObjectPattern":"ObjectExpression")};Pr.parseProperty=function(e,t){var r=this.startNode(),n,i,a,o;if(this.options.ecmaVersion>=9&&this.eat(ge.ellipsis))return e?(r.argument=this.parseIdent(!1),this.type===ge.comma&&this.raiseRecoverable(this.start,"Comma is not permitted after the rest element"),this.finishNode(r,"RestElement")):(r.argument=this.parseMaybeAssign(!1,t),this.type===ge.comma&&t&&t.trailingComma<0&&(t.trailingComma=this.start),this.finishNode(r,"SpreadElement"));this.options.ecmaVersion>=6&&(r.method=!1,r.shorthand=!1,(e||t)&&(a=this.start,o=this.startLoc),e||(n=this.eat(ge.star)));var s=this.containsEsc;return this.parsePropertyName(r),!e&&!s&&this.options.ecmaVersion>=8&&!n&&this.isAsyncProp(r)?(i=!0,n=this.options.ecmaVersion>=9&&this.eat(ge.star),this.parsePropertyName(r)):i=!1,this.parsePropertyValue(r,e,n,i,a,o,t,s),this.finishNode(r,"Property")};Pr.parseGetterSetter=function(e){e.kind=e.key.name,this.parsePropertyName(e),e.value=this.parseMethod(!1);var t=e.kind==="get"?0:1;if(e.value.params.length!==t){var r=e.value.start;e.kind==="get"?this.raiseRecoverable(r,"getter should have no params"):this.raiseRecoverable(r,"setter should have exactly one param")}else e.kind==="set"&&e.value.params[0].type==="RestElement"&&this.raiseRecoverable(e.value.params[0].start,"Setter cannot use rest params")};Pr.parsePropertyValue=function(e,t,r,n,i,a,o,s){(r||n)&&this.type===ge.colon&&this.unexpected(),this.eat(ge.colon)?(e.value=t?this.parseMaybeDefault(this.start,this.startLoc):this.parseMaybeAssign(!1,o),e.kind="init"):this.options.ecmaVersion>=6&&this.type===ge.parenL?(t&&this.unexpected(),e.kind="init",e.method=!0,e.value=this.parseMethod(r,n)):!t&&!s&&this.options.ecmaVersion>=5&&!e.computed&&e.key.type==="Identifier"&&(e.key.name==="get"||e.key.name==="set")&&this.type!==ge.comma&&this.type!==ge.braceR&&this.type!==ge.eq?((r||n)&&this.unexpected(),this.parseGetterSetter(e)):this.options.ecmaVersion>=6&&!e.computed&&e.key.type==="Identifier"?((r||n)&&this.unexpected(),this.checkUnreserved(e.key),e.key.name==="await"&&!this.awaitIdentPos&&(this.awaitIdentPos=i),e.kind="init",t?e.value=this.parseMaybeDefault(i,a,this.copyNode(e.key)):this.type===ge.eq&&o?(o.shorthandAssign<0&&(o.shorthandAssign=this.start),e.value=this.parseMaybeDefault(i,a,this.copyNode(e.key))):e.value=this.copyNode(e.key),e.shorthand=!0):this.unexpected()};Pr.parsePropertyName=function(e){if(this.options.ecmaVersion>=6){if(this.eat(ge.bracketL))return e.computed=!0,e.key=this.parseMaybeAssign(),this.expect(ge.bracketR),e.key;e.computed=!1}return e.key=this.type===ge.num||this.type===ge.string?this.parseExprAtom():this.parseIdent(this.options.allowReserved!=="never")};Pr.initFunction=function(e){e.id=null,this.options.ecmaVersion>=6&&(e.generator=e.expression=!1),this.options.ecmaVersion>=8&&(e.async=!1)};Pr.parseMethod=function(e,t,r){var n=this.startNode(),i=this.yieldPos,a=this.awaitPos,o=this.awaitIdentPos;return this.initFunction(n),this.options.ecmaVersion>=6&&(n.generator=e),this.options.ecmaVersion>=8&&(n.async=!!t),this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0,this.enterScope(Qq(t,n.generator)|Vq|(r?ite:0)),this.expect(ge.parenL),n.params=this.parseBindingList(ge.parenR,!1,this.options.ecmaVersion>=8),this.checkYieldAwaitInDefaultParams(),this.parseFunctionBody(n,!1,!0,!1),this.yieldPos=i,this.awaitPos=a,this.awaitIdentPos=o,this.finishNode(n,"FunctionExpression")};Pr.parseArrowExpression=function(e,t,r,n){var i=this.yieldPos,a=this.awaitPos,o=this.awaitIdentPos;return this.enterScope(Qq(r,!1)|rte),this.initFunction(e),this.options.ecmaVersion>=8&&(e.async=!!r),this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0,e.params=this.toAssignableList(t,!0),this.parseFunctionBody(e,!0,!1,n),this.yieldPos=i,this.awaitPos=a,this.awaitIdentPos=o,this.finishNode(e,"ArrowFunctionExpression")};Pr.parseFunctionBody=function(e,t,r,n){var i=t&&this.type!==ge.braceL,a=this.strict,o=!1;if(i)e.body=this.parseMaybeAssign(n),e.expression=!0,this.checkParams(e,!1);else{var s=this.options.ecmaVersion>=7&&!this.isSimpleParamList(e.params);(!a||s)&&(o=this.strictDirective(this.end),o&&s&&this.raiseRecoverable(e.start,"Illegal 'use strict' directive in function with non-simple parameter list"));var l=this.labels;this.labels=[],o&&(this.strict=!0),this.checkParams(e,!a&&!o&&!t&&!r&&this.isSimpleParamList(e.params)),this.strict&&e.id&&this.checkLValSimple(e.id,ste),e.body=this.parseBlock(!1,void 0,o&&!a),e.expression=!1,this.adaptDirectivePrologue(e.body.body),this.labels=l}this.exitScope()};Pr.isSimpleParamList=function(e){for(var t=0,r=e;t-1||i.functions.indexOf(e)>-1||i.var.indexOf(e)>-1,i.lexical.push(e),this.inModule&&i.flags&Sk&&delete this.undefinedExports[e]}else if(t===ote){var a=this.currentScope();a.lexical.push(e)}else if(t===ate){var o=this.currentScope();this.treatFunctionsAsVar?n=o.lexical.indexOf(e)>-1:n=o.lexical.indexOf(e)>-1||o.var.indexOf(e)>-1,o.functions.push(e)}else for(var s=this.scopeStack.length-1;s>=0;--s){var l=this.scopeStack[s];if(l.lexical.indexOf(e)>-1&&!(l.flags&nte&&l.lexical[0]===e)||!this.treatFunctionsAsVarInScope(l)&&l.functions.indexOf(e)>-1){n=!0;break}if(l.var.push(e),this.inModule&&l.flags&Sk&&delete this.undefinedExports[e],l.flags&Gq)break}n&&this.raiseRecoverable(r,"Identifier '"+e+"' has already been declared")};u0.checkLocalExport=function(e){this.scopeStack[0].lexical.indexOf(e.name)===-1&&this.scopeStack[0].var.indexOf(e.name)===-1&&(this.undefinedExports[e.name]=e)};u0.currentScope=function(){return this.scopeStack[this.scopeStack.length-1]};u0.currentVarScope=function(){for(var e=this.scopeStack.length-1;;e--){var t=this.scopeStack[e];if(t.flags&Gq)return t}};u0.currentThisScope=function(){for(var e=this.scopeStack.length-1;;e--){var t=this.scopeStack[e];if(t.flags&Gq&&!(t.flags&rte))return t}};var YM=function(t,r,n){this.type="",this.start=r,this.end=0,t.options.locations&&(this.loc=new GM(t,n)),t.options.directSourceFile&&(this.sourceFile=t.options.directSourceFile),t.options.ranges&&(this.range=[r,0])},Ck=ss.prototype;Ck.startNode=function(){return new YM(this,this.start,this.startLoc)};Ck.startNodeAt=function(e,t){return new YM(this,e,t)};function cte(e,t,r,n){return e.type=t,e.end=r,this.options.locations&&(e.loc.end=n),this.options.ranges&&(e.range[1]=r),e}Ck.finishNode=function(e,t){return cte.call(this,e,t,this.lastTokEnd,this.lastTokEndLoc)};Ck.finishNodeAt=function(e,t,r,n){return cte.call(this,e,t,r,n)};Ck.copyNode=function(e){var t=new YM(this,e.start,this.startLoc);for(var r in e)t[r]=e[r];return t};var fte="ASCII ASCII_Hex_Digit AHex Alphabetic Alpha Any Assigned Bidi_Control Bidi_C Bidi_Mirrored Bidi_M Case_Ignorable CI Cased Changes_When_Casefolded CWCF Changes_When_Casemapped CWCM Changes_When_Lowercased CWL Changes_When_NFKC_Casefolded CWKCF Changes_When_Titlecased CWT Changes_When_Uppercased CWU Dash Default_Ignorable_Code_Point DI Deprecated Dep Diacritic Dia Emoji Emoji_Component Emoji_Modifier Emoji_Modifier_Base Emoji_Presentation Extender Ext Grapheme_Base Gr_Base Grapheme_Extend Gr_Ext Hex_Digit Hex IDS_Binary_Operator IDSB IDS_Trinary_Operator IDST ID_Continue IDC ID_Start IDS Ideographic Ideo Join_Control Join_C Logical_Order_Exception LOE Lowercase Lower Math Noncharacter_Code_Point NChar Pattern_Syntax Pat_Syn Pattern_White_Space Pat_WS Quotation_Mark QMark Radical Regional_Indicator RI Sentence_Terminal STerm Soft_Dotted SD Terminal_Punctuation Term Unified_Ideograph UIdeo Uppercase Upper Variation_Selector VS White_Space space XID_Continue XIDC XID_Start XIDS",dte=fte+" Extended_Pictographic",pte=dte,mte=pte+" EBase EComp EMod EPres ExtPict",hte=mte,zPe=hte,UPe={9:fte,10:dte,11:pte,12:mte,13:hte,14:zPe},WPe="Basic_Emoji Emoji_Keycap_Sequence RGI_Emoji_Modifier_Sequence RGI_Emoji_Flag_Sequence RGI_Emoji_Tag_Sequence RGI_Emoji_ZWJ_Sequence RGI_Emoji",HPe={9:"",10:"",11:"",12:"",13:"",14:WPe},Gee="Cased_Letter LC Close_Punctuation Pe Connector_Punctuation Pc Control Cc cntrl Currency_Symbol Sc Dash_Punctuation Pd Decimal_Number Nd digit Enclosing_Mark Me Final_Punctuation Pf Format Cf Initial_Punctuation Pi Letter L Letter_Number Nl Line_Separator Zl Lowercase_Letter Ll Mark M Combining_Mark Math_Symbol Sm Modifier_Letter Lm Modifier_Symbol Sk Nonspacing_Mark Mn Number N Open_Punctuation Ps Other C Other_Letter Lo Other_Number No Other_Punctuation Po Other_Symbol So Paragraph_Separator Zp Private_Use Co Punctuation P punct Separator Z Space_Separator Zs Spacing_Mark Mc Surrogate Cs Symbol S Titlecase_Letter Lt Unassigned Cn Uppercase_Letter Lu",Ate="Adlam Adlm Ahom Anatolian_Hieroglyphs Hluw Arabic Arab Armenian Armn Avestan Avst Balinese Bali Bamum Bamu Bassa_Vah Bass Batak Batk Bengali Beng Bhaiksuki Bhks Bopomofo Bopo Brahmi Brah Braille Brai Buginese Bugi Buhid Buhd Canadian_Aboriginal Cans Carian Cari Caucasian_Albanian Aghb Chakma Cakm Cham Cham Cherokee Cher Common Zyyy Coptic Copt Qaac Cuneiform Xsux Cypriot Cprt Cyrillic Cyrl Deseret Dsrt Devanagari Deva Duployan Dupl Egyptian_Hieroglyphs Egyp Elbasan Elba Ethiopic Ethi Georgian Geor Glagolitic Glag Gothic Goth Grantha Gran Greek Grek Gujarati Gujr Gurmukhi Guru Han Hani Hangul Hang Hanunoo Hano Hatran Hatr Hebrew Hebr Hiragana Hira Imperial_Aramaic Armi Inherited Zinh Qaai Inscriptional_Pahlavi Phli Inscriptional_Parthian Prti Javanese Java Kaithi Kthi Kannada Knda Katakana Kana Kayah_Li Kali Kharoshthi Khar Khmer Khmr Khojki Khoj Khudawadi Sind Lao Laoo Latin Latn Lepcha Lepc Limbu Limb Linear_A Lina Linear_B Linb Lisu Lisu Lycian Lyci Lydian Lydi Mahajani Mahj Malayalam Mlym Mandaic Mand Manichaean Mani Marchen Marc Masaram_Gondi Gonm Meetei_Mayek Mtei Mende_Kikakui Mend Meroitic_Cursive Merc Meroitic_Hieroglyphs Mero Miao Plrd Modi Mongolian Mong Mro Mroo Multani Mult Myanmar Mymr Nabataean Nbat New_Tai_Lue Talu Newa Newa Nko Nkoo Nushu Nshu Ogham Ogam Ol_Chiki Olck Old_Hungarian Hung Old_Italic Ital Old_North_Arabian Narb Old_Permic Perm Old_Persian Xpeo Old_South_Arabian Sarb Old_Turkic Orkh Oriya Orya Osage Osge Osmanya Osma Pahawh_Hmong Hmng Palmyrene Palm Pau_Cin_Hau Pauc Phags_Pa Phag Phoenician Phnx Psalter_Pahlavi Phlp Rejang Rjng Runic Runr Samaritan Samr Saurashtra Saur Sharada Shrd Shavian Shaw Siddham Sidd SignWriting Sgnw Sinhala Sinh Sora_Sompeng Sora Soyombo Soyo Sundanese Sund Syloti_Nagri Sylo Syriac Syrc Tagalog Tglg Tagbanwa Tagb Tai_Le Tale Tai_Tham Lana Tai_Viet Tavt Takri Takr Tamil Taml Tangut Tang Telugu Telu Thaana Thaa Thai Thai Tibetan Tibt Tifinagh Tfng Tirhuta Tirh Ugaritic Ugar Vai Vaii Warang_Citi Wara Yi Yiii Zanabazar_Square Zanb",gte=Ate+" Dogra Dogr Gunjala_Gondi Gong Hanifi_Rohingya Rohg Makasar Maka Medefaidrin Medf Old_Sogdian Sogo Sogdian Sogd",vte=gte+" Elymaic Elym Nandinagari Nand Nyiakeng_Puachue_Hmong Hmnp Wancho Wcho",yte=vte+" Chorasmian Chrs Diak Dives_Akuru Khitan_Small_Script Kits Yezi Yezidi",bte=yte+" Cypro_Minoan Cpmn Old_Uyghur Ougr Tangsa Tnsa Toto Vithkuqi Vith",VPe=bte+" Hrkt Katakana_Or_Hiragana Kawi Nag_Mundari Nagm Unknown Zzzz",GPe={9:Ate,10:gte,11:vte,12:yte,13:bte,14:VPe},xte={};function QPe(e){var t=xte[e]={binary:s0(UPe[e]+" "+Gee),binaryOfStrings:s0(HPe[e]),nonBinary:{General_Category:s0(Gee),Script:s0(GPe[e])}};t.nonBinary.Script_Extensions=t.nonBinary.Script,t.nonBinary.gc=t.nonBinary.General_Category,t.nonBinary.sc=t.nonBinary.Script,t.nonBinary.scx=t.nonBinary.Script_Extensions}for(UM=0,qq=[9,10,11,12,13,14];UM=6?"uy":"")+(t.options.ecmaVersion>=9?"s":"")+(t.options.ecmaVersion>=13?"d":"")+(t.options.ecmaVersion>=15?"v":""),this.unicodeProperties=xte[t.options.ecmaVersion>=14?14:t.options.ecmaVersion],this.source="",this.flags="",this.start=0,this.switchU=!1,this.switchV=!1,this.switchN=!1,this.pos=0,this.lastIntValue=0,this.lastStringValue="",this.lastAssertionIsQuantifiable=!1,this.numCapturingParens=0,this.maxBackReference=0,this.groupNames=[],this.backReferenceNames=[]};Pm.prototype.reset=function(t,r,n){var i=n.indexOf("v")!==-1,a=n.indexOf("u")!==-1;this.start=t|0,this.source=r+"",this.flags=n,i&&this.parser.options.ecmaVersion>=15?(this.switchU=!0,this.switchV=!0,this.switchN=!0):(this.switchU=a&&this.parser.options.ecmaVersion>=6,this.switchV=!1,this.switchN=a&&this.parser.options.ecmaVersion>=9)};Pm.prototype.raise=function(t){this.parser.raiseRecoverable(this.start,"Invalid regular expression: /"+this.source+"/: "+t)};Pm.prototype.at=function(t,r){r===void 0&&(r=!1);var n=this.source,i=n.length;if(t>=i)return-1;var a=n.charCodeAt(t);if(!(r||this.switchU)||a<=55295||a>=57344||t+1>=i)return a;var o=n.charCodeAt(t+1);return o>=56320&&o<=57343?(a<<10)+o-56613888:a};Pm.prototype.nextIndex=function(t,r){r===void 0&&(r=!1);var n=this.source,i=n.length;if(t>=i)return i;var a=n.charCodeAt(t),o;return!(r||this.switchU)||a<=55295||a>=57344||t+1>=i||(o=n.charCodeAt(t+1))<56320||o>57343?t+1:t+2};Pm.prototype.current=function(t){return t===void 0&&(t=!1),this.at(this.pos,t)};Pm.prototype.lookahead=function(t){return t===void 0&&(t=!1),this.at(this.nextIndex(this.pos,t),t)};Pm.prototype.advance=function(t){t===void 0&&(t=!1),this.pos=this.nextIndex(this.pos,t)};Pm.prototype.eat=function(t,r){return r===void 0&&(r=!1),this.current(r)===t?(this.advance(r),!0):!1};Pm.prototype.eatChars=function(t,r){r===void 0&&(r=!1);for(var n=this.pos,i=0,a=t;i-1&&this.raise(e.start,"Duplicate regular expression flag"),o==="u"&&(n=!0),o==="v"&&(i=!0)}this.options.ecmaVersion>=15&&n&&i&&this.raise(e.start,"Invalid regular expression flag")};er.validateRegExpPattern=function(e){this.regexp_pattern(e),!e.switchN&&this.options.ecmaVersion>=9&&e.groupNames.length>0&&(e.switchN=!0,this.regexp_pattern(e))};er.regexp_pattern=function(e){e.pos=0,e.lastIntValue=0,e.lastStringValue="",e.lastAssertionIsQuantifiable=!1,e.numCapturingParens=0,e.maxBackReference=0,e.groupNames.length=0,e.backReferenceNames.length=0,this.regexp_disjunction(e),e.pos!==e.source.length&&(e.eat(41)&&e.raise("Unmatched ')'"),(e.eat(93)||e.eat(125))&&e.raise("Lone quantifier brackets")),e.maxBackReference>e.numCapturingParens&&e.raise("Invalid escape");for(var t=0,r=e.backReferenceNames;t=9&&(r=e.eat(60)),e.eat(61)||e.eat(33))return this.regexp_disjunction(e),e.eat(41)||e.raise("Unterminated group"),e.lastAssertionIsQuantifiable=!r,!0}return e.pos=t,!1};er.regexp_eatQuantifier=function(e,t){return t===void 0&&(t=!1),this.regexp_eatQuantifierPrefix(e,t)?(e.eat(63),!0):!1};er.regexp_eatQuantifierPrefix=function(e,t){return e.eat(42)||e.eat(43)||e.eat(63)||this.regexp_eatBracedQuantifier(e,t)};er.regexp_eatBracedQuantifier=function(e,t){var r=e.pos;if(e.eat(123)){var n=0,i=-1;if(this.regexp_eatDecimalDigits(e)&&(n=e.lastIntValue,e.eat(44)&&this.regexp_eatDecimalDigits(e)&&(i=e.lastIntValue),e.eat(125)))return i!==-1&&i=9?this.regexp_groupSpecifier(e):e.current()===63&&e.raise("Invalid group"),this.regexp_disjunction(e),e.eat(41))return e.numCapturingParens+=1,!0;e.raise("Unterminated group")}return!1};er.regexp_eatExtendedAtom=function(e){return e.eat(46)||this.regexp_eatReverseSolidusAtomEscape(e)||this.regexp_eatCharacterClass(e)||this.regexp_eatUncapturingGroup(e)||this.regexp_eatCapturingGroup(e)||this.regexp_eatInvalidBracedQuantifier(e)||this.regexp_eatExtendedPatternCharacter(e)};er.regexp_eatInvalidBracedQuantifier=function(e){return this.regexp_eatBracedQuantifier(e,!0)&&e.raise("Nothing to repeat"),!1};er.regexp_eatSyntaxCharacter=function(e){var t=e.current();return wte(t)?(e.lastIntValue=t,e.advance(),!0):!1};function wte(e){return e===36||e>=40&&e<=43||e===46||e===63||e>=91&&e<=94||e>=123&&e<=125}er.regexp_eatPatternCharacters=function(e){for(var t=e.pos,r=0;(r=e.current())!==-1&&!wte(r);)e.advance();return e.pos!==t};er.regexp_eatExtendedPatternCharacter=function(e){var t=e.current();return t!==-1&&t!==36&&!(t>=40&&t<=43)&&t!==46&&t!==63&&t!==91&&t!==94&&t!==124?(e.advance(),!0):!1};er.regexp_groupSpecifier=function(e){if(e.eat(63)){if(this.regexp_eatGroupName(e)){e.groupNames.indexOf(e.lastStringValue)!==-1&&e.raise("Duplicate capture group name"),e.groupNames.push(e.lastStringValue);return}e.raise("Invalid group")}};er.regexp_eatGroupName=function(e){if(e.lastStringValue="",e.eat(60)){if(this.regexp_eatRegExpIdentifierName(e)&&e.eat(62))return!0;e.raise("Invalid capture group name")}return!1};er.regexp_eatRegExpIdentifierName=function(e){if(e.lastStringValue="",this.regexp_eatRegExpIdentifierStart(e)){for(e.lastStringValue+=l0(e.lastIntValue);this.regexp_eatRegExpIdentifierPart(e);)e.lastStringValue+=l0(e.lastIntValue);return!0}return!1};er.regexp_eatRegExpIdentifierStart=function(e){var t=e.pos,r=this.options.ecmaVersion>=11,n=e.current(r);return e.advance(r),n===92&&this.regexp_eatRegExpUnicodeEscapeSequence(e,r)&&(n=e.lastIntValue),YPe(n)?(e.lastIntValue=n,!0):(e.pos=t,!1)};function YPe(e){return EA(e,!0)||e===36||e===95}er.regexp_eatRegExpIdentifierPart=function(e){var t=e.pos,r=this.options.ecmaVersion>=11,n=e.current(r);return e.advance(r),n===92&&this.regexp_eatRegExpUnicodeEscapeSequence(e,r)&&(n=e.lastIntValue),ZPe(n)?(e.lastIntValue=n,!0):(e.pos=t,!1)};function ZPe(e){return Jx(e,!0)||e===36||e===95||e===8204||e===8205}er.regexp_eatAtomEscape=function(e){return this.regexp_eatBackReference(e)||this.regexp_eatCharacterClassEscape(e)||this.regexp_eatCharacterEscape(e)||e.switchN&&this.regexp_eatKGroupName(e)?!0:(e.switchU&&(e.current()===99&&e.raise("Invalid unicode escape"),e.raise("Invalid escape")),!1)};er.regexp_eatBackReference=function(e){var t=e.pos;if(this.regexp_eatDecimalEscape(e)){var r=e.lastIntValue;if(e.switchU)return r>e.maxBackReference&&(e.maxBackReference=r),!0;if(r<=e.numCapturingParens)return!0;e.pos=t}return!1};er.regexp_eatKGroupName=function(e){if(e.eat(107)){if(this.regexp_eatGroupName(e))return e.backReferenceNames.push(e.lastStringValue),!0;e.raise("Invalid named reference")}return!1};er.regexp_eatCharacterEscape=function(e){return this.regexp_eatControlEscape(e)||this.regexp_eatCControlLetter(e)||this.regexp_eatZero(e)||this.regexp_eatHexEscapeSequence(e)||this.regexp_eatRegExpUnicodeEscapeSequence(e,!1)||!e.switchU&&this.regexp_eatLegacyOctalEscapeSequence(e)||this.regexp_eatIdentityEscape(e)};er.regexp_eatCControlLetter=function(e){var t=e.pos;if(e.eat(99)){if(this.regexp_eatControlLetter(e))return!0;e.pos=t}return!1};er.regexp_eatZero=function(e){return e.current()===48&&!ZM(e.lookahead())?(e.lastIntValue=0,e.advance(),!0):!1};er.regexp_eatControlEscape=function(e){var t=e.current();return t===116?(e.lastIntValue=9,e.advance(),!0):t===110?(e.lastIntValue=10,e.advance(),!0):t===118?(e.lastIntValue=11,e.advance(),!0):t===102?(e.lastIntValue=12,e.advance(),!0):t===114?(e.lastIntValue=13,e.advance(),!0):!1};er.regexp_eatControlLetter=function(e){var t=e.current();return Ste(t)?(e.lastIntValue=t%32,e.advance(),!0):!1};function Ste(e){return e>=65&&e<=90||e>=97&&e<=122}er.regexp_eatRegExpUnicodeEscapeSequence=function(e,t){t===void 0&&(t=!1);var r=e.pos,n=t||e.switchU;if(e.eat(117)){if(this.regexp_eatFixedHexDigits(e,4)){var i=e.lastIntValue;if(n&&i>=55296&&i<=56319){var a=e.pos;if(e.eat(92)&&e.eat(117)&&this.regexp_eatFixedHexDigits(e,4)){var o=e.lastIntValue;if(o>=56320&&o<=57343)return e.lastIntValue=(i-55296)*1024+(o-56320)+65536,!0}e.pos=a,e.lastIntValue=i}return!0}if(n&&e.eat(123)&&this.regexp_eatHexDigits(e)&&e.eat(125)&&XPe(e.lastIntValue))return!0;n&&e.raise("Invalid unicode escape"),e.pos=r}return!1};function XPe(e){return e>=0&&e<=1114111}er.regexp_eatIdentityEscape=function(e){if(e.switchU)return this.regexp_eatSyntaxCharacter(e)?!0:e.eat(47)?(e.lastIntValue=47,!0):!1;var t=e.current();return t!==99&&(!e.switchN||t!==107)?(e.lastIntValue=t,e.advance(),!0):!1};er.regexp_eatDecimalEscape=function(e){e.lastIntValue=0;var t=e.current();if(t>=49&&t<=57){do e.lastIntValue=10*e.lastIntValue+(t-48),e.advance();while((t=e.current())>=48&&t<=57);return!0}return!1};var Ete=0,kA=1,pd=2;er.regexp_eatCharacterClassEscape=function(e){var t=e.current();if(KPe(t))return e.lastIntValue=-1,e.advance(),kA;var r=!1;if(e.switchU&&this.options.ecmaVersion>=9&&((r=t===80)||t===112)){e.lastIntValue=-1,e.advance();var n;if(e.eat(123)&&(n=this.regexp_eatUnicodePropertyValueExpression(e))&&e.eat(125))return r&&n===pd&&e.raise("Invalid property name"),n;e.raise("Invalid property name")}return Ete};function KPe(e){return e===100||e===68||e===115||e===83||e===119||e===87}er.regexp_eatUnicodePropertyValueExpression=function(e){var t=e.pos;if(this.regexp_eatUnicodePropertyName(e)&&e.eat(61)){var r=e.lastStringValue;if(this.regexp_eatUnicodePropertyValue(e)){var n=e.lastStringValue;return this.regexp_validateUnicodePropertyNameAndValue(e,r,n),kA}}if(e.pos=t,this.regexp_eatLoneUnicodePropertyNameOrValue(e)){var i=e.lastStringValue;return this.regexp_validateUnicodePropertyNameOrValue(e,i)}return Ete};er.regexp_validateUnicodePropertyNameAndValue=function(e,t,r){Ek(e.unicodeProperties.nonBinary,t)||e.raise("Invalid property name"),e.unicodeProperties.nonBinary[t].test(r)||e.raise("Invalid property value")};er.regexp_validateUnicodePropertyNameOrValue=function(e,t){if(e.unicodeProperties.binary.test(t))return kA;if(e.switchV&&e.unicodeProperties.binaryOfStrings.test(t))return pd;e.raise("Invalid property name")};er.regexp_eatUnicodePropertyName=function(e){var t=0;for(e.lastStringValue="";kte(t=e.current());)e.lastStringValue+=l0(t),e.advance();return e.lastStringValue!==""};function kte(e){return Ste(e)||e===95}er.regexp_eatUnicodePropertyValue=function(e){var t=0;for(e.lastStringValue="";JPe(t=e.current());)e.lastStringValue+=l0(t),e.advance();return e.lastStringValue!==""};function JPe(e){return kte(e)||ZM(e)}er.regexp_eatLoneUnicodePropertyNameOrValue=function(e){return this.regexp_eatUnicodePropertyValue(e)};er.regexp_eatCharacterClass=function(e){if(e.eat(91)){var t=e.eat(94),r=this.regexp_classContents(e);return e.eat(93)||e.raise("Unterminated character class"),t&&r===pd&&e.raise("Negated character class may contain strings"),!0}return!1};er.regexp_classContents=function(e){return e.current()===93?kA:e.switchV?this.regexp_classSetExpression(e):(this.regexp_nonEmptyClassRanges(e),kA)};er.regexp_nonEmptyClassRanges=function(e){for(;this.regexp_eatClassAtom(e);){var t=e.lastIntValue;if(e.eat(45)&&this.regexp_eatClassAtom(e)){var r=e.lastIntValue;e.switchU&&(t===-1||r===-1)&&e.raise("Invalid character class"),t!==-1&&r!==-1&&t>r&&e.raise("Range out of order in character class")}}};er.regexp_eatClassAtom=function(e){var t=e.pos;if(e.eat(92)){if(this.regexp_eatClassEscape(e))return!0;if(e.switchU){var r=e.current();(r===99||Ote(r))&&e.raise("Invalid class escape"),e.raise("Invalid escape")}e.pos=t}var n=e.current();return n!==93?(e.lastIntValue=n,e.advance(),!0):!1};er.regexp_eatClassEscape=function(e){var t=e.pos;if(e.eat(98))return e.lastIntValue=8,!0;if(e.switchU&&e.eat(45))return e.lastIntValue=45,!0;if(!e.switchU&&e.eat(99)){if(this.regexp_eatClassControlLetter(e))return!0;e.pos=t}return this.regexp_eatCharacterClassEscape(e)||this.regexp_eatCharacterEscape(e)};er.regexp_classSetExpression=function(e){var t=kA,r;if(!this.regexp_eatClassSetRange(e))if(r=this.regexp_eatClassSetOperand(e)){r===pd&&(t=pd);for(var n=e.pos;e.eatChars([38,38]);){if(e.current()!==38&&(r=this.regexp_eatClassSetOperand(e))){r!==pd&&(t=kA);continue}e.raise("Invalid character in character class")}if(n!==e.pos)return t;for(;e.eatChars([45,45]);)this.regexp_eatClassSetOperand(e)||e.raise("Invalid character in character class");if(n!==e.pos)return t}else e.raise("Invalid character in character class");for(;;)if(!this.regexp_eatClassSetRange(e)){if(r=this.regexp_eatClassSetOperand(e),!r)return t;r===pd&&(t=pd)}};er.regexp_eatClassSetRange=function(e){var t=e.pos;if(this.regexp_eatClassSetCharacter(e)){var r=e.lastIntValue;if(e.eat(45)&&this.regexp_eatClassSetCharacter(e)){var n=e.lastIntValue;return r!==-1&&n!==-1&&r>n&&e.raise("Range out of order in character class"),!0}e.pos=t}return!1};er.regexp_eatClassSetOperand=function(e){return this.regexp_eatClassSetCharacter(e)?kA:this.regexp_eatClassStringDisjunction(e)||this.regexp_eatNestedClass(e)};er.regexp_eatNestedClass=function(e){var t=e.pos;if(e.eat(91)){var r=e.eat(94),n=this.regexp_classContents(e);if(e.eat(93))return r&&n===pd&&e.raise("Negated character class may contain strings"),n;e.pos=t}if(e.eat(92)){var i=this.regexp_eatCharacterClassEscape(e);if(i)return i;e.pos=t}return null};er.regexp_eatClassStringDisjunction=function(e){var t=e.pos;if(e.eatChars([92,113])){if(e.eat(123)){var r=this.regexp_classStringDisjunctionContents(e);if(e.eat(125))return r}else e.raise("Invalid escape");e.pos=t}return null};er.regexp_classStringDisjunctionContents=function(e){for(var t=this.regexp_classString(e);e.eat(124);)this.regexp_classString(e)===pd&&(t=pd);return t};er.regexp_classString=function(e){for(var t=0;this.regexp_eatClassSetCharacter(e);)t++;return t===1?kA:pd};er.regexp_eatClassSetCharacter=function(e){var t=e.pos;if(e.eat(92))return this.regexp_eatCharacterEscape(e)||this.regexp_eatClassSetReservedPunctuator(e)?!0:e.eat(98)?(e.lastIntValue=8,!0):(e.pos=t,!1);var r=e.current();return r<0||r===e.lookahead()&&eIe(r)||tIe(r)?!1:(e.advance(),e.lastIntValue=r,!0)};function eIe(e){return e===33||e>=35&&e<=38||e>=42&&e<=44||e===46||e>=58&&e<=64||e===94||e===96||e===126}function tIe(e){return e===40||e===41||e===45||e===47||e>=91&&e<=93||e>=123&&e<=125}er.regexp_eatClassSetReservedPunctuator=function(e){var t=e.current();return rIe(t)?(e.lastIntValue=t,e.advance(),!0):!1};function rIe(e){return e===33||e===35||e===37||e===38||e===44||e===45||e>=58&&e<=62||e===64||e===96||e===126}er.regexp_eatClassControlLetter=function(e){var t=e.current();return ZM(t)||t===95?(e.lastIntValue=t%32,e.advance(),!0):!1};er.regexp_eatHexEscapeSequence=function(e){var t=e.pos;if(e.eat(120)){if(this.regexp_eatFixedHexDigits(e,2))return!0;e.switchU&&e.raise("Invalid escape"),e.pos=t}return!1};er.regexp_eatDecimalDigits=function(e){var t=e.pos,r=0;for(e.lastIntValue=0;ZM(r=e.current());)e.lastIntValue=10*e.lastIntValue+(r-48),e.advance();return e.pos!==t};function ZM(e){return e>=48&&e<=57}er.regexp_eatHexDigits=function(e){var t=e.pos,r=0;for(e.lastIntValue=0;Cte(r=e.current());)e.lastIntValue=16*e.lastIntValue+Dte(r),e.advance();return e.pos!==t};function Cte(e){return e>=48&&e<=57||e>=65&&e<=70||e>=97&&e<=102}function Dte(e){return e>=65&&e<=70?10+(e-65):e>=97&&e<=102?10+(e-97):e-48}er.regexp_eatLegacyOctalEscapeSequence=function(e){if(this.regexp_eatOctalDigit(e)){var t=e.lastIntValue;if(this.regexp_eatOctalDigit(e)){var r=e.lastIntValue;t<=3&&this.regexp_eatOctalDigit(e)?e.lastIntValue=t*64+r*8+e.lastIntValue:e.lastIntValue=t*8+r}else e.lastIntValue=t;return!0}return!1};er.regexp_eatOctalDigit=function(e){var t=e.current();return Ote(t)?(e.lastIntValue=t-48,e.advance(),!0):(e.lastIntValue=0,!1)};function Ote(e){return e>=48&&e<=55}er.regexp_eatFixedHexDigits=function(e,t){var r=e.pos;e.lastIntValue=0;for(var n=0;n=this.input.length)return this.finishToken(ge.eof);if(e.override)return e.override(this);this.readToken(this.fullCharCodeAtPos())};Nn.readToken=function(e){return EA(e,this.options.ecmaVersion>=6)||e===92?this.readWord():this.getTokenFromCode(e)};Nn.fullCharCodeAtPos=function(){var e=this.input.charCodeAt(this.pos);if(e<=55295||e>=56320)return e;var t=this.input.charCodeAt(this.pos+1);return t<=56319||t>=57344?e:(e<<10)+t-56613888};Nn.skipBlockComment=function(){var e=this.options.onComment&&this.curPosition(),t=this.pos,r=this.input.indexOf("*/",this.pos+=2);if(r===-1&&this.raise(this.pos-2,"Unterminated comment"),this.pos=r+2,this.options.locations)for(var n=void 0,i=t;(n=Xee(this.input,i,this.pos))>-1;)++this.curLine,i=this.lineStart=n;this.options.onComment&&this.options.onComment(!0,this.input.slice(t+2,r),t,this.pos,e,this.curPosition())};Nn.skipLineComment=function(e){for(var t=this.pos,r=this.options.onComment&&this.curPosition(),n=this.input.charCodeAt(this.pos+=e);this.pos8&&e<14||e>=5760&&Kee.test(String.fromCharCode(e)))++this.pos;else break e}}};Nn.finishToken=function(e,t){this.end=this.pos,this.options.locations&&(this.endLoc=this.curPosition());var r=this.type;this.type=e,this.value=t,this.updateContext(r)};Nn.readToken_dot=function(){var e=this.input.charCodeAt(this.pos+1);if(e>=48&&e<=57)return this.readNumber(!0);var t=this.input.charCodeAt(this.pos+2);return this.options.ecmaVersion>=6&&e===46&&t===46?(this.pos+=3,this.finishToken(ge.ellipsis)):(++this.pos,this.finishToken(ge.dot))};Nn.readToken_slash=function(){var e=this.input.charCodeAt(this.pos+1);return this.exprAllowed?(++this.pos,this.readRegexp()):e===61?this.finishOp(ge.assign,2):this.finishOp(ge.slash,1)};Nn.readToken_mult_modulo_exp=function(e){var t=this.input.charCodeAt(this.pos+1),r=1,n=e===42?ge.star:ge.modulo;return this.options.ecmaVersion>=7&&e===42&&t===42&&(++r,n=ge.starstar,t=this.input.charCodeAt(this.pos+2)),t===61?this.finishOp(ge.assign,r+1):this.finishOp(n,r)};Nn.readToken_pipe_amp=function(e){var t=this.input.charCodeAt(this.pos+1);if(t===e){if(this.options.ecmaVersion>=12){var r=this.input.charCodeAt(this.pos+2);if(r===61)return this.finishOp(ge.assign,3)}return this.finishOp(e===124?ge.logicalOR:ge.logicalAND,2)}return t===61?this.finishOp(ge.assign,2):this.finishOp(e===124?ge.bitwiseOR:ge.bitwiseAND,1)};Nn.readToken_caret=function(){var e=this.input.charCodeAt(this.pos+1);return e===61?this.finishOp(ge.assign,2):this.finishOp(ge.bitwiseXOR,1)};Nn.readToken_plus_min=function(e){var t=this.input.charCodeAt(this.pos+1);return t===e?t===45&&!this.inModule&&this.input.charCodeAt(this.pos+2)===62&&(this.lastTokEnd===0||md.test(this.input.slice(this.lastTokEnd,this.pos)))?(this.skipLineComment(3),this.skipSpace(),this.nextToken()):this.finishOp(ge.incDec,2):t===61?this.finishOp(ge.assign,2):this.finishOp(ge.plusMin,1)};Nn.readToken_lt_gt=function(e){var t=this.input.charCodeAt(this.pos+1),r=1;return t===e?(r=e===62&&this.input.charCodeAt(this.pos+2)===62?3:2,this.input.charCodeAt(this.pos+r)===61?this.finishOp(ge.assign,r+1):this.finishOp(ge.bitShift,r)):t===33&&e===60&&!this.inModule&&this.input.charCodeAt(this.pos+2)===45&&this.input.charCodeAt(this.pos+3)===45?(this.skipLineComment(4),this.skipSpace(),this.nextToken()):(t===61&&(r=2),this.finishOp(ge.relational,r))};Nn.readToken_eq_excl=function(e){var t=this.input.charCodeAt(this.pos+1);return t===61?this.finishOp(ge.equality,this.input.charCodeAt(this.pos+2)===61?3:2):e===61&&t===62&&this.options.ecmaVersion>=6?(this.pos+=2,this.finishToken(ge.arrow)):this.finishOp(e===61?ge.eq:ge.prefix,1)};Nn.readToken_question=function(){var e=this.options.ecmaVersion;if(e>=11){var t=this.input.charCodeAt(this.pos+1);if(t===46){var r=this.input.charCodeAt(this.pos+2);if(r<48||r>57)return this.finishOp(ge.questionDot,2)}if(t===63){if(e>=12){var n=this.input.charCodeAt(this.pos+2);if(n===61)return this.finishOp(ge.assign,3)}return this.finishOp(ge.coalesce,2)}}return this.finishOp(ge.question,1)};Nn.readToken_numberSign=function(){var e=this.options.ecmaVersion,t=35;if(e>=13&&(++this.pos,t=this.fullCharCodeAtPos(),EA(t,!0)||t===92))return this.finishToken(ge.privateId,this.readWord1());this.raise(this.pos,"Unexpected character '"+l0(t)+"'")};Nn.getTokenFromCode=function(e){switch(e){case 46:return this.readToken_dot();case 40:return++this.pos,this.finishToken(ge.parenL);case 41:return++this.pos,this.finishToken(ge.parenR);case 59:return++this.pos,this.finishToken(ge.semi);case 44:return++this.pos,this.finishToken(ge.comma);case 91:return++this.pos,this.finishToken(ge.bracketL);case 93:return++this.pos,this.finishToken(ge.bracketR);case 123:return++this.pos,this.finishToken(ge.braceL);case 125:return++this.pos,this.finishToken(ge.braceR);case 58:return++this.pos,this.finishToken(ge.colon);case 96:if(this.options.ecmaVersion<6)break;return++this.pos,this.finishToken(ge.backQuote);case 48:var t=this.input.charCodeAt(this.pos+1);if(t===120||t===88)return this.readRadixNumber(16);if(this.options.ecmaVersion>=6){if(t===111||t===79)return this.readRadixNumber(8);if(t===98||t===66)return this.readRadixNumber(2)}case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:return this.readNumber(!1);case 34:case 39:return this.readString(e);case 47:return this.readToken_slash();case 37:case 42:return this.readToken_mult_modulo_exp(e);case 124:case 38:return this.readToken_pipe_amp(e);case 94:return this.readToken_caret();case 43:case 45:return this.readToken_plus_min(e);case 60:case 62:return this.readToken_lt_gt(e);case 61:case 33:return this.readToken_eq_excl(e);case 63:return this.readToken_question();case 126:return this.finishOp(ge.prefix,1);case 35:return this.readToken_numberSign()}this.raise(this.pos,"Unexpected character '"+l0(e)+"'")};Nn.finishOp=function(e,t){var r=this.input.slice(this.pos,this.pos+t);return this.pos+=t,this.finishToken(e,r)};Nn.readRegexp=function(){for(var e,t,r=this.pos;;){this.pos>=this.input.length&&this.raise(r,"Unterminated regular expression");var n=this.input.charAt(this.pos);if(md.test(n)&&this.raise(r,"Unterminated regular expression"),e)e=!1;else{if(n==="[")t=!0;else if(n==="]"&&t)t=!1;else if(n==="/"&&!t)break;e=n==="\\"}++this.pos}var i=this.input.slice(r,this.pos);++this.pos;var a=this.pos,o=this.readWord1();this.containsEsc&&this.unexpected(a);var s=this.regexpState||(this.regexpState=new Pm(this));s.reset(r,i,o),this.validateRegExpFlags(s),this.validateRegExpPattern(s);var l=null;try{l=new RegExp(i,o)}catch{}return this.finishToken(ge.regexp,{pattern:i,flags:o,value:l})};Nn.readInt=function(e,t,r){for(var n=this.options.ecmaVersion>=12&&t===void 0,i=r&&this.input.charCodeAt(this.pos)===48,a=this.pos,o=0,s=0,l=0,u=t??1/0;l=97?f=c-97+10:c>=65?f=c-65+10:c>=48&&c<=57?f=c-48:f=1/0,f>=e)break;s=c,o=o*e+f}return n&&s===95&&this.raiseRecoverable(this.pos-1,"Numeric separator is not allowed at the last of digits"),this.pos===a||t!=null&&this.pos-a!==t?null:o};function nIe(e,t){return t?parseInt(e,8):parseFloat(e.replace(/_/g,""))}function Mte(e){return typeof BigInt!="function"?null:BigInt(e.replace(/_/g,""))}Nn.readRadixNumber=function(e){var t=this.pos;this.pos+=2;var r=this.readInt(e);return r==null&&this.raise(this.start+2,"Expected number in radix "+e),this.options.ecmaVersion>=11&&this.input.charCodeAt(this.pos)===110?(r=Mte(this.input.slice(t,this.pos)),++this.pos):EA(this.fullCharCodeAtPos())&&this.raise(this.pos,"Identifier directly after number"),this.finishToken(ge.num,r)};Nn.readNumber=function(e){var t=this.pos;!e&&this.readInt(10,void 0,!0)===null&&this.raise(t,"Invalid number");var r=this.pos-t>=2&&this.input.charCodeAt(t)===48;r&&this.strict&&this.raise(t,"Invalid number");var n=this.input.charCodeAt(this.pos);if(!r&&!e&&this.options.ecmaVersion>=11&&n===110){var i=Mte(this.input.slice(t,this.pos));return++this.pos,EA(this.fullCharCodeAtPos())&&this.raise(this.pos,"Identifier directly after number"),this.finishToken(ge.num,i)}r&&/[89]/.test(this.input.slice(t,this.pos))&&(r=!1),n===46&&!r&&(++this.pos,this.readInt(10),n=this.input.charCodeAt(this.pos)),(n===69||n===101)&&!r&&(n=this.input.charCodeAt(++this.pos),(n===43||n===45)&&++this.pos,this.readInt(10)===null&&this.raise(t,"Invalid number")),EA(this.fullCharCodeAtPos())&&this.raise(this.pos,"Identifier directly after number");var a=nIe(this.input.slice(t,this.pos),r);return this.finishToken(ge.num,a)};Nn.readCodePoint=function(){var e=this.input.charCodeAt(this.pos),t;if(e===123){this.options.ecmaVersion<6&&this.unexpected();var r=++this.pos;t=this.readHexChar(this.input.indexOf("}",this.pos)-this.pos),++this.pos,t>1114111&&this.invalidStringToken(r,"Code point out of bounds")}else t=this.readHexChar(4);return t};Nn.readString=function(e){for(var t="",r=++this.pos;;){this.pos>=this.input.length&&this.raise(this.start,"Unterminated string constant");var n=this.input.charCodeAt(this.pos);if(n===e)break;n===92?(t+=this.input.slice(r,this.pos),t+=this.readEscapedChar(!1),r=this.pos):n===8232||n===8233?(this.options.ecmaVersion<10&&this.raise(this.start,"Unterminated string constant"),++this.pos,this.options.locations&&(this.curLine++,this.lineStart=this.pos)):(ew(n)&&this.raise(this.start,"Unterminated string constant"),++this.pos)}return t+=this.input.slice(r,this.pos++),this.finishToken(ge.string,t)};var jte={};Nn.tryReadTemplateToken=function(){this.inTemplateElement=!0;try{this.readTmplToken()}catch(e){if(e===jte)this.readInvalidTemplateToken();else throw e}this.inTemplateElement=!1};Nn.invalidStringToken=function(e,t){if(this.inTemplateElement&&this.options.ecmaVersion>=9)throw jte;this.raise(e,t)};Nn.readTmplToken=function(){for(var e="",t=this.pos;;){this.pos>=this.input.length&&this.raise(this.start,"Unterminated template");var r=this.input.charCodeAt(this.pos);if(r===96||r===36&&this.input.charCodeAt(this.pos+1)===123)return this.pos===this.start&&(this.type===ge.template||this.type===ge.invalidTemplate)?r===36?(this.pos+=2,this.finishToken(ge.dollarBraceL)):(++this.pos,this.finishToken(ge.backQuote)):(e+=this.input.slice(t,this.pos),this.finishToken(ge.template,e));if(r===92)e+=this.input.slice(t,this.pos),e+=this.readEscapedChar(!0),t=this.pos;else if(ew(r)){switch(e+=this.input.slice(t,this.pos),++this.pos,r){case 13:this.input.charCodeAt(this.pos)===10&&++this.pos;case 10:e+=` `;break;default:e+=String.fromCharCode(r);break}this.options.locations&&(++this.curLine,this.lineStart=this.pos),t=this.pos}else++this.pos}};Nn.readInvalidTemplateToken=function(){for(;this.pos=48&&t<=55){var n=this.input.substr(this.pos-1,3).match(/^[0-7]+/)[0],i=parseInt(n,8);return i>255&&(n=n.slice(0,-1),i=parseInt(n,8)),this.pos+=n.length-1,t=this.input.charCodeAt(this.pos),(n!=="0"||t===56||t===57)&&(this.strict||e)&&this.invalidStringToken(this.pos-1-n.length,e?"Octal literal in template string":"Octal literal in strict mode"),String.fromCharCode(i)}return ew(t)?"":String.fromCharCode(t)}};Nn.readHexChar=function(e){var t=this.pos,r=this.readInt(16,e);return r===null&&this.invalidStringToken(t,"Bad character escape sequence"),r};Nn.readWord1=function(){this.containsEsc=!1;for(var e="",t=!0,r=this.pos,n=this.options.ecmaVersion>=6;this.pos{!e||t!==r&&Object.prototype.hasOwnProperty.call(e,t)&&(Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(e,t)),delete e[t])};function KM(e,t){let r={};for(let n in e)Object.prototype.hasOwnProperty.call(e,n)&&(r[n]=t(e[n],n));return r}var Vo=(e,t)=>e?pr(e.value,e.type,t).alias??e.name:null,rL=e=>e.replace(/;+$/,""),JM=(e,t)=>{let r=rL(e.trim());return!!(t=="object"&&r.startsWith("{")&&r.endsWith("}")||t=="object-multi"&&r.startsWith("[")&&r.endsWith("]")||e==null||e=="")},Pu=e=>{let t=/^["'](?:[^"\\]|\\.)*["'](?:;)?$/.test(e),r=e?.replace(/;+$/,""),n=!isNaN(parseFloat(r))&&!isNaN(r);return t||n||r=="false"||r=="true"||e==null||e==""},ls=(e,t,r,n)=>ct({...e,node:{...e.node,type:"frame",ref:"spaces://$kit/#*"+e.id},children:[]},t,r,n),ct=(e,t,r,n)=>({...e,node:{...e.node,props:{...e.node.props,...t},styles:{...e.node.styles,...r},actions:{...e.node.actions,...n}}});var z1=(e,t,r,n)=>{let i=Mi(e.node.id,r.map(a=>a.id));return{...e.node,id:i,schemaId:n,parentId:t}};var nL=(e,t,r)=>{let n=t?`($event, $value, $state, $saveState, $api) => { ${e} }`:e,i=typeof n=="string"||n instanceof String?n.includes(` `):!1,a=r?.startsWith("object")&&JM(e,r),o;try{o=i&&!t&&!n.startsWith("(")&&!a?new Function(`with(this) { ${n} }`):new Function(`with(this) { return ${n}; }`)}catch(s){console.log(s,n,e)}return o},Dk=e=>{let t={...e,execActions:{},execProps:{},execStyles:{},execPropsOptions:{}},{sortedKeys:r,dependencies:n}=Fte(t.node.props,`${t.id}.props`),{sortedKeys:i,dependencies:a}=Fte(t.node.styles,`${t.id}.styles`);t.execPropsOptions.props=r.map(s=>({name:s,isConst:Pu(t.node.props[s]),deps:n.get(s)||[]})),t.execProps=KM(t.node.props,(s,l)=>nL(s,!1,t.node.types[l])),t.execStyles=KM(t.node.styles,s=>nL(s,!1)),t.execActions=KM(t.node.actions,s=>nL(s,!0)),t.children=t.children.map(s=>Dk(s)),t.execPropsOptions.children=[...t.children.flatMap(s=>s.execPropsOptions.children),...t.children.map(s=>s.id)];let o=[...t.children.flatMap(s=>s.execPropsOptions.deps),...t.execPropsOptions.props.flatMap(s=>s.deps),...[...a.values()].flat()];return t.execPropsOptions.deps=o.filter(s=>s[0]!=t.id),t.node.type=="list"&&(t.execPropsOptions.template=t.children),t};function aIe(e){let t=[];function r(i,a=[]){if(i.type==="Identifier")return a.push(i.name),a;if(i.type==="MemberExpression"){let o=r(i.object,a);if(o&&i.computed)return i.property.type==="Literal"?(o.push(String(i.property.value)),o):i.property.type==="Identifier"?(o.push(i.property.name),o):i.property.type==="MemberExpression"?(n(i.property),o):null;if(o)return r(i.property,o)}else{if(i.type==="Literal")return a.push(String(i.value)),a;if(i.type==="ChainExpression"||i.type=="ExpressionStatement"){n(i.expression);return}else if(i.type==="CallExpression"){n(i);return}}return null}function n(i){if(i.type==="MemberExpression"){let a=r(i);a&&t.push(a);return}for(let a in i)if(typeof i[a]=="object"&&i[a]!==null)n(i[a]);else if(Array.isArray(i[a]))for(let o of i[a])typeof o=="object"&&o!==null&&n(o)}try{let i=q1(e.replace("return ",""),{ecmaVersion:2020});n(i)}catch{return[]}return t}function Fte(e,t){let r=new Map,n=new Map,i=new Map;for(let u in e){let c=e[u],f=aIe(c),d=f.filter(p=>p.slice(0,-1).join(".")===t);n.set(u,d),i.set(u,f),r.has(u)||r.set(u,new Set);for(let p of d){let h=p[p.length-1];h!==u&&r.get(u).add(h)}}let a=new Set,o=[],s=new Set,l=u=>{if(s.has(u))throw new Error("Circular dependency detected");if(!a.has(u)){s.add(u);let c=r.get(u)||new Set;for(let f of c)l(f);a.add(u),s.delete(u),o.push(u)}};for(let u in e)a.has(u)||l(u);return{sortedKeys:o,dependencies:i}}var{stringify:oIe}=JSON;if(!String.prototype.repeat)throw new Error("String.prototype.repeat is undefined, see https://github.com/davidbonnet/astring#installation");if(!String.prototype.endsWith)throw new Error("String.prototype.endsWith is undefined, see https://github.com/davidbonnet/astring#installation");var ej={"||":2,"??":3,"&&":4,"|":5,"^":6,"&":7,"==":8,"!=":8,"===":8,"!==":8,"<":9,">":9,"<=":9,">=":9,in:9,instanceof:9,"<<":10,">>":10,">>>":10,"+":11,"-":11,"*":12,"%":12,"/":12,"**":13},wp=17,sIe={ArrayExpression:20,TaggedTemplateExpression:20,ThisExpression:20,Identifier:20,PrivateIdentifier:20,Literal:18,TemplateLiteral:20,Super:20,SequenceExpression:20,MemberExpression:19,ChainExpression:19,CallExpression:19,NewExpression:19,ArrowFunctionExpression:wp,ClassExpression:wp,FunctionExpression:wp,ObjectExpression:wp,UpdateExpression:16,UnaryExpression:15,AwaitExpression:15,BinaryExpression:14,LogicalExpression:13,ConditionalExpression:4,AssignmentExpression:3,YieldExpression:2,RestElement:1};function nw(e,t){let{generator:r}=e;if(e.write("("),t!=null&&t.length>0){r[t[0].type](t[0],e);let{length:n}=t;for(let i=1;il.trim()!=="");s[s.length-1].includes("return")&&(o=!0),s[s.length-1]=`${s[s.length-1].replace("return ","")}`,i=s.join(` `)}try{let s=q1(i,{ecmaVersion:2020,locations:!0});Nte(s,{Identifier(l,u){let c=u[u.length-2];(c.type!=="MemberExpression"||c.object===l)&&l.name==t&&(l.name=r)},Property(l){l.key.type==="Identifier"&&l.key.name===t&&(l.key.name=r)},ObjectExpression(l){l.properties.forEach(u=>{u.key.type==="Identifier"&&u.key.name===t&&(u.key.name=r)})}}),n=Lte(s).trimEnd()}catch(s){console.log(s,e,name),n='"error"'}if(a&&o){let s=n.split(` `).filter(l=>l.trim()!=="");s[s.length-1]=`return ${s[s.length-1]}`,n=s.join(` -`)}return n},sf=(e,t,r,n)=>({...r,id:r.id==e?t:r.id,parentId:r.id==n?r.parentId:r.parentId==e?t:r.parentId,ref:r.ref==e?t:r.ref,props:Object.keys(r?.props??{}).reduce((i,a)=>({...i,[a]:U1(r.props[a],e,t)}),r.props),actions:Object.keys(r?.actions??{}).reduce((i,a)=>({...i,[a]:U1(r.actions[a],e,t)}),r.actions),styles:Object.keys(r?.styles??{}).reduce((i,a)=>({...i,[a]:U1(r.styles[a],e,t)}),r.styles)}),zte=(e,t,r,n,i)=>{let a=(s,l)=>{let[u,c]=l.reduce((f,d,p)=>{let[h,m]=f,g=d.parentId?d.id+m:s.id,A={...d.parentId==""?s:h[p],type:h[p].type,id:g};return[h.map(v=>v.id!=d.id?sf(d.id,g,v,s.id):sf(d.id,g,A,s.id)),m+1]},[l,i]);return[u,c]},o=t!=e.id?sf(t,e.id,e,e.id):e;return a(o,n)},Ute=(e,t)=>{let r=(i,a,o)=>{let s,l=o.node;return o.children&&(s=o.children.map(u=>r(i,a,u))),{...o,children:s,node:{...o.node,parentId:l.parentId==i?a:l.parentId,props:Object.keys(l?.props??{}).reduce((u,c)=>({...u,[c]:U1(l.props[c],i,a)}),l.props),actions:Object.keys(l?.actions??{}).reduce((u,c)=>({...u,[c]:U1(l.actions[c],i,a)}),l.actions),styles:Object.keys(l?.styles??{}).reduce((u,c)=>({...u,[c]:U1(l.styles[c],i,a)}),l.styles)}}};return((i,a,o)=>{let s=(l,u,c)=>{let f=u.node.parentId?u.id+c:l.id,d={...u,node:{...u.node,id:f},id:f};if(d=r(u.id,f,d),d.children){let[p,h]=d.children.reduce((m,g,A)=>{let[b,v]=s(d,g,c+A+1);return m[0].push(b),[m[0],v]},[[],c]);d.children=p,c=h}return[d,c+1]};return s(i,a,o)})(e,e,t)};var Sp=e=>({...e,def:JSON.stringify(e.def)}),Ao=e=>e?{...e,def:or(e.def)}:null,W1=e=>({...e,rank:parseInt(e.rank),contexts:or(e.contexts),styles:or(e.styles),actions:or(e.actions),props:or(e.props),types:Wte(e.type),propsValue:Hte(e.type)}),lf=e=>{let{contexts:t,styles:r,props:n,actions:i,...a}=e;return{...a,rank:e.rank?.toString()??"0",contexts:JSON.stringify(t),styles:JSON.stringify(r),actions:JSON.stringify(i),props:JSON.stringify(n)}};var Vte=(e,t)=>{if(e.editMode==0||!e.rootId||t.node.id==e.rootId)return e;if(t.isRef)return{...e,dropMode:0,dragMode:0,resizeMode:0,selectMode:0,linkedNode:Pm(t.node.props?.value)};if(e.editMode==3)return{...e,resizeMode:1,dragMode:2,dropMode:t.editorProps.parentType=="group"?wa(t.parent.node.styles?.layout)=="row"?3:2:1};let r=t.node.parentId==e.rootId,n=t.editorProps.parentType=="column",i=t.node.type=="column",a=i&&t.editorProps.parentLastChildID!=t.id?2:1,o=r&&t.node.type!="container"||n&&!i||i&&t.children.length==0?1:2,s=e.screenType==0?2:i?3:n?2:r?1:t.editorProps.parentType=="group"?wa(t.parent.node.styles?.layout)=="column"?3:2:0;return{...e,dragMode:o,resizeMode:a,dropMode:s,linkedNode:Pm(t.node.props?.value)}};var pIe=async(e,t)=>{let r=e.spaceManager.uriByString(t);if(!r)return;if(r.authority=="$kit"){let i=e.kit.find(a=>a.def.id==r.ref);return i?nj(i):void 0}return await e.spaceManager.readFrame(r.basePath,r.ref)};function H1(e,t){let r=[],n=[];function i(a,o){let s=Mi(a.node.id,n);n.push(s),r.push({...a.node,id:s,parentId:o,schemaId:t}),(a.children??[]).forEach(l=>{i(l,s)})}return i(e,""),r}function mIe(e,t){function r(i){return{...i,children:i.node.type==="content"&&t.length>0?t.map(a=>({...a,node:{...a.node,parentId:i.id}})):i.children.map(a=>r(a))}}return r(e)}var hIe=async(e,t,r)=>{if(e.node.type=="frame"){let n=await pIe(r,e.node.ref);if(e.node.schemaId==n?.schema.id)return[e,t];if(!n||n.rows.length==0)return[e,t];let i=Kte(n.cols,e),[a,o]=zte(i.node,n.schema.id,i.node.props,n.rows.map(u=>W1(u)),t),[s,l]=await Ok(i.node,a,r,o,!0,e.editorProps);return s?[mIe({...s,parent:i.parent,isRef:!1,node:{...s.node,schemaId:i.node.schemaId,ref:i.node.ref,types:i.node.types,propsAttrs:i.node.propsAttrs,propsValue:i.node.propsValue,parentId:i.node.parentId,type:i.node.type,id:s.id}},e.children),l]:[i,l]}return[e,t]},Xte=async(e,t,r=0,n)=>{let[i,a]=await e.children.reduce(async(l,u)=>{let[c,f]=await l,d=Vte({...n,parentType:e.node.type,parentLastChildID:e.children[e.children.length-1]?.id},u),[p,h]=await Xte(u,t,f+1,d);return[[...c,p],h+1]},Promise.resolve([[],r])),[o,s]=await hIe({...e,children:i,editorProps:n},a,t);return[{...o,editorProps:Vte(o.editorProps,o)},s]},Kte=(e,t)=>{let r=e.reduce((o,s)=>({...o,[s.name]:""}),{}),n=e.reduce((o,s)=>({...o,[s.name]:s.type}),{}),i=e.reduce((o,s)=>({...o,[s.name]:s.value}),{}),a=e.reduce((o,s)=>({...o,[s.name]:s.attrs}),{});return{...t,node:{...t.node,props:{...r,...t.node.props},types:{...n,...t.node.types},propsValue:{...i,...t.node.propsValue},propsAttrs:{...a,...t.node.propsAttrs}}}},oL=(e,t,r)=>Zte.default.cloneDeep({...e,[r]:{...e[r]??{},props:{...t??{},...e[r]?.props??{}}}}),sL=e=>({schemaId:e.id,id:e.id,type:"group",rank:0,name:e.id});var rj=async(e,t,r=c0)=>t?lL(Ao(t.schema),t.cols,t.rows.map(n=>W1(n)),e,r):null,lL=async(e,t,r,n,i=c0)=>{let a=r.find(s=>s.id==e.id)??sL(e),o=await Ok(a,r,n,r.length,!1,{...i,rootId:e.id}).then(s=>s[0]);return o&&Dk(Kte(t,o))},Jte=e=>Object.keys(e.types).map(t=>({type:e.types[t],name:t,schemaId:t,value:e.propsValue?.[t],attrs:e.propsAttrs?.[t]})),Ok=async(e,t,r,n=0,i,a=c0,o)=>{let s={node:e,id:e.id,children:[],isRef:i,editorProps:a,parent:null},l={[e.id]:s};if(t.forEach(f=>{l[f.id]={id:f.id,node:f,children:[],isRef:i,editorProps:a,parent:null}}),t.forEach(f=>{if(f.parentId){l[f.id].parent=l[f.parentId];let d=l[f.parentId];d&&(d.children.push({...l[f.id],editorProps:{...a,parentType:d.node.type,parentLastChildID:d.children[d.children.length-1]?.id}}),d.children.sort((p,h)=>p.node.rank-h.node.rank))}else f.id==e.id&&(s.node=l[f.id].node)}),o)return[l[e.id],n];let[u,c]=await Xte(l[e.id],r,n,a);return[u,c]};var pc=(e,t,r=null)=>{for(let n of e.children)if(n.id===t)return e;for(let n of e.children){let i=pc(n,t,e.id);if(i)return i}return null};var iw={uniques:["id,schemaId"],cols:["id","schemaId","type","parentId","name","rank","icon","props","actions","ref","styles","contexts"]};var Wte=e=>e=="flow"?{value:"link"}:e=="container"||e=="group"||e=="content"||e=="frame"?{}:{value:e},AIe=e=>{switch(e){case"flow":return"Link";case"space":return"Context";case"text":return"Label";case"icon":return"Sticker";case"image":return"Image";default:return e}},Hte=e=>e=="container"||e=="group"||e=="content"||e=="frame"?{}:{value:JSON.stringify({alias:AIe(e)})},nj=(e,t)=>(t||(t=e.node.id),{schema:{id:t,name:e.node.name,type:"frame",def:JSON.stringify(e.def)},cols:Object.keys(e.node.types??{}).map(r=>({name:r,schemaId:t,type:e.node.types[r],value:e.node.propsValue?.[r],attrs:e.node.propsAttrs?.[r]})),rows:H1({...e,id:t,node:{...e.node,id:t}},t).map(r=>lf(sf("$root",t,r,t)))});var ij=(e,t)=>!uL.default.isEqual(tL(e,["execPropsOptions","execProps","execStyles","execActions","parent"]),tL(t,["execPropsOptions","execProps","execStyles","execActions","parent"])),ere=(e,t,r,n)=>e.filter(i=>r[n]?.props[i]&&!uL.default.isEqual(r[n].props[i],t?.[i])),Mk=e=>{if(!e)return null;if(e.startsWith("$contexts")){let{context:t,prop:r}=cL(e);return r}else return Pm(e)?.prop},cL=e=>{if(!e||Pu(e))return null;let t=[];if(e.includes(` +`)}return n},sf=(e,t,r,n)=>({...r,id:r.id==e?t:r.id,parentId:r.id==n?r.parentId:r.parentId==e?t:r.parentId,ref:r.ref==e?t:r.ref,props:Object.keys(r?.props??{}).reduce((i,a)=>({...i,[a]:U1(r.props[a],e,t)}),r.props),actions:Object.keys(r?.actions??{}).reduce((i,a)=>({...i,[a]:U1(r.actions[a],e,t)}),r.actions),styles:Object.keys(r?.styles??{}).reduce((i,a)=>({...i,[a]:U1(r.styles[a],e,t)}),r.styles)}),zte=(e,t,r,n,i)=>{let a=(s,l)=>{let[u,c]=l.reduce((f,d,p)=>{let[h,m]=f,g=d.parentId?d.id+m:s.id,A={...d.parentId==""?s:h[p],type:h[p].type,id:g};return[h.map(v=>v.id!=d.id?sf(d.id,g,v,s.id):sf(d.id,g,A,s.id)),m+1]},[l,i]);return[u,c]},o=t!=e.id?sf(t,e.id,e,e.id):e;return a(o,n)},Ute=(e,t)=>{let r=(i,a,o)=>{let s,l=o.node;return o.children&&(s=o.children.map(u=>r(i,a,u))),{...o,children:s,node:{...o.node,parentId:l.parentId==i?a:l.parentId,props:Object.keys(l?.props??{}).reduce((u,c)=>({...u,[c]:U1(l.props[c],i,a)}),l.props),actions:Object.keys(l?.actions??{}).reduce((u,c)=>({...u,[c]:U1(l.actions[c],i,a)}),l.actions),styles:Object.keys(l?.styles??{}).reduce((u,c)=>({...u,[c]:U1(l.styles[c],i,a)}),l.styles)}}};return((i,a,o)=>{let s=(l,u,c)=>{let f=u.node.parentId?u.id+c:l.id,d={...u,node:{...u.node,id:f},id:f};if(d=r(u.id,f,d),d.children){let[p,h]=d.children.reduce((m,g,A)=>{let[b,v]=s(d,g,c+A+1);return m[0].push(b),[m[0],v]},[[],c]);d.children=p,c=h}return[d,c+1]};return s(i,a,o)})(e,e,t)};var Sp=e=>({...e,def:JSON.stringify(e.def)}),Ao=e=>e?{...e,def:or(e.def)}:null,W1=e=>({...e,rank:parseInt(e.rank),contexts:or(e.contexts),styles:or(e.styles),actions:or(e.actions),props:or(e.props),types:Wte(e.type),propsValue:Hte(e.type)}),lf=e=>{let{contexts:t,styles:r,props:n,actions:i,...a}=e;return{...a,rank:e.rank?.toString()??"0",contexts:JSON.stringify(t),styles:JSON.stringify(r),actions:JSON.stringify(i),props:JSON.stringify(n)}};var Vte=(e,t)=>{if(e.editMode==0||!e.rootId||t.node.id==e.rootId)return e;if(t.isRef)return{...e,dropMode:0,dragMode:0,resizeMode:0,selectMode:0,linkedNode:Im(t.node.props?.value)};if(e.editMode==3)return{...e,resizeMode:1,dragMode:2,dropMode:t.editorProps.parentType=="group"?wa(t.parent.node.styles?.layout)=="row"?3:2:1};let r=t.node.parentId==e.rootId,n=t.editorProps.parentType=="column",i=t.node.type=="column",a=i&&t.editorProps.parentLastChildID!=t.id?2:1,o=r&&t.node.type!="container"||n&&!i||i&&t.children.length==0?1:2,s=e.screenType==0?2:i?3:n?2:r?1:t.editorProps.parentType=="group"?wa(t.parent.node.styles?.layout)=="column"?3:2:0;return{...e,dragMode:o,resizeMode:a,dropMode:s,linkedNode:Im(t.node.props?.value)}};var pIe=async(e,t)=>{let r=e.spaceManager.uriByString(t);if(!r)return;if(r.authority=="$kit"){let i=e.kit.find(a=>a.def.id==r.ref);return i?nj(i):void 0}return await e.spaceManager.readFrame(r.basePath,r.ref)};function H1(e,t){let r=[],n=[];function i(a,o){let s=Mi(a.node.id,n);n.push(s),r.push({...a.node,id:s,parentId:o,schemaId:t}),(a.children??[]).forEach(l=>{i(l,s)})}return i(e,""),r}function mIe(e,t){function r(i){return{...i,children:i.node.type==="content"&&t.length>0?t.map(a=>({...a,node:{...a.node,parentId:i.id}})):i.children.map(a=>r(a))}}return r(e)}var hIe=async(e,t,r)=>{if(e.node.type=="frame"){let n=await pIe(r,e.node.ref);if(e.node.schemaId==n?.schema.id)return[e,t];if(!n||n.rows.length==0)return[e,t];let i=Kte(n.cols,e),[a,o]=zte(i.node,n.schema.id,i.node.props,n.rows.map(u=>W1(u)),t),[s,l]=await Ok(i.node,a,r,o,!0,e.editorProps);return s?[mIe({...s,parent:i.parent,isRef:!1,node:{...s.node,schemaId:i.node.schemaId,ref:i.node.ref,types:i.node.types,propsAttrs:i.node.propsAttrs,propsValue:i.node.propsValue,parentId:i.node.parentId,type:i.node.type,id:s.id}},e.children),l]:[i,l]}return[e,t]},Xte=async(e,t,r=0,n)=>{let[i,a]=await e.children.reduce(async(l,u)=>{let[c,f]=await l,d=Vte({...n,parentType:e.node.type,parentLastChildID:e.children[e.children.length-1]?.id},u),[p,h]=await Xte(u,t,f+1,d);return[[...c,p],h+1]},Promise.resolve([[],r])),[o,s]=await hIe({...e,children:i,editorProps:n},a,t);return[{...o,editorProps:Vte(o.editorProps,o)},s]},Kte=(e,t)=>{let r=e.reduce((o,s)=>({...o,[s.name]:""}),{}),n=e.reduce((o,s)=>({...o,[s.name]:s.type}),{}),i=e.reduce((o,s)=>({...o,[s.name]:s.value}),{}),a=e.reduce((o,s)=>({...o,[s.name]:s.attrs}),{});return{...t,node:{...t.node,props:{...r,...t.node.props},types:{...n,...t.node.types},propsValue:{...i,...t.node.propsValue},propsAttrs:{...a,...t.node.propsAttrs}}}},oL=(e,t,r)=>Zte.default.cloneDeep({...e,[r]:{...e[r]??{},props:{...t??{},...e[r]?.props??{}}}}),sL=e=>({schemaId:e.id,id:e.id,type:"group",rank:0,name:e.id});var rj=async(e,t,r=c0)=>t?lL(Ao(t.schema),t.cols,t.rows.map(n=>W1(n)),e,r):null,lL=async(e,t,r,n,i=c0)=>{let a=r.find(s=>s.id==e.id)??sL(e),o=await Ok(a,r,n,r.length,!1,{...i,rootId:e.id}).then(s=>s[0]);return o&&Dk(Kte(t,o))},Jte=e=>Object.keys(e.types).map(t=>({type:e.types[t],name:t,schemaId:t,value:e.propsValue?.[t],attrs:e.propsAttrs?.[t]})),Ok=async(e,t,r,n=0,i,a=c0,o)=>{let s={node:e,id:e.id,children:[],isRef:i,editorProps:a,parent:null},l={[e.id]:s};if(t.forEach(f=>{l[f.id]={id:f.id,node:f,children:[],isRef:i,editorProps:a,parent:null}}),t.forEach(f=>{if(f.parentId){l[f.id].parent=l[f.parentId];let d=l[f.parentId];d&&(d.children.push({...l[f.id],editorProps:{...a,parentType:d.node.type,parentLastChildID:d.children[d.children.length-1]?.id}}),d.children.sort((p,h)=>p.node.rank-h.node.rank))}else f.id==e.id&&(s.node=l[f.id].node)}),o)return[l[e.id],n];let[u,c]=await Xte(l[e.id],r,n,a);return[u,c]};var pc=(e,t,r=null)=>{for(let n of e.children)if(n.id===t)return e;for(let n of e.children){let i=pc(n,t,e.id);if(i)return i}return null};var iw={uniques:["id,schemaId"],cols:["id","schemaId","type","parentId","name","rank","icon","props","actions","ref","styles","contexts"]};var Wte=e=>e=="flow"?{value:"link"}:e=="container"||e=="group"||e=="content"||e=="frame"?{}:{value:e},AIe=e=>{switch(e){case"flow":return"Link";case"space":return"Context";case"text":return"Label";case"icon":return"Sticker";case"image":return"Image";default:return e}},Hte=e=>e=="container"||e=="group"||e=="content"||e=="frame"?{}:{value:JSON.stringify({alias:AIe(e)})},nj=(e,t)=>(t||(t=e.node.id),{schema:{id:t,name:e.node.name,type:"frame",def:JSON.stringify(e.def)},cols:Object.keys(e.node.types??{}).map(r=>({name:r,schemaId:t,type:e.node.types[r],value:e.node.propsValue?.[r],attrs:e.node.propsAttrs?.[r]})),rows:H1({...e,id:t,node:{...e.node,id:t}},t).map(r=>lf(sf("$root",t,r,t)))});var ij=(e,t)=>!uL.default.isEqual(tL(e,["execPropsOptions","execProps","execStyles","execActions","parent"]),tL(t,["execPropsOptions","execProps","execStyles","execActions","parent"])),ere=(e,t,r,n)=>e.filter(i=>r[n]?.props[i]&&!uL.default.isEqual(r[n].props[i],t?.[i])),Mk=e=>{if(!e)return null;if(e.startsWith("$contexts")){let{context:t,prop:r}=cL(e);return r}else return Im(e)?.prop},cL=e=>{if(!e||Pu(e))return null;let t=[];if(e.includes(` `)){let n=e.split(` `).filter(i=>i.trim()!=="");n[n.length-1]=`${n[n.length-1].replace("return ","")}`,e=n.join(` -`)}try{let n=q1(e,{ecmaVersion:2020});Jq(n,{MemberExpression(i){i.object.type==="Identifier"&&!t.includes(i.object.name)&&t.push(i.object.name),i.computed?t.push(i.property.value):t.push(i.property.name)}})}catch(n){console.log(n)}return t.length<3?null:{context:t[1],prop:t[2]}},Pm=e=>{if(!e||Pu(e))return null;let t=[];if(e.includes(` +`)}try{let n=q1(e,{ecmaVersion:2020});Jq(n,{MemberExpression(i){i.object.type==="Identifier"&&!t.includes(i.object.name)&&t.push(i.object.name),i.computed?t.push(i.property.value):t.push(i.property.name)}})}catch(n){console.log(n)}return t.length<3?null:{context:t[1],prop:t[2]}},Im=e=>{if(!e||Pu(e))return null;let t=[];if(e.includes(` `)){let n=e.split(` `).filter(i=>i.trim()!=="");n[n.length-1]=`${n[n.length-1].replace("return ","")}`,e=n.join(` -`)}try{let n=q1(e,{ecmaVersion:2020});Jq(n,{MemberExpression(i){i.object.type==="Identifier"&&!t.includes(i.object.name)&&t.push(i.object.name),i.computed?t.push(i.property.value):t.push(i.property.name)}})}catch(n){console.log(n)}return t.length<3?null:{node:t[0],prop:t[2]}},gIe=async(e,t,r,n)=>{if(!t)return;let i=H1(n,t.schema.id),a={...t,cols:t.cols??[],rows:[...i].map(o=>lf(sf("$root",t.schema.id,o,t.schema.id)))};await e.spaceManager.saveFrame(r.path,a)},tre=async(e,t,r,n)=>e.spaceManager.readFrame(t.path,r).then(i=>gIe(e,i,t,n)),jk=(e,t)=>Object.keys(e).reduce((r,n)=>({...r,[n]:{uniques:iw.uniques,cols:iw.cols,rows:e[n].rows}}),{m_fields:{uniques:sa.uniques,cols:sa.cols,rows:Object.values(e).flatMap(r=>r.cols)}});var Xa={def:{id:"icon",icon:"ui//gem"},node:{icon:"ui//gem",schemaId:"icon",parentId:"",name:H.properties.icon.label,rank:0,id:"icon",type:"icon",props:{value:""},types:{value:"icon"},styles:{"--icon-size":"'100%'",width:"'36px'",height:"'36px'"}}},f0={def:{id:"space",icon:"ui//layout-grid",description:H.frames.context.description},node:{icon:"ui//layout-grid",schemaId:"space",parentId:"",name:H.frames.context.label,rank:0,id:"space",styles:{width:"'100%'"},type:"space",props:{value:""},types:{value:"view"}}},uf={def:{id:"image",icon:"ui//image"},node:{icon:"ui//image",schemaId:"image",parentId:"",name:H.properties.image.label,rank:0,id:"image",type:"image",props:{value:""},types:{value:"image"}}},omt={def:{id:"text",icon:"ui//audio"},node:{icon:"ui//audio",schemaId:"audio",parentId:"",name:H.properties.audio.label,rank:0,id:"audio",type:"audio",props:{value:""},types:{value:"audio"}}},mn={def:{id:"text",icon:"ui//type",description:H.frames.label.description},node:{icon:"ui//type",schemaId:"text",parentId:"",name:H.frames.label.label,rank:0,id:"text",type:"text",props:{value:""},types:{value:"text"},styles:{width:"'100%'"}}},V1={def:{icon:""},node:{schemaId:"input",parentId:"",name:"input",rank:0,id:"input",styles:{as:'"text"'},type:"input",props:{value:""},types:{value:"text"},actions:{onChange:"$api.properties.update(input.props.value, $value, $contexts.$context['_keyValue'], $saveState)"}}},Mo={def:{id:"flow",icon:"ui//file-text"},node:{icon:"ui//file-text",schemaId:"flow",parentId:"",name:H.commands.flow,rank:0,id:"flow",type:"flow",props:{value:""},styles:{width:"'100%'",padding:"'8px'"},types:{value:"link"}}},smt={def:{id:"newNode",icon:"ui//lightbulb"},node:{id:"node",schemaId:"node",name:H.commands.idea,rank:0,parentId:"",type:"new"}},hn={def:{id:"groupNode",icon:"ui//box-select",description:"Groups allow you to customize your layout"},node:{id:"group",schemaId:"group",name:H.commands.group,rank:0,parentId:"",styles:{layout:'"column"',width:"'100%'",height:"'100px'"},type:"group"}},lmt={def:{id:"spacerNode",icon:"ui//unfold-horizontal"},node:{id:"group",schemaId:"group",name:H.commands.group,rank:0,parentId:"",styles:{flex:"'1'"},type:"group"}},rre={def:{id:"columnsNode",icon:"ui//columns"},node:{id:"container",schemaId:"container",name:H.commands.columns,rank:0,parentId:"",styles:{layout:'"row"',width:"'100%'",gap:"'24px'"},type:"container"}},aj={def:{id:"columnNode",icon:"ui//columns"},node:{icon:"ui//columns",id:"column",schemaId:"column",name:H.commands.column,rank:0,parentId:"",styles:{layout:'"column"',layoutAlign:"'left'",flex:"1",gap:"'8px'",width:"0"},type:"column"}},mc={def:{id:"content",icon:"ui//type"},node:{icon:"ui//type",schemaId:"content",parentId:"",name:"Content",rank:0,id:"content",type:"content"}};var vIe=[{...hn.node,id:"main",type:"group",rank:0,schemaId:"main",props:{note:"",space:""},types:{note:"link",space:"space"},propsValue:{note:JSON.stringify({alias:H.defaults.spaceNote}),space:JSON.stringify({alias:H.defaults.spaceContext})},styles:{layout:'"column"'}},{...f0.node,id:"context",rank:1,props:{value:"$contexts.$space.space"},styles:{width:'"100%"'},parentId:"main",schemaId:"main"}],yIe=[{...hn.node,id:"main",type:"group",rank:0,schemaId:"main",props:{note:"",space:""},types:{note:"link",space:"space"},propsValue:{note:JSON.stringify({alias:H.defaults.spaceNote}),space:JSON.stringify({alias:H.defaults.spaceContext})},styles:{layout:'"column"'}},{...Mo.node,rank:0,props:{value:"$contexts.$space.note"},styles:{width:'"100%"',"--mk-min-mode":"true","--mk-expanded":"true",padding:'"0px"'},parentId:"main",schemaId:"main"},{...f0.node,id:"context",rank:1,props:{value:"$contexts.$space.space"},styles:{width:'"100%"'},parentId:"main",schemaId:"main"}],nre={[r0]:{schema:{id:r0,name:"All",type:"view",def:JSON.stringify({db:Er,icon:"ui//file-stack"}),predicate:JSON.stringify({listView:"spaces://$kit/#*listView",listGroup:"spaces://$kit/#*listGroup",listItem:"spaces://$kit/#*overviewItem",view:"list"})},cols:sd.rows,rows:[]}},oj={main:{schema:MM(j1),cols:[],rows:yIe.map(e=>lf(e))},[r0]:{schema:bp,cols:sd.rows,rows:[]}},aw={main:{schema:MM(j1),cols:[],rows:vIe.map(e=>lf(e))},[r0]:{schema:bp,cols:sd.rows,rows:[]}},ire=[{name:"space",type:"space",schemaId:"main",value:JSON.stringify({alias:H.defaults.spaceContext})},{name:"note",type:"link",schemaId:"main",value:JSON.stringify({alias:H.defaults.spaceNote})}];var d0=e=>[e.fmKeyBanner,e.fmKeySticker,e.fmKeyColor,e.fmKeyBanner,e.fmKeyBannerOffset,Nk,_k,Pk,Ik,Tk,Fk];var ymt={name:H.menu.vault,readOnly:!1,path:"/",label:{thumbnail:"",name:H.menu.vault,sticker:"ui//vault",color:""},type:"default"},Im={tags:{name:"Tags",icon:"ui//tags",readOnly:!1,hidden:!1},overview:{name:"Overview",icon:"ui//overview",readOnly:!0,hidden:!0}},Nk="_contexts",Tk="_template",Fk="_templateName",_k="_filters",Pk="_links",Ik="_sort",sj="_subfolders";var p0=(e,t,r)=>{let n=Wn(t.toLowerCase()),i=e.superstate.settings.spacesFolder+"/"+KJ(t);return{name:t,path:n,isRemote:!1,readOnly:r,folderPath:i,defPath:`${i}/${e.superstate.settings.spaceSubFolder}/def.json`,notePath:`${i}/${KE(t)}.md`,framePath:nf(i+"/",e)+"views.mdb",dbPath:nf(i+"/",e)+"context.mdb",commandsPath:nf(i+"/",e)+"commands.mdb"}},are=(e,t)=>{if(!t)return;if(t.startsWith(Zg)){let i=t.slice(Zg.length),a=e.superstate.settings.spacesFolder+"/$"+i;return{name:Im[i].name,path:t,isRemote:!1,readOnly:!1,folderPath:a,defPath:`${a}/${e.superstate.settings.spaceSubFolder}/def.json`,notePath:`${a}/${Im[i].name}.md`,framePath:nf(a+"/",e)+"views.mdb",dbPath:nf(a+"/",e)+"context.mdb",commandsPath:nf(a+"/",e)+"commands.mdb"}}let r=e.uriByString(t);if(!r)return null;let n=e.spaceTypeByString(r);return n=="folder"?Bk(e,Tu(r.path)):n=="tag"?r.path.length>1?p0(e,r.authority+"/"+r.path):p0(e,r.authority):n=="vault"?Bk(e,"/"):null},Bk=(e,t,r)=>{if(t=="/"){let a="Vault";return{name:a,path:t,isRemote:!1,readOnly:r,folderPath:t,defPath:`${e.superstate.settings.spaceSubFolder}/def.json`,notePath:a+".md",dbPath:nf(t,e)+"context.mdb",framePath:nf(t,e)+"views.mdb",commandsPath:nf(t,e)+"commands.mdb"}}let n=i0(t),i=e.superstate.settings.folderNoteName;return{name:n,path:t,isRemote:!1,readOnly:r,folderPath:t,defPath:t+`/${e.superstate.settings.spaceSubFolder}/def.json`,notePath:t+"/"+(i.length>0?i:n)+".md",dbPath:nf(t+"/",e)+"context.mdb",framePath:nf(t+"/",e)+"views.mdb",commandsPath:nf(t+"/",e)+"commands.mdb"}};var ore=(e,t)=>sr(t).some(r=>e==$x(r)),bIe=(e,t,r)=>Bi(sr(r).map(n=>$x(n)==e?t:e)),xIe=(e,t)=>Bi(sr(t).filter(r=>r!=e)),fL=e=>e.filter(t=>t.type.startsWith("link")||t.type.startsWith("context")),sre=(e,t,r,n)=>{if(n.length==0)return t;let i=n.reduce((a,o)=>{if(ore(r,t[o.name])){let s=xIe(r,t[o.name]);return e.saveProperties(t[mt],{[o.name]:la(o.type,s,!0)}),{...a,[o.name]:s}}return a},{});return{...t,...i}},lre=(e,t,r,n,i)=>{if(i.length==0)return t;let a=i.reduce((o,s)=>{if(ore(r,t[s.name])){let l=bIe(r,n,t[s.name]);return e.saveProperties(t[mt],{[s.name]:la(s.type,l,!0)}),{...o,[s.name]:l}}return o},{});return{...t,...a}};var ure=(e,t,r)=>({...e,rows:e.rows.map(n=>n[mt]==t?{...n,[mt]:r}:n)}),cre=(e,t)=>({...e,rows:e.rows.filter(r=>r[mt]!=t)});var dL=(e,t,r)=>{let n=e.rows.filter(i=>t.includes(i[mt]));return{...e,rows:Dx(e.rows.filter(i=>!t.includes(i[mt])),r,n)}};var xc=Ae(yi());var To=Ae(Te());var nt=Ae(Te()),I0=Ae(bl());var No=Ae(Te());function Wae(){for(var e=arguments.length,t=new Array(e),r=0;rn=>{t.forEach(i=>i(n))},t)}var j6=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function ly(e){let t=Object.prototype.toString.call(e);return t==="[object Window]"||t==="[object global]"}function jN(e){return"nodeType"in e}function nu(e){var t,r;return e?ly(e)?e:jN(e)&&(t=(r=e.ownerDocument)==null?void 0:r.defaultView)!=null?t:window:window}function NN(e){let{Document:t}=nu(e);return e instanceof t}function Iw(e){return ly(e)?!1:e instanceof nu(e).HTMLElement}function TU(e){return e instanceof nu(e).SVGElement}function uy(e){return e?ly(e)?e.document:jN(e)?NN(e)?e:Iw(e)||TU(e)?e.ownerDocument:document:document:document}var bc=j6?No.useLayoutEffect:No.useEffect;function N6(e){let t=(0,No.useRef)(e);return bc(()=>{t.current=e}),(0,No.useCallback)(function(){for(var r=arguments.length,n=new Array(r),i=0;i{e.current=setInterval(n,i)},[]),r=(0,No.useCallback)(()=>{e.current!==null&&(clearInterval(e.current),e.current=null)},[]);return[t,r]}function Bw(e,t){t===void 0&&(t=[e]);let r=(0,No.useRef)(e);return bc(()=>{r.current!==e&&(r.current=e)},t),r}function Rw(e,t){let r=(0,No.useRef)();return(0,No.useMemo)(()=>{let n=e(r.current);return r.current=n,n},[...t])}function T6(e){let t=N6(e),r=(0,No.useRef)(null),n=(0,No.useCallback)(i=>{i!==r.current&&t?.(i,r.current),r.current=i},[]);return[r,n]}function F6(e){let t=(0,No.useRef)();return(0,No.useEffect)(()=>{t.current=e},[e]),t.current}var NU={};function cy(e,t){return(0,No.useMemo)(()=>{if(t)return t;let r=NU[e]==null?0:NU[e]+1;return NU[e]=r,e+"-"+r},[e,t])}function Vae(e){return function(t){for(var r=arguments.length,n=new Array(r>1?r-1:0),i=1;i{let s=Object.entries(o);for(let[l,u]of s){let c=a[l];c!=null&&(a[l]=c+e*u)}return a},{...t})}}var fy=Vae(1),dy=Vae(-1);function R5e(e){return"clientX"in e&&"clientY"in e}function $w(e){if(!e)return!1;let{KeyboardEvent:t}=nu(e.target);return t&&e instanceof t}function $5e(e){if(!e)return!1;let{TouchEvent:t}=nu(e.target);return t&&e instanceof t}function _6(e){if($5e(e)){if(e.touches&&e.touches.length){let{clientX:t,clientY:r}=e.touches[0];return{x:t,y:r}}else if(e.changedTouches&&e.changedTouches.length){let{clientX:t,clientY:r}=e.changedTouches[0];return{x:t,y:r}}}return R5e(e)?{x:e.clientX,y:e.clientY}:null}var Lu=Object.freeze({Translate:{toString(e){if(!e)return;let{x:t,y:r}=e;return"translate3d("+(t?Math.round(t):0)+"px, "+(r?Math.round(r):0)+"px, 0)"}},Scale:{toString(e){if(!e)return;let{scaleX:t,scaleY:r}=e;return"scaleX("+t+") scaleY("+r+")"}},Transform:{toString(e){if(!!e)return[Lu.Translate.toString(e),Lu.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:r,easing:n}=e;return t+" "+r+"ms "+n}}}),Uae="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function Gae(e){return e.matches(Uae)?e:e.querySelector(Uae)}var py=Ae(Te()),q5e={display:"none"};function Qae(e){let{id:t,value:r}=e;return py.default.createElement("div",{id:t,style:q5e},r)}function Yae(e){let{id:t,announcement:r,ariaLiveType:n="assertive"}=e,i={position:"fixed",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(100%)",whiteSpace:"nowrap"};return py.default.createElement("div",{id:t,style:i,role:"status","aria-live":n,"aria-atomic":!0},r)}function Zae(){let[e,t]=(0,py.useState)("");return{announce:(0,py.useCallback)(n=>{n!=null&&t(n)},[]),announcement:e}}var uoe=(0,nt.createContext)(null);function Ca(e){let t=(0,nt.useContext)(uoe);(0,nt.useEffect)(()=>{if(!t)throw new Error("useDndMonitor must be used within a children of ");return t(e)},[e,t])}function L5e(){let[e]=(0,nt.useState)(()=>new Set),t=(0,nt.useCallback)(n=>(e.add(n),()=>e.delete(n)),[e]);return[(0,nt.useCallback)(n=>{let{type:i,event:a}=n;e.forEach(o=>{var s;return(s=o[i])==null?void 0:s.call(o,a)})},[e]),t]}var z5e={draggable:` +`)}try{let n=q1(e,{ecmaVersion:2020});Jq(n,{MemberExpression(i){i.object.type==="Identifier"&&!t.includes(i.object.name)&&t.push(i.object.name),i.computed?t.push(i.property.value):t.push(i.property.name)}})}catch(n){console.log(n)}return t.length<3?null:{node:t[0],prop:t[2]}},gIe=async(e,t,r,n)=>{if(!t)return;let i=H1(n,t.schema.id),a={...t,cols:t.cols??[],rows:[...i].map(o=>lf(sf("$root",t.schema.id,o,t.schema.id)))};await e.spaceManager.saveFrame(r.path,a)},tre=async(e,t,r,n)=>e.spaceManager.readFrame(t.path,r).then(i=>gIe(e,i,t,n)),jk=(e,t)=>Object.keys(e).reduce((r,n)=>({...r,[n]:{uniques:iw.uniques,cols:iw.cols,rows:e[n].rows}}),{m_fields:{uniques:sa.uniques,cols:sa.cols,rows:Object.values(e).flatMap(r=>r.cols)}});var Xa={def:{id:"icon",icon:"ui//gem"},node:{icon:"ui//gem",schemaId:"icon",parentId:"",name:H.properties.icon.label,rank:0,id:"icon",type:"icon",props:{value:""},types:{value:"icon"},styles:{"--icon-size":"'100%'",width:"'36px'",height:"'36px'"}}},f0={def:{id:"space",icon:"ui//layout-grid",description:H.frames.context.description},node:{icon:"ui//layout-grid",schemaId:"space",parentId:"",name:H.frames.context.label,rank:0,id:"space",styles:{width:"'100%'"},type:"space",props:{value:""},types:{value:"view"}}},uf={def:{id:"image",icon:"ui//image"},node:{icon:"ui//image",schemaId:"image",parentId:"",name:H.properties.image.label,rank:0,id:"image",type:"image",props:{value:""},types:{value:"image"}}},omt={def:{id:"text",icon:"ui//audio"},node:{icon:"ui//audio",schemaId:"audio",parentId:"",name:H.properties.audio.label,rank:0,id:"audio",type:"audio",props:{value:""},types:{value:"audio"}}},mn={def:{id:"text",icon:"ui//type",description:H.frames.label.description},node:{icon:"ui//type",schemaId:"text",parentId:"",name:H.frames.label.label,rank:0,id:"text",type:"text",props:{value:""},types:{value:"text"},styles:{width:"'100%'"}}},V1={def:{icon:""},node:{schemaId:"input",parentId:"",name:"input",rank:0,id:"input",styles:{as:'"text"'},type:"input",props:{value:""},types:{value:"text"},actions:{onChange:"$api.properties.update(input.props.value, $value, $contexts.$context['_keyValue'], $saveState)"}}},Mo={def:{id:"flow",icon:"ui//file-text"},node:{icon:"ui//file-text",schemaId:"flow",parentId:"",name:H.commands.flow,rank:0,id:"flow",type:"flow",props:{value:""},styles:{width:"'100%'",padding:"'8px'"},types:{value:"link"}}},smt={def:{id:"newNode",icon:"ui//lightbulb"},node:{id:"node",schemaId:"node",name:H.commands.idea,rank:0,parentId:"",type:"new"}},hn={def:{id:"groupNode",icon:"ui//box-select",description:"Groups allow you to customize your layout"},node:{id:"group",schemaId:"group",name:H.commands.group,rank:0,parentId:"",styles:{layout:'"column"',width:"'100%'",height:"'100px'"},type:"group"}},lmt={def:{id:"spacerNode",icon:"ui//unfold-horizontal"},node:{id:"group",schemaId:"group",name:H.commands.group,rank:0,parentId:"",styles:{flex:"'1'"},type:"group"}},rre={def:{id:"columnsNode",icon:"ui//columns"},node:{id:"container",schemaId:"container",name:H.commands.columns,rank:0,parentId:"",styles:{layout:'"row"',width:"'100%'",gap:"'24px'"},type:"container"}},aj={def:{id:"columnNode",icon:"ui//columns"},node:{icon:"ui//columns",id:"column",schemaId:"column",name:H.commands.column,rank:0,parentId:"",styles:{layout:'"column"',layoutAlign:"'left'",flex:"1",gap:"'8px'",width:"0"},type:"column"}},mc={def:{id:"content",icon:"ui//type"},node:{icon:"ui//type",schemaId:"content",parentId:"",name:"Content",rank:0,id:"content",type:"content"}};var vIe=[{...hn.node,id:"main",type:"group",rank:0,schemaId:"main",props:{note:"",space:""},types:{note:"link",space:"space"},propsValue:{note:JSON.stringify({alias:H.defaults.spaceNote}),space:JSON.stringify({alias:H.defaults.spaceContext})},styles:{layout:'"column"'}},{...f0.node,id:"context",rank:1,props:{value:"$contexts.$space.space"},styles:{width:'"100%"'},parentId:"main",schemaId:"main"}],yIe=[{...hn.node,id:"main",type:"group",rank:0,schemaId:"main",props:{note:"",space:""},types:{note:"link",space:"space"},propsValue:{note:JSON.stringify({alias:H.defaults.spaceNote}),space:JSON.stringify({alias:H.defaults.spaceContext})},styles:{layout:'"column"'}},{...Mo.node,rank:0,props:{value:"$contexts.$space.note"},styles:{width:'"100%"',"--mk-min-mode":"true","--mk-expanded":"true",padding:'"0px"'},parentId:"main",schemaId:"main"},{...f0.node,id:"context",rank:1,props:{value:"$contexts.$space.space"},styles:{width:'"100%"'},parentId:"main",schemaId:"main"}],nre={[r0]:{schema:{id:r0,name:"All",type:"view",def:JSON.stringify({db:Er,icon:"ui//file-stack"}),predicate:JSON.stringify({listView:"spaces://$kit/#*listView",listGroup:"spaces://$kit/#*listGroup",listItem:"spaces://$kit/#*overviewItem",view:"list"})},cols:sd.rows,rows:[]}},oj={main:{schema:MM(j1),cols:[],rows:yIe.map(e=>lf(e))},[r0]:{schema:bp,cols:sd.rows,rows:[]}},aw={main:{schema:MM(j1),cols:[],rows:vIe.map(e=>lf(e))},[r0]:{schema:bp,cols:sd.rows,rows:[]}},ire=[{name:"space",type:"space",schemaId:"main",value:JSON.stringify({alias:H.defaults.spaceContext})},{name:"note",type:"link",schemaId:"main",value:JSON.stringify({alias:H.defaults.spaceNote})}];var d0=e=>[e.fmKeyBanner,e.fmKeySticker,e.fmKeyColor,e.fmKeyBanner,e.fmKeyBannerOffset,Nk,_k,Pk,Ik,Tk,Fk];var ymt={name:H.menu.vault,readOnly:!1,path:"/",label:{thumbnail:"",name:H.menu.vault,sticker:"ui//vault",color:""},type:"default"},Ep={tags:{name:"Tags",icon:"ui//tags",readOnly:!1,hidden:!1},overview:{name:"Overview",icon:"ui//overview",readOnly:!0,hidden:!0}},Nk="_contexts",Tk="_template",Fk="_templateName",_k="_filters",Pk="_links",Ik="_sort",sj="_subfolders";var p0=(e,t,r)=>{let n=Wn(t.toLowerCase()),i=e.superstate.settings.spacesFolder+"/"+KJ(t);return{name:t,path:n,isRemote:!1,readOnly:r,folderPath:i,defPath:`${i}/${e.superstate.settings.spaceSubFolder}/def.json`,notePath:`${i}/${KE(t)}.md`,framePath:nf(i+"/",e)+"views.mdb",dbPath:nf(i+"/",e)+"context.mdb",commandsPath:nf(i+"/",e)+"commands.mdb"}},are=(e,t)=>{if(!t)return;if(t.startsWith(Zg)){let i=t.slice(Zg.length),a=e.superstate.settings.spacesFolder+"/$"+i;return{name:Ep[i].name,path:t,isRemote:!1,readOnly:!1,folderPath:a,defPath:`${a}/${e.superstate.settings.spaceSubFolder}/def.json`,notePath:`${a}/${Ep[i].name}.md`,framePath:nf(a+"/",e)+"views.mdb",dbPath:nf(a+"/",e)+"context.mdb",commandsPath:nf(a+"/",e)+"commands.mdb"}}let r=e.uriByString(t);if(!r)return null;let n=e.spaceTypeByString(r);return n=="folder"?Bk(e,Tu(r.path)):n=="tag"?r.path.length>1?p0(e,r.authority+"/"+r.path):p0(e,r.authority):n=="vault"?Bk(e,"/"):null},Bk=(e,t,r)=>{if(t=="/"){let a="Vault";return{name:a,path:t,isRemote:!1,readOnly:r,folderPath:t,defPath:`${e.superstate.settings.spaceSubFolder}/def.json`,notePath:a+".md",dbPath:nf(t,e)+"context.mdb",framePath:nf(t,e)+"views.mdb",commandsPath:nf(t,e)+"commands.mdb"}}let n=i0(t),i=e.superstate.settings.folderNoteName;return{name:n,path:t,isRemote:!1,readOnly:r,folderPath:t,defPath:t+`/${e.superstate.settings.spaceSubFolder}/def.json`,notePath:t+"/"+(i.length>0?i:n)+".md",dbPath:nf(t+"/",e)+"context.mdb",framePath:nf(t+"/",e)+"views.mdb",commandsPath:nf(t+"/",e)+"commands.mdb"}};var ore=(e,t)=>sr(t).some(r=>e==$x(r)),bIe=(e,t,r)=>Bi(sr(r).map(n=>$x(n)==e?t:e)),xIe=(e,t)=>Bi(sr(t).filter(r=>r!=e)),fL=e=>e.filter(t=>t.type.startsWith("link")||t.type.startsWith("context")),sre=(e,t,r,n)=>{if(n.length==0)return t;let i=n.reduce((a,o)=>{if(ore(r,t[o.name])){let s=xIe(r,t[o.name]);return e.saveProperties(t[mt],{[o.name]:la(o.type,s,!0)}),{...a,[o.name]:s}}return a},{});return{...t,...i}},lre=(e,t,r,n,i)=>{if(i.length==0)return t;let a=i.reduce((o,s)=>{if(ore(r,t[s.name])){let l=bIe(r,n,t[s.name]);return e.saveProperties(t[mt],{[s.name]:la(s.type,l,!0)}),{...o,[s.name]:l}}return o},{});return{...t,...a}};var ure=(e,t,r)=>({...e,rows:e.rows.map(n=>n[mt]==t?{...n,[mt]:r}:n)}),cre=(e,t)=>({...e,rows:e.rows.filter(r=>r[mt]!=t)});var dL=(e,t,r)=>{let n=e.rows.filter(i=>t.includes(i[mt]));return{...e,rows:Dx(e.rows.filter(i=>!t.includes(i[mt])),r,n)}};var xc=Ae(yi());var To=Ae(Te());var nt=Ae(Te()),I0=Ae(bl());var No=Ae(Te());function Wae(){for(var e=arguments.length,t=new Array(e),r=0;rn=>{t.forEach(i=>i(n))},t)}var j6=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function ly(e){let t=Object.prototype.toString.call(e);return t==="[object Window]"||t==="[object global]"}function jN(e){return"nodeType"in e}function nu(e){var t,r;return e?ly(e)?e:jN(e)&&(t=(r=e.ownerDocument)==null?void 0:r.defaultView)!=null?t:window:window}function NN(e){let{Document:t}=nu(e);return e instanceof t}function Iw(e){return ly(e)?!1:e instanceof nu(e).HTMLElement}function TU(e){return e instanceof nu(e).SVGElement}function uy(e){return e?ly(e)?e.document:jN(e)?NN(e)?e:Iw(e)||TU(e)?e.ownerDocument:document:document:document}var bc=j6?No.useLayoutEffect:No.useEffect;function N6(e){let t=(0,No.useRef)(e);return bc(()=>{t.current=e}),(0,No.useCallback)(function(){for(var r=arguments.length,n=new Array(r),i=0;i{e.current=setInterval(n,i)},[]),r=(0,No.useCallback)(()=>{e.current!==null&&(clearInterval(e.current),e.current=null)},[]);return[t,r]}function Bw(e,t){t===void 0&&(t=[e]);let r=(0,No.useRef)(e);return bc(()=>{r.current!==e&&(r.current=e)},t),r}function Rw(e,t){let r=(0,No.useRef)();return(0,No.useMemo)(()=>{let n=e(r.current);return r.current=n,n},[...t])}function T6(e){let t=N6(e),r=(0,No.useRef)(null),n=(0,No.useCallback)(i=>{i!==r.current&&t?.(i,r.current),r.current=i},[]);return[r,n]}function F6(e){let t=(0,No.useRef)();return(0,No.useEffect)(()=>{t.current=e},[e]),t.current}var NU={};function cy(e,t){return(0,No.useMemo)(()=>{if(t)return t;let r=NU[e]==null?0:NU[e]+1;return NU[e]=r,e+"-"+r},[e,t])}function Vae(e){return function(t){for(var r=arguments.length,n=new Array(r>1?r-1:0),i=1;i{let s=Object.entries(o);for(let[l,u]of s){let c=a[l];c!=null&&(a[l]=c+e*u)}return a},{...t})}}var fy=Vae(1),dy=Vae(-1);function R5e(e){return"clientX"in e&&"clientY"in e}function $w(e){if(!e)return!1;let{KeyboardEvent:t}=nu(e.target);return t&&e instanceof t}function $5e(e){if(!e)return!1;let{TouchEvent:t}=nu(e.target);return t&&e instanceof t}function _6(e){if($5e(e)){if(e.touches&&e.touches.length){let{clientX:t,clientY:r}=e.touches[0];return{x:t,y:r}}else if(e.changedTouches&&e.changedTouches.length){let{clientX:t,clientY:r}=e.changedTouches[0];return{x:t,y:r}}}return R5e(e)?{x:e.clientX,y:e.clientY}:null}var Lu=Object.freeze({Translate:{toString(e){if(!e)return;let{x:t,y:r}=e;return"translate3d("+(t?Math.round(t):0)+"px, "+(r?Math.round(r):0)+"px, 0)"}},Scale:{toString(e){if(!e)return;let{scaleX:t,scaleY:r}=e;return"scaleX("+t+") scaleY("+r+")"}},Transform:{toString(e){if(!!e)return[Lu.Translate.toString(e),Lu.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:r,easing:n}=e;return t+" "+r+"ms "+n}}}),Uae="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function Gae(e){return e.matches(Uae)?e:e.querySelector(Uae)}var py=Ae(Te()),q5e={display:"none"};function Qae(e){let{id:t,value:r}=e;return py.default.createElement("div",{id:t,style:q5e},r)}function Yae(e){let{id:t,announcement:r,ariaLiveType:n="assertive"}=e,i={position:"fixed",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(100%)",whiteSpace:"nowrap"};return py.default.createElement("div",{id:t,style:i,role:"status","aria-live":n,"aria-atomic":!0},r)}function Zae(){let[e,t]=(0,py.useState)("");return{announce:(0,py.useCallback)(n=>{n!=null&&t(n)},[]),announcement:e}}var uoe=(0,nt.createContext)(null);function Ca(e){let t=(0,nt.useContext)(uoe);(0,nt.useEffect)(()=>{if(!t)throw new Error("useDndMonitor must be used within a children of ");return t(e)},[e,t])}function L5e(){let[e]=(0,nt.useState)(()=>new Set),t=(0,nt.useCallback)(n=>(e.add(n),()=>e.delete(n)),[e]);return[(0,nt.useCallback)(n=>{let{type:i,event:a}=n;e.forEach(o=>{var s;return(s=o[i])==null?void 0:s.call(o,a)})},[e]),t]}var z5e={draggable:` To pick up a draggable item, press the space bar. While dragging, use the arrow keys to move the item. Press space again to drop the item in its new position, or press escape to cancel. - `},U5e={onDragStart(e){let{active:t}=e;return"Picked up draggable item "+t.id+"."},onDragOver(e){let{active:t,over:r}=e;return r?"Draggable item "+t.id+" was moved over droppable area "+r.id+".":"Draggable item "+t.id+" is no longer over a droppable area."},onDragEnd(e){let{active:t,over:r}=e;return r?"Draggable item "+t.id+" was dropped over droppable area "+r.id:"Draggable item "+t.id+" was dropped."},onDragCancel(e){let{active:t}=e;return"Dragging was cancelled. Draggable item "+t.id+" was dropped."}};function W5e(e){let{announcements:t=U5e,container:r,hiddenTextDescribedById:n,screenReaderInstructions:i=z5e}=e,{announce:a,announcement:o}=Zae(),s=cy("DndLiveRegion"),[l,u]=(0,nt.useState)(!1);if((0,nt.useEffect)(()=>{u(!0)},[]),Ca((0,nt.useMemo)(()=>({onDragStart(f){let{active:d}=f;a(t.onDragStart({active:d}))},onDragMove(f){let{active:d,over:p}=f;t.onDragMove&&a(t.onDragMove({active:d,over:p}))},onDragOver(f){let{active:d,over:p}=f;a(t.onDragOver({active:d,over:p}))},onDragEnd(f){let{active:d,over:p}=f;a(t.onDragEnd({active:d,over:p}))},onDragCancel(f){let{active:d,over:p}=f;a(t.onDragCancel({active:d,over:p}))}}),[a,t])),!l)return null;let c=nt.default.createElement(nt.default.Fragment,null,nt.default.createElement(Qae,{id:n,value:i.draggable}),nt.default.createElement(Yae,{id:s,announcement:o}));return r?(0,I0.createPortal)(c,r):c}var fs;(function(e){e.DragStart="dragStart",e.DragMove="dragMove",e.DragEnd="dragEnd",e.DragCancel="dragCancel",e.DragOver="dragOver",e.RegisterDroppable="registerDroppable",e.SetDroppableDisabled="setDroppableDisabled",e.UnregisterDroppable="unregisterDroppable"})(fs||(fs={}));function FN(){}function _p(e,t){return(0,nt.useMemo)(()=>({sensor:e,options:t??{}}),[e,t])}function qw(){for(var e=arguments.length,t=new Array(e),r=0;r[...t].filter(n=>n!=null),[...t])}var Tp=Object.freeze({x:0,y:0});function coe(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function H5e(e,t){let r=_6(e);if(!r)return"0 0";let n={x:(r.x-t.left)/t.width*100,y:(r.y-t.top)/t.height*100};return n.x+"% "+n.y+"%"}function foe(e,t){let{data:{value:r}}=e,{data:{value:n}}=t;return r-n}function V5e(e,t){let{data:{value:r}}=e,{data:{value:n}}=t;return n-r}function Xae(e){let{left:t,top:r,height:n,width:i}=e;return[{x:t,y:r},{x:t+i,y:r},{x:t,y:r+n},{x:t+i,y:r+n}]}function qU(e,t){if(!e||e.length===0)return null;let[r]=e;return t?r[t]:r}function Kae(e,t,r){return t===void 0&&(t=e.left),r===void 0&&(r=e.top),{x:t+e.width*.5,y:r+e.height*.5}}var IN=e=>{let{collisionRect:t,droppableRects:r,droppableContainers:n}=e,i=Kae(t,t.left,t.top),a=[];for(let o of n){let{id:s}=o,l=r.get(s);if(l){let u=coe(Kae(l),i);a.push({id:s,data:{droppableContainer:o,value:u}})}}return a.sort(foe)},doe=e=>{let{collisionRect:t,droppableRects:r,droppableContainers:n}=e,i=Xae(t),a=[];for(let o of n){let{id:s}=o,l=r.get(s);if(l){let u=Xae(l),c=i.reduce((d,p,h)=>d+coe(u[h],p),0),f=Number((c/4).toFixed(4));a.push({id:s,data:{droppableContainer:o,value:f}})}}return a.sort(foe)};function G5e(e,t){let r=Math.max(t.top,e.top),n=Math.max(t.left,e.left),i=Math.min(t.left+t.width,e.left+e.width),a=Math.min(t.top+t.height,e.top+e.height),o=i-n,s=a-r;if(n{let{collisionRect:t,droppableRects:r,droppableContainers:n}=e,i=[];for(let a of n){let{id:o}=a,s=r.get(o);if(s){let l=G5e(s,t);l>0&&i.push({id:o,data:{droppableContainer:a,value:l}})}}return i.sort(V5e)};function Q5e(e,t,r){return{...e,scaleX:t&&r?t.width/r.width:1,scaleY:t&&r?t.height/r.height:1}}function poe(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:Tp}function Y5e(e){return function(r){for(var n=arguments.length,i=new Array(n>1?n-1:0),a=1;a({...o,top:o.top+e*s.y,bottom:o.bottom+e*s.y,left:o.left+e*s.x,right:o.right+e*s.x}),{...r})}}var Z5e=Y5e(1);function moe(e){if(e.startsWith("matrix3d(")){let t=e.slice(9,-1).split(/, /);return{x:+t[12],y:+t[13],scaleX:+t[0],scaleY:+t[5]}}else if(e.startsWith("matrix(")){let t=e.slice(7,-1).split(/, /);return{x:+t[4],y:+t[5],scaleX:+t[0],scaleY:+t[3]}}return null}function X5e(e,t,r){let n=moe(t);if(!n)return e;let{scaleX:i,scaleY:a,x:o,y:s}=n,l=e.left-o-(1-i)*parseFloat(r),u=e.top-s-(1-a)*parseFloat(r.slice(r.indexOf(" ")+1)),c=i?e.width/i:e.width,f=a?e.height/a:e.height;return{width:c,height:f,top:u,right:l+c,bottom:u+f,left:l}}var K5e={ignoreTransform:!1};function Ay(e,t){t===void 0&&(t=K5e);let r=e.getBoundingClientRect();if(t.ignoreTransform){let{transform:u,transformOrigin:c}=nu(e).getComputedStyle(e);u&&(r=X5e(r,u,c))}let{top:n,left:i,width:a,height:o,bottom:s,right:l}=r;return{top:n,left:i,width:a,height:o,bottom:s,right:l}}function Jae(e){return Ay(e,{ignoreTransform:!0})}function J5e(e){let t=e.innerWidth,r=e.innerHeight;return{top:0,left:0,right:t,bottom:r,width:t,height:r}}function e9e(e,t){return t===void 0&&(t=nu(e).getComputedStyle(e)),t.position==="fixed"}function t9e(e,t){t===void 0&&(t=nu(e).getComputedStyle(e));let r=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].some(i=>{let a=t[i];return typeof a=="string"?r.test(a):!1})}function R6(e,t){let r=[];function n(i){if(t!=null&&r.length>=t||!i)return r;if(NN(i)&&i.scrollingElement!=null&&!r.includes(i.scrollingElement))return r.push(i.scrollingElement),r;if(!Iw(i)||TU(i)||r.includes(i))return r;let a=nu(e).getComputedStyle(i);return i!==e&&t9e(i,a)&&r.push(i),e9e(i,a)?r:n(i.parentNode)}return e?n(e):r}function hoe(e){let[t]=R6(e,1);return t??null}function FU(e){return!j6||!e?null:ly(e)?e:jN(e)?NN(e)||e===uy(e).scrollingElement?window:Iw(e)?e:null:null}function Aoe(e){return ly(e)?e.scrollX:e.scrollLeft}function goe(e){return ly(e)?e.scrollY:e.scrollTop}function BU(e){return{x:Aoe(e),y:goe(e)}}var zs;(function(e){e[e.Forward=1]="Forward",e[e.Backward=-1]="Backward"})(zs||(zs={}));function voe(e){return!j6||!e?!1:e===document.scrollingElement}function yoe(e){let t={x:0,y:0},r=voe(e)?{height:window.innerHeight,width:window.innerWidth}:{height:e.clientHeight,width:e.clientWidth},n={x:e.scrollWidth-r.width,y:e.scrollHeight-r.height},i=e.scrollTop<=t.y,a=e.scrollLeft<=t.x,o=e.scrollTop>=n.y,s=e.scrollLeft>=n.x;return{isTop:i,isLeft:a,isBottom:o,isRight:s,maxScroll:n,minScroll:t}}var r9e={x:.2,y:.2};function n9e(e,t,r,n,i){let{top:a,left:o,right:s,bottom:l}=r;n===void 0&&(n=10),i===void 0&&(i=r9e);let{isTop:u,isBottom:c,isLeft:f,isRight:d}=yoe(e),p={x:0,y:0},h={x:0,y:0},m={height:t.height*i.y,width:t.width*i.x};return!u&&a<=t.top+m.height?(p.y=zs.Backward,h.y=n*Math.abs((t.top+m.height-a)/m.height)):!c&&l>=t.bottom-m.height&&(p.y=zs.Forward,h.y=n*Math.abs((t.bottom-m.height-l)/m.height)),!d&&s>=t.right-m.width?(p.x=zs.Forward,h.x=n*Math.abs((t.right-m.width-s)/m.width)):!f&&o<=t.left+m.width&&(p.x=zs.Backward,h.x=n*Math.abs((t.left+m.width-o)/m.width)),{direction:p,speed:h}}function i9e(e){if(e===document.scrollingElement){let{innerWidth:a,innerHeight:o}=window;return{top:0,left:0,right:a,bottom:o,width:a,height:o}}let{top:t,left:r,right:n,bottom:i}=e.getBoundingClientRect();return{top:t,left:r,right:n,bottom:i,width:e.clientWidth,height:e.clientHeight}}function boe(e){return e.reduce((t,r)=>fy(t,BU(r)),Tp)}function a9e(e){return e.reduce((t,r)=>t+Aoe(r),0)}function o9e(e){return e.reduce((t,r)=>t+goe(r),0)}function xoe(e,t){if(t===void 0&&(t=Ay),!e)return;let{top:r,left:n,bottom:i,right:a}=t(e);!hoe(e)||(i<=0||a<=0||r>=window.innerHeight||n>=window.innerWidth)&&e.scrollIntoView({block:"center",inline:"center"})}var s9e=[["x",["left","right"],a9e],["y",["top","bottom"],o9e]],I6=class{constructor(t,r){this.rect=void 0,this.width=void 0,this.height=void 0,this.top=void 0,this.bottom=void 0,this.right=void 0,this.left=void 0;let n=R6(r),i=boe(n);this.rect={...t},this.width=t.width,this.height=t.height;for(let[a,o,s]of s9e)for(let l of o)Object.defineProperty(this,l,{get:()=>{let u=s(n),c=i[a]-u;return this.rect[l]+c},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}},my=class{constructor(t){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(r=>{var n;return(n=this.target)==null?void 0:n.removeEventListener(...r)})},this.target=t}add(t,r,n){var i;(i=this.target)==null||i.addEventListener(t,r,n),this.listeners.push([t,r,n])}};function l9e(e){let{EventTarget:t}=nu(e);return e instanceof t?e:uy(e)}function _U(e,t){let r=Math.abs(e.x),n=Math.abs(e.y);return typeof t=="number"?Math.sqrt(r**2+n**2)>t:"x"in t&&"y"in t?r>t.x&&n>t.y:"x"in t?r>t.x:"y"in t?n>t.y:!1}var Sd;(function(e){e.Click="click",e.DragStart="dragstart",e.Keydown="keydown",e.ContextMenu="contextmenu",e.Resize="resize",e.SelectionChange="selectionchange",e.VisibilityChange="visibilitychange"})(Sd||(Sd={}));function eoe(e){e.preventDefault()}function u9e(e){e.stopPropagation()}var $n;(function(e){e.Space="Space",e.Down="ArrowDown",e.Right="ArrowRight",e.Left="ArrowLeft",e.Up="ArrowUp",e.Esc="Escape",e.Enter="Enter"})($n||($n={}));var woe={start:[$n.Space,$n.Enter],cancel:[$n.Esc],end:[$n.Space,$n.Enter]},c9e=(e,t)=>{let{currentCoordinates:r}=t;switch(e.code){case $n.Right:return{...r,x:r.x+25};case $n.Left:return{...r,x:r.x-25};case $n.Down:return{...r,y:r.y+25};case $n.Up:return{...r,y:r.y-25}}},B0=class{constructor(t){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=t;let{event:{target:r}}=t;this.props=t,this.listeners=new my(uy(r)),this.windowListeners=new my(nu(r)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(Sd.Resize,this.handleCancel),this.windowListeners.add(Sd.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(Sd.Keydown,this.handleKeyDown))}handleStart(){let{activeNode:t,onStart:r}=this.props,n=t.node.current;n&&xoe(n),r(Tp)}handleKeyDown(t){if($w(t)){let{active:r,context:n,options:i}=this.props,{keyboardCodes:a=woe,coordinateGetter:o=c9e,scrollBehavior:s="smooth"}=i,{code:l}=t;if(a.end.includes(l)){this.handleEnd(t);return}if(a.cancel.includes(l)){this.handleCancel(t);return}let{collisionRect:u}=n.current,c=u?{x:u.left,y:u.top}:Tp;this.referenceCoordinates||(this.referenceCoordinates=c);let f=o(t,{active:r,context:n.current,currentCoordinates:c});if(f){let d=dy(f,c),p={x:0,y:0},{scrollableAncestors:h}=n.current;for(let m of h){let g=t.code,{isTop:A,isRight:b,isLeft:v,isBottom:x,maxScroll:w,minScroll:S}=yoe(m),k=i9e(m),j={x:Math.min(g===$n.Right?k.right-k.width/2:k.right,Math.max(g===$n.Right?k.left:k.left+k.width/2,f.x)),y:Math.min(g===$n.Down?k.bottom-k.height/2:k.bottom,Math.max(g===$n.Down?k.top:k.top+k.height/2,f.y))},O=g===$n.Right&&!b||g===$n.Left&&!v,C=g===$n.Down&&!x||g===$n.Up&&!A;if(O&&j.x!==f.x){let N=m.scrollLeft+d.x,D=g===$n.Right&&N<=w.x||g===$n.Left&&N>=S.x;if(D&&!d.y){m.scrollTo({left:N,behavior:s});return}D?p.x=m.scrollLeft-N:p.x=g===$n.Right?m.scrollLeft-w.x:m.scrollLeft-S.x,p.x&&m.scrollBy({left:-p.x,behavior:s});break}else if(C&&j.y!==f.y){let N=m.scrollTop+d.y,D=g===$n.Down&&N<=w.y||g===$n.Up&&N>=S.y;if(D&&!d.x){m.scrollTo({top:N,behavior:s});return}D?p.y=m.scrollTop-N:p.y=g===$n.Down?m.scrollTop-w.y:m.scrollTop-S.y,p.y&&m.scrollBy({top:-p.y,behavior:s});break}}this.handleMove(t,fy(dy(f,this.referenceCoordinates),p))}}}handleMove(t,r){let{onMove:n}=this.props;t.preventDefault(),n(r)}handleEnd(t){let{onEnd:r}=this.props;t.preventDefault(),this.detach(),r()}handleCancel(t){let{onCancel:r}=this.props;t.preventDefault(),this.detach(),r()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}};B0.activators=[{eventName:"onKeyDown",handler:(e,t,r)=>{let{keyboardCodes:n=woe,onActivation:i}=t,{active:a}=r,{code:o}=e.nativeEvent;if(n.start.includes(o)){let s=a.activatorNode.current;return s&&e.target!==s?!1:(e.preventDefault(),i?.({event:e.nativeEvent}),!0)}return!1}}];function toe(e){return Boolean(e&&"distance"in e)}function roe(e){return Boolean(e&&"delay"in e)}var B6=class{constructor(t,r,n){var i;n===void 0&&(n=l9e(t.event.target)),this.props=void 0,this.events=void 0,this.autoScrollEnabled=!0,this.document=void 0,this.activated=!1,this.initialCoordinates=void 0,this.timeoutId=null,this.listeners=void 0,this.documentListeners=void 0,this.windowListeners=void 0,this.props=t,this.events=r;let{event:a}=t,{target:o}=a;this.props=t,this.events=r,this.document=uy(o),this.documentListeners=new my(this.document),this.listeners=new my(n),this.windowListeners=new my(nu(o)),this.initialCoordinates=(i=_6(a))!=null?i:Tp,this.handleStart=this.handleStart.bind(this),this.handleMove=this.handleMove.bind(this),this.handleEnd=this.handleEnd.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.removeTextSelection=this.removeTextSelection.bind(this),this.attach()}attach(){let{events:t,props:{options:{activationConstraint:r,bypassActivationConstraint:n}}}=this;if(this.listeners.add(t.move.name,this.handleMove,{passive:!1}),this.listeners.add(t.end.name,this.handleEnd),this.windowListeners.add(Sd.Resize,this.handleCancel),this.windowListeners.add(Sd.DragStart,eoe),this.windowListeners.add(Sd.VisibilityChange,this.handleCancel),this.windowListeners.add(Sd.ContextMenu,eoe),this.documentListeners.add(Sd.Keydown,this.handleKeydown),r){if(n!=null&&n({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(roe(r)){this.timeoutId=setTimeout(this.handleStart,r.delay);return}if(toe(r))return}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),this.timeoutId!==null&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handleStart(){let{initialCoordinates:t}=this,{onStart:r}=this.props;t&&(this.activated=!0,this.documentListeners.add(Sd.Click,u9e,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(Sd.SelectionChange,this.removeTextSelection),r(t))}handleMove(t){var r;let{activated:n,initialCoordinates:i,props:a}=this,{onMove:o,options:{activationConstraint:s}}=a;if(!i)return;let l=(r=_6(t))!=null?r:Tp,u=dy(i,l);if(!n&&s){if(toe(s)){if(s.tolerance!=null&&_U(u,s.tolerance))return this.handleCancel();if(_U(u,s.distance))return this.handleStart()}return roe(s)&&_U(u,s.tolerance)?this.handleCancel():void 0}t.cancelable&&t.preventDefault(),o(l)}handleEnd(){let{onEnd:t}=this.props;this.detach(),t()}handleCancel(){let{onCancel:t}=this.props;this.detach(),t()}handleKeydown(t){t.code===$n.Esc&&this.handleCancel()}removeTextSelection(){var t;(t=this.document.getSelection())==null||t.removeAllRanges()}},f9e={move:{name:"pointermove"},end:{name:"pointerup"}},_N=class extends B6{constructor(t){let{event:r}=t,n=uy(r.target);super(t,f9e,n)}};_N.activators=[{eventName:"onPointerDown",handler:(e,t)=>{let{nativeEvent:r}=e,{onActivation:n}=t;return!r.isPrimary||r.button!==0?!1:(n?.({event:r}),!0)}}];var d9e={move:{name:"mousemove"},end:{name:"mouseup"}},RU;(function(e){e[e.RightClick=2]="RightClick"})(RU||(RU={}));var BA=class extends B6{constructor(t){super(t,d9e,uy(t.event.target))}};BA.activators=[{eventName:"onMouseDown",handler:(e,t)=>{let{nativeEvent:r}=e,{onActivation:n}=t;return r.button===RU.RightClick?!1:(n?.({event:r}),!0)}}];var PU={move:{name:"touchmove"},end:{name:"touchend"}},RA=class extends B6{constructor(t){super(t,PU)}static setup(){return window.addEventListener(PU.move.name,t,{capture:!1,passive:!1}),function(){window.removeEventListener(PU.move.name,t)};function t(){}}};RA.activators=[{eventName:"onTouchStart",handler:(e,t)=>{let{nativeEvent:r}=e,{onActivation:n}=t,{touches:i}=r;return i.length>1?!1:(n?.({event:r}),!0)}}];var P6;(function(e){e[e.Pointer=0]="Pointer",e[e.DraggableRect=1]="DraggableRect"})(P6||(P6={}));var PN;(function(e){e[e.TreeOrder=0]="TreeOrder",e[e.ReversedTreeOrder=1]="ReversedTreeOrder"})(PN||(PN={}));function p9e(e){let{acceleration:t,activator:r=P6.Pointer,canScroll:n,draggingRect:i,enabled:a,interval:o=5,order:s=PN.TreeOrder,pointerCoordinates:l,scrollableAncestors:u,scrollableAncestorRects:c,delta:f,threshold:d}=e,p=h9e({delta:f,disabled:!a}),[h,m]=Hae(),g=(0,nt.useRef)({x:0,y:0}),A=(0,nt.useRef)({x:0,y:0}),b=(0,nt.useMemo)(()=>{switch(r){case P6.Pointer:return l?{top:l.y,bottom:l.y,left:l.x,right:l.x}:null;case P6.DraggableRect:return i}},[r,i,l]),v=(0,nt.useRef)(null),x=(0,nt.useCallback)(()=>{let S=v.current;if(!S)return;let k=g.current.x*A.current.x,j=g.current.y*A.current.y;S.scrollBy(k,j)},[]),w=(0,nt.useMemo)(()=>s===PN.TreeOrder?[...u].reverse():u,[s,u]);(0,nt.useEffect)(()=>{if(!a||!u.length||!b){m();return}for(let S of w){if(n?.(S)===!1)continue;let k=u.indexOf(S),j=c[k];if(!j)continue;let{direction:O,speed:C}=n9e(S,j,b,t,d);for(let N of["x","y"])p[N][O[N]]||(C[N]=0,O[N]=0);if(C.x>0||C.y>0){m(),v.current=S,h(x,o),g.current=C,A.current=O;return}}g.current={x:0,y:0},A.current={x:0,y:0},m()},[t,x,n,m,a,o,JSON.stringify(b),JSON.stringify(p),h,u,w,c,JSON.stringify(d)])}var m9e={x:{[zs.Backward]:!1,[zs.Forward]:!1},y:{[zs.Backward]:!1,[zs.Forward]:!1}};function h9e(e){let{delta:t,disabled:r}=e,n=F6(t);return Rw(i=>{if(r||!n||!i)return m9e;let a={x:Math.sign(t.x-n.x),y:Math.sign(t.y-n.y)};return{x:{[zs.Backward]:i.x[zs.Backward]||a.x===-1,[zs.Forward]:i.x[zs.Forward]||a.x===1},y:{[zs.Backward]:i.y[zs.Backward]||a.y===-1,[zs.Forward]:i.y[zs.Forward]||a.y===1}}},[r,t,n])}function A9e(e,t){let r=t!==null?e.get(t):void 0,n=r?r.node.current:null;return Rw(i=>{var a;return t===null?null:(a=n??i)!=null?a:null},[n,t])}function g9e(e,t){return(0,nt.useMemo)(()=>e.reduce((r,n)=>{let{sensor:i}=n,a=i.activators.map(o=>({eventName:o.eventName,handler:t(o.handler,n)}));return[...r,...a]},[]),[e,t])}var Fp;(function(e){e[e.Always=0]="Always",e[e.BeforeDragging=1]="BeforeDragging",e[e.WhileDragging=2]="WhileDragging"})(Fp||(Fp={}));var $U;(function(e){e.Optimized="optimized"})($U||($U={}));var noe=new Map;function v9e(e,t){let{dragging:r,dependencies:n,config:i}=t,[a,o]=(0,nt.useState)(null),{frequency:s,measure:l,strategy:u}=i,c=(0,nt.useRef)(e),f=g(),d=Bw(f),p=(0,nt.useCallback)(function(A){A===void 0&&(A=[]),!d.current&&o(b=>b===null?A:b.concat(A.filter(v=>!b.includes(v))))},[d]),h=(0,nt.useRef)(null),m=Rw(A=>{if(f&&!r)return noe;if(!A||A===noe||c.current!==e||a!=null){let b=new Map;for(let v of e){if(!v)continue;if(a&&a.length>0&&!a.includes(v.id)&&v.rect.current){b.set(v.id,v.rect.current);continue}let x=v.node.current,w=x?new I6(l(x),x):null;v.rect.current=w,w&&b.set(v.id,w)}return b}return A},[e,a,r,f,l]);return(0,nt.useEffect)(()=>{c.current=e},[e]),(0,nt.useEffect)(()=>{f||p()},[r,f]),(0,nt.useEffect)(()=>{a&&a.length>0&&o(null)},[JSON.stringify(a)]),(0,nt.useEffect)(()=>{f||typeof s!="number"||h.current!==null||(h.current=setTimeout(()=>{p(),h.current=null},s))},[s,f,p,...n]),{droppableRects:m,measureDroppableContainers:p,measuringScheduled:a!=null};function g(){switch(u){case Fp.Always:return!1;case Fp.BeforeDragging:return r;default:return!r}}}function zU(e,t){return Rw(r=>e?r||(typeof t=="function"?t(e):e):null,[t,e])}function y9e(e,t){return zU(e,t)}function b9e(e){let{callback:t,disabled:r}=e,n=N6(t),i=(0,nt.useMemo)(()=>{if(r||typeof window>"u"||typeof window.MutationObserver>"u")return;let{MutationObserver:a}=window;return new a(n)},[n,r]);return(0,nt.useEffect)(()=>()=>i?.disconnect(),[i]),i}function BN(e){let{callback:t,disabled:r}=e,n=N6(t),i=(0,nt.useMemo)(()=>{if(r||typeof window>"u"||typeof window.ResizeObserver>"u")return;let{ResizeObserver:a}=window;return new a(n)},[r]);return(0,nt.useEffect)(()=>()=>i?.disconnect(),[i]),i}function x9e(e){return new I6(Ay(e),e)}function ioe(e,t,r){t===void 0&&(t=x9e);let[n,i]=(0,nt.useReducer)(s,null),a=b9e({callback(l){if(!!e)for(let u of l){let{type:c,target:f}=u;if(c==="childList"&&f instanceof HTMLElement&&f.contains(e)){i();break}}}}),o=BN({callback:i});return bc(()=>{i(),e?(o?.observe(e),a?.observe(document.body,{childList:!0,subtree:!0})):(o?.disconnect(),a?.disconnect())},[e]),n;function s(l){if(!e)return null;if(e.isConnected===!1){var u;return(u=l??r)!=null?u:null}let c=t(e);return JSON.stringify(l)===JSON.stringify(c)?l:c}}function w9e(e){let t=zU(e);return poe(e,t)}var aoe=[];function S9e(e){let t=(0,nt.useRef)(e),r=Rw(n=>e?n&&n!==aoe&&e&&t.current&&e.parentNode===t.current.parentNode?n:R6(e):aoe,[e]);return(0,nt.useEffect)(()=>{t.current=e},[e]),r}function E9e(e){let[t,r]=(0,nt.useState)(null),n=(0,nt.useRef)(e),i=(0,nt.useCallback)(a=>{let o=FU(a.target);!o||r(s=>s?(s.set(o,BU(o)),new Map(s)):null)},[]);return(0,nt.useEffect)(()=>{let a=n.current;if(e!==a){o(a);let s=e.map(l=>{let u=FU(l);return u?(u.addEventListener("scroll",i,{passive:!0}),[u,BU(u)]):null}).filter(l=>l!=null);r(s.length?new Map(s):null),n.current=e}return()=>{o(e),o(a)};function o(s){s.forEach(l=>{let u=FU(l);u?.removeEventListener("scroll",i)})}},[i,e]),(0,nt.useMemo)(()=>e.length?t?Array.from(t.values()).reduce((a,o)=>fy(a,o),Tp):boe(e):Tp,[e,t])}function ooe(e,t){t===void 0&&(t=[]);let r=(0,nt.useRef)(null);return(0,nt.useEffect)(()=>{r.current=null},t),(0,nt.useEffect)(()=>{let n=e!==Tp;n&&!r.current&&(r.current=e),!n&&r.current&&(r.current=null)},[e]),r.current?dy(e,r.current):Tp}function k9e(e){(0,nt.useEffect)(()=>{if(!j6)return;let t=e.map(r=>{let{sensor:n}=r;return n.setup==null?void 0:n.setup()});return()=>{for(let r of t)r?.()}},e.map(t=>{let{sensor:r}=t;return r}))}function C9e(e,t){return(0,nt.useMemo)(()=>e.reduce((r,n)=>{let{eventName:i,handler:a}=n;return r[i]=o=>{a(o,t)},r},{}),[e,t])}function Soe(e){return(0,nt.useMemo)(()=>e?J5e(e):null,[e])}var IU=[];function D9e(e,t){t===void 0&&(t=Ay);let[r]=e,n=Soe(r?nu(r):null),[i,a]=(0,nt.useReducer)(s,IU),o=BN({callback:a});return e.length>0&&i===IU&&a(),bc(()=>{e.length?e.forEach(l=>o?.observe(l)):(o?.disconnect(),a())},[e]),i;function s(){return e.length?e.map(l=>voe(l)?n:new I6(t(l),l)):IU}}function Eoe(e){if(!e)return null;if(e.children.length>1)return e;let t=e.children[0];return Iw(t)?t:e}function O9e(e){let{measure:t}=e,[r,n]=(0,nt.useState)(null),i=(0,nt.useCallback)(u=>{for(let{target:c}of u)if(Iw(c)){n(f=>{let d=t(c);return f?{...f,width:d.width,height:d.height}:d});break}},[t]),a=BN({callback:i}),o=(0,nt.useCallback)(u=>{let c=Eoe(u);a?.disconnect(),c&&a?.observe(c),n(c?t(c):null)},[t,a]),[s,l]=T6(o);return(0,nt.useMemo)(()=>({nodeRef:s,rect:r,setRef:l}),[r,s,l])}var M9e=[{sensor:_N,options:{}},{sensor:B0,options:{}}],j9e={current:{}},TN={draggable:{measure:Jae},droppable:{measure:Jae,strategy:Fp.WhileDragging,frequency:$U.Optimized},dragOverlay:{measure:Ay}},hy=class extends Map{get(t){var r;return t!=null&&(r=super.get(t))!=null?r:void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(t=>{let{disabled:r}=t;return!r})}getNodeFor(t){var r,n;return(r=(n=this.get(t))==null?void 0:n.node.current)!=null?r:void 0}},N9e={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new hy,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:FN},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:TN,measureDroppableContainers:FN,windowRect:null,measuringScheduled:!1},koe={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:FN,draggableNodes:new Map,over:null,measureDroppableContainers:FN},$6=(0,nt.createContext)(koe),Coe=(0,nt.createContext)(N9e);function T9e(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new hy}}}function F9e(e,t){switch(t.type){case fs.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case fs.DragMove:return e.draggable.active?{...e,draggable:{...e.draggable,translate:{x:t.coordinates.x-e.draggable.initialCoordinates.x,y:t.coordinates.y-e.draggable.initialCoordinates.y}}}:e;case fs.DragEnd:case fs.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case fs.RegisterDroppable:{let{element:r}=t,{id:n}=r,i=new hy(e.droppable.containers);return i.set(n,r),{...e,droppable:{...e.droppable,containers:i}}}case fs.SetDroppableDisabled:{let{id:r,key:n,disabled:i}=t,a=e.droppable.containers.get(r);if(!a||n!==a.key)return e;let o=new hy(e.droppable.containers);return o.set(r,{...a,disabled:i}),{...e,droppable:{...e.droppable,containers:o}}}case fs.UnregisterDroppable:{let{id:r,key:n}=t,i=e.droppable.containers.get(r);if(!i||n!==i.key)return e;let a=new hy(e.droppable.containers);return a.delete(r),{...e,droppable:{...e.droppable,containers:a}}}default:return e}}function _9e(e){let{disabled:t}=e,{active:r,activatorEvent:n,draggableNodes:i}=(0,nt.useContext)($6),a=F6(n),o=F6(r?.id);return(0,nt.useEffect)(()=>{if(!t&&!n&&a&&o!=null){if(!$w(a)||document.activeElement===a.target)return;let s=i.get(o);if(!s)return;let{activatorNode:l,node:u}=s;if(!l.current&&!u.current)return;requestAnimationFrame(()=>{for(let c of[l.current,u.current]){if(!c)continue;let f=Gae(c);if(f){f.focus();break}}})}},[n,t,i,o,a]),null}function Doe(e,t){let{transform:r,...n}=t;return e!=null&&e.length?e.reduce((i,a)=>a({transform:i,...n}),r):r}function P9e(e){return(0,nt.useMemo)(()=>({draggable:{...TN.draggable,...e?.draggable},droppable:{...TN.droppable,...e?.droppable},dragOverlay:{...TN.dragOverlay,...e?.dragOverlay}}),[e?.draggable,e?.droppable,e?.dragOverlay])}function I9e(e){let{activeNode:t,measure:r,initialRect:n,config:i=!0}=e,a=(0,nt.useRef)(!1),{x:o,y:s}=typeof i=="boolean"?{x:i,y:i}:i;bc(()=>{if(!o&&!s||!t){a.current=!1;return}if(a.current||!n)return;let u=t?.node.current;if(!u||u.isConnected===!1)return;let c=r(u),f=poe(c,n);if(o||(f.x=0),s||(f.y=0),a.current=!0,Math.abs(f.x)>0||Math.abs(f.y)>0){let d=hoe(u);d&&d.scrollBy({top:f.y,left:f.x})}},[t,o,s,n,r])}var RN=(0,nt.createContext)({...Tp,scaleX:1,scaleY:1}),P0;(function(e){e[e.Uninitialized=0]="Uninitialized",e[e.Initializing=1]="Initializing",e[e.Initialized=2]="Initialized"})(P0||(P0={}));var Lw=(0,nt.memo)(function(t){var r,n,i,a;let{id:o,accessibility:s,autoScroll:l=!0,children:u,sensors:c=M9e,collisionDetection:f=LU,measuring:d,modifiers:p,...h}=t,m=(0,nt.useReducer)(F9e,void 0,T9e),[g,A]=m,[b,v]=L5e(),[x,w]=(0,nt.useState)(P0.Uninitialized),S=x===P0.Initialized,{draggable:{active:k,nodes:j,translate:O},droppable:{containers:C}}=g,N=k?j.get(k):null,D=(0,nt.useRef)({initial:null,translated:null}),P=(0,nt.useMemo)(()=>{var at;return k!=null?{id:k,data:(at=N?.data)!=null?at:j9e,rect:D}:null},[k,N]),q=(0,nt.useRef)(null),[z,I]=(0,nt.useState)(null),[T,L]=(0,nt.useState)(null),_=Bw(h,Object.values(h)),Y=cy("DndDescribedBy",o),oe=(0,nt.useMemo)(()=>C.getEnabled(),[C]),te=P9e(d),{droppableRects:Q,measureDroppableContainers:fe,measuringScheduled:Ie}=v9e(oe,{dragging:S,dependencies:[O.x,O.y],config:te.droppable}),Se=A9e(j,k),Oe=(0,nt.useMemo)(()=>T?_6(T):null,[T]),ve=De(),ye=y9e(Se,te.draggable.measure);I9e({activeNode:k?j.get(k):null,config:ve.layoutShiftCompensation,initialRect:ye,measure:te.draggable.measure});let me=ioe(Se,te.draggable.measure,ye),ke=ioe(Se?Se.parentElement:null),$=(0,nt.useRef)({activatorEvent:null,active:null,activeNode:Se,collisionRect:null,collisions:null,droppableRects:Q,draggableNodes:j,draggingNode:null,draggingNodeRect:null,droppableContainers:C,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),ae=C.getNodeFor((r=$.current.over)==null?void 0:r.id),ce=O9e({measure:te.dragOverlay.measure}),U=(n=ce.nodeRef.current)!=null?n:Se,R=S?(i=ce.rect)!=null?i:me:null,J=Boolean(ce.nodeRef.current&&ce.rect),ee=w9e(J?null:me),ie=Soe(U?nu(U):null),re=S9e(S?ae??Se:null),Ee=D9e(re),Ce=Doe(p,{transform:{x:O.x-ee.x,y:O.y-ee.y,scaleX:1,scaleY:1},activatorEvent:T,active:P,activeNodeRect:me,containerNodeRect:ke,draggingNodeRect:R,over:$.current.over,overlayNodeRect:ce.rect,scrollableAncestors:re,scrollableAncestorRects:Ee,windowRect:ie}),_e=Oe?fy(Oe,O):null,he=E9e(re),ze=ooe(he),Ye=ooe(he,[me]),tt=fy(Ce,ze),Ct=R?Z5e(R,Ce):null,we=P&&Ct?f({active:P,collisionRect:Ct,droppableRects:Q,droppableContainers:oe,pointerCoordinates:_e}):null,Be=qU(we,"id"),[Le,Ze]=(0,nt.useState)(null),He=J?Ce:fy(Ce,Ye),Qe=Q5e(He,(a=Le?.rect)!=null?a:null,me),et=(0,nt.useCallback)((at,ht)=>{let{sensor:Zt,options:Wr}=ht;if(q.current==null)return;let en=j.get(q.current);if(!en)return;let tn=at.nativeEvent,ci=new Zt({active:q.current,activeNode:en,event:tn,options:Wr,context:$,onStart(Qi){let Pa=q.current;if(Pa==null)return;let Dt=j.get(Pa);if(!Dt)return;let{onDragStart:Hc}=_.current,Wf={active:{id:Pa,data:Dt.data,rect:D}};(0,I0.unstable_batchedUpdates)(()=>{Hc?.(Wf),w(P0.Initializing),A({type:fs.DragStart,initialCoordinates:Qi,active:Pa}),b({type:"onDragStart",event:Wf})})},onMove(Qi){A({type:fs.DragMove,coordinates:Qi})},onEnd:ns(fs.DragEnd),onCancel:ns(fs.DragCancel)});(0,I0.unstable_batchedUpdates)(()=>{I(ci),L(at.nativeEvent)});function ns(Qi){return async function(){let{active:Dt,collisions:Hc,over:Wf,scrollAdjustedTranslate:Va}=$.current,Eu=null;if(Dt&&Va){let{cancelDrop:Yr}=_.current;Eu={activatorEvent:tn,active:Dt,collisions:Hc,delta:Va,over:Wf},Qi===fs.DragEnd&&typeof Yr=="function"&&await Promise.resolve(Yr(Eu))&&(Qi=fs.DragCancel)}q.current=null,(0,I0.unstable_batchedUpdates)(()=>{A({type:Qi}),w(P0.Uninitialized),Ze(null),I(null),L(null);let Yr=Qi===fs.DragEnd?"onDragEnd":"onDragCancel";if(Eu){let Ul=_.current[Yr];Ul?.(Eu),b({type:Yr,event:Eu})}})}}},[j]),Ge=(0,nt.useCallback)((at,ht)=>(Zt,Wr)=>{let en=Zt.nativeEvent,tn=j.get(Wr);if(q.current!==null||!tn||en.dndKit||en.defaultPrevented)return;let ci={active:tn};at(Zt,ht.options,ci)===!0&&(en.dndKit={capturedBy:ht.sensor},q.current=Wr,et(Zt,ht))},[j,et]),G=g9e(c,Ge);k9e(c),bc(()=>{me&&x===P0.Initializing&&w(P0.Initialized)},[me,x]),(0,nt.useEffect)(()=>{let{onDragMove:at}=_.current,{active:ht,activatorEvent:Zt,collisions:Wr,over:en}=$.current;if(!ht||!Zt)return;let tn={active:ht,activatorEvent:Zt,collisions:Wr,delta:{x:tt.x,y:tt.y},over:en};(0,I0.unstable_batchedUpdates)(()=>{at?.(tn),b({type:"onDragMove",event:tn})})},[tt.x,tt.y]),(0,nt.useEffect)(()=>{let{active:at,activatorEvent:ht,collisions:Zt,droppableContainers:Wr,scrollAdjustedTranslate:en}=$.current;if(!at||q.current==null||!ht||!en)return;let{onDragOver:tn}=_.current,ci=Wr.get(Be),ns=ci&&ci.rect.current?{id:ci.id,rect:ci.rect.current,data:ci.data,disabled:ci.disabled}:null,Qi={active:at,activatorEvent:ht,collisions:Zt,delta:{x:en.x,y:en.y},over:ns};(0,I0.unstable_batchedUpdates)(()=>{Ze(ns),tn?.(Qi),b({type:"onDragOver",event:Qi})})},[Be]),bc(()=>{$.current={activatorEvent:T,active:P,activeNode:Se,collisionRect:Ct,collisions:we,droppableRects:Q,draggableNodes:j,draggingNode:U,draggingNodeRect:R,droppableContainers:C,over:Le,scrollableAncestors:re,scrollAdjustedTranslate:tt},D.current={initial:R,translated:Ct}},[P,Se,we,Ct,j,U,R,Q,C,Le,re,tt]),p9e({...ve,delta:O,draggingRect:Ct,pointerCoordinates:_e,scrollableAncestors:re,scrollableAncestorRects:Ee});let ue=(0,nt.useMemo)(()=>({active:P,activeNode:Se,activeNodeRect:me,activatorEvent:T,collisions:we,containerNodeRect:ke,dragOverlay:ce,draggableNodes:j,droppableContainers:C,droppableRects:Q,over:Le,measureDroppableContainers:fe,scrollableAncestors:re,scrollableAncestorRects:Ee,measuringConfiguration:te,measuringScheduled:Ie,windowRect:ie}),[P,Se,me,T,we,ke,ce,j,C,Q,Le,fe,re,Ee,te,Ie,ie]),Pe=(0,nt.useMemo)(()=>({activatorEvent:T,activators:G,active:P,activeNodeRect:me,ariaDescribedById:{draggable:Y},dispatch:A,draggableNodes:j,over:Le,measureDroppableContainers:fe}),[T,G,P,me,A,Y,j,Le,fe]);return nt.default.createElement(uoe.Provider,{value:v},nt.default.createElement($6.Provider,{value:Pe},nt.default.createElement(Coe.Provider,{value:ue},nt.default.createElement(RN.Provider,{value:Qe},u)),nt.default.createElement(_9e,{disabled:s?.restoreFocus===!1})),nt.default.createElement(W5e,{...s,hiddenTextDescribedById:Y}));function De(){let at=z?.autoScrollEnabled===!1,ht=typeof l=="object"?l.enabled===!1:l===!1,Zt=S&&!at&&!ht;return typeof l=="object"?{...l,enabled:Zt}:{enabled:Zt}}}),B9e=(0,nt.createContext)(null),soe="button",R9e="Droppable";function Us(e){let{id:t,data:r,disabled:n=!1,attributes:i}=e,a=cy(R9e),{activators:o,activatorEvent:s,active:l,activeNodeRect:u,ariaDescribedById:c,draggableNodes:f,over:d}=(0,nt.useContext)($6),{role:p=soe,roleDescription:h="draggable",tabIndex:m=0}=i??{},g=l?.id===t,A=(0,nt.useContext)(g?RN:B9e),[b,v]=T6(),[x,w]=T6(),S=C9e(o,t),k=Bw(r);bc(()=>(f.set(t,{id:t,key:a,node:b,activatorNode:x,data:k}),()=>{let O=f.get(t);O&&O.key===a&&f.delete(t)}),[f,t]);let j=(0,nt.useMemo)(()=>({role:p,tabIndex:m,"aria-disabled":n,"aria-pressed":g&&p===soe?!0:void 0,"aria-roledescription":h,"aria-describedby":c.draggable}),[n,p,m,g,h,c.draggable]);return{active:l,activatorEvent:s,activeNodeRect:u,attributes:j,isDragging:g,listeners:n?void 0:S,node:b,over:d,setNodeRef:v,setActivatorNodeRef:w,transform:A}}function UU(){return(0,nt.useContext)(Coe)}var $9e="Droppable",q9e={timeout:25};function zu(e){let{data:t,disabled:r=!1,id:n,resizeObserverConfig:i}=e,a=cy($9e),{active:o,dispatch:s,over:l,measureDroppableContainers:u}=(0,nt.useContext)($6),c=(0,nt.useRef)({disabled:r}),f=(0,nt.useRef)(!1),d=(0,nt.useRef)(null),p=(0,nt.useRef)(null),{disabled:h,updateMeasurementsFor:m,timeout:g}={...q9e,...i},A=Bw(m??n),b=(0,nt.useCallback)(()=>{if(!f.current){f.current=!0;return}p.current!=null&&clearTimeout(p.current),p.current=setTimeout(()=>{u(Array.isArray(A.current)?A.current:[A.current]),p.current=null},g)},[g]),v=BN({callback:b,disabled:h||!o}),x=(0,nt.useCallback)((j,O)=>{!v||(O&&(v.unobserve(O),f.current=!1),j&&v.observe(j))},[v]),[w,S]=T6(x),k=Bw(t);return(0,nt.useEffect)(()=>{!v||!w.current||(v.disconnect(),f.current=!1,v.observe(w.current))},[w,v]),bc(()=>(s({type:fs.RegisterDroppable,element:{id:n,key:a,disabled:r,node:w,rect:d,data:k}}),()=>s({type:fs.UnregisterDroppable,key:a,id:n})),[n]),(0,nt.useEffect)(()=>{r!==c.current.disabled&&(s({type:fs.SetDroppableDisabled,id:n,key:a,disabled:r}),c.current.disabled=r)},[n,a,r,s]),{active:o,rect:d,isOver:l?.id===n,node:w,over:l,setNodeRef:S}}function L9e(e){let{animation:t,children:r}=e,[n,i]=(0,nt.useState)(null),[a,o]=(0,nt.useState)(null),s=F6(r);return!r&&!n&&s&&i(s),bc(()=>{if(!a)return;let l=n?.key,u=n?.props.id;if(l==null||u==null){i(null);return}Promise.resolve(t(u,a)).then(()=>{i(null)})},[t,n,a]),nt.default.createElement(nt.default.Fragment,null,r,n?(0,nt.cloneElement)(n,{ref:o}):null)}var z9e={x:0,y:0,scaleX:1,scaleY:1};function U9e(e){let{children:t}=e;return nt.default.createElement($6.Provider,{value:koe},nt.default.createElement(RN.Provider,{value:z9e},t))}var W9e={position:"fixed",touchAction:"none"},H9e=e=>$w(e)?"transform 250ms ease":void 0,V9e=(0,nt.forwardRef)((e,t)=>{let{as:r,activatorEvent:n,adjustScale:i,children:a,className:o,rect:s,style:l,transform:u,transition:c=H9e}=e;if(!s)return null;let f=i?u:{...u,scaleX:1,scaleY:1},d={...W9e,width:s.width,height:s.height,top:s.top,left:s.left,transform:Lu.Transform.toString(f),transformOrigin:i&&n?H5e(n,s):void 0,transition:typeof c=="function"?c(n):c,...l};return nt.default.createElement(r,{className:o,style:d,ref:t},a)}),G9e=e=>t=>{let{active:r,dragOverlay:n}=t,i={},{styles:a,className:o}=e;if(a!=null&&a.active)for(let[s,l]of Object.entries(a.active))l!==void 0&&(i[s]=r.node.style.getPropertyValue(s),r.node.style.setProperty(s,l));if(a!=null&&a.dragOverlay)for(let[s,l]of Object.entries(a.dragOverlay))l!==void 0&&n.node.style.setProperty(s,l);return o!=null&&o.active&&r.node.classList.add(o.active),o!=null&&o.dragOverlay&&n.node.classList.add(o.dragOverlay),function(){for(let[l,u]of Object.entries(i))r.node.style.setProperty(l,u);o!=null&&o.active&&r.node.classList.remove(o.active)}},Q9e=e=>{let{transform:{initial:t,final:r}}=e;return[{transform:Lu.Transform.toString(t)},{transform:Lu.Transform.toString(r)}]},WU={duration:250,easing:"ease",keyframes:Q9e,sideEffects:G9e({styles:{active:{opacity:"0"}}})};function Y9e(e){let{config:t,draggableNodes:r,droppableContainers:n,measuringConfiguration:i}=e;return N6((a,o)=>{if(t===null)return;let s=r.get(a);if(!s)return;let l=s.node.current;if(!l)return;let u=Eoe(o);if(!u)return;let{transform:c}=nu(o).getComputedStyle(o),f=moe(c);if(!f)return;let d=typeof t=="function"?t:Z9e(t);return xoe(l,i.draggable.measure),d({active:{id:a,data:s.data,node:l,rect:i.draggable.measure(l)},draggableNodes:r,dragOverlay:{node:o,rect:i.dragOverlay.measure(u)},droppableContainers:n,measuringConfiguration:i,transform:f})})}function Z9e(e){let{duration:t,easing:r,sideEffects:n,keyframes:i}={...WU,...e};return a=>{let{active:o,dragOverlay:s,transform:l,...u}=a;if(!t)return;let c={x:s.rect.left-o.rect.left,y:s.rect.top-o.rect.top},f={scaleX:l.scaleX!==1?o.rect.width*l.scaleX/s.rect.width:1,scaleY:l.scaleY!==1?o.rect.height*l.scaleY/s.rect.height:1},d={x:l.x-c.x,y:l.y-c.y,...f},p=i({...u,active:o,dragOverlay:s,transform:{initial:l,final:d}}),[h]=p,m=p[p.length-1];if(JSON.stringify(h)===JSON.stringify(m))return;let g=n?.({active:o,dragOverlay:s,...u}),A=s.node.animate(p,{duration:t,easing:r,fill:"forwards"});return new Promise(b=>{A.onfinish=()=>{g?.(),b()}})}}var loe=0;function X9e(e){return(0,nt.useMemo)(()=>{if(e!=null)return loe++,loe},[e])}var Um=nt.default.memo(e=>{let{adjustScale:t=!1,children:r,dropAnimation:n,style:i,transition:a,modifiers:o,wrapperElement:s="div",className:l,zIndex:u=999}=e,{activatorEvent:c,active:f,activeNodeRect:d,containerNodeRect:p,draggableNodes:h,droppableContainers:m,dragOverlay:g,over:A,measuringConfiguration:b,scrollableAncestors:v,scrollableAncestorRects:x,windowRect:w}=UU(),S=(0,nt.useContext)(RN),k=X9e(f?.id),j=Doe(o,{activatorEvent:c,active:f,activeNodeRect:d,containerNodeRect:p,draggingNodeRect:g.rect,over:A,overlayNodeRect:g.rect,scrollableAncestors:v,scrollableAncestorRects:x,transform:S,windowRect:w}),O=zU(d),C=Y9e({config:n,draggableNodes:h,droppableContainers:m,measuringConfiguration:b}),N=O?g.setRef:void 0;return nt.default.createElement(U9e,null,nt.default.createElement(L9e,{animation:C},f&&k?nt.default.createElement(V9e,{key:k,id:f.id,ref:N,as:s,activatorEvent:c,adjustScale:t,className:l,transition:a,rect:O,style:{zIndex:u,...i},transform:j},r):null))});function Ws(e,t,r){let n=e.slice();return n.splice(r<0?n.length+r:r,0,n.splice(t,1)[0]),n}function K9e(e,t){return e.reduce((r,n,i)=>{let a=t.get(n);return a&&(r[i]=a),r},Array(e.length))}function $N(e){return e!==null&&e>=0}function J9e(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let r=0;r{let{rects:t,activeIndex:r,overIndex:n,index:i}=e,a=Ws(t,n,r),o=t[i],s=a[i];return!s||!o?null:{x:s.left-o.left,y:s.top-o.top,scaleX:s.width/o.width,scaleY:s.height/o.height}};var Ooe="Sortable",Moe=To.default.createContext({activeIndex:-1,containerId:Ooe,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:q6,disabled:{draggable:!1,droppable:!1}});function HU(e){let{children:t,id:r,items:n,strategy:i=q6,disabled:a=!1}=e,{active:o,dragOverlay:s,droppableRects:l,over:u,measureDroppableContainers:c}=UU(),f=cy(Ooe,r),d=Boolean(s.rect!==null),p=(0,To.useMemo)(()=>n.map(S=>typeof S=="object"&&"id"in S?S.id:S),[n]),h=o!=null,m=o?p.indexOf(o.id):-1,g=u?p.indexOf(u.id):-1,A=(0,To.useRef)(p),b=!J9e(p,A.current),v=g!==-1&&m===-1||b,x=e8e(a);bc(()=>{b&&h&&c(p)},[b,p,h,c]),(0,To.useEffect)(()=>{A.current=p},[p]);let w=(0,To.useMemo)(()=>({activeIndex:m,containerId:f,disabled:x,disableTransforms:v,items:p,overIndex:g,useDragOverlay:d,sortedRects:K9e(p,l),strategy:i}),[m,f,x.draggable,x.droppable,v,p,g,l,d,i]);return To.default.createElement(Moe.Provider,{value:w},t)}var t8e=e=>{let{id:t,items:r,activeIndex:n,overIndex:i}=e;return Ws(r,n,i).indexOf(t)},VU=e=>{let{containerId:t,isSorting:r,wasDragging:n,index:i,items:a,newIndex:o,previousItems:s,previousContainerId:l,transition:u}=e;return!u||!n||s!==a&&i===o?!1:r?!0:o!==i&&t===l},r8e={duration:200,easing:"ease"},joe="transform",n8e=Lu.Transition.toString({property:joe,duration:0,easing:"linear"}),i8e={roleDescription:"sortable"};function a8e(e){let{disabled:t,index:r,node:n,rect:i}=e,[a,o]=(0,To.useState)(null),s=(0,To.useRef)(r);return bc(()=>{if(!t&&r!==s.current&&n.current){let l=i.current;if(l){let u=Ay(n.current,{ignoreTransform:!0}),c={x:l.left-u.left,y:l.top-u.top,scaleX:l.width/u.width,scaleY:l.height/u.height};(c.x||c.y)&&o(c)}}r!==s.current&&(s.current=r)},[t,r,n,i]),(0,To.useEffect)(()=>{a&&o(null)},[a]),a}function Noe(e){let{animateLayoutChanges:t=VU,attributes:r,disabled:n,data:i,getNewIndex:a=t8e,id:o,strategy:s,resizeObserverConfig:l,transition:u=r8e}=e,{items:c,containerId:f,activeIndex:d,disabled:p,disableTransforms:h,sortedRects:m,overIndex:g,useDragOverlay:A,strategy:b}=(0,To.useContext)(Moe),v=o8e(n,p),x=c.indexOf(o),w=(0,To.useMemo)(()=>({sortable:{containerId:f,index:x,items:c},...i}),[f,i,x,c]),S=(0,To.useMemo)(()=>c.slice(c.indexOf(o)),[c,o]),{rect:k,node:j,isOver:O,setNodeRef:C}=zu({id:o,data:w,disabled:v.droppable,resizeObserverConfig:{updateMeasurementsFor:S,...l}}),{active:N,activatorEvent:D,activeNodeRect:P,attributes:q,setNodeRef:z,listeners:I,isDragging:T,over:L,setActivatorNodeRef:_,transform:Y}=Us({id:o,data:w,attributes:{...i8e,...r},disabled:v.draggable}),oe=Wae(C,z),te=Boolean(N),Q=te&&!h&&$N(d)&&$N(g),fe=!A&&T,Ie=fe&&Q?Y:null,Oe=Q?Ie??(s??b)({rects:m,activeNodeRect:P,activeIndex:d,overIndex:g,index:x}):null,ve=$N(d)&&$N(g)?a({id:o,items:c,activeIndex:d,overIndex:g}):x,ye=N?.id,me=(0,To.useRef)({activeId:ye,items:c,newIndex:ve,containerId:f}),ke=c!==me.current.items,$=t({active:N,containerId:f,isDragging:T,isSorting:te,id:o,index:x,items:c,newIndex:me.current.newIndex,previousItems:me.current.items,previousContainerId:me.current.containerId,transition:u,wasDragging:me.current.activeId!=null}),ae=a8e({disabled:!$,index:x,node:j,rect:k});return(0,To.useEffect)(()=>{te&&me.current.newIndex!==ve&&(me.current.newIndex=ve),f!==me.current.containerId&&(me.current.containerId=f),c!==me.current.items&&(me.current.items=c)},[te,ve,f,c]),(0,To.useEffect)(()=>{if(ye===me.current.activeId)return;if(ye&&!me.current.activeId){me.current.activeId=ye;return}let U=setTimeout(()=>{me.current.activeId=ye},50);return()=>clearTimeout(U)},[ye]),{active:N,activeIndex:d,attributes:q,data:w,rect:k,index:x,newIndex:ve,items:c,isOver:O,isSorting:te,isDragging:T,listeners:I,node:j,overIndex:g,over:L,setNodeRef:oe,setActivatorNodeRef:_,setDroppableNodeRef:C,setDraggableNodeRef:z,transform:ae??Oe,transition:ce()};function ce(){if(ae||ke&&me.current.newIndex===x)return n8e;if(!(fe&&!$w(D)||!u)&&(te||$))return Lu.Transition.toString({...u,property:joe})}}function o8e(e,t){var r,n;return typeof e=="boolean"?{draggable:e,droppable:!1}:{draggable:(r=e?.draggable)!=null?r:t.draggable,droppable:(n=e?.droppable)!=null?n:t.droppable}}function qN(e){if(!e)return!1;let t=e.data.current;return!!(t&&"sortable"in t&&typeof t.sortable=="object"&&"containerId"in t.sortable&&"items"in t.sortable&&"index"in t.sortable)}var s8e=[$n.Down,$n.Right,$n.Up,$n.Left],LN=(e,t)=>{let{context:{active:r,collisionRect:n,droppableRects:i,droppableContainers:a,over:o,scrollableAncestors:s}}=t;if(s8e.includes(e.code)){if(e.preventDefault(),!r||!n)return;let l=[];a.getEnabled().forEach(f=>{if(!f||f!=null&&f.disabled)return;let d=i.get(f.id);if(!!d)switch(e.code){case $n.Down:n.topd.top&&l.push(f);break;case $n.Left:n.left>d.left&&l.push(f);break;case $n.Right:n.left1&&(c=u[1].id),c!=null){let f=a.get(r.id),d=a.get(c),p=d?i.get(d.id):null,h=d?.node.current;if(h&&p&&f&&d){let g=R6(h).some((S,k)=>s[k]!==S),A=Toe(f,d),b=l8e(f,d),v=g||!A?{x:0,y:0}:{x:b?n.width-p.width:0,y:b?n.height-p.height:0},x={x:p.left,y:p.top};return v.x&&v.y?x:dy(x,v)}}}};function Toe(e,t){return!qN(e)||!qN(t)?!1:e.data.current.sortable.containerId===t.data.current.sortable.containerId}function l8e(e,t){return!qN(e)||!qN(t)||!Toe(e,t)?!1:e.data.current.sortable.index{let r=e.spaceManager.uriByString(t);if(!r)return null;let n=r.basePath,i=e.spacesIndex.get(r.basePath);if(!i)return null;let a,o,s,l;if(r.refType=="frame"){s=r.ref;let u=await e.spaceManager.readAllFrames(n).then(c=>Object.values(c).map(f=>f.schema));s&&u&&(l=u.find(c=>c.id==s)?.name,a=or(u.find(c=>c.id==s)?.def)?.db,o=e.contextsIndex.get(n)?.schemas.find(c=>c.id==a)?.name)}else r.refType=="context"&&(a=r.ref,o=e.contextsIndex.get(n)?.schemas.find(u=>u.id==a)?.name);return{space:n,spaceName:i.name,schema:a,schemaName:o,view:s,viewName:l}},UN=async(e,t,r,n)=>{let i=await e.readTable(t.path,r);i&&await n(i,t)},$A=async(e,t,r)=>{let n=await e.contextForSpace(t.path);n&&await r(n,t)},wc=async(e,t,r,n)=>{await e.saveTable(t.path,r,n).then(i=>i&&e.superstate.reloadContextByPath(t.path,!0))};var Foe=(e,t,r,n,i)=>({...e,rows:e.rows.map(a=>a[t]==r?{...a,[n]:Bi(sr(a[n]).filter(o=>o!=i))}:a)}),u8e=(e,t,r,n,i)=>({...e,rows:e.rows.map(a=>a[t]==r?{...a,[n]:i}:a)});var c8e=(e,t,r)=>({...e,rows:r?Dx(e.rows,r,t):[...e.rows,...t]}),f8e=(e,t,r)=>({...e,rows:e.rows.map((n,i)=>i==r?t:n)}),_oe=async(e,t,r,n,i,a,o)=>{UN(e,t,r,async s=>{let l={...s,rows:s.rows.map((u,c)=>c==n?{...u,[i]:a}:u)};return o&&(l={...l,rows:Ws(l.rows,n,o)}),xc.default.isEqual(s,l)||(e.superstate.settings.enhancedLogs&&console.log("Saving Context Change: Update Table Value"),await wc(e,t,l)),l})},WN=async(e,t,r,n,i,a,o)=>{e.contextForSpace(t.path).then(s=>{let u=(a??u8e)(s,mt,r,n,i);return o&&(u=dL(u,[r],o)),e.superstate.settings.enhancedLogs&&console.log("Saving Context Change: Update Context Value"),wc(e,t,u).then(c=>u)})};var d8e=async(e,t,r)=>{let n=t;e.spacesIndex.has(n)&&(n=Af(e,e.spacesIndex.get(n).space));let i=await e.spaceManager.readProperties(n);return i?Object.keys(i).reduce((a,o)=>r.some(s=>s.name==o)?{...a,[o]:Ri(o,i[o],r.find(s=>s.name==o).type)}:a,{}):{}},Poe=(e,t)=>t=="$space"?ire:t=="$context"?sd.rows:e.contextsIndex.get(t)?.contextTable?.cols??[],GU=async(e,t,r)=>{let n=async a=>{let o=a.rows.some(l=>l[mt]===t),s=await d8e(e,t,a.cols.filter(l=>l.name!=mt&&l.type!="fileprop"));return o?a.rows.map(l=>l[mt]==t?{...l,...s}:l):[...a.rows,{[mt]:t,...s}]},i=r.map(a=>$A(e.spaceManager,a,async(o,s)=>{let l=await n(o),u={...o,rows:l};return xc.default.isEqual(o,u)||(e.settings.enhancedLogs&&console.log("Saving Context Change: Update Context Path Properties"),await wc(e.spaceManager,s,u,!0)),u}));await Promise.all(i)},HN=async(e,t,r,n,i)=>UN(e,t,r,async(a,o)=>{let s=f8e(a,i,n);return xc.default.isEqual(a,s)||(e.superstate.settings.enhancedLogs&&console.log("Saving Context Change: Update Table Row"),await wc(e,o,s)),s}),Ioe=async(e,t,r,n,i)=>{let a=o=>({...o,rows:o.rows.map(s=>s[mt]==t?{...s,[r]:n}:s)});return $A(e,i,async(o,s)=>{let l=a(o);return xc.default.isEqual(o,l)||(e.superstate.settings.enhancedLogs&&console.log("Saving Context Change: Update Value in Context"),await wc(e,s,l)),l})},Boe=async(e,t,r,n)=>{let i=o=>{let s=o.cols.map(l=>l.type.startsWith("context")&&l.value==t?{...l,value:r}:l);return{...o,cols:s}},a=n.map(o=>$A(e,o,async(s,l)=>{let u=i(s);return xc.default.isEqual(s,u)||(e.superstate.settings.enhancedLogs&&console.log("Saving Context Change: Rename Tag in Context"),await wc(e,l,u)),u}));return Promise.all(a)},Roe=async(e,t,r)=>{let n=a=>{let o=a.cols.map(s=>s.type.startsWith("context")&&s.value==t?{...s,type:"link-multi"}:s);return{...a,cols:o}},i=r.map(a=>$A(e,a,async(o,s)=>{let l=n(o);return xc.default.isEqual(o,l)||(e.superstate.settings.enhancedLogs&&console.log("Saving Context Change: Remove Tag in Context"),await wc(e,s,l)),l}));return Promise.all(i)},$oe=async(e,t,r,n,i)=>UN(e,r,n,async(a,o)=>{let s=c8e(a,[t],i);return xc.default.isEqual(a,s)||(e.superstate.settings.enhancedLogs&&console.log("Saving Context Change: Add Row in Table"),await wc(e,o,s)),s}),qoe=async(e,t,r,n)=>UN(e,t,r,async(i,a)=>{let o={...i,rows:i.rows.filter((s,l)=>l!=n)};return xc.default.isEqual(i,o)||(e.superstate.settings.enhancedLogs&&console.log("Saving Context Change: Delete Row in Table"),await wc(e,a,o)),o});var Loe=async(e,t,r,n)=>{let i=n.map(a=>$A(e,a,async(o,s)=>{let l=fL(o.cols),u={...o,rows:o.rows.map(c=>lre(e,c,t,r,l))};return xc.default.isEqual(o,u)||(e.superstate.settings.enhancedLogs&&console.log("Saving Context Change: Rename Link in Context"),await wc(e,s,u)),u}));return Promise.all(i)},zoe=async(e,t,r)=>{let n=r.map(i=>$A(e,i,async(a,o)=>{let s=fL(a.cols),l={...a,rows:a.rows.map(u=>sre(e,u,t,s))};return xc.default.isEqual(a,l)||(e.superstate.settings.enhancedLogs&&console.log("Saving Context Change: Remove link in context"),await wc(e,o,l)),l}));return Promise.all(n)},Uoe=async(e,t,r,n)=>{let i=n.map(a=>$A(e,a,async(o,s)=>{let l=ure(o,t,r);return xc.default.isEqual(o,l)||await wc(e,s,l),l}));return Promise.all(i)},Woe=async(e,t,r)=>{let n=r.map(i=>$A(e,i,async(a,o)=>{let s=cre(a,t);return xc.default.isEqual(a,s)||(e.superstate.settings.enhancedLogs&&console.log("Saving Context Change: Remove Path in Context"),await wc(e,o,s)),s}));return Promise.all(n)},Hoe=async(e,t,r,n)=>$A(e,n,async(i,a)=>{let o=dL(i,t,r);return xc.default.isEqual(i,o)||(e.superstate.settings.enhancedLogs&&console.log("Saving Context Change: Reorder path in Context"),await wc(e,a,o,!0)),o});function Fn(){return Fn=Object.assign?Object.assign.bind():function(e){for(var t=1;te[t])}var aT=["Matrix","Array"],oT=["number","BigNumber","Fraction"];function Xoe(e,t){function r(n){if(n){var i=Ww(e,Bt);Zoe(n,"matrix",aT),Zoe(n,"number",oT),QU(e,n);var a=Ww(e,Bt),o=Ww(n,Bt);return t("config",a,i,o),a}else return Ww(e,Bt)}return r.MATRIX_OPTIONS=aT,r.NUMBER_OPTIONS=oT,Object.keys(gy).forEach(n=>{Object.defineProperty(r,n,{get:()=>e[n],enumerable:!0,configurable:!0})}),r}function p8e(e,t){return e.indexOf(t)!==-1}function Zoe(e,t,r){e[t]!==void 0&&!p8e(r,e[t])&&console.warn('Warning: Unknown value "'+e[t]+'" for configuration option "'+t+'". Available options: '+r.map(n=>JSON.stringify(n)).join(", ")+".")}var it=function(t){if(t)throw new Error(`The global config is readonly. + `},U5e={onDragStart(e){let{active:t}=e;return"Picked up draggable item "+t.id+"."},onDragOver(e){let{active:t,over:r}=e;return r?"Draggable item "+t.id+" was moved over droppable area "+r.id+".":"Draggable item "+t.id+" is no longer over a droppable area."},onDragEnd(e){let{active:t,over:r}=e;return r?"Draggable item "+t.id+" was dropped over droppable area "+r.id:"Draggable item "+t.id+" was dropped."},onDragCancel(e){let{active:t}=e;return"Dragging was cancelled. Draggable item "+t.id+" was dropped."}};function W5e(e){let{announcements:t=U5e,container:r,hiddenTextDescribedById:n,screenReaderInstructions:i=z5e}=e,{announce:a,announcement:o}=Zae(),s=cy("DndLiveRegion"),[l,u]=(0,nt.useState)(!1);if((0,nt.useEffect)(()=>{u(!0)},[]),Ca((0,nt.useMemo)(()=>({onDragStart(f){let{active:d}=f;a(t.onDragStart({active:d}))},onDragMove(f){let{active:d,over:p}=f;t.onDragMove&&a(t.onDragMove({active:d,over:p}))},onDragOver(f){let{active:d,over:p}=f;a(t.onDragOver({active:d,over:p}))},onDragEnd(f){let{active:d,over:p}=f;a(t.onDragEnd({active:d,over:p}))},onDragCancel(f){let{active:d,over:p}=f;a(t.onDragCancel({active:d,over:p}))}}),[a,t])),!l)return null;let c=nt.default.createElement(nt.default.Fragment,null,nt.default.createElement(Qae,{id:n,value:i.draggable}),nt.default.createElement(Yae,{id:s,announcement:o}));return r?(0,I0.createPortal)(c,r):c}var fs;(function(e){e.DragStart="dragStart",e.DragMove="dragMove",e.DragEnd="dragEnd",e.DragCancel="dragCancel",e.DragOver="dragOver",e.RegisterDroppable="registerDroppable",e.SetDroppableDisabled="setDroppableDisabled",e.UnregisterDroppable="unregisterDroppable"})(fs||(fs={}));function FN(){}function Pp(e,t){return(0,nt.useMemo)(()=>({sensor:e,options:t??{}}),[e,t])}function qw(){for(var e=arguments.length,t=new Array(e),r=0;r[...t].filter(n=>n!=null),[...t])}var Fp=Object.freeze({x:0,y:0});function coe(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function H5e(e,t){let r=_6(e);if(!r)return"0 0";let n={x:(r.x-t.left)/t.width*100,y:(r.y-t.top)/t.height*100};return n.x+"% "+n.y+"%"}function foe(e,t){let{data:{value:r}}=e,{data:{value:n}}=t;return r-n}function V5e(e,t){let{data:{value:r}}=e,{data:{value:n}}=t;return n-r}function Xae(e){let{left:t,top:r,height:n,width:i}=e;return[{x:t,y:r},{x:t+i,y:r},{x:t,y:r+n},{x:t+i,y:r+n}]}function qU(e,t){if(!e||e.length===0)return null;let[r]=e;return t?r[t]:r}function Kae(e,t,r){return t===void 0&&(t=e.left),r===void 0&&(r=e.top),{x:t+e.width*.5,y:r+e.height*.5}}var IN=e=>{let{collisionRect:t,droppableRects:r,droppableContainers:n}=e,i=Kae(t,t.left,t.top),a=[];for(let o of n){let{id:s}=o,l=r.get(s);if(l){let u=coe(Kae(l),i);a.push({id:s,data:{droppableContainer:o,value:u}})}}return a.sort(foe)},doe=e=>{let{collisionRect:t,droppableRects:r,droppableContainers:n}=e,i=Xae(t),a=[];for(let o of n){let{id:s}=o,l=r.get(s);if(l){let u=Xae(l),c=i.reduce((d,p,h)=>d+coe(u[h],p),0),f=Number((c/4).toFixed(4));a.push({id:s,data:{droppableContainer:o,value:f}})}}return a.sort(foe)};function G5e(e,t){let r=Math.max(t.top,e.top),n=Math.max(t.left,e.left),i=Math.min(t.left+t.width,e.left+e.width),a=Math.min(t.top+t.height,e.top+e.height),o=i-n,s=a-r;if(n{let{collisionRect:t,droppableRects:r,droppableContainers:n}=e,i=[];for(let a of n){let{id:o}=a,s=r.get(o);if(s){let l=G5e(s,t);l>0&&i.push({id:o,data:{droppableContainer:a,value:l}})}}return i.sort(V5e)};function Q5e(e,t,r){return{...e,scaleX:t&&r?t.width/r.width:1,scaleY:t&&r?t.height/r.height:1}}function poe(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:Fp}function Y5e(e){return function(r){for(var n=arguments.length,i=new Array(n>1?n-1:0),a=1;a({...o,top:o.top+e*s.y,bottom:o.bottom+e*s.y,left:o.left+e*s.x,right:o.right+e*s.x}),{...r})}}var Z5e=Y5e(1);function moe(e){if(e.startsWith("matrix3d(")){let t=e.slice(9,-1).split(/, /);return{x:+t[12],y:+t[13],scaleX:+t[0],scaleY:+t[5]}}else if(e.startsWith("matrix(")){let t=e.slice(7,-1).split(/, /);return{x:+t[4],y:+t[5],scaleX:+t[0],scaleY:+t[3]}}return null}function X5e(e,t,r){let n=moe(t);if(!n)return e;let{scaleX:i,scaleY:a,x:o,y:s}=n,l=e.left-o-(1-i)*parseFloat(r),u=e.top-s-(1-a)*parseFloat(r.slice(r.indexOf(" ")+1)),c=i?e.width/i:e.width,f=a?e.height/a:e.height;return{width:c,height:f,top:u,right:l+c,bottom:u+f,left:l}}var K5e={ignoreTransform:!1};function Ay(e,t){t===void 0&&(t=K5e);let r=e.getBoundingClientRect();if(t.ignoreTransform){let{transform:u,transformOrigin:c}=nu(e).getComputedStyle(e);u&&(r=X5e(r,u,c))}let{top:n,left:i,width:a,height:o,bottom:s,right:l}=r;return{top:n,left:i,width:a,height:o,bottom:s,right:l}}function Jae(e){return Ay(e,{ignoreTransform:!0})}function J5e(e){let t=e.innerWidth,r=e.innerHeight;return{top:0,left:0,right:t,bottom:r,width:t,height:r}}function e9e(e,t){return t===void 0&&(t=nu(e).getComputedStyle(e)),t.position==="fixed"}function t9e(e,t){t===void 0&&(t=nu(e).getComputedStyle(e));let r=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].some(i=>{let a=t[i];return typeof a=="string"?r.test(a):!1})}function R6(e,t){let r=[];function n(i){if(t!=null&&r.length>=t||!i)return r;if(NN(i)&&i.scrollingElement!=null&&!r.includes(i.scrollingElement))return r.push(i.scrollingElement),r;if(!Iw(i)||TU(i)||r.includes(i))return r;let a=nu(e).getComputedStyle(i);return i!==e&&t9e(i,a)&&r.push(i),e9e(i,a)?r:n(i.parentNode)}return e?n(e):r}function hoe(e){let[t]=R6(e,1);return t??null}function FU(e){return!j6||!e?null:ly(e)?e:jN(e)?NN(e)||e===uy(e).scrollingElement?window:Iw(e)?e:null:null}function Aoe(e){return ly(e)?e.scrollX:e.scrollLeft}function goe(e){return ly(e)?e.scrollY:e.scrollTop}function BU(e){return{x:Aoe(e),y:goe(e)}}var zs;(function(e){e[e.Forward=1]="Forward",e[e.Backward=-1]="Backward"})(zs||(zs={}));function voe(e){return!j6||!e?!1:e===document.scrollingElement}function yoe(e){let t={x:0,y:0},r=voe(e)?{height:window.innerHeight,width:window.innerWidth}:{height:e.clientHeight,width:e.clientWidth},n={x:e.scrollWidth-r.width,y:e.scrollHeight-r.height},i=e.scrollTop<=t.y,a=e.scrollLeft<=t.x,o=e.scrollTop>=n.y,s=e.scrollLeft>=n.x;return{isTop:i,isLeft:a,isBottom:o,isRight:s,maxScroll:n,minScroll:t}}var r9e={x:.2,y:.2};function n9e(e,t,r,n,i){let{top:a,left:o,right:s,bottom:l}=r;n===void 0&&(n=10),i===void 0&&(i=r9e);let{isTop:u,isBottom:c,isLeft:f,isRight:d}=yoe(e),p={x:0,y:0},h={x:0,y:0},m={height:t.height*i.y,width:t.width*i.x};return!u&&a<=t.top+m.height?(p.y=zs.Backward,h.y=n*Math.abs((t.top+m.height-a)/m.height)):!c&&l>=t.bottom-m.height&&(p.y=zs.Forward,h.y=n*Math.abs((t.bottom-m.height-l)/m.height)),!d&&s>=t.right-m.width?(p.x=zs.Forward,h.x=n*Math.abs((t.right-m.width-s)/m.width)):!f&&o<=t.left+m.width&&(p.x=zs.Backward,h.x=n*Math.abs((t.left+m.width-o)/m.width)),{direction:p,speed:h}}function i9e(e){if(e===document.scrollingElement){let{innerWidth:a,innerHeight:o}=window;return{top:0,left:0,right:a,bottom:o,width:a,height:o}}let{top:t,left:r,right:n,bottom:i}=e.getBoundingClientRect();return{top:t,left:r,right:n,bottom:i,width:e.clientWidth,height:e.clientHeight}}function boe(e){return e.reduce((t,r)=>fy(t,BU(r)),Fp)}function a9e(e){return e.reduce((t,r)=>t+Aoe(r),0)}function o9e(e){return e.reduce((t,r)=>t+goe(r),0)}function xoe(e,t){if(t===void 0&&(t=Ay),!e)return;let{top:r,left:n,bottom:i,right:a}=t(e);!hoe(e)||(i<=0||a<=0||r>=window.innerHeight||n>=window.innerWidth)&&e.scrollIntoView({block:"center",inline:"center"})}var s9e=[["x",["left","right"],a9e],["y",["top","bottom"],o9e]],I6=class{constructor(t,r){this.rect=void 0,this.width=void 0,this.height=void 0,this.top=void 0,this.bottom=void 0,this.right=void 0,this.left=void 0;let n=R6(r),i=boe(n);this.rect={...t},this.width=t.width,this.height=t.height;for(let[a,o,s]of s9e)for(let l of o)Object.defineProperty(this,l,{get:()=>{let u=s(n),c=i[a]-u;return this.rect[l]+c},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}},my=class{constructor(t){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(r=>{var n;return(n=this.target)==null?void 0:n.removeEventListener(...r)})},this.target=t}add(t,r,n){var i;(i=this.target)==null||i.addEventListener(t,r,n),this.listeners.push([t,r,n])}};function l9e(e){let{EventTarget:t}=nu(e);return e instanceof t?e:uy(e)}function _U(e,t){let r=Math.abs(e.x),n=Math.abs(e.y);return typeof t=="number"?Math.sqrt(r**2+n**2)>t:"x"in t&&"y"in t?r>t.x&&n>t.y:"x"in t?r>t.x:"y"in t?n>t.y:!1}var Sd;(function(e){e.Click="click",e.DragStart="dragstart",e.Keydown="keydown",e.ContextMenu="contextmenu",e.Resize="resize",e.SelectionChange="selectionchange",e.VisibilityChange="visibilitychange"})(Sd||(Sd={}));function eoe(e){e.preventDefault()}function u9e(e){e.stopPropagation()}var $n;(function(e){e.Space="Space",e.Down="ArrowDown",e.Right="ArrowRight",e.Left="ArrowLeft",e.Up="ArrowUp",e.Esc="Escape",e.Enter="Enter"})($n||($n={}));var woe={start:[$n.Space,$n.Enter],cancel:[$n.Esc],end:[$n.Space,$n.Enter]},c9e=(e,t)=>{let{currentCoordinates:r}=t;switch(e.code){case $n.Right:return{...r,x:r.x+25};case $n.Left:return{...r,x:r.x-25};case $n.Down:return{...r,y:r.y+25};case $n.Up:return{...r,y:r.y-25}}},B0=class{constructor(t){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=t;let{event:{target:r}}=t;this.props=t,this.listeners=new my(uy(r)),this.windowListeners=new my(nu(r)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(Sd.Resize,this.handleCancel),this.windowListeners.add(Sd.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(Sd.Keydown,this.handleKeyDown))}handleStart(){let{activeNode:t,onStart:r}=this.props,n=t.node.current;n&&xoe(n),r(Fp)}handleKeyDown(t){if($w(t)){let{active:r,context:n,options:i}=this.props,{keyboardCodes:a=woe,coordinateGetter:o=c9e,scrollBehavior:s="smooth"}=i,{code:l}=t;if(a.end.includes(l)){this.handleEnd(t);return}if(a.cancel.includes(l)){this.handleCancel(t);return}let{collisionRect:u}=n.current,c=u?{x:u.left,y:u.top}:Fp;this.referenceCoordinates||(this.referenceCoordinates=c);let f=o(t,{active:r,context:n.current,currentCoordinates:c});if(f){let d=dy(f,c),p={x:0,y:0},{scrollableAncestors:h}=n.current;for(let m of h){let g=t.code,{isTop:A,isRight:b,isLeft:v,isBottom:x,maxScroll:w,minScroll:S}=yoe(m),k=i9e(m),j={x:Math.min(g===$n.Right?k.right-k.width/2:k.right,Math.max(g===$n.Right?k.left:k.left+k.width/2,f.x)),y:Math.min(g===$n.Down?k.bottom-k.height/2:k.bottom,Math.max(g===$n.Down?k.top:k.top+k.height/2,f.y))},O=g===$n.Right&&!b||g===$n.Left&&!v,C=g===$n.Down&&!x||g===$n.Up&&!A;if(O&&j.x!==f.x){let N=m.scrollLeft+d.x,D=g===$n.Right&&N<=w.x||g===$n.Left&&N>=S.x;if(D&&!d.y){m.scrollTo({left:N,behavior:s});return}D?p.x=m.scrollLeft-N:p.x=g===$n.Right?m.scrollLeft-w.x:m.scrollLeft-S.x,p.x&&m.scrollBy({left:-p.x,behavior:s});break}else if(C&&j.y!==f.y){let N=m.scrollTop+d.y,D=g===$n.Down&&N<=w.y||g===$n.Up&&N>=S.y;if(D&&!d.x){m.scrollTo({top:N,behavior:s});return}D?p.y=m.scrollTop-N:p.y=g===$n.Down?m.scrollTop-w.y:m.scrollTop-S.y,p.y&&m.scrollBy({top:-p.y,behavior:s});break}}this.handleMove(t,fy(dy(f,this.referenceCoordinates),p))}}}handleMove(t,r){let{onMove:n}=this.props;t.preventDefault(),n(r)}handleEnd(t){let{onEnd:r}=this.props;t.preventDefault(),this.detach(),r()}handleCancel(t){let{onCancel:r}=this.props;t.preventDefault(),this.detach(),r()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}};B0.activators=[{eventName:"onKeyDown",handler:(e,t,r)=>{let{keyboardCodes:n=woe,onActivation:i}=t,{active:a}=r,{code:o}=e.nativeEvent;if(n.start.includes(o)){let s=a.activatorNode.current;return s&&e.target!==s?!1:(e.preventDefault(),i?.({event:e.nativeEvent}),!0)}return!1}}];function toe(e){return Boolean(e&&"distance"in e)}function roe(e){return Boolean(e&&"delay"in e)}var B6=class{constructor(t,r,n){var i;n===void 0&&(n=l9e(t.event.target)),this.props=void 0,this.events=void 0,this.autoScrollEnabled=!0,this.document=void 0,this.activated=!1,this.initialCoordinates=void 0,this.timeoutId=null,this.listeners=void 0,this.documentListeners=void 0,this.windowListeners=void 0,this.props=t,this.events=r;let{event:a}=t,{target:o}=a;this.props=t,this.events=r,this.document=uy(o),this.documentListeners=new my(this.document),this.listeners=new my(n),this.windowListeners=new my(nu(o)),this.initialCoordinates=(i=_6(a))!=null?i:Fp,this.handleStart=this.handleStart.bind(this),this.handleMove=this.handleMove.bind(this),this.handleEnd=this.handleEnd.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.removeTextSelection=this.removeTextSelection.bind(this),this.attach()}attach(){let{events:t,props:{options:{activationConstraint:r,bypassActivationConstraint:n}}}=this;if(this.listeners.add(t.move.name,this.handleMove,{passive:!1}),this.listeners.add(t.end.name,this.handleEnd),this.windowListeners.add(Sd.Resize,this.handleCancel),this.windowListeners.add(Sd.DragStart,eoe),this.windowListeners.add(Sd.VisibilityChange,this.handleCancel),this.windowListeners.add(Sd.ContextMenu,eoe),this.documentListeners.add(Sd.Keydown,this.handleKeydown),r){if(n!=null&&n({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(roe(r)){this.timeoutId=setTimeout(this.handleStart,r.delay);return}if(toe(r))return}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),this.timeoutId!==null&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handleStart(){let{initialCoordinates:t}=this,{onStart:r}=this.props;t&&(this.activated=!0,this.documentListeners.add(Sd.Click,u9e,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(Sd.SelectionChange,this.removeTextSelection),r(t))}handleMove(t){var r;let{activated:n,initialCoordinates:i,props:a}=this,{onMove:o,options:{activationConstraint:s}}=a;if(!i)return;let l=(r=_6(t))!=null?r:Fp,u=dy(i,l);if(!n&&s){if(toe(s)){if(s.tolerance!=null&&_U(u,s.tolerance))return this.handleCancel();if(_U(u,s.distance))return this.handleStart()}return roe(s)&&_U(u,s.tolerance)?this.handleCancel():void 0}t.cancelable&&t.preventDefault(),o(l)}handleEnd(){let{onEnd:t}=this.props;this.detach(),t()}handleCancel(){let{onCancel:t}=this.props;this.detach(),t()}handleKeydown(t){t.code===$n.Esc&&this.handleCancel()}removeTextSelection(){var t;(t=this.document.getSelection())==null||t.removeAllRanges()}},f9e={move:{name:"pointermove"},end:{name:"pointerup"}},_N=class extends B6{constructor(t){let{event:r}=t,n=uy(r.target);super(t,f9e,n)}};_N.activators=[{eventName:"onPointerDown",handler:(e,t)=>{let{nativeEvent:r}=e,{onActivation:n}=t;return!r.isPrimary||r.button!==0?!1:(n?.({event:r}),!0)}}];var d9e={move:{name:"mousemove"},end:{name:"mouseup"}},RU;(function(e){e[e.RightClick=2]="RightClick"})(RU||(RU={}));var BA=class extends B6{constructor(t){super(t,d9e,uy(t.event.target))}};BA.activators=[{eventName:"onMouseDown",handler:(e,t)=>{let{nativeEvent:r}=e,{onActivation:n}=t;return r.button===RU.RightClick?!1:(n?.({event:r}),!0)}}];var PU={move:{name:"touchmove"},end:{name:"touchend"}},RA=class extends B6{constructor(t){super(t,PU)}static setup(){return window.addEventListener(PU.move.name,t,{capture:!1,passive:!1}),function(){window.removeEventListener(PU.move.name,t)};function t(){}}};RA.activators=[{eventName:"onTouchStart",handler:(e,t)=>{let{nativeEvent:r}=e,{onActivation:n}=t,{touches:i}=r;return i.length>1?!1:(n?.({event:r}),!0)}}];var P6;(function(e){e[e.Pointer=0]="Pointer",e[e.DraggableRect=1]="DraggableRect"})(P6||(P6={}));var PN;(function(e){e[e.TreeOrder=0]="TreeOrder",e[e.ReversedTreeOrder=1]="ReversedTreeOrder"})(PN||(PN={}));function p9e(e){let{acceleration:t,activator:r=P6.Pointer,canScroll:n,draggingRect:i,enabled:a,interval:o=5,order:s=PN.TreeOrder,pointerCoordinates:l,scrollableAncestors:u,scrollableAncestorRects:c,delta:f,threshold:d}=e,p=h9e({delta:f,disabled:!a}),[h,m]=Hae(),g=(0,nt.useRef)({x:0,y:0}),A=(0,nt.useRef)({x:0,y:0}),b=(0,nt.useMemo)(()=>{switch(r){case P6.Pointer:return l?{top:l.y,bottom:l.y,left:l.x,right:l.x}:null;case P6.DraggableRect:return i}},[r,i,l]),v=(0,nt.useRef)(null),x=(0,nt.useCallback)(()=>{let S=v.current;if(!S)return;let k=g.current.x*A.current.x,j=g.current.y*A.current.y;S.scrollBy(k,j)},[]),w=(0,nt.useMemo)(()=>s===PN.TreeOrder?[...u].reverse():u,[s,u]);(0,nt.useEffect)(()=>{if(!a||!u.length||!b){m();return}for(let S of w){if(n?.(S)===!1)continue;let k=u.indexOf(S),j=c[k];if(!j)continue;let{direction:O,speed:C}=n9e(S,j,b,t,d);for(let N of["x","y"])p[N][O[N]]||(C[N]=0,O[N]=0);if(C.x>0||C.y>0){m(),v.current=S,h(x,o),g.current=C,A.current=O;return}}g.current={x:0,y:0},A.current={x:0,y:0},m()},[t,x,n,m,a,o,JSON.stringify(b),JSON.stringify(p),h,u,w,c,JSON.stringify(d)])}var m9e={x:{[zs.Backward]:!1,[zs.Forward]:!1},y:{[zs.Backward]:!1,[zs.Forward]:!1}};function h9e(e){let{delta:t,disabled:r}=e,n=F6(t);return Rw(i=>{if(r||!n||!i)return m9e;let a={x:Math.sign(t.x-n.x),y:Math.sign(t.y-n.y)};return{x:{[zs.Backward]:i.x[zs.Backward]||a.x===-1,[zs.Forward]:i.x[zs.Forward]||a.x===1},y:{[zs.Backward]:i.y[zs.Backward]||a.y===-1,[zs.Forward]:i.y[zs.Forward]||a.y===1}}},[r,t,n])}function A9e(e,t){let r=t!==null?e.get(t):void 0,n=r?r.node.current:null;return Rw(i=>{var a;return t===null?null:(a=n??i)!=null?a:null},[n,t])}function g9e(e,t){return(0,nt.useMemo)(()=>e.reduce((r,n)=>{let{sensor:i}=n,a=i.activators.map(o=>({eventName:o.eventName,handler:t(o.handler,n)}));return[...r,...a]},[]),[e,t])}var _p;(function(e){e[e.Always=0]="Always",e[e.BeforeDragging=1]="BeforeDragging",e[e.WhileDragging=2]="WhileDragging"})(_p||(_p={}));var $U;(function(e){e.Optimized="optimized"})($U||($U={}));var noe=new Map;function v9e(e,t){let{dragging:r,dependencies:n,config:i}=t,[a,o]=(0,nt.useState)(null),{frequency:s,measure:l,strategy:u}=i,c=(0,nt.useRef)(e),f=g(),d=Bw(f),p=(0,nt.useCallback)(function(A){A===void 0&&(A=[]),!d.current&&o(b=>b===null?A:b.concat(A.filter(v=>!b.includes(v))))},[d]),h=(0,nt.useRef)(null),m=Rw(A=>{if(f&&!r)return noe;if(!A||A===noe||c.current!==e||a!=null){let b=new Map;for(let v of e){if(!v)continue;if(a&&a.length>0&&!a.includes(v.id)&&v.rect.current){b.set(v.id,v.rect.current);continue}let x=v.node.current,w=x?new I6(l(x),x):null;v.rect.current=w,w&&b.set(v.id,w)}return b}return A},[e,a,r,f,l]);return(0,nt.useEffect)(()=>{c.current=e},[e]),(0,nt.useEffect)(()=>{f||p()},[r,f]),(0,nt.useEffect)(()=>{a&&a.length>0&&o(null)},[JSON.stringify(a)]),(0,nt.useEffect)(()=>{f||typeof s!="number"||h.current!==null||(h.current=setTimeout(()=>{p(),h.current=null},s))},[s,f,p,...n]),{droppableRects:m,measureDroppableContainers:p,measuringScheduled:a!=null};function g(){switch(u){case _p.Always:return!1;case _p.BeforeDragging:return r;default:return!r}}}function zU(e,t){return Rw(r=>e?r||(typeof t=="function"?t(e):e):null,[t,e])}function y9e(e,t){return zU(e,t)}function b9e(e){let{callback:t,disabled:r}=e,n=N6(t),i=(0,nt.useMemo)(()=>{if(r||typeof window>"u"||typeof window.MutationObserver>"u")return;let{MutationObserver:a}=window;return new a(n)},[n,r]);return(0,nt.useEffect)(()=>()=>i?.disconnect(),[i]),i}function BN(e){let{callback:t,disabled:r}=e,n=N6(t),i=(0,nt.useMemo)(()=>{if(r||typeof window>"u"||typeof window.ResizeObserver>"u")return;let{ResizeObserver:a}=window;return new a(n)},[r]);return(0,nt.useEffect)(()=>()=>i?.disconnect(),[i]),i}function x9e(e){return new I6(Ay(e),e)}function ioe(e,t,r){t===void 0&&(t=x9e);let[n,i]=(0,nt.useReducer)(s,null),a=b9e({callback(l){if(!!e)for(let u of l){let{type:c,target:f}=u;if(c==="childList"&&f instanceof HTMLElement&&f.contains(e)){i();break}}}}),o=BN({callback:i});return bc(()=>{i(),e?(o?.observe(e),a?.observe(document.body,{childList:!0,subtree:!0})):(o?.disconnect(),a?.disconnect())},[e]),n;function s(l){if(!e)return null;if(e.isConnected===!1){var u;return(u=l??r)!=null?u:null}let c=t(e);return JSON.stringify(l)===JSON.stringify(c)?l:c}}function w9e(e){let t=zU(e);return poe(e,t)}var aoe=[];function S9e(e){let t=(0,nt.useRef)(e),r=Rw(n=>e?n&&n!==aoe&&e&&t.current&&e.parentNode===t.current.parentNode?n:R6(e):aoe,[e]);return(0,nt.useEffect)(()=>{t.current=e},[e]),r}function E9e(e){let[t,r]=(0,nt.useState)(null),n=(0,nt.useRef)(e),i=(0,nt.useCallback)(a=>{let o=FU(a.target);!o||r(s=>s?(s.set(o,BU(o)),new Map(s)):null)},[]);return(0,nt.useEffect)(()=>{let a=n.current;if(e!==a){o(a);let s=e.map(l=>{let u=FU(l);return u?(u.addEventListener("scroll",i,{passive:!0}),[u,BU(u)]):null}).filter(l=>l!=null);r(s.length?new Map(s):null),n.current=e}return()=>{o(e),o(a)};function o(s){s.forEach(l=>{let u=FU(l);u?.removeEventListener("scroll",i)})}},[i,e]),(0,nt.useMemo)(()=>e.length?t?Array.from(t.values()).reduce((a,o)=>fy(a,o),Fp):boe(e):Fp,[e,t])}function ooe(e,t){t===void 0&&(t=[]);let r=(0,nt.useRef)(null);return(0,nt.useEffect)(()=>{r.current=null},t),(0,nt.useEffect)(()=>{let n=e!==Fp;n&&!r.current&&(r.current=e),!n&&r.current&&(r.current=null)},[e]),r.current?dy(e,r.current):Fp}function k9e(e){(0,nt.useEffect)(()=>{if(!j6)return;let t=e.map(r=>{let{sensor:n}=r;return n.setup==null?void 0:n.setup()});return()=>{for(let r of t)r?.()}},e.map(t=>{let{sensor:r}=t;return r}))}function C9e(e,t){return(0,nt.useMemo)(()=>e.reduce((r,n)=>{let{eventName:i,handler:a}=n;return r[i]=o=>{a(o,t)},r},{}),[e,t])}function Soe(e){return(0,nt.useMemo)(()=>e?J5e(e):null,[e])}var IU=[];function D9e(e,t){t===void 0&&(t=Ay);let[r]=e,n=Soe(r?nu(r):null),[i,a]=(0,nt.useReducer)(s,IU),o=BN({callback:a});return e.length>0&&i===IU&&a(),bc(()=>{e.length?e.forEach(l=>o?.observe(l)):(o?.disconnect(),a())},[e]),i;function s(){return e.length?e.map(l=>voe(l)?n:new I6(t(l),l)):IU}}function Eoe(e){if(!e)return null;if(e.children.length>1)return e;let t=e.children[0];return Iw(t)?t:e}function O9e(e){let{measure:t}=e,[r,n]=(0,nt.useState)(null),i=(0,nt.useCallback)(u=>{for(let{target:c}of u)if(Iw(c)){n(f=>{let d=t(c);return f?{...f,width:d.width,height:d.height}:d});break}},[t]),a=BN({callback:i}),o=(0,nt.useCallback)(u=>{let c=Eoe(u);a?.disconnect(),c&&a?.observe(c),n(c?t(c):null)},[t,a]),[s,l]=T6(o);return(0,nt.useMemo)(()=>({nodeRef:s,rect:r,setRef:l}),[r,s,l])}var M9e=[{sensor:_N,options:{}},{sensor:B0,options:{}}],j9e={current:{}},TN={draggable:{measure:Jae},droppable:{measure:Jae,strategy:_p.WhileDragging,frequency:$U.Optimized},dragOverlay:{measure:Ay}},hy=class extends Map{get(t){var r;return t!=null&&(r=super.get(t))!=null?r:void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(t=>{let{disabled:r}=t;return!r})}getNodeFor(t){var r,n;return(r=(n=this.get(t))==null?void 0:n.node.current)!=null?r:void 0}},N9e={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new hy,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:FN},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:TN,measureDroppableContainers:FN,windowRect:null,measuringScheduled:!1},koe={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:FN,draggableNodes:new Map,over:null,measureDroppableContainers:FN},$6=(0,nt.createContext)(koe),Coe=(0,nt.createContext)(N9e);function T9e(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new hy}}}function F9e(e,t){switch(t.type){case fs.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case fs.DragMove:return e.draggable.active?{...e,draggable:{...e.draggable,translate:{x:t.coordinates.x-e.draggable.initialCoordinates.x,y:t.coordinates.y-e.draggable.initialCoordinates.y}}}:e;case fs.DragEnd:case fs.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case fs.RegisterDroppable:{let{element:r}=t,{id:n}=r,i=new hy(e.droppable.containers);return i.set(n,r),{...e,droppable:{...e.droppable,containers:i}}}case fs.SetDroppableDisabled:{let{id:r,key:n,disabled:i}=t,a=e.droppable.containers.get(r);if(!a||n!==a.key)return e;let o=new hy(e.droppable.containers);return o.set(r,{...a,disabled:i}),{...e,droppable:{...e.droppable,containers:o}}}case fs.UnregisterDroppable:{let{id:r,key:n}=t,i=e.droppable.containers.get(r);if(!i||n!==i.key)return e;let a=new hy(e.droppable.containers);return a.delete(r),{...e,droppable:{...e.droppable,containers:a}}}default:return e}}function _9e(e){let{disabled:t}=e,{active:r,activatorEvent:n,draggableNodes:i}=(0,nt.useContext)($6),a=F6(n),o=F6(r?.id);return(0,nt.useEffect)(()=>{if(!t&&!n&&a&&o!=null){if(!$w(a)||document.activeElement===a.target)return;let s=i.get(o);if(!s)return;let{activatorNode:l,node:u}=s;if(!l.current&&!u.current)return;requestAnimationFrame(()=>{for(let c of[l.current,u.current]){if(!c)continue;let f=Gae(c);if(f){f.focus();break}}})}},[n,t,i,o,a]),null}function Doe(e,t){let{transform:r,...n}=t;return e!=null&&e.length?e.reduce((i,a)=>a({transform:i,...n}),r):r}function P9e(e){return(0,nt.useMemo)(()=>({draggable:{...TN.draggable,...e?.draggable},droppable:{...TN.droppable,...e?.droppable},dragOverlay:{...TN.dragOverlay,...e?.dragOverlay}}),[e?.draggable,e?.droppable,e?.dragOverlay])}function I9e(e){let{activeNode:t,measure:r,initialRect:n,config:i=!0}=e,a=(0,nt.useRef)(!1),{x:o,y:s}=typeof i=="boolean"?{x:i,y:i}:i;bc(()=>{if(!o&&!s||!t){a.current=!1;return}if(a.current||!n)return;let u=t?.node.current;if(!u||u.isConnected===!1)return;let c=r(u),f=poe(c,n);if(o||(f.x=0),s||(f.y=0),a.current=!0,Math.abs(f.x)>0||Math.abs(f.y)>0){let d=hoe(u);d&&d.scrollBy({top:f.y,left:f.x})}},[t,o,s,n,r])}var RN=(0,nt.createContext)({...Fp,scaleX:1,scaleY:1}),P0;(function(e){e[e.Uninitialized=0]="Uninitialized",e[e.Initializing=1]="Initializing",e[e.Initialized=2]="Initialized"})(P0||(P0={}));var Lw=(0,nt.memo)(function(t){var r,n,i,a;let{id:o,accessibility:s,autoScroll:l=!0,children:u,sensors:c=M9e,collisionDetection:f=LU,measuring:d,modifiers:p,...h}=t,m=(0,nt.useReducer)(F9e,void 0,T9e),[g,A]=m,[b,v]=L5e(),[x,w]=(0,nt.useState)(P0.Uninitialized),S=x===P0.Initialized,{draggable:{active:k,nodes:j,translate:O},droppable:{containers:C}}=g,N=k?j.get(k):null,D=(0,nt.useRef)({initial:null,translated:null}),P=(0,nt.useMemo)(()=>{var at;return k!=null?{id:k,data:(at=N?.data)!=null?at:j9e,rect:D}:null},[k,N]),q=(0,nt.useRef)(null),[z,I]=(0,nt.useState)(null),[T,L]=(0,nt.useState)(null),_=Bw(h,Object.values(h)),Y=cy("DndDescribedBy",o),oe=(0,nt.useMemo)(()=>C.getEnabled(),[C]),te=P9e(d),{droppableRects:Q,measureDroppableContainers:fe,measuringScheduled:Ie}=v9e(oe,{dragging:S,dependencies:[O.x,O.y],config:te.droppable}),Se=A9e(j,k),Oe=(0,nt.useMemo)(()=>T?_6(T):null,[T]),ve=De(),ye=y9e(Se,te.draggable.measure);I9e({activeNode:k?j.get(k):null,config:ve.layoutShiftCompensation,initialRect:ye,measure:te.draggable.measure});let me=ioe(Se,te.draggable.measure,ye),ke=ioe(Se?Se.parentElement:null),$=(0,nt.useRef)({activatorEvent:null,active:null,activeNode:Se,collisionRect:null,collisions:null,droppableRects:Q,draggableNodes:j,draggingNode:null,draggingNodeRect:null,droppableContainers:C,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),ae=C.getNodeFor((r=$.current.over)==null?void 0:r.id),ce=O9e({measure:te.dragOverlay.measure}),U=(n=ce.nodeRef.current)!=null?n:Se,R=S?(i=ce.rect)!=null?i:me:null,J=Boolean(ce.nodeRef.current&&ce.rect),ee=w9e(J?null:me),ie=Soe(U?nu(U):null),re=S9e(S?ae??Se:null),Ee=D9e(re),Ce=Doe(p,{transform:{x:O.x-ee.x,y:O.y-ee.y,scaleX:1,scaleY:1},activatorEvent:T,active:P,activeNodeRect:me,containerNodeRect:ke,draggingNodeRect:R,over:$.current.over,overlayNodeRect:ce.rect,scrollableAncestors:re,scrollableAncestorRects:Ee,windowRect:ie}),_e=Oe?fy(Oe,O):null,he=E9e(re),ze=ooe(he),Ye=ooe(he,[me]),tt=fy(Ce,ze),Ct=R?Z5e(R,Ce):null,we=P&&Ct?f({active:P,collisionRect:Ct,droppableRects:Q,droppableContainers:oe,pointerCoordinates:_e}):null,Be=qU(we,"id"),[Le,Ze]=(0,nt.useState)(null),He=J?Ce:fy(Ce,Ye),Qe=Q5e(He,(a=Le?.rect)!=null?a:null,me),et=(0,nt.useCallback)((at,ht)=>{let{sensor:Zt,options:Wr}=ht;if(q.current==null)return;let en=j.get(q.current);if(!en)return;let tn=at.nativeEvent,ci=new Zt({active:q.current,activeNode:en,event:tn,options:Wr,context:$,onStart(Qi){let Pa=q.current;if(Pa==null)return;let Dt=j.get(Pa);if(!Dt)return;let{onDragStart:Hc}=_.current,Wf={active:{id:Pa,data:Dt.data,rect:D}};(0,I0.unstable_batchedUpdates)(()=>{Hc?.(Wf),w(P0.Initializing),A({type:fs.DragStart,initialCoordinates:Qi,active:Pa}),b({type:"onDragStart",event:Wf})})},onMove(Qi){A({type:fs.DragMove,coordinates:Qi})},onEnd:ns(fs.DragEnd),onCancel:ns(fs.DragCancel)});(0,I0.unstable_batchedUpdates)(()=>{I(ci),L(at.nativeEvent)});function ns(Qi){return async function(){let{active:Dt,collisions:Hc,over:Wf,scrollAdjustedTranslate:Va}=$.current,Eu=null;if(Dt&&Va){let{cancelDrop:Yr}=_.current;Eu={activatorEvent:tn,active:Dt,collisions:Hc,delta:Va,over:Wf},Qi===fs.DragEnd&&typeof Yr=="function"&&await Promise.resolve(Yr(Eu))&&(Qi=fs.DragCancel)}q.current=null,(0,I0.unstable_batchedUpdates)(()=>{A({type:Qi}),w(P0.Uninitialized),Ze(null),I(null),L(null);let Yr=Qi===fs.DragEnd?"onDragEnd":"onDragCancel";if(Eu){let Ul=_.current[Yr];Ul?.(Eu),b({type:Yr,event:Eu})}})}}},[j]),Ge=(0,nt.useCallback)((at,ht)=>(Zt,Wr)=>{let en=Zt.nativeEvent,tn=j.get(Wr);if(q.current!==null||!tn||en.dndKit||en.defaultPrevented)return;let ci={active:tn};at(Zt,ht.options,ci)===!0&&(en.dndKit={capturedBy:ht.sensor},q.current=Wr,et(Zt,ht))},[j,et]),G=g9e(c,Ge);k9e(c),bc(()=>{me&&x===P0.Initializing&&w(P0.Initialized)},[me,x]),(0,nt.useEffect)(()=>{let{onDragMove:at}=_.current,{active:ht,activatorEvent:Zt,collisions:Wr,over:en}=$.current;if(!ht||!Zt)return;let tn={active:ht,activatorEvent:Zt,collisions:Wr,delta:{x:tt.x,y:tt.y},over:en};(0,I0.unstable_batchedUpdates)(()=>{at?.(tn),b({type:"onDragMove",event:tn})})},[tt.x,tt.y]),(0,nt.useEffect)(()=>{let{active:at,activatorEvent:ht,collisions:Zt,droppableContainers:Wr,scrollAdjustedTranslate:en}=$.current;if(!at||q.current==null||!ht||!en)return;let{onDragOver:tn}=_.current,ci=Wr.get(Be),ns=ci&&ci.rect.current?{id:ci.id,rect:ci.rect.current,data:ci.data,disabled:ci.disabled}:null,Qi={active:at,activatorEvent:ht,collisions:Zt,delta:{x:en.x,y:en.y},over:ns};(0,I0.unstable_batchedUpdates)(()=>{Ze(ns),tn?.(Qi),b({type:"onDragOver",event:Qi})})},[Be]),bc(()=>{$.current={activatorEvent:T,active:P,activeNode:Se,collisionRect:Ct,collisions:we,droppableRects:Q,draggableNodes:j,draggingNode:U,draggingNodeRect:R,droppableContainers:C,over:Le,scrollableAncestors:re,scrollAdjustedTranslate:tt},D.current={initial:R,translated:Ct}},[P,Se,we,Ct,j,U,R,Q,C,Le,re,tt]),p9e({...ve,delta:O,draggingRect:Ct,pointerCoordinates:_e,scrollableAncestors:re,scrollableAncestorRects:Ee});let ue=(0,nt.useMemo)(()=>({active:P,activeNode:Se,activeNodeRect:me,activatorEvent:T,collisions:we,containerNodeRect:ke,dragOverlay:ce,draggableNodes:j,droppableContainers:C,droppableRects:Q,over:Le,measureDroppableContainers:fe,scrollableAncestors:re,scrollableAncestorRects:Ee,measuringConfiguration:te,measuringScheduled:Ie,windowRect:ie}),[P,Se,me,T,we,ke,ce,j,C,Q,Le,fe,re,Ee,te,Ie,ie]),Pe=(0,nt.useMemo)(()=>({activatorEvent:T,activators:G,active:P,activeNodeRect:me,ariaDescribedById:{draggable:Y},dispatch:A,draggableNodes:j,over:Le,measureDroppableContainers:fe}),[T,G,P,me,A,Y,j,Le,fe]);return nt.default.createElement(uoe.Provider,{value:v},nt.default.createElement($6.Provider,{value:Pe},nt.default.createElement(Coe.Provider,{value:ue},nt.default.createElement(RN.Provider,{value:Qe},u)),nt.default.createElement(_9e,{disabled:s?.restoreFocus===!1})),nt.default.createElement(W5e,{...s,hiddenTextDescribedById:Y}));function De(){let at=z?.autoScrollEnabled===!1,ht=typeof l=="object"?l.enabled===!1:l===!1,Zt=S&&!at&&!ht;return typeof l=="object"?{...l,enabled:Zt}:{enabled:Zt}}}),B9e=(0,nt.createContext)(null),soe="button",R9e="Droppable";function Us(e){let{id:t,data:r,disabled:n=!1,attributes:i}=e,a=cy(R9e),{activators:o,activatorEvent:s,active:l,activeNodeRect:u,ariaDescribedById:c,draggableNodes:f,over:d}=(0,nt.useContext)($6),{role:p=soe,roleDescription:h="draggable",tabIndex:m=0}=i??{},g=l?.id===t,A=(0,nt.useContext)(g?RN:B9e),[b,v]=T6(),[x,w]=T6(),S=C9e(o,t),k=Bw(r);bc(()=>(f.set(t,{id:t,key:a,node:b,activatorNode:x,data:k}),()=>{let O=f.get(t);O&&O.key===a&&f.delete(t)}),[f,t]);let j=(0,nt.useMemo)(()=>({role:p,tabIndex:m,"aria-disabled":n,"aria-pressed":g&&p===soe?!0:void 0,"aria-roledescription":h,"aria-describedby":c.draggable}),[n,p,m,g,h,c.draggable]);return{active:l,activatorEvent:s,activeNodeRect:u,attributes:j,isDragging:g,listeners:n?void 0:S,node:b,over:d,setNodeRef:v,setActivatorNodeRef:w,transform:A}}function UU(){return(0,nt.useContext)(Coe)}var $9e="Droppable",q9e={timeout:25};function zu(e){let{data:t,disabled:r=!1,id:n,resizeObserverConfig:i}=e,a=cy($9e),{active:o,dispatch:s,over:l,measureDroppableContainers:u}=(0,nt.useContext)($6),c=(0,nt.useRef)({disabled:r}),f=(0,nt.useRef)(!1),d=(0,nt.useRef)(null),p=(0,nt.useRef)(null),{disabled:h,updateMeasurementsFor:m,timeout:g}={...q9e,...i},A=Bw(m??n),b=(0,nt.useCallback)(()=>{if(!f.current){f.current=!0;return}p.current!=null&&clearTimeout(p.current),p.current=setTimeout(()=>{u(Array.isArray(A.current)?A.current:[A.current]),p.current=null},g)},[g]),v=BN({callback:b,disabled:h||!o}),x=(0,nt.useCallback)((j,O)=>{!v||(O&&(v.unobserve(O),f.current=!1),j&&v.observe(j))},[v]),[w,S]=T6(x),k=Bw(t);return(0,nt.useEffect)(()=>{!v||!w.current||(v.disconnect(),f.current=!1,v.observe(w.current))},[w,v]),bc(()=>(s({type:fs.RegisterDroppable,element:{id:n,key:a,disabled:r,node:w,rect:d,data:k}}),()=>s({type:fs.UnregisterDroppable,key:a,id:n})),[n]),(0,nt.useEffect)(()=>{r!==c.current.disabled&&(s({type:fs.SetDroppableDisabled,id:n,key:a,disabled:r}),c.current.disabled=r)},[n,a,r,s]),{active:o,rect:d,isOver:l?.id===n,node:w,over:l,setNodeRef:S}}function L9e(e){let{animation:t,children:r}=e,[n,i]=(0,nt.useState)(null),[a,o]=(0,nt.useState)(null),s=F6(r);return!r&&!n&&s&&i(s),bc(()=>{if(!a)return;let l=n?.key,u=n?.props.id;if(l==null||u==null){i(null);return}Promise.resolve(t(u,a)).then(()=>{i(null)})},[t,n,a]),nt.default.createElement(nt.default.Fragment,null,r,n?(0,nt.cloneElement)(n,{ref:o}):null)}var z9e={x:0,y:0,scaleX:1,scaleY:1};function U9e(e){let{children:t}=e;return nt.default.createElement($6.Provider,{value:koe},nt.default.createElement(RN.Provider,{value:z9e},t))}var W9e={position:"fixed",touchAction:"none"},H9e=e=>$w(e)?"transform 250ms ease":void 0,V9e=(0,nt.forwardRef)((e,t)=>{let{as:r,activatorEvent:n,adjustScale:i,children:a,className:o,rect:s,style:l,transform:u,transition:c=H9e}=e;if(!s)return null;let f=i?u:{...u,scaleX:1,scaleY:1},d={...W9e,width:s.width,height:s.height,top:s.top,left:s.left,transform:Lu.Transform.toString(f),transformOrigin:i&&n?H5e(n,s):void 0,transition:typeof c=="function"?c(n):c,...l};return nt.default.createElement(r,{className:o,style:d,ref:t},a)}),G9e=e=>t=>{let{active:r,dragOverlay:n}=t,i={},{styles:a,className:o}=e;if(a!=null&&a.active)for(let[s,l]of Object.entries(a.active))l!==void 0&&(i[s]=r.node.style.getPropertyValue(s),r.node.style.setProperty(s,l));if(a!=null&&a.dragOverlay)for(let[s,l]of Object.entries(a.dragOverlay))l!==void 0&&n.node.style.setProperty(s,l);return o!=null&&o.active&&r.node.classList.add(o.active),o!=null&&o.dragOverlay&&n.node.classList.add(o.dragOverlay),function(){for(let[l,u]of Object.entries(i))r.node.style.setProperty(l,u);o!=null&&o.active&&r.node.classList.remove(o.active)}},Q9e=e=>{let{transform:{initial:t,final:r}}=e;return[{transform:Lu.Transform.toString(t)},{transform:Lu.Transform.toString(r)}]},WU={duration:250,easing:"ease",keyframes:Q9e,sideEffects:G9e({styles:{active:{opacity:"0"}}})};function Y9e(e){let{config:t,draggableNodes:r,droppableContainers:n,measuringConfiguration:i}=e;return N6((a,o)=>{if(t===null)return;let s=r.get(a);if(!s)return;let l=s.node.current;if(!l)return;let u=Eoe(o);if(!u)return;let{transform:c}=nu(o).getComputedStyle(o),f=moe(c);if(!f)return;let d=typeof t=="function"?t:Z9e(t);return xoe(l,i.draggable.measure),d({active:{id:a,data:s.data,node:l,rect:i.draggable.measure(l)},draggableNodes:r,dragOverlay:{node:o,rect:i.dragOverlay.measure(u)},droppableContainers:n,measuringConfiguration:i,transform:f})})}function Z9e(e){let{duration:t,easing:r,sideEffects:n,keyframes:i}={...WU,...e};return a=>{let{active:o,dragOverlay:s,transform:l,...u}=a;if(!t)return;let c={x:s.rect.left-o.rect.left,y:s.rect.top-o.rect.top},f={scaleX:l.scaleX!==1?o.rect.width*l.scaleX/s.rect.width:1,scaleY:l.scaleY!==1?o.rect.height*l.scaleY/s.rect.height:1},d={x:l.x-c.x,y:l.y-c.y,...f},p=i({...u,active:o,dragOverlay:s,transform:{initial:l,final:d}}),[h]=p,m=p[p.length-1];if(JSON.stringify(h)===JSON.stringify(m))return;let g=n?.({active:o,dragOverlay:s,...u}),A=s.node.animate(p,{duration:t,easing:r,fill:"forwards"});return new Promise(b=>{A.onfinish=()=>{g?.(),b()}})}}var loe=0;function X9e(e){return(0,nt.useMemo)(()=>{if(e!=null)return loe++,loe},[e])}var Um=nt.default.memo(e=>{let{adjustScale:t=!1,children:r,dropAnimation:n,style:i,transition:a,modifiers:o,wrapperElement:s="div",className:l,zIndex:u=999}=e,{activatorEvent:c,active:f,activeNodeRect:d,containerNodeRect:p,draggableNodes:h,droppableContainers:m,dragOverlay:g,over:A,measuringConfiguration:b,scrollableAncestors:v,scrollableAncestorRects:x,windowRect:w}=UU(),S=(0,nt.useContext)(RN),k=X9e(f?.id),j=Doe(o,{activatorEvent:c,active:f,activeNodeRect:d,containerNodeRect:p,draggingNodeRect:g.rect,over:A,overlayNodeRect:g.rect,scrollableAncestors:v,scrollableAncestorRects:x,transform:S,windowRect:w}),O=zU(d),C=Y9e({config:n,draggableNodes:h,droppableContainers:m,measuringConfiguration:b}),N=O?g.setRef:void 0;return nt.default.createElement(U9e,null,nt.default.createElement(L9e,{animation:C},f&&k?nt.default.createElement(V9e,{key:k,id:f.id,ref:N,as:s,activatorEvent:c,adjustScale:t,className:l,transition:a,rect:O,style:{zIndex:u,...i},transform:j},r):null))});function Ws(e,t,r){let n=e.slice();return n.splice(r<0?n.length+r:r,0,n.splice(t,1)[0]),n}function K9e(e,t){return e.reduce((r,n,i)=>{let a=t.get(n);return a&&(r[i]=a),r},Array(e.length))}function $N(e){return e!==null&&e>=0}function J9e(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let r=0;r{let{rects:t,activeIndex:r,overIndex:n,index:i}=e,a=Ws(t,n,r),o=t[i],s=a[i];return!s||!o?null:{x:s.left-o.left,y:s.top-o.top,scaleX:s.width/o.width,scaleY:s.height/o.height}};var Ooe="Sortable",Moe=To.default.createContext({activeIndex:-1,containerId:Ooe,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:q6,disabled:{draggable:!1,droppable:!1}});function HU(e){let{children:t,id:r,items:n,strategy:i=q6,disabled:a=!1}=e,{active:o,dragOverlay:s,droppableRects:l,over:u,measureDroppableContainers:c}=UU(),f=cy(Ooe,r),d=Boolean(s.rect!==null),p=(0,To.useMemo)(()=>n.map(S=>typeof S=="object"&&"id"in S?S.id:S),[n]),h=o!=null,m=o?p.indexOf(o.id):-1,g=u?p.indexOf(u.id):-1,A=(0,To.useRef)(p),b=!J9e(p,A.current),v=g!==-1&&m===-1||b,x=e8e(a);bc(()=>{b&&h&&c(p)},[b,p,h,c]),(0,To.useEffect)(()=>{A.current=p},[p]);let w=(0,To.useMemo)(()=>({activeIndex:m,containerId:f,disabled:x,disableTransforms:v,items:p,overIndex:g,useDragOverlay:d,sortedRects:K9e(p,l),strategy:i}),[m,f,x.draggable,x.droppable,v,p,g,l,d,i]);return To.default.createElement(Moe.Provider,{value:w},t)}var t8e=e=>{let{id:t,items:r,activeIndex:n,overIndex:i}=e;return Ws(r,n,i).indexOf(t)},VU=e=>{let{containerId:t,isSorting:r,wasDragging:n,index:i,items:a,newIndex:o,previousItems:s,previousContainerId:l,transition:u}=e;return!u||!n||s!==a&&i===o?!1:r?!0:o!==i&&t===l},r8e={duration:200,easing:"ease"},joe="transform",n8e=Lu.Transition.toString({property:joe,duration:0,easing:"linear"}),i8e={roleDescription:"sortable"};function a8e(e){let{disabled:t,index:r,node:n,rect:i}=e,[a,o]=(0,To.useState)(null),s=(0,To.useRef)(r);return bc(()=>{if(!t&&r!==s.current&&n.current){let l=i.current;if(l){let u=Ay(n.current,{ignoreTransform:!0}),c={x:l.left-u.left,y:l.top-u.top,scaleX:l.width/u.width,scaleY:l.height/u.height};(c.x||c.y)&&o(c)}}r!==s.current&&(s.current=r)},[t,r,n,i]),(0,To.useEffect)(()=>{a&&o(null)},[a]),a}function Noe(e){let{animateLayoutChanges:t=VU,attributes:r,disabled:n,data:i,getNewIndex:a=t8e,id:o,strategy:s,resizeObserverConfig:l,transition:u=r8e}=e,{items:c,containerId:f,activeIndex:d,disabled:p,disableTransforms:h,sortedRects:m,overIndex:g,useDragOverlay:A,strategy:b}=(0,To.useContext)(Moe),v=o8e(n,p),x=c.indexOf(o),w=(0,To.useMemo)(()=>({sortable:{containerId:f,index:x,items:c},...i}),[f,i,x,c]),S=(0,To.useMemo)(()=>c.slice(c.indexOf(o)),[c,o]),{rect:k,node:j,isOver:O,setNodeRef:C}=zu({id:o,data:w,disabled:v.droppable,resizeObserverConfig:{updateMeasurementsFor:S,...l}}),{active:N,activatorEvent:D,activeNodeRect:P,attributes:q,setNodeRef:z,listeners:I,isDragging:T,over:L,setActivatorNodeRef:_,transform:Y}=Us({id:o,data:w,attributes:{...i8e,...r},disabled:v.draggable}),oe=Wae(C,z),te=Boolean(N),Q=te&&!h&&$N(d)&&$N(g),fe=!A&&T,Ie=fe&&Q?Y:null,Oe=Q?Ie??(s??b)({rects:m,activeNodeRect:P,activeIndex:d,overIndex:g,index:x}):null,ve=$N(d)&&$N(g)?a({id:o,items:c,activeIndex:d,overIndex:g}):x,ye=N?.id,me=(0,To.useRef)({activeId:ye,items:c,newIndex:ve,containerId:f}),ke=c!==me.current.items,$=t({active:N,containerId:f,isDragging:T,isSorting:te,id:o,index:x,items:c,newIndex:me.current.newIndex,previousItems:me.current.items,previousContainerId:me.current.containerId,transition:u,wasDragging:me.current.activeId!=null}),ae=a8e({disabled:!$,index:x,node:j,rect:k});return(0,To.useEffect)(()=>{te&&me.current.newIndex!==ve&&(me.current.newIndex=ve),f!==me.current.containerId&&(me.current.containerId=f),c!==me.current.items&&(me.current.items=c)},[te,ve,f,c]),(0,To.useEffect)(()=>{if(ye===me.current.activeId)return;if(ye&&!me.current.activeId){me.current.activeId=ye;return}let U=setTimeout(()=>{me.current.activeId=ye},50);return()=>clearTimeout(U)},[ye]),{active:N,activeIndex:d,attributes:q,data:w,rect:k,index:x,newIndex:ve,items:c,isOver:O,isSorting:te,isDragging:T,listeners:I,node:j,overIndex:g,over:L,setNodeRef:oe,setActivatorNodeRef:_,setDroppableNodeRef:C,setDraggableNodeRef:z,transform:ae??Oe,transition:ce()};function ce(){if(ae||ke&&me.current.newIndex===x)return n8e;if(!(fe&&!$w(D)||!u)&&(te||$))return Lu.Transition.toString({...u,property:joe})}}function o8e(e,t){var r,n;return typeof e=="boolean"?{draggable:e,droppable:!1}:{draggable:(r=e?.draggable)!=null?r:t.draggable,droppable:(n=e?.droppable)!=null?n:t.droppable}}function qN(e){if(!e)return!1;let t=e.data.current;return!!(t&&"sortable"in t&&typeof t.sortable=="object"&&"containerId"in t.sortable&&"items"in t.sortable&&"index"in t.sortable)}var s8e=[$n.Down,$n.Right,$n.Up,$n.Left],LN=(e,t)=>{let{context:{active:r,collisionRect:n,droppableRects:i,droppableContainers:a,over:o,scrollableAncestors:s}}=t;if(s8e.includes(e.code)){if(e.preventDefault(),!r||!n)return;let l=[];a.getEnabled().forEach(f=>{if(!f||f!=null&&f.disabled)return;let d=i.get(f.id);if(!!d)switch(e.code){case $n.Down:n.topd.top&&l.push(f);break;case $n.Left:n.left>d.left&&l.push(f);break;case $n.Right:n.left1&&(c=u[1].id),c!=null){let f=a.get(r.id),d=a.get(c),p=d?i.get(d.id):null,h=d?.node.current;if(h&&p&&f&&d){let g=R6(h).some((S,k)=>s[k]!==S),A=Toe(f,d),b=l8e(f,d),v=g||!A?{x:0,y:0}:{x:b?n.width-p.width:0,y:b?n.height-p.height:0},x={x:p.left,y:p.top};return v.x&&v.y?x:dy(x,v)}}}};function Toe(e,t){return!qN(e)||!qN(t)?!1:e.data.current.sortable.containerId===t.data.current.sortable.containerId}function l8e(e,t){return!qN(e)||!qN(t)||!Toe(e,t)?!1:e.data.current.sortable.index{let r=e.spaceManager.uriByString(t);if(!r)return null;let n=r.basePath,i=e.spacesIndex.get(r.basePath);if(!i)return null;let a,o,s,l;if(r.refType=="frame"){s=r.ref;let u=await e.spaceManager.readAllFrames(n).then(c=>Object.values(c).map(f=>f.schema));s&&u&&(l=u.find(c=>c.id==s)?.name,a=or(u.find(c=>c.id==s)?.def)?.db,o=e.contextsIndex.get(n)?.schemas.find(c=>c.id==a)?.name)}else r.refType=="context"&&(a=r.ref,o=e.contextsIndex.get(n)?.schemas.find(u=>u.id==a)?.name);return{space:n,spaceName:i.name,schema:a,schemaName:o,view:s,viewName:l}},UN=async(e,t,r,n)=>{let i=await e.readTable(t.path,r);i&&await n(i,t)},$A=async(e,t,r)=>{let n=await e.contextForSpace(t.path);n&&await r(n,t)},wc=async(e,t,r,n)=>{await e.saveTable(t.path,r,n).then(i=>i&&e.superstate.reloadContextByPath(t.path,!0))};var Foe=(e,t,r,n,i)=>({...e,rows:e.rows.map(a=>a[t]==r?{...a,[n]:Bi(sr(a[n]).filter(o=>o!=i))}:a)}),u8e=(e,t,r,n,i)=>({...e,rows:e.rows.map(a=>a[t]==r?{...a,[n]:i}:a)});var c8e=(e,t,r)=>({...e,rows:r?Dx(e.rows,r,t):[...e.rows,...t]}),f8e=(e,t,r)=>({...e,rows:e.rows.map((n,i)=>i==r?t:n)}),_oe=async(e,t,r,n,i,a,o)=>{UN(e,t,r,async s=>{let l={...s,rows:s.rows.map((u,c)=>c==n?{...u,[i]:a}:u)};return o&&(l={...l,rows:Ws(l.rows,n,o)}),xc.default.isEqual(s,l)||(e.superstate.settings.enhancedLogs&&console.log("Saving Context Change: Update Table Value"),await wc(e,t,l)),l})},WN=async(e,t,r,n,i,a,o)=>{e.contextForSpace(t.path).then(s=>{let u=(a??u8e)(s,mt,r,n,i);return o&&(u=dL(u,[r],o)),e.superstate.settings.enhancedLogs&&console.log("Saving Context Change: Update Context Value"),wc(e,t,u).then(c=>u)})};var d8e=async(e,t,r)=>{let n=t;e.spacesIndex.has(n)&&(n=Af(e,e.spacesIndex.get(n).space));let i=await e.spaceManager.readProperties(n);return i?Object.keys(i).reduce((a,o)=>r.some(s=>s.name==o)?{...a,[o]:Ri(o,i[o],r.find(s=>s.name==o).type)}:a,{}):{}},Poe=(e,t)=>t=="$space"?ire:t=="$context"?sd.rows:e.contextsIndex.get(t)?.contextTable?.cols??[],GU=async(e,t,r)=>{let n=async a=>{let o=a.rows.some(l=>l[mt]===t),s=await d8e(e,t,a.cols.filter(l=>l.name!=mt&&l.type!="fileprop"));return o?a.rows.map(l=>l[mt]==t?{...l,...s}:l):[...a.rows,{[mt]:t,...s}]},i=r.map(a=>$A(e.spaceManager,a,async(o,s)=>{let l=await n(o),u={...o,rows:l};return xc.default.isEqual(o,u)||(e.settings.enhancedLogs&&console.log("Saving Context Change: Update Context Path Properties"),await wc(e.spaceManager,s,u,!0)),u}));await Promise.all(i)},HN=async(e,t,r,n,i)=>UN(e,t,r,async(a,o)=>{let s=f8e(a,i,n);return xc.default.isEqual(a,s)||(e.superstate.settings.enhancedLogs&&console.log("Saving Context Change: Update Table Row"),await wc(e,o,s)),s}),Ioe=async(e,t,r,n,i)=>{let a=o=>({...o,rows:o.rows.map(s=>s[mt]==t?{...s,[r]:n}:s)});return $A(e,i,async(o,s)=>{let l=a(o);return xc.default.isEqual(o,l)||(e.superstate.settings.enhancedLogs&&console.log("Saving Context Change: Update Value in Context"),await wc(e,s,l)),l})},Boe=async(e,t,r,n)=>{let i=o=>{let s=o.cols.map(l=>l.type.startsWith("context")&&l.value==t?{...l,value:r}:l);return{...o,cols:s}},a=n.map(o=>$A(e,o,async(s,l)=>{let u=i(s);return xc.default.isEqual(s,u)||(e.superstate.settings.enhancedLogs&&console.log("Saving Context Change: Rename Tag in Context"),await wc(e,l,u)),u}));return Promise.all(a)},Roe=async(e,t,r)=>{let n=a=>{let o=a.cols.map(s=>s.type.startsWith("context")&&s.value==t?{...s,type:"link-multi"}:s);return{...a,cols:o}},i=r.map(a=>$A(e,a,async(o,s)=>{let l=n(o);return xc.default.isEqual(o,l)||(e.superstate.settings.enhancedLogs&&console.log("Saving Context Change: Remove Tag in Context"),await wc(e,s,l)),l}));return Promise.all(i)},$oe=async(e,t,r,n,i)=>UN(e,r,n,async(a,o)=>{let s=c8e(a,[t],i);return xc.default.isEqual(a,s)||(e.superstate.settings.enhancedLogs&&console.log("Saving Context Change: Add Row in Table"),await wc(e,o,s)),s}),qoe=async(e,t,r,n)=>UN(e,t,r,async(i,a)=>{let o={...i,rows:i.rows.filter((s,l)=>l!=n)};return xc.default.isEqual(i,o)||(e.superstate.settings.enhancedLogs&&console.log("Saving Context Change: Delete Row in Table"),await wc(e,a,o)),o});var Loe=async(e,t,r,n)=>{let i=n.map(a=>$A(e,a,async(o,s)=>{let l=fL(o.cols),u={...o,rows:o.rows.map(c=>lre(e,c,t,r,l))};return xc.default.isEqual(o,u)||(e.superstate.settings.enhancedLogs&&console.log("Saving Context Change: Rename Link in Context"),await wc(e,s,u)),u}));return Promise.all(i)},zoe=async(e,t,r)=>{let n=r.map(i=>$A(e,i,async(a,o)=>{let s=fL(a.cols),l={...a,rows:a.rows.map(u=>sre(e,u,t,s))};return xc.default.isEqual(a,l)||(e.superstate.settings.enhancedLogs&&console.log("Saving Context Change: Remove link in context"),await wc(e,o,l)),l}));return Promise.all(n)},Uoe=async(e,t,r,n)=>{let i=n.map(a=>$A(e,a,async(o,s)=>{let l=ure(o,t,r);return xc.default.isEqual(o,l)||await wc(e,s,l),l}));return Promise.all(i)},Woe=async(e,t,r)=>{let n=r.map(i=>$A(e,i,async(a,o)=>{let s=cre(a,t);return xc.default.isEqual(a,s)||(e.superstate.settings.enhancedLogs&&console.log("Saving Context Change: Remove Path in Context"),await wc(e,o,s)),s}));return Promise.all(n)},Hoe=async(e,t,r,n)=>$A(e,n,async(i,a)=>{let o=dL(i,t,r);return xc.default.isEqual(i,o)||(e.superstate.settings.enhancedLogs&&console.log("Saving Context Change: Reorder path in Context"),await wc(e,a,o,!0)),o});function Fn(){return Fn=Object.assign?Object.assign.bind():function(e){for(var t=1;te[t])}var aT=["Matrix","Array"],oT=["number","BigNumber","Fraction"];function Xoe(e,t){function r(n){if(n){var i=Ww(e,Bt);Zoe(n,"matrix",aT),Zoe(n,"number",oT),QU(e,n);var a=Ww(e,Bt),o=Ww(n,Bt);return t("config",a,i,o),a}else return Ww(e,Bt)}return r.MATRIX_OPTIONS=aT,r.NUMBER_OPTIONS=oT,Object.keys(gy).forEach(n=>{Object.defineProperty(r,n,{get:()=>e[n],enumerable:!0,configurable:!0})}),r}function p8e(e,t){return e.indexOf(t)!==-1}function Zoe(e,t,r){e[t]!==void 0&&!p8e(r,e[t])&&console.warn('Warning: Unknown value "'+e[t]+'" for configuration option "'+t+'". Available options: '+r.map(n=>JSON.stringify(n)).join(", ")+".")}var it=function(t){if(t)throw new Error(`The global config is readonly. Please create a mathjs instance if you want to change the default configuration. Example: import { create, all } from 'mathjs'; const mathjs = create(all); mathjs.config({ number: 'BigNumber' }); -`);return Object.freeze(gy)};Fn(it,gy,{MATRIX_OPTIONS:aT,NUMBER_OPTIONS:oT});var zH={};dM(zH,{createAbs:()=>sF,createAccessorNode:()=>a4,createAcos:()=>m_,createAcosh:()=>h_,createAcot:()=>A_,createAcoth:()=>g_,createAcsc:()=>v_,createAcsch:()=>y_,createAdd:()=>Y_,createAddScalar:()=>uF,createAnd:()=>wS,createAndTransform:()=>SB,createApply:()=>G0,createApplyTransform:()=>nB,createArg:()=>PF,createArrayNode:()=>s4,createAsec:()=>b_,createAsech:()=>x_,createAsin:()=>w_,createAsinh:()=>S_,createAssignmentNode:()=>f4,createAtan:()=>E_,createAtan2:()=>k_,createAtanh:()=>C_,createAtomicMass:()=>PI,createAvogadro:()=>II,createBellNumbers:()=>OP,createBigNumberClass:()=>CT,createBignumber:()=>XT,createBin:()=>g3,createBitAnd:()=>sS,createBitAndTransform:()=>kB,createBitNot:()=>FF,createBitOr:()=>lS,createBitOrTransform:()=>CB,createBitXor:()=>_F,createBlockNode:()=>p4,createBohrMagneton:()=>hI,createBohrRadius:()=>xI,createBoltzmann:()=>BI,createBoolean:()=>ZT,createCatalan:()=>MP,createCbrt:()=>fF,createCeil:()=>dF,createChain:()=>K4,createChainClass:()=>Z4,createClassicalElectronRadius:()=>wI,createClone:()=>FT,createColumn:()=>fS,createColumnTransform:()=>iB,createCombinations:()=>hP,createCombinationsWithRep:()=>AP,createCompare:()=>q3,createCompareNatural:()=>L3,createCompareText:()=>z3,createCompile:()=>R4,createComplex:()=>KT,createComplexClass:()=>DT,createComposition:()=>jP,createConcat:()=>cS,createConcatTransform:()=>hB,createConditionalNode:()=>h4,createConductanceQuantum:()=>AI,createConj:()=>IF,createConstantNode:()=>y4,createCorr:()=>mP,createCos:()=>D_,createCosh:()=>O_,createCot:()=>M_,createCoth:()=>j_,createCoulomb:()=>pI,createCount:()=>LF,createCreateUnit:()=>p_,createCross:()=>zF,createCsc:()=>N_,createCsch:()=>T_,createCtranspose:()=>s3,createCube:()=>pF,createCumSum:()=>DS,createCumSumTransform:()=>bB,createDeepEqual:()=>e_,createDenseMatrixClass:()=>TT,createDerivative:()=>BP,createDet:()=>J4,createDeuteronMass:()=>OI,createDiag:()=>UF,createDiff:()=>dS,createDiffTransform:()=>AB,createDistance:()=>uP,createDivide:()=>lP,createDivideScalar:()=>E3,createDot:()=>K_,createDotDivide:()=>N3,createDotMultiply:()=>NF,createDotPow:()=>j3,createE:()=>ZP,createEfimovFactor:()=>_I,createEigs:()=>rP,createElectricConstant:()=>fI,createElectronMass:()=>SI,createElementaryCharge:()=>mI,createEqual:()=>W3,createEqualScalar:()=>VT,createEqualText:()=>H3,createErf:()=>d3,createEvaluate:()=>$4,createExp:()=>mF,createExpm:()=>nP,createExpm1:()=>hF,createFactorial:()=>yP,createFalse:()=>WP,createFaraday:()=>RI,createFermiCoupling:()=>EI,createFft:()=>u3,createFibonacciHeapClass:()=>s_,createFilter:()=>WF,createFilterTransform:()=>aB,createFineStructure:()=>kI,createFirstRadiation:()=>$I,createFix:()=>AF,createFlatten:()=>HF,createFloor:()=>nS,createForEach:()=>VF,createForEachTransform:()=>oB,createFormat:()=>A3,createFraction:()=>JT,createFractionClass:()=>OT,createFreqz:()=>qP,createFunctionAssignmentNode:()=>x4,createFunctionNode:()=>I4,createGamma:()=>gP,createGasConstant:()=>LI,createGcd:()=>gF,createGetMatrixDataType:()=>GF,createGravitationConstant:()=>sI,createGravity:()=>ZI,createHartreeEnergy:()=>CI,createHasNumericValue:()=>qT,createHelp:()=>X4,createHelpClass:()=>Y4,createHex:()=>y3,createHypot:()=>Z_,createI:()=>iI,createIdentity:()=>QF,createIfft:()=>c3,createIm:()=>BF,createImmutableDenseMatrixClass:()=>a_,createIndex:()=>e4,createIndexClass:()=>o_,createIndexNode:()=>S4,createIndexTransform:()=>sB,createInfinity:()=>VP,createIntersect:()=>cP,createInv:()=>eP,createInverseConductanceQuantum:()=>gI,createInvmod:()=>MF,createIsInteger:()=>IT,createIsNaN:()=>UT,createIsNegative:()=>RT,createIsNumeric:()=>$T,createIsPositive:()=>LT,createIsPrime:()=>w3,createIsZero:()=>zT,createKldivergence:()=>bP,createKlitzing:()=>bI,createKron:()=>YF,createLN10:()=>JP,createLN2:()=>KP,createLOG10E:()=>tI,createLOG2E:()=>eI,createLarger:()=>X3,createLargerEq:()=>J3,createLcm:()=>vF,createLeafCount:()=>NP,createLeftShift:()=>I3,createLgamma:()=>vP,createLog:()=>D3,createLog10:()=>yF,createLog1p:()=>O3,createLog2:()=>bF,createLoschmidt:()=>qI,createLsolve:()=>T3,createLsolveAll:()=>_3,createLup:()=>z4,createLusolve:()=>G4,createLyap:()=>sP,createMad:()=>pP,createMagneticConstant:()=>cI,createMagneticFluxQuantum:()=>vI,createMap:()=>ZF,createMapTransform:()=>lB,createMatrix:()=>eF,createMatrixClass:()=>jT,createMatrixFromColumns:()=>nF,createMatrixFromFunction:()=>tF,createMatrixFromRows:()=>rF,createMax:()=>SS,createMaxTransform:()=>uB,createMean:()=>OS,createMeanTransform:()=>cB,createMedian:()=>dP,createMin:()=>ES,createMinTransform:()=>fB,createMod:()=>iS,createMode:()=>m3,createMolarMass:()=>QI,createMolarMassC12:()=>YI,createMolarPlanckConstant:()=>zI,createMolarVolume:()=>UI,createMultinomial:()=>xP,createMultiply:()=>wF,createMultiplyScalar:()=>xF,createNaN:()=>GP,createNeutronMass:()=>MI,createNode:()=>r4,createNorm:()=>X_,createNot:()=>$F,createNthRoot:()=>SF,createNthRoots:()=>M3,createNuclearMagneton:()=>yI,createNull:()=>HP,createNumber:()=>QT,createNumeric:()=>S3,createObjectNode:()=>k4,createOct:()=>v3,createOnes:()=>XF,createOperatorNode:()=>D4,createOr:()=>uS,createOrTransform:()=>EB,createParenthesisNode:()=>M4,createParse:()=>B4,createParser:()=>L4,createParserClass:()=>q4,createPartitionSelect:()=>n_,createPermutations:()=>wP,createPhi:()=>XP,createPi:()=>QP,createPickRandom:()=>EP,createPinv:()=>tP,createPlanckCharge:()=>eB,createPlanckConstant:()=>lI,createPlanckLength:()=>XI,createPlanckMass:()=>KI,createPlanckTemperature:()=>tB,createPlanckTime:()=>JI,createPolynomialRoot:()=>Q4,createPow:()=>k3,createPrint:()=>vS,createPrintTransform:()=>wB,createProd:()=>h3,createProtonMass:()=>DI,createQr:()=>U4,createQuantileSeq:()=>jS,createQuantileSeqTransform:()=>yB,createQuantumOfCirculation:()=>jI,createRandom:()=>kP,createRandomInt:()=>CP,createRange:()=>mS,createRangeClass:()=>MT,createRangeNode:()=>N4,createRangeTransform:()=>dB,createRationalize:()=>RP,createRe:()=>RF,createReducedPlanckConstant:()=>uI,createRelationalNode:()=>F4,createReplacer:()=>zP,createReshape:()=>e3,createResize:()=>t3,createResolve:()=>PP,createResultSet:()=>vT,createReviver:()=>LP,createRightArithShift:()=>B3,createRightLogShift:()=>R3,createRotate:()=>r3,createRotationMatrix:()=>n3,createRound:()=>C3,createRow:()=>hS,createRowTransform:()=>pB,createRydberg:()=>NI,createSQRT1_2:()=>rI,createSQRT2:()=>nI,createSackurTetrode:()=>WI,createSchur:()=>oP,createSec:()=>F_,createSech:()=>__,createSecondRadiation:()=>HI,createSetCartesian:()=>$_,createSetDifference:()=>q_,createSetDistinct:()=>L_,createSetIntersect:()=>z_,createSetIsSubset:()=>U_,createSetMultiplicity:()=>W_,createSetPowerset:()=>H_,createSetSize:()=>V_,createSetSymDifference:()=>G_,createSetUnion:()=>Q_,createSign:()=>EF,createSimplify:()=>TP,createSimplifyConstant:()=>FP,createSimplifyCore:()=>_P,createSin:()=>P_,createSinh:()=>I_,createSize:()=>i3,createSlu:()=>V4,createSmaller:()=>G3,createSmallerEq:()=>Y3,createSolveODE:()=>f3,createSort:()=>i_,createSpaClass:()=>l_,createSparse:()=>d_,createSparseMatrixClass:()=>GT,createSpeedOfLight:()=>oI,createSplitUnit:()=>iF,createSqrt:()=>kF,createSqrtm:()=>iP,createSquare:()=>CF,createSqueeze:()=>a3,createStd:()=>NS,createStdTransform:()=>gB,createStefanBoltzmann:()=>VI,createStirlingS2:()=>DP,createString:()=>YT,createSubset:()=>AS,createSubsetTransform:()=>mB,createSubtract:()=>DF,createSubtractScalar:()=>cF,createSum:()=>CS,createSumTransform:()=>vB,createSylvester:()=>aP,createSymbolNode:()=>_4,createSymbolicEqual:()=>IP,createTan:()=>B_,createTanh:()=>R_,createTau:()=>YP,createThomsonCrossSection:()=>TI,createTo:()=>x3,createTrace:()=>J_,createTranspose:()=>o3,createTrue:()=>UP,createTypeOf:()=>WT,createTyped:()=>gT,createUnaryMinus:()=>aF,createUnaryPlus:()=>oF,createUnequal:()=>r_,createUnitClass:()=>c_,createUnitFunction:()=>f_,createUppercaseE:()=>vge,createUppercasePi:()=>gge,createUsolve:()=>F3,createUsolveAll:()=>P3,createVacuumImpedance:()=>dI,createVariance:()=>MS,createVarianceTransform:()=>xB,createVersion:()=>aI,createWeakMixingAngle:()=>FI,createWienDisplacement:()=>GI,createXgcd:()=>OF,createXor:()=>qF,createZeros:()=>l3,createZeta:()=>p3,createZpk2tf:()=>$P});var dW=Ae(sT(),1);function wt(e){return typeof e=="boolean"?!0:isFinite(e)?e===Math.round(e):!1}var kd=Math.sign||function(e){return e>0?1:e<0?-1:0},ese=Math.log2||function(t){return Math.log(t)/Math.LN2},tse=Math.log10||function(t){return Math.log(t)/Math.LN10},lT=Math.log1p||function(e){return Math.log(e+1)},rse=Math.cbrt||function(t){if(t===0)return t;var r=t<0,n;return r&&(t=-t),isFinite(t)?(n=Math.exp(Math.log(t)/3),n=(t/(n*n)+2*n)/3):n=t,r?-n:n},nse=Math.expm1||function(t){return t>=2e-4||t<=-2e-4?Math.exp(t)-1:t+t*t/2+t*t*t/6};function KU(e,t,r){var n={2:"0b",8:"0o",16:"0x"},i=n[t],a="";if(r){if(r<1)throw new Error("size must be in greater than 0");if(!wt(r))throw new Error("size must be an integer");if(e>2**(r-1)-1||e<-(2**(r-1)))throw new Error("Value must be in range [-2^".concat(r-1,", 2^").concat(r-1,"-1]"));if(!wt(e))throw new Error("Value must be an integer");e<0&&(e=e+2**r),a="i".concat(r)}var o="";return e<0&&(e=-e,o="-"),"".concat(o).concat(i).concat(e.toString(t)).concat(a)}function Ip(e,t){if(typeof t=="function")return t(e);if(e===1/0)return"Infinity";if(e===-1/0)return"-Infinity";if(isNaN(e))return"NaN";var{notation:r,precision:n,wordSize:i}=JU(t);switch(r){case"fixed":return eW(e,n);case"exponential":return ise(e,n);case"engineering":return m8e(e,n);case"bin":return KU(e,2,i);case"oct":return KU(e,8,i);case"hex":return KU(e,16,i);case"auto":return h8e(e,n,t).replace(/((\.\d*?)(0+))($|e)/,function(){var a=arguments[2],o=arguments[4];return a!=="."?a+o:o});default:throw new Error('Unknown notation "'+r+'". Choose "auto", "exponential", "fixed", "bin", "oct", or "hex.')}}function JU(e){var t="auto",r,n;if(e!==void 0)if(Qt(e))r=e;else if(It(e))r=e.toNumber();else if(Hm(e))e.precision!==void 0&&(r=Koe(e.precision,()=>{throw new Error('Option "precision" must be a number or BigNumber')})),e.wordSize!==void 0&&(n=Koe(e.wordSize,()=>{throw new Error('Option "wordSize" must be a number or BigNumber')})),e.notation&&(t=e.notation);else throw new Error("Unsupported type of options, number, BigNumber, or object expected");return{notation:t,precision:r,wordSize:n}}function Gw(e){var t=String(e).toLowerCase().match(/^(-?)(\d+\.?\d*)(e([+-]?\d+))?$/);if(!t)throw new SyntaxError("Invalid number "+e);var r=t[1],n=t[2],i=parseFloat(t[4]||"0"),a=n.indexOf(".");i+=a!==-1?a-1:n.length-1;var o=n.replace(".","").replace(/^0*/,function(s){return i-=s.length,""}).replace(/0*$/,"").split("").map(function(s){return parseInt(s)});return o.length===0&&(o.push(0),i++),{sign:r,coefficients:o,exponent:i}}function m8e(e,t){if(isNaN(e)||!isFinite(e))return String(e);var r=Gw(e),n=uT(r,t),i=n.exponent,a=n.coefficients,o=i%3===0?i:i<0?i-3-i%3:i-i%3;if(Qt(t))for(;t>a.length||i-o+1>a.length;)a.push(0);else for(var s=Math.abs(i-o)-(a.length-1),l=0;l0;)c++,u--;var f=a.slice(c).join(""),d=Qt(t)&&f.length||f.match(/[1-9]/)?"."+f:"",p=a.slice(0,c).join("")+d+"e"+(i>=0?"+":"")+o.toString();return n.sign+p}function eW(e,t){if(isNaN(e)||!isFinite(e))return String(e);var r=Gw(e),n=typeof t=="number"?uT(r,r.exponent+1+t):r,i=n.coefficients,a=n.exponent+1,o=a+(t||0);return i.length0?"."+i.join(""):"")+"e"+(a>=0?"+":"")+a}function h8e(e,t,r){if(isNaN(e)||!isFinite(e))return String(e);var n=Joe(r?.lowerExp,-3),i=Joe(r?.upperExp,5),a=Gw(e),o=t?uT(a,t):a;if(o.exponent=i)return ise(e,t);var s=o.coefficients,l=o.exponent;s.length0?l:0;return ut){var i=n.splice(t,n.length-t);if(i[0]>=5){var a=t-1;for(n[a]++;n[a]===10;)n.pop(),a===0&&(n.unshift(0),r.exponent++,a++),a--,n[a]++}}return r}function Vw(e){for(var t=[],r=0;r0?!0:e<0?!1:1/e===1/0,n=t>0?!0:t<0?!1:1/t===1/0;return r^n?-e:e}function Koe(e,t){if(Qt(e))return e;if(It(e))return e.toNumber();t()}function Joe(e,t){return Qt(e)?e:It(e)?e.toNumber():t}function tW(e,t,r){var n=e.constructor,i=new n(2),a="";if(r){if(r<1)throw new Error("size must be in greater than 0");if(!wt(r))throw new Error("size must be an integer");if(e.greaterThan(i.pow(r-1).sub(1))||e.lessThan(i.pow(r-1).mul(-1)))throw new Error("Value must be in range [-2^".concat(r-1,", 2^").concat(r-1,"-1]"));if(!e.isInteger())throw new Error("Value must be an integer");e.lessThan(0)&&(e=e.add(i.pow(r))),a="i".concat(r)}switch(t){case 2:return"".concat(e.toBinary()).concat(a);case 8:return"".concat(e.toOctal()).concat(a);case 16:return"".concat(e.toHexadecimal()).concat(a);default:throw new Error("Base ".concat(t," not supported "))}}function pse(e,t){if(typeof t=="function")return t(e);if(!e.isFinite())return e.isNaN()?"NaN":e.gt(0)?"Infinity":"-Infinity";var{notation:r,precision:n,wordSize:i}=JU(t);switch(r){case"fixed":return v8e(e,n);case"exponential":return fse(e,n);case"engineering":return g8e(e,n);case"bin":return tW(e,2,i);case"oct":return tW(e,8,i);case"hex":return tW(e,16,i);case"auto":{var a=dse(t?.lowerExp,-3),o=dse(t?.upperExp,5);if(e.isZero())return"0";var s,l=e.toSignificantDigits(n),u=l.e;return u>=a&&u=0?"+":"")+n.toString()}function fse(e,t){return t!==void 0?e.toExponential(t-1):e.toExponential()}function v8e(e,t){return e.toFixed(t)}function dse(e,t){return Qt(e)?e:It(e)?e.toNumber():t}function hse(e,t){var r=e.length-t.length,n=e.length;return e.substring(r,n)===t}function tr(e,t){var r=y8e(e,t);return t&&typeof t=="object"&&"truncate"in t&&r.length>t.truncate?r.substring(0,t.truncate-3)+"...":r}function y8e(e,t){if(typeof e=="number")return Ip(e,t);if(It(e))return pse(e,t);if(b8e(e))return!t||t.fraction!=="decimal"?e.s*e.n+"/"+e.d:e.toString();if(Array.isArray(e))return Ase(e,t);if(da(e))return vy(e);if(typeof e=="function")return e.syntax?String(e.syntax):"function";if(e&&typeof e=="object"){if(typeof e.format=="function")return e.format(t);if(e&&e.toString(t)!=={}.toString())return e.toString(t);var r=Object.keys(e).map(n=>vy(n)+": "+tr(e[n],t));return"{"+r.join(", ")+"}"}return String(e)}function vy(e){for(var t=String(e),r="",n=0;n/g,">"),t}function Ase(e,t){if(Array.isArray(e)){for(var r="[",n=e.length,i=0;it?1:-1}function nr(e,t,r){if(!(this instanceof nr))throw new SyntaxError("Constructor must be called with the new operator");this.actual=e,this.expected=t,this.relation=r,this.message="Dimension mismatch ("+(Array.isArray(e)?"["+e.join(", ")+"]":e)+" "+(this.relation||"!=")+" "+(Array.isArray(t)?"["+t.join(", ")+"]":t)+")",this.stack=new Error().stack}nr.prototype=new RangeError;nr.prototype.constructor=RangeError;nr.prototype.name="DimensionError";nr.prototype.isDimensionError=!0;function As(e,t,r){if(!(this instanceof As))throw new SyntaxError("Constructor must be called with the new operator");this.index=e,arguments.length<3?(this.min=0,this.max=t):(this.min=t,this.max=r),this.min!==void 0&&this.index=this.max?this.message="Index out of range ("+this.index+" > "+(this.max-1)+")":this.message="Index out of range ("+this.index+")",this.stack=new Error().stack}As.prototype=new RangeError;As.prototype.constructor=RangeError;As.prototype.name="IndexError";As.prototype.isIndexError=!0;function Yt(e){for(var t=[];Array.isArray(e);)t.push(e.length),e=e[0];return t}function gse(e,t,r){var n,i=e.length;if(i!==t[r])throw new nr(i,t[r]);if(r")}function nW(e,t){var r=t.length===0;if(r){if(Array.isArray(e))throw new nr(e.length,0)}else gse(e,t,0)}function z6(e,t){var r=e.isMatrix?e._size:Yt(e),n=t._sourceSize;n.forEach((i,a)=>{if(i!==null&&i!==r[a])throw new nr(i,r[a])})}function Vn(e,t){if(e!==void 0){if(!Qt(e)||!wt(e))throw new TypeError("Index must be an integer (value: "+e+")");if(e<0||typeof t=="number"&&e>=t)throw new As(e,t)}}function yy(e){for(var t=0;t=0,l=t%r===0;if(s)if(l)n[a]=-t/r;else throw new Error("Could not replace wildcard, since "+t+" is no multiple of "+-r);return n}function vse(e){return e.reduce((t,r)=>t*r,1)}function x8e(e,t){for(var r=e,n,i=t.length-1;i>0;i--){var a=t[i];n=[];for(var o=r.length/a,s=0;st.test(r))}function iW(e,t){return Array.prototype.join.call(e,t)}function LA(e){if(!Array.isArray(e))throw new TypeError("Array input expected");if(e.length===0)return e;var t=[],r=0;t[0]={value:e[0],identifier:0};for(var n=1;n1)return e.slice(1).reduce(function(r,n){return xse(r,n,t,0)},e[0]);throw new Error("Wrong number of arguments in function concat")}function w8e(){for(var e=arguments.length,t=new Array(e),r=0;rd.length),i=Math.max(...n),a=new Array(i).fill(null),o=0;oa[c]&&(a[c]=s[u])}for(var f=0;f1||e[i]>t[a])throw new Error("shape missmatch: missmatch is found in arg with shape (".concat(e,") not possible to broadcast dimension ").concat(n," with size ").concat(e[i]," to size ").concat(t[a]))}}function sW(e,t){var r=Yt(e);if(Pp(r,t))return e;H6(r,t);var n=w8e(r,t),i=n.length,a=[...Array(i-r.length).fill(1),...r],o=E8e(e);r.length!C8e(a)).every(a=>r[a]!==void 0);if(!n){var i=t.filter(a=>r[a]===void 0);throw new Error('Cannot create function "'.concat(e,'", ')+"some dependencies are missing: ".concat(i.map(a=>'"'.concat(a,'"')).join(", "),"."))}}function C8e(e){return e&&e[0]==="?"}function lW(e){return e&&e[0]==="?"?e.slice(1):e}function Zi(e,t){if(kse(e)&&Sse(e,t))return e[t];throw typeof e[t]=="function"&&hT(e,t)?new Error('Cannot access method "'+t+'" as a property'):new Error('No access to property "'+t+'"')}function Gm(e,t,r){if(kse(e)&&Sse(e,t))return e[t]=r,r;throw new Error('No access to property "'+t+'"')}function wse(e,t){return t in e}function Sse(e,t){return!e||typeof e!="object"?!1:Et(D8e,t)?!0:!(t in Object.prototype||t in Function.prototype)}function Ese(e,t){if(!hT(e,t))throw new Error('No access to method "'+t+'"');return e[t]}function hT(e,t){return e==null||typeof e[t]!="function"||Et(e,t)&&Object.getPrototypeOf&&t in Object.getPrototypeOf(e)?!1:Et(O8e,t)?!0:!(t in Object.prototype||t in Function.prototype)}function kse(e){return typeof e=="object"&&e&&e.constructor===Object}var D8e={length:!0,name:!0},O8e={toString:!0,valueOf:!0,toLocaleString:!0};var xy=class{constructor(t){this.wrappedObject=t,this[Symbol.iterator]=this.entries}keys(){return Object.keys(this.wrappedObject).values()}get(t){return Zi(this.wrappedObject,t)}set(t,r){return Gm(this.wrappedObject,t,r),this}has(t){return wse(this.wrappedObject,t)}entries(){return Cse(this.keys(),t=>[t,this.get(t)])}forEach(t){for(var r of this.keys())t(this.get(r),r,this)}delete(t){delete this.wrappedObject[t]}clear(){for(var t of this.keys())this.delete(t)}get size(){return Object.keys(this.wrappedObject).length}},Xw=class{constructor(t,r,n){this.a=t,this.b=r,this.bKeys=n,this[Symbol.iterator]=this.entries}get(t){return this.bKeys.has(t)?this.b.get(t):this.a.get(t)}set(t,r){return this.bKeys.has(t)?this.b.set(t,r):this.a.set(t,r),this}has(t){return this.b.has(t)||this.a.has(t)}keys(){return new Set([...this.a.keys(),...this.b.keys()])[Symbol.iterator]()}entries(){return Cse(this.keys(),t=>[t,this.get(t)])}forEach(t){for(var r of this.keys())t(this.get(r),r,this)}delete(t){return this.bKeys.has(t)?this.b.delete(t):this.a.delete(t)}clear(){this.a.clear(),this.b.clear()}get size(){return[...this.keys()].length}};function Cse(e,t){return{next:()=>{var r=e.next();return r.done?r:{value:t(r.value),done:!1}}}}function L0(){return new Map}function zA(e){if(!e)return L0();if(uW(e))return e;if(Hm(e))return new xy(e);throw new Error("createMap can create maps from objects or Maps")}function Dse(e){if(e instanceof xy)return e.wrappedObject;var t={};for(var r of e.keys()){var n=e.get(r);Gm(t,r,n)}return t}function uW(e){return e?e instanceof Map||e instanceof xy||typeof e.set=="function"&&typeof e.get=="function"&&typeof e.keys=="function"&&typeof e.has=="function":!1}var Ose=function(){return Ose=dW.default.create,dW.default},M8e=["?BigNumber","?Complex","?DenseMatrix","?Fraction"],gT=V("typed",M8e,function(t){var{BigNumber:r,Complex:n,DenseMatrix:i,Fraction:a}=t,o=Ose();return o.clear(),o.addTypes([{name:"number",test:Qt},{name:"Complex",test:ds},{name:"BigNumber",test:It},{name:"Fraction",test:gf},{name:"Unit",test:Fo},{name:"identifier",test:s=>da&&/^(?:[A-Za-z\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0560-\u0588\u05D0-\u05EA\u05EF-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u0860-\u086A\u0870-\u0887\u0889-\u088E\u08A0-\u08C9\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u09FC\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C5D\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D04-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E86-\u0E8A\u0E8C-\u0EA3\u0EA5\u0EA7-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16F1-\u16F8\u1700-\u1711\u171F-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1878\u1880-\u1884\u1887-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4C\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C88\u1C90-\u1CBA\u1CBD-\u1CBF\u1CE9-\u1CEC\u1CEE-\u1CF3\u1CF5\u1CF6\u1CFA\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2183\u2184\u2C00-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005\u3006\u3031-\u3035\u303B\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312F\u3131-\u318E\u31A0-\u31BF\u31F0-\u31FF\u3400-\u4DBF\u4E00-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6E5\uA717-\uA71F\uA722-\uA788\uA78B-\uA7CA\uA7D0\uA7D1\uA7D3\uA7D5-\uA7D9\uA7F2-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA8FE\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB69\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDE80-\uDE9C\uDEA0-\uDED0\uDF00-\uDF1F\uDF2D-\uDF40\uDF42-\uDF49\uDF50-\uDF75\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF]|\uD801[\uDC00-\uDC9D\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDD70-\uDD7A\uDD7C-\uDD8A\uDD8C-\uDD92\uDD94\uDD95\uDD97-\uDDA1\uDDA3-\uDDB1\uDDB3-\uDDB9\uDDBB\uDDBC\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67\uDF80-\uDF85\uDF87-\uDFB0\uDFB2-\uDFBA]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00\uDE10-\uDE13\uDE15-\uDE17\uDE19-\uDE35\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE4\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2\uDD00-\uDD23\uDE80-\uDEA9\uDEB0\uDEB1\uDF00-\uDF1C\uDF27\uDF30-\uDF45\uDF70-\uDF81\uDFB0-\uDFC4\uDFE0-\uDFF6]|\uD804[\uDC03-\uDC37\uDC71\uDC72\uDC75\uDC83-\uDCAF\uDCD0-\uDCE8\uDD03-\uDD26\uDD44\uDD47\uDD50-\uDD72\uDD76\uDD83-\uDDB2\uDDC1-\uDDC4\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE2B\uDE3F\uDE40\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEDE\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF50\uDF5D-\uDF61]|\uD805[\uDC00-\uDC34\uDC47-\uDC4A\uDC5F-\uDC61\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDD80-\uDDAE\uDDD8-\uDDDB\uDE00-\uDE2F\uDE44\uDE80-\uDEAA\uDEB8\uDF00-\uDF1A\uDF40-\uDF46]|\uD806[\uDC00-\uDC2B\uDCA0-\uDCDF\uDCFF-\uDD06\uDD09\uDD0C-\uDD13\uDD15\uDD16\uDD18-\uDD2F\uDD3F\uDD41\uDDA0-\uDDA7\uDDAA-\uDDD0\uDDE1\uDDE3\uDE00\uDE0B-\uDE32\uDE3A\uDE50\uDE5C-\uDE89\uDE9D\uDEB0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC2E\uDC40\uDC72-\uDC8F\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD30\uDD46\uDD60-\uDD65\uDD67\uDD68\uDD6A-\uDD89\uDD98\uDEE0-\uDEF2\uDF02\uDF04-\uDF10\uDF12-\uDF33\uDFB0]|\uD808[\uDC00-\uDF99]|\uD809[\uDC80-\uDD43]|\uD80B[\uDF90-\uDFF0]|[\uD80C\uD81C-\uD820\uD822\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879\uD880-\uD883\uD885-\uD887][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2F\uDC41-\uDC46]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDE70-\uDEBE\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDE40-\uDE7F\uDF00-\uDF4A\uDF50\uDF93-\uDF9F\uDFE0\uDFE1\uDFE3]|\uD821[\uDC00-\uDFF7]|\uD823[\uDC00-\uDCD5\uDD00-\uDD08]|\uD82B[\uDFF0-\uDFF3\uDFF5-\uDFFB\uDFFD\uDFFE]|\uD82C[\uDC00-\uDD22\uDD32\uDD50-\uDD52\uDD55\uDD64-\uDD67\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB]|\uD837[\uDF00-\uDF1E\uDF25-\uDF2A]|\uD838[\uDC30-\uDC6D\uDD00-\uDD2C\uDD37-\uDD3D\uDD4E\uDE90-\uDEAD\uDEC0-\uDEEB]|\uD839[\uDCD0-\uDCEB\uDFE0-\uDFE6\uDFE8-\uDFEB\uDFED\uDFEE\uDFF0-\uDFFE]|\uD83A[\uDC00-\uDCC4\uDD00-\uDD43\uDD4B]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDEDF\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF39\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D]|\uD884[\uDC00-\uDF4A\uDF50-\uDFFF]|\uD888[\uDC00-\uDFAF])(?:[0-9A-Za-z\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0560-\u0588\u05D0-\u05EA\u05EF-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u0860-\u086A\u0870-\u0887\u0889-\u088E\u08A0-\u08C9\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u09FC\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C5D\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D04-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E86-\u0E8A\u0E8C-\u0EA3\u0EA5\u0EA7-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16F1-\u16F8\u1700-\u1711\u171F-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1878\u1880-\u1884\u1887-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4C\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C88\u1C90-\u1CBA\u1CBD-\u1CBF\u1CE9-\u1CEC\u1CEE-\u1CF3\u1CF5\u1CF6\u1CFA\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2183\u2184\u2C00-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005\u3006\u3031-\u3035\u303B\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312F\u3131-\u318E\u31A0-\u31BF\u31F0-\u31FF\u3400-\u4DBF\u4E00-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6E5\uA717-\uA71F\uA722-\uA788\uA78B-\uA7CA\uA7D0\uA7D1\uA7D3\uA7D5-\uA7D9\uA7F2-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA8FE\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB69\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDE80-\uDE9C\uDEA0-\uDED0\uDF00-\uDF1F\uDF2D-\uDF40\uDF42-\uDF49\uDF50-\uDF75\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF]|\uD801[\uDC00-\uDC9D\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDD70-\uDD7A\uDD7C-\uDD8A\uDD8C-\uDD92\uDD94\uDD95\uDD97-\uDDA1\uDDA3-\uDDB1\uDDB3-\uDDB9\uDDBB\uDDBC\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67\uDF80-\uDF85\uDF87-\uDFB0\uDFB2-\uDFBA]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00\uDE10-\uDE13\uDE15-\uDE17\uDE19-\uDE35\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE4\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2\uDD00-\uDD23\uDE80-\uDEA9\uDEB0\uDEB1\uDF00-\uDF1C\uDF27\uDF30-\uDF45\uDF70-\uDF81\uDFB0-\uDFC4\uDFE0-\uDFF6]|\uD804[\uDC03-\uDC37\uDC71\uDC72\uDC75\uDC83-\uDCAF\uDCD0-\uDCE8\uDD03-\uDD26\uDD44\uDD47\uDD50-\uDD72\uDD76\uDD83-\uDDB2\uDDC1-\uDDC4\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE2B\uDE3F\uDE40\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEDE\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF50\uDF5D-\uDF61]|\uD805[\uDC00-\uDC34\uDC47-\uDC4A\uDC5F-\uDC61\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDD80-\uDDAE\uDDD8-\uDDDB\uDE00-\uDE2F\uDE44\uDE80-\uDEAA\uDEB8\uDF00-\uDF1A\uDF40-\uDF46]|\uD806[\uDC00-\uDC2B\uDCA0-\uDCDF\uDCFF-\uDD06\uDD09\uDD0C-\uDD13\uDD15\uDD16\uDD18-\uDD2F\uDD3F\uDD41\uDDA0-\uDDA7\uDDAA-\uDDD0\uDDE1\uDDE3\uDE00\uDE0B-\uDE32\uDE3A\uDE50\uDE5C-\uDE89\uDE9D\uDEB0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC2E\uDC40\uDC72-\uDC8F\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD30\uDD46\uDD60-\uDD65\uDD67\uDD68\uDD6A-\uDD89\uDD98\uDEE0-\uDEF2\uDF02\uDF04-\uDF10\uDF12-\uDF33\uDFB0]|\uD808[\uDC00-\uDF99]|\uD809[\uDC80-\uDD43]|\uD80B[\uDF90-\uDFF0]|[\uD80C\uD81C-\uD820\uD822\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879\uD880-\uD883\uD885-\uD887][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2F\uDC41-\uDC46]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDE70-\uDEBE\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDE40-\uDE7F\uDF00-\uDF4A\uDF50\uDF93-\uDF9F\uDFE0\uDFE1\uDFE3]|\uD821[\uDC00-\uDFF7]|\uD823[\uDC00-\uDCD5\uDD00-\uDD08]|\uD82B[\uDFF0-\uDFF3\uDFF5-\uDFFB\uDFFD\uDFFE]|\uD82C[\uDC00-\uDD22\uDD32\uDD50-\uDD52\uDD55\uDD64-\uDD67\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB]|\uD837[\uDF00-\uDF1E\uDF25-\uDF2A]|\uD838[\uDC30-\uDC6D\uDD00-\uDD2C\uDD37-\uDD3D\uDD4E\uDE90-\uDEAD\uDEC0-\uDEEB]|\uD839[\uDCD0-\uDCEB\uDFE0-\uDFE6\uDFE8-\uDFEB\uDFED\uDFEE\uDFF0-\uDFFE]|\uD83A[\uDC00-\uDCC4\uDD00-\uDD43\uDD4B]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDEDF\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF39\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D]|\uD884[\uDC00-\uDF4A\uDF50-\uDFFF]|\uD888[\uDC00-\uDFAF])*$/.test(s)},{name:"string",test:da},{name:"Chain",test:Uw},{name:"Array",test:Ir},{name:"Matrix",test:St},{name:"DenseMatrix",test:qA},{name:"SparseMatrix",test:vf},{name:"Range",test:R0},{name:"Index",test:Wm},{name:"boolean",test:VN},{name:"ResultSet",test:GN},{name:"Help",test:zw},{name:"function",test:QN},{name:"Date",test:YN},{name:"RegExp",test:ZN},{name:"null",test:XN},{name:"undefined",test:KN},{name:"AccessorNode",test:Uu},{name:"ArrayNode",test:ps},{name:"AssignmentNode",test:JN},{name:"BlockNode",test:eT},{name:"ConditionalNode",test:tT},{name:"ConstantNode",test:gr},{name:"FunctionNode",test:xl},{name:"FunctionAssignmentNode",test:Ed},{name:"IndexNode",test:Sc},{name:"Node",test:Nr},{name:"ObjectNode",test:Vm},{name:"OperatorNode",test:bi},{name:"ParenthesisNode",test:ms},{name:"RangeNode",test:rT},{name:"RelationalNode",test:nT},{name:"SymbolNode",test:ri},{name:"Map",test:uW},{name:"Object",test:Hm}]),o.addConversions([{from:"number",to:"BigNumber",convert:function(l){if(r||cW(l),ase(l)>15)throw new TypeError("Cannot implicitly convert a number with >15 significant digits to BigNumber (value: "+l+"). Use function bignumber(x) to convert to BigNumber.");return new r(l)}},{from:"number",to:"Complex",convert:function(l){return n||AT(l),new n(l,0)}},{from:"BigNumber",to:"Complex",convert:function(l){return n||AT(l),new n(l.toNumber(),0)}},{from:"Fraction",to:"BigNumber",convert:function(l){throw new TypeError("Cannot implicitly convert a Fraction to BigNumber or vice versa. Use function bignumber(x) to convert to BigNumber or fraction(x) to convert to Fraction.")}},{from:"Fraction",to:"Complex",convert:function(l){return n||AT(l),new n(l.valueOf(),0)}},{from:"number",to:"Fraction",convert:function(l){a||fW(l);var u=new a(l);if(u.valueOf()!==l)throw new TypeError("Cannot implicitly convert a number to a Fraction when there will be a loss of precision (value: "+l+"). Use function fraction(x) to convert to Fraction.");return u}},{from:"string",to:"number",convert:function(l){var u=Number(l);if(isNaN(u))throw new Error('Cannot convert "'+l+'" to a number');return u}},{from:"string",to:"BigNumber",convert:function(l){r||cW(l);try{return new r(l)}catch{throw new Error('Cannot convert "'+l+'" to BigNumber')}}},{from:"string",to:"Fraction",convert:function(l){a||fW(l);try{return new a(l)}catch{throw new Error('Cannot convert "'+l+'" to Fraction')}}},{from:"string",to:"Complex",convert:function(l){n||AT(l);try{return new n(l)}catch{throw new Error('Cannot convert "'+l+'" to Complex')}}},{from:"boolean",to:"number",convert:function(l){return+l}},{from:"boolean",to:"BigNumber",convert:function(l){return r||cW(l),new r(+l)}},{from:"boolean",to:"Fraction",convert:function(l){return a||fW(l),new a(+l)}},{from:"boolean",to:"string",convert:function(l){return String(l)}},{from:"Array",to:"Matrix",convert:function(l){return i||j8e(),new i(l)}},{from:"Matrix",to:"Array",convert:function(l){return l.valueOf()}}]),o.onMismatch=(s,l,u)=>{var c=o.createError(s,l,u);if(["wrongType","mismatch"].includes(c.data.category)&&l.length===1&&Da(l[0])&&u.some(d=>!d.params.includes(","))){var f=new TypeError("Function '".concat(s,"' doesn't apply to matrices. To call it ")+"elementwise on a matrix 'M', try 'map(M, ".concat(s,")'."));throw f.data=c.data,f}throw c},o.onMismatch=(s,l,u)=>{var c=o.createError(s,l,u);if(["wrongType","mismatch"].includes(c.data.category)&&l.length===1&&Da(l[0])&&u.some(d=>!d.params.includes(","))){var f=new TypeError("Function '".concat(s,"' doesn't apply to matrices. To call it ")+"elementwise on a matrix 'M', try 'map(M, ".concat(s,")'."));throw f.data=c.data,f}throw c},o});function cW(e){throw new Error("Cannot convert value ".concat(e," into a BigNumber: no class 'BigNumber' provided"))}function AT(e){throw new Error("Cannot convert value ".concat(e," into a Complex number: no class 'Complex' provided"))}function j8e(){throw new Error("Cannot convert array into a Matrix: no class 'DenseMatrix' provided")}function fW(e){throw new Error("Cannot convert value ".concat(e," into a Fraction, no class 'Fraction' provided."))}var N8e="ResultSet",T8e=[],vT=V(N8e,T8e,()=>{function e(t){if(!(this instanceof e))throw new SyntaxError("Constructor must be called with the new operator");this.entries=t||[]}return e.prototype.type="ResultSet",e.prototype.isResultSet=!0,e.prototype.valueOf=function(){return this.entries},e.prototype.toString=function(){return"["+this.entries.join(", ")+"]"},e.prototype.toJSON=function(){return{mathjs:"ResultSet",entries:this.entries}},e.fromJSON=function(t){return new e(t.entries)},e},{isClass:!0});var Kw=9e15,H0=1e9,pW="0123456789abcdef",bT="2.3025850929940456840179914546843642076011014886287729760333279009675726096773524802359972050895982983419677840422862486334095254650828067566662873690987816894829072083255546808437998948262331985283935053089653777326288461633662222876982198867465436674744042432743651550489343149393914796194044002221051017141748003688084012647080685567743216228355220114804663715659121373450747856947683463616792101806445070648000277502684916746550586856935673420670581136429224554405758925724208241314695689016758940256776311356919292033376587141660230105703089634572075440370847469940168269282808481184289314848524948644871927809676271275775397027668605952496716674183485704422507197965004714951050492214776567636938662976979522110718264549734772662425709429322582798502585509785265383207606726317164309505995087807523710333101197857547331541421808427543863591778117054309827482385045648019095610299291824318237525357709750539565187697510374970888692180205189339507238539205144634197265287286965110862571492198849978748873771345686209167058",xT="3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679821480865132823066470938446095505822317253594081284811174502841027019385211055596446229489549303819644288109756659334461284756482337867831652712019091456485669234603486104543266482133936072602491412737245870066063155881748815209209628292540917153643678925903600113305305488204665213841469519415116094330572703657595919530921861173819326117931051185480744623799627495673518857527248912279381830119491298336733624406566430860213949463952247371907021798609437027705392171762931767523846748184676694051320005681271452635608277857713427577896091736371787214684409012249534301465495853710507922796892589235420199561121290219608640344181598136297747713099605187072113499999983729780499510597317328160963185950244594553469083026425223082533446850352619311881710100031378387528865875332083814206171776691473035982534904287554687311595628638823537875937519577818577805321712268066130019278766111959092164201989380952572010654858632789",mW={precision:20,rounding:4,modulo:1,toExpNeg:-7,toExpPos:21,minE:-Kw,maxE:Kw,crypto:!1},Tse,UA,Br=!0,ST="[DecimalError] ",W0=ST+"Invalid argument: ",Fse=ST+"Precision limit exceeded",_se=ST+"crypto unavailable",Pse="[object Decimal]",iu=Math.floor,gs=Math.pow,F8e=/^0b([01]+(\.[01]*)?|\.[01]+)(p[+-]?\d+)?$/i,_8e=/^0x([0-9a-f]+(\.[0-9a-f]*)?|\.[0-9a-f]+)(p[+-]?\d+)?$/i,P8e=/^0o([0-7]+(\.[0-7]*)?|\.[0-7]+)(p[+-]?\d+)?$/i,Ise=/^(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,$p=1e7,vr=7,I8e=9007199254740991,B8e=bT.length-1,hW=xT.length-1,pt={toStringTag:Pse};pt.absoluteValue=pt.abs=function(){var e=new this.constructor(this);return e.s<0&&(e.s=1),cr(e)};pt.ceil=function(){return cr(new this.constructor(this),this.e+1,2)};pt.clampedTo=pt.clamp=function(e,t){var r,n=this,i=n.constructor;if(e=new i(e),t=new i(t),!e.s||!t.s)return new i(NaN);if(e.gt(t))throw Error(W0+t);return r=n.cmp(e),r<0?e:n.cmp(t)>0?t:new i(n)};pt.comparedTo=pt.cmp=function(e){var t,r,n,i,a=this,o=a.d,s=(e=new a.constructor(e)).d,l=a.s,u=e.s;if(!o||!s)return!l||!u?NaN:l!==u?l:o===s?0:!o^l<0?1:-1;if(!o[0]||!s[0])return o[0]?l:s[0]?-u:0;if(l!==u)return l;if(a.e!==e.e)return a.e>e.e^l<0?1:-1;for(n=o.length,i=s.length,t=0,r=ns[t]^l<0?1:-1;return n===i?0:n>i^l<0?1:-1};pt.cosine=pt.cos=function(){var e,t,r=this,n=r.constructor;return r.d?r.d[0]?(e=n.precision,t=n.rounding,n.precision=e+Math.max(r.e,r.sd())+vr,n.rounding=1,r=R8e(n,Lse(n,r)),n.precision=e,n.rounding=t,cr(UA==2||UA==3?r.neg():r,e,t,!0)):new n(1):new n(NaN)};pt.cubeRoot=pt.cbrt=function(){var e,t,r,n,i,a,o,s,l,u,c=this,f=c.constructor;if(!c.isFinite()||c.isZero())return new f(c);for(Br=!1,a=c.s*gs(c.s*c,1/3),!a||Math.abs(a)==1/0?(r=wl(c.d),e=c.e,(a=(e-r.length+1)%3)&&(r+=a==1||a==-2?"0":"00"),a=gs(r,1/3),e=iu((e+1)/3)-(e%3==(e<0?-1:2)),a==1/0?r="5e"+e:(r=a.toExponential(),r=r.slice(0,r.indexOf("e")+1)+e),n=new f(r),n.s=c.s):n=new f(a.toString()),o=(e=f.precision)+3;;)if(s=n,l=s.times(s).times(s),u=l.plus(c),n=Xi(u.plus(c).times(s),u.plus(l),o+2,1),wl(s.d).slice(0,o)===(r=wl(n.d)).slice(0,o))if(r=r.slice(o-3,o+1),r=="9999"||!i&&r=="4999"){if(!i&&(cr(s,e+1,0),s.times(s).times(s).eq(c))){n=s;break}o+=4,i=1}else{(!+r||!+r.slice(1)&&r.charAt(0)=="5")&&(cr(n,e+1,1),t=!n.times(n).times(n).eq(c));break}return Br=!0,cr(n,e,f.rounding,t)};pt.decimalPlaces=pt.dp=function(){var e,t=this.d,r=NaN;if(t){if(e=t.length-1,r=(e-iu(this.e/vr))*vr,e=t[e],e)for(;e%10==0;e/=10)r--;r<0&&(r=0)}return r};pt.dividedBy=pt.div=function(e){return Xi(this,new this.constructor(e))};pt.dividedToIntegerBy=pt.divToInt=function(e){var t=this,r=t.constructor;return cr(Xi(t,new r(e),0,1,1),r.precision,r.rounding)};pt.equals=pt.eq=function(e){return this.cmp(e)===0};pt.floor=function(){return cr(new this.constructor(this),this.e+1,3)};pt.greaterThan=pt.gt=function(e){return this.cmp(e)>0};pt.greaterThanOrEqualTo=pt.gte=function(e){var t=this.cmp(e);return t==1||t===0};pt.hyperbolicCosine=pt.cosh=function(){var e,t,r,n,i,a=this,o=a.constructor,s=new o(1);if(!a.isFinite())return new o(a.s?1/0:NaN);if(a.isZero())return s;r=o.precision,n=o.rounding,o.precision=r+Math.max(a.e,a.sd())+4,o.rounding=1,i=a.d.length,i<32?(e=Math.ceil(i/3),t=(1/kT(4,e)).toString()):(e=16,t="2.3283064365386962890625e-10"),a=Jw(o,1,a.times(t),new o(1),!0);for(var l,u=e,c=new o(8);u--;)l=a.times(a),a=s.minus(l.times(c.minus(l.times(c))));return cr(a,o.precision=r,o.rounding=n,!0)};pt.hyperbolicSine=pt.sinh=function(){var e,t,r,n,i=this,a=i.constructor;if(!i.isFinite()||i.isZero())return new a(i);if(t=a.precision,r=a.rounding,a.precision=t+Math.max(i.e,i.sd())+4,a.rounding=1,n=i.d.length,n<3)i=Jw(a,2,i,i,!0);else{e=1.4*Math.sqrt(n),e=e>16?16:e|0,i=i.times(1/kT(5,e)),i=Jw(a,2,i,i,!0);for(var o,s=new a(5),l=new a(16),u=new a(20);e--;)o=i.times(i),i=i.times(s.plus(o.times(l.times(o).plus(u))))}return a.precision=t,a.rounding=r,cr(i,t,r,!0)};pt.hyperbolicTangent=pt.tanh=function(){var e,t,r=this,n=r.constructor;return r.isFinite()?r.isZero()?new n(r):(e=n.precision,t=n.rounding,n.precision=e+7,n.rounding=1,Xi(r.sinh(),r.cosh(),n.precision=e,n.rounding=t)):new n(r.s)};pt.inverseCosine=pt.acos=function(){var e,t=this,r=t.constructor,n=t.abs().cmp(1),i=r.precision,a=r.rounding;return n!==-1?n===0?t.isNeg()?Rp(r,i,a):new r(0):new r(NaN):t.isZero()?Rp(r,i+4,a).times(.5):(r.precision=i+6,r.rounding=1,t=t.asin(),e=Rp(r,i+4,a).times(.5),r.precision=i,r.rounding=a,e.minus(t))};pt.inverseHyperbolicCosine=pt.acosh=function(){var e,t,r=this,n=r.constructor;return r.lte(1)?new n(r.eq(1)?0:NaN):r.isFinite()?(e=n.precision,t=n.rounding,n.precision=e+Math.max(Math.abs(r.e),r.sd())+4,n.rounding=1,Br=!1,r=r.times(r).minus(1).sqrt().plus(r),Br=!0,n.precision=e,n.rounding=t,r.ln()):new n(r)};pt.inverseHyperbolicSine=pt.asinh=function(){var e,t,r=this,n=r.constructor;return!r.isFinite()||r.isZero()?new n(r):(e=n.precision,t=n.rounding,n.precision=e+2*Math.max(Math.abs(r.e),r.sd())+6,n.rounding=1,Br=!1,r=r.times(r).plus(1).sqrt().plus(r),Br=!0,n.precision=e,n.rounding=t,r.ln())};pt.inverseHyperbolicTangent=pt.atanh=function(){var e,t,r,n,i=this,a=i.constructor;return i.isFinite()?i.e>=0?new a(i.abs().eq(1)?i.s/0:i.isZero()?i:NaN):(e=a.precision,t=a.rounding,n=i.sd(),Math.max(n,e)<2*-i.e-1?cr(new a(i),e,t,!0):(a.precision=r=n-i.e,i=Xi(i.plus(1),new a(1).minus(i),r+e,1),a.precision=e+4,a.rounding=1,i=i.ln(),a.precision=e,a.rounding=t,i.times(.5))):new a(NaN)};pt.inverseSine=pt.asin=function(){var e,t,r,n,i=this,a=i.constructor;return i.isZero()?new a(i):(t=i.abs().cmp(1),r=a.precision,n=a.rounding,t!==-1?t===0?(e=Rp(a,r+4,n).times(.5),e.s=i.s,e):new a(NaN):(a.precision=r+6,a.rounding=1,i=i.div(new a(1).minus(i.times(i)).sqrt().plus(1)).atan(),a.precision=r,a.rounding=n,i.times(2)))};pt.inverseTangent=pt.atan=function(){var e,t,r,n,i,a,o,s,l,u=this,c=u.constructor,f=c.precision,d=c.rounding;if(u.isFinite()){if(u.isZero())return new c(u);if(u.abs().eq(1)&&f+4<=hW)return o=Rp(c,f+4,d).times(.25),o.s=u.s,o}else{if(!u.s)return new c(NaN);if(f+4<=hW)return o=Rp(c,f+4,d).times(.5),o.s=u.s,o}for(c.precision=s=f+10,c.rounding=1,r=Math.min(28,s/vr+2|0),e=r;e;--e)u=u.div(u.times(u).plus(1).sqrt().plus(1));for(Br=!1,t=Math.ceil(s/vr),n=1,l=u.times(u),o=new c(u),i=u;e!==-1;)if(i=i.times(l),a=o.minus(i.div(n+=2)),i=i.times(l),o=a.plus(i.div(n+=2)),o.d[t]!==void 0)for(e=t;o.d[e]===a.d[e]&&e--;);return r&&(o=o.times(2<this.d.length-2};pt.isNaN=function(){return!this.s};pt.isNegative=pt.isNeg=function(){return this.s<0};pt.isPositive=pt.isPos=function(){return this.s>0};pt.isZero=function(){return!!this.d&&this.d[0]===0};pt.lessThan=pt.lt=function(e){return this.cmp(e)<0};pt.lessThanOrEqualTo=pt.lte=function(e){return this.cmp(e)<1};pt.logarithm=pt.log=function(e){var t,r,n,i,a,o,s,l,u=this,c=u.constructor,f=c.precision,d=c.rounding,p=5;if(e==null)e=new c(10),t=!0;else{if(e=new c(e),r=e.d,e.s<0||!r||!r[0]||e.eq(1))return new c(NaN);t=e.eq(10)}if(r=u.d,u.s<0||!r||!r[0]||u.eq(1))return new c(r&&!r[0]?-1/0:u.s!=1?NaN:r?0:1/0);if(t)if(r.length>1)a=!0;else{for(i=r[0];i%10===0;)i/=10;a=i!==1}if(Br=!1,s=f+p,o=U0(u,s),n=t?wT(c,s+10):U0(e,s),l=Xi(o,n,s,1),V6(l.d,i=f,d))do if(s+=10,o=U0(u,s),n=t?wT(c,s+10):U0(e,s),l=Xi(o,n,s,1),!a){+wl(l.d).slice(i+1,i+15)+1==1e14&&(l=cr(l,f+1,0));break}while(V6(l.d,i+=10,d));return Br=!0,cr(l,f,d)};pt.minus=pt.sub=function(e){var t,r,n,i,a,o,s,l,u,c,f,d,p=this,h=p.constructor;if(e=new h(e),!p.d||!e.d)return!p.s||!e.s?e=new h(NaN):p.d?e.s=-e.s:e=new h(e.d||p.s!==e.s?p:NaN),e;if(p.s!=e.s)return e.s=-e.s,p.plus(e);if(u=p.d,d=e.d,s=h.precision,l=h.rounding,!u[0]||!d[0]){if(d[0])e.s=-e.s;else if(u[0])e=new h(p);else return new h(l===3?-0:0);return Br?cr(e,s,l):e}if(r=iu(e.e/vr),c=iu(p.e/vr),u=u.slice(),a=c-r,a){for(f=a<0,f?(t=u,a=-a,o=d.length):(t=d,r=c,o=u.length),n=Math.max(Math.ceil(s/vr),o)+2,a>n&&(a=n,t.length=1),t.reverse(),n=a;n--;)t.push(0);t.reverse()}else{for(n=u.length,o=d.length,f=n0;--n)u[o++]=0;for(n=d.length;n>a;){if(u[--n]o?a+1:o+1,i>o&&(i=o,r.length=1),r.reverse();i--;)r.push(0);r.reverse()}for(o=u.length,i=c.length,o-i<0&&(i=o,r=c,c=u,u=r),t=0;i;)t=(u[--i]=u[i]+c[i]+t)/$p|0,u[i]%=$p;for(t&&(u.unshift(t),++n),o=u.length;u[--o]==0;)u.pop();return e.d=u,e.e=ET(u,n),Br?cr(e,s,l):e};pt.precision=pt.sd=function(e){var t,r=this;if(e!==void 0&&e!==!!e&&e!==1&&e!==0)throw Error(W0+e);return r.d?(t=Bse(r.d),e&&r.e+1>t&&(t=r.e+1)):t=NaN,t};pt.round=function(){var e=this,t=e.constructor;return cr(new t(e),e.e+1,t.rounding)};pt.sine=pt.sin=function(){var e,t,r=this,n=r.constructor;return r.isFinite()?r.isZero()?new n(r):(e=n.precision,t=n.rounding,n.precision=e+Math.max(r.e,r.sd())+vr,n.rounding=1,r=q8e(n,Lse(n,r)),n.precision=e,n.rounding=t,cr(UA>2?r.neg():r,e,t,!0)):new n(NaN)};pt.squareRoot=pt.sqrt=function(){var e,t,r,n,i,a,o=this,s=o.d,l=o.e,u=o.s,c=o.constructor;if(u!==1||!s||!s[0])return new c(!u||u<0&&(!s||s[0])?NaN:s?o:1/0);for(Br=!1,u=Math.sqrt(+o),u==0||u==1/0?(t=wl(s),(t.length+l)%2==0&&(t+="0"),u=Math.sqrt(t),l=iu((l+1)/2)-(l<0||l%2),u==1/0?t="5e"+l:(t=u.toExponential(),t=t.slice(0,t.indexOf("e")+1)+l),n=new c(t)):n=new c(u.toString()),r=(l=c.precision)+3;;)if(a=n,n=a.plus(Xi(o,a,r+2,1)).times(.5),wl(a.d).slice(0,r)===(t=wl(n.d)).slice(0,r))if(t=t.slice(r-3,r+1),t=="9999"||!i&&t=="4999"){if(!i&&(cr(a,l+1,0),a.times(a).eq(o))){n=a;break}r+=4,i=1}else{(!+t||!+t.slice(1)&&t.charAt(0)=="5")&&(cr(n,l+1,1),e=!n.times(n).eq(o));break}return Br=!0,cr(n,l,c.rounding,e)};pt.tangent=pt.tan=function(){var e,t,r=this,n=r.constructor;return r.isFinite()?r.isZero()?new n(r):(e=n.precision,t=n.rounding,n.precision=e+10,n.rounding=1,r=r.sin(),r.s=1,r=Xi(r,new n(1).minus(r.times(r)).sqrt(),e+10,0),n.precision=e,n.rounding=t,cr(UA==2||UA==4?r.neg():r,e,t,!0)):new n(NaN)};pt.times=pt.mul=function(e){var t,r,n,i,a,o,s,l,u,c=this,f=c.constructor,d=c.d,p=(e=new f(e)).d;if(e.s*=c.s,!d||!d[0]||!p||!p[0])return new f(!e.s||d&&!d[0]&&!p||p&&!p[0]&&!d?NaN:!d||!p?e.s/0:e.s*0);for(r=iu(c.e/vr)+iu(e.e/vr),l=d.length,u=p.length,l=0;){for(t=0,i=l+n;i>n;)s=a[i]+p[n]*d[i-n-1]+t,a[i--]=s%$p|0,t=s/$p|0;a[i]=(a[i]+t)%$p|0}for(;!a[--o];)a.pop();return t?++r:a.shift(),e.d=a,e.e=ET(a,r),Br?cr(e,f.precision,f.rounding):e};pt.toBinary=function(e,t){return vW(this,2,e,t)};pt.toDecimalPlaces=pt.toDP=function(e,t){var r=this,n=r.constructor;return r=new n(r),e===void 0?r:(kc(e,0,H0),t===void 0?t=n.rounding:kc(t,0,8),cr(r,e+r.e+1,t))};pt.toExponential=function(e,t){var r,n=this,i=n.constructor;return e===void 0?r=Qm(n,!0):(kc(e,0,H0),t===void 0?t=i.rounding:kc(t,0,8),n=cr(new i(n),e+1,t),r=Qm(n,!0,e+1)),n.isNeg()&&!n.isZero()?"-"+r:r};pt.toFixed=function(e,t){var r,n,i=this,a=i.constructor;return e===void 0?r=Qm(i):(kc(e,0,H0),t===void 0?t=a.rounding:kc(t,0,8),n=cr(new a(i),e+i.e+1,t),r=Qm(n,!1,e+n.e+1)),i.isNeg()&&!i.isZero()?"-"+r:r};pt.toFraction=function(e){var t,r,n,i,a,o,s,l,u,c,f,d,p=this,h=p.d,m=p.constructor;if(!h)return new m(p);if(u=r=new m(1),n=l=new m(0),t=new m(n),a=t.e=Bse(h)-p.e-1,o=a%vr,t.d[0]=gs(10,o<0?vr+o:o),e==null)e=a>0?t:u;else{if(s=new m(e),!s.isInt()||s.lt(u))throw Error(W0+s);e=s.gt(t)?a>0?t:u:s}for(Br=!1,s=new m(wl(h)),c=m.precision,m.precision=a=h.length*vr*2;f=Xi(s,t,0,1,1),i=r.plus(f.times(n)),i.cmp(e)!=1;)r=n,n=i,i=u,u=l.plus(f.times(i)),l=i,i=t,t=s.minus(f.times(i)),s=i;return i=Xi(e.minus(r),n,0,1,1),l=l.plus(i.times(u)),r=r.plus(i.times(n)),l.s=u.s=p.s,d=Xi(u,n,a,1).minus(p).abs().cmp(Xi(l,r,a,1).minus(p).abs())<1?[u,n]:[l,r],m.precision=c,Br=!0,d};pt.toHexadecimal=pt.toHex=function(e,t){return vW(this,16,e,t)};pt.toNearest=function(e,t){var r=this,n=r.constructor;if(r=new n(r),e==null){if(!r.d)return r;e=new n(1),t=n.rounding}else{if(e=new n(e),t===void 0?t=n.rounding:kc(t,0,8),!r.d)return e.s?r:e;if(!e.d)return e.s&&(e.s=r.s),e}return e.d[0]?(Br=!1,r=Xi(r,e,0,t,1).times(e),Br=!0,cr(r)):(e.s=r.s,r=e),r};pt.toNumber=function(){return+this};pt.toOctal=function(e,t){return vW(this,8,e,t)};pt.toPower=pt.pow=function(e){var t,r,n,i,a,o,s=this,l=s.constructor,u=+(e=new l(e));if(!s.d||!e.d||!s.d[0]||!e.d[0])return new l(gs(+s,u));if(s=new l(s),s.eq(1))return s;if(n=l.precision,a=l.rounding,e.eq(1))return cr(s,n,a);if(t=iu(e.e/vr),t>=e.d.length-1&&(r=u<0?-u:u)<=I8e)return i=Rse(l,s,r,n),e.s<0?new l(1).div(i):cr(i,n,a);if(o=s.s,o<0){if(tl.maxE+1||t0?o/0:0):(Br=!1,l.rounding=s.s=1,r=Math.min(12,(t+"").length),i=AW(e.times(U0(s,n+r)),n),i.d&&(i=cr(i,n+5,1),V6(i.d,n,a)&&(t=n+10,i=cr(AW(e.times(U0(s,t+r)),t),t+5,1),+wl(i.d).slice(n+1,n+15)+1==1e14&&(i=cr(i,n+1,0)))),i.s=o,Br=!0,l.rounding=a,cr(i,n,a))};pt.toPrecision=function(e,t){var r,n=this,i=n.constructor;return e===void 0?r=Qm(n,n.e<=i.toExpNeg||n.e>=i.toExpPos):(kc(e,1,H0),t===void 0?t=i.rounding:kc(t,0,8),n=cr(new i(n),e,t),r=Qm(n,e<=n.e||n.e<=i.toExpNeg,e)),n.isNeg()&&!n.isZero()?"-"+r:r};pt.toSignificantDigits=pt.toSD=function(e,t){var r=this,n=r.constructor;return e===void 0?(e=n.precision,t=n.rounding):(kc(e,1,H0),t===void 0?t=n.rounding:kc(t,0,8)),cr(new n(r),e,t)};pt.toString=function(){var e=this,t=e.constructor,r=Qm(e,e.e<=t.toExpNeg||e.e>=t.toExpPos);return e.isNeg()&&!e.isZero()?"-"+r:r};pt.truncated=pt.trunc=function(){return cr(new this.constructor(this),this.e+1,1)};pt.valueOf=pt.toJSON=function(){var e=this,t=e.constructor,r=Qm(e,e.e<=t.toExpNeg||e.e>=t.toExpPos);return e.isNeg()?"-"+r:r};function wl(e){var t,r,n,i=e.length-1,a="",o=e[0];if(i>0){for(a+=o,t=1;tr)throw Error(W0+e)}function V6(e,t,r,n){var i,a,o,s;for(a=e[0];a>=10;a/=10)--t;return--t<0?(t+=vr,i=0):(i=Math.ceil((t+1)/vr),t%=vr),a=gs(10,vr-t),s=e[i]%a|0,n==null?t<3?(t==0?s=s/100|0:t==1&&(s=s/10|0),o=r<4&&s==99999||r>3&&s==49999||s==5e4||s==0):o=(r<4&&s+1==a||r>3&&s+1==a/2)&&(e[i+1]/a/100|0)==gs(10,t-2)-1||(s==a/2||s==0)&&(e[i+1]/a/100|0)==0:t<4?(t==0?s=s/1e3|0:t==1?s=s/100|0:t==2&&(s=s/10|0),o=(n||r<4)&&s==9999||!n&&r>3&&s==4999):o=((n||r<4)&&s+1==a||!n&&r>3&&s+1==a/2)&&(e[i+1]/a/1e3|0)==gs(10,t-3)-1,o}function yT(e,t,r){for(var n,i=[0],a,o=0,s=e.length;or-1&&(i[n+1]===void 0&&(i[n+1]=0),i[n+1]+=i[n]/r|0,i[n]%=r)}return i.reverse()}function R8e(e,t){var r,n,i;if(t.isZero())return t;n=t.d.length,n<32?(r=Math.ceil(n/3),i=(1/kT(4,r)).toString()):(r=16,i="2.3283064365386962890625e-10"),e.precision+=r,t=Jw(e,1,t.times(i),new e(1));for(var a=r;a--;){var o=t.times(t);t=o.times(o).minus(o).times(8).plus(1)}return e.precision-=r,t}var Xi=function(){function e(n,i,a){var o,s=0,l=n.length;for(n=n.slice();l--;)o=n[l]*i+s,n[l]=o%a|0,s=o/a|0;return s&&n.unshift(s),n}function t(n,i,a,o){var s,l;if(a!=o)l=a>o?1:-1;else for(s=l=0;si[s]?1:-1;break}return l}function r(n,i,a,o){for(var s=0;a--;)n[a]-=s,s=n[a]1;)n.shift()}return function(n,i,a,o,s,l){var u,c,f,d,p,h,m,g,A,b,v,x,w,S,k,j,O,C,N,D,P=n.constructor,q=n.s==i.s?1:-1,z=n.d,I=i.d;if(!z||!z[0]||!I||!I[0])return new P(!n.s||!i.s||(z?I&&z[0]==I[0]:!I)?NaN:z&&z[0]==0||!I?q*0:q/0);for(l?(p=1,c=n.e-i.e):(l=$p,p=vr,c=iu(n.e/p)-iu(i.e/p)),N=I.length,O=z.length,A=new P(q),b=A.d=[],f=0;I[f]==(z[f]||0);f++);if(I[f]>(z[f]||0)&&c--,a==null?(S=a=P.precision,o=P.rounding):s?S=a+(n.e-i.e)+1:S=a,S<0)b.push(1),h=!0;else{if(S=S/p+2|0,f=0,N==1){for(d=0,I=I[0],S++;(f1&&(I=e(I,d,l),z=e(z,d,l),N=I.length,O=z.length),j=N,v=z.slice(0,N),x=v.length;x=l/2&&++C;do d=0,u=t(I,v,N,x),u<0?(w=v[0],N!=x&&(w=w*l+(v[1]||0)),d=w/C|0,d>1?(d>=l&&(d=l-1),m=e(I,d,l),g=m.length,x=v.length,u=t(m,v,g,x),u==1&&(d--,r(m,N=10;d/=10)f++;A.e=f+c*p-1,cr(A,s?a+A.e+1:a,o,h)}return A}}();function cr(e,t,r,n){var i,a,o,s,l,u,c,f,d,p=e.constructor;e:if(t!=null){if(f=e.d,!f)return e;for(i=1,s=f[0];s>=10;s/=10)i++;if(a=t-i,a<0)a+=vr,o=t,c=f[d=0],l=c/gs(10,i-o-1)%10|0;else if(d=Math.ceil((a+1)/vr),s=f.length,d>=s)if(n){for(;s++<=d;)f.push(0);c=l=0,i=1,a%=vr,o=a-vr+1}else break e;else{for(c=s=f[d],i=1;s>=10;s/=10)i++;a%=vr,o=a-vr+i,l=o<0?0:c/gs(10,i-o-1)%10|0}if(n=n||t<0||f[d+1]!==void 0||(o<0?c:c%gs(10,i-o-1)),u=r<4?(l||n)&&(r==0||r==(e.s<0?3:2)):l>5||l==5&&(r==4||n||r==6&&(a>0?o>0?c/gs(10,i-o):0:f[d-1])%10&1||r==(e.s<0?8:7)),t<1||!f[0])return f.length=0,u?(t-=e.e+1,f[0]=gs(10,(vr-t%vr)%vr),e.e=-t||0):f[0]=e.e=0,e;if(a==0?(f.length=d,s=1,d--):(f.length=d+1,s=gs(10,vr-a),f[d]=o>0?(c/gs(10,i-o)%gs(10,o)|0)*s:0),u)for(;;)if(d==0){for(a=1,o=f[0];o>=10;o/=10)a++;for(o=f[0]+=s,s=1;o>=10;o/=10)s++;a!=s&&(e.e++,f[0]==$p&&(f[0]=1));break}else{if(f[d]+=s,f[d]!=$p)break;f[d--]=0,s=1}for(a=f.length;f[--a]===0;)f.pop()}return Br&&(e.e>p.maxE?(e.d=null,e.e=NaN):e.e0?a=a.charAt(0)+"."+a.slice(1)+z0(n):o>1&&(a=a.charAt(0)+"."+a.slice(1)),a=a+(e.e<0?"e":"e+")+e.e):i<0?(a="0."+z0(-i-1)+a,r&&(n=r-o)>0&&(a+=z0(n))):i>=o?(a+=z0(i+1-o),r&&(n=r-i-1)>0&&(a=a+"."+z0(n))):((n=i+1)0&&(i+1===o&&(a+="."),a+=z0(n))),a}function ET(e,t){var r=e[0];for(t*=vr;r>=10;r/=10)t++;return t}function wT(e,t,r){if(t>B8e)throw Br=!0,r&&(e.precision=r),Error(Fse);return cr(new e(bT),t,1,!0)}function Rp(e,t,r){if(t>hW)throw Error(Fse);return cr(new e(xT),t,r,!0)}function Bse(e){var t=e.length-1,r=t*vr+1;if(t=e[t],t){for(;t%10==0;t/=10)r--;for(t=e[0];t>=10;t/=10)r++}return r}function z0(e){for(var t="";e--;)t+="0";return t}function Rse(e,t,r,n){var i,a=new e(1),o=Math.ceil(n/vr+4);for(Br=!1;;){if(r%2&&(a=a.times(t),jse(a.d,o)&&(i=!0)),r=iu(r/2),r===0){r=a.d.length-1,i&&a.d[r]===0&&++a.d[r];break}t=t.times(t),jse(t.d,o)}return Br=!0,a}function Mse(e){return e.d[e.d.length-1]&1}function $se(e,t,r){for(var n,i=new e(t[0]),a=0;++a17)return new d(e.d?e.d[0]?e.s<0?0:1/0:1:e.s?e.s<0?0:e:0/0);for(t==null?(Br=!1,l=h):l=t,s=new d(.03125);e.e>-2;)e=e.times(s),f+=5;for(n=Math.log(gs(2,f))/Math.LN10*2+5|0,l+=n,r=a=o=new d(1),d.precision=l;;){if(a=cr(a.times(e),l,1),r=r.times(++c),s=o.plus(Xi(a,r,l,1)),wl(s.d).slice(0,l)===wl(o.d).slice(0,l)){for(i=f;i--;)o=cr(o.times(o),l,1);if(t==null)if(u<3&&V6(o.d,l-n,p,u))d.precision=l+=10,r=a=s=new d(1),c=0,u++;else return cr(o,d.precision=h,p,Br=!0);else return d.precision=h,o}o=s}}function U0(e,t){var r,n,i,a,o,s,l,u,c,f,d,p=1,h=10,m=e,g=m.d,A=m.constructor,b=A.rounding,v=A.precision;if(m.s<0||!g||!g[0]||!m.e&&g[0]==1&&g.length==1)return new A(g&&!g[0]?-1/0:m.s!=1?NaN:g?0:m);if(t==null?(Br=!1,c=v):c=t,A.precision=c+=h,r=wl(g),n=r.charAt(0),Math.abs(a=m.e)<15e14){for(;n<7&&n!=1||n==1&&r.charAt(1)>3;)m=m.times(e),r=wl(m.d),n=r.charAt(0),p++;a=m.e,n>1?(m=new A("0."+r),a++):m=new A(n+"."+r.slice(1))}else return u=wT(A,c+2,v).times(a+""),m=U0(new A(n+"."+r.slice(1)),c-h).plus(u),A.precision=v,t==null?cr(m,v,b,Br=!0):m;for(f=m,l=o=m=Xi(m.minus(1),m.plus(1),c,1),d=cr(m.times(m),c,1),i=3;;){if(o=cr(o.times(d),c,1),u=l.plus(Xi(o,new A(i),c,1)),wl(u.d).slice(0,c)===wl(l.d).slice(0,c))if(l=l.times(2),a!==0&&(l=l.plus(wT(A,c+2,v).times(a+""))),l=Xi(l,new A(p),c,1),t==null)if(V6(l.d,c-h,b,s))A.precision=c+=h,u=o=m=Xi(f.minus(1),f.plus(1),c,1),d=cr(m.times(m),c,1),i=s=1;else return cr(l,A.precision=v,b,Br=!0);else return A.precision=v,l;l=u,i+=2}}function qse(e){return String(e.s*e.s/0)}function gW(e,t){var r,n,i;for((r=t.indexOf("."))>-1&&(t=t.replace(".","")),(n=t.search(/e/i))>0?(r<0&&(r=n),r+=+t.slice(n+1),t=t.substring(0,n)):r<0&&(r=t.length),n=0;t.charCodeAt(n)===48;n++);for(i=t.length;t.charCodeAt(i-1)===48;--i);if(t=t.slice(n,i),t){if(i-=n,e.e=r=r-n-1,e.d=[],n=(r+1)%vr,r<0&&(n+=vr),ne.constructor.maxE?(e.d=null,e.e=NaN):e.e-1){if(t=t.replace(/(\d)_(?=\d)/g,"$1"),Ise.test(t))return gW(e,t)}else if(t==="Infinity"||t==="NaN")return+t||(e.s=NaN),e.e=NaN,e.d=null,e;if(_8e.test(t))r=16,t=t.toLowerCase();else if(F8e.test(t))r=2;else if(P8e.test(t))r=8;else throw Error(W0+t);for(a=t.search(/p/i),a>0?(l=+t.slice(a+1),t=t.substring(2,a)):t=t.slice(2),a=t.indexOf("."),o=a>=0,n=e.constructor,o&&(t=t.replace(".",""),s=t.length,a=s-a,i=Rse(n,new n(r),a,a*2)),u=yT(t,r,$p),c=u.length-1,a=c;u[a]===0;--a)u.pop();return a<0?new n(e.s*0):(e.e=ET(u,c),e.d=u,Br=!1,o&&(e=Xi(e,i,s*4)),l&&(e=e.times(Math.abs(l)<54?gs(2,l):G6.pow(2,l))),Br=!0,e)}function q8e(e,t){var r,n=t.d.length;if(n<3)return t.isZero()?t:Jw(e,2,t,t);r=1.4*Math.sqrt(n),r=r>16?16:r|0,t=t.times(1/kT(5,r)),t=Jw(e,2,t,t);for(var i,a=new e(5),o=new e(16),s=new e(20);r--;)i=t.times(t),t=t.times(a.plus(i.times(o.times(i).minus(s))));return t}function Jw(e,t,r,n,i){var a,o,s,l,u=1,c=e.precision,f=Math.ceil(c/vr);for(Br=!1,l=r.times(r),s=new e(n);;){if(o=Xi(s.times(l),new e(t++*t++),c,1),s=i?n.plus(o):n.minus(o),n=Xi(o.times(l),new e(t++*t++),c,1),o=s.plus(n),o.d[f]!==void 0){for(a=f;o.d[a]===s.d[a]&&a--;);if(a==-1)break}a=s,s=n,n=o,o=a,u++}return Br=!0,o.d.length=f+1,o}function kT(e,t){for(var r=e;--t;)r*=e;return r}function Lse(e,t){var r,n=t.s<0,i=Rp(e,e.precision,1),a=i.times(.5);if(t=t.abs(),t.lte(a))return UA=n?4:1,t;if(r=t.divToInt(i),r.isZero())UA=n?3:2;else{if(t=t.minus(r.times(i)),t.lte(a))return UA=Mse(r)?n?2:3:n?4:1,t;UA=Mse(r)?n?1:4:n?3:2}return t.minus(i).abs()}function vW(e,t,r,n){var i,a,o,s,l,u,c,f,d,p=e.constructor,h=r!==void 0;if(h?(kc(r,1,H0),n===void 0?n=p.rounding:kc(n,0,8)):(r=p.precision,n=p.rounding),!e.isFinite())c=qse(e);else{for(c=Qm(e),o=c.indexOf("."),h?(i=2,t==16?r=r*4-3:t==8&&(r=r*3-2)):i=t,o>=0&&(c=c.replace(".",""),d=new p(1),d.e=c.length-o,d.d=yT(Qm(d),10,i),d.e=d.d.length),f=yT(c,10,i),a=l=f.length;f[--l]==0;)f.pop();if(!f[0])c=h?"0p+0":"0";else{if(o<0?a--:(e=new p(e),e.d=f,e.e=a,e=Xi(e,d,r,n,0,i),f=e.d,a=e.e,u=Tse),o=f[r],s=i/2,u=u||f[r+1]!==void 0,u=n<4?(o!==void 0||u)&&(n===0||n===(e.s<0?3:2)):o>s||o===s&&(n===4||u||n===6&&f[r-1]&1||n===(e.s<0?8:7)),f.length=r,u)for(;++f[--r]>i-1;)f[r]=0,r||(++a,f.unshift(1));for(l=f.length;!f[l-1];--l);for(o=0,c="";o1)if(t==16||t==8){for(o=t==16?4:3,--l;l%o;l++)c+="0";for(f=yT(c,i,t),l=f.length;!f[l-1];--l);for(o=1,c="1.";ol)for(a-=l;a--;)c+="0";else at)return e.length=t,!0}function L8e(e){return new this(e).abs()}function z8e(e){return new this(e).acos()}function U8e(e){return new this(e).acosh()}function W8e(e,t){return new this(e).plus(t)}function H8e(e){return new this(e).asin()}function V8e(e){return new this(e).asinh()}function G8e(e){return new this(e).atan()}function Q8e(e){return new this(e).atanh()}function Y8e(e,t){e=new this(e),t=new this(t);var r,n=this.precision,i=this.rounding,a=n+4;return!e.s||!t.s?r=new this(NaN):!e.d&&!t.d?(r=Rp(this,a,1).times(t.s>0?.25:.75),r.s=e.s):!t.d||e.isZero()?(r=t.s<0?Rp(this,n,i):new this(0),r.s=e.s):!e.d||t.isZero()?(r=Rp(this,a,1).times(.5),r.s=e.s):t.s<0?(this.precision=a,this.rounding=1,r=this.atan(Xi(e,t,a,1)),t=Rp(this,a,1),this.precision=n,this.rounding=i,r=e.s<0?r.minus(t):r.plus(t)):r=this.atan(Xi(e,t,a,1)),r}function Z8e(e){return new this(e).cbrt()}function X8e(e){return cr(e=new this(e),e.e+1,2)}function K8e(e,t,r){return new this(e).clamp(t,r)}function J8e(e){if(!e||typeof e!="object")throw Error(ST+"Object expected");var t,r,n,i=e.defaults===!0,a=["precision",1,H0,"rounding",0,8,"toExpNeg",-Kw,0,"toExpPos",0,Kw,"maxE",0,Kw,"minE",-Kw,0,"modulo",0,9];for(t=0;t=a[t+1]&&n<=a[t+2])this[r]=n;else throw Error(W0+r+": "+n);if(r="crypto",i&&(this[r]=mW[r]),(n=e[r])!==void 0)if(n===!0||n===!1||n===0||n===1)if(n)if(typeof crypto<"u"&&crypto&&(crypto.getRandomValues||crypto.randomBytes))this[r]=!0;else throw Error(_se);else this[r]=!1;else throw Error(W0+r+": "+n);return this}function e7e(e){return new this(e).cos()}function t7e(e){return new this(e).cosh()}function zse(e){var t,r,n;function i(a){var o,s,l,u=this;if(!(u instanceof i))return new i(a);if(u.constructor=i,Nse(a)){u.s=a.s,Br?!a.d||a.e>i.maxE?(u.e=NaN,u.d=null):a.e=10;s/=10)o++;Br?o>i.maxE?(u.e=NaN,u.d=null):o=429e7?t[a]=crypto.getRandomValues(new Uint32Array(1))[0]:s[a++]=i%1e7;else if(crypto.randomBytes){for(t=crypto.randomBytes(n*=4);a=214e7?crypto.randomBytes(4).copy(t,a):(s.push(i%1e7),a+=4);a=n/4}else throw Error(_se);else for(;a=10;i/=10)n++;n{var{on:t,config:r}=e,n=wy.clone({precision:r.precision,modulo:wy.EUCLID});return n.prototype=Object.create(n.prototype),n.prototype.type="BigNumber",n.prototype.isBigNumber=!0,n.prototype.toJSON=function(){return{mathjs:"BigNumber",value:this.toString()}},n.fromJSON=function(i){return new n(i.value)},t&&t("config",function(i,a){i.precision!==a.precision&&n.config({precision:i.precision})}),n},{isClass:!0});var Hs=Ae(Wse(),1);var O7e="Complex",M7e=[],DT=V(O7e,M7e,()=>(Object.defineProperty(Hs.default,"name",{value:"Complex"}),Hs.default.prototype.constructor=Hs.default,Hs.default.prototype.type="Complex",Hs.default.prototype.isComplex=!0,Hs.default.prototype.toJSON=function(){return{mathjs:"Complex",re:this.re,im:this.im}},Hs.default.prototype.toPolar=function(){return{r:this.abs(),phi:this.arg()}},Hs.default.prototype.format=function(e){var t="",r=this.im,n=this.re,i=Ip(this.re,e),a=Ip(this.im,e),o=Qt(e)?e:e?e.precision:null;if(o!==null){var s=Math.pow(10,-o);Math.abs(n/r)t.re?1:e.ret.im?1:e.im(Object.defineProperty(Ym.default,"name",{value:"Fraction"}),Ym.default.prototype.constructor=Ym.default,Ym.default.prototype.type="Fraction",Ym.default.prototype.isFraction=!0,Ym.default.prototype.toJSON=function(){return{mathjs:"Fraction",n:this.s*this.n,d:this.d}},Ym.default.fromJSON=function(e){return new Ym.default(e)},Ym.default),{isClass:!0});var T7e="Range",F7e=[],MT=V(T7e,F7e,()=>{function e(t,r,n){if(!(this instanceof e))throw new SyntaxError("Constructor must be called with the new operator");var i=t!=null,a=r!=null,o=n!=null;if(i){if(It(t))t=t.toNumber();else if(typeof t!="number")throw new TypeError("Parameter start must be a number")}if(a){if(It(r))r=r.toNumber();else if(typeof r!="number")throw new TypeError("Parameter end must be a number")}if(o){if(It(n))n=n.toNumber();else if(typeof n!="number")throw new TypeError("Parameter step must be a number")}this.start=i?parseFloat(t):0,this.end=a?parseFloat(r):0,this.step=o?parseFloat(n):1}return e.prototype.type="Range",e.prototype.isRange=!0,e.parse=function(t){if(typeof t!="string")return null;var r=t.split(":"),n=r.map(function(a){return parseFloat(a)}),i=n.some(function(a){return isNaN(a)});if(i)return null;switch(n.length){case 2:return new e(n[0],n[1]);case 3:return new e(n[0],n[2],n[1]);default:return null}},e.prototype.clone=function(){return new e(this.start,this.end,this.step)},e.prototype.size=function(){var t=0,r=this.start,n=this.step,i=this.end,a=i-r;return kd(n)===kd(a)?t=Math.ceil(a/n):a===0&&(t=0),isNaN(t)&&(t=0),[t]},e.prototype.min=function(){var t=this.size()[0];if(t>0)return this.step>0?this.start:this.start+(t-1)*this.step},e.prototype.max=function(){var t=this.size()[0];if(t>0)return this.step>0?this.start+(t-1)*this.step:this.start},e.prototype.forEach=function(t){var r=this.start,n=this.step,i=this.end,a=0;if(n>0)for(;ri;)t(r,[a],this),r+=n,a++},e.prototype.map=function(t){var r=[];return this.forEach(function(n,i,a){r[i[0]]=t(n,i,a)}),r},e.prototype.toArray=function(){var t=[];return this.forEach(function(r,n){t[n[0]]=r}),t},e.prototype.valueOf=function(){return this.toArray()},e.prototype.format=function(t){var r=Ip(this.start,t);return this.step!==1&&(r+=":"+Ip(this.step,t)),r+=":"+Ip(this.end,t),r},e.prototype.toString=function(){return this.format()},e.prototype.toJSON=function(){return{mathjs:"Range",start:this.start,end:this.end,step:this.step}},e.fromJSON=function(t){return new e(t.start,t.end,t.step)},e},{isClass:!0});var _7e="Matrix",P7e=[],jT=V(_7e,P7e,()=>{function e(){if(!(this instanceof e))throw new SyntaxError("Constructor must be called with the new operator")}return e.prototype.type="Matrix",e.prototype.isMatrix=!0,e.prototype.storage=function(){throw new Error("Cannot invoke storage on a Matrix interface")},e.prototype.datatype=function(){throw new Error("Cannot invoke datatype on a Matrix interface")},e.prototype.create=function(t,r){throw new Error("Cannot invoke create on a Matrix interface")},e.prototype.subset=function(t,r,n){throw new Error("Cannot invoke subset on a Matrix interface")},e.prototype.get=function(t){throw new Error("Cannot invoke get on a Matrix interface")},e.prototype.set=function(t,r,n){throw new Error("Cannot invoke set on a Matrix interface")},e.prototype.resize=function(t,r){throw new Error("Cannot invoke resize on a Matrix interface")},e.prototype.reshape=function(t,r){throw new Error("Cannot invoke reshape on a Matrix interface")},e.prototype.clone=function(){throw new Error("Cannot invoke clone on a Matrix interface")},e.prototype.size=function(){throw new Error("Cannot invoke size on a Matrix interface")},e.prototype.map=function(t,r){throw new Error("Cannot invoke map on a Matrix interface")},e.prototype.forEach=function(t){throw new Error("Cannot invoke forEach on a Matrix interface")},e.prototype[Symbol.iterator]=function(){throw new Error("Cannot iterate a Matrix interface")},e.prototype.toArray=function(){throw new Error("Cannot invoke toArray on a Matrix interface")},e.prototype.valueOf=function(){throw new Error("Cannot invoke valueOf on a Matrix interface")},e.prototype.format=function(t){throw new Error("Cannot invoke format on a Matrix interface")},e.prototype.toString=function(){throw new Error("Cannot invoke toString on a Matrix interface")},e},{isClass:!0});function Gse(e){var t=0,r=1,n=Object.create(null),i=Object.create(null),a=0,o=function(l){var u=i[l];if(!!u&&(delete n[u],delete i[l],--t,r===u)){if(!t){a=0,r=1;return}for(;!Object.prototype.hasOwnProperty.call(n,++r););}};return e=Math.abs(e),{hit:function(l){var u=i[l],c=++a;if(n[c]=l,i[l]=c,!u)return++t,t<=e?void 0:(l=n[r],o(l),l);if(delete n[u],r===u)for(;!Object.prototype.hasOwnProperty.call(n,++r););},delete:o,clear:function(){t=a=0,r=1,n=Object.create(null),i=Object.create(null)}}}function Sy(e){var{hasher:t,limit:r}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return r=r??Number.POSITIVE_INFINITY,t=t??JSON.stringify,function n(){typeof n.cache!="object"&&(n.cache={values:new Map,lru:Gse(r||Number.POSITIVE_INFINITY)});for(var i=[],a=0;a{var{Matrix:t}=e;function r(c,f){if(!(this instanceof r))throw new SyntaxError("Constructor must be called with the new operator");if(f&&!da(f))throw new Error("Invalid datatype: "+f);if(St(c))c.type==="DenseMatrix"?(this._data=Bt(c._data),this._size=Bt(c._size),this._datatype=f||c._datatype):(this._data=c.toArray(),this._size=c.size(),this._datatype=f||c._datatype);else if(c&&Ir(c.data)&&Ir(c.size))this._data=c.data,this._size=c.size,nW(this._data,this._size),this._datatype=f||c.datatype;else if(Ir(c))this._data=u(c),this._size=Yt(this._data),nW(this._data,this._size),this._datatype=f;else{if(c)throw new TypeError("Unsupported type of data ("+qr(c)+")");this._data=[],this._size=[0],this._datatype=f}}r.prototype=new t,r.prototype.createDenseMatrix=function(c,f){return new r(c,f)},Object.defineProperty(r,"name",{value:"DenseMatrix"}),r.prototype.constructor=r,r.prototype.type="DenseMatrix",r.prototype.isDenseMatrix=!0,r.prototype.getDataType=function(){return q0(this._data,qr)},r.prototype.storage=function(){return"dense"},r.prototype.datatype=function(){return this._datatype},r.prototype.create=function(c,f){return new r(c,f)},r.prototype.subset=function(c,f,d){switch(arguments.length){case 1:return n(this,c);case 2:case 3:return a(this,c,f,d);default:throw new SyntaxError("Wrong number of arguments")}},r.prototype.get=function(c){if(!Ir(c))throw new TypeError("Array expected");if(c.length!==this._size.length)throw new nr(c.length,this._size.length);for(var f=0;f");var v=f.max().map(function(S){return S+1});l(c,v,p);var x=h.length,w=0;o(c._data,f,d,x,w)}return c}function o(c,f,d,p,h){var m=h===p-1,g=f.dimension(h);m?g.forEach(function(A,b){Vn(A),c[A]=d[b[0]]}):g.forEach(function(A,b){Vn(A),o(c[A],f,d[b[0]],p,h+1)})}r.prototype.resize=function(c,f,d){if(!Da(c))throw new TypeError("Array or Matrix expected");var p=c.valueOf().map(m=>Array.isArray(m)&&m.length===1?m[0]:m),h=d?this.clone():this;return s(h,p,f)};function s(c,f,d){if(f.length===0){for(var p=c._data;Ir(p);)p=p[0];return p}return c._size=f.slice(0),c._data=Bp(c._data,c._size,d),c}r.prototype.reshape=function(c,f){var d=f?this.clone():this;d._data=U6(d._data,c);var p=d._size.reduce((h,m)=>h*m);return d._size=W6(c,p),d};function l(c,f,d){for(var p=c._size.slice(0),h=!1;p.lengthp[m]&&(p[m]=f[m],h=!0);h&&s(c,p,d)}r.prototype.clone=function(){var c=new r({data:Bt(this._data),size:Bt(this._size),datatype:this._datatype});return c},r.prototype.size=function(){return this._size.slice(0)},r.prototype.map=function(c){var f=this,d=NT(c),p=function g(A,b){return Ir(A)?A.map(function(v,x){return g(v,b.concat(x))}):d===1?c(A):d===2?c(A,b):c(A,b,f)},h=p(this._data,[]),m=this._datatype!==void 0?q0(h,qr):void 0;return new r(h,m)},r.prototype.forEach=function(c){var f=this,d=function p(h,m){Ir(h)?h.forEach(function(g,A){p(g,m.concat(A))}):c(h,m,f)};d(this._data,[])},r.prototype[Symbol.iterator]=function*(){var c=function*f(d,p){if(Ir(d))for(var h=0;h[v[A]]);f.push(new r(b,c._datatype))},m=0;m0?c:0,d=c<0?-c:0,p=this._size[0],h=this._size[1],m=Math.min(p-d,h-f),g=[],A=0;A0?d:0,m=d<0?-d:0,g=c[0],A=c[1],b=Math.min(g-m,A-h),v;if(Ir(f)){if(f.length!==b)throw new Error("Invalid value array length");v=function(j){return f[j]}}else if(St(f)){var x=f.size();if(x.length!==1||x[0]!==b)throw new Error("Invalid matrix length");v=function(j){return f.get([j])}}else v=function(){return f};p||(p=It(v(0))?v(0).mul(0):0);var w=[];if(c.length>0){w=Bp(w,c,p);for(var S=0;S{var{typed:t}=e;return t(Qse,{any:Bt})});function _T(e){var t=e.length,r=e[0].length,n,i,a=[];for(i=0;i=n.length)throw new As(t,n.length);return St(e)?e.create(PT(e.valueOf(),t,r)):PT(e,t,r)}function PT(e,t,r){var n,i,a,o;if(t<=0)if(Array.isArray(e[0])){for(o=_T(e),i=[],n=0;n{var{typed:t}=e;return t(Yse,{number:wt,BigNumber:function(n){return n.isInt()},Fraction:function(n){return n.d===1&&isFinite(n.n)},"Array | Matrix":t.referToSelf(r=>n=>jt(n,r))})});var Cc="number",WA="number, number";function wW(e){return Math.abs(e)}wW.signature=Cc;function SW(e,t){return e+t}SW.signature=WA;function EW(e,t){return e-t}EW.signature=WA;function kW(e,t){return e*t}kW.signature=WA;function q7e(e,t){return e/t}q7e.signature=WA;function CW(e){return-e}CW.signature=Cc;function DW(e){return e}DW.signature=Cc;function eS(e){return rse(e)}eS.signature=Cc;function OW(e){return e*e*e}OW.signature=Cc;function MW(e){return Math.exp(e)}MW.signature=Cc;function jW(e){return nse(e)}jW.signature=Cc;function L7e(e,t){if(!wt(e)||!wt(t))throw new Error("Parameters in function gcd must be integer numbers");for(var r;t!==0;)r=e%t,e=t,t=r;return e<0?-e:e}L7e.signature=WA;function NW(e,t){if(!wt(e)||!wt(t))throw new Error("Parameters in function lcm must be integer numbers");if(e===0||t===0)return 0;for(var r,n=e*t;t!==0;)r=t,t=e%r,e=r;return Math.abs(n/e)}NW.signature=WA;function Zse(e,t){return t?Math.log(e)/Math.log(t):Math.log(e)}function TW(e){return tse(e)}TW.signature=Cc;function FW(e){return ese(e)}FW.signature=Cc;function z7e(e){return lT(e)}z7e.signature=Cc;function U7e(e,t){return t===0?e:e-t*Math.floor(e/t)}U7e.signature=WA;function _W(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:2,r=t<0;if(r&&(t=-t),t===0)throw new Error("Root must be non-zero");if(e<0&&Math.abs(t)%2!==1)throw new Error("Root must be odd when a is negative.");if(e===0)return r?1/0:0;if(!isFinite(e))return r?0:e;var n=Math.pow(Math.abs(e),1/t);return n=e<0?-n:n,r?1/n:n}function BT(e){return kd(e)}BT.signature=Cc;function W7e(e){return Math.sqrt(e)}W7e.signature=Cc;function PW(e){return e*e}PW.signature=Cc;function IW(e,t){var r,n,i,a=0,o=1,s=1,l=0;if(!wt(e)||!wt(t))throw new Error("Parameters in function xgcd must be integer numbers");for(;t;)n=Math.floor(e/t),i=e-n*t,r=a,a=o-n*a,o=r,r=s,s=l-n*s,l=r,e=t,t=i;var u;return e<0?u=[-e,-o,-l]:u=[e,e?o:0,l],u}IW.signature=WA;function BW(e,t){return e*e<1&&t===1/0||e*e>1&&t===-1/0?0:Math.pow(e,t)}BW.signature=WA;function tS(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;if(!wt(t)||t<0||t>15)throw new Error("Number of decimals in function round must be an integer from 0 to 15 inclusive");return parseFloat(eW(e,t))}function H7e(e){return Math.abs(e)}H7e.signature=Cc;var V7e="number",rS="number, number";function RW(e,t){if(!wt(e)||!wt(t))throw new Error("Integers expected in function bitAnd");return e&t}RW.signature=rS;function $W(e){if(!wt(e))throw new Error("Integer expected in function bitNot");return~e}$W.signature=V7e;function qW(e,t){if(!wt(e)||!wt(t))throw new Error("Integers expected in function bitOr");return e|t}qW.signature=rS;function LW(e,t){if(!wt(e)||!wt(t))throw new Error("Integers expected in function bitXor");return e^t}LW.signature=rS;function zW(e,t){if(!wt(e)||!wt(t))throw new Error("Integers expected in function leftShift");return e<>t}UW.signature=rS;function WW(e,t){if(!wt(e)||!wt(t))throw new Error("Integers expected in function rightLogShift");return e>>>t}WW.signature=rS;function yf(e,t){if(t>1;return yf(e,r)*yf(r+1,t)}function HW(e,t){if(!wt(e)||e<0)throw new TypeError("Positive integer value expected in function combinations");if(!wt(t)||t<0)throw new TypeError("Positive integer value expected in function combinations");if(t>e)throw new TypeError("k must be less than or equal to n");for(var r=e-t,n=1,i=t171?1/0:yf(1,e-1);if(e<.5)return Math.PI/(Math.sin(Math.PI*e)*Q6(1-e));if(e>=171.35)return 1/0;if(e>85){var r=e*e,n=r*e,i=n*e,a=i*e;return Math.sqrt(2*Math.PI/e)*Math.pow(e/Math.E,e)*(1+1/(12*e)+1/(288*r)-139/(51840*n)-571/(2488320*i)+163879/(209018880*a)+5246819/(75246796800*a*e))}--e,t=Ey[0];for(var o=1;o=1;n--)r+=tle[n]/(e+n);return KW+(e+.5)*Math.log(t)-t+Math.log(r)}Y6.signature="number";var qa="number",Z7e="number, number";function X7e(e){return Math.acos(e)}X7e.signature=qa;function JW(e){return ose(e)}JW.signature=qa;function eH(e){return Math.atan(1/e)}eH.signature=qa;function tH(e){return isFinite(e)?(Math.log((e+1)/e)+Math.log(e/(e-1)))/2:0}tH.signature=qa;function rH(e){return Math.asin(1/e)}rH.signature=qa;function nH(e){var t=1/e;return Math.log(t+Math.sqrt(t*t+1))}nH.signature=qa;function iH(e){return Math.acos(1/e)}iH.signature=qa;function aH(e){var t=1/e,r=Math.sqrt(t*t-1);return Math.log(r+t)}aH.signature=qa;function K7e(e){return Math.asin(e)}K7e.signature=qa;function oH(e){return sse(e)}oH.signature=qa;function J7e(e){return Math.atan(e)}J7e.signature=qa;function eRe(e,t){return Math.atan2(e,t)}eRe.signature=Z7e;function sH(e){return lse(e)}sH.signature=qa;function tRe(e){return Math.cos(e)}tRe.signature=qa;function rRe(e){return cT(e)}rRe.signature=qa;function lH(e){return 1/Math.tan(e)}lH.signature=qa;function uH(e){var t=Math.exp(2*e);return(t+1)/(t-1)}uH.signature=qa;function cH(e){return 1/Math.sin(e)}cH.signature=qa;function fH(e){return e===0?Number.POSITIVE_INFINITY:Math.abs(2/(Math.exp(e)-Math.exp(-e)))*kd(e)}fH.signature=qa;function dH(e){return 1/Math.cos(e)}dH.signature=qa;function pH(e){return 2/(Math.exp(e)+Math.exp(-e))}pH.signature=qa;function nRe(e){return Math.sin(e)}nRe.signature=qa;function mH(e){return use(e)}mH.signature=qa;function iRe(e){return Math.tan(e)}iRe.signature=qa;function aRe(e){return fT(e)}aRe.signature=qa;var Z6="number";function oRe(e){return wt(e)}oRe.signature=Z6;function hH(e){return e<0}hH.signature=Z6;function AH(e){return e>0}AH.signature=Z6;function gH(e){return e===0}gH.signature=Z6;function vH(e){return Number.isNaN(e)}vH.signature=Z6;var rle="isNegative",sRe=["typed"],RT=V(rle,sRe,e=>{var{typed:t}=e;return t(rle,{number:hH,BigNumber:function(n){return n.isNeg()&&!n.isZero()&&!n.isNaN()},Fraction:function(n){return n.s<0},Unit:t.referToSelf(r=>n=>t.find(r,n.valueType())(n.value)),"Array | Matrix":t.referToSelf(r=>n=>jt(n,r))})});var nle="isNumeric",lRe=["typed"],$T=V(nle,lRe,e=>{var{typed:t}=e;return t(nle,{"number | BigNumber | Fraction | boolean":()=>!0,"Complex | Unit | string | null | undefined | Node":()=>!1,"Array | Matrix":t.referToSelf(r=>n=>jt(n,r))})});var ile="hasNumericValue",uRe=["typed","isNumeric"],qT=V(ile,uRe,e=>{var{typed:t,isNumeric:r}=e;return t(ile,{boolean:()=>!0,string:function(i){return i.trim().length>0&&!isNaN(Number(i))},any:function(i){return r(i)}})});var ale="isPositive",cRe=["typed"],LT=V(ale,cRe,e=>{var{typed:t}=e;return t(ale,{number:AH,BigNumber:function(n){return!n.isNeg()&&!n.isZero()&&!n.isNaN()},Fraction:function(n){return n.s>0&&n.n>0},Unit:t.referToSelf(r=>n=>t.find(r,n.valueType())(n.value)),"Array | Matrix":t.referToSelf(r=>n=>jt(n,r))})});var ole="isZero",fRe=["typed"],zT=V(ole,fRe,e=>{var{typed:t}=e;return t(ole,{number:gH,BigNumber:function(n){return n.isZero()},Complex:function(n){return n.re===0&&n.im===0},Fraction:function(n){return n.d===1&&n.n===0},Unit:t.referToSelf(r=>n=>t.find(r,n.valueType())(n.value)),"Array | Matrix":t.referToSelf(r=>n=>jt(n,r))})});var sle="isNaN",dRe=["typed"],UT=V(sle,dRe,e=>{var{typed:t}=e;return t(sle,{number:vH,BigNumber:function(n){return n.isNaN()},Fraction:function(n){return!1},Complex:function(n){return n.isNaN()},Unit:function(n){return Number.isNaN(n.value)},"Array | Matrix":function(n){return jt(n,Number.isNaN)}})});var lle="typeOf",pRe=["typed"],WT=V(lle,pRe,e=>{var{typed:t}=e;return t(lle,{any:qr})});function _o(e,t,r){if(r==null)return e.eq(t);if(e.eq(t))return!0;if(e.isNaN()||t.isNaN())return!1;if(e.isFinite()&&t.isFinite()){var n=e.minus(t).abs();if(n.isZero())return!0;var i=e.constructor.max(e.abs(),t.abs());return n.lte(i.times(r))}return!1}function ule(e,t,r){return Oa(e.re,t.re,r)&&Oa(e.im,t.im,r)}var Dd=V("compareUnits",["typed"],e=>{var{typed:t}=e;return{"Unit, Unit":t.referToSelf(r=>(n,i)=>{if(!n.equalBase(i))throw new Error("Cannot compare units with different base");return t.find(r,[n.valueType(),i.valueType()])(n.value,i.value)})}});var HT="equalScalar",mRe=["typed","config"],VT=V(HT,mRe,e=>{var{typed:t,config:r}=e,n=Dd({typed:t});return t(HT,{"boolean, boolean":function(a,o){return a===o},"number, number":function(a,o){return Oa(a,o,r.epsilon)},"BigNumber, BigNumber":function(a,o){return a.eq(o)||_o(a,o,r.epsilon)},"Fraction, Fraction":function(a,o){return a.equals(o)},"Complex, Complex":function(a,o){return ule(a,o,r.epsilon)}},n)}),$gt=V(HT,["typed","config"],e=>{var{typed:t,config:r}=e;return t(HT,{"number, number":function(i,a){return Oa(i,a,r.epsilon)}})});var hRe="SparseMatrix",ARe=["typed","equalScalar","Matrix"],GT=V(hRe,ARe,e=>{var{typed:t,equalScalar:r,Matrix:n}=e;function i(m,g){if(!(this instanceof i))throw new SyntaxError("Constructor must be called with the new operator");if(g&&!da(g))throw new Error("Invalid datatype: "+g);if(St(m))a(this,m,g);else if(m&&Ir(m.index)&&Ir(m.ptr)&&Ir(m.size))this._values=m.values,this._index=m.index,this._ptr=m.ptr,this._size=m.size,this._datatype=g||m.datatype;else if(Ir(m))o(this,m,g);else{if(m)throw new TypeError("Unsupported type of data ("+qr(m)+")");this._values=[],this._index=[],this._ptr=[0],this._size=[0,0],this._datatype=g}}function a(m,g,A){g.type==="SparseMatrix"?(m._values=g._values?Bt(g._values):void 0,m._index=Bt(g._index),m._ptr=Bt(g._ptr),m._size=Bt(g._size),m._datatype=A||g._datatype):o(m,g.valueOf(),A||g._datatype)}function o(m,g,A){m._values=[],m._index=[],m._ptr=[],m._datatype=A;var b=g.length,v=0,x=r,w=0;if(da(A)&&(x=t.find(r,[A,A])||r,w=t.convert(0,A)),b>0){var S=0;do{m._ptr.push(m._index.length);for(var k=0;k");if(v.length===1){var j=g.dimension(0);j.forEach(function(N,D){Vn(N),m.set([N,0],A[D[0]],b)})}else{var O=g.dimension(0),C=g.dimension(1);O.forEach(function(N,D){Vn(N),C.forEach(function(P,q){Vn(P),m.set([N,P],A[D[0]][q[0]],b)})})}}return m}i.prototype.get=function(m){if(!Ir(m))throw new TypeError("Array expected");if(m.length!==this._size.length)throw new nr(m.length,this._size.length);if(!this._values)throw new Error("Cannot invoke get on a Pattern only matrix");var g=m[0],A=m[1];Vn(g,this._size[0]),Vn(A,this._size[1]);var b=u(g,this._ptr[A],this._ptr[A+1],this._index);return bx-1||v>w-1)&&(d(this,Math.max(b+1,x),Math.max(v+1,w),A),x=this._size[0],w=this._size[1]),Vn(b,x),Vn(v,w);var j=u(b,this._ptr[v],this._ptr[v+1],this._index);return jArray.isArray(x)&&x.length===1?x[0]:x);if(b.length!==2)throw new Error("Only two dimensions matrix are supported");b.forEach(function(x){if(!Qt(x)||!wt(x)||x<0)throw new TypeError("Invalid size, must contain positive integers (size: "+tr(b)+")")});var v=A?this.clone():this;return d(v,b[0],b[1],g)};function d(m,g,A,b){var v=b||0,x=r,w=0;da(m._datatype)&&(x=t.find(r,[m._datatype,m._datatype])||r,w=t.convert(0,m._datatype),v=t.convert(v,m._datatype));var S=!x(v,w),k=m._size[0],j=m._size[1],O,C,N;if(A>j){for(C=j;Ck){if(S){var D=0;for(C=0;Cg-1&&(m._values.splice(N,1),m._index.splice(N,1),q++)}m._ptr[C]=m._values.length}return m._size[0]=g,m._size[1]=A,m}i.prototype.reshape=function(m,g){if(!Ir(m))throw new TypeError("Array expected");if(m.length!==2)throw new Error("Sparse matrices can only be reshaped in two dimensions");m.forEach(function(_){if(!Qt(_)||!wt(_)||_<=-2||_===0)throw new TypeError("Invalid size, must contain positive integers or -1 (size: "+tr(m)+")")});var A=this._size[0]*this._size[1];m=W6(m,A);var b=m[0]*m[1];if(A!==b)throw new Error("Reshaping sparse matrix will result in the wrong number of elements");var v=g?this.clone():this;if(this._size[0]===m[0]&&this._size[1]===m[1])return v;for(var x=[],w=0;w=g&&I<=A&&N(m._values[z],I-g,D-b)}else{for(var T={},L=P;LsF,createAccessorNode:()=>a4,createAcos:()=>m_,createAcosh:()=>h_,createAcot:()=>A_,createAcoth:()=>g_,createAcsc:()=>v_,createAcsch:()=>y_,createAdd:()=>Y_,createAddScalar:()=>uF,createAnd:()=>wS,createAndTransform:()=>SB,createApply:()=>G0,createApplyTransform:()=>nB,createArg:()=>PF,createArrayNode:()=>s4,createAsec:()=>b_,createAsech:()=>x_,createAsin:()=>w_,createAsinh:()=>S_,createAssignmentNode:()=>f4,createAtan:()=>E_,createAtan2:()=>k_,createAtanh:()=>C_,createAtomicMass:()=>PI,createAvogadro:()=>II,createBellNumbers:()=>OP,createBigNumberClass:()=>CT,createBignumber:()=>XT,createBin:()=>g3,createBitAnd:()=>sS,createBitAndTransform:()=>kB,createBitNot:()=>FF,createBitOr:()=>lS,createBitOrTransform:()=>CB,createBitXor:()=>_F,createBlockNode:()=>p4,createBohrMagneton:()=>hI,createBohrRadius:()=>xI,createBoltzmann:()=>BI,createBoolean:()=>ZT,createCatalan:()=>MP,createCbrt:()=>fF,createCeil:()=>dF,createChain:()=>K4,createChainClass:()=>Z4,createClassicalElectronRadius:()=>wI,createClone:()=>FT,createColumn:()=>fS,createColumnTransform:()=>iB,createCombinations:()=>hP,createCombinationsWithRep:()=>AP,createCompare:()=>q3,createCompareNatural:()=>L3,createCompareText:()=>z3,createCompile:()=>R4,createComplex:()=>KT,createComplexClass:()=>DT,createComposition:()=>jP,createConcat:()=>cS,createConcatTransform:()=>hB,createConditionalNode:()=>h4,createConductanceQuantum:()=>AI,createConj:()=>IF,createConstantNode:()=>y4,createCorr:()=>mP,createCos:()=>D_,createCosh:()=>O_,createCot:()=>M_,createCoth:()=>j_,createCoulomb:()=>pI,createCount:()=>LF,createCreateUnit:()=>p_,createCross:()=>zF,createCsc:()=>N_,createCsch:()=>T_,createCtranspose:()=>s3,createCube:()=>pF,createCumSum:()=>DS,createCumSumTransform:()=>bB,createDeepEqual:()=>e_,createDenseMatrixClass:()=>TT,createDerivative:()=>BP,createDet:()=>J4,createDeuteronMass:()=>OI,createDiag:()=>UF,createDiff:()=>dS,createDiffTransform:()=>AB,createDistance:()=>uP,createDivide:()=>lP,createDivideScalar:()=>E3,createDot:()=>K_,createDotDivide:()=>N3,createDotMultiply:()=>NF,createDotPow:()=>j3,createE:()=>ZP,createEfimovFactor:()=>_I,createEigs:()=>rP,createElectricConstant:()=>fI,createElectronMass:()=>SI,createElementaryCharge:()=>mI,createEqual:()=>W3,createEqualScalar:()=>VT,createEqualText:()=>H3,createErf:()=>d3,createEvaluate:()=>$4,createExp:()=>mF,createExpm:()=>nP,createExpm1:()=>hF,createFactorial:()=>yP,createFalse:()=>WP,createFaraday:()=>RI,createFermiCoupling:()=>EI,createFft:()=>u3,createFibonacciHeapClass:()=>s_,createFilter:()=>WF,createFilterTransform:()=>aB,createFineStructure:()=>kI,createFirstRadiation:()=>$I,createFix:()=>AF,createFlatten:()=>HF,createFloor:()=>nS,createForEach:()=>VF,createForEachTransform:()=>oB,createFormat:()=>A3,createFraction:()=>JT,createFractionClass:()=>OT,createFreqz:()=>qP,createFunctionAssignmentNode:()=>x4,createFunctionNode:()=>I4,createGamma:()=>gP,createGasConstant:()=>LI,createGcd:()=>gF,createGetMatrixDataType:()=>GF,createGravitationConstant:()=>sI,createGravity:()=>ZI,createHartreeEnergy:()=>CI,createHasNumericValue:()=>qT,createHelp:()=>X4,createHelpClass:()=>Y4,createHex:()=>y3,createHypot:()=>Z_,createI:()=>iI,createIdentity:()=>QF,createIfft:()=>c3,createIm:()=>BF,createImmutableDenseMatrixClass:()=>a_,createIndex:()=>e4,createIndexClass:()=>o_,createIndexNode:()=>S4,createIndexTransform:()=>sB,createInfinity:()=>VP,createIntersect:()=>cP,createInv:()=>eP,createInverseConductanceQuantum:()=>gI,createInvmod:()=>MF,createIsInteger:()=>IT,createIsNaN:()=>UT,createIsNegative:()=>RT,createIsNumeric:()=>$T,createIsPositive:()=>LT,createIsPrime:()=>w3,createIsZero:()=>zT,createKldivergence:()=>bP,createKlitzing:()=>bI,createKron:()=>YF,createLN10:()=>JP,createLN2:()=>KP,createLOG10E:()=>tI,createLOG2E:()=>eI,createLarger:()=>X3,createLargerEq:()=>J3,createLcm:()=>vF,createLeafCount:()=>NP,createLeftShift:()=>I3,createLgamma:()=>vP,createLog:()=>D3,createLog10:()=>yF,createLog1p:()=>O3,createLog2:()=>bF,createLoschmidt:()=>qI,createLsolve:()=>T3,createLsolveAll:()=>_3,createLup:()=>z4,createLusolve:()=>G4,createLyap:()=>sP,createMad:()=>pP,createMagneticConstant:()=>cI,createMagneticFluxQuantum:()=>vI,createMap:()=>ZF,createMapTransform:()=>lB,createMatrix:()=>eF,createMatrixClass:()=>jT,createMatrixFromColumns:()=>nF,createMatrixFromFunction:()=>tF,createMatrixFromRows:()=>rF,createMax:()=>SS,createMaxTransform:()=>uB,createMean:()=>OS,createMeanTransform:()=>cB,createMedian:()=>dP,createMin:()=>ES,createMinTransform:()=>fB,createMod:()=>iS,createMode:()=>m3,createMolarMass:()=>QI,createMolarMassC12:()=>YI,createMolarPlanckConstant:()=>zI,createMolarVolume:()=>UI,createMultinomial:()=>xP,createMultiply:()=>wF,createMultiplyScalar:()=>xF,createNaN:()=>GP,createNeutronMass:()=>MI,createNode:()=>r4,createNorm:()=>X_,createNot:()=>$F,createNthRoot:()=>SF,createNthRoots:()=>M3,createNuclearMagneton:()=>yI,createNull:()=>HP,createNumber:()=>QT,createNumeric:()=>S3,createObjectNode:()=>k4,createOct:()=>v3,createOnes:()=>XF,createOperatorNode:()=>D4,createOr:()=>uS,createOrTransform:()=>EB,createParenthesisNode:()=>M4,createParse:()=>B4,createParser:()=>L4,createParserClass:()=>q4,createPartitionSelect:()=>n_,createPermutations:()=>wP,createPhi:()=>XP,createPi:()=>QP,createPickRandom:()=>EP,createPinv:()=>tP,createPlanckCharge:()=>eB,createPlanckConstant:()=>lI,createPlanckLength:()=>XI,createPlanckMass:()=>KI,createPlanckTemperature:()=>tB,createPlanckTime:()=>JI,createPolynomialRoot:()=>Q4,createPow:()=>k3,createPrint:()=>vS,createPrintTransform:()=>wB,createProd:()=>h3,createProtonMass:()=>DI,createQr:()=>U4,createQuantileSeq:()=>jS,createQuantileSeqTransform:()=>yB,createQuantumOfCirculation:()=>jI,createRandom:()=>kP,createRandomInt:()=>CP,createRange:()=>mS,createRangeClass:()=>MT,createRangeNode:()=>N4,createRangeTransform:()=>dB,createRationalize:()=>RP,createRe:()=>RF,createReducedPlanckConstant:()=>uI,createRelationalNode:()=>F4,createReplacer:()=>zP,createReshape:()=>e3,createResize:()=>t3,createResolve:()=>PP,createResultSet:()=>vT,createReviver:()=>LP,createRightArithShift:()=>B3,createRightLogShift:()=>R3,createRotate:()=>r3,createRotationMatrix:()=>n3,createRound:()=>C3,createRow:()=>hS,createRowTransform:()=>pB,createRydberg:()=>NI,createSQRT1_2:()=>rI,createSQRT2:()=>nI,createSackurTetrode:()=>WI,createSchur:()=>oP,createSec:()=>F_,createSech:()=>__,createSecondRadiation:()=>HI,createSetCartesian:()=>$_,createSetDifference:()=>q_,createSetDistinct:()=>L_,createSetIntersect:()=>z_,createSetIsSubset:()=>U_,createSetMultiplicity:()=>W_,createSetPowerset:()=>H_,createSetSize:()=>V_,createSetSymDifference:()=>G_,createSetUnion:()=>Q_,createSign:()=>EF,createSimplify:()=>TP,createSimplifyConstant:()=>FP,createSimplifyCore:()=>_P,createSin:()=>P_,createSinh:()=>I_,createSize:()=>i3,createSlu:()=>V4,createSmaller:()=>G3,createSmallerEq:()=>Y3,createSolveODE:()=>f3,createSort:()=>i_,createSpaClass:()=>l_,createSparse:()=>d_,createSparseMatrixClass:()=>GT,createSpeedOfLight:()=>oI,createSplitUnit:()=>iF,createSqrt:()=>kF,createSqrtm:()=>iP,createSquare:()=>CF,createSqueeze:()=>a3,createStd:()=>NS,createStdTransform:()=>gB,createStefanBoltzmann:()=>VI,createStirlingS2:()=>DP,createString:()=>YT,createSubset:()=>AS,createSubsetTransform:()=>mB,createSubtract:()=>DF,createSubtractScalar:()=>cF,createSum:()=>CS,createSumTransform:()=>vB,createSylvester:()=>aP,createSymbolNode:()=>_4,createSymbolicEqual:()=>IP,createTan:()=>B_,createTanh:()=>R_,createTau:()=>YP,createThomsonCrossSection:()=>TI,createTo:()=>x3,createTrace:()=>J_,createTranspose:()=>o3,createTrue:()=>UP,createTypeOf:()=>WT,createTyped:()=>gT,createUnaryMinus:()=>aF,createUnaryPlus:()=>oF,createUnequal:()=>r_,createUnitClass:()=>c_,createUnitFunction:()=>f_,createUppercaseE:()=>vge,createUppercasePi:()=>gge,createUsolve:()=>F3,createUsolveAll:()=>P3,createVacuumImpedance:()=>dI,createVariance:()=>MS,createVarianceTransform:()=>xB,createVersion:()=>aI,createWeakMixingAngle:()=>FI,createWienDisplacement:()=>GI,createXgcd:()=>OF,createXor:()=>qF,createZeros:()=>l3,createZeta:()=>p3,createZpk2tf:()=>$P});var dW=Ae(sT(),1);function wt(e){return typeof e=="boolean"?!0:isFinite(e)?e===Math.round(e):!1}var kd=Math.sign||function(e){return e>0?1:e<0?-1:0},ese=Math.log2||function(t){return Math.log(t)/Math.LN2},tse=Math.log10||function(t){return Math.log(t)/Math.LN10},lT=Math.log1p||function(e){return Math.log(e+1)},rse=Math.cbrt||function(t){if(t===0)return t;var r=t<0,n;return r&&(t=-t),isFinite(t)?(n=Math.exp(Math.log(t)/3),n=(t/(n*n)+2*n)/3):n=t,r?-n:n},nse=Math.expm1||function(t){return t>=2e-4||t<=-2e-4?Math.exp(t)-1:t+t*t/2+t*t*t/6};function KU(e,t,r){var n={2:"0b",8:"0o",16:"0x"},i=n[t],a="";if(r){if(r<1)throw new Error("size must be in greater than 0");if(!wt(r))throw new Error("size must be an integer");if(e>2**(r-1)-1||e<-(2**(r-1)))throw new Error("Value must be in range [-2^".concat(r-1,", 2^").concat(r-1,"-1]"));if(!wt(e))throw new Error("Value must be an integer");e<0&&(e=e+2**r),a="i".concat(r)}var o="";return e<0&&(e=-e,o="-"),"".concat(o).concat(i).concat(e.toString(t)).concat(a)}function Bp(e,t){if(typeof t=="function")return t(e);if(e===1/0)return"Infinity";if(e===-1/0)return"-Infinity";if(isNaN(e))return"NaN";var{notation:r,precision:n,wordSize:i}=JU(t);switch(r){case"fixed":return eW(e,n);case"exponential":return ise(e,n);case"engineering":return m8e(e,n);case"bin":return KU(e,2,i);case"oct":return KU(e,8,i);case"hex":return KU(e,16,i);case"auto":return h8e(e,n,t).replace(/((\.\d*?)(0+))($|e)/,function(){var a=arguments[2],o=arguments[4];return a!=="."?a+o:o});default:throw new Error('Unknown notation "'+r+'". Choose "auto", "exponential", "fixed", "bin", "oct", or "hex.')}}function JU(e){var t="auto",r,n;if(e!==void 0)if(Qt(e))r=e;else if(It(e))r=e.toNumber();else if(Hm(e))e.precision!==void 0&&(r=Koe(e.precision,()=>{throw new Error('Option "precision" must be a number or BigNumber')})),e.wordSize!==void 0&&(n=Koe(e.wordSize,()=>{throw new Error('Option "wordSize" must be a number or BigNumber')})),e.notation&&(t=e.notation);else throw new Error("Unsupported type of options, number, BigNumber, or object expected");return{notation:t,precision:r,wordSize:n}}function Gw(e){var t=String(e).toLowerCase().match(/^(-?)(\d+\.?\d*)(e([+-]?\d+))?$/);if(!t)throw new SyntaxError("Invalid number "+e);var r=t[1],n=t[2],i=parseFloat(t[4]||"0"),a=n.indexOf(".");i+=a!==-1?a-1:n.length-1;var o=n.replace(".","").replace(/^0*/,function(s){return i-=s.length,""}).replace(/0*$/,"").split("").map(function(s){return parseInt(s)});return o.length===0&&(o.push(0),i++),{sign:r,coefficients:o,exponent:i}}function m8e(e,t){if(isNaN(e)||!isFinite(e))return String(e);var r=Gw(e),n=uT(r,t),i=n.exponent,a=n.coefficients,o=i%3===0?i:i<0?i-3-i%3:i-i%3;if(Qt(t))for(;t>a.length||i-o+1>a.length;)a.push(0);else for(var s=Math.abs(i-o)-(a.length-1),l=0;l0;)c++,u--;var f=a.slice(c).join(""),d=Qt(t)&&f.length||f.match(/[1-9]/)?"."+f:"",p=a.slice(0,c).join("")+d+"e"+(i>=0?"+":"")+o.toString();return n.sign+p}function eW(e,t){if(isNaN(e)||!isFinite(e))return String(e);var r=Gw(e),n=typeof t=="number"?uT(r,r.exponent+1+t):r,i=n.coefficients,a=n.exponent+1,o=a+(t||0);return i.length0?"."+i.join(""):"")+"e"+(a>=0?"+":"")+a}function h8e(e,t,r){if(isNaN(e)||!isFinite(e))return String(e);var n=Joe(r?.lowerExp,-3),i=Joe(r?.upperExp,5),a=Gw(e),o=t?uT(a,t):a;if(o.exponent=i)return ise(e,t);var s=o.coefficients,l=o.exponent;s.length0?l:0;return ut){var i=n.splice(t,n.length-t);if(i[0]>=5){var a=t-1;for(n[a]++;n[a]===10;)n.pop(),a===0&&(n.unshift(0),r.exponent++,a++),a--,n[a]++}}return r}function Vw(e){for(var t=[],r=0;r0?!0:e<0?!1:1/e===1/0,n=t>0?!0:t<0?!1:1/t===1/0;return r^n?-e:e}function Koe(e,t){if(Qt(e))return e;if(It(e))return e.toNumber();t()}function Joe(e,t){return Qt(e)?e:It(e)?e.toNumber():t}function tW(e,t,r){var n=e.constructor,i=new n(2),a="";if(r){if(r<1)throw new Error("size must be in greater than 0");if(!wt(r))throw new Error("size must be an integer");if(e.greaterThan(i.pow(r-1).sub(1))||e.lessThan(i.pow(r-1).mul(-1)))throw new Error("Value must be in range [-2^".concat(r-1,", 2^").concat(r-1,"-1]"));if(!e.isInteger())throw new Error("Value must be an integer");e.lessThan(0)&&(e=e.add(i.pow(r))),a="i".concat(r)}switch(t){case 2:return"".concat(e.toBinary()).concat(a);case 8:return"".concat(e.toOctal()).concat(a);case 16:return"".concat(e.toHexadecimal()).concat(a);default:throw new Error("Base ".concat(t," not supported "))}}function pse(e,t){if(typeof t=="function")return t(e);if(!e.isFinite())return e.isNaN()?"NaN":e.gt(0)?"Infinity":"-Infinity";var{notation:r,precision:n,wordSize:i}=JU(t);switch(r){case"fixed":return v8e(e,n);case"exponential":return fse(e,n);case"engineering":return g8e(e,n);case"bin":return tW(e,2,i);case"oct":return tW(e,8,i);case"hex":return tW(e,16,i);case"auto":{var a=dse(t?.lowerExp,-3),o=dse(t?.upperExp,5);if(e.isZero())return"0";var s,l=e.toSignificantDigits(n),u=l.e;return u>=a&&u=0?"+":"")+n.toString()}function fse(e,t){return t!==void 0?e.toExponential(t-1):e.toExponential()}function v8e(e,t){return e.toFixed(t)}function dse(e,t){return Qt(e)?e:It(e)?e.toNumber():t}function hse(e,t){var r=e.length-t.length,n=e.length;return e.substring(r,n)===t}function tr(e,t){var r=y8e(e,t);return t&&typeof t=="object"&&"truncate"in t&&r.length>t.truncate?r.substring(0,t.truncate-3)+"...":r}function y8e(e,t){if(typeof e=="number")return Bp(e,t);if(It(e))return pse(e,t);if(b8e(e))return!t||t.fraction!=="decimal"?e.s*e.n+"/"+e.d:e.toString();if(Array.isArray(e))return Ase(e,t);if(da(e))return vy(e);if(typeof e=="function")return e.syntax?String(e.syntax):"function";if(e&&typeof e=="object"){if(typeof e.format=="function")return e.format(t);if(e&&e.toString(t)!=={}.toString())return e.toString(t);var r=Object.keys(e).map(n=>vy(n)+": "+tr(e[n],t));return"{"+r.join(", ")+"}"}return String(e)}function vy(e){for(var t=String(e),r="",n=0;n/g,">"),t}function Ase(e,t){if(Array.isArray(e)){for(var r="[",n=e.length,i=0;it?1:-1}function nr(e,t,r){if(!(this instanceof nr))throw new SyntaxError("Constructor must be called with the new operator");this.actual=e,this.expected=t,this.relation=r,this.message="Dimension mismatch ("+(Array.isArray(e)?"["+e.join(", ")+"]":e)+" "+(this.relation||"!=")+" "+(Array.isArray(t)?"["+t.join(", ")+"]":t)+")",this.stack=new Error().stack}nr.prototype=new RangeError;nr.prototype.constructor=RangeError;nr.prototype.name="DimensionError";nr.prototype.isDimensionError=!0;function As(e,t,r){if(!(this instanceof As))throw new SyntaxError("Constructor must be called with the new operator");this.index=e,arguments.length<3?(this.min=0,this.max=t):(this.min=t,this.max=r),this.min!==void 0&&this.index=this.max?this.message="Index out of range ("+this.index+" > "+(this.max-1)+")":this.message="Index out of range ("+this.index+")",this.stack=new Error().stack}As.prototype=new RangeError;As.prototype.constructor=RangeError;As.prototype.name="IndexError";As.prototype.isIndexError=!0;function Yt(e){for(var t=[];Array.isArray(e);)t.push(e.length),e=e[0];return t}function gse(e,t,r){var n,i=e.length;if(i!==t[r])throw new nr(i,t[r]);if(r")}function nW(e,t){var r=t.length===0;if(r){if(Array.isArray(e))throw new nr(e.length,0)}else gse(e,t,0)}function z6(e,t){var r=e.isMatrix?e._size:Yt(e),n=t._sourceSize;n.forEach((i,a)=>{if(i!==null&&i!==r[a])throw new nr(i,r[a])})}function Vn(e,t){if(e!==void 0){if(!Qt(e)||!wt(e))throw new TypeError("Index must be an integer (value: "+e+")");if(e<0||typeof t=="number"&&e>=t)throw new As(e,t)}}function yy(e){for(var t=0;t=0,l=t%r===0;if(s)if(l)n[a]=-t/r;else throw new Error("Could not replace wildcard, since "+t+" is no multiple of "+-r);return n}function vse(e){return e.reduce((t,r)=>t*r,1)}function x8e(e,t){for(var r=e,n,i=t.length-1;i>0;i--){var a=t[i];n=[];for(var o=r.length/a,s=0;st.test(r))}function iW(e,t){return Array.prototype.join.call(e,t)}function LA(e){if(!Array.isArray(e))throw new TypeError("Array input expected");if(e.length===0)return e;var t=[],r=0;t[0]={value:e[0],identifier:0};for(var n=1;n1)return e.slice(1).reduce(function(r,n){return xse(r,n,t,0)},e[0]);throw new Error("Wrong number of arguments in function concat")}function w8e(){for(var e=arguments.length,t=new Array(e),r=0;rd.length),i=Math.max(...n),a=new Array(i).fill(null),o=0;oa[c]&&(a[c]=s[u])}for(var f=0;f1||e[i]>t[a])throw new Error("shape missmatch: missmatch is found in arg with shape (".concat(e,") not possible to broadcast dimension ").concat(n," with size ").concat(e[i]," to size ").concat(t[a]))}}function sW(e,t){var r=Yt(e);if(Ip(r,t))return e;H6(r,t);var n=w8e(r,t),i=n.length,a=[...Array(i-r.length).fill(1),...r],o=E8e(e);r.length!C8e(a)).every(a=>r[a]!==void 0);if(!n){var i=t.filter(a=>r[a]===void 0);throw new Error('Cannot create function "'.concat(e,'", ')+"some dependencies are missing: ".concat(i.map(a=>'"'.concat(a,'"')).join(", "),"."))}}function C8e(e){return e&&e[0]==="?"}function lW(e){return e&&e[0]==="?"?e.slice(1):e}function Zi(e,t){if(kse(e)&&Sse(e,t))return e[t];throw typeof e[t]=="function"&&hT(e,t)?new Error('Cannot access method "'+t+'" as a property'):new Error('No access to property "'+t+'"')}function Gm(e,t,r){if(kse(e)&&Sse(e,t))return e[t]=r,r;throw new Error('No access to property "'+t+'"')}function wse(e,t){return t in e}function Sse(e,t){return!e||typeof e!="object"?!1:Et(D8e,t)?!0:!(t in Object.prototype||t in Function.prototype)}function Ese(e,t){if(!hT(e,t))throw new Error('No access to method "'+t+'"');return e[t]}function hT(e,t){return e==null||typeof e[t]!="function"||Et(e,t)&&Object.getPrototypeOf&&t in Object.getPrototypeOf(e)?!1:Et(O8e,t)?!0:!(t in Object.prototype||t in Function.prototype)}function kse(e){return typeof e=="object"&&e&&e.constructor===Object}var D8e={length:!0,name:!0},O8e={toString:!0,valueOf:!0,toLocaleString:!0};var xy=class{constructor(t){this.wrappedObject=t,this[Symbol.iterator]=this.entries}keys(){return Object.keys(this.wrappedObject).values()}get(t){return Zi(this.wrappedObject,t)}set(t,r){return Gm(this.wrappedObject,t,r),this}has(t){return wse(this.wrappedObject,t)}entries(){return Cse(this.keys(),t=>[t,this.get(t)])}forEach(t){for(var r of this.keys())t(this.get(r),r,this)}delete(t){delete this.wrappedObject[t]}clear(){for(var t of this.keys())this.delete(t)}get size(){return Object.keys(this.wrappedObject).length}},Xw=class{constructor(t,r,n){this.a=t,this.b=r,this.bKeys=n,this[Symbol.iterator]=this.entries}get(t){return this.bKeys.has(t)?this.b.get(t):this.a.get(t)}set(t,r){return this.bKeys.has(t)?this.b.set(t,r):this.a.set(t,r),this}has(t){return this.b.has(t)||this.a.has(t)}keys(){return new Set([...this.a.keys(),...this.b.keys()])[Symbol.iterator]()}entries(){return Cse(this.keys(),t=>[t,this.get(t)])}forEach(t){for(var r of this.keys())t(this.get(r),r,this)}delete(t){return this.bKeys.has(t)?this.b.delete(t):this.a.delete(t)}clear(){this.a.clear(),this.b.clear()}get size(){return[...this.keys()].length}};function Cse(e,t){return{next:()=>{var r=e.next();return r.done?r:{value:t(r.value),done:!1}}}}function L0(){return new Map}function zA(e){if(!e)return L0();if(uW(e))return e;if(Hm(e))return new xy(e);throw new Error("createMap can create maps from objects or Maps")}function Dse(e){if(e instanceof xy)return e.wrappedObject;var t={};for(var r of e.keys()){var n=e.get(r);Gm(t,r,n)}return t}function uW(e){return e?e instanceof Map||e instanceof xy||typeof e.set=="function"&&typeof e.get=="function"&&typeof e.keys=="function"&&typeof e.has=="function":!1}var Ose=function(){return Ose=dW.default.create,dW.default},M8e=["?BigNumber","?Complex","?DenseMatrix","?Fraction"],gT=V("typed",M8e,function(t){var{BigNumber:r,Complex:n,DenseMatrix:i,Fraction:a}=t,o=Ose();return o.clear(),o.addTypes([{name:"number",test:Qt},{name:"Complex",test:ds},{name:"BigNumber",test:It},{name:"Fraction",test:gf},{name:"Unit",test:Fo},{name:"identifier",test:s=>da&&/^(?:[A-Za-z\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0560-\u0588\u05D0-\u05EA\u05EF-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u0860-\u086A\u0870-\u0887\u0889-\u088E\u08A0-\u08C9\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u09FC\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C5D\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D04-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E86-\u0E8A\u0E8C-\u0EA3\u0EA5\u0EA7-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16F1-\u16F8\u1700-\u1711\u171F-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1878\u1880-\u1884\u1887-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4C\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C88\u1C90-\u1CBA\u1CBD-\u1CBF\u1CE9-\u1CEC\u1CEE-\u1CF3\u1CF5\u1CF6\u1CFA\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2183\u2184\u2C00-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005\u3006\u3031-\u3035\u303B\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312F\u3131-\u318E\u31A0-\u31BF\u31F0-\u31FF\u3400-\u4DBF\u4E00-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6E5\uA717-\uA71F\uA722-\uA788\uA78B-\uA7CA\uA7D0\uA7D1\uA7D3\uA7D5-\uA7D9\uA7F2-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA8FE\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB69\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDE80-\uDE9C\uDEA0-\uDED0\uDF00-\uDF1F\uDF2D-\uDF40\uDF42-\uDF49\uDF50-\uDF75\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF]|\uD801[\uDC00-\uDC9D\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDD70-\uDD7A\uDD7C-\uDD8A\uDD8C-\uDD92\uDD94\uDD95\uDD97-\uDDA1\uDDA3-\uDDB1\uDDB3-\uDDB9\uDDBB\uDDBC\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67\uDF80-\uDF85\uDF87-\uDFB0\uDFB2-\uDFBA]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00\uDE10-\uDE13\uDE15-\uDE17\uDE19-\uDE35\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE4\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2\uDD00-\uDD23\uDE80-\uDEA9\uDEB0\uDEB1\uDF00-\uDF1C\uDF27\uDF30-\uDF45\uDF70-\uDF81\uDFB0-\uDFC4\uDFE0-\uDFF6]|\uD804[\uDC03-\uDC37\uDC71\uDC72\uDC75\uDC83-\uDCAF\uDCD0-\uDCE8\uDD03-\uDD26\uDD44\uDD47\uDD50-\uDD72\uDD76\uDD83-\uDDB2\uDDC1-\uDDC4\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE2B\uDE3F\uDE40\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEDE\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF50\uDF5D-\uDF61]|\uD805[\uDC00-\uDC34\uDC47-\uDC4A\uDC5F-\uDC61\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDD80-\uDDAE\uDDD8-\uDDDB\uDE00-\uDE2F\uDE44\uDE80-\uDEAA\uDEB8\uDF00-\uDF1A\uDF40-\uDF46]|\uD806[\uDC00-\uDC2B\uDCA0-\uDCDF\uDCFF-\uDD06\uDD09\uDD0C-\uDD13\uDD15\uDD16\uDD18-\uDD2F\uDD3F\uDD41\uDDA0-\uDDA7\uDDAA-\uDDD0\uDDE1\uDDE3\uDE00\uDE0B-\uDE32\uDE3A\uDE50\uDE5C-\uDE89\uDE9D\uDEB0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC2E\uDC40\uDC72-\uDC8F\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD30\uDD46\uDD60-\uDD65\uDD67\uDD68\uDD6A-\uDD89\uDD98\uDEE0-\uDEF2\uDF02\uDF04-\uDF10\uDF12-\uDF33\uDFB0]|\uD808[\uDC00-\uDF99]|\uD809[\uDC80-\uDD43]|\uD80B[\uDF90-\uDFF0]|[\uD80C\uD81C-\uD820\uD822\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879\uD880-\uD883\uD885-\uD887][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2F\uDC41-\uDC46]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDE70-\uDEBE\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDE40-\uDE7F\uDF00-\uDF4A\uDF50\uDF93-\uDF9F\uDFE0\uDFE1\uDFE3]|\uD821[\uDC00-\uDFF7]|\uD823[\uDC00-\uDCD5\uDD00-\uDD08]|\uD82B[\uDFF0-\uDFF3\uDFF5-\uDFFB\uDFFD\uDFFE]|\uD82C[\uDC00-\uDD22\uDD32\uDD50-\uDD52\uDD55\uDD64-\uDD67\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB]|\uD837[\uDF00-\uDF1E\uDF25-\uDF2A]|\uD838[\uDC30-\uDC6D\uDD00-\uDD2C\uDD37-\uDD3D\uDD4E\uDE90-\uDEAD\uDEC0-\uDEEB]|\uD839[\uDCD0-\uDCEB\uDFE0-\uDFE6\uDFE8-\uDFEB\uDFED\uDFEE\uDFF0-\uDFFE]|\uD83A[\uDC00-\uDCC4\uDD00-\uDD43\uDD4B]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDEDF\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF39\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D]|\uD884[\uDC00-\uDF4A\uDF50-\uDFFF]|\uD888[\uDC00-\uDFAF])(?:[0-9A-Za-z\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0560-\u0588\u05D0-\u05EA\u05EF-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u0860-\u086A\u0870-\u0887\u0889-\u088E\u08A0-\u08C9\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u09FC\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C5D\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D04-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E86-\u0E8A\u0E8C-\u0EA3\u0EA5\u0EA7-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16F1-\u16F8\u1700-\u1711\u171F-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1878\u1880-\u1884\u1887-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4C\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C88\u1C90-\u1CBA\u1CBD-\u1CBF\u1CE9-\u1CEC\u1CEE-\u1CF3\u1CF5\u1CF6\u1CFA\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2183\u2184\u2C00-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005\u3006\u3031-\u3035\u303B\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312F\u3131-\u318E\u31A0-\u31BF\u31F0-\u31FF\u3400-\u4DBF\u4E00-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6E5\uA717-\uA71F\uA722-\uA788\uA78B-\uA7CA\uA7D0\uA7D1\uA7D3\uA7D5-\uA7D9\uA7F2-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA8FE\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB69\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDE80-\uDE9C\uDEA0-\uDED0\uDF00-\uDF1F\uDF2D-\uDF40\uDF42-\uDF49\uDF50-\uDF75\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF]|\uD801[\uDC00-\uDC9D\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDD70-\uDD7A\uDD7C-\uDD8A\uDD8C-\uDD92\uDD94\uDD95\uDD97-\uDDA1\uDDA3-\uDDB1\uDDB3-\uDDB9\uDDBB\uDDBC\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67\uDF80-\uDF85\uDF87-\uDFB0\uDFB2-\uDFBA]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00\uDE10-\uDE13\uDE15-\uDE17\uDE19-\uDE35\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE4\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2\uDD00-\uDD23\uDE80-\uDEA9\uDEB0\uDEB1\uDF00-\uDF1C\uDF27\uDF30-\uDF45\uDF70-\uDF81\uDFB0-\uDFC4\uDFE0-\uDFF6]|\uD804[\uDC03-\uDC37\uDC71\uDC72\uDC75\uDC83-\uDCAF\uDCD0-\uDCE8\uDD03-\uDD26\uDD44\uDD47\uDD50-\uDD72\uDD76\uDD83-\uDDB2\uDDC1-\uDDC4\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE2B\uDE3F\uDE40\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEDE\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF50\uDF5D-\uDF61]|\uD805[\uDC00-\uDC34\uDC47-\uDC4A\uDC5F-\uDC61\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDD80-\uDDAE\uDDD8-\uDDDB\uDE00-\uDE2F\uDE44\uDE80-\uDEAA\uDEB8\uDF00-\uDF1A\uDF40-\uDF46]|\uD806[\uDC00-\uDC2B\uDCA0-\uDCDF\uDCFF-\uDD06\uDD09\uDD0C-\uDD13\uDD15\uDD16\uDD18-\uDD2F\uDD3F\uDD41\uDDA0-\uDDA7\uDDAA-\uDDD0\uDDE1\uDDE3\uDE00\uDE0B-\uDE32\uDE3A\uDE50\uDE5C-\uDE89\uDE9D\uDEB0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC2E\uDC40\uDC72-\uDC8F\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD30\uDD46\uDD60-\uDD65\uDD67\uDD68\uDD6A-\uDD89\uDD98\uDEE0-\uDEF2\uDF02\uDF04-\uDF10\uDF12-\uDF33\uDFB0]|\uD808[\uDC00-\uDF99]|\uD809[\uDC80-\uDD43]|\uD80B[\uDF90-\uDFF0]|[\uD80C\uD81C-\uD820\uD822\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879\uD880-\uD883\uD885-\uD887][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2F\uDC41-\uDC46]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDE70-\uDEBE\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDE40-\uDE7F\uDF00-\uDF4A\uDF50\uDF93-\uDF9F\uDFE0\uDFE1\uDFE3]|\uD821[\uDC00-\uDFF7]|\uD823[\uDC00-\uDCD5\uDD00-\uDD08]|\uD82B[\uDFF0-\uDFF3\uDFF5-\uDFFB\uDFFD\uDFFE]|\uD82C[\uDC00-\uDD22\uDD32\uDD50-\uDD52\uDD55\uDD64-\uDD67\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB]|\uD837[\uDF00-\uDF1E\uDF25-\uDF2A]|\uD838[\uDC30-\uDC6D\uDD00-\uDD2C\uDD37-\uDD3D\uDD4E\uDE90-\uDEAD\uDEC0-\uDEEB]|\uD839[\uDCD0-\uDCEB\uDFE0-\uDFE6\uDFE8-\uDFEB\uDFED\uDFEE\uDFF0-\uDFFE]|\uD83A[\uDC00-\uDCC4\uDD00-\uDD43\uDD4B]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDEDF\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF39\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D]|\uD884[\uDC00-\uDF4A\uDF50-\uDFFF]|\uD888[\uDC00-\uDFAF])*$/.test(s)},{name:"string",test:da},{name:"Chain",test:Uw},{name:"Array",test:Ir},{name:"Matrix",test:St},{name:"DenseMatrix",test:qA},{name:"SparseMatrix",test:vf},{name:"Range",test:R0},{name:"Index",test:Wm},{name:"boolean",test:VN},{name:"ResultSet",test:GN},{name:"Help",test:zw},{name:"function",test:QN},{name:"Date",test:YN},{name:"RegExp",test:ZN},{name:"null",test:XN},{name:"undefined",test:KN},{name:"AccessorNode",test:Uu},{name:"ArrayNode",test:ps},{name:"AssignmentNode",test:JN},{name:"BlockNode",test:eT},{name:"ConditionalNode",test:tT},{name:"ConstantNode",test:gr},{name:"FunctionNode",test:xl},{name:"FunctionAssignmentNode",test:Ed},{name:"IndexNode",test:Sc},{name:"Node",test:Nr},{name:"ObjectNode",test:Vm},{name:"OperatorNode",test:bi},{name:"ParenthesisNode",test:ms},{name:"RangeNode",test:rT},{name:"RelationalNode",test:nT},{name:"SymbolNode",test:ri},{name:"Map",test:uW},{name:"Object",test:Hm}]),o.addConversions([{from:"number",to:"BigNumber",convert:function(l){if(r||cW(l),ase(l)>15)throw new TypeError("Cannot implicitly convert a number with >15 significant digits to BigNumber (value: "+l+"). Use function bignumber(x) to convert to BigNumber.");return new r(l)}},{from:"number",to:"Complex",convert:function(l){return n||AT(l),new n(l,0)}},{from:"BigNumber",to:"Complex",convert:function(l){return n||AT(l),new n(l.toNumber(),0)}},{from:"Fraction",to:"BigNumber",convert:function(l){throw new TypeError("Cannot implicitly convert a Fraction to BigNumber or vice versa. Use function bignumber(x) to convert to BigNumber or fraction(x) to convert to Fraction.")}},{from:"Fraction",to:"Complex",convert:function(l){return n||AT(l),new n(l.valueOf(),0)}},{from:"number",to:"Fraction",convert:function(l){a||fW(l);var u=new a(l);if(u.valueOf()!==l)throw new TypeError("Cannot implicitly convert a number to a Fraction when there will be a loss of precision (value: "+l+"). Use function fraction(x) to convert to Fraction.");return u}},{from:"string",to:"number",convert:function(l){var u=Number(l);if(isNaN(u))throw new Error('Cannot convert "'+l+'" to a number');return u}},{from:"string",to:"BigNumber",convert:function(l){r||cW(l);try{return new r(l)}catch{throw new Error('Cannot convert "'+l+'" to BigNumber')}}},{from:"string",to:"Fraction",convert:function(l){a||fW(l);try{return new a(l)}catch{throw new Error('Cannot convert "'+l+'" to Fraction')}}},{from:"string",to:"Complex",convert:function(l){n||AT(l);try{return new n(l)}catch{throw new Error('Cannot convert "'+l+'" to Complex')}}},{from:"boolean",to:"number",convert:function(l){return+l}},{from:"boolean",to:"BigNumber",convert:function(l){return r||cW(l),new r(+l)}},{from:"boolean",to:"Fraction",convert:function(l){return a||fW(l),new a(+l)}},{from:"boolean",to:"string",convert:function(l){return String(l)}},{from:"Array",to:"Matrix",convert:function(l){return i||j8e(),new i(l)}},{from:"Matrix",to:"Array",convert:function(l){return l.valueOf()}}]),o.onMismatch=(s,l,u)=>{var c=o.createError(s,l,u);if(["wrongType","mismatch"].includes(c.data.category)&&l.length===1&&Da(l[0])&&u.some(d=>!d.params.includes(","))){var f=new TypeError("Function '".concat(s,"' doesn't apply to matrices. To call it ")+"elementwise on a matrix 'M', try 'map(M, ".concat(s,")'."));throw f.data=c.data,f}throw c},o.onMismatch=(s,l,u)=>{var c=o.createError(s,l,u);if(["wrongType","mismatch"].includes(c.data.category)&&l.length===1&&Da(l[0])&&u.some(d=>!d.params.includes(","))){var f=new TypeError("Function '".concat(s,"' doesn't apply to matrices. To call it ")+"elementwise on a matrix 'M', try 'map(M, ".concat(s,")'."));throw f.data=c.data,f}throw c},o});function cW(e){throw new Error("Cannot convert value ".concat(e," into a BigNumber: no class 'BigNumber' provided"))}function AT(e){throw new Error("Cannot convert value ".concat(e," into a Complex number: no class 'Complex' provided"))}function j8e(){throw new Error("Cannot convert array into a Matrix: no class 'DenseMatrix' provided")}function fW(e){throw new Error("Cannot convert value ".concat(e," into a Fraction, no class 'Fraction' provided."))}var N8e="ResultSet",T8e=[],vT=V(N8e,T8e,()=>{function e(t){if(!(this instanceof e))throw new SyntaxError("Constructor must be called with the new operator");this.entries=t||[]}return e.prototype.type="ResultSet",e.prototype.isResultSet=!0,e.prototype.valueOf=function(){return this.entries},e.prototype.toString=function(){return"["+this.entries.join(", ")+"]"},e.prototype.toJSON=function(){return{mathjs:"ResultSet",entries:this.entries}},e.fromJSON=function(t){return new e(t.entries)},e},{isClass:!0});var Kw=9e15,H0=1e9,pW="0123456789abcdef",bT="2.3025850929940456840179914546843642076011014886287729760333279009675726096773524802359972050895982983419677840422862486334095254650828067566662873690987816894829072083255546808437998948262331985283935053089653777326288461633662222876982198867465436674744042432743651550489343149393914796194044002221051017141748003688084012647080685567743216228355220114804663715659121373450747856947683463616792101806445070648000277502684916746550586856935673420670581136429224554405758925724208241314695689016758940256776311356919292033376587141660230105703089634572075440370847469940168269282808481184289314848524948644871927809676271275775397027668605952496716674183485704422507197965004714951050492214776567636938662976979522110718264549734772662425709429322582798502585509785265383207606726317164309505995087807523710333101197857547331541421808427543863591778117054309827482385045648019095610299291824318237525357709750539565187697510374970888692180205189339507238539205144634197265287286965110862571492198849978748873771345686209167058",xT="3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679821480865132823066470938446095505822317253594081284811174502841027019385211055596446229489549303819644288109756659334461284756482337867831652712019091456485669234603486104543266482133936072602491412737245870066063155881748815209209628292540917153643678925903600113305305488204665213841469519415116094330572703657595919530921861173819326117931051185480744623799627495673518857527248912279381830119491298336733624406566430860213949463952247371907021798609437027705392171762931767523846748184676694051320005681271452635608277857713427577896091736371787214684409012249534301465495853710507922796892589235420199561121290219608640344181598136297747713099605187072113499999983729780499510597317328160963185950244594553469083026425223082533446850352619311881710100031378387528865875332083814206171776691473035982534904287554687311595628638823537875937519577818577805321712268066130019278766111959092164201989380952572010654858632789",mW={precision:20,rounding:4,modulo:1,toExpNeg:-7,toExpPos:21,minE:-Kw,maxE:Kw,crypto:!1},Tse,UA,Br=!0,ST="[DecimalError] ",W0=ST+"Invalid argument: ",Fse=ST+"Precision limit exceeded",_se=ST+"crypto unavailable",Pse="[object Decimal]",iu=Math.floor,gs=Math.pow,F8e=/^0b([01]+(\.[01]*)?|\.[01]+)(p[+-]?\d+)?$/i,_8e=/^0x([0-9a-f]+(\.[0-9a-f]*)?|\.[0-9a-f]+)(p[+-]?\d+)?$/i,P8e=/^0o([0-7]+(\.[0-7]*)?|\.[0-7]+)(p[+-]?\d+)?$/i,Ise=/^(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,qp=1e7,vr=7,I8e=9007199254740991,B8e=bT.length-1,hW=xT.length-1,pt={toStringTag:Pse};pt.absoluteValue=pt.abs=function(){var e=new this.constructor(this);return e.s<0&&(e.s=1),cr(e)};pt.ceil=function(){return cr(new this.constructor(this),this.e+1,2)};pt.clampedTo=pt.clamp=function(e,t){var r,n=this,i=n.constructor;if(e=new i(e),t=new i(t),!e.s||!t.s)return new i(NaN);if(e.gt(t))throw Error(W0+t);return r=n.cmp(e),r<0?e:n.cmp(t)>0?t:new i(n)};pt.comparedTo=pt.cmp=function(e){var t,r,n,i,a=this,o=a.d,s=(e=new a.constructor(e)).d,l=a.s,u=e.s;if(!o||!s)return!l||!u?NaN:l!==u?l:o===s?0:!o^l<0?1:-1;if(!o[0]||!s[0])return o[0]?l:s[0]?-u:0;if(l!==u)return l;if(a.e!==e.e)return a.e>e.e^l<0?1:-1;for(n=o.length,i=s.length,t=0,r=ns[t]^l<0?1:-1;return n===i?0:n>i^l<0?1:-1};pt.cosine=pt.cos=function(){var e,t,r=this,n=r.constructor;return r.d?r.d[0]?(e=n.precision,t=n.rounding,n.precision=e+Math.max(r.e,r.sd())+vr,n.rounding=1,r=R8e(n,Lse(n,r)),n.precision=e,n.rounding=t,cr(UA==2||UA==3?r.neg():r,e,t,!0)):new n(1):new n(NaN)};pt.cubeRoot=pt.cbrt=function(){var e,t,r,n,i,a,o,s,l,u,c=this,f=c.constructor;if(!c.isFinite()||c.isZero())return new f(c);for(Br=!1,a=c.s*gs(c.s*c,1/3),!a||Math.abs(a)==1/0?(r=wl(c.d),e=c.e,(a=(e-r.length+1)%3)&&(r+=a==1||a==-2?"0":"00"),a=gs(r,1/3),e=iu((e+1)/3)-(e%3==(e<0?-1:2)),a==1/0?r="5e"+e:(r=a.toExponential(),r=r.slice(0,r.indexOf("e")+1)+e),n=new f(r),n.s=c.s):n=new f(a.toString()),o=(e=f.precision)+3;;)if(s=n,l=s.times(s).times(s),u=l.plus(c),n=Xi(u.plus(c).times(s),u.plus(l),o+2,1),wl(s.d).slice(0,o)===(r=wl(n.d)).slice(0,o))if(r=r.slice(o-3,o+1),r=="9999"||!i&&r=="4999"){if(!i&&(cr(s,e+1,0),s.times(s).times(s).eq(c))){n=s;break}o+=4,i=1}else{(!+r||!+r.slice(1)&&r.charAt(0)=="5")&&(cr(n,e+1,1),t=!n.times(n).times(n).eq(c));break}return Br=!0,cr(n,e,f.rounding,t)};pt.decimalPlaces=pt.dp=function(){var e,t=this.d,r=NaN;if(t){if(e=t.length-1,r=(e-iu(this.e/vr))*vr,e=t[e],e)for(;e%10==0;e/=10)r--;r<0&&(r=0)}return r};pt.dividedBy=pt.div=function(e){return Xi(this,new this.constructor(e))};pt.dividedToIntegerBy=pt.divToInt=function(e){var t=this,r=t.constructor;return cr(Xi(t,new r(e),0,1,1),r.precision,r.rounding)};pt.equals=pt.eq=function(e){return this.cmp(e)===0};pt.floor=function(){return cr(new this.constructor(this),this.e+1,3)};pt.greaterThan=pt.gt=function(e){return this.cmp(e)>0};pt.greaterThanOrEqualTo=pt.gte=function(e){var t=this.cmp(e);return t==1||t===0};pt.hyperbolicCosine=pt.cosh=function(){var e,t,r,n,i,a=this,o=a.constructor,s=new o(1);if(!a.isFinite())return new o(a.s?1/0:NaN);if(a.isZero())return s;r=o.precision,n=o.rounding,o.precision=r+Math.max(a.e,a.sd())+4,o.rounding=1,i=a.d.length,i<32?(e=Math.ceil(i/3),t=(1/kT(4,e)).toString()):(e=16,t="2.3283064365386962890625e-10"),a=Jw(o,1,a.times(t),new o(1),!0);for(var l,u=e,c=new o(8);u--;)l=a.times(a),a=s.minus(l.times(c.minus(l.times(c))));return cr(a,o.precision=r,o.rounding=n,!0)};pt.hyperbolicSine=pt.sinh=function(){var e,t,r,n,i=this,a=i.constructor;if(!i.isFinite()||i.isZero())return new a(i);if(t=a.precision,r=a.rounding,a.precision=t+Math.max(i.e,i.sd())+4,a.rounding=1,n=i.d.length,n<3)i=Jw(a,2,i,i,!0);else{e=1.4*Math.sqrt(n),e=e>16?16:e|0,i=i.times(1/kT(5,e)),i=Jw(a,2,i,i,!0);for(var o,s=new a(5),l=new a(16),u=new a(20);e--;)o=i.times(i),i=i.times(s.plus(o.times(l.times(o).plus(u))))}return a.precision=t,a.rounding=r,cr(i,t,r,!0)};pt.hyperbolicTangent=pt.tanh=function(){var e,t,r=this,n=r.constructor;return r.isFinite()?r.isZero()?new n(r):(e=n.precision,t=n.rounding,n.precision=e+7,n.rounding=1,Xi(r.sinh(),r.cosh(),n.precision=e,n.rounding=t)):new n(r.s)};pt.inverseCosine=pt.acos=function(){var e,t=this,r=t.constructor,n=t.abs().cmp(1),i=r.precision,a=r.rounding;return n!==-1?n===0?t.isNeg()?$p(r,i,a):new r(0):new r(NaN):t.isZero()?$p(r,i+4,a).times(.5):(r.precision=i+6,r.rounding=1,t=t.asin(),e=$p(r,i+4,a).times(.5),r.precision=i,r.rounding=a,e.minus(t))};pt.inverseHyperbolicCosine=pt.acosh=function(){var e,t,r=this,n=r.constructor;return r.lte(1)?new n(r.eq(1)?0:NaN):r.isFinite()?(e=n.precision,t=n.rounding,n.precision=e+Math.max(Math.abs(r.e),r.sd())+4,n.rounding=1,Br=!1,r=r.times(r).minus(1).sqrt().plus(r),Br=!0,n.precision=e,n.rounding=t,r.ln()):new n(r)};pt.inverseHyperbolicSine=pt.asinh=function(){var e,t,r=this,n=r.constructor;return!r.isFinite()||r.isZero()?new n(r):(e=n.precision,t=n.rounding,n.precision=e+2*Math.max(Math.abs(r.e),r.sd())+6,n.rounding=1,Br=!1,r=r.times(r).plus(1).sqrt().plus(r),Br=!0,n.precision=e,n.rounding=t,r.ln())};pt.inverseHyperbolicTangent=pt.atanh=function(){var e,t,r,n,i=this,a=i.constructor;return i.isFinite()?i.e>=0?new a(i.abs().eq(1)?i.s/0:i.isZero()?i:NaN):(e=a.precision,t=a.rounding,n=i.sd(),Math.max(n,e)<2*-i.e-1?cr(new a(i),e,t,!0):(a.precision=r=n-i.e,i=Xi(i.plus(1),new a(1).minus(i),r+e,1),a.precision=e+4,a.rounding=1,i=i.ln(),a.precision=e,a.rounding=t,i.times(.5))):new a(NaN)};pt.inverseSine=pt.asin=function(){var e,t,r,n,i=this,a=i.constructor;return i.isZero()?new a(i):(t=i.abs().cmp(1),r=a.precision,n=a.rounding,t!==-1?t===0?(e=$p(a,r+4,n).times(.5),e.s=i.s,e):new a(NaN):(a.precision=r+6,a.rounding=1,i=i.div(new a(1).minus(i.times(i)).sqrt().plus(1)).atan(),a.precision=r,a.rounding=n,i.times(2)))};pt.inverseTangent=pt.atan=function(){var e,t,r,n,i,a,o,s,l,u=this,c=u.constructor,f=c.precision,d=c.rounding;if(u.isFinite()){if(u.isZero())return new c(u);if(u.abs().eq(1)&&f+4<=hW)return o=$p(c,f+4,d).times(.25),o.s=u.s,o}else{if(!u.s)return new c(NaN);if(f+4<=hW)return o=$p(c,f+4,d).times(.5),o.s=u.s,o}for(c.precision=s=f+10,c.rounding=1,r=Math.min(28,s/vr+2|0),e=r;e;--e)u=u.div(u.times(u).plus(1).sqrt().plus(1));for(Br=!1,t=Math.ceil(s/vr),n=1,l=u.times(u),o=new c(u),i=u;e!==-1;)if(i=i.times(l),a=o.minus(i.div(n+=2)),i=i.times(l),o=a.plus(i.div(n+=2)),o.d[t]!==void 0)for(e=t;o.d[e]===a.d[e]&&e--;);return r&&(o=o.times(2<this.d.length-2};pt.isNaN=function(){return!this.s};pt.isNegative=pt.isNeg=function(){return this.s<0};pt.isPositive=pt.isPos=function(){return this.s>0};pt.isZero=function(){return!!this.d&&this.d[0]===0};pt.lessThan=pt.lt=function(e){return this.cmp(e)<0};pt.lessThanOrEqualTo=pt.lte=function(e){return this.cmp(e)<1};pt.logarithm=pt.log=function(e){var t,r,n,i,a,o,s,l,u=this,c=u.constructor,f=c.precision,d=c.rounding,p=5;if(e==null)e=new c(10),t=!0;else{if(e=new c(e),r=e.d,e.s<0||!r||!r[0]||e.eq(1))return new c(NaN);t=e.eq(10)}if(r=u.d,u.s<0||!r||!r[0]||u.eq(1))return new c(r&&!r[0]?-1/0:u.s!=1?NaN:r?0:1/0);if(t)if(r.length>1)a=!0;else{for(i=r[0];i%10===0;)i/=10;a=i!==1}if(Br=!1,s=f+p,o=U0(u,s),n=t?wT(c,s+10):U0(e,s),l=Xi(o,n,s,1),V6(l.d,i=f,d))do if(s+=10,o=U0(u,s),n=t?wT(c,s+10):U0(e,s),l=Xi(o,n,s,1),!a){+wl(l.d).slice(i+1,i+15)+1==1e14&&(l=cr(l,f+1,0));break}while(V6(l.d,i+=10,d));return Br=!0,cr(l,f,d)};pt.minus=pt.sub=function(e){var t,r,n,i,a,o,s,l,u,c,f,d,p=this,h=p.constructor;if(e=new h(e),!p.d||!e.d)return!p.s||!e.s?e=new h(NaN):p.d?e.s=-e.s:e=new h(e.d||p.s!==e.s?p:NaN),e;if(p.s!=e.s)return e.s=-e.s,p.plus(e);if(u=p.d,d=e.d,s=h.precision,l=h.rounding,!u[0]||!d[0]){if(d[0])e.s=-e.s;else if(u[0])e=new h(p);else return new h(l===3?-0:0);return Br?cr(e,s,l):e}if(r=iu(e.e/vr),c=iu(p.e/vr),u=u.slice(),a=c-r,a){for(f=a<0,f?(t=u,a=-a,o=d.length):(t=d,r=c,o=u.length),n=Math.max(Math.ceil(s/vr),o)+2,a>n&&(a=n,t.length=1),t.reverse(),n=a;n--;)t.push(0);t.reverse()}else{for(n=u.length,o=d.length,f=n0;--n)u[o++]=0;for(n=d.length;n>a;){if(u[--n]o?a+1:o+1,i>o&&(i=o,r.length=1),r.reverse();i--;)r.push(0);r.reverse()}for(o=u.length,i=c.length,o-i<0&&(i=o,r=c,c=u,u=r),t=0;i;)t=(u[--i]=u[i]+c[i]+t)/qp|0,u[i]%=qp;for(t&&(u.unshift(t),++n),o=u.length;u[--o]==0;)u.pop();return e.d=u,e.e=ET(u,n),Br?cr(e,s,l):e};pt.precision=pt.sd=function(e){var t,r=this;if(e!==void 0&&e!==!!e&&e!==1&&e!==0)throw Error(W0+e);return r.d?(t=Bse(r.d),e&&r.e+1>t&&(t=r.e+1)):t=NaN,t};pt.round=function(){var e=this,t=e.constructor;return cr(new t(e),e.e+1,t.rounding)};pt.sine=pt.sin=function(){var e,t,r=this,n=r.constructor;return r.isFinite()?r.isZero()?new n(r):(e=n.precision,t=n.rounding,n.precision=e+Math.max(r.e,r.sd())+vr,n.rounding=1,r=q8e(n,Lse(n,r)),n.precision=e,n.rounding=t,cr(UA>2?r.neg():r,e,t,!0)):new n(NaN)};pt.squareRoot=pt.sqrt=function(){var e,t,r,n,i,a,o=this,s=o.d,l=o.e,u=o.s,c=o.constructor;if(u!==1||!s||!s[0])return new c(!u||u<0&&(!s||s[0])?NaN:s?o:1/0);for(Br=!1,u=Math.sqrt(+o),u==0||u==1/0?(t=wl(s),(t.length+l)%2==0&&(t+="0"),u=Math.sqrt(t),l=iu((l+1)/2)-(l<0||l%2),u==1/0?t="5e"+l:(t=u.toExponential(),t=t.slice(0,t.indexOf("e")+1)+l),n=new c(t)):n=new c(u.toString()),r=(l=c.precision)+3;;)if(a=n,n=a.plus(Xi(o,a,r+2,1)).times(.5),wl(a.d).slice(0,r)===(t=wl(n.d)).slice(0,r))if(t=t.slice(r-3,r+1),t=="9999"||!i&&t=="4999"){if(!i&&(cr(a,l+1,0),a.times(a).eq(o))){n=a;break}r+=4,i=1}else{(!+t||!+t.slice(1)&&t.charAt(0)=="5")&&(cr(n,l+1,1),e=!n.times(n).eq(o));break}return Br=!0,cr(n,l,c.rounding,e)};pt.tangent=pt.tan=function(){var e,t,r=this,n=r.constructor;return r.isFinite()?r.isZero()?new n(r):(e=n.precision,t=n.rounding,n.precision=e+10,n.rounding=1,r=r.sin(),r.s=1,r=Xi(r,new n(1).minus(r.times(r)).sqrt(),e+10,0),n.precision=e,n.rounding=t,cr(UA==2||UA==4?r.neg():r,e,t,!0)):new n(NaN)};pt.times=pt.mul=function(e){var t,r,n,i,a,o,s,l,u,c=this,f=c.constructor,d=c.d,p=(e=new f(e)).d;if(e.s*=c.s,!d||!d[0]||!p||!p[0])return new f(!e.s||d&&!d[0]&&!p||p&&!p[0]&&!d?NaN:!d||!p?e.s/0:e.s*0);for(r=iu(c.e/vr)+iu(e.e/vr),l=d.length,u=p.length,l=0;){for(t=0,i=l+n;i>n;)s=a[i]+p[n]*d[i-n-1]+t,a[i--]=s%qp|0,t=s/qp|0;a[i]=(a[i]+t)%qp|0}for(;!a[--o];)a.pop();return t?++r:a.shift(),e.d=a,e.e=ET(a,r),Br?cr(e,f.precision,f.rounding):e};pt.toBinary=function(e,t){return vW(this,2,e,t)};pt.toDecimalPlaces=pt.toDP=function(e,t){var r=this,n=r.constructor;return r=new n(r),e===void 0?r:(kc(e,0,H0),t===void 0?t=n.rounding:kc(t,0,8),cr(r,e+r.e+1,t))};pt.toExponential=function(e,t){var r,n=this,i=n.constructor;return e===void 0?r=Qm(n,!0):(kc(e,0,H0),t===void 0?t=i.rounding:kc(t,0,8),n=cr(new i(n),e+1,t),r=Qm(n,!0,e+1)),n.isNeg()&&!n.isZero()?"-"+r:r};pt.toFixed=function(e,t){var r,n,i=this,a=i.constructor;return e===void 0?r=Qm(i):(kc(e,0,H0),t===void 0?t=a.rounding:kc(t,0,8),n=cr(new a(i),e+i.e+1,t),r=Qm(n,!1,e+n.e+1)),i.isNeg()&&!i.isZero()?"-"+r:r};pt.toFraction=function(e){var t,r,n,i,a,o,s,l,u,c,f,d,p=this,h=p.d,m=p.constructor;if(!h)return new m(p);if(u=r=new m(1),n=l=new m(0),t=new m(n),a=t.e=Bse(h)-p.e-1,o=a%vr,t.d[0]=gs(10,o<0?vr+o:o),e==null)e=a>0?t:u;else{if(s=new m(e),!s.isInt()||s.lt(u))throw Error(W0+s);e=s.gt(t)?a>0?t:u:s}for(Br=!1,s=new m(wl(h)),c=m.precision,m.precision=a=h.length*vr*2;f=Xi(s,t,0,1,1),i=r.plus(f.times(n)),i.cmp(e)!=1;)r=n,n=i,i=u,u=l.plus(f.times(i)),l=i,i=t,t=s.minus(f.times(i)),s=i;return i=Xi(e.minus(r),n,0,1,1),l=l.plus(i.times(u)),r=r.plus(i.times(n)),l.s=u.s=p.s,d=Xi(u,n,a,1).minus(p).abs().cmp(Xi(l,r,a,1).minus(p).abs())<1?[u,n]:[l,r],m.precision=c,Br=!0,d};pt.toHexadecimal=pt.toHex=function(e,t){return vW(this,16,e,t)};pt.toNearest=function(e,t){var r=this,n=r.constructor;if(r=new n(r),e==null){if(!r.d)return r;e=new n(1),t=n.rounding}else{if(e=new n(e),t===void 0?t=n.rounding:kc(t,0,8),!r.d)return e.s?r:e;if(!e.d)return e.s&&(e.s=r.s),e}return e.d[0]?(Br=!1,r=Xi(r,e,0,t,1).times(e),Br=!0,cr(r)):(e.s=r.s,r=e),r};pt.toNumber=function(){return+this};pt.toOctal=function(e,t){return vW(this,8,e,t)};pt.toPower=pt.pow=function(e){var t,r,n,i,a,o,s=this,l=s.constructor,u=+(e=new l(e));if(!s.d||!e.d||!s.d[0]||!e.d[0])return new l(gs(+s,u));if(s=new l(s),s.eq(1))return s;if(n=l.precision,a=l.rounding,e.eq(1))return cr(s,n,a);if(t=iu(e.e/vr),t>=e.d.length-1&&(r=u<0?-u:u)<=I8e)return i=Rse(l,s,r,n),e.s<0?new l(1).div(i):cr(i,n,a);if(o=s.s,o<0){if(tl.maxE+1||t0?o/0:0):(Br=!1,l.rounding=s.s=1,r=Math.min(12,(t+"").length),i=AW(e.times(U0(s,n+r)),n),i.d&&(i=cr(i,n+5,1),V6(i.d,n,a)&&(t=n+10,i=cr(AW(e.times(U0(s,t+r)),t),t+5,1),+wl(i.d).slice(n+1,n+15)+1==1e14&&(i=cr(i,n+1,0)))),i.s=o,Br=!0,l.rounding=a,cr(i,n,a))};pt.toPrecision=function(e,t){var r,n=this,i=n.constructor;return e===void 0?r=Qm(n,n.e<=i.toExpNeg||n.e>=i.toExpPos):(kc(e,1,H0),t===void 0?t=i.rounding:kc(t,0,8),n=cr(new i(n),e,t),r=Qm(n,e<=n.e||n.e<=i.toExpNeg,e)),n.isNeg()&&!n.isZero()?"-"+r:r};pt.toSignificantDigits=pt.toSD=function(e,t){var r=this,n=r.constructor;return e===void 0?(e=n.precision,t=n.rounding):(kc(e,1,H0),t===void 0?t=n.rounding:kc(t,0,8)),cr(new n(r),e,t)};pt.toString=function(){var e=this,t=e.constructor,r=Qm(e,e.e<=t.toExpNeg||e.e>=t.toExpPos);return e.isNeg()&&!e.isZero()?"-"+r:r};pt.truncated=pt.trunc=function(){return cr(new this.constructor(this),this.e+1,1)};pt.valueOf=pt.toJSON=function(){var e=this,t=e.constructor,r=Qm(e,e.e<=t.toExpNeg||e.e>=t.toExpPos);return e.isNeg()?"-"+r:r};function wl(e){var t,r,n,i=e.length-1,a="",o=e[0];if(i>0){for(a+=o,t=1;tr)throw Error(W0+e)}function V6(e,t,r,n){var i,a,o,s;for(a=e[0];a>=10;a/=10)--t;return--t<0?(t+=vr,i=0):(i=Math.ceil((t+1)/vr),t%=vr),a=gs(10,vr-t),s=e[i]%a|0,n==null?t<3?(t==0?s=s/100|0:t==1&&(s=s/10|0),o=r<4&&s==99999||r>3&&s==49999||s==5e4||s==0):o=(r<4&&s+1==a||r>3&&s+1==a/2)&&(e[i+1]/a/100|0)==gs(10,t-2)-1||(s==a/2||s==0)&&(e[i+1]/a/100|0)==0:t<4?(t==0?s=s/1e3|0:t==1?s=s/100|0:t==2&&(s=s/10|0),o=(n||r<4)&&s==9999||!n&&r>3&&s==4999):o=((n||r<4)&&s+1==a||!n&&r>3&&s+1==a/2)&&(e[i+1]/a/1e3|0)==gs(10,t-3)-1,o}function yT(e,t,r){for(var n,i=[0],a,o=0,s=e.length;or-1&&(i[n+1]===void 0&&(i[n+1]=0),i[n+1]+=i[n]/r|0,i[n]%=r)}return i.reverse()}function R8e(e,t){var r,n,i;if(t.isZero())return t;n=t.d.length,n<32?(r=Math.ceil(n/3),i=(1/kT(4,r)).toString()):(r=16,i="2.3283064365386962890625e-10"),e.precision+=r,t=Jw(e,1,t.times(i),new e(1));for(var a=r;a--;){var o=t.times(t);t=o.times(o).minus(o).times(8).plus(1)}return e.precision-=r,t}var Xi=function(){function e(n,i,a){var o,s=0,l=n.length;for(n=n.slice();l--;)o=n[l]*i+s,n[l]=o%a|0,s=o/a|0;return s&&n.unshift(s),n}function t(n,i,a,o){var s,l;if(a!=o)l=a>o?1:-1;else for(s=l=0;si[s]?1:-1;break}return l}function r(n,i,a,o){for(var s=0;a--;)n[a]-=s,s=n[a]1;)n.shift()}return function(n,i,a,o,s,l){var u,c,f,d,p,h,m,g,A,b,v,x,w,S,k,j,O,C,N,D,P=n.constructor,q=n.s==i.s?1:-1,z=n.d,I=i.d;if(!z||!z[0]||!I||!I[0])return new P(!n.s||!i.s||(z?I&&z[0]==I[0]:!I)?NaN:z&&z[0]==0||!I?q*0:q/0);for(l?(p=1,c=n.e-i.e):(l=qp,p=vr,c=iu(n.e/p)-iu(i.e/p)),N=I.length,O=z.length,A=new P(q),b=A.d=[],f=0;I[f]==(z[f]||0);f++);if(I[f]>(z[f]||0)&&c--,a==null?(S=a=P.precision,o=P.rounding):s?S=a+(n.e-i.e)+1:S=a,S<0)b.push(1),h=!0;else{if(S=S/p+2|0,f=0,N==1){for(d=0,I=I[0],S++;(f1&&(I=e(I,d,l),z=e(z,d,l),N=I.length,O=z.length),j=N,v=z.slice(0,N),x=v.length;x=l/2&&++C;do d=0,u=t(I,v,N,x),u<0?(w=v[0],N!=x&&(w=w*l+(v[1]||0)),d=w/C|0,d>1?(d>=l&&(d=l-1),m=e(I,d,l),g=m.length,x=v.length,u=t(m,v,g,x),u==1&&(d--,r(m,N=10;d/=10)f++;A.e=f+c*p-1,cr(A,s?a+A.e+1:a,o,h)}return A}}();function cr(e,t,r,n){var i,a,o,s,l,u,c,f,d,p=e.constructor;e:if(t!=null){if(f=e.d,!f)return e;for(i=1,s=f[0];s>=10;s/=10)i++;if(a=t-i,a<0)a+=vr,o=t,c=f[d=0],l=c/gs(10,i-o-1)%10|0;else if(d=Math.ceil((a+1)/vr),s=f.length,d>=s)if(n){for(;s++<=d;)f.push(0);c=l=0,i=1,a%=vr,o=a-vr+1}else break e;else{for(c=s=f[d],i=1;s>=10;s/=10)i++;a%=vr,o=a-vr+i,l=o<0?0:c/gs(10,i-o-1)%10|0}if(n=n||t<0||f[d+1]!==void 0||(o<0?c:c%gs(10,i-o-1)),u=r<4?(l||n)&&(r==0||r==(e.s<0?3:2)):l>5||l==5&&(r==4||n||r==6&&(a>0?o>0?c/gs(10,i-o):0:f[d-1])%10&1||r==(e.s<0?8:7)),t<1||!f[0])return f.length=0,u?(t-=e.e+1,f[0]=gs(10,(vr-t%vr)%vr),e.e=-t||0):f[0]=e.e=0,e;if(a==0?(f.length=d,s=1,d--):(f.length=d+1,s=gs(10,vr-a),f[d]=o>0?(c/gs(10,i-o)%gs(10,o)|0)*s:0),u)for(;;)if(d==0){for(a=1,o=f[0];o>=10;o/=10)a++;for(o=f[0]+=s,s=1;o>=10;o/=10)s++;a!=s&&(e.e++,f[0]==qp&&(f[0]=1));break}else{if(f[d]+=s,f[d]!=qp)break;f[d--]=0,s=1}for(a=f.length;f[--a]===0;)f.pop()}return Br&&(e.e>p.maxE?(e.d=null,e.e=NaN):e.e0?a=a.charAt(0)+"."+a.slice(1)+z0(n):o>1&&(a=a.charAt(0)+"."+a.slice(1)),a=a+(e.e<0?"e":"e+")+e.e):i<0?(a="0."+z0(-i-1)+a,r&&(n=r-o)>0&&(a+=z0(n))):i>=o?(a+=z0(i+1-o),r&&(n=r-i-1)>0&&(a=a+"."+z0(n))):((n=i+1)0&&(i+1===o&&(a+="."),a+=z0(n))),a}function ET(e,t){var r=e[0];for(t*=vr;r>=10;r/=10)t++;return t}function wT(e,t,r){if(t>B8e)throw Br=!0,r&&(e.precision=r),Error(Fse);return cr(new e(bT),t,1,!0)}function $p(e,t,r){if(t>hW)throw Error(Fse);return cr(new e(xT),t,r,!0)}function Bse(e){var t=e.length-1,r=t*vr+1;if(t=e[t],t){for(;t%10==0;t/=10)r--;for(t=e[0];t>=10;t/=10)r++}return r}function z0(e){for(var t="";e--;)t+="0";return t}function Rse(e,t,r,n){var i,a=new e(1),o=Math.ceil(n/vr+4);for(Br=!1;;){if(r%2&&(a=a.times(t),jse(a.d,o)&&(i=!0)),r=iu(r/2),r===0){r=a.d.length-1,i&&a.d[r]===0&&++a.d[r];break}t=t.times(t),jse(t.d,o)}return Br=!0,a}function Mse(e){return e.d[e.d.length-1]&1}function $se(e,t,r){for(var n,i=new e(t[0]),a=0;++a17)return new d(e.d?e.d[0]?e.s<0?0:1/0:1:e.s?e.s<0?0:e:0/0);for(t==null?(Br=!1,l=h):l=t,s=new d(.03125);e.e>-2;)e=e.times(s),f+=5;for(n=Math.log(gs(2,f))/Math.LN10*2+5|0,l+=n,r=a=o=new d(1),d.precision=l;;){if(a=cr(a.times(e),l,1),r=r.times(++c),s=o.plus(Xi(a,r,l,1)),wl(s.d).slice(0,l)===wl(o.d).slice(0,l)){for(i=f;i--;)o=cr(o.times(o),l,1);if(t==null)if(u<3&&V6(o.d,l-n,p,u))d.precision=l+=10,r=a=s=new d(1),c=0,u++;else return cr(o,d.precision=h,p,Br=!0);else return d.precision=h,o}o=s}}function U0(e,t){var r,n,i,a,o,s,l,u,c,f,d,p=1,h=10,m=e,g=m.d,A=m.constructor,b=A.rounding,v=A.precision;if(m.s<0||!g||!g[0]||!m.e&&g[0]==1&&g.length==1)return new A(g&&!g[0]?-1/0:m.s!=1?NaN:g?0:m);if(t==null?(Br=!1,c=v):c=t,A.precision=c+=h,r=wl(g),n=r.charAt(0),Math.abs(a=m.e)<15e14){for(;n<7&&n!=1||n==1&&r.charAt(1)>3;)m=m.times(e),r=wl(m.d),n=r.charAt(0),p++;a=m.e,n>1?(m=new A("0."+r),a++):m=new A(n+"."+r.slice(1))}else return u=wT(A,c+2,v).times(a+""),m=U0(new A(n+"."+r.slice(1)),c-h).plus(u),A.precision=v,t==null?cr(m,v,b,Br=!0):m;for(f=m,l=o=m=Xi(m.minus(1),m.plus(1),c,1),d=cr(m.times(m),c,1),i=3;;){if(o=cr(o.times(d),c,1),u=l.plus(Xi(o,new A(i),c,1)),wl(u.d).slice(0,c)===wl(l.d).slice(0,c))if(l=l.times(2),a!==0&&(l=l.plus(wT(A,c+2,v).times(a+""))),l=Xi(l,new A(p),c,1),t==null)if(V6(l.d,c-h,b,s))A.precision=c+=h,u=o=m=Xi(f.minus(1),f.plus(1),c,1),d=cr(m.times(m),c,1),i=s=1;else return cr(l,A.precision=v,b,Br=!0);else return A.precision=v,l;l=u,i+=2}}function qse(e){return String(e.s*e.s/0)}function gW(e,t){var r,n,i;for((r=t.indexOf("."))>-1&&(t=t.replace(".","")),(n=t.search(/e/i))>0?(r<0&&(r=n),r+=+t.slice(n+1),t=t.substring(0,n)):r<0&&(r=t.length),n=0;t.charCodeAt(n)===48;n++);for(i=t.length;t.charCodeAt(i-1)===48;--i);if(t=t.slice(n,i),t){if(i-=n,e.e=r=r-n-1,e.d=[],n=(r+1)%vr,r<0&&(n+=vr),ne.constructor.maxE?(e.d=null,e.e=NaN):e.e-1){if(t=t.replace(/(\d)_(?=\d)/g,"$1"),Ise.test(t))return gW(e,t)}else if(t==="Infinity"||t==="NaN")return+t||(e.s=NaN),e.e=NaN,e.d=null,e;if(_8e.test(t))r=16,t=t.toLowerCase();else if(F8e.test(t))r=2;else if(P8e.test(t))r=8;else throw Error(W0+t);for(a=t.search(/p/i),a>0?(l=+t.slice(a+1),t=t.substring(2,a)):t=t.slice(2),a=t.indexOf("."),o=a>=0,n=e.constructor,o&&(t=t.replace(".",""),s=t.length,a=s-a,i=Rse(n,new n(r),a,a*2)),u=yT(t,r,qp),c=u.length-1,a=c;u[a]===0;--a)u.pop();return a<0?new n(e.s*0):(e.e=ET(u,c),e.d=u,Br=!1,o&&(e=Xi(e,i,s*4)),l&&(e=e.times(Math.abs(l)<54?gs(2,l):G6.pow(2,l))),Br=!0,e)}function q8e(e,t){var r,n=t.d.length;if(n<3)return t.isZero()?t:Jw(e,2,t,t);r=1.4*Math.sqrt(n),r=r>16?16:r|0,t=t.times(1/kT(5,r)),t=Jw(e,2,t,t);for(var i,a=new e(5),o=new e(16),s=new e(20);r--;)i=t.times(t),t=t.times(a.plus(i.times(o.times(i).minus(s))));return t}function Jw(e,t,r,n,i){var a,o,s,l,u=1,c=e.precision,f=Math.ceil(c/vr);for(Br=!1,l=r.times(r),s=new e(n);;){if(o=Xi(s.times(l),new e(t++*t++),c,1),s=i?n.plus(o):n.minus(o),n=Xi(o.times(l),new e(t++*t++),c,1),o=s.plus(n),o.d[f]!==void 0){for(a=f;o.d[a]===s.d[a]&&a--;);if(a==-1)break}a=s,s=n,n=o,o=a,u++}return Br=!0,o.d.length=f+1,o}function kT(e,t){for(var r=e;--t;)r*=e;return r}function Lse(e,t){var r,n=t.s<0,i=$p(e,e.precision,1),a=i.times(.5);if(t=t.abs(),t.lte(a))return UA=n?4:1,t;if(r=t.divToInt(i),r.isZero())UA=n?3:2;else{if(t=t.minus(r.times(i)),t.lte(a))return UA=Mse(r)?n?2:3:n?4:1,t;UA=Mse(r)?n?1:4:n?3:2}return t.minus(i).abs()}function vW(e,t,r,n){var i,a,o,s,l,u,c,f,d,p=e.constructor,h=r!==void 0;if(h?(kc(r,1,H0),n===void 0?n=p.rounding:kc(n,0,8)):(r=p.precision,n=p.rounding),!e.isFinite())c=qse(e);else{for(c=Qm(e),o=c.indexOf("."),h?(i=2,t==16?r=r*4-3:t==8&&(r=r*3-2)):i=t,o>=0&&(c=c.replace(".",""),d=new p(1),d.e=c.length-o,d.d=yT(Qm(d),10,i),d.e=d.d.length),f=yT(c,10,i),a=l=f.length;f[--l]==0;)f.pop();if(!f[0])c=h?"0p+0":"0";else{if(o<0?a--:(e=new p(e),e.d=f,e.e=a,e=Xi(e,d,r,n,0,i),f=e.d,a=e.e,u=Tse),o=f[r],s=i/2,u=u||f[r+1]!==void 0,u=n<4?(o!==void 0||u)&&(n===0||n===(e.s<0?3:2)):o>s||o===s&&(n===4||u||n===6&&f[r-1]&1||n===(e.s<0?8:7)),f.length=r,u)for(;++f[--r]>i-1;)f[r]=0,r||(++a,f.unshift(1));for(l=f.length;!f[l-1];--l);for(o=0,c="";o1)if(t==16||t==8){for(o=t==16?4:3,--l;l%o;l++)c+="0";for(f=yT(c,i,t),l=f.length;!f[l-1];--l);for(o=1,c="1.";ol)for(a-=l;a--;)c+="0";else at)return e.length=t,!0}function L8e(e){return new this(e).abs()}function z8e(e){return new this(e).acos()}function U8e(e){return new this(e).acosh()}function W8e(e,t){return new this(e).plus(t)}function H8e(e){return new this(e).asin()}function V8e(e){return new this(e).asinh()}function G8e(e){return new this(e).atan()}function Q8e(e){return new this(e).atanh()}function Y8e(e,t){e=new this(e),t=new this(t);var r,n=this.precision,i=this.rounding,a=n+4;return!e.s||!t.s?r=new this(NaN):!e.d&&!t.d?(r=$p(this,a,1).times(t.s>0?.25:.75),r.s=e.s):!t.d||e.isZero()?(r=t.s<0?$p(this,n,i):new this(0),r.s=e.s):!e.d||t.isZero()?(r=$p(this,a,1).times(.5),r.s=e.s):t.s<0?(this.precision=a,this.rounding=1,r=this.atan(Xi(e,t,a,1)),t=$p(this,a,1),this.precision=n,this.rounding=i,r=e.s<0?r.minus(t):r.plus(t)):r=this.atan(Xi(e,t,a,1)),r}function Z8e(e){return new this(e).cbrt()}function X8e(e){return cr(e=new this(e),e.e+1,2)}function K8e(e,t,r){return new this(e).clamp(t,r)}function J8e(e){if(!e||typeof e!="object")throw Error(ST+"Object expected");var t,r,n,i=e.defaults===!0,a=["precision",1,H0,"rounding",0,8,"toExpNeg",-Kw,0,"toExpPos",0,Kw,"maxE",0,Kw,"minE",-Kw,0,"modulo",0,9];for(t=0;t=a[t+1]&&n<=a[t+2])this[r]=n;else throw Error(W0+r+": "+n);if(r="crypto",i&&(this[r]=mW[r]),(n=e[r])!==void 0)if(n===!0||n===!1||n===0||n===1)if(n)if(typeof crypto<"u"&&crypto&&(crypto.getRandomValues||crypto.randomBytes))this[r]=!0;else throw Error(_se);else this[r]=!1;else throw Error(W0+r+": "+n);return this}function e7e(e){return new this(e).cos()}function t7e(e){return new this(e).cosh()}function zse(e){var t,r,n;function i(a){var o,s,l,u=this;if(!(u instanceof i))return new i(a);if(u.constructor=i,Nse(a)){u.s=a.s,Br?!a.d||a.e>i.maxE?(u.e=NaN,u.d=null):a.e=10;s/=10)o++;Br?o>i.maxE?(u.e=NaN,u.d=null):o=429e7?t[a]=crypto.getRandomValues(new Uint32Array(1))[0]:s[a++]=i%1e7;else if(crypto.randomBytes){for(t=crypto.randomBytes(n*=4);a=214e7?crypto.randomBytes(4).copy(t,a):(s.push(i%1e7),a+=4);a=n/4}else throw Error(_se);else for(;a=10;i/=10)n++;n{var{on:t,config:r}=e,n=wy.clone({precision:r.precision,modulo:wy.EUCLID});return n.prototype=Object.create(n.prototype),n.prototype.type="BigNumber",n.prototype.isBigNumber=!0,n.prototype.toJSON=function(){return{mathjs:"BigNumber",value:this.toString()}},n.fromJSON=function(i){return new n(i.value)},t&&t("config",function(i,a){i.precision!==a.precision&&n.config({precision:i.precision})}),n},{isClass:!0});var Hs=Ae(Wse(),1);var O7e="Complex",M7e=[],DT=V(O7e,M7e,()=>(Object.defineProperty(Hs.default,"name",{value:"Complex"}),Hs.default.prototype.constructor=Hs.default,Hs.default.prototype.type="Complex",Hs.default.prototype.isComplex=!0,Hs.default.prototype.toJSON=function(){return{mathjs:"Complex",re:this.re,im:this.im}},Hs.default.prototype.toPolar=function(){return{r:this.abs(),phi:this.arg()}},Hs.default.prototype.format=function(e){var t="",r=this.im,n=this.re,i=Bp(this.re,e),a=Bp(this.im,e),o=Qt(e)?e:e?e.precision:null;if(o!==null){var s=Math.pow(10,-o);Math.abs(n/r)t.re?1:e.ret.im?1:e.im(Object.defineProperty(Ym.default,"name",{value:"Fraction"}),Ym.default.prototype.constructor=Ym.default,Ym.default.prototype.type="Fraction",Ym.default.prototype.isFraction=!0,Ym.default.prototype.toJSON=function(){return{mathjs:"Fraction",n:this.s*this.n,d:this.d}},Ym.default.fromJSON=function(e){return new Ym.default(e)},Ym.default),{isClass:!0});var T7e="Range",F7e=[],MT=V(T7e,F7e,()=>{function e(t,r,n){if(!(this instanceof e))throw new SyntaxError("Constructor must be called with the new operator");var i=t!=null,a=r!=null,o=n!=null;if(i){if(It(t))t=t.toNumber();else if(typeof t!="number")throw new TypeError("Parameter start must be a number")}if(a){if(It(r))r=r.toNumber();else if(typeof r!="number")throw new TypeError("Parameter end must be a number")}if(o){if(It(n))n=n.toNumber();else if(typeof n!="number")throw new TypeError("Parameter step must be a number")}this.start=i?parseFloat(t):0,this.end=a?parseFloat(r):0,this.step=o?parseFloat(n):1}return e.prototype.type="Range",e.prototype.isRange=!0,e.parse=function(t){if(typeof t!="string")return null;var r=t.split(":"),n=r.map(function(a){return parseFloat(a)}),i=n.some(function(a){return isNaN(a)});if(i)return null;switch(n.length){case 2:return new e(n[0],n[1]);case 3:return new e(n[0],n[2],n[1]);default:return null}},e.prototype.clone=function(){return new e(this.start,this.end,this.step)},e.prototype.size=function(){var t=0,r=this.start,n=this.step,i=this.end,a=i-r;return kd(n)===kd(a)?t=Math.ceil(a/n):a===0&&(t=0),isNaN(t)&&(t=0),[t]},e.prototype.min=function(){var t=this.size()[0];if(t>0)return this.step>0?this.start:this.start+(t-1)*this.step},e.prototype.max=function(){var t=this.size()[0];if(t>0)return this.step>0?this.start+(t-1)*this.step:this.start},e.prototype.forEach=function(t){var r=this.start,n=this.step,i=this.end,a=0;if(n>0)for(;ri;)t(r,[a],this),r+=n,a++},e.prototype.map=function(t){var r=[];return this.forEach(function(n,i,a){r[i[0]]=t(n,i,a)}),r},e.prototype.toArray=function(){var t=[];return this.forEach(function(r,n){t[n[0]]=r}),t},e.prototype.valueOf=function(){return this.toArray()},e.prototype.format=function(t){var r=Bp(this.start,t);return this.step!==1&&(r+=":"+Bp(this.step,t)),r+=":"+Bp(this.end,t),r},e.prototype.toString=function(){return this.format()},e.prototype.toJSON=function(){return{mathjs:"Range",start:this.start,end:this.end,step:this.step}},e.fromJSON=function(t){return new e(t.start,t.end,t.step)},e},{isClass:!0});var _7e="Matrix",P7e=[],jT=V(_7e,P7e,()=>{function e(){if(!(this instanceof e))throw new SyntaxError("Constructor must be called with the new operator")}return e.prototype.type="Matrix",e.prototype.isMatrix=!0,e.prototype.storage=function(){throw new Error("Cannot invoke storage on a Matrix interface")},e.prototype.datatype=function(){throw new Error("Cannot invoke datatype on a Matrix interface")},e.prototype.create=function(t,r){throw new Error("Cannot invoke create on a Matrix interface")},e.prototype.subset=function(t,r,n){throw new Error("Cannot invoke subset on a Matrix interface")},e.prototype.get=function(t){throw new Error("Cannot invoke get on a Matrix interface")},e.prototype.set=function(t,r,n){throw new Error("Cannot invoke set on a Matrix interface")},e.prototype.resize=function(t,r){throw new Error("Cannot invoke resize on a Matrix interface")},e.prototype.reshape=function(t,r){throw new Error("Cannot invoke reshape on a Matrix interface")},e.prototype.clone=function(){throw new Error("Cannot invoke clone on a Matrix interface")},e.prototype.size=function(){throw new Error("Cannot invoke size on a Matrix interface")},e.prototype.map=function(t,r){throw new Error("Cannot invoke map on a Matrix interface")},e.prototype.forEach=function(t){throw new Error("Cannot invoke forEach on a Matrix interface")},e.prototype[Symbol.iterator]=function(){throw new Error("Cannot iterate a Matrix interface")},e.prototype.toArray=function(){throw new Error("Cannot invoke toArray on a Matrix interface")},e.prototype.valueOf=function(){throw new Error("Cannot invoke valueOf on a Matrix interface")},e.prototype.format=function(t){throw new Error("Cannot invoke format on a Matrix interface")},e.prototype.toString=function(){throw new Error("Cannot invoke toString on a Matrix interface")},e},{isClass:!0});function Gse(e){var t=0,r=1,n=Object.create(null),i=Object.create(null),a=0,o=function(l){var u=i[l];if(!!u&&(delete n[u],delete i[l],--t,r===u)){if(!t){a=0,r=1;return}for(;!Object.prototype.hasOwnProperty.call(n,++r););}};return e=Math.abs(e),{hit:function(l){var u=i[l],c=++a;if(n[c]=l,i[l]=c,!u)return++t,t<=e?void 0:(l=n[r],o(l),l);if(delete n[u],r===u)for(;!Object.prototype.hasOwnProperty.call(n,++r););},delete:o,clear:function(){t=a=0,r=1,n=Object.create(null),i=Object.create(null)}}}function Sy(e){var{hasher:t,limit:r}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return r=r??Number.POSITIVE_INFINITY,t=t??JSON.stringify,function n(){typeof n.cache!="object"&&(n.cache={values:new Map,lru:Gse(r||Number.POSITIVE_INFINITY)});for(var i=[],a=0;a{var{Matrix:t}=e;function r(c,f){if(!(this instanceof r))throw new SyntaxError("Constructor must be called with the new operator");if(f&&!da(f))throw new Error("Invalid datatype: "+f);if(St(c))c.type==="DenseMatrix"?(this._data=Bt(c._data),this._size=Bt(c._size),this._datatype=f||c._datatype):(this._data=c.toArray(),this._size=c.size(),this._datatype=f||c._datatype);else if(c&&Ir(c.data)&&Ir(c.size))this._data=c.data,this._size=c.size,nW(this._data,this._size),this._datatype=f||c.datatype;else if(Ir(c))this._data=u(c),this._size=Yt(this._data),nW(this._data,this._size),this._datatype=f;else{if(c)throw new TypeError("Unsupported type of data ("+qr(c)+")");this._data=[],this._size=[0],this._datatype=f}}r.prototype=new t,r.prototype.createDenseMatrix=function(c,f){return new r(c,f)},Object.defineProperty(r,"name",{value:"DenseMatrix"}),r.prototype.constructor=r,r.prototype.type="DenseMatrix",r.prototype.isDenseMatrix=!0,r.prototype.getDataType=function(){return q0(this._data,qr)},r.prototype.storage=function(){return"dense"},r.prototype.datatype=function(){return this._datatype},r.prototype.create=function(c,f){return new r(c,f)},r.prototype.subset=function(c,f,d){switch(arguments.length){case 1:return n(this,c);case 2:case 3:return a(this,c,f,d);default:throw new SyntaxError("Wrong number of arguments")}},r.prototype.get=function(c){if(!Ir(c))throw new TypeError("Array expected");if(c.length!==this._size.length)throw new nr(c.length,this._size.length);for(var f=0;f");var v=f.max().map(function(S){return S+1});l(c,v,p);var x=h.length,w=0;o(c._data,f,d,x,w)}return c}function o(c,f,d,p,h){var m=h===p-1,g=f.dimension(h);m?g.forEach(function(A,b){Vn(A),c[A]=d[b[0]]}):g.forEach(function(A,b){Vn(A),o(c[A],f,d[b[0]],p,h+1)})}r.prototype.resize=function(c,f,d){if(!Da(c))throw new TypeError("Array or Matrix expected");var p=c.valueOf().map(m=>Array.isArray(m)&&m.length===1?m[0]:m),h=d?this.clone():this;return s(h,p,f)};function s(c,f,d){if(f.length===0){for(var p=c._data;Ir(p);)p=p[0];return p}return c._size=f.slice(0),c._data=Rp(c._data,c._size,d),c}r.prototype.reshape=function(c,f){var d=f?this.clone():this;d._data=U6(d._data,c);var p=d._size.reduce((h,m)=>h*m);return d._size=W6(c,p),d};function l(c,f,d){for(var p=c._size.slice(0),h=!1;p.lengthp[m]&&(p[m]=f[m],h=!0);h&&s(c,p,d)}r.prototype.clone=function(){var c=new r({data:Bt(this._data),size:Bt(this._size),datatype:this._datatype});return c},r.prototype.size=function(){return this._size.slice(0)},r.prototype.map=function(c){var f=this,d=NT(c),p=function g(A,b){return Ir(A)?A.map(function(v,x){return g(v,b.concat(x))}):d===1?c(A):d===2?c(A,b):c(A,b,f)},h=p(this._data,[]),m=this._datatype!==void 0?q0(h,qr):void 0;return new r(h,m)},r.prototype.forEach=function(c){var f=this,d=function p(h,m){Ir(h)?h.forEach(function(g,A){p(g,m.concat(A))}):c(h,m,f)};d(this._data,[])},r.prototype[Symbol.iterator]=function*(){var c=function*f(d,p){if(Ir(d))for(var h=0;h[v[A]]);f.push(new r(b,c._datatype))},m=0;m0?c:0,d=c<0?-c:0,p=this._size[0],h=this._size[1],m=Math.min(p-d,h-f),g=[],A=0;A0?d:0,m=d<0?-d:0,g=c[0],A=c[1],b=Math.min(g-m,A-h),v;if(Ir(f)){if(f.length!==b)throw new Error("Invalid value array length");v=function(j){return f[j]}}else if(St(f)){var x=f.size();if(x.length!==1||x[0]!==b)throw new Error("Invalid matrix length");v=function(j){return f.get([j])}}else v=function(){return f};p||(p=It(v(0))?v(0).mul(0):0);var w=[];if(c.length>0){w=Rp(w,c,p);for(var S=0;S{var{typed:t}=e;return t(Qse,{any:Bt})});function _T(e){var t=e.length,r=e[0].length,n,i,a=[];for(i=0;i=n.length)throw new As(t,n.length);return St(e)?e.create(PT(e.valueOf(),t,r)):PT(e,t,r)}function PT(e,t,r){var n,i,a,o;if(t<=0)if(Array.isArray(e[0])){for(o=_T(e),i=[],n=0;n{var{typed:t}=e;return t(Yse,{number:wt,BigNumber:function(n){return n.isInt()},Fraction:function(n){return n.d===1&&isFinite(n.n)},"Array | Matrix":t.referToSelf(r=>n=>jt(n,r))})});var Cc="number",WA="number, number";function wW(e){return Math.abs(e)}wW.signature=Cc;function SW(e,t){return e+t}SW.signature=WA;function EW(e,t){return e-t}EW.signature=WA;function kW(e,t){return e*t}kW.signature=WA;function q7e(e,t){return e/t}q7e.signature=WA;function CW(e){return-e}CW.signature=Cc;function DW(e){return e}DW.signature=Cc;function eS(e){return rse(e)}eS.signature=Cc;function OW(e){return e*e*e}OW.signature=Cc;function MW(e){return Math.exp(e)}MW.signature=Cc;function jW(e){return nse(e)}jW.signature=Cc;function L7e(e,t){if(!wt(e)||!wt(t))throw new Error("Parameters in function gcd must be integer numbers");for(var r;t!==0;)r=e%t,e=t,t=r;return e<0?-e:e}L7e.signature=WA;function NW(e,t){if(!wt(e)||!wt(t))throw new Error("Parameters in function lcm must be integer numbers");if(e===0||t===0)return 0;for(var r,n=e*t;t!==0;)r=t,t=e%r,e=r;return Math.abs(n/e)}NW.signature=WA;function Zse(e,t){return t?Math.log(e)/Math.log(t):Math.log(e)}function TW(e){return tse(e)}TW.signature=Cc;function FW(e){return ese(e)}FW.signature=Cc;function z7e(e){return lT(e)}z7e.signature=Cc;function U7e(e,t){return t===0?e:e-t*Math.floor(e/t)}U7e.signature=WA;function _W(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:2,r=t<0;if(r&&(t=-t),t===0)throw new Error("Root must be non-zero");if(e<0&&Math.abs(t)%2!==1)throw new Error("Root must be odd when a is negative.");if(e===0)return r?1/0:0;if(!isFinite(e))return r?0:e;var n=Math.pow(Math.abs(e),1/t);return n=e<0?-n:n,r?1/n:n}function BT(e){return kd(e)}BT.signature=Cc;function W7e(e){return Math.sqrt(e)}W7e.signature=Cc;function PW(e){return e*e}PW.signature=Cc;function IW(e,t){var r,n,i,a=0,o=1,s=1,l=0;if(!wt(e)||!wt(t))throw new Error("Parameters in function xgcd must be integer numbers");for(;t;)n=Math.floor(e/t),i=e-n*t,r=a,a=o-n*a,o=r,r=s,s=l-n*s,l=r,e=t,t=i;var u;return e<0?u=[-e,-o,-l]:u=[e,e?o:0,l],u}IW.signature=WA;function BW(e,t){return e*e<1&&t===1/0||e*e>1&&t===-1/0?0:Math.pow(e,t)}BW.signature=WA;function tS(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;if(!wt(t)||t<0||t>15)throw new Error("Number of decimals in function round must be an integer from 0 to 15 inclusive");return parseFloat(eW(e,t))}function H7e(e){return Math.abs(e)}H7e.signature=Cc;var V7e="number",rS="number, number";function RW(e,t){if(!wt(e)||!wt(t))throw new Error("Integers expected in function bitAnd");return e&t}RW.signature=rS;function $W(e){if(!wt(e))throw new Error("Integer expected in function bitNot");return~e}$W.signature=V7e;function qW(e,t){if(!wt(e)||!wt(t))throw new Error("Integers expected in function bitOr");return e|t}qW.signature=rS;function LW(e,t){if(!wt(e)||!wt(t))throw new Error("Integers expected in function bitXor");return e^t}LW.signature=rS;function zW(e,t){if(!wt(e)||!wt(t))throw new Error("Integers expected in function leftShift");return e<>t}UW.signature=rS;function WW(e,t){if(!wt(e)||!wt(t))throw new Error("Integers expected in function rightLogShift");return e>>>t}WW.signature=rS;function yf(e,t){if(t>1;return yf(e,r)*yf(r+1,t)}function HW(e,t){if(!wt(e)||e<0)throw new TypeError("Positive integer value expected in function combinations");if(!wt(t)||t<0)throw new TypeError("Positive integer value expected in function combinations");if(t>e)throw new TypeError("k must be less than or equal to n");for(var r=e-t,n=1,i=t171?1/0:yf(1,e-1);if(e<.5)return Math.PI/(Math.sin(Math.PI*e)*Q6(1-e));if(e>=171.35)return 1/0;if(e>85){var r=e*e,n=r*e,i=n*e,a=i*e;return Math.sqrt(2*Math.PI/e)*Math.pow(e/Math.E,e)*(1+1/(12*e)+1/(288*r)-139/(51840*n)-571/(2488320*i)+163879/(209018880*a)+5246819/(75246796800*a*e))}--e,t=Ey[0];for(var o=1;o=1;n--)r+=tle[n]/(e+n);return KW+(e+.5)*Math.log(t)-t+Math.log(r)}Y6.signature="number";var qa="number",Z7e="number, number";function X7e(e){return Math.acos(e)}X7e.signature=qa;function JW(e){return ose(e)}JW.signature=qa;function eH(e){return Math.atan(1/e)}eH.signature=qa;function tH(e){return isFinite(e)?(Math.log((e+1)/e)+Math.log(e/(e-1)))/2:0}tH.signature=qa;function rH(e){return Math.asin(1/e)}rH.signature=qa;function nH(e){var t=1/e;return Math.log(t+Math.sqrt(t*t+1))}nH.signature=qa;function iH(e){return Math.acos(1/e)}iH.signature=qa;function aH(e){var t=1/e,r=Math.sqrt(t*t-1);return Math.log(r+t)}aH.signature=qa;function K7e(e){return Math.asin(e)}K7e.signature=qa;function oH(e){return sse(e)}oH.signature=qa;function J7e(e){return Math.atan(e)}J7e.signature=qa;function eRe(e,t){return Math.atan2(e,t)}eRe.signature=Z7e;function sH(e){return lse(e)}sH.signature=qa;function tRe(e){return Math.cos(e)}tRe.signature=qa;function rRe(e){return cT(e)}rRe.signature=qa;function lH(e){return 1/Math.tan(e)}lH.signature=qa;function uH(e){var t=Math.exp(2*e);return(t+1)/(t-1)}uH.signature=qa;function cH(e){return 1/Math.sin(e)}cH.signature=qa;function fH(e){return e===0?Number.POSITIVE_INFINITY:Math.abs(2/(Math.exp(e)-Math.exp(-e)))*kd(e)}fH.signature=qa;function dH(e){return 1/Math.cos(e)}dH.signature=qa;function pH(e){return 2/(Math.exp(e)+Math.exp(-e))}pH.signature=qa;function nRe(e){return Math.sin(e)}nRe.signature=qa;function mH(e){return use(e)}mH.signature=qa;function iRe(e){return Math.tan(e)}iRe.signature=qa;function aRe(e){return fT(e)}aRe.signature=qa;var Z6="number";function oRe(e){return wt(e)}oRe.signature=Z6;function hH(e){return e<0}hH.signature=Z6;function AH(e){return e>0}AH.signature=Z6;function gH(e){return e===0}gH.signature=Z6;function vH(e){return Number.isNaN(e)}vH.signature=Z6;var rle="isNegative",sRe=["typed"],RT=V(rle,sRe,e=>{var{typed:t}=e;return t(rle,{number:hH,BigNumber:function(n){return n.isNeg()&&!n.isZero()&&!n.isNaN()},Fraction:function(n){return n.s<0},Unit:t.referToSelf(r=>n=>t.find(r,n.valueType())(n.value)),"Array | Matrix":t.referToSelf(r=>n=>jt(n,r))})});var nle="isNumeric",lRe=["typed"],$T=V(nle,lRe,e=>{var{typed:t}=e;return t(nle,{"number | BigNumber | Fraction | boolean":()=>!0,"Complex | Unit | string | null | undefined | Node":()=>!1,"Array | Matrix":t.referToSelf(r=>n=>jt(n,r))})});var ile="hasNumericValue",uRe=["typed","isNumeric"],qT=V(ile,uRe,e=>{var{typed:t,isNumeric:r}=e;return t(ile,{boolean:()=>!0,string:function(i){return i.trim().length>0&&!isNaN(Number(i))},any:function(i){return r(i)}})});var ale="isPositive",cRe=["typed"],LT=V(ale,cRe,e=>{var{typed:t}=e;return t(ale,{number:AH,BigNumber:function(n){return!n.isNeg()&&!n.isZero()&&!n.isNaN()},Fraction:function(n){return n.s>0&&n.n>0},Unit:t.referToSelf(r=>n=>t.find(r,n.valueType())(n.value)),"Array | Matrix":t.referToSelf(r=>n=>jt(n,r))})});var ole="isZero",fRe=["typed"],zT=V(ole,fRe,e=>{var{typed:t}=e;return t(ole,{number:gH,BigNumber:function(n){return n.isZero()},Complex:function(n){return n.re===0&&n.im===0},Fraction:function(n){return n.d===1&&n.n===0},Unit:t.referToSelf(r=>n=>t.find(r,n.valueType())(n.value)),"Array | Matrix":t.referToSelf(r=>n=>jt(n,r))})});var sle="isNaN",dRe=["typed"],UT=V(sle,dRe,e=>{var{typed:t}=e;return t(sle,{number:vH,BigNumber:function(n){return n.isNaN()},Fraction:function(n){return!1},Complex:function(n){return n.isNaN()},Unit:function(n){return Number.isNaN(n.value)},"Array | Matrix":function(n){return jt(n,Number.isNaN)}})});var lle="typeOf",pRe=["typed"],WT=V(lle,pRe,e=>{var{typed:t}=e;return t(lle,{any:qr})});function _o(e,t,r){if(r==null)return e.eq(t);if(e.eq(t))return!0;if(e.isNaN()||t.isNaN())return!1;if(e.isFinite()&&t.isFinite()){var n=e.minus(t).abs();if(n.isZero())return!0;var i=e.constructor.max(e.abs(),t.abs());return n.lte(i.times(r))}return!1}function ule(e,t,r){return Oa(e.re,t.re,r)&&Oa(e.im,t.im,r)}var Dd=V("compareUnits",["typed"],e=>{var{typed:t}=e;return{"Unit, Unit":t.referToSelf(r=>(n,i)=>{if(!n.equalBase(i))throw new Error("Cannot compare units with different base");return t.find(r,[n.valueType(),i.valueType()])(n.value,i.value)})}});var HT="equalScalar",mRe=["typed","config"],VT=V(HT,mRe,e=>{var{typed:t,config:r}=e,n=Dd({typed:t});return t(HT,{"boolean, boolean":function(a,o){return a===o},"number, number":function(a,o){return Oa(a,o,r.epsilon)},"BigNumber, BigNumber":function(a,o){return a.eq(o)||_o(a,o,r.epsilon)},"Fraction, Fraction":function(a,o){return a.equals(o)},"Complex, Complex":function(a,o){return ule(a,o,r.epsilon)}},n)}),$gt=V(HT,["typed","config"],e=>{var{typed:t,config:r}=e;return t(HT,{"number, number":function(i,a){return Oa(i,a,r.epsilon)}})});var hRe="SparseMatrix",ARe=["typed","equalScalar","Matrix"],GT=V(hRe,ARe,e=>{var{typed:t,equalScalar:r,Matrix:n}=e;function i(m,g){if(!(this instanceof i))throw new SyntaxError("Constructor must be called with the new operator");if(g&&!da(g))throw new Error("Invalid datatype: "+g);if(St(m))a(this,m,g);else if(m&&Ir(m.index)&&Ir(m.ptr)&&Ir(m.size))this._values=m.values,this._index=m.index,this._ptr=m.ptr,this._size=m.size,this._datatype=g||m.datatype;else if(Ir(m))o(this,m,g);else{if(m)throw new TypeError("Unsupported type of data ("+qr(m)+")");this._values=[],this._index=[],this._ptr=[0],this._size=[0,0],this._datatype=g}}function a(m,g,A){g.type==="SparseMatrix"?(m._values=g._values?Bt(g._values):void 0,m._index=Bt(g._index),m._ptr=Bt(g._ptr),m._size=Bt(g._size),m._datatype=A||g._datatype):o(m,g.valueOf(),A||g._datatype)}function o(m,g,A){m._values=[],m._index=[],m._ptr=[],m._datatype=A;var b=g.length,v=0,x=r,w=0;if(da(A)&&(x=t.find(r,[A,A])||r,w=t.convert(0,A)),b>0){var S=0;do{m._ptr.push(m._index.length);for(var k=0;k");if(v.length===1){var j=g.dimension(0);j.forEach(function(N,D){Vn(N),m.set([N,0],A[D[0]],b)})}else{var O=g.dimension(0),C=g.dimension(1);O.forEach(function(N,D){Vn(N),C.forEach(function(P,q){Vn(P),m.set([N,P],A[D[0]][q[0]],b)})})}}return m}i.prototype.get=function(m){if(!Ir(m))throw new TypeError("Array expected");if(m.length!==this._size.length)throw new nr(m.length,this._size.length);if(!this._values)throw new Error("Cannot invoke get on a Pattern only matrix");var g=m[0],A=m[1];Vn(g,this._size[0]),Vn(A,this._size[1]);var b=u(g,this._ptr[A],this._ptr[A+1],this._index);return bx-1||v>w-1)&&(d(this,Math.max(b+1,x),Math.max(v+1,w),A),x=this._size[0],w=this._size[1]),Vn(b,x),Vn(v,w);var j=u(b,this._ptr[v],this._ptr[v+1],this._index);return jArray.isArray(x)&&x.length===1?x[0]:x);if(b.length!==2)throw new Error("Only two dimensions matrix are supported");b.forEach(function(x){if(!Qt(x)||!wt(x)||x<0)throw new TypeError("Invalid size, must contain positive integers (size: "+tr(b)+")")});var v=A?this.clone():this;return d(v,b[0],b[1],g)};function d(m,g,A,b){var v=b||0,x=r,w=0;da(m._datatype)&&(x=t.find(r,[m._datatype,m._datatype])||r,w=t.convert(0,m._datatype),v=t.convert(v,m._datatype));var S=!x(v,w),k=m._size[0],j=m._size[1],O,C,N;if(A>j){for(C=j;Ck){if(S){var D=0;for(C=0;Cg-1&&(m._values.splice(N,1),m._index.splice(N,1),q++)}m._ptr[C]=m._values.length}return m._size[0]=g,m._size[1]=A,m}i.prototype.reshape=function(m,g){if(!Ir(m))throw new TypeError("Array expected");if(m.length!==2)throw new Error("Sparse matrices can only be reshaped in two dimensions");m.forEach(function(_){if(!Qt(_)||!wt(_)||_<=-2||_===0)throw new TypeError("Invalid size, must contain positive integers or -1 (size: "+tr(m)+")")});var A=this._size[0]*this._size[1];m=W6(m,A);var b=m[0]*m[1];if(A!==b)throw new Error("Reshaping sparse matrix will result in the wrong number of elements");var v=g?this.clone():this;if(this._size[0]===m[0]&&this._size[1]===m[1])return v;for(var x=[],w=0;w=g&&I<=A&&N(m._values[z],I-g,D-b)}else{for(var T={},L=P;L "+(this._values?tr(this._values[k],m):"X")}return v},i.prototype.toString=function(){return tr(this.toArray())},i.prototype.toJSON=function(){return{mathjs:"SparseMatrix",values:this._values,index:this._index,ptr:this._ptr,size:this._size,datatype:this._datatype}},i.prototype.diagonal=function(m){if(m){if(It(m)&&(m=m.toNumber()),!Qt(m)||!wt(m))throw new TypeError("The parameter k must be an integer number")}else m=0;var g=m>0?m:0,A=m<0?-m:0,b=this._size[0],v=this._size[1],x=Math.min(b-A,v-g),w=[],S=[],k=[];k[0]=0;for(var j=g;j0?A:0,k=A<0?-A:0,j=m[0],O=m[1],C=Math.min(j-k,O-S),N;if(Ir(g)){if(g.length!==C)throw new Error("Invalid value array length");N=function(Y){return g[Y]}}else if(St(g)){var D=g.size();if(D.length!==1||D[0]!==C)throw new Error("Invalid matrix length");N=function(Y){return g.get([Y])}}else N=function(){return g};for(var P=[],q=[],z=[],I=0;I=0&&T=k||v[O]!==g)){var N=b?b[j]:void 0;v.splice(O,0,g),b&&b.splice(O,0,N),v.splice(O<=j?j+1:j,1),b&&b.splice(O<=j?j+1:j,1);continue}if(O=k||v[j]!==m)){var D=b?b[O]:void 0;v.splice(j,0,m),b&&b.splice(j,0,D),v.splice(j<=O?O+1:O,1),b&&b.splice(j<=O?O+1:O,1)}}},i},{isClass:!0});var gRe="number",vRe=["typed"];function yRe(e){var t=e.match(/(0[box])([0-9a-fA-F]*)\.([0-9a-fA-F]*)/);if(t){var r={"0b":2,"0o":8,"0x":16}[t[1]],n=t[2],i=t[3];return{input:e,radix:r,integerPart:n,fractionalPart:i}}else return null}function bRe(e){for(var t=parseInt(e.integerPart,e.radix),r=0,n=0;n{var{typed:t}=e,r=t("number",{"":function(){return 0},number:function(i){return i},string:function(i){if(i==="NaN")return NaN;var a=yRe(i);if(a)return bRe(a);var o=0,s=i.match(/(0[box][0-9a-fA-F]*)i([0-9]*)/);s&&(o=Number(s[2]),i=s[1]);var l=Number(i);if(isNaN(l))throw new SyntaxError('String "'+i+'" is not a valid number');if(s){if(l>2**o-1)throw new SyntaxError('String "'.concat(i,'" is out of range'));l>=2**(o-1)&&(l=l-2**o)}return l},BigNumber:function(i){return i.toNumber()},Fraction:function(i){return i.valueOf()},Unit:t.referToSelf(n=>i=>{var a=i.clone();return a.value=n(i.value),a}),null:function(i){return 0},"Unit, string | Unit":function(i,a){return i.toNumber(a)},"Array | Matrix":t.referToSelf(n=>i=>jt(i,n))});return r.fromJSON=function(n){return parseFloat(n.value)},r});var cle="string",xRe=["typed"],YT=V(cle,xRe,e=>{var{typed:t}=e;return t(cle,{"":function(){return""},number:Ip,null:function(n){return"null"},boolean:function(n){return n+""},string:function(n){return n},"Array | Matrix":t.referToSelf(r=>n=>jt(n,r)),any:function(n){return String(n)}})});var fle="boolean",wRe=["typed"],ZT=V(fle,wRe,e=>{var{typed:t}=e;return t(fle,{"":function(){return!1},boolean:function(n){return n},number:function(n){return!!n},null:function(n){return!1},BigNumber:function(n){return!n.isZero()},string:function(n){var i=n.toLowerCase();if(i==="true")return!0;if(i==="false")return!1;var a=Number(n);if(n!==""&&!isNaN(a))return!!a;throw new Error('Cannot convert "'+n+'" to a boolean')},"Array | Matrix":t.referToSelf(r=>n=>jt(n,r))})});var SRe="bignumber",ERe=["typed","BigNumber"],XT=V(SRe,ERe,e=>{var{typed:t,BigNumber:r}=e;return t("bignumber",{"":function(){return new r(0)},number:function(i){return new r(i+"")},string:function(i){var a=i.match(/(0[box][0-9a-fA-F]*)i([0-9]*)/);if(a){var o=a[2],s=r(a[1]),l=new r(2).pow(Number(o));if(s.gt(l.sub(1)))throw new SyntaxError('String "'.concat(i,'" is out of range'));var u=new r(2).pow(Number(o)-1);return s.gte(u)?s.sub(l):s}return new r(i)},BigNumber:function(i){return i},Unit:t.referToSelf(n=>i=>{var a=i.clone();return a.value=n(i.value),a}),Fraction:function(i){return new r(i.n).div(i.d).times(i.s)},null:function(i){return new r(0)},"Array | Matrix":t.referToSelf(n=>i=>jt(i,n))})});var kRe="complex",CRe=["typed","Complex"],KT=V(kRe,CRe,e=>{var{typed:t,Complex:r}=e;return t("complex",{"":function(){return r.ZERO},number:function(i){return new r(i,0)},"number, number":function(i,a){return new r(i,a)},"BigNumber, BigNumber":function(i,a){return new r(i.toNumber(),a.toNumber())},Fraction:function(i){return new r(i.valueOf(),0)},Complex:function(i){return i.clone()},string:function(i){return r(i)},null:function(i){return r(0)},Object:function(i){if("re"in i&&"im"in i)return new r(i.re,i.im);if("r"in i&&"phi"in i||"abs"in i&&"arg"in i)return new r(i);throw new Error("Expected object with properties (re and im) or (r and phi) or (abs and arg)")},"Array | Matrix":t.referToSelf(n=>i=>jt(i,n))})});var DRe="fraction",ORe=["typed","Fraction"],JT=V(DRe,ORe,e=>{var{typed:t,Fraction:r}=e;return t("fraction",{number:function(i){if(!isFinite(i)||isNaN(i))throw new Error(i+" cannot be represented as a fraction");return new r(i)},string:function(i){return new r(i)},"number, number":function(i,a){return new r(i,a)},null:function(i){return new r(0)},BigNumber:function(i){return new r(i.toString())},Fraction:function(i){return i},Unit:t.referToSelf(n=>i=>{var a=i.clone();return a.value=n(i.value),a}),Object:function(i){return new r(i)},"Array | Matrix":t.referToSelf(n=>i=>jt(i,n))})});var dle="matrix",MRe=["typed","Matrix","DenseMatrix","SparseMatrix"],eF=V(dle,MRe,e=>{var{typed:t,Matrix:r,DenseMatrix:n,SparseMatrix:i}=e;return t(dle,{"":function(){return a([])},string:function(s){return a([],s)},"string, string":function(s,l){return a([],s,l)},Array:function(s){return a(s)},Matrix:function(s){return a(s,s.storage())},"Array | Matrix, string":a,"Array | Matrix, string, string":a});function a(o,s,l){if(s==="dense"||s==="default"||s===void 0)return new n(o,l);if(s==="sparse")return new i(o,l);throw new TypeError("Unknown matrix type "+JSON.stringify(s)+".")}});var ple="matrixFromFunction",jRe=["typed","matrix","isZero"],tF=V(ple,jRe,e=>{var{typed:t,matrix:r,isZero:n}=e;return t(ple,{"Array | Matrix, function, string, string":function(o,s,l,u){return i(o,s,l,u)},"Array | Matrix, function, string":function(o,s,l){return i(o,s,l)},"Matrix, function":function(o,s){return i(o,s,"dense")},"Array, function":function(o,s){return i(o,s,"dense").toArray()},"Array | Matrix, string, function":function(o,s,l){return i(o,l,s)},"Array | Matrix, string, string, function":function(o,s,l,u){return i(o,u,s,l)}});function i(a,o,s,l){var u;return l!==void 0?u=r(s,l):u=r(s),u.resize(a),u.forEach(function(c,f){var d=o(f);n(d)||u.set(f,d)}),u}});var mle="matrixFromRows",NRe=["typed","matrix","flatten","size"],rF=V(mle,NRe,e=>{var{typed:t,matrix:r,flatten:n,size:i}=e;return t(mle,{"...Array":function(l){return a(l)},"...Matrix":function(l){return r(a(l.map(u=>u.toArray())))}});function a(s){if(s.length===0)throw new TypeError("At least one row is needed to construct a matrix.");var l=o(s[0]),u=[];for(var c of s){var f=o(c);if(f!==l)throw new TypeError("The vectors had different length: "+(l|0)+" \u2260 "+(f|0));u.push(n(c))}return u}function o(s){var l=i(s);if(l.length===1)return l[0];if(l.length===2){if(l[0]===1)return l[1];if(l[1]===1)return l[0];throw new TypeError("At least one of the arguments is not a vector.")}else throw new TypeError("Only one- or two-dimensional vectors are supported.")}});var hle="matrixFromColumns",TRe=["typed","matrix","flatten","size"],nF=V(hle,TRe,e=>{var{typed:t,matrix:r,flatten:n,size:i}=e;return t(hle,{"...Array":function(l){return a(l)},"...Matrix":function(l){return r(a(l.map(u=>u.toArray())))}});function a(s){if(s.length===0)throw new TypeError("At least one column is needed to construct a matrix.");for(var l=o(s[0]),u=[],c=0;c{var{typed:t}=e;return t(Ale,{"Unit, Array":function(n,i){return n.splitUnit(i)}})});var gle="unaryMinus",_Re=["typed"],aF=V(gle,_Re,e=>{var{typed:t}=e;return t(gle,{number:CW,"Complex | BigNumber | Fraction":r=>r.neg(),Unit:t.referToSelf(r=>n=>{var i=n.clone();return i.value=t.find(r,i.valueType())(n.value),i}),"Array | Matrix":t.referToSelf(r=>n=>jt(n,r,!0))})});var vle="unaryPlus",PRe=["typed","config","BigNumber"],oF=V(vle,PRe,e=>{var{typed:t,config:r,BigNumber:n}=e;return t(vle,{number:DW,Complex:function(a){return a},BigNumber:function(a){return a},Fraction:function(a){return a},Unit:function(a){return a.clone()},"Array | Matrix":t.referToSelf(i=>a=>jt(a,i,!0)),"boolean | string":function(a){return r.number==="BigNumber"?new n(+a):+a}})});var yle="abs",IRe=["typed"],sF=V(yle,IRe,e=>{var{typed:t}=e;return t(yle,{number:wW,"Complex | BigNumber | Fraction | Unit":r=>r.abs(),"Array | Matrix":t.referToSelf(r=>n=>jt(n,r,!0))})});var ble="apply",BRe=["typed","isInteger"],G0=V(ble,BRe,e=>{var{typed:t,isInteger:r}=e;return t(ble,{"Array | Matrix, number | BigNumber, function":function(i,a,o){if(!r(a))throw new TypeError("Integer number expected for dimension");var s=Array.isArray(i)?Yt(i):i.size();if(a<0||a>=s.length)throw new As(a,s.length);return St(i)?i.create(lF(i.valueOf(),a,o)):lF(i,a,o)}})});function lF(e,t,r){var n,i,a;if(t<=0)if(Array.isArray(e[0])){for(a=RRe(e),i=[],n=0;n{var{typed:t}=e;return t(xle,{"number, number":SW,"Complex, Complex":function(n,i){return n.add(i)},"BigNumber, BigNumber":function(n,i){return n.plus(i)},"Fraction, Fraction":function(n,i){return n.add(i)},"Unit, Unit":t.referToSelf(r=>(n,i)=>{if(n.value===null||n.value===void 0)throw new Error("Parameter x contains a unit with undefined value");if(i.value===null||i.value===void 0)throw new Error("Parameter y contains a unit with undefined value");if(!n.equalBase(i))throw new Error("Units do not match");var a=n.clone();return a.value=t.find(r,[a.valueType(),i.valueType()])(a.value,i.value),a.fixPrefix=!1,a})})});var wle="subtractScalar",qRe=["typed"],cF=V(wle,qRe,e=>{var{typed:t}=e;return t(wle,{"number, number":EW,"Complex, Complex":function(n,i){return n.sub(i)},"BigNumber, BigNumber":function(n,i){return n.minus(i)},"Fraction, Fraction":function(n,i){return n.sub(i)},"Unit, Unit":t.referToSelf(r=>(n,i)=>{if(n.value===null||n.value===void 0)throw new Error("Parameter x contains a unit with undefined value");if(i.value===null||i.value===void 0)throw new Error("Parameter y contains a unit with undefined value");if(!n.equalBase(i))throw new Error("Units do not match");var a=n.clone();return a.value=t.find(r,[a.valueType(),i.valueType()])(a.value,i.value),a.fixPrefix=!1,a})})});var Sle="cbrt",LRe=["config","typed","isNegative","unaryMinus","matrix","Complex","BigNumber","Fraction"],fF=V(Sle,LRe,e=>{var{config:t,typed:r,isNegative:n,unaryMinus:i,matrix:a,Complex:o,BigNumber:s,Fraction:l}=e;return r(Sle,{number:eS,Complex:u,"Complex, boolean":u,BigNumber:function(d){return d.cbrt()},Unit:c});function u(f,d){var p=f.arg()/3,h=f.abs(),m=new o(eS(h),0).mul(new o(0,p).exp());if(d){var g=[m,new o(eS(h),0).mul(new o(0,p+Math.PI*2/3).exp()),new o(eS(h),0).mul(new o(0,p-Math.PI*2/3).exp())];return t.matrix==="Array"?g:a(g)}else return m}function c(f){if(f.value&&ds(f.value)){var d=f.clone();return d.value=1,d=d.pow(1/3),d.value=u(f.value),d}else{var p=n(f.value);p&&(f.value=i(f.value));var h;It(f.value)?h=new s(1).div(3):gf(f.value)?h=new l(1,3):h=1/3;var m=f.pow(h);return p&&(m.value=i(m.value)),m}}});var zRe="matAlgo11xS0s",URe=["typed","equalScalar"],Gn=V(zRe,URe,e=>{var{typed:t,equalScalar:r}=e;return function(i,a,o,s){var l=i._values,u=i._index,c=i._ptr,f=i._size,d=i._datatype;if(!l)throw new Error("Cannot perform operation on Pattern Sparse Matrix and Scalar value");var p=f[0],h=f[1],m,g=r,A=0,b=o;typeof d=="string"&&(m=d,g=t.find(r,[m,m]),A=t.convert(0,m),a=t.convert(a,m),b=t.find(o,[m,m]));for(var v=[],x=[],w=[],S=0;S{var{typed:t,DenseMatrix:r}=e;return function(i,a,o,s){var l=i._values,u=i._index,c=i._ptr,f=i._size,d=i._datatype;if(!l)throw new Error("Cannot perform operation on Pattern Sparse Matrix and Scalar value");var p=f[0],h=f[1],m,g=o;typeof d=="string"&&(m=d,a=t.convert(a,m),g=t.find(o,[m,m]));for(var A=[],b=[],v=[],x=0;x{var{typed:t}=e;return function(i,a,o,s){var l=i._data,u=i._size,c=i._datatype,f,d=o;typeof c=="string"&&(f=c,a=t.convert(a,f),d=t.find(o,[f,f]));var p=u.length>0?r(d,0,u,u[0],l,a,s):[];return i.createDenseMatrix({data:p,size:Bt(u),datatype:f})};function r(n,i,a,o,s,l,u){var c=[];if(i===a.length-1)for(var f=0;f{var{typed:t,config:r,round:n}=e;return t(yH,{number:function(a){return Oa(a,n(a),r.epsilon)?n(a):Math.ceil(a)},"number, number":function(a,o){if(Oa(a,n(a,o),r.epsilon))return n(a,o);var[s,l]="".concat(a,"e").split("e"),u=Math.ceil(Number("".concat(s,"e").concat(Number(l)+o)));return[s,l]="".concat(u,"e").split("e"),Number("".concat(s,"e").concat(Number(l)-o))}})}),dF=V(yH,QRe,e=>{var{typed:t,config:r,round:n,matrix:i,equalScalar:a,zeros:o,DenseMatrix:s}=e,l=Gn({typed:t,equalScalar:a}),u=An({typed:t,DenseMatrix:s}),c=vo({typed:t}),f=YRe({typed:t,config:r,round:n});return t("ceil",{number:f.signatures.number,"number,number":f.signatures["number,number"],Complex:function(p){return p.ceil()},"Complex, number":function(p,h){return p.ceil(h)},"Complex, BigNumber":function(p,h){return p.ceil(h.toNumber())},BigNumber:function(p){return _o(p,n(p),r.epsilon)?n(p):p.ceil()},"BigNumber, BigNumber":function(p,h){return _o(p,n(p,h),r.epsilon)?n(p,h):p.toDecimalPlaces(h.toNumber(),wy.ROUND_CEIL)},Fraction:function(p){return p.ceil()},"Fraction, number":function(p,h){return p.ceil(h)},"Fraction, BigNumber":function(p,h){return p.ceil(h.toNumber())},"Array | Matrix":t.referToSelf(d=>p=>jt(p,d,!0)),"Array, number | BigNumber":t.referToSelf(d=>(p,h)=>jt(p,m=>d(m,h),!0)),"SparseMatrix, number | BigNumber":t.referToSelf(d=>(p,h)=>l(p,h,d,!1)),"DenseMatrix, number | BigNumber":t.referToSelf(d=>(p,h)=>c(p,h,d,!1)),"number | Complex | Fraction | BigNumber, Array":t.referToSelf(d=>(p,h)=>c(i(h),p,d,!0).valueOf()),"number | Complex | Fraction | BigNumber, Matrix":t.referToSelf(d=>(p,h)=>a(p,0)?o(h.size(),h.storage()):h.storage()==="dense"?c(h,p,d,!0):u(h,p,d,!0))})});var Ele="cube",ZRe=["typed"],pF=V(Ele,ZRe,e=>{var{typed:t}=e;return t(Ele,{number:OW,Complex:function(n){return n.mul(n).mul(n)},BigNumber:function(n){return n.times(n).times(n)},Fraction:function(n){return n.pow(3)},Unit:function(n){return n.pow(3)}})});var kle="exp",XRe=["typed"],mF=V(kle,XRe,e=>{var{typed:t}=e;return t(kle,{number:MW,Complex:function(n){return n.exp()},BigNumber:function(n){return n.exp()}})});var Cle="expm1",KRe=["typed","Complex"],hF=V(Cle,KRe,e=>{var{typed:t,Complex:r}=e;return t(Cle,{number:jW,Complex:function(i){var a=Math.exp(i.re);return new r(a*Math.cos(i.im)-1,a*Math.sin(i.im))},BigNumber:function(i){return i.exp().minus(1)}})});var bH="fix",JRe=["typed","Complex","matrix","ceil","floor","equalScalar","zeros","DenseMatrix"],e$e=V(bH,["typed","ceil","floor"],e=>{var{typed:t,ceil:r,floor:n}=e;return t(bH,{number:function(a){return a>0?n(a):r(a)},"number, number":function(a,o){return a>0?n(a,o):r(a,o)}})}),AF=V(bH,JRe,e=>{var{typed:t,Complex:r,matrix:n,ceil:i,floor:a,equalScalar:o,zeros:s,DenseMatrix:l}=e,u=An({typed:t,DenseMatrix:l}),c=vo({typed:t}),f=e$e({typed:t,ceil:i,floor:a});return t("fix",{number:f.signatures.number,"number, number | BigNumber":f.signatures["number,number"],Complex:function(p){return new r(p.re>0?Math.floor(p.re):Math.ceil(p.re),p.im>0?Math.floor(p.im):Math.ceil(p.im))},"Complex, number":function(p,h){return new r(p.re>0?a(p.re,h):i(p.re,h),p.im>0?a(p.im,h):i(p.im,h))},"Complex, BigNumber":function(p,h){var m=h.toNumber();return new r(p.re>0?a(p.re,m):i(p.re,m),p.im>0?a(p.im,m):i(p.im,m))},BigNumber:function(p){return p.isNegative()?i(p):a(p)},"BigNumber, number | BigNumber":function(p,h){return p.isNegative()?i(p,h):a(p,h)},Fraction:function(p){return p.s<0?p.ceil():p.floor()},"Fraction, number | BigNumber":function(p,h){return p.s<0?i(p,h):a(p,h)},"Array | Matrix":t.referToSelf(d=>p=>jt(p,d,!0)),"Array | Matrix, number | BigNumber":t.referToSelf(d=>(p,h)=>jt(p,m=>d(m,h),!0)),"number | Complex | Fraction | BigNumber, Array":t.referToSelf(d=>(p,h)=>c(n(h),p,d,!0).valueOf()),"number | Complex | Fraction | BigNumber, Matrix":t.referToSelf(d=>(p,h)=>o(p,0)?s(h.size(),h.storage()):h.storage()==="dense"?c(h,p,d,!0):u(h,p,d,!0))})});var xH="floor",t$e=["typed","config","round","matrix","equalScalar","zeros","DenseMatrix"],r$e=V(xH,["typed","config","round"],e=>{var{typed:t,config:r,round:n}=e;return t(xH,{number:function(a){return Oa(a,n(a),r.epsilon)?n(a):Math.floor(a)},"number, number":function(a,o){if(Oa(a,n(a,o),r.epsilon))return n(a,o);var[s,l]="".concat(a,"e").split("e"),u=Math.floor(Number("".concat(s,"e").concat(Number(l)+o)));return[s,l]="".concat(u,"e").split("e"),Number("".concat(s,"e").concat(Number(l)-o))}})}),nS=V(xH,t$e,e=>{var{typed:t,config:r,round:n,matrix:i,equalScalar:a,zeros:o,DenseMatrix:s}=e,l=Gn({typed:t,equalScalar:a}),u=An({typed:t,DenseMatrix:s}),c=vo({typed:t}),f=r$e({typed:t,config:r,round:n});return t("floor",{number:f.signatures.number,"number,number":f.signatures["number,number"],Complex:function(p){return p.floor()},"Complex, number":function(p,h){return p.floor(h)},"Complex, BigNumber":function(p,h){return p.floor(h.toNumber())},BigNumber:function(p){return _o(p,n(p),r.epsilon)?n(p):p.floor()},"BigNumber, BigNumber":function(p,h){return _o(p,n(p,h),r.epsilon)?n(p,h):p.toDecimalPlaces(h.toNumber(),wy.ROUND_FLOOR)},Fraction:function(p){return p.floor()},"Fraction, number":function(p,h){return p.floor(h)},"Fraction, BigNumber":function(p,h){return p.floor(h.toNumber())},"Array | Matrix":t.referToSelf(d=>p=>jt(p,d,!0)),"Array, number | BigNumber":t.referToSelf(d=>(p,h)=>jt(p,m=>d(m,h),!0)),"SparseMatrix, number | BigNumber":t.referToSelf(d=>(p,h)=>l(p,h,d,!1)),"DenseMatrix, number | BigNumber":t.referToSelf(d=>(p,h)=>c(p,h,d,!1)),"number | Complex | Fraction | BigNumber, Array":t.referToSelf(d=>(p,h)=>c(i(h),p,d,!0).valueOf()),"number | Complex | Fraction | BigNumber, Matrix":t.referToSelf(d=>(p,h)=>a(p,0)?o(h.size(),h.storage()):h.storage()==="dense"?c(h,p,d,!0):u(h,p,d,!0))})});var n$e="matAlgo02xDS0",i$e=["typed","equalScalar"],yo=V(n$e,i$e,e=>{var{typed:t,equalScalar:r}=e;return function(i,a,o,s){var l=i._data,u=i._size,c=i._datatype||i.getDataType(),f=a._values,d=a._index,p=a._ptr,h=a._size,m=a._datatype||a._data===void 0?a._datatype:a.getDataType();if(u.length!==h.length)throw new nr(u.length,h.length);if(u[0]!==h[0]||u[1]!==h[1])throw new RangeError("Dimension mismatch. Matrix A ("+u+") must match Matrix B ("+h+")");if(!f)throw new Error("Cannot perform operation on Dense Matrix and Pattern Sparse Matrix");var g=u[0],A=u[1],b,v=r,x=0,w=o;typeof c=="string"&&c===m&&c!=="mixed"&&(b=c,v=t.find(r,[b,b]),x=t.convert(0,b),w=t.find(o,[b,b]));for(var S=[],k=[],j=[],O=0;O{var{typed:t}=e;return function(n,i,a,o){var s=n._data,l=n._size,u=n._datatype||n.getDataType(),c=i._values,f=i._index,d=i._ptr,p=i._size,h=i._datatype||i._data===void 0?i._datatype:i.getDataType();if(l.length!==p.length)throw new nr(l.length,p.length);if(l[0]!==p[0]||l[1]!==p[1])throw new RangeError("Dimension mismatch. Matrix A ("+l+") must match Matrix B ("+p+")");if(!c)throw new Error("Cannot perform operation on Dense Matrix and Pattern Sparse Matrix");var m=l[0],g=l[1],A,b=0,v=a;typeof u=="string"&&u===h&&u!=="mixed"&&(A=u,b=t.convert(0,A),v=t.find(a,[A,A]));for(var x=[],w=0;w{var{typed:t,equalScalar:r}=e;return function(i,a,o){var s=i._values,l=i._index,u=i._ptr,c=i._size,f=i._datatype||i._data===void 0?i._datatype:i.getDataType(),d=a._values,p=a._index,h=a._ptr,m=a._size,g=a._datatype||a._data===void 0?a._datatype:a.getDataType();if(c.length!==m.length)throw new nr(c.length,m.length);if(c[0]!==m[0]||c[1]!==m[1])throw new RangeError("Dimension mismatch. Matrix A ("+c+") must match Matrix B ("+m+")");var A=c[0],b=c[1],v,x=r,w=0,S=o;typeof f=="string"&&f===g&&f!=="mixed"&&(v=f,x=t.find(r,[v,v]),w=t.convert(0,v),S=t.find(o,[v,v]));var k=s&&d?[]:void 0,j=[],O=[],C=k?[]:void 0,N=k?[]:void 0,D=[],P=[],q,z,I,T;for(z=0;z{var{typed:t}=e;return function(i,a,o){var s=i._data,l=i._size,u=i._datatype,c=a._data,f=a._size,d=a._datatype,p=[];if(l.length!==f.length)throw new nr(l.length,f.length);for(var h=0;h0?r(g,0,p,p[0],s,c):[];return i.createDenseMatrix({data:A,size:p,datatype:m})};function r(n,i,a,o,s,l){var u=[];if(i===a.length-1)for(var c=0;c{var{concat:t}=e;return function(i,a){var o=Math.max(i._size.length,a._size.length);if(i._size.length===a._size.length&&i._size.every((h,m)=>h===a._size[m]))return[i,a];for(var s=r(i._size,o,0),l=r(a._size,o,0),u=[],c=0;c{var{typed:t,matrix:r,concat:n}=e,i=Dle({typed:t}),a=vo({typed:t}),o=Ole({concat:n});return function(l){var u=l.elop,c=l.SD||l.DS,f;u?(f={"DenseMatrix, DenseMatrix":(m,g)=>i(...o(m,g),u),"Array, Array":(m,g)=>i(...o(r(m),r(g)),u).valueOf(),"Array, DenseMatrix":(m,g)=>i(...o(r(m),g),u),"DenseMatrix, Array":(m,g)=>i(...o(m,r(g)),u)},l.SS&&(f["SparseMatrix, SparseMatrix"]=(m,g)=>l.SS(...o(m,g),u,!1)),l.DS&&(f["DenseMatrix, SparseMatrix"]=(m,g)=>l.DS(...o(m,g),u,!1),f["Array, SparseMatrix"]=(m,g)=>l.DS(...o(r(m),g),u,!1)),c&&(f["SparseMatrix, DenseMatrix"]=(m,g)=>c(...o(g,m),u,!0),f["SparseMatrix, Array"]=(m,g)=>c(...o(r(g),m),u,!0))):(f={"DenseMatrix, DenseMatrix":t.referToSelf(m=>(g,A)=>i(...o(g,A),m)),"Array, Array":t.referToSelf(m=>(g,A)=>i(...o(r(g),r(A)),m).valueOf()),"Array, DenseMatrix":t.referToSelf(m=>(g,A)=>i(...o(r(g),A),m)),"DenseMatrix, Array":t.referToSelf(m=>(g,A)=>i(...o(g,r(A)),m))},l.SS&&(f["SparseMatrix, SparseMatrix"]=t.referToSelf(m=>(g,A)=>l.SS(...o(g,A),m,!1))),l.DS&&(f["DenseMatrix, SparseMatrix"]=t.referToSelf(m=>(g,A)=>l.DS(...o(g,A),m,!1)),f["Array, SparseMatrix"]=t.referToSelf(m=>(g,A)=>l.DS(...o(r(g),A),m,!1))),c&&(f["SparseMatrix, DenseMatrix"]=t.referToSelf(m=>(g,A)=>c(...o(A,g),m,!0)),f["SparseMatrix, Array"]=t.referToSelf(m=>(g,A)=>c(...o(r(A),g),m,!0))));var d=l.scalar||"any",p=l.Ds||l.Ss;p&&(u?(f["DenseMatrix,"+d]=(m,g)=>a(m,g,u,!1),f[d+", DenseMatrix"]=(m,g)=>a(g,m,u,!0),f["Array,"+d]=(m,g)=>a(r(m),g,u,!1).valueOf(),f[d+", Array"]=(m,g)=>a(r(g),m,u,!0).valueOf()):(f["DenseMatrix,"+d]=t.referToSelf(m=>(g,A)=>a(g,A,m,!1)),f[d+", DenseMatrix"]=t.referToSelf(m=>(g,A)=>a(A,g,m,!0)),f["Array,"+d]=t.referToSelf(m=>(g,A)=>a(r(g),A,m,!1).valueOf()),f[d+", Array"]=t.referToSelf(m=>(g,A)=>a(r(A),g,m,!0).valueOf())));var h=l.sS!==void 0?l.sS:l.Ss;return u?(l.Ss&&(f["SparseMatrix,"+d]=(m,g)=>l.Ss(m,g,u,!1)),h&&(f[d+", SparseMatrix"]=(m,g)=>h(g,m,u,!0))):(l.Ss&&(f["SparseMatrix,"+d]=t.referToSelf(m=>(g,A)=>l.Ss(g,A,m,!1))),h&&(f[d+", SparseMatrix"]=t.referToSelf(m=>(g,A)=>h(A,g,m,!0)))),u&&u.signatures&&iT(f,u.signatures),f}});var Mle="mod",h$e=["typed","config","round","matrix","equalScalar","zeros","DenseMatrix","concat"],iS=V(Mle,h$e,e=>{var{typed:t,config:r,round:n,matrix:i,equalScalar:a,zeros:o,DenseMatrix:s,concat:l}=e,u=nS({typed:t,config:r,round:n,matrix:i,equalScalar:a,zeros:o,DenseMatrix:s}),c=yo({typed:t,equalScalar:a}),f=xi({typed:t}),d=Q0({typed:t,equalScalar:a}),p=Gn({typed:t,equalScalar:a}),h=An({typed:t,DenseMatrix:s}),m=fr({typed:t,matrix:i,concat:l});return t(Mle,{"number, number":g,"BigNumber, BigNumber":function(b,v){return v.isZero()?b:b.sub(v.mul(u(b.div(v))))},"Fraction, Fraction":function(b,v){return v.equals(0)?b:b.sub(v.mul(u(b.div(v))))}},m({SS:d,DS:f,SD:c,Ss:p,sS:h}));function g(A,b){return b===0?A:A-b*u(A/b)}});var A$e="matAlgo01xDSid",g$e=["typed"],ou=V(A$e,g$e,e=>{var{typed:t}=e;return function(n,i,a,o){var s=n._data,l=n._size,u=n._datatype||n.getDataType(),c=i._values,f=i._index,d=i._ptr,p=i._size,h=i._datatype||i._data===void 0?i._datatype:i.getDataType();if(l.length!==p.length)throw new nr(l.length,p.length);if(l[0]!==p[0]||l[1]!==p[1])throw new RangeError("Dimension mismatch. Matrix A ("+l+") must match Matrix B ("+p+")");if(!c)throw new Error("Cannot perform operation on Dense Matrix and Pattern Sparse Matrix");var m=l[0],g=l[1],A=typeof u=="string"&&u!=="mixed"&&u===h?u:void 0,b=A?t.find(a,[A,A]):a,v,x,w=[];for(v=0;v{var{typed:t,equalScalar:r}=e;return function(i,a,o){var s=i._values,l=i._index,u=i._ptr,c=i._size,f=i._datatype||i._data===void 0?i._datatype:i.getDataType(),d=a._values,p=a._index,h=a._ptr,m=a._size,g=a._datatype||a._data===void 0?a._datatype:a.getDataType();if(c.length!==m.length)throw new nr(c.length,m.length);if(c[0]!==m[0]||c[1]!==m[1])throw new RangeError("Dimension mismatch. Matrix A ("+c+") must match Matrix B ("+m+")");var A=c[0],b=c[1],v,x=r,w=0,S=o;typeof f=="string"&&f===g&&f!=="mixed"&&(v=f,x=t.find(r,[v,v]),w=t.convert(0,v),S=t.find(o,[v,v]));var k=s&&d?[]:void 0,j=[],O=[],C=s&&d?[]:void 0,N=s&&d?[]:void 0,D=[],P=[],q,z,I,T,L;for(z=0;z{var{typed:t,DenseMatrix:r}=e;return function(i,a,o,s){var l=i._values,u=i._index,c=i._ptr,f=i._size,d=i._datatype;if(!l)throw new Error("Cannot perform operation on Pattern Sparse Matrix and Scalar value");var p=f[0],h=f[1],m,g=o;typeof d=="string"&&(m=d,a=t.convert(a,m),g=t.find(o,[m,m]));for(var A=[],b=[],v=[],x=0;xArray.isArray(t))}var gF=V(jle,w$e,e=>{var{typed:t,matrix:r,config:n,round:i,equalScalar:a,zeros:o,BigNumber:s,DenseMatrix:l,concat:u}=e,c=iS({typed:t,config:n,round:i,matrix:r,equalScalar:a,zeros:o,DenseMatrix:l,concat:u}),f=ou({typed:t}),d=aS({typed:t,equalScalar:a}),p=Dc({typed:t,DenseMatrix:l}),h=fr({typed:t,matrix:r,concat:u});return t(jle,{"number, number":m,"BigNumber, BigNumber":g,"Fraction, Fraction":(A,b)=>A.gcd(b)},h({SS:d,DS:f,Ss:p}),{[S$e]:t.referToSelf(A=>(b,v,x)=>{for(var w=A(b,v),S=0;Sb=>{if(b.length===1&&Array.isArray(b[0])&&Nle(b[0]))return A(...b[0]);if(Nle(b))return A(...b);throw new bf("gcd() supports only 1d matrices!")}),Matrix:t.referToSelf(A=>b=>A(b.toArray()))});function m(A,b){if(!wt(A)||!wt(b))throw new Error("Parameters in function gcd must be integer numbers");for(var v;b!==0;)v=c(A,b),A=b,b=v;return A<0?-A:A}function g(A,b){if(!A.isInt()||!b.isInt())throw new Error("Parameters in function gcd must be integer numbers");for(var v=new s(0);!b.isZero();){var x=c(A,b);A=b,b=x}return A.lt(v)?A.neg():A}});var E$e="matAlgo06xS0S0",k$e=["typed","equalScalar"],Y0=V(E$e,k$e,e=>{var{typed:t,equalScalar:r}=e;return function(i,a,o){var s=i._values,l=i._size,u=i._datatype||i._data===void 0?i._datatype:i.getDataType(),c=a._values,f=a._size,d=a._datatype||a._data===void 0?a._datatype:a.getDataType();if(l.length!==f.length)throw new nr(l.length,f.length);if(l[0]!==f[0]||l[1]!==f[1])throw new RangeError("Dimension mismatch. Matrix A ("+l+") must match Matrix B ("+f+")");var p=l[0],h=l[1],m,g=r,A=0,b=o;typeof u=="string"&&u===d&&u!=="mixed"&&(m=u,g=t.find(r,[m,m]),A=t.convert(0,m),b=t.find(o,[m,m]));for(var v=s&&c?[]:void 0,x=[],w=[],S=v?[]:void 0,k=[],j=[],O=0;O{var{typed:t,matrix:r,equalScalar:n,concat:i}=e,a=yo({typed:t,equalScalar:n}),o=Y0({typed:t,equalScalar:n}),s=Gn({typed:t,equalScalar:n}),l=fr({typed:t,matrix:r,concat:i}),u="number | BigNumber | Fraction | Matrix | Array",c={};return c["".concat(u,", ").concat(u,", ...").concat(u)]=t.referToSelf(d=>(p,h,m)=>{for(var g=d(p,h),A=0;Ad.lcm(p)},l({SS:o,DS:a,Ss:s}),c);function f(d,p){if(!d.isInt()||!p.isInt())throw new Error("Parameters in function lcm must be integer numbers");if(d.isZero())return d;if(p.isZero())return p;for(var h=d.times(p);!p.isZero();){var m=p;p=d.mod(m),d=m}return h.div(d).abs()}});var Fle="log10",D$e=["typed","config","Complex"],yF=V(Fle,D$e,e=>{var{typed:t,config:r,Complex:n}=e;return t(Fle,{number:function(a){return a>=0||r.predictable?TW(a):new n(a,0).log().div(Math.LN10)},Complex:function(a){return new n(a).log().div(Math.LN10)},BigNumber:function(a){return!a.isNegative()||r.predictable?a.log():new n(a.toNumber(),0).log().div(Math.LN10)},"Array | Matrix":t.referToSelf(i=>a=>jt(a,i))})});var _le="log2",O$e=["typed","config","Complex"],bF=V(_le,O$e,e=>{var{typed:t,config:r,Complex:n}=e;return t(_le,{number:function(o){return o>=0||r.predictable?FW(o):i(new n(o,0))},Complex:i,BigNumber:function(o){return!o.isNegative()||r.predictable?o.log(2):i(new n(o.toNumber(),0))},"Array | Matrix":t.referToSelf(a=>o=>jt(o,a))});function i(a){var o=Math.sqrt(a.re*a.re+a.im*a.im);return new n(Math.log2?Math.log2(o):Math.log(o)/Math.LN2,Math.atan2(a.im,a.re)/Math.LN2)}});var M$e="multiplyScalar",j$e=["typed"],xF=V(M$e,j$e,e=>{var{typed:t}=e;return t("multiplyScalar",{"number, number":kW,"Complex, Complex":function(n,i){return n.mul(i)},"BigNumber, BigNumber":function(n,i){return n.times(i)},"Fraction, Fraction":function(n,i){return n.mul(i)},"number | Fraction | BigNumber | Complex, Unit":(r,n)=>n.multiply(r),"Unit, number | Fraction | BigNumber | Complex | Unit":(r,n)=>r.multiply(n)})});var Ple="multiply",N$e=["typed","matrix","addScalar","multiplyScalar","equalScalar","dot"],wF=V(Ple,N$e,e=>{var{typed:t,matrix:r,addScalar:n,multiplyScalar:i,equalScalar:a,dot:o}=e,s=Gn({typed:t,equalScalar:a}),l=vo({typed:t});function u(w,S){switch(w.length){case 1:switch(S.length){case 1:if(w[0]!==S[0])throw new RangeError("Dimension mismatch in multiplication. Vectors must have the same length");break;case 2:if(w[0]!==S[0])throw new RangeError("Dimension mismatch in multiplication. Vector length ("+w[0]+") must match Matrix rows ("+S[0]+")");break;default:throw new Error("Can only multiply a 1 or 2 dimensional matrix (Matrix B has "+S.length+" dimensions)")}break;case 2:switch(S.length){case 1:if(w[1]!==S[0])throw new RangeError("Dimension mismatch in multiplication. Matrix columns ("+w[1]+") must match Vector length ("+S[0]+")");break;case 2:if(w[1]!==S[0])throw new RangeError("Dimension mismatch in multiplication. Matrix A columns ("+w[1]+") must match Matrix B rows ("+S[0]+")");break;default:throw new Error("Can only multiply a 1 or 2 dimensional matrix (Matrix B has "+S.length+" dimensions)")}break;default:throw new Error("Can only multiply a 1 or 2 dimensional matrix (Matrix A has "+w.length+" dimensions)")}}function c(w,S,k){if(k===0)throw new Error("Cannot multiply two empty vectors");return o(w,S)}function f(w,S){if(S.storage()!=="dense")throw new Error("Support for SparseMatrix not implemented");return d(w,S)}function d(w,S){var k=w._data,j=w._size,O=w._datatype||w.getDataType(),C=S._data,N=S._size,D=S._datatype||S.getDataType(),P=j[0],q=N[1],z,I=n,T=i;O&&D&&O===D&&typeof O=="string"&&O!=="mixed"&&(z=O,I=t.find(n,[z,z]),T=t.find(i,[z,z]));for(var L=[],_=0;_Oe)for(var ye=0,me=0;me(S,k)=>{u(Yt(S),Yt(k));var j=w(r(S),r(k));return St(j)?j.valueOf():j}),"Matrix, Matrix":function(S,k){var j=S.size(),O=k.size();return u(j,O),j.length===1?O.length===1?c(S,k,j[0]):f(S,k):O.length===1?p(S,k):h(S,k)},"Matrix, Array":t.referTo("Matrix,Matrix",w=>(S,k)=>w(S,r(k))),"Array, Matrix":t.referToSelf(w=>(S,k)=>w(r(S,k.storage()),k)),"SparseMatrix, any":function(S,k){return s(S,k,i,!1)},"DenseMatrix, any":function(S,k){return l(S,k,i,!1)},"any, SparseMatrix":function(S,k){return s(k,S,i,!0)},"any, DenseMatrix":function(S,k){return l(k,S,i,!0)},"Array, any":function(S,k){return l(r(S),k,i,!1).valueOf()},"any, Array":function(S,k){return l(r(k),S,i,!0).valueOf()},"any, any":i,"any, any, ...any":t.referToSelf(w=>(S,k,j)=>{for(var O=w(S,k),C=0;C{var{typed:t,matrix:r,equalScalar:n,BigNumber:i,concat:a}=e,o=ou({typed:t}),s=yo({typed:t,equalScalar:n}),l=Y0({typed:t,equalScalar:n}),u=Gn({typed:t,equalScalar:n}),c=fr({typed:t,matrix:r,concat:a});function f(){throw new Error("Complex number not supported in function nthRoot. Use nthRoots instead.")}return t(Ile,{number:_W,"number, number":_W,BigNumber:p=>d(p,new i(2)),"BigNumber, BigNumber":d,Complex:f,"Complex, number":f,Array:t.referTo("DenseMatrix,number",p=>h=>p(r(h),2).valueOf()),DenseMatrix:t.referTo("DenseMatrix,number",p=>h=>p(h,2)),SparseMatrix:t.referTo("SparseMatrix,number",p=>h=>p(h,2)),"SparseMatrix, SparseMatrix":t.referToSelf(p=>(h,m)=>{if(m.density()===1)return l(h,m,p);throw new Error("Root must be non-zero")}),"DenseMatrix, SparseMatrix":t.referToSelf(p=>(h,m)=>{if(m.density()===1)return o(h,m,p,!1);throw new Error("Root must be non-zero")}),"Array, SparseMatrix":t.referTo("DenseMatrix,SparseMatrix",p=>(h,m)=>p(r(h),m)),"number | BigNumber, SparseMatrix":t.referToSelf(p=>(h,m)=>{if(m.density()===1)return u(m,h,p,!0);throw new Error("Root must be non-zero")})},c({scalar:"number | BigNumber",SD:s,Ss:u,sS:!1}));function d(p,h){var m=i.precision,g=i.clone({precision:m+2}),A=new i(0),b=new g(1),v=h.isNegative();if(v&&(h=h.neg()),h.isZero())throw new Error("Root must be non-zero");if(p.isNegative()&&!h.abs().mod(2).equals(1))throw new Error("Root must be odd when a is negative.");if(p.isZero())return v?new g(1/0):0;if(!p.isFinite())return v?A:p;var x=p.abs().pow(b.div(h));return x=p.isNeg()?x.neg():x,new i((v?b.div(x):x).toPrecision(m))}});var Ble="sign",F$e=["typed","BigNumber","Fraction","complex"],EF=V(Ble,F$e,e=>{var{typed:t,BigNumber:r,complex:n,Fraction:i}=e;return t(Ble,{number:BT,Complex:function(o){return o.im===0?n(BT(o.re)):o.sign()},BigNumber:function(o){return new r(o.cmp(0))},Fraction:function(o){return new i(o.s,1)},"Array | Matrix":t.referToSelf(a=>o=>jt(o,a,!0)),Unit:t.referToSelf(a=>o=>{if(!o._isDerived()&&o.units[0].unit.offset!==0)throw new TypeError("sign is ambiguous for units with offset");return t.find(a,o.valueType())(o.value)})})});var _$e="sqrt",P$e=["config","typed","Complex"],kF=V(_$e,P$e,e=>{var{config:t,typed:r,Complex:n}=e;return r("sqrt",{number:i,Complex:function(o){return o.sqrt()},BigNumber:function(o){return!o.isNegative()||t.predictable?o.sqrt():i(o.toNumber())},Unit:function(o){return o.pow(.5)}});function i(a){return isNaN(a)?NaN:a>=0||t.predictable?Math.sqrt(a):new n(a,0).sqrt()}});var Rle="square",I$e=["typed"],CF=V(Rle,I$e,e=>{var{typed:t}=e;return t(Rle,{number:PW,Complex:function(n){return n.mul(n)},BigNumber:function(n){return n.times(n)},Fraction:function(n){return n.mul(n)},Unit:function(n){return n.pow(2)}})});var $le="subtract",B$e=["typed","matrix","equalScalar","subtractScalar","unaryMinus","DenseMatrix","concat"],DF=V($le,B$e,e=>{var{typed:t,matrix:r,equalScalar:n,subtractScalar:i,unaryMinus:a,DenseMatrix:o,concat:s}=e,l=ou({typed:t}),u=xi({typed:t}),c=Q0({typed:t,equalScalar:n}),f=Dc({typed:t,DenseMatrix:o}),d=An({typed:t,DenseMatrix:o}),p=fr({typed:t,matrix:r,concat:s});return t($le,{"any, any":i},p({elop:i,SS:c,DS:l,SD:u,Ss:d,sS:f}))});var qle="xgcd",R$e=["typed","config","matrix","BigNumber"],OF=V(qle,R$e,e=>{var{typed:t,config:r,matrix:n,BigNumber:i}=e;return t(qle,{"number, number":function(s,l){var u=IW(s,l);return r.matrix==="Array"?u:n(u)},"BigNumber, BigNumber":a});function a(o,s){var l,u,c,f=new i(0),d=new i(1),p=f,h=d,m=d,g=f;if(!o.isInt()||!s.isInt())throw new Error("Parameters in function xgcd must be integer numbers");for(;!s.isZero();)u=o.div(s).floor(),c=o.mod(s),l=p,p=h.minus(u.times(p)),h=l,l=m,m=g.minus(u.times(m)),g=l,o=s,s=c;var A;return o.lt(f)?A=[o.neg(),h.neg(),g.neg()]:A=[o,o.isZero()?0:h,g],r.matrix==="Array"?A:n(A)}});var Lle="invmod",$$e=["typed","config","BigNumber","xgcd","equal","smaller","mod","add","isInteger"],MF=V(Lle,$$e,e=>{var{typed:t,config:r,BigNumber:n,xgcd:i,equal:a,smaller:o,mod:s,add:l,isInteger:u}=e;return t(Lle,{"number, number":c,"BigNumber, BigNumber":c});function c(f,d){if(!u(f)||!u(d))throw new Error("Parameters in function invmod must be integer numbers");if(f=s(f,d),a(d,0))throw new Error("Divisor must be non zero");var p=i(f,d);p=p.valueOf();var[h,m]=p;return a(h,n(1))?(m=s(m,d),o(m,n(0))&&(m=l(m,d)),m):NaN}});var q$e="matAlgo09xS0Sf",L$e=["typed","equalScalar"],jF=V(q$e,L$e,e=>{var{typed:t,equalScalar:r}=e;return function(i,a,o){var s=i._values,l=i._index,u=i._ptr,c=i._size,f=i._datatype||i._data===void 0?i._datatype:i.getDataType(),d=a._values,p=a._index,h=a._ptr,m=a._size,g=a._datatype||a._data===void 0?a._datatype:a.getDataType();if(c.length!==m.length)throw new nr(c.length,m.length);if(c[0]!==m[0]||c[1]!==m[1])throw new RangeError("Dimension mismatch. Matrix A ("+c+") must match Matrix B ("+m+")");var A=c[0],b=c[1],v,x=r,w=0,S=o;typeof f=="string"&&f===g&&f!=="mixed"&&(v=f,x=t.find(r,[v,v]),w=t.convert(0,v),S=t.find(o,[v,v]));var k=s&&d?[]:void 0,j=[],O=[],C=k?[]:void 0,N=[],D,P,q,z,I;for(P=0;P{var{typed:t,matrix:r,equalScalar:n,multiplyScalar:i,concat:a}=e,o=yo({typed:t,equalScalar:n}),s=jF({typed:t,equalScalar:n}),l=Gn({typed:t,equalScalar:n}),u=fr({typed:t,matrix:r,concat:a});return t(zle,u({elop:i,SS:s,DS:o,Ss:l}))});function Ule(e,t){if(e.isFinite()&&!e.isInteger()||t.isFinite()&&!t.isInteger())throw new Error("Integers expected in function bitAnd");var r=e.constructor;if(e.isNaN()||t.isNaN())return new r(NaN);if(e.isZero()||t.eq(-1)||e.eq(t))return e;if(t.isZero()||e.eq(-1))return t;if(!e.isFinite()||!t.isFinite()){if(!e.isFinite()&&!t.isFinite())return e.isNegative()===t.isNegative()?e:new r(0);if(!e.isFinite())return t.isNegative()?e:e.isNegative()?new r(0):t;if(!t.isFinite())return e.isNegative()?t:t.isNegative()?new r(0):e}return SH(e,t,function(n,i){return n&i})}function oS(e){if(e.isFinite()&&!e.isInteger())throw new Error("Integer expected in function bitNot");var t=e.constructor,r=t.precision;t.config({precision:1e9});var n=e.plus(new t(1));return n.s=-n.s||null,t.config({precision:r}),n}function Wle(e,t){if(e.isFinite()&&!e.isInteger()||t.isFinite()&&!t.isInteger())throw new Error("Integers expected in function bitOr");var r=e.constructor;if(e.isNaN()||t.isNaN())return new r(NaN);var n=new r(-1);return e.isZero()||t.eq(n)||e.eq(t)?t:t.isZero()||e.eq(n)?e:!e.isFinite()||!t.isFinite()?!e.isFinite()&&!e.isNegative()&&t.isNegative()||e.isNegative()&&!t.isNegative()&&!t.isFinite()?n:e.isNegative()&&t.isNegative()?e.isFinite()?e:t:e.isFinite()?t:e:SH(e,t,function(i,a){return i|a})}function SH(e,t,r){var n=e.constructor,i,a,o=+(e.s<0),s=+(t.s<0);if(o){i=TF(oS(e));for(var l=0;l0;)r(c[--p],f[--h])===m&&(g=g.plus(A)),A=A.times(b);for(;h>0;)r(d,f[--h])===m&&(g=g.plus(A)),A=A.times(b);return n.config({precision:v}),m===0&&(g.s=-g.s),g}function TF(e){for(var t=e.d,r=t[0]+"",n=1;n0)if(++s>u)for(s-=u;s--;)l+="0";else s1&&((c[p+1]===null||c[p+1]===void 0)&&(c[p+1]=0),c[p+1]+=c[p]>>1,c[p]&=1)}return c.reverse()}function Hle(e,t){if(e.isFinite()&&!e.isInteger()||t.isFinite()&&!t.isInteger())throw new Error("Integers expected in function bitXor");var r=e.constructor;if(e.isNaN()||t.isNaN())return new r(NaN);if(e.isZero())return t;if(t.isZero())return e;if(e.eq(t))return new r(0);var n=new r(-1);return e.eq(n)?oS(t):t.eq(n)?oS(e):!e.isFinite()||!t.isFinite()?!e.isFinite()&&!t.isFinite()?n:new r(e.isNegative()===t.isNegative()?1/0:-1/0):SH(e,t,function(i,a){return i^a})}function Vle(e,t){if(e.isFinite()&&!e.isInteger()||t.isFinite()&&!t.isInteger())throw new Error("Integers expected in function leftShift");var r=e.constructor;return e.isNaN()||t.isNaN()||t.isNegative()&&!t.isZero()?new r(NaN):e.isZero()||t.isZero()?e:!e.isFinite()&&!t.isFinite()?new r(NaN):t.lt(55)?e.times(Math.pow(2,t.toNumber())+""):e.times(new r(2).pow(t))}function Gle(e,t){if(e.isFinite()&&!e.isInteger()||t.isFinite()&&!t.isInteger())throw new Error("Integers expected in function rightArithShift");var r=e.constructor;return e.isNaN()||t.isNaN()||t.isNegative()&&!t.isZero()?new r(NaN):e.isZero()||t.isZero()?e:t.isFinite()?t.lt(55)?e.div(Math.pow(2,t.toNumber())+"").floor():e.div(new r(2).pow(t)).floor():e.isNegative()?new r(-1):e.isFinite()?new r(0):new r(NaN)}var Qle="bitAnd",U$e=["typed","matrix","equalScalar","concat"],sS=V(Qle,U$e,e=>{var{typed:t,matrix:r,equalScalar:n,concat:i}=e,a=yo({typed:t,equalScalar:n}),o=Y0({typed:t,equalScalar:n}),s=Gn({typed:t,equalScalar:n}),l=fr({typed:t,matrix:r,concat:i});return t(Qle,{"number, number":RW,"BigNumber, BigNumber":Ule},l({SS:o,DS:a,Ss:s}))});var Yle="bitNot",W$e=["typed"],FF=V(Yle,W$e,e=>{var{typed:t}=e;return t(Yle,{number:$W,BigNumber:oS,"Array | Matrix":t.referToSelf(r=>n=>jt(n,r))})});var Zle="bitOr",H$e=["typed","matrix","equalScalar","DenseMatrix","concat"],lS=V(Zle,H$e,e=>{var{typed:t,matrix:r,equalScalar:n,DenseMatrix:i,concat:a}=e,o=ou({typed:t}),s=aS({typed:t,equalScalar:n}),l=Dc({typed:t,DenseMatrix:i}),u=fr({typed:t,matrix:r,concat:a});return t(Zle,{"number, number":qW,"BigNumber, BigNumber":Wle},u({SS:s,DS:o,Ss:l}))});var V$e="matAlgo07xSSf",G$e=["typed","DenseMatrix"],Qo=V(V$e,G$e,e=>{var{typed:t,DenseMatrix:r}=e;return function(a,o,s){var l=a._size,u=a._datatype||a._data===void 0?a._datatype:a.getDataType(),c=o._size,f=o._datatype||o._data===void 0?o._datatype:o.getDataType();if(l.length!==c.length)throw new nr(l.length,c.length);if(l[0]!==c[0]||l[1]!==c[1])throw new RangeError("Dimension mismatch. Matrix A ("+l+") must match Matrix B ("+c+")");var d=l[0],p=l[1],h,m=0,g=s;typeof u=="string"&&u===f&&u!=="mixed"&&(h=u,m=t.convert(0,h),g=t.find(s,[h,h]));var A,b,v=[];for(A=0;A{var{typed:t,matrix:r,DenseMatrix:n,concat:i}=e,a=xi({typed:t}),o=Qo({typed:t,DenseMatrix:n}),s=An({typed:t,DenseMatrix:n}),l=fr({typed:t,matrix:r,concat:i});return t(Xle,{"number, number":LW,"BigNumber, BigNumber":Hle},l({SS:o,DS:a,Ss:s}))});var Kle="arg",Y$e=["typed"],PF=V(Kle,Y$e,e=>{var{typed:t}=e;return t(Kle,{number:function(n){return Math.atan2(0,n)},BigNumber:function(n){return n.constructor.atan2(0,n)},Complex:function(n){return n.arg()},"Array | Matrix":t.referToSelf(r=>n=>jt(n,r))})});var Jle="conj",Z$e=["typed"],IF=V(Jle,Z$e,e=>{var{typed:t}=e;return t(Jle,{"number | BigNumber | Fraction":r=>r,Complex:r=>r.conjugate(),"Array | Matrix":t.referToSelf(r=>n=>jt(n,r))})});var eue="im",X$e=["typed"],BF=V(eue,X$e,e=>{var{typed:t}=e;return t(eue,{number:()=>0,"BigNumber | Fraction":r=>r.mul(0),Complex:r=>r.im,"Array | Matrix":t.referToSelf(r=>n=>jt(n,r))})});var tue="re",K$e=["typed"],RF=V(tue,K$e,e=>{var{typed:t}=e;return t(tue,{"number | BigNumber | Fraction":r=>r,Complex:r=>r.re,"Array | Matrix":t.referToSelf(r=>n=>jt(n,r))})});var rue="not",J$e=["typed"],$F=V(rue,J$e,e=>{var{typed:t}=e;return t(rue,{"null | undefined":()=>!0,number:GW,Complex:function(n){return n.re===0&&n.im===0},BigNumber:function(n){return n.isZero()||n.isNaN()},Unit:t.referToSelf(r=>n=>t.find(r,n.valueType())(n.value)),"Array | Matrix":t.referToSelf(r=>n=>jt(n,r))})});var nue="or",eqe=["typed","matrix","equalScalar","DenseMatrix","concat"],uS=V(nue,eqe,e=>{var{typed:t,matrix:r,equalScalar:n,DenseMatrix:i,concat:a}=e,o=xi({typed:t}),s=Q0({typed:t,equalScalar:n}),l=An({typed:t,DenseMatrix:i}),u=fr({typed:t,matrix:r,concat:a});return t(nue,{"number, number":QW,"Complex, Complex":function(f,d){return f.re!==0||f.im!==0||d.re!==0||d.im!==0},"BigNumber, BigNumber":function(f,d){return!f.isZero()&&!f.isNaN()||!d.isZero()&&!d.isNaN()},"Unit, Unit":t.referToSelf(c=>(f,d)=>c(f.value||0,d.value||0))},u({SS:s,DS:o,Ss:l}))});var iue="xor",tqe=["typed","matrix","DenseMatrix","concat"],qF=V(iue,tqe,e=>{var{typed:t,matrix:r,DenseMatrix:n,concat:i}=e,a=xi({typed:t}),o=Qo({typed:t,DenseMatrix:n}),s=An({typed:t,DenseMatrix:n}),l=fr({typed:t,matrix:r,concat:i});return t(iue,{"number, number":YW,"Complex, Complex":function(c,f){return(c.re!==0||c.im!==0)!=(f.re!==0||f.im!==0)},"BigNumber, BigNumber":function(c,f){return(!c.isZero()&&!c.isNaN())!=(!f.isZero()&&!f.isNaN())},"Unit, Unit":t.referToSelf(u=>(c,f)=>u(c.value||0,f.value||0))},l({SS:o,DS:a,Ss:s}))});var aue="concat",rqe=["typed","matrix","isInteger"],cS=V(aue,rqe,e=>{var{typed:t,matrix:r,isInteger:n}=e;return t(aue,{"...Array | Matrix | number | BigNumber":function(a){var o,s=a.length,l=-1,u,c=!1,f=[];for(o=0;o0&&l>u)throw new As(l,u+1)}else{var p=Bt(d).valueOf(),h=Yt(p);if(f[o]=p,u=l,l=h.length-1,o>0&&l!==u)throw new nr(u+1,l+1)}}if(f.length===0)throw new SyntaxError("At least one matrix expected");for(var m=f.shift();f.length;)m=oW(m,f.shift(),l);return c?r(m):m},"...string":function(a){return a.join("")}})});var oue="column",nqe=["typed","Index","matrix","range"],fS=V(oue,nqe,e=>{var{typed:t,Index:r,matrix:n,range:i}=e;return t(oue,{"Matrix, number":a,"Array, number":function(s,l){return a(n(Bt(s)),l).valueOf()}});function a(o,s){if(o.size().length!==2)throw new Error("Only two dimensional matrix is supported");Vn(s,o.size()[1]);var l=i(0,o.size()[0]),u=new r(l,s),c=o.subset(u);return St(c)?c:n([[c]])}});var sue="count",iqe=["typed","size","prod"],LF=V(sue,iqe,e=>{var{typed:t,size:r,prod:n}=e;return t(sue,{string:function(a){return a.length},"Matrix | Array":function(a){return n(r(a))}})});var lue="cross",aqe=["typed","matrix","subtract","multiply"],zF=V(lue,aqe,e=>{var{typed:t,matrix:r,subtract:n,multiply:i}=e;return t(lue,{"Matrix, Matrix":function(s,l){return r(a(s.toArray(),l.toArray()))},"Matrix, Array":function(s,l){return r(a(s.toArray(),l))},"Array, Matrix":function(s,l){return r(a(s,l.toArray()))},"Array, Array":a});function a(o,s){var l=Math.max(Yt(o).length,Yt(s).length);o=Qw(o),s=Qw(s);var u=Yt(o),c=Yt(s);if(u.length!==1||c.length!==1||u[0]!==3||c[0]!==3)throw new RangeError("Vectors with length 3 expected (Size A = ["+u.join(", ")+"], B = ["+c.join(", ")+"])");var f=[n(i(o[1],s[2]),i(o[2],s[1])),n(i(o[2],s[0]),i(o[0],s[2])),n(i(o[0],s[1]),i(o[1],s[0]))];return l>1?[f]:f}});var uue="diag",oqe=["typed","matrix","DenseMatrix","SparseMatrix"],UF=V(uue,oqe,e=>{var{typed:t,matrix:r,DenseMatrix:n,SparseMatrix:i}=e;return t(uue,{Array:function(u){return a(u,0,Yt(u),null)},"Array, number":function(u,c){return a(u,c,Yt(u),null)},"Array, BigNumber":function(u,c){return a(u,c.toNumber(),Yt(u),null)},"Array, string":function(u,c){return a(u,0,Yt(u),c)},"Array, number, string":function(u,c,f){return a(u,c,Yt(u),f)},"Array, BigNumber, string":function(u,c,f){return a(u,c.toNumber(),Yt(u),f)},Matrix:function(u){return a(u,0,u.size(),u.storage())},"Matrix, number":function(u,c){return a(u,c,u.size(),u.storage())},"Matrix, BigNumber":function(u,c){return a(u,c.toNumber(),u.size(),u.storage())},"Matrix, string":function(u,c){return a(u,0,u.size(),c)},"Matrix, number, string":function(u,c,f){return a(u,c,u.size(),f)},"Matrix, BigNumber, string":function(u,c,f){return a(u,c.toNumber(),u.size(),f)}});function a(l,u,c,f){if(!wt(u))throw new TypeError("Second parameter in function diag must be an integer");var d=u>0?u:0,p=u<0?-u:0;switch(c.length){case 1:return o(l,u,f,c[0],p,d);case 2:return s(l,u,f,c,p,d)}throw new RangeError("Matrix for function diag must be 2 dimensional")}function o(l,u,c,f,d,p){var h=[f+d,f+p];if(c&&c!=="sparse"&&c!=="dense")throw new TypeError("Unknown matrix type ".concat(c,'"'));var m=c==="sparse"?i.diagonal(h,l,u):n.diagonal(h,l,u);return c!==null?m:m.valueOf()}function s(l,u,c,f,d,p){if(St(l)){var h=l.diagonal(u);return c!==null?c!==h.storage()?r(h,c):h:h.valueOf()}for(var m=Math.min(f[0]-d,f[1]-p),g=[],A=0;A=2&&m.push("index: ".concat(qr(r))),p.length>=3&&m.push("array: ".concat(qr(n))),new TypeError("Function ".concat(i," cannot apply callback arguments ")+"".concat(e.name,"(").concat(m.join(", "),") at index ").concat(JSON.stringify(r)))}else throw new TypeError("Function ".concat(i," cannot apply callback arguments ")+"to function ".concat(e.name,": ").concat(g.message))}}}var sqe="filter",lqe=["typed"],WF=V(sqe,lqe,e=>{var{typed:t}=e;return t("filter",{"Array, function":cue,"Matrix, function":function(n,i){return n.create(cue(n.toArray(),i))},"Array, RegExp":Yw,"Matrix, RegExp":function(n,i){return n.create(Yw(n.toArray(),i))}})});function cue(e,t){return mT(e,function(r,n,i){return Od(t,r,[n],i,"filter")})}var fue="flatten",uqe=["typed","matrix"],HF=V(fue,uqe,e=>{var{typed:t,matrix:r}=e;return t(fue,{Array:function(i){return mr(i)},Matrix:function(i){var a=mr(i.toArray());return r(a)}})});var due="forEach",cqe=["typed"],VF=V(due,cqe,e=>{var{typed:t}=e;return t(due,{"Array, function":fqe,"Matrix, function":function(n,i){n.forEach(i)}})});function fqe(e,t){var r=function n(i,a){if(Array.isArray(i))$0(i,function(o,s){n(o,a.concat(s))});else return Od(t,i,a,e,"forEach")};r(e,[])}var pue="getMatrixDataType",dqe=["typed"],GF=V(pue,dqe,e=>{var{typed:t}=e;return t(pue,{Array:function(n){return q0(n,qr)},Matrix:function(n){return n.getDataType()}})});var mue="identity",pqe=["typed","config","matrix","BigNumber","DenseMatrix","SparseMatrix"],QF=V(mue,pqe,e=>{var{typed:t,config:r,matrix:n,BigNumber:i,DenseMatrix:a,SparseMatrix:o}=e;return t(mue,{"":function(){return r.matrix==="Matrix"?n([]):[]},string:function(c){return n(c)},"number | BigNumber":function(c){return l(c,c,r.matrix==="Matrix"?"dense":void 0)},"number | BigNumber, string":function(c,f){return l(c,c,f)},"number | BigNumber, number | BigNumber":function(c,f){return l(c,f,r.matrix==="Matrix"?"dense":void 0)},"number | BigNumber, number | BigNumber, string":function(c,f,d){return l(c,f,d)},Array:function(c){return s(c)},"Array, string":function(c,f){return s(c,f)},Matrix:function(c){return s(c.valueOf(),c.storage())},"Matrix, string":function(c,f){return s(c.valueOf(),f)}});function s(u,c){switch(u.length){case 0:return c?n(c):[];case 1:return l(u[0],u[0],c);case 2:return l(u[0],u[1],c);default:throw new Error("Vector containing two values expected")}}function l(u,c,f){var d=It(u)||It(c)?i:null;if(It(u)&&(u=u.toNumber()),It(c)&&(c=c.toNumber()),!wt(u)||u<1)throw new Error("Parameters in function identity must be positive integers");if(!wt(c)||c<1)throw new Error("Parameters in function identity must be positive integers");var p=d?new i(1):1,h=d?new d(0):0,m=[u,c];if(f){if(f==="sparse")return o.diagonal(m,p,0,h);if(f==="dense")return a.diagonal(m,p,0,h);throw new TypeError('Unknown matrix type "'.concat(f,'"'))}for(var g=Bp([],m,h),A=u{var{typed:t,matrix:r,multiplyScalar:n}=e;return t(hue,{"Matrix, Matrix":function(o,s){return r(i(o.toArray(),s.toArray()))},"Matrix, Array":function(o,s){return r(i(o.toArray(),s))},"Array, Matrix":function(o,s){return r(i(o,s.toArray()))},"Array, Array":i});function i(a,o){if(Yt(a).length===1&&(a=[a]),Yt(o).length===1&&(o=[o]),Yt(a).length>2||Yt(o).length>2)throw new RangeError("Vectors with dimensions greater then 2 are not supported expected (Size x = "+JSON.stringify(a.length)+", y = "+JSON.stringify(o.length)+")");var s=[],l=[];return a.map(function(u){return o.map(function(c){return l=[],s.push(l),u.map(function(f){return c.map(function(d){return l.push(n(f,d))})})})})&&s}});var Aue="map",hqe=["typed"],ZF=V(Aue,hqe,e=>{var{typed:t}=e;return t(Aue,{"Array, function":Aqe,"Matrix, function":function(n,i){return n.map(i)}})});function Aqe(e,t){var r=function n(i,a){return Array.isArray(i)?i.map(function(o,s){return n(o,a.concat(s))}):Od(t,i,a,e,"map")};return r(e,[])}var gue="diff",gqe=["typed","matrix","subtract","number"],dS=V(gue,gqe,e=>{var{typed:t,matrix:r,subtract:n,number:i}=e;return t(gue,{"Array | Matrix":function(c){return St(c)?r(o(c.toArray())):o(c)},"Array | Matrix, number":function(c,f){if(!wt(f))throw new RangeError("Dimension must be a whole number");return St(c)?r(a(c.toArray(),f)):a(c,f)},"Array, BigNumber":t.referTo("Array,number",u=>(c,f)=>u(c,i(f))),"Matrix, BigNumber":t.referTo("Matrix,number",u=>(c,f)=>u(c,i(f)))});function a(u,c){if(St(u)&&(u=u.toArray()),!Array.isArray(u))throw RangeError("Array/Matrix does not have that many dimensions");if(c>0){var f=[];return u.forEach(d=>{f.push(a(d,c-1))}),f}else{if(c===0)return o(u);throw RangeError("Cannot have negative dimension")}}function o(u){for(var c=[],f=u.length,d=1;d{var{typed:t,config:r,matrix:n,BigNumber:i}=e;return t("ones",{"":function(){return r.matrix==="Array"?a([]):a([],"default")},"...number | BigNumber | string":function(u){var c=u[u.length-1];if(typeof c=="string"){var f=u.pop();return a(u,f)}else return r.matrix==="Array"?a(u):a(u,"default")},Array:a,Matrix:function(u){var c=u.storage();return a(u.valueOf(),c)},"Array | Matrix, string":function(u,c){return a(u.valueOf(),c)}});function a(l,u){var c=o(l),f=c?new i(1):1;if(s(l),u){var d=n(u);return l.length>0?d.resize(l,f):d}else{var p=[];return l.length>0?Bp(p,l,f):p}}function o(l){var u=!1;return l.forEach(function(c,f,d){It(c)&&(u=!0,d[f]=c.toNumber())}),u}function s(l){l.forEach(function(u){if(typeof u!="number"||!wt(u)||u<0)throw new Error("Parameters in function ones must be positive integers")})}});function pS(){throw new Error('No "bignumber" implementation available')}function KF(){throw new Error('No "fraction" implementation available')}function JF(){throw new Error('No "matrix" implementation available')}var vue="range",bqe=["typed","config","?matrix","?bignumber","smaller","smallerEq","larger","largerEq","add","isPositive"],mS=V(vue,bqe,e=>{var{typed:t,config:r,matrix:n,bignumber:i,smaller:a,smallerEq:o,larger:s,largerEq:l,add:u,isPositive:c}=e;return t(vue,{string:d,"string, boolean":d,"number, number":function(g,A){return f(p(g,A,1,!1))},"number, number, number":function(g,A,b){return f(p(g,A,b,!1))},"number, number, boolean":function(g,A,b){return f(p(g,A,1,b))},"number, number, number, boolean":function(g,A,b,v){return f(p(g,A,b,v))},"BigNumber, BigNumber":function(g,A){var b=g.constructor;return f(p(g,A,new b(1),!1))},"BigNumber, BigNumber, BigNumber":function(g,A,b){return f(p(g,A,b,!1))},"BigNumber, BigNumber, boolean":function(g,A,b){var v=g.constructor;return f(p(g,A,new v(1),b))},"BigNumber, BigNumber, BigNumber, boolean":function(g,A,b,v){return f(p(g,A,b,v))},"Unit, Unit, Unit":function(g,A,b){return f(p(g,A,b,!1))},"Unit, Unit, Unit, boolean":function(g,A,b,v){return f(p(g,A,b,v))}});function f(m){return r.matrix==="Matrix"?n?n(m):JF():m}function d(m,g){var A=h(m);if(!A)throw new SyntaxError('String "'+m+'" is no valid range');return r.number==="BigNumber"?(i===void 0&&pS(),f(p(i(A.start),i(A.end),i(A.step)),g)):f(p(A.start,A.end,A.step,g))}function p(m,g,A,b){for(var v=[],x=c(A)?b?o:a:b?l:s,w=m;x(w,g);)v.push(w),w=u(w,A);return v}function h(m){var g=m.split(":"),A=g.map(function(v){return Number(v)}),b=A.some(function(v){return isNaN(v)});if(b)return null;switch(A.length){case 2:return{start:A[0],end:A[1],step:1};case 3:return{start:A[0],end:A[2],step:A[1]};default:return null}}});var yue="reshape",xqe=["typed","isInteger","matrix"],e3=V(yue,xqe,e=>{var{typed:t,isInteger:r}=e;return t(yue,{"Matrix, Array":function(i,a){return i.reshape(a,!0)},"Array, Array":function(i,a){return a.forEach(function(o){if(!r(o))throw new TypeError("Invalid size for dimension: "+o)}),U6(i,a)}})});var wqe="resize",Sqe=["config","matrix"],t3=V(wqe,Sqe,e=>{var{config:t,matrix:r}=e;return function(a,o,s){if(arguments.length!==2&&arguments.length!==3)throw new bf("resize",arguments.length,2,3);if(St(o)&&(o=o.valueOf()),It(o[0])&&(o=o.map(function(c){return It(c)?c.toNumber():c})),St(a))return a.resize(o,s,!0);if(typeof a=="string")return n(a,o,s);var l=Array.isArray(a)?!1:t.matrix!=="Array";if(o.length===0){for(;Array.isArray(a);)a=a[0];return Bt(a)}else{Array.isArray(a)||(a=[a]),a=Bt(a);var u=Bp(a,o,s);return l?r(u):u}};function n(i,a,o){if(o!==void 0){if(typeof o!="string"||o.length!==1)throw new TypeError("Single character expected as defaultValue")}else o=" ";if(a.length!==1)throw new nr(a.length,1);var s=a[0];if(typeof s!="number"||!wt(s))throw new TypeError("Invalid size, must contain positive integers (size: "+tr(a)+")");if(i.length>s)return i.substring(0,s);if(i.length{var{typed:t,multiply:r,rotationMatrix:n}=e;return t(bue,{"Array , number | BigNumber | Complex | Unit":function(o,s){i(o,2);var l=r(n(s),o);return l.toArray()},"Matrix , number | BigNumber | Complex | Unit":function(o,s){return i(o,2),r(n(s),o)},"Array, number | BigNumber | Complex | Unit, Array | Matrix":function(o,s,l){i(o,3);var u=r(n(s,l),o);return u},"Matrix, number | BigNumber | Complex | Unit, Array | Matrix":function(o,s,l){return i(o,3),r(n(s,l),o)}});function i(a,o){var s=Array.isArray(a)?Yt(a):a.size();if(s.length>2)throw new RangeError("Vector must be of dimensions 1x".concat(o));if(s.length===2&&s[1]!==1)throw new RangeError("Vector must be of dimensions 1x".concat(o));if(s[0]!==o)throw new RangeError("Vector must be of dimensions 1x".concat(o))}});var xue="rotationMatrix",kqe=["typed","config","multiplyScalar","addScalar","unaryMinus","norm","matrix","BigNumber","DenseMatrix","SparseMatrix","cos","sin"],n3=V(xue,kqe,e=>{var{typed:t,config:r,multiplyScalar:n,addScalar:i,unaryMinus:a,norm:o,BigNumber:s,matrix:l,DenseMatrix:u,SparseMatrix:c,cos:f,sin:d}=e;return t(xue,{"":function(){return r.matrix==="Matrix"?l([]):[]},string:function(v){return l(v)},"number | BigNumber | Complex | Unit":function(v){return p(v,r.matrix==="Matrix"?"dense":void 0)},"number | BigNumber | Complex | Unit, string":function(v,x){return p(v,x)},"number | BigNumber | Complex | Unit, Array":function(v,x){var w=l(x);return h(w),A(v,w,void 0)},"number | BigNumber | Complex | Unit, Matrix":function(v,x){h(x);var w=x.storage()||(r.matrix==="Matrix"?"dense":void 0);return A(v,x,w)},"number | BigNumber | Complex | Unit, Array, string":function(v,x,w){var S=l(x);return h(S),A(v,S,w)},"number | BigNumber | Complex | Unit, Matrix, string":function(v,x,w){return h(x),A(v,x,w)}});function p(b,v){var x=It(b),w=x?new s(-1):-1,S=f(b),k=d(b),j=[[S,n(w,k)],[k,S]];return g(j,v)}function h(b){var v=b.size();if(v.length<1||v[0]!==3)throw new RangeError("Vector must be of dimensions 1x3")}function m(b){return b.reduce((v,x)=>n(v,x))}function g(b,v){if(v){if(v==="sparse")return new c(b);if(v==="dense")return new u(b);throw new TypeError('Unknown matrix type "'.concat(v,'"'))}return b}function A(b,v,x){var w=o(v);if(w===0)throw new RangeError("Rotation around zero vector");var S=It(b)?s:null,k=S?new S(1):1,j=S?new S(-1):-1,O=S?new S(v.get([0])/w):v.get([0])/w,C=S?new S(v.get([1])/w):v.get([1])/w,N=S?new S(v.get([2])/w):v.get([2])/w,D=f(b),P=i(k,a(D)),q=d(b),z=i(D,m([O,O,P])),I=i(m([O,C,P]),m([j,N,q])),T=i(m([O,N,P]),m([C,q])),L=i(m([O,C,P]),m([N,q])),_=i(D,m([C,C,P])),Y=i(m([C,N,P]),m([j,O,q])),oe=i(m([O,N,P]),m([j,C,q])),te=i(m([C,N,P]),m([O,q])),Q=i(D,m([N,N,P])),fe=[[z,I,T],[L,_,Y],[oe,te,Q]];return g(fe,x)}});var wue="row",Cqe=["typed","Index","matrix","range"],hS=V(wue,Cqe,e=>{var{typed:t,Index:r,matrix:n,range:i}=e;return t(wue,{"Matrix, number":a,"Array, number":function(s,l){return a(n(Bt(s)),l).valueOf()}});function a(o,s){if(o.size().length!==2)throw new Error("Only two dimensional matrix is supported");Vn(s,o.size()[0]);var l=i(0,o.size()[1]),u=new r(s,l),c=o.subset(u);return St(c)?c:n([[c]])}});var Sue="size",Dqe=["typed","config","?matrix"],i3=V(Sue,Dqe,e=>{var{typed:t,config:r,matrix:n}=e;return t(Sue,{Matrix:function(a){return a.create(a.size())},Array:Yt,string:function(a){return r.matrix==="Array"?[a.length]:n([a.length])},"number | Complex | BigNumber | Unit | boolean | null":function(a){return r.matrix==="Array"?[]:n?n([]):JF()}})});var Eue="squeeze",Oqe=["typed","matrix"],a3=V(Eue,Oqe,e=>{var{typed:t,matrix:r}=e;return t(Eue,{Array:function(i){return Qw(Bt(i))},Matrix:function(i){var a=Qw(i.toArray());return Array.isArray(a)?r(a):a},any:function(i){return Bt(i)}})});var kue="subset",Mqe=["typed","matrix","zeros","add"],AS=V(kue,Mqe,e=>{var{typed:t,matrix:r,zeros:n,add:i}=e;return t(kue,{"Matrix, Index":function(s,l){return yy(l)?r():(z6(s,l),s.subset(l))},"Array, Index":t.referTo("Matrix, Index",function(o){return function(s,l){var u=o(r(s),l);return l.isScalar()?u:u.valueOf()}}),"Object, Index":Nqe,"string, Index":jqe,"Matrix, Index, any, any":function(s,l,u,c){return yy(l)?s:(z6(s,l),s.clone().subset(l,a(u,l),c))},"Array, Index, any, any":t.referTo("Matrix, Index, any, any",function(o){return function(s,l,u,c){var f=o(r(s),l,u,c);return f.isMatrix?f.valueOf():f}}),"Array, Index, any":t.referTo("Matrix, Index, any, any",function(o){return function(s,l,u){return o(r(s),l,u,void 0).valueOf()}}),"Matrix, Index, any":t.referTo("Matrix, Index, any, any",function(o){return function(s,l,u){return o(s,l,u,void 0)}}),"string, Index, string":Cue,"string, Index, string, string":Cue,"Object, Index, any":Tqe});function a(o,s){if(typeof o=="string")throw new Error("can't boradcast a string");if(s._isScalar)return o;var l=s.size();if(l.every(u=>u>0))try{return i(o,n(l))}catch{return o}else return o}});function jqe(e,t){if(!Wm(t))throw new TypeError("Index expected");if(yy(t))return"";if(z6(Array.from(e),t),t.size().length!==1)throw new nr(t.size().length,1);var r=e.length;Vn(t.min()[0],r),Vn(t.max()[0],r);var n=t.dimension(0),i="";return n.forEach(function(a){i+=e.charAt(a)}),i}function Cue(e,t,r,n){if(!t||t.isIndex!==!0)throw new TypeError("Index expected");if(yy(t))return e;if(z6(Array.from(e),t),t.size().length!==1)throw new nr(t.size().length,1);if(n!==void 0){if(typeof n!="string"||n.length!==1)throw new TypeError("Single character expected as defaultValue")}else n=" ";var i=t.dimension(0),a=i.size()[0];if(a!==r.length)throw new nr(i.size()[0],r.length);var o=e.length;Vn(t.min()[0]),Vn(t.max()[0]);for(var s=[],l=0;lo)for(var u=o-1,c=s.length;u{var{typed:t,matrix:r}=e;return t(Due,{Array:o=>n(r(o)).valueOf(),Matrix:n,any:Bt});function n(o){var s=o.size(),l;switch(s.length){case 1:l=o.clone();break;case 2:{var u=s[0],c=s[1];if(c===0)throw new RangeError("Cannot transpose a 2D matrix with no columns (size: "+tr(s)+")");switch(o.storage()){case"dense":l=i(o,u,c);break;case"sparse":l=a(o,u,c);break}}break;default:throw new RangeError("Matrix must be a vector or two dimensional (size: "+tr(s)+")")}return l}function i(o,s,l){for(var u=o._data,c=[],f,d=0;d{var{typed:t,transpose:r,conj:n}=e;return t(Oue,{any:function(a){return n(r(a))}})});var Mue="zeros",Pqe=["typed","config","matrix","BigNumber"],l3=V(Mue,Pqe,e=>{var{typed:t,config:r,matrix:n,BigNumber:i}=e;return t(Mue,{"":function(){return r.matrix==="Array"?a([]):a([],"default")},"...number | BigNumber | string":function(u){var c=u[u.length-1];if(typeof c=="string"){var f=u.pop();return a(u,f)}else return r.matrix==="Array"?a(u):a(u,"default")},Array:a,Matrix:function(u){var c=u.storage();return a(u.valueOf(),c)},"Array | Matrix, string":function(u,c){return a(u.valueOf(),c)}});function a(l,u){var c=o(l),f=c?new i(0):0;if(s(l),u){var d=n(u);return l.length>0?d.resize(l,f):d}else{var p=[];return l.length>0?Bp(p,l,f):p}}function o(l){var u=!1;return l.forEach(function(c,f,d){It(c)&&(u=!0,d[f]=c.toNumber())}),u}function s(l){l.forEach(function(u){if(typeof u!="number"||!wt(u)||u<0)throw new Error("Parameters in function zeros must be positive integers")})}});var jue="fft",Iqe=["typed","matrix","addScalar","multiplyScalar","divideScalar","exp","tau","i","dotDivide","conj","pow","ceil","log2"],u3=V(jue,Iqe,e=>{var{typed:t,matrix:r,addScalar:n,multiplyScalar:i,divideScalar:a,exp:o,tau:s,i:l,dotDivide:u,conj:c,pow:f,ceil:d,log2:p}=e;return t(jue,{Array:h,Matrix:function(v){return v.create(h(v.toArray()))}});function h(b){var v=Yt(b);return v.length===1?A(b,v[0]):m(b.map(x=>h(x,v.slice(1))),0)}function m(b,v){var x=Yt(b);if(v!==0)return new Array(x[0]).fill(0).map((S,k)=>m(b[k],v-1));if(x.length===1)return A(b);function w(S){var k=Yt(S);return new Array(k[1]).fill(0).map((j,O)=>new Array(k[0]).fill(0).map((C,N)=>S[N][O]))}return w(m(w(b),1))}function g(b){for(var v=b.length,x=o(a(i(-1,i(l,s)),v)),w=[],S=1-v;Si(b[T],w[v-1+T])),...new Array(k-v).fill(0)],O=[...new Array(v+v-1).fill(0).map((I,T)=>a(1,w[T])),...new Array(k-(v+v-1)).fill(0)],C=A(j),N=A(O),D=new Array(k).fill(0).map((I,T)=>i(C[T],N[T])),P=u(c(h(c(D))),k),q=[],z=v-1;zO%2===0),v/2),...A(b.filter((j,O)=>O%2===1),v/2)],w=0;w{var{typed:t,fft:r,dotDivide:n,conj:i}=e;return t(Nue,{"Array | Matrix":function(o){var s=St(o)?o.size():Yt(o);return n(i(r(i(o))),s.reduce((l,u)=>l*u,1))}})});function Tue(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function Rqe(e){for(var t=1;t{var{typed:t,add:r,subtract:n,multiply:i,divide:a,max:o,map:s,abs:l,isPositive:u,isNegative:c,larger:f,smaller:d,matrix:p,bignumber:h,unaryMinus:m}=e;function g(j){return function(O,C,N,D){var P=!(C.length===2&&(C.every(S)||C.every(Fo)));if(P)throw new Error('"tspan" must be an Array of two numeric values or two units [tStart, tEnd]');var q=C[0],z=C[1],I=f(z,q),T=D.firstStep;if(T!==void 0&&!u(T))throw new Error('"firstStep" must be positive');var L=D.maxStep;if(L!==void 0&&!u(L))throw new Error('"maxStep" must be positive');var _=D.minStep;if(_&&c(_))throw new Error('"minStep" must be positive or zero');var Y=[q,z,T,_,L].filter(_e=>_e!==void 0);if(!(Y.every(S)||Y.every(Fo)))throw new Error('Inconsistent type of "t" dependant variables');for(var oe=1,te=D.tol?D.tol:1e-4,Q=D.minDelta?D.minDelta:.2,fe=D.maxDelta?D.maxDelta:5,Ie=D.maxIter?D.maxIter:1e4,Se=[q,z,...N,L,_].some(It),[Oe,ve,ye,me]=Se?[h(j.a),h(j.c),h(j.b),h(j.bp)]:[j.a,j.c,j.b,j.bp],ke=T?I?T:m(T):a(n(z,q),oe),$=[q],ae=[N],ce=n(ye,me),U=0,R=0,J=x(I),ee=w(I);J($[U],z);){var ie=[];ke=ee($[U],z,ke),ie.push(O($[U],ae[U]));for(var re=1;reFo(_e)?_e.value:_e)));Ee1/4&&($.push(r($[U],ke)),ae.push(r(ae[U],i(ke,ye,ie))),U++);var Ce=.84*(te/Ee)**(1/5);if(d(Ce,Q)?Ce=Q:f(Ce,fe)&&(Ce=fe),Ce=Se?h(Ce):Ce,ke=i(ke,Ce),L&&f(l(ke),L)?ke=I?L:m(L):_&&d(l(ke),_)&&(ke=I?_:m(_)),R++,R>Ie)throw new Error("Maximum number of iterations reached, try changing options")}return{t:$,y:ae}}}function A(j,O,C,N){var D=[[],[.5],[0,.75],[.2222222222222222,.3333333333333333,.4444444444444444]],P=[null,1/2,3/4,1],q=[2/9,1/3,4/9,0],z=[7/24,1/4,1/3,1/8],I={a:D,c:P,b:q,bp:z};return g(I)(j,O,C,N)}function b(j,O,C,N){var D=[[],[.2],[.075,.225],[.9777777777777777,-3.7333333333333334,3.5555555555555554],[2.9525986892242035,-11.595793324188385,9.822892851699436,-.2908093278463649],[2.8462752525252526,-10.757575757575758,8.906422717743473,.2784090909090909,-.2735313036020583],[.09114583333333333,0,.44923629829290207,.6510416666666666,-.322376179245283,.13095238095238096]],P=[null,1/5,3/10,4/5,8/9,1,1],q=[35/384,0,500/1113,125/192,-2187/6784,11/84,0],z=[5179/57600,0,7571/16695,393/640,-92097/339200,187/2100,1/40],I={a:D,c:P,b:q,bp:z};return g(I)(j,O,C,N)}function v(j,O,C,N){var D=N.method?N.method:"RK45",P={RK23:A,RK45:b};if(D.toUpperCase()in P){var q=Rqe({},N);return delete q.method,P[D.toUpperCase()](j,O,C,q)}else{var z=Object.keys(P).map(T=>'"'.concat(T,'"')),I="".concat(z.slice(0,-1).join(", ")," and ").concat(z.slice(-1));throw new Error('Unavailable method "'.concat(D,'". Available methods are ').concat(I))}}function x(j){return j?d:f}function w(j){var O=j?f:d;return function(C,N,D){var P=r(C,D);return O(P,N)?n(N,C):D}}function S(j){return It(j)||Qt(j)}function k(j,O,C,N){var D=v(j,O.toArray(),C.toArray(),N);return{t:p(D.t),y:p(D.y)}}return t("solveODE",{"function, Array, Array, Object":v,"function, Matrix, Matrix, Object":k,"function, Array, Array":(j,O,C)=>v(j,O,C,{}),"function, Matrix, Matrix":(j,O,C)=>k(j,O,C,{}),"function, Array, number | BigNumber | Unit":(j,O,C)=>{var N=v(j,O,[C],{});return{t:N.t,y:N.y.map(D=>D[0])}},"function, Matrix, number | BigNumber | Unit":(j,O,C)=>{var N=v(j,O.toArray(),[C],{});return{t:p(N.t),y:p(N.y.map(D=>D[0]))}},"function, Array, number | BigNumber | Unit, Object":(j,O,C,N)=>{var D=v(j,O,[C],N);return{t:D.t,y:D.y.map(P=>P[0])}},"function, Matrix, number | BigNumber | Unit, Object":(j,O,C,N)=>{var D=v(j,O.toArray(),[C],N);return{t:p(D.t),y:p(D.y.map(P=>P[0]))}}})});var Lqe="erf",zqe=["typed"],d3=V(Lqe,zqe,e=>{var{typed:t}=e;return t("name",{number:function(o){var s=Math.abs(o);return s>=Hqe?kd(o):s<=Uqe?kd(o)*r(s):s<=4?kd(o)*(1-n(s)):kd(o)*(1-i(s))},"Array | Matrix":t.referToSelf(a=>o=>jt(o,a))});function r(a){var o=a*a,s=HA[0][4]*o,l=o,u;for(u=0;u<3;u+=1)s=(s+HA[0][u])*o,l=(l+gS[0][u])*o;return a*(s+HA[0][3])/(l+gS[0][3])}function n(a){var o=HA[1][8]*a,s=a,l;for(l=0;l<7;l+=1)o=(o+HA[1][l])*a,s=(s+gS[1][l])*a;var u=(o+HA[1][7])/(s+gS[1][7]),c=parseInt(a*16)/16,f=(a-c)*(a+c);return Math.exp(-c*c)*Math.exp(-f)*u}function i(a){var o=1/(a*a),s=HA[2][5]*o,l=o,u;for(u=0;u<4;u+=1)s=(s+HA[2][u])*o,l=(l+gS[2][u])*o;var c=o*(s+HA[2][4])/(l+gS[2][4]);c=(Wqe-c)/a,o=parseInt(a*16)/16;var f=(a-o)*(a+o);return Math.exp(-o*o)*Math.exp(-f)*c}}),Uqe=.46875,Wqe=.5641895835477563,HA=[[3.1611237438705655,113.86415415105016,377.485237685302,3209.3775891384694,.18577770618460315],[.5641884969886701,8.883149794388377,66.11919063714163,298.6351381974001,881.952221241769,1712.0476126340707,2051.0783778260716,1230.3393547979972,21531153547440383e-24],[.30532663496123236,.36034489994980445,.12578172611122926,.016083785148742275,.0006587491615298378,.016315387137302097]],gS=[[23.601290952344122,244.02463793444417,1282.6165260773723,2844.236833439171],[15.744926110709835,117.6939508913125,537.1811018620099,1621.3895745666903,3290.7992357334597,4362.619090143247,3439.3676741437216,1230.3393548037495],[2.568520192289822,1.8729528499234604,.5279051029514285,.06051834131244132,.0023352049762686918]],Hqe=Math.pow(2,53);var Fue="zeta",Vqe=["typed","config","multiply","pow","divide","factorial","equal","smallerEq","isNegative","gamma","sin","subtract","add","?Complex","?BigNumber","pi"],p3=V(Fue,Vqe,e=>{var{typed:t,config:r,multiply:n,pow:i,divide:a,factorial:o,equal:s,smallerEq:l,isNegative:u,gamma:c,sin:f,subtract:d,add:p,Complex:h,BigNumber:m,pi:g}=e;return t(Fue,{number:S=>A(S,k=>k,()=>20),BigNumber:S=>A(S,k=>new m(k),()=>Math.abs(Math.log10(r.epsilon))),Complex:b});function A(S,k,j){return s(S,0)?k(-.5):s(S,1)?k(NaN):isFinite(S)?v(S,k,j,O=>O):u(S)?k(NaN):k(1)}function b(S){return S.re===0&&S.im===0?new h(-.5):S.re===1?new h(NaN,NaN):S.re===1/0&&S.im===0?new h(1):S.im===1/0||S.re===-1/0?new h(NaN,NaN):v(S,k=>k,k=>Math.round(1.3*15+.9*Math.abs(k.im)),k=>k.re)}function v(S,k,j,O){var C=j(S);if(O(S)>-(C-1)/2)return w(S,k(C),k);var N=n(i(2,S),i(k(g),d(S,1)));return N=n(N,f(n(a(k(g),2),S))),N=n(N,c(d(1,S))),n(N,v(d(1,S),k,j,O))}function x(S,k){for(var j=S,O=S;l(O,k);O=p(O,1)){var C=a(n(o(p(k,d(O,1))),i(4,O)),n(o(d(k,O)),o(n(2,O))));j=p(j,C)}return n(k,j)}function w(S,k,j){for(var O=a(1,n(x(j(0),k),d(1,i(2,d(1,S))))),C=j(0),N=j(1);l(N,k);N=p(N,1))C=p(C,a(n((-1)**(N-1),x(N,k)),i(N,S)));return n(O,C)}});var _ue="mode",Gqe=["typed","isNaN","isNumeric"],m3=V(_ue,Gqe,e=>{var{typed:t,isNaN:r,isNumeric:n}=e;return t(_ue,{"Array | Matrix":i,"...":function(o){return i(o)}});function i(a){a=mr(a.valueOf());var o=a.length;if(o===0)throw new Error("Cannot calculate mode of an empty array");for(var s={},l=[],u=0,c=0;cu&&(u=s[f],l=[f])}return l}});function La(e,t,r){var n;return String(e).indexOf("Unexpected type")!==-1?(n=arguments.length>2?" (type: "+qr(r)+", value: "+JSON.stringify(r)+")":" (type: "+e.data.actual+")",new TypeError("Cannot calculate "+t+", unexpected type of argument"+n)):String(e).indexOf("complex numbers")!==-1?(n=arguments.length>2?" (type: "+qr(r)+", value: "+JSON.stringify(r)+")":"",new TypeError("Cannot calculate "+t+", no ordering relation is defined for complex numbers"+n)):e}var Pue="prod",Qqe=["typed","config","multiplyScalar","numeric"],h3=V(Pue,Qqe,e=>{var{typed:t,config:r,multiplyScalar:n,numeric:i}=e;return t(Pue,{"Array | Matrix":a,"Array | Matrix, number | BigNumber":function(s,l){throw new Error("prod(A, dim) is not yet supported")},"...":function(s){return a(s)}});function a(o){var s;if(au(o,function(l){try{s=s===void 0?l:n(s,l)}catch(u){throw La(u,"prod",l)}}),typeof s=="string"&&(s=i(s,r.number)),s===void 0)throw new Error("Cannot calculate prod of an empty array");return s}});var Iue="format",Yqe=["typed"],A3=V(Iue,Yqe,e=>{var{typed:t}=e;return t(Iue,{any:tr,"any, Object | function | number | BigNumber":tr})});var Bue="bin",Zqe=["typed","format"],g3=V(Bue,Zqe,e=>{var{typed:t,format:r}=e;return t(Bue,{"number | BigNumber":function(i){return r(i,{notation:"bin"})},"number | BigNumber, number | BigNumber":function(i,a){return r(i,{notation:"bin",wordSize:a})}})});var Rue="oct",Xqe=["typed","format"],v3=V(Rue,Xqe,e=>{var{typed:t,format:r}=e;return t(Rue,{"number | BigNumber":function(i){return r(i,{notation:"oct"})},"number | BigNumber, number | BigNumber":function(i,a){return r(i,{notation:"oct",wordSize:a})}})});var $ue="hex",Kqe=["typed","format"],y3=V($ue,Kqe,e=>{var{typed:t,format:r}=e;return t($ue,{"number | BigNumber":function(i){return r(i,{notation:"hex"})},"number | BigNumber, number | BigNumber":function(i,a){return r(i,{notation:"hex",wordSize:a})}})});var b3=/\$([\w.]+)/g;var que="print",Jqe=["typed"],vS=V(que,Jqe,e=>{var{typed:t}=e;return t(que,{"string, Object | Array":Lue,"string, Object | Array, number | Object":Lue})});function Lue(e,t,r){return e.replace(b3,function(n,i){var a=i.split("."),o=t[a.shift()];for(o!==void 0&&o.isMatrix&&(o=o.toArray());a.length&&o!==void 0;){var s=a.shift();o=s?o[s]:o+"."}return o!==void 0?da(o)?o:tr(o,r):n})}var zue="to",eLe=["typed","matrix","concat"],x3=V(zue,eLe,e=>{var{typed:t,matrix:r,concat:n}=e,i=fr({typed:t,matrix:r,concat:n});return t(zue,{"Unit, Unit | string":(a,o)=>a.to(o)},i({Ds:!0}))});var Uue="isPrime",tLe=["typed"],w3=V(Uue,tLe,e=>{var{typed:t}=e;return t(Uue,{number:function(n){if(n*0!==0)return!1;if(n<=3)return n>1;if(n%2===0||n%3===0)return!1;for(var i=5;i*i<=n;i+=6)if(n%i===0||n%(i+2)===0)return!1;return!0},BigNumber:function(n){if(n.toNumber()*0!==0)return!1;if(n.lte(3))return n.gt(1);if(n.mod(2).eq(0)||n.mod(3).eq(0))return!1;if(n.lt(Math.pow(2,32))){for(var i=n.toNumber(),a=5;a*a<=i;a+=6)if(i%a===0||i%(a+2)===0)return!1;return!0}function o(b,v,x){for(var w=1;!v.eq(0);)v.mod(2).eq(0)?(v=v.div(2),b=b.mul(b).mod(x)):(v=v.sub(1),w=b.mul(w).mod(x));return w}var s=n.constructor.clone({precision:n.toFixed(0).length*2});n=new s(n);for(var l=0,u=n.sub(1);u.mod(2).eq(0);)u=u.div(2),l+=1;var c=null;if(n.lt("3317044064679887385961981"))c=[2,3,5,7,11,13,17,19,23,29,31,37,41].filter(b=>bn=>jt(n,r))})});var rLe="numeric",nLe=["number","?bignumber","?fraction"],S3=V(rLe,nLe,e=>{var{number:t,bignumber:r,fraction:n}=e,i={string:!0,number:!0,BigNumber:!0,Fraction:!0},a={number:o=>t(o),BigNumber:r?o=>r(o):pS,Fraction:n?o=>n(o):KF};return function(s){var l=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"number",u=arguments.length>2?arguments[2]:void 0;if(u!==void 0)throw new SyntaxError("numeric() takes one or two arguments");var c=qr(s);if(!(c in i))throw new TypeError("Cannot convert "+s+' of type "'+c+'"; valid input types are '+Object.keys(i).join(", "));if(!(l in a))throw new TypeError("Cannot convert "+s+' to type "'+l+'"; valid output types are '+Object.keys(a).join(", "));return l===c?s:a[l](s)}});var Wue="divideScalar",iLe=["typed","numeric"],E3=V(Wue,iLe,e=>{var{typed:t,numeric:r}=e;return t(Wue,{"number, number":function(i,a){return i/a},"Complex, Complex":function(i,a){return i.div(a)},"BigNumber, BigNumber":function(i,a){return i.div(a)},"Fraction, Fraction":function(i,a){return i.div(a)},"Unit, number | Complex | Fraction | BigNumber | Unit":(n,i)=>n.divide(i),"number | Fraction | Complex | BigNumber, Unit":(n,i)=>i.divideInto(n)})});var Hue="pow",aLe=["typed","config","identity","multiply","matrix","inv","fraction","number","Complex"],k3=V(Hue,aLe,e=>{var{typed:t,config:r,identity:n,multiply:i,matrix:a,inv:o,number:s,fraction:l,Complex:u}=e;return t(Hue,{"number, number":c,"Complex, Complex":function(h,m){return h.pow(m)},"BigNumber, BigNumber":function(h,m){return m.isInteger()||h>=0||r.predictable?h.pow(m):new u(h.toNumber(),0).pow(m.toNumber(),0)},"Fraction, Fraction":function(h,m){var g=h.pow(m);if(g!=null)return g;if(r.predictable)throw new Error("Result of pow is non-rational and cannot be expressed as a fraction");return c(h.valueOf(),m.valueOf())},"Array, number":f,"Array, BigNumber":function(h,m){return f(h,m.toNumber())},"Matrix, number":d,"Matrix, BigNumber":function(h,m){return d(h,m.toNumber())},"Unit, number | BigNumber":function(h,m){return h.pow(m)}});function c(p,h){if(r.predictable&&!wt(h)&&p<0)try{var m=l(h),g=s(m);if((h===g||Math.abs((h-g)/h)<1e-14)&&m.d%2===1)return(m.n%2===0?1:-1)*Math.pow(-p,h)}catch{}return r.predictable&&(p<-1&&h===1/0||p>-1&&p<0&&h===-1/0)?NaN:wt(h)||p>=0||r.predictable?BW(p,h):p*p<1&&h===1/0||p*p>1&&h===-1/0?0:new u(p,0).pow(h,0)}function f(p,h){if(!wt(h))throw new TypeError("For A^b, b must be an integer (value is "+h+")");var m=Yt(p);if(m.length!==2)throw new Error("For A^b, A must be 2 dimensional (A has "+m.length+" dimensions)");if(m[0]!==m[1])throw new Error("For A^b, A must be square (size is "+m[0]+"x"+m[1]+")");if(h<0)try{return f(o(p),-h)}catch(b){throw b.message==="Cannot calculate inverse, determinant is zero"?new TypeError("For A^b, when A is not invertible, b must be a positive integer (value is "+h+")"):b}for(var g=n(m[0]).valueOf(),A=p;h>=1;)(h&1)===1&&(g=i(A,g)),h>>=1,A=i(A,A);return g}function d(p,h){return a(f(p.valueOf(),h))}});var yS="Number of decimals in function round must be an integer",Vue="round",oLe=["typed","config","matrix","equalScalar","zeros","BigNumber","DenseMatrix"],C3=V(Vue,oLe,e=>{var{typed:t,config:r,matrix:n,equalScalar:i,zeros:a,BigNumber:o,DenseMatrix:s}=e,l=Gn({typed:t,equalScalar:i}),u=An({typed:t,DenseMatrix:s}),c=vo({typed:t});function f(d){return Math.abs(Gw(d).exponent)}return t(Vue,{number:function(p){var h=tS(p,f(r.epsilon)),m=Oa(p,h,r.epsilon)?h:p;return tS(m)},"number, number":function(p,h){var m=f(r.epsilon);if(h>=m)return tS(p,h);var g=tS(p,m),A=Oa(p,g,r.epsilon)?g:p;return tS(A,h)},"number, BigNumber":function(p,h){if(!h.isInteger())throw new TypeError(yS);return new o(p).toDecimalPlaces(h.toNumber())},Complex:function(p){return p.round()},"Complex, number":function(p,h){if(h%1)throw new TypeError(yS);return p.round(h)},"Complex, BigNumber":function(p,h){if(!h.isInteger())throw new TypeError(yS);var m=h.toNumber();return p.round(m)},BigNumber:function(p){var h=new o(p).toDecimalPlaces(f(r.epsilon)),m=_o(p,h,r.epsilon)?h:p;return m.toDecimalPlaces(0)},"BigNumber, BigNumber":function(p,h){if(!h.isInteger())throw new TypeError(yS);var m=f(r.epsilon);if(h>=m)return p.toDecimalPlaces(h.toNumber());var g=p.toDecimalPlaces(m),A=_o(p,g,r.epsilon)?g:p;return A.toDecimalPlaces(h.toNumber())},Fraction:function(p){return p.round()},"Fraction, number":function(p,h){if(h%1)throw new TypeError(yS);return p.round(h)},"Fraction, BigNumber":function(p,h){if(!h.isInteger())throw new TypeError(yS);return p.round(h.toNumber())},"Unit, number, Unit":t.referToSelf(d=>function(p,h,m){var g=p.toNumeric(m);return m.multiply(d(g,h))}),"Unit, BigNumber, Unit":t.referToSelf(d=>(p,h,m)=>d(p,h.toNumber(),m)),"Unit, Unit":t.referToSelf(d=>(p,h)=>d(p,0,h)),"Array | Matrix, number, Unit":t.referToSelf(d=>(p,h,m)=>jt(p,g=>d(g,h,m),!0)),"Array | Matrix, BigNumber, Unit":t.referToSelf(d=>(p,h,m)=>d(p,h.toNumber(),m)),"Array | Matrix, Unit":t.referToSelf(d=>(p,h)=>d(p,0,h)),"Array | Matrix":t.referToSelf(d=>p=>jt(p,d,!0)),"SparseMatrix, number | BigNumber":t.referToSelf(d=>(p,h)=>l(p,h,d,!1)),"DenseMatrix, number | BigNumber":t.referToSelf(d=>(p,h)=>c(p,h,d,!1)),"Array, number | BigNumber":t.referToSelf(d=>(p,h)=>c(n(p),h,d,!1).valueOf()),"number | Complex | BigNumber | Fraction, SparseMatrix":t.referToSelf(d=>(p,h)=>i(p,0)?a(h.size(),h.storage()):u(h,p,d,!0)),"number | Complex | BigNumber | Fraction, DenseMatrix":t.referToSelf(d=>(p,h)=>i(p,0)?a(h.size(),h.storage()):c(h,p,d,!0)),"number | Complex | BigNumber | Fraction, Array":t.referToSelf(d=>(p,h)=>c(n(h),p,d,!0).valueOf())})});var Gue="log",sLe=["config","typed","divideScalar","Complex"],D3=V(Gue,sLe,e=>{var{typed:t,config:r,divideScalar:n,Complex:i}=e;return t(Gue,{number:function(o){return o>=0||r.predictable?Zse(o):new i(o,0).log()},Complex:function(o){return o.log()},BigNumber:function(o){return!o.isNegative()||r.predictable?o.ln():new i(o.toNumber(),0).log()},"any, any":t.referToSelf(a=>(o,s)=>n(a(o),a(s)))})});var Que="log1p",lLe=["typed","config","divideScalar","log","Complex"],O3=V(Que,lLe,e=>{var{typed:t,config:r,divideScalar:n,log:i,Complex:a}=e;return t(Que,{number:function(l){return l>=-1||r.predictable?lT(l):o(new a(l,0))},Complex:o,BigNumber:function(l){var u=l.plus(1);return!u.isNegative()||r.predictable?u.ln():o(new a(l.toNumber(),0))},"Array | Matrix":t.referToSelf(s=>l=>jt(l,s)),"any, any":t.referToSelf(s=>(l,u)=>n(s(l),i(u)))});function o(s){var l=s.re+1;return new a(Math.log(Math.sqrt(l*l+s.im*s.im)),Math.atan2(s.im,l))}});var Yue="nthRoots",uLe=["config","typed","divideScalar","Complex"],M3=V(Yue,uLe,e=>{var{typed:t,config:r,divideScalar:n,Complex:i}=e,a=[function(l){return new i(l,0)},function(l){return new i(0,l)},function(l){return new i(-l,0)},function(l){return new i(0,-l)}];function o(s,l){if(l<0)throw new Error("Root must be greater than zero");if(l===0)throw new Error("Root must be non-zero");if(l%1!==0)throw new Error("Root must be an integer");if(s===0||s.abs()===0)return[new i(0,0)];var u=typeof s=="number",c;(u||s.re===0||s.im===0)&&(u?c=2*+(s<0):s.im===0?c=2*+(s.re<0):c=2*+(s.im<0)+1);for(var f=s.arg(),d=s.abs(),p=[],h=Math.pow(d,1/l),m=0;m{var{typed:t,equalScalar:r,matrix:n,pow:i,DenseMatrix:a,concat:o}=e,s=xi({typed:t}),l=Qo({typed:t,DenseMatrix:a}),u=Gn({typed:t,equalScalar:r}),c=An({typed:t,DenseMatrix:a}),f=fr({typed:t,matrix:n,concat:o}),d={};for(var p in i.signatures)Object.prototype.hasOwnProperty.call(i.signatures,p)&&!p.includes("Matrix")&&!p.includes("Array")&&(d[p]=i.signatures[p]);var h=t(d);return t(Zue,f({elop:h,SS:l,DS:s,Ss:u,sS:c}))});var Xue="dotDivide",fLe=["typed","matrix","equalScalar","divideScalar","DenseMatrix","concat"],N3=V(Xue,fLe,e=>{var{typed:t,matrix:r,equalScalar:n,divideScalar:i,DenseMatrix:a,concat:o}=e,s=yo({typed:t,equalScalar:n}),l=xi({typed:t}),u=Qo({typed:t,DenseMatrix:a}),c=Gn({typed:t,equalScalar:n}),f=An({typed:t,DenseMatrix:a}),d=fr({typed:t,matrix:r,concat:o});return t(Xue,d({elop:i,SS:u,DS:l,SD:s,Ss:c,sS:f}))});function Zm(e){var{DenseMatrix:t}=e;return function(n,i,a){var o=n.size();if(o.length!==2)throw new RangeError("Matrix must be two dimensional (size: "+tr(o)+")");var s=o[0],l=o[1];if(s!==l)throw new RangeError("Matrix must be square (size: "+tr(o)+")");var u=[];if(St(i)){var c=i.size(),f=i._data;if(c.length===1){if(c[0]!==s)throw new RangeError("Dimension mismatch. Matrix columns must match vector length.");for(var d=0;d{var{typed:t,matrix:r,divideScalar:n,multiplyScalar:i,subtractScalar:a,equalScalar:o,DenseMatrix:s}=e,l=Zm({DenseMatrix:s});return t(Kue,{"SparseMatrix, Array | Matrix":function(d,p){return c(d,p)},"DenseMatrix, Array | Matrix":function(d,p){return u(d,p)},"Array, Array | Matrix":function(d,p){var h=r(d),m=u(h,p);return m.valueOf()}});function u(f,d){d=l(f,d,!0);for(var p=d._data,h=f._size[0],m=f._size[1],g=[],A=f._data,b=0;bx&&(k.push(g[N]),j.push(D))}if(o(S,0))throw new Error("Linear system cannot be solved since matrix is singular");for(var P=n(w,S),q=0,z=j.length;q{var{typed:t,matrix:r,divideScalar:n,multiplyScalar:i,subtractScalar:a,equalScalar:o,DenseMatrix:s}=e,l=Zm({DenseMatrix:s});return t(Jue,{"SparseMatrix, Array | Matrix":function(d,p){return c(d,p)},"DenseMatrix, Array | Matrix":function(d,p){return u(d,p)},"Array, Array | Matrix":function(d,p){var h=r(d),m=u(h,p);return m.valueOf()}});function u(f,d){d=l(f,d,!0);for(var p=d._data,h=f._size[0],m=f._size[1],g=[],A=f._data,b=m-1;b>=0;b--){var v=p[b][0]||0,x=void 0;if(o(v,0))x=0;else{var w=A[b][b];if(o(w,0))throw new Error("Linear system cannot be solved since matrix is singular");x=n(v,w);for(var S=b-1;S>=0;S--)p[S]=[a(p[S][0]||0,i(x,A[S][b]))]}g[b]=[x]}return new s({data:g,size:[h,1]})}function c(f,d){d=l(f,d,!0);for(var p=d._data,h=f._size[0],m=f._size[1],g=f._values,A=f._index,b=f._ptr,v=[],x=m-1;x>=0;x--){var w=p[x][0]||0;if(o(w,0))v[x]=[0];else{for(var S=0,k=[],j=[],O=b[x],C=b[x+1],N=C-1;N>=O;N--){var D=A[N];D===x?S=g[N]:D{var{typed:t,matrix:r,divideScalar:n,multiplyScalar:i,subtractScalar:a,equalScalar:o,DenseMatrix:s}=e,l=Zm({DenseMatrix:s});return t(ece,{"SparseMatrix, Array | Matrix":function(d,p){return c(d,p)},"DenseMatrix, Array | Matrix":function(d,p){return u(d,p)},"Array, Array | Matrix":function(d,p){var h=r(d),m=u(h,p);return m.map(g=>g.valueOf())}});function u(f,d){for(var p=[l(f,d,!0)._data.map(j=>j[0])],h=f._data,m=f._size[0],g=f._size[1],A=0;Anew s({data:j.map(O=>[O]),size:[m,1]}))}function c(f,d){for(var p=[l(f,d,!0)._data.map(oe=>oe[0])],h=f._size[0],m=f._size[1],g=f._values,A=f._index,b=f._ptr,v=0;vv&&(k.push(g[D]),j.push(P))}if(o(N,0))if(o(S[v],0)){if(w===0){var T=[...S];T[v]=1;for(var L=0,_=j.length;L<_;L++){var Y=j[L];T[Y]=a(T[Y],k[L])}p.push(T)}}else{if(w===0)return[];p.splice(w,1),w-=1,x-=1}else{S[v]=n(S[v],N);for(var q=0,z=j.length;qnew s({data:oe.map(te=>[te]),size:[h,1]}))}});var tce="usolveAll",hLe=["typed","matrix","divideScalar","multiplyScalar","subtractScalar","equalScalar","DenseMatrix"],P3=V(tce,hLe,e=>{var{typed:t,matrix:r,divideScalar:n,multiplyScalar:i,subtractScalar:a,equalScalar:o,DenseMatrix:s}=e,l=Zm({DenseMatrix:s});return t(tce,{"SparseMatrix, Array | Matrix":function(d,p){return c(d,p)},"DenseMatrix, Array | Matrix":function(d,p){return u(d,p)},"Array, Array | Matrix":function(d,p){var h=r(d),m=u(h,p);return m.map(g=>g.valueOf())}});function u(f,d){for(var p=[l(f,d,!0)._data.map(j=>j[0])],h=f._data,m=f._size[0],g=f._size[1],A=g-1;A>=0;A--)for(var b=p.length,v=0;v=0;k--)S[k]=a(S[k],h[k][A]);p.push(S)}}else{if(v===0)return[];p.splice(v,1),v-=1,b-=1}else{x[A]=n(x[A],h[A][A]);for(var w=A-1;w>=0;w--)x[w]=a(x[w],i(x[A],h[w][A]))}}return p.map(j=>new s({data:j.map(O=>[O]),size:[m,1]}))}function c(f,d){for(var p=[l(f,d,!0)._data.map(oe=>oe[0])],h=f._size[0],m=f._size[1],g=f._values,A=f._index,b=f._ptr,v=m-1;v>=0;v--)for(var x=p.length,w=0;w=O;D--){var P=A[D];P===v?N=g[D]:Pnew s({data:oe.map(te=>[te]),size:[h,1]}))}});var ALe="matAlgo08xS0Sid",gLe=["typed","equalScalar"],bS=V(ALe,gLe,e=>{var{typed:t,equalScalar:r}=e;return function(i,a,o){var s=i._values,l=i._index,u=i._ptr,c=i._size,f=i._datatype||i._data===void 0?i._datatype:i.getDataType(),d=a._values,p=a._index,h=a._ptr,m=a._size,g=a._datatype||a._data===void 0?a._datatype:a.getDataType();if(c.length!==m.length)throw new nr(c.length,m.length);if(c[0]!==m[0]||c[1]!==m[1])throw new RangeError("Dimension mismatch. Matrix A ("+c+") must match Matrix B ("+m+")");if(!s||!d)throw new Error("Cannot perform operation on Pattern Sparse Matrices");var A=c[0],b=c[1],v,x=r,w=0,S=o;typeof f=="string"&&f===g&&f!=="mixed"&&(v=f,x=t.find(r,[v,v]),w=t.convert(0,v),S=t.find(o,[v,v]));for(var k=[],j=[],O=[],C=[],N=[],D,P,q,z,I=0;I{var{typed:t,matrix:r}=e;return{"Array, number":t.referTo("DenseMatrix, number",n=>(i,a)=>n(r(i),a).valueOf()),"Array, BigNumber":t.referTo("DenseMatrix, BigNumber",n=>(i,a)=>n(r(i),a).valueOf()),"number, Array":t.referTo("number, DenseMatrix",n=>(i,a)=>n(i,r(a)).valueOf()),"BigNumber, Array":t.referTo("BigNumber, DenseMatrix",n=>(i,a)=>n(i,r(a)).valueOf())}});var rce="leftShift",vLe=["typed","matrix","equalScalar","zeros","DenseMatrix","concat"],I3=V(rce,vLe,e=>{var{typed:t,matrix:r,equalScalar:n,zeros:i,DenseMatrix:a,concat:o}=e,s=ou({typed:t}),l=yo({typed:t,equalScalar:n}),u=bS({typed:t,equalScalar:n}),c=Dc({typed:t,DenseMatrix:a}),f=Gn({typed:t,equalScalar:n}),d=vo({typed:t}),p=fr({typed:t,matrix:r,concat:o}),h=xS({typed:t,matrix:r});return t(rce,{"number, number":zW,"BigNumber, BigNumber":Vle,"SparseMatrix, number | BigNumber":t.referToSelf(m=>(g,A)=>n(A,0)?g.clone():f(g,A,m,!1)),"DenseMatrix, number | BigNumber":t.referToSelf(m=>(g,A)=>n(A,0)?g.clone():d(g,A,m,!1)),"number | BigNumber, SparseMatrix":t.referToSelf(m=>(g,A)=>n(g,0)?i(A.size(),A.storage()):c(A,g,m,!0)),"number | BigNumber, DenseMatrix":t.referToSelf(m=>(g,A)=>n(g,0)?i(A.size(),A.storage()):d(A,g,m,!0))},h,p({SS:u,DS:s,SD:l}))});var nce="rightArithShift",yLe=["typed","matrix","equalScalar","zeros","DenseMatrix","concat"],B3=V(nce,yLe,e=>{var{typed:t,matrix:r,equalScalar:n,zeros:i,DenseMatrix:a,concat:o}=e,s=ou({typed:t}),l=yo({typed:t,equalScalar:n}),u=bS({typed:t,equalScalar:n}),c=Dc({typed:t,DenseMatrix:a}),f=Gn({typed:t,equalScalar:n}),d=vo({typed:t}),p=fr({typed:t,matrix:r,concat:o}),h=xS({typed:t,matrix:r});return t(nce,{"number, number":UW,"BigNumber, BigNumber":Gle,"SparseMatrix, number | BigNumber":t.referToSelf(m=>(g,A)=>n(A,0)?g.clone():f(g,A,m,!1)),"DenseMatrix, number | BigNumber":t.referToSelf(m=>(g,A)=>n(A,0)?g.clone():d(g,A,m,!1)),"number | BigNumber, SparseMatrix":t.referToSelf(m=>(g,A)=>n(g,0)?i(A.size(),A.storage()):c(A,g,m,!0)),"number | BigNumber, DenseMatrix":t.referToSelf(m=>(g,A)=>n(g,0)?i(A.size(),A.storage()):d(A,g,m,!0))},h,p({SS:u,DS:s,SD:l}))});var ice="rightLogShift",bLe=["typed","matrix","equalScalar","zeros","DenseMatrix","concat"],R3=V(ice,bLe,e=>{var{typed:t,matrix:r,equalScalar:n,zeros:i,DenseMatrix:a,concat:o}=e,s=ou({typed:t}),l=yo({typed:t,equalScalar:n}),u=bS({typed:t,equalScalar:n}),c=Dc({typed:t,DenseMatrix:a}),f=Gn({typed:t,equalScalar:n}),d=vo({typed:t}),p=fr({typed:t,matrix:r,concat:o}),h=xS({typed:t,matrix:r});return t(ice,{"number, number":WW,"SparseMatrix, number | BigNumber":t.referToSelf(m=>(g,A)=>n(A,0)?g.clone():f(g,A,m,!1)),"DenseMatrix, number | BigNumber":t.referToSelf(m=>(g,A)=>n(A,0)?g.clone():d(g,A,m,!1)),"number | BigNumber, SparseMatrix":t.referToSelf(m=>(g,A)=>n(g,0)?i(A.size(),A.storage()):c(A,g,m,!0)),"number | BigNumber, DenseMatrix":t.referToSelf(m=>(g,A)=>n(g,0)?i(A.size(),A.storage()):d(A,g,m,!0))},h,p({SS:u,DS:s,SD:l}))});var ace="and",xLe=["typed","matrix","equalScalar","zeros","not","concat"],wS=V(ace,xLe,e=>{var{typed:t,matrix:r,equalScalar:n,zeros:i,not:a,concat:o}=e,s=yo({typed:t,equalScalar:n}),l=Y0({typed:t,equalScalar:n}),u=Gn({typed:t,equalScalar:n}),c=vo({typed:t}),f=fr({typed:t,matrix:r,concat:o});return t(ace,{"number, number":ZW,"Complex, Complex":function(p,h){return(p.re!==0||p.im!==0)&&(h.re!==0||h.im!==0)},"BigNumber, BigNumber":function(p,h){return!p.isZero()&&!h.isZero()&&!p.isNaN()&&!h.isNaN()},"Unit, Unit":t.referToSelf(d=>(p,h)=>d(p.value||0,h.value||0)),"SparseMatrix, any":t.referToSelf(d=>(p,h)=>a(h)?i(p.size(),p.storage()):u(p,h,d,!1)),"DenseMatrix, any":t.referToSelf(d=>(p,h)=>a(h)?i(p.size(),p.storage()):c(p,h,d,!1)),"any, SparseMatrix":t.referToSelf(d=>(p,h)=>a(p)?i(p.size(),p.storage()):u(h,p,d,!0)),"any, DenseMatrix":t.referToSelf(d=>(p,h)=>a(p)?i(p.size(),p.storage()):c(h,p,d,!0)),"Array, any":t.referToSelf(d=>(p,h)=>d(r(p),h).valueOf()),"any, Array":t.referToSelf(d=>(p,h)=>d(p,r(h)).valueOf())},f({SS:l,DS:s}))});var $3="compare",wLe=["typed","config","matrix","equalScalar","BigNumber","Fraction","DenseMatrix","concat"],q3=V($3,wLe,e=>{var{typed:t,config:r,equalScalar:n,matrix:i,BigNumber:a,Fraction:o,DenseMatrix:s,concat:l}=e,u=xi({typed:t}),c=Q0({typed:t,equalScalar:n}),f=An({typed:t,DenseMatrix:s}),d=fr({typed:t,matrix:i,concat:l}),p=Dd({typed:t});return t($3,SLe({typed:t,config:r}),{"boolean, boolean":function(m,g){return m===g?0:m>g?1:-1},"BigNumber, BigNumber":function(m,g){return _o(m,g,r.epsilon)?new a(0):new a(m.cmp(g))},"Fraction, Fraction":function(m,g){return new o(m.compare(g))},"Complex, Complex":function(){throw new TypeError("No ordering relation is defined for complex numbers")}},p,d({SS:c,DS:u,Ss:f}))}),SLe=V($3,["typed","config"],e=>{var{typed:t,config:r}=e;return t($3,{"number, number":function(i,a){return Oa(i,a,r.epsilon)?0:i>a?1:-1}})});var ky=Ae(sce(),1);var lce="compareNatural",ELe=["typed","compare"],L3=V(lce,ELe,e=>{var{typed:t,compare:r}=e,n=r.signatures["boolean,boolean"];return t(lce,{"any, any":i});function i(l,u){var c=qr(l),f=qr(u),d;if((c==="number"||c==="BigNumber"||c==="Fraction")&&(f==="number"||f==="BigNumber"||f==="Fraction"))return d=r(l,u),d.toString()!=="0"?d>0?1:-1:(0,ky.default)(c,f);var p=["Array","DenseMatrix","SparseMatrix"];if(p.includes(c)||p.includes(f))return d=a(i,l,u),d!==0?d:(0,ky.default)(c,f);if(c!==f)return(0,ky.default)(c,f);if(c==="Complex")return kLe(l,u);if(c==="Unit")return l.equalBase(u)?i(l.value,u.value):o(i,l.formatUnits(),u.formatUnits());if(c==="boolean")return n(l,u);if(c==="string")return(0,ky.default)(l,u);if(c==="Object")return s(i,l,u);if(c==="null"||c==="undefined")return 0;throw new TypeError('Unsupported type of value "'+c+'"')}function a(l,u,c){return vf(u)&&vf(c)?o(l,u.toJSON().values,c.toJSON().values):vf(u)?a(l,u.toArray(),c):vf(c)?a(l,u,c.toArray()):qA(u)?a(l,u.toJSON().data,c):qA(c)?a(l,u,c.toJSON().data):Array.isArray(u)?Array.isArray(c)?o(l,u,c):a(l,u,[c]):a(l,[u],c)}function o(l,u,c){for(var f=0,d=Math.min(u.length,c.length);fc.length?1:u.lengtht.re?1:e.ret.im?1:e.im{var{typed:t,matrix:r,concat:n}=e,i=fr({typed:t,matrix:r,concat:n});return t(uce,dT,i({elop:dT,Ds:!0}))});var U3="equal",DLe=["typed","matrix","equalScalar","DenseMatrix","concat"],W3=V(U3,DLe,e=>{var{typed:t,matrix:r,equalScalar:n,DenseMatrix:i,concat:a}=e,o=xi({typed:t}),s=Qo({typed:t,DenseMatrix:i}),l=An({typed:t,DenseMatrix:i}),u=fr({typed:t,matrix:r,concat:a});return t(U3,OLe({typed:t,equalScalar:n}),u({elop:n,SS:s,DS:o,Ss:l}))}),OLe=V(U3,["typed","equalScalar"],e=>{var{typed:t,equalScalar:r}=e;return t(U3,{"any, any":function(i,a){return i===null?a===null:a===null?i===null:i===void 0?a===void 0:a===void 0?i===void 0:r(i,a)}})});var cce="equalText",MLe=["typed","compareText","isZero"],H3=V(cce,MLe,e=>{var{typed:t,compareText:r,isZero:n}=e;return t(cce,{"any, any":function(a,o){return n(r(a,o))}})});var V3="smaller",jLe=["typed","config","matrix","DenseMatrix","concat"],G3=V(V3,jLe,e=>{var{typed:t,config:r,matrix:n,DenseMatrix:i,concat:a}=e,o=xi({typed:t}),s=Qo({typed:t,DenseMatrix:i}),l=An({typed:t,DenseMatrix:i}),u=fr({typed:t,matrix:n,concat:a}),c=Dd({typed:t});return t(V3,NLe({typed:t,config:r}),{"boolean, boolean":(f,d)=>ff.compare(d)===-1,"Complex, Complex":function(d,p){throw new TypeError("No ordering relation is defined for complex numbers")}},c,u({SS:s,DS:o,Ss:l}))}),NLe=V(V3,["typed","config"],e=>{var{typed:t,config:r}=e;return t(V3,{"number, number":function(i,a){return i{var{typed:t,config:r,matrix:n,DenseMatrix:i,concat:a}=e,o=xi({typed:t}),s=Qo({typed:t,DenseMatrix:i}),l=An({typed:t,DenseMatrix:i}),u=fr({typed:t,matrix:n,concat:a}),c=Dd({typed:t});return t(Q3,FLe({typed:t,config:r}),{"boolean, boolean":(f,d)=>f<=d,"BigNumber, BigNumber":function(d,p){return d.lte(p)||_o(d,p,r.epsilon)},"Fraction, Fraction":(f,d)=>f.compare(d)!==1,"Complex, Complex":function(){throw new TypeError("No ordering relation is defined for complex numbers")}},c,u({SS:s,DS:o,Ss:l}))}),FLe=V(Q3,["typed","config"],e=>{var{typed:t,config:r}=e;return t(Q3,{"number, number":function(i,a){return i<=a||Oa(i,a,r.epsilon)}})});var Z3="larger",_Le=["typed","config","matrix","DenseMatrix","concat"],X3=V(Z3,_Le,e=>{var{typed:t,config:r,matrix:n,DenseMatrix:i,concat:a}=e,o=xi({typed:t}),s=Qo({typed:t,DenseMatrix:i}),l=An({typed:t,DenseMatrix:i}),u=fr({typed:t,matrix:n,concat:a}),c=Dd({typed:t});return t(Z3,PLe({typed:t,config:r}),{"boolean, boolean":(f,d)=>f>d,"BigNumber, BigNumber":function(d,p){return d.gt(p)&&!_o(d,p,r.epsilon)},"Fraction, Fraction":(f,d)=>f.compare(d)===1,"Complex, Complex":function(){throw new TypeError("No ordering relation is defined for complex numbers")}},c,u({SS:s,DS:o,Ss:l}))}),PLe=V(Z3,["typed","config"],e=>{var{typed:t,config:r}=e;return t(Z3,{"number, number":function(i,a){return i>a&&!Oa(i,a,r.epsilon)}})});var K3="largerEq",ILe=["typed","config","matrix","DenseMatrix","concat"],J3=V(K3,ILe,e=>{var{typed:t,config:r,matrix:n,DenseMatrix:i,concat:a}=e,o=xi({typed:t}),s=Qo({typed:t,DenseMatrix:i}),l=An({typed:t,DenseMatrix:i}),u=fr({typed:t,matrix:n,concat:a}),c=Dd({typed:t});return t(K3,BLe({typed:t,config:r}),{"boolean, boolean":(f,d)=>f>=d,"BigNumber, BigNumber":function(d,p){return d.gte(p)||_o(d,p,r.epsilon)},"Fraction, Fraction":(f,d)=>f.compare(d)!==-1,"Complex, Complex":function(){throw new TypeError("No ordering relation is defined for complex numbers")}},c,u({SS:s,DS:o,Ss:l}))}),BLe=V(K3,["typed","config"],e=>{var{typed:t,config:r}=e;return t(K3,{"number, number":function(i,a){return i>=a||Oa(i,a,r.epsilon)}})});var fce="deepEqual",RLe=["typed","equal"],e_=V(fce,RLe,e=>{var{typed:t,equal:r}=e;return t(fce,{"any, any":function(a,o){return n(a.valueOf(),o.valueOf())}});function n(i,a){if(Array.isArray(i))if(Array.isArray(a)){var o=i.length;if(o!==a.length)return!1;for(var s=0;s{var{typed:t,config:r,equalScalar:n,matrix:i,DenseMatrix:a,concat:o}=e,s=xi({typed:t}),l=Qo({typed:t,DenseMatrix:a}),u=An({typed:t,DenseMatrix:a}),c=fr({typed:t,matrix:i,concat:o});return t(t_,qLe({typed:t,equalScalar:n}),c({elop:f,SS:l,DS:s,Ss:u}));function f(d,p){return!n(d,p)}}),qLe=V(t_,["typed","equalScalar"],e=>{var{typed:t,equalScalar:r}=e;return t(t_,{"any, any":function(i,a){return i===null?a!==null:a===null?i!==null:i===void 0?a!==void 0:a===void 0?i!==void 0:!r(i,a)}})});var dce="partitionSelect",LLe=["typed","isNumeric","isNaN","compare"],n_=V(dce,LLe,e=>{var{typed:t,isNumeric:r,isNaN:n,compare:i}=e,a=i,o=(u,c)=>-i(u,c);return t(dce,{"Array | Matrix, number":function(c,f){return s(c,f,a)},"Array | Matrix, number, string":function(c,f,d){if(d==="asc")return s(c,f,a);if(d==="desc")return s(c,f,o);throw new Error('Compare string must be "asc" or "desc"')},"Array | Matrix, number, function":s});function s(u,c,f){if(!wt(c)||c<0)throw new Error("k must be a non-negative integer");if(St(u)){var d=u.size();if(d.length>1)throw new Error("Only one dimensional matrices supported");return l(u.valueOf(),c,f)}if(Array.isArray(u))return l(u,c,f)}function l(u,c,f){if(c>=u.length)throw new Error("k out of bounds");for(var d=0;d=0){var b=u[g];u[g]=u[m],u[m]=b,--g}else++m;f(u[m],A)>0&&--m,c<=m?h=m:p=m+1}return u[c]}});var pce="sort",zLe=["typed","matrix","compare","compareNatural"],i_=V(pce,zLe,e=>{var{typed:t,matrix:r,compare:n,compareNatural:i}=e,a=n,o=(c,f)=>-n(c,f);return t(pce,{Array:function(f){return l(f),f.sort(a)},Matrix:function(f){return u(f),r(f.toArray().sort(a),f.storage())},"Array, function":function(f,d){return l(f),f.sort(d)},"Matrix, function":function(f,d){return u(f),r(f.toArray().sort(d),f.storage())},"Array, string":function(f,d){return l(f),f.sort(s(d))},"Matrix, string":function(f,d){return u(f),r(f.toArray().sort(s(d)),f.storage())}});function s(c){if(c==="asc")return a;if(c==="desc")return o;if(c==="natural")return i;throw new Error('String "asc", "desc", or "natural" expected')}function l(c){if(Yt(c).length!==1)throw new Error("One dimensional array expected")}function u(c){if(c.size().length!==1)throw new Error("One dimensional matrix expected")}});var mce="max",ULe=["typed","config","numeric","larger"],SS=V(mce,ULe,e=>{var{typed:t,config:r,numeric:n,larger:i}=e;return t(mce,{"Array | Matrix":o,"Array | Matrix, number | BigNumber":function(l,u){return V0(l,u.valueOf(),a)},"...":function(l){if(Cd(l))throw new TypeError("Scalar values expected in function max");return o(l)}});function a(s,l){try{return i(s,l)?s:l}catch(u){throw La(u,"max",l)}}function o(s){var l;if(au(s,function(u){try{isNaN(u)&&typeof u=="number"?l=NaN:(l===void 0||i(u,l))&&(l=u)}catch(c){throw La(c,"max",u)}}),l===void 0)throw new Error("Cannot calculate max of an empty array");return typeof l=="string"&&(l=n(l,r.number)),l}});var hce="min",WLe=["typed","config","numeric","smaller"],ES=V(hce,WLe,e=>{var{typed:t,config:r,numeric:n,smaller:i}=e;return t(hce,{"Array | Matrix":o,"Array | Matrix, number | BigNumber":function(l,u){return V0(l,u.valueOf(),a)},"...":function(l){if(Cd(l))throw new TypeError("Scalar values expected in function min");return o(l)}});function a(s,l){try{return i(s,l)?s:l}catch(u){throw La(u,"min",l)}}function o(s){var l;if(au(s,function(u){try{isNaN(u)&&typeof u=="number"?l=NaN:(l===void 0||i(u,l))&&(l=u)}catch(c){throw La(c,"min",u)}}),l===void 0)throw new Error("Cannot calculate min of an empty array");return typeof l=="string"&&(l=n(l,r.number)),l}});var HLe="ImmutableDenseMatrix",VLe=["smaller","DenseMatrix"],a_=V(HLe,VLe,e=>{var{smaller:t,DenseMatrix:r}=e;function n(i,a){if(!(this instanceof n))throw new SyntaxError("Constructor must be called with the new operator");if(a&&!da(a))throw new Error("Invalid datatype: "+a);if(St(i)||Ir(i)){var o=new r(i,a);this._data=o._data,this._size=o._size,this._datatype=o._datatype,this._min=null,this._max=null}else if(i&&Ir(i.data)&&Ir(i.size))this._data=i.data,this._size=i.size,this._datatype=i.datatype,this._min=typeof i.min<"u"?i.min:null,this._max=typeof i.max<"u"?i.max:null;else{if(i)throw new TypeError("Unsupported type of data ("+qr(i)+")");this._data=[],this._size=[0],this._datatype=a,this._min=null,this._max=null}}return n.prototype=new r,n.prototype.type="ImmutableDenseMatrix",n.prototype.isImmutableDenseMatrix=!0,n.prototype.subset=function(i){switch(arguments.length){case 1:{var a=r.prototype.subset.call(this,i);return St(a)?new n({data:a._data,size:a._size,datatype:a._datatype}):a}case 2:case 3:throw new Error("Cannot invoke set subset on an Immutable Matrix instance");default:throw new SyntaxError("Wrong number of arguments")}},n.prototype.set=function(){throw new Error("Cannot invoke set on an Immutable Matrix instance")},n.prototype.resize=function(){throw new Error("Cannot invoke resize on an Immutable Matrix instance")},n.prototype.reshape=function(){throw new Error("Cannot invoke reshape on an Immutable Matrix instance")},n.prototype.clone=function(){return new n({data:Bt(this._data),size:Bt(this._size),datatype:this._datatype})},n.prototype.toJSON=function(){return{mathjs:"ImmutableDenseMatrix",data:this._data,size:this._size,datatype:this._datatype}},n.fromJSON=function(i){return new n(i)},n.prototype.swapRows=function(){throw new Error("Cannot invoke swapRows on an Immutable Matrix instance")},n.prototype.min=function(){if(this._min===null){var i=null;this.forEach(function(a){(i===null||t(a,i))&&(i=a)}),this._min=i!==null?i:void 0}return this._min},n.prototype.max=function(){if(this._max===null){var i=null;this.forEach(function(a){(i===null||t(i,a))&&(i=a)}),this._max=i!==null?i:void 0}return this._max},n},{isClass:!0});var GLe="Index",QLe=["ImmutableDenseMatrix","getMatrixDataType"],o_=V(GLe,QLe,e=>{var{ImmutableDenseMatrix:t,getMatrixDataType:r}=e;function n(a){if(!(this instanceof n))throw new SyntaxError("Constructor must be called with the new operator");this._dimensions=[],this._sourceSize=[],this._isScalar=!0;for(var o=0,s=arguments.length;o{r&&t.push(n)}),t}var YLe="FibonacciHeap",ZLe=["smaller","larger"],s_=V(YLe,ZLe,e=>{var{smaller:t,larger:r}=e,n=1/Math.log((1+Math.sqrt(5))/2);function i(){if(!(this instanceof i))throw new SyntaxError("Constructor must be called with the new operator");this._minimum=null,this._size=0}i.prototype.type="FibonacciHeap",i.prototype.isFibonacciHeap=!0,i.prototype.insert=function(c,f){var d={key:c,value:f,degree:0};if(this._minimum){var p=this._minimum;d.left=p,d.right=p.right,p.right=d,d.right.left=d,t(c,p.key)&&(this._minimum=d)}else d.left=d,d.right=d,this._minimum=d;return this._size++,d},i.prototype.size=function(){return this._size},i.prototype.clear=function(){this._minimum=null,this._size=0},i.prototype.isEmpty=function(){return this._size===0},i.prototype.extractMinimum=function(){var c=this._minimum;if(c===null)return c;for(var f=this._minimum,d=c.degree,p=c.child;d>0;){var h=p.right;p.left.right=p.right,p.right.left=p.left,p.left=f,p.right=f.right,f.right=p,p.right.left=p,p.parent=null,p=h,d--}return c.left.right=c.right,c.right.left=c.left,c===c.right?f=null:(f=c.right,f=u(f,this._size)),this._size--,this._minimum=f,c},i.prototype.remove=function(c){this._minimum=a(this._minimum,c,-1),this.extractMinimum()};function a(c,f,d){f.key=d;var p=f.parent;return p&&t(f.key,p.key)&&(o(c,f,p),s(c,p)),t(f.key,c.key)&&(c=f),c}function o(c,f,d){f.left.right=f.right,f.right.left=f.left,d.degree--,d.child===f&&(d.child=f.right),d.degree===0&&(d.child=null),f.left=c,f.right=c.right,c.right=f,f.right.left=f,f.parent=null,f.mark=!1}function s(c,f){var d=f.parent;!d||(f.mark?(o(c,f,d),s(d)):f.mark=!0)}var l=function(f,d){f.left.right=f.right,f.right.left=f.left,f.parent=d,d.child?(f.left=d.child,f.right=d.child.right,d.child.right=f,f.right.left=f):(d.child=f,f.right=f,f.left=f),d.degree++,f.mark=!1};function u(c,f){var d=Math.floor(Math.log(f)*n)+1,p=new Array(d),h=0,m=c;if(m)for(h++,m=m.right;m!==c;)h++,m=m.right;for(var g;h>0;){for(var A=m.degree,b=m.right;g=p[A],!!g;){if(r(m.key,g.key)){var v=g;g=m,m=v}l(g,m),p[A]=null,A++}p[A]=m,m=b,h--}c=null;for(var x=0;x{var{addScalar:t,equalScalar:r,FibonacciHeap:n}=e;function i(){if(!(this instanceof i))throw new SyntaxError("Constructor must be called with the new operator");this._values=[],this._heap=new n}return i.prototype.type="Spa",i.prototype.isSpa=!0,i.prototype.set=function(a,o){if(this._values[a])this._values[a].value=o;else{var s=this._heap.insert(a,o);this._values[a]=s}},i.prototype.get=function(a){var o=this._values[a];return o?o.value:0},i.prototype.accumulate=function(a,o){var s=this._values[a];s?s.value=t(s.value,o):(s=this._heap.insert(a,o),this._values[a]=s)},i.prototype.forEach=function(a,o,s){var l=this._heap,u=this._values,c=[],f=l.extractMinimum();for(f&&c.push(f);f&&f.key<=o;)f.key>=a&&(r(f.value,0)||s(f.key,f.value,this)),f=l.extractMinimum(),f&&c.push(f);for(var d=0;d{var{on:t,config:r,addScalar:n,subtractScalar:i,multiplyScalar:a,divideScalar:o,pow:s,abs:l,fix:u,round:c,equal:f,isNumeric:d,format:p,number:h,Complex:m,BigNumber:g,Fraction:A}=e,b=h;function v(U,R){if(!(this instanceof v))throw new Error("Constructor must be called with the new operator");if(!(U==null||d(U)||ds(U)))throw new TypeError("First parameter in Unit constructor must be number, BigNumber, Fraction, Complex, or undefined");if(this.fixPrefix=!1,this.skipAutomaticSimplification=!0,R===void 0)this.units=[],this.dimensions=L.map(ee=>0);else if(typeof R=="string"){var J=v.parse(R);this.units=J.units,this.dimensions=J.dimensions}else if(Fo(R)&&R.value===null)this.fixPrefix=R.fixPrefix,this.skipAutomaticSimplification=R.skipAutomaticSimplification,this.dimensions=R.dimensions.slice(0),this.units=R.units.map(ee=>Fn({},ee));else throw new TypeError("Second parameter in Unit constructor must be a string or valueless Unit");this.value=this._normalize(U)}Object.defineProperty(v,"name",{value:"Unit"}),v.prototype.constructor=v,v.prototype.type="Unit",v.prototype.isUnit=!0;var x,w,S;function k(){for(;S===" "||S===" ";)C()}function j(U){return U>="0"&&U<="9"||U==="."}function O(U){return U>="0"&&U<="9"}function C(){w++,S=x.charAt(w)}function N(U){w=U,S=x.charAt(w)}function D(){var U="",R=w;if(S==="+"?C():S==="-"&&(U+=S,C()),!j(S))return N(R),null;if(S==="."){if(U+=S,C(),!O(S))return N(R),null}else{for(;O(S);)U+=S,C();S==="."&&(U+=S,C())}for(;O(S);)U+=S,C();if(S==="E"||S==="e"){var J="",ee=w;if(J+=S,C(),(S==="+"||S==="-")&&(J+=S,C()),!O(S))return N(ee),U;for(U=U+J;O(S);)U+=S,C()}return U}function P(){for(var U="";O(S)||v.isValidAlpha(S);)U+=S,C();var R=U.charAt(0);return v.isValidAlpha(R)?U:null}function q(U){return S===U?(C(),U):null}v.parse=function(U,R){if(R=R||{},x=U,w=-1,S="",typeof x!="string")throw new TypeError("Invalid argument in Unit.parse, string expected");var J=new v;J.units=[];var ee=1,ie=!1;C(),k();var re=D(),Ee=null;if(re){if(r.number==="BigNumber")Ee=new g(re);else if(r.number==="Fraction")try{Ee=new A(re)}catch{Ee=parseFloat(re)}else Ee=parseFloat(re);k(),q("*")?(ee=1,ie=!0):q("/")&&(ee=-1,ie=!0)}for(var Ce=[],_e=1;;){for(k();S==="(";)Ce.push(ee),_e*=ee,ee=1,C(),k();var he=void 0;if(S){var ze=S;if(he=P(),he===null)throw new SyntaxError('Unexpected "'+ze+'" in "'+x+'" at index '+w.toString())}else break;var Ye=z(he);if(Ye===null)throw new SyntaxError('Unit "'+he+'" not found.');var tt=ee*_e;if(k(),q("^")){k();var Ct=D();if(Ct===null)throw new SyntaxError('In "'+U+'", "^" must be followed by a floating-point number');tt*=Ct}J.units.push({unit:Ye.unit,prefix:Ye.prefix,power:tt});for(var we=0;we1||Math.abs(this.units[0].power-1)>1e-15},v.prototype._normalize=function(U){if(U==null||this.units.length===0)return U;for(var R=U,J=v._getNumberConverter(qr(U)),ee=0;ee{if(Et(Q,U)){var R=Q[U],J=R.prefixes[""];return{unit:R,prefix:J}}for(var ee in Q)if(Et(Q,ee)&&hse(U,ee)){var ie=Q[ee],re=U.length-ee.length,Ee=U.substring(0,re),Ce=Et(ie.prefixes,Ee)?ie.prefixes[Ee]:void 0;if(Ce!==void 0)return{unit:ie,prefix:Ce}}return null},{hasher:U=>U[0],limit:100});v.isValuelessUnit=function(U){return z(U)!==null},v.prototype.hasBase=function(U){if(typeof U=="string"&&(U=_[U]),!U)return!1;for(var R=0;R1e-12)return!1;return!0},v.prototype.equalBase=function(U){for(var R=0;R1e-12)return!1;return!0},v.prototype.equals=function(U){return this.equalBase(U)&&f(this.value,U.value)},v.prototype.multiply=function(U){for(var R=this.clone(),J=Fo(U)?U:new v(U),ee=0;ee1e-12&&(Et(Oe,Ce)?R.push({unit:Oe[Ce].unit,prefix:Oe[Ce].prefix,power:U.dimensions[Ee]||0}):re=!0)}R.length1e-12)if(Et(Se.si,ee))R.push({unit:Se.si[ee].unit,prefix:Se.si[ee].prefix,power:U.dimensions[J]||0});else throw new Error("Cannot express custom unit "+ee+" in SI units")}return U.units=R,U.fixPrefix=!0,U.skipAutomaticSimplification=!0,this.value!==null?(U.value=null,this.to(U)):U},v.prototype.formatUnits=function(){for(var U="",R="",J=0,ee=0,ie=0;ie0?(J++,U+=" "+this.units[ie].prefix.name+this.units[ie].unit.name,Math.abs(this.units[ie].power-1)>1e-15&&(U+="^"+this.units[ie].power)):this.units[ie].power<0&&ee++;if(ee>0)for(var re=0;re0?(R+=" "+this.units[re].prefix.name+this.units[re].unit.name,Math.abs(this.units[re].power+1)>1e-15&&(R+="^"+-this.units[re].power)):(R+=" "+this.units[re].prefix.name+this.units[re].unit.name,R+="^"+this.units[re].power));U=U.substr(1),R=R.substr(1),J>1&&ee>0&&(U="("+U+")"),ee>1&&J>0&&(R="("+R+")");var Ee=U;return J>0&&ee>0&&(Ee+=" / "),Ee+=R,Ee},v.prototype.format=function(U){var R=this.skipAutomaticSimplification||this.value===null?this.clone():this.simplify(),J=!1;typeof R.value<"u"&&R.value!==null&&ds(R.value)&&(J=Math.abs(R.value.re)<1e-14);for(var ee in R.units)Et(R.units,ee)&&R.units[ee].unit&&(R.units[ee].unit.name==="VA"&&J?R.units[ee].unit=Q.VAR:R.units[ee].unit.name==="VAR"&&!J&&(R.units[ee].unit=Q.VA));R.units.length===1&&!R.fixPrefix&&Math.abs(R.units[0].power-Math.round(R.units[0].power))<1e-14&&(R.units[0].prefix=R._bestPrefix());var ie=R._denormalize(R.value),re=R.value!==null?p(ie,U||{}):"",Ee=R.formatUnits();return R.value&&ds(R.value)&&(re="("+re+")"),Ee.length>0&&re.length>0&&(re+=" "),re+=Ee,re},v.prototype._bestPrefix=function(){if(this.units.length!==1)throw new Error("Can only compute the best prefix for single units with integer powers, like kg, s^2, N^-1, and so forth!");if(Math.abs(this.units[0].power-Math.round(this.units[0].power))>=1e-14)throw new Error("Can only compute the best prefix for single units with integer powers, like kg, s^2, N^-1, and so forth!");var U=this.value!==null?l(this.value):0,R=l(this.units[0].unit.value),J=this.units[0].prefix;if(U===0)return J;var ee=this.units[0].power,ie=Math.log(U/Math.pow(J.value*R,ee))/Math.LN10-1.2;if(ie>-2.200001&&ie<1.800001)return J;ie=Math.abs(ie);var re=this.units[0].unit.prefixes;for(var Ee in re)if(Et(re,Ee)){var Ce=re[Ee];if(Ce.scientific){var _e=Math.abs(Math.log(U/Math.pow(Ce.value*R,ee))/Math.LN10-1.2);(_e0)},Q={meter:{name:"meter",base:_.LENGTH,prefixes:T.LONG,value:1,offset:0},inch:{name:"inch",base:_.LENGTH,prefixes:T.NONE,value:.0254,offset:0},foot:{name:"foot",base:_.LENGTH,prefixes:T.NONE,value:.3048,offset:0},yard:{name:"yard",base:_.LENGTH,prefixes:T.NONE,value:.9144,offset:0},mile:{name:"mile",base:_.LENGTH,prefixes:T.NONE,value:1609.344,offset:0},link:{name:"link",base:_.LENGTH,prefixes:T.NONE,value:.201168,offset:0},rod:{name:"rod",base:_.LENGTH,prefixes:T.NONE,value:5.0292,offset:0},chain:{name:"chain",base:_.LENGTH,prefixes:T.NONE,value:20.1168,offset:0},angstrom:{name:"angstrom",base:_.LENGTH,prefixes:T.NONE,value:1e-10,offset:0},m:{name:"m",base:_.LENGTH,prefixes:T.SHORT,value:1,offset:0},in:{name:"in",base:_.LENGTH,prefixes:T.NONE,value:.0254,offset:0},ft:{name:"ft",base:_.LENGTH,prefixes:T.NONE,value:.3048,offset:0},yd:{name:"yd",base:_.LENGTH,prefixes:T.NONE,value:.9144,offset:0},mi:{name:"mi",base:_.LENGTH,prefixes:T.NONE,value:1609.344,offset:0},li:{name:"li",base:_.LENGTH,prefixes:T.NONE,value:.201168,offset:0},rd:{name:"rd",base:_.LENGTH,prefixes:T.NONE,value:5.02921,offset:0},ch:{name:"ch",base:_.LENGTH,prefixes:T.NONE,value:20.1168,offset:0},mil:{name:"mil",base:_.LENGTH,prefixes:T.NONE,value:254e-7,offset:0},m2:{name:"m2",base:_.SURFACE,prefixes:T.SQUARED,value:1,offset:0},sqin:{name:"sqin",base:_.SURFACE,prefixes:T.NONE,value:64516e-8,offset:0},sqft:{name:"sqft",base:_.SURFACE,prefixes:T.NONE,value:.09290304,offset:0},sqyd:{name:"sqyd",base:_.SURFACE,prefixes:T.NONE,value:.83612736,offset:0},sqmi:{name:"sqmi",base:_.SURFACE,prefixes:T.NONE,value:2589988110336e-6,offset:0},sqrd:{name:"sqrd",base:_.SURFACE,prefixes:T.NONE,value:25.29295,offset:0},sqch:{name:"sqch",base:_.SURFACE,prefixes:T.NONE,value:404.6873,offset:0},sqmil:{name:"sqmil",base:_.SURFACE,prefixes:T.NONE,value:64516e-14,offset:0},acre:{name:"acre",base:_.SURFACE,prefixes:T.NONE,value:4046.86,offset:0},hectare:{name:"hectare",base:_.SURFACE,prefixes:T.NONE,value:1e4,offset:0},m3:{name:"m3",base:_.VOLUME,prefixes:T.CUBIC,value:1,offset:0},L:{name:"L",base:_.VOLUME,prefixes:T.SHORT,value:.001,offset:0},l:{name:"l",base:_.VOLUME,prefixes:T.SHORT,value:.001,offset:0},litre:{name:"litre",base:_.VOLUME,prefixes:T.LONG,value:.001,offset:0},cuin:{name:"cuin",base:_.VOLUME,prefixes:T.NONE,value:16387064e-12,offset:0},cuft:{name:"cuft",base:_.VOLUME,prefixes:T.NONE,value:.028316846592,offset:0},cuyd:{name:"cuyd",base:_.VOLUME,prefixes:T.NONE,value:.764554857984,offset:0},teaspoon:{name:"teaspoon",base:_.VOLUME,prefixes:T.NONE,value:5e-6,offset:0},tablespoon:{name:"tablespoon",base:_.VOLUME,prefixes:T.NONE,value:15e-6,offset:0},drop:{name:"drop",base:_.VOLUME,prefixes:T.NONE,value:5e-8,offset:0},gtt:{name:"gtt",base:_.VOLUME,prefixes:T.NONE,value:5e-8,offset:0},minim:{name:"minim",base:_.VOLUME,prefixes:T.NONE,value:6161152e-14,offset:0},fluiddram:{name:"fluiddram",base:_.VOLUME,prefixes:T.NONE,value:36966911e-13,offset:0},fluidounce:{name:"fluidounce",base:_.VOLUME,prefixes:T.NONE,value:2957353e-11,offset:0},gill:{name:"gill",base:_.VOLUME,prefixes:T.NONE,value:.0001182941,offset:0},cc:{name:"cc",base:_.VOLUME,prefixes:T.NONE,value:1e-6,offset:0},cup:{name:"cup",base:_.VOLUME,prefixes:T.NONE,value:.0002365882,offset:0},pint:{name:"pint",base:_.VOLUME,prefixes:T.NONE,value:.0004731765,offset:0},quart:{name:"quart",base:_.VOLUME,prefixes:T.NONE,value:.0009463529,offset:0},gallon:{name:"gallon",base:_.VOLUME,prefixes:T.NONE,value:.003785412,offset:0},beerbarrel:{name:"beerbarrel",base:_.VOLUME,prefixes:T.NONE,value:.1173478,offset:0},oilbarrel:{name:"oilbarrel",base:_.VOLUME,prefixes:T.NONE,value:.1589873,offset:0},hogshead:{name:"hogshead",base:_.VOLUME,prefixes:T.NONE,value:.238481,offset:0},fldr:{name:"fldr",base:_.VOLUME,prefixes:T.NONE,value:36966911e-13,offset:0},floz:{name:"floz",base:_.VOLUME,prefixes:T.NONE,value:2957353e-11,offset:0},gi:{name:"gi",base:_.VOLUME,prefixes:T.NONE,value:.0001182941,offset:0},cp:{name:"cp",base:_.VOLUME,prefixes:T.NONE,value:.0002365882,offset:0},pt:{name:"pt",base:_.VOLUME,prefixes:T.NONE,value:.0004731765,offset:0},qt:{name:"qt",base:_.VOLUME,prefixes:T.NONE,value:.0009463529,offset:0},gal:{name:"gal",base:_.VOLUME,prefixes:T.NONE,value:.003785412,offset:0},bbl:{name:"bbl",base:_.VOLUME,prefixes:T.NONE,value:.1173478,offset:0},obl:{name:"obl",base:_.VOLUME,prefixes:T.NONE,value:.1589873,offset:0},g:{name:"g",base:_.MASS,prefixes:T.SHORT,value:.001,offset:0},gram:{name:"gram",base:_.MASS,prefixes:T.LONG,value:.001,offset:0},ton:{name:"ton",base:_.MASS,prefixes:T.SHORT,value:907.18474,offset:0},t:{name:"t",base:_.MASS,prefixes:T.SHORT,value:1e3,offset:0},tonne:{name:"tonne",base:_.MASS,prefixes:T.LONG,value:1e3,offset:0},grain:{name:"grain",base:_.MASS,prefixes:T.NONE,value:6479891e-11,offset:0},dram:{name:"dram",base:_.MASS,prefixes:T.NONE,value:.0017718451953125,offset:0},ounce:{name:"ounce",base:_.MASS,prefixes:T.NONE,value:.028349523125,offset:0},poundmass:{name:"poundmass",base:_.MASS,prefixes:T.NONE,value:.45359237,offset:0},hundredweight:{name:"hundredweight",base:_.MASS,prefixes:T.NONE,value:45.359237,offset:0},stick:{name:"stick",base:_.MASS,prefixes:T.NONE,value:.115,offset:0},stone:{name:"stone",base:_.MASS,prefixes:T.NONE,value:6.35029318,offset:0},gr:{name:"gr",base:_.MASS,prefixes:T.NONE,value:6479891e-11,offset:0},dr:{name:"dr",base:_.MASS,prefixes:T.NONE,value:.0017718451953125,offset:0},oz:{name:"oz",base:_.MASS,prefixes:T.NONE,value:.028349523125,offset:0},lbm:{name:"lbm",base:_.MASS,prefixes:T.NONE,value:.45359237,offset:0},cwt:{name:"cwt",base:_.MASS,prefixes:T.NONE,value:45.359237,offset:0},s:{name:"s",base:_.TIME,prefixes:T.SHORT,value:1,offset:0},min:{name:"min",base:_.TIME,prefixes:T.NONE,value:60,offset:0},h:{name:"h",base:_.TIME,prefixes:T.NONE,value:3600,offset:0},second:{name:"second",base:_.TIME,prefixes:T.LONG,value:1,offset:0},sec:{name:"sec",base:_.TIME,prefixes:T.LONG,value:1,offset:0},minute:{name:"minute",base:_.TIME,prefixes:T.NONE,value:60,offset:0},hour:{name:"hour",base:_.TIME,prefixes:T.NONE,value:3600,offset:0},day:{name:"day",base:_.TIME,prefixes:T.NONE,value:86400,offset:0},week:{name:"week",base:_.TIME,prefixes:T.NONE,value:7*86400,offset:0},month:{name:"month",base:_.TIME,prefixes:T.NONE,value:2629800,offset:0},year:{name:"year",base:_.TIME,prefixes:T.NONE,value:31557600,offset:0},decade:{name:"decade",base:_.TIME,prefixes:T.NONE,value:315576e3,offset:0},century:{name:"century",base:_.TIME,prefixes:T.NONE,value:315576e4,offset:0},millennium:{name:"millennium",base:_.TIME,prefixes:T.NONE,value:315576e5,offset:0},hertz:{name:"Hertz",base:_.FREQUENCY,prefixes:T.LONG,value:1,offset:0,reciprocal:!0},Hz:{name:"Hz",base:_.FREQUENCY,prefixes:T.SHORT,value:1,offset:0,reciprocal:!0},rad:{name:"rad",base:_.ANGLE,prefixes:T.SHORT,value:1,offset:0},radian:{name:"radian",base:_.ANGLE,prefixes:T.LONG,value:1,offset:0},deg:{name:"deg",base:_.ANGLE,prefixes:T.SHORT,value:null,offset:0},degree:{name:"degree",base:_.ANGLE,prefixes:T.LONG,value:null,offset:0},grad:{name:"grad",base:_.ANGLE,prefixes:T.SHORT,value:null,offset:0},gradian:{name:"gradian",base:_.ANGLE,prefixes:T.LONG,value:null,offset:0},cycle:{name:"cycle",base:_.ANGLE,prefixes:T.NONE,value:null,offset:0},arcsec:{name:"arcsec",base:_.ANGLE,prefixes:T.NONE,value:null,offset:0},arcmin:{name:"arcmin",base:_.ANGLE,prefixes:T.NONE,value:null,offset:0},A:{name:"A",base:_.CURRENT,prefixes:T.SHORT,value:1,offset:0},ampere:{name:"ampere",base:_.CURRENT,prefixes:T.LONG,value:1,offset:0},K:{name:"K",base:_.TEMPERATURE,prefixes:T.SHORT,value:1,offset:0},degC:{name:"degC",base:_.TEMPERATURE,prefixes:T.SHORT,value:1,offset:273.15},degF:{name:"degF",base:_.TEMPERATURE,prefixes:T.SHORT,value:new A(5,9),offset:459.67},degR:{name:"degR",base:_.TEMPERATURE,prefixes:T.SHORT,value:new A(5,9),offset:0},kelvin:{name:"kelvin",base:_.TEMPERATURE,prefixes:T.LONG,value:1,offset:0},celsius:{name:"celsius",base:_.TEMPERATURE,prefixes:T.LONG,value:1,offset:273.15},fahrenheit:{name:"fahrenheit",base:_.TEMPERATURE,prefixes:T.LONG,value:new A(5,9),offset:459.67},rankine:{name:"rankine",base:_.TEMPERATURE,prefixes:T.LONG,value:new A(5,9),offset:0},mol:{name:"mol",base:_.AMOUNT_OF_SUBSTANCE,prefixes:T.SHORT,value:1,offset:0},mole:{name:"mole",base:_.AMOUNT_OF_SUBSTANCE,prefixes:T.LONG,value:1,offset:0},cd:{name:"cd",base:_.LUMINOUS_INTENSITY,prefixes:T.SHORT,value:1,offset:0},candela:{name:"candela",base:_.LUMINOUS_INTENSITY,prefixes:T.LONG,value:1,offset:0},N:{name:"N",base:_.FORCE,prefixes:T.SHORT,value:1,offset:0},newton:{name:"newton",base:_.FORCE,prefixes:T.LONG,value:1,offset:0},dyn:{name:"dyn",base:_.FORCE,prefixes:T.SHORT,value:1e-5,offset:0},dyne:{name:"dyne",base:_.FORCE,prefixes:T.LONG,value:1e-5,offset:0},lbf:{name:"lbf",base:_.FORCE,prefixes:T.NONE,value:4.4482216152605,offset:0},poundforce:{name:"poundforce",base:_.FORCE,prefixes:T.NONE,value:4.4482216152605,offset:0},kip:{name:"kip",base:_.FORCE,prefixes:T.LONG,value:4448.2216,offset:0},kilogramforce:{name:"kilogramforce",base:_.FORCE,prefixes:T.NONE,value:9.80665,offset:0},J:{name:"J",base:_.ENERGY,prefixes:T.SHORT,value:1,offset:0},joule:{name:"joule",base:_.ENERGY,prefixes:T.LONG,value:1,offset:0},erg:{name:"erg",base:_.ENERGY,prefixes:T.SHORTLONG,value:1e-7,offset:0},Wh:{name:"Wh",base:_.ENERGY,prefixes:T.SHORT,value:3600,offset:0},BTU:{name:"BTU",base:_.ENERGY,prefixes:T.BTU,value:1055.05585262,offset:0},eV:{name:"eV",base:_.ENERGY,prefixes:T.SHORT,value:1602176565e-28,offset:0},electronvolt:{name:"electronvolt",base:_.ENERGY,prefixes:T.LONG,value:1602176565e-28,offset:0},W:{name:"W",base:_.POWER,prefixes:T.SHORT,value:1,offset:0},watt:{name:"watt",base:_.POWER,prefixes:T.LONG,value:1,offset:0},hp:{name:"hp",base:_.POWER,prefixes:T.NONE,value:745.6998715386,offset:0},VAR:{name:"VAR",base:_.POWER,prefixes:T.SHORT,value:m.I,offset:0},VA:{name:"VA",base:_.POWER,prefixes:T.SHORT,value:1,offset:0},Pa:{name:"Pa",base:_.PRESSURE,prefixes:T.SHORT,value:1,offset:0},psi:{name:"psi",base:_.PRESSURE,prefixes:T.NONE,value:6894.75729276459,offset:0},atm:{name:"atm",base:_.PRESSURE,prefixes:T.NONE,value:101325,offset:0},bar:{name:"bar",base:_.PRESSURE,prefixes:T.SHORTLONG,value:1e5,offset:0},torr:{name:"torr",base:_.PRESSURE,prefixes:T.NONE,value:133.322,offset:0},mmHg:{name:"mmHg",base:_.PRESSURE,prefixes:T.NONE,value:133.322,offset:0},mmH2O:{name:"mmH2O",base:_.PRESSURE,prefixes:T.NONE,value:9.80665,offset:0},cmH2O:{name:"cmH2O",base:_.PRESSURE,prefixes:T.NONE,value:98.0665,offset:0},coulomb:{name:"coulomb",base:_.ELECTRIC_CHARGE,prefixes:T.LONG,value:1,offset:0},C:{name:"C",base:_.ELECTRIC_CHARGE,prefixes:T.SHORT,value:1,offset:0},farad:{name:"farad",base:_.ELECTRIC_CAPACITANCE,prefixes:T.LONG,value:1,offset:0},F:{name:"F",base:_.ELECTRIC_CAPACITANCE,prefixes:T.SHORT,value:1,offset:0},volt:{name:"volt",base:_.ELECTRIC_POTENTIAL,prefixes:T.LONG,value:1,offset:0},V:{name:"V",base:_.ELECTRIC_POTENTIAL,prefixes:T.SHORT,value:1,offset:0},ohm:{name:"ohm",base:_.ELECTRIC_RESISTANCE,prefixes:T.SHORTLONG,value:1,offset:0},henry:{name:"henry",base:_.ELECTRIC_INDUCTANCE,prefixes:T.LONG,value:1,offset:0},H:{name:"H",base:_.ELECTRIC_INDUCTANCE,prefixes:T.SHORT,value:1,offset:0},siemens:{name:"siemens",base:_.ELECTRIC_CONDUCTANCE,prefixes:T.LONG,value:1,offset:0},S:{name:"S",base:_.ELECTRIC_CONDUCTANCE,prefixes:T.SHORT,value:1,offset:0},weber:{name:"weber",base:_.MAGNETIC_FLUX,prefixes:T.LONG,value:1,offset:0},Wb:{name:"Wb",base:_.MAGNETIC_FLUX,prefixes:T.SHORT,value:1,offset:0},tesla:{name:"tesla",base:_.MAGNETIC_FLUX_DENSITY,prefixes:T.LONG,value:1,offset:0},T:{name:"T",base:_.MAGNETIC_FLUX_DENSITY,prefixes:T.SHORT,value:1,offset:0},b:{name:"b",base:_.BIT,prefixes:T.BINARY_SHORT,value:1,offset:0},bits:{name:"bits",base:_.BIT,prefixes:T.BINARY_LONG,value:1,offset:0},B:{name:"B",base:_.BIT,prefixes:T.BINARY_SHORT,value:8,offset:0},bytes:{name:"bytes",base:_.BIT,prefixes:T.BINARY_LONG,value:8,offset:0}},fe={meters:"meter",inches:"inch",feet:"foot",yards:"yard",miles:"mile",links:"link",rods:"rod",chains:"chain",angstroms:"angstrom",lt:"l",litres:"litre",liter:"litre",liters:"litre",teaspoons:"teaspoon",tablespoons:"tablespoon",minims:"minim",fluiddrams:"fluiddram",fluidounces:"fluidounce",gills:"gill",cups:"cup",pints:"pint",quarts:"quart",gallons:"gallon",beerbarrels:"beerbarrel",oilbarrels:"oilbarrel",hogsheads:"hogshead",gtts:"gtt",grams:"gram",tons:"ton",tonnes:"tonne",grains:"grain",drams:"dram",ounces:"ounce",poundmasses:"poundmass",hundredweights:"hundredweight",sticks:"stick",lb:"lbm",lbs:"lbm",kips:"kip",kgf:"kilogramforce",acres:"acre",hectares:"hectare",sqfeet:"sqft",sqyard:"sqyd",sqmile:"sqmi",sqmiles:"sqmi",mmhg:"mmHg",mmh2o:"mmH2O",cmh2o:"cmH2O",seconds:"second",secs:"second",minutes:"minute",mins:"minute",hours:"hour",hr:"hour",hrs:"hour",days:"day",weeks:"week",months:"month",years:"year",decades:"decade",centuries:"century",millennia:"millennium",hertz:"hertz",radians:"radian",degrees:"degree",gradians:"gradian",cycles:"cycle",arcsecond:"arcsec",arcseconds:"arcsec",arcminute:"arcmin",arcminutes:"arcmin",BTUs:"BTU",watts:"watt",joules:"joule",amperes:"ampere",amps:"ampere",amp:"ampere",coulombs:"coulomb",volts:"volt",ohms:"ohm",farads:"farad",webers:"weber",teslas:"tesla",electronvolts:"electronvolt",moles:"mole",bit:"bits",byte:"bytes"};function Ie(U){if(U.number==="BigNumber"){var R=K6(g);Q.rad.value=new g(1),Q.deg.value=R.div(180),Q.grad.value=R.div(200),Q.cycle.value=R.times(2),Q.arcsec.value=R.div(648e3),Q.arcmin.value=R.div(10800)}else Q.rad.value=1,Q.deg.value=Math.PI/180,Q.grad.value=Math.PI/200,Q.cycle.value=Math.PI*2,Q.arcsec.value=Math.PI/648e3,Q.arcmin.value=Math.PI/10800;Q.radian.value=Q.rad.value,Q.degree.value=Q.deg.value,Q.gradian.value=Q.grad.value}Ie(r),t&&t("config",function(U,R){U.number!==R.number&&Ie(U)});var Se={si:{NONE:{unit:te,prefix:T.NONE[""]},LENGTH:{unit:Q.m,prefix:T.SHORT[""]},MASS:{unit:Q.g,prefix:T.SHORT.k},TIME:{unit:Q.s,prefix:T.SHORT[""]},CURRENT:{unit:Q.A,prefix:T.SHORT[""]},TEMPERATURE:{unit:Q.K,prefix:T.SHORT[""]},LUMINOUS_INTENSITY:{unit:Q.cd,prefix:T.SHORT[""]},AMOUNT_OF_SUBSTANCE:{unit:Q.mol,prefix:T.SHORT[""]},ANGLE:{unit:Q.rad,prefix:T.SHORT[""]},BIT:{unit:Q.bits,prefix:T.SHORT[""]},FORCE:{unit:Q.N,prefix:T.SHORT[""]},ENERGY:{unit:Q.J,prefix:T.SHORT[""]},POWER:{unit:Q.W,prefix:T.SHORT[""]},PRESSURE:{unit:Q.Pa,prefix:T.SHORT[""]},ELECTRIC_CHARGE:{unit:Q.C,prefix:T.SHORT[""]},ELECTRIC_CAPACITANCE:{unit:Q.F,prefix:T.SHORT[""]},ELECTRIC_POTENTIAL:{unit:Q.V,prefix:T.SHORT[""]},ELECTRIC_RESISTANCE:{unit:Q.ohm,prefix:T.SHORT[""]},ELECTRIC_INDUCTANCE:{unit:Q.H,prefix:T.SHORT[""]},ELECTRIC_CONDUCTANCE:{unit:Q.S,prefix:T.SHORT[""]},MAGNETIC_FLUX:{unit:Q.Wb,prefix:T.SHORT[""]},MAGNETIC_FLUX_DENSITY:{unit:Q.T,prefix:T.SHORT[""]},FREQUENCY:{unit:Q.Hz,prefix:T.SHORT[""]}}};Se.cgs=JSON.parse(JSON.stringify(Se.si)),Se.cgs.LENGTH={unit:Q.m,prefix:T.SHORT.c},Se.cgs.MASS={unit:Q.g,prefix:T.SHORT[""]},Se.cgs.FORCE={unit:Q.dyn,prefix:T.SHORT[""]},Se.cgs.ENERGY={unit:Q.erg,prefix:T.NONE[""]},Se.us=JSON.parse(JSON.stringify(Se.si)),Se.us.LENGTH={unit:Q.ft,prefix:T.NONE[""]},Se.us.MASS={unit:Q.lbm,prefix:T.NONE[""]},Se.us.TEMPERATURE={unit:Q.degF,prefix:T.NONE[""]},Se.us.FORCE={unit:Q.lbf,prefix:T.NONE[""]},Se.us.ENERGY={unit:Q.BTU,prefix:T.BTU[""]},Se.us.POWER={unit:Q.hp,prefix:T.NONE[""]},Se.us.PRESSURE={unit:Q.psi,prefix:T.NONE[""]},Se.auto=JSON.parse(JSON.stringify(Se.si));var Oe=Se.auto;v.setUnitSystem=function(U){if(Et(Se,U))Oe=Se[U];else throw new Error("Unit system "+U+" does not exist. Choices are: "+Object.keys(Se).join(", "))},v.getUnitSystem=function(){for(var U in Se)if(Et(Se,U)&&Se[U]===Oe)return U},v.typeConverters={BigNumber:function(R){return R!=null&&R.isFraction?new g(R.n).div(R.d).times(R.s):new g(R+"")},Fraction:function(R){return new A(R)},Complex:function(R){return R},number:function(R){return R!=null&&R.isFraction?h(R):R}},v.prototype._numberConverter=function(){var U=v.typeConverters[this.valueType()];if(U)return U;throw new TypeError('Unsupported Unit value type "'+this.valueType()+'"')},v._getNumberConverter=function(U){if(!v.typeConverters[U])throw new TypeError('Unsupported type "'+U+'"');return v.typeConverters[U]};for(var ve in Q)if(Et(Q,ve)){var ye=Q[ve];ye.dimensions=ye.base.dimensions}for(var me in fe)if(Et(fe,me)){var ke=Q[fe[me]],$={};for(var ae in ke)Et(ke,ae)&&($[ae]=ke[ae]);$.name=me,Q[me]=$}v.isValidAlpha=function(R){return/^[a-zA-Z]$/.test(R)};function ce(U){for(var R=0;R0&&!(v.isValidAlpha(S)||O(S)))throw new Error('Invalid unit name (only alphanumeric characters are allowed): "'+U+'"')}}return v.createUnit=function(U,R){if(typeof U!="object")throw new TypeError("createUnit expects first parameter to be of type 'Object'");if(R&&R.override){for(var J in U)if(Et(U,J)&&v.deleteUnit(J),U[J].aliases)for(var ee=0;ee"u"||R===null)&&(R={}),typeof U!="string")throw new TypeError("createUnitSingle expects first parameter to be of type 'string'");if(Et(Q,U))throw new Error('Cannot create unit "'+U+'": a unit with that name already exists');ce(U);var J=null,ee=[],ie=0,re,Ee,Ce;if(R&&R.type==="Unit")J=R.clone();else if(typeof R=="string")R!==""&&(re=R);else if(typeof R=="object")re=R.definition,Ee=R.prefixes,ie=R.offset,Ce=R.baseName,R.aliases&&(ee=R.aliases.valueOf());else throw new TypeError('Cannot create unit "'+U+'" from "'+R.toString()+'": expecting "string" or "Unit" or "Object"');if(ee){for(var _e=0;_e1e-12){Be=!1;break}if(Be){Ct=!0,he.base=_[we];break}}if(!Ct){Ce=Ce||U+"_STUFF";var Ze={dimensions:J.dimensions.slice(0)};Ze.key=Ce,_[Ce]=Ze,Oe[Ce]={unit:he,prefix:T.NONE[""]},he.base=_[Ce]}}else{if(Ce=Ce||U+"_STUFF",L.indexOf(Ce)>=0)throw new Error('Cannot create new base unit "'+U+'": a base unit with that name already exists (and cannot be overridden)');L.push(Ce);for(var ze in _)Et(_,ze)&&(_[ze].dimensions[L.length-1]=0);for(var Ye={dimensions:[]},tt=0;tt{var{typed:t,Unit:r}=e;return t(xce,{Unit:function(i){return i.clone()},string:function(i){return r.isValuelessUnit(i)?new r(null,i):r.parse(i,{allowNoUnits:!0})},"number | BigNumber | Fraction | Complex, string | Unit":function(i,a){return new r(i,a)},"number | BigNumber | Fraction":function(i){return new r(i)},"Array | Matrix":t.referToSelf(n=>i=>jt(i,n))})});var wce="sparse",rze=["typed","SparseMatrix"],d_=V(wce,rze,e=>{var{typed:t,SparseMatrix:r}=e;return t(wce,{"":function(){return new r([])},string:function(i){return new r([],i)},"Array | Matrix":function(i){return new r(i)},"Array | Matrix, string":function(i,a){return new r(i,a)}})});var Sce="createUnit",nze=["typed","Unit"],p_=V(Sce,nze,e=>{var{typed:t,Unit:r}=e;return t(Sce,{"Object, Object":function(i,a){return r.createUnit(i,a)},Object:function(i){return r.createUnit(i,{})},"string, Unit | string | Object, Object":function(i,a,o){var s={};return s[i]=a,r.createUnit(s,o)},"string, Unit | string | Object":function(i,a){var o={};return o[i]=a,r.createUnit(o,{})},string:function(i){var a={};return a[i]={},r.createUnit(a,{})}})});var Ece="acos",ize=["typed","config","Complex"],m_=V(Ece,ize,e=>{var{typed:t,config:r,Complex:n}=e;return t(Ece,{number:function(a){return a>=-1&&a<=1||r.predictable?Math.acos(a):new n(a,0).acos()},Complex:function(a){return a.acos()},BigNumber:function(a){return a.acos()}})});var kce="acosh",aze=["typed","config","Complex"],h_=V(kce,aze,e=>{var{typed:t,config:r,Complex:n}=e;return t(kce,{number:function(a){return a>=1||r.predictable?JW(a):a<=-1?new n(Math.log(Math.sqrt(a*a-1)-a),Math.PI):new n(a,0).acosh()},Complex:function(a){return a.acosh()},BigNumber:function(a){return a.acosh()}})});var Cce="acot",oze=["typed","BigNumber"],A_=V(Cce,oze,e=>{var{typed:t,BigNumber:r}=e;return t(Cce,{number:eH,Complex:function(i){return i.acot()},BigNumber:function(i){return new r(1).div(i).atan()}})});var Dce="acoth",sze=["typed","config","Complex","BigNumber"],g_=V(Dce,sze,e=>{var{typed:t,config:r,Complex:n,BigNumber:i}=e;return t(Dce,{number:function(o){return o>=1||o<=-1||r.predictable?tH(o):new n(o,0).acoth()},Complex:function(o){return o.acoth()},BigNumber:function(o){return new i(1).div(o).atanh()}})});var Oce="acsc",lze=["typed","config","Complex","BigNumber"],v_=V(Oce,lze,e=>{var{typed:t,config:r,Complex:n,BigNumber:i}=e;return t(Oce,{number:function(o){return o<=-1||o>=1||r.predictable?rH(o):new n(o,0).acsc()},Complex:function(o){return o.acsc()},BigNumber:function(o){return new i(1).div(o).asin()}})});var Mce="acsch",uze=["typed","BigNumber"],y_=V(Mce,uze,e=>{var{typed:t,BigNumber:r}=e;return t(Mce,{number:nH,Complex:function(i){return i.acsch()},BigNumber:function(i){return new r(1).div(i).asinh()}})});var jce="asec",cze=["typed","config","Complex","BigNumber"],b_=V(jce,cze,e=>{var{typed:t,config:r,Complex:n,BigNumber:i}=e;return t(jce,{number:function(o){return o<=-1||o>=1||r.predictable?iH(o):new n(o,0).asec()},Complex:function(o){return o.asec()},BigNumber:function(o){return new i(1).div(o).acos()}})});var Nce="asech",fze=["typed","config","Complex","BigNumber"],x_=V(Nce,fze,e=>{var{typed:t,config:r,Complex:n,BigNumber:i}=e;return t(Nce,{number:function(o){if(o<=1&&o>=-1||r.predictable){var s=1/o;if(s>0||r.predictable)return aH(o);var l=Math.sqrt(s*s-1);return new n(Math.log(l-s),Math.PI)}return new n(o,0).asech()},Complex:function(o){return o.asech()},BigNumber:function(o){return new i(1).div(o).acosh()}})});var Tce="asin",dze=["typed","config","Complex"],w_=V(Tce,dze,e=>{var{typed:t,config:r,Complex:n}=e;return t(Tce,{number:function(a){return a>=-1&&a<=1||r.predictable?Math.asin(a):new n(a,0).asin()},Complex:function(a){return a.asin()},BigNumber:function(a){return a.asin()}})});var pze="asinh",mze=["typed"],S_=V(pze,mze,e=>{var{typed:t}=e;return t("asinh",{number:oH,Complex:function(n){return n.asinh()},BigNumber:function(n){return n.asinh()}})});var hze="atan",Aze=["typed"],E_=V(hze,Aze,e=>{var{typed:t}=e;return t("atan",{number:function(n){return Math.atan(n)},Complex:function(n){return n.atan()},BigNumber:function(n){return n.atan()}})});var Fce="atan2",gze=["typed","matrix","equalScalar","BigNumber","DenseMatrix","concat"],k_=V(Fce,gze,e=>{var{typed:t,matrix:r,equalScalar:n,BigNumber:i,DenseMatrix:a,concat:o}=e,s=yo({typed:t,equalScalar:n}),l=xi({typed:t}),u=jF({typed:t,equalScalar:n}),c=Gn({typed:t,equalScalar:n}),f=An({typed:t,DenseMatrix:a}),d=fr({typed:t,matrix:r,concat:o});return t(Fce,{"number, number":Math.atan2,"BigNumber, BigNumber":(p,h)=>i.atan2(p,h)},d({scalar:"number | BigNumber",SS:u,DS:l,SD:s,Ss:c,sS:f}))});var _ce="atanh",vze=["typed","config","Complex"],C_=V(_ce,vze,e=>{var{typed:t,config:r,Complex:n}=e;return t(_ce,{number:function(a){return a<=1&&a>=-1||r.predictable?sH(a):new n(a,0).atanh()},Complex:function(a){return a.atanh()},BigNumber:function(a){return a.atanh()}})});var Md=V("trigUnit",["typed"],e=>{var{typed:t}=e;return{Unit:t.referToSelf(r=>n=>{if(!n.hasBase(n.constructor.BASE_UNITS.ANGLE))throw new TypeError("Unit in function cot is no angle");return t.find(r,n.valueType())(n.value)})}});var Pce="cos",yze=["typed"],D_=V(Pce,yze,e=>{var{typed:t}=e,r=Md({typed:t});return t(Pce,{number:Math.cos,"Complex | BigNumber":n=>n.cos()},r)});var Ice="cosh",bze=["typed"],O_=V(Ice,bze,e=>{var{typed:t}=e;return t(Ice,{number:cT,"Complex | BigNumber":r=>r.cosh()})});var Bce="cot",xze=["typed","BigNumber"],M_=V(Bce,xze,e=>{var{typed:t,BigNumber:r}=e,n=Md({typed:t});return t(Bce,{number:lH,Complex:i=>i.cot(),BigNumber:i=>new r(1).div(i.tan())},n)});var Rce="coth",wze=["typed","BigNumber"],j_=V(Rce,wze,e=>{var{typed:t,BigNumber:r}=e;return t(Rce,{number:uH,Complex:n=>n.coth(),BigNumber:n=>new r(1).div(n.tanh())})});var $ce="csc",Sze=["typed","BigNumber"],N_=V($ce,Sze,e=>{var{typed:t,BigNumber:r}=e,n=Md({typed:t});return t($ce,{number:cH,Complex:i=>i.csc(),BigNumber:i=>new r(1).div(i.sin())},n)});var qce="csch",Eze=["typed","BigNumber"],T_=V(qce,Eze,e=>{var{typed:t,BigNumber:r}=e;return t(qce,{number:fH,Complex:n=>n.csch(),BigNumber:n=>new r(1).div(n.sinh())})});var Lce="sec",kze=["typed","BigNumber"],F_=V(Lce,kze,e=>{var{typed:t,BigNumber:r}=e,n=Md({typed:t});return t(Lce,{number:dH,Complex:i=>i.sec(),BigNumber:i=>new r(1).div(i.cos())},n)});var zce="sech",Cze=["typed","BigNumber"],__=V(zce,Cze,e=>{var{typed:t,BigNumber:r}=e;return t(zce,{number:pH,Complex:n=>n.sech(),BigNumber:n=>new r(1).div(n.cosh())})});var Uce="sin",Dze=["typed"],P_=V(Uce,Dze,e=>{var{typed:t}=e,r=Md({typed:t});return t(Uce,{number:Math.sin,"Complex | BigNumber":n=>n.sin()},r)});var Wce="sinh",Oze=["typed"],I_=V(Wce,Oze,e=>{var{typed:t}=e;return t(Wce,{number:mH,"Complex | BigNumber":r=>r.sinh()})});var Hce="tan",Mze=["typed"],B_=V(Hce,Mze,e=>{var{typed:t}=e,r=Md({typed:t});return t(Hce,{number:Math.tan,"Complex | BigNumber":n=>n.tan()},r)});var jze="tanh",Nze=["typed"],R_=V(jze,Nze,e=>{var{typed:t}=e;return t("tanh",{number:fT,"Complex | BigNumber":r=>r.tanh()})});var Vce="setCartesian",Tze=["typed","size","subset","compareNatural","Index","DenseMatrix"],$_=V(Vce,Tze,e=>{var{typed:t,size:r,subset:n,compareNatural:i,Index:a,DenseMatrix:o}=e;return t(Vce,{"Array | Matrix, Array | Matrix":function(l,u){var c=[];if(n(r(l),new a(0))!==0&&n(r(u),new a(0))!==0){var f=mr(Array.isArray(l)?l:l.toArray()).sort(i),d=mr(Array.isArray(u)?u:u.toArray()).sort(i);c=[];for(var p=0;p{var{typed:t,size:r,subset:n,compareNatural:i,Index:a,DenseMatrix:o}=e;return t(Gce,{"Array | Matrix, Array | Matrix":function(l,u){var c;if(n(r(l),new a(0))===0)c=[];else{if(n(r(u),new a(0))===0)return mr(l.toArray());var f=LA(mr(Array.isArray(l)?l:l.toArray()).sort(i)),d=LA(mr(Array.isArray(u)?u:u.toArray()).sort(i));c=[];for(var p,h=0;h{var{typed:t,size:r,subset:n,compareNatural:i,Index:a,DenseMatrix:o}=e;return t(Qce,{"Array | Matrix":function(l){var u;if(n(r(l),new a(0))===0)u=[];else{var c=mr(Array.isArray(l)?l:l.toArray()).sort(i);u=[],u.push(c[0]);for(var f=1;f{var{typed:t,size:r,subset:n,compareNatural:i,Index:a,DenseMatrix:o}=e;return t(Yce,{"Array | Matrix, Array | Matrix":function(l,u){var c;if(n(r(l),new a(0))===0||n(r(u),new a(0))===0)c=[];else{var f=LA(mr(Array.isArray(l)?l:l.toArray()).sort(i)),d=LA(mr(Array.isArray(u)?u:u.toArray()).sort(i));c=[];for(var p=0;p{var{typed:t,size:r,subset:n,compareNatural:i,Index:a}=e;return t(Zce,{"Array | Matrix, Array | Matrix":function(s,l){if(n(r(s),new a(0))===0)return!0;if(n(r(l),new a(0))===0)return!1;for(var u=LA(mr(Array.isArray(s)?s:s.toArray()).sort(i)),c=LA(mr(Array.isArray(l)?l:l.toArray()).sort(i)),f,d=0;d{var{typed:t,size:r,subset:n,compareNatural:i,Index:a}=e;return t(Xce,{"number | BigNumber | Fraction | Complex, Array | Matrix":function(s,l){if(n(r(l),new a(0))===0)return 0;for(var u=mr(Array.isArray(l)?l:l.toArray()),c=0,f=0;f{var{typed:t,size:r,subset:n,compareNatural:i,Index:a}=e;return t(Kce,{"Array | Matrix":function(u){if(n(r(u),new a(0))===0)return[];for(var c=mr(Array.isArray(u)?u:u.toArray()).sort(i),f=[],d=0;d.toString(2).length<=c.length;)f.push(o(c,d.toString(2).split("").reverse())),d++;return s(f)}});function o(l,u){for(var c=[],f=0;f0;c--)for(var f=0;fl[f+1].length&&(u=l[f],l[f]=l[f+1],l[f+1]=u);return l}});var Jce="setSize",$ze=["typed","compareNatural"],V_=V(Jce,$ze,e=>{var{typed:t,compareNatural:r}=e;return t(Jce,{"Array | Matrix":function(i){return Array.isArray(i)?mr(i).length:mr(i.toArray()).length},"Array | Matrix, boolean":function(i,a){if(a===!1||i.length===0)return Array.isArray(i)?mr(i).length:mr(i.toArray()).length;for(var o=mr(Array.isArray(i)?i:i.toArray()).sort(r),s=1,l=1;l{var{typed:t,size:r,concat:n,subset:i,setDifference:a,Index:o}=e;return t(efe,{"Array | Matrix, Array | Matrix":function(l,u){if(i(r(l),new o(0))===0)return mr(u);if(i(r(u),new o(0))===0)return mr(l);var c=mr(l),f=mr(u);return n(a(c,f),a(f,c))}})});var tfe="setUnion",Lze=["typed","size","concat","subset","setIntersect","setSymDifference","Index"],Q_=V(tfe,Lze,e=>{var{typed:t,size:r,concat:n,subset:i,setIntersect:a,setSymDifference:o,Index:s}=e;return t(tfe,{"Array | Matrix, Array | Matrix":function(u,c){if(i(r(u),new s(0))===0)return mr(c);if(i(r(c),new s(0))===0)return mr(u);var f=mr(u),d=mr(c);return n(o(f,d),a(f,d))}})});var rfe="add",zze=["typed","matrix","addScalar","equalScalar","DenseMatrix","SparseMatrix","concat"],Y_=V(rfe,zze,e=>{var{typed:t,matrix:r,addScalar:n,equalScalar:i,DenseMatrix:a,SparseMatrix:o,concat:s}=e,l=ou({typed:t}),u=aS({typed:t,equalScalar:i}),c=Dc({typed:t,DenseMatrix:a}),f=fr({typed:t,matrix:r,concat:s});return t(rfe,{"any, any":n,"any, any, ...any":t.referToSelf(d=>(p,h,m)=>{for(var g=d(p,h),A=0;A{var{typed:t,abs:r,addScalar:n,divideScalar:i,multiplyScalar:a,sqrt:o,smaller:s,isPositive:l}=e;return t(nfe,{"... number | BigNumber":u,Array:u,Matrix:c=>u(mr(c.toArray()))});function u(c){for(var f=0,d=0,p=0;p{var{typed:t,abs:r,add:n,pow:i,conj:a,sqrt:o,multiply:s,equalScalar:l,larger:u,smaller:c,matrix:f,ctranspose:d,eigs:p}=e;return t(ife,{number:Math.abs,Complex:function(j){return j.abs()},BigNumber:function(j){return j.abs()},boolean:function(j){return Math.abs(j)},Array:function(j){return S(f(j),2)},Matrix:function(j){return S(j,2)},"Array, number | BigNumber | string":function(j,O){return S(f(j),O)},"Matrix, number | BigNumber | string":function(j,O){return S(j,O)}});function h(k){var j=0;return k.forEach(function(O){var C=r(O);u(C,j)&&(j=C)},!0),j}function m(k){var j;return k.forEach(function(O){var C=r(O);(!j||c(C,j))&&(j=C)},!0),j||0}function g(k,j){if(j===Number.POSITIVE_INFINITY||j==="inf")return h(k);if(j===Number.NEGATIVE_INFINITY||j==="-inf")return m(k);if(j==="fro")return S(k,2);if(typeof j=="number"&&!isNaN(j)){if(!l(j,0)){var O=0;return k.forEach(function(C){O=n(i(r(C),j),O)},!0),i(O,1/j)}return Number.POSITIVE_INFINITY}throw new Error("Unsupported parameter value")}function A(k){var j=0;return k.forEach(function(O,C){j=n(j,s(O,a(O)))}),r(o(j))}function b(k){var j=[],O=0;return k.forEach(function(C,N){var D=N[1],P=n(j[D]||0,r(C));u(P,O)&&(O=P),j[D]=P},!0),O}function v(k){var j=k.size();if(j[0]!==j[1])throw new RangeError("Invalid matrix dimensions");var O=d(k),C=s(O,k),N=p(C).values.toArray(),D=N[N.length-1];return r(o(D))}function x(k){var j=[],O=0;return k.forEach(function(C,N){var D=N[0],P=n(j[D]||0,r(C));u(P,O)&&(O=P),j[D]=P},!0),O}function w(k,j){if(j===1)return b(k);if(j===Number.POSITIVE_INFINITY||j==="inf")return x(k);if(j==="fro")return A(k);if(j===2)return v(k);throw new Error("Unsupported parameter value "+j)}function S(k,j){var O=k.size();if(O.length===1)return g(k,j);if(O.length===2){if(O[0]&&O[1])return w(k,j);throw new RangeError("Invalid matrix dimensions")}}});var afe="dot",Hze=["typed","addScalar","multiplyScalar","conj","size"],K_=V(afe,Hze,e=>{var{typed:t,addScalar:r,multiplyScalar:n,conj:i,size:a}=e;return t(afe,{"Array | DenseMatrix, Array | DenseMatrix":s,"SparseMatrix, SparseMatrix":l});function o(c,f){var d=u(c),p=u(f),h,m;if(d.length===1)h=d[0];else if(d.length===2&&d[1]===1)h=d[0];else throw new RangeError("Expected a column vector, instead got a matrix of size ("+d.join(", ")+")");if(p.length===1)m=p[0];else if(p.length===2&&p[1]===1)m=p[0];else throw new RangeError("Expected a column vector, instead got a matrix of size ("+p.join(", ")+")");if(h!==m)throw new RangeError("Vectors must have equal length ("+h+" != "+m+")");if(h===0)throw new RangeError("Cannot calculate the dot product of empty vectors");return h}function s(c,f){var d=o(c,f),p=St(c)?c._data:c,h=St(c)?c._datatype||c.getDataType():void 0,m=St(f)?f._data:f,g=St(f)?f._datatype||f.getDataType():void 0,A=u(c).length===2,b=u(f).length===2,v=r,x=n;if(h&&g&&h===g&&typeof h=="string"&&h!=="mixed"){var w=h;v=t.find(r,[w,w]),x=t.find(n,[w,w])}if(!A&&!b){for(var S=x(i(p[0]),m[0]),k=1;kS){x++;continue}w===S&&(g=A(g,b(p[v],m[x])),v++,x++)}return g}function u(c){return St(c)?c.size():a(c)}});var Vze="trace",Gze=["typed","matrix","add"],J_=V(Vze,Gze,e=>{var{typed:t,matrix:r,add:n}=e;return t("trace",{Array:function(s){return i(r(s))},SparseMatrix:a,DenseMatrix:i,any:Bt});function i(o){var s=o._size,l=o._data;switch(s.length){case 1:if(s[0]===1)return Bt(l[0]);throw new RangeError("Matrix must be square (size: "+tr(s)+")");case 2:{var u=s[0],c=s[1];if(u===c){for(var f=0,d=0;d0)for(var h=0;hh)break}return p}throw new RangeError("Matrix must be square (size: "+tr(c)+")")}});var ofe="index",Qze=["typed","Index"],e4=V(ofe,Qze,e=>{var{typed:t,Index:r}=e;return t(ofe,{"...number | string | BigNumber | Range | Array | Matrix":function(i){var a=i.map(function(s){return It(s)?s.toNumber():Ir(s)||St(s)?s.map(function(l){return It(l)?l.toNumber():l}):s}),o=new r;return r.apply(o,a),o}})});var t4=new Set(["end"]);var Yze="Node",Zze=["mathWithTransform"],r4=V(Yze,Zze,e=>{var{mathWithTransform:t}=e;function r(i){for(var a of[...t4])if(i.has(a))throw new Error('Scope contains an illegal symbol, "'+a+'" is a reserved keyword')}class n{get type(){return"Node"}get isNode(){return!0}evaluate(a){return this.compile().evaluate(a)}compile(){var a=this._compile(t,{}),o={},s=null;function l(u){var c=zA(u);return r(c),a(c,o,s)}return{evaluate:l}}_compile(a,o){throw new Error("Method _compile must be implemented by type "+this.type)}forEach(a){throw new Error("Cannot run forEach on a Node interface")}map(a){throw new Error("Cannot run map on a Node interface")}_ifNode(a){if(!Nr(a))throw new TypeError("Callback function must return a Node");return a}traverse(a){a(this,null,null);function o(s,l){s.forEach(function(u,c,f){l(u,c,f),o(u,l)})}o(this,a)}transform(a){function o(s,l,u){var c=a(s,l,u);return c!==s?c:s.map(o)}return o(this,null,null)}filter(a){var o=[];return this.traverse(function(s,l,u){a(s,l,u)&&o.push(s)}),o}clone(){throw new Error("Cannot clone a Node interface")}cloneDeep(){return this.map(function(a){return a.cloneDeep()})}equals(a){return a?this.type===a.type&&Pp(this,a):!1}toString(a){var o=this._getCustomString(a);return typeof o<"u"?o:this._toString(a)}_toString(){throw new Error("_toString not implemented for "+this.type)}toJSON(){throw new Error("Cannot serialize object: toJSON not implemented by "+this.type)}toHTML(a){var o=this._getCustomString(a);return typeof o<"u"?o:this._toHTML(a)}_toHTML(){throw new Error("_toHTML not implemented for "+this.type)}toTex(a){var o=this._getCustomString(a);return typeof o<"u"?o:this._toTex(a)}_toTex(a){throw new Error("_toTex not implemented for "+this.type)}_getCustomString(a){if(a&&typeof a=="object")switch(typeof a.handler){case"object":case"undefined":return;case"function":return a.handler(this,a);default:throw new TypeError("Object or function expected as callback")}}getIdentifier(){return this.type}getContent(){return this}}return n},{isClass:!0,isNode:!0});function wi(e){return e&&e.isIndexError?new As(e.index+1,e.min+1,e.max!==void 0?e.max+1:void 0):e}function n4(e){var{subset:t}=e;return function(n,i){try{if(Array.isArray(n))return t(n,i);if(n&&typeof n.subset=="function")return n.subset(i);if(typeof n=="string")return t(n,i);if(typeof n=="object"){if(!i.isObjectProperty())throw new TypeError("Cannot apply a numeric index as object property");return Zi(n,i.getObjectProperty())}else throw new TypeError("Cannot apply index: unsupported type of object")}catch(a){throw wi(a)}}}var i4="AccessorNode",Xze=["subset","Node"],a4=V(i4,Xze,e=>{var{subset:t,Node:r}=e,n=n4({subset:t});function i(o){return!(Uu(o)||ps(o)||gr(o)||xl(o)||Vm(o)||ms(o)||ri(o))}class a extends r{constructor(s,l){if(super(),!Nr(s))throw new TypeError('Node expected for parameter "object"');if(!Sc(l))throw new TypeError('IndexNode expected for parameter "index"');this.object=s,this.index=l}get name(){return this.index?this.index.isObjectProperty()?this.index.getObjectProperty():"":this.object.name||""}get type(){return i4}get isAccessorNode(){return!0}_compile(s,l){var u=this.object._compile(s,l),c=this.index._compile(s,l);if(this.index.isObjectProperty()){var f=this.index.getObjectProperty();return function(p,h,m){return Zi(u(p,h,m),f)}}else return function(p,h,m){var g=u(p,h,m),A=c(p,h,g);return n(g,A)}}forEach(s){s(this.object,"object",this),s(this.index,"index",this)}map(s){return new a(this._ifNode(s(this.object,"object",this)),this._ifNode(s(this.index,"index",this)))}clone(){return new a(this.object,this.index)}_toString(s){var l=this.object.toString(s);return i(this.object)&&(l="("+l+")"),l+this.index.toString(s)}_toHTML(s){var l=this.object.toHTML(s);return i(this.object)&&(l='('+l+')'),l+this.index.toHTML(s)}_toTex(s){var l=this.object.toTex(s);return i(this.object)&&(l="\\left(' + object + '\\right)"),l+this.index.toTex(s)}toJSON(){return{mathjs:i4,object:this.object,index:this.index}}static fromJSON(s){return new a(s.object,s.index)}}return yn(a,"name",i4),a},{isClass:!0,isNode:!0});var o4="ArrayNode",Kze=["Node"],s4=V(o4,Kze,e=>{var{Node:t}=e;class r extends t{constructor(i){if(super(),this.items=i||[],!Array.isArray(this.items)||!this.items.every(Nr))throw new TypeError("Array containing Nodes expected")}get type(){return o4}get isArrayNode(){return!0}_compile(i,a){var o=Ec(this.items,function(u){return u._compile(i,a)}),s=i.config.matrix!=="Array";if(s){var l=i.matrix;return function(c,f,d){return l(Ec(o,function(p){return p(c,f,d)}))}}else return function(c,f,d){return Ec(o,function(p){return p(c,f,d)})}}forEach(i){for(var a=0;a['+a.join(',')+']'}_toTex(i){function a(o,s){var l=o.some(ps)&&!o.every(ps),u=s||l,c=u?"&":"\\\\",f=o.map(function(d){return d.items?a(d.items,!s):d.toTex(i)}).join(c);return l||!u||u&&!s?"\\begin{bmatrix}"+f+"\\end{bmatrix}":f}return a(this.items,!1)}}return yn(r,"name",o4),r},{isClass:!0,isNode:!0});function sfe(e){var{subset:t,matrix:r}=e;return function(i,a,o){try{if(Array.isArray(i)){var s=r(i).subset(a,o).valueOf();return s.forEach((l,u)=>{i[u]=l}),i}else{if(i&&typeof i.subset=="function")return i.subset(a,o);if(typeof i=="string")return t(i,a,o);if(typeof i=="object"){if(!a.isObjectProperty())throw TypeError("Cannot apply a numeric index as object property");return Gm(i,a.getObjectProperty(),o),i}else throw new TypeError("Cannot apply index: unsupported type of object")}}catch(l){throw wi(l)}}}var jd=[{AssignmentNode:{},FunctionAssignmentNode:{}},{ConditionalNode:{latexLeftParens:!1,latexRightParens:!1,latexParens:!1}},{"OperatorNode:or":{op:"or",associativity:"left",associativeWith:[]}},{"OperatorNode:xor":{op:"xor",associativity:"left",associativeWith:[]}},{"OperatorNode:and":{op:"and",associativity:"left",associativeWith:[]}},{"OperatorNode:bitOr":{op:"|",associativity:"left",associativeWith:[]}},{"OperatorNode:bitXor":{op:"^|",associativity:"left",associativeWith:[]}},{"OperatorNode:bitAnd":{op:"&",associativity:"left",associativeWith:[]}},{"OperatorNode:equal":{op:"==",associativity:"left",associativeWith:[]},"OperatorNode:unequal":{op:"!=",associativity:"left",associativeWith:[]},"OperatorNode:smaller":{op:"<",associativity:"left",associativeWith:[]},"OperatorNode:larger":{op:">",associativity:"left",associativeWith:[]},"OperatorNode:smallerEq":{op:"<=",associativity:"left",associativeWith:[]},"OperatorNode:largerEq":{op:">=",associativity:"left",associativeWith:[]},RelationalNode:{associativity:"left",associativeWith:[]}},{"OperatorNode:leftShift":{op:"<<",associativity:"left",associativeWith:[]},"OperatorNode:rightArithShift":{op:">>",associativity:"left",associativeWith:[]},"OperatorNode:rightLogShift":{op:">>>",associativity:"left",associativeWith:[]}},{"OperatorNode:to":{op:"to",associativity:"left",associativeWith:[]}},{RangeNode:{}},{"OperatorNode:add":{op:"+",associativity:"left",associativeWith:["OperatorNode:add","OperatorNode:subtract"]},"OperatorNode:subtract":{op:"-",associativity:"left",associativeWith:[]}},{"OperatorNode:multiply":{op:"*",associativity:"left",associativeWith:["OperatorNode:multiply","OperatorNode:divide","Operator:dotMultiply","Operator:dotDivide"]},"OperatorNode:divide":{op:"/",associativity:"left",associativeWith:[],latexLeftParens:!1,latexRightParens:!1,latexParens:!1},"OperatorNode:dotMultiply":{op:".*",associativity:"left",associativeWith:["OperatorNode:multiply","OperatorNode:divide","OperatorNode:dotMultiply","OperatorNode:doDivide"]},"OperatorNode:dotDivide":{op:"./",associativity:"left",associativeWith:[]},"OperatorNode:mod":{op:"mod",associativity:"left",associativeWith:[]}},{"OperatorNode:multiply":{associativity:"left",associativeWith:["OperatorNode:multiply","OperatorNode:divide","Operator:dotMultiply","Operator:dotDivide"]}},{"OperatorNode:unaryPlus":{op:"+",associativity:"right"},"OperatorNode:unaryMinus":{op:"-",associativity:"right"},"OperatorNode:bitNot":{op:"~",associativity:"right"},"OperatorNode:not":{op:"not",associativity:"right"}},{"OperatorNode:pow":{op:"^",associativity:"right",associativeWith:[],latexRightParens:!1},"OperatorNode:dotPow":{op:".^",associativity:"right",associativeWith:[]}},{"OperatorNode:factorial":{op:"!",associativity:"left"}},{"OperatorNode:ctranspose":{op:"'",associativity:"left"}}];function l4(e,t){if(!t||t!=="auto")return e;for(var r=e;ms(r);)r=r.content;return r}function qn(e,t,r,n){var i=e;t!=="keep"&&(i=e.getContent());for(var a=i.getIdentifier(),o=null,s=0;s{var{subset:t,matrix:r,Node:n}=e,i=n4({subset:t}),a=sfe({subset:t,matrix:r});function o(l,u,c){u||(u="keep");var f=qn(l,u,c),d=qn(l.value,u,c);return u==="all"||d!==null&&d<=f}class s extends n{constructor(u,c,f){if(super(),this.object=u,this.index=f?c:null,this.value=f||c,!ri(u)&&!Uu(u))throw new TypeError('SymbolNode or AccessorNode expected as "object"');if(ri(u)&&u.name==="end")throw new Error('Cannot assign to symbol "end"');if(this.index&&!Sc(this.index))throw new TypeError('IndexNode expected as "index"');if(!Nr(this.value))throw new TypeError('Node expected as "value"')}get name(){return this.index?this.index.isObjectProperty()?this.index.getObjectProperty():"":this.object.name||""}get type(){return c4}get isAssignmentNode(){return!0}_compile(u,c){var f=this.object._compile(u,c),d=this.index?this.index._compile(u,c):null,p=this.value._compile(u,c),h=this.object.name;if(this.index)if(this.index.isObjectProperty()){var m=this.index.getObjectProperty();return function(x,w,S){var k=f(x,w,S),j=p(x,w,S);return Gm(k,m,j),j}}else{if(ri(this.object))return function(x,w,S){var k=f(x,w,S),j=p(x,w,S),O=d(x,w,k);return x.set(h,a(k,O,j)),j};var g=this.object.object._compile(u,c);if(this.object.index.isObjectProperty()){var A=this.object.index.getObjectProperty();return function(x,w,S){var k=g(x,w,S),j=Zi(k,A),O=d(x,w,j),C=p(x,w,S);return Gm(k,A,a(j,O,C)),C}}else{var b=this.object.index._compile(u,c);return function(x,w,S){var k=g(x,w,S),j=b(x,w,k),O=i(k,j),C=d(x,w,O),N=p(x,w,S);return a(k,j,a(O,C,N)),N}}}else{if(!ri(this.object))throw new TypeError("SymbolNode expected as object");return function(x,w,S){var k=p(x,w,S);return x.set(h,k),k}}}forEach(u){u(this.object,"object",this),this.index&&u(this.index,"index",this),u(this.value,"value",this)}map(u){var c=this._ifNode(u(this.object,"object",this)),f=this.index?this._ifNode(u(this.index,"index",this)):null,d=this._ifNode(u(this.value,"value",this));return new s(c,f,d)}clone(){return new s(this.object,this.index,this.value)}_toString(u){var c=this.object.toString(u),f=this.index?this.index.toString(u):"",d=this.value.toString(u);return o(this,u&&u.parenthesis,u&&u.implicit)&&(d="("+d+")"),c+f+" = "+d}toJSON(){return{mathjs:c4,object:this.object,index:this.index,value:this.value}}static fromJSON(u){return new s(u.object,u.index,u.value)}_toHTML(u){var c=this.object.toHTML(u),f=this.index?this.index.toHTML(u):"",d=this.value.toHTML(u);return o(this,u&&u.parenthesis,u&&u.implicit)&&(d='('+d+')'),c+f+'='+d}_toTex(u){var c=this.object.toTex(u),f=this.index?this.index.toTex(u):"",d=this.value.toTex(u);return o(this,u&&u.parenthesis,u&&u.implicit)&&(d="\\left(".concat(d,"\\right)")),c+f+"="+d}}return yn(s,"name",c4),s},{isClass:!0,isNode:!0});var d4="BlockNode",eUe=["ResultSet","Node"],p4=V(d4,eUe,e=>{var{ResultSet:t,Node:r}=e;class n extends r{constructor(a){if(super(),!Array.isArray(a))throw new Error("Array expected");this.blocks=a.map(function(o){var s=o&&o.node,l=o&&o.visible!==void 0?o.visible:!0;if(!Nr(s))throw new TypeError('Property "node" must be a Node');if(typeof l!="boolean")throw new TypeError('Property "visible" must be a boolean');return{node:s,visible:l}})}get type(){return d4}get isBlockNode(){return!0}_compile(a,o){var s=Ec(this.blocks,function(l){return{evaluate:l.node._compile(a,o),visible:l.visible}});return function(u,c,f){var d=[];return $0(s,function(h){var m=h.evaluate(u,c,f);h.visible&&d.push(m)}),new t(d)}}forEach(a){for(var o=0;o "+(this._values?tr(this._values[k],m):"X")}return v},i.prototype.toString=function(){return tr(this.toArray())},i.prototype.toJSON=function(){return{mathjs:"SparseMatrix",values:this._values,index:this._index,ptr:this._ptr,size:this._size,datatype:this._datatype}},i.prototype.diagonal=function(m){if(m){if(It(m)&&(m=m.toNumber()),!Qt(m)||!wt(m))throw new TypeError("The parameter k must be an integer number")}else m=0;var g=m>0?m:0,A=m<0?-m:0,b=this._size[0],v=this._size[1],x=Math.min(b-A,v-g),w=[],S=[],k=[];k[0]=0;for(var j=g;j0?A:0,k=A<0?-A:0,j=m[0],O=m[1],C=Math.min(j-k,O-S),N;if(Ir(g)){if(g.length!==C)throw new Error("Invalid value array length");N=function(Y){return g[Y]}}else if(St(g)){var D=g.size();if(D.length!==1||D[0]!==C)throw new Error("Invalid matrix length");N=function(Y){return g.get([Y])}}else N=function(){return g};for(var P=[],q=[],z=[],I=0;I=0&&T=k||v[O]!==g)){var N=b?b[j]:void 0;v.splice(O,0,g),b&&b.splice(O,0,N),v.splice(O<=j?j+1:j,1),b&&b.splice(O<=j?j+1:j,1);continue}if(O=k||v[j]!==m)){var D=b?b[O]:void 0;v.splice(j,0,m),b&&b.splice(j,0,D),v.splice(j<=O?O+1:O,1),b&&b.splice(j<=O?O+1:O,1)}}},i},{isClass:!0});var gRe="number",vRe=["typed"];function yRe(e){var t=e.match(/(0[box])([0-9a-fA-F]*)\.([0-9a-fA-F]*)/);if(t){var r={"0b":2,"0o":8,"0x":16}[t[1]],n=t[2],i=t[3];return{input:e,radix:r,integerPart:n,fractionalPart:i}}else return null}function bRe(e){for(var t=parseInt(e.integerPart,e.radix),r=0,n=0;n{var{typed:t}=e,r=t("number",{"":function(){return 0},number:function(i){return i},string:function(i){if(i==="NaN")return NaN;var a=yRe(i);if(a)return bRe(a);var o=0,s=i.match(/(0[box][0-9a-fA-F]*)i([0-9]*)/);s&&(o=Number(s[2]),i=s[1]);var l=Number(i);if(isNaN(l))throw new SyntaxError('String "'+i+'" is not a valid number');if(s){if(l>2**o-1)throw new SyntaxError('String "'.concat(i,'" is out of range'));l>=2**(o-1)&&(l=l-2**o)}return l},BigNumber:function(i){return i.toNumber()},Fraction:function(i){return i.valueOf()},Unit:t.referToSelf(n=>i=>{var a=i.clone();return a.value=n(i.value),a}),null:function(i){return 0},"Unit, string | Unit":function(i,a){return i.toNumber(a)},"Array | Matrix":t.referToSelf(n=>i=>jt(i,n))});return r.fromJSON=function(n){return parseFloat(n.value)},r});var cle="string",xRe=["typed"],YT=V(cle,xRe,e=>{var{typed:t}=e;return t(cle,{"":function(){return""},number:Bp,null:function(n){return"null"},boolean:function(n){return n+""},string:function(n){return n},"Array | Matrix":t.referToSelf(r=>n=>jt(n,r)),any:function(n){return String(n)}})});var fle="boolean",wRe=["typed"],ZT=V(fle,wRe,e=>{var{typed:t}=e;return t(fle,{"":function(){return!1},boolean:function(n){return n},number:function(n){return!!n},null:function(n){return!1},BigNumber:function(n){return!n.isZero()},string:function(n){var i=n.toLowerCase();if(i==="true")return!0;if(i==="false")return!1;var a=Number(n);if(n!==""&&!isNaN(a))return!!a;throw new Error('Cannot convert "'+n+'" to a boolean')},"Array | Matrix":t.referToSelf(r=>n=>jt(n,r))})});var SRe="bignumber",ERe=["typed","BigNumber"],XT=V(SRe,ERe,e=>{var{typed:t,BigNumber:r}=e;return t("bignumber",{"":function(){return new r(0)},number:function(i){return new r(i+"")},string:function(i){var a=i.match(/(0[box][0-9a-fA-F]*)i([0-9]*)/);if(a){var o=a[2],s=r(a[1]),l=new r(2).pow(Number(o));if(s.gt(l.sub(1)))throw new SyntaxError('String "'.concat(i,'" is out of range'));var u=new r(2).pow(Number(o)-1);return s.gte(u)?s.sub(l):s}return new r(i)},BigNumber:function(i){return i},Unit:t.referToSelf(n=>i=>{var a=i.clone();return a.value=n(i.value),a}),Fraction:function(i){return new r(i.n).div(i.d).times(i.s)},null:function(i){return new r(0)},"Array | Matrix":t.referToSelf(n=>i=>jt(i,n))})});var kRe="complex",CRe=["typed","Complex"],KT=V(kRe,CRe,e=>{var{typed:t,Complex:r}=e;return t("complex",{"":function(){return r.ZERO},number:function(i){return new r(i,0)},"number, number":function(i,a){return new r(i,a)},"BigNumber, BigNumber":function(i,a){return new r(i.toNumber(),a.toNumber())},Fraction:function(i){return new r(i.valueOf(),0)},Complex:function(i){return i.clone()},string:function(i){return r(i)},null:function(i){return r(0)},Object:function(i){if("re"in i&&"im"in i)return new r(i.re,i.im);if("r"in i&&"phi"in i||"abs"in i&&"arg"in i)return new r(i);throw new Error("Expected object with properties (re and im) or (r and phi) or (abs and arg)")},"Array | Matrix":t.referToSelf(n=>i=>jt(i,n))})});var DRe="fraction",ORe=["typed","Fraction"],JT=V(DRe,ORe,e=>{var{typed:t,Fraction:r}=e;return t("fraction",{number:function(i){if(!isFinite(i)||isNaN(i))throw new Error(i+" cannot be represented as a fraction");return new r(i)},string:function(i){return new r(i)},"number, number":function(i,a){return new r(i,a)},null:function(i){return new r(0)},BigNumber:function(i){return new r(i.toString())},Fraction:function(i){return i},Unit:t.referToSelf(n=>i=>{var a=i.clone();return a.value=n(i.value),a}),Object:function(i){return new r(i)},"Array | Matrix":t.referToSelf(n=>i=>jt(i,n))})});var dle="matrix",MRe=["typed","Matrix","DenseMatrix","SparseMatrix"],eF=V(dle,MRe,e=>{var{typed:t,Matrix:r,DenseMatrix:n,SparseMatrix:i}=e;return t(dle,{"":function(){return a([])},string:function(s){return a([],s)},"string, string":function(s,l){return a([],s,l)},Array:function(s){return a(s)},Matrix:function(s){return a(s,s.storage())},"Array | Matrix, string":a,"Array | Matrix, string, string":a});function a(o,s,l){if(s==="dense"||s==="default"||s===void 0)return new n(o,l);if(s==="sparse")return new i(o,l);throw new TypeError("Unknown matrix type "+JSON.stringify(s)+".")}});var ple="matrixFromFunction",jRe=["typed","matrix","isZero"],tF=V(ple,jRe,e=>{var{typed:t,matrix:r,isZero:n}=e;return t(ple,{"Array | Matrix, function, string, string":function(o,s,l,u){return i(o,s,l,u)},"Array | Matrix, function, string":function(o,s,l){return i(o,s,l)},"Matrix, function":function(o,s){return i(o,s,"dense")},"Array, function":function(o,s){return i(o,s,"dense").toArray()},"Array | Matrix, string, function":function(o,s,l){return i(o,l,s)},"Array | Matrix, string, string, function":function(o,s,l,u){return i(o,u,s,l)}});function i(a,o,s,l){var u;return l!==void 0?u=r(s,l):u=r(s),u.resize(a),u.forEach(function(c,f){var d=o(f);n(d)||u.set(f,d)}),u}});var mle="matrixFromRows",NRe=["typed","matrix","flatten","size"],rF=V(mle,NRe,e=>{var{typed:t,matrix:r,flatten:n,size:i}=e;return t(mle,{"...Array":function(l){return a(l)},"...Matrix":function(l){return r(a(l.map(u=>u.toArray())))}});function a(s){if(s.length===0)throw new TypeError("At least one row is needed to construct a matrix.");var l=o(s[0]),u=[];for(var c of s){var f=o(c);if(f!==l)throw new TypeError("The vectors had different length: "+(l|0)+" \u2260 "+(f|0));u.push(n(c))}return u}function o(s){var l=i(s);if(l.length===1)return l[0];if(l.length===2){if(l[0]===1)return l[1];if(l[1]===1)return l[0];throw new TypeError("At least one of the arguments is not a vector.")}else throw new TypeError("Only one- or two-dimensional vectors are supported.")}});var hle="matrixFromColumns",TRe=["typed","matrix","flatten","size"],nF=V(hle,TRe,e=>{var{typed:t,matrix:r,flatten:n,size:i}=e;return t(hle,{"...Array":function(l){return a(l)},"...Matrix":function(l){return r(a(l.map(u=>u.toArray())))}});function a(s){if(s.length===0)throw new TypeError("At least one column is needed to construct a matrix.");for(var l=o(s[0]),u=[],c=0;c{var{typed:t}=e;return t(Ale,{"Unit, Array":function(n,i){return n.splitUnit(i)}})});var gle="unaryMinus",_Re=["typed"],aF=V(gle,_Re,e=>{var{typed:t}=e;return t(gle,{number:CW,"Complex | BigNumber | Fraction":r=>r.neg(),Unit:t.referToSelf(r=>n=>{var i=n.clone();return i.value=t.find(r,i.valueType())(n.value),i}),"Array | Matrix":t.referToSelf(r=>n=>jt(n,r,!0))})});var vle="unaryPlus",PRe=["typed","config","BigNumber"],oF=V(vle,PRe,e=>{var{typed:t,config:r,BigNumber:n}=e;return t(vle,{number:DW,Complex:function(a){return a},BigNumber:function(a){return a},Fraction:function(a){return a},Unit:function(a){return a.clone()},"Array | Matrix":t.referToSelf(i=>a=>jt(a,i,!0)),"boolean | string":function(a){return r.number==="BigNumber"?new n(+a):+a}})});var yle="abs",IRe=["typed"],sF=V(yle,IRe,e=>{var{typed:t}=e;return t(yle,{number:wW,"Complex | BigNumber | Fraction | Unit":r=>r.abs(),"Array | Matrix":t.referToSelf(r=>n=>jt(n,r,!0))})});var ble="apply",BRe=["typed","isInteger"],G0=V(ble,BRe,e=>{var{typed:t,isInteger:r}=e;return t(ble,{"Array | Matrix, number | BigNumber, function":function(i,a,o){if(!r(a))throw new TypeError("Integer number expected for dimension");var s=Array.isArray(i)?Yt(i):i.size();if(a<0||a>=s.length)throw new As(a,s.length);return St(i)?i.create(lF(i.valueOf(),a,o)):lF(i,a,o)}})});function lF(e,t,r){var n,i,a;if(t<=0)if(Array.isArray(e[0])){for(a=RRe(e),i=[],n=0;n{var{typed:t}=e;return t(xle,{"number, number":SW,"Complex, Complex":function(n,i){return n.add(i)},"BigNumber, BigNumber":function(n,i){return n.plus(i)},"Fraction, Fraction":function(n,i){return n.add(i)},"Unit, Unit":t.referToSelf(r=>(n,i)=>{if(n.value===null||n.value===void 0)throw new Error("Parameter x contains a unit with undefined value");if(i.value===null||i.value===void 0)throw new Error("Parameter y contains a unit with undefined value");if(!n.equalBase(i))throw new Error("Units do not match");var a=n.clone();return a.value=t.find(r,[a.valueType(),i.valueType()])(a.value,i.value),a.fixPrefix=!1,a})})});var wle="subtractScalar",qRe=["typed"],cF=V(wle,qRe,e=>{var{typed:t}=e;return t(wle,{"number, number":EW,"Complex, Complex":function(n,i){return n.sub(i)},"BigNumber, BigNumber":function(n,i){return n.minus(i)},"Fraction, Fraction":function(n,i){return n.sub(i)},"Unit, Unit":t.referToSelf(r=>(n,i)=>{if(n.value===null||n.value===void 0)throw new Error("Parameter x contains a unit with undefined value");if(i.value===null||i.value===void 0)throw new Error("Parameter y contains a unit with undefined value");if(!n.equalBase(i))throw new Error("Units do not match");var a=n.clone();return a.value=t.find(r,[a.valueType(),i.valueType()])(a.value,i.value),a.fixPrefix=!1,a})})});var Sle="cbrt",LRe=["config","typed","isNegative","unaryMinus","matrix","Complex","BigNumber","Fraction"],fF=V(Sle,LRe,e=>{var{config:t,typed:r,isNegative:n,unaryMinus:i,matrix:a,Complex:o,BigNumber:s,Fraction:l}=e;return r(Sle,{number:eS,Complex:u,"Complex, boolean":u,BigNumber:function(d){return d.cbrt()},Unit:c});function u(f,d){var p=f.arg()/3,h=f.abs(),m=new o(eS(h),0).mul(new o(0,p).exp());if(d){var g=[m,new o(eS(h),0).mul(new o(0,p+Math.PI*2/3).exp()),new o(eS(h),0).mul(new o(0,p-Math.PI*2/3).exp())];return t.matrix==="Array"?g:a(g)}else return m}function c(f){if(f.value&&ds(f.value)){var d=f.clone();return d.value=1,d=d.pow(1/3),d.value=u(f.value),d}else{var p=n(f.value);p&&(f.value=i(f.value));var h;It(f.value)?h=new s(1).div(3):gf(f.value)?h=new l(1,3):h=1/3;var m=f.pow(h);return p&&(m.value=i(m.value)),m}}});var zRe="matAlgo11xS0s",URe=["typed","equalScalar"],Gn=V(zRe,URe,e=>{var{typed:t,equalScalar:r}=e;return function(i,a,o,s){var l=i._values,u=i._index,c=i._ptr,f=i._size,d=i._datatype;if(!l)throw new Error("Cannot perform operation on Pattern Sparse Matrix and Scalar value");var p=f[0],h=f[1],m,g=r,A=0,b=o;typeof d=="string"&&(m=d,g=t.find(r,[m,m]),A=t.convert(0,m),a=t.convert(a,m),b=t.find(o,[m,m]));for(var v=[],x=[],w=[],S=0;S{var{typed:t,DenseMatrix:r}=e;return function(i,a,o,s){var l=i._values,u=i._index,c=i._ptr,f=i._size,d=i._datatype;if(!l)throw new Error("Cannot perform operation on Pattern Sparse Matrix and Scalar value");var p=f[0],h=f[1],m,g=o;typeof d=="string"&&(m=d,a=t.convert(a,m),g=t.find(o,[m,m]));for(var A=[],b=[],v=[],x=0;x{var{typed:t}=e;return function(i,a,o,s){var l=i._data,u=i._size,c=i._datatype,f,d=o;typeof c=="string"&&(f=c,a=t.convert(a,f),d=t.find(o,[f,f]));var p=u.length>0?r(d,0,u,u[0],l,a,s):[];return i.createDenseMatrix({data:p,size:Bt(u),datatype:f})};function r(n,i,a,o,s,l,u){var c=[];if(i===a.length-1)for(var f=0;f{var{typed:t,config:r,round:n}=e;return t(yH,{number:function(a){return Oa(a,n(a),r.epsilon)?n(a):Math.ceil(a)},"number, number":function(a,o){if(Oa(a,n(a,o),r.epsilon))return n(a,o);var[s,l]="".concat(a,"e").split("e"),u=Math.ceil(Number("".concat(s,"e").concat(Number(l)+o)));return[s,l]="".concat(u,"e").split("e"),Number("".concat(s,"e").concat(Number(l)-o))}})}),dF=V(yH,QRe,e=>{var{typed:t,config:r,round:n,matrix:i,equalScalar:a,zeros:o,DenseMatrix:s}=e,l=Gn({typed:t,equalScalar:a}),u=An({typed:t,DenseMatrix:s}),c=vo({typed:t}),f=YRe({typed:t,config:r,round:n});return t("ceil",{number:f.signatures.number,"number,number":f.signatures["number,number"],Complex:function(p){return p.ceil()},"Complex, number":function(p,h){return p.ceil(h)},"Complex, BigNumber":function(p,h){return p.ceil(h.toNumber())},BigNumber:function(p){return _o(p,n(p),r.epsilon)?n(p):p.ceil()},"BigNumber, BigNumber":function(p,h){return _o(p,n(p,h),r.epsilon)?n(p,h):p.toDecimalPlaces(h.toNumber(),wy.ROUND_CEIL)},Fraction:function(p){return p.ceil()},"Fraction, number":function(p,h){return p.ceil(h)},"Fraction, BigNumber":function(p,h){return p.ceil(h.toNumber())},"Array | Matrix":t.referToSelf(d=>p=>jt(p,d,!0)),"Array, number | BigNumber":t.referToSelf(d=>(p,h)=>jt(p,m=>d(m,h),!0)),"SparseMatrix, number | BigNumber":t.referToSelf(d=>(p,h)=>l(p,h,d,!1)),"DenseMatrix, number | BigNumber":t.referToSelf(d=>(p,h)=>c(p,h,d,!1)),"number | Complex | Fraction | BigNumber, Array":t.referToSelf(d=>(p,h)=>c(i(h),p,d,!0).valueOf()),"number | Complex | Fraction | BigNumber, Matrix":t.referToSelf(d=>(p,h)=>a(p,0)?o(h.size(),h.storage()):h.storage()==="dense"?c(h,p,d,!0):u(h,p,d,!0))})});var Ele="cube",ZRe=["typed"],pF=V(Ele,ZRe,e=>{var{typed:t}=e;return t(Ele,{number:OW,Complex:function(n){return n.mul(n).mul(n)},BigNumber:function(n){return n.times(n).times(n)},Fraction:function(n){return n.pow(3)},Unit:function(n){return n.pow(3)}})});var kle="exp",XRe=["typed"],mF=V(kle,XRe,e=>{var{typed:t}=e;return t(kle,{number:MW,Complex:function(n){return n.exp()},BigNumber:function(n){return n.exp()}})});var Cle="expm1",KRe=["typed","Complex"],hF=V(Cle,KRe,e=>{var{typed:t,Complex:r}=e;return t(Cle,{number:jW,Complex:function(i){var a=Math.exp(i.re);return new r(a*Math.cos(i.im)-1,a*Math.sin(i.im))},BigNumber:function(i){return i.exp().minus(1)}})});var bH="fix",JRe=["typed","Complex","matrix","ceil","floor","equalScalar","zeros","DenseMatrix"],e$e=V(bH,["typed","ceil","floor"],e=>{var{typed:t,ceil:r,floor:n}=e;return t(bH,{number:function(a){return a>0?n(a):r(a)},"number, number":function(a,o){return a>0?n(a,o):r(a,o)}})}),AF=V(bH,JRe,e=>{var{typed:t,Complex:r,matrix:n,ceil:i,floor:a,equalScalar:o,zeros:s,DenseMatrix:l}=e,u=An({typed:t,DenseMatrix:l}),c=vo({typed:t}),f=e$e({typed:t,ceil:i,floor:a});return t("fix",{number:f.signatures.number,"number, number | BigNumber":f.signatures["number,number"],Complex:function(p){return new r(p.re>0?Math.floor(p.re):Math.ceil(p.re),p.im>0?Math.floor(p.im):Math.ceil(p.im))},"Complex, number":function(p,h){return new r(p.re>0?a(p.re,h):i(p.re,h),p.im>0?a(p.im,h):i(p.im,h))},"Complex, BigNumber":function(p,h){var m=h.toNumber();return new r(p.re>0?a(p.re,m):i(p.re,m),p.im>0?a(p.im,m):i(p.im,m))},BigNumber:function(p){return p.isNegative()?i(p):a(p)},"BigNumber, number | BigNumber":function(p,h){return p.isNegative()?i(p,h):a(p,h)},Fraction:function(p){return p.s<0?p.ceil():p.floor()},"Fraction, number | BigNumber":function(p,h){return p.s<0?i(p,h):a(p,h)},"Array | Matrix":t.referToSelf(d=>p=>jt(p,d,!0)),"Array | Matrix, number | BigNumber":t.referToSelf(d=>(p,h)=>jt(p,m=>d(m,h),!0)),"number | Complex | Fraction | BigNumber, Array":t.referToSelf(d=>(p,h)=>c(n(h),p,d,!0).valueOf()),"number | Complex | Fraction | BigNumber, Matrix":t.referToSelf(d=>(p,h)=>o(p,0)?s(h.size(),h.storage()):h.storage()==="dense"?c(h,p,d,!0):u(h,p,d,!0))})});var xH="floor",t$e=["typed","config","round","matrix","equalScalar","zeros","DenseMatrix"],r$e=V(xH,["typed","config","round"],e=>{var{typed:t,config:r,round:n}=e;return t(xH,{number:function(a){return Oa(a,n(a),r.epsilon)?n(a):Math.floor(a)},"number, number":function(a,o){if(Oa(a,n(a,o),r.epsilon))return n(a,o);var[s,l]="".concat(a,"e").split("e"),u=Math.floor(Number("".concat(s,"e").concat(Number(l)+o)));return[s,l]="".concat(u,"e").split("e"),Number("".concat(s,"e").concat(Number(l)-o))}})}),nS=V(xH,t$e,e=>{var{typed:t,config:r,round:n,matrix:i,equalScalar:a,zeros:o,DenseMatrix:s}=e,l=Gn({typed:t,equalScalar:a}),u=An({typed:t,DenseMatrix:s}),c=vo({typed:t}),f=r$e({typed:t,config:r,round:n});return t("floor",{number:f.signatures.number,"number,number":f.signatures["number,number"],Complex:function(p){return p.floor()},"Complex, number":function(p,h){return p.floor(h)},"Complex, BigNumber":function(p,h){return p.floor(h.toNumber())},BigNumber:function(p){return _o(p,n(p),r.epsilon)?n(p):p.floor()},"BigNumber, BigNumber":function(p,h){return _o(p,n(p,h),r.epsilon)?n(p,h):p.toDecimalPlaces(h.toNumber(),wy.ROUND_FLOOR)},Fraction:function(p){return p.floor()},"Fraction, number":function(p,h){return p.floor(h)},"Fraction, BigNumber":function(p,h){return p.floor(h.toNumber())},"Array | Matrix":t.referToSelf(d=>p=>jt(p,d,!0)),"Array, number | BigNumber":t.referToSelf(d=>(p,h)=>jt(p,m=>d(m,h),!0)),"SparseMatrix, number | BigNumber":t.referToSelf(d=>(p,h)=>l(p,h,d,!1)),"DenseMatrix, number | BigNumber":t.referToSelf(d=>(p,h)=>c(p,h,d,!1)),"number | Complex | Fraction | BigNumber, Array":t.referToSelf(d=>(p,h)=>c(i(h),p,d,!0).valueOf()),"number | Complex | Fraction | BigNumber, Matrix":t.referToSelf(d=>(p,h)=>a(p,0)?o(h.size(),h.storage()):h.storage()==="dense"?c(h,p,d,!0):u(h,p,d,!0))})});var n$e="matAlgo02xDS0",i$e=["typed","equalScalar"],yo=V(n$e,i$e,e=>{var{typed:t,equalScalar:r}=e;return function(i,a,o,s){var l=i._data,u=i._size,c=i._datatype||i.getDataType(),f=a._values,d=a._index,p=a._ptr,h=a._size,m=a._datatype||a._data===void 0?a._datatype:a.getDataType();if(u.length!==h.length)throw new nr(u.length,h.length);if(u[0]!==h[0]||u[1]!==h[1])throw new RangeError("Dimension mismatch. Matrix A ("+u+") must match Matrix B ("+h+")");if(!f)throw new Error("Cannot perform operation on Dense Matrix and Pattern Sparse Matrix");var g=u[0],A=u[1],b,v=r,x=0,w=o;typeof c=="string"&&c===m&&c!=="mixed"&&(b=c,v=t.find(r,[b,b]),x=t.convert(0,b),w=t.find(o,[b,b]));for(var S=[],k=[],j=[],O=0;O{var{typed:t}=e;return function(n,i,a,o){var s=n._data,l=n._size,u=n._datatype||n.getDataType(),c=i._values,f=i._index,d=i._ptr,p=i._size,h=i._datatype||i._data===void 0?i._datatype:i.getDataType();if(l.length!==p.length)throw new nr(l.length,p.length);if(l[0]!==p[0]||l[1]!==p[1])throw new RangeError("Dimension mismatch. Matrix A ("+l+") must match Matrix B ("+p+")");if(!c)throw new Error("Cannot perform operation on Dense Matrix and Pattern Sparse Matrix");var m=l[0],g=l[1],A,b=0,v=a;typeof u=="string"&&u===h&&u!=="mixed"&&(A=u,b=t.convert(0,A),v=t.find(a,[A,A]));for(var x=[],w=0;w{var{typed:t,equalScalar:r}=e;return function(i,a,o){var s=i._values,l=i._index,u=i._ptr,c=i._size,f=i._datatype||i._data===void 0?i._datatype:i.getDataType(),d=a._values,p=a._index,h=a._ptr,m=a._size,g=a._datatype||a._data===void 0?a._datatype:a.getDataType();if(c.length!==m.length)throw new nr(c.length,m.length);if(c[0]!==m[0]||c[1]!==m[1])throw new RangeError("Dimension mismatch. Matrix A ("+c+") must match Matrix B ("+m+")");var A=c[0],b=c[1],v,x=r,w=0,S=o;typeof f=="string"&&f===g&&f!=="mixed"&&(v=f,x=t.find(r,[v,v]),w=t.convert(0,v),S=t.find(o,[v,v]));var k=s&&d?[]:void 0,j=[],O=[],C=k?[]:void 0,N=k?[]:void 0,D=[],P=[],q,z,I,T;for(z=0;z{var{typed:t}=e;return function(i,a,o){var s=i._data,l=i._size,u=i._datatype,c=a._data,f=a._size,d=a._datatype,p=[];if(l.length!==f.length)throw new nr(l.length,f.length);for(var h=0;h0?r(g,0,p,p[0],s,c):[];return i.createDenseMatrix({data:A,size:p,datatype:m})};function r(n,i,a,o,s,l){var u=[];if(i===a.length-1)for(var c=0;c{var{concat:t}=e;return function(i,a){var o=Math.max(i._size.length,a._size.length);if(i._size.length===a._size.length&&i._size.every((h,m)=>h===a._size[m]))return[i,a];for(var s=r(i._size,o,0),l=r(a._size,o,0),u=[],c=0;c{var{typed:t,matrix:r,concat:n}=e,i=Dle({typed:t}),a=vo({typed:t}),o=Ole({concat:n});return function(l){var u=l.elop,c=l.SD||l.DS,f;u?(f={"DenseMatrix, DenseMatrix":(m,g)=>i(...o(m,g),u),"Array, Array":(m,g)=>i(...o(r(m),r(g)),u).valueOf(),"Array, DenseMatrix":(m,g)=>i(...o(r(m),g),u),"DenseMatrix, Array":(m,g)=>i(...o(m,r(g)),u)},l.SS&&(f["SparseMatrix, SparseMatrix"]=(m,g)=>l.SS(...o(m,g),u,!1)),l.DS&&(f["DenseMatrix, SparseMatrix"]=(m,g)=>l.DS(...o(m,g),u,!1),f["Array, SparseMatrix"]=(m,g)=>l.DS(...o(r(m),g),u,!1)),c&&(f["SparseMatrix, DenseMatrix"]=(m,g)=>c(...o(g,m),u,!0),f["SparseMatrix, Array"]=(m,g)=>c(...o(r(g),m),u,!0))):(f={"DenseMatrix, DenseMatrix":t.referToSelf(m=>(g,A)=>i(...o(g,A),m)),"Array, Array":t.referToSelf(m=>(g,A)=>i(...o(r(g),r(A)),m).valueOf()),"Array, DenseMatrix":t.referToSelf(m=>(g,A)=>i(...o(r(g),A),m)),"DenseMatrix, Array":t.referToSelf(m=>(g,A)=>i(...o(g,r(A)),m))},l.SS&&(f["SparseMatrix, SparseMatrix"]=t.referToSelf(m=>(g,A)=>l.SS(...o(g,A),m,!1))),l.DS&&(f["DenseMatrix, SparseMatrix"]=t.referToSelf(m=>(g,A)=>l.DS(...o(g,A),m,!1)),f["Array, SparseMatrix"]=t.referToSelf(m=>(g,A)=>l.DS(...o(r(g),A),m,!1))),c&&(f["SparseMatrix, DenseMatrix"]=t.referToSelf(m=>(g,A)=>c(...o(A,g),m,!0)),f["SparseMatrix, Array"]=t.referToSelf(m=>(g,A)=>c(...o(r(A),g),m,!0))));var d=l.scalar||"any",p=l.Ds||l.Ss;p&&(u?(f["DenseMatrix,"+d]=(m,g)=>a(m,g,u,!1),f[d+", DenseMatrix"]=(m,g)=>a(g,m,u,!0),f["Array,"+d]=(m,g)=>a(r(m),g,u,!1).valueOf(),f[d+", Array"]=(m,g)=>a(r(g),m,u,!0).valueOf()):(f["DenseMatrix,"+d]=t.referToSelf(m=>(g,A)=>a(g,A,m,!1)),f[d+", DenseMatrix"]=t.referToSelf(m=>(g,A)=>a(A,g,m,!0)),f["Array,"+d]=t.referToSelf(m=>(g,A)=>a(r(g),A,m,!1).valueOf()),f[d+", Array"]=t.referToSelf(m=>(g,A)=>a(r(A),g,m,!0).valueOf())));var h=l.sS!==void 0?l.sS:l.Ss;return u?(l.Ss&&(f["SparseMatrix,"+d]=(m,g)=>l.Ss(m,g,u,!1)),h&&(f[d+", SparseMatrix"]=(m,g)=>h(g,m,u,!0))):(l.Ss&&(f["SparseMatrix,"+d]=t.referToSelf(m=>(g,A)=>l.Ss(g,A,m,!1))),h&&(f[d+", SparseMatrix"]=t.referToSelf(m=>(g,A)=>h(A,g,m,!0)))),u&&u.signatures&&iT(f,u.signatures),f}});var Mle="mod",h$e=["typed","config","round","matrix","equalScalar","zeros","DenseMatrix","concat"],iS=V(Mle,h$e,e=>{var{typed:t,config:r,round:n,matrix:i,equalScalar:a,zeros:o,DenseMatrix:s,concat:l}=e,u=nS({typed:t,config:r,round:n,matrix:i,equalScalar:a,zeros:o,DenseMatrix:s}),c=yo({typed:t,equalScalar:a}),f=xi({typed:t}),d=Q0({typed:t,equalScalar:a}),p=Gn({typed:t,equalScalar:a}),h=An({typed:t,DenseMatrix:s}),m=fr({typed:t,matrix:i,concat:l});return t(Mle,{"number, number":g,"BigNumber, BigNumber":function(b,v){return v.isZero()?b:b.sub(v.mul(u(b.div(v))))},"Fraction, Fraction":function(b,v){return v.equals(0)?b:b.sub(v.mul(u(b.div(v))))}},m({SS:d,DS:f,SD:c,Ss:p,sS:h}));function g(A,b){return b===0?A:A-b*u(A/b)}});var A$e="matAlgo01xDSid",g$e=["typed"],ou=V(A$e,g$e,e=>{var{typed:t}=e;return function(n,i,a,o){var s=n._data,l=n._size,u=n._datatype||n.getDataType(),c=i._values,f=i._index,d=i._ptr,p=i._size,h=i._datatype||i._data===void 0?i._datatype:i.getDataType();if(l.length!==p.length)throw new nr(l.length,p.length);if(l[0]!==p[0]||l[1]!==p[1])throw new RangeError("Dimension mismatch. Matrix A ("+l+") must match Matrix B ("+p+")");if(!c)throw new Error("Cannot perform operation on Dense Matrix and Pattern Sparse Matrix");var m=l[0],g=l[1],A=typeof u=="string"&&u!=="mixed"&&u===h?u:void 0,b=A?t.find(a,[A,A]):a,v,x,w=[];for(v=0;v{var{typed:t,equalScalar:r}=e;return function(i,a,o){var s=i._values,l=i._index,u=i._ptr,c=i._size,f=i._datatype||i._data===void 0?i._datatype:i.getDataType(),d=a._values,p=a._index,h=a._ptr,m=a._size,g=a._datatype||a._data===void 0?a._datatype:a.getDataType();if(c.length!==m.length)throw new nr(c.length,m.length);if(c[0]!==m[0]||c[1]!==m[1])throw new RangeError("Dimension mismatch. Matrix A ("+c+") must match Matrix B ("+m+")");var A=c[0],b=c[1],v,x=r,w=0,S=o;typeof f=="string"&&f===g&&f!=="mixed"&&(v=f,x=t.find(r,[v,v]),w=t.convert(0,v),S=t.find(o,[v,v]));var k=s&&d?[]:void 0,j=[],O=[],C=s&&d?[]:void 0,N=s&&d?[]:void 0,D=[],P=[],q,z,I,T,L;for(z=0;z{var{typed:t,DenseMatrix:r}=e;return function(i,a,o,s){var l=i._values,u=i._index,c=i._ptr,f=i._size,d=i._datatype;if(!l)throw new Error("Cannot perform operation on Pattern Sparse Matrix and Scalar value");var p=f[0],h=f[1],m,g=o;typeof d=="string"&&(m=d,a=t.convert(a,m),g=t.find(o,[m,m]));for(var A=[],b=[],v=[],x=0;xArray.isArray(t))}var gF=V(jle,w$e,e=>{var{typed:t,matrix:r,config:n,round:i,equalScalar:a,zeros:o,BigNumber:s,DenseMatrix:l,concat:u}=e,c=iS({typed:t,config:n,round:i,matrix:r,equalScalar:a,zeros:o,DenseMatrix:l,concat:u}),f=ou({typed:t}),d=aS({typed:t,equalScalar:a}),p=Dc({typed:t,DenseMatrix:l}),h=fr({typed:t,matrix:r,concat:u});return t(jle,{"number, number":m,"BigNumber, BigNumber":g,"Fraction, Fraction":(A,b)=>A.gcd(b)},h({SS:d,DS:f,Ss:p}),{[S$e]:t.referToSelf(A=>(b,v,x)=>{for(var w=A(b,v),S=0;Sb=>{if(b.length===1&&Array.isArray(b[0])&&Nle(b[0]))return A(...b[0]);if(Nle(b))return A(...b);throw new bf("gcd() supports only 1d matrices!")}),Matrix:t.referToSelf(A=>b=>A(b.toArray()))});function m(A,b){if(!wt(A)||!wt(b))throw new Error("Parameters in function gcd must be integer numbers");for(var v;b!==0;)v=c(A,b),A=b,b=v;return A<0?-A:A}function g(A,b){if(!A.isInt()||!b.isInt())throw new Error("Parameters in function gcd must be integer numbers");for(var v=new s(0);!b.isZero();){var x=c(A,b);A=b,b=x}return A.lt(v)?A.neg():A}});var E$e="matAlgo06xS0S0",k$e=["typed","equalScalar"],Y0=V(E$e,k$e,e=>{var{typed:t,equalScalar:r}=e;return function(i,a,o){var s=i._values,l=i._size,u=i._datatype||i._data===void 0?i._datatype:i.getDataType(),c=a._values,f=a._size,d=a._datatype||a._data===void 0?a._datatype:a.getDataType();if(l.length!==f.length)throw new nr(l.length,f.length);if(l[0]!==f[0]||l[1]!==f[1])throw new RangeError("Dimension mismatch. Matrix A ("+l+") must match Matrix B ("+f+")");var p=l[0],h=l[1],m,g=r,A=0,b=o;typeof u=="string"&&u===d&&u!=="mixed"&&(m=u,g=t.find(r,[m,m]),A=t.convert(0,m),b=t.find(o,[m,m]));for(var v=s&&c?[]:void 0,x=[],w=[],S=v?[]:void 0,k=[],j=[],O=0;O{var{typed:t,matrix:r,equalScalar:n,concat:i}=e,a=yo({typed:t,equalScalar:n}),o=Y0({typed:t,equalScalar:n}),s=Gn({typed:t,equalScalar:n}),l=fr({typed:t,matrix:r,concat:i}),u="number | BigNumber | Fraction | Matrix | Array",c={};return c["".concat(u,", ").concat(u,", ...").concat(u)]=t.referToSelf(d=>(p,h,m)=>{for(var g=d(p,h),A=0;Ad.lcm(p)},l({SS:o,DS:a,Ss:s}),c);function f(d,p){if(!d.isInt()||!p.isInt())throw new Error("Parameters in function lcm must be integer numbers");if(d.isZero())return d;if(p.isZero())return p;for(var h=d.times(p);!p.isZero();){var m=p;p=d.mod(m),d=m}return h.div(d).abs()}});var Fle="log10",D$e=["typed","config","Complex"],yF=V(Fle,D$e,e=>{var{typed:t,config:r,Complex:n}=e;return t(Fle,{number:function(a){return a>=0||r.predictable?TW(a):new n(a,0).log().div(Math.LN10)},Complex:function(a){return new n(a).log().div(Math.LN10)},BigNumber:function(a){return!a.isNegative()||r.predictable?a.log():new n(a.toNumber(),0).log().div(Math.LN10)},"Array | Matrix":t.referToSelf(i=>a=>jt(a,i))})});var _le="log2",O$e=["typed","config","Complex"],bF=V(_le,O$e,e=>{var{typed:t,config:r,Complex:n}=e;return t(_le,{number:function(o){return o>=0||r.predictable?FW(o):i(new n(o,0))},Complex:i,BigNumber:function(o){return!o.isNegative()||r.predictable?o.log(2):i(new n(o.toNumber(),0))},"Array | Matrix":t.referToSelf(a=>o=>jt(o,a))});function i(a){var o=Math.sqrt(a.re*a.re+a.im*a.im);return new n(Math.log2?Math.log2(o):Math.log(o)/Math.LN2,Math.atan2(a.im,a.re)/Math.LN2)}});var M$e="multiplyScalar",j$e=["typed"],xF=V(M$e,j$e,e=>{var{typed:t}=e;return t("multiplyScalar",{"number, number":kW,"Complex, Complex":function(n,i){return n.mul(i)},"BigNumber, BigNumber":function(n,i){return n.times(i)},"Fraction, Fraction":function(n,i){return n.mul(i)},"number | Fraction | BigNumber | Complex, Unit":(r,n)=>n.multiply(r),"Unit, number | Fraction | BigNumber | Complex | Unit":(r,n)=>r.multiply(n)})});var Ple="multiply",N$e=["typed","matrix","addScalar","multiplyScalar","equalScalar","dot"],wF=V(Ple,N$e,e=>{var{typed:t,matrix:r,addScalar:n,multiplyScalar:i,equalScalar:a,dot:o}=e,s=Gn({typed:t,equalScalar:a}),l=vo({typed:t});function u(w,S){switch(w.length){case 1:switch(S.length){case 1:if(w[0]!==S[0])throw new RangeError("Dimension mismatch in multiplication. Vectors must have the same length");break;case 2:if(w[0]!==S[0])throw new RangeError("Dimension mismatch in multiplication. Vector length ("+w[0]+") must match Matrix rows ("+S[0]+")");break;default:throw new Error("Can only multiply a 1 or 2 dimensional matrix (Matrix B has "+S.length+" dimensions)")}break;case 2:switch(S.length){case 1:if(w[1]!==S[0])throw new RangeError("Dimension mismatch in multiplication. Matrix columns ("+w[1]+") must match Vector length ("+S[0]+")");break;case 2:if(w[1]!==S[0])throw new RangeError("Dimension mismatch in multiplication. Matrix A columns ("+w[1]+") must match Matrix B rows ("+S[0]+")");break;default:throw new Error("Can only multiply a 1 or 2 dimensional matrix (Matrix B has "+S.length+" dimensions)")}break;default:throw new Error("Can only multiply a 1 or 2 dimensional matrix (Matrix A has "+w.length+" dimensions)")}}function c(w,S,k){if(k===0)throw new Error("Cannot multiply two empty vectors");return o(w,S)}function f(w,S){if(S.storage()!=="dense")throw new Error("Support for SparseMatrix not implemented");return d(w,S)}function d(w,S){var k=w._data,j=w._size,O=w._datatype||w.getDataType(),C=S._data,N=S._size,D=S._datatype||S.getDataType(),P=j[0],q=N[1],z,I=n,T=i;O&&D&&O===D&&typeof O=="string"&&O!=="mixed"&&(z=O,I=t.find(n,[z,z]),T=t.find(i,[z,z]));for(var L=[],_=0;_Oe)for(var ye=0,me=0;me(S,k)=>{u(Yt(S),Yt(k));var j=w(r(S),r(k));return St(j)?j.valueOf():j}),"Matrix, Matrix":function(S,k){var j=S.size(),O=k.size();return u(j,O),j.length===1?O.length===1?c(S,k,j[0]):f(S,k):O.length===1?p(S,k):h(S,k)},"Matrix, Array":t.referTo("Matrix,Matrix",w=>(S,k)=>w(S,r(k))),"Array, Matrix":t.referToSelf(w=>(S,k)=>w(r(S,k.storage()),k)),"SparseMatrix, any":function(S,k){return s(S,k,i,!1)},"DenseMatrix, any":function(S,k){return l(S,k,i,!1)},"any, SparseMatrix":function(S,k){return s(k,S,i,!0)},"any, DenseMatrix":function(S,k){return l(k,S,i,!0)},"Array, any":function(S,k){return l(r(S),k,i,!1).valueOf()},"any, Array":function(S,k){return l(r(k),S,i,!0).valueOf()},"any, any":i,"any, any, ...any":t.referToSelf(w=>(S,k,j)=>{for(var O=w(S,k),C=0;C{var{typed:t,matrix:r,equalScalar:n,BigNumber:i,concat:a}=e,o=ou({typed:t}),s=yo({typed:t,equalScalar:n}),l=Y0({typed:t,equalScalar:n}),u=Gn({typed:t,equalScalar:n}),c=fr({typed:t,matrix:r,concat:a});function f(){throw new Error("Complex number not supported in function nthRoot. Use nthRoots instead.")}return t(Ile,{number:_W,"number, number":_W,BigNumber:p=>d(p,new i(2)),"BigNumber, BigNumber":d,Complex:f,"Complex, number":f,Array:t.referTo("DenseMatrix,number",p=>h=>p(r(h),2).valueOf()),DenseMatrix:t.referTo("DenseMatrix,number",p=>h=>p(h,2)),SparseMatrix:t.referTo("SparseMatrix,number",p=>h=>p(h,2)),"SparseMatrix, SparseMatrix":t.referToSelf(p=>(h,m)=>{if(m.density()===1)return l(h,m,p);throw new Error("Root must be non-zero")}),"DenseMatrix, SparseMatrix":t.referToSelf(p=>(h,m)=>{if(m.density()===1)return o(h,m,p,!1);throw new Error("Root must be non-zero")}),"Array, SparseMatrix":t.referTo("DenseMatrix,SparseMatrix",p=>(h,m)=>p(r(h),m)),"number | BigNumber, SparseMatrix":t.referToSelf(p=>(h,m)=>{if(m.density()===1)return u(m,h,p,!0);throw new Error("Root must be non-zero")})},c({scalar:"number | BigNumber",SD:s,Ss:u,sS:!1}));function d(p,h){var m=i.precision,g=i.clone({precision:m+2}),A=new i(0),b=new g(1),v=h.isNegative();if(v&&(h=h.neg()),h.isZero())throw new Error("Root must be non-zero");if(p.isNegative()&&!h.abs().mod(2).equals(1))throw new Error("Root must be odd when a is negative.");if(p.isZero())return v?new g(1/0):0;if(!p.isFinite())return v?A:p;var x=p.abs().pow(b.div(h));return x=p.isNeg()?x.neg():x,new i((v?b.div(x):x).toPrecision(m))}});var Ble="sign",F$e=["typed","BigNumber","Fraction","complex"],EF=V(Ble,F$e,e=>{var{typed:t,BigNumber:r,complex:n,Fraction:i}=e;return t(Ble,{number:BT,Complex:function(o){return o.im===0?n(BT(o.re)):o.sign()},BigNumber:function(o){return new r(o.cmp(0))},Fraction:function(o){return new i(o.s,1)},"Array | Matrix":t.referToSelf(a=>o=>jt(o,a,!0)),Unit:t.referToSelf(a=>o=>{if(!o._isDerived()&&o.units[0].unit.offset!==0)throw new TypeError("sign is ambiguous for units with offset");return t.find(a,o.valueType())(o.value)})})});var _$e="sqrt",P$e=["config","typed","Complex"],kF=V(_$e,P$e,e=>{var{config:t,typed:r,Complex:n}=e;return r("sqrt",{number:i,Complex:function(o){return o.sqrt()},BigNumber:function(o){return!o.isNegative()||t.predictable?o.sqrt():i(o.toNumber())},Unit:function(o){return o.pow(.5)}});function i(a){return isNaN(a)?NaN:a>=0||t.predictable?Math.sqrt(a):new n(a,0).sqrt()}});var Rle="square",I$e=["typed"],CF=V(Rle,I$e,e=>{var{typed:t}=e;return t(Rle,{number:PW,Complex:function(n){return n.mul(n)},BigNumber:function(n){return n.times(n)},Fraction:function(n){return n.mul(n)},Unit:function(n){return n.pow(2)}})});var $le="subtract",B$e=["typed","matrix","equalScalar","subtractScalar","unaryMinus","DenseMatrix","concat"],DF=V($le,B$e,e=>{var{typed:t,matrix:r,equalScalar:n,subtractScalar:i,unaryMinus:a,DenseMatrix:o,concat:s}=e,l=ou({typed:t}),u=xi({typed:t}),c=Q0({typed:t,equalScalar:n}),f=Dc({typed:t,DenseMatrix:o}),d=An({typed:t,DenseMatrix:o}),p=fr({typed:t,matrix:r,concat:s});return t($le,{"any, any":i},p({elop:i,SS:c,DS:l,SD:u,Ss:d,sS:f}))});var qle="xgcd",R$e=["typed","config","matrix","BigNumber"],OF=V(qle,R$e,e=>{var{typed:t,config:r,matrix:n,BigNumber:i}=e;return t(qle,{"number, number":function(s,l){var u=IW(s,l);return r.matrix==="Array"?u:n(u)},"BigNumber, BigNumber":a});function a(o,s){var l,u,c,f=new i(0),d=new i(1),p=f,h=d,m=d,g=f;if(!o.isInt()||!s.isInt())throw new Error("Parameters in function xgcd must be integer numbers");for(;!s.isZero();)u=o.div(s).floor(),c=o.mod(s),l=p,p=h.minus(u.times(p)),h=l,l=m,m=g.minus(u.times(m)),g=l,o=s,s=c;var A;return o.lt(f)?A=[o.neg(),h.neg(),g.neg()]:A=[o,o.isZero()?0:h,g],r.matrix==="Array"?A:n(A)}});var Lle="invmod",$$e=["typed","config","BigNumber","xgcd","equal","smaller","mod","add","isInteger"],MF=V(Lle,$$e,e=>{var{typed:t,config:r,BigNumber:n,xgcd:i,equal:a,smaller:o,mod:s,add:l,isInteger:u}=e;return t(Lle,{"number, number":c,"BigNumber, BigNumber":c});function c(f,d){if(!u(f)||!u(d))throw new Error("Parameters in function invmod must be integer numbers");if(f=s(f,d),a(d,0))throw new Error("Divisor must be non zero");var p=i(f,d);p=p.valueOf();var[h,m]=p;return a(h,n(1))?(m=s(m,d),o(m,n(0))&&(m=l(m,d)),m):NaN}});var q$e="matAlgo09xS0Sf",L$e=["typed","equalScalar"],jF=V(q$e,L$e,e=>{var{typed:t,equalScalar:r}=e;return function(i,a,o){var s=i._values,l=i._index,u=i._ptr,c=i._size,f=i._datatype||i._data===void 0?i._datatype:i.getDataType(),d=a._values,p=a._index,h=a._ptr,m=a._size,g=a._datatype||a._data===void 0?a._datatype:a.getDataType();if(c.length!==m.length)throw new nr(c.length,m.length);if(c[0]!==m[0]||c[1]!==m[1])throw new RangeError("Dimension mismatch. Matrix A ("+c+") must match Matrix B ("+m+")");var A=c[0],b=c[1],v,x=r,w=0,S=o;typeof f=="string"&&f===g&&f!=="mixed"&&(v=f,x=t.find(r,[v,v]),w=t.convert(0,v),S=t.find(o,[v,v]));var k=s&&d?[]:void 0,j=[],O=[],C=k?[]:void 0,N=[],D,P,q,z,I;for(P=0;P{var{typed:t,matrix:r,equalScalar:n,multiplyScalar:i,concat:a}=e,o=yo({typed:t,equalScalar:n}),s=jF({typed:t,equalScalar:n}),l=Gn({typed:t,equalScalar:n}),u=fr({typed:t,matrix:r,concat:a});return t(zle,u({elop:i,SS:s,DS:o,Ss:l}))});function Ule(e,t){if(e.isFinite()&&!e.isInteger()||t.isFinite()&&!t.isInteger())throw new Error("Integers expected in function bitAnd");var r=e.constructor;if(e.isNaN()||t.isNaN())return new r(NaN);if(e.isZero()||t.eq(-1)||e.eq(t))return e;if(t.isZero()||e.eq(-1))return t;if(!e.isFinite()||!t.isFinite()){if(!e.isFinite()&&!t.isFinite())return e.isNegative()===t.isNegative()?e:new r(0);if(!e.isFinite())return t.isNegative()?e:e.isNegative()?new r(0):t;if(!t.isFinite())return e.isNegative()?t:t.isNegative()?new r(0):e}return SH(e,t,function(n,i){return n&i})}function oS(e){if(e.isFinite()&&!e.isInteger())throw new Error("Integer expected in function bitNot");var t=e.constructor,r=t.precision;t.config({precision:1e9});var n=e.plus(new t(1));return n.s=-n.s||null,t.config({precision:r}),n}function Wle(e,t){if(e.isFinite()&&!e.isInteger()||t.isFinite()&&!t.isInteger())throw new Error("Integers expected in function bitOr");var r=e.constructor;if(e.isNaN()||t.isNaN())return new r(NaN);var n=new r(-1);return e.isZero()||t.eq(n)||e.eq(t)?t:t.isZero()||e.eq(n)?e:!e.isFinite()||!t.isFinite()?!e.isFinite()&&!e.isNegative()&&t.isNegative()||e.isNegative()&&!t.isNegative()&&!t.isFinite()?n:e.isNegative()&&t.isNegative()?e.isFinite()?e:t:e.isFinite()?t:e:SH(e,t,function(i,a){return i|a})}function SH(e,t,r){var n=e.constructor,i,a,o=+(e.s<0),s=+(t.s<0);if(o){i=TF(oS(e));for(var l=0;l0;)r(c[--p],f[--h])===m&&(g=g.plus(A)),A=A.times(b);for(;h>0;)r(d,f[--h])===m&&(g=g.plus(A)),A=A.times(b);return n.config({precision:v}),m===0&&(g.s=-g.s),g}function TF(e){for(var t=e.d,r=t[0]+"",n=1;n0)if(++s>u)for(s-=u;s--;)l+="0";else s1&&((c[p+1]===null||c[p+1]===void 0)&&(c[p+1]=0),c[p+1]+=c[p]>>1,c[p]&=1)}return c.reverse()}function Hle(e,t){if(e.isFinite()&&!e.isInteger()||t.isFinite()&&!t.isInteger())throw new Error("Integers expected in function bitXor");var r=e.constructor;if(e.isNaN()||t.isNaN())return new r(NaN);if(e.isZero())return t;if(t.isZero())return e;if(e.eq(t))return new r(0);var n=new r(-1);return e.eq(n)?oS(t):t.eq(n)?oS(e):!e.isFinite()||!t.isFinite()?!e.isFinite()&&!t.isFinite()?n:new r(e.isNegative()===t.isNegative()?1/0:-1/0):SH(e,t,function(i,a){return i^a})}function Vle(e,t){if(e.isFinite()&&!e.isInteger()||t.isFinite()&&!t.isInteger())throw new Error("Integers expected in function leftShift");var r=e.constructor;return e.isNaN()||t.isNaN()||t.isNegative()&&!t.isZero()?new r(NaN):e.isZero()||t.isZero()?e:!e.isFinite()&&!t.isFinite()?new r(NaN):t.lt(55)?e.times(Math.pow(2,t.toNumber())+""):e.times(new r(2).pow(t))}function Gle(e,t){if(e.isFinite()&&!e.isInteger()||t.isFinite()&&!t.isInteger())throw new Error("Integers expected in function rightArithShift");var r=e.constructor;return e.isNaN()||t.isNaN()||t.isNegative()&&!t.isZero()?new r(NaN):e.isZero()||t.isZero()?e:t.isFinite()?t.lt(55)?e.div(Math.pow(2,t.toNumber())+"").floor():e.div(new r(2).pow(t)).floor():e.isNegative()?new r(-1):e.isFinite()?new r(0):new r(NaN)}var Qle="bitAnd",U$e=["typed","matrix","equalScalar","concat"],sS=V(Qle,U$e,e=>{var{typed:t,matrix:r,equalScalar:n,concat:i}=e,a=yo({typed:t,equalScalar:n}),o=Y0({typed:t,equalScalar:n}),s=Gn({typed:t,equalScalar:n}),l=fr({typed:t,matrix:r,concat:i});return t(Qle,{"number, number":RW,"BigNumber, BigNumber":Ule},l({SS:o,DS:a,Ss:s}))});var Yle="bitNot",W$e=["typed"],FF=V(Yle,W$e,e=>{var{typed:t}=e;return t(Yle,{number:$W,BigNumber:oS,"Array | Matrix":t.referToSelf(r=>n=>jt(n,r))})});var Zle="bitOr",H$e=["typed","matrix","equalScalar","DenseMatrix","concat"],lS=V(Zle,H$e,e=>{var{typed:t,matrix:r,equalScalar:n,DenseMatrix:i,concat:a}=e,o=ou({typed:t}),s=aS({typed:t,equalScalar:n}),l=Dc({typed:t,DenseMatrix:i}),u=fr({typed:t,matrix:r,concat:a});return t(Zle,{"number, number":qW,"BigNumber, BigNumber":Wle},u({SS:s,DS:o,Ss:l}))});var V$e="matAlgo07xSSf",G$e=["typed","DenseMatrix"],Qo=V(V$e,G$e,e=>{var{typed:t,DenseMatrix:r}=e;return function(a,o,s){var l=a._size,u=a._datatype||a._data===void 0?a._datatype:a.getDataType(),c=o._size,f=o._datatype||o._data===void 0?o._datatype:o.getDataType();if(l.length!==c.length)throw new nr(l.length,c.length);if(l[0]!==c[0]||l[1]!==c[1])throw new RangeError("Dimension mismatch. Matrix A ("+l+") must match Matrix B ("+c+")");var d=l[0],p=l[1],h,m=0,g=s;typeof u=="string"&&u===f&&u!=="mixed"&&(h=u,m=t.convert(0,h),g=t.find(s,[h,h]));var A,b,v=[];for(A=0;A{var{typed:t,matrix:r,DenseMatrix:n,concat:i}=e,a=xi({typed:t}),o=Qo({typed:t,DenseMatrix:n}),s=An({typed:t,DenseMatrix:n}),l=fr({typed:t,matrix:r,concat:i});return t(Xle,{"number, number":LW,"BigNumber, BigNumber":Hle},l({SS:o,DS:a,Ss:s}))});var Kle="arg",Y$e=["typed"],PF=V(Kle,Y$e,e=>{var{typed:t}=e;return t(Kle,{number:function(n){return Math.atan2(0,n)},BigNumber:function(n){return n.constructor.atan2(0,n)},Complex:function(n){return n.arg()},"Array | Matrix":t.referToSelf(r=>n=>jt(n,r))})});var Jle="conj",Z$e=["typed"],IF=V(Jle,Z$e,e=>{var{typed:t}=e;return t(Jle,{"number | BigNumber | Fraction":r=>r,Complex:r=>r.conjugate(),"Array | Matrix":t.referToSelf(r=>n=>jt(n,r))})});var eue="im",X$e=["typed"],BF=V(eue,X$e,e=>{var{typed:t}=e;return t(eue,{number:()=>0,"BigNumber | Fraction":r=>r.mul(0),Complex:r=>r.im,"Array | Matrix":t.referToSelf(r=>n=>jt(n,r))})});var tue="re",K$e=["typed"],RF=V(tue,K$e,e=>{var{typed:t}=e;return t(tue,{"number | BigNumber | Fraction":r=>r,Complex:r=>r.re,"Array | Matrix":t.referToSelf(r=>n=>jt(n,r))})});var rue="not",J$e=["typed"],$F=V(rue,J$e,e=>{var{typed:t}=e;return t(rue,{"null | undefined":()=>!0,number:GW,Complex:function(n){return n.re===0&&n.im===0},BigNumber:function(n){return n.isZero()||n.isNaN()},Unit:t.referToSelf(r=>n=>t.find(r,n.valueType())(n.value)),"Array | Matrix":t.referToSelf(r=>n=>jt(n,r))})});var nue="or",eqe=["typed","matrix","equalScalar","DenseMatrix","concat"],uS=V(nue,eqe,e=>{var{typed:t,matrix:r,equalScalar:n,DenseMatrix:i,concat:a}=e,o=xi({typed:t}),s=Q0({typed:t,equalScalar:n}),l=An({typed:t,DenseMatrix:i}),u=fr({typed:t,matrix:r,concat:a});return t(nue,{"number, number":QW,"Complex, Complex":function(f,d){return f.re!==0||f.im!==0||d.re!==0||d.im!==0},"BigNumber, BigNumber":function(f,d){return!f.isZero()&&!f.isNaN()||!d.isZero()&&!d.isNaN()},"Unit, Unit":t.referToSelf(c=>(f,d)=>c(f.value||0,d.value||0))},u({SS:s,DS:o,Ss:l}))});var iue="xor",tqe=["typed","matrix","DenseMatrix","concat"],qF=V(iue,tqe,e=>{var{typed:t,matrix:r,DenseMatrix:n,concat:i}=e,a=xi({typed:t}),o=Qo({typed:t,DenseMatrix:n}),s=An({typed:t,DenseMatrix:n}),l=fr({typed:t,matrix:r,concat:i});return t(iue,{"number, number":YW,"Complex, Complex":function(c,f){return(c.re!==0||c.im!==0)!=(f.re!==0||f.im!==0)},"BigNumber, BigNumber":function(c,f){return(!c.isZero()&&!c.isNaN())!=(!f.isZero()&&!f.isNaN())},"Unit, Unit":t.referToSelf(u=>(c,f)=>u(c.value||0,f.value||0))},l({SS:o,DS:a,Ss:s}))});var aue="concat",rqe=["typed","matrix","isInteger"],cS=V(aue,rqe,e=>{var{typed:t,matrix:r,isInteger:n}=e;return t(aue,{"...Array | Matrix | number | BigNumber":function(a){var o,s=a.length,l=-1,u,c=!1,f=[];for(o=0;o0&&l>u)throw new As(l,u+1)}else{var p=Bt(d).valueOf(),h=Yt(p);if(f[o]=p,u=l,l=h.length-1,o>0&&l!==u)throw new nr(u+1,l+1)}}if(f.length===0)throw new SyntaxError("At least one matrix expected");for(var m=f.shift();f.length;)m=oW(m,f.shift(),l);return c?r(m):m},"...string":function(a){return a.join("")}})});var oue="column",nqe=["typed","Index","matrix","range"],fS=V(oue,nqe,e=>{var{typed:t,Index:r,matrix:n,range:i}=e;return t(oue,{"Matrix, number":a,"Array, number":function(s,l){return a(n(Bt(s)),l).valueOf()}});function a(o,s){if(o.size().length!==2)throw new Error("Only two dimensional matrix is supported");Vn(s,o.size()[1]);var l=i(0,o.size()[0]),u=new r(l,s),c=o.subset(u);return St(c)?c:n([[c]])}});var sue="count",iqe=["typed","size","prod"],LF=V(sue,iqe,e=>{var{typed:t,size:r,prod:n}=e;return t(sue,{string:function(a){return a.length},"Matrix | Array":function(a){return n(r(a))}})});var lue="cross",aqe=["typed","matrix","subtract","multiply"],zF=V(lue,aqe,e=>{var{typed:t,matrix:r,subtract:n,multiply:i}=e;return t(lue,{"Matrix, Matrix":function(s,l){return r(a(s.toArray(),l.toArray()))},"Matrix, Array":function(s,l){return r(a(s.toArray(),l))},"Array, Matrix":function(s,l){return r(a(s,l.toArray()))},"Array, Array":a});function a(o,s){var l=Math.max(Yt(o).length,Yt(s).length);o=Qw(o),s=Qw(s);var u=Yt(o),c=Yt(s);if(u.length!==1||c.length!==1||u[0]!==3||c[0]!==3)throw new RangeError("Vectors with length 3 expected (Size A = ["+u.join(", ")+"], B = ["+c.join(", ")+"])");var f=[n(i(o[1],s[2]),i(o[2],s[1])),n(i(o[2],s[0]),i(o[0],s[2])),n(i(o[0],s[1]),i(o[1],s[0]))];return l>1?[f]:f}});var uue="diag",oqe=["typed","matrix","DenseMatrix","SparseMatrix"],UF=V(uue,oqe,e=>{var{typed:t,matrix:r,DenseMatrix:n,SparseMatrix:i}=e;return t(uue,{Array:function(u){return a(u,0,Yt(u),null)},"Array, number":function(u,c){return a(u,c,Yt(u),null)},"Array, BigNumber":function(u,c){return a(u,c.toNumber(),Yt(u),null)},"Array, string":function(u,c){return a(u,0,Yt(u),c)},"Array, number, string":function(u,c,f){return a(u,c,Yt(u),f)},"Array, BigNumber, string":function(u,c,f){return a(u,c.toNumber(),Yt(u),f)},Matrix:function(u){return a(u,0,u.size(),u.storage())},"Matrix, number":function(u,c){return a(u,c,u.size(),u.storage())},"Matrix, BigNumber":function(u,c){return a(u,c.toNumber(),u.size(),u.storage())},"Matrix, string":function(u,c){return a(u,0,u.size(),c)},"Matrix, number, string":function(u,c,f){return a(u,c,u.size(),f)},"Matrix, BigNumber, string":function(u,c,f){return a(u,c.toNumber(),u.size(),f)}});function a(l,u,c,f){if(!wt(u))throw new TypeError("Second parameter in function diag must be an integer");var d=u>0?u:0,p=u<0?-u:0;switch(c.length){case 1:return o(l,u,f,c[0],p,d);case 2:return s(l,u,f,c,p,d)}throw new RangeError("Matrix for function diag must be 2 dimensional")}function o(l,u,c,f,d,p){var h=[f+d,f+p];if(c&&c!=="sparse"&&c!=="dense")throw new TypeError("Unknown matrix type ".concat(c,'"'));var m=c==="sparse"?i.diagonal(h,l,u):n.diagonal(h,l,u);return c!==null?m:m.valueOf()}function s(l,u,c,f,d,p){if(St(l)){var h=l.diagonal(u);return c!==null?c!==h.storage()?r(h,c):h:h.valueOf()}for(var m=Math.min(f[0]-d,f[1]-p),g=[],A=0;A=2&&m.push("index: ".concat(qr(r))),p.length>=3&&m.push("array: ".concat(qr(n))),new TypeError("Function ".concat(i," cannot apply callback arguments ")+"".concat(e.name,"(").concat(m.join(", "),") at index ").concat(JSON.stringify(r)))}else throw new TypeError("Function ".concat(i," cannot apply callback arguments ")+"to function ".concat(e.name,": ").concat(g.message))}}}var sqe="filter",lqe=["typed"],WF=V(sqe,lqe,e=>{var{typed:t}=e;return t("filter",{"Array, function":cue,"Matrix, function":function(n,i){return n.create(cue(n.toArray(),i))},"Array, RegExp":Yw,"Matrix, RegExp":function(n,i){return n.create(Yw(n.toArray(),i))}})});function cue(e,t){return mT(e,function(r,n,i){return Od(t,r,[n],i,"filter")})}var fue="flatten",uqe=["typed","matrix"],HF=V(fue,uqe,e=>{var{typed:t,matrix:r}=e;return t(fue,{Array:function(i){return mr(i)},Matrix:function(i){var a=mr(i.toArray());return r(a)}})});var due="forEach",cqe=["typed"],VF=V(due,cqe,e=>{var{typed:t}=e;return t(due,{"Array, function":fqe,"Matrix, function":function(n,i){n.forEach(i)}})});function fqe(e,t){var r=function n(i,a){if(Array.isArray(i))$0(i,function(o,s){n(o,a.concat(s))});else return Od(t,i,a,e,"forEach")};r(e,[])}var pue="getMatrixDataType",dqe=["typed"],GF=V(pue,dqe,e=>{var{typed:t}=e;return t(pue,{Array:function(n){return q0(n,qr)},Matrix:function(n){return n.getDataType()}})});var mue="identity",pqe=["typed","config","matrix","BigNumber","DenseMatrix","SparseMatrix"],QF=V(mue,pqe,e=>{var{typed:t,config:r,matrix:n,BigNumber:i,DenseMatrix:a,SparseMatrix:o}=e;return t(mue,{"":function(){return r.matrix==="Matrix"?n([]):[]},string:function(c){return n(c)},"number | BigNumber":function(c){return l(c,c,r.matrix==="Matrix"?"dense":void 0)},"number | BigNumber, string":function(c,f){return l(c,c,f)},"number | BigNumber, number | BigNumber":function(c,f){return l(c,f,r.matrix==="Matrix"?"dense":void 0)},"number | BigNumber, number | BigNumber, string":function(c,f,d){return l(c,f,d)},Array:function(c){return s(c)},"Array, string":function(c,f){return s(c,f)},Matrix:function(c){return s(c.valueOf(),c.storage())},"Matrix, string":function(c,f){return s(c.valueOf(),f)}});function s(u,c){switch(u.length){case 0:return c?n(c):[];case 1:return l(u[0],u[0],c);case 2:return l(u[0],u[1],c);default:throw new Error("Vector containing two values expected")}}function l(u,c,f){var d=It(u)||It(c)?i:null;if(It(u)&&(u=u.toNumber()),It(c)&&(c=c.toNumber()),!wt(u)||u<1)throw new Error("Parameters in function identity must be positive integers");if(!wt(c)||c<1)throw new Error("Parameters in function identity must be positive integers");var p=d?new i(1):1,h=d?new d(0):0,m=[u,c];if(f){if(f==="sparse")return o.diagonal(m,p,0,h);if(f==="dense")return a.diagonal(m,p,0,h);throw new TypeError('Unknown matrix type "'.concat(f,'"'))}for(var g=Rp([],m,h),A=u{var{typed:t,matrix:r,multiplyScalar:n}=e;return t(hue,{"Matrix, Matrix":function(o,s){return r(i(o.toArray(),s.toArray()))},"Matrix, Array":function(o,s){return r(i(o.toArray(),s))},"Array, Matrix":function(o,s){return r(i(o,s.toArray()))},"Array, Array":i});function i(a,o){if(Yt(a).length===1&&(a=[a]),Yt(o).length===1&&(o=[o]),Yt(a).length>2||Yt(o).length>2)throw new RangeError("Vectors with dimensions greater then 2 are not supported expected (Size x = "+JSON.stringify(a.length)+", y = "+JSON.stringify(o.length)+")");var s=[],l=[];return a.map(function(u){return o.map(function(c){return l=[],s.push(l),u.map(function(f){return c.map(function(d){return l.push(n(f,d))})})})})&&s}});var Aue="map",hqe=["typed"],ZF=V(Aue,hqe,e=>{var{typed:t}=e;return t(Aue,{"Array, function":Aqe,"Matrix, function":function(n,i){return n.map(i)}})});function Aqe(e,t){var r=function n(i,a){return Array.isArray(i)?i.map(function(o,s){return n(o,a.concat(s))}):Od(t,i,a,e,"map")};return r(e,[])}var gue="diff",gqe=["typed","matrix","subtract","number"],dS=V(gue,gqe,e=>{var{typed:t,matrix:r,subtract:n,number:i}=e;return t(gue,{"Array | Matrix":function(c){return St(c)?r(o(c.toArray())):o(c)},"Array | Matrix, number":function(c,f){if(!wt(f))throw new RangeError("Dimension must be a whole number");return St(c)?r(a(c.toArray(),f)):a(c,f)},"Array, BigNumber":t.referTo("Array,number",u=>(c,f)=>u(c,i(f))),"Matrix, BigNumber":t.referTo("Matrix,number",u=>(c,f)=>u(c,i(f)))});function a(u,c){if(St(u)&&(u=u.toArray()),!Array.isArray(u))throw RangeError("Array/Matrix does not have that many dimensions");if(c>0){var f=[];return u.forEach(d=>{f.push(a(d,c-1))}),f}else{if(c===0)return o(u);throw RangeError("Cannot have negative dimension")}}function o(u){for(var c=[],f=u.length,d=1;d{var{typed:t,config:r,matrix:n,BigNumber:i}=e;return t("ones",{"":function(){return r.matrix==="Array"?a([]):a([],"default")},"...number | BigNumber | string":function(u){var c=u[u.length-1];if(typeof c=="string"){var f=u.pop();return a(u,f)}else return r.matrix==="Array"?a(u):a(u,"default")},Array:a,Matrix:function(u){var c=u.storage();return a(u.valueOf(),c)},"Array | Matrix, string":function(u,c){return a(u.valueOf(),c)}});function a(l,u){var c=o(l),f=c?new i(1):1;if(s(l),u){var d=n(u);return l.length>0?d.resize(l,f):d}else{var p=[];return l.length>0?Rp(p,l,f):p}}function o(l){var u=!1;return l.forEach(function(c,f,d){It(c)&&(u=!0,d[f]=c.toNumber())}),u}function s(l){l.forEach(function(u){if(typeof u!="number"||!wt(u)||u<0)throw new Error("Parameters in function ones must be positive integers")})}});function pS(){throw new Error('No "bignumber" implementation available')}function KF(){throw new Error('No "fraction" implementation available')}function JF(){throw new Error('No "matrix" implementation available')}var vue="range",bqe=["typed","config","?matrix","?bignumber","smaller","smallerEq","larger","largerEq","add","isPositive"],mS=V(vue,bqe,e=>{var{typed:t,config:r,matrix:n,bignumber:i,smaller:a,smallerEq:o,larger:s,largerEq:l,add:u,isPositive:c}=e;return t(vue,{string:d,"string, boolean":d,"number, number":function(g,A){return f(p(g,A,1,!1))},"number, number, number":function(g,A,b){return f(p(g,A,b,!1))},"number, number, boolean":function(g,A,b){return f(p(g,A,1,b))},"number, number, number, boolean":function(g,A,b,v){return f(p(g,A,b,v))},"BigNumber, BigNumber":function(g,A){var b=g.constructor;return f(p(g,A,new b(1),!1))},"BigNumber, BigNumber, BigNumber":function(g,A,b){return f(p(g,A,b,!1))},"BigNumber, BigNumber, boolean":function(g,A,b){var v=g.constructor;return f(p(g,A,new v(1),b))},"BigNumber, BigNumber, BigNumber, boolean":function(g,A,b,v){return f(p(g,A,b,v))},"Unit, Unit, Unit":function(g,A,b){return f(p(g,A,b,!1))},"Unit, Unit, Unit, boolean":function(g,A,b,v){return f(p(g,A,b,v))}});function f(m){return r.matrix==="Matrix"?n?n(m):JF():m}function d(m,g){var A=h(m);if(!A)throw new SyntaxError('String "'+m+'" is no valid range');return r.number==="BigNumber"?(i===void 0&&pS(),f(p(i(A.start),i(A.end),i(A.step)),g)):f(p(A.start,A.end,A.step,g))}function p(m,g,A,b){for(var v=[],x=c(A)?b?o:a:b?l:s,w=m;x(w,g);)v.push(w),w=u(w,A);return v}function h(m){var g=m.split(":"),A=g.map(function(v){return Number(v)}),b=A.some(function(v){return isNaN(v)});if(b)return null;switch(A.length){case 2:return{start:A[0],end:A[1],step:1};case 3:return{start:A[0],end:A[2],step:A[1]};default:return null}}});var yue="reshape",xqe=["typed","isInteger","matrix"],e3=V(yue,xqe,e=>{var{typed:t,isInteger:r}=e;return t(yue,{"Matrix, Array":function(i,a){return i.reshape(a,!0)},"Array, Array":function(i,a){return a.forEach(function(o){if(!r(o))throw new TypeError("Invalid size for dimension: "+o)}),U6(i,a)}})});var wqe="resize",Sqe=["config","matrix"],t3=V(wqe,Sqe,e=>{var{config:t,matrix:r}=e;return function(a,o,s){if(arguments.length!==2&&arguments.length!==3)throw new bf("resize",arguments.length,2,3);if(St(o)&&(o=o.valueOf()),It(o[0])&&(o=o.map(function(c){return It(c)?c.toNumber():c})),St(a))return a.resize(o,s,!0);if(typeof a=="string")return n(a,o,s);var l=Array.isArray(a)?!1:t.matrix!=="Array";if(o.length===0){for(;Array.isArray(a);)a=a[0];return Bt(a)}else{Array.isArray(a)||(a=[a]),a=Bt(a);var u=Rp(a,o,s);return l?r(u):u}};function n(i,a,o){if(o!==void 0){if(typeof o!="string"||o.length!==1)throw new TypeError("Single character expected as defaultValue")}else o=" ";if(a.length!==1)throw new nr(a.length,1);var s=a[0];if(typeof s!="number"||!wt(s))throw new TypeError("Invalid size, must contain positive integers (size: "+tr(a)+")");if(i.length>s)return i.substring(0,s);if(i.length{var{typed:t,multiply:r,rotationMatrix:n}=e;return t(bue,{"Array , number | BigNumber | Complex | Unit":function(o,s){i(o,2);var l=r(n(s),o);return l.toArray()},"Matrix , number | BigNumber | Complex | Unit":function(o,s){return i(o,2),r(n(s),o)},"Array, number | BigNumber | Complex | Unit, Array | Matrix":function(o,s,l){i(o,3);var u=r(n(s,l),o);return u},"Matrix, number | BigNumber | Complex | Unit, Array | Matrix":function(o,s,l){return i(o,3),r(n(s,l),o)}});function i(a,o){var s=Array.isArray(a)?Yt(a):a.size();if(s.length>2)throw new RangeError("Vector must be of dimensions 1x".concat(o));if(s.length===2&&s[1]!==1)throw new RangeError("Vector must be of dimensions 1x".concat(o));if(s[0]!==o)throw new RangeError("Vector must be of dimensions 1x".concat(o))}});var xue="rotationMatrix",kqe=["typed","config","multiplyScalar","addScalar","unaryMinus","norm","matrix","BigNumber","DenseMatrix","SparseMatrix","cos","sin"],n3=V(xue,kqe,e=>{var{typed:t,config:r,multiplyScalar:n,addScalar:i,unaryMinus:a,norm:o,BigNumber:s,matrix:l,DenseMatrix:u,SparseMatrix:c,cos:f,sin:d}=e;return t(xue,{"":function(){return r.matrix==="Matrix"?l([]):[]},string:function(v){return l(v)},"number | BigNumber | Complex | Unit":function(v){return p(v,r.matrix==="Matrix"?"dense":void 0)},"number | BigNumber | Complex | Unit, string":function(v,x){return p(v,x)},"number | BigNumber | Complex | Unit, Array":function(v,x){var w=l(x);return h(w),A(v,w,void 0)},"number | BigNumber | Complex | Unit, Matrix":function(v,x){h(x);var w=x.storage()||(r.matrix==="Matrix"?"dense":void 0);return A(v,x,w)},"number | BigNumber | Complex | Unit, Array, string":function(v,x,w){var S=l(x);return h(S),A(v,S,w)},"number | BigNumber | Complex | Unit, Matrix, string":function(v,x,w){return h(x),A(v,x,w)}});function p(b,v){var x=It(b),w=x?new s(-1):-1,S=f(b),k=d(b),j=[[S,n(w,k)],[k,S]];return g(j,v)}function h(b){var v=b.size();if(v.length<1||v[0]!==3)throw new RangeError("Vector must be of dimensions 1x3")}function m(b){return b.reduce((v,x)=>n(v,x))}function g(b,v){if(v){if(v==="sparse")return new c(b);if(v==="dense")return new u(b);throw new TypeError('Unknown matrix type "'.concat(v,'"'))}return b}function A(b,v,x){var w=o(v);if(w===0)throw new RangeError("Rotation around zero vector");var S=It(b)?s:null,k=S?new S(1):1,j=S?new S(-1):-1,O=S?new S(v.get([0])/w):v.get([0])/w,C=S?new S(v.get([1])/w):v.get([1])/w,N=S?new S(v.get([2])/w):v.get([2])/w,D=f(b),P=i(k,a(D)),q=d(b),z=i(D,m([O,O,P])),I=i(m([O,C,P]),m([j,N,q])),T=i(m([O,N,P]),m([C,q])),L=i(m([O,C,P]),m([N,q])),_=i(D,m([C,C,P])),Y=i(m([C,N,P]),m([j,O,q])),oe=i(m([O,N,P]),m([j,C,q])),te=i(m([C,N,P]),m([O,q])),Q=i(D,m([N,N,P])),fe=[[z,I,T],[L,_,Y],[oe,te,Q]];return g(fe,x)}});var wue="row",Cqe=["typed","Index","matrix","range"],hS=V(wue,Cqe,e=>{var{typed:t,Index:r,matrix:n,range:i}=e;return t(wue,{"Matrix, number":a,"Array, number":function(s,l){return a(n(Bt(s)),l).valueOf()}});function a(o,s){if(o.size().length!==2)throw new Error("Only two dimensional matrix is supported");Vn(s,o.size()[0]);var l=i(0,o.size()[1]),u=new r(s,l),c=o.subset(u);return St(c)?c:n([[c]])}});var Sue="size",Dqe=["typed","config","?matrix"],i3=V(Sue,Dqe,e=>{var{typed:t,config:r,matrix:n}=e;return t(Sue,{Matrix:function(a){return a.create(a.size())},Array:Yt,string:function(a){return r.matrix==="Array"?[a.length]:n([a.length])},"number | Complex | BigNumber | Unit | boolean | null":function(a){return r.matrix==="Array"?[]:n?n([]):JF()}})});var Eue="squeeze",Oqe=["typed","matrix"],a3=V(Eue,Oqe,e=>{var{typed:t,matrix:r}=e;return t(Eue,{Array:function(i){return Qw(Bt(i))},Matrix:function(i){var a=Qw(i.toArray());return Array.isArray(a)?r(a):a},any:function(i){return Bt(i)}})});var kue="subset",Mqe=["typed","matrix","zeros","add"],AS=V(kue,Mqe,e=>{var{typed:t,matrix:r,zeros:n,add:i}=e;return t(kue,{"Matrix, Index":function(s,l){return yy(l)?r():(z6(s,l),s.subset(l))},"Array, Index":t.referTo("Matrix, Index",function(o){return function(s,l){var u=o(r(s),l);return l.isScalar()?u:u.valueOf()}}),"Object, Index":Nqe,"string, Index":jqe,"Matrix, Index, any, any":function(s,l,u,c){return yy(l)?s:(z6(s,l),s.clone().subset(l,a(u,l),c))},"Array, Index, any, any":t.referTo("Matrix, Index, any, any",function(o){return function(s,l,u,c){var f=o(r(s),l,u,c);return f.isMatrix?f.valueOf():f}}),"Array, Index, any":t.referTo("Matrix, Index, any, any",function(o){return function(s,l,u){return o(r(s),l,u,void 0).valueOf()}}),"Matrix, Index, any":t.referTo("Matrix, Index, any, any",function(o){return function(s,l,u){return o(s,l,u,void 0)}}),"string, Index, string":Cue,"string, Index, string, string":Cue,"Object, Index, any":Tqe});function a(o,s){if(typeof o=="string")throw new Error("can't boradcast a string");if(s._isScalar)return o;var l=s.size();if(l.every(u=>u>0))try{return i(o,n(l))}catch{return o}else return o}});function jqe(e,t){if(!Wm(t))throw new TypeError("Index expected");if(yy(t))return"";if(z6(Array.from(e),t),t.size().length!==1)throw new nr(t.size().length,1);var r=e.length;Vn(t.min()[0],r),Vn(t.max()[0],r);var n=t.dimension(0),i="";return n.forEach(function(a){i+=e.charAt(a)}),i}function Cue(e,t,r,n){if(!t||t.isIndex!==!0)throw new TypeError("Index expected");if(yy(t))return e;if(z6(Array.from(e),t),t.size().length!==1)throw new nr(t.size().length,1);if(n!==void 0){if(typeof n!="string"||n.length!==1)throw new TypeError("Single character expected as defaultValue")}else n=" ";var i=t.dimension(0),a=i.size()[0];if(a!==r.length)throw new nr(i.size()[0],r.length);var o=e.length;Vn(t.min()[0]),Vn(t.max()[0]);for(var s=[],l=0;lo)for(var u=o-1,c=s.length;u{var{typed:t,matrix:r}=e;return t(Due,{Array:o=>n(r(o)).valueOf(),Matrix:n,any:Bt});function n(o){var s=o.size(),l;switch(s.length){case 1:l=o.clone();break;case 2:{var u=s[0],c=s[1];if(c===0)throw new RangeError("Cannot transpose a 2D matrix with no columns (size: "+tr(s)+")");switch(o.storage()){case"dense":l=i(o,u,c);break;case"sparse":l=a(o,u,c);break}}break;default:throw new RangeError("Matrix must be a vector or two dimensional (size: "+tr(s)+")")}return l}function i(o,s,l){for(var u=o._data,c=[],f,d=0;d{var{typed:t,transpose:r,conj:n}=e;return t(Oue,{any:function(a){return n(r(a))}})});var Mue="zeros",Pqe=["typed","config","matrix","BigNumber"],l3=V(Mue,Pqe,e=>{var{typed:t,config:r,matrix:n,BigNumber:i}=e;return t(Mue,{"":function(){return r.matrix==="Array"?a([]):a([],"default")},"...number | BigNumber | string":function(u){var c=u[u.length-1];if(typeof c=="string"){var f=u.pop();return a(u,f)}else return r.matrix==="Array"?a(u):a(u,"default")},Array:a,Matrix:function(u){var c=u.storage();return a(u.valueOf(),c)},"Array | Matrix, string":function(u,c){return a(u.valueOf(),c)}});function a(l,u){var c=o(l),f=c?new i(0):0;if(s(l),u){var d=n(u);return l.length>0?d.resize(l,f):d}else{var p=[];return l.length>0?Rp(p,l,f):p}}function o(l){var u=!1;return l.forEach(function(c,f,d){It(c)&&(u=!0,d[f]=c.toNumber())}),u}function s(l){l.forEach(function(u){if(typeof u!="number"||!wt(u)||u<0)throw new Error("Parameters in function zeros must be positive integers")})}});var jue="fft",Iqe=["typed","matrix","addScalar","multiplyScalar","divideScalar","exp","tau","i","dotDivide","conj","pow","ceil","log2"],u3=V(jue,Iqe,e=>{var{typed:t,matrix:r,addScalar:n,multiplyScalar:i,divideScalar:a,exp:o,tau:s,i:l,dotDivide:u,conj:c,pow:f,ceil:d,log2:p}=e;return t(jue,{Array:h,Matrix:function(v){return v.create(h(v.toArray()))}});function h(b){var v=Yt(b);return v.length===1?A(b,v[0]):m(b.map(x=>h(x,v.slice(1))),0)}function m(b,v){var x=Yt(b);if(v!==0)return new Array(x[0]).fill(0).map((S,k)=>m(b[k],v-1));if(x.length===1)return A(b);function w(S){var k=Yt(S);return new Array(k[1]).fill(0).map((j,O)=>new Array(k[0]).fill(0).map((C,N)=>S[N][O]))}return w(m(w(b),1))}function g(b){for(var v=b.length,x=o(a(i(-1,i(l,s)),v)),w=[],S=1-v;Si(b[T],w[v-1+T])),...new Array(k-v).fill(0)],O=[...new Array(v+v-1).fill(0).map((I,T)=>a(1,w[T])),...new Array(k-(v+v-1)).fill(0)],C=A(j),N=A(O),D=new Array(k).fill(0).map((I,T)=>i(C[T],N[T])),P=u(c(h(c(D))),k),q=[],z=v-1;zO%2===0),v/2),...A(b.filter((j,O)=>O%2===1),v/2)],w=0;w{var{typed:t,fft:r,dotDivide:n,conj:i}=e;return t(Nue,{"Array | Matrix":function(o){var s=St(o)?o.size():Yt(o);return n(i(r(i(o))),s.reduce((l,u)=>l*u,1))}})});function Tue(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function Rqe(e){for(var t=1;t{var{typed:t,add:r,subtract:n,multiply:i,divide:a,max:o,map:s,abs:l,isPositive:u,isNegative:c,larger:f,smaller:d,matrix:p,bignumber:h,unaryMinus:m}=e;function g(j){return function(O,C,N,D){var P=!(C.length===2&&(C.every(S)||C.every(Fo)));if(P)throw new Error('"tspan" must be an Array of two numeric values or two units [tStart, tEnd]');var q=C[0],z=C[1],I=f(z,q),T=D.firstStep;if(T!==void 0&&!u(T))throw new Error('"firstStep" must be positive');var L=D.maxStep;if(L!==void 0&&!u(L))throw new Error('"maxStep" must be positive');var _=D.minStep;if(_&&c(_))throw new Error('"minStep" must be positive or zero');var Y=[q,z,T,_,L].filter(_e=>_e!==void 0);if(!(Y.every(S)||Y.every(Fo)))throw new Error('Inconsistent type of "t" dependant variables');for(var oe=1,te=D.tol?D.tol:1e-4,Q=D.minDelta?D.minDelta:.2,fe=D.maxDelta?D.maxDelta:5,Ie=D.maxIter?D.maxIter:1e4,Se=[q,z,...N,L,_].some(It),[Oe,ve,ye,me]=Se?[h(j.a),h(j.c),h(j.b),h(j.bp)]:[j.a,j.c,j.b,j.bp],ke=T?I?T:m(T):a(n(z,q),oe),$=[q],ae=[N],ce=n(ye,me),U=0,R=0,J=x(I),ee=w(I);J($[U],z);){var ie=[];ke=ee($[U],z,ke),ie.push(O($[U],ae[U]));for(var re=1;reFo(_e)?_e.value:_e)));Ee1/4&&($.push(r($[U],ke)),ae.push(r(ae[U],i(ke,ye,ie))),U++);var Ce=.84*(te/Ee)**(1/5);if(d(Ce,Q)?Ce=Q:f(Ce,fe)&&(Ce=fe),Ce=Se?h(Ce):Ce,ke=i(ke,Ce),L&&f(l(ke),L)?ke=I?L:m(L):_&&d(l(ke),_)&&(ke=I?_:m(_)),R++,R>Ie)throw new Error("Maximum number of iterations reached, try changing options")}return{t:$,y:ae}}}function A(j,O,C,N){var D=[[],[.5],[0,.75],[.2222222222222222,.3333333333333333,.4444444444444444]],P=[null,1/2,3/4,1],q=[2/9,1/3,4/9,0],z=[7/24,1/4,1/3,1/8],I={a:D,c:P,b:q,bp:z};return g(I)(j,O,C,N)}function b(j,O,C,N){var D=[[],[.2],[.075,.225],[.9777777777777777,-3.7333333333333334,3.5555555555555554],[2.9525986892242035,-11.595793324188385,9.822892851699436,-.2908093278463649],[2.8462752525252526,-10.757575757575758,8.906422717743473,.2784090909090909,-.2735313036020583],[.09114583333333333,0,.44923629829290207,.6510416666666666,-.322376179245283,.13095238095238096]],P=[null,1/5,3/10,4/5,8/9,1,1],q=[35/384,0,500/1113,125/192,-2187/6784,11/84,0],z=[5179/57600,0,7571/16695,393/640,-92097/339200,187/2100,1/40],I={a:D,c:P,b:q,bp:z};return g(I)(j,O,C,N)}function v(j,O,C,N){var D=N.method?N.method:"RK45",P={RK23:A,RK45:b};if(D.toUpperCase()in P){var q=Rqe({},N);return delete q.method,P[D.toUpperCase()](j,O,C,q)}else{var z=Object.keys(P).map(T=>'"'.concat(T,'"')),I="".concat(z.slice(0,-1).join(", ")," and ").concat(z.slice(-1));throw new Error('Unavailable method "'.concat(D,'". Available methods are ').concat(I))}}function x(j){return j?d:f}function w(j){var O=j?f:d;return function(C,N,D){var P=r(C,D);return O(P,N)?n(N,C):D}}function S(j){return It(j)||Qt(j)}function k(j,O,C,N){var D=v(j,O.toArray(),C.toArray(),N);return{t:p(D.t),y:p(D.y)}}return t("solveODE",{"function, Array, Array, Object":v,"function, Matrix, Matrix, Object":k,"function, Array, Array":(j,O,C)=>v(j,O,C,{}),"function, Matrix, Matrix":(j,O,C)=>k(j,O,C,{}),"function, Array, number | BigNumber | Unit":(j,O,C)=>{var N=v(j,O,[C],{});return{t:N.t,y:N.y.map(D=>D[0])}},"function, Matrix, number | BigNumber | Unit":(j,O,C)=>{var N=v(j,O.toArray(),[C],{});return{t:p(N.t),y:p(N.y.map(D=>D[0]))}},"function, Array, number | BigNumber | Unit, Object":(j,O,C,N)=>{var D=v(j,O,[C],N);return{t:D.t,y:D.y.map(P=>P[0])}},"function, Matrix, number | BigNumber | Unit, Object":(j,O,C,N)=>{var D=v(j,O.toArray(),[C],N);return{t:p(D.t),y:p(D.y.map(P=>P[0]))}}})});var Lqe="erf",zqe=["typed"],d3=V(Lqe,zqe,e=>{var{typed:t}=e;return t("name",{number:function(o){var s=Math.abs(o);return s>=Hqe?kd(o):s<=Uqe?kd(o)*r(s):s<=4?kd(o)*(1-n(s)):kd(o)*(1-i(s))},"Array | Matrix":t.referToSelf(a=>o=>jt(o,a))});function r(a){var o=a*a,s=HA[0][4]*o,l=o,u;for(u=0;u<3;u+=1)s=(s+HA[0][u])*o,l=(l+gS[0][u])*o;return a*(s+HA[0][3])/(l+gS[0][3])}function n(a){var o=HA[1][8]*a,s=a,l;for(l=0;l<7;l+=1)o=(o+HA[1][l])*a,s=(s+gS[1][l])*a;var u=(o+HA[1][7])/(s+gS[1][7]),c=parseInt(a*16)/16,f=(a-c)*(a+c);return Math.exp(-c*c)*Math.exp(-f)*u}function i(a){var o=1/(a*a),s=HA[2][5]*o,l=o,u;for(u=0;u<4;u+=1)s=(s+HA[2][u])*o,l=(l+gS[2][u])*o;var c=o*(s+HA[2][4])/(l+gS[2][4]);c=(Wqe-c)/a,o=parseInt(a*16)/16;var f=(a-o)*(a+o);return Math.exp(-o*o)*Math.exp(-f)*c}}),Uqe=.46875,Wqe=.5641895835477563,HA=[[3.1611237438705655,113.86415415105016,377.485237685302,3209.3775891384694,.18577770618460315],[.5641884969886701,8.883149794388377,66.11919063714163,298.6351381974001,881.952221241769,1712.0476126340707,2051.0783778260716,1230.3393547979972,21531153547440383e-24],[.30532663496123236,.36034489994980445,.12578172611122926,.016083785148742275,.0006587491615298378,.016315387137302097]],gS=[[23.601290952344122,244.02463793444417,1282.6165260773723,2844.236833439171],[15.744926110709835,117.6939508913125,537.1811018620099,1621.3895745666903,3290.7992357334597,4362.619090143247,3439.3676741437216,1230.3393548037495],[2.568520192289822,1.8729528499234604,.5279051029514285,.06051834131244132,.0023352049762686918]],Hqe=Math.pow(2,53);var Fue="zeta",Vqe=["typed","config","multiply","pow","divide","factorial","equal","smallerEq","isNegative","gamma","sin","subtract","add","?Complex","?BigNumber","pi"],p3=V(Fue,Vqe,e=>{var{typed:t,config:r,multiply:n,pow:i,divide:a,factorial:o,equal:s,smallerEq:l,isNegative:u,gamma:c,sin:f,subtract:d,add:p,Complex:h,BigNumber:m,pi:g}=e;return t(Fue,{number:S=>A(S,k=>k,()=>20),BigNumber:S=>A(S,k=>new m(k),()=>Math.abs(Math.log10(r.epsilon))),Complex:b});function A(S,k,j){return s(S,0)?k(-.5):s(S,1)?k(NaN):isFinite(S)?v(S,k,j,O=>O):u(S)?k(NaN):k(1)}function b(S){return S.re===0&&S.im===0?new h(-.5):S.re===1?new h(NaN,NaN):S.re===1/0&&S.im===0?new h(1):S.im===1/0||S.re===-1/0?new h(NaN,NaN):v(S,k=>k,k=>Math.round(1.3*15+.9*Math.abs(k.im)),k=>k.re)}function v(S,k,j,O){var C=j(S);if(O(S)>-(C-1)/2)return w(S,k(C),k);var N=n(i(2,S),i(k(g),d(S,1)));return N=n(N,f(n(a(k(g),2),S))),N=n(N,c(d(1,S))),n(N,v(d(1,S),k,j,O))}function x(S,k){for(var j=S,O=S;l(O,k);O=p(O,1)){var C=a(n(o(p(k,d(O,1))),i(4,O)),n(o(d(k,O)),o(n(2,O))));j=p(j,C)}return n(k,j)}function w(S,k,j){for(var O=a(1,n(x(j(0),k),d(1,i(2,d(1,S))))),C=j(0),N=j(1);l(N,k);N=p(N,1))C=p(C,a(n((-1)**(N-1),x(N,k)),i(N,S)));return n(O,C)}});var _ue="mode",Gqe=["typed","isNaN","isNumeric"],m3=V(_ue,Gqe,e=>{var{typed:t,isNaN:r,isNumeric:n}=e;return t(_ue,{"Array | Matrix":i,"...":function(o){return i(o)}});function i(a){a=mr(a.valueOf());var o=a.length;if(o===0)throw new Error("Cannot calculate mode of an empty array");for(var s={},l=[],u=0,c=0;cu&&(u=s[f],l=[f])}return l}});function La(e,t,r){var n;return String(e).indexOf("Unexpected type")!==-1?(n=arguments.length>2?" (type: "+qr(r)+", value: "+JSON.stringify(r)+")":" (type: "+e.data.actual+")",new TypeError("Cannot calculate "+t+", unexpected type of argument"+n)):String(e).indexOf("complex numbers")!==-1?(n=arguments.length>2?" (type: "+qr(r)+", value: "+JSON.stringify(r)+")":"",new TypeError("Cannot calculate "+t+", no ordering relation is defined for complex numbers"+n)):e}var Pue="prod",Qqe=["typed","config","multiplyScalar","numeric"],h3=V(Pue,Qqe,e=>{var{typed:t,config:r,multiplyScalar:n,numeric:i}=e;return t(Pue,{"Array | Matrix":a,"Array | Matrix, number | BigNumber":function(s,l){throw new Error("prod(A, dim) is not yet supported")},"...":function(s){return a(s)}});function a(o){var s;if(au(o,function(l){try{s=s===void 0?l:n(s,l)}catch(u){throw La(u,"prod",l)}}),typeof s=="string"&&(s=i(s,r.number)),s===void 0)throw new Error("Cannot calculate prod of an empty array");return s}});var Iue="format",Yqe=["typed"],A3=V(Iue,Yqe,e=>{var{typed:t}=e;return t(Iue,{any:tr,"any, Object | function | number | BigNumber":tr})});var Bue="bin",Zqe=["typed","format"],g3=V(Bue,Zqe,e=>{var{typed:t,format:r}=e;return t(Bue,{"number | BigNumber":function(i){return r(i,{notation:"bin"})},"number | BigNumber, number | BigNumber":function(i,a){return r(i,{notation:"bin",wordSize:a})}})});var Rue="oct",Xqe=["typed","format"],v3=V(Rue,Xqe,e=>{var{typed:t,format:r}=e;return t(Rue,{"number | BigNumber":function(i){return r(i,{notation:"oct"})},"number | BigNumber, number | BigNumber":function(i,a){return r(i,{notation:"oct",wordSize:a})}})});var $ue="hex",Kqe=["typed","format"],y3=V($ue,Kqe,e=>{var{typed:t,format:r}=e;return t($ue,{"number | BigNumber":function(i){return r(i,{notation:"hex"})},"number | BigNumber, number | BigNumber":function(i,a){return r(i,{notation:"hex",wordSize:a})}})});var b3=/\$([\w.]+)/g;var que="print",Jqe=["typed"],vS=V(que,Jqe,e=>{var{typed:t}=e;return t(que,{"string, Object | Array":Lue,"string, Object | Array, number | Object":Lue})});function Lue(e,t,r){return e.replace(b3,function(n,i){var a=i.split("."),o=t[a.shift()];for(o!==void 0&&o.isMatrix&&(o=o.toArray());a.length&&o!==void 0;){var s=a.shift();o=s?o[s]:o+"."}return o!==void 0?da(o)?o:tr(o,r):n})}var zue="to",eLe=["typed","matrix","concat"],x3=V(zue,eLe,e=>{var{typed:t,matrix:r,concat:n}=e,i=fr({typed:t,matrix:r,concat:n});return t(zue,{"Unit, Unit | string":(a,o)=>a.to(o)},i({Ds:!0}))});var Uue="isPrime",tLe=["typed"],w3=V(Uue,tLe,e=>{var{typed:t}=e;return t(Uue,{number:function(n){if(n*0!==0)return!1;if(n<=3)return n>1;if(n%2===0||n%3===0)return!1;for(var i=5;i*i<=n;i+=6)if(n%i===0||n%(i+2)===0)return!1;return!0},BigNumber:function(n){if(n.toNumber()*0!==0)return!1;if(n.lte(3))return n.gt(1);if(n.mod(2).eq(0)||n.mod(3).eq(0))return!1;if(n.lt(Math.pow(2,32))){for(var i=n.toNumber(),a=5;a*a<=i;a+=6)if(i%a===0||i%(a+2)===0)return!1;return!0}function o(b,v,x){for(var w=1;!v.eq(0);)v.mod(2).eq(0)?(v=v.div(2),b=b.mul(b).mod(x)):(v=v.sub(1),w=b.mul(w).mod(x));return w}var s=n.constructor.clone({precision:n.toFixed(0).length*2});n=new s(n);for(var l=0,u=n.sub(1);u.mod(2).eq(0);)u=u.div(2),l+=1;var c=null;if(n.lt("3317044064679887385961981"))c=[2,3,5,7,11,13,17,19,23,29,31,37,41].filter(b=>bn=>jt(n,r))})});var rLe="numeric",nLe=["number","?bignumber","?fraction"],S3=V(rLe,nLe,e=>{var{number:t,bignumber:r,fraction:n}=e,i={string:!0,number:!0,BigNumber:!0,Fraction:!0},a={number:o=>t(o),BigNumber:r?o=>r(o):pS,Fraction:n?o=>n(o):KF};return function(s){var l=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"number",u=arguments.length>2?arguments[2]:void 0;if(u!==void 0)throw new SyntaxError("numeric() takes one or two arguments");var c=qr(s);if(!(c in i))throw new TypeError("Cannot convert "+s+' of type "'+c+'"; valid input types are '+Object.keys(i).join(", "));if(!(l in a))throw new TypeError("Cannot convert "+s+' to type "'+l+'"; valid output types are '+Object.keys(a).join(", "));return l===c?s:a[l](s)}});var Wue="divideScalar",iLe=["typed","numeric"],E3=V(Wue,iLe,e=>{var{typed:t,numeric:r}=e;return t(Wue,{"number, number":function(i,a){return i/a},"Complex, Complex":function(i,a){return i.div(a)},"BigNumber, BigNumber":function(i,a){return i.div(a)},"Fraction, Fraction":function(i,a){return i.div(a)},"Unit, number | Complex | Fraction | BigNumber | Unit":(n,i)=>n.divide(i),"number | Fraction | Complex | BigNumber, Unit":(n,i)=>i.divideInto(n)})});var Hue="pow",aLe=["typed","config","identity","multiply","matrix","inv","fraction","number","Complex"],k3=V(Hue,aLe,e=>{var{typed:t,config:r,identity:n,multiply:i,matrix:a,inv:o,number:s,fraction:l,Complex:u}=e;return t(Hue,{"number, number":c,"Complex, Complex":function(h,m){return h.pow(m)},"BigNumber, BigNumber":function(h,m){return m.isInteger()||h>=0||r.predictable?h.pow(m):new u(h.toNumber(),0).pow(m.toNumber(),0)},"Fraction, Fraction":function(h,m){var g=h.pow(m);if(g!=null)return g;if(r.predictable)throw new Error("Result of pow is non-rational and cannot be expressed as a fraction");return c(h.valueOf(),m.valueOf())},"Array, number":f,"Array, BigNumber":function(h,m){return f(h,m.toNumber())},"Matrix, number":d,"Matrix, BigNumber":function(h,m){return d(h,m.toNumber())},"Unit, number | BigNumber":function(h,m){return h.pow(m)}});function c(p,h){if(r.predictable&&!wt(h)&&p<0)try{var m=l(h),g=s(m);if((h===g||Math.abs((h-g)/h)<1e-14)&&m.d%2===1)return(m.n%2===0?1:-1)*Math.pow(-p,h)}catch{}return r.predictable&&(p<-1&&h===1/0||p>-1&&p<0&&h===-1/0)?NaN:wt(h)||p>=0||r.predictable?BW(p,h):p*p<1&&h===1/0||p*p>1&&h===-1/0?0:new u(p,0).pow(h,0)}function f(p,h){if(!wt(h))throw new TypeError("For A^b, b must be an integer (value is "+h+")");var m=Yt(p);if(m.length!==2)throw new Error("For A^b, A must be 2 dimensional (A has "+m.length+" dimensions)");if(m[0]!==m[1])throw new Error("For A^b, A must be square (size is "+m[0]+"x"+m[1]+")");if(h<0)try{return f(o(p),-h)}catch(b){throw b.message==="Cannot calculate inverse, determinant is zero"?new TypeError("For A^b, when A is not invertible, b must be a positive integer (value is "+h+")"):b}for(var g=n(m[0]).valueOf(),A=p;h>=1;)(h&1)===1&&(g=i(A,g)),h>>=1,A=i(A,A);return g}function d(p,h){return a(f(p.valueOf(),h))}});var yS="Number of decimals in function round must be an integer",Vue="round",oLe=["typed","config","matrix","equalScalar","zeros","BigNumber","DenseMatrix"],C3=V(Vue,oLe,e=>{var{typed:t,config:r,matrix:n,equalScalar:i,zeros:a,BigNumber:o,DenseMatrix:s}=e,l=Gn({typed:t,equalScalar:i}),u=An({typed:t,DenseMatrix:s}),c=vo({typed:t});function f(d){return Math.abs(Gw(d).exponent)}return t(Vue,{number:function(p){var h=tS(p,f(r.epsilon)),m=Oa(p,h,r.epsilon)?h:p;return tS(m)},"number, number":function(p,h){var m=f(r.epsilon);if(h>=m)return tS(p,h);var g=tS(p,m),A=Oa(p,g,r.epsilon)?g:p;return tS(A,h)},"number, BigNumber":function(p,h){if(!h.isInteger())throw new TypeError(yS);return new o(p).toDecimalPlaces(h.toNumber())},Complex:function(p){return p.round()},"Complex, number":function(p,h){if(h%1)throw new TypeError(yS);return p.round(h)},"Complex, BigNumber":function(p,h){if(!h.isInteger())throw new TypeError(yS);var m=h.toNumber();return p.round(m)},BigNumber:function(p){var h=new o(p).toDecimalPlaces(f(r.epsilon)),m=_o(p,h,r.epsilon)?h:p;return m.toDecimalPlaces(0)},"BigNumber, BigNumber":function(p,h){if(!h.isInteger())throw new TypeError(yS);var m=f(r.epsilon);if(h>=m)return p.toDecimalPlaces(h.toNumber());var g=p.toDecimalPlaces(m),A=_o(p,g,r.epsilon)?g:p;return A.toDecimalPlaces(h.toNumber())},Fraction:function(p){return p.round()},"Fraction, number":function(p,h){if(h%1)throw new TypeError(yS);return p.round(h)},"Fraction, BigNumber":function(p,h){if(!h.isInteger())throw new TypeError(yS);return p.round(h.toNumber())},"Unit, number, Unit":t.referToSelf(d=>function(p,h,m){var g=p.toNumeric(m);return m.multiply(d(g,h))}),"Unit, BigNumber, Unit":t.referToSelf(d=>(p,h,m)=>d(p,h.toNumber(),m)),"Unit, Unit":t.referToSelf(d=>(p,h)=>d(p,0,h)),"Array | Matrix, number, Unit":t.referToSelf(d=>(p,h,m)=>jt(p,g=>d(g,h,m),!0)),"Array | Matrix, BigNumber, Unit":t.referToSelf(d=>(p,h,m)=>d(p,h.toNumber(),m)),"Array | Matrix, Unit":t.referToSelf(d=>(p,h)=>d(p,0,h)),"Array | Matrix":t.referToSelf(d=>p=>jt(p,d,!0)),"SparseMatrix, number | BigNumber":t.referToSelf(d=>(p,h)=>l(p,h,d,!1)),"DenseMatrix, number | BigNumber":t.referToSelf(d=>(p,h)=>c(p,h,d,!1)),"Array, number | BigNumber":t.referToSelf(d=>(p,h)=>c(n(p),h,d,!1).valueOf()),"number | Complex | BigNumber | Fraction, SparseMatrix":t.referToSelf(d=>(p,h)=>i(p,0)?a(h.size(),h.storage()):u(h,p,d,!0)),"number | Complex | BigNumber | Fraction, DenseMatrix":t.referToSelf(d=>(p,h)=>i(p,0)?a(h.size(),h.storage()):c(h,p,d,!0)),"number | Complex | BigNumber | Fraction, Array":t.referToSelf(d=>(p,h)=>c(n(h),p,d,!0).valueOf())})});var Gue="log",sLe=["config","typed","divideScalar","Complex"],D3=V(Gue,sLe,e=>{var{typed:t,config:r,divideScalar:n,Complex:i}=e;return t(Gue,{number:function(o){return o>=0||r.predictable?Zse(o):new i(o,0).log()},Complex:function(o){return o.log()},BigNumber:function(o){return!o.isNegative()||r.predictable?o.ln():new i(o.toNumber(),0).log()},"any, any":t.referToSelf(a=>(o,s)=>n(a(o),a(s)))})});var Que="log1p",lLe=["typed","config","divideScalar","log","Complex"],O3=V(Que,lLe,e=>{var{typed:t,config:r,divideScalar:n,log:i,Complex:a}=e;return t(Que,{number:function(l){return l>=-1||r.predictable?lT(l):o(new a(l,0))},Complex:o,BigNumber:function(l){var u=l.plus(1);return!u.isNegative()||r.predictable?u.ln():o(new a(l.toNumber(),0))},"Array | Matrix":t.referToSelf(s=>l=>jt(l,s)),"any, any":t.referToSelf(s=>(l,u)=>n(s(l),i(u)))});function o(s){var l=s.re+1;return new a(Math.log(Math.sqrt(l*l+s.im*s.im)),Math.atan2(s.im,l))}});var Yue="nthRoots",uLe=["config","typed","divideScalar","Complex"],M3=V(Yue,uLe,e=>{var{typed:t,config:r,divideScalar:n,Complex:i}=e,a=[function(l){return new i(l,0)},function(l){return new i(0,l)},function(l){return new i(-l,0)},function(l){return new i(0,-l)}];function o(s,l){if(l<0)throw new Error("Root must be greater than zero");if(l===0)throw new Error("Root must be non-zero");if(l%1!==0)throw new Error("Root must be an integer");if(s===0||s.abs()===0)return[new i(0,0)];var u=typeof s=="number",c;(u||s.re===0||s.im===0)&&(u?c=2*+(s<0):s.im===0?c=2*+(s.re<0):c=2*+(s.im<0)+1);for(var f=s.arg(),d=s.abs(),p=[],h=Math.pow(d,1/l),m=0;m{var{typed:t,equalScalar:r,matrix:n,pow:i,DenseMatrix:a,concat:o}=e,s=xi({typed:t}),l=Qo({typed:t,DenseMatrix:a}),u=Gn({typed:t,equalScalar:r}),c=An({typed:t,DenseMatrix:a}),f=fr({typed:t,matrix:n,concat:o}),d={};for(var p in i.signatures)Object.prototype.hasOwnProperty.call(i.signatures,p)&&!p.includes("Matrix")&&!p.includes("Array")&&(d[p]=i.signatures[p]);var h=t(d);return t(Zue,f({elop:h,SS:l,DS:s,Ss:u,sS:c}))});var Xue="dotDivide",fLe=["typed","matrix","equalScalar","divideScalar","DenseMatrix","concat"],N3=V(Xue,fLe,e=>{var{typed:t,matrix:r,equalScalar:n,divideScalar:i,DenseMatrix:a,concat:o}=e,s=yo({typed:t,equalScalar:n}),l=xi({typed:t}),u=Qo({typed:t,DenseMatrix:a}),c=Gn({typed:t,equalScalar:n}),f=An({typed:t,DenseMatrix:a}),d=fr({typed:t,matrix:r,concat:o});return t(Xue,d({elop:i,SS:u,DS:l,SD:s,Ss:c,sS:f}))});function Zm(e){var{DenseMatrix:t}=e;return function(n,i,a){var o=n.size();if(o.length!==2)throw new RangeError("Matrix must be two dimensional (size: "+tr(o)+")");var s=o[0],l=o[1];if(s!==l)throw new RangeError("Matrix must be square (size: "+tr(o)+")");var u=[];if(St(i)){var c=i.size(),f=i._data;if(c.length===1){if(c[0]!==s)throw new RangeError("Dimension mismatch. Matrix columns must match vector length.");for(var d=0;d{var{typed:t,matrix:r,divideScalar:n,multiplyScalar:i,subtractScalar:a,equalScalar:o,DenseMatrix:s}=e,l=Zm({DenseMatrix:s});return t(Kue,{"SparseMatrix, Array | Matrix":function(d,p){return c(d,p)},"DenseMatrix, Array | Matrix":function(d,p){return u(d,p)},"Array, Array | Matrix":function(d,p){var h=r(d),m=u(h,p);return m.valueOf()}});function u(f,d){d=l(f,d,!0);for(var p=d._data,h=f._size[0],m=f._size[1],g=[],A=f._data,b=0;bx&&(k.push(g[N]),j.push(D))}if(o(S,0))throw new Error("Linear system cannot be solved since matrix is singular");for(var P=n(w,S),q=0,z=j.length;q{var{typed:t,matrix:r,divideScalar:n,multiplyScalar:i,subtractScalar:a,equalScalar:o,DenseMatrix:s}=e,l=Zm({DenseMatrix:s});return t(Jue,{"SparseMatrix, Array | Matrix":function(d,p){return c(d,p)},"DenseMatrix, Array | Matrix":function(d,p){return u(d,p)},"Array, Array | Matrix":function(d,p){var h=r(d),m=u(h,p);return m.valueOf()}});function u(f,d){d=l(f,d,!0);for(var p=d._data,h=f._size[0],m=f._size[1],g=[],A=f._data,b=m-1;b>=0;b--){var v=p[b][0]||0,x=void 0;if(o(v,0))x=0;else{var w=A[b][b];if(o(w,0))throw new Error("Linear system cannot be solved since matrix is singular");x=n(v,w);for(var S=b-1;S>=0;S--)p[S]=[a(p[S][0]||0,i(x,A[S][b]))]}g[b]=[x]}return new s({data:g,size:[h,1]})}function c(f,d){d=l(f,d,!0);for(var p=d._data,h=f._size[0],m=f._size[1],g=f._values,A=f._index,b=f._ptr,v=[],x=m-1;x>=0;x--){var w=p[x][0]||0;if(o(w,0))v[x]=[0];else{for(var S=0,k=[],j=[],O=b[x],C=b[x+1],N=C-1;N>=O;N--){var D=A[N];D===x?S=g[N]:D{var{typed:t,matrix:r,divideScalar:n,multiplyScalar:i,subtractScalar:a,equalScalar:o,DenseMatrix:s}=e,l=Zm({DenseMatrix:s});return t(ece,{"SparseMatrix, Array | Matrix":function(d,p){return c(d,p)},"DenseMatrix, Array | Matrix":function(d,p){return u(d,p)},"Array, Array | Matrix":function(d,p){var h=r(d),m=u(h,p);return m.map(g=>g.valueOf())}});function u(f,d){for(var p=[l(f,d,!0)._data.map(j=>j[0])],h=f._data,m=f._size[0],g=f._size[1],A=0;Anew s({data:j.map(O=>[O]),size:[m,1]}))}function c(f,d){for(var p=[l(f,d,!0)._data.map(oe=>oe[0])],h=f._size[0],m=f._size[1],g=f._values,A=f._index,b=f._ptr,v=0;vv&&(k.push(g[D]),j.push(P))}if(o(N,0))if(o(S[v],0)){if(w===0){var T=[...S];T[v]=1;for(var L=0,_=j.length;L<_;L++){var Y=j[L];T[Y]=a(T[Y],k[L])}p.push(T)}}else{if(w===0)return[];p.splice(w,1),w-=1,x-=1}else{S[v]=n(S[v],N);for(var q=0,z=j.length;qnew s({data:oe.map(te=>[te]),size:[h,1]}))}});var tce="usolveAll",hLe=["typed","matrix","divideScalar","multiplyScalar","subtractScalar","equalScalar","DenseMatrix"],P3=V(tce,hLe,e=>{var{typed:t,matrix:r,divideScalar:n,multiplyScalar:i,subtractScalar:a,equalScalar:o,DenseMatrix:s}=e,l=Zm({DenseMatrix:s});return t(tce,{"SparseMatrix, Array | Matrix":function(d,p){return c(d,p)},"DenseMatrix, Array | Matrix":function(d,p){return u(d,p)},"Array, Array | Matrix":function(d,p){var h=r(d),m=u(h,p);return m.map(g=>g.valueOf())}});function u(f,d){for(var p=[l(f,d,!0)._data.map(j=>j[0])],h=f._data,m=f._size[0],g=f._size[1],A=g-1;A>=0;A--)for(var b=p.length,v=0;v=0;k--)S[k]=a(S[k],h[k][A]);p.push(S)}}else{if(v===0)return[];p.splice(v,1),v-=1,b-=1}else{x[A]=n(x[A],h[A][A]);for(var w=A-1;w>=0;w--)x[w]=a(x[w],i(x[A],h[w][A]))}}return p.map(j=>new s({data:j.map(O=>[O]),size:[m,1]}))}function c(f,d){for(var p=[l(f,d,!0)._data.map(oe=>oe[0])],h=f._size[0],m=f._size[1],g=f._values,A=f._index,b=f._ptr,v=m-1;v>=0;v--)for(var x=p.length,w=0;w=O;D--){var P=A[D];P===v?N=g[D]:Pnew s({data:oe.map(te=>[te]),size:[h,1]}))}});var ALe="matAlgo08xS0Sid",gLe=["typed","equalScalar"],bS=V(ALe,gLe,e=>{var{typed:t,equalScalar:r}=e;return function(i,a,o){var s=i._values,l=i._index,u=i._ptr,c=i._size,f=i._datatype||i._data===void 0?i._datatype:i.getDataType(),d=a._values,p=a._index,h=a._ptr,m=a._size,g=a._datatype||a._data===void 0?a._datatype:a.getDataType();if(c.length!==m.length)throw new nr(c.length,m.length);if(c[0]!==m[0]||c[1]!==m[1])throw new RangeError("Dimension mismatch. Matrix A ("+c+") must match Matrix B ("+m+")");if(!s||!d)throw new Error("Cannot perform operation on Pattern Sparse Matrices");var A=c[0],b=c[1],v,x=r,w=0,S=o;typeof f=="string"&&f===g&&f!=="mixed"&&(v=f,x=t.find(r,[v,v]),w=t.convert(0,v),S=t.find(o,[v,v]));for(var k=[],j=[],O=[],C=[],N=[],D,P,q,z,I=0;I{var{typed:t,matrix:r}=e;return{"Array, number":t.referTo("DenseMatrix, number",n=>(i,a)=>n(r(i),a).valueOf()),"Array, BigNumber":t.referTo("DenseMatrix, BigNumber",n=>(i,a)=>n(r(i),a).valueOf()),"number, Array":t.referTo("number, DenseMatrix",n=>(i,a)=>n(i,r(a)).valueOf()),"BigNumber, Array":t.referTo("BigNumber, DenseMatrix",n=>(i,a)=>n(i,r(a)).valueOf())}});var rce="leftShift",vLe=["typed","matrix","equalScalar","zeros","DenseMatrix","concat"],I3=V(rce,vLe,e=>{var{typed:t,matrix:r,equalScalar:n,zeros:i,DenseMatrix:a,concat:o}=e,s=ou({typed:t}),l=yo({typed:t,equalScalar:n}),u=bS({typed:t,equalScalar:n}),c=Dc({typed:t,DenseMatrix:a}),f=Gn({typed:t,equalScalar:n}),d=vo({typed:t}),p=fr({typed:t,matrix:r,concat:o}),h=xS({typed:t,matrix:r});return t(rce,{"number, number":zW,"BigNumber, BigNumber":Vle,"SparseMatrix, number | BigNumber":t.referToSelf(m=>(g,A)=>n(A,0)?g.clone():f(g,A,m,!1)),"DenseMatrix, number | BigNumber":t.referToSelf(m=>(g,A)=>n(A,0)?g.clone():d(g,A,m,!1)),"number | BigNumber, SparseMatrix":t.referToSelf(m=>(g,A)=>n(g,0)?i(A.size(),A.storage()):c(A,g,m,!0)),"number | BigNumber, DenseMatrix":t.referToSelf(m=>(g,A)=>n(g,0)?i(A.size(),A.storage()):d(A,g,m,!0))},h,p({SS:u,DS:s,SD:l}))});var nce="rightArithShift",yLe=["typed","matrix","equalScalar","zeros","DenseMatrix","concat"],B3=V(nce,yLe,e=>{var{typed:t,matrix:r,equalScalar:n,zeros:i,DenseMatrix:a,concat:o}=e,s=ou({typed:t}),l=yo({typed:t,equalScalar:n}),u=bS({typed:t,equalScalar:n}),c=Dc({typed:t,DenseMatrix:a}),f=Gn({typed:t,equalScalar:n}),d=vo({typed:t}),p=fr({typed:t,matrix:r,concat:o}),h=xS({typed:t,matrix:r});return t(nce,{"number, number":UW,"BigNumber, BigNumber":Gle,"SparseMatrix, number | BigNumber":t.referToSelf(m=>(g,A)=>n(A,0)?g.clone():f(g,A,m,!1)),"DenseMatrix, number | BigNumber":t.referToSelf(m=>(g,A)=>n(A,0)?g.clone():d(g,A,m,!1)),"number | BigNumber, SparseMatrix":t.referToSelf(m=>(g,A)=>n(g,0)?i(A.size(),A.storage()):c(A,g,m,!0)),"number | BigNumber, DenseMatrix":t.referToSelf(m=>(g,A)=>n(g,0)?i(A.size(),A.storage()):d(A,g,m,!0))},h,p({SS:u,DS:s,SD:l}))});var ice="rightLogShift",bLe=["typed","matrix","equalScalar","zeros","DenseMatrix","concat"],R3=V(ice,bLe,e=>{var{typed:t,matrix:r,equalScalar:n,zeros:i,DenseMatrix:a,concat:o}=e,s=ou({typed:t}),l=yo({typed:t,equalScalar:n}),u=bS({typed:t,equalScalar:n}),c=Dc({typed:t,DenseMatrix:a}),f=Gn({typed:t,equalScalar:n}),d=vo({typed:t}),p=fr({typed:t,matrix:r,concat:o}),h=xS({typed:t,matrix:r});return t(ice,{"number, number":WW,"SparseMatrix, number | BigNumber":t.referToSelf(m=>(g,A)=>n(A,0)?g.clone():f(g,A,m,!1)),"DenseMatrix, number | BigNumber":t.referToSelf(m=>(g,A)=>n(A,0)?g.clone():d(g,A,m,!1)),"number | BigNumber, SparseMatrix":t.referToSelf(m=>(g,A)=>n(g,0)?i(A.size(),A.storage()):c(A,g,m,!0)),"number | BigNumber, DenseMatrix":t.referToSelf(m=>(g,A)=>n(g,0)?i(A.size(),A.storage()):d(A,g,m,!0))},h,p({SS:u,DS:s,SD:l}))});var ace="and",xLe=["typed","matrix","equalScalar","zeros","not","concat"],wS=V(ace,xLe,e=>{var{typed:t,matrix:r,equalScalar:n,zeros:i,not:a,concat:o}=e,s=yo({typed:t,equalScalar:n}),l=Y0({typed:t,equalScalar:n}),u=Gn({typed:t,equalScalar:n}),c=vo({typed:t}),f=fr({typed:t,matrix:r,concat:o});return t(ace,{"number, number":ZW,"Complex, Complex":function(p,h){return(p.re!==0||p.im!==0)&&(h.re!==0||h.im!==0)},"BigNumber, BigNumber":function(p,h){return!p.isZero()&&!h.isZero()&&!p.isNaN()&&!h.isNaN()},"Unit, Unit":t.referToSelf(d=>(p,h)=>d(p.value||0,h.value||0)),"SparseMatrix, any":t.referToSelf(d=>(p,h)=>a(h)?i(p.size(),p.storage()):u(p,h,d,!1)),"DenseMatrix, any":t.referToSelf(d=>(p,h)=>a(h)?i(p.size(),p.storage()):c(p,h,d,!1)),"any, SparseMatrix":t.referToSelf(d=>(p,h)=>a(p)?i(p.size(),p.storage()):u(h,p,d,!0)),"any, DenseMatrix":t.referToSelf(d=>(p,h)=>a(p)?i(p.size(),p.storage()):c(h,p,d,!0)),"Array, any":t.referToSelf(d=>(p,h)=>d(r(p),h).valueOf()),"any, Array":t.referToSelf(d=>(p,h)=>d(p,r(h)).valueOf())},f({SS:l,DS:s}))});var $3="compare",wLe=["typed","config","matrix","equalScalar","BigNumber","Fraction","DenseMatrix","concat"],q3=V($3,wLe,e=>{var{typed:t,config:r,equalScalar:n,matrix:i,BigNumber:a,Fraction:o,DenseMatrix:s,concat:l}=e,u=xi({typed:t}),c=Q0({typed:t,equalScalar:n}),f=An({typed:t,DenseMatrix:s}),d=fr({typed:t,matrix:i,concat:l}),p=Dd({typed:t});return t($3,SLe({typed:t,config:r}),{"boolean, boolean":function(m,g){return m===g?0:m>g?1:-1},"BigNumber, BigNumber":function(m,g){return _o(m,g,r.epsilon)?new a(0):new a(m.cmp(g))},"Fraction, Fraction":function(m,g){return new o(m.compare(g))},"Complex, Complex":function(){throw new TypeError("No ordering relation is defined for complex numbers")}},p,d({SS:c,DS:u,Ss:f}))}),SLe=V($3,["typed","config"],e=>{var{typed:t,config:r}=e;return t($3,{"number, number":function(i,a){return Oa(i,a,r.epsilon)?0:i>a?1:-1}})});var ky=Ae(sce(),1);var lce="compareNatural",ELe=["typed","compare"],L3=V(lce,ELe,e=>{var{typed:t,compare:r}=e,n=r.signatures["boolean,boolean"];return t(lce,{"any, any":i});function i(l,u){var c=qr(l),f=qr(u),d;if((c==="number"||c==="BigNumber"||c==="Fraction")&&(f==="number"||f==="BigNumber"||f==="Fraction"))return d=r(l,u),d.toString()!=="0"?d>0?1:-1:(0,ky.default)(c,f);var p=["Array","DenseMatrix","SparseMatrix"];if(p.includes(c)||p.includes(f))return d=a(i,l,u),d!==0?d:(0,ky.default)(c,f);if(c!==f)return(0,ky.default)(c,f);if(c==="Complex")return kLe(l,u);if(c==="Unit")return l.equalBase(u)?i(l.value,u.value):o(i,l.formatUnits(),u.formatUnits());if(c==="boolean")return n(l,u);if(c==="string")return(0,ky.default)(l,u);if(c==="Object")return s(i,l,u);if(c==="null"||c==="undefined")return 0;throw new TypeError('Unsupported type of value "'+c+'"')}function a(l,u,c){return vf(u)&&vf(c)?o(l,u.toJSON().values,c.toJSON().values):vf(u)?a(l,u.toArray(),c):vf(c)?a(l,u,c.toArray()):qA(u)?a(l,u.toJSON().data,c):qA(c)?a(l,u,c.toJSON().data):Array.isArray(u)?Array.isArray(c)?o(l,u,c):a(l,u,[c]):a(l,[u],c)}function o(l,u,c){for(var f=0,d=Math.min(u.length,c.length);fc.length?1:u.lengtht.re?1:e.ret.im?1:e.im{var{typed:t,matrix:r,concat:n}=e,i=fr({typed:t,matrix:r,concat:n});return t(uce,dT,i({elop:dT,Ds:!0}))});var U3="equal",DLe=["typed","matrix","equalScalar","DenseMatrix","concat"],W3=V(U3,DLe,e=>{var{typed:t,matrix:r,equalScalar:n,DenseMatrix:i,concat:a}=e,o=xi({typed:t}),s=Qo({typed:t,DenseMatrix:i}),l=An({typed:t,DenseMatrix:i}),u=fr({typed:t,matrix:r,concat:a});return t(U3,OLe({typed:t,equalScalar:n}),u({elop:n,SS:s,DS:o,Ss:l}))}),OLe=V(U3,["typed","equalScalar"],e=>{var{typed:t,equalScalar:r}=e;return t(U3,{"any, any":function(i,a){return i===null?a===null:a===null?i===null:i===void 0?a===void 0:a===void 0?i===void 0:r(i,a)}})});var cce="equalText",MLe=["typed","compareText","isZero"],H3=V(cce,MLe,e=>{var{typed:t,compareText:r,isZero:n}=e;return t(cce,{"any, any":function(a,o){return n(r(a,o))}})});var V3="smaller",jLe=["typed","config","matrix","DenseMatrix","concat"],G3=V(V3,jLe,e=>{var{typed:t,config:r,matrix:n,DenseMatrix:i,concat:a}=e,o=xi({typed:t}),s=Qo({typed:t,DenseMatrix:i}),l=An({typed:t,DenseMatrix:i}),u=fr({typed:t,matrix:n,concat:a}),c=Dd({typed:t});return t(V3,NLe({typed:t,config:r}),{"boolean, boolean":(f,d)=>ff.compare(d)===-1,"Complex, Complex":function(d,p){throw new TypeError("No ordering relation is defined for complex numbers")}},c,u({SS:s,DS:o,Ss:l}))}),NLe=V(V3,["typed","config"],e=>{var{typed:t,config:r}=e;return t(V3,{"number, number":function(i,a){return i{var{typed:t,config:r,matrix:n,DenseMatrix:i,concat:a}=e,o=xi({typed:t}),s=Qo({typed:t,DenseMatrix:i}),l=An({typed:t,DenseMatrix:i}),u=fr({typed:t,matrix:n,concat:a}),c=Dd({typed:t});return t(Q3,FLe({typed:t,config:r}),{"boolean, boolean":(f,d)=>f<=d,"BigNumber, BigNumber":function(d,p){return d.lte(p)||_o(d,p,r.epsilon)},"Fraction, Fraction":(f,d)=>f.compare(d)!==1,"Complex, Complex":function(){throw new TypeError("No ordering relation is defined for complex numbers")}},c,u({SS:s,DS:o,Ss:l}))}),FLe=V(Q3,["typed","config"],e=>{var{typed:t,config:r}=e;return t(Q3,{"number, number":function(i,a){return i<=a||Oa(i,a,r.epsilon)}})});var Z3="larger",_Le=["typed","config","matrix","DenseMatrix","concat"],X3=V(Z3,_Le,e=>{var{typed:t,config:r,matrix:n,DenseMatrix:i,concat:a}=e,o=xi({typed:t}),s=Qo({typed:t,DenseMatrix:i}),l=An({typed:t,DenseMatrix:i}),u=fr({typed:t,matrix:n,concat:a}),c=Dd({typed:t});return t(Z3,PLe({typed:t,config:r}),{"boolean, boolean":(f,d)=>f>d,"BigNumber, BigNumber":function(d,p){return d.gt(p)&&!_o(d,p,r.epsilon)},"Fraction, Fraction":(f,d)=>f.compare(d)===1,"Complex, Complex":function(){throw new TypeError("No ordering relation is defined for complex numbers")}},c,u({SS:s,DS:o,Ss:l}))}),PLe=V(Z3,["typed","config"],e=>{var{typed:t,config:r}=e;return t(Z3,{"number, number":function(i,a){return i>a&&!Oa(i,a,r.epsilon)}})});var K3="largerEq",ILe=["typed","config","matrix","DenseMatrix","concat"],J3=V(K3,ILe,e=>{var{typed:t,config:r,matrix:n,DenseMatrix:i,concat:a}=e,o=xi({typed:t}),s=Qo({typed:t,DenseMatrix:i}),l=An({typed:t,DenseMatrix:i}),u=fr({typed:t,matrix:n,concat:a}),c=Dd({typed:t});return t(K3,BLe({typed:t,config:r}),{"boolean, boolean":(f,d)=>f>=d,"BigNumber, BigNumber":function(d,p){return d.gte(p)||_o(d,p,r.epsilon)},"Fraction, Fraction":(f,d)=>f.compare(d)!==-1,"Complex, Complex":function(){throw new TypeError("No ordering relation is defined for complex numbers")}},c,u({SS:s,DS:o,Ss:l}))}),BLe=V(K3,["typed","config"],e=>{var{typed:t,config:r}=e;return t(K3,{"number, number":function(i,a){return i>=a||Oa(i,a,r.epsilon)}})});var fce="deepEqual",RLe=["typed","equal"],e_=V(fce,RLe,e=>{var{typed:t,equal:r}=e;return t(fce,{"any, any":function(a,o){return n(a.valueOf(),o.valueOf())}});function n(i,a){if(Array.isArray(i))if(Array.isArray(a)){var o=i.length;if(o!==a.length)return!1;for(var s=0;s{var{typed:t,config:r,equalScalar:n,matrix:i,DenseMatrix:a,concat:o}=e,s=xi({typed:t}),l=Qo({typed:t,DenseMatrix:a}),u=An({typed:t,DenseMatrix:a}),c=fr({typed:t,matrix:i,concat:o});return t(t_,qLe({typed:t,equalScalar:n}),c({elop:f,SS:l,DS:s,Ss:u}));function f(d,p){return!n(d,p)}}),qLe=V(t_,["typed","equalScalar"],e=>{var{typed:t,equalScalar:r}=e;return t(t_,{"any, any":function(i,a){return i===null?a!==null:a===null?i!==null:i===void 0?a!==void 0:a===void 0?i!==void 0:!r(i,a)}})});var dce="partitionSelect",LLe=["typed","isNumeric","isNaN","compare"],n_=V(dce,LLe,e=>{var{typed:t,isNumeric:r,isNaN:n,compare:i}=e,a=i,o=(u,c)=>-i(u,c);return t(dce,{"Array | Matrix, number":function(c,f){return s(c,f,a)},"Array | Matrix, number, string":function(c,f,d){if(d==="asc")return s(c,f,a);if(d==="desc")return s(c,f,o);throw new Error('Compare string must be "asc" or "desc"')},"Array | Matrix, number, function":s});function s(u,c,f){if(!wt(c)||c<0)throw new Error("k must be a non-negative integer");if(St(u)){var d=u.size();if(d.length>1)throw new Error("Only one dimensional matrices supported");return l(u.valueOf(),c,f)}if(Array.isArray(u))return l(u,c,f)}function l(u,c,f){if(c>=u.length)throw new Error("k out of bounds");for(var d=0;d=0){var b=u[g];u[g]=u[m],u[m]=b,--g}else++m;f(u[m],A)>0&&--m,c<=m?h=m:p=m+1}return u[c]}});var pce="sort",zLe=["typed","matrix","compare","compareNatural"],i_=V(pce,zLe,e=>{var{typed:t,matrix:r,compare:n,compareNatural:i}=e,a=n,o=(c,f)=>-n(c,f);return t(pce,{Array:function(f){return l(f),f.sort(a)},Matrix:function(f){return u(f),r(f.toArray().sort(a),f.storage())},"Array, function":function(f,d){return l(f),f.sort(d)},"Matrix, function":function(f,d){return u(f),r(f.toArray().sort(d),f.storage())},"Array, string":function(f,d){return l(f),f.sort(s(d))},"Matrix, string":function(f,d){return u(f),r(f.toArray().sort(s(d)),f.storage())}});function s(c){if(c==="asc")return a;if(c==="desc")return o;if(c==="natural")return i;throw new Error('String "asc", "desc", or "natural" expected')}function l(c){if(Yt(c).length!==1)throw new Error("One dimensional array expected")}function u(c){if(c.size().length!==1)throw new Error("One dimensional matrix expected")}});var mce="max",ULe=["typed","config","numeric","larger"],SS=V(mce,ULe,e=>{var{typed:t,config:r,numeric:n,larger:i}=e;return t(mce,{"Array | Matrix":o,"Array | Matrix, number | BigNumber":function(l,u){return V0(l,u.valueOf(),a)},"...":function(l){if(Cd(l))throw new TypeError("Scalar values expected in function max");return o(l)}});function a(s,l){try{return i(s,l)?s:l}catch(u){throw La(u,"max",l)}}function o(s){var l;if(au(s,function(u){try{isNaN(u)&&typeof u=="number"?l=NaN:(l===void 0||i(u,l))&&(l=u)}catch(c){throw La(c,"max",u)}}),l===void 0)throw new Error("Cannot calculate max of an empty array");return typeof l=="string"&&(l=n(l,r.number)),l}});var hce="min",WLe=["typed","config","numeric","smaller"],ES=V(hce,WLe,e=>{var{typed:t,config:r,numeric:n,smaller:i}=e;return t(hce,{"Array | Matrix":o,"Array | Matrix, number | BigNumber":function(l,u){return V0(l,u.valueOf(),a)},"...":function(l){if(Cd(l))throw new TypeError("Scalar values expected in function min");return o(l)}});function a(s,l){try{return i(s,l)?s:l}catch(u){throw La(u,"min",l)}}function o(s){var l;if(au(s,function(u){try{isNaN(u)&&typeof u=="number"?l=NaN:(l===void 0||i(u,l))&&(l=u)}catch(c){throw La(c,"min",u)}}),l===void 0)throw new Error("Cannot calculate min of an empty array");return typeof l=="string"&&(l=n(l,r.number)),l}});var HLe="ImmutableDenseMatrix",VLe=["smaller","DenseMatrix"],a_=V(HLe,VLe,e=>{var{smaller:t,DenseMatrix:r}=e;function n(i,a){if(!(this instanceof n))throw new SyntaxError("Constructor must be called with the new operator");if(a&&!da(a))throw new Error("Invalid datatype: "+a);if(St(i)||Ir(i)){var o=new r(i,a);this._data=o._data,this._size=o._size,this._datatype=o._datatype,this._min=null,this._max=null}else if(i&&Ir(i.data)&&Ir(i.size))this._data=i.data,this._size=i.size,this._datatype=i.datatype,this._min=typeof i.min<"u"?i.min:null,this._max=typeof i.max<"u"?i.max:null;else{if(i)throw new TypeError("Unsupported type of data ("+qr(i)+")");this._data=[],this._size=[0],this._datatype=a,this._min=null,this._max=null}}return n.prototype=new r,n.prototype.type="ImmutableDenseMatrix",n.prototype.isImmutableDenseMatrix=!0,n.prototype.subset=function(i){switch(arguments.length){case 1:{var a=r.prototype.subset.call(this,i);return St(a)?new n({data:a._data,size:a._size,datatype:a._datatype}):a}case 2:case 3:throw new Error("Cannot invoke set subset on an Immutable Matrix instance");default:throw new SyntaxError("Wrong number of arguments")}},n.prototype.set=function(){throw new Error("Cannot invoke set on an Immutable Matrix instance")},n.prototype.resize=function(){throw new Error("Cannot invoke resize on an Immutable Matrix instance")},n.prototype.reshape=function(){throw new Error("Cannot invoke reshape on an Immutable Matrix instance")},n.prototype.clone=function(){return new n({data:Bt(this._data),size:Bt(this._size),datatype:this._datatype})},n.prototype.toJSON=function(){return{mathjs:"ImmutableDenseMatrix",data:this._data,size:this._size,datatype:this._datatype}},n.fromJSON=function(i){return new n(i)},n.prototype.swapRows=function(){throw new Error("Cannot invoke swapRows on an Immutable Matrix instance")},n.prototype.min=function(){if(this._min===null){var i=null;this.forEach(function(a){(i===null||t(a,i))&&(i=a)}),this._min=i!==null?i:void 0}return this._min},n.prototype.max=function(){if(this._max===null){var i=null;this.forEach(function(a){(i===null||t(i,a))&&(i=a)}),this._max=i!==null?i:void 0}return this._max},n},{isClass:!0});var GLe="Index",QLe=["ImmutableDenseMatrix","getMatrixDataType"],o_=V(GLe,QLe,e=>{var{ImmutableDenseMatrix:t,getMatrixDataType:r}=e;function n(a){if(!(this instanceof n))throw new SyntaxError("Constructor must be called with the new operator");this._dimensions=[],this._sourceSize=[],this._isScalar=!0;for(var o=0,s=arguments.length;o{r&&t.push(n)}),t}var YLe="FibonacciHeap",ZLe=["smaller","larger"],s_=V(YLe,ZLe,e=>{var{smaller:t,larger:r}=e,n=1/Math.log((1+Math.sqrt(5))/2);function i(){if(!(this instanceof i))throw new SyntaxError("Constructor must be called with the new operator");this._minimum=null,this._size=0}i.prototype.type="FibonacciHeap",i.prototype.isFibonacciHeap=!0,i.prototype.insert=function(c,f){var d={key:c,value:f,degree:0};if(this._minimum){var p=this._minimum;d.left=p,d.right=p.right,p.right=d,d.right.left=d,t(c,p.key)&&(this._minimum=d)}else d.left=d,d.right=d,this._minimum=d;return this._size++,d},i.prototype.size=function(){return this._size},i.prototype.clear=function(){this._minimum=null,this._size=0},i.prototype.isEmpty=function(){return this._size===0},i.prototype.extractMinimum=function(){var c=this._minimum;if(c===null)return c;for(var f=this._minimum,d=c.degree,p=c.child;d>0;){var h=p.right;p.left.right=p.right,p.right.left=p.left,p.left=f,p.right=f.right,f.right=p,p.right.left=p,p.parent=null,p=h,d--}return c.left.right=c.right,c.right.left=c.left,c===c.right?f=null:(f=c.right,f=u(f,this._size)),this._size--,this._minimum=f,c},i.prototype.remove=function(c){this._minimum=a(this._minimum,c,-1),this.extractMinimum()};function a(c,f,d){f.key=d;var p=f.parent;return p&&t(f.key,p.key)&&(o(c,f,p),s(c,p)),t(f.key,c.key)&&(c=f),c}function o(c,f,d){f.left.right=f.right,f.right.left=f.left,d.degree--,d.child===f&&(d.child=f.right),d.degree===0&&(d.child=null),f.left=c,f.right=c.right,c.right=f,f.right.left=f,f.parent=null,f.mark=!1}function s(c,f){var d=f.parent;!d||(f.mark?(o(c,f,d),s(d)):f.mark=!0)}var l=function(f,d){f.left.right=f.right,f.right.left=f.left,f.parent=d,d.child?(f.left=d.child,f.right=d.child.right,d.child.right=f,f.right.left=f):(d.child=f,f.right=f,f.left=f),d.degree++,f.mark=!1};function u(c,f){var d=Math.floor(Math.log(f)*n)+1,p=new Array(d),h=0,m=c;if(m)for(h++,m=m.right;m!==c;)h++,m=m.right;for(var g;h>0;){for(var A=m.degree,b=m.right;g=p[A],!!g;){if(r(m.key,g.key)){var v=g;g=m,m=v}l(g,m),p[A]=null,A++}p[A]=m,m=b,h--}c=null;for(var x=0;x{var{addScalar:t,equalScalar:r,FibonacciHeap:n}=e;function i(){if(!(this instanceof i))throw new SyntaxError("Constructor must be called with the new operator");this._values=[],this._heap=new n}return i.prototype.type="Spa",i.prototype.isSpa=!0,i.prototype.set=function(a,o){if(this._values[a])this._values[a].value=o;else{var s=this._heap.insert(a,o);this._values[a]=s}},i.prototype.get=function(a){var o=this._values[a];return o?o.value:0},i.prototype.accumulate=function(a,o){var s=this._values[a];s?s.value=t(s.value,o):(s=this._heap.insert(a,o),this._values[a]=s)},i.prototype.forEach=function(a,o,s){var l=this._heap,u=this._values,c=[],f=l.extractMinimum();for(f&&c.push(f);f&&f.key<=o;)f.key>=a&&(r(f.value,0)||s(f.key,f.value,this)),f=l.extractMinimum(),f&&c.push(f);for(var d=0;d{var{on:t,config:r,addScalar:n,subtractScalar:i,multiplyScalar:a,divideScalar:o,pow:s,abs:l,fix:u,round:c,equal:f,isNumeric:d,format:p,number:h,Complex:m,BigNumber:g,Fraction:A}=e,b=h;function v(U,R){if(!(this instanceof v))throw new Error("Constructor must be called with the new operator");if(!(U==null||d(U)||ds(U)))throw new TypeError("First parameter in Unit constructor must be number, BigNumber, Fraction, Complex, or undefined");if(this.fixPrefix=!1,this.skipAutomaticSimplification=!0,R===void 0)this.units=[],this.dimensions=L.map(ee=>0);else if(typeof R=="string"){var J=v.parse(R);this.units=J.units,this.dimensions=J.dimensions}else if(Fo(R)&&R.value===null)this.fixPrefix=R.fixPrefix,this.skipAutomaticSimplification=R.skipAutomaticSimplification,this.dimensions=R.dimensions.slice(0),this.units=R.units.map(ee=>Fn({},ee));else throw new TypeError("Second parameter in Unit constructor must be a string or valueless Unit");this.value=this._normalize(U)}Object.defineProperty(v,"name",{value:"Unit"}),v.prototype.constructor=v,v.prototype.type="Unit",v.prototype.isUnit=!0;var x,w,S;function k(){for(;S===" "||S===" ";)C()}function j(U){return U>="0"&&U<="9"||U==="."}function O(U){return U>="0"&&U<="9"}function C(){w++,S=x.charAt(w)}function N(U){w=U,S=x.charAt(w)}function D(){var U="",R=w;if(S==="+"?C():S==="-"&&(U+=S,C()),!j(S))return N(R),null;if(S==="."){if(U+=S,C(),!O(S))return N(R),null}else{for(;O(S);)U+=S,C();S==="."&&(U+=S,C())}for(;O(S);)U+=S,C();if(S==="E"||S==="e"){var J="",ee=w;if(J+=S,C(),(S==="+"||S==="-")&&(J+=S,C()),!O(S))return N(ee),U;for(U=U+J;O(S);)U+=S,C()}return U}function P(){for(var U="";O(S)||v.isValidAlpha(S);)U+=S,C();var R=U.charAt(0);return v.isValidAlpha(R)?U:null}function q(U){return S===U?(C(),U):null}v.parse=function(U,R){if(R=R||{},x=U,w=-1,S="",typeof x!="string")throw new TypeError("Invalid argument in Unit.parse, string expected");var J=new v;J.units=[];var ee=1,ie=!1;C(),k();var re=D(),Ee=null;if(re){if(r.number==="BigNumber")Ee=new g(re);else if(r.number==="Fraction")try{Ee=new A(re)}catch{Ee=parseFloat(re)}else Ee=parseFloat(re);k(),q("*")?(ee=1,ie=!0):q("/")&&(ee=-1,ie=!0)}for(var Ce=[],_e=1;;){for(k();S==="(";)Ce.push(ee),_e*=ee,ee=1,C(),k();var he=void 0;if(S){var ze=S;if(he=P(),he===null)throw new SyntaxError('Unexpected "'+ze+'" in "'+x+'" at index '+w.toString())}else break;var Ye=z(he);if(Ye===null)throw new SyntaxError('Unit "'+he+'" not found.');var tt=ee*_e;if(k(),q("^")){k();var Ct=D();if(Ct===null)throw new SyntaxError('In "'+U+'", "^" must be followed by a floating-point number');tt*=Ct}J.units.push({unit:Ye.unit,prefix:Ye.prefix,power:tt});for(var we=0;we1||Math.abs(this.units[0].power-1)>1e-15},v.prototype._normalize=function(U){if(U==null||this.units.length===0)return U;for(var R=U,J=v._getNumberConverter(qr(U)),ee=0;ee{if(Et(Q,U)){var R=Q[U],J=R.prefixes[""];return{unit:R,prefix:J}}for(var ee in Q)if(Et(Q,ee)&&hse(U,ee)){var ie=Q[ee],re=U.length-ee.length,Ee=U.substring(0,re),Ce=Et(ie.prefixes,Ee)?ie.prefixes[Ee]:void 0;if(Ce!==void 0)return{unit:ie,prefix:Ce}}return null},{hasher:U=>U[0],limit:100});v.isValuelessUnit=function(U){return z(U)!==null},v.prototype.hasBase=function(U){if(typeof U=="string"&&(U=_[U]),!U)return!1;for(var R=0;R1e-12)return!1;return!0},v.prototype.equalBase=function(U){for(var R=0;R1e-12)return!1;return!0},v.prototype.equals=function(U){return this.equalBase(U)&&f(this.value,U.value)},v.prototype.multiply=function(U){for(var R=this.clone(),J=Fo(U)?U:new v(U),ee=0;ee1e-12&&(Et(Oe,Ce)?R.push({unit:Oe[Ce].unit,prefix:Oe[Ce].prefix,power:U.dimensions[Ee]||0}):re=!0)}R.length1e-12)if(Et(Se.si,ee))R.push({unit:Se.si[ee].unit,prefix:Se.si[ee].prefix,power:U.dimensions[J]||0});else throw new Error("Cannot express custom unit "+ee+" in SI units")}return U.units=R,U.fixPrefix=!0,U.skipAutomaticSimplification=!0,this.value!==null?(U.value=null,this.to(U)):U},v.prototype.formatUnits=function(){for(var U="",R="",J=0,ee=0,ie=0;ie0?(J++,U+=" "+this.units[ie].prefix.name+this.units[ie].unit.name,Math.abs(this.units[ie].power-1)>1e-15&&(U+="^"+this.units[ie].power)):this.units[ie].power<0&&ee++;if(ee>0)for(var re=0;re0?(R+=" "+this.units[re].prefix.name+this.units[re].unit.name,Math.abs(this.units[re].power+1)>1e-15&&(R+="^"+-this.units[re].power)):(R+=" "+this.units[re].prefix.name+this.units[re].unit.name,R+="^"+this.units[re].power));U=U.substr(1),R=R.substr(1),J>1&&ee>0&&(U="("+U+")"),ee>1&&J>0&&(R="("+R+")");var Ee=U;return J>0&&ee>0&&(Ee+=" / "),Ee+=R,Ee},v.prototype.format=function(U){var R=this.skipAutomaticSimplification||this.value===null?this.clone():this.simplify(),J=!1;typeof R.value<"u"&&R.value!==null&&ds(R.value)&&(J=Math.abs(R.value.re)<1e-14);for(var ee in R.units)Et(R.units,ee)&&R.units[ee].unit&&(R.units[ee].unit.name==="VA"&&J?R.units[ee].unit=Q.VAR:R.units[ee].unit.name==="VAR"&&!J&&(R.units[ee].unit=Q.VA));R.units.length===1&&!R.fixPrefix&&Math.abs(R.units[0].power-Math.round(R.units[0].power))<1e-14&&(R.units[0].prefix=R._bestPrefix());var ie=R._denormalize(R.value),re=R.value!==null?p(ie,U||{}):"",Ee=R.formatUnits();return R.value&&ds(R.value)&&(re="("+re+")"),Ee.length>0&&re.length>0&&(re+=" "),re+=Ee,re},v.prototype._bestPrefix=function(){if(this.units.length!==1)throw new Error("Can only compute the best prefix for single units with integer powers, like kg, s^2, N^-1, and so forth!");if(Math.abs(this.units[0].power-Math.round(this.units[0].power))>=1e-14)throw new Error("Can only compute the best prefix for single units with integer powers, like kg, s^2, N^-1, and so forth!");var U=this.value!==null?l(this.value):0,R=l(this.units[0].unit.value),J=this.units[0].prefix;if(U===0)return J;var ee=this.units[0].power,ie=Math.log(U/Math.pow(J.value*R,ee))/Math.LN10-1.2;if(ie>-2.200001&&ie<1.800001)return J;ie=Math.abs(ie);var re=this.units[0].unit.prefixes;for(var Ee in re)if(Et(re,Ee)){var Ce=re[Ee];if(Ce.scientific){var _e=Math.abs(Math.log(U/Math.pow(Ce.value*R,ee))/Math.LN10-1.2);(_e0)},Q={meter:{name:"meter",base:_.LENGTH,prefixes:T.LONG,value:1,offset:0},inch:{name:"inch",base:_.LENGTH,prefixes:T.NONE,value:.0254,offset:0},foot:{name:"foot",base:_.LENGTH,prefixes:T.NONE,value:.3048,offset:0},yard:{name:"yard",base:_.LENGTH,prefixes:T.NONE,value:.9144,offset:0},mile:{name:"mile",base:_.LENGTH,prefixes:T.NONE,value:1609.344,offset:0},link:{name:"link",base:_.LENGTH,prefixes:T.NONE,value:.201168,offset:0},rod:{name:"rod",base:_.LENGTH,prefixes:T.NONE,value:5.0292,offset:0},chain:{name:"chain",base:_.LENGTH,prefixes:T.NONE,value:20.1168,offset:0},angstrom:{name:"angstrom",base:_.LENGTH,prefixes:T.NONE,value:1e-10,offset:0},m:{name:"m",base:_.LENGTH,prefixes:T.SHORT,value:1,offset:0},in:{name:"in",base:_.LENGTH,prefixes:T.NONE,value:.0254,offset:0},ft:{name:"ft",base:_.LENGTH,prefixes:T.NONE,value:.3048,offset:0},yd:{name:"yd",base:_.LENGTH,prefixes:T.NONE,value:.9144,offset:0},mi:{name:"mi",base:_.LENGTH,prefixes:T.NONE,value:1609.344,offset:0},li:{name:"li",base:_.LENGTH,prefixes:T.NONE,value:.201168,offset:0},rd:{name:"rd",base:_.LENGTH,prefixes:T.NONE,value:5.02921,offset:0},ch:{name:"ch",base:_.LENGTH,prefixes:T.NONE,value:20.1168,offset:0},mil:{name:"mil",base:_.LENGTH,prefixes:T.NONE,value:254e-7,offset:0},m2:{name:"m2",base:_.SURFACE,prefixes:T.SQUARED,value:1,offset:0},sqin:{name:"sqin",base:_.SURFACE,prefixes:T.NONE,value:64516e-8,offset:0},sqft:{name:"sqft",base:_.SURFACE,prefixes:T.NONE,value:.09290304,offset:0},sqyd:{name:"sqyd",base:_.SURFACE,prefixes:T.NONE,value:.83612736,offset:0},sqmi:{name:"sqmi",base:_.SURFACE,prefixes:T.NONE,value:2589988110336e-6,offset:0},sqrd:{name:"sqrd",base:_.SURFACE,prefixes:T.NONE,value:25.29295,offset:0},sqch:{name:"sqch",base:_.SURFACE,prefixes:T.NONE,value:404.6873,offset:0},sqmil:{name:"sqmil",base:_.SURFACE,prefixes:T.NONE,value:64516e-14,offset:0},acre:{name:"acre",base:_.SURFACE,prefixes:T.NONE,value:4046.86,offset:0},hectare:{name:"hectare",base:_.SURFACE,prefixes:T.NONE,value:1e4,offset:0},m3:{name:"m3",base:_.VOLUME,prefixes:T.CUBIC,value:1,offset:0},L:{name:"L",base:_.VOLUME,prefixes:T.SHORT,value:.001,offset:0},l:{name:"l",base:_.VOLUME,prefixes:T.SHORT,value:.001,offset:0},litre:{name:"litre",base:_.VOLUME,prefixes:T.LONG,value:.001,offset:0},cuin:{name:"cuin",base:_.VOLUME,prefixes:T.NONE,value:16387064e-12,offset:0},cuft:{name:"cuft",base:_.VOLUME,prefixes:T.NONE,value:.028316846592,offset:0},cuyd:{name:"cuyd",base:_.VOLUME,prefixes:T.NONE,value:.764554857984,offset:0},teaspoon:{name:"teaspoon",base:_.VOLUME,prefixes:T.NONE,value:5e-6,offset:0},tablespoon:{name:"tablespoon",base:_.VOLUME,prefixes:T.NONE,value:15e-6,offset:0},drop:{name:"drop",base:_.VOLUME,prefixes:T.NONE,value:5e-8,offset:0},gtt:{name:"gtt",base:_.VOLUME,prefixes:T.NONE,value:5e-8,offset:0},minim:{name:"minim",base:_.VOLUME,prefixes:T.NONE,value:6161152e-14,offset:0},fluiddram:{name:"fluiddram",base:_.VOLUME,prefixes:T.NONE,value:36966911e-13,offset:0},fluidounce:{name:"fluidounce",base:_.VOLUME,prefixes:T.NONE,value:2957353e-11,offset:0},gill:{name:"gill",base:_.VOLUME,prefixes:T.NONE,value:.0001182941,offset:0},cc:{name:"cc",base:_.VOLUME,prefixes:T.NONE,value:1e-6,offset:0},cup:{name:"cup",base:_.VOLUME,prefixes:T.NONE,value:.0002365882,offset:0},pint:{name:"pint",base:_.VOLUME,prefixes:T.NONE,value:.0004731765,offset:0},quart:{name:"quart",base:_.VOLUME,prefixes:T.NONE,value:.0009463529,offset:0},gallon:{name:"gallon",base:_.VOLUME,prefixes:T.NONE,value:.003785412,offset:0},beerbarrel:{name:"beerbarrel",base:_.VOLUME,prefixes:T.NONE,value:.1173478,offset:0},oilbarrel:{name:"oilbarrel",base:_.VOLUME,prefixes:T.NONE,value:.1589873,offset:0},hogshead:{name:"hogshead",base:_.VOLUME,prefixes:T.NONE,value:.238481,offset:0},fldr:{name:"fldr",base:_.VOLUME,prefixes:T.NONE,value:36966911e-13,offset:0},floz:{name:"floz",base:_.VOLUME,prefixes:T.NONE,value:2957353e-11,offset:0},gi:{name:"gi",base:_.VOLUME,prefixes:T.NONE,value:.0001182941,offset:0},cp:{name:"cp",base:_.VOLUME,prefixes:T.NONE,value:.0002365882,offset:0},pt:{name:"pt",base:_.VOLUME,prefixes:T.NONE,value:.0004731765,offset:0},qt:{name:"qt",base:_.VOLUME,prefixes:T.NONE,value:.0009463529,offset:0},gal:{name:"gal",base:_.VOLUME,prefixes:T.NONE,value:.003785412,offset:0},bbl:{name:"bbl",base:_.VOLUME,prefixes:T.NONE,value:.1173478,offset:0},obl:{name:"obl",base:_.VOLUME,prefixes:T.NONE,value:.1589873,offset:0},g:{name:"g",base:_.MASS,prefixes:T.SHORT,value:.001,offset:0},gram:{name:"gram",base:_.MASS,prefixes:T.LONG,value:.001,offset:0},ton:{name:"ton",base:_.MASS,prefixes:T.SHORT,value:907.18474,offset:0},t:{name:"t",base:_.MASS,prefixes:T.SHORT,value:1e3,offset:0},tonne:{name:"tonne",base:_.MASS,prefixes:T.LONG,value:1e3,offset:0},grain:{name:"grain",base:_.MASS,prefixes:T.NONE,value:6479891e-11,offset:0},dram:{name:"dram",base:_.MASS,prefixes:T.NONE,value:.0017718451953125,offset:0},ounce:{name:"ounce",base:_.MASS,prefixes:T.NONE,value:.028349523125,offset:0},poundmass:{name:"poundmass",base:_.MASS,prefixes:T.NONE,value:.45359237,offset:0},hundredweight:{name:"hundredweight",base:_.MASS,prefixes:T.NONE,value:45.359237,offset:0},stick:{name:"stick",base:_.MASS,prefixes:T.NONE,value:.115,offset:0},stone:{name:"stone",base:_.MASS,prefixes:T.NONE,value:6.35029318,offset:0},gr:{name:"gr",base:_.MASS,prefixes:T.NONE,value:6479891e-11,offset:0},dr:{name:"dr",base:_.MASS,prefixes:T.NONE,value:.0017718451953125,offset:0},oz:{name:"oz",base:_.MASS,prefixes:T.NONE,value:.028349523125,offset:0},lbm:{name:"lbm",base:_.MASS,prefixes:T.NONE,value:.45359237,offset:0},cwt:{name:"cwt",base:_.MASS,prefixes:T.NONE,value:45.359237,offset:0},s:{name:"s",base:_.TIME,prefixes:T.SHORT,value:1,offset:0},min:{name:"min",base:_.TIME,prefixes:T.NONE,value:60,offset:0},h:{name:"h",base:_.TIME,prefixes:T.NONE,value:3600,offset:0},second:{name:"second",base:_.TIME,prefixes:T.LONG,value:1,offset:0},sec:{name:"sec",base:_.TIME,prefixes:T.LONG,value:1,offset:0},minute:{name:"minute",base:_.TIME,prefixes:T.NONE,value:60,offset:0},hour:{name:"hour",base:_.TIME,prefixes:T.NONE,value:3600,offset:0},day:{name:"day",base:_.TIME,prefixes:T.NONE,value:86400,offset:0},week:{name:"week",base:_.TIME,prefixes:T.NONE,value:7*86400,offset:0},month:{name:"month",base:_.TIME,prefixes:T.NONE,value:2629800,offset:0},year:{name:"year",base:_.TIME,prefixes:T.NONE,value:31557600,offset:0},decade:{name:"decade",base:_.TIME,prefixes:T.NONE,value:315576e3,offset:0},century:{name:"century",base:_.TIME,prefixes:T.NONE,value:315576e4,offset:0},millennium:{name:"millennium",base:_.TIME,prefixes:T.NONE,value:315576e5,offset:0},hertz:{name:"Hertz",base:_.FREQUENCY,prefixes:T.LONG,value:1,offset:0,reciprocal:!0},Hz:{name:"Hz",base:_.FREQUENCY,prefixes:T.SHORT,value:1,offset:0,reciprocal:!0},rad:{name:"rad",base:_.ANGLE,prefixes:T.SHORT,value:1,offset:0},radian:{name:"radian",base:_.ANGLE,prefixes:T.LONG,value:1,offset:0},deg:{name:"deg",base:_.ANGLE,prefixes:T.SHORT,value:null,offset:0},degree:{name:"degree",base:_.ANGLE,prefixes:T.LONG,value:null,offset:0},grad:{name:"grad",base:_.ANGLE,prefixes:T.SHORT,value:null,offset:0},gradian:{name:"gradian",base:_.ANGLE,prefixes:T.LONG,value:null,offset:0},cycle:{name:"cycle",base:_.ANGLE,prefixes:T.NONE,value:null,offset:0},arcsec:{name:"arcsec",base:_.ANGLE,prefixes:T.NONE,value:null,offset:0},arcmin:{name:"arcmin",base:_.ANGLE,prefixes:T.NONE,value:null,offset:0},A:{name:"A",base:_.CURRENT,prefixes:T.SHORT,value:1,offset:0},ampere:{name:"ampere",base:_.CURRENT,prefixes:T.LONG,value:1,offset:0},K:{name:"K",base:_.TEMPERATURE,prefixes:T.SHORT,value:1,offset:0},degC:{name:"degC",base:_.TEMPERATURE,prefixes:T.SHORT,value:1,offset:273.15},degF:{name:"degF",base:_.TEMPERATURE,prefixes:T.SHORT,value:new A(5,9),offset:459.67},degR:{name:"degR",base:_.TEMPERATURE,prefixes:T.SHORT,value:new A(5,9),offset:0},kelvin:{name:"kelvin",base:_.TEMPERATURE,prefixes:T.LONG,value:1,offset:0},celsius:{name:"celsius",base:_.TEMPERATURE,prefixes:T.LONG,value:1,offset:273.15},fahrenheit:{name:"fahrenheit",base:_.TEMPERATURE,prefixes:T.LONG,value:new A(5,9),offset:459.67},rankine:{name:"rankine",base:_.TEMPERATURE,prefixes:T.LONG,value:new A(5,9),offset:0},mol:{name:"mol",base:_.AMOUNT_OF_SUBSTANCE,prefixes:T.SHORT,value:1,offset:0},mole:{name:"mole",base:_.AMOUNT_OF_SUBSTANCE,prefixes:T.LONG,value:1,offset:0},cd:{name:"cd",base:_.LUMINOUS_INTENSITY,prefixes:T.SHORT,value:1,offset:0},candela:{name:"candela",base:_.LUMINOUS_INTENSITY,prefixes:T.LONG,value:1,offset:0},N:{name:"N",base:_.FORCE,prefixes:T.SHORT,value:1,offset:0},newton:{name:"newton",base:_.FORCE,prefixes:T.LONG,value:1,offset:0},dyn:{name:"dyn",base:_.FORCE,prefixes:T.SHORT,value:1e-5,offset:0},dyne:{name:"dyne",base:_.FORCE,prefixes:T.LONG,value:1e-5,offset:0},lbf:{name:"lbf",base:_.FORCE,prefixes:T.NONE,value:4.4482216152605,offset:0},poundforce:{name:"poundforce",base:_.FORCE,prefixes:T.NONE,value:4.4482216152605,offset:0},kip:{name:"kip",base:_.FORCE,prefixes:T.LONG,value:4448.2216,offset:0},kilogramforce:{name:"kilogramforce",base:_.FORCE,prefixes:T.NONE,value:9.80665,offset:0},J:{name:"J",base:_.ENERGY,prefixes:T.SHORT,value:1,offset:0},joule:{name:"joule",base:_.ENERGY,prefixes:T.LONG,value:1,offset:0},erg:{name:"erg",base:_.ENERGY,prefixes:T.SHORTLONG,value:1e-7,offset:0},Wh:{name:"Wh",base:_.ENERGY,prefixes:T.SHORT,value:3600,offset:0},BTU:{name:"BTU",base:_.ENERGY,prefixes:T.BTU,value:1055.05585262,offset:0},eV:{name:"eV",base:_.ENERGY,prefixes:T.SHORT,value:1602176565e-28,offset:0},electronvolt:{name:"electronvolt",base:_.ENERGY,prefixes:T.LONG,value:1602176565e-28,offset:0},W:{name:"W",base:_.POWER,prefixes:T.SHORT,value:1,offset:0},watt:{name:"watt",base:_.POWER,prefixes:T.LONG,value:1,offset:0},hp:{name:"hp",base:_.POWER,prefixes:T.NONE,value:745.6998715386,offset:0},VAR:{name:"VAR",base:_.POWER,prefixes:T.SHORT,value:m.I,offset:0},VA:{name:"VA",base:_.POWER,prefixes:T.SHORT,value:1,offset:0},Pa:{name:"Pa",base:_.PRESSURE,prefixes:T.SHORT,value:1,offset:0},psi:{name:"psi",base:_.PRESSURE,prefixes:T.NONE,value:6894.75729276459,offset:0},atm:{name:"atm",base:_.PRESSURE,prefixes:T.NONE,value:101325,offset:0},bar:{name:"bar",base:_.PRESSURE,prefixes:T.SHORTLONG,value:1e5,offset:0},torr:{name:"torr",base:_.PRESSURE,prefixes:T.NONE,value:133.322,offset:0},mmHg:{name:"mmHg",base:_.PRESSURE,prefixes:T.NONE,value:133.322,offset:0},mmH2O:{name:"mmH2O",base:_.PRESSURE,prefixes:T.NONE,value:9.80665,offset:0},cmH2O:{name:"cmH2O",base:_.PRESSURE,prefixes:T.NONE,value:98.0665,offset:0},coulomb:{name:"coulomb",base:_.ELECTRIC_CHARGE,prefixes:T.LONG,value:1,offset:0},C:{name:"C",base:_.ELECTRIC_CHARGE,prefixes:T.SHORT,value:1,offset:0},farad:{name:"farad",base:_.ELECTRIC_CAPACITANCE,prefixes:T.LONG,value:1,offset:0},F:{name:"F",base:_.ELECTRIC_CAPACITANCE,prefixes:T.SHORT,value:1,offset:0},volt:{name:"volt",base:_.ELECTRIC_POTENTIAL,prefixes:T.LONG,value:1,offset:0},V:{name:"V",base:_.ELECTRIC_POTENTIAL,prefixes:T.SHORT,value:1,offset:0},ohm:{name:"ohm",base:_.ELECTRIC_RESISTANCE,prefixes:T.SHORTLONG,value:1,offset:0},henry:{name:"henry",base:_.ELECTRIC_INDUCTANCE,prefixes:T.LONG,value:1,offset:0},H:{name:"H",base:_.ELECTRIC_INDUCTANCE,prefixes:T.SHORT,value:1,offset:0},siemens:{name:"siemens",base:_.ELECTRIC_CONDUCTANCE,prefixes:T.LONG,value:1,offset:0},S:{name:"S",base:_.ELECTRIC_CONDUCTANCE,prefixes:T.SHORT,value:1,offset:0},weber:{name:"weber",base:_.MAGNETIC_FLUX,prefixes:T.LONG,value:1,offset:0},Wb:{name:"Wb",base:_.MAGNETIC_FLUX,prefixes:T.SHORT,value:1,offset:0},tesla:{name:"tesla",base:_.MAGNETIC_FLUX_DENSITY,prefixes:T.LONG,value:1,offset:0},T:{name:"T",base:_.MAGNETIC_FLUX_DENSITY,prefixes:T.SHORT,value:1,offset:0},b:{name:"b",base:_.BIT,prefixes:T.BINARY_SHORT,value:1,offset:0},bits:{name:"bits",base:_.BIT,prefixes:T.BINARY_LONG,value:1,offset:0},B:{name:"B",base:_.BIT,prefixes:T.BINARY_SHORT,value:8,offset:0},bytes:{name:"bytes",base:_.BIT,prefixes:T.BINARY_LONG,value:8,offset:0}},fe={meters:"meter",inches:"inch",feet:"foot",yards:"yard",miles:"mile",links:"link",rods:"rod",chains:"chain",angstroms:"angstrom",lt:"l",litres:"litre",liter:"litre",liters:"litre",teaspoons:"teaspoon",tablespoons:"tablespoon",minims:"minim",fluiddrams:"fluiddram",fluidounces:"fluidounce",gills:"gill",cups:"cup",pints:"pint",quarts:"quart",gallons:"gallon",beerbarrels:"beerbarrel",oilbarrels:"oilbarrel",hogsheads:"hogshead",gtts:"gtt",grams:"gram",tons:"ton",tonnes:"tonne",grains:"grain",drams:"dram",ounces:"ounce",poundmasses:"poundmass",hundredweights:"hundredweight",sticks:"stick",lb:"lbm",lbs:"lbm",kips:"kip",kgf:"kilogramforce",acres:"acre",hectares:"hectare",sqfeet:"sqft",sqyard:"sqyd",sqmile:"sqmi",sqmiles:"sqmi",mmhg:"mmHg",mmh2o:"mmH2O",cmh2o:"cmH2O",seconds:"second",secs:"second",minutes:"minute",mins:"minute",hours:"hour",hr:"hour",hrs:"hour",days:"day",weeks:"week",months:"month",years:"year",decades:"decade",centuries:"century",millennia:"millennium",hertz:"hertz",radians:"radian",degrees:"degree",gradians:"gradian",cycles:"cycle",arcsecond:"arcsec",arcseconds:"arcsec",arcminute:"arcmin",arcminutes:"arcmin",BTUs:"BTU",watts:"watt",joules:"joule",amperes:"ampere",amps:"ampere",amp:"ampere",coulombs:"coulomb",volts:"volt",ohms:"ohm",farads:"farad",webers:"weber",teslas:"tesla",electronvolts:"electronvolt",moles:"mole",bit:"bits",byte:"bytes"};function Ie(U){if(U.number==="BigNumber"){var R=K6(g);Q.rad.value=new g(1),Q.deg.value=R.div(180),Q.grad.value=R.div(200),Q.cycle.value=R.times(2),Q.arcsec.value=R.div(648e3),Q.arcmin.value=R.div(10800)}else Q.rad.value=1,Q.deg.value=Math.PI/180,Q.grad.value=Math.PI/200,Q.cycle.value=Math.PI*2,Q.arcsec.value=Math.PI/648e3,Q.arcmin.value=Math.PI/10800;Q.radian.value=Q.rad.value,Q.degree.value=Q.deg.value,Q.gradian.value=Q.grad.value}Ie(r),t&&t("config",function(U,R){U.number!==R.number&&Ie(U)});var Se={si:{NONE:{unit:te,prefix:T.NONE[""]},LENGTH:{unit:Q.m,prefix:T.SHORT[""]},MASS:{unit:Q.g,prefix:T.SHORT.k},TIME:{unit:Q.s,prefix:T.SHORT[""]},CURRENT:{unit:Q.A,prefix:T.SHORT[""]},TEMPERATURE:{unit:Q.K,prefix:T.SHORT[""]},LUMINOUS_INTENSITY:{unit:Q.cd,prefix:T.SHORT[""]},AMOUNT_OF_SUBSTANCE:{unit:Q.mol,prefix:T.SHORT[""]},ANGLE:{unit:Q.rad,prefix:T.SHORT[""]},BIT:{unit:Q.bits,prefix:T.SHORT[""]},FORCE:{unit:Q.N,prefix:T.SHORT[""]},ENERGY:{unit:Q.J,prefix:T.SHORT[""]},POWER:{unit:Q.W,prefix:T.SHORT[""]},PRESSURE:{unit:Q.Pa,prefix:T.SHORT[""]},ELECTRIC_CHARGE:{unit:Q.C,prefix:T.SHORT[""]},ELECTRIC_CAPACITANCE:{unit:Q.F,prefix:T.SHORT[""]},ELECTRIC_POTENTIAL:{unit:Q.V,prefix:T.SHORT[""]},ELECTRIC_RESISTANCE:{unit:Q.ohm,prefix:T.SHORT[""]},ELECTRIC_INDUCTANCE:{unit:Q.H,prefix:T.SHORT[""]},ELECTRIC_CONDUCTANCE:{unit:Q.S,prefix:T.SHORT[""]},MAGNETIC_FLUX:{unit:Q.Wb,prefix:T.SHORT[""]},MAGNETIC_FLUX_DENSITY:{unit:Q.T,prefix:T.SHORT[""]},FREQUENCY:{unit:Q.Hz,prefix:T.SHORT[""]}}};Se.cgs=JSON.parse(JSON.stringify(Se.si)),Se.cgs.LENGTH={unit:Q.m,prefix:T.SHORT.c},Se.cgs.MASS={unit:Q.g,prefix:T.SHORT[""]},Se.cgs.FORCE={unit:Q.dyn,prefix:T.SHORT[""]},Se.cgs.ENERGY={unit:Q.erg,prefix:T.NONE[""]},Se.us=JSON.parse(JSON.stringify(Se.si)),Se.us.LENGTH={unit:Q.ft,prefix:T.NONE[""]},Se.us.MASS={unit:Q.lbm,prefix:T.NONE[""]},Se.us.TEMPERATURE={unit:Q.degF,prefix:T.NONE[""]},Se.us.FORCE={unit:Q.lbf,prefix:T.NONE[""]},Se.us.ENERGY={unit:Q.BTU,prefix:T.BTU[""]},Se.us.POWER={unit:Q.hp,prefix:T.NONE[""]},Se.us.PRESSURE={unit:Q.psi,prefix:T.NONE[""]},Se.auto=JSON.parse(JSON.stringify(Se.si));var Oe=Se.auto;v.setUnitSystem=function(U){if(Et(Se,U))Oe=Se[U];else throw new Error("Unit system "+U+" does not exist. Choices are: "+Object.keys(Se).join(", "))},v.getUnitSystem=function(){for(var U in Se)if(Et(Se,U)&&Se[U]===Oe)return U},v.typeConverters={BigNumber:function(R){return R!=null&&R.isFraction?new g(R.n).div(R.d).times(R.s):new g(R+"")},Fraction:function(R){return new A(R)},Complex:function(R){return R},number:function(R){return R!=null&&R.isFraction?h(R):R}},v.prototype._numberConverter=function(){var U=v.typeConverters[this.valueType()];if(U)return U;throw new TypeError('Unsupported Unit value type "'+this.valueType()+'"')},v._getNumberConverter=function(U){if(!v.typeConverters[U])throw new TypeError('Unsupported type "'+U+'"');return v.typeConverters[U]};for(var ve in Q)if(Et(Q,ve)){var ye=Q[ve];ye.dimensions=ye.base.dimensions}for(var me in fe)if(Et(fe,me)){var ke=Q[fe[me]],$={};for(var ae in ke)Et(ke,ae)&&($[ae]=ke[ae]);$.name=me,Q[me]=$}v.isValidAlpha=function(R){return/^[a-zA-Z]$/.test(R)};function ce(U){for(var R=0;R0&&!(v.isValidAlpha(S)||O(S)))throw new Error('Invalid unit name (only alphanumeric characters are allowed): "'+U+'"')}}return v.createUnit=function(U,R){if(typeof U!="object")throw new TypeError("createUnit expects first parameter to be of type 'Object'");if(R&&R.override){for(var J in U)if(Et(U,J)&&v.deleteUnit(J),U[J].aliases)for(var ee=0;ee"u"||R===null)&&(R={}),typeof U!="string")throw new TypeError("createUnitSingle expects first parameter to be of type 'string'");if(Et(Q,U))throw new Error('Cannot create unit "'+U+'": a unit with that name already exists');ce(U);var J=null,ee=[],ie=0,re,Ee,Ce;if(R&&R.type==="Unit")J=R.clone();else if(typeof R=="string")R!==""&&(re=R);else if(typeof R=="object")re=R.definition,Ee=R.prefixes,ie=R.offset,Ce=R.baseName,R.aliases&&(ee=R.aliases.valueOf());else throw new TypeError('Cannot create unit "'+U+'" from "'+R.toString()+'": expecting "string" or "Unit" or "Object"');if(ee){for(var _e=0;_e1e-12){Be=!1;break}if(Be){Ct=!0,he.base=_[we];break}}if(!Ct){Ce=Ce||U+"_STUFF";var Ze={dimensions:J.dimensions.slice(0)};Ze.key=Ce,_[Ce]=Ze,Oe[Ce]={unit:he,prefix:T.NONE[""]},he.base=_[Ce]}}else{if(Ce=Ce||U+"_STUFF",L.indexOf(Ce)>=0)throw new Error('Cannot create new base unit "'+U+'": a base unit with that name already exists (and cannot be overridden)');L.push(Ce);for(var ze in _)Et(_,ze)&&(_[ze].dimensions[L.length-1]=0);for(var Ye={dimensions:[]},tt=0;tt{var{typed:t,Unit:r}=e;return t(xce,{Unit:function(i){return i.clone()},string:function(i){return r.isValuelessUnit(i)?new r(null,i):r.parse(i,{allowNoUnits:!0})},"number | BigNumber | Fraction | Complex, string | Unit":function(i,a){return new r(i,a)},"number | BigNumber | Fraction":function(i){return new r(i)},"Array | Matrix":t.referToSelf(n=>i=>jt(i,n))})});var wce="sparse",rze=["typed","SparseMatrix"],d_=V(wce,rze,e=>{var{typed:t,SparseMatrix:r}=e;return t(wce,{"":function(){return new r([])},string:function(i){return new r([],i)},"Array | Matrix":function(i){return new r(i)},"Array | Matrix, string":function(i,a){return new r(i,a)}})});var Sce="createUnit",nze=["typed","Unit"],p_=V(Sce,nze,e=>{var{typed:t,Unit:r}=e;return t(Sce,{"Object, Object":function(i,a){return r.createUnit(i,a)},Object:function(i){return r.createUnit(i,{})},"string, Unit | string | Object, Object":function(i,a,o){var s={};return s[i]=a,r.createUnit(s,o)},"string, Unit | string | Object":function(i,a){var o={};return o[i]=a,r.createUnit(o,{})},string:function(i){var a={};return a[i]={},r.createUnit(a,{})}})});var Ece="acos",ize=["typed","config","Complex"],m_=V(Ece,ize,e=>{var{typed:t,config:r,Complex:n}=e;return t(Ece,{number:function(a){return a>=-1&&a<=1||r.predictable?Math.acos(a):new n(a,0).acos()},Complex:function(a){return a.acos()},BigNumber:function(a){return a.acos()}})});var kce="acosh",aze=["typed","config","Complex"],h_=V(kce,aze,e=>{var{typed:t,config:r,Complex:n}=e;return t(kce,{number:function(a){return a>=1||r.predictable?JW(a):a<=-1?new n(Math.log(Math.sqrt(a*a-1)-a),Math.PI):new n(a,0).acosh()},Complex:function(a){return a.acosh()},BigNumber:function(a){return a.acosh()}})});var Cce="acot",oze=["typed","BigNumber"],A_=V(Cce,oze,e=>{var{typed:t,BigNumber:r}=e;return t(Cce,{number:eH,Complex:function(i){return i.acot()},BigNumber:function(i){return new r(1).div(i).atan()}})});var Dce="acoth",sze=["typed","config","Complex","BigNumber"],g_=V(Dce,sze,e=>{var{typed:t,config:r,Complex:n,BigNumber:i}=e;return t(Dce,{number:function(o){return o>=1||o<=-1||r.predictable?tH(o):new n(o,0).acoth()},Complex:function(o){return o.acoth()},BigNumber:function(o){return new i(1).div(o).atanh()}})});var Oce="acsc",lze=["typed","config","Complex","BigNumber"],v_=V(Oce,lze,e=>{var{typed:t,config:r,Complex:n,BigNumber:i}=e;return t(Oce,{number:function(o){return o<=-1||o>=1||r.predictable?rH(o):new n(o,0).acsc()},Complex:function(o){return o.acsc()},BigNumber:function(o){return new i(1).div(o).asin()}})});var Mce="acsch",uze=["typed","BigNumber"],y_=V(Mce,uze,e=>{var{typed:t,BigNumber:r}=e;return t(Mce,{number:nH,Complex:function(i){return i.acsch()},BigNumber:function(i){return new r(1).div(i).asinh()}})});var jce="asec",cze=["typed","config","Complex","BigNumber"],b_=V(jce,cze,e=>{var{typed:t,config:r,Complex:n,BigNumber:i}=e;return t(jce,{number:function(o){return o<=-1||o>=1||r.predictable?iH(o):new n(o,0).asec()},Complex:function(o){return o.asec()},BigNumber:function(o){return new i(1).div(o).acos()}})});var Nce="asech",fze=["typed","config","Complex","BigNumber"],x_=V(Nce,fze,e=>{var{typed:t,config:r,Complex:n,BigNumber:i}=e;return t(Nce,{number:function(o){if(o<=1&&o>=-1||r.predictable){var s=1/o;if(s>0||r.predictable)return aH(o);var l=Math.sqrt(s*s-1);return new n(Math.log(l-s),Math.PI)}return new n(o,0).asech()},Complex:function(o){return o.asech()},BigNumber:function(o){return new i(1).div(o).acosh()}})});var Tce="asin",dze=["typed","config","Complex"],w_=V(Tce,dze,e=>{var{typed:t,config:r,Complex:n}=e;return t(Tce,{number:function(a){return a>=-1&&a<=1||r.predictable?Math.asin(a):new n(a,0).asin()},Complex:function(a){return a.asin()},BigNumber:function(a){return a.asin()}})});var pze="asinh",mze=["typed"],S_=V(pze,mze,e=>{var{typed:t}=e;return t("asinh",{number:oH,Complex:function(n){return n.asinh()},BigNumber:function(n){return n.asinh()}})});var hze="atan",Aze=["typed"],E_=V(hze,Aze,e=>{var{typed:t}=e;return t("atan",{number:function(n){return Math.atan(n)},Complex:function(n){return n.atan()},BigNumber:function(n){return n.atan()}})});var Fce="atan2",gze=["typed","matrix","equalScalar","BigNumber","DenseMatrix","concat"],k_=V(Fce,gze,e=>{var{typed:t,matrix:r,equalScalar:n,BigNumber:i,DenseMatrix:a,concat:o}=e,s=yo({typed:t,equalScalar:n}),l=xi({typed:t}),u=jF({typed:t,equalScalar:n}),c=Gn({typed:t,equalScalar:n}),f=An({typed:t,DenseMatrix:a}),d=fr({typed:t,matrix:r,concat:o});return t(Fce,{"number, number":Math.atan2,"BigNumber, BigNumber":(p,h)=>i.atan2(p,h)},d({scalar:"number | BigNumber",SS:u,DS:l,SD:s,Ss:c,sS:f}))});var _ce="atanh",vze=["typed","config","Complex"],C_=V(_ce,vze,e=>{var{typed:t,config:r,Complex:n}=e;return t(_ce,{number:function(a){return a<=1&&a>=-1||r.predictable?sH(a):new n(a,0).atanh()},Complex:function(a){return a.atanh()},BigNumber:function(a){return a.atanh()}})});var Md=V("trigUnit",["typed"],e=>{var{typed:t}=e;return{Unit:t.referToSelf(r=>n=>{if(!n.hasBase(n.constructor.BASE_UNITS.ANGLE))throw new TypeError("Unit in function cot is no angle");return t.find(r,n.valueType())(n.value)})}});var Pce="cos",yze=["typed"],D_=V(Pce,yze,e=>{var{typed:t}=e,r=Md({typed:t});return t(Pce,{number:Math.cos,"Complex | BigNumber":n=>n.cos()},r)});var Ice="cosh",bze=["typed"],O_=V(Ice,bze,e=>{var{typed:t}=e;return t(Ice,{number:cT,"Complex | BigNumber":r=>r.cosh()})});var Bce="cot",xze=["typed","BigNumber"],M_=V(Bce,xze,e=>{var{typed:t,BigNumber:r}=e,n=Md({typed:t});return t(Bce,{number:lH,Complex:i=>i.cot(),BigNumber:i=>new r(1).div(i.tan())},n)});var Rce="coth",wze=["typed","BigNumber"],j_=V(Rce,wze,e=>{var{typed:t,BigNumber:r}=e;return t(Rce,{number:uH,Complex:n=>n.coth(),BigNumber:n=>new r(1).div(n.tanh())})});var $ce="csc",Sze=["typed","BigNumber"],N_=V($ce,Sze,e=>{var{typed:t,BigNumber:r}=e,n=Md({typed:t});return t($ce,{number:cH,Complex:i=>i.csc(),BigNumber:i=>new r(1).div(i.sin())},n)});var qce="csch",Eze=["typed","BigNumber"],T_=V(qce,Eze,e=>{var{typed:t,BigNumber:r}=e;return t(qce,{number:fH,Complex:n=>n.csch(),BigNumber:n=>new r(1).div(n.sinh())})});var Lce="sec",kze=["typed","BigNumber"],F_=V(Lce,kze,e=>{var{typed:t,BigNumber:r}=e,n=Md({typed:t});return t(Lce,{number:dH,Complex:i=>i.sec(),BigNumber:i=>new r(1).div(i.cos())},n)});var zce="sech",Cze=["typed","BigNumber"],__=V(zce,Cze,e=>{var{typed:t,BigNumber:r}=e;return t(zce,{number:pH,Complex:n=>n.sech(),BigNumber:n=>new r(1).div(n.cosh())})});var Uce="sin",Dze=["typed"],P_=V(Uce,Dze,e=>{var{typed:t}=e,r=Md({typed:t});return t(Uce,{number:Math.sin,"Complex | BigNumber":n=>n.sin()},r)});var Wce="sinh",Oze=["typed"],I_=V(Wce,Oze,e=>{var{typed:t}=e;return t(Wce,{number:mH,"Complex | BigNumber":r=>r.sinh()})});var Hce="tan",Mze=["typed"],B_=V(Hce,Mze,e=>{var{typed:t}=e,r=Md({typed:t});return t(Hce,{number:Math.tan,"Complex | BigNumber":n=>n.tan()},r)});var jze="tanh",Nze=["typed"],R_=V(jze,Nze,e=>{var{typed:t}=e;return t("tanh",{number:fT,"Complex | BigNumber":r=>r.tanh()})});var Vce="setCartesian",Tze=["typed","size","subset","compareNatural","Index","DenseMatrix"],$_=V(Vce,Tze,e=>{var{typed:t,size:r,subset:n,compareNatural:i,Index:a,DenseMatrix:o}=e;return t(Vce,{"Array | Matrix, Array | Matrix":function(l,u){var c=[];if(n(r(l),new a(0))!==0&&n(r(u),new a(0))!==0){var f=mr(Array.isArray(l)?l:l.toArray()).sort(i),d=mr(Array.isArray(u)?u:u.toArray()).sort(i);c=[];for(var p=0;p{var{typed:t,size:r,subset:n,compareNatural:i,Index:a,DenseMatrix:o}=e;return t(Gce,{"Array | Matrix, Array | Matrix":function(l,u){var c;if(n(r(l),new a(0))===0)c=[];else{if(n(r(u),new a(0))===0)return mr(l.toArray());var f=LA(mr(Array.isArray(l)?l:l.toArray()).sort(i)),d=LA(mr(Array.isArray(u)?u:u.toArray()).sort(i));c=[];for(var p,h=0;h{var{typed:t,size:r,subset:n,compareNatural:i,Index:a,DenseMatrix:o}=e;return t(Qce,{"Array | Matrix":function(l){var u;if(n(r(l),new a(0))===0)u=[];else{var c=mr(Array.isArray(l)?l:l.toArray()).sort(i);u=[],u.push(c[0]);for(var f=1;f{var{typed:t,size:r,subset:n,compareNatural:i,Index:a,DenseMatrix:o}=e;return t(Yce,{"Array | Matrix, Array | Matrix":function(l,u){var c;if(n(r(l),new a(0))===0||n(r(u),new a(0))===0)c=[];else{var f=LA(mr(Array.isArray(l)?l:l.toArray()).sort(i)),d=LA(mr(Array.isArray(u)?u:u.toArray()).sort(i));c=[];for(var p=0;p{var{typed:t,size:r,subset:n,compareNatural:i,Index:a}=e;return t(Zce,{"Array | Matrix, Array | Matrix":function(s,l){if(n(r(s),new a(0))===0)return!0;if(n(r(l),new a(0))===0)return!1;for(var u=LA(mr(Array.isArray(s)?s:s.toArray()).sort(i)),c=LA(mr(Array.isArray(l)?l:l.toArray()).sort(i)),f,d=0;d{var{typed:t,size:r,subset:n,compareNatural:i,Index:a}=e;return t(Xce,{"number | BigNumber | Fraction | Complex, Array | Matrix":function(s,l){if(n(r(l),new a(0))===0)return 0;for(var u=mr(Array.isArray(l)?l:l.toArray()),c=0,f=0;f{var{typed:t,size:r,subset:n,compareNatural:i,Index:a}=e;return t(Kce,{"Array | Matrix":function(u){if(n(r(u),new a(0))===0)return[];for(var c=mr(Array.isArray(u)?u:u.toArray()).sort(i),f=[],d=0;d.toString(2).length<=c.length;)f.push(o(c,d.toString(2).split("").reverse())),d++;return s(f)}});function o(l,u){for(var c=[],f=0;f0;c--)for(var f=0;fl[f+1].length&&(u=l[f],l[f]=l[f+1],l[f+1]=u);return l}});var Jce="setSize",$ze=["typed","compareNatural"],V_=V(Jce,$ze,e=>{var{typed:t,compareNatural:r}=e;return t(Jce,{"Array | Matrix":function(i){return Array.isArray(i)?mr(i).length:mr(i.toArray()).length},"Array | Matrix, boolean":function(i,a){if(a===!1||i.length===0)return Array.isArray(i)?mr(i).length:mr(i.toArray()).length;for(var o=mr(Array.isArray(i)?i:i.toArray()).sort(r),s=1,l=1;l{var{typed:t,size:r,concat:n,subset:i,setDifference:a,Index:o}=e;return t(efe,{"Array | Matrix, Array | Matrix":function(l,u){if(i(r(l),new o(0))===0)return mr(u);if(i(r(u),new o(0))===0)return mr(l);var c=mr(l),f=mr(u);return n(a(c,f),a(f,c))}})});var tfe="setUnion",Lze=["typed","size","concat","subset","setIntersect","setSymDifference","Index"],Q_=V(tfe,Lze,e=>{var{typed:t,size:r,concat:n,subset:i,setIntersect:a,setSymDifference:o,Index:s}=e;return t(tfe,{"Array | Matrix, Array | Matrix":function(u,c){if(i(r(u),new s(0))===0)return mr(c);if(i(r(c),new s(0))===0)return mr(u);var f=mr(u),d=mr(c);return n(o(f,d),a(f,d))}})});var rfe="add",zze=["typed","matrix","addScalar","equalScalar","DenseMatrix","SparseMatrix","concat"],Y_=V(rfe,zze,e=>{var{typed:t,matrix:r,addScalar:n,equalScalar:i,DenseMatrix:a,SparseMatrix:o,concat:s}=e,l=ou({typed:t}),u=aS({typed:t,equalScalar:i}),c=Dc({typed:t,DenseMatrix:a}),f=fr({typed:t,matrix:r,concat:s});return t(rfe,{"any, any":n,"any, any, ...any":t.referToSelf(d=>(p,h,m)=>{for(var g=d(p,h),A=0;A{var{typed:t,abs:r,addScalar:n,divideScalar:i,multiplyScalar:a,sqrt:o,smaller:s,isPositive:l}=e;return t(nfe,{"... number | BigNumber":u,Array:u,Matrix:c=>u(mr(c.toArray()))});function u(c){for(var f=0,d=0,p=0;p{var{typed:t,abs:r,add:n,pow:i,conj:a,sqrt:o,multiply:s,equalScalar:l,larger:u,smaller:c,matrix:f,ctranspose:d,eigs:p}=e;return t(ife,{number:Math.abs,Complex:function(j){return j.abs()},BigNumber:function(j){return j.abs()},boolean:function(j){return Math.abs(j)},Array:function(j){return S(f(j),2)},Matrix:function(j){return S(j,2)},"Array, number | BigNumber | string":function(j,O){return S(f(j),O)},"Matrix, number | BigNumber | string":function(j,O){return S(j,O)}});function h(k){var j=0;return k.forEach(function(O){var C=r(O);u(C,j)&&(j=C)},!0),j}function m(k){var j;return k.forEach(function(O){var C=r(O);(!j||c(C,j))&&(j=C)},!0),j||0}function g(k,j){if(j===Number.POSITIVE_INFINITY||j==="inf")return h(k);if(j===Number.NEGATIVE_INFINITY||j==="-inf")return m(k);if(j==="fro")return S(k,2);if(typeof j=="number"&&!isNaN(j)){if(!l(j,0)){var O=0;return k.forEach(function(C){O=n(i(r(C),j),O)},!0),i(O,1/j)}return Number.POSITIVE_INFINITY}throw new Error("Unsupported parameter value")}function A(k){var j=0;return k.forEach(function(O,C){j=n(j,s(O,a(O)))}),r(o(j))}function b(k){var j=[],O=0;return k.forEach(function(C,N){var D=N[1],P=n(j[D]||0,r(C));u(P,O)&&(O=P),j[D]=P},!0),O}function v(k){var j=k.size();if(j[0]!==j[1])throw new RangeError("Invalid matrix dimensions");var O=d(k),C=s(O,k),N=p(C).values.toArray(),D=N[N.length-1];return r(o(D))}function x(k){var j=[],O=0;return k.forEach(function(C,N){var D=N[0],P=n(j[D]||0,r(C));u(P,O)&&(O=P),j[D]=P},!0),O}function w(k,j){if(j===1)return b(k);if(j===Number.POSITIVE_INFINITY||j==="inf")return x(k);if(j==="fro")return A(k);if(j===2)return v(k);throw new Error("Unsupported parameter value "+j)}function S(k,j){var O=k.size();if(O.length===1)return g(k,j);if(O.length===2){if(O[0]&&O[1])return w(k,j);throw new RangeError("Invalid matrix dimensions")}}});var afe="dot",Hze=["typed","addScalar","multiplyScalar","conj","size"],K_=V(afe,Hze,e=>{var{typed:t,addScalar:r,multiplyScalar:n,conj:i,size:a}=e;return t(afe,{"Array | DenseMatrix, Array | DenseMatrix":s,"SparseMatrix, SparseMatrix":l});function o(c,f){var d=u(c),p=u(f),h,m;if(d.length===1)h=d[0];else if(d.length===2&&d[1]===1)h=d[0];else throw new RangeError("Expected a column vector, instead got a matrix of size ("+d.join(", ")+")");if(p.length===1)m=p[0];else if(p.length===2&&p[1]===1)m=p[0];else throw new RangeError("Expected a column vector, instead got a matrix of size ("+p.join(", ")+")");if(h!==m)throw new RangeError("Vectors must have equal length ("+h+" != "+m+")");if(h===0)throw new RangeError("Cannot calculate the dot product of empty vectors");return h}function s(c,f){var d=o(c,f),p=St(c)?c._data:c,h=St(c)?c._datatype||c.getDataType():void 0,m=St(f)?f._data:f,g=St(f)?f._datatype||f.getDataType():void 0,A=u(c).length===2,b=u(f).length===2,v=r,x=n;if(h&&g&&h===g&&typeof h=="string"&&h!=="mixed"){var w=h;v=t.find(r,[w,w]),x=t.find(n,[w,w])}if(!A&&!b){for(var S=x(i(p[0]),m[0]),k=1;kS){x++;continue}w===S&&(g=A(g,b(p[v],m[x])),v++,x++)}return g}function u(c){return St(c)?c.size():a(c)}});var Vze="trace",Gze=["typed","matrix","add"],J_=V(Vze,Gze,e=>{var{typed:t,matrix:r,add:n}=e;return t("trace",{Array:function(s){return i(r(s))},SparseMatrix:a,DenseMatrix:i,any:Bt});function i(o){var s=o._size,l=o._data;switch(s.length){case 1:if(s[0]===1)return Bt(l[0]);throw new RangeError("Matrix must be square (size: "+tr(s)+")");case 2:{var u=s[0],c=s[1];if(u===c){for(var f=0,d=0;d0)for(var h=0;hh)break}return p}throw new RangeError("Matrix must be square (size: "+tr(c)+")")}});var ofe="index",Qze=["typed","Index"],e4=V(ofe,Qze,e=>{var{typed:t,Index:r}=e;return t(ofe,{"...number | string | BigNumber | Range | Array | Matrix":function(i){var a=i.map(function(s){return It(s)?s.toNumber():Ir(s)||St(s)?s.map(function(l){return It(l)?l.toNumber():l}):s}),o=new r;return r.apply(o,a),o}})});var t4=new Set(["end"]);var Yze="Node",Zze=["mathWithTransform"],r4=V(Yze,Zze,e=>{var{mathWithTransform:t}=e;function r(i){for(var a of[...t4])if(i.has(a))throw new Error('Scope contains an illegal symbol, "'+a+'" is a reserved keyword')}class n{get type(){return"Node"}get isNode(){return!0}evaluate(a){return this.compile().evaluate(a)}compile(){var a=this._compile(t,{}),o={},s=null;function l(u){var c=zA(u);return r(c),a(c,o,s)}return{evaluate:l}}_compile(a,o){throw new Error("Method _compile must be implemented by type "+this.type)}forEach(a){throw new Error("Cannot run forEach on a Node interface")}map(a){throw new Error("Cannot run map on a Node interface")}_ifNode(a){if(!Nr(a))throw new TypeError("Callback function must return a Node");return a}traverse(a){a(this,null,null);function o(s,l){s.forEach(function(u,c,f){l(u,c,f),o(u,l)})}o(this,a)}transform(a){function o(s,l,u){var c=a(s,l,u);return c!==s?c:s.map(o)}return o(this,null,null)}filter(a){var o=[];return this.traverse(function(s,l,u){a(s,l,u)&&o.push(s)}),o}clone(){throw new Error("Cannot clone a Node interface")}cloneDeep(){return this.map(function(a){return a.cloneDeep()})}equals(a){return a?this.type===a.type&&Ip(this,a):!1}toString(a){var o=this._getCustomString(a);return typeof o<"u"?o:this._toString(a)}_toString(){throw new Error("_toString not implemented for "+this.type)}toJSON(){throw new Error("Cannot serialize object: toJSON not implemented by "+this.type)}toHTML(a){var o=this._getCustomString(a);return typeof o<"u"?o:this._toHTML(a)}_toHTML(){throw new Error("_toHTML not implemented for "+this.type)}toTex(a){var o=this._getCustomString(a);return typeof o<"u"?o:this._toTex(a)}_toTex(a){throw new Error("_toTex not implemented for "+this.type)}_getCustomString(a){if(a&&typeof a=="object")switch(typeof a.handler){case"object":case"undefined":return;case"function":return a.handler(this,a);default:throw new TypeError("Object or function expected as callback")}}getIdentifier(){return this.type}getContent(){return this}}return n},{isClass:!0,isNode:!0});function wi(e){return e&&e.isIndexError?new As(e.index+1,e.min+1,e.max!==void 0?e.max+1:void 0):e}function n4(e){var{subset:t}=e;return function(n,i){try{if(Array.isArray(n))return t(n,i);if(n&&typeof n.subset=="function")return n.subset(i);if(typeof n=="string")return t(n,i);if(typeof n=="object"){if(!i.isObjectProperty())throw new TypeError("Cannot apply a numeric index as object property");return Zi(n,i.getObjectProperty())}else throw new TypeError("Cannot apply index: unsupported type of object")}catch(a){throw wi(a)}}}var i4="AccessorNode",Xze=["subset","Node"],a4=V(i4,Xze,e=>{var{subset:t,Node:r}=e,n=n4({subset:t});function i(o){return!(Uu(o)||ps(o)||gr(o)||xl(o)||Vm(o)||ms(o)||ri(o))}class a extends r{constructor(s,l){if(super(),!Nr(s))throw new TypeError('Node expected for parameter "object"');if(!Sc(l))throw new TypeError('IndexNode expected for parameter "index"');this.object=s,this.index=l}get name(){return this.index?this.index.isObjectProperty()?this.index.getObjectProperty():"":this.object.name||""}get type(){return i4}get isAccessorNode(){return!0}_compile(s,l){var u=this.object._compile(s,l),c=this.index._compile(s,l);if(this.index.isObjectProperty()){var f=this.index.getObjectProperty();return function(p,h,m){return Zi(u(p,h,m),f)}}else return function(p,h,m){var g=u(p,h,m),A=c(p,h,g);return n(g,A)}}forEach(s){s(this.object,"object",this),s(this.index,"index",this)}map(s){return new a(this._ifNode(s(this.object,"object",this)),this._ifNode(s(this.index,"index",this)))}clone(){return new a(this.object,this.index)}_toString(s){var l=this.object.toString(s);return i(this.object)&&(l="("+l+")"),l+this.index.toString(s)}_toHTML(s){var l=this.object.toHTML(s);return i(this.object)&&(l='('+l+')'),l+this.index.toHTML(s)}_toTex(s){var l=this.object.toTex(s);return i(this.object)&&(l="\\left(' + object + '\\right)"),l+this.index.toTex(s)}toJSON(){return{mathjs:i4,object:this.object,index:this.index}}static fromJSON(s){return new a(s.object,s.index)}}return yn(a,"name",i4),a},{isClass:!0,isNode:!0});var o4="ArrayNode",Kze=["Node"],s4=V(o4,Kze,e=>{var{Node:t}=e;class r extends t{constructor(i){if(super(),this.items=i||[],!Array.isArray(this.items)||!this.items.every(Nr))throw new TypeError("Array containing Nodes expected")}get type(){return o4}get isArrayNode(){return!0}_compile(i,a){var o=Ec(this.items,function(u){return u._compile(i,a)}),s=i.config.matrix!=="Array";if(s){var l=i.matrix;return function(c,f,d){return l(Ec(o,function(p){return p(c,f,d)}))}}else return function(c,f,d){return Ec(o,function(p){return p(c,f,d)})}}forEach(i){for(var a=0;a['+a.join(',')+']'}_toTex(i){function a(o,s){var l=o.some(ps)&&!o.every(ps),u=s||l,c=u?"&":"\\\\",f=o.map(function(d){return d.items?a(d.items,!s):d.toTex(i)}).join(c);return l||!u||u&&!s?"\\begin{bmatrix}"+f+"\\end{bmatrix}":f}return a(this.items,!1)}}return yn(r,"name",o4),r},{isClass:!0,isNode:!0});function sfe(e){var{subset:t,matrix:r}=e;return function(i,a,o){try{if(Array.isArray(i)){var s=r(i).subset(a,o).valueOf();return s.forEach((l,u)=>{i[u]=l}),i}else{if(i&&typeof i.subset=="function")return i.subset(a,o);if(typeof i=="string")return t(i,a,o);if(typeof i=="object"){if(!a.isObjectProperty())throw TypeError("Cannot apply a numeric index as object property");return Gm(i,a.getObjectProperty(),o),i}else throw new TypeError("Cannot apply index: unsupported type of object")}}catch(l){throw wi(l)}}}var jd=[{AssignmentNode:{},FunctionAssignmentNode:{}},{ConditionalNode:{latexLeftParens:!1,latexRightParens:!1,latexParens:!1}},{"OperatorNode:or":{op:"or",associativity:"left",associativeWith:[]}},{"OperatorNode:xor":{op:"xor",associativity:"left",associativeWith:[]}},{"OperatorNode:and":{op:"and",associativity:"left",associativeWith:[]}},{"OperatorNode:bitOr":{op:"|",associativity:"left",associativeWith:[]}},{"OperatorNode:bitXor":{op:"^|",associativity:"left",associativeWith:[]}},{"OperatorNode:bitAnd":{op:"&",associativity:"left",associativeWith:[]}},{"OperatorNode:equal":{op:"==",associativity:"left",associativeWith:[]},"OperatorNode:unequal":{op:"!=",associativity:"left",associativeWith:[]},"OperatorNode:smaller":{op:"<",associativity:"left",associativeWith:[]},"OperatorNode:larger":{op:">",associativity:"left",associativeWith:[]},"OperatorNode:smallerEq":{op:"<=",associativity:"left",associativeWith:[]},"OperatorNode:largerEq":{op:">=",associativity:"left",associativeWith:[]},RelationalNode:{associativity:"left",associativeWith:[]}},{"OperatorNode:leftShift":{op:"<<",associativity:"left",associativeWith:[]},"OperatorNode:rightArithShift":{op:">>",associativity:"left",associativeWith:[]},"OperatorNode:rightLogShift":{op:">>>",associativity:"left",associativeWith:[]}},{"OperatorNode:to":{op:"to",associativity:"left",associativeWith:[]}},{RangeNode:{}},{"OperatorNode:add":{op:"+",associativity:"left",associativeWith:["OperatorNode:add","OperatorNode:subtract"]},"OperatorNode:subtract":{op:"-",associativity:"left",associativeWith:[]}},{"OperatorNode:multiply":{op:"*",associativity:"left",associativeWith:["OperatorNode:multiply","OperatorNode:divide","Operator:dotMultiply","Operator:dotDivide"]},"OperatorNode:divide":{op:"/",associativity:"left",associativeWith:[],latexLeftParens:!1,latexRightParens:!1,latexParens:!1},"OperatorNode:dotMultiply":{op:".*",associativity:"left",associativeWith:["OperatorNode:multiply","OperatorNode:divide","OperatorNode:dotMultiply","OperatorNode:doDivide"]},"OperatorNode:dotDivide":{op:"./",associativity:"left",associativeWith:[]},"OperatorNode:mod":{op:"mod",associativity:"left",associativeWith:[]}},{"OperatorNode:multiply":{associativity:"left",associativeWith:["OperatorNode:multiply","OperatorNode:divide","Operator:dotMultiply","Operator:dotDivide"]}},{"OperatorNode:unaryPlus":{op:"+",associativity:"right"},"OperatorNode:unaryMinus":{op:"-",associativity:"right"},"OperatorNode:bitNot":{op:"~",associativity:"right"},"OperatorNode:not":{op:"not",associativity:"right"}},{"OperatorNode:pow":{op:"^",associativity:"right",associativeWith:[],latexRightParens:!1},"OperatorNode:dotPow":{op:".^",associativity:"right",associativeWith:[]}},{"OperatorNode:factorial":{op:"!",associativity:"left"}},{"OperatorNode:ctranspose":{op:"'",associativity:"left"}}];function l4(e,t){if(!t||t!=="auto")return e;for(var r=e;ms(r);)r=r.content;return r}function qn(e,t,r,n){var i=e;t!=="keep"&&(i=e.getContent());for(var a=i.getIdentifier(),o=null,s=0;s{var{subset:t,matrix:r,Node:n}=e,i=n4({subset:t}),a=sfe({subset:t,matrix:r});function o(l,u,c){u||(u="keep");var f=qn(l,u,c),d=qn(l.value,u,c);return u==="all"||d!==null&&d<=f}class s extends n{constructor(u,c,f){if(super(),this.object=u,this.index=f?c:null,this.value=f||c,!ri(u)&&!Uu(u))throw new TypeError('SymbolNode or AccessorNode expected as "object"');if(ri(u)&&u.name==="end")throw new Error('Cannot assign to symbol "end"');if(this.index&&!Sc(this.index))throw new TypeError('IndexNode expected as "index"');if(!Nr(this.value))throw new TypeError('Node expected as "value"')}get name(){return this.index?this.index.isObjectProperty()?this.index.getObjectProperty():"":this.object.name||""}get type(){return c4}get isAssignmentNode(){return!0}_compile(u,c){var f=this.object._compile(u,c),d=this.index?this.index._compile(u,c):null,p=this.value._compile(u,c),h=this.object.name;if(this.index)if(this.index.isObjectProperty()){var m=this.index.getObjectProperty();return function(x,w,S){var k=f(x,w,S),j=p(x,w,S);return Gm(k,m,j),j}}else{if(ri(this.object))return function(x,w,S){var k=f(x,w,S),j=p(x,w,S),O=d(x,w,k);return x.set(h,a(k,O,j)),j};var g=this.object.object._compile(u,c);if(this.object.index.isObjectProperty()){var A=this.object.index.getObjectProperty();return function(x,w,S){var k=g(x,w,S),j=Zi(k,A),O=d(x,w,j),C=p(x,w,S);return Gm(k,A,a(j,O,C)),C}}else{var b=this.object.index._compile(u,c);return function(x,w,S){var k=g(x,w,S),j=b(x,w,k),O=i(k,j),C=d(x,w,O),N=p(x,w,S);return a(k,j,a(O,C,N)),N}}}else{if(!ri(this.object))throw new TypeError("SymbolNode expected as object");return function(x,w,S){var k=p(x,w,S);return x.set(h,k),k}}}forEach(u){u(this.object,"object",this),this.index&&u(this.index,"index",this),u(this.value,"value",this)}map(u){var c=this._ifNode(u(this.object,"object",this)),f=this.index?this._ifNode(u(this.index,"index",this)):null,d=this._ifNode(u(this.value,"value",this));return new s(c,f,d)}clone(){return new s(this.object,this.index,this.value)}_toString(u){var c=this.object.toString(u),f=this.index?this.index.toString(u):"",d=this.value.toString(u);return o(this,u&&u.parenthesis,u&&u.implicit)&&(d="("+d+")"),c+f+" = "+d}toJSON(){return{mathjs:c4,object:this.object,index:this.index,value:this.value}}static fromJSON(u){return new s(u.object,u.index,u.value)}_toHTML(u){var c=this.object.toHTML(u),f=this.index?this.index.toHTML(u):"",d=this.value.toHTML(u);return o(this,u&&u.parenthesis,u&&u.implicit)&&(d='('+d+')'),c+f+'='+d}_toTex(u){var c=this.object.toTex(u),f=this.index?this.index.toTex(u):"",d=this.value.toTex(u);return o(this,u&&u.parenthesis,u&&u.implicit)&&(d="\\left(".concat(d,"\\right)")),c+f+"="+d}}return yn(s,"name",c4),s},{isClass:!0,isNode:!0});var d4="BlockNode",eUe=["ResultSet","Node"],p4=V(d4,eUe,e=>{var{ResultSet:t,Node:r}=e;class n extends r{constructor(a){if(super(),!Array.isArray(a))throw new Error("Array expected");this.blocks=a.map(function(o){var s=o&&o.node,l=o&&o.visible!==void 0?o.visible:!0;if(!Nr(s))throw new TypeError('Property "node" must be a Node');if(typeof l!="boolean")throw new TypeError('Property "visible" must be a boolean');return{node:s,visible:l}})}get type(){return d4}get isBlockNode(){return!0}_compile(a,o){var s=Ec(this.blocks,function(l){return{evaluate:l.node._compile(a,o),visible:l.visible}});return function(u,c,f){var d=[];return $0(s,function(h){var m=h.evaluate(u,c,f);h.visible&&d.push(m)}),new t(d)}}forEach(a){for(var o=0;o;')}).join('
')}_toTex(a){return this.blocks.map(function(o){return o.node.toTex(a)+(o.visible?"":";")}).join(`\\;\\; `)}}return yn(n,"name",d4),n},{isClass:!0,isNode:!0});var m4="ConditionalNode",tUe=["Node"],h4=V(m4,tUe,e=>{var{Node:t}=e;function r(i){if(typeof i=="number"||typeof i=="boolean"||typeof i=="string")return!!i;if(i){if(It(i))return!i.isZero();if(ds(i))return!!(i.re||i.im);if(Fo(i))return!!i.value}if(i==null)return!1;throw new TypeError('Unsupported type of condition "'+qr(i)+'"')}class n extends t{constructor(a,o,s){if(super(),!Nr(a))throw new TypeError("Parameter condition must be a Node");if(!Nr(o))throw new TypeError("Parameter trueExpr must be a Node");if(!Nr(s))throw new TypeError("Parameter falseExpr must be a Node");this.condition=a,this.trueExpr=o,this.falseExpr=s}get type(){return m4}get isConditionalNode(){return!0}_compile(a,o){var s=this.condition._compile(a,o),l=this.trueExpr._compile(a,o),u=this.falseExpr._compile(a,o);return function(f,d,p){return r(s(f,d,p))?l(f,d,p):u(f,d,p)}}forEach(a){a(this.condition,"condition",this),a(this.trueExpr,"trueExpr",this),a(this.falseExpr,"falseExpr",this)}map(a){return new n(this._ifNode(a(this.condition,"condition",this)),this._ifNode(a(this.trueExpr,"trueExpr",this)),this._ifNode(a(this.falseExpr,"falseExpr",this)))}clone(){return new n(this.condition,this.trueExpr,this.falseExpr)}_toString(a){var o=a&&a.parenthesis?a.parenthesis:"keep",s=qn(this,o,a&&a.implicit),l=this.condition.toString(a),u=qn(this.condition,o,a&&a.implicit);(o==="all"||this.condition.type==="OperatorNode"||u!==null&&u<=s)&&(l="("+l+")");var c=this.trueExpr.toString(a),f=qn(this.trueExpr,o,a&&a.implicit);(o==="all"||this.trueExpr.type==="OperatorNode"||f!==null&&f<=s)&&(c="("+c+")");var d=this.falseExpr.toString(a),p=qn(this.falseExpr,o,a&&a.implicit);return(o==="all"||this.falseExpr.type==="OperatorNode"||p!==null&&p<=s)&&(d="("+d+")"),l+" ? "+c+" : "+d}toJSON(){return{mathjs:m4,condition:this.condition,trueExpr:this.trueExpr,falseExpr:this.falseExpr}}static fromJSON(a){return new n(a.condition,a.trueExpr,a.falseExpr)}_toHTML(a){var o=a&&a.parenthesis?a.parenthesis:"keep",s=qn(this,o,a&&a.implicit),l=this.condition.toHTML(a),u=qn(this.condition,o,a&&a.implicit);(o==="all"||this.condition.type==="OperatorNode"||u!==null&&u<=s)&&(l='('+l+')');var c=this.trueExpr.toHTML(a),f=qn(this.trueExpr,o,a&&a.implicit);(o==="all"||this.trueExpr.type==="OperatorNode"||f!==null&&f<=s)&&(c='('+c+')');var d=this.falseExpr.toHTML(a),p=qn(this.falseExpr,o,a&&a.implicit);return(o==="all"||this.falseExpr.type==="OperatorNode"||p!==null&&p<=s)&&(d='('+d+')'),l+'?'+c+':'+d}_toTex(a){return"\\begin{cases} {"+this.trueExpr.toTex(a)+"}, &\\quad{\\text{if }\\;"+this.condition.toTex(a)+"}\\\\{"+this.falseExpr.toTex(a)+"}, &\\quad{\\text{otherwise}}\\end{cases}"}}return yn(n,"name",m4),n},{isClass:!0,isNode:!0});var dfe=Ae(cfe(),1);var CH={Alpha:"A",alpha:"\\alpha",Beta:"B",beta:"\\beta",Gamma:"\\Gamma",gamma:"\\gamma",Delta:"\\Delta",delta:"\\delta",Epsilon:"E",epsilon:"\\epsilon",varepsilon:"\\varepsilon",Zeta:"Z",zeta:"\\zeta",Eta:"H",eta:"\\eta",Theta:"\\Theta",theta:"\\theta",vartheta:"\\vartheta",Iota:"I",iota:"\\iota",Kappa:"K",kappa:"\\kappa",varkappa:"\\varkappa",Lambda:"\\Lambda",lambda:"\\lambda",Mu:"M",mu:"\\mu",Nu:"N",nu:"\\nu",Xi:"\\Xi",xi:"\\xi",Omicron:"O",omicron:"o",Pi:"\\Pi",pi:"\\pi",varpi:"\\varpi",Rho:"P",rho:"\\rho",varrho:"\\varrho",Sigma:"\\Sigma",sigma:"\\sigma",varsigma:"\\varsigma",Tau:"T",tau:"\\tau",Upsilon:"\\Upsilon",upsilon:"\\upsilon",Phi:"\\Phi",phi:"\\phi",varphi:"\\varphi",Chi:"X",chi:"\\chi",Psi:"\\Psi",psi:"\\psi",Omega:"\\Omega",omega:"\\omega",true:"\\mathrm{True}",false:"\\mathrm{False}",i:"i",inf:"\\infty",Inf:"\\infty",infinity:"\\infty",Infinity:"\\infty",oo:"\\infty",lim:"\\lim",undefined:"\\mathbf{?}"},bn={transpose:"^\\top",ctranspose:"^H",factorial:"!",pow:"^",dotPow:".^\\wedge",unaryPlus:"+",unaryMinus:"-",bitNot:"\\~",not:"\\neg",multiply:"\\cdot",divide:"\\frac",dotMultiply:".\\cdot",dotDivide:".:",mod:"\\mod",add:"+",subtract:"-",to:"\\rightarrow",leftShift:"<<",rightArithShift:">>",rightLogShift:">>>",equal:"=",unequal:"\\neq",smaller:"<",larger:">",smallerEq:"\\leq",largerEq:"\\geq",bitAnd:"\\&",bitXor:"\\underline{|}",bitOr:"|",and:"\\wedge",xor:"\\veebar",or:"\\vee"},DH={abs:{1:"\\left|${args[0]}\\right|"},add:{2:"\\left(${args[0]}".concat(bn.add,"${args[1]}\\right)")},cbrt:{1:"\\sqrt[3]{${args[0]}}"},ceil:{1:"\\left\\lceil${args[0]}\\right\\rceil"},cube:{1:"\\left(${args[0]}\\right)^3"},divide:{2:"\\frac{${args[0]}}{${args[1]}}"},dotDivide:{2:"\\left(${args[0]}".concat(bn.dotDivide,"${args[1]}\\right)")},dotMultiply:{2:"\\left(${args[0]}".concat(bn.dotMultiply,"${args[1]}\\right)")},dotPow:{2:"\\left(${args[0]}".concat(bn.dotPow,"${args[1]}\\right)")},exp:{1:"\\exp\\left(${args[0]}\\right)"},expm1:"\\left(e".concat(bn.pow,"{${args[0]}}-1\\right)"),fix:{1:"\\mathrm{${name}}\\left(${args[0]}\\right)"},floor:{1:"\\left\\lfloor${args[0]}\\right\\rfloor"},gcd:"\\gcd\\left(${args}\\right)",hypot:"\\hypot\\left(${args}\\right)",log:{1:"\\ln\\left(${args[0]}\\right)",2:"\\log_{${args[1]}}\\left(${args[0]}\\right)"},log10:{1:"\\log_{10}\\left(${args[0]}\\right)"},log1p:{1:"\\ln\\left(${args[0]}+1\\right)",2:"\\log_{${args[1]}}\\left(${args[0]}+1\\right)"},log2:"\\log_{2}\\left(${args[0]}\\right)",mod:{2:"\\left(${args[0]}".concat(bn.mod,"${args[1]}\\right)")},multiply:{2:"\\left(${args[0]}".concat(bn.multiply,"${args[1]}\\right)")},norm:{1:"\\left\\|${args[0]}\\right\\|",2:void 0},nthRoot:{2:"\\sqrt[${args[1]}]{${args[0]}}"},nthRoots:{2:"\\{y : $y^{args[1]} = {${args[0]}}\\}"},pow:{2:"\\left(${args[0]}\\right)".concat(bn.pow,"{${args[1]}}")},round:{1:"\\left\\lfloor${args[0]}\\right\\rceil",2:void 0},sign:{1:"\\mathrm{${name}}\\left(${args[0]}\\right)"},sqrt:{1:"\\sqrt{${args[0]}}"},square:{1:"\\left(${args[0]}\\right)^2"},subtract:{2:"\\left(${args[0]}".concat(bn.subtract,"${args[1]}\\right)")},unaryMinus:{1:"".concat(bn.unaryMinus,"\\left(${args[0]}\\right)")},unaryPlus:{1:"".concat(bn.unaryPlus,"\\left(${args[0]}\\right)")},bitAnd:{2:"\\left(${args[0]}".concat(bn.bitAnd,"${args[1]}\\right)")},bitNot:{1:bn.bitNot+"\\left(${args[0]}\\right)"},bitOr:{2:"\\left(${args[0]}".concat(bn.bitOr,"${args[1]}\\right)")},bitXor:{2:"\\left(${args[0]}".concat(bn.bitXor,"${args[1]}\\right)")},leftShift:{2:"\\left(${args[0]}".concat(bn.leftShift,"${args[1]}\\right)")},rightArithShift:{2:"\\left(${args[0]}".concat(bn.rightArithShift,"${args[1]}\\right)")},rightLogShift:{2:"\\left(${args[0]}".concat(bn.rightLogShift,"${args[1]}\\right)")},bellNumbers:{1:"\\mathrm{B}_{${args[0]}}"},catalan:{1:"\\mathrm{C}_{${args[0]}}"},stirlingS2:{2:"\\mathrm{S}\\left(${args}\\right)"},arg:{1:"\\arg\\left(${args[0]}\\right)"},conj:{1:"\\left(${args[0]}\\right)^*"},im:{1:"\\Im\\left\\lbrace${args[0]}\\right\\rbrace"},re:{1:"\\Re\\left\\lbrace${args[0]}\\right\\rbrace"},and:{2:"\\left(${args[0]}".concat(bn.and,"${args[1]}\\right)")},not:{1:bn.not+"\\left(${args[0]}\\right)"},or:{2:"\\left(${args[0]}".concat(bn.or,"${args[1]}\\right)")},xor:{2:"\\left(${args[0]}".concat(bn.xor,"${args[1]}\\right)")},cross:{2:"\\left(${args[0]}\\right)\\times\\left(${args[1]}\\right)"},ctranspose:{1:"\\left(${args[0]}\\right)".concat(bn.ctranspose)},det:{1:"\\det\\left(${args[0]}\\right)"},dot:{2:"\\left(${args[0]}\\cdot${args[1]}\\right)"},expm:{1:"\\exp\\left(${args[0]}\\right)"},inv:{1:"\\left(${args[0]}\\right)^{-1}"},pinv:{1:"\\left(${args[0]}\\right)^{+}"},sqrtm:{1:"{${args[0]}}".concat(bn.pow,"{\\frac{1}{2}}")},trace:{1:"\\mathrm{tr}\\left(${args[0]}\\right)"},transpose:{1:"\\left(${args[0]}\\right)".concat(bn.transpose)},combinations:{2:"\\binom{${args[0]}}{${args[1]}}"},combinationsWithRep:{2:"\\left(\\!\\!{\\binom{${args[0]}}{${args[1]}}}\\!\\!\\right)"},factorial:{1:"\\left(${args[0]}\\right)".concat(bn.factorial)},gamma:{1:"\\Gamma\\left(${args[0]}\\right)"},lgamma:{1:"\\ln\\Gamma\\left(${args[0]}\\right)"},equal:{2:"\\left(${args[0]}".concat(bn.equal,"${args[1]}\\right)")},larger:{2:"\\left(${args[0]}".concat(bn.larger,"${args[1]}\\right)")},largerEq:{2:"\\left(${args[0]}".concat(bn.largerEq,"${args[1]}\\right)")},smaller:{2:"\\left(${args[0]}".concat(bn.smaller,"${args[1]}\\right)")},smallerEq:{2:"\\left(${args[0]}".concat(bn.smallerEq,"${args[1]}\\right)")},unequal:{2:"\\left(${args[0]}".concat(bn.unequal,"${args[1]}\\right)")},erf:{1:"erf\\left(${args[0]}\\right)"},max:"\\max\\left(${args}\\right)",min:"\\min\\left(${args}\\right)",variance:"\\mathrm{Var}\\left(${args}\\right)",acos:{1:"\\cos^{-1}\\left(${args[0]}\\right)"},acosh:{1:"\\cosh^{-1}\\left(${args[0]}\\right)"},acot:{1:"\\cot^{-1}\\left(${args[0]}\\right)"},acoth:{1:"\\coth^{-1}\\left(${args[0]}\\right)"},acsc:{1:"\\csc^{-1}\\left(${args[0]}\\right)"},acsch:{1:"\\mathrm{csch}^{-1}\\left(${args[0]}\\right)"},asec:{1:"\\sec^{-1}\\left(${args[0]}\\right)"},asech:{1:"\\mathrm{sech}^{-1}\\left(${args[0]}\\right)"},asin:{1:"\\sin^{-1}\\left(${args[0]}\\right)"},asinh:{1:"\\sinh^{-1}\\left(${args[0]}\\right)"},atan:{1:"\\tan^{-1}\\left(${args[0]}\\right)"},atan2:{2:"\\mathrm{atan2}\\left(${args}\\right)"},atanh:{1:"\\tanh^{-1}\\left(${args[0]}\\right)"},cos:{1:"\\cos\\left(${args[0]}\\right)"},cosh:{1:"\\cosh\\left(${args[0]}\\right)"},cot:{1:"\\cot\\left(${args[0]}\\right)"},coth:{1:"\\coth\\left(${args[0]}\\right)"},csc:{1:"\\csc\\left(${args[0]}\\right)"},csch:{1:"\\mathrm{csch}\\left(${args[0]}\\right)"},sec:{1:"\\sec\\left(${args[0]}\\right)"},sech:{1:"\\mathrm{sech}\\left(${args[0]}\\right)"},sin:{1:"\\sin\\left(${args[0]}\\right)"},sinh:{1:"\\sinh\\left(${args[0]}\\right)"},tan:{1:"\\tan\\left(${args[0]}\\right)"},tanh:{1:"\\tanh\\left(${args[0]}\\right)"},to:{2:"\\left(${args[0]}".concat(bn.to,"${args[1]}\\right)")},numeric:function(t,r){return t.args[0].toTex()},number:{0:"0",1:"\\left(${args[0]}\\right)",2:"\\left(\\left(${args[0]}\\right)${args[1]}\\right)"},string:{0:'\\mathtt{""}',1:"\\mathrm{string}\\left(${args[0]}\\right)"},bignumber:{0:"0",1:"\\left(${args[0]}\\right)"},complex:{0:"0",1:"\\left(${args[0]}\\right)",2:"\\left(\\left(${args[0]}\\right)+".concat(CH.i,"\\cdot\\left(${args[1]}\\right)\\right)")},matrix:{0:"\\begin{bmatrix}\\end{bmatrix}",1:"\\left(${args[0]}\\right)",2:"\\left(${args[0]}\\right)"},sparse:{0:"\\begin{bsparse}\\end{bsparse}",1:"\\left(${args[0]}\\right)"},unit:{1:"\\left(${args[0]}\\right)",2:"\\left(\\left(${args[0]}\\right)${args[1]}\\right)"}},pfe="\\mathrm{${name}}\\left(${args}\\right)",ffe={deg:"^\\circ"};function A4(e){return(0,dfe.default)(e,{preserveFormatting:!0})}function g4(e,t){return t=typeof t>"u"?!1:t,t?Et(ffe,e)?ffe[e]:"\\mathrm{"+A4(e)+"}":Et(CH,e)?CH[e]:A4(e)}var v4="ConstantNode",aUe=["Node"],y4=V(v4,aUe,e=>{var{Node:t}=e;class r extends t{constructor(i){super(),this.value=i}get type(){return v4}get isConstantNode(){return!0}_compile(i,a){var o=this.value;return function(){return o}}forEach(i){}map(i){return this.clone()}clone(){return new r(this.value)}_toString(i){return tr(this.value,i)}_toHTML(i){var a=this._toString(i);switch(qr(this.value)){case"number":case"BigNumber":case"Fraction":return''+a+"";case"string":return''+a+"";case"boolean":return''+a+"";case"null":return''+a+"";case"undefined":return''+a+"";default:return''+a+""}}toJSON(){return{mathjs:v4,value:this.value}}static fromJSON(i){return new r(i.value)}_toTex(i){var a=this._toString(i),o=qr(this.value);switch(o){case"string":return"\\mathtt{"+A4(a)+"}";case"number":case"BigNumber":{var s=o==="BigNumber"?this.value.isFinite():isFinite(this.value);if(!s)return this.value.valueOf()<0?"-\\infty":"\\infty";var l=a.toLowerCase().indexOf("e");return l!==-1?a.substring(0,l)+"\\cdot10^{"+a.substring(l+1)+"}":a}case"Fraction":return this.value.toLatex();default:return a}}}return yn(r,"name",v4),r},{isClass:!0,isNode:!0});var b4="FunctionAssignmentNode",oUe=["typed","Node"],x4=V(b4,oUe,e=>{var{typed:t,Node:r}=e;function n(a,o,s){var l=qn(a,o,s),u=qn(a.expr,o,s);return o==="all"||u!==null&&u<=l}class i extends r{constructor(o,s,l){if(super(),typeof o!="string")throw new TypeError('String expected for parameter "name"');if(!Array.isArray(s))throw new TypeError('Array containing strings or objects expected for parameter "params"');if(!Nr(l))throw new TypeError('Node expected for parameter "expr"');if(t4.has(o))throw new Error('Illegal function name, "'+o+'" is a reserved keyword');var u=new Set;for(var c of s){var f=typeof c=="string"?c:c.name;if(u.has(f))throw new Error('Duplicate parameter name "'.concat(f,'"'));u.add(f)}this.name=o,this.params=s.map(function(d){return d&&d.name||d}),this.types=s.map(function(d){return d&&d.type||"any"}),this.expr=l}get type(){return b4}get isFunctionAssignmentNode(){return!0}_compile(o,s){var l=Object.create(s);$0(this.params,function(h){l[h]=!0});var u=this.expr._compile(o,l),c=this.name,f=this.params,d=iW(this.types,","),p=c+"("+iW(this.params,", ")+")";return function(m,g,A){var b={};b[d]=function(){for(var x=Object.create(g),w=0;w'+hs(this.params[u])+"");var c=this.expr.toHTML(o);return n(this,s,o&&o.implicit)&&(c='('+c+')'),''+hs(this.name)+'('+l.join(',')+')='+c}_toTex(o){var s=o&&o.parenthesis?o.parenthesis:"keep",l=this.expr.toTex(o);return n(this,s,o&&o.implicit)&&(l="\\left(".concat(l,"\\right)")),"\\mathrm{"+this.name+"}\\left("+this.params.map(g4).join(",")+"\\right)="+l}}return yn(i,"name",b4),i},{isClass:!0,isNode:!0});var w4="IndexNode",sUe=["Node","size"],S4=V(w4,sUe,e=>{var{Node:t,size:r}=e;class n extends t{constructor(a,o){if(super(),this.dimensions=a,this.dotNotation=o||!1,!Array.isArray(a)||!a.every(Nr))throw new TypeError('Array containing Nodes expected for parameter "dimensions"');if(this.dotNotation&&!this.isObjectProperty())throw new Error("dotNotation only applicable for object properties")}get type(){return w4}get isIndexNode(){return!0}_compile(a,o){var s=Ec(this.dimensions,function(u,c){var f=u.filter(h=>h.isSymbolNode&&h.name==="end").length>0;if(f){var d=Object.create(o);d.end=!0;var p=u._compile(a,d);return function(m,g,A){if(!St(A)&&!Ir(A)&&!da(A))throw new TypeError('Cannot resolve "end": context must be a Matrix, Array, or string but is '+qr(A));var b=r(A).valueOf(),v=Object.create(g);return v.end=b[c],p(m,v,A)}}else return u._compile(a,o)}),l=Zi(a,"index");return function(c,f,d){var p=Ec(s,function(h){return h(c,f,d)});return l(...p)}}forEach(a){for(var o=0;o.'+hs(this.getObjectProperty())+"":'['+o.join(',')+']'}_toTex(a){var o=this.dimensions.map(function(s){return s.toTex(a)});return this.dotNotation?"."+this.getObjectProperty():"_{"+o.join(",")+"}"}}return yn(n,"name",w4),n},{isClass:!0,isNode:!0});var E4="ObjectNode",lUe=["Node"],k4=V(E4,lUe,e=>{var{Node:t}=e;class r extends t{constructor(i){if(super(),this.properties=i||{},i&&(typeof i!="object"||!Object.keys(i).every(function(a){return Nr(i[a])})))throw new TypeError("Object containing Nodes expected")}get type(){return E4}get isObjectNode(){return!0}_compile(i,a){var o={};for(var s in this.properties)if(Et(this.properties,s)){var l=vy(s),u=JSON.parse(l),c=Zi(this.properties,s);o[u]=c._compile(i,a)}return function(d,p,h){var m={};for(var g in o)Et(o,g)&&(m[g]=o[g](d,p,h));return m}}forEach(i){for(var a in this.properties)Et(this.properties,a)&&i(this.properties[a],"properties["+vy(a)+"]",this)}map(i){var a={};for(var o in this.properties)Et(this.properties,o)&&(a[o]=this._ifNode(i(this.properties[o],"properties["+vy(o)+"]",this)));return new r(a)}clone(){var i={};for(var a in this.properties)Et(this.properties,a)&&(i[a]=this.properties[a]);return new r(i)}_toString(i){var a=[];for(var o in this.properties)Et(this.properties,o)&&a.push(vy(o)+": "+this.properties[o].toString(i));return"{"+a.join(", ")+"}"}toJSON(){return{mathjs:E4,properties:this.properties}}static fromJSON(i){return new r(i.properties)}_toHTML(i){var a=[];for(var o in this.properties)Et(this.properties,o)&&a.push(''+hs(o)+':'+this.properties[o].toHTML(i));return'{'+a.join(',')+'}'}_toTex(i){var a=[];for(var o in this.properties)Et(this.properties,o)&&a.push("\\mathbf{"+o+":} & "+this.properties[o].toTex(i)+"\\\\");var s="\\left\\{\\begin{array}{ll}"+a.join(` `)+"\\end{array}\\right\\}";return s}}return yn(r,"name",E4),r},{isClass:!0,isNode:!0});function Cy(e,t){return new Xw(e,new xy(t),new Set(Object.keys(t)))}var C4="OperatorNode",uUe=["Node"],D4=V(C4,uUe,e=>{var{Node:t}=e;function r(a,o){var s=a;if(o==="auto")for(;ms(s);)s=s.content;return gr(s)?!0:bi(s)?r(s.args[0],o):!1}function n(a,o,s,l,u){var c=qn(a,o,s),f=kS(a,o);if(o==="all"||l.length>2&&a.getIdentifier()!=="OperatorNode:add"&&a.getIdentifier()!=="OperatorNode:multiply")return l.map(function(C){switch(C.getContent().type){case"ArrayNode":case"ConstantNode":case"SymbolNode":case"ParenthesisNode":return!1;default:return!0}});var d;switch(l.length){case 0:d=[];break;case 1:{var p=qn(l[0],o,s,a);if(u&&p!==null){var h,m;if(o==="keep"?(h=l[0].getIdentifier(),m=a.getIdentifier()):(h=l[0].getContent().getIdentifier(),m=a.getContent().getIdentifier()),jd[c][m].latexLeftParens===!1){d=[!1];break}if(jd[p][h].latexParens===!1){d=[!1];break}}if(p===null){d=[!1];break}if(p<=c){d=[!0];break}d=[!1]}break;case 2:{var g,A=qn(l[0],o,s,a),b=u4(a,l[0],o);A===null?g=!1:A===c&&f==="right"&&!b||A=2&&a.getIdentifier()==="OperatorNode:multiply"&&a.implicit&&o!=="all"&&s==="hide")for(var O=1;O2&&(this.getIdentifier()==="OperatorNode:add"||this.getIdentifier()==="OperatorNode:multiply")){var g=u.map(function(A,b){return A=A.toString(o),c[b]&&(A="("+A+")"),A});return this.implicit&&this.getIdentifier()==="OperatorNode:multiply"&&l==="hide"?g.join(" "):g.join(" "+this.op+" ")}else return this.fn+"("+this.args.join(", ")+")"}toJSON(){return{mathjs:C4,op:this.op,fn:this.fn,args:this.args,implicit:this.implicit,isPercentage:this.isPercentage}}static fromJSON(o){return new i(o.op,o.fn,o.args,o.implicit,o.isPercentage)}_toHTML(o){var s=o&&o.parenthesis?o.parenthesis:"keep",l=o&&o.implicit?o.implicit:"hide",u=this.args,c=n(this,s,l,u,!1);if(u.length===1){var f=kS(this,s),d=u[0].toHTML(o);return c[0]&&(d='('+d+')'),f==="right"?''+hs(this.op)+""+d:d+''+hs(this.op)+""}else if(u.length===2){var p=u[0].toHTML(o),h=u[1].toHTML(o);return c[0]&&(p='('+p+')'),c[1]&&(h='('+h+')'),this.implicit&&this.getIdentifier()==="OperatorNode:multiply"&&l==="hide"?p+''+h:p+''+hs(this.op)+""+h}else{var m=u.map(function(g,A){return g=g.toHTML(o),c[A]&&(g='('+g+')'),g});return u.length>2&&(this.getIdentifier()==="OperatorNode:add"||this.getIdentifier()==="OperatorNode:multiply")?this.implicit&&this.getIdentifier()==="OperatorNode:multiply"&&l==="hide"?m.join(''):m.join(''+hs(this.op)+""):''+hs(this.fn)+'('+m.join(',')+')'}}_toTex(o){var s=o&&o.parenthesis?o.parenthesis:"keep",l=o&&o.implicit?o.implicit:"hide",u=this.args,c=n(this,s,l,u,!0),f=bn[this.fn];if(f=typeof f>"u"?this.op:f,u.length===1){var d=kS(this,s),p=u[0].toTex(o);return c[0]&&(p="\\left(".concat(p,"\\right)")),d==="right"?f+p:p+f}else if(u.length===2){var h=u[0],m=h.toTex(o);c[0]&&(m="\\left(".concat(m,"\\right)"));var g=u[1],A=g.toTex(o);c[1]&&(A="\\left(".concat(A,"\\right)"));var b;switch(s==="keep"?b=h.getIdentifier():b=h.getContent().getIdentifier(),this.getIdentifier()){case"OperatorNode:divide":return f+"{"+m+"}{"+A+"}";case"OperatorNode:pow":switch(m="{"+m+"}",A="{"+A+"}",b){case"ConditionalNode":case"OperatorNode:divide":m="\\left(".concat(m,"\\right)")}break;case"OperatorNode:multiply":if(this.implicit&&l==="hide")return m+"~"+A}return m+f+A}else if(u.length>2&&(this.getIdentifier()==="OperatorNode:add"||this.getIdentifier()==="OperatorNode:multiply")){var v=u.map(function(x,w){return x=x.toTex(o),c[w]&&(x="\\left(".concat(x,"\\right)")),x});return this.getIdentifier()==="OperatorNode:multiply"&&this.implicit&&l==="hide"?v.join("~"):v.join(f)}else return"\\mathrm{"+this.fn+"}\\left("+u.map(function(x){return x.toTex(o)}).join(",")+"\\right)"}getIdentifier(){return this.type+":"+this.fn}}return yn(i,"name",C4),i},{isClass:!0,isNode:!0});var O4="ParenthesisNode",cUe=["Node"],M4=V(O4,cUe,e=>{var{Node:t}=e;class r extends t{constructor(i){if(super(),!Nr(i))throw new TypeError('Node expected for parameter "content"');this.content=i}get type(){return O4}get isParenthesisNode(){return!0}_compile(i,a){return this.content._compile(i,a)}getContent(){return this.content.getContent()}forEach(i){i(this.content,"content",this)}map(i){var a=i(this.content,"content",this);return new r(a)}clone(){return new r(this.content)}_toString(i){return!i||i&&!i.parenthesis||i&&i.parenthesis==="keep"?"("+this.content.toString(i)+")":this.content.toString(i)}toJSON(){return{mathjs:O4,content:this.content}}static fromJSON(i){return new r(i.content)}_toHTML(i){return!i||i&&!i.parenthesis||i&&i.parenthesis==="keep"?'('+this.content.toHTML(i)+')':this.content.toHTML(i)}_toTex(i){return!i||i&&!i.parenthesis||i&&i.parenthesis==="keep"?"\\left(".concat(this.content.toTex(i),"\\right)"):this.content.toTex(i)}}return yn(r,"name",O4),r},{isClass:!0,isNode:!0});var j4="RangeNode",fUe=["Node"],N4=V(j4,fUe,e=>{var{Node:t}=e;function r(i,a,o){var s=qn(i,a,o),l={},u=qn(i.start,a,o);if(l.start=u!==null&&u<=s||a==="all",i.step){var c=qn(i.step,a,o);l.step=c!==null&&c<=s||a==="all"}var f=qn(i.end,a,o);return l.end=f!==null&&f<=s||a==="all",l}class n extends t{constructor(a,o,s){if(super(),!Nr(a))throw new TypeError("Node expected");if(!Nr(o))throw new TypeError("Node expected");if(s&&!Nr(s))throw new TypeError("Node expected");if(arguments.length>3)throw new Error("Too many arguments");this.start=a,this.end=o,this.step=s||null}get type(){return j4}get isRangeNode(){return!0}needsEnd(){var a=this.filter(function(o){return ri(o)&&o.name==="end"});return a.length>0}_compile(a,o){var s=a.range,l=this.start._compile(a,o),u=this.end._compile(a,o);if(this.step){var c=this.step._compile(a,o);return function(d,p,h){return s(l(d,p,h),u(d,p,h),c(d,p,h))}}else return function(d,p,h){return s(l(d,p,h),u(d,p,h))}}forEach(a){a(this.start,"start",this),a(this.end,"end",this),this.step&&a(this.step,"step",this)}map(a){return new n(this._ifNode(a(this.start,"start",this)),this._ifNode(a(this.end,"end",this)),this.step&&this._ifNode(a(this.step,"step",this)))}clone(){return new n(this.start,this.end,this.step&&this.step)}_toString(a){var o=a&&a.parenthesis?a.parenthesis:"keep",s=r(this,o,a&&a.implicit),l,u=this.start.toString(a);if(s.start&&(u="("+u+")"),l=u,this.step){var c=this.step.toString(a);s.step&&(c="("+c+")"),l+=":"+c}var f=this.end.toString(a);return s.end&&(f="("+f+")"),l+=":"+f,l}toJSON(){return{mathjs:j4,start:this.start,end:this.end,step:this.step}}static fromJSON(a){return new n(a.start,a.end,a.step)}_toHTML(a){var o=a&&a.parenthesis?a.parenthesis:"keep",s=r(this,o,a&&a.implicit),l,u=this.start.toHTML(a);if(s.start&&(u='('+u+')'),l=u,this.step){var c=this.step.toHTML(a);s.step&&(c='('+c+')'),l+=':'+c}var f=this.end.toHTML(a);return s.end&&(f='('+f+')'),l+=':'+f,l}_toTex(a){var o=a&&a.parenthesis?a.parenthesis:"keep",s=r(this,o,a&&a.implicit),l=this.start.toTex(a);if(s.start&&(l="\\left(".concat(l,"\\right)")),this.step){var u=this.step.toTex(a);s.step&&(u="\\left(".concat(u,"\\right)")),l+=":"+u}var c=this.end.toTex(a);return s.end&&(c="\\left(".concat(c,"\\right)")),l+=":"+c,l}}return yn(n,"name",j4),n},{isClass:!0,isNode:!0});var T4="RelationalNode",dUe=["Node"],F4=V(T4,dUe,e=>{var{Node:t}=e,r={equal:"==",unequal:"!=",smaller:"<",larger:">",smallerEq:"<=",largerEq:">="};class n extends t{constructor(a,o){if(super(),!Array.isArray(a))throw new TypeError("Parameter conditionals must be an array");if(!Array.isArray(o))throw new TypeError("Parameter params must be an array");if(a.length!==o.length-1)throw new TypeError("Parameter params must contain exactly one more element than parameter conditionals");this.conditionals=a,this.params=o}get type(){return T4}get isRelationalNode(){return!0}_compile(a,o){var s=this,l=this.params.map(u=>u._compile(a,o));return function(c,f,d){for(var p,h=l[0](c,f,d),m=0;ma(o,"params["+s+"]",this),this)}map(a){return new n(this.conditionals.slice(),this.params.map((o,s)=>this._ifNode(a(o,"params["+s+"]",this)),this))}clone(){return new n(this.conditionals,this.params)}_toString(a){for(var o=a&&a.parenthesis?a.parenthesis:"keep",s=qn(this,o,a&&a.implicit),l=this.params.map(function(f,d){var p=qn(f,o,a&&a.implicit);return o==="all"||p!==null&&p<=s?"("+f.toString(a)+")":f.toString(a)}),u=l[0],c=0;c('+f.toHTML(a)+')':f.toHTML(a)}),u=l[0],c=0;c'+hs(r[this.conditionals[c]])+""+l[c+1];return u}_toTex(a){for(var o=a&&a.parenthesis?a.parenthesis:"keep",s=qn(this,o,a&&a.implicit),l=this.params.map(function(f,d){var p=qn(f,o,a&&a.implicit);return o==="all"||p!==null&&p<=s?"\\left("+f.toTex(a)+"\right)":f.toTex(a)}),u=l[0],c=0;c{var{math:t,Unit:r,Node:n}=e;function i(o){return r?r.isValuelessUnit(o):!1}class a extends n{constructor(s){if(super(),typeof s!="string")throw new TypeError('String expected for parameter "name"');this.name=s}get type(){return"SymbolNode"}get isSymbolNode(){return!0}_compile(s,l){var u=this.name;if(l[u]===!0)return function(f,d,p){return Zi(d,u)};if(u in s)return function(f,d,p){return f.has(u)?f.get(u):Zi(s,u)};var c=i(u);return function(f,d,p){return f.has(u)?f.get(u):c?new r(null,u):a.onUndefinedSymbol(u)}}forEach(s){}map(s){return this.clone()}static onUndefinedSymbol(s){throw new Error("Undefined symbol "+s)}clone(){return new a(this.name)}_toString(s){return this.name}_toHTML(s){var l=hs(this.name);return l==="true"||l==="false"?''+l+"":l==="i"?''+l+"":l==="Infinity"?''+l+"":l==="NaN"?''+l+"":l==="null"?''+l+"":l==="undefined"?''+l+"":''+l+""}toJSON(){return{mathjs:"SymbolNode",name:this.name}}static fromJSON(s){return new a(s.name)}_toTex(s){var l=!1;typeof t[this.name]>"u"&&i(this.name)&&(l=!0);var u=g4(this.name,l);return u[0]==="\\"?u:" "+u}}return a},{isClass:!0,isNode:!0});var P4="FunctionNode",hUe=["math","Node","SymbolNode"],I4=V(P4,hUe,e=>{var t,{math:r,Node:n,SymbolNode:i}=e,a=l=>tr(l,{truncate:78});function o(l,u,c){for(var f="",d=/\$(?:\{([a-z_][a-z_0-9]*)(?:\[([0-9]+)\])?\}|\$)/gi,p=0,h;(h=d.exec(l))!==null;)if(f+=l.substring(p,h.index),p=h.index,h[0]==="$$")f+="$",p++;else{p+=h[0].length;var m=u[h[1]];if(!m)throw new ReferenceError("Template: Property "+h[1]+" does not exist.");if(h[2]===void 0)switch(typeof m){case"string":f+=m;break;case"object":if(Nr(m))f+=m.toTex(c);else if(Array.isArray(m))f+=m.map(function(g,A){if(Nr(g))return g.toTex(c);throw new TypeError("Template: "+h[1]+"["+A+"] is not a Node.")}).join(",");else throw new TypeError("Template: "+h[1]+" has to be a Node, String or array of Nodes");break;default:throw new TypeError("Template: "+h[1]+" has to be a Node, String or array of Nodes")}else if(Nr(m[h[2]]&&m[h[2]]))f+=m[h[2]].toTex(c);else throw new TypeError("Template: "+h[1]+"["+h[2]+"] is not a Node.")}return f+=l.slice(p),f}class s extends n{constructor(u,c){if(super(),typeof u=="string"&&(u=new i(u)),!Nr(u))throw new TypeError('Node expected as parameter "fn"');if(!Array.isArray(c)||!c.every(Nr))throw new TypeError('Array containing Nodes expected for parameter "args"');this.fn=u,this.args=c||[]}get name(){return this.fn.name||""}get type(){return P4}get isFunctionNode(){return!0}_compile(u,c){var f=this.args.map(j=>j._compile(u,c));if(ri(this.fn)){var d=this.fn.name;if(c[d]){var A=this.args;return function(O,C,N){var D=Zi(C,d);if(typeof D!="function")throw new TypeError("Argument '".concat(d,"' was not a function; received: ").concat(a(D)));if(D.rawArgs)return D(A,u,Cy(O,C));var P=f.map(q=>q(O,C,N));return D.apply(D,P)}}else{var p=d in u?Zi(u,d):void 0,h=typeof p=="function"&&p.rawArgs===!0,m=j=>{var O;if(j.has(d))O=j.get(d);else if(d in u)O=Zi(u,d);else return s.onUndefinedFunction(d);if(typeof O=="function")return O;throw new TypeError("'".concat(d,`' is not a function; its value is: @@ -96,7 +96,7 @@ U: `+this.U.toString()+` P: `+this.p}}}function m(g){var A=g._size[0],b=g._size[1],v=Math.min(A,b),x=g._values,w=g._index,S=g._ptr,k=[],j=[],O=[],C=[A,v],N=[],D=[],P=[],q=[v,b],z,I,T,L=[],_=[];for(z=0;z0&&Q.forEach(0,I-1,function(ye,me){d._forEachRow(ye,k,j,O,function(ke,$){ke>ye&&Q.accumulate(ke,c(o($,me)))})});var Se=I,Oe=Q.get(I),ve=n(Oe);Q.forEach(I+1,A-1,function(ye,me){var ke=n(me);l(ke,ve)&&(Se=ye,ve=ke,Oe=me)}),I!==Se&&(d._swapRows(I,Se,C[1],k,j,O),d._swapRows(I,Se,q[1],N,D,P),Q.swap(I,Se),Y(I,Se)),Q.forEach(0,A-1,function(ye,me){ye<=I?(N.push(me),D.push(ye)):(me=a(me,Oe),u(me,0)||(k.push(me),j.push(ye)))})};for(I=0;I{var{typed:t,matrix:r,zeros:n,identity:i,isZero:a,equal:o,sign:s,sqrt:l,conj:u,unaryMinus:c,addScalar:f,divideScalar:d,multiplyScalar:p,subtractScalar:h,complex:m}=e;return Fn(t(yfe,{DenseMatrix:function(x){return A(x)},SparseMatrix:function(x){return b(x)},Array:function(x){var w=r(x),S=A(w);return{Q:S.Q.valueOf(),R:S.R.valueOf()}}}),{_denseQRimpl:g});function g(v){var x=v._size[0],w=v._size[1],S=i([x],"dense"),k=S._data,j=v.clone(),O=j._data,C,N,D,P=n([x],"");for(D=0;D0)for(var S=w[0][0].type==="Complex"?m(0):0,k=0;k=0;){var l=r[o+s],u=r[n+l];u===-1?(s--,a[t++]=l):(r[n+l]=r[i+u],++s,r[o+s]=u)}return t}function xfe(e,t){if(!e)return null;var r=0,n,i=[],a=[],o=0,s=t,l=2*t;for(n=0;n=0;n--)e[n]!==-1&&(a[s+n]=a[o+e[n]],a[o+e[n]]=n);for(n=0;n{var{add:t,multiply:r,transpose:n}=e;return function(c,f){if(!f||c<=0||c>3)return null;var d=f._size,p=d[0],h=d[1],m=0,g=Math.max(16,10*Math.sqrt(h));g=Math.min(h-2,g);var A=i(c,f,p,h,g);Sfe(A,l,null);for(var b=A._index,v=A._ptr,x=v[h],w=[],S=[],k=0,j=h+1,O=2*(h+1),C=3*(h+1),N=4*(h+1),D=5*(h+1),P=6*(h+1),q=7*(h+1),z=w,I=a(h,v,S,k,C,z,O,q,j,P,N,D),T=o(h,v,S,D,N,P,g,j,C,z,O),L=0,_,Y,oe,te,Q,fe,Ie,Se,Oe,ve,ye,me,ke,$,ae,ce;TU?(fe=oe,Ie=ee,Se=S[k+oe]-U):(fe=b[ee++],Ie=v[fe],Se=S[k+fe]),Q=1;Q<=Se;Q++)_=b[Ie++],!((Oe=S[j+_])<=0)&&(J+=Oe,S[j+_]=-Oe,b[re++]=_,S[O+_]!==-1&&(z[S[O+_]]=z[_]),z[_]!==-1?S[O+z[_]]=S[O+_]:S[C+S[D+_]]=S[O+_]);fe!==oe&&(v[fe]=qp(oe),S[P+fe]=0)}for(U!==0&&(x=re),S[D+oe]=J,v[oe]=ie,S[k+oe]=re-ie,S[N+oe]=-2,I=s(I,m,S,P,h),ve=ie;ve=I?S[P+fe]-=Oe:S[P+fe]!==0&&(S[P+fe]=S[D+fe]+Ee)}for(ve=ie;ve0?(ce+=Ce,b[$++]=fe,ae+=fe):(v[fe]=qp(oe),S[P+fe]=0)}S[N+_]=$-me+1;var _e=$,he=me+S[k+_];for(ee=ke+1;ee=0))for(ae=z[_],_=S[q+ae],S[q+ae]=-1;_!==-1&&S[O+_]!==-1;_=S[O+_],I++){for(Se=S[k+_],ye=S[N+_],ee=v[_]+1;ee<=v[_]+Se-1;ee++)S[P+b[ee]]=I;var Ye=_;for(Y=S[O+_];Y!==-1;){var tt=S[k+Y]===Se&&S[N+Y]===ye;for(ee=v[Y]+1;tt&&ee<=v[Y]+Se-1;ee++)S[P+b[ee]]!==I&&(tt=0);tt?(v[Y]=qp(_),S[j+_]+=S[j+Y],S[j+Y]=0,S[N+Y]=-1,Y=S[O+Y],S[O+Ye]=Y):(Ye=Y,Y=S[O+Y])}}for(ee=ie,ve=ie;ve=0;Y--)S[j+Y]>0||(S[O+Y]=S[C+v[Y]],S[C+v[Y]]=Y);for(fe=h;fe>=0;fe--)S[j+fe]<=0||v[fe]!==-1&&(S[O+fe]=S[C+v[fe]],S[C+v[fe]]=fe);for(oe=0,_=0;_<=h;_++)v[_]===-1&&(oe=W4(_,oe,S,C,O,w,P));return w.splice(w.length-1,1),w};function i(u,c,f,d,p){var h=n(c);if(u===1&&d===f)return t(c,h);if(u===2){for(var m=h._index,g=h._ptr,A=0,b=0;bp))for(var x=g[b+1];vm)f[g+w]=0,f[p+w]=-1,x++,c[w]=qp(u),f[g+u]++;else{var k=f[A+S];k!==-1&&(b[k]=w),f[v+w]=f[A+S],f[A+S]=w}}return x}function s(u,c,f,d,p){if(u<2||u+c<0){for(var h=0;h{var{transpose:t}=e;return function(r,n,i,a){if(!r||!n||!i)return null;var o=r._size,s=o[0],l=o[1],u,c,f,d,p,h,m,g=4*l+(a?l+s+1:0),A=[],b=0,v=l,x=2*l,w=3*l,S=4*l,k=5*l+1;for(f=0;f=1&&j[c]++,D.jleaf===2&&j[D.q]--}n[c]!==-1&&(A[b+c]=n[c])}for(c=0;c{var{add:t,multiply:r,transpose:n}=e,i=Efe({add:t,multiply:r,transpose:n}),a=Cfe({transpose:n});return function(l,u,c){var f=u._ptr,d=u._size,p=d[1],h,m={};if(m.q=i(l,u),l&&!m.q)return null;if(c){var g=l?bfe(u,null,m.q,0):u;m.parent=wfe(g,1);var A=xfe(m.parent,p);if(m.cp=a(g,m.parent,A,1),g&&m.parent&&m.cp&&o(g,m))for(m.unz=0,h=0;h=0;k--)for(O=u[k],C=u[k+1],j=O;j=0;S--)m[S]=-1,k=g[S],k!==-1&&(A[w+k]++===0&&(A[x+k]=S),A[b+S]=A[v+k],A[v+k]=S);for(l.lnz=0,l.m2=d,k=0;k=0;){e=n[d];var p=i?i[e]:e;J6(o,e)||(H4(o,e),n[l+d]=p<0?0:OH(o[p]));var h=1;for(c=n[l+d],f=p<0?0:OH(o[p+1]);c{var{divideScalar:t,multiply:r,subtract:n}=e;return function(a,o,s,l,u,c,f){var d=a._values,p=a._index,h=a._ptr,m=a._size,g=m[1],A=o._values,b=o._index,v=o._ptr,x,w,S,k,j=Mfe(a,o,s,l,c);for(x=j;x{var{abs:t,divideScalar:r,multiply:n,subtract:i,larger:a,largerEq:o,SparseMatrix:s}=e,l=jfe({divideScalar:r,multiply:n,subtract:i});return function(c,f,d){if(!c)return null;var p=c._size,h=p[1],m,g=100,A=100;f&&(m=f.q,g=f.lnz||g,A=f.unz||A);var b=[],v=[],x=[],w=new s({values:b,index:v,ptr:x,size:[h,h]}),S=[],k=[],j=[],O=new s({values:S,index:k,ptr:j,size:[h,h]}),C=[],N,D,P=[],q=[];for(N=0;N{var{typed:t,abs:r,add:n,multiply:i,transpose:a,divideScalar:o,subtract:s,larger:l,largerEq:u,SparseMatrix:c}=e,f=Dfe({add:n,multiply:i,transpose:a}),d=Nfe({abs:r,divideScalar:o,multiply:i,subtract:s,larger:l,largerEq:u,SparseMatrix:c});return t(Tfe,{"SparseMatrix, number, number":function(h,m,g){if(!wt(m)||m<0||m>3)throw new Error("Symbolic Ordering and Analysis order must be an integer number in the interval [0, 3]");if(g<0||g>1)throw new Error("Partial pivoting threshold must be a number from 0 to 1");var A=f(m,h,!1),b=d(h,A,g);return{L:b.L,U:b.U,p:b.pinv,q:A.q,toString:function(){return"L: "+this.L.toString()+` +R: `+this.R.toString()}}}function A(v){var x=g(v),w=x.R._data;if(v._data.length>0)for(var S=w[0][0].type==="Complex"?m(0):0,k=0;k=0;){var l=r[o+s],u=r[n+l];u===-1?(s--,a[t++]=l):(r[n+l]=r[i+u],++s,r[o+s]=u)}return t}function xfe(e,t){if(!e)return null;var r=0,n,i=[],a=[],o=0,s=t,l=2*t;for(n=0;n=0;n--)e[n]!==-1&&(a[s+n]=a[o+e[n]],a[o+e[n]]=n);for(n=0;n{var{add:t,multiply:r,transpose:n}=e;return function(c,f){if(!f||c<=0||c>3)return null;var d=f._size,p=d[0],h=d[1],m=0,g=Math.max(16,10*Math.sqrt(h));g=Math.min(h-2,g);var A=i(c,f,p,h,g);Sfe(A,l,null);for(var b=A._index,v=A._ptr,x=v[h],w=[],S=[],k=0,j=h+1,O=2*(h+1),C=3*(h+1),N=4*(h+1),D=5*(h+1),P=6*(h+1),q=7*(h+1),z=w,I=a(h,v,S,k,C,z,O,q,j,P,N,D),T=o(h,v,S,D,N,P,g,j,C,z,O),L=0,_,Y,oe,te,Q,fe,Ie,Se,Oe,ve,ye,me,ke,$,ae,ce;TU?(fe=oe,Ie=ee,Se=S[k+oe]-U):(fe=b[ee++],Ie=v[fe],Se=S[k+fe]),Q=1;Q<=Se;Q++)_=b[Ie++],!((Oe=S[j+_])<=0)&&(J+=Oe,S[j+_]=-Oe,b[re++]=_,S[O+_]!==-1&&(z[S[O+_]]=z[_]),z[_]!==-1?S[O+z[_]]=S[O+_]:S[C+S[D+_]]=S[O+_]);fe!==oe&&(v[fe]=Lp(oe),S[P+fe]=0)}for(U!==0&&(x=re),S[D+oe]=J,v[oe]=ie,S[k+oe]=re-ie,S[N+oe]=-2,I=s(I,m,S,P,h),ve=ie;ve=I?S[P+fe]-=Oe:S[P+fe]!==0&&(S[P+fe]=S[D+fe]+Ee)}for(ve=ie;ve0?(ce+=Ce,b[$++]=fe,ae+=fe):(v[fe]=Lp(oe),S[P+fe]=0)}S[N+_]=$-me+1;var _e=$,he=me+S[k+_];for(ee=ke+1;ee=0))for(ae=z[_],_=S[q+ae],S[q+ae]=-1;_!==-1&&S[O+_]!==-1;_=S[O+_],I++){for(Se=S[k+_],ye=S[N+_],ee=v[_]+1;ee<=v[_]+Se-1;ee++)S[P+b[ee]]=I;var Ye=_;for(Y=S[O+_];Y!==-1;){var tt=S[k+Y]===Se&&S[N+Y]===ye;for(ee=v[Y]+1;tt&&ee<=v[Y]+Se-1;ee++)S[P+b[ee]]!==I&&(tt=0);tt?(v[Y]=Lp(_),S[j+_]+=S[j+Y],S[j+Y]=0,S[N+Y]=-1,Y=S[O+Y],S[O+Ye]=Y):(Ye=Y,Y=S[O+Y])}}for(ee=ie,ve=ie;ve=0;Y--)S[j+Y]>0||(S[O+Y]=S[C+v[Y]],S[C+v[Y]]=Y);for(fe=h;fe>=0;fe--)S[j+fe]<=0||v[fe]!==-1&&(S[O+fe]=S[C+v[fe]],S[C+v[fe]]=fe);for(oe=0,_=0;_<=h;_++)v[_]===-1&&(oe=W4(_,oe,S,C,O,w,P));return w.splice(w.length-1,1),w};function i(u,c,f,d,p){var h=n(c);if(u===1&&d===f)return t(c,h);if(u===2){for(var m=h._index,g=h._ptr,A=0,b=0;bp))for(var x=g[b+1];vm)f[g+w]=0,f[p+w]=-1,x++,c[w]=Lp(u),f[g+u]++;else{var k=f[A+S];k!==-1&&(b[k]=w),f[v+w]=f[A+S],f[A+S]=w}}return x}function s(u,c,f,d,p){if(u<2||u+c<0){for(var h=0;h{var{transpose:t}=e;return function(r,n,i,a){if(!r||!n||!i)return null;var o=r._size,s=o[0],l=o[1],u,c,f,d,p,h,m,g=4*l+(a?l+s+1:0),A=[],b=0,v=l,x=2*l,w=3*l,S=4*l,k=5*l+1;for(f=0;f=1&&j[c]++,D.jleaf===2&&j[D.q]--}n[c]!==-1&&(A[b+c]=n[c])}for(c=0;c{var{add:t,multiply:r,transpose:n}=e,i=Efe({add:t,multiply:r,transpose:n}),a=Cfe({transpose:n});return function(l,u,c){var f=u._ptr,d=u._size,p=d[1],h,m={};if(m.q=i(l,u),l&&!m.q)return null;if(c){var g=l?bfe(u,null,m.q,0):u;m.parent=wfe(g,1);var A=xfe(m.parent,p);if(m.cp=a(g,m.parent,A,1),g&&m.parent&&m.cp&&o(g,m))for(m.unz=0,h=0;h=0;k--)for(O=u[k],C=u[k+1],j=O;j=0;S--)m[S]=-1,k=g[S],k!==-1&&(A[w+k]++===0&&(A[x+k]=S),A[b+S]=A[v+k],A[v+k]=S);for(l.lnz=0,l.m2=d,k=0;k=0;){e=n[d];var p=i?i[e]:e;J6(o,e)||(H4(o,e),n[l+d]=p<0?0:OH(o[p]));var h=1;for(c=n[l+d],f=p<0?0:OH(o[p+1]);c{var{divideScalar:t,multiply:r,subtract:n}=e;return function(a,o,s,l,u,c,f){var d=a._values,p=a._index,h=a._ptr,m=a._size,g=m[1],A=o._values,b=o._index,v=o._ptr,x,w,S,k,j=Mfe(a,o,s,l,c);for(x=j;x{var{abs:t,divideScalar:r,multiply:n,subtract:i,larger:a,largerEq:o,SparseMatrix:s}=e,l=jfe({divideScalar:r,multiply:n,subtract:i});return function(c,f,d){if(!c)return null;var p=c._size,h=p[1],m,g=100,A=100;f&&(m=f.q,g=f.lnz||g,A=f.unz||A);var b=[],v=[],x=[],w=new s({values:b,index:v,ptr:x,size:[h,h]}),S=[],k=[],j=[],O=new s({values:S,index:k,ptr:j,size:[h,h]}),C=[],N,D,P=[],q=[];for(N=0;N{var{typed:t,abs:r,add:n,multiply:i,transpose:a,divideScalar:o,subtract:s,larger:l,largerEq:u,SparseMatrix:c}=e,f=Dfe({add:n,multiply:i,transpose:a}),d=Nfe({abs:r,divideScalar:o,multiply:i,subtract:s,larger:l,largerEq:u,SparseMatrix:c});return t(Tfe,{"SparseMatrix, number, number":function(h,m,g){if(!wt(m)||m<0||m>3)throw new Error("Symbolic Ordering and Analysis order must be an integer number in the interval [0, 3]");if(g<0||g>1)throw new Error("Partial pivoting threshold must be a number from 0 to 1");var A=f(m,h,!1),b=d(h,A,g);return{L:b.L,U:b.U,p:b.pinv,q:A.q,toString:function(){return"L: "+this.L.toString()+` U: `+this.U.toString()+` p: `+this.p.toString()+(this.q?` q: `+this.q.toString():"")+` @@ -121,15 +121,15 @@ q: `+this.q.toString():"")+` `),n.seealso&&n.seealso.length&&(i+="See also: "+n.seealso.join(", ")+` `),i},r.prototype.toJSON=function(){var n=Bt(this.doc);return n.mathjs="Help",n},r.fromJSON=function(n){var i={};return Object.keys(n).filter(a=>a!=="mathjs").forEach(a=>{i[a]=n[a]}),new r(i)},r.prototype.valueOf=r.prototype.toString,r},{isClass:!0});var $Ue="Chain",qUe=["?on","math","typed"],Z4=V($Ue,qUe,e=>{var{on:t,math:r,typed:n}=e;function i(u){if(!(this instanceof i))throw new SyntaxError("Constructor must be called with the new operator");Uw(u)?this.value=u.value:this.value=u}i.prototype.type="Chain",i.prototype.isChain=!0,i.prototype.done=function(){return this.value},i.prototype.valueOf=function(){return this.value},i.prototype.toString=function(){return tr(this.value)},i.prototype.toJSON=function(){return{mathjs:"Chain",value:this.value}},i.fromJSON=function(u){return new i(u.value)};function a(u,c){typeof c=="function"&&(i.prototype[u]=s(c))}function o(u,c){Hw(i.prototype,u,function(){var d=c();if(typeof d=="function")return s(d)})}function s(u){return function(){if(arguments.length===0)return new i(u(this.value));for(var c=[this.value],f=0;fu[h])};for(var d in u)f(d)}};var l={expression:!0,docs:!0,type:!0,classes:!0,json:!0,error:!0,isChain:!0};return i.createProxy(r),t&&t("import",function(u,c,f){f||o(u,c)}),i},{isClass:!0});var jH={name:"e",category:"Constants",syntax:["e"],description:"Euler's number, the base of the natural logarithm. Approximately equal to 2.71828",examples:["e","e ^ 2","exp(2)","log(e)"],seealso:["exp"]};var Pfe={name:"false",category:"Constants",syntax:["false"],description:"Boolean value false",examples:["false"],seealso:["true"]};var Ife={name:"i",category:"Constants",syntax:["i"],description:"Imaginary unit, defined as i*i=-1. A complex number is described as a + b*i, where a is the real part, and b is the imaginary part.",examples:["i","i * i","sqrt(-1)"],seealso:[]};var Bfe={name:"Infinity",category:"Constants",syntax:["Infinity"],description:"Infinity, a number which is larger than the maximum number that can be handled by a floating point number.",examples:["Infinity","1 / 0"],seealso:[]};var Rfe={name:"LN10",category:"Constants",syntax:["LN10"],description:"Returns the natural logarithm of 10, approximately equal to 2.302",examples:["LN10","log(10)"],seealso:[]};var $fe={name:"LN2",category:"Constants",syntax:["LN2"],description:"Returns the natural logarithm of 2, approximately equal to 0.693",examples:["LN2","log(2)"],seealso:[]};var qfe={name:"LOG10E",category:"Constants",syntax:["LOG10E"],description:"Returns the base-10 logarithm of E, approximately equal to 0.434",examples:["LOG10E","log(e, 10)"],seealso:[]};var Lfe={name:"LOG2E",category:"Constants",syntax:["LOG2E"],description:"Returns the base-2 logarithm of E, approximately equal to 1.442",examples:["LOG2E","log(e, 2)"],seealso:[]};var zfe={name:"NaN",category:"Constants",syntax:["NaN"],description:"Not a number",examples:["NaN","0 / 0"],seealso:[]};var Ufe={name:"null",category:"Constants",syntax:["null"],description:"Value null",examples:["null"],seealso:["true","false"]};var Wfe={name:"phi",category:"Constants",syntax:["phi"],description:"Phi is the golden ratio. Two quantities are in the golden ratio if their ratio is the same as the ratio of their sum to the larger of the two quantities. Phi is defined as `(1 + sqrt(5)) / 2` and is approximately 1.618034...",examples:["phi"],seealso:[]};var NH={name:"pi",category:"Constants",syntax:["pi"],description:"The number pi is a mathematical constant that is the ratio of a circle's circumference to its diameter, and is approximately equal to 3.14159",examples:["pi","sin(pi/2)"],seealso:["tau"]};var Hfe={name:"SQRT1_2",category:"Constants",syntax:["SQRT1_2"],description:"Returns the square root of 1/2, approximately equal to 0.707",examples:["SQRT1_2","sqrt(1/2)"],seealso:[]};var Vfe={name:"SQRT2",category:"Constants",syntax:["SQRT2"],description:"Returns the square root of 2, approximately equal to 1.414",examples:["SQRT2","sqrt(2)"],seealso:[]};var Gfe={name:"tau",category:"Constants",syntax:["tau"],description:"Tau is the ratio constant of a circle's circumference to radius, equal to 2 * pi, approximately 6.2832.",examples:["tau","2 * pi"],seealso:["pi"]};var Qfe={name:"true",category:"Constants",syntax:["true"],description:"Boolean value true",examples:["true"],seealso:["false"]};var Yfe={name:"version",category:"Constants",syntax:["version"],description:"A string with the version number of math.js",examples:["version"],seealso:[]};var Zfe={name:"bignumber",category:"Construction",syntax:["bignumber(x)"],description:"Create a big number from a number or string.",examples:["0.1 + 0.2","bignumber(0.1) + bignumber(0.2)",'bignumber("7.2")','bignumber("7.2e500")',"bignumber([0.1, 0.2, 0.3])"],seealso:["boolean","complex","fraction","index","matrix","string","unit"]};var Xfe={name:"boolean",category:"Construction",syntax:["x","boolean(x)"],description:"Convert a string or number into a boolean.",examples:["boolean(0)","boolean(1)","boolean(3)",'boolean("true")','boolean("false")',"boolean([1, 0, 1, 1])"],seealso:["bignumber","complex","index","matrix","number","string","unit"]};var Kfe={name:"complex",category:"Construction",syntax:["complex()","complex(re, im)","complex(string)"],description:"Create a complex number.",examples:["complex()","complex(2, 3)",'complex("7 - 2i")'],seealso:["bignumber","boolean","index","matrix","number","string","unit"]};var Jfe={name:"createUnit",category:"Construction",syntax:["createUnit(definitions)","createUnit(name, definition)"],description:"Create a user-defined unit and register it with the Unit type.",examples:['createUnit("foo")','createUnit("knot", {definition: "0.514444444 m/s", aliases: ["knots", "kt", "kts"]})','createUnit("mph", "1 mile/hour")'],seealso:["unit","splitUnit"]};var ede={name:"fraction",category:"Construction",syntax:["fraction(num)","fraction(matrix)","fraction(num,den)","fraction({n: num, d: den})"],description:"Create a fraction from a number or from integer numerator and denominator.",examples:["fraction(0.125)","fraction(1, 3) + fraction(2, 5)","fraction({n: 333, d: 53})","fraction([sqrt(9), sqrt(10), sqrt(11)])"],seealso:["bignumber","boolean","complex","index","matrix","string","unit"]};var tde={name:"index",category:"Construction",syntax:["[start]","[start:end]","[start:step:end]","[start1, start 2, ...]","[start1:end1, start2:end2, ...]","[start1:step1:end1, start2:step2:end2, ...]"],description:"Create an index to get or replace a subset of a matrix",examples:["A = [1, 2, 3; 4, 5, 6]","A[1, :]","A[1, 2] = 50","A[1:2, 1:2] = 1","B = [1, 2, 3]","B[B>1 and B<3]"],seealso:["bignumber","boolean","complex","matrix,","number","range","string","unit"]};var rde={name:"matrix",category:"Construction",syntax:["[]","[a1, b1, ...; a2, b2, ...]","matrix()",'matrix("dense")',"matrix([...])"],description:"Create a matrix.",examples:["[]","[1, 2, 3]","[1, 2, 3; 4, 5, 6]","matrix()","matrix([3, 4])",'matrix([3, 4; 5, 6], "sparse")','matrix([3, 4; 5, 6], "sparse", "number")'],seealso:["bignumber","boolean","complex","index","number","string","unit","sparse"]};var nde={name:"number",category:"Construction",syntax:["x","number(x)","number(unit, valuelessUnit)"],description:"Create a number or convert a string or boolean into a number.",examples:["2","2e3","4.05","number(2)",'number("7.2")',"number(true)","number([true, false, true, true])",'number(unit("52cm"), "m")'],seealso:["bignumber","boolean","complex","fraction","index","matrix","string","unit"]};var ide={name:"sparse",category:"Construction",syntax:["sparse()","sparse([a1, b1, ...; a1, b2, ...])",'sparse([a1, b1, ...; a1, b2, ...], "number")'],description:"Create a sparse matrix.",examples:["sparse()","sparse([3, 4; 5, 6])",'sparse([3, 0; 5, 0], "number")'],seealso:["bignumber","boolean","complex","index","number","string","unit","matrix"]};var ade={name:"splitUnit",category:"Construction",syntax:["splitUnit(unit: Unit, parts: Unit[])"],description:"Split a unit in an array of units whose sum is equal to the original unit.",examples:['splitUnit(1 m, ["feet", "inch"])'],seealso:["unit","createUnit"]};var ode={name:"string",category:"Construction",syntax:['"text"',"string(x)"],description:"Create a string or convert a value to a string",examples:['"Hello World!"',"string(4.2)","string(3 + 2i)"],seealso:["bignumber","boolean","complex","index","matrix","number","unit"]};var sde={name:"unit",category:"Construction",syntax:["value unit","unit(value, unit)","unit(string)"],description:"Create a unit.",examples:["5.5 mm","3 inch",'unit(7.1, "kilogram")','unit("23 deg")'],seealso:["bignumber","boolean","complex","index","matrix","number","string"]};var lde={name:"config",category:"Core",syntax:["config()","config(options)"],description:"Get configuration or change configuration.",examples:["config()","1/3 + 1/4",'config({number: "Fraction"})',"1/3 + 1/4"],seealso:[]};var ude={name:"import",category:"Core",syntax:["import(functions)","import(functions, options)"],description:"Import functions or constants from an object.",examples:["import({myFn: f(x)=x^2, myConstant: 32 })","myFn(2)","myConstant"],seealso:[]};var cde={name:"typed",category:"Core",syntax:["typed(signatures)","typed(name, signatures)"],description:"Create a typed function.",examples:['double = typed({ "number": f(x)=x+x, "string": f(x)=concat(x,x) })',"double(2)",'double("hello")'],seealso:[]};var fde={name:"derivative",category:"Algebra",syntax:["derivative(expr, variable)","derivative(expr, variable, {simplify: boolean})"],description:"Takes the derivative of an expression expressed in parser Nodes. The derivative will be taken over the supplied variable in the second parameter. If there are multiple variables in the expression, it will return a partial derivative.",examples:['derivative("2x^3", "x")','derivative("2x^3", "x", {simplify: false})','derivative("2x^2 + 3x + 4", "x")','derivative("sin(2x)", "x")','f = parse("x^2 + x")','x = parse("x")',"df = derivative(f, x)","df.evaluate({x: 3})"],seealso:["simplify","parse","evaluate"]};var dde={name:"leafCount",category:"Algebra",syntax:["leafCount(expr)"],description:"Computes the number of leaves in the parse tree of the given expression",examples:['leafCount("e^(i*pi)-1")','leafCount(parse("{a: 22/7, b: 10^(1/2)}"))'],seealso:["simplify"]};var pde={name:"lsolve",category:"Algebra",syntax:["x=lsolve(L, b)"],description:"Finds one solution of the linear system L * x = b where L is an [n x n] lower triangular matrix and b is a [n] column vector.",examples:["a = [-2, 3; 2, 1]","b = [11, 9]","x = lsolve(a, b)"],seealso:["lsolveAll","lup","lusolve","usolve","matrix","sparse"]};var mde={name:"lsolveAll",category:"Algebra",syntax:["x=lsolveAll(L, b)"],description:"Finds all solutions of the linear system L * x = b where L is an [n x n] lower triangular matrix and b is a [n] column vector.",examples:["a = [-2, 3; 2, 1]","b = [11, 9]","x = lsolve(a, b)"],seealso:["lsolve","lup","lusolve","usolve","matrix","sparse"]};var hde={name:"lup",category:"Algebra",syntax:["lup(m)"],description:"Calculate the Matrix LU decomposition with partial pivoting. Matrix A is decomposed in three matrices (L, U, P) where P * A = L * U",examples:["lup([[2, 1], [1, 4]])","lup(matrix([[2, 1], [1, 4]]))","lup(sparse([[2, 1], [1, 4]]))"],seealso:["lusolve","lsolve","usolve","matrix","sparse","slu","qr"]};var Ade={name:"lusolve",category:"Algebra",syntax:["x=lusolve(A, b)","x=lusolve(lu, b)"],description:"Solves the linear system A * x = b where A is an [n x n] matrix and b is a [n] column vector.",examples:["a = [-2, 3; 2, 1]","b = [11, 9]","x = lusolve(a, b)"],seealso:["lup","slu","lsolve","usolve","matrix","sparse"]};var gde={name:"polynomialRoot",category:"Algebra",syntax:["x=polynomialRoot(-6, 3)","x=polynomialRoot(4, -4, 1)","x=polynomialRoot(-8, 12, -6, 1)"],description:"Finds the roots of a univariate polynomial given by its coefficients starting from constant, linear, and so on, increasing in degree.",examples:["a = polynomialRoot(-6, 11, -6, 1)"],seealso:["cbrt","sqrt"]};var vde={name:"qr",category:"Algebra",syntax:["qr(A)"],description:"Calculates the Matrix QR decomposition. Matrix `A` is decomposed in two matrices (`Q`, `R`) where `Q` is an orthogonal matrix and `R` is an upper triangular matrix.",examples:["qr([[1, -1, 4], [1, 4, -2], [1, 4, 2], [1, -1, 0]])"],seealso:["lup","slu","matrix"]};var yde={name:"rationalize",category:"Algebra",syntax:["rationalize(expr)","rationalize(expr, scope)","rationalize(expr, scope, detailed)"],description:"Transform a rationalizable expression in a rational fraction. If rational fraction is one variable polynomial then converts the numerator and denominator in canonical form, with decreasing exponents, returning the coefficients of numerator.",examples:['rationalize("2x/y - y/(x+1)")','rationalize("2x/y - y/(x+1)", true)'],seealso:["simplify"]};var bde={name:"resolve",category:"Algebra",syntax:["resolve(node, scope)"],description:"Recursively substitute variables in an expression tree.",examples:['resolve(parse("1 + x"), { x: 7 })','resolve(parse("size(text)"), { text: "Hello World" })','resolve(parse("x + y"), { x: parse("3z") })','resolve(parse("3x"), { x: parse("y+z"), z: parse("w^y") })'],seealso:["simplify","evaluate"],mayThrow:["ReferenceError"]};var xde={name:"simplify",category:"Algebra",syntax:["simplify(expr)","simplify(expr, rules)"],description:"Simplify an expression tree.",examples:['simplify("3 + 2 / 4")','simplify("2x + x")','f = parse("x * (x + 2 + x)")',"simplified = simplify(f)","simplified.evaluate({x: 2})"],seealso:["simplifyCore","derivative","evaluate","parse","rationalize","resolve"]};var wde={name:"simplifyConstant",category:"Algebra",syntax:["simplifyConstant(expr)","simplifyConstant(expr, options)"],description:"Replace constant subexpressions of node with their values.",examples:['simplifyConstant("(3-3)*x")','simplifyConstant(parse("z-cos(tau/8)"))'],seealso:["simplify","simplifyCore","evaluate"]};var Sde={name:"simplifyCore",category:"Algebra",syntax:["simplifyCore(node)"],description:"Perform simple one-pass simplifications on an expression tree.",examples:['simplifyCore(parse("0*x"))','simplifyCore(parse("(x+0)*2"))'],seealso:["simplify","simplifyConstant","evaluate"]};var Ede={name:"slu",category:"Algebra",syntax:["slu(A, order, threshold)"],description:"Calculate the Matrix LU decomposition with full pivoting. Matrix A is decomposed in two matrices (L, U) and two permutation vectors (pinv, q) where P * A * Q = L * U",examples:["slu(sparse([4.5, 0, 3.2, 0; 3.1, 2.9, 0, 0.9; 0, 1.7, 3, 0; 3.5, 0.4, 0, 1]), 1, 0.001)"],seealso:["lusolve","lsolve","usolve","matrix","sparse","lup","qr"]};var kde={name:"symbolicEqual",category:"Algebra",syntax:["symbolicEqual(expr1, expr2)","symbolicEqual(expr1, expr2, options)"],description:"Returns true if the difference of the expressions simplifies to 0",examples:['symbolicEqual("x*y","y*x")','symbolicEqual("abs(x^2)", "x^2")','symbolicEqual("abs(x)", "x", {context: {abs: {trivial: true}}})'],seealso:["simplify","evaluate"]};var Cde={name:"usolve",category:"Algebra",syntax:["x=usolve(U, b)"],description:"Finds one solution of the linear system U * x = b where U is an [n x n] upper triangular matrix and b is a [n] column vector.",examples:["x=usolve(sparse([1, 1, 1, 1; 0, 1, 1, 1; 0, 0, 1, 1; 0, 0, 0, 1]), [1; 2; 3; 4])"],seealso:["usolveAll","lup","lusolve","lsolve","matrix","sparse"]};var Dde={name:"usolveAll",category:"Algebra",syntax:["x=usolve(U, b)"],description:"Finds all solutions of the linear system U * x = b where U is an [n x n] upper triangular matrix and b is a [n] column vector.",examples:["x=usolve(sparse([1, 1, 1, 1; 0, 1, 1, 1; 0, 0, 1, 1; 0, 0, 0, 1]), [1; 2; 3; 4])"],seealso:["usolve","lup","lusolve","lsolve","matrix","sparse"]};var Ode={name:"abs",category:"Arithmetic",syntax:["abs(x)"],description:"Compute the absolute value.",examples:["abs(3.5)","abs(-4.2)"],seealso:["sign"]};var Mde={name:"add",category:"Operators",syntax:["x + y","add(x, y)"],description:"Add two values.",examples:["a = 2.1 + 3.6","a - 3.6","3 + 2i","3 cm + 2 inch",'"2.3" + "4"'],seealso:["subtract"]};var jde={name:"cbrt",category:"Arithmetic",syntax:["cbrt(x)","cbrt(x, allRoots)"],description:"Compute the cubic root value. If x = y * y * y, then y is the cubic root of x. When `x` is a number or complex number, an optional second argument `allRoots` can be provided to return all three cubic roots. If not provided, the principal root is returned",examples:["cbrt(64)","cube(4)","cbrt(-8)","cbrt(2 + 3i)","cbrt(8i)","cbrt(8i, true)","cbrt(27 m^3)"],seealso:["square","sqrt","cube","multiply"]};var Nde={name:"ceil",category:"Arithmetic",syntax:["ceil(x)"],description:"Round a value towards plus infinity. If x is complex, both real and imaginary part are rounded towards plus infinity.",examples:["ceil(3.2)","ceil(3.8)","ceil(-4.2)"],seealso:["floor","fix","round"]};var Tde={name:"cube",category:"Arithmetic",syntax:["cube(x)"],description:"Compute the cube of a value. The cube of x is x * x * x.",examples:["cube(2)","2^3","2 * 2 * 2"],seealso:["multiply","square","pow"]};var Fde={name:"divide",category:"Operators",syntax:["x / y","divide(x, y)"],description:"Divide two values.",examples:["a = 2 / 3","a * 3","4.5 / 2","3 + 4 / 2","(3 + 4) / 2","18 km / 4.5"],seealso:["multiply"]};var _de={name:"dotDivide",category:"Operators",syntax:["x ./ y","dotDivide(x, y)"],description:"Divide two values element wise.",examples:["a = [1, 2, 3; 4, 5, 6]","b = [2, 1, 1; 3, 2, 5]","a ./ b"],seealso:["multiply","dotMultiply","divide"]};var Pde={name:"dotMultiply",category:"Operators",syntax:["x .* y","dotMultiply(x, y)"],description:"Multiply two values element wise.",examples:["a = [1, 2, 3; 4, 5, 6]","b = [2, 1, 1; 3, 2, 5]","a .* b"],seealso:["multiply","divide","dotDivide"]};var Ide={name:"dotPow",category:"Operators",syntax:["x .^ y","dotPow(x, y)"],description:"Calculates the power of x to y element wise.",examples:["a = [1, 2, 3; 4, 5, 6]","a .^ 2"],seealso:["pow"]};var Bde={name:"exp",category:"Arithmetic",syntax:["exp(x)"],description:"Calculate the exponent of a value.",examples:["exp(1.3)","e ^ 1.3","log(exp(1.3))","x = 2.4","(exp(i*x) == cos(x) + i*sin(x)) # Euler's formula"],seealso:["expm","expm1","pow","log"]};var Rde={name:"expm",category:"Arithmetic",syntax:["exp(x)"],description:"Compute the matrix exponential, expm(A) = e^A. The matrix must be square. Not to be confused with exp(a), which performs element-wise exponentiation.",examples:["expm([[0,2],[0,0]])"],seealso:["exp"]};var $de={name:"expm1",category:"Arithmetic",syntax:["expm1(x)"],description:"Calculate the value of subtracting 1 from the exponential value.",examples:["expm1(2)","pow(e, 2) - 1","log(expm1(2) + 1)"],seealso:["exp","pow","log"]};var qde={name:"fix",category:"Arithmetic",syntax:["fix(x)"],description:"Round a value towards zero. If x is complex, both real and imaginary part are rounded towards zero.",examples:["fix(3.2)","fix(3.8)","fix(-4.2)","fix(-4.8)"],seealso:["ceil","floor","round"]};var Lde={name:"floor",category:"Arithmetic",syntax:["floor(x)"],description:"Round a value towards minus infinity.If x is complex, both real and imaginary part are rounded towards minus infinity.",examples:["floor(3.2)","floor(3.8)","floor(-4.2)"],seealso:["ceil","fix","round"]};var zde={name:"gcd",category:"Arithmetic",syntax:["gcd(a, b)","gcd(a, b, c, ...)"],description:"Compute the greatest common divisor.",examples:["gcd(8, 12)","gcd(-4, 6)","gcd(25, 15, -10)"],seealso:["lcm","xgcd"]};var Ude={name:"hypot",category:"Arithmetic",syntax:["hypot(a, b, c, ...)","hypot([a, b, c, ...])"],description:"Calculate the hypotenusa of a list with values. ",examples:["hypot(3, 4)","sqrt(3^2 + 4^2)","hypot(-2)","hypot([3, 4, 5])"],seealso:["abs","norm"]};var Wde={name:"invmod",category:"Arithmetic",syntax:["invmod(a, b)"],description:"Calculate the (modular) multiplicative inverse of a modulo b. Solution to the equation ax \u2263 1 (mod b)",examples:["invmod(8, 12)","invmod(7, 13)","invmod(15151, 15122)"],seealso:["gcd","xgcd"]};var Hde={name:"lcm",category:"Arithmetic",syntax:["lcm(x, y)"],description:"Compute the least common multiple.",examples:["lcm(4, 6)","lcm(6, 21)","lcm(6, 21, 5)"],seealso:["gcd"]};var Vde={name:"log",category:"Arithmetic",syntax:["log(x)","log(x, base)"],description:"Compute the logarithm of a value. If no base is provided, the natural logarithm of x is calculated. If base if provided, the logarithm is calculated for the specified base. log(x, base) is defined as log(x) / log(base).",examples:["log(3.5)","a = log(2.4)","exp(a)","10 ^ 4","log(10000, 10)","log(10000) / log(10)","b = log(1024, 2)","2 ^ b"],seealso:["exp","log1p","log2","log10"]};var Gde={name:"log10",category:"Arithmetic",syntax:["log10(x)"],description:"Compute the 10-base logarithm of a value.",examples:["log10(0.00001)","log10(10000)","10 ^ 4","log(10000) / log(10)","log(10000, 10)"],seealso:["exp","log"]};var Qde={name:"log1p",category:"Arithmetic",syntax:["log1p(x)","log1p(x, base)"],description:"Calculate the logarithm of a `value+1`",examples:["log1p(2.5)","exp(log1p(1.4))","pow(10, 4)","log1p(9999, 10)","log1p(9999) / log(10)"],seealso:["exp","log","log2","log10"]};var Yde={name:"log2",category:"Arithmetic",syntax:["log2(x)"],description:"Calculate the 2-base of a value. This is the same as calculating `log(x, 2)`.",examples:["log2(0.03125)","log2(16)","log2(16) / log2(2)","pow(2, 4)"],seealso:["exp","log1p","log","log10"]};var Zde={name:"mod",category:"Operators",syntax:["x % y","x mod y","mod(x, y)"],description:"Calculates the modulus, the remainder of an integer division.",examples:["7 % 3","11 % 2","10 mod 4","isOdd(x) = x % 2","isOdd(2)","isOdd(3)"],seealso:["divide"]};var Xde={name:"multiply",category:"Operators",syntax:["x * y","multiply(x, y)"],description:"multiply two values.",examples:["a = 2.1 * 3.4","a / 3.4","2 * 3 + 4","2 * (3 + 4)","3 * 2.1 km"],seealso:["divide"]};var Kde={name:"norm",category:"Arithmetic",syntax:["norm(x)","norm(x, p)"],description:"Calculate the norm of a number, vector or matrix.",examples:["abs(-3.5)","norm(-3.5)","norm(3 - 4i)","norm([1, 2, -3], Infinity)","norm([1, 2, -3], -Infinity)","norm([3, 4], 2)","norm([[1, 2], [3, 4]], 1)",'norm([[1, 2], [3, 4]], "inf")','norm([[1, 2], [3, 4]], "fro")']};var Jde={name:"nthRoot",category:"Arithmetic",syntax:["nthRoot(a)","nthRoot(a, root)"],description:'Calculate the nth root of a value. The principal nth root of a positive real number A, is the positive real solution of the equation "x^root = A".',examples:["4 ^ 3","nthRoot(64, 3)","nthRoot(9, 2)","sqrt(9)"],seealso:["nthRoots","pow","sqrt"]};var epe={name:"nthRoots",category:"Arithmetic",syntax:["nthRoots(A)","nthRoots(A, root)"],description:'Calculate the nth roots of a value. An nth root of a positive real number A, is a positive real solution of the equation "x^root = A". This function returns an array of complex values.',examples:["nthRoots(1)","nthRoots(1, 3)"],seealso:["sqrt","pow","nthRoot"]};var tpe={name:"pow",category:"Operators",syntax:["x ^ y","pow(x, y)"],description:"Calculates the power of x to y, x^y.",examples:["2^3","2*2*2","1 + e ^ (pi * i)","pow([[1, 2], [4, 3]], 2)","pow([[1, 2], [4, 3]], -1)"],seealso:["multiply","nthRoot","nthRoots","sqrt"]};var rpe={name:"round",category:"Arithmetic",syntax:["round(x)","round(x, n)","round(unit, valuelessUnit)","round(unit, n, valuelessUnit)"],description:"round a value towards the nearest integer.If x is complex, both real and imaginary part are rounded towards the nearest integer. When n is specified, the value is rounded to n decimals.",examples:["round(3.2)","round(3.8)","round(-4.2)","round(-4.8)","round(pi, 3)","round(123.45678, 2)","round(3.241cm, 2, cm)","round([3.2, 3.8, -4.7])"],seealso:["ceil","floor","fix"]};var npe={name:"sign",category:"Arithmetic",syntax:["sign(x)"],description:"Compute the sign of a value. The sign of a value x is 1 when x>1, -1 when x<0, and 0 when x=0.",examples:["sign(3.5)","sign(-4.2)","sign(0)"],seealso:["abs"]};var ipe={name:"sqrt",category:"Arithmetic",syntax:["sqrt(x)"],description:"Compute the square root value. If x = y * y, then y is the square root of x.",examples:["sqrt(25)","5 * 5","sqrt(-1)"],seealso:["square","sqrtm","multiply","nthRoot","nthRoots","pow"]};var ape={name:"sqrtm",category:"Arithmetic",syntax:["sqrtm(x)"],description:"Calculate the principal square root of a square matrix. The principal square root matrix `X` of another matrix `A` is such that `X * X = A`.",examples:["sqrtm([[33, 24], [48, 57]])"],seealso:["sqrt","abs","square","multiply"]};var ope={name:"sylvester",category:"Algebra",syntax:["sylvester(A,B,C)"],description:"Solves the real-valued Sylvester equation AX+XB=C for X",examples:["sylvester([[-1, -2], [1, 1]], [[-2, 1], [-1, 2]], [[-3, 2], [3, 0]])","A = [[-1, -2], [1, 1]]; B = [[2, -1], [1, -2]]; C = [[-3, 2], [3, 0]]","sylvester(A, B, C)"],seealso:["schur","lyap"]};var spe={name:"schur",category:"Algebra",syntax:["schur(A)"],description:"Performs a real Schur decomposition of the real matrix A = UTU'",examples:["schur([[1, 0], [-4, 3]])","A = [[1, 0], [-4, 3]]","schur(A)"],seealso:["lyap","sylvester"]};var lpe={name:"lyap",category:"Algebra",syntax:["lyap(A,Q)"],description:"Solves the Continuous-time Lyapunov equation AP+PA'+Q=0 for P",examples:["lyap([[-2, 0], [1, -4]], [[3, 1], [1, 3]])","A = [[-2, 0], [1, -4]]","Q = [[3, 1], [1, 3]]","lyap(A,Q)"],seealso:["schur","sylvester"]};var upe={name:"square",category:"Arithmetic",syntax:["square(x)"],description:"Compute the square of a value. The square of x is x * x.",examples:["square(3)","sqrt(9)","3^2","3 * 3"],seealso:["multiply","pow","sqrt","cube"]};var cpe={name:"subtract",category:"Operators",syntax:["x - y","subtract(x, y)"],description:"subtract two values.",examples:["a = 5.3 - 2","a + 2","2/3 - 1/6","2 * 3 - 3","2.1 km - 500m"],seealso:["add"]};var fpe={name:"unaryMinus",category:"Operators",syntax:["-x","unaryMinus(x)"],description:"Inverse the sign of a value. Converts booleans and strings to numbers.",examples:["-4.5","-(-5.6)",'-"22"'],seealso:["add","subtract","unaryPlus"]};var dpe={name:"unaryPlus",category:"Operators",syntax:["+x","unaryPlus(x)"],description:"Converts booleans and strings to numbers.",examples:["+true",'+"2"'],seealso:["add","subtract","unaryMinus"]};var ppe={name:"xgcd",category:"Arithmetic",syntax:["xgcd(a, b)"],description:"Calculate the extended greatest common divisor for two values. The result is an array [d, x, y] with 3 entries, where d is the greatest common divisor, and d = x * a + y * b.",examples:["xgcd(8, 12)","gcd(8, 12)","xgcd(36163, 21199)"],seealso:["gcd","lcm"]};var mpe={name:"bitAnd",category:"Bitwise",syntax:["x & y","bitAnd(x, y)"],description:"Bitwise AND operation. Performs the logical AND operation on each pair of the corresponding bits of the two given values by multiplying them. If both bits in the compared position are 1, the bit in the resulting binary representation is 1, otherwise, the result is 0",examples:["5 & 3","bitAnd(53, 131)","[1, 12, 31] & 42"],seealso:["bitNot","bitOr","bitXor","leftShift","rightArithShift","rightLogShift"]};var hpe={name:"bitNot",category:"Bitwise",syntax:["~x","bitNot(x)"],description:"Bitwise NOT operation. Performs a logical negation on each bit of the given value. Bits that are 0 become 1, and those that are 1 become 0.",examples:["~1","~2","bitNot([2, -3, 4])"],seealso:["bitAnd","bitOr","bitXor","leftShift","rightArithShift","rightLogShift"]};var Ape={name:"bitOr",category:"Bitwise",syntax:["x | y","bitOr(x, y)"],description:"Bitwise OR operation. Performs the logical inclusive OR operation on each pair of corresponding bits of the two given values. The result in each position is 1 if the first bit is 1 or the second bit is 1 or both bits are 1, otherwise, the result is 0.",examples:["5 | 3","bitOr([1, 2, 3], 4)"],seealso:["bitAnd","bitNot","bitXor","leftShift","rightArithShift","rightLogShift"]};var gpe={name:"bitXor",category:"Bitwise",syntax:["bitXor(x, y)"],description:"Bitwise XOR operation, exclusive OR. Performs the logical exclusive OR operation on each pair of corresponding bits of the two given values. The result in each position is 1 if only the first bit is 1 or only the second bit is 1, but will be 0 if both are 0 or both are 1.",examples:["bitOr(1, 2)","bitXor([2, 3, 4], 4)"],seealso:["bitAnd","bitNot","bitOr","leftShift","rightArithShift","rightLogShift"]};var vpe={name:"leftShift",category:"Bitwise",syntax:["x << y","leftShift(x, y)"],description:"Bitwise left logical shift of a value x by y number of bits.",examples:["4 << 1","8 >> 1"],seealso:["bitAnd","bitNot","bitOr","bitXor","rightArithShift","rightLogShift"]};var ype={name:"rightArithShift",category:"Bitwise",syntax:["x >> y","rightArithShift(x, y)"],description:"Bitwise right arithmetic shift of a value x by y number of bits.",examples:["8 >> 1","4 << 1","-12 >> 2"],seealso:["bitAnd","bitNot","bitOr","bitXor","leftShift","rightLogShift"]};var bpe={name:"rightLogShift",category:"Bitwise",syntax:["x >>> y","rightLogShift(x, y)"],description:"Bitwise right logical shift of a value x by y number of bits.",examples:["8 >>> 1","4 << 1","-12 >>> 2"],seealso:["bitAnd","bitNot","bitOr","bitXor","leftShift","rightArithShift"]};var xpe={name:"bellNumbers",category:"Combinatorics",syntax:["bellNumbers(n)"],description:"The Bell Numbers count the number of partitions of a set. A partition is a pairwise disjoint subset of S whose union is S. `bellNumbers` only takes integer arguments. The following condition must be enforced: n >= 0.",examples:["bellNumbers(3)","bellNumbers(8)"],seealso:["stirlingS2"]};var wpe={name:"catalan",category:"Combinatorics",syntax:["catalan(n)"],description:"The Catalan Numbers enumerate combinatorial structures of many different types. catalan only takes integer arguments. The following condition must be enforced: n >= 0.",examples:["catalan(3)","catalan(8)"],seealso:["bellNumbers"]};var Spe={name:"composition",category:"Combinatorics",syntax:["composition(n, k)"],description:"The composition counts of n into k parts. composition only takes integer arguments. The following condition must be enforced: k <= n.",examples:["composition(5, 3)"],seealso:["combinations"]};var Epe={name:"stirlingS2",category:"Combinatorics",syntax:["stirlingS2(n, k)"],description:"he Stirling numbers of the second kind, counts the number of ways to partition a set of n labelled objects into k nonempty unlabelled subsets. `stirlingS2` only takes integer arguments. The following condition must be enforced: k <= n. If n = k or k = 1, then s(n,k) = 1.",examples:["stirlingS2(5, 3)"],seealso:["bellNumbers"]};var kpe={name:"arg",category:"Complex",syntax:["arg(x)"],description:"Compute the argument of a complex value. If x = a+bi, the argument is computed as atan2(b, a).",examples:["arg(2 + 2i)","atan2(3, 2)","arg(2 + 3i)"],seealso:["re","im","conj","abs"]};var Cpe={name:"conj",category:"Complex",syntax:["conj(x)"],description:"Compute the complex conjugate of a complex value. If x = a+bi, the complex conjugate is a-bi.",examples:["conj(2 + 3i)","conj(2 - 3i)","conj(-5.2i)"],seealso:["re","im","abs","arg"]};var Dpe={name:"im",category:"Complex",syntax:["im(x)"],description:"Get the imaginary part of a complex number.",examples:["im(2 + 3i)","re(2 + 3i)","im(-5.2i)","im(2.4)"],seealso:["re","conj","abs","arg"]};var Ope={name:"re",category:"Complex",syntax:["re(x)"],description:"Get the real part of a complex number.",examples:["re(2 + 3i)","im(2 + 3i)","re(-5.2i)","re(2.4)"],seealso:["im","conj","abs","arg"]};var Mpe={name:"evaluate",category:"Expression",syntax:["evaluate(expression)","evaluate(expression, scope)","evaluate([expr1, expr2, expr3, ...])","evaluate([expr1, expr2, expr3, ...], scope)"],description:"Evaluate an expression or an array with expressions.",examples:['evaluate("2 + 3")','evaluate("sqrt(16)")','evaluate("2 inch to cm")','evaluate("sin(x * pi)", { "x": 1/2 })','evaluate(["width=2", "height=4","width*height"])'],seealso:[]};var jpe={name:"help",category:"Expression",syntax:["help(object)","help(string)"],description:"Display documentation on a function or data type.",examples:["help(sqrt)",'help("complex")'],seealso:[]};var Npe={name:"distance",category:"Geometry",syntax:["distance([x1, y1], [x2, y2])","distance([[x1, y1], [x2, y2]])"],description:"Calculates the Euclidean distance between two points.",examples:["distance([0,0], [4,4])","distance([[0,0], [4,4]])"],seealso:[]};var Tpe={name:"intersect",category:"Geometry",syntax:["intersect(expr1, expr2, expr3, expr4)","intersect(expr1, expr2, expr3)"],description:"Computes the intersection point of lines and/or planes.",examples:["intersect([0, 0], [10, 10], [10, 0], [0, 10])","intersect([1, 0, 1], [4, -2, 2], [1, 1, 1, 6])"],seealso:[]};var Fpe={name:"and",category:"Logical",syntax:["x and y","and(x, y)"],description:"Logical and. Test whether two values are both defined with a nonzero/nonempty value.",examples:["true and false","true and true","2 and 4"],seealso:["not","or","xor"]};var _pe={name:"not",category:"Logical",syntax:["not x","not(x)"],description:"Logical not. Flips the boolean value of given argument.",examples:["not true","not false","not 2","not 0"],seealso:["and","or","xor"]};var Ppe={name:"or",category:"Logical",syntax:["x or y","or(x, y)"],description:"Logical or. Test if at least one value is defined with a nonzero/nonempty value.",examples:["true or false","false or false","0 or 4"],seealso:["not","and","xor"]};var Ipe={name:"xor",category:"Logical",syntax:["x xor y","xor(x, y)"],description:"Logical exclusive or, xor. Test whether one and only one value is defined with a nonzero/nonempty value.",examples:["true xor false","false xor false","true xor true","0 xor 4"],seealso:["not","and","or"]};var Bpe={name:"column",category:"Matrix",syntax:["column(x, index)"],description:"Return a column from a matrix or array.",examples:["A = [[1, 2], [3, 4]]","column(A, 1)","column(A, 2)"],seealso:["row","matrixFromColumns"]};var Rpe={name:"concat",category:"Matrix",syntax:["concat(A, B, C, ...)","concat(A, B, C, ..., dim)"],description:"Concatenate matrices. By default, the matrices are concatenated by the last dimension. The dimension on which to concatenate can be provided as last argument.",examples:["A = [1, 2; 5, 6]","B = [3, 4; 7, 8]","concat(A, B)","concat(A, B, 1)","concat(A, B, 2)"],seealso:["det","diag","identity","inv","ones","range","size","squeeze","subset","trace","transpose","zeros"]};var $pe={name:"count",category:"Matrix",syntax:["count(x)"],description:"Count the number of elements of a matrix, array or string.",examples:["a = [1, 2; 3, 4; 5, 6]","count(a)","size(a)",'count("hello world")'],seealso:["size"]};var qpe={name:"cross",category:"Matrix",syntax:["cross(A, B)"],description:"Calculate the cross product for two vectors in three dimensional space.",examples:["cross([1, 1, 0], [0, 1, 1])","cross([3, -3, 1], [4, 9, 2])","cross([2, 3, 4], [5, 6, 7])"],seealso:["multiply","dot"]};var Lpe={name:"ctranspose",category:"Matrix",syntax:["x'","ctranspose(x)"],description:"Complex Conjugate and Transpose a matrix",examples:["a = [1, 2, 3; 4, 5, 6]","a'","ctranspose(a)"],seealso:["concat","det","diag","identity","inv","ones","range","size","squeeze","subset","trace","zeros"]};var zpe={name:"det",category:"Matrix",syntax:["det(x)"],description:"Calculate the determinant of a matrix",examples:["det([1, 2; 3, 4])","det([-2, 2, 3; -1, 1, 3; 2, 0, -1])"],seealso:["concat","diag","identity","inv","ones","range","size","squeeze","subset","trace","transpose","zeros"]};var Upe={name:"diag",category:"Matrix",syntax:["diag(x)","diag(x, k)"],description:"Create a diagonal matrix or retrieve the diagonal of a matrix. When x is a vector, a matrix with the vector values on the diagonal will be returned. When x is a matrix, a vector with the diagonal values of the matrix is returned. When k is provided, the k-th diagonal will be filled in or retrieved, if k is positive, the values are placed on the super diagonal. When k is negative, the values are placed on the sub diagonal.",examples:["diag(1:3)","diag(1:3, 1)","a = [1, 2, 3; 4, 5, 6; 7, 8, 9]","diag(a)"],seealso:["concat","det","identity","inv","ones","range","size","squeeze","subset","trace","transpose","zeros"]};var Wpe={name:"diff",category:"Matrix",syntax:["diff(arr)","diff(arr, dim)"],description:["Create a new matrix or array with the difference of the passed matrix or array.","Dim parameter is optional and used to indicant the dimension of the array/matrix to apply the difference","If no dimension parameter is passed it is assumed as dimension 0","Dimension is zero-based in javascript and one-based in the parser","Arrays must be 'rectangular' meaning arrays like [1, 2]","If something is passed as a matrix it will be returned as a matrix but other than that all matrices are converted to arrays"],examples:["A = [1, 2, 4, 7, 0]","diff(A)","diff(A, 1)","B = [[1, 2], [3, 4]]","diff(B)","diff(B, 1)","diff(B, 2)","diff(B, bignumber(2))","diff([[1, 2], matrix([3, 4])], 2)"],seealso:["subtract","partitionSelect"]};var Hpe={name:"dot",category:"Matrix",syntax:["dot(A, B)","A * B"],description:"Calculate the dot product of two vectors. The dot product of A = [a1, a2, a3, ..., an] and B = [b1, b2, b3, ..., bn] is defined as dot(A, B) = a1 * b1 + a2 * b2 + a3 * b3 + ... + an * bn",examples:["dot([2, 4, 1], [2, 2, 3])","[2, 4, 1] * [2, 2, 3]"],seealso:["multiply","cross"]};var Vpe={name:"eigs",category:"Matrix",syntax:["eigs(x)"],description:"Calculate the eigenvalues and optionally eigenvectors of a square matrix",examples:["eigs([[5, 2.3], [2.3, 1]])","eigs([[1, 2, 3], [4, 5, 6], [7, 8, 9]], { precision: 1e-6, eigenvectors: false })"],seealso:["inv"]};var Gpe={name:"filter",category:"Matrix",syntax:["filter(x, test)"],description:"Filter items in a matrix.",examples:["isPositive(x) = x > 0","filter([6, -2, -1, 4, 3], isPositive)","filter([6, -2, 0, 1, 0], x != 0)"],seealso:["sort","map","forEach"]};var Qpe={name:"flatten",category:"Matrix",syntax:["flatten(x)"],description:"Flatten a multi dimensional matrix into a single dimensional matrix.",examples:["a = [1, 2, 3; 4, 5, 6]","size(a)","b = flatten(a)","size(b)"],seealso:["concat","resize","size","squeeze"]};var Ype={name:"forEach",category:"Matrix",syntax:["forEach(x, callback)"],description:"Iterates over all elements of a matrix/array, and executes the given callback function.",examples:["numberOfPets = {}","addPet(n) = numberOfPets[n] = (numberOfPets[n] ? numberOfPets[n]:0 ) + 1;",'forEach(["Dog","Cat","Cat"], addPet)',"numberOfPets"],seealso:["map","sort","filter"]};var Zpe={name:"getMatrixDataType",category:"Matrix",syntax:["getMatrixDataType(x)"],description:'Find the data type of all elements in a matrix or array, for example "number" if all items are a number and "Complex" if all values are complex numbers. If a matrix contains more than one data type, it will return "mixed".',examples:["getMatrixDataType([1, 2, 3])","getMatrixDataType([[5 cm], [2 inch]])",'getMatrixDataType([1, "text"])',"getMatrixDataType([1, bignumber(4)])"],seealso:["matrix","sparse","typeOf"]};var Xpe={name:"identity",category:"Matrix",syntax:["identity(n)","identity(m, n)","identity([m, n])"],description:"Returns the identity matrix with size m-by-n. The matrix has ones on the diagonal and zeros elsewhere.",examples:["identity(3)","identity(3, 5)","a = [1, 2, 3; 4, 5, 6]","identity(size(a))"],seealso:["concat","det","diag","inv","ones","range","size","squeeze","subset","trace","transpose","zeros"]};var Kpe={name:"inv",category:"Matrix",syntax:["inv(x)"],description:"Calculate the inverse of a matrix",examples:["inv([1, 2; 3, 4])","inv(4)","1 / 4"],seealso:["concat","det","diag","identity","ones","range","size","squeeze","subset","trace","transpose","zeros"]};var Jpe={name:"pinv",category:"Matrix",syntax:["pinv(x)"],description:"Calculate the Moore\u2013Penrose inverse of a matrix",examples:["pinv([1, 2; 3, 4])","pinv([[1, 0], [0, 1], [0, 1]])","pinv(4)"],seealso:["inv"]};var eme={name:"kron",category:"Matrix",syntax:["kron(x, y)"],description:"Calculates the kronecker product of 2 matrices or vectors.",examples:["kron([[1, 0], [0, 1]], [[1, 2], [3, 4]])","kron([1,1], [2,3,4])"],seealso:["multiply","dot","cross"]};var tme={name:"map",category:"Matrix",syntax:["map(x, callback)"],description:"Create a new matrix or array with the results of the callback function executed on each entry of the matrix/array.",examples:["map([1, 2, 3], square)"],seealso:["filter","forEach"]};var rme={name:"matrixFromColumns",category:"Matrix",syntax:["matrixFromColumns(...arr)","matrixFromColumns(row1, row2)","matrixFromColumns(row1, row2, row3)"],description:"Create a dense matrix from vectors as individual columns.",examples:["matrixFromColumns([1, 2, 3], [[4],[5],[6]])"],seealso:["matrix","matrixFromRows","matrixFromFunction","zeros"]};var nme={name:"matrixFromFunction",category:"Matrix",syntax:["matrixFromFunction(size, fn)","matrixFromFunction(size, fn, format)","matrixFromFunction(size, fn, format, datatype)","matrixFromFunction(size, format, fn)","matrixFromFunction(size, format, datatype, fn)"],description:"Create a matrix by evaluating a generating function at each index.",examples:["f(I) = I[1] - I[2]","matrixFromFunction([3,3], f)","g(I) = I[1] - I[2] == 1 ? 4 : 0",'matrixFromFunction([100, 100], "sparse", g)',"matrixFromFunction([5], random)"],seealso:["matrix","matrixFromRows","matrixFromColumns","zeros"]};var ime={name:"matrixFromRows",category:"Matrix",syntax:["matrixFromRows(...arr)","matrixFromRows(row1, row2)","matrixFromRows(row1, row2, row3)"],description:"Create a dense matrix from vectors as individual rows.",examples:["matrixFromRows([1, 2, 3], [[4],[5],[6]])"],seealso:["matrix","matrixFromColumns","matrixFromFunction","zeros"]};var ame={name:"ones",category:"Matrix",syntax:["ones(m)","ones(m, n)","ones(m, n, p, ...)","ones([m])","ones([m, n])","ones([m, n, p, ...])"],description:"Create a matrix containing ones.",examples:["ones(3)","ones(3, 5)","ones([2,3]) * 4.5","a = [1, 2, 3; 4, 5, 6]","ones(size(a))"],seealso:["concat","det","diag","identity","inv","range","size","squeeze","subset","trace","transpose","zeros"]};var ome={name:"partitionSelect",category:"Matrix",syntax:["partitionSelect(x, k)","partitionSelect(x, k, compare)"],description:"Partition-based selection of an array or 1D matrix. Will find the kth smallest value, and mutates the input array. Uses Quickselect.",examples:["partitionSelect([5, 10, 1], 2)",'partitionSelect(["C", "B", "A", "D"], 1, compareText)',"arr = [5, 2, 1]","partitionSelect(arr, 0) # returns 1, arr is now: [1, 2, 5]","arr","partitionSelect(arr, 1, 'desc') # returns 2, arr is now: [5, 2, 1]","arr"],seealso:["sort"]};var sme={name:"range",category:"Type",syntax:["start:end","start:step:end","range(start, end)","range(start, end, step)","range(string)"],description:"Create a range. Lower bound of the range is included, upper bound is excluded.",examples:["1:5","3:-1:-3","range(3, 7)","range(0, 12, 2)",'range("4:10")',"range(1m, 1m, 3m)","a = [1, 2, 3, 4; 5, 6, 7, 8]","a[1:2, 1:2]"],seealso:["concat","det","diag","identity","inv","ones","size","squeeze","subset","trace","transpose","zeros"]};var lme={name:"reshape",category:"Matrix",syntax:["reshape(x, sizes)"],description:"Reshape a multi dimensional array to fit the specified dimensions.",examples:["reshape([1, 2, 3, 4, 5, 6], [2, 3])","reshape([[1, 2], [3, 4]], [1, 4])","reshape([[1, 2], [3, 4]], [4])","reshape([1, 2, 3, 4], [-1, 2])"],seealso:["size","squeeze","resize"]};var ume={name:"resize",category:"Matrix",syntax:["resize(x, size)","resize(x, size, defaultValue)"],description:"Resize a matrix.",examples:["resize([1,2,3,4,5], [3])","resize([1,2,3], [5])","resize([1,2,3], [5], -1)","resize(2, [2, 3])",'resize("hello", [8], "!")'],seealso:["size","subset","squeeze","reshape"]};var cme={name:"rotate",category:"Matrix",syntax:["rotate(w, theta)","rotate(w, theta, v)"],description:"Returns a 2-D rotation matrix (2x2) for a given angle (in radians). Returns a 2-D rotation matrix (3x3) of a given angle (in radians) around given axis.",examples:["rotate([1, 0], pi / 2)",'rotate(matrix([1, 0]), unit("35deg"))','rotate([1, 0, 0], unit("90deg"), [0, 0, 1])','rotate(matrix([1, 0, 0]), unit("90deg"), matrix([0, 0, 1]))'],seealso:["matrix","rotationMatrix"]};var fme={name:"rotationMatrix",category:"Matrix",syntax:["rotationMatrix(theta)","rotationMatrix(theta, v)","rotationMatrix(theta, v, format)"],description:"Returns a 2-D rotation matrix (2x2) for a given angle (in radians). Returns a 2-D rotation matrix (3x3) of a given angle (in radians) around given axis.",examples:["rotationMatrix(pi / 2)",'rotationMatrix(unit("45deg"), [0, 0, 1])','rotationMatrix(1, matrix([0, 0, 1]), "sparse")'],seealso:["cos","sin"]};var dme={name:"row",category:"Matrix",syntax:["row(x, index)"],description:"Return a row from a matrix or array.",examples:["A = [[1, 2], [3, 4]]","row(A, 1)","row(A, 2)"],seealso:["column","matrixFromRows"]};var pme={name:"size",category:"Matrix",syntax:["size(x)"],description:"Calculate the size of a matrix.",examples:["size(2.3)",'size("hello world")',"a = [1, 2; 3, 4; 5, 6]","size(a)","size(1:6)"],seealso:["concat","count","det","diag","identity","inv","ones","range","squeeze","subset","trace","transpose","zeros"]};var mme={name:"sort",category:"Matrix",syntax:["sort(x)","sort(x, compare)"],description:'Sort the items in a matrix. Compare can be a string "asc", "desc", "natural", or a custom sort function.',examples:["sort([5, 10, 1])",'sort(["C", "B", "A", "D"], "natural")',"sortByLength(a, b) = size(a)[1] - size(b)[1]",'sort(["Langdon", "Tom", "Sara"], sortByLength)','sort(["10", "1", "2"], "natural")'],seealso:["map","filter","forEach"]};var hme={name:"squeeze",category:"Matrix",syntax:["squeeze(x)"],description:"Remove inner and outer singleton dimensions from a matrix.",examples:["a = zeros(3,2,1)","size(squeeze(a))","b = zeros(1,1,3)","size(squeeze(b))"],seealso:["concat","det","diag","identity","inv","ones","range","size","subset","trace","transpose","zeros"]};var Ame={name:"subset",category:"Matrix",syntax:["value(index)","value(index) = replacement","subset(value, [index])","subset(value, [index], replacement)"],description:"Get or set a subset of the entries of a matrix or characters of a string. Indexes are one-based. There should be one index specification for each dimension of the target. Each specification can be a single index, a list of indices, or a range in colon notation `l:u`. In a range, both the lower bound l and upper bound u are included; and if a bound is omitted it defaults to the most extreme valid value. The cartesian product of the indices specified in each dimension determines the target of the operation.",examples:["d = [1, 2; 3, 4]","e = []","e[1, 1:2] = [5, 6]","e[2, :] = [7, 8]","f = d * e","f[2, 1]","f[:, 1]","f[[1,2], [1,3]] = [9, 10; 11, 12]","f"],seealso:["concat","det","diag","identity","inv","ones","range","size","squeeze","trace","transpose","zeros"]};var gme={name:"trace",category:"Matrix",syntax:["trace(A)"],description:"Calculate the trace of a matrix: the sum of the elements on the main diagonal of a square matrix.",examples:["A = [1, 2, 3; -1, 2, 3; 2, 0, 3]","trace(A)"],seealso:["concat","det","diag","identity","inv","ones","range","size","squeeze","subset","transpose","zeros"]};var vme={name:"transpose",category:"Matrix",syntax:["x'","transpose(x)"],description:"Transpose a matrix",examples:["a = [1, 2, 3; 4, 5, 6]","a'","transpose(a)"],seealso:["concat","det","diag","identity","inv","ones","range","size","squeeze","subset","trace","zeros"]};var yme={name:"zeros",category:"Matrix",syntax:["zeros(m)","zeros(m, n)","zeros(m, n, p, ...)","zeros([m])","zeros([m, n])","zeros([m, n, p, ...])"],description:"Create a matrix containing zeros.",examples:["zeros(3)","zeros(3, 5)","a = [1, 2, 3; 4, 5, 6]","zeros(size(a))"],seealso:["concat","det","diag","identity","inv","ones","range","size","squeeze","subset","trace","transpose"]};var bme={name:"fft",category:"Matrix",syntax:["fft(x)"],description:"Calculate N-dimensional fourier transform",examples:["fft([[1, 0], [1, 0]])"],seealso:["ifft"]};var xme={name:"ifft",category:"Matrix",syntax:["ifft(x)"],description:"Calculate N-dimensional inverse fourier transform",examples:["ifft([[2, 2], [0, 0]])"],seealso:["fft"]};var wme={name:"combinations",category:"Probability",syntax:["combinations(n, k)"],description:"Compute the number of combinations of n items taken k at a time",examples:["combinations(7, 5)"],seealso:["combinationsWithRep","permutations","factorial"]};var Sme={name:"combinationsWithRep",category:"Probability",syntax:["combinationsWithRep(n, k)"],description:"Compute the number of combinations of n items taken k at a time with replacements.",examples:["combinationsWithRep(7, 5)"],seealso:["combinations","permutations","factorial"]};var Eme={name:"factorial",category:"Probability",syntax:["n!","factorial(n)"],description:"Compute the factorial of a value",examples:["5!","5 * 4 * 3 * 2 * 1","3!"],seealso:["combinations","combinationsWithRep","permutations","gamma"]};var kme={name:"gamma",category:"Probability",syntax:["gamma(n)"],description:"Compute the gamma function. For small values, the Lanczos approximation is used, and for large values the extended Stirling approximation.",examples:["gamma(4)","3!","gamma(1/2)","sqrt(pi)"],seealso:["factorial"]};var Cme={name:"lgamma",category:"Probability",syntax:["lgamma(n)"],description:"Logarithm of the gamma function for real, positive numbers and complex numbers, using Lanczos approximation for numbers and Stirling series for complex numbers.",examples:["lgamma(4)","lgamma(1/2)","lgamma(i)","lgamma(complex(1.1, 2))"],seealso:["gamma"]};var Dme={name:"kldivergence",category:"Probability",syntax:["kldivergence(x, y)"],description:"Calculate the Kullback-Leibler (KL) divergence between two distributions.",examples:["kldivergence([0.7,0.5,0.4], [0.2,0.9,0.5])"],seealso:[]};var Ome={name:"multinomial",category:"Probability",syntax:["multinomial(A)"],description:"Multinomial Coefficients compute the number of ways of picking a1, a2, ..., ai unordered outcomes from `n` possibilities. multinomial takes one array of integers as an argument. The following condition must be enforced: every ai > 0.",examples:["multinomial([1, 2, 1])"],seealso:["combinations","factorial"]};var Mme={name:"permutations",category:"Probability",syntax:["permutations(n)","permutations(n, k)"],description:"Compute the number of permutations of n items taken k at a time",examples:["permutations(5)","permutations(5, 3)"],seealso:["combinations","combinationsWithRep","factorial"]};var jme={name:"pickRandom",category:"Probability",syntax:["pickRandom(array)","pickRandom(array, number)","pickRandom(array, weights)","pickRandom(array, number, weights)","pickRandom(array, weights, number)"],description:"Pick a random entry from a given array.",examples:["pickRandom(0:10)","pickRandom([1, 3, 1, 6])","pickRandom([1, 3, 1, 6], 2)","pickRandom([1, 3, 1, 6], [2, 3, 2, 1])","pickRandom([1, 3, 1, 6], 2, [2, 3, 2, 1])","pickRandom([1, 3, 1, 6], [2, 3, 2, 1], 2)"],seealso:["random","randomInt"]};var Nme={name:"random",category:"Probability",syntax:["random()","random(max)","random(min, max)","random(size)","random(size, max)","random(size, min, max)"],description:"Return a random number.",examples:["random()","random(10, 20)","random([2, 3])"],seealso:["pickRandom","randomInt"]};var Tme={name:"randomInt",category:"Probability",syntax:["randomInt(max)","randomInt(min, max)","randomInt(size)","randomInt(size, max)","randomInt(size, min, max)"],description:"Return a random integer number",examples:["randomInt(10, 20)","randomInt([2, 3], 10)"],seealso:["pickRandom","random"]};var Fme={name:"compare",category:"Relational",syntax:["compare(x, y)"],description:"Compare two values. Returns 1 when x > y, -1 when x < y, and 0 when x == y.",examples:["compare(2, 3)","compare(3, 2)","compare(2, 2)","compare(5cm, 40mm)","compare(2, [1, 2, 3])"],seealso:["equal","unequal","smaller","smallerEq","largerEq","compareNatural","compareText"]};var _me={name:"compareNatural",category:"Relational",syntax:["compareNatural(x, y)"],description:"Compare two values of any type in a deterministic, natural way. Returns 1 when x > y, -1 when x < y, and 0 when x == y.",examples:["compareNatural(2, 3)","compareNatural(3, 2)","compareNatural(2, 2)","compareNatural(5cm, 40mm)",'compareNatural("2", "10")',"compareNatural(2 + 3i, 2 + 4i)","compareNatural([1, 2, 4], [1, 2, 3])","compareNatural([1, 5], [1, 2, 3])","compareNatural([1, 2], [1, 2])","compareNatural({a: 2}, {a: 4})"],seealso:["equal","unequal","smaller","smallerEq","largerEq","compare","compareText"]};var Pme={name:"compareText",category:"Relational",syntax:["compareText(x, y)"],description:"Compare two strings lexically. Comparison is case sensitive. Returns 1 when x > y, -1 when x < y, and 0 when x == y.",examples:['compareText("B", "A")','compareText("A", "B")','compareText("A", "A")','compareText("2", "10")','compare("2", "10")',"compare(2, 10)",'compareNatural("2", "10")','compareText("B", ["A", "B", "C"])'],seealso:["compare","compareNatural"]};var Ime={name:"deepEqual",category:"Relational",syntax:["deepEqual(x, y)"],description:"Check equality of two matrices element wise. Returns true if the size of both matrices is equal and when and each of the elements are equal.",examples:["deepEqual([1,3,4], [1,3,4])","deepEqual([1,3,4], [1,3])"],seealso:["equal","unequal","smaller","larger","smallerEq","largerEq","compare"]};var Bme={name:"equal",category:"Relational",syntax:["x == y","equal(x, y)"],description:"Check equality of two values. Returns true if the values are equal, and false if not.",examples:["2+2 == 3","2+2 == 4","a = 3.2","b = 6-2.8","a == b","50cm == 0.5m"],seealso:["unequal","smaller","larger","smallerEq","largerEq","compare","deepEqual","equalText"]};var Rme={name:"equalText",category:"Relational",syntax:["equalText(x, y)"],description:"Check equality of two strings. Comparison is case sensitive. Returns true if the values are equal, and false if not.",examples:['equalText("Hello", "Hello")','equalText("a", "A")','equal("2e3", "2000")','equalText("2e3", "2000")','equalText("B", ["A", "B", "C"])'],seealso:["compare","compareNatural","compareText","equal"]};var $me={name:"larger",category:"Relational",syntax:["x > y","larger(x, y)"],description:"Check if value x is larger than y. Returns true if x is larger than y, and false if not.",examples:["2 > 3","5 > 2*2","a = 3.3","b = 6-2.8","(a > b)","(b < a)","5 cm > 2 inch"],seealso:["equal","unequal","smaller","smallerEq","largerEq","compare"]};var qme={name:"largerEq",category:"Relational",syntax:["x >= y","largerEq(x, y)"],description:"Check if value x is larger or equal to y. Returns true if x is larger or equal to y, and false if not.",examples:["2 >= 1+1","2 > 1+1","a = 3.2","b = 6-2.8","(a >= b)"],seealso:["equal","unequal","smallerEq","smaller","compare"]};var Lme={name:"smaller",category:"Relational",syntax:["x < y","smaller(x, y)"],description:"Check if value x is smaller than value y. Returns true if x is smaller than y, and false if not.",examples:["2 < 3","5 < 2*2","a = 3.3","b = 6-2.8","(a < b)","5 cm < 2 inch"],seealso:["equal","unequal","larger","smallerEq","largerEq","compare"]};var zme={name:"smallerEq",category:"Relational",syntax:["x <= y","smallerEq(x, y)"],description:"Check if value x is smaller or equal to value y. Returns true if x is smaller than y, and false if not.",examples:["2 <= 1+1","2 < 1+1","a = 3.2","b = 6-2.8","(a <= b)"],seealso:["equal","unequal","larger","smaller","largerEq","compare"]};var Ume={name:"unequal",category:"Relational",syntax:["x != y","unequal(x, y)"],description:"Check unequality of two values. Returns true if the values are unequal, and false if they are equal.",examples:["2+2 != 3","2+2 != 4","a = 3.2","b = 6-2.8","a != b","50cm != 0.5m","5 cm != 2 inch"],seealso:["equal","smaller","larger","smallerEq","largerEq","compare","deepEqual"]};var Wme={name:"setCartesian",category:"Set",syntax:["setCartesian(set1, set2)"],description:"Create the cartesian product of two (multi)sets. Multi-dimension arrays will be converted to single-dimension arrays and the values will be sorted in ascending order before the operation.",examples:["setCartesian([1, 2], [3, 4])"],seealso:["setUnion","setIntersect","setDifference","setPowerset"]};var Hme={name:"setDifference",category:"Set",syntax:["setDifference(set1, set2)"],description:"Create the difference of two (multi)sets: every element of set1, that is not the element of set2. Multi-dimension arrays will be converted to single-dimension arrays before the operation.",examples:["setDifference([1, 2, 3, 4], [3, 4, 5, 6])","setDifference([[1, 2], [3, 4]], [[3, 4], [5, 6]])"],seealso:["setUnion","setIntersect","setSymDifference"]};var Vme={name:"setDistinct",category:"Set",syntax:["setDistinct(set)"],description:"Collect the distinct elements of a multiset. A multi-dimension array will be converted to a single-dimension array before the operation.",examples:["setDistinct([1, 1, 1, 2, 2, 3])"],seealso:["setMultiplicity"]};var Gme={name:"setIntersect",category:"Set",syntax:["setIntersect(set1, set2)"],description:"Create the intersection of two (multi)sets. Multi-dimension arrays will be converted to single-dimension arrays before the operation.",examples:["setIntersect([1, 2, 3, 4], [3, 4, 5, 6])","setIntersect([[1, 2], [3, 4]], [[3, 4], [5, 6]])"],seealso:["setUnion","setDifference"]};var Qme={name:"setIsSubset",category:"Set",syntax:["setIsSubset(set1, set2)"],description:"Check whether a (multi)set is a subset of another (multi)set: every element of set1 is the element of set2. Multi-dimension arrays will be converted to single-dimension arrays before the operation.",examples:["setIsSubset([1, 2], [3, 4, 5, 6])","setIsSubset([3, 4], [3, 4, 5, 6])"],seealso:["setUnion","setIntersect","setDifference"]};var Yme={name:"setMultiplicity",category:"Set",syntax:["setMultiplicity(element, set)"],description:"Count the multiplicity of an element in a multiset. A multi-dimension array will be converted to a single-dimension array before the operation.",examples:["setMultiplicity(1, [1, 2, 2, 4])","setMultiplicity(2, [1, 2, 2, 4])"],seealso:["setDistinct","setSize"]};var Zme={name:"setPowerset",category:"Set",syntax:["setPowerset(set)"],description:"Create the powerset of a (multi)set: the powerset contains very possible subsets of a (multi)set. A multi-dimension array will be converted to a single-dimension array before the operation.",examples:["setPowerset([1, 2, 3])"],seealso:["setCartesian"]};var Xme={name:"setSize",category:"Set",syntax:["setSize(set)","setSize(set, unique)"],description:'Count the number of elements of a (multi)set. When the second parameter "unique" is true, count only the unique values. A multi-dimension array will be converted to a single-dimension array before the operation.',examples:["setSize([1, 2, 2, 4])","setSize([1, 2, 2, 4], true)"],seealso:["setUnion","setIntersect","setDifference"]};var Kme={name:"setSymDifference",category:"Set",syntax:["setSymDifference(set1, set2)"],description:"Create the symmetric difference of two (multi)sets. Multi-dimension arrays will be converted to single-dimension arrays before the operation.",examples:["setSymDifference([1, 2, 3, 4], [3, 4, 5, 6])","setSymDifference([[1, 2], [3, 4]], [[3, 4], [5, 6]])"],seealso:["setUnion","setIntersect","setDifference"]};var Jme={name:"setUnion",category:"Set",syntax:["setUnion(set1, set2)"],description:"Create the union of two (multi)sets. Multi-dimension arrays will be converted to single-dimension arrays before the operation.",examples:["setUnion([1, 2, 3, 4], [3, 4, 5, 6])","setUnion([[1, 2], [3, 4]], [[3, 4], [5, 6]])"],seealso:["setIntersect","setDifference"]};var ehe={name:"zpk2tf",category:"Signal",syntax:["zpk2tf(z, p, k)"],description:"Compute the transfer function of a zero-pole-gain model.",examples:["zpk2tf([1, 2], [-1, -2], 1)","zpk2tf([1, 2], [-1, -2])","zpk2tf([1 - 3i, 2 + 2i], [-1, -2])"],seealso:[]};var the={name:"freqz",category:"Signal",syntax:["freqz(b, a)","freqz(b, a, w)"],description:"Calculates the frequency response of a filter given its numerator and denominator coefficients.",examples:["freqz([1, 2], [1, 2, 3])","freqz([1, 2], [1, 2, 3], [0, 1])","freqz([1, 2], [1, 2, 3], 512)"],seealso:[]};var rhe={name:"erf",category:"Special",syntax:["erf(x)"],description:"Compute the erf function of a value using a rational Chebyshev approximations for different intervals of x",examples:["erf(0.2)","erf(-0.5)","erf(4)"],seealso:[]};var nhe={name:"zeta",category:"Special",syntax:["zeta(s)"],description:"Compute the Riemann Zeta Function using an infinite series and Riemanns Functional Equation for the entire complex plane",examples:["zeta(0.2)","zeta(-0.5)","zeta(4)"],seealso:[]};var ihe={name:"mad",category:"Statistics",syntax:["mad(a, b, c, ...)","mad(A)"],description:"Compute the median absolute deviation of a matrix or a list with values. The median absolute deviation is defined as the median of the absolute deviations from the median.",examples:["mad(10, 20, 30)","mad([1, 2, 3])"],seealso:["mean","median","std","abs"]};var ahe={name:"max",category:"Statistics",syntax:["max(a, b, c, ...)","max(A)","max(A, dimension)"],description:"Compute the maximum value of a list of values.",examples:["max(2, 3, 4, 1)","max([2, 3, 4, 1])","max([2, 5; 4, 3])","max([2, 5; 4, 3], 1)","max([2, 5; 4, 3], 2)","max(2.7, 7.1, -4.5, 2.0, 4.1)","min(2.7, 7.1, -4.5, 2.0, 4.1)"],seealso:["mean","median","min","prod","std","sum","variance"]};var ohe={name:"mean",category:"Statistics",syntax:["mean(a, b, c, ...)","mean(A)","mean(A, dimension)"],description:"Compute the arithmetic mean of a list of values.",examples:["mean(2, 3, 4, 1)","mean([2, 3, 4, 1])","mean([2, 5; 4, 3])","mean([2, 5; 4, 3], 1)","mean([2, 5; 4, 3], 2)","mean([1.0, 2.7, 3.2, 4.0])"],seealso:["max","median","min","prod","std","sum","variance"]};var she={name:"median",category:"Statistics",syntax:["median(a, b, c, ...)","median(A)"],description:"Compute the median of all values. The values are sorted and the middle value is returned. In case of an even number of values, the average of the two middle values is returned.",examples:["median(5, 2, 7)","median([3, -1, 5, 7])"],seealso:["max","mean","min","prod","std","sum","variance","quantileSeq"]};var lhe={name:"min",category:"Statistics",syntax:["min(a, b, c, ...)","min(A)","min(A, dimension)"],description:"Compute the minimum value of a list of values.",examples:["min(2, 3, 4, 1)","min([2, 3, 4, 1])","min([2, 5; 4, 3])","min([2, 5; 4, 3], 1)","min([2, 5; 4, 3], 2)","min(2.7, 7.1, -4.5, 2.0, 4.1)","max(2.7, 7.1, -4.5, 2.0, 4.1)"],seealso:["max","mean","median","prod","std","sum","variance"]};var uhe={name:"mode",category:"Statistics",syntax:["mode(a, b, c, ...)","mode(A)","mode(A, a, b, B, c, ...)"],description:"Computes the mode of all values as an array. In case mode being more than one, multiple values are returned in an array.",examples:["mode(2, 1, 4, 3, 1)","mode([1, 2.7, 3.2, 4, 2.7])","mode(1, 4, 6, 1, 6)"],seealso:["max","mean","min","median","prod","std","sum","variance"]};var che={name:"prod",category:"Statistics",syntax:["prod(a, b, c, ...)","prod(A)"],description:"Compute the product of all values.",examples:["prod(2, 3, 4)","prod([2, 3, 4])","prod([2, 5; 4, 3])"],seealso:["max","mean","min","median","min","std","sum","variance"]};var fhe={name:"quantileSeq",category:"Statistics",syntax:["quantileSeq(A, prob[, sorted])","quantileSeq(A, [prob1, prob2, ...][, sorted])","quantileSeq(A, N[, sorted])"],description:`Compute the prob order quantile of a matrix or a list with values. The sequence is sorted and the middle value is returned. Supported types of sequence values are: Number, BigNumber, Unit Supported types of probablity are: Number, BigNumber. -In case of a (multi dimensional) array or matrix, the prob order quantile of all elements will be calculated.`,examples:["quantileSeq([3, -1, 5, 7], 0.5)","quantileSeq([3, -1, 5, 7], [1/3, 2/3])","quantileSeq([3, -1, 5, 7], 2)","quantileSeq([-1, 3, 5, 7], 0.5, true)"],seealso:["mean","median","min","max","prod","std","sum","variance"]};var dhe={name:"std",category:"Statistics",syntax:["std(a, b, c, ...)","std(A)","std(A, dimension)","std(A, normalization)","std(A, dimension, normalization)"],description:'Compute the standard deviation of all values, defined as std(A) = sqrt(variance(A)). Optional parameter normalization can be "unbiased" (default), "uncorrected", or "biased".',examples:["std(2, 4, 6)","std([2, 4, 6, 8])",'std([2, 4, 6, 8], "uncorrected")','std([2, 4, 6, 8], "biased")',"std([1, 2, 3; 4, 5, 6])"],seealso:["max","mean","min","median","prod","sum","variance"]};var phe={name:"cumsum",category:"Statistics",syntax:["cumsum(a, b, c, ...)","cumsum(A)"],description:"Compute the cumulative sum of all values.",examples:["cumsum(2, 3, 4, 1)","cumsum([2, 3, 4, 1])","cumsum([1, 2; 3, 4])","cumsum([1, 2; 3, 4], 1)","cumsum([1, 2; 3, 4], 2)"],seealso:["max","mean","median","min","prod","std","sum","variance"]};var mhe={name:"sum",category:"Statistics",syntax:["sum(a, b, c, ...)","sum(A)","sum(A, dimension)"],description:"Compute the sum of all values.",examples:["sum(2, 3, 4, 1)","sum([2, 3, 4, 1])","sum([2, 5; 4, 3])"],seealso:["max","mean","median","min","prod","std","sum","variance"]};var hhe={name:"variance",category:"Statistics",syntax:["variance(a, b, c, ...)","variance(A)","variance(A, dimension)","variance(A, normalization)","variance(A, dimension, normalization)"],description:'Compute the variance of all values. Optional parameter normalization can be "unbiased" (default), "uncorrected", or "biased".',examples:["variance(2, 4, 6)","variance([2, 4, 6, 8])",'variance([2, 4, 6, 8], "uncorrected")','variance([2, 4, 6, 8], "biased")',"variance([1, 2, 3; 4, 5, 6])"],seealso:["max","mean","min","median","min","prod","std","sum"]};var Ahe={name:"corr",category:"Statistics",syntax:["corr(A,B)"],description:"Compute the correlation coefficient of a two list with values, For matrices, the matrix correlation coefficient is calculated.",examples:["corr([2, 4, 6, 8],[1, 2, 3, 6])","corr(matrix([[1, 2.2, 3, 4.8, 5], [1, 2, 3, 4, 5]]), matrix([[4, 5.3, 6.6, 7, 8], [1, 2, 3, 4, 5]]))"],seealso:["max","mean","min","median","min","prod","std","sum"]};var ghe={name:"acos",category:"Trigonometry",syntax:["acos(x)"],description:"Compute the inverse cosine of a value in radians.",examples:["acos(0.5)","acos(cos(2.3))"],seealso:["cos","atan","asin"]};var vhe={name:"acosh",category:"Trigonometry",syntax:["acosh(x)"],description:"Calculate the hyperbolic arccos of a value, defined as `acosh(x) = ln(sqrt(x^2 - 1) + x)`.",examples:["acosh(1.5)"],seealso:["cosh","asinh","atanh"]};var yhe={name:"acot",category:"Trigonometry",syntax:["acot(x)"],description:"Calculate the inverse cotangent of a value.",examples:["acot(0.5)","acot(cot(0.5))","acot(2)"],seealso:["cot","atan"]};var bhe={name:"acoth",category:"Trigonometry",syntax:["acoth(x)"],description:"Calculate the hyperbolic arccotangent of a value, defined as `acoth(x) = (ln((x+1)/x) + ln(x/(x-1))) / 2`.",examples:["acoth(2)","acoth(0.5)"],seealso:["acsch","asech"]};var xhe={name:"acsc",category:"Trigonometry",syntax:["acsc(x)"],description:"Calculate the inverse cotangent of a value.",examples:["acsc(2)","acsc(csc(0.5))","acsc(0.5)"],seealso:["csc","asin","asec"]};var whe={name:"acsch",category:"Trigonometry",syntax:["acsch(x)"],description:"Calculate the hyperbolic arccosecant of a value, defined as `acsch(x) = ln(1/x + sqrt(1/x^2 + 1))`.",examples:["acsch(0.5)"],seealso:["asech","acoth"]};var She={name:"asec",category:"Trigonometry",syntax:["asec(x)"],description:"Calculate the inverse secant of a value.",examples:["asec(0.5)","asec(sec(0.5))","asec(2)"],seealso:["acos","acot","acsc"]};var Ehe={name:"asech",category:"Trigonometry",syntax:["asech(x)"],description:"Calculate the inverse secant of a value.",examples:["asech(0.5)"],seealso:["acsch","acoth"]};var khe={name:"asin",category:"Trigonometry",syntax:["asin(x)"],description:"Compute the inverse sine of a value in radians.",examples:["asin(0.5)","asin(sin(0.5))"],seealso:["sin","acos","atan"]};var Che={name:"asinh",category:"Trigonometry",syntax:["asinh(x)"],description:"Calculate the hyperbolic arcsine of a value, defined as `asinh(x) = ln(x + sqrt(x^2 + 1))`.",examples:["asinh(0.5)"],seealso:["acosh","atanh"]};var Dhe={name:"atan",category:"Trigonometry",syntax:["atan(x)"],description:"Compute the inverse tangent of a value in radians.",examples:["atan(0.5)","atan(tan(0.5))"],seealso:["tan","acos","asin"]};var Ohe={name:"atan2",category:"Trigonometry",syntax:["atan2(y, x)"],description:"Computes the principal value of the arc tangent of y/x in radians.",examples:["atan2(2, 2) / pi","angle = 60 deg in rad","x = cos(angle)","y = sin(angle)","atan2(y, x)"],seealso:["sin","cos","tan"]};var Mhe={name:"atanh",category:"Trigonometry",syntax:["atanh(x)"],description:"Calculate the hyperbolic arctangent of a value, defined as `atanh(x) = ln((1 + x)/(1 - x)) / 2`.",examples:["atanh(0.5)"],seealso:["acosh","asinh"]};var jhe={name:"cos",category:"Trigonometry",syntax:["cos(x)"],description:"Compute the cosine of x in radians.",examples:["cos(2)","cos(pi / 4) ^ 2","cos(180 deg)","cos(60 deg)","sin(0.2)^2 + cos(0.2)^2"],seealso:["acos","sin","tan"]};var Nhe={name:"cosh",category:"Trigonometry",syntax:["cosh(x)"],description:"Compute the hyperbolic cosine of x in radians.",examples:["cosh(0.5)"],seealso:["sinh","tanh","coth"]};var The={name:"cot",category:"Trigonometry",syntax:["cot(x)"],description:"Compute the cotangent of x in radians. Defined as 1/tan(x)",examples:["cot(2)","1 / tan(2)"],seealso:["sec","csc","tan"]};var Fhe={name:"coth",category:"Trigonometry",syntax:["coth(x)"],description:"Compute the hyperbolic cotangent of x in radians.",examples:["coth(2)","1 / tanh(2)"],seealso:["sech","csch","tanh"]};var _he={name:"csc",category:"Trigonometry",syntax:["csc(x)"],description:"Compute the cosecant of x in radians. Defined as 1/sin(x)",examples:["csc(2)","1 / sin(2)"],seealso:["sec","cot","sin"]};var Phe={name:"csch",category:"Trigonometry",syntax:["csch(x)"],description:"Compute the hyperbolic cosecant of x in radians. Defined as 1/sinh(x)",examples:["csch(2)","1 / sinh(2)"],seealso:["sech","coth","sinh"]};var Ihe={name:"sec",category:"Trigonometry",syntax:["sec(x)"],description:"Compute the secant of x in radians. Defined as 1/cos(x)",examples:["sec(2)","1 / cos(2)"],seealso:["cot","csc","cos"]};var Bhe={name:"sech",category:"Trigonometry",syntax:["sech(x)"],description:"Compute the hyperbolic secant of x in radians. Defined as 1/cosh(x)",examples:["sech(2)","1 / cosh(2)"],seealso:["coth","csch","cosh"]};var Rhe={name:"sin",category:"Trigonometry",syntax:["sin(x)"],description:"Compute the sine of x in radians.",examples:["sin(2)","sin(pi / 4) ^ 2","sin(90 deg)","sin(30 deg)","sin(0.2)^2 + cos(0.2)^2"],seealso:["asin","cos","tan"]};var $he={name:"sinh",category:"Trigonometry",syntax:["sinh(x)"],description:"Compute the hyperbolic sine of x in radians.",examples:["sinh(0.5)"],seealso:["cosh","tanh"]};var qhe={name:"tan",category:"Trigonometry",syntax:["tan(x)"],description:"Compute the tangent of x in radians.",examples:["tan(0.5)","sin(0.5) / cos(0.5)","tan(pi / 4)","tan(45 deg)"],seealso:["atan","sin","cos"]};var Lhe={name:"tanh",category:"Trigonometry",syntax:["tanh(x)"],description:"Compute the hyperbolic tangent of x in radians.",examples:["tanh(0.5)","sinh(0.5) / cosh(0.5)"],seealso:["sinh","cosh"]};var zhe={name:"to",category:"Units",syntax:["x to unit","to(x, unit)"],description:"Change the unit of a value.",examples:["5 inch to cm","3.2kg to g","16 bytes in bits"],seealso:[]};var Uhe={name:"bin",category:"Utils",syntax:["bin(value)"],description:"Format a number as binary",examples:["bin(2)"],seealso:["oct","hex"]};var Whe={name:"clone",category:"Utils",syntax:["clone(x)"],description:"Clone a variable. Creates a copy of primitive variables,and a deep copy of matrices",examples:["clone(3.5)","clone(2 - 4i)","clone(45 deg)","clone([1, 2; 3, 4])",'clone("hello world")'],seealso:[]};var Hhe={name:"format",category:"Utils",syntax:["format(value)","format(value, precision)"],description:"Format a value of any type as string.",examples:["format(2.3)","format(3 - 4i)","format([])","format(pi, 3)"],seealso:["print"]};var Vhe={name:"hasNumericValue",category:"Utils",syntax:["hasNumericValue(x)"],description:"Test whether a value is an numeric value. In case of a string, true is returned if the string contains a numeric value.",examples:["hasNumericValue(2)",'hasNumericValue("2")','isNumeric("2")',"hasNumericValue(0)","hasNumericValue(bignumber(500))","hasNumericValue(fraction(0.125))","hasNumericValue(2 + 3i)",'hasNumericValue([2.3, "foo", false])'],seealso:["isInteger","isZero","isNegative","isPositive","isNaN","isNumeric"]};var Ghe={name:"hex",category:"Utils",syntax:["hex(value)"],description:"Format a number as hexadecimal",examples:["hex(240)"],seealso:["bin","oct"]};var Qhe={name:"isInteger",category:"Utils",syntax:["isInteger(x)"],description:"Test whether a value is an integer number.",examples:["isInteger(2)","isInteger(3.5)","isInteger([3, 0.5, -2])"],seealso:["isNegative","isNumeric","isPositive","isZero"]};var Yhe={name:"isNaN",category:"Utils",syntax:["isNaN(x)"],description:"Test whether a value is NaN (not a number)",examples:["isNaN(2)","isNaN(0 / 0)","isNaN(NaN)","isNaN(Infinity)"],seealso:["isNegative","isNumeric","isPositive","isZero"]};var Zhe={name:"isNegative",category:"Utils",syntax:["isNegative(x)"],description:"Test whether a value is negative: smaller than zero.",examples:["isNegative(2)","isNegative(0)","isNegative(-4)","isNegative([3, 0.5, -2])"],seealso:["isInteger","isNumeric","isPositive","isZero"]};var Xhe={name:"isNumeric",category:"Utils",syntax:["isNumeric(x)"],description:"Test whether a value is a numeric value. Returns true when the input is a number, BigNumber, Fraction, or boolean.",examples:["isNumeric(2)",'isNumeric("2")','hasNumericValue("2")',"isNumeric(0)","isNumeric(bignumber(500))","isNumeric(fraction(0.125))","isNumeric(2 + 3i)",'isNumeric([2.3, "foo", false])'],seealso:["isInteger","isZero","isNegative","isPositive","isNaN","hasNumericValue"]};var Khe={name:"isPositive",category:"Utils",syntax:["isPositive(x)"],description:"Test whether a value is positive: larger than zero.",examples:["isPositive(2)","isPositive(0)","isPositive(-4)","isPositive([3, 0.5, -2])"],seealso:["isInteger","isNumeric","isNegative","isZero"]};var Jhe={name:"isPrime",category:"Utils",syntax:["isPrime(x)"],description:"Test whether a value is prime: has no divisors other than itself and one.",examples:["isPrime(3)","isPrime(-2)","isPrime([2, 17, 100])"],seealso:["isInteger","isNumeric","isNegative","isZero"]};var eAe={name:"isZero",category:"Utils",syntax:["isZero(x)"],description:"Test whether a value is zero.",examples:["isZero(2)","isZero(0)","isZero(-4)","isZero([3, 0, -2, 0])"],seealso:["isInteger","isNumeric","isNegative","isPositive"]};var tAe={name:"numeric",category:"Utils",syntax:["numeric(x)"],description:"Convert a numeric input to a specific numeric type: number, BigNumber, or Fraction.",examples:['numeric("4")','numeric("4", "number")','numeric("4", "BigNumber")','numeric("4", "Fraction")','numeric(4, "Fraction")','numeric(fraction(2, 5), "number")'],seealso:["number","fraction","bignumber","string","format"]};var rAe={name:"oct",category:"Utils",syntax:["oct(value)"],description:"Format a number as octal",examples:["oct(56)"],seealso:["bin","hex"]};var nAe={name:"print",category:"Utils",syntax:["print(template, values)","print(template, values, precision)"],description:"Interpolate values into a string template.",examples:['print("Lucy is $age years old", {age: 5})','print("The value of pi is $pi", {pi: pi}, 3)','print("Hello, $user.name!", {user: {name: "John"}})','print("Values: $1, $2, $3", [6, 9, 4])'],seealso:["format"]};var iAe={name:"typeOf",category:"Utils",syntax:["typeOf(x)"],description:"Get the type of a variable.",examples:["typeOf(3.5)","typeOf(2 - 4i)","typeOf(45 deg)",'typeOf("hello world")'],seealso:["getMatrixDataType"]};var aAe={name:"solveODE",category:"Numeric",syntax:["solveODE(func, tspan, y0)","solveODE(func, tspan, y0, options)"],description:"Numerical Integration of Ordinary Differential Equations.",examples:["f(t,y) = y","tspan = [0, 4]","solveODE(f, tspan, 1)","solveODE(f, tspan, [1, 2])",'solveODE(f, tspan, 1, { method:"RK23", maxStep:0.1 })'],seealso:["derivative","simplifyCore"]};var oAe={bignumber:Zfe,boolean:Xfe,complex:Kfe,createUnit:Jfe,fraction:ede,index:tde,matrix:rde,number:nde,sparse:ide,splitUnit:ade,string:ode,unit:sde,e:jH,E:jH,false:Pfe,i:Ife,Infinity:Bfe,LN2:$fe,LN10:Rfe,LOG2E:Lfe,LOG10E:qfe,NaN:zfe,null:Ufe,pi:NH,PI:NH,phi:Wfe,SQRT1_2:Hfe,SQRT2:Vfe,tau:Gfe,true:Qfe,version:Yfe,speedOfLight:{description:"Speed of light in vacuum",examples:["speedOfLight"]},gravitationConstant:{description:"Newtonian constant of gravitation",examples:["gravitationConstant"]},planckConstant:{description:"Planck constant",examples:["planckConstant"]},reducedPlanckConstant:{description:"Reduced Planck constant",examples:["reducedPlanckConstant"]},magneticConstant:{description:"Magnetic constant (vacuum permeability)",examples:["magneticConstant"]},electricConstant:{description:"Electric constant (vacuum permeability)",examples:["electricConstant"]},vacuumImpedance:{description:"Characteristic impedance of vacuum",examples:["vacuumImpedance"]},coulomb:{description:"Coulomb's constant",examples:["coulomb"]},elementaryCharge:{description:"Elementary charge",examples:["elementaryCharge"]},bohrMagneton:{description:"Borh magneton",examples:["bohrMagneton"]},conductanceQuantum:{description:"Conductance quantum",examples:["conductanceQuantum"]},inverseConductanceQuantum:{description:"Inverse conductance quantum",examples:["inverseConductanceQuantum"]},magneticFluxQuantum:{description:"Magnetic flux quantum",examples:["magneticFluxQuantum"]},nuclearMagneton:{description:"Nuclear magneton",examples:["nuclearMagneton"]},klitzing:{description:"Von Klitzing constant",examples:["klitzing"]},bohrRadius:{description:"Borh radius",examples:["bohrRadius"]},classicalElectronRadius:{description:"Classical electron radius",examples:["classicalElectronRadius"]},electronMass:{description:"Electron mass",examples:["electronMass"]},fermiCoupling:{description:"Fermi coupling constant",examples:["fermiCoupling"]},fineStructure:{description:"Fine-structure constant",examples:["fineStructure"]},hartreeEnergy:{description:"Hartree energy",examples:["hartreeEnergy"]},protonMass:{description:"Proton mass",examples:["protonMass"]},deuteronMass:{description:"Deuteron Mass",examples:["deuteronMass"]},neutronMass:{description:"Neutron mass",examples:["neutronMass"]},quantumOfCirculation:{description:"Quantum of circulation",examples:["quantumOfCirculation"]},rydberg:{description:"Rydberg constant",examples:["rydberg"]},thomsonCrossSection:{description:"Thomson cross section",examples:["thomsonCrossSection"]},weakMixingAngle:{description:"Weak mixing angle",examples:["weakMixingAngle"]},efimovFactor:{description:"Efimov factor",examples:["efimovFactor"]},atomicMass:{description:"Atomic mass constant",examples:["atomicMass"]},avogadro:{description:"Avogadro's number",examples:["avogadro"]},boltzmann:{description:"Boltzmann constant",examples:["boltzmann"]},faraday:{description:"Faraday constant",examples:["faraday"]},firstRadiation:{description:"First radiation constant",examples:["firstRadiation"]},loschmidt:{description:"Loschmidt constant at T=273.15 K and p=101.325 kPa",examples:["loschmidt"]},gasConstant:{description:"Gas constant",examples:["gasConstant"]},molarPlanckConstant:{description:"Molar Planck constant",examples:["molarPlanckConstant"]},molarVolume:{description:"Molar volume of an ideal gas at T=273.15 K and p=101.325 kPa",examples:["molarVolume"]},sackurTetrode:{description:"Sackur-Tetrode constant at T=1 K and p=101.325 kPa",examples:["sackurTetrode"]},secondRadiation:{description:"Second radiation constant",examples:["secondRadiation"]},stefanBoltzmann:{description:"Stefan-Boltzmann constant",examples:["stefanBoltzmann"]},wienDisplacement:{description:"Wien displacement law constant",examples:["wienDisplacement"]},molarMass:{description:"Molar mass constant",examples:["molarMass"]},molarMassC12:{description:"Molar mass constant of carbon-12",examples:["molarMassC12"]},gravity:{description:"Standard acceleration of gravity (standard acceleration of free-fall on Earth)",examples:["gravity"]},planckLength:{description:"Planck length",examples:["planckLength"]},planckMass:{description:"Planck mass",examples:["planckMass"]},planckTime:{description:"Planck time",examples:["planckTime"]},planckCharge:{description:"Planck charge",examples:["planckCharge"]},planckTemperature:{description:"Planck temperature",examples:["planckTemperature"]},derivative:fde,lsolve:pde,lsolveAll:mde,lup:hde,lusolve:Ade,leafCount:dde,polynomialRoot:gde,resolve:bde,simplify:xde,simplifyConstant:wde,simplifyCore:Sde,symbolicEqual:kde,rationalize:yde,slu:Ede,usolve:Cde,usolveAll:Dde,qr:vde,abs:Ode,add:Mde,cbrt:jde,ceil:Nde,cube:Tde,divide:Fde,dotDivide:_de,dotMultiply:Pde,dotPow:Ide,exp:Bde,expm:Rde,expm1:$de,fix:qde,floor:Lde,gcd:zde,hypot:Ude,lcm:Hde,log:Vde,log2:Yde,log1p:Qde,log10:Gde,mod:Zde,multiply:Xde,norm:Kde,nthRoot:Jde,nthRoots:epe,pow:tpe,round:rpe,sign:npe,sqrt:ipe,sqrtm:ape,square:upe,subtract:cpe,unaryMinus:fpe,unaryPlus:dpe,xgcd:ppe,invmod:Wde,bitAnd:mpe,bitNot:hpe,bitOr:Ape,bitXor:gpe,leftShift:vpe,rightArithShift:ype,rightLogShift:bpe,bellNumbers:xpe,catalan:wpe,composition:Spe,stirlingS2:Epe,config:lde,import:ude,typed:cde,arg:kpe,conj:Cpe,re:Ope,im:Dpe,evaluate:Mpe,help:jpe,distance:Npe,intersect:Tpe,and:Fpe,not:_pe,or:Ppe,xor:Ipe,concat:Rpe,count:$pe,cross:qpe,column:Bpe,ctranspose:Lpe,det:zpe,diag:Upe,diff:Wpe,dot:Hpe,getMatrixDataType:Zpe,identity:Xpe,filter:Gpe,flatten:Qpe,forEach:Ype,inv:Kpe,pinv:Jpe,eigs:Vpe,kron:eme,matrixFromFunction:nme,matrixFromRows:ime,matrixFromColumns:rme,map:tme,ones:ame,partitionSelect:ome,range:sme,resize:ume,reshape:lme,rotate:cme,rotationMatrix:fme,row:dme,size:pme,sort:mme,squeeze:hme,subset:Ame,trace:gme,transpose:vme,zeros:yme,fft:bme,ifft:xme,sylvester:ope,schur:spe,lyap:lpe,solveODE:aAe,combinations:wme,combinationsWithRep:Sme,factorial:Eme,gamma:kme,kldivergence:Dme,lgamma:Cme,multinomial:Ome,permutations:Mme,pickRandom:jme,random:Nme,randomInt:Tme,compare:Fme,compareNatural:_me,compareText:Pme,deepEqual:Ime,equal:Bme,equalText:Rme,larger:$me,largerEq:qme,smaller:Lme,smallerEq:zme,unequal:Ume,setCartesian:Wme,setDifference:Hme,setDistinct:Vme,setIntersect:Gme,setIsSubset:Qme,setMultiplicity:Yme,setPowerset:Zme,setSize:Xme,setSymDifference:Kme,setUnion:Jme,zpk2tf:ehe,freqz:the,erf:rhe,zeta:nhe,cumsum:phe,mad:ihe,max:ahe,mean:ohe,median:she,min:lhe,mode:uhe,prod:che,quantileSeq:fhe,std:dhe,sum:mhe,variance:hhe,corr:Ahe,acos:ghe,acosh:vhe,acot:yhe,acoth:bhe,acsc:xhe,acsch:whe,asec:She,asech:Ehe,asin:khe,asinh:Che,atan:Dhe,atanh:Mhe,atan2:Ohe,cos:jhe,cosh:Nhe,cot:The,coth:Fhe,csc:_he,csch:Phe,sec:Ihe,sech:Bhe,sin:Rhe,sinh:$he,tan:qhe,tanh:Lhe,to:zhe,clone:Whe,format:Hhe,bin:Uhe,oct:rAe,hex:Ghe,isNaN:Yhe,isInteger:Qhe,isNegative:Zhe,isNumeric:Xhe,hasNumericValue:Vhe,isPositive:Khe,isPrime:Jhe,isZero:eAe,print:nAe,typeOf:iAe,numeric:tAe};var sAe="help",LUe=["typed","mathWithTransform","Help"],X4=V(sAe,LUe,e=>{var{typed:t,mathWithTransform:r,Help:n}=e;return t(sAe,{any:function(a){var o,s=a;if(typeof a!="string"){for(o in r)if(Et(r,o)&&a===r[o]){s=o;break}}var l=Zi(oAe,s);if(!l){var u=typeof s=="function"?s.name:s;throw new Error('No documentation found on "'+u+'"')}return new n(l)}})});var lAe="chain",zUe=["typed","Chain"],K4=V(lAe,zUe,e=>{var{typed:t,Chain:r}=e;return t(lAe,{"":function(){return new r},any:function(i){return new r(i)}})});var uAe="det",UUe=["typed","matrix","subtractScalar","multiply","divideScalar","isZero","unaryMinus"],J4=V(uAe,UUe,e=>{var{typed:t,matrix:r,subtractScalar:n,multiply:i,divideScalar:a,isZero:o,unaryMinus:s}=e;return t(uAe,{any:function(c){return Bt(c)},"Array | Matrix":function(c){var f;switch(St(c)?f=c.size():Array.isArray(c)?(c=r(c),f=c.size()):f=[],f.length){case 0:return Bt(c);case 1:if(f[0]===1)return Bt(c.valueOf()[0]);if(f[0]===0)return 1;throw new RangeError("Matrix must be square (size: "+tr(f)+")");case 2:{var d=f[0],p=f[1];if(d===p)return l(c.clone().valueOf(),d,p);if(p===0)return 1;throw new RangeError("Matrix must be square (size: "+tr(f)+")")}default:throw new RangeError("Matrix must be two dimensional (size: "+tr(f)+")")}}});function l(u,c,f){if(c===1)return Bt(u[0][0]);if(c===2)return n(i(u[0][0],u[1][1]),i(u[1][0],u[0][1]));for(var d=!1,p=new Array(c).fill(0).map((k,j)=>j),h=0;h{var{typed:t,matrix:r,divideScalar:n,addScalar:i,multiply:a,unaryMinus:o,det:s,identity:l,abs:u}=e;return t(cAe,{"Array | Matrix":function(d){var p=St(d)?d.size():Yt(d);switch(p.length){case 1:if(p[0]===1)return St(d)?r([n(1,d.valueOf()[0])]):[n(1,d[0])];throw new RangeError("Matrix must be square (size: "+tr(p)+")");case 2:{var h=p[0],m=p[1];if(h===m)return St(d)?r(c(d.valueOf(),h,m),d.storage()):c(d,h,m);throw new RangeError("Matrix must be square (size: "+tr(p)+")")}default:throw new RangeError("Matrix must be two dimensional (size: "+tr(p)+")")}},any:function(d){return n(1,d)}});function c(f,d,p){var h,m,g,A,b;if(d===1){if(A=f[0][0],A===0)throw Error("Cannot calculate inverse, determinant is zero");return[[n(1,A)]]}else if(d===2){var v=s(f);if(v===0)throw Error("Cannot calculate inverse, determinant is zero");return[[n(f[1][1],v),n(o(f[0][1]),v)],[n(o(f[1][0]),v),n(f[0][0],v)]]}else{var x=f.concat();for(h=0;hk&&(k=u(x[h][S]),j=h),h++;if(k===0)throw Error("Cannot calculate inverse, determinant is zero");h=j,h!==S&&(b=x[S],x[S]=x[h],x[h]=b,b=w[S],w[S]=w[h],w[h]=b);var O=x[S],C=w[S];for(h=0;h{var{typed:t,matrix:r,inv:n,deepEqual:i,equal:a,dotDivide:o,dot:s,ctranspose:l,divideScalar:u,multiply:c,add:f,Complex:d}=e;return t(fAe,{"Array | Matrix":function(v){var x=St(v)?v.size():Yt(v);switch(x.length){case 1:return A(v)?l(v):x[0]===1?n(v):o(l(v),s(v,v));case 2:{if(A(v))return l(v);var w=x[0],S=x[1];if(w===S)try{return n(v)}catch(k){if(!(k instanceof Error&&k.message.match(/Cannot calculate inverse, determinant is zero/)))throw k}return St(v)?r(p(v.valueOf(),w,S),v.storage()):p(v,w,S)}default:throw new RangeError("Matrix must be two dimensional (size: "+tr(x)+")")}},any:function(v){return a(v,0)?Bt(v):u(1,v)}});function p(b,v,x){var{C:w,F:S}=m(b,v,x),k=c(n(c(l(w),w)),l(w)),j=c(l(S),n(c(S,l(S))));return c(j,k)}function h(b,v,x){for(var w=Bt(b),S=0,k=0;kj.filter((C,N)=>N!g(s(w[O],w[O])));return{C:S,F:k}}function g(b){return a(f(b,d(1,1)),f(0,d(1,1)))}function A(b){return i(f(b,d(1,1)),f(c(b,0),d(1,1)))}});function dAe(e){var{addScalar:t,subtract:r,flatten:n,multiply:i,multiplyScalar:a,divideScalar:o,sqrt:s,abs:l,bignumber:u,diag:c,size:f,reshape:d,inv:p,qr:h,usolve:m,usolveAll:g,equal:A,complex:b,larger:v,smaller:x,matrixFromColumns:w,dot:S}=e;function k(te,Q,fe,Ie){var Se=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,Oe=j(te,Q,fe,Ie,Se);O(te,Q,fe,Ie,Se,Oe);var{values:ve,C:ye}=C(te,Q,fe,Ie,Se);if(Se){var me=N(te,Q,ye,Oe,ve,fe,Ie);return{values:ve,eigenvectors:me}}return{values:ve}}function j(te,Q,fe,Ie,Se){var Oe=Ie==="BigNumber",ve=Ie==="Complex",ye=Oe?u(0):0,me=Oe?u(1):ve?b(1):1,ke=Oe?u(1):1,$=Oe?u(10):2,ae=a($,$),ce;Se&&(ce=Array(Q).fill(me));for(var U=!1;!U;){U=!0;for(var R=0;R1&&(U=c(Array($-1).fill(ye)))),$-=1,me.pop();for(var Ce=0;Ce<$;Ce++)me[Ce].pop()}else if($===2||x(l(me[$-2][$-3]),fe)){R=0;var _e=D(me[$-2][$-2],me[$-2][$-1],me[$-1][$-2],me[$-1][$-1]);ke.push(..._e),Se&&(ae.unshift(P(me[$-2][$-2],me[$-2][$-1],me[$-1][$-2],me[$-1][$-1],_e[0],_e[1],fe,Ie)),q(U,Q),ce=i(ce,U),$>2&&(U=c(Array($-2).fill(ye)))),$-=2,me.pop(),me.pop();for(var he=0;he<$;he++)me[he].pop(),me[he].pop()}if($===0)break}if(ke.sort((tt,Ct)=>+r(l(tt),l(Ct))),R>100){var ze=Error("The eigenvalues failed to converge. Only found these eigenvalues: "+ke.join(", "));throw ze.values=ke,ze.vectors=[],ze}var Ye=Se?i(ce,z(ae,Q)):void 0;return{values:ke,C:Ye}}function N(te,Q,fe,Ie,Se,Oe,ve){var ye=p(fe),me=i(ye,te,fe),ke=ve==="BigNumber",$=ve==="Complex",ae=ke?u(0):$?b(0):0,ce=ke?u(1):$?b(1):1,U=[],R=[];for(var J of Se){var ee=I(U,J,A);ee===-1?(U.push(J),R.push(1)):R[ee]+=1}for(var ie=[],re=U.length,Ee=Array(Q).fill(ae),Ce=c(Array(Q).fill(ce)),_e=function(){var Ye=U[he],tt=r(me,i(Ye,Ce)),Ct=g(tt,Ee);for(Ct.shift();Ct.lengthi(Be,Le)),ie.push(...Ct.map(Le=>({value:Ye,vector:n(Le)})))},he=0;he=5)return null;for(ye=0;;){var me=m(te,ve);if(x(Y(_(ve,[me])),Ie))break;if(++ye>=10)return null;ve=oe(me)}return ve}function L(te,Q,fe){var Ie=fe==="BigNumber",Se=fe==="Complex",Oe=Array(te).fill(0).map(ve=>2*Math.random()-1);return Ie&&(Oe=Oe.map(ve=>u(ve))),Se&&(Oe=Oe.map(ve=>b(ve))),Oe=_(Oe,Q),oe(Oe,fe)}function _(te,Q){var fe=f(te);for(var Ie of Q)Ie=d(Ie,fe),te=r(te,i(o(S(Ie,te),S(Ie,Ie)),Ie));return te}function Y(te){return l(s(S(te,te)))}function oe(te,Q){var fe=Q==="BigNumber",Ie=Q==="Complex",Se=fe?u(1):Ie?b(1):1;return i(o(Se,Y(te)),te)}return k}function pAe(e){var{config:t,addScalar:r,subtract:n,abs:i,atan:a,cos:o,sin:s,multiplyScalar:l,inv:u,bignumber:c,multiply:f,add:d}=e;function p(O,C){var N=arguments.length>2&&arguments[2]!==void 0?arguments[2]:t.epsilon,D=arguments.length>3?arguments[3]:void 0,P=arguments.length>4?arguments[4]:void 0;if(D==="number")return h(O,N,P);if(D==="BigNumber")return m(O,N,P);throw TypeError("Unsupported data type: "+D)}function h(O,C,N){var D=O.length,P=Math.abs(C/D),q,z;if(N){z=new Array(D);for(var I=0;I=Math.abs(P);){var L=T[0][0],_=T[0][1];q=g(O[L][L],O[_][_],O[L][_]),O=w(O,q,L,_),N&&(z=b(z,q,L,_)),T=S(O)}for(var Y=Array(D).fill(0),oe=0;oe=i(P);){var L=T[0][0],_=T[0][1];q=A(O[L][L],O[_][_],O[L][_]),O=x(O,q,L,_),N&&(z=v(z,q,L,_)),T=k(O)}for(var Y=Array(D).fill(0),oe=0;oe({value:P[Q],vector:te}));return{values:P,eigenvectors:oe}}return p}var VUe="eigs",GUe=["config","typed","matrix","addScalar","equal","subtract","abs","atan","cos","sin","multiplyScalar","divideScalar","inv","bignumber","multiply","add","larger","column","flatten","number","complex","sqrt","diag","size","reshape","qr","usolve","usolveAll","im","re","smaller","matrixFromColumns","dot"],rP=V(VUe,GUe,e=>{var{config:t,typed:r,matrix:n,addScalar:i,subtract:a,equal:o,abs:s,atan:l,cos:u,sin:c,multiplyScalar:f,divideScalar:d,inv:p,bignumber:h,multiply:m,add:g,larger:A,column:b,flatten:v,number:x,complex:w,sqrt:S,diag:k,size:j,reshape:O,qr:C,usolve:N,usolveAll:D,im:P,re:q,smaller:z,matrixFromColumns:I,dot:T}=e,L=pAe({config:t,addScalar:i,subtract:a,column:b,flatten:v,equal:o,abs:s,atan:l,cos:u,sin:c,multiplyScalar:f,inv:p,bignumber:h,complex:w,multiply:m,add:g}),_=dAe({config:t,addScalar:i,subtract:a,multiply:m,multiplyScalar:f,flatten:v,divideScalar:d,sqrt:S,abs:s,bignumber:h,diag:k,size:j,reshape:O,qr:C,inv:p,usolve:N,usolveAll:D,equal:o,complex:w,larger:A,smaller:z,matrixFromColumns:I,dot:T});return r("eigs",{Array:function(Oe){return Y(n(Oe))},"Array, number|BigNumber":function(Oe,ve){return Y(n(Oe),{precision:ve})},"Array, Object"(Se,Oe){return Y(n(Se),Oe)},Matrix:function(Oe){return Y(Oe,{matricize:!0})},"Matrix, number|BigNumber":function(Oe,ve){return Y(Oe,{precision:ve,matricize:!0})},"Matrix, Object":function(Oe,ve){var ye={matricize:!0};return Fn(ye,ve),Y(Oe,ye)}});function Y(Se){var Oe,ve=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},ye="eigenvectors"in ve?ve.eigenvectors:!0,me=(Oe=ve.precision)!==null&&Oe!==void 0?Oe:t.epsilon,ke=oe(Se,me,ye);return ve.matricize&&(ke.values=n(ke.values),ye&&(ke.eigenvectors=ke.eigenvectors.map($=>{var{value:ae,vector:ce}=$;return{value:ae,vector:n(ce)}}))),ye&&Object.defineProperty(ke,"vectors",{enumerable:!1,get:()=>{throw new Error("eigs(M).vectors replaced with eigs(M).eigenvectors")}}),ke}function oe(Se,Oe,ve){var ye=Se.toArray(),me=Se.size();if(me.length!==2||me[0]!==me[1])throw new RangeError("Matrix must be square (size: ".concat(tr(me),")"));var ke=me[0];if(Q(ye,ke,Oe)&&(fe(ye,ke),te(ye,ke,Oe))){var $=Ie(Se,ye,ke);return L(ye,ke,Oe,$,ve)}var ae=Ie(Se,ye,ke);return _(ye,ke,Oe,ae,ve)}function te(Se,Oe,ve){for(var ye=0;ye{var{typed:t,abs:r,add:n,identity:i,inv:a,multiply:o}=e;return t(mAe,{Matrix:function(f){var d=f.size();if(d.length!==2||d[0]!==d[1])throw new RangeError("Matrix must be square (size: "+tr(d)+")");for(var p=d[0],h=1e-15,m=s(f),g=l(m,h),A=g.q,b=g.j,v=o(f,Math.pow(2,-b)),x=i(p),w=i(p),S=1,k=v,j=-1,O=1;O<=A;O++)O>1&&(k=o(k,v),j=-j),S=S*(A-O+1)/((2*A-O+1)*O),x=n(x,o(S,k)),w=n(w,o(S*j,k));for(var C=o(a(w),x),N=0;N{var{typed:t,abs:r,add:n,multiply:i,map:a,sqrt:o,subtract:s,inv:l,size:u,max:c,identity:f}=e,d=1e3,p=1e-6;function h(m){var g,A=0,b=m,v=f(u(m));do{var x=b;if(b=i(.5,n(x,l(v))),v=i(.5,n(v,l(x))),g=c(r(s(b,x))),g>p&&++A>d)throw new Error("computing square root of matrix: iterative method could not converge")}while(g>p);return b}return t(hAe,{"Array | Matrix":function(g){var A=St(g)?g.size():Yt(g);switch(A.length){case 1:if(A[0]===1)return a(g,o);throw new RangeError("Matrix must be square (size: "+tr(A)+")");case 2:{var b=A[0],v=A[1];if(b===v)return h(g);throw new RangeError("Matrix must be square (size: "+tr(A)+")")}default:throw new RangeError("Matrix must be at most two dimensional (size: "+tr(A)+")")}}})});var AAe="sylvester",ZUe=["typed","schur","matrixFromColumns","matrix","multiply","range","concat","transpose","index","subset","add","subtract","identity","lusolve","abs"],aP=V(AAe,ZUe,e=>{var{typed:t,schur:r,matrixFromColumns:n,matrix:i,multiply:a,range:o,concat:s,transpose:l,index:u,subset:c,add:f,subtract:d,identity:p,lusolve:h,abs:m}=e;return t(AAe,{"Matrix, Matrix, Matrix":g,"Array, Matrix, Matrix":function(b,v,x){return g(i(b),v,x)},"Array, Array, Matrix":function(b,v,x){return g(i(b),i(v),x)},"Array, Matrix, Array":function(b,v,x){return g(i(b),v,i(x))},"Matrix, Array, Matrix":function(b,v,x){return g(b,i(v),x)},"Matrix, Array, Array":function(b,v,x){return g(b,i(v),i(x))},"Matrix, Matrix, Array":function(b,v,x){return g(b,v,i(x))},"Array, Array, Array":function(b,v,x){return g(i(b),i(v),i(x)).toArray()}});function g(A,b,v){for(var x=b.size()[0],w=A.size()[0],S=r(A),k=S.T,j=S.U,O=r(a(-1,b)),C=O.T,N=O.U,D=a(a(l(j),v),N),P=o(0,w),q=[],z=($,ae)=>s($,ae,1),I=($,ae)=>s($,ae,0),T=0;T1e-5){for(var L=I(c(D,u(P,T)),c(D,u(P,T+1))),_=0;_{var{typed:t,matrix:r,identity:n,multiply:i,qr:a,norm:o,subtract:s}=e;return t(gAe,{Array:function(c){var f=l(r(c));return{U:f.U.valueOf(),T:f.T.valueOf()}},Matrix:function(c){return l(c)}});function l(u){var c=u.size()[0],f=u,d=n(c),p=0,h;do{h=f;var m=a(f),g=m.Q,A=m.R;if(f=i(A,g),d=i(d,g),p++>100)break}while(o(s(f,h))>1e-4);return{U:d,T:f}}});var vAe="lyap",KUe=["typed","matrix","sylvester","multiply","transpose"],sP=V(vAe,KUe,e=>{var{typed:t,matrix:r,sylvester:n,multiply:i,transpose:a}=e;return t(vAe,{"Matrix, Matrix":function(s,l){return n(s,a(s),i(-1,l))},"Array, Matrix":function(s,l){return n(r(s),a(r(s)),i(-1,l))},"Matrix, Array":function(s,l){return n(s,a(r(s)),r(i(-1,l)))},"Array, Array":function(s,l){return n(r(s),a(r(s)),r(i(-1,l))).toArray()}})});var JUe="divide",eWe=["typed","matrix","multiply","equalScalar","divideScalar","inv"],lP=V(JUe,eWe,e=>{var{typed:t,matrix:r,multiply:n,equalScalar:i,divideScalar:a,inv:o}=e,s=Gn({typed:t,equalScalar:i}),l=vo({typed:t});return t("divide",iT({"Array | Matrix, Array | Matrix":function(c,f){return n(c,o(f))},"DenseMatrix, any":function(c,f){return l(c,f,a,!1)},"SparseMatrix, any":function(c,f){return s(c,f,a,!1)},"Array, any":function(c,f){return l(r(c),f,a,!1).valueOf()},"any, Array | Matrix":function(c,f){return n(c,o(f))}},a.signatures))});var yAe="distance",tWe=["typed","addScalar","subtractScalar","divideScalar","multiplyScalar","deepEqual","sqrt","abs"],uP=V(yAe,tWe,e=>{var{typed:t,addScalar:r,subtractScalar:n,multiplyScalar:i,divideScalar:a,deepEqual:o,sqrt:s,abs:l}=e;return t(yAe,{"Array, Array, Array":function(w,S,k){if(w.length===2&&S.length===2&&k.length===2){if(!c(w))throw new TypeError("Array with 2 numbers or BigNumbers expected for first argument");if(!c(S))throw new TypeError("Array with 2 numbers or BigNumbers expected for second argument");if(!c(k))throw new TypeError("Array with 2 numbers or BigNumbers expected for third argument");if(o(S,k))throw new TypeError("LinePoint1 should not be same with LinePoint2");var j=n(k[1],S[1]),O=n(S[0],k[0]),C=n(i(k[0],S[1]),i(S[0],k[1]));return g(w[0],w[1],j,O,C)}else throw new TypeError("Invalid Arguments: Try again")},"Object, Object, Object":function(w,S,k){if(Object.keys(w).length===2&&Object.keys(S).length===2&&Object.keys(k).length===2){if(!c(w))throw new TypeError("Values of pointX and pointY should be numbers or BigNumbers");if(!c(S))throw new TypeError("Values of lineOnePtX and lineOnePtY should be numbers or BigNumbers");if(!c(k))throw new TypeError("Values of lineTwoPtX and lineTwoPtY should be numbers or BigNumbers");if(o(h(S),h(k)))throw new TypeError("LinePoint1 should not be same with LinePoint2");if("pointX"in w&&"pointY"in w&&"lineOnePtX"in S&&"lineOnePtY"in S&&"lineTwoPtX"in k&&"lineTwoPtY"in k){var j=n(k.lineTwoPtY,S.lineOnePtY),O=n(S.lineOnePtX,k.lineTwoPtX),C=n(i(k.lineTwoPtX,S.lineOnePtY),i(S.lineOnePtX,k.lineTwoPtY));return g(w.pointX,w.pointY,j,O,C)}else throw new TypeError("Key names do not match")}else throw new TypeError("Invalid Arguments: Try again")},"Array, Array":function(w,S){if(w.length===2&&S.length===3){if(!c(w))throw new TypeError("Array with 2 numbers or BigNumbers expected for first argument");if(!f(S))throw new TypeError("Array with 3 numbers or BigNumbers expected for second argument");return g(w[0],w[1],S[0],S[1],S[2])}else if(w.length===3&&S.length===6){if(!f(w))throw new TypeError("Array with 3 numbers or BigNumbers expected for first argument");if(!p(S))throw new TypeError("Array with 6 numbers or BigNumbers expected for second argument");return A(w[0],w[1],w[2],S[0],S[1],S[2],S[3],S[4],S[5])}else if(w.length===S.length&&w.length>0){if(!d(w))throw new TypeError("All values of an array should be numbers or BigNumbers");if(!d(S))throw new TypeError("All values of an array should be numbers or BigNumbers");return b(w,S)}else throw new TypeError("Invalid Arguments: Try again")},"Object, Object":function(w,S){if(Object.keys(w).length===2&&Object.keys(S).length===3){if(!c(w))throw new TypeError("Values of pointX and pointY should be numbers or BigNumbers");if(!f(S))throw new TypeError("Values of xCoeffLine, yCoeffLine and constant should be numbers or BigNumbers");if("pointX"in w&&"pointY"in w&&"xCoeffLine"in S&&"yCoeffLine"in S&&"constant"in S)return g(w.pointX,w.pointY,S.xCoeffLine,S.yCoeffLine,S.constant);throw new TypeError("Key names do not match")}else if(Object.keys(w).length===3&&Object.keys(S).length===6){if(!f(w))throw new TypeError("Values of pointX, pointY and pointZ should be numbers or BigNumbers");if(!p(S))throw new TypeError("Values of x0, y0, z0, a, b and c should be numbers or BigNumbers");if("pointX"in w&&"pointY"in w&&"x0"in S&&"y0"in S&&"z0"in S&&"a"in S&&"b"in S&&"c"in S)return A(w.pointX,w.pointY,w.pointZ,S.x0,S.y0,S.z0,S.a,S.b,S.c);throw new TypeError("Key names do not match")}else if(Object.keys(w).length===2&&Object.keys(S).length===2){if(!c(w))throw new TypeError("Values of pointOneX and pointOneY should be numbers or BigNumbers");if(!c(S))throw new TypeError("Values of pointTwoX and pointTwoY should be numbers or BigNumbers");if("pointOneX"in w&&"pointOneY"in w&&"pointTwoX"in S&&"pointTwoY"in S)return b([w.pointOneX,w.pointOneY],[S.pointTwoX,S.pointTwoY]);throw new TypeError("Key names do not match")}else if(Object.keys(w).length===3&&Object.keys(S).length===3){if(!f(w))throw new TypeError("Values of pointOneX, pointOneY and pointOneZ should be numbers or BigNumbers");if(!f(S))throw new TypeError("Values of pointTwoX, pointTwoY and pointTwoZ should be numbers or BigNumbers");if("pointOneX"in w&&"pointOneY"in w&&"pointOneZ"in w&&"pointTwoX"in S&&"pointTwoY"in S&&"pointTwoZ"in S)return b([w.pointOneX,w.pointOneY,w.pointOneZ],[S.pointTwoX,S.pointTwoY,S.pointTwoZ]);throw new TypeError("Key names do not match")}else throw new TypeError("Invalid Arguments: Try again")},Array:function(w){if(!m(w))throw new TypeError("Incorrect array format entered for pairwise distance calculation");return v(w)}});function u(x){return typeof x=="number"||It(x)}function c(x){return x.constructor!==Array&&(x=h(x)),u(x[0])&&u(x[1])}function f(x){return x.constructor!==Array&&(x=h(x)),u(x[0])&&u(x[1])&&u(x[2])}function d(x){return Array.isArray(x)||(x=h(x)),x.every(u)}function p(x){return x.constructor!==Array&&(x=h(x)),u(x[0])&&u(x[1])&&u(x[2])&&u(x[3])&&u(x[4])&&u(x[5])}function h(x){for(var w=Object.keys(x),S=[],k=0;kw.length!==2||!u(w[0])||!u(w[1])))return!1}else if(x[0].length===3&&u(x[0][0])&&u(x[0][1])&&u(x[0][2])){if(x.some(w=>w.length!==3||!u(w[0])||!u(w[1])||!u(w[2])))return!1}else return!1;return!0}function g(x,w,S,k,j){var O=l(r(r(i(S,x),i(k,w)),j)),C=s(r(i(S,S),i(k,k)));return a(O,C)}function A(x,w,S,k,j,O,C,N,D){var P=[n(i(n(j,w),D),i(n(O,S),N)),n(i(n(O,S),C),i(n(k,x),D)),n(i(n(k,x),N),i(n(j,w),C))];P=s(r(r(i(P[0],P[0]),i(P[1],P[1])),i(P[2],P[2])));var q=s(r(r(i(C,C),i(N,N)),i(D,D)));return a(P,q)}function b(x,w){for(var S=x.length,k=0,j=0,O=0;O{var{typed:t,config:r,abs:n,add:i,addScalar:a,matrix:o,multiply:s,multiplyScalar:l,divideScalar:u,subtract:c,smaller:f,equalScalar:d,flatten:p,isZero:h,isNumeric:m}=e;return t("intersect",{"Array, Array, Array":g,"Array, Array, Array, Array":A,"Matrix, Matrix, Matrix":function(N,D,P){var q=g(N.valueOf(),D.valueOf(),P.valueOf());return q===null?null:o(q)},"Matrix, Matrix, Matrix, Matrix":function(N,D,P,q){var z=A(N.valueOf(),D.valueOf(),P.valueOf(),q.valueOf());return z===null?null:o(z)}});function g(C,N,D){if(C=b(C),N=b(N),D=b(D),!x(C))throw new TypeError("Array with 3 numbers or BigNumbers expected for first argument");if(!x(N))throw new TypeError("Array with 3 numbers or BigNumbers expected for second argument");if(!w(D))throw new TypeError("Array with 4 numbers expected as third argument");return O(C[0],C[1],C[2],N[0],N[1],N[2],D[0],D[1],D[2],D[3])}function A(C,N,D,P){if(C=b(C),N=b(N),D=b(D),P=b(P),C.length===2){if(!v(C))throw new TypeError("Array with 2 numbers or BigNumbers expected for first argument");if(!v(N))throw new TypeError("Array with 2 numbers or BigNumbers expected for second argument");if(!v(D))throw new TypeError("Array with 2 numbers or BigNumbers expected for third argument");if(!v(P))throw new TypeError("Array with 2 numbers or BigNumbers expected for fourth argument");return S(C,N,D,P)}else if(C.length===3){if(!x(C))throw new TypeError("Array with 3 numbers or BigNumbers expected for first argument");if(!x(N))throw new TypeError("Array with 3 numbers or BigNumbers expected for second argument");if(!x(D))throw new TypeError("Array with 3 numbers or BigNumbers expected for third argument");if(!x(P))throw new TypeError("Array with 3 numbers or BigNumbers expected for fourth argument");return j(C[0],C[1],C[2],N[0],N[1],N[2],D[0],D[1],D[2],P[0],P[1],P[2])}else throw new TypeError("Arrays with two or thee dimensional points expected")}function b(C){return C.length===1?C[0]:C.length>1&&Array.isArray(C[0])&&C.every(N=>Array.isArray(N)&&N.length===1)?p(C):C}function v(C){return C.length===2&&m(C[0])&&m(C[1])}function x(C){return C.length===3&&m(C[0])&&m(C[1])&&m(C[2])}function w(C){return C.length===4&&m(C[0])&&m(C[1])&&m(C[2])&&m(C[3])}function S(C,N,D,P){var q=C,z=D,I=c(q,N),T=c(z,P),L=c(l(I[0],T[1]),l(T[0],I[1]));if(h(L)||f(n(L),r.epsilon))return null;var _=l(T[0],q[1]),Y=l(T[1],q[0]),oe=l(T[0],z[1]),te=l(T[1],z[0]),Q=u(a(c(c(_,Y),oe),te),L);return i(s(I,Q),q)}function k(C,N,D,P,q,z,I,T,L,_,Y,oe){var te=l(c(C,N),c(D,P)),Q=l(c(q,z),c(I,T)),fe=l(c(L,_),c(Y,oe));return a(a(te,Q),fe)}function j(C,N,D,P,q,z,I,T,L,_,Y,oe){var te=k(C,I,_,I,N,T,Y,T,D,L,oe,L),Q=k(_,I,P,C,Y,T,q,N,oe,L,z,D),fe=k(C,I,P,C,N,T,q,N,D,L,z,D),Ie=k(_,I,_,I,Y,T,Y,T,oe,L,oe,L),Se=k(P,C,P,C,q,N,q,N,z,D,z,D),Oe=c(l(te,Q),l(fe,Ie)),ve=c(l(Se,Ie),l(Q,Q));if(h(ve))return null;var ye=u(Oe,ve),me=u(a(te,l(ye,Q)),Ie),ke=a(C,l(ye,c(P,C))),$=a(N,l(ye,c(q,N))),ae=a(D,l(ye,c(z,D))),ce=a(I,l(me,c(_,I))),U=a(T,l(me,c(Y,T))),R=a(L,l(me,c(oe,L)));return d(ke,ce)&&d($,U)&&d(ae,R)?[ke,$,ae]:null}function O(C,N,D,P,q,z,I,T,L,_){var Y=l(C,I),oe=l(P,I),te=l(N,T),Q=l(q,T),fe=l(D,L),Ie=l(z,L),Se=c(c(c(_,Y),te),fe),Oe=c(c(c(a(a(oe,Q),Ie),Y),te),fe),ve=u(Se,Oe),ye=a(C,l(ve,c(P,C))),me=a(N,l(ve,c(q,N))),ke=a(D,l(ve,c(z,D)));return[ye,me,ke]}});var bAe="sum",iWe=["typed","config","add","numeric"],CS=V(bAe,iWe,e=>{var{typed:t,config:r,add:n,numeric:i}=e;return t(bAe,{"Array | Matrix":a,"Array | Matrix, number | BigNumber":o,"...":function(l){if(Cd(l))throw new TypeError("Scalar values expected in function sum");return a(l)}});function a(s){var l;return au(s,function(u){try{l=l===void 0?u:n(l,u)}catch(c){throw La(c,"sum",u)}}),l===void 0&&(l=i(0,r.number)),typeof l=="string"&&(l=i(l,r.number)),l}function o(s,l){try{var u=V0(s,l,n);return u}catch(c){throw La(c,"sum")}}});var fP="cumsum",aWe=["typed","add","unaryPlus"],DS=V(fP,aWe,e=>{var{typed:t,add:r,unaryPlus:n}=e;return t(fP,{Array:i,Matrix:function(u){return u.create(i(u.valueOf()))},"Array, number | BigNumber":o,"Matrix, number | BigNumber":function(u,c){return u.create(o(u.valueOf(),c))},"...":function(u){if(Cd(u))throw new TypeError("All values expected to be scalar in function cumsum");return i(u)}});function i(l){try{return a(l)}catch(u){throw La(u,fP)}}function a(l){if(l.length===0)return[];for(var u=[n(l[0])],c=1;c=c.length)throw new As(u,c.length);try{return s(l,u)}catch(f){throw La(f,fP)}}function s(l,u){var c,f,d;if(u<=0){var p=l[0][0];if(Array.isArray(p)){for(d=_T(l),f=[],c=0;c{var{typed:t,add:r,divide:n}=e;return t(xAe,{"Array | Matrix":a,"Array | Matrix, number | BigNumber":i,"...":function(s){if(Cd(s))throw new TypeError("Scalar values expected in function mean");return a(s)}});function i(o,s){try{var l=V0(o,s,r),u=Array.isArray(o)?Yt(o):o.size();return n(l,u[s])}catch(c){throw La(c,"mean")}}function a(o){var s,l=0;if(au(o,function(u){try{s=s===void 0?u:r(s,u),l++}catch(c){throw La(c,"mean",u)}}),l===0)throw new Error("Cannot calculate the mean of an empty array");return n(s,l)}});var wAe="median",sWe=["typed","add","divide","compare","partitionSelect"],dP=V(wAe,sWe,e=>{var{typed:t,add:r,divide:n,compare:i,partitionSelect:a}=e;function o(u){try{u=mr(u.valueOf());var c=u.length;if(c===0)throw new Error("Cannot calculate median of an empty array");if(c%2===0){for(var f=c/2-1,d=a(u,f+1),p=u[f],h=0;h0&&(p=u[h]);return l(p,d)}else{var m=a(u,(c-1)/2);return s(m)}}catch(g){throw La(g,"median")}}var s=t({"number | BigNumber | Complex | Unit":function(c){return c}}),l=t({"number | BigNumber | Complex | Unit, number | BigNumber | Complex | Unit":function(c,f){return n(r(c,f),2)}});return t(wAe,{"Array | Matrix":o,"Array | Matrix, number | BigNumber":function(c,f){throw new Error("median(A, dim) is not yet supported")},"...":function(c){if(Cd(c))throw new TypeError("Scalar values expected in function median");return o(c)}})});var SAe="mad",lWe=["typed","abs","map","median","subtract"],pP=V(SAe,lWe,e=>{var{typed:t,abs:r,map:n,median:i,subtract:a}=e;return t(SAe,{"Array | Matrix":o,"...":function(l){return o(l)}});function o(s){if(s=mr(s.valueOf()),s.length===0)throw new Error("Cannot calculate median absolute deviation (mad) of an empty array");try{var l=i(s);return i(n(s,function(u){return r(a(u,l))}))}catch(u){throw u instanceof TypeError&&u.message.indexOf("median")!==-1?new TypeError(u.message.replace("median","mad")):La(u,"mad")}}});var TH="unbiased",EAe="variance",uWe=["typed","add","subtract","multiply","divide","apply","isNaN"],MS=V(EAe,uWe,e=>{var{typed:t,add:r,subtract:n,multiply:i,divide:a,apply:o,isNaN:s}=e;return t(EAe,{"Array | Matrix":function(f){return l(f,TH)},"Array | Matrix, string":l,"Array | Matrix, number | BigNumber":function(f,d){return u(f,d,TH)},"Array | Matrix, number | BigNumber, string":u,"...":function(f){return l(f,TH)}});function l(c,f){var d,p=0;if(c.length===0)throw new SyntaxError("Function variance requires one or more parameters (0 provided)");if(au(c,function(g){try{d=d===void 0?g:r(d,g),p++}catch(A){throw La(A,"variance",g)}}),p===0)throw new Error("Cannot calculate variance of an empty array");var h=a(d,p);if(d=void 0,au(c,function(g){var A=n(g,h);d=d===void 0?i(A,A):r(d,i(A,A))}),s(d))return d;switch(f){case"uncorrected":return a(d,p);case"biased":return a(d,p+1);case"unbiased":{var m=It(d)?d.mul(0):0;return p===1?m:a(d,p-1)}default:throw new Error('Unknown normalization "'+f+'". Choose "unbiased" (default), "uncorrected", or "biased".')}}function u(c,f,d){try{if(c.length===0)throw new SyntaxError("Function variance requires one or more parameters (0 provided)");return o(c,f,p=>l(p,d))}catch(p){throw La(p,"variance")}}});var kAe="quantileSeq",cWe=["typed","?bignumber","add","subtract","divide","multiply","partitionSelect","compare","isInteger","smaller","smallerEq","larger"],jS=V(kAe,cWe,e=>{var{typed:t,bignumber:r,add:n,subtract:i,divide:a,multiply:o,partitionSelect:s,compare:l,isInteger:u,smaller:c,smallerEq:f,larger:d}=e,p=G0({typed:t,isInteger:u});return t(kAe,{"Array | Matrix, number | BigNumber":(b,v)=>m(b,v,!1),"Array | Matrix, number | BigNumber, number":(b,v,x)=>h(b,v,!1,x,m),"Array | Matrix, number | BigNumber, boolean":m,"Array | Matrix, number | BigNumber, boolean, number":(b,v,x,w)=>h(b,v,x,w,m),"Array | Matrix, Array | Matrix":(b,v)=>g(b,v,!1),"Array | Matrix, Array | Matrix, number":(b,v,x)=>h(b,v,!1,x,g),"Array | Matrix, Array | Matrix, boolean":g,"Array | Matrix, Array | Matrix, boolean, number":(b,v,x,w)=>h(b,v,x,w,g)});function h(b,v,x,w,S){return p(b,w,k=>S(k,v,x))}function m(b,v,x){var w,S=b.valueOf();if(c(v,0))throw new Error("N/prob must be non-negative");if(f(v,1))return Qt(v)?A(S,v,x):r(A(S,v,x));if(d(v,1)){if(!u(v))throw new Error("N must be a positive integer");if(d(v,4294967295))throw new Error("N must be less than or equal to 2^32-1, as that is the maximum length of an Array");var k=n(v,1);w=[];for(var j=0;c(j,v);j++){var O=a(j+1,k);w.push(A(S,O,x))}return Qt(v)?w:r(w)}}function g(b,v,x){for(var w=b.valueOf(),S=v.valueOf(),k=[],j=0;j0&&(C=w[D])}return n(o(C,i(1,O)),o(N,O))}});var CAe="std",fWe=["typed","map","sqrt","variance"],NS=V(CAe,fWe,e=>{var{typed:t,map:r,sqrt:n,variance:i}=e;return t(CAe,{"Array | Matrix":a,"Array | Matrix, string":a,"Array | Matrix, number | BigNumber":a,"Array | Matrix, number | BigNumber, string":a,"...":function(s){return a(s)}});function a(o,s){if(o.length===0)throw new SyntaxError("Function std requires one or more parameters (0 provided)");try{var l=i.apply(null,arguments);return Da(l)?r(l,n):n(l)}catch(u){throw u instanceof TypeError&&u.message.indexOf(" variance")!==-1?new TypeError(u.message.replace(" variance"," std")):u}}});var DAe="corr",dWe=["typed","matrix","mean","sqrt","sum","add","subtract","multiply","pow","divide"],mP=V(DAe,dWe,e=>{var{typed:t,matrix:r,sqrt:n,sum:i,add:a,subtract:o,multiply:s,pow:l,divide:u}=e;return t(DAe,{"Array, Array":function(p,h){return c(p,h)},"Matrix, Matrix":function(p,h){var m=c(p.toArray(),h.toArray());return Array.isArray(m)?r(m):m}});function c(d,p){var h=[];if(Array.isArray(d[0])&&Array.isArray(p[0])){if(d.length!==p.length)throw new SyntaxError("Dimension mismatch. Array A and B must have the same length.");for(var m=0;ma(S,s(k,p[j])),0),b=i(d.map(S=>l(S,2))),v=i(p.map(S=>l(S,2))),x=o(s(h,A),s(m,g)),w=n(s(o(s(h,b),l(m,2)),o(s(h,v),l(g,2))));return u(x,w)}});var OAe="combinations",pWe=["typed"],hP=V(OAe,pWe,e=>{var{typed:t}=e;return t(OAe,{"number, number":HW,"BigNumber, BigNumber":function(n,i){var a=n.constructor,o,s,l=n.minus(i),u=new a(1);if(!MAe(n)||!MAe(i))throw new TypeError("Positive integer value expected in function combinations");if(i.gt(n))throw new TypeError("k must be less than n in function combinations");if(o=u,i.lt(l))for(s=u;s.lte(l);s=s.plus(u))o=o.times(i.plus(s)).dividedBy(s);else for(s=u;s.lte(i);s=s.plus(u))o=o.times(l.plus(s)).dividedBy(s);return o}})});function MAe(e){return e.isInteger()&&e.gte(0)}var jAe="combinationsWithRep",mWe=["typed"],AP=V(jAe,mWe,e=>{var{typed:t}=e;return t(jAe,{"number, number":function(n,i){if(!wt(n)||n<0)throw new TypeError("Positive integer value expected in function combinationsWithRep");if(!wt(i)||i<0)throw new TypeError("Positive integer value expected in function combinationsWithRep");if(n<1)throw new TypeError("k must be less than or equal to n + k - 1");if(i{var{typed:t,config:r,multiplyScalar:n,pow:i,BigNumber:a,Complex:o}=e;function s(u){if(u.im===0)return Q6(u.re);if(u.re<.5){var c=new o(1-u.re,-u.im),f=new o(Math.PI*u.re,Math.PI*u.im);return new o(Math.PI).div(f.sin()).div(s(c))}u=new o(u.re-1,u.im);for(var d=new o(Ey[0],0),p=1;p2;)d-=2,h+=d,p=p.times(h);return new a(p.toPrecision(a.precision))}});var FAe="lgamma",AWe=["Complex","typed"],vP=V(FAe,AWe,e=>{var{Complex:t,typed:r}=e,n=7,i=7,a=[-.029550653594771242,.00641025641025641,-.0019175269175269176,.0008417508417508417,-.0005952380952380953,.0007936507936507937,-.002777777777777778,.08333333333333333];return r(FAe,{number:Y6,Complex:o,BigNumber:function(){throw new Error("mathjs doesn't yet provide an implementation of the algorithm lgamma for BigNumber")}});function o(u){var c=6.283185307179586,f=1.1447298858494002,d=.1;if(u.isNaN())return new t(NaN,NaN);if(u.im===0)return new t(Y6(u.re),0);if(u.re>=n||Math.abs(u.im)>=i)return s(u);if(u.re<=d){var p=cse(c,u.im)*Math.floor(.5*u.re+.25),h=u.mul(Math.PI).sin().log(),m=o(new t(1-u.re,-u.im));return new t(f,p).sub(h).sub(m)}else return u.im>=0?l(u):l(u.conjugate()).conjugate()}function s(u){for(var c=u.sub(.5).mul(u.log()).sub(u).add(KW),f=new t(1,0).div(u),d=f.div(u),p=a[0],h=a[1],m=2*d.re,g=d.re*d.re+d.im*d.im,A=2;A<8;A++){var b=h;h=-g*p+a[A],p=m*p+b}var v=f.mul(d.mul(p).add(h));return c.add(v)}function l(u){var c=0,f=0,d=u;for(u=u.add(1);u.re<=n;){d=d.mul(u);var p=d.im<0?1:0;p!==0&&f===0&&c++,f=p,u=u.add(1)}return s(u).sub(d.log()).sub(new t(0,c*2*Math.PI*1))}});var _Ae="factorial",gWe=["typed","gamma"],yP=V(_Ae,gWe,e=>{var{typed:t,gamma:r}=e;return t(_Ae,{number:function(i){if(i<0)throw new Error("Value must be non-negative");return r(i+1)},BigNumber:function(i){if(i.isNegative())throw new Error("Value must be non-negative");return r(i.plus(1))},"Array | Matrix":t.referToSelf(n=>i=>jt(i,n))})});var PAe="kldivergence",vWe=["typed","matrix","divide","sum","multiply","map","dotDivide","log","isNumeric"],bP=V(PAe,vWe,e=>{var{typed:t,matrix:r,divide:n,sum:i,multiply:a,map:o,dotDivide:s,log:l,isNumeric:u}=e;return t(PAe,{"Array, Array":function(d,p){return c(r(d),r(p))},"Matrix, Array":function(d,p){return c(d,r(p))},"Array, Matrix":function(d,p){return c(r(d),p)},"Matrix, Matrix":function(d,p){return c(d,p)}});function c(f,d){var p=d.size().length,h=f.size().length;if(p>1)throw new Error("first object must be one dimensional");if(h>1)throw new Error("second object must be one dimensional");if(p!==h)throw new Error("Length of two vectors must be equal");var m=i(f);if(m===0)throw new Error("Sum of elements in first object must be non zero");var g=i(d);if(g===0)throw new Error("Sum of elements in second object must be non zero");var A=n(f,i(f)),b=n(d,i(d)),v=i(a(A,o(s(A,b),x=>l(x))));return u(v)?v:Number.NaN}});var IAe="multinomial",yWe=["typed","add","divide","multiply","factorial","isInteger","isPositive"],xP=V(IAe,yWe,e=>{var{typed:t,add:r,divide:n,multiply:i,factorial:a,isInteger:o,isPositive:s}=e;return t(IAe,{"Array | Matrix":function(u){var c=0,f=1;return au(u,function(d){if(!o(d)||!s(d))throw new TypeError("Positive integer value expected in function multinomial");c=r(c,d),f=i(f,a(d))}),n(a(c),f)}})});var BAe="permutations",bWe=["typed","factorial"],wP=V(BAe,bWe,e=>{var{typed:t,factorial:r}=e;return t(BAe,{"number | BigNumber":r,"number, number":function(i,a){if(!wt(i)||i<0)throw new TypeError("Positive integer value expected in function permutations");if(!wt(a)||a<0)throw new TypeError("Positive integer value expected in function permutations");if(a>i)throw new TypeError("second argument k must be less than or equal to first argument n");return yf(i-a+1,i)},"BigNumber, BigNumber":function(i,a){var o,s;if(!RAe(i)||!RAe(a))throw new TypeError("Positive integer value expected in function permutations");if(a.gt(i))throw new TypeError("second argument k must be less than or equal to first argument n");var l=i.mul(0).add(1);for(o=l,s=i.minus(a).plus(1);s.lte(i);s=s.plus(1))o=o.times(s);return o}})});function RAe(e){return e.isInteger()&&e.gte(0)}var $H=Ae(ege(),1),DWe=(0,$H.default)(Date.now());function VA(e){var t;function r(i){t=i===null?DWe:(0,$H.default)(String(i))}r(e);function n(){return t()}return n}var tge="pickRandom",OWe=["typed","config","?on"],EP=V(tge,OWe,e=>{var{typed:t,config:r,on:n}=e,i=VA(r.randomSeed);return n&&n("config",function(o,s){o.randomSeed!==s.randomSeed&&(i=VA(o.randomSeed))}),t(tge,{"Array | Matrix":function(s){return a(s,{})},"Array | Matrix, Object":function(s,l){return a(s,l)},"Array | Matrix, number":function(s,l){return a(s,{number:l})},"Array | Matrix, Array | Matrix":function(s,l){return a(s,{weights:l})},"Array | Matrix, Array | Matrix, number":function(s,l,u){return a(s,{number:u,weights:l})},"Array | Matrix, number, Array | Matrix":function(s,l,u){return a(s,{number:l,weights:u})}});function a(o,s){var{number:l,weights:u,elementWise:c=!0}=s,f=typeof l>"u";f&&(l=1);var d=St(o)?o.create:St(u)?u.create:null;o=o.valueOf(),u&&(u=u.valueOf()),c===!0&&(o=mr(o),u=mr(u));var p=0;if(typeof u<"u"){if(u.length!==o.length)throw new Error("Weights must have the same length as possibles");for(var h=0,m=u.length;h"u")b=o[Math.floor(i()*g)];else for(var v=i()*p,x=0,w=o.length;x1)for(var n=0,i=e.shift();n{var{typed:t,config:r,on:n}=e,i=VA(r.randomSeed);return n&&n("config",function(s,l){s.randomSeed!==l.randomSeed&&(i=VA(s.randomSeed))}),t(rge,{"":()=>o(0,1),number:s=>o(0,s),"number, number":(s,l)=>o(s,l),"Array | Matrix":s=>a(s,0,1),"Array | Matrix, number":(s,l)=>a(s,0,l),"Array | Matrix, number, number":(s,l,u)=>a(s,l,u)});function a(s,l,u){var c=eC(s.valueOf(),()=>o(l,u));return St(s)?s.create(c):c}function o(s,l){return s+i()*(l-s)}});var nge="randomInt",jWe=["typed","config","?on"],CP=V(nge,jWe,e=>{var{typed:t,config:r,on:n}=e,i=VA(r.randomSeed);return n&&n("config",function(s,l){s.randomSeed!==l.randomSeed&&(i=VA(s.randomSeed))}),t(nge,{"":()=>o(0,1),number:s=>o(0,s),"number, number":(s,l)=>o(s,l),"Array | Matrix":s=>a(s,0,1),"Array | Matrix, number":(s,l)=>a(s,0,l),"Array | Matrix, number, number":(s,l,u)=>a(s,l,u)});function a(s,l,u){var c=eC(s.valueOf(),()=>o(l,u));return St(s)?s.create(c):c}function o(s,l){return Math.floor(s+i()*(l-s))}});var ige="stirlingS2",NWe=["typed","addScalar","subtractScalar","multiplyScalar","divideScalar","pow","factorial","combinations","isNegative","isInteger","number","?bignumber","larger"],DP=V(ige,NWe,e=>{var{typed:t,addScalar:r,subtractScalar:n,multiplyScalar:i,divideScalar:a,pow:o,factorial:s,combinations:l,isNegative:u,isInteger:c,number:f,bignumber:d,larger:p}=e,h=[],m=[];return t(ige,{"number | BigNumber, number | BigNumber":function(A,b){if(!c(A)||u(A)||!c(b)||u(b))throw new TypeError("Non-negative integer value expected in function stirlingS2");if(p(b,A))throw new TypeError("k must be less than or equal to n in function stirlingS2");var v=!(Qt(A)&&Qt(b)),x=v?m:h,w=v?d:f,S=f(A),k=f(b);if(x[S]&&x[S].length>k)return x[S][k];for(var j=0;j<=S;++j)if(x[j]||(x[j]=[w(j===0?1:0)]),j!==0)for(var O=x[j],C=x[j-1],N=O.length;N<=j&&N<=k;++N)N===j?O[N]=1:O[N]=r(i(w(N),C[N]),C[N-1]);return x[S][k]}})});var age="bellNumbers",TWe=["typed","addScalar","isNegative","isInteger","stirlingS2"],OP=V(age,TWe,e=>{var{typed:t,addScalar:r,isNegative:n,isInteger:i,stirlingS2:a}=e;return t(age,{"number | BigNumber":function(s){if(!i(s)||n(s))throw new TypeError("Non-negative integer value expected in function bellNumbers");for(var l=0,u=0;u<=s;u++)l=r(l,a(s,u));return l}})});var oge="catalan",FWe=["typed","addScalar","divideScalar","multiplyScalar","combinations","isNegative","isInteger"],MP=V(oge,FWe,e=>{var{typed:t,addScalar:r,divideScalar:n,multiplyScalar:i,combinations:a,isNegative:o,isInteger:s}=e;return t(oge,{"number | BigNumber":function(u){if(!s(u)||o(u))throw new TypeError("Non-negative integer value expected in function catalan");return n(a(i(u,2),u),r(u,1))}})});var sge="composition",_We=["typed","addScalar","combinations","isNegative","isPositive","isInteger","larger"],jP=V(sge,_We,e=>{var{typed:t,addScalar:r,combinations:n,isPositive:i,isNegative:a,isInteger:o,larger:s}=e;return t(sge,{"number | BigNumber, number | BigNumber":function(u,c){if(!o(u)||!i(u)||!o(c)||!i(c))throw new TypeError("Positive integer value expected in function composition");if(s(c,u))throw new TypeError("k must be less than or equal to n in function composition");return n(r(u,-1),r(c,-1))}})});var lge="leafCount",PWe=["parse","typed"],NP=V(lge,PWe,e=>{var{parse:t,typed:r}=e;function n(i){var a=0;return i.forEach(o=>{a+=n(o)}),a||1}return r(lge,{Node:function(a){return n(a)}})});function qH(e){return gr(e)||bi(e)&&e.isUnary()&&gr(e.args[0])}function tC(e){return!!(gr(e)||(xl(e)||bi(e))&&e.args.every(tC)||ms(e)&&tC(e.content))}function uge(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function LH(e){for(var t=1;t{var{FunctionNode:t,OperatorNode:r,SymbolNode:n}=e,i=!0,a=!1,o="defaultF",s={add:{trivial:i,total:i,commutative:i,associative:i},unaryPlus:{trivial:i,total:i,commutative:i,associative:i},subtract:{trivial:a,total:i,commutative:a,associative:a},multiply:{trivial:i,total:i,commutative:i,associative:i},divide:{trivial:a,total:i,commutative:a,associative:a},paren:{trivial:i,total:i,commutative:i,associative:a},defaultF:{trivial:a,total:i,commutative:a,associative:a}},l={divide:{total:a},log:{total:a}},u={subtract:{total:a},abs:{trivial:i},log:{total:i}};function c(v,x){var w=arguments.length>2&&arguments[2]!==void 0?arguments[2]:s,S=o;if(typeof v=="string"?S=v:bi(v)?S=v.fn.toString():xl(v)?S=v.name:ms(v)&&(S="paren"),Et(w,S)){var k=w[S];if(Et(k,x))return k[x];if(Et(s,S))return s[S][x]}if(Et(w,o)){var j=w[o];return Et(j,x)?j[x]:s[o][x]}if(Et(s,S)){var O=s[S];if(Et(O,x))return O[x]}return s[o][x]}function f(v){var x=arguments.length>1&&arguments[1]!==void 0?arguments[1]:s;return c(v,"commutative",x)}function d(v){var x=arguments.length>1&&arguments[1]!==void 0?arguments[1]:s;return c(v,"associative",x)}function p(v,x){var w=LH({},v);for(var S in x)Et(v,S)?w[S]=LH(LH({},x[S]),v[S]):w[S]=x[S];return w}function h(v,x){if(!v.args||v.args.length===0)return v;v.args=m(v,x);for(var w=0;w2&&d(v,x)){for(var j=v.args.pop();v.args.length>0;)j=w([v.args.pop(),j]);v.args=j.args}}}function A(v,x){if(!(!v.args||v.args.length===0)){for(var w=b(v),S=v.args.length,k=0;k2&&d(v,x)){for(var j=v.args.shift();v.args.length>0;)j=w([j,v.args.shift()]);v.args=j.args}}}function b(v){return bi(v)?function(x){try{return new r(v.op,v.fn,x,v.implicit)}catch(w){return console.error(w),[]}}:function(x){return new t(new n(v.name),x)}}return{createMakeNodeFunction:b,hasProperty:c,isCommutative:f,isAssociative:d,mergeContext:p,flatten:h,allChildren:m,unflattenr:g,unflattenl:A,defaultContext:s,realContext:l,positiveContext:u}});var RWe="simplify",$We=["config","typed","parse","add","subtract","multiply","divide","pow","isZero","equal","resolve","simplifyConstant","simplifyCore","?fraction","?bignumber","mathWithTransform","matrix","AccessorNode","ArrayNode","ConstantNode","FunctionNode","IndexNode","ObjectNode","OperatorNode","ParenthesisNode","SymbolNode"],TP=V(RWe,$We,e=>{var{config:t,typed:r,parse:n,add:i,subtract:a,multiply:o,divide:s,pow:l,isZero:u,equal:c,resolve:f,simplifyConstant:d,simplifyCore:p,fraction:h,bignumber:m,mathWithTransform:g,matrix:A,AccessorNode:b,ArrayNode:v,ConstantNode:x,FunctionNode:w,IndexNode:S,ObjectNode:k,OperatorNode:j,ParenthesisNode:O,SymbolNode:C}=e,{hasProperty:N,isCommutative:D,isAssociative:P,mergeContext:q,flatten:z,unflattenr:I,unflattenl:T,createMakeNodeFunction:L,defaultContext:_,realContext:Y,positiveContext:oe}=TS({FunctionNode:w,OperatorNode:j,SymbolNode:C});r.addConversion({from:"Object",to:"Map",convert:zA});var te=r("simplify",{Node:ye,"Node, Map":(ee,ie)=>ye(ee,!1,ie),"Node, Map, Object":(ee,ie,re)=>ye(ee,!1,ie,re),"Node, Array":ye,"Node, Array, Map":ye,"Node, Array, Map, Object":ye});r.removeConversion({from:"Object",to:"Map",convert:zA}),te.defaultContext=_,te.realContext=Y,te.positiveContext=oe;function Q(ee){return ee.transform(function(ie,re,Ee){return ms(ie)?Q(ie.content):ie})}var fe={true:!0,false:!0,e:!0,i:!0,Infinity:!0,LN2:!0,LN10:!0,LOG2E:!0,LOG10E:!0,NaN:!0,phi:!0,pi:!0,SQRT1_2:!0,SQRT2:!0,tau:!0};te.rules=[p,{l:"log(e)",r:"1"},{s:"n-n1 -> n+-n1",assuming:{subtract:{total:!0}}},{s:"n-n -> 0",assuming:{subtract:{total:!1}}},{s:"-(cl*v) -> v * (-cl)",assuming:{multiply:{commutative:!0},subtract:{total:!0}}},{s:"-(cl*v) -> (-cl) * v",assuming:{multiply:{commutative:!1},subtract:{total:!0}}},{s:"-(v*cl) -> v * (-cl)",assuming:{multiply:{commutative:!1},subtract:{total:!0}}},{l:"-(n1/n2)",r:"-n1/n2"},{l:"-v",r:"v * (-1)"},{l:"(n1 + n2)*(-1)",r:"n1*(-1) + n2*(-1)",repeat:!0},{l:"n/n1^n2",r:"n*n1^-n2"},{l:"n/n1",r:"n*n1^-1"},{s:"(n1*n2)^n3 -> n1^n3 * n2^n3",assuming:{multiply:{commutative:!0}}},{s:"(n1*n2)^(-1) -> n2^(-1) * n1^(-1)",assuming:{multiply:{commutative:!1}}},{s:"(n ^ n1) ^ n2 -> n ^ (n1 * n2)",assuming:{divide:{total:!0}}},{l:" vd * ( vd * n1 + n2)",r:"vd^2 * n1 + vd * n2"},{s:" vd * (vd^n4 * n1 + n2) -> vd^(1+n4) * n1 + vd * n2",assuming:{divide:{total:!0}}},{s:"vd^n3 * ( vd * n1 + n2) -> vd^(n3+1) * n1 + vd^n3 * n2",assuming:{divide:{total:!0}}},{s:"vd^n3 * (vd^n4 * n1 + n2) -> vd^(n3+n4) * n1 + vd^n3 * n2",assuming:{divide:{total:!0}}},{l:"n*n",r:"n^2"},{s:"n * n^n1 -> n^(n1+1)",assuming:{divide:{total:!0}}},{s:"n^n1 * n^n2 -> n^(n1+n2)",assuming:{divide:{total:!0}}},d,{s:"n+n -> 2*n",assuming:{add:{total:!0}}},{l:"n+-n",r:"0"},{l:"vd*n + vd",r:"vd*(n+1)"},{l:"n3*n1 + n3*n2",r:"n3*(n1+n2)"},{l:"n3^(-n4)*n1 + n3 * n2",r:"n3^(-n4)*(n1 + n3^(n4+1) *n2)"},{l:"n3^(-n4)*n1 + n3^n5 * n2",r:"n3^(-n4)*(n1 + n3^(n4+n5)*n2)"},{s:"n*vd + vd -> (n+1)*vd",assuming:{multiply:{commutative:!1}}},{s:"vd + n*vd -> (1+n)*vd",assuming:{multiply:{commutative:!1}}},{s:"n1*n3 + n2*n3 -> (n1+n2)*n3",assuming:{multiply:{commutative:!1}}},{s:"n^n1 * n -> n^(n1+1)",assuming:{divide:{total:!0},multiply:{commutative:!1}}},{s:"n1*n3^(-n4) + n2 * n3 -> (n1 + n2*n3^(n4 + 1))*n3^(-n4)",assuming:{multiply:{commutative:!1}}},{s:"n1*n3^(-n4) + n2 * n3^n5 -> (n1 + n2*n3^(n4 + n5))*n3^(-n4)",assuming:{multiply:{commutative:!1}}},{l:"n*cd + cd",r:"(n+1)*cd"},{s:"cd*n + cd -> cd*(n+1)",assuming:{multiply:{commutative:!1}}},{s:"cd + cd*n -> cd*(1+n)",assuming:{multiply:{commutative:!1}}},d,{s:"(-n)*n1 -> -(n*n1)",assuming:{subtract:{total:!0}}},{s:"n1*(-n) -> -(n1*n)",assuming:{subtract:{total:!0},multiply:{commutative:!1}}},{s:"ce+ve -> ve+ce",assuming:{add:{commutative:!0}},imposeContext:{add:{commutative:!1}}},{s:"vd*cd -> cd*vd",assuming:{multiply:{commutative:!0}},imposeContext:{multiply:{commutative:!1}}},{l:"n+-n1",r:"n-n1"},{l:"n+-(n1)",r:"n-(n1)"},{s:"n*(n1^-1) -> n/n1",assuming:{multiply:{commutative:!0}}},{s:"n*n1^-n2 -> n/n1^n2",assuming:{multiply:{commutative:!0}}},{s:"n^-1 -> 1/n",assuming:{multiply:{commutative:!0}}},{l:"n^1",r:"n"},{s:"n*(n1/n2) -> (n*n1)/n2",assuming:{multiply:{associative:!0}}},{s:"n-(n1+n2) -> n-n1-n2",assuming:{addition:{associative:!0,commutative:!0}}},{l:"1*n",r:"n",imposeContext:{multiply:{commutative:!0}}},{s:"n1/(n2/n3) -> (n1*n3)/n2",assuming:{multiply:{associative:!0}}},{l:"n1/(-n2)",r:"-n1/n2"}];function Ie(ee,ie){var re={};if(ee.s){var Ee=ee.s.split("->");if(Ee.length===2)re.l=Ee[0],re.r=Ee[1];else throw SyntaxError("Could not parse rule: "+ee.s)}else re.l=ee.l,re.r=ee.r;re.l=Q(n(re.l)),re.r=Q(n(re.r));for(var Ce of["imposeContext","repeat","assuming"])Ce in ee&&(re[Ce]=ee[Ce]);if(ee.evaluate&&(re.evaluate=n(ee.evaluate)),P(re.l,ie)){var _e=!D(re.l,ie),he;_e&&(he=ve());var ze=L(re.l),Ye=ve();re.expanded={},re.expanded.l=ze([re.l,Ye]),z(re.expanded.l,ie),I(re.expanded.l,ie),re.expanded.r=ze([re.r,Ye]),_e&&(re.expandedNC1={},re.expandedNC1.l=ze([he,re.l]),re.expandedNC1.r=ze([he,re.r]),re.expandedNC2={},re.expandedNC2.l=ze([he,re.expanded.l]),re.expandedNC2.r=ze([he,re.expanded.r]))}return re}function Se(ee,ie){for(var re=[],Ee=0;Ee2&&arguments[2]!==void 0?arguments[2]:L0(),Ee=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{},Ce=Ee.consoleDebug;ie=Se(ie||te.rules,Ee.context);var _e=f(ee,re);_e=Q(_e);for(var he={},ze=_e.toString({parenthesis:"all"});!he[ze];){he[ze]=!0,Oe=0;var Ye=ze;Ce&&console.log("Working on: ",ze);for(var tt=0;tt ").concat(ie[tt].r.toString()))),Ce){var we=_e.toString({parenthesis:"all"});we!==Ye&&(console.log("Applying",Ct,"produced",we),Ye=we)}T(_e,Ee.context)}ze=_e.toString({parenthesis:"all"})}return _e}function me(ee,ie,re){var Ee=ee;if(ee)for(var Ce=0;Ce1&&(Ye=_e(ee.args.slice(0,ze))),Ce=ee.args.slice(ze),Ee=Ce.length===1?Ce[0]:_e(Ce),re.push(_e([Ye,Ee]))}return re}function ae(ee,ie){var re={placeholders:{}};if(!ee.placeholders&&!ie.placeholders)return re;if(ee.placeholders){if(!ie.placeholders)return ee}else return ie;for(var Ee in ee.placeholders)if(Et(ee.placeholders,Ee)&&(re.placeholders[Ee]=ee.placeholders[Ee],Et(ie.placeholders,Ee)&&!J(ee.placeholders[Ee],ie.placeholders[Ee])))return null;for(var Ce in ie.placeholders)Et(ie.placeholders,Ce)&&(re.placeholders[Ce]=ie.placeholders[Ce]);return re}function ce(ee,ie){var re=[];if(ee.length===0||ie.length===0)return re;for(var Ee,Ce=0;Ce2)throw new Error("permuting >2 commutative non-associative rule arguments not yet implemented");var Ye=R(ee.args[0],ie.args[1],re);if(Ye.length===0)return[];var tt=R(ee.args[1],ie.args[0],re);if(tt.length===0)return[];_e=[Ye,tt]}Ce=U(_e)}else if(ie.args.length>=2&&ee.args.length===2){for(var Ct=$(ie,re),we=[],Be=0;Be2)throw Error("Unexpected non-binary associative function: "+ee.toString());return[]}}else if(ee instanceof C){if(ee.name.length===0)throw new Error("Symbol in rule has 0 length...!?");if(fe[ee.name]){if(ee.name!==ie.name)return[]}else switch(ee.name[1]>="a"&&ee.name[1]<="z"?ee.name.substring(0,2):ee.name[0]){case"n":case"_p":Ce[0].placeholders[ee.name]=ie;break;case"c":case"cl":if(gr(ie))Ce[0].placeholders[ee.name]=ie;else return[];break;case"v":if(!gr(ie))Ce[0].placeholders[ee.name]=ie;else return[];break;case"vl":if(ri(ie))Ce[0].placeholders[ee.name]=ie;else return[];break;case"cd":if(qH(ie))Ce[0].placeholders[ee.name]=ie;else return[];break;case"vd":if(!qH(ie))Ce[0].placeholders[ee.name]=ie;else return[];break;case"ce":if(tC(ie))Ce[0].placeholders[ee.name]=ie;else return[];break;case"ve":if(!tC(ie))Ce[0].placeholders[ee.name]=ie;else return[];break;default:throw new Error("Invalid symbol in rule: "+ee.name)}}else if(ee instanceof x){if(!c(ee.value,ie.value))return[]}else return[];return Ce}function J(ee,ie){if(ee instanceof x&&ie instanceof x){if(!c(ee.value,ie.value))return!1}else if(ee instanceof C&&ie instanceof C){if(ee.name!==ie.name)return!1}else if(ee instanceof j&&ie instanceof j||ee instanceof w&&ie instanceof w){if(ee instanceof j){if(ee.op!==ie.op||ee.fn!==ie.fn)return!1}else if(ee instanceof w&&ee.name!==ie.name)return!1;if(ee.args.length!==ie.args.length)return!1;for(var re=0;re{var{typed:t,config:r,mathWithTransform:n,matrix:i,fraction:a,bignumber:o,AccessorNode:s,ArrayNode:l,ConstantNode:u,FunctionNode:c,IndexNode:f,ObjectNode:d,OperatorNode:p,SymbolNode:h}=e,{isCommutative:m,isAssociative:g,allChildren:A,createMakeNodeFunction:b}=TS({FunctionNode:c,OperatorNode:p,SymbolNode:h}),v=t("simplifyConstant",{Node:z=>k(q(z,{})),"Node, Object":function(I,T){return k(q(I,T))}});function x(z){return gf(z)?z.valueOf():z instanceof Array?z.map(x):St(z)?i(x(z.valueOf())):z}function w(z,I,T){try{return n[z].apply(null,I)}catch{return I=I.map(x),O(n[z].apply(null,I),T)}}var S=t({Fraction:N,number:function(I){return I<0?C(new u(-I)):new u(I)},BigNumber:function(I){return I<0?C(new u(-I)):new u(I)},Complex:function(I){throw new Error("Cannot convert Complex number to Node")},string:function(I){return new u(I)},Matrix:function(I){return new l(I.valueOf().map(T=>S(T)))}});function k(z){return Nr(z)?z:S(z)}function j(z,I){var T=I&&I.exactFractions!==!1;if(T&&isFinite(z)&&a){var L=a(z),_=I&&typeof I.fractionsLimit=="number"?I.fractionsLimit:1/0;if(L.valueOf()===z&&L.n<_&&L.d<_)return L}return z}var O=t({"string, Object":function(I,T){if(r.number==="BigNumber")return o===void 0&&pS(),o(I);if(r.number==="Fraction")return a===void 0&&KF(),a(I);var L=parseFloat(I);return j(L,T)},"Fraction, Object":function(I,T){return I},"BigNumber, Object":function(I,T){return I},"number, Object":function(I,T){return j(I,T)},"Complex, Object":function(I,T){return I.im!==0?I:j(I.re,T)},"Matrix, Object":function(I,T){return i(j(I.valueOf()))},"Array, Object":function(I,T){return I.map(j)}});function C(z){return new p("-","unaryMinus",[z])}function N(z){var I,T=z.s*z.n;return T<0?I=new p("-","unaryMinus",[new u(-T)]):I=new u(T),z.d===1?I:new p("/","divide",[I,new u(z.d)])}function D(z,I,T){if(!Sc(I))return new s(k(z),k(I));if(ps(z)||St(z)){for(var L=Array.from(I.dimensions);L.length>0;)if(gr(L[0])&&typeof L[0].value!="string"){var _=O(L.shift().value,T);ps(z)?z=z.items[_-1]:(z=z.valueOf()[_-1],z instanceof Array&&(z=i(z)))}else if(L.length>1&&gr(L[1])&&typeof L[1].value!="string"){var Y=O(L[1].value,T),oe=[],te=ps(z)?z.items:z.valueOf();for(var Q of te)if(ps(Q))oe.push(Q.items[Y-1]);else if(St(z))oe.push(Q[Y-1]);else break;if(oe.length===te.length)ps(z)?z=new l(oe):z=i(oe),L.splice(1,1);else break}else break;return L.length===I.dimensions.length?new s(k(z),I):L.length>0?(I=new f(L),new s(k(z),I)):z}if(Vm(z)&&I.dimensions.length===1&&gr(I.dimensions[0])){var fe=I.dimensions[0].value;return fe in z.properties?z.properties[fe]:new u}return new s(k(z),I)}function P(z,I,T,L){var _=I.shift(),Y=I.reduce((oe,te)=>{if(!Nr(te)){var Q=oe.pop();if(Nr(Q))return[Q,te];try{return oe.push(w(z,[Q,te],L)),oe}catch{oe.push(Q)}}oe.push(k(oe.pop()));var fe=oe.length===1?oe[0]:T(oe);return[T([fe,k(te)])]},[_]);return Y.length===1?Y[0]:T([Y[0],S(Y[1])])}function q(z,I){switch(z.type){case"SymbolNode":return z;case"ConstantNode":switch(typeof z.value){case"number":return O(z.value,I);case"string":return z.value;default:if(!isNaN(z.value))return O(z.value,I)}return z;case"FunctionNode":if(n[z.name]&&n[z.name].rawArgs)return z;{var T=["add","multiply"];if(T.indexOf(z.name)===-1){var L=z.args.map(ke=>q(ke,I));if(!L.some(Nr))try{return w(z.name,L,I)}catch{}if(z.name==="size"&&L.length===1&&ps(L[0])){for(var _=[],Y=L[0];ps(Y);)_.push(Y.items.length),Y=Y.items[0];return i(_)}return new c(z.name,L.map(k))}}case"OperatorNode":{var oe=z.fn.toString(),te,Q,fe=b(z);if(bi(z)&&z.isUnary())te=[q(z.args[0],I)],Nr(te[0])?Q=fe(te):Q=w(oe,te,I);else if(g(z,I.context))if(te=A(z,I.context),te=te.map(ke=>q(ke,I)),m(oe,I.context)){for(var Ie=[],Se=[],Oe=0;Oe1?(Q=P(oe,Ie,fe,I),Se.unshift(Q),Q=P(oe,Se,fe,I)):Q=P(oe,te,fe,I)}else Q=P(oe,te,fe,I);else te=z.args.map(ke=>q(ke,I)),Q=P(oe,te,fe,I);return Q}case"ParenthesisNode":return q(z.content,I);case"AccessorNode":return D(q(z.object,I),q(z.index,I),I);case"ArrayNode":{var ve=z.items.map(ke=>q(ke,I));return ve.some(Nr)?new l(ve.map(k)):i(ve)}case"IndexNode":return new f(z.dimensions.map(ke=>v(ke,I)));case"ObjectNode":{var ye={};for(var me in z.properties)ye[me]=v(z.properties[me],I);return new d(ye)}case"AssignmentNode":case"BlockNode":case"FunctionAssignmentNode":case"RangeNode":case"ConditionalNode":default:throw new Error("Unimplemented node type in simplifyConstant: ".concat(z.type))}}return v});var cge="simplifyCore",zWe=["typed","parse","equal","isZero","add","subtract","multiply","divide","pow","AccessorNode","ArrayNode","ConstantNode","FunctionNode","IndexNode","ObjectNode","OperatorNode","ParenthesisNode","SymbolNode"],_P=V(cge,zWe,e=>{var{typed:t,parse:r,equal:n,isZero:i,add:a,subtract:o,multiply:s,divide:l,pow:u,AccessorNode:c,ArrayNode:f,ConstantNode:d,FunctionNode:p,IndexNode:h,ObjectNode:m,OperatorNode:g,ParenthesisNode:A,SymbolNode:b}=e,v=new d(0),x=new d(1),w=new d(!0),S=new d(!1);function k(N){return bi(N)&&["and","not","or"].includes(N.op)}var{hasProperty:j,isCommutative:O}=TS({FunctionNode:p,OperatorNode:g,SymbolNode:b});function C(N){var D=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},P=D?D.context:void 0;if(j(N,"trivial",P)){if(xl(N)&&N.args.length===1)return C(N.args[0],D);var q=!1,z=0;if(N.forEach(Se=>{++z,z===1&&(q=C(Se,D))}),z===1)return q}var I=N;if(xl(I)){var T=lfe(I.name);if(T){if(I.args.length>2&&j(I,"associative",P))for(;I.args.length>2;){var L=I.args.pop(),_=I.args.pop();I.args.push(new g(T,I.name,[L,_]))}I=new g(T,I.name,I.args)}else return new p(C(I.fn),I.args.map(Se=>C(Se,D)))}if(bi(I)&&I.isUnary()){var Y=C(I.args[0],D);if(I.op==="~"&&bi(Y)&&Y.isUnary()&&Y.op==="~"||I.op==="not"&&bi(Y)&&Y.isUnary()&&Y.op==="not"&&k(Y.args[0]))return Y.args[0];var oe=!0;if(I.op==="-"&&bi(Y)&&(Y.isBinary()&&Y.fn==="subtract"&&(I=new g("-","subtract",[Y.args[1],Y.args[0]]),oe=!1),Y.isUnary()&&Y.op==="-"))return Y.args[0];if(oe)return new g(I.op,I.fn,[Y])}if(bi(I)&&I.isBinary()){var te=C(I.args[0],D),Q=C(I.args[1],D);if(I.op==="+"){if(gr(te)&&i(te.value))return Q;if(gr(Q)&&i(Q.value))return te;bi(Q)&&Q.isUnary()&&Q.op==="-"&&(Q=Q.args[0],I=new g("-","subtract",[te,Q]))}if(I.op==="-")return bi(Q)&&Q.isUnary()&&Q.op==="-"?C(new g("+","add",[te,Q.args[0]]),D):gr(te)&&i(te.value)?C(new g("-","unaryMinus",[Q])):gr(Q)&&i(Q.value)?te:new g(I.op,I.fn,[te,Q]);if(I.op==="*"){if(gr(te)){if(i(te.value))return v;if(n(te.value,1))return Q}if(gr(Q)){if(i(Q.value))return v;if(n(Q.value,1))return te;if(O(I,P))return new g(I.op,I.fn,[Q,te],I.implicit)}return new g(I.op,I.fn,[te,Q],I.implicit)}if(I.op==="/")return gr(te)&&i(te.value)?v:gr(Q)&&n(Q.value,1)?te:new g(I.op,I.fn,[te,Q]);if(I.op==="^"&&gr(Q)){if(i(Q.value))return x;if(n(Q.value,1))return te}if(I.op==="and"){if(gr(te))if(te.value){if(k(Q))return Q;if(gr(Q))return Q.value?w:S}else return S;if(gr(Q))if(Q.value){if(k(te))return te}else return S}if(I.op==="or"){if(gr(te)){if(te.value)return w;if(k(Q))return Q}if(gr(Q)){if(Q.value)return w;if(k(te))return te}}return new g(I.op,I.fn,[te,Q])}if(bi(I))return new g(I.op,I.fn,I.args.map(Se=>C(Se,D)));if(ps(I))return new f(I.items.map(Se=>C(Se,D)));if(Uu(I))return new c(C(I.object,D),C(I.index,D));if(Sc(I))return new h(I.dimensions.map(Se=>C(Se,D)));if(Vm(I)){var fe={};for(var Ie in I.properties)fe[Ie]=C(I.properties[Ie],D);return new m(fe)}return I}return t(cge,{Node:C,"Node,Object":C})});var UWe="resolve",WWe=["typed","parse","ConstantNode","FunctionNode","OperatorNode","ParenthesisNode"],PP=V(UWe,WWe,e=>{var{typed:t,parse:r,ConstantNode:n,FunctionNode:i,OperatorNode:a,ParenthesisNode:o}=e;function s(l,u){var c=arguments.length>2&&arguments[2]!==void 0?arguments[2]:new Set;if(!u)return l;if(ri(l)){if(c.has(l.name)){var f=Array.from(c).join(", ");throw new ReferenceError("recursive loop of variable definitions among {".concat(f,"}"))}var d=u.get(l.name);if(Nr(d)){var p=new Set(c);return p.add(l.name),s(d,u,p)}else return typeof d=="number"?r(String(d)):d!==void 0?new n(d):l}else if(bi(l)){var h=l.args.map(function(g){return s(g,u,c)});return new a(l.op,l.fn,h,l.implicit)}else{if(ms(l))return new o(s(l.content,u,c));if(xl(l)){var m=l.args.map(function(g){return s(g,u,c)});return new i(l.name,m)}}return l.map(g=>s(g,u,c))}return t("resolve",{Node:s,"Node, Map | null | undefined":s,"Node, Object":(l,u)=>s(l,zA(u)),"Array | Matrix":t.referToSelf(l=>u=>u.map(c=>l(c))),"Array | Matrix, null | undefined":t.referToSelf(l=>u=>u.map(c=>l(c))),"Array, Object":t.referTo("Array,Map",l=>(u,c)=>l(u,zA(c))),"Matrix, Object":t.referTo("Matrix,Map",l=>(u,c)=>l(u,zA(c))),"Array | Matrix, Map":t.referToSelf(l=>(u,c)=>u.map(f=>l(f,c)))})});var fge="symbolicEqual",HWe=["parse","simplify","typed","OperatorNode"],IP=V(fge,HWe,e=>{var{parse:t,simplify:r,typed:n,OperatorNode:i}=e;function a(o,s){var l=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},u=new i("-","subtract",[o,s]),c=r(u,{},l);return gr(c)&&!c.value}return n(fge,{"Node, Node":a,"Node, Node, Object":a})});var dge="derivative",VWe=["typed","config","parse","simplify","equal","isZero","numeric","ConstantNode","FunctionNode","OperatorNode","ParenthesisNode","SymbolNode"],BP=V(dge,VWe,e=>{var{typed:t,config:r,parse:n,simplify:i,equal:a,isZero:o,numeric:s,ConstantNode:l,FunctionNode:u,OperatorNode:c,ParenthesisNode:f,SymbolNode:d}=e;function p(v,x){var w=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{simplify:!0},S={};g(S,v,x.name);var k=A(v,S);return w.simplify?i(k):k}t.addConversion({from:"identifier",to:"SymbolNode",convert:n});var h=t(dge,{"Node, SymbolNode":p,"Node, SymbolNode, Object":p});t.removeConversion({from:"identifier",to:"SymbolNode",convert:n}),h._simplify=!0,h.toTex=function(v){return m.apply(null,v.args)};var m=t("_derivTex",{"Node, SymbolNode":function(x,w){return gr(x)&&qr(x.value)==="string"?m(n(x.value).toString(),w.toString(),1):m(x.toTex(),w.toString(),1)},"Node, ConstantNode":function(x,w){if(qr(w.value)==="string")return m(x,n(w.value));throw new Error("The second parameter to 'derivative' is a non-string constant")},"Node, SymbolNode, ConstantNode":function(x,w,S){return m(x.toString(),w.name,S.value)},"string, string, number":function(x,w,S){var k;return S===1?k="{d\\over d"+w+"}":k="{d^{"+S+"}\\over d"+w+"^{"+S+"}}",k+"\\left[".concat(x,"\\right]")}}),g=t("constTag",{"Object, ConstantNode, string":function(x,w){return x[w]=!0,!0},"Object, SymbolNode, string":function(x,w,S){return w.name!==S?(x[w]=!0,!0):!1},"Object, ParenthesisNode, string":function(x,w,S){return g(x,w.content,S)},"Object, FunctionAssignmentNode, string":function(x,w,S){return w.params.indexOf(S)===-1?(x[w]=!0,!0):g(x,w.expr,S)},"Object, FunctionNode | OperatorNode, string":function(x,w,S){if(w.args.length>0){for(var k=g(x,w.args[0],S),j=1;j0){var k=x.args.filter(function(z){return w[z]===void 0}),j=k.length===1?k[0]:new c("*","multiply",k),O=S.concat(A(j,w));return new c("*","multiply",O)}return new c("+","add",x.args.map(function(z){return new c("*","multiply",x.args.map(function(I){return I===z?A(I,w):I.clone()}))}))}if(x.op==="/"&&x.isBinary()){var C=x.args[0],N=x.args[1];return w[N]!==void 0?new c("/","divide",[A(C,w),N]):w[C]!==void 0?new c("*","multiply",[new c("-","unaryMinus",[C]),new c("/","divide",[A(N,w),new c("^","pow",[N.clone(),b(2)])])]):new c("/","divide",[new c("-","subtract",[new c("*","multiply",[A(C,w),N.clone()]),new c("*","multiply",[C.clone(),A(N,w)])]),new c("^","pow",[N.clone(),b(2)])])}if(x.op==="^"&&x.isBinary()){var D=x.args[0],P=x.args[1];if(w[D]!==void 0)return gr(D)&&(o(D.value)||a(D.value,1))?b(0):new c("*","multiply",[x,new c("*","multiply",[new u("log",[D.clone()]),A(P.clone(),w)])]);if(w[P]!==void 0){if(gr(P)){if(o(P.value))return b(0);if(a(P.value,1))return A(D,w)}var q=new c("^","pow",[D.clone(),new c("-","subtract",[P,b(1)])]);return new c("*","multiply",[P.clone(),new c("*","multiply",[A(D,w),q])])}return new c("*","multiply",[new c("^","pow",[D.clone(),P.clone()]),new c("+","add",[new c("*","multiply",[A(D,w),new c("/","divide",[P.clone(),D.clone()])]),new c("*","multiply",[A(P,w),new u("log",[D.clone()])])])])}throw new Error('Cannot process operator "'+x.op+'" in derivative: the operator is not supported, undefined, or the number of arguments passed to it are not supported')}});function b(v,x){return new l(s(v,x||r.number))}return h});var pge="rationalize",GWe=["config","typed","equal","isZero","add","subtract","multiply","divide","pow","parse","simplifyConstant","simplifyCore","simplify","?bignumber","?fraction","mathWithTransform","matrix","AccessorNode","ArrayNode","ConstantNode","FunctionNode","IndexNode","ObjectNode","OperatorNode","SymbolNode","ParenthesisNode"],RP=V(pge,GWe,e=>{var{config:t,typed:r,equal:n,isZero:i,add:a,subtract:o,multiply:s,divide:l,pow:u,parse:c,simplifyConstant:f,simplifyCore:d,simplify:p,fraction:h,bignumber:m,mathWithTransform:g,matrix:A,AccessorNode:b,ArrayNode:v,ConstantNode:x,FunctionNode:w,IndexNode:S,ObjectNode:k,OperatorNode:j,SymbolNode:O,ParenthesisNode:C}=e;function N(I){var T=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},L=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,_=P(),Y=D(I,T,!0,_.firstRules),oe=Y.variables.length,te={exactFractions:!1},Q={exactFractions:!0};if(I=Y.expression,oe>=1){I=q(I);var fe,Ie,Se=!0,Oe=!1;I=p(I,_.firstRules,{},te);for(var ve;Ie=Se?_.distrDivRules:_.sucDivRules,I=p(I,Ie,{},Q),Se=!Se,ve=I.toString(),ve!==fe;)Oe=!0,fe=ve;Oe&&(I=p(I,_.firstRulesAgain,{},te)),I=p(I,_.finalRules,{},te)}var ye=[],me={};return I.type==="OperatorNode"&&I.isBinary()&&I.op==="/"?(oe===1&&(I.args[0]=z(I.args[0],ye),I.args[1]=z(I.args[1])),L&&(me.numerator=I.args[0],me.denominator=I.args[1])):(oe===1&&(I=z(I,ye)),L&&(me.numerator=I,me.denominator=null)),L?(me.coefficients=ye,me.variables=Y.variables,me.expression=I,me):I}return r(pge,{Node:N,"Node, boolean":(I,T)=>N(I,{},T),"Node, Object":N,"Node, Object, boolean":N});function D(I,T,L,_){var Y=[],oe=p(I,_,T,{exactFractions:!1});L=!!L;var te="+-*"+(L?"/":"");fe(oe);var Q={};return Q.expression=oe,Q.variables=Y,Q;function fe(Ie){var Se=Ie.type;if(Se==="FunctionNode")throw new Error("There is an unsolved function call");if(Se==="OperatorNode")if(Ie.op==="^"){if(Ie.args[1].type!=="ConstantNode"||!wt(parseFloat(Ie.args[1].value)))throw new Error("There is a non-integer exponent");fe(Ie.args[0])}else{if(te.indexOf(Ie.op)===-1)throw new Error("Operator "+Ie.op+" invalid in polynomial expression");for(var Oe=0;Oe1;if(_==="OperatorNode"&&I.isBinary()){var oe=!1,te;if(I.op==="^"&&(I.args[0].type==="ParenthesisNode"||I.args[0].type==="OperatorNode")&&I.args[1].type==="ConstantNode"&&(te=parseFloat(I.args[1].value),oe=te>=2&&wt(te)),oe){if(te>2){var Q=I.args[0],fe=new j("^","pow",[I.args[0].cloneDeep(),new x(te-1)]);I=new j("*","multiply",[Q,fe])}else I=new j("*","multiply",[I.args[0],I.args[0].cloneDeep()]);Y&&(L==="content"?T.content=I:T.args[L]=I)}}if(_==="ParenthesisNode")q(I.content,I,"content");else if(_!=="ConstantNode"&&_!=="SymbolNode")for(var Ie=0;Ie=0;Q--)if(T[Q]!==0){var fe=new x(oe?T[Q]:Math.abs(T[Q])),Ie=T[Q]<0?"-":"+";if(Q>0){var Se=new O(Y);if(Q>1){var Oe=new x(Q);Se=new j("^","pow",[Se,Oe])}T[Q]===-1&&oe?fe=new j("-","unaryMinus",[Se]):Math.abs(T[Q])===1?fe=Se:fe=new j("*","multiply",[fe,Se])}oe?te=fe:Ie==="+"?te=new j("+","add",[te,fe]):te=new j("-","subtract",[te,fe]),oe=!1}if(oe)return new x(0);return te;function ve(ye,me,ke){var $=ye.type;if($==="FunctionNode")throw new Error("There is an unsolved function call");if($==="OperatorNode"){if("+-*^".indexOf(ye.op)===-1)throw new Error("Operator "+ye.op+" invalid");if(me!==null){if((ye.fn==="unaryMinus"||ye.fn==="pow")&&me.fn!=="add"&&me.fn!=="subtract"&&me.fn!=="multiply")throw new Error("Invalid "+ye.op+" placing");if((ye.fn==="subtract"||ye.fn==="add"||ye.fn==="multiply")&&me.fn!=="add"&&me.fn!=="subtract")throw new Error("Invalid "+ye.op+" placing");if((ye.fn==="subtract"||ye.fn==="add"||ye.fn==="unaryMinus")&&ke.noFil!==0)throw new Error("Invalid "+ye.op+" placing")}(ye.op==="^"||ye.op==="*")&&(ke.fire=ye.op);for(var ae=0;ae_&&(T[ce]=0),T[ce]+=ke.cte*(ke.oper==="+"?1:-1),_=Math.max(ce,_);return}ke.cte=ce,ke.fire===""&&(T[0]+=ke.cte*(ke.oper==="+"?1:-1))}else throw new Error("Type "+$+" is not allowed")}}});var mge="zpk2tf",QWe=["typed","add","multiply","Complex","number"],$P=V(mge,QWe,e=>{var{typed:t,add:r,multiply:n,Complex:i,number:a}=e;return t(mge,{"Array,Array,number":function(u,c,f){return o(u,c,f)},"Array,Array":function(u,c){return o(u,c,1)},"Matrix,Matrix,number":function(u,c,f){return o(u.valueOf(),c.valueOf(),f)},"Matrix,Matrix":function(u,c){return o(u.valueOf(),c.valueOf(),1)}});function o(l,u,c){l.some(b=>b.type==="BigNumber")&&(l=l.map(b=>a(b))),u.some(b=>b.type==="BigNumber")&&(u=u.map(b=>a(b)));for(var f=[i(1,0)],d=[i(1,0)],p=0;p=0&&f-d{var{typed:t,add:r,multiply:n,Complex:i,divide:a,matrix:o}=e;return t(hge,{"Array, Array":function(c,f){var d=l(512);return s(c,f,d)},"Array, Array, Array":function(c,f,d){return s(c,f,d)},"Array, Array, number":function(c,f,d){if(d<0)throw new Error("w must be a positive number");var p=l(d);return s(c,f,p)},"Matrix, Matrix":function(c,f){var d=l(512),{w:p,h}=s(c.valueOf(),f.valueOf(),d);return{w:o(p),h:o(h)}},"Matrix, Matrix, Matrix":function(c,f,d){var{h:p}=s(c.valueOf(),f.valueOf(),d.valueOf());return{h:o(p),w:o(d)}},"Matrix, Matrix, number":function(c,f,d){if(d<0)throw new Error("w must be a positive number");var p=l(d),{h}=s(c.valueOf(),f.valueOf(),p);return{h:o(h),w:o(p)}}});function s(u,c,f){for(var d=[],p=[],h=0;h{var{classes:t}=e;return function(n,i){var a=t[i&&i.mathjs];return a&&typeof a.fromJSON=="function"?a.fromJSON(i):i}});var KWe="replacer",JWe=[],zP=V(KWe,JWe,()=>function(t,r){return typeof r=="number"&&(!isFinite(r)||isNaN(r))?{mathjs:"number",value:String(r)}:r});var Age="12.4.1";var UP=V("true",[],()=>!0),WP=V("false",[],()=>!1),HP=V("null",[],()=>null),VP=xf("Infinity",["config","?BigNumber"],e=>{var{config:t,BigNumber:r}=e;return t.number==="BigNumber"?new r(1/0):1/0}),GP=xf("NaN",["config","?BigNumber"],e=>{var{config:t,BigNumber:r}=e;return t.number==="BigNumber"?new r(NaN):NaN}),QP=xf("pi",["config","?BigNumber"],e=>{var{config:t,BigNumber:r}=e;return t.number==="BigNumber"?K6(r):Xse}),YP=xf("tau",["config","?BigNumber"],e=>{var{config:t,BigNumber:r}=e;return t.number==="BigNumber"?yce(r):Kse}),ZP=xf("e",["config","?BigNumber"],e=>{var{config:t,BigNumber:r}=e;return t.number==="BigNumber"?gce(r):Jse}),XP=xf("phi",["config","?BigNumber"],e=>{var{config:t,BigNumber:r}=e;return t.number==="BigNumber"?vce(r):ele}),KP=xf("LN2",["config","?BigNumber"],e=>{var{config:t,BigNumber:r}=e;return t.number==="BigNumber"?new r(2).ln():Math.LN2}),JP=xf("LN10",["config","?BigNumber"],e=>{var{config:t,BigNumber:r}=e;return t.number==="BigNumber"?new r(10).ln():Math.LN10}),eI=xf("LOG2E",["config","?BigNumber"],e=>{var{config:t,BigNumber:r}=e;return t.number==="BigNumber"?new r(1).div(new r(2).ln()):Math.LOG2E}),tI=xf("LOG10E",["config","?BigNumber"],e=>{var{config:t,BigNumber:r}=e;return t.number==="BigNumber"?new r(1).div(new r(10).ln()):Math.LOG10E}),rI=xf("SQRT1_2",["config","?BigNumber"],e=>{var{config:t,BigNumber:r}=e;return t.number==="BigNumber"?new r("0.5").sqrt():Math.SQRT1_2}),nI=xf("SQRT2",["config","?BigNumber"],e=>{var{config:t,BigNumber:r}=e;return t.number==="BigNumber"?new r(2).sqrt():Math.SQRT2}),iI=xf("i",["Complex"],e=>{var{Complex:t}=e;return t.I}),gge=V("PI",["pi"],e=>{var{pi:t}=e;return t}),vge=V("E",["e"],e=>{var{e:t}=e;return t}),aI=V("version",[],()=>Age);function xf(e,t,r){return V(e,t,r,{recreateOnConfigChange:!0})}var oI=Rr("speedOfLight","299792458","m s^-1"),sI=Rr("gravitationConstant","6.67430e-11","m^3 kg^-1 s^-2"),lI=Rr("planckConstant","6.62607015e-34","J s"),uI=Rr("reducedPlanckConstant","1.0545718176461565e-34","J s"),cI=Rr("magneticConstant","1.25663706212e-6","N A^-2"),fI=Rr("electricConstant","8.8541878128e-12","F m^-1"),dI=Rr("vacuumImpedance","376.730313667","ohm"),pI=Rr("coulomb","8.987551792261171e9","N m^2 C^-2"),mI=Rr("elementaryCharge","1.602176634e-19","C"),hI=Rr("bohrMagneton","9.2740100783e-24","J T^-1"),AI=Rr("conductanceQuantum","7.748091729863649e-5","S"),gI=Rr("inverseConductanceQuantum","12906.403729652257","ohm"),vI=Rr("magneticFluxQuantum","2.0678338484619295e-15","Wb"),yI=Rr("nuclearMagneton","5.0507837461e-27","J T^-1"),bI=Rr("klitzing","25812.807459304513","ohm");var xI=Rr("bohrRadius","5.29177210903e-11","m"),wI=Rr("classicalElectronRadius","2.8179403262e-15","m"),SI=Rr("electronMass","9.1093837015e-31","kg"),EI=Rr("fermiCoupling","1.1663787e-5","GeV^-2"),kI=rB("fineStructure",.0072973525693),CI=Rr("hartreeEnergy","4.3597447222071e-18","J"),DI=Rr("protonMass","1.67262192369e-27","kg"),OI=Rr("deuteronMass","3.3435830926e-27","kg"),MI=Rr("neutronMass","1.6749271613e-27","kg"),jI=Rr("quantumOfCirculation","3.6369475516e-4","m^2 s^-1"),NI=Rr("rydberg","10973731.568160","m^-1"),TI=Rr("thomsonCrossSection","6.6524587321e-29","m^2"),FI=rB("weakMixingAngle",.2229),_I=rB("efimovFactor",22.7),PI=Rr("atomicMass","1.66053906660e-27","kg"),II=Rr("avogadro","6.02214076e23","mol^-1"),BI=Rr("boltzmann","1.380649e-23","J K^-1"),RI=Rr("faraday","96485.33212331001","C mol^-1"),$I=Rr("firstRadiation","3.7417718521927573e-16","W m^2"),qI=Rr("loschmidt","2.686780111798444e25","m^-3"),LI=Rr("gasConstant","8.31446261815324","J K^-1 mol^-1"),zI=Rr("molarPlanckConstant","3.990312712893431e-10","J s mol^-1"),UI=Rr("molarVolume","0.022413969545014137","m^3 mol^-1"),WI=rB("sackurTetrode",-1.16487052358),HI=Rr("secondRadiation","0.014387768775039337","m K"),VI=Rr("stefanBoltzmann","5.67037441918443e-8","W m^-2 K^-4"),GI=Rr("wienDisplacement","2.897771955e-3","m K"),QI=Rr("molarMass","0.99999999965e-3","kg mol^-1"),YI=Rr("molarMassC12","11.9999999958e-3","kg mol^-1"),ZI=Rr("gravity","9.80665","m s^-2"),XI=Rr("planckLength","1.616255e-35","m"),KI=Rr("planckMass","2.176435e-8","kg"),JI=Rr("planckTime","5.391245e-44","s"),eB=Rr("planckCharge","1.87554603778e-18","C"),tB=Rr("planckTemperature","1.416785e+32","K");function Rr(e,t,r){var n=["config","Unit","BigNumber"];return V(e,n,i=>{var{config:a,Unit:o,BigNumber:s}=i,l=a.number==="BigNumber"?new s(t):parseFloat(t),u=new o(l,r);return u.fixPrefix=!0,u})}function rB(e,t){var r=["config","BigNumber"];return V(e,r,n=>{var{config:i,BigNumber:a}=n;return i.number==="BigNumber"?new a(t):t})}var eHe="apply",tHe=["typed","isInteger"],nB=V(eHe,tHe,e=>{var{typed:t,isInteger:r}=e,n=G0({typed:t,isInteger:r});return t("apply",{"...any":function(a){var o=a[1];Qt(o)?a[1]=o-1:It(o)&&(a[1]=o.minus(1));try{return n.apply(null,a)}catch(s){throw wi(s)}}})},{isTransformFunction:!0});var rHe="column",nHe=["typed","Index","matrix","range"],iB=V(rHe,nHe,e=>{var{typed:t,Index:r,matrix:n,range:i}=e,a=fS({typed:t,Index:r,matrix:n,range:i});return t("column",{"...any":function(s){var l=s.length-1,u=s[l];Qt(u)&&(s[l]=u-1);try{return a.apply(null,s)}catch(c){throw wi(c)}}})},{isTransformFunction:!0});function FS(e,t,r){var n=e.filter(function(l){return ri(l)&&!(l.name in t)&&!r.has(l.name)})[0];if(!n)throw new Error('No undefined variable found in inline expression "'+e+'"');var i=n.name,a=new Map,o=new Xw(r,a,new Set([i])),s=e.compile();return function(u){return a.set(i,u),s.evaluate(o)}}var iHe="filter",aHe=["typed"],aB=V(iHe,aHe,e=>{var{typed:t}=e;function r(i,a,o){var s,l;return i[0]&&(s=i[0].compile().evaluate(o)),i[1]&&(ri(i[1])||Ed(i[1])?l=i[1].compile().evaluate(o):l=FS(i[1],a,o)),n(s,l)}r.rawArgs=!0;var n=t("filter",{"Array, function":yge,"Matrix, function":function(a,o){return a.create(yge(a.toArray(),o))},"Array, RegExp":Yw,"Matrix, RegExp":function(a,o){return a.create(Yw(a.toArray(),o))}});return r},{isTransformFunction:!0});function yge(e,t){return mT(e,function(r,n,i){return Od(t,r,[n+1],i,"filter")})}var oHe="forEach",sHe=["typed"],oB=V(oHe,sHe,e=>{var{typed:t}=e;function r(i,a,o){var s,l;return i[0]&&(s=i[0].compile().evaluate(o)),i[1]&&(ri(i[1])||Ed(i[1])?l=i[1].compile().evaluate(o):l=FS(i[1],a,o)),n(s,l)}r.rawArgs=!0;var n=t("forEach",{"Array | Matrix, function":function(a,o){var s=function l(u,c){if(Array.isArray(u))$0(u,function(f,d){l(f,c.concat(d+1))});else return Od(o,u,c,a,"forEach")};s(a.valueOf(),[])}});return r},{isTransformFunction:!0});var lHe="index",uHe=["Index","getMatrixDataType"],sB=V(lHe,uHe,e=>{var{Index:t,getMatrixDataType:r}=e;return function(){for(var i=[],a=0,o=arguments.length;a0?0:2;else if(s&&s.isSet===!0)s=s.map(function(u){return u-1});else if(Ir(s)||St(s))r(s)!=="boolean"&&(s=s.map(function(u){return u-1}));else if(Qt(s))s--;else if(It(s))s=s.toNumber()-1;else if(typeof s!="string")throw new TypeError("Dimension must be an Array, Matrix, number, string, or Range");i[a]=s}var l=new t;return t.apply(l,i),l}},{isTransformFunction:!0});var cHe="map",fHe=["typed"],lB=V(cHe,fHe,e=>{var{typed:t}=e;function r(i,a,o){var s,l;return i[0]&&(s=i[0].compile().evaluate(o)),i[1]&&(ri(i[1])||Ed(i[1])?l=i[1].compile().evaluate(o):l=FS(i[1],a,o)),n(s,l)}r.rawArgs=!0;var n=t("map",{"Array, function":function(a,o){return bge(a,o,a)},"Matrix, function":function(a,o){return a.create(bge(a.valueOf(),o,a))}});return r},{isTransformFunction:!0});function bge(e,t,r){function n(i,a){return Array.isArray(i)?Ec(i,function(o,s){return n(o,a.concat(s+1))}):Od(t,i,a,r,"map")}return n(e,[])}function su(e){if(e.length===2&&Da(e[0])){e=e.slice();var t=e[1];Qt(t)?e[1]=t-1:It(t)&&(e[1]=t.minus(1))}return e}var dHe="max",pHe=["typed","config","numeric","larger"],uB=V(dHe,pHe,e=>{var{typed:t,config:r,numeric:n,larger:i}=e,a=SS({typed:t,config:r,numeric:n,larger:i});return t("max",{"...any":function(s){s=su(s);try{return a.apply(null,s)}catch(l){throw wi(l)}}})},{isTransformFunction:!0});var mHe="mean",hHe=["typed","add","divide"],cB=V(mHe,hHe,e=>{var{typed:t,add:r,divide:n}=e,i=OS({typed:t,add:r,divide:n});return t("mean",{"...any":function(o){o=su(o);try{return i.apply(null,o)}catch(s){throw wi(s)}}})},{isTransformFunction:!0});var AHe="min",gHe=["typed","config","numeric","smaller"],fB=V(AHe,gHe,e=>{var{typed:t,config:r,numeric:n,smaller:i}=e,a=ES({typed:t,config:r,numeric:n,smaller:i});return t("min",{"...any":function(s){s=su(s);try{return a.apply(null,s)}catch(l){throw wi(l)}}})},{isTransformFunction:!0});var vHe="range",yHe=["typed","config","?matrix","?bignumber","smaller","smallerEq","larger","largerEq","add","isPositive"],dB=V(vHe,yHe,e=>{var{typed:t,config:r,matrix:n,bignumber:i,smaller:a,smallerEq:o,larger:s,largerEq:l,add:u,isPositive:c}=e,f=mS({typed:t,config:r,matrix:n,bignumber:i,smaller:a,smallerEq:o,larger:s,largerEq:l,add:u,isPositive:c});return t("range",{"...any":function(p){var h=p.length-1,m=p[h];return typeof m!="boolean"&&p.push(!0),f.apply(null,p)}})},{isTransformFunction:!0});var bHe="row",xHe=["typed","Index","matrix","range"],pB=V(bHe,xHe,e=>{var{typed:t,Index:r,matrix:n,range:i}=e,a=hS({typed:t,Index:r,matrix:n,range:i});return t("row",{"...any":function(s){var l=s.length-1,u=s[l];Qt(u)&&(s[l]=u-1);try{return a.apply(null,s)}catch(c){throw wi(c)}}})},{isTransformFunction:!0});var wHe="subset",SHe=["typed","matrix","zeros","add"],mB=V(wHe,SHe,e=>{var{typed:t,matrix:r,zeros:n,add:i}=e,a=AS({typed:t,matrix:r,zeros:n,add:i});return t("subset",{"...any":function(s){try{return a.apply(null,s)}catch(l){throw wi(l)}}})},{isTransformFunction:!0});var EHe="concat",kHe=["typed","matrix","isInteger"],hB=V(EHe,kHe,e=>{var{typed:t,matrix:r,isInteger:n}=e,i=cS({typed:t,matrix:r,isInteger:n});return t("concat",{"...any":function(o){var s=o.length-1,l=o[s];Qt(l)?o[s]=l-1:It(l)&&(o[s]=l.minus(1));try{return i.apply(null,o)}catch(u){throw wi(u)}}})},{isTransformFunction:!0});var xge="diff",CHe=["typed","matrix","subtract","number","bignumber"],AB=V(xge,CHe,e=>{var{typed:t,matrix:r,subtract:n,number:i,bignumber:a}=e,o=dS({typed:t,matrix:r,subtract:n,number:i,bignumber:a});return t(xge,{"...any":function(l){l=su(l);try{return o.apply(null,l)}catch(u){throw wi(u)}}})},{isTransformFunction:!0});var DHe="std",OHe=["typed","map","sqrt","variance"],gB=V(DHe,OHe,e=>{var{typed:t,map:r,sqrt:n,variance:i}=e,a=NS({typed:t,map:r,sqrt:n,variance:i});return t("std",{"...any":function(s){s=su(s);try{return a.apply(null,s)}catch(l){throw wi(l)}}})},{isTransformFunction:!0});var wge="sum",MHe=["typed","config","add","numeric"],vB=V(wge,MHe,e=>{var{typed:t,config:r,add:n,numeric:i}=e,a=CS({typed:t,config:r,add:n,numeric:i});return t(wge,{"...any":function(s){s=su(s);try{return a.apply(null,s)}catch(l){throw wi(l)}}})},{isTransformFunction:!0});var jHe="quantileSeq",NHe=["typed","bignumber","add","subtract","divide","multiply","partitionSelect","compare","isInteger","smaller","smallerEq","larger"],yB=V(jHe,NHe,e=>{var{typed:t,bignumber:r,add:n,subtract:i,divide:a,multiply:o,partitionSelect:s,compare:l,isInteger:u,smaller:c,smallerEq:f,larger:d}=e,p=jS({typed:t,bignumber:r,add:n,subtract:i,divide:a,multiply:o,partitionSelect:s,compare:l,isInteger:u,smaller:c,smallerEq:f,larger:d});return t("quantileSeq",{"Array | Matrix, number | BigNumber":p,"Array | Matrix, number | BigNumber, number":(m,g,A)=>p(m,g,h(A)),"Array | Matrix, number | BigNumber, boolean":p,"Array | Matrix, number | BigNumber, boolean, number":(m,g,A,b)=>p(m,g,A,h(b)),"Array | Matrix, Array | Matrix":p,"Array | Matrix, Array | Matrix, number":(m,g,A)=>p(m,g,h(A)),"Array | Matrix, Array | Matrix, boolean":p,"Array | Matrix, Array | Matrix, boolean, number":(m,g,A,b)=>p(m,g,A,h(b))});function h(m){return su([[],m])[1]}},{isTransformFunction:!0});var Sge="cumsum",THe=["typed","add","unaryPlus"],bB=V(Sge,THe,e=>{var{typed:t,add:r,unaryPlus:n}=e,i=DS({typed:t,add:r,unaryPlus:n});return t(Sge,{"...any":function(o){if(o.length===2&&Da(o[0])){var s=o[1];Qt(s)?o[1]=s-1:It(s)&&(o[1]=s.minus(1))}try{return i.apply(null,o)}catch(l){throw wi(l)}}})},{isTransformFunction:!0});var Ege="variance",FHe=["typed","add","subtract","multiply","divide","apply","isNaN"],xB=V(Ege,FHe,e=>{var{typed:t,add:r,subtract:n,multiply:i,divide:a,apply:o,isNaN:s}=e,l=MS({typed:t,add:r,subtract:n,multiply:i,divide:a,apply:o,isNaN:s});return t(Ege,{"...any":function(c){c=su(c);try{return l.apply(null,c)}catch(f){throw wi(f)}}})},{isTransformFunction:!0});var kge="print",_He=["typed","matrix","zeros","add"],wB=V(kge,_He,e=>{var{typed:t,matrix:r,zeros:n,add:i}=e,a=vS({typed:t,matrix:r,zeros:n,add:i});return t(kge,{"string, Object | Array":function(l,u){return a(o(l),u)},"string, Object | Array, number | Object":function(l,u,c){return a(o(l),u,c)}});function o(s){return s.replace(b3,l=>{var u=l.slice(1).split("."),c=u.map(function(f){return!isNaN(f)&&f.length>0?parseInt(f)-1:f});return"$"+c.join(".")})}},{isTransformFunction:!0});var PHe="and",IHe=["typed","matrix","zeros","add","equalScalar","not","concat"],SB=V(PHe,IHe,e=>{var{typed:t,matrix:r,equalScalar:n,zeros:i,not:a,concat:o}=e,s=wS({typed:t,matrix:r,equalScalar:n,zeros:i,not:a,concat:o});function l(u,c,f){var d=u[0].compile().evaluate(f);if(!Da(d)&&!s(d,!0))return!1;var p=u[1].compile().evaluate(f);return s(d,p)}return l.rawArgs=!0,l},{isTransformFunction:!0});var BHe="or",RHe=["typed","matrix","equalScalar","DenseMatrix","concat"],EB=V(BHe,RHe,e=>{var{typed:t,matrix:r,equalScalar:n,DenseMatrix:i,concat:a}=e,o=uS({typed:t,matrix:r,equalScalar:n,DenseMatrix:i,concat:a});function s(l,u,c){var f=l[0].compile().evaluate(c);if(!Da(f)&&o(f,!1))return!0;var d=l[1].compile().evaluate(c);return o(f,d)}return s.rawArgs=!0,s},{isTransformFunction:!0});var $He="bitAnd",qHe=["typed","matrix","zeros","add","equalScalar","not","concat"],kB=V($He,qHe,e=>{var{typed:t,matrix:r,equalScalar:n,zeros:i,not:a,concat:o}=e,s=sS({typed:t,matrix:r,equalScalar:n,zeros:i,not:a,concat:o});function l(u,c,f){var d=u[0].compile().evaluate(f);if(!Da(d)){if(isNaN(d))return NaN;if(d===0||d===!1)return 0}var p=u[1].compile().evaluate(f);return s(d,p)}return l.rawArgs=!0,l},{isTransformFunction:!0});var LHe="bitOr",zHe=["typed","matrix","equalScalar","DenseMatrix","concat"],CB=V(LHe,zHe,e=>{var{typed:t,matrix:r,equalScalar:n,DenseMatrix:i,concat:a}=e,o=lS({typed:t,matrix:r,equalScalar:n,DenseMatrix:i,concat:a});function s(l,u,c){var f=l[0].compile().evaluate(c);if(!Da(f)){if(isNaN(f))return NaN;if(f===-1)return-1;if(f===!0)return 1}var d=l[1].compile().evaluate(c);return o(f,d)}return s.rawArgs=!0,s},{isTransformFunction:!0});var yt=CT({config:it}),Si=DT({}),UH=ZP({BigNumber:yt,config:it}),Cge=WP({}),Dge=kI({BigNumber:yt,config:it}),Z0=OT({}),WH=iI({Complex:Si}),Oge=VP({BigNumber:yt,config:it}),Mge=JP({BigNumber:yt,config:it}),jge=tI({BigNumber:yt,config:it}),rC=jT({}),Nge=GP({BigNumber:yt,config:it}),Tge=HP({}),Fge=XP({BigNumber:yt,config:it}),_ge=MT({}),HH=vT({}),Pge=rI({BigNumber:yt,config:it}),Ige=WI({BigNumber:yt,config:it}),VH=YP({BigNumber:yt,config:it}),Bge=UP({}),Rge=aI({}),Lr=TT({Matrix:rC}),$ge=_I({BigNumber:yt,config:it}),qge=KP({BigNumber:yt,config:it}),DB=QP({BigNumber:yt,config:it}),Lge=zP({}),zge=nI({BigNumber:yt,config:it}),Me=gT({BigNumber:yt,Complex:Si,DenseMatrix:Lr,Fraction:Z0}),OB=oF({BigNumber:yt,config:it,typed:Me}),Uge=FI({BigNumber:yt,config:it}),lu=sF({typed:Me}),Wge=m_({Complex:Si,config:it,typed:Me}),Hge=A_({BigNumber:yt,typed:Me}),Vge=v_({BigNumber:yt,Complex:Si,config:it,typed:Me}),Yo=uF({typed:Me}),Gge=PF({typed:Me}),Qge=x_({BigNumber:yt,Complex:Si,config:it,typed:Me}),Yge=S_({typed:Me}),GH=E_({typed:Me}),Zge=C_({Complex:Si,config:it,typed:Me}),Oc=XT({BigNumber:yt,typed:Me}),Xge=FF({typed:Me}),Kge=ZT({typed:Me}),Jge=FT({typed:Me}),nC=hP({typed:Me}),iC=KT({Complex:Si,typed:Me}),X0=IF({typed:Me}),MB=D_({typed:Me}),e0e=M_({BigNumber:yt,typed:Me}),t0e=N_({BigNumber:yt,typed:Me}),r0e=pF({typed:Me}),Zr=VT({config:it,typed:Me}),n0e=d3({typed:Me}),QH=mF({typed:Me}),i0e=hF({Complex:Si,typed:Me}),a0e=WF({typed:Me}),o0e=VF({typed:Me}),_S=A3({typed:Me}),jB=GF({typed:Me}),s0e=y3({format:_S,typed:Me}),NB=BF({typed:Me}),Wu=IT({typed:Me}),GA=RT({typed:Me}),K0=LT({typed:Me}),Nd=zT({typed:Me}),l0e=eI({BigNumber:yt,config:it}),u0e=vP({Complex:Si,typed:Me}),c0e=yF({Complex:Si,config:it,typed:Me}),YH=bF({Complex:Si,config:it,typed:Me}),J0=ZF({typed:Me}),to=xF({typed:Me}),aC=$F({typed:Me}),Xm=QT({typed:Me}),f0e=v3({format:_S,typed:Me}),d0e=EP({config:it,typed:Me}),p0e=vS({typed:Me}),m0e=kP({config:it,typed:Me}),TB=RF({typed:Me}),h0e=F_({BigNumber:yt,typed:Me}),ZH=EF({BigNumber:yt,Fraction:Z0,complex:iC,typed:Me}),oC=P_({typed:Me}),Km=GT({Matrix:rC,equalScalar:Zr,typed:Me}),A0e=iF({typed:Me}),g0e=CF({typed:Me}),v0e=YT({typed:Me}),wf=cF({typed:Me}),y0e=B_({typed:Me}),XH=WT({typed:Me}),b0e=h_({Complex:Si,config:it,typed:Me}),x0e=y_({BigNumber:yt,typed:Me}),FB=G0({isInteger:Wu,typed:Me}),w0e=b_({BigNumber:yt,Complex:Si,config:it,typed:Me}),S0e=g3({format:_S,typed:Me}),E0e=AP({typed:Me}),k0e=O_({typed:Me}),C0e=T_({BigNumber:yt,typed:Me}),PS=UT({typed:Me}),D0e=w3({typed:Me}),O0e=CP({config:it,typed:Me}),M0e=__({BigNumber:yt,typed:Me}),j0e=I_({typed:Me}),N0e=d_({SparseMatrix:Km,typed:Me}),Td=kF({Complex:Si,config:it,typed:Me}),T0e=R_({typed:Me}),Lp=aF({typed:Me}),F0e=g_({BigNumber:yt,Complex:Si,config:it,typed:Me}),_0e=j_({BigNumber:yt,typed:Me}),Oy=JT({Fraction:Z0,typed:Me}),ev=$T({typed:Me}),vt=eF({DenseMatrix:Lr,Matrix:rC,SparseMatrix:Km,typed:Me}),P0e=tF({isZero:Nd,matrix:vt,typed:Me}),I0e=m3({isNaN:PS,isNumeric:ev,typed:Me}),Fd=S3({bignumber:Oc,fraction:Oy,number:Xm}),KH=h3({config:it,multiplyScalar:to,numeric:Fd,typed:Me}),JH=e3({isInteger:Wu,matrix:vt,typed:Me}),Vs=i3({matrix:vt,config:it,typed:Me}),B0e=a3({matrix:vt,typed:Me}),IS=o3({matrix:vt,typed:Me}),eV=OF({BigNumber:yt,config:it,matrix:vt,typed:Me}),Gs=l3({BigNumber:yt,config:it,matrix:vt,typed:Me}),R0e=w_({Complex:Si,config:it,typed:Me}),tV=fF({BigNumber:yt,Complex:Si,Fraction:Z0,config:it,isNegative:GA,matrix:vt,typed:Me,unaryMinus:Lp}),xn=cS({isInteger:Wu,matrix:vt,typed:Me}),$0e=LF({prod:KH,size:Vs,typed:Me}),_B=s3({conj:X0,transpose:IS,typed:Me}),rV=UF({DenseMatrix:Lr,SparseMatrix:Km,matrix:vt,typed:Me}),Ma=E3({numeric:Fd,typed:Me}),BS=N3({DenseMatrix:Lr,concat:xn,divideScalar:Ma,equalScalar:Zr,matrix:vt,typed:Me}),Sf=W3({DenseMatrix:Lr,concat:xn,equalScalar:Zr,matrix:vt,typed:Me}),RS=HF({matrix:vt,typed:Me}),q0e=qT({isNumeric:ev,typed:Me}),QA=QF({BigNumber:yt,DenseMatrix:Lr,SparseMatrix:Km,config:it,matrix:vt,typed:Me}),L0e=YF({matrix:vt,multiplyScalar:to,typed:Me}),sC=J3({DenseMatrix:Lr,concat:xn,config:it,matrix:vt,typed:Me}),z0e=I3({DenseMatrix:Lr,concat:xn,equalScalar:Zr,matrix:vt,typed:Me,zeros:Gs}),nV=T3({DenseMatrix:Lr,divideScalar:Ma,equalScalar:Zr,matrix:vt,multiplyScalar:to,subtractScalar:wf,typed:Me}),PB=nF({flatten:RS,matrix:vt,size:Vs,typed:Me}),U0e=SF({BigNumber:yt,concat:xn,equalScalar:Zr,matrix:vt,typed:Me}),W0e=XF({BigNumber:yt,config:it,matrix:vt,typed:Me}),IB=U4({addScalar:Yo,complex:iC,conj:X0,divideScalar:Ma,equal:Sf,identity:QA,isZero:Nd,matrix:vt,multiplyScalar:to,sign:ZH,sqrt:Td,subtractScalar:wf,typed:Me,unaryMinus:Lp,zeros:Gs}),H0e=t3({config:it,matrix:vt}),V0e=B3({DenseMatrix:Lr,concat:xn,equalScalar:Zr,matrix:vt,typed:Me,zeros:Gs}),My=C3({BigNumber:yt,DenseMatrix:Lr,config:it,equalScalar:Zr,matrix:vt,typed:Me,zeros:Gs}),uu=G3({DenseMatrix:Lr,concat:xn,config:it,matrix:vt,typed:Me}),ro=DF({DenseMatrix:Lr,concat:xn,equalScalar:Zr,matrix:vt,subtractScalar:wf,typed:Me,unaryMinus:Lp}),G0e=x3({concat:xn,matrix:vt,typed:Me}),Q0e=r_({DenseMatrix:Lr,concat:xn,config:it,equalScalar:Zr,matrix:vt,typed:Me}),BB=F3({DenseMatrix:Lr,divideScalar:Ma,equalScalar:Zr,matrix:vt,multiplyScalar:to,subtractScalar:wf,typed:Me}),Y0e=qF({DenseMatrix:Lr,concat:xn,matrix:vt,typed:Me}),an=Y_({DenseMatrix:Lr,SparseMatrix:Km,addScalar:Yo,concat:xn,equalScalar:Zr,matrix:vt,typed:Me}),Z0e=k_({BigNumber:yt,DenseMatrix:Lr,concat:xn,equalScalar:Zr,matrix:vt,typed:Me}),X0e=sS({concat:xn,equalScalar:Zr,matrix:vt,typed:Me}),K0e=lS({DenseMatrix:Lr,concat:xn,equalScalar:Zr,matrix:vt,typed:Me}),J0e=_F({DenseMatrix:Lr,concat:xn,matrix:vt,typed:Me}),eve=MP({addScalar:Yo,combinations:nC,divideScalar:Ma,isInteger:Wu,isNegative:GA,multiplyScalar:to,typed:Me}),tv=q3({BigNumber:yt,DenseMatrix:Lr,Fraction:Z0,concat:xn,config:it,equalScalar:Zr,matrix:vt,typed:Me}),iV=z3({concat:xn,matrix:vt,typed:Me}),tve=DS({add:an,typed:Me,unaryPlus:OB}),RB=e_({equal:Sf,typed:Me}),rve=dS({matrix:vt,number:Xm,subtract:ro,typed:Me}),nve=uP({abs:lu,addScalar:Yo,deepEqual:RB,divideScalar:Ma,multiplyScalar:to,sqrt:Td,subtractScalar:wf,typed:Me}),lC=K_({addScalar:Yo,conj:X0,multiplyScalar:to,size:Vs,typed:Me}),ive=H3({compareText:iV,isZero:Nd,typed:Me}),aV=nS({DenseMatrix:Lr,config:it,equalScalar:Zr,matrix:vt,round:My,typed:Me,zeros:Gs}),ave=gF({BigNumber:yt,DenseMatrix:Lr,concat:xn,config:it,equalScalar:Zr,matrix:vt,round:My,typed:Me,zeros:Gs}),ove=Z_({abs:lu,addScalar:Yo,divideScalar:Ma,isPositive:K0,multiplyScalar:to,smaller:uu,sqrt:Td,typed:Me}),oV=a_({DenseMatrix:Lr,smaller:uu}),Sl=o_({ImmutableDenseMatrix:oV,getMatrixDataType:jB}),cu=X3({DenseMatrix:Lr,concat:xn,config:it,matrix:vt,typed:Me}),$B=D3({Complex:Si,config:it,divideScalar:Ma,typed:Me}),sve=_3({DenseMatrix:Lr,divideScalar:Ma,equalScalar:Zr,matrix:vt,multiplyScalar:to,subtractScalar:wf,typed:Me}),lve=rF({flatten:RS,matrix:vt,size:Vs,typed:Me}),uve=ES({config:it,numeric:Fd,smaller:uu,typed:Me}),sV=iS({DenseMatrix:Lr,concat:xn,config:it,equalScalar:Zr,matrix:vt,round:My,typed:Me,zeros:Gs}),ni=wF({addScalar:Yo,dot:lC,equalScalar:Zr,matrix:vt,multiplyScalar:to,typed:Me}),cve=M3({Complex:Si,config:it,divideScalar:Ma,typed:Me}),fve=uS({DenseMatrix:Lr,concat:xn,equalScalar:Zr,matrix:vt,typed:Me}),uC=n_({compare:tv,isNaN:PS,isNumeric:ev,typed:Me}),dve=R3({DenseMatrix:Lr,concat:xn,equalScalar:Zr,matrix:vt,typed:Me,zeros:Gs}),lV=V4({SparseMatrix:Km,abs:lu,add:an,divideScalar:Ma,larger:cu,largerEq:sC,multiply:ni,subtract:ro,transpose:IS,typed:Me}),Mc=AS({add:an,matrix:vt,typed:Me,zeros:Gs}),qB=CS({add:an,config:it,numeric:Fd,typed:Me}),pve=J_({add:an,matrix:vt,typed:Me}),uV=P3({DenseMatrix:Lr,divideScalar:Ma,equalScalar:Zr,matrix:vt,multiplyScalar:to,subtractScalar:wf,typed:Me}),mve=$P({Complex:Si,add:an,multiply:ni,number:Xm,typed:Me}),LB=dF({DenseMatrix:Lr,config:it,equalScalar:Zr,matrix:vt,round:My,typed:Me,zeros:Gs}),zp=L3({compare:tv,typed:Me}),hve=jP({addScalar:Yo,combinations:nC,isInteger:Wu,isNegative:GA,isPositive:K0,larger:cu,typed:Me}),Ave=zF({matrix:vt,multiply:ni,subtract:ro,typed:Me}),cV=J4({divideScalar:Ma,isZero:Nd,matrix:vt,multiply:ni,subtractScalar:wf,typed:Me,unaryMinus:Lp}),gve=NF({concat:xn,equalScalar:Zr,matrix:vt,multiplyScalar:to,typed:Me}),fV=s_({larger:cu,smaller:uu}),dV=AF({Complex:Si,DenseMatrix:Lr,ceil:LB,equalScalar:Zr,floor:aV,matrix:vt,typed:Me,zeros:Gs}),pV=e4({Index:Sl,typed:Me}),vve=cP({abs:lu,add:an,addScalar:Yo,config:it,divideScalar:Ma,equalScalar:Zr,flatten:RS,isNumeric:ev,isZero:Nd,matrix:vt,multiply:ni,multiplyScalar:to,smaller:uu,subtract:ro,typed:Me}),yve=MF({BigNumber:yt,add:an,config:it,equal:Sf,isInteger:Wu,mod:sV,smaller:uu,typed:Me,xgcd:eV}),bve=vF({concat:xn,equalScalar:Zr,matrix:vt,typed:Me}),xve=O3({Complex:Si,config:it,divideScalar:Ma,log:$B,typed:Me}),zB=SS({config:it,larger:cu,numeric:Fd,typed:Me}),wve=$_({DenseMatrix:Lr,Index:Sl,compareNatural:zp,size:Vs,subset:Mc,typed:Me}),Sve=L_({DenseMatrix:Lr,Index:Sl,compareNatural:zp,size:Vs,subset:Mc,typed:Me}),Eve=U_({Index:Sl,compareNatural:zp,size:Vs,subset:Mc,typed:Me}),kve=H_({Index:Sl,compareNatural:zp,size:Vs,subset:Mc,typed:Me}),jy=Y3({DenseMatrix:Lr,concat:xn,config:it,matrix:vt,typed:Me}),Cve=i_({compare:tv,compareNatural:zp,matrix:vt,typed:Me}),Dve=wS({concat:xn,equalScalar:Zr,matrix:vt,not:aC,typed:Me,zeros:Gs}),Ny=mS({bignumber:Oc,matrix:vt,add:an,config:it,isPositive:K0,larger:cu,largerEq:sC,smaller:uu,smallerEq:jy,typed:Me}),Ove=hS({Index:Sl,matrix:vt,range:Ny,typed:Me}),mV=q_({DenseMatrix:Lr,Index:Sl,compareNatural:zp,size:Vs,subset:Mc,typed:Me}),Mve=W_({Index:Sl,compareNatural:zp,size:Vs,subset:Mc,typed:Me}),hV=G_({Index:Sl,concat:xn,setDifference:mV,size:Vs,subset:Mc,typed:Me}),AV=l_({FibonacciHeap:fV,addScalar:Yo,equalScalar:Zr}),gV=fS({Index:Sl,matrix:vt,range:Ny,typed:Me}),rv=eP({abs:lu,addScalar:Yo,det:cV,divideScalar:Ma,identity:QA,matrix:vt,multiply:ni,typed:Me,unaryMinus:Lp}),vV=z4({DenseMatrix:Lr,Spa:AV,SparseMatrix:Km,abs:lu,addScalar:Yo,divideScalar:Ma,equalScalar:Zr,larger:cu,matrix:vt,multiplyScalar:to,subtractScalar:wf,typed:Me,unaryMinus:Lp}),jve=tP({Complex:Si,add:an,ctranspose:_B,deepEqual:RB,divideScalar:Ma,dot:lC,dotDivide:BS,equal:Sf,inv:rv,matrix:vt,multiply:ni,typed:Me}),Ef=k3({Complex:Si,config:it,fraction:Oy,identity:QA,inv:rv,matrix:vt,multiply:ni,number:Xm,typed:Me}),yV=z_({DenseMatrix:Lr,Index:Sl,compareNatural:zp,size:Vs,subset:Mc,typed:Me}),Nve=Q_({Index:Sl,concat:xn,setIntersect:yV,setSymDifference:hV,size:Vs,subset:Mc,typed:Me}),Tve=iP({abs:lu,add:an,identity:QA,inv:rv,map:J0,max:zB,multiply:ni,size:Vs,sqrt:Td,subtract:ro,typed:Me}),yr=c_({BigNumber:yt,Complex:Si,Fraction:Z0,abs:lu,addScalar:Yo,config:it,divideScalar:Ma,equal:Sf,fix:dV,format:_S,isNumeric:ev,multiplyScalar:to,number:Xm,pow:Ef,round:My,subtractScalar:wf}),Fve=dI({BigNumber:yt,Unit:yr,config:it}),_ve=GI({BigNumber:yt,Unit:yr,config:it}),Pve=PI({BigNumber:yt,Unit:yr,config:it}),Ive=hI({BigNumber:yt,Unit:yr,config:it}),Bve=BI({BigNumber:yt,Unit:yr,config:it}),Rve=AI({BigNumber:yt,Unit:yr,config:it}),$ve=pI({BigNumber:yt,Unit:yr,config:it}),qve=OI({BigNumber:yt,Unit:yr,config:it}),Lve=j3({DenseMatrix:Lr,concat:xn,equalScalar:Zr,matrix:vt,pow:Ef,typed:Me}),zve=fI({BigNumber:yt,Unit:yr,config:it}),Uve=mI({BigNumber:yt,Unit:yr,config:it}),Wve=nP({abs:lu,add:an,identity:QA,inv:rv,multiply:ni,typed:Me}),Hve=RI({BigNumber:yt,Unit:yr,config:it}),bV=u3({addScalar:Yo,ceil:LB,conj:X0,divideScalar:Ma,dotDivide:BS,exp:QH,i:WH,log2:YH,matrix:vt,multiplyScalar:to,pow:Ef,tau:VH,typed:Me}),UB=gP({BigNumber:yt,Complex:Si,config:it,multiplyScalar:to,pow:Ef,typed:Me}),Vve=sI({BigNumber:yt,Unit:yr,config:it}),Gve=CI({BigNumber:yt,Unit:yr,config:it}),Qve=c3({conj:X0,dotDivide:BS,fft:bV,typed:Me}),Yve=bI({BigNumber:yt,Unit:yr,config:it}),Zve=qI({BigNumber:yt,Unit:yr,config:it}),Xve=cI({BigNumber:yt,Unit:yr,config:it}),Kve=QI({BigNumber:yt,Unit:yr,config:it}),Jve=zI({BigNumber:yt,Unit:yr,config:it}),e1e=MI({BigNumber:yt,Unit:yr,config:it}),t1e=yI({BigNumber:yt,Unit:yr,config:it}),r1e=eB({BigNumber:yt,Unit:yr,config:it}),n1e=XI({BigNumber:yt,Unit:yr,config:it}),i1e=tB({BigNumber:yt,Unit:yr,config:it}),a1e=DI({BigNumber:yt,Unit:yr,config:it}),o1e=jI({BigNumber:yt,Unit:yr,config:it}),s1e=uI({BigNumber:yt,Unit:yr,config:it}),l1e=NI({BigNumber:yt,Unit:yr,config:it}),u1e=HI({BigNumber:yt,Unit:yr,config:it}),c1e=oI({BigNumber:yt,Unit:yr,config:it}),f1e=VI({BigNumber:yt,Unit:yr,config:it}),d1e=TI({BigNumber:yt,Unit:yr,config:it}),p1e=II({BigNumber:yt,Unit:yr,config:it}),m1e=xI({BigNumber:yt,Unit:yr,config:it}),h1e=p_({Unit:yr,typed:Me}),vs=lP({divideScalar:Ma,equalScalar:Zr,inv:rv,matrix:vt,multiply:ni,typed:Me}),A1e=SI({BigNumber:yt,Unit:yr,config:it}),$S=yP({gamma:UB,typed:Me}),g1e=$I({BigNumber:yt,Unit:yr,config:it}),v1e=ZI({BigNumber:yt,Unit:yr,config:it}),y1e=gI({BigNumber:yt,Unit:yr,config:it}),xV=G4({DenseMatrix:Lr,lsolve:nV,lup:vV,matrix:vt,slu:lV,typed:Me,usolve:BB}),b1e=vI({BigNumber:yt,Unit:yr,config:it}),x1e=YI({BigNumber:yt,Unit:yr,config:it}),w1e=xP({add:an,divide:vs,factorial:$S,isInteger:Wu,isPositive:K0,multiply:ni,typed:Me}),S1e=wP({factorial:$S,typed:Me}),E1e=KI({BigNumber:yt,Unit:yr,config:it}),k1e=Q4({add:an,cbrt:tV,divide:vs,equalScalar:Zr,im:NB,isZero:Nd,multiply:ni,re:TB,sqrt:Td,subtract:ro,typeOf:XH,typed:Me,unaryMinus:Lp}),C1e=V_({compareNatural:zp,typed:Me}),D1e=f3({abs:lu,add:an,bignumber:Oc,divide:vs,isNegative:GA,isPositive:K0,larger:cu,map:J0,matrix:vt,max:zB,multiply:ni,smaller:uu,subtract:ro,typed:Me,unaryMinus:Lp}),wV=DP({bignumber:Oc,addScalar:Yo,combinations:nC,divideScalar:Ma,factorial:$S,isInteger:Wu,isNegative:GA,larger:cu,multiplyScalar:to,number:Xm,pow:Ef,subtractScalar:wf,typed:Me}),O1e=f_({Unit:yr,typed:Me}),M1e=OP({addScalar:Yo,isInteger:Wu,isNegative:GA,stirlingS2:wV,typed:Me}),SV=rP({abs:lu,add:an,addScalar:Yo,atan:GH,bignumber:Oc,column:gV,complex:iC,config:it,cos:MB,diag:rV,divideScalar:Ma,dot:lC,equal:Sf,flatten:RS,im:NB,inv:rv,larger:cu,matrix:vt,matrixFromColumns:PB,multiply:ni,multiplyScalar:to,number:Xm,qr:IB,re:TB,reshape:JH,sin:oC,size:Vs,smaller:uu,sqrt:Td,subtract:ro,typed:Me,usolve:BB,usolveAll:uV}),j1e=EI({BigNumber:yt,Unit:yr,config:it}),N1e=LI({BigNumber:yt,Unit:yr,config:it}),T1e=bP({divide:vs,dotDivide:BS,isNumeric:ev,log:$B,map:J0,matrix:vt,multiply:ni,sum:qB,typed:Me}),EV=OS({add:an,divide:vs,typed:Me}),F1e=UI({BigNumber:yt,Unit:yr,config:it}),_1e=lI({BigNumber:yt,Unit:yr,config:it}),P1e=jS({bignumber:Oc,add:an,compare:tv,divide:vs,isInteger:Wu,larger:cu,multiply:ni,partitionSelect:uC,smaller:uu,smallerEq:jy,subtract:ro,typed:Me}),WB=MS({add:an,apply:FB,divide:vs,isNaN:PS,multiply:ni,subtract:ro,typed:Me}),I1e=wI({BigNumber:yt,Unit:yr,config:it}),cC=dP({add:an,compare:tv,divide:vs,partitionSelect:uC,typed:Me}),B1e=mP({add:an,divide:vs,matrix:vt,mean:EV,multiply:ni,pow:Ef,sqrt:Td,subtract:ro,sum:qB,typed:Me}),R1e=qP({Complex:Si,add:an,divide:vs,matrix:vt,multiply:ni,typed:Me}),$1e=pP({abs:lu,map:J0,median:cC,subtract:ro,typed:Me}),q1e=NS({map:J0,sqrt:Td,typed:Me,variance:WB}),L1e=p3({BigNumber:yt,Complex:Si,add:an,config:it,divide:vs,equal:Sf,factorial:$S,gamma:UB,isNegative:GA,multiply:ni,pi:DB,pow:Ef,sin:oC,smallerEq:jy,subtract:ro,typed:Me}),HB=X_({abs:lu,add:an,conj:X0,ctranspose:_B,eigs:SV,equalScalar:Zr,larger:cu,matrix:vt,multiply:ni,pow:Ef,smaller:uu,sqrt:Td,typed:Me}),kV=n3({BigNumber:yt,DenseMatrix:Lr,SparseMatrix:Km,addScalar:Yo,config:it,cos:MB,matrix:vt,multiplyScalar:to,norm:HB,sin:oC,typed:Me,unaryMinus:Lp}),z1e=JI({BigNumber:yt,Unit:yr,config:it}),CV=oP({identity:QA,matrix:vt,multiply:ni,norm:HB,qr:IB,subtract:ro,typed:Me}),U1e=r3({multiply:ni,rotationMatrix:kV,typed:Me}),DV=aP({abs:lu,add:an,concat:xn,identity:QA,index:pV,lusolve:xV,matrix:vt,matrixFromColumns:PB,multiply:ni,range:Ny,schur:CV,subset:Mc,subtract:ro,transpose:IS,typed:Me}),W1e=sP({matrix:vt,multiply:ni,sylvester:DV,transpose:IS,typed:Me});var qS={},LS={},H1e={},fu=r4({mathWithTransform:LS}),zS=k4({Node:fu}),YA=D4({Node:fu}),Ty=M4({Node:fu}),V1e=F4({Node:fu}),US=s4({Node:fu}),G1e=p4({Node:fu,ResultSet:HH}),Q1e=h4({Node:fu}),nv=y4({Node:fu}),Y1e=N4({Node:fu}),UHe=LP({classes:H1e}),OV=Z4({math:qS,typed:Me}),Z1e=x4({Node:fu,typed:Me}),WHe=K4({Chain:OV,typed:Me}),WS=S4({Node:fu,size:Vs}),HS=a4({Node:fu,subset:Mc}),X1e=f4({matrix:vt,Node:fu,subset:Mc}),iv=_4({Unit:yr,Node:fu,math:qS}),av=I4({Node:fu,SymbolNode:iv,math:qS}),_d=B4({AccessorNode:HS,ArrayNode:US,AssignmentNode:X1e,BlockNode:G1e,ConditionalNode:Q1e,ConstantNode:nv,FunctionAssignmentNode:Z1e,FunctionNode:av,IndexNode:WS,ObjectNode:zS,OperatorNode:YA,ParenthesisNode:Ty,RangeNode:Y1e,RelationalNode:V1e,SymbolNode:iv,config:it,numeric:Fd,typed:Me}),K1e=PP({ConstantNode:nv,FunctionNode:av,OperatorNode:YA,ParenthesisNode:Ty,parse:_d,typed:Me}),MV=FP({bignumber:Oc,fraction:Oy,AccessorNode:HS,ArrayNode:US,ConstantNode:nv,FunctionNode:av,IndexNode:WS,ObjectNode:zS,OperatorNode:YA,SymbolNode:iv,config:it,mathWithTransform:LS,matrix:vt,typed:Me}),HHe=R4({parse:_d,typed:Me}),jV=_P({AccessorNode:HS,ArrayNode:US,ConstantNode:nv,FunctionNode:av,IndexNode:WS,ObjectNode:zS,OperatorNode:YA,ParenthesisNode:Ty,SymbolNode:iv,add:an,divide:vs,equal:Sf,isZero:Nd,multiply:ni,parse:_d,pow:Ef,subtract:ro,typed:Me}),NV=$4({parse:_d,typed:Me}),J1e=Y4({evaluate:NV}),eye=q4({evaluate:NV}),VB=TP({bignumber:Oc,fraction:Oy,AccessorNode:HS,ArrayNode:US,ConstantNode:nv,FunctionNode:av,IndexNode:WS,ObjectNode:zS,OperatorNode:YA,ParenthesisNode:Ty,SymbolNode:iv,add:an,config:it,divide:vs,equal:Sf,isZero:Nd,mathWithTransform:LS,matrix:vt,multiply:ni,parse:_d,pow:Ef,resolve:K1e,simplifyConstant:MV,simplifyCore:jV,subtract:ro,typed:Me}),VHe=IP({OperatorNode:YA,parse:_d,simplify:VB,typed:Me}),GHe=NP({parse:_d,typed:Me}),QHe=L4({Parser:eye,typed:Me}),YHe=RP({bignumber:Oc,fraction:Oy,AccessorNode:HS,ArrayNode:US,ConstantNode:nv,FunctionNode:av,IndexNode:WS,ObjectNode:zS,OperatorNode:YA,ParenthesisNode:Ty,SymbolNode:iv,add:an,config:it,divide:vs,equal:Sf,isZero:Nd,mathWithTransform:LS,matrix:vt,multiply:ni,parse:_d,pow:Ef,simplify:VB,simplifyConstant:MV,simplifyCore:jV,subtract:ro,typed:Me}),ZHe=BP({ConstantNode:nv,FunctionNode:av,OperatorNode:YA,ParenthesisNode:Ty,SymbolNode:iv,config:it,equal:Sf,isZero:Nd,numeric:Fd,parse:_d,simplify:VB,typed:Me}),XHe=X4({Help:J1e,mathWithTransform:LS,typed:Me});Fn(qS,{e:UH,false:Cge,fineStructure:Dge,i:WH,Infinity:Oge,LN10:Mge,LOG10E:jge,NaN:Nge,null:Tge,phi:Fge,SQRT1_2:Pge,sackurTetrode:Ige,tau:VH,true:Bge,E:UH,version:Rge,efimovFactor:$ge,LN2:qge,pi:DB,replacer:Lge,reviver:UHe,SQRT2:zge,typed:Me,unaryPlus:OB,PI:DB,weakMixingAngle:Uge,abs:lu,acos:Wge,acot:Hge,acsc:Vge,addScalar:Yo,arg:Gge,asech:Qge,asinh:Yge,atan:GH,atanh:Zge,bignumber:Oc,bitNot:Xge,boolean:Kge,clone:Jge,combinations:nC,complex:iC,conj:X0,cos:MB,cot:e0e,csc:t0e,cube:r0e,equalScalar:Zr,erf:n0e,exp:QH,expm1:i0e,filter:a0e,forEach:o0e,format:_S,getMatrixDataType:jB,hex:s0e,im:NB,isInteger:Wu,isNegative:GA,isPositive:K0,isZero:Nd,LOG2E:l0e,lgamma:u0e,log10:c0e,log2:YH,map:J0,multiplyScalar:to,not:aC,number:Xm,oct:f0e,pickRandom:d0e,print:p0e,random:m0e,re:TB,sec:h0e,sign:ZH,sin:oC,splitUnit:A0e,square:g0e,string:v0e,subtractScalar:wf,tan:y0e,typeOf:XH,acosh:b0e,acsch:x0e,apply:FB,asec:w0e,bin:S0e,chain:WHe,combinationsWithRep:E0e,cosh:k0e,csch:C0e,isNaN:PS,isPrime:D0e,randomInt:O0e,sech:M0e,sinh:j0e,sparse:N0e,sqrt:Td,tanh:T0e,unaryMinus:Lp,acoth:F0e,coth:_0e,fraction:Oy,isNumeric:ev,matrix:vt,matrixFromFunction:P0e,mode:I0e,numeric:Fd,prod:KH,reshape:JH,size:Vs,squeeze:B0e,transpose:IS,xgcd:eV,zeros:Gs,asin:R0e,cbrt:tV,concat:xn,count:$0e,ctranspose:_B,diag:rV,divideScalar:Ma,dotDivide:BS,equal:Sf,flatten:RS,hasNumericValue:q0e,identity:QA,kron:L0e,largerEq:sC,leftShift:z0e,lsolve:nV,matrixFromColumns:PB,nthRoot:U0e,ones:W0e,qr:IB,resize:H0e,rightArithShift:V0e,round:My,smaller:uu,subtract:ro,to:G0e,unequal:Q0e,usolve:BB,xor:Y0e,add:an,atan2:Z0e,bitAnd:X0e,bitOr:K0e,bitXor:J0e,catalan:eve,compare:tv,compareText:iV,cumsum:tve,deepEqual:RB,diff:rve,distance:nve,dot:lC,equalText:ive,floor:aV,gcd:ave,hypot:ove,larger:cu,log:$B,lsolveAll:sve,matrixFromRows:lve,min:uve,mod:sV,multiply:ni,nthRoots:cve,or:fve,partitionSelect:uC,rightLogShift:dve,slu:lV,subset:Mc,sum:qB,trace:pve,usolveAll:uV,zpk2tf:mve,ceil:LB,compareNatural:zp,composition:hve,cross:Ave,det:cV,dotMultiply:gve,fix:dV,index:pV,intersect:vve,invmod:yve,lcm:bve,log1p:xve,max:zB,setCartesian:wve,setDistinct:Sve,setIsSubset:Eve,setPowerset:kve,smallerEq:jy,sort:Cve,and:Dve,range:Ny,row:Ove,setDifference:mV,setMultiplicity:Mve,setSymDifference:hV,column:gV,inv:rv,lup:vV,pinv:jve,pow:Ef,setIntersect:yV,setUnion:Nve,sqrtm:Tve,vacuumImpedance:Fve,wienDisplacement:_ve,atomicMass:Pve,bohrMagneton:Ive,boltzmann:Bve,conductanceQuantum:Rve,coulomb:$ve,deuteronMass:qve,dotPow:Lve,electricConstant:zve,elementaryCharge:Uve,expm:Wve,faraday:Hve,fft:bV,gamma:UB,gravitationConstant:Vve,hartreeEnergy:Gve,ifft:Qve,klitzing:Yve,loschmidt:Zve,magneticConstant:Xve,molarMass:Kve,molarPlanckConstant:Jve,neutronMass:e1e,nuclearMagneton:t1e,planckCharge:r1e,planckLength:n1e,planckTemperature:i1e,protonMass:a1e,quantumOfCirculation:o1e,reducedPlanckConstant:s1e,rydberg:l1e,secondRadiation:u1e,speedOfLight:c1e,stefanBoltzmann:f1e,thomsonCrossSection:d1e,avogadro:p1e,bohrRadius:m1e,createUnit:h1e,divide:vs,electronMass:A1e,factorial:$S,firstRadiation:g1e,gravity:v1e,inverseConductanceQuantum:y1e,lusolve:xV,magneticFluxQuantum:b1e,molarMassC12:x1e,multinomial:w1e,parse:_d,permutations:S1e,planckMass:E1e,polynomialRoot:k1e,resolve:K1e,setSize:C1e,simplifyConstant:MV,solveODE:D1e,stirlingS2:wV,unit:O1e,bellNumbers:M1e,compile:HHe,eigs:SV,fermiCoupling:j1e,gasConstant:N1e,kldivergence:T1e,mean:EV,molarVolume:F1e,planckConstant:_1e,quantileSeq:P1e,simplifyCore:jV,variance:WB,classicalElectronRadius:I1e,evaluate:NV,median:cC,simplify:VB,symbolicEqual:VHe,corr:B1e,freqz:R1e,leafCount:GHe,mad:$1e,parser:QHe,rationalize:YHe,std:q1e,zeta:L1e,derivative:ZHe,norm:HB,rotationMatrix:kV,help:XHe,planckTime:z1e,schur:CV,rotate:U1e,sylvester:DV,lyap:W1e,config:it});Fn(LS,qS,{filter:aB({typed:Me}),forEach:oB({typed:Me}),map:lB({typed:Me}),apply:nB({isInteger:Wu,typed:Me}),or:EB({DenseMatrix:Lr,concat:xn,equalScalar:Zr,matrix:vt,typed:Me}),and:SB({add:an,concat:xn,equalScalar:Zr,matrix:vt,not:aC,typed:Me,zeros:Gs}),concat:hB({isInteger:Wu,matrix:vt,typed:Me}),max:uB({config:it,larger:cu,numeric:Fd,typed:Me}),print:wB({add:an,matrix:vt,typed:Me,zeros:Gs}),bitAnd:kB({add:an,concat:xn,equalScalar:Zr,matrix:vt,not:aC,typed:Me,zeros:Gs}),diff:AB({bignumber:Oc,matrix:vt,number:Xm,subtract:ro,typed:Me}),min:fB({config:it,numeric:Fd,smaller:uu,typed:Me}),subset:mB({add:an,matrix:vt,typed:Me,zeros:Gs}),bitOr:CB({DenseMatrix:Lr,concat:xn,equalScalar:Zr,matrix:vt,typed:Me}),cumsum:bB({add:an,typed:Me,unaryPlus:OB}),index:sB({Index:Sl,getMatrixDataType:jB}),sum:vB({add:an,config:it,numeric:Fd,typed:Me}),range:dB({bignumber:Oc,matrix:vt,add:an,config:it,isPositive:K0,larger:cu,largerEq:sC,smaller:uu,smallerEq:jy,typed:Me}),row:pB({Index:Sl,matrix:vt,range:Ny,typed:Me}),column:iB({Index:Sl,matrix:vt,range:Ny,typed:Me}),mean:cB({add:an,divide:vs,typed:Me}),quantileSeq:yB({add:an,bignumber:Oc,compare:tv,divide:vs,isInteger:Wu,larger:cu,multiply:ni,partitionSelect:uC,smaller:uu,smallerEq:jy,subtract:ro,typed:Me}),variance:xB({add:an,apply:FB,divide:vs,isNaN:PS,multiply:ni,subtract:ro,typed:Me}),std:gB({map:J0,sqrt:Td,typed:Me,variance:WB})});Fn(H1e,{BigNumber:yt,Complex:Si,Fraction:Z0,Matrix:rC,Node:fu,ObjectNode:zS,OperatorNode:YA,ParenthesisNode:Ty,Range:_ge,RelationalNode:V1e,ResultSet:HH,ArrayNode:US,BlockNode:G1e,ConditionalNode:Q1e,ConstantNode:nv,DenseMatrix:Lr,RangeNode:Y1e,Chain:OV,FunctionAssignmentNode:Z1e,SparseMatrix:Km,IndexNode:WS,ImmutableDenseMatrix:oV,Index:Sl,AccessorNode:HS,AssignmentNode:X1e,FibonacciHeap:fV,Spa:AV,Unit:yr,SymbolNode:iv,FunctionNode:av,Help:J1e,Parser:eye});OV.createProxy(qS);var TV=zH;var aye=Ae(sT(),1);var rye=Ae(tye(),1);function nye(e){var t=new rye.default;return e.on=t.on.bind(t),e.off=t.off.bind(t),e.once=t.once.bind(t),e.emit=t.emit.bind(t),e}function iye(e,t,r,n){function i(g,A){var b=arguments.length;if(b!==1&&b!==2)throw new bf("import",b,1,2);A||(A={});function v(k,j,O){if(Array.isArray(j))j.forEach(D=>v(k,D));else if(typeof j=="object")for(var C in j)Et(j,C)&&v(k,j[C],C);else if(by(j)||O!==void 0){var N=by(j)?h(j)?j.fn+".transform":j.fn:O;if(Et(k,N)&&k[N]!==j&&!A.silent)throw new Error('Cannot import "'+N+'" twice');k[N]=j}else if(!A.silent)throw new TypeError("Factory, Object, or Array expected")}var x={};v(x,g);for(var w in x)if(Et(x,w)){var S=x[w];if(by(S))u(S,A);else if(c(S))a(w,S,A);else if(!A.silent)throw new TypeError("Factory, Object, or Array expected")}}function a(g,A,b){if(b.wrap&&typeof A=="function"&&(A=l(A)),f(A)&&(A=e(g,{[A.signature]:A})),e.isTypedFunction(r[g])&&e.isTypedFunction(A)){b.override?A=e(g,A.signatures):A=e(r[g],A),r[g]=A,delete n[g],o(g,A),r.emit("import",g,function(){return A});return}if(r[g]===void 0||b.override){r[g]=A,delete n[g],o(g,A),r.emit("import",g,function(){return A});return}if(!b.silent)throw new Error('Cannot import "'+g+'": already exists')}function o(g,A){A&&typeof A.transform=="function"?(r.expression.transform[g]=A.transform,d(g)&&(r.expression.mathWithTransform[g]=A.transform)):(delete r.expression.transform[g],d(g)&&(r.expression.mathWithTransform[g]=A))}function s(g){delete r.expression.transform[g],d(g)?r.expression.mathWithTransform[g]=r[g]:delete r.expression.mathWithTransform[g]}function l(g){var A=function(){for(var v=[],x=0,w=arguments.length;x2&&arguments[2]!==void 0?arguments[2]:g.fn;if(aW(b,"."))throw new Error("Factory name should not contain a nested path. Name: "+JSON.stringify(b));var v=h(g)?r.expression.transform:r,x=b in r.expression.transform,w=Et(v,b)?v[b]:void 0,S=function(){var j={};g.dependencies.map(lW).forEach(C=>{if(aW(C,"."))throw new Error("Factory dependency should not contain a nested path. Name: "+JSON.stringify(C));C==="math"?j.math=r:C==="mathWithTransform"?j.mathWithTransform=r.expression.mathWithTransform:C==="classes"?j.classes=r:j[C]=r[C]});var O=g(j);if(O&&typeof O.transform=="function")throw new Error('Transforms cannot be attached to factory functions. Please create a separate function for it with exports.path="expression.transform"');if(w===void 0||A.override)return O;if(e.isTypedFunction(w)&&e.isTypedFunction(O))return e(w,O);if(A.silent)return w;throw new Error('Cannot import "'+b+'": already exists')};!g.meta||g.meta.lazy!==!1?(Hw(v,b,S),w&&x?s(b):(h(g)||p(g))&&Hw(r.expression.mathWithTransform,b,()=>v[b])):(v[b]=S(),w&&x?s(b):(h(g)||p(g))&&Hw(r.expression.mathWithTransform,b,()=>v[b])),n[b]=g,r.emit("import",b,S)}function c(g){return typeof g=="function"||typeof g=="number"||typeof g=="string"||typeof g=="boolean"||g===null||Fo(g)||ds(g)||It(g)||gf(g)||St(g)||Array.isArray(g)}function f(g){return typeof g=="function"&&typeof g.signature=="string"}function d(g){return!Et(m,g)}function p(g){return g.fn.indexOf(".")===-1&&!Et(m,g.fn)&&(!g.meta||!g.meta.isClass)}function h(g){return g!==void 0&&g.meta!==void 0&&g.meta.isTransformFunction===!0||!1}var m={expression:!0,type:!0,docs:!0,error:!0,json:!0,chain:!0};return i}function GB(e,t){var r=Fn({},gy,t);if(typeof Object.create!="function")throw new Error("ES5 not supported by this JavaScript engine. Please load the es5-shim and es5-sham library for compatibility.");var n=nye({isNumber:Qt,isComplex:ds,isBigNumber:It,isFraction:gf,isUnit:Fo,isString:da,isArray:Ir,isMatrix:St,isCollection:Da,isDenseMatrix:qA,isSparseMatrix:vf,isRange:R0,isIndex:Wm,isBoolean:VN,isResultSet:GN,isHelp:zw,isFunction:QN,isDate:YN,isRegExp:ZN,isObject:Hm,isNull:XN,isUndefined:KN,isAccessorNode:Uu,isArrayNode:ps,isAssignmentNode:JN,isBlockNode:eT,isConditionalNode:tT,isConstantNode:gr,isFunctionAssignmentNode:Ed,isFunctionNode:xl,isIndexNode:Sc,isNode:Nr,isObjectNode:Vm,isOperatorNode:bi,isParenthesisNode:ms,isRangeNode:rT,isRelationalNode:nT,isSymbolNode:ri,isChain:Uw});n.config=Xoe(r,n.emit),n.expression={transform:{},mathWithTransform:{config:n.config}};var i=[],a=[];function o(c){if(by(c))return c(n);var f=c[Object.keys(c)[0]];if(by(f))return f(n);if(!Qoe(c))throw console.warn("Factory object with properties `type`, `name`, and `factory` expected",c),new Error("Factory object with properties `type`, `name`, and `factory` expected");var d=i.indexOf(c),p;return d===-1?(c.math===!0?p=c.factory(n.type,r,o,n.typed,n):p=c.factory(n.type,r,o,n.typed),i.push(c),a.push(p)):p=a[d],p}var s={};function l(){for(var c=arguments.length,f=new Array(c),d=0;d{YU(s).forEach(c=>{c&&c.meta&&c.meta.recreateOnConfigChange&&u(c,{override:!0})})}),n.create=GB.bind(null,e),n.factory=V,n.import(YU(Voe(e))),n.ArgumentsError=bf,n.DimensionError=nr,n.IndexError=As,n}var fC={prop:{name:"prop",fn:"prop",args:[{name:"property",types:["text"]}],returnType:"any",description:"Get the value of a property",category:"Property",difficulty:1},slice:{name:"slice",fn:"slice",args:[{name:"text",types:["text"]},{name:"start",types:["number"]},{name:"end",types:["number"]}],returnType:"text",description:"Get a part of a text",category:"String",difficulty:1},if:{name:"if",fn:"if",args:[{name:"condition",types:["boolean"]},{name:"ifTrue",types:["any"]},{name:"ifFalse",types:["any"]}],returnType:"any",description:"If condition is true return the first argument else return the second",category:"Logic",difficulty:2},ifs:{name:"ifs",fn:"ifs",args:[{name:"condition",types:["boolean"]},{name:"ifTrue",types:["any"]},{name:"...",types:[]},{name:"ifFalse",types:["any"]}],returnType:"any",description:"If the first condition is true return the first argument else check the next condition",category:"Logic",difficulty:2},empty:{name:"empty",fn:"empty",args:[{name:"value",types:["any"]}],returnType:"boolean",description:"Check if a list is empty",category:"String",difficulty:1},length:{name:"length",fn:"length",args:[{name:"list",types:["any-multi"]}],returnType:"number",description:"Get the length of a list",category:"List",difficulty:1},values:{name:"values",fn:"values",args:[{name:"list",types:["any-multi"]}],returnType:"number",description:"Get the number of values in a list",category:"List",difficulty:1},uniques:{name:"uniques",fn:"uniques",args:[{name:"list",types:["any-list"]}],returnType:"number",description:"Get the number of unique values in a list",category:"List",difficulty:1},substring:{name:"substring",fn:"substring",args:[{name:"string",types:["text"]},{name:"start",types:["number"]},{name:"end",types:["number"]}],returnType:"text",description:"Get a substring of a string",category:"String",difficulty:2},startsWith:{name:"startsWith",fn:"startsWith",args:[{name:"string",types:["text"]},{name:"substring",types:["text"]}],returnType:"boolean",description:"Check if a string starts with another string",category:"String",difficulty:1},contains:{name:"contains",fn:"contains",args:[{name:"string",types:["text"]},{name:"substring",types:["text"]}],returnType:"boolean",description:"Check if a string contains another string",category:"String",difficulty:1},test:{name:"test",fn:"test",args:[{name:"string",types:["text"]},{name:"regex",types:["text"]}],returnType:"boolean",description:"Test a string with a regex",category:"String",difficulty:3},match:{name:"match",fn:"match",args:[{name:"string",types:["text"]},{name:"regex",types:["text"]}],returnType:"boolean",description:"Match a string with a regex",category:"String",difficulty:3},replace:{name:"replace",fn:"replace",args:[{name:"string",types:["text"]},{name:"search",types:["text"]},{name:"replace",types:["text"]}],returnType:"text",description:"Replace a string with another string",category:"String",difficulty:1},replaceAll:{name:"replaceAll",fn:"replaceAll",args:[{name:"string",types:["text"]},{name:"search",types:["text"]},{name:"replace",types:["text"]}],returnType:"text",description:"Replace all occurences of a string with another string",category:"String",difficulty:1},lower:{name:"lower",fn:"lower",args:[{name:"string",types:["text"]}],returnType:"text",description:"Convert a string to lowercase",category:"String",difficulty:1},upper:{name:"upper",fn:"upper",args:[{name:"string",types:["text"]}],returnType:"text",description:"Convert a string to uppercase",category:"String",difficulty:1},repeat:{name:"repeat",fn:"repeat",args:[{name:"string",types:["text"]},{name:"times",types:["number"]}],returnType:"text",description:"Repeat a string",category:"String",difficulty:1},format:{name:"format",fn:"format",args:[{name:"value",types:["any"]}],returnType:"text",description:"Format a value to string",category:"String",difficulty:1},toNumber:{name:"toNumber",fn:"toNumber",args:[{name:"value",types:["any"]}],returnType:"number",description:"Convert a value to a number",category:"Number",difficulty:1},now:{name:"now",fn:"now",args:[],returnType:"date",description:"Get the current date",category:"Date",difficulty:1},minute:{name:"minute",fn:"minute",args:[{name:"date",types:["date"]}],returnType:"number",description:"Get the minutes of a date",category:"Date",difficulty:1},hour:{name:"hour",fn:"hour",args:[{name:"date",types:["date"]}],returnType:"number",description:"Get the hours of a date",category:"Date",difficulty:1},day:{name:"day",fn:"day",args:[{name:"date",types:["date"]}],returnType:"number",description:"Get the day of a date",category:"Date",difficulty:1},date:{name:"date",fn:"date",args:[{name:"date",types:["date"]}],returnType:"number",description:"Get the date of a date",category:"Date",difficulty:1},week:{name:"week",fn:"week",args:[{name:"date",types:["date"]}],returnType:"number",description:"Get the week of a date",category:"Date",difficulty:1},month:{name:"month",fn:"month",args:[{name:"date",types:["date"]}],returnType:"number",description:"Get the month of a date",category:"Date",difficulty:1},year:{name:"year",fn:"year",args:[{name:"date",types:["date"]}],returnType:"number",description:"Get the year of a date",category:"Date",difficulty:1},pad:{name:"pad",fn:"pad",args:[{name:"number",types:["number"]},{name:"length",types:["number"]},{name:"text",types:["text"]}],returnType:"text",description:"Pad a number with text",category:"String",difficulty:1},range:{name:"range",fn:"range",args:[{name:"numbers",types:["number-multi"]}],returnType:"number",description:"Get the difference between the largest and smallest from a list of numbers",category:"List",difficulty:1},latest:{name:"latest",fn:"latest",args:[{name:"dates",types:["date-multi"]}],returnType:"date",description:"Get the latest date of a list of dates",category:"Date",difficulty:1},earliest:{name:"earliest",fn:"earliest",args:[{name:"dates",types:["date-multi"]}],returnType:"date",description:"Get the earliest date of a list of dates",category:"Date",difficulty:1},dateRange:{name:"dateRange",fn:"dateRange",args:[{name:"dates",types:["date-multi"]},{name:"type",types:["text"]}],returnType:"number",description:"Get the date range of a list of dates",category:"Date",difficulty:1},dateAdd:{name:"dateAdd",fn:"dateAdd",args:[{name:"date",types:["date"]},{name:"amount",types:["number"]},{name:"type",types:["text"]}],returnType:"date",description:"Add an amount to a date",category:"Date",difficulty:2},dateSubtract:{name:"dateSubtract",fn:"dateSubtract",args:[{name:"date",types:["date"]},{name:"amount",types:["number"]},{name:"type",types:["text"]}],description:"Subtract an amount from a date",category:"Date",difficulty:2},dateBetween:{name:"dateBetween",fn:"dateBetween",args:[{name:"date1",types:["date"]},{name:"date2",types:["date"]},{name:"type",types:["text"]}],returnType:"number",description:"Get the difference between two dates",category:"Date",difficulty:2},spaceItems:{name:"spaceItems",fn:"spaceItems",args:[{name:"path",types:["text"]}],returnType:"link-multi",description:"Get the items inside of a path",category:"Path",difficulty:2},spaces:{name:"spaces",fn:"spaces",args:[{name:"path",types:["text"]}],returnType:"link-multi",description:"Get the spaces the path is inside of",category:"Path",difficulty:2},timeStamp:{name:"timeStamp",fn:"timeStamp",args:[{name:"date",types:["date"]}],returnType:"number",description:"Get the timestamp of a date",category:"Date",difficulty:1},at:{name:"at",fn:"at",args:[{name:"list",types:["any-list"]},{name:"index",types:["number"]}],returnType:"any",description:"Get an element at a specific index",category:"List",difficulty:2},first:{name:"first",fn:"first",args:[{name:"list",types:["any-multi"]}],returnType:"any",description:"Get the first element of a list",category:"List",difficulty:1},last:{name:"last",fn:"last",args:[{name:"list",types:["any-multi"]}],returnType:"any",description:"Get the last element of a list",category:"List",difficulty:1},concat:{name:"concat",fn:"concat",args:[{name:"list 1",types:["any-multi"]},{name:"list 2",types:["any-multi"]}],returnType:"any-multi",description:"Concatenate two lists",category:"List",difficulty:1},sort:{name:"sort",fn:"sort",args:[{name:"list",types:["any-multi"]}],returnType:"any-multi",description:"Sort a list",category:"List",difficulty:1},reverse:{name:"reverse",fn:"reverse",args:[{name:"list",types:["any-multi"]}],returnType:"any-multi",description:"Reverse a list",category:"List",difficulty:1},join:{name:"join",fn:"join",args:[{name:"list",types:["text-multi"]},{name:"separator",types:["text"]}],returnType:"text",description:"Turn a list into text separator",category:"List",difficulty:1},includes:{name:"includes",fn:"includes",args:[{name:"list",types:["any-multi"]},{name:"value",types:["any"]}],returnType:"boolean",description:"Check if a list includes a value",category:"List",difficulty:1},split:{name:"split",fn:"split",args:[{name:"string",types:["text"]},{name:"separator",types:["text"]}],returnType:"text-multi",description:"Split text into a list using a separator",category:"String",difficulty:1},formatDate:{name:"formatDate",fn:"formatDate",args:[{name:"date",types:["date"]},{name:"format",types:["text"]}],returnType:"text",description:"Format a date into text",category:"Date",difficulty:2},parseDate:{name:"parseDate",fn:"parseDate",args:[{name:"date",types:["text"]}],returnType:"date",description:"Transform date from text",category:"Date",difficulty:1},find:{name:"find",fn:"find",args:[{name:"list",types:["any-multi"]},{name:"condition",types:["boolean"]}],returnType:"any",description:"Find an element in a list",category:"List",difficulty:2},findIndex:{name:"findIndex",fn:"findIndex",args:[{name:"list",types:["any-multi"]},{name:"condition",types:["boolean"]}],returnType:"number",description:"Find the index of an element in a list",category:"List",difficulty:2},filter:{name:"filter",fn:"filter",args:[{name:"list",types:["any-multi"]},{name:"condition",types:["boolean"]}],returnType:"any-multi",description:"Filter a list based on a condition",category:"List",difficulty:2},map:{name:"map",fn:"map",args:[{name:"list",types:["any-multi"]},{name:"formula",types:["any"]}],returnType:"any-multi",description:"Change all the values in a list based on a formula",category:"List",difficulty:2},some:{name:"some",fn:"some",args:[{name:"list",types:["any-multi"]},{name:"condition",types:["boolean"]}],returnType:"boolean",description:"Check if some elements in a list are true",category:"List",difficulty:2},every:{name:"every",fn:"every",args:[{name:"list",types:["any-multi"]},{name:"condition",types:["boolean"]}],returnType:"boolean",description:"Check if every element in a list is true",category:"List",difficulty:2},flat:{name:"flat",fn:"flat",args:[{name:"list",types:["any-multi"]}],returnType:"any-multi",description:"Flatten a list of lists into a single list",category:"List",difficulty:2},path:{name:"path",fn:"path",args:[{name:"path",types:["text"]}],returnType:"link",description:"Get the path object of a path",category:"Path",difficulty:2},let:{name:"let",fn:"let",args:[{name:"variable",types:["text"]},{name:"value",types:["any"]},{name:"formula",types:["any"]}],returnType:"any",description:"Define a variable to use in a formula",category:"Variable",difficulty:3},lets:{name:"lets",fn:"lets",args:[{name:"variable",types:["text"]},{name:"value",types:["any"]},{name:"...",types:[]},{name:"formula",types:["any"]}],returnType:"any",description:"Define multiple variables to use in a formula",category:"Variable",difficulty:3}},oye=(e,t,r)=>{let n=e[0];if(!n.isSymbolNode||e.length!==3)return"";let i=n.name,a=e[1];return t.evaluate(`${i} = ${a.toString()}`,r),e[2].compile().evaluate(r)};oye.rawArgs=!0;var sye=(e,t,r)=>{if(e.length%2!==1)return"";for(let i=0;i{if(e.length!==1)return"";let n=e.map(function(o){return o.compile().evaluate(r)}),i=n[0];return typeof n[0]!="string"&&n[0].path&&(i=n[0].path),r.get("$paths").get(i)};lye.rawArgs=!0;var uye=(e,t,r)=>{if(e.length!==1)return"";let n=e.map(function(l){return l.compile().evaluate(r)}),i=n[0];typeof n[0]!="string"&&n[0].path&&(i=n[0].path);let a=r.get("$items").get(i),o=r.get("$paths");return[...a??[]].map(l=>o.get(l))};uye.rawArgs=!0;var cye=(e,t,r)=>{if(e.length!==1)return"";let n=e.map(function(l){return l.compile().evaluate(r)}),i=n[0];typeof n[0]!="string"&&n[0].path&&(i=n[0].path);let a=r.get("$spaces").get(i),o=r.get("$paths");return[...a??[]].map(l=>o.get(l))};cye.rawArgs=!0;var fye=(e,t,r)=>r?.get("$current");fye.rawArgs=!0;var dye=(e,t,r)=>r?.get("$index");dye.rawArgs=!0;var pye=(e,t,r)=>{if(e.length!==2)return"";let n=e[0].compile().evaluate?e[0].compile().evaluate(r):e[0];return Array.isArray(n)?n.find((i,a)=>{r.set("$current",i),r.set("$index",a),t.evaluate("current = _current(); index = _index()",r);let o=e[1].compile().evaluate?e[1].compile().evaluate(r):e[1];return i===o})??"":""};pye.rawArgs=!0;var mye=(e,t,r)=>{if(e.length!==2)return"";let n=e[0].compile().evaluate?e[0].compile().evaluate(r):e[0];return Array.isArray(n)?n.findIndex((i,a)=>{r.set("$current",i),r.set("$index",a),t.evaluate("current = _current(); index = _index()",r);let o=e[1].compile().evaluate?e[1].compile().evaluate(r):e[1];return i===o}):""};mye.rawArgs=!0;var hye=(e,t,r)=>{if(e.length!==2)return"";let n=e[0].compile().evaluate?e[0].compile().evaluate(r):e[0];return Array.isArray(n)?n.filter((i,a)=>(r.set("$current",i),r.set("$index",a),t.evaluate("current = _current(); index = _index()",r),e[1].compile().evaluate(r))):""};hye.rawArgs=!0;var Aye=(e,t,r)=>{if(e.length!==2)return"";let n=e[0].compile().evaluate?e[0].compile().evaluate(r):e[0];return Array.isArray(n)?n.map((i,a)=>(r.set("$current",i),r.set("$index",a),t.evaluate("current = _current(); index = _index()",r),e[1].compile().evaluate(r))):[]};Aye.rawArgs=!0;var gye=(e,t,r)=>{if(e.length!==2)return"";let n=e[0].compile().evaluate?e[0].compile().evaluate(r):e[0];return Array.isArray(n)?n.some((i,a)=>(r.set("$current",i),r.set("$index",a),t.evaluate("current = _current(); index = _index()",r),e[1].compile().evaluate(r))):""};gye.rawArgs=!0;var vye=(e,t,r)=>{if(e.length!==2)return"";let n=e[0].compile().evaluate?e[0].compile().evaluate(r):e[0];return Array.isArray(n)?n.every((i,a)=>(r.set("$current",i),r.set("$index",a),t.evaluate("current = _current(); index = _index()",r),e[1].compile().evaluate(r))):""};vye.rawArgs=!0;var yye=(e,t,r)=>{if(e.length!==1)return"";let n=e[0].compile().evaluate?e[0].compile().evaluate(r):e[0];return Array.isArray(n)?n.flat():""};yye.rawArgs=!0;var bye=(e,t,r)=>{if(e.length!==1)return"";let n=e.map(function(o){return o.compile().evaluate(r)}),i=r.get("$properties")?.[n[0]]?.type,a=la(i,r.get(n[0]));return(i=="file"||i=="link"||i=="context")&&(i.includes("multi")?a=sr(a).map(o=>r.get("$paths").get(o)??o):a=r.get("$paths").get(a)??a),i=="date"&&(a=Yi(a)),a??""};bye.rawArgs=!0;var xye=(e,t,r)=>{if((e.length-1)%2!==0)return"";for(let n=0;n{if(e.length<1||e.length>2)return"";let n=e[0].compile().evaluate(r);n instanceof Date||(n=new Date(n));let i=e[1]?.compile().evaluate(r);return i?.length>0?Za(n,i):Za(n,r.get("$settings")?.dateFormat??"yyyy-MM-dd")};wye.rawArgs=!0;var Hu=e=>typeof e=="string"||e instanceof String?e:e instanceof Date?Za(e,"yyyy-MM-dd"):typeof e=="number"?e.toFixed(0):e?.path?e.path:"",dC={prop:bye,_current:fye,_index:dye,slice:(e,t,r)=>(e=Hu(e),e.slice(t,r)),if:(e,t,r)=>e===!0?t:r,ifs:xye,empty:e=>e.length!==1?"":Array.isArray(e[0])?e[0].length===0:e[0]===""?"true":"false",length:e=>e.length,values:e=>e.flat().length,uniques:e=>kr(e.flat()).length,substring:(e,t,r)=>(e=Hu(e),r?e.substring(t,r):e.substring(t)),startsWith:(e,t)=>(e=Hu(e),t=Hu(t),e.startsWith(t)),contains:(e,t)=>(e=Hu(e),t=Hu(t),e.includes(t)),test:(e,t)=>(e=Hu(e),new RegExp(t).test(e)),match:(e,t)=>(e=Hu(e),e.match(new RegExp(t))),replace:(e,t,r)=>(e=Hu(e),e.replace(new RegExp(t),r)),replaceAll:(e,t,r)=>(e=Hu(e),t=Hu(t),r=Hu(r),e.replace(new RegExp(t,"g"),r)),lower:e=>(e=Hu(e),e.toLowerCase()),upper:e=>(e=Hu(e),e.toUpperCase()),repeat:(e,t)=>e.repeat(t),format:Hu,toNumber:e=>e instanceof Date?e.getTime():typeof e=="string"?parseFloat(e):e,now:()=>new Date,minute:e=>e.getMinutes(),hour:e=>e.getHours(),day:e=>e.getDay(),date:e=>e.getDate(),week:e=>Za(e,"w"),month:e=>e.getMonth()+1,year:e=>e.getFullYear(),pad:(e,t,r)=>e.padStart(t,r),range:e=>Math.max(...e)-Math.min(...e),latest:e=>new Date(Math.max(...e.map(t=>t.getTime()))),earliest:e=>new Date(Math.min(...e.map(t=>t.getTime()))),dateRange:(e,t)=>{let r=Math.abs(Math.max(...e.map(n=>n.getTime()))-Math.min(...e.map(n=>n.getTime())));return t.startsWith("day")?r/(1e3*60*60*24):t.startsWith("month")?r/(1e3*60*60*24*30):t.startsWith("year")?r/(1e3*60*60*24*365):t.startsWith("hour")?r/(1e3*60*60):t.startsWith("minute")?r/(1e3*60):t.startsWith("second")?r/1e3:t.startsWith("week")?r/(1e3*60*60*24*7):t.startsWith("quarter")?r/(1e3*60*60*24*30*3):r/(1e3*60*60*24)},dateAdd:(e,t,r)=>(r.startsWith("day")&&e.setDate(e.getDate()+t),r.startsWith("month")&&e.setMonth(e.getMonth()+t),r.startsWith("year")&&e.setFullYear(e.getFullYear()+t),r.startsWith("quarter")&&e.setMonth(e.getMonth()+t*3),r.startsWith("week")&&e.setDate(e.getDate()+t*7),r.startsWith("hour")&&e.setHours(e.getHours()+t),r.startsWith("minute")&&e.setMinutes(e.getMinutes()+t),r.startsWith("second")&&e.setSeconds(e.getSeconds()+t),e),dateSubtract:(e,t,r)=>(r.startsWith("day")&&e.setDate(e.getDate()-t),r.startsWith("month")&&e.setMonth(e.getMonth()-t),r.startsWith("year")&&e.setFullYear(e.getFullYear()-t),r.startsWith("quarter")&&e.setMonth(e.getMonth()-t*3),r.startsWith("week")&&e.setDate(e.getDate()-t*7),r.startsWith("hour")&&e.setHours(e.getHours()-t),r.startsWith("minute")&&e.setMinutes(e.getMinutes()-t),r.startsWith("second")&&e.setSeconds(e.getSeconds()-t),e),dateBetween:(e,t,r)=>{let o=Math.abs(t.getTime()-e.getTime());switch(r){case"days":return Math.round(o/864e5);case"months":return Math.round(o/2592e6);case"years":return Math.round(o/31536e6);case"hours":return Math.round(o/(60*60*1e3));case"minutes":return Math.round(o/(60*1e3));case"seconds":return Math.round(o/1e3);case"weeks":return Math.round(o/(864e5*7));case"quarters":return Math.round(o/(2592e6*3));default:return Math.round(o/864e5)}},style:(e,t)=>e,timeStamp:e=>e.getTime(),at:(e,t)=>e[t],first:e=>e[0],last:e=>e[e.length-1],concat:(e,t)=>e.concat(t),sort:e=>e.sort((t,r)=>r-t),reverse:e=>e.reverse(),join:(e,t)=>e.join(t),includes:(e,t)=>e.includes(t),split:(e,t)=>e.split(t),formatDate:wye,parseDate:e=>Yi(e),find:pye,findIndex:mye,filter:hye,map:Aye,some:gye,every:vye,flat:yye,path:lye,let:oye,lets:sye,spaceItems:uye,spaces:cye};var Pd=(e,t,r,n,i,a,o,s)=>{if(!n)return"";let l=new Map;Object.keys(a).forEach(c=>l.set(c,a[c])),l.set("$properties",i),l.set("$paths",t),l.set("$items",r.invMap),l.set("$spaces",r.map),o&&l.set("$current",o);let u;try{if(e.evaluate("current = _current()",l),u=e.evaluate(n,l),u=Ri("",u),typeof u!="string"&&s)throw u}catch(c){if(u="",s)throw c;console.log(n,c)}return u};var QB=(e,t)=>t.startsWith(e),PV=(e,t)=>(r,n)=>{let i=t?r:n,a=t?n:r;return e(i)e(a)?1:0},Sye=(e,t)=>(r,n)=>{let i=t?r:n,a=t?n:r;return i[e]a[e]?1:0},Eye=(e,t)=>(r,n)=>{let i=t?r:n,a=t?n:r;return i[e]?.toLowerCase().localeCompare(a[e]?.toLowerCase())},kye=(e,t)=>(r,n)=>{let i=t?r:n,a=t?n:r;return+i[e]-+a[e]};var Gr=e=>e.primaryInteractionType()==0,jc=e=>e.getScreenType()==0;var Jm=e=>{try{return e?.replace(/'/g,"''")}catch(t){return console.log(t,e),""}},ZA=e=>e?.charAt(0)=="_"?ZA(e.substring(1)):e?.replace(/"/g,""),eh=e=>e?.replace(/[^a-z0-9+]+/gi,""),eVe=/^[+\$#^]+/,Cye=/[\/\?<>\\:\*\|":]/g,Dye=/[\x00-\x1f\x80-\x9f]/g,Oye=/^\.+$/,Mye=/^(con|prn|aux|nul|com[0-9]|lpt[0-9])(\..*)?$/i,jye=e=>{let t="";return e.replace(eVe,t).replace(Cye,t).replace(Dye,t).replace(Oye,t).replace(Mye,t)},ov=e=>{let t="";return e.replace(Cye,t).replace(Dye,t).replace(Oye,t).replace(Mye,t)};var YB=(e,t,r)=>e.spacesIndex.has(t)?e.spaceManager.deleteTag(Af(e,e.spacesIndex.get(t).space),r):e.spaceManager.deleteTag(t,r),th=(e,t,r)=>e.spacesIndex.has(t)?e.spaceManager.addTag(Af(e,e.spacesIndex.get(t).space),r):e.spaceManager.addTag(t,r),IV=(e,t)=>e.spaceManager.createSpace(zx(t),e.settings.spacesFolder,null);var ZB=async(e,t)=>{let r=e.spaceManager.uriByString(t);if(r.refType=="context"){let n=e.contextsIndex.get(r.basePath)?.schemas.find(i=>i.id==r.ref);if(n)return{id:n.id,name:n.name,type:"context",path:r.basePath}}if(r.refType=="frame")return e.spaceManager.readFrame(r.basePath,r.ref).then(n=>{let i=n?.schema;if(i){let a=Ao(i);return{id:i.id,name:a.name,sticker:a.def?.icon,type:"frame",frameType:a.type,path:r.basePath}}return null});if(r.refType=="action"){let n=e.actionsIndex.get(r.path)?.find(i=>i.schema.id==r.ref)?.schema;if(n)return{id:n.id,name:n.name,sticker:n.def?.icon,type:"action",path:r.basePath}}return null},tVe=e=>({field:Bs(e?.field??"rank"),asc:XE(e?.asc),group:XE(e?.group),recursive:XE(e?.recursive)}),rVe=e=>e=="fileprop"?"file":e=="filemeta"?"path":Bs(e),nVe=e=>({type:rVe(e.type),fType:Bs(e.fType),field:Bs(e.field),fn:Bs(e.fn),value:Bs(e.value)}),iVe=e=>({type:bJ(e.type,["any","all"],"any"),trueFalse:!!e.truefalse,filters:dl(e.filters).map(t=>nVe(t))}),pC=(e,t)=>({sort:tVe(e[Ik]),recursive:Bs(e[sj]),contexts:dl(e[Nk]),links:dl(e[Pk]),filters:dl(e[_k]).map(r=>iVe(r)),template:Bs(e[Tk]),templateName:Bs(e[Fk]),defaultSticker:Bs(e.defaultSticker),readMode:XE(e.readMode)}),Nye=(e,t,r,n,i,a,o)=>({id:i?i+"/"+e.path:e.path,parentId:i,depth:n,index:0,space:a,path:e.path,item:e,rank:e?.rank,collapsed:t,sortable:r,childrenCount:o,type:"space"}),XB=(e,t,r,n,i,a,o,s,l,u)=>({item:t,space:r,id:u+"/"+t.path,parentId:u,depth:i,path:n,index:a,collapsed:o,sortable:s,childrenCount:l,rank:t.rank,type:"file"}),VS=(e,t,r)=>(t??(Gr(e.ui)?40:29))+(r?10:0),BV=e=>(t,r)=>{if(e.field=="rank")return t.rank-r.rank;let n=[];if(e.group&&n.push(Sye("type",!1)),e.field=="number")n.push(kye("name",e.asc));else if(e.field=="name")n.push(Eye(e.field,e.asc));else if(e.field.startsWith("props")){let i=e.field.split(".")[1],a=o=>o?.metadata?.property?.[i];n.push(PV(a,e.asc))}else{let i=a=>a?.metadata?.file?.[e.field];n.push(PV(i,e.asc))}return n.reduce((i,a)=>i==0?a(t,r):i,0)},GS=async(e,t,r,n)=>{let i=e.spacesIndex.get(n);if(!i)return;let a=r;e.addToContextStateQueue(()=>Hoe(e.spaceManager,[t],a,i.space).then(o=>{let s=[...e.spacesMap.getInverse(i.path)].map(l=>e.reloadPath(l));return Promise.all(s)}).then(o=>e.dispatchEvent("spaceStateUpdated",{path:i.path})))},RV=async(e,t,r,n,i)=>{if(!t)return;let a=e.pathsIndex.get(t.path);if(!a)return;let o=r=="/"?a.name:r+"/"+a.name;if(await e.spaceManager.pathExists(o)){e.ui.notify(H.notice.fileExists);return}i?await e.spaceManager.copyPath(t.path,r):await e.spaceManager.renamePath(t.path,Mm(t.path,r)),GS(e,o,n,r)},Tye=(e,t,r)=>{mC(e,t,"template",r)},Fye=(e,t,r)=>{mC(e,t,"templateName",r)};var kf=async(e,t,r)=>{let n=e.spacesIndex.get(t),i;if(n){if(!e.pathsIndex.has(t))return await e.reloadSpace(n.space);if(r)i=await du(e,n.space,r);else return}else{let a=e.spaceManager.spaceInfoForPath(t);if(a.readOnly)return await e.reloadSpace(a);await e.spaceManager.createSpace(a.name,e.spaceManager.parentPathForPath(a.path),r),r?(await du(e,a,r),i=await e.reloadSpace(a,r)):i=await e.reloadSpace(a)}return e.onSpaceDefinitionChanged(i,null),i},mC=async(e,t,r,n)=>{e.spaceManager.saveSpace(t,a=>({...a,[r]:n}));let i=e.spacesIndex.get(t);await e.updateSpaceMetadata(t,{...i.metadata,[r]:n})},aVe=async(e,t,r)=>{e.spaceManager.saveSpace(t,n=>n,r)},du=async(e,t,r)=>(await e.spaceManager.saveSpace(t.path,n=>({...n,...r})),e.updateSpaceMetadata(t.path,r)),QS=async(e,t,r,n)=>t.type=="tag"?th(e,r,t.name):rh(e,t,r,n);var YS=async(e,t)=>{let r=null;return e.settings.newFileLocation=="folder"?r=e.spacesIndex.get(e.settings.newFileFolderPath):e.settings.newFileLocation=="current"&&t&&t.type=="space"?r=e.spacesIndex.get(t.path):t&&(r=e.spacesIndex.get(t.parent)),r||(r=e.spacesIndex.get("/")),r},rh=async(e,t,r,n)=>{if(r==t.path)return;let i=dl(t.metadata.links)??[];i.find(o=>o==r)||i.push(r),await du(e,t.space,{...t.metadata,links:i}),await e.reloadPath(r,!0).then(o=>e.dispatchEvent("pathStateUpdated",{path:r})),GS(e,r,n,t.path)},_ye=async(e,t)=>{let r=e.spacesIndex.get(t);!r||(r.type=="tag"?e.onTagDeleted(r.name):r.type=="folder"&&await F1(e,r.path))},Id=(e,t,r)=>{let n=e.spacesIndex.get(t);n&&du(e,n.space,{...n.metadata,sort:r})},Af=(e,t)=>e.settings.enableFolderNote?t.notePath:t.defPath,sv=async(e,t,r)=>{let n=e.spacesIndex.get(r);!n||(await e.spaceManager.saveTemplate(t,n.path),e.ui.notify(H.notice.templateSaved+n.name))},lv=async(e,t,r)=>{let n=e.spacesIndex.get(t);!n||(n.type=="tag"?r.forEach(i=>YB(e,i,n.name)):(n.type=="folder"||n.type=="vault")&&await mC(e,n.path,"links",n.metadata.links.filter(i=>!r.some(a=>a==i))))},$V=async(e,t,r,n)=>{let i;try{if(t.metadata.templateName?.length>0){let o=Pd(e.formulaContext,e.pathsIndex,e.spacesMap,t.metadata.templateName,{},{},e.pathsIndex.get(t.path));o?.length>0&&(i=o)}}catch{}if(!await e.spaceManager.pathExists(`${t.path}/${e.settings.spaceSubFolder}/templates/${r}`)){za(e,t,"md",null,!1,null,n);return}let a=await e.spaceManager.copyPath(`${t.path}/${e.settings.spaceSubFolder}/templates/${r}`,t.path,i);a&&e.ui.openPath(a,n)},za=async(e,t,r,n,i,a,o)=>{let s;return t.type=="tag"?(s=await e.spaceManager.createItemAtPath("/",r,n,a),await e.spaceManager.addTag(s,t.name)):s=await e.spaceManager.createItemAtPath(t.path,r,n,a),i||e.ui.openPath(s,o),s};var Pye=async(e,t,r)=>{let n=(i,a,o)=>{let s={...a,name:ZA(a.name)},l=i;if(s.name=="")return e.ui.notify(H.notice.noPropertyName),!1;if(!o&&l.cols.find(d=>d.name.toLowerCase()==s.name.toLowerCase())||o&&o.name!=s.name&&l.cols.find(d=>d.name.toLowerCase()==s.name.toLowerCase()))return e.ui.notify(H.notice.duplicatePropertyName),!1;let u=o?l.cols.findIndex(d=>d.name==o.name):-1,c=u==-1?[...l.cols,s]:l.cols.map((d,p)=>p==u?s:d),f={...l,cols:c??[]};return e.spaceManager.saveFrame(t,f),!0};if(e.spacesIndex.has(t)){let i=await e.spaceManager.readFrame(t,"main");n(i,{...r,schemaId:"main"})}else e.spaceManager.saveProperties(t,{[r.name]:Bx(r.type)})},pi=(e,t,r)=>e.spacesIndex.has(t)?aVe(e,t,r):e.spaceManager.saveProperties(t,r),qV=(e,t,r,n)=>{if(e.spacesIndex.has(t)){e.spaceManager.renameProperty(Af(e,e.spacesIndex.get(t).space),r,n);return}e.spaceManager.renameProperty(t,r,n)},Iye=(e,t,r)=>{if(e.spacesIndex.has(t)){e.spaceManager.deleteProperty(Af(e,e.spacesIndex.get(t).space),r);return}e.spaceManager.deleteProperty(t,r)};var hC=e=>{let t=new Map;e.filter(o=>o.type=="fileprop"||o.name.startsWith("tags")).forEach(o=>{let{value:s}=pr(o.value,o.type),l=[];try{let c=_d(s).filter(f=>f.type=="FunctionNode").filter(f=>f.fn.name=="prop"&&f.args[0].type=="ConstantNode").map(f=>f.args[0]?.value);l.push(...c)}catch{}let u=o.name;t.has(u)||t.set(u,new Set);for(let c of l){let f=c;f!==u&&t.get(u).add(f)}});let r=new Set,n=[],i=new Set,a=o=>{if(i.has(o))throw new Error("Circular dependency detected");if(!r.has(o)){i.add(o);let s=t.get(o)||new Set;for(let l of s)a(l);r.add(o),i.delete(o),n.push(o)}};for(let o of e)r.has(o.name)||a(o.name);return n},nh=(e,t,r,n,i,a,o)=>{if(!n)return{};let s=o??hC(i),l=t.get(n[mt])?.metadata?.property??{},u=Object.keys(l).filter(d=>i.some(p=>p.name==d)&&d!=mt).reduce((d,p)=>({...d,[p]:Ri(p,l[p])}),{}),c=s.map(d=>i.find(p=>p.name==d)).filter(d=>d&&(d.type=="fileprop"||d.name=="tags")),f=i.reduce((d,p)=>({...d,[p.name]:p}),{});return{...n,...u,...c.reduce((d,p)=>{let{value:h}=pr(p.value,p.type);return{...d,[p.name]:Pd(e,t,r,h,f,{...n,...d},a)}},{})}};var KB=async(e,t,r)=>{let n=e;if(t.prevState[n.id]&&n.node.type!="content"){let a=!1;if(n.node.type=="slides"||n.node.type=="slide"||n.node.type=="delta")a=!1;else{let o=(n.execPropsOptions.children??[]).some(c=>Object.keys(t.newState).includes(c)),s=Object.keys(t.newState[n.id]?.props??{}).every(c=>t.newState[n.id]?.props[c]==t.prevState[n.id]?.props[c]),l=Object.keys(t.newState[n.id]?.styles??{}).every(c=>t.newState[n.id]?.styles[c]==t.prevState[n.id]?.styles[c]),u=n.execPropsOptions.deps.every(c=>c[0]=="$api"||t.newState[c[0]]?.[c[1]]?.[c[2]]===void 0?!0:t.newState[c[0]]?.[c[1]]?.[c[2]]===t.prevState[c[0]]?.[c[1]]?.[c[2]]);s&&l&&u&&!o&&(a=!0)}if(a)return{id:r.runID,root:r.root,exec:n,state:t.state,slides:t.slides,newState:t.newState,prevState:t.prevState,contexts:r.contexts}}let i=await oVe(n,t,r.contexts,r.api);if(n.node.type=="list"){let a=0;n.children=dl(i.state[n.id].props.value).flatMap((o,s)=>n.execPropsOptions.template.map(l=>{let[u,c]=Ute({...l,node:{...l.node,props:{...l.node.props,_index:`${s}`,value:`${n.id}.props.value[${s}]`}}},a);return a=c,Dk(u)}))}typeof i.state[n.id]?.actions?.onRun=="function"&&i.state[n.id].actions?.onRun(null,null,i,a=>{r.saveState(a,{state:i.state,slides:i.slides,root:r.root,exec:r.exec,id:r.runID,contexts:r.contexts})},r.api),n.children=[...n.children.filter(a=>a.node.type=="slides"),...n.children.filter(a=>a.node.type!="slides")];for(let a=0;a[{state:l.state,newState:l.newState,slides:l.slides,prevState:l.prevState},l.exec]);if(i=o,n.children[a]=s,s.node.type=="slides"){let l=o.state[s.id].props.value,u=o.state[s.node.parentId]?.props[l],c;r.selectedSlide&&(c=s.children.find(f=>f.id==r.selectedSlide)),u!==null&&!c&&(c=s.children.find(f=>o.state[f.id].props.value==u)),c&&c.children.forEach(f=>{i.newState[f.node.ref]||(i.newState[f.node.ref]={props:{},styles:{},actions:{}}),f.node.ref==n.id?(i.state[f.node.ref].props={...i.state[f.node.ref].props,...i.state[f.node.id].props},i.state[f.node.ref].styles={...i.state[f.node.ref].styles,...i.state[f.node.id].styles},i.state[f.node.ref].actions={...i.state[f.node.ref].actions,...i.state[f.node.id].actions}):(i.newState[f.node.ref].props={...i.newState[f.node.ref].props,...i.state[f.node.id].props},i.newState[f.node.ref].styles={...i.newState[f.node.ref].styles,...i.state[f.node.id].styles},i.newState[f.node.ref].actions={...i.newState[f.node.ref].actions,...i.state[f.node.id].actions})})}}return{id:r.runID,root:r.root,exec:n,state:i.state,slides:i.slides,newState:i.newState,prevState:i.prevState,contexts:r.contexts}},oVe=async(e,t,r,n)=>{let i=await sVe(e,t,r,n),a=Bye(e.node,"styles",e.execStyles,i);return Bye(e.node,"actions",e.execActions,a)},ZS=(e,t)=>((typeof e=="string"||e instanceof String?e.includes(` -`):!1)?new Function(`with(this) { ${e} }`):new Function(`with(this) { return ${e}; }`)).call(t),sVe=async(e,t,r,n)=>{let{id:i}=e.node,a=e.execProps??{},o=t.state;o[i]={props:t.state[i]?.props??{},actions:t.state[i]?.actions??{},styles:t.state[i]?.styles??{}},o.$contexts=r,o.$api=n;for(let{name:s,isConst:l}of e.execPropsOptions.props)try{let u;s in(t.newState?.[i]?.props||{})&&l?u=t.newState[i].props[s]:u=a[s]?.call(o),u!==null?(o[i].props[s]=u,t.state[i].props[s]=u,t.newState&&(t.newState[i]=t.newState[i]??{props:{},styles:{},actions:{}},t.newState[i].props[s]=u)):(delete o[i].props[s],delete t.state[i].props[s],t.newState?.[i]&&delete t.newState[i].props[s])}catch(u){console.log(s,u)}return t};function Bye(e,t,r,n){let{id:i}=e;for(let a of Object.keys(r)){let o;try{a in(n.newState?.[i]?.[t]||{})?o=n.newState[i][t][a]:o=r[a]?.call(n.state),o!==null?n.state[e.id][t][a]=o:delete n.state[e.id][t][a]}catch(s){console.log(s,a)}}return n}var LV=(e,t)=>e.skipFolderNames.some(r=>t.endsWith(r))||t.endsWith("/"+e.spaceSubFolder)||t==e.spaceSubFolder||t.split("/").pop()==e.spaceSubFolder||t.startsWith(e.spacesFolder+"/#")||t.startsWith(e.spacesFolder+"/$")||e.skipFolders.some(r=>r==t);var AC="templates",gC="kits",vC="actions",yC="waypoints.json",bC=class{constructor(t,r){this.fileSystem=t;this.dataPath=r;this.schemes=["spaces","vault"];this.onFocusesUpdated=()=>{this.spaceManager.onFocusesUpdated()};this.onSpaceUpdated=t=>{t.type=="views.mdb"?this.spaceManager.onSpaceUpdated(t.path,"frame"):t.type=="context.mdb"?this.spaceManager.onSpaceUpdated(t.path,"context"):t.type=="commands.mdb"&&this.spaceManager.onSpaceUpdated(t.path,"action")};this.onCreate=async t=>{t.file.isFolder?this.spaceManager.onSpaceCreated(t.file.path):this.spaceManager.onPathCreated(t.file.path)};this.onDelete=t=>{!t.file||(!t.file.isFolder&&t.file.extension!="mdb"?this.spaceManager.onPathDeleted(t.file.path):t.file.isFolder&&this.spaceManager.onSpaceDeleted(t.file.path))};this.onRename=t=>{!t.file||(!t.file.isFolder&&t.file.extension!="mdb"?this.spaceManager.onPathChanged(t.file.path,t.oldPath):t.file.isFolder&&this.spaceManager.onSpaceRenamed(t.file.path,t.oldPath))};this.authorities=["vault"];t.eventDispatch.addListener("onCreate",this.onCreate,0,this),t.eventDispatch.addListener("onRename",this.onRename,0,this),t.eventDispatch.addListener("onDelete",this.onDelete,0,this),t.eventDispatch.addListener("onFocusesUpdated",this.onFocusesUpdated,0,this),t.eventDispatch.addListener("onSpaceUpdated",this.onSpaceUpdated,0,this),t.eventDispatch.addListener("onCacheUpdated",this.onMetadataChange,0,this)}initiateAdapter(t){this.spaceManager=t}async readTemplates(t){return(await this.childrenForPath(`${t}/${this.spaceManager.superstate.settings.spaceSubFolder}/templates`)).filter(r=>!r.startsWith(".")).map(r=>r.split("/").pop())}async saveTemplate(t,r){return this.copyPath(t,`${r}/${this.spaceManager.superstate.settings.spaceSubFolder}/templates`)}deleteTemplate(t,r){return this.deletePath(`${r}/${this.spaceManager.superstate.settings.spaceSubFolder}/templates/${t}`)}async readFocuses(){return await this.fileSystem.fileExists(this.dataPath)||await this.fileSystem.createFolder(this.dataPath),await this.fileSystem.fileExists(`${this.dataPath}/${yC}`)?this.fileSystem.readTextFromFile(`${this.dataPath}/${yC}`).then(t=>dl(or(t))):[]}async saveFocuses(t){return await this.fileSystem.fileExists(this.dataPath)||await this.fileSystem.createFolder(this.dataPath),this.fileSystem.writeTextToFile(`${this.dataPath}/${yC}`,JSON.stringify(t))}async readTemplate(t){let r=`${this.dataPath}/${AC}/${t}`;if(await this.fileSystem.fileExists(r))return this.fileSystem.readFileFragments({path:`${r}/${this.spaceManager.superstate.settings.spaceSubFolder}/views.mdb`,name:"views",filename:"views.mdb",parent:r,isFolder:!1,extension:"mdb"},"mdbTables")}async readAllKits(){let t=(await this.childrenForPath(`${this.dataPath}/${gC}`)).map(n=>n.split("/").pop());return Promise.all(t.map(async n=>{let i=await this.readKitFrames(n);return{id:n,name:n,colors:{},frames:Object.values(i??{})}}))}async readAllTemplates(){let t=(await this.childrenForPath(`${this.dataPath}/${AC}`)).map(n=>n.split("/").pop()),r={};for(let n of t){let i=await this.readTemplate(n);i&&(r[n]=i)}return r}async readKitFrames(t){return this.fileSystem.readFileFragments({path:`${this.dataPath}/${gC}/${t}/kit.mdb`,name:"kit",filename:"kit.mdb",parent:`${this.dataPath}/${gC}/${t}`,isFolder:!1,extension:"mdb"},"mdbTables")}async saveFrameKit(t,r){let n={path:`${this.dataPath}/${gC}/${r}/kit.mdb`,name:"kit",filename:"kit.mdb",parent:`${this.dataPath}/${gC}/${r}`,isFolder:!1,extension:"mdb"};await this.fileSystem.saveFileFragment(n,"schema",t.schema.id,()=>t.schema),this.fileSystem.saveFileFragment(n,"mdbFrame",t.schema.id,()=>t)}async saveSpaceTemplate(t,r){let n=r;if(await this.fileSystem.fileExists(`${this.dataPath}/${AC}`)){let i=await this.childrenForPath(`${this.dataPath}/${AC}/${r}`);n=Mi(n,i)}await this.fileSystem.newFile(`${this.dataPath}/${AC}/${n}/${this.spaceManager.superstate.settings.spaceSubFolder}`,"view","mdb",t)}async onMetadataChange(t){if(!t.path)return;if(t.path.endsWith(".json")){let n=t.path.split("/").slice(0,-2).join("/");this.spaceManager.onPathPropertyChanged(n);return}let r=this.spaceManager.superstate.pathsIndex.get(t.path);if(r?.metadata.spacePath?.length>0){this.spaceManager.onPathPropertyChanged(r?.metadata.spacePath);return}this.spaceManager.onPathPropertyChanged(t.path)}uriByPath(t){return this.spaceManager.uriByString(t)}allPaths(t){return[...this.fileSystem.allFiles().filter(r=>t?t.some(n=>n=="folder"?r.isFolder:r.extension==n):!0).map(r=>r.path).filter(r=>!LV(this.spaceManager.superstate.settings,r))]}async pathExists(t){return this.fileSystem.fileExists(t)}async createItemAtPath(t,r,n,i){let a=await this.getPathInfo(t);if(!a)await this.fileSystem.createFolder(t);else if(!a?.isFolder){let o=await this.fileSystem.getFile(t);return o?this.fileSystem.newFileFragment(o,r,n,i)?.then(s=>o.path):null}return this.fileSystem.newFile(t,n,r,i).then(o=>o?.path)}async renamePath(t,r){let n=this.uriByPath(t),i=this.uriByPath(r),a=await this.fileSystem.getFile(n.path);if(n.refStr){let o=await this.fileSystem.getFileCacheTypeByRefString(a,n.refStr);return await this.fileSystem.saveFileFragment(a,o,n.refStr,()=>i.refStr),r}return await this.fileSystem.renameFile(t,r)}async deletePath(t){let r=this.uriByPath(t);if(r.refStr){let n=await this.fileSystem.getFile(r.path),i=await this.fileSystem.getFileCacheTypeByRefString(n,r.refStr);return this.fileSystem.deleteFileFragment(n,i,r.refStr)}return this.fileSystem.deleteFile(t)}async getPathInfo(t){let r=this.uriByPath(t),n=await this.fileSystem.getFile(r.path);if(r.refStr){let i=this.fileSystem.getFileCacheTypeByRefString(n,r.refStr)}return n}keysForCacheType(t){return this.fileSystem.keysForCacheType(t)}async readPathCache(t){let r=this.uriByPath(t);if(r.scheme=="spaces"){if(r.authority.charAt(0)=="$"){let n=Object.keys(Im).find(i=>i==r.authority.slice(1));if(n)return{file:null,metadata:null,label:{name:Im[n].name,sticker:Im[n].icon,color:""},readOnly:!1,type:"space",parent:"",tags:[]}}if(r.authority.charAt(0)=="#")return{file:null,metadata:null,label:{name:r.authority,sticker:"",color:""},type:"space",parent:"",tags:[],readOnly:!1}}return t=="/"?{file:{name:this.spaceManager.superstate.settings.systemName,path:"/",isFolder:!0},metadata:{},label:{name:this.spaceManager.superstate.settings.systemName,sticker:"",color:""},type:"space",subtype:"folder",parent:"",tags:[],readOnly:!1}:this.fileSystem.getFileCache(t)}async readPath(t){let r=this.uriByPath(t),n=await this.fileSystem.getFile(r.path);if(r.refStr){let i=this.fileSystem.getFileCacheTypeByRefString(n,r.refStr);this.fileSystem.getFileContent(n,i,r.refStr)}return this.fileSystem.readTextFromFile(t)}async copyPath(t,r,n){let i=this.uriByPath(t),a=await this.fileSystem.getFile(i.path);return this.fileSystem.copyFile(a.path,r,n)}async writeToPath(t,r,n){let i=this.uriByPath(t),a=await this.fileSystem.getFile(i.path);if(i.refStr){let o=this.fileSystem.getFileCacheTypeByRefString(a,i.refStr);this.fileSystem.saveFileFragment(a,o,i.refStr,()=>r)}return n?this.fileSystem.writeBinaryToFile(t,r):this.fileSystem.writeTextToFile(t,r)}async childrenForPath(t,r){return await this.fileSystem.fileExists(t)?this.fileSystem.childrenForFolder(t,r):[]}parentPathForPath(t){return this.fileSystem.parentPathForPath(t)}async readFrame(t,r){let n=await this.fileSystem.getFile(this.spaceInfoForPath(t).framePath);if(!n){let i=this.defaultFrame(t);if(Object.keys(i).some(a=>a==r))return i[r]}return this.fileSystem.readFileFragments(n,"mdbTable",r)}async readAllFrames(t){let r=await this.fileSystem.getFile(this.spaceInfoForPath(t).framePath);return r?this.fileSystem.readFileFragments(r,"mdbTables"):this.defaultFrame(t)}async readTable(t,r){let n=this.spaceInfoForPath(t),i=await this.fileSystem.getFile(n.dbPath);if(!i&&r==yp.id){let o=Kx(this.spaceManager.superstate,n),s=hC(o.cols),l=o.rows.map(u=>nh(this.spaceManager.superstate.formulaContext,this.spaceManager.superstate.pathsIndex,this.spaceManager.superstate.spacesMap,u,o.cols,this.spaceManager.superstate.pathsIndex.get(t),s));return{...o,rows:l}}let a=await this.fileSystem.readFileFragments(i,"mdbTable",r);if(a&&a.schema.id!=yp.id){let o=hC(a.cols),s=a.rows.map(l=>nh(this.spaceManager.superstate.formulaContext,this.spaceManager.superstate.pathsIndex,this.spaceManager.superstate.spacesMap,l,a.cols,this.spaceManager.superstate.pathsIndex.get(t),o));return{...a,rows:s}}else if(!a&&r==yp.id){let o=Kx(this.spaceManager.superstate,n),s=hC(o.cols),l=o.rows.map(u=>nh(this.spaceManager.superstate.formulaContext,this.spaceManager.superstate.pathsIndex,this.spaceManager.superstate.spacesMap,u,o.cols,this.spaceManager.superstate.pathsIndex.get(t),s));return{...o,rows:l}}return a}async spaceInitiated(t){return!0}async contextInitiated(t){let r=this.spaceInfoForPath(t);return await this.fileSystem.fileExists(r.dbPath)}async tablesForSpace(t){let r=this.spaceInfoForPath(t),n=await this.fileSystem.getFile(r.dbPath);if(!n)return vA.rows;let i=await this.fileSystem.readFileFragments(n,"schemas",null);return i.length==0?vA.rows:i}defaultDBTablesForContext(t){let r=Kx(this.spaceManager.superstate,t),n=xq(t);return{...GJ(t),m_fields:{uniques:n.uniques,cols:n.cols,rows:[...n.rows??[],...r.cols]},[r.schema.id]:{uniques:r.cols.filter(a=>a.unique=="true").map(a=>a.name),cols:r.cols.map(a=>a.name),rows:r.rows}}}defaultFrame(t){return t.startsWith(Zg)&&t==Zg+"overview"?nre:this.spaceManager.superstate.settings.defaultSpaceTemplate.length>0&&this.spaceManager.superstate.templateCache.has(this.spaceManager.superstate.settings.defaultSpaceTemplate)?this.spaceManager.superstate.templateCache.get(this.spaceManager.superstate.settings.defaultSpaceTemplate):this.spaceManager.superstate.settings.enableFolderNote?oj:aw}async createDefaultTable(t){let r=this.spaceInfoForPath(t),n=this.spaceInfoForPath(t).dbPath,i=n.split(".").pop(),a=n.split("/").slice(0,-1).join("/"),o=n.split("/").pop().split(".")[0];return this.fileSystem.newFile(a,o,i,this.defaultDBTablesForContext(r))}async createDefaultFrames(t){let r=this.defaultFrame(t),n={...jk(r),m_schema:WJ},i=this.spaceInfoForPath(t).framePath,a=i.split(".").pop(),o=i.split("/").slice(0,-1).join("/"),s=i.split("/").pop().split(".")[0];return this.fileSystem.newFile(o,s,a,n)}async createTable(t,r){let n=await this.fileSystem.getFile(this.spaceInfoForPath(t).dbPath);return n||(n=await this.createDefaultTable(t)),this.fileSystem.newFileFragment(n,"schema",r.id,r)}async saveTableSchema(t,r,n){let i=await this.fileSystem.getFile(this.spaceInfoForPath(t).dbPath);return i||(i=await this.createDefaultTable(t)),this.fileSystem.saveFileFragment(i,"schema",r,n)}async saveTable(t,r,n){let i=await this.fileSystem.getFile(this.spaceInfoForPath(t).dbPath);if(!i)if(n)i=await this.createDefaultTable(t);else return!1;return this.fileSystem.saveFileFragment(i,"mdbTable",r.schema.id,()=>r)}async deleteTable(t,r){let n=await this.fileSystem.getFile(this.spaceInfoForPath(t).dbPath);return this.fileSystem.deleteFileFragment(n,"schema",r)}async readAllTables(t){let r=this.spaceInfoForPath(t),n=await this.fileSystem.getFile(r.dbPath);if(!n){let i=Kx(this.spaceManager.superstate,r);return{[i.schema.id]:i}}return this.fileSystem.readFileFragments(n,"mdbTables",null)}async framesForSpace(t){let r=await this.fileSystem.getFile(this.spaceInfoForPath(t).framePath);if(!r){let n=this.defaultFrame(t);return Object.values(n).map(i=>i.schema)}return this.fileSystem.readFileFragments(r,"schemas",null)}async createFrame(t,r){let n=await this.fileSystem.getFile(this.spaceInfoForPath(t).framePath);return n||(n=await this.createDefaultFrames(t)),this.fileSystem.newFileFragment(n,"schema",r.id,r)}async deleteFrame(t,r){let n=await this.fileSystem.getFile(this.spaceInfoForPath(t).framePath);return this.fileSystem.deleteFileFragment(n,"schema",r)}async saveFrameSchema(t,r,n){let i=await this.fileSystem.getFile(this.spaceInfoForPath(t).framePath);return i||(i=await this.createDefaultFrames(t)),this.fileSystem.saveFileFragment(i,"schema",r,n)}async saveFrame(t,r){let n=await this.fileSystem.getFile(this.spaceInfoForPath(t).framePath);return n||(n=await this.createDefaultFrames(t)),this.fileSystem.saveFileFragment(n,"mdbFrame",r.schema.id,()=>r)}async createDefaultCommands(t){let r={m_fields:{uniques:sa.uniques,cols:sa.cols,rows:[]},m_schema:{uniques:[],cols:["id","name","type","def","predicate","primary"],rows:[]}},n=this.spaceInfoForPath(t).commandsPath,i=n.split(".").pop(),a=n.split("/").slice(0,-1).join("/"),o=n.split("/").pop().split(".")[0];return this.fileSystem.newFile(a,o,i,r)}async commandsForSpace(t){let r=await this.fileSystem.getFile(this.spaceInfoForPath(t).commandsPath);return r?this.fileSystem.readFileFragments(r,"mdbCommands",null):[]}async runCommand(t,r,n){let i=await this.fileSystem.getFile(this.spaceInfoForPath(t).commandsPath);if(!i)return{result:null,error:"No commands file found"};let a=await this.fileSystem.readFileFragments(i,"mdbCommand",r);if(!a)return{result:null,error:"No command found"};let o,s;try{a.schema.type=="script"&&(o=ZS(a.code,n)),a.schema.type=="formula"&&(o=Pd(this.spaceManager.superstate.formulaContext,this.spaceManager.superstate.pathsIndex,this.spaceManager.superstate.spacesMap,a.code,a.fields.reduce((l,u)=>({...l,[u.name]:u}),{}),n,this.spaceManager.superstate.pathsIndex.get(t)))}catch(l){s=l}return{result:o,error:s}}async createCommand(t,r){let n=await this.fileSystem.getFile(this.spaceInfoForPath(t).commandsPath);return n||(n=await this.createDefaultCommands(t)),this.fileSystem.newFileFragment(n,"schema",r.id,r)}async readSystemCommands(){let t=(await this.childrenForPath(`${this.dataPath}/${vC}`,"folder")).map(n=>n.split("/").pop());return Promise.all(t.map(async n=>{let i=await this.readLibraryCommands(n);return{name:n,commands:Object.values(i??{})}}))}async readLibraryCommands(t){return this.fileSystem.readFileFragments({path:`${this.dataPath}/${vC}/${t}/commands.mdb`,name:"commands",filename:"commands.mdb",parent:`${this.dataPath}/${vC}/${t}`,isFolder:!1,extension:"mdb"},"mdbCommands")}async saveSystemCommand(t,r){let n={path:`${this.dataPath}/${vC}/${t}/commands.mdb`,name:"commands",filename:"commands.mdb",parent:`${this.dataPath}/${vC}/${t}`,isFolder:!1,extension:"mdb"};if(r)await this.fileSystem.saveFileFragment(n,"schema",r.schema.id,()=>r.schema),await this.fileSystem.saveFileFragment(n,"mdbCommand",r.schema.id,()=>r);else{let i={m_fields:{uniques:sa.uniques,cols:sa.cols,rows:[]},m_schema:{uniques:[],cols:["id","name","type","def","predicate","primary"],rows:[]}},a=n.path,o=a.split(".").pop(),s=a.split("/").slice(0,-1).join("/"),l=a.split("/").pop().split(".")[0];await this.fileSystem.newFile(s,l,o,i)}}async deleteCommand(t,r){let n=await this.fileSystem.getFile(this.spaceInfoForPath(t).commandsPath);return this.fileSystem.deleteFileFragment(n,"mdbCommand",r)}async saveCommand(t,r,n){let i=await this.fileSystem.getFile(this.spaceInfoForPath(t).commandsPath);return i||(i=await this.createDefaultCommands(t)),this.fileSystem.saveFileFragment(i,"mdbCommand",r,n)}async contextForSpace(t){let r=await this.fileSystem.getFile(this.spaceInfoForPath(t).dbPath);return r?this.fileSystem.readFileFragments(r,"mdbTable",Er):Kx(this.spaceManager.superstate,this.spaceInfoForPath(t))}async addSpaceProperty(t,r){let n=await this.fileSystem.getFile(this.spaceInfoForPath(t)?.dbPath);return n||await this.createDefaultTable(t),this.fileSystem.newFileFragment(n,"field",r.name,r)}async deleteSpaceProperty(t,r){let n=await this.fileSystem.getFile(this.spaceInfoForPath(t).dbPath);return this.fileSystem.deleteFileFragment(n,"field",r)}async saveSpaceProperty(t,r,n){let i=await this.fileSystem.getFile(this.spaceInfoForPath(t).dbPath);return i||await this.createDefaultTable(t),this.fileSystem.saveFileFragment(i,"field",n,a=>({...a,...r}))}async addProperty(t,r){let n=await this.fileSystem.getFile(t);this.fileSystem.newFileFragment(n,"property",r.name,r)}async saveProperties(t,r){let n=await this.fileSystem.getFile(t);return this.fileSystem.saveFileFragment(n,"property",null,i=>({...i,...r}))}async readLabel(t){let r=this.fileSystem.getFileCache(t)?.label;if(!r){let n=await this.fileSystem.getFile(t);return n?this.fileSystem.readFileFragments(n,"label",null):{}}return r}async saveLabel(t,r,n){if(this.spaceManager.superstate.spacesIndex.has(t)){let a=this.spaceInfoForPath(t),o=await this.fileSystem.getFile(a.defPath),s=await this.fileSystem.getFile(a.notePath);if(this.spaceManager.superstate.settings.enableFolderNote)s||(s=await this.fileSystem.newFile(a.folderPath,a.name,"md"));else{if(!o){let l=this.spaceInfoForPath(t).defPath,u=l.split(".").pop(),c=l.split("/").slice(0,-1).join("/"),f=l.split("/").pop().split(".")[0];o=await this.fileSystem.newFile(c,f,u)}s=o}await this.fileSystem.saveFileLabel(s,r,n);return}let i=await this.fileSystem.getFile(t);this.fileSystem.saveFileLabel(i,r,n)}async renameProperty(t,r,n){let i=await this.fileSystem.getFile(t);this.fileSystem.saveFileFragment(i,"property",null,a=>{let{[r]:o,...s}=a;return o?{...s,[n]:o}:a})}async readProperties(t){let r=await this.fileSystem.getFile(t);return this.fileSystem.readFileFragments(r,"property",null)}async deleteProperty(t,r){let n=await this.fileSystem.getFile(t);this.fileSystem.deleteFileFragment(n,"property",r)}allSpaces(){let r=(()=>this.allPaths(["folder"]).filter(i=>!LV(this.spaceManager.superstate.settings,i)).map(i=>Bk(this.spaceManager,i)))();if(this.spaceManager.superstate.settings.enableDefaultSpaces){let n=Object.keys(Im).map(o=>this.spaceManager.spaceInfoForPath(`spaces://$${o}`)),i=()=>this.readTags().map(o=>p0(this.spaceManager,jM(o)))??[],a=this.spaceManager.superstate.settings.enableDefaultSpaces?i():[];return[...n,...a,...r]}return r}readTags(){return this.fileSystem.allTags()}spaceInfoForPath(t){return are(this.spaceManager,t)}allCaches(){return this.fileSystem.allCaches()}async spaceDefForSpace(t){let r=this.spaceInfoForPath(t);if(!r)return null;let n=r.defPath?await this.fileSystem.readTextFromFile(r.defPath):null;if(!n){let a=await this.fileSystem.getFile(r.notePath),s=(a?this.fileSystem.getFileCache(a.path)?.frontmatter:null)??{};return pC(s,this.spaceManager.superstate.settings)}let i=or(n)??{};return pC(i,this.spaceManager.superstate.settings)}async createSpace(t,r,n){let i=this.spaceInfoForPath(r),a=i.folderPath=="/"?t:i.folderPath+"/"+t;if(await this.fileSystem.createFolder(a),Object.keys(n??{}).length>0)return this.saveSpace(a,()=>n)}async saveSpace(t,r,n){let i=r(await this.spaceDefForSpace(t))??{},a=this.spaceInfoForPath(t),o=await this.fileSystem.getFile(a.defPath);if(!o){let l=this.spaceInfoForPath(t).defPath,u=l.split(".").pop(),c=l.split("/").slice(0,-1).join("/"),f=l.split("/").pop().split(".")[0];o=await this.fileSystem.newFile(c,f,u)}let s=await this.fileSystem.getFile(a.notePath);this.spaceManager.superstate.settings.enableFolderNote?s||(s=await this.fileSystem.newFile(a.folderPath,rf(a.notePath),"md")):s=o,n&&await this.fileSystem.saveFileFragment(s,"property",null,l=>({...l,...n??{}})),await this.fileSystem.saveFileFragment(o,"definition",null,l=>({[_k]:i.filters,[Nk]:i.contexts,[Pk]:i.links,[Ik]:i.sort,[Tk]:i.template,[Fk]:i.templateName,[sj]:i.recursive,defaultSticker:i.defaultSticker,readMode:i.readMode}))}renameSpace(t,r){let n=this.spaceInfoForPath(t),i=this.spaceInfoForPath(r);return this.fileSystem.renameFile(n.folderPath,i.folderPath).then(a=>(this.spaceManager.superstate.settings.enableFolderNote&&this.fileSystem.renameFile(Mm(n.notePath,i.path),i.notePath),a))}deleteSpace(t){let r=this.spaceInfoForPath(t),n=p0(this.spaceManager,r.name);this.fileSystem.deleteFile(n.folderPath)}childrenForSpace(t){return this.fileSystem.allFiles().filter(r=>r.parent==t).map(r=>r.path)}addTag(t,r){this.fileSystem.addTagToFile(t,r)}renameTag(t,r,n){this.fileSystem.renameTagForFile(t,r,n)}deleteTag(t,r){this.fileSystem.removeTagFromFile(t,r)}pathsForTag(t){return this.fileSystem.filesForTag(t)}resolvePath(t,r){return this.fileSystem.resolvePath(t,r)}};var Rye={"image-select":` +In case of a (multi dimensional) array or matrix, the prob order quantile of all elements will be calculated.`,examples:["quantileSeq([3, -1, 5, 7], 0.5)","quantileSeq([3, -1, 5, 7], [1/3, 2/3])","quantileSeq([3, -1, 5, 7], 2)","quantileSeq([-1, 3, 5, 7], 0.5, true)"],seealso:["mean","median","min","max","prod","std","sum","variance"]};var dhe={name:"std",category:"Statistics",syntax:["std(a, b, c, ...)","std(A)","std(A, dimension)","std(A, normalization)","std(A, dimension, normalization)"],description:'Compute the standard deviation of all values, defined as std(A) = sqrt(variance(A)). Optional parameter normalization can be "unbiased" (default), "uncorrected", or "biased".',examples:["std(2, 4, 6)","std([2, 4, 6, 8])",'std([2, 4, 6, 8], "uncorrected")','std([2, 4, 6, 8], "biased")',"std([1, 2, 3; 4, 5, 6])"],seealso:["max","mean","min","median","prod","sum","variance"]};var phe={name:"cumsum",category:"Statistics",syntax:["cumsum(a, b, c, ...)","cumsum(A)"],description:"Compute the cumulative sum of all values.",examples:["cumsum(2, 3, 4, 1)","cumsum([2, 3, 4, 1])","cumsum([1, 2; 3, 4])","cumsum([1, 2; 3, 4], 1)","cumsum([1, 2; 3, 4], 2)"],seealso:["max","mean","median","min","prod","std","sum","variance"]};var mhe={name:"sum",category:"Statistics",syntax:["sum(a, b, c, ...)","sum(A)","sum(A, dimension)"],description:"Compute the sum of all values.",examples:["sum(2, 3, 4, 1)","sum([2, 3, 4, 1])","sum([2, 5; 4, 3])"],seealso:["max","mean","median","min","prod","std","sum","variance"]};var hhe={name:"variance",category:"Statistics",syntax:["variance(a, b, c, ...)","variance(A)","variance(A, dimension)","variance(A, normalization)","variance(A, dimension, normalization)"],description:'Compute the variance of all values. Optional parameter normalization can be "unbiased" (default), "uncorrected", or "biased".',examples:["variance(2, 4, 6)","variance([2, 4, 6, 8])",'variance([2, 4, 6, 8], "uncorrected")','variance([2, 4, 6, 8], "biased")',"variance([1, 2, 3; 4, 5, 6])"],seealso:["max","mean","min","median","min","prod","std","sum"]};var Ahe={name:"corr",category:"Statistics",syntax:["corr(A,B)"],description:"Compute the correlation coefficient of a two list with values, For matrices, the matrix correlation coefficient is calculated.",examples:["corr([2, 4, 6, 8],[1, 2, 3, 6])","corr(matrix([[1, 2.2, 3, 4.8, 5], [1, 2, 3, 4, 5]]), matrix([[4, 5.3, 6.6, 7, 8], [1, 2, 3, 4, 5]]))"],seealso:["max","mean","min","median","min","prod","std","sum"]};var ghe={name:"acos",category:"Trigonometry",syntax:["acos(x)"],description:"Compute the inverse cosine of a value in radians.",examples:["acos(0.5)","acos(cos(2.3))"],seealso:["cos","atan","asin"]};var vhe={name:"acosh",category:"Trigonometry",syntax:["acosh(x)"],description:"Calculate the hyperbolic arccos of a value, defined as `acosh(x) = ln(sqrt(x^2 - 1) + x)`.",examples:["acosh(1.5)"],seealso:["cosh","asinh","atanh"]};var yhe={name:"acot",category:"Trigonometry",syntax:["acot(x)"],description:"Calculate the inverse cotangent of a value.",examples:["acot(0.5)","acot(cot(0.5))","acot(2)"],seealso:["cot","atan"]};var bhe={name:"acoth",category:"Trigonometry",syntax:["acoth(x)"],description:"Calculate the hyperbolic arccotangent of a value, defined as `acoth(x) = (ln((x+1)/x) + ln(x/(x-1))) / 2`.",examples:["acoth(2)","acoth(0.5)"],seealso:["acsch","asech"]};var xhe={name:"acsc",category:"Trigonometry",syntax:["acsc(x)"],description:"Calculate the inverse cotangent of a value.",examples:["acsc(2)","acsc(csc(0.5))","acsc(0.5)"],seealso:["csc","asin","asec"]};var whe={name:"acsch",category:"Trigonometry",syntax:["acsch(x)"],description:"Calculate the hyperbolic arccosecant of a value, defined as `acsch(x) = ln(1/x + sqrt(1/x^2 + 1))`.",examples:["acsch(0.5)"],seealso:["asech","acoth"]};var She={name:"asec",category:"Trigonometry",syntax:["asec(x)"],description:"Calculate the inverse secant of a value.",examples:["asec(0.5)","asec(sec(0.5))","asec(2)"],seealso:["acos","acot","acsc"]};var Ehe={name:"asech",category:"Trigonometry",syntax:["asech(x)"],description:"Calculate the inverse secant of a value.",examples:["asech(0.5)"],seealso:["acsch","acoth"]};var khe={name:"asin",category:"Trigonometry",syntax:["asin(x)"],description:"Compute the inverse sine of a value in radians.",examples:["asin(0.5)","asin(sin(0.5))"],seealso:["sin","acos","atan"]};var Che={name:"asinh",category:"Trigonometry",syntax:["asinh(x)"],description:"Calculate the hyperbolic arcsine of a value, defined as `asinh(x) = ln(x + sqrt(x^2 + 1))`.",examples:["asinh(0.5)"],seealso:["acosh","atanh"]};var Dhe={name:"atan",category:"Trigonometry",syntax:["atan(x)"],description:"Compute the inverse tangent of a value in radians.",examples:["atan(0.5)","atan(tan(0.5))"],seealso:["tan","acos","asin"]};var Ohe={name:"atan2",category:"Trigonometry",syntax:["atan2(y, x)"],description:"Computes the principal value of the arc tangent of y/x in radians.",examples:["atan2(2, 2) / pi","angle = 60 deg in rad","x = cos(angle)","y = sin(angle)","atan2(y, x)"],seealso:["sin","cos","tan"]};var Mhe={name:"atanh",category:"Trigonometry",syntax:["atanh(x)"],description:"Calculate the hyperbolic arctangent of a value, defined as `atanh(x) = ln((1 + x)/(1 - x)) / 2`.",examples:["atanh(0.5)"],seealso:["acosh","asinh"]};var jhe={name:"cos",category:"Trigonometry",syntax:["cos(x)"],description:"Compute the cosine of x in radians.",examples:["cos(2)","cos(pi / 4) ^ 2","cos(180 deg)","cos(60 deg)","sin(0.2)^2 + cos(0.2)^2"],seealso:["acos","sin","tan"]};var Nhe={name:"cosh",category:"Trigonometry",syntax:["cosh(x)"],description:"Compute the hyperbolic cosine of x in radians.",examples:["cosh(0.5)"],seealso:["sinh","tanh","coth"]};var The={name:"cot",category:"Trigonometry",syntax:["cot(x)"],description:"Compute the cotangent of x in radians. Defined as 1/tan(x)",examples:["cot(2)","1 / tan(2)"],seealso:["sec","csc","tan"]};var Fhe={name:"coth",category:"Trigonometry",syntax:["coth(x)"],description:"Compute the hyperbolic cotangent of x in radians.",examples:["coth(2)","1 / tanh(2)"],seealso:["sech","csch","tanh"]};var _he={name:"csc",category:"Trigonometry",syntax:["csc(x)"],description:"Compute the cosecant of x in radians. Defined as 1/sin(x)",examples:["csc(2)","1 / sin(2)"],seealso:["sec","cot","sin"]};var Phe={name:"csch",category:"Trigonometry",syntax:["csch(x)"],description:"Compute the hyperbolic cosecant of x in radians. Defined as 1/sinh(x)",examples:["csch(2)","1 / sinh(2)"],seealso:["sech","coth","sinh"]};var Ihe={name:"sec",category:"Trigonometry",syntax:["sec(x)"],description:"Compute the secant of x in radians. Defined as 1/cos(x)",examples:["sec(2)","1 / cos(2)"],seealso:["cot","csc","cos"]};var Bhe={name:"sech",category:"Trigonometry",syntax:["sech(x)"],description:"Compute the hyperbolic secant of x in radians. Defined as 1/cosh(x)",examples:["sech(2)","1 / cosh(2)"],seealso:["coth","csch","cosh"]};var Rhe={name:"sin",category:"Trigonometry",syntax:["sin(x)"],description:"Compute the sine of x in radians.",examples:["sin(2)","sin(pi / 4) ^ 2","sin(90 deg)","sin(30 deg)","sin(0.2)^2 + cos(0.2)^2"],seealso:["asin","cos","tan"]};var $he={name:"sinh",category:"Trigonometry",syntax:["sinh(x)"],description:"Compute the hyperbolic sine of x in radians.",examples:["sinh(0.5)"],seealso:["cosh","tanh"]};var qhe={name:"tan",category:"Trigonometry",syntax:["tan(x)"],description:"Compute the tangent of x in radians.",examples:["tan(0.5)","sin(0.5) / cos(0.5)","tan(pi / 4)","tan(45 deg)"],seealso:["atan","sin","cos"]};var Lhe={name:"tanh",category:"Trigonometry",syntax:["tanh(x)"],description:"Compute the hyperbolic tangent of x in radians.",examples:["tanh(0.5)","sinh(0.5) / cosh(0.5)"],seealso:["sinh","cosh"]};var zhe={name:"to",category:"Units",syntax:["x to unit","to(x, unit)"],description:"Change the unit of a value.",examples:["5 inch to cm","3.2kg to g","16 bytes in bits"],seealso:[]};var Uhe={name:"bin",category:"Utils",syntax:["bin(value)"],description:"Format a number as binary",examples:["bin(2)"],seealso:["oct","hex"]};var Whe={name:"clone",category:"Utils",syntax:["clone(x)"],description:"Clone a variable. Creates a copy of primitive variables,and a deep copy of matrices",examples:["clone(3.5)","clone(2 - 4i)","clone(45 deg)","clone([1, 2; 3, 4])",'clone("hello world")'],seealso:[]};var Hhe={name:"format",category:"Utils",syntax:["format(value)","format(value, precision)"],description:"Format a value of any type as string.",examples:["format(2.3)","format(3 - 4i)","format([])","format(pi, 3)"],seealso:["print"]};var Vhe={name:"hasNumericValue",category:"Utils",syntax:["hasNumericValue(x)"],description:"Test whether a value is an numeric value. In case of a string, true is returned if the string contains a numeric value.",examples:["hasNumericValue(2)",'hasNumericValue("2")','isNumeric("2")',"hasNumericValue(0)","hasNumericValue(bignumber(500))","hasNumericValue(fraction(0.125))","hasNumericValue(2 + 3i)",'hasNumericValue([2.3, "foo", false])'],seealso:["isInteger","isZero","isNegative","isPositive","isNaN","isNumeric"]};var Ghe={name:"hex",category:"Utils",syntax:["hex(value)"],description:"Format a number as hexadecimal",examples:["hex(240)"],seealso:["bin","oct"]};var Qhe={name:"isInteger",category:"Utils",syntax:["isInteger(x)"],description:"Test whether a value is an integer number.",examples:["isInteger(2)","isInteger(3.5)","isInteger([3, 0.5, -2])"],seealso:["isNegative","isNumeric","isPositive","isZero"]};var Yhe={name:"isNaN",category:"Utils",syntax:["isNaN(x)"],description:"Test whether a value is NaN (not a number)",examples:["isNaN(2)","isNaN(0 / 0)","isNaN(NaN)","isNaN(Infinity)"],seealso:["isNegative","isNumeric","isPositive","isZero"]};var Zhe={name:"isNegative",category:"Utils",syntax:["isNegative(x)"],description:"Test whether a value is negative: smaller than zero.",examples:["isNegative(2)","isNegative(0)","isNegative(-4)","isNegative([3, 0.5, -2])"],seealso:["isInteger","isNumeric","isPositive","isZero"]};var Xhe={name:"isNumeric",category:"Utils",syntax:["isNumeric(x)"],description:"Test whether a value is a numeric value. Returns true when the input is a number, BigNumber, Fraction, or boolean.",examples:["isNumeric(2)",'isNumeric("2")','hasNumericValue("2")',"isNumeric(0)","isNumeric(bignumber(500))","isNumeric(fraction(0.125))","isNumeric(2 + 3i)",'isNumeric([2.3, "foo", false])'],seealso:["isInteger","isZero","isNegative","isPositive","isNaN","hasNumericValue"]};var Khe={name:"isPositive",category:"Utils",syntax:["isPositive(x)"],description:"Test whether a value is positive: larger than zero.",examples:["isPositive(2)","isPositive(0)","isPositive(-4)","isPositive([3, 0.5, -2])"],seealso:["isInteger","isNumeric","isNegative","isZero"]};var Jhe={name:"isPrime",category:"Utils",syntax:["isPrime(x)"],description:"Test whether a value is prime: has no divisors other than itself and one.",examples:["isPrime(3)","isPrime(-2)","isPrime([2, 17, 100])"],seealso:["isInteger","isNumeric","isNegative","isZero"]};var eAe={name:"isZero",category:"Utils",syntax:["isZero(x)"],description:"Test whether a value is zero.",examples:["isZero(2)","isZero(0)","isZero(-4)","isZero([3, 0, -2, 0])"],seealso:["isInteger","isNumeric","isNegative","isPositive"]};var tAe={name:"numeric",category:"Utils",syntax:["numeric(x)"],description:"Convert a numeric input to a specific numeric type: number, BigNumber, or Fraction.",examples:['numeric("4")','numeric("4", "number")','numeric("4", "BigNumber")','numeric("4", "Fraction")','numeric(4, "Fraction")','numeric(fraction(2, 5), "number")'],seealso:["number","fraction","bignumber","string","format"]};var rAe={name:"oct",category:"Utils",syntax:["oct(value)"],description:"Format a number as octal",examples:["oct(56)"],seealso:["bin","hex"]};var nAe={name:"print",category:"Utils",syntax:["print(template, values)","print(template, values, precision)"],description:"Interpolate values into a string template.",examples:['print("Lucy is $age years old", {age: 5})','print("The value of pi is $pi", {pi: pi}, 3)','print("Hello, $user.name!", {user: {name: "John"}})','print("Values: $1, $2, $3", [6, 9, 4])'],seealso:["format"]};var iAe={name:"typeOf",category:"Utils",syntax:["typeOf(x)"],description:"Get the type of a variable.",examples:["typeOf(3.5)","typeOf(2 - 4i)","typeOf(45 deg)",'typeOf("hello world")'],seealso:["getMatrixDataType"]};var aAe={name:"solveODE",category:"Numeric",syntax:["solveODE(func, tspan, y0)","solveODE(func, tspan, y0, options)"],description:"Numerical Integration of Ordinary Differential Equations.",examples:["f(t,y) = y","tspan = [0, 4]","solveODE(f, tspan, 1)","solveODE(f, tspan, [1, 2])",'solveODE(f, tspan, 1, { method:"RK23", maxStep:0.1 })'],seealso:["derivative","simplifyCore"]};var oAe={bignumber:Zfe,boolean:Xfe,complex:Kfe,createUnit:Jfe,fraction:ede,index:tde,matrix:rde,number:nde,sparse:ide,splitUnit:ade,string:ode,unit:sde,e:jH,E:jH,false:Pfe,i:Ife,Infinity:Bfe,LN2:$fe,LN10:Rfe,LOG2E:Lfe,LOG10E:qfe,NaN:zfe,null:Ufe,pi:NH,PI:NH,phi:Wfe,SQRT1_2:Hfe,SQRT2:Vfe,tau:Gfe,true:Qfe,version:Yfe,speedOfLight:{description:"Speed of light in vacuum",examples:["speedOfLight"]},gravitationConstant:{description:"Newtonian constant of gravitation",examples:["gravitationConstant"]},planckConstant:{description:"Planck constant",examples:["planckConstant"]},reducedPlanckConstant:{description:"Reduced Planck constant",examples:["reducedPlanckConstant"]},magneticConstant:{description:"Magnetic constant (vacuum permeability)",examples:["magneticConstant"]},electricConstant:{description:"Electric constant (vacuum permeability)",examples:["electricConstant"]},vacuumImpedance:{description:"Characteristic impedance of vacuum",examples:["vacuumImpedance"]},coulomb:{description:"Coulomb's constant",examples:["coulomb"]},elementaryCharge:{description:"Elementary charge",examples:["elementaryCharge"]},bohrMagneton:{description:"Borh magneton",examples:["bohrMagneton"]},conductanceQuantum:{description:"Conductance quantum",examples:["conductanceQuantum"]},inverseConductanceQuantum:{description:"Inverse conductance quantum",examples:["inverseConductanceQuantum"]},magneticFluxQuantum:{description:"Magnetic flux quantum",examples:["magneticFluxQuantum"]},nuclearMagneton:{description:"Nuclear magneton",examples:["nuclearMagneton"]},klitzing:{description:"Von Klitzing constant",examples:["klitzing"]},bohrRadius:{description:"Borh radius",examples:["bohrRadius"]},classicalElectronRadius:{description:"Classical electron radius",examples:["classicalElectronRadius"]},electronMass:{description:"Electron mass",examples:["electronMass"]},fermiCoupling:{description:"Fermi coupling constant",examples:["fermiCoupling"]},fineStructure:{description:"Fine-structure constant",examples:["fineStructure"]},hartreeEnergy:{description:"Hartree energy",examples:["hartreeEnergy"]},protonMass:{description:"Proton mass",examples:["protonMass"]},deuteronMass:{description:"Deuteron Mass",examples:["deuteronMass"]},neutronMass:{description:"Neutron mass",examples:["neutronMass"]},quantumOfCirculation:{description:"Quantum of circulation",examples:["quantumOfCirculation"]},rydberg:{description:"Rydberg constant",examples:["rydberg"]},thomsonCrossSection:{description:"Thomson cross section",examples:["thomsonCrossSection"]},weakMixingAngle:{description:"Weak mixing angle",examples:["weakMixingAngle"]},efimovFactor:{description:"Efimov factor",examples:["efimovFactor"]},atomicMass:{description:"Atomic mass constant",examples:["atomicMass"]},avogadro:{description:"Avogadro's number",examples:["avogadro"]},boltzmann:{description:"Boltzmann constant",examples:["boltzmann"]},faraday:{description:"Faraday constant",examples:["faraday"]},firstRadiation:{description:"First radiation constant",examples:["firstRadiation"]},loschmidt:{description:"Loschmidt constant at T=273.15 K and p=101.325 kPa",examples:["loschmidt"]},gasConstant:{description:"Gas constant",examples:["gasConstant"]},molarPlanckConstant:{description:"Molar Planck constant",examples:["molarPlanckConstant"]},molarVolume:{description:"Molar volume of an ideal gas at T=273.15 K and p=101.325 kPa",examples:["molarVolume"]},sackurTetrode:{description:"Sackur-Tetrode constant at T=1 K and p=101.325 kPa",examples:["sackurTetrode"]},secondRadiation:{description:"Second radiation constant",examples:["secondRadiation"]},stefanBoltzmann:{description:"Stefan-Boltzmann constant",examples:["stefanBoltzmann"]},wienDisplacement:{description:"Wien displacement law constant",examples:["wienDisplacement"]},molarMass:{description:"Molar mass constant",examples:["molarMass"]},molarMassC12:{description:"Molar mass constant of carbon-12",examples:["molarMassC12"]},gravity:{description:"Standard acceleration of gravity (standard acceleration of free-fall on Earth)",examples:["gravity"]},planckLength:{description:"Planck length",examples:["planckLength"]},planckMass:{description:"Planck mass",examples:["planckMass"]},planckTime:{description:"Planck time",examples:["planckTime"]},planckCharge:{description:"Planck charge",examples:["planckCharge"]},planckTemperature:{description:"Planck temperature",examples:["planckTemperature"]},derivative:fde,lsolve:pde,lsolveAll:mde,lup:hde,lusolve:Ade,leafCount:dde,polynomialRoot:gde,resolve:bde,simplify:xde,simplifyConstant:wde,simplifyCore:Sde,symbolicEqual:kde,rationalize:yde,slu:Ede,usolve:Cde,usolveAll:Dde,qr:vde,abs:Ode,add:Mde,cbrt:jde,ceil:Nde,cube:Tde,divide:Fde,dotDivide:_de,dotMultiply:Pde,dotPow:Ide,exp:Bde,expm:Rde,expm1:$de,fix:qde,floor:Lde,gcd:zde,hypot:Ude,lcm:Hde,log:Vde,log2:Yde,log1p:Qde,log10:Gde,mod:Zde,multiply:Xde,norm:Kde,nthRoot:Jde,nthRoots:epe,pow:tpe,round:rpe,sign:npe,sqrt:ipe,sqrtm:ape,square:upe,subtract:cpe,unaryMinus:fpe,unaryPlus:dpe,xgcd:ppe,invmod:Wde,bitAnd:mpe,bitNot:hpe,bitOr:Ape,bitXor:gpe,leftShift:vpe,rightArithShift:ype,rightLogShift:bpe,bellNumbers:xpe,catalan:wpe,composition:Spe,stirlingS2:Epe,config:lde,import:ude,typed:cde,arg:kpe,conj:Cpe,re:Ope,im:Dpe,evaluate:Mpe,help:jpe,distance:Npe,intersect:Tpe,and:Fpe,not:_pe,or:Ppe,xor:Ipe,concat:Rpe,count:$pe,cross:qpe,column:Bpe,ctranspose:Lpe,det:zpe,diag:Upe,diff:Wpe,dot:Hpe,getMatrixDataType:Zpe,identity:Xpe,filter:Gpe,flatten:Qpe,forEach:Ype,inv:Kpe,pinv:Jpe,eigs:Vpe,kron:eme,matrixFromFunction:nme,matrixFromRows:ime,matrixFromColumns:rme,map:tme,ones:ame,partitionSelect:ome,range:sme,resize:ume,reshape:lme,rotate:cme,rotationMatrix:fme,row:dme,size:pme,sort:mme,squeeze:hme,subset:Ame,trace:gme,transpose:vme,zeros:yme,fft:bme,ifft:xme,sylvester:ope,schur:spe,lyap:lpe,solveODE:aAe,combinations:wme,combinationsWithRep:Sme,factorial:Eme,gamma:kme,kldivergence:Dme,lgamma:Cme,multinomial:Ome,permutations:Mme,pickRandom:jme,random:Nme,randomInt:Tme,compare:Fme,compareNatural:_me,compareText:Pme,deepEqual:Ime,equal:Bme,equalText:Rme,larger:$me,largerEq:qme,smaller:Lme,smallerEq:zme,unequal:Ume,setCartesian:Wme,setDifference:Hme,setDistinct:Vme,setIntersect:Gme,setIsSubset:Qme,setMultiplicity:Yme,setPowerset:Zme,setSize:Xme,setSymDifference:Kme,setUnion:Jme,zpk2tf:ehe,freqz:the,erf:rhe,zeta:nhe,cumsum:phe,mad:ihe,max:ahe,mean:ohe,median:she,min:lhe,mode:uhe,prod:che,quantileSeq:fhe,std:dhe,sum:mhe,variance:hhe,corr:Ahe,acos:ghe,acosh:vhe,acot:yhe,acoth:bhe,acsc:xhe,acsch:whe,asec:She,asech:Ehe,asin:khe,asinh:Che,atan:Dhe,atanh:Mhe,atan2:Ohe,cos:jhe,cosh:Nhe,cot:The,coth:Fhe,csc:_he,csch:Phe,sec:Ihe,sech:Bhe,sin:Rhe,sinh:$he,tan:qhe,tanh:Lhe,to:zhe,clone:Whe,format:Hhe,bin:Uhe,oct:rAe,hex:Ghe,isNaN:Yhe,isInteger:Qhe,isNegative:Zhe,isNumeric:Xhe,hasNumericValue:Vhe,isPositive:Khe,isPrime:Jhe,isZero:eAe,print:nAe,typeOf:iAe,numeric:tAe};var sAe="help",LUe=["typed","mathWithTransform","Help"],X4=V(sAe,LUe,e=>{var{typed:t,mathWithTransform:r,Help:n}=e;return t(sAe,{any:function(a){var o,s=a;if(typeof a!="string"){for(o in r)if(Et(r,o)&&a===r[o]){s=o;break}}var l=Zi(oAe,s);if(!l){var u=typeof s=="function"?s.name:s;throw new Error('No documentation found on "'+u+'"')}return new n(l)}})});var lAe="chain",zUe=["typed","Chain"],K4=V(lAe,zUe,e=>{var{typed:t,Chain:r}=e;return t(lAe,{"":function(){return new r},any:function(i){return new r(i)}})});var uAe="det",UUe=["typed","matrix","subtractScalar","multiply","divideScalar","isZero","unaryMinus"],J4=V(uAe,UUe,e=>{var{typed:t,matrix:r,subtractScalar:n,multiply:i,divideScalar:a,isZero:o,unaryMinus:s}=e;return t(uAe,{any:function(c){return Bt(c)},"Array | Matrix":function(c){var f;switch(St(c)?f=c.size():Array.isArray(c)?(c=r(c),f=c.size()):f=[],f.length){case 0:return Bt(c);case 1:if(f[0]===1)return Bt(c.valueOf()[0]);if(f[0]===0)return 1;throw new RangeError("Matrix must be square (size: "+tr(f)+")");case 2:{var d=f[0],p=f[1];if(d===p)return l(c.clone().valueOf(),d,p);if(p===0)return 1;throw new RangeError("Matrix must be square (size: "+tr(f)+")")}default:throw new RangeError("Matrix must be two dimensional (size: "+tr(f)+")")}}});function l(u,c,f){if(c===1)return Bt(u[0][0]);if(c===2)return n(i(u[0][0],u[1][1]),i(u[1][0],u[0][1]));for(var d=!1,p=new Array(c).fill(0).map((k,j)=>j),h=0;h{var{typed:t,matrix:r,divideScalar:n,addScalar:i,multiply:a,unaryMinus:o,det:s,identity:l,abs:u}=e;return t(cAe,{"Array | Matrix":function(d){var p=St(d)?d.size():Yt(d);switch(p.length){case 1:if(p[0]===1)return St(d)?r([n(1,d.valueOf()[0])]):[n(1,d[0])];throw new RangeError("Matrix must be square (size: "+tr(p)+")");case 2:{var h=p[0],m=p[1];if(h===m)return St(d)?r(c(d.valueOf(),h,m),d.storage()):c(d,h,m);throw new RangeError("Matrix must be square (size: "+tr(p)+")")}default:throw new RangeError("Matrix must be two dimensional (size: "+tr(p)+")")}},any:function(d){return n(1,d)}});function c(f,d,p){var h,m,g,A,b;if(d===1){if(A=f[0][0],A===0)throw Error("Cannot calculate inverse, determinant is zero");return[[n(1,A)]]}else if(d===2){var v=s(f);if(v===0)throw Error("Cannot calculate inverse, determinant is zero");return[[n(f[1][1],v),n(o(f[0][1]),v)],[n(o(f[1][0]),v),n(f[0][0],v)]]}else{var x=f.concat();for(h=0;hk&&(k=u(x[h][S]),j=h),h++;if(k===0)throw Error("Cannot calculate inverse, determinant is zero");h=j,h!==S&&(b=x[S],x[S]=x[h],x[h]=b,b=w[S],w[S]=w[h],w[h]=b);var O=x[S],C=w[S];for(h=0;h{var{typed:t,matrix:r,inv:n,deepEqual:i,equal:a,dotDivide:o,dot:s,ctranspose:l,divideScalar:u,multiply:c,add:f,Complex:d}=e;return t(fAe,{"Array | Matrix":function(v){var x=St(v)?v.size():Yt(v);switch(x.length){case 1:return A(v)?l(v):x[0]===1?n(v):o(l(v),s(v,v));case 2:{if(A(v))return l(v);var w=x[0],S=x[1];if(w===S)try{return n(v)}catch(k){if(!(k instanceof Error&&k.message.match(/Cannot calculate inverse, determinant is zero/)))throw k}return St(v)?r(p(v.valueOf(),w,S),v.storage()):p(v,w,S)}default:throw new RangeError("Matrix must be two dimensional (size: "+tr(x)+")")}},any:function(v){return a(v,0)?Bt(v):u(1,v)}});function p(b,v,x){var{C:w,F:S}=m(b,v,x),k=c(n(c(l(w),w)),l(w)),j=c(l(S),n(c(S,l(S))));return c(j,k)}function h(b,v,x){for(var w=Bt(b),S=0,k=0;kj.filter((C,N)=>N!g(s(w[O],w[O])));return{C:S,F:k}}function g(b){return a(f(b,d(1,1)),f(0,d(1,1)))}function A(b){return i(f(b,d(1,1)),f(c(b,0),d(1,1)))}});function dAe(e){var{addScalar:t,subtract:r,flatten:n,multiply:i,multiplyScalar:a,divideScalar:o,sqrt:s,abs:l,bignumber:u,diag:c,size:f,reshape:d,inv:p,qr:h,usolve:m,usolveAll:g,equal:A,complex:b,larger:v,smaller:x,matrixFromColumns:w,dot:S}=e;function k(te,Q,fe,Ie){var Se=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,Oe=j(te,Q,fe,Ie,Se);O(te,Q,fe,Ie,Se,Oe);var{values:ve,C:ye}=C(te,Q,fe,Ie,Se);if(Se){var me=N(te,Q,ye,Oe,ve,fe,Ie);return{values:ve,eigenvectors:me}}return{values:ve}}function j(te,Q,fe,Ie,Se){var Oe=Ie==="BigNumber",ve=Ie==="Complex",ye=Oe?u(0):0,me=Oe?u(1):ve?b(1):1,ke=Oe?u(1):1,$=Oe?u(10):2,ae=a($,$),ce;Se&&(ce=Array(Q).fill(me));for(var U=!1;!U;){U=!0;for(var R=0;R1&&(U=c(Array($-1).fill(ye)))),$-=1,me.pop();for(var Ce=0;Ce<$;Ce++)me[Ce].pop()}else if($===2||x(l(me[$-2][$-3]),fe)){R=0;var _e=D(me[$-2][$-2],me[$-2][$-1],me[$-1][$-2],me[$-1][$-1]);ke.push(..._e),Se&&(ae.unshift(P(me[$-2][$-2],me[$-2][$-1],me[$-1][$-2],me[$-1][$-1],_e[0],_e[1],fe,Ie)),q(U,Q),ce=i(ce,U),$>2&&(U=c(Array($-2).fill(ye)))),$-=2,me.pop(),me.pop();for(var he=0;he<$;he++)me[he].pop(),me[he].pop()}if($===0)break}if(ke.sort((tt,Ct)=>+r(l(tt),l(Ct))),R>100){var ze=Error("The eigenvalues failed to converge. Only found these eigenvalues: "+ke.join(", "));throw ze.values=ke,ze.vectors=[],ze}var Ye=Se?i(ce,z(ae,Q)):void 0;return{values:ke,C:Ye}}function N(te,Q,fe,Ie,Se,Oe,ve){var ye=p(fe),me=i(ye,te,fe),ke=ve==="BigNumber",$=ve==="Complex",ae=ke?u(0):$?b(0):0,ce=ke?u(1):$?b(1):1,U=[],R=[];for(var J of Se){var ee=I(U,J,A);ee===-1?(U.push(J),R.push(1)):R[ee]+=1}for(var ie=[],re=U.length,Ee=Array(Q).fill(ae),Ce=c(Array(Q).fill(ce)),_e=function(){var Ye=U[he],tt=r(me,i(Ye,Ce)),Ct=g(tt,Ee);for(Ct.shift();Ct.lengthi(Be,Le)),ie.push(...Ct.map(Le=>({value:Ye,vector:n(Le)})))},he=0;he=5)return null;for(ye=0;;){var me=m(te,ve);if(x(Y(_(ve,[me])),Ie))break;if(++ye>=10)return null;ve=oe(me)}return ve}function L(te,Q,fe){var Ie=fe==="BigNumber",Se=fe==="Complex",Oe=Array(te).fill(0).map(ve=>2*Math.random()-1);return Ie&&(Oe=Oe.map(ve=>u(ve))),Se&&(Oe=Oe.map(ve=>b(ve))),Oe=_(Oe,Q),oe(Oe,fe)}function _(te,Q){var fe=f(te);for(var Ie of Q)Ie=d(Ie,fe),te=r(te,i(o(S(Ie,te),S(Ie,Ie)),Ie));return te}function Y(te){return l(s(S(te,te)))}function oe(te,Q){var fe=Q==="BigNumber",Ie=Q==="Complex",Se=fe?u(1):Ie?b(1):1;return i(o(Se,Y(te)),te)}return k}function pAe(e){var{config:t,addScalar:r,subtract:n,abs:i,atan:a,cos:o,sin:s,multiplyScalar:l,inv:u,bignumber:c,multiply:f,add:d}=e;function p(O,C){var N=arguments.length>2&&arguments[2]!==void 0?arguments[2]:t.epsilon,D=arguments.length>3?arguments[3]:void 0,P=arguments.length>4?arguments[4]:void 0;if(D==="number")return h(O,N,P);if(D==="BigNumber")return m(O,N,P);throw TypeError("Unsupported data type: "+D)}function h(O,C,N){var D=O.length,P=Math.abs(C/D),q,z;if(N){z=new Array(D);for(var I=0;I=Math.abs(P);){var L=T[0][0],_=T[0][1];q=g(O[L][L],O[_][_],O[L][_]),O=w(O,q,L,_),N&&(z=b(z,q,L,_)),T=S(O)}for(var Y=Array(D).fill(0),oe=0;oe=i(P);){var L=T[0][0],_=T[0][1];q=A(O[L][L],O[_][_],O[L][_]),O=x(O,q,L,_),N&&(z=v(z,q,L,_)),T=k(O)}for(var Y=Array(D).fill(0),oe=0;oe({value:P[Q],vector:te}));return{values:P,eigenvectors:oe}}return p}var VUe="eigs",GUe=["config","typed","matrix","addScalar","equal","subtract","abs","atan","cos","sin","multiplyScalar","divideScalar","inv","bignumber","multiply","add","larger","column","flatten","number","complex","sqrt","diag","size","reshape","qr","usolve","usolveAll","im","re","smaller","matrixFromColumns","dot"],rP=V(VUe,GUe,e=>{var{config:t,typed:r,matrix:n,addScalar:i,subtract:a,equal:o,abs:s,atan:l,cos:u,sin:c,multiplyScalar:f,divideScalar:d,inv:p,bignumber:h,multiply:m,add:g,larger:A,column:b,flatten:v,number:x,complex:w,sqrt:S,diag:k,size:j,reshape:O,qr:C,usolve:N,usolveAll:D,im:P,re:q,smaller:z,matrixFromColumns:I,dot:T}=e,L=pAe({config:t,addScalar:i,subtract:a,column:b,flatten:v,equal:o,abs:s,atan:l,cos:u,sin:c,multiplyScalar:f,inv:p,bignumber:h,complex:w,multiply:m,add:g}),_=dAe({config:t,addScalar:i,subtract:a,multiply:m,multiplyScalar:f,flatten:v,divideScalar:d,sqrt:S,abs:s,bignumber:h,diag:k,size:j,reshape:O,qr:C,inv:p,usolve:N,usolveAll:D,equal:o,complex:w,larger:A,smaller:z,matrixFromColumns:I,dot:T});return r("eigs",{Array:function(Oe){return Y(n(Oe))},"Array, number|BigNumber":function(Oe,ve){return Y(n(Oe),{precision:ve})},"Array, Object"(Se,Oe){return Y(n(Se),Oe)},Matrix:function(Oe){return Y(Oe,{matricize:!0})},"Matrix, number|BigNumber":function(Oe,ve){return Y(Oe,{precision:ve,matricize:!0})},"Matrix, Object":function(Oe,ve){var ye={matricize:!0};return Fn(ye,ve),Y(Oe,ye)}});function Y(Se){var Oe,ve=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},ye="eigenvectors"in ve?ve.eigenvectors:!0,me=(Oe=ve.precision)!==null&&Oe!==void 0?Oe:t.epsilon,ke=oe(Se,me,ye);return ve.matricize&&(ke.values=n(ke.values),ye&&(ke.eigenvectors=ke.eigenvectors.map($=>{var{value:ae,vector:ce}=$;return{value:ae,vector:n(ce)}}))),ye&&Object.defineProperty(ke,"vectors",{enumerable:!1,get:()=>{throw new Error("eigs(M).vectors replaced with eigs(M).eigenvectors")}}),ke}function oe(Se,Oe,ve){var ye=Se.toArray(),me=Se.size();if(me.length!==2||me[0]!==me[1])throw new RangeError("Matrix must be square (size: ".concat(tr(me),")"));var ke=me[0];if(Q(ye,ke,Oe)&&(fe(ye,ke),te(ye,ke,Oe))){var $=Ie(Se,ye,ke);return L(ye,ke,Oe,$,ve)}var ae=Ie(Se,ye,ke);return _(ye,ke,Oe,ae,ve)}function te(Se,Oe,ve){for(var ye=0;ye{var{typed:t,abs:r,add:n,identity:i,inv:a,multiply:o}=e;return t(mAe,{Matrix:function(f){var d=f.size();if(d.length!==2||d[0]!==d[1])throw new RangeError("Matrix must be square (size: "+tr(d)+")");for(var p=d[0],h=1e-15,m=s(f),g=l(m,h),A=g.q,b=g.j,v=o(f,Math.pow(2,-b)),x=i(p),w=i(p),S=1,k=v,j=-1,O=1;O<=A;O++)O>1&&(k=o(k,v),j=-j),S=S*(A-O+1)/((2*A-O+1)*O),x=n(x,o(S,k)),w=n(w,o(S*j,k));for(var C=o(a(w),x),N=0;N{var{typed:t,abs:r,add:n,multiply:i,map:a,sqrt:o,subtract:s,inv:l,size:u,max:c,identity:f}=e,d=1e3,p=1e-6;function h(m){var g,A=0,b=m,v=f(u(m));do{var x=b;if(b=i(.5,n(x,l(v))),v=i(.5,n(v,l(x))),g=c(r(s(b,x))),g>p&&++A>d)throw new Error("computing square root of matrix: iterative method could not converge")}while(g>p);return b}return t(hAe,{"Array | Matrix":function(g){var A=St(g)?g.size():Yt(g);switch(A.length){case 1:if(A[0]===1)return a(g,o);throw new RangeError("Matrix must be square (size: "+tr(A)+")");case 2:{var b=A[0],v=A[1];if(b===v)return h(g);throw new RangeError("Matrix must be square (size: "+tr(A)+")")}default:throw new RangeError("Matrix must be at most two dimensional (size: "+tr(A)+")")}}})});var AAe="sylvester",ZUe=["typed","schur","matrixFromColumns","matrix","multiply","range","concat","transpose","index","subset","add","subtract","identity","lusolve","abs"],aP=V(AAe,ZUe,e=>{var{typed:t,schur:r,matrixFromColumns:n,matrix:i,multiply:a,range:o,concat:s,transpose:l,index:u,subset:c,add:f,subtract:d,identity:p,lusolve:h,abs:m}=e;return t(AAe,{"Matrix, Matrix, Matrix":g,"Array, Matrix, Matrix":function(b,v,x){return g(i(b),v,x)},"Array, Array, Matrix":function(b,v,x){return g(i(b),i(v),x)},"Array, Matrix, Array":function(b,v,x){return g(i(b),v,i(x))},"Matrix, Array, Matrix":function(b,v,x){return g(b,i(v),x)},"Matrix, Array, Array":function(b,v,x){return g(b,i(v),i(x))},"Matrix, Matrix, Array":function(b,v,x){return g(b,v,i(x))},"Array, Array, Array":function(b,v,x){return g(i(b),i(v),i(x)).toArray()}});function g(A,b,v){for(var x=b.size()[0],w=A.size()[0],S=r(A),k=S.T,j=S.U,O=r(a(-1,b)),C=O.T,N=O.U,D=a(a(l(j),v),N),P=o(0,w),q=[],z=($,ae)=>s($,ae,1),I=($,ae)=>s($,ae,0),T=0;T1e-5){for(var L=I(c(D,u(P,T)),c(D,u(P,T+1))),_=0;_{var{typed:t,matrix:r,identity:n,multiply:i,qr:a,norm:o,subtract:s}=e;return t(gAe,{Array:function(c){var f=l(r(c));return{U:f.U.valueOf(),T:f.T.valueOf()}},Matrix:function(c){return l(c)}});function l(u){var c=u.size()[0],f=u,d=n(c),p=0,h;do{h=f;var m=a(f),g=m.Q,A=m.R;if(f=i(A,g),d=i(d,g),p++>100)break}while(o(s(f,h))>1e-4);return{U:d,T:f}}});var vAe="lyap",KUe=["typed","matrix","sylvester","multiply","transpose"],sP=V(vAe,KUe,e=>{var{typed:t,matrix:r,sylvester:n,multiply:i,transpose:a}=e;return t(vAe,{"Matrix, Matrix":function(s,l){return n(s,a(s),i(-1,l))},"Array, Matrix":function(s,l){return n(r(s),a(r(s)),i(-1,l))},"Matrix, Array":function(s,l){return n(s,a(r(s)),r(i(-1,l)))},"Array, Array":function(s,l){return n(r(s),a(r(s)),r(i(-1,l))).toArray()}})});var JUe="divide",eWe=["typed","matrix","multiply","equalScalar","divideScalar","inv"],lP=V(JUe,eWe,e=>{var{typed:t,matrix:r,multiply:n,equalScalar:i,divideScalar:a,inv:o}=e,s=Gn({typed:t,equalScalar:i}),l=vo({typed:t});return t("divide",iT({"Array | Matrix, Array | Matrix":function(c,f){return n(c,o(f))},"DenseMatrix, any":function(c,f){return l(c,f,a,!1)},"SparseMatrix, any":function(c,f){return s(c,f,a,!1)},"Array, any":function(c,f){return l(r(c),f,a,!1).valueOf()},"any, Array | Matrix":function(c,f){return n(c,o(f))}},a.signatures))});var yAe="distance",tWe=["typed","addScalar","subtractScalar","divideScalar","multiplyScalar","deepEqual","sqrt","abs"],uP=V(yAe,tWe,e=>{var{typed:t,addScalar:r,subtractScalar:n,multiplyScalar:i,divideScalar:a,deepEqual:o,sqrt:s,abs:l}=e;return t(yAe,{"Array, Array, Array":function(w,S,k){if(w.length===2&&S.length===2&&k.length===2){if(!c(w))throw new TypeError("Array with 2 numbers or BigNumbers expected for first argument");if(!c(S))throw new TypeError("Array with 2 numbers or BigNumbers expected for second argument");if(!c(k))throw new TypeError("Array with 2 numbers or BigNumbers expected for third argument");if(o(S,k))throw new TypeError("LinePoint1 should not be same with LinePoint2");var j=n(k[1],S[1]),O=n(S[0],k[0]),C=n(i(k[0],S[1]),i(S[0],k[1]));return g(w[0],w[1],j,O,C)}else throw new TypeError("Invalid Arguments: Try again")},"Object, Object, Object":function(w,S,k){if(Object.keys(w).length===2&&Object.keys(S).length===2&&Object.keys(k).length===2){if(!c(w))throw new TypeError("Values of pointX and pointY should be numbers or BigNumbers");if(!c(S))throw new TypeError("Values of lineOnePtX and lineOnePtY should be numbers or BigNumbers");if(!c(k))throw new TypeError("Values of lineTwoPtX and lineTwoPtY should be numbers or BigNumbers");if(o(h(S),h(k)))throw new TypeError("LinePoint1 should not be same with LinePoint2");if("pointX"in w&&"pointY"in w&&"lineOnePtX"in S&&"lineOnePtY"in S&&"lineTwoPtX"in k&&"lineTwoPtY"in k){var j=n(k.lineTwoPtY,S.lineOnePtY),O=n(S.lineOnePtX,k.lineTwoPtX),C=n(i(k.lineTwoPtX,S.lineOnePtY),i(S.lineOnePtX,k.lineTwoPtY));return g(w.pointX,w.pointY,j,O,C)}else throw new TypeError("Key names do not match")}else throw new TypeError("Invalid Arguments: Try again")},"Array, Array":function(w,S){if(w.length===2&&S.length===3){if(!c(w))throw new TypeError("Array with 2 numbers or BigNumbers expected for first argument");if(!f(S))throw new TypeError("Array with 3 numbers or BigNumbers expected for second argument");return g(w[0],w[1],S[0],S[1],S[2])}else if(w.length===3&&S.length===6){if(!f(w))throw new TypeError("Array with 3 numbers or BigNumbers expected for first argument");if(!p(S))throw new TypeError("Array with 6 numbers or BigNumbers expected for second argument");return A(w[0],w[1],w[2],S[0],S[1],S[2],S[3],S[4],S[5])}else if(w.length===S.length&&w.length>0){if(!d(w))throw new TypeError("All values of an array should be numbers or BigNumbers");if(!d(S))throw new TypeError("All values of an array should be numbers or BigNumbers");return b(w,S)}else throw new TypeError("Invalid Arguments: Try again")},"Object, Object":function(w,S){if(Object.keys(w).length===2&&Object.keys(S).length===3){if(!c(w))throw new TypeError("Values of pointX and pointY should be numbers or BigNumbers");if(!f(S))throw new TypeError("Values of xCoeffLine, yCoeffLine and constant should be numbers or BigNumbers");if("pointX"in w&&"pointY"in w&&"xCoeffLine"in S&&"yCoeffLine"in S&&"constant"in S)return g(w.pointX,w.pointY,S.xCoeffLine,S.yCoeffLine,S.constant);throw new TypeError("Key names do not match")}else if(Object.keys(w).length===3&&Object.keys(S).length===6){if(!f(w))throw new TypeError("Values of pointX, pointY and pointZ should be numbers or BigNumbers");if(!p(S))throw new TypeError("Values of x0, y0, z0, a, b and c should be numbers or BigNumbers");if("pointX"in w&&"pointY"in w&&"x0"in S&&"y0"in S&&"z0"in S&&"a"in S&&"b"in S&&"c"in S)return A(w.pointX,w.pointY,w.pointZ,S.x0,S.y0,S.z0,S.a,S.b,S.c);throw new TypeError("Key names do not match")}else if(Object.keys(w).length===2&&Object.keys(S).length===2){if(!c(w))throw new TypeError("Values of pointOneX and pointOneY should be numbers or BigNumbers");if(!c(S))throw new TypeError("Values of pointTwoX and pointTwoY should be numbers or BigNumbers");if("pointOneX"in w&&"pointOneY"in w&&"pointTwoX"in S&&"pointTwoY"in S)return b([w.pointOneX,w.pointOneY],[S.pointTwoX,S.pointTwoY]);throw new TypeError("Key names do not match")}else if(Object.keys(w).length===3&&Object.keys(S).length===3){if(!f(w))throw new TypeError("Values of pointOneX, pointOneY and pointOneZ should be numbers or BigNumbers");if(!f(S))throw new TypeError("Values of pointTwoX, pointTwoY and pointTwoZ should be numbers or BigNumbers");if("pointOneX"in w&&"pointOneY"in w&&"pointOneZ"in w&&"pointTwoX"in S&&"pointTwoY"in S&&"pointTwoZ"in S)return b([w.pointOneX,w.pointOneY,w.pointOneZ],[S.pointTwoX,S.pointTwoY,S.pointTwoZ]);throw new TypeError("Key names do not match")}else throw new TypeError("Invalid Arguments: Try again")},Array:function(w){if(!m(w))throw new TypeError("Incorrect array format entered for pairwise distance calculation");return v(w)}});function u(x){return typeof x=="number"||It(x)}function c(x){return x.constructor!==Array&&(x=h(x)),u(x[0])&&u(x[1])}function f(x){return x.constructor!==Array&&(x=h(x)),u(x[0])&&u(x[1])&&u(x[2])}function d(x){return Array.isArray(x)||(x=h(x)),x.every(u)}function p(x){return x.constructor!==Array&&(x=h(x)),u(x[0])&&u(x[1])&&u(x[2])&&u(x[3])&&u(x[4])&&u(x[5])}function h(x){for(var w=Object.keys(x),S=[],k=0;kw.length!==2||!u(w[0])||!u(w[1])))return!1}else if(x[0].length===3&&u(x[0][0])&&u(x[0][1])&&u(x[0][2])){if(x.some(w=>w.length!==3||!u(w[0])||!u(w[1])||!u(w[2])))return!1}else return!1;return!0}function g(x,w,S,k,j){var O=l(r(r(i(S,x),i(k,w)),j)),C=s(r(i(S,S),i(k,k)));return a(O,C)}function A(x,w,S,k,j,O,C,N,D){var P=[n(i(n(j,w),D),i(n(O,S),N)),n(i(n(O,S),C),i(n(k,x),D)),n(i(n(k,x),N),i(n(j,w),C))];P=s(r(r(i(P[0],P[0]),i(P[1],P[1])),i(P[2],P[2])));var q=s(r(r(i(C,C),i(N,N)),i(D,D)));return a(P,q)}function b(x,w){for(var S=x.length,k=0,j=0,O=0;O{var{typed:t,config:r,abs:n,add:i,addScalar:a,matrix:o,multiply:s,multiplyScalar:l,divideScalar:u,subtract:c,smaller:f,equalScalar:d,flatten:p,isZero:h,isNumeric:m}=e;return t("intersect",{"Array, Array, Array":g,"Array, Array, Array, Array":A,"Matrix, Matrix, Matrix":function(N,D,P){var q=g(N.valueOf(),D.valueOf(),P.valueOf());return q===null?null:o(q)},"Matrix, Matrix, Matrix, Matrix":function(N,D,P,q){var z=A(N.valueOf(),D.valueOf(),P.valueOf(),q.valueOf());return z===null?null:o(z)}});function g(C,N,D){if(C=b(C),N=b(N),D=b(D),!x(C))throw new TypeError("Array with 3 numbers or BigNumbers expected for first argument");if(!x(N))throw new TypeError("Array with 3 numbers or BigNumbers expected for second argument");if(!w(D))throw new TypeError("Array with 4 numbers expected as third argument");return O(C[0],C[1],C[2],N[0],N[1],N[2],D[0],D[1],D[2],D[3])}function A(C,N,D,P){if(C=b(C),N=b(N),D=b(D),P=b(P),C.length===2){if(!v(C))throw new TypeError("Array with 2 numbers or BigNumbers expected for first argument");if(!v(N))throw new TypeError("Array with 2 numbers or BigNumbers expected for second argument");if(!v(D))throw new TypeError("Array with 2 numbers or BigNumbers expected for third argument");if(!v(P))throw new TypeError("Array with 2 numbers or BigNumbers expected for fourth argument");return S(C,N,D,P)}else if(C.length===3){if(!x(C))throw new TypeError("Array with 3 numbers or BigNumbers expected for first argument");if(!x(N))throw new TypeError("Array with 3 numbers or BigNumbers expected for second argument");if(!x(D))throw new TypeError("Array with 3 numbers or BigNumbers expected for third argument");if(!x(P))throw new TypeError("Array with 3 numbers or BigNumbers expected for fourth argument");return j(C[0],C[1],C[2],N[0],N[1],N[2],D[0],D[1],D[2],P[0],P[1],P[2])}else throw new TypeError("Arrays with two or thee dimensional points expected")}function b(C){return C.length===1?C[0]:C.length>1&&Array.isArray(C[0])&&C.every(N=>Array.isArray(N)&&N.length===1)?p(C):C}function v(C){return C.length===2&&m(C[0])&&m(C[1])}function x(C){return C.length===3&&m(C[0])&&m(C[1])&&m(C[2])}function w(C){return C.length===4&&m(C[0])&&m(C[1])&&m(C[2])&&m(C[3])}function S(C,N,D,P){var q=C,z=D,I=c(q,N),T=c(z,P),L=c(l(I[0],T[1]),l(T[0],I[1]));if(h(L)||f(n(L),r.epsilon))return null;var _=l(T[0],q[1]),Y=l(T[1],q[0]),oe=l(T[0],z[1]),te=l(T[1],z[0]),Q=u(a(c(c(_,Y),oe),te),L);return i(s(I,Q),q)}function k(C,N,D,P,q,z,I,T,L,_,Y,oe){var te=l(c(C,N),c(D,P)),Q=l(c(q,z),c(I,T)),fe=l(c(L,_),c(Y,oe));return a(a(te,Q),fe)}function j(C,N,D,P,q,z,I,T,L,_,Y,oe){var te=k(C,I,_,I,N,T,Y,T,D,L,oe,L),Q=k(_,I,P,C,Y,T,q,N,oe,L,z,D),fe=k(C,I,P,C,N,T,q,N,D,L,z,D),Ie=k(_,I,_,I,Y,T,Y,T,oe,L,oe,L),Se=k(P,C,P,C,q,N,q,N,z,D,z,D),Oe=c(l(te,Q),l(fe,Ie)),ve=c(l(Se,Ie),l(Q,Q));if(h(ve))return null;var ye=u(Oe,ve),me=u(a(te,l(ye,Q)),Ie),ke=a(C,l(ye,c(P,C))),$=a(N,l(ye,c(q,N))),ae=a(D,l(ye,c(z,D))),ce=a(I,l(me,c(_,I))),U=a(T,l(me,c(Y,T))),R=a(L,l(me,c(oe,L)));return d(ke,ce)&&d($,U)&&d(ae,R)?[ke,$,ae]:null}function O(C,N,D,P,q,z,I,T,L,_){var Y=l(C,I),oe=l(P,I),te=l(N,T),Q=l(q,T),fe=l(D,L),Ie=l(z,L),Se=c(c(c(_,Y),te),fe),Oe=c(c(c(a(a(oe,Q),Ie),Y),te),fe),ve=u(Se,Oe),ye=a(C,l(ve,c(P,C))),me=a(N,l(ve,c(q,N))),ke=a(D,l(ve,c(z,D)));return[ye,me,ke]}});var bAe="sum",iWe=["typed","config","add","numeric"],CS=V(bAe,iWe,e=>{var{typed:t,config:r,add:n,numeric:i}=e;return t(bAe,{"Array | Matrix":a,"Array | Matrix, number | BigNumber":o,"...":function(l){if(Cd(l))throw new TypeError("Scalar values expected in function sum");return a(l)}});function a(s){var l;return au(s,function(u){try{l=l===void 0?u:n(l,u)}catch(c){throw La(c,"sum",u)}}),l===void 0&&(l=i(0,r.number)),typeof l=="string"&&(l=i(l,r.number)),l}function o(s,l){try{var u=V0(s,l,n);return u}catch(c){throw La(c,"sum")}}});var fP="cumsum",aWe=["typed","add","unaryPlus"],DS=V(fP,aWe,e=>{var{typed:t,add:r,unaryPlus:n}=e;return t(fP,{Array:i,Matrix:function(u){return u.create(i(u.valueOf()))},"Array, number | BigNumber":o,"Matrix, number | BigNumber":function(u,c){return u.create(o(u.valueOf(),c))},"...":function(u){if(Cd(u))throw new TypeError("All values expected to be scalar in function cumsum");return i(u)}});function i(l){try{return a(l)}catch(u){throw La(u,fP)}}function a(l){if(l.length===0)return[];for(var u=[n(l[0])],c=1;c=c.length)throw new As(u,c.length);try{return s(l,u)}catch(f){throw La(f,fP)}}function s(l,u){var c,f,d;if(u<=0){var p=l[0][0];if(Array.isArray(p)){for(d=_T(l),f=[],c=0;c{var{typed:t,add:r,divide:n}=e;return t(xAe,{"Array | Matrix":a,"Array | Matrix, number | BigNumber":i,"...":function(s){if(Cd(s))throw new TypeError("Scalar values expected in function mean");return a(s)}});function i(o,s){try{var l=V0(o,s,r),u=Array.isArray(o)?Yt(o):o.size();return n(l,u[s])}catch(c){throw La(c,"mean")}}function a(o){var s,l=0;if(au(o,function(u){try{s=s===void 0?u:r(s,u),l++}catch(c){throw La(c,"mean",u)}}),l===0)throw new Error("Cannot calculate the mean of an empty array");return n(s,l)}});var wAe="median",sWe=["typed","add","divide","compare","partitionSelect"],dP=V(wAe,sWe,e=>{var{typed:t,add:r,divide:n,compare:i,partitionSelect:a}=e;function o(u){try{u=mr(u.valueOf());var c=u.length;if(c===0)throw new Error("Cannot calculate median of an empty array");if(c%2===0){for(var f=c/2-1,d=a(u,f+1),p=u[f],h=0;h0&&(p=u[h]);return l(p,d)}else{var m=a(u,(c-1)/2);return s(m)}}catch(g){throw La(g,"median")}}var s=t({"number | BigNumber | Complex | Unit":function(c){return c}}),l=t({"number | BigNumber | Complex | Unit, number | BigNumber | Complex | Unit":function(c,f){return n(r(c,f),2)}});return t(wAe,{"Array | Matrix":o,"Array | Matrix, number | BigNumber":function(c,f){throw new Error("median(A, dim) is not yet supported")},"...":function(c){if(Cd(c))throw new TypeError("Scalar values expected in function median");return o(c)}})});var SAe="mad",lWe=["typed","abs","map","median","subtract"],pP=V(SAe,lWe,e=>{var{typed:t,abs:r,map:n,median:i,subtract:a}=e;return t(SAe,{"Array | Matrix":o,"...":function(l){return o(l)}});function o(s){if(s=mr(s.valueOf()),s.length===0)throw new Error("Cannot calculate median absolute deviation (mad) of an empty array");try{var l=i(s);return i(n(s,function(u){return r(a(u,l))}))}catch(u){throw u instanceof TypeError&&u.message.indexOf("median")!==-1?new TypeError(u.message.replace("median","mad")):La(u,"mad")}}});var TH="unbiased",EAe="variance",uWe=["typed","add","subtract","multiply","divide","apply","isNaN"],MS=V(EAe,uWe,e=>{var{typed:t,add:r,subtract:n,multiply:i,divide:a,apply:o,isNaN:s}=e;return t(EAe,{"Array | Matrix":function(f){return l(f,TH)},"Array | Matrix, string":l,"Array | Matrix, number | BigNumber":function(f,d){return u(f,d,TH)},"Array | Matrix, number | BigNumber, string":u,"...":function(f){return l(f,TH)}});function l(c,f){var d,p=0;if(c.length===0)throw new SyntaxError("Function variance requires one or more parameters (0 provided)");if(au(c,function(g){try{d=d===void 0?g:r(d,g),p++}catch(A){throw La(A,"variance",g)}}),p===0)throw new Error("Cannot calculate variance of an empty array");var h=a(d,p);if(d=void 0,au(c,function(g){var A=n(g,h);d=d===void 0?i(A,A):r(d,i(A,A))}),s(d))return d;switch(f){case"uncorrected":return a(d,p);case"biased":return a(d,p+1);case"unbiased":{var m=It(d)?d.mul(0):0;return p===1?m:a(d,p-1)}default:throw new Error('Unknown normalization "'+f+'". Choose "unbiased" (default), "uncorrected", or "biased".')}}function u(c,f,d){try{if(c.length===0)throw new SyntaxError("Function variance requires one or more parameters (0 provided)");return o(c,f,p=>l(p,d))}catch(p){throw La(p,"variance")}}});var kAe="quantileSeq",cWe=["typed","?bignumber","add","subtract","divide","multiply","partitionSelect","compare","isInteger","smaller","smallerEq","larger"],jS=V(kAe,cWe,e=>{var{typed:t,bignumber:r,add:n,subtract:i,divide:a,multiply:o,partitionSelect:s,compare:l,isInteger:u,smaller:c,smallerEq:f,larger:d}=e,p=G0({typed:t,isInteger:u});return t(kAe,{"Array | Matrix, number | BigNumber":(b,v)=>m(b,v,!1),"Array | Matrix, number | BigNumber, number":(b,v,x)=>h(b,v,!1,x,m),"Array | Matrix, number | BigNumber, boolean":m,"Array | Matrix, number | BigNumber, boolean, number":(b,v,x,w)=>h(b,v,x,w,m),"Array | Matrix, Array | Matrix":(b,v)=>g(b,v,!1),"Array | Matrix, Array | Matrix, number":(b,v,x)=>h(b,v,!1,x,g),"Array | Matrix, Array | Matrix, boolean":g,"Array | Matrix, Array | Matrix, boolean, number":(b,v,x,w)=>h(b,v,x,w,g)});function h(b,v,x,w,S){return p(b,w,k=>S(k,v,x))}function m(b,v,x){var w,S=b.valueOf();if(c(v,0))throw new Error("N/prob must be non-negative");if(f(v,1))return Qt(v)?A(S,v,x):r(A(S,v,x));if(d(v,1)){if(!u(v))throw new Error("N must be a positive integer");if(d(v,4294967295))throw new Error("N must be less than or equal to 2^32-1, as that is the maximum length of an Array");var k=n(v,1);w=[];for(var j=0;c(j,v);j++){var O=a(j+1,k);w.push(A(S,O,x))}return Qt(v)?w:r(w)}}function g(b,v,x){for(var w=b.valueOf(),S=v.valueOf(),k=[],j=0;j0&&(C=w[D])}return n(o(C,i(1,O)),o(N,O))}});var CAe="std",fWe=["typed","map","sqrt","variance"],NS=V(CAe,fWe,e=>{var{typed:t,map:r,sqrt:n,variance:i}=e;return t(CAe,{"Array | Matrix":a,"Array | Matrix, string":a,"Array | Matrix, number | BigNumber":a,"Array | Matrix, number | BigNumber, string":a,"...":function(s){return a(s)}});function a(o,s){if(o.length===0)throw new SyntaxError("Function std requires one or more parameters (0 provided)");try{var l=i.apply(null,arguments);return Da(l)?r(l,n):n(l)}catch(u){throw u instanceof TypeError&&u.message.indexOf(" variance")!==-1?new TypeError(u.message.replace(" variance"," std")):u}}});var DAe="corr",dWe=["typed","matrix","mean","sqrt","sum","add","subtract","multiply","pow","divide"],mP=V(DAe,dWe,e=>{var{typed:t,matrix:r,sqrt:n,sum:i,add:a,subtract:o,multiply:s,pow:l,divide:u}=e;return t(DAe,{"Array, Array":function(p,h){return c(p,h)},"Matrix, Matrix":function(p,h){var m=c(p.toArray(),h.toArray());return Array.isArray(m)?r(m):m}});function c(d,p){var h=[];if(Array.isArray(d[0])&&Array.isArray(p[0])){if(d.length!==p.length)throw new SyntaxError("Dimension mismatch. Array A and B must have the same length.");for(var m=0;ma(S,s(k,p[j])),0),b=i(d.map(S=>l(S,2))),v=i(p.map(S=>l(S,2))),x=o(s(h,A),s(m,g)),w=n(s(o(s(h,b),l(m,2)),o(s(h,v),l(g,2))));return u(x,w)}});var OAe="combinations",pWe=["typed"],hP=V(OAe,pWe,e=>{var{typed:t}=e;return t(OAe,{"number, number":HW,"BigNumber, BigNumber":function(n,i){var a=n.constructor,o,s,l=n.minus(i),u=new a(1);if(!MAe(n)||!MAe(i))throw new TypeError("Positive integer value expected in function combinations");if(i.gt(n))throw new TypeError("k must be less than n in function combinations");if(o=u,i.lt(l))for(s=u;s.lte(l);s=s.plus(u))o=o.times(i.plus(s)).dividedBy(s);else for(s=u;s.lte(i);s=s.plus(u))o=o.times(l.plus(s)).dividedBy(s);return o}})});function MAe(e){return e.isInteger()&&e.gte(0)}var jAe="combinationsWithRep",mWe=["typed"],AP=V(jAe,mWe,e=>{var{typed:t}=e;return t(jAe,{"number, number":function(n,i){if(!wt(n)||n<0)throw new TypeError("Positive integer value expected in function combinationsWithRep");if(!wt(i)||i<0)throw new TypeError("Positive integer value expected in function combinationsWithRep");if(n<1)throw new TypeError("k must be less than or equal to n + k - 1");if(i{var{typed:t,config:r,multiplyScalar:n,pow:i,BigNumber:a,Complex:o}=e;function s(u){if(u.im===0)return Q6(u.re);if(u.re<.5){var c=new o(1-u.re,-u.im),f=new o(Math.PI*u.re,Math.PI*u.im);return new o(Math.PI).div(f.sin()).div(s(c))}u=new o(u.re-1,u.im);for(var d=new o(Ey[0],0),p=1;p2;)d-=2,h+=d,p=p.times(h);return new a(p.toPrecision(a.precision))}});var FAe="lgamma",AWe=["Complex","typed"],vP=V(FAe,AWe,e=>{var{Complex:t,typed:r}=e,n=7,i=7,a=[-.029550653594771242,.00641025641025641,-.0019175269175269176,.0008417508417508417,-.0005952380952380953,.0007936507936507937,-.002777777777777778,.08333333333333333];return r(FAe,{number:Y6,Complex:o,BigNumber:function(){throw new Error("mathjs doesn't yet provide an implementation of the algorithm lgamma for BigNumber")}});function o(u){var c=6.283185307179586,f=1.1447298858494002,d=.1;if(u.isNaN())return new t(NaN,NaN);if(u.im===0)return new t(Y6(u.re),0);if(u.re>=n||Math.abs(u.im)>=i)return s(u);if(u.re<=d){var p=cse(c,u.im)*Math.floor(.5*u.re+.25),h=u.mul(Math.PI).sin().log(),m=o(new t(1-u.re,-u.im));return new t(f,p).sub(h).sub(m)}else return u.im>=0?l(u):l(u.conjugate()).conjugate()}function s(u){for(var c=u.sub(.5).mul(u.log()).sub(u).add(KW),f=new t(1,0).div(u),d=f.div(u),p=a[0],h=a[1],m=2*d.re,g=d.re*d.re+d.im*d.im,A=2;A<8;A++){var b=h;h=-g*p+a[A],p=m*p+b}var v=f.mul(d.mul(p).add(h));return c.add(v)}function l(u){var c=0,f=0,d=u;for(u=u.add(1);u.re<=n;){d=d.mul(u);var p=d.im<0?1:0;p!==0&&f===0&&c++,f=p,u=u.add(1)}return s(u).sub(d.log()).sub(new t(0,c*2*Math.PI*1))}});var _Ae="factorial",gWe=["typed","gamma"],yP=V(_Ae,gWe,e=>{var{typed:t,gamma:r}=e;return t(_Ae,{number:function(i){if(i<0)throw new Error("Value must be non-negative");return r(i+1)},BigNumber:function(i){if(i.isNegative())throw new Error("Value must be non-negative");return r(i.plus(1))},"Array | Matrix":t.referToSelf(n=>i=>jt(i,n))})});var PAe="kldivergence",vWe=["typed","matrix","divide","sum","multiply","map","dotDivide","log","isNumeric"],bP=V(PAe,vWe,e=>{var{typed:t,matrix:r,divide:n,sum:i,multiply:a,map:o,dotDivide:s,log:l,isNumeric:u}=e;return t(PAe,{"Array, Array":function(d,p){return c(r(d),r(p))},"Matrix, Array":function(d,p){return c(d,r(p))},"Array, Matrix":function(d,p){return c(r(d),p)},"Matrix, Matrix":function(d,p){return c(d,p)}});function c(f,d){var p=d.size().length,h=f.size().length;if(p>1)throw new Error("first object must be one dimensional");if(h>1)throw new Error("second object must be one dimensional");if(p!==h)throw new Error("Length of two vectors must be equal");var m=i(f);if(m===0)throw new Error("Sum of elements in first object must be non zero");var g=i(d);if(g===0)throw new Error("Sum of elements in second object must be non zero");var A=n(f,i(f)),b=n(d,i(d)),v=i(a(A,o(s(A,b),x=>l(x))));return u(v)?v:Number.NaN}});var IAe="multinomial",yWe=["typed","add","divide","multiply","factorial","isInteger","isPositive"],xP=V(IAe,yWe,e=>{var{typed:t,add:r,divide:n,multiply:i,factorial:a,isInteger:o,isPositive:s}=e;return t(IAe,{"Array | Matrix":function(u){var c=0,f=1;return au(u,function(d){if(!o(d)||!s(d))throw new TypeError("Positive integer value expected in function multinomial");c=r(c,d),f=i(f,a(d))}),n(a(c),f)}})});var BAe="permutations",bWe=["typed","factorial"],wP=V(BAe,bWe,e=>{var{typed:t,factorial:r}=e;return t(BAe,{"number | BigNumber":r,"number, number":function(i,a){if(!wt(i)||i<0)throw new TypeError("Positive integer value expected in function permutations");if(!wt(a)||a<0)throw new TypeError("Positive integer value expected in function permutations");if(a>i)throw new TypeError("second argument k must be less than or equal to first argument n");return yf(i-a+1,i)},"BigNumber, BigNumber":function(i,a){var o,s;if(!RAe(i)||!RAe(a))throw new TypeError("Positive integer value expected in function permutations");if(a.gt(i))throw new TypeError("second argument k must be less than or equal to first argument n");var l=i.mul(0).add(1);for(o=l,s=i.minus(a).plus(1);s.lte(i);s=s.plus(1))o=o.times(s);return o}})});function RAe(e){return e.isInteger()&&e.gte(0)}var $H=Ae(ege(),1),DWe=(0,$H.default)(Date.now());function VA(e){var t;function r(i){t=i===null?DWe:(0,$H.default)(String(i))}r(e);function n(){return t()}return n}var tge="pickRandom",OWe=["typed","config","?on"],EP=V(tge,OWe,e=>{var{typed:t,config:r,on:n}=e,i=VA(r.randomSeed);return n&&n("config",function(o,s){o.randomSeed!==s.randomSeed&&(i=VA(o.randomSeed))}),t(tge,{"Array | Matrix":function(s){return a(s,{})},"Array | Matrix, Object":function(s,l){return a(s,l)},"Array | Matrix, number":function(s,l){return a(s,{number:l})},"Array | Matrix, Array | Matrix":function(s,l){return a(s,{weights:l})},"Array | Matrix, Array | Matrix, number":function(s,l,u){return a(s,{number:u,weights:l})},"Array | Matrix, number, Array | Matrix":function(s,l,u){return a(s,{number:l,weights:u})}});function a(o,s){var{number:l,weights:u,elementWise:c=!0}=s,f=typeof l>"u";f&&(l=1);var d=St(o)?o.create:St(u)?u.create:null;o=o.valueOf(),u&&(u=u.valueOf()),c===!0&&(o=mr(o),u=mr(u));var p=0;if(typeof u<"u"){if(u.length!==o.length)throw new Error("Weights must have the same length as possibles");for(var h=0,m=u.length;h"u")b=o[Math.floor(i()*g)];else for(var v=i()*p,x=0,w=o.length;x1)for(var n=0,i=e.shift();n{var{typed:t,config:r,on:n}=e,i=VA(r.randomSeed);return n&&n("config",function(s,l){s.randomSeed!==l.randomSeed&&(i=VA(s.randomSeed))}),t(rge,{"":()=>o(0,1),number:s=>o(0,s),"number, number":(s,l)=>o(s,l),"Array | Matrix":s=>a(s,0,1),"Array | Matrix, number":(s,l)=>a(s,0,l),"Array | Matrix, number, number":(s,l,u)=>a(s,l,u)});function a(s,l,u){var c=eC(s.valueOf(),()=>o(l,u));return St(s)?s.create(c):c}function o(s,l){return s+i()*(l-s)}});var nge="randomInt",jWe=["typed","config","?on"],CP=V(nge,jWe,e=>{var{typed:t,config:r,on:n}=e,i=VA(r.randomSeed);return n&&n("config",function(s,l){s.randomSeed!==l.randomSeed&&(i=VA(s.randomSeed))}),t(nge,{"":()=>o(0,1),number:s=>o(0,s),"number, number":(s,l)=>o(s,l),"Array | Matrix":s=>a(s,0,1),"Array | Matrix, number":(s,l)=>a(s,0,l),"Array | Matrix, number, number":(s,l,u)=>a(s,l,u)});function a(s,l,u){var c=eC(s.valueOf(),()=>o(l,u));return St(s)?s.create(c):c}function o(s,l){return Math.floor(s+i()*(l-s))}});var ige="stirlingS2",NWe=["typed","addScalar","subtractScalar","multiplyScalar","divideScalar","pow","factorial","combinations","isNegative","isInteger","number","?bignumber","larger"],DP=V(ige,NWe,e=>{var{typed:t,addScalar:r,subtractScalar:n,multiplyScalar:i,divideScalar:a,pow:o,factorial:s,combinations:l,isNegative:u,isInteger:c,number:f,bignumber:d,larger:p}=e,h=[],m=[];return t(ige,{"number | BigNumber, number | BigNumber":function(A,b){if(!c(A)||u(A)||!c(b)||u(b))throw new TypeError("Non-negative integer value expected in function stirlingS2");if(p(b,A))throw new TypeError("k must be less than or equal to n in function stirlingS2");var v=!(Qt(A)&&Qt(b)),x=v?m:h,w=v?d:f,S=f(A),k=f(b);if(x[S]&&x[S].length>k)return x[S][k];for(var j=0;j<=S;++j)if(x[j]||(x[j]=[w(j===0?1:0)]),j!==0)for(var O=x[j],C=x[j-1],N=O.length;N<=j&&N<=k;++N)N===j?O[N]=1:O[N]=r(i(w(N),C[N]),C[N-1]);return x[S][k]}})});var age="bellNumbers",TWe=["typed","addScalar","isNegative","isInteger","stirlingS2"],OP=V(age,TWe,e=>{var{typed:t,addScalar:r,isNegative:n,isInteger:i,stirlingS2:a}=e;return t(age,{"number | BigNumber":function(s){if(!i(s)||n(s))throw new TypeError("Non-negative integer value expected in function bellNumbers");for(var l=0,u=0;u<=s;u++)l=r(l,a(s,u));return l}})});var oge="catalan",FWe=["typed","addScalar","divideScalar","multiplyScalar","combinations","isNegative","isInteger"],MP=V(oge,FWe,e=>{var{typed:t,addScalar:r,divideScalar:n,multiplyScalar:i,combinations:a,isNegative:o,isInteger:s}=e;return t(oge,{"number | BigNumber":function(u){if(!s(u)||o(u))throw new TypeError("Non-negative integer value expected in function catalan");return n(a(i(u,2),u),r(u,1))}})});var sge="composition",_We=["typed","addScalar","combinations","isNegative","isPositive","isInteger","larger"],jP=V(sge,_We,e=>{var{typed:t,addScalar:r,combinations:n,isPositive:i,isNegative:a,isInteger:o,larger:s}=e;return t(sge,{"number | BigNumber, number | BigNumber":function(u,c){if(!o(u)||!i(u)||!o(c)||!i(c))throw new TypeError("Positive integer value expected in function composition");if(s(c,u))throw new TypeError("k must be less than or equal to n in function composition");return n(r(u,-1),r(c,-1))}})});var lge="leafCount",PWe=["parse","typed"],NP=V(lge,PWe,e=>{var{parse:t,typed:r}=e;function n(i){var a=0;return i.forEach(o=>{a+=n(o)}),a||1}return r(lge,{Node:function(a){return n(a)}})});function qH(e){return gr(e)||bi(e)&&e.isUnary()&&gr(e.args[0])}function tC(e){return!!(gr(e)||(xl(e)||bi(e))&&e.args.every(tC)||ms(e)&&tC(e.content))}function uge(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function LH(e){for(var t=1;t{var{FunctionNode:t,OperatorNode:r,SymbolNode:n}=e,i=!0,a=!1,o="defaultF",s={add:{trivial:i,total:i,commutative:i,associative:i},unaryPlus:{trivial:i,total:i,commutative:i,associative:i},subtract:{trivial:a,total:i,commutative:a,associative:a},multiply:{trivial:i,total:i,commutative:i,associative:i},divide:{trivial:a,total:i,commutative:a,associative:a},paren:{trivial:i,total:i,commutative:i,associative:a},defaultF:{trivial:a,total:i,commutative:a,associative:a}},l={divide:{total:a},log:{total:a}},u={subtract:{total:a},abs:{trivial:i},log:{total:i}};function c(v,x){var w=arguments.length>2&&arguments[2]!==void 0?arguments[2]:s,S=o;if(typeof v=="string"?S=v:bi(v)?S=v.fn.toString():xl(v)?S=v.name:ms(v)&&(S="paren"),Et(w,S)){var k=w[S];if(Et(k,x))return k[x];if(Et(s,S))return s[S][x]}if(Et(w,o)){var j=w[o];return Et(j,x)?j[x]:s[o][x]}if(Et(s,S)){var O=s[S];if(Et(O,x))return O[x]}return s[o][x]}function f(v){var x=arguments.length>1&&arguments[1]!==void 0?arguments[1]:s;return c(v,"commutative",x)}function d(v){var x=arguments.length>1&&arguments[1]!==void 0?arguments[1]:s;return c(v,"associative",x)}function p(v,x){var w=LH({},v);for(var S in x)Et(v,S)?w[S]=LH(LH({},x[S]),v[S]):w[S]=x[S];return w}function h(v,x){if(!v.args||v.args.length===0)return v;v.args=m(v,x);for(var w=0;w2&&d(v,x)){for(var j=v.args.pop();v.args.length>0;)j=w([v.args.pop(),j]);v.args=j.args}}}function A(v,x){if(!(!v.args||v.args.length===0)){for(var w=b(v),S=v.args.length,k=0;k2&&d(v,x)){for(var j=v.args.shift();v.args.length>0;)j=w([j,v.args.shift()]);v.args=j.args}}}function b(v){return bi(v)?function(x){try{return new r(v.op,v.fn,x,v.implicit)}catch(w){return console.error(w),[]}}:function(x){return new t(new n(v.name),x)}}return{createMakeNodeFunction:b,hasProperty:c,isCommutative:f,isAssociative:d,mergeContext:p,flatten:h,allChildren:m,unflattenr:g,unflattenl:A,defaultContext:s,realContext:l,positiveContext:u}});var RWe="simplify",$We=["config","typed","parse","add","subtract","multiply","divide","pow","isZero","equal","resolve","simplifyConstant","simplifyCore","?fraction","?bignumber","mathWithTransform","matrix","AccessorNode","ArrayNode","ConstantNode","FunctionNode","IndexNode","ObjectNode","OperatorNode","ParenthesisNode","SymbolNode"],TP=V(RWe,$We,e=>{var{config:t,typed:r,parse:n,add:i,subtract:a,multiply:o,divide:s,pow:l,isZero:u,equal:c,resolve:f,simplifyConstant:d,simplifyCore:p,fraction:h,bignumber:m,mathWithTransform:g,matrix:A,AccessorNode:b,ArrayNode:v,ConstantNode:x,FunctionNode:w,IndexNode:S,ObjectNode:k,OperatorNode:j,ParenthesisNode:O,SymbolNode:C}=e,{hasProperty:N,isCommutative:D,isAssociative:P,mergeContext:q,flatten:z,unflattenr:I,unflattenl:T,createMakeNodeFunction:L,defaultContext:_,realContext:Y,positiveContext:oe}=TS({FunctionNode:w,OperatorNode:j,SymbolNode:C});r.addConversion({from:"Object",to:"Map",convert:zA});var te=r("simplify",{Node:ye,"Node, Map":(ee,ie)=>ye(ee,!1,ie),"Node, Map, Object":(ee,ie,re)=>ye(ee,!1,ie,re),"Node, Array":ye,"Node, Array, Map":ye,"Node, Array, Map, Object":ye});r.removeConversion({from:"Object",to:"Map",convert:zA}),te.defaultContext=_,te.realContext=Y,te.positiveContext=oe;function Q(ee){return ee.transform(function(ie,re,Ee){return ms(ie)?Q(ie.content):ie})}var fe={true:!0,false:!0,e:!0,i:!0,Infinity:!0,LN2:!0,LN10:!0,LOG2E:!0,LOG10E:!0,NaN:!0,phi:!0,pi:!0,SQRT1_2:!0,SQRT2:!0,tau:!0};te.rules=[p,{l:"log(e)",r:"1"},{s:"n-n1 -> n+-n1",assuming:{subtract:{total:!0}}},{s:"n-n -> 0",assuming:{subtract:{total:!1}}},{s:"-(cl*v) -> v * (-cl)",assuming:{multiply:{commutative:!0},subtract:{total:!0}}},{s:"-(cl*v) -> (-cl) * v",assuming:{multiply:{commutative:!1},subtract:{total:!0}}},{s:"-(v*cl) -> v * (-cl)",assuming:{multiply:{commutative:!1},subtract:{total:!0}}},{l:"-(n1/n2)",r:"-n1/n2"},{l:"-v",r:"v * (-1)"},{l:"(n1 + n2)*(-1)",r:"n1*(-1) + n2*(-1)",repeat:!0},{l:"n/n1^n2",r:"n*n1^-n2"},{l:"n/n1",r:"n*n1^-1"},{s:"(n1*n2)^n3 -> n1^n3 * n2^n3",assuming:{multiply:{commutative:!0}}},{s:"(n1*n2)^(-1) -> n2^(-1) * n1^(-1)",assuming:{multiply:{commutative:!1}}},{s:"(n ^ n1) ^ n2 -> n ^ (n1 * n2)",assuming:{divide:{total:!0}}},{l:" vd * ( vd * n1 + n2)",r:"vd^2 * n1 + vd * n2"},{s:" vd * (vd^n4 * n1 + n2) -> vd^(1+n4) * n1 + vd * n2",assuming:{divide:{total:!0}}},{s:"vd^n3 * ( vd * n1 + n2) -> vd^(n3+1) * n1 + vd^n3 * n2",assuming:{divide:{total:!0}}},{s:"vd^n3 * (vd^n4 * n1 + n2) -> vd^(n3+n4) * n1 + vd^n3 * n2",assuming:{divide:{total:!0}}},{l:"n*n",r:"n^2"},{s:"n * n^n1 -> n^(n1+1)",assuming:{divide:{total:!0}}},{s:"n^n1 * n^n2 -> n^(n1+n2)",assuming:{divide:{total:!0}}},d,{s:"n+n -> 2*n",assuming:{add:{total:!0}}},{l:"n+-n",r:"0"},{l:"vd*n + vd",r:"vd*(n+1)"},{l:"n3*n1 + n3*n2",r:"n3*(n1+n2)"},{l:"n3^(-n4)*n1 + n3 * n2",r:"n3^(-n4)*(n1 + n3^(n4+1) *n2)"},{l:"n3^(-n4)*n1 + n3^n5 * n2",r:"n3^(-n4)*(n1 + n3^(n4+n5)*n2)"},{s:"n*vd + vd -> (n+1)*vd",assuming:{multiply:{commutative:!1}}},{s:"vd + n*vd -> (1+n)*vd",assuming:{multiply:{commutative:!1}}},{s:"n1*n3 + n2*n3 -> (n1+n2)*n3",assuming:{multiply:{commutative:!1}}},{s:"n^n1 * n -> n^(n1+1)",assuming:{divide:{total:!0},multiply:{commutative:!1}}},{s:"n1*n3^(-n4) + n2 * n3 -> (n1 + n2*n3^(n4 + 1))*n3^(-n4)",assuming:{multiply:{commutative:!1}}},{s:"n1*n3^(-n4) + n2 * n3^n5 -> (n1 + n2*n3^(n4 + n5))*n3^(-n4)",assuming:{multiply:{commutative:!1}}},{l:"n*cd + cd",r:"(n+1)*cd"},{s:"cd*n + cd -> cd*(n+1)",assuming:{multiply:{commutative:!1}}},{s:"cd + cd*n -> cd*(1+n)",assuming:{multiply:{commutative:!1}}},d,{s:"(-n)*n1 -> -(n*n1)",assuming:{subtract:{total:!0}}},{s:"n1*(-n) -> -(n1*n)",assuming:{subtract:{total:!0},multiply:{commutative:!1}}},{s:"ce+ve -> ve+ce",assuming:{add:{commutative:!0}},imposeContext:{add:{commutative:!1}}},{s:"vd*cd -> cd*vd",assuming:{multiply:{commutative:!0}},imposeContext:{multiply:{commutative:!1}}},{l:"n+-n1",r:"n-n1"},{l:"n+-(n1)",r:"n-(n1)"},{s:"n*(n1^-1) -> n/n1",assuming:{multiply:{commutative:!0}}},{s:"n*n1^-n2 -> n/n1^n2",assuming:{multiply:{commutative:!0}}},{s:"n^-1 -> 1/n",assuming:{multiply:{commutative:!0}}},{l:"n^1",r:"n"},{s:"n*(n1/n2) -> (n*n1)/n2",assuming:{multiply:{associative:!0}}},{s:"n-(n1+n2) -> n-n1-n2",assuming:{addition:{associative:!0,commutative:!0}}},{l:"1*n",r:"n",imposeContext:{multiply:{commutative:!0}}},{s:"n1/(n2/n3) -> (n1*n3)/n2",assuming:{multiply:{associative:!0}}},{l:"n1/(-n2)",r:"-n1/n2"}];function Ie(ee,ie){var re={};if(ee.s){var Ee=ee.s.split("->");if(Ee.length===2)re.l=Ee[0],re.r=Ee[1];else throw SyntaxError("Could not parse rule: "+ee.s)}else re.l=ee.l,re.r=ee.r;re.l=Q(n(re.l)),re.r=Q(n(re.r));for(var Ce of["imposeContext","repeat","assuming"])Ce in ee&&(re[Ce]=ee[Ce]);if(ee.evaluate&&(re.evaluate=n(ee.evaluate)),P(re.l,ie)){var _e=!D(re.l,ie),he;_e&&(he=ve());var ze=L(re.l),Ye=ve();re.expanded={},re.expanded.l=ze([re.l,Ye]),z(re.expanded.l,ie),I(re.expanded.l,ie),re.expanded.r=ze([re.r,Ye]),_e&&(re.expandedNC1={},re.expandedNC1.l=ze([he,re.l]),re.expandedNC1.r=ze([he,re.r]),re.expandedNC2={},re.expandedNC2.l=ze([he,re.expanded.l]),re.expandedNC2.r=ze([he,re.expanded.r]))}return re}function Se(ee,ie){for(var re=[],Ee=0;Ee2&&arguments[2]!==void 0?arguments[2]:L0(),Ee=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{},Ce=Ee.consoleDebug;ie=Se(ie||te.rules,Ee.context);var _e=f(ee,re);_e=Q(_e);for(var he={},ze=_e.toString({parenthesis:"all"});!he[ze];){he[ze]=!0,Oe=0;var Ye=ze;Ce&&console.log("Working on: ",ze);for(var tt=0;tt ").concat(ie[tt].r.toString()))),Ce){var we=_e.toString({parenthesis:"all"});we!==Ye&&(console.log("Applying",Ct,"produced",we),Ye=we)}T(_e,Ee.context)}ze=_e.toString({parenthesis:"all"})}return _e}function me(ee,ie,re){var Ee=ee;if(ee)for(var Ce=0;Ce1&&(Ye=_e(ee.args.slice(0,ze))),Ce=ee.args.slice(ze),Ee=Ce.length===1?Ce[0]:_e(Ce),re.push(_e([Ye,Ee]))}return re}function ae(ee,ie){var re={placeholders:{}};if(!ee.placeholders&&!ie.placeholders)return re;if(ee.placeholders){if(!ie.placeholders)return ee}else return ie;for(var Ee in ee.placeholders)if(Et(ee.placeholders,Ee)&&(re.placeholders[Ee]=ee.placeholders[Ee],Et(ie.placeholders,Ee)&&!J(ee.placeholders[Ee],ie.placeholders[Ee])))return null;for(var Ce in ie.placeholders)Et(ie.placeholders,Ce)&&(re.placeholders[Ce]=ie.placeholders[Ce]);return re}function ce(ee,ie){var re=[];if(ee.length===0||ie.length===0)return re;for(var Ee,Ce=0;Ce2)throw new Error("permuting >2 commutative non-associative rule arguments not yet implemented");var Ye=R(ee.args[0],ie.args[1],re);if(Ye.length===0)return[];var tt=R(ee.args[1],ie.args[0],re);if(tt.length===0)return[];_e=[Ye,tt]}Ce=U(_e)}else if(ie.args.length>=2&&ee.args.length===2){for(var Ct=$(ie,re),we=[],Be=0;Be2)throw Error("Unexpected non-binary associative function: "+ee.toString());return[]}}else if(ee instanceof C){if(ee.name.length===0)throw new Error("Symbol in rule has 0 length...!?");if(fe[ee.name]){if(ee.name!==ie.name)return[]}else switch(ee.name[1]>="a"&&ee.name[1]<="z"?ee.name.substring(0,2):ee.name[0]){case"n":case"_p":Ce[0].placeholders[ee.name]=ie;break;case"c":case"cl":if(gr(ie))Ce[0].placeholders[ee.name]=ie;else return[];break;case"v":if(!gr(ie))Ce[0].placeholders[ee.name]=ie;else return[];break;case"vl":if(ri(ie))Ce[0].placeholders[ee.name]=ie;else return[];break;case"cd":if(qH(ie))Ce[0].placeholders[ee.name]=ie;else return[];break;case"vd":if(!qH(ie))Ce[0].placeholders[ee.name]=ie;else return[];break;case"ce":if(tC(ie))Ce[0].placeholders[ee.name]=ie;else return[];break;case"ve":if(!tC(ie))Ce[0].placeholders[ee.name]=ie;else return[];break;default:throw new Error("Invalid symbol in rule: "+ee.name)}}else if(ee instanceof x){if(!c(ee.value,ie.value))return[]}else return[];return Ce}function J(ee,ie){if(ee instanceof x&&ie instanceof x){if(!c(ee.value,ie.value))return!1}else if(ee instanceof C&&ie instanceof C){if(ee.name!==ie.name)return!1}else if(ee instanceof j&&ie instanceof j||ee instanceof w&&ie instanceof w){if(ee instanceof j){if(ee.op!==ie.op||ee.fn!==ie.fn)return!1}else if(ee instanceof w&&ee.name!==ie.name)return!1;if(ee.args.length!==ie.args.length)return!1;for(var re=0;re{var{typed:t,config:r,mathWithTransform:n,matrix:i,fraction:a,bignumber:o,AccessorNode:s,ArrayNode:l,ConstantNode:u,FunctionNode:c,IndexNode:f,ObjectNode:d,OperatorNode:p,SymbolNode:h}=e,{isCommutative:m,isAssociative:g,allChildren:A,createMakeNodeFunction:b}=TS({FunctionNode:c,OperatorNode:p,SymbolNode:h}),v=t("simplifyConstant",{Node:z=>k(q(z,{})),"Node, Object":function(I,T){return k(q(I,T))}});function x(z){return gf(z)?z.valueOf():z instanceof Array?z.map(x):St(z)?i(x(z.valueOf())):z}function w(z,I,T){try{return n[z].apply(null,I)}catch{return I=I.map(x),O(n[z].apply(null,I),T)}}var S=t({Fraction:N,number:function(I){return I<0?C(new u(-I)):new u(I)},BigNumber:function(I){return I<0?C(new u(-I)):new u(I)},Complex:function(I){throw new Error("Cannot convert Complex number to Node")},string:function(I){return new u(I)},Matrix:function(I){return new l(I.valueOf().map(T=>S(T)))}});function k(z){return Nr(z)?z:S(z)}function j(z,I){var T=I&&I.exactFractions!==!1;if(T&&isFinite(z)&&a){var L=a(z),_=I&&typeof I.fractionsLimit=="number"?I.fractionsLimit:1/0;if(L.valueOf()===z&&L.n<_&&L.d<_)return L}return z}var O=t({"string, Object":function(I,T){if(r.number==="BigNumber")return o===void 0&&pS(),o(I);if(r.number==="Fraction")return a===void 0&&KF(),a(I);var L=parseFloat(I);return j(L,T)},"Fraction, Object":function(I,T){return I},"BigNumber, Object":function(I,T){return I},"number, Object":function(I,T){return j(I,T)},"Complex, Object":function(I,T){return I.im!==0?I:j(I.re,T)},"Matrix, Object":function(I,T){return i(j(I.valueOf()))},"Array, Object":function(I,T){return I.map(j)}});function C(z){return new p("-","unaryMinus",[z])}function N(z){var I,T=z.s*z.n;return T<0?I=new p("-","unaryMinus",[new u(-T)]):I=new u(T),z.d===1?I:new p("/","divide",[I,new u(z.d)])}function D(z,I,T){if(!Sc(I))return new s(k(z),k(I));if(ps(z)||St(z)){for(var L=Array.from(I.dimensions);L.length>0;)if(gr(L[0])&&typeof L[0].value!="string"){var _=O(L.shift().value,T);ps(z)?z=z.items[_-1]:(z=z.valueOf()[_-1],z instanceof Array&&(z=i(z)))}else if(L.length>1&&gr(L[1])&&typeof L[1].value!="string"){var Y=O(L[1].value,T),oe=[],te=ps(z)?z.items:z.valueOf();for(var Q of te)if(ps(Q))oe.push(Q.items[Y-1]);else if(St(z))oe.push(Q[Y-1]);else break;if(oe.length===te.length)ps(z)?z=new l(oe):z=i(oe),L.splice(1,1);else break}else break;return L.length===I.dimensions.length?new s(k(z),I):L.length>0?(I=new f(L),new s(k(z),I)):z}if(Vm(z)&&I.dimensions.length===1&&gr(I.dimensions[0])){var fe=I.dimensions[0].value;return fe in z.properties?z.properties[fe]:new u}return new s(k(z),I)}function P(z,I,T,L){var _=I.shift(),Y=I.reduce((oe,te)=>{if(!Nr(te)){var Q=oe.pop();if(Nr(Q))return[Q,te];try{return oe.push(w(z,[Q,te],L)),oe}catch{oe.push(Q)}}oe.push(k(oe.pop()));var fe=oe.length===1?oe[0]:T(oe);return[T([fe,k(te)])]},[_]);return Y.length===1?Y[0]:T([Y[0],S(Y[1])])}function q(z,I){switch(z.type){case"SymbolNode":return z;case"ConstantNode":switch(typeof z.value){case"number":return O(z.value,I);case"string":return z.value;default:if(!isNaN(z.value))return O(z.value,I)}return z;case"FunctionNode":if(n[z.name]&&n[z.name].rawArgs)return z;{var T=["add","multiply"];if(T.indexOf(z.name)===-1){var L=z.args.map(ke=>q(ke,I));if(!L.some(Nr))try{return w(z.name,L,I)}catch{}if(z.name==="size"&&L.length===1&&ps(L[0])){for(var _=[],Y=L[0];ps(Y);)_.push(Y.items.length),Y=Y.items[0];return i(_)}return new c(z.name,L.map(k))}}case"OperatorNode":{var oe=z.fn.toString(),te,Q,fe=b(z);if(bi(z)&&z.isUnary())te=[q(z.args[0],I)],Nr(te[0])?Q=fe(te):Q=w(oe,te,I);else if(g(z,I.context))if(te=A(z,I.context),te=te.map(ke=>q(ke,I)),m(oe,I.context)){for(var Ie=[],Se=[],Oe=0;Oe1?(Q=P(oe,Ie,fe,I),Se.unshift(Q),Q=P(oe,Se,fe,I)):Q=P(oe,te,fe,I)}else Q=P(oe,te,fe,I);else te=z.args.map(ke=>q(ke,I)),Q=P(oe,te,fe,I);return Q}case"ParenthesisNode":return q(z.content,I);case"AccessorNode":return D(q(z.object,I),q(z.index,I),I);case"ArrayNode":{var ve=z.items.map(ke=>q(ke,I));return ve.some(Nr)?new l(ve.map(k)):i(ve)}case"IndexNode":return new f(z.dimensions.map(ke=>v(ke,I)));case"ObjectNode":{var ye={};for(var me in z.properties)ye[me]=v(z.properties[me],I);return new d(ye)}case"AssignmentNode":case"BlockNode":case"FunctionAssignmentNode":case"RangeNode":case"ConditionalNode":default:throw new Error("Unimplemented node type in simplifyConstant: ".concat(z.type))}}return v});var cge="simplifyCore",zWe=["typed","parse","equal","isZero","add","subtract","multiply","divide","pow","AccessorNode","ArrayNode","ConstantNode","FunctionNode","IndexNode","ObjectNode","OperatorNode","ParenthesisNode","SymbolNode"],_P=V(cge,zWe,e=>{var{typed:t,parse:r,equal:n,isZero:i,add:a,subtract:o,multiply:s,divide:l,pow:u,AccessorNode:c,ArrayNode:f,ConstantNode:d,FunctionNode:p,IndexNode:h,ObjectNode:m,OperatorNode:g,ParenthesisNode:A,SymbolNode:b}=e,v=new d(0),x=new d(1),w=new d(!0),S=new d(!1);function k(N){return bi(N)&&["and","not","or"].includes(N.op)}var{hasProperty:j,isCommutative:O}=TS({FunctionNode:p,OperatorNode:g,SymbolNode:b});function C(N){var D=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},P=D?D.context:void 0;if(j(N,"trivial",P)){if(xl(N)&&N.args.length===1)return C(N.args[0],D);var q=!1,z=0;if(N.forEach(Se=>{++z,z===1&&(q=C(Se,D))}),z===1)return q}var I=N;if(xl(I)){var T=lfe(I.name);if(T){if(I.args.length>2&&j(I,"associative",P))for(;I.args.length>2;){var L=I.args.pop(),_=I.args.pop();I.args.push(new g(T,I.name,[L,_]))}I=new g(T,I.name,I.args)}else return new p(C(I.fn),I.args.map(Se=>C(Se,D)))}if(bi(I)&&I.isUnary()){var Y=C(I.args[0],D);if(I.op==="~"&&bi(Y)&&Y.isUnary()&&Y.op==="~"||I.op==="not"&&bi(Y)&&Y.isUnary()&&Y.op==="not"&&k(Y.args[0]))return Y.args[0];var oe=!0;if(I.op==="-"&&bi(Y)&&(Y.isBinary()&&Y.fn==="subtract"&&(I=new g("-","subtract",[Y.args[1],Y.args[0]]),oe=!1),Y.isUnary()&&Y.op==="-"))return Y.args[0];if(oe)return new g(I.op,I.fn,[Y])}if(bi(I)&&I.isBinary()){var te=C(I.args[0],D),Q=C(I.args[1],D);if(I.op==="+"){if(gr(te)&&i(te.value))return Q;if(gr(Q)&&i(Q.value))return te;bi(Q)&&Q.isUnary()&&Q.op==="-"&&(Q=Q.args[0],I=new g("-","subtract",[te,Q]))}if(I.op==="-")return bi(Q)&&Q.isUnary()&&Q.op==="-"?C(new g("+","add",[te,Q.args[0]]),D):gr(te)&&i(te.value)?C(new g("-","unaryMinus",[Q])):gr(Q)&&i(Q.value)?te:new g(I.op,I.fn,[te,Q]);if(I.op==="*"){if(gr(te)){if(i(te.value))return v;if(n(te.value,1))return Q}if(gr(Q)){if(i(Q.value))return v;if(n(Q.value,1))return te;if(O(I,P))return new g(I.op,I.fn,[Q,te],I.implicit)}return new g(I.op,I.fn,[te,Q],I.implicit)}if(I.op==="/")return gr(te)&&i(te.value)?v:gr(Q)&&n(Q.value,1)?te:new g(I.op,I.fn,[te,Q]);if(I.op==="^"&&gr(Q)){if(i(Q.value))return x;if(n(Q.value,1))return te}if(I.op==="and"){if(gr(te))if(te.value){if(k(Q))return Q;if(gr(Q))return Q.value?w:S}else return S;if(gr(Q))if(Q.value){if(k(te))return te}else return S}if(I.op==="or"){if(gr(te)){if(te.value)return w;if(k(Q))return Q}if(gr(Q)){if(Q.value)return w;if(k(te))return te}}return new g(I.op,I.fn,[te,Q])}if(bi(I))return new g(I.op,I.fn,I.args.map(Se=>C(Se,D)));if(ps(I))return new f(I.items.map(Se=>C(Se,D)));if(Uu(I))return new c(C(I.object,D),C(I.index,D));if(Sc(I))return new h(I.dimensions.map(Se=>C(Se,D)));if(Vm(I)){var fe={};for(var Ie in I.properties)fe[Ie]=C(I.properties[Ie],D);return new m(fe)}return I}return t(cge,{Node:C,"Node,Object":C})});var UWe="resolve",WWe=["typed","parse","ConstantNode","FunctionNode","OperatorNode","ParenthesisNode"],PP=V(UWe,WWe,e=>{var{typed:t,parse:r,ConstantNode:n,FunctionNode:i,OperatorNode:a,ParenthesisNode:o}=e;function s(l,u){var c=arguments.length>2&&arguments[2]!==void 0?arguments[2]:new Set;if(!u)return l;if(ri(l)){if(c.has(l.name)){var f=Array.from(c).join(", ");throw new ReferenceError("recursive loop of variable definitions among {".concat(f,"}"))}var d=u.get(l.name);if(Nr(d)){var p=new Set(c);return p.add(l.name),s(d,u,p)}else return typeof d=="number"?r(String(d)):d!==void 0?new n(d):l}else if(bi(l)){var h=l.args.map(function(g){return s(g,u,c)});return new a(l.op,l.fn,h,l.implicit)}else{if(ms(l))return new o(s(l.content,u,c));if(xl(l)){var m=l.args.map(function(g){return s(g,u,c)});return new i(l.name,m)}}return l.map(g=>s(g,u,c))}return t("resolve",{Node:s,"Node, Map | null | undefined":s,"Node, Object":(l,u)=>s(l,zA(u)),"Array | Matrix":t.referToSelf(l=>u=>u.map(c=>l(c))),"Array | Matrix, null | undefined":t.referToSelf(l=>u=>u.map(c=>l(c))),"Array, Object":t.referTo("Array,Map",l=>(u,c)=>l(u,zA(c))),"Matrix, Object":t.referTo("Matrix,Map",l=>(u,c)=>l(u,zA(c))),"Array | Matrix, Map":t.referToSelf(l=>(u,c)=>u.map(f=>l(f,c)))})});var fge="symbolicEqual",HWe=["parse","simplify","typed","OperatorNode"],IP=V(fge,HWe,e=>{var{parse:t,simplify:r,typed:n,OperatorNode:i}=e;function a(o,s){var l=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},u=new i("-","subtract",[o,s]),c=r(u,{},l);return gr(c)&&!c.value}return n(fge,{"Node, Node":a,"Node, Node, Object":a})});var dge="derivative",VWe=["typed","config","parse","simplify","equal","isZero","numeric","ConstantNode","FunctionNode","OperatorNode","ParenthesisNode","SymbolNode"],BP=V(dge,VWe,e=>{var{typed:t,config:r,parse:n,simplify:i,equal:a,isZero:o,numeric:s,ConstantNode:l,FunctionNode:u,OperatorNode:c,ParenthesisNode:f,SymbolNode:d}=e;function p(v,x){var w=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{simplify:!0},S={};g(S,v,x.name);var k=A(v,S);return w.simplify?i(k):k}t.addConversion({from:"identifier",to:"SymbolNode",convert:n});var h=t(dge,{"Node, SymbolNode":p,"Node, SymbolNode, Object":p});t.removeConversion({from:"identifier",to:"SymbolNode",convert:n}),h._simplify=!0,h.toTex=function(v){return m.apply(null,v.args)};var m=t("_derivTex",{"Node, SymbolNode":function(x,w){return gr(x)&&qr(x.value)==="string"?m(n(x.value).toString(),w.toString(),1):m(x.toTex(),w.toString(),1)},"Node, ConstantNode":function(x,w){if(qr(w.value)==="string")return m(x,n(w.value));throw new Error("The second parameter to 'derivative' is a non-string constant")},"Node, SymbolNode, ConstantNode":function(x,w,S){return m(x.toString(),w.name,S.value)},"string, string, number":function(x,w,S){var k;return S===1?k="{d\\over d"+w+"}":k="{d^{"+S+"}\\over d"+w+"^{"+S+"}}",k+"\\left[".concat(x,"\\right]")}}),g=t("constTag",{"Object, ConstantNode, string":function(x,w){return x[w]=!0,!0},"Object, SymbolNode, string":function(x,w,S){return w.name!==S?(x[w]=!0,!0):!1},"Object, ParenthesisNode, string":function(x,w,S){return g(x,w.content,S)},"Object, FunctionAssignmentNode, string":function(x,w,S){return w.params.indexOf(S)===-1?(x[w]=!0,!0):g(x,w.expr,S)},"Object, FunctionNode | OperatorNode, string":function(x,w,S){if(w.args.length>0){for(var k=g(x,w.args[0],S),j=1;j0){var k=x.args.filter(function(z){return w[z]===void 0}),j=k.length===1?k[0]:new c("*","multiply",k),O=S.concat(A(j,w));return new c("*","multiply",O)}return new c("+","add",x.args.map(function(z){return new c("*","multiply",x.args.map(function(I){return I===z?A(I,w):I.clone()}))}))}if(x.op==="/"&&x.isBinary()){var C=x.args[0],N=x.args[1];return w[N]!==void 0?new c("/","divide",[A(C,w),N]):w[C]!==void 0?new c("*","multiply",[new c("-","unaryMinus",[C]),new c("/","divide",[A(N,w),new c("^","pow",[N.clone(),b(2)])])]):new c("/","divide",[new c("-","subtract",[new c("*","multiply",[A(C,w),N.clone()]),new c("*","multiply",[C.clone(),A(N,w)])]),new c("^","pow",[N.clone(),b(2)])])}if(x.op==="^"&&x.isBinary()){var D=x.args[0],P=x.args[1];if(w[D]!==void 0)return gr(D)&&(o(D.value)||a(D.value,1))?b(0):new c("*","multiply",[x,new c("*","multiply",[new u("log",[D.clone()]),A(P.clone(),w)])]);if(w[P]!==void 0){if(gr(P)){if(o(P.value))return b(0);if(a(P.value,1))return A(D,w)}var q=new c("^","pow",[D.clone(),new c("-","subtract",[P,b(1)])]);return new c("*","multiply",[P.clone(),new c("*","multiply",[A(D,w),q])])}return new c("*","multiply",[new c("^","pow",[D.clone(),P.clone()]),new c("+","add",[new c("*","multiply",[A(D,w),new c("/","divide",[P.clone(),D.clone()])]),new c("*","multiply",[A(P,w),new u("log",[D.clone()])])])])}throw new Error('Cannot process operator "'+x.op+'" in derivative: the operator is not supported, undefined, or the number of arguments passed to it are not supported')}});function b(v,x){return new l(s(v,x||r.number))}return h});var pge="rationalize",GWe=["config","typed","equal","isZero","add","subtract","multiply","divide","pow","parse","simplifyConstant","simplifyCore","simplify","?bignumber","?fraction","mathWithTransform","matrix","AccessorNode","ArrayNode","ConstantNode","FunctionNode","IndexNode","ObjectNode","OperatorNode","SymbolNode","ParenthesisNode"],RP=V(pge,GWe,e=>{var{config:t,typed:r,equal:n,isZero:i,add:a,subtract:o,multiply:s,divide:l,pow:u,parse:c,simplifyConstant:f,simplifyCore:d,simplify:p,fraction:h,bignumber:m,mathWithTransform:g,matrix:A,AccessorNode:b,ArrayNode:v,ConstantNode:x,FunctionNode:w,IndexNode:S,ObjectNode:k,OperatorNode:j,SymbolNode:O,ParenthesisNode:C}=e;function N(I){var T=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},L=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,_=P(),Y=D(I,T,!0,_.firstRules),oe=Y.variables.length,te={exactFractions:!1},Q={exactFractions:!0};if(I=Y.expression,oe>=1){I=q(I);var fe,Ie,Se=!0,Oe=!1;I=p(I,_.firstRules,{},te);for(var ve;Ie=Se?_.distrDivRules:_.sucDivRules,I=p(I,Ie,{},Q),Se=!Se,ve=I.toString(),ve!==fe;)Oe=!0,fe=ve;Oe&&(I=p(I,_.firstRulesAgain,{},te)),I=p(I,_.finalRules,{},te)}var ye=[],me={};return I.type==="OperatorNode"&&I.isBinary()&&I.op==="/"?(oe===1&&(I.args[0]=z(I.args[0],ye),I.args[1]=z(I.args[1])),L&&(me.numerator=I.args[0],me.denominator=I.args[1])):(oe===1&&(I=z(I,ye)),L&&(me.numerator=I,me.denominator=null)),L?(me.coefficients=ye,me.variables=Y.variables,me.expression=I,me):I}return r(pge,{Node:N,"Node, boolean":(I,T)=>N(I,{},T),"Node, Object":N,"Node, Object, boolean":N});function D(I,T,L,_){var Y=[],oe=p(I,_,T,{exactFractions:!1});L=!!L;var te="+-*"+(L?"/":"");fe(oe);var Q={};return Q.expression=oe,Q.variables=Y,Q;function fe(Ie){var Se=Ie.type;if(Se==="FunctionNode")throw new Error("There is an unsolved function call");if(Se==="OperatorNode")if(Ie.op==="^"){if(Ie.args[1].type!=="ConstantNode"||!wt(parseFloat(Ie.args[1].value)))throw new Error("There is a non-integer exponent");fe(Ie.args[0])}else{if(te.indexOf(Ie.op)===-1)throw new Error("Operator "+Ie.op+" invalid in polynomial expression");for(var Oe=0;Oe1;if(_==="OperatorNode"&&I.isBinary()){var oe=!1,te;if(I.op==="^"&&(I.args[0].type==="ParenthesisNode"||I.args[0].type==="OperatorNode")&&I.args[1].type==="ConstantNode"&&(te=parseFloat(I.args[1].value),oe=te>=2&&wt(te)),oe){if(te>2){var Q=I.args[0],fe=new j("^","pow",[I.args[0].cloneDeep(),new x(te-1)]);I=new j("*","multiply",[Q,fe])}else I=new j("*","multiply",[I.args[0],I.args[0].cloneDeep()]);Y&&(L==="content"?T.content=I:T.args[L]=I)}}if(_==="ParenthesisNode")q(I.content,I,"content");else if(_!=="ConstantNode"&&_!=="SymbolNode")for(var Ie=0;Ie=0;Q--)if(T[Q]!==0){var fe=new x(oe?T[Q]:Math.abs(T[Q])),Ie=T[Q]<0?"-":"+";if(Q>0){var Se=new O(Y);if(Q>1){var Oe=new x(Q);Se=new j("^","pow",[Se,Oe])}T[Q]===-1&&oe?fe=new j("-","unaryMinus",[Se]):Math.abs(T[Q])===1?fe=Se:fe=new j("*","multiply",[fe,Se])}oe?te=fe:Ie==="+"?te=new j("+","add",[te,fe]):te=new j("-","subtract",[te,fe]),oe=!1}if(oe)return new x(0);return te;function ve(ye,me,ke){var $=ye.type;if($==="FunctionNode")throw new Error("There is an unsolved function call");if($==="OperatorNode"){if("+-*^".indexOf(ye.op)===-1)throw new Error("Operator "+ye.op+" invalid");if(me!==null){if((ye.fn==="unaryMinus"||ye.fn==="pow")&&me.fn!=="add"&&me.fn!=="subtract"&&me.fn!=="multiply")throw new Error("Invalid "+ye.op+" placing");if((ye.fn==="subtract"||ye.fn==="add"||ye.fn==="multiply")&&me.fn!=="add"&&me.fn!=="subtract")throw new Error("Invalid "+ye.op+" placing");if((ye.fn==="subtract"||ye.fn==="add"||ye.fn==="unaryMinus")&&ke.noFil!==0)throw new Error("Invalid "+ye.op+" placing")}(ye.op==="^"||ye.op==="*")&&(ke.fire=ye.op);for(var ae=0;ae_&&(T[ce]=0),T[ce]+=ke.cte*(ke.oper==="+"?1:-1),_=Math.max(ce,_);return}ke.cte=ce,ke.fire===""&&(T[0]+=ke.cte*(ke.oper==="+"?1:-1))}else throw new Error("Type "+$+" is not allowed")}}});var mge="zpk2tf",QWe=["typed","add","multiply","Complex","number"],$P=V(mge,QWe,e=>{var{typed:t,add:r,multiply:n,Complex:i,number:a}=e;return t(mge,{"Array,Array,number":function(u,c,f){return o(u,c,f)},"Array,Array":function(u,c){return o(u,c,1)},"Matrix,Matrix,number":function(u,c,f){return o(u.valueOf(),c.valueOf(),f)},"Matrix,Matrix":function(u,c){return o(u.valueOf(),c.valueOf(),1)}});function o(l,u,c){l.some(b=>b.type==="BigNumber")&&(l=l.map(b=>a(b))),u.some(b=>b.type==="BigNumber")&&(u=u.map(b=>a(b)));for(var f=[i(1,0)],d=[i(1,0)],p=0;p=0&&f-d{var{typed:t,add:r,multiply:n,Complex:i,divide:a,matrix:o}=e;return t(hge,{"Array, Array":function(c,f){var d=l(512);return s(c,f,d)},"Array, Array, Array":function(c,f,d){return s(c,f,d)},"Array, Array, number":function(c,f,d){if(d<0)throw new Error("w must be a positive number");var p=l(d);return s(c,f,p)},"Matrix, Matrix":function(c,f){var d=l(512),{w:p,h}=s(c.valueOf(),f.valueOf(),d);return{w:o(p),h:o(h)}},"Matrix, Matrix, Matrix":function(c,f,d){var{h:p}=s(c.valueOf(),f.valueOf(),d.valueOf());return{h:o(p),w:o(d)}},"Matrix, Matrix, number":function(c,f,d){if(d<0)throw new Error("w must be a positive number");var p=l(d),{h}=s(c.valueOf(),f.valueOf(),p);return{h:o(h),w:o(p)}}});function s(u,c,f){for(var d=[],p=[],h=0;h{var{classes:t}=e;return function(n,i){var a=t[i&&i.mathjs];return a&&typeof a.fromJSON=="function"?a.fromJSON(i):i}});var KWe="replacer",JWe=[],zP=V(KWe,JWe,()=>function(t,r){return typeof r=="number"&&(!isFinite(r)||isNaN(r))?{mathjs:"number",value:String(r)}:r});var Age="12.4.1";var UP=V("true",[],()=>!0),WP=V("false",[],()=>!1),HP=V("null",[],()=>null),VP=xf("Infinity",["config","?BigNumber"],e=>{var{config:t,BigNumber:r}=e;return t.number==="BigNumber"?new r(1/0):1/0}),GP=xf("NaN",["config","?BigNumber"],e=>{var{config:t,BigNumber:r}=e;return t.number==="BigNumber"?new r(NaN):NaN}),QP=xf("pi",["config","?BigNumber"],e=>{var{config:t,BigNumber:r}=e;return t.number==="BigNumber"?K6(r):Xse}),YP=xf("tau",["config","?BigNumber"],e=>{var{config:t,BigNumber:r}=e;return t.number==="BigNumber"?yce(r):Kse}),ZP=xf("e",["config","?BigNumber"],e=>{var{config:t,BigNumber:r}=e;return t.number==="BigNumber"?gce(r):Jse}),XP=xf("phi",["config","?BigNumber"],e=>{var{config:t,BigNumber:r}=e;return t.number==="BigNumber"?vce(r):ele}),KP=xf("LN2",["config","?BigNumber"],e=>{var{config:t,BigNumber:r}=e;return t.number==="BigNumber"?new r(2).ln():Math.LN2}),JP=xf("LN10",["config","?BigNumber"],e=>{var{config:t,BigNumber:r}=e;return t.number==="BigNumber"?new r(10).ln():Math.LN10}),eI=xf("LOG2E",["config","?BigNumber"],e=>{var{config:t,BigNumber:r}=e;return t.number==="BigNumber"?new r(1).div(new r(2).ln()):Math.LOG2E}),tI=xf("LOG10E",["config","?BigNumber"],e=>{var{config:t,BigNumber:r}=e;return t.number==="BigNumber"?new r(1).div(new r(10).ln()):Math.LOG10E}),rI=xf("SQRT1_2",["config","?BigNumber"],e=>{var{config:t,BigNumber:r}=e;return t.number==="BigNumber"?new r("0.5").sqrt():Math.SQRT1_2}),nI=xf("SQRT2",["config","?BigNumber"],e=>{var{config:t,BigNumber:r}=e;return t.number==="BigNumber"?new r(2).sqrt():Math.SQRT2}),iI=xf("i",["Complex"],e=>{var{Complex:t}=e;return t.I}),gge=V("PI",["pi"],e=>{var{pi:t}=e;return t}),vge=V("E",["e"],e=>{var{e:t}=e;return t}),aI=V("version",[],()=>Age);function xf(e,t,r){return V(e,t,r,{recreateOnConfigChange:!0})}var oI=Rr("speedOfLight","299792458","m s^-1"),sI=Rr("gravitationConstant","6.67430e-11","m^3 kg^-1 s^-2"),lI=Rr("planckConstant","6.62607015e-34","J s"),uI=Rr("reducedPlanckConstant","1.0545718176461565e-34","J s"),cI=Rr("magneticConstant","1.25663706212e-6","N A^-2"),fI=Rr("electricConstant","8.8541878128e-12","F m^-1"),dI=Rr("vacuumImpedance","376.730313667","ohm"),pI=Rr("coulomb","8.987551792261171e9","N m^2 C^-2"),mI=Rr("elementaryCharge","1.602176634e-19","C"),hI=Rr("bohrMagneton","9.2740100783e-24","J T^-1"),AI=Rr("conductanceQuantum","7.748091729863649e-5","S"),gI=Rr("inverseConductanceQuantum","12906.403729652257","ohm"),vI=Rr("magneticFluxQuantum","2.0678338484619295e-15","Wb"),yI=Rr("nuclearMagneton","5.0507837461e-27","J T^-1"),bI=Rr("klitzing","25812.807459304513","ohm");var xI=Rr("bohrRadius","5.29177210903e-11","m"),wI=Rr("classicalElectronRadius","2.8179403262e-15","m"),SI=Rr("electronMass","9.1093837015e-31","kg"),EI=Rr("fermiCoupling","1.1663787e-5","GeV^-2"),kI=rB("fineStructure",.0072973525693),CI=Rr("hartreeEnergy","4.3597447222071e-18","J"),DI=Rr("protonMass","1.67262192369e-27","kg"),OI=Rr("deuteronMass","3.3435830926e-27","kg"),MI=Rr("neutronMass","1.6749271613e-27","kg"),jI=Rr("quantumOfCirculation","3.6369475516e-4","m^2 s^-1"),NI=Rr("rydberg","10973731.568160","m^-1"),TI=Rr("thomsonCrossSection","6.6524587321e-29","m^2"),FI=rB("weakMixingAngle",.2229),_I=rB("efimovFactor",22.7),PI=Rr("atomicMass","1.66053906660e-27","kg"),II=Rr("avogadro","6.02214076e23","mol^-1"),BI=Rr("boltzmann","1.380649e-23","J K^-1"),RI=Rr("faraday","96485.33212331001","C mol^-1"),$I=Rr("firstRadiation","3.7417718521927573e-16","W m^2"),qI=Rr("loschmidt","2.686780111798444e25","m^-3"),LI=Rr("gasConstant","8.31446261815324","J K^-1 mol^-1"),zI=Rr("molarPlanckConstant","3.990312712893431e-10","J s mol^-1"),UI=Rr("molarVolume","0.022413969545014137","m^3 mol^-1"),WI=rB("sackurTetrode",-1.16487052358),HI=Rr("secondRadiation","0.014387768775039337","m K"),VI=Rr("stefanBoltzmann","5.67037441918443e-8","W m^-2 K^-4"),GI=Rr("wienDisplacement","2.897771955e-3","m K"),QI=Rr("molarMass","0.99999999965e-3","kg mol^-1"),YI=Rr("molarMassC12","11.9999999958e-3","kg mol^-1"),ZI=Rr("gravity","9.80665","m s^-2"),XI=Rr("planckLength","1.616255e-35","m"),KI=Rr("planckMass","2.176435e-8","kg"),JI=Rr("planckTime","5.391245e-44","s"),eB=Rr("planckCharge","1.87554603778e-18","C"),tB=Rr("planckTemperature","1.416785e+32","K");function Rr(e,t,r){var n=["config","Unit","BigNumber"];return V(e,n,i=>{var{config:a,Unit:o,BigNumber:s}=i,l=a.number==="BigNumber"?new s(t):parseFloat(t),u=new o(l,r);return u.fixPrefix=!0,u})}function rB(e,t){var r=["config","BigNumber"];return V(e,r,n=>{var{config:i,BigNumber:a}=n;return i.number==="BigNumber"?new a(t):t})}var eHe="apply",tHe=["typed","isInteger"],nB=V(eHe,tHe,e=>{var{typed:t,isInteger:r}=e,n=G0({typed:t,isInteger:r});return t("apply",{"...any":function(a){var o=a[1];Qt(o)?a[1]=o-1:It(o)&&(a[1]=o.minus(1));try{return n.apply(null,a)}catch(s){throw wi(s)}}})},{isTransformFunction:!0});var rHe="column",nHe=["typed","Index","matrix","range"],iB=V(rHe,nHe,e=>{var{typed:t,Index:r,matrix:n,range:i}=e,a=fS({typed:t,Index:r,matrix:n,range:i});return t("column",{"...any":function(s){var l=s.length-1,u=s[l];Qt(u)&&(s[l]=u-1);try{return a.apply(null,s)}catch(c){throw wi(c)}}})},{isTransformFunction:!0});function FS(e,t,r){var n=e.filter(function(l){return ri(l)&&!(l.name in t)&&!r.has(l.name)})[0];if(!n)throw new Error('No undefined variable found in inline expression "'+e+'"');var i=n.name,a=new Map,o=new Xw(r,a,new Set([i])),s=e.compile();return function(u){return a.set(i,u),s.evaluate(o)}}var iHe="filter",aHe=["typed"],aB=V(iHe,aHe,e=>{var{typed:t}=e;function r(i,a,o){var s,l;return i[0]&&(s=i[0].compile().evaluate(o)),i[1]&&(ri(i[1])||Ed(i[1])?l=i[1].compile().evaluate(o):l=FS(i[1],a,o)),n(s,l)}r.rawArgs=!0;var n=t("filter",{"Array, function":yge,"Matrix, function":function(a,o){return a.create(yge(a.toArray(),o))},"Array, RegExp":Yw,"Matrix, RegExp":function(a,o){return a.create(Yw(a.toArray(),o))}});return r},{isTransformFunction:!0});function yge(e,t){return mT(e,function(r,n,i){return Od(t,r,[n+1],i,"filter")})}var oHe="forEach",sHe=["typed"],oB=V(oHe,sHe,e=>{var{typed:t}=e;function r(i,a,o){var s,l;return i[0]&&(s=i[0].compile().evaluate(o)),i[1]&&(ri(i[1])||Ed(i[1])?l=i[1].compile().evaluate(o):l=FS(i[1],a,o)),n(s,l)}r.rawArgs=!0;var n=t("forEach",{"Array | Matrix, function":function(a,o){var s=function l(u,c){if(Array.isArray(u))$0(u,function(f,d){l(f,c.concat(d+1))});else return Od(o,u,c,a,"forEach")};s(a.valueOf(),[])}});return r},{isTransformFunction:!0});var lHe="index",uHe=["Index","getMatrixDataType"],sB=V(lHe,uHe,e=>{var{Index:t,getMatrixDataType:r}=e;return function(){for(var i=[],a=0,o=arguments.length;a0?0:2;else if(s&&s.isSet===!0)s=s.map(function(u){return u-1});else if(Ir(s)||St(s))r(s)!=="boolean"&&(s=s.map(function(u){return u-1}));else if(Qt(s))s--;else if(It(s))s=s.toNumber()-1;else if(typeof s!="string")throw new TypeError("Dimension must be an Array, Matrix, number, string, or Range");i[a]=s}var l=new t;return t.apply(l,i),l}},{isTransformFunction:!0});var cHe="map",fHe=["typed"],lB=V(cHe,fHe,e=>{var{typed:t}=e;function r(i,a,o){var s,l;return i[0]&&(s=i[0].compile().evaluate(o)),i[1]&&(ri(i[1])||Ed(i[1])?l=i[1].compile().evaluate(o):l=FS(i[1],a,o)),n(s,l)}r.rawArgs=!0;var n=t("map",{"Array, function":function(a,o){return bge(a,o,a)},"Matrix, function":function(a,o){return a.create(bge(a.valueOf(),o,a))}});return r},{isTransformFunction:!0});function bge(e,t,r){function n(i,a){return Array.isArray(i)?Ec(i,function(o,s){return n(o,a.concat(s+1))}):Od(t,i,a,r,"map")}return n(e,[])}function su(e){if(e.length===2&&Da(e[0])){e=e.slice();var t=e[1];Qt(t)?e[1]=t-1:It(t)&&(e[1]=t.minus(1))}return e}var dHe="max",pHe=["typed","config","numeric","larger"],uB=V(dHe,pHe,e=>{var{typed:t,config:r,numeric:n,larger:i}=e,a=SS({typed:t,config:r,numeric:n,larger:i});return t("max",{"...any":function(s){s=su(s);try{return a.apply(null,s)}catch(l){throw wi(l)}}})},{isTransformFunction:!0});var mHe="mean",hHe=["typed","add","divide"],cB=V(mHe,hHe,e=>{var{typed:t,add:r,divide:n}=e,i=OS({typed:t,add:r,divide:n});return t("mean",{"...any":function(o){o=su(o);try{return i.apply(null,o)}catch(s){throw wi(s)}}})},{isTransformFunction:!0});var AHe="min",gHe=["typed","config","numeric","smaller"],fB=V(AHe,gHe,e=>{var{typed:t,config:r,numeric:n,smaller:i}=e,a=ES({typed:t,config:r,numeric:n,smaller:i});return t("min",{"...any":function(s){s=su(s);try{return a.apply(null,s)}catch(l){throw wi(l)}}})},{isTransformFunction:!0});var vHe="range",yHe=["typed","config","?matrix","?bignumber","smaller","smallerEq","larger","largerEq","add","isPositive"],dB=V(vHe,yHe,e=>{var{typed:t,config:r,matrix:n,bignumber:i,smaller:a,smallerEq:o,larger:s,largerEq:l,add:u,isPositive:c}=e,f=mS({typed:t,config:r,matrix:n,bignumber:i,smaller:a,smallerEq:o,larger:s,largerEq:l,add:u,isPositive:c});return t("range",{"...any":function(p){var h=p.length-1,m=p[h];return typeof m!="boolean"&&p.push(!0),f.apply(null,p)}})},{isTransformFunction:!0});var bHe="row",xHe=["typed","Index","matrix","range"],pB=V(bHe,xHe,e=>{var{typed:t,Index:r,matrix:n,range:i}=e,a=hS({typed:t,Index:r,matrix:n,range:i});return t("row",{"...any":function(s){var l=s.length-1,u=s[l];Qt(u)&&(s[l]=u-1);try{return a.apply(null,s)}catch(c){throw wi(c)}}})},{isTransformFunction:!0});var wHe="subset",SHe=["typed","matrix","zeros","add"],mB=V(wHe,SHe,e=>{var{typed:t,matrix:r,zeros:n,add:i}=e,a=AS({typed:t,matrix:r,zeros:n,add:i});return t("subset",{"...any":function(s){try{return a.apply(null,s)}catch(l){throw wi(l)}}})},{isTransformFunction:!0});var EHe="concat",kHe=["typed","matrix","isInteger"],hB=V(EHe,kHe,e=>{var{typed:t,matrix:r,isInteger:n}=e,i=cS({typed:t,matrix:r,isInteger:n});return t("concat",{"...any":function(o){var s=o.length-1,l=o[s];Qt(l)?o[s]=l-1:It(l)&&(o[s]=l.minus(1));try{return i.apply(null,o)}catch(u){throw wi(u)}}})},{isTransformFunction:!0});var xge="diff",CHe=["typed","matrix","subtract","number","bignumber"],AB=V(xge,CHe,e=>{var{typed:t,matrix:r,subtract:n,number:i,bignumber:a}=e,o=dS({typed:t,matrix:r,subtract:n,number:i,bignumber:a});return t(xge,{"...any":function(l){l=su(l);try{return o.apply(null,l)}catch(u){throw wi(u)}}})},{isTransformFunction:!0});var DHe="std",OHe=["typed","map","sqrt","variance"],gB=V(DHe,OHe,e=>{var{typed:t,map:r,sqrt:n,variance:i}=e,a=NS({typed:t,map:r,sqrt:n,variance:i});return t("std",{"...any":function(s){s=su(s);try{return a.apply(null,s)}catch(l){throw wi(l)}}})},{isTransformFunction:!0});var wge="sum",MHe=["typed","config","add","numeric"],vB=V(wge,MHe,e=>{var{typed:t,config:r,add:n,numeric:i}=e,a=CS({typed:t,config:r,add:n,numeric:i});return t(wge,{"...any":function(s){s=su(s);try{return a.apply(null,s)}catch(l){throw wi(l)}}})},{isTransformFunction:!0});var jHe="quantileSeq",NHe=["typed","bignumber","add","subtract","divide","multiply","partitionSelect","compare","isInteger","smaller","smallerEq","larger"],yB=V(jHe,NHe,e=>{var{typed:t,bignumber:r,add:n,subtract:i,divide:a,multiply:o,partitionSelect:s,compare:l,isInteger:u,smaller:c,smallerEq:f,larger:d}=e,p=jS({typed:t,bignumber:r,add:n,subtract:i,divide:a,multiply:o,partitionSelect:s,compare:l,isInteger:u,smaller:c,smallerEq:f,larger:d});return t("quantileSeq",{"Array | Matrix, number | BigNumber":p,"Array | Matrix, number | BigNumber, number":(m,g,A)=>p(m,g,h(A)),"Array | Matrix, number | BigNumber, boolean":p,"Array | Matrix, number | BigNumber, boolean, number":(m,g,A,b)=>p(m,g,A,h(b)),"Array | Matrix, Array | Matrix":p,"Array | Matrix, Array | Matrix, number":(m,g,A)=>p(m,g,h(A)),"Array | Matrix, Array | Matrix, boolean":p,"Array | Matrix, Array | Matrix, boolean, number":(m,g,A,b)=>p(m,g,A,h(b))});function h(m){return su([[],m])[1]}},{isTransformFunction:!0});var Sge="cumsum",THe=["typed","add","unaryPlus"],bB=V(Sge,THe,e=>{var{typed:t,add:r,unaryPlus:n}=e,i=DS({typed:t,add:r,unaryPlus:n});return t(Sge,{"...any":function(o){if(o.length===2&&Da(o[0])){var s=o[1];Qt(s)?o[1]=s-1:It(s)&&(o[1]=s.minus(1))}try{return i.apply(null,o)}catch(l){throw wi(l)}}})},{isTransformFunction:!0});var Ege="variance",FHe=["typed","add","subtract","multiply","divide","apply","isNaN"],xB=V(Ege,FHe,e=>{var{typed:t,add:r,subtract:n,multiply:i,divide:a,apply:o,isNaN:s}=e,l=MS({typed:t,add:r,subtract:n,multiply:i,divide:a,apply:o,isNaN:s});return t(Ege,{"...any":function(c){c=su(c);try{return l.apply(null,c)}catch(f){throw wi(f)}}})},{isTransformFunction:!0});var kge="print",_He=["typed","matrix","zeros","add"],wB=V(kge,_He,e=>{var{typed:t,matrix:r,zeros:n,add:i}=e,a=vS({typed:t,matrix:r,zeros:n,add:i});return t(kge,{"string, Object | Array":function(l,u){return a(o(l),u)},"string, Object | Array, number | Object":function(l,u,c){return a(o(l),u,c)}});function o(s){return s.replace(b3,l=>{var u=l.slice(1).split("."),c=u.map(function(f){return!isNaN(f)&&f.length>0?parseInt(f)-1:f});return"$"+c.join(".")})}},{isTransformFunction:!0});var PHe="and",IHe=["typed","matrix","zeros","add","equalScalar","not","concat"],SB=V(PHe,IHe,e=>{var{typed:t,matrix:r,equalScalar:n,zeros:i,not:a,concat:o}=e,s=wS({typed:t,matrix:r,equalScalar:n,zeros:i,not:a,concat:o});function l(u,c,f){var d=u[0].compile().evaluate(f);if(!Da(d)&&!s(d,!0))return!1;var p=u[1].compile().evaluate(f);return s(d,p)}return l.rawArgs=!0,l},{isTransformFunction:!0});var BHe="or",RHe=["typed","matrix","equalScalar","DenseMatrix","concat"],EB=V(BHe,RHe,e=>{var{typed:t,matrix:r,equalScalar:n,DenseMatrix:i,concat:a}=e,o=uS({typed:t,matrix:r,equalScalar:n,DenseMatrix:i,concat:a});function s(l,u,c){var f=l[0].compile().evaluate(c);if(!Da(f)&&o(f,!1))return!0;var d=l[1].compile().evaluate(c);return o(f,d)}return s.rawArgs=!0,s},{isTransformFunction:!0});var $He="bitAnd",qHe=["typed","matrix","zeros","add","equalScalar","not","concat"],kB=V($He,qHe,e=>{var{typed:t,matrix:r,equalScalar:n,zeros:i,not:a,concat:o}=e,s=sS({typed:t,matrix:r,equalScalar:n,zeros:i,not:a,concat:o});function l(u,c,f){var d=u[0].compile().evaluate(f);if(!Da(d)){if(isNaN(d))return NaN;if(d===0||d===!1)return 0}var p=u[1].compile().evaluate(f);return s(d,p)}return l.rawArgs=!0,l},{isTransformFunction:!0});var LHe="bitOr",zHe=["typed","matrix","equalScalar","DenseMatrix","concat"],CB=V(LHe,zHe,e=>{var{typed:t,matrix:r,equalScalar:n,DenseMatrix:i,concat:a}=e,o=lS({typed:t,matrix:r,equalScalar:n,DenseMatrix:i,concat:a});function s(l,u,c){var f=l[0].compile().evaluate(c);if(!Da(f)){if(isNaN(f))return NaN;if(f===-1)return-1;if(f===!0)return 1}var d=l[1].compile().evaluate(c);return o(f,d)}return s.rawArgs=!0,s},{isTransformFunction:!0});var yt=CT({config:it}),Si=DT({}),UH=ZP({BigNumber:yt,config:it}),Cge=WP({}),Dge=kI({BigNumber:yt,config:it}),Z0=OT({}),WH=iI({Complex:Si}),Oge=VP({BigNumber:yt,config:it}),Mge=JP({BigNumber:yt,config:it}),jge=tI({BigNumber:yt,config:it}),rC=jT({}),Nge=GP({BigNumber:yt,config:it}),Tge=HP({}),Fge=XP({BigNumber:yt,config:it}),_ge=MT({}),HH=vT({}),Pge=rI({BigNumber:yt,config:it}),Ige=WI({BigNumber:yt,config:it}),VH=YP({BigNumber:yt,config:it}),Bge=UP({}),Rge=aI({}),Lr=TT({Matrix:rC}),$ge=_I({BigNumber:yt,config:it}),qge=KP({BigNumber:yt,config:it}),DB=QP({BigNumber:yt,config:it}),Lge=zP({}),zge=nI({BigNumber:yt,config:it}),Me=gT({BigNumber:yt,Complex:Si,DenseMatrix:Lr,Fraction:Z0}),OB=oF({BigNumber:yt,config:it,typed:Me}),Uge=FI({BigNumber:yt,config:it}),lu=sF({typed:Me}),Wge=m_({Complex:Si,config:it,typed:Me}),Hge=A_({BigNumber:yt,typed:Me}),Vge=v_({BigNumber:yt,Complex:Si,config:it,typed:Me}),Yo=uF({typed:Me}),Gge=PF({typed:Me}),Qge=x_({BigNumber:yt,Complex:Si,config:it,typed:Me}),Yge=S_({typed:Me}),GH=E_({typed:Me}),Zge=C_({Complex:Si,config:it,typed:Me}),Oc=XT({BigNumber:yt,typed:Me}),Xge=FF({typed:Me}),Kge=ZT({typed:Me}),Jge=FT({typed:Me}),nC=hP({typed:Me}),iC=KT({Complex:Si,typed:Me}),X0=IF({typed:Me}),MB=D_({typed:Me}),e0e=M_({BigNumber:yt,typed:Me}),t0e=N_({BigNumber:yt,typed:Me}),r0e=pF({typed:Me}),Zr=VT({config:it,typed:Me}),n0e=d3({typed:Me}),QH=mF({typed:Me}),i0e=hF({Complex:Si,typed:Me}),a0e=WF({typed:Me}),o0e=VF({typed:Me}),_S=A3({typed:Me}),jB=GF({typed:Me}),s0e=y3({format:_S,typed:Me}),NB=BF({typed:Me}),Wu=IT({typed:Me}),GA=RT({typed:Me}),K0=LT({typed:Me}),Nd=zT({typed:Me}),l0e=eI({BigNumber:yt,config:it}),u0e=vP({Complex:Si,typed:Me}),c0e=yF({Complex:Si,config:it,typed:Me}),YH=bF({Complex:Si,config:it,typed:Me}),J0=ZF({typed:Me}),to=xF({typed:Me}),aC=$F({typed:Me}),Xm=QT({typed:Me}),f0e=v3({format:_S,typed:Me}),d0e=EP({config:it,typed:Me}),p0e=vS({typed:Me}),m0e=kP({config:it,typed:Me}),TB=RF({typed:Me}),h0e=F_({BigNumber:yt,typed:Me}),ZH=EF({BigNumber:yt,Fraction:Z0,complex:iC,typed:Me}),oC=P_({typed:Me}),Km=GT({Matrix:rC,equalScalar:Zr,typed:Me}),A0e=iF({typed:Me}),g0e=CF({typed:Me}),v0e=YT({typed:Me}),wf=cF({typed:Me}),y0e=B_({typed:Me}),XH=WT({typed:Me}),b0e=h_({Complex:Si,config:it,typed:Me}),x0e=y_({BigNumber:yt,typed:Me}),FB=G0({isInteger:Wu,typed:Me}),w0e=b_({BigNumber:yt,Complex:Si,config:it,typed:Me}),S0e=g3({format:_S,typed:Me}),E0e=AP({typed:Me}),k0e=O_({typed:Me}),C0e=T_({BigNumber:yt,typed:Me}),PS=UT({typed:Me}),D0e=w3({typed:Me}),O0e=CP({config:it,typed:Me}),M0e=__({BigNumber:yt,typed:Me}),j0e=I_({typed:Me}),N0e=d_({SparseMatrix:Km,typed:Me}),Td=kF({Complex:Si,config:it,typed:Me}),T0e=R_({typed:Me}),zp=aF({typed:Me}),F0e=g_({BigNumber:yt,Complex:Si,config:it,typed:Me}),_0e=j_({BigNumber:yt,typed:Me}),Oy=JT({Fraction:Z0,typed:Me}),ev=$T({typed:Me}),vt=eF({DenseMatrix:Lr,Matrix:rC,SparseMatrix:Km,typed:Me}),P0e=tF({isZero:Nd,matrix:vt,typed:Me}),I0e=m3({isNaN:PS,isNumeric:ev,typed:Me}),Fd=S3({bignumber:Oc,fraction:Oy,number:Xm}),KH=h3({config:it,multiplyScalar:to,numeric:Fd,typed:Me}),JH=e3({isInteger:Wu,matrix:vt,typed:Me}),Vs=i3({matrix:vt,config:it,typed:Me}),B0e=a3({matrix:vt,typed:Me}),IS=o3({matrix:vt,typed:Me}),eV=OF({BigNumber:yt,config:it,matrix:vt,typed:Me}),Gs=l3({BigNumber:yt,config:it,matrix:vt,typed:Me}),R0e=w_({Complex:Si,config:it,typed:Me}),tV=fF({BigNumber:yt,Complex:Si,Fraction:Z0,config:it,isNegative:GA,matrix:vt,typed:Me,unaryMinus:zp}),xn=cS({isInteger:Wu,matrix:vt,typed:Me}),$0e=LF({prod:KH,size:Vs,typed:Me}),_B=s3({conj:X0,transpose:IS,typed:Me}),rV=UF({DenseMatrix:Lr,SparseMatrix:Km,matrix:vt,typed:Me}),Ma=E3({numeric:Fd,typed:Me}),BS=N3({DenseMatrix:Lr,concat:xn,divideScalar:Ma,equalScalar:Zr,matrix:vt,typed:Me}),Sf=W3({DenseMatrix:Lr,concat:xn,equalScalar:Zr,matrix:vt,typed:Me}),RS=HF({matrix:vt,typed:Me}),q0e=qT({isNumeric:ev,typed:Me}),QA=QF({BigNumber:yt,DenseMatrix:Lr,SparseMatrix:Km,config:it,matrix:vt,typed:Me}),L0e=YF({matrix:vt,multiplyScalar:to,typed:Me}),sC=J3({DenseMatrix:Lr,concat:xn,config:it,matrix:vt,typed:Me}),z0e=I3({DenseMatrix:Lr,concat:xn,equalScalar:Zr,matrix:vt,typed:Me,zeros:Gs}),nV=T3({DenseMatrix:Lr,divideScalar:Ma,equalScalar:Zr,matrix:vt,multiplyScalar:to,subtractScalar:wf,typed:Me}),PB=nF({flatten:RS,matrix:vt,size:Vs,typed:Me}),U0e=SF({BigNumber:yt,concat:xn,equalScalar:Zr,matrix:vt,typed:Me}),W0e=XF({BigNumber:yt,config:it,matrix:vt,typed:Me}),IB=U4({addScalar:Yo,complex:iC,conj:X0,divideScalar:Ma,equal:Sf,identity:QA,isZero:Nd,matrix:vt,multiplyScalar:to,sign:ZH,sqrt:Td,subtractScalar:wf,typed:Me,unaryMinus:zp,zeros:Gs}),H0e=t3({config:it,matrix:vt}),V0e=B3({DenseMatrix:Lr,concat:xn,equalScalar:Zr,matrix:vt,typed:Me,zeros:Gs}),My=C3({BigNumber:yt,DenseMatrix:Lr,config:it,equalScalar:Zr,matrix:vt,typed:Me,zeros:Gs}),uu=G3({DenseMatrix:Lr,concat:xn,config:it,matrix:vt,typed:Me}),ro=DF({DenseMatrix:Lr,concat:xn,equalScalar:Zr,matrix:vt,subtractScalar:wf,typed:Me,unaryMinus:zp}),G0e=x3({concat:xn,matrix:vt,typed:Me}),Q0e=r_({DenseMatrix:Lr,concat:xn,config:it,equalScalar:Zr,matrix:vt,typed:Me}),BB=F3({DenseMatrix:Lr,divideScalar:Ma,equalScalar:Zr,matrix:vt,multiplyScalar:to,subtractScalar:wf,typed:Me}),Y0e=qF({DenseMatrix:Lr,concat:xn,matrix:vt,typed:Me}),an=Y_({DenseMatrix:Lr,SparseMatrix:Km,addScalar:Yo,concat:xn,equalScalar:Zr,matrix:vt,typed:Me}),Z0e=k_({BigNumber:yt,DenseMatrix:Lr,concat:xn,equalScalar:Zr,matrix:vt,typed:Me}),X0e=sS({concat:xn,equalScalar:Zr,matrix:vt,typed:Me}),K0e=lS({DenseMatrix:Lr,concat:xn,equalScalar:Zr,matrix:vt,typed:Me}),J0e=_F({DenseMatrix:Lr,concat:xn,matrix:vt,typed:Me}),eve=MP({addScalar:Yo,combinations:nC,divideScalar:Ma,isInteger:Wu,isNegative:GA,multiplyScalar:to,typed:Me}),tv=q3({BigNumber:yt,DenseMatrix:Lr,Fraction:Z0,concat:xn,config:it,equalScalar:Zr,matrix:vt,typed:Me}),iV=z3({concat:xn,matrix:vt,typed:Me}),tve=DS({add:an,typed:Me,unaryPlus:OB}),RB=e_({equal:Sf,typed:Me}),rve=dS({matrix:vt,number:Xm,subtract:ro,typed:Me}),nve=uP({abs:lu,addScalar:Yo,deepEqual:RB,divideScalar:Ma,multiplyScalar:to,sqrt:Td,subtractScalar:wf,typed:Me}),lC=K_({addScalar:Yo,conj:X0,multiplyScalar:to,size:Vs,typed:Me}),ive=H3({compareText:iV,isZero:Nd,typed:Me}),aV=nS({DenseMatrix:Lr,config:it,equalScalar:Zr,matrix:vt,round:My,typed:Me,zeros:Gs}),ave=gF({BigNumber:yt,DenseMatrix:Lr,concat:xn,config:it,equalScalar:Zr,matrix:vt,round:My,typed:Me,zeros:Gs}),ove=Z_({abs:lu,addScalar:Yo,divideScalar:Ma,isPositive:K0,multiplyScalar:to,smaller:uu,sqrt:Td,typed:Me}),oV=a_({DenseMatrix:Lr,smaller:uu}),Sl=o_({ImmutableDenseMatrix:oV,getMatrixDataType:jB}),cu=X3({DenseMatrix:Lr,concat:xn,config:it,matrix:vt,typed:Me}),$B=D3({Complex:Si,config:it,divideScalar:Ma,typed:Me}),sve=_3({DenseMatrix:Lr,divideScalar:Ma,equalScalar:Zr,matrix:vt,multiplyScalar:to,subtractScalar:wf,typed:Me}),lve=rF({flatten:RS,matrix:vt,size:Vs,typed:Me}),uve=ES({config:it,numeric:Fd,smaller:uu,typed:Me}),sV=iS({DenseMatrix:Lr,concat:xn,config:it,equalScalar:Zr,matrix:vt,round:My,typed:Me,zeros:Gs}),ni=wF({addScalar:Yo,dot:lC,equalScalar:Zr,matrix:vt,multiplyScalar:to,typed:Me}),cve=M3({Complex:Si,config:it,divideScalar:Ma,typed:Me}),fve=uS({DenseMatrix:Lr,concat:xn,equalScalar:Zr,matrix:vt,typed:Me}),uC=n_({compare:tv,isNaN:PS,isNumeric:ev,typed:Me}),dve=R3({DenseMatrix:Lr,concat:xn,equalScalar:Zr,matrix:vt,typed:Me,zeros:Gs}),lV=V4({SparseMatrix:Km,abs:lu,add:an,divideScalar:Ma,larger:cu,largerEq:sC,multiply:ni,subtract:ro,transpose:IS,typed:Me}),Mc=AS({add:an,matrix:vt,typed:Me,zeros:Gs}),qB=CS({add:an,config:it,numeric:Fd,typed:Me}),pve=J_({add:an,matrix:vt,typed:Me}),uV=P3({DenseMatrix:Lr,divideScalar:Ma,equalScalar:Zr,matrix:vt,multiplyScalar:to,subtractScalar:wf,typed:Me}),mve=$P({Complex:Si,add:an,multiply:ni,number:Xm,typed:Me}),LB=dF({DenseMatrix:Lr,config:it,equalScalar:Zr,matrix:vt,round:My,typed:Me,zeros:Gs}),Up=L3({compare:tv,typed:Me}),hve=jP({addScalar:Yo,combinations:nC,isInteger:Wu,isNegative:GA,isPositive:K0,larger:cu,typed:Me}),Ave=zF({matrix:vt,multiply:ni,subtract:ro,typed:Me}),cV=J4({divideScalar:Ma,isZero:Nd,matrix:vt,multiply:ni,subtractScalar:wf,typed:Me,unaryMinus:zp}),gve=NF({concat:xn,equalScalar:Zr,matrix:vt,multiplyScalar:to,typed:Me}),fV=s_({larger:cu,smaller:uu}),dV=AF({Complex:Si,DenseMatrix:Lr,ceil:LB,equalScalar:Zr,floor:aV,matrix:vt,typed:Me,zeros:Gs}),pV=e4({Index:Sl,typed:Me}),vve=cP({abs:lu,add:an,addScalar:Yo,config:it,divideScalar:Ma,equalScalar:Zr,flatten:RS,isNumeric:ev,isZero:Nd,matrix:vt,multiply:ni,multiplyScalar:to,smaller:uu,subtract:ro,typed:Me}),yve=MF({BigNumber:yt,add:an,config:it,equal:Sf,isInteger:Wu,mod:sV,smaller:uu,typed:Me,xgcd:eV}),bve=vF({concat:xn,equalScalar:Zr,matrix:vt,typed:Me}),xve=O3({Complex:Si,config:it,divideScalar:Ma,log:$B,typed:Me}),zB=SS({config:it,larger:cu,numeric:Fd,typed:Me}),wve=$_({DenseMatrix:Lr,Index:Sl,compareNatural:Up,size:Vs,subset:Mc,typed:Me}),Sve=L_({DenseMatrix:Lr,Index:Sl,compareNatural:Up,size:Vs,subset:Mc,typed:Me}),Eve=U_({Index:Sl,compareNatural:Up,size:Vs,subset:Mc,typed:Me}),kve=H_({Index:Sl,compareNatural:Up,size:Vs,subset:Mc,typed:Me}),jy=Y3({DenseMatrix:Lr,concat:xn,config:it,matrix:vt,typed:Me}),Cve=i_({compare:tv,compareNatural:Up,matrix:vt,typed:Me}),Dve=wS({concat:xn,equalScalar:Zr,matrix:vt,not:aC,typed:Me,zeros:Gs}),Ny=mS({bignumber:Oc,matrix:vt,add:an,config:it,isPositive:K0,larger:cu,largerEq:sC,smaller:uu,smallerEq:jy,typed:Me}),Ove=hS({Index:Sl,matrix:vt,range:Ny,typed:Me}),mV=q_({DenseMatrix:Lr,Index:Sl,compareNatural:Up,size:Vs,subset:Mc,typed:Me}),Mve=W_({Index:Sl,compareNatural:Up,size:Vs,subset:Mc,typed:Me}),hV=G_({Index:Sl,concat:xn,setDifference:mV,size:Vs,subset:Mc,typed:Me}),AV=l_({FibonacciHeap:fV,addScalar:Yo,equalScalar:Zr}),gV=fS({Index:Sl,matrix:vt,range:Ny,typed:Me}),rv=eP({abs:lu,addScalar:Yo,det:cV,divideScalar:Ma,identity:QA,matrix:vt,multiply:ni,typed:Me,unaryMinus:zp}),vV=z4({DenseMatrix:Lr,Spa:AV,SparseMatrix:Km,abs:lu,addScalar:Yo,divideScalar:Ma,equalScalar:Zr,larger:cu,matrix:vt,multiplyScalar:to,subtractScalar:wf,typed:Me,unaryMinus:zp}),jve=tP({Complex:Si,add:an,ctranspose:_B,deepEqual:RB,divideScalar:Ma,dot:lC,dotDivide:BS,equal:Sf,inv:rv,matrix:vt,multiply:ni,typed:Me}),Ef=k3({Complex:Si,config:it,fraction:Oy,identity:QA,inv:rv,matrix:vt,multiply:ni,number:Xm,typed:Me}),yV=z_({DenseMatrix:Lr,Index:Sl,compareNatural:Up,size:Vs,subset:Mc,typed:Me}),Nve=Q_({Index:Sl,concat:xn,setIntersect:yV,setSymDifference:hV,size:Vs,subset:Mc,typed:Me}),Tve=iP({abs:lu,add:an,identity:QA,inv:rv,map:J0,max:zB,multiply:ni,size:Vs,sqrt:Td,subtract:ro,typed:Me}),yr=c_({BigNumber:yt,Complex:Si,Fraction:Z0,abs:lu,addScalar:Yo,config:it,divideScalar:Ma,equal:Sf,fix:dV,format:_S,isNumeric:ev,multiplyScalar:to,number:Xm,pow:Ef,round:My,subtractScalar:wf}),Fve=dI({BigNumber:yt,Unit:yr,config:it}),_ve=GI({BigNumber:yt,Unit:yr,config:it}),Pve=PI({BigNumber:yt,Unit:yr,config:it}),Ive=hI({BigNumber:yt,Unit:yr,config:it}),Bve=BI({BigNumber:yt,Unit:yr,config:it}),Rve=AI({BigNumber:yt,Unit:yr,config:it}),$ve=pI({BigNumber:yt,Unit:yr,config:it}),qve=OI({BigNumber:yt,Unit:yr,config:it}),Lve=j3({DenseMatrix:Lr,concat:xn,equalScalar:Zr,matrix:vt,pow:Ef,typed:Me}),zve=fI({BigNumber:yt,Unit:yr,config:it}),Uve=mI({BigNumber:yt,Unit:yr,config:it}),Wve=nP({abs:lu,add:an,identity:QA,inv:rv,multiply:ni,typed:Me}),Hve=RI({BigNumber:yt,Unit:yr,config:it}),bV=u3({addScalar:Yo,ceil:LB,conj:X0,divideScalar:Ma,dotDivide:BS,exp:QH,i:WH,log2:YH,matrix:vt,multiplyScalar:to,pow:Ef,tau:VH,typed:Me}),UB=gP({BigNumber:yt,Complex:Si,config:it,multiplyScalar:to,pow:Ef,typed:Me}),Vve=sI({BigNumber:yt,Unit:yr,config:it}),Gve=CI({BigNumber:yt,Unit:yr,config:it}),Qve=c3({conj:X0,dotDivide:BS,fft:bV,typed:Me}),Yve=bI({BigNumber:yt,Unit:yr,config:it}),Zve=qI({BigNumber:yt,Unit:yr,config:it}),Xve=cI({BigNumber:yt,Unit:yr,config:it}),Kve=QI({BigNumber:yt,Unit:yr,config:it}),Jve=zI({BigNumber:yt,Unit:yr,config:it}),e1e=MI({BigNumber:yt,Unit:yr,config:it}),t1e=yI({BigNumber:yt,Unit:yr,config:it}),r1e=eB({BigNumber:yt,Unit:yr,config:it}),n1e=XI({BigNumber:yt,Unit:yr,config:it}),i1e=tB({BigNumber:yt,Unit:yr,config:it}),a1e=DI({BigNumber:yt,Unit:yr,config:it}),o1e=jI({BigNumber:yt,Unit:yr,config:it}),s1e=uI({BigNumber:yt,Unit:yr,config:it}),l1e=NI({BigNumber:yt,Unit:yr,config:it}),u1e=HI({BigNumber:yt,Unit:yr,config:it}),c1e=oI({BigNumber:yt,Unit:yr,config:it}),f1e=VI({BigNumber:yt,Unit:yr,config:it}),d1e=TI({BigNumber:yt,Unit:yr,config:it}),p1e=II({BigNumber:yt,Unit:yr,config:it}),m1e=xI({BigNumber:yt,Unit:yr,config:it}),h1e=p_({Unit:yr,typed:Me}),vs=lP({divideScalar:Ma,equalScalar:Zr,inv:rv,matrix:vt,multiply:ni,typed:Me}),A1e=SI({BigNumber:yt,Unit:yr,config:it}),$S=yP({gamma:UB,typed:Me}),g1e=$I({BigNumber:yt,Unit:yr,config:it}),v1e=ZI({BigNumber:yt,Unit:yr,config:it}),y1e=gI({BigNumber:yt,Unit:yr,config:it}),xV=G4({DenseMatrix:Lr,lsolve:nV,lup:vV,matrix:vt,slu:lV,typed:Me,usolve:BB}),b1e=vI({BigNumber:yt,Unit:yr,config:it}),x1e=YI({BigNumber:yt,Unit:yr,config:it}),w1e=xP({add:an,divide:vs,factorial:$S,isInteger:Wu,isPositive:K0,multiply:ni,typed:Me}),S1e=wP({factorial:$S,typed:Me}),E1e=KI({BigNumber:yt,Unit:yr,config:it}),k1e=Q4({add:an,cbrt:tV,divide:vs,equalScalar:Zr,im:NB,isZero:Nd,multiply:ni,re:TB,sqrt:Td,subtract:ro,typeOf:XH,typed:Me,unaryMinus:zp}),C1e=V_({compareNatural:Up,typed:Me}),D1e=f3({abs:lu,add:an,bignumber:Oc,divide:vs,isNegative:GA,isPositive:K0,larger:cu,map:J0,matrix:vt,max:zB,multiply:ni,smaller:uu,subtract:ro,typed:Me,unaryMinus:zp}),wV=DP({bignumber:Oc,addScalar:Yo,combinations:nC,divideScalar:Ma,factorial:$S,isInteger:Wu,isNegative:GA,larger:cu,multiplyScalar:to,number:Xm,pow:Ef,subtractScalar:wf,typed:Me}),O1e=f_({Unit:yr,typed:Me}),M1e=OP({addScalar:Yo,isInteger:Wu,isNegative:GA,stirlingS2:wV,typed:Me}),SV=rP({abs:lu,add:an,addScalar:Yo,atan:GH,bignumber:Oc,column:gV,complex:iC,config:it,cos:MB,diag:rV,divideScalar:Ma,dot:lC,equal:Sf,flatten:RS,im:NB,inv:rv,larger:cu,matrix:vt,matrixFromColumns:PB,multiply:ni,multiplyScalar:to,number:Xm,qr:IB,re:TB,reshape:JH,sin:oC,size:Vs,smaller:uu,sqrt:Td,subtract:ro,typed:Me,usolve:BB,usolveAll:uV}),j1e=EI({BigNumber:yt,Unit:yr,config:it}),N1e=LI({BigNumber:yt,Unit:yr,config:it}),T1e=bP({divide:vs,dotDivide:BS,isNumeric:ev,log:$B,map:J0,matrix:vt,multiply:ni,sum:qB,typed:Me}),EV=OS({add:an,divide:vs,typed:Me}),F1e=UI({BigNumber:yt,Unit:yr,config:it}),_1e=lI({BigNumber:yt,Unit:yr,config:it}),P1e=jS({bignumber:Oc,add:an,compare:tv,divide:vs,isInteger:Wu,larger:cu,multiply:ni,partitionSelect:uC,smaller:uu,smallerEq:jy,subtract:ro,typed:Me}),WB=MS({add:an,apply:FB,divide:vs,isNaN:PS,multiply:ni,subtract:ro,typed:Me}),I1e=wI({BigNumber:yt,Unit:yr,config:it}),cC=dP({add:an,compare:tv,divide:vs,partitionSelect:uC,typed:Me}),B1e=mP({add:an,divide:vs,matrix:vt,mean:EV,multiply:ni,pow:Ef,sqrt:Td,subtract:ro,sum:qB,typed:Me}),R1e=qP({Complex:Si,add:an,divide:vs,matrix:vt,multiply:ni,typed:Me}),$1e=pP({abs:lu,map:J0,median:cC,subtract:ro,typed:Me}),q1e=NS({map:J0,sqrt:Td,typed:Me,variance:WB}),L1e=p3({BigNumber:yt,Complex:Si,add:an,config:it,divide:vs,equal:Sf,factorial:$S,gamma:UB,isNegative:GA,multiply:ni,pi:DB,pow:Ef,sin:oC,smallerEq:jy,subtract:ro,typed:Me}),HB=X_({abs:lu,add:an,conj:X0,ctranspose:_B,eigs:SV,equalScalar:Zr,larger:cu,matrix:vt,multiply:ni,pow:Ef,smaller:uu,sqrt:Td,typed:Me}),kV=n3({BigNumber:yt,DenseMatrix:Lr,SparseMatrix:Km,addScalar:Yo,config:it,cos:MB,matrix:vt,multiplyScalar:to,norm:HB,sin:oC,typed:Me,unaryMinus:zp}),z1e=JI({BigNumber:yt,Unit:yr,config:it}),CV=oP({identity:QA,matrix:vt,multiply:ni,norm:HB,qr:IB,subtract:ro,typed:Me}),U1e=r3({multiply:ni,rotationMatrix:kV,typed:Me}),DV=aP({abs:lu,add:an,concat:xn,identity:QA,index:pV,lusolve:xV,matrix:vt,matrixFromColumns:PB,multiply:ni,range:Ny,schur:CV,subset:Mc,subtract:ro,transpose:IS,typed:Me}),W1e=sP({matrix:vt,multiply:ni,sylvester:DV,transpose:IS,typed:Me});var qS={},LS={},H1e={},fu=r4({mathWithTransform:LS}),zS=k4({Node:fu}),YA=D4({Node:fu}),Ty=M4({Node:fu}),V1e=F4({Node:fu}),US=s4({Node:fu}),G1e=p4({Node:fu,ResultSet:HH}),Q1e=h4({Node:fu}),nv=y4({Node:fu}),Y1e=N4({Node:fu}),UHe=LP({classes:H1e}),OV=Z4({math:qS,typed:Me}),Z1e=x4({Node:fu,typed:Me}),WHe=K4({Chain:OV,typed:Me}),WS=S4({Node:fu,size:Vs}),HS=a4({Node:fu,subset:Mc}),X1e=f4({matrix:vt,Node:fu,subset:Mc}),iv=_4({Unit:yr,Node:fu,math:qS}),av=I4({Node:fu,SymbolNode:iv,math:qS}),_d=B4({AccessorNode:HS,ArrayNode:US,AssignmentNode:X1e,BlockNode:G1e,ConditionalNode:Q1e,ConstantNode:nv,FunctionAssignmentNode:Z1e,FunctionNode:av,IndexNode:WS,ObjectNode:zS,OperatorNode:YA,ParenthesisNode:Ty,RangeNode:Y1e,RelationalNode:V1e,SymbolNode:iv,config:it,numeric:Fd,typed:Me}),K1e=PP({ConstantNode:nv,FunctionNode:av,OperatorNode:YA,ParenthesisNode:Ty,parse:_d,typed:Me}),MV=FP({bignumber:Oc,fraction:Oy,AccessorNode:HS,ArrayNode:US,ConstantNode:nv,FunctionNode:av,IndexNode:WS,ObjectNode:zS,OperatorNode:YA,SymbolNode:iv,config:it,mathWithTransform:LS,matrix:vt,typed:Me}),HHe=R4({parse:_d,typed:Me}),jV=_P({AccessorNode:HS,ArrayNode:US,ConstantNode:nv,FunctionNode:av,IndexNode:WS,ObjectNode:zS,OperatorNode:YA,ParenthesisNode:Ty,SymbolNode:iv,add:an,divide:vs,equal:Sf,isZero:Nd,multiply:ni,parse:_d,pow:Ef,subtract:ro,typed:Me}),NV=$4({parse:_d,typed:Me}),J1e=Y4({evaluate:NV}),eye=q4({evaluate:NV}),VB=TP({bignumber:Oc,fraction:Oy,AccessorNode:HS,ArrayNode:US,ConstantNode:nv,FunctionNode:av,IndexNode:WS,ObjectNode:zS,OperatorNode:YA,ParenthesisNode:Ty,SymbolNode:iv,add:an,config:it,divide:vs,equal:Sf,isZero:Nd,mathWithTransform:LS,matrix:vt,multiply:ni,parse:_d,pow:Ef,resolve:K1e,simplifyConstant:MV,simplifyCore:jV,subtract:ro,typed:Me}),VHe=IP({OperatorNode:YA,parse:_d,simplify:VB,typed:Me}),GHe=NP({parse:_d,typed:Me}),QHe=L4({Parser:eye,typed:Me}),YHe=RP({bignumber:Oc,fraction:Oy,AccessorNode:HS,ArrayNode:US,ConstantNode:nv,FunctionNode:av,IndexNode:WS,ObjectNode:zS,OperatorNode:YA,ParenthesisNode:Ty,SymbolNode:iv,add:an,config:it,divide:vs,equal:Sf,isZero:Nd,mathWithTransform:LS,matrix:vt,multiply:ni,parse:_d,pow:Ef,simplify:VB,simplifyConstant:MV,simplifyCore:jV,subtract:ro,typed:Me}),ZHe=BP({ConstantNode:nv,FunctionNode:av,OperatorNode:YA,ParenthesisNode:Ty,SymbolNode:iv,config:it,equal:Sf,isZero:Nd,numeric:Fd,parse:_d,simplify:VB,typed:Me}),XHe=X4({Help:J1e,mathWithTransform:LS,typed:Me});Fn(qS,{e:UH,false:Cge,fineStructure:Dge,i:WH,Infinity:Oge,LN10:Mge,LOG10E:jge,NaN:Nge,null:Tge,phi:Fge,SQRT1_2:Pge,sackurTetrode:Ige,tau:VH,true:Bge,E:UH,version:Rge,efimovFactor:$ge,LN2:qge,pi:DB,replacer:Lge,reviver:UHe,SQRT2:zge,typed:Me,unaryPlus:OB,PI:DB,weakMixingAngle:Uge,abs:lu,acos:Wge,acot:Hge,acsc:Vge,addScalar:Yo,arg:Gge,asech:Qge,asinh:Yge,atan:GH,atanh:Zge,bignumber:Oc,bitNot:Xge,boolean:Kge,clone:Jge,combinations:nC,complex:iC,conj:X0,cos:MB,cot:e0e,csc:t0e,cube:r0e,equalScalar:Zr,erf:n0e,exp:QH,expm1:i0e,filter:a0e,forEach:o0e,format:_S,getMatrixDataType:jB,hex:s0e,im:NB,isInteger:Wu,isNegative:GA,isPositive:K0,isZero:Nd,LOG2E:l0e,lgamma:u0e,log10:c0e,log2:YH,map:J0,multiplyScalar:to,not:aC,number:Xm,oct:f0e,pickRandom:d0e,print:p0e,random:m0e,re:TB,sec:h0e,sign:ZH,sin:oC,splitUnit:A0e,square:g0e,string:v0e,subtractScalar:wf,tan:y0e,typeOf:XH,acosh:b0e,acsch:x0e,apply:FB,asec:w0e,bin:S0e,chain:WHe,combinationsWithRep:E0e,cosh:k0e,csch:C0e,isNaN:PS,isPrime:D0e,randomInt:O0e,sech:M0e,sinh:j0e,sparse:N0e,sqrt:Td,tanh:T0e,unaryMinus:zp,acoth:F0e,coth:_0e,fraction:Oy,isNumeric:ev,matrix:vt,matrixFromFunction:P0e,mode:I0e,numeric:Fd,prod:KH,reshape:JH,size:Vs,squeeze:B0e,transpose:IS,xgcd:eV,zeros:Gs,asin:R0e,cbrt:tV,concat:xn,count:$0e,ctranspose:_B,diag:rV,divideScalar:Ma,dotDivide:BS,equal:Sf,flatten:RS,hasNumericValue:q0e,identity:QA,kron:L0e,largerEq:sC,leftShift:z0e,lsolve:nV,matrixFromColumns:PB,nthRoot:U0e,ones:W0e,qr:IB,resize:H0e,rightArithShift:V0e,round:My,smaller:uu,subtract:ro,to:G0e,unequal:Q0e,usolve:BB,xor:Y0e,add:an,atan2:Z0e,bitAnd:X0e,bitOr:K0e,bitXor:J0e,catalan:eve,compare:tv,compareText:iV,cumsum:tve,deepEqual:RB,diff:rve,distance:nve,dot:lC,equalText:ive,floor:aV,gcd:ave,hypot:ove,larger:cu,log:$B,lsolveAll:sve,matrixFromRows:lve,min:uve,mod:sV,multiply:ni,nthRoots:cve,or:fve,partitionSelect:uC,rightLogShift:dve,slu:lV,subset:Mc,sum:qB,trace:pve,usolveAll:uV,zpk2tf:mve,ceil:LB,compareNatural:Up,composition:hve,cross:Ave,det:cV,dotMultiply:gve,fix:dV,index:pV,intersect:vve,invmod:yve,lcm:bve,log1p:xve,max:zB,setCartesian:wve,setDistinct:Sve,setIsSubset:Eve,setPowerset:kve,smallerEq:jy,sort:Cve,and:Dve,range:Ny,row:Ove,setDifference:mV,setMultiplicity:Mve,setSymDifference:hV,column:gV,inv:rv,lup:vV,pinv:jve,pow:Ef,setIntersect:yV,setUnion:Nve,sqrtm:Tve,vacuumImpedance:Fve,wienDisplacement:_ve,atomicMass:Pve,bohrMagneton:Ive,boltzmann:Bve,conductanceQuantum:Rve,coulomb:$ve,deuteronMass:qve,dotPow:Lve,electricConstant:zve,elementaryCharge:Uve,expm:Wve,faraday:Hve,fft:bV,gamma:UB,gravitationConstant:Vve,hartreeEnergy:Gve,ifft:Qve,klitzing:Yve,loschmidt:Zve,magneticConstant:Xve,molarMass:Kve,molarPlanckConstant:Jve,neutronMass:e1e,nuclearMagneton:t1e,planckCharge:r1e,planckLength:n1e,planckTemperature:i1e,protonMass:a1e,quantumOfCirculation:o1e,reducedPlanckConstant:s1e,rydberg:l1e,secondRadiation:u1e,speedOfLight:c1e,stefanBoltzmann:f1e,thomsonCrossSection:d1e,avogadro:p1e,bohrRadius:m1e,createUnit:h1e,divide:vs,electronMass:A1e,factorial:$S,firstRadiation:g1e,gravity:v1e,inverseConductanceQuantum:y1e,lusolve:xV,magneticFluxQuantum:b1e,molarMassC12:x1e,multinomial:w1e,parse:_d,permutations:S1e,planckMass:E1e,polynomialRoot:k1e,resolve:K1e,setSize:C1e,simplifyConstant:MV,solveODE:D1e,stirlingS2:wV,unit:O1e,bellNumbers:M1e,compile:HHe,eigs:SV,fermiCoupling:j1e,gasConstant:N1e,kldivergence:T1e,mean:EV,molarVolume:F1e,planckConstant:_1e,quantileSeq:P1e,simplifyCore:jV,variance:WB,classicalElectronRadius:I1e,evaluate:NV,median:cC,simplify:VB,symbolicEqual:VHe,corr:B1e,freqz:R1e,leafCount:GHe,mad:$1e,parser:QHe,rationalize:YHe,std:q1e,zeta:L1e,derivative:ZHe,norm:HB,rotationMatrix:kV,help:XHe,planckTime:z1e,schur:CV,rotate:U1e,sylvester:DV,lyap:W1e,config:it});Fn(LS,qS,{filter:aB({typed:Me}),forEach:oB({typed:Me}),map:lB({typed:Me}),apply:nB({isInteger:Wu,typed:Me}),or:EB({DenseMatrix:Lr,concat:xn,equalScalar:Zr,matrix:vt,typed:Me}),and:SB({add:an,concat:xn,equalScalar:Zr,matrix:vt,not:aC,typed:Me,zeros:Gs}),concat:hB({isInteger:Wu,matrix:vt,typed:Me}),max:uB({config:it,larger:cu,numeric:Fd,typed:Me}),print:wB({add:an,matrix:vt,typed:Me,zeros:Gs}),bitAnd:kB({add:an,concat:xn,equalScalar:Zr,matrix:vt,not:aC,typed:Me,zeros:Gs}),diff:AB({bignumber:Oc,matrix:vt,number:Xm,subtract:ro,typed:Me}),min:fB({config:it,numeric:Fd,smaller:uu,typed:Me}),subset:mB({add:an,matrix:vt,typed:Me,zeros:Gs}),bitOr:CB({DenseMatrix:Lr,concat:xn,equalScalar:Zr,matrix:vt,typed:Me}),cumsum:bB({add:an,typed:Me,unaryPlus:OB}),index:sB({Index:Sl,getMatrixDataType:jB}),sum:vB({add:an,config:it,numeric:Fd,typed:Me}),range:dB({bignumber:Oc,matrix:vt,add:an,config:it,isPositive:K0,larger:cu,largerEq:sC,smaller:uu,smallerEq:jy,typed:Me}),row:pB({Index:Sl,matrix:vt,range:Ny,typed:Me}),column:iB({Index:Sl,matrix:vt,range:Ny,typed:Me}),mean:cB({add:an,divide:vs,typed:Me}),quantileSeq:yB({add:an,bignumber:Oc,compare:tv,divide:vs,isInteger:Wu,larger:cu,multiply:ni,partitionSelect:uC,smaller:uu,smallerEq:jy,subtract:ro,typed:Me}),variance:xB({add:an,apply:FB,divide:vs,isNaN:PS,multiply:ni,subtract:ro,typed:Me}),std:gB({map:J0,sqrt:Td,typed:Me,variance:WB})});Fn(H1e,{BigNumber:yt,Complex:Si,Fraction:Z0,Matrix:rC,Node:fu,ObjectNode:zS,OperatorNode:YA,ParenthesisNode:Ty,Range:_ge,RelationalNode:V1e,ResultSet:HH,ArrayNode:US,BlockNode:G1e,ConditionalNode:Q1e,ConstantNode:nv,DenseMatrix:Lr,RangeNode:Y1e,Chain:OV,FunctionAssignmentNode:Z1e,SparseMatrix:Km,IndexNode:WS,ImmutableDenseMatrix:oV,Index:Sl,AccessorNode:HS,AssignmentNode:X1e,FibonacciHeap:fV,Spa:AV,Unit:yr,SymbolNode:iv,FunctionNode:av,Help:J1e,Parser:eye});OV.createProxy(qS);var TV=zH;var aye=Ae(sT(),1);var rye=Ae(tye(),1);function nye(e){var t=new rye.default;return e.on=t.on.bind(t),e.off=t.off.bind(t),e.once=t.once.bind(t),e.emit=t.emit.bind(t),e}function iye(e,t,r,n){function i(g,A){var b=arguments.length;if(b!==1&&b!==2)throw new bf("import",b,1,2);A||(A={});function v(k,j,O){if(Array.isArray(j))j.forEach(D=>v(k,D));else if(typeof j=="object")for(var C in j)Et(j,C)&&v(k,j[C],C);else if(by(j)||O!==void 0){var N=by(j)?h(j)?j.fn+".transform":j.fn:O;if(Et(k,N)&&k[N]!==j&&!A.silent)throw new Error('Cannot import "'+N+'" twice');k[N]=j}else if(!A.silent)throw new TypeError("Factory, Object, or Array expected")}var x={};v(x,g);for(var w in x)if(Et(x,w)){var S=x[w];if(by(S))u(S,A);else if(c(S))a(w,S,A);else if(!A.silent)throw new TypeError("Factory, Object, or Array expected")}}function a(g,A,b){if(b.wrap&&typeof A=="function"&&(A=l(A)),f(A)&&(A=e(g,{[A.signature]:A})),e.isTypedFunction(r[g])&&e.isTypedFunction(A)){b.override?A=e(g,A.signatures):A=e(r[g],A),r[g]=A,delete n[g],o(g,A),r.emit("import",g,function(){return A});return}if(r[g]===void 0||b.override){r[g]=A,delete n[g],o(g,A),r.emit("import",g,function(){return A});return}if(!b.silent)throw new Error('Cannot import "'+g+'": already exists')}function o(g,A){A&&typeof A.transform=="function"?(r.expression.transform[g]=A.transform,d(g)&&(r.expression.mathWithTransform[g]=A.transform)):(delete r.expression.transform[g],d(g)&&(r.expression.mathWithTransform[g]=A))}function s(g){delete r.expression.transform[g],d(g)?r.expression.mathWithTransform[g]=r[g]:delete r.expression.mathWithTransform[g]}function l(g){var A=function(){for(var v=[],x=0,w=arguments.length;x2&&arguments[2]!==void 0?arguments[2]:g.fn;if(aW(b,"."))throw new Error("Factory name should not contain a nested path. Name: "+JSON.stringify(b));var v=h(g)?r.expression.transform:r,x=b in r.expression.transform,w=Et(v,b)?v[b]:void 0,S=function(){var j={};g.dependencies.map(lW).forEach(C=>{if(aW(C,"."))throw new Error("Factory dependency should not contain a nested path. Name: "+JSON.stringify(C));C==="math"?j.math=r:C==="mathWithTransform"?j.mathWithTransform=r.expression.mathWithTransform:C==="classes"?j.classes=r:j[C]=r[C]});var O=g(j);if(O&&typeof O.transform=="function")throw new Error('Transforms cannot be attached to factory functions. Please create a separate function for it with exports.path="expression.transform"');if(w===void 0||A.override)return O;if(e.isTypedFunction(w)&&e.isTypedFunction(O))return e(w,O);if(A.silent)return w;throw new Error('Cannot import "'+b+'": already exists')};!g.meta||g.meta.lazy!==!1?(Hw(v,b,S),w&&x?s(b):(h(g)||p(g))&&Hw(r.expression.mathWithTransform,b,()=>v[b])):(v[b]=S(),w&&x?s(b):(h(g)||p(g))&&Hw(r.expression.mathWithTransform,b,()=>v[b])),n[b]=g,r.emit("import",b,S)}function c(g){return typeof g=="function"||typeof g=="number"||typeof g=="string"||typeof g=="boolean"||g===null||Fo(g)||ds(g)||It(g)||gf(g)||St(g)||Array.isArray(g)}function f(g){return typeof g=="function"&&typeof g.signature=="string"}function d(g){return!Et(m,g)}function p(g){return g.fn.indexOf(".")===-1&&!Et(m,g.fn)&&(!g.meta||!g.meta.isClass)}function h(g){return g!==void 0&&g.meta!==void 0&&g.meta.isTransformFunction===!0||!1}var m={expression:!0,type:!0,docs:!0,error:!0,json:!0,chain:!0};return i}function GB(e,t){var r=Fn({},gy,t);if(typeof Object.create!="function")throw new Error("ES5 not supported by this JavaScript engine. Please load the es5-shim and es5-sham library for compatibility.");var n=nye({isNumber:Qt,isComplex:ds,isBigNumber:It,isFraction:gf,isUnit:Fo,isString:da,isArray:Ir,isMatrix:St,isCollection:Da,isDenseMatrix:qA,isSparseMatrix:vf,isRange:R0,isIndex:Wm,isBoolean:VN,isResultSet:GN,isHelp:zw,isFunction:QN,isDate:YN,isRegExp:ZN,isObject:Hm,isNull:XN,isUndefined:KN,isAccessorNode:Uu,isArrayNode:ps,isAssignmentNode:JN,isBlockNode:eT,isConditionalNode:tT,isConstantNode:gr,isFunctionAssignmentNode:Ed,isFunctionNode:xl,isIndexNode:Sc,isNode:Nr,isObjectNode:Vm,isOperatorNode:bi,isParenthesisNode:ms,isRangeNode:rT,isRelationalNode:nT,isSymbolNode:ri,isChain:Uw});n.config=Xoe(r,n.emit),n.expression={transform:{},mathWithTransform:{config:n.config}};var i=[],a=[];function o(c){if(by(c))return c(n);var f=c[Object.keys(c)[0]];if(by(f))return f(n);if(!Qoe(c))throw console.warn("Factory object with properties `type`, `name`, and `factory` expected",c),new Error("Factory object with properties `type`, `name`, and `factory` expected");var d=i.indexOf(c),p;return d===-1?(c.math===!0?p=c.factory(n.type,r,o,n.typed,n):p=c.factory(n.type,r,o,n.typed),i.push(c),a.push(p)):p=a[d],p}var s={};function l(){for(var c=arguments.length,f=new Array(c),d=0;d{YU(s).forEach(c=>{c&&c.meta&&c.meta.recreateOnConfigChange&&u(c,{override:!0})})}),n.create=GB.bind(null,e),n.factory=V,n.import(YU(Voe(e))),n.ArgumentsError=bf,n.DimensionError=nr,n.IndexError=As,n}var fC={prop:{name:"prop",fn:"prop",args:[{name:"property",types:["text"]}],returnType:"any",description:"Get the value of a property",category:"Property",difficulty:1},slice:{name:"slice",fn:"slice",args:[{name:"text",types:["text"]},{name:"start",types:["number"]},{name:"end",types:["number"]}],returnType:"text",description:"Get a part of a text",category:"String",difficulty:1},if:{name:"if",fn:"if",args:[{name:"condition",types:["boolean"]},{name:"ifTrue",types:["any"]},{name:"ifFalse",types:["any"]}],returnType:"any",description:"If condition is true return the first argument else return the second",category:"Logic",difficulty:2},ifs:{name:"ifs",fn:"ifs",args:[{name:"condition",types:["boolean"]},{name:"ifTrue",types:["any"]},{name:"...",types:[]},{name:"ifFalse",types:["any"]}],returnType:"any",description:"If the first condition is true return the first argument else check the next condition",category:"Logic",difficulty:2},empty:{name:"empty",fn:"empty",args:[{name:"value",types:["any"]}],returnType:"boolean",description:"Check if a list is empty",category:"String",difficulty:1},length:{name:"length",fn:"length",args:[{name:"list",types:["any-multi"]}],returnType:"number",description:"Get the length of a list",category:"List",difficulty:1},values:{name:"values",fn:"values",args:[{name:"list",types:["any-multi"]}],returnType:"number",description:"Get the number of values in a list",category:"List",difficulty:1},uniques:{name:"uniques",fn:"uniques",args:[{name:"list",types:["any-list"]}],returnType:"number",description:"Get the number of unique values in a list",category:"List",difficulty:1},substring:{name:"substring",fn:"substring",args:[{name:"string",types:["text"]},{name:"start",types:["number"]},{name:"end",types:["number"]}],returnType:"text",description:"Get a substring of a string",category:"String",difficulty:2},startsWith:{name:"startsWith",fn:"startsWith",args:[{name:"string",types:["text"]},{name:"substring",types:["text"]}],returnType:"boolean",description:"Check if a string starts with another string",category:"String",difficulty:1},contains:{name:"contains",fn:"contains",args:[{name:"string",types:["text"]},{name:"substring",types:["text"]}],returnType:"boolean",description:"Check if a string contains another string",category:"String",difficulty:1},test:{name:"test",fn:"test",args:[{name:"string",types:["text"]},{name:"regex",types:["text"]}],returnType:"boolean",description:"Test a string with a regex",category:"String",difficulty:3},match:{name:"match",fn:"match",args:[{name:"string",types:["text"]},{name:"regex",types:["text"]}],returnType:"boolean",description:"Match a string with a regex",category:"String",difficulty:3},replace:{name:"replace",fn:"replace",args:[{name:"string",types:["text"]},{name:"search",types:["text"]},{name:"replace",types:["text"]}],returnType:"text",description:"Replace a string with another string",category:"String",difficulty:1},replaceAll:{name:"replaceAll",fn:"replaceAll",args:[{name:"string",types:["text"]},{name:"search",types:["text"]},{name:"replace",types:["text"]}],returnType:"text",description:"Replace all occurences of a string with another string",category:"String",difficulty:1},lower:{name:"lower",fn:"lower",args:[{name:"string",types:["text"]}],returnType:"text",description:"Convert a string to lowercase",category:"String",difficulty:1},upper:{name:"upper",fn:"upper",args:[{name:"string",types:["text"]}],returnType:"text",description:"Convert a string to uppercase",category:"String",difficulty:1},repeat:{name:"repeat",fn:"repeat",args:[{name:"string",types:["text"]},{name:"times",types:["number"]}],returnType:"text",description:"Repeat a string",category:"String",difficulty:1},format:{name:"format",fn:"format",args:[{name:"value",types:["any"]}],returnType:"text",description:"Format a value to string",category:"String",difficulty:1},toNumber:{name:"toNumber",fn:"toNumber",args:[{name:"value",types:["any"]}],returnType:"number",description:"Convert a value to a number",category:"Number",difficulty:1},now:{name:"now",fn:"now",args:[],returnType:"date",description:"Get the current date",category:"Date",difficulty:1},minute:{name:"minute",fn:"minute",args:[{name:"date",types:["date"]}],returnType:"number",description:"Get the minutes of a date",category:"Date",difficulty:1},hour:{name:"hour",fn:"hour",args:[{name:"date",types:["date"]}],returnType:"number",description:"Get the hours of a date",category:"Date",difficulty:1},day:{name:"day",fn:"day",args:[{name:"date",types:["date"]}],returnType:"number",description:"Get the day of a date",category:"Date",difficulty:1},date:{name:"date",fn:"date",args:[{name:"date",types:["date"]}],returnType:"number",description:"Get the date of a date",category:"Date",difficulty:1},week:{name:"week",fn:"week",args:[{name:"date",types:["date"]}],returnType:"number",description:"Get the week of a date",category:"Date",difficulty:1},month:{name:"month",fn:"month",args:[{name:"date",types:["date"]}],returnType:"number",description:"Get the month of a date",category:"Date",difficulty:1},year:{name:"year",fn:"year",args:[{name:"date",types:["date"]}],returnType:"number",description:"Get the year of a date",category:"Date",difficulty:1},pad:{name:"pad",fn:"pad",args:[{name:"number",types:["number"]},{name:"length",types:["number"]},{name:"text",types:["text"]}],returnType:"text",description:"Pad a number with text",category:"String",difficulty:1},range:{name:"range",fn:"range",args:[{name:"numbers",types:["number-multi"]}],returnType:"number",description:"Get the difference between the largest and smallest from a list of numbers",category:"List",difficulty:1},latest:{name:"latest",fn:"latest",args:[{name:"dates",types:["date-multi"]}],returnType:"date",description:"Get the latest date of a list of dates",category:"Date",difficulty:1},earliest:{name:"earliest",fn:"earliest",args:[{name:"dates",types:["date-multi"]}],returnType:"date",description:"Get the earliest date of a list of dates",category:"Date",difficulty:1},dateRange:{name:"dateRange",fn:"dateRange",args:[{name:"dates",types:["date-multi"]},{name:"type",types:["text"]}],returnType:"number",description:"Get the date range of a list of dates",category:"Date",difficulty:1},dateAdd:{name:"dateAdd",fn:"dateAdd",args:[{name:"date",types:["date"]},{name:"amount",types:["number"]},{name:"type",types:["text"]}],returnType:"date",description:"Add an amount to a date",category:"Date",difficulty:2},dateSubtract:{name:"dateSubtract",fn:"dateSubtract",args:[{name:"date",types:["date"]},{name:"amount",types:["number"]},{name:"type",types:["text"]}],description:"Subtract an amount from a date",category:"Date",difficulty:2},dateBetween:{name:"dateBetween",fn:"dateBetween",args:[{name:"date1",types:["date"]},{name:"date2",types:["date"]},{name:"type",types:["text"]}],returnType:"number",description:"Get the difference between two dates",category:"Date",difficulty:2},spaceItems:{name:"spaceItems",fn:"spaceItems",args:[{name:"path",types:["text"]}],returnType:"link-multi",description:"Get the items inside of a path",category:"Path",difficulty:2},spaces:{name:"spaces",fn:"spaces",args:[{name:"path",types:["text"]}],returnType:"link-multi",description:"Get the spaces the path is inside of",category:"Path",difficulty:2},timeStamp:{name:"timeStamp",fn:"timeStamp",args:[{name:"date",types:["date"]}],returnType:"number",description:"Get the timestamp of a date",category:"Date",difficulty:1},at:{name:"at",fn:"at",args:[{name:"list",types:["any-list"]},{name:"index",types:["number"]}],returnType:"any",description:"Get an element at a specific index",category:"List",difficulty:2},first:{name:"first",fn:"first",args:[{name:"list",types:["any-multi"]}],returnType:"any",description:"Get the first element of a list",category:"List",difficulty:1},last:{name:"last",fn:"last",args:[{name:"list",types:["any-multi"]}],returnType:"any",description:"Get the last element of a list",category:"List",difficulty:1},concat:{name:"concat",fn:"concat",args:[{name:"list 1",types:["any-multi"]},{name:"list 2",types:["any-multi"]}],returnType:"any-multi",description:"Concatenate two lists",category:"List",difficulty:1},sort:{name:"sort",fn:"sort",args:[{name:"list",types:["any-multi"]}],returnType:"any-multi",description:"Sort a list",category:"List",difficulty:1},reverse:{name:"reverse",fn:"reverse",args:[{name:"list",types:["any-multi"]}],returnType:"any-multi",description:"Reverse a list",category:"List",difficulty:1},join:{name:"join",fn:"join",args:[{name:"list",types:["text-multi"]},{name:"separator",types:["text"]}],returnType:"text",description:"Turn a list into text separator",category:"List",difficulty:1},includes:{name:"includes",fn:"includes",args:[{name:"list",types:["any-multi"]},{name:"value",types:["any"]}],returnType:"boolean",description:"Check if a list includes a value",category:"List",difficulty:1},split:{name:"split",fn:"split",args:[{name:"string",types:["text"]},{name:"separator",types:["text"]}],returnType:"text-multi",description:"Split text into a list using a separator",category:"String",difficulty:1},formatDate:{name:"formatDate",fn:"formatDate",args:[{name:"date",types:["date"]},{name:"format",types:["text"]}],returnType:"text",description:"Format a date into text",category:"Date",difficulty:2},parseDate:{name:"parseDate",fn:"parseDate",args:[{name:"date",types:["text"]}],returnType:"date",description:"Transform date from text",category:"Date",difficulty:1},find:{name:"find",fn:"find",args:[{name:"list",types:["any-multi"]},{name:"condition",types:["boolean"]}],returnType:"any",description:"Find an element in a list",category:"List",difficulty:2},findIndex:{name:"findIndex",fn:"findIndex",args:[{name:"list",types:["any-multi"]},{name:"condition",types:["boolean"]}],returnType:"number",description:"Find the index of an element in a list",category:"List",difficulty:2},filter:{name:"filter",fn:"filter",args:[{name:"list",types:["any-multi"]},{name:"condition",types:["boolean"]}],returnType:"any-multi",description:"Filter a list based on a condition",category:"List",difficulty:2},map:{name:"map",fn:"map",args:[{name:"list",types:["any-multi"]},{name:"formula",types:["any"]}],returnType:"any-multi",description:"Change all the values in a list based on a formula",category:"List",difficulty:2},some:{name:"some",fn:"some",args:[{name:"list",types:["any-multi"]},{name:"condition",types:["boolean"]}],returnType:"boolean",description:"Check if some elements in a list are true",category:"List",difficulty:2},every:{name:"every",fn:"every",args:[{name:"list",types:["any-multi"]},{name:"condition",types:["boolean"]}],returnType:"boolean",description:"Check if every element in a list is true",category:"List",difficulty:2},flat:{name:"flat",fn:"flat",args:[{name:"list",types:["any-multi"]}],returnType:"any-multi",description:"Flatten a list of lists into a single list",category:"List",difficulty:2},path:{name:"path",fn:"path",args:[{name:"path",types:["text"]}],returnType:"link",description:"Get the path object of a path",category:"Path",difficulty:2},let:{name:"let",fn:"let",args:[{name:"variable",types:["text"]},{name:"value",types:["any"]},{name:"formula",types:["any"]}],returnType:"any",description:"Define a variable to use in a formula",category:"Variable",difficulty:3},lets:{name:"lets",fn:"lets",args:[{name:"variable",types:["text"]},{name:"value",types:["any"]},{name:"...",types:[]},{name:"formula",types:["any"]}],returnType:"any",description:"Define multiple variables to use in a formula",category:"Variable",difficulty:3}},oye=(e,t,r)=>{let n=e[0];if(!n.isSymbolNode||e.length!==3)return"";let i=n.name,a=e[1];return t.evaluate(`${i} = ${a.toString()}`,r),e[2].compile().evaluate(r)};oye.rawArgs=!0;var sye=(e,t,r)=>{if(e.length%2!==1)return"";for(let i=0;i{if(e.length!==1)return"";let n=e.map(function(o){return o.compile().evaluate(r)}),i=n[0];return typeof n[0]!="string"&&n[0].path&&(i=n[0].path),r.get("$paths").get(i)};lye.rawArgs=!0;var uye=(e,t,r)=>{if(e.length!==1)return"";let n=e.map(function(l){return l.compile().evaluate(r)}),i=n[0];typeof n[0]!="string"&&n[0].path&&(i=n[0].path);let a=r.get("$items").get(i),o=r.get("$paths");return[...a??[]].map(l=>o.get(l))};uye.rawArgs=!0;var cye=(e,t,r)=>{if(e.length!==1)return"";let n=e.map(function(l){return l.compile().evaluate(r)}),i=n[0];typeof n[0]!="string"&&n[0].path&&(i=n[0].path);let a=r.get("$spaces").get(i),o=r.get("$paths");return[...a??[]].map(l=>o.get(l))};cye.rawArgs=!0;var fye=(e,t,r)=>r?.get("$current");fye.rawArgs=!0;var dye=(e,t,r)=>r?.get("$index");dye.rawArgs=!0;var pye=(e,t,r)=>{if(e.length!==2)return"";let n=e[0].compile().evaluate?e[0].compile().evaluate(r):e[0];return Array.isArray(n)?n.find((i,a)=>{r.set("$current",i),r.set("$index",a),t.evaluate("current = _current(); index = _index()",r);let o=e[1].compile().evaluate?e[1].compile().evaluate(r):e[1];return i===o})??"":""};pye.rawArgs=!0;var mye=(e,t,r)=>{if(e.length!==2)return"";let n=e[0].compile().evaluate?e[0].compile().evaluate(r):e[0];return Array.isArray(n)?n.findIndex((i,a)=>{r.set("$current",i),r.set("$index",a),t.evaluate("current = _current(); index = _index()",r);let o=e[1].compile().evaluate?e[1].compile().evaluate(r):e[1];return i===o}):""};mye.rawArgs=!0;var hye=(e,t,r)=>{if(e.length!==2)return"";let n=e[0].compile().evaluate?e[0].compile().evaluate(r):e[0];return Array.isArray(n)?n.filter((i,a)=>(r.set("$current",i),r.set("$index",a),t.evaluate("current = _current(); index = _index()",r),e[1].compile().evaluate(r))):""};hye.rawArgs=!0;var Aye=(e,t,r)=>{if(e.length!==2)return"";let n=e[0].compile().evaluate?e[0].compile().evaluate(r):e[0];return Array.isArray(n)?n.map((i,a)=>(r.set("$current",i),r.set("$index",a),t.evaluate("current = _current(); index = _index()",r),e[1].compile().evaluate(r))):[]};Aye.rawArgs=!0;var gye=(e,t,r)=>{if(e.length!==2)return"";let n=e[0].compile().evaluate?e[0].compile().evaluate(r):e[0];return Array.isArray(n)?n.some((i,a)=>(r.set("$current",i),r.set("$index",a),t.evaluate("current = _current(); index = _index()",r),e[1].compile().evaluate(r))):""};gye.rawArgs=!0;var vye=(e,t,r)=>{if(e.length!==2)return"";let n=e[0].compile().evaluate?e[0].compile().evaluate(r):e[0];return Array.isArray(n)?n.every((i,a)=>(r.set("$current",i),r.set("$index",a),t.evaluate("current = _current(); index = _index()",r),e[1].compile().evaluate(r))):""};vye.rawArgs=!0;var yye=(e,t,r)=>{if(e.length!==1)return"";let n=e[0].compile().evaluate?e[0].compile().evaluate(r):e[0];return Array.isArray(n)?n.flat():""};yye.rawArgs=!0;var bye=(e,t,r)=>{if(e.length!==1)return"";let n=e.map(function(o){return o.compile().evaluate(r)}),i=r.get("$properties")?.[n[0]]?.type,a=la(i,r.get(n[0]));return(i=="file"||i=="link"||i=="context")&&(i.includes("multi")?a=sr(a).map(o=>r.get("$paths").get(o)??o):a=r.get("$paths").get(a)??a),i=="date"&&(a=Yi(a)),a??""};bye.rawArgs=!0;var xye=(e,t,r)=>{if((e.length-1)%2!==0)return"";for(let n=0;n{if(e.length<1||e.length>2)return"";let n=e[0].compile().evaluate(r);n instanceof Date||(n=new Date(n));let i=e[1]?.compile().evaluate(r);return i?.length>0?Za(n,i):Za(n,r.get("$settings")?.dateFormat??"yyyy-MM-dd")};wye.rawArgs=!0;var Hu=e=>typeof e=="string"||e instanceof String?e:e instanceof Date?Za(e,"yyyy-MM-dd"):typeof e=="number"?e.toFixed(0):e?.path?e.path:"",dC={prop:bye,_current:fye,_index:dye,slice:(e,t,r)=>(e=Hu(e),e.slice(t,r)),if:(e,t,r)=>e===!0?t:r,ifs:xye,empty:e=>e.length!==1?"":Array.isArray(e[0])?e[0].length===0:e[0]===""?"true":"false",length:e=>e.length,values:e=>e.flat().length,uniques:e=>kr(e.flat()).length,substring:(e,t,r)=>(e=Hu(e),r?e.substring(t,r):e.substring(t)),startsWith:(e,t)=>(e=Hu(e),t=Hu(t),e.startsWith(t)),contains:(e,t)=>(e=Hu(e),t=Hu(t),e.includes(t)),test:(e,t)=>(e=Hu(e),new RegExp(t).test(e)),match:(e,t)=>(e=Hu(e),e.match(new RegExp(t))),replace:(e,t,r)=>(e=Hu(e),e.replace(new RegExp(t),r)),replaceAll:(e,t,r)=>(e=Hu(e),t=Hu(t),r=Hu(r),e.replace(new RegExp(t,"g"),r)),lower:e=>(e=Hu(e),e.toLowerCase()),upper:e=>(e=Hu(e),e.toUpperCase()),repeat:(e,t)=>e.repeat(t),format:Hu,toNumber:e=>e instanceof Date?e.getTime():typeof e=="string"?parseFloat(e):e,now:()=>new Date,minute:e=>e.getMinutes(),hour:e=>e.getHours(),day:e=>e.getDay(),date:e=>e.getDate(),week:e=>Za(e,"w"),month:e=>e.getMonth()+1,year:e=>e.getFullYear(),pad:(e,t,r)=>e.padStart(t,r),range:e=>Math.max(...e)-Math.min(...e),latest:e=>new Date(Math.max(...e.map(t=>t.getTime()))),earliest:e=>new Date(Math.min(...e.map(t=>t.getTime()))),dateRange:(e,t)=>{let r=Math.abs(Math.max(...e.map(n=>n.getTime()))-Math.min(...e.map(n=>n.getTime())));return t.startsWith("day")?r/(1e3*60*60*24):t.startsWith("month")?r/(1e3*60*60*24*30):t.startsWith("year")?r/(1e3*60*60*24*365):t.startsWith("hour")?r/(1e3*60*60):t.startsWith("minute")?r/(1e3*60):t.startsWith("second")?r/1e3:t.startsWith("week")?r/(1e3*60*60*24*7):t.startsWith("quarter")?r/(1e3*60*60*24*30*3):r/(1e3*60*60*24)},dateAdd:(e,t,r)=>(r.startsWith("day")&&e.setDate(e.getDate()+t),r.startsWith("month")&&e.setMonth(e.getMonth()+t),r.startsWith("year")&&e.setFullYear(e.getFullYear()+t),r.startsWith("quarter")&&e.setMonth(e.getMonth()+t*3),r.startsWith("week")&&e.setDate(e.getDate()+t*7),r.startsWith("hour")&&e.setHours(e.getHours()+t),r.startsWith("minute")&&e.setMinutes(e.getMinutes()+t),r.startsWith("second")&&e.setSeconds(e.getSeconds()+t),e),dateSubtract:(e,t,r)=>(r.startsWith("day")&&e.setDate(e.getDate()-t),r.startsWith("month")&&e.setMonth(e.getMonth()-t),r.startsWith("year")&&e.setFullYear(e.getFullYear()-t),r.startsWith("quarter")&&e.setMonth(e.getMonth()-t*3),r.startsWith("week")&&e.setDate(e.getDate()-t*7),r.startsWith("hour")&&e.setHours(e.getHours()-t),r.startsWith("minute")&&e.setMinutes(e.getMinutes()-t),r.startsWith("second")&&e.setSeconds(e.getSeconds()-t),e),dateBetween:(e,t,r)=>{let o=Math.abs(t.getTime()-e.getTime());switch(r){case"days":return Math.round(o/864e5);case"months":return Math.round(o/2592e6);case"years":return Math.round(o/31536e6);case"hours":return Math.round(o/(60*60*1e3));case"minutes":return Math.round(o/(60*1e3));case"seconds":return Math.round(o/1e3);case"weeks":return Math.round(o/(864e5*7));case"quarters":return Math.round(o/(2592e6*3));default:return Math.round(o/864e5)}},style:(e,t)=>e,timeStamp:e=>e.getTime(),at:(e,t)=>e[t],first:e=>e[0],last:e=>e[e.length-1],concat:(e,t)=>e.concat(t),sort:e=>e.sort((t,r)=>r-t),reverse:e=>e.reverse(),join:(e,t)=>e.join(t),includes:(e,t)=>e.includes(t),split:(e,t)=>e.split(t),formatDate:wye,parseDate:e=>Yi(e),find:pye,findIndex:mye,filter:hye,map:Aye,some:gye,every:vye,flat:yye,path:lye,let:oye,lets:sye,spaceItems:uye,spaces:cye};var Pd=(e,t,r,n,i,a,o,s)=>{if(!n)return"";let l=new Map;Object.keys(a).forEach(c=>l.set(c,a[c])),l.set("$properties",i),l.set("$paths",t),l.set("$items",r.invMap),l.set("$spaces",r.map),o&&l.set("$current",o);let u;try{if(e.evaluate("current = _current()",l),u=e.evaluate(n,l),u=Ri("",u),typeof u!="string"&&s)throw u}catch(c){if(u="",s)throw c}return u};var QB=(e,t)=>t.startsWith(e),PV=(e,t)=>(r,n)=>{let i=t?r:n,a=t?n:r;return e(i)e(a)?1:0},Sye=(e,t)=>(r,n)=>{let i=t?r:n,a=t?n:r;return i[e]a[e]?1:0},Eye=(e,t)=>(r,n)=>{let i=t?r:n,a=t?n:r;return i[e]?.toLowerCase().localeCompare(a[e]?.toLowerCase())},kye=(e,t)=>(r,n)=>{let i=t?r:n,a=t?n:r;return+i[e]-+a[e]};var Gr=e=>e.primaryInteractionType()==0,jc=e=>e.getScreenType()==0;var Jm=e=>{try{return e?.replace(/'/g,"''")}catch(t){return console.log(t,e),""}},ZA=e=>e?.charAt(0)=="_"?ZA(e.substring(1)):e?.replace(/"/g,""),eh=e=>e?.replace(/[^a-z0-9+]+/gi,""),eVe=/^[+\$#^]+/,Cye=/[\/\?<>\\:\*\|":]/g,Dye=/[\x00-\x1f\x80-\x9f]/g,Oye=/^\.+$/,Mye=/^(con|prn|aux|nul|com[0-9]|lpt[0-9])(\..*)?$/i,jye=e=>{let t="";return e.replace(eVe,t).replace(Cye,t).replace(Dye,t).replace(Oye,t).replace(Mye,t)},ov=e=>{let t="";return e.replace(Cye,t).replace(Dye,t).replace(Oye,t).replace(Mye,t)};var YB=(e,t,r)=>e.spacesIndex.has(t)?e.spaceManager.deleteTag(Af(e,e.spacesIndex.get(t).space),r):e.spaceManager.deleteTag(t,r),th=(e,t,r)=>e.spacesIndex.has(t)?e.spaceManager.addTag(Af(e,e.spacesIndex.get(t).space),r):e.spaceManager.addTag(t,r),IV=(e,t)=>e.spaceManager.createSpace(zx(t),e.settings.spacesFolder,null);var ZB=async(e,t)=>{let r=e.spaceManager.uriByString(t);if(r.refType=="context"){let n=e.contextsIndex.get(r.basePath)?.schemas.find(i=>i.id==r.ref);if(n)return{id:n.id,name:n.name,type:"context",path:r.basePath}}if(r.refType=="frame")return e.spaceManager.readFrame(r.basePath,r.ref).then(n=>{let i=n?.schema;if(i){let a=Ao(i);return{id:i.id,name:a.name,sticker:a.def?.icon,type:"frame",frameType:a.type,path:r.basePath}}return null});if(r.refType=="action"){let n=e.actionsIndex.get(r.path)?.find(i=>i.schema.id==r.ref)?.schema;if(n)return{id:n.id,name:n.name,sticker:n.def?.icon,type:"action",path:r.basePath}}return null},tVe=e=>({field:Bs(e?.field??"rank"),asc:XE(e?.asc),group:XE(e?.group),recursive:XE(e?.recursive)}),rVe=e=>e=="fileprop"?"file":e=="filemeta"?"path":Bs(e),nVe=e=>({type:rVe(e.type),fType:Bs(e.fType),field:Bs(e.field),fn:Bs(e.fn),value:Bs(e.value)}),iVe=e=>({type:bJ(e.type,["any","all"],"any"),trueFalse:!!e.truefalse,filters:dl(e.filters).map(t=>nVe(t))}),pC=(e,t)=>({sort:tVe(e[Ik]),recursive:Bs(e[sj]),contexts:dl(e[Nk]),links:dl(e[Pk]),filters:dl(e[_k]).map(r=>iVe(r)),template:Bs(e[Tk]),templateName:Bs(e[Fk]),defaultSticker:Bs(e.defaultSticker),readMode:XE(e.readMode)}),Nye=(e,t,r,n,i,a,o)=>({id:i?i+"/"+e.path:e.path,parentId:i,depth:n,index:0,space:a,path:e.path,item:e,rank:e?.rank,collapsed:t,sortable:r,childrenCount:o,type:"space"}),XB=(e,t,r,n,i,a,o,s,l,u)=>({item:t,space:r,id:u+"/"+t.path,parentId:u,depth:i,path:n,index:a,collapsed:o,sortable:s,childrenCount:l,rank:t.rank,type:"file"}),VS=(e,t,r)=>(t??(Gr(e.ui)?40:29))+(r?10:0),BV=e=>(t,r)=>{if(e.field=="rank")return t.rank-r.rank;let n=[];if(e.group&&n.push(Sye("type",!1)),e.field=="number")n.push(kye("name",e.asc));else if(e.field=="name")n.push(Eye(e.field,e.asc));else if(e.field.startsWith("props")){let i=e.field.split(".")[1],a=o=>o?.metadata?.property?.[i];n.push(PV(a,e.asc))}else{let i=a=>a?.metadata?.file?.[e.field];n.push(PV(i,e.asc))}return n.reduce((i,a)=>i==0?a(t,r):i,0)},GS=async(e,t,r,n)=>{let i=e.spacesIndex.get(n);if(!i)return;let a=r;e.addToContextStateQueue(()=>Hoe(e.spaceManager,[t],a,i.space).then(o=>{let s=[...e.spacesMap.getInverse(i.path)].map(l=>e.reloadPath(l));return Promise.all(s)}).then(o=>e.dispatchEvent("spaceStateUpdated",{path:i.path})))},RV=async(e,t,r,n,i)=>{if(!t)return;let a=e.pathsIndex.get(t.path);if(!a)return;let o=r=="/"?a.name:r+"/"+a.name;if(await e.spaceManager.pathExists(o)){e.ui.notify(H.notice.fileExists);return}i?await e.spaceManager.copyPath(t.path,r):await e.spaceManager.renamePath(t.path,jm(t.path,r)),GS(e,o,n,r)},Tye=(e,t,r)=>{mC(e,t,"template",r)},Fye=(e,t,r)=>{mC(e,t,"templateName",r)};var kf=async(e,t,r)=>{let n=e.spacesIndex.get(t),i;if(n){if(!e.pathsIndex.has(t))return await e.reloadSpace(n.space);if(r)i=await du(e,n.space,r);else return}else{let a=e.spaceManager.spaceInfoForPath(t);if(a.readOnly)return await e.reloadSpace(a);await e.spaceManager.createSpace(a.name,e.spaceManager.parentPathForPath(a.path),r),r?(await du(e,a,r),i=await e.reloadSpace(a,r)):i=await e.reloadSpace(a)}return e.onSpaceDefinitionChanged(i,null),i},mC=async(e,t,r,n)=>{e.spaceManager.saveSpace(t,a=>({...a,[r]:n}));let i=e.spacesIndex.get(t);await e.updateSpaceMetadata(t,{...i.metadata,[r]:n})},aVe=async(e,t,r)=>{e.spaceManager.saveSpace(t,n=>n,r)},du=async(e,t,r)=>(await e.spaceManager.saveSpace(t.path,n=>({...n,...r})),e.updateSpaceMetadata(t.path,r)),QS=async(e,t,r,n)=>t.type=="tag"?th(e,r,t.name):rh(e,t,r,n);var YS=async(e,t)=>{let r=null;return e.settings.newFileLocation=="folder"?r=e.spacesIndex.get(e.settings.newFileFolderPath):e.settings.newFileLocation=="current"&&t&&t.type=="space"?r=e.spacesIndex.get(t.path):t&&(r=e.spacesIndex.get(t.parent)),r||(r=e.spacesIndex.get("/")),r},rh=async(e,t,r,n)=>{if(r==t.path)return;let i=dl(t.metadata.links)??[];i.find(o=>o==r)||i.push(r),await du(e,t.space,{...t.metadata,links:i}),await e.reloadPath(r,!0).then(o=>e.dispatchEvent("pathStateUpdated",{path:r})),GS(e,r,n,t.path)},_ye=async(e,t)=>{let r=e.spacesIndex.get(t);!r||(r.type=="tag"?e.onTagDeleted(r.name):r.type=="folder"&&await F1(e,r.path))},Id=(e,t,r)=>{let n=e.spacesIndex.get(t);n&&du(e,n.space,{...n.metadata,sort:r})},Af=(e,t)=>e.settings.enableFolderNote?t.notePath:t.defPath,sv=async(e,t,r)=>{let n=e.spacesIndex.get(r);!n||(await e.spaceManager.saveTemplate(t,n.path),e.ui.notify(H.notice.templateSaved+n.name))},lv=async(e,t,r)=>{let n=e.spacesIndex.get(t);!n||(n.type=="tag"?r.forEach(i=>YB(e,i,n.name)):(n.type=="folder"||n.type=="vault")&&await mC(e,n.path,"links",n.metadata.links.filter(i=>!r.some(a=>a==i))))},$V=async(e,t,r,n)=>{let i;try{if(t.metadata.templateName?.length>0){let o=Pd(e.formulaContext,e.pathsIndex,e.spacesMap,t.metadata.templateName,{},{},e.pathsIndex.get(t.path));o?.length>0&&(i=o)}}catch{}if(!await e.spaceManager.pathExists(`${t.path}/${e.settings.spaceSubFolder}/templates/${r}`)){za(e,t,"md",null,!1,null,n);return}let a=await e.spaceManager.copyPath(`${t.path}/${e.settings.spaceSubFolder}/templates/${r}`,t.path,i);a&&e.ui.openPath(a,n)},za=async(e,t,r,n,i,a,o)=>{let s;return t.type=="tag"?(s=await e.spaceManager.createItemAtPath("/",r,n,a),await e.spaceManager.addTag(s,t.name)):s=await e.spaceManager.createItemAtPath(t.path,r,n,a),i||e.ui.openPath(s,o),s};var Pye=async(e,t,r)=>{let n=(i,a,o)=>{let s={...a,name:ZA(a.name)},l=i;if(s.name=="")return e.ui.notify(H.notice.noPropertyName),!1;if(!o&&l.cols.find(d=>d.name.toLowerCase()==s.name.toLowerCase())||o&&o.name!=s.name&&l.cols.find(d=>d.name.toLowerCase()==s.name.toLowerCase()))return e.ui.notify(H.notice.duplicatePropertyName),!1;let u=o?l.cols.findIndex(d=>d.name==o.name):-1,c=u==-1?[...l.cols,s]:l.cols.map((d,p)=>p==u?s:d),f={...l,cols:c??[]};return e.spaceManager.saveFrame(t,f),!0};if(e.spacesIndex.has(t)){let i=await e.spaceManager.readFrame(t,"main");n(i,{...r,schemaId:"main"})}else e.spaceManager.saveProperties(t,{[r.name]:Bx(r.type)})},pi=(e,t,r)=>e.spacesIndex.has(t)?aVe(e,t,r):e.spaceManager.saveProperties(t,r),qV=(e,t,r,n)=>{if(e.spacesIndex.has(t)){e.spaceManager.renameProperty(Af(e,e.spacesIndex.get(t).space),r,n);return}e.spaceManager.renameProperty(t,r,n)},Iye=(e,t,r)=>{if(e.spacesIndex.has(t)){e.spaceManager.deleteProperty(Af(e,e.spacesIndex.get(t).space),r);return}e.spaceManager.deleteProperty(t,r)};var hC=e=>{let t=new Map;e.filter(o=>o.type=="fileprop"||o.name.startsWith("tags")).forEach(o=>{let{value:s}=pr(o.value,o.type),l=[];try{let c=_d(s).filter(f=>f.type=="FunctionNode").filter(f=>f.fn.name=="prop"&&f.args[0].type=="ConstantNode").map(f=>f.args[0]?.value);l.push(...c)}catch{}let u=o.name;t.has(u)||t.set(u,new Set);for(let c of l){let f=c;f!==u&&t.get(u).add(f)}});let r=new Set,n=[],i=new Set,a=o=>{if(i.has(o))throw new Error("Circular dependency detected");if(!r.has(o)){i.add(o);let s=t.get(o)||new Set;for(let l of s)a(l);r.add(o),i.delete(o),n.push(o)}};for(let o of e)r.has(o.name)||a(o.name);return n},nh=(e,t,r,n,i,a,o)=>{if(!n)return{};let s=o??hC(i),l=t.get(n[mt])?.metadata?.property??{},u=Object.keys(l).filter(d=>i.some(p=>p.name==d)&&d!=mt).reduce((d,p)=>({...d,[p]:Ri(p,l[p])}),{}),c=s.map(d=>i.find(p=>p.name==d)).filter(d=>d&&(d.type=="fileprop"||d.name=="tags")),f=i.reduce((d,p)=>({...d,[p.name]:p}),{});return{...n,...u,...c.reduce((d,p)=>{let{value:h}=pr(p.value,p.type);return{...d,[p.name]:Pd(e,t,r,h,f,{...n,...d},a)}},{})}};var KB=async(e,t,r)=>{let n=e;if(t.prevState[n.id]&&n.node.type!="content"){let a=!1;if(n.node.type=="slides"||n.node.type=="slide"||n.node.type=="delta")a=!1;else{let o=(n.execPropsOptions.children??[]).some(c=>Object.keys(t.newState).includes(c)),s=Object.keys(t.newState[n.id]?.props??{}).every(c=>t.newState[n.id]?.props[c]==t.prevState[n.id]?.props[c]),l=Object.keys(t.newState[n.id]?.styles??{}).every(c=>t.newState[n.id]?.styles[c]==t.prevState[n.id]?.styles[c]),u=n.execPropsOptions.deps.every(c=>c[0]=="$api"||t.newState[c[0]]?.[c[1]]?.[c[2]]===void 0?!0:t.newState[c[0]]?.[c[1]]?.[c[2]]===t.prevState[c[0]]?.[c[1]]?.[c[2]]);s&&l&&u&&!o&&(a=!0)}if(a)return{id:r.runID,root:r.root,exec:n,state:t.state,slides:t.slides,newState:t.newState,prevState:t.prevState,contexts:r.contexts}}let i=await oVe(n,t,r.contexts,r.api);if(n.node.type=="list"){let a=0;n.children=dl(i.state[n.id].props.value).flatMap((o,s)=>n.execPropsOptions.template.map(l=>{let[u,c]=Ute({...l,node:{...l.node,props:{...l.node.props,_index:`${s}`,value:`${n.id}.props.value[${s}]`}}},a);return a=c,Dk(u)}))}typeof i.state[n.id]?.actions?.onRun=="function"&&i.state[n.id].actions?.onRun(null,null,i,a=>{r.saveState(a,{state:i.state,slides:i.slides,root:r.root,exec:r.exec,id:r.runID,contexts:r.contexts})},r.api),n.children=[...n.children.filter(a=>a.node.type=="slides"),...n.children.filter(a=>a.node.type!="slides")];for(let a=0;a[{state:l.state,newState:l.newState,slides:l.slides,prevState:l.prevState},l.exec]);if(i=o,n.children[a]=s,s.node.type=="slides"){let l=o.state[s.id].props.value,u=o.state[s.node.parentId]?.props[l],c;r.selectedSlide&&(c=s.children.find(f=>f.id==r.selectedSlide)),u!==null&&!c&&(c=s.children.find(f=>o.state[f.id].props.value==u)),c&&c.children.forEach(f=>{i.newState[f.node.ref]||(i.newState[f.node.ref]={props:{},styles:{},actions:{}}),f.node.ref==n.id?(i.state[f.node.ref].props={...i.state[f.node.ref].props,...i.state[f.node.id].props},i.state[f.node.ref].styles={...i.state[f.node.ref].styles,...i.state[f.node.id].styles},i.state[f.node.ref].actions={...i.state[f.node.ref].actions,...i.state[f.node.id].actions}):(i.newState[f.node.ref].props={...i.newState[f.node.ref].props,...i.state[f.node.id].props},i.newState[f.node.ref].styles={...i.newState[f.node.ref].styles,...i.state[f.node.id].styles},i.newState[f.node.ref].actions={...i.newState[f.node.ref].actions,...i.state[f.node.id].actions})})}}return{id:r.runID,root:r.root,exec:n,state:i.state,slides:i.slides,newState:i.newState,prevState:i.prevState,contexts:r.contexts}},oVe=async(e,t,r,n)=>{let i=await sVe(e,t,r,n),a=Bye(e.node,"styles",e.execStyles,i);return Bye(e.node,"actions",e.execActions,a)},ZS=(e,t)=>((typeof e=="string"||e instanceof String?e.includes(` +`):!1)?new Function(`with(this) { ${e} }`):new Function(`with(this) { return ${e}; }`)).call(t),sVe=async(e,t,r,n)=>{let{id:i}=e.node,a=e.execProps??{},o=t.state;o[i]={props:t.state[i]?.props??{},actions:t.state[i]?.actions??{},styles:t.state[i]?.styles??{}},o.$contexts=r,o.$api=n;for(let{name:s,isConst:l}of e.execPropsOptions.props)try{let u;s in(t.newState?.[i]?.props||{})&&l?u=t.newState[i].props[s]:u=a[s]?.call(o),u!==null?(o[i].props[s]=u,t.state[i].props[s]=u,t.newState&&(t.newState[i]=t.newState[i]??{props:{},styles:{},actions:{}},t.newState[i].props[s]=u)):(delete o[i].props[s],delete t.state[i].props[s],t.newState?.[i]&&delete t.newState[i].props[s])}catch(u){console.log(s,u)}return t};function Bye(e,t,r,n){let{id:i}=e;for(let a of Object.keys(r)){let o;try{a in(n.newState?.[i]?.[t]||{})?o=n.newState[i][t][a]:o=r[a]?.call(n.state),o!==null?n.state[e.id][t][a]=o:delete n.state[e.id][t][a]}catch(s){console.log(s,a)}}return n}var LV=(e,t)=>e.skipFolderNames.some(r=>t.endsWith(r))||t.endsWith("/"+e.spaceSubFolder)||t==e.spaceSubFolder||t.split("/").pop()==e.spaceSubFolder||t.startsWith(e.spacesFolder+"/#")||t.startsWith(e.spacesFolder+"/$")||e.skipFolders.some(r=>r==t);var AC="templates",gC="kits",vC="actions",yC="waypoints.json",bC=class{constructor(t,r){this.fileSystem=t;this.dataPath=r;this.schemes=["spaces","vault"];this.onFocusesUpdated=()=>{this.spaceManager.onFocusesUpdated()};this.onSpaceUpdated=t=>{t.type=="views.mdb"?this.spaceManager.onSpaceUpdated(t.path,"frame"):t.type=="context.mdb"?this.spaceManager.onSpaceUpdated(t.path,"context"):t.type=="commands.mdb"&&this.spaceManager.onSpaceUpdated(t.path,"action")};this.onCreate=async t=>{t.file.isFolder?this.spaceManager.onSpaceCreated(t.file.path):this.spaceManager.onPathCreated(t.file.path)};this.onDelete=t=>{!t.file||(!t.file.isFolder&&t.file.extension!="mdb"?this.spaceManager.onPathDeleted(t.file.path):t.file.isFolder&&this.spaceManager.onSpaceDeleted(t.file.path))};this.onRename=t=>{!t.file||(!t.file.isFolder&&t.file.extension!="mdb"?this.spaceManager.onPathChanged(t.file.path,t.oldPath):t.file.isFolder&&this.spaceManager.onSpaceRenamed(t.file.path,t.oldPath))};this.authorities=["vault"];t.eventDispatch.addListener("onCreate",this.onCreate,0,this),t.eventDispatch.addListener("onRename",this.onRename,0,this),t.eventDispatch.addListener("onDelete",this.onDelete,0,this),t.eventDispatch.addListener("onFocusesUpdated",this.onFocusesUpdated,0,this),t.eventDispatch.addListener("onSpaceUpdated",this.onSpaceUpdated,0,this),t.eventDispatch.addListener("onCacheUpdated",this.onMetadataChange,0,this)}initiateAdapter(t){this.spaceManager=t}async readTemplates(t){return(await this.childrenForPath(`${t}/${this.spaceManager.superstate.settings.spaceSubFolder}/templates`)).filter(r=>!r.startsWith(".")).map(r=>r.split("/").pop())}async saveTemplate(t,r){return this.copyPath(t,`${r}/${this.spaceManager.superstate.settings.spaceSubFolder}/templates`)}deleteTemplate(t,r){return this.deletePath(`${r}/${this.spaceManager.superstate.settings.spaceSubFolder}/templates/${t}`)}async readFocuses(){return await this.fileSystem.fileExists(this.dataPath)||await this.fileSystem.createFolder(this.dataPath),await this.fileSystem.fileExists(`${this.dataPath}/${yC}`)?this.fileSystem.readTextFromFile(`${this.dataPath}/${yC}`).then(t=>dl(or(t))):[]}async saveFocuses(t){return await this.fileSystem.fileExists(this.dataPath)||await this.fileSystem.createFolder(this.dataPath),this.fileSystem.writeTextToFile(`${this.dataPath}/${yC}`,JSON.stringify(t))}async readTemplate(t){let r=`${this.dataPath}/${AC}/${t}`;if(await this.fileSystem.fileExists(r))return this.fileSystem.readFileFragments({path:`${r}/${this.spaceManager.superstate.settings.spaceSubFolder}/views.mdb`,name:"views",filename:"views.mdb",parent:r,isFolder:!1,extension:"mdb"},"mdbTables")}async readAllKits(){let t=(await this.childrenForPath(`${this.dataPath}/${gC}`)).map(n=>n.split("/").pop());return Promise.all(t.map(async n=>{let i=await this.readKitFrames(n);return{id:n,name:n,colors:{},frames:Object.values(i??{})}}))}async readAllTemplates(){let t=(await this.childrenForPath(`${this.dataPath}/${AC}`)).map(n=>n.split("/").pop()),r={};for(let n of t){let i=await this.readTemplate(n);i&&(r[n]=i)}return r}async readKitFrames(t){return this.fileSystem.readFileFragments({path:`${this.dataPath}/${gC}/${t}/kit.mdb`,name:"kit",filename:"kit.mdb",parent:`${this.dataPath}/${gC}/${t}`,isFolder:!1,extension:"mdb"},"mdbTables")}async saveFrameKit(t,r){let n={path:`${this.dataPath}/${gC}/${r}/kit.mdb`,name:"kit",filename:"kit.mdb",parent:`${this.dataPath}/${gC}/${r}`,isFolder:!1,extension:"mdb"};await this.fileSystem.saveFileFragment(n,"schema",t.schema.id,()=>t.schema),this.fileSystem.saveFileFragment(n,"mdbFrame",t.schema.id,()=>t)}async saveSpaceTemplate(t,r){let n=r;if(await this.fileSystem.fileExists(`${this.dataPath}/${AC}`)){let i=await this.childrenForPath(`${this.dataPath}/${AC}/${r}`);n=Mi(n,i)}await this.fileSystem.newFile(`${this.dataPath}/${AC}/${n}/${this.spaceManager.superstate.settings.spaceSubFolder}`,"view","mdb",t)}async onMetadataChange(t){if(!t.path)return;if(t.path.endsWith(".json")){let n=t.path.split("/").slice(0,-2).join("/");this.spaceManager.onPathPropertyChanged(n);return}let r=this.spaceManager.superstate.pathsIndex.get(t.path);if(r?.metadata.spacePath?.length>0){this.spaceManager.onPathPropertyChanged(r?.metadata.spacePath);return}this.spaceManager.onPathPropertyChanged(t.path)}uriByPath(t){return this.spaceManager.uriByString(t)}allPaths(t){return[...this.fileSystem.allFiles().filter(r=>t?t.some(n=>n=="folder"?r.isFolder:r.extension==n):!0).map(r=>r.path).filter(r=>!LV(this.spaceManager.superstate.settings,r))]}async pathExists(t){let r=this.uriByPath(t);return r.scheme=="spaces"&&(r.authority.charAt(0)=="$"&&Object.keys(Ep).find(i=>i==r.authority.slice(1))||r.authority.charAt(0)=="#"||t=="/")?!0:this.fileSystem.fileExists(t)}async createItemAtPath(t,r,n,i){let a=await this.getPathInfo(t);if(!a)await this.fileSystem.createFolder(t);else if(!a?.isFolder){let o=await this.fileSystem.getFile(t);return o?this.fileSystem.newFileFragment(o,r,n,i)?.then(s=>o.path):null}return this.fileSystem.newFile(t,n,r,i).then(o=>o?.path)}async renamePath(t,r){let n=this.uriByPath(t),i=this.uriByPath(r),a=await this.fileSystem.getFile(n.path);if(n.refStr){let o=await this.fileSystem.getFileCacheTypeByRefString(a,n.refStr);return await this.fileSystem.saveFileFragment(a,o,n.refStr,()=>i.refStr),r}return await this.fileSystem.renameFile(t,r)}async deletePath(t){let r=this.uriByPath(t);if(r.refStr){let n=await this.fileSystem.getFile(r.path),i=await this.fileSystem.getFileCacheTypeByRefString(n,r.refStr);return this.fileSystem.deleteFileFragment(n,i,r.refStr)}return this.fileSystem.deleteFile(t)}async getPathInfo(t){let r=this.uriByPath(t),n=await this.fileSystem.getFile(r.path);if(r.refStr){let i=this.fileSystem.getFileCacheTypeByRefString(n,r.refStr)}return n}keysForCacheType(t){return this.fileSystem.keysForCacheType(t)}async readPathCache(t){let r=this.uriByPath(t);if(r.scheme=="spaces"){if(r.authority.charAt(0)=="$"){let n=Object.keys(Ep).find(i=>i==r.authority.slice(1));if(n)return{file:null,metadata:null,label:{name:Ep[n].name,sticker:Ep[n].icon,color:""},readOnly:!1,type:"space",parent:"",tags:[]}}if(r.authority.charAt(0)=="#")return{file:null,metadata:null,label:{name:r.authority,sticker:"",color:""},type:"space",parent:"",tags:[],readOnly:!1}}return t=="/"?{file:{name:this.spaceManager.superstate.settings.systemName,path:"/",isFolder:!0},metadata:{},label:{name:this.spaceManager.superstate.settings.systemName,sticker:"",color:""},type:"space",subtype:"folder",parent:"",tags:[],readOnly:!1}:this.fileSystem.getFileCache(t)}async readPath(t){let r=this.uriByPath(t),n=await this.fileSystem.getFile(r.path);if(r.refStr){let i=this.fileSystem.getFileCacheTypeByRefString(n,r.refStr);this.fileSystem.getFileContent(n,i,r.refStr)}return this.fileSystem.readTextFromFile(t)}async copyPath(t,r,n){let i=this.uriByPath(t),a=await this.fileSystem.getFile(i.path);return this.fileSystem.copyFile(a.path,r,n)}async writeToPath(t,r,n){let i=this.uriByPath(t),a=await this.fileSystem.getFile(i.path);if(i.refStr){let o=this.fileSystem.getFileCacheTypeByRefString(a,i.refStr);this.fileSystem.saveFileFragment(a,o,i.refStr,()=>r)}return n?this.fileSystem.writeBinaryToFile(t,r):this.fileSystem.writeTextToFile(t,r)}async childrenForPath(t,r){return await this.fileSystem.fileExists(t)?this.fileSystem.childrenForFolder(t,r):[]}parentPathForPath(t){return this.fileSystem.parentPathForPath(t)}async readFrame(t,r){let n=await this.fileSystem.getFile(this.spaceInfoForPath(t).framePath);if(!n){let i=this.defaultFrame(t);if(Object.keys(i).some(a=>a==r))return i[r]}return this.fileSystem.readFileFragments(n,"mdbTable",r)}async readAllFrames(t){let r=await this.fileSystem.getFile(this.spaceInfoForPath(t).framePath);return r?this.fileSystem.readFileFragments(r,"mdbTables"):this.defaultFrame(t)}async readTable(t,r){let n=this.spaceInfoForPath(t),i=await this.fileSystem.getFile(n.dbPath);if(!i&&r==yp.id){let o=Kx(this.spaceManager.superstate,n),s=hC(o.cols),l=o.rows.map(u=>nh(this.spaceManager.superstate.formulaContext,this.spaceManager.superstate.pathsIndex,this.spaceManager.superstate.spacesMap,u,o.cols,this.spaceManager.superstate.pathsIndex.get(t),s));return{...o,rows:l}}let a=await this.fileSystem.readFileFragments(i,"mdbTable",r);if(a&&a.schema.id!=yp.id){let o=hC(a.cols),s=a.rows.map(l=>nh(this.spaceManager.superstate.formulaContext,this.spaceManager.superstate.pathsIndex,this.spaceManager.superstate.spacesMap,l,a.cols,this.spaceManager.superstate.pathsIndex.get(t),o));return{...a,rows:s}}else if(!a&&r==yp.id){let o=Kx(this.spaceManager.superstate,n),s=hC(o.cols),l=o.rows.map(u=>nh(this.spaceManager.superstate.formulaContext,this.spaceManager.superstate.pathsIndex,this.spaceManager.superstate.spacesMap,u,o.cols,this.spaceManager.superstate.pathsIndex.get(t),s));return{...o,rows:l}}return a}async spaceInitiated(t){return!0}async contextInitiated(t){let r=this.spaceInfoForPath(t);return await this.fileSystem.fileExists(r.dbPath)}async tablesForSpace(t){let r=this.spaceInfoForPath(t),n=await this.fileSystem.getFile(r.dbPath);if(!n)return vA.rows;let i=await this.fileSystem.readFileFragments(n,"schemas",null);return i.length==0?vA.rows:i}defaultDBTablesForContext(t){let r=Kx(this.spaceManager.superstate,t),n=xq(t);return{...GJ(t),m_fields:{uniques:n.uniques,cols:n.cols,rows:[...n.rows??[],...r.cols]},[r.schema.id]:{uniques:r.cols.filter(a=>a.unique=="true").map(a=>a.name),cols:r.cols.map(a=>a.name),rows:r.rows}}}defaultFrame(t){return t.startsWith(Zg)&&t==Zg+"overview"?nre:this.spaceManager.superstate.settings.defaultSpaceTemplate.length>0&&this.spaceManager.superstate.templateCache.has(this.spaceManager.superstate.settings.defaultSpaceTemplate)?this.spaceManager.superstate.templateCache.get(this.spaceManager.superstate.settings.defaultSpaceTemplate):this.spaceManager.superstate.settings.enableFolderNote?oj:aw}async createDefaultTable(t){let r=this.spaceInfoForPath(t),n=this.spaceInfoForPath(t).dbPath,i=n.split(".").pop(),a=n.split("/").slice(0,-1).join("/"),o=n.split("/").pop().split(".")[0];return this.fileSystem.newFile(a,o,i,this.defaultDBTablesForContext(r))}async createDefaultFrames(t){let r=this.defaultFrame(t),n={...jk(r),m_schema:WJ},i=this.spaceInfoForPath(t).framePath,a=i.split(".").pop(),o=i.split("/").slice(0,-1).join("/"),s=i.split("/").pop().split(".")[0];return this.fileSystem.newFile(o,s,a,n)}async createTable(t,r){let n=await this.fileSystem.getFile(this.spaceInfoForPath(t).dbPath);return n||(n=await this.createDefaultTable(t)),this.fileSystem.newFileFragment(n,"schema",r.id,r)}async saveTableSchema(t,r,n){let i=await this.fileSystem.getFile(this.spaceInfoForPath(t).dbPath);return i||(i=await this.createDefaultTable(t)),this.fileSystem.saveFileFragment(i,"schema",r,n)}async saveTable(t,r,n){let i=await this.fileSystem.getFile(this.spaceInfoForPath(t).dbPath);if(!i)if(n)i=await this.createDefaultTable(t);else return!1;return this.fileSystem.saveFileFragment(i,"mdbTable",r.schema.id,()=>r)}async deleteTable(t,r){let n=await this.fileSystem.getFile(this.spaceInfoForPath(t).dbPath);return this.fileSystem.deleteFileFragment(n,"schema",r)}async readAllTables(t){let r=this.spaceInfoForPath(t),n=await this.fileSystem.getFile(r.dbPath);if(!n){let i=Kx(this.spaceManager.superstate,r);return{[i.schema.id]:i}}return this.fileSystem.readFileFragments(n,"mdbTables",null)}async framesForSpace(t){let r=await this.fileSystem.getFile(this.spaceInfoForPath(t).framePath);if(!r){let n=this.defaultFrame(t);return Object.values(n).map(i=>i.schema)}return this.fileSystem.readFileFragments(r,"schemas",null)}async createFrame(t,r){let n=await this.fileSystem.getFile(this.spaceInfoForPath(t).framePath);return n||(n=await this.createDefaultFrames(t)),this.fileSystem.newFileFragment(n,"schema",r.id,r)}async deleteFrame(t,r){let n=await this.fileSystem.getFile(this.spaceInfoForPath(t).framePath);return this.fileSystem.deleteFileFragment(n,"schema",r)}async saveFrameSchema(t,r,n){let i=await this.fileSystem.getFile(this.spaceInfoForPath(t).framePath);return i||(i=await this.createDefaultFrames(t)),this.fileSystem.saveFileFragment(i,"schema",r,n)}async saveFrame(t,r){let n=await this.fileSystem.getFile(this.spaceInfoForPath(t).framePath);return n||(n=await this.createDefaultFrames(t)),this.fileSystem.saveFileFragment(n,"mdbFrame",r.schema.id,()=>r)}async createDefaultCommands(t){let r={m_fields:{uniques:sa.uniques,cols:sa.cols,rows:[]},m_schema:{uniques:[],cols:["id","name","type","def","predicate","primary"],rows:[]}},n=this.spaceInfoForPath(t).commandsPath,i=n.split(".").pop(),a=n.split("/").slice(0,-1).join("/"),o=n.split("/").pop().split(".")[0];return this.fileSystem.newFile(a,o,i,r)}async commandsForSpace(t){let r=await this.fileSystem.getFile(this.spaceInfoForPath(t).commandsPath);return r?this.fileSystem.readFileFragments(r,"mdbCommands",null):[]}async runCommand(t,r,n){let i=await this.fileSystem.getFile(this.spaceInfoForPath(t).commandsPath);if(!i)return{result:null,error:"No commands file found"};let a=await this.fileSystem.readFileFragments(i,"mdbCommand",r);if(!a)return{result:null,error:"No command found"};let o,s;try{a.schema.type=="script"&&(o=ZS(a.code,n)),a.schema.type=="formula"&&(o=Pd(this.spaceManager.superstate.formulaContext,this.spaceManager.superstate.pathsIndex,this.spaceManager.superstate.spacesMap,a.code,a.fields.reduce((l,u)=>({...l,[u.name]:u}),{}),n,this.spaceManager.superstate.pathsIndex.get(t)))}catch(l){s=l}return{result:o,error:s}}async createCommand(t,r){let n=await this.fileSystem.getFile(this.spaceInfoForPath(t).commandsPath);return n||(n=await this.createDefaultCommands(t)),this.fileSystem.newFileFragment(n,"schema",r.id,r)}async readSystemCommands(){let t=(await this.childrenForPath(`${this.dataPath}/${vC}`,"folder")).map(n=>n.split("/").pop());return Promise.all(t.map(async n=>{let i=await this.readLibraryCommands(n);return{name:n,commands:Object.values(i??{})}}))}async readLibraryCommands(t){return this.fileSystem.readFileFragments({path:`${this.dataPath}/${vC}/${t}/commands.mdb`,name:"commands",filename:"commands.mdb",parent:`${this.dataPath}/${vC}/${t}`,isFolder:!1,extension:"mdb"},"mdbCommands")}async saveSystemCommand(t,r){let n={path:`${this.dataPath}/${vC}/${t}/commands.mdb`,name:"commands",filename:"commands.mdb",parent:`${this.dataPath}/${vC}/${t}`,isFolder:!1,extension:"mdb"};if(r)await this.fileSystem.saveFileFragment(n,"schema",r.schema.id,()=>r.schema),await this.fileSystem.saveFileFragment(n,"mdbCommand",r.schema.id,()=>r);else{let i={m_fields:{uniques:sa.uniques,cols:sa.cols,rows:[]},m_schema:{uniques:[],cols:["id","name","type","def","predicate","primary"],rows:[]}},a=n.path,o=a.split(".").pop(),s=a.split("/").slice(0,-1).join("/"),l=a.split("/").pop().split(".")[0];await this.fileSystem.newFile(s,l,o,i)}}async deleteCommand(t,r){let n=await this.fileSystem.getFile(this.spaceInfoForPath(t).commandsPath);return this.fileSystem.deleteFileFragment(n,"mdbCommand",r)}async saveCommand(t,r,n){let i=await this.fileSystem.getFile(this.spaceInfoForPath(t).commandsPath);return i||(i=await this.createDefaultCommands(t)),this.fileSystem.saveFileFragment(i,"mdbCommand",r,n)}async contextForSpace(t){let r=await this.fileSystem.getFile(this.spaceInfoForPath(t).dbPath);return r?this.fileSystem.readFileFragments(r,"mdbTable",Er):Kx(this.spaceManager.superstate,this.spaceInfoForPath(t))}async addSpaceProperty(t,r){let n=await this.fileSystem.getFile(this.spaceInfoForPath(t)?.dbPath);return n||await this.createDefaultTable(t),this.fileSystem.newFileFragment(n,"field",r.name,r)}async deleteSpaceProperty(t,r){let n=await this.fileSystem.getFile(this.spaceInfoForPath(t).dbPath);return this.fileSystem.deleteFileFragment(n,"field",r)}async saveSpaceProperty(t,r,n){let i=await this.fileSystem.getFile(this.spaceInfoForPath(t).dbPath);return i||await this.createDefaultTable(t),this.fileSystem.saveFileFragment(i,"field",n,a=>({...a,...r}))}async addProperty(t,r){let n=await this.fileSystem.getFile(t);this.fileSystem.newFileFragment(n,"property",r.name,r)}async saveProperties(t,r){let n=await this.fileSystem.getFile(t);return this.fileSystem.saveFileFragment(n,"property",null,i=>({...i,...r}))}async readLabel(t){let r=this.fileSystem.getFileCache(t)?.label;if(!r){let n=await this.fileSystem.getFile(t);return n?this.fileSystem.readFileFragments(n,"label",null):{}}return r}async saveLabel(t,r,n){if(this.spaceManager.superstate.spacesIndex.has(t)){let a=this.spaceInfoForPath(t),o=await this.fileSystem.getFile(a.defPath),s=await this.fileSystem.getFile(a.notePath);if(this.spaceManager.superstate.settings.enableFolderNote)s||(s=await this.fileSystem.newFile(a.folderPath,a.name,"md"));else{if(!o){let l=this.spaceInfoForPath(t).defPath,u=l.split(".").pop(),c=l.split("/").slice(0,-1).join("/"),f=l.split("/").pop().split(".")[0];o=await this.fileSystem.newFile(c,f,u)}s=o}await this.fileSystem.saveFileLabel(s,r,n);return}let i=await this.fileSystem.getFile(t);this.fileSystem.saveFileLabel(i,r,n)}async renameProperty(t,r,n){let i=await this.fileSystem.getFile(t);this.fileSystem.saveFileFragment(i,"property",null,a=>{let{[r]:o,...s}=a;return o?{...s,[n]:o}:a})}async readProperties(t){let r=await this.fileSystem.getFile(t);return this.fileSystem.readFileFragments(r,"property",null)}async deleteProperty(t,r){let n=await this.fileSystem.getFile(t);this.fileSystem.deleteFileFragment(n,"property",r)}allSpaces(){let r=(()=>this.allPaths(["folder"]).filter(i=>!LV(this.spaceManager.superstate.settings,i)).map(i=>Bk(this.spaceManager,i)))();if(this.spaceManager.superstate.settings.enableDefaultSpaces){let n=Object.keys(Ep).map(o=>this.spaceManager.spaceInfoForPath(`spaces://$${o}`)),a=(()=>this.readTags().map(o=>p0(this.spaceManager,jM(o)))??[])();return[...n,...a,...r]}return r}readTags(){return this.fileSystem.allTags()}spaceInfoForPath(t){return are(this.spaceManager,t)}allCaches(){return this.fileSystem.allCaches()}async spaceDefForSpace(t){let r=this.spaceInfoForPath(t);if(!r)return null;let n=r.defPath?await this.fileSystem.readTextFromFile(r.defPath):null;if(!n){let a=await this.fileSystem.getFile(r.notePath),s=(a?this.fileSystem.getFileCache(a.path)?.frontmatter:null)??{};return pC(s,this.spaceManager.superstate.settings)}let i=or(n)??{};return pC(i,this.spaceManager.superstate.settings)}async createSpace(t,r,n){let i=this.spaceInfoForPath(r),a=i.folderPath=="/"?t:i.folderPath+"/"+t;if(await this.fileSystem.createFolder(a),Object.keys(n??{}).length>0)return this.saveSpace(a,()=>n)}async saveSpace(t,r,n){let i=r(await this.spaceDefForSpace(t))??{},a=this.spaceInfoForPath(t),o=await this.fileSystem.getFile(a.defPath);if(!o){let l=this.spaceInfoForPath(t).defPath,u=l.split(".").pop(),c=l.split("/").slice(0,-1).join("/"),f=l.split("/").pop().split(".")[0];o=await this.fileSystem.newFile(c,f,u)}let s=await this.fileSystem.getFile(a.notePath);this.spaceManager.superstate.settings.enableFolderNote?s||(s=await this.fileSystem.newFile(a.folderPath,rf(a.notePath),"md")):s=o,n&&await this.fileSystem.saveFileFragment(s,"property",null,l=>({...l,...n??{}})),await this.fileSystem.saveFileFragment(o,"definition",null,l=>({[_k]:i.filters,[Nk]:i.contexts,[Pk]:i.links,[Ik]:i.sort,[Tk]:i.template,[Fk]:i.templateName,[sj]:i.recursive,defaultSticker:i.defaultSticker,readMode:i.readMode}))}renameSpace(t,r){let n=this.spaceInfoForPath(t),i=this.spaceInfoForPath(r);return this.fileSystem.renameFile(n.folderPath,i.folderPath).then(a=>(this.spaceManager.superstate.settings.enableFolderNote&&this.fileSystem.renameFile(jm(n.notePath,i.path),i.notePath),a))}deleteSpace(t){let r=this.spaceInfoForPath(t),n=p0(this.spaceManager,r.name);this.fileSystem.deleteFile(n.folderPath)}childrenForSpace(t){return this.fileSystem.allFiles().filter(r=>r.parent==t).map(r=>r.path)}addTag(t,r){this.fileSystem.addTagToFile(t,r)}renameTag(t,r,n){this.fileSystem.renameTagForFile(t,r,n)}deleteTag(t,r){this.fileSystem.removeTagFromFile(t,r)}pathsForTag(t){return this.fileSystem.filesForTag(t)}resolvePath(t,r){return this.fileSystem.resolvePath(t,r)}};var Rye={"image-select":` - `};var Sxe=Ae(Ya());var $ye=(e,t,r,n)=>{let i=n==="bottom"?e.x:e.x+e.width,a=n==="top"?e.y-t.height-10:n=="right"?e.y:e.y+e.height+10,o=i+t.width-r.width,s=a+t.height-r.height,l=a,u=i;return o>0&&(e.x-t.width<0?u=e.x-o:u=e.x-t.width),s>0&&(e.y-t.height<0?l=e.y-s:l=e.y-t.height-10),{x:u,y:l,width:t.width,height:t.height}};var qd=Ae(Te());var wxe=Ae(Ya()),$d=Ae(Te());var pa=Ae(Te(),1);function ih(e,t,{checkForDefaultPrevented:r=!0}={}){return function(i){if(e?.(i),r===!1||!i.defaultPrevented)return t?.(i)}}var qye=Ae(Te(),1);function lVe(e,t){typeof e=="function"?e(t):e!=null&&(e.current=t)}function zV(...e){return t=>e.forEach(r=>lVe(r,t))}function Up(...e){return qye.useCallback(zV(...e),e)}var Bd=Ae(Te(),1),UV=Ae(XA(),1);function Wye(e,t){let r=Bd.createContext(t);function n(a){let{children:o,...s}=a,l=Bd.useMemo(()=>s,Object.values(s));return(0,UV.jsx)(r.Provider,{value:l,children:o})}function i(a){let o=Bd.useContext(r);if(o)return o;if(t!==void 0)return t;throw new Error(`\`${a}\` must be used within \`${e}\``)}return n.displayName=e+"Provider",[n,i]}function Hye(e,t=[]){let r=[];function n(a,o){let s=Bd.createContext(o),l=r.length;r=[...r,o];function u(f){let{scope:d,children:p,...h}=f,m=d?.[e][l]||s,g=Bd.useMemo(()=>h,Object.values(h));return(0,UV.jsx)(m.Provider,{value:g,children:p})}function c(f,d){let p=d?.[e][l]||s,h=Bd.useContext(p);if(h)return h;if(o!==void 0)return o;throw new Error(`\`${f}\` must be used within \`${a}\``)}return u.displayName=a+"Provider",[u,c]}let i=()=>{let a=r.map(o=>Bd.createContext(o));return function(s){let l=s?.[e]||a;return Bd.useMemo(()=>({[`__scope${e}`]:{...s,[e]:l}}),[s,l])}};return i.scopeName=e,[n,hVe(i,...t)]}function hVe(...e){let t=e[0];if(e.length===1)return t;let r=()=>{let n=e.map(i=>({useScope:i(),scopeName:i.scopeName}));return function(a){let o=n.reduce((s,{useScope:l,scopeName:u})=>{let f=l(a)[`__scope${u}`];return{...s,...f}},{});return Bd.useMemo(()=>({[`__scope${t.scopeName}`]:o}),[o])}};return r.scopeName=t.scopeName,r}var WV=Ae(Te(),1);var Vye=Ae(Te(),1),Fy=Boolean(globalThis?.document)?Vye.useLayoutEffect:()=>{};var AVe=WV["useId".toString()]||(()=>{}),gVe=0;function e5(e){let[t,r]=WV.useState(AVe());return Fy(()=>{e||r(n=>n??String(gVe++))},[e]),e||(t?`radix-${t}`:"")}var uv=Ae(Te(),1);var XS=Ae(Te(),1);function Wp(e){let t=XS.useRef(e);return XS.useEffect(()=>{t.current=e}),XS.useMemo(()=>(...r)=>t.current?.(...r),[])}function Gye({prop:e,defaultProp:t,onChange:r=()=>{}}){let[n,i]=vVe({defaultProp:t,onChange:r}),a=e!==void 0,o=a?e:n,s=Wp(r),l=uv.useCallback(u=>{if(a){let f=typeof u=="function"?u(e):u;f!==e&&s(f)}else i(u)},[a,e,i,s]);return[o,l]}function vVe({defaultProp:e,onChange:t}){let r=uv.useState(e),[n]=r,i=uv.useRef(n),a=Wp(t);return uv.useEffect(()=>{i.current!==n&&(a(n),i.current=n)},[n,i,a]),r}var no=Ae(Te(),1);var Qye=Ae(Te(),1),Yye=Ae(bl(),1);var El=Ae(Te(),1);var KS=Ae(XA(),1),xC=El.forwardRef((e,t)=>{let{children:r,...n}=e,i=El.Children.toArray(r),a=i.find(bVe);if(a){let o=a.props.children,s=i.map(l=>l===a?El.Children.count(o)>1?El.Children.only(null):El.isValidElement(o)?o.props.children:null:l);return(0,KS.jsx)(HV,{...n,ref:t,children:El.isValidElement(o)?El.cloneElement(o,void 0,s):null})}return(0,KS.jsx)(HV,{...n,ref:t,children:r})});xC.displayName="Slot";var HV=El.forwardRef((e,t)=>{let{children:r,...n}=e;if(El.isValidElement(r)){let i=wVe(r);return El.cloneElement(r,{...xVe(n,r.props),ref:t?zV(t,i):i})}return El.Children.count(r)>1?El.Children.only(null):null});HV.displayName="SlotClone";var yVe=({children:e})=>(0,KS.jsx)(KS.Fragment,{children:e});function bVe(e){return El.isValidElement(e)&&e.type===yVe}function xVe(e,t){let r={...t};for(let n in t){let i=e[n],a=t[n];/^on[A-Z]/.test(n)?i&&a?r[n]=(...s)=>{a(...s),i(...s)}:i&&(r[n]=i):n==="style"?r[n]={...i,...a}:n==="className"&&(r[n]=[i,a].filter(Boolean).join(" "))}return{...e,...r}}function wVe(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning;return r?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning,r?e.props.ref:e.props.ref||e.ref)}var Zye=Ae(XA(),1),SVe=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"],Cf=SVe.reduce((e,t)=>{let r=Qye.forwardRef((n,i)=>{let{asChild:a,...o}=n,s=a?xC:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),(0,Zye.jsx)(s,{...o,ref:i})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function Xye(e,t){e&&Yye.flushSync(()=>e.dispatchEvent(t))}var Kye=Ae(Te(),1);function Jye(e,t=globalThis?.document){let r=Wp(e);Kye.useEffect(()=>{let n=i=>{i.key==="Escape"&&r(i)};return t.addEventListener("keydown",n,{capture:!0}),()=>t.removeEventListener("keydown",n,{capture:!0})},[r,t])}var GV=Ae(XA(),1),EVe="DismissableLayer",VV="dismissableLayer.update",kVe="dismissableLayer.pointerDownOutside",CVe="dismissableLayer.focusOutside",ebe,rbe=no.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),QV=no.forwardRef((e,t)=>{let{disableOutsidePointerEvents:r=!1,onEscapeKeyDown:n,onPointerDownOutside:i,onFocusOutside:a,onInteractOutside:o,onDismiss:s,...l}=e,u=no.useContext(rbe),[c,f]=no.useState(null),d=c?.ownerDocument??globalThis?.document,[,p]=no.useState({}),h=Up(t,k=>f(k)),m=Array.from(u.layers),[g]=[...u.layersWithOutsidePointerEventsDisabled].slice(-1),A=m.indexOf(g),b=c?m.indexOf(c):-1,v=u.layersWithOutsidePointerEventsDisabled.size>0,x=b>=A,w=MVe(k=>{let j=k.target,O=[...u.branches].some(C=>C.contains(j));!x||O||(i?.(k),o?.(k),k.defaultPrevented||s?.())},d),S=jVe(k=>{let j=k.target;[...u.branches].some(C=>C.contains(j))||(a?.(k),o?.(k),k.defaultPrevented||s?.())},d);return Jye(k=>{b===u.layers.size-1&&(n?.(k),!k.defaultPrevented&&s&&(k.preventDefault(),s()))},d),no.useEffect(()=>{if(!!c)return r&&(u.layersWithOutsidePointerEventsDisabled.size===0&&(ebe=d.body.style.pointerEvents,d.body.style.pointerEvents="none"),u.layersWithOutsidePointerEventsDisabled.add(c)),u.layers.add(c),tbe(),()=>{r&&u.layersWithOutsidePointerEventsDisabled.size===1&&(d.body.style.pointerEvents=ebe)}},[c,d,r,u]),no.useEffect(()=>()=>{!c||(u.layers.delete(c),u.layersWithOutsidePointerEventsDisabled.delete(c),tbe())},[c,u]),no.useEffect(()=>{let k=()=>p({});return document.addEventListener(VV,k),()=>document.removeEventListener(VV,k)},[]),(0,GV.jsx)(Cf.div,{...l,ref:h,style:{pointerEvents:v?x?"auto":"none":void 0,...e.style},onFocusCapture:ih(e.onFocusCapture,S.onFocusCapture),onBlurCapture:ih(e.onBlurCapture,S.onBlurCapture),onPointerDownCapture:ih(e.onPointerDownCapture,w.onPointerDownCapture)})});QV.displayName=EVe;var DVe="DismissableLayerBranch",OVe=no.forwardRef((e,t)=>{let r=no.useContext(rbe),n=no.useRef(null),i=Up(t,n);return no.useEffect(()=>{let a=n.current;if(a)return r.branches.add(a),()=>{r.branches.delete(a)}},[r.branches]),(0,GV.jsx)(Cf.div,{...e,ref:i})});OVe.displayName=DVe;function MVe(e,t=globalThis?.document){let r=Wp(e),n=no.useRef(!1),i=no.useRef(()=>{});return no.useEffect(()=>{let a=s=>{if(s.target&&!n.current){let u=function(){nbe(kVe,r,c,{discrete:!0})};var l=u;let c={originalEvent:s};s.pointerType==="touch"?(t.removeEventListener("click",i.current),i.current=u,t.addEventListener("click",i.current,{once:!0})):u()}else t.removeEventListener("click",i.current);n.current=!1},o=window.setTimeout(()=>{t.addEventListener("pointerdown",a)},0);return()=>{window.clearTimeout(o),t.removeEventListener("pointerdown",a),t.removeEventListener("click",i.current)}},[t,r]),{onPointerDownCapture:()=>n.current=!0}}function jVe(e,t=globalThis?.document){let r=Wp(e),n=no.useRef(!1);return no.useEffect(()=>{let i=a=>{a.target&&!n.current&&nbe(CVe,r,{originalEvent:a},{discrete:!1})};return t.addEventListener("focusin",i),()=>t.removeEventListener("focusin",i)},[t,r]),{onFocusCapture:()=>n.current=!0,onBlurCapture:()=>n.current=!1}}function tbe(){let e=new CustomEvent(VV);document.dispatchEvent(e)}function nbe(e,t,r,{discrete:n}){let i=r.originalEvent.target,a=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:r});t&&i.addEventListener(e,t,{once:!0}),n?Xye(i,a):i.dispatchEvent(a)}var Rd=Ae(Te(),1);var lbe=Ae(XA(),1),YV="focusScope.autoFocusOnMount",ZV="focusScope.autoFocusOnUnmount",ibe={bubbles:!1,cancelable:!0},NVe="FocusScope",XV=Rd.forwardRef((e,t)=>{let{loop:r=!1,trapped:n=!1,onMountAutoFocus:i,onUnmountAutoFocus:a,...o}=e,[s,l]=Rd.useState(null),u=Wp(i),c=Wp(a),f=Rd.useRef(null),d=Up(t,m=>l(m)),p=Rd.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;Rd.useEffect(()=>{if(n){let b=function(S){if(p.paused||!s)return;let k=S.target;s.contains(k)?f.current=k:cv(f.current,{select:!0})},v=function(S){if(p.paused||!s)return;let k=S.relatedTarget;k!==null&&(s.contains(k)||cv(f.current,{select:!0}))},x=function(S){if(document.activeElement===document.body)for(let j of S)j.removedNodes.length>0&&cv(s)};var m=b,g=v,A=x;document.addEventListener("focusin",b),document.addEventListener("focusout",v);let w=new MutationObserver(x);return s&&w.observe(s,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",b),document.removeEventListener("focusout",v),w.disconnect()}}},[n,s,p.paused]),Rd.useEffect(()=>{if(s){obe.add(p);let m=document.activeElement;if(!s.contains(m)){let A=new CustomEvent(YV,ibe);s.addEventListener(YV,u),s.dispatchEvent(A),A.defaultPrevented||(TVe(BVe(ube(s)),{select:!0}),document.activeElement===m&&cv(s))}return()=>{s.removeEventListener(YV,u),setTimeout(()=>{let A=new CustomEvent(ZV,ibe);s.addEventListener(ZV,c),s.dispatchEvent(A),A.defaultPrevented||cv(m??document.body,{select:!0}),s.removeEventListener(ZV,c),obe.remove(p)},0)}}},[s,u,c,p]);let h=Rd.useCallback(m=>{if(!r&&!n||p.paused)return;let g=m.key==="Tab"&&!m.altKey&&!m.ctrlKey&&!m.metaKey,A=document.activeElement;if(g&&A){let b=m.currentTarget,[v,x]=FVe(b);v&&x?!m.shiftKey&&A===x?(m.preventDefault(),r&&cv(v,{select:!0})):m.shiftKey&&A===v&&(m.preventDefault(),r&&cv(x,{select:!0})):A===b&&m.preventDefault()}},[r,n,p.paused]);return(0,lbe.jsx)(Cf.div,{tabIndex:-1,...o,ref:d,onKeyDown:h})});XV.displayName=NVe;function TVe(e,{select:t=!1}={}){let r=document.activeElement;for(let n of e)if(cv(n,{select:t}),document.activeElement!==r)return}function FVe(e){let t=ube(e),r=abe(t,e),n=abe(t.reverse(),e);return[r,n]}function ube(e){let t=[],r=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:n=>{let i=n.tagName==="INPUT"&&n.type==="hidden";return n.disabled||n.hidden||i?NodeFilter.FILTER_SKIP:n.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;r.nextNode();)t.push(r.currentNode);return t}function abe(e,t){for(let r of e)if(!_Ve(r,{upTo:t}))return r}function _Ve(e,{upTo:t}){if(getComputedStyle(e).visibility==="hidden")return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display==="none")return!0;e=e.parentElement}return!1}function PVe(e){return e instanceof HTMLInputElement&&"select"in e}function cv(e,{select:t=!1}={}){if(e&&e.focus){let r=document.activeElement;e.focus({preventScroll:!0}),e!==r&&PVe(e)&&t&&e.select()}}var obe=IVe();function IVe(){let e=[];return{add(t){let r=e[0];t!==r&&r?.pause(),e=sbe(e,t),e.unshift(t)},remove(t){e=sbe(e,t),e[0]?.resume()}}}function sbe(e,t){let r=[...e],n=r.indexOf(t);return n!==-1&&r.splice(n,1),r}function BVe(e){return e.filter(t=>t.tagName!=="A")}var t5=Ae(Te(),1),cbe=Ae(bl(),1);var fbe=Ae(XA(),1),RVe="Portal",KV=t5.forwardRef((e,t)=>{let{container:r,...n}=e,[i,a]=t5.useState(!1);Fy(()=>a(!0),[]);let o=r||i&&globalThis?.document?.body;return o?cbe.default.createPortal((0,fbe.jsx)(Cf.div,{...n,ref:t}),o):null});KV.displayName=RVe;var Nc=Ae(Te(),1),dbe=Ae(bl(),1);var pbe=Ae(Te(),1);function $Ve(e,t){return pbe.useReducer((r,n)=>t[r][n]??r,e)}var wC=e=>{let{present:t,children:r}=e,n=qVe(t),i=typeof r=="function"?r({present:n.isPresent}):Nc.Children.only(r),a=Up(n.ref,LVe(i));return typeof r=="function"||n.isPresent?Nc.cloneElement(i,{ref:a}):null};wC.displayName="Presence";function qVe(e){let[t,r]=Nc.useState(),n=Nc.useRef({}),i=Nc.useRef(e),a=Nc.useRef("none"),o=e?"mounted":"unmounted",[s,l]=$Ve(o,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return Nc.useEffect(()=>{let u=r5(n.current);a.current=s==="mounted"?u:"none"},[s]),Fy(()=>{let u=n.current,c=i.current;if(c!==e){let d=a.current,p=r5(u);e?l("MOUNT"):p==="none"||u?.display==="none"?l("UNMOUNT"):l(c&&d!==p?"ANIMATION_OUT":"UNMOUNT"),i.current=e}},[e,l]),Fy(()=>{if(t){let u=f=>{let p=r5(n.current).includes(f.animationName);f.target===t&&p&&dbe.flushSync(()=>l("ANIMATION_END"))},c=f=>{f.target===t&&(a.current=r5(n.current))};return t.addEventListener("animationstart",c),t.addEventListener("animationcancel",u),t.addEventListener("animationend",u),()=>{t.removeEventListener("animationstart",c),t.removeEventListener("animationcancel",u),t.removeEventListener("animationend",u)}}else l("ANIMATION_END")},[t,l]),{isPresent:["mounted","unmountSuspended"].includes(s),ref:Nc.useCallback(u=>{u&&(n.current=getComputedStyle(u)),r(u)},[])}}function r5(e){return e?.animationName||"none"}function LVe(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning;return r?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning,r?e.props.ref:e.props.ref||e.ref)}var hbe=Ae(Te(),1),JV=0;function Abe(){hbe.useEffect(()=>{let e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??mbe()),document.body.insertAdjacentElement("beforeend",e[1]??mbe()),JV++,()=>{JV===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(t=>t.remove()),JV--}},[])}function mbe(){let e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.cssText="outline: none; opacity: 0; position: fixed; pointer-events: none",e}var s5=Ae(Te());var pu=Ae(Te());var _y="right-scroll-bar-position",Py="width-before-scroll-bar",eG="with-scroll-bars-hidden",tG="--removed-body-scroll-bar-size";function n5(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}var gbe=Ae(Te());function vbe(e,t){var r=(0,gbe.useState)(function(){return{value:e,callback:t,facade:{get current(){return r.value},set current(n){var i=r.value;i!==n&&(r.value=n,r.callback(n,i))}}}})[0];return r.callback=t,r.facade}var i5=Ae(Te());var zVe=typeof window<"u"?i5.useLayoutEffect:i5.useEffect,ybe=new WeakMap;function rG(e,t){var r=vbe(t||null,function(n){return e.forEach(function(i){return n5(i,n)})});return zVe(function(){var n=ybe.get(r);if(n){var i=new Set(n),a=new Set(e),o=r.current;i.forEach(function(s){a.has(s)||n5(s,null)}),a.forEach(function(s){i.has(s)||n5(s,o)})}ybe.set(r,e)},[e]),r}function UVe(e){return e}function WVe(e,t){t===void 0&&(t=UVe);var r=[],n=!1,i={read:function(){if(n)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return r.length?r[r.length-1]:e},useMedium:function(a){var o=t(a,n);return r.push(o),function(){r=r.filter(function(s){return s!==o})}},assignSyncMedium:function(a){for(n=!0;r.length;){var o=r;r=[],o.forEach(a)}r={push:function(s){return a(s)},filter:function(){return r}}},assignMedium:function(a){n=!0;var o=[];if(r.length){var s=r;r=[],s.forEach(a),o=r}var l=function(){var c=o;o=[],c.forEach(a)},u=function(){return Promise.resolve().then(l)};u(),r={push:function(c){o.push(c),u()},filter:function(c){return o=o.filter(c),r}}}};return i}function nG(e){e===void 0&&(e={});var t=WVe(null);return t.options=ji({async:!0,ssr:!1},e),t}var bbe=Ae(Te()),xbe=function(e){var t=e.sideCar,r=$M(e,["sideCar"]);if(!t)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var n=t.read();if(!n)throw new Error("Sidecar medium not found");return bbe.createElement(n,ji({},r))};xbe.isSideCarExport=!0;function iG(e,t){return e.useMedium(t),xbe}var a5=nG();var aG=function(){},SC=pu.forwardRef(function(e,t){var r=pu.useRef(null),n=pu.useState({onScrollCapture:aG,onWheelCapture:aG,onTouchMoveCapture:aG}),i=n[0],a=n[1],o=e.forwardProps,s=e.children,l=e.className,u=e.removeScrollBar,c=e.enabled,f=e.shards,d=e.sideCar,p=e.noIsolation,h=e.inert,m=e.allowPinchZoom,g=e.as,A=g===void 0?"div":g,b=e.gapMode,v=$M(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noIsolation","inert","allowPinchZoom","as","gapMode"]),x=d,w=rG([r,t]),S=ji(ji({},v),i);return pu.createElement(pu.Fragment,null,c&&pu.createElement(x,{sideCar:a5,removeScrollBar:u,shards:f,noIsolation:p,inert:h,setCallbacks:a,allowPinchZoom:!!m,lockRef:r,gapMode:b}),o?pu.cloneElement(pu.Children.only(s),ji(ji({},S),{ref:w})):pu.createElement(A,ji({},S,{className:l,ref:w}),s))});SC.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};SC.classNames={fullWidth:Py,zeroRight:_y};var ja=Ae(Te());var e2=Ae(Te());var Ebe=Ae(Te());var wbe;var Sbe=function(){if(wbe)return wbe;if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function HVe(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=Sbe();return t&&e.setAttribute("nonce",t),e}function VVe(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function GVe(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var oG=function(){var e=0,t=null;return{add:function(r){e==0&&(t=HVe())&&(VVe(t,r),GVe(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}};var sG=function(){var e=oG();return function(t,r){Ebe.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&r])}};var EC=function(){var e=sG(),t=function(r){var n=r.styles,i=r.dynamic;return e(n,i),null};return t};var QVe={left:0,top:0,right:0,gap:0},lG=function(e){return parseInt(e||"",10)||0},YVe=function(e){var t=window.getComputedStyle(document.body),r=t[e==="padding"?"paddingLeft":"marginLeft"],n=t[e==="padding"?"paddingTop":"marginTop"],i=t[e==="padding"?"paddingRight":"marginRight"];return[lG(r),lG(n),lG(i)]},uG=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return QVe;var t=YVe(e),r=document.documentElement.clientWidth,n=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,n-r+t[2]-t[0])}};var ZVe=EC(),JS="data-scroll-locked",XVe=function(e,t,r,n){var i=e.left,a=e.top,o=e.right,s=e.gap;return r===void 0&&(r="margin"),` + `};var Sxe=Ae(Ya());var $ye=(e,t,r,n)=>{let i=n==="bottom"?e.x:e.x+e.width,a=n==="top"?e.y-t.height-10:n=="right"?e.y:e.y+e.height+10,o=i+t.width-r.width,s=a+t.height-r.height,l=a,u=i;return o>0&&(e.x-t.width<0?u=e.x-o:u=e.x-t.width),s>0&&(e.y-t.height<0?l=e.y-s:l=e.y-t.height-10),{x:u,y:l,width:t.width,height:t.height}};var qd=Ae(Te());var wxe=Ae(Ya()),$d=Ae(Te());var pa=Ae(Te(),1);function ih(e,t,{checkForDefaultPrevented:r=!0}={}){return function(i){if(e?.(i),r===!1||!i.defaultPrevented)return t?.(i)}}var qye=Ae(Te(),1);function lVe(e,t){typeof e=="function"?e(t):e!=null&&(e.current=t)}function zV(...e){return t=>e.forEach(r=>lVe(r,t))}function Wp(...e){return qye.useCallback(zV(...e),e)}var Bd=Ae(Te(),1),UV=Ae(XA(),1);function Wye(e,t){let r=Bd.createContext(t);function n(a){let{children:o,...s}=a,l=Bd.useMemo(()=>s,Object.values(s));return(0,UV.jsx)(r.Provider,{value:l,children:o})}function i(a){let o=Bd.useContext(r);if(o)return o;if(t!==void 0)return t;throw new Error(`\`${a}\` must be used within \`${e}\``)}return n.displayName=e+"Provider",[n,i]}function Hye(e,t=[]){let r=[];function n(a,o){let s=Bd.createContext(o),l=r.length;r=[...r,o];function u(f){let{scope:d,children:p,...h}=f,m=d?.[e][l]||s,g=Bd.useMemo(()=>h,Object.values(h));return(0,UV.jsx)(m.Provider,{value:g,children:p})}function c(f,d){let p=d?.[e][l]||s,h=Bd.useContext(p);if(h)return h;if(o!==void 0)return o;throw new Error(`\`${f}\` must be used within \`${a}\``)}return u.displayName=a+"Provider",[u,c]}let i=()=>{let a=r.map(o=>Bd.createContext(o));return function(s){let l=s?.[e]||a;return Bd.useMemo(()=>({[`__scope${e}`]:{...s,[e]:l}}),[s,l])}};return i.scopeName=e,[n,hVe(i,...t)]}function hVe(...e){let t=e[0];if(e.length===1)return t;let r=()=>{let n=e.map(i=>({useScope:i(),scopeName:i.scopeName}));return function(a){let o=n.reduce((s,{useScope:l,scopeName:u})=>{let f=l(a)[`__scope${u}`];return{...s,...f}},{});return Bd.useMemo(()=>({[`__scope${t.scopeName}`]:o}),[o])}};return r.scopeName=t.scopeName,r}var WV=Ae(Te(),1);var Vye=Ae(Te(),1),Fy=Boolean(globalThis?.document)?Vye.useLayoutEffect:()=>{};var AVe=WV["useId".toString()]||(()=>{}),gVe=0;function e5(e){let[t,r]=WV.useState(AVe());return Fy(()=>{e||r(n=>n??String(gVe++))},[e]),e||(t?`radix-${t}`:"")}var uv=Ae(Te(),1);var XS=Ae(Te(),1);function Hp(e){let t=XS.useRef(e);return XS.useEffect(()=>{t.current=e}),XS.useMemo(()=>(...r)=>t.current?.(...r),[])}function Gye({prop:e,defaultProp:t,onChange:r=()=>{}}){let[n,i]=vVe({defaultProp:t,onChange:r}),a=e!==void 0,o=a?e:n,s=Hp(r),l=uv.useCallback(u=>{if(a){let f=typeof u=="function"?u(e):u;f!==e&&s(f)}else i(u)},[a,e,i,s]);return[o,l]}function vVe({defaultProp:e,onChange:t}){let r=uv.useState(e),[n]=r,i=uv.useRef(n),a=Hp(t);return uv.useEffect(()=>{i.current!==n&&(a(n),i.current=n)},[n,i,a]),r}var no=Ae(Te(),1);var Qye=Ae(Te(),1),Yye=Ae(bl(),1);var El=Ae(Te(),1);var KS=Ae(XA(),1),xC=El.forwardRef((e,t)=>{let{children:r,...n}=e,i=El.Children.toArray(r),a=i.find(bVe);if(a){let o=a.props.children,s=i.map(l=>l===a?El.Children.count(o)>1?El.Children.only(null):El.isValidElement(o)?o.props.children:null:l);return(0,KS.jsx)(HV,{...n,ref:t,children:El.isValidElement(o)?El.cloneElement(o,void 0,s):null})}return(0,KS.jsx)(HV,{...n,ref:t,children:r})});xC.displayName="Slot";var HV=El.forwardRef((e,t)=>{let{children:r,...n}=e;if(El.isValidElement(r)){let i=wVe(r);return El.cloneElement(r,{...xVe(n,r.props),ref:t?zV(t,i):i})}return El.Children.count(r)>1?El.Children.only(null):null});HV.displayName="SlotClone";var yVe=({children:e})=>(0,KS.jsx)(KS.Fragment,{children:e});function bVe(e){return El.isValidElement(e)&&e.type===yVe}function xVe(e,t){let r={...t};for(let n in t){let i=e[n],a=t[n];/^on[A-Z]/.test(n)?i&&a?r[n]=(...s)=>{a(...s),i(...s)}:i&&(r[n]=i):n==="style"?r[n]={...i,...a}:n==="className"&&(r[n]=[i,a].filter(Boolean).join(" "))}return{...e,...r}}function wVe(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning;return r?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning,r?e.props.ref:e.props.ref||e.ref)}var Zye=Ae(XA(),1),SVe=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"],Cf=SVe.reduce((e,t)=>{let r=Qye.forwardRef((n,i)=>{let{asChild:a,...o}=n,s=a?xC:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),(0,Zye.jsx)(s,{...o,ref:i})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function Xye(e,t){e&&Yye.flushSync(()=>e.dispatchEvent(t))}var Kye=Ae(Te(),1);function Jye(e,t=globalThis?.document){let r=Hp(e);Kye.useEffect(()=>{let n=i=>{i.key==="Escape"&&r(i)};return t.addEventListener("keydown",n,{capture:!0}),()=>t.removeEventListener("keydown",n,{capture:!0})},[r,t])}var GV=Ae(XA(),1),EVe="DismissableLayer",VV="dismissableLayer.update",kVe="dismissableLayer.pointerDownOutside",CVe="dismissableLayer.focusOutside",ebe,rbe=no.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),QV=no.forwardRef((e,t)=>{let{disableOutsidePointerEvents:r=!1,onEscapeKeyDown:n,onPointerDownOutside:i,onFocusOutside:a,onInteractOutside:o,onDismiss:s,...l}=e,u=no.useContext(rbe),[c,f]=no.useState(null),d=c?.ownerDocument??globalThis?.document,[,p]=no.useState({}),h=Wp(t,k=>f(k)),m=Array.from(u.layers),[g]=[...u.layersWithOutsidePointerEventsDisabled].slice(-1),A=m.indexOf(g),b=c?m.indexOf(c):-1,v=u.layersWithOutsidePointerEventsDisabled.size>0,x=b>=A,w=MVe(k=>{let j=k.target,O=[...u.branches].some(C=>C.contains(j));!x||O||(i?.(k),o?.(k),k.defaultPrevented||s?.())},d),S=jVe(k=>{let j=k.target;[...u.branches].some(C=>C.contains(j))||(a?.(k),o?.(k),k.defaultPrevented||s?.())},d);return Jye(k=>{b===u.layers.size-1&&(n?.(k),!k.defaultPrevented&&s&&(k.preventDefault(),s()))},d),no.useEffect(()=>{if(!!c)return r&&(u.layersWithOutsidePointerEventsDisabled.size===0&&(ebe=d.body.style.pointerEvents,d.body.style.pointerEvents="none"),u.layersWithOutsidePointerEventsDisabled.add(c)),u.layers.add(c),tbe(),()=>{r&&u.layersWithOutsidePointerEventsDisabled.size===1&&(d.body.style.pointerEvents=ebe)}},[c,d,r,u]),no.useEffect(()=>()=>{!c||(u.layers.delete(c),u.layersWithOutsidePointerEventsDisabled.delete(c),tbe())},[c,u]),no.useEffect(()=>{let k=()=>p({});return document.addEventListener(VV,k),()=>document.removeEventListener(VV,k)},[]),(0,GV.jsx)(Cf.div,{...l,ref:h,style:{pointerEvents:v?x?"auto":"none":void 0,...e.style},onFocusCapture:ih(e.onFocusCapture,S.onFocusCapture),onBlurCapture:ih(e.onBlurCapture,S.onBlurCapture),onPointerDownCapture:ih(e.onPointerDownCapture,w.onPointerDownCapture)})});QV.displayName=EVe;var DVe="DismissableLayerBranch",OVe=no.forwardRef((e,t)=>{let r=no.useContext(rbe),n=no.useRef(null),i=Wp(t,n);return no.useEffect(()=>{let a=n.current;if(a)return r.branches.add(a),()=>{r.branches.delete(a)}},[r.branches]),(0,GV.jsx)(Cf.div,{...e,ref:i})});OVe.displayName=DVe;function MVe(e,t=globalThis?.document){let r=Hp(e),n=no.useRef(!1),i=no.useRef(()=>{});return no.useEffect(()=>{let a=s=>{if(s.target&&!n.current){let u=function(){nbe(kVe,r,c,{discrete:!0})};var l=u;let c={originalEvent:s};s.pointerType==="touch"?(t.removeEventListener("click",i.current),i.current=u,t.addEventListener("click",i.current,{once:!0})):u()}else t.removeEventListener("click",i.current);n.current=!1},o=window.setTimeout(()=>{t.addEventListener("pointerdown",a)},0);return()=>{window.clearTimeout(o),t.removeEventListener("pointerdown",a),t.removeEventListener("click",i.current)}},[t,r]),{onPointerDownCapture:()=>n.current=!0}}function jVe(e,t=globalThis?.document){let r=Hp(e),n=no.useRef(!1);return no.useEffect(()=>{let i=a=>{a.target&&!n.current&&nbe(CVe,r,{originalEvent:a},{discrete:!1})};return t.addEventListener("focusin",i),()=>t.removeEventListener("focusin",i)},[t,r]),{onFocusCapture:()=>n.current=!0,onBlurCapture:()=>n.current=!1}}function tbe(){let e=new CustomEvent(VV);document.dispatchEvent(e)}function nbe(e,t,r,{discrete:n}){let i=r.originalEvent.target,a=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:r});t&&i.addEventListener(e,t,{once:!0}),n?Xye(i,a):i.dispatchEvent(a)}var Rd=Ae(Te(),1);var lbe=Ae(XA(),1),YV="focusScope.autoFocusOnMount",ZV="focusScope.autoFocusOnUnmount",ibe={bubbles:!1,cancelable:!0},NVe="FocusScope",XV=Rd.forwardRef((e,t)=>{let{loop:r=!1,trapped:n=!1,onMountAutoFocus:i,onUnmountAutoFocus:a,...o}=e,[s,l]=Rd.useState(null),u=Hp(i),c=Hp(a),f=Rd.useRef(null),d=Wp(t,m=>l(m)),p=Rd.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;Rd.useEffect(()=>{if(n){let b=function(S){if(p.paused||!s)return;let k=S.target;s.contains(k)?f.current=k:cv(f.current,{select:!0})},v=function(S){if(p.paused||!s)return;let k=S.relatedTarget;k!==null&&(s.contains(k)||cv(f.current,{select:!0}))},x=function(S){if(document.activeElement===document.body)for(let j of S)j.removedNodes.length>0&&cv(s)};var m=b,g=v,A=x;document.addEventListener("focusin",b),document.addEventListener("focusout",v);let w=new MutationObserver(x);return s&&w.observe(s,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",b),document.removeEventListener("focusout",v),w.disconnect()}}},[n,s,p.paused]),Rd.useEffect(()=>{if(s){obe.add(p);let m=document.activeElement;if(!s.contains(m)){let A=new CustomEvent(YV,ibe);s.addEventListener(YV,u),s.dispatchEvent(A),A.defaultPrevented||(TVe(BVe(ube(s)),{select:!0}),document.activeElement===m&&cv(s))}return()=>{s.removeEventListener(YV,u),setTimeout(()=>{let A=new CustomEvent(ZV,ibe);s.addEventListener(ZV,c),s.dispatchEvent(A),A.defaultPrevented||cv(m??document.body,{select:!0}),s.removeEventListener(ZV,c),obe.remove(p)},0)}}},[s,u,c,p]);let h=Rd.useCallback(m=>{if(!r&&!n||p.paused)return;let g=m.key==="Tab"&&!m.altKey&&!m.ctrlKey&&!m.metaKey,A=document.activeElement;if(g&&A){let b=m.currentTarget,[v,x]=FVe(b);v&&x?!m.shiftKey&&A===x?(m.preventDefault(),r&&cv(v,{select:!0})):m.shiftKey&&A===v&&(m.preventDefault(),r&&cv(x,{select:!0})):A===b&&m.preventDefault()}},[r,n,p.paused]);return(0,lbe.jsx)(Cf.div,{tabIndex:-1,...o,ref:d,onKeyDown:h})});XV.displayName=NVe;function TVe(e,{select:t=!1}={}){let r=document.activeElement;for(let n of e)if(cv(n,{select:t}),document.activeElement!==r)return}function FVe(e){let t=ube(e),r=abe(t,e),n=abe(t.reverse(),e);return[r,n]}function ube(e){let t=[],r=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:n=>{let i=n.tagName==="INPUT"&&n.type==="hidden";return n.disabled||n.hidden||i?NodeFilter.FILTER_SKIP:n.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;r.nextNode();)t.push(r.currentNode);return t}function abe(e,t){for(let r of e)if(!_Ve(r,{upTo:t}))return r}function _Ve(e,{upTo:t}){if(getComputedStyle(e).visibility==="hidden")return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display==="none")return!0;e=e.parentElement}return!1}function PVe(e){return e instanceof HTMLInputElement&&"select"in e}function cv(e,{select:t=!1}={}){if(e&&e.focus){let r=document.activeElement;e.focus({preventScroll:!0}),e!==r&&PVe(e)&&t&&e.select()}}var obe=IVe();function IVe(){let e=[];return{add(t){let r=e[0];t!==r&&r?.pause(),e=sbe(e,t),e.unshift(t)},remove(t){e=sbe(e,t),e[0]?.resume()}}}function sbe(e,t){let r=[...e],n=r.indexOf(t);return n!==-1&&r.splice(n,1),r}function BVe(e){return e.filter(t=>t.tagName!=="A")}var t5=Ae(Te(),1),cbe=Ae(bl(),1);var fbe=Ae(XA(),1),RVe="Portal",KV=t5.forwardRef((e,t)=>{let{container:r,...n}=e,[i,a]=t5.useState(!1);Fy(()=>a(!0),[]);let o=r||i&&globalThis?.document?.body;return o?cbe.default.createPortal((0,fbe.jsx)(Cf.div,{...n,ref:t}),o):null});KV.displayName=RVe;var Nc=Ae(Te(),1),dbe=Ae(bl(),1);var pbe=Ae(Te(),1);function $Ve(e,t){return pbe.useReducer((r,n)=>t[r][n]??r,e)}var wC=e=>{let{present:t,children:r}=e,n=qVe(t),i=typeof r=="function"?r({present:n.isPresent}):Nc.Children.only(r),a=Wp(n.ref,LVe(i));return typeof r=="function"||n.isPresent?Nc.cloneElement(i,{ref:a}):null};wC.displayName="Presence";function qVe(e){let[t,r]=Nc.useState(),n=Nc.useRef({}),i=Nc.useRef(e),a=Nc.useRef("none"),o=e?"mounted":"unmounted",[s,l]=$Ve(o,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return Nc.useEffect(()=>{let u=r5(n.current);a.current=s==="mounted"?u:"none"},[s]),Fy(()=>{let u=n.current,c=i.current;if(c!==e){let d=a.current,p=r5(u);e?l("MOUNT"):p==="none"||u?.display==="none"?l("UNMOUNT"):l(c&&d!==p?"ANIMATION_OUT":"UNMOUNT"),i.current=e}},[e,l]),Fy(()=>{if(t){let u=f=>{let p=r5(n.current).includes(f.animationName);f.target===t&&p&&dbe.flushSync(()=>l("ANIMATION_END"))},c=f=>{f.target===t&&(a.current=r5(n.current))};return t.addEventListener("animationstart",c),t.addEventListener("animationcancel",u),t.addEventListener("animationend",u),()=>{t.removeEventListener("animationstart",c),t.removeEventListener("animationcancel",u),t.removeEventListener("animationend",u)}}else l("ANIMATION_END")},[t,l]),{isPresent:["mounted","unmountSuspended"].includes(s),ref:Nc.useCallback(u=>{u&&(n.current=getComputedStyle(u)),r(u)},[])}}function r5(e){return e?.animationName||"none"}function LVe(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning;return r?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning,r?e.props.ref:e.props.ref||e.ref)}var hbe=Ae(Te(),1),JV=0;function Abe(){hbe.useEffect(()=>{let e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??mbe()),document.body.insertAdjacentElement("beforeend",e[1]??mbe()),JV++,()=>{JV===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(t=>t.remove()),JV--}},[])}function mbe(){let e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.cssText="outline: none; opacity: 0; position: fixed; pointer-events: none",e}var s5=Ae(Te());var pu=Ae(Te());var _y="right-scroll-bar-position",Py="width-before-scroll-bar",eG="with-scroll-bars-hidden",tG="--removed-body-scroll-bar-size";function n5(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}var gbe=Ae(Te());function vbe(e,t){var r=(0,gbe.useState)(function(){return{value:e,callback:t,facade:{get current(){return r.value},set current(n){var i=r.value;i!==n&&(r.value=n,r.callback(n,i))}}}})[0];return r.callback=t,r.facade}var i5=Ae(Te());var zVe=typeof window<"u"?i5.useLayoutEffect:i5.useEffect,ybe=new WeakMap;function rG(e,t){var r=vbe(t||null,function(n){return e.forEach(function(i){return n5(i,n)})});return zVe(function(){var n=ybe.get(r);if(n){var i=new Set(n),a=new Set(e),o=r.current;i.forEach(function(s){a.has(s)||n5(s,null)}),a.forEach(function(s){i.has(s)||n5(s,o)})}ybe.set(r,e)},[e]),r}function UVe(e){return e}function WVe(e,t){t===void 0&&(t=UVe);var r=[],n=!1,i={read:function(){if(n)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return r.length?r[r.length-1]:e},useMedium:function(a){var o=t(a,n);return r.push(o),function(){r=r.filter(function(s){return s!==o})}},assignSyncMedium:function(a){for(n=!0;r.length;){var o=r;r=[],o.forEach(a)}r={push:function(s){return a(s)},filter:function(){return r}}},assignMedium:function(a){n=!0;var o=[];if(r.length){var s=r;r=[],s.forEach(a),o=r}var l=function(){var c=o;o=[],c.forEach(a)},u=function(){return Promise.resolve().then(l)};u(),r={push:function(c){o.push(c),u()},filter:function(c){return o=o.filter(c),r}}}};return i}function nG(e){e===void 0&&(e={});var t=WVe(null);return t.options=ji({async:!0,ssr:!1},e),t}var bbe=Ae(Te()),xbe=function(e){var t=e.sideCar,r=$M(e,["sideCar"]);if(!t)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var n=t.read();if(!n)throw new Error("Sidecar medium not found");return bbe.createElement(n,ji({},r))};xbe.isSideCarExport=!0;function iG(e,t){return e.useMedium(t),xbe}var a5=nG();var aG=function(){},SC=pu.forwardRef(function(e,t){var r=pu.useRef(null),n=pu.useState({onScrollCapture:aG,onWheelCapture:aG,onTouchMoveCapture:aG}),i=n[0],a=n[1],o=e.forwardProps,s=e.children,l=e.className,u=e.removeScrollBar,c=e.enabled,f=e.shards,d=e.sideCar,p=e.noIsolation,h=e.inert,m=e.allowPinchZoom,g=e.as,A=g===void 0?"div":g,b=e.gapMode,v=$M(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noIsolation","inert","allowPinchZoom","as","gapMode"]),x=d,w=rG([r,t]),S=ji(ji({},v),i);return pu.createElement(pu.Fragment,null,c&&pu.createElement(x,{sideCar:a5,removeScrollBar:u,shards:f,noIsolation:p,inert:h,setCallbacks:a,allowPinchZoom:!!m,lockRef:r,gapMode:b}),o?pu.cloneElement(pu.Children.only(s),ji(ji({},S),{ref:w})):pu.createElement(A,ji({},S,{className:l,ref:w}),s))});SC.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};SC.classNames={fullWidth:Py,zeroRight:_y};var ja=Ae(Te());var e2=Ae(Te());var Ebe=Ae(Te());var wbe;var Sbe=function(){if(wbe)return wbe;if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function HVe(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=Sbe();return t&&e.setAttribute("nonce",t),e}function VVe(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function GVe(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var oG=function(){var e=0,t=null;return{add:function(r){e==0&&(t=HVe())&&(VVe(t,r),GVe(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}};var sG=function(){var e=oG();return function(t,r){Ebe.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&r])}};var EC=function(){var e=sG(),t=function(r){var n=r.styles,i=r.dynamic;return e(n,i),null};return t};var QVe={left:0,top:0,right:0,gap:0},lG=function(e){return parseInt(e||"",10)||0},YVe=function(e){var t=window.getComputedStyle(document.body),r=t[e==="padding"?"paddingLeft":"marginLeft"],n=t[e==="padding"?"paddingTop":"marginTop"],i=t[e==="padding"?"paddingRight":"marginRight"];return[lG(r),lG(n),lG(i)]},uG=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return QVe;var t=YVe(e),r=document.documentElement.clientWidth,n=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,n-r+t[2]-t[0])}};var ZVe=EC(),JS="data-scroll-locked",XVe=function(e,t,r,n){var i=e.left,a=e.top,o=e.right,s=e.gap;return r===void 0&&(r="margin"),` .`.concat(eG,` { overflow: hidden `).concat(n,`; padding-right: `).concat(s,"px ").concat(n,`; @@ -169,28 +169,28 @@ In case of a (multi dimensional) array or matrix, the prob order quantile of all `)},kbe=function(){var e=parseInt(document.body.getAttribute(JS)||"0",10);return isFinite(e)?e:0},KVe=function(){e2.useEffect(function(){return document.body.setAttribute(JS,(kbe()+1).toString()),function(){var e=kbe()-1;e<=0?document.body.removeAttribute(JS):document.body.setAttribute(JS,e.toString())}},[])},cG=function(e){var t=e.noRelative,r=e.noImportant,n=e.gapMode,i=n===void 0?"margin":n;KVe();var a=e2.useMemo(function(){return uG(i)},[i]);return e2.createElement(ZVe,{styles:XVe(a,!t,i,r?"":"!important")})};var fG=!1;if(typeof window<"u")try{kC=Object.defineProperty({},"passive",{get:function(){return fG=!0,!0}}),window.addEventListener("test",kC,kC),window.removeEventListener("test",kC,kC)}catch{fG=!1}var kC,Iy=fG?{passive:!1}:!1;var JVe=function(e){return e.tagName==="TEXTAREA"},Cbe=function(e,t){var r=window.getComputedStyle(e);return r[t]!=="hidden"&&!(r.overflowY===r.overflowX&&!JVe(e)&&r[t]==="visible")},eGe=function(e){return Cbe(e,"overflowY")},tGe=function(e){return Cbe(e,"overflowX")},dG=function(e,t){var r=t.ownerDocument,n=t;do{typeof ShadowRoot<"u"&&n instanceof ShadowRoot&&(n=n.host);var i=Dbe(e,n);if(i){var a=Obe(e,n),o=a[1],s=a[2];if(o>s)return!0}n=n.parentNode}while(n&&n!==r.body);return!1},rGe=function(e){var t=e.scrollTop,r=e.scrollHeight,n=e.clientHeight;return[t,r,n]},nGe=function(e){var t=e.scrollLeft,r=e.scrollWidth,n=e.clientWidth;return[t,r,n]},Dbe=function(e,t){return e==="v"?eGe(t):tGe(t)},Obe=function(e,t){return e==="v"?rGe(t):nGe(t)},iGe=function(e,t){return e==="h"&&t==="rtl"?-1:1},Mbe=function(e,t,r,n,i){var a=iGe(e,window.getComputedStyle(t).direction),o=a*n,s=r.target,l=t.contains(s),u=!1,c=o>0,f=0,d=0;do{var p=Obe(e,s),h=p[0],m=p[1],g=p[2],A=m-g-a*h;(h||A)&&Dbe(e,s)&&(f+=A,d+=h),s instanceof ShadowRoot?s=s.host:s=s.parentNode}while(!l&&s!==document.body||l&&(t.contains(s)||t===s));return(c&&(i&&Math.abs(f)<1||!i&&o>f)||!c&&(i&&Math.abs(d)<1||!i&&-o>d))&&(u=!0),u};var o5=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},jbe=function(e){return[e.deltaX,e.deltaY]},Nbe=function(e){return e&&"current"in e?e.current:e},aGe=function(e,t){return e[0]===t[0]&&e[1]===t[1]},oGe=function(e){return` .block-interactivity-`.concat(e,` {pointer-events: none;} .allow-interactivity-`).concat(e,` {pointer-events: all;} -`)},sGe=0,t2=[];function Tbe(e){var t=ja.useRef([]),r=ja.useRef([0,0]),n=ja.useRef(),i=ja.useState(sGe++)[0],a=ja.useState(EC)[0],o=ja.useRef(e);ja.useEffect(function(){o.current=e},[e]),ja.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(i));var m=kt([e.lockRef.current],(e.shards||[]).map(Nbe),!0).filter(Boolean);return m.forEach(function(g){return g.classList.add("allow-interactivity-".concat(i))}),function(){document.body.classList.remove("block-interactivity-".concat(i)),m.forEach(function(g){return g.classList.remove("allow-interactivity-".concat(i))})}}},[e.inert,e.lockRef.current,e.shards]);var s=ja.useCallback(function(m,g){if("touches"in m&&m.touches.length===2)return!o.current.allowPinchZoom;var A=o5(m),b=r.current,v="deltaX"in m?m.deltaX:b[0]-A[0],x="deltaY"in m?m.deltaY:b[1]-A[1],w,S=m.target,k=Math.abs(v)>Math.abs(x)?"h":"v";if("touches"in m&&k==="h"&&S.type==="range")return!1;var j=dG(k,S);if(!j)return!0;if(j?w=k:(w=k==="v"?"h":"v",j=dG(k,S)),!j)return!1;if(!n.current&&"changedTouches"in m&&(v||x)&&(n.current=w),!w)return!0;var O=n.current||w;return Mbe(O,g,m,O==="h"?v:x,!0)},[]),l=ja.useCallback(function(m){var g=m;if(!(!t2.length||t2[t2.length-1]!==a)){var A="deltaY"in g?jbe(g):o5(g),b=t.current.filter(function(w){return w.name===g.type&&(w.target===g.target||g.target===w.shadowParent)&&aGe(w.delta,A)})[0];if(b&&b.should){g.cancelable&&g.preventDefault();return}if(!b){var v=(o.current.shards||[]).map(Nbe).filter(Boolean).filter(function(w){return w.contains(g.target)}),x=v.length>0?s(g,v[0]):!o.current.noIsolation;x&&g.cancelable&&g.preventDefault()}}},[]),u=ja.useCallback(function(m,g,A,b){var v={name:m,delta:g,target:A,should:b,shadowParent:lGe(A)};t.current.push(v),setTimeout(function(){t.current=t.current.filter(function(x){return x!==v})},1)},[]),c=ja.useCallback(function(m){r.current=o5(m),n.current=void 0},[]),f=ja.useCallback(function(m){u(m.type,jbe(m),m.target,s(m,e.lockRef.current))},[]),d=ja.useCallback(function(m){u(m.type,o5(m),m.target,s(m,e.lockRef.current))},[]);ja.useEffect(function(){return t2.push(a),e.setCallbacks({onScrollCapture:f,onWheelCapture:f,onTouchMoveCapture:d}),document.addEventListener("wheel",l,Iy),document.addEventListener("touchmove",l,Iy),document.addEventListener("touchstart",c,Iy),function(){t2=t2.filter(function(m){return m!==a}),document.removeEventListener("wheel",l,Iy),document.removeEventListener("touchmove",l,Iy),document.removeEventListener("touchstart",c,Iy)}},[]);var p=e.removeScrollBar,h=e.inert;return ja.createElement(ja.Fragment,null,h?ja.createElement(a,{styles:oGe(i)}):null,p?ja.createElement(cG,{gapMode:e.gapMode}):null)}function lGe(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}var Fbe=iG(a5,Tbe);var _be=s5.forwardRef(function(e,t){return s5.createElement(SC,ji({},e,{ref:t,sideCar:Fbe}))});_be.classNames=SC.classNames;var pG=_be;var uGe=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},r2=new WeakMap,l5=new WeakMap,u5={},mG=0,Pbe=function(e){return e&&(e.host||Pbe(e.parentNode))},cGe=function(e,t){return t.map(function(r){if(e.contains(r))return r;var n=Pbe(r);return n&&e.contains(n)?n:(console.error("aria-hidden",r,"in not contained inside",e,". Doing nothing"),null)}).filter(function(r){return Boolean(r)})},fGe=function(e,t,r,n){var i=cGe(t,Array.isArray(e)?e:[e]);u5[r]||(u5[r]=new WeakMap);var a=u5[r],o=[],s=new Set,l=new Set(i),u=function(f){!f||s.has(f)||(s.add(f),u(f.parentNode))};i.forEach(u);var c=function(f){!f||l.has(f)||Array.prototype.forEach.call(f.children,function(d){if(s.has(d))c(d);else try{var p=d.getAttribute(n),h=p!==null&&p!=="false",m=(r2.get(d)||0)+1,g=(a.get(d)||0)+1;r2.set(d,m),a.set(d,g),o.push(d),m===1&&h&&l5.set(d,!0),g===1&&d.setAttribute(r,"true"),h||d.setAttribute(n,"true")}catch(A){console.error("aria-hidden: cannot operate on ",d,A)}})};return c(t),s.clear(),mG++,function(){o.forEach(function(f){var d=r2.get(f)-1,p=a.get(f)-1;r2.set(f,d),a.set(f,p),d||(l5.has(f)||f.removeAttribute(n),l5.delete(f)),p||f.removeAttribute(r)}),mG--,mG||(r2=new WeakMap,r2=new WeakMap,l5=new WeakMap,u5={})}},Ibe=function(e,t,r){r===void 0&&(r="data-aria-hidden");var n=Array.from(Array.isArray(e)?e:[e]),i=t||uGe(e);return i?(n.push.apply(n,Array.from(i.querySelectorAll("[aria-live]"))),fGe(n,i,r,"aria-hidden")):function(){return null}};var $i=Ae(XA(),1),hG="Dialog",[Bbe,QZt]=Hye(hG),[dGe,Hp]=Bbe(hG),Rbe=e=>{let{__scopeDialog:t,children:r,open:n,defaultOpen:i,onOpenChange:a,modal:o=!0}=e,s=pa.useRef(null),l=pa.useRef(null),[u=!1,c]=Gye({prop:n,defaultProp:i,onChange:a});return(0,$i.jsx)(dGe,{scope:t,triggerRef:s,contentRef:l,contentId:e5(),titleId:e5(),descriptionId:e5(),open:u,onOpenChange:c,onOpenToggle:pa.useCallback(()=>c(f=>!f),[c]),modal:o,children:r})};Rbe.displayName=hG;var $be="DialogTrigger",qbe=pa.forwardRef((e,t)=>{let{__scopeDialog:r,...n}=e,i=Hp($be,r),a=Up(t,i.triggerRef);return(0,$i.jsx)(Cf.button,{type:"button","aria-haspopup":"dialog","aria-expanded":i.open,"aria-controls":i.contentId,"data-state":vG(i.open),...n,ref:a,onClick:ih(e.onClick,i.onOpenToggle)})});qbe.displayName=$be;var AG="DialogPortal",[pGe,Lbe]=Bbe(AG,{forceMount:void 0}),zbe=e=>{let{__scopeDialog:t,forceMount:r,children:n,container:i}=e,a=Hp(AG,t);return(0,$i.jsx)(pGe,{scope:t,forceMount:r,children:pa.Children.map(n,o=>(0,$i.jsx)(wC,{present:r||a.open,children:(0,$i.jsx)(KV,{asChild:!0,container:i,children:o})}))})};zbe.displayName=AG;var c5="DialogOverlay",Ube=pa.forwardRef((e,t)=>{let r=Lbe(c5,e.__scopeDialog),{forceMount:n=r.forceMount,...i}=e,a=Hp(c5,e.__scopeDialog);return a.modal?(0,$i.jsx)(wC,{present:n||a.open,children:(0,$i.jsx)(mGe,{...i,ref:t})}):null});Ube.displayName=c5;var mGe=pa.forwardRef((e,t)=>{let{__scopeDialog:r,...n}=e,i=Hp(c5,r);return(0,$i.jsx)(pG,{as:xC,allowPinchZoom:!0,shards:[i.contentRef],children:(0,$i.jsx)(Cf.div,{"data-state":vG(i.open),...n,ref:t,style:{pointerEvents:"auto",...n.style}})})}),By="DialogContent",Wbe=pa.forwardRef((e,t)=>{let r=Lbe(By,e.__scopeDialog),{forceMount:n=r.forceMount,...i}=e,a=Hp(By,e.__scopeDialog);return(0,$i.jsx)(wC,{present:n||a.open,children:a.modal?(0,$i.jsx)(hGe,{...i,ref:t}):(0,$i.jsx)(AGe,{...i,ref:t})})});Wbe.displayName=By;var hGe=pa.forwardRef((e,t)=>{let r=Hp(By,e.__scopeDialog),n=pa.useRef(null),i=Up(t,r.contentRef,n);return pa.useEffect(()=>{let a=n.current;if(a)return Ibe(a)},[]),(0,$i.jsx)(Hbe,{...e,ref:i,trapFocus:r.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:ih(e.onCloseAutoFocus,a=>{a.preventDefault(),r.triggerRef.current?.focus()}),onPointerDownOutside:ih(e.onPointerDownOutside,a=>{let o=a.detail.originalEvent,s=o.button===0&&o.ctrlKey===!0;(o.button===2||s)&&a.preventDefault()}),onFocusOutside:ih(e.onFocusOutside,a=>a.preventDefault())})}),AGe=pa.forwardRef((e,t)=>{let r=Hp(By,e.__scopeDialog),n=pa.useRef(!1),i=pa.useRef(!1);return(0,$i.jsx)(Hbe,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:a=>{e.onCloseAutoFocus?.(a),a.defaultPrevented||(n.current||r.triggerRef.current?.focus(),a.preventDefault()),n.current=!1,i.current=!1},onInteractOutside:a=>{e.onInteractOutside?.(a),a.defaultPrevented||(n.current=!0,a.detail.originalEvent.type==="pointerdown"&&(i.current=!0));let o=a.target;r.triggerRef.current?.contains(o)&&a.preventDefault(),a.detail.originalEvent.type==="focusin"&&i.current&&a.preventDefault()}})}),Hbe=pa.forwardRef((e,t)=>{let{__scopeDialog:r,trapFocus:n,onOpenAutoFocus:i,onCloseAutoFocus:a,...o}=e,s=Hp(By,r),l=pa.useRef(null),u=Up(t,l);return Abe(),(0,$i.jsxs)($i.Fragment,{children:[(0,$i.jsx)(XV,{asChild:!0,loop:!0,trapped:n,onMountAutoFocus:i,onUnmountAutoFocus:a,children:(0,$i.jsx)(QV,{role:"dialog",id:s.contentId,"aria-describedby":s.descriptionId,"aria-labelledby":s.titleId,"data-state":vG(s.open),...o,ref:u,onDismiss:()=>s.onOpenChange(!1)})}),(0,$i.jsxs)($i.Fragment,{children:[(0,$i.jsx)(gGe,{titleId:s.titleId}),(0,$i.jsx)(yGe,{contentRef:l,descriptionId:s.descriptionId})]})]})}),gG="DialogTitle",Vbe=pa.forwardRef((e,t)=>{let{__scopeDialog:r,...n}=e,i=Hp(gG,r);return(0,$i.jsx)(Cf.h2,{id:i.titleId,...n,ref:t})});Vbe.displayName=gG;var Gbe="DialogDescription",Qbe=pa.forwardRef((e,t)=>{let{__scopeDialog:r,...n}=e,i=Hp(Gbe,r);return(0,$i.jsx)(Cf.p,{id:i.descriptionId,...n,ref:t})});Qbe.displayName=Gbe;var Ybe="DialogClose",Zbe=pa.forwardRef((e,t)=>{let{__scopeDialog:r,...n}=e,i=Hp(Ybe,r);return(0,$i.jsx)(Cf.button,{type:"button",...n,ref:t,onClick:ih(e.onClick,()=>i.onOpenChange(!1))})});Zbe.displayName=Ybe;function vG(e){return e?"open":"closed"}var Xbe="DialogTitleWarning",[YZt,Kbe]=Wye(Xbe,{contentName:By,titleName:gG,docsSlug:"dialog"}),gGe=({titleId:e})=>{let t=Kbe(Xbe),r=`\`${t.contentName}\` requires a \`${t.titleName}\` for the component to be accessible for screen reader users. +`)},sGe=0,t2=[];function Tbe(e){var t=ja.useRef([]),r=ja.useRef([0,0]),n=ja.useRef(),i=ja.useState(sGe++)[0],a=ja.useState(EC)[0],o=ja.useRef(e);ja.useEffect(function(){o.current=e},[e]),ja.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(i));var m=kt([e.lockRef.current],(e.shards||[]).map(Nbe),!0).filter(Boolean);return m.forEach(function(g){return g.classList.add("allow-interactivity-".concat(i))}),function(){document.body.classList.remove("block-interactivity-".concat(i)),m.forEach(function(g){return g.classList.remove("allow-interactivity-".concat(i))})}}},[e.inert,e.lockRef.current,e.shards]);var s=ja.useCallback(function(m,g){if("touches"in m&&m.touches.length===2)return!o.current.allowPinchZoom;var A=o5(m),b=r.current,v="deltaX"in m?m.deltaX:b[0]-A[0],x="deltaY"in m?m.deltaY:b[1]-A[1],w,S=m.target,k=Math.abs(v)>Math.abs(x)?"h":"v";if("touches"in m&&k==="h"&&S.type==="range")return!1;var j=dG(k,S);if(!j)return!0;if(j?w=k:(w=k==="v"?"h":"v",j=dG(k,S)),!j)return!1;if(!n.current&&"changedTouches"in m&&(v||x)&&(n.current=w),!w)return!0;var O=n.current||w;return Mbe(O,g,m,O==="h"?v:x,!0)},[]),l=ja.useCallback(function(m){var g=m;if(!(!t2.length||t2[t2.length-1]!==a)){var A="deltaY"in g?jbe(g):o5(g),b=t.current.filter(function(w){return w.name===g.type&&(w.target===g.target||g.target===w.shadowParent)&&aGe(w.delta,A)})[0];if(b&&b.should){g.cancelable&&g.preventDefault();return}if(!b){var v=(o.current.shards||[]).map(Nbe).filter(Boolean).filter(function(w){return w.contains(g.target)}),x=v.length>0?s(g,v[0]):!o.current.noIsolation;x&&g.cancelable&&g.preventDefault()}}},[]),u=ja.useCallback(function(m,g,A,b){var v={name:m,delta:g,target:A,should:b,shadowParent:lGe(A)};t.current.push(v),setTimeout(function(){t.current=t.current.filter(function(x){return x!==v})},1)},[]),c=ja.useCallback(function(m){r.current=o5(m),n.current=void 0},[]),f=ja.useCallback(function(m){u(m.type,jbe(m),m.target,s(m,e.lockRef.current))},[]),d=ja.useCallback(function(m){u(m.type,o5(m),m.target,s(m,e.lockRef.current))},[]);ja.useEffect(function(){return t2.push(a),e.setCallbacks({onScrollCapture:f,onWheelCapture:f,onTouchMoveCapture:d}),document.addEventListener("wheel",l,Iy),document.addEventListener("touchmove",l,Iy),document.addEventListener("touchstart",c,Iy),function(){t2=t2.filter(function(m){return m!==a}),document.removeEventListener("wheel",l,Iy),document.removeEventListener("touchmove",l,Iy),document.removeEventListener("touchstart",c,Iy)}},[]);var p=e.removeScrollBar,h=e.inert;return ja.createElement(ja.Fragment,null,h?ja.createElement(a,{styles:oGe(i)}):null,p?ja.createElement(cG,{gapMode:e.gapMode}):null)}function lGe(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}var Fbe=iG(a5,Tbe);var _be=s5.forwardRef(function(e,t){return s5.createElement(SC,ji({},e,{ref:t,sideCar:Fbe}))});_be.classNames=SC.classNames;var pG=_be;var uGe=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},r2=new WeakMap,l5=new WeakMap,u5={},mG=0,Pbe=function(e){return e&&(e.host||Pbe(e.parentNode))},cGe=function(e,t){return t.map(function(r){if(e.contains(r))return r;var n=Pbe(r);return n&&e.contains(n)?n:(console.error("aria-hidden",r,"in not contained inside",e,". Doing nothing"),null)}).filter(function(r){return Boolean(r)})},fGe=function(e,t,r,n){var i=cGe(t,Array.isArray(e)?e:[e]);u5[r]||(u5[r]=new WeakMap);var a=u5[r],o=[],s=new Set,l=new Set(i),u=function(f){!f||s.has(f)||(s.add(f),u(f.parentNode))};i.forEach(u);var c=function(f){!f||l.has(f)||Array.prototype.forEach.call(f.children,function(d){if(s.has(d))c(d);else try{var p=d.getAttribute(n),h=p!==null&&p!=="false",m=(r2.get(d)||0)+1,g=(a.get(d)||0)+1;r2.set(d,m),a.set(d,g),o.push(d),m===1&&h&&l5.set(d,!0),g===1&&d.setAttribute(r,"true"),h||d.setAttribute(n,"true")}catch(A){console.error("aria-hidden: cannot operate on ",d,A)}})};return c(t),s.clear(),mG++,function(){o.forEach(function(f){var d=r2.get(f)-1,p=a.get(f)-1;r2.set(f,d),a.set(f,p),d||(l5.has(f)||f.removeAttribute(n),l5.delete(f)),p||f.removeAttribute(r)}),mG--,mG||(r2=new WeakMap,r2=new WeakMap,l5=new WeakMap,u5={})}},Ibe=function(e,t,r){r===void 0&&(r="data-aria-hidden");var n=Array.from(Array.isArray(e)?e:[e]),i=t||uGe(e);return i?(n.push.apply(n,Array.from(i.querySelectorAll("[aria-live]"))),fGe(n,i,r,"aria-hidden")):function(){return null}};var $i=Ae(XA(),1),hG="Dialog",[Bbe,QZt]=Hye(hG),[dGe,Vp]=Bbe(hG),Rbe=e=>{let{__scopeDialog:t,children:r,open:n,defaultOpen:i,onOpenChange:a,modal:o=!0}=e,s=pa.useRef(null),l=pa.useRef(null),[u=!1,c]=Gye({prop:n,defaultProp:i,onChange:a});return(0,$i.jsx)(dGe,{scope:t,triggerRef:s,contentRef:l,contentId:e5(),titleId:e5(),descriptionId:e5(),open:u,onOpenChange:c,onOpenToggle:pa.useCallback(()=>c(f=>!f),[c]),modal:o,children:r})};Rbe.displayName=hG;var $be="DialogTrigger",qbe=pa.forwardRef((e,t)=>{let{__scopeDialog:r,...n}=e,i=Vp($be,r),a=Wp(t,i.triggerRef);return(0,$i.jsx)(Cf.button,{type:"button","aria-haspopup":"dialog","aria-expanded":i.open,"aria-controls":i.contentId,"data-state":vG(i.open),...n,ref:a,onClick:ih(e.onClick,i.onOpenToggle)})});qbe.displayName=$be;var AG="DialogPortal",[pGe,Lbe]=Bbe(AG,{forceMount:void 0}),zbe=e=>{let{__scopeDialog:t,forceMount:r,children:n,container:i}=e,a=Vp(AG,t);return(0,$i.jsx)(pGe,{scope:t,forceMount:r,children:pa.Children.map(n,o=>(0,$i.jsx)(wC,{present:r||a.open,children:(0,$i.jsx)(KV,{asChild:!0,container:i,children:o})}))})};zbe.displayName=AG;var c5="DialogOverlay",Ube=pa.forwardRef((e,t)=>{let r=Lbe(c5,e.__scopeDialog),{forceMount:n=r.forceMount,...i}=e,a=Vp(c5,e.__scopeDialog);return a.modal?(0,$i.jsx)(wC,{present:n||a.open,children:(0,$i.jsx)(mGe,{...i,ref:t})}):null});Ube.displayName=c5;var mGe=pa.forwardRef((e,t)=>{let{__scopeDialog:r,...n}=e,i=Vp(c5,r);return(0,$i.jsx)(pG,{as:xC,allowPinchZoom:!0,shards:[i.contentRef],children:(0,$i.jsx)(Cf.div,{"data-state":vG(i.open),...n,ref:t,style:{pointerEvents:"auto",...n.style}})})}),By="DialogContent",Wbe=pa.forwardRef((e,t)=>{let r=Lbe(By,e.__scopeDialog),{forceMount:n=r.forceMount,...i}=e,a=Vp(By,e.__scopeDialog);return(0,$i.jsx)(wC,{present:n||a.open,children:a.modal?(0,$i.jsx)(hGe,{...i,ref:t}):(0,$i.jsx)(AGe,{...i,ref:t})})});Wbe.displayName=By;var hGe=pa.forwardRef((e,t)=>{let r=Vp(By,e.__scopeDialog),n=pa.useRef(null),i=Wp(t,r.contentRef,n);return pa.useEffect(()=>{let a=n.current;if(a)return Ibe(a)},[]),(0,$i.jsx)(Hbe,{...e,ref:i,trapFocus:r.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:ih(e.onCloseAutoFocus,a=>{a.preventDefault(),r.triggerRef.current?.focus()}),onPointerDownOutside:ih(e.onPointerDownOutside,a=>{let o=a.detail.originalEvent,s=o.button===0&&o.ctrlKey===!0;(o.button===2||s)&&a.preventDefault()}),onFocusOutside:ih(e.onFocusOutside,a=>a.preventDefault())})}),AGe=pa.forwardRef((e,t)=>{let r=Vp(By,e.__scopeDialog),n=pa.useRef(!1),i=pa.useRef(!1);return(0,$i.jsx)(Hbe,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:a=>{e.onCloseAutoFocus?.(a),a.defaultPrevented||(n.current||r.triggerRef.current?.focus(),a.preventDefault()),n.current=!1,i.current=!1},onInteractOutside:a=>{e.onInteractOutside?.(a),a.defaultPrevented||(n.current=!0,a.detail.originalEvent.type==="pointerdown"&&(i.current=!0));let o=a.target;r.triggerRef.current?.contains(o)&&a.preventDefault(),a.detail.originalEvent.type==="focusin"&&i.current&&a.preventDefault()}})}),Hbe=pa.forwardRef((e,t)=>{let{__scopeDialog:r,trapFocus:n,onOpenAutoFocus:i,onCloseAutoFocus:a,...o}=e,s=Vp(By,r),l=pa.useRef(null),u=Wp(t,l);return Abe(),(0,$i.jsxs)($i.Fragment,{children:[(0,$i.jsx)(XV,{asChild:!0,loop:!0,trapped:n,onMountAutoFocus:i,onUnmountAutoFocus:a,children:(0,$i.jsx)(QV,{role:"dialog",id:s.contentId,"aria-describedby":s.descriptionId,"aria-labelledby":s.titleId,"data-state":vG(s.open),...o,ref:u,onDismiss:()=>s.onOpenChange(!1)})}),(0,$i.jsxs)($i.Fragment,{children:[(0,$i.jsx)(gGe,{titleId:s.titleId}),(0,$i.jsx)(yGe,{contentRef:l,descriptionId:s.descriptionId})]})]})}),gG="DialogTitle",Vbe=pa.forwardRef((e,t)=>{let{__scopeDialog:r,...n}=e,i=Vp(gG,r);return(0,$i.jsx)(Cf.h2,{id:i.titleId,...n,ref:t})});Vbe.displayName=gG;var Gbe="DialogDescription",Qbe=pa.forwardRef((e,t)=>{let{__scopeDialog:r,...n}=e,i=Vp(Gbe,r);return(0,$i.jsx)(Cf.p,{id:i.descriptionId,...n,ref:t})});Qbe.displayName=Gbe;var Ybe="DialogClose",Zbe=pa.forwardRef((e,t)=>{let{__scopeDialog:r,...n}=e,i=Vp(Ybe,r);return(0,$i.jsx)(Cf.button,{type:"button",...n,ref:t,onClick:ih(e.onClick,()=>i.onOpenChange(!1))})});Zbe.displayName=Ybe;function vG(e){return e?"open":"closed"}var Xbe="DialogTitleWarning",[YZt,Kbe]=Wye(Xbe,{contentName:By,titleName:gG,docsSlug:"dialog"}),gGe=({titleId:e})=>{let t=Kbe(Xbe),r=`\`${t.contentName}\` requires a \`${t.titleName}\` for the component to be accessible for screen reader users. If you want to hide the \`${t.titleName}\`, you can wrap it with our VisuallyHidden component. -For more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return pa.useEffect(()=>{e&&(document.getElementById(e)||console.error(r))},[r,e]),null},vGe="DialogDescriptionWarning",yGe=({contentRef:e,descriptionId:t})=>{let n=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${Kbe(vGe).contentName}}.`;return pa.useEffect(()=>{let i=e.current?.getAttribute("aria-describedby");t&&i&&(document.getElementById(t)||console.warn(n))},[n,e,t]),null},Jbe=Rbe,exe=qbe,txe=zbe,rxe=Ube,nxe=Wbe,ixe=Vbe,axe=Qbe,oxe=Zbe;var cxe=Ae(Te(),1),Lt=Ae(Te(),1);function xGe(e){if(!e||typeof document>"u")return;let t=document.head||document.getElementsByTagName("head")[0],r=document.createElement("style");r.type="text/css",t.appendChild(r),r.styleSheet?r.styleSheet.cssText=e:r.appendChild(document.createTextNode(e))}var ii={DURATION:.5,EASE:[.32,.72,0,1]},fxe=.4,dxe=Lt.default.createContext({drawerRef:{current:null},overlayRef:{current:null},scaleBackground:()=>{},onPress:()=>{},onRelease:()=>{},onDrag:()=>{},onNestedDrag:()=>{},onNestedOpenChange:()=>{},onNestedRelease:()=>{},openProp:void 0,dismissible:!1,handleOnly:!1,isOpen:!1,isDragging:!1,keyboardIsOpen:{current:!1},snapPointsOffset:null,snapPoints:null,modal:!1,shouldFade:!1,activeSnapPoint:null,onOpenChange:()=>{},setActiveSnapPoint:()=>{},visible:!1,closeDrawer:()=>{},setVisible:()=>{},direction:"bottom"}),m5=()=>{let e=Lt.default.useContext(dxe);if(!e)throw new Error("useDrawerContext must be used within a Drawer.Root");return e};function Ti(e,t,r,n=!1){if(!t||!(t instanceof HTMLElement))return;let i={};Object.entries(r).forEach(([a,o])=>{if(a.startsWith("--")){t.style.setProperty(a,o);return}i[a]=t.style[a],t.style[a]=o}),!n&&e.set(t,i)}function Ry(e,t,r){if(!t||!(t instanceof HTMLElement))return;let n=e.get(t);!n||(r?t.style[r]=n[r]:Object.entries(n).forEach(([i,a])=>{t.style[i]=a}))}var io=e=>{switch(e){case"top":case"bottom":return!0;case"left":case"right":return!1;default:return e}};function f5(e,t){if(!e)return null;let r=window.getComputedStyle(e),n=r.transform||r.webkitTransform||r.mozTransform,i=n.match(/^matrix3d\((.+)\)$/);return i?parseFloat(i[1].split(", ")[io(t)?13:12]):(i=n.match(/^matrix\((.+)\)$/),i?parseFloat(i[1].split(", ")[io(t)?5:4]):null)}function wGe(e){return 8*(Math.log(e+1)-2)}xGe("[vaul-drawer]{touch-action:none;will-change:transform;transition:transform .5s cubic-bezier(.32, .72, 0, 1)}[vaul-drawer][vaul-drawer-direction=bottom]{transform:translate3d(0,100%,0)}[vaul-drawer][vaul-drawer-direction=top]{transform:translate3d(0,-100%,0)}[vaul-drawer][vaul-drawer-direction=left]{transform:translate3d(-100%,0,0)}[vaul-drawer][vaul-drawer-direction=right]{transform:translate3d(100%,0,0)}.vaul-dragging .vaul-scrollable [vault-drawer-direction=top]{overflow-y:hidden!important}.vaul-dragging .vaul-scrollable [vault-drawer-direction=bottom]{overflow-y:hidden!important}.vaul-dragging .vaul-scrollable [vault-drawer-direction=left]{overflow-x:hidden!important}.vaul-dragging .vaul-scrollable [vault-drawer-direction=right]{overflow-x:hidden!important}[vaul-drawer][vaul-drawer-visible=true][vaul-drawer-direction=top]{transform:translate3d(0,var(--snap-point-height,0),0)}[vaul-drawer][vaul-drawer-visible=true][vaul-drawer-direction=bottom]{transform:translate3d(0,var(--snap-point-height,0),0)}[vaul-drawer][vaul-drawer-visible=true][vaul-drawer-direction=left]{transform:translate3d(var(--snap-point-height,0),0,0)}[vaul-drawer][vaul-drawer-visible=true][vaul-drawer-direction=right]{transform:translate3d(var(--snap-point-height,0),0,0)}[vaul-overlay]{opacity:0;transition:opacity .5s cubic-bezier(.32, .72, 0, 1)}[vaul-overlay][vaul-drawer-visible=true]{opacity:1}[vaul-drawer]::after{content:'';position:absolute;background:inherit;background-color:inherit}[vaul-drawer][vaul-drawer-direction=top]::after{top:initial;bottom:100%;left:0;right:0;height:200%}[vaul-drawer][vaul-drawer-direction=bottom]::after{top:100%;bottom:initial;left:0;right:0;height:200%}[vaul-drawer][vaul-drawer-direction=left]::after{left:initial;right:100%;top:0;bottom:0;width:200%}[vaul-drawer][vaul-drawer-direction=right]::after{left:100%;right:initial;top:0;bottom:0;width:200%}[vaul-handle]{display:block;position:relative;opacity:.8;margin-left:auto;margin-right:auto;height:5px;width:56px;border-radius:1rem;touch-action:pan-y;cursor:grab}[vaul-handle]:active,[vaul-handle]:hover{opacity:1}[vaul-handle]:active{cursor:grabbing}[vaul-handle-hitarea]{position:absolute;left:50%;top:50%;transform:translate(-50%,-50%);width:max(100%,2.75rem);height:max(100%,2.75rem);touch-action:inherit}[vaul-overlay][vaul-snap-points=true]:not([vaul-snap-points-overlay=true]):not([data-state=closed]){opacity:0}[vaul-overlay][vaul-snap-points-overlay=true]:not([vaul-drawer-visible=false]){opacity:1}@media (hover:hover) and (pointer:fine){[vaul-drawer]{user-select:none}}@media (pointer:fine){[vaul-handle-hitarea]:{width:100%;height:100%}}");function SGe(e,t){typeof e=="function"?e(t):e!=null&&(e.current=t)}function EGe(...e){return t=>e.forEach(r=>SGe(r,t))}function pxe(...e){return cxe.useCallback(EGe(...e),e)}var CC=null;function kGe({isOpen:e,modal:t,nested:r,hasBeenOpened:n,preventScrollRestoration:i,noBodyStyles:a}){let[o,s]=Lt.default.useState(()=>typeof window<"u"?window.location.href:""),l=Lt.default.useRef(0),u=Lt.default.useCallback(()=>{if(CC===null&&e&&!a){CC={position:document.body.style.position,top:document.body.style.top,left:document.body.style.left,height:document.body.style.height,right:"unset"};let{scrollX:f,innerHeight:d}=window;document.body.style.setProperty("position","fixed","important"),Object.assign(document.body.style,{top:`${-l.current}px`,left:`${-f}px`,right:"0px",height:"auto"}),window.setTimeout(()=>window.requestAnimationFrame(()=>{let p=d-window.innerHeight;p&&l.current>=d&&(document.body.style.top=`${-(l.current+p)}px`)}),300)}},[e]),c=Lt.default.useCallback(()=>{if(CC!==null&&!a){let f=-parseInt(document.body.style.top,10),d=-parseInt(document.body.style.left,10);Object.assign(document.body.style,CC),window.requestAnimationFrame(()=>{if(i&&o!==window.location.href){s(window.location.href);return}window.scrollTo(d,f)}),CC=null}},[o]);return Lt.default.useEffect(()=>{function f(){l.current=window.scrollY}return f(),window.addEventListener("scroll",f),()=>{window.removeEventListener("scroll",f)}},[]),Lt.default.useEffect(()=>{r||!n||(e?(!window.matchMedia("(display-mode: standalone)").matches&&u(),t||window.setTimeout(()=>{c()},500)):c())},[e,n,o,t,r,u,c]),{restorePositionSetting:c}}var CGe=typeof window<"u"?Lt.useLayoutEffect:Lt.useEffect;function wG(...e){return(...t)=>{for(let r of e)typeof r=="function"&&r(...t)}}function DGe(){return EG(/^Mac/)}function OGe(){return EG(/^iPhone/)}function MGe(){return EG(/^iPad/)||DGe()&&navigator.maxTouchPoints>1}function mxe(){return OGe()||MGe()}function EG(e){return typeof window<"u"&&window.navigator!=null?e.test(window.navigator.platform):void 0}var yG=typeof document<"u"&&window.visualViewport;function sxe(e){let t=window.getComputedStyle(e);return/(auto|scroll)/.test(t.overflow+t.overflowX+t.overflowY)}function hxe(e){for(sxe(e)&&(e=e.parentElement);e&&!sxe(e);)e=e.parentElement;return e||document.scrollingElement||document.documentElement}var jGe=new Set(["checkbox","radio","range","color","file","image","button","submit","reset"]),d5=0,bG;function NGe(e={}){let{isDisabled:t}=e;CGe(()=>{if(!t)return d5++,d5===1&&(mxe()?bG=FGe():bG=TGe()),()=>{d5--,d5===0&&bG()}},[t])}function TGe(){return wG(Axe(document.documentElement,"paddingRight",`${window.innerWidth-document.documentElement.clientWidth}px`))}function FGe(){let e,t=0,r=f=>{e=hxe(f.target),!(e===document.documentElement&&e===document.body)&&(t=f.changedTouches[0].pageY)},n=f=>{if(!e||e===document.documentElement||e===document.body){f.preventDefault();return}let d=f.changedTouches[0].pageY,p=e.scrollTop,h=e.scrollHeight-e.clientHeight;h!==0&&((p<=0&&d>t||p>=h&&d{let d=f.target;SG(d)&&d!==document.activeElement&&(f.preventDefault(),d.style.transform="translateY(-2000px)",d.focus(),requestAnimationFrame(()=>{d.style.transform=""}))},a=f=>{let d=f.target;SG(d)&&(d.style.transform="translateY(-2000px)",requestAnimationFrame(()=>{d.style.transform="",yG&&(yG.height{lxe(d)}):yG.addEventListener("resize",()=>lxe(d),{once:!0}))}))},o=()=>{window.scrollTo(0,0)},s=window.pageXOffset,l=window.pageYOffset,u=wG(Axe(document.documentElement,"paddingRight",`${window.innerWidth-document.documentElement.clientWidth}px`));window.scrollTo(0,0);let c=wG(DC(document,"touchstart",r,{passive:!1,capture:!0}),DC(document,"touchmove",n,{passive:!1,capture:!0}),DC(document,"touchend",i,{passive:!1,capture:!0}),DC(document,"focus",a,!0),DC(window,"scroll",o));return()=>{u(),c(),window.scrollTo(s,l)}}function Axe(e,t,r){let n=e.style[t];return e.style[t]=r,()=>{e.style[t]=n}}function DC(e,t,r,n){return e.addEventListener(t,r,n),()=>{e.removeEventListener(t,r,n)}}function lxe(e){let t=document.scrollingElement||document.documentElement;for(;e&&e!==t;){let r=hxe(e);if(r!==document.documentElement&&r!==document.body&&r!==e){let n=r.getBoundingClientRect().top,i=e.getBoundingClientRect().top,a=e.getBoundingClientRect().bottom,o=r.getBoundingClientRect().bottom;a>o&&(r.scrollTop+=i-n)}e=r.parentElement}}function SG(e){return e instanceof HTMLInputElement&&!jGe.has(e.type)||e instanceof HTMLTextAreaElement||e instanceof HTMLElement&&e.isContentEditable}function gxe(e){let t=Lt.default.useRef(e);return Lt.default.useEffect(()=>{t.current=e}),Lt.default.useMemo(()=>(...r)=>t.current==null?void 0:t.current.call(t,...r),[])}function _Ge({defaultProp:e,onChange:t}){let r=Lt.default.useState(e),[n]=r,i=Lt.default.useRef(n),a=gxe(t);return Lt.default.useEffect(()=>{i.current!==n&&(a(n),i.current=n)},[n,i,a]),r}function PGe({prop:e,defaultProp:t,onChange:r=()=>{}}){let[n,i]=_Ge({defaultProp:t,onChange:r}),a=e!==void 0,o=a?e:n,s=gxe(r),l=Lt.default.useCallback(u=>{if(a){let f=typeof u=="function"?u(e):u;f!==e&&s(f)}else i(u)},[a,e,i,s]);return[o,l]}function IGe({activeSnapPointProp:e,setActiveSnapPointProp:t,snapPoints:r,drawerRef:n,overlayRef:i,cacheRef:a,fadeFromIndex:o,onSnapPointChange:s,direction:l="bottom"}){let[u,c]=PGe({prop:e,defaultProp:r?.[0],onChange:t}),f=Lt.default.useMemo(()=>u===r?.[r.length-1]||null,[r,u]),d=r&&r.length>0&&(o||o===0)&&!Number.isNaN(o)&&r[o]===u||!r,p=Lt.default.useMemo(()=>r?.findIndex(x=>x===u),[r,u]),h=Lt.default.useMemo(()=>{var x;return(x=r?.map(w=>{let S=typeof window<"u",k=typeof w=="string",j=0;if(k&&(j=parseInt(w,10)),io(l)){let C=k?j:S?w*window.innerHeight:0;return S?l==="bottom"?window.innerHeight-C:-window.innerHeight+C:C}let O=k?j:S?w*window.innerWidth:0;return S?l==="right"?window.innerWidth-O:-window.innerWidth+O:O}))!=null?x:[]},[r]),m=Lt.default.useMemo(()=>p!==null?h?.[p]:null,[h,p]),g=Lt.default.useCallback(x=>{var w;let S=(w=h?.findIndex(k=>k===x))!=null?w:null;s(S),Ti(a.current,n.current,{transition:`transform ${ii.DURATION}s cubic-bezier(${ii.EASE.join(",")})`,transform:io(l)?`translate3d(0, ${x}px, 0)`:`translate3d(${x}px, 0, 0)`}),h&&S!==h.length-1&&S!==o?Ti(a.current,i.current,{transition:`opacity ${ii.DURATION}s cubic-bezier(${ii.EASE.join(",")})`,opacity:"0"}):Ti(a.current,i.current,{transition:`opacity ${ii.DURATION}s cubic-bezier(${ii.EASE.join(",")})`,opacity:"1"}),c(S!==null?r?.[S]:null)},[n.current,r,h,o,i,c]);Lt.default.useEffect(()=>{if(u||e){var x;let w=(x=r?.findIndex(S=>S===e||S===u))!=null?x:-1;h&&w!==-1&&typeof h[w]=="number"&&g(h[w])}},[u,e,r,h,g]);function A({draggedDistance:x,closeDrawer:w,velocity:S,dismissible:k}){if(o===void 0)return;let j=l==="bottom"||l==="right"?(m??0)-x:(m??0)+x,O=p===o-1,C=p===0,N=x>0;if(O&&Ti(a.current,i.current,{transition:`opacity ${ii.DURATION}s cubic-bezier(${ii.EASE.join(",")})`}),S>2&&!N){k?w():g(h[0]);return}if(S>2&&N&&h&&r){g(h[r.length-1]);return}let D=h?.reduce((q,z)=>typeof q!="number"||typeof z!="number"?q:Math.abs(z-j)fxe&&Math.abs(x)0&&f){g(h[r.length-1]);return}if(C&&q<0&&k&&w(),p===null)return;g(h[p+q]);return}g(D)}function b({draggedDistance:x}){if(m===null)return;let w=l==="bottom"||l==="right"?m-x:m+x;(l==="bottom"||l==="right")&&wh[h.length-1]||Ti(a.current,n.current,{transform:io(l)?`translate3d(0, ${w}px, 0)`:`translate3d(${w}px, 0, 0)`})}function v(x,w){if(!r||typeof p!="number"||!h||o===void 0)return null;let S=p===o-1;if(p>=o&&w)return 0;if(S&&!w)return 1;if(!d&&!S)return null;let j=S?p+1:p-1,O=S?h[j]-h[j-1]:h[j+1]-h[j],C=x/Math.abs(O);return S?1-C:C}return{isLastSnapPoint:f,activeSnapPoint:u,shouldFade:d,getPercentageDragged:v,setActiveSnapPoint:c,activeSnapPointIndex:p,onRelease:A,onDrag:b,snapPointsOffset:h}}var BGe=.25,RGe=100,p5=8,$y=16,uxe=26,xG="vaul-dragging";function vxe({open:e,onOpenChange:t,children:r,shouldScaleBackground:n,onDrag:i,onRelease:a,snapPoints:o,nested:s=!1,setBackgroundColorOnScale:l=!0,closeThreshold:u=BGe,scrollLockTimeout:c=RGe,dismissible:f=!0,handleOnly:d=!1,fadeFromIndex:p=o&&o.length-1,activeSnapPoint:h,setActiveSnapPoint:m,fixed:g,modal:A=!0,onClose:b,noBodyStyles:v,direction:x="bottom",preventScrollRestoration:w=!0,disablePreventScroll:S=!1}){var k;let[j=!1,O]=Lt.default.useState(!1),[C,N]=Lt.default.useState(!1),[D,P]=Lt.default.useState(!1),[q,z]=Lt.default.useState(!1),[I,T]=Lt.default.useState(!1),[L,_]=Lt.default.useState(!1),Y=Lt.default.useRef(null),oe=Lt.default.useRef(null),te=Lt.default.useRef(null),Q=Lt.default.useRef(null),fe=Lt.default.useRef(null),Ie=Lt.default.useRef(!1),Se=Lt.default.useRef(null),Oe=Lt.default.useRef(0),ve=Lt.default.useRef(!1),ye=Lt.default.useRef(0),me=Lt.default.useRef(null),ke=Lt.default.useRef(((k=me.current)==null?void 0:k.getBoundingClientRect().height)||0),$=Lt.default.useRef(0),ae=(0,Lt.useRef)(null),ce=Lt.default.useCallback(Ge=>{o&&Ge===ie.length-1&&(oe.current=new Date)},[]),{activeSnapPoint:U,activeSnapPointIndex:R,setActiveSnapPoint:J,onRelease:ee,snapPointsOffset:ie,onDrag:re,shouldFade:Ee,getPercentageDragged:Ce}=IGe({snapPoints:o,cacheRef:ae,activeSnapPointProp:h,setActiveSnapPointProp:m,drawerRef:me,fadeFromIndex:p,overlayRef:Y,onSnapPointChange:ce,direction:x});NGe({isDisabled:!j||I||!A||L||!C||S});let{restorePositionSetting:_e}=kGe({isOpen:j,modal:A,nested:s,hasBeenOpened:C,preventScrollRestoration:w,noBodyStyles:v});function he(){return(window.innerWidth-uxe)/window.innerWidth}function ze(Ge){var G;!f&&!o||me.current&&!me.current.contains(Ge.target)||(ke.current=((G=me.current)==null?void 0:G.getBoundingClientRect().height)||0,T(!0),te.current=new Date,mxe()&&window.addEventListener("touchend",()=>Ie.current=!1,{once:!0}),Ge.target.setPointerCapture(Ge.pointerId),Oe.current=io(x)?Ge.clientY:Ge.clientX)}function Ye(Ge,G){var ue;let Pe=Ge,De=(ue=window.getSelection())==null?void 0:ue.toString(),at=me.current?f5(me.current,x):null,ht=new Date;if(Pe.hasAttribute("data-vaul-no-drag")||Pe.closest("[data-vaul-no-drag]"))return!1;if(x==="right"||x==="left")return!0;if(oe.current&&ht.getTime()-oe.current.getTime()<500)return!1;if(at!==null&&(x==="bottom"?at>0:at<0))return!0;if(De&&De.length>0)return!1;if(fe.current&&ht.getTime()-fe.current.getTime()Pe.clientHeight){if(Pe.scrollTop!==0)return fe.current=new Date,!1;if(Pe.getAttribute("role")==="dialog")return!0}Pe=Pe.parentNode}return!0}function tt(Ge){if(!!me.current&&I){let G=x==="bottom"||x==="right"?1:-1,ue=(Oe.current-(io(x)?Ge.clientY:Ge.clientX))*G,Pe=ue>0,De=o&&!f&&!Pe;if(De&&R===0)return;let at=Math.abs(ue),ht=document.querySelector("[vaul-drawer-wrapper]"),Zt=at/ke.current,Wr=Ce(at,Pe);if(Wr!==null&&(Zt=Wr),De&&Zt>=1||!Ie.current&&!Ye(Ge.target,Pe))return;if(me.current.classList.add(xG),Ie.current=!0,Ti(ae.current,me.current,{transition:"none"}),Ti(ae.current,Y.current,{transition:"none"}),o&&re({draggedDistance:ue}),Pe&&!o){let tn=wGe(ue),ci=Math.min(tn*-1,0)*G;Ti(ae.current,me.current,{transform:io(x)?`translate3d(0, ${ci}px, 0)`:`translate3d(${ci}px, 0, 0)`});return}let en=1-Zt;if((Ee||p&&R===p-1)&&(i?.(Ge,Zt),Ti(ae.current,Y.current,{opacity:`${en}`,transition:"none"},!0)),ht&&Y.current&&n){let tn=Math.min(he()+Zt*(1-he()),1),ci=8-Zt*8,ns=Math.max(0,14-Zt*14);document.querySelectorAll("[vaul-drawer]").forEach(Pa=>{Pa!==me.current&&Ti(ae.current,Pa,{borderRadius:`${ci}px`,transform:io(x)?`scale(${tn}) translate3d(0, ${ns}px, 0)`:`scale(${tn}) translate3d(${ns}px, 0, 0)`,transition:"none"},!0)}),Ti(ae.current,ht,{borderRadius:`${ci}px`,transform:io(x)?`scale(${tn}) translate3d(0, ${ns}px, 0)`:`scale(${tn}) translate3d(${ns}px, 0, 0)`,transition:"none"},!0)}if(!o){let tn=at*G;Ti(ae.current,me.current,{transform:io(x)?`translate3d(0, ${tn}px, 0)`:`translate3d(${tn}px, 0, 0)`})}}}Lt.default.useEffect(()=>()=>{Ze(!1),_e()},[]),Lt.default.useEffect(()=>{var Ge;function G(){if(!me.current)return;let ue=document.activeElement;if(SG(ue)||ve.current){var Pe;let De=((Pe=window.visualViewport)==null?void 0:Pe.height)||0,at=window.innerHeight-De,ht=me.current.getBoundingClientRect().height||0;$.current||($.current=ht);let Zt=me.current.getBoundingClientRect().top;if(Math.abs(ye.current-at)>60&&(ve.current=!ve.current),o&&o.length>0&&ie&&R&&(at+=ie[R]||0),ye.current=at,ht>De||ve.current){let Wr=me.current.getBoundingClientRect().height,en=Wr;Wr>De&&(en=De-uxe),g?me.current.style.height=`${Wr-Math.max(at,0)}px`:me.current.style.height=`${Math.max(en,De-Zt)}px`}else me.current.style.height=`${$.current}px`;o&&o.length>0&&!ve.current?me.current.style.bottom="0px":me.current.style.bottom=`${Math.max(at,0)}px`}}return(Ge=window.visualViewport)==null||Ge.addEventListener("resize",G),()=>{var ue;return(ue=window.visualViewport)==null?void 0:ue.removeEventListener("resize",G)}},[R,o,ie]);function Ct(){!me.current||(Be(),b?.(),Ti(ae.current,me.current,{transform:io(x)?`translate3d(0, ${x==="bottom"?"100%":"-100%"}, 0)`:`translate3d(${x==="right"?"100%":"-100%"}, 0, 0)`,transition:`transform ${ii.DURATION}s cubic-bezier(${ii.EASE.join(",")})`}),Ti(ae.current,Y.current,{opacity:"0",transition:`opacity ${ii.DURATION}s cubic-bezier(${ii.EASE.join(",")})`}),Ze(!1),setTimeout(()=>{P(!1),O(!1)},300),setTimeout(()=>{o&&J(o[0])},ii.DURATION*1e3))}Lt.default.useEffect(()=>{if(!j&&n){let Ge=setTimeout(()=>{Ry(ae.current,document.body)},200);return()=>clearTimeout(Ge)}},[j,n]),Lt.default.useLayoutEffect(()=>{e?(O(!0),N(!0)):Ct()},[e]),Lt.default.useEffect(()=>{q&&t?.(j)},[j]),Lt.default.useEffect(()=>{ae.current=new WeakMap,z(!0)},[]);function we(){if(!me.current)return;let Ge=document.querySelector("[vaul-drawer-wrapper]"),G=f5(me.current,x);Ti(ae.current,me.current,{transform:"translate3d(0, 0, 0)",transition:`transform ${ii.DURATION}s cubic-bezier(${ii.EASE.join(",")})`}),Ti(ae.current,Y.current,{transition:`opacity ${ii.DURATION}s cubic-bezier(${ii.EASE.join(",")})`,opacity:"1"}),n&&G&&G>0&&j&&(document.querySelectorAll("[vaul-drawer]").forEach(Pe=>{Pe!==me.current&&Ti(ae.current,Pe,{borderRadius:`${p5}px`,overflow:"hidden",...io(x)?{transform:`scale(${he()}) translate3d(0, 14px, 0)`,transformOrigin:"top"}:{transform:`scale(${he()}) translate3d(14px, 0, 0)`,transformOrigin:"left"},transitionProperty:"transform, border-radius",transitionDuration:`${ii.DURATION}s`,transitionTimingFunction:`cubic-bezier(${ii.EASE.join(",")})`},!0)}),Ti(ae.current,Ge,{borderRadius:`${p5}px`,overflow:"hidden",...io(x)?{transform:`scale(${he()}) translate3d(0, 14px, 0)`,transformOrigin:"top"}:{transform:`scale(${he()}) translate3d(14px, 0, 0)`,transformOrigin:"left"},transitionProperty:"transform, border-radius",transitionDuration:`${ii.DURATION}s`,transitionTimingFunction:`cubic-bezier(${ii.EASE.join(",")})`},!0))}function Be(){!I||!me.current||(me.current.classList.remove(xG),Ie.current=!1,T(!1),Q.current=new Date)}function Le(Ge){if(!I||!me.current)return;me.current.classList.remove(xG),Ie.current=!1,T(!1),Q.current=new Date;let G=f5(me.current,x);if(!Ye(Ge.target,!1)||!G||Number.isNaN(G)||te.current===null)return;let ue=Q.current.getTime()-te.current.getTime(),Pe=Oe.current-(io(x)?Ge.clientY:Ge.clientX),De=Math.abs(Pe)/ue;if(De>.05&&(_(!0),setTimeout(()=>{_(!1)},200)),o){ee({draggedDistance:Pe*(x==="bottom"||x==="right"?1:-1),closeDrawer:Ct,velocity:De,dismissible:f}),a?.(Ge,!0);return}if(x==="bottom"||x==="right"?Pe>0:Pe<0){we(),a?.(Ge,!0);return}if(De>fxe){Ct(),a?.(Ge,!1);return}var at;let ht=Math.min((at=me.current.getBoundingClientRect().height)!=null?at:0,window.innerHeight);if(G>=ht*u){Ct(),a?.(Ge,!1);return}a?.(Ge,!0),we()}Lt.default.useEffect(()=>{j&&(Ti(ae.current,document.documentElement,{scrollBehavior:"auto"}),oe.current=new Date,Ze(!0))},[j]),Lt.default.useEffect(()=>{if(me.current&&D){var Ge;let G=me==null||(Ge=me.current)==null?void 0:Ge.querySelectorAll("*");G?.forEach(ue=>{let Pe=ue;(Pe.scrollHeight>Pe.clientHeight||Pe.scrollWidth>Pe.clientWidth)&&Pe.classList.add("vaul-scrollable")})}},[D]);function Ze(Ge){let G=document.querySelector("[vaul-drawer-wrapper]");!G||!n||(Ge?(l&&(Ti(ae.current,document.body,{background:document.body.style.backgroundColor||document.body.style.background}),Ti(ae.current,document.body,{background:"black"},!0)),document.querySelectorAll("[vaul-drawer]").forEach(Pe=>{Pe!==me.current&&Ti(ae.current,Pe,{borderRadius:`${p5}px`,overflow:"hidden",...io(x)?{transform:`scale(${he()}) translate3d(0, 14px, 0)`,transformOrigin:"top"}:{transform:`scale(${he()}) translate3d(14px, 0, 0)`,transformOrigin:"left"},transitionProperty:"transform, border-radius",transitionDuration:`${ii.DURATION}s`,transitionTimingFunction:`cubic-bezier(${ii.EASE.join(",")})`})}),Ti(ae.current,G,{borderRadius:`${p5}px`,overflow:"hidden",...io(x)?{transform:`scale(${he()}) translate3d(0, 14px, 0)`,transformOrigin:"top"}:{transform:`scale(${he()}) translate3d(14px, 0, 0)`,transformOrigin:"left"},transitionProperty:"transform, border-radius",transitionDuration:`${ii.DURATION}s`,transitionTimingFunction:`cubic-bezier(${ii.EASE.join(",")})`})):(document.querySelectorAll("[vaul-drawer]").forEach(Pe=>{Pe!==me.current&&(Ry(ae.current,Pe,"overflow"),Ry(ae.current,Pe,"transform"),Ry(ae.current,Pe,"borderRadius"),Ti(ae.current,Pe,{transitionProperty:"transform, border-radius",transitionDuration:`${ii.DURATION}s`,transitionTimingFunction:`cubic-bezier(${ii.EASE.join(",")})`}))}),Ry(ae.current,G,"overflow"),Ry(ae.current,G,"transform"),Ry(ae.current,G,"borderRadius"),Ti(ae.current,G,{transitionProperty:"transform, border-radius",transitionDuration:`${ii.DURATION}s`,transitionTimingFunction:`cubic-bezier(${ii.EASE.join(",")})`})))}function He(Ge){let G=Ge?(window.innerWidth-$y)/window.innerWidth:1,ue=Ge?-$y:0;Se.current&&window.clearTimeout(Se.current),Ti(ae.current,me.current,{transition:`transform ${ii.DURATION}s cubic-bezier(${ii.EASE.join(",")})`,transform:`scale(${G}) translate3d(0, ${ue}px, 0)`}),!Ge&&me.current&&(Se.current=setTimeout(()=>{let Pe=f5(me.current,x);Ti(ae.current,me.current,{transition:"none",transform:io(x)?`translate3d(0, ${Pe}px, 0)`:`translate3d(${Pe}px, 0, 0)`})},500))}function Qe(Ge,G){if(G<0)return;let ue=io(x)?window.innerHeight:window.innerWidth,Pe=(ue-$y)/ue,De=Pe+G*(1-Pe),at=-$y+G*$y;Ti(ae.current,me.current,{transform:io(x)?`scale(${De}) translate3d(0, ${at}px, 0)`:`scale(${De}) translate3d(${at}px, 0, 0)`,transition:"none"})}function et(Ge,G){let ue=io(x)?window.innerHeight:window.innerWidth,Pe=G?(ue-$y)/ue:1,De=G?-$y:0;G&&Ti(ae.current,me.current,{transition:`transform ${ii.DURATION}s cubic-bezier(${ii.EASE.join(",")})`,transform:io(x)?`scale(${Pe}) translate3d(0, ${De}px, 0)`:`scale(${Pe}) translate3d(${De}px, 0, 0)`})}return Lt.default.createElement(Jbe,{modal:A,onOpenChange:Ge=>{if(e!==void 0){t?.(Ge);return}Ge?(N(!0),O(Ge)):Ct()},open:j},Lt.default.createElement(dxe.Provider,{value:{visible:D,activeSnapPoint:U,snapPoints:o,setActiveSnapPoint:J,drawerRef:me,overlayRef:Y,scaleBackground:Ze,onOpenChange:t,onPress:ze,setVisible:P,onRelease:Le,onDrag:tt,dismissible:f,handleOnly:d,isOpen:j,isDragging:I,shouldFade:Ee,closeDrawer:Ct,onNestedDrag:Qe,onNestedOpenChange:He,onNestedRelease:et,keyboardIsOpen:ve,openProp:e,modal:A,snapPointsOffset:ie,direction:x}},r))}var $Ge=250,qGe=120,yxe=Lt.default.forwardRef(function({preventCycle:e=!1,children:t,...r},n){let{visible:i,closeDrawer:a,isDragging:o,snapPoints:s,activeSnapPoint:l,setActiveSnapPoint:u,dismissible:c,handleOnly:f,onPress:d,onDrag:p}=m5(),h=Lt.default.useRef(null),m=Lt.default.useRef(!1);function g(){if(m.current){v();return}window.setTimeout(()=>{A()},qGe)}function A(){if(o||e||m.current){v();return}if(v(),(!s||s.length===0)&&c){a();return}if(l===s[s.length-1]&&c){a();return}let w=s.findIndex(k=>k===l);if(w===-1)return;let S=s[w+1];u(S)}function b(){h.current=window.setTimeout(()=>{m.current=!0},$Ge)}function v(){window.clearTimeout(h.current),m.current=!1}return Lt.default.createElement("div",{onClick:g,onDoubleClick:()=>{m.current=!0,a()},onPointerCancel:v,onPointerDown:x=>{f&&d(x),b()},onPointerMove:x=>{f&&p(x)},ref:n,"vaul-drawer-visible":i?"true":"false","vaul-handle":"","aria-hidden":"true",...r},Lt.default.createElement("span",{"vaul-handle-hitarea":"","aria-hidden":"true"},t))});yxe.displayName="Drawer.Handle";var bxe=Lt.default.forwardRef(function({children:e,...t},r){let{overlayRef:n,snapPoints:i,onRelease:a,shouldFade:o,isOpen:s,visible:l}=m5(),u=pxe(r,n),c=i&&i.length>0;return Lt.default.createElement(rxe,{onMouseUp:a,ref:u,"vaul-drawer-visible":l?"true":"false","vaul-overlay":"","vaul-snap-points":s&&c?"true":"false","vaul-snap-points-overlay":s&&o?"true":"false",...t})});bxe.displayName="Drawer.Overlay";var xxe=Lt.default.forwardRef(function({onOpenAutoFocus:e,onPointerDownOutside:t,onAnimationEnd:r,style:n,...i},a){let{drawerRef:o,onPress:s,onRelease:l,onDrag:u,dismissible:c,keyboardIsOpen:f,snapPointsOffset:d,visible:p,closeDrawer:h,modal:m,openProp:g,onOpenChange:A,setVisible:b,handleOnly:v,direction:x}=m5(),w=pxe(a,o),S=Lt.default.useRef(null),k=Lt.default.useRef(!1),j=(O,C,N=0)=>{if(k.current)return!0;let D=Math.abs(O.y),P=Math.abs(O.x),q=P>D,z=["bottom","right"].includes(C)?1:-1;if(C==="left"||C==="right"){if(!(O.x*z<0)&&P>=0&&P<=N)return q}else if(!(O.y*z<0)&&D>=0&&D<=N)return!q;return k.current=!0,!0};return Lt.default.useEffect(()=>{b(!0)},[]),Lt.default.createElement(nxe,{"vaul-drawer":"","vaul-drawer-direction":x,"vaul-drawer-visible":p?"true":"false",...i,ref:w,style:d&&d.length>0?{"--snap-point-height":`${d[0]}px`,...n}:n,onOpenAutoFocus:O=>{if(e)e(O);else{var C;O.preventDefault(),(C=o.current)==null||C.focus()}},onPointerDown:O=>{v||(i.onPointerDown==null||i.onPointerDown.call(i,O),S.current={x:O.clientX,y:O.clientY},s(O))},onPointerDownOutside:O=>{if(t?.(O),!m||O.defaultPrevented){O.preventDefault();return}f.current&&(f.current=!1),O.preventDefault(),A?.(!1),!(!c||g!==void 0)&&h()},onFocusOutside:O=>{if(!m){O.preventDefault();return}},onEscapeKeyDown:O=>{if(!m){O.preventDefault();return}},onPointerMove:O=>{if(v||(i.onPointerMove==null||i.onPointerMove.call(i,O),!S.current))return;let C=O.clientY-S.current.y,N=O.clientX-S.current.x,D=O.pointerType==="touch"?10:2;j({x:N,y:C},x,D)?u(O):(Math.abs(N)>D||Math.abs(C)>D)&&(S.current=null)},onPointerUp:O=>{i.onPointerUp==null||i.onPointerUp.call(i,O),S.current=null,k.current=!1,l(O)}})});xxe.displayName="Drawer.Content";function LGe({onDrag:e,onOpenChange:t,...r}){let{onNestedDrag:n,onNestedOpenChange:i,onNestedRelease:a}=m5();if(!n)throw new Error("Drawer.NestedRoot must be placed in another drawer");return Lt.default.createElement(vxe,{nested:!0,onClose:()=>{i(!1)},onDrag:(o,s)=>{n(o,s),e?.(o,s)},onOpenChange:o=>{o&&i(o),t?.(o)},onRelease:a,...r})}var qy={Root:vxe,NestedRoot:LGe,Content:xxe,Handle:yxe,Overlay:bxe,Trigger:exe,Portal:txe,Close:oxe,Title:ixe,Description:axe};var h5=e=>{let{newProps:t}=e,[r,n]=$d.default.useState(!0),i=(0,$d.useMemo)(()=>{let a=document.querySelectorAll(".mk-drawer-content"),o=0;return a.forEach(s=>{if(s instanceof HTMLElement){let l=s.getAttribute("data-drawer-index");l&&parseInt(l)>=o&&(o=parseInt(l)+1)}}),o},[]);return $d.default.createElement(qy.Root,{open:r,onOpenChange:a=>{n(a)},shouldScaleBackground:!0,onClose:()=>{n(!1),e.hide(!0)},noBodyStyles:!0},$d.default.createElement(qy.Portal,null,$d.default.createElement(qy.Content,{className:(0,wxe.default)("mk-drawer-content",e.className),"data-drawer-index":i,style:{"--drawer-index":i}},$d.default.createElement(qy.Handle,{className:"mk-drawer-handle"}),$d.default.createElement(qy.Title,{className:"mk-drawer-title",hidden:!(e.title?.length>0)},e.title),(0,$d.cloneElement)(e.fc,{hide:a=>{n(!1),e.hide(a)},...t})),$d.default.createElement(qy.Overlay,{className:"mk-drawer-overlay",style:{"--drawer-index":i}})))};var zGe=e=>{let t=qw(_p(BA,{activationConstraint:{distance:10}}),_p(RA,{activationConstraint:{delay:250,tolerance:5}}),_p(B0,{coordinateGetter:LN})),r=qd.default.useRef(null),[n,i]=qd.default.useState(!1);return(0,qd.useEffect)(()=>{let a=s=>s.key=="Escape"?(e.hide(!0),!0):!1;function o(s){let l=c=>!!(c.classList.contains("mk-menu")||c.classList.contains("mk-menu-wrapper")||c.classList.contains("mk-modal")),u=s.target;for(;!l(u)&&u.parentElement;)u=u.parentElement;l(u)||r.current&&!r.current.contains(s.target)&&e.hide(!0)}return e.ui.inputManager.on("click",o),e.ui.inputManager.on("contextmenu",o),e.ui.inputManager.on("keydown",a),()=>{e.ui.inputManager.off("click",o),e.ui.inputManager.off("contextmenu",o),e.ui.inputManager.off("keydown",a)}},[e.hide]),(0,qd.useEffect)(()=>{if(!jc(e.ui))return;let a=new ResizeObserver(o=>{let s=o[0].target.getBoundingClientRect();i(!0)});return r.current&&a.observe(r.current),()=>a.disconnect()},[e.rect]),qd.default.createElement(Lw,{sensors:t,collisionDetection:IN,measuring:{droppable:{strategy:Fp.Always}}},qd.default.createElement("div",{className:`mk-menu-wrapper ${!jc(e.ui)||n?"mk-ready":""}`,ref:r},e.children))},A5=e=>{let t=e.win.document.createElement("div"),r=jc(e.ui)&&!e.force;r?t.classList.add("mk-menu-mobile"):t.classList.add("mk-menu"),e.win.document.body.appendChild(t);let n=null,a=(()=>{let l=!1;return u=>{e.onHide&&!u&&e.onHide(),n&&n.hide(!0),!l&&(l=!0,setTimeout(()=>{o.unmount(),e.win.document.body.removeChild(t)},50))}})(),o=e.ui.createRoot(t),s=l=>{if(r){o.render(qd.default.createElement(h5,{fc:e.fc,hide:u=>a(u),newProps:l,className:(0,Sxe.default)("mk-drawer-menu",e.className)}));return}o.render(qd.default.createElement(zGe,{rect:e.rect,ui:e.ui,hide:u=>a(u),anchor:e.anchor},(0,qd.cloneElement)(e.fc,{hide:u=>a(u),onSubmenu:u=>{let c=u(e.rect,()=>{e.onHide&&e.onHide(),a(!0)});n&&n.hide(!0),n=c},...l})))};if(s(e.props),!r)return t.style.position="absolute",t.style.left=`${e.rect.x}px`,t.style.top=`${e.rect.y}px`,new ResizeObserver(u=>{let c=$ye(e.rect,u[0].target.getBoundingClientRect(),{width:e.win.innerWidth,height:e.win.innerHeight},e.anchor);t.style.left=`${c.x}px`,t.style.top=`${c.y}px`}).observe(t),{update:s,hide:a}};var Exe=Ae(Te());var kxe=(e,t,r,n,i,a)=>A5({ui:t.ui,rect:e,anchor:n,win:r,fc:Exe.default.createElement(kG,{...t}),onHide:i,className:t.searchable?"mk-combo-menu":"mk-select-menu",force:a});var Cxe=Ae(yi());var g5=class{constructor(){this.events={};this.handleMouseEvent=t=>{this.emit(t.type,t)};this.handleKeyEvent=t=>{this.emit(t.type,t)};this.addListeners()}on(t,r){this.events[t]||(this.events[t]=[]),this.events[t].push(r)}off(t,r){let n=this.events[t];n&&(this.events[t]=n.filter(i=>i!==r))}emit(t,r){let n=this.events[t];if(n){let i=!1;n.slice().reverse().forEach(a=>{i||(i=a(r))})}}addListeners(){window.addEventListener("mousedown",this.handleMouseEvent,!0),window.addEventListener("click",this.handleMouseEvent,!0),window.addEventListener("contextmenu",this.handleMouseEvent,!0),window.addEventListener("keydown",this.handleKeyEvent),window.addEventListener("keyup",this.handleKeyEvent)}removeListeners(){window.removeEventListener("mousedown",this.handleMouseEvent),window.removeEventListener("click",this.handleMouseEvent),window.removeEventListener("contextmenu",this.handleMouseEvent),window.removeEventListener("keydown",this.handleKeyEvent),window.removeEventListener("keyup",this.handleKeyEvent)}};var Ly=class{constructor(t,r){this.resetFunctions=[];this.addResetFunction=t=>{this.resetFunctions.push(t)};this.removeResetFunction=t=>{this.resetFunctions=this.resetFunctions.filter(r=>r!=t)};this.resetSelection=t=>{this.resetFunctions.forEach(r=>r(t))};this.eventsDispatch=new n0;this.activeState={};this.adapters=[];this.adapters=r??[],t.manager=this,this.mainFrame=t,this.inputManager=new g5}quickOpen(t,r,n,i){this.mainFrame.quickOpen(t,r,n,i)}availableViews(){return this.mainFrame.availableViews()}setActiveState(t){Cxe.default.isEqual(t,this.activeState)||(this.activeState=t,this.eventsDispatch.dispatchEvent("activeStateChanged",null))}setActivePath(t){this.activePath=t,this.eventsDispatch.dispatchEvent("activePathChanged",t)}setActiveSelection(t,r){this.eventsDispatch.dispatchEvent("activeSelectionChanged",{path:t,content:r})}mainMenu(t,r){this.mainFrame.mainMenu(t,r)}navigationHistory(){return this.mainFrame.navigationHistory()}allViews(){return[]}viewsByPath(t){return this.mainFrame.viewsByPath(t)}static create(t,r){return new Ly(t,r)}isEverViewOpen(){return this.mainFrame.isEverViewOpen()}getWarnings(){return this.mainFrame.getWarnings()}createRoot(t,r){return this.mainFrame.createRoot(t)}openMenu(t,r,n,i="right",a,o){return kxe(t,r,n,i,a,o)}openCustomMenu(t,r,n,i,a="right",o,s,l){return A5({rect:t,anchor:a,win:i,ui:this,fc:r,props:n,onHide:o,className:s,onSubmenu:l})}notify(t,r){if(r=="console"){console.log(t);return}this.mainFrame.openToast(t)}error(t){console.log(t)}openPalette(t,r,n){return this.mainFrame.openPalette(t,r,n)}openModal(t,r,n,i,a){return this.mainFrame.openModal(t,r,n,i,a)}openPopover(t,r){this.mainFrame.openPopover(t,r)}openPath(t,r,n,i){this.mainFrame.openPath(t,r,n,i)}primaryInteractionType(){return this.mainFrame.primaryInteractionType()}getScreenType(){return this.mainFrame.getScreenType()}getOS(){return this.mainFrame.getOS()}getSticker(t){return this.mainFrame.getSticker(t)}getPlaceholderImage(t){return Rye[t]}allStickers(){return this.mainFrame.allStickers()}getUIPath(t,r){return t?this.mainFrame.getUIPath(t,r):null}dragStarted(t,r){this.mainFrame.dragStarted(t,r)}dragEnded(t){this.mainFrame.dragEnded(t)}setDragLabel(t){this.mainFrame.setDragLabel(t)}};var Of=Ae(Te());function KA(e){return Array.isArray?Array.isArray(e):_xe(e)==="[object Array]"}var UGe=1/0;function WGe(e){if(typeof e=="string")return e;let t=e+"";return t=="0"&&1/e==-UGe?"-0":t}function HGe(e){return e==null?"":WGe(e)}function ah(e){return typeof e=="string"}function Txe(e){return typeof e=="number"}function VGe(e){return e===!0||e===!1||GGe(e)&&_xe(e)=="[object Boolean]"}function Fxe(e){return typeof e=="object"}function GGe(e){return Fxe(e)&&e!==null}function Df(e){return e!=null}function CG(e){return!e.trim().length}function _xe(e){return e==null?e===void 0?"[object Undefined]":"[object Null]":Object.prototype.toString.call(e)}var QGe="Incorrect 'index' type",YGe=e=>`Invalid value for key ${e}`,ZGe=e=>`Pattern length exceeds max of ${e}.`,XGe=e=>`Missing ${e} property in key`,KGe=e=>`Property 'weight' in key '${e}' must be a positive integer`,Dxe=Object.prototype.hasOwnProperty,DG=class{constructor(t){this._keys=[],this._keyMap={};let r=0;t.forEach(n=>{let i=Pxe(n);this._keys.push(i),this._keyMap[i.id]=i,r+=i.weight}),this._keys.forEach(n=>{n.weight/=r})}get(t){return this._keyMap[t]}keys(){return this._keys}toJSON(){return JSON.stringify(this._keys)}};function Pxe(e){let t=null,r=null,n=null,i=1,a=null;if(ah(e)||KA(e))n=e,t=Oxe(e),r=OG(e);else{if(!Dxe.call(e,"name"))throw new Error(XGe("name"));let o=e.name;if(n=o,Dxe.call(e,"weight")&&(i=e.weight,i<=0))throw new Error(KGe(o));t=Oxe(o),r=OG(o),a=e.getFn}return{path:t,id:r,weight:i,src:n,getFn:a}}function Oxe(e){return KA(e)?e:e.split(".")}function OG(e){return KA(e)?e.join("."):e}function JGe(e,t){let r=[],n=!1,i=(a,o,s)=>{if(!!Df(a))if(!o[s])r.push(a);else{let l=o[s],u=a[l];if(!Df(u))return;if(s===o.length-1&&(ah(u)||Txe(u)||VGe(u)))r.push(HGe(u));else if(KA(u)){n=!0;for(let c=0,f=u.length;ce.score===t.score?e.idx{this._keysMap[r.id]=n})}create(){this.isCreated||!this.docs.length||(this.isCreated=!0,ah(this.docs[0])?this.docs.forEach((t,r)=>{this._addString(t,r)}):this.docs.forEach((t,r)=>{this._addObject(t,r)}),this.norm.clear())}add(t){let r=this.size();ah(t)?this._addString(t,r):this._addObject(t,r)}removeAt(t){this.records.splice(t,1);for(let r=t,n=this.size();r{let o=i.getFn?i.getFn(t):this.getFn(t,i.path);if(!!Df(o)){if(KA(o)){let s=[],l=[{nestedArrIndex:-1,value:o}];for(;l.length;){let{nestedArrIndex:u,value:c}=l.pop();if(!!Df(c))if(ah(c)&&!CG(c)){let f={v:c,i:u,n:this.norm.get(c)};s.push(f)}else KA(c)&&c.forEach((f,d)=>{l.push({nestedArrIndex:d,value:f})})}n.$[a]=s}else if(ah(o)&&!CG(o)){let s={v:o,n:this.norm.get(o)};n.$[a]=s}}}),this.records.push(n)}toJSON(){return{keys:this.keys,records:this.records}}};function Ixe(e,t,{getFn:r=zr.getFn,fieldNormWeight:n=zr.fieldNormWeight}={}){let i=new OC({getFn:r,fieldNormWeight:n});return i.setKeys(e.map(Pxe)),i.setSources(t),i.create(),i}function oQe(e,{getFn:t=zr.getFn,fieldNormWeight:r=zr.fieldNormWeight}={}){let{keys:n,records:i}=e,a=new OC({getFn:t,fieldNormWeight:r});return a.setKeys(n),a.setIndexRecords(i),a}function v5(e,{errors:t=0,currentLocation:r=0,expectedLocation:n=0,distance:i=zr.distance,ignoreLocation:a=zr.ignoreLocation}={}){let o=t/e.length;if(a)return o;let s=Math.abs(n-r);return i?o+s/i:s?1:o}function sQe(e=[],t=zr.minMatchCharLength){let r=[],n=-1,i=-1,a=0;for(let o=e.length;a=t&&r.push([n,i]),n=-1)}return e[a-1]&&a-n>=t&&r.push([n,a-1]),r}var zy=32;function lQe(e,t,r,{location:n=zr.location,distance:i=zr.distance,threshold:a=zr.threshold,findAllMatches:o=zr.findAllMatches,minMatchCharLength:s=zr.minMatchCharLength,includeMatches:l=zr.includeMatches,ignoreLocation:u=zr.ignoreLocation}={}){if(t.length>zy)throw new Error(ZGe(zy));let c=t.length,f=e.length,d=Math.max(0,Math.min(n,f)),p=a,h=d,m=s>1||l,g=m?Array(f):[],A;for(;(A=e.indexOf(t,h))>-1;){let k=v5(t,{currentLocation:A,expectedLocation:d,distance:i,ignoreLocation:u});if(p=Math.min(k,p),h=A+c,m){let j=0;for(;j=C;q-=1){let z=q-1,I=r[e.charAt(z)];if(m&&(g[z]=+!!I),D[q]=(D[q+1]<<1|1)&I,k&&(D[q]|=(b[q+1]|b[q])<<1|1|b[q+1]),D[q]&w&&(v=v5(t,{errors:k,currentLocation:z,expectedLocation:d,distance:i,ignoreLocation:u}),v<=p)){if(p=v,h=z,h<=d)break;C=Math.max(1,2*d-h)}}if(v5(t,{errors:k+1,currentLocation:d,expectedLocation:d,distance:i,ignoreLocation:u})>p)break;b=D}let S={isMatch:h>=0,score:Math.max(.001,v)};if(m){let k=sQe(g,s);k.length?l&&(S.indices=k):S.isMatch=!1}return S}function uQe(e){let t={};for(let r=0,n=e.length;r{this.chunks.push({pattern:d,alphabet:uQe(d),startIndex:p})},f=this.pattern.length;if(f>zy){let d=0,p=f%zy,h=f-p;for(;d{let{isMatch:A,score:b,indices:v}=lQe(t,h,m,{location:i+g,distance:a,threshold:o,findAllMatches:s,minMatchCharLength:l,includeMatches:n,ignoreLocation:u});A&&(d=!0),f+=b,A&&v&&(c=[...c,...v])});let p={isMatch:d,score:d?f/this.chunks.length:1};return d&&n&&(p.indices=c),p}},oh=class{constructor(t){this.pattern=t}static isMultiMatch(t){return Mxe(t,this.multiRegex)}static isSingleMatch(t){return Mxe(t,this.singleRegex)}search(){}};function Mxe(e,t){let r=e.match(t);return r?r[1]:null}var MG=class extends oh{constructor(t){super(t)}static get type(){return"exact"}static get multiRegex(){return/^="(.*)"$/}static get singleRegex(){return/^=(.*)$/}search(t){let r=t===this.pattern;return{isMatch:r,score:r?0:1,indices:[0,this.pattern.length-1]}}},jG=class extends oh{constructor(t){super(t)}static get type(){return"inverse-exact"}static get multiRegex(){return/^!"(.*)"$/}static get singleRegex(){return/^!(.*)$/}search(t){let n=t.indexOf(this.pattern)===-1;return{isMatch:n,score:n?0:1,indices:[0,t.length-1]}}},NG=class extends oh{constructor(t){super(t)}static get type(){return"prefix-exact"}static get multiRegex(){return/^\^"(.*)"$/}static get singleRegex(){return/^\^(.*)$/}search(t){let r=t.startsWith(this.pattern);return{isMatch:r,score:r?0:1,indices:[0,this.pattern.length-1]}}},TG=class extends oh{constructor(t){super(t)}static get type(){return"inverse-prefix-exact"}static get multiRegex(){return/^!\^"(.*)"$/}static get singleRegex(){return/^!\^(.*)$/}search(t){let r=!t.startsWith(this.pattern);return{isMatch:r,score:r?0:1,indices:[0,t.length-1]}}},FG=class extends oh{constructor(t){super(t)}static get type(){return"suffix-exact"}static get multiRegex(){return/^"(.*)"\$$/}static get singleRegex(){return/^(.*)\$$/}search(t){let r=t.endsWith(this.pattern);return{isMatch:r,score:r?0:1,indices:[t.length-this.pattern.length,t.length-1]}}},_G=class extends oh{constructor(t){super(t)}static get type(){return"inverse-suffix-exact"}static get multiRegex(){return/^!"(.*)"\$$/}static get singleRegex(){return/^!(.*)\$$/}search(t){let r=!t.endsWith(this.pattern);return{isMatch:r,score:r?0:1,indices:[0,t.length-1]}}},b5=class extends oh{constructor(t,{location:r=zr.location,threshold:n=zr.threshold,distance:i=zr.distance,includeMatches:a=zr.includeMatches,findAllMatches:o=zr.findAllMatches,minMatchCharLength:s=zr.minMatchCharLength,isCaseSensitive:l=zr.isCaseSensitive,ignoreLocation:u=zr.ignoreLocation}={}){super(t),this._bitapSearch=new y5(t,{location:r,threshold:n,distance:i,includeMatches:a,findAllMatches:o,minMatchCharLength:s,isCaseSensitive:l,ignoreLocation:u})}static get type(){return"fuzzy"}static get multiRegex(){return/^"(.*)"$/}static get singleRegex(){return/^(.*)$/}search(t){return this._bitapSearch.searchIn(t)}},x5=class extends oh{constructor(t){super(t)}static get type(){return"include"}static get multiRegex(){return/^'"(.*)"$/}static get singleRegex(){return/^'(.*)$/}search(t){let r=0,n,i=[],a=this.pattern.length;for(;(n=t.indexOf(this.pattern,r))>-1;)r=n+a,i.push([n,r-1]);let o=!!i.length;return{isMatch:o,score:o?0:1,indices:i}}},PG=[MG,x5,NG,TG,_G,FG,jG,b5],jxe=PG.length,cQe=/ +(?=(?:[^\"]*\"[^\"]*\")*[^\"]*$)/,fQe="|";function dQe(e,t={}){return e.split(fQe).map(r=>{let n=r.trim().split(cQe).filter(a=>a&&!!a.trim()),i=[];for(let a=0,o=n.length;a!!(e[w5.AND]||e[w5.OR]),hQe=e=>!!e[$G.PATH],AQe=e=>!KA(e)&&Fxe(e)&&!qG(e),Nxe=e=>({[w5.AND]:Object.keys(e).map(t=>({[t]:e[t]}))});function Bxe(e,t,{auto:r=!0}={}){let n=i=>{let a=Object.keys(i),o=hQe(i);if(!o&&a.length>1&&!qG(i))return n(Nxe(i));if(AQe(i)){let l=o?i[$G.PATH]:a[0],u=o?i[$G.PATTERN]:i[l];if(!ah(u))throw new Error(YGe(l));let c={keyId:OG(l),pattern:u};return r&&(c.searcher=RG(u,t)),c}let s={children:[],operator:a[0]};return a.forEach(l=>{let u=i[l];KA(u)&&u.forEach(c=>{s.children.push(n(c))})}),s};return qG(e)||(e=Nxe(e)),n(e)}function gQe(e,{ignoreFieldNorm:t=zr.ignoreFieldNorm}){e.forEach(r=>{let n=1;r.matches.forEach(({key:i,norm:a,score:o})=>{let s=i?i.weight:null;n*=Math.pow(o===0&&s?Number.EPSILON:o,(s||1)*(t?1:a))}),r.score=n})}function vQe(e,t){let r=e.matches;t.matches=[],Df(r)&&r.forEach(n=>{if(!Df(n.indices)||!n.indices.length)return;let{indices:i,value:a}=n,o={indices:i,value:a};n.key&&(o.key=n.key.src),n.idx>-1&&(o.refIndex=n.idx),t.matches.push(o)})}function yQe(e,t){t.score=e.score}function bQe(e,t,{includeMatches:r=zr.includeMatches,includeScore:n=zr.includeScore}={}){let i=[];return r&&i.push(vQe),n&&i.push(yQe),e.map(a=>{let{idx:o}=a,s={item:t[o],refIndex:o};return i.length&&i.forEach(l=>{l(a,s)}),s})}var Vp=class{constructor(t,r={},n){this.options={...zr,...r},this.options.useExtendedSearch,this._keyStore=new DG(this.options.keys),this.setCollection(t,n)}setCollection(t,r){if(this._docs=t,r&&!(r instanceof OC))throw new Error(QGe);this._myIndex=r||Ixe(this.options.keys,this._docs,{getFn:this.options.getFn,fieldNormWeight:this.options.fieldNormWeight})}add(t){!Df(t)||(this._docs.push(t),this._myIndex.add(t))}remove(t=()=>!1){let r=[];for(let n=0,i=this._docs.length;n-1&&(l=l.slice(0,r)),bQe(l,this._docs,{includeMatches:n,includeScore:i})}_searchStringList(t){let r=RG(t,this.options),{records:n}=this._myIndex,i=[];return n.forEach(({v:a,i:o,n:s})=>{if(!Df(a))return;let{isMatch:l,score:u,indices:c}=r.searchIn(a);l&&i.push({item:a,idx:o,matches:[{score:u,value:a,norm:s,indices:c}]})}),i}_searchLogical(t){let r=Bxe(t,this.options),n=(s,l,u)=>{if(!s.children){let{keyId:f,searcher:d}=s,p=this._findMatches({key:this._keyStore.get(f),value:this._myIndex.getValueForItemAtKeyId(l,f),searcher:d});return p&&p.length?[{idx:u,item:l,matches:p}]:[]}let c=[];for(let f=0,d=s.children.length;f{if(Df(s)){let u=n(r,s,l);u.length&&(a[l]||(a[l]={idx:l,item:s,matches:[]},o.push(a[l])),u.forEach(({matches:c})=>{a[l].matches.push(...c)}))}}),o}_searchObjectList(t){let r=RG(t,this.options),{keys:n,records:i}=this._myIndex,a=[];return i.forEach(({$:o,i:s})=>{if(!Df(o))return;let l=[];n.forEach((u,c)=>{l.push(...this._findMatches({key:u,value:o[c],searcher:r}))}),l.length&&a.push({idx:s,item:o,matches:l})}),a}_findMatches({key:t,value:r,searcher:n}){if(!Df(r))return[];let i=[];if(KA(r))r.forEach(({v:a,i:o,n:s})=>{if(!Df(a))return;let{isMatch:l,score:u,indices:c}=n.searchIn(a);l&&i.push({score:u,key:t,value:a,idx:o,norm:s,indices:c})});else{let{v:a,n:o}=r,{isMatch:s,score:l,indices:u}=n.searchIn(a);s&&i.push({score:l,key:t,value:a,norm:o,indices:u})}return i}};Vp.version="7.0.0";Vp.createIndex=Ixe;Vp.parseIndex=oQe;Vp.config=zr;Vp.parseQuery=Bxe;mQe(IG);var Ei=Ae(Te());var kl=Ae(Te()),xQe={position:"absolute",width:0,height:0,visibility:"hidden",overflow:"scroll",whiteSpace:"pre"},wQe=["fontSize","fontFamily","fontWeight","fontStyle","letterSpacing","textTransform"],Rxe=(0,kl.forwardRef)((e,t)=>{let{classNames:r,inputAttributes:n,inputEventHandlers:i,index:a}=e,o=(0,kl.useRef)(null),[s,l]=(0,kl.useState)(null),[u,c]=(0,kl.useState)("");(0,kl.useEffect)(()=>{f(),d(),setTimeout(()=>{t.current?.focus()},50)},[]),(0,kl.useEffect)(()=>{u!==e.placeholderText&&(c(e.placeholderText),d())},[e.query,e.placeholderText]);let f=()=>{let p=window.getComputedStyle(t.current);wQe.forEach(h=>{o.current.style[h]=p[h]})},d=()=>{let p=Math.ceil(o.current.scrollWidth)+2;p!==s&&l(p)};return kl.default.createElement("div",{className:r.search},kl.default.createElement("div",{className:r.searchWrapper},kl.default.createElement("div",{className:"mk-icon-xsmall",dangerouslySetInnerHTML:{__html:e.ui.getSticker("ui//search")}}),kl.default.createElement("input",{...n,...i,ref:t,value:e.query,placeholder:u,className:r.searchInput,role:"combobox",style:{width:"100%"},onClick:p=>p.stopPropagation()}),kl.default.createElement("div",{ref:o,style:xQe},e.query||u),kl.default.createElement("span",null)))}),$xe=Rxe;Rxe.displayName="SelectMenuSearch";var LG=Ae(Te()),SQe=e=>LG.default.createElement("button",{type:"button",className:e.classNames.selectedTag,onClick:e.onDelete},LG.default.createElement("span",{className:e.classNames.selectedTagName},e.tag.name)),qxe=SQe;var Lxe=Ae(Te()),zxe=e=>Lxe.default.createElement("div",{className:"mk-sticker",dangerouslySetInnerHTML:{__html:e.ui.getSticker(e.sticker)}});var mi=Ae(Te());function Uxe(e){return e.replace(/[-\\^$*+?.()|[\]{}]/g,"\\$&")}function n2(e){return new RegExp(Uxe(e),"gi")}function Wxe(e){return new RegExp(`^${Uxe(e)}$`,"i")}function Hxe(e,t){let r=n2(t);return e?.replace(r,"$&")}var EQe=e=>{let t=(0,mi.useRef)(null);return(0,mi.useEffect)(()=>{e.active&&t?.current?.scrollIntoViewIfNeeded()},[e.active]),mi.default.createElement(mi.default.Fragment,null,e.item.icon&&mi.default.createElement(zxe,{ui:e.ui,sticker:e.item.icon}),mi.default.createElement("div",{ref:t,className:"mk-menu-options-inner"},e.item.onToggle&&mi.default.createElement("div",null,"Toggle"),mi.default.createElement("span",{style:e.item.color?.length>0?{background:e.item.color,padding:"2px 4px",borderRadius:"4px",color:e.item.color=="var(--mk-color-none)"?"inherit":"var(--mk-color-white)"}:{},dangerouslySetInnerHTML:{__html:e.query.length>0?Hxe(e.item.name,e.query):e.item.name}}),e.item.description&&mi.default.createElement("span",{"aria-label":e.item.description,className:"mk-menu-options-description",dangerouslySetInnerHTML:{__html:Hxe(e.item.description,e.query)}})),e.item.type==1&&mi.default.createElement("span",null,e.item.value),e.item.type==3&&e.item.value&&mi.default.createElement("div",{className:"mk-icon-small",dangerouslySetInnerHTML:{__html:e.ui.getSticker("ui//check")}}),e.item.onMoreOptions||e.onMoreOption&&e.item.removeable?mi.default.createElement("div",{onClick:r=>{r.stopPropagation(),r.preventDefault(),e.item.onMoreOptions?e.item.onMoreOptions(r):e.onMoreOption(r,e.item.value)},className:"mk-icon-small",dangerouslySetInnerHTML:{__html:e.ui.getSticker("ui//options")}}):null,e.item.removeable&&e.onDeleteOption&&mi.default.createElement("div",{onClick:r=>{r.stopPropagation(),r.preventDefault(),e.onDeleteOption(e.item.value)},className:"mk-icon-small",dangerouslySetInnerHTML:{__html:e.ui.getSticker("ui//close")}}),e.item.type==6&&mi.default.createElement("div",{className:"mk-icon-small",dangerouslySetInnerHTML:{__html:e.ui.getSticker("ui//chevron-right")}}))},kQe=e=>{let[t,r]=(0,mi.useState)(e.value);return mi.default.createElement("input",{type:"text",value:t,onKeyDown:n=>{n.key=="Enter"&&e.setValue(t)},onMouseDown:n=>n.stopPropagation(),onClick:n=>n.stopPropagation(),onFocus:n=>{n.stopPropagation()},onChange:n=>r(n.target.value),onBlur:n=>e.setValue(t)})},CQe=e=>{let t=e.options.map((r,n)=>{let i=`${e.id}-${n}`,a=r.type==-1?"mk-menu-separator":r.type==2?"mk-menu-input":r.type==5?"mk-menu-custom":`mk-menu-option ${e.index===n&&e.classNames.suggestionActive} ${r.disabled&&e.classNames.suggestionDisabled}`;return mi.default.createElement("div",{ref:o=>{e.refs?.current&&(e.refs.current[n]=o)},onMouseDown:o=>{e.isDisclosureMenu||o.stopPropagation(),o.preventDefault()},onClick:o=>{if(r.onSubmenu&&e.openSubmenu){let s=e.refs?.current[n].getBoundingClientRect();e.openSubmenu(r.onSubmenu(s,()=>{e.onHide&&e.onHide(),e.hide()}))}else r.onClick?(r.onClick(o),r.type!=6&&r.type!=1&&e.hide()):(r.type==null||r.type==0||r.type==1)&&(e.selectOption(r,{ctrlKey:o.ctrlKey,metaKey:o.metaKey,altKey:o.altKey,shiftKey:o.shiftKey,doubleClick:o.detail==2}),e.isDisclosureMenu||o.stopPropagation())},id:i,key:i,className:a},r.type==-1?mi.default.createElement(mi.default.Fragment,null):r.type==-2?mi.default.createElement("div",{className:"mk-menu-options-section"},r.name):r.type==2?mi.default.createElement(kQe,{value:r.value,setValue:r.onValueChange}):r.type==5?mi.default.createElement(r.fragment,{hide:e.hide,onSubmenu:o=>{if(e.openSubmenu){let s=e.refs?.current[n].getBoundingClientRect();e.openSubmenu(o(s,()=>{e.onHide&&e.onHide(),e.hide()}))}}}):mi.default.createElement(EQe,{ui:e.ui,item:r,query:e.query,active:n==e.index,onMoreOption:e.moreOption,onDeleteOption:e.deleteOption}))});return mi.default.createElement("div",{className:"mk-menu-suggestions"},t,e.query&&e.allowNew&&mi.default.createElement("div",{className:"mk-menu-option",onMouseDown:r=>r.preventDefault(),onClick:r=>e.selectOption({name:e.query,value:e.query},{ctrlKey:r.ctrlKey,metaKey:r.metaKey,altKey:r.altKey,shiftKey:r.shiftKey})},mi.default.createElement("div",{className:"mk-sticker",dangerouslySetInnerHTML:{__html:e.ui.getSticker("ui//plus")}}),mi.default.createElement("div",{className:"mk-menu-options-inner"},e.addKeyword??"Add"," ",e.query)))},Vxe=CQe;function Gxe(e,t){let r=e.querySelectorAll("a,button,input"),n=Array.prototype.findIndex.call(r,a=>a===t),i=r[n-1]||r[n+1];i&&i.focus()}var Uy={ENTER:"Enter",TAB:"Tab",BACKSPACE:"Backspace",UP_ARROW:"ArrowUp",UP_ARROW_COMPAT:"Up",DOWN_ARROW:"ArrowDown",DOWN_ARROW_COMPAT:"Down",LEFT_ARROW:"ArrowLeft",RIGHT_ARROW:"ArrowRight"},Yxe={root:"mk-menu-container",rootFocused:"mk-focused",selected:"mk-menu-input-wrapper",selectedTagWrapper:"mk-menu-selected-tag-wrapper",selectedTag:"mk-menu-selected-tag",selectedTagName:"mk-menu-selected-tag-name",search:"mk-menu-search",searchWrapper:"mk-menu-search-container",searchInput:"mk-menu-search-input",suggestions:"mk-menu-suggestions",suggestionActive:"mk-active",suggestionDisabled:"mk-disabled"},DQe={ui:null,id:"SelectMenu",tags:[],hide:()=>null,onHide:()=>null,suggestionsOnly:!1,placeholderText:H.labels.optionItemSelectPlaceholder,noSuggestionsText:null,newTagText:null,suggestions:[],suggestionsFilter:OQe,suggestionsTransform:null,classNames:Yxe,delimiters:[Uy.ENTER],minQueryLength:2,maxSuggestionsLength:8,inputAttributes:{}},Zxe=(e,t)=>e.findIndex(r=>Wxe(t).test(r.name)),Qxe=(e,t,r,n,i,a)=>{if(t.length>=e.minQueryLength){let o=Zxe(n,t),s=r===-1?o:r,l=s>-1?n[s]:null;i(l||{name:t,value:t},a)}};function OQe(e,t){return n2(t).test(e.name)}function MQe(e,t,r){let n,i=e.suggestions;r.length>0&&(i=e.suggestions.filter(s=>s.section==r));let a={threshold:0,ignoreLocation:!0,keys:["name","value"]},o=new Vp(i,a);return n=t.length==0?i:o.search(t).map(s=>s.item),n=n.slice(0,e.maxSuggestionsLength),e.newTagText&&Zxe(n,t)===-1?n.push({id:0,name:t,value:t}):e.noSuggestionsText&&n.length===0&&n.push({id:0,name:e.noSuggestionsText,value:"",disabled:!0}),n}var Xxe=Ei.default.forwardRef((e,t)=>{let r={...DQe,...e},[n,i]=(0,Ei.useState)([]),a=(0,Ei.useRef)([]),o=(0,Ei.useMemo)(()=>r.showSections?[{name:"All",value:""},...r.sections??kr(r.suggestions.map(te=>te.section)).filter(te=>te)]:[],[r.showSections,r.sections,r.suggestions]),s=(0,Ei.useRef)(null),[l,u]=(0,Ei.useState)(""),[c,f]=(0,Ei.useState)(""),[d,p]=(0,Ei.useState)(!1),[h,m]=(0,Ei.useState)(0),g=(0,Ei.useRef)(!1);(0,Ei.useEffect)(()=>{t&&(t.current=()=>d?!0:(s?.current?.focus(),p(!0),!1))},[d]),(0,Ei.useEffect)(()=>{if(c.length==0&&r.defaultSuggestions){i(r.defaultSuggestions);return}i(MQe(r,c,l))},[c,r.defaultSuggestions,l,r.suggestions]);let A=(0,Ei.useRef)(null),b=te=>{if(te.type==="compositionstart"){g.current=!0;return}if(te.type==="compositionend"){g.current=!1;return}let Q=te.target.value;r.onInput&&r.onInput(Q),Q.length===c.length+1&&r.delimiters.indexOf(c.slice(-1))>-1?Qxe(r,c,h,n,k,{}):Q!==c&&f(Q)},v=te=>{g.current||(r.delimiters.indexOf(te.key)>-1&&((c||h>-1)&&te.preventDefault(),Qxe(r,c,h,n,k,{ctrlKey:te.ctrlKey,metaKey:te.metaKey,altKey:te.altKey,shiftKey:te.shiftKey})),te.key!="Escape"&&(te.key===Uy.TAB&&q(te),te.key===Uy.BACKSPACE&&P(),(te.key===Uy.UP_ARROW||te.key===Uy.UP_ARROW_COMPAT)&&N(te),(te.key===Uy.DOWN_ARROW||te.key===Uy.DOWN_ARROW_COMPAT)&&D(te),te.stopPropagation()))},x=()=>{p(!1),r.onBlur&&r.onBlur()},w=()=>{p(!0),r.onFocus&&r.onFocus()},S=(te,Q)=>{A.current&&Gxe(A.current,Q.currentTarget),j(te)},k=(te,Q)=>{te.disabled||r.onValidate&&!r.onValidate(te)||(r.onAddition(te,Q),O())},j=te=>{r.onDelete(te)},O=()=>{f(""),m(-1)},C=()=>{m(-1)},N=te=>{te.preventDefault();let Q=n.length-1,fe=h<=0?Q:h-1;n[fe].disabled?m(fe<=0?Q:fe-1):m(fe)},D=te=>{te.preventDefault();let Q=n.length-1,fe=h>=Q?0:h+1;n[fe].disabled?m(fe>=Q?0:fe+1):m(fe)};function P(){c.length||j(r.tags.length-1)}function q(te){r.showSections&&(te.preventDefault(),te.stopPropagation(),u(Q=>{let fe=o.findIndex(Ie=>Ie.value==Q);return te.shiftKey?fe==0?Q:(r.onSelectSection&&r.onSelectSection(o[fe-1].value),o[fe-1].value):fe==o.length-1?Q:(r.onSelectSection&&r.onSelectSection(o[fe+1].value),o[fe+1].value)}))}let z=()=>{s.current.focus()},I={onChange:b,onCompositionEnd:b,onCompositionStart:b};(0,Ei.useEffect)(()=>(r.ui.inputManager.on("keydown",v),()=>{r.ui.inputManager.off("keydown",v)}),[n,h]);let T=d&&c.length>=r.minQueryLength,L=Object.assign({},Yxe,r.classNames);r.wrapperClass&&(L.root=`${L.root} ${r.wrapperClass}`);let _=[L.root];d&&_.push(L.rootFocused);let Y=(0,Ei.useRef)(null),oe=te=>{Y.current&&Y.current.hide(!0),Y.current=te};return Ei.default.createElement("div",{ref:A,className:_.join(" "),style:r.suggestionsOnly?{}:{"--mk-menu-max-height":"200px"}},r.suggestionsOnly?null:Ei.default.createElement("div",{className:L.selected,"aria-relevant":"additions removals","aria-live":"polite"},r.tags.length>0&&Ei.default.createElement("div",{className:L.selectedTagWrapper},r.tags.map((te,Q)=>Ei.default.createElement(qxe,{key:Q,tag:te,classNames:L,onDelete:fe=>S(Q,fe)}))),Ei.default.createElement($xe,{ui:r.ui,ref:s,query:c,index:h,id:r.id,currentSection:o.find(te=>te.value==l),classNames:L,inputAttributes:r.inputAttributes,inputEventHandlers:I,expanded:T,placeholderText:r.placeholderText})),r.showSections?Ei.default.createElement("div",{className:"mk-menu-sections"},o.map((te,Q)=>Ei.default.createElement("div",{key:Q,onClick:fe=>{fe.stopPropagation(),u(te.value)},className:`${l==te.value?"is-active":""} mk-menu-section`},te.name==""?H.labels.all:te.name))):Ei.default.createElement(Ei.default.Fragment,null),n.length||r.allowNew?Ei.default.createElement(Vxe,{ui:r.ui,hide:()=>{r.hide()},addKeyword:r.addKeyword,refs:a,options:n,query:c,setIndex:m,index:h,onHide:r.onHide,id:r.id,classNames:L,expanded:T,selectOption:k,allowNew:r.allowNew,moreOption:r.onMoreOption,deleteOption:r.onDeleteOption,isDisclosureMenu:r.isDisclosure,openSubmenu:oe}):null,r.previewComponent)});Xxe.displayName="SelectMenuComponent";var Kxe=Xxe;var Jxe=Of.default.forwardRef((e,t)=>{let r=e.options.map((f,d)=>({...f,id:d+1}));(0,Of.useEffect)(()=>{i(e.options.map((f,d)=>({...f,id:d+1})))},[e.options]);let[n,i]=(0,Of.useState)(r),[a,o]=(0,Of.useState)(e.value.map(f=>r.find(d=>d.value==f)??{id:0,name:f,value:f})),s=(0,Of.useCallback)(f=>{let d=a.filter((p,h)=>h!==f);o(d),e.saveOptions&&e.saveOptions(n.map(p=>p.value),d.map(p=>p.value),!1)},[n,a,e]),l=(0,Of.useCallback)(f=>{let d=n.filter(h=>h.value!=f),p=a.filter(h=>h.value!=f);i(d),o(p),e.removeOption&&e.removeOption(f),e.hide()},[a,n,e]),u=(0,Of.useCallback)((f,d)=>{let p=f,h=n,m=a;n.find(g=>g.value==f.value)||(p={id:n.length+1,name:f.name,value:f.value??f.name},h=[...n,p],i(h)),e.multi?a.find(g=>g.value==p.value)||(m=[...a,p],o(m)):(m=[p],o(m)),e.saveOptions&&e.saveOptions(h.map(g=>g.value),m.map(g=>g.value),!0),!e.multi&&f.type!=1&&e.hide()},[a,n]),c=(0,Of.useCallback)(f=>!(!e.editable&&!n.find(d=>d.value==f.value)||f.name.length==0),[n]);return Of.default.createElement(Kxe,{tags:e.multi?a:[],suggestions:n,ui:e.ui,ref:t,addKeyword:e.addKeyword,hide:e.hide,onDelete:s,wrapperClass:e.wrapperClass,onMoreOption:e.onMoreOption,onDeleteOption:l,onAddition:u,onValidate:c,onSelectSection:e.onSelectSection,defaultSuggestions:e.defaultOptions,placeholderText:e.placeholder??"",minQueryLength:0,onHover:e.onHover,showSections:e.showSections,sections:e.sections,maxSuggestionsLength:e.showAll?Math.min(50,e.options.length):25,suggestionsOnly:!e.searchable&&!e.editable,allowNew:e.editable,previewComponent:e.previewComponent,isDisclosure:e.isDisclosure})});Jxe.displayName="SelectMenu";var kG=Jxe;var Xo=Ae(Te());var sh=Ae(Te());function fv(){return([1e7]+-1e3+-4e3+-8e3+-1e11).replace(/[018]/g,e=>(e^crypto.getRandomValues(new Uint8Array(1))[0]&15>>e/4).toString(16))}var $r=(0,sh.createContext)({uid:"",readMode:!1,pathState:null,addToSpace:()=>null,removeFromSpace:()=>null}),Qs=e=>{let[t,r]=(0,sh.useState)(e.pathState??e.superstate.pathsIndex.get(e.path)),n=async o=>{let s=e.superstate.spacesIndex.get(o);s&&QS(e.superstate,s,t.path,-1)},i=o=>{lv(e.superstate,o,[t.path])},a=t?.readOnly||e.readMode;return(0,sh.useEffect)(()=>{let o=()=>{e.pathState||r(e.superstate.pathsIndex.get(e.path))},s=u=>{u.path==t?.path&&r(e.superstate.pathsIndex.get(u.newPath))},l=u=>{u.path==e.path&&o()};return o(),e.superstate.eventsDispatcher.addListener("pathStateUpdated",l),e.superstate.eventsDispatcher.addListener("superstateUpdated",o),e.superstate.eventsDispatcher.addListener("pathChanged",s),()=>{e.superstate.eventsDispatcher.removeListener("superstateUpdated",o),e.superstate.eventsDispatcher.removeListener("pathStateUpdated",l),e.superstate.eventsDispatcher.removeListener("pathChanged",s)}},[e.path]),sh.default.createElement($r.Provider,{value:{uid:fv(),readMode:a,pathState:t,addToSpace:n,removeFromSpace:i}},t?e.children:sh.default.createElement(sh.default.Fragment,null))};var zd=Ae(Te());var ur=(0,zd.createContext)({spaceInfo:null,readMode:!1,spaceState:null}),lh=e=>{let{pathState:t}=(0,zd.useContext)($r),r=(0,zd.useMemo)(()=>e.superstate.spacesIndex.get(t.path)?.space,[t]),[n,i]=(0,zd.useState)(null),a=n?.metadata.readMode??r?.readOnly;return(0,zd.useEffect)(()=>{let o=()=>{i(e.superstate.spacesIndex.get(t.path))},s=l=>{l.path==t.path&&o()};return o(),e.superstate.eventsDispatcher.addListener("spaceStateUpdated",s),()=>{e.superstate.eventsDispatcher.removeListener("spaceStateUpdated",s)}},[t]),zd.default.createElement(ur.Provider,{value:{spaceState:n,readMode:a,spaceInfo:r}},r&&e.children)};var Cl=Ae(Te());var dv=(0,Cl.forwardRef)((e,t)=>{let r=(0,Cl.useRef)(null),[n,i]=(0,Cl.useState)(!1),[a,o]=(0,Cl.useState)(!1),s=async u=>{let c=r.current,f=e.superstate.spaceManager.uriByString(e.path,e.source),d=e.superstate.pathsIndex.get(f.basePath),p=await e.superstate.spaceManager.pathExists(f.basePath),h=d?.type=="space"&&e.forceNote?e.superstate.spacesIndex.get(e.path)?.space.notePath:d||p?f.fullPath:null;if(h)i(!1),e.superstate.ui.openPath(h,!1,c);else if(u){let m=d?.type=="space"?(e.superstate.spacesIndex.get(e.path)?.space).folderPath:e.superstate.spaceManager.parentPathForPath(f.basePath);if(!m)return;let g=await e.superstate.spaceManager.createItemAtPath(m,"md",rf(e.path));i(!1),await e.superstate.ui.openPath(g,!1,c)}else{i(!0),o(!1);return}o(!0)},l=()=>{e.load?s():r?.current&&(r.current.innerHTML="")};return(0,Cl.useEffect)(()=>{l()},[e.load,e.path]),(0,Cl.useEffect)(()=>{let u=()=>{r.current&&!r.current.hasChildNodes()&&e.load&&!n&&s()};return e.superstate.ui.eventsDispatch.addListener("activeStateChanged",u),()=>{r.current=null,e.superstate.ui.eventsDispatch.removeListener("activeStateChanged",u)}},[]),Cl.default.createElement(Cl.default.Fragment,null,Cl.default.createElement("div",{className:`${e.classname??""} mk-flowspace-editor`,ref:r,onClick:u=>u.stopPropagation()}),n?Cl.default.createElement("div",{onClick:()=>s(!0),className:"mk-placeholder",style:{color:"var(--mk-ui-text-tertiary)"}},H.labels.notePlaceholder.replace("${1}",rf(e.path))):Cl.default.createElement(Cl.default.Fragment,null))});dv.displayName="FlowView";var Ne=e=>e.defaultView||window;var uh=(e,t)=>({name:"",type:2,value:e,onValueChange:t});var Rt={name:"",type:-1,disabled:!0},Ht=(e,t)=>({ui:e,multi:!1,value:[],editable:!1,options:t,searchable:!1,showAll:!0});var ewe=(e,t,r,n,i,a,o,s)=>{let l=[];l.push(uh(n?.name??"",u=>o(n.name,u))),l.push(Rt),l.push({name:H.menu.changePropertyType,icon:"ui//list",onClick:u=>{s(u,n.name)}}),n.type!="object"&&l.push({name:H.menu.syncToContext,icon:"ui//sync",onClick:u=>{a(n)}}),l.push({name:H.menu.deleteProperty,icon:"ui//trash",onClick:u=>{i(n)}}),e.ui.openMenu(t,Ht(e.ui,l),r)};var ao=Ae(Te());var Wy={view:"list",filters:[],listView:"",listItem:"",listGroup:"",listGroupProps:{},listViewProps:{},listItemProps:{},sort:[],groupBy:[],colsOrder:[],colsHidden:[],colsSize:{},colsCalc:{}};var ma=(0,ao.createContext)({frameSchemas:[],frames:[],tableData:null,saveFrame:()=>null,frameSchema:null,setFrameSchema:()=>null,saveSchema:()=>null,deleteSchema:()=>null,saveProperty:()=>!1,newProperty:()=>!1,delProperty:()=>null,getMDBData:()=>null,undoLastAction:()=>null,redoAction:()=>null}),pv=e=>{let[t,r]=(0,ao.useState)([]),[n,i]=(0,ao.useState)([]),[a,o]=(0,ao.useState)(null),s=(0,ao.useMemo)(()=>(a?.rows??[]).map(N=>Ao(N))??[],[a]),l=s.filter(N=>N.type=="frame"),[u,c]=(0,ao.useState)(null),[f,d]=(0,ao.useState)(null),p=(0,ao.useMemo)(()=>u?.[f?.id],[u,f]),{spaceInfo:h,readMode:m}=(0,ao.useContext)(ur),g=async N=>{if(N.primary)return;await e.superstate.spaceManager.deleteFrame(h.path,N.id);let D={...a,rows:a.rows.filter(P=>P.id!=N.id)};o(D)},A=async N=>{let P=!!a.rows.find(q=>q.id==N.id)?{...a,rows:a.rows.map(q=>q.id==N.id?Sp(N):q)}:{...a,rows:[...a.rows,Sp(N)]};h.readOnly||await e.superstate.spaceManager.saveFrameSchema(h.path,N.id,()=>Sp(N)),N.id==f?.id&&(d(N),c(q=>({...q,[N.id]:{...q[N.id],schema:Sp(N)}}))),o(P)};(0,ao.useEffect)(()=>{a&&x().then(N=>{N&&Object.keys(N).length>0&&c(N)})},[a]),(0,ao.useEffect)(()=>{a&&d(N=>{if(e.schema){let D=Ao(a.rows.find(P=>P.id==e.schema));return D||(e.schema==bp.id?Ao(bp):{id:Mi(eh(e.schema),a.rows.map(q=>q.id)),name:e.schema,type:"frame"})}else return N?Ao(a.rows?.find(D=>D.id==N.id)):e.contextSchema?Ao({id:Mi(e.contextSchema,a?.rows.map(D=>D.id)??[]),name:"Table",type:"view",predicate:JSON.stringify({...Wy,view:"table"}),def:JSON.stringify({db:e.contextSchema,icon:"ui//table"})}):Ao(bp);return N})},[a,e.contextSchema,e.schema]);let b=(0,ao.useCallback)(async()=>{!h||e.superstate.spaceManager.framesForSpace(h.path).then(N=>{N&&o(D=>({uniques:[],cols:["id","name","type","def","predicate","primary"],rows:N}))})},[e.schema,h]),v=(0,ao.useCallback)(async N=>{if(N.path==h.path){b();return}},[h,b]);(0,ao.useEffect)(()=>(e.superstate.eventsDispatcher.addListener("frameStateUpdated",v),()=>{e.superstate.eventsDispatcher.removeListener("frameStateUpdated",v)}),[v]);let x=async()=>await e.superstate.spaceManager.readAllFrames(h.path);(0,ao.useEffect)(()=>{b()},[h,e.schema]);let w=async(N,D=!0)=>{h.readOnly||(D&&(r(P=>[...P,N]),i([])),await e.superstate.spaceManager.saveFrame(h.path,N).then(P=>{c(q=>({...q,[N.schema.id]:N}))}))},S=()=>{if(t.length===0)return;let N=t.slice(0,-1),D=t[t.length-1];if(r(N),i(P=>[D,...P]),N.length>0){let P=N[N.length-1];w(P,!1)}},k=()=>{if(n.length===0)return;let N=n.slice(1),D=n[0];i(N),r(P=>[...P,D]),w(D,!1)},j=N=>{let D=p,P=D.cols.filter((z,I)=>z.name!=N.name),q={...D,cols:P??[]};w(q)},O=N=>C(N),C=(N,D)=>{let P={...N,name:ZA(N.name)},q=p;if(P.name=="")return e.superstate.ui.notify(H.notice.noPropertyName),!1;if(!D&&q.cols.find(L=>L.name.toLowerCase()==P.name.toLowerCase())||D&&D.name!=P.name&&q.cols.find(L=>L.name.toLowerCase()==P.name.toLowerCase()))return e.superstate.ui.notify(H.notice.duplicatePropertyName),!1;let z=D?q.cols.findIndex(L=>L.name==D.name):-1,I=z==-1?[...q.cols,P]:q.cols.map((L,_)=>_==z?P:L),T={...q,cols:I??[]};return w(T),!0};return ao.default.createElement(ma.Provider,{value:{frames:l,tableData:p,saveFrame:w,frameSchemas:s,saveSchema:A,deleteSchema:g,saveProperty:C,newProperty:O,delProperty:j,frameSchema:f,setFrameSchema:d,getMDBData:x,undoLastAction:S,redoAction:k}},e.children)};var ws=Ae(Te());var jQe={freq:{label:"Frequency",type:"option",value:{options:[{name:"Yearly",value:"YEARLY"},{name:"Monthly",value:"MONTHLY"},{name:"Weekly",value:"WEEKLY"},{name:"Daily",value:"DAILY"},{name:"Hourly",value:"HOURLY"},{name:"Minutely",value:"MINUTELY"},{name:"Secondly",value:"SECONDLY"}]}},until:{label:"Until",type:"date"},interval:{label:"Interval",type:"number"},count:{label:"Count",type:"number"},wkst:{label:"Week Start",type:"option",value:{options:[{name:"Monday",value:"MO"},{name:"Tuesday",value:"TU"},{name:"Wednesday",value:"WE"},{name:"Thursday",value:"TH"},{name:"Friday",value:"FR"},{name:"Saturday",value:"SA"},{name:"Sunday",value:"SU"}]}},byweekday:{label:"By Weekday",type:"option-multi",value:{alias:"Repeat Event",options:[{name:"Monday",value:"MO"},{name:"Tuesday",value:"TU"},{name:"Wednesday",value:"WE"},{name:"Thursday",value:"TH"},{name:"Friday",value:"FR"},{name:"Saturday",value:"SA"},{name:"Sunday",value:"SU"}]}}},twe={name:"repeat",type:"object",value:JSON.stringify({typeName:"Repeat",type:jQe})};var rwe=(e,t)=>{let r={};for(let n of t){let i=e.pathsIndex.get(n)?.metadata?.property;i&&Object.keys(i).forEach(a=>{r[a]=[...r[a]??[],yA(i[a],a)]})}return Object.keys(r).reduce((n,i)=>[...n,{name:i,type:r[i][0]}],[])};var Kr=Ae(Te());var NQe=0,MC=class{constructor(t,r){this.from=t,this.to=r}},wn=class{constructor(t={}){this.id=NQe++,this.perNode=!!t.perNode,this.deserialize=t.deserialize||(()=>{throw new Error("This node type doesn't define a deserialize function")})}add(t){if(this.perNode)throw new RangeError("Can't add per-node props to node types");return typeof t!="function"&&(t=Dl.match(t)),r=>{let n=t(r);return n===void 0?null:[this,n]}}};wn.closedBy=new wn({deserialize:e=>e.split(" ")});wn.openedBy=new wn({deserialize:e=>e.split(" ")});wn.group=new wn({deserialize:e=>e.split(" ")});wn.isolate=new wn({deserialize:e=>{if(e&&e!="rtl"&&e!="ltr"&&e!="auto")throw new RangeError("Invalid value for isolate: "+e);return e||"auto"}});wn.contextHash=new wn({perNode:!0});wn.lookAhead=new wn({perNode:!0});wn.mounted=new wn({perNode:!0});var i2=class{constructor(t,r,n){this.tree=t,this.overlay=r,this.parser=n}static get(t){return t&&t.props&&t.props[wn.mounted.id]}},TQe=Object.create(null),Dl=class{constructor(t,r,n,i=0){this.name=t,this.props=r,this.id=n,this.flags=i}static define(t){let r=t.props&&t.props.length?Object.create(null):TQe,n=(t.top?1:0)|(t.skipped?2:0)|(t.error?4:0)|(t.name==null?8:0),i=new Dl(t.name||"",r,t.id,n);if(t.props){for(let a of t.props)if(Array.isArray(a)||(a=a(i)),a){if(a[0].perNode)throw new RangeError("Can't store a per-node prop on a node type");r[a[0].id]=a[1]}}return i}prop(t){return this.props[t.id]}get isTop(){return(this.flags&1)>0}get isSkipped(){return(this.flags&2)>0}get isError(){return(this.flags&4)>0}get isAnonymous(){return(this.flags&8)>0}is(t){if(typeof t=="string"){if(this.name==t)return!0;let r=this.prop(wn.group);return r?r.indexOf(t)>-1:!1}return this.id==t}static match(t){let r=Object.create(null);for(let n in t)for(let i of n.split(" "))r[i]=t[n];return n=>{for(let i=n.prop(wn.group),a=-1;a<(i?i.length:0);a++){let o=r[a<0?n.name:i[a]];if(o)return o}}}};Dl.none=new Dl("",Object.create(null),0,8);var a2=class{constructor(t){this.types=t;for(let r=0;r0;for(let l=this.cursor(o|Ys.IncludeAnonymous);;){let u=!1;if(l.from<=a&&l.to>=i&&(!s&&l.type.isAnonymous||r(l)!==!1)){if(l.firstChild())continue;u=!0}for(;u&&n&&(s||!l.type.isAnonymous)&&n(l),!l.nextSibling();){if(!l.parent())return;u=!0}}}prop(t){return t.perNode?this.props?this.props[t.id]:void 0:this.type.prop(t)}get propValues(){let t=[];if(this.props)for(let r in this.props)t.push([+r,this.props[r]]);return t}balance(t={}){return this.children.length<=8?this:GG(Dl.none,this.children,this.positions,0,this.children.length,0,this.length,(r,n,i)=>new ha(this.type,r,n,i,this.propValues),t.makeTree||((r,n,i)=>new ha(Dl.none,r,n,i)))}static build(t){return _Qe(t)}};ha.empty=new ha(Dl.none,[],[],0);var jC=class{constructor(t,r){this.buffer=t,this.index=r}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}get pos(){return this.index}next(){this.index-=4}fork(){return new jC(this.buffer,this.index)}},fh=class{constructor(t,r,n){this.buffer=t,this.length=r,this.set=n}get type(){return Dl.none}toString(){let t=[];for(let r=0;r0));l=o[l+3]);return s}slice(t,r,n){let i=this.buffer,a=new Uint16Array(r-t),o=0;for(let s=t,l=0;s=t&&rt;case 1:return r<=t&&n>t;case 2:return n>t;case 4:return!0}}function NC(e,t,r,n){for(var i;e.from==e.to||(r<1?e.from>=t:e.from>t)||(r>-1?e.to<=t:e.to0?s.length:-1;t!=u;t+=r){let c=s[t],f=l[t]+o.from;if(!!owe(i,n,f,f+c.length)){if(c instanceof fh){if(a&Ys.ExcludeBuffers)continue;let d=c.findChild(0,c.buffer.length,r,n-f,i);if(d>-1)return new ch(new UG(o,c,t,f),null,d)}else if(a&Ys.IncludeAnonymous||!c.type.isAnonymous||VG(c)){let d;if(!(a&Ys.IgnoreMounts)&&(d=i2.get(c))&&!d.overlay)return new Tc(d.tree,f,t,o);let p=new Tc(c,f,t,o);return a&Ys.IncludeAnonymous||!p.type.isAnonymous?p:p.nextChild(r<0?c.children.length-1:0,r,n,i)}}}if(a&Ys.IncludeAnonymous||!o.type.isAnonymous||(o.index>=0?t=o.index+r:t=r<0?-1:o._parent._tree.children.length,o=o._parent,!o))return null}}get firstChild(){return this.nextChild(0,1,0,4)}get lastChild(){return this.nextChild(this._tree.children.length-1,-1,0,4)}childAfter(t){return this.nextChild(0,1,t,2)}childBefore(t){return this.nextChild(this._tree.children.length-1,-1,t,-2)}enter(t,r,n=0){let i;if(!(n&Ys.IgnoreOverlays)&&(i=i2.get(this._tree))&&i.overlay){let a=t-this.from;for(let{from:o,to:s}of i.overlay)if((r>0?o<=a:o=a:s>a))return new Tc(i.tree,i.overlay[0].from+this.from,-1,this)}return this.nextChild(0,1,t,r,n)}nextSignificantParent(){let t=this;for(;t.type.isAnonymous&&t._parent;)t=t._parent;return t}get parent(){return this._parent?this._parent.nextSignificantParent():null}get nextSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index+1,1,0,4):null}get prevSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index-1,-1,0,4):null}get tree(){return this._tree}toTree(){return this._tree}toString(){return this._tree.toString()}};function iwe(e,t,r,n){let i=e.cursor(),a=[];if(!i.firstChild())return a;if(r!=null){for(let o=!1;!o;)if(o=i.type.is(r),!i.nextSibling())return a}for(;;){if(n!=null&&i.type.is(n))return a;if(i.type.is(t)&&a.push(i.node),!i.nextSibling())return n==null?a:[]}}function zG(e,t,r=t.length-1){for(let n=e.parent;r>=0;n=n.parent){if(!n)return!1;if(!n.type.isAnonymous){if(t[r]&&t[r]!=n.name)return!1;r--}}return!0}var UG=class{constructor(t,r,n,i){this.parent=t,this.buffer=r,this.index=n,this.start=i}},ch=class extends k5{get name(){return this.type.name}get from(){return this.context.start+this.context.buffer.buffer[this.index+1]}get to(){return this.context.start+this.context.buffer.buffer[this.index+2]}constructor(t,r,n){super(),this.context=t,this._parent=r,this.index=n,this.type=t.buffer.set.types[t.buffer.buffer[n]]}child(t,r,n){let{buffer:i}=this.context,a=i.findChild(this.index+4,i.buffer[this.index+3],t,r-this.context.start,n);return a<0?null:new ch(this.context,this,a)}get firstChild(){return this.child(1,0,4)}get lastChild(){return this.child(-1,0,4)}childAfter(t){return this.child(1,t,2)}childBefore(t){return this.child(-1,t,-2)}enter(t,r,n=0){if(n&Ys.ExcludeBuffers)return null;let{buffer:i}=this.context,a=i.findChild(this.index+4,i.buffer[this.index+3],r>0?1:-1,t-this.context.start,r);return a<0?null:new ch(this.context,this,a)}get parent(){return this._parent||this.context.parent.nextSignificantParent()}externalSibling(t){return this._parent?null:this.context.parent.nextChild(this.context.index+t,t,0,4)}get nextSibling(){let{buffer:t}=this.context,r=t.buffer[this.index+3];return r<(this._parent?t.buffer[this._parent.index+3]:t.buffer.length)?new ch(this.context,this._parent,r):this.externalSibling(1)}get prevSibling(){let{buffer:t}=this.context,r=this._parent?this._parent.index+4:0;return this.index==r?this.externalSibling(-1):new ch(this.context,this._parent,t.findChild(r,this.index,-1,0,4))}get tree(){return null}toTree(){let t=[],r=[],{buffer:n}=this.context,i=this.index+4,a=n.buffer[this.index+3];if(a>i){let o=n.buffer[this.index+1];t.push(n.slice(i,a,o)),r.push(0)}return new ha(this.type,t,r,this.to-this.from)}toString(){return this.context.buffer.childString(this.index)}};function swe(e){if(!e.length)return null;let t=0,r=e[0];for(let a=1;ar.from||o.to=t){let s=new Tc(o.tree,o.overlay[0].from+a.from,-1,a);(i||(i=[n])).push(NC(s,t,r,!1))}}return i?swe(i):n}var TC=class{get name(){return this.type.name}constructor(t,r=0){if(this.mode=r,this.buffer=null,this.stack=[],this.index=0,this.bufferNode=null,t instanceof Tc)this.yieldNode(t);else{this._tree=t.context.parent,this.buffer=t.context;for(let n=t._parent;n;n=n._parent)this.stack.unshift(n.index);this.bufferNode=t,this.yieldBuf(t.index)}}yieldNode(t){return t?(this._tree=t,this.type=t.type,this.from=t.from,this.to=t.to,!0):!1}yieldBuf(t,r){this.index=t;let{start:n,buffer:i}=this.buffer;return this.type=r||i.set.types[i.buffer[t]],this.from=n+i.buffer[t+1],this.to=n+i.buffer[t+2],!0}yield(t){return t?t instanceof Tc?(this.buffer=null,this.yieldNode(t)):(this.buffer=t.context,this.yieldBuf(t.index,t.type)):!1}toString(){return this.buffer?this.buffer.buffer.childString(this.index):this._tree.toString()}enterChild(t,r,n){if(!this.buffer)return this.yield(this._tree.nextChild(t<0?this._tree._tree.children.length-1:0,t,r,n,this.mode));let{buffer:i}=this.buffer,a=i.findChild(this.index+4,i.buffer[this.index+3],t,r-this.buffer.start,n);return a<0?!1:(this.stack.push(this.index),this.yieldBuf(a))}firstChild(){return this.enterChild(1,0,4)}lastChild(){return this.enterChild(-1,0,4)}childAfter(t){return this.enterChild(1,t,2)}childBefore(t){return this.enterChild(-1,t,-2)}enter(t,r,n=this.mode){return this.buffer?n&Ys.ExcludeBuffers?!1:this.enterChild(1,t,r):this.yield(this._tree.enter(t,r,n))}parent(){if(!this.buffer)return this.yieldNode(this.mode&Ys.IncludeAnonymous?this._tree._parent:this._tree.parent);if(this.stack.length)return this.yieldBuf(this.stack.pop());let t=this.mode&Ys.IncludeAnonymous?this.buffer.parent:this.buffer.parent.nextSignificantParent();return this.buffer=null,this.yieldNode(t)}sibling(t){if(!this.buffer)return this._tree._parent?this.yield(this._tree.index<0?null:this._tree._parent.nextChild(this._tree.index+t,t,0,4,this.mode)):!1;let{buffer:r}=this.buffer,n=this.stack.length-1;if(t<0){let i=n<0?0:this.stack[n]+4;if(this.index!=i)return this.yieldBuf(r.findChild(i,this.index,-1,0,4))}else{let i=r.buffer[this.index+3];if(i<(n<0?r.buffer.length:r.buffer[this.stack[n]+3]))return this.yieldBuf(i)}return n<0?this.yield(this.buffer.parent.nextChild(this.buffer.index+t,t,0,4,this.mode)):!1}nextSibling(){return this.sibling(1)}prevSibling(){return this.sibling(-1)}atLastNode(t){let r,n,{buffer:i}=this;if(i){if(t>0){if(this.index-1)for(let a=r+t,o=t<0?-1:n._tree.children.length;a!=o;a+=t){let s=n._tree.children[a];if(this.mode&Ys.IncludeAnonymous||s instanceof fh||!s.type.isAnonymous||VG(s))return!1}return!0}move(t,r){if(r&&this.enterChild(t,0,4))return!0;for(;;){if(this.sibling(t))return!0;if(this.atLastNode(t)||!this.parent())return!1}}next(t=!0){return this.move(1,t)}prev(t=!0){return this.move(-1,t)}moveTo(t,r=0){for(;(this.from==this.to||(r<1?this.from>=t:this.from>t)||(r>-1?this.to<=t:this.to=0;){for(let o=t;o;o=o._parent)if(o.index==i){if(i==this.index)return o;r=o,n=a+1;break e}i=this.stack[--a]}}for(let i=n;i=0;a--){if(a<0)return zG(this.node,t,i);let o=n[r.buffer[this.stack[a]]];if(!o.isAnonymous){if(t[i]&&t[i]!=o.name)return!1;i--}}return!0}};function VG(e){return e.children.some(t=>t instanceof fh||!t.type.isAnonymous||VG(t))}function _Qe(e){var t;let{buffer:r,nodeSet:n,maxBufferLength:i=1024,reused:a=[],minRepeatType:o=n.types.length}=e,s=Array.isArray(r)?new jC(r,r.length):r,l=n.types,u=0,c=0;function f(w,S,k,j,O,C){let{id:N,start:D,end:P,size:q}=s,z=c;for(;q<0;)if(s.next(),q==-1){let Y=a[N];k.push(Y),j.push(D-w);return}else if(q==-3){u=N;return}else if(q==-4){c=N;return}else throw new RangeError(`Unrecognized record size: ${q}`);let I=l[N],T,L,_=D-w;if(P-D<=i&&(L=g(s.pos-S,O))){let Y=new Uint16Array(L.size-L.skip),oe=s.pos-L.size,te=Y.length;for(;s.pos>oe;)te=A(L.start,Y,te);T=new fh(Y,P-L.start,n),_=L.start-w}else{let Y=s.pos-q;s.next();let oe=[],te=[],Q=N>=o?N:-1,fe=0,Ie=P;for(;s.pos>Y;)Q>=0&&s.id==Q&&s.size>=0?(s.end<=Ie-i&&(h(oe,te,D,fe,s.end,Ie,Q,z),fe=oe.length,Ie=s.end),s.next()):C>2500?d(D,Y,oe,te):f(D,Y,oe,te,Q,C+1);if(Q>=0&&fe>0&&fe-1&&fe>0){let Se=p(I);T=GG(I,oe,te,0,oe.length,0,P-D,Se,Se)}else T=m(I,oe,te,P-D,z-P)}k.push(T),j.push(_)}function d(w,S,k,j){let O=[],C=0,N=-1;for(;s.pos>S;){let{id:D,start:P,end:q,size:z}=s;if(z>4)s.next();else{if(N>-1&&P=0;q-=3)D[z++]=O[q],D[z++]=O[q+1]-P,D[z++]=O[q+2]-P,D[z++]=z;k.push(new fh(D,O[2]-P,n)),j.push(P-w)}}function p(w){return(S,k,j)=>{let O=0,C=S.length-1,N,D;if(C>=0&&(N=S[C])instanceof ha){if(!C&&N.type==w&&N.length==j)return N;(D=N.prop(wn.lookAhead))&&(O=k[C]+N.length+D)}return m(w,S,k,j,O)}}function h(w,S,k,j,O,C,N,D){let P=[],q=[];for(;w.length>j;)P.push(w.pop()),q.push(S.pop()+k-O);w.push(m(n.types[N],P,q,C-O,D-C)),S.push(O-k)}function m(w,S,k,j,O=0,C){if(u){let N=[wn.contextHash,u];C=C?[N].concat(C):[N]}if(O>25){let N=[wn.lookAhead,O];C=C?[N].concat(C):[N]}return new ha(w,S,k,j,C)}function g(w,S){let k=s.fork(),j=0,O=0,C=0,N=k.end-i,D={size:0,start:0,skip:0};e:for(let P=k.pos-w;k.pos>P;){let q=k.size;if(k.id==S&&q>=0){D.size=j,D.start=O,D.skip=C,C+=4,j+=4,k.next();continue}let z=k.pos-q;if(q<0||z=o?4:0,T=k.start;for(k.next();k.pos>z;){if(k.size<0)if(k.size==-3)I+=4;else break e;else k.id>=o&&(I+=4);k.next()}O=T,j+=q,C+=I}return(S<0||j==w)&&(D.size=j,D.start=O,D.skip=C),D.size>4?D:void 0}function A(w,S,k){let{id:j,start:O,end:C,size:N}=s;if(s.next(),N>=0&&j4){let P=s.pos-(N-4);for(;s.pos>P;)k=A(w,S,k)}S[--k]=D,S[--k]=C-w,S[--k]=O-w,S[--k]=j}else N==-3?u=j:N==-4&&(c=j);return k}let b=[],v=[];for(;s.pos>0;)f(e.start||0,e.bufferStart||0,b,v,-1,0);let x=(t=e.length)!==null&&t!==void 0?t:b.length?v[0]+b[0].length:0;return new ha(l[e.topID],b.reverse(),v.reverse(),x)}var awe=new WeakMap;function E5(e,t){if(!e.isAnonymous||t instanceof fh||t.type!=e)return 1;let r=awe.get(t);if(r==null){r=1;for(let n of t.children){if(n.type!=e||!(n instanceof ha)){r=1;break}r+=E5(e,n)}awe.set(t,r)}return r}function GG(e,t,r,n,i,a,o,s,l){let u=0;for(let h=n;h=c)break;S+=k}if(v==x+1){if(S>c){let k=h[x];p(k.children,k.positions,0,k.children.length,m[x]+b);continue}f.push(h[x])}else{let k=m[v-1]+h[v-1].length-w;f.push(GG(e,h,m,x,v,w,k,null,l))}d.push(w+b-a)}}return p(t,r,n,i,0),(s||l)(f,d,o)}var dh=class{constructor(t,r,n,i,a=!1,o=!1){this.from=t,this.to=r,this.tree=n,this.offset=i,this.open=(a?1:0)|(o?2:0)}get openStart(){return(this.open&1)>0}get openEnd(){return(this.open&2)>0}static addTree(t,r=[],n=!1){let i=[new dh(0,t.length,t,0,!1,n)];for(let a of r)a.to>t.length&&i.push(a);return i}static applyChanges(t,r,n=128){if(!r.length)return t;let i=[],a=1,o=t.length?t[0]:null;for(let s=0,l=0,u=0;;s++){let c=s=n)for(;o&&o.from=d.from||f<=d.to||u){let p=Math.max(d.from,l)-u,h=Math.min(d.to,f)-u;d=p>=h?null:new dh(p,h,d.tree,d.offset+u,s>0,!!c)}if(d&&i.push(d),o.to>f)break;o=anew MC(i.from,i.to)):[new MC(0,0)]:[new MC(0,t.length)],this.createParse(t,r||[],n)}parse(t,r,n){let i=this.startParse(t,r,n);for(;;){let a=i.advance();if(a)return a}}},HG=class{constructor(t){this.string=t}get length(){return this.string.length}chunk(t){return this.string.slice(t)}get lineChunks(){return!1}read(t,r){return this.string.slice(t,r)}};var wKt=new wn({perNode:!0});var Sn=require("@codemirror/state"),on=require("@codemirror/view");var PQe=0,Ud=class{constructor(t,r,n){this.set=t,this.base=r,this.modified=n,this.id=PQe++}static define(t){if(t?.base)throw new Error("Can not derive from a modified tag");let r=new Ud([],null,[]);if(r.set.push(r),t)for(let n of t.set)r.set.push(n);return r}static defineModifier(){let t=new o2;return r=>r.modified.indexOf(t)>-1?r:o2.get(r.base||r,r.modified.concat(t).sort((n,i)=>n.id-i.id))}},IQe=0,o2=class{constructor(){this.instances=[],this.id=IQe++}static get(t,r){if(!r.length)return t;let n=r[0].instances.find(s=>s.base==t&&BQe(r,s.modified));if(n)return n;let i=[],a=new Ud(i,t,r);for(let s of r)s.instances.push(a);let o=RQe(r);for(let s of t.set)if(!s.modified.length)for(let l of o)i.push(o2.get(s,l));return a}};function BQe(e,t){return e.length==t.length&&e.every((r,n)=>r==t[n])}function RQe(e){let t=[[]];for(let r=0;rn.length-r.length)}function cwe(e){let t=Object.create(null);for(let r in e){let n=e[r];Array.isArray(n)||(n=[n]);for(let i of r.split(" "))if(i){let a=[],o=2,s=i;for(let f=0;;){if(s=="..."&&f>0&&f+3==i.length){o=1;break}let d=/^"(?:[^"\\]|\\.)*?"|[^\/!]+/.exec(s);if(!d)throw new RangeError("Invalid path: "+i);if(a.push(d[0]=="*"?"":d[0][0]=='"'?JSON.parse(d[0]):d[0]),f+=d[0].length,f==i.length)break;let p=i[f++];if(f==i.length&&p=="!"){o=0;break}if(p!="/")throw new RangeError("Invalid path: "+i);s=i.slice(f)}let l=a.length-1,u=a[l];if(!u)throw new RangeError("Invalid path: "+i);let c=new s2(n,o,l>0?a.slice(0,l):null);t[u]=c.sort(t[u])}}return fwe.add(t)}var fwe=new wn,s2=class{constructor(t,r,n,i){this.tags=t,this.mode=r,this.context=n,this.next=i}get opaque(){return this.mode==0}get inherit(){return this.mode==1}sort(t){return!t||t.depth{let o=i;for(let s of a)for(let l of s.set){let u=r[l.id];if(u){o=o?o+" "+u:u;break}}return o},scope:n}}function $Qe(e,t){let r=null;for(let n of e){let i=n.style(t);i&&(r=r?r+" "+i:i)}return r}function dwe(e,t,r,n=0,i=e.length){let a=new YG(n,Array.isArray(t)?t:[t],r);a.highlightRange(e.cursor(),n,i,"",a.highlighters),a.flush(i)}var YG=class{constructor(t,r,n){this.at=t,this.highlighters=r,this.span=n,this.class=""}startSpan(t,r){r!=this.class&&(this.flush(t),t>this.at&&(this.at=t),this.class=r)}flush(t){t>this.at&&this.class&&this.span(this.at,t,this.class)}highlightRange(t,r,n,i,a){let{type:o,from:s,to:l}=t;if(s>=n||l<=r)return;o.isTop&&(a=this.highlighters.filter(p=>!p.scope||p.scope(o)));let u=i,c=qQe(t)||s2.empty,f=$Qe(a,c.tags);if(f&&(u&&(u+=" "),u+=f,c.mode==1&&(i+=(i?" ":"")+f)),this.startSpan(Math.max(r,s),u),c.opaque)return;let d=t.tree&&t.tree.prop(wn.mounted);if(d&&d.overlay){let p=t.node.enter(d.overlay[0].from+s,1),h=this.highlighters.filter(g=>!g.scope||g.scope(d.tree.type)),m=t.firstChild();for(let g=0,A=s;;g++){let b=g=v||!t.nextSibling())););if(!b||v>n)break;A=b.to+s,A>r&&(this.highlightRange(p.cursor(),Math.max(r,b.from+s),Math.min(n,A),"",h),this.startSpan(Math.min(n,A),u))}m&&t.parent()}else if(t.firstChild()){d&&(i="");do if(!(t.to<=r)){if(t.from>=n)break;this.highlightRange(t,r,n,i,a),this.startSpan(Math.min(n,t.to),u)}while(t.nextSibling());t.parent()}}};function qQe(e){let t=e.type.prop(fwe);for(;t&&t.context&&!e.matchContext(t.context);)t=t.next;return t||null}var Nt=Ud.define,C5=Nt(),mv=Nt(),lwe=Nt(mv),uwe=Nt(mv),hv=Nt(),D5=Nt(hv),QG=Nt(hv),hh=Nt(),Hy=Nt(hh),ph=Nt(),mh=Nt(),ZG=Nt(),_C=Nt(ZG),O5=Nt(),qe={comment:C5,lineComment:Nt(C5),blockComment:Nt(C5),docComment:Nt(C5),name:mv,variableName:Nt(mv),typeName:lwe,tagName:Nt(lwe),propertyName:uwe,attributeName:Nt(uwe),className:Nt(mv),labelName:Nt(mv),namespace:Nt(mv),macroName:Nt(mv),literal:hv,string:D5,docString:Nt(D5),character:Nt(D5),attributeValue:Nt(D5),number:QG,integer:Nt(QG),float:Nt(QG),bool:Nt(hv),regexp:Nt(hv),escape:Nt(hv),color:Nt(hv),url:Nt(hv),keyword:ph,self:Nt(ph),null:Nt(ph),atom:Nt(ph),unit:Nt(ph),modifier:Nt(ph),operatorKeyword:Nt(ph),controlKeyword:Nt(ph),definitionKeyword:Nt(ph),moduleKeyword:Nt(ph),operator:mh,derefOperator:Nt(mh),arithmeticOperator:Nt(mh),logicOperator:Nt(mh),bitwiseOperator:Nt(mh),compareOperator:Nt(mh),updateOperator:Nt(mh),definitionOperator:Nt(mh),typeOperator:Nt(mh),controlOperator:Nt(mh),punctuation:ZG,separator:Nt(ZG),bracket:_C,angleBracket:Nt(_C),squareBracket:Nt(_C),paren:Nt(_C),brace:Nt(_C),content:hh,heading:Hy,heading1:Nt(Hy),heading2:Nt(Hy),heading3:Nt(Hy),heading4:Nt(Hy),heading5:Nt(Hy),heading6:Nt(Hy),contentSeparator:Nt(hh),list:Nt(hh),quote:Nt(hh),emphasis:Nt(hh),strong:Nt(hh),link:Nt(hh),monospace:Nt(hh),strikethrough:Nt(hh),inserted:Nt(),deleted:Nt(),changed:Nt(),invalid:Nt(),meta:O5,documentMeta:Nt(O5),annotation:Nt(O5),processingInstruction:Nt(O5),definition:Ud.defineModifier(),constant:Ud.defineModifier(),function:Ud.defineModifier(),standard:Ud.defineModifier(),local:Ud.defineModifier(),special:Ud.defineModifier()},kKt=XG([{tag:qe.link,class:"tok-link"},{tag:qe.heading,class:"tok-heading"},{tag:qe.emphasis,class:"tok-emphasis"},{tag:qe.strong,class:"tok-strong"},{tag:qe.keyword,class:"tok-keyword"},{tag:qe.atom,class:"tok-atom"},{tag:qe.bool,class:"tok-bool"},{tag:qe.url,class:"tok-url"},{tag:qe.labelName,class:"tok-labelName"},{tag:qe.inserted,class:"tok-inserted"},{tag:qe.deleted,class:"tok-deleted"},{tag:qe.literal,class:"tok-literal"},{tag:qe.string,class:"tok-string"},{tag:qe.number,class:"tok-number"},{tag:[qe.regexp,qe.escape,qe.special(qe.string)],class:"tok-string2"},{tag:qe.variableName,class:"tok-variableName"},{tag:qe.local(qe.variableName),class:"tok-variableName tok-local"},{tag:qe.definition(qe.variableName),class:"tok-variableName tok-definition"},{tag:qe.special(qe.variableName),class:"tok-variableName2"},{tag:qe.definition(qe.propertyName),class:"tok-propertyName tok-definition"},{tag:qe.typeName,class:"tok-typeName"},{tag:qe.namespace,class:"tok-namespace"},{tag:qe.className,class:"tok-className"},{tag:qe.macroName,class:"tok-macroName"},{tag:qe.propertyName,class:"tok-propertyName"},{tag:qe.operator,class:"tok-operator"},{tag:qe.comment,class:"tok-comment"},{tag:qe.meta,class:"tok-meta"},{tag:qe.invalid,class:"tok-invalid"},{tag:qe.punctuation,class:"tok-punctuation"}]);var KG="\u037C",pwe=typeof Symbol>"u"?"__"+KG:Symbol.for(KG),JG=typeof Symbol>"u"?"__styleSet"+Math.floor(Math.random()*1e8):Symbol("styleSet"),mwe=typeof globalThis<"u"?globalThis:typeof window<"u"?window:{},Gp=class{constructor(t,r){this.rules=[];let{finish:n}=r||{};function i(o){return/^@/.test(o)?[o]:o.split(/,\s*/)}function a(o,s,l,u){let c=[],f=/^@(\w+)\b/.exec(o[0]),d=f&&f[1]=="keyframes";if(f&&s==null)return l.push(o[0]+";");for(let p in s){let h=s[p];if(/&/.test(p))a(p.split(/,\s*/).map(m=>o.map(g=>m.replace(/&/,g))).reduce((m,g)=>m.concat(g)),h,l);else if(h&&typeof h=="object"){if(!f)throw new RangeError("The value of a property ("+p+") should be a primitive value.");a(i(p),h,c,d)}else h!=null&&c.push(p.replace(/_.*/,"").replace(/[A-Z]/g,m=>"-"+m.toLowerCase())+": "+h+";")}(c.length||d)&&l.push((n&&!f&&!u?o.map(n):o).join(", ")+" {"+c.join(" ")+"}")}for(let o in t)a(i(o),t[o],this.rules)}getRules(){return this.rules.join(` +For more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return pa.useEffect(()=>{e&&(document.getElementById(e)||console.error(r))},[r,e]),null},vGe="DialogDescriptionWarning",yGe=({contentRef:e,descriptionId:t})=>{let n=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${Kbe(vGe).contentName}}.`;return pa.useEffect(()=>{let i=e.current?.getAttribute("aria-describedby");t&&i&&(document.getElementById(t)||console.warn(n))},[n,e,t]),null},Jbe=Rbe,exe=qbe,txe=zbe,rxe=Ube,nxe=Wbe,ixe=Vbe,axe=Qbe,oxe=Zbe;var cxe=Ae(Te(),1),Lt=Ae(Te(),1);function xGe(e){if(!e||typeof document>"u")return;let t=document.head||document.getElementsByTagName("head")[0],r=document.createElement("style");r.type="text/css",t.appendChild(r),r.styleSheet?r.styleSheet.cssText=e:r.appendChild(document.createTextNode(e))}var ii={DURATION:.5,EASE:[.32,.72,0,1]},fxe=.4,dxe=Lt.default.createContext({drawerRef:{current:null},overlayRef:{current:null},scaleBackground:()=>{},onPress:()=>{},onRelease:()=>{},onDrag:()=>{},onNestedDrag:()=>{},onNestedOpenChange:()=>{},onNestedRelease:()=>{},openProp:void 0,dismissible:!1,handleOnly:!1,isOpen:!1,isDragging:!1,keyboardIsOpen:{current:!1},snapPointsOffset:null,snapPoints:null,modal:!1,shouldFade:!1,activeSnapPoint:null,onOpenChange:()=>{},setActiveSnapPoint:()=>{},visible:!1,closeDrawer:()=>{},setVisible:()=>{},direction:"bottom"}),m5=()=>{let e=Lt.default.useContext(dxe);if(!e)throw new Error("useDrawerContext must be used within a Drawer.Root");return e};function Ti(e,t,r,n=!1){if(!t||!(t instanceof HTMLElement))return;let i={};Object.entries(r).forEach(([a,o])=>{if(a.startsWith("--")){t.style.setProperty(a,o);return}i[a]=t.style[a],t.style[a]=o}),!n&&e.set(t,i)}function Ry(e,t,r){if(!t||!(t instanceof HTMLElement))return;let n=e.get(t);!n||(r?t.style[r]=n[r]:Object.entries(n).forEach(([i,a])=>{t.style[i]=a}))}var io=e=>{switch(e){case"top":case"bottom":return!0;case"left":case"right":return!1;default:return e}};function f5(e,t){if(!e)return null;let r=window.getComputedStyle(e),n=r.transform||r.webkitTransform||r.mozTransform,i=n.match(/^matrix3d\((.+)\)$/);return i?parseFloat(i[1].split(", ")[io(t)?13:12]):(i=n.match(/^matrix\((.+)\)$/),i?parseFloat(i[1].split(", ")[io(t)?5:4]):null)}function wGe(e){return 8*(Math.log(e+1)-2)}xGe("[vaul-drawer]{touch-action:none;will-change:transform;transition:transform .5s cubic-bezier(.32, .72, 0, 1)}[vaul-drawer][vaul-drawer-direction=bottom]{transform:translate3d(0,100%,0)}[vaul-drawer][vaul-drawer-direction=top]{transform:translate3d(0,-100%,0)}[vaul-drawer][vaul-drawer-direction=left]{transform:translate3d(-100%,0,0)}[vaul-drawer][vaul-drawer-direction=right]{transform:translate3d(100%,0,0)}.vaul-dragging .vaul-scrollable [vault-drawer-direction=top]{overflow-y:hidden!important}.vaul-dragging .vaul-scrollable [vault-drawer-direction=bottom]{overflow-y:hidden!important}.vaul-dragging .vaul-scrollable [vault-drawer-direction=left]{overflow-x:hidden!important}.vaul-dragging .vaul-scrollable [vault-drawer-direction=right]{overflow-x:hidden!important}[vaul-drawer][vaul-drawer-visible=true][vaul-drawer-direction=top]{transform:translate3d(0,var(--snap-point-height,0),0)}[vaul-drawer][vaul-drawer-visible=true][vaul-drawer-direction=bottom]{transform:translate3d(0,var(--snap-point-height,0),0)}[vaul-drawer][vaul-drawer-visible=true][vaul-drawer-direction=left]{transform:translate3d(var(--snap-point-height,0),0,0)}[vaul-drawer][vaul-drawer-visible=true][vaul-drawer-direction=right]{transform:translate3d(var(--snap-point-height,0),0,0)}[vaul-overlay]{opacity:0;transition:opacity .5s cubic-bezier(.32, .72, 0, 1)}[vaul-overlay][vaul-drawer-visible=true]{opacity:1}[vaul-drawer]::after{content:'';position:absolute;background:inherit;background-color:inherit}[vaul-drawer][vaul-drawer-direction=top]::after{top:initial;bottom:100%;left:0;right:0;height:200%}[vaul-drawer][vaul-drawer-direction=bottom]::after{top:100%;bottom:initial;left:0;right:0;height:200%}[vaul-drawer][vaul-drawer-direction=left]::after{left:initial;right:100%;top:0;bottom:0;width:200%}[vaul-drawer][vaul-drawer-direction=right]::after{left:100%;right:initial;top:0;bottom:0;width:200%}[vaul-handle]{display:block;position:relative;opacity:.8;margin-left:auto;margin-right:auto;height:5px;width:56px;border-radius:1rem;touch-action:pan-y;cursor:grab}[vaul-handle]:active,[vaul-handle]:hover{opacity:1}[vaul-handle]:active{cursor:grabbing}[vaul-handle-hitarea]{position:absolute;left:50%;top:50%;transform:translate(-50%,-50%);width:max(100%,2.75rem);height:max(100%,2.75rem);touch-action:inherit}[vaul-overlay][vaul-snap-points=true]:not([vaul-snap-points-overlay=true]):not([data-state=closed]){opacity:0}[vaul-overlay][vaul-snap-points-overlay=true]:not([vaul-drawer-visible=false]){opacity:1}@media (hover:hover) and (pointer:fine){[vaul-drawer]{user-select:none}}@media (pointer:fine){[vaul-handle-hitarea]:{width:100%;height:100%}}");function SGe(e,t){typeof e=="function"?e(t):e!=null&&(e.current=t)}function EGe(...e){return t=>e.forEach(r=>SGe(r,t))}function pxe(...e){return cxe.useCallback(EGe(...e),e)}var CC=null;function kGe({isOpen:e,modal:t,nested:r,hasBeenOpened:n,preventScrollRestoration:i,noBodyStyles:a}){let[o,s]=Lt.default.useState(()=>typeof window<"u"?window.location.href:""),l=Lt.default.useRef(0),u=Lt.default.useCallback(()=>{if(CC===null&&e&&!a){CC={position:document.body.style.position,top:document.body.style.top,left:document.body.style.left,height:document.body.style.height,right:"unset"};let{scrollX:f,innerHeight:d}=window;document.body.style.setProperty("position","fixed","important"),Object.assign(document.body.style,{top:`${-l.current}px`,left:`${-f}px`,right:"0px",height:"auto"}),window.setTimeout(()=>window.requestAnimationFrame(()=>{let p=d-window.innerHeight;p&&l.current>=d&&(document.body.style.top=`${-(l.current+p)}px`)}),300)}},[e]),c=Lt.default.useCallback(()=>{if(CC!==null&&!a){let f=-parseInt(document.body.style.top,10),d=-parseInt(document.body.style.left,10);Object.assign(document.body.style,CC),window.requestAnimationFrame(()=>{if(i&&o!==window.location.href){s(window.location.href);return}window.scrollTo(d,f)}),CC=null}},[o]);return Lt.default.useEffect(()=>{function f(){l.current=window.scrollY}return f(),window.addEventListener("scroll",f),()=>{window.removeEventListener("scroll",f)}},[]),Lt.default.useEffect(()=>{r||!n||(e?(!window.matchMedia("(display-mode: standalone)").matches&&u(),t||window.setTimeout(()=>{c()},500)):c())},[e,n,o,t,r,u,c]),{restorePositionSetting:c}}var CGe=typeof window<"u"?Lt.useLayoutEffect:Lt.useEffect;function wG(...e){return(...t)=>{for(let r of e)typeof r=="function"&&r(...t)}}function DGe(){return EG(/^Mac/)}function OGe(){return EG(/^iPhone/)}function MGe(){return EG(/^iPad/)||DGe()&&navigator.maxTouchPoints>1}function mxe(){return OGe()||MGe()}function EG(e){return typeof window<"u"&&window.navigator!=null?e.test(window.navigator.platform):void 0}var yG=typeof document<"u"&&window.visualViewport;function sxe(e){let t=window.getComputedStyle(e);return/(auto|scroll)/.test(t.overflow+t.overflowX+t.overflowY)}function hxe(e){for(sxe(e)&&(e=e.parentElement);e&&!sxe(e);)e=e.parentElement;return e||document.scrollingElement||document.documentElement}var jGe=new Set(["checkbox","radio","range","color","file","image","button","submit","reset"]),d5=0,bG;function NGe(e={}){let{isDisabled:t}=e;CGe(()=>{if(!t)return d5++,d5===1&&(mxe()?bG=FGe():bG=TGe()),()=>{d5--,d5===0&&bG()}},[t])}function TGe(){return wG(Axe(document.documentElement,"paddingRight",`${window.innerWidth-document.documentElement.clientWidth}px`))}function FGe(){let e,t=0,r=f=>{e=hxe(f.target),!(e===document.documentElement&&e===document.body)&&(t=f.changedTouches[0].pageY)},n=f=>{if(!e||e===document.documentElement||e===document.body){f.preventDefault();return}let d=f.changedTouches[0].pageY,p=e.scrollTop,h=e.scrollHeight-e.clientHeight;h!==0&&((p<=0&&d>t||p>=h&&d{let d=f.target;SG(d)&&d!==document.activeElement&&(f.preventDefault(),d.style.transform="translateY(-2000px)",d.focus(),requestAnimationFrame(()=>{d.style.transform=""}))},a=f=>{let d=f.target;SG(d)&&(d.style.transform="translateY(-2000px)",requestAnimationFrame(()=>{d.style.transform="",yG&&(yG.height{lxe(d)}):yG.addEventListener("resize",()=>lxe(d),{once:!0}))}))},o=()=>{window.scrollTo(0,0)},s=window.pageXOffset,l=window.pageYOffset,u=wG(Axe(document.documentElement,"paddingRight",`${window.innerWidth-document.documentElement.clientWidth}px`));window.scrollTo(0,0);let c=wG(DC(document,"touchstart",r,{passive:!1,capture:!0}),DC(document,"touchmove",n,{passive:!1,capture:!0}),DC(document,"touchend",i,{passive:!1,capture:!0}),DC(document,"focus",a,!0),DC(window,"scroll",o));return()=>{u(),c(),window.scrollTo(s,l)}}function Axe(e,t,r){let n=e.style[t];return e.style[t]=r,()=>{e.style[t]=n}}function DC(e,t,r,n){return e.addEventListener(t,r,n),()=>{e.removeEventListener(t,r,n)}}function lxe(e){let t=document.scrollingElement||document.documentElement;for(;e&&e!==t;){let r=hxe(e);if(r!==document.documentElement&&r!==document.body&&r!==e){let n=r.getBoundingClientRect().top,i=e.getBoundingClientRect().top,a=e.getBoundingClientRect().bottom,o=r.getBoundingClientRect().bottom;a>o&&(r.scrollTop+=i-n)}e=r.parentElement}}function SG(e){return e instanceof HTMLInputElement&&!jGe.has(e.type)||e instanceof HTMLTextAreaElement||e instanceof HTMLElement&&e.isContentEditable}function gxe(e){let t=Lt.default.useRef(e);return Lt.default.useEffect(()=>{t.current=e}),Lt.default.useMemo(()=>(...r)=>t.current==null?void 0:t.current.call(t,...r),[])}function _Ge({defaultProp:e,onChange:t}){let r=Lt.default.useState(e),[n]=r,i=Lt.default.useRef(n),a=gxe(t);return Lt.default.useEffect(()=>{i.current!==n&&(a(n),i.current=n)},[n,i,a]),r}function PGe({prop:e,defaultProp:t,onChange:r=()=>{}}){let[n,i]=_Ge({defaultProp:t,onChange:r}),a=e!==void 0,o=a?e:n,s=gxe(r),l=Lt.default.useCallback(u=>{if(a){let f=typeof u=="function"?u(e):u;f!==e&&s(f)}else i(u)},[a,e,i,s]);return[o,l]}function IGe({activeSnapPointProp:e,setActiveSnapPointProp:t,snapPoints:r,drawerRef:n,overlayRef:i,cacheRef:a,fadeFromIndex:o,onSnapPointChange:s,direction:l="bottom"}){let[u,c]=PGe({prop:e,defaultProp:r?.[0],onChange:t}),f=Lt.default.useMemo(()=>u===r?.[r.length-1]||null,[r,u]),d=r&&r.length>0&&(o||o===0)&&!Number.isNaN(o)&&r[o]===u||!r,p=Lt.default.useMemo(()=>r?.findIndex(x=>x===u),[r,u]),h=Lt.default.useMemo(()=>{var x;return(x=r?.map(w=>{let S=typeof window<"u",k=typeof w=="string",j=0;if(k&&(j=parseInt(w,10)),io(l)){let C=k?j:S?w*window.innerHeight:0;return S?l==="bottom"?window.innerHeight-C:-window.innerHeight+C:C}let O=k?j:S?w*window.innerWidth:0;return S?l==="right"?window.innerWidth-O:-window.innerWidth+O:O}))!=null?x:[]},[r]),m=Lt.default.useMemo(()=>p!==null?h?.[p]:null,[h,p]),g=Lt.default.useCallback(x=>{var w;let S=(w=h?.findIndex(k=>k===x))!=null?w:null;s(S),Ti(a.current,n.current,{transition:`transform ${ii.DURATION}s cubic-bezier(${ii.EASE.join(",")})`,transform:io(l)?`translate3d(0, ${x}px, 0)`:`translate3d(${x}px, 0, 0)`}),h&&S!==h.length-1&&S!==o?Ti(a.current,i.current,{transition:`opacity ${ii.DURATION}s cubic-bezier(${ii.EASE.join(",")})`,opacity:"0"}):Ti(a.current,i.current,{transition:`opacity ${ii.DURATION}s cubic-bezier(${ii.EASE.join(",")})`,opacity:"1"}),c(S!==null?r?.[S]:null)},[n.current,r,h,o,i,c]);Lt.default.useEffect(()=>{if(u||e){var x;let w=(x=r?.findIndex(S=>S===e||S===u))!=null?x:-1;h&&w!==-1&&typeof h[w]=="number"&&g(h[w])}},[u,e,r,h,g]);function A({draggedDistance:x,closeDrawer:w,velocity:S,dismissible:k}){if(o===void 0)return;let j=l==="bottom"||l==="right"?(m??0)-x:(m??0)+x,O=p===o-1,C=p===0,N=x>0;if(O&&Ti(a.current,i.current,{transition:`opacity ${ii.DURATION}s cubic-bezier(${ii.EASE.join(",")})`}),S>2&&!N){k?w():g(h[0]);return}if(S>2&&N&&h&&r){g(h[r.length-1]);return}let D=h?.reduce((q,z)=>typeof q!="number"||typeof z!="number"?q:Math.abs(z-j)fxe&&Math.abs(x)0&&f){g(h[r.length-1]);return}if(C&&q<0&&k&&w(),p===null)return;g(h[p+q]);return}g(D)}function b({draggedDistance:x}){if(m===null)return;let w=l==="bottom"||l==="right"?m-x:m+x;(l==="bottom"||l==="right")&&wh[h.length-1]||Ti(a.current,n.current,{transform:io(l)?`translate3d(0, ${w}px, 0)`:`translate3d(${w}px, 0, 0)`})}function v(x,w){if(!r||typeof p!="number"||!h||o===void 0)return null;let S=p===o-1;if(p>=o&&w)return 0;if(S&&!w)return 1;if(!d&&!S)return null;let j=S?p+1:p-1,O=S?h[j]-h[j-1]:h[j+1]-h[j],C=x/Math.abs(O);return S?1-C:C}return{isLastSnapPoint:f,activeSnapPoint:u,shouldFade:d,getPercentageDragged:v,setActiveSnapPoint:c,activeSnapPointIndex:p,onRelease:A,onDrag:b,snapPointsOffset:h}}var BGe=.25,RGe=100,p5=8,$y=16,uxe=26,xG="vaul-dragging";function vxe({open:e,onOpenChange:t,children:r,shouldScaleBackground:n,onDrag:i,onRelease:a,snapPoints:o,nested:s=!1,setBackgroundColorOnScale:l=!0,closeThreshold:u=BGe,scrollLockTimeout:c=RGe,dismissible:f=!0,handleOnly:d=!1,fadeFromIndex:p=o&&o.length-1,activeSnapPoint:h,setActiveSnapPoint:m,fixed:g,modal:A=!0,onClose:b,noBodyStyles:v,direction:x="bottom",preventScrollRestoration:w=!0,disablePreventScroll:S=!1}){var k;let[j=!1,O]=Lt.default.useState(!1),[C,N]=Lt.default.useState(!1),[D,P]=Lt.default.useState(!1),[q,z]=Lt.default.useState(!1),[I,T]=Lt.default.useState(!1),[L,_]=Lt.default.useState(!1),Y=Lt.default.useRef(null),oe=Lt.default.useRef(null),te=Lt.default.useRef(null),Q=Lt.default.useRef(null),fe=Lt.default.useRef(null),Ie=Lt.default.useRef(!1),Se=Lt.default.useRef(null),Oe=Lt.default.useRef(0),ve=Lt.default.useRef(!1),ye=Lt.default.useRef(0),me=Lt.default.useRef(null),ke=Lt.default.useRef(((k=me.current)==null?void 0:k.getBoundingClientRect().height)||0),$=Lt.default.useRef(0),ae=(0,Lt.useRef)(null),ce=Lt.default.useCallback(Ge=>{o&&Ge===ie.length-1&&(oe.current=new Date)},[]),{activeSnapPoint:U,activeSnapPointIndex:R,setActiveSnapPoint:J,onRelease:ee,snapPointsOffset:ie,onDrag:re,shouldFade:Ee,getPercentageDragged:Ce}=IGe({snapPoints:o,cacheRef:ae,activeSnapPointProp:h,setActiveSnapPointProp:m,drawerRef:me,fadeFromIndex:p,overlayRef:Y,onSnapPointChange:ce,direction:x});NGe({isDisabled:!j||I||!A||L||!C||S});let{restorePositionSetting:_e}=kGe({isOpen:j,modal:A,nested:s,hasBeenOpened:C,preventScrollRestoration:w,noBodyStyles:v});function he(){return(window.innerWidth-uxe)/window.innerWidth}function ze(Ge){var G;!f&&!o||me.current&&!me.current.contains(Ge.target)||(ke.current=((G=me.current)==null?void 0:G.getBoundingClientRect().height)||0,T(!0),te.current=new Date,mxe()&&window.addEventListener("touchend",()=>Ie.current=!1,{once:!0}),Ge.target.setPointerCapture(Ge.pointerId),Oe.current=io(x)?Ge.clientY:Ge.clientX)}function Ye(Ge,G){var ue;let Pe=Ge,De=(ue=window.getSelection())==null?void 0:ue.toString(),at=me.current?f5(me.current,x):null,ht=new Date;if(Pe.hasAttribute("data-vaul-no-drag")||Pe.closest("[data-vaul-no-drag]"))return!1;if(x==="right"||x==="left")return!0;if(oe.current&&ht.getTime()-oe.current.getTime()<500)return!1;if(at!==null&&(x==="bottom"?at>0:at<0))return!0;if(De&&De.length>0)return!1;if(fe.current&&ht.getTime()-fe.current.getTime()Pe.clientHeight){if(Pe.scrollTop!==0)return fe.current=new Date,!1;if(Pe.getAttribute("role")==="dialog")return!0}Pe=Pe.parentNode}return!0}function tt(Ge){if(!!me.current&&I){let G=x==="bottom"||x==="right"?1:-1,ue=(Oe.current-(io(x)?Ge.clientY:Ge.clientX))*G,Pe=ue>0,De=o&&!f&&!Pe;if(De&&R===0)return;let at=Math.abs(ue),ht=document.querySelector("[vaul-drawer-wrapper]"),Zt=at/ke.current,Wr=Ce(at,Pe);if(Wr!==null&&(Zt=Wr),De&&Zt>=1||!Ie.current&&!Ye(Ge.target,Pe))return;if(me.current.classList.add(xG),Ie.current=!0,Ti(ae.current,me.current,{transition:"none"}),Ti(ae.current,Y.current,{transition:"none"}),o&&re({draggedDistance:ue}),Pe&&!o){let tn=wGe(ue),ci=Math.min(tn*-1,0)*G;Ti(ae.current,me.current,{transform:io(x)?`translate3d(0, ${ci}px, 0)`:`translate3d(${ci}px, 0, 0)`});return}let en=1-Zt;if((Ee||p&&R===p-1)&&(i?.(Ge,Zt),Ti(ae.current,Y.current,{opacity:`${en}`,transition:"none"},!0)),ht&&Y.current&&n){let tn=Math.min(he()+Zt*(1-he()),1),ci=8-Zt*8,ns=Math.max(0,14-Zt*14);document.querySelectorAll("[vaul-drawer]").forEach(Pa=>{Pa!==me.current&&Ti(ae.current,Pa,{borderRadius:`${ci}px`,transform:io(x)?`scale(${tn}) translate3d(0, ${ns}px, 0)`:`scale(${tn}) translate3d(${ns}px, 0, 0)`,transition:"none"},!0)}),Ti(ae.current,ht,{borderRadius:`${ci}px`,transform:io(x)?`scale(${tn}) translate3d(0, ${ns}px, 0)`:`scale(${tn}) translate3d(${ns}px, 0, 0)`,transition:"none"},!0)}if(!o){let tn=at*G;Ti(ae.current,me.current,{transform:io(x)?`translate3d(0, ${tn}px, 0)`:`translate3d(${tn}px, 0, 0)`})}}}Lt.default.useEffect(()=>()=>{Ze(!1),_e()},[]),Lt.default.useEffect(()=>{var Ge;function G(){if(!me.current)return;let ue=document.activeElement;if(SG(ue)||ve.current){var Pe;let De=((Pe=window.visualViewport)==null?void 0:Pe.height)||0,at=window.innerHeight-De,ht=me.current.getBoundingClientRect().height||0;$.current||($.current=ht);let Zt=me.current.getBoundingClientRect().top;if(Math.abs(ye.current-at)>60&&(ve.current=!ve.current),o&&o.length>0&&ie&&R&&(at+=ie[R]||0),ye.current=at,ht>De||ve.current){let Wr=me.current.getBoundingClientRect().height,en=Wr;Wr>De&&(en=De-uxe),g?me.current.style.height=`${Wr-Math.max(at,0)}px`:me.current.style.height=`${Math.max(en,De-Zt)}px`}else me.current.style.height=`${$.current}px`;o&&o.length>0&&!ve.current?me.current.style.bottom="0px":me.current.style.bottom=`${Math.max(at,0)}px`}}return(Ge=window.visualViewport)==null||Ge.addEventListener("resize",G),()=>{var ue;return(ue=window.visualViewport)==null?void 0:ue.removeEventListener("resize",G)}},[R,o,ie]);function Ct(){!me.current||(Be(),b?.(),Ti(ae.current,me.current,{transform:io(x)?`translate3d(0, ${x==="bottom"?"100%":"-100%"}, 0)`:`translate3d(${x==="right"?"100%":"-100%"}, 0, 0)`,transition:`transform ${ii.DURATION}s cubic-bezier(${ii.EASE.join(",")})`}),Ti(ae.current,Y.current,{opacity:"0",transition:`opacity ${ii.DURATION}s cubic-bezier(${ii.EASE.join(",")})`}),Ze(!1),setTimeout(()=>{P(!1),O(!1)},300),setTimeout(()=>{o&&J(o[0])},ii.DURATION*1e3))}Lt.default.useEffect(()=>{if(!j&&n){let Ge=setTimeout(()=>{Ry(ae.current,document.body)},200);return()=>clearTimeout(Ge)}},[j,n]),Lt.default.useLayoutEffect(()=>{e?(O(!0),N(!0)):Ct()},[e]),Lt.default.useEffect(()=>{q&&t?.(j)},[j]),Lt.default.useEffect(()=>{ae.current=new WeakMap,z(!0)},[]);function we(){if(!me.current)return;let Ge=document.querySelector("[vaul-drawer-wrapper]"),G=f5(me.current,x);Ti(ae.current,me.current,{transform:"translate3d(0, 0, 0)",transition:`transform ${ii.DURATION}s cubic-bezier(${ii.EASE.join(",")})`}),Ti(ae.current,Y.current,{transition:`opacity ${ii.DURATION}s cubic-bezier(${ii.EASE.join(",")})`,opacity:"1"}),n&&G&&G>0&&j&&(document.querySelectorAll("[vaul-drawer]").forEach(Pe=>{Pe!==me.current&&Ti(ae.current,Pe,{borderRadius:`${p5}px`,overflow:"hidden",...io(x)?{transform:`scale(${he()}) translate3d(0, 14px, 0)`,transformOrigin:"top"}:{transform:`scale(${he()}) translate3d(14px, 0, 0)`,transformOrigin:"left"},transitionProperty:"transform, border-radius",transitionDuration:`${ii.DURATION}s`,transitionTimingFunction:`cubic-bezier(${ii.EASE.join(",")})`},!0)}),Ti(ae.current,Ge,{borderRadius:`${p5}px`,overflow:"hidden",...io(x)?{transform:`scale(${he()}) translate3d(0, 14px, 0)`,transformOrigin:"top"}:{transform:`scale(${he()}) translate3d(14px, 0, 0)`,transformOrigin:"left"},transitionProperty:"transform, border-radius",transitionDuration:`${ii.DURATION}s`,transitionTimingFunction:`cubic-bezier(${ii.EASE.join(",")})`},!0))}function Be(){!I||!me.current||(me.current.classList.remove(xG),Ie.current=!1,T(!1),Q.current=new Date)}function Le(Ge){if(!I||!me.current)return;me.current.classList.remove(xG),Ie.current=!1,T(!1),Q.current=new Date;let G=f5(me.current,x);if(!Ye(Ge.target,!1)||!G||Number.isNaN(G)||te.current===null)return;let ue=Q.current.getTime()-te.current.getTime(),Pe=Oe.current-(io(x)?Ge.clientY:Ge.clientX),De=Math.abs(Pe)/ue;if(De>.05&&(_(!0),setTimeout(()=>{_(!1)},200)),o){ee({draggedDistance:Pe*(x==="bottom"||x==="right"?1:-1),closeDrawer:Ct,velocity:De,dismissible:f}),a?.(Ge,!0);return}if(x==="bottom"||x==="right"?Pe>0:Pe<0){we(),a?.(Ge,!0);return}if(De>fxe){Ct(),a?.(Ge,!1);return}var at;let ht=Math.min((at=me.current.getBoundingClientRect().height)!=null?at:0,window.innerHeight);if(G>=ht*u){Ct(),a?.(Ge,!1);return}a?.(Ge,!0),we()}Lt.default.useEffect(()=>{j&&(Ti(ae.current,document.documentElement,{scrollBehavior:"auto"}),oe.current=new Date,Ze(!0))},[j]),Lt.default.useEffect(()=>{if(me.current&&D){var Ge;let G=me==null||(Ge=me.current)==null?void 0:Ge.querySelectorAll("*");G?.forEach(ue=>{let Pe=ue;(Pe.scrollHeight>Pe.clientHeight||Pe.scrollWidth>Pe.clientWidth)&&Pe.classList.add("vaul-scrollable")})}},[D]);function Ze(Ge){let G=document.querySelector("[vaul-drawer-wrapper]");!G||!n||(Ge?(l&&(Ti(ae.current,document.body,{background:document.body.style.backgroundColor||document.body.style.background}),Ti(ae.current,document.body,{background:"black"},!0)),document.querySelectorAll("[vaul-drawer]").forEach(Pe=>{Pe!==me.current&&Ti(ae.current,Pe,{borderRadius:`${p5}px`,overflow:"hidden",...io(x)?{transform:`scale(${he()}) translate3d(0, 14px, 0)`,transformOrigin:"top"}:{transform:`scale(${he()}) translate3d(14px, 0, 0)`,transformOrigin:"left"},transitionProperty:"transform, border-radius",transitionDuration:`${ii.DURATION}s`,transitionTimingFunction:`cubic-bezier(${ii.EASE.join(",")})`})}),Ti(ae.current,G,{borderRadius:`${p5}px`,overflow:"hidden",...io(x)?{transform:`scale(${he()}) translate3d(0, 14px, 0)`,transformOrigin:"top"}:{transform:`scale(${he()}) translate3d(14px, 0, 0)`,transformOrigin:"left"},transitionProperty:"transform, border-radius",transitionDuration:`${ii.DURATION}s`,transitionTimingFunction:`cubic-bezier(${ii.EASE.join(",")})`})):(document.querySelectorAll("[vaul-drawer]").forEach(Pe=>{Pe!==me.current&&(Ry(ae.current,Pe,"overflow"),Ry(ae.current,Pe,"transform"),Ry(ae.current,Pe,"borderRadius"),Ti(ae.current,Pe,{transitionProperty:"transform, border-radius",transitionDuration:`${ii.DURATION}s`,transitionTimingFunction:`cubic-bezier(${ii.EASE.join(",")})`}))}),Ry(ae.current,G,"overflow"),Ry(ae.current,G,"transform"),Ry(ae.current,G,"borderRadius"),Ti(ae.current,G,{transitionProperty:"transform, border-radius",transitionDuration:`${ii.DURATION}s`,transitionTimingFunction:`cubic-bezier(${ii.EASE.join(",")})`})))}function He(Ge){let G=Ge?(window.innerWidth-$y)/window.innerWidth:1,ue=Ge?-$y:0;Se.current&&window.clearTimeout(Se.current),Ti(ae.current,me.current,{transition:`transform ${ii.DURATION}s cubic-bezier(${ii.EASE.join(",")})`,transform:`scale(${G}) translate3d(0, ${ue}px, 0)`}),!Ge&&me.current&&(Se.current=setTimeout(()=>{let Pe=f5(me.current,x);Ti(ae.current,me.current,{transition:"none",transform:io(x)?`translate3d(0, ${Pe}px, 0)`:`translate3d(${Pe}px, 0, 0)`})},500))}function Qe(Ge,G){if(G<0)return;let ue=io(x)?window.innerHeight:window.innerWidth,Pe=(ue-$y)/ue,De=Pe+G*(1-Pe),at=-$y+G*$y;Ti(ae.current,me.current,{transform:io(x)?`scale(${De}) translate3d(0, ${at}px, 0)`:`scale(${De}) translate3d(${at}px, 0, 0)`,transition:"none"})}function et(Ge,G){let ue=io(x)?window.innerHeight:window.innerWidth,Pe=G?(ue-$y)/ue:1,De=G?-$y:0;G&&Ti(ae.current,me.current,{transition:`transform ${ii.DURATION}s cubic-bezier(${ii.EASE.join(",")})`,transform:io(x)?`scale(${Pe}) translate3d(0, ${De}px, 0)`:`scale(${Pe}) translate3d(${De}px, 0, 0)`})}return Lt.default.createElement(Jbe,{modal:A,onOpenChange:Ge=>{if(e!==void 0){t?.(Ge);return}Ge?(N(!0),O(Ge)):Ct()},open:j},Lt.default.createElement(dxe.Provider,{value:{visible:D,activeSnapPoint:U,snapPoints:o,setActiveSnapPoint:J,drawerRef:me,overlayRef:Y,scaleBackground:Ze,onOpenChange:t,onPress:ze,setVisible:P,onRelease:Le,onDrag:tt,dismissible:f,handleOnly:d,isOpen:j,isDragging:I,shouldFade:Ee,closeDrawer:Ct,onNestedDrag:Qe,onNestedOpenChange:He,onNestedRelease:et,keyboardIsOpen:ve,openProp:e,modal:A,snapPointsOffset:ie,direction:x}},r))}var $Ge=250,qGe=120,yxe=Lt.default.forwardRef(function({preventCycle:e=!1,children:t,...r},n){let{visible:i,closeDrawer:a,isDragging:o,snapPoints:s,activeSnapPoint:l,setActiveSnapPoint:u,dismissible:c,handleOnly:f,onPress:d,onDrag:p}=m5(),h=Lt.default.useRef(null),m=Lt.default.useRef(!1);function g(){if(m.current){v();return}window.setTimeout(()=>{A()},qGe)}function A(){if(o||e||m.current){v();return}if(v(),(!s||s.length===0)&&c){a();return}if(l===s[s.length-1]&&c){a();return}let w=s.findIndex(k=>k===l);if(w===-1)return;let S=s[w+1];u(S)}function b(){h.current=window.setTimeout(()=>{m.current=!0},$Ge)}function v(){window.clearTimeout(h.current),m.current=!1}return Lt.default.createElement("div",{onClick:g,onDoubleClick:()=>{m.current=!0,a()},onPointerCancel:v,onPointerDown:x=>{f&&d(x),b()},onPointerMove:x=>{f&&p(x)},ref:n,"vaul-drawer-visible":i?"true":"false","vaul-handle":"","aria-hidden":"true",...r},Lt.default.createElement("span",{"vaul-handle-hitarea":"","aria-hidden":"true"},t))});yxe.displayName="Drawer.Handle";var bxe=Lt.default.forwardRef(function({children:e,...t},r){let{overlayRef:n,snapPoints:i,onRelease:a,shouldFade:o,isOpen:s,visible:l}=m5(),u=pxe(r,n),c=i&&i.length>0;return Lt.default.createElement(rxe,{onMouseUp:a,ref:u,"vaul-drawer-visible":l?"true":"false","vaul-overlay":"","vaul-snap-points":s&&c?"true":"false","vaul-snap-points-overlay":s&&o?"true":"false",...t})});bxe.displayName="Drawer.Overlay";var xxe=Lt.default.forwardRef(function({onOpenAutoFocus:e,onPointerDownOutside:t,onAnimationEnd:r,style:n,...i},a){let{drawerRef:o,onPress:s,onRelease:l,onDrag:u,dismissible:c,keyboardIsOpen:f,snapPointsOffset:d,visible:p,closeDrawer:h,modal:m,openProp:g,onOpenChange:A,setVisible:b,handleOnly:v,direction:x}=m5(),w=pxe(a,o),S=Lt.default.useRef(null),k=Lt.default.useRef(!1),j=(O,C,N=0)=>{if(k.current)return!0;let D=Math.abs(O.y),P=Math.abs(O.x),q=P>D,z=["bottom","right"].includes(C)?1:-1;if(C==="left"||C==="right"){if(!(O.x*z<0)&&P>=0&&P<=N)return q}else if(!(O.y*z<0)&&D>=0&&D<=N)return!q;return k.current=!0,!0};return Lt.default.useEffect(()=>{b(!0)},[]),Lt.default.createElement(nxe,{"vaul-drawer":"","vaul-drawer-direction":x,"vaul-drawer-visible":p?"true":"false",...i,ref:w,style:d&&d.length>0?{"--snap-point-height":`${d[0]}px`,...n}:n,onOpenAutoFocus:O=>{if(e)e(O);else{var C;O.preventDefault(),(C=o.current)==null||C.focus()}},onPointerDown:O=>{v||(i.onPointerDown==null||i.onPointerDown.call(i,O),S.current={x:O.clientX,y:O.clientY},s(O))},onPointerDownOutside:O=>{if(t?.(O),!m||O.defaultPrevented){O.preventDefault();return}f.current&&(f.current=!1),O.preventDefault(),A?.(!1),!(!c||g!==void 0)&&h()},onFocusOutside:O=>{if(!m){O.preventDefault();return}},onEscapeKeyDown:O=>{if(!m){O.preventDefault();return}},onPointerMove:O=>{if(v||(i.onPointerMove==null||i.onPointerMove.call(i,O),!S.current))return;let C=O.clientY-S.current.y,N=O.clientX-S.current.x,D=O.pointerType==="touch"?10:2;j({x:N,y:C},x,D)?u(O):(Math.abs(N)>D||Math.abs(C)>D)&&(S.current=null)},onPointerUp:O=>{i.onPointerUp==null||i.onPointerUp.call(i,O),S.current=null,k.current=!1,l(O)}})});xxe.displayName="Drawer.Content";function LGe({onDrag:e,onOpenChange:t,...r}){let{onNestedDrag:n,onNestedOpenChange:i,onNestedRelease:a}=m5();if(!n)throw new Error("Drawer.NestedRoot must be placed in another drawer");return Lt.default.createElement(vxe,{nested:!0,onClose:()=>{i(!1)},onDrag:(o,s)=>{n(o,s),e?.(o,s)},onOpenChange:o=>{o&&i(o),t?.(o)},onRelease:a,...r})}var qy={Root:vxe,NestedRoot:LGe,Content:xxe,Handle:yxe,Overlay:bxe,Trigger:exe,Portal:txe,Close:oxe,Title:ixe,Description:axe};var h5=e=>{let{newProps:t}=e,[r,n]=$d.default.useState(!0),i=(0,$d.useMemo)(()=>{let a=document.querySelectorAll(".mk-drawer-content"),o=0;return a.forEach(s=>{if(s instanceof HTMLElement){let l=s.getAttribute("data-drawer-index");l&&parseInt(l)>=o&&(o=parseInt(l)+1)}}),o},[]);return $d.default.createElement(qy.Root,{open:r,onOpenChange:a=>{n(a)},shouldScaleBackground:!0,onClose:()=>{n(!1),e.hide(!0)},noBodyStyles:!0},$d.default.createElement(qy.Portal,null,$d.default.createElement(qy.Content,{className:(0,wxe.default)("mk-drawer-content",e.className),"data-drawer-index":i,style:{"--drawer-index":i}},$d.default.createElement(qy.Handle,{className:"mk-drawer-handle"}),$d.default.createElement(qy.Title,{className:"mk-drawer-title",hidden:!(e.title?.length>0)},e.title),(0,$d.cloneElement)(e.fc,{hide:a=>{n(!1),e.hide(a)},...t})),$d.default.createElement(qy.Overlay,{className:"mk-drawer-overlay",style:{"--drawer-index":i}})))};var zGe=e=>{let t=qw(Pp(BA,{activationConstraint:{distance:10}}),Pp(RA,{activationConstraint:{delay:250,tolerance:5}}),Pp(B0,{coordinateGetter:LN})),r=qd.default.useRef(null),[n,i]=qd.default.useState(!1);return(0,qd.useEffect)(()=>{let a=s=>s.key=="Escape"?(e.hide(!0),!0):!1;function o(s){let l=c=>!!(c.classList.contains("mk-menu")||c.classList.contains("mk-menu-wrapper")||c.classList.contains("mk-modal")),u=s.target;for(;!l(u)&&u.parentElement;)u=u.parentElement;l(u)||r.current&&!r.current.contains(s.target)&&e.hide(!0)}return e.ui.inputManager.on("click",o),e.ui.inputManager.on("contextmenu",o),e.ui.inputManager.on("keydown",a),()=>{e.ui.inputManager.off("click",o),e.ui.inputManager.off("contextmenu",o),e.ui.inputManager.off("keydown",a)}},[e.hide]),(0,qd.useEffect)(()=>{if(!jc(e.ui))return;let a=new ResizeObserver(o=>{let s=o[0].target.getBoundingClientRect();i(!0)});return r.current&&a.observe(r.current),()=>a.disconnect()},[e.rect]),qd.default.createElement(Lw,{sensors:t,collisionDetection:IN,measuring:{droppable:{strategy:_p.Always}}},qd.default.createElement("div",{className:`mk-menu-wrapper ${!jc(e.ui)||n?"mk-ready":""}`,ref:r},e.children))},A5=e=>{let t=e.win.document.createElement("div"),r=jc(e.ui)&&!e.force;r?t.classList.add("mk-menu-mobile"):t.classList.add("mk-menu"),e.win.document.body.appendChild(t);let n=null,a=(()=>{let l=!1;return u=>{e.onHide&&!u&&e.onHide(),n&&n.hide(!0),!l&&(l=!0,setTimeout(()=>{o.unmount(),e.win.document.body.removeChild(t)},50))}})(),o=e.ui.createRoot(t),s=l=>{if(r){o.render(qd.default.createElement(h5,{fc:e.fc,hide:u=>a(u),newProps:l,className:(0,Sxe.default)("mk-drawer-menu",e.className)}));return}o.render(qd.default.createElement(zGe,{rect:e.rect,ui:e.ui,hide:u=>a(u),anchor:e.anchor},(0,qd.cloneElement)(e.fc,{hide:u=>a(u),onSubmenu:u=>{let c=u(e.rect,()=>{e.onHide&&e.onHide(),a(!0)});n&&n.hide(!0),n=c},...l})))};if(s(e.props),!r)return t.style.position="absolute",t.style.left=`${e.rect.x}px`,t.style.top=`${e.rect.y}px`,new ResizeObserver(u=>{let c=$ye(e.rect,u[0].target.getBoundingClientRect(),{width:e.win.innerWidth,height:e.win.innerHeight},e.anchor);t.style.left=`${c.x}px`,t.style.top=`${c.y}px`}).observe(t),{update:s,hide:a}};var Exe=Ae(Te());var kxe=(e,t,r,n,i,a)=>A5({ui:t.ui,rect:e,anchor:n,win:r,fc:Exe.default.createElement(kG,{...t}),onHide:i,className:t.searchable?"mk-combo-menu":"mk-select-menu",force:a});var Cxe=Ae(yi());var g5=class{constructor(){this.events={};this.handleMouseEvent=t=>{this.emit(t.type,t)};this.handleKeyEvent=t=>{this.emit(t.type,t)};this.addListeners()}on(t,r){this.events[t]||(this.events[t]=[]),this.events[t].push(r)}off(t,r){let n=this.events[t];n&&(this.events[t]=n.filter(i=>i!==r))}emit(t,r){let n=this.events[t];if(n){let i=!1;n.slice().reverse().forEach(a=>{i||(i=a(r))})}}addListeners(){window.addEventListener("mousedown",this.handleMouseEvent,!0),window.addEventListener("click",this.handleMouseEvent,!0),window.addEventListener("contextmenu",this.handleMouseEvent,!0),window.addEventListener("keydown",this.handleKeyEvent),window.addEventListener("keyup",this.handleKeyEvent)}removeListeners(){window.removeEventListener("mousedown",this.handleMouseEvent),window.removeEventListener("click",this.handleMouseEvent),window.removeEventListener("contextmenu",this.handleMouseEvent),window.removeEventListener("keydown",this.handleKeyEvent),window.removeEventListener("keyup",this.handleKeyEvent)}};var Ly=class{constructor(t,r){this.resetFunctions=[];this.addResetFunction=t=>{this.resetFunctions.push(t)};this.removeResetFunction=t=>{this.resetFunctions=this.resetFunctions.filter(r=>r!=t)};this.resetSelection=t=>{this.resetFunctions.forEach(r=>r(t))};this.eventsDispatch=new n0;this.activeState={};this.adapters=[];this.adapters=r??[],t.manager=this,this.mainFrame=t,this.inputManager=new g5}quickOpen(t,r,n,i){this.mainFrame.quickOpen(t,r,n,i)}availableViews(){return this.mainFrame.availableViews()}setActiveState(t){Cxe.default.isEqual(t,this.activeState)||(this.activeState=t,this.eventsDispatch.dispatchEvent("activeStateChanged",null))}setActivePath(t){this.activePath=t,this.eventsDispatch.dispatchEvent("activePathChanged",t)}setActiveSelection(t,r){this.eventsDispatch.dispatchEvent("activeSelectionChanged",{path:t,content:r})}mainMenu(t,r){this.mainFrame.mainMenu(t,r)}navigationHistory(){return this.mainFrame.navigationHistory()}allViews(){return[]}viewsByPath(t){return this.mainFrame.viewsByPath(t)}static create(t,r){return new Ly(t,r)}isEverViewOpen(){return this.mainFrame.isEverViewOpen()}getWarnings(){return this.mainFrame.getWarnings()}createRoot(t,r){return this.mainFrame.createRoot(t)}openMenu(t,r,n,i="right",a,o){return kxe(t,r,n,i,a,o)}openCustomMenu(t,r,n,i,a="right",o,s,l){return A5({rect:t,anchor:a,win:i,ui:this,fc:r,props:n,onHide:o,className:s,onSubmenu:l})}notify(t,r){if(r=="console"){console.log(t);return}this.mainFrame.openToast(t)}error(t){console.log(t)}openPalette(t,r,n){return this.mainFrame.openPalette(t,r,n)}openModal(t,r,n,i,a){return this.mainFrame.openModal(t,r,n,i,a)}openPopover(t,r){this.mainFrame.openPopover(t,r)}openPath(t,r,n,i){this.mainFrame.openPath(t,r,n,i)}primaryInteractionType(){return this.mainFrame.primaryInteractionType()}getScreenType(){return this.mainFrame.getScreenType()}getOS(){return this.mainFrame.getOS()}getSticker(t){return this.mainFrame.getSticker(t)}getPlaceholderImage(t){return Rye[t]}allStickers(){return this.mainFrame.allStickers()}getUIPath(t,r){return t?this.mainFrame.getUIPath(t,r):null}dragStarted(t,r){this.mainFrame.dragStarted(t,r)}dragEnded(t){this.mainFrame.dragEnded(t)}setDragLabel(t){this.mainFrame.setDragLabel(t)}};var Of=Ae(Te());function KA(e){return Array.isArray?Array.isArray(e):_xe(e)==="[object Array]"}var UGe=1/0;function WGe(e){if(typeof e=="string")return e;let t=e+"";return t=="0"&&1/e==-UGe?"-0":t}function HGe(e){return e==null?"":WGe(e)}function ah(e){return typeof e=="string"}function Txe(e){return typeof e=="number"}function VGe(e){return e===!0||e===!1||GGe(e)&&_xe(e)=="[object Boolean]"}function Fxe(e){return typeof e=="object"}function GGe(e){return Fxe(e)&&e!==null}function Df(e){return e!=null}function CG(e){return!e.trim().length}function _xe(e){return e==null?e===void 0?"[object Undefined]":"[object Null]":Object.prototype.toString.call(e)}var QGe="Incorrect 'index' type",YGe=e=>`Invalid value for key ${e}`,ZGe=e=>`Pattern length exceeds max of ${e}.`,XGe=e=>`Missing ${e} property in key`,KGe=e=>`Property 'weight' in key '${e}' must be a positive integer`,Dxe=Object.prototype.hasOwnProperty,DG=class{constructor(t){this._keys=[],this._keyMap={};let r=0;t.forEach(n=>{let i=Pxe(n);this._keys.push(i),this._keyMap[i.id]=i,r+=i.weight}),this._keys.forEach(n=>{n.weight/=r})}get(t){return this._keyMap[t]}keys(){return this._keys}toJSON(){return JSON.stringify(this._keys)}};function Pxe(e){let t=null,r=null,n=null,i=1,a=null;if(ah(e)||KA(e))n=e,t=Oxe(e),r=OG(e);else{if(!Dxe.call(e,"name"))throw new Error(XGe("name"));let o=e.name;if(n=o,Dxe.call(e,"weight")&&(i=e.weight,i<=0))throw new Error(KGe(o));t=Oxe(o),r=OG(o),a=e.getFn}return{path:t,id:r,weight:i,src:n,getFn:a}}function Oxe(e){return KA(e)?e:e.split(".")}function OG(e){return KA(e)?e.join("."):e}function JGe(e,t){let r=[],n=!1,i=(a,o,s)=>{if(!!Df(a))if(!o[s])r.push(a);else{let l=o[s],u=a[l];if(!Df(u))return;if(s===o.length-1&&(ah(u)||Txe(u)||VGe(u)))r.push(HGe(u));else if(KA(u)){n=!0;for(let c=0,f=u.length;ce.score===t.score?e.idx{this._keysMap[r.id]=n})}create(){this.isCreated||!this.docs.length||(this.isCreated=!0,ah(this.docs[0])?this.docs.forEach((t,r)=>{this._addString(t,r)}):this.docs.forEach((t,r)=>{this._addObject(t,r)}),this.norm.clear())}add(t){let r=this.size();ah(t)?this._addString(t,r):this._addObject(t,r)}removeAt(t){this.records.splice(t,1);for(let r=t,n=this.size();r{let o=i.getFn?i.getFn(t):this.getFn(t,i.path);if(!!Df(o)){if(KA(o)){let s=[],l=[{nestedArrIndex:-1,value:o}];for(;l.length;){let{nestedArrIndex:u,value:c}=l.pop();if(!!Df(c))if(ah(c)&&!CG(c)){let f={v:c,i:u,n:this.norm.get(c)};s.push(f)}else KA(c)&&c.forEach((f,d)=>{l.push({nestedArrIndex:d,value:f})})}n.$[a]=s}else if(ah(o)&&!CG(o)){let s={v:o,n:this.norm.get(o)};n.$[a]=s}}}),this.records.push(n)}toJSON(){return{keys:this.keys,records:this.records}}};function Ixe(e,t,{getFn:r=zr.getFn,fieldNormWeight:n=zr.fieldNormWeight}={}){let i=new OC({getFn:r,fieldNormWeight:n});return i.setKeys(e.map(Pxe)),i.setSources(t),i.create(),i}function oQe(e,{getFn:t=zr.getFn,fieldNormWeight:r=zr.fieldNormWeight}={}){let{keys:n,records:i}=e,a=new OC({getFn:t,fieldNormWeight:r});return a.setKeys(n),a.setIndexRecords(i),a}function v5(e,{errors:t=0,currentLocation:r=0,expectedLocation:n=0,distance:i=zr.distance,ignoreLocation:a=zr.ignoreLocation}={}){let o=t/e.length;if(a)return o;let s=Math.abs(n-r);return i?o+s/i:s?1:o}function sQe(e=[],t=zr.minMatchCharLength){let r=[],n=-1,i=-1,a=0;for(let o=e.length;a=t&&r.push([n,i]),n=-1)}return e[a-1]&&a-n>=t&&r.push([n,a-1]),r}var zy=32;function lQe(e,t,r,{location:n=zr.location,distance:i=zr.distance,threshold:a=zr.threshold,findAllMatches:o=zr.findAllMatches,minMatchCharLength:s=zr.minMatchCharLength,includeMatches:l=zr.includeMatches,ignoreLocation:u=zr.ignoreLocation}={}){if(t.length>zy)throw new Error(ZGe(zy));let c=t.length,f=e.length,d=Math.max(0,Math.min(n,f)),p=a,h=d,m=s>1||l,g=m?Array(f):[],A;for(;(A=e.indexOf(t,h))>-1;){let k=v5(t,{currentLocation:A,expectedLocation:d,distance:i,ignoreLocation:u});if(p=Math.min(k,p),h=A+c,m){let j=0;for(;j=C;q-=1){let z=q-1,I=r[e.charAt(z)];if(m&&(g[z]=+!!I),D[q]=(D[q+1]<<1|1)&I,k&&(D[q]|=(b[q+1]|b[q])<<1|1|b[q+1]),D[q]&w&&(v=v5(t,{errors:k,currentLocation:z,expectedLocation:d,distance:i,ignoreLocation:u}),v<=p)){if(p=v,h=z,h<=d)break;C=Math.max(1,2*d-h)}}if(v5(t,{errors:k+1,currentLocation:d,expectedLocation:d,distance:i,ignoreLocation:u})>p)break;b=D}let S={isMatch:h>=0,score:Math.max(.001,v)};if(m){let k=sQe(g,s);k.length?l&&(S.indices=k):S.isMatch=!1}return S}function uQe(e){let t={};for(let r=0,n=e.length;r{this.chunks.push({pattern:d,alphabet:uQe(d),startIndex:p})},f=this.pattern.length;if(f>zy){let d=0,p=f%zy,h=f-p;for(;d{let{isMatch:A,score:b,indices:v}=lQe(t,h,m,{location:i+g,distance:a,threshold:o,findAllMatches:s,minMatchCharLength:l,includeMatches:n,ignoreLocation:u});A&&(d=!0),f+=b,A&&v&&(c=[...c,...v])});let p={isMatch:d,score:d?f/this.chunks.length:1};return d&&n&&(p.indices=c),p}},oh=class{constructor(t){this.pattern=t}static isMultiMatch(t){return Mxe(t,this.multiRegex)}static isSingleMatch(t){return Mxe(t,this.singleRegex)}search(){}};function Mxe(e,t){let r=e.match(t);return r?r[1]:null}var MG=class extends oh{constructor(t){super(t)}static get type(){return"exact"}static get multiRegex(){return/^="(.*)"$/}static get singleRegex(){return/^=(.*)$/}search(t){let r=t===this.pattern;return{isMatch:r,score:r?0:1,indices:[0,this.pattern.length-1]}}},jG=class extends oh{constructor(t){super(t)}static get type(){return"inverse-exact"}static get multiRegex(){return/^!"(.*)"$/}static get singleRegex(){return/^!(.*)$/}search(t){let n=t.indexOf(this.pattern)===-1;return{isMatch:n,score:n?0:1,indices:[0,t.length-1]}}},NG=class extends oh{constructor(t){super(t)}static get type(){return"prefix-exact"}static get multiRegex(){return/^\^"(.*)"$/}static get singleRegex(){return/^\^(.*)$/}search(t){let r=t.startsWith(this.pattern);return{isMatch:r,score:r?0:1,indices:[0,this.pattern.length-1]}}},TG=class extends oh{constructor(t){super(t)}static get type(){return"inverse-prefix-exact"}static get multiRegex(){return/^!\^"(.*)"$/}static get singleRegex(){return/^!\^(.*)$/}search(t){let r=!t.startsWith(this.pattern);return{isMatch:r,score:r?0:1,indices:[0,t.length-1]}}},FG=class extends oh{constructor(t){super(t)}static get type(){return"suffix-exact"}static get multiRegex(){return/^"(.*)"\$$/}static get singleRegex(){return/^(.*)\$$/}search(t){let r=t.endsWith(this.pattern);return{isMatch:r,score:r?0:1,indices:[t.length-this.pattern.length,t.length-1]}}},_G=class extends oh{constructor(t){super(t)}static get type(){return"inverse-suffix-exact"}static get multiRegex(){return/^!"(.*)"\$$/}static get singleRegex(){return/^!(.*)\$$/}search(t){let r=!t.endsWith(this.pattern);return{isMatch:r,score:r?0:1,indices:[0,t.length-1]}}},b5=class extends oh{constructor(t,{location:r=zr.location,threshold:n=zr.threshold,distance:i=zr.distance,includeMatches:a=zr.includeMatches,findAllMatches:o=zr.findAllMatches,minMatchCharLength:s=zr.minMatchCharLength,isCaseSensitive:l=zr.isCaseSensitive,ignoreLocation:u=zr.ignoreLocation}={}){super(t),this._bitapSearch=new y5(t,{location:r,threshold:n,distance:i,includeMatches:a,findAllMatches:o,minMatchCharLength:s,isCaseSensitive:l,ignoreLocation:u})}static get type(){return"fuzzy"}static get multiRegex(){return/^"(.*)"$/}static get singleRegex(){return/^(.*)$/}search(t){return this._bitapSearch.searchIn(t)}},x5=class extends oh{constructor(t){super(t)}static get type(){return"include"}static get multiRegex(){return/^'"(.*)"$/}static get singleRegex(){return/^'(.*)$/}search(t){let r=0,n,i=[],a=this.pattern.length;for(;(n=t.indexOf(this.pattern,r))>-1;)r=n+a,i.push([n,r-1]);let o=!!i.length;return{isMatch:o,score:o?0:1,indices:i}}},PG=[MG,x5,NG,TG,_G,FG,jG,b5],jxe=PG.length,cQe=/ +(?=(?:[^\"]*\"[^\"]*\")*[^\"]*$)/,fQe="|";function dQe(e,t={}){return e.split(fQe).map(r=>{let n=r.trim().split(cQe).filter(a=>a&&!!a.trim()),i=[];for(let a=0,o=n.length;a!!(e[w5.AND]||e[w5.OR]),hQe=e=>!!e[$G.PATH],AQe=e=>!KA(e)&&Fxe(e)&&!qG(e),Nxe=e=>({[w5.AND]:Object.keys(e).map(t=>({[t]:e[t]}))});function Bxe(e,t,{auto:r=!0}={}){let n=i=>{let a=Object.keys(i),o=hQe(i);if(!o&&a.length>1&&!qG(i))return n(Nxe(i));if(AQe(i)){let l=o?i[$G.PATH]:a[0],u=o?i[$G.PATTERN]:i[l];if(!ah(u))throw new Error(YGe(l));let c={keyId:OG(l),pattern:u};return r&&(c.searcher=RG(u,t)),c}let s={children:[],operator:a[0]};return a.forEach(l=>{let u=i[l];KA(u)&&u.forEach(c=>{s.children.push(n(c))})}),s};return qG(e)||(e=Nxe(e)),n(e)}function gQe(e,{ignoreFieldNorm:t=zr.ignoreFieldNorm}){e.forEach(r=>{let n=1;r.matches.forEach(({key:i,norm:a,score:o})=>{let s=i?i.weight:null;n*=Math.pow(o===0&&s?Number.EPSILON:o,(s||1)*(t?1:a))}),r.score=n})}function vQe(e,t){let r=e.matches;t.matches=[],Df(r)&&r.forEach(n=>{if(!Df(n.indices)||!n.indices.length)return;let{indices:i,value:a}=n,o={indices:i,value:a};n.key&&(o.key=n.key.src),n.idx>-1&&(o.refIndex=n.idx),t.matches.push(o)})}function yQe(e,t){t.score=e.score}function bQe(e,t,{includeMatches:r=zr.includeMatches,includeScore:n=zr.includeScore}={}){let i=[];return r&&i.push(vQe),n&&i.push(yQe),e.map(a=>{let{idx:o}=a,s={item:t[o],refIndex:o};return i.length&&i.forEach(l=>{l(a,s)}),s})}var Gp=class{constructor(t,r={},n){this.options={...zr,...r},this.options.useExtendedSearch,this._keyStore=new DG(this.options.keys),this.setCollection(t,n)}setCollection(t,r){if(this._docs=t,r&&!(r instanceof OC))throw new Error(QGe);this._myIndex=r||Ixe(this.options.keys,this._docs,{getFn:this.options.getFn,fieldNormWeight:this.options.fieldNormWeight})}add(t){!Df(t)||(this._docs.push(t),this._myIndex.add(t))}remove(t=()=>!1){let r=[];for(let n=0,i=this._docs.length;n-1&&(l=l.slice(0,r)),bQe(l,this._docs,{includeMatches:n,includeScore:i})}_searchStringList(t){let r=RG(t,this.options),{records:n}=this._myIndex,i=[];return n.forEach(({v:a,i:o,n:s})=>{if(!Df(a))return;let{isMatch:l,score:u,indices:c}=r.searchIn(a);l&&i.push({item:a,idx:o,matches:[{score:u,value:a,norm:s,indices:c}]})}),i}_searchLogical(t){let r=Bxe(t,this.options),n=(s,l,u)=>{if(!s.children){let{keyId:f,searcher:d}=s,p=this._findMatches({key:this._keyStore.get(f),value:this._myIndex.getValueForItemAtKeyId(l,f),searcher:d});return p&&p.length?[{idx:u,item:l,matches:p}]:[]}let c=[];for(let f=0,d=s.children.length;f{if(Df(s)){let u=n(r,s,l);u.length&&(a[l]||(a[l]={idx:l,item:s,matches:[]},o.push(a[l])),u.forEach(({matches:c})=>{a[l].matches.push(...c)}))}}),o}_searchObjectList(t){let r=RG(t,this.options),{keys:n,records:i}=this._myIndex,a=[];return i.forEach(({$:o,i:s})=>{if(!Df(o))return;let l=[];n.forEach((u,c)=>{l.push(...this._findMatches({key:u,value:o[c],searcher:r}))}),l.length&&a.push({idx:s,item:o,matches:l})}),a}_findMatches({key:t,value:r,searcher:n}){if(!Df(r))return[];let i=[];if(KA(r))r.forEach(({v:a,i:o,n:s})=>{if(!Df(a))return;let{isMatch:l,score:u,indices:c}=n.searchIn(a);l&&i.push({score:u,key:t,value:a,idx:o,norm:s,indices:c})});else{let{v:a,n:o}=r,{isMatch:s,score:l,indices:u}=n.searchIn(a);s&&i.push({score:l,key:t,value:a,norm:o,indices:u})}return i}};Gp.version="7.0.0";Gp.createIndex=Ixe;Gp.parseIndex=oQe;Gp.config=zr;Gp.parseQuery=Bxe;mQe(IG);var Ei=Ae(Te());var kl=Ae(Te()),xQe={position:"absolute",width:0,height:0,visibility:"hidden",overflow:"scroll",whiteSpace:"pre"},wQe=["fontSize","fontFamily","fontWeight","fontStyle","letterSpacing","textTransform"],Rxe=(0,kl.forwardRef)((e,t)=>{let{classNames:r,inputAttributes:n,inputEventHandlers:i,index:a}=e,o=(0,kl.useRef)(null),[s,l]=(0,kl.useState)(null),[u,c]=(0,kl.useState)("");(0,kl.useEffect)(()=>{f(),d(),setTimeout(()=>{t.current?.focus()},50)},[]),(0,kl.useEffect)(()=>{u!==e.placeholderText&&(c(e.placeholderText),d())},[e.query,e.placeholderText]);let f=()=>{let p=window.getComputedStyle(t.current);wQe.forEach(h=>{o.current.style[h]=p[h]})},d=()=>{let p=Math.ceil(o.current.scrollWidth)+2;p!==s&&l(p)};return kl.default.createElement("div",{className:r.search},kl.default.createElement("div",{className:r.searchWrapper},kl.default.createElement("div",{className:"mk-icon-xsmall",dangerouslySetInnerHTML:{__html:e.ui.getSticker("ui//search")}}),kl.default.createElement("input",{...n,...i,ref:t,value:e.query,placeholder:u,className:r.searchInput,role:"combobox",style:{width:"100%"},onClick:p=>p.stopPropagation()}),kl.default.createElement("div",{ref:o,style:xQe},e.query||u),kl.default.createElement("span",null)))}),$xe=Rxe;Rxe.displayName="SelectMenuSearch";var LG=Ae(Te()),SQe=e=>LG.default.createElement("button",{type:"button",className:e.classNames.selectedTag,onClick:e.onDelete},LG.default.createElement("span",{className:e.classNames.selectedTagName},e.tag.name)),qxe=SQe;var Lxe=Ae(Te()),zxe=e=>Lxe.default.createElement("div",{className:"mk-sticker",dangerouslySetInnerHTML:{__html:e.ui.getSticker(e.sticker)}});var mi=Ae(Te());function Uxe(e){return e.replace(/[-\\^$*+?.()|[\]{}]/g,"\\$&")}function n2(e){return new RegExp(Uxe(e),"gi")}function Wxe(e){return new RegExp(`^${Uxe(e)}$`,"i")}function Hxe(e,t){let r=n2(t);return e?.replace(r,"$&")}var EQe=e=>{let t=(0,mi.useRef)(null);return(0,mi.useEffect)(()=>{e.active&&t?.current?.scrollIntoViewIfNeeded()},[e.active]),mi.default.createElement(mi.default.Fragment,null,e.item.icon&&mi.default.createElement(zxe,{ui:e.ui,sticker:e.item.icon}),mi.default.createElement("div",{ref:t,className:"mk-menu-options-inner"},e.item.onToggle&&mi.default.createElement("div",null,"Toggle"),mi.default.createElement("span",{style:e.item.color?.length>0?{background:e.item.color,padding:"2px 4px",borderRadius:"4px",color:e.item.color=="var(--mk-color-none)"?"inherit":"var(--mk-color-white)"}:{},dangerouslySetInnerHTML:{__html:e.query.length>0?Hxe(e.item.name,e.query):e.item.name}}),e.item.description&&mi.default.createElement("span",{"aria-label":e.item.description,className:"mk-menu-options-description",dangerouslySetInnerHTML:{__html:Hxe(e.item.description,e.query)}})),e.item.type==1&&mi.default.createElement("span",null,e.item.value),e.item.type==3&&e.item.value&&mi.default.createElement("div",{className:"mk-icon-small",dangerouslySetInnerHTML:{__html:e.ui.getSticker("ui//check")}}),e.item.onMoreOptions||e.onMoreOption&&e.item.removeable?mi.default.createElement("div",{onClick:r=>{r.stopPropagation(),r.preventDefault(),e.item.onMoreOptions?e.item.onMoreOptions(r):e.onMoreOption(r,e.item.value)},className:"mk-icon-small",dangerouslySetInnerHTML:{__html:e.ui.getSticker("ui//options")}}):null,e.item.removeable&&e.onDeleteOption&&mi.default.createElement("div",{onClick:r=>{r.stopPropagation(),r.preventDefault(),e.onDeleteOption(e.item.value)},className:"mk-icon-small",dangerouslySetInnerHTML:{__html:e.ui.getSticker("ui//close")}}),e.item.type==6&&mi.default.createElement("div",{className:"mk-icon-small",dangerouslySetInnerHTML:{__html:e.ui.getSticker("ui//chevron-right")}}))},kQe=e=>{let[t,r]=(0,mi.useState)(e.value);return mi.default.createElement("input",{type:"text",value:t,onKeyDown:n=>{n.key=="Enter"&&e.setValue(t)},onMouseDown:n=>n.stopPropagation(),onClick:n=>n.stopPropagation(),onFocus:n=>{n.stopPropagation()},onChange:n=>r(n.target.value),onBlur:n=>e.setValue(t)})},CQe=e=>{let t=e.options.map((r,n)=>{let i=`${e.id}-${n}`,a=r.type==-1?"mk-menu-separator":r.type==2?"mk-menu-input":r.type==5?"mk-menu-custom":`mk-menu-option ${e.index===n&&e.classNames.suggestionActive} ${r.disabled&&e.classNames.suggestionDisabled}`;return mi.default.createElement("div",{ref:o=>{e.refs?.current&&(e.refs.current[n]=o)},onMouseDown:o=>{e.isDisclosureMenu||o.stopPropagation(),o.preventDefault()},onClick:o=>{if(r.onSubmenu&&e.openSubmenu){let s=e.refs?.current[n].getBoundingClientRect();e.openSubmenu(r.onSubmenu(s,()=>{e.onHide&&e.onHide(),e.hide()}))}else r.onClick?(r.onClick(o),r.type!=6&&r.type!=1&&e.hide()):(r.type==null||r.type==0||r.type==1)&&(e.selectOption(r,{ctrlKey:o.ctrlKey,metaKey:o.metaKey,altKey:o.altKey,shiftKey:o.shiftKey,doubleClick:o.detail==2}),e.isDisclosureMenu||o.stopPropagation())},id:i,key:i,className:a},r.type==-1?mi.default.createElement(mi.default.Fragment,null):r.type==-2?mi.default.createElement("div",{className:"mk-menu-options-section"},r.name):r.type==2?mi.default.createElement(kQe,{value:r.value,setValue:r.onValueChange}):r.type==5?mi.default.createElement(r.fragment,{hide:e.hide,onSubmenu:o=>{if(e.openSubmenu){let s=e.refs?.current[n].getBoundingClientRect();e.openSubmenu(o(s,()=>{e.onHide&&e.onHide(),e.hide()}))}}}):mi.default.createElement(EQe,{ui:e.ui,item:r,query:e.query,active:n==e.index,onMoreOption:e.moreOption,onDeleteOption:e.deleteOption}))});return mi.default.createElement("div",{className:"mk-menu-suggestions"},t,e.query&&e.allowNew&&mi.default.createElement("div",{className:"mk-menu-option",onMouseDown:r=>r.preventDefault(),onClick:r=>e.selectOption({name:e.query,value:e.query},{ctrlKey:r.ctrlKey,metaKey:r.metaKey,altKey:r.altKey,shiftKey:r.shiftKey})},mi.default.createElement("div",{className:"mk-sticker",dangerouslySetInnerHTML:{__html:e.ui.getSticker("ui//plus")}}),mi.default.createElement("div",{className:"mk-menu-options-inner"},e.addKeyword??"Add"," ",e.query)))},Vxe=CQe;function Gxe(e,t){let r=e.querySelectorAll("a,button,input"),n=Array.prototype.findIndex.call(r,a=>a===t),i=r[n-1]||r[n+1];i&&i.focus()}var Uy={ENTER:"Enter",TAB:"Tab",BACKSPACE:"Backspace",UP_ARROW:"ArrowUp",UP_ARROW_COMPAT:"Up",DOWN_ARROW:"ArrowDown",DOWN_ARROW_COMPAT:"Down",LEFT_ARROW:"ArrowLeft",RIGHT_ARROW:"ArrowRight"},Yxe={root:"mk-menu-container",rootFocused:"mk-focused",selected:"mk-menu-input-wrapper",selectedTagWrapper:"mk-menu-selected-tag-wrapper",selectedTag:"mk-menu-selected-tag",selectedTagName:"mk-menu-selected-tag-name",search:"mk-menu-search",searchWrapper:"mk-menu-search-container",searchInput:"mk-menu-search-input",suggestions:"mk-menu-suggestions",suggestionActive:"mk-active",suggestionDisabled:"mk-disabled"},DQe={ui:null,id:"SelectMenu",tags:[],hide:()=>null,onHide:()=>null,suggestionsOnly:!1,placeholderText:H.labels.optionItemSelectPlaceholder,noSuggestionsText:null,newTagText:null,suggestions:[],suggestionsFilter:OQe,suggestionsTransform:null,classNames:Yxe,delimiters:[Uy.ENTER],minQueryLength:2,maxSuggestionsLength:8,inputAttributes:{}},Zxe=(e,t)=>e.findIndex(r=>Wxe(t).test(r.name)),Qxe=(e,t,r,n,i,a)=>{if(t.length>=e.minQueryLength){let o=Zxe(n,t),s=r===-1?o:r,l=s>-1?n[s]:null;i(l||{name:t,value:t},a)}};function OQe(e,t){return n2(t).test(e.name)}function MQe(e,t,r){let n,i=e.suggestions;r.length>0&&(i=e.suggestions.filter(s=>s.section==r));let a={threshold:0,ignoreLocation:!0,keys:["name","value"]},o=new Gp(i,a);return n=t.length==0?i:o.search(t).map(s=>s.item),n=n.slice(0,e.maxSuggestionsLength),e.newTagText&&Zxe(n,t)===-1?n.push({id:0,name:t,value:t}):e.noSuggestionsText&&n.length===0&&n.push({id:0,name:e.noSuggestionsText,value:"",disabled:!0}),n}var Xxe=Ei.default.forwardRef((e,t)=>{let r={...DQe,...e},[n,i]=(0,Ei.useState)([]),a=(0,Ei.useRef)([]),o=(0,Ei.useMemo)(()=>r.showSections?[{name:"All",value:""},...r.sections??kr(r.suggestions.map(te=>te.section)).filter(te=>te)]:[],[r.showSections,r.sections,r.suggestions]),s=(0,Ei.useRef)(null),[l,u]=(0,Ei.useState)(""),[c,f]=(0,Ei.useState)(""),[d,p]=(0,Ei.useState)(!1),[h,m]=(0,Ei.useState)(0),g=(0,Ei.useRef)(!1);(0,Ei.useEffect)(()=>{t&&(t.current=()=>d?!0:(s?.current?.focus(),p(!0),!1))},[d]),(0,Ei.useEffect)(()=>{if(c.length==0&&r.defaultSuggestions){i(r.defaultSuggestions);return}i(MQe(r,c,l))},[c,r.defaultSuggestions,l,r.suggestions]);let A=(0,Ei.useRef)(null),b=te=>{if(te.type==="compositionstart"){g.current=!0;return}if(te.type==="compositionend"){g.current=!1;return}let Q=te.target.value;r.onInput&&r.onInput(Q),Q.length===c.length+1&&r.delimiters.indexOf(c.slice(-1))>-1?Qxe(r,c,h,n,k,{}):Q!==c&&f(Q)},v=te=>{g.current||(r.delimiters.indexOf(te.key)>-1&&((c||h>-1)&&te.preventDefault(),Qxe(r,c,h,n,k,{ctrlKey:te.ctrlKey,metaKey:te.metaKey,altKey:te.altKey,shiftKey:te.shiftKey})),te.key!="Escape"&&(te.key===Uy.TAB&&q(te),te.key===Uy.BACKSPACE&&P(),(te.key===Uy.UP_ARROW||te.key===Uy.UP_ARROW_COMPAT)&&N(te),(te.key===Uy.DOWN_ARROW||te.key===Uy.DOWN_ARROW_COMPAT)&&D(te),te.stopPropagation()))},x=()=>{p(!1),r.onBlur&&r.onBlur()},w=()=>{p(!0),r.onFocus&&r.onFocus()},S=(te,Q)=>{A.current&&Gxe(A.current,Q.currentTarget),j(te)},k=(te,Q)=>{te.disabled||r.onValidate&&!r.onValidate(te)||(r.onAddition(te,Q),O())},j=te=>{r.onDelete(te)},O=()=>{f(""),m(-1)},C=()=>{m(-1)},N=te=>{te.preventDefault();let Q=n.length-1,fe=h<=0?Q:h-1;n[fe].disabled?m(fe<=0?Q:fe-1):m(fe)},D=te=>{te.preventDefault();let Q=n.length-1,fe=h>=Q?0:h+1;n[fe].disabled?m(fe>=Q?0:fe+1):m(fe)};function P(){c.length||j(r.tags.length-1)}function q(te){r.showSections&&(te.preventDefault(),te.stopPropagation(),u(Q=>{let fe=o.findIndex(Ie=>Ie.value==Q);return te.shiftKey?fe==0?Q:(r.onSelectSection&&r.onSelectSection(o[fe-1].value),o[fe-1].value):fe==o.length-1?Q:(r.onSelectSection&&r.onSelectSection(o[fe+1].value),o[fe+1].value)}))}let z=()=>{s.current.focus()},I={onChange:b,onCompositionEnd:b,onCompositionStart:b};(0,Ei.useEffect)(()=>(r.ui.inputManager.on("keydown",v),()=>{r.ui.inputManager.off("keydown",v)}),[n,h]);let T=d&&c.length>=r.minQueryLength,L=Object.assign({},Yxe,r.classNames);r.wrapperClass&&(L.root=`${L.root} ${r.wrapperClass}`);let _=[L.root];d&&_.push(L.rootFocused);let Y=(0,Ei.useRef)(null),oe=te=>{Y.current&&Y.current.hide(!0),Y.current=te};return Ei.default.createElement("div",{ref:A,className:_.join(" "),style:r.suggestionsOnly?{}:{"--mk-menu-max-height":"200px"}},r.suggestionsOnly?null:Ei.default.createElement("div",{className:L.selected,"aria-relevant":"additions removals","aria-live":"polite"},r.tags.length>0&&Ei.default.createElement("div",{className:L.selectedTagWrapper},r.tags.map((te,Q)=>Ei.default.createElement(qxe,{key:Q,tag:te,classNames:L,onDelete:fe=>S(Q,fe)}))),Ei.default.createElement($xe,{ui:r.ui,ref:s,query:c,index:h,id:r.id,currentSection:o.find(te=>te.value==l),classNames:L,inputAttributes:r.inputAttributes,inputEventHandlers:I,expanded:T,placeholderText:r.placeholderText})),r.showSections?Ei.default.createElement("div",{className:"mk-menu-sections"},o.map((te,Q)=>Ei.default.createElement("div",{key:Q,onClick:fe=>{fe.stopPropagation(),u(te.value)},className:`${l==te.value?"is-active":""} mk-menu-section`},te.name==""?H.labels.all:te.name))):Ei.default.createElement(Ei.default.Fragment,null),n.length||r.allowNew?Ei.default.createElement(Vxe,{ui:r.ui,hide:()=>{r.hide()},addKeyword:r.addKeyword,refs:a,options:n,query:c,setIndex:m,index:h,onHide:r.onHide,id:r.id,classNames:L,expanded:T,selectOption:k,allowNew:r.allowNew,moreOption:r.onMoreOption,deleteOption:r.onDeleteOption,isDisclosureMenu:r.isDisclosure,openSubmenu:oe}):null,r.previewComponent)});Xxe.displayName="SelectMenuComponent";var Kxe=Xxe;var Jxe=Of.default.forwardRef((e,t)=>{let r=e.options.map((f,d)=>({...f,id:d+1}));(0,Of.useEffect)(()=>{i(e.options.map((f,d)=>({...f,id:d+1})))},[e.options]);let[n,i]=(0,Of.useState)(r),[a,o]=(0,Of.useState)(e.value.map(f=>r.find(d=>d.value==f)??{id:0,name:f,value:f})),s=(0,Of.useCallback)(f=>{let d=a.filter((p,h)=>h!==f);o(d),e.saveOptions&&e.saveOptions(n.map(p=>p.value),d.map(p=>p.value),!1)},[n,a,e]),l=(0,Of.useCallback)(f=>{let d=n.filter(h=>h.value!=f),p=a.filter(h=>h.value!=f);i(d),o(p),e.removeOption&&e.removeOption(f),e.hide()},[a,n,e]),u=(0,Of.useCallback)((f,d)=>{let p=f,h=n,m=a;n.find(g=>g.value==f.value)||(p={id:n.length+1,name:f.name,value:f.value??f.name},h=[...n,p],i(h)),e.multi?a.find(g=>g.value==p.value)||(m=[...a,p],o(m)):(m=[p],o(m)),e.saveOptions&&e.saveOptions(h.map(g=>g.value),m.map(g=>g.value),!0),!e.multi&&f.type!=1&&e.hide()},[a,n]),c=(0,Of.useCallback)(f=>!(!e.editable&&!n.find(d=>d.value==f.value)||f.name.length==0),[n]);return Of.default.createElement(Kxe,{tags:e.multi?a:[],suggestions:n,ui:e.ui,ref:t,addKeyword:e.addKeyword,hide:e.hide,onDelete:s,wrapperClass:e.wrapperClass,onMoreOption:e.onMoreOption,onDeleteOption:l,onAddition:u,onValidate:c,onSelectSection:e.onSelectSection,defaultSuggestions:e.defaultOptions,placeholderText:e.placeholder??"",minQueryLength:0,onHover:e.onHover,showSections:e.showSections,sections:e.sections,maxSuggestionsLength:e.showAll?Math.min(50,e.options.length):25,suggestionsOnly:!e.searchable&&!e.editable,allowNew:e.editable,previewComponent:e.previewComponent,isDisclosure:e.isDisclosure})});Jxe.displayName="SelectMenu";var kG=Jxe;var Xo=Ae(Te());var sh=Ae(Te());function fv(){return([1e7]+-1e3+-4e3+-8e3+-1e11).replace(/[018]/g,e=>(e^crypto.getRandomValues(new Uint8Array(1))[0]&15>>e/4).toString(16))}var $r=(0,sh.createContext)({uid:"",readMode:!1,pathState:null,addToSpace:()=>null,removeFromSpace:()=>null}),Qs=e=>{let[t,r]=(0,sh.useState)(e.pathState??e.superstate.pathsIndex.get(e.path)),n=async o=>{let s=e.superstate.spacesIndex.get(o);s&&QS(e.superstate,s,t.path,-1)},i=o=>{lv(e.superstate,o,[t.path])},a=t?.readOnly||e.readMode;return(0,sh.useEffect)(()=>{let o=()=>{e.pathState||r(e.superstate.pathsIndex.get(e.path))},s=u=>{u.path==t?.path&&r(e.superstate.pathsIndex.get(u.newPath))},l=u=>{u.path==e.path&&o()};return o(),e.superstate.eventsDispatcher.addListener("pathStateUpdated",l),e.superstate.eventsDispatcher.addListener("superstateUpdated",o),e.superstate.eventsDispatcher.addListener("pathChanged",s),()=>{e.superstate.eventsDispatcher.removeListener("superstateUpdated",o),e.superstate.eventsDispatcher.removeListener("pathStateUpdated",l),e.superstate.eventsDispatcher.removeListener("pathChanged",s)}},[e.path]),sh.default.createElement($r.Provider,{value:{uid:fv(),readMode:a,pathState:t,addToSpace:n,removeFromSpace:i}},t?e.children:sh.default.createElement(sh.default.Fragment,null))};var zd=Ae(Te());var ur=(0,zd.createContext)({spaceInfo:null,readMode:!1,spaceState:null}),lh=e=>{let{pathState:t}=(0,zd.useContext)($r),r=(0,zd.useMemo)(()=>e.superstate.spacesIndex.get(t.path)?.space,[t]),[n,i]=(0,zd.useState)(null),a=n?.metadata.readMode??r?.readOnly;return(0,zd.useEffect)(()=>{let o=()=>{i(e.superstate.spacesIndex.get(t.path))},s=l=>{l.path==t.path&&o()};return o(),e.superstate.eventsDispatcher.addListener("spaceStateUpdated",s),()=>{e.superstate.eventsDispatcher.removeListener("spaceStateUpdated",s)}},[t]),zd.default.createElement(ur.Provider,{value:{spaceState:n,readMode:a,spaceInfo:r}},r&&e.children)};var Cl=Ae(Te());var dv=(0,Cl.forwardRef)((e,t)=>{let r=(0,Cl.useRef)(null),[n,i]=(0,Cl.useState)(!1),[a,o]=(0,Cl.useState)(!1),s=async u=>{let c=r.current,f=e.superstate.spaceManager.uriByString(e.path,e.source),d=e.superstate.pathsIndex.get(f.basePath),p=await e.superstate.spaceManager.pathExists(f.basePath),h=d?.type=="space"&&e.forceNote?e.superstate.spacesIndex.get(e.path)?.space.notePath:d||p?f.fullPath:null;if(h)i(!1),e.superstate.ui.openPath(h,!1,c);else if(u){let m=d?.type=="space"?(e.superstate.spacesIndex.get(e.path)?.space).folderPath:e.superstate.spaceManager.parentPathForPath(f.basePath);if(!m)return;let g=await e.superstate.spaceManager.createItemAtPath(m,"md",rf(e.path));i(!1),await e.superstate.ui.openPath(g,!1,c)}else{i(!0),o(!1);return}o(!0)},l=()=>{e.load?s():r?.current&&(r.current.innerHTML="")};return(0,Cl.useEffect)(()=>{l()},[e.load,e.path]),(0,Cl.useEffect)(()=>{let u=()=>{r.current&&!r.current.hasChildNodes()&&e.load&&!n&&s()};return e.superstate.ui.eventsDispatch.addListener("activeStateChanged",u),()=>{r.current=null,e.superstate.ui.eventsDispatch.removeListener("activeStateChanged",u)}},[]),Cl.default.createElement(Cl.default.Fragment,null,Cl.default.createElement("div",{className:`${e.classname??""} mk-flowspace-editor`,ref:r,onClick:u=>u.stopPropagation()}),n?Cl.default.createElement("div",{onClick:()=>s(!0),className:"mk-placeholder",style:{color:"var(--mk-ui-text-tertiary)"}},H.labels.notePlaceholder.replace("${1}",rf(e.path))):Cl.default.createElement(Cl.default.Fragment,null))});dv.displayName="FlowView";var Ne=e=>e.defaultView||window;var uh=(e,t)=>({name:"",type:2,value:e,onValueChange:t});var Rt={name:"",type:-1,disabled:!0},Ht=(e,t)=>({ui:e,multi:!1,value:[],editable:!1,options:t,searchable:!1,showAll:!0});var ewe=(e,t,r,n,i,a,o,s)=>{let l=[];l.push(uh(n?.name??"",u=>o(n.name,u))),l.push(Rt),l.push({name:H.menu.changePropertyType,icon:"ui//list",onClick:u=>{s(u,n.name)}}),n.type!="object"&&l.push({name:H.menu.syncToContext,icon:"ui//sync",onClick:u=>{a(n)}}),l.push({name:H.menu.deleteProperty,icon:"ui//trash",onClick:u=>{i(n)}}),e.ui.openMenu(t,Ht(e.ui,l),r)};var ao=Ae(Te());var Wy={view:"list",filters:[],listView:"",listItem:"",listGroup:"",listGroupProps:{},listViewProps:{},listItemProps:{},sort:[],groupBy:[],colsOrder:[],colsHidden:[],colsSize:{},colsCalc:{}};var ma=(0,ao.createContext)({frameSchemas:[],frames:[],tableData:null,saveFrame:()=>null,frameSchema:null,setFrameSchema:()=>null,saveSchema:()=>null,deleteSchema:()=>null,saveProperty:()=>!1,newProperty:()=>!1,delProperty:()=>null,getMDBData:()=>null,undoLastAction:()=>null,redoAction:()=>null}),pv=e=>{let[t,r]=(0,ao.useState)([]),[n,i]=(0,ao.useState)([]),[a,o]=(0,ao.useState)(null),s=(0,ao.useMemo)(()=>(a?.rows??[]).map(N=>Ao(N))??[],[a]),l=s.filter(N=>N.type=="frame"),[u,c]=(0,ao.useState)(null),[f,d]=(0,ao.useState)(null),p=(0,ao.useMemo)(()=>u?.[f?.id],[u,f]),{spaceInfo:h,readMode:m}=(0,ao.useContext)(ur),g=async N=>{if(N.primary)return;await e.superstate.spaceManager.deleteFrame(h.path,N.id);let D={...a,rows:a.rows.filter(P=>P.id!=N.id)};o(D)},A=async N=>{let P=!!a.rows.find(q=>q.id==N.id)?{...a,rows:a.rows.map(q=>q.id==N.id?Sp(N):q)}:{...a,rows:[...a.rows,Sp(N)]};h.readOnly||await e.superstate.spaceManager.saveFrameSchema(h.path,N.id,()=>Sp(N)),N.id==f?.id&&(d(N),c(q=>({...q,[N.id]:{...q[N.id],schema:Sp(N)}}))),o(P)};(0,ao.useEffect)(()=>{a&&x().then(N=>{N&&Object.keys(N).length>0&&c(N)})},[a]),(0,ao.useEffect)(()=>{a&&d(N=>{if(e.schema){let D=Ao(a.rows.find(P=>P.id==e.schema));return D||(e.schema==bp.id?Ao(bp):{id:Mi(eh(e.schema),a.rows.map(q=>q.id)),name:e.schema,type:"frame"})}else return N?Ao(a.rows?.find(D=>D.id==N.id)):e.contextSchema?Ao({id:Mi(e.contextSchema,a?.rows.map(D=>D.id)??[]),name:"Table",type:"view",predicate:JSON.stringify({...Wy,view:"table"}),def:JSON.stringify({db:e.contextSchema,icon:"ui//table"})}):Ao(bp);return N})},[a,e.contextSchema,e.schema]);let b=(0,ao.useCallback)(async()=>{!h||e.superstate.spaceManager.framesForSpace(h.path).then(N=>{N&&o(D=>({uniques:[],cols:["id","name","type","def","predicate","primary"],rows:N}))})},[e.schema,h]),v=(0,ao.useCallback)(async N=>{if(N.path==h.path){b();return}},[h,b]);(0,ao.useEffect)(()=>(e.superstate.eventsDispatcher.addListener("frameStateUpdated",v),()=>{e.superstate.eventsDispatcher.removeListener("frameStateUpdated",v)}),[v]);let x=async()=>await e.superstate.spaceManager.readAllFrames(h.path);(0,ao.useEffect)(()=>{b()},[h,e.schema]);let w=async(N,D=!0)=>{h.readOnly||(D&&(r(P=>[...P,N]),i([])),await e.superstate.spaceManager.saveFrame(h.path,N).then(P=>{c(q=>({...q,[N.schema.id]:N}))}))},S=()=>{if(t.length===0)return;let N=t.slice(0,-1),D=t[t.length-1];if(r(N),i(P=>[D,...P]),N.length>0){let P=N[N.length-1];w(P,!1)}},k=()=>{if(n.length===0)return;let N=n.slice(1),D=n[0];i(N),r(P=>[...P,D]),w(D,!1)},j=N=>{let D=p,P=D.cols.filter((z,I)=>z.name!=N.name),q={...D,cols:P??[]};w(q)},O=N=>C(N),C=(N,D)=>{let P={...N,name:ZA(N.name)},q=p;if(P.name=="")return e.superstate.ui.notify(H.notice.noPropertyName),!1;if(!D&&q.cols.find(L=>L.name.toLowerCase()==P.name.toLowerCase())||D&&D.name!=P.name&&q.cols.find(L=>L.name.toLowerCase()==P.name.toLowerCase()))return e.superstate.ui.notify(H.notice.duplicatePropertyName),!1;let z=D?q.cols.findIndex(L=>L.name==D.name):-1,I=z==-1?[...q.cols,P]:q.cols.map((L,_)=>_==z?P:L),T={...q,cols:I??[]};return w(T),!0};return ao.default.createElement(ma.Provider,{value:{frames:l,tableData:p,saveFrame:w,frameSchemas:s,saveSchema:A,deleteSchema:g,saveProperty:C,newProperty:O,delProperty:j,frameSchema:f,setFrameSchema:d,getMDBData:x,undoLastAction:S,redoAction:k}},e.children)};var ws=Ae(Te());var jQe={freq:{label:"Frequency",type:"option",value:{options:[{name:"Yearly",value:"YEARLY"},{name:"Monthly",value:"MONTHLY"},{name:"Weekly",value:"WEEKLY"},{name:"Daily",value:"DAILY"},{name:"Hourly",value:"HOURLY"},{name:"Minutely",value:"MINUTELY"},{name:"Secondly",value:"SECONDLY"}]}},until:{label:"Until",type:"date"},interval:{label:"Interval",type:"number"},count:{label:"Count",type:"number"},wkst:{label:"Week Start",type:"option",value:{options:[{name:"Monday",value:"MO"},{name:"Tuesday",value:"TU"},{name:"Wednesday",value:"WE"},{name:"Thursday",value:"TH"},{name:"Friday",value:"FR"},{name:"Saturday",value:"SA"},{name:"Sunday",value:"SU"}]}},byweekday:{label:"By Weekday",type:"option-multi",value:{alias:"Repeat Event",options:[{name:"Monday",value:"MO"},{name:"Tuesday",value:"TU"},{name:"Wednesday",value:"WE"},{name:"Thursday",value:"TH"},{name:"Friday",value:"FR"},{name:"Saturday",value:"SA"},{name:"Sunday",value:"SU"}]}}},twe={name:"repeat",type:"object",value:JSON.stringify({typeName:"Repeat",type:jQe})};var rwe=(e,t)=>{let r={};for(let n of t){let i=e.pathsIndex.get(n)?.metadata?.property;i&&Object.keys(i).forEach(a=>{r[a]=[...r[a]??[],yA(i[a],a)]})}return Object.keys(r).reduce((n,i)=>[...n,{name:i,type:r[i][0]}],[])};var Kr=Ae(Te());var NQe=0,MC=class{constructor(t,r){this.from=t,this.to=r}},wn=class{constructor(t={}){this.id=NQe++,this.perNode=!!t.perNode,this.deserialize=t.deserialize||(()=>{throw new Error("This node type doesn't define a deserialize function")})}add(t){if(this.perNode)throw new RangeError("Can't add per-node props to node types");return typeof t!="function"&&(t=Dl.match(t)),r=>{let n=t(r);return n===void 0?null:[this,n]}}};wn.closedBy=new wn({deserialize:e=>e.split(" ")});wn.openedBy=new wn({deserialize:e=>e.split(" ")});wn.group=new wn({deserialize:e=>e.split(" ")});wn.isolate=new wn({deserialize:e=>{if(e&&e!="rtl"&&e!="ltr"&&e!="auto")throw new RangeError("Invalid value for isolate: "+e);return e||"auto"}});wn.contextHash=new wn({perNode:!0});wn.lookAhead=new wn({perNode:!0});wn.mounted=new wn({perNode:!0});var i2=class{constructor(t,r,n){this.tree=t,this.overlay=r,this.parser=n}static get(t){return t&&t.props&&t.props[wn.mounted.id]}},TQe=Object.create(null),Dl=class{constructor(t,r,n,i=0){this.name=t,this.props=r,this.id=n,this.flags=i}static define(t){let r=t.props&&t.props.length?Object.create(null):TQe,n=(t.top?1:0)|(t.skipped?2:0)|(t.error?4:0)|(t.name==null?8:0),i=new Dl(t.name||"",r,t.id,n);if(t.props){for(let a of t.props)if(Array.isArray(a)||(a=a(i)),a){if(a[0].perNode)throw new RangeError("Can't store a per-node prop on a node type");r[a[0].id]=a[1]}}return i}prop(t){return this.props[t.id]}get isTop(){return(this.flags&1)>0}get isSkipped(){return(this.flags&2)>0}get isError(){return(this.flags&4)>0}get isAnonymous(){return(this.flags&8)>0}is(t){if(typeof t=="string"){if(this.name==t)return!0;let r=this.prop(wn.group);return r?r.indexOf(t)>-1:!1}return this.id==t}static match(t){let r=Object.create(null);for(let n in t)for(let i of n.split(" "))r[i]=t[n];return n=>{for(let i=n.prop(wn.group),a=-1;a<(i?i.length:0);a++){let o=r[a<0?n.name:i[a]];if(o)return o}}}};Dl.none=new Dl("",Object.create(null),0,8);var a2=class{constructor(t){this.types=t;for(let r=0;r0;for(let l=this.cursor(o|Ys.IncludeAnonymous);;){let u=!1;if(l.from<=a&&l.to>=i&&(!s&&l.type.isAnonymous||r(l)!==!1)){if(l.firstChild())continue;u=!0}for(;u&&n&&(s||!l.type.isAnonymous)&&n(l),!l.nextSibling();){if(!l.parent())return;u=!0}}}prop(t){return t.perNode?this.props?this.props[t.id]:void 0:this.type.prop(t)}get propValues(){let t=[];if(this.props)for(let r in this.props)t.push([+r,this.props[r]]);return t}balance(t={}){return this.children.length<=8?this:GG(Dl.none,this.children,this.positions,0,this.children.length,0,this.length,(r,n,i)=>new ha(this.type,r,n,i,this.propValues),t.makeTree||((r,n,i)=>new ha(Dl.none,r,n,i)))}static build(t){return _Qe(t)}};ha.empty=new ha(Dl.none,[],[],0);var jC=class{constructor(t,r){this.buffer=t,this.index=r}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}get pos(){return this.index}next(){this.index-=4}fork(){return new jC(this.buffer,this.index)}},fh=class{constructor(t,r,n){this.buffer=t,this.length=r,this.set=n}get type(){return Dl.none}toString(){let t=[];for(let r=0;r0));l=o[l+3]);return s}slice(t,r,n){let i=this.buffer,a=new Uint16Array(r-t),o=0;for(let s=t,l=0;s=t&&rt;case 1:return r<=t&&n>t;case 2:return n>t;case 4:return!0}}function NC(e,t,r,n){for(var i;e.from==e.to||(r<1?e.from>=t:e.from>t)||(r>-1?e.to<=t:e.to0?s.length:-1;t!=u;t+=r){let c=s[t],f=l[t]+o.from;if(!!owe(i,n,f,f+c.length)){if(c instanceof fh){if(a&Ys.ExcludeBuffers)continue;let d=c.findChild(0,c.buffer.length,r,n-f,i);if(d>-1)return new ch(new UG(o,c,t,f),null,d)}else if(a&Ys.IncludeAnonymous||!c.type.isAnonymous||VG(c)){let d;if(!(a&Ys.IgnoreMounts)&&(d=i2.get(c))&&!d.overlay)return new Tc(d.tree,f,t,o);let p=new Tc(c,f,t,o);return a&Ys.IncludeAnonymous||!p.type.isAnonymous?p:p.nextChild(r<0?c.children.length-1:0,r,n,i)}}}if(a&Ys.IncludeAnonymous||!o.type.isAnonymous||(o.index>=0?t=o.index+r:t=r<0?-1:o._parent._tree.children.length,o=o._parent,!o))return null}}get firstChild(){return this.nextChild(0,1,0,4)}get lastChild(){return this.nextChild(this._tree.children.length-1,-1,0,4)}childAfter(t){return this.nextChild(0,1,t,2)}childBefore(t){return this.nextChild(this._tree.children.length-1,-1,t,-2)}enter(t,r,n=0){let i;if(!(n&Ys.IgnoreOverlays)&&(i=i2.get(this._tree))&&i.overlay){let a=t-this.from;for(let{from:o,to:s}of i.overlay)if((r>0?o<=a:o=a:s>a))return new Tc(i.tree,i.overlay[0].from+this.from,-1,this)}return this.nextChild(0,1,t,r,n)}nextSignificantParent(){let t=this;for(;t.type.isAnonymous&&t._parent;)t=t._parent;return t}get parent(){return this._parent?this._parent.nextSignificantParent():null}get nextSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index+1,1,0,4):null}get prevSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index-1,-1,0,4):null}get tree(){return this._tree}toTree(){return this._tree}toString(){return this._tree.toString()}};function iwe(e,t,r,n){let i=e.cursor(),a=[];if(!i.firstChild())return a;if(r!=null){for(let o=!1;!o;)if(o=i.type.is(r),!i.nextSibling())return a}for(;;){if(n!=null&&i.type.is(n))return a;if(i.type.is(t)&&a.push(i.node),!i.nextSibling())return n==null?a:[]}}function zG(e,t,r=t.length-1){for(let n=e.parent;r>=0;n=n.parent){if(!n)return!1;if(!n.type.isAnonymous){if(t[r]&&t[r]!=n.name)return!1;r--}}return!0}var UG=class{constructor(t,r,n,i){this.parent=t,this.buffer=r,this.index=n,this.start=i}},ch=class extends k5{get name(){return this.type.name}get from(){return this.context.start+this.context.buffer.buffer[this.index+1]}get to(){return this.context.start+this.context.buffer.buffer[this.index+2]}constructor(t,r,n){super(),this.context=t,this._parent=r,this.index=n,this.type=t.buffer.set.types[t.buffer.buffer[n]]}child(t,r,n){let{buffer:i}=this.context,a=i.findChild(this.index+4,i.buffer[this.index+3],t,r-this.context.start,n);return a<0?null:new ch(this.context,this,a)}get firstChild(){return this.child(1,0,4)}get lastChild(){return this.child(-1,0,4)}childAfter(t){return this.child(1,t,2)}childBefore(t){return this.child(-1,t,-2)}enter(t,r,n=0){if(n&Ys.ExcludeBuffers)return null;let{buffer:i}=this.context,a=i.findChild(this.index+4,i.buffer[this.index+3],r>0?1:-1,t-this.context.start,r);return a<0?null:new ch(this.context,this,a)}get parent(){return this._parent||this.context.parent.nextSignificantParent()}externalSibling(t){return this._parent?null:this.context.parent.nextChild(this.context.index+t,t,0,4)}get nextSibling(){let{buffer:t}=this.context,r=t.buffer[this.index+3];return r<(this._parent?t.buffer[this._parent.index+3]:t.buffer.length)?new ch(this.context,this._parent,r):this.externalSibling(1)}get prevSibling(){let{buffer:t}=this.context,r=this._parent?this._parent.index+4:0;return this.index==r?this.externalSibling(-1):new ch(this.context,this._parent,t.findChild(r,this.index,-1,0,4))}get tree(){return null}toTree(){let t=[],r=[],{buffer:n}=this.context,i=this.index+4,a=n.buffer[this.index+3];if(a>i){let o=n.buffer[this.index+1];t.push(n.slice(i,a,o)),r.push(0)}return new ha(this.type,t,r,this.to-this.from)}toString(){return this.context.buffer.childString(this.index)}};function swe(e){if(!e.length)return null;let t=0,r=e[0];for(let a=1;ar.from||o.to=t){let s=new Tc(o.tree,o.overlay[0].from+a.from,-1,a);(i||(i=[n])).push(NC(s,t,r,!1))}}return i?swe(i):n}var TC=class{get name(){return this.type.name}constructor(t,r=0){if(this.mode=r,this.buffer=null,this.stack=[],this.index=0,this.bufferNode=null,t instanceof Tc)this.yieldNode(t);else{this._tree=t.context.parent,this.buffer=t.context;for(let n=t._parent;n;n=n._parent)this.stack.unshift(n.index);this.bufferNode=t,this.yieldBuf(t.index)}}yieldNode(t){return t?(this._tree=t,this.type=t.type,this.from=t.from,this.to=t.to,!0):!1}yieldBuf(t,r){this.index=t;let{start:n,buffer:i}=this.buffer;return this.type=r||i.set.types[i.buffer[t]],this.from=n+i.buffer[t+1],this.to=n+i.buffer[t+2],!0}yield(t){return t?t instanceof Tc?(this.buffer=null,this.yieldNode(t)):(this.buffer=t.context,this.yieldBuf(t.index,t.type)):!1}toString(){return this.buffer?this.buffer.buffer.childString(this.index):this._tree.toString()}enterChild(t,r,n){if(!this.buffer)return this.yield(this._tree.nextChild(t<0?this._tree._tree.children.length-1:0,t,r,n,this.mode));let{buffer:i}=this.buffer,a=i.findChild(this.index+4,i.buffer[this.index+3],t,r-this.buffer.start,n);return a<0?!1:(this.stack.push(this.index),this.yieldBuf(a))}firstChild(){return this.enterChild(1,0,4)}lastChild(){return this.enterChild(-1,0,4)}childAfter(t){return this.enterChild(1,t,2)}childBefore(t){return this.enterChild(-1,t,-2)}enter(t,r,n=this.mode){return this.buffer?n&Ys.ExcludeBuffers?!1:this.enterChild(1,t,r):this.yield(this._tree.enter(t,r,n))}parent(){if(!this.buffer)return this.yieldNode(this.mode&Ys.IncludeAnonymous?this._tree._parent:this._tree.parent);if(this.stack.length)return this.yieldBuf(this.stack.pop());let t=this.mode&Ys.IncludeAnonymous?this.buffer.parent:this.buffer.parent.nextSignificantParent();return this.buffer=null,this.yieldNode(t)}sibling(t){if(!this.buffer)return this._tree._parent?this.yield(this._tree.index<0?null:this._tree._parent.nextChild(this._tree.index+t,t,0,4,this.mode)):!1;let{buffer:r}=this.buffer,n=this.stack.length-1;if(t<0){let i=n<0?0:this.stack[n]+4;if(this.index!=i)return this.yieldBuf(r.findChild(i,this.index,-1,0,4))}else{let i=r.buffer[this.index+3];if(i<(n<0?r.buffer.length:r.buffer[this.stack[n]+3]))return this.yieldBuf(i)}return n<0?this.yield(this.buffer.parent.nextChild(this.buffer.index+t,t,0,4,this.mode)):!1}nextSibling(){return this.sibling(1)}prevSibling(){return this.sibling(-1)}atLastNode(t){let r,n,{buffer:i}=this;if(i){if(t>0){if(this.index-1)for(let a=r+t,o=t<0?-1:n._tree.children.length;a!=o;a+=t){let s=n._tree.children[a];if(this.mode&Ys.IncludeAnonymous||s instanceof fh||!s.type.isAnonymous||VG(s))return!1}return!0}move(t,r){if(r&&this.enterChild(t,0,4))return!0;for(;;){if(this.sibling(t))return!0;if(this.atLastNode(t)||!this.parent())return!1}}next(t=!0){return this.move(1,t)}prev(t=!0){return this.move(-1,t)}moveTo(t,r=0){for(;(this.from==this.to||(r<1?this.from>=t:this.from>t)||(r>-1?this.to<=t:this.to=0;){for(let o=t;o;o=o._parent)if(o.index==i){if(i==this.index)return o;r=o,n=a+1;break e}i=this.stack[--a]}}for(let i=n;i=0;a--){if(a<0)return zG(this.node,t,i);let o=n[r.buffer[this.stack[a]]];if(!o.isAnonymous){if(t[i]&&t[i]!=o.name)return!1;i--}}return!0}};function VG(e){return e.children.some(t=>t instanceof fh||!t.type.isAnonymous||VG(t))}function _Qe(e){var t;let{buffer:r,nodeSet:n,maxBufferLength:i=1024,reused:a=[],minRepeatType:o=n.types.length}=e,s=Array.isArray(r)?new jC(r,r.length):r,l=n.types,u=0,c=0;function f(w,S,k,j,O,C){let{id:N,start:D,end:P,size:q}=s,z=c;for(;q<0;)if(s.next(),q==-1){let Y=a[N];k.push(Y),j.push(D-w);return}else if(q==-3){u=N;return}else if(q==-4){c=N;return}else throw new RangeError(`Unrecognized record size: ${q}`);let I=l[N],T,L,_=D-w;if(P-D<=i&&(L=g(s.pos-S,O))){let Y=new Uint16Array(L.size-L.skip),oe=s.pos-L.size,te=Y.length;for(;s.pos>oe;)te=A(L.start,Y,te);T=new fh(Y,P-L.start,n),_=L.start-w}else{let Y=s.pos-q;s.next();let oe=[],te=[],Q=N>=o?N:-1,fe=0,Ie=P;for(;s.pos>Y;)Q>=0&&s.id==Q&&s.size>=0?(s.end<=Ie-i&&(h(oe,te,D,fe,s.end,Ie,Q,z),fe=oe.length,Ie=s.end),s.next()):C>2500?d(D,Y,oe,te):f(D,Y,oe,te,Q,C+1);if(Q>=0&&fe>0&&fe-1&&fe>0){let Se=p(I);T=GG(I,oe,te,0,oe.length,0,P-D,Se,Se)}else T=m(I,oe,te,P-D,z-P)}k.push(T),j.push(_)}function d(w,S,k,j){let O=[],C=0,N=-1;for(;s.pos>S;){let{id:D,start:P,end:q,size:z}=s;if(z>4)s.next();else{if(N>-1&&P=0;q-=3)D[z++]=O[q],D[z++]=O[q+1]-P,D[z++]=O[q+2]-P,D[z++]=z;k.push(new fh(D,O[2]-P,n)),j.push(P-w)}}function p(w){return(S,k,j)=>{let O=0,C=S.length-1,N,D;if(C>=0&&(N=S[C])instanceof ha){if(!C&&N.type==w&&N.length==j)return N;(D=N.prop(wn.lookAhead))&&(O=k[C]+N.length+D)}return m(w,S,k,j,O)}}function h(w,S,k,j,O,C,N,D){let P=[],q=[];for(;w.length>j;)P.push(w.pop()),q.push(S.pop()+k-O);w.push(m(n.types[N],P,q,C-O,D-C)),S.push(O-k)}function m(w,S,k,j,O=0,C){if(u){let N=[wn.contextHash,u];C=C?[N].concat(C):[N]}if(O>25){let N=[wn.lookAhead,O];C=C?[N].concat(C):[N]}return new ha(w,S,k,j,C)}function g(w,S){let k=s.fork(),j=0,O=0,C=0,N=k.end-i,D={size:0,start:0,skip:0};e:for(let P=k.pos-w;k.pos>P;){let q=k.size;if(k.id==S&&q>=0){D.size=j,D.start=O,D.skip=C,C+=4,j+=4,k.next();continue}let z=k.pos-q;if(q<0||z=o?4:0,T=k.start;for(k.next();k.pos>z;){if(k.size<0)if(k.size==-3)I+=4;else break e;else k.id>=o&&(I+=4);k.next()}O=T,j+=q,C+=I}return(S<0||j==w)&&(D.size=j,D.start=O,D.skip=C),D.size>4?D:void 0}function A(w,S,k){let{id:j,start:O,end:C,size:N}=s;if(s.next(),N>=0&&j4){let P=s.pos-(N-4);for(;s.pos>P;)k=A(w,S,k)}S[--k]=D,S[--k]=C-w,S[--k]=O-w,S[--k]=j}else N==-3?u=j:N==-4&&(c=j);return k}let b=[],v=[];for(;s.pos>0;)f(e.start||0,e.bufferStart||0,b,v,-1,0);let x=(t=e.length)!==null&&t!==void 0?t:b.length?v[0]+b[0].length:0;return new ha(l[e.topID],b.reverse(),v.reverse(),x)}var awe=new WeakMap;function E5(e,t){if(!e.isAnonymous||t instanceof fh||t.type!=e)return 1;let r=awe.get(t);if(r==null){r=1;for(let n of t.children){if(n.type!=e||!(n instanceof ha)){r=1;break}r+=E5(e,n)}awe.set(t,r)}return r}function GG(e,t,r,n,i,a,o,s,l){let u=0;for(let h=n;h=c)break;S+=k}if(v==x+1){if(S>c){let k=h[x];p(k.children,k.positions,0,k.children.length,m[x]+b);continue}f.push(h[x])}else{let k=m[v-1]+h[v-1].length-w;f.push(GG(e,h,m,x,v,w,k,null,l))}d.push(w+b-a)}}return p(t,r,n,i,0),(s||l)(f,d,o)}var dh=class{constructor(t,r,n,i,a=!1,o=!1){this.from=t,this.to=r,this.tree=n,this.offset=i,this.open=(a?1:0)|(o?2:0)}get openStart(){return(this.open&1)>0}get openEnd(){return(this.open&2)>0}static addTree(t,r=[],n=!1){let i=[new dh(0,t.length,t,0,!1,n)];for(let a of r)a.to>t.length&&i.push(a);return i}static applyChanges(t,r,n=128){if(!r.length)return t;let i=[],a=1,o=t.length?t[0]:null;for(let s=0,l=0,u=0;;s++){let c=s=n)for(;o&&o.from=d.from||f<=d.to||u){let p=Math.max(d.from,l)-u,h=Math.min(d.to,f)-u;d=p>=h?null:new dh(p,h,d.tree,d.offset+u,s>0,!!c)}if(d&&i.push(d),o.to>f)break;o=anew MC(i.from,i.to)):[new MC(0,0)]:[new MC(0,t.length)],this.createParse(t,r||[],n)}parse(t,r,n){let i=this.startParse(t,r,n);for(;;){let a=i.advance();if(a)return a}}},HG=class{constructor(t){this.string=t}get length(){return this.string.length}chunk(t){return this.string.slice(t)}get lineChunks(){return!1}read(t,r){return this.string.slice(t,r)}};var wKt=new wn({perNode:!0});var Sn=require("@codemirror/state"),on=require("@codemirror/view");var PQe=0,Ud=class{constructor(t,r,n){this.set=t,this.base=r,this.modified=n,this.id=PQe++}static define(t){if(t?.base)throw new Error("Can not derive from a modified tag");let r=new Ud([],null,[]);if(r.set.push(r),t)for(let n of t.set)r.set.push(n);return r}static defineModifier(){let t=new o2;return r=>r.modified.indexOf(t)>-1?r:o2.get(r.base||r,r.modified.concat(t).sort((n,i)=>n.id-i.id))}},IQe=0,o2=class{constructor(){this.instances=[],this.id=IQe++}static get(t,r){if(!r.length)return t;let n=r[0].instances.find(s=>s.base==t&&BQe(r,s.modified));if(n)return n;let i=[],a=new Ud(i,t,r);for(let s of r)s.instances.push(a);let o=RQe(r);for(let s of t.set)if(!s.modified.length)for(let l of o)i.push(o2.get(s,l));return a}};function BQe(e,t){return e.length==t.length&&e.every((r,n)=>r==t[n])}function RQe(e){let t=[[]];for(let r=0;rn.length-r.length)}function cwe(e){let t=Object.create(null);for(let r in e){let n=e[r];Array.isArray(n)||(n=[n]);for(let i of r.split(" "))if(i){let a=[],o=2,s=i;for(let f=0;;){if(s=="..."&&f>0&&f+3==i.length){o=1;break}let d=/^"(?:[^"\\]|\\.)*?"|[^\/!]+/.exec(s);if(!d)throw new RangeError("Invalid path: "+i);if(a.push(d[0]=="*"?"":d[0][0]=='"'?JSON.parse(d[0]):d[0]),f+=d[0].length,f==i.length)break;let p=i[f++];if(f==i.length&&p=="!"){o=0;break}if(p!="/")throw new RangeError("Invalid path: "+i);s=i.slice(f)}let l=a.length-1,u=a[l];if(!u)throw new RangeError("Invalid path: "+i);let c=new s2(n,o,l>0?a.slice(0,l):null);t[u]=c.sort(t[u])}}return fwe.add(t)}var fwe=new wn,s2=class{constructor(t,r,n,i){this.tags=t,this.mode=r,this.context=n,this.next=i}get opaque(){return this.mode==0}get inherit(){return this.mode==1}sort(t){return!t||t.depth{let o=i;for(let s of a)for(let l of s.set){let u=r[l.id];if(u){o=o?o+" "+u:u;break}}return o},scope:n}}function $Qe(e,t){let r=null;for(let n of e){let i=n.style(t);i&&(r=r?r+" "+i:i)}return r}function dwe(e,t,r,n=0,i=e.length){let a=new YG(n,Array.isArray(t)?t:[t],r);a.highlightRange(e.cursor(),n,i,"",a.highlighters),a.flush(i)}var YG=class{constructor(t,r,n){this.at=t,this.highlighters=r,this.span=n,this.class=""}startSpan(t,r){r!=this.class&&(this.flush(t),t>this.at&&(this.at=t),this.class=r)}flush(t){t>this.at&&this.class&&this.span(this.at,t,this.class)}highlightRange(t,r,n,i,a){let{type:o,from:s,to:l}=t;if(s>=n||l<=r)return;o.isTop&&(a=this.highlighters.filter(p=>!p.scope||p.scope(o)));let u=i,c=qQe(t)||s2.empty,f=$Qe(a,c.tags);if(f&&(u&&(u+=" "),u+=f,c.mode==1&&(i+=(i?" ":"")+f)),this.startSpan(Math.max(r,s),u),c.opaque)return;let d=t.tree&&t.tree.prop(wn.mounted);if(d&&d.overlay){let p=t.node.enter(d.overlay[0].from+s,1),h=this.highlighters.filter(g=>!g.scope||g.scope(d.tree.type)),m=t.firstChild();for(let g=0,A=s;;g++){let b=g=v||!t.nextSibling())););if(!b||v>n)break;A=b.to+s,A>r&&(this.highlightRange(p.cursor(),Math.max(r,b.from+s),Math.min(n,A),"",h),this.startSpan(Math.min(n,A),u))}m&&t.parent()}else if(t.firstChild()){d&&(i="");do if(!(t.to<=r)){if(t.from>=n)break;this.highlightRange(t,r,n,i,a),this.startSpan(Math.min(n,t.to),u)}while(t.nextSibling());t.parent()}}};function qQe(e){let t=e.type.prop(fwe);for(;t&&t.context&&!e.matchContext(t.context);)t=t.next;return t||null}var Nt=Ud.define,C5=Nt(),mv=Nt(),lwe=Nt(mv),uwe=Nt(mv),hv=Nt(),D5=Nt(hv),QG=Nt(hv),hh=Nt(),Hy=Nt(hh),ph=Nt(),mh=Nt(),ZG=Nt(),_C=Nt(ZG),O5=Nt(),qe={comment:C5,lineComment:Nt(C5),blockComment:Nt(C5),docComment:Nt(C5),name:mv,variableName:Nt(mv),typeName:lwe,tagName:Nt(lwe),propertyName:uwe,attributeName:Nt(uwe),className:Nt(mv),labelName:Nt(mv),namespace:Nt(mv),macroName:Nt(mv),literal:hv,string:D5,docString:Nt(D5),character:Nt(D5),attributeValue:Nt(D5),number:QG,integer:Nt(QG),float:Nt(QG),bool:Nt(hv),regexp:Nt(hv),escape:Nt(hv),color:Nt(hv),url:Nt(hv),keyword:ph,self:Nt(ph),null:Nt(ph),atom:Nt(ph),unit:Nt(ph),modifier:Nt(ph),operatorKeyword:Nt(ph),controlKeyword:Nt(ph),definitionKeyword:Nt(ph),moduleKeyword:Nt(ph),operator:mh,derefOperator:Nt(mh),arithmeticOperator:Nt(mh),logicOperator:Nt(mh),bitwiseOperator:Nt(mh),compareOperator:Nt(mh),updateOperator:Nt(mh),definitionOperator:Nt(mh),typeOperator:Nt(mh),controlOperator:Nt(mh),punctuation:ZG,separator:Nt(ZG),bracket:_C,angleBracket:Nt(_C),squareBracket:Nt(_C),paren:Nt(_C),brace:Nt(_C),content:hh,heading:Hy,heading1:Nt(Hy),heading2:Nt(Hy),heading3:Nt(Hy),heading4:Nt(Hy),heading5:Nt(Hy),heading6:Nt(Hy),contentSeparator:Nt(hh),list:Nt(hh),quote:Nt(hh),emphasis:Nt(hh),strong:Nt(hh),link:Nt(hh),monospace:Nt(hh),strikethrough:Nt(hh),inserted:Nt(),deleted:Nt(),changed:Nt(),invalid:Nt(),meta:O5,documentMeta:Nt(O5),annotation:Nt(O5),processingInstruction:Nt(O5),definition:Ud.defineModifier(),constant:Ud.defineModifier(),function:Ud.defineModifier(),standard:Ud.defineModifier(),local:Ud.defineModifier(),special:Ud.defineModifier()},kKt=XG([{tag:qe.link,class:"tok-link"},{tag:qe.heading,class:"tok-heading"},{tag:qe.emphasis,class:"tok-emphasis"},{tag:qe.strong,class:"tok-strong"},{tag:qe.keyword,class:"tok-keyword"},{tag:qe.atom,class:"tok-atom"},{tag:qe.bool,class:"tok-bool"},{tag:qe.url,class:"tok-url"},{tag:qe.labelName,class:"tok-labelName"},{tag:qe.inserted,class:"tok-inserted"},{tag:qe.deleted,class:"tok-deleted"},{tag:qe.literal,class:"tok-literal"},{tag:qe.string,class:"tok-string"},{tag:qe.number,class:"tok-number"},{tag:[qe.regexp,qe.escape,qe.special(qe.string)],class:"tok-string2"},{tag:qe.variableName,class:"tok-variableName"},{tag:qe.local(qe.variableName),class:"tok-variableName tok-local"},{tag:qe.definition(qe.variableName),class:"tok-variableName tok-definition"},{tag:qe.special(qe.variableName),class:"tok-variableName2"},{tag:qe.definition(qe.propertyName),class:"tok-propertyName tok-definition"},{tag:qe.typeName,class:"tok-typeName"},{tag:qe.namespace,class:"tok-namespace"},{tag:qe.className,class:"tok-className"},{tag:qe.macroName,class:"tok-macroName"},{tag:qe.propertyName,class:"tok-propertyName"},{tag:qe.operator,class:"tok-operator"},{tag:qe.comment,class:"tok-comment"},{tag:qe.meta,class:"tok-meta"},{tag:qe.invalid,class:"tok-invalid"},{tag:qe.punctuation,class:"tok-punctuation"}]);var KG="\u037C",pwe=typeof Symbol>"u"?"__"+KG:Symbol.for(KG),JG=typeof Symbol>"u"?"__styleSet"+Math.floor(Math.random()*1e8):Symbol("styleSet"),mwe=typeof globalThis<"u"?globalThis:typeof window<"u"?window:{},Qp=class{constructor(t,r){this.rules=[];let{finish:n}=r||{};function i(o){return/^@/.test(o)?[o]:o.split(/,\s*/)}function a(o,s,l,u){let c=[],f=/^@(\w+)\b/.exec(o[0]),d=f&&f[1]=="keyframes";if(f&&s==null)return l.push(o[0]+";");for(let p in s){let h=s[p];if(/&/.test(p))a(p.split(/,\s*/).map(m=>o.map(g=>m.replace(/&/,g))).reduce((m,g)=>m.concat(g)),h,l);else if(h&&typeof h=="object"){if(!f)throw new RangeError("The value of a property ("+p+") should be a primitive value.");a(i(p),h,c,d)}else h!=null&&c.push(p.replace(/_.*/,"").replace(/[A-Z]/g,m=>"-"+m.toLowerCase())+": "+h+";")}(c.length||d)&&l.push((n&&!f&&!u?o.map(n):o).join(", ")+" {"+c.join(" ")+"}")}for(let o in t)a(i(o),t[o],this.rules)}getRules(){return this.rules.join(` `)}static newName(){let t=mwe[pwe]||1;return mwe[pwe]=t+1,KG+t.toString(36)}static mount(t,r,n){let i=t[JG],a=n&&n.nonce;i?a&&i.setNonce(a):i=new eQ(t,a),i.mount(Array.isArray(r)?r:[r],t)}},hwe=new Map,eQ=class{constructor(t,r){let n=t.ownerDocument||t,i=n.defaultView;if(!t.head&&t.adoptedStyleSheets&&i.CSSStyleSheet){let a=hwe.get(n);if(a)return t[JG]=a;this.sheet=new i.CSSStyleSheet,hwe.set(n,this)}else this.styleTag=n.createElement("style"),r&&this.styleTag.setAttribute("nonce",r);this.modules=[],t[JG]=this}mount(t,r){let n=this.sheet,i=0,a=0;for(let o=0;o-1&&(this.modules.splice(l,1),a--,l=-1),l==-1){if(this.modules.splice(a++,0,s),n)for(let u=0;ut.concat(e):void 0})}var zQe=new wn,Mf=class{constructor(t,r,n=[],i=""){this.data=t,this.name=i,Sn.EditorState.prototype.hasOwnProperty("tree")||Object.defineProperty(Sn.EditorState.prototype,"tree",{get(){return Zs(this)}}),this.parser=r,this.extension=[vv.of(this),Sn.EditorState.languageData.of((a,o,s)=>{let l=Awe(a,o,s),u=l.type.prop(l2);if(!u)return[];let c=a.facet(u),f=l.type.prop(zQe);if(f){let d=l.resolve(o-l.from,s);for(let p of f)if(p.test(d,a)){let h=a.facet(p.facet);return p.type=="replace"?h:h.concat(c)}}return c})].concat(n)}isActiveAt(t,r,n=-1){return Awe(t,r,n).type.prop(l2)==this.data}findRegions(t){let r=t.facet(vv);if(r?.data==this.data)return[{from:0,to:t.doc.length}];if(!r||!r.allowsNesting)return[];let n=[],i=(a,o)=>{if(a.prop(l2)==this.data){n.push({from:o,to:o+a.length});return}let s=a.prop(wn.mounted);if(s){if(s.tree.prop(l2)==this.data){if(s.overlay)for(let l of s.overlay)n.push({from:l.from+o,to:l.to+o});else n.push({from:o,to:o+a.length});return}else if(s.overlay){let l=n.length;if(i(s.tree,s.overlay[0].from+o),n.length>l)return}}for(let l=0;l=this.cursorPos?this.doc.sliceString(t,r):this.string.slice(t-n,r-n)}},PC=null,Av=class{constructor(t,r,n=[],i,a,o,s,l){this.parser=t,this.state=r,this.fragments=n,this.tree=i,this.treeLen=a,this.viewport=o,this.skipped=s,this.scheduleOn=l,this.parse=null,this.tempSkipped=[]}static create(t,r,n){return new Av(t,r,[],ha.empty,0,n,[],null)}startParse(){return this.parser.startParse(new aQ(this.state.doc),this.fragments)}work(t,r){return r!=null&&r>=this.state.doc.length&&(r=void 0),this.tree!=ha.empty&&this.isDone(r??this.state.doc.length)?(this.takeTree(),!0):this.withContext(()=>{var n;if(typeof t=="number"){let i=Date.now()+t;t=()=>Date.now()>i}for(this.parse||(this.parse=this.startParse()),r!=null&&(this.parse.stoppedAt==null||this.parse.stoppedAt>r)&&r=this.treeLen&&((this.parse.stoppedAt==null||this.parse.stoppedAt>t)&&this.parse.stopAt(t),this.withContext(()=>{for(;!(r=this.parse.advance()););}),this.treeLen=t,this.tree=r,this.fragments=this.withoutTempSkipped(dh.addTree(this.tree,this.fragments,!0)),this.parse=null)}withContext(t){let r=PC;PC=this;try{return t()}finally{PC=r}}withoutTempSkipped(t){for(let r;r=this.tempSkipped.pop();)t=gwe(t,r.from,r.to);return t}changes(t,r){let{fragments:n,tree:i,treeLen:a,viewport:o,skipped:s}=this;if(this.takeTree(),!t.empty){let l=[];if(t.iterChangedRanges((u,c,f,d)=>l.push({fromA:u,toA:c,fromB:f,toB:d})),n=dh.applyChanges(n,l),i=ha.empty,a=0,o={from:t.mapPos(o.from,-1),to:t.mapPos(o.to,1)},this.skipped.length){s=[];for(let u of this.skipped){let c=t.mapPos(u.from,1),f=t.mapPos(u.to,-1);ct.from&&(this.fragments=gwe(this.fragments,i,a),this.skipped.splice(n--,1))}return this.skipped.length>=r?!1:(this.reset(),!0)}reset(){this.parse&&(this.takeTree(),this.parse=null)}skipUntilInView(t,r){this.skipped.push({from:t,to:r})}static getSkippingParser(t){return new class extends FC{createParse(r,n,i){let a=i[0].from,o=i[i.length-1].to;return{parsedPos:a,advance(){let l=PC;if(l){for(let u of i)l.tempSkipped.push(u);t&&(l.scheduleOn=l.scheduleOn?Promise.all([l.scheduleOn,t]):t)}return this.parsedPos=o,new ha(Dl.none,[],[],o-a)},stoppedAt:null,stopAt(){}}}}}isDone(t){t=Math.min(t,this.state.doc.length);let r=this.fragments;return this.treeLen>=t&&r.length&&r[0].from==0&&r[0].to>=t}static get(){return PC}};function gwe(e,t,r){return dh.applyChanges(e,[{fromA:t,toA:r,fromB:t,toB:r}])}var gv=class{constructor(t){this.context=t,this.tree=t.tree}apply(t){if(!t.docChanged&&this.tree==this.context.tree)return this;let r=this.context.changes(t.changes,t.state),n=this.context.treeLen==t.startState.doc.length?void 0:Math.max(t.changes.mapPos(this.context.treeLen),r.viewport.to);return r.work(20,n)||r.takeTree(),new gv(r)}static init(t){let r=Math.min(3e3,t.doc.length),n=Av.create(t.facet(vv).parser,t,{from:0,to:r});return n.work(20,r)||n.takeTree(),new gv(n)}};Mf.state=Sn.StateField.define({create:gv.init,update(e,t){for(let r of t.effects)if(r.is(Mf.setState))return r.value;return t.startState.facet(vv)!=t.state.facet(vv)?gv.init(t.state):e.apply(t)}});var Swe=e=>{let t=setTimeout(()=>e(),500);return()=>clearTimeout(t)};typeof requestIdleCallback<"u"&&(Swe=e=>{let t=-1,r=setTimeout(()=>{t=requestIdleCallback(e,{timeout:500-100})},100);return()=>t<0?clearTimeout(r):cancelIdleCallback(t)});var rQ=typeof navigator<"u"&&((tQ=navigator.scheduling)===null||tQ===void 0?void 0:tQ.isInputPending)?()=>navigator.scheduling.isInputPending():null,UQe=on.ViewPlugin.fromClass(class{constructor(t){this.view=t,this.working=null,this.workScheduled=0,this.chunkEnd=-1,this.chunkBudget=-1,this.work=this.work.bind(this),this.scheduleWork()}update(t){let r=this.view.state.field(Mf.state).context;(r.updateViewport(t.view.viewport)||this.view.viewport.to>r.treeLen)&&this.scheduleWork(),(t.docChanged||t.selectionSet)&&(this.view.hasFocus&&(this.chunkBudget+=50),this.scheduleWork()),this.checkAsyncSchedule(r)}scheduleWork(){if(this.working)return;let{state:t}=this.view,r=t.field(Mf.state);(r.tree!=r.context.tree||!r.context.isDone(t.doc.length))&&(this.working=Swe(this.work))}work(t){this.working=null;let r=Date.now();if(this.chunkEndi+1e3,l=a.context.work(()=>rQ&&rQ()||Date.now()>o,i+(s?0:1e5));this.chunkBudget-=Date.now()-r,(l||this.chunkBudget<=0)&&(a.context.takeTree(),this.view.dispatch({effects:Mf.setState.of(new gv(a.context))})),this.chunkBudget>0&&!(l&&!s)&&this.scheduleWork(),this.checkAsyncSchedule(a.context)}checkAsyncSchedule(t){t.scheduleOn&&(this.workScheduled++,t.scheduleOn.then(()=>this.scheduleWork()).catch(r=>(0,on.logException)(this.view.state,r)).then(()=>this.workScheduled--),t.scheduleOn=null)}destroy(){this.working&&this.working()}isWorking(){return!!(this.working||this.workScheduled>0)}},{eventHandlers:{focus(){this.scheduleWork()}}}),vv=Sn.Facet.define({combine(e){return e.length?e[0]:null},enables:e=>[Mf.state,UQe,on.EditorView.contentAttributes.compute([e],t=>{let r=t.facet(e);return r&&r.name?{"data-language":r.name}:{}})]});var Ewe=Sn.Facet.define(),$C=Sn.Facet.define({combine:e=>{if(!e.length)return" ";let t=e[0];if(!t||/\S/.test(t)||Array.from(t).some(r=>r!=t[0]))throw new Error("Invalid indent unit: "+JSON.stringify(e[0]));return t}});function j5(e){let t=e.facet($C);return t.charCodeAt(0)==9?e.tabSize*t.length:t.length}function WQe(e,t){let r="",n=e.tabSize,i=e.facet($C)[0];if(i==" "){for(;t>=n;)r+=" ",t-=n;i=" "}for(let a=0;a=t?GQe(e,r,t):null}var N5=class{constructor(t,r={}){this.state=t,this.options=r,this.unit=j5(t)}lineAt(t,r=1){let n=this.state.doc.lineAt(t),{simulateBreak:i,simulateDoubleBreak:a}=this.options;return i!=null&&i>=n.from&&i<=n.to?a&&i==t?{text:"",from:t}:(r<0?i-1&&(a+=o-this.countColumn(n,n.search(/\S|$/))),a}countColumn(t,r=t.length){return(0,Sn.countColumn)(t,this.state.tabSize,r)}lineIndent(t,r=1){let{text:n,from:i}=this.lineAt(t,r),a=this.options.overrideIndentation;if(a){let o=a(i);if(o>-1)return o}return this.countColumn(n,n.search(/\S|$/))}get simulatedBreak(){return this.options.simulateBreak||null}},VQe=new wn;function GQe(e,t,r){let n=t.resolveStack(r),i=n.node.enterUnfinishedNodesBefore(r);if(i!=n.node){let a=[];for(let o=i;o!=n.node;o=o.parent)a.push(o);for(let o=a.length-1;o>=0;o--)n={node:a[o],next:n}}return kwe(n,e,r)}function kwe(e,t,r){for(let n=e;n;n=n.next){let i=YQe(n.node);if(i)return i(BC.create(t,r,n))}return 0}function QQe(e){return e.pos==e.options.simulateBreak&&e.options.simulateDoubleBreak}function YQe(e){let t=e.type.prop(VQe);if(t)return t;let r=e.firstChild,n;if(r&&(n=r.type.prop(wn.closedBy))){let i=e.lastChild,a=i&&n.indexOf(i.name)>-1;return o=>JQe(o,!0,1,void 0,a&&!QQe(o)?i.from:void 0)}return e.parent==null?ZQe:null}function ZQe(){return 0}var BC=class extends N5{constructor(t,r,n){super(t.state,t.options),this.base=t,this.pos=r,this.context=n}get node(){return this.context.node}static create(t,r,n){return new BC(t,r,n)}get textAfter(){return this.textAfterPos(this.pos)}get baseIndent(){return this.baseIndentFor(this.node)}baseIndentFor(t){let r=this.state.doc.lineAt(t.from);for(;;){let n=t.resolve(r.from);for(;n.parent&&n.parent.from==n.from;)n=n.parent;if(XQe(n,t))break;r=this.state.doc.lineAt(n.from)}return this.lineIndent(r.from)}continue(){return kwe(this.context.next,this.base,this.pos)}};function XQe(e,t){for(let r=t;r;r=r.parent)if(e==r)return!0;return!1}function KQe(e){let t=e.node,r=t.childAfter(t.from),n=t.lastChild;if(!r)return null;let i=e.options.simulateBreak,a=e.state.doc.lineAt(r.from),o=i==null||i<=a.from?a.to:Math.min(a.to,i);for(let s=r.to;;){let l=t.childAfter(s);if(!l||l==n)return null;if(!l.type.isSkipped)return l.from{if(!e.docChanged||!e.isUserEvent("input.type")&&!e.isUserEvent("input.complete"))return e;let t=e.startState.languageDataAt("indentOnInput",e.startState.selection.main.head);if(!t.length)return e;let r=e.newDoc,{head:n}=e.newSelection.main,i=r.lineAt(n);if(n>i.from+eYe)return e;let a=r.sliceString(i.from,n);if(!t.some(u=>u.test(a)))return e;let{state:o}=e,s=-1,l=[];for(let{head:u}of o.selection.ranges){let c=o.doc.lineAt(u);if(c.from==s)continue;s=c.from;let f=HQe(o,c.from);if(f==null)continue;let d=/^\s*/.exec(c.text)[0],p=WQe(o,f);d!=p&&l.push({from:c.from,to:c.from+d.length,insert:p})}return l.length?[e,{changes:l,sequential:!0}]:e})}var tYe=Sn.Facet.define(),rYe=new wn;function nYe(e,t,r){let n=Zs(e);if(n.lengthr)continue;if(a&&s.from=t&&u.to>r&&(a=u)}}return a}function iYe(e){let t=e.lastChild;return t&&t.to==e.to&&t.type.isError}function T5(e,t,r){for(let n of e.facet(tYe)){let i=n(e,t,r);if(i)return i}return nYe(e,t,r)}function Dwe(e,t){let r=t.mapPos(e.from,1),n=t.mapPos(e.to,-1);return r>=n?void 0:{from:r,to:n}}var I5=Sn.StateEffect.define({map:Dwe}),qC=Sn.StateEffect.define({map:Dwe});function Owe(e){let t=[];for(let{head:r}of e.state.selection.ranges)t.some(n=>n.from<=r&&n.to>=r)||t.push(e.lineBlockAt(r));return t}var Vy=Sn.StateField.define({create(){return on.Decoration.none},update(e,t){e=e.map(t.changes);for(let r of t.effects)if(r.is(I5)&&!aYe(e,r.value.from,r.value.to)){let{preparePlaceholder:n}=t.state.facet(dQ),i=n?on.Decoration.replace({widget:new oQ(n(t.state,r.value))}):vwe;e=e.update({add:[i.range(r.value.from,r.value.to)]})}else r.is(qC)&&(e=e.update({filter:(n,i)=>r.value.from!=n||r.value.to!=i,filterFrom:r.value.from,filterTo:r.value.to}));if(t.selection){let r=!1,{head:n}=t.selection.main;e.between(n,n,(i,a)=>{in&&(r=!0)}),r&&(e=e.update({filterFrom:n,filterTo:n,filter:(i,a)=>a<=n||i>=n}))}return e},provide:e=>on.EditorView.decorations.from(e),toJSON(e,t){let r=[];return e.between(0,t.doc.length,(n,i)=>{r.push(n,i)}),r},fromJSON(e){if(!Array.isArray(e)||e.length%2)throw new RangeError("Invalid JSON for fold state");let t=[];for(let r=0;r{(!i||i.from>a)&&(i={from:a,to:o})}),i}function aYe(e,t,r){let n=!1;return e.between(t,t,(i,a)=>{i==t&&a==r&&(n=!0)}),n}function Mwe(e,t){return e.field(Vy,!1)?t:t.concat(Sn.StateEffect.appendConfig.of(Twe()))}var oYe=e=>{for(let t of Owe(e)){let r=T5(e.state,t.from,t.to);if(r)return e.dispatch({effects:Mwe(e.state,[I5.of(r),jwe(e,r)])}),!0}return!1},sYe=e=>{if(!e.state.field(Vy,!1))return!1;let t=[];for(let r of Owe(e)){let n=F5(e.state,r.from,r.to);n&&t.push(qC.of(n),jwe(e,n,!1))}return t.length&&e.dispatch({effects:t}),t.length>0};function jwe(e,t,r=!0){let n=e.state.doc.lineAt(t.from).number,i=e.state.doc.lineAt(t.to).number;return on.EditorView.announce.of(`${e.state.phrase(r?"Folded lines":"Unfolded lines")} ${n} ${e.state.phrase("to")} ${i}.`)}var lYe=e=>{let{state:t}=e,r=[];for(let n=0;n{let t=e.state.field(Vy,!1);if(!t||!t.size)return!1;let r=[];return t.between(0,e.state.doc.length,(n,i)=>{r.push(qC.of({from:n,to:i}))}),e.dispatch({effects:r}),!0};var Nwe=[{key:"Ctrl-Shift-[",mac:"Cmd-Alt-[",run:oYe},{key:"Ctrl-Shift-]",mac:"Cmd-Alt-]",run:sYe},{key:"Ctrl-Alt-[",run:lYe},{key:"Ctrl-Alt-]",run:uYe}],cYe={placeholderDOM:null,preparePlaceholder:null,placeholderText:"\u2026"},dQ=Sn.Facet.define({combine(e){return(0,Sn.combineConfig)(e,cYe)}});function Twe(e){let t=[Vy,dYe];return e&&t.push(dQ.of(e)),t}function Fwe(e,t){let{state:r}=e,n=r.facet(dQ),i=o=>{let s=e.lineBlockAt(e.posAtDOM(o.target)),l=F5(e.state,s.from,s.to);l&&e.dispatch({effects:qC.of(l)}),o.preventDefault()};if(n.placeholderDOM)return n.placeholderDOM(e,i,t);let a=document.createElement("span");return a.textContent=n.placeholderText,a.setAttribute("aria-label",r.phrase("folded code")),a.title=r.phrase("unfold"),a.className="cm-foldPlaceholder",a.onclick=i,a}var vwe=on.Decoration.replace({widget:new class extends on.WidgetType{toDOM(e){return Fwe(e,null)}}}),oQ=class extends on.WidgetType{constructor(t){super(),this.value=t}eq(t){return this.value==t.value}toDOM(t){return Fwe(t,this.value)}},fYe={openText:"\u2304",closedText:"\u203A",markerDOM:null,domEventHandlers:{},foldingChanged:()=>!1},IC=class extends on.GutterMarker{constructor(t,r){super(),this.config=t,this.open=r}eq(t){return this.config==t.config&&this.open==t.open}toDOM(t){if(this.config.markerDOM)return this.config.markerDOM(this.open);let r=document.createElement("span");return r.textContent=this.open?this.config.openText:this.config.closedText,r.title=t.state.phrase(this.open?"Fold line":"Unfold line"),r}};function _we(e={}){let t=Object.assign(Object.assign({},fYe),e),r=new IC(t,!0),n=new IC(t,!1),i=on.ViewPlugin.fromClass(class{constructor(o){this.from=o.viewport.from,this.markers=this.buildMarkers(o)}update(o){(o.docChanged||o.viewportChanged||o.startState.facet(vv)!=o.state.facet(vv)||o.startState.field(Vy,!1)!=o.state.field(Vy,!1)||Zs(o.startState)!=Zs(o.state)||t.foldingChanged(o))&&(this.markers=this.buildMarkers(o.view))}buildMarkers(o){let s=new Sn.RangeSetBuilder;for(let l of o.viewportLineBlocks){let u=F5(o.state,l.from,l.to)?n:T5(o.state,l.from,l.to)?r:null;u&&s.add(l.from,l.from,u)}return s.finish()}}),{domEventHandlers:a}=t;return[i,(0,on.gutter)({class:"cm-foldGutter",markers(o){var s;return((s=o.plugin(i))===null||s===void 0?void 0:s.markers)||Sn.RangeSet.empty},initialSpacer(){return new IC(t,!1)},domEventHandlers:Object.assign(Object.assign({},a),{click:(o,s,l)=>{if(a.click&&a.click(o,s,l))return!0;let u=F5(o.state,s.from,s.to);if(u)return o.dispatch({effects:qC.of(u)}),!0;let c=T5(o.state,s.from,s.to);return c?(o.dispatch({effects:I5.of(c)}),!0):!1}})}),Twe()]}var dYe=on.EditorView.baseTheme({".cm-foldPlaceholder":{backgroundColor:"#eee",border:"1px solid #ddd",color:"#888",borderRadius:".2em",margin:"0 1px",padding:"0 1px",cursor:"pointer"},".cm-foldGutter span":{padding:"0 1px",cursor:"pointer"}}),Wd=class{constructor(t,r){this.specs=t;let n;function i(s){let l=Gp.newName();return(n||(n=Object.create(null)))["."+l]=s,l}let a=typeof r.all=="string"?r.all:r.all?i(r.all):void 0,o=r.scope;this.scope=o instanceof Mf?s=>s.prop(l2)==o.data:o?s=>s==o:void 0,this.style=XG(t.map(s=>({tag:s.tag,class:s.class||i(Object.assign({},s,{tag:null}))})),{all:a}).style,this.module=n?new Gp(n):null,this.themeType=r.themeType}static define(t,r){return new Wd(t,r||{})}},sQ=Sn.Facet.define(),Pwe=Sn.Facet.define({combine(e){return e.length?[e[0]]:null}});function nQ(e){let t=e.facet(sQ);return t.length?t:e.facet(Pwe)}function JA(e,t){let r=[pYe],n;return e instanceof Wd&&(e.module&&r.push(on.EditorView.styleModule.of(e.module)),n=e.themeType),t?.fallback?r.push(Pwe.of(e)):n?r.push(sQ.computeN([on.EditorView.darkTheme],i=>i.facet(on.EditorView.darkTheme)==(n=="dark")?[e]:[])):r.push(sQ.of(e)),r}var lQ=class{constructor(t){this.markCache=Object.create(null),this.tree=Zs(t.state),this.decorations=this.buildDeco(t,nQ(t.state)),this.decoratedTo=t.viewport.to}update(t){let r=Zs(t.state),n=nQ(t.state),i=n!=nQ(t.startState),{viewport:a}=t.view,o=t.changes.mapPos(this.decoratedTo,1);r.length=a.to?(this.decorations=this.decorations.map(t.changes),this.decoratedTo=o):(r!=this.tree||t.viewportChanged||i)&&(this.tree=r,this.decorations=this.buildDeco(t.view,n),this.decoratedTo=a.to)}buildDeco(t,r){if(!r||!this.tree.length)return on.Decoration.none;let n=new Sn.RangeSetBuilder;for(let{from:i,to:a}of t.visibleRanges)dwe(this.tree,r,(o,s,l)=>{n.add(o,s,this.markCache[l]||(this.markCache[l]=on.Decoration.mark({class:l})))},i,a);return n.finish()}},pYe=Sn.Prec.high(on.ViewPlugin.fromClass(lQ,{decorations:e=>e.decorations})),pQ=Wd.define([{tag:qe.meta,color:"#404740"},{tag:qe.link,textDecoration:"underline"},{tag:qe.heading,textDecoration:"underline",fontWeight:"bold"},{tag:qe.emphasis,fontStyle:"italic"},{tag:qe.strong,fontWeight:"bold"},{tag:qe.strikethrough,textDecoration:"line-through"},{tag:qe.keyword,color:"#708"},{tag:[qe.atom,qe.bool,qe.url,qe.contentSeparator,qe.labelName],color:"#219"},{tag:[qe.literal,qe.inserted],color:"#164"},{tag:[qe.string,qe.deleted],color:"#a11"},{tag:[qe.regexp,qe.escape,qe.special(qe.string)],color:"#e40"},{tag:qe.definition(qe.variableName),color:"#00f"},{tag:qe.local(qe.variableName),color:"#30a"},{tag:[qe.typeName,qe.namespace],color:"#085"},{tag:qe.className,color:"#167"},{tag:[qe.special(qe.variableName),qe.macroName],color:"#256"},{tag:qe.definition(qe.propertyName),color:"#00c"},{tag:qe.comment,color:"#940"},{tag:qe.invalid,color:"#f00"}]),mYe=on.EditorView.baseTheme({"&.cm-focused .cm-matchingBracket":{backgroundColor:"#328c8252"},"&.cm-focused .cm-nonmatchingBracket":{backgroundColor:"#bb555544"}}),Iwe=1e4,Bwe="()[]{}",Rwe=Sn.Facet.define({combine(e){return(0,Sn.combineConfig)(e,{afterCursor:!0,brackets:Bwe,maxScanDistance:Iwe,renderMatch:gYe})}}),hYe=on.Decoration.mark({class:"cm-matchingBracket"}),AYe=on.Decoration.mark({class:"cm-nonmatchingBracket"});function gYe(e){let t=[],r=e.matched?hYe:AYe;return t.push(r.range(e.start.from,e.start.to)),e.end&&t.push(r.range(e.end.from,e.end.to)),t}var vYe=Sn.StateField.define({create(){return on.Decoration.none},update(e,t){if(!t.docChanged&&!t.selection)return e;let r=[],n=t.state.facet(Rwe);for(let i of t.state.selection.ranges){if(!i.empty)continue;let a=M5(t.state,i.head,-1,n)||i.head>0&&M5(t.state,i.head-1,1,n)||n.afterCursor&&(M5(t.state,i.head,1,n)||i.headon.EditorView.decorations.from(e)}),yYe=[vYe,mYe];function $we(e={}){return[Rwe.of(e),yYe]}var bYe=new wn;function uQ(e,t,r){let n=e.prop(t<0?wn.openedBy:wn.closedBy);if(n)return n;if(e.name.length==1){let i=r.indexOf(e.name);if(i>-1&&i%2==(t<0?1:0))return[r[i+t]]}return null}function cQ(e){let t=e.type.prop(bYe);return t?t(e.node):e}function M5(e,t,r,n={}){let i=n.maxScanDistance||Iwe,a=n.brackets||Bwe,o=Zs(e),s=o.resolveInner(t,r);for(let l=s;l;l=l.parent){let u=uQ(l.type,r,a);if(u&&l.from0?t>=c.from&&tc.from&&t<=c.to))return xYe(e,t,r,l,c,u,a)}}return wYe(e,t,r,o,s.type,i,a)}function xYe(e,t,r,n,i,a,o){let s=n.parent,l={from:i.from,to:i.to},u=0,c=s?.cursor();if(c&&(r<0?c.childBefore(n.from):c.childAfter(n.to)))do if(r<0?c.to<=n.from:c.from>=n.to){if(u==0&&a.indexOf(c.type.name)>-1&&c.from0)return null;let u={from:r<0?t-1:t,to:r>0?t+1:t},c=e.doc.iterRange(t,r>0?e.doc.length:0),f=0;for(let d=0;!c.next().done&&d<=a;){let p=c.value;r<0&&(d+=p.length);let h=t+d*r;for(let m=r>0?0:p.length-1,g=r>0?p.length:-1;m!=g;m+=r){let A=o.indexOf(p[m]);if(!(A<0||n.resolveInner(h+m,1).type!=i))if(A%2==0==r>0)f++;else{if(f==1)return{start:u,end:{from:h+m,to:h+m+1},matched:A>>1==l>>1};f--}}r>0&&(d+=p.length)}return c.done?{start:u,matched:!1}:null}function ywe(e,t,r,n=0,i=0){t==null&&(t=e.search(/[^\s\u00a0]/),t==-1&&(t=e.length));let a=i;for(let o=n;o=this.string.length}sol(){return this.pos==0}peek(){return this.string.charAt(this.pos)||void 0}next(){if(this.posr}eatSpace(){let t=this.pos;for(;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>t}skipToEnd(){this.pos=this.string.length}skipTo(t){let r=this.string.indexOf(t,this.pos);if(r>-1)return this.pos=r,!0}backUp(t){this.pos-=t}column(){return this.lastColumnPosn?o.toLowerCase():o,a=this.string.substr(this.pos,t.length);return i(a)==i(t)?(r!==!1&&(this.pos+=t.length),!0):null}else{let i=this.string.slice(this.pos).match(t);return i&&i.index>0?null:(i&&r!==!1&&(this.pos+=i[0].length),i)}}current(){return this.string.slice(this.start,this.pos)}};function SYe(e){return{name:e.name||"",token:e.token,blankLine:e.blankLine||(()=>{}),startState:e.startState||(()=>!0),copyState:e.copyState||EYe,indent:e.indent||(()=>null),languageData:e.languageData||{},tokenTable:e.tokenTable||hQ}}function EYe(e){if(typeof e!="object")return e;let t={};for(let r in e){let n=e[r];t[r]=n instanceof Array?n.slice():n}return t}var bwe=new WeakMap,u2=class extends Mf{constructor(t){let r=LQe(t.languageData),n=SYe(t),i,a=new class extends FC{createParse(o,s,l){return new fQ(i,o,s,l)}};super(r,a,[Ewe.of((o,s)=>this.getIndent(o,s))],t.name),this.topNode=OYe(r),i=this,this.streamParser=n,this.stateAfter=new wn({perNode:!0}),this.tokenTable=t.tokenTable?new P5(n.tokenTable):DYe}static define(t){return new u2(t)}getIndent(t,r){let n=Zs(t.state),i=n.resolve(r);for(;i&&i.type!=this.topNode;)i=i.parent;if(!i)return null;let a,{overrideIndentation:o}=t.options;o&&(a=bwe.get(t.state),a!=null&&a1e4)return null;for(;l=n&&r+t.length<=i&&t.prop(e.stateAfter);if(a)return{state:e.streamParser.copyState(a),pos:r+t.length};for(let o=t.children.length-1;o>=0;o--){let s=t.children[o],l=r+t.positions[o],u=s instanceof ha&&l=t.length)return t;!i&&t.type==e.topNode&&(i=!0);for(let a=t.children.length-1;a>=0;a--){let o=t.positions[a],s=t.children[a],l;if(or&&mQ(e,i.tree,0-i.offset,r,o),l;if(s&&(l=qwe(e,i.tree,r+i.offset,s.pos+i.offset,!1)))return{state:s.state,tree:l}}return{state:e.streamParser.startState(n?j5(n):4),tree:ha.empty}}var fQ=class{constructor(t,r,n,i){this.lang=t,this.input=r,this.fragments=n,this.ranges=i,this.stoppedAt=null,this.chunks=[],this.chunkPos=[],this.chunk=[],this.chunkReused=void 0,this.rangeIndex=0,this.to=i[i.length-1].to;let a=Av.get(),o=i[0].from,{state:s,tree:l}=kYe(t,n,o,a?.state);this.state=s,this.parsedPos=this.chunkStart=o+l.length;for(let u=0;u=r?this.finish():t&&this.parsedPos>=t.viewport.to?(t.skipUntilInView(this.parsedPos,r),this.finish()):null}stopAt(t){this.stoppedAt=t}lineAfter(t){let r=this.input.chunk(t);if(this.input.lineChunks)r==` +`;this.styleTag.textContent=o;let s=r.head||r;this.styleTag.parentNode!=s&&s.insertBefore(this.styleTag,s.firstChild)}}setNonce(t){this.styleTag&&this.styleTag.getAttribute("nonce")!=t&&this.styleTag.setAttribute("nonce",t)}};var tQ,l2=new wn;function LQe(e){return Sn.Facet.define({combine:e?t=>t.concat(e):void 0})}var zQe=new wn,Mf=class{constructor(t,r,n=[],i=""){this.data=t,this.name=i,Sn.EditorState.prototype.hasOwnProperty("tree")||Object.defineProperty(Sn.EditorState.prototype,"tree",{get(){return Zs(this)}}),this.parser=r,this.extension=[vv.of(this),Sn.EditorState.languageData.of((a,o,s)=>{let l=Awe(a,o,s),u=l.type.prop(l2);if(!u)return[];let c=a.facet(u),f=l.type.prop(zQe);if(f){let d=l.resolve(o-l.from,s);for(let p of f)if(p.test(d,a)){let h=a.facet(p.facet);return p.type=="replace"?h:h.concat(c)}}return c})].concat(n)}isActiveAt(t,r,n=-1){return Awe(t,r,n).type.prop(l2)==this.data}findRegions(t){let r=t.facet(vv);if(r?.data==this.data)return[{from:0,to:t.doc.length}];if(!r||!r.allowsNesting)return[];let n=[],i=(a,o)=>{if(a.prop(l2)==this.data){n.push({from:o,to:o+a.length});return}let s=a.prop(wn.mounted);if(s){if(s.tree.prop(l2)==this.data){if(s.overlay)for(let l of s.overlay)n.push({from:l.from+o,to:l.to+o});else n.push({from:o,to:o+a.length});return}else if(s.overlay){let l=n.length;if(i(s.tree,s.overlay[0].from+o),n.length>l)return}}for(let l=0;l=this.cursorPos?this.doc.sliceString(t,r):this.string.slice(t-n,r-n)}},PC=null,Av=class{constructor(t,r,n=[],i,a,o,s,l){this.parser=t,this.state=r,this.fragments=n,this.tree=i,this.treeLen=a,this.viewport=o,this.skipped=s,this.scheduleOn=l,this.parse=null,this.tempSkipped=[]}static create(t,r,n){return new Av(t,r,[],ha.empty,0,n,[],null)}startParse(){return this.parser.startParse(new aQ(this.state.doc),this.fragments)}work(t,r){return r!=null&&r>=this.state.doc.length&&(r=void 0),this.tree!=ha.empty&&this.isDone(r??this.state.doc.length)?(this.takeTree(),!0):this.withContext(()=>{var n;if(typeof t=="number"){let i=Date.now()+t;t=()=>Date.now()>i}for(this.parse||(this.parse=this.startParse()),r!=null&&(this.parse.stoppedAt==null||this.parse.stoppedAt>r)&&r=this.treeLen&&((this.parse.stoppedAt==null||this.parse.stoppedAt>t)&&this.parse.stopAt(t),this.withContext(()=>{for(;!(r=this.parse.advance()););}),this.treeLen=t,this.tree=r,this.fragments=this.withoutTempSkipped(dh.addTree(this.tree,this.fragments,!0)),this.parse=null)}withContext(t){let r=PC;PC=this;try{return t()}finally{PC=r}}withoutTempSkipped(t){for(let r;r=this.tempSkipped.pop();)t=gwe(t,r.from,r.to);return t}changes(t,r){let{fragments:n,tree:i,treeLen:a,viewport:o,skipped:s}=this;if(this.takeTree(),!t.empty){let l=[];if(t.iterChangedRanges((u,c,f,d)=>l.push({fromA:u,toA:c,fromB:f,toB:d})),n=dh.applyChanges(n,l),i=ha.empty,a=0,o={from:t.mapPos(o.from,-1),to:t.mapPos(o.to,1)},this.skipped.length){s=[];for(let u of this.skipped){let c=t.mapPos(u.from,1),f=t.mapPos(u.to,-1);ct.from&&(this.fragments=gwe(this.fragments,i,a),this.skipped.splice(n--,1))}return this.skipped.length>=r?!1:(this.reset(),!0)}reset(){this.parse&&(this.takeTree(),this.parse=null)}skipUntilInView(t,r){this.skipped.push({from:t,to:r})}static getSkippingParser(t){return new class extends FC{createParse(r,n,i){let a=i[0].from,o=i[i.length-1].to;return{parsedPos:a,advance(){let l=PC;if(l){for(let u of i)l.tempSkipped.push(u);t&&(l.scheduleOn=l.scheduleOn?Promise.all([l.scheduleOn,t]):t)}return this.parsedPos=o,new ha(Dl.none,[],[],o-a)},stoppedAt:null,stopAt(){}}}}}isDone(t){t=Math.min(t,this.state.doc.length);let r=this.fragments;return this.treeLen>=t&&r.length&&r[0].from==0&&r[0].to>=t}static get(){return PC}};function gwe(e,t,r){return dh.applyChanges(e,[{fromA:t,toA:r,fromB:t,toB:r}])}var gv=class{constructor(t){this.context=t,this.tree=t.tree}apply(t){if(!t.docChanged&&this.tree==this.context.tree)return this;let r=this.context.changes(t.changes,t.state),n=this.context.treeLen==t.startState.doc.length?void 0:Math.max(t.changes.mapPos(this.context.treeLen),r.viewport.to);return r.work(20,n)||r.takeTree(),new gv(r)}static init(t){let r=Math.min(3e3,t.doc.length),n=Av.create(t.facet(vv).parser,t,{from:0,to:r});return n.work(20,r)||n.takeTree(),new gv(n)}};Mf.state=Sn.StateField.define({create:gv.init,update(e,t){for(let r of t.effects)if(r.is(Mf.setState))return r.value;return t.startState.facet(vv)!=t.state.facet(vv)?gv.init(t.state):e.apply(t)}});var Swe=e=>{let t=setTimeout(()=>e(),500);return()=>clearTimeout(t)};typeof requestIdleCallback<"u"&&(Swe=e=>{let t=-1,r=setTimeout(()=>{t=requestIdleCallback(e,{timeout:500-100})},100);return()=>t<0?clearTimeout(r):cancelIdleCallback(t)});var rQ=typeof navigator<"u"&&((tQ=navigator.scheduling)===null||tQ===void 0?void 0:tQ.isInputPending)?()=>navigator.scheduling.isInputPending():null,UQe=on.ViewPlugin.fromClass(class{constructor(t){this.view=t,this.working=null,this.workScheduled=0,this.chunkEnd=-1,this.chunkBudget=-1,this.work=this.work.bind(this),this.scheduleWork()}update(t){let r=this.view.state.field(Mf.state).context;(r.updateViewport(t.view.viewport)||this.view.viewport.to>r.treeLen)&&this.scheduleWork(),(t.docChanged||t.selectionSet)&&(this.view.hasFocus&&(this.chunkBudget+=50),this.scheduleWork()),this.checkAsyncSchedule(r)}scheduleWork(){if(this.working)return;let{state:t}=this.view,r=t.field(Mf.state);(r.tree!=r.context.tree||!r.context.isDone(t.doc.length))&&(this.working=Swe(this.work))}work(t){this.working=null;let r=Date.now();if(this.chunkEndi+1e3,l=a.context.work(()=>rQ&&rQ()||Date.now()>o,i+(s?0:1e5));this.chunkBudget-=Date.now()-r,(l||this.chunkBudget<=0)&&(a.context.takeTree(),this.view.dispatch({effects:Mf.setState.of(new gv(a.context))})),this.chunkBudget>0&&!(l&&!s)&&this.scheduleWork(),this.checkAsyncSchedule(a.context)}checkAsyncSchedule(t){t.scheduleOn&&(this.workScheduled++,t.scheduleOn.then(()=>this.scheduleWork()).catch(r=>(0,on.logException)(this.view.state,r)).then(()=>this.workScheduled--),t.scheduleOn=null)}destroy(){this.working&&this.working()}isWorking(){return!!(this.working||this.workScheduled>0)}},{eventHandlers:{focus(){this.scheduleWork()}}}),vv=Sn.Facet.define({combine(e){return e.length?e[0]:null},enables:e=>[Mf.state,UQe,on.EditorView.contentAttributes.compute([e],t=>{let r=t.facet(e);return r&&r.name?{"data-language":r.name}:{}})]});var Ewe=Sn.Facet.define(),$C=Sn.Facet.define({combine:e=>{if(!e.length)return" ";let t=e[0];if(!t||/\S/.test(t)||Array.from(t).some(r=>r!=t[0]))throw new Error("Invalid indent unit: "+JSON.stringify(e[0]));return t}});function j5(e){let t=e.facet($C);return t.charCodeAt(0)==9?e.tabSize*t.length:t.length}function WQe(e,t){let r="",n=e.tabSize,i=e.facet($C)[0];if(i==" "){for(;t>=n;)r+=" ",t-=n;i=" "}for(let a=0;a=t?GQe(e,r,t):null}var N5=class{constructor(t,r={}){this.state=t,this.options=r,this.unit=j5(t)}lineAt(t,r=1){let n=this.state.doc.lineAt(t),{simulateBreak:i,simulateDoubleBreak:a}=this.options;return i!=null&&i>=n.from&&i<=n.to?a&&i==t?{text:"",from:t}:(r<0?i-1&&(a+=o-this.countColumn(n,n.search(/\S|$/))),a}countColumn(t,r=t.length){return(0,Sn.countColumn)(t,this.state.tabSize,r)}lineIndent(t,r=1){let{text:n,from:i}=this.lineAt(t,r),a=this.options.overrideIndentation;if(a){let o=a(i);if(o>-1)return o}return this.countColumn(n,n.search(/\S|$/))}get simulatedBreak(){return this.options.simulateBreak||null}},VQe=new wn;function GQe(e,t,r){let n=t.resolveStack(r),i=n.node.enterUnfinishedNodesBefore(r);if(i!=n.node){let a=[];for(let o=i;o!=n.node;o=o.parent)a.push(o);for(let o=a.length-1;o>=0;o--)n={node:a[o],next:n}}return kwe(n,e,r)}function kwe(e,t,r){for(let n=e;n;n=n.next){let i=YQe(n.node);if(i)return i(BC.create(t,r,n))}return 0}function QQe(e){return e.pos==e.options.simulateBreak&&e.options.simulateDoubleBreak}function YQe(e){let t=e.type.prop(VQe);if(t)return t;let r=e.firstChild,n;if(r&&(n=r.type.prop(wn.closedBy))){let i=e.lastChild,a=i&&n.indexOf(i.name)>-1;return o=>JQe(o,!0,1,void 0,a&&!QQe(o)?i.from:void 0)}return e.parent==null?ZQe:null}function ZQe(){return 0}var BC=class extends N5{constructor(t,r,n){super(t.state,t.options),this.base=t,this.pos=r,this.context=n}get node(){return this.context.node}static create(t,r,n){return new BC(t,r,n)}get textAfter(){return this.textAfterPos(this.pos)}get baseIndent(){return this.baseIndentFor(this.node)}baseIndentFor(t){let r=this.state.doc.lineAt(t.from);for(;;){let n=t.resolve(r.from);for(;n.parent&&n.parent.from==n.from;)n=n.parent;if(XQe(n,t))break;r=this.state.doc.lineAt(n.from)}return this.lineIndent(r.from)}continue(){return kwe(this.context.next,this.base,this.pos)}};function XQe(e,t){for(let r=t;r;r=r.parent)if(e==r)return!0;return!1}function KQe(e){let t=e.node,r=t.childAfter(t.from),n=t.lastChild;if(!r)return null;let i=e.options.simulateBreak,a=e.state.doc.lineAt(r.from),o=i==null||i<=a.from?a.to:Math.min(a.to,i);for(let s=r.to;;){let l=t.childAfter(s);if(!l||l==n)return null;if(!l.type.isSkipped)return l.from{if(!e.docChanged||!e.isUserEvent("input.type")&&!e.isUserEvent("input.complete"))return e;let t=e.startState.languageDataAt("indentOnInput",e.startState.selection.main.head);if(!t.length)return e;let r=e.newDoc,{head:n}=e.newSelection.main,i=r.lineAt(n);if(n>i.from+eYe)return e;let a=r.sliceString(i.from,n);if(!t.some(u=>u.test(a)))return e;let{state:o}=e,s=-1,l=[];for(let{head:u}of o.selection.ranges){let c=o.doc.lineAt(u);if(c.from==s)continue;s=c.from;let f=HQe(o,c.from);if(f==null)continue;let d=/^\s*/.exec(c.text)[0],p=WQe(o,f);d!=p&&l.push({from:c.from,to:c.from+d.length,insert:p})}return l.length?[e,{changes:l,sequential:!0}]:e})}var tYe=Sn.Facet.define(),rYe=new wn;function nYe(e,t,r){let n=Zs(e);if(n.lengthr)continue;if(a&&s.from=t&&u.to>r&&(a=u)}}return a}function iYe(e){let t=e.lastChild;return t&&t.to==e.to&&t.type.isError}function T5(e,t,r){for(let n of e.facet(tYe)){let i=n(e,t,r);if(i)return i}return nYe(e,t,r)}function Dwe(e,t){let r=t.mapPos(e.from,1),n=t.mapPos(e.to,-1);return r>=n?void 0:{from:r,to:n}}var I5=Sn.StateEffect.define({map:Dwe}),qC=Sn.StateEffect.define({map:Dwe});function Owe(e){let t=[];for(let{head:r}of e.state.selection.ranges)t.some(n=>n.from<=r&&n.to>=r)||t.push(e.lineBlockAt(r));return t}var Vy=Sn.StateField.define({create(){return on.Decoration.none},update(e,t){e=e.map(t.changes);for(let r of t.effects)if(r.is(I5)&&!aYe(e,r.value.from,r.value.to)){let{preparePlaceholder:n}=t.state.facet(dQ),i=n?on.Decoration.replace({widget:new oQ(n(t.state,r.value))}):vwe;e=e.update({add:[i.range(r.value.from,r.value.to)]})}else r.is(qC)&&(e=e.update({filter:(n,i)=>r.value.from!=n||r.value.to!=i,filterFrom:r.value.from,filterTo:r.value.to}));if(t.selection){let r=!1,{head:n}=t.selection.main;e.between(n,n,(i,a)=>{in&&(r=!0)}),r&&(e=e.update({filterFrom:n,filterTo:n,filter:(i,a)=>a<=n||i>=n}))}return e},provide:e=>on.EditorView.decorations.from(e),toJSON(e,t){let r=[];return e.between(0,t.doc.length,(n,i)=>{r.push(n,i)}),r},fromJSON(e){if(!Array.isArray(e)||e.length%2)throw new RangeError("Invalid JSON for fold state");let t=[];for(let r=0;r{(!i||i.from>a)&&(i={from:a,to:o})}),i}function aYe(e,t,r){let n=!1;return e.between(t,t,(i,a)=>{i==t&&a==r&&(n=!0)}),n}function Mwe(e,t){return e.field(Vy,!1)?t:t.concat(Sn.StateEffect.appendConfig.of(Twe()))}var oYe=e=>{for(let t of Owe(e)){let r=T5(e.state,t.from,t.to);if(r)return e.dispatch({effects:Mwe(e.state,[I5.of(r),jwe(e,r)])}),!0}return!1},sYe=e=>{if(!e.state.field(Vy,!1))return!1;let t=[];for(let r of Owe(e)){let n=F5(e.state,r.from,r.to);n&&t.push(qC.of(n),jwe(e,n,!1))}return t.length&&e.dispatch({effects:t}),t.length>0};function jwe(e,t,r=!0){let n=e.state.doc.lineAt(t.from).number,i=e.state.doc.lineAt(t.to).number;return on.EditorView.announce.of(`${e.state.phrase(r?"Folded lines":"Unfolded lines")} ${n} ${e.state.phrase("to")} ${i}.`)}var lYe=e=>{let{state:t}=e,r=[];for(let n=0;n{let t=e.state.field(Vy,!1);if(!t||!t.size)return!1;let r=[];return t.between(0,e.state.doc.length,(n,i)=>{r.push(qC.of({from:n,to:i}))}),e.dispatch({effects:r}),!0};var Nwe=[{key:"Ctrl-Shift-[",mac:"Cmd-Alt-[",run:oYe},{key:"Ctrl-Shift-]",mac:"Cmd-Alt-]",run:sYe},{key:"Ctrl-Alt-[",run:lYe},{key:"Ctrl-Alt-]",run:uYe}],cYe={placeholderDOM:null,preparePlaceholder:null,placeholderText:"\u2026"},dQ=Sn.Facet.define({combine(e){return(0,Sn.combineConfig)(e,cYe)}});function Twe(e){let t=[Vy,dYe];return e&&t.push(dQ.of(e)),t}function Fwe(e,t){let{state:r}=e,n=r.facet(dQ),i=o=>{let s=e.lineBlockAt(e.posAtDOM(o.target)),l=F5(e.state,s.from,s.to);l&&e.dispatch({effects:qC.of(l)}),o.preventDefault()};if(n.placeholderDOM)return n.placeholderDOM(e,i,t);let a=document.createElement("span");return a.textContent=n.placeholderText,a.setAttribute("aria-label",r.phrase("folded code")),a.title=r.phrase("unfold"),a.className="cm-foldPlaceholder",a.onclick=i,a}var vwe=on.Decoration.replace({widget:new class extends on.WidgetType{toDOM(e){return Fwe(e,null)}}}),oQ=class extends on.WidgetType{constructor(t){super(),this.value=t}eq(t){return this.value==t.value}toDOM(t){return Fwe(t,this.value)}},fYe={openText:"\u2304",closedText:"\u203A",markerDOM:null,domEventHandlers:{},foldingChanged:()=>!1},IC=class extends on.GutterMarker{constructor(t,r){super(),this.config=t,this.open=r}eq(t){return this.config==t.config&&this.open==t.open}toDOM(t){if(this.config.markerDOM)return this.config.markerDOM(this.open);let r=document.createElement("span");return r.textContent=this.open?this.config.openText:this.config.closedText,r.title=t.state.phrase(this.open?"Fold line":"Unfold line"),r}};function _we(e={}){let t=Object.assign(Object.assign({},fYe),e),r=new IC(t,!0),n=new IC(t,!1),i=on.ViewPlugin.fromClass(class{constructor(o){this.from=o.viewport.from,this.markers=this.buildMarkers(o)}update(o){(o.docChanged||o.viewportChanged||o.startState.facet(vv)!=o.state.facet(vv)||o.startState.field(Vy,!1)!=o.state.field(Vy,!1)||Zs(o.startState)!=Zs(o.state)||t.foldingChanged(o))&&(this.markers=this.buildMarkers(o.view))}buildMarkers(o){let s=new Sn.RangeSetBuilder;for(let l of o.viewportLineBlocks){let u=F5(o.state,l.from,l.to)?n:T5(o.state,l.from,l.to)?r:null;u&&s.add(l.from,l.from,u)}return s.finish()}}),{domEventHandlers:a}=t;return[i,(0,on.gutter)({class:"cm-foldGutter",markers(o){var s;return((s=o.plugin(i))===null||s===void 0?void 0:s.markers)||Sn.RangeSet.empty},initialSpacer(){return new IC(t,!1)},domEventHandlers:Object.assign(Object.assign({},a),{click:(o,s,l)=>{if(a.click&&a.click(o,s,l))return!0;let u=F5(o.state,s.from,s.to);if(u)return o.dispatch({effects:qC.of(u)}),!0;let c=T5(o.state,s.from,s.to);return c?(o.dispatch({effects:I5.of(c)}),!0):!1}})}),Twe()]}var dYe=on.EditorView.baseTheme({".cm-foldPlaceholder":{backgroundColor:"#eee",border:"1px solid #ddd",color:"#888",borderRadius:".2em",margin:"0 1px",padding:"0 1px",cursor:"pointer"},".cm-foldGutter span":{padding:"0 1px",cursor:"pointer"}}),Wd=class{constructor(t,r){this.specs=t;let n;function i(s){let l=Qp.newName();return(n||(n=Object.create(null)))["."+l]=s,l}let a=typeof r.all=="string"?r.all:r.all?i(r.all):void 0,o=r.scope;this.scope=o instanceof Mf?s=>s.prop(l2)==o.data:o?s=>s==o:void 0,this.style=XG(t.map(s=>({tag:s.tag,class:s.class||i(Object.assign({},s,{tag:null}))})),{all:a}).style,this.module=n?new Qp(n):null,this.themeType=r.themeType}static define(t,r){return new Wd(t,r||{})}},sQ=Sn.Facet.define(),Pwe=Sn.Facet.define({combine(e){return e.length?[e[0]]:null}});function nQ(e){let t=e.facet(sQ);return t.length?t:e.facet(Pwe)}function JA(e,t){let r=[pYe],n;return e instanceof Wd&&(e.module&&r.push(on.EditorView.styleModule.of(e.module)),n=e.themeType),t?.fallback?r.push(Pwe.of(e)):n?r.push(sQ.computeN([on.EditorView.darkTheme],i=>i.facet(on.EditorView.darkTheme)==(n=="dark")?[e]:[])):r.push(sQ.of(e)),r}var lQ=class{constructor(t){this.markCache=Object.create(null),this.tree=Zs(t.state),this.decorations=this.buildDeco(t,nQ(t.state)),this.decoratedTo=t.viewport.to}update(t){let r=Zs(t.state),n=nQ(t.state),i=n!=nQ(t.startState),{viewport:a}=t.view,o=t.changes.mapPos(this.decoratedTo,1);r.length=a.to?(this.decorations=this.decorations.map(t.changes),this.decoratedTo=o):(r!=this.tree||t.viewportChanged||i)&&(this.tree=r,this.decorations=this.buildDeco(t.view,n),this.decoratedTo=a.to)}buildDeco(t,r){if(!r||!this.tree.length)return on.Decoration.none;let n=new Sn.RangeSetBuilder;for(let{from:i,to:a}of t.visibleRanges)dwe(this.tree,r,(o,s,l)=>{n.add(o,s,this.markCache[l]||(this.markCache[l]=on.Decoration.mark({class:l})))},i,a);return n.finish()}},pYe=Sn.Prec.high(on.ViewPlugin.fromClass(lQ,{decorations:e=>e.decorations})),pQ=Wd.define([{tag:qe.meta,color:"#404740"},{tag:qe.link,textDecoration:"underline"},{tag:qe.heading,textDecoration:"underline",fontWeight:"bold"},{tag:qe.emphasis,fontStyle:"italic"},{tag:qe.strong,fontWeight:"bold"},{tag:qe.strikethrough,textDecoration:"line-through"},{tag:qe.keyword,color:"#708"},{tag:[qe.atom,qe.bool,qe.url,qe.contentSeparator,qe.labelName],color:"#219"},{tag:[qe.literal,qe.inserted],color:"#164"},{tag:[qe.string,qe.deleted],color:"#a11"},{tag:[qe.regexp,qe.escape,qe.special(qe.string)],color:"#e40"},{tag:qe.definition(qe.variableName),color:"#00f"},{tag:qe.local(qe.variableName),color:"#30a"},{tag:[qe.typeName,qe.namespace],color:"#085"},{tag:qe.className,color:"#167"},{tag:[qe.special(qe.variableName),qe.macroName],color:"#256"},{tag:qe.definition(qe.propertyName),color:"#00c"},{tag:qe.comment,color:"#940"},{tag:qe.invalid,color:"#f00"}]),mYe=on.EditorView.baseTheme({"&.cm-focused .cm-matchingBracket":{backgroundColor:"#328c8252"},"&.cm-focused .cm-nonmatchingBracket":{backgroundColor:"#bb555544"}}),Iwe=1e4,Bwe="()[]{}",Rwe=Sn.Facet.define({combine(e){return(0,Sn.combineConfig)(e,{afterCursor:!0,brackets:Bwe,maxScanDistance:Iwe,renderMatch:gYe})}}),hYe=on.Decoration.mark({class:"cm-matchingBracket"}),AYe=on.Decoration.mark({class:"cm-nonmatchingBracket"});function gYe(e){let t=[],r=e.matched?hYe:AYe;return t.push(r.range(e.start.from,e.start.to)),e.end&&t.push(r.range(e.end.from,e.end.to)),t}var vYe=Sn.StateField.define({create(){return on.Decoration.none},update(e,t){if(!t.docChanged&&!t.selection)return e;let r=[],n=t.state.facet(Rwe);for(let i of t.state.selection.ranges){if(!i.empty)continue;let a=M5(t.state,i.head,-1,n)||i.head>0&&M5(t.state,i.head-1,1,n)||n.afterCursor&&(M5(t.state,i.head,1,n)||i.headon.EditorView.decorations.from(e)}),yYe=[vYe,mYe];function $we(e={}){return[Rwe.of(e),yYe]}var bYe=new wn;function uQ(e,t,r){let n=e.prop(t<0?wn.openedBy:wn.closedBy);if(n)return n;if(e.name.length==1){let i=r.indexOf(e.name);if(i>-1&&i%2==(t<0?1:0))return[r[i+t]]}return null}function cQ(e){let t=e.type.prop(bYe);return t?t(e.node):e}function M5(e,t,r,n={}){let i=n.maxScanDistance||Iwe,a=n.brackets||Bwe,o=Zs(e),s=o.resolveInner(t,r);for(let l=s;l;l=l.parent){let u=uQ(l.type,r,a);if(u&&l.from0?t>=c.from&&tc.from&&t<=c.to))return xYe(e,t,r,l,c,u,a)}}return wYe(e,t,r,o,s.type,i,a)}function xYe(e,t,r,n,i,a,o){let s=n.parent,l={from:i.from,to:i.to},u=0,c=s?.cursor();if(c&&(r<0?c.childBefore(n.from):c.childAfter(n.to)))do if(r<0?c.to<=n.from:c.from>=n.to){if(u==0&&a.indexOf(c.type.name)>-1&&c.from0)return null;let u={from:r<0?t-1:t,to:r>0?t+1:t},c=e.doc.iterRange(t,r>0?e.doc.length:0),f=0;for(let d=0;!c.next().done&&d<=a;){let p=c.value;r<0&&(d+=p.length);let h=t+d*r;for(let m=r>0?0:p.length-1,g=r>0?p.length:-1;m!=g;m+=r){let A=o.indexOf(p[m]);if(!(A<0||n.resolveInner(h+m,1).type!=i))if(A%2==0==r>0)f++;else{if(f==1)return{start:u,end:{from:h+m,to:h+m+1},matched:A>>1==l>>1};f--}}r>0&&(d+=p.length)}return c.done?{start:u,matched:!1}:null}function ywe(e,t,r,n=0,i=0){t==null&&(t=e.search(/[^\s\u00a0]/),t==-1&&(t=e.length));let a=i;for(let o=n;o=this.string.length}sol(){return this.pos==0}peek(){return this.string.charAt(this.pos)||void 0}next(){if(this.posr}eatSpace(){let t=this.pos;for(;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>t}skipToEnd(){this.pos=this.string.length}skipTo(t){let r=this.string.indexOf(t,this.pos);if(r>-1)return this.pos=r,!0}backUp(t){this.pos-=t}column(){return this.lastColumnPosn?o.toLowerCase():o,a=this.string.substr(this.pos,t.length);return i(a)==i(t)?(r!==!1&&(this.pos+=t.length),!0):null}else{let i=this.string.slice(this.pos).match(t);return i&&i.index>0?null:(i&&r!==!1&&(this.pos+=i[0].length),i)}}current(){return this.string.slice(this.start,this.pos)}};function SYe(e){return{name:e.name||"",token:e.token,blankLine:e.blankLine||(()=>{}),startState:e.startState||(()=>!0),copyState:e.copyState||EYe,indent:e.indent||(()=>null),languageData:e.languageData||{},tokenTable:e.tokenTable||hQ}}function EYe(e){if(typeof e!="object")return e;let t={};for(let r in e){let n=e[r];t[r]=n instanceof Array?n.slice():n}return t}var bwe=new WeakMap,u2=class extends Mf{constructor(t){let r=LQe(t.languageData),n=SYe(t),i,a=new class extends FC{createParse(o,s,l){return new fQ(i,o,s,l)}};super(r,a,[Ewe.of((o,s)=>this.getIndent(o,s))],t.name),this.topNode=OYe(r),i=this,this.streamParser=n,this.stateAfter=new wn({perNode:!0}),this.tokenTable=t.tokenTable?new P5(n.tokenTable):DYe}static define(t){return new u2(t)}getIndent(t,r){let n=Zs(t.state),i=n.resolve(r);for(;i&&i.type!=this.topNode;)i=i.parent;if(!i)return null;let a,{overrideIndentation:o}=t.options;o&&(a=bwe.get(t.state),a!=null&&a1e4)return null;for(;l=n&&r+t.length<=i&&t.prop(e.stateAfter);if(a)return{state:e.streamParser.copyState(a),pos:r+t.length};for(let o=t.children.length-1;o>=0;o--){let s=t.children[o],l=r+t.positions[o],u=s instanceof ha&&l=t.length)return t;!i&&t.type==e.topNode&&(i=!0);for(let a=t.children.length-1;a>=0;a--){let o=t.positions[a],s=t.children[a],l;if(or&&mQ(e,i.tree,0-i.offset,r,o),l;if(s&&(l=qwe(e,i.tree,r+i.offset,s.pos+i.offset,!1)))return{state:s.state,tree:l}}return{state:e.streamParser.startState(n?j5(n):4),tree:ha.empty}}var fQ=class{constructor(t,r,n,i){this.lang=t,this.input=r,this.fragments=n,this.ranges=i,this.stoppedAt=null,this.chunks=[],this.chunkPos=[],this.chunk=[],this.chunkReused=void 0,this.rangeIndex=0,this.to=i[i.length-1].to;let a=Av.get(),o=i[0].from,{state:s,tree:l}=kYe(t,n,o,a?.state);this.state=s,this.parsedPos=this.chunkStart=o+l.length;for(let u=0;u=r?this.finish():t&&this.parsedPos>=t.viewport.to?(t.skipUntilInView(this.parsedPos,r),this.finish()):null}stopAt(t){this.stoppedAt=t}lineAfter(t){let r=this.input.chunk(t);if(this.input.lineChunks)r==` `&&(r="");else{let n=r.indexOf(` -`);n>-1&&(r=r.slice(0,n))}return t+r.length<=this.to?r:r.slice(0,this.to-t)}nextLine(){let t=this.parsedPos,r=this.lineAfter(t),n=t+r.length;for(let i=this.rangeIndex;;){let a=this.ranges[i].to;if(a>=n||(r=r.slice(0,a-(n-r.length)),i++,i==this.ranges.length))break;let o=this.ranges[i].from,s=this.lineAfter(o);r+=s,n=o+s.length}return{line:r,end:n}}skipGapsTo(t,r,n){for(;;){let i=this.ranges[this.rangeIndex].to,a=t+r;if(n>0?i>a:i>=a)break;r+=this.ranges[++this.rangeIndex].from-i}return r}moveRangeIndex(){for(;this.ranges[this.rangeIndex].to1){a=this.skipGapsTo(r,a,1),r+=a;let o=this.chunk.length;a=this.skipGapsTo(n,a,-1),n+=a,i+=this.chunk.length-o}return this.chunk.push(t,r,n,i),a}parseLine(t){let{line:r,end:n}=this.nextLine(),i=0,{streamParser:a}=this.lang,o=new _5(r,t?t.state.tabSize:4,t?j5(t.state):2);if(o.eol())a.blankLine(this.state,o.indentUnit);else for(;!o.eol();){let s=Lwe(a.token,o,this.state);if(s&&(i=this.emitToken(this.lang.tokenTable.resolve(s),this.parsedPos+o.start,this.parsedPos+o.pos,4,i)),o.start>1e4)break}this.parsedPos=n,this.moveRangeIndex(),this.parsedPost.start)return i}throw new Error("Stream parser failed to advance stream.")}var hQ=Object.create(null),RC=[Dl.none],CYe=new a2(RC),xwe=[],wwe=Object.create(null),zwe=Object.create(null);for(let[e,t]of[["variable","variableName"],["variable-2","variableName.special"],["string-2","string.special"],["def","variableName.definition"],["tag","tagName"],["attribute","attributeName"],["type","typeName"],["builtin","variableName.standard"],["qualifier","modifier"],["error","invalid"],["header","heading"],["property","propertyName"]])zwe[e]=Uwe(hQ,t);var P5=class{constructor(t){this.extra=t,this.table=Object.assign(Object.create(null),zwe)}resolve(t){return t?this.table[t]||(this.table[t]=Uwe(this.extra,t)):0}},DYe=new P5(hQ);function iQ(e,t){xwe.indexOf(e)>-1||(xwe.push(e),console.warn(t))}function Uwe(e,t){let r=[];for(let s of t.split(" ")){let l=[];for(let u of s.split(".")){let c=e[u]||qe[u];c?typeof c=="function"?l.length?l=l.map(c):iQ(u,`Modifier ${u} used at start of tag`):l.length?iQ(u,`Tag ${u} used as modifier`):l=Array.isArray(c)?c:[c]:iQ(u,`Unknown highlighting tag ${u}`)}for(let u of l)r.push(u)}if(!r.length)return 0;let n=t.replace(/ /g,"_"),i=n+" "+r.map(s=>s.id),a=wwe[i];if(a)return a.id;let o=wwe[i]=Dl.define({id:RC.length,name:n,props:[cwe({[n]:r})]});return RC.push(o),o.id}function OYe(e){let t=Dl.define({id:RC.length,name:"Document",props:[l2.add(()=>e)],top:!0});return RC.push(t),t}var TKt={rtl:on.Decoration.mark({class:"cm-iso",inclusive:!0,attributes:{dir:"rtl"},bidiIsolate:on.Direction.RTL}),ltr:on.Decoration.mark({class:"cm-iso",inclusive:!0,attributes:{dir:"ltr"},bidiIsolate:on.Direction.LTR}),auto:on.Decoration.mark({class:"cm-iso",inclusive:!0,attributes:{dir:"auto"},bidiIsolate:null})};var Wwe=require("@codemirror/view");var Hwe=e=>{var{theme:t,settings:r={},styles:n=[]}=e,i={".cm-gutters":{}},a={};r.background&&(a.backgroundColor=r.background),r.backgroundImage&&(a.backgroundImage=r.backgroundImage),r.foreground&&(a.color=r.foreground),(r.background||r.foreground)&&(i["&"]=a),r.fontFamily&&(i["&.cm-editor .cm-scroller"]={fontFamily:r.fontFamily}),r.gutterBackground&&(i[".cm-gutters"].backgroundColor=r.gutterBackground),r.gutterForeground&&(i[".cm-gutters"].color=r.gutterForeground),r.gutterBorder&&(i[".cm-gutters"].borderRightColor=r.gutterBorder),r.caret&&(i[".cm-content"]={caretColor:r.caret},i[".cm-cursor, .cm-dropCursor"]={borderLeftColor:r.caret});var o={};r.gutterActiveForeground&&(o.color=r.gutterActiveForeground),r.lineHighlight&&(i[".cm-activeLine"]={backgroundColor:r.lineHighlight},o.backgroundColor=r.lineHighlight),i[".cm-activeLineGutter"]=o,r.selection&&(i["&.cm-focused .cm-selectionBackground, & .cm-line::selection, & .cm-selectionLayer .cm-selectionBackground, .cm-content ::selection"]={background:r.selection+" !important"}),r.selectionMatch&&(i["& .cm-selectionMatch"]={backgroundColor:r.selectionMatch});var s=Wwe.EditorView.theme(i,{dark:t==="dark"}),l=Wd.define(n),u=[s,JA(l)];return u};var MYe={background:"#0f0f0f",foreground:"#defdef",caret:"#00FF00",selection:"#515151",selectionMatch:"#515151",gutterBackground:"#555",gutterForeground:"#FFFFFF",lineHighlight:"#0a6bcb3d"},AQ=e=>{var{theme:t="dark",settings:r={},styles:n=[]}=e||{};return Hwe({theme:t,settings:Fn({},MYe,r),styles:[{tag:qe.keyword,color:"darkgoldenrod",fontWeight:"bold"},{tag:qe.atom,color:"#77F"},{tag:qe.comment,color:"#7a7b7c",fontStyle:"italic"},{tag:qe.number,color:"violet"},{tag:qe.definition(qe.variableName),color:"#fffabc"},{tag:qe.variableName,color:"#abcdef"},{tag:qe.function(qe.variableName),color:"#fffabc"},{tag:qe.typeName,color:"#FFDD44"},{tag:qe.tagName,color:"#def"},{tag:qe.string,color:"#2b4"},{tag:qe.meta,color:"#C9F"},{tag:qe.bracket,color:"#8a8a8a"},{tag:qe.attributeName,color:"#DDFF00"},{tag:qe.heading,color:"aquamarine",fontWeight:"bold"},{tag:qe.link,color:"blueviolet",fontWeight:"bold"},...n]})},UKt=AQ();var En={};dM(En,{basicSetup:()=>U5,color:()=>fZe,default:()=>VC,defaultLightThemeOption:()=>FQ,getDefaultExtensions:()=>_Q,getStatistics:()=>PQ,minimalSetup:()=>cZe,oneDark:()=>TQ,oneDarkHighlightStyle:()=>xSe,oneDarkTheme:()=>bSe,useCodeMirror:()=>IQ});function LC(e,t){if(e==null)return{};var r={},n=Object.keys(e),i,a;for(a=0;a=0)&&(r[i]=e[i]);return r}var d2=Ae(Te());var Qp=Ae(Te()),Qy=require("@codemirror/state"),HC=require("@codemirror/view");var SSe=require("@codemirror/commands");var Po=require("@codemirror/view"),uSe=require("@codemirror/state"),eg=require("@codemirror/commands"),z5=require("@codemirror/search");var Xt=require("@codemirror/state"),bo=require("@codemirror/view");var R5=class{constructor(t,r,n){this.state=t,this.pos=r,this.explicit=n,this.abortListeners=[]}tokenBefore(t){let r=Zs(this.state).resolveInner(this.pos,-1);for(;r&&t.indexOf(r.name)<0;)r=r.parent;return r?{from:r.from,to:this.pos,text:this.state.sliceDoc(r.from,this.pos),type:r.type}:null}matchBefore(t){let r=this.state.doc.lineAt(this.pos),n=Math.max(r.from,this.pos-250),i=r.text.slice(n-r.from,this.pos-r.from),a=i.search(Jwe(t,!1));return a<0?null:{from:n+a,to:this.pos,text:i.slice(a)}}get aborted(){return this.abortListeners==null}addEventListener(t,r){t=="abort"&&this.abortListeners&&this.abortListeners.push(r)}};function Vwe(e){let t=Object.keys(e).join(""),r=/\w/.test(t);return r&&(t=t.replace(/\w/g,"")),`[${r?"\\w":""}${t.replace(/[^\w\s]/g,"\\$&")}]`}function jYe(e){let t=Object.create(null),r=Object.create(null);for(let{label:i}of e){t[i[0]]=!0;for(let a=1;atypeof i=="string"?{label:i}:i),[r,n]=t.every(i=>/^\w+$/.test(i.label))?[/\w*$/,/\w+$/]:jYe(t);return i=>{let a=i.matchBefore(n);return a||i.explicit?{from:a?a.from:i.pos,options:t,validFor:r}:null}}var $5=class{constructor(t,r,n,i){this.completion=t,this.source=r,this.match=n,this.score=i}};function bv(e){return e.selection.main.from}function Jwe(e,t){var r;let{source:n}=e,i=t&&n[0]!="^",a=n[n.length-1]!="$";return!i&&!a?e:new RegExp(`${i?"^":""}(?:${n})${a?"$":""}`,(r=e.flags)!==null&&r!==void 0?r:e.ignoreCase?"i":"")}var TYe=Xt.Annotation.define();function FYe(e,t,r,n){let{main:i}=e.selection,a=r-i.from,o=n-i.from;return Object.assign(Object.assign({},e.changeByRange(s=>s!=i&&r!=n&&e.sliceDoc(s.from+a,s.from+o)!=e.sliceDoc(r,n)?{range:s}:{changes:{from:s.from+a,to:n==i.from?s.to:s.from+o,insert:t},range:Xt.EditorSelection.cursor(s.from+a+t.length)})),{scrollIntoView:!0,userEvent:"input.complete"})}var Gwe=new WeakMap;function _Ye(e){if(!Array.isArray(e))return e;let t=Gwe.get(e);return t||Gwe.set(e,t=NYe(e)),t}var q5=Xt.StateEffect.define(),zC=Xt.StateEffect.define(),yQ=class{constructor(t){this.pattern=t,this.chars=[],this.folded=[],this.any=[],this.precise=[],this.byWord=[],this.score=0,this.matched=[];for(let r=0;r=48&&w<=57||w>=97&&w<=122?2:w>=65&&w<=90?1:0:(S=(0,Xt.fromCodePoint)(w))!=S.toLowerCase()?1:S!=S.toUpperCase()?2:0;(!b||k==1&&g||x==0&&k!=0)&&(r[f]==w||n[f]==w&&(d=!0)?o[f++]=b:o.length&&(A=!1)),x=k,b+=(0,Xt.codePointSize)(w)}return f==l&&o[0]==0&&A?this.result(-100+(d?-200:0),o,t):p==l&&h==0?this.ret(-200-t.length+(m==t.length?0:-100),[0,m]):s>-1?this.ret(-700-t.length,[s,s+this.pattern.length]):p==l?this.ret(-200+-700-t.length,[h,m]):f==l?this.result(-100+(d?-200:0)+-700+(A?0:-1100),o,t):r.length==2?null:this.result((i[0]?-700:0)+-200+-1100,i,t)}result(t,r,n){let i=[],a=0;for(let o of r){let s=o+(this.astral?(0,Xt.codePointSize)((0,Xt.codePointAt)(n,o)):1);a&&i[a-1]==o?i[a-1]=s:(i[a++]=o,i[a++]=s)}return this.ret(t-n.length,i)}},bQ=class{constructor(t){this.pattern=t,this.matched=[],this.score=0,this.folded=t.toLowerCase()}match(t){if(t.length"",optionClass:()=>"",aboveCursor:!1,icons:!0,addToOptions:[],positionInfo:PYe,filterStrict:!1,compareCompletions:(t,r)=>t.label.localeCompare(r.label),interactionDelay:75,updateSyncTime:100},{defaultKeymap:(t,r)=>t&&r,closeOnBlur:(t,r)=>t&&r,icons:(t,r)=>t&&r,tooltipClass:(t,r)=>n=>Qwe(t(n),r(n)),optionClass:(t,r)=>n=>Qwe(t(n),r(n)),addToOptions:(t,r)=>t.concat(r),filterStrict:(t,r)=>t||r})}});function Qwe(e,t){return e?t?e+" "+t:e:t}function PYe(e,t,r,n,i,a){let o=e.textDirection==bo.Direction.RTL,s=o,l=!1,u="top",c,f,d=t.left-i.left,p=i.right-t.right,h=n.right-n.left,m=n.bottom-n.top;if(s&&d=m||b>t.top?c=r.bottom-t.top:(u="bottom",c=t.bottom-r.top)}let g=(t.bottom-t.top)/a.offsetHeight,A=(t.right-t.left)/a.offsetWidth;return{style:`${u}: ${c/g}px; max-width: ${f/A}px`,class:"cm-completionInfo-"+(l?o?"left-narrow":"right-narrow":s?"left":"right")}}function IYe(e){let t=e.addToOptions.slice();return e.icons&&t.push({render(r){let n=document.createElement("div");return n.classList.add("cm-completionIcon"),r.type&&n.classList.add(...r.type.split(/\s+/g).map(i=>"cm-completionIcon-"+i)),n.setAttribute("aria-hidden","true"),n},position:20}),t.push({render(r,n,i,a){let o=document.createElement("span");o.className="cm-completionLabel";let s=r.displayLabel||r.label,l=0;for(let u=0;ul&&o.appendChild(document.createTextNode(s.slice(l,c)));let d=o.appendChild(document.createElement("span"));d.appendChild(document.createTextNode(s.slice(c,f))),d.className="cm-completionMatchedText",l=f}return lr.position-n.position).map(r=>r.render)}function gQ(e,t,r){if(e<=r)return{from:0,to:e};if(t<0&&(t=0),t<=e>>1){let i=Math.floor(t/r);return{from:i*r,to:(i+1)*r}}let n=Math.floor((e-t)/r);return{from:e-(n+1)*r,to:e-n*r}}var xQ=class{constructor(t,r,n){this.view=t,this.stateField=r,this.applyCompletion=n,this.info=null,this.infoDestroy=null,this.placeInfoReq={read:()=>this.measureInfo(),write:l=>this.placeInfo(l),key:this},this.space=null,this.currentClass="";let i=t.state.field(r),{options:a,selected:o}=i.open,s=t.state.facet(Ml);this.optionContent=IYe(s),this.optionClass=s.optionClass,this.tooltipClass=s.tooltipClass,this.range=gQ(a.length,o,s.maxRenderedOptions),this.dom=document.createElement("div"),this.dom.className="cm-tooltip-autocomplete",this.updateTooltipClass(t.state),this.dom.addEventListener("mousedown",l=>{let{options:u}=t.state.field(r).open;for(let c=l.target,f;c&&c!=this.dom;c=c.parentNode)if(c.nodeName=="LI"&&(f=/-(\d+)$/.exec(c.id))&&+f[1]{let u=t.state.field(this.stateField,!1);u&&u.tooltip&&t.state.facet(Ml).closeOnBlur&&l.relatedTarget!=t.contentDOM&&t.dispatch({effects:zC.of(null)})}),this.showOptions(a,i.id)}mount(){this.updateSel()}showOptions(t,r){this.list&&this.list.remove(),this.list=this.dom.appendChild(this.createListBox(t,r,this.range)),this.list.addEventListener("scroll",()=>{this.info&&this.view.requestMeasure(this.placeInfoReq)})}update(t){var r;let n=t.state.field(this.stateField),i=t.startState.field(this.stateField);if(this.updateTooltipClass(t.state),n!=i){let{options:a,selected:o,disabled:s}=n.open;(!i.open||i.open.options!=a)&&(this.range=gQ(a.length,o,t.state.facet(Ml).maxRenderedOptions),this.showOptions(a,n.id)),this.updateSel(),s!=((r=i.open)===null||r===void 0?void 0:r.disabled)&&this.dom.classList.toggle("cm-tooltip-autocomplete-disabled",!!s)}}updateTooltipClass(t){let r=this.tooltipClass(t);if(r!=this.currentClass){for(let n of this.currentClass.split(" "))n&&this.dom.classList.remove(n);for(let n of r.split(" "))n&&this.dom.classList.add(n);this.currentClass=r}}positioned(t){this.space=t,this.info&&this.view.requestMeasure(this.placeInfoReq)}updateSel(){let t=this.view.state.field(this.stateField),r=t.open;if((r.selected>-1&&r.selected=this.range.to)&&(this.range=gQ(r.options.length,r.selected,this.view.state.facet(Ml).maxRenderedOptions),this.showOptions(r.options,t.id)),this.updateSelectedOption(r.selected)){this.destroyInfo();let{completion:n}=r.options[r.selected],{info:i}=n;if(!i)return;let a=typeof i=="string"?document.createTextNode(i):i(n);if(!a)return;"then"in a?a.then(o=>{o&&this.view.state.field(this.stateField,!1)==t&&this.addInfoPane(o,n)}).catch(o=>(0,bo.logException)(this.view.state,o,"completion info")):this.addInfoPane(a,n)}}addInfoPane(t,r){this.destroyInfo();let n=this.info=document.createElement("div");if(n.className="cm-tooltip cm-completionInfo",t.nodeType!=null)n.appendChild(t),this.infoDestroy=null;else{let{dom:i,destroy:a}=t;n.appendChild(i),this.infoDestroy=a||null}this.dom.appendChild(n),this.view.requestMeasure(this.placeInfoReq)}updateSelectedOption(t){let r=null;for(let n=this.list.firstChild,i=this.range.from;n;n=n.nextSibling,i++)n.nodeName!="LI"||!n.id?i--:i==t?n.hasAttribute("aria-selected")||(n.setAttribute("aria-selected","true"),r=n):n.hasAttribute("aria-selected")&&n.removeAttribute("aria-selected");return r&&RYe(this.list,r),r}measureInfo(){let t=this.dom.querySelector("[aria-selected]");if(!t||!this.info)return null;let r=this.dom.getBoundingClientRect(),n=this.info.getBoundingClientRect(),i=t.getBoundingClientRect(),a=this.space;if(!a){let o=this.dom.ownerDocument.defaultView||window;a={left:0,top:0,right:o.innerWidth,bottom:o.innerHeight}}return i.top>Math.min(a.bottom,r.bottom)-10||i.bottomn.from||n.from==0))if(a=d,typeof u!="string"&&u.header)i.appendChild(u.header(u));else{let p=i.appendChild(document.createElement("completion-section"));p.textContent=d}}let c=i.appendChild(document.createElement("li"));c.id=r+"-"+o,c.setAttribute("role","option");let f=this.optionClass(s);f&&(c.className=f);for(let d of this.optionContent){let p=d(s,this.view.state,this.view,l);p&&c.appendChild(p)}}return n.from&&i.classList.add("cm-completionListIncompleteTop"),n.tonew xQ(r,e,t)}function RYe(e,t){let r=e.getBoundingClientRect(),n=t.getBoundingClientRect(),i=r.height/e.offsetHeight;n.topr.bottom&&(e.scrollTop+=(n.bottom-r.bottom)/i)}function Ywe(e){return(e.boost||0)*100+(e.apply?10:0)+(e.info?5:0)+(e.type?1:0)}function $Ye(e,t){let r=[],n=null,i=u=>{r.push(u);let{section:c}=u.completion;if(c){n||(n=[]);let f=typeof c=="string"?c:c.name;n.some(d=>d.name==f)||n.push(typeof c=="string"?{name:f}:c)}},a=t.facet(Ml);for(let u of e)if(u.hasResult()){let c=u.result.getMatch;if(u.result.filter===!1)for(let f of u.result.options)i(new $5(f,u.source,c?c(f):[],1e9-r.length));else{let f=t.sliceDoc(u.from,u.to),d,p=a.filterStrict?new bQ(f):new yQ(f);for(let h of u.result.options)if(d=p.match(h.label)){let m=h.displayLabel?c?c(h,d.matched):[]:d.matched;i(new $5(h,u.source,m,d.score+(h.boost||0)))}}}if(n){let u=Object.create(null),c=0,f=(d,p)=>{var h,m;return((h=d.rank)!==null&&h!==void 0?h:1e9)-((m=p.rank)!==null&&m!==void 0?m:1e9)||(d.namef.score-c.score||l(c.completion,f.completion))){let c=u.completion;!s||s.label!=c.label||s.detail!=c.detail||s.type!=null&&c.type!=null&&s.type!=c.type||s.apply!=c.apply||s.boost!=c.boost?o.push(u):Ywe(u.completion)>Ywe(s)&&(o[o.length-1]=u),s=u.completion}return o}var yv=class{constructor(t,r,n,i,a,o){this.options=t,this.attrs=r,this.tooltip=n,this.timestamp=i,this.selected=a,this.disabled=o}setSelected(t,r){return t==this.selected||t>=this.options.length?this:new yv(this.options,Zwe(r,t),this.tooltip,this.timestamp,t,this.disabled)}static build(t,r,n,i,a){let o=$Ye(t,r);if(!o.length)return i&&t.some(l=>l.state==1)?new yv(i.options,i.attrs,i.tooltip,i.timestamp,i.selected,!0):null;let s=r.facet(Ml).selectOnOpen?0:-1;if(i&&i.selected!=s&&i.selected!=-1){let l=i.options[i.selected].completion;for(let u=0;uu.hasResult()?Math.min(l,u.from):l,1e8),create:WYe,above:a.aboveCursor},i?i.timestamp:Date.now(),s,!1)}map(t){return new yv(this.options,this.attrs,Object.assign(Object.assign({},this.tooltip),{pos:t.mapPos(this.tooltip.pos)}),this.timestamp,this.selected,this.disabled)}},c2=class{constructor(t,r,n){this.active=t,this.id=r,this.open=n}static start(){return new c2(zYe,"cm-ac-"+Math.floor(Math.random()*2e6).toString(36),null)}update(t){let{state:r}=t,n=r.facet(Ml),a=(n.override||r.languageDataAt("autocomplete",bv(r)).map(_Ye)).map(s=>(this.active.find(u=>u.source==s)||new Ol(s,this.active.some(u=>u.state!=0)?1:0)).update(t,n));a.length==this.active.length&&a.every((s,l)=>s==this.active[l])&&(a=this.active);let o=this.open;o&&t.docChanged&&(o=o.map(t.changes)),t.selection||a.some(s=>s.hasResult()&&t.changes.touchesRange(s.from,s.to))||!qYe(a,this.active)?o=yv.build(a,r,this.id,o,n):o&&o.disabled&&!a.some(s=>s.state==1)&&(o=null),!o&&a.every(s=>s.state!=1)&&a.some(s=>s.hasResult())&&(a=a.map(s=>s.hasResult()?new Ol(s.source,0):s));for(let s of t.effects)s.is(tSe)&&(o=o&&o.setSelected(s.value,this.id));return a==this.active&&o==this.open?this:new c2(a,this.id,o)}get tooltip(){return this.open?this.open.tooltip:null}get attrs(){return this.open?this.open.attrs:LYe}};function qYe(e,t){if(e==t)return!0;for(let r=0,n=0;;){for(;r-1&&(r["aria-activedescendant"]=e+"-"+t),r}var zYe=[];function wQ(e){return e.isUserEvent("input.type")?"input":e.isUserEvent("delete.backward")?"delete":null}var Ol=class{constructor(t,r,n=-1){this.source=t,this.state=r,this.explicitPos=n}hasResult(){return!1}update(t,r){let n=wQ(t),i=this;n?i=i.handleUserEvent(t,n,r):t.docChanged?i=i.handleChange(t):t.selection&&i.state!=0&&(i=new Ol(i.source,0));for(let a of t.effects)if(a.is(q5))i=new Ol(i.source,1,a.value?bv(t.state):-1);else if(a.is(zC))i=new Ol(i.source,0);else if(a.is(eSe))for(let o of a.value)o.source==i.source&&(i=o);return i}handleUserEvent(t,r,n){return r=="delete"||!n.activateOnTyping?this.map(t.changes):new Ol(this.source,1)}handleChange(t){return t.changes.touchesRange(bv(t.startState))?new Ol(this.source,0):this.map(t.changes)}map(t){return t.empty||this.explicitPos<0?this:new Ol(this.source,this.state,t.mapPos(this.explicitPos))}},xv=class extends Ol{constructor(t,r,n,i,a){super(t,2,r),this.result=n,this.from=i,this.to=a}hasResult(){return!0}handleUserEvent(t,r,n){var i;let a=this.result;a.map&&!t.changes.empty&&(a=a.map(a,t.changes));let o=t.changes.mapPos(this.from),s=t.changes.mapPos(this.to,1),l=bv(t.state);if((this.explicitPos<0?l<=o:ls||!a||r=="delete"&&bv(t.startState)==this.from)return new Ol(this.source,r=="input"&&n.activateOnTyping?1:0);let u=this.explicitPos<0?-1:t.changes.mapPos(this.explicitPos);return UYe(a.validFor,t.state,o,s)?new xv(this.source,u,a,o,s):a.update&&(a=a.update(a,o,s,new R5(t.state,l,u>=0)))?new xv(this.source,u,a,a.from,(i=a.to)!==null&&i!==void 0?i:bv(t.state)):new Ol(this.source,1,u)}handleChange(t){return t.changes.touchesRange(this.from,this.to)?new Ol(this.source,0):this.map(t.changes)}map(t){return t.empty?this:(this.result.map?this.result.map(this.result,t):this.result)?new xv(this.source,this.explicitPos<0?-1:t.mapPos(this.explicitPos),this.result,t.mapPos(this.from),t.mapPos(this.to,1)):new Ol(this.source,0)}};function UYe(e,t,r,n){if(!e)return!1;let i=t.sliceDoc(r,n);return typeof e=="function"?e(i,r,n,t):Jwe(e,!0).test(i)}var eSe=Xt.StateEffect.define({map(e,t){return e.map(r=>r.map(t))}}),tSe=Xt.StateEffect.define(),Fc=Xt.StateField.define({create(){return c2.start()},update(e,t){return e.update(t)},provide:e=>[bo.showTooltip.from(e,t=>t.tooltip),bo.EditorView.contentAttributes.from(e,t=>t.attrs)]});function EQ(e,t){let r=t.completion.apply||t.completion.label,n=e.state.field(Fc).active.find(i=>i.source==t.source);return n instanceof xv?(typeof r=="string"?e.dispatch(Object.assign(Object.assign({},FYe(e.state,r,n.from,n.to)),{annotations:TYe.of(t.completion)})):r(e,t.completion,n.from,n.to),!0):!1}var WYe=BYe(Fc,EQ);function B5(e,t="option"){return r=>{let n=r.state.field(Fc,!1);if(!n||!n.open||n.open.disabled||Date.now()-n.open.timestamp-1?n.open.selected+i*(e?1:-1):e?0:o-1;return s<0?s=t=="page"?0:o-1:s>=o&&(s=t=="page"?o-1:0),r.dispatch({effects:tSe.of(s)}),!0}}var HYe=e=>{let t=e.state.field(Fc,!1);return e.state.readOnly||!t||!t.open||t.open.selected<0||t.open.disabled||Date.now()-t.open.timestampe.state.field(Fc,!1)?(e.dispatch({effects:q5.of(!0)}),!0):!1,GYe=e=>{let t=e.state.field(Fc,!1);return!t||!t.active.some(r=>r.state!=0)?!1:(e.dispatch({effects:zC.of(null)}),!0)},SQ=class{constructor(t,r){this.active=t,this.context=r,this.time=Date.now(),this.updates=[],this.done=void 0}},QYe=50,YYe=1e3,ZYe=bo.ViewPlugin.fromClass(class{constructor(e){this.view=e,this.debounceUpdate=-1,this.running=[],this.debounceAccept=-1,this.pendingStart=!1,this.composing=0;for(let t of e.state.field(Fc).active)t.state==1&&this.startQuery(t)}update(e){let t=e.state.field(Fc);if(!e.selectionSet&&!e.docChanged&&e.startState.field(Fc)==t)return;let r=e.transactions.some(i=>(i.selection||i.docChanged)&&!wQ(i));for(let i=0;iQYe&&Date.now()-a.time>YYe){for(let o of a.context.abortListeners)try{o()}catch(s){(0,bo.logException)(this.view.state,s)}a.context.abortListeners=null,this.running.splice(i--,1)}else a.updates.push(...e.transactions)}this.debounceUpdate>-1&&clearTimeout(this.debounceUpdate),e.transactions.some(i=>i.effects.some(a=>a.is(q5)))&&(this.pendingStart=!0);let n=this.pendingStart?50:e.state.facet(Ml).activateOnTypingDelay;if(this.debounceUpdate=t.active.some(i=>i.state==1&&!this.running.some(a=>a.active.source==i.source))?setTimeout(()=>this.startUpdate(),n):-1,this.composing!=0)for(let i of e.transactions)wQ(i)=="input"?this.composing=2:this.composing==2&&i.selection&&(this.composing=3)}startUpdate(){this.debounceUpdate=-1,this.pendingStart=!1;let{state:e}=this.view,t=e.field(Fc);for(let r of t.active)r.state==1&&!this.running.some(n=>n.active.source==r.source)&&this.startQuery(r)}startQuery(e){let{state:t}=this.view,r=bv(t),n=new R5(t,r,e.explicitPos==r),i=new SQ(e,n);this.running.push(i),Promise.resolve(e.source(n)).then(a=>{i.context.aborted||(i.done=a||null,this.scheduleAccept())},a=>{this.view.dispatch({effects:zC.of(null)}),(0,bo.logException)(this.view.state,a)})}scheduleAccept(){this.running.every(e=>e.done!==void 0)?this.accept():this.debounceAccept<0&&(this.debounceAccept=setTimeout(()=>this.accept(),this.view.state.facet(Ml).updateSyncTime))}accept(){var e;this.debounceAccept>-1&&clearTimeout(this.debounceAccept),this.debounceAccept=-1;let t=[],r=this.view.state.facet(Ml);for(let n=0;no.source==i.active.source);if(a&&a.state==1)if(i.done==null){let o=new Ol(i.active.source,0);for(let s of i.updates)o=o.update(s,r);o.state!=1&&t.push(o)}else this.startQuery(a)}t.length&&this.view.dispatch({effects:eSe.of(t)})}},{eventHandlers:{blur(e){let t=this.view.state.field(Fc,!1);if(t&&t.tooltip&&this.view.state.facet(Ml).closeOnBlur){let r=t.open&&(0,bo.getTooltip)(this.view,t.open.tooltip);(!r||!r.dom.contains(e.relatedTarget))&&setTimeout(()=>this.view.dispatch({effects:zC.of(null)}),10)}},compositionstart(){this.composing=1},compositionend(){this.composing==3&&setTimeout(()=>this.view.dispatch({effects:q5.of(!1)}),20),this.composing=0}}}),XYe=typeof navigator=="object"&&/Win/.test(navigator.platform),KYe=Xt.Prec.highest(bo.EditorView.domEventHandlers({keydown(e,t){let r=t.state.field(Fc,!1);if(!r||!r.open||r.open.disabled||r.open.selected<0||e.key.length>1||e.ctrlKey&&!(XYe&&e.altKey)||e.metaKey)return!1;let n=r.open.options[r.open.selected],i=r.active.find(o=>o.source==n.source),a=n.completion.commitCharacters||i.result.commitCharacters;return a&&a.indexOf(e.key)>-1&&EQ(t,n),!1}})),JYe=bo.EditorView.baseTheme({".cm-tooltip.cm-tooltip-autocomplete":{"& > ul":{fontFamily:"monospace",whiteSpace:"nowrap",overflow:"hidden auto",maxWidth_fallback:"700px",maxWidth:"min(700px, 95vw)",minWidth:"250px",maxHeight:"10em",height:"100%",listStyle:"none",margin:0,padding:0,"& > li, & > completion-section":{padding:"1px 3px",lineHeight:1.2},"& > li":{overflowX:"hidden",textOverflow:"ellipsis",cursor:"pointer"},"& > completion-section":{display:"list-item",borderBottom:"1px solid silver",paddingLeft:"0.5em",opacity:.7}}},"&light .cm-tooltip-autocomplete ul li[aria-selected]":{background:"#17c",color:"white"},"&light .cm-tooltip-autocomplete-disabled ul li[aria-selected]":{background:"#777"},"&dark .cm-tooltip-autocomplete ul li[aria-selected]":{background:"#347",color:"white"},"&dark .cm-tooltip-autocomplete-disabled ul li[aria-selected]":{background:"#444"},".cm-completionListIncompleteTop:before, .cm-completionListIncompleteBottom:after":{content:'"\xB7\xB7\xB7"',opacity:.5,display:"block",textAlign:"center"},".cm-tooltip.cm-completionInfo":{position:"absolute",padding:"3px 9px",width:"max-content",maxWidth:`${400}px`,boxSizing:"border-box"},".cm-completionInfo.cm-completionInfo-left":{right:"100%"},".cm-completionInfo.cm-completionInfo-right":{left:"100%"},".cm-completionInfo.cm-completionInfo-left-narrow":{right:`${30}px`},".cm-completionInfo.cm-completionInfo-right-narrow":{left:`${30}px`},"&light .cm-snippetField":{backgroundColor:"#00000022"},"&dark .cm-snippetField":{backgroundColor:"#ffffff22"},".cm-snippetFieldPosition":{verticalAlign:"text-top",width:0,height:"1.15em",display:"inline-block",margin:"0 -0.7px -.7em",borderLeft:"1.4px dotted #888"},".cm-completionMatchedText":{textDecoration:"underline"},".cm-completionDetail":{marginLeft:"0.5em",fontStyle:"italic"},".cm-completionIcon":{fontSize:"90%",width:".8em",display:"inline-block",textAlign:"center",paddingRight:".6em",opacity:"0.6",boxSizing:"content-box"},".cm-completionIcon-function, .cm-completionIcon-method":{"&:after":{content:"'\u0192'"}},".cm-completionIcon-class":{"&:after":{content:"'\u25CB'"}},".cm-completionIcon-interface":{"&:after":{content:"'\u25CC'"}},".cm-completionIcon-variable":{"&:after":{content:"'\u{1D465}'"}},".cm-completionIcon-constant":{"&:after":{content:"'\u{1D436}'"}},".cm-completionIcon-type":{"&:after":{content:"'\u{1D461}'"}},".cm-completionIcon-enum":{"&:after":{content:"'\u222A'"}},".cm-completionIcon-property":{"&:after":{content:"'\u25A1'"}},".cm-completionIcon-keyword":{"&:after":{content:"'\u{1F511}\uFE0E'"}},".cm-completionIcon-namespace":{"&:after":{content:"'\u25A2'"}},".cm-completionIcon-text":{"&:after":{content:"'abc'",fontSize:"50%",verticalAlign:"middle"}}});var UC={brackets:["(","[","{","'",'"'],before:")]}:;>",stringPrefixes:[]},Gy=Xt.StateEffect.define({map(e,t){let r=t.mapPos(e,-1,Xt.MapMode.TrackAfter);return r??void 0}}),kQ=new class extends Xt.RangeValue{};kQ.startSide=1;kQ.endSide=-1;var rSe=Xt.StateField.define({create(){return Xt.RangeSet.empty},update(e,t){if(e=e.map(t.changes),t.selection){let r=t.state.doc.lineAt(t.selection.main.head);e=e.update({filter:n=>n>=r.from&&n<=r.to})}for(let r of t.effects)r.is(Gy)&&(e=e.update({add:[kQ.range(r.value,r.value+1)]}));return e}});function nSe(){return[tZe,rSe]}var vQ="()[]{}<>";function iSe(e){for(let t=0;t{if((eZe?e.composing:e.compositionStarted)||e.state.readOnly)return!1;let i=e.state.selection.main;if(n.length>2||n.length==2&&(0,Xt.codePointSize)((0,Xt.codePointAt)(n,0))==1||t!=i.from||r!=i.to)return!1;let a=nZe(e.state,n);return a?(e.dispatch(a),!0):!1}),rZe=({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=aSe(e,e.selection.main.head).brackets||UC.brackets,i=null,a=e.changeByRange(o=>{if(o.empty){let s=iZe(e.doc,o.head);for(let l of n)if(l==s&&L5(e.doc,o.head)==iSe((0,Xt.codePointAt)(l,0)))return{changes:{from:o.head-l.length,to:o.head+l.length},range:Xt.EditorSelection.cursor(o.head-l.length)}}return{range:i=o}});return i||t(e.update(a,{scrollIntoView:!0,userEvent:"delete.backward"})),!i},oSe=[{key:"Backspace",run:rZe}];function nZe(e,t){let r=aSe(e,e.selection.main.head),n=r.brackets||UC.brackets;for(let i of n){let a=iSe((0,Xt.codePointAt)(i,0));if(t==i)return a==i?sZe(e,i,n.indexOf(i+i+i)>-1,r):aZe(e,i,a,r.before||UC.before);if(t==a&&sSe(e,e.selection.main.from))return oZe(e,i,a)}return null}function sSe(e,t){let r=!1;return e.field(rSe).between(0,e.doc.length,n=>{n==t&&(r=!0)}),r}function L5(e,t){let r=e.sliceString(t,t+2);return r.slice(0,(0,Xt.codePointSize)((0,Xt.codePointAt)(r,0)))}function iZe(e,t){let r=e.sliceString(t-2,t);return(0,Xt.codePointSize)((0,Xt.codePointAt)(r,0))==r.length?r:r.slice(1)}function aZe(e,t,r,n){let i=null,a=e.changeByRange(o=>{if(!o.empty)return{changes:[{insert:t,from:o.from},{insert:r,from:o.to}],effects:Gy.of(o.to+t.length),range:Xt.EditorSelection.range(o.anchor+t.length,o.head+t.length)};let s=L5(e.doc,o.head);return!s||/\s/.test(s)||n.indexOf(s)>-1?{changes:{insert:t+r,from:o.head},effects:Gy.of(o.head+t.length),range:Xt.EditorSelection.cursor(o.head+t.length)}:{range:i=o}});return i?null:e.update(a,{scrollIntoView:!0,userEvent:"input.type"})}function oZe(e,t,r){let n=null,i=e.changeByRange(a=>a.empty&&L5(e.doc,a.head)==r?{changes:{from:a.head,to:a.head+r.length,insert:r},range:Xt.EditorSelection.cursor(a.head+r.length)}:n={range:a});return n?null:e.update(i,{scrollIntoView:!0,userEvent:"input.type"})}function sZe(e,t,r,n){let i=n.stringPrefixes||UC.stringPrefixes,a=null,o=e.changeByRange(s=>{if(!s.empty)return{changes:[{insert:t,from:s.from},{insert:t,from:s.to}],effects:Gy.of(s.to+t.length),range:Xt.EditorSelection.range(s.anchor+t.length,s.head+t.length)};let l=s.head,u=L5(e.doc,l),c;if(u==t){if(Xwe(e,l))return{changes:{insert:t+t,from:l},effects:Gy.of(l+t.length),range:Xt.EditorSelection.cursor(l+t.length)};if(sSe(e,l)){let d=r&&e.sliceDoc(l,l+t.length*3)==t+t+t?t+t+t:t;return{changes:{from:l,to:l+d.length,insert:d},range:Xt.EditorSelection.cursor(l+d.length)}}}else{if(r&&e.sliceDoc(l-2*t.length,l)==t+t&&(c=Kwe(e,l-2*t.length,i))>-1&&Xwe(e,c))return{changes:{insert:t+t+t+t,from:l},effects:Gy.of(l+t.length),range:Xt.EditorSelection.cursor(l+t.length)};if(e.charCategorizer(l)(u)!=Xt.CharCategory.Word&&Kwe(e,l,i)>-1&&!lZe(e,l,t,i))return{changes:{insert:t+t,from:l},effects:Gy.of(l+t.length),range:Xt.EditorSelection.cursor(l+t.length)}}return{range:a=s}});return a?null:e.update(o,{scrollIntoView:!0,userEvent:"input.type"})}function Xwe(e,t){let r=Zs(e).resolveInner(t+1);return r.parent&&r.from==t}function lZe(e,t,r,n){let i=Zs(e).resolveInner(t,-1),a=n.reduce((o,s)=>Math.max(o,s.length),0);for(let o=0;o<5;o++){let s=e.sliceDoc(i.from,Math.min(i.to,i.from+r.length+a)),l=s.indexOf(r);if(!l||l>-1&&n.indexOf(s.slice(0,l))>-1){let c=i.firstChild;for(;c&&c.from==i.from&&c.to-c.from>r.length+l;){if(e.sliceDoc(c.to-r.length,c.to)==r)return!1;c=c.firstChild}return!0}let u=i.to==t&&i.parent;if(!u)break;i=u}return!1}function Kwe(e,t,r){let n=e.charCategorizer(t);if(n(e.sliceDoc(t-1,t))!=Xt.CharCategory.Word)return t;for(let i of r){let a=t-i.length;if(e.sliceDoc(a,t)==i&&n(e.sliceDoc(a-1,a))!=Xt.CharCategory.Word)return a}return-1}function lSe(e={}){return[KYe,Fc,Ml.of(e),ZYe,uZe,JYe]}var CQ=[{key:"Ctrl-Space",run:VYe},{key:"Escape",run:GYe},{key:"ArrowDown",run:B5(!0)},{key:"ArrowUp",run:B5(!1)},{key:"PageDown",run:B5(!0,"page")},{key:"PageUp",run:B5(!1,"page")},{key:"Enter",run:HYe}],uZe=Xt.Prec.highest(bo.keymap.computeN([Ml],e=>e.facet(Ml).defaultKeymap?[CQ]:[]));var cSe=require("@codemirror/lint"),U5=function(t){t===void 0&&(t={});var{crosshairCursor:r=!1}=t,n=[];t.closeBracketsKeymap!==!1&&(n=n.concat(oSe)),t.defaultKeymap!==!1&&(n=n.concat(eg.defaultKeymap)),t.searchKeymap!==!1&&(n=n.concat(z5.searchKeymap)),t.historyKeymap!==!1&&(n=n.concat(eg.historyKeymap)),t.foldKeymap!==!1&&(n=n.concat(Nwe)),t.completionKeymap!==!1&&(n=n.concat(CQ)),t.lintKeymap!==!1&&(n=n.concat(cSe.lintKeymap));var i=[];return t.lineNumbers!==!1&&i.push((0,Po.lineNumbers)()),t.highlightActiveLineGutter!==!1&&i.push((0,Po.highlightActiveLineGutter)()),t.highlightSpecialChars!==!1&&i.push((0,Po.highlightSpecialChars)()),t.history!==!1&&i.push((0,eg.history)()),t.foldGutter!==!1&&i.push(_we()),t.drawSelection!==!1&&i.push((0,Po.drawSelection)()),t.dropCursor!==!1&&i.push((0,Po.dropCursor)()),t.allowMultipleSelections!==!1&&i.push(uSe.EditorState.allowMultipleSelections.of(!0)),t.indentOnInput!==!1&&i.push(Cwe()),t.syntaxHighlighting!==!1&&i.push(JA(pQ,{fallback:!0})),t.bracketMatching!==!1&&i.push($we()),t.closeBrackets!==!1&&i.push(nSe()),t.autocompletion!==!1&&i.push(lSe()),t.rectangularSelection!==!1&&i.push((0,Po.rectangularSelection)()),r!==!1&&i.push((0,Po.crosshairCursor)()),t.highlightActiveLine!==!1&&i.push((0,Po.highlightActiveLine)()),t.highlightSelectionMatches!==!1&&i.push((0,z5.highlightSelectionMatches)()),t.tabSize&&typeof t.tabSize=="number"&&i.push($C.of(" ".repeat(t.tabSize))),i.concat([Po.keymap.of(n.flat())]).filter(Boolean)},cZe=function(t){t===void 0&&(t={});var r=[];t.defaultKeymap!==!1&&(r=r.concat(eg.defaultKeymap)),t.historyKeymap!==!1&&(r=r.concat(eg.historyKeymap));var n=[];return t.highlightSpecialChars!==!1&&n.push((0,Po.highlightSpecialChars)()),t.history!==!1&&n.push((0,eg.history)()),t.drawSelection!==!1&&n.push((0,Po.drawSelection)()),t.syntaxHighlighting!==!1&&n.push(JA(pQ,{fallback:!0})),n.concat([Po.keymap.of(r.flat())]).filter(Boolean)};var f2=require("@codemirror/view");var fSe=require("@codemirror/view");var dSe="#e5c07b",DQ="#e06c75",pSe="#56b6c2",mSe="#ffffff",WC="#abb2bf",H5="#7d8799",hSe="#61afef",ASe="#98c379",OQ="#d19a66",gSe="#c678dd",vSe="#21252b",MQ="#2c313a",jQ="#282c34",W5="#353a42",ySe="#3E4451",NQ="#528bff",fZe={chalky:dSe,coral:DQ,cyan:pSe,invalid:mSe,ivory:WC,stone:H5,malibu:hSe,sage:ASe,whiskey:OQ,violet:gSe,darkBackground:vSe,highlightBackground:MQ,background:jQ,tooltipBackground:W5,selection:ySe,cursor:NQ},bSe=fSe.EditorView.theme({"&":{color:WC,backgroundColor:jQ},".cm-content":{caretColor:NQ},".cm-cursor, .cm-dropCursor":{borderLeftColor:NQ},"&.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection":{backgroundColor:ySe},".cm-panels":{backgroundColor:vSe,color:WC},".cm-panels.cm-panels-top":{borderBottom:"2px solid black"},".cm-panels.cm-panels-bottom":{borderTop:"2px solid black"},".cm-searchMatch":{backgroundColor:"#72a1ff59",outline:"1px solid #457dff"},".cm-searchMatch.cm-searchMatch-selected":{backgroundColor:"#6199ff2f"},".cm-activeLine":{backgroundColor:"#6699ff0b"},".cm-selectionMatch":{backgroundColor:"#aafe661a"},"&.cm-focused .cm-matchingBracket, &.cm-focused .cm-nonmatchingBracket":{backgroundColor:"#bad0f847"},".cm-gutters":{backgroundColor:jQ,color:H5,border:"none"},".cm-activeLineGutter":{backgroundColor:MQ},".cm-foldPlaceholder":{backgroundColor:"transparent",border:"none",color:"#ddd"},".cm-tooltip":{border:"none",backgroundColor:W5},".cm-tooltip .cm-tooltip-arrow:before":{borderTopColor:"transparent",borderBottomColor:"transparent"},".cm-tooltip .cm-tooltip-arrow:after":{borderTopColor:W5,borderBottomColor:W5},".cm-tooltip-autocomplete":{"& > ul > li[aria-selected]":{backgroundColor:MQ,color:WC}}},{dark:!0}),xSe=Wd.define([{tag:qe.keyword,color:gSe},{tag:[qe.name,qe.deleted,qe.character,qe.propertyName,qe.macroName],color:DQ},{tag:[qe.function(qe.variableName),qe.labelName],color:hSe},{tag:[qe.color,qe.constant(qe.name),qe.standard(qe.name)],color:OQ},{tag:[qe.definition(qe.name),qe.separator],color:WC},{tag:[qe.typeName,qe.className,qe.number,qe.changed,qe.annotation,qe.modifier,qe.self,qe.namespace],color:dSe},{tag:[qe.operator,qe.operatorKeyword,qe.url,qe.escape,qe.regexp,qe.link,qe.special(qe.string)],color:pSe},{tag:[qe.meta,qe.comment],color:H5},{tag:qe.strong,fontWeight:"bold"},{tag:qe.emphasis,fontStyle:"italic"},{tag:qe.strikethrough,textDecoration:"line-through"},{tag:qe.link,color:H5,textDecoration:"underline"},{tag:qe.heading,fontWeight:"bold",color:DQ},{tag:[qe.atom,qe.bool,qe.special(qe.variableName)],color:OQ},{tag:[qe.processingInstruction,qe.string,qe.inserted],color:ASe},{tag:qe.invalid,color:mSe}]),TQ=[bSe,JA(xSe)];var ESe=require("@codemirror/state");var wSe=require("@codemirror/view"),FQ=wSe.EditorView.theme({"&":{backgroundColor:"#fff"}},{dark:!1});var _Q=function(t){t===void 0&&(t={});var{indentWithTab:r=!0,editable:n=!0,readOnly:i=!1,theme:a="light",placeholder:o="",basicSetup:s=!0}=t,l=[];switch(r&&l.unshift(f2.keymap.of([SSe.indentWithTab])),s&&(typeof s=="boolean"?l.unshift(U5()):l.unshift(U5(s))),o&&l.unshift((0,f2.placeholder)(o)),a){case"light":l.push(FQ);break;case"dark":l.push(TQ);break;case"none":break;default:l.push(a);break}return n===!1&&l.push(f2.EditorView.editable.of(!1)),i&&l.push(ESe.EditorState.readOnly.of(!0)),[...l]};var PQ=e=>({line:e.state.doc.lineAt(e.state.selection.main.from),lineCount:e.state.doc.lines,lineBreak:e.state.lineBreak,length:e.state.doc.length,readOnly:e.state.readOnly,tabSize:e.state.tabSize,selection:e.state.selection,selectionAsSingle:e.state.selection.asSingle().main,ranges:e.state.selection.ranges,selectionCode:e.state.sliceDoc(e.state.selection.main.from,e.state.selection.main.to),selections:e.state.selection.ranges.map(t=>e.state.sliceDoc(t.from,t.to)),selectedText:e.state.selection.ranges.some(t=>!t.empty)});var kSe=Qy.Annotation.define(),dZe=[];function IQ(e){var{value:t,selection:r,onChange:n,onStatistics:i,onCreateEditor:a,onUpdate:o,extensions:s=dZe,autoFocus:l,theme:u="light",height:c=null,minHeight:f=null,maxHeight:d=null,width:p=null,minWidth:h=null,maxWidth:m=null,placeholder:g="",editable:A=!0,readOnly:b=!1,indentWithTab:v=!0,basicSetup:x=!0,root:w,initialState:S}=e,[k,j]=(0,Qp.useState)(),[O,C]=(0,Qp.useState)(),[N,D]=(0,Qp.useState)(),P=HC.EditorView.theme({"&":{height:c,minHeight:f,maxHeight:d,width:p,minWidth:h,maxWidth:m},"& .cm-scroller":{height:"100% !important"}}),q=HC.EditorView.updateListener.of(T=>{if(T.docChanged&&typeof n=="function"&&!T.transactions.some(Y=>Y.annotation(kSe))){var L=T.state.doc,_=L.toString();n(_,T)}i&&i(PQ(T))}),z=_Q({theme:u,editable:A,readOnly:b,placeholder:g,indentWithTab:v,basicSetup:x}),I=[q,P,...z];return o&&typeof o=="function"&&I.push(HC.EditorView.updateListener.of(o)),I=I.concat(s),(0,Qp.useEffect)(()=>{if(k&&!N){var T={doc:t,selection:r,extensions:I},L=S?Qy.EditorState.fromJSON(S.json,T,S.fields):Qy.EditorState.create(T);if(D(L),!O){var _=new HC.EditorView({state:L,parent:k,root:w});C(_),a&&a(_,L)}}return()=>{O&&(D(void 0),C(void 0))}},[k,N]),(0,Qp.useEffect)(()=>j(e.container),[e.container]),(0,Qp.useEffect)(()=>()=>{O&&(O.destroy(),C(void 0))},[O]),(0,Qp.useEffect)(()=>{l&&O&&O.focus()},[l,O]),(0,Qp.useEffect)(()=>{O&&O.dispatch({effects:Qy.StateEffect.reconfigure.of(I)})},[u,s,c,f,d,p,h,m,g,A,b,v,x,n,o]),(0,Qp.useEffect)(()=>{if(t!==void 0){var T=O?O.state.doc.toString():"";O&&t!==T&&O.dispatch({changes:{from:0,to:T.length,insert:t||""},annotations:[kSe.of(!0)]})}},[t,O]),{state:N,setState:D,view:O,setView:C,container:k,setContainer:j}}var CSe=Ae(XA());li(En,require("@codemirror/view"));li(En,require("@codemirror/state"));var pZe=["className","value","selection","extensions","onChange","onStatistics","onCreateEditor","onUpdate","autoFocus","theme","height","minHeight","maxHeight","width","minWidth","maxWidth","basicSetup","placeholder","indentWithTab","editable","readOnly","root","initialState"],DSe=(0,d2.forwardRef)((e,t)=>{var{className:r,value:n="",selection:i,extensions:a=[],onChange:o,onStatistics:s,onCreateEditor:l,onUpdate:u,autoFocus:c,theme:f="light",height:d,minHeight:p,maxHeight:h,width:m,minWidth:g,maxWidth:A,basicSetup:b,placeholder:v,indentWithTab:x,editable:w,readOnly:S,root:k,initialState:j}=e,O=LC(e,pZe),C=(0,d2.useRef)(null),{state:N,view:D,container:P}=IQ({container:C.current,root:k,value:n,autoFocus:c,theme:f,height:d,minHeight:p,maxHeight:h,width:m,minWidth:g,maxWidth:A,basicSetup:b,placeholder:v,indentWithTab:x,editable:w,readOnly:S,selection:i,onChange:o,onStatistics:s,onCreateEditor:l,onUpdate:u,extensions:a,initialState:j});if((0,d2.useImperativeHandle)(t,()=>({editor:C.current,state:N,view:D}),[C,P,N,D]),typeof n!="string")throw new Error("value must be typeof string but got "+typeof n);var q=typeof f=="string"?"cm-theme-"+f:"cm-theme";return(0,CSe.jsx)("div",Fn({ref:C,className:""+q+(r?" "+r:"")},O))});DSe.displayName="CodeMirror";var VC=DSe;var GC={functions:["abs","acos","acosh","acot","acoth","acsc","acsch","add","and","apply","arg","asec","asech","asin","asinh","atan","atan2","atanh","bellNumbers","bin","bitAnd","bitNot","bitOr","bitXor","catalan","cbrt","ceil","clone","column","combinations","combinationsWithRep","compare","compareNatural","compareText","compile","composition","concat","conj","cos","cosh","cot","coth","count","cross","csc","csch","ctranspose","cube","cumsum","deepEqual","det","diag","diff","distance","divide","dot","dotDivide","dotMultiply","dotPow","eigs","equal","equalText","erf","evaluate","exp","expm","expm1","factorial","fft","filter","fix","flatten","floor","forEach","format","gamma","gcd","getMatrixDataType","hasNumericValue","help","hex","hypot","identity","ifft","im","intersect","inv","invmod","isInteger","isNaN","isNegative","isNumeric","isPositive","isPrime","isZero","kldivergence","kron","larger","largerEq","lcm","leftShift","lgamma","log","log10","log1p","log2","lsolve","lsolveAll","lup","lusolve","lyap","mad","map","matrixFromColumns","matrixFromFunction","matrixFromRows","max","mean","median","min","mod","mode","multinomial","multiply","norm","not","nthRoot","nthRoots","numeric","oct","ones","or","parser","partitionSelect","permutations","pickRandom","pinv","pow","print","prod","qr","quantileSeq","random","randomInt","range","re","reshape","resize","rightArithShift","rightLogShift","rotate","rotationMatrix","round","row","schur","sec","sech","setCartesian","setDifference","setDistinct","setIntersect","setIsSubset","setMultiplicity","setPowerset","setSize","setSymDifference","setUnion","sign","sin","sinh","size","slu","smaller","smallerEq","sort","sqrt","sqrtm","square","squeeze","std","stirlingS2","subset","subtract","sum","sylvester","tan","tanh","to","trace","transpose","typeOf","unaryMinus","unaryPlus","unequal","usolve","usolveAll","variance","xgcd","xor","zeros","date","epoch","charToHex","hexToChar"],constants:["speedOfLight","gravitationConstant","planckConstant","reducedPlanckConstant","magneticConstant","electricConstant","vacuumImpedance","coulomb","elementaryCharge","bohrMagneton","conductanceQuantum","inverseConductanceQuantum","magneticFluxQuantum","nuclearMagneton","klitzing","bohrRadius","classicalElectronRadius","electronMass","fermiCoupling","fineStructure","hartreeEnergy","protonMass","deuteronMass","neutronMass","quantumOfCirculation","rydberg","thomsonCrossSection","weakMixingAngle","efimovFactor","atomicMass","avogadro","boltzmann","faraday","firstRadiation","loschmidt","gasConstant","molarPlanckConstant","molarVolume","sackurTetrode","secondRadiation","stefanBoltzmann","wienDisplacement","molarMass","molarMassC12","gravity","atm","planckLength","planckMass","planckTime","planckCharge","planckTemperature","e","E","i","Infinity","LN2","LN10","LOG2E","LOG10E","NaN","null","phi","pi","PI","SQRT1_2","SQRT2","tau","undefined","version","true","false"],currency:["AED","AFN","ALL","AMD","ANG","AOA","ARS","AUD","AWG","AZN","BAM","BBD","BDT","BGN","BHD","BIF","BMD","BND","BOB","BRL","BSD","BTC","BTN","BWP","BYN","BZD","CAD","CDF","CHF","CLF","CLP","CNH","CNY","COP","CRC","CUC","CUP","CVE","CZK","DJF","DKK","DOP","DZD","EGP","ERN","ETB","EUR","FJD","FKP","GBP","GEL","GGP","GHS","GIP","GMD","GNF","GTQ","GYD","HKD","HNL","HRK","HTG","HUF","IDR","ILS","IMP","INR","IQD","IRR","ISK","JEP","JMD","JOD","JPY","KES","KGS","KHR","KMF","KPW","KRW","KWD","KYD","KZT","LAK","LBP","LKR","LRD","LSL","LYD","MAD","MDL","MGA","MKD","MMK","MNT","MOP","MRU","MUR","MVR","MWK","MXN","MYR","MZN","NAD","NGN","NIO","NOK","NPR","NZD","OMR","PAB","PEN","PGK","PHP","PKR","PLN","PYG","QAR","RON","RSD","RUB","RWF","SAR","SBD","SCR","SDG","SEK","SGD","SHP","SLL","SOS","SRD","SSP","STD","STN","SVC","SYP","SZL","THB","TJS","TMT","TND","TOP","TRY","TTD","TWD","TZS","UAH","UGX","USD","UYU","UZS","VES","VND","VUV","WST","XAF","XAG","XAU","XCD","XDR","XOF","XPD","XPF","XPT","YER","ZAR","ZMW","ZWL"]},BQ=(()=>{let e=[],t="px|pixel|pixels|pt|point|points|em|oF|oC|f|c|mph|kph".split("|");return[...e,...t,...GC.currency,...GC.currency.map(r=>r.toLowerCase())]})(),RQ="today|tomorrow|now|time|yesterday|sum|total|average|avg".split("|"),$Q="in|to|last|off|of|mod|xor|or|ago".split("|"),mZe=[...BQ,...RQ,...GC.functions,...$Q,...Object.keys(fC)],EJt=mZe.sort((e,t)=>e.length-t.length).filter(e=>e.length>0),OSe=GC.functions,MSe=GC.constants;function QC(e){let t={};for(let r=0;r/:^%!]/;function bZe(e,t){let r=e.next();if(r=="#"||r=="/"&&e.eat("/"))return e.skipToEnd(),"comment";if(r=='"'||r=="'")return t.tokenize=xZe(r),t.tokenize(e,t);if(/[$£€¥₽¥]/.test(r))return"variableName.special";if(/[[\](),]/.test(r))return null;if(/[\d.]/.test(r))return e.eatWhile(/^(\d+((,\d{3})+)?)?(\.(\d+)?)?(e[+-]?\d+)?(M |k )?$/),"number";if(jSe.test(r))return e.eatWhile(jSe),"operator";e.eatWhile(/[\w_]/);let n=e.current();return Object.hasOwn(hZe,n)?"operatorKeyword":Object.hasOwn(AZe,n)||Object.hasOwn(yZe,n)?"variableName.standard":Object.hasOwn(vZe,n)?"variableName.special":Object.hasOwn(gZe,n)?"function":e.peek()==="("?"variableName.definition":"variable"}function xZe(e){return function(t,r){let n=!1,i,a=!1;for(;(i=t.next())!=null;){if(i==e&&!n){a=!0;break}n=!n&&i=="\\"}return(a||!n)&&(r.tokenize=null),"string"}}var NSe={name:"mkformula",startState:function(){return{tokenize:null}},token:function(e,t){if(e.eatSpace())return null;let r=(t.tokenize||bZe)(e,t);return r=="comment"||r=="meta",r},languageData:{autocomplete:Object.keys(dC),closeBrackets:{brackets:["(","[","{","'",'"',"`"]},commentTokens:{line:"#"}}};var cn=Ae(Te());var LSe=Ae(yi());var Vu=Ae(Te());var TSe=(e,t)=>{let r=e?sr(e):[],n=t?sr(t):[];return n.every(i=>r.some(a=>a==i))&&r.every(i=>n.some(a=>a==i))},p2=(e,t)=>e==t,wv=(e,t)=>(e??"").length==0,qQ=(e,t)=>(e??"").toLowerCase().includes((t??"").toLowerCase()),LQ=(e,t)=>parseFloat(e)>parseFloat(t),zQ=(e,t)=>parseInt(e){let r=isNaN(Date.parse(e))?new Date(parseInt(e)):new Date(e),n=isNaN(Date.parse(t))?new Date(parseInt(t)):new Date(t);return r.valueOf()>=n.valueOf()},_Se=(e,t)=>{let r=isNaN(Date.parse(e))?new Date(parseInt(e)):new Date(e),n=isNaN(Date.parse(t))?new Date(parseInt(t)):new Date(t);return r.valueOf(){let r=e?sr(e):[],n=t?sr(t):[];return r.length==0?!1:n.some(i=>r.some(a=>a==i))},PSe=(e,t)=>{if(!e)return!1;let r=new Date(`${e.toString().replace(".",":")}`),n=new Date(`${t}`);return r.getMonth()===n.getMonth()&&r.getDate()===n.getDate()},ISe=e=>{if(!e)return!1;let t=new Date(`${e.toString()}T00:00`),r=new Date;return t.getMonth()===r.getMonth()&&t.getDate()===r.getDate()},BSe=(e,t,r,n)=>{if(!e)return!0;let i=qi[t?.fn],a=!0;if(i&&i.fn){let o=t.fType=="property"?n[t.value]:t.value;a=i.fn(r[t.field],o)}return a};var qi={isNotEmpty:{type:["text","file","number","option","option-multi","link","link-multi","image"],fn:(e,t)=>!wv(e,""),valueType:"none"},isEmpty:{type:["text","file","number","option","option-multi","link","link-multi","image"],fn:(e,t)=>wv(e,""),valueType:"none"},include:{fn:(e,t)=>qQ(e,t),type:["text","file","link","image"],valueType:"text"},notInclude:{type:["text","file","link","image"],fn:(e,t)=>!qQ(e,t),valueType:"text"},is:{type:["text"],fn:(e,t)=>p2(e,t),valueType:"text"},isNot:{type:["text"],fn:(e,t)=>!p2(e,t),valueType:"text"},equal:{type:["number"],fn:(e,t)=>p2(e,t),valueType:"number"},isLink:{type:["link","context"],fn:(e,t)=>p2(e,t),valueType:"link"},isNotLink:{type:["link","context"],fn:(e,t)=>!p2(e,t),valueType:"link"},isGreatThan:{type:["number"],fn:(e,t)=>LQ(e,t),valueType:"number"},isLessThan:{type:["number"],fn:(e,t)=>zQ(e,t),valueType:"number"},isLessThanOrEqual:{type:["number"],fn:(e,t)=>!LQ(e,t),valueType:"number"},isGreatThanOrEqual:{type:["number"],fn:(e,t)=>!zQ(e,t),valueType:"number"},dateBefore:{type:["date"],fn:(e,t)=>_Se(e,t),valueType:"date"},dateAfter:{type:["date"],fn:(e,t)=>FSe(e,t),valueType:"date"},isSameDate:{type:["date"],fn:(e,t)=>PSe(e,t),valueType:"date"},isSameDateAsToday:{type:["date"],fn:(e,t)=>ISe(e,t),valueType:"none"},isExactList:{type:["option","option-multi","link-multi","context-multi","tags-multi"],fn:(e,t)=>TSe(e,t),valueType:"list"},isAnyInList:{type:["option","context","link","option-multi","link-multi","context-multi","tags-multi"],fn:(e,t)=>UQ(e,t),valueType:"list"},isNoneInList:{type:["option","context","link","option-multi","link-multi","context-multi","tags-multi"],fn:(e,t)=>!UQ(e,t),valueType:"list"},isTrue:{type:["boolean"],fn:(e,t)=>e=="true",valueType:"none"},isFalse:{type:["boolean"],fn:(e,t)=>e!="true",valueType:"none"}};var wZe=(e,t)=>t.reduce((r,n)=>r==!0?!0:e?RSe(e,n):!1,!1),RSe=(e,t)=>{let r=qi[t.fn],n=!0;return r&&(n=r.fn(Ri(t.field,e[t.field]),t.value)),n},SZe=(e,t)=>t.reduce((r,n)=>r==!1?!1:e?RSe(e,n):!1,!0),$Se=(e,t)=>e.reduce((n,i)=>!n||i.filters.length==0?!1:i.type=="any"?wZe(t,i.filters):SZe(t,i.filters),!0);var qSe=Ae(yi());var HQ=e=>or(e),V5=async(e,t,r)=>{let n=HQ(t);return WQ(e,n,r)},WQ=async(e,t,r)=>{if(r.iterations>e.settings.actionMaxSteps){alert("Max steps reached, you can change this in settings.");return}let n={...r,iterations:r.iterations+1,props:{...t?.props??{},...Object.keys(t.linked??{}).reduce((l,u)=>({...l,[u]:r.instanceProps[t.linked[u]]}),{}),...t.result?{[t.result]:r.result}:{}}},i=e.cli.commandForAction(t.action);if(i.schema.type=="builtin"){if(i.schema.id=="loop"&&(0,qSe.isArray)(r.result))return await Promise.all(r.result.map(u=>Promise.all(t.children.map(c=>WQ(e,c,o))).then(c=>c[c.length-1])));if(i.schema.id=="filter"&&!$Se(t.props.$function,n.instanceProps))return}let a;try{if(i.schema.type=="api"){let[l,u]=i.schema.id.split(".");a=await e.api[l]?.[u]?.(...i.fields.map(c=>n.props[c.name]))}else a=await e.cli.runCommand(t.action,n)}catch(l){console.error(l)}let o={...n,result:a};if(t.children?.length===0)return a;let s=await Promise.all(t.children.map(l=>WQ(e,l,o)));return s[s.length-1]};var G5=e=>{let t=e.superstate.pathsIndex.get(e.path),[r,n]=(0,Vu.useState)({}),[i,a]=(0,Vu.useState)(),[o,s]=(0,Vu.useState)();(0,Vu.useEffect)(()=>{e.autoTest&&(0,LSe.debounce)(()=>l(),500,{leading:!0,trailing:!0})()},[e.code,e.autoTest]);let l=async()=>{let u=Object.keys(r).reduce((d,p)=>{let h=e.fields.find(g=>g.name==p);return wq(h.type,r[p])?.length>0?{...d,[p]:wq(h.type,r[p])}:d},{...e.value,$api:e.superstate.api,$contexts:{$space:{path:t},$context:{}},$properties:e.fields}),c,f;try{e.type=="actions"&&(c=await V5(e.superstate,e.code,{props:{},instanceProps:u,iterations:0})),e.type=="script"&&(c=await ZS(e.code,u)),e.type=="formula"&&(c=await Pd(e.superstate.formulaContext,e.superstate.pathsIndex,e.superstate.spacesMap,e.code,e.fields.reduce((d,p)=>({...d,[p.name]:p}),{}),u,t,!0))}catch(d){c="",f=d?.message}a(c),s(f)};return Vu.default.createElement("div",{className:"mk-editor-tester"},o?.length>0?Vu.default.createElement(Vu.default.Fragment,null,"Error:"," ",Vu.default.createElement("span",{style:{color:"var(--mk-ui-text-error)"}},o)):Vu.default.createElement(Vu.default.Fragment,null,"Result:"," ",Vu.default.createElement("span",{style:{color:"var(--mk-ui-text-primary"}},String(i))),!e.autoTest&&Vu.default.createElement("button",{onClick:()=>l()},H.buttons.run))};var Ah=e=>{let[t,r]=(0,cn.useState)(e.formula),[n,i]=(0,cn.useState)(null),[a,o]=(0,cn.useState)(""),[s,l]=(0,cn.useState)({func:null,arg:0}),u=Object.values(fC),c=b=>{if(!b)return[];let v=[];if(b.func){if(b.func.args.length==1){let x=b.func.args[0]?.types??[];e.fields.filter(w=>x.includes(ho(w))).forEach(w=>{v.push({name:w.name,type:"rollup",value:`${b.func.name}(prop'${w.name}')`})})}}else if(b.prop){let x=ho(b.prop);x.includes("multi")?u.filter(w=>w.name!="prop"&&w.args.length==1&&w.args[0].types.some(S=>S==x||S=="any-multi")).forEach(w=>{v.push({name:w.name,type:"rollup",value:`${w.name}(prop('${b.prop.name}'))`})}):u.filter(w=>w.name!="prop"&&w.args.length==1&&w.args[0].types.includes(x)).forEach(w=>{v.push({name:w.name,type:"rollup",value:`${w.name}(prop('${b.prop.name}'))`})})}else return v;return v},f=b=>{let v=b.view,x=v.state.wordAt(v.state.selection.main.head),w=x?v.state.sliceDoc(x.from,x.to):"";o(w)},d=b=>{r(b)},p=()=>{e.saveFormula(t),e.hide()};(0,cn.useEffect)(()=>{if(d(e.formula),!h.current?.view)return;h.current.view.focus()},[e.formula]);let h=(0,cn.useRef)(null),m=(b,v)=>{let x=h.current.view,w=x.state.selection.main.to,S=x.state.wordAt(w);S?x.dispatch({changes:{from:S.from,to:S.to,insert:b},selection:{anchor:S.from+b.length-v}}):x.dispatch({changes:{from:w,to:w,insert:b},selection:{anchor:w+b.length-v}}),x.focus()},g=e.fields.filter(b=>b.name.toLowerCase().includes(a.toLowerCase())),A=u.filter(b=>b.name.toLowerCase().includes(a.toLowerCase()));return cn.default.createElement("div",{className:"mk-formula"},cn.default.createElement("div",{className:"mk-formula-header"},cn.default.createElement(VC,{ref:h,autoFocus:!0,value:t,height:"auto",theme:AQ({settings:{background:"var(--mk-ui-background)"}}),basicSetup:{syntaxHighlighting:!0,history:!0,closeBrackets:!0,autocompletion:!1,defaultKeymap:!0,lineNumbers:!1,foldGutter:!1,highlightActiveLine:!1},extensions:[En.EditorView.lineWrapping,u2.define(NSe)],onUpdate:f,onChange:d}),cn.default.createElement("button",{"aria-label":"Save Formula",onClick:()=>p()},"Done")),cn.default.createElement("div",{className:"mk-formula-helper"},cn.default.createElement("div",{className:"mk-formula-list"},g.length>0&&cn.default.createElement("div",{className:"mk-formula-list-section"},"Properties"),g.map((b,v)=>cn.default.createElement("div",{key:v,className:"mk-formula-list-item",onMouseOver:()=>{i({func:null,prop:b})},onClick:()=>{m(`prop('${b.name}')`,0)}},b.name)),A.length>0&&cn.default.createElement("div",{className:"mk-formula-list-section"},"Functions"),A.map((b,v)=>cn.default.createElement("div",{key:v,className:"mk-formula-list-item",onMouseOver:()=>{i({func:fC[b.name],prop:null})},onClick:()=>{m(`${b.name}()`,1)}},b.name))),cn.default.createElement("div",{className:"mk-formula-suggester"},n&&(n.func?cn.default.createElement(cn.default.Fragment,null,cn.default.createElement("div",{className:"mk-formula-suggester-name"},n.func.name,"(",cn.default.createElement("div",{className:"mk-formula-suggester-args"},n.func.args.map((b,v)=>cn.default.createElement("span",{"aria-label":b.types.join(", "),key:v,className:"mk-formula-suggester-arg"},b.name,v0&&cn.default.createElement("div",{className:"mk-formula-suggester-title"},"Suggestions"),c(n).map((b,v)=>cn.default.createElement("div",{key:v,className:"mk-formula-suggestion"},cn.default.createElement("pre",null,b.value),cn.default.createElement("span",null),cn.default.createElement("button",{className:"mk-toolbar-button","aria-label":"Replace",onClick:()=>d(b.value),dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//replace")}}),cn.default.createElement("button",{className:"mk-toolbar-button","aria-label":"Insert",onClick:()=>m(b.value,0),dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//plus")}}))))),cn.default.createElement(G5,{type:"formula",code:t,autoTest:!0,fields:e.fields,value:e.value,superstate:e.superstate,path:e.path}))};var Q5=(e,t,r,n)=>{let i=_c[r];if(!i)return null;let a=ho(n),o="";try{a=="number"&&(t=t.map(l=>parseFloat(l))),a=="date"&&(t=t.map(l=>new Date(l)));let s=i.fn(t,n.type);if(i.valueType=="date"){let l=or(n.value)?.format;o=_r(e,Yi(s),l)}else o=s??""}catch(s){console.error(s)}return o},_c={values:{label:"Values",type:["any"],fn:e=>kr(e.map(t=>Ri("",t))).join(", "),valueType:"none"},sum:{label:"Sum",type:["number"],fn:e=>e.filter(t=>!isNaN(t)).reduce((t,r)=>r?t+r:t,0),valueType:"number"},avg:{label:"Average",type:["number"],fn:e=>{let t=e.filter(r=>!isNaN(r));return t.reduce((r,n)=>r+n,0)/t.length},valueType:"number"},median:{label:"Median",type:["number"],fn:e=>{let t=e.filter(r=>!isNaN(r));return cC(t)},valueType:"number"},count:{label:"Count",type:["any"],fn:e=>e.length,valueType:"number"},countValues:{label:"Count Values",shortLabel:"Values",type:["any"],fn:e=>e.flat().length,valueType:"number"},countUniques:{label:"Count Uniques",shortLabel:"Uniques",type:["any"],fn:e=>new Set(e.flat()).size,valueType:"number"},percentageEmpty:{label:"Percentage Empty",shortLabel:"Empty",type:["any"],fn:e=>e.filter(t=>wv(t,"")).length/e.length*100+"%",valueType:"string"},percentageNotEmpty:{label:"Percentage Not Empty",shortLabel:"Not Empty",type:["any"],fn:e=>e.filter(t=>!wv(t,"")).length/e.length*100+"%",valueType:"string"},min:{label:"Min",type:["number"],fn:e=>Math.min(...e.filter(t=>!isNaN(t))),valueType:"number"},max:{label:"Max",type:["number"],fn:(e,t)=>Math.max(...e.filter(r=>!isNaN(r))),valueType:"number"},range:{label:"Range",type:["number"],fn:e=>Math.max(...e.filter(t=>!isNaN(t)))-Math.min(...e.filter(t=>!isNaN(t))),valueType:"number"},empty:{label:"Empty",type:["any"],fn:e=>e.filter(t=>wv(t,"")).length,valueType:"none"},notEmpty:{label:"Not Empty",type:["any"],fn:e=>e.filter(t=>!wv(t,"")).length,valueType:"none"},earliest:{label:"Earliest",type:["date"],fn:e=>new Date(Math.min(...e.map(t=>t.getTime()))),valueType:"date"},latest:{label:"Latest",type:["date"],fn:e=>new Date(Math.max(...e.map(t=>t.getTime()))),valueType:"date"},dateRange:{label:"Date Range",shortLabel:"Range",type:["date"],fn:e=>{let t=e.map(r=>r.getTime());return Math.max(...t)-Math.min(...t)},valueType:"duration"}};var Dr=Ae(Te());var jf=Ae(Te());var zSe=(e,t,r,n,i,a)=>{e.ui.openModal(t,jf.default.createElement(Ki,{value:r,saveValue:n,saveLabel:i}),a)},Ki=e=>{let[t,r]=(0,jf.useState)(e.value),n=()=>{e.saveValue(t),e.hide&&e.hide()},i=(0,jf.useRef)(null);return(0,jf.useEffect)(()=>{i?.current&&i.current.focus()},[i]),jf.default.createElement("div",{className:"mk-layout-column mk-gap-8"},jf.default.createElement("input",{ref:i,value:t,type:"text",onChange:a=>r(a.target.value),className:"mk-input mk-input-large",style:{width:"100%"},onKeyDown:a=>{a.key==="Enter"&&n()}}),jf.default.createElement("div",{className:"mk-modal-actions"},jf.default.createElement("button",{onClick:()=>n()},e.saveLabel),jf.default.createElement("button",{onClick:()=>e.hide&&e.hide()},H.buttons.cancel)))};var Y5=e=>{let t=(h,m,g,A,b)=>{e.superstate.ui.openMenu(h.target.getBoundingClientRect(),{ui:e.superstate.ui,multi:!1,editable:!0,searchable:!0,saveOptions:(v,x)=>{b?b(x[0]):i(A,x[0])},placeholder:H.labels.propertyValueSpace,value:[m??""],options:g},Ne(h.view.document))},r=h=>{e.superstate.ui.openMenu(h.target.getBoundingClientRect(),{ui:e.superstate.ui,multi:!1,editable:!1,searchable:!1,saveOptions:(m,g)=>i("type",g[0]),value:[],showAll:!0,options:ml.filter(m=>m.primative).map((m,g)=>({id:g+1,name:m.label,value:m.type,icon:m.icon}))},Ne(h.view.document))},n=(0,Dr.useMemo)(()=>pr(e.value,e.fieldType,e.superstate),[e.value,e.fieldType]),i=(h,m)=>{e.saveValue(JSON.stringify({...n,[h]:m}))},a=h=>{let m=e.superstate.contextsIndex.get(n.space)?.contextTable?.cols?.find(g=>g.name==h);m?e.superstate.spaceManager.saveSpaceProperty(n.space,{...m,value:JSON.stringify({space:e.contextPath,field:e.name})},m):e.superstate.spaceManager.addSpaceProperty(n.space,{name:h,schemaId:Er,type:"context",value:JSON.stringify({space:e.contextPath,field:e.name})}),i("field",h)},o=h=>{t(h,n.space,e.superstate.allSpaces().filter(m=>m.type!="default").map(m=>({name:m.name,value:m.path,description:m.path})),"space")},s=h=>{let m=e.fields.filter(g=>g.type=="context").map(g=>({name:g.name,value:g.name}))??[];t(h,null,m,"ref")},l=h=>{let m=n.ref,g=e.fields.find(A=>A.name==m);if(g){let A=pr(g.value,g.type,e.superstate)?.space;A&&t(h,n.field,e.superstate.contextsIndex.get(A)?.contextTable?.cols.map(b=>({name:b.name,value:b.name}))??[],"field",a)}},u=h=>{let m=e.fields.find(g=>g.name==n.ref);if(m){let g=pr(m.value,m.type,e.superstate)?.space;if(g){let A=e.superstate.contextsIndex.get(g)?.contextTable?.cols?.find(b=>b.name==n.field);if(A){let b=[];b.push({name:"None",value:""}),Object.keys(_c).forEach(v=>{(_c[v].type.includes(ho(A))||_c[v].type.includes("any"))&&b.push({name:_c[v].label,value:v})}),t(h,null,b,"fn")}}}},c=h=>{t(h,n.property,e.superstate.contextsIndex.get(n.space)?.contextTable?.cols.filter(m=>!!(m.type?.startsWith("context")&&pr(m.value,m.type,e.superstate).space==e.contextPath)).map(m=>({name:m.name,value:m.name}))??[],"field",a)},f=h=>{let m=e.fields.filter(g=>g.type=="file"||g.type=="link"||g.type=="context").map(g=>({name:g.name,value:g.name}))??[];t(h,null,m,"field")},d=h=>{let m={superstate:e.superstate,saveFormula:g=>i("value",g),formula:n.value,value:{},fields:e.fields.filter(g=>g.name!=e.name),path:""};e.superstate.ui.openCustomMenu(h.target.getBoundingClientRect(),Dr.default.createElement(Ah,{...m}),{...m},Ne(h.view.document),"bottom")},p=h=>{t(h,null,[{name:"2020-04-21",value:"yyyy-MM-dd"},{name:"Apr 21, 2020",value:"MMM d, yyyy"},{name:"Tue Apr 21, 2020",value:"EEE MMM d, yyyy"}],"format")};return e.fieldType?.startsWith("date")?Dr.default.createElement("div",{className:"mk-menu-option",onClick:h=>p(h)},Dr.default.createElement("span",null,H.labels.dateFormat),Dr.default.createElement("span",null,n.format)):e.fieldType?.startsWith("context")?Dr.default.createElement(Dr.default.Fragment,null,Dr.default.createElement("div",{className:"mk-menu-option",onClick:h=>o(h)},Dr.default.createElement("span",null,H.labels.propertyValueSpace),Dr.default.createElement("span",null,wJ(n.space,e.superstate))),n.space?.length>0&&e.contextPath&&Dr.default.createElement("div",{className:"mk-menu-option",onClick:h=>c(h)},Dr.default.createElement("span",null,H.labels.propertyValueProperty),Dr.default.createElement("span",null,n.field))):e.fieldType?.startsWith("aggregate")?Dr.default.createElement(Dr.default.Fragment,null,Dr.default.createElement("div",{className:"mk-menu-option",onClick:h=>s(h)},Dr.default.createElement("span",null,H.labels.propertyValueReference),Dr.default.createElement("span",null,n.ref)),n.ref?.length>0&&Dr.default.createElement("div",{className:"mk-menu-option",onClick:h=>l(h)},Dr.default.createElement("span",null,H.labels.propertyValueAggregate),Dr.default.createElement("span",null,n.field)),n.field?.length>0&&Dr.default.createElement("div",{className:"mk-menu-option",onClick:h=>u(h)},Dr.default.createElement("span",null,H.labels.aggregateBy),Dr.default.createElement("span",null,_c[n?.fn]?.label))):e.fieldType=="number"?Dr.default.createElement(Dr.default.Fragment,null):e.fieldType=="fileprop"?Dr.default.createElement(Dr.default.Fragment,null,Dr.default.createElement("div",{className:"mk-menu-option",onClick:h=>d(h)},Dr.default.createElement("span",null,H.labels.propertyLookup)),Dr.default.createElement("div",{className:"mk-menu-option",onClick:h=>r(h)},Dr.default.createElement("span",null,H.labels.propertyType),Dr.default.createElement("span",null,fc(n.type)?.label))):e.fieldType=="object"?Dr.default.createElement("div",{className:"mk-menu-option",onClick:h=>{e.superstate.ui.openModal("Object Name",Dr.default.createElement(Ki,{value:n.typeName,saveLabel:"Rename Object",saveValue:m=>{i("typeName",m)}}),Ne(h.view.document))}},Dr.default.createElement("span",null,"Name"),Dr.default.createElement("span",null,n.typeName)):e.fieldType=="super"?Dr.default.createElement(Dr.default.Fragment,null,Dr.default.createElement("div",{className:"mk-menu-option"},Dr.default.createElement("span",null,H.labels.propertyDynamic),Dr.default.createElement("input",{type:"checkbox",checked:n.dynamic==!0,onChange:()=>i("dynamic",!n.dynamic)})),Dr.default.createElement("div",{className:"mk-menu-option",onClick:h=>f(h)},Dr.default.createElement("span",null,H.labels.propertyFileProp),Dr.default.createElement("span",null,n.field))):Dr.default.createElement(Dr.default.Fragment,null)};var EZe=e=>{let[t,r]=(0,Kr.useState)(""),[n,i]=(0,Kr.useState)(e.fileMetadata?"$fm":""),a=(0,Kr.useMemo)(()=>e.spaces.map(k=>e.superstate.spacesIndex.get(k)).filter(k=>k),[e.spaces]),[o,s]=(0,Kr.useState)(""),[l,u]=(0,Kr.useState)(e.type??"text"),c=(0,Kr.useMemo)(()=>{let k=[];return e.fileMetadata&&k.push({name:H.menu.setNone,value:"$fm"}),e.contextPath&&(!e.fileMetadata||e.contextPath!="$fm")&&k.push({name:i0(e.contextPath),value:""}),k.push(...(a??[]).map(j=>({name:j.name,value:j.path}))),k},[a]),f=(k,j)=>{u(j[0])},d=k=>{s(k)},p=(k,j)=>{i(j[0])},h=()=>{let k=ml.find(j=>j.type==l||j.multiType==l);u(k.type==l?k.multiType:k.type)},m=k=>{let j=(O,C)=>{let D=[twe].map((P,q)=>({name:Vo(P,e.superstate),value:P.name,icon:Ii(P),onClick:()=>{e.saveField(n,{...P,schemaId:e.schemaId})}}));return e.superstate.ui.openMenu(O,{ui:e.superstate.ui,multi:!1,editable:!1,searchable:!0,value:[],showAll:!0,options:D},Ne(k.view.document))};e.onSubmenu((O,C)=>{let N=[];return ml.filter(D=>n=="$fm"&&!e.isSpace?D.metadata:!D.restricted).forEach((D,P)=>{N.push({id:P+1,name:D.label,value:D.type,icon:D.icon,description:D.description,onClick:()=>u(D.type)})}),N.push({name:"Special",value:"special",icon:"ui//edit",type:6,onSubmenu:j}),e.superstate.ui.openMenu(O,{ui:e.superstate.ui,multi:!1,editable:!1,searchable:!0,value:[],showAll:!0,options:N},Ne(k.view.document))})},g=k=>{s(k)},A=(0,Kr.useMemo)(()=>fc(l,t)??ml[0],[l,t]),b=k=>{k.stopPropagation(),e.superstate.ui.openMenu(k.target.getBoundingClientRect(),{ui:e.superstate.ui,multi:!1,editable:!1,searchable:!1,saveOptions:p,value:[],showAll:!0,options:c},Ne(k.view.document))},v=()=>{if(t.length==0){e.superstate.ui.notify(H.notice.noPropertyName);return}e.saveField(n,{name:t,type:l,value:o,schemaId:e.schemaId})&&e.hide()},x=k=>{k.key=="Enter"&&v()};(0,Kr.useEffect)(()=>{setTimeout(()=>{w.current?.focus()},50)},[]);let w=(0,Kr.useRef)(null),S=k=>{let j=n==""?e.contextPath:n;k.stopPropagation();let O=e.superstate.contextsIndex.get(j)?.contextTable?.cols??[],C=rwe(e.superstate,[...e.superstate.spacesMap.getInverse(j)??[]]).filter(N=>!O.some(D=>D.name==N.name)&&![...d0(e.superstate.settings),e.superstate.settings.fmKeyAlias,"tags"].some(D=>D==N.name)).map(N=>({name:N.name,type:N.type,value:"",schemaId:e.schemaId}));if(C.length==0){e.superstate.ui.notify(H.notice.noPropertiesFound);return}e.superstate.ui.openMenu(k.target.getBoundingClientRect(),{ui:e.superstate.ui,multi:!1,editable:!1,searchable:!0,saveOptions:(N,D)=>{if(D[0]=="all"){e.superstate.spaceManager.readTable(j,Er).then(q=>e.superstate.spaceManager.saveTable(j,{...q,cols:[...q.cols,...C]})).then(q=>e.superstate.reloadContextByPath(j,!0)),e.hide();return}e.saveField(n,D[0])&&e.hide()},value:[],showAll:!0,options:[{name:H.labels.all,value:"all",icon:"ui//plus"},Rt,...C.map((N,D)=>({id:D+1,name:N.name,value:N,icon:Ii(N)}))],placeholder:H.labels.existingFrontmatter},Ne(k.view.document))};return Kr.default.createElement("div",{className:"mk-menu-container"},Kr.default.createElement("div",{className:"mk-menu-suggestions"},Kr.default.createElement("div",{className:"mk-menu-input"},Kr.default.createElement("input",{type:"text",ref:w,placeholder:"Name",onKeyDown:x,onChange:k=>r(k.target.value),onMouseDown:k=>k.stopPropagation(),value:t}),n!="$fm"&&Kr.default.createElement("button",{"aria-label":H.labels.existingFrontmatter,className:"mk-toolbar-button",onClick:k=>S(k),dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//import")}})),Kr.default.createElement("div",{className:"mk-menu-separator"}),c.length>1&&Kr.default.createElement("div",{className:"mk-menu-option",onClick:k=>b(k)},Kr.default.createElement("div",{className:"mk-menu-options-inner"},H.labels.propertyValueSpace),Kr.default.createElement("span",null,n=="$fm"?"None":n==""?e.superstate.spacesIndex.get(e.contextPath)?.name:e.superstate.spacesIndex.get(n)?.name)),Kr.default.createElement("div",{className:"mk-menu-option",onClick:k=>m(k)},Kr.default.createElement("div",{className:"mk-menu-options-inner"},H.labels.propertyType),Kr.default.createElement("span",null,A.label)),A.multi?Kr.default.createElement("div",{className:"mk-menu-option"},Kr.default.createElement("span",null,H.labels.multiple),Kr.default.createElement("input",{type:"checkbox",checked:l==A.multiType,onChange:()=>h()})):Kr.default.createElement(Kr.default.Fragment,null),Kr.default.createElement("div",{className:"mk-menu-separator"}),n!="$fm"||e.isSpace?Kr.default.createElement(Y5,{superstate:e.superstate,table:n,fields:e.fields,fieldType:l,value:o,contextPath:e.contextPath,saveValue:d}):Kr.default.createElement(Kr.default.Fragment,null),Kr.default.createElement("div",{className:"mk-menu-separator"}),Kr.default.createElement("div",{className:"mk-menu-option",onClick:k=>v()},Kr.default.createElement("span",null,H.buttons.saveProperty)),Kr.default.createElement("div",{className:"mk-menu-option",onClick:k=>e.hide()},Kr.default.createElement("span",null,H.buttons.cancel))))},Nf=(e,t,r,n,i,a)=>e.ui.openCustomMenu(t,Kr.default.createElement(EZe,{superstate:e,...n}),{},r,null,i);var wo=Ae(Te());var USe=Ae(Te()),gh=e=>USe.default.createElement("button",{className:`mk-collapse mk-inline-button mk-icon-xsmall ${e.collapsed?"mk-collapsed":""}`,onClick:t=>{e.onToggle&&(e.onToggle(!e.collapsed,t),t.stopPropagation())},dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//collapse-solid")}});var YC=(e,t)=>et?1:0,WSe=(e,t)=>{let r=e.split("/").pop(),n=t.split("/").pop();return YC(r.toLowerCase(),n.toLowerCase())},Z5=(e,t)=>YC(e?.toLowerCase(),t?.toLowerCase()),HSe=(e,t)=>YC(parseFloat(e),parseFloat(t)),VSe=(e,t)=>YC(e=="true"?1:0,t=="true"?1:0),GSe=(e,t)=>YC(sr(e).length,sr(t).length),VQ=(e,t)=>Object.keys(Yp).find(r=>Yp[r].type.some(n=>n==e)&&Yp[r].desc==t),Yp={alphabetical:{type:["text","option"],fn:Z5,label:H.sortTypes.alphaAsc,desc:!1},reverseAlphabetical:{type:["text","option"],fn:(e,t)=>Z5(e,t)*-1,label:H.sortTypes.alphaDesc,desc:!0},linkAlphabetical:{type:["link","context","file","image"],fn:WSe,label:H.sortTypes.alphaAsc,desc:!1},linkReverseAlphabetical:{type:["link","context","file","image"],fn:(e,t)=>WSe(e,t)*-1,label:H.sortTypes.alphaDesc,desc:!0},earliest:{type:["date"],fn:Z5,label:H.sortTypes.earliest,desc:!1},latest:{type:["date"],fn:(e,t)=>Z5(e,t)*-1,label:H.sortTypes.latest,desc:!0},boolean:{type:["boolean"],fn:VSe,label:H.sortTypes.checkAsc,desc:!1},booleanReverse:{type:["boolean"],fn:(e,t)=>VSe(e,t)*-1,label:H.sortTypes.checkDesc,desc:!0},number:{type:["number"],fn:HSe,label:"1 \u2192 9",desc:!1},reverseNumber:{type:["number"],fn:(e,t)=>HSe(e,t)*-1,label:"9 \u2192 1",desc:!0},count:{type:["option-multi","context-multi","link-multi","tags-multi"],fn:GSe,label:H.sortTypes.itemsDesc,desc:!0},reverseCount:{type:["option-multi","context-multi","link-multi","tags-multi"],fn:(e,t)=>GSe(e,t)*-1,label:H.sortTypes.itemsAsc,desc:!1}},QSe=(e,t,r,n)=>{if(!e)return 0;let i=Yp[t.fn];return i?i.fn(r[t.field],n[t.field]):0};var XC=Ae(yi()),hi=Ae(Te());var GQ=(e,t)=>Object.keys(t).find(n=>t[n].type.find(i=>i==e)),ZSe=e=>Object.keys(e),m2=(e,t)=>Object.keys(t).filter(n=>t[n].type.find(i=>i==e)),YSe=(e,t)=>e.filter(r=>Object.keys(t).find(n=>n==r.fn)),QQ=(e,t)=>e?{...t,view:e.view,listItem:e.listItem,listGroup:e.listGroup,listView:e.listView,listViewProps:e.listViewProps,listItemProps:e.listItemProps,listGroupProps:e.listGroupProps,filters:Array.isArray(e.filters)?YSe(e.filters,qi):[],sort:Array.isArray(e.sort)?YSe(e.sort,Yp):[],groupBy:Array.isArray(e.groupBy)?e.groupBy:[],colsOrder:Array.isArray(e.colsOrder)?e.colsOrder:[],colsHidden:Array.isArray(e.colsHidden)?e.colsHidden:[],colsSize:e.colsSize??{},colsCalc:e.colsCalc??{}}:t,ZC=e=>e?.primary=="true"?Wy:{...Wy,view:"table"};var Na=(0,hi.createContext)({dbSchema:null,views:[],source:"",sortedColumns:[],filteredData:[],contextTable:{},editMode:0,setEditMode:()=>null,selectedRows:[],selectRows:()=>null,setContextTable:()=>null,predicate:null,savePredicate:()=>null,saveDB:()=>null,hideColumn:()=>null,saveColumn:()=>!1,newColumn:()=>!1,sortColumn:()=>null,delColumn:()=>null,searchString:"",setSearchString:()=>null,data:[],updateValue:()=>null,updateFieldValue:()=>null,updateRow:()=>null,tableData:null,cols:[]}),h2=e=>{let{frameSchemas:t,saveSchema:r,frameSchema:n}=(0,hi.useContext)(ma),{spaceInfo:i,readMode:a,spaceState:o}=(0,hi.useContext)(ur),[s,l]=(0,hi.useState)(null),[u,c]=(0,hi.useState)({}),[f,d]=(0,hi.useState)(null),[p,h]=(0,hi.useState)(null),[m,g]=(0,hi.useState)(null),[A,b]=(0,hi.useState)([]),[v,x]=(0,hi.useState)(0),w=e.source??n?.def?.context??i?.path,S=(0,hi.useMemo)(()=>n&&n.def?.db?s?s?.rows.find($=>$.id==n.def.db):{id:n.def.db,...yp}:null,[n,s]),k=(0,hi.useMemo)(()=>{let $=t.filter(ae=>ae.type=="view"&&ae.def.db==S?.id);return $.length>0?$:n?[n]:[]},[t,n,S]),j=vA,O=o?.contexts??[],C=async()=>{let $=e.superstate.contextsIndex.get(w)?.schemas;$||($=await e.superstate.spaceManager.tablesForSpace(w)),$&&!(0,XC.isEqual)(s?.rows,$)?l(()=>({...j,rows:$})):S&&D(S)};(0,hi.useEffect)(()=>{S&&D(S)},[S]);let N=(0,hi.useCallback)(async $=>{e.superstate.spaceManager.contextForSpace($).then(ae=>{c(ce=>({...ce,[$]:ae}))})},[]),D=$=>{e.superstate.spaceManager.readTable(w,$.id).then(ae=>{if(ae){if($.primary)for(let ce of O)N(Wn(ce));for(let ce of ae.cols)if(ce.type.startsWith("context")){let U=pr(ce.value,ce.type,e.superstate);N(U.space)}P(ae)}})},P=$=>{d($),c(ae=>({...ae,[w]:$}))};(0,hi.useEffect)(()=>{let $=ce=>{if(ce.path==w)C();else{let U=Object.keys(u).find(R=>e.superstate.spaceManager.spaceInfoForPath(R)?.path==ce.path);U&&N(U)}},ae=ce=>{ce.path==w?C():S?.primary=="true"&&f?.rows.some(U=>U[mt]==ce.path)&&D(S)};return e.superstate.eventsDispatcher.addListener("contextStateUpdated",$),e.superstate.eventsDispatcher.addListener("spaceStateUpdated",$),e.superstate.eventsDispatcher.addListener("pathStateUpdated",ae),()=>{e.superstate.eventsDispatcher.removeListener("contextStateUpdated",$),e.superstate.eventsDispatcher.removeListener("spaceStateUpdated",$),e.superstate.eventsDispatcher.removeListener("pathStateUpdated",ae)}},[u,S,D,i,f]),(0,hi.useEffect)(()=>{C()},[i,n,e.source]);let q=async $=>{i.readOnly||await e.superstate.spaceManager.saveTable(w,$,!0).then(ae=>e.superstate.reloadContext(i,!0))},z=(0,hi.useMemo)(()=>f?[...f.cols.map($=>({...$,table:""}))??[],...S?.primary=="true"?O.reduce(($,ae)=>[...$,...u[Wn(ae)]?.cols.filter(ce=>ce.primary!="true").map(ce=>({...ce,table:ae}))??[]],[]):[]].filter($=>$):[],[f,u,O,S]),I=(0,hi.useMemo)(()=>f?.rows.map(($,ae)=>({_index:ae.toString(),...$,...$[mt]?{[mt]:e.superstate.spaceManager.resolvePath($[mt],o?.path)}:{},...O.reduce((ce,U)=>{let R=u[Wn(U)]?.rows.findIndex(ie=>ie[mt]==$[mt])??-1,J=u[Wn(U)]?.rows[R]??{},ee=Object.keys(J).reduce((ie,re)=>({...ie,[re+U]:J[re]}),{["_index"+U]:R.toString()});return{...ce,...ee}},{})}))??[],[f,u,z,S,o]);(0,hi.useEffect)(()=>{if(f)for(let $ of O)N($)},[f]);let T=async($,ae)=>{await e.superstate.spaceManager.saveTable(ae,$,!0).then(ce=>e.superstate.reloadContextByPath(ae,!0))},L=(0,hi.useMemo)(()=>z.filter($=>$.hidden!="true"&&!(m?.colsHidden??[]).some(ae=>ae==$.name+$.table)).sort(($,ae)=>(m?.colsOrder??[]).findIndex(ce=>ce==$.name+$.table)-(m?.colsOrder??[]).findIndex(ce=>ce==ae.name+ae.table)),[z,m]),_=(0,hi.useMemo)(()=>I.filter($=>(m?.filters??[]).reduce((ae,ce)=>{let U=z.some(R=>R.name=="tags")?{...$,tags:(e.superstate.pathsIndex.get($[mt])?.tags??[]).join(", ")}:$;return ae&&BSe(z.find(R=>R.name+R.table==ce.field),ce,U,o.properties)},!0)).filter($=>p?.length>0?n2(p).test(Object.keys($).filter(ae=>ae.charAt(0)!="_").map(ae=>$[ae]).join("|")):!0).sort(($,ae)=>(m?.sort??[]).reduce((ce,U)=>ce==0?QSe(z.find(R=>R.name+R.table==U.field),U,$,ae):ce,0)),[m,I,z,p]),Y=async($,ae)=>{let ce=e.superstate.spacesIndex.get(w??o.path);if(ae==-1){if(S?.id==Er){let J=I.findIndex(ee=>ee[mt]==$[mt]);if(J==-1){let ee=$[mt],ie=e.superstate.pathsIndex.get(ee);if(ie)await rh(e.superstate,ce,ie.path);else{let Ee=Tu(ce.path)+"/"+ee;await kf(e.superstate,Ee,{})}let re=Object.keys($).filter(Ee=>Ee!=mt);pi(e.superstate,$?.[mt],re.reduce((Ee,Ce)=>({...Ee,[Ce]:$[Ce]}),{})),q(bk(f,$));return}Y($,J);return}q(bk(f,$));return}let U=I[ae],R=Object.keys($).filter(J=>$[J]!=U[J]);pi(e.superstate,U?.[mt],R.reduce((J,ee)=>({...J,[ee]:$[ee]}),{})),q({...f,rows:f.rows.map((J,ee)=>ee==ae?{...J,...$}:J)})},oe=($,ae,ce,U,R)=>{let J=(ce==""?f:u[Wn(ce)])?.cols.find(ee=>ee.name==$);if(J&&pi(e.superstate,R??f.rows[U]?.[mt],{[$]:la(ho(J),ae,!0)}),ce=="")q({...f,rows:f.rows.map((ee,ie)=>ie==U?{...ee,[$]:ae}:ee)});else if(u[ce]){let ee=f.rows[U][mt];T({...u[Wn(ce)],rows:u[Wn(ce)].rows.map((ie,re)=>ie[mt]==ee?{...ie,[$]:ae}:ie)},Wn(ce))}},te=$=>{Oe({sort:[$]})},Q=($,ae)=>{Oe({colsHidden:ae?[...m.colsHidden.filter(ce=>ce!=$.name+$.table),$.name+$.table]:m.colsHidden.filter(ce=>ce!=$.name+$.table)})},fe=($,ae,ce,U,R,J)=>{let ee=f.cols.find(ie=>ie.name==$);if(pi(e.superstate,J??f.rows[R]?.[mt],{[$]:la(ho(ee),ce,!0)}),U==""){let ie={...f,cols:f.cols.map(re=>re.name==$?{...re,value:ae}:re),rows:f.rows.map((re,Ee)=>Ee==R?{...re,[$]:ce}:re)};q(ie)}else if(u[Wn(U)]){let ie=f.rows[R][mt];T({...u[Wn(U)],cols:u[Wn(U)].cols.map(re=>re.name==$?{...re,value:ae}:re),rows:u[Wn(U)].rows.map((re,Ee)=>ie==re[mt]?{...re,[$]:ce}:re)},Wn(U))}},Ie=async $=>{let ae=$.rows.map(ie=>ie[mt]),U=await(async(ie,re)=>{let Ee={uniques:[],cols:re.map(Ce=>Ce.name),rows:[]};for(let Ce of ie){let _e=e.superstate.pathsIndex.get(Ce)?.metadata.property;Ee={uniques:[],cols:re.map(he=>he.name),rows:[...Ee.rows,{[mt]:Ce,..._e?re.reduce((he,ze)=>{let Ye=Ri(ze.name,_e[ze.name],ze.type);return Ye?.length>0?{...he,[ze.name]:Ye}:he},{}):{}}]}}return Ee})(ae,$.cols.filter(ie=>!ie.type.includes("file"))),R=$.rows.map(ie=>{let re=U.rows.find(Ee=>Ee[mt]==ie[mt]);return re?{...ie,...re}:ie}),J=!XC.default.isEqual(R,f?.rows),ee=!XC.default.isEqual(f?.cols,$.cols);(J||ee)&&q({...$,rows:R})};(0,hi.useEffect)(()=>{n&&ve(n.predicate)},[n]);let Se=($,ae)=>{if(b(ae),S?.primary=="true")if($){let ce=f.rows[parseInt($)]?.[mt];ce&&e.superstate.ui.setActivePath(ce)}else e.superstate.ui.setActivePath(w)},Oe=$=>{let ae=ZC(S),ce={...m??ae,...$},U=QQ(ce,ae);r(n?{...n,predicate:JSON.stringify(U)}:{id:Mi(S.id+"View",t.map(R=>R.id)),name:S.name+" View",type:"view",def:{db:S.id},predicate:JSON.stringify(U)}),g(U)};(0,hi.useEffect)(()=>{m&&g($=>({...$,colsOrder:kr([...$.colsOrder,...z.filter(ae=>ae.hidden!="true").map(ae=>ae.name+ae.table)])}))},[z]);let ve=$=>{let ae=ZC(S),ce=QQ(or($),ae);g({...ce,colsOrder:kr([...ce.colsOrder,...z.filter(U=>U.hidden!="true").map(U=>U.name+U.table)])})},ye=$=>{let ae,ce=$.table;ce==""?ae=f:u[Wn(ce)]&&(ae=u[Wn(ce)]);let U=ae.cols.filter((J,ee)=>J.name!=$.name),R={...ae,cols:U,rows:ae.rows.map(J=>{let{[$.name]:ee,...ie}=J;return ie})};ce==""?q(R):u[Wn(ce)]&&T(R,Wn(ce))},me=$=>ke($),ke=($,ae)=>{let ce,U={...$,name:ZA($.name)},R=U.table;if(R==""||R==w?ce=f:u[Wn(R)]&&(ce=u[Wn(R)]),U.name=="")return e.superstate.ui.notify(H.notice.noPropertyName),!1;if(!ae&&ce.cols.find(re=>re.name.toLowerCase()==U.name.toLowerCase())||ae&&ae.name!=U.name&&ce.cols.find(re=>re.name.toLowerCase()==U.name.toLowerCase()))return e.superstate.ui.notify(H.notice.duplicatePropertyName),!1;if(!ae&&$.schemaId==Er&&$.type.startsWith("option")){let re=kr([...e.superstate.spacesMap.getInverse(w)??[]].flatMap(Ce=>sr(e.superstate.pathsIndex.get(Ce)?.metadata?.property?.[$.name])??[])),Ee=pA(re.map(Ce=>({value:Ce,name:Ce})),{});U.value=Ee}let J=ae?ce.cols.findIndex(re=>re.name==ae.name):-1,ee=J==-1?[...ce.cols,U]:ce.cols.map((re,Ee)=>Ee==J?U:re),ie={...ce,cols:ee,rows:ce.rows.map(re=>ae?{...re,[U.name]:re[ae.name],oldColumn:void 0}:re)};return ae&&Oe({filters:(m?.filters??[]).map(re=>re.field==ae.name+ae.table?{...re,field:U.name+U.table}:re),sort:(m?.sort??[]).map(re=>re.field==ae.name+ae.table?{...re,field:U.name+U.table}:re),groupBy:(m?.groupBy??[]).map(re=>re==ae.name+ae.table?U.name+U.table:re),colsHidden:(m?.colsHidden??[]).map(re=>re==ae.name+ae.table?U.name+U.table:re),colsOrder:(m?.colsOrder??[]).map(re=>re==ae.name+ae.table?U.name+U.table:re),colsSize:{...m?.colsSize??{},[U.name+U.table]:m?.colsSize?.[ae.name+ae.table],[ae.name+ae.table]:void 0},colsCalc:{...m?.colsCalc??{},[U.name+U.table]:m?.colsCalc?.[ae.name+ae.table],[ae.name+ae.table]:void 0}}),R==""?S.id==Er?Ie(ie):q(ie):u[Wn(R)]&&T(ie,Wn(R)),!0};return hi.default.createElement(Na.Provider,{value:{source:w,views:k,cols:z,saveDB:q,filteredData:_,dbSchema:S,tableData:f,selectedRows:A,selectRows:Se,sortedColumns:L,contextTable:u,setContextTable:c,predicate:m,savePredicate:Oe,saveColumn:ke,hideColumn:Q,sortColumn:te,delColumn:ye,newColumn:me,searchString:p,setSearchString:h,updateValue:oe,updateFieldValue:fe,editMode:v,setEditMode:x,data:I,updateRow:Y}},e.children)};var KC=Ae(Te()),XSe=Ae(bl()),vh=KC.default.createContext({dragNode:null,setDragNode:()=>null,dragActive:!1}),KSe=e=>{let[t,r]=KC.default.useState(null);return Ca({onDragCancel:()=>{r(null)},onDragEnd:()=>{r(null)}}),KC.default.createElement(vh.Provider,{value:{dragNode:t,setDragNode:r,dragActive:e.dragActive}},e.children,t&&(0,XSe.createPortal)(KC.default.createElement(Um,{dropAnimation:null,zIndex:1600},t),document.body))};var Qr=Ae(Te());var JSe=Ae(Te()),Io=e=>JSe.default.createElement("div",{"aria-label":e.name,className:`mk-editor-frame-node-button ${e.value==e.onValue?"mk-active":""}`,onClick:t=>e.value==e.onValue?e.setValue(e.defaultValue):e.setValue(e.onValue),dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker(e.icon)}});var e2e=e=>{let{pathState:t}=(0,Qr.useContext)($r),{spaceInfo:r}=(0,Qr.useContext)(ur),{predicate:n,savePredicate:i,sortedColumns:a}=(0,Qr.useContext)(Na),o=(b,v)=>{i({view:"frame",[v]:b})},{frameSchemas:s,saveSchema:l}=(0,Qr.useContext)(ma),u=(0,Qr.useMemo)(()=>{let b=[];return s&&b.push(...s.filter(v=>v.type=="frame"&&v.def?.type=="listItem").map(v=>({name:v.name,value:`${r.path}/#*${v.id}`}))),b.push(...e.superstate.selectedKit.frames.filter(v=>Ao(v.schema).def?.type=="listItem").map(v=>({name:v.schema.name,value:`spaces://$kit/#*${Ao(v.schema).def.id}`}))),b},[]),c=(b,v)=>{let x=b.target.getBoundingClientRect();e.superstate.ui.openMenu(x,{ui:e.superstate.ui,multi:!1,editable:!0,value:[],options:[...s.filter(w=>w.type=="frame"&&w.def?.type==v).map(w=>({name:w.name,value:`${r.path}/#*${w.id}`})),...e.superstate.selectedKit.frames.filter(w=>Ao(w.schema).def?.type==v).map(w=>({name:w.schema.name,icon:"ui//package-plus",value:`spaces://$kit/#*${Ao(w.schema).def.id}`}))],saveOptions:(w,S,k)=>{o(S[0],v)},placeholder:H.hintText.createListItem,detail:!0,searchable:!1,showAll:!0},Ne(b.view.document))},f=async(b,v)=>(o(`${r.path}/#*${b.id}`,v),await l(b),b),d=async()=>{let b=e.superstate.spaceManager.uriByString(n.listItem);if(b.authority=="$kit"){e.superstate.ui.notify("Already in Kit");return}let v=await e.superstate.spaceManager.readFrame(b.basePath,b.ref);e.superstate.spaceManager.saveFrameKit(v,e.superstate.settings.selectedKit)},p=b=>{let v=mA(n[b],"spaces://$kit/#*"+b),x=e.superstate.spaceManager.uriByString(v);if(x.authority=="$kit"){let w=e.superstate.kit.find(S=>S.def.id==x.ref);f({name:w.def.id,type:"frame",id:w.def.id,def:w.def},b).then(async S=>{await tre(e.superstate,r,S.id,w),o(`./#*${S.id}`,b)})}else o(v,b);e.setEditSection(b)},[h,m]=(0,Qr.useState)(!1),[g,A]=(0,Qr.useTransition)();return(0,Qr.useEffect)(()=>{A(()=>{m(!0)})},[]),n?Qr.default.createElement("div",{className:"mk-editor-context-selector"},Qr.default.createElement("div",{className:"mk-editor-context-groups"},Qr.default.createElement("div",{className:"mk-editor-context-group"},Qr.default.createElement(Io,{superstate:e.superstate,name:H.editor.rows,icon:"ui//rows",value:n.listGroup,defaultValue:"spaces://$kit/#*listGroup",onValue:"spaces://$kit/#*listGroup",setValue:b=>{i({view:"list",listView:"spaces://$kit/#*listView",listGroup:"spaces://$kit/#*listGroup"})}}),Qr.default.createElement(Io,{superstate:e.superstate,name:H.editor.columns,icon:"ui//columns",value:n.listGroup,defaultValue:"spaces://$kit/#*columnGroup",onValue:"spaces://$kit/#*columnGroup",setValue:b=>{i({view:"list",listView:"spaces://$kit/#*columnView",listGroup:"spaces://$kit/#*columnGroup"})}}),Qr.default.createElement(Io,{superstate:e.superstate,name:H.editor.catalog,icon:"ui//gallery-horizontal-end",value:n.listGroup,defaultValue:"spaces://$kit/#*rowGroup",onValue:"spaces://$kit/#*rowGroup",setValue:b=>{i({view:"list",listView:"spaces://$kit/#*listView",listGroup:"spaces://$kit/#*rowGroup"})}}),Qr.default.createElement(Io,{superstate:e.superstate,name:H.editor.grid,icon:"ui//layout-grid",value:n.listGroup,defaultValue:"spaces://$kit/#*gridGroup",onValue:"spaces://$kit/#*gridGroup",setValue:b=>{i({view:"list",listView:"spaces://$kit/#*listView",listGroup:"spaces://$kit/#*gridGroup"})}}),Qr.default.createElement("button",{onClick:b=>{p("listGroup")},"aria-label":H.buttons.customize,className:"mk-icon-xsmall mk-button-new",dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//brush")},style:{height:"20px",padding:"8px"}})),Qr.default.createElement("div",{className:"mk-editor-context-group"},Qr.default.createElement("div",{className:"mk-editor-context-group-select",onClick:b=>{c(b,"listItem"),b.stopPropagation()}},u.find(b=>b.value==n.listItem)?.name??H.labels.select,Qr.default.createElement(gh,{superstate:e.superstate,collapsed:!1,onToggle:(b,v)=>{c(v,"listItem"),v.stopPropagation()}})),Qr.default.createElement("button",{onClick:b=>{p("listItem")},"aria-label":H.buttons.customize,className:"mk-icon-xsmall mk-button-new",style:{height:"20px",padding:"8px"},dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//brush")}}),Qr.default.createElement("button",{onClick:b=>{d()},className:"mk-icon-xsmall",dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//package-plus")},style:{height:"20px",padding:"8px"}})),Qr.default.createElement("span",null),Qr.default.createElement("div",{className:"mk-editor-frame-node-button-primary",onClick:b=>{e.setEditMode(0),b.stopPropagation()}},H.labels.done)),e.editSection=="listItem"&&Qr.default.createElement("div",{className:"mk-editor-context-properties"},Qr.default.createElement("div",{style:{display:"flex"}},H.labels.properties,Qr.default.createElement("div",{"aria-label":H.hintText.dragDropProperties,className:"mk-icon-xsmall",dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//help-circle")}})),Qr.default.createElement("div",null,a.map((b,v)=>Qr.default.createElement(JC,{contexts:[t.path],path:t.path,key:v,superstate:e.superstate,property:b,draggable:!0}))))):null},JC=e=>{let{uid:t}=(0,Qr.useContext)($r),r=e.contexts?.[0],n=`${t}_props_${r??""}${e.property.name}`,{attributes:i,listeners:a,setNodeRef:o,transform:s}=Us({id:n,data:{id:n,name:e.property.name,property:e.property,context:r??"",path:e.path,type:"property"}}),{setDragNode:l}=(0,Qr.useContext)(vh);return Ca({onDragStart:u=>{u.active.data.current.id==n&&l(Qr.default.createElement("div",{className:"mk-path-context-field",onClick:c=>e.onClick?e.onClick(c):null},Qr.default.createElement("div",{className:"mk-path-context-field-icon",dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker(Ii(e.property))}}),Qr.default.createElement("div",{className:"mk-path-context-field-key"},Vo(e.property,e.superstate))))}}),Qr.default.createElement("div",{ref:o,className:"mk-path-context-field",onClick:u=>e.onClick?e.onClick(u):null,...i,...a},Qr.default.createElement("div",{className:"mk-path-context-field-icon",dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker(Ii(e.property))}}),e.contexts?.length>0&&Qr.default.createElement("div",{className:"mk-path-context-field-space",dangerouslySetInnerHTML:{__html:e.contexts.length==1?e.superstate.ui.getSticker(e.superstate.pathsIndex.get(e.contexts[0])?.label?.sticker):e.contexts.length}}),Qr.default.createElement("div",{className:"mk-path-context-field-key"},Vo(e.property,e.superstate)))};var rD=Ae(Te(),1);function Sv(e,t){return typeof e=="function"?e(t):e}function Tf(e,t){return r=>{t.setState(n=>({...n,[e]:Sv(r,n[e])}))}}function e9(e){return e instanceof Function}function kZe(e){return Array.isArray(e)&&e.every(t=>typeof t=="number")}function n2e(e,t){let r=[],n=i=>{i.forEach(a=>{r.push(a);let o=t(a);o!=null&&o.length&&n(o)})};return n(e),r}function Or(e,t,r){let n=[],i;return a=>{let o;r.key&&r.debug&&(o=Date.now());let s=e(a);if(!(s.length!==n.length||s.some((c,f)=>n[f]!==c)))return i;n=s;let u;if(r.key&&r.debug&&(u=Date.now()),i=t(...s),r==null||r.onChange==null||r.onChange(i),r.key&&r.debug&&r!=null&&r.debug()){let c=Math.round((Date.now()-o)*100)/100,f=Math.round((Date.now()-u)*100)/100,d=f/16,p=(h,m)=>{for(h=String(h);h.length-1&&(r=r.slice(0,n))}return t+r.length<=this.to?r:r.slice(0,this.to-t)}nextLine(){let t=this.parsedPos,r=this.lineAfter(t),n=t+r.length;for(let i=this.rangeIndex;;){let a=this.ranges[i].to;if(a>=n||(r=r.slice(0,a-(n-r.length)),i++,i==this.ranges.length))break;let o=this.ranges[i].from,s=this.lineAfter(o);r+=s,n=o+s.length}return{line:r,end:n}}skipGapsTo(t,r,n){for(;;){let i=this.ranges[this.rangeIndex].to,a=t+r;if(n>0?i>a:i>=a)break;r+=this.ranges[++this.rangeIndex].from-i}return r}moveRangeIndex(){for(;this.ranges[this.rangeIndex].to1){a=this.skipGapsTo(r,a,1),r+=a;let o=this.chunk.length;a=this.skipGapsTo(n,a,-1),n+=a,i+=this.chunk.length-o}return this.chunk.push(t,r,n,i),a}parseLine(t){let{line:r,end:n}=this.nextLine(),i=0,{streamParser:a}=this.lang,o=new _5(r,t?t.state.tabSize:4,t?j5(t.state):2);if(o.eol())a.blankLine(this.state,o.indentUnit);else for(;!o.eol();){let s=Lwe(a.token,o,this.state);if(s&&(i=this.emitToken(this.lang.tokenTable.resolve(s),this.parsedPos+o.start,this.parsedPos+o.pos,4,i)),o.start>1e4)break}this.parsedPos=n,this.moveRangeIndex(),this.parsedPost.start)return i}throw new Error("Stream parser failed to advance stream.")}var hQ=Object.create(null),RC=[Dl.none],CYe=new a2(RC),xwe=[],wwe=Object.create(null),zwe=Object.create(null);for(let[e,t]of[["variable","variableName"],["variable-2","variableName.special"],["string-2","string.special"],["def","variableName.definition"],["tag","tagName"],["attribute","attributeName"],["type","typeName"],["builtin","variableName.standard"],["qualifier","modifier"],["error","invalid"],["header","heading"],["property","propertyName"]])zwe[e]=Uwe(hQ,t);var P5=class{constructor(t){this.extra=t,this.table=Object.assign(Object.create(null),zwe)}resolve(t){return t?this.table[t]||(this.table[t]=Uwe(this.extra,t)):0}},DYe=new P5(hQ);function iQ(e,t){xwe.indexOf(e)>-1||(xwe.push(e),console.warn(t))}function Uwe(e,t){let r=[];for(let s of t.split(" ")){let l=[];for(let u of s.split(".")){let c=e[u]||qe[u];c?typeof c=="function"?l.length?l=l.map(c):iQ(u,`Modifier ${u} used at start of tag`):l.length?iQ(u,`Tag ${u} used as modifier`):l=Array.isArray(c)?c:[c]:iQ(u,`Unknown highlighting tag ${u}`)}for(let u of l)r.push(u)}if(!r.length)return 0;let n=t.replace(/ /g,"_"),i=n+" "+r.map(s=>s.id),a=wwe[i];if(a)return a.id;let o=wwe[i]=Dl.define({id:RC.length,name:n,props:[cwe({[n]:r})]});return RC.push(o),o.id}function OYe(e){let t=Dl.define({id:RC.length,name:"Document",props:[l2.add(()=>e)],top:!0});return RC.push(t),t}var TKt={rtl:on.Decoration.mark({class:"cm-iso",inclusive:!0,attributes:{dir:"rtl"},bidiIsolate:on.Direction.RTL}),ltr:on.Decoration.mark({class:"cm-iso",inclusive:!0,attributes:{dir:"ltr"},bidiIsolate:on.Direction.LTR}),auto:on.Decoration.mark({class:"cm-iso",inclusive:!0,attributes:{dir:"auto"},bidiIsolate:null})};var Wwe=require("@codemirror/view");var Hwe=e=>{var{theme:t,settings:r={},styles:n=[]}=e,i={".cm-gutters":{}},a={};r.background&&(a.backgroundColor=r.background),r.backgroundImage&&(a.backgroundImage=r.backgroundImage),r.foreground&&(a.color=r.foreground),(r.background||r.foreground)&&(i["&"]=a),r.fontFamily&&(i["&.cm-editor .cm-scroller"]={fontFamily:r.fontFamily}),r.gutterBackground&&(i[".cm-gutters"].backgroundColor=r.gutterBackground),r.gutterForeground&&(i[".cm-gutters"].color=r.gutterForeground),r.gutterBorder&&(i[".cm-gutters"].borderRightColor=r.gutterBorder),r.caret&&(i[".cm-content"]={caretColor:r.caret},i[".cm-cursor, .cm-dropCursor"]={borderLeftColor:r.caret});var o={};r.gutterActiveForeground&&(o.color=r.gutterActiveForeground),r.lineHighlight&&(i[".cm-activeLine"]={backgroundColor:r.lineHighlight},o.backgroundColor=r.lineHighlight),i[".cm-activeLineGutter"]=o,r.selection&&(i["&.cm-focused .cm-selectionBackground, & .cm-line::selection, & .cm-selectionLayer .cm-selectionBackground, .cm-content ::selection"]={background:r.selection+" !important"}),r.selectionMatch&&(i["& .cm-selectionMatch"]={backgroundColor:r.selectionMatch});var s=Wwe.EditorView.theme(i,{dark:t==="dark"}),l=Wd.define(n),u=[s,JA(l)];return u};var MYe={background:"#0f0f0f",foreground:"#defdef",caret:"#00FF00",selection:"#515151",selectionMatch:"#515151",gutterBackground:"#555",gutterForeground:"#FFFFFF",lineHighlight:"#0a6bcb3d"},AQ=e=>{var{theme:t="dark",settings:r={},styles:n=[]}=e||{};return Hwe({theme:t,settings:Fn({},MYe,r),styles:[{tag:qe.keyword,color:"darkgoldenrod",fontWeight:"bold"},{tag:qe.atom,color:"#77F"},{tag:qe.comment,color:"#7a7b7c",fontStyle:"italic"},{tag:qe.number,color:"violet"},{tag:qe.definition(qe.variableName),color:"#fffabc"},{tag:qe.variableName,color:"#abcdef"},{tag:qe.function(qe.variableName),color:"#fffabc"},{tag:qe.typeName,color:"#FFDD44"},{tag:qe.tagName,color:"#def"},{tag:qe.string,color:"#2b4"},{tag:qe.meta,color:"#C9F"},{tag:qe.bracket,color:"#8a8a8a"},{tag:qe.attributeName,color:"#DDFF00"},{tag:qe.heading,color:"aquamarine",fontWeight:"bold"},{tag:qe.link,color:"blueviolet",fontWeight:"bold"},...n]})},UKt=AQ();var En={};dM(En,{basicSetup:()=>U5,color:()=>fZe,default:()=>VC,defaultLightThemeOption:()=>FQ,getDefaultExtensions:()=>_Q,getStatistics:()=>PQ,minimalSetup:()=>cZe,oneDark:()=>TQ,oneDarkHighlightStyle:()=>xSe,oneDarkTheme:()=>bSe,useCodeMirror:()=>IQ});function LC(e,t){if(e==null)return{};var r={},n=Object.keys(e),i,a;for(a=0;a=0)&&(r[i]=e[i]);return r}var d2=Ae(Te());var Yp=Ae(Te()),Qy=require("@codemirror/state"),HC=require("@codemirror/view");var SSe=require("@codemirror/commands");var Po=require("@codemirror/view"),uSe=require("@codemirror/state"),eg=require("@codemirror/commands"),z5=require("@codemirror/search");var Xt=require("@codemirror/state"),bo=require("@codemirror/view");var R5=class{constructor(t,r,n){this.state=t,this.pos=r,this.explicit=n,this.abortListeners=[]}tokenBefore(t){let r=Zs(this.state).resolveInner(this.pos,-1);for(;r&&t.indexOf(r.name)<0;)r=r.parent;return r?{from:r.from,to:this.pos,text:this.state.sliceDoc(r.from,this.pos),type:r.type}:null}matchBefore(t){let r=this.state.doc.lineAt(this.pos),n=Math.max(r.from,this.pos-250),i=r.text.slice(n-r.from,this.pos-r.from),a=i.search(Jwe(t,!1));return a<0?null:{from:n+a,to:this.pos,text:i.slice(a)}}get aborted(){return this.abortListeners==null}addEventListener(t,r){t=="abort"&&this.abortListeners&&this.abortListeners.push(r)}};function Vwe(e){let t=Object.keys(e).join(""),r=/\w/.test(t);return r&&(t=t.replace(/\w/g,"")),`[${r?"\\w":""}${t.replace(/[^\w\s]/g,"\\$&")}]`}function jYe(e){let t=Object.create(null),r=Object.create(null);for(let{label:i}of e){t[i[0]]=!0;for(let a=1;atypeof i=="string"?{label:i}:i),[r,n]=t.every(i=>/^\w+$/.test(i.label))?[/\w*$/,/\w+$/]:jYe(t);return i=>{let a=i.matchBefore(n);return a||i.explicit?{from:a?a.from:i.pos,options:t,validFor:r}:null}}var $5=class{constructor(t,r,n,i){this.completion=t,this.source=r,this.match=n,this.score=i}};function bv(e){return e.selection.main.from}function Jwe(e,t){var r;let{source:n}=e,i=t&&n[0]!="^",a=n[n.length-1]!="$";return!i&&!a?e:new RegExp(`${i?"^":""}(?:${n})${a?"$":""}`,(r=e.flags)!==null&&r!==void 0?r:e.ignoreCase?"i":"")}var TYe=Xt.Annotation.define();function FYe(e,t,r,n){let{main:i}=e.selection,a=r-i.from,o=n-i.from;return Object.assign(Object.assign({},e.changeByRange(s=>s!=i&&r!=n&&e.sliceDoc(s.from+a,s.from+o)!=e.sliceDoc(r,n)?{range:s}:{changes:{from:s.from+a,to:n==i.from?s.to:s.from+o,insert:t},range:Xt.EditorSelection.cursor(s.from+a+t.length)})),{scrollIntoView:!0,userEvent:"input.complete"})}var Gwe=new WeakMap;function _Ye(e){if(!Array.isArray(e))return e;let t=Gwe.get(e);return t||Gwe.set(e,t=NYe(e)),t}var q5=Xt.StateEffect.define(),zC=Xt.StateEffect.define(),yQ=class{constructor(t){this.pattern=t,this.chars=[],this.folded=[],this.any=[],this.precise=[],this.byWord=[],this.score=0,this.matched=[];for(let r=0;r=48&&w<=57||w>=97&&w<=122?2:w>=65&&w<=90?1:0:(S=(0,Xt.fromCodePoint)(w))!=S.toLowerCase()?1:S!=S.toUpperCase()?2:0;(!b||k==1&&g||x==0&&k!=0)&&(r[f]==w||n[f]==w&&(d=!0)?o[f++]=b:o.length&&(A=!1)),x=k,b+=(0,Xt.codePointSize)(w)}return f==l&&o[0]==0&&A?this.result(-100+(d?-200:0),o,t):p==l&&h==0?this.ret(-200-t.length+(m==t.length?0:-100),[0,m]):s>-1?this.ret(-700-t.length,[s,s+this.pattern.length]):p==l?this.ret(-200+-700-t.length,[h,m]):f==l?this.result(-100+(d?-200:0)+-700+(A?0:-1100),o,t):r.length==2?null:this.result((i[0]?-700:0)+-200+-1100,i,t)}result(t,r,n){let i=[],a=0;for(let o of r){let s=o+(this.astral?(0,Xt.codePointSize)((0,Xt.codePointAt)(n,o)):1);a&&i[a-1]==o?i[a-1]=s:(i[a++]=o,i[a++]=s)}return this.ret(t-n.length,i)}},bQ=class{constructor(t){this.pattern=t,this.matched=[],this.score=0,this.folded=t.toLowerCase()}match(t){if(t.length"",optionClass:()=>"",aboveCursor:!1,icons:!0,addToOptions:[],positionInfo:PYe,filterStrict:!1,compareCompletions:(t,r)=>t.label.localeCompare(r.label),interactionDelay:75,updateSyncTime:100},{defaultKeymap:(t,r)=>t&&r,closeOnBlur:(t,r)=>t&&r,icons:(t,r)=>t&&r,tooltipClass:(t,r)=>n=>Qwe(t(n),r(n)),optionClass:(t,r)=>n=>Qwe(t(n),r(n)),addToOptions:(t,r)=>t.concat(r),filterStrict:(t,r)=>t||r})}});function Qwe(e,t){return e?t?e+" "+t:e:t}function PYe(e,t,r,n,i,a){let o=e.textDirection==bo.Direction.RTL,s=o,l=!1,u="top",c,f,d=t.left-i.left,p=i.right-t.right,h=n.right-n.left,m=n.bottom-n.top;if(s&&d=m||b>t.top?c=r.bottom-t.top:(u="bottom",c=t.bottom-r.top)}let g=(t.bottom-t.top)/a.offsetHeight,A=(t.right-t.left)/a.offsetWidth;return{style:`${u}: ${c/g}px; max-width: ${f/A}px`,class:"cm-completionInfo-"+(l?o?"left-narrow":"right-narrow":s?"left":"right")}}function IYe(e){let t=e.addToOptions.slice();return e.icons&&t.push({render(r){let n=document.createElement("div");return n.classList.add("cm-completionIcon"),r.type&&n.classList.add(...r.type.split(/\s+/g).map(i=>"cm-completionIcon-"+i)),n.setAttribute("aria-hidden","true"),n},position:20}),t.push({render(r,n,i,a){let o=document.createElement("span");o.className="cm-completionLabel";let s=r.displayLabel||r.label,l=0;for(let u=0;ul&&o.appendChild(document.createTextNode(s.slice(l,c)));let d=o.appendChild(document.createElement("span"));d.appendChild(document.createTextNode(s.slice(c,f))),d.className="cm-completionMatchedText",l=f}return lr.position-n.position).map(r=>r.render)}function gQ(e,t,r){if(e<=r)return{from:0,to:e};if(t<0&&(t=0),t<=e>>1){let i=Math.floor(t/r);return{from:i*r,to:(i+1)*r}}let n=Math.floor((e-t)/r);return{from:e-(n+1)*r,to:e-n*r}}var xQ=class{constructor(t,r,n){this.view=t,this.stateField=r,this.applyCompletion=n,this.info=null,this.infoDestroy=null,this.placeInfoReq={read:()=>this.measureInfo(),write:l=>this.placeInfo(l),key:this},this.space=null,this.currentClass="";let i=t.state.field(r),{options:a,selected:o}=i.open,s=t.state.facet(Ml);this.optionContent=IYe(s),this.optionClass=s.optionClass,this.tooltipClass=s.tooltipClass,this.range=gQ(a.length,o,s.maxRenderedOptions),this.dom=document.createElement("div"),this.dom.className="cm-tooltip-autocomplete",this.updateTooltipClass(t.state),this.dom.addEventListener("mousedown",l=>{let{options:u}=t.state.field(r).open;for(let c=l.target,f;c&&c!=this.dom;c=c.parentNode)if(c.nodeName=="LI"&&(f=/-(\d+)$/.exec(c.id))&&+f[1]{let u=t.state.field(this.stateField,!1);u&&u.tooltip&&t.state.facet(Ml).closeOnBlur&&l.relatedTarget!=t.contentDOM&&t.dispatch({effects:zC.of(null)})}),this.showOptions(a,i.id)}mount(){this.updateSel()}showOptions(t,r){this.list&&this.list.remove(),this.list=this.dom.appendChild(this.createListBox(t,r,this.range)),this.list.addEventListener("scroll",()=>{this.info&&this.view.requestMeasure(this.placeInfoReq)})}update(t){var r;let n=t.state.field(this.stateField),i=t.startState.field(this.stateField);if(this.updateTooltipClass(t.state),n!=i){let{options:a,selected:o,disabled:s}=n.open;(!i.open||i.open.options!=a)&&(this.range=gQ(a.length,o,t.state.facet(Ml).maxRenderedOptions),this.showOptions(a,n.id)),this.updateSel(),s!=((r=i.open)===null||r===void 0?void 0:r.disabled)&&this.dom.classList.toggle("cm-tooltip-autocomplete-disabled",!!s)}}updateTooltipClass(t){let r=this.tooltipClass(t);if(r!=this.currentClass){for(let n of this.currentClass.split(" "))n&&this.dom.classList.remove(n);for(let n of r.split(" "))n&&this.dom.classList.add(n);this.currentClass=r}}positioned(t){this.space=t,this.info&&this.view.requestMeasure(this.placeInfoReq)}updateSel(){let t=this.view.state.field(this.stateField),r=t.open;if((r.selected>-1&&r.selected=this.range.to)&&(this.range=gQ(r.options.length,r.selected,this.view.state.facet(Ml).maxRenderedOptions),this.showOptions(r.options,t.id)),this.updateSelectedOption(r.selected)){this.destroyInfo();let{completion:n}=r.options[r.selected],{info:i}=n;if(!i)return;let a=typeof i=="string"?document.createTextNode(i):i(n);if(!a)return;"then"in a?a.then(o=>{o&&this.view.state.field(this.stateField,!1)==t&&this.addInfoPane(o,n)}).catch(o=>(0,bo.logException)(this.view.state,o,"completion info")):this.addInfoPane(a,n)}}addInfoPane(t,r){this.destroyInfo();let n=this.info=document.createElement("div");if(n.className="cm-tooltip cm-completionInfo",t.nodeType!=null)n.appendChild(t),this.infoDestroy=null;else{let{dom:i,destroy:a}=t;n.appendChild(i),this.infoDestroy=a||null}this.dom.appendChild(n),this.view.requestMeasure(this.placeInfoReq)}updateSelectedOption(t){let r=null;for(let n=this.list.firstChild,i=this.range.from;n;n=n.nextSibling,i++)n.nodeName!="LI"||!n.id?i--:i==t?n.hasAttribute("aria-selected")||(n.setAttribute("aria-selected","true"),r=n):n.hasAttribute("aria-selected")&&n.removeAttribute("aria-selected");return r&&RYe(this.list,r),r}measureInfo(){let t=this.dom.querySelector("[aria-selected]");if(!t||!this.info)return null;let r=this.dom.getBoundingClientRect(),n=this.info.getBoundingClientRect(),i=t.getBoundingClientRect(),a=this.space;if(!a){let o=this.dom.ownerDocument.defaultView||window;a={left:0,top:0,right:o.innerWidth,bottom:o.innerHeight}}return i.top>Math.min(a.bottom,r.bottom)-10||i.bottomn.from||n.from==0))if(a=d,typeof u!="string"&&u.header)i.appendChild(u.header(u));else{let p=i.appendChild(document.createElement("completion-section"));p.textContent=d}}let c=i.appendChild(document.createElement("li"));c.id=r+"-"+o,c.setAttribute("role","option");let f=this.optionClass(s);f&&(c.className=f);for(let d of this.optionContent){let p=d(s,this.view.state,this.view,l);p&&c.appendChild(p)}}return n.from&&i.classList.add("cm-completionListIncompleteTop"),n.tonew xQ(r,e,t)}function RYe(e,t){let r=e.getBoundingClientRect(),n=t.getBoundingClientRect(),i=r.height/e.offsetHeight;n.topr.bottom&&(e.scrollTop+=(n.bottom-r.bottom)/i)}function Ywe(e){return(e.boost||0)*100+(e.apply?10:0)+(e.info?5:0)+(e.type?1:0)}function $Ye(e,t){let r=[],n=null,i=u=>{r.push(u);let{section:c}=u.completion;if(c){n||(n=[]);let f=typeof c=="string"?c:c.name;n.some(d=>d.name==f)||n.push(typeof c=="string"?{name:f}:c)}},a=t.facet(Ml);for(let u of e)if(u.hasResult()){let c=u.result.getMatch;if(u.result.filter===!1)for(let f of u.result.options)i(new $5(f,u.source,c?c(f):[],1e9-r.length));else{let f=t.sliceDoc(u.from,u.to),d,p=a.filterStrict?new bQ(f):new yQ(f);for(let h of u.result.options)if(d=p.match(h.label)){let m=h.displayLabel?c?c(h,d.matched):[]:d.matched;i(new $5(h,u.source,m,d.score+(h.boost||0)))}}}if(n){let u=Object.create(null),c=0,f=(d,p)=>{var h,m;return((h=d.rank)!==null&&h!==void 0?h:1e9)-((m=p.rank)!==null&&m!==void 0?m:1e9)||(d.namef.score-c.score||l(c.completion,f.completion))){let c=u.completion;!s||s.label!=c.label||s.detail!=c.detail||s.type!=null&&c.type!=null&&s.type!=c.type||s.apply!=c.apply||s.boost!=c.boost?o.push(u):Ywe(u.completion)>Ywe(s)&&(o[o.length-1]=u),s=u.completion}return o}var yv=class{constructor(t,r,n,i,a,o){this.options=t,this.attrs=r,this.tooltip=n,this.timestamp=i,this.selected=a,this.disabled=o}setSelected(t,r){return t==this.selected||t>=this.options.length?this:new yv(this.options,Zwe(r,t),this.tooltip,this.timestamp,t,this.disabled)}static build(t,r,n,i,a){let o=$Ye(t,r);if(!o.length)return i&&t.some(l=>l.state==1)?new yv(i.options,i.attrs,i.tooltip,i.timestamp,i.selected,!0):null;let s=r.facet(Ml).selectOnOpen?0:-1;if(i&&i.selected!=s&&i.selected!=-1){let l=i.options[i.selected].completion;for(let u=0;uu.hasResult()?Math.min(l,u.from):l,1e8),create:WYe,above:a.aboveCursor},i?i.timestamp:Date.now(),s,!1)}map(t){return new yv(this.options,this.attrs,Object.assign(Object.assign({},this.tooltip),{pos:t.mapPos(this.tooltip.pos)}),this.timestamp,this.selected,this.disabled)}},c2=class{constructor(t,r,n){this.active=t,this.id=r,this.open=n}static start(){return new c2(zYe,"cm-ac-"+Math.floor(Math.random()*2e6).toString(36),null)}update(t){let{state:r}=t,n=r.facet(Ml),a=(n.override||r.languageDataAt("autocomplete",bv(r)).map(_Ye)).map(s=>(this.active.find(u=>u.source==s)||new Ol(s,this.active.some(u=>u.state!=0)?1:0)).update(t,n));a.length==this.active.length&&a.every((s,l)=>s==this.active[l])&&(a=this.active);let o=this.open;o&&t.docChanged&&(o=o.map(t.changes)),t.selection||a.some(s=>s.hasResult()&&t.changes.touchesRange(s.from,s.to))||!qYe(a,this.active)?o=yv.build(a,r,this.id,o,n):o&&o.disabled&&!a.some(s=>s.state==1)&&(o=null),!o&&a.every(s=>s.state!=1)&&a.some(s=>s.hasResult())&&(a=a.map(s=>s.hasResult()?new Ol(s.source,0):s));for(let s of t.effects)s.is(tSe)&&(o=o&&o.setSelected(s.value,this.id));return a==this.active&&o==this.open?this:new c2(a,this.id,o)}get tooltip(){return this.open?this.open.tooltip:null}get attrs(){return this.open?this.open.attrs:LYe}};function qYe(e,t){if(e==t)return!0;for(let r=0,n=0;;){for(;r-1&&(r["aria-activedescendant"]=e+"-"+t),r}var zYe=[];function wQ(e){return e.isUserEvent("input.type")?"input":e.isUserEvent("delete.backward")?"delete":null}var Ol=class{constructor(t,r,n=-1){this.source=t,this.state=r,this.explicitPos=n}hasResult(){return!1}update(t,r){let n=wQ(t),i=this;n?i=i.handleUserEvent(t,n,r):t.docChanged?i=i.handleChange(t):t.selection&&i.state!=0&&(i=new Ol(i.source,0));for(let a of t.effects)if(a.is(q5))i=new Ol(i.source,1,a.value?bv(t.state):-1);else if(a.is(zC))i=new Ol(i.source,0);else if(a.is(eSe))for(let o of a.value)o.source==i.source&&(i=o);return i}handleUserEvent(t,r,n){return r=="delete"||!n.activateOnTyping?this.map(t.changes):new Ol(this.source,1)}handleChange(t){return t.changes.touchesRange(bv(t.startState))?new Ol(this.source,0):this.map(t.changes)}map(t){return t.empty||this.explicitPos<0?this:new Ol(this.source,this.state,t.mapPos(this.explicitPos))}},xv=class extends Ol{constructor(t,r,n,i,a){super(t,2,r),this.result=n,this.from=i,this.to=a}hasResult(){return!0}handleUserEvent(t,r,n){var i;let a=this.result;a.map&&!t.changes.empty&&(a=a.map(a,t.changes));let o=t.changes.mapPos(this.from),s=t.changes.mapPos(this.to,1),l=bv(t.state);if((this.explicitPos<0?l<=o:ls||!a||r=="delete"&&bv(t.startState)==this.from)return new Ol(this.source,r=="input"&&n.activateOnTyping?1:0);let u=this.explicitPos<0?-1:t.changes.mapPos(this.explicitPos);return UYe(a.validFor,t.state,o,s)?new xv(this.source,u,a,o,s):a.update&&(a=a.update(a,o,s,new R5(t.state,l,u>=0)))?new xv(this.source,u,a,a.from,(i=a.to)!==null&&i!==void 0?i:bv(t.state)):new Ol(this.source,1,u)}handleChange(t){return t.changes.touchesRange(this.from,this.to)?new Ol(this.source,0):this.map(t.changes)}map(t){return t.empty?this:(this.result.map?this.result.map(this.result,t):this.result)?new xv(this.source,this.explicitPos<0?-1:t.mapPos(this.explicitPos),this.result,t.mapPos(this.from),t.mapPos(this.to,1)):new Ol(this.source,0)}};function UYe(e,t,r,n){if(!e)return!1;let i=t.sliceDoc(r,n);return typeof e=="function"?e(i,r,n,t):Jwe(e,!0).test(i)}var eSe=Xt.StateEffect.define({map(e,t){return e.map(r=>r.map(t))}}),tSe=Xt.StateEffect.define(),Fc=Xt.StateField.define({create(){return c2.start()},update(e,t){return e.update(t)},provide:e=>[bo.showTooltip.from(e,t=>t.tooltip),bo.EditorView.contentAttributes.from(e,t=>t.attrs)]});function EQ(e,t){let r=t.completion.apply||t.completion.label,n=e.state.field(Fc).active.find(i=>i.source==t.source);return n instanceof xv?(typeof r=="string"?e.dispatch(Object.assign(Object.assign({},FYe(e.state,r,n.from,n.to)),{annotations:TYe.of(t.completion)})):r(e,t.completion,n.from,n.to),!0):!1}var WYe=BYe(Fc,EQ);function B5(e,t="option"){return r=>{let n=r.state.field(Fc,!1);if(!n||!n.open||n.open.disabled||Date.now()-n.open.timestamp-1?n.open.selected+i*(e?1:-1):e?0:o-1;return s<0?s=t=="page"?0:o-1:s>=o&&(s=t=="page"?o-1:0),r.dispatch({effects:tSe.of(s)}),!0}}var HYe=e=>{let t=e.state.field(Fc,!1);return e.state.readOnly||!t||!t.open||t.open.selected<0||t.open.disabled||Date.now()-t.open.timestampe.state.field(Fc,!1)?(e.dispatch({effects:q5.of(!0)}),!0):!1,GYe=e=>{let t=e.state.field(Fc,!1);return!t||!t.active.some(r=>r.state!=0)?!1:(e.dispatch({effects:zC.of(null)}),!0)},SQ=class{constructor(t,r){this.active=t,this.context=r,this.time=Date.now(),this.updates=[],this.done=void 0}},QYe=50,YYe=1e3,ZYe=bo.ViewPlugin.fromClass(class{constructor(e){this.view=e,this.debounceUpdate=-1,this.running=[],this.debounceAccept=-1,this.pendingStart=!1,this.composing=0;for(let t of e.state.field(Fc).active)t.state==1&&this.startQuery(t)}update(e){let t=e.state.field(Fc);if(!e.selectionSet&&!e.docChanged&&e.startState.field(Fc)==t)return;let r=e.transactions.some(i=>(i.selection||i.docChanged)&&!wQ(i));for(let i=0;iQYe&&Date.now()-a.time>YYe){for(let o of a.context.abortListeners)try{o()}catch(s){(0,bo.logException)(this.view.state,s)}a.context.abortListeners=null,this.running.splice(i--,1)}else a.updates.push(...e.transactions)}this.debounceUpdate>-1&&clearTimeout(this.debounceUpdate),e.transactions.some(i=>i.effects.some(a=>a.is(q5)))&&(this.pendingStart=!0);let n=this.pendingStart?50:e.state.facet(Ml).activateOnTypingDelay;if(this.debounceUpdate=t.active.some(i=>i.state==1&&!this.running.some(a=>a.active.source==i.source))?setTimeout(()=>this.startUpdate(),n):-1,this.composing!=0)for(let i of e.transactions)wQ(i)=="input"?this.composing=2:this.composing==2&&i.selection&&(this.composing=3)}startUpdate(){this.debounceUpdate=-1,this.pendingStart=!1;let{state:e}=this.view,t=e.field(Fc);for(let r of t.active)r.state==1&&!this.running.some(n=>n.active.source==r.source)&&this.startQuery(r)}startQuery(e){let{state:t}=this.view,r=bv(t),n=new R5(t,r,e.explicitPos==r),i=new SQ(e,n);this.running.push(i),Promise.resolve(e.source(n)).then(a=>{i.context.aborted||(i.done=a||null,this.scheduleAccept())},a=>{this.view.dispatch({effects:zC.of(null)}),(0,bo.logException)(this.view.state,a)})}scheduleAccept(){this.running.every(e=>e.done!==void 0)?this.accept():this.debounceAccept<0&&(this.debounceAccept=setTimeout(()=>this.accept(),this.view.state.facet(Ml).updateSyncTime))}accept(){var e;this.debounceAccept>-1&&clearTimeout(this.debounceAccept),this.debounceAccept=-1;let t=[],r=this.view.state.facet(Ml);for(let n=0;no.source==i.active.source);if(a&&a.state==1)if(i.done==null){let o=new Ol(i.active.source,0);for(let s of i.updates)o=o.update(s,r);o.state!=1&&t.push(o)}else this.startQuery(a)}t.length&&this.view.dispatch({effects:eSe.of(t)})}},{eventHandlers:{blur(e){let t=this.view.state.field(Fc,!1);if(t&&t.tooltip&&this.view.state.facet(Ml).closeOnBlur){let r=t.open&&(0,bo.getTooltip)(this.view,t.open.tooltip);(!r||!r.dom.contains(e.relatedTarget))&&setTimeout(()=>this.view.dispatch({effects:zC.of(null)}),10)}},compositionstart(){this.composing=1},compositionend(){this.composing==3&&setTimeout(()=>this.view.dispatch({effects:q5.of(!1)}),20),this.composing=0}}}),XYe=typeof navigator=="object"&&/Win/.test(navigator.platform),KYe=Xt.Prec.highest(bo.EditorView.domEventHandlers({keydown(e,t){let r=t.state.field(Fc,!1);if(!r||!r.open||r.open.disabled||r.open.selected<0||e.key.length>1||e.ctrlKey&&!(XYe&&e.altKey)||e.metaKey)return!1;let n=r.open.options[r.open.selected],i=r.active.find(o=>o.source==n.source),a=n.completion.commitCharacters||i.result.commitCharacters;return a&&a.indexOf(e.key)>-1&&EQ(t,n),!1}})),JYe=bo.EditorView.baseTheme({".cm-tooltip.cm-tooltip-autocomplete":{"& > ul":{fontFamily:"monospace",whiteSpace:"nowrap",overflow:"hidden auto",maxWidth_fallback:"700px",maxWidth:"min(700px, 95vw)",minWidth:"250px",maxHeight:"10em",height:"100%",listStyle:"none",margin:0,padding:0,"& > li, & > completion-section":{padding:"1px 3px",lineHeight:1.2},"& > li":{overflowX:"hidden",textOverflow:"ellipsis",cursor:"pointer"},"& > completion-section":{display:"list-item",borderBottom:"1px solid silver",paddingLeft:"0.5em",opacity:.7}}},"&light .cm-tooltip-autocomplete ul li[aria-selected]":{background:"#17c",color:"white"},"&light .cm-tooltip-autocomplete-disabled ul li[aria-selected]":{background:"#777"},"&dark .cm-tooltip-autocomplete ul li[aria-selected]":{background:"#347",color:"white"},"&dark .cm-tooltip-autocomplete-disabled ul li[aria-selected]":{background:"#444"},".cm-completionListIncompleteTop:before, .cm-completionListIncompleteBottom:after":{content:'"\xB7\xB7\xB7"',opacity:.5,display:"block",textAlign:"center"},".cm-tooltip.cm-completionInfo":{position:"absolute",padding:"3px 9px",width:"max-content",maxWidth:`${400}px`,boxSizing:"border-box"},".cm-completionInfo.cm-completionInfo-left":{right:"100%"},".cm-completionInfo.cm-completionInfo-right":{left:"100%"},".cm-completionInfo.cm-completionInfo-left-narrow":{right:`${30}px`},".cm-completionInfo.cm-completionInfo-right-narrow":{left:`${30}px`},"&light .cm-snippetField":{backgroundColor:"#00000022"},"&dark .cm-snippetField":{backgroundColor:"#ffffff22"},".cm-snippetFieldPosition":{verticalAlign:"text-top",width:0,height:"1.15em",display:"inline-block",margin:"0 -0.7px -.7em",borderLeft:"1.4px dotted #888"},".cm-completionMatchedText":{textDecoration:"underline"},".cm-completionDetail":{marginLeft:"0.5em",fontStyle:"italic"},".cm-completionIcon":{fontSize:"90%",width:".8em",display:"inline-block",textAlign:"center",paddingRight:".6em",opacity:"0.6",boxSizing:"content-box"},".cm-completionIcon-function, .cm-completionIcon-method":{"&:after":{content:"'\u0192'"}},".cm-completionIcon-class":{"&:after":{content:"'\u25CB'"}},".cm-completionIcon-interface":{"&:after":{content:"'\u25CC'"}},".cm-completionIcon-variable":{"&:after":{content:"'\u{1D465}'"}},".cm-completionIcon-constant":{"&:after":{content:"'\u{1D436}'"}},".cm-completionIcon-type":{"&:after":{content:"'\u{1D461}'"}},".cm-completionIcon-enum":{"&:after":{content:"'\u222A'"}},".cm-completionIcon-property":{"&:after":{content:"'\u25A1'"}},".cm-completionIcon-keyword":{"&:after":{content:"'\u{1F511}\uFE0E'"}},".cm-completionIcon-namespace":{"&:after":{content:"'\u25A2'"}},".cm-completionIcon-text":{"&:after":{content:"'abc'",fontSize:"50%",verticalAlign:"middle"}}});var UC={brackets:["(","[","{","'",'"'],before:")]}:;>",stringPrefixes:[]},Gy=Xt.StateEffect.define({map(e,t){let r=t.mapPos(e,-1,Xt.MapMode.TrackAfter);return r??void 0}}),kQ=new class extends Xt.RangeValue{};kQ.startSide=1;kQ.endSide=-1;var rSe=Xt.StateField.define({create(){return Xt.RangeSet.empty},update(e,t){if(e=e.map(t.changes),t.selection){let r=t.state.doc.lineAt(t.selection.main.head);e=e.update({filter:n=>n>=r.from&&n<=r.to})}for(let r of t.effects)r.is(Gy)&&(e=e.update({add:[kQ.range(r.value,r.value+1)]}));return e}});function nSe(){return[tZe,rSe]}var vQ="()[]{}<>";function iSe(e){for(let t=0;t{if((eZe?e.composing:e.compositionStarted)||e.state.readOnly)return!1;let i=e.state.selection.main;if(n.length>2||n.length==2&&(0,Xt.codePointSize)((0,Xt.codePointAt)(n,0))==1||t!=i.from||r!=i.to)return!1;let a=nZe(e.state,n);return a?(e.dispatch(a),!0):!1}),rZe=({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=aSe(e,e.selection.main.head).brackets||UC.brackets,i=null,a=e.changeByRange(o=>{if(o.empty){let s=iZe(e.doc,o.head);for(let l of n)if(l==s&&L5(e.doc,o.head)==iSe((0,Xt.codePointAt)(l,0)))return{changes:{from:o.head-l.length,to:o.head+l.length},range:Xt.EditorSelection.cursor(o.head-l.length)}}return{range:i=o}});return i||t(e.update(a,{scrollIntoView:!0,userEvent:"delete.backward"})),!i},oSe=[{key:"Backspace",run:rZe}];function nZe(e,t){let r=aSe(e,e.selection.main.head),n=r.brackets||UC.brackets;for(let i of n){let a=iSe((0,Xt.codePointAt)(i,0));if(t==i)return a==i?sZe(e,i,n.indexOf(i+i+i)>-1,r):aZe(e,i,a,r.before||UC.before);if(t==a&&sSe(e,e.selection.main.from))return oZe(e,i,a)}return null}function sSe(e,t){let r=!1;return e.field(rSe).between(0,e.doc.length,n=>{n==t&&(r=!0)}),r}function L5(e,t){let r=e.sliceString(t,t+2);return r.slice(0,(0,Xt.codePointSize)((0,Xt.codePointAt)(r,0)))}function iZe(e,t){let r=e.sliceString(t-2,t);return(0,Xt.codePointSize)((0,Xt.codePointAt)(r,0))==r.length?r:r.slice(1)}function aZe(e,t,r,n){let i=null,a=e.changeByRange(o=>{if(!o.empty)return{changes:[{insert:t,from:o.from},{insert:r,from:o.to}],effects:Gy.of(o.to+t.length),range:Xt.EditorSelection.range(o.anchor+t.length,o.head+t.length)};let s=L5(e.doc,o.head);return!s||/\s/.test(s)||n.indexOf(s)>-1?{changes:{insert:t+r,from:o.head},effects:Gy.of(o.head+t.length),range:Xt.EditorSelection.cursor(o.head+t.length)}:{range:i=o}});return i?null:e.update(a,{scrollIntoView:!0,userEvent:"input.type"})}function oZe(e,t,r){let n=null,i=e.changeByRange(a=>a.empty&&L5(e.doc,a.head)==r?{changes:{from:a.head,to:a.head+r.length,insert:r},range:Xt.EditorSelection.cursor(a.head+r.length)}:n={range:a});return n?null:e.update(i,{scrollIntoView:!0,userEvent:"input.type"})}function sZe(e,t,r,n){let i=n.stringPrefixes||UC.stringPrefixes,a=null,o=e.changeByRange(s=>{if(!s.empty)return{changes:[{insert:t,from:s.from},{insert:t,from:s.to}],effects:Gy.of(s.to+t.length),range:Xt.EditorSelection.range(s.anchor+t.length,s.head+t.length)};let l=s.head,u=L5(e.doc,l),c;if(u==t){if(Xwe(e,l))return{changes:{insert:t+t,from:l},effects:Gy.of(l+t.length),range:Xt.EditorSelection.cursor(l+t.length)};if(sSe(e,l)){let d=r&&e.sliceDoc(l,l+t.length*3)==t+t+t?t+t+t:t;return{changes:{from:l,to:l+d.length,insert:d},range:Xt.EditorSelection.cursor(l+d.length)}}}else{if(r&&e.sliceDoc(l-2*t.length,l)==t+t&&(c=Kwe(e,l-2*t.length,i))>-1&&Xwe(e,c))return{changes:{insert:t+t+t+t,from:l},effects:Gy.of(l+t.length),range:Xt.EditorSelection.cursor(l+t.length)};if(e.charCategorizer(l)(u)!=Xt.CharCategory.Word&&Kwe(e,l,i)>-1&&!lZe(e,l,t,i))return{changes:{insert:t+t,from:l},effects:Gy.of(l+t.length),range:Xt.EditorSelection.cursor(l+t.length)}}return{range:a=s}});return a?null:e.update(o,{scrollIntoView:!0,userEvent:"input.type"})}function Xwe(e,t){let r=Zs(e).resolveInner(t+1);return r.parent&&r.from==t}function lZe(e,t,r,n){let i=Zs(e).resolveInner(t,-1),a=n.reduce((o,s)=>Math.max(o,s.length),0);for(let o=0;o<5;o++){let s=e.sliceDoc(i.from,Math.min(i.to,i.from+r.length+a)),l=s.indexOf(r);if(!l||l>-1&&n.indexOf(s.slice(0,l))>-1){let c=i.firstChild;for(;c&&c.from==i.from&&c.to-c.from>r.length+l;){if(e.sliceDoc(c.to-r.length,c.to)==r)return!1;c=c.firstChild}return!0}let u=i.to==t&&i.parent;if(!u)break;i=u}return!1}function Kwe(e,t,r){let n=e.charCategorizer(t);if(n(e.sliceDoc(t-1,t))!=Xt.CharCategory.Word)return t;for(let i of r){let a=t-i.length;if(e.sliceDoc(a,t)==i&&n(e.sliceDoc(a-1,a))!=Xt.CharCategory.Word)return a}return-1}function lSe(e={}){return[KYe,Fc,Ml.of(e),ZYe,uZe,JYe]}var CQ=[{key:"Ctrl-Space",run:VYe},{key:"Escape",run:GYe},{key:"ArrowDown",run:B5(!0)},{key:"ArrowUp",run:B5(!1)},{key:"PageDown",run:B5(!0,"page")},{key:"PageUp",run:B5(!1,"page")},{key:"Enter",run:HYe}],uZe=Xt.Prec.highest(bo.keymap.computeN([Ml],e=>e.facet(Ml).defaultKeymap?[CQ]:[]));var cSe=require("@codemirror/lint"),U5=function(t){t===void 0&&(t={});var{crosshairCursor:r=!1}=t,n=[];t.closeBracketsKeymap!==!1&&(n=n.concat(oSe)),t.defaultKeymap!==!1&&(n=n.concat(eg.defaultKeymap)),t.searchKeymap!==!1&&(n=n.concat(z5.searchKeymap)),t.historyKeymap!==!1&&(n=n.concat(eg.historyKeymap)),t.foldKeymap!==!1&&(n=n.concat(Nwe)),t.completionKeymap!==!1&&(n=n.concat(CQ)),t.lintKeymap!==!1&&(n=n.concat(cSe.lintKeymap));var i=[];return t.lineNumbers!==!1&&i.push((0,Po.lineNumbers)()),t.highlightActiveLineGutter!==!1&&i.push((0,Po.highlightActiveLineGutter)()),t.highlightSpecialChars!==!1&&i.push((0,Po.highlightSpecialChars)()),t.history!==!1&&i.push((0,eg.history)()),t.foldGutter!==!1&&i.push(_we()),t.drawSelection!==!1&&i.push((0,Po.drawSelection)()),t.dropCursor!==!1&&i.push((0,Po.dropCursor)()),t.allowMultipleSelections!==!1&&i.push(uSe.EditorState.allowMultipleSelections.of(!0)),t.indentOnInput!==!1&&i.push(Cwe()),t.syntaxHighlighting!==!1&&i.push(JA(pQ,{fallback:!0})),t.bracketMatching!==!1&&i.push($we()),t.closeBrackets!==!1&&i.push(nSe()),t.autocompletion!==!1&&i.push(lSe()),t.rectangularSelection!==!1&&i.push((0,Po.rectangularSelection)()),r!==!1&&i.push((0,Po.crosshairCursor)()),t.highlightActiveLine!==!1&&i.push((0,Po.highlightActiveLine)()),t.highlightSelectionMatches!==!1&&i.push((0,z5.highlightSelectionMatches)()),t.tabSize&&typeof t.tabSize=="number"&&i.push($C.of(" ".repeat(t.tabSize))),i.concat([Po.keymap.of(n.flat())]).filter(Boolean)},cZe=function(t){t===void 0&&(t={});var r=[];t.defaultKeymap!==!1&&(r=r.concat(eg.defaultKeymap)),t.historyKeymap!==!1&&(r=r.concat(eg.historyKeymap));var n=[];return t.highlightSpecialChars!==!1&&n.push((0,Po.highlightSpecialChars)()),t.history!==!1&&n.push((0,eg.history)()),t.drawSelection!==!1&&n.push((0,Po.drawSelection)()),t.syntaxHighlighting!==!1&&n.push(JA(pQ,{fallback:!0})),n.concat([Po.keymap.of(r.flat())]).filter(Boolean)};var f2=require("@codemirror/view");var fSe=require("@codemirror/view");var dSe="#e5c07b",DQ="#e06c75",pSe="#56b6c2",mSe="#ffffff",WC="#abb2bf",H5="#7d8799",hSe="#61afef",ASe="#98c379",OQ="#d19a66",gSe="#c678dd",vSe="#21252b",MQ="#2c313a",jQ="#282c34",W5="#353a42",ySe="#3E4451",NQ="#528bff",fZe={chalky:dSe,coral:DQ,cyan:pSe,invalid:mSe,ivory:WC,stone:H5,malibu:hSe,sage:ASe,whiskey:OQ,violet:gSe,darkBackground:vSe,highlightBackground:MQ,background:jQ,tooltipBackground:W5,selection:ySe,cursor:NQ},bSe=fSe.EditorView.theme({"&":{color:WC,backgroundColor:jQ},".cm-content":{caretColor:NQ},".cm-cursor, .cm-dropCursor":{borderLeftColor:NQ},"&.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection":{backgroundColor:ySe},".cm-panels":{backgroundColor:vSe,color:WC},".cm-panels.cm-panels-top":{borderBottom:"2px solid black"},".cm-panels.cm-panels-bottom":{borderTop:"2px solid black"},".cm-searchMatch":{backgroundColor:"#72a1ff59",outline:"1px solid #457dff"},".cm-searchMatch.cm-searchMatch-selected":{backgroundColor:"#6199ff2f"},".cm-activeLine":{backgroundColor:"#6699ff0b"},".cm-selectionMatch":{backgroundColor:"#aafe661a"},"&.cm-focused .cm-matchingBracket, &.cm-focused .cm-nonmatchingBracket":{backgroundColor:"#bad0f847"},".cm-gutters":{backgroundColor:jQ,color:H5,border:"none"},".cm-activeLineGutter":{backgroundColor:MQ},".cm-foldPlaceholder":{backgroundColor:"transparent",border:"none",color:"#ddd"},".cm-tooltip":{border:"none",backgroundColor:W5},".cm-tooltip .cm-tooltip-arrow:before":{borderTopColor:"transparent",borderBottomColor:"transparent"},".cm-tooltip .cm-tooltip-arrow:after":{borderTopColor:W5,borderBottomColor:W5},".cm-tooltip-autocomplete":{"& > ul > li[aria-selected]":{backgroundColor:MQ,color:WC}}},{dark:!0}),xSe=Wd.define([{tag:qe.keyword,color:gSe},{tag:[qe.name,qe.deleted,qe.character,qe.propertyName,qe.macroName],color:DQ},{tag:[qe.function(qe.variableName),qe.labelName],color:hSe},{tag:[qe.color,qe.constant(qe.name),qe.standard(qe.name)],color:OQ},{tag:[qe.definition(qe.name),qe.separator],color:WC},{tag:[qe.typeName,qe.className,qe.number,qe.changed,qe.annotation,qe.modifier,qe.self,qe.namespace],color:dSe},{tag:[qe.operator,qe.operatorKeyword,qe.url,qe.escape,qe.regexp,qe.link,qe.special(qe.string)],color:pSe},{tag:[qe.meta,qe.comment],color:H5},{tag:qe.strong,fontWeight:"bold"},{tag:qe.emphasis,fontStyle:"italic"},{tag:qe.strikethrough,textDecoration:"line-through"},{tag:qe.link,color:H5,textDecoration:"underline"},{tag:qe.heading,fontWeight:"bold",color:DQ},{tag:[qe.atom,qe.bool,qe.special(qe.variableName)],color:OQ},{tag:[qe.processingInstruction,qe.string,qe.inserted],color:ASe},{tag:qe.invalid,color:mSe}]),TQ=[bSe,JA(xSe)];var ESe=require("@codemirror/state");var wSe=require("@codemirror/view"),FQ=wSe.EditorView.theme({"&":{backgroundColor:"#fff"}},{dark:!1});var _Q=function(t){t===void 0&&(t={});var{indentWithTab:r=!0,editable:n=!0,readOnly:i=!1,theme:a="light",placeholder:o="",basicSetup:s=!0}=t,l=[];switch(r&&l.unshift(f2.keymap.of([SSe.indentWithTab])),s&&(typeof s=="boolean"?l.unshift(U5()):l.unshift(U5(s))),o&&l.unshift((0,f2.placeholder)(o)),a){case"light":l.push(FQ);break;case"dark":l.push(TQ);break;case"none":break;default:l.push(a);break}return n===!1&&l.push(f2.EditorView.editable.of(!1)),i&&l.push(ESe.EditorState.readOnly.of(!0)),[...l]};var PQ=e=>({line:e.state.doc.lineAt(e.state.selection.main.from),lineCount:e.state.doc.lines,lineBreak:e.state.lineBreak,length:e.state.doc.length,readOnly:e.state.readOnly,tabSize:e.state.tabSize,selection:e.state.selection,selectionAsSingle:e.state.selection.asSingle().main,ranges:e.state.selection.ranges,selectionCode:e.state.sliceDoc(e.state.selection.main.from,e.state.selection.main.to),selections:e.state.selection.ranges.map(t=>e.state.sliceDoc(t.from,t.to)),selectedText:e.state.selection.ranges.some(t=>!t.empty)});var kSe=Qy.Annotation.define(),dZe=[];function IQ(e){var{value:t,selection:r,onChange:n,onStatistics:i,onCreateEditor:a,onUpdate:o,extensions:s=dZe,autoFocus:l,theme:u="light",height:c=null,minHeight:f=null,maxHeight:d=null,width:p=null,minWidth:h=null,maxWidth:m=null,placeholder:g="",editable:A=!0,readOnly:b=!1,indentWithTab:v=!0,basicSetup:x=!0,root:w,initialState:S}=e,[k,j]=(0,Yp.useState)(),[O,C]=(0,Yp.useState)(),[N,D]=(0,Yp.useState)(),P=HC.EditorView.theme({"&":{height:c,minHeight:f,maxHeight:d,width:p,minWidth:h,maxWidth:m},"& .cm-scroller":{height:"100% !important"}}),q=HC.EditorView.updateListener.of(T=>{if(T.docChanged&&typeof n=="function"&&!T.transactions.some(Y=>Y.annotation(kSe))){var L=T.state.doc,_=L.toString();n(_,T)}i&&i(PQ(T))}),z=_Q({theme:u,editable:A,readOnly:b,placeholder:g,indentWithTab:v,basicSetup:x}),I=[q,P,...z];return o&&typeof o=="function"&&I.push(HC.EditorView.updateListener.of(o)),I=I.concat(s),(0,Yp.useEffect)(()=>{if(k&&!N){var T={doc:t,selection:r,extensions:I},L=S?Qy.EditorState.fromJSON(S.json,T,S.fields):Qy.EditorState.create(T);if(D(L),!O){var _=new HC.EditorView({state:L,parent:k,root:w});C(_),a&&a(_,L)}}return()=>{O&&(D(void 0),C(void 0))}},[k,N]),(0,Yp.useEffect)(()=>j(e.container),[e.container]),(0,Yp.useEffect)(()=>()=>{O&&(O.destroy(),C(void 0))},[O]),(0,Yp.useEffect)(()=>{l&&O&&O.focus()},[l,O]),(0,Yp.useEffect)(()=>{O&&O.dispatch({effects:Qy.StateEffect.reconfigure.of(I)})},[u,s,c,f,d,p,h,m,g,A,b,v,x,n,o]),(0,Yp.useEffect)(()=>{if(t!==void 0){var T=O?O.state.doc.toString():"";O&&t!==T&&O.dispatch({changes:{from:0,to:T.length,insert:t||""},annotations:[kSe.of(!0)]})}},[t,O]),{state:N,setState:D,view:O,setView:C,container:k,setContainer:j}}var CSe=Ae(XA());li(En,require("@codemirror/view"));li(En,require("@codemirror/state"));var pZe=["className","value","selection","extensions","onChange","onStatistics","onCreateEditor","onUpdate","autoFocus","theme","height","minHeight","maxHeight","width","minWidth","maxWidth","basicSetup","placeholder","indentWithTab","editable","readOnly","root","initialState"],DSe=(0,d2.forwardRef)((e,t)=>{var{className:r,value:n="",selection:i,extensions:a=[],onChange:o,onStatistics:s,onCreateEditor:l,onUpdate:u,autoFocus:c,theme:f="light",height:d,minHeight:p,maxHeight:h,width:m,minWidth:g,maxWidth:A,basicSetup:b,placeholder:v,indentWithTab:x,editable:w,readOnly:S,root:k,initialState:j}=e,O=LC(e,pZe),C=(0,d2.useRef)(null),{state:N,view:D,container:P}=IQ({container:C.current,root:k,value:n,autoFocus:c,theme:f,height:d,minHeight:p,maxHeight:h,width:m,minWidth:g,maxWidth:A,basicSetup:b,placeholder:v,indentWithTab:x,editable:w,readOnly:S,selection:i,onChange:o,onStatistics:s,onCreateEditor:l,onUpdate:u,extensions:a,initialState:j});if((0,d2.useImperativeHandle)(t,()=>({editor:C.current,state:N,view:D}),[C,P,N,D]),typeof n!="string")throw new Error("value must be typeof string but got "+typeof n);var q=typeof f=="string"?"cm-theme-"+f:"cm-theme";return(0,CSe.jsx)("div",Fn({ref:C,className:""+q+(r?" "+r:"")},O))});DSe.displayName="CodeMirror";var VC=DSe;var GC={functions:["abs","acos","acosh","acot","acoth","acsc","acsch","add","and","apply","arg","asec","asech","asin","asinh","atan","atan2","atanh","bellNumbers","bin","bitAnd","bitNot","bitOr","bitXor","catalan","cbrt","ceil","clone","column","combinations","combinationsWithRep","compare","compareNatural","compareText","compile","composition","concat","conj","cos","cosh","cot","coth","count","cross","csc","csch","ctranspose","cube","cumsum","deepEqual","det","diag","diff","distance","divide","dot","dotDivide","dotMultiply","dotPow","eigs","equal","equalText","erf","evaluate","exp","expm","expm1","factorial","fft","filter","fix","flatten","floor","forEach","format","gamma","gcd","getMatrixDataType","hasNumericValue","help","hex","hypot","identity","ifft","im","intersect","inv","invmod","isInteger","isNaN","isNegative","isNumeric","isPositive","isPrime","isZero","kldivergence","kron","larger","largerEq","lcm","leftShift","lgamma","log","log10","log1p","log2","lsolve","lsolveAll","lup","lusolve","lyap","mad","map","matrixFromColumns","matrixFromFunction","matrixFromRows","max","mean","median","min","mod","mode","multinomial","multiply","norm","not","nthRoot","nthRoots","numeric","oct","ones","or","parser","partitionSelect","permutations","pickRandom","pinv","pow","print","prod","qr","quantileSeq","random","randomInt","range","re","reshape","resize","rightArithShift","rightLogShift","rotate","rotationMatrix","round","row","schur","sec","sech","setCartesian","setDifference","setDistinct","setIntersect","setIsSubset","setMultiplicity","setPowerset","setSize","setSymDifference","setUnion","sign","sin","sinh","size","slu","smaller","smallerEq","sort","sqrt","sqrtm","square","squeeze","std","stirlingS2","subset","subtract","sum","sylvester","tan","tanh","to","trace","transpose","typeOf","unaryMinus","unaryPlus","unequal","usolve","usolveAll","variance","xgcd","xor","zeros","date","epoch","charToHex","hexToChar"],constants:["speedOfLight","gravitationConstant","planckConstant","reducedPlanckConstant","magneticConstant","electricConstant","vacuumImpedance","coulomb","elementaryCharge","bohrMagneton","conductanceQuantum","inverseConductanceQuantum","magneticFluxQuantum","nuclearMagneton","klitzing","bohrRadius","classicalElectronRadius","electronMass","fermiCoupling","fineStructure","hartreeEnergy","protonMass","deuteronMass","neutronMass","quantumOfCirculation","rydberg","thomsonCrossSection","weakMixingAngle","efimovFactor","atomicMass","avogadro","boltzmann","faraday","firstRadiation","loschmidt","gasConstant","molarPlanckConstant","molarVolume","sackurTetrode","secondRadiation","stefanBoltzmann","wienDisplacement","molarMass","molarMassC12","gravity","atm","planckLength","planckMass","planckTime","planckCharge","planckTemperature","e","E","i","Infinity","LN2","LN10","LOG2E","LOG10E","NaN","null","phi","pi","PI","SQRT1_2","SQRT2","tau","undefined","version","true","false"],currency:["AED","AFN","ALL","AMD","ANG","AOA","ARS","AUD","AWG","AZN","BAM","BBD","BDT","BGN","BHD","BIF","BMD","BND","BOB","BRL","BSD","BTC","BTN","BWP","BYN","BZD","CAD","CDF","CHF","CLF","CLP","CNH","CNY","COP","CRC","CUC","CUP","CVE","CZK","DJF","DKK","DOP","DZD","EGP","ERN","ETB","EUR","FJD","FKP","GBP","GEL","GGP","GHS","GIP","GMD","GNF","GTQ","GYD","HKD","HNL","HRK","HTG","HUF","IDR","ILS","IMP","INR","IQD","IRR","ISK","JEP","JMD","JOD","JPY","KES","KGS","KHR","KMF","KPW","KRW","KWD","KYD","KZT","LAK","LBP","LKR","LRD","LSL","LYD","MAD","MDL","MGA","MKD","MMK","MNT","MOP","MRU","MUR","MVR","MWK","MXN","MYR","MZN","NAD","NGN","NIO","NOK","NPR","NZD","OMR","PAB","PEN","PGK","PHP","PKR","PLN","PYG","QAR","RON","RSD","RUB","RWF","SAR","SBD","SCR","SDG","SEK","SGD","SHP","SLL","SOS","SRD","SSP","STD","STN","SVC","SYP","SZL","THB","TJS","TMT","TND","TOP","TRY","TTD","TWD","TZS","UAH","UGX","USD","UYU","UZS","VES","VND","VUV","WST","XAF","XAG","XAU","XCD","XDR","XOF","XPD","XPF","XPT","YER","ZAR","ZMW","ZWL"]},BQ=(()=>{let e=[],t="px|pixel|pixels|pt|point|points|em|oF|oC|f|c|mph|kph".split("|");return[...e,...t,...GC.currency,...GC.currency.map(r=>r.toLowerCase())]})(),RQ="today|tomorrow|now|time|yesterday|sum|total|average|avg".split("|"),$Q="in|to|last|off|of|mod|xor|or|ago".split("|"),mZe=[...BQ,...RQ,...GC.functions,...$Q,...Object.keys(fC)],EJt=mZe.sort((e,t)=>e.length-t.length).filter(e=>e.length>0),OSe=GC.functions,MSe=GC.constants;function QC(e){let t={};for(let r=0;r/:^%!]/;function bZe(e,t){let r=e.next();if(r=="#"||r=="/"&&e.eat("/"))return e.skipToEnd(),"comment";if(r=='"'||r=="'")return t.tokenize=xZe(r),t.tokenize(e,t);if(/[$£€¥₽¥]/.test(r))return"variableName.special";if(/[[\](),]/.test(r))return null;if(/[\d.]/.test(r))return e.eatWhile(/^(\d+((,\d{3})+)?)?(\.(\d+)?)?(e[+-]?\d+)?(M |k )?$/),"number";if(jSe.test(r))return e.eatWhile(jSe),"operator";e.eatWhile(/[\w_]/);let n=e.current();return Object.hasOwn(hZe,n)?"operatorKeyword":Object.hasOwn(AZe,n)||Object.hasOwn(yZe,n)?"variableName.standard":Object.hasOwn(vZe,n)?"variableName.special":Object.hasOwn(gZe,n)?"function":e.peek()==="("?"variableName.definition":"variable"}function xZe(e){return function(t,r){let n=!1,i,a=!1;for(;(i=t.next())!=null;){if(i==e&&!n){a=!0;break}n=!n&&i=="\\"}return(a||!n)&&(r.tokenize=null),"string"}}var NSe={name:"mkformula",startState:function(){return{tokenize:null}},token:function(e,t){if(e.eatSpace())return null;let r=(t.tokenize||bZe)(e,t);return r=="comment"||r=="meta",r},languageData:{autocomplete:Object.keys(dC),closeBrackets:{brackets:["(","[","{","'",'"',"`"]},commentTokens:{line:"#"}}};var cn=Ae(Te());var LSe=Ae(yi());var Vu=Ae(Te());var TSe=(e,t)=>{let r=e?sr(e):[],n=t?sr(t):[];return n.every(i=>r.some(a=>a==i))&&r.every(i=>n.some(a=>a==i))},p2=(e,t)=>e==t,wv=(e,t)=>(e??"").length==0,qQ=(e,t)=>(e??"").toLowerCase().includes((t??"").toLowerCase()),LQ=(e,t)=>parseFloat(e)>parseFloat(t),zQ=(e,t)=>parseInt(e){let r=isNaN(Date.parse(e))?new Date(parseInt(e)):new Date(e),n=isNaN(Date.parse(t))?new Date(parseInt(t)):new Date(t);return r.valueOf()>=n.valueOf()},_Se=(e,t)=>{let r=isNaN(Date.parse(e))?new Date(parseInt(e)):new Date(e),n=isNaN(Date.parse(t))?new Date(parseInt(t)):new Date(t);return r.valueOf(){let r=e?sr(e):[],n=t?sr(t):[];return r.length==0?!1:n.some(i=>r.some(a=>a==i))},PSe=(e,t)=>{if(!e)return!1;let r=new Date(`${e.toString().replace(".",":")}`),n=new Date(`${t}`);return r.getMonth()===n.getMonth()&&r.getDate()===n.getDate()},ISe=e=>{if(!e)return!1;let t=new Date(`${e.toString()}T00:00`),r=new Date;return t.getMonth()===r.getMonth()&&t.getDate()===r.getDate()},BSe=(e,t,r,n)=>{if(!e)return!0;let i=qi[t?.fn],a=!0;if(i&&i.fn){let o=t.fType=="property"?n[t.value]:t.value;a=i.fn(r[t.field],o)}return a};var qi={isNotEmpty:{type:["text","file","number","option","option-multi","link","link-multi","image"],fn:(e,t)=>!wv(e,""),valueType:"none"},isEmpty:{type:["text","file","number","option","option-multi","link","link-multi","image"],fn:(e,t)=>wv(e,""),valueType:"none"},include:{fn:(e,t)=>qQ(e,t),type:["text","file","link","image"],valueType:"text"},notInclude:{type:["text","file","link","image"],fn:(e,t)=>!qQ(e,t),valueType:"text"},is:{type:["text"],fn:(e,t)=>p2(e,t),valueType:"text"},isNot:{type:["text"],fn:(e,t)=>!p2(e,t),valueType:"text"},equal:{type:["number"],fn:(e,t)=>p2(e,t),valueType:"number"},isLink:{type:["link","context"],fn:(e,t)=>p2(e,t),valueType:"link"},isNotLink:{type:["link","context"],fn:(e,t)=>!p2(e,t),valueType:"link"},isGreatThan:{type:["number"],fn:(e,t)=>LQ(e,t),valueType:"number"},isLessThan:{type:["number"],fn:(e,t)=>zQ(e,t),valueType:"number"},isLessThanOrEqual:{type:["number"],fn:(e,t)=>!LQ(e,t),valueType:"number"},isGreatThanOrEqual:{type:["number"],fn:(e,t)=>!zQ(e,t),valueType:"number"},dateBefore:{type:["date"],fn:(e,t)=>_Se(e,t),valueType:"date"},dateAfter:{type:["date"],fn:(e,t)=>FSe(e,t),valueType:"date"},isSameDate:{type:["date"],fn:(e,t)=>PSe(e,t),valueType:"date"},isSameDateAsToday:{type:["date"],fn:(e,t)=>ISe(e,t),valueType:"none"},isExactList:{type:["option","option-multi","link-multi","context-multi","tags-multi"],fn:(e,t)=>TSe(e,t),valueType:"list"},isAnyInList:{type:["option","context","link","option-multi","link-multi","context-multi","tags-multi"],fn:(e,t)=>UQ(e,t),valueType:"list"},isNoneInList:{type:["option","context","link","option-multi","link-multi","context-multi","tags-multi"],fn:(e,t)=>!UQ(e,t),valueType:"list"},isTrue:{type:["boolean"],fn:(e,t)=>e=="true",valueType:"none"},isFalse:{type:["boolean"],fn:(e,t)=>e!="true",valueType:"none"}};var wZe=(e,t)=>t.reduce((r,n)=>r==!0?!0:e?RSe(e,n):!1,!1),RSe=(e,t)=>{let r=qi[t.fn],n=!0;return r&&(n=r.fn(Ri(t.field,e[t.field]),t.value)),n},SZe=(e,t)=>t.reduce((r,n)=>r==!1?!1:e?RSe(e,n):!1,!0),$Se=(e,t)=>e.reduce((n,i)=>!n||i.filters.length==0?!1:i.type=="any"?wZe(t,i.filters):SZe(t,i.filters),!0);var qSe=Ae(yi());var HQ=e=>or(e),V5=async(e,t,r)=>{let n=HQ(t);return WQ(e,n,r)},WQ=async(e,t,r)=>{if(r.iterations>e.settings.actionMaxSteps){alert("Max steps reached, you can change this in settings.");return}let n={...r,iterations:r.iterations+1,props:{...t?.props??{},...Object.keys(t.linked??{}).reduce((l,u)=>({...l,[u]:r.instanceProps[t.linked[u]]}),{}),...t.result?{[t.result]:r.result}:{}}},i=e.cli.commandForAction(t.action);if(i.schema.type=="builtin"){if(i.schema.id=="loop"&&(0,qSe.isArray)(r.result))return await Promise.all(r.result.map(u=>Promise.all(t.children.map(c=>WQ(e,c,o))).then(c=>c[c.length-1])));if(i.schema.id=="filter"&&!$Se(t.props.$function,n.instanceProps))return}let a;try{if(i.schema.type=="api"){let[l,u]=i.schema.id.split(".");a=await e.api[l]?.[u]?.(...i.fields.map(c=>n.props[c.name]))}else a=await e.cli.runCommand(t.action,n)}catch(l){console.error(l)}let o={...n,result:a};if(t.children?.length===0)return a;let s=await Promise.all(t.children.map(l=>WQ(e,l,o)));return s[s.length-1]};var G5=e=>{let t=e.superstate.pathsIndex.get(e.path),[r,n]=(0,Vu.useState)({}),[i,a]=(0,Vu.useState)(),[o,s]=(0,Vu.useState)();(0,Vu.useEffect)(()=>{e.autoTest&&(0,LSe.debounce)(()=>l(),500,{leading:!0,trailing:!0})()},[e.code,e.autoTest]);let l=async()=>{let u=Object.keys(r).reduce((d,p)=>{let h=e.fields.find(g=>g.name==p);return wq(h.type,r[p])?.length>0?{...d,[p]:wq(h.type,r[p])}:d},{...e.value,$api:e.superstate.api,$contexts:{$space:{path:t},$context:{}},$properties:e.fields}),c,f;try{e.type=="actions"&&(c=await V5(e.superstate,e.code,{props:{},instanceProps:u,iterations:0})),e.type=="script"&&(c=await ZS(e.code,u)),e.type=="formula"&&(c=await Pd(e.superstate.formulaContext,e.superstate.pathsIndex,e.superstate.spacesMap,e.code,e.fields.reduce((d,p)=>({...d,[p.name]:p}),{}),u,t,!0))}catch(d){c="",f=d?.message}a(c),s(f)};return Vu.default.createElement("div",{className:"mk-editor-tester"},o?.length>0?Vu.default.createElement(Vu.default.Fragment,null,"Error:"," ",Vu.default.createElement("span",{style:{color:"var(--mk-ui-text-error)"}},o)):Vu.default.createElement(Vu.default.Fragment,null,"Result:"," ",Vu.default.createElement("span",{style:{color:"var(--mk-ui-text-primary"}},String(i))),!e.autoTest&&Vu.default.createElement("button",{onClick:()=>l()},H.buttons.run))};var Ah=e=>{let[t,r]=(0,cn.useState)(e.formula),[n,i]=(0,cn.useState)(null),[a,o]=(0,cn.useState)(""),[s,l]=(0,cn.useState)({func:null,arg:0}),u=Object.values(fC),c=b=>{if(!b)return[];let v=[];if(b.func){if(b.func.args.length==1){let x=b.func.args[0]?.types??[];e.fields.filter(w=>x.includes(ho(w))).forEach(w=>{v.push({name:w.name,type:"rollup",value:`${b.func.name}(prop'${w.name}')`})})}}else if(b.prop){let x=ho(b.prop);x.includes("multi")?u.filter(w=>w.name!="prop"&&w.args.length==1&&w.args[0].types.some(S=>S==x||S=="any-multi")).forEach(w=>{v.push({name:w.name,type:"rollup",value:`${w.name}(prop('${b.prop.name}'))`})}):u.filter(w=>w.name!="prop"&&w.args.length==1&&w.args[0].types.includes(x)).forEach(w=>{v.push({name:w.name,type:"rollup",value:`${w.name}(prop('${b.prop.name}'))`})})}else return v;return v},f=b=>{let v=b.view,x=v.state.wordAt(v.state.selection.main.head),w=x?v.state.sliceDoc(x.from,x.to):"";o(w)},d=b=>{r(b)},p=()=>{e.saveFormula(t),e.hide()};(0,cn.useEffect)(()=>{if(d(e.formula),!h.current?.view)return;h.current.view.focus()},[e.formula]);let h=(0,cn.useRef)(null),m=(b,v)=>{let x=h.current.view,w=x.state.selection.main.to,S=x.state.wordAt(w);S?x.dispatch({changes:{from:S.from,to:S.to,insert:b},selection:{anchor:S.from+b.length-v}}):x.dispatch({changes:{from:w,to:w,insert:b},selection:{anchor:w+b.length-v}}),x.focus()},g=e.fields.filter(b=>b.name.toLowerCase().includes(a.toLowerCase())),A=u.filter(b=>b.name.toLowerCase().includes(a.toLowerCase()));return cn.default.createElement("div",{className:"mk-formula"},cn.default.createElement("div",{className:"mk-formula-header"},cn.default.createElement(VC,{ref:h,autoFocus:!0,value:t,height:"auto",theme:AQ({settings:{background:"var(--mk-ui-background)"}}),basicSetup:{syntaxHighlighting:!0,history:!0,closeBrackets:!0,autocompletion:!1,defaultKeymap:!0,lineNumbers:!1,foldGutter:!1,highlightActiveLine:!1},extensions:[En.EditorView.lineWrapping,u2.define(NSe)],onUpdate:f,onChange:d}),cn.default.createElement("button",{"aria-label":"Save Formula",onClick:()=>p()},"Done")),cn.default.createElement("div",{className:"mk-formula-helper"},cn.default.createElement("div",{className:"mk-formula-list"},g.length>0&&cn.default.createElement("div",{className:"mk-formula-list-section"},"Properties"),g.map((b,v)=>cn.default.createElement("div",{key:v,className:"mk-formula-list-item",onMouseOver:()=>{i({func:null,prop:b})},onClick:()=>{m(`prop('${b.name}')`,0)}},b.name)),A.length>0&&cn.default.createElement("div",{className:"mk-formula-list-section"},"Functions"),A.map((b,v)=>cn.default.createElement("div",{key:v,className:"mk-formula-list-item",onMouseOver:()=>{i({func:fC[b.name],prop:null})},onClick:()=>{m(`${b.name}()`,1)}},b.name))),cn.default.createElement("div",{className:"mk-formula-suggester"},n&&(n.func?cn.default.createElement(cn.default.Fragment,null,cn.default.createElement("div",{className:"mk-formula-suggester-name"},n.func.name,"(",cn.default.createElement("div",{className:"mk-formula-suggester-args"},n.func.args.map((b,v)=>cn.default.createElement("span",{"aria-label":b.types.join(", "),key:v,className:"mk-formula-suggester-arg"},b.name,v0&&cn.default.createElement("div",{className:"mk-formula-suggester-title"},"Suggestions"),c(n).map((b,v)=>cn.default.createElement("div",{key:v,className:"mk-formula-suggestion"},cn.default.createElement("pre",null,b.value),cn.default.createElement("span",null),cn.default.createElement("button",{className:"mk-toolbar-button","aria-label":"Replace",onClick:()=>d(b.value),dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//replace")}}),cn.default.createElement("button",{className:"mk-toolbar-button","aria-label":"Insert",onClick:()=>m(b.value,0),dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//plus")}}))))),cn.default.createElement(G5,{type:"formula",code:t,autoTest:!0,fields:e.fields,value:e.value,superstate:e.superstate,path:e.path}))};var Q5=(e,t,r,n)=>{let i=_c[r];if(!i)return null;let a=ho(n),o="";try{a=="number"&&(t=t.map(l=>parseFloat(l))),a=="date"&&(t=t.map(l=>new Date(l)));let s=i.fn(t,n.type);if(i.valueType=="date"){let l=or(n.value)?.format;o=_r(e,Yi(s),l)}else o=s??""}catch(s){console.error(s)}return o},_c={values:{label:"Values",type:["any"],fn:e=>kr(e.map(t=>Ri("",t))).join(", "),valueType:"none"},sum:{label:"Sum",type:["number"],fn:e=>e.filter(t=>!isNaN(t)).reduce((t,r)=>r?t+r:t,0),valueType:"number"},avg:{label:"Average",type:["number"],fn:e=>{let t=e.filter(r=>!isNaN(r));return t.reduce((r,n)=>r+n,0)/t.length},valueType:"number"},median:{label:"Median",type:["number"],fn:e=>{let t=e.filter(r=>!isNaN(r));return cC(t)},valueType:"number"},count:{label:"Count",type:["any"],fn:e=>e.length,valueType:"number"},countValues:{label:"Count Values",shortLabel:"Values",type:["any"],fn:e=>e.flat().length,valueType:"number"},countUniques:{label:"Count Uniques",shortLabel:"Uniques",type:["any"],fn:e=>new Set(e.flat()).size,valueType:"number"},percentageEmpty:{label:"Percentage Empty",shortLabel:"Empty",type:["any"],fn:e=>e.filter(t=>wv(t,"")).length/e.length*100+"%",valueType:"string"},percentageNotEmpty:{label:"Percentage Not Empty",shortLabel:"Not Empty",type:["any"],fn:e=>e.filter(t=>!wv(t,"")).length/e.length*100+"%",valueType:"string"},min:{label:"Min",type:["number"],fn:e=>Math.min(...e.filter(t=>!isNaN(t))),valueType:"number"},max:{label:"Max",type:["number"],fn:(e,t)=>Math.max(...e.filter(r=>!isNaN(r))),valueType:"number"},range:{label:"Range",type:["number"],fn:e=>Math.max(...e.filter(t=>!isNaN(t)))-Math.min(...e.filter(t=>!isNaN(t))),valueType:"number"},empty:{label:"Empty",type:["any"],fn:e=>e.filter(t=>wv(t,"")).length,valueType:"none"},notEmpty:{label:"Not Empty",type:["any"],fn:e=>e.filter(t=>!wv(t,"")).length,valueType:"none"},earliest:{label:"Earliest",type:["date"],fn:e=>new Date(Math.min(...e.map(t=>t.getTime()))),valueType:"date"},latest:{label:"Latest",type:["date"],fn:e=>new Date(Math.max(...e.map(t=>t.getTime()))),valueType:"date"},dateRange:{label:"Date Range",shortLabel:"Range",type:["date"],fn:e=>{let t=e.map(r=>r.getTime());return Math.max(...t)-Math.min(...t)},valueType:"duration"}};var Dr=Ae(Te());var jf=Ae(Te());var zSe=(e,t,r,n,i,a)=>{e.ui.openModal(t,jf.default.createElement(Ki,{value:r,saveValue:n,saveLabel:i}),a)},Ki=e=>{let[t,r]=(0,jf.useState)(e.value),n=()=>{e.saveValue(t),e.hide&&e.hide()},i=(0,jf.useRef)(null);return(0,jf.useEffect)(()=>{i?.current&&i.current.focus()},[i]),jf.default.createElement("div",{className:"mk-layout-column mk-gap-8"},jf.default.createElement("input",{ref:i,value:t,type:"text",onChange:a=>r(a.target.value),className:"mk-input mk-input-large",style:{width:"100%"},onKeyDown:a=>{a.key==="Enter"&&n()}}),jf.default.createElement("div",{className:"mk-modal-actions"},jf.default.createElement("button",{onClick:()=>n()},e.saveLabel),jf.default.createElement("button",{onClick:()=>e.hide&&e.hide()},H.buttons.cancel)))};var Y5=e=>{let t=(h,m,g,A,b)=>{e.superstate.ui.openMenu(h.target.getBoundingClientRect(),{ui:e.superstate.ui,multi:!1,editable:!0,searchable:!0,saveOptions:(v,x)=>{b?b(x[0]):i(A,x[0])},placeholder:H.labels.propertyValueSpace,value:[m??""],options:g},Ne(h.view.document))},r=h=>{e.superstate.ui.openMenu(h.target.getBoundingClientRect(),{ui:e.superstate.ui,multi:!1,editable:!1,searchable:!1,saveOptions:(m,g)=>i("type",g[0]),value:[],showAll:!0,options:ml.filter(m=>m.primative).map((m,g)=>({id:g+1,name:m.label,value:m.type,icon:m.icon}))},Ne(h.view.document))},n=(0,Dr.useMemo)(()=>pr(e.value,e.fieldType,e.superstate),[e.value,e.fieldType]),i=(h,m)=>{e.saveValue(JSON.stringify({...n,[h]:m}))},a=h=>{let m=e.superstate.contextsIndex.get(n.space)?.contextTable?.cols?.find(g=>g.name==h);m?e.superstate.spaceManager.saveSpaceProperty(n.space,{...m,value:JSON.stringify({space:e.contextPath,field:e.name})},m):e.superstate.spaceManager.addSpaceProperty(n.space,{name:h,schemaId:Er,type:"context",value:JSON.stringify({space:e.contextPath,field:e.name})}),i("field",h)},o=h=>{t(h,n.space,e.superstate.allSpaces().filter(m=>m.type!="default").map(m=>({name:m.name,value:m.path,description:m.path})),"space")},s=h=>{let m=e.fields.filter(g=>g.type=="context").map(g=>({name:g.name,value:g.name}))??[];t(h,null,m,"ref")},l=h=>{let m=n.ref,g=e.fields.find(A=>A.name==m);if(g){let A=pr(g.value,g.type,e.superstate)?.space;A&&t(h,n.field,e.superstate.contextsIndex.get(A)?.contextTable?.cols.map(b=>({name:b.name,value:b.name}))??[],"field",a)}},u=h=>{let m=e.fields.find(g=>g.name==n.ref);if(m){let g=pr(m.value,m.type,e.superstate)?.space;if(g){let A=e.superstate.contextsIndex.get(g)?.contextTable?.cols?.find(b=>b.name==n.field);if(A){let b=[];b.push({name:"None",value:""}),Object.keys(_c).forEach(v=>{(_c[v].type.includes(ho(A))||_c[v].type.includes("any"))&&b.push({name:_c[v].label,value:v})}),t(h,null,b,"fn")}}}},c=h=>{t(h,n.property,e.superstate.contextsIndex.get(n.space)?.contextTable?.cols.filter(m=>!!(m.type?.startsWith("context")&&pr(m.value,m.type,e.superstate).space==e.contextPath)).map(m=>({name:m.name,value:m.name}))??[],"field",a)},f=h=>{let m=e.fields.filter(g=>g.type=="file"||g.type=="link"||g.type=="context").map(g=>({name:g.name,value:g.name}))??[];t(h,null,m,"field")},d=h=>{let m={superstate:e.superstate,saveFormula:g=>i("value",g),formula:n.value,value:{},fields:e.fields.filter(g=>g.name!=e.name),path:""};e.superstate.ui.openCustomMenu(h.target.getBoundingClientRect(),Dr.default.createElement(Ah,{...m}),{...m},Ne(h.view.document),"bottom")},p=h=>{t(h,null,[{name:"2020-04-21",value:"yyyy-MM-dd"},{name:"Apr 21, 2020",value:"MMM d, yyyy"},{name:"Tue Apr 21, 2020",value:"EEE MMM d, yyyy"}],"format")};return e.fieldType?.startsWith("date")?Dr.default.createElement("div",{className:"mk-menu-option",onClick:h=>p(h)},Dr.default.createElement("span",null,H.labels.dateFormat),Dr.default.createElement("span",null,n.format)):e.fieldType?.startsWith("context")?Dr.default.createElement(Dr.default.Fragment,null,Dr.default.createElement("div",{className:"mk-menu-option",onClick:h=>o(h)},Dr.default.createElement("span",null,H.labels.propertyValueSpace),Dr.default.createElement("span",null,wJ(n.space,e.superstate))),n.space?.length>0&&e.contextPath&&Dr.default.createElement("div",{className:"mk-menu-option",onClick:h=>c(h)},Dr.default.createElement("span",null,H.labels.propertyValueProperty),Dr.default.createElement("span",null,n.field))):e.fieldType?.startsWith("aggregate")?Dr.default.createElement(Dr.default.Fragment,null,Dr.default.createElement("div",{className:"mk-menu-option",onClick:h=>s(h)},Dr.default.createElement("span",null,H.labels.propertyValueReference),Dr.default.createElement("span",null,n.ref)),n.ref?.length>0&&Dr.default.createElement("div",{className:"mk-menu-option",onClick:h=>l(h)},Dr.default.createElement("span",null,H.labels.propertyValueAggregate),Dr.default.createElement("span",null,n.field)),n.field?.length>0&&Dr.default.createElement("div",{className:"mk-menu-option",onClick:h=>u(h)},Dr.default.createElement("span",null,H.labels.aggregateBy),Dr.default.createElement("span",null,_c[n?.fn]?.label))):e.fieldType=="number"?Dr.default.createElement(Dr.default.Fragment,null):e.fieldType=="fileprop"?Dr.default.createElement(Dr.default.Fragment,null,Dr.default.createElement("div",{className:"mk-menu-option",onClick:h=>d(h)},Dr.default.createElement("span",null,H.labels.propertyLookup)),Dr.default.createElement("div",{className:"mk-menu-option",onClick:h=>r(h)},Dr.default.createElement("span",null,H.labels.propertyType),Dr.default.createElement("span",null,fc(n.type)?.label))):e.fieldType=="object"?Dr.default.createElement("div",{className:"mk-menu-option",onClick:h=>{e.superstate.ui.openModal("Object Name",Dr.default.createElement(Ki,{value:n.typeName,saveLabel:"Rename Object",saveValue:m=>{i("typeName",m)}}),Ne(h.view.document))}},Dr.default.createElement("span",null,"Name"),Dr.default.createElement("span",null,n.typeName)):e.fieldType=="super"?Dr.default.createElement(Dr.default.Fragment,null,Dr.default.createElement("div",{className:"mk-menu-option"},Dr.default.createElement("span",null,H.labels.propertyDynamic),Dr.default.createElement("input",{type:"checkbox",checked:n.dynamic==!0,onChange:()=>i("dynamic",!n.dynamic)})),Dr.default.createElement("div",{className:"mk-menu-option",onClick:h=>f(h)},Dr.default.createElement("span",null,H.labels.propertyFileProp),Dr.default.createElement("span",null,n.field))):Dr.default.createElement(Dr.default.Fragment,null)};var EZe=e=>{let[t,r]=(0,Kr.useState)(""),[n,i]=(0,Kr.useState)(e.fileMetadata?"$fm":""),a=(0,Kr.useMemo)(()=>e.spaces.map(k=>e.superstate.spacesIndex.get(k)).filter(k=>k),[e.spaces]),[o,s]=(0,Kr.useState)(""),[l,u]=(0,Kr.useState)(e.type??"text"),c=(0,Kr.useMemo)(()=>{let k=[];return e.fileMetadata&&k.push({name:H.menu.setNone,value:"$fm"}),e.contextPath&&(!e.fileMetadata||e.contextPath!="$fm")&&k.push({name:i0(e.contextPath),value:""}),k.push(...(a??[]).map(j=>({name:j.name,value:j.path}))),k},[a]),f=(k,j)=>{u(j[0])},d=k=>{s(k)},p=(k,j)=>{i(j[0])},h=()=>{let k=ml.find(j=>j.type==l||j.multiType==l);u(k.type==l?k.multiType:k.type)},m=k=>{let j=(O,C)=>{let D=[twe].map((P,q)=>({name:Vo(P,e.superstate),value:P.name,icon:Ii(P),onClick:()=>{e.saveField(n,{...P,schemaId:e.schemaId})}}));return e.superstate.ui.openMenu(O,{ui:e.superstate.ui,multi:!1,editable:!1,searchable:!0,value:[],showAll:!0,options:D},Ne(k.view.document))};e.onSubmenu((O,C)=>{let N=[];return ml.filter(D=>n=="$fm"&&!e.isSpace?D.metadata:!D.restricted).forEach((D,P)=>{N.push({id:P+1,name:D.label,value:D.type,icon:D.icon,description:D.description,onClick:()=>u(D.type)})}),N.push({name:"Special",value:"special",icon:"ui//edit",type:6,onSubmenu:j}),e.superstate.ui.openMenu(O,{ui:e.superstate.ui,multi:!1,editable:!1,searchable:!0,value:[],showAll:!0,options:N},Ne(k.view.document))})},g=k=>{s(k)},A=(0,Kr.useMemo)(()=>fc(l,t)??ml[0],[l,t]),b=k=>{k.stopPropagation(),e.superstate.ui.openMenu(k.target.getBoundingClientRect(),{ui:e.superstate.ui,multi:!1,editable:!1,searchable:!1,saveOptions:p,value:[],showAll:!0,options:c},Ne(k.view.document))},v=()=>{if(t.length==0){e.superstate.ui.notify(H.notice.noPropertyName);return}e.saveField(n,{name:t,type:l,value:o,schemaId:e.schemaId})&&e.hide()},x=k=>{k.key=="Enter"&&v()};(0,Kr.useEffect)(()=>{setTimeout(()=>{w.current?.focus()},50)},[]);let w=(0,Kr.useRef)(null),S=k=>{let j=n==""?e.contextPath:n;k.stopPropagation();let O=e.superstate.contextsIndex.get(j)?.contextTable?.cols??[],C=rwe(e.superstate,[...e.superstate.spacesMap.getInverse(j)??[]]).filter(N=>!O.some(D=>D.name==N.name)&&![...d0(e.superstate.settings),e.superstate.settings.fmKeyAlias,"tags"].some(D=>D==N.name)).map(N=>({name:N.name,type:N.type,value:"",schemaId:e.schemaId}));if(C.length==0){e.superstate.ui.notify(H.notice.noPropertiesFound);return}e.superstate.ui.openMenu(k.target.getBoundingClientRect(),{ui:e.superstate.ui,multi:!1,editable:!1,searchable:!0,saveOptions:(N,D)=>{if(D[0]=="all"){e.superstate.spaceManager.readTable(j,Er).then(q=>e.superstate.spaceManager.saveTable(j,{...q,cols:[...q.cols,...C]})).then(q=>e.superstate.reloadContextByPath(j,!0)),e.hide();return}e.saveField(n,D[0])&&e.hide()},value:[],showAll:!0,options:[{name:H.labels.all,value:"all",icon:"ui//plus"},Rt,...C.map((N,D)=>({id:D+1,name:N.name,value:N,icon:Ii(N)}))],placeholder:H.labels.existingFrontmatter},Ne(k.view.document))};return Kr.default.createElement("div",{className:"mk-menu-container"},Kr.default.createElement("div",{className:"mk-menu-suggestions"},Kr.default.createElement("div",{className:"mk-menu-input"},Kr.default.createElement("input",{type:"text",ref:w,placeholder:"Name",onKeyDown:x,onChange:k=>r(k.target.value),onMouseDown:k=>k.stopPropagation(),value:t}),n!="$fm"&&Kr.default.createElement("button",{"aria-label":H.labels.existingFrontmatter,className:"mk-toolbar-button",onClick:k=>S(k),dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//import")}})),Kr.default.createElement("div",{className:"mk-menu-separator"}),c.length>1&&Kr.default.createElement("div",{className:"mk-menu-option",onClick:k=>b(k)},Kr.default.createElement("div",{className:"mk-menu-options-inner"},H.labels.propertyValueSpace),Kr.default.createElement("span",null,n=="$fm"?"None":n==""?e.superstate.spacesIndex.get(e.contextPath)?.name:e.superstate.spacesIndex.get(n)?.name)),Kr.default.createElement("div",{className:"mk-menu-option",onClick:k=>m(k)},Kr.default.createElement("div",{className:"mk-menu-options-inner"},H.labels.propertyType),Kr.default.createElement("span",null,A.label)),A.multi?Kr.default.createElement("div",{className:"mk-menu-option"},Kr.default.createElement("span",null,H.labels.multiple),Kr.default.createElement("input",{type:"checkbox",checked:l==A.multiType,onChange:()=>h()})):Kr.default.createElement(Kr.default.Fragment,null),Kr.default.createElement("div",{className:"mk-menu-separator"}),n!="$fm"||e.isSpace?Kr.default.createElement(Y5,{superstate:e.superstate,table:n,fields:e.fields,fieldType:l,value:o,contextPath:e.contextPath,saveValue:d}):Kr.default.createElement(Kr.default.Fragment,null),Kr.default.createElement("div",{className:"mk-menu-separator"}),Kr.default.createElement("div",{className:"mk-menu-option",onClick:k=>v()},Kr.default.createElement("span",null,H.buttons.saveProperty)),Kr.default.createElement("div",{className:"mk-menu-option",onClick:k=>e.hide()},Kr.default.createElement("span",null,H.buttons.cancel))))},Nf=(e,t,r,n,i,a)=>e.ui.openCustomMenu(t,Kr.default.createElement(EZe,{superstate:e,...n}),{},r,null,i);var wo=Ae(Te());var USe=Ae(Te()),gh=e=>USe.default.createElement("button",{className:`mk-collapse mk-inline-button mk-icon-xsmall ${e.collapsed?"mk-collapsed":""}`,onClick:t=>{e.onToggle&&(e.onToggle(!e.collapsed,t),t.stopPropagation())},dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//collapse-solid")}});var YC=(e,t)=>et?1:0,WSe=(e,t)=>{let r=e.split("/").pop(),n=t.split("/").pop();return YC(r.toLowerCase(),n.toLowerCase())},Z5=(e,t)=>YC(e?.toLowerCase(),t?.toLowerCase()),HSe=(e,t)=>YC(parseFloat(e),parseFloat(t)),VSe=(e,t)=>YC(e=="true"?1:0,t=="true"?1:0),GSe=(e,t)=>YC(sr(e).length,sr(t).length),VQ=(e,t)=>Object.keys(Zp).find(r=>Zp[r].type.some(n=>n==e)&&Zp[r].desc==t),Zp={alphabetical:{type:["text","option"],fn:Z5,label:H.sortTypes.alphaAsc,desc:!1},reverseAlphabetical:{type:["text","option"],fn:(e,t)=>Z5(e,t)*-1,label:H.sortTypes.alphaDesc,desc:!0},linkAlphabetical:{type:["link","context","file","image"],fn:WSe,label:H.sortTypes.alphaAsc,desc:!1},linkReverseAlphabetical:{type:["link","context","file","image"],fn:(e,t)=>WSe(e,t)*-1,label:H.sortTypes.alphaDesc,desc:!0},earliest:{type:["date"],fn:Z5,label:H.sortTypes.earliest,desc:!1},latest:{type:["date"],fn:(e,t)=>Z5(e,t)*-1,label:H.sortTypes.latest,desc:!0},boolean:{type:["boolean"],fn:VSe,label:H.sortTypes.checkAsc,desc:!1},booleanReverse:{type:["boolean"],fn:(e,t)=>VSe(e,t)*-1,label:H.sortTypes.checkDesc,desc:!0},number:{type:["number"],fn:HSe,label:"1 \u2192 9",desc:!1},reverseNumber:{type:["number"],fn:(e,t)=>HSe(e,t)*-1,label:"9 \u2192 1",desc:!0},count:{type:["option-multi","context-multi","link-multi","tags-multi"],fn:GSe,label:H.sortTypes.itemsDesc,desc:!0},reverseCount:{type:["option-multi","context-multi","link-multi","tags-multi"],fn:(e,t)=>GSe(e,t)*-1,label:H.sortTypes.itemsAsc,desc:!1}},QSe=(e,t,r,n)=>{if(!e)return 0;let i=Zp[t.fn];return i?i.fn(r[t.field],n[t.field]):0};var XC=Ae(yi()),hi=Ae(Te());var GQ=(e,t)=>Object.keys(t).find(n=>t[n].type.find(i=>i==e)),ZSe=e=>Object.keys(e),m2=(e,t)=>Object.keys(t).filter(n=>t[n].type.find(i=>i==e)),YSe=(e,t)=>e.filter(r=>Object.keys(t).find(n=>n==r.fn)),QQ=(e,t)=>e?{...t,view:e.view,listItem:e.listItem,listGroup:e.listGroup,listView:e.listView,listViewProps:e.listViewProps,listItemProps:e.listItemProps,listGroupProps:e.listGroupProps,filters:Array.isArray(e.filters)?YSe(e.filters,qi):[],sort:Array.isArray(e.sort)?YSe(e.sort,Zp):[],groupBy:Array.isArray(e.groupBy)?e.groupBy:[],colsOrder:Array.isArray(e.colsOrder)?e.colsOrder:[],colsHidden:Array.isArray(e.colsHidden)?e.colsHidden:[],colsSize:e.colsSize??{},colsCalc:e.colsCalc??{}}:t,ZC=e=>e?.primary=="true"?Wy:{...Wy,view:"table"};var Na=(0,hi.createContext)({dbSchema:null,views:[],source:"",sortedColumns:[],filteredData:[],contextTable:{},editMode:0,setEditMode:()=>null,selectedRows:[],selectRows:()=>null,setContextTable:()=>null,predicate:null,savePredicate:()=>null,saveDB:()=>null,hideColumn:()=>null,saveColumn:()=>!1,newColumn:()=>!1,sortColumn:()=>null,delColumn:()=>null,searchString:"",setSearchString:()=>null,data:[],updateValue:()=>null,updateFieldValue:()=>null,updateRow:()=>null,tableData:null,cols:[]}),h2=e=>{let{frameSchemas:t,saveSchema:r,frameSchema:n}=(0,hi.useContext)(ma),{spaceInfo:i,readMode:a,spaceState:o}=(0,hi.useContext)(ur),[s,l]=(0,hi.useState)(null),[u,c]=(0,hi.useState)({}),[f,d]=(0,hi.useState)(null),[p,h]=(0,hi.useState)(null),[m,g]=(0,hi.useState)(null),[A,b]=(0,hi.useState)([]),[v,x]=(0,hi.useState)(0),w=e.source??n?.def?.context??i?.path,S=(0,hi.useMemo)(()=>n&&n.def?.db?s?s?.rows.find($=>$.id==n.def.db):{id:n.def.db,...yp}:null,[n,s]),k=(0,hi.useMemo)(()=>{let $=t.filter(ae=>ae.type=="view"&&ae.def.db==S?.id);return $.length>0?$:n?[n]:[]},[t,n,S]),j=vA,O=o?.contexts??[],C=async()=>{let $=e.superstate.contextsIndex.get(w)?.schemas;$||($=await e.superstate.spaceManager.tablesForSpace(w)),$&&!(0,XC.isEqual)(s?.rows,$)?l(()=>({...j,rows:$})):S&&D(S)};(0,hi.useEffect)(()=>{S&&D(S)},[S]);let N=(0,hi.useCallback)(async $=>{e.superstate.spaceManager.contextForSpace($).then(ae=>{c(ce=>({...ce,[$]:ae}))})},[]),D=$=>{e.superstate.spaceManager.readTable(w,$.id).then(ae=>{if(ae){if($.primary)for(let ce of O)N(Wn(ce));for(let ce of ae.cols)if(ce.type.startsWith("context")){let U=pr(ce.value,ce.type,e.superstate);N(U.space)}P(ae)}})},P=$=>{d($),c(ae=>({...ae,[w]:$}))};(0,hi.useEffect)(()=>{let $=ce=>{if(ce.path==w)C();else{let U=Object.keys(u).find(R=>e.superstate.spaceManager.spaceInfoForPath(R)?.path==ce.path);U&&N(U)}},ae=ce=>{ce.path==w?C():S?.primary=="true"&&f?.rows.some(U=>U[mt]==ce.path)&&D(S)};return e.superstate.eventsDispatcher.addListener("contextStateUpdated",$),e.superstate.eventsDispatcher.addListener("spaceStateUpdated",$),e.superstate.eventsDispatcher.addListener("pathStateUpdated",ae),()=>{e.superstate.eventsDispatcher.removeListener("contextStateUpdated",$),e.superstate.eventsDispatcher.removeListener("spaceStateUpdated",$),e.superstate.eventsDispatcher.removeListener("pathStateUpdated",ae)}},[u,S,D,i,f]),(0,hi.useEffect)(()=>{C()},[i,n,e.source]);let q=async $=>{i.readOnly||await e.superstate.spaceManager.saveTable(w,$,!0).then(ae=>e.superstate.reloadContext(i,!0))},z=(0,hi.useMemo)(()=>f?[...f.cols.map($=>({...$,table:""}))??[],...S?.primary=="true"?O.reduce(($,ae)=>[...$,...u[Wn(ae)]?.cols.filter(ce=>ce.primary!="true").map(ce=>({...ce,table:ae}))??[]],[]):[]].filter($=>$):[],[f,u,O,S]),I=(0,hi.useMemo)(()=>f?.rows.map(($,ae)=>({_index:ae.toString(),...$,...$[mt]?{[mt]:e.superstate.spaceManager.resolvePath($[mt],o?.path)}:{},...O.reduce((ce,U)=>{let R=u[Wn(U)]?.rows.findIndex(ie=>ie[mt]==$[mt])??-1,J=u[Wn(U)]?.rows[R]??{},ee=Object.keys(J).reduce((ie,re)=>({...ie,[re+U]:J[re]}),{["_index"+U]:R.toString()});return{...ce,...ee}},{})}))??[],[f,u,z,S,o]);(0,hi.useEffect)(()=>{if(f)for(let $ of O)N($)},[f]);let T=async($,ae)=>{await e.superstate.spaceManager.saveTable(ae,$,!0).then(ce=>e.superstate.reloadContextByPath(ae,!0))},L=(0,hi.useMemo)(()=>z.filter($=>$.hidden!="true"&&!(m?.colsHidden??[]).some(ae=>ae==$.name+$.table)).sort(($,ae)=>(m?.colsOrder??[]).findIndex(ce=>ce==$.name+$.table)-(m?.colsOrder??[]).findIndex(ce=>ce==ae.name+ae.table)),[z,m]),_=(0,hi.useMemo)(()=>I.filter($=>(m?.filters??[]).reduce((ae,ce)=>{let U=z.some(R=>R.name=="tags")?{...$,tags:(e.superstate.pathsIndex.get($[mt])?.tags??[]).join(", ")}:$;return ae&&BSe(z.find(R=>R.name+R.table==ce.field),ce,U,o.properties)},!0)).filter($=>p?.length>0?n2(p).test(Object.keys($).filter(ae=>ae.charAt(0)!="_").map(ae=>$[ae]).join("|")):!0).sort(($,ae)=>(m?.sort??[]).reduce((ce,U)=>ce==0?QSe(z.find(R=>R.name+R.table==U.field),U,$,ae):ce,0)),[m,I,z,p]),Y=async($,ae)=>{let ce=e.superstate.spacesIndex.get(w??o.path);if(ae==-1){if(S?.id==Er){let J=I.findIndex(ee=>ee[mt]==$[mt]);if(J==-1){let ee=$[mt],ie=e.superstate.pathsIndex.get(ee);if(ie)await rh(e.superstate,ce,ie.path);else{let Ee=Tu(ce.path)+"/"+ee;await kf(e.superstate,Ee,{})}let re=Object.keys($).filter(Ee=>Ee!=mt);pi(e.superstate,$?.[mt],re.reduce((Ee,Ce)=>({...Ee,[Ce]:$[Ce]}),{})),q(bk(f,$));return}Y($,J);return}q(bk(f,$));return}let U=I[ae],R=Object.keys($).filter(J=>$[J]!=U[J]);pi(e.superstate,U?.[mt],R.reduce((J,ee)=>({...J,[ee]:$[ee]}),{})),q({...f,rows:f.rows.map((J,ee)=>ee==ae?{...J,...$}:J)})},oe=($,ae,ce,U,R)=>{let J=(ce==""?f:u[Wn(ce)])?.cols.find(ee=>ee.name==$);if(J&&pi(e.superstate,R??f.rows[U]?.[mt],{[$]:la(ho(J),ae,!0)}),ce=="")q({...f,rows:f.rows.map((ee,ie)=>ie==U?{...ee,[$]:ae}:ee)});else if(u[ce]){let ee=f.rows[U][mt];T({...u[Wn(ce)],rows:u[Wn(ce)].rows.map((ie,re)=>ie[mt]==ee?{...ie,[$]:ae}:ie)},Wn(ce))}},te=$=>{Oe({sort:[$]})},Q=($,ae)=>{Oe({colsHidden:ae?[...m.colsHidden.filter(ce=>ce!=$.name+$.table),$.name+$.table]:m.colsHidden.filter(ce=>ce!=$.name+$.table)})},fe=($,ae,ce,U,R,J)=>{let ee=f.cols.find(ie=>ie.name==$);if(pi(e.superstate,J??f.rows[R]?.[mt],{[$]:la(ho(ee),ce,!0)}),U==""){let ie={...f,cols:f.cols.map(re=>re.name==$?{...re,value:ae}:re),rows:f.rows.map((re,Ee)=>Ee==R?{...re,[$]:ce}:re)};q(ie)}else if(u[Wn(U)]){let ie=f.rows[R][mt];T({...u[Wn(U)],cols:u[Wn(U)].cols.map(re=>re.name==$?{...re,value:ae}:re),rows:u[Wn(U)].rows.map((re,Ee)=>ie==re[mt]?{...re,[$]:ce}:re)},Wn(U))}},Ie=async $=>{let ae=$.rows.map(ie=>ie[mt]),U=await(async(ie,re)=>{let Ee={uniques:[],cols:re.map(Ce=>Ce.name),rows:[]};for(let Ce of ie){let _e=e.superstate.pathsIndex.get(Ce)?.metadata.property;Ee={uniques:[],cols:re.map(he=>he.name),rows:[...Ee.rows,{[mt]:Ce,..._e?re.reduce((he,ze)=>{let Ye=Ri(ze.name,_e[ze.name],ze.type);return Ye?.length>0?{...he,[ze.name]:Ye}:he},{}):{}}]}}return Ee})(ae,$.cols.filter(ie=>!ie.type.includes("file"))),R=$.rows.map(ie=>{let re=U.rows.find(Ee=>Ee[mt]==ie[mt]);return re?{...ie,...re}:ie}),J=!XC.default.isEqual(R,f?.rows),ee=!XC.default.isEqual(f?.cols,$.cols);(J||ee)&&q({...$,rows:R})};(0,hi.useEffect)(()=>{n&&ve(n.predicate)},[n]);let Se=($,ae)=>{if(b(ae),S?.primary=="true")if($){let ce=f.rows[parseInt($)]?.[mt];ce&&e.superstate.ui.setActivePath(ce)}else e.superstate.ui.setActivePath(w)},Oe=$=>{let ae=ZC(S),ce={...m??ae,...$},U=QQ(ce,ae);r(n?{...n,predicate:JSON.stringify(U)}:{id:Mi(S.id+"View",t.map(R=>R.id)),name:S.name+" View",type:"view",def:{db:S.id},predicate:JSON.stringify(U)}),g(U)};(0,hi.useEffect)(()=>{m&&g($=>({...$,colsOrder:kr([...$.colsOrder,...z.filter(ae=>ae.hidden!="true").map(ae=>ae.name+ae.table)])}))},[z]);let ve=$=>{let ae=ZC(S),ce=QQ(or($),ae);g({...ce,colsOrder:kr([...ce.colsOrder,...z.filter(U=>U.hidden!="true").map(U=>U.name+U.table)])})},ye=$=>{let ae,ce=$.table;ce==""?ae=f:u[Wn(ce)]&&(ae=u[Wn(ce)]);let U=ae.cols.filter((J,ee)=>J.name!=$.name),R={...ae,cols:U,rows:ae.rows.map(J=>{let{[$.name]:ee,...ie}=J;return ie})};ce==""?q(R):u[Wn(ce)]&&T(R,Wn(ce))},me=$=>ke($),ke=($,ae)=>{let ce,U={...$,name:ZA($.name)},R=U.table;if(R==""||R==w?ce=f:u[Wn(R)]&&(ce=u[Wn(R)]),U.name=="")return e.superstate.ui.notify(H.notice.noPropertyName),!1;if(!ae&&ce.cols.find(re=>re.name.toLowerCase()==U.name.toLowerCase())||ae&&ae.name!=U.name&&ce.cols.find(re=>re.name.toLowerCase()==U.name.toLowerCase()))return e.superstate.ui.notify(H.notice.duplicatePropertyName),!1;if(!ae&&$.schemaId==Er&&$.type.startsWith("option")){let re=kr([...e.superstate.spacesMap.getInverse(w)??[]].flatMap(Ce=>sr(e.superstate.pathsIndex.get(Ce)?.metadata?.property?.[$.name])??[])),Ee=pA(re.map(Ce=>({value:Ce,name:Ce})),{});U.value=Ee}let J=ae?ce.cols.findIndex(re=>re.name==ae.name):-1,ee=J==-1?[...ce.cols,U]:ce.cols.map((re,Ee)=>Ee==J?U:re),ie={...ce,cols:ee,rows:ce.rows.map(re=>ae?{...re,[U.name]:re[ae.name],oldColumn:void 0}:re)};return ae&&Oe({filters:(m?.filters??[]).map(re=>re.field==ae.name+ae.table?{...re,field:U.name+U.table}:re),sort:(m?.sort??[]).map(re=>re.field==ae.name+ae.table?{...re,field:U.name+U.table}:re),groupBy:(m?.groupBy??[]).map(re=>re==ae.name+ae.table?U.name+U.table:re),colsHidden:(m?.colsHidden??[]).map(re=>re==ae.name+ae.table?U.name+U.table:re),colsOrder:(m?.colsOrder??[]).map(re=>re==ae.name+ae.table?U.name+U.table:re),colsSize:{...m?.colsSize??{},[U.name+U.table]:m?.colsSize?.[ae.name+ae.table],[ae.name+ae.table]:void 0},colsCalc:{...m?.colsCalc??{},[U.name+U.table]:m?.colsCalc?.[ae.name+ae.table],[ae.name+ae.table]:void 0}}),R==""?S.id==Er?Ie(ie):q(ie):u[Wn(R)]&&T(ie,Wn(R)),!0};return hi.default.createElement(Na.Provider,{value:{source:w,views:k,cols:z,saveDB:q,filteredData:_,dbSchema:S,tableData:f,selectedRows:A,selectRows:Se,sortedColumns:L,contextTable:u,setContextTable:c,predicate:m,savePredicate:Oe,saveColumn:ke,hideColumn:Q,sortColumn:te,delColumn:ye,newColumn:me,searchString:p,setSearchString:h,updateValue:oe,updateFieldValue:fe,editMode:v,setEditMode:x,data:I,updateRow:Y}},e.children)};var KC=Ae(Te()),XSe=Ae(bl()),vh=KC.default.createContext({dragNode:null,setDragNode:()=>null,dragActive:!1}),KSe=e=>{let[t,r]=KC.default.useState(null);return Ca({onDragCancel:()=>{r(null)},onDragEnd:()=>{r(null)}}),KC.default.createElement(vh.Provider,{value:{dragNode:t,setDragNode:r,dragActive:e.dragActive}},e.children,t&&(0,XSe.createPortal)(KC.default.createElement(Um,{dropAnimation:null,zIndex:1600},t),document.body))};var Qr=Ae(Te());var JSe=Ae(Te()),Io=e=>JSe.default.createElement("div",{"aria-label":e.name,className:`mk-editor-frame-node-button ${e.value==e.onValue?"mk-active":""}`,onClick:t=>e.value==e.onValue?e.setValue(e.defaultValue):e.setValue(e.onValue),dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker(e.icon)}});var e2e=e=>{let{pathState:t}=(0,Qr.useContext)($r),{spaceInfo:r}=(0,Qr.useContext)(ur),{predicate:n,savePredicate:i,sortedColumns:a}=(0,Qr.useContext)(Na),o=(b,v)=>{i({view:"frame",[v]:b})},{frameSchemas:s,saveSchema:l}=(0,Qr.useContext)(ma),u=(0,Qr.useMemo)(()=>{let b=[];return s&&b.push(...s.filter(v=>v.type=="frame"&&v.def?.type=="listItem").map(v=>({name:v.name,value:`${r.path}/#*${v.id}`}))),b.push(...e.superstate.selectedKit.frames.filter(v=>Ao(v.schema).def?.type=="listItem").map(v=>({name:v.schema.name,value:`spaces://$kit/#*${Ao(v.schema).def.id}`}))),b},[]),c=(b,v)=>{let x=b.target.getBoundingClientRect();e.superstate.ui.openMenu(x,{ui:e.superstate.ui,multi:!1,editable:!0,value:[],options:[...s.filter(w=>w.type=="frame"&&w.def?.type==v).map(w=>({name:w.name,value:`${r.path}/#*${w.id}`})),...e.superstate.selectedKit.frames.filter(w=>Ao(w.schema).def?.type==v).map(w=>({name:w.schema.name,icon:"ui//package-plus",value:`spaces://$kit/#*${Ao(w.schema).def.id}`}))],saveOptions:(w,S,k)=>{o(S[0],v)},placeholder:H.hintText.createListItem,detail:!0,searchable:!1,showAll:!0},Ne(b.view.document))},f=async(b,v)=>(o(`${r.path}/#*${b.id}`,v),await l(b),b),d=async()=>{let b=e.superstate.spaceManager.uriByString(n.listItem);if(b.authority=="$kit"){e.superstate.ui.notify("Already in Kit");return}let v=await e.superstate.spaceManager.readFrame(b.basePath,b.ref);e.superstate.spaceManager.saveFrameKit(v,e.superstate.settings.selectedKit)},p=b=>{let v=mA(n[b],"spaces://$kit/#*"+b),x=e.superstate.spaceManager.uriByString(v);if(x.authority=="$kit"){let w=e.superstate.kit.find(S=>S.def.id==x.ref);f({name:w.def.id,type:"frame",id:w.def.id,def:w.def},b).then(async S=>{await tre(e.superstate,r,S.id,w),o(`./#*${S.id}`,b)})}else o(v,b);e.setEditSection(b)},[h,m]=(0,Qr.useState)(!1),[g,A]=(0,Qr.useTransition)();return(0,Qr.useEffect)(()=>{A(()=>{m(!0)})},[]),n?Qr.default.createElement("div",{className:"mk-editor-context-selector"},Qr.default.createElement("div",{className:"mk-editor-context-groups"},Qr.default.createElement("div",{className:"mk-editor-context-group"},Qr.default.createElement(Io,{superstate:e.superstate,name:H.editor.rows,icon:"ui//rows",value:n.listGroup,defaultValue:"spaces://$kit/#*listGroup",onValue:"spaces://$kit/#*listGroup",setValue:b=>{i({view:"list",listView:"spaces://$kit/#*listView",listGroup:"spaces://$kit/#*listGroup"})}}),Qr.default.createElement(Io,{superstate:e.superstate,name:H.editor.columns,icon:"ui//columns",value:n.listGroup,defaultValue:"spaces://$kit/#*columnGroup",onValue:"spaces://$kit/#*columnGroup",setValue:b=>{i({view:"list",listView:"spaces://$kit/#*columnView",listGroup:"spaces://$kit/#*columnGroup"})}}),Qr.default.createElement(Io,{superstate:e.superstate,name:H.editor.catalog,icon:"ui//gallery-horizontal-end",value:n.listGroup,defaultValue:"spaces://$kit/#*rowGroup",onValue:"spaces://$kit/#*rowGroup",setValue:b=>{i({view:"list",listView:"spaces://$kit/#*listView",listGroup:"spaces://$kit/#*rowGroup"})}}),Qr.default.createElement(Io,{superstate:e.superstate,name:H.editor.grid,icon:"ui//layout-grid",value:n.listGroup,defaultValue:"spaces://$kit/#*gridGroup",onValue:"spaces://$kit/#*gridGroup",setValue:b=>{i({view:"list",listView:"spaces://$kit/#*listView",listGroup:"spaces://$kit/#*gridGroup"})}}),Qr.default.createElement("button",{onClick:b=>{p("listGroup")},"aria-label":H.buttons.customize,className:"mk-icon-xsmall mk-button-new",dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//brush")},style:{height:"20px",padding:"8px"}})),Qr.default.createElement("div",{className:"mk-editor-context-group"},Qr.default.createElement("div",{className:"mk-editor-context-group-select",onClick:b=>{c(b,"listItem"),b.stopPropagation()}},u.find(b=>b.value==n.listItem)?.name??H.labels.select,Qr.default.createElement(gh,{superstate:e.superstate,collapsed:!1,onToggle:(b,v)=>{c(v,"listItem"),v.stopPropagation()}})),Qr.default.createElement("button",{onClick:b=>{p("listItem")},"aria-label":H.buttons.customize,className:"mk-icon-xsmall mk-button-new",style:{height:"20px",padding:"8px"},dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//brush")}}),Qr.default.createElement("button",{onClick:b=>{d()},className:"mk-icon-xsmall",dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//package-plus")},style:{height:"20px",padding:"8px"}})),Qr.default.createElement("span",null),Qr.default.createElement("div",{className:"mk-editor-frame-node-button-primary",onClick:b=>{e.setEditMode(0),b.stopPropagation()}},H.labels.done)),e.editSection=="listItem"&&Qr.default.createElement("div",{className:"mk-editor-context-properties"},Qr.default.createElement("div",{style:{display:"flex"}},H.labels.properties,Qr.default.createElement("div",{"aria-label":H.hintText.dragDropProperties,className:"mk-icon-xsmall",dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//help-circle")}})),Qr.default.createElement("div",null,a.map((b,v)=>Qr.default.createElement(JC,{contexts:[t.path],path:t.path,key:v,superstate:e.superstate,property:b,draggable:!0}))))):null},JC=e=>{let{uid:t}=(0,Qr.useContext)($r),r=e.contexts?.[0],n=`${t}_props_${r??""}${e.property.name}`,{attributes:i,listeners:a,setNodeRef:o,transform:s}=Us({id:n,data:{id:n,name:e.property.name,property:e.property,context:r??"",path:e.path,type:"property"}}),{setDragNode:l}=(0,Qr.useContext)(vh);return Ca({onDragStart:u=>{u.active.data.current.id==n&&l(Qr.default.createElement("div",{className:"mk-path-context-field",onClick:c=>e.onClick?e.onClick(c):null},Qr.default.createElement("div",{className:"mk-path-context-field-icon",dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker(Ii(e.property))}}),Qr.default.createElement("div",{className:"mk-path-context-field-key"},Vo(e.property,e.superstate))))}}),Qr.default.createElement("div",{ref:o,className:"mk-path-context-field",onClick:u=>e.onClick?e.onClick(u):null,...i,...a},Qr.default.createElement("div",{className:"mk-path-context-field-icon",dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker(Ii(e.property))}}),e.contexts?.length>0&&Qr.default.createElement("div",{className:"mk-path-context-field-space",dangerouslySetInnerHTML:{__html:e.contexts.length==1?e.superstate.ui.getSticker(e.superstate.pathsIndex.get(e.contexts[0])?.label?.sticker):e.contexts.length}}),Qr.default.createElement("div",{className:"mk-path-context-field-key"},Vo(e.property,e.superstate)))};var rD=Ae(Te(),1);function Sv(e,t){return typeof e=="function"?e(t):e}function Tf(e,t){return r=>{t.setState(n=>({...n,[e]:Sv(r,n[e])}))}}function e9(e){return e instanceof Function}function kZe(e){return Array.isArray(e)&&e.every(t=>typeof t=="number")}function n2e(e,t){let r=[],n=i=>{i.forEach(a=>{r.push(a);let o=t(a);o!=null&&o.length&&n(o)})};return n(e),r}function Or(e,t,r){let n=[],i;return a=>{let o;r.key&&r.debug&&(o=Date.now());let s=e(a);if(!(s.length!==n.length||s.some((c,f)=>n[f]!==c)))return i;n=s;let u;if(r.key&&r.debug&&(u=Date.now()),i=t(...s),r==null||r.onChange==null||r.onChange(i),r.key&&r.debug&&r!=null&&r.debug()){let c=Math.round((Date.now()-o)*100)/100,f=Math.round((Date.now()-u)*100)/100,d=f/16,p=(h,m)=>{for(h=String(h);h.length{var i;return(i=e?.debugAll)!=null?i:e[t]},key:!1,onChange:n}}function CZe(e,t,r,n){let i=()=>{var o;return(o=a.getValue())!=null?o:e.options.renderFallbackValue},a={id:`${t.id}_${r.id}`,row:t,column:r,getValue:()=>t.getValue(n),renderValue:i,getContext:Or(()=>[e,r,t,a],(o,s,l,u)=>({table:o,column:s,row:l,cell:u,getValue:u.getValue,renderValue:u.renderValue}),Mr(e.options,"debugCells","cell.getContext"))};return e._features.forEach(o=>{o.createCell==null||o.createCell(a,r,t,e)},{}),a}function DZe(e,t,r,n){var i,a;let s={...e._getDefaultColumnDef(),...t},l=s.accessorKey,u=(i=(a=s.id)!=null?a:l?l.replace(".","_"):void 0)!=null?i:typeof s.header=="string"?s.header:void 0,c;if(s.accessorFn?c=s.accessorFn:l&&(l.includes(".")?c=d=>{let p=d;for(let m of l.split(".")){var h;p=(h=p)==null?void 0:h[m]}return p}:c=d=>d[s.accessorKey]),!u)throw new Error;let f={id:`${String(u)}`,accessorFn:c,parent:n,depth:r,columnDef:s,columns:[],getFlatColumns:Or(()=>[!0],()=>{var d;return[f,...(d=f.columns)==null?void 0:d.flatMap(p=>p.getFlatColumns())]},Mr(e.options,"debugColumns","column.getFlatColumns")),getLeafColumns:Or(()=>[e._getOrderColumnsFn()],d=>{var p;if((p=f.columns)!=null&&p.length){let h=f.columns.flatMap(m=>m.getLeafColumns());return d(h)}return[f]},Mr(e.options,"debugColumns","column.getLeafColumns"))};for(let d of e._features)d.createColumn==null||d.createColumn(f,e);return f}var mu="debugHeaders";function t2e(e,t,r){var n;let a={id:(n=r.id)!=null?n:t.id,column:t,index:r.index,isPlaceholder:!!r.isPlaceholder,placeholderId:r.placeholderId,depth:r.depth,subHeaders:[],colSpan:0,rowSpan:0,headerGroup:null,getLeafHeaders:()=>{let o=[],s=l=>{l.subHeaders&&l.subHeaders.length&&l.subHeaders.map(s),o.push(l)};return s(a),o},getContext:()=>({table:e,header:a,column:t})};return e._features.forEach(o=>{o.createHeader==null||o.createHeader(a,e)}),a}var OZe={createTable:e=>{e.getHeaderGroups=Or(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.left,e.getState().columnPinning.right],(t,r,n,i)=>{var a,o;let s=(a=n?.map(f=>r.find(d=>d.id===f)).filter(Boolean))!=null?a:[],l=(o=i?.map(f=>r.find(d=>d.id===f)).filter(Boolean))!=null?o:[],u=r.filter(f=>!(n!=null&&n.includes(f.id))&&!(i!=null&&i.includes(f.id)));return X5(t,[...s,...u,...l],e)},Mr(e.options,mu,"getHeaderGroups")),e.getCenterHeaderGroups=Or(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.left,e.getState().columnPinning.right],(t,r,n,i)=>(r=r.filter(a=>!(n!=null&&n.includes(a.id))&&!(i!=null&&i.includes(a.id))),X5(t,r,e,"center")),Mr(e.options,mu,"getCenterHeaderGroups")),e.getLeftHeaderGroups=Or(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.left],(t,r,n)=>{var i;let a=(i=n?.map(o=>r.find(s=>s.id===o)).filter(Boolean))!=null?i:[];return X5(t,a,e,"left")},Mr(e.options,mu,"getLeftHeaderGroups")),e.getRightHeaderGroups=Or(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.right],(t,r,n)=>{var i;let a=(i=n?.map(o=>r.find(s=>s.id===o)).filter(Boolean))!=null?i:[];return X5(t,a,e,"right")},Mr(e.options,mu,"getRightHeaderGroups")),e.getFooterGroups=Or(()=>[e.getHeaderGroups()],t=>[...t].reverse(),Mr(e.options,mu,"getFooterGroups")),e.getLeftFooterGroups=Or(()=>[e.getLeftHeaderGroups()],t=>[...t].reverse(),Mr(e.options,mu,"getLeftFooterGroups")),e.getCenterFooterGroups=Or(()=>[e.getCenterHeaderGroups()],t=>[...t].reverse(),Mr(e.options,mu,"getCenterFooterGroups")),e.getRightFooterGroups=Or(()=>[e.getRightHeaderGroups()],t=>[...t].reverse(),Mr(e.options,mu,"getRightFooterGroups")),e.getFlatHeaders=Or(()=>[e.getHeaderGroups()],t=>t.map(r=>r.headers).flat(),Mr(e.options,mu,"getFlatHeaders")),e.getLeftFlatHeaders=Or(()=>[e.getLeftHeaderGroups()],t=>t.map(r=>r.headers).flat(),Mr(e.options,mu,"getLeftFlatHeaders")),e.getCenterFlatHeaders=Or(()=>[e.getCenterHeaderGroups()],t=>t.map(r=>r.headers).flat(),Mr(e.options,mu,"getCenterFlatHeaders")),e.getRightFlatHeaders=Or(()=>[e.getRightHeaderGroups()],t=>t.map(r=>r.headers).flat(),Mr(e.options,mu,"getRightFlatHeaders")),e.getCenterLeafHeaders=Or(()=>[e.getCenterFlatHeaders()],t=>t.filter(r=>{var n;return!((n=r.subHeaders)!=null&&n.length)}),Mr(e.options,mu,"getCenterLeafHeaders")),e.getLeftLeafHeaders=Or(()=>[e.getLeftFlatHeaders()],t=>t.filter(r=>{var n;return!((n=r.subHeaders)!=null&&n.length)}),Mr(e.options,mu,"getLeftLeafHeaders")),e.getRightLeafHeaders=Or(()=>[e.getRightFlatHeaders()],t=>t.filter(r=>{var n;return!((n=r.subHeaders)!=null&&n.length)}),Mr(e.options,mu,"getRightLeafHeaders")),e.getLeafHeaders=Or(()=>[e.getLeftHeaderGroups(),e.getCenterHeaderGroups(),e.getRightHeaderGroups()],(t,r,n)=>{var i,a,o,s,l,u;return[...(i=(a=t[0])==null?void 0:a.headers)!=null?i:[],...(o=(s=r[0])==null?void 0:s.headers)!=null?o:[],...(l=(u=n[0])==null?void 0:u.headers)!=null?l:[]].map(c=>c.getLeafHeaders()).flat()},Mr(e.options,mu,"getLeafHeaders"))}};function X5(e,t,r,n){var i,a;let o=0,s=function(d,p){p===void 0&&(p=1),o=Math.max(o,p),d.filter(h=>h.getIsVisible()).forEach(h=>{var m;(m=h.columns)!=null&&m.length&&s(h.columns,p+1)},0)};s(e);let l=[],u=(d,p)=>{let h={depth:p,id:[n,`${p}`].filter(Boolean).join("_"),headers:[]},m=[];d.forEach(g=>{let A=[...m].reverse()[0],b=g.column.depth===h.depth,v,x=!1;if(b&&g.column.parent?v=g.column.parent:(v=g.column,x=!0),A&&A?.column===v)A.subHeaders.push(g);else{let w=t2e(r,v,{id:[n,p,v.id,g?.id].filter(Boolean).join("_"),isPlaceholder:x,placeholderId:x?`${m.filter(S=>S.column===v).length}`:void 0,depth:p,index:m.length});w.subHeaders.push(g),m.push(w)}h.headers.push(g),g.headerGroup=h}),l.push(h),p>0&&u(m,p-1)},c=t.map((d,p)=>t2e(r,d,{depth:o,index:p}));u(c,o-1),l.reverse();let f=d=>d.filter(h=>h.column.getIsVisible()).map(h=>{let m=0,g=0,A=[0];h.subHeaders&&h.subHeaders.length?(A=[],f(h.subHeaders).forEach(v=>{let{colSpan:x,rowSpan:w}=v;m+=x,A.push(w)})):m=1;let b=Math.min(...A);return g=g+b,h.colSpan=m,h.rowSpan=g,{colSpan:m,rowSpan:g}});return f((i=(a=l[0])==null?void 0:a.headers)!=null?i:[]),l}var i2e=(e,t,r,n,i,a,o)=>{let s={id:t,index:n,original:r,depth:i,parentId:o,_valuesCache:{},_uniqueValuesCache:{},getValue:l=>{if(s._valuesCache.hasOwnProperty(l))return s._valuesCache[l];let u=e.getColumn(l);if(!!(u!=null&&u.accessorFn))return s._valuesCache[l]=u.accessorFn(s.original,n),s._valuesCache[l]},getUniqueValues:l=>{if(s._uniqueValuesCache.hasOwnProperty(l))return s._uniqueValuesCache[l];let u=e.getColumn(l);if(!!(u!=null&&u.accessorFn))return u.columnDef.getUniqueValues?(s._uniqueValuesCache[l]=u.columnDef.getUniqueValues(s.original,n),s._uniqueValuesCache[l]):(s._uniqueValuesCache[l]=[s.getValue(l)],s._uniqueValuesCache[l])},renderValue:l=>{var u;return(u=s.getValue(l))!=null?u:e.options.renderFallbackValue},subRows:a??[],getLeafRows:()=>n2e(s.subRows,l=>l.subRows),getParentRow:()=>s.parentId?e.getRow(s.parentId,!0):void 0,getParentRows:()=>{let l=[],u=s;for(;;){let c=u.getParentRow();if(!c)break;l.push(c),u=c}return l.reverse()},getAllCells:Or(()=>[e.getAllLeafColumns()],l=>l.map(u=>CZe(e,s,u,u.id)),Mr(e.options,"debugRows","getAllCells")),_getAllCellsByColumnId:Or(()=>[s.getAllCells()],l=>l.reduce((u,c)=>(u[c.column.id]=c,u),{}),Mr(e.options,"debugRows","getAllCellsByColumnId"))};for(let l=0;l{e._getFacetedRowModel=t.options.getFacetedRowModel&&t.options.getFacetedRowModel(t,e.id),e.getFacetedRowModel=()=>e._getFacetedRowModel?e._getFacetedRowModel():t.getPreFilteredRowModel(),e._getFacetedUniqueValues=t.options.getFacetedUniqueValues&&t.options.getFacetedUniqueValues(t,e.id),e.getFacetedUniqueValues=()=>e._getFacetedUniqueValues?e._getFacetedUniqueValues():new Map,e._getFacetedMinMaxValues=t.options.getFacetedMinMaxValues&&t.options.getFacetedMinMaxValues(t,e.id),e.getFacetedMinMaxValues=()=>{if(!!e._getFacetedMinMaxValues)return e._getFacetedMinMaxValues()}}},a2e=(e,t,r)=>{var n;let i=r.toLowerCase();return Boolean((n=e.getValue(t))==null||(n=n.toString())==null||(n=n.toLowerCase())==null?void 0:n.includes(i))};a2e.autoRemove=e=>Zp(e);var o2e=(e,t,r)=>{var n;return Boolean((n=e.getValue(t))==null||(n=n.toString())==null?void 0:n.includes(r))};o2e.autoRemove=e=>Zp(e);var s2e=(e,t,r)=>{var n;return((n=e.getValue(t))==null||(n=n.toString())==null?void 0:n.toLowerCase())===r?.toLowerCase()};s2e.autoRemove=e=>Zp(e);var l2e=(e,t,r)=>{var n;return(n=e.getValue(t))==null?void 0:n.includes(r)};l2e.autoRemove=e=>Zp(e)||!(e!=null&&e.length);var u2e=(e,t,r)=>!r.some(n=>{var i;return!((i=e.getValue(t))!=null&&i.includes(n))});u2e.autoRemove=e=>Zp(e)||!(e!=null&&e.length);var c2e=(e,t,r)=>r.some(n=>{var i;return(i=e.getValue(t))==null?void 0:i.includes(n)});c2e.autoRemove=e=>Zp(e)||!(e!=null&&e.length);var f2e=(e,t,r)=>e.getValue(t)===r;f2e.autoRemove=e=>Zp(e);var d2e=(e,t,r)=>e.getValue(t)==r;d2e.autoRemove=e=>Zp(e);var sY=(e,t,r)=>{let[n,i]=r,a=e.getValue(t);return a>=n&&a<=i};sY.resolveFilterValue=e=>{let[t,r]=e,n=typeof t!="number"?parseFloat(t):t,i=typeof r!="number"?parseFloat(r):r,a=t===null||Number.isNaN(n)?-1/0:n,o=r===null||Number.isNaN(i)?1/0:i;if(a>o){let s=a;a=o,o=s}return[a,o]};sY.autoRemove=e=>Zp(e)||Zp(e[0])&&Zp(e[1]);var tg={includesString:a2e,includesStringSensitive:o2e,equalsString:s2e,arrIncludes:l2e,arrIncludesAll:u2e,arrIncludesSome:c2e,equals:f2e,weakEquals:d2e,inNumberRange:sY};function Zp(e){return e==null||e===""}var jZe={getDefaultColumnDef:()=>({filterFn:"auto"}),getInitialState:e=>({columnFilters:[],...e}),getDefaultOptions:e=>({onColumnFiltersChange:Tf("columnFilters",e),filterFromLeafRows:!1,maxLeafRowFilterDepth:100}),createColumn:(e,t)=>{e.getAutoFilterFn=()=>{let r=t.getCoreRowModel().flatRows[0],n=r?.getValue(e.id);return typeof n=="string"?tg.includesString:typeof n=="number"?tg.inNumberRange:typeof n=="boolean"||n!==null&&typeof n=="object"?tg.equals:Array.isArray(n)?tg.arrIncludes:tg.weakEquals},e.getFilterFn=()=>{var r,n;return e9(e.columnDef.filterFn)?e.columnDef.filterFn:e.columnDef.filterFn==="auto"?e.getAutoFilterFn():(r=(n=t.options.filterFns)==null?void 0:n[e.columnDef.filterFn])!=null?r:tg[e.columnDef.filterFn]},e.getCanFilter=()=>{var r,n,i;return((r=e.columnDef.enableColumnFilter)!=null?r:!0)&&((n=t.options.enableColumnFilters)!=null?n:!0)&&((i=t.options.enableFilters)!=null?i:!0)&&!!e.accessorFn},e.getIsFiltered=()=>e.getFilterIndex()>-1,e.getFilterValue=()=>{var r;return(r=t.getState().columnFilters)==null||(r=r.find(n=>n.id===e.id))==null?void 0:r.value},e.getFilterIndex=()=>{var r,n;return(r=(n=t.getState().columnFilters)==null?void 0:n.findIndex(i=>i.id===e.id))!=null?r:-1},e.setFilterValue=r=>{t.setColumnFilters(n=>{let i=e.getFilterFn(),a=n?.find(c=>c.id===e.id),o=Sv(r,a?a.value:void 0);if(r2e(i,o,e)){var s;return(s=n?.filter(c=>c.id!==e.id))!=null?s:[]}let l={id:e.id,value:o};if(a){var u;return(u=n?.map(c=>c.id===e.id?l:c))!=null?u:[]}return n!=null&&n.length?[...n,l]:[l]})}},createRow:(e,t)=>{e.columnFilters={},e.columnFiltersMeta={}},createTable:e=>{e.setColumnFilters=t=>{let r=e.getAllLeafColumns(),n=i=>{var a;return(a=Sv(t,i))==null?void 0:a.filter(o=>{let s=r.find(l=>l.id===o.id);if(s){let l=s.getFilterFn();if(r2e(l,o.value,s))return!1}return!0})};e.options.onColumnFiltersChange==null||e.options.onColumnFiltersChange(n)},e.resetColumnFilters=t=>{var r,n;e.setColumnFilters(t?[]:(r=(n=e.initialState)==null?void 0:n.columnFilters)!=null?r:[])},e.getPreFilteredRowModel=()=>e.getCoreRowModel(),e.getFilteredRowModel=()=>(!e._getFilteredRowModel&&e.options.getFilteredRowModel&&(e._getFilteredRowModel=e.options.getFilteredRowModel(e)),e.options.manualFiltering||!e._getFilteredRowModel?e.getPreFilteredRowModel():e._getFilteredRowModel())}};function r2e(e,t,r){return(e&&e.autoRemove?e.autoRemove(t,r):!1)||typeof t>"u"||typeof t=="string"&&!t}var NZe=(e,t,r)=>r.reduce((n,i)=>{let a=i.getValue(e);return n+(typeof a=="number"?a:0)},0),TZe=(e,t,r)=>{let n;return r.forEach(i=>{let a=i.getValue(e);a!=null&&(n>a||n===void 0&&a>=a)&&(n=a)}),n},FZe=(e,t,r)=>{let n;return r.forEach(i=>{let a=i.getValue(e);a!=null&&(n=a)&&(n=a)}),n},_Ze=(e,t,r)=>{let n,i;return r.forEach(a=>{let o=a.getValue(e);o!=null&&(n===void 0?o>=o&&(n=i=o):(n>o&&(n=o),i{let r=0,n=0;if(t.forEach(i=>{let a=i.getValue(e);a!=null&&(a=+a)>=a&&(++r,n+=a)}),r)return n/r},IZe=(e,t)=>{if(!t.length)return;let r=t.map(a=>a.getValue(e));if(!kZe(r))return;if(r.length===1)return r[0];let n=Math.floor(r.length/2),i=r.sort((a,o)=>a-o);return r.length%2!==0?i[n]:(i[n-1]+i[n])/2},BZe=(e,t)=>Array.from(new Set(t.map(r=>r.getValue(e))).values()),RZe=(e,t)=>new Set(t.map(r=>r.getValue(e))).size,$Ze=(e,t)=>t.length,YQ={sum:NZe,min:TZe,max:FZe,extent:_Ze,mean:PZe,median:IZe,unique:BZe,uniqueCount:RZe,count:$Ze},qZe={getDefaultColumnDef:()=>({aggregatedCell:e=>{var t,r;return(t=(r=e.getValue())==null||r.toString==null?void 0:r.toString())!=null?t:null},aggregationFn:"auto"}),getInitialState:e=>({grouping:[],...e}),getDefaultOptions:e=>({onGroupingChange:Tf("grouping",e),groupedColumnMode:"reorder"}),createColumn:(e,t)=>{e.toggleGrouping=()=>{t.setGrouping(r=>r!=null&&r.includes(e.id)?r.filter(n=>n!==e.id):[...r??[],e.id])},e.getCanGroup=()=>{var r,n,i,a;return(r=(n=(i=(a=e.columnDef.enableGrouping)!=null?a:!0)!=null?i:t.options.enableGrouping)!=null?n:!0)!=null?r:!!e.accessorFn},e.getIsGrouped=()=>{var r;return(r=t.getState().grouping)==null?void 0:r.includes(e.id)},e.getGroupedIndex=()=>{var r;return(r=t.getState().grouping)==null?void 0:r.indexOf(e.id)},e.getToggleGroupingHandler=()=>{let r=e.getCanGroup();return()=>{!r||e.toggleGrouping()}},e.getAutoAggregationFn=()=>{let r=t.getCoreRowModel().flatRows[0],n=r?.getValue(e.id);if(typeof n=="number")return YQ.sum;if(Object.prototype.toString.call(n)==="[object Date]")return YQ.extent},e.getAggregationFn=()=>{var r,n;if(!e)throw new Error;return e9(e.columnDef.aggregationFn)?e.columnDef.aggregationFn:e.columnDef.aggregationFn==="auto"?e.getAutoAggregationFn():(r=(n=t.options.aggregationFns)==null?void 0:n[e.columnDef.aggregationFn])!=null?r:YQ[e.columnDef.aggregationFn]}},createTable:e=>{e.setGrouping=t=>e.options.onGroupingChange==null?void 0:e.options.onGroupingChange(t),e.resetGrouping=t=>{var r,n;e.setGrouping(t?[]:(r=(n=e.initialState)==null?void 0:n.grouping)!=null?r:[])},e.getPreGroupedRowModel=()=>e.getFilteredRowModel(),e.getGroupedRowModel=()=>(!e._getGroupedRowModel&&e.options.getGroupedRowModel&&(e._getGroupedRowModel=e.options.getGroupedRowModel(e)),e.options.manualGrouping||!e._getGroupedRowModel?e.getPreGroupedRowModel():e._getGroupedRowModel())},createRow:(e,t)=>{e.getIsGrouped=()=>!!e.groupingColumnId,e.getGroupingValue=r=>{if(e._groupingValuesCache.hasOwnProperty(r))return e._groupingValuesCache[r];let n=t.getColumn(r);return n!=null&&n.columnDef.getGroupingValue?(e._groupingValuesCache[r]=n.columnDef.getGroupingValue(e.original),e._groupingValuesCache[r]):e.getValue(r)},e._groupingValuesCache={}},createCell:(e,t,r,n)=>{e.getIsGrouped=()=>t.getIsGrouped()&&t.id===r.groupingColumnId,e.getIsPlaceholder=()=>!e.getIsGrouped()&&t.getIsGrouped(),e.getIsAggregated=()=>{var i;return!e.getIsGrouped()&&!e.getIsPlaceholder()&&!!((i=r.subRows)!=null&&i.length)}}};function LZe(e,t,r){if(!(t!=null&&t.length)||!r)return e;let n=e.filter(a=>!t.includes(a.id));return r==="remove"?n:[...t.map(a=>e.find(o=>o.id===a)).filter(Boolean),...n]}var zZe={getInitialState:e=>({columnOrder:[],...e}),getDefaultOptions:e=>({onColumnOrderChange:Tf("columnOrder",e)}),createColumn:(e,t)=>{e.getIndex=Or(r=>[tD(t,r)],r=>r.findIndex(n=>n.id===e.id),Mr(t.options,"debugColumns","getIndex")),e.getIsFirstColumn=r=>{var n;return((n=tD(t,r)[0])==null?void 0:n.id)===e.id},e.getIsLastColumn=r=>{var n;let i=tD(t,r);return((n=i[i.length-1])==null?void 0:n.id)===e.id}},createTable:e=>{e.setColumnOrder=t=>e.options.onColumnOrderChange==null?void 0:e.options.onColumnOrderChange(t),e.resetColumnOrder=t=>{var r;e.setColumnOrder(t?[]:(r=e.initialState.columnOrder)!=null?r:[])},e._getOrderColumnsFn=Or(()=>[e.getState().columnOrder,e.getState().grouping,e.options.groupedColumnMode],(t,r,n)=>i=>{let a=[];if(!(t!=null&&t.length))a=i;else{let o=[...t],s=[...i];for(;s.length&&o.length;){let l=o.shift(),u=s.findIndex(c=>c.id===l);u>-1&&a.push(s.splice(u,1)[0])}a=[...a,...s]}return LZe(a,r,n)},Mr(e.options,"debugTable","_getOrderColumnsFn"))}},ZQ=()=>({left:[],right:[]}),UZe={getInitialState:e=>({columnPinning:ZQ(),...e}),getDefaultOptions:e=>({onColumnPinningChange:Tf("columnPinning",e)}),createColumn:(e,t)=>{e.pin=r=>{let n=e.getLeafColumns().map(i=>i.id).filter(Boolean);t.setColumnPinning(i=>{var a,o;if(r==="right"){var s,l;return{left:((s=i?.left)!=null?s:[]).filter(f=>!(n!=null&&n.includes(f))),right:[...((l=i?.right)!=null?l:[]).filter(f=>!(n!=null&&n.includes(f))),...n]}}if(r==="left"){var u,c;return{left:[...((u=i?.left)!=null?u:[]).filter(f=>!(n!=null&&n.includes(f))),...n],right:((c=i?.right)!=null?c:[]).filter(f=>!(n!=null&&n.includes(f)))}}return{left:((a=i?.left)!=null?a:[]).filter(f=>!(n!=null&&n.includes(f))),right:((o=i?.right)!=null?o:[]).filter(f=>!(n!=null&&n.includes(f)))}})},e.getCanPin=()=>e.getLeafColumns().some(n=>{var i,a,o;return((i=n.columnDef.enablePinning)!=null?i:!0)&&((a=(o=t.options.enableColumnPinning)!=null?o:t.options.enablePinning)!=null?a:!0)}),e.getIsPinned=()=>{let r=e.getLeafColumns().map(s=>s.id),{left:n,right:i}=t.getState().columnPinning,a=r.some(s=>n?.includes(s)),o=r.some(s=>i?.includes(s));return a?"left":o?"right":!1},e.getPinnedIndex=()=>{var r,n;let i=e.getIsPinned();return i?(r=(n=t.getState().columnPinning)==null||(n=n[i])==null?void 0:n.indexOf(e.id))!=null?r:-1:0}},createRow:(e,t)=>{e.getCenterVisibleCells=Or(()=>[e._getAllVisibleCells(),t.getState().columnPinning.left,t.getState().columnPinning.right],(r,n,i)=>{let a=[...n??[],...i??[]];return r.filter(o=>!a.includes(o.column.id))},Mr(t.options,"debugRows","getCenterVisibleCells")),e.getLeftVisibleCells=Or(()=>[e._getAllVisibleCells(),t.getState().columnPinning.left],(r,n)=>(n??[]).map(a=>r.find(o=>o.column.id===a)).filter(Boolean).map(a=>({...a,position:"left"})),Mr(t.options,"debugRows","getLeftVisibleCells")),e.getRightVisibleCells=Or(()=>[e._getAllVisibleCells(),t.getState().columnPinning.right],(r,n)=>(n??[]).map(a=>r.find(o=>o.column.id===a)).filter(Boolean).map(a=>({...a,position:"right"})),Mr(t.options,"debugRows","getRightVisibleCells"))},createTable:e=>{e.setColumnPinning=t=>e.options.onColumnPinningChange==null?void 0:e.options.onColumnPinningChange(t),e.resetColumnPinning=t=>{var r,n;return e.setColumnPinning(t?ZQ():(r=(n=e.initialState)==null?void 0:n.columnPinning)!=null?r:ZQ())},e.getIsSomeColumnsPinned=t=>{var r;let n=e.getState().columnPinning;if(!t){var i,a;return Boolean(((i=n.left)==null?void 0:i.length)||((a=n.right)==null?void 0:a.length))}return Boolean((r=n[t])==null?void 0:r.length)},e.getLeftLeafColumns=Or(()=>[e.getAllLeafColumns(),e.getState().columnPinning.left],(t,r)=>(r??[]).map(n=>t.find(i=>i.id===n)).filter(Boolean),Mr(e.options,"debugColumns","getLeftLeafColumns")),e.getRightLeafColumns=Or(()=>[e.getAllLeafColumns(),e.getState().columnPinning.right],(t,r)=>(r??[]).map(n=>t.find(i=>i.id===n)).filter(Boolean),Mr(e.options,"debugColumns","getRightLeafColumns")),e.getCenterLeafColumns=Or(()=>[e.getAllLeafColumns(),e.getState().columnPinning.left,e.getState().columnPinning.right],(t,r,n)=>{let i=[...r??[],...n??[]];return t.filter(a=>!i.includes(a.id))},Mr(e.options,"debugColumns","getCenterLeafColumns"))}},K5={size:150,minSize:20,maxSize:Number.MAX_SAFE_INTEGER},XQ=()=>({startOffset:null,startSize:null,deltaOffset:null,deltaPercentage:null,isResizingColumn:!1,columnSizingStart:[]}),WZe={getDefaultColumnDef:()=>K5,getInitialState:e=>({columnSizing:{},columnSizingInfo:XQ(),...e}),getDefaultOptions:e=>({columnResizeMode:"onEnd",columnResizeDirection:"ltr",onColumnSizingChange:Tf("columnSizing",e),onColumnSizingInfoChange:Tf("columnSizingInfo",e)}),createColumn:(e,t)=>{e.getSize=()=>{var r,n,i;let a=t.getState().columnSizing[e.id];return Math.min(Math.max((r=e.columnDef.minSize)!=null?r:K5.minSize,(n=a??e.columnDef.size)!=null?n:K5.size),(i=e.columnDef.maxSize)!=null?i:K5.maxSize)},e.getStart=Or(r=>[r,tD(t,r),t.getState().columnSizing],(r,n)=>n.slice(0,e.getIndex(r)).reduce((i,a)=>i+a.getSize(),0),Mr(t.options,"debugColumns","getStart")),e.getAfter=Or(r=>[r,tD(t,r),t.getState().columnSizing],(r,n)=>n.slice(e.getIndex(r)+1).reduce((i,a)=>i+a.getSize(),0),Mr(t.options,"debugColumns","getAfter")),e.resetSize=()=>{t.setColumnSizing(r=>{let{[e.id]:n,...i}=r;return i})},e.getCanResize=()=>{var r,n;return((r=e.columnDef.enableResizing)!=null?r:!0)&&((n=t.options.enableColumnResizing)!=null?n:!0)},e.getIsResizing=()=>t.getState().columnSizingInfo.isResizingColumn===e.id},createHeader:(e,t)=>{e.getSize=()=>{let r=0,n=i=>{if(i.subHeaders.length)i.subHeaders.forEach(n);else{var a;r+=(a=i.column.getSize())!=null?a:0}};return n(e),r},e.getStart=()=>{if(e.index>0){let r=e.headerGroup.headers[e.index-1];return r.getStart()+r.getSize()}return 0},e.getResizeHandler=r=>{let n=t.getColumn(e.column.id),i=n?.getCanResize();return a=>{if(!n||!i||(a.persist==null||a.persist(),KQ(a)&&a.touches&&a.touches.length>1))return;let o=e.getSize(),s=e?e.getLeafHeaders().map(A=>[A.column.id,A.column.getSize()]):[[n.id,n.getSize()]],l=KQ(a)?Math.round(a.touches[0].clientX):a.clientX,u={},c=(A,b)=>{typeof b=="number"&&(t.setColumnSizingInfo(v=>{var x,w;let S=t.options.columnResizeDirection==="rtl"?-1:1,k=(b-((x=v?.startOffset)!=null?x:0))*S,j=Math.max(k/((w=v?.startSize)!=null?w:0),-.999999);return v.columnSizingStart.forEach(O=>{let[C,N]=O;u[C]=Math.round(Math.max(N+N*j,0)*100)/100}),{...v,deltaOffset:k,deltaPercentage:j}}),(t.options.columnResizeMode==="onChange"||A==="end")&&t.setColumnSizing(v=>({...v,...u})))},f=A=>c("move",A),d=A=>{c("end",A),t.setColumnSizingInfo(b=>({...b,isResizingColumn:!1,startOffset:null,startSize:null,deltaOffset:null,deltaPercentage:null,columnSizingStart:[]}))},p=r||typeof document<"u"?document:null,h={moveHandler:A=>f(A.clientX),upHandler:A=>{p?.removeEventListener("mousemove",h.moveHandler),p?.removeEventListener("mouseup",h.upHandler),d(A.clientX)}},m={moveHandler:A=>(A.cancelable&&(A.preventDefault(),A.stopPropagation()),f(A.touches[0].clientX),!1),upHandler:A=>{var b;p?.removeEventListener("touchmove",m.moveHandler),p?.removeEventListener("touchend",m.upHandler),A.cancelable&&(A.preventDefault(),A.stopPropagation()),d((b=A.touches[0])==null?void 0:b.clientX)}},g=HZe()?{passive:!1}:!1;KQ(a)?(p?.addEventListener("touchmove",m.moveHandler,g),p?.addEventListener("touchend",m.upHandler,g)):(p?.addEventListener("mousemove",h.moveHandler,g),p?.addEventListener("mouseup",h.upHandler,g)),t.setColumnSizingInfo(A=>({...A,startOffset:l,startSize:o,deltaOffset:0,deltaPercentage:0,columnSizingStart:s,isResizingColumn:n.id}))}}},createTable:e=>{e.setColumnSizing=t=>e.options.onColumnSizingChange==null?void 0:e.options.onColumnSizingChange(t),e.setColumnSizingInfo=t=>e.options.onColumnSizingInfoChange==null?void 0:e.options.onColumnSizingInfoChange(t),e.resetColumnSizing=t=>{var r;e.setColumnSizing(t?{}:(r=e.initialState.columnSizing)!=null?r:{})},e.resetHeaderSizeInfo=t=>{var r;e.setColumnSizingInfo(t?XQ():(r=e.initialState.columnSizingInfo)!=null?r:XQ())},e.getTotalSize=()=>{var t,r;return(t=(r=e.getHeaderGroups()[0])==null?void 0:r.headers.reduce((n,i)=>n+i.getSize(),0))!=null?t:0},e.getLeftTotalSize=()=>{var t,r;return(t=(r=e.getLeftHeaderGroups()[0])==null?void 0:r.headers.reduce((n,i)=>n+i.getSize(),0))!=null?t:0},e.getCenterTotalSize=()=>{var t,r;return(t=(r=e.getCenterHeaderGroups()[0])==null?void 0:r.headers.reduce((n,i)=>n+i.getSize(),0))!=null?t:0},e.getRightTotalSize=()=>{var t,r;return(t=(r=e.getRightHeaderGroups()[0])==null?void 0:r.headers.reduce((n,i)=>n+i.getSize(),0))!=null?t:0}}},J5=null;function HZe(){if(typeof J5=="boolean")return J5;let e=!1;try{let t={get passive(){return e=!0,!1}},r=()=>{};window.addEventListener("test",r,t),window.removeEventListener("test",r)}catch{e=!1}return J5=e,J5}function KQ(e){return e.type==="touchstart"}var VZe={getInitialState:e=>({columnVisibility:{},...e}),getDefaultOptions:e=>({onColumnVisibilityChange:Tf("columnVisibility",e)}),createColumn:(e,t)=>{e.toggleVisibility=r=>{e.getCanHide()&&t.setColumnVisibility(n=>({...n,[e.id]:r??!e.getIsVisible()}))},e.getIsVisible=()=>{var r,n;let i=e.columns;return(r=i.length?i.some(a=>a.getIsVisible()):(n=t.getState().columnVisibility)==null?void 0:n[e.id])!=null?r:!0},e.getCanHide=()=>{var r,n;return((r=e.columnDef.enableHiding)!=null?r:!0)&&((n=t.options.enableHiding)!=null?n:!0)},e.getToggleVisibilityHandler=()=>r=>{e.toggleVisibility==null||e.toggleVisibility(r.target.checked)}},createRow:(e,t)=>{e._getAllVisibleCells=Or(()=>[e.getAllCells(),t.getState().columnVisibility],r=>r.filter(n=>n.column.getIsVisible()),Mr(t.options,"debugRows","_getAllVisibleCells")),e.getVisibleCells=Or(()=>[e.getLeftVisibleCells(),e.getCenterVisibleCells(),e.getRightVisibleCells()],(r,n,i)=>[...r,...n,...i],Mr(t.options,"debugRows","getVisibleCells"))},createTable:e=>{let t=(r,n)=>Or(()=>[n(),n().filter(i=>i.getIsVisible()).map(i=>i.id).join("_")],i=>i.filter(a=>a.getIsVisible==null?void 0:a.getIsVisible()),Mr(e.options,"debugColumns",r));e.getVisibleFlatColumns=t("getVisibleFlatColumns",()=>e.getAllFlatColumns()),e.getVisibleLeafColumns=t("getVisibleLeafColumns",()=>e.getAllLeafColumns()),e.getLeftVisibleLeafColumns=t("getLeftVisibleLeafColumns",()=>e.getLeftLeafColumns()),e.getRightVisibleLeafColumns=t("getRightVisibleLeafColumns",()=>e.getRightLeafColumns()),e.getCenterVisibleLeafColumns=t("getCenterVisibleLeafColumns",()=>e.getCenterLeafColumns()),e.setColumnVisibility=r=>e.options.onColumnVisibilityChange==null?void 0:e.options.onColumnVisibilityChange(r),e.resetColumnVisibility=r=>{var n;e.setColumnVisibility(r?{}:(n=e.initialState.columnVisibility)!=null?n:{})},e.toggleAllColumnsVisible=r=>{var n;r=(n=r)!=null?n:!e.getIsAllColumnsVisible(),e.setColumnVisibility(e.getAllLeafColumns().reduce((i,a)=>({...i,[a.id]:r||!(a.getCanHide!=null&&a.getCanHide())}),{}))},e.getIsAllColumnsVisible=()=>!e.getAllLeafColumns().some(r=>!(r.getIsVisible!=null&&r.getIsVisible())),e.getIsSomeColumnsVisible=()=>e.getAllLeafColumns().some(r=>r.getIsVisible==null?void 0:r.getIsVisible()),e.getToggleAllColumnsVisibilityHandler=()=>r=>{var n;e.toggleAllColumnsVisible((n=r.target)==null?void 0:n.checked)}}};function tD(e,t){return t?t==="center"?e.getCenterVisibleLeafColumns():t==="left"?e.getLeftVisibleLeafColumns():e.getRightVisibleLeafColumns():e.getVisibleLeafColumns()}var GZe={getInitialState:e=>({globalFilter:void 0,...e}),getDefaultOptions:e=>({onGlobalFilterChange:Tf("globalFilter",e),globalFilterFn:"auto",getColumnCanGlobalFilter:t=>{var r;let n=(r=e.getCoreRowModel().flatRows[0])==null||(r=r._getAllCellsByColumnId()[t.id])==null?void 0:r.getValue();return typeof n=="string"||typeof n=="number"}}),createColumn:(e,t)=>{e.getCanGlobalFilter=()=>{var r,n,i,a;return((r=e.columnDef.enableGlobalFilter)!=null?r:!0)&&((n=t.options.enableGlobalFilter)!=null?n:!0)&&((i=t.options.enableFilters)!=null?i:!0)&&((a=t.options.getColumnCanGlobalFilter==null?void 0:t.options.getColumnCanGlobalFilter(e))!=null?a:!0)&&!!e.accessorFn}},createTable:e=>{e.getGlobalAutoFilterFn=()=>tg.includesString,e.getGlobalFilterFn=()=>{var t,r;let{globalFilterFn:n}=e.options;return e9(n)?n:n==="auto"?e.getGlobalAutoFilterFn():(t=(r=e.options.filterFns)==null?void 0:r[n])!=null?t:tg[n]},e.setGlobalFilter=t=>{e.options.onGlobalFilterChange==null||e.options.onGlobalFilterChange(t)},e.resetGlobalFilter=t=>{e.setGlobalFilter(t?void 0:e.initialState.globalFilter)},e._getGlobalFacetedRowModel=e.options.getFacetedRowModel&&e.options.getFacetedRowModel(e,"__global__"),e.getGlobalFacetedRowModel=()=>e.options.manualFiltering||!e._getGlobalFacetedRowModel?e.getPreFilteredRowModel():e._getGlobalFacetedRowModel(),e._getGlobalFacetedUniqueValues=e.options.getFacetedUniqueValues&&e.options.getFacetedUniqueValues(e,"__global__"),e.getGlobalFacetedUniqueValues=()=>e._getGlobalFacetedUniqueValues?e._getGlobalFacetedUniqueValues():new Map,e._getGlobalFacetedMinMaxValues=e.options.getFacetedMinMaxValues&&e.options.getFacetedMinMaxValues(e,"__global__"),e.getGlobalFacetedMinMaxValues=()=>{if(!!e._getGlobalFacetedMinMaxValues)return e._getGlobalFacetedMinMaxValues()}}},QZe={getInitialState:e=>({expanded:{},...e}),getDefaultOptions:e=>({onExpandedChange:Tf("expanded",e),paginateExpandedRows:!0}),createTable:e=>{let t=!1,r=!1;e._autoResetExpanded=()=>{var n,i;if(!t){e._queue(()=>{t=!0});return}if((n=(i=e.options.autoResetAll)!=null?i:e.options.autoResetExpanded)!=null?n:!e.options.manualExpanding){if(r)return;r=!0,e._queue(()=>{e.resetExpanded(),r=!1})}},e.setExpanded=n=>e.options.onExpandedChange==null?void 0:e.options.onExpandedChange(n),e.toggleAllRowsExpanded=n=>{n??!e.getIsAllRowsExpanded()?e.setExpanded(!0):e.setExpanded({})},e.resetExpanded=n=>{var i,a;e.setExpanded(n?{}:(i=(a=e.initialState)==null?void 0:a.expanded)!=null?i:{})},e.getCanSomeRowsExpand=()=>e.getPrePaginationRowModel().flatRows.some(n=>n.getCanExpand()),e.getToggleAllRowsExpandedHandler=()=>n=>{n.persist==null||n.persist(),e.toggleAllRowsExpanded()},e.getIsSomeRowsExpanded=()=>{let n=e.getState().expanded;return n===!0||Object.values(n).some(Boolean)},e.getIsAllRowsExpanded=()=>{let n=e.getState().expanded;return typeof n=="boolean"?n===!0:!(!Object.keys(n).length||e.getRowModel().flatRows.some(i=>!i.getIsExpanded()))},e.getExpandedDepth=()=>{let n=0;return(e.getState().expanded===!0?Object.keys(e.getRowModel().rowsById):Object.keys(e.getState().expanded)).forEach(a=>{let o=a.split(".");n=Math.max(n,o.length)}),n},e.getPreExpandedRowModel=()=>e.getSortedRowModel(),e.getExpandedRowModel=()=>(!e._getExpandedRowModel&&e.options.getExpandedRowModel&&(e._getExpandedRowModel=e.options.getExpandedRowModel(e)),e.options.manualExpanding||!e._getExpandedRowModel?e.getPreExpandedRowModel():e._getExpandedRowModel())},createRow:(e,t)=>{e.toggleExpanded=r=>{t.setExpanded(n=>{var i;let a=n===!0?!0:!!(n!=null&&n[e.id]),o={};if(n===!0?Object.keys(t.getRowModel().rowsById).forEach(s=>{o[s]=!0}):o=n,r=(i=r)!=null?i:!a,!a&&r)return{...o,[e.id]:!0};if(a&&!r){let{[e.id]:s,...l}=o;return l}return n})},e.getIsExpanded=()=>{var r;let n=t.getState().expanded;return!!((r=t.options.getIsRowExpanded==null?void 0:t.options.getIsRowExpanded(e))!=null?r:n===!0||n?.[e.id])},e.getCanExpand=()=>{var r,n,i;return(r=t.options.getRowCanExpand==null?void 0:t.options.getRowCanExpand(e))!=null?r:((n=t.options.enableExpanding)!=null?n:!0)&&!!((i=e.subRows)!=null&&i.length)},e.getIsAllParentsExpanded=()=>{let r=!0,n=e;for(;r&&n.parentId;)n=t.getRow(n.parentId,!0),r=n.getIsExpanded();return r},e.getToggleExpandedHandler=()=>{let r=e.getCanExpand();return()=>{!r||e.toggleExpanded()}}}},rY=0,nY=10,JQ=()=>({pageIndex:rY,pageSize:nY}),YZe={getInitialState:e=>({...e,pagination:{...JQ(),...e?.pagination}}),getDefaultOptions:e=>({onPaginationChange:Tf("pagination",e)}),createTable:e=>{let t=!1,r=!1;e._autoResetPageIndex=()=>{var n,i;if(!t){e._queue(()=>{t=!0});return}if((n=(i=e.options.autoResetAll)!=null?i:e.options.autoResetPageIndex)!=null?n:!e.options.manualPagination){if(r)return;r=!0,e._queue(()=>{e.resetPageIndex(),r=!1})}},e.setPagination=n=>{let i=a=>Sv(n,a);return e.options.onPaginationChange==null?void 0:e.options.onPaginationChange(i)},e.resetPagination=n=>{var i;e.setPagination(n?JQ():(i=e.initialState.pagination)!=null?i:JQ())},e.setPageIndex=n=>{e.setPagination(i=>{let a=Sv(n,i.pageIndex),o=typeof e.options.pageCount>"u"||e.options.pageCount===-1?Number.MAX_SAFE_INTEGER:e.options.pageCount-1;return a=Math.max(0,Math.min(a,o)),{...i,pageIndex:a}})},e.resetPageIndex=n=>{var i,a;e.setPageIndex(n?rY:(i=(a=e.initialState)==null||(a=a.pagination)==null?void 0:a.pageIndex)!=null?i:rY)},e.resetPageSize=n=>{var i,a;e.setPageSize(n?nY:(i=(a=e.initialState)==null||(a=a.pagination)==null?void 0:a.pageSize)!=null?i:nY)},e.setPageSize=n=>{e.setPagination(i=>{let a=Math.max(1,Sv(n,i.pageSize)),o=i.pageSize*i.pageIndex,s=Math.floor(o/a);return{...i,pageIndex:s,pageSize:a}})},e.setPageCount=n=>e.setPagination(i=>{var a;let o=Sv(n,(a=e.options.pageCount)!=null?a:-1);return typeof o=="number"&&(o=Math.max(-1,o)),{...i,pageCount:o}}),e.getPageOptions=Or(()=>[e.getPageCount()],n=>{let i=[];return n&&n>0&&(i=[...new Array(n)].fill(null).map((a,o)=>o)),i},Mr(e.options,"debugTable","getPageOptions")),e.getCanPreviousPage=()=>e.getState().pagination.pageIndex>0,e.getCanNextPage=()=>{let{pageIndex:n}=e.getState().pagination,i=e.getPageCount();return i===-1?!0:i===0?!1:ne.setPageIndex(n=>n-1),e.nextPage=()=>e.setPageIndex(n=>n+1),e.firstPage=()=>e.setPageIndex(0),e.lastPage=()=>e.setPageIndex(e.getPageCount()-1),e.getPrePaginationRowModel=()=>e.getExpandedRowModel(),e.getPaginationRowModel=()=>(!e._getPaginationRowModel&&e.options.getPaginationRowModel&&(e._getPaginationRowModel=e.options.getPaginationRowModel(e)),e.options.manualPagination||!e._getPaginationRowModel?e.getPrePaginationRowModel():e._getPaginationRowModel()),e.getPageCount=()=>{var n;return(n=e.options.pageCount)!=null?n:Math.ceil(e.getRowCount()/e.getState().pagination.pageSize)},e.getRowCount=()=>{var n;return(n=e.options.rowCount)!=null?n:e.getPrePaginationRowModel().rows.length}}},eY=()=>({top:[],bottom:[]}),ZZe={getInitialState:e=>({rowPinning:eY(),...e}),getDefaultOptions:e=>({onRowPinningChange:Tf("rowPinning",e)}),createRow:(e,t)=>{e.pin=(r,n,i)=>{let a=n?e.getLeafRows().map(l=>{let{id:u}=l;return u}):[],o=i?e.getParentRows().map(l=>{let{id:u}=l;return u}):[],s=new Set([...o,e.id,...a]);t.setRowPinning(l=>{var u,c;if(r==="bottom"){var f,d;return{top:((f=l?.top)!=null?f:[]).filter(m=>!(s!=null&&s.has(m))),bottom:[...((d=l?.bottom)!=null?d:[]).filter(m=>!(s!=null&&s.has(m))),...Array.from(s)]}}if(r==="top"){var p,h;return{top:[...((p=l?.top)!=null?p:[]).filter(m=>!(s!=null&&s.has(m))),...Array.from(s)],bottom:((h=l?.bottom)!=null?h:[]).filter(m=>!(s!=null&&s.has(m)))}}return{top:((u=l?.top)!=null?u:[]).filter(m=>!(s!=null&&s.has(m))),bottom:((c=l?.bottom)!=null?c:[]).filter(m=>!(s!=null&&s.has(m)))}})},e.getCanPin=()=>{var r;let{enableRowPinning:n,enablePinning:i}=t.options;return typeof n=="function"?n(e):(r=n??i)!=null?r:!0},e.getIsPinned=()=>{let r=[e.id],{top:n,bottom:i}=t.getState().rowPinning,a=r.some(s=>n?.includes(s)),o=r.some(s=>i?.includes(s));return a?"top":o?"bottom":!1},e.getPinnedIndex=()=>{var r,n;let i=e.getIsPinned();if(!i)return-1;let a=(r=t._getPinnedRows(i))==null?void 0:r.map(o=>{let{id:s}=o;return s});return(n=a?.indexOf(e.id))!=null?n:-1}},createTable:e=>{e.setRowPinning=t=>e.options.onRowPinningChange==null?void 0:e.options.onRowPinningChange(t),e.resetRowPinning=t=>{var r,n;return e.setRowPinning(t?eY():(r=(n=e.initialState)==null?void 0:n.rowPinning)!=null?r:eY())},e.getIsSomeRowsPinned=t=>{var r;let n=e.getState().rowPinning;if(!t){var i,a;return Boolean(((i=n.top)==null?void 0:i.length)||((a=n.bottom)==null?void 0:a.length))}return Boolean((r=n[t])==null?void 0:r.length)},e._getPinnedRows=Or(t=>[e.getRowModel().rows,e.getState().rowPinning[t],t],(t,r,n)=>{var i;return((i=e.options.keepPinnedRows)==null||i?(r??[]).map(o=>{let s=e.getRow(o,!0);return s.getIsAllParentsExpanded()?s:null}):(r??[]).map(o=>t.find(s=>s.id===o))).filter(Boolean).map(o=>({...o,position:n}))},Mr(e.options,"debugRows","_getPinnedRows")),e.getTopRows=()=>e._getPinnedRows("top"),e.getBottomRows=()=>e._getPinnedRows("bottom"),e.getCenterRows=Or(()=>[e.getRowModel().rows,e.getState().rowPinning.top,e.getState().rowPinning.bottom],(t,r,n)=>{let i=new Set([...r??[],...n??[]]);return t.filter(a=>!i.has(a.id))},Mr(e.options,"debugRows","getCenterRows"))}},XZe={getInitialState:e=>({rowSelection:{},...e}),getDefaultOptions:e=>({onRowSelectionChange:Tf("rowSelection",e),enableRowSelection:!0,enableMultiRowSelection:!0,enableSubRowSelection:!0}),createTable:e=>{e.setRowSelection=t=>e.options.onRowSelectionChange==null?void 0:e.options.onRowSelectionChange(t),e.resetRowSelection=t=>{var r;return e.setRowSelection(t?{}:(r=e.initialState.rowSelection)!=null?r:{})},e.toggleAllRowsSelected=t=>{e.setRowSelection(r=>{t=typeof t<"u"?t:!e.getIsAllRowsSelected();let n={...r},i=e.getPreGroupedRowModel().flatRows;return t?i.forEach(a=>{!a.getCanSelect()||(n[a.id]=!0)}):i.forEach(a=>{delete n[a.id]}),n})},e.toggleAllPageRowsSelected=t=>e.setRowSelection(r=>{let n=typeof t<"u"?t:!e.getIsAllPageRowsSelected(),i={...r};return e.getRowModel().rows.forEach(a=>{iY(i,a.id,n,!0,e)}),i}),e.getPreSelectedRowModel=()=>e.getCoreRowModel(),e.getSelectedRowModel=Or(()=>[e.getState().rowSelection,e.getCoreRowModel()],(t,r)=>Object.keys(t).length?tY(e,r):{rows:[],flatRows:[],rowsById:{}},Mr(e.options,"debugTable","getSelectedRowModel")),e.getFilteredSelectedRowModel=Or(()=>[e.getState().rowSelection,e.getFilteredRowModel()],(t,r)=>Object.keys(t).length?tY(e,r):{rows:[],flatRows:[],rowsById:{}},Mr(e.options,"debugTable","getFilteredSelectedRowModel")),e.getGroupedSelectedRowModel=Or(()=>[e.getState().rowSelection,e.getSortedRowModel()],(t,r)=>Object.keys(t).length?tY(e,r):{rows:[],flatRows:[],rowsById:{}},Mr(e.options,"debugTable","getGroupedSelectedRowModel")),e.getIsAllRowsSelected=()=>{let t=e.getFilteredRowModel().flatRows,{rowSelection:r}=e.getState(),n=Boolean(t.length&&Object.keys(r).length);return n&&t.some(i=>i.getCanSelect()&&!r[i.id])&&(n=!1),n},e.getIsAllPageRowsSelected=()=>{let t=e.getPaginationRowModel().flatRows.filter(i=>i.getCanSelect()),{rowSelection:r}=e.getState(),n=!!t.length;return n&&t.some(i=>!r[i.id])&&(n=!1),n},e.getIsSomeRowsSelected=()=>{var t;let r=Object.keys((t=e.getState().rowSelection)!=null?t:{}).length;return r>0&&r{let t=e.getPaginationRowModel().flatRows;return e.getIsAllPageRowsSelected()?!1:t.filter(r=>r.getCanSelect()).some(r=>r.getIsSelected()||r.getIsSomeSelected())},e.getToggleAllRowsSelectedHandler=()=>t=>{e.toggleAllRowsSelected(t.target.checked)},e.getToggleAllPageRowsSelectedHandler=()=>t=>{e.toggleAllPageRowsSelected(t.target.checked)}},createRow:(e,t)=>{e.toggleSelected=(r,n)=>{let i=e.getIsSelected();t.setRowSelection(a=>{var o;if(r=typeof r<"u"?r:!i,e.getCanSelect()&&i===r)return a;let s={...a};return iY(s,e.id,r,(o=n?.selectChildren)!=null?o:!0,t),s})},e.getIsSelected=()=>{let{rowSelection:r}=t.getState();return lY(e,r)},e.getIsSomeSelected=()=>{let{rowSelection:r}=t.getState();return aY(e,r)==="some"},e.getIsAllSubRowsSelected=()=>{let{rowSelection:r}=t.getState();return aY(e,r)==="all"},e.getCanSelect=()=>{var r;return typeof t.options.enableRowSelection=="function"?t.options.enableRowSelection(e):(r=t.options.enableRowSelection)!=null?r:!0},e.getCanSelectSubRows=()=>{var r;return typeof t.options.enableSubRowSelection=="function"?t.options.enableSubRowSelection(e):(r=t.options.enableSubRowSelection)!=null?r:!0},e.getCanMultiSelect=()=>{var r;return typeof t.options.enableMultiRowSelection=="function"?t.options.enableMultiRowSelection(e):(r=t.options.enableMultiRowSelection)!=null?r:!0},e.getToggleSelectedHandler=()=>{let r=e.getCanSelect();return n=>{var i;!r||e.toggleSelected((i=n.target)==null?void 0:i.checked)}}}},iY=(e,t,r,n,i)=>{var a;let o=i.getRow(t,!0);r?(o.getCanMultiSelect()||Object.keys(e).forEach(s=>delete e[s]),o.getCanSelect()&&(e[t]=!0)):delete e[t],n&&(a=o.subRows)!=null&&a.length&&o.getCanSelectSubRows()&&o.subRows.forEach(s=>iY(e,s.id,r,n,i))};function tY(e,t){let r=e.getState().rowSelection,n=[],i={},a=function(o,s){return o.map(l=>{var u;let c=lY(l,r);if(c&&(n.push(l),i[l.id]=l),(u=l.subRows)!=null&&u.length&&(l={...l,subRows:a(l.subRows)}),c)return l}).filter(Boolean)};return{rows:a(t.rows),flatRows:n,rowsById:i}}function lY(e,t){var r;return(r=t[e.id])!=null?r:!1}function aY(e,t,r){var n;if(!((n=e.subRows)!=null&&n.length))return!1;let i=!0,a=!1;return e.subRows.forEach(o=>{if(!(a&&!i)&&(o.getCanSelect()&&(lY(o,t)?a=!0:i=!1),o.subRows&&o.subRows.length)){let s=aY(o,t);s==="all"?a=!0:(s==="some"&&(a=!0),i=!1)}}),i?"all":a?"some":!1}var oY=/([0-9]+)/gm,KZe=(e,t,r)=>p2e(Ev(e.getValue(r)).toLowerCase(),Ev(t.getValue(r)).toLowerCase()),JZe=(e,t,r)=>p2e(Ev(e.getValue(r)),Ev(t.getValue(r))),eXe=(e,t,r)=>uY(Ev(e.getValue(r)).toLowerCase(),Ev(t.getValue(r)).toLowerCase()),tXe=(e,t,r)=>uY(Ev(e.getValue(r)),Ev(t.getValue(r))),rXe=(e,t,r)=>{let n=e.getValue(r),i=t.getValue(r);return n>i?1:nuY(e.getValue(r),t.getValue(r));function uY(e,t){return e===t?0:e>t?1:-1}function Ev(e){return typeof e=="number"?isNaN(e)||e===1/0||e===-1/0?"":String(e):typeof e=="string"?e:""}function p2e(e,t){let r=e.split(oY).filter(Boolean),n=t.split(oY).filter(Boolean);for(;r.length&&n.length;){let i=r.shift(),a=n.shift(),o=parseInt(i,10),s=parseInt(a,10),l=[o,s].sort();if(isNaN(l[0])){if(i>a)return 1;if(a>i)return-1;continue}if(isNaN(l[1]))return isNaN(o)?-1:1;if(o>s)return 1;if(s>o)return-1}return r.length-n.length}var eD={alphanumeric:KZe,alphanumericCaseSensitive:JZe,text:eXe,textCaseSensitive:tXe,datetime:rXe,basic:nXe},iXe={getInitialState:e=>({sorting:[],...e}),getDefaultColumnDef:()=>({sortingFn:"auto",sortUndefined:1}),getDefaultOptions:e=>({onSortingChange:Tf("sorting",e),isMultiSortEvent:t=>t.shiftKey}),createColumn:(e,t)=>{e.getAutoSortingFn=()=>{let r=t.getFilteredRowModel().flatRows.slice(10),n=!1;for(let i of r){let a=i?.getValue(e.id);if(Object.prototype.toString.call(a)==="[object Date]")return eD.datetime;if(typeof a=="string"&&(n=!0,a.split(oY).length>1))return eD.alphanumeric}return n?eD.text:eD.basic},e.getAutoSortDir=()=>{let r=t.getFilteredRowModel().flatRows[0];return typeof r?.getValue(e.id)=="string"?"asc":"desc"},e.getSortingFn=()=>{var r,n;if(!e)throw new Error;return e9(e.columnDef.sortingFn)?e.columnDef.sortingFn:e.columnDef.sortingFn==="auto"?e.getAutoSortingFn():(r=(n=t.options.sortingFns)==null?void 0:n[e.columnDef.sortingFn])!=null?r:eD[e.columnDef.sortingFn]},e.toggleSorting=(r,n)=>{let i=e.getNextSortingOrder(),a=typeof r<"u"&&r!==null;t.setSorting(o=>{let s=o?.find(p=>p.id===e.id),l=o?.findIndex(p=>p.id===e.id),u=[],c,f=a?r:i==="desc";if(o!=null&&o.length&&e.getCanMultiSort()&&n?s?c="toggle":c="add":o!=null&&o.length&&l!==o.length-1?c="replace":s?c="toggle":c="replace",c==="toggle"&&(a||i||(c="remove")),c==="add"){var d;u=[...o,{id:e.id,desc:f}],u.splice(0,u.length-((d=t.options.maxMultiSortColCount)!=null?d:Number.MAX_SAFE_INTEGER))}else c==="toggle"?u=o.map(p=>p.id===e.id?{...p,desc:f}:p):c==="remove"?u=o.filter(p=>p.id!==e.id):u=[{id:e.id,desc:f}];return u})},e.getFirstSortDir=()=>{var r,n;return((r=(n=e.columnDef.sortDescFirst)!=null?n:t.options.sortDescFirst)!=null?r:e.getAutoSortDir()==="desc")?"desc":"asc"},e.getNextSortingOrder=r=>{var n,i;let a=e.getFirstSortDir(),o=e.getIsSorted();return o?o!==a&&((n=t.options.enableSortingRemoval)!=null?n:!0)&&(r&&(i=t.options.enableMultiRemove)!=null?i:!0)?!1:o==="desc"?"asc":"desc":a},e.getCanSort=()=>{var r,n;return((r=e.columnDef.enableSorting)!=null?r:!0)&&((n=t.options.enableSorting)!=null?n:!0)&&!!e.accessorFn},e.getCanMultiSort=()=>{var r,n;return(r=(n=e.columnDef.enableMultiSort)!=null?n:t.options.enableMultiSort)!=null?r:!!e.accessorFn},e.getIsSorted=()=>{var r;let n=(r=t.getState().sorting)==null?void 0:r.find(i=>i.id===e.id);return n?n.desc?"desc":"asc":!1},e.getSortIndex=()=>{var r,n;return(r=(n=t.getState().sorting)==null?void 0:n.findIndex(i=>i.id===e.id))!=null?r:-1},e.clearSorting=()=>{t.setSorting(r=>r!=null&&r.length?r.filter(n=>n.id!==e.id):[])},e.getToggleSortingHandler=()=>{let r=e.getCanSort();return n=>{!r||(n.persist==null||n.persist(),e.toggleSorting==null||e.toggleSorting(void 0,e.getCanMultiSort()?t.options.isMultiSortEvent==null?void 0:t.options.isMultiSortEvent(n):!1))}}},createTable:e=>{e.setSorting=t=>e.options.onSortingChange==null?void 0:e.options.onSortingChange(t),e.resetSorting=t=>{var r,n;e.setSorting(t?[]:(r=(n=e.initialState)==null?void 0:n.sorting)!=null?r:[])},e.getPreSortedRowModel=()=>e.getGroupedRowModel(),e.getSortedRowModel=()=>(!e._getSortedRowModel&&e.options.getSortedRowModel&&(e._getSortedRowModel=e.options.getSortedRowModel(e)),e.options.manualSorting||!e._getSortedRowModel?e.getPreSortedRowModel():e._getSortedRowModel())}},aXe=[OZe,VZe,zZe,UZe,MZe,jZe,GZe,iXe,qZe,QZe,YZe,ZZe,XZe,WZe];function m2e(e){var t,r;let n=[...aXe,...(t=e._features)!=null?t:[]],i={_features:n},a=i._features.reduce((d,p)=>Object.assign(d,p.getDefaultOptions==null?void 0:p.getDefaultOptions(i)),{}),o=d=>i.options.mergeOptions?i.options.mergeOptions(a,d):{...a,...d},l={...{},...(r=e.initialState)!=null?r:{}};i._features.forEach(d=>{var p;l=(p=d.getInitialState==null?void 0:d.getInitialState(l))!=null?p:l});let u=[],c=!1,f={_features:n,options:{...a,...e},initialState:l,_queue:d=>{u.push(d),c||(c=!0,Promise.resolve().then(()=>{for(;u.length;)u.shift()();c=!1}).catch(p=>setTimeout(()=>{throw p})))},reset:()=>{i.setState(i.initialState)},setOptions:d=>{let p=Sv(d,i.options);i.options=o(p)},getState:()=>i.options.state,setState:d=>{i.options.onStateChange==null||i.options.onStateChange(d)},_getRowId:(d,p,h)=>{var m;return(m=i.options.getRowId==null?void 0:i.options.getRowId(d,p,h))!=null?m:`${h?[h.id,p].join("."):p}`},getCoreRowModel:()=>(i._getCoreRowModel||(i._getCoreRowModel=i.options.getCoreRowModel(i)),i._getCoreRowModel()),getRowModel:()=>i.getPaginationRowModel(),getRow:(d,p)=>{let h=(p?i.getPrePaginationRowModel():i.getRowModel()).rowsById[d];if(!h&&(h=i.getCoreRowModel().rowsById[d],!h))throw new Error;return h},_getDefaultColumnDef:Or(()=>[i.options.defaultColumn],d=>{var p;return d=(p=d)!=null?p:{},{header:h=>{let m=h.header.column.columnDef;return m.accessorKey?m.accessorKey:m.accessorFn?m.id:null},cell:h=>{var m,g;return(m=(g=h.renderValue())==null||g.toString==null?void 0:g.toString())!=null?m:null},...i._features.reduce((h,m)=>Object.assign(h,m.getDefaultColumnDef==null?void 0:m.getDefaultColumnDef()),{}),...d}},Mr(e,"debugColumns","_getDefaultColumnDef")),_getColumnDefs:()=>i.options.columns,getAllColumns:Or(()=>[i._getColumnDefs()],d=>{let p=function(h,m,g){return g===void 0&&(g=0),h.map(A=>{let b=DZe(i,A,g,m),v=A;return b.columns=v.columns?p(v.columns,b,g+1):[],b})};return p(d)},Mr(e,"debugColumns","getAllColumns")),getAllFlatColumns:Or(()=>[i.getAllColumns()],d=>d.flatMap(p=>p.getFlatColumns()),Mr(e,"debugColumns","getAllFlatColumns")),_getAllFlatColumnsById:Or(()=>[i.getAllFlatColumns()],d=>d.reduce((p,h)=>(p[h.id]=h,p),{}),Mr(e,"debugColumns","getAllFlatColumnsById")),getAllLeafColumns:Or(()=>[i.getAllColumns(),i._getOrderColumnsFn()],(d,p)=>{let h=d.flatMap(m=>m.getLeafColumns());return p(h)},Mr(e,"debugColumns","getAllLeafColumns")),getColumn:d=>i._getAllFlatColumnsById()[d]};Object.assign(i,f);for(let d=0;dOr(()=>[e.options.data],t=>{let r={rows:[],flatRows:[],rowsById:{}},n=function(i,a,o){a===void 0&&(a=0);let s=[];for(let u=0;ue._autoResetPageIndex()))}function A2e(){return e=>Or(()=>[e.getState().expanded,e.getPreExpandedRowModel(),e.options.paginateExpandedRows],(t,r,n)=>!r.rows.length||t!==!0&&!Object.keys(t??{}).length||!n?r:g2e(r),Mr(e.options,"debugTable","getExpandedRowModel"))}function g2e(e){let t=[],r=n=>{var i;t.push(n),(i=n.subRows)!=null&&i.length&&n.getIsExpanded()&&n.subRows.forEach(r)};return e.rows.forEach(r),{rows:t,flatRows:e.flatRows,rowsById:e.rowsById}}function v2e(){return e=>Or(()=>[e.getState().grouping,e.getPreGroupedRowModel()],(t,r)=>{if(!r.rows.length||!t.length)return r;let n=t.filter(l=>e.getColumn(l)),i=[],a={},o=function(l,u,c){if(u===void 0&&(u=0),u>=n.length)return l.map(h=>(h.depth=u,i.push(h),a[h.id]=h,h.subRows&&(h.subRows=o(h.subRows,u+1,h.id)),h));let f=n[u],d=oXe(l,f);return Array.from(d.entries()).map((h,m)=>{let[g,A]=h,b=`${f}:${g}`;b=c?`${c}>${b}`:b;let v=o(A,u+1,b),x=u?n2e(A,S=>S.subRows):A,w=i2e(e,b,x[0].original,m,u,void 0,c);return Object.assign(w,{groupingColumnId:f,groupingValue:g,subRows:v,leafRows:x,getValue:S=>{if(n.includes(S)){if(w._valuesCache.hasOwnProperty(S))return w._valuesCache[S];if(A[0]){var k;w._valuesCache[S]=(k=A[0].getValue(S))!=null?k:void 0}return w._valuesCache[S]}if(w._groupingValuesCache.hasOwnProperty(S))return w._groupingValuesCache[S];let j=e.getColumn(S),O=j?.getAggregationFn();if(O)return w._groupingValuesCache[S]=O(S,x,A),w._groupingValuesCache[S]}}),v.forEach(S=>{i.push(S),a[S.id]=S}),w})},s=o(r.rows,0);return s.forEach(l=>{i.push(l),a[l.id]=l}),{rows:s,flatRows:i,rowsById:a}},Mr(e.options,"debugTable","getGroupedRowModel",()=>{e._queue(()=>{e._autoResetExpanded(),e._autoResetPageIndex()})}))}function oXe(e,t){let r=new Map;return e.reduce((n,i)=>{let a=`${i.getGroupingValue(t)}`,o=n.get(a);return o?o.push(i):n.set(a,[i]),n},r)}function y2e(e){return t=>Or(()=>[t.getState().pagination,t.getPrePaginationRowModel(),t.options.paginateExpandedRows?void 0:t.getState().expanded],(r,n)=>{if(!n.rows.length)return n;let{pageSize:i,pageIndex:a}=r,{rows:o,flatRows:s,rowsById:l}=n,u=i*a,c=u+i;o=o.slice(u,c);let f;t.options.paginateExpandedRows?f={rows:o,flatRows:s,rowsById:l}:f=g2e({rows:o,flatRows:s,rowsById:l}),f.flatRows=[];let d=p=>{f.flatRows.push(p),p.subRows.length&&p.subRows.forEach(d)};return f.rows.forEach(d),f},Mr(t.options,"debugTable","getPaginationRowModel"))}function t9(e,t){return e?sXe(e)?rD.createElement(e,t):e:null}function sXe(e){return lXe(e)||typeof e=="function"||uXe(e)}function lXe(e){return typeof e=="function"&&(()=>{let t=Object.getPrototypeOf(e);return t.prototype&&t.prototype.isReactComponent})()}function uXe(e){return typeof e=="object"&&typeof e.$$typeof=="symbol"&&["react.memo","react.forward_ref"].includes(e.$$typeof.description)}function b2e(e){let t={state:{},onStateChange:()=>{},renderFallbackValue:null,...e},[r]=rD.useState(()=>({current:m2e(t)})),[n,i]=rD.useState(()=>r.current.initialState);return r.current.setOptions(a=>({...a,...e,state:{...n,...e.state},onStateChange:o=>{i(o),e.onStateChange==null||e.onStateChange(o)}})),r.current}var Vt=Ae(Te()),cEe=Ae(bl());var Xs=Ae(Te());var ai=Ae(Te());var Yy=e=>{let t;try{t=cXe(e)}catch{t=e}return t};function rg(e){if(!e)return["",""];let t=e.match(/^(.*?)\s*\/\/\s*(.*)$/);return t?[t[1],t[2]]:["",e]}var cXe=e=>{let r=e.split("-").map(n=>`0x${n}`);return String.fromCodePoint(...r)};var fXe=e=>{let[t,r]=(0,ai.useState)(""),[n,i]=(0,ai.useState)([]),[a,o]=(0,ai.useState)([]),[s,l]=(0,ai.useState)(null),u=x=>x.type=="emoji"?Yy(x.html):x.html;(0,ai.useEffect)(()=>{let x=[];x.push(...e.ui.allStickers()),i(x)},[]);let c=(0,ai.useMemo)(()=>new Set(n.map(x=>x.type)),[n]),[f,d]=(0,ai.useState)(1),p=(0,ai.useCallback)(()=>{d(x=>x+1)},[f]),h=(0,ai.useRef)(null);(0,ai.useEffect)(()=>{let x=new IntersectionObserver(w=>{w[0].isIntersecting&&p()});return h.current&&x.observe(h.current),()=>{h.current&&x.unobserve(h.current)}},[p]);let[m,g]=(0,ai.useState)(null);(0,ai.useEffect)(()=>{o(n.filter(x=>x.name.includes(t)&&(m==null||x.type==m)).slice(0,f*250))},[t,n,f,m]);let A=x=>{r(x.target.value)},b=x=>{let w=s;x.key==="ArrowUp"&&w>0?l(w-1):x.key==="ArrowDown"&&w{v.current&&v.current.focus()},[v.current]),ai.default.createElement(ai.default.Fragment,null,ai.default.createElement("div",{className:"mk-palette-search"},ai.default.createElement("div",{className:"mk-icon-small",dangerouslySetInnerHTML:{__html:e.ui.getSticker("ui//search")}}),ai.default.createElement("input",{value:t,onChange:A,onKeyDown:b,placeholder:H.labels.findStickers,ref:v}),ai.default.createElement("button",{className:"mk-toolbar-button"})),ai.default.createElement("div",{className:"mk-menu-sections"},ai.default.createElement("div",{onClick:()=>g(null),className:`${m==null?"is-active":""} mk-menu-section`},"All"),[...c].map(x=>ai.default.createElement("div",{key:x,onClick:()=>g(x),className:`${m==x?"is-active":""} mk-menu-section`},x))),ai.default.createElement("div",{className:"mk-layout-row mk-layout-wrap mk-gap-4 mk-padding-12 mk-layout-scroll"},a.map((x,w)=>ai.default.createElement("div",{key:w,onClick:()=>{e.selectedSticker(a[w].type+"//"+a[w].value),e.hide()},className:s===w?"selected mk-padding-4 mk-border-radius-4 mk-hover":"mk-padding-4 mk-border-radius-4 mk-hover"},ai.default.createElement("div",{dangerouslySetInnerHTML:{__html:u(x)},className:"mk-sticker"}))),ai.default.createElement("div",{ref:h})))},Ta=fXe;var dXe=e=>{let[t,r]=(0,Xs.useState)(e.field),n=(u,c)=>{let f={...t,type:c[0],value:JSON.stringify(l(t,c))};r(f),e.saveField(f)},i=(u,c,f)=>e.superstate.ui.openMenu(u,{ui:e.superstate.ui,multi:!1,editable:!1,searchable:!1,saveOptions:f,value:[],showAll:!0,options:ml.filter(d=>!d.restricted).map((d,p)=>({id:p+1,name:d.label,value:d.type,icon:d.icon}))},c),a=u=>{let c={...t,value:u};r(c),e.saveField(c)},o=()=>{let u={...t,type:t.type==s.multiType?s.type:s.multiType};r(u),e.saveField(u)},s=fc(t.type,t.name)??ml[0],l=(u,c)=>c[0].startsWith("option")?JSON.stringify({options:e.options.map(f=>({name:f,value:f}))}):c[0]==s.type||c[0]==s.multiType?u.value:null;return Xs.default.createElement(Xs.default.Fragment,null,Xs.default.createElement("li",null,Xs.default.createElement("div",{className:"mk-menu-option",onClick:u=>e.onSubmenu((c,f)=>i(c,Ne(u.view.document),n))},Xs.default.createElement("span",null,H.labels.propertyType),Xs.default.createElement("span",null,s.label))),s.multi?Xs.default.createElement("div",{className:"mk-menu-option"},Xs.default.createElement("span",null,H.labels.multiple),Xs.default.createElement("input",{type:"checkbox",checked:t.type==s.multiType,onChange:()=>o()})):Xs.default.createElement(Xs.default.Fragment,null),Xs.default.createElement("div",{className:"mk-menu-separator"}),Xs.default.createElement(Y5,{superstate:e.superstate,name:t.name,table:t.table,fields:e.fields,fieldType:s.type,value:t.value,contextPath:e.contextPath,saveValue:a}))},yh=(e,t,r)=>{let{superstate:n,rect:i,editable:a,options:o,field:s,fields:l,contextPath:u,saveField:c,hide:f,deleteColumn:d,sortColumn:p,editCode:h,hidden:m}=e,g=x=>{if(!a){let w=or(s.value);c({...s,value:JSON.stringify({...w,alias:x})});return}c({...s,name:x})},A=[];A.push(uh(Vo(s,e.superstate)??"",x=>g(x))),A.push(Rt),a&&A.push({name:"",type:5,fragment:x=>Xs.default.createElement(dXe,{superstate:n,field:s,fields:l,contextPath:u,options:o,saveField:c,onSubmenu:x.onSubmenu})}),A.push(Rt),A.push({name:H.menu.setIcon,icon:"ui//gem",onClick:x=>{n.ui.openPalette(Xs.default.createElement(Ta,{ui:n.ui,selectedSticker:w=>c({...s,attrs:JSON.stringify({icon:w})})}),Ne(x.view.document))}}),A.push(Rt);let b=VQ(s.type,!1);return b&&p&&(A.push({name:H.menu.sortAscending,icon:"ui//sort-asc",onClick:()=>{p({field:s.name+s.table,fn:b})}}),A.push({name:H.menu.sortDescending,icon:"ui//sort-desc",onClick:()=>{p({field:s.name+s.table,fn:VQ(s.type,!0)})}})),A.push(Rt),f&&(m?A.push({name:H.menu.unhideProperty,icon:"ui//eye",onClick:()=>{f(s,!1)}}):A.push({name:H.menu.hideProperty,icon:"ui//eye-off",onClick:()=>{f(s,!0)}})),a&&(h&&A.push({name:H.menu.editCode,icon:"ui//code",onClick:()=>{h()}}),d&&A.push({name:H.menu.deleteProperty,icon:"ui//trash",onClick:()=>{d(s)}})),n.ui.openMenu(i,Ht(n.ui,A),e.win,e.anchor,t)};var x2e=Ae(Te());function r9(...e){return(0,x2e.useMemo)(()=>t=>{e.forEach(r=>r(t))},e)}var Ks=Ae(Te());var vrr=[{name:H.properties.fileProperty.name,value:"name"},{name:H.properties.fileProperty.createdTime,value:"ctime"},{name:H.properties.fileProperty.modifiedTime,value:"mtime"},{name:H.properties.fileProperty.sticker,value:"sticker"},{name:H.properties.fileProperty.extension,value:"extension"},{name:H.properties.fileProperty.size,value:"size"},{name:H.properties.fileProperty.parentFolder,value:"folder"},{name:H.properties.fileProperty.links,value:"inlinks"},{name:H.properties.fileProperty.tags,value:"tags"},{name:H.properties.fileProperty.spaces,value:"spaces"}],n9=e=>{let[t,r]=(0,Ks.useState)(e.column),n=(0,Ks.useRef)(null),{spaceInfo:i,spaceState:a}=(0,Ks.useContext)(ur),{predicate:o,tableData:s,contextTable:l,cols:u,newColumn:c,saveColumn:f,hideColumn:d,sortColumn:p,delColumn:h}=(0,Ks.useContext)(Na);(0,Ks.useEffect)(()=>{r(e.column)},[e.column]);let{attributes:m,listeners:g,setNodeRef:A,transform:b}=Us({id:t.name+t.table,data:{name:t.name}}),{setNodeRef:v}=zu({id:t.name+t.table,data:{name:t.name}}),x=O=>{O.name.length>0&&(O.name!=e.column.name||O.type!=e.column.type||O.value!=e.column.value||O.attrs!=e.column.attrs)&&f(O,e.column)&&e.isNew&&r(e.column)},w=O=>{let C=k.current.getBoundingClientRect();Nf(e.superstate,C,Ne(O.view.document),{spaces:a?.contexts??[],fields:u,saveField:(N,D)=>c({...D,table:N}),schemaId:s.schema.id,contextPath:i.path})},S=O=>{if(e.isNew)w(O);else{let C=O.target.getBoundingClientRect(),N=Uee(t.name,t.table==""?s:l[Wn(t.table)]);yh({superstate:e.superstate,rect:C,win:Ne(O.view.document),editable:t.name!=mt,options:N,field:t,fields:u,contextPath:i.path,saveField:x,hide:d,deleteColumn:h,sortColumn:p,hidden:o?.colsHidden.includes(t.name+t.table)})}},k=(0,Ks.useRef)(null),j=r9(v,A);return Ks.default.createElement("div",{ref:j,...g,...m,className:"mk-col-header",onClick:O=>{S(O)}},Ks.default.createElement("div",{ref:k},e.column.name.length>0?Ks.default.createElement(Ks.default.Fragment,null,Ks.default.createElement("div",{className:"mk-path-context-field-icon",dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker(Ii(e.column))}}),Ks.default.createElement("div",{className:"mk-path-context-field-key"},Vo(t,e.superstate))):"+",Ks.default.createElement("span",{className:"mk-col-header-context","aria-label":e.column.table.length>0?e.column.table:""},e.column.table.length>0?"#":"")))};var fEe=Ae(Ya());var _2e=Ae(Te());var Zy=(e,t,r)=>{if(e.spacesIndex.has(t)){pi(e,Af(e,e.spacesIndex.get(t).space),{[e.settings.fmKeyBanner]:r});return}pi(e,t,{[e.settings.fmKeyBanner]:r})},A2=async(e,t,r)=>{e.spaceManager.saveLabel(t,e.settings.fmKeyColor,r)},Xp=async(e,t,r)=>{e.spaceManager.saveLabel(t,e.settings.fmKeySticker,r)},nD=(e,t,r,n)=>{let i=os([n,...dl(r).filter(a=>a==n)]);return pi(e,t,{[e.settings.fmKeyAlias]:la("option-multi",i,!0)})};var S2e=async(e,t,r,n,i,a,o,s)=>{if(t.length==1){pXe(e,t[0],r,n,i,a,o,s);return}if(i){let l=a.findIndex(({id:m})=>m===n),u=a[l],c=u.type=="file"?u.depth==0?null:a.find(m=>m.id==u.parentId)?.item:u.item,f=t.filter(m=>!QB(m,c.path)),d=i.insert?n:i.parentId,p=a.find(({id:m})=>m===d)?.item.path,h=d==u.id?-1:u.rank??-1;if(!p)return;g2(e,f,p,i.sortable&&h,s)}},pXe=async(e,t,r,n,i,a,o,s)=>{if(i){let l=a,u=l.findIndex(({id:A})=>A===n),c=l[u],f=i.insert?n:i.parentId,d=i.depth==0&&!i.insert?null:l.find(({id:A})=>A===f)?.item.path,p=f==null?o.findIndex(A=>A?.path==c.id):f==c.id?-1:c.rank??-1;if(!r){w2e(e,t,null,d,i.sortable&&p,s);return}let h=l.findIndex(({id:A})=>A===r),m=l[h],g=m.parentId==null?null:l.find(({id:A})=>A===m.parentId)?.item.path;w2e(e,m.item.path,g,d,i.sortable&&p,s)}},mXe=(e,t,r)=>{let n=e.focuses[e.settings.currentWaypoint]??{sticker:"",name:"Waypoint",paths:[]},a=n.paths.findIndex(s=>s==t)>r?Math.max(0,r-1):r;n.paths=Ws(n.paths,n.paths.findIndex(s=>s==t),a),e.settings.currentWaypoint>e.focuses.length&&e.spaceManager.saveFocuses([...e.focuses,n]);let o=e.focuses.map((s,l)=>l==e.settings.currentWaypoint?n:s);e.spaceManager.saveFocuses(o)},w2e=async(e,t,r,n,i,a)=>{if(!e.pathsIndex.get(t))return!1;if(!n){mXe(e,t,i);return}let s=e.spacesIndex.get(n);if(r==n){GS(e,t,i,n);return}(s.type=="folder"||s.type=="vault")&&(a=="link"||QB(t,s.path)?rh(e,s,t,i):RV(e,e.pathsIndex.get(t),s.path,i,a=="copy")),s.type=="tag"&&th(e,t,s.name),r&&r!=n&&lv(e,r,[t])},g2=async(e,t,r,n,i)=>{let a=e.spacesIndex.get(r);!a||((a.type=="folder"||a.type=="vault")&&t.forEach(o=>{i=="link"||QB(o,a.path)?rh(e,a,o,n):RV(e,e.pathsIndex.get(o),a.path,n,i=="copy")}),a.type=="tag"&&t.forEach(o=>th(e,o,a.name)))};var E2e=(e,t,r)=>{t.forEach(n=>{Xp(e,n,r)})},k2e=(e,t,r)=>{t.forEach(n=>{A2(e,n,r)})},v2=(e,t,r)=>{Xp(e,t,r)},i9=(e,t)=>{t.forEach(r=>{Xp(e,r,"")})},y2=(e,t)=>{Xp(e,t,"")};var iD=Ae(Te());var b2=Ae(Te());var Xy=e=>{let{hide:t,confirmAction:r,message:n,confirmLabel:i}=e,a=()=>{r(),t()};return b2.default.createElement("div",{className:"mk-modal-contents"},b2.default.createElement("div",{className:"mk-modal-message"},n),b2.default.createElement("div",{className:"mk-button-group"},b2.default.createElement("button",{onClick:()=>a(),className:"mod-warning"},i),b2.default.createElement("button",{onClick:()=>t&&t()},H.buttons.cancel)))};var hXe=e=>`${e}-gradient(`,cY=e=>{let t=e.values;t.sort((o,s)=>o.position-s.position),t=t.length==1?[t[0],t[0]]:t;let r=t.map(o=>`${o.color} ${o.position}%`).join(", "),n=e.type,i=["top","left","bottom","right","center"],a=e.direction;return["linear","repeating-linear"].indexOf(n)>=0&&i.indexOf(a)>=0&&(a=a==="center"?"to right":`to ${a}`),["radial","repeating-radial"].indexOf(n)>=0&&i.indexOf(a)>=0&&(a=`circle at ${a}`),r?`${n}-gradient(${a}, ${r})`:""},C2e=e=>{let t=null,r=null,n=e.indexOf("(")+1,i=e.lastIndexOf(")"),a=e.substring(n,i),o=a.split(/,(?![^(]*\)) /);if(!a)return null;o.length>2&&(r=o.shift());let s=!1;return["repeating-linear","repeating-radial","linear","radial"].forEach(u=>{e.indexOf(hXe(u))>-1&&!s&&(s=!0,t=u)}),t?{type:t,direction:r,values:o.map(u=>{let c=u.split(" "),f=parseFloat(c.pop()),d=c.join("");return{position:f,color:d}})}:null};var fY=Ae(yi());var Aa=Ae(Te());var x2=[["Red","var(--mk-color-red)"],["Pink","var(--mk-color-pink)"],["Orange","var(--mk-color-orange)"],["Yellow","var(--mk-color-yellow)"],["Green","var(--mk-color-green)"],["Turquoise","var(--mk-color-turquoise)"],["Teal","var(--mk-color-teal)"],["Blue","var(--mk-color-blue)"],["Purple","var(--mk-color-purple)"],["Brown","var(--mk-color-brown)"],["Charcoal","var(--mk-color-charcoal)"],["Gray","var(--mk-color-gray)"]],D2e=[["Base 0","var(--mk-color-base-0)"],["Base 10","var(--mk-color-base-10)"],["Base 20","var(--mk-color-base-20)"],["Base 30","var(--mk-color-base-30)"],["Base 40","var(--mk-color-base-40)"],["Base 50","var(--mk-color-base-50)"],["Base 60","var(--mk-color-base-60)"],["Base 70","var(--mk-color-base-70)"],["Base 100","var(--mk-color-base-100)"]],O2e=[["Background","var(--mk-ui-background)"],["Background Variant","var(--mk-ui-background-variant)"],["Background Contrast","var(--mk-ui-background-contrast)"],["Background Active","var(--mk-ui-background-active)"],["Background Selected","var(--mk-ui-background-selected)"]],M2e=[["Text Primary","var(--mk-ui-text-primary)"],["Text Secondary","var(--mk-ui-text-secondary)"],["Text Tertiary","var(--mk-ui-text-tertiary)"]];var AXe=e=>{let[t,r]=(0,Aa.useState)(null),[n,i]=(0,Aa.useState)(null),[a,o]=(0,Aa.useState)(e.color??"#eb3b5a"),[s,l]=(0,Aa.useState)(a),u=(0,Aa.useRef)(null),c=p=>{if(l(p),t){let h={...t};h.values.find(g=>g.id==n).color=p,r(h);let m=cY(h);o(m),e.saveValue(m);return}o(p),e.saveValue(p),e.stayOpen||e.hide()},f=p=>{let h=cY(p);o(h),e.saveValue(h)},d=p=>{p&&(o(p),l(p));let h;try{h=C2e(p);let m=h.values.map(g=>{let A=t?.values.find(b=>b.position==g.position&&b.color==g.color);return A?{...g,id:A.id??(0,fY.uniqueId)()}:{...g,id:(0,fY.uniqueId)()}});h.values=m}catch(m){console.log(m)}h?(r(h),l(h.values[0].color)):l(p)};return(0,Aa.useEffect)(()=>{l(t?.values.find(p=>p.id==n)?.color)},[n,t]),Aa.default.createElement("div",{className:"mk-ui-color-picker"},Aa.default.createElement("div",{className:"mk-ui-color-picker-palette"},Aa.default.createElement("div",{style:{width:"100%",display:"flex",alignItems:"center",marginBottom:"12px"}},Aa.default.createElement("div",{onMouseDown:()=>{e.saveValue("")},className:"mk-color",style:{background:`linear-gradient(to top left, rgba(0,0,0,0) 0%, + color: hsl(${Math.max(0,Math.min(120-120*d,120))}deg 100% 31%);`,r?.key)}return i}}function Mr(e,t,r,n){return{debug:()=>{var i;return(i=e?.debugAll)!=null?i:e[t]},key:!1,onChange:n}}function CZe(e,t,r,n){let i=()=>{var o;return(o=a.getValue())!=null?o:e.options.renderFallbackValue},a={id:`${t.id}_${r.id}`,row:t,column:r,getValue:()=>t.getValue(n),renderValue:i,getContext:Or(()=>[e,r,t,a],(o,s,l,u)=>({table:o,column:s,row:l,cell:u,getValue:u.getValue,renderValue:u.renderValue}),Mr(e.options,"debugCells","cell.getContext"))};return e._features.forEach(o=>{o.createCell==null||o.createCell(a,r,t,e)},{}),a}function DZe(e,t,r,n){var i,a;let s={...e._getDefaultColumnDef(),...t},l=s.accessorKey,u=(i=(a=s.id)!=null?a:l?l.replace(".","_"):void 0)!=null?i:typeof s.header=="string"?s.header:void 0,c;if(s.accessorFn?c=s.accessorFn:l&&(l.includes(".")?c=d=>{let p=d;for(let m of l.split(".")){var h;p=(h=p)==null?void 0:h[m]}return p}:c=d=>d[s.accessorKey]),!u)throw new Error;let f={id:`${String(u)}`,accessorFn:c,parent:n,depth:r,columnDef:s,columns:[],getFlatColumns:Or(()=>[!0],()=>{var d;return[f,...(d=f.columns)==null?void 0:d.flatMap(p=>p.getFlatColumns())]},Mr(e.options,"debugColumns","column.getFlatColumns")),getLeafColumns:Or(()=>[e._getOrderColumnsFn()],d=>{var p;if((p=f.columns)!=null&&p.length){let h=f.columns.flatMap(m=>m.getLeafColumns());return d(h)}return[f]},Mr(e.options,"debugColumns","column.getLeafColumns"))};for(let d of e._features)d.createColumn==null||d.createColumn(f,e);return f}var mu="debugHeaders";function t2e(e,t,r){var n;let a={id:(n=r.id)!=null?n:t.id,column:t,index:r.index,isPlaceholder:!!r.isPlaceholder,placeholderId:r.placeholderId,depth:r.depth,subHeaders:[],colSpan:0,rowSpan:0,headerGroup:null,getLeafHeaders:()=>{let o=[],s=l=>{l.subHeaders&&l.subHeaders.length&&l.subHeaders.map(s),o.push(l)};return s(a),o},getContext:()=>({table:e,header:a,column:t})};return e._features.forEach(o=>{o.createHeader==null||o.createHeader(a,e)}),a}var OZe={createTable:e=>{e.getHeaderGroups=Or(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.left,e.getState().columnPinning.right],(t,r,n,i)=>{var a,o;let s=(a=n?.map(f=>r.find(d=>d.id===f)).filter(Boolean))!=null?a:[],l=(o=i?.map(f=>r.find(d=>d.id===f)).filter(Boolean))!=null?o:[],u=r.filter(f=>!(n!=null&&n.includes(f.id))&&!(i!=null&&i.includes(f.id)));return X5(t,[...s,...u,...l],e)},Mr(e.options,mu,"getHeaderGroups")),e.getCenterHeaderGroups=Or(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.left,e.getState().columnPinning.right],(t,r,n,i)=>(r=r.filter(a=>!(n!=null&&n.includes(a.id))&&!(i!=null&&i.includes(a.id))),X5(t,r,e,"center")),Mr(e.options,mu,"getCenterHeaderGroups")),e.getLeftHeaderGroups=Or(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.left],(t,r,n)=>{var i;let a=(i=n?.map(o=>r.find(s=>s.id===o)).filter(Boolean))!=null?i:[];return X5(t,a,e,"left")},Mr(e.options,mu,"getLeftHeaderGroups")),e.getRightHeaderGroups=Or(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.right],(t,r,n)=>{var i;let a=(i=n?.map(o=>r.find(s=>s.id===o)).filter(Boolean))!=null?i:[];return X5(t,a,e,"right")},Mr(e.options,mu,"getRightHeaderGroups")),e.getFooterGroups=Or(()=>[e.getHeaderGroups()],t=>[...t].reverse(),Mr(e.options,mu,"getFooterGroups")),e.getLeftFooterGroups=Or(()=>[e.getLeftHeaderGroups()],t=>[...t].reverse(),Mr(e.options,mu,"getLeftFooterGroups")),e.getCenterFooterGroups=Or(()=>[e.getCenterHeaderGroups()],t=>[...t].reverse(),Mr(e.options,mu,"getCenterFooterGroups")),e.getRightFooterGroups=Or(()=>[e.getRightHeaderGroups()],t=>[...t].reverse(),Mr(e.options,mu,"getRightFooterGroups")),e.getFlatHeaders=Or(()=>[e.getHeaderGroups()],t=>t.map(r=>r.headers).flat(),Mr(e.options,mu,"getFlatHeaders")),e.getLeftFlatHeaders=Or(()=>[e.getLeftHeaderGroups()],t=>t.map(r=>r.headers).flat(),Mr(e.options,mu,"getLeftFlatHeaders")),e.getCenterFlatHeaders=Or(()=>[e.getCenterHeaderGroups()],t=>t.map(r=>r.headers).flat(),Mr(e.options,mu,"getCenterFlatHeaders")),e.getRightFlatHeaders=Or(()=>[e.getRightHeaderGroups()],t=>t.map(r=>r.headers).flat(),Mr(e.options,mu,"getRightFlatHeaders")),e.getCenterLeafHeaders=Or(()=>[e.getCenterFlatHeaders()],t=>t.filter(r=>{var n;return!((n=r.subHeaders)!=null&&n.length)}),Mr(e.options,mu,"getCenterLeafHeaders")),e.getLeftLeafHeaders=Or(()=>[e.getLeftFlatHeaders()],t=>t.filter(r=>{var n;return!((n=r.subHeaders)!=null&&n.length)}),Mr(e.options,mu,"getLeftLeafHeaders")),e.getRightLeafHeaders=Or(()=>[e.getRightFlatHeaders()],t=>t.filter(r=>{var n;return!((n=r.subHeaders)!=null&&n.length)}),Mr(e.options,mu,"getRightLeafHeaders")),e.getLeafHeaders=Or(()=>[e.getLeftHeaderGroups(),e.getCenterHeaderGroups(),e.getRightHeaderGroups()],(t,r,n)=>{var i,a,o,s,l,u;return[...(i=(a=t[0])==null?void 0:a.headers)!=null?i:[],...(o=(s=r[0])==null?void 0:s.headers)!=null?o:[],...(l=(u=n[0])==null?void 0:u.headers)!=null?l:[]].map(c=>c.getLeafHeaders()).flat()},Mr(e.options,mu,"getLeafHeaders"))}};function X5(e,t,r,n){var i,a;let o=0,s=function(d,p){p===void 0&&(p=1),o=Math.max(o,p),d.filter(h=>h.getIsVisible()).forEach(h=>{var m;(m=h.columns)!=null&&m.length&&s(h.columns,p+1)},0)};s(e);let l=[],u=(d,p)=>{let h={depth:p,id:[n,`${p}`].filter(Boolean).join("_"),headers:[]},m=[];d.forEach(g=>{let A=[...m].reverse()[0],b=g.column.depth===h.depth,v,x=!1;if(b&&g.column.parent?v=g.column.parent:(v=g.column,x=!0),A&&A?.column===v)A.subHeaders.push(g);else{let w=t2e(r,v,{id:[n,p,v.id,g?.id].filter(Boolean).join("_"),isPlaceholder:x,placeholderId:x?`${m.filter(S=>S.column===v).length}`:void 0,depth:p,index:m.length});w.subHeaders.push(g),m.push(w)}h.headers.push(g),g.headerGroup=h}),l.push(h),p>0&&u(m,p-1)},c=t.map((d,p)=>t2e(r,d,{depth:o,index:p}));u(c,o-1),l.reverse();let f=d=>d.filter(h=>h.column.getIsVisible()).map(h=>{let m=0,g=0,A=[0];h.subHeaders&&h.subHeaders.length?(A=[],f(h.subHeaders).forEach(v=>{let{colSpan:x,rowSpan:w}=v;m+=x,A.push(w)})):m=1;let b=Math.min(...A);return g=g+b,h.colSpan=m,h.rowSpan=g,{colSpan:m,rowSpan:g}});return f((i=(a=l[0])==null?void 0:a.headers)!=null?i:[]),l}var i2e=(e,t,r,n,i,a,o)=>{let s={id:t,index:n,original:r,depth:i,parentId:o,_valuesCache:{},_uniqueValuesCache:{},getValue:l=>{if(s._valuesCache.hasOwnProperty(l))return s._valuesCache[l];let u=e.getColumn(l);if(!!(u!=null&&u.accessorFn))return s._valuesCache[l]=u.accessorFn(s.original,n),s._valuesCache[l]},getUniqueValues:l=>{if(s._uniqueValuesCache.hasOwnProperty(l))return s._uniqueValuesCache[l];let u=e.getColumn(l);if(!!(u!=null&&u.accessorFn))return u.columnDef.getUniqueValues?(s._uniqueValuesCache[l]=u.columnDef.getUniqueValues(s.original,n),s._uniqueValuesCache[l]):(s._uniqueValuesCache[l]=[s.getValue(l)],s._uniqueValuesCache[l])},renderValue:l=>{var u;return(u=s.getValue(l))!=null?u:e.options.renderFallbackValue},subRows:a??[],getLeafRows:()=>n2e(s.subRows,l=>l.subRows),getParentRow:()=>s.parentId?e.getRow(s.parentId,!0):void 0,getParentRows:()=>{let l=[],u=s;for(;;){let c=u.getParentRow();if(!c)break;l.push(c),u=c}return l.reverse()},getAllCells:Or(()=>[e.getAllLeafColumns()],l=>l.map(u=>CZe(e,s,u,u.id)),Mr(e.options,"debugRows","getAllCells")),_getAllCellsByColumnId:Or(()=>[s.getAllCells()],l=>l.reduce((u,c)=>(u[c.column.id]=c,u),{}),Mr(e.options,"debugRows","getAllCellsByColumnId"))};for(let l=0;l{e._getFacetedRowModel=t.options.getFacetedRowModel&&t.options.getFacetedRowModel(t,e.id),e.getFacetedRowModel=()=>e._getFacetedRowModel?e._getFacetedRowModel():t.getPreFilteredRowModel(),e._getFacetedUniqueValues=t.options.getFacetedUniqueValues&&t.options.getFacetedUniqueValues(t,e.id),e.getFacetedUniqueValues=()=>e._getFacetedUniqueValues?e._getFacetedUniqueValues():new Map,e._getFacetedMinMaxValues=t.options.getFacetedMinMaxValues&&t.options.getFacetedMinMaxValues(t,e.id),e.getFacetedMinMaxValues=()=>{if(!!e._getFacetedMinMaxValues)return e._getFacetedMinMaxValues()}}},a2e=(e,t,r)=>{var n;let i=r.toLowerCase();return Boolean((n=e.getValue(t))==null||(n=n.toString())==null||(n=n.toLowerCase())==null?void 0:n.includes(i))};a2e.autoRemove=e=>Xp(e);var o2e=(e,t,r)=>{var n;return Boolean((n=e.getValue(t))==null||(n=n.toString())==null?void 0:n.includes(r))};o2e.autoRemove=e=>Xp(e);var s2e=(e,t,r)=>{var n;return((n=e.getValue(t))==null||(n=n.toString())==null?void 0:n.toLowerCase())===r?.toLowerCase()};s2e.autoRemove=e=>Xp(e);var l2e=(e,t,r)=>{var n;return(n=e.getValue(t))==null?void 0:n.includes(r)};l2e.autoRemove=e=>Xp(e)||!(e!=null&&e.length);var u2e=(e,t,r)=>!r.some(n=>{var i;return!((i=e.getValue(t))!=null&&i.includes(n))});u2e.autoRemove=e=>Xp(e)||!(e!=null&&e.length);var c2e=(e,t,r)=>r.some(n=>{var i;return(i=e.getValue(t))==null?void 0:i.includes(n)});c2e.autoRemove=e=>Xp(e)||!(e!=null&&e.length);var f2e=(e,t,r)=>e.getValue(t)===r;f2e.autoRemove=e=>Xp(e);var d2e=(e,t,r)=>e.getValue(t)==r;d2e.autoRemove=e=>Xp(e);var sY=(e,t,r)=>{let[n,i]=r,a=e.getValue(t);return a>=n&&a<=i};sY.resolveFilterValue=e=>{let[t,r]=e,n=typeof t!="number"?parseFloat(t):t,i=typeof r!="number"?parseFloat(r):r,a=t===null||Number.isNaN(n)?-1/0:n,o=r===null||Number.isNaN(i)?1/0:i;if(a>o){let s=a;a=o,o=s}return[a,o]};sY.autoRemove=e=>Xp(e)||Xp(e[0])&&Xp(e[1]);var tg={includesString:a2e,includesStringSensitive:o2e,equalsString:s2e,arrIncludes:l2e,arrIncludesAll:u2e,arrIncludesSome:c2e,equals:f2e,weakEquals:d2e,inNumberRange:sY};function Xp(e){return e==null||e===""}var jZe={getDefaultColumnDef:()=>({filterFn:"auto"}),getInitialState:e=>({columnFilters:[],...e}),getDefaultOptions:e=>({onColumnFiltersChange:Tf("columnFilters",e),filterFromLeafRows:!1,maxLeafRowFilterDepth:100}),createColumn:(e,t)=>{e.getAutoFilterFn=()=>{let r=t.getCoreRowModel().flatRows[0],n=r?.getValue(e.id);return typeof n=="string"?tg.includesString:typeof n=="number"?tg.inNumberRange:typeof n=="boolean"||n!==null&&typeof n=="object"?tg.equals:Array.isArray(n)?tg.arrIncludes:tg.weakEquals},e.getFilterFn=()=>{var r,n;return e9(e.columnDef.filterFn)?e.columnDef.filterFn:e.columnDef.filterFn==="auto"?e.getAutoFilterFn():(r=(n=t.options.filterFns)==null?void 0:n[e.columnDef.filterFn])!=null?r:tg[e.columnDef.filterFn]},e.getCanFilter=()=>{var r,n,i;return((r=e.columnDef.enableColumnFilter)!=null?r:!0)&&((n=t.options.enableColumnFilters)!=null?n:!0)&&((i=t.options.enableFilters)!=null?i:!0)&&!!e.accessorFn},e.getIsFiltered=()=>e.getFilterIndex()>-1,e.getFilterValue=()=>{var r;return(r=t.getState().columnFilters)==null||(r=r.find(n=>n.id===e.id))==null?void 0:r.value},e.getFilterIndex=()=>{var r,n;return(r=(n=t.getState().columnFilters)==null?void 0:n.findIndex(i=>i.id===e.id))!=null?r:-1},e.setFilterValue=r=>{t.setColumnFilters(n=>{let i=e.getFilterFn(),a=n?.find(c=>c.id===e.id),o=Sv(r,a?a.value:void 0);if(r2e(i,o,e)){var s;return(s=n?.filter(c=>c.id!==e.id))!=null?s:[]}let l={id:e.id,value:o};if(a){var u;return(u=n?.map(c=>c.id===e.id?l:c))!=null?u:[]}return n!=null&&n.length?[...n,l]:[l]})}},createRow:(e,t)=>{e.columnFilters={},e.columnFiltersMeta={}},createTable:e=>{e.setColumnFilters=t=>{let r=e.getAllLeafColumns(),n=i=>{var a;return(a=Sv(t,i))==null?void 0:a.filter(o=>{let s=r.find(l=>l.id===o.id);if(s){let l=s.getFilterFn();if(r2e(l,o.value,s))return!1}return!0})};e.options.onColumnFiltersChange==null||e.options.onColumnFiltersChange(n)},e.resetColumnFilters=t=>{var r,n;e.setColumnFilters(t?[]:(r=(n=e.initialState)==null?void 0:n.columnFilters)!=null?r:[])},e.getPreFilteredRowModel=()=>e.getCoreRowModel(),e.getFilteredRowModel=()=>(!e._getFilteredRowModel&&e.options.getFilteredRowModel&&(e._getFilteredRowModel=e.options.getFilteredRowModel(e)),e.options.manualFiltering||!e._getFilteredRowModel?e.getPreFilteredRowModel():e._getFilteredRowModel())}};function r2e(e,t,r){return(e&&e.autoRemove?e.autoRemove(t,r):!1)||typeof t>"u"||typeof t=="string"&&!t}var NZe=(e,t,r)=>r.reduce((n,i)=>{let a=i.getValue(e);return n+(typeof a=="number"?a:0)},0),TZe=(e,t,r)=>{let n;return r.forEach(i=>{let a=i.getValue(e);a!=null&&(n>a||n===void 0&&a>=a)&&(n=a)}),n},FZe=(e,t,r)=>{let n;return r.forEach(i=>{let a=i.getValue(e);a!=null&&(n=a)&&(n=a)}),n},_Ze=(e,t,r)=>{let n,i;return r.forEach(a=>{let o=a.getValue(e);o!=null&&(n===void 0?o>=o&&(n=i=o):(n>o&&(n=o),i{let r=0,n=0;if(t.forEach(i=>{let a=i.getValue(e);a!=null&&(a=+a)>=a&&(++r,n+=a)}),r)return n/r},IZe=(e,t)=>{if(!t.length)return;let r=t.map(a=>a.getValue(e));if(!kZe(r))return;if(r.length===1)return r[0];let n=Math.floor(r.length/2),i=r.sort((a,o)=>a-o);return r.length%2!==0?i[n]:(i[n-1]+i[n])/2},BZe=(e,t)=>Array.from(new Set(t.map(r=>r.getValue(e))).values()),RZe=(e,t)=>new Set(t.map(r=>r.getValue(e))).size,$Ze=(e,t)=>t.length,YQ={sum:NZe,min:TZe,max:FZe,extent:_Ze,mean:PZe,median:IZe,unique:BZe,uniqueCount:RZe,count:$Ze},qZe={getDefaultColumnDef:()=>({aggregatedCell:e=>{var t,r;return(t=(r=e.getValue())==null||r.toString==null?void 0:r.toString())!=null?t:null},aggregationFn:"auto"}),getInitialState:e=>({grouping:[],...e}),getDefaultOptions:e=>({onGroupingChange:Tf("grouping",e),groupedColumnMode:"reorder"}),createColumn:(e,t)=>{e.toggleGrouping=()=>{t.setGrouping(r=>r!=null&&r.includes(e.id)?r.filter(n=>n!==e.id):[...r??[],e.id])},e.getCanGroup=()=>{var r,n,i,a;return(r=(n=(i=(a=e.columnDef.enableGrouping)!=null?a:!0)!=null?i:t.options.enableGrouping)!=null?n:!0)!=null?r:!!e.accessorFn},e.getIsGrouped=()=>{var r;return(r=t.getState().grouping)==null?void 0:r.includes(e.id)},e.getGroupedIndex=()=>{var r;return(r=t.getState().grouping)==null?void 0:r.indexOf(e.id)},e.getToggleGroupingHandler=()=>{let r=e.getCanGroup();return()=>{!r||e.toggleGrouping()}},e.getAutoAggregationFn=()=>{let r=t.getCoreRowModel().flatRows[0],n=r?.getValue(e.id);if(typeof n=="number")return YQ.sum;if(Object.prototype.toString.call(n)==="[object Date]")return YQ.extent},e.getAggregationFn=()=>{var r,n;if(!e)throw new Error;return e9(e.columnDef.aggregationFn)?e.columnDef.aggregationFn:e.columnDef.aggregationFn==="auto"?e.getAutoAggregationFn():(r=(n=t.options.aggregationFns)==null?void 0:n[e.columnDef.aggregationFn])!=null?r:YQ[e.columnDef.aggregationFn]}},createTable:e=>{e.setGrouping=t=>e.options.onGroupingChange==null?void 0:e.options.onGroupingChange(t),e.resetGrouping=t=>{var r,n;e.setGrouping(t?[]:(r=(n=e.initialState)==null?void 0:n.grouping)!=null?r:[])},e.getPreGroupedRowModel=()=>e.getFilteredRowModel(),e.getGroupedRowModel=()=>(!e._getGroupedRowModel&&e.options.getGroupedRowModel&&(e._getGroupedRowModel=e.options.getGroupedRowModel(e)),e.options.manualGrouping||!e._getGroupedRowModel?e.getPreGroupedRowModel():e._getGroupedRowModel())},createRow:(e,t)=>{e.getIsGrouped=()=>!!e.groupingColumnId,e.getGroupingValue=r=>{if(e._groupingValuesCache.hasOwnProperty(r))return e._groupingValuesCache[r];let n=t.getColumn(r);return n!=null&&n.columnDef.getGroupingValue?(e._groupingValuesCache[r]=n.columnDef.getGroupingValue(e.original),e._groupingValuesCache[r]):e.getValue(r)},e._groupingValuesCache={}},createCell:(e,t,r,n)=>{e.getIsGrouped=()=>t.getIsGrouped()&&t.id===r.groupingColumnId,e.getIsPlaceholder=()=>!e.getIsGrouped()&&t.getIsGrouped(),e.getIsAggregated=()=>{var i;return!e.getIsGrouped()&&!e.getIsPlaceholder()&&!!((i=r.subRows)!=null&&i.length)}}};function LZe(e,t,r){if(!(t!=null&&t.length)||!r)return e;let n=e.filter(a=>!t.includes(a.id));return r==="remove"?n:[...t.map(a=>e.find(o=>o.id===a)).filter(Boolean),...n]}var zZe={getInitialState:e=>({columnOrder:[],...e}),getDefaultOptions:e=>({onColumnOrderChange:Tf("columnOrder",e)}),createColumn:(e,t)=>{e.getIndex=Or(r=>[tD(t,r)],r=>r.findIndex(n=>n.id===e.id),Mr(t.options,"debugColumns","getIndex")),e.getIsFirstColumn=r=>{var n;return((n=tD(t,r)[0])==null?void 0:n.id)===e.id},e.getIsLastColumn=r=>{var n;let i=tD(t,r);return((n=i[i.length-1])==null?void 0:n.id)===e.id}},createTable:e=>{e.setColumnOrder=t=>e.options.onColumnOrderChange==null?void 0:e.options.onColumnOrderChange(t),e.resetColumnOrder=t=>{var r;e.setColumnOrder(t?[]:(r=e.initialState.columnOrder)!=null?r:[])},e._getOrderColumnsFn=Or(()=>[e.getState().columnOrder,e.getState().grouping,e.options.groupedColumnMode],(t,r,n)=>i=>{let a=[];if(!(t!=null&&t.length))a=i;else{let o=[...t],s=[...i];for(;s.length&&o.length;){let l=o.shift(),u=s.findIndex(c=>c.id===l);u>-1&&a.push(s.splice(u,1)[0])}a=[...a,...s]}return LZe(a,r,n)},Mr(e.options,"debugTable","_getOrderColumnsFn"))}},ZQ=()=>({left:[],right:[]}),UZe={getInitialState:e=>({columnPinning:ZQ(),...e}),getDefaultOptions:e=>({onColumnPinningChange:Tf("columnPinning",e)}),createColumn:(e,t)=>{e.pin=r=>{let n=e.getLeafColumns().map(i=>i.id).filter(Boolean);t.setColumnPinning(i=>{var a,o;if(r==="right"){var s,l;return{left:((s=i?.left)!=null?s:[]).filter(f=>!(n!=null&&n.includes(f))),right:[...((l=i?.right)!=null?l:[]).filter(f=>!(n!=null&&n.includes(f))),...n]}}if(r==="left"){var u,c;return{left:[...((u=i?.left)!=null?u:[]).filter(f=>!(n!=null&&n.includes(f))),...n],right:((c=i?.right)!=null?c:[]).filter(f=>!(n!=null&&n.includes(f)))}}return{left:((a=i?.left)!=null?a:[]).filter(f=>!(n!=null&&n.includes(f))),right:((o=i?.right)!=null?o:[]).filter(f=>!(n!=null&&n.includes(f)))}})},e.getCanPin=()=>e.getLeafColumns().some(n=>{var i,a,o;return((i=n.columnDef.enablePinning)!=null?i:!0)&&((a=(o=t.options.enableColumnPinning)!=null?o:t.options.enablePinning)!=null?a:!0)}),e.getIsPinned=()=>{let r=e.getLeafColumns().map(s=>s.id),{left:n,right:i}=t.getState().columnPinning,a=r.some(s=>n?.includes(s)),o=r.some(s=>i?.includes(s));return a?"left":o?"right":!1},e.getPinnedIndex=()=>{var r,n;let i=e.getIsPinned();return i?(r=(n=t.getState().columnPinning)==null||(n=n[i])==null?void 0:n.indexOf(e.id))!=null?r:-1:0}},createRow:(e,t)=>{e.getCenterVisibleCells=Or(()=>[e._getAllVisibleCells(),t.getState().columnPinning.left,t.getState().columnPinning.right],(r,n,i)=>{let a=[...n??[],...i??[]];return r.filter(o=>!a.includes(o.column.id))},Mr(t.options,"debugRows","getCenterVisibleCells")),e.getLeftVisibleCells=Or(()=>[e._getAllVisibleCells(),t.getState().columnPinning.left],(r,n)=>(n??[]).map(a=>r.find(o=>o.column.id===a)).filter(Boolean).map(a=>({...a,position:"left"})),Mr(t.options,"debugRows","getLeftVisibleCells")),e.getRightVisibleCells=Or(()=>[e._getAllVisibleCells(),t.getState().columnPinning.right],(r,n)=>(n??[]).map(a=>r.find(o=>o.column.id===a)).filter(Boolean).map(a=>({...a,position:"right"})),Mr(t.options,"debugRows","getRightVisibleCells"))},createTable:e=>{e.setColumnPinning=t=>e.options.onColumnPinningChange==null?void 0:e.options.onColumnPinningChange(t),e.resetColumnPinning=t=>{var r,n;return e.setColumnPinning(t?ZQ():(r=(n=e.initialState)==null?void 0:n.columnPinning)!=null?r:ZQ())},e.getIsSomeColumnsPinned=t=>{var r;let n=e.getState().columnPinning;if(!t){var i,a;return Boolean(((i=n.left)==null?void 0:i.length)||((a=n.right)==null?void 0:a.length))}return Boolean((r=n[t])==null?void 0:r.length)},e.getLeftLeafColumns=Or(()=>[e.getAllLeafColumns(),e.getState().columnPinning.left],(t,r)=>(r??[]).map(n=>t.find(i=>i.id===n)).filter(Boolean),Mr(e.options,"debugColumns","getLeftLeafColumns")),e.getRightLeafColumns=Or(()=>[e.getAllLeafColumns(),e.getState().columnPinning.right],(t,r)=>(r??[]).map(n=>t.find(i=>i.id===n)).filter(Boolean),Mr(e.options,"debugColumns","getRightLeafColumns")),e.getCenterLeafColumns=Or(()=>[e.getAllLeafColumns(),e.getState().columnPinning.left,e.getState().columnPinning.right],(t,r,n)=>{let i=[...r??[],...n??[]];return t.filter(a=>!i.includes(a.id))},Mr(e.options,"debugColumns","getCenterLeafColumns"))}},K5={size:150,minSize:20,maxSize:Number.MAX_SAFE_INTEGER},XQ=()=>({startOffset:null,startSize:null,deltaOffset:null,deltaPercentage:null,isResizingColumn:!1,columnSizingStart:[]}),WZe={getDefaultColumnDef:()=>K5,getInitialState:e=>({columnSizing:{},columnSizingInfo:XQ(),...e}),getDefaultOptions:e=>({columnResizeMode:"onEnd",columnResizeDirection:"ltr",onColumnSizingChange:Tf("columnSizing",e),onColumnSizingInfoChange:Tf("columnSizingInfo",e)}),createColumn:(e,t)=>{e.getSize=()=>{var r,n,i;let a=t.getState().columnSizing[e.id];return Math.min(Math.max((r=e.columnDef.minSize)!=null?r:K5.minSize,(n=a??e.columnDef.size)!=null?n:K5.size),(i=e.columnDef.maxSize)!=null?i:K5.maxSize)},e.getStart=Or(r=>[r,tD(t,r),t.getState().columnSizing],(r,n)=>n.slice(0,e.getIndex(r)).reduce((i,a)=>i+a.getSize(),0),Mr(t.options,"debugColumns","getStart")),e.getAfter=Or(r=>[r,tD(t,r),t.getState().columnSizing],(r,n)=>n.slice(e.getIndex(r)+1).reduce((i,a)=>i+a.getSize(),0),Mr(t.options,"debugColumns","getAfter")),e.resetSize=()=>{t.setColumnSizing(r=>{let{[e.id]:n,...i}=r;return i})},e.getCanResize=()=>{var r,n;return((r=e.columnDef.enableResizing)!=null?r:!0)&&((n=t.options.enableColumnResizing)!=null?n:!0)},e.getIsResizing=()=>t.getState().columnSizingInfo.isResizingColumn===e.id},createHeader:(e,t)=>{e.getSize=()=>{let r=0,n=i=>{if(i.subHeaders.length)i.subHeaders.forEach(n);else{var a;r+=(a=i.column.getSize())!=null?a:0}};return n(e),r},e.getStart=()=>{if(e.index>0){let r=e.headerGroup.headers[e.index-1];return r.getStart()+r.getSize()}return 0},e.getResizeHandler=r=>{let n=t.getColumn(e.column.id),i=n?.getCanResize();return a=>{if(!n||!i||(a.persist==null||a.persist(),KQ(a)&&a.touches&&a.touches.length>1))return;let o=e.getSize(),s=e?e.getLeafHeaders().map(A=>[A.column.id,A.column.getSize()]):[[n.id,n.getSize()]],l=KQ(a)?Math.round(a.touches[0].clientX):a.clientX,u={},c=(A,b)=>{typeof b=="number"&&(t.setColumnSizingInfo(v=>{var x,w;let S=t.options.columnResizeDirection==="rtl"?-1:1,k=(b-((x=v?.startOffset)!=null?x:0))*S,j=Math.max(k/((w=v?.startSize)!=null?w:0),-.999999);return v.columnSizingStart.forEach(O=>{let[C,N]=O;u[C]=Math.round(Math.max(N+N*j,0)*100)/100}),{...v,deltaOffset:k,deltaPercentage:j}}),(t.options.columnResizeMode==="onChange"||A==="end")&&t.setColumnSizing(v=>({...v,...u})))},f=A=>c("move",A),d=A=>{c("end",A),t.setColumnSizingInfo(b=>({...b,isResizingColumn:!1,startOffset:null,startSize:null,deltaOffset:null,deltaPercentage:null,columnSizingStart:[]}))},p=r||typeof document<"u"?document:null,h={moveHandler:A=>f(A.clientX),upHandler:A=>{p?.removeEventListener("mousemove",h.moveHandler),p?.removeEventListener("mouseup",h.upHandler),d(A.clientX)}},m={moveHandler:A=>(A.cancelable&&(A.preventDefault(),A.stopPropagation()),f(A.touches[0].clientX),!1),upHandler:A=>{var b;p?.removeEventListener("touchmove",m.moveHandler),p?.removeEventListener("touchend",m.upHandler),A.cancelable&&(A.preventDefault(),A.stopPropagation()),d((b=A.touches[0])==null?void 0:b.clientX)}},g=HZe()?{passive:!1}:!1;KQ(a)?(p?.addEventListener("touchmove",m.moveHandler,g),p?.addEventListener("touchend",m.upHandler,g)):(p?.addEventListener("mousemove",h.moveHandler,g),p?.addEventListener("mouseup",h.upHandler,g)),t.setColumnSizingInfo(A=>({...A,startOffset:l,startSize:o,deltaOffset:0,deltaPercentage:0,columnSizingStart:s,isResizingColumn:n.id}))}}},createTable:e=>{e.setColumnSizing=t=>e.options.onColumnSizingChange==null?void 0:e.options.onColumnSizingChange(t),e.setColumnSizingInfo=t=>e.options.onColumnSizingInfoChange==null?void 0:e.options.onColumnSizingInfoChange(t),e.resetColumnSizing=t=>{var r;e.setColumnSizing(t?{}:(r=e.initialState.columnSizing)!=null?r:{})},e.resetHeaderSizeInfo=t=>{var r;e.setColumnSizingInfo(t?XQ():(r=e.initialState.columnSizingInfo)!=null?r:XQ())},e.getTotalSize=()=>{var t,r;return(t=(r=e.getHeaderGroups()[0])==null?void 0:r.headers.reduce((n,i)=>n+i.getSize(),0))!=null?t:0},e.getLeftTotalSize=()=>{var t,r;return(t=(r=e.getLeftHeaderGroups()[0])==null?void 0:r.headers.reduce((n,i)=>n+i.getSize(),0))!=null?t:0},e.getCenterTotalSize=()=>{var t,r;return(t=(r=e.getCenterHeaderGroups()[0])==null?void 0:r.headers.reduce((n,i)=>n+i.getSize(),0))!=null?t:0},e.getRightTotalSize=()=>{var t,r;return(t=(r=e.getRightHeaderGroups()[0])==null?void 0:r.headers.reduce((n,i)=>n+i.getSize(),0))!=null?t:0}}},J5=null;function HZe(){if(typeof J5=="boolean")return J5;let e=!1;try{let t={get passive(){return e=!0,!1}},r=()=>{};window.addEventListener("test",r,t),window.removeEventListener("test",r)}catch{e=!1}return J5=e,J5}function KQ(e){return e.type==="touchstart"}var VZe={getInitialState:e=>({columnVisibility:{},...e}),getDefaultOptions:e=>({onColumnVisibilityChange:Tf("columnVisibility",e)}),createColumn:(e,t)=>{e.toggleVisibility=r=>{e.getCanHide()&&t.setColumnVisibility(n=>({...n,[e.id]:r??!e.getIsVisible()}))},e.getIsVisible=()=>{var r,n;let i=e.columns;return(r=i.length?i.some(a=>a.getIsVisible()):(n=t.getState().columnVisibility)==null?void 0:n[e.id])!=null?r:!0},e.getCanHide=()=>{var r,n;return((r=e.columnDef.enableHiding)!=null?r:!0)&&((n=t.options.enableHiding)!=null?n:!0)},e.getToggleVisibilityHandler=()=>r=>{e.toggleVisibility==null||e.toggleVisibility(r.target.checked)}},createRow:(e,t)=>{e._getAllVisibleCells=Or(()=>[e.getAllCells(),t.getState().columnVisibility],r=>r.filter(n=>n.column.getIsVisible()),Mr(t.options,"debugRows","_getAllVisibleCells")),e.getVisibleCells=Or(()=>[e.getLeftVisibleCells(),e.getCenterVisibleCells(),e.getRightVisibleCells()],(r,n,i)=>[...r,...n,...i],Mr(t.options,"debugRows","getVisibleCells"))},createTable:e=>{let t=(r,n)=>Or(()=>[n(),n().filter(i=>i.getIsVisible()).map(i=>i.id).join("_")],i=>i.filter(a=>a.getIsVisible==null?void 0:a.getIsVisible()),Mr(e.options,"debugColumns",r));e.getVisibleFlatColumns=t("getVisibleFlatColumns",()=>e.getAllFlatColumns()),e.getVisibleLeafColumns=t("getVisibleLeafColumns",()=>e.getAllLeafColumns()),e.getLeftVisibleLeafColumns=t("getLeftVisibleLeafColumns",()=>e.getLeftLeafColumns()),e.getRightVisibleLeafColumns=t("getRightVisibleLeafColumns",()=>e.getRightLeafColumns()),e.getCenterVisibleLeafColumns=t("getCenterVisibleLeafColumns",()=>e.getCenterLeafColumns()),e.setColumnVisibility=r=>e.options.onColumnVisibilityChange==null?void 0:e.options.onColumnVisibilityChange(r),e.resetColumnVisibility=r=>{var n;e.setColumnVisibility(r?{}:(n=e.initialState.columnVisibility)!=null?n:{})},e.toggleAllColumnsVisible=r=>{var n;r=(n=r)!=null?n:!e.getIsAllColumnsVisible(),e.setColumnVisibility(e.getAllLeafColumns().reduce((i,a)=>({...i,[a.id]:r||!(a.getCanHide!=null&&a.getCanHide())}),{}))},e.getIsAllColumnsVisible=()=>!e.getAllLeafColumns().some(r=>!(r.getIsVisible!=null&&r.getIsVisible())),e.getIsSomeColumnsVisible=()=>e.getAllLeafColumns().some(r=>r.getIsVisible==null?void 0:r.getIsVisible()),e.getToggleAllColumnsVisibilityHandler=()=>r=>{var n;e.toggleAllColumnsVisible((n=r.target)==null?void 0:n.checked)}}};function tD(e,t){return t?t==="center"?e.getCenterVisibleLeafColumns():t==="left"?e.getLeftVisibleLeafColumns():e.getRightVisibleLeafColumns():e.getVisibleLeafColumns()}var GZe={getInitialState:e=>({globalFilter:void 0,...e}),getDefaultOptions:e=>({onGlobalFilterChange:Tf("globalFilter",e),globalFilterFn:"auto",getColumnCanGlobalFilter:t=>{var r;let n=(r=e.getCoreRowModel().flatRows[0])==null||(r=r._getAllCellsByColumnId()[t.id])==null?void 0:r.getValue();return typeof n=="string"||typeof n=="number"}}),createColumn:(e,t)=>{e.getCanGlobalFilter=()=>{var r,n,i,a;return((r=e.columnDef.enableGlobalFilter)!=null?r:!0)&&((n=t.options.enableGlobalFilter)!=null?n:!0)&&((i=t.options.enableFilters)!=null?i:!0)&&((a=t.options.getColumnCanGlobalFilter==null?void 0:t.options.getColumnCanGlobalFilter(e))!=null?a:!0)&&!!e.accessorFn}},createTable:e=>{e.getGlobalAutoFilterFn=()=>tg.includesString,e.getGlobalFilterFn=()=>{var t,r;let{globalFilterFn:n}=e.options;return e9(n)?n:n==="auto"?e.getGlobalAutoFilterFn():(t=(r=e.options.filterFns)==null?void 0:r[n])!=null?t:tg[n]},e.setGlobalFilter=t=>{e.options.onGlobalFilterChange==null||e.options.onGlobalFilterChange(t)},e.resetGlobalFilter=t=>{e.setGlobalFilter(t?void 0:e.initialState.globalFilter)},e._getGlobalFacetedRowModel=e.options.getFacetedRowModel&&e.options.getFacetedRowModel(e,"__global__"),e.getGlobalFacetedRowModel=()=>e.options.manualFiltering||!e._getGlobalFacetedRowModel?e.getPreFilteredRowModel():e._getGlobalFacetedRowModel(),e._getGlobalFacetedUniqueValues=e.options.getFacetedUniqueValues&&e.options.getFacetedUniqueValues(e,"__global__"),e.getGlobalFacetedUniqueValues=()=>e._getGlobalFacetedUniqueValues?e._getGlobalFacetedUniqueValues():new Map,e._getGlobalFacetedMinMaxValues=e.options.getFacetedMinMaxValues&&e.options.getFacetedMinMaxValues(e,"__global__"),e.getGlobalFacetedMinMaxValues=()=>{if(!!e._getGlobalFacetedMinMaxValues)return e._getGlobalFacetedMinMaxValues()}}},QZe={getInitialState:e=>({expanded:{},...e}),getDefaultOptions:e=>({onExpandedChange:Tf("expanded",e),paginateExpandedRows:!0}),createTable:e=>{let t=!1,r=!1;e._autoResetExpanded=()=>{var n,i;if(!t){e._queue(()=>{t=!0});return}if((n=(i=e.options.autoResetAll)!=null?i:e.options.autoResetExpanded)!=null?n:!e.options.manualExpanding){if(r)return;r=!0,e._queue(()=>{e.resetExpanded(),r=!1})}},e.setExpanded=n=>e.options.onExpandedChange==null?void 0:e.options.onExpandedChange(n),e.toggleAllRowsExpanded=n=>{n??!e.getIsAllRowsExpanded()?e.setExpanded(!0):e.setExpanded({})},e.resetExpanded=n=>{var i,a;e.setExpanded(n?{}:(i=(a=e.initialState)==null?void 0:a.expanded)!=null?i:{})},e.getCanSomeRowsExpand=()=>e.getPrePaginationRowModel().flatRows.some(n=>n.getCanExpand()),e.getToggleAllRowsExpandedHandler=()=>n=>{n.persist==null||n.persist(),e.toggleAllRowsExpanded()},e.getIsSomeRowsExpanded=()=>{let n=e.getState().expanded;return n===!0||Object.values(n).some(Boolean)},e.getIsAllRowsExpanded=()=>{let n=e.getState().expanded;return typeof n=="boolean"?n===!0:!(!Object.keys(n).length||e.getRowModel().flatRows.some(i=>!i.getIsExpanded()))},e.getExpandedDepth=()=>{let n=0;return(e.getState().expanded===!0?Object.keys(e.getRowModel().rowsById):Object.keys(e.getState().expanded)).forEach(a=>{let o=a.split(".");n=Math.max(n,o.length)}),n},e.getPreExpandedRowModel=()=>e.getSortedRowModel(),e.getExpandedRowModel=()=>(!e._getExpandedRowModel&&e.options.getExpandedRowModel&&(e._getExpandedRowModel=e.options.getExpandedRowModel(e)),e.options.manualExpanding||!e._getExpandedRowModel?e.getPreExpandedRowModel():e._getExpandedRowModel())},createRow:(e,t)=>{e.toggleExpanded=r=>{t.setExpanded(n=>{var i;let a=n===!0?!0:!!(n!=null&&n[e.id]),o={};if(n===!0?Object.keys(t.getRowModel().rowsById).forEach(s=>{o[s]=!0}):o=n,r=(i=r)!=null?i:!a,!a&&r)return{...o,[e.id]:!0};if(a&&!r){let{[e.id]:s,...l}=o;return l}return n})},e.getIsExpanded=()=>{var r;let n=t.getState().expanded;return!!((r=t.options.getIsRowExpanded==null?void 0:t.options.getIsRowExpanded(e))!=null?r:n===!0||n?.[e.id])},e.getCanExpand=()=>{var r,n,i;return(r=t.options.getRowCanExpand==null?void 0:t.options.getRowCanExpand(e))!=null?r:((n=t.options.enableExpanding)!=null?n:!0)&&!!((i=e.subRows)!=null&&i.length)},e.getIsAllParentsExpanded=()=>{let r=!0,n=e;for(;r&&n.parentId;)n=t.getRow(n.parentId,!0),r=n.getIsExpanded();return r},e.getToggleExpandedHandler=()=>{let r=e.getCanExpand();return()=>{!r||e.toggleExpanded()}}}},rY=0,nY=10,JQ=()=>({pageIndex:rY,pageSize:nY}),YZe={getInitialState:e=>({...e,pagination:{...JQ(),...e?.pagination}}),getDefaultOptions:e=>({onPaginationChange:Tf("pagination",e)}),createTable:e=>{let t=!1,r=!1;e._autoResetPageIndex=()=>{var n,i;if(!t){e._queue(()=>{t=!0});return}if((n=(i=e.options.autoResetAll)!=null?i:e.options.autoResetPageIndex)!=null?n:!e.options.manualPagination){if(r)return;r=!0,e._queue(()=>{e.resetPageIndex(),r=!1})}},e.setPagination=n=>{let i=a=>Sv(n,a);return e.options.onPaginationChange==null?void 0:e.options.onPaginationChange(i)},e.resetPagination=n=>{var i;e.setPagination(n?JQ():(i=e.initialState.pagination)!=null?i:JQ())},e.setPageIndex=n=>{e.setPagination(i=>{let a=Sv(n,i.pageIndex),o=typeof e.options.pageCount>"u"||e.options.pageCount===-1?Number.MAX_SAFE_INTEGER:e.options.pageCount-1;return a=Math.max(0,Math.min(a,o)),{...i,pageIndex:a}})},e.resetPageIndex=n=>{var i,a;e.setPageIndex(n?rY:(i=(a=e.initialState)==null||(a=a.pagination)==null?void 0:a.pageIndex)!=null?i:rY)},e.resetPageSize=n=>{var i,a;e.setPageSize(n?nY:(i=(a=e.initialState)==null||(a=a.pagination)==null?void 0:a.pageSize)!=null?i:nY)},e.setPageSize=n=>{e.setPagination(i=>{let a=Math.max(1,Sv(n,i.pageSize)),o=i.pageSize*i.pageIndex,s=Math.floor(o/a);return{...i,pageIndex:s,pageSize:a}})},e.setPageCount=n=>e.setPagination(i=>{var a;let o=Sv(n,(a=e.options.pageCount)!=null?a:-1);return typeof o=="number"&&(o=Math.max(-1,o)),{...i,pageCount:o}}),e.getPageOptions=Or(()=>[e.getPageCount()],n=>{let i=[];return n&&n>0&&(i=[...new Array(n)].fill(null).map((a,o)=>o)),i},Mr(e.options,"debugTable","getPageOptions")),e.getCanPreviousPage=()=>e.getState().pagination.pageIndex>0,e.getCanNextPage=()=>{let{pageIndex:n}=e.getState().pagination,i=e.getPageCount();return i===-1?!0:i===0?!1:ne.setPageIndex(n=>n-1),e.nextPage=()=>e.setPageIndex(n=>n+1),e.firstPage=()=>e.setPageIndex(0),e.lastPage=()=>e.setPageIndex(e.getPageCount()-1),e.getPrePaginationRowModel=()=>e.getExpandedRowModel(),e.getPaginationRowModel=()=>(!e._getPaginationRowModel&&e.options.getPaginationRowModel&&(e._getPaginationRowModel=e.options.getPaginationRowModel(e)),e.options.manualPagination||!e._getPaginationRowModel?e.getPrePaginationRowModel():e._getPaginationRowModel()),e.getPageCount=()=>{var n;return(n=e.options.pageCount)!=null?n:Math.ceil(e.getRowCount()/e.getState().pagination.pageSize)},e.getRowCount=()=>{var n;return(n=e.options.rowCount)!=null?n:e.getPrePaginationRowModel().rows.length}}},eY=()=>({top:[],bottom:[]}),ZZe={getInitialState:e=>({rowPinning:eY(),...e}),getDefaultOptions:e=>({onRowPinningChange:Tf("rowPinning",e)}),createRow:(e,t)=>{e.pin=(r,n,i)=>{let a=n?e.getLeafRows().map(l=>{let{id:u}=l;return u}):[],o=i?e.getParentRows().map(l=>{let{id:u}=l;return u}):[],s=new Set([...o,e.id,...a]);t.setRowPinning(l=>{var u,c;if(r==="bottom"){var f,d;return{top:((f=l?.top)!=null?f:[]).filter(m=>!(s!=null&&s.has(m))),bottom:[...((d=l?.bottom)!=null?d:[]).filter(m=>!(s!=null&&s.has(m))),...Array.from(s)]}}if(r==="top"){var p,h;return{top:[...((p=l?.top)!=null?p:[]).filter(m=>!(s!=null&&s.has(m))),...Array.from(s)],bottom:((h=l?.bottom)!=null?h:[]).filter(m=>!(s!=null&&s.has(m)))}}return{top:((u=l?.top)!=null?u:[]).filter(m=>!(s!=null&&s.has(m))),bottom:((c=l?.bottom)!=null?c:[]).filter(m=>!(s!=null&&s.has(m)))}})},e.getCanPin=()=>{var r;let{enableRowPinning:n,enablePinning:i}=t.options;return typeof n=="function"?n(e):(r=n??i)!=null?r:!0},e.getIsPinned=()=>{let r=[e.id],{top:n,bottom:i}=t.getState().rowPinning,a=r.some(s=>n?.includes(s)),o=r.some(s=>i?.includes(s));return a?"top":o?"bottom":!1},e.getPinnedIndex=()=>{var r,n;let i=e.getIsPinned();if(!i)return-1;let a=(r=t._getPinnedRows(i))==null?void 0:r.map(o=>{let{id:s}=o;return s});return(n=a?.indexOf(e.id))!=null?n:-1}},createTable:e=>{e.setRowPinning=t=>e.options.onRowPinningChange==null?void 0:e.options.onRowPinningChange(t),e.resetRowPinning=t=>{var r,n;return e.setRowPinning(t?eY():(r=(n=e.initialState)==null?void 0:n.rowPinning)!=null?r:eY())},e.getIsSomeRowsPinned=t=>{var r;let n=e.getState().rowPinning;if(!t){var i,a;return Boolean(((i=n.top)==null?void 0:i.length)||((a=n.bottom)==null?void 0:a.length))}return Boolean((r=n[t])==null?void 0:r.length)},e._getPinnedRows=Or(t=>[e.getRowModel().rows,e.getState().rowPinning[t],t],(t,r,n)=>{var i;return((i=e.options.keepPinnedRows)==null||i?(r??[]).map(o=>{let s=e.getRow(o,!0);return s.getIsAllParentsExpanded()?s:null}):(r??[]).map(o=>t.find(s=>s.id===o))).filter(Boolean).map(o=>({...o,position:n}))},Mr(e.options,"debugRows","_getPinnedRows")),e.getTopRows=()=>e._getPinnedRows("top"),e.getBottomRows=()=>e._getPinnedRows("bottom"),e.getCenterRows=Or(()=>[e.getRowModel().rows,e.getState().rowPinning.top,e.getState().rowPinning.bottom],(t,r,n)=>{let i=new Set([...r??[],...n??[]]);return t.filter(a=>!i.has(a.id))},Mr(e.options,"debugRows","getCenterRows"))}},XZe={getInitialState:e=>({rowSelection:{},...e}),getDefaultOptions:e=>({onRowSelectionChange:Tf("rowSelection",e),enableRowSelection:!0,enableMultiRowSelection:!0,enableSubRowSelection:!0}),createTable:e=>{e.setRowSelection=t=>e.options.onRowSelectionChange==null?void 0:e.options.onRowSelectionChange(t),e.resetRowSelection=t=>{var r;return e.setRowSelection(t?{}:(r=e.initialState.rowSelection)!=null?r:{})},e.toggleAllRowsSelected=t=>{e.setRowSelection(r=>{t=typeof t<"u"?t:!e.getIsAllRowsSelected();let n={...r},i=e.getPreGroupedRowModel().flatRows;return t?i.forEach(a=>{!a.getCanSelect()||(n[a.id]=!0)}):i.forEach(a=>{delete n[a.id]}),n})},e.toggleAllPageRowsSelected=t=>e.setRowSelection(r=>{let n=typeof t<"u"?t:!e.getIsAllPageRowsSelected(),i={...r};return e.getRowModel().rows.forEach(a=>{iY(i,a.id,n,!0,e)}),i}),e.getPreSelectedRowModel=()=>e.getCoreRowModel(),e.getSelectedRowModel=Or(()=>[e.getState().rowSelection,e.getCoreRowModel()],(t,r)=>Object.keys(t).length?tY(e,r):{rows:[],flatRows:[],rowsById:{}},Mr(e.options,"debugTable","getSelectedRowModel")),e.getFilteredSelectedRowModel=Or(()=>[e.getState().rowSelection,e.getFilteredRowModel()],(t,r)=>Object.keys(t).length?tY(e,r):{rows:[],flatRows:[],rowsById:{}},Mr(e.options,"debugTable","getFilteredSelectedRowModel")),e.getGroupedSelectedRowModel=Or(()=>[e.getState().rowSelection,e.getSortedRowModel()],(t,r)=>Object.keys(t).length?tY(e,r):{rows:[],flatRows:[],rowsById:{}},Mr(e.options,"debugTable","getGroupedSelectedRowModel")),e.getIsAllRowsSelected=()=>{let t=e.getFilteredRowModel().flatRows,{rowSelection:r}=e.getState(),n=Boolean(t.length&&Object.keys(r).length);return n&&t.some(i=>i.getCanSelect()&&!r[i.id])&&(n=!1),n},e.getIsAllPageRowsSelected=()=>{let t=e.getPaginationRowModel().flatRows.filter(i=>i.getCanSelect()),{rowSelection:r}=e.getState(),n=!!t.length;return n&&t.some(i=>!r[i.id])&&(n=!1),n},e.getIsSomeRowsSelected=()=>{var t;let r=Object.keys((t=e.getState().rowSelection)!=null?t:{}).length;return r>0&&r{let t=e.getPaginationRowModel().flatRows;return e.getIsAllPageRowsSelected()?!1:t.filter(r=>r.getCanSelect()).some(r=>r.getIsSelected()||r.getIsSomeSelected())},e.getToggleAllRowsSelectedHandler=()=>t=>{e.toggleAllRowsSelected(t.target.checked)},e.getToggleAllPageRowsSelectedHandler=()=>t=>{e.toggleAllPageRowsSelected(t.target.checked)}},createRow:(e,t)=>{e.toggleSelected=(r,n)=>{let i=e.getIsSelected();t.setRowSelection(a=>{var o;if(r=typeof r<"u"?r:!i,e.getCanSelect()&&i===r)return a;let s={...a};return iY(s,e.id,r,(o=n?.selectChildren)!=null?o:!0,t),s})},e.getIsSelected=()=>{let{rowSelection:r}=t.getState();return lY(e,r)},e.getIsSomeSelected=()=>{let{rowSelection:r}=t.getState();return aY(e,r)==="some"},e.getIsAllSubRowsSelected=()=>{let{rowSelection:r}=t.getState();return aY(e,r)==="all"},e.getCanSelect=()=>{var r;return typeof t.options.enableRowSelection=="function"?t.options.enableRowSelection(e):(r=t.options.enableRowSelection)!=null?r:!0},e.getCanSelectSubRows=()=>{var r;return typeof t.options.enableSubRowSelection=="function"?t.options.enableSubRowSelection(e):(r=t.options.enableSubRowSelection)!=null?r:!0},e.getCanMultiSelect=()=>{var r;return typeof t.options.enableMultiRowSelection=="function"?t.options.enableMultiRowSelection(e):(r=t.options.enableMultiRowSelection)!=null?r:!0},e.getToggleSelectedHandler=()=>{let r=e.getCanSelect();return n=>{var i;!r||e.toggleSelected((i=n.target)==null?void 0:i.checked)}}}},iY=(e,t,r,n,i)=>{var a;let o=i.getRow(t,!0);r?(o.getCanMultiSelect()||Object.keys(e).forEach(s=>delete e[s]),o.getCanSelect()&&(e[t]=!0)):delete e[t],n&&(a=o.subRows)!=null&&a.length&&o.getCanSelectSubRows()&&o.subRows.forEach(s=>iY(e,s.id,r,n,i))};function tY(e,t){let r=e.getState().rowSelection,n=[],i={},a=function(o,s){return o.map(l=>{var u;let c=lY(l,r);if(c&&(n.push(l),i[l.id]=l),(u=l.subRows)!=null&&u.length&&(l={...l,subRows:a(l.subRows)}),c)return l}).filter(Boolean)};return{rows:a(t.rows),flatRows:n,rowsById:i}}function lY(e,t){var r;return(r=t[e.id])!=null?r:!1}function aY(e,t,r){var n;if(!((n=e.subRows)!=null&&n.length))return!1;let i=!0,a=!1;return e.subRows.forEach(o=>{if(!(a&&!i)&&(o.getCanSelect()&&(lY(o,t)?a=!0:i=!1),o.subRows&&o.subRows.length)){let s=aY(o,t);s==="all"?a=!0:(s==="some"&&(a=!0),i=!1)}}),i?"all":a?"some":!1}var oY=/([0-9]+)/gm,KZe=(e,t,r)=>p2e(Ev(e.getValue(r)).toLowerCase(),Ev(t.getValue(r)).toLowerCase()),JZe=(e,t,r)=>p2e(Ev(e.getValue(r)),Ev(t.getValue(r))),eXe=(e,t,r)=>uY(Ev(e.getValue(r)).toLowerCase(),Ev(t.getValue(r)).toLowerCase()),tXe=(e,t,r)=>uY(Ev(e.getValue(r)),Ev(t.getValue(r))),rXe=(e,t,r)=>{let n=e.getValue(r),i=t.getValue(r);return n>i?1:nuY(e.getValue(r),t.getValue(r));function uY(e,t){return e===t?0:e>t?1:-1}function Ev(e){return typeof e=="number"?isNaN(e)||e===1/0||e===-1/0?"":String(e):typeof e=="string"?e:""}function p2e(e,t){let r=e.split(oY).filter(Boolean),n=t.split(oY).filter(Boolean);for(;r.length&&n.length;){let i=r.shift(),a=n.shift(),o=parseInt(i,10),s=parseInt(a,10),l=[o,s].sort();if(isNaN(l[0])){if(i>a)return 1;if(a>i)return-1;continue}if(isNaN(l[1]))return isNaN(o)?-1:1;if(o>s)return 1;if(s>o)return-1}return r.length-n.length}var eD={alphanumeric:KZe,alphanumericCaseSensitive:JZe,text:eXe,textCaseSensitive:tXe,datetime:rXe,basic:nXe},iXe={getInitialState:e=>({sorting:[],...e}),getDefaultColumnDef:()=>({sortingFn:"auto",sortUndefined:1}),getDefaultOptions:e=>({onSortingChange:Tf("sorting",e),isMultiSortEvent:t=>t.shiftKey}),createColumn:(e,t)=>{e.getAutoSortingFn=()=>{let r=t.getFilteredRowModel().flatRows.slice(10),n=!1;for(let i of r){let a=i?.getValue(e.id);if(Object.prototype.toString.call(a)==="[object Date]")return eD.datetime;if(typeof a=="string"&&(n=!0,a.split(oY).length>1))return eD.alphanumeric}return n?eD.text:eD.basic},e.getAutoSortDir=()=>{let r=t.getFilteredRowModel().flatRows[0];return typeof r?.getValue(e.id)=="string"?"asc":"desc"},e.getSortingFn=()=>{var r,n;if(!e)throw new Error;return e9(e.columnDef.sortingFn)?e.columnDef.sortingFn:e.columnDef.sortingFn==="auto"?e.getAutoSortingFn():(r=(n=t.options.sortingFns)==null?void 0:n[e.columnDef.sortingFn])!=null?r:eD[e.columnDef.sortingFn]},e.toggleSorting=(r,n)=>{let i=e.getNextSortingOrder(),a=typeof r<"u"&&r!==null;t.setSorting(o=>{let s=o?.find(p=>p.id===e.id),l=o?.findIndex(p=>p.id===e.id),u=[],c,f=a?r:i==="desc";if(o!=null&&o.length&&e.getCanMultiSort()&&n?s?c="toggle":c="add":o!=null&&o.length&&l!==o.length-1?c="replace":s?c="toggle":c="replace",c==="toggle"&&(a||i||(c="remove")),c==="add"){var d;u=[...o,{id:e.id,desc:f}],u.splice(0,u.length-((d=t.options.maxMultiSortColCount)!=null?d:Number.MAX_SAFE_INTEGER))}else c==="toggle"?u=o.map(p=>p.id===e.id?{...p,desc:f}:p):c==="remove"?u=o.filter(p=>p.id!==e.id):u=[{id:e.id,desc:f}];return u})},e.getFirstSortDir=()=>{var r,n;return((r=(n=e.columnDef.sortDescFirst)!=null?n:t.options.sortDescFirst)!=null?r:e.getAutoSortDir()==="desc")?"desc":"asc"},e.getNextSortingOrder=r=>{var n,i;let a=e.getFirstSortDir(),o=e.getIsSorted();return o?o!==a&&((n=t.options.enableSortingRemoval)!=null?n:!0)&&(r&&(i=t.options.enableMultiRemove)!=null?i:!0)?!1:o==="desc"?"asc":"desc":a},e.getCanSort=()=>{var r,n;return((r=e.columnDef.enableSorting)!=null?r:!0)&&((n=t.options.enableSorting)!=null?n:!0)&&!!e.accessorFn},e.getCanMultiSort=()=>{var r,n;return(r=(n=e.columnDef.enableMultiSort)!=null?n:t.options.enableMultiSort)!=null?r:!!e.accessorFn},e.getIsSorted=()=>{var r;let n=(r=t.getState().sorting)==null?void 0:r.find(i=>i.id===e.id);return n?n.desc?"desc":"asc":!1},e.getSortIndex=()=>{var r,n;return(r=(n=t.getState().sorting)==null?void 0:n.findIndex(i=>i.id===e.id))!=null?r:-1},e.clearSorting=()=>{t.setSorting(r=>r!=null&&r.length?r.filter(n=>n.id!==e.id):[])},e.getToggleSortingHandler=()=>{let r=e.getCanSort();return n=>{!r||(n.persist==null||n.persist(),e.toggleSorting==null||e.toggleSorting(void 0,e.getCanMultiSort()?t.options.isMultiSortEvent==null?void 0:t.options.isMultiSortEvent(n):!1))}}},createTable:e=>{e.setSorting=t=>e.options.onSortingChange==null?void 0:e.options.onSortingChange(t),e.resetSorting=t=>{var r,n;e.setSorting(t?[]:(r=(n=e.initialState)==null?void 0:n.sorting)!=null?r:[])},e.getPreSortedRowModel=()=>e.getGroupedRowModel(),e.getSortedRowModel=()=>(!e._getSortedRowModel&&e.options.getSortedRowModel&&(e._getSortedRowModel=e.options.getSortedRowModel(e)),e.options.manualSorting||!e._getSortedRowModel?e.getPreSortedRowModel():e._getSortedRowModel())}},aXe=[OZe,VZe,zZe,UZe,MZe,jZe,GZe,iXe,qZe,QZe,YZe,ZZe,XZe,WZe];function m2e(e){var t,r;let n=[...aXe,...(t=e._features)!=null?t:[]],i={_features:n},a=i._features.reduce((d,p)=>Object.assign(d,p.getDefaultOptions==null?void 0:p.getDefaultOptions(i)),{}),o=d=>i.options.mergeOptions?i.options.mergeOptions(a,d):{...a,...d},l={...{},...(r=e.initialState)!=null?r:{}};i._features.forEach(d=>{var p;l=(p=d.getInitialState==null?void 0:d.getInitialState(l))!=null?p:l});let u=[],c=!1,f={_features:n,options:{...a,...e},initialState:l,_queue:d=>{u.push(d),c||(c=!0,Promise.resolve().then(()=>{for(;u.length;)u.shift()();c=!1}).catch(p=>setTimeout(()=>{throw p})))},reset:()=>{i.setState(i.initialState)},setOptions:d=>{let p=Sv(d,i.options);i.options=o(p)},getState:()=>i.options.state,setState:d=>{i.options.onStateChange==null||i.options.onStateChange(d)},_getRowId:(d,p,h)=>{var m;return(m=i.options.getRowId==null?void 0:i.options.getRowId(d,p,h))!=null?m:`${h?[h.id,p].join("."):p}`},getCoreRowModel:()=>(i._getCoreRowModel||(i._getCoreRowModel=i.options.getCoreRowModel(i)),i._getCoreRowModel()),getRowModel:()=>i.getPaginationRowModel(),getRow:(d,p)=>{let h=(p?i.getPrePaginationRowModel():i.getRowModel()).rowsById[d];if(!h&&(h=i.getCoreRowModel().rowsById[d],!h))throw new Error;return h},_getDefaultColumnDef:Or(()=>[i.options.defaultColumn],d=>{var p;return d=(p=d)!=null?p:{},{header:h=>{let m=h.header.column.columnDef;return m.accessorKey?m.accessorKey:m.accessorFn?m.id:null},cell:h=>{var m,g;return(m=(g=h.renderValue())==null||g.toString==null?void 0:g.toString())!=null?m:null},...i._features.reduce((h,m)=>Object.assign(h,m.getDefaultColumnDef==null?void 0:m.getDefaultColumnDef()),{}),...d}},Mr(e,"debugColumns","_getDefaultColumnDef")),_getColumnDefs:()=>i.options.columns,getAllColumns:Or(()=>[i._getColumnDefs()],d=>{let p=function(h,m,g){return g===void 0&&(g=0),h.map(A=>{let b=DZe(i,A,g,m),v=A;return b.columns=v.columns?p(v.columns,b,g+1):[],b})};return p(d)},Mr(e,"debugColumns","getAllColumns")),getAllFlatColumns:Or(()=>[i.getAllColumns()],d=>d.flatMap(p=>p.getFlatColumns()),Mr(e,"debugColumns","getAllFlatColumns")),_getAllFlatColumnsById:Or(()=>[i.getAllFlatColumns()],d=>d.reduce((p,h)=>(p[h.id]=h,p),{}),Mr(e,"debugColumns","getAllFlatColumnsById")),getAllLeafColumns:Or(()=>[i.getAllColumns(),i._getOrderColumnsFn()],(d,p)=>{let h=d.flatMap(m=>m.getLeafColumns());return p(h)},Mr(e,"debugColumns","getAllLeafColumns")),getColumn:d=>i._getAllFlatColumnsById()[d]};Object.assign(i,f);for(let d=0;dOr(()=>[e.options.data],t=>{let r={rows:[],flatRows:[],rowsById:{}},n=function(i,a,o){a===void 0&&(a=0);let s=[];for(let u=0;ue._autoResetPageIndex()))}function A2e(){return e=>Or(()=>[e.getState().expanded,e.getPreExpandedRowModel(),e.options.paginateExpandedRows],(t,r,n)=>!r.rows.length||t!==!0&&!Object.keys(t??{}).length||!n?r:g2e(r),Mr(e.options,"debugTable","getExpandedRowModel"))}function g2e(e){let t=[],r=n=>{var i;t.push(n),(i=n.subRows)!=null&&i.length&&n.getIsExpanded()&&n.subRows.forEach(r)};return e.rows.forEach(r),{rows:t,flatRows:e.flatRows,rowsById:e.rowsById}}function v2e(){return e=>Or(()=>[e.getState().grouping,e.getPreGroupedRowModel()],(t,r)=>{if(!r.rows.length||!t.length)return r;let n=t.filter(l=>e.getColumn(l)),i=[],a={},o=function(l,u,c){if(u===void 0&&(u=0),u>=n.length)return l.map(h=>(h.depth=u,i.push(h),a[h.id]=h,h.subRows&&(h.subRows=o(h.subRows,u+1,h.id)),h));let f=n[u],d=oXe(l,f);return Array.from(d.entries()).map((h,m)=>{let[g,A]=h,b=`${f}:${g}`;b=c?`${c}>${b}`:b;let v=o(A,u+1,b),x=u?n2e(A,S=>S.subRows):A,w=i2e(e,b,x[0].original,m,u,void 0,c);return Object.assign(w,{groupingColumnId:f,groupingValue:g,subRows:v,leafRows:x,getValue:S=>{if(n.includes(S)){if(w._valuesCache.hasOwnProperty(S))return w._valuesCache[S];if(A[0]){var k;w._valuesCache[S]=(k=A[0].getValue(S))!=null?k:void 0}return w._valuesCache[S]}if(w._groupingValuesCache.hasOwnProperty(S))return w._groupingValuesCache[S];let j=e.getColumn(S),O=j?.getAggregationFn();if(O)return w._groupingValuesCache[S]=O(S,x,A),w._groupingValuesCache[S]}}),v.forEach(S=>{i.push(S),a[S.id]=S}),w})},s=o(r.rows,0);return s.forEach(l=>{i.push(l),a[l.id]=l}),{rows:s,flatRows:i,rowsById:a}},Mr(e.options,"debugTable","getGroupedRowModel",()=>{e._queue(()=>{e._autoResetExpanded(),e._autoResetPageIndex()})}))}function oXe(e,t){let r=new Map;return e.reduce((n,i)=>{let a=`${i.getGroupingValue(t)}`,o=n.get(a);return o?o.push(i):n.set(a,[i]),n},r)}function y2e(e){return t=>Or(()=>[t.getState().pagination,t.getPrePaginationRowModel(),t.options.paginateExpandedRows?void 0:t.getState().expanded],(r,n)=>{if(!n.rows.length)return n;let{pageSize:i,pageIndex:a}=r,{rows:o,flatRows:s,rowsById:l}=n,u=i*a,c=u+i;o=o.slice(u,c);let f;t.options.paginateExpandedRows?f={rows:o,flatRows:s,rowsById:l}:f=g2e({rows:o,flatRows:s,rowsById:l}),f.flatRows=[];let d=p=>{f.flatRows.push(p),p.subRows.length&&p.subRows.forEach(d)};return f.rows.forEach(d),f},Mr(t.options,"debugTable","getPaginationRowModel"))}function t9(e,t){return e?sXe(e)?rD.createElement(e,t):e:null}function sXe(e){return lXe(e)||typeof e=="function"||uXe(e)}function lXe(e){return typeof e=="function"&&(()=>{let t=Object.getPrototypeOf(e);return t.prototype&&t.prototype.isReactComponent})()}function uXe(e){return typeof e=="object"&&typeof e.$$typeof=="symbol"&&["react.memo","react.forward_ref"].includes(e.$$typeof.description)}function b2e(e){let t={state:{},onStateChange:()=>{},renderFallbackValue:null,...e},[r]=rD.useState(()=>({current:m2e(t)})),[n,i]=rD.useState(()=>r.current.initialState);return r.current.setOptions(a=>({...a,...e,state:{...n,...e.state},onStateChange:o=>{i(o),e.onStateChange==null||e.onStateChange(o)}})),r.current}var Vt=Ae(Te()),cEe=Ae(bl());var Xs=Ae(Te());var ai=Ae(Te());var Yy=e=>{let t;try{t=cXe(e)}catch{t=e}return t};function rg(e){if(!e)return["",""];let t=e.match(/^(.*?)\s*\/\/\s*(.*)$/);return t?[t[1],t[2]]:["",e]}var cXe=e=>{let r=e.split("-").map(n=>`0x${n}`);return String.fromCodePoint(...r)};var fXe=e=>{let[t,r]=(0,ai.useState)(""),[n,i]=(0,ai.useState)([]),[a,o]=(0,ai.useState)([]),[s,l]=(0,ai.useState)(null),u=x=>x.type=="emoji"?Yy(x.html):x.html;(0,ai.useEffect)(()=>{let x=[];x.push(...e.ui.allStickers()),i(x)},[]);let c=(0,ai.useMemo)(()=>new Set(n.map(x=>x.type)),[n]),[f,d]=(0,ai.useState)(1),p=(0,ai.useCallback)(()=>{d(x=>x+1)},[f]),h=(0,ai.useRef)(null);(0,ai.useEffect)(()=>{let x=new IntersectionObserver(w=>{w[0].isIntersecting&&p()});return h.current&&x.observe(h.current),()=>{h.current&&x.unobserve(h.current)}},[p]);let[m,g]=(0,ai.useState)(null);(0,ai.useEffect)(()=>{o(n.filter(x=>x.name.includes(t)&&(m==null||x.type==m)).slice(0,f*250))},[t,n,f,m]);let A=x=>{r(x.target.value)},b=x=>{let w=s;x.key==="ArrowUp"&&w>0?l(w-1):x.key==="ArrowDown"&&w{v.current&&v.current.focus()},[v.current]),ai.default.createElement(ai.default.Fragment,null,ai.default.createElement("div",{className:"mk-palette-search"},ai.default.createElement("div",{className:"mk-icon-small",dangerouslySetInnerHTML:{__html:e.ui.getSticker("ui//search")}}),ai.default.createElement("input",{value:t,onChange:A,onKeyDown:b,placeholder:H.labels.findStickers,ref:v}),ai.default.createElement("button",{className:"mk-toolbar-button"})),ai.default.createElement("div",{className:"mk-menu-sections"},ai.default.createElement("div",{onClick:()=>g(null),className:`${m==null?"is-active":""} mk-menu-section`},"All"),[...c].map(x=>ai.default.createElement("div",{key:x,onClick:()=>g(x),className:`${m==x?"is-active":""} mk-menu-section`},x))),ai.default.createElement("div",{className:"mk-layout-row mk-layout-wrap mk-gap-4 mk-padding-12 mk-layout-scroll"},a.map((x,w)=>ai.default.createElement("div",{key:w,onClick:()=>{e.selectedSticker(a[w].type+"//"+a[w].value),e.hide()},className:s===w?"selected mk-padding-4 mk-border-radius-4 mk-hover":"mk-padding-4 mk-border-radius-4 mk-hover"},ai.default.createElement("div",{dangerouslySetInnerHTML:{__html:u(x)},className:"mk-sticker"}))),ai.default.createElement("div",{ref:h})))},Ta=fXe;var dXe=e=>{let[t,r]=(0,Xs.useState)(e.field),n=(u,c)=>{let f={...t,type:c[0],value:JSON.stringify(l(t,c))};r(f),e.saveField(f)},i=(u,c,f)=>e.superstate.ui.openMenu(u,{ui:e.superstate.ui,multi:!1,editable:!1,searchable:!1,saveOptions:f,value:[],showAll:!0,options:ml.filter(d=>!d.restricted).map((d,p)=>({id:p+1,name:d.label,value:d.type,icon:d.icon}))},c),a=u=>{let c={...t,value:u};r(c),e.saveField(c)},o=()=>{let u={...t,type:t.type==s.multiType?s.type:s.multiType};r(u),e.saveField(u)},s=fc(t.type,t.name)??ml[0],l=(u,c)=>c[0].startsWith("option")?JSON.stringify({options:e.options.map(f=>({name:f,value:f}))}):c[0]==s.type||c[0]==s.multiType?u.value:null;return Xs.default.createElement(Xs.default.Fragment,null,Xs.default.createElement("li",null,Xs.default.createElement("div",{className:"mk-menu-option",onClick:u=>e.onSubmenu((c,f)=>i(c,Ne(u.view.document),n))},Xs.default.createElement("span",null,H.labels.propertyType),Xs.default.createElement("span",null,s.label))),s.multi?Xs.default.createElement("div",{className:"mk-menu-option"},Xs.default.createElement("span",null,H.labels.multiple),Xs.default.createElement("input",{type:"checkbox",checked:t.type==s.multiType,onChange:()=>o()})):Xs.default.createElement(Xs.default.Fragment,null),Xs.default.createElement("div",{className:"mk-menu-separator"}),Xs.default.createElement(Y5,{superstate:e.superstate,name:t.name,table:t.table,fields:e.fields,fieldType:s.type,value:t.value,contextPath:e.contextPath,saveValue:a}))},yh=(e,t,r)=>{let{superstate:n,rect:i,editable:a,options:o,field:s,fields:l,contextPath:u,saveField:c,hide:f,deleteColumn:d,sortColumn:p,editCode:h,hidden:m}=e,g=x=>{if(!a){let w=or(s.value);c({...s,value:JSON.stringify({...w,alias:x})});return}c({...s,name:x})},A=[];A.push(uh(Vo(s,e.superstate)??"",x=>g(x))),A.push(Rt),a&&A.push({name:"",type:5,fragment:x=>Xs.default.createElement(dXe,{superstate:n,field:s,fields:l,contextPath:u,options:o,saveField:c,onSubmenu:x.onSubmenu})}),A.push(Rt),A.push({name:H.menu.setIcon,icon:"ui//gem",onClick:x=>{n.ui.openPalette(Xs.default.createElement(Ta,{ui:n.ui,selectedSticker:w=>c({...s,attrs:JSON.stringify({icon:w})})}),Ne(x.view.document))}}),A.push(Rt);let b=VQ(s.type,!1);return b&&p&&(A.push({name:H.menu.sortAscending,icon:"ui//sort-asc",onClick:()=>{p({field:s.name+s.table,fn:b})}}),A.push({name:H.menu.sortDescending,icon:"ui//sort-desc",onClick:()=>{p({field:s.name+s.table,fn:VQ(s.type,!0)})}})),A.push(Rt),f&&(m?A.push({name:H.menu.unhideProperty,icon:"ui//eye",onClick:()=>{f(s,!1)}}):A.push({name:H.menu.hideProperty,icon:"ui//eye-off",onClick:()=>{f(s,!0)}})),a&&(h&&A.push({name:H.menu.editCode,icon:"ui//code",onClick:()=>{h()}}),d&&A.push({name:H.menu.deleteProperty,icon:"ui//trash",onClick:()=>{d(s)}})),n.ui.openMenu(i,Ht(n.ui,A),e.win,e.anchor,t)};var x2e=Ae(Te());function r9(...e){return(0,x2e.useMemo)(()=>t=>{e.forEach(r=>r(t))},e)}var Ks=Ae(Te());var vrr=[{name:H.properties.fileProperty.name,value:"name"},{name:H.properties.fileProperty.createdTime,value:"ctime"},{name:H.properties.fileProperty.modifiedTime,value:"mtime"},{name:H.properties.fileProperty.sticker,value:"sticker"},{name:H.properties.fileProperty.extension,value:"extension"},{name:H.properties.fileProperty.size,value:"size"},{name:H.properties.fileProperty.parentFolder,value:"folder"},{name:H.properties.fileProperty.links,value:"inlinks"},{name:H.properties.fileProperty.tags,value:"tags"},{name:H.properties.fileProperty.spaces,value:"spaces"}],n9=e=>{let[t,r]=(0,Ks.useState)(e.column),n=(0,Ks.useRef)(null),{spaceInfo:i,spaceState:a}=(0,Ks.useContext)(ur),{predicate:o,tableData:s,contextTable:l,cols:u,newColumn:c,saveColumn:f,hideColumn:d,sortColumn:p,delColumn:h}=(0,Ks.useContext)(Na);(0,Ks.useEffect)(()=>{r(e.column)},[e.column]);let{attributes:m,listeners:g,setNodeRef:A,transform:b}=Us({id:t.name+t.table,data:{name:t.name}}),{setNodeRef:v}=zu({id:t.name+t.table,data:{name:t.name}}),x=O=>{O.name.length>0&&(O.name!=e.column.name||O.type!=e.column.type||O.value!=e.column.value||O.attrs!=e.column.attrs)&&f(O,e.column)&&e.isNew&&r(e.column)},w=O=>{let C=k.current.getBoundingClientRect();Nf(e.superstate,C,Ne(O.view.document),{spaces:a?.contexts??[],fields:u,saveField:(N,D)=>c({...D,table:N}),schemaId:s.schema.id,contextPath:i.path})},S=O=>{if(e.isNew)w(O);else{let C=O.target.getBoundingClientRect(),N=Uee(t.name,t.table==""?s:l[Wn(t.table)]);yh({superstate:e.superstate,rect:C,win:Ne(O.view.document),editable:t.name!=mt,options:N,field:t,fields:u,contextPath:i.path,saveField:x,hide:d,deleteColumn:h,sortColumn:p,hidden:o?.colsHidden.includes(t.name+t.table)})}},k=(0,Ks.useRef)(null),j=r9(v,A);return Ks.default.createElement("div",{ref:j,...g,...m,className:"mk-col-header",onClick:O=>{S(O)}},Ks.default.createElement("div",{ref:k},e.column.name.length>0?Ks.default.createElement(Ks.default.Fragment,null,Ks.default.createElement("div",{className:"mk-path-context-field-icon",dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker(Ii(e.column))}}),Ks.default.createElement("div",{className:"mk-path-context-field-key"},Vo(t,e.superstate))):"+",Ks.default.createElement("span",{className:"mk-col-header-context","aria-label":e.column.table.length>0?e.column.table:""},e.column.table.length>0?"#":"")))};var fEe=Ae(Ya());var _2e=Ae(Te());var Zy=(e,t,r)=>{if(e.spacesIndex.has(t)){pi(e,Af(e,e.spacesIndex.get(t).space),{[e.settings.fmKeyBanner]:r});return}pi(e,t,{[e.settings.fmKeyBanner]:r})},A2=async(e,t,r)=>{e.spaceManager.saveLabel(t,e.settings.fmKeyColor,r)},Kp=async(e,t,r)=>{e.spaceManager.saveLabel(t,e.settings.fmKeySticker,r)},nD=(e,t,r,n)=>{let i=os([n,...dl(r).filter(a=>a==n)]);return pi(e,t,{[e.settings.fmKeyAlias]:la("option-multi",i,!0)})};var S2e=async(e,t,r,n,i,a,o,s)=>{if(t.length==1){pXe(e,t[0],r,n,i,a,o,s);return}if(i){let l=a.findIndex(({id:m})=>m===n),u=a[l],c=u.type=="file"?u.depth==0?null:a.find(m=>m.id==u.parentId)?.item:u.item,f=t.filter(m=>!QB(m,c.path)),d=i.insert?n:i.parentId,p=a.find(({id:m})=>m===d)?.item.path,h=d==u.id?-1:u.rank??-1;if(!p)return;g2(e,f,p,i.sortable&&h,s)}},pXe=async(e,t,r,n,i,a,o,s)=>{if(i){let l=a,u=l.findIndex(({id:A})=>A===n),c=l[u],f=i.insert?n:i.parentId,d=i.depth==0&&!i.insert?null:l.find(({id:A})=>A===f)?.item.path,p=f==null?o.findIndex(A=>A?.path==c.id):f==c.id?-1:c.rank??-1;if(!r){w2e(e,t,null,d,i.sortable&&p,s);return}let h=l.findIndex(({id:A})=>A===r),m=l[h],g=m.parentId==null?null:l.find(({id:A})=>A===m.parentId)?.item.path;w2e(e,m.item.path,g,d,i.sortable&&p,s)}},mXe=(e,t,r)=>{let n=e.focuses[e.settings.currentWaypoint]??{sticker:"",name:"Waypoint",paths:[]},a=n.paths.findIndex(s=>s==t)>r?Math.max(0,r-1):r;n.paths=Ws(n.paths,n.paths.findIndex(s=>s==t),a),e.settings.currentWaypoint>e.focuses.length&&e.spaceManager.saveFocuses([...e.focuses,n]);let o=e.focuses.map((s,l)=>l==e.settings.currentWaypoint?n:s);e.spaceManager.saveFocuses(o)},w2e=async(e,t,r,n,i,a)=>{if(!e.pathsIndex.get(t))return!1;if(!n){mXe(e,t,i);return}let s=e.spacesIndex.get(n);if(r==n){GS(e,t,i,n);return}(s.type=="folder"||s.type=="vault")&&(a=="link"||QB(t,s.path)?rh(e,s,t,i):RV(e,e.pathsIndex.get(t),s.path,i,a=="copy")),s.type=="tag"&&th(e,t,s.name),r&&r!=n&&lv(e,r,[t])},g2=async(e,t,r,n,i)=>{let a=e.spacesIndex.get(r);!a||((a.type=="folder"||a.type=="vault")&&t.forEach(o=>{i=="link"||QB(o,a.path)?rh(e,a,o,n):RV(e,e.pathsIndex.get(o),a.path,n,i=="copy")}),a.type=="tag"&&t.forEach(o=>th(e,o,a.name)))};var E2e=(e,t,r)=>{t.forEach(n=>{Kp(e,n,r)})},k2e=(e,t,r)=>{t.forEach(n=>{A2(e,n,r)})},v2=(e,t,r)=>{Kp(e,t,r)},i9=(e,t)=>{t.forEach(r=>{Kp(e,r,"")})},y2=(e,t)=>{Kp(e,t,"")};var iD=Ae(Te());var b2=Ae(Te());var Xy=e=>{let{hide:t,confirmAction:r,message:n,confirmLabel:i}=e,a=()=>{r(),t()};return b2.default.createElement("div",{className:"mk-modal-contents"},b2.default.createElement("div",{className:"mk-modal-message"},n),b2.default.createElement("div",{className:"mk-button-group"},b2.default.createElement("button",{onClick:()=>a(),className:"mod-warning"},i),b2.default.createElement("button",{onClick:()=>t&&t()},H.buttons.cancel)))};var hXe=e=>`${e}-gradient(`,cY=e=>{let t=e.values;t.sort((o,s)=>o.position-s.position),t=t.length==1?[t[0],t[0]]:t;let r=t.map(o=>`${o.color} ${o.position}%`).join(", "),n=e.type,i=["top","left","bottom","right","center"],a=e.direction;return["linear","repeating-linear"].indexOf(n)>=0&&i.indexOf(a)>=0&&(a=a==="center"?"to right":`to ${a}`),["radial","repeating-radial"].indexOf(n)>=0&&i.indexOf(a)>=0&&(a=`circle at ${a}`),r?`${n}-gradient(${a}, ${r})`:""},C2e=e=>{let t=null,r=null,n=e.indexOf("(")+1,i=e.lastIndexOf(")"),a=e.substring(n,i),o=a.split(/,(?![^(]*\)) /);if(!a)return null;o.length>2&&(r=o.shift());let s=!1;return["repeating-linear","repeating-radial","linear","radial"].forEach(u=>{e.indexOf(hXe(u))>-1&&!s&&(s=!0,t=u)}),t?{type:t,direction:r,values:o.map(u=>{let c=u.split(" "),f=parseFloat(c.pop()),d=c.join("");return{position:f,color:d}})}:null};var fY=Ae(yi());var Aa=Ae(Te());var x2=[["Red","var(--mk-color-red)"],["Pink","var(--mk-color-pink)"],["Orange","var(--mk-color-orange)"],["Yellow","var(--mk-color-yellow)"],["Green","var(--mk-color-green)"],["Turquoise","var(--mk-color-turquoise)"],["Teal","var(--mk-color-teal)"],["Blue","var(--mk-color-blue)"],["Purple","var(--mk-color-purple)"],["Brown","var(--mk-color-brown)"],["Charcoal","var(--mk-color-charcoal)"],["Gray","var(--mk-color-gray)"]],D2e=[["Base 0","var(--mk-color-base-0)"],["Base 10","var(--mk-color-base-10)"],["Base 20","var(--mk-color-base-20)"],["Base 30","var(--mk-color-base-30)"],["Base 40","var(--mk-color-base-40)"],["Base 50","var(--mk-color-base-50)"],["Base 60","var(--mk-color-base-60)"],["Base 70","var(--mk-color-base-70)"],["Base 100","var(--mk-color-base-100)"]],O2e=[["Background","var(--mk-ui-background)"],["Background Variant","var(--mk-ui-background-variant)"],["Background Contrast","var(--mk-ui-background-contrast)"],["Background Active","var(--mk-ui-background-active)"],["Background Selected","var(--mk-ui-background-selected)"]],M2e=[["Text Primary","var(--mk-ui-text-primary)"],["Text Secondary","var(--mk-ui-text-secondary)"],["Text Tertiary","var(--mk-ui-text-tertiary)"]];var AXe=e=>{let[t,r]=(0,Aa.useState)(null),[n,i]=(0,Aa.useState)(null),[a,o]=(0,Aa.useState)(e.color??"#eb3b5a"),[s,l]=(0,Aa.useState)(a),u=(0,Aa.useRef)(null),c=p=>{if(l(p),t){let h={...t};h.values.find(g=>g.id==n).color=p,r(h);let m=cY(h);o(m),e.saveValue(m);return}o(p),e.saveValue(p),e.stayOpen||e.hide()},f=p=>{let h=cY(p);o(h),e.saveValue(h)},d=p=>{p&&(o(p),l(p));let h;try{h=C2e(p);let m=h.values.map(g=>{let A=t?.values.find(b=>b.position==g.position&&b.color==g.color);return A?{...g,id:A.id??(0,fY.uniqueId)()}:{...g,id:(0,fY.uniqueId)()}});h.values=m}catch(m){console.log(m)}h?(r(h),l(h.values[0].color)):l(p)};return(0,Aa.useEffect)(()=>{l(t?.values.find(p=>p.id==n)?.color)},[n,t]),Aa.default.createElement("div",{className:"mk-ui-color-picker"},Aa.default.createElement("div",{className:"mk-ui-color-picker-palette"},Aa.default.createElement("div",{style:{width:"100%",display:"flex",alignItems:"center",marginBottom:"12px"}},Aa.default.createElement("div",{onMouseDown:()=>{e.saveValue("")},className:"mk-color",style:{background:`linear-gradient(to top left, rgba(0,0,0,0) 0%, rgba(255,0,0,0) calc(50% - 1px), rgba(255,0,0,1) 50%, rgba(255,0,0,0) calc(50% + 1px), - rgba(0,0,0,0) 100%)`}}),Aa.default.createElement("span",{style:{flex:1}}),H.editor.hex,Aa.default.createElement("input",{style:{width:"auto"},type:"text",defaultValue:s,onClick:p=>p.stopPropagation(),onMouseDown:p=>p.stopPropagation(),onKeyDown:p=>{p.key=="Enter"&&p.target.blur()},onBlur:p=>{c(p.target.value)}})),Aa.default.createElement("div",{style:{fontSize:"13px",padding:"4px",marginTop:"8px"}},H.editor.themeColors),Aa.default.createElement("div",null,x2.map((p,h)=>Aa.default.createElement("div",{key:h,"aria-label":p[0],onMouseDown:()=>{c(p[1])},className:"mk-color",style:{background:p[1]}}))),Aa.default.createElement("div",null,D2e.map((p,h)=>Aa.default.createElement("div",{key:h,"aria-label":p[0],onMouseDown:()=>{c(p[1])},className:"mk-color",style:{background:p[1]}}))),Aa.default.createElement("div",{style:{fontSize:"13px",padding:"4px",marginTop:"8px"}},H.editor.uiColors),Aa.default.createElement("div",null,O2e.map((p,h)=>Aa.default.createElement("div",{key:h,"aria-label":p[0],onMouseDown:()=>{c(p[1])},className:"mk-color",style:{background:p[1]}})),M2e.map((p,h)=>Aa.default.createElement("div",{key:h,"aria-label":p[0],onMouseDown:()=>{c(p[1])},className:"mk-color",style:{background:p[1]}})))))},Gu=(e,t,r,n,i,a,o)=>e.ui.openCustomMenu(t,Aa.default.createElement(AXe,{superstate:e,color:n,saveValue:i,stayOpen:a}),{},r,"bottom");var Fa=(e,t,r,n,i,a,o)=>{let s=[...r.allSpaces(!0)].filter(l=>(i||l.type!="default")&&(!o||l.type=="tag")).map(l=>({name:l.name,value:l.path,icon:r.pathsIndex.get(l.path)?.label?.sticker,section:l.type=="tag"?"tag":l.type=="folder"?"folder":"",description:l.type=="tag"?l.name:(l.type=="folder",l.path)}));return r.ui.openMenu(e,{ui:r.ui,multi:!1,editable:a,addKeyword:"Create",value:[],options:s,sections:o?[]:[{name:H.buttons.tag,value:"tag"},{name:H.menu.folder,value:"folder"}],saveOptions:(l,u)=>{n(u[0],!s.some(c=>c.value==u[0]))},placeholder:H.labels.spaceSelectPlaceholder,detail:!0,searchable:!0,showSections:!o,showAll:!0},t,"bottom")};var j2e=(e,t,r)=>{let n=t.map(a=>a.item.path),i=[];return i.push({name:H.menu.openFilePane,icon:"ui//go-to-file",onClick:a=>{n.forEach(o=>e.ui.openPath(o,!0))}}),i.push(Rt),i.push({name:H.buttons.addToSpace,icon:"ui//pin",onClick:a=>{let o=a.target.getBoundingClientRect();Fa(o,Ne(a.view.document),e,s=>{g2(e,t.map(l=>l.path),s,-1,"link")},!0)}}),e.settings.spacesStickers&&(i.push(Rt),i.push({name:H.menu.changeColor,icon:"ui//palette",type:6,onSubmenu:a=>Gu(e,a,Ne(r.view.document),"",o=>k2e(e,n,o),!1,!0)}),i.push({name:H.buttons.changeIcon,icon:"ui//sticker",onClick:a=>{e.ui.openPalette(iD.default.createElement(Ta,{ui:e.ui,selectedSticker:o=>E2e(e,n,o)}),Ne(a.view.document))}}),i.push({name:H.buttons.removeIcon,icon:"ui//file-minus",onClick:a=>{i9(e,n)}})),i.push(Rt),i.push({name:H.menu.moveFile,icon:"ui//paper-plane",onClick:a=>{let o=a.target.getBoundingClientRect();Fa(o,Ne(a.view.document),e,s=>{n.forEach(l=>{tee(e,l,s)})})}}),i.push(Rt),i.push({name:H.menu.hide,icon:"ui//eye-off",onClick:a=>{eee(e,n)}}),i.push({name:H.menu.delete,icon:"ui//trash",onClick:a=>{e.ui.openModal(H.labels.deleteFiles,iD.default.createElement(Xy,{confirmAction:()=>{n.forEach(o=>{F1(e,o)})},confirmLabel:H.buttons.delete,message:H.descriptions.deleteFiles.replace("${1}",n.length.toString())}),Ne(a.view.document))}}),e.ui.openMenu(r.target.getBoundingClientRect(),Ht(e.ui,i),Ne(r.view.document)),!1},Kp=(e,t,r,n,i,a,o)=>{let s=e.pathsIndex.get(t);if(!s)return;let l=[];if(l.push({name:H.menu.openFilePane,icon:"ui//go-to-file",onClick:u=>{e.ui.openPath(t,!0)}}),l.push(Rt),o&&(l.push({name:H.menu.closeSpace,icon:"ui//close",onClick:u=>{o()}}),l.push(Rt)),l.push({name:H.buttons.addToSpace,icon:"ui//pin",onClick:u=>{let c=u.target.getBoundingClientRect(),f=[],d=[...e.spacesMap.get(t)];Fa(c,Ne(u.view.document),e,p=>{g2(e,[t],p,-1,"link")},!0)}}),s.type=="file"&&s.subtype=="md"&&l.push({name:H.menu.changeToFolderNote,icon:"ui//file-plus-2",onClick:u=>{TM(e,t,!1)}}),l.push({name:"Save as Template",icon:"ui//clipboard-add",onClick:u=>{sv(e,t,r)}}),r&&r!=s.parent){let u=e.spacesIndex.get(r);u&&l.push({name:H.menu.removeFromSpace,icon:"ui//pin-off",onClick:c=>{lv(e,u.path,[t])}})}return e.settings.spacesStickers&&(l.push(Rt),l.push({name:H.menu.changeColor,icon:"ui//palette",type:6,onSubmenu:u=>Gu(e,u,i,"",c=>A2(e,t,c),!1,!0)}),l.push({name:H.buttons.changeIcon,icon:"ui//sticker",onClick:u=>{e.ui.openPalette(iD.default.createElement(Ta,{ui:e.ui,selectedSticker:c=>v2(e,t,c)}),Ne(u.view.document))}}),l.push({name:H.buttons.removeIcon,icon:"ui//file-minus",onClick:u=>{y2(e,t)}})),l.push(Rt),l.push({name:H.menu.rename,icon:"ui//edit",onClick:u=>{e.ui.openModal(H.labels.rename,iD.default.createElement(Ki,{saveLabel:H.buttons.rename,value:s.name,saveValue:c=>Ux(e,t,c)}),Ne(u.view.document))}}),l.push({name:H.menu.duplicate,icon:"ui//documents",onClick:u=>{e.spaceManager.copyPath(t,`${s.parent}`,`${s.name}`)}}),l.push({name:H.menu.moveFile,icon:"ui//paper-plane",onClick:u=>{let c=u.target.getBoundingClientRect();Fa(c,Ne(u.view.document),e,f=>{let d=e.pathsIndex.get(t);e.spaceManager.renamePath(t,Mm(t,f))})}}),l.push(Rt),Gr(e.ui)||(l.push({name:e.ui.getOS()=="mac"?H.menu.revealInDefault:H.menu.revealInExplorer,icon:"ui//arrow-up-right",onClick:u=>{e.ui.openPath(t,"system")}}),l.push(Rt)),l.push({name:H.menu.hide,icon:"ui//eye-off",onClick:u=>{NM(e,t)}}),l.push({name:H.menu.delete,icon:"ui//trash",onClick:u=>{F1(e,t)}}),e.ui.openMenu(n,Ht(e.ui,l),i,a),!1};var l9=Ae(Te());var jl=(e,t,r,n,i)=>{let a=[...r.pathsIndex.values()].filter(s=>!s.hidden).map(s=>({name:s.label.name,value:s.path,description:s.path,icon:s.label?.sticker,section:s.type})),o=Array.from(new Set(a.map(s=>s.section))).map(s=>({name:s,value:s}));return r.ui.openMenu(e,{ui:r.ui,multi:!1,editable:!0,value:[],options:a,saveOptions:(s,l)=>{n(l[0])},placeholder:H.labels.linkItemSelectPlaceholder,detail:!0,searchable:!0,showAll:!0,sections:o,showSections:!0,...i??{}},t)};var N2e=Ae(Te());var T2e=(e,t,r)=>{let n=e.spacesIndex.get(t);du(e,n.space,{...n.metadata,contexts:r})},gXe=(e,t,r,n,i)=>{let a=t.spacesIndex.get(r),o=t.spaceManager.readTags(),s=async l=>{let u=zx(l);T2e(t,a.path,[...a.metadata.contexts.filter(c=>c!=u),u])};return t.ui.openMenu(e,{ui:t.ui,multi:!1,editable:!0,value:[],options:o.map(l=>({name:l,value:l})),saveOptions:(l,u)=>s(u[0]),placeholder:H.labels.contextItemSelectPlaceholder,searchable:!0,showAll:!0},n,null,i)},vXe=(e,t,r,n,i)=>{let a=[];a.push({name:H.buttons.addContext,icon:"ui//plus",type:6,onSubmenu:(s,l)=>gXe(s,r,t,n,l)}),a.push(Rt);let o=r.spacesIndex.get(t);return o.contexts.forEach(s=>{a.push({name:s,icon:"ui//tags",onClick:l=>{r.ui.openPath(Wn(s))},onMoreOptions:l=>{let u=l.target.getBoundingClientRect(),c=[];return c.push({name:H.menu.deleteContext,icon:"ui//trash",onClick:f=>{T2e(r,o.path,o.contexts.filter(d=>d!=s))}}),r.ui.openMenu(u,{ui:r.ui,multi:!1,editable:!1,value:[],options:c,placeholder:H.labels.contextItemSelectPlaceholder,searchable:!1,showAll:!0},n)}})}),r.ui.openMenu(e,{ui:r.ui,multi:!1,editable:!1,value:[],options:a,placeholder:H.labels.contextItemSelectPlaceholder,searchable:!1,showAll:!0},n,null,i)},a9=(e,t,r,n)=>{let i=[{name:"Apply Tags",icon:"ui//tags",value:"apply-tags",onSubmenu:(a,o)=>vXe(a,r.path,t,n,o)},{name:"Set Default Sticker",icon:"ui//sticker",value:"apply-all-sticker",onClick:()=>{t.ui.openPalette(N2e.default.createElement(Ta,{ui:t.ui,selectedSticker:a=>du(t,r.space,{...r.metadata,defaultSticker:a})}),n)}}];return t.ui.openMenu(e,Ht(t.ui,i),n)};var o9=Ae(Te());var w2=(e,t,r,n)=>{if(t?.path==kx)e.ui.openModal("New Tag",o9.default.createElement(Ki,{value:"",saveLabel:H.labels.saveView,saveValue:i=>IV(e,i)}),r);else if(t)if(t?.metadata.template?.length>0){$V(e,t,t.metadata.template,n);return}else za(e,t,"md",null,!1,null,n);else YS(e,e.pathsIndex.get(e.ui.activePath)).then(i=>{i&&za(e,i,"md",null,!1,null,n)})},s9=(e,t,r,n,i,a)=>{let o=[];if(n.type=="default")o.push({name:"New Tag",icon:"ui//tags",onClick:s=>{e.ui.openModal("New Tag",o9.default.createElement(Ki,{value:"",saveLabel:H.labels.saveView,saveValue:l=>IV(e,l)}),Ne(s.view.document))}});else if(o.push({name:H.labels.createNote,icon:"ui//edit",onClick:s=>{za(e,n,"md",e.settings.newNotePlaceholder,i)}}),o.push({name:H.buttons.createCanvas,icon:"ui//layout-dashboard",onClick:s=>{za(e,n,"canvas",null,i)}}),o.push({name:H.labels.createSection,icon:"ui//folder-plus",onClick:s=>{e.ui.openModal(H.labels.createSection,o9.default.createElement(Ki,{saveLabel:H.buttons.createFolder,value:"",saveValue:l=>{let u=e.pathsIndex.get(n?.path);u||(u=e.pathsIndex.get("/"));let c=l.replace(/\//g,""),f=u?.subtype=="folder"?u.path:u.parent?u.parent:"/",d=!f||f=="/"?c:f+"/"+c;if(c.length==0){e.ui.notify(H.notice.newSpaceName);return}if(e.spacesIndex.has(d)){e.ui.notify(H.notice.duplicateSpaceName);return}kf(e,d,{})}}),Ne(s.view.document))}}),n.templates.length>0){o.push(Rt);for(let s of n.templates)o.push({name:s,icon:"ui//clipboard-pen",onClick:l=>{$V(e,n,s)}})}return e.ui.openMenu(t,Ht(e.ui,o),r,"bottom")};var Ky=(e,t,r,n,i,a)=>{let o=e.spacesIndex.get(t.path);if(!o)return;let s=[];s.push({name:H.menu.openFilePane,icon:"ui//go-to-file",onClick:u=>{e.ui.openPath(t.path,!0)}}),s.push(Rt),s.push({name:"New",type:6,onSubmenu:u=>s9(e,u,Ne(r.view.document),o,!1,!0),icon:"ui//plus"}),o.type=="folder"&&s.push({name:H.buttons.addIntoSpace,icon:"ui//pin",onClick:u=>{let c=u.target.getBoundingClientRect();jl(c,Ne(u.view.document),e,f=>{rh(e,o,f)}),u.stopPropagation()}}),s.push(Rt),s.push({name:"Apply to All Items",icon:"ui//pin",value:"apply-all",type:6,onSubmenu:u=>a9(u,e,o,Ne(r.view.document))}),a&&s.push({name:H.menu.closeSpace,icon:"ui//close",onClick:u=>{a()}}),s.push(Rt),o.type=="folder"&&(s.push({name:H.buttons.addToSpace,icon:"ui//pin",onClick:u=>{let c=u.target.getBoundingClientRect();Fa(c,Ne(u.view.document),e,f=>{let d=e.spacesIndex.get(f);d&&QS(e,d,o.path,-1)},!0)}}),s.push(Rt));let l=e.spacesIndex.get(i);if(l&&(l.type=="folder"||l.type=="vault")&&(s.push({name:"Save as Template",icon:"ui//clipboard-add",onClick:u=>{sv(e,o.path,i)}}),i!=t.parent)){let u=e.spacesIndex.get(i);u&&s.push({name:H.menu.removeFromSpace,icon:"ui//pin-off",onClick:c=>{lv(e,u.path,[o.path])}})}return s.push(Rt),e.settings.spacesStickers&&(s.push({name:H.menu.changeColor,icon:"ui//palette",type:6,onSubmenu:u=>Gu(e,u,Ne(r.view.document),"",c=>A2(e,o.path,c),!1,!0)}),s.push({name:H.buttons.changeIcon,icon:"ui//sticker",onClick:u=>{e.ui.openPalette(l9.default.createElement(Ta,{ui:e.ui,selectedSticker:c=>Xp(e,o.path,c)}),Ne(u.view.document))}}),s.push({name:H.buttons.removeIcon,icon:"ui//file-minus",onClick:u=>{y2(e,o.path)}})),o.metadata?.sort&&(s.push(Rt),s.push({name:H.menu.sortBy,icon:"ui//sort-desc",type:6,onSubmenu:u=>{let c=[];c.push({name:H.menu.groupSpaces,icon:"ui//arrow-up-down",value:o.metadata.sort.group==!0,type:3,onClick:x=>{Id(e,o.path,{field:o.metadata.sort.field,asc:o.metadata.sort.asc,group:!o.metadata.sort.group,recursive:o.metadata.sort.recursive})}}),c.push(Rt),c.push({name:H.menu.recurisveSort,icon:"ui//arrow-up-down",value:o.metadata.sort.recursive==!0,type:3,onClick:x=>{Id(e,o.path,{field:o.metadata.sort.field,asc:o.metadata.sort.asc,group:o.metadata.sort.group,recursive:!o.metadata.sort.recursive})}}),c.push(Rt);let f={field:"rank",asc:!0,group:o.metadata.sort.group,recursive:o.metadata.sort.recursive};c.push({name:H.menu.customSort,icon:"ui//arrow-up-down",value:o.metadata.sort.field==f.field&&o.metadata.sort.asc==f.asc,type:3,onClick:x=>{Id(e,o.path,f)}}),c.push(Rt);let d={field:"name",asc:!0,group:o.metadata.sort.group,recursive:o.metadata.sort.recursive};c.push({name:H.menu.fileNameSortAlphaAsc,icon:"ui//arrow-up-down",value:o.metadata.sort.field==d.field&&o.metadata.sort.asc==d.asc,type:3,onClick:x=>{Id(e,o.path,d)}});let p={field:"name",asc:!1,group:o.metadata.sort.group,recursive:o.metadata.sort.recursive};c.push({name:H.menu.fileNameSortAlphaDesc,icon:"ui//arrow-up-down",value:o.metadata.sort.field==p.field&&o.metadata.sort.asc==p.asc,type:3,onClick:x=>{Id(e,o.path,p)}}),c.push(Rt);let h={field:"number",asc:!0,group:o.metadata.sort.group,recursive:o.metadata.sort.recursive};c.push({name:H.menu.fileNameSortNumericalAsc,icon:"ui//arrow-up-down",value:o.metadata.sort.field==h.field&&o.metadata.sort.asc==h.asc,type:3,onClick:x=>{Id(e,o.path,h)}});let m={field:"number",asc:!1,group:o.metadata.sort.group,recursive:o.metadata.sort.recursive};c.push({name:H.menu.fileNameSortNumericalDesc,icon:"ui//arrow-up-down",value:o.metadata.sort.field==m.field&&o.metadata.sort.asc==m.asc,type:3,onClick:x=>{Id(e,o.path,m)}}),c.push(Rt);let g={field:"ctime",asc:!1,group:o.metadata.sort.group,recursive:o.metadata.sort.recursive};c.push({name:H.menu.createdTimeSortAsc,icon:"ui//arrow-up-down",value:o.metadata.sort.field==g.field&&o.metadata.sort.asc==g.asc,type:3,onClick:x=>{Id(e,o.path,g)}});let A={field:"ctime",asc:!0,group:o.metadata.sort.group,recursive:o.metadata.sort.recursive};c.push({name:H.menu.createdTimeSortDesc,icon:"ui//arrow-up-down",value:o.metadata.sort.field==A.field&&o.metadata.sort.asc==A.asc,type:3,onClick:x=>{Id(e,o.path,A)}}),c.push(Rt);let b={field:"size",asc:!1,group:o.metadata.sort.group,recursive:o.metadata.sort.recursive};c.push({name:H.menu.sizeSortAsc,icon:"ui//arrow-up-down",value:o.metadata.sort.field==b.field&&o.metadata.sort.asc==b.asc,type:3,onClick:x=>{Id(e,o.path,b)}});let v={field:"size",asc:!0,group:o.metadata.sort.group,recursive:o.metadata.sort.recursive};return c.push({name:H.menu.sizeSortDesc,icon:"ui//arrow-up-down",value:o.metadata.sort.field==v.field&&o.metadata.sort.asc==v.asc,type:3,onClick:x=>{Id(e,o.path,v)}}),e.ui.openMenu(u,Ht(e.ui,c),Ne(r.view.document))}})),o.type!="default"&&(s.push(Rt),s.push({name:H.menu.rename,icon:"ui//edit",onClick:u=>{e.ui.openModal(H.labels.rename,l9.default.createElement(Ki,{saveLabel:H.buttons.rename,value:o.type=="tag"?hl(o.name):o.name,saveValue:c=>Ux(e,o.path,c)}),Ne(u.view.document))}})),s.push({name:H.menu.duplicate,icon:"ui//documents",onClick:u=>{e.spaceManager.copyPath(t.path,`${t.parent}`)}}),o.type=="folder"&&s.push({name:H.menu.moveFile,icon:"ui//paper-plane",onClick:u=>{let c=u.target.getBoundingClientRect();Fa(c,Ne(u.view.document),e,f=>{e.spaceManager.renameSpace(o.path,Mm(o.path,f))})}}),s.push(Rt),Gr(e.ui)||s.push({name:e.ui.getOS()=="mac"?H.menu.revealInDefault:H.menu.revealInExplorer,icon:"ui//arrow-up-right",onClick:u=>{e.ui.openPath(o.space.folderPath,"system")}}),s.push(Rt),o.type=="folder"&&s.push({name:H.menu.hide,icon:"ui//eye-off",onClick:u=>{NM(e,o.path)}}),(o.type=="folder"||o.type=="tag")&&s.push({name:H.menu.delete,icon:"ui//trash",onClick:u=>{e.ui.openModal(H.labels.deleteSpace,l9.default.createElement(Xy,{confirmAction:()=>_ye(e,o.path),confirmLabel:H.buttons.delete,message:H.descriptions.deleteSpace}),Ne(u.view.document))}}),e.ui.openMenu(r.target.getBoundingClientRect(),Ht(e.ui,s),Ne(r.view.document)),!1};var Qu=Ae(Te()),F2e=e=>{let[t,r]=Qu.default.useState();(0,Qu.useEffect)(()=>{(async()=>{let s=await e.superstate.spaceManager.readTable(e.path,e.schema);r(s)})()},[e.path,e.schema]);let n=t?.cols??[],i=t?.rows[e.index],a=async(o,s)=>{let u=(await e.superstate.spaceManager.readTable(e.path,e.schema)).rows[e.index];u&&HN(e.superstate.spaceManager,e.superstate.spacesIndex.get(e.path)?.space,e.schema,e.index,{...u,[o]:s})};return Qu.default.createElement("div",{className:"mk-editor-frame-properties"},Qu.default.createElement("div",{className:"mk-editor-actions-name"},Qu.default.createElement("div",{className:"mk-editor-actions-name-icon"},Qu.default.createElement("div",{className:"mk-icon-small",dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//list")}})),Qu.default.createElement("div",{className:"mk-editor-actions-name-text"},H.buttons.editProperty),Qu.default.createElement("span",null),Qu.default.createElement("div",{className:"mk-icon-small mk-inline-button",dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//close")},onClick:()=>e.hide()})),Qu.default.createElement("div",{className:"mk-props-contexts"},n.map((o,s)=>Qu.default.createElement(Qu.default.Fragment,{key:s},Qu.default.createElement(bs,{initialValue:i[o.name],column:o,compactMode:!1,superstate:e.superstate,editMode:3,row:i,updateValue:l=>{a(o.name,l)},source:e.pathState.path,columns:n})))))};var u9=async(e,t,r,n,i)=>{e.preventDefault();let a=await t.spaceManager.readTable(r,n),o=a?.schema,s=a?.rows;if(!a)return;if(o.primary=="true"){let c=s.find((f,d)=>d==i);if(c){if(t.spacesIndex.has(c[mt])){let f=t.pathsIndex.get(c[mt]);f&&Ky(t,f,e,"",r);return}Kp(t,c[mt],r,e.target.getBoundingClientRect(),Ne(e.view.document));return}}let l=[],u={superstate:t,pathState:t.pathsIndex.get(r),path:r,schema:n,index:i};l.push({name:H.menu.editProperties,icon:"ui//list",onClick:c=>{t.ui.openCustomMenu(c.currentTarget.getBoundingClientRect(),_2e.default.createElement(F2e,{...u}),u,Ne(c.view.document))}}),l.push({name:H.menu.deleteRow,icon:"ui//trash",onClick:c=>{qoe(t.spaceManager,t.spacesIndex.get(r)?.space,n,i)}}),t.ui.openMenu(e.target.getBoundingClientRect(),Ht(t.ui,l),Ne(e.view.document))};var dY=(e,t)=>{if(!e&&t.length>0)return t[0];let r=t.indexOf(e);return r{let r=t.indexOf(e);return r>0?t[r-1]:t[0]},P2e=(e,t,r)=>{let n=r.findIndex(a=>a==e),i=r.findIndex(a=>a==t);return no>n&&o<=i):r.filter((a,o)=>o=i)};var dEe=Ae(yi());var xo=Ae(Te());var ng=Ae(Te());var c9=e=>{let{initialValue:t,saveValue:r}=e,[n,i]=ng.default.useState(t=="true"),a=()=>{e.editMode!=0&&(i(!n),r(n?"false":"true"))};return(0,ng.useEffect)(()=>{e.editMode==4&&(i(!n),r(n?"false":"true"),e.setEditMode(null))},[e.editMode]),ng.default.useEffect(()=>{i(t=="true")},[t]),e.editMode<2?ng.default.createElement("div",{className:"mk-cell-boolean"},ng.default.createElement("input",{type:"checkbox",checked:n,onChange:a})):ng.default.createElement("div",{className:"mk-cell-boolean"},ng.default.createElement("input",{type:"checkbox",checked:n,onChange:a}))};var mY=Ae(Te());var I2e=e=>{let t=r=>{let n=a=>{e.saveValue(a)},i=r.target.getBoundingClientRect();Gu(e.superstate,i,Ne(r.view.document),e.initialValue,n)};return mY.default.createElement("div",null,mY.default.createElement("div",{className:"mk-setter-color",onClick:r=>t(r),style:{backgroundColor:e.initialValue,width:30,height:30}}))};var bh=Ae(Te());var Pc=Ae(Te());var aD=e=>{let{pathState:t}=e,r=t?.label?.sticker,n=t?.label?.color,i=l=>{if(!t)return;l.preventDefault(),l.stopPropagation();let u=[];return u.push({name:H.buttons.changeIcon,icon:"ui//sticker",onClick:c=>{e.superstate.ui.openPalette(Pc.default.createElement(Ta,{ui:e.superstate.ui,selectedSticker:f=>Xp(e.superstate,t?.path,f)}),Ne(c.view.document))}}),u.push({name:H.buttons.removeIcon,icon:"ui//file-minus",onClick:()=>{i9(e.superstate,[t.path])}}),e.superstate.ui.openMenu(l.target.getBoundingClientRect(),Ht(e.superstate.ui,u),Ne(l.view.document)),!1},a=l=>{if(l.stopPropagation(),t?.type=="space"){e.superstate.ui.openPalette(Pc.default.createElement(Ta,{ui:e.superstate.ui,selectedSticker:u=>Xp(e.superstate,t.path,u)}),Ne(l.view.document));return}e.superstate.ui.openPalette(Pc.default.createElement(Ta,{ui:e.superstate.ui,selectedSticker:u=>Xp(e.superstate,t.path,u)}),Ne(l.view.document))},[o,s]=rg(r);return Pc.default.createElement("div",{className:`mk-path-icon ${r?"":"mk-path-icon-placeholder"}`},o=="image"?Pc.default.createElement("img",{src:e.superstate.ui.getUIPath(e.superstate.imagesCache.get(s))}):Pc.default.createElement("button",{"aria-label":H.buttons.changeIcon,onContextMenu:i,style:n?.length>0?{"--label-color":`${n}`,"--icon-color":"#ffffff"}:{"--icon-color":"var(--mk-ui-text-secondary)"},dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker(r)},onClick:l=>e.editable&&a(l)}))},f9=e=>{let[t,r]=(0,Pc.useState)(null),n=()=>{r(e.superstate.pathsIndex.get(e.path))},i=a=>{a.path==e.path&&n()};return(0,Pc.useEffect)(()=>(n(),e.superstate.eventsDispatcher.addListener("pathStateUpdated",i),()=>{e.superstate.eventsDispatcher.removeListener("pathStateUpdated",i)}),[e.path]),t?Pc.default.createElement(aD,{superstate:e.superstate,pathState:t,editable:!0}):Pc.default.createElement(Pc.default.Fragment,null)};var oo=e=>{let t=(0,bh.useMemo)(()=>e.source&&e.path?e.superstate.spaceManager.resolvePath(e.path,e.source):e.path,[e.source,e.path]),[r,n]=(0,bh.useState)(e.superstate.pathsIndex.get(t)),i=()=>{n(e.superstate.pathsIndex.get(t))},a=o=>{o.path==t&&i()};return(0,bh.useEffect)(()=>(e.superstate.eventsDispatcher.addListener("pathStateUpdated",a),i(),()=>{e.superstate.eventsDispatcher.removeListener("pathStateUpdated",a)}),[t]),bh.default.createElement("div",{className:"mk-path",onClick:()=>{e.superstate.ui.openPath(r?.path??t,!1)},onContextMenu:o=>{r&&(o.stopPropagation(),Kp(e.superstate,r.path,e.source,{x:o.clientX,y:o.clientY,width:0,height:0},Ne(o.view.document)))}},r&&!e.hideIcon&&bh.default.createElement(aD,{superstate:e.superstate,pathState:r}),bh.default.createElement("span",null,(!e.hideName&&r?.label.name)??t),e.children)};var Ff=Ae(Te());var hY=Ae(yi()),Ai=Ae(Te());var d9=e=>{let t=(0,Ai.useMemo)(()=>pr(e.propertyValue,"option",e.superstate,e.source),[e.propertyValue,e.source]),r=(m,g,A,b)=>[...(m??[]).filter(v=>v.value).map(v=>({...v,color:b?v.color?.length>0?v.color:"var(--mk-color-none)":void 0,removeable:b?A>=2:!1}))??[],...g.map(v=>({name:v,value:v,color:b?"var(--mk-color-none)":void 0,removeable:b?A>=2:!1}))].filter(AJ("value")).filter(v=>v.value.length>0),n=(m,g)=>(g?sr(m)??[]:[m]).filter(A=>A&&A.length>0),[i,a]=(0,Ai.useState)(r(t.options??[],n(e.initialValue,e.multi),e.editMode,!t.source)),[o,s]=(0,Ai.useState)(n(e.initialValue,e.multi));(0,Ai.useEffect)(()=>{s(n(e.initialValue,e.multi))},[e.initialValue,e.multi]),(0,Ai.useEffect)(()=>{a(r(t.options??[],o,e.editMode,!t.source))},[t,o,e.editMode]);let l=m=>{if(e.multi){let g=o.filter(A=>A!=m);s(g),e.saveValue(Bi(g))}else s([]),e.saveValue("")},u=m=>{let g=i.filter(b=>b.value!=m),A=o.filter(b=>b!=m);a(g),s(A),e.multi?e.saveOptions(pA(g,t),Bi(A)):e.saveOptions(pA(g,t),os(A))},c=(m,g)=>{e.multi?e.saveOptions(pA(m,t),Bi(g)):e.saveOptions(pA(m,t),os(g))},f=(m,g)=>{let A=(0,hY.uniq)([...m,...g]).filter(b=>b.length>0).map(b=>i.find(v=>v.value==b)??{name:b,value:b});if(!e.multi)e.editMode>=2&&a(A),s(g),c(A,g);else{let b=(0,hY.uniq)([...o,g[0]]);e.editMode>=2&&a(A),s(b),c(A,b)}},d=(m,g)=>{let A=i.map(v=>v.value==m?g:v),b=o;a(A),s(b),c(A,b)},p=(m,g)=>{let A=i.find(v=>v.value==g),b=[];b.push(uh(A.value,v=>d(A.value,{...A,value:v}))),b.push(Rt),b.push({name:"None",color:"var(--mk-color-none)",onClick:()=>{d(A.value,{...A,color:""})}}),x2.forEach(v=>{b.push({name:v[0],value:v[1],color:`${v[1]}`,onClick:()=>{d(A.value,{...A,color:v[1]})}})}),e.superstate.ui.openMenu(m.target.getBoundingClientRect(),Ht(e.superstate.ui,b),Ne(m.view.document))},h=()=>({multi:!1,editable:e.editMode>=2,ui:e.superstate.ui,value:o,options:e.multi?i:[{name:H.menu.none,value:""},...i],saveOptions:f,removeOption:e.editMode>=2&&u,onMoreOption:e.editMode>=2&&p,placeholder:H.labels.optionItemSelectPlaceholder,searchable:!0,showAll:!0,onHide:()=>e.setEditMode(null)});return Ai.default.createElement(ig,{superstate:e.superstate,baseClass:"mk-cell-option",value:o,menuProps:h,multi:e.multi,removeValue:l,selectLabel:e.compactMode?e.property.name:H.labels.select,editMode:e.editMode,labelElement:m=>{let g=i.find(A=>A.value==m.value)?.color??"var(--mk-color-none)";return Ai.default.createElement("div",{className:"mk-cell-option-item",style:{background:`${g}`,color:g=="var(--mk-color-none)"?"inherit":"var(--mk-color-white)"}},Ai.default.createElement("span",null,m.value),m.children)}})},ig=e=>{let{value:t,menuProps:r}=e,n=(0,Ai.useRef)(null),i=(0,Ai.useRef)(null),a=()=>{if(n.current){n.current.hide(),n.current=null;return}let s=i.current.getBoundingClientRect();n.current=e.superstate.ui.openMenu(s,r(),Ne(i.current.ownerDocument),"bottom",()=>n.current=null)},o=e.editMode>1;return Ai.default.createElement("div",{className:e.baseClass,ref:i},t.length>0?t.map((s,l)=>Ai.default.createElement(Ai.default.Fragment,{key:l},e.labelElement&&Ai.default.createElement(e.labelElement,{value:s},o?!e.multi&&t.length>0?Ai.default.createElement("div",{onClick:u=>{u.stopPropagation(),a()},className:"mk-cell-option-select mk-icon-xxsmall mk-icon-rotated",dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//collapse-solid")}}):e.multi?Ai.default.createElement("div",{className:"mk-cell-option-remove mk-icon-xxsmall",onClick:u=>{u.stopPropagation(),e.removeValue(s)},dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//close")}}):null:null))):o&&!e.multi?Ai.default.createElement("div",{className:"mk-cell-option-item",onClick:s=>{a()}},Ai.default.createElement("div",{className:"mk-cell-empty"},e.selectLabel),Ai.default.createElement("div",{className:"mk-cell-option-select mk-icon-xxsmall mk-icon-rotated",dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//collapse-solid")}})):e.editMode==0?Ai.default.createElement("div",{className:"mk-cell-option-item mk-cell-empty"},Ai.default.createElement("div",null,H.menu.none)):Ai.default.createElement(Ai.default.Fragment,null),o&&e.multi?Ai.default.createElement("div",{onClick:s=>{s.stopPropagation(),o&&a()},className:"mk-cell-option-new mk-icon-small",dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//plus")}}):Ai.default.createElement(Ai.default.Fragment,null))};var B2e=e=>{let{contextTable:t}=e,r=(0,Ff.useMemo)(()=>pr(e.propertyValue,"context",e.superstate),[e.propertyValue]),n=(0,Ff.useMemo)(()=>r?e.superstate.spaceManager.resolvePath(r.space,e.contextPath):null,[r.space,e.contextPath]),i=(m,g)=>(g?sr(m)??[]:[m]).filter(A=>A),[a,o]=(0,Ff.useState)([]);(0,Ff.useEffect)(()=>{!r?.field||!t[n]||o(t[n].rows.reduce((m,g)=>sr(g[r.field]).includes(e.path)?[...m,g[mt]]:m,[]))},[n,r,t]);let s=[...e.superstate.spacesMap.getInverse(n)].map(m=>e.superstate.pathsIndex.get(m)).filter(m=>m).map(m=>({name:m.name,icon:m.label.sticker,description:m.path,value:m.path})),[l,u]=(0,Ff.useState)(i(e.initialValue,e.multi)),c=(0,Ff.useMemo)(()=>kr([...l,...a]),[l,a]),f=m=>{e.multi?e.saveValue(Bi(m)):e.saveValue(os(m))},d=m=>{if(a.includes(m)){let g=a.filter(A=>A!=m);o(g),WN(e.superstate.spaceManager,e.superstate.spacesIndex.get(n).space,m,r.spaceField,e.path,Foe)}else{let g=l.filter(A=>A!=m);u(g),f(g.map(A=>A))}};(0,Ff.useEffect)(()=>{u(i(e.initialValue,e.multi))},[e.initialValue,e.multi]);let p=(m,g)=>{let A=[...e.superstate.spacesMap.getInverse(n)].filter(b=>!g.includes(b));if(A.length>0&&A.forEach(b=>{let v=e.superstate.spacesIndex.get(n);e.superstate.pathsIndex.get(b)?QS(e.superstate,v,b):za(e.superstate,v,"md",b,!0)}),!e.multi)u(g),f(g);else{let b=g[0];if(b){let v=[...l,b];u(v),f(v)}}},h=()=>{let m=e.multi?s:[{name:H.menu.none,value:""},...s];return{ui:e.superstate.ui,multi:!1,editable:!0,value:c.map(g=>g.path),options:m,saveOptions:p,placeholder:H.labels.contextItemSelectPlaceholder,searchable:!0,showAll:!0,onHide:()=>e.setEditMode(null)}};return Ff.default.createElement(ig,{baseClass:"mk-cell-context",superstate:e.superstate,menuProps:h,removeValue:d,selectLabel:e.compactMode?e.property.name:H.labels.select,labelElement:m=>Ff.default.createElement(oo,{superstate:e.superstate,path:m.value,source:e.contextPath},m.children),value:c,multi:e.multi,editMode:e.editMode})};var Fi=Ae(Te());var Ln=Ae(Te());var Tr=function(){return Tr=Object.assign||function(t){for(var r,n=1,i=arguments.length;n1&&(l||!u),f=t>1&&(u||!l),d=function(){!n||a(n)},p=function(){!i||a(i)};return dt.jsx(KXe,{displayMonth:e.displayMonth,hideNext:c,hidePrevious:f,nextMonth:i,previousMonth:n,onPreviousClick:d,onNextClick:p})}function JXe(e){var t,r=ga(),n=r.classNames,i=r.disableNavigation,a=r.styles,o=r.captionLayout,s=r.components,l=(t=s?.CaptionLabel)!==null&&t!==void 0?t:V2e,u;return i?u=dt.jsx(l,{id:e.id,displayMonth:e.displayMonth}):o==="dropdown"?u=dt.jsx($2e,{displayMonth:e.displayMonth,id:e.id}):o==="dropdown-buttons"?u=dt.jsxs(dt.Fragment,{children:[dt.jsx($2e,{displayMonth:e.displayMonth,displayIndex:e.displayIndex,id:e.id}),dt.jsx(q2e,{displayMonth:e.displayMonth,displayIndex:e.displayIndex,id:e.id})]}):u=dt.jsxs(dt.Fragment,{children:[dt.jsx(l,{id:e.id,displayMonth:e.displayMonth,displayIndex:e.displayIndex}),dt.jsx(q2e,{displayMonth:e.displayMonth,id:e.id})]}),dt.jsx("div",{className:n.caption,style:a.caption,children:u})}function eKe(e){var t=ga(),r=t.footer,n=t.styles,i=t.classNames.tfoot;return r?dt.jsx("tfoot",{className:i,style:n.tfoot,children:dt.jsx("tr",{children:dt.jsx("td",{colSpan:8,children:r})})}):dt.jsx(dt.Fragment,{})}function tKe(e,t,r){for(var n=r?tf(new Date):mo(new Date,{locale:e,weekStartsOn:t}),i=[],a=0;a<7;a++){var o=oa(n,a);i.push(o)}return i}function rKe(){var e=ga(),t=e.classNames,r=e.styles,n=e.showWeekNumber,i=e.locale,a=e.weekStartsOn,o=e.ISOWeek,s=e.formatters.formatWeekdayName,l=e.labels.labelWeekday,u=tKe(i,a,o);return dt.jsxs("tr",{style:r.head_row,className:t.head_row,children:[n&&dt.jsx("td",{style:r.head_cell,className:t.head_cell}),u.map(function(c,f){return dt.jsx("th",{scope:"col",className:t.head_cell,style:r.head_cell,"aria-label":l(c,{locale:i}),children:s(c,{locale:i})},f)})]})}function nKe(){var e,t=ga(),r=t.classNames,n=t.styles,i=t.components,a=(e=i?.HeadRow)!==null&&e!==void 0?e:rKe;return dt.jsx("thead",{style:n.head,className:r.head,children:dt.jsx(a,{})})}function iKe(e){var t=ga(),r=t.locale,n=t.formatters.formatDay;return dt.jsx(dt.Fragment,{children:n(e.date,{locale:r})})}var bY=(0,Ln.createContext)(void 0);function aKe(e){if(!sD(e.initialProps)){var t={selected:void 0,modifiers:{disabled:[]}};return dt.jsx(bY.Provider,{value:t,children:e.children})}return dt.jsx(oKe,{initialProps:e.initialProps,children:e.children})}function oKe(e){var t=e.initialProps,r=e.children,n=t.selected,i=t.min,a=t.max,o=function(u,c,f){var d,p;(d=t.onDayClick)===null||d===void 0||d.call(t,u,c,f);var h=Boolean(c.selected&&i&&n?.length===i);if(!h){var m=Boolean(!c.selected&&a&&n?.length===a);if(!m){var g=n?U2e([],n,!0):[];if(c.selected){var A=g.findIndex(function(b){return pl(u,b)});g.splice(A,1)}else g.push(u);(p=t.onSelect)===null||p===void 0||p.call(t,g,u,c,f)}}},s={disabled:[]};n&&s.disabled.push(function(u){var c=a&&n.length>a-1,f=n.some(function(d){return pl(d,u)});return Boolean(c&&!f)});var l={selected:n,onDayClick:o,modifiers:s};return dt.jsx(bY.Provider,{value:l,children:r})}function xY(){var e=(0,Ln.useContext)(bY);if(!e)throw new Error("useSelectMultiple must be used within a SelectMultipleProvider");return e}function sKe(e,t){var r=t||{},n=r.from,i=r.to;return n&&i?pl(i,e)&&pl(n,e)?void 0:pl(i,e)?{from:i,to:void 0}:pl(n,e)?void 0:Nx(n,e)?{from:e,to:i}:{from:n,to:e}:i?Nx(e,i)?{from:i,to:e}:{from:e,to:i}:n?ak(e,n)?{from:e,to:n}:{from:n,to:e}:{from:e,to:void 0}}var wY=(0,Ln.createContext)(void 0);function lKe(e){if(!lD(e.initialProps)){var t={selected:void 0,modifiers:{range_start:[],range_end:[],range_middle:[],disabled:[]}};return dt.jsx(wY.Provider,{value:t,children:e.children})}return dt.jsx(uKe,{initialProps:e.initialProps,children:e.children})}function uKe(e){var t=e.initialProps,r=e.children,n=t.selected,i=n||{},a=i.from,o=i.to,s=t.min,l=t.max,u=function(p,h,m){var g,A;(g=t.onDayClick)===null||g===void 0||g.call(t,p,h,m);var b=sKe(p,n);(A=t.onSelect)===null||A===void 0||A.call(t,b,p,h,m)},c={range_start:[],range_end:[],range_middle:[],disabled:[]};if(a?(c.range_start=[a],o?(c.range_end=[o],pl(a,o)||(c.range_middle=[{after:a,before:o}])):c.range_end=[a]):o&&(c.range_start=[o],c.range_end=[o]),s&&(a&&!o&&c.disabled.push({after:Fx(a,s-1),before:oa(a,s-1)}),a&&o&&c.disabled.push({after:a,before:oa(a,s-1)}),!a&&o&&c.disabled.push({after:Fx(o,s-1),before:oa(o,s-1)})),l){if(a&&!o&&(c.disabled.push({before:oa(a,-l+1)}),c.disabled.push({after:oa(a,l-1)})),a&&o){var f=od(o,a)+1,d=l-f;c.disabled.push({before:Fx(a,d)}),c.disabled.push({after:oa(o,d)})}!a&&o&&(c.disabled.push({before:oa(o,-l+1)}),c.disabled.push({after:oa(o,l-1)}))}return dt.jsx(wY.Provider,{value:{selected:n,onDayClick:u,modifiers:c},children:r})}function SY(){var e=(0,Ln.useContext)(wY);if(!e)throw new Error("useSelectRange must be used within a SelectRangeProvider");return e}function p9(e){return Array.isArray(e)?U2e([],e,!0):e!==void 0?[e]:[]}function cKe(e){var t={};return Object.entries(e).forEach(function(r){var n=r[0],i=r[1];t[n]=p9(i)}),t}var Jp;(function(e){e.Outside="outside",e.Disabled="disabled",e.Selected="selected",e.Hidden="hidden",e.Today="today",e.RangeStart="range_start",e.RangeEnd="range_end",e.RangeMiddle="range_middle"})(Jp||(Jp={}));var fKe=Jp.Selected,ag=Jp.Disabled,dKe=Jp.Hidden,pKe=Jp.Today,AY=Jp.RangeEnd,gY=Jp.RangeMiddle,vY=Jp.RangeStart,mKe=Jp.Outside;function hKe(e,t,r){var n,i=(n={},n[fKe]=p9(e.selected),n[ag]=p9(e.disabled),n[dKe]=p9(e.hidden),n[pKe]=[e.today],n[AY]=[],n[gY]=[],n[vY]=[],n[mKe]=[],n);return e.fromDate&&i[ag].push({before:e.fromDate}),e.toDate&&i[ag].push({after:e.toDate}),sD(e)?i[ag]=i[ag].concat(t.modifiers[ag]):lD(e)&&(i[ag]=i[ag].concat(r.modifiers[ag]),i[vY]=r.modifiers[vY],i[gY]=r.modifiers[gY],i[AY]=r.modifiers[AY]),i}var Y2e=(0,Ln.createContext)(void 0);function AKe(e){var t=ga(),r=xY(),n=SY(),i=hKe(t,r,n),a=cKe(t.modifiers),o=Tr(Tr({},i),a);return dt.jsx(Y2e.Provider,{value:o,children:e.children})}function Z2e(){var e=(0,Ln.useContext)(Y2e);if(!e)throw new Error("useModifiers must be used within a ModifiersProvider");return e}function gKe(e){return Boolean(e&&typeof e=="object"&&"before"in e&&"after"in e)}function vKe(e){return Boolean(e&&typeof e=="object"&&"from"in e)}function yKe(e){return Boolean(e&&typeof e=="object"&&"after"in e)}function bKe(e){return Boolean(e&&typeof e=="object"&&"before"in e)}function xKe(e){return Boolean(e&&typeof e=="object"&&"dayOfWeek"in e)}function wKe(e,t){var r,n=t.from,i=t.to;if(n&&i){var a=od(i,n)<0;a&&(r=[i,n],n=r[0],i=r[1]);var o=od(e,n)>=0&&od(i,e)>=0;return o}return i?pl(i,e):n?pl(n,e):!1}function SKe(e){return C1(e)}function EKe(e){return Array.isArray(e)&&e.every(C1)}function kKe(e,t){return t.some(function(r){if(typeof r=="boolean")return r;if(SKe(r))return pl(e,r);if(EKe(r))return r.includes(e);if(vKe(r))return wKe(e,r);if(xKe(r))return r.dayOfWeek.includes(e.getDay());if(gKe(r)){var n=od(r.before,e),i=od(r.after,e),a=n>0,o=i<0,s=Nx(r.before,r.after);return s?o&&a:a||o}return yKe(r)?od(e,r.after)>0:bKe(r)?od(r.before,e)>0:typeof r=="function"?r(e):!1})}function EY(e,t,r){var n=Object.keys(t).reduce(function(a,o){var s=t[o];return kKe(e,s)&&a.push(o),a},[]),i={};return n.forEach(function(a){return i[a]=!0}),r&&!Tx(e,r)&&(i.outside=!0),i}function CKe(e,t){for(var r=Wo(e[0]),n=Jg(e[e.length-1]),i,a,o=r;o<=n;){var s=EY(o,t),l=!s.disabled&&!s.hidden;if(!l){o=oa(o,1);continue}if(s.selected)return o;s.today&&!a&&(a=o),i||(i=o),o=oa(o,1)}return a||i}var DKe=365;function X2e(e,t){var r=t.moveBy,n=t.direction,i=t.context,a=t.modifiers,o=t.retry,s=o===void 0?{count:0,lastFocused:e}:o,l=i.weekStartsOn,u=i.fromDate,c=i.toDate,f=i.locale,d={day:oa,week:Xg,month:Uo,year:gM,startOfWeek:function(g){return i.ISOWeek?tf(g):mo(g,{locale:f,weekStartsOn:l})},endOfWeek:function(g){return i.ISOWeek?ek(g):AA(g,{locale:f,weekStartsOn:l})}},p=d[r](e,n==="after"?1:-1);n==="before"&&u?p=vM([u,p]):n==="after"&&c&&(p=yM([c,p]));var h=!0;if(a){var m=EY(p,a);h=!m.disabled&&!m.hidden}return h?p:s.count>DKe?s.lastFocused:X2e(p,{moveBy:r,direction:n,context:i,modifiers:a,retry:Tr(Tr({},s),{count:s.count+1})})}var K2e=(0,Ln.createContext)(void 0);function OKe(e){var t=Jy(),r=Z2e(),n=(0,Ln.useState)(),i=n[0],a=n[1],o=(0,Ln.useState)(),s=o[0],l=o[1],u=CKe(t.displayMonths,r),c=i??(s&&t.isDateDisplayed(s))?s:u,f=function(){l(i),a(void 0)},d=function(g){a(g)},p=ga(),h=function(g,A){if(!!i){var b=X2e(i,{moveBy:g,direction:A,context:p,modifiers:r});pl(i,b)||(t.goToDate(b,i),d(b))}},m={focusedDay:i,focusTarget:c,blur:f,focus:d,focusDayAfter:function(){return h("day","after")},focusDayBefore:function(){return h("day","before")},focusWeekAfter:function(){return h("week","after")},focusWeekBefore:function(){return h("week","before")},focusMonthBefore:function(){return h("month","before")},focusMonthAfter:function(){return h("month","after")},focusYearBefore:function(){return h("year","before")},focusYearAfter:function(){return h("year","after")},focusStartOfWeek:function(){return h("startOfWeek","before")},focusEndOfWeek:function(){return h("endOfWeek","after")}};return dt.jsx(K2e.Provider,{value:m,children:e.children})}function kY(){var e=(0,Ln.useContext)(K2e);if(!e)throw new Error("useFocusContext must be used within a FocusProvider");return e}function MKe(e,t){var r=Z2e(),n=EY(e,r,t);return n}var CY=(0,Ln.createContext)(void 0);function jKe(e){if(!h9(e.initialProps)){var t={selected:void 0};return dt.jsx(CY.Provider,{value:t,children:e.children})}return dt.jsx(NKe,{initialProps:e.initialProps,children:e.children})}function NKe(e){var t=e.initialProps,r=e.children,n=function(a,o,s){var l,u,c;if((l=t.onDayClick)===null||l===void 0||l.call(t,a,o,s),o.selected&&!t.required){(u=t.onSelect)===null||u===void 0||u.call(t,void 0,a,o,s);return}(c=t.onSelect)===null||c===void 0||c.call(t,a,a,o,s)},i={selected:t.selected,onDayClick:n};return dt.jsx(CY.Provider,{value:i,children:r})}function J2e(){var e=(0,Ln.useContext)(CY);if(!e)throw new Error("useSelectSingle must be used within a SelectSingleProvider");return e}function TKe(e,t){var r=ga(),n=J2e(),i=xY(),a=SY(),o=kY(),s=o.focusDayAfter,l=o.focusDayBefore,u=o.focusWeekAfter,c=o.focusWeekBefore,f=o.blur,d=o.focus,p=o.focusMonthBefore,h=o.focusMonthAfter,m=o.focusYearBefore,g=o.focusYearAfter,A=o.focusStartOfWeek,b=o.focusEndOfWeek,v=function(T){var L,_,Y,oe;h9(r)?(L=n.onDayClick)===null||L===void 0||L.call(n,e,t,T):sD(r)?(_=i.onDayClick)===null||_===void 0||_.call(i,e,t,T):lD(r)?(Y=a.onDayClick)===null||Y===void 0||Y.call(a,e,t,T):(oe=r.onDayClick)===null||oe===void 0||oe.call(r,e,t,T)},x=function(T){var L;d(e),(L=r.onDayFocus)===null||L===void 0||L.call(r,e,t,T)},w=function(T){var L;f(),(L=r.onDayBlur)===null||L===void 0||L.call(r,e,t,T)},S=function(T){var L;(L=r.onDayMouseEnter)===null||L===void 0||L.call(r,e,t,T)},k=function(T){var L;(L=r.onDayMouseLeave)===null||L===void 0||L.call(r,e,t,T)},j=function(T){var L;(L=r.onDayPointerEnter)===null||L===void 0||L.call(r,e,t,T)},O=function(T){var L;(L=r.onDayPointerLeave)===null||L===void 0||L.call(r,e,t,T)},C=function(T){var L;(L=r.onDayTouchCancel)===null||L===void 0||L.call(r,e,t,T)},N=function(T){var L;(L=r.onDayTouchEnd)===null||L===void 0||L.call(r,e,t,T)},D=function(T){var L;(L=r.onDayTouchMove)===null||L===void 0||L.call(r,e,t,T)},P=function(T){var L;(L=r.onDayTouchStart)===null||L===void 0||L.call(r,e,t,T)},q=function(T){var L;(L=r.onDayKeyUp)===null||L===void 0||L.call(r,e,t,T)},z=function(T){var L;switch(T.key){case"ArrowLeft":T.preventDefault(),T.stopPropagation(),r.dir==="rtl"?s():l();break;case"ArrowRight":T.preventDefault(),T.stopPropagation(),r.dir==="rtl"?l():s();break;case"ArrowDown":T.preventDefault(),T.stopPropagation(),u();break;case"ArrowUp":T.preventDefault(),T.stopPropagation(),c();break;case"PageUp":T.preventDefault(),T.stopPropagation(),T.shiftKey?m():p();break;case"PageDown":T.preventDefault(),T.stopPropagation(),T.shiftKey?g():h();break;case"Home":T.preventDefault(),T.stopPropagation(),A();break;case"End":T.preventDefault(),T.stopPropagation(),b();break}(L=r.onDayKeyDown)===null||L===void 0||L.call(r,e,t,T)},I={onClick:v,onFocus:x,onBlur:w,onKeyDown:z,onKeyUp:q,onMouseEnter:S,onMouseLeave:k,onPointerEnter:j,onPointerLeave:O,onTouchCancel:C,onTouchEnd:N,onTouchMove:D,onTouchStart:P};return I}function FKe(){var e=ga(),t=J2e(),r=xY(),n=SY(),i=h9(e)?t.selected:sD(e)?r.selected:lD(e)?n.selected:void 0;return i}function _Ke(e){return Object.values(Jp).includes(e)}function PKe(e,t){var r=[e.classNames.day];return Object.keys(t).forEach(function(n){var i=e.modifiersClassNames[n];if(i)r.push(i);else if(_Ke(n)){var a=e.classNames["day_".concat(n)];a&&r.push(a)}}),r}function IKe(e,t){var r=Tr({},e.styles.day);return Object.keys(t).forEach(function(n){var i;r=Tr(Tr({},r),(i=e.modifiersStyles)===null||i===void 0?void 0:i[n])}),r}function BKe(e,t,r){var n,i,a,o=ga(),s=kY(),l=MKe(e,t),u=TKe(e,l),c=FKe(),f=Boolean(o.onDayClick||o.mode!=="default");(0,Ln.useEffect)(function(){var S;l.outside||!s.focusedDay||!f||pl(s.focusedDay,e)&&((S=r.current)===null||S===void 0||S.focus())},[s.focusedDay,e,r,f,l.outside]);var d=PKe(o,l).join(" "),p=IKe(o,l),h=Boolean(l.outside&&!o.showOutsideDays||l.hidden),m=(a=(i=o.components)===null||i===void 0?void 0:i.DayContent)!==null&&a!==void 0?a:iKe,g=dt.jsx(m,{date:e,displayMonth:t,activeModifiers:l}),A={style:p,className:d,children:g,role:"gridcell"},b=s.focusTarget&&pl(s.focusTarget,e)&&!l.outside,v=s.focusedDay&&pl(s.focusedDay,e),x=Tr(Tr(Tr({},A),(n={disabled:l.disabled,role:"gridcell"},n["aria-selected"]=l.selected,n.tabIndex=v||b?0:-1,n)),u),w={isButton:f,isHidden:h,activeModifiers:l,selectedDays:c,buttonProps:x,divProps:A};return w}function RKe(e){var t=(0,Ln.useRef)(null),r=BKe(e.date,e.displayMonth,t);return r.isHidden?dt.jsx("div",{role:"gridcell"}):r.isButton?dt.jsx(m9,Tr({name:"day",ref:t},r.buttonProps)):dt.jsx("div",Tr({},r.divProps))}function $Ke(e){var t=e.number,r=e.dates,n=ga(),i=n.onWeekNumberClick,a=n.styles,o=n.classNames,s=n.locale,l=n.labels.labelWeekNumber,u=n.formatters.formatWeekNumber,c=u(Number(t),{locale:s});if(!i)return dt.jsx("span",{className:o.weeknumber,style:a.weeknumber,children:c});var f=l(Number(t),{locale:s}),d=function(p){i(t,r,p)};return dt.jsx(m9,{name:"week-number","aria-label":f,className:o.weeknumber,style:a.weeknumber,onClick:d,children:c})}function qKe(e){var t,r,n=ga(),i=n.styles,a=n.classNames,o=n.showWeekNumber,s=n.components,l=(t=s?.Day)!==null&&t!==void 0?t:RKe,u=(r=s?.WeekNumber)!==null&&r!==void 0?r:$Ke,c;return o&&(c=dt.jsx("td",{className:a.cell,style:i.cell,children:dt.jsx(u,{number:e.weekNumber,dates:e.dates})})),dt.jsxs("tr",{className:a.row,style:i.row,children:[c,e.dates.map(function(f){return dt.jsx("td",{className:a.cell,style:i.cell,role:"presentation",children:dt.jsx(l,{displayMonth:e.displayMonth,date:f})},wM(f))})]})}function L2e(e,t,r){for(var n=r?.ISOWeek?ek(t):AA(t,r),i=r?.ISOWeek?tf(e):mo(e,r),a=od(n,i),o=[],s=0;s<=a;s++)o.push(oa(i,s));var l=o.reduce(function(u,c){var f=r?.ISOWeek?xM(c):SM(c,r),d=u.find(function(p){return p.weekNumber===f});return d?(d.dates.push(c),u):(u.push({weekNumber:f,dates:[c]}),u)},[]);return l}function LKe(e,t){var r=L2e(Wo(e),Jg(e),t);if(t?.useFixedWeeks){var n=EM(e,t);if(n<6){var i=r[r.length-1],a=i.dates[i.dates.length-1],o=Xg(a,6-n),s=L2e(Xg(a,1),o,t);r.push.apply(r,s)}}return r}function zKe(e){var t,r,n,i=ga(),a=i.locale,o=i.classNames,s=i.styles,l=i.hideHead,u=i.fixedWeeks,c=i.components,f=i.weekStartsOn,d=i.firstWeekContainsDate,p=i.ISOWeek,h=LKe(e.displayMonth,{useFixedWeeks:Boolean(u),ISOWeek:p,locale:a,weekStartsOn:f,firstWeekContainsDate:d}),m=(t=c?.Head)!==null&&t!==void 0?t:nKe,g=(r=c?.Row)!==null&&r!==void 0?r:qKe,A=(n=c?.Footer)!==null&&n!==void 0?n:eKe;return dt.jsxs("table",{id:e.id,className:o.table,style:s.table,role:"grid","aria-labelledby":e["aria-labelledby"],children:[!l&&dt.jsx(m,{}),dt.jsx("tbody",{className:o.tbody,style:s.tbody,children:h.map(function(b){return dt.jsx(g,{displayMonth:e.displayMonth,dates:b.dates,weekNumber:b.weekNumber},b.weekNumber)})}),dt.jsx(A,{displayMonth:e.displayMonth})]})}function UKe(){return!!(typeof window<"u"&&window.document&&window.document.createElement)}var WKe=UKe()?Ln.useLayoutEffect:Ln.useEffect,yY=!1,HKe=0;function z2e(){return"react-day-picker-".concat(++HKe)}function VKe(e){var t,r=e??(yY?z2e():null),n=(0,Ln.useState)(r),i=n[0],a=n[1];return WKe(function(){i===null&&a(z2e())},[]),(0,Ln.useEffect)(function(){yY===!1&&(yY=!0)},[]),(t=e??i)!==null&&t!==void 0?t:void 0}function GKe(e){var t,r,n=ga(),i=n.dir,a=n.classNames,o=n.styles,s=n.components,l=Jy().displayMonths,u=VKe(n.id?"".concat(n.id,"-").concat(e.displayIndex):void 0),c=n.id?"".concat(n.id,"-grid-").concat(e.displayIndex):void 0,f=[a.month],d=o.month,p=e.displayIndex===0,h=e.displayIndex===l.length-1,m=!p&&!h;i==="rtl"&&(t=[p,h],h=t[0],p=t[1]),p&&(f.push(a.caption_start),d=Tr(Tr({},d),o.caption_start)),h&&(f.push(a.caption_end),d=Tr(Tr({},d),o.caption_end)),m&&(f.push(a.caption_between),d=Tr(Tr({},d),o.caption_between));var g=(r=s?.Caption)!==null&&r!==void 0?r:JXe;return dt.jsxs("div",{className:f.join(" "),style:d,children:[dt.jsx(g,{id:u,displayMonth:e.displayMonth,displayIndex:e.displayIndex}),dt.jsx(zKe,{id:c,"aria-labelledby":u,displayMonth:e.displayMonth})]},e.displayIndex)}function QKe(e){var t=ga(),r=t.classNames,n=t.styles;return dt.jsx("div",{className:r.months,style:n.months,children:e.children})}function YKe(e){var t,r,n=e.initialProps,i=ga(),a=kY(),o=Jy(),s=(0,Ln.useState)(!1),l=s[0],u=s[1];(0,Ln.useEffect)(function(){!i.initialFocus||!a.focusTarget||l||(a.focus(a.focusTarget),u(!0))},[i.initialFocus,l,a.focus,a.focusTarget,a]);var c=[i.classNames.root,i.className];i.numberOfMonths>1&&c.push(i.classNames.multiple_months),i.showWeekNumber&&c.push(i.classNames.with_weeknumber);var f=Tr(Tr({},i.styles.root),i.style),d=Object.keys(n).filter(function(h){return h.startsWith("data-")}).reduce(function(h,m){var g;return Tr(Tr({},h),(g={},g[m]=n[m],g))},{}),p=(r=(t=n.components)===null||t===void 0?void 0:t.Months)!==null&&r!==void 0?r:QKe;return dt.jsx("div",Tr({className:c.join(" "),style:f,dir:i.dir,id:i.id,nonce:n.nonce,title:n.title,lang:n.lang},d,{children:dt.jsx(p,{children:o.displayMonths.map(function(h,m){return dt.jsx(GKe,{displayIndex:m,displayMonth:h},m)})})}))}function ZKe(e){var t=e.children,r=yXe(e,["children"]);return dt.jsx($Xe,{initialProps:r,children:dt.jsx(YXe,{children:dt.jsx(jKe,{initialProps:r,children:dt.jsx(aKe,{initialProps:r,children:dt.jsx(lKe,{initialProps:r,children:dt.jsx(AKe,{children:dt.jsx(OKe,{children:t})})})})})})})}function eEe(e){return dt.jsx(ZKe,Tr({},e,{children:dt.jsx(YKe,{initialProps:e})}))}var kv=(e,t,r,n,i,a,o,s)=>e.openCustomMenu(t,Fi.default.createElement(KKe,{ui:e,value:n,setValue:i,time:a}),{width:"280px",height:"280px"},r,s),XKe=e=>{let{goToMonth:t,nextMonth:r,previousMonth:n}=Jy(),[i,a]=(0,Fi.useState)(!1);return Fi.default.createElement("div",{className:"mk-date-picker-header"},Fi.default.createElement("button",{disabled:!n,onClick:()=>n&&t(n),dangerouslySetInnerHTML:{__html:e.ui.getSticker("ui//chevron-left")}}),i?Fi.default.createElement("div",{className:"mk-date-picker-header-input"},Fi.default.createElement("input",{type:"text",value:e.displayMonth.getMonth()+1,onKeyDown:o=>{if(o.key==="ArrowUp"){let s=Uo(e.displayMonth,1);t(s)}else if(o.key==="ArrowDown"){let s=Uo(e.displayMonth,-1);t(s)}},onChange:o=>{let s=e.displayMonth;s.setMonth(+o.target.value-1),t(s)}}),Fi.default.createElement("input",{type:"text",value:e.displayMonth.getFullYear(),onKeyDown:o=>{if(o.key==="ArrowUp"){let s=e.displayMonth;s.setFullYear(s.getFullYear()+1),t(s)}else if(o.key==="ArrowDown"){let s=e.displayMonth;s.setFullYear(s.getFullYear()-1),t(s)}},onChange:o=>{let s=e.displayMonth;s.setFullYear(+o.target.value),t(s)}})):Fi.default.createElement("div",{onClick:()=>a(!0)},_r(e.ui.superstate,e.displayMonth,"MMM yyy")),Fi.default.createElement("button",{disabled:!r,onClick:()=>r&&t(r),dangerouslySetInnerHTML:{__html:e.ui.getSticker("ui//chevron-right")}}))},KKe=e=>{let[t,r]=(0,Fi.useState)(0),[n,i]=(0,Fi.useState)(0),[a,o]=(0,Fi.useState)(0),[s,l]=(0,Fi.useState)(e.value),[u,c]=(0,Fi.useState)(e.time==2),[f,d]=(0,Fi.useState)(!1),p=()=>{let m=e.value?e.value:e.time==0?Hn(new Date):new Date,g=m.getHours(),A=m.getMinutes(),b=m.getSeconds();r(g),i(A),o(b),l(m),e.time==1&&(g==0&&A==0&&b==0&&!u||c(!0))};(0,Fi.useEffect)(()=>{p()},[e.value,e.time]),(0,Fi.useEffect)(()=>{p()},[]);let h=m=>{let g=new Date(s),A=m?.h??t,b=m?.m??n,v=m?.s??a;m&&(m.h!==void 0&&r(m.h),m.m!==void 0&&i(m.m),m.s!==void 0&&o(m.s)),e.time&&(g.setHours(A),g.setMinutes(b),g.setSeconds(v),A==0&&b==0&&v==0&&c(!1)),m.y!==void 0&&g.setFullYear(m.y),m.mo!==void 0&&g.setMonth(m.mo),e.setValue(g,e.time!=0&&!(A==0&&b==0&&v==0))};return Fi.default.createElement("div",{className:"mk-date-picker-container"},Fi.default.createElement(eEe,{defaultMonth:s,mode:"single",classNames:{root:"mk-date-picker",day:"mk-date-picker-day",cell:"mk-date-picker-cell",months:"mk-date-picker-months",month:"mk-date-picker-month",day_today:"mk-date-picker-today",day_selected:"mk-date-picker-selected"},components:{Caption:m=>XKe({ui:e.ui,...m})},labels:{labelMonthDropdown:()=>{},labelYearDropdown:()=>{},labelNext:()=>{},labelPrevious:()=>{},labelDay:()=>{},labelWeekday:()=>{},labelWeekNumber:()=>{}},onSelect:(m,g,A,b)=>{let v=m;u&&(v.setHours(t),v.setMinutes(n),v.setSeconds(a)),l(v),e.setValue(v,e.time!=0&&!(t==0&&n==0&&a==0)),b.stopPropagation()}}),u?Fi.default.createElement("div",{className:"mk-date-picker-time"},Fi.default.createElement("div",{dangerouslySetInnerHTML:{__html:e.ui.getSticker("ui//clock")}}),Fi.default.createElement("input",{type:"text",value:t.toString().padStart(2,"0"),onKeyDown:m=>{m.key==="ArrowUp"?h({h:(t+1)%24}):m.key==="ArrowDown"&&h({h:(t+23)%24})},onChange:m=>{h({h:+m.target.value})}}),":",Fi.default.createElement("input",{type:"text",value:n.toString().padStart(2,"0"),onKeyDown:m=>{m.key==="ArrowUp"?h({m:(n+1)%60}):m.key==="ArrowDown"&&h({m:(n+59)%60})},onChange:m=>{h({m:+m.target.value})}}),Fi.default.createElement("button",{className:"mk-date-picker-meridiem",onClick:()=>{h({h:(t+12)%24})}},t<12?"AM":"PM"),Fi.default.createElement("button",{onClick:()=>h({h:0,m:0,s:0}),dangerouslySetInnerHTML:{__html:e.ui.getSticker("ui//close")}})):e.time==1?Fi.default.createElement("button",{onClick:()=>c(!0)},"Add Time"):null)};var tEe=Ae(Ya()),xs=Ae(Te());var rEe=e=>{let[t,r]=(0,xs.useState)(e.initialValue);(0,xs.useEffect)(()=>{r(e.initialValue)},[e.initialValue]);let n=(0,xs.useMemo)(()=>{let f=Yi(t);return Lee(f)?f:null},[t]),i=(f,d)=>{let p=_r(e.superstate,f,d?$s:"yyyy-MM-dd");e.saveValue(p),r(p),e.setEditMode(null)},a=(0,xs.useRef)(null),o=(0,xs.useRef)(null);(0,xs.useEffect)(()=>{e.editMode==4&&o.current&&(s(),o.current.focus())},[e.editMode]);let s=(0,xs.useCallback)(f=>{if(e.editMode<=1)return;let d=f?f.target.getBoundingClientRect():o.current.getBoundingClientRect();a.current=kv(e.superstate.ui,d,Ne(f.view.document),n,i,1,null,"bottom")},[n]),l=f=>{f.stopPropagation(),(f.key=="Enter"||f.key=="Escape")&&(f.target.blur(),i(n,!1),a.current.hide())},u=(0,xs.useMemo)(()=>or(e.propertyValue)?.format,[e.propertyValue]),c=!(t?.length>0);return xs.default.createElement("div",{className:"mk-cell-date",onClick:f=>!t&&s(f)},xs.default.createElement("div",{className:(0,tEe.default)("mk-cell-date-item",c&&"mk-cell-date-new")},xs.default.createElement("div",{className:"mk-icon-xsmall",dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//calendar")}}),c&&"Select",e.editMode==4?xs.default.createElement("input",{onClick:f=>f.stopPropagation(),className:"mk-cell-text",ref:o,type:"text",value:t,onChange:f=>r(f.target.value),onMouseDown:()=>s(),onKeyDown:l}):xs.default.createElement("div",{className:"mk-cell-date-value",onClick:f=>s(f)},n?_r(e.superstate,n,u?.length>0?u:null):t)))};var tm=Ae(Te());var em=Ae(Te());var A9=e=>{let t=(0,em.useMemo)(()=>e.multi?sr(e.initialValue)??[]:[e.initialValue],[e.initialValue]),r=(0,em.useRef)(null);(0,em.useEffect)(()=>{e.editMode==4&&r?.current?.focus()},[e.editMode]);let n=i=>{e.superstate.ui.openPalette(em.default.createElement(Ta,{ui:e.superstate.ui,selectedSticker:a=>e.saveValue(a)}),Ne(i.view.document))};return em.default.createElement("div",{className:"mk-cell-icon"},t.map((i,a)=>i?.length>0?em.default.createElement("div",{className:"mk-cell-clickable",key:a,"aria-label":H.buttons.changeIcon,dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker(i)},onClick:o=>n(o)}):em.default.createElement("div",{key:a,className:"mk-cell-placeholder",onClick:o=>n(o)},H.labels.selectIcon)))};var Nl=Ae(Te());var Cv=/https?:\/\/(www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_\+.~#?&//=]*)/gi;var JKe=e=>{let[t,r]=(0,Nl.useState)(""),[n,i]=(0,Nl.useState)([]),[a,o]=(0,Nl.useState)([]),[s,l]=(0,Nl.useState)(null);(0,Nl.useEffect)(()=>{let d=[];d.push(...[...e.superstate.pathsIndex.values()].filter(p=>p.subtype=="image").map(p=>({path:p.path,thumnail:p.label.thumbnail}))),i(d),o(d)},[]),(0,Nl.useEffect)(()=>{t.match(Cv)?o([{path:t,thumnail:t}]):o(n.filter(d=>d.path.includes(t)))},[t,n]);let u=d=>{r(d.target.value)},c=d=>{let p=a.findIndex(h=>h.path==s);d.key==="ArrowUp"&&p>0?l(a[p-1].path):d.key==="ArrowDown"&&p{f.current&&f.current.focus()},[f.current]),Nl.default.createElement(Nl.default.Fragment,null,Nl.default.createElement("input",{onKeyDown:c,value:t,ref:f,onChange:u,className:"mk-input mk-input-large mk-border-bottom"}),Nl.default.createElement("div",{className:"mk-layout-masonry mk-padding-12 mk-layout-scroll"},a.map(d=>Nl.default.createElement("img",{key:d.path,src:e.superstate.ui.getUIPath(d.thumnail),className:s===d.path?"mk-selected":"",onClick:()=>{e.selectedPath(d.path),e.hide()}}))))},_f=JKe;var Zo=Ae(Te());var g9=e=>{let{initialValue:t,multi:r}=e,[n,i]=Zo.default.useState(sr(t)),a=(0,Zo.useRef)(null),o=(0,Zo.useMemo)(()=>n?.length>0?n.map(c=>e.superstate.ui.getUIPath(c)):[],[n]);Zo.default.useEffect(()=>{i(sr(t))},[t]);let s=c=>{if(r){let f=[...n];f.splice(c,1),i(f),e.saveValue(Bi(f))}else e.saveValue("")},l=(c,f)=>{e.multi?c==-1?e.saveValue(Bi([...n,f])):e.saveValue(Bi(n.map((d,p)=>p==c?f:d))):e.saveValue(f)},u=(c,f)=>{e.superstate.ui.openPalette(Zo.default.createElement(_f,{superstate:e.superstate,selectedPath:d=>l(c,d)}),Ne(f.view.document)),e.setEditMode(null)};return Zo.default.createElement("div",{className:"mk-cell-image"},o.map((c,f)=>Zo.default.createElement("div",{key:f,className:"mk-cell-image-item"},Zo.default.createElement("img",{onClick:d=>e.superstate.ui.openPath(t,d.metaKey?"tab":!1),src:c}),e.editMode>1?Zo.default.createElement("div",{className:"mk-image-selector"},Zo.default.createElement("div",{onClick:d=>u(f,d),className:"mk-hover-button mk-icon-xsmall",dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//edit")}}),Zo.default.createElement("div",{onClick:()=>s(f),className:"mk-hover-button mk-icon-xsmall",dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//close")}})):Zo.default.createElement(Zo.default.Fragment,null))),e.editMode>1?e.multi?Zo.default.createElement("div",{onClick:c=>u(-1,c),className:"mk-cell-option-new mk-icon-small",dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//plus")}}):n.length==0?Zo.default.createElement("div",{onClick:c=>u(-1,c),className:"mk-cell-clickable"},"Select"):null:Zo.default.createElement(Zo.default.Fragment,null))};var eb=Ae(Te());var uD=e=>{let t=u=>e.multi?sr(u)??[]:[u].filter(c=>c).map(c=>e.superstate.spaceManager.resolvePath(c,e.source));(0,eb.useEffect)(()=>{n(t(e.initialValue))},[e.initialValue]);let[r,n]=(0,eb.useState)(t(e.initialValue)),i=u=>{let c=r.filter(f=>f!=u);n(c),a(c)},a=u=>{e.multi?e.saveValue(Bi(u)):e.saveValue(os(u))},o=(u,c)=>{if(!e.multi)n(c),a(c);else{let f=c[0];if(f){let d=kr([...r,f]);n(d),a(d)}}},s=()=>{let u=[...e.superstate.pathsIndex.values()].filter(f=>!f.hidden).map(f=>({name:f.name,value:f.path,description:f.path})),c=e.multi?u:[{name:H.menu.none,value:""},...u];return{ui:e.superstate.ui,multi:!1,editable:!0,value:r.map(f=>f),options:c,saveOptions:o,placeholder:H.labels.linkItemSelectPlaceholder,detail:!0,searchable:!0}},l=async u=>{await e.superstate.spaceManager.pathExists(u)||await e.superstate.spaceManager.createItemAtPath("/","md",u),e.superstate.ui.openPath(u,!1)};return eb.default.createElement(ig,{superstate:e.superstate,baseClass:"mk-cell-link",removeValue:i,selectLabel:e.compactMode?e.property.name:H.labels.select,menuProps:s,labelElement:u=>eb.default.createElement(oo,{superstate:e.superstate,path:u.value},u.children),value:r,multi:e.multi,editMode:e.editMode})};var nEe=e=>{let t=Bs(e.initialValue),r=(0,tm.useMemo)(()=>pr(e.propertyValue,"fileprop",e.superstate),[e.propertyValue]),n=(a,o)=>{e.saveOptions(JSON.stringify({...r,[a]:o}),"")},i=a=>{let o={superstate:e.superstate,saveFormula:s=>n("value",s),formula:r.value,value:e.row,fields:e.columns,path:e.path};e.superstate.ui.openCustomMenu(a.target.getBoundingClientRect(),tm.default.createElement(Ah,{...o}),{...o},Ne(a.view.document),"bottom")};return r.type=="boolean"?tm.default.createElement(c9,{...e,initialValue:t,editMode:0}):t?.length==0?tm.default.createElement(tm.default.Fragment,null):r.type=="image"?tm.default.createElement(g9,{...e,initialValue:t,editMode:0,multi:!0}):r.type=="icon"?tm.default.createElement(A9,{...e,initialValue:t,multi:!0,editMode:0}):r.type=="link"?tm.default.createElement(uD,{...e,initialValue:t,multi:!0,editMode:0}):tm.default.createElement(d9,{...e,initialValue:t,editMode:0,multi:!0,source:e.source})};var og=Ae(Te());var iEe=e=>{let{initialValue:t,saveValue:r}=e,[n,i]=og.default.useState(t),a=(0,og.useRef)(null),o=()=>{t!=n&&r(n)},s=l=>{l.stopPropagation(),l.key=="Enter"&&(l.target.blur(),e.setEditMode(null)),l.key=="Escape"&&(i(t),l.target.blur(),e.setEditMode(null))};return og.default.useEffect(()=>{i(t)},[t]),(0,og.useEffect)(()=>{e.editMode==4&&a?.current?.focus()},[e.editMode]),e.editMode>2?og.default.createElement("input",{className:"mk-cell-text",type:"number",ref:a,value:n??"",onChange:l=>i(l.target.value),onKeyDown:s,onBlur:o}):og.default.createElement("div",{className:"mk-cell-number"},n)};var fn=Ae(Te()),aEe=Ae(bl());var OY=e=>{let{value:t,saveValue:r,saveType:n}=e,i=[...Object.keys(e.type??{}).map(u=>({name:u,type:e.type[u].type,value:JSON.stringify({...e.type[u].value,alias:e.type[u].label})})),...Object.keys(t).filter(u=>!Object.keys(e.type??{}).includes(u)).map(u=>({name:u,type:"text"}))],a=(u,c)=>{u!=c&&r({...t,[c]:t[u],[u]:void 0})},o=(u,c)=>{r({...t,[u]:c})},s=(u,c)=>{if(e.editMode<=3)return;let f=u.target.getBoundingClientRect(),d=[];d.push({name:H.menu.rename,icon:"ui//edit",value:"edit",onClick:()=>{e.superstate.ui.openModal(H.labels.rename,fn.default.createElement(Ki,{value:c,saveLabel:H.labels.rename,saveValue:p=>{a(c,p)}}),Ne(u.view.document))}}),d.push({name:H.buttons.delete,icon:"ui//trash",value:"delete",onClick:()=>{e.saveType(Object.keys(e.type??{}).reduce((p,h)=>h!=c?{...p,[h]:e.type[h]}:p,{}),Object.keys(t).reduce((p,h)=>h!=c?{...p,[h]:t[h]}:p,{}))}}),e.superstate.ui.openMenu(f,Ht(e.superstate.ui,d),Ne(u.view.document))},l=(u,c,f)=>{if(u.type=="object"||u.type=="object-multi"){let d=jm(f,u.type=="object-multi");if(Rx(u)){let p=pr(c,u.type),h={...e.type,[u.name]:{type:u.type,label:u.name,value:p}};n(h,d)}}else o(u.name,f)};return fn.default.createElement("div",{className:"mk-cell-object-group"},e.draggable&&fn.default.createElement("div",{className:"mk-cell-object-group-header",onClick:u=>{e.showDragMenu(u)}},e.typeName??"Object"),fn.default.createElement("div",{className:"mk-cell-object"},i.map((u,c)=>fn.default.createElement(bs,{key:c,initialValue:t[u.name]??"",superstate:e.superstate,updateValue:f=>o(u.name,f),updateFieldValue:(f,d)=>l(u,f,d),propertyMenu:f=>s(f,u.name),row:t,columns:i,source:null,compactMode:e.compactMode,column:u,editMode:5}))))},MY=e=>{let t=pr(e.propertyValue,"object",e.superstate),r=t.type,{initialValue:n,superstate:i}=e,a=(0,fn.useMemo)(()=>jm(n,e.multi),[n,e.multi]),o=(v,x)=>{if(e.multi){let w=a.map(S=>({...Object.keys(v).reduce((k,j)=>S[j]?{...k,[j]:S[j]}:k,{})}));e.savePropValue(JSON.stringify({...t,type:v}),JSON.stringify(w))}else e.savePropValue(JSON.stringify({...t,type:v}),JSON.stringify(x))},s=v=>{e.saveValue(JSON.stringify(v))},l=v=>{let x=Object.keys(r).reduce((w,S)=>({...w,[S]:""}),{});e.saveValue(JSON.stringify([...a.slice(0,v),x,...a.slice(v)]))},u=(v,x)=>{if(x>=a.length){e.saveValue(JSON.stringify([...a,v]));return}e.saveValue(JSON.stringify(a.map((w,S)=>S==x?v:w)))},c=v=>{e.saveValue(JSON.stringify(a.filter((x,w)=>w!=v)))},f=v=>{v&&s({...a,[v]:""})},d=(v,x)=>{let w=v.target.getBoundingClientRect(),S=[];S.push({name:H.menu.insertAbove,value:"insert-above",onClick:k=>{l(x)}}),S.push({name:H.menu.insertBelow,value:"insert-below",onClick:k=>{l(x+1)}}),S.push(Rt),x>0&&S.push({name:H.menu.moveUp,value:"move-up",onClick:k=>{e.saveValue(JSON.stringify(Ws(a,x,x-1)))}}),x{e.saveValue(JSON.stringify(Ws(a,x,x+1)))}}),S.push(Rt),S.push({name:H.buttons.delete,icon:"ui//trash",value:"delete",onClick:()=>{c(x)}}),e.superstate.ui.openMenu(w,Ht(e.superstate.ui,S),Ne(v.view.document))},[p,h]=(0,fn.useState)(-1),[m,g]=(0,fn.useState)(-1),A=()=>{g(-1),h(-1)};Ca({onDragStart({active:v}){v.data.current.type=="object"&&h(v.data.current.id)},onDragOver({active:v,over:x}){let w=x?.data.current.id;v.data.current.type=="object"&&w&&g(w)},onDragCancel(){A()},onDragEnd({active:v,over:x}){if(!v||m!=-1){A();return}e.saveValue(JSON.stringify(Ws(a,p,m))),A()}});let b=(0,fn.useRef)();return(0,fn.useEffect)(()=>{b.current&&b.current.update(e)},[e]),e.compactMode?fn.default.createElement("div",{className:"mk-cell-object"},fn.default.createElement("div",{className:"mk-cell-clickable",onClick:v=>{b.current=i.ui.openCustomMenu(v.currentTarget.getBoundingClientRect(),fn.default.createElement(eJe,{...e}),e,Ne(v.view.document))}},fn.default.createElement("div",{className:"mk-icon-xsmall",dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//edit")}}),`${H.menu.edit} ${e.property.name}`)):e.multi?fn.default.createElement("div",{className:"mk-cell-object-multi"},a.map((v,x)=>fn.default.createElement(OY,{key:x,superstate:i,value:v,compactMode:e.compactMode,row:e.row,typeName:t.typeName,columns:e.columns,type:r,saveValue:w=>u(w,x),saveType:o,editMode:e.editMode,draggable:!0,index:x,showDragMenu:w=>d(w,x)})),p!=-1&&(0,aEe.createPortal)(fn.default.createElement(Um,{dropAnimation:null,zIndex:1600},fn.default.createElement(OY,{superstate:i,value:a[p],typeName:t.typeName,compactMode:e.compactMode,row:e.row,columns:e.columns,type:r,saveValue:null,saveType:null,editMode:e.editMode,draggable:!1})),document.body)):fn.default.createElement(OY,{superstate:i,value:a,typeName:t.typeName,compactMode:e.compactMode,row:e.row,columns:e.columns,type:r,saveValue:s,saveType:o,editMode:e.editMode,draggable:!1})},eJe=e=>{let[t,r]=(0,fn.useState)(e.initialValue),[n,i]=(0,fn.useState)(e.property.value),a=c=>{r(c),e.saveValue(c)},o=(c,f)=>{r(f),i(c),e.savePropValue(c,f)},s=(c,f)=>{let d=pr(n,e.property.type),p=jm(t,e.property.type=="object-multi");e.property.type=="object-multi"?o(JSON.stringify({...d,type:c}),JSON.stringify(p)):o(JSON.stringify({...d,type:c}),JSON.stringify(f))},l=c=>{let f=c.target.getBoundingClientRect(),d=pr(n,e.property.type)?.type,p=jm(t,e.property.type=="object-multi");Nf(e.superstate,f,Ne(c.view.document),{spaces:[],fields:[],saveField:(h,m)=>(s({...d??{},[m.name]:{type:m.type,label:m.name}},{...p,[m.name]:""}),!0),fileMetadata:!0})},u=c=>{let f=jm(t,e.property.type=="object-multi"),d=pr(n,e.property.type)?.type,p=Object.keys(d).reduce((h,m)=>({...h,[m]:""}),{});a(JSON.stringify([...f.slice(0,c),p,...f.slice(c)]))};return fn.default.createElement("div",{className:"mk-editor-frame-properties"},fn.default.createElement("div",{className:"mk-editor-actions-name"},fn.default.createElement("div",{className:"mk-editor-actions-name-icon"},fn.default.createElement("div",{className:"mk-icon-small",dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//list")}})),fn.default.createElement("div",{className:"mk-editor-actions-name-text"},H.labels.editObject),fn.default.createElement("span",null),fn.default.createElement("div",{className:"mk-icon-small mk-inline-button",dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//close")},onClick:()=>e.hide()})),fn.default.createElement(MY,{...e,initialValue:t,compactMode:!1,propertyValue:n,saveValue:c=>{a(c)},savePropValue:(c,f)=>{o(c,f)},editMode:5}),fn.default.createElement("div",{className:"mk-cell-object-options"},fn.default.createElement("button",{onClick:c=>l(c),className:"mk-toolbar-button"},fn.default.createElement("div",{className:"mk-icon-xsmall",dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//plus")}}),H.labels.propertyFileProp),e.property.type=="object-multi"&&fn.default.createElement("button",{onClick:c=>u(0),className:"mk-inline-button"},fn.default.createElement("div",{className:"mk-icon-xsmall",dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//insert")}}),"Object")))};var cD=Ae(Te());var v9=e=>{let[t,r]=(0,cD.useState)(Mk(e.initialValue)),n=(a,o)=>{r(Mk(o[0])),e.saveValue(o[0])},i=()=>{let a=(e.columns??[]).map(o=>({name:o.name,description:o.table,value:o.table==""?`$root['props']['${o.name}']`:`$contexts['${o.table}']['${o.name}']`}));return{ui:e.superstate.ui,multi:!1,editable:!0,value:t?[t]:[],options:a,saveOptions:n,placeholder:H.labels.linkItemSelectPlaceholder,detail:!0,searchable:!0}};return cD.default.createElement(ig,{superstate:e.superstate,removeValue:null,baseClass:"mk-cell-link",selectLabel:e.compactMode?e.property.name:H.labels.select,menuProps:i,labelElement:a=>cD.default.createElement("div",null,a.value),value:t?[t]:[],multi:!1,editMode:e.editMode})};var Ic=Ae(Te());var oEe=e=>{let t=(0,Ic.useMemo)(()=>pr(e.propertyValue,"aggregate",e.superstate),[e.propertyValue]),r=(0,Ic.useMemo)(()=>{let f=e.cols?.find(d=>d.name==t.ref);return f&&f.type=="context"?pr(f.value,"context",e.superstate):null},[e.cols,t]),n=(0,Ic.useMemo)(()=>{if(r&&r.space)return e.superstate.spaceManager.resolvePath(r.space,e.contextPath)},[r,e.contextPath]),i=(0,Ic.useMemo)(()=>e.contextTable[n]?.cols.find(f=>f.name==t.field),[t.field,e.contextTable,n]),a=(f,d)=>(d?sr(f)??[]:[f]).filter(p=>p),[o,s]=(0,Ic.useState)([]);(0,Ic.useEffect)(()=>{!r?.field||!e.contextTable[n]||s(e.contextTable[n].rows.reduce((f,d)=>sr(d[r.field]).includes(e.path)?[...f,d[mt]]:f,[]))},[n,r,e.path,e.contextTable]);let[l,u]=(0,Ic.useState)([]),c=(0,Ic.useMemo)(()=>!n||!i?"":Q5(e.superstate,kr([...l,...o]).map(f=>e.contextTable[n].rows.find(d=>d[mt]==f)).filter(f=>f).map(f=>f[i.name]),t.fn,i),[l,o,t,e.contextTable,n,i]);return(0,Ic.useEffect)(()=>{u(a(e.row[t.ref],e.multi))},[e.row,t,e.multi]),Ic.default.createElement("div",{className:"mk-cell-text"},c)};var Js=Ae(Te());var jY=e=>{let t=async()=>{e.superstate.ui.openPath(e.initialValue,!1)},r=(0,Js.useRef)(null),[n,i]=(0,Js.useState)(null);(0,Js.useEffect)(()=>{zN(e.superstate,e.initialValue).then(c=>i(c))},[e.initialValue]);let a=(0,Js.useRef)(null),o=()=>({multi:!1,ui:e.superstate.ui,editable:!0,value:[e.initialValue],options:e.superstate.allSpaces().map(c=>({name:c.name,value:c.path,description:c.name})),saveOptions:(c,f)=>e.saveValue(f[0]),removeOption:()=>null,placeholder:H.labels.optionItemSelectPlaceholder,searchable:!0,showAll:!0,onHide:()=>e.setEditMode(null)}),s=()=>({multi:!1,ui:e.superstate.ui,editable:!0,value:[n.schema],options:e.superstate.contextsIndex.get(n.space).schemas.map(c=>({name:c.name,value:c.id,description:c.name})),saveOptions:(c,f)=>e.saveValue(`${n?.space}/#^${f[0]}`),removeOption:()=>null,placeholder:H.labels.optionItemSelectPlaceholder,searchable:!0,showAll:!0,onHide:()=>e.setEditMode(null)}),l=c=>{let f=c.target.getBoundingClientRect();r.current=e.superstate.ui.openMenu(f,o(),Ne(c.view.document))},u=c=>{let f=c.target.getBoundingClientRect();r.current=e.superstate.ui.openMenu(f,s(),Ne(c.view.document))};return Js.default.createElement("div",{ref:a,className:"mk-cell-space"},Js.default.createElement("div",{className:"mk-cell-option-item"},Js.default.createElement("div",{onClick:()=>t()},n?.space),e.editMode>2&&Js.default.createElement(Js.default.Fragment,null,Js.default.createElement("span",null),Js.default.createElement("div",{onClick:c=>l(c),className:"mk-cell-option-select mk-icon-xxsmall mk-icon-rotated",dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//collapse-solid")}}))),e.isTable&&Js.default.createElement("div",{className:"mk-cell-option-item"},Js.default.createElement("div",{onClick:()=>t()},n?.schemaName),n?.space&&Js.default.createElement("div",{onClick:c=>u(c),className:"mk-cell-option-select mk-icon-xxsmall mk-icon-rotated",dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//collapse-solid")}})))};var Hd=Ae(Te());var fD=Ae(Te());var NY=e=>{let[t,r]=(0,fD.useState)(e.value),n=(a,o)=>{r({...t,[a]:o}),e.saveValue(a,o)},i=a=>a.type.startsWith("object")||a.type=="super";return fD.default.createElement("div",{className:"mk-cell-object"},e.command.fields.map((a,o)=>{let s=i(a);return fD.default.createElement(bs,{key:o,superstate:e.superstate,initialValue:a.type.startsWith("object")?t?.[a.name]:wa(t?.[a.name]),compactMode:!1,updateFieldValue:(l,u)=>{n(a.name,a.type.startsWith("object")?u:jr(u))},updateValue:l=>{n(a.name,a.type.startsWith("object")?l:jr(l))},column:{...a,table:""},editMode:5,columns:e.command.fields})}))};var sEe=e=>{let t=(0,Hd.useMemo)(()=>{let l=pr(e.propertyValue,"super",e.superstate),u=l.dynamic?e.row?.[l.field]:l.field;return e.superstate.cli.commandForAction(u)},[e.propertyValue,e.row]),r=l=>{if(!l)return null;let u;try{u=JSON.parse(l),u=Object.keys(u).reduce((c,f)=>typeof u[f]=="object"?{...c,[f]:JSON.stringify(u[f])}:typeof u[f]=="string"?{...c,[f]:jr(u[f])}:{...c,[f]:u[f]},{})}catch(c){return console.log(c),null}return u},[n,i]=(0,Hd.useState)(r(X$(e.initialValue)));(0,Hd.useEffect)(()=>{i(r(X$(e.initialValue)))},[e.initialValue]);let a=l=>`{${Object.keys(l??{}).map(u=>`"${u}": ${l[u]}`).join(",")}}`,o=(l,u)=>{i({...n,[l]:u});let c=EJ(a({...n,[l]:u}));e.saveValue(c)},s=l=>{let u=l.currentTarget.getBoundingClientRect(),c={superstate:e.superstate,command:t,value:n,saveValue:o};e.superstate.ui.openCustomMenu(u,Hd.default.createElement(NY,{...c}),c,Ne(l.view.document),"bottom")};return Hd.default.createElement(Hd.default.Fragment,null,t&&(e.compactMode?Hd.default.createElement("div",{className:"mk-cell-super",onClick:l=>s(l)},"Edit Parameters"):Hd.default.createElement(NY,{superstate:e.superstate,command:t,value:n,saveValue:o})))};var sg=Ae(Te());var lEe=e=>{let[t,r]=(0,sg.useState)([]),[n,i]=(0,sg.useState)([]);(0,sg.useEffect)(()=>{r(e.superstate.pathsIndex.get(e.path).metadata?.tags??[]),i([...e.superstate.tagsMap.get(e.path)??[]])},[]),(0,sg.useEffect)(()=>{let l=u=>{u.path==e.path&&(r(e.superstate.pathsIndex.get(e.path).metadata?.tags??[]),i([...e.superstate.tagsMap.get(e.path)??[]]))};return e.superstate.eventsDispatcher.addListener("pathStateUpdated",l),()=>{e.superstate.eventsDispatcher.removeListener("pathStateUpdated",l)}},[e.path]);let a=l=>{YB(e.superstate,e.path,l)},o=(l,u)=>{let c=u[0];th(e.superstate,e.path,c)},s=()=>{let l=e.superstate.spaceManager.readTags().map(u=>({name:u,value:u}));return{ui:e.superstate.ui,multi:!1,editable:!0,value:n,options:l,saveOptions:o,placeholder:H.labels.tagItemSelectPlaceholder,searchable:!0,showAll:!0,onHide:()=>e.setEditMode(null)}};return sg.default.createElement(ig,{superstate:e.superstate,baseClass:"mk-cell-tags",removeValue:a,menuProps:s,selectLabel:e.compactMode?e.property.name:H.labels.select,value:n,multi:!0,editMode:e.editMode,labelElement:l=>sg.default.createElement("div",{className:"mk-cell-tags-label"},l.value,t.some(u=>u.toLowerCase()==l.value)&&l.children)})};var tb=Ae(Te());var uEe=e=>{let{initialValue:t,saveValue:r}=e,n=(0,tb.useRef)(null),i=o=>{let s=o.currentTarget.innerText;t!=s&&r(s)},a=o=>{o.stopPropagation(),o.key=="Enter"&&(o.shiftKey||(o.target.blur(),e.setEditMode(null))),o.key=="Escape"&&(n.current.innerText=t,o.target.blur(),e.setEditMode(null))};return(0,tb.useEffect)(()=>{if(e.editMode==4&&n?.current){let o=window.getSelection();o.selectAllChildren(n.current),o.collapseToEnd()}},[e.editMode]),e.editMode>2?tb.default.createElement("div",{onClick:o=>o.stopPropagation(),className:"mk-cell-text",ref:n,"data-ph":e.compactMode?e.property.name:"Empty",onKeyDown:a,onBlur:i,contentEditable:!0,dangerouslySetInnerHTML:{__html:t}}):tb.default.createElement("div",{className:"mk-cell-text"},t)};var S2=e=>{let{initialValue:t,column:r,row:n}=e,i=l=>{e.updateValue(l)},a=(l,u)=>{e.editMode>0&&e.updateFieldValue?e.updateFieldValue(l,u):e.updateValue(u)},o={initialValue:t,saveValue:i,editMode:e.editMode,setEditMode:e.setEditMode??(()=>{}),superstate:e.superstate,propertyValue:r.value,path:e.source??n?.[mt],property:r,compactMode:e.compactMode},s=fc(r.type,r.name);return s?s.type=="file"?xo.default.createElement(uD,{...o,multi:!1,source:e.source,editMode:0}):s.type=="icon"?xo.default.createElement(A9,{...o,multi:s.multiType==r.type}):s.type=="boolean"?xo.default.createElement(c9,{...o}):s.type=="option"?xo.default.createElement(d9,{...o,multi:s.multiType==r.type,saveOptions:a,source:e.source}):s.type=="date"?xo.default.createElement(rEe,{...o}):s.type=="context"?xo.default.createElement(B2e,{...o,multi:s.multiType==r.type,source:e.source,contextTable:e.contextTable,contextPath:e.contextPath}):s.type=="aggregate"?xo.default.createElement(oEe,{...o,multi:s.multiType==r.type,row:n,source:e.source,contextTable:e.contextTable,contextPath:e.contextPath,cols:e.columns}):s.type=="fileprop"?xo.default.createElement(nEe,{...o,row:e.row,columns:e.columns,saveOptions:a,source:e.source}):s.type=="number"?xo.default.createElement(iEe,{...o}):s.type=="link"?xo.default.createElement(uD,{...o,multi:s.multiType==r.type,source:e.source}):s.type=="tags-multi"?xo.default.createElement(lEe,{...o}):s.type=="image"?xo.default.createElement(g9,{...o,multi:s.multiType==r.type}):s.type=="object"?xo.default.createElement(MY,{...o,multi:s.multiType==r.type,savePropValue:a,columns:e.columns,row:e.row,compactMode:e.compactMode}):s.type=="color"?xo.default.createElement(I2e,{...o}):s.type=="space"?xo.default.createElement(jY,{...o,isTable:!1}):s.type=="table"?xo.default.createElement(jY,{...o,isTable:!0}):s.type=="super"?xo.default.createElement(sEe,{...o,row:n,columns:e.columns,compactMode:e.compactMode,source:e.source}):s.type=="input"?xo.default.createElement(v9,{...o,columns:e.columns}):xo.default.createElement(uEe,{...o}):xo.default.createElement(xo.default.Fragment,null)};var pEe=e=>{let{spaceInfo:t,spaceState:r}=(0,Vt.useContext)(ur),{readMode:n}=(0,Vt.useContext)($r),{tableData:i,dbSchema:a,contextTable:o,saveDB:s,selectedRows:l,selectRows:u,sortedColumns:c,filteredData:f,predicate:d,savePredicate:p,updateFieldValue:h,updateValue:m}=(0,Vt.useContext)(Na),g=e.superstate.settings.contextPagination??25,[A,b]=Vt.default.useState({pageIndex:0,pageSize:g}),[v,x]=(0,Vt.useState)(null),[w,S]=(0,Vt.useState)(null),[k,j]=(0,Vt.useState)(null),[O,C]=(0,Vt.useState)(null),[N,D]=(0,Vt.useState)(null),[P,q]=(0,Vt.useState)({}),z=(0,Vt.useRef)(null),I=c.find(R=>R.primary=="true");(0,Vt.useEffect)(()=>{q({...d?.colsSize??{},"+":30})},[d]),(0,Vt.useEffect)(()=>{C(null)},[k,w]);let T=R=>{let J=R(P);q(J),L(J)},L=(0,Vt.useCallback)((0,dEe.debounce)(R=>p({colsSize:R}),1e3),[d]),_=(R,J,ee)=>{a?.id==Er?za(e.superstate,r,"md",R,!0):s(bk(i,I?{[I.name]:R??"",...ee??{}}:ee??{},J))},Y=(R,J)=>{if(R.metaKey){e.superstate.ui.openPath(i.rows[parseInt(J)][mt],!1);return}R.ctrlKey?l.some(ee=>ee==J)?u(null,l.filter(ee=>ee!=J)):u(J,kr([...l,J])):R.shiftKey?u(J,kr([...l,...P2e(w,J,f.map(ee=>ee._index))])):u(J,[J]),S(J)},oe=R=>{let J=Ce=>{if(k){let _e=k.split("#");m(_e[0],Ce,_e[1]??"",parseInt(w),"")}},ee=()=>{J("")},ie=()=>{navigator.clipboard.writeText(i.rows[parseInt(w)][k])},re=()=>{let Ce=dY(w,f.map(_e=>_e._index));u(Ce,[Ce]),S(Ce)},Ee=()=>{let Ce=pY(w,f.map(_e=>_e._index));u(Ce,[Ce]),S(Ce)};if(R.key=="c"&&R.metaKey&&ie(),R.key=="x"&&R.metaKey&&(ie(),ee()),R.key=="v"&&R.metaKey&&navigator.clipboard.readText().then(Ce=>J(Ce)),R.key=="Escape"&&(u(null,[]),S(null),j(null)),(R.key=="Backspace"||R.key=="Delete")&&ee(),R.key=="Enter"){k&&w&&(R.shiftKey?(_("",parseInt(w)+1),re()):(C([k,w]),R.preventDefault(),R.stopPropagation()));return}if(R.key=="ArrowDown"&&(re(),R.preventDefault()),R.key=="ArrowUp"&&(Ee(),R.preventDefault()),R.key=="ArrowLeft"){let Ce=pY(k,te.map(_e=>_e.accessorKey).filter(_e=>_e!="+"));j(Ce)}if(R.key=="ArrowRight"){let Ce=dY(k,te.map(_e=>_e.accessorKey).filter(_e=>_e!="+"));j(Ce)}},te=(0,Vt.useMemo)(()=>[...c.map(R=>({header:R.name,footer:()=>"test",accessorKey:R.name+R.table,meta:{table:R.table,editable:R.name!=mt,schemaId:a?.id},cell:({getValue:J,row:{index:ee},column:{colId:ie},cell:re,table:Ee})=>{let Ce=J(),_e=parseInt(f[ee]._index),he=parseInt(f[ee]._index),ze=Be=>{C(null),j(null),Ce!=Be&&Ee.options.meta?.updateData(R.name,Be,R.table,_e)},Ye=(Be,Le)=>{Ee.options.meta?.updateFieldValue(R.name,Be,Le,R.table,_e)},tt=n||re.getIsGrouped()?0:Gr(e.superstate.ui)?5:O&&O[0]==R.name+R.table&&O[1]==he.toString()?4:2,Ct={compactMode:!0,initialValue:Ce,updateValue:ze,updateFieldValue:Ye,superstate:e.superstate,setEditMode:C,column:R,editMode:tt,row:f[ee],contextTable:o,source:f[ee][mt],columns:c,contextPath:r.path};return fc(R.type,R.name)?Vt.default.createElement(S2,{...Ct}):Vt.default.createElement(Vt.default.Fragment,null,Ce)}}))??[],...n?[]:[{header:"+",meta:{schemaId:a?.id},accessorKey:"+",size:20,cell:()=>Vt.default.createElement(Vt.default.Fragment,null)}]],[c,f,O,d,a,o]),Q=(0,Vt.useMemo)(()=>d?.groupBy?.length>0&&c.find(R=>R.name+R.table==d.groupBy[0])?d.groupBy:[],[d,c]),fe=b2e({data:f,columns:te,columnResizeMode:"onChange",state:{columnVisibility:d?.colsHidden.reduce((R,J)=>({...R,[J]:!1}),{}),columnOrder:d?.colsOrder,columnSizing:{...te.reduce((R,J)=>({...R,[J.accessorKey]:150}),{}),...P},grouping:Q,expanded:!0,pagination:A},onColumnSizingChange:T,getCoreRowModel:h2e(),getExpandedRowModel:A2e(),getGroupedRowModel:v2e(),getPaginationRowModel:y2e(),onPaginationChange:b,meta:{updateData:m,updateFieldValue:h}}),Ie=qw(_p(BA,{activationConstraint:{distance:10}}),_p(RA,{activationConstraint:{delay:250,tolerance:5}})),Se={droppable:{strategy:Fp.Always}};function Oe(R){let{active:{id:J}}=R;x(J),D(N),document.body.style.setProperty("cursor","grabbing")}function ve({over:R}){R?.id&&D(R?.id??null)}let ye=R=>{p({filters:[...(d?.filters??[]).filter(J=>J.field!=R.field),R]})},me=(R,J)=>{p({colsCalc:{...d.colsCalc,[R]:J}})},ke=(0,Vt.useMemo)(()=>{let R={};return Object.keys(d.colsCalc).forEach(J=>{R[J]=Q5(e.superstate,f.map(ee=>ee[J]),d.colsCalc[J],c.find(ee=>ee.name==J))}),R},[c,f,d.colsCalc]),$=(R,J,ee)=>{Gr(e.superstate.ui)||ee=="+"||(Y({ctrlKey:R.ctrlKey,metaKey:R.metaKey,altKey:R.altKey,shiftKey:R.shiftKey},f[J]._index),j(ee),R.detail===1||R.detail===2&&C([ee,f[J]._index]))};function ae({active:R,over:J}){U();let ee=d?.colsOrder??[];p({colsOrder:Ws(ee,ee.findIndex(ie=>ie==v),ee.findIndex(ie=>ie==N))})}function ce(){U()}function U(){D(null),x(null),document.body.style.setProperty("cursor","")}return Vt.default.createElement(Lw,{sensors:Ie,collisionDetection:IN,measuring:Se,onDragStart:Oe,onDragOver:ve,onDragEnd:ae,onDragCancel:ce},Vt.default.createElement("div",{className:"mk-table",ref:z,tabIndex:1,onKeyDown:oe,onMouseDown:R=>R.stopPropagation()},Vt.default.createElement("table",{...{}},Vt.default.createElement("thead",null,fe.getHeaderGroups().map(R=>Vt.default.createElement("tr",{key:R.id},Vt.default.createElement("th",null),R.headers.map(J=>Vt.default.createElement("th",{className:"mk-th",key:J.id,style:{minWidth:J.column.getIsGrouped()?"0px":P[J.column.columnDef.accessorKey]??"150px",maxWidth:J.column.getIsGrouped()?"0px":P[J.column.columnDef.accessorKey]??"150px"}},J.isPlaceholder?null:J.column.columnDef.header!="+"?J.column.getIsGrouped()?Vt.default.createElement(Vt.default.Fragment,null):Vt.default.createElement(n9,{superstate:e.superstate,editable:!n&&J.column.columnDef.meta.editable,column:c.find(ee=>ee.name==J.column.columnDef.header&&ee.table==J.column.columnDef.meta.table)}):Vt.default.createElement(n9,{superstate:e.superstate,isNew:!0,editable:!0,column:{name:"",schemaId:J.column.columnDef.meta.schemaId,type:"text",table:""}}),Vt.default.createElement("div",{...{onMouseDown:J.getResizeHandler(),onTouchStart:J.getResizeHandler(),className:`mk-resizer ${J.column.getIsResizing()?"isResizing":""}`}})))))),Vt.default.createElement("tbody",null,fe.getRowModel().rows.map(R=>Vt.default.createElement("tr",{className:l?.some(J=>J==f[R.index]._index)?"mk-active":void 0,onContextMenu:J=>{let ee=parseInt(f[R.index]._index);u9(J,e.superstate,r.path,a.id,ee)},key:R.id},Vt.default.createElement("td",null),R.getVisibleCells().map((J,ee)=>J.getIsGrouped()?Vt.default.createElement("td",{key:ee,className:"mk-td-group",colSpan:c.length+(n?0:1)},Vt.default.createElement("div",{...{onClick:R.getToggleExpandedHandler(),style:{display:"flex",alignItems:"center",cursor:"normal"}}},t9(J.column.columnDef.cell,J.getContext())," ","(",R.subRows.length,")")):J.getIsAggregated()?Vt.default.createElement(Vt.default.Fragment,{key:ee},t9(J.column.columnDef.aggregatedCell??J.column.columnDef.cell,J.getContext())):Vt.default.createElement("td",{onClick:ie=>$(ie,J.row.index,J.column.columnDef.accessorKey),className:`${J.column.columnDef.accessorKey==k?"mk-selected-cell ":""} mk-td ${J.getIsPlaceholder()?"mk-td-empty":""}`,key:J.id,style:{minWidth:J.getIsPlaceholder()?"0px":P[J.column.columnDef.accessorKey]??"50px",maxWidth:J.getIsPlaceholder()?"0px":P[J.column.columnDef.accessorKey]??"unset"}},J.getIsPlaceholder()?null:t9(J.column.columnDef.cell,J.getContext())))))),Vt.default.createElement("tfoot",null,fe.getCanNextPage()&&Vt.default.createElement("tr",null,Vt.default.createElement("th",{className:"mk-row-new",colSpan:c.length+(n?1:2),onClick:()=>fe.setPageSize(A.pageSize+g)},H.buttons.loadMore)),n?Vt.default.createElement(Vt.default.Fragment,null):Vt.default.createElement("tr",null,Vt.default.createElement("th",{className:"mk-row-new",colSpan:c.length+(n?1:2),"data-placeholder":H.hintText.newItem,onFocus:R=>{j(null),S(null)},onKeyPress:R=>{R.key=="Enter"&&(_(R.currentTarget.innerText),R.currentTarget.innerText="",R.currentTarget.blur())},contentEditable:!0})),Vt.default.createElement("tr",null,Vt.default.createElement("td",null),Q.map((R,J)=>Vt.default.createElement("td",{key:J})),(Q.length>0?c.filter(R=>!Q.includes(R.name)):c).map((R,J)=>Vt.default.createElement("td",{key:J,className:(0,fEe.default)("mk-td-aggregate",!d.colsCalc[R.name]&&"mk-empty"),onClick:ee=>{let ie=[];ie.push({name:"None",value:"",onClick:()=>{me(R.name,null)}}),Object.keys(_c).forEach(Ee=>{(_c[Ee].type.includes(ho(R))||_c[Ee].type.includes("any"))&&ie.push({name:_c[Ee].label,value:Ee,onClick:()=>{me(R.name,Ee)}})});let re=ee.currentTarget.getBoundingClientRect();e.superstate.ui.openMenu(re,Ht(e.superstate.ui,ie),Ne(ee.view.document))}},d.colsCalc[R.name]?.length>0?Vt.default.createElement("div",null,Vt.default.createElement("span",null,_c[d.colsCalc[R.name]].shortLabel??_c[d.colsCalc[R.name]].label),ke[R.name]):Vt.default.createElement("div",null,Vt.default.createElement("span",null,"Calculate")))),Vt.default.createElement("td",null)))),(0,cEe.createPortal)(Vt.default.createElement(Um,{dropAnimation:null,zIndex:1600},v?Vt.default.createElement(n9,{superstate:e.superstate,editable:!1,column:{name:v,schemaId:i.schema.id,type:"text",table:""}}):null),document.body)))};var bs=e=>{let t=(0,wo.useMemo)(()=>Rx(e.column),[e.column]),r=pr(e.column.value,e.column.type,e.superstate),n=(o,s)=>{let l=jm(e.initialValue??"",e.column.type=="object-multi");e.column.type=="object-multi"?e.updateFieldValue(JSON.stringify({...r,type:o}),JSON.stringify(l)):e.updateFieldValue(JSON.stringify({...r,type:o}),JSON.stringify(s))},i=o=>{let s=o.target.getBoundingClientRect(),l=pr(e.column.value,e.column.type)?.type,u=jm(e.initialValue??"",e.column.type=="object-multi");Nf(e.superstate,s,Ne(o.view.document),{spaces:[],fields:[],saveField:(c,f)=>(n({...l??{},[f.name]:{type:f.type,label:f.name}},{...u,[f.name]:""}),!0),fileMetadata:!0})},a=o=>{let s=pr(e.column.value,e.column.type)?.type,l=jm(e.initialValue??"",e.column.type=="object-multi"),u=Object.keys(s).reduce((c,f)=>({...c,[f]:""}),{});e.updateValue(JSON.stringify([...l.slice(0,o),u,...l.slice(o)]))};return e.compactMode?wo.default.createElement("div",null,wo.default.createElement(S2,{...e})):wo.default.createElement(wo.default.Fragment,null,wo.default.createElement("div",{className:"mk-path-context-row"},wo.default.createElement(JC,{superstate:e.superstate,path:e.path,property:e.column,onClick:o=>e.propertyMenu&&e.propertyMenu(o),contexts:e.contexts,draggable:e.draggable}),wo.default.createElement("div",{className:"mk-path-context-value"},t?!e.compactMode&&wo.default.createElement("div",{className:"mk-cell-object-options"},e.editMode>3&&wo.default.createElement("button",{onClick:o=>i(o),className:"mk-inline-button"},wo.default.createElement("div",{className:"mk-icon-xsmall",dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//plus")}}),H.labels.propertyFileProp),e.column.type=="object-multi"&&wo.default.createElement("button",{onClick:o=>a(0),className:"mk-inline-button"},wo.default.createElement("div",{className:"mk-icon-xsmall",dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//insert")}}),r?.typeName??"Object")):wo.default.createElement(S2,{...e})),e.linkProp&&wo.default.createElement(wo.default.Fragment,null,wo.default.createElement("span",null),wo.default.createElement("div",{className:"mk-icon-small",style:{height:"24px"},onClick:o=>e.linkProp(o),dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//plug")}}))),t&&!e.compactMode&&wo.default.createElement("div",{className:"mk-path-context-row",style:{marginLeft:"30px"}},wo.default.createElement(S2,{...e})))};var mEe=e=>{let{pathState:t}=(0,ws.useContext)($r),[r,n]=(0,ws.useState)({}),[i,a]=(0,ws.useState)([]),[o,s]=(0,ws.useState)([]),{tableData:l,saveProperty:u,delProperty:c,saveFrame:f}=(0,ws.useContext)(ma),d=async()=>{let D=e.superstate.spacesMap.get(t.path)??new Set,P=(await Promise.all([...D].map(async _=>e.superstate.spaceManager.readTable(_,Er).then(Y=>Y.cols??[])))).reduce((_,Y)=>[..._,...Y],[]),q=[],z={},I=t?.metadata?.property??{},T=mM([...Object.keys(I),...l?.cols?.map(_=>_.name)??[]]).filter(_=>!P.some(Y=>Y.name==_)),L=T.map(_=>l?.cols?.find(Y=>Y.name==_)??{table:"",name:_,schemaId:"",type:yA(I[_],_)});I&&(q.push(...L),T.forEach(_=>{z[_]=Ri(_,I[_])})),a(q.filter(_=>!e.excludeKeys?.some(Y=>Y==_.name))),s([...e.superstate.settings.hideFrontmatter?P.map(_=>_.name):[]]),n(nh(e.superstate.formulaContext,e.superstate.pathsIndex,e.superstate.spacesMap,z,L,t))},p=D=>{e.spaces.find(P=>P==D.path)&&d()};(0,ws.useEffect)(()=>(d(),e.superstate.eventsDispatcher.addListener("contextStateUpdated",p),()=>{e.superstate.eventsDispatcher.removeListener("contextStateUpdated",p)}),[e.spaces,l]);let h=(D,P)=>{if(u){let q=l?.cols?.find(z=>z.name==P.name);q&&u(P,q)}pi(e.superstate,t.path,{[P.name]:la(P.type,D,!0)})},m=D=>{c&&D&&c(D),Iye(e.superstate,t.path,D.name)},g=async(D,P)=>{let q={...D,schemaId:Er},z=e.superstate.spacesIndex.get(P)?.space;!z||(await e.superstate.spaceManager.addSpaceProperty(P,q),await WN(e.superstate.spaceManager,z,t.path,q.name,r[q.name]))},A=(D,P)=>{let q=D.target.getBoundingClientRect(),z=[...e.superstate.spacesMap.get(t.path)].map(I=>e.superstate.pathsIndex.get(I)).filter(I=>I).map(I=>({name:I.name,value:I.path,icon:I.label?.sticker,description:I.path}));e.superstate.ui.openMenu(q,{ui:e.superstate.ui,multi:!1,editable:!1,value:[],options:z,saveOptions:(I,T)=>{g(P,T[0])},placeholder:H.labels.spaceSelectPlaceholder,detail:!0,searchable:!0,showAll:!0},Ne(D.view.document),"bottom")},b=(D,P)=>{if(u){let q=l?.cols?.find(z=>z.name==D);q&&u({...q,name:P},q)}qV(e.superstate,t.path,D,P)},v=(D,P)=>{if(u){let q=l?.cols?.find(z=>z.name==P);q&&u({...q,type:D[0]},q)}pi(e.superstate,t.path,{[P]:Bx(D[0])})},x=(D,P)=>{let q=D.target.getBoundingClientRect();e.superstate.ui.openMenu(q,{ui:e.superstate.ui,multi:!1,editable:!1,searchable:!1,saveOptions:(z,I)=>v(I,P),value:[],showAll:!0,options:ml.filter(z=>z.metadata).map((z,I)=>({id:I+1,name:z.label,value:z.type,icon:z.icon}))},Ne(D.view.document))},[w,S]=(0,ws.useState)(null),[k,j]=(0,ws.useState)(null),O=()=>{j(null),S(null)};Ca({onDragStart({active:D}){D.data.current.type=="property"&&S(D.data.current.property)},onDragOver({active:D,over:P}){let q=P?.data.current.id;P?.data.current.type=="property"&&q&&j(q)},onDragCancel(){O()},onDragEnd({active:D,over:P}){if(!D||!k){O();return}O()}});let C=(D,P)=>{if(u){let q=l?.cols?.find(z=>z.name==P.name);q&&u(D,q)}D.name!=P.name&&qV(e.superstate,t.path,P.name,D.name)},N=(D,P)=>{let q=D.target.getBoundingClientRect();if(t.type=="space"){yh({superstate:e.superstate,rect:q,win:Ne(D.view.document),editable:!0,options:[],field:P,fields:i,contextPath:null,saveField:z=>C(z,P),deleteColumn:m,anchor:"bottom"});return}ewe(e.superstate,q,Ne(D.view.document),P,m,()=>A(D,P),b,x)};return ws.default.createElement(ws.default.Fragment,null,e.compactMode?i.map((D,P)=>ws.default.createElement(bs,{key:P,path:t.path,propertyMenu:q=>N(q,D),superstate:e.superstate,initialValue:r[D.name],row:r,compactMode:e.compactMode,column:{...D,table:""},columns:[],editMode:e.editable?5:2,updateValue:q=>h(q,D),updateFieldValue:(q,z)=>h(z,{...D,value:q}),contextTable:{},source:t.path})):e.force?i.map((D,P)=>ws.default.createElement(bs,{key:P,path:t.path,propertyMenu:q=>N(q,D),superstate:e.superstate,initialValue:r[D.name],row:r,compactMode:e.compactMode,column:{...D,table:""},columns:[],editMode:e.editable?5:2,updateValue:q=>h(q,D),updateFieldValue:(q,z)=>h(z,{...D,value:q}),contextTable:{},source:t.path})):ws.default.createElement(ws.default.Fragment,null),o.length>0&&ws.default.createElement("style",null,`${o.map(D=>`.metadata-property[data-property-key="${D}"]`).join(", ")} + rgba(0,0,0,0) 100%)`}}),Aa.default.createElement("span",{style:{flex:1}}),H.editor.hex,Aa.default.createElement("input",{style:{width:"auto"},type:"text",defaultValue:s,onClick:p=>p.stopPropagation(),onMouseDown:p=>p.stopPropagation(),onKeyDown:p=>{p.key=="Enter"&&p.target.blur()},onBlur:p=>{c(p.target.value)}})),Aa.default.createElement("div",{style:{fontSize:"13px",padding:"4px",marginTop:"8px"}},H.editor.themeColors),Aa.default.createElement("div",null,x2.map((p,h)=>Aa.default.createElement("div",{key:h,"aria-label":p[0],onMouseDown:()=>{c(p[1])},className:"mk-color",style:{background:p[1]}}))),Aa.default.createElement("div",null,D2e.map((p,h)=>Aa.default.createElement("div",{key:h,"aria-label":p[0],onMouseDown:()=>{c(p[1])},className:"mk-color",style:{background:p[1]}}))),Aa.default.createElement("div",{style:{fontSize:"13px",padding:"4px",marginTop:"8px"}},H.editor.uiColors),Aa.default.createElement("div",null,O2e.map((p,h)=>Aa.default.createElement("div",{key:h,"aria-label":p[0],onMouseDown:()=>{c(p[1])},className:"mk-color",style:{background:p[1]}})),M2e.map((p,h)=>Aa.default.createElement("div",{key:h,"aria-label":p[0],onMouseDown:()=>{c(p[1])},className:"mk-color",style:{background:p[1]}})))))},Gu=(e,t,r,n,i,a,o)=>e.ui.openCustomMenu(t,Aa.default.createElement(AXe,{superstate:e,color:n,saveValue:i,stayOpen:a}),{},r,"bottom");var Fa=(e,t,r,n,i,a,o)=>{let s=[...r.allSpaces(!0)].filter(l=>(i||l.type!="default")&&(!o||l.type=="tag")).map(l=>({name:l.name,value:l.path,icon:r.pathsIndex.get(l.path)?.label?.sticker,section:l.type=="tag"?"tag":l.type=="folder"?"folder":"",description:l.type=="tag"?l.name:(l.type=="folder",l.path)}));return r.ui.openMenu(e,{ui:r.ui,multi:!1,editable:a,addKeyword:"Create",value:[],options:s,sections:o?[]:[{name:H.buttons.tag,value:"tag"},{name:H.menu.folder,value:"folder"}],saveOptions:(l,u)=>{n(u[0],!s.some(c=>c.value==u[0]))},placeholder:H.labels.spaceSelectPlaceholder,detail:!0,searchable:!0,showSections:!o,showAll:!0},t,"bottom")};var j2e=(e,t,r)=>{let n=t.map(a=>a.item.path),i=[];return i.push({name:H.menu.openFilePane,icon:"ui//go-to-file",onClick:a=>{n.forEach(o=>e.ui.openPath(o,!0))}}),i.push(Rt),i.push({name:H.buttons.addToSpace,icon:"ui//pin",onClick:a=>{let o=a.target.getBoundingClientRect();Fa(o,Ne(a.view.document),e,s=>{g2(e,t.map(l=>l.path),s,-1,"link")},!0)}}),e.settings.spacesStickers&&(i.push(Rt),i.push({name:H.menu.changeColor,icon:"ui//palette",type:6,onSubmenu:a=>Gu(e,a,Ne(r.view.document),"",o=>k2e(e,n,o),!1,!0)}),i.push({name:H.buttons.changeIcon,icon:"ui//sticker",onClick:a=>{e.ui.openPalette(iD.default.createElement(Ta,{ui:e.ui,selectedSticker:o=>E2e(e,n,o)}),Ne(a.view.document))}}),i.push({name:H.buttons.removeIcon,icon:"ui//file-minus",onClick:a=>{i9(e,n)}})),i.push(Rt),i.push({name:H.menu.moveFile,icon:"ui//paper-plane",onClick:a=>{let o=a.target.getBoundingClientRect();Fa(o,Ne(a.view.document),e,s=>{n.forEach(l=>{tee(e,l,s)})})}}),i.push(Rt),i.push({name:H.menu.hide,icon:"ui//eye-off",onClick:a=>{eee(e,n)}}),i.push({name:H.menu.delete,icon:"ui//trash",onClick:a=>{e.ui.openModal(H.labels.deleteFiles,iD.default.createElement(Xy,{confirmAction:()=>{n.forEach(o=>{F1(e,o)})},confirmLabel:H.buttons.delete,message:H.descriptions.deleteFiles.replace("${1}",n.length.toString())}),Ne(a.view.document))}}),e.ui.openMenu(r.target.getBoundingClientRect(),Ht(e.ui,i),Ne(r.view.document)),!1},Jp=(e,t,r,n,i,a,o)=>{let s=e.pathsIndex.get(t);if(!s)return;let l=[];if(l.push({name:H.menu.openFilePane,icon:"ui//go-to-file",onClick:u=>{e.ui.openPath(t,!0)}}),l.push(Rt),o&&(l.push({name:H.menu.closeSpace,icon:"ui//close",onClick:u=>{o()}}),l.push(Rt)),l.push({name:H.buttons.addToSpace,icon:"ui//pin",onClick:u=>{let c=u.target.getBoundingClientRect(),f=[],d=[...e.spacesMap.get(t)];Fa(c,Ne(u.view.document),e,p=>{g2(e,[t],p,-1,"link")},!0)}}),s.type=="file"&&s.subtype=="md"&&l.push({name:H.menu.changeToFolderNote,icon:"ui//file-plus-2",onClick:u=>{TM(e,t,!1)}}),l.push({name:"Save as Template",icon:"ui//clipboard-add",onClick:u=>{sv(e,t,r)}}),r&&r!=s.parent){let u=e.spacesIndex.get(r);u&&l.push({name:H.menu.removeFromSpace,icon:"ui//pin-off",onClick:c=>{lv(e,u.path,[t])}})}return e.settings.spacesStickers&&(l.push(Rt),l.push({name:H.menu.changeColor,icon:"ui//palette",type:6,onSubmenu:u=>Gu(e,u,i,"",c=>A2(e,t,c),!1,!0)}),l.push({name:H.buttons.changeIcon,icon:"ui//sticker",onClick:u=>{e.ui.openPalette(iD.default.createElement(Ta,{ui:e.ui,selectedSticker:c=>v2(e,t,c)}),Ne(u.view.document))}}),l.push({name:H.buttons.removeIcon,icon:"ui//file-minus",onClick:u=>{y2(e,t)}})),l.push(Rt),l.push({name:H.menu.rename,icon:"ui//edit",onClick:u=>{e.ui.openModal(H.labels.rename,iD.default.createElement(Ki,{saveLabel:H.buttons.rename,value:s.name,saveValue:c=>Ux(e,t,c)}),Ne(u.view.document))}}),l.push({name:H.menu.duplicate,icon:"ui//documents",onClick:u=>{e.spaceManager.copyPath(t,`${s.parent}`,`${s.name}`)}}),l.push({name:H.menu.moveFile,icon:"ui//paper-plane",onClick:u=>{let c=u.target.getBoundingClientRect();Fa(c,Ne(u.view.document),e,f=>{let d=e.pathsIndex.get(t);e.spaceManager.renamePath(t,jm(t,f))})}}),l.push(Rt),Gr(e.ui)||(l.push({name:e.ui.getOS()=="mac"?H.menu.revealInDefault:H.menu.revealInExplorer,icon:"ui//arrow-up-right",onClick:u=>{e.ui.openPath(t,"system")}}),l.push(Rt)),l.push({name:H.menu.hide,icon:"ui//eye-off",onClick:u=>{NM(e,t)}}),l.push({name:H.menu.delete,icon:"ui//trash",onClick:u=>{F1(e,t)}}),e.ui.openMenu(n,Ht(e.ui,l),i,a),!1};var l9=Ae(Te());var jl=(e,t,r,n,i)=>{let a=[...r.pathsIndex.values()].filter(s=>!s.hidden).map(s=>({name:s.label.name,value:s.path,description:s.path,icon:s.label?.sticker,section:s.type})),o=Array.from(new Set(a.map(s=>s.section))).map(s=>({name:s,value:s}));return r.ui.openMenu(e,{ui:r.ui,multi:!1,editable:!0,value:[],options:a,saveOptions:(s,l)=>{n(l[0])},placeholder:H.labels.linkItemSelectPlaceholder,detail:!0,searchable:!0,showAll:!0,sections:o,showSections:!0,...i??{}},t)};var N2e=Ae(Te());var T2e=(e,t,r)=>{let n=e.spacesIndex.get(t);du(e,n.space,{...n.metadata,contexts:r})},gXe=(e,t,r,n,i)=>{let a=t.spacesIndex.get(r),o=t.spaceManager.readTags(),s=async l=>{let u=zx(l);T2e(t,a.path,[...a.metadata.contexts.filter(c=>c!=u),u])};return t.ui.openMenu(e,{ui:t.ui,multi:!1,editable:!0,value:[],options:o.map(l=>({name:l,value:l})),saveOptions:(l,u)=>s(u[0]),placeholder:H.labels.contextItemSelectPlaceholder,searchable:!0,showAll:!0},n,null,i)},vXe=(e,t,r,n,i)=>{let a=[];a.push({name:H.buttons.addContext,icon:"ui//plus",type:6,onSubmenu:(s,l)=>gXe(s,r,t,n,l)}),a.push(Rt);let o=r.spacesIndex.get(t);return o.contexts.forEach(s=>{a.push({name:s,icon:"ui//tags",onClick:l=>{r.ui.openPath(Wn(s))},onMoreOptions:l=>{let u=l.target.getBoundingClientRect(),c=[];return c.push({name:H.menu.deleteContext,icon:"ui//trash",onClick:f=>{T2e(r,o.path,o.contexts.filter(d=>d!=s))}}),r.ui.openMenu(u,{ui:r.ui,multi:!1,editable:!1,value:[],options:c,placeholder:H.labels.contextItemSelectPlaceholder,searchable:!1,showAll:!0},n)}})}),r.ui.openMenu(e,{ui:r.ui,multi:!1,editable:!1,value:[],options:a,placeholder:H.labels.contextItemSelectPlaceholder,searchable:!1,showAll:!0},n,null,i)},a9=(e,t,r,n)=>{let i=[{name:"Apply Tags",icon:"ui//tags",value:"apply-tags",onSubmenu:(a,o)=>vXe(a,r.path,t,n,o)},{name:"Set Default Sticker",icon:"ui//sticker",value:"apply-all-sticker",onClick:()=>{t.ui.openPalette(N2e.default.createElement(Ta,{ui:t.ui,selectedSticker:a=>du(t,r.space,{...r.metadata,defaultSticker:a})}),n)}}];return t.ui.openMenu(e,Ht(t.ui,i),n)};var o9=Ae(Te());var w2=(e,t,r,n)=>{if(t?.path==kx)e.ui.openModal("New Tag",o9.default.createElement(Ki,{value:"",saveLabel:H.labels.saveView,saveValue:i=>IV(e,i)}),r);else if(t)if(t?.metadata.template?.length>0){$V(e,t,t.metadata.template,n);return}else za(e,t,"md",null,!1,null,n);else YS(e,e.pathsIndex.get(e.ui.activePath)).then(i=>{i&&za(e,i,"md",null,!1,null,n)})},s9=(e,t,r,n,i,a)=>{let o=[];if(n.type=="default")o.push({name:"New Tag",icon:"ui//tags",onClick:s=>{e.ui.openModal("New Tag",o9.default.createElement(Ki,{value:"",saveLabel:H.labels.saveView,saveValue:l=>IV(e,l)}),Ne(s.view.document))}});else if(o.push({name:H.labels.createNote,icon:"ui//edit",onClick:s=>{za(e,n,"md",e.settings.newNotePlaceholder,i)}}),o.push({name:H.buttons.createCanvas,icon:"ui//layout-dashboard",onClick:s=>{za(e,n,"canvas",null,i)}}),o.push({name:H.labels.createSection,icon:"ui//folder-plus",onClick:s=>{e.ui.openModal(H.labels.createSection,o9.default.createElement(Ki,{saveLabel:H.buttons.createFolder,value:"",saveValue:l=>{let u=e.pathsIndex.get(n?.path);u||(u=e.pathsIndex.get("/"));let c=l.replace(/\//g,""),f=u?.subtype=="folder"?u.path:u.parent?u.parent:"/",d=!f||f=="/"?c:f+"/"+c;if(c.length==0){e.ui.notify(H.notice.newSpaceName);return}if(e.spacesIndex.has(d)){e.ui.notify(H.notice.duplicateSpaceName);return}kf(e,d,{})}}),Ne(s.view.document))}}),n.templates.length>0){o.push(Rt);for(let s of n.templates)o.push({name:s,icon:"ui//clipboard-pen",onClick:l=>{$V(e,n,s)}})}return e.ui.openMenu(t,Ht(e.ui,o),r,"bottom")};var Ky=(e,t,r,n,i,a)=>{let o=e.spacesIndex.get(t.path);if(!o)return;let s=[];s.push({name:H.menu.openFilePane,icon:"ui//go-to-file",onClick:u=>{e.ui.openPath(t.path,!0)}}),s.push(Rt),s.push({name:"New",type:6,onSubmenu:u=>s9(e,u,Ne(r.view.document),o,!1,!0),icon:"ui//plus"}),o.type=="folder"&&s.push({name:H.buttons.addIntoSpace,icon:"ui//pin",onClick:u=>{let c=u.target.getBoundingClientRect();jl(c,Ne(u.view.document),e,f=>{rh(e,o,f)}),u.stopPropagation()}}),s.push(Rt),s.push({name:"Apply to All Items",icon:"ui//pin",value:"apply-all",type:6,onSubmenu:u=>a9(u,e,o,Ne(r.view.document))}),a&&s.push({name:H.menu.closeSpace,icon:"ui//close",onClick:u=>{a()}}),s.push(Rt),o.type=="folder"&&(s.push({name:H.buttons.addToSpace,icon:"ui//pin",onClick:u=>{let c=u.target.getBoundingClientRect();Fa(c,Ne(u.view.document),e,f=>{let d=e.spacesIndex.get(f);d&&QS(e,d,o.path,-1)},!0)}}),s.push(Rt));let l=e.spacesIndex.get(i);if(l&&(l.type=="folder"||l.type=="vault")&&(s.push({name:"Save as Template",icon:"ui//clipboard-add",onClick:u=>{sv(e,o.path,i)}}),i!=t.parent)){let u=e.spacesIndex.get(i);u&&s.push({name:H.menu.removeFromSpace,icon:"ui//pin-off",onClick:c=>{lv(e,u.path,[o.path])}})}return s.push(Rt),e.settings.spacesStickers&&(s.push({name:H.menu.changeColor,icon:"ui//palette",type:6,onSubmenu:u=>Gu(e,u,Ne(r.view.document),"",c=>A2(e,o.path,c),!1,!0)}),s.push({name:H.buttons.changeIcon,icon:"ui//sticker",onClick:u=>{e.ui.openPalette(l9.default.createElement(Ta,{ui:e.ui,selectedSticker:c=>Kp(e,o.path,c)}),Ne(u.view.document))}}),s.push({name:H.buttons.removeIcon,icon:"ui//file-minus",onClick:u=>{y2(e,o.path)}})),o.metadata?.sort&&(s.push(Rt),s.push({name:H.menu.sortBy,icon:"ui//sort-desc",type:6,onSubmenu:u=>{let c=[];c.push({name:H.menu.groupSpaces,icon:"ui//arrow-up-down",value:o.metadata.sort.group==!0,type:3,onClick:x=>{Id(e,o.path,{field:o.metadata.sort.field,asc:o.metadata.sort.asc,group:!o.metadata.sort.group,recursive:o.metadata.sort.recursive})}}),c.push(Rt),c.push({name:H.menu.recurisveSort,icon:"ui//arrow-up-down",value:o.metadata.sort.recursive==!0,type:3,onClick:x=>{Id(e,o.path,{field:o.metadata.sort.field,asc:o.metadata.sort.asc,group:o.metadata.sort.group,recursive:!o.metadata.sort.recursive})}}),c.push(Rt);let f={field:"rank",asc:!0,group:o.metadata.sort.group,recursive:o.metadata.sort.recursive};c.push({name:H.menu.customSort,icon:"ui//arrow-up-down",value:o.metadata.sort.field==f.field&&o.metadata.sort.asc==f.asc,type:3,onClick:x=>{Id(e,o.path,f)}}),c.push(Rt);let d={field:"name",asc:!0,group:o.metadata.sort.group,recursive:o.metadata.sort.recursive};c.push({name:H.menu.fileNameSortAlphaAsc,icon:"ui//arrow-up-down",value:o.metadata.sort.field==d.field&&o.metadata.sort.asc==d.asc,type:3,onClick:x=>{Id(e,o.path,d)}});let p={field:"name",asc:!1,group:o.metadata.sort.group,recursive:o.metadata.sort.recursive};c.push({name:H.menu.fileNameSortAlphaDesc,icon:"ui//arrow-up-down",value:o.metadata.sort.field==p.field&&o.metadata.sort.asc==p.asc,type:3,onClick:x=>{Id(e,o.path,p)}}),c.push(Rt);let h={field:"number",asc:!0,group:o.metadata.sort.group,recursive:o.metadata.sort.recursive};c.push({name:H.menu.fileNameSortNumericalAsc,icon:"ui//arrow-up-down",value:o.metadata.sort.field==h.field&&o.metadata.sort.asc==h.asc,type:3,onClick:x=>{Id(e,o.path,h)}});let m={field:"number",asc:!1,group:o.metadata.sort.group,recursive:o.metadata.sort.recursive};c.push({name:H.menu.fileNameSortNumericalDesc,icon:"ui//arrow-up-down",value:o.metadata.sort.field==m.field&&o.metadata.sort.asc==m.asc,type:3,onClick:x=>{Id(e,o.path,m)}}),c.push(Rt);let g={field:"ctime",asc:!1,group:o.metadata.sort.group,recursive:o.metadata.sort.recursive};c.push({name:H.menu.createdTimeSortAsc,icon:"ui//arrow-up-down",value:o.metadata.sort.field==g.field&&o.metadata.sort.asc==g.asc,type:3,onClick:x=>{Id(e,o.path,g)}});let A={field:"ctime",asc:!0,group:o.metadata.sort.group,recursive:o.metadata.sort.recursive};c.push({name:H.menu.createdTimeSortDesc,icon:"ui//arrow-up-down",value:o.metadata.sort.field==A.field&&o.metadata.sort.asc==A.asc,type:3,onClick:x=>{Id(e,o.path,A)}}),c.push(Rt);let b={field:"size",asc:!1,group:o.metadata.sort.group,recursive:o.metadata.sort.recursive};c.push({name:H.menu.sizeSortAsc,icon:"ui//arrow-up-down",value:o.metadata.sort.field==b.field&&o.metadata.sort.asc==b.asc,type:3,onClick:x=>{Id(e,o.path,b)}});let v={field:"size",asc:!0,group:o.metadata.sort.group,recursive:o.metadata.sort.recursive};return c.push({name:H.menu.sizeSortDesc,icon:"ui//arrow-up-down",value:o.metadata.sort.field==v.field&&o.metadata.sort.asc==v.asc,type:3,onClick:x=>{Id(e,o.path,v)}}),e.ui.openMenu(u,Ht(e.ui,c),Ne(r.view.document))}})),o.type!="default"&&(s.push(Rt),s.push({name:H.menu.rename,icon:"ui//edit",onClick:u=>{e.ui.openModal(H.labels.rename,l9.default.createElement(Ki,{saveLabel:H.buttons.rename,value:o.type=="tag"?hl(o.name):o.name,saveValue:c=>Ux(e,o.path,c)}),Ne(u.view.document))}})),s.push({name:H.menu.duplicate,icon:"ui//documents",onClick:u=>{e.spaceManager.copyPath(t.path,`${t.parent}`)}}),o.type=="folder"&&s.push({name:H.menu.moveFile,icon:"ui//paper-plane",onClick:u=>{let c=u.target.getBoundingClientRect();Fa(c,Ne(u.view.document),e,f=>{e.spaceManager.renameSpace(o.path,jm(o.path,f))})}}),s.push(Rt),Gr(e.ui)||s.push({name:e.ui.getOS()=="mac"?H.menu.revealInDefault:H.menu.revealInExplorer,icon:"ui//arrow-up-right",onClick:u=>{e.ui.openPath(o.space.folderPath,"system")}}),s.push(Rt),o.type=="folder"&&s.push({name:H.menu.hide,icon:"ui//eye-off",onClick:u=>{NM(e,o.path)}}),(o.type=="folder"||o.type=="tag")&&s.push({name:H.menu.delete,icon:"ui//trash",onClick:u=>{e.ui.openModal(H.labels.deleteSpace,l9.default.createElement(Xy,{confirmAction:()=>_ye(e,o.path),confirmLabel:H.buttons.delete,message:H.descriptions.deleteSpace}),Ne(u.view.document))}}),e.ui.openMenu(r.target.getBoundingClientRect(),Ht(e.ui,s),Ne(r.view.document)),!1};var Qu=Ae(Te()),F2e=e=>{let[t,r]=Qu.default.useState();(0,Qu.useEffect)(()=>{(async()=>{let s=await e.superstate.spaceManager.readTable(e.path,e.schema);r(s)})()},[e.path,e.schema]);let n=t?.cols??[],i=t?.rows[e.index],a=async(o,s)=>{let u=(await e.superstate.spaceManager.readTable(e.path,e.schema)).rows[e.index];u&&HN(e.superstate.spaceManager,e.superstate.spacesIndex.get(e.path)?.space,e.schema,e.index,{...u,[o]:s})};return Qu.default.createElement("div",{className:"mk-editor-frame-properties"},Qu.default.createElement("div",{className:"mk-editor-actions-name"},Qu.default.createElement("div",{className:"mk-editor-actions-name-icon"},Qu.default.createElement("div",{className:"mk-icon-small",dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//list")}})),Qu.default.createElement("div",{className:"mk-editor-actions-name-text"},H.buttons.editProperty),Qu.default.createElement("span",null),Qu.default.createElement("div",{className:"mk-icon-small mk-inline-button",dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//close")},onClick:()=>e.hide()})),Qu.default.createElement("div",{className:"mk-props-contexts"},n.map((o,s)=>Qu.default.createElement(Qu.default.Fragment,{key:s},Qu.default.createElement(bs,{initialValue:i[o.name],column:o,compactMode:!1,superstate:e.superstate,editMode:3,row:i,updateValue:l=>{a(o.name,l)},source:e.pathState.path,columns:n})))))};var u9=async(e,t,r,n,i)=>{e.preventDefault();let a=await t.spaceManager.readTable(r,n),o=a?.schema,s=a?.rows;if(!a)return;if(o.primary=="true"){let c=s.find((f,d)=>d==i);if(c){if(t.spacesIndex.has(c[mt])){let f=t.pathsIndex.get(c[mt]);f&&Ky(t,f,e,"",r);return}Jp(t,c[mt],r,e.target.getBoundingClientRect(),Ne(e.view.document));return}}let l=[],u={superstate:t,pathState:t.pathsIndex.get(r),path:r,schema:n,index:i};l.push({name:H.menu.editProperties,icon:"ui//list",onClick:c=>{t.ui.openCustomMenu(c.currentTarget.getBoundingClientRect(),_2e.default.createElement(F2e,{...u}),u,Ne(c.view.document))}}),l.push({name:H.menu.deleteRow,icon:"ui//trash",onClick:c=>{qoe(t.spaceManager,t.spacesIndex.get(r)?.space,n,i)}}),t.ui.openMenu(e.target.getBoundingClientRect(),Ht(t.ui,l),Ne(e.view.document))};var dY=(e,t)=>{if(!e&&t.length>0)return t[0];let r=t.indexOf(e);return r{let r=t.indexOf(e);return r>0?t[r-1]:t[0]},P2e=(e,t,r)=>{let n=r.findIndex(a=>a==e),i=r.findIndex(a=>a==t);return no>n&&o<=i):r.filter((a,o)=>o=i)};var dEe=Ae(yi());var xo=Ae(Te());var ng=Ae(Te());var c9=e=>{let{initialValue:t,saveValue:r}=e,[n,i]=ng.default.useState(t=="true"),a=()=>{e.editMode!=0&&(i(!n),r(n?"false":"true"))};return(0,ng.useEffect)(()=>{e.editMode==4&&(i(!n),r(n?"false":"true"),e.setEditMode(null))},[e.editMode]),ng.default.useEffect(()=>{i(t=="true")},[t]),e.editMode<2?ng.default.createElement("div",{className:"mk-cell-boolean"},ng.default.createElement("input",{type:"checkbox",checked:n,onChange:a})):ng.default.createElement("div",{className:"mk-cell-boolean"},ng.default.createElement("input",{type:"checkbox",checked:n,onChange:a}))};var mY=Ae(Te());var I2e=e=>{let t=r=>{let n=a=>{e.saveValue(a)},i=r.target.getBoundingClientRect();Gu(e.superstate,i,Ne(r.view.document),e.initialValue,n)};return mY.default.createElement("div",null,mY.default.createElement("div",{className:"mk-setter-color",onClick:r=>t(r),style:{backgroundColor:e.initialValue,width:30,height:30}}))};var bh=Ae(Te());var Pc=Ae(Te());var aD=e=>{let{pathState:t}=e,r=t?.label?.sticker,n=t?.label?.color,i=l=>{if(!t)return;l.preventDefault(),l.stopPropagation();let u=[];return u.push({name:H.buttons.changeIcon,icon:"ui//sticker",onClick:c=>{e.superstate.ui.openPalette(Pc.default.createElement(Ta,{ui:e.superstate.ui,selectedSticker:f=>Kp(e.superstate,t?.path,f)}),Ne(c.view.document))}}),u.push({name:H.buttons.removeIcon,icon:"ui//file-minus",onClick:()=>{i9(e.superstate,[t.path])}}),e.superstate.ui.openMenu(l.target.getBoundingClientRect(),Ht(e.superstate.ui,u),Ne(l.view.document)),!1},a=l=>{if(l.stopPropagation(),t?.type=="space"){e.superstate.ui.openPalette(Pc.default.createElement(Ta,{ui:e.superstate.ui,selectedSticker:u=>Kp(e.superstate,t.path,u)}),Ne(l.view.document));return}e.superstate.ui.openPalette(Pc.default.createElement(Ta,{ui:e.superstate.ui,selectedSticker:u=>Kp(e.superstate,t.path,u)}),Ne(l.view.document))},[o,s]=rg(r);return Pc.default.createElement("div",{className:`mk-path-icon ${r?"":"mk-path-icon-placeholder"}`},o=="image"?Pc.default.createElement("img",{src:e.superstate.ui.getUIPath(e.superstate.imagesCache.get(s))}):Pc.default.createElement("button",{"aria-label":H.buttons.changeIcon,onContextMenu:i,style:n?.length>0?{"--label-color":`${n}`,"--icon-color":"#ffffff"}:{"--icon-color":"var(--mk-ui-text-secondary)"},dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker(r)},onClick:l=>e.editable&&a(l)}))},f9=e=>{let[t,r]=(0,Pc.useState)(null),n=()=>{r(e.superstate.pathsIndex.get(e.path))},i=a=>{a.path==e.path&&n()};return(0,Pc.useEffect)(()=>(n(),e.superstate.eventsDispatcher.addListener("pathStateUpdated",i),()=>{e.superstate.eventsDispatcher.removeListener("pathStateUpdated",i)}),[e.path]),t?Pc.default.createElement(aD,{superstate:e.superstate,pathState:t,editable:!0}):Pc.default.createElement(Pc.default.Fragment,null)};var oo=e=>{let t=(0,bh.useMemo)(()=>e.source&&e.path?e.superstate.spaceManager.resolvePath(e.path,e.source):e.path,[e.source,e.path]),[r,n]=(0,bh.useState)(e.superstate.pathsIndex.get(t)),i=()=>{n(e.superstate.pathsIndex.get(t))},a=o=>{o.path==t&&i()};return(0,bh.useEffect)(()=>(e.superstate.eventsDispatcher.addListener("pathStateUpdated",a),i(),()=>{e.superstate.eventsDispatcher.removeListener("pathStateUpdated",a)}),[t]),bh.default.createElement("div",{className:"mk-path",onClick:()=>{e.superstate.ui.openPath(r?.path??t,!1)},onContextMenu:o=>{r&&(o.stopPropagation(),Jp(e.superstate,r.path,e.source,{x:o.clientX,y:o.clientY,width:0,height:0},Ne(o.view.document)))}},r&&!e.hideIcon&&bh.default.createElement(aD,{superstate:e.superstate,pathState:r}),bh.default.createElement("span",null,(!e.hideName&&r?.label.name)??t),e.children)};var Ff=Ae(Te());var hY=Ae(yi()),Ai=Ae(Te());var d9=e=>{let t=(0,Ai.useMemo)(()=>pr(e.propertyValue,"option",e.superstate,e.source),[e.propertyValue,e.source]),r=(m,g,A,b)=>[...(m??[]).filter(v=>v.value).map(v=>({...v,color:b?v.color?.length>0?v.color:"var(--mk-color-none)":void 0,removeable:b?A>=2:!1}))??[],...g.map(v=>({name:v,value:v,color:b?"var(--mk-color-none)":void 0,removeable:b?A>=2:!1}))].filter(AJ("value")).filter(v=>v.value.length>0),n=(m,g)=>(g?sr(m)??[]:[m]).filter(A=>A&&A.length>0),[i,a]=(0,Ai.useState)(r(t.options??[],n(e.initialValue,e.multi),e.editMode,!t.source)),[o,s]=(0,Ai.useState)(n(e.initialValue,e.multi));(0,Ai.useEffect)(()=>{s(n(e.initialValue,e.multi))},[e.initialValue,e.multi]),(0,Ai.useEffect)(()=>{a(r(t.options??[],o,e.editMode,!t.source))},[t,o,e.editMode]);let l=m=>{if(e.multi){let g=o.filter(A=>A!=m);s(g),e.saveValue(Bi(g))}else s([]),e.saveValue("")},u=m=>{let g=i.filter(b=>b.value!=m),A=o.filter(b=>b!=m);a(g),s(A),e.multi?e.saveOptions(pA(g,t),Bi(A)):e.saveOptions(pA(g,t),os(A))},c=(m,g)=>{e.multi?e.saveOptions(pA(m,t),Bi(g)):e.saveOptions(pA(m,t),os(g))},f=(m,g)=>{let A=(0,hY.uniq)([...m,...g]).filter(b=>b.length>0).map(b=>i.find(v=>v.value==b)??{name:b,value:b});if(!e.multi)e.editMode>=2&&a(A),s(g),c(A,g);else{let b=(0,hY.uniq)([...o,g[0]]);e.editMode>=2&&a(A),s(b),c(A,b)}},d=(m,g)=>{let A=i.map(v=>v.value==m?g:v),b=o;a(A),s(b),c(A,b)},p=(m,g)=>{let A=i.find(v=>v.value==g),b=[];b.push(uh(A.value,v=>d(A.value,{...A,value:v}))),b.push(Rt),b.push({name:"None",color:"var(--mk-color-none)",onClick:()=>{d(A.value,{...A,color:""})}}),x2.forEach(v=>{b.push({name:v[0],value:v[1],color:`${v[1]}`,onClick:()=>{d(A.value,{...A,color:v[1]})}})}),e.superstate.ui.openMenu(m.target.getBoundingClientRect(),Ht(e.superstate.ui,b),Ne(m.view.document))},h=()=>({multi:!1,editable:e.editMode>=2,ui:e.superstate.ui,value:o,options:e.multi?i:[{name:H.menu.none,value:""},...i],saveOptions:f,removeOption:e.editMode>=2&&u,onMoreOption:e.editMode>=2&&p,placeholder:H.labels.optionItemSelectPlaceholder,searchable:!0,showAll:!0,onHide:()=>e.setEditMode(null)});return Ai.default.createElement(ig,{superstate:e.superstate,baseClass:"mk-cell-option",value:o,menuProps:h,multi:e.multi,removeValue:l,selectLabel:e.compactMode?e.property.name:H.labels.select,editMode:e.editMode,labelElement:m=>{let g=i.find(A=>A.value==m.value)?.color??"var(--mk-color-none)";return Ai.default.createElement("div",{className:"mk-cell-option-item",style:{background:`${g}`,color:g=="var(--mk-color-none)"?"inherit":"var(--mk-color-white)"}},Ai.default.createElement("span",null,m.value),m.children)}})},ig=e=>{let{value:t,menuProps:r}=e,n=(0,Ai.useRef)(null),i=(0,Ai.useRef)(null),a=()=>{if(n.current){n.current.hide(),n.current=null;return}let s=i.current.getBoundingClientRect();n.current=e.superstate.ui.openMenu(s,r(),Ne(i.current.ownerDocument),"bottom",()=>n.current=null)},o=e.editMode>1;return Ai.default.createElement("div",{className:e.baseClass,ref:i},t.length>0?t.map((s,l)=>Ai.default.createElement(Ai.default.Fragment,{key:l},e.labelElement&&Ai.default.createElement(e.labelElement,{value:s},o?!e.multi&&t.length>0?Ai.default.createElement("div",{onClick:u=>{u.stopPropagation(),a()},className:"mk-cell-option-select mk-icon-xxsmall mk-icon-rotated",dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//collapse-solid")}}):e.multi?Ai.default.createElement("div",{className:"mk-cell-option-remove mk-icon-xxsmall",onClick:u=>{u.stopPropagation(),e.removeValue(s)},dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//close")}}):null:null))):o&&!e.multi?Ai.default.createElement("div",{className:"mk-cell-option-item",onClick:s=>{a()}},Ai.default.createElement("div",{className:"mk-cell-empty"},e.selectLabel),Ai.default.createElement("div",{className:"mk-cell-option-select mk-icon-xxsmall mk-icon-rotated",dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//collapse-solid")}})):e.editMode==0?Ai.default.createElement("div",{className:"mk-cell-option-item mk-cell-empty"},Ai.default.createElement("div",null,H.menu.none)):Ai.default.createElement(Ai.default.Fragment,null),o&&e.multi?Ai.default.createElement("div",{onClick:s=>{s.stopPropagation(),o&&a()},className:"mk-cell-option-new mk-icon-small",dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//plus")}}):Ai.default.createElement(Ai.default.Fragment,null))};var B2e=e=>{let{contextTable:t}=e,r=(0,Ff.useMemo)(()=>pr(e.propertyValue,"context",e.superstate),[e.propertyValue]),n=(0,Ff.useMemo)(()=>r?e.superstate.spaceManager.resolvePath(r.space,e.contextPath):null,[r.space,e.contextPath]),i=(m,g)=>(g?sr(m)??[]:[m]).filter(A=>A),[a,o]=(0,Ff.useState)([]);(0,Ff.useEffect)(()=>{!r?.field||!t[n]||o(t[n].rows.reduce((m,g)=>sr(g[r.field]).includes(e.path)?[...m,g[mt]]:m,[]))},[n,r,t]);let s=[...e.superstate.spacesMap.getInverse(n)].map(m=>e.superstate.pathsIndex.get(m)).filter(m=>m).map(m=>({name:m.name,icon:m.label.sticker,description:m.path,value:m.path})),[l,u]=(0,Ff.useState)(i(e.initialValue,e.multi)),c=(0,Ff.useMemo)(()=>kr([...l,...a]),[l,a]),f=m=>{e.multi?e.saveValue(Bi(m)):e.saveValue(os(m))},d=m=>{if(a.includes(m)){let g=a.filter(A=>A!=m);o(g),WN(e.superstate.spaceManager,e.superstate.spacesIndex.get(n).space,m,r.spaceField,e.path,Foe)}else{let g=l.filter(A=>A!=m);u(g),f(g.map(A=>A))}};(0,Ff.useEffect)(()=>{u(i(e.initialValue,e.multi))},[e.initialValue,e.multi]);let p=(m,g)=>{let A=[...e.superstate.spacesMap.getInverse(n)].filter(b=>!g.includes(b));if(A.length>0&&A.forEach(b=>{let v=e.superstate.spacesIndex.get(n);e.superstate.pathsIndex.get(b)?QS(e.superstate,v,b):za(e.superstate,v,"md",b,!0)}),!e.multi)u(g),f(g);else{let b=g[0];if(b){let v=[...l,b];u(v),f(v)}}},h=()=>{let m=e.multi?s:[{name:H.menu.none,value:""},...s];return{ui:e.superstate.ui,multi:!1,editable:!0,value:c.map(g=>g.path),options:m,saveOptions:p,placeholder:H.labels.contextItemSelectPlaceholder,searchable:!0,showAll:!0,onHide:()=>e.setEditMode(null)}};return Ff.default.createElement(ig,{baseClass:"mk-cell-context",superstate:e.superstate,menuProps:h,removeValue:d,selectLabel:e.compactMode?e.property.name:H.labels.select,labelElement:m=>Ff.default.createElement(oo,{superstate:e.superstate,path:m.value,source:e.contextPath},m.children),value:c,multi:e.multi,editMode:e.editMode})};var Fi=Ae(Te());var Ln=Ae(Te());var Tr=function(){return Tr=Object.assign||function(t){for(var r,n=1,i=arguments.length;n1&&(l||!u),f=t>1&&(u||!l),d=function(){!n||a(n)},p=function(){!i||a(i)};return dt.jsx(KXe,{displayMonth:e.displayMonth,hideNext:c,hidePrevious:f,nextMonth:i,previousMonth:n,onPreviousClick:d,onNextClick:p})}function JXe(e){var t,r=ga(),n=r.classNames,i=r.disableNavigation,a=r.styles,o=r.captionLayout,s=r.components,l=(t=s?.CaptionLabel)!==null&&t!==void 0?t:V2e,u;return i?u=dt.jsx(l,{id:e.id,displayMonth:e.displayMonth}):o==="dropdown"?u=dt.jsx($2e,{displayMonth:e.displayMonth,id:e.id}):o==="dropdown-buttons"?u=dt.jsxs(dt.Fragment,{children:[dt.jsx($2e,{displayMonth:e.displayMonth,displayIndex:e.displayIndex,id:e.id}),dt.jsx(q2e,{displayMonth:e.displayMonth,displayIndex:e.displayIndex,id:e.id})]}):u=dt.jsxs(dt.Fragment,{children:[dt.jsx(l,{id:e.id,displayMonth:e.displayMonth,displayIndex:e.displayIndex}),dt.jsx(q2e,{displayMonth:e.displayMonth,id:e.id})]}),dt.jsx("div",{className:n.caption,style:a.caption,children:u})}function eKe(e){var t=ga(),r=t.footer,n=t.styles,i=t.classNames.tfoot;return r?dt.jsx("tfoot",{className:i,style:n.tfoot,children:dt.jsx("tr",{children:dt.jsx("td",{colSpan:8,children:r})})}):dt.jsx(dt.Fragment,{})}function tKe(e,t,r){for(var n=r?tf(new Date):mo(new Date,{locale:e,weekStartsOn:t}),i=[],a=0;a<7;a++){var o=oa(n,a);i.push(o)}return i}function rKe(){var e=ga(),t=e.classNames,r=e.styles,n=e.showWeekNumber,i=e.locale,a=e.weekStartsOn,o=e.ISOWeek,s=e.formatters.formatWeekdayName,l=e.labels.labelWeekday,u=tKe(i,a,o);return dt.jsxs("tr",{style:r.head_row,className:t.head_row,children:[n&&dt.jsx("td",{style:r.head_cell,className:t.head_cell}),u.map(function(c,f){return dt.jsx("th",{scope:"col",className:t.head_cell,style:r.head_cell,"aria-label":l(c,{locale:i}),children:s(c,{locale:i})},f)})]})}function nKe(){var e,t=ga(),r=t.classNames,n=t.styles,i=t.components,a=(e=i?.HeadRow)!==null&&e!==void 0?e:rKe;return dt.jsx("thead",{style:n.head,className:r.head,children:dt.jsx(a,{})})}function iKe(e){var t=ga(),r=t.locale,n=t.formatters.formatDay;return dt.jsx(dt.Fragment,{children:n(e.date,{locale:r})})}var bY=(0,Ln.createContext)(void 0);function aKe(e){if(!sD(e.initialProps)){var t={selected:void 0,modifiers:{disabled:[]}};return dt.jsx(bY.Provider,{value:t,children:e.children})}return dt.jsx(oKe,{initialProps:e.initialProps,children:e.children})}function oKe(e){var t=e.initialProps,r=e.children,n=t.selected,i=t.min,a=t.max,o=function(u,c,f){var d,p;(d=t.onDayClick)===null||d===void 0||d.call(t,u,c,f);var h=Boolean(c.selected&&i&&n?.length===i);if(!h){var m=Boolean(!c.selected&&a&&n?.length===a);if(!m){var g=n?U2e([],n,!0):[];if(c.selected){var A=g.findIndex(function(b){return pl(u,b)});g.splice(A,1)}else g.push(u);(p=t.onSelect)===null||p===void 0||p.call(t,g,u,c,f)}}},s={disabled:[]};n&&s.disabled.push(function(u){var c=a&&n.length>a-1,f=n.some(function(d){return pl(d,u)});return Boolean(c&&!f)});var l={selected:n,onDayClick:o,modifiers:s};return dt.jsx(bY.Provider,{value:l,children:r})}function xY(){var e=(0,Ln.useContext)(bY);if(!e)throw new Error("useSelectMultiple must be used within a SelectMultipleProvider");return e}function sKe(e,t){var r=t||{},n=r.from,i=r.to;return n&&i?pl(i,e)&&pl(n,e)?void 0:pl(i,e)?{from:i,to:void 0}:pl(n,e)?void 0:Nx(n,e)?{from:e,to:i}:{from:n,to:e}:i?Nx(e,i)?{from:i,to:e}:{from:e,to:i}:n?ak(e,n)?{from:e,to:n}:{from:n,to:e}:{from:e,to:void 0}}var wY=(0,Ln.createContext)(void 0);function lKe(e){if(!lD(e.initialProps)){var t={selected:void 0,modifiers:{range_start:[],range_end:[],range_middle:[],disabled:[]}};return dt.jsx(wY.Provider,{value:t,children:e.children})}return dt.jsx(uKe,{initialProps:e.initialProps,children:e.children})}function uKe(e){var t=e.initialProps,r=e.children,n=t.selected,i=n||{},a=i.from,o=i.to,s=t.min,l=t.max,u=function(p,h,m){var g,A;(g=t.onDayClick)===null||g===void 0||g.call(t,p,h,m);var b=sKe(p,n);(A=t.onSelect)===null||A===void 0||A.call(t,b,p,h,m)},c={range_start:[],range_end:[],range_middle:[],disabled:[]};if(a?(c.range_start=[a],o?(c.range_end=[o],pl(a,o)||(c.range_middle=[{after:a,before:o}])):c.range_end=[a]):o&&(c.range_start=[o],c.range_end=[o]),s&&(a&&!o&&c.disabled.push({after:Fx(a,s-1),before:oa(a,s-1)}),a&&o&&c.disabled.push({after:a,before:oa(a,s-1)}),!a&&o&&c.disabled.push({after:Fx(o,s-1),before:oa(o,s-1)})),l){if(a&&!o&&(c.disabled.push({before:oa(a,-l+1)}),c.disabled.push({after:oa(a,l-1)})),a&&o){var f=od(o,a)+1,d=l-f;c.disabled.push({before:Fx(a,d)}),c.disabled.push({after:oa(o,d)})}!a&&o&&(c.disabled.push({before:oa(o,-l+1)}),c.disabled.push({after:oa(o,l-1)}))}return dt.jsx(wY.Provider,{value:{selected:n,onDayClick:u,modifiers:c},children:r})}function SY(){var e=(0,Ln.useContext)(wY);if(!e)throw new Error("useSelectRange must be used within a SelectRangeProvider");return e}function p9(e){return Array.isArray(e)?U2e([],e,!0):e!==void 0?[e]:[]}function cKe(e){var t={};return Object.entries(e).forEach(function(r){var n=r[0],i=r[1];t[n]=p9(i)}),t}var em;(function(e){e.Outside="outside",e.Disabled="disabled",e.Selected="selected",e.Hidden="hidden",e.Today="today",e.RangeStart="range_start",e.RangeEnd="range_end",e.RangeMiddle="range_middle"})(em||(em={}));var fKe=em.Selected,ag=em.Disabled,dKe=em.Hidden,pKe=em.Today,AY=em.RangeEnd,gY=em.RangeMiddle,vY=em.RangeStart,mKe=em.Outside;function hKe(e,t,r){var n,i=(n={},n[fKe]=p9(e.selected),n[ag]=p9(e.disabled),n[dKe]=p9(e.hidden),n[pKe]=[e.today],n[AY]=[],n[gY]=[],n[vY]=[],n[mKe]=[],n);return e.fromDate&&i[ag].push({before:e.fromDate}),e.toDate&&i[ag].push({after:e.toDate}),sD(e)?i[ag]=i[ag].concat(t.modifiers[ag]):lD(e)&&(i[ag]=i[ag].concat(r.modifiers[ag]),i[vY]=r.modifiers[vY],i[gY]=r.modifiers[gY],i[AY]=r.modifiers[AY]),i}var Y2e=(0,Ln.createContext)(void 0);function AKe(e){var t=ga(),r=xY(),n=SY(),i=hKe(t,r,n),a=cKe(t.modifiers),o=Tr(Tr({},i),a);return dt.jsx(Y2e.Provider,{value:o,children:e.children})}function Z2e(){var e=(0,Ln.useContext)(Y2e);if(!e)throw new Error("useModifiers must be used within a ModifiersProvider");return e}function gKe(e){return Boolean(e&&typeof e=="object"&&"before"in e&&"after"in e)}function vKe(e){return Boolean(e&&typeof e=="object"&&"from"in e)}function yKe(e){return Boolean(e&&typeof e=="object"&&"after"in e)}function bKe(e){return Boolean(e&&typeof e=="object"&&"before"in e)}function xKe(e){return Boolean(e&&typeof e=="object"&&"dayOfWeek"in e)}function wKe(e,t){var r,n=t.from,i=t.to;if(n&&i){var a=od(i,n)<0;a&&(r=[i,n],n=r[0],i=r[1]);var o=od(e,n)>=0&&od(i,e)>=0;return o}return i?pl(i,e):n?pl(n,e):!1}function SKe(e){return C1(e)}function EKe(e){return Array.isArray(e)&&e.every(C1)}function kKe(e,t){return t.some(function(r){if(typeof r=="boolean")return r;if(SKe(r))return pl(e,r);if(EKe(r))return r.includes(e);if(vKe(r))return wKe(e,r);if(xKe(r))return r.dayOfWeek.includes(e.getDay());if(gKe(r)){var n=od(r.before,e),i=od(r.after,e),a=n>0,o=i<0,s=Nx(r.before,r.after);return s?o&&a:a||o}return yKe(r)?od(e,r.after)>0:bKe(r)?od(r.before,e)>0:typeof r=="function"?r(e):!1})}function EY(e,t,r){var n=Object.keys(t).reduce(function(a,o){var s=t[o];return kKe(e,s)&&a.push(o),a},[]),i={};return n.forEach(function(a){return i[a]=!0}),r&&!Tx(e,r)&&(i.outside=!0),i}function CKe(e,t){for(var r=Wo(e[0]),n=Jg(e[e.length-1]),i,a,o=r;o<=n;){var s=EY(o,t),l=!s.disabled&&!s.hidden;if(!l){o=oa(o,1);continue}if(s.selected)return o;s.today&&!a&&(a=o),i||(i=o),o=oa(o,1)}return a||i}var DKe=365;function X2e(e,t){var r=t.moveBy,n=t.direction,i=t.context,a=t.modifiers,o=t.retry,s=o===void 0?{count:0,lastFocused:e}:o,l=i.weekStartsOn,u=i.fromDate,c=i.toDate,f=i.locale,d={day:oa,week:Xg,month:Uo,year:gM,startOfWeek:function(g){return i.ISOWeek?tf(g):mo(g,{locale:f,weekStartsOn:l})},endOfWeek:function(g){return i.ISOWeek?ek(g):AA(g,{locale:f,weekStartsOn:l})}},p=d[r](e,n==="after"?1:-1);n==="before"&&u?p=vM([u,p]):n==="after"&&c&&(p=yM([c,p]));var h=!0;if(a){var m=EY(p,a);h=!m.disabled&&!m.hidden}return h?p:s.count>DKe?s.lastFocused:X2e(p,{moveBy:r,direction:n,context:i,modifiers:a,retry:Tr(Tr({},s),{count:s.count+1})})}var K2e=(0,Ln.createContext)(void 0);function OKe(e){var t=Jy(),r=Z2e(),n=(0,Ln.useState)(),i=n[0],a=n[1],o=(0,Ln.useState)(),s=o[0],l=o[1],u=CKe(t.displayMonths,r),c=i??(s&&t.isDateDisplayed(s))?s:u,f=function(){l(i),a(void 0)},d=function(g){a(g)},p=ga(),h=function(g,A){if(!!i){var b=X2e(i,{moveBy:g,direction:A,context:p,modifiers:r});pl(i,b)||(t.goToDate(b,i),d(b))}},m={focusedDay:i,focusTarget:c,blur:f,focus:d,focusDayAfter:function(){return h("day","after")},focusDayBefore:function(){return h("day","before")},focusWeekAfter:function(){return h("week","after")},focusWeekBefore:function(){return h("week","before")},focusMonthBefore:function(){return h("month","before")},focusMonthAfter:function(){return h("month","after")},focusYearBefore:function(){return h("year","before")},focusYearAfter:function(){return h("year","after")},focusStartOfWeek:function(){return h("startOfWeek","before")},focusEndOfWeek:function(){return h("endOfWeek","after")}};return dt.jsx(K2e.Provider,{value:m,children:e.children})}function kY(){var e=(0,Ln.useContext)(K2e);if(!e)throw new Error("useFocusContext must be used within a FocusProvider");return e}function MKe(e,t){var r=Z2e(),n=EY(e,r,t);return n}var CY=(0,Ln.createContext)(void 0);function jKe(e){if(!h9(e.initialProps)){var t={selected:void 0};return dt.jsx(CY.Provider,{value:t,children:e.children})}return dt.jsx(NKe,{initialProps:e.initialProps,children:e.children})}function NKe(e){var t=e.initialProps,r=e.children,n=function(a,o,s){var l,u,c;if((l=t.onDayClick)===null||l===void 0||l.call(t,a,o,s),o.selected&&!t.required){(u=t.onSelect)===null||u===void 0||u.call(t,void 0,a,o,s);return}(c=t.onSelect)===null||c===void 0||c.call(t,a,a,o,s)},i={selected:t.selected,onDayClick:n};return dt.jsx(CY.Provider,{value:i,children:r})}function J2e(){var e=(0,Ln.useContext)(CY);if(!e)throw new Error("useSelectSingle must be used within a SelectSingleProvider");return e}function TKe(e,t){var r=ga(),n=J2e(),i=xY(),a=SY(),o=kY(),s=o.focusDayAfter,l=o.focusDayBefore,u=o.focusWeekAfter,c=o.focusWeekBefore,f=o.blur,d=o.focus,p=o.focusMonthBefore,h=o.focusMonthAfter,m=o.focusYearBefore,g=o.focusYearAfter,A=o.focusStartOfWeek,b=o.focusEndOfWeek,v=function(T){var L,_,Y,oe;h9(r)?(L=n.onDayClick)===null||L===void 0||L.call(n,e,t,T):sD(r)?(_=i.onDayClick)===null||_===void 0||_.call(i,e,t,T):lD(r)?(Y=a.onDayClick)===null||Y===void 0||Y.call(a,e,t,T):(oe=r.onDayClick)===null||oe===void 0||oe.call(r,e,t,T)},x=function(T){var L;d(e),(L=r.onDayFocus)===null||L===void 0||L.call(r,e,t,T)},w=function(T){var L;f(),(L=r.onDayBlur)===null||L===void 0||L.call(r,e,t,T)},S=function(T){var L;(L=r.onDayMouseEnter)===null||L===void 0||L.call(r,e,t,T)},k=function(T){var L;(L=r.onDayMouseLeave)===null||L===void 0||L.call(r,e,t,T)},j=function(T){var L;(L=r.onDayPointerEnter)===null||L===void 0||L.call(r,e,t,T)},O=function(T){var L;(L=r.onDayPointerLeave)===null||L===void 0||L.call(r,e,t,T)},C=function(T){var L;(L=r.onDayTouchCancel)===null||L===void 0||L.call(r,e,t,T)},N=function(T){var L;(L=r.onDayTouchEnd)===null||L===void 0||L.call(r,e,t,T)},D=function(T){var L;(L=r.onDayTouchMove)===null||L===void 0||L.call(r,e,t,T)},P=function(T){var L;(L=r.onDayTouchStart)===null||L===void 0||L.call(r,e,t,T)},q=function(T){var L;(L=r.onDayKeyUp)===null||L===void 0||L.call(r,e,t,T)},z=function(T){var L;switch(T.key){case"ArrowLeft":T.preventDefault(),T.stopPropagation(),r.dir==="rtl"?s():l();break;case"ArrowRight":T.preventDefault(),T.stopPropagation(),r.dir==="rtl"?l():s();break;case"ArrowDown":T.preventDefault(),T.stopPropagation(),u();break;case"ArrowUp":T.preventDefault(),T.stopPropagation(),c();break;case"PageUp":T.preventDefault(),T.stopPropagation(),T.shiftKey?m():p();break;case"PageDown":T.preventDefault(),T.stopPropagation(),T.shiftKey?g():h();break;case"Home":T.preventDefault(),T.stopPropagation(),A();break;case"End":T.preventDefault(),T.stopPropagation(),b();break}(L=r.onDayKeyDown)===null||L===void 0||L.call(r,e,t,T)},I={onClick:v,onFocus:x,onBlur:w,onKeyDown:z,onKeyUp:q,onMouseEnter:S,onMouseLeave:k,onPointerEnter:j,onPointerLeave:O,onTouchCancel:C,onTouchEnd:N,onTouchMove:D,onTouchStart:P};return I}function FKe(){var e=ga(),t=J2e(),r=xY(),n=SY(),i=h9(e)?t.selected:sD(e)?r.selected:lD(e)?n.selected:void 0;return i}function _Ke(e){return Object.values(em).includes(e)}function PKe(e,t){var r=[e.classNames.day];return Object.keys(t).forEach(function(n){var i=e.modifiersClassNames[n];if(i)r.push(i);else if(_Ke(n)){var a=e.classNames["day_".concat(n)];a&&r.push(a)}}),r}function IKe(e,t){var r=Tr({},e.styles.day);return Object.keys(t).forEach(function(n){var i;r=Tr(Tr({},r),(i=e.modifiersStyles)===null||i===void 0?void 0:i[n])}),r}function BKe(e,t,r){var n,i,a,o=ga(),s=kY(),l=MKe(e,t),u=TKe(e,l),c=FKe(),f=Boolean(o.onDayClick||o.mode!=="default");(0,Ln.useEffect)(function(){var S;l.outside||!s.focusedDay||!f||pl(s.focusedDay,e)&&((S=r.current)===null||S===void 0||S.focus())},[s.focusedDay,e,r,f,l.outside]);var d=PKe(o,l).join(" "),p=IKe(o,l),h=Boolean(l.outside&&!o.showOutsideDays||l.hidden),m=(a=(i=o.components)===null||i===void 0?void 0:i.DayContent)!==null&&a!==void 0?a:iKe,g=dt.jsx(m,{date:e,displayMonth:t,activeModifiers:l}),A={style:p,className:d,children:g,role:"gridcell"},b=s.focusTarget&&pl(s.focusTarget,e)&&!l.outside,v=s.focusedDay&&pl(s.focusedDay,e),x=Tr(Tr(Tr({},A),(n={disabled:l.disabled,role:"gridcell"},n["aria-selected"]=l.selected,n.tabIndex=v||b?0:-1,n)),u),w={isButton:f,isHidden:h,activeModifiers:l,selectedDays:c,buttonProps:x,divProps:A};return w}function RKe(e){var t=(0,Ln.useRef)(null),r=BKe(e.date,e.displayMonth,t);return r.isHidden?dt.jsx("div",{role:"gridcell"}):r.isButton?dt.jsx(m9,Tr({name:"day",ref:t},r.buttonProps)):dt.jsx("div",Tr({},r.divProps))}function $Ke(e){var t=e.number,r=e.dates,n=ga(),i=n.onWeekNumberClick,a=n.styles,o=n.classNames,s=n.locale,l=n.labels.labelWeekNumber,u=n.formatters.formatWeekNumber,c=u(Number(t),{locale:s});if(!i)return dt.jsx("span",{className:o.weeknumber,style:a.weeknumber,children:c});var f=l(Number(t),{locale:s}),d=function(p){i(t,r,p)};return dt.jsx(m9,{name:"week-number","aria-label":f,className:o.weeknumber,style:a.weeknumber,onClick:d,children:c})}function qKe(e){var t,r,n=ga(),i=n.styles,a=n.classNames,o=n.showWeekNumber,s=n.components,l=(t=s?.Day)!==null&&t!==void 0?t:RKe,u=(r=s?.WeekNumber)!==null&&r!==void 0?r:$Ke,c;return o&&(c=dt.jsx("td",{className:a.cell,style:i.cell,children:dt.jsx(u,{number:e.weekNumber,dates:e.dates})})),dt.jsxs("tr",{className:a.row,style:i.row,children:[c,e.dates.map(function(f){return dt.jsx("td",{className:a.cell,style:i.cell,role:"presentation",children:dt.jsx(l,{displayMonth:e.displayMonth,date:f})},wM(f))})]})}function L2e(e,t,r){for(var n=r?.ISOWeek?ek(t):AA(t,r),i=r?.ISOWeek?tf(e):mo(e,r),a=od(n,i),o=[],s=0;s<=a;s++)o.push(oa(i,s));var l=o.reduce(function(u,c){var f=r?.ISOWeek?xM(c):SM(c,r),d=u.find(function(p){return p.weekNumber===f});return d?(d.dates.push(c),u):(u.push({weekNumber:f,dates:[c]}),u)},[]);return l}function LKe(e,t){var r=L2e(Wo(e),Jg(e),t);if(t?.useFixedWeeks){var n=EM(e,t);if(n<6){var i=r[r.length-1],a=i.dates[i.dates.length-1],o=Xg(a,6-n),s=L2e(Xg(a,1),o,t);r.push.apply(r,s)}}return r}function zKe(e){var t,r,n,i=ga(),a=i.locale,o=i.classNames,s=i.styles,l=i.hideHead,u=i.fixedWeeks,c=i.components,f=i.weekStartsOn,d=i.firstWeekContainsDate,p=i.ISOWeek,h=LKe(e.displayMonth,{useFixedWeeks:Boolean(u),ISOWeek:p,locale:a,weekStartsOn:f,firstWeekContainsDate:d}),m=(t=c?.Head)!==null&&t!==void 0?t:nKe,g=(r=c?.Row)!==null&&r!==void 0?r:qKe,A=(n=c?.Footer)!==null&&n!==void 0?n:eKe;return dt.jsxs("table",{id:e.id,className:o.table,style:s.table,role:"grid","aria-labelledby":e["aria-labelledby"],children:[!l&&dt.jsx(m,{}),dt.jsx("tbody",{className:o.tbody,style:s.tbody,children:h.map(function(b){return dt.jsx(g,{displayMonth:e.displayMonth,dates:b.dates,weekNumber:b.weekNumber},b.weekNumber)})}),dt.jsx(A,{displayMonth:e.displayMonth})]})}function UKe(){return!!(typeof window<"u"&&window.document&&window.document.createElement)}var WKe=UKe()?Ln.useLayoutEffect:Ln.useEffect,yY=!1,HKe=0;function z2e(){return"react-day-picker-".concat(++HKe)}function VKe(e){var t,r=e??(yY?z2e():null),n=(0,Ln.useState)(r),i=n[0],a=n[1];return WKe(function(){i===null&&a(z2e())},[]),(0,Ln.useEffect)(function(){yY===!1&&(yY=!0)},[]),(t=e??i)!==null&&t!==void 0?t:void 0}function GKe(e){var t,r,n=ga(),i=n.dir,a=n.classNames,o=n.styles,s=n.components,l=Jy().displayMonths,u=VKe(n.id?"".concat(n.id,"-").concat(e.displayIndex):void 0),c=n.id?"".concat(n.id,"-grid-").concat(e.displayIndex):void 0,f=[a.month],d=o.month,p=e.displayIndex===0,h=e.displayIndex===l.length-1,m=!p&&!h;i==="rtl"&&(t=[p,h],h=t[0],p=t[1]),p&&(f.push(a.caption_start),d=Tr(Tr({},d),o.caption_start)),h&&(f.push(a.caption_end),d=Tr(Tr({},d),o.caption_end)),m&&(f.push(a.caption_between),d=Tr(Tr({},d),o.caption_between));var g=(r=s?.Caption)!==null&&r!==void 0?r:JXe;return dt.jsxs("div",{className:f.join(" "),style:d,children:[dt.jsx(g,{id:u,displayMonth:e.displayMonth,displayIndex:e.displayIndex}),dt.jsx(zKe,{id:c,"aria-labelledby":u,displayMonth:e.displayMonth})]},e.displayIndex)}function QKe(e){var t=ga(),r=t.classNames,n=t.styles;return dt.jsx("div",{className:r.months,style:n.months,children:e.children})}function YKe(e){var t,r,n=e.initialProps,i=ga(),a=kY(),o=Jy(),s=(0,Ln.useState)(!1),l=s[0],u=s[1];(0,Ln.useEffect)(function(){!i.initialFocus||!a.focusTarget||l||(a.focus(a.focusTarget),u(!0))},[i.initialFocus,l,a.focus,a.focusTarget,a]);var c=[i.classNames.root,i.className];i.numberOfMonths>1&&c.push(i.classNames.multiple_months),i.showWeekNumber&&c.push(i.classNames.with_weeknumber);var f=Tr(Tr({},i.styles.root),i.style),d=Object.keys(n).filter(function(h){return h.startsWith("data-")}).reduce(function(h,m){var g;return Tr(Tr({},h),(g={},g[m]=n[m],g))},{}),p=(r=(t=n.components)===null||t===void 0?void 0:t.Months)!==null&&r!==void 0?r:QKe;return dt.jsx("div",Tr({className:c.join(" "),style:f,dir:i.dir,id:i.id,nonce:n.nonce,title:n.title,lang:n.lang},d,{children:dt.jsx(p,{children:o.displayMonths.map(function(h,m){return dt.jsx(GKe,{displayIndex:m,displayMonth:h},m)})})}))}function ZKe(e){var t=e.children,r=yXe(e,["children"]);return dt.jsx($Xe,{initialProps:r,children:dt.jsx(YXe,{children:dt.jsx(jKe,{initialProps:r,children:dt.jsx(aKe,{initialProps:r,children:dt.jsx(lKe,{initialProps:r,children:dt.jsx(AKe,{children:dt.jsx(OKe,{children:t})})})})})})})}function eEe(e){return dt.jsx(ZKe,Tr({},e,{children:dt.jsx(YKe,{initialProps:e})}))}var kv=(e,t,r,n,i,a,o,s)=>e.openCustomMenu(t,Fi.default.createElement(KKe,{ui:e,value:n,setValue:i,time:a}),{width:"280px",height:"280px"},r,s),XKe=e=>{let{goToMonth:t,nextMonth:r,previousMonth:n}=Jy(),[i,a]=(0,Fi.useState)(!1);return Fi.default.createElement("div",{className:"mk-date-picker-header"},Fi.default.createElement("button",{disabled:!n,onClick:()=>n&&t(n),dangerouslySetInnerHTML:{__html:e.ui.getSticker("ui//chevron-left")}}),i?Fi.default.createElement("div",{className:"mk-date-picker-header-input"},Fi.default.createElement("input",{type:"text",value:e.displayMonth.getMonth()+1,onKeyDown:o=>{if(o.key==="ArrowUp"){let s=Uo(e.displayMonth,1);t(s)}else if(o.key==="ArrowDown"){let s=Uo(e.displayMonth,-1);t(s)}},onChange:o=>{let s=e.displayMonth;s.setMonth(+o.target.value-1),t(s)}}),Fi.default.createElement("input",{type:"text",value:e.displayMonth.getFullYear(),onKeyDown:o=>{if(o.key==="ArrowUp"){let s=e.displayMonth;s.setFullYear(s.getFullYear()+1),t(s)}else if(o.key==="ArrowDown"){let s=e.displayMonth;s.setFullYear(s.getFullYear()-1),t(s)}},onChange:o=>{let s=e.displayMonth;s.setFullYear(+o.target.value),t(s)}})):Fi.default.createElement("div",{onClick:()=>a(!0)},_r(e.ui.superstate,e.displayMonth,"MMM yyy")),Fi.default.createElement("button",{disabled:!r,onClick:()=>r&&t(r),dangerouslySetInnerHTML:{__html:e.ui.getSticker("ui//chevron-right")}}))},KKe=e=>{let[t,r]=(0,Fi.useState)(0),[n,i]=(0,Fi.useState)(0),[a,o]=(0,Fi.useState)(0),[s,l]=(0,Fi.useState)(e.value),[u,c]=(0,Fi.useState)(e.time==2),[f,d]=(0,Fi.useState)(!1),p=()=>{let m=e.value?e.value:e.time==0?Hn(new Date):new Date,g=m.getHours(),A=m.getMinutes(),b=m.getSeconds();r(g),i(A),o(b),l(m),e.time==1&&(g==0&&A==0&&b==0&&!u||c(!0))};(0,Fi.useEffect)(()=>{p()},[e.value,e.time]),(0,Fi.useEffect)(()=>{p()},[]);let h=m=>{let g=new Date(s),A=m?.h??t,b=m?.m??n,v=m?.s??a;m&&(m.h!==void 0&&r(m.h),m.m!==void 0&&i(m.m),m.s!==void 0&&o(m.s)),e.time&&(g.setHours(A),g.setMinutes(b),g.setSeconds(v),A==0&&b==0&&v==0&&c(!1)),m.y!==void 0&&g.setFullYear(m.y),m.mo!==void 0&&g.setMonth(m.mo),e.setValue(g,e.time!=0&&!(A==0&&b==0&&v==0))};return Fi.default.createElement("div",{className:"mk-date-picker-container"},Fi.default.createElement(eEe,{defaultMonth:s,mode:"single",classNames:{root:"mk-date-picker",day:"mk-date-picker-day",cell:"mk-date-picker-cell",months:"mk-date-picker-months",month:"mk-date-picker-month",day_today:"mk-date-picker-today",day_selected:"mk-date-picker-selected"},components:{Caption:m=>XKe({ui:e.ui,...m})},labels:{labelMonthDropdown:()=>{},labelYearDropdown:()=>{},labelNext:()=>{},labelPrevious:()=>{},labelDay:()=>{},labelWeekday:()=>{},labelWeekNumber:()=>{}},onSelect:(m,g,A,b)=>{let v=m;u&&(v.setHours(t),v.setMinutes(n),v.setSeconds(a)),l(v),e.setValue(v,e.time!=0&&!(t==0&&n==0&&a==0)),b.stopPropagation()}}),u?Fi.default.createElement("div",{className:"mk-date-picker-time"},Fi.default.createElement("div",{dangerouslySetInnerHTML:{__html:e.ui.getSticker("ui//clock")}}),Fi.default.createElement("input",{type:"text",value:t.toString().padStart(2,"0"),onKeyDown:m=>{m.key==="ArrowUp"?h({h:(t+1)%24}):m.key==="ArrowDown"&&h({h:(t+23)%24})},onChange:m=>{h({h:+m.target.value})}}),":",Fi.default.createElement("input",{type:"text",value:n.toString().padStart(2,"0"),onKeyDown:m=>{m.key==="ArrowUp"?h({m:(n+1)%60}):m.key==="ArrowDown"&&h({m:(n+59)%60})},onChange:m=>{h({m:+m.target.value})}}),Fi.default.createElement("button",{className:"mk-date-picker-meridiem",onClick:()=>{h({h:(t+12)%24})}},t<12?"AM":"PM"),Fi.default.createElement("button",{onClick:()=>h({h:0,m:0,s:0}),dangerouslySetInnerHTML:{__html:e.ui.getSticker("ui//close")}})):e.time==1?Fi.default.createElement("button",{onClick:()=>c(!0)},"Add Time"):null)};var tEe=Ae(Ya()),xs=Ae(Te());var rEe=e=>{let[t,r]=(0,xs.useState)(e.initialValue);(0,xs.useEffect)(()=>{r(e.initialValue)},[e.initialValue]);let n=(0,xs.useMemo)(()=>{let f=Yi(t);return Lee(f)?f:null},[t]),i=(f,d)=>{let p=_r(e.superstate,f,d?$s:"yyyy-MM-dd");e.saveValue(p),r(p),e.setEditMode(null)},a=(0,xs.useRef)(null),o=(0,xs.useRef)(null);(0,xs.useEffect)(()=>{e.editMode==4&&o.current&&(s(),o.current.focus())},[e.editMode]);let s=(0,xs.useCallback)(f=>{if(e.editMode<=1)return;let d=f?f.target.getBoundingClientRect():o.current.getBoundingClientRect();a.current=kv(e.superstate.ui,d,Ne(f.view.document),n,i,1,null,"bottom")},[n]),l=f=>{f.stopPropagation(),(f.key=="Enter"||f.key=="Escape")&&(f.target.blur(),i(n,!1),a.current.hide())},u=(0,xs.useMemo)(()=>or(e.propertyValue)?.format,[e.propertyValue]),c=!(t?.length>0);return xs.default.createElement("div",{className:"mk-cell-date",onClick:f=>!t&&s(f)},xs.default.createElement("div",{className:(0,tEe.default)("mk-cell-date-item",c&&"mk-cell-date-new")},xs.default.createElement("div",{className:"mk-icon-xsmall",dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//calendar")}}),c&&"Select",e.editMode==4?xs.default.createElement("input",{onClick:f=>f.stopPropagation(),className:"mk-cell-text",ref:o,type:"text",value:t,onChange:f=>r(f.target.value),onMouseDown:()=>s(),onKeyDown:l}):xs.default.createElement("div",{className:"mk-cell-date-value",onClick:f=>s(f)},n?_r(e.superstate,n,u?.length>0?u:null):t)))};var rm=Ae(Te());var tm=Ae(Te());var A9=e=>{let t=(0,tm.useMemo)(()=>e.multi?sr(e.initialValue)??[]:[e.initialValue],[e.initialValue]),r=(0,tm.useRef)(null);(0,tm.useEffect)(()=>{e.editMode==4&&r?.current?.focus()},[e.editMode]);let n=i=>{e.superstate.ui.openPalette(tm.default.createElement(Ta,{ui:e.superstate.ui,selectedSticker:a=>e.saveValue(a)}),Ne(i.view.document))};return tm.default.createElement("div",{className:"mk-cell-icon"},t.map((i,a)=>i?.length>0?tm.default.createElement("div",{className:"mk-cell-clickable",key:a,"aria-label":H.buttons.changeIcon,dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker(i)},onClick:o=>n(o)}):tm.default.createElement("div",{key:a,className:"mk-cell-placeholder",onClick:o=>n(o)},H.labels.selectIcon)))};var Nl=Ae(Te());var Cv=/https?:\/\/(www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_\+.~#?&//=]*)/gi;var JKe=e=>{let[t,r]=(0,Nl.useState)(""),[n,i]=(0,Nl.useState)([]),[a,o]=(0,Nl.useState)([]),[s,l]=(0,Nl.useState)(null);(0,Nl.useEffect)(()=>{let d=[];d.push(...[...e.superstate.pathsIndex.values()].filter(p=>p.subtype=="image").map(p=>({path:p.path,thumnail:p.label.thumbnail}))),i(d),o(d)},[]),(0,Nl.useEffect)(()=>{t.match(Cv)?o([{path:t,thumnail:t}]):o(n.filter(d=>d.path.includes(t)))},[t,n]);let u=d=>{r(d.target.value)},c=d=>{let p=a.findIndex(h=>h.path==s);d.key==="ArrowUp"&&p>0?l(a[p-1].path):d.key==="ArrowDown"&&p{f.current&&f.current.focus()},[f.current]),Nl.default.createElement(Nl.default.Fragment,null,Nl.default.createElement("input",{onKeyDown:c,value:t,ref:f,onChange:u,className:"mk-input mk-input-large mk-border-bottom"}),Nl.default.createElement("div",{className:"mk-layout-masonry mk-padding-12 mk-layout-scroll"},a.map(d=>Nl.default.createElement("img",{key:d.path,src:e.superstate.ui.getUIPath(d.thumnail),className:s===d.path?"mk-selected":"",onClick:()=>{e.selectedPath(d.path),e.hide()}}))))},_f=JKe;var Zo=Ae(Te());var g9=e=>{let{initialValue:t,multi:r}=e,[n,i]=Zo.default.useState(sr(t)),a=(0,Zo.useRef)(null),o=(0,Zo.useMemo)(()=>n?.length>0?n.map(c=>e.superstate.ui.getUIPath(c)):[],[n]);Zo.default.useEffect(()=>{i(sr(t))},[t]);let s=c=>{if(r){let f=[...n];f.splice(c,1),i(f),e.saveValue(Bi(f))}else e.saveValue("")},l=(c,f)=>{e.multi?c==-1?e.saveValue(Bi([...n,f])):e.saveValue(Bi(n.map((d,p)=>p==c?f:d))):e.saveValue(f)},u=(c,f)=>{e.superstate.ui.openPalette(Zo.default.createElement(_f,{superstate:e.superstate,selectedPath:d=>l(c,d)}),Ne(f.view.document)),e.setEditMode(null)};return Zo.default.createElement("div",{className:"mk-cell-image"},o.map((c,f)=>Zo.default.createElement("div",{key:f,className:"mk-cell-image-item"},Zo.default.createElement("img",{onClick:d=>e.superstate.ui.openPath(t,d.metaKey?"tab":!1),src:c}),e.editMode>1?Zo.default.createElement("div",{className:"mk-image-selector"},Zo.default.createElement("div",{onClick:d=>u(f,d),className:"mk-hover-button mk-icon-xsmall",dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//edit")}}),Zo.default.createElement("div",{onClick:()=>s(f),className:"mk-hover-button mk-icon-xsmall",dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//close")}})):Zo.default.createElement(Zo.default.Fragment,null))),e.editMode>1?e.multi?Zo.default.createElement("div",{onClick:c=>u(-1,c),className:"mk-cell-option-new mk-icon-small",dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//plus")}}):n.length==0?Zo.default.createElement("div",{onClick:c=>u(-1,c),className:"mk-cell-clickable"},"Select"):null:Zo.default.createElement(Zo.default.Fragment,null))};var eb=Ae(Te());var uD=e=>{let t=u=>e.multi?sr(u)??[]:[u].filter(c=>c).map(c=>e.superstate.spaceManager.resolvePath(c,e.source));(0,eb.useEffect)(()=>{n(t(e.initialValue))},[e.initialValue]);let[r,n]=(0,eb.useState)(t(e.initialValue)),i=u=>{let c=r.filter(f=>f!=u);n(c),a(c)},a=u=>{e.multi?e.saveValue(Bi(u)):e.saveValue(os(u))},o=(u,c)=>{if(!e.multi)n(c),a(c);else{let f=c[0];if(f){let d=kr([...r,f]);n(d),a(d)}}},s=()=>{let u=[...e.superstate.pathsIndex.values()].filter(f=>!f.hidden).map(f=>({name:f.name,value:f.path,description:f.path})),c=e.multi?u:[{name:H.menu.none,value:""},...u];return{ui:e.superstate.ui,multi:!1,editable:!0,value:r.map(f=>f),options:c,saveOptions:o,placeholder:H.labels.linkItemSelectPlaceholder,detail:!0,searchable:!0}},l=async u=>{await e.superstate.spaceManager.pathExists(u)||await e.superstate.spaceManager.createItemAtPath("/","md",u),e.superstate.ui.openPath(u,!1)};return eb.default.createElement(ig,{superstate:e.superstate,baseClass:"mk-cell-link",removeValue:i,selectLabel:e.compactMode?e.property.name:H.labels.select,menuProps:s,labelElement:u=>eb.default.createElement(oo,{superstate:e.superstate,path:u.value},u.children),value:r,multi:e.multi,editMode:e.editMode})};var nEe=e=>{let t=Bs(e.initialValue),r=(0,rm.useMemo)(()=>pr(e.propertyValue,"fileprop",e.superstate),[e.propertyValue]),n=(a,o)=>{e.saveOptions(JSON.stringify({...r,[a]:o}),"")},i=a=>{let o={superstate:e.superstate,saveFormula:s=>n("value",s),formula:r.value,value:e.row,fields:e.columns,path:e.path};e.superstate.ui.openCustomMenu(a.target.getBoundingClientRect(),rm.default.createElement(Ah,{...o}),{...o},Ne(a.view.document),"bottom")};return r.type=="boolean"?rm.default.createElement(c9,{...e,initialValue:t,editMode:0}):t?.length==0?rm.default.createElement(rm.default.Fragment,null):r.type=="image"?rm.default.createElement(g9,{...e,initialValue:t,editMode:0,multi:!0}):r.type=="icon"?rm.default.createElement(A9,{...e,initialValue:t,multi:!0,editMode:0}):r.type=="link"?rm.default.createElement(uD,{...e,initialValue:t,multi:!0,editMode:0}):rm.default.createElement(d9,{...e,initialValue:t,editMode:0,multi:!0,source:e.source})};var og=Ae(Te());var iEe=e=>{let{initialValue:t,saveValue:r}=e,[n,i]=og.default.useState(t),a=(0,og.useRef)(null),o=()=>{t!=n&&r(n)},s=l=>{l.stopPropagation(),l.key=="Enter"&&(l.target.blur(),e.setEditMode(null)),l.key=="Escape"&&(i(t),l.target.blur(),e.setEditMode(null))};return og.default.useEffect(()=>{i(t)},[t]),(0,og.useEffect)(()=>{e.editMode==4&&a?.current?.focus()},[e.editMode]),e.editMode>2?og.default.createElement("input",{className:"mk-cell-text",type:"number",ref:a,value:n??"",onChange:l=>i(l.target.value),onKeyDown:s,onBlur:o}):og.default.createElement("div",{className:"mk-cell-number"},n)};var fn=Ae(Te()),aEe=Ae(bl());var OY=e=>{let{value:t,saveValue:r,saveType:n}=e,i=[...Object.keys(e.type??{}).map(u=>({name:u,type:e.type[u].type,value:JSON.stringify({...e.type[u].value,alias:e.type[u].label})})),...Object.keys(t).filter(u=>!Object.keys(e.type??{}).includes(u)).map(u=>({name:u,type:"text"}))],a=(u,c)=>{u!=c&&r({...t,[c]:t[u],[u]:void 0})},o=(u,c)=>{r({...t,[u]:c})},s=(u,c)=>{if(e.editMode<=3)return;let f=u.target.getBoundingClientRect(),d=[];d.push({name:H.menu.rename,icon:"ui//edit",value:"edit",onClick:()=>{e.superstate.ui.openModal(H.labels.rename,fn.default.createElement(Ki,{value:c,saveLabel:H.labels.rename,saveValue:p=>{a(c,p)}}),Ne(u.view.document))}}),d.push({name:H.buttons.delete,icon:"ui//trash",value:"delete",onClick:()=>{e.saveType(Object.keys(e.type??{}).reduce((p,h)=>h!=c?{...p,[h]:e.type[h]}:p,{}),Object.keys(t).reduce((p,h)=>h!=c?{...p,[h]:t[h]}:p,{}))}}),e.superstate.ui.openMenu(f,Ht(e.superstate.ui,d),Ne(u.view.document))},l=(u,c,f)=>{if(u.type=="object"||u.type=="object-multi"){let d=Nm(f,u.type=="object-multi");if(Rx(u)){let p=pr(c,u.type),h={...e.type,[u.name]:{type:u.type,label:u.name,value:p}};n(h,d)}}else o(u.name,f)};return fn.default.createElement("div",{className:"mk-cell-object-group"},e.draggable&&fn.default.createElement("div",{className:"mk-cell-object-group-header",onClick:u=>{e.showDragMenu(u)}},e.typeName??"Object"),fn.default.createElement("div",{className:"mk-cell-object"},i.map((u,c)=>fn.default.createElement(bs,{key:c,initialValue:t[u.name]??"",superstate:e.superstate,updateValue:f=>o(u.name,f),updateFieldValue:(f,d)=>l(u,f,d),propertyMenu:f=>s(f,u.name),row:t,columns:i,source:null,compactMode:e.compactMode,column:u,editMode:5}))))},MY=e=>{let t=pr(e.propertyValue,"object",e.superstate),r=t.type,{initialValue:n,superstate:i}=e,a=(0,fn.useMemo)(()=>Nm(n,e.multi),[n,e.multi]),o=(v,x)=>{if(e.multi){let w=a.map(S=>({...Object.keys(v).reduce((k,j)=>S[j]?{...k,[j]:S[j]}:k,{})}));e.savePropValue(JSON.stringify({...t,type:v}),JSON.stringify(w))}else e.savePropValue(JSON.stringify({...t,type:v}),JSON.stringify(x))},s=v=>{e.saveValue(JSON.stringify(v))},l=v=>{let x=Object.keys(r).reduce((w,S)=>({...w,[S]:""}),{});e.saveValue(JSON.stringify([...a.slice(0,v),x,...a.slice(v)]))},u=(v,x)=>{if(x>=a.length){e.saveValue(JSON.stringify([...a,v]));return}e.saveValue(JSON.stringify(a.map((w,S)=>S==x?v:w)))},c=v=>{e.saveValue(JSON.stringify(a.filter((x,w)=>w!=v)))},f=v=>{v&&s({...a,[v]:""})},d=(v,x)=>{let w=v.target.getBoundingClientRect(),S=[];S.push({name:H.menu.insertAbove,value:"insert-above",onClick:k=>{l(x)}}),S.push({name:H.menu.insertBelow,value:"insert-below",onClick:k=>{l(x+1)}}),S.push(Rt),x>0&&S.push({name:H.menu.moveUp,value:"move-up",onClick:k=>{e.saveValue(JSON.stringify(Ws(a,x,x-1)))}}),x{e.saveValue(JSON.stringify(Ws(a,x,x+1)))}}),S.push(Rt),S.push({name:H.buttons.delete,icon:"ui//trash",value:"delete",onClick:()=>{c(x)}}),e.superstate.ui.openMenu(w,Ht(e.superstate.ui,S),Ne(v.view.document))},[p,h]=(0,fn.useState)(-1),[m,g]=(0,fn.useState)(-1),A=()=>{g(-1),h(-1)};Ca({onDragStart({active:v}){v.data.current.type=="object"&&h(v.data.current.id)},onDragOver({active:v,over:x}){let w=x?.data.current.id;v.data.current.type=="object"&&w&&g(w)},onDragCancel(){A()},onDragEnd({active:v,over:x}){if(!v||m!=-1){A();return}e.saveValue(JSON.stringify(Ws(a,p,m))),A()}});let b=(0,fn.useRef)();return(0,fn.useEffect)(()=>{b.current&&b.current.update(e)},[e]),e.compactMode?fn.default.createElement("div",{className:"mk-cell-object"},fn.default.createElement("div",{className:"mk-cell-clickable",onClick:v=>{b.current=i.ui.openCustomMenu(v.currentTarget.getBoundingClientRect(),fn.default.createElement(eJe,{...e}),e,Ne(v.view.document))}},fn.default.createElement("div",{className:"mk-icon-xsmall",dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//edit")}}),`${H.menu.edit} ${e.property.name}`)):e.multi?fn.default.createElement("div",{className:"mk-cell-object-multi"},a.map((v,x)=>fn.default.createElement(OY,{key:x,superstate:i,value:v,compactMode:e.compactMode,row:e.row,typeName:t.typeName,columns:e.columns,type:r,saveValue:w=>u(w,x),saveType:o,editMode:e.editMode,draggable:!0,index:x,showDragMenu:w=>d(w,x)})),p!=-1&&(0,aEe.createPortal)(fn.default.createElement(Um,{dropAnimation:null,zIndex:1600},fn.default.createElement(OY,{superstate:i,value:a[p],typeName:t.typeName,compactMode:e.compactMode,row:e.row,columns:e.columns,type:r,saveValue:null,saveType:null,editMode:e.editMode,draggable:!1})),document.body)):fn.default.createElement(OY,{superstate:i,value:a,typeName:t.typeName,compactMode:e.compactMode,row:e.row,columns:e.columns,type:r,saveValue:s,saveType:o,editMode:e.editMode,draggable:!1})},eJe=e=>{let[t,r]=(0,fn.useState)(e.initialValue),[n,i]=(0,fn.useState)(e.property.value),a=c=>{r(c),e.saveValue(c)},o=(c,f)=>{r(f),i(c),e.savePropValue(c,f)},s=(c,f)=>{let d=pr(n,e.property.type),p=Nm(t,e.property.type=="object-multi");e.property.type=="object-multi"?o(JSON.stringify({...d,type:c}),JSON.stringify(p)):o(JSON.stringify({...d,type:c}),JSON.stringify(f))},l=c=>{let f=c.target.getBoundingClientRect(),d=pr(n,e.property.type)?.type,p=Nm(t,e.property.type=="object-multi");Nf(e.superstate,f,Ne(c.view.document),{spaces:[],fields:[],saveField:(h,m)=>(s({...d??{},[m.name]:{type:m.type,label:m.name}},{...p,[m.name]:""}),!0),fileMetadata:!0})},u=c=>{let f=Nm(t,e.property.type=="object-multi"),d=pr(n,e.property.type)?.type,p=Object.keys(d).reduce((h,m)=>({...h,[m]:""}),{});a(JSON.stringify([...f.slice(0,c),p,...f.slice(c)]))};return fn.default.createElement("div",{className:"mk-editor-frame-properties"},fn.default.createElement("div",{className:"mk-editor-actions-name"},fn.default.createElement("div",{className:"mk-editor-actions-name-icon"},fn.default.createElement("div",{className:"mk-icon-small",dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//list")}})),fn.default.createElement("div",{className:"mk-editor-actions-name-text"},H.labels.editObject),fn.default.createElement("span",null),fn.default.createElement("div",{className:"mk-icon-small mk-inline-button",dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//close")},onClick:()=>e.hide()})),fn.default.createElement(MY,{...e,initialValue:t,compactMode:!1,propertyValue:n,saveValue:c=>{a(c)},savePropValue:(c,f)=>{o(c,f)},editMode:5}),fn.default.createElement("div",{className:"mk-cell-object-options"},fn.default.createElement("button",{onClick:c=>l(c),className:"mk-toolbar-button"},fn.default.createElement("div",{className:"mk-icon-xsmall",dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//plus")}}),H.labels.propertyFileProp),e.property.type=="object-multi"&&fn.default.createElement("button",{onClick:c=>u(0),className:"mk-inline-button"},fn.default.createElement("div",{className:"mk-icon-xsmall",dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//insert")}}),"Object")))};var cD=Ae(Te());var v9=e=>{let[t,r]=(0,cD.useState)(Mk(e.initialValue)),n=(a,o)=>{r(Mk(o[0])),e.saveValue(o[0])},i=()=>{let a=(e.columns??[]).map(o=>({name:o.name,description:o.table,value:o.table==""?`$root['props']['${o.name}']`:`$contexts['${o.table}']['${o.name}']`}));return{ui:e.superstate.ui,multi:!1,editable:!0,value:t?[t]:[],options:a,saveOptions:n,placeholder:H.labels.linkItemSelectPlaceholder,detail:!0,searchable:!0}};return cD.default.createElement(ig,{superstate:e.superstate,removeValue:null,baseClass:"mk-cell-link",selectLabel:e.compactMode?e.property.name:H.labels.select,menuProps:i,labelElement:a=>cD.default.createElement("div",null,a.value),value:t?[t]:[],multi:!1,editMode:e.editMode})};var Ic=Ae(Te());var oEe=e=>{let t=(0,Ic.useMemo)(()=>pr(e.propertyValue,"aggregate",e.superstate),[e.propertyValue]),r=(0,Ic.useMemo)(()=>{let f=e.cols?.find(d=>d.name==t.ref);return f&&f.type=="context"?pr(f.value,"context",e.superstate):null},[e.cols,t]),n=(0,Ic.useMemo)(()=>{if(r&&r.space)return e.superstate.spaceManager.resolvePath(r.space,e.contextPath)},[r,e.contextPath]),i=(0,Ic.useMemo)(()=>e.contextTable[n]?.cols.find(f=>f.name==t.field),[t.field,e.contextTable,n]),a=(f,d)=>(d?sr(f)??[]:[f]).filter(p=>p),[o,s]=(0,Ic.useState)([]);(0,Ic.useEffect)(()=>{!r?.field||!e.contextTable[n]||s(e.contextTable[n].rows.reduce((f,d)=>sr(d[r.field]).includes(e.path)?[...f,d[mt]]:f,[]))},[n,r,e.path,e.contextTable]);let[l,u]=(0,Ic.useState)([]),c=(0,Ic.useMemo)(()=>!n||!i?"":Q5(e.superstate,kr([...l,...o]).map(f=>e.contextTable[n].rows.find(d=>d[mt]==f)).filter(f=>f).map(f=>f[i.name]),t.fn,i),[l,o,t,e.contextTable,n,i]);return(0,Ic.useEffect)(()=>{u(a(e.row[t.ref],e.multi))},[e.row,t,e.multi]),Ic.default.createElement("div",{className:"mk-cell-text"},c)};var Js=Ae(Te());var jY=e=>{let t=async()=>{e.superstate.ui.openPath(e.initialValue,!1)},r=(0,Js.useRef)(null),[n,i]=(0,Js.useState)(null);(0,Js.useEffect)(()=>{zN(e.superstate,e.initialValue).then(c=>i(c))},[e.initialValue]);let a=(0,Js.useRef)(null),o=()=>({multi:!1,ui:e.superstate.ui,editable:!0,value:[e.initialValue],options:e.superstate.allSpaces().map(c=>({name:c.name,value:c.path,description:c.name})),saveOptions:(c,f)=>e.saveValue(f[0]),removeOption:()=>null,placeholder:H.labels.optionItemSelectPlaceholder,searchable:!0,showAll:!0,onHide:()=>e.setEditMode(null)}),s=()=>({multi:!1,ui:e.superstate.ui,editable:!0,value:[n.schema],options:e.superstate.contextsIndex.get(n.space).schemas.map(c=>({name:c.name,value:c.id,description:c.name})),saveOptions:(c,f)=>e.saveValue(`${n?.space}/#^${f[0]}`),removeOption:()=>null,placeholder:H.labels.optionItemSelectPlaceholder,searchable:!0,showAll:!0,onHide:()=>e.setEditMode(null)}),l=c=>{let f=c.target.getBoundingClientRect();r.current=e.superstate.ui.openMenu(f,o(),Ne(c.view.document))},u=c=>{let f=c.target.getBoundingClientRect();r.current=e.superstate.ui.openMenu(f,s(),Ne(c.view.document))};return Js.default.createElement("div",{ref:a,className:"mk-cell-space"},Js.default.createElement("div",{className:"mk-cell-option-item"},Js.default.createElement("div",{onClick:()=>t()},n?.space),e.editMode>2&&Js.default.createElement(Js.default.Fragment,null,Js.default.createElement("span",null),Js.default.createElement("div",{onClick:c=>l(c),className:"mk-cell-option-select mk-icon-xxsmall mk-icon-rotated",dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//collapse-solid")}}))),e.isTable&&Js.default.createElement("div",{className:"mk-cell-option-item"},Js.default.createElement("div",{onClick:()=>t()},n?.schemaName),n?.space&&Js.default.createElement("div",{onClick:c=>u(c),className:"mk-cell-option-select mk-icon-xxsmall mk-icon-rotated",dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//collapse-solid")}})))};var Hd=Ae(Te());var fD=Ae(Te());var NY=e=>{let[t,r]=(0,fD.useState)(e.value),n=(a,o)=>{r({...t,[a]:o}),e.saveValue(a,o)},i=a=>a.type.startsWith("object")||a.type=="super";return fD.default.createElement("div",{className:"mk-cell-object"},e.command.fields.map((a,o)=>{let s=i(a);return fD.default.createElement(bs,{key:o,superstate:e.superstate,initialValue:a.type.startsWith("object")?t?.[a.name]:wa(t?.[a.name]),compactMode:!1,updateFieldValue:(l,u)=>{n(a.name,a.type.startsWith("object")?u:jr(u))},updateValue:l=>{n(a.name,a.type.startsWith("object")?l:jr(l))},column:{...a,table:""},editMode:5,columns:e.command.fields})}))};var sEe=e=>{let t=(0,Hd.useMemo)(()=>{let l=pr(e.propertyValue,"super",e.superstate),u=l.dynamic?e.row?.[l.field]:l.field;return e.superstate.cli.commandForAction(u)},[e.propertyValue,e.row]),r=l=>{if(!l)return null;let u;try{u=JSON.parse(l),u=Object.keys(u).reduce((c,f)=>typeof u[f]=="object"?{...c,[f]:JSON.stringify(u[f])}:typeof u[f]=="string"?{...c,[f]:jr(u[f])}:{...c,[f]:u[f]},{})}catch(c){return console.log(c),null}return u},[n,i]=(0,Hd.useState)(r(X$(e.initialValue)));(0,Hd.useEffect)(()=>{i(r(X$(e.initialValue)))},[e.initialValue]);let a=l=>`{${Object.keys(l??{}).map(u=>`"${u}": ${l[u]}`).join(",")}}`,o=(l,u)=>{i({...n,[l]:u});let c=EJ(a({...n,[l]:u}));e.saveValue(c)},s=l=>{let u=l.currentTarget.getBoundingClientRect(),c={superstate:e.superstate,command:t,value:n,saveValue:o};e.superstate.ui.openCustomMenu(u,Hd.default.createElement(NY,{...c}),c,Ne(l.view.document),"bottom")};return Hd.default.createElement(Hd.default.Fragment,null,t&&(e.compactMode?Hd.default.createElement("div",{className:"mk-cell-super",onClick:l=>s(l)},"Edit Parameters"):Hd.default.createElement(NY,{superstate:e.superstate,command:t,value:n,saveValue:o})))};var sg=Ae(Te());var lEe=e=>{let[t,r]=(0,sg.useState)([]),[n,i]=(0,sg.useState)([]);(0,sg.useEffect)(()=>{r(e.superstate.pathsIndex.get(e.path).metadata?.tags??[]),i([...e.superstate.tagsMap.get(e.path)??[]])},[]),(0,sg.useEffect)(()=>{let l=u=>{u.path==e.path&&(r(e.superstate.pathsIndex.get(e.path).metadata?.tags??[]),i([...e.superstate.tagsMap.get(e.path)??[]]))};return e.superstate.eventsDispatcher.addListener("pathStateUpdated",l),()=>{e.superstate.eventsDispatcher.removeListener("pathStateUpdated",l)}},[e.path]);let a=l=>{YB(e.superstate,e.path,l)},o=(l,u)=>{let c=u[0];th(e.superstate,e.path,c)},s=()=>{let l=e.superstate.spaceManager.readTags().map(u=>({name:u,value:u}));return{ui:e.superstate.ui,multi:!1,editable:!0,value:n,options:l,saveOptions:o,placeholder:H.labels.tagItemSelectPlaceholder,searchable:!0,showAll:!0,onHide:()=>e.setEditMode(null)}};return sg.default.createElement(ig,{superstate:e.superstate,baseClass:"mk-cell-tags",removeValue:a,menuProps:s,selectLabel:e.compactMode?e.property.name:H.labels.select,value:n,multi:!0,editMode:e.editMode,labelElement:l=>sg.default.createElement("div",{className:"mk-cell-tags-label"},l.value,t.some(u=>u.toLowerCase()==l.value)&&l.children)})};var tb=Ae(Te());var uEe=e=>{let{initialValue:t,saveValue:r}=e,n=(0,tb.useRef)(null),i=o=>{let s=o.currentTarget.innerText;t!=s&&r(s)},a=o=>{o.stopPropagation(),o.key=="Enter"&&(o.shiftKey||(o.target.blur(),e.setEditMode(null))),o.key=="Escape"&&(n.current.innerText=t,o.target.blur(),e.setEditMode(null))};return(0,tb.useEffect)(()=>{if(e.editMode==4&&n?.current){let o=window.getSelection();o.selectAllChildren(n.current),o.collapseToEnd()}},[e.editMode]),e.editMode>2?tb.default.createElement("div",{onClick:o=>o.stopPropagation(),className:"mk-cell-text",ref:n,"data-ph":e.compactMode?e.property.name:"Empty",onKeyDown:a,onBlur:i,contentEditable:!0,dangerouslySetInnerHTML:{__html:t}}):tb.default.createElement("div",{className:"mk-cell-text"},t)};var S2=e=>{let{initialValue:t,column:r,row:n}=e,i=l=>{e.updateValue(l)},a=(l,u)=>{e.editMode>0&&e.updateFieldValue?e.updateFieldValue(l,u):e.updateValue(u)},o={initialValue:t,saveValue:i,editMode:e.editMode,setEditMode:e.setEditMode??(()=>{}),superstate:e.superstate,propertyValue:r.value,path:e.source??n?.[mt],property:r,compactMode:e.compactMode},s=fc(r.type,r.name);return s?s.type=="file"?xo.default.createElement(uD,{...o,multi:!1,source:e.source,editMode:0}):s.type=="icon"?xo.default.createElement(A9,{...o,multi:s.multiType==r.type}):s.type=="boolean"?xo.default.createElement(c9,{...o}):s.type=="option"?xo.default.createElement(d9,{...o,multi:s.multiType==r.type,saveOptions:a,source:e.source}):s.type=="date"?xo.default.createElement(rEe,{...o}):s.type=="context"?xo.default.createElement(B2e,{...o,multi:s.multiType==r.type,source:e.source,contextTable:e.contextTable,contextPath:e.contextPath}):s.type=="aggregate"?xo.default.createElement(oEe,{...o,multi:s.multiType==r.type,row:n,source:e.source,contextTable:e.contextTable,contextPath:e.contextPath,cols:e.columns}):s.type=="fileprop"?xo.default.createElement(nEe,{...o,row:e.row,columns:e.columns,saveOptions:a,source:e.source}):s.type=="number"?xo.default.createElement(iEe,{...o}):s.type=="link"?xo.default.createElement(uD,{...o,multi:s.multiType==r.type,source:e.source}):s.type=="tags-multi"?xo.default.createElement(lEe,{...o}):s.type=="image"?xo.default.createElement(g9,{...o,multi:s.multiType==r.type}):s.type=="object"?xo.default.createElement(MY,{...o,multi:s.multiType==r.type,savePropValue:a,columns:e.columns,row:e.row,compactMode:e.compactMode}):s.type=="color"?xo.default.createElement(I2e,{...o}):s.type=="space"?xo.default.createElement(jY,{...o,isTable:!1}):s.type=="table"?xo.default.createElement(jY,{...o,isTable:!0}):s.type=="super"?xo.default.createElement(sEe,{...o,row:n,columns:e.columns,compactMode:e.compactMode,source:e.source}):s.type=="input"?xo.default.createElement(v9,{...o,columns:e.columns}):xo.default.createElement(uEe,{...o}):xo.default.createElement(xo.default.Fragment,null)};var pEe=e=>{let{spaceInfo:t,spaceState:r}=(0,Vt.useContext)(ur),{readMode:n}=(0,Vt.useContext)($r),{tableData:i,dbSchema:a,contextTable:o,saveDB:s,selectedRows:l,selectRows:u,sortedColumns:c,filteredData:f,predicate:d,savePredicate:p,updateFieldValue:h,updateValue:m}=(0,Vt.useContext)(Na),g=e.superstate.settings.contextPagination??25,[A,b]=Vt.default.useState({pageIndex:0,pageSize:g}),[v,x]=(0,Vt.useState)(null),[w,S]=(0,Vt.useState)(null),[k,j]=(0,Vt.useState)(null),[O,C]=(0,Vt.useState)(null),[N,D]=(0,Vt.useState)(null),[P,q]=(0,Vt.useState)({}),z=(0,Vt.useRef)(null),I=c.find(R=>R.primary=="true");(0,Vt.useEffect)(()=>{q({...d?.colsSize??{},"+":30})},[d]),(0,Vt.useEffect)(()=>{C(null)},[k,w]);let T=R=>{let J=R(P);q(J),L(J)},L=(0,Vt.useCallback)((0,dEe.debounce)(R=>p({colsSize:R}),1e3),[d]),_=(R,J,ee)=>{a?.id==Er?za(e.superstate,r,"md",R,!0):s(bk(i,I?{[I.name]:R??"",...ee??{}}:ee??{},J))},Y=(R,J)=>{if(R.metaKey){e.superstate.ui.openPath(i.rows[parseInt(J)][mt],!1);return}R.ctrlKey?l.some(ee=>ee==J)?u(null,l.filter(ee=>ee!=J)):u(J,kr([...l,J])):R.shiftKey?u(J,kr([...l,...P2e(w,J,f.map(ee=>ee._index))])):u(J,[J]),S(J)},oe=R=>{let J=Ce=>{if(k){let _e=k.split("#");m(_e[0],Ce,_e[1]??"",parseInt(w),"")}},ee=()=>{J("")},ie=()=>{navigator.clipboard.writeText(i.rows[parseInt(w)][k])},re=()=>{let Ce=dY(w,f.map(_e=>_e._index));u(Ce,[Ce]),S(Ce)},Ee=()=>{let Ce=pY(w,f.map(_e=>_e._index));u(Ce,[Ce]),S(Ce)};if(R.key=="c"&&R.metaKey&&ie(),R.key=="x"&&R.metaKey&&(ie(),ee()),R.key=="v"&&R.metaKey&&navigator.clipboard.readText().then(Ce=>J(Ce)),R.key=="Escape"&&(u(null,[]),S(null),j(null)),(R.key=="Backspace"||R.key=="Delete")&&ee(),R.key=="Enter"){k&&w&&(R.shiftKey?(_("",parseInt(w)+1),re()):(C([k,w]),R.preventDefault(),R.stopPropagation()));return}if(R.key=="ArrowDown"&&(re(),R.preventDefault()),R.key=="ArrowUp"&&(Ee(),R.preventDefault()),R.key=="ArrowLeft"){let Ce=pY(k,te.map(_e=>_e.accessorKey).filter(_e=>_e!="+"));j(Ce)}if(R.key=="ArrowRight"){let Ce=dY(k,te.map(_e=>_e.accessorKey).filter(_e=>_e!="+"));j(Ce)}},te=(0,Vt.useMemo)(()=>[...c.map(R=>({header:R.name,footer:()=>"test",accessorKey:R.name+R.table,meta:{table:R.table,editable:R.name!=mt,schemaId:a?.id},cell:({getValue:J,row:{index:ee},column:{colId:ie},cell:re,table:Ee})=>{let Ce=J(),_e=parseInt(f[ee]._index),he=parseInt(f[ee]._index),ze=Be=>{C(null),j(null),Ce!=Be&&Ee.options.meta?.updateData(R.name,Be,R.table,_e)},Ye=(Be,Le)=>{Ee.options.meta?.updateFieldValue(R.name,Be,Le,R.table,_e)},tt=n||re.getIsGrouped()?0:Gr(e.superstate.ui)?5:O&&O[0]==R.name+R.table&&O[1]==he.toString()?4:2,Ct={compactMode:!0,initialValue:Ce,updateValue:ze,updateFieldValue:Ye,superstate:e.superstate,setEditMode:C,column:R,editMode:tt,row:f[ee],contextTable:o,source:f[ee][mt],columns:c,contextPath:r.path};return fc(R.type,R.name)?Vt.default.createElement(S2,{...Ct}):Vt.default.createElement(Vt.default.Fragment,null,Ce)}}))??[],...n?[]:[{header:"+",meta:{schemaId:a?.id},accessorKey:"+",size:20,cell:()=>Vt.default.createElement(Vt.default.Fragment,null)}]],[c,f,O,d,a,o]),Q=(0,Vt.useMemo)(()=>d?.groupBy?.length>0&&c.find(R=>R.name+R.table==d.groupBy[0])?d.groupBy:[],[d,c]),fe=b2e({data:f,columns:te,columnResizeMode:"onChange",state:{columnVisibility:d?.colsHidden.reduce((R,J)=>({...R,[J]:!1}),{}),columnOrder:d?.colsOrder,columnSizing:{...te.reduce((R,J)=>({...R,[J.accessorKey]:150}),{}),...P},grouping:Q,expanded:!0,pagination:A},onColumnSizingChange:T,getCoreRowModel:h2e(),getExpandedRowModel:A2e(),getGroupedRowModel:v2e(),getPaginationRowModel:y2e(),onPaginationChange:b,meta:{updateData:m,updateFieldValue:h}}),Ie=qw(Pp(BA,{activationConstraint:{distance:10}}),Pp(RA,{activationConstraint:{delay:250,tolerance:5}})),Se={droppable:{strategy:_p.Always}};function Oe(R){let{active:{id:J}}=R;x(J),D(N),document.body.style.setProperty("cursor","grabbing")}function ve({over:R}){R?.id&&D(R?.id??null)}let ye=R=>{p({filters:[...(d?.filters??[]).filter(J=>J.field!=R.field),R]})},me=(R,J)=>{p({colsCalc:{...d.colsCalc,[R]:J}})},ke=(0,Vt.useMemo)(()=>{let R={};return Object.keys(d.colsCalc).forEach(J=>{R[J]=Q5(e.superstate,f.map(ee=>ee[J]),d.colsCalc[J],c.find(ee=>ee.name==J))}),R},[c,f,d.colsCalc]),$=(R,J,ee)=>{Gr(e.superstate.ui)||ee=="+"||(Y({ctrlKey:R.ctrlKey,metaKey:R.metaKey,altKey:R.altKey,shiftKey:R.shiftKey},f[J]._index),j(ee),R.detail===1||R.detail===2&&C([ee,f[J]._index]))};function ae({active:R,over:J}){U();let ee=d?.colsOrder??[];p({colsOrder:Ws(ee,ee.findIndex(ie=>ie==v),ee.findIndex(ie=>ie==N))})}function ce(){U()}function U(){D(null),x(null),document.body.style.setProperty("cursor","")}return Vt.default.createElement(Lw,{sensors:Ie,collisionDetection:IN,measuring:Se,onDragStart:Oe,onDragOver:ve,onDragEnd:ae,onDragCancel:ce},Vt.default.createElement("div",{className:"mk-table",ref:z,tabIndex:1,onKeyDown:oe,onMouseDown:R=>R.stopPropagation()},Vt.default.createElement("table",{...{}},Vt.default.createElement("thead",null,fe.getHeaderGroups().map(R=>Vt.default.createElement("tr",{key:R.id},Vt.default.createElement("th",null),R.headers.map(J=>Vt.default.createElement("th",{className:"mk-th",key:J.id,style:{minWidth:J.column.getIsGrouped()?"0px":P[J.column.columnDef.accessorKey]??"150px",maxWidth:J.column.getIsGrouped()?"0px":P[J.column.columnDef.accessorKey]??"150px"}},J.isPlaceholder?null:J.column.columnDef.header!="+"?J.column.getIsGrouped()?Vt.default.createElement(Vt.default.Fragment,null):Vt.default.createElement(n9,{superstate:e.superstate,editable:!n&&J.column.columnDef.meta.editable,column:c.find(ee=>ee.name==J.column.columnDef.header&&ee.table==J.column.columnDef.meta.table)}):Vt.default.createElement(n9,{superstate:e.superstate,isNew:!0,editable:!0,column:{name:"",schemaId:J.column.columnDef.meta.schemaId,type:"text",table:""}}),Vt.default.createElement("div",{...{onMouseDown:J.getResizeHandler(),onTouchStart:J.getResizeHandler(),className:`mk-resizer ${J.column.getIsResizing()?"isResizing":""}`}})))))),Vt.default.createElement("tbody",null,fe.getRowModel().rows.map(R=>Vt.default.createElement("tr",{className:l?.some(J=>J==f[R.index]._index)?"mk-active":void 0,onContextMenu:J=>{let ee=parseInt(f[R.index]._index);u9(J,e.superstate,r.path,a.id,ee)},key:R.id},Vt.default.createElement("td",null),R.getVisibleCells().map((J,ee)=>J.getIsGrouped()?Vt.default.createElement("td",{key:ee,className:"mk-td-group",colSpan:c.length+(n?0:1)},Vt.default.createElement("div",{...{onClick:R.getToggleExpandedHandler(),style:{display:"flex",alignItems:"center",cursor:"normal"}}},t9(J.column.columnDef.cell,J.getContext())," ","(",R.subRows.length,")")):J.getIsAggregated()?Vt.default.createElement(Vt.default.Fragment,{key:ee},t9(J.column.columnDef.aggregatedCell??J.column.columnDef.cell,J.getContext())):Vt.default.createElement("td",{onClick:ie=>$(ie,J.row.index,J.column.columnDef.accessorKey),className:`${J.column.columnDef.accessorKey==k?"mk-selected-cell ":""} mk-td ${J.getIsPlaceholder()?"mk-td-empty":""}`,key:J.id,style:{minWidth:J.getIsPlaceholder()?"0px":P[J.column.columnDef.accessorKey]??"50px",maxWidth:J.getIsPlaceholder()?"0px":P[J.column.columnDef.accessorKey]??"unset"}},J.getIsPlaceholder()?null:t9(J.column.columnDef.cell,J.getContext())))))),Vt.default.createElement("tfoot",null,fe.getCanNextPage()&&Vt.default.createElement("tr",null,Vt.default.createElement("th",{className:"mk-row-new",colSpan:c.length+(n?1:2),onClick:()=>fe.setPageSize(A.pageSize+g)},H.buttons.loadMore)),n?Vt.default.createElement(Vt.default.Fragment,null):Vt.default.createElement("tr",null,Vt.default.createElement("th",{className:"mk-row-new",colSpan:c.length+(n?1:2),"data-placeholder":H.hintText.newItem,onFocus:R=>{j(null),S(null)},onKeyPress:R=>{R.key=="Enter"&&(_(R.currentTarget.innerText),R.currentTarget.innerText="",R.currentTarget.blur())},contentEditable:!0})),Vt.default.createElement("tr",null,Vt.default.createElement("td",null),Q.map((R,J)=>Vt.default.createElement("td",{key:J})),(Q.length>0?c.filter(R=>!Q.includes(R.name)):c).map((R,J)=>Vt.default.createElement("td",{key:J,className:(0,fEe.default)("mk-td-aggregate",!d.colsCalc[R.name]&&"mk-empty"),onClick:ee=>{let ie=[];ie.push({name:"None",value:"",onClick:()=>{me(R.name,null)}}),Object.keys(_c).forEach(Ee=>{(_c[Ee].type.includes(ho(R))||_c[Ee].type.includes("any"))&&ie.push({name:_c[Ee].label,value:Ee,onClick:()=>{me(R.name,Ee)}})});let re=ee.currentTarget.getBoundingClientRect();e.superstate.ui.openMenu(re,Ht(e.superstate.ui,ie),Ne(ee.view.document))}},d.colsCalc[R.name]?.length>0?Vt.default.createElement("div",null,Vt.default.createElement("span",null,_c[d.colsCalc[R.name]].shortLabel??_c[d.colsCalc[R.name]].label),ke[R.name]):Vt.default.createElement("div",null,Vt.default.createElement("span",null,"Calculate")))),Vt.default.createElement("td",null)))),(0,cEe.createPortal)(Vt.default.createElement(Um,{dropAnimation:null,zIndex:1600},v?Vt.default.createElement(n9,{superstate:e.superstate,editable:!1,column:{name:v,schemaId:i.schema.id,type:"text",table:""}}):null),document.body)))};var bs=e=>{let t=(0,wo.useMemo)(()=>Rx(e.column),[e.column]),r=pr(e.column.value,e.column.type,e.superstate),n=(o,s)=>{let l=Nm(e.initialValue??"",e.column.type=="object-multi");e.column.type=="object-multi"?e.updateFieldValue(JSON.stringify({...r,type:o}),JSON.stringify(l)):e.updateFieldValue(JSON.stringify({...r,type:o}),JSON.stringify(s))},i=o=>{let s=o.target.getBoundingClientRect(),l=pr(e.column.value,e.column.type)?.type,u=Nm(e.initialValue??"",e.column.type=="object-multi");Nf(e.superstate,s,Ne(o.view.document),{spaces:[],fields:[],saveField:(c,f)=>(n({...l??{},[f.name]:{type:f.type,label:f.name}},{...u,[f.name]:""}),!0),fileMetadata:!0})},a=o=>{let s=pr(e.column.value,e.column.type)?.type,l=Nm(e.initialValue??"",e.column.type=="object-multi"),u=Object.keys(s).reduce((c,f)=>({...c,[f]:""}),{});e.updateValue(JSON.stringify([...l.slice(0,o),u,...l.slice(o)]))};return e.compactMode?wo.default.createElement("div",null,wo.default.createElement(S2,{...e})):wo.default.createElement(wo.default.Fragment,null,wo.default.createElement("div",{className:"mk-path-context-row"},wo.default.createElement(JC,{superstate:e.superstate,path:e.path,property:e.column,onClick:o=>e.propertyMenu&&e.propertyMenu(o),contexts:e.contexts,draggable:e.draggable}),wo.default.createElement("div",{className:"mk-path-context-value"},t?!e.compactMode&&wo.default.createElement("div",{className:"mk-cell-object-options"},e.editMode>3&&wo.default.createElement("button",{onClick:o=>i(o),className:"mk-inline-button"},wo.default.createElement("div",{className:"mk-icon-xsmall",dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//plus")}}),H.labels.propertyFileProp),e.column.type=="object-multi"&&wo.default.createElement("button",{onClick:o=>a(0),className:"mk-inline-button"},wo.default.createElement("div",{className:"mk-icon-xsmall",dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//insert")}}),r?.typeName??"Object")):wo.default.createElement(S2,{...e})),e.linkProp&&wo.default.createElement(wo.default.Fragment,null,wo.default.createElement("span",null),wo.default.createElement("div",{className:"mk-icon-small",style:{height:"24px"},onClick:o=>e.linkProp(o),dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//plug")}}))),t&&!e.compactMode&&wo.default.createElement("div",{className:"mk-path-context-row",style:{marginLeft:"30px"}},wo.default.createElement(S2,{...e})))};var mEe=e=>{let{pathState:t}=(0,ws.useContext)($r),[r,n]=(0,ws.useState)({}),[i,a]=(0,ws.useState)([]),[o,s]=(0,ws.useState)([]),{tableData:l,saveProperty:u,delProperty:c,saveFrame:f}=(0,ws.useContext)(ma),d=async()=>{let D=e.superstate.spacesMap.get(t.path)??new Set,P=(await Promise.all([...D].map(async _=>e.superstate.spaceManager.readTable(_,Er).then(Y=>Y.cols??[])))).reduce((_,Y)=>[..._,...Y],[]),q=[],z={},I=t?.metadata?.property??{},T=mM([...Object.keys(I),...l?.cols?.map(_=>_.name)??[]]).filter(_=>!P.some(Y=>Y.name==_)),L=T.map(_=>l?.cols?.find(Y=>Y.name==_)??{table:"",name:_,schemaId:"",type:yA(I[_],_)});I&&(q.push(...L),T.forEach(_=>{z[_]=Ri(_,I[_])})),a(q.filter(_=>!e.excludeKeys?.some(Y=>Y==_.name))),s([...e.superstate.settings.hideFrontmatter?P.map(_=>_.name):[]]),n(nh(e.superstate.formulaContext,e.superstate.pathsIndex,e.superstate.spacesMap,z,L,t))},p=D=>{e.spaces.find(P=>P==D.path)&&d()};(0,ws.useEffect)(()=>(d(),e.superstate.eventsDispatcher.addListener("contextStateUpdated",p),()=>{e.superstate.eventsDispatcher.removeListener("contextStateUpdated",p)}),[e.spaces,l]);let h=(D,P)=>{if(u){let q=l?.cols?.find(z=>z.name==P.name);q&&u(P,q)}pi(e.superstate,t.path,{[P.name]:la(P.type,D,!0)})},m=D=>{c&&D&&c(D),Iye(e.superstate,t.path,D.name)},g=async(D,P)=>{let q={...D,schemaId:Er},z=e.superstate.spacesIndex.get(P)?.space;!z||(await e.superstate.spaceManager.addSpaceProperty(P,q),await WN(e.superstate.spaceManager,z,t.path,q.name,r[q.name]))},A=(D,P)=>{let q=D.target.getBoundingClientRect(),z=[...e.superstate.spacesMap.get(t.path)].map(I=>e.superstate.pathsIndex.get(I)).filter(I=>I).map(I=>({name:I.name,value:I.path,icon:I.label?.sticker,description:I.path}));e.superstate.ui.openMenu(q,{ui:e.superstate.ui,multi:!1,editable:!1,value:[],options:z,saveOptions:(I,T)=>{g(P,T[0])},placeholder:H.labels.spaceSelectPlaceholder,detail:!0,searchable:!0,showAll:!0},Ne(D.view.document),"bottom")},b=(D,P)=>{if(u){let q=l?.cols?.find(z=>z.name==D);q&&u({...q,name:P},q)}qV(e.superstate,t.path,D,P)},v=(D,P)=>{if(u){let q=l?.cols?.find(z=>z.name==P);q&&u({...q,type:D[0]},q)}pi(e.superstate,t.path,{[P]:Bx(D[0])})},x=(D,P)=>{let q=D.target.getBoundingClientRect();e.superstate.ui.openMenu(q,{ui:e.superstate.ui,multi:!1,editable:!1,searchable:!1,saveOptions:(z,I)=>v(I,P),value:[],showAll:!0,options:ml.filter(z=>z.metadata).map((z,I)=>({id:I+1,name:z.label,value:z.type,icon:z.icon}))},Ne(D.view.document))},[w,S]=(0,ws.useState)(null),[k,j]=(0,ws.useState)(null),O=()=>{j(null),S(null)};Ca({onDragStart({active:D}){D.data.current.type=="property"&&S(D.data.current.property)},onDragOver({active:D,over:P}){let q=P?.data.current.id;P?.data.current.type=="property"&&q&&j(q)},onDragCancel(){O()},onDragEnd({active:D,over:P}){if(!D||!k){O();return}O()}});let C=(D,P)=>{if(u){let q=l?.cols?.find(z=>z.name==P.name);q&&u(D,q)}D.name!=P.name&&qV(e.superstate,t.path,P.name,D.name)},N=(D,P)=>{let q=D.target.getBoundingClientRect();if(t.type=="space"){yh({superstate:e.superstate,rect:q,win:Ne(D.view.document),editable:!0,options:[],field:P,fields:i,contextPath:null,saveField:z=>C(z,P),deleteColumn:m,anchor:"bottom"});return}ewe(e.superstate,q,Ne(D.view.document),P,m,()=>A(D,P),b,x)};return ws.default.createElement(ws.default.Fragment,null,e.compactMode?i.map((D,P)=>ws.default.createElement(bs,{key:P,path:t.path,propertyMenu:q=>N(q,D),superstate:e.superstate,initialValue:r[D.name],row:r,compactMode:e.compactMode,column:{...D,table:""},columns:[],editMode:e.editable?5:2,updateValue:q=>h(q,D),updateFieldValue:(q,z)=>h(z,{...D,value:q}),contextTable:{},source:t.path})):e.force?i.map((D,P)=>ws.default.createElement(bs,{key:P,path:t.path,propertyMenu:q=>N(q,D),superstate:e.superstate,initialValue:r[D.name],row:r,compactMode:e.compactMode,column:{...D,table:""},columns:[],editMode:e.editable?5:2,updateValue:q=>h(q,D),updateFieldValue:(q,z)=>h(z,{...D,value:q}),contextTable:{},source:t.path})):ws.default.createElement(ws.default.Fragment,null),o.length>0&&ws.default.createElement("style",null,`${o.map(D=>`.metadata-property[data-property-key="${D}"]`).join(", ")} { display: none; - }`))};var hu=Ae(Te());var Dv={isEmpty:H.filterTypes.isEmpty,isNotEmpty:H.filterTypes.isNotEmpty,include:H.filterTypes.contains,notInclude:H.filterTypes.notContains,is:H.filterTypes.is,isNot:H.filterTypes.isNot,isLink:H.filterTypes.is,isNotLink:H.filterTypes.isNot,equal:"=",isGreatThan:">",isLessThan:"<",isLessThanOrEqual:"\u2264",isGreatThanOrEqual:"\u2265",dateBefore:H.filterTypes.before,dateAfter:H.filterTypes.after,isSameDate:H.filterTypes.isSameDate,isSameDateAsToday:H.filterTypes.isSameDateAsToday,isExactList:H.filterTypes.is,isAnyInList:H.filterTypes.anyOf,isNoneInList:H.filterTypes.noneOf,isTrue:H.filterTypes.checked,isFalse:H.filterTypes.unchecked};var ki=Ae(Te());var bEe=Ae(Ya());var y9=(e,t,r,n,i,a)=>{if(!!n&&n.type!="text"){if(n.type=="number"){let o=uh("",s=>i(s));r.ui.openMenu(e,{...Ht(r.ui,[o])},t)}else if(n.type=="date")kv(r.ui,e,t,new Date,o=>i(o.toISOString()),0);else if(n.type=="option"){let o=pr(n.value,n.type,r,a)?.options??[];r.ui.openMenu(e,{...Ht(r.ui,o),saveOptions:(s,l)=>{i(l[0])}},t)}else if(n.type=="boolean"){let o=[{name:"Yes",value:"true"},{name:"No",value:"false"}];r.ui.openMenu(e,{...Ht(r.ui,o),saveOptions:(s,l)=>{i(l[0])}},t)}}};var Kt=Ae(Te());var tJe=(e,t)=>e.type=="folder"?`${e.path}/#*${t}`:e.type=="vault"?`/#*${t}`:`${e.path}/#*${t}`,TY=(e,t)=>e.type=="folder"?`${e.path}/#;${t}`:e.type=="vault"?`/#;${t}`:`${e.path}/#;${t}`,rb=(e,t)=>e.type=="folder"?`${e.path}/#^${t}`:e.type=="vault"?`/#^${t}`:`${e.path}/#^${t}`,dD=(e,t)=>`![![${tJe(e,t)}]]`,b9=(e,t)=>`![![${rb(e,t)}]]`;var Ov=Ae(Te());var hEe=e=>{let{dbSchema:t,source:r}=(0,Ov.useContext)(Na),n=u=>{e.superstate.ui.openPalette(Ov.default.createElement(Ta,{ui:e.superstate.ui,selectedSticker:c=>e.superstate.spaceManager.saveTableSchema(r,t.id,()=>({...t,def:JSON.stringify({...or(t?.def)??{},icon:c})}))}),Ne(u.view.document))},i=t?.name,a=u=>{let c=u.target.innerText;c!=i&&e.superstate.spaceManager.saveTableSchema(r,t.id,()=>({...t,name:c}))},o=u=>{u.stopPropagation()},s=u=>{u.stopPropagation()},l=u=>{if(u.stopPropagation(),u.key=="a"&&u.metaKey){u.preventDefault();let c=window.getSelection(),f=document.createRange();f.selectNodeContents(u.target),c.removeAllRanges(),c.addRange(f)}u.key=="Enter"&&(u.target.blur(),u.preventDefault()),u.key=="Escape"&&(u.target.blur(),u.preventDefault())};return Ov.default.createElement("div",{className:"mk-context-title"},Ov.default.createElement("div",{className:"mk-path-icon",onClick:u=>n(u),dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker(UJ(t))}}),Ov.default.createElement("div",{contentEditable:!0,dangerouslySetInnerHTML:{__html:t?.name},onBlur:a,onKeyPress:o,onKeyUp:s,onKeyDown:l}),Ov.default.createElement("button",{className:"mk-toolbar-button",onClick:()=>e.superstate.ui.openPath(rb(e.superstate.spacesIndex.get(r),t.id)),dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//expand")}}))};var AEe=Ae(Te()),gEe=e=>AEe.default.createElement("div",{onClick:t=>e.onSelect(t),onContextMenu:t=>e.onContextMenu(t,e.schema),className:`mk-context ${e.active?"mk-active":""}`},hM(e.schema.name,"Untitled"),e.children);var vEe=Ae(Te()),Vd=e=>vEe.default.createElement("button",{className:`mk-collapse ${e.collapsed?"mk-collapsed":""}`,onClick:t=>{!e.onToggle||(t.stopPropagation(),e.onToggle(!e.collapsed,t))},dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//collapse")}});var el=Ae(Te());var yEe=e=>{let{views:t,dbSchema:r,source:n}=(0,el.useContext)(Na),{readMode:i}=(0,el.useContext)($r),{spaceState:a}=(0,el.useContext)(ur),{frameSchema:o,setFrameSchema:s,saveSchema:l,deleteSchema:u}=(0,el.useContext)(ma),c=(m,g)=>{let A=[];A.push({name:H.menu.copyEmbedLink,icon:"ui//link",onClick:b=>{navigator.clipboard.writeText(dD(a,g.id))}}),A.push({name:H.buttons.renameView,icon:"ui//edit",onClick:b=>{e.superstate.ui.openModal(H.labels.renameView,el.default.createElement(Ki,{value:g.name,saveLabel:H.labels.renameView,saveValue:v=>l({...g,name:v})}),Ne(b.view.document))}}),t.length>1&&A.push({name:H.buttons.delete,icon:"ui//trash",onClick:b=>{o.id==g.id&&e.setView&&(t[0].id==g.id?(e.setView(t[1].id),s(t[1])):(e.setView(t[0].id),s(t[0]))),u(g)}}),e.superstate.ui.openMenu(m.target.getBoundingClientRect(),Ht(e.superstate.ui,A),Ne(m.view.document))},f=m=>{s(t.find(g=>g.id==m)),e.setView&&e.setView(m)},d=(0,el.useRef)(null),p=m=>{e.superstate.ui.openModal(H.labels.saveView,el.default.createElement(Ki,{value:"",saveLabel:H.labels.saveView,saveValue:g=>{let A={...o??{name:r.name,def:{db:r.id},type:"view"},id:g.replace(/ /g,"_"),name:g};l(A).then(b=>f(A.id))}}),Ne(m.view.document))},h=m=>{let g=[];(t??[]).forEach(A=>{g.push({name:hM(A.name,"Untitled"),value:A.id,icon:Ix(A),onClick:()=>f(A.id),onMoreOptions:i?null:b=>c(b,A)})}),i||(g.push(Rt),g.push({name:H.menu.newView,icon:"ui//plus",value:"",onClick:A=>p(A)})),e.superstate.ui.openMenu(m.target.getBoundingClientRect(),Ht(e.superstate.ui,g),Ne(m.view.document),"bottom")};return r&&(o?el.default.createElement(el.default.Fragment,null,el.default.createElement("div",{className:"mk-view-selector",ref:d},t.map((m,g)=>el.default.createElement(gEe,{key:g,active:o.id==m.id,superstate:e.superstate,schema:m,onSelect:()=>s(t.find(A=>A.id==m.id)),onContextMenu:c})),el.default.createElement("button",{className:"mk-toolbar-button",onClick:m=>p(m),dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//plus")}}))):el.default.createElement("div",{onClick:m=>h(m),className:"mk-context"},el.default.createElement("div",{className:"mk-path-icon",dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//table")}}),r.name,el.default.createElement(Vd,{collapsed:!1,onToggle:null,superstate:e.superstate})))};var rm=Ae(Te());var x9=e=>{let[t,r]=rm.default.useState(!1),n=()=>{r(!1),e.setSearchString("")},i=rm.default.useRef(null);return(0,rm.useEffect)(()=>{t&&i.current?.focus()},[t]),rm.default.createElement("div",{className:"mk-view-search"},rm.default.createElement("button",{className:"mk-toolbar-button",dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//search")}}),rm.default.createElement(rm.default.Fragment,null,rm.default.createElement("input",{onChange:a=>e.setSearchString(a.target.value),placeholder:H.labels.searchPlaceholder,className:"mk-search-bar",ref:i}),e.closeSearch&&rm.default.createElement("button",{className:"mk-toolbar-button",dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//clear")},onClick:a=>{a.stopPropagation(),n(),e.closeSearch()}})))};var w9=e=>{let{spaceState:t}=(0,Kt.useContext)(ur),{readMode:r}=(0,Kt.useContext)($r),{source:n,dbSchema:i,cols:a,setSearchString:o,setEditMode:s,predicate:l,savePredicate:u,hideColumn:c,delColumn:f,saveColumn:d}=(0,Kt.useContext)(Na),{frameSchema:p,saveSchema:h,setFrameSchema:m}=(0,Kt.useContext)(ma),[g,A]=(0,Kt.useState)(!1),b=t?.propertyTypes??[],v=async(ve,ye)=>{if(ve.view=="table")return[];if(ve.view=="day"||ve.view=="week"||ve.view=="month")return ye!="listView"?[]:[{name:"start",type:"option",value:JSON.stringify({alias:"Start Time Property",source:"$properties"})},{name:"end",type:"option",value:JSON.stringify({alias:"End Time Property",source:"$properties"})},{name:"repeat",type:"option",value:JSON.stringify({alias:"Repeat Property",source:"$properties"})},{name:"startOfDay",type:"number",value:JSON.stringify({alias:"Start of Day"})},{name:"endOfDay",type:"number",value:JSON.stringify({alias:"End of Day"})},{name:"hideHeader",type:"boolean",value:JSON.stringify({alias:"Hide Header"})}];let me=ve?.[ye];if(!me)return[];let ke=e.superstate.spaceManager.uriByString(me);if(ke.authority=="$kit"){let{node:$}=e.superstate.kitFrames.get(ke.ref);return Object.keys($.types).map(ae=>({type:$.types[ae],name:ae,attrs:JSON.stringify($.propsAttrs?.[ae]),schemaId:$.schemaId,value:JSON.stringify($.propsValue?.[ae])})).filter(ae=>!ae.name.startsWith("_"))}return e.superstate.spaceManager.readFrame(ke.path,ke.ref).then($=>$?.cols.filter(ae=>!ae.name.startsWith("_"))??[])},x=a.filter(ve=>ve.hidden!="true"),[w,S]=(0,Kt.useState)(!1),k=ve=>{ve=="table"&&u({view:"table",listView:"",listGroup:"",listItem:""}),ve=="flow"&&u({view:"list",listView:"spaces://$kit/#*listView",listGroup:"spaces://$kit/#*listGroup",listItem:"spaces://$kit/#*flowListItem"}),ve=="list"&&u({view:"list",listView:"spaces://$kit/#*listView",listGroup:"spaces://$kit/#*listGroup",listItem:"spaces://$kit/#*rowItem"}),ve=="details"&&u({view:"list",listView:"spaces://$kit/#*listView",listGroup:"spaces://$kit/#*listGroup",listItem:"spaces://$kit/#*detailItem"}),ve=="board"&&u({view:"list",listView:"spaces://$kit/#*columnView",listGroup:"spaces://$kit/#*columnGroup",listItem:"spaces://$kit/#*cardListItem"}),ve=="cards"&&u({view:"list",listView:"spaces://$kit/#*listView",listGroup:"spaces://$kit/#*gridGroup",listItem:"spaces://$kit/#*cardsListItem"}),ve=="catalog"&&u({view:"list",listView:"spaces://$kit/#*listView",listGroup:"spaces://$kit/#*rowGroup",listItem:"spaces://$kit/#*coverListItem"}),ve=="gallery"&&u({view:"list",listView:"spaces://$kit/#*listView",listGroup:"spaces://$kit/#*masonryGroup",listItem:"spaces://$kit/#*imageListItem"}),ve=="calendar"&&u({view:"list",listView:"spaces://$kit/#*calendarView",listGroup:"spaces://$kit/#*dateGroup",listItem:"spaces://$kit/#*eventItem"})},j=()=>{u({filters:[],sort:[]})},O=()=>{u({colsHidden:[]})},C=(ve,ye)=>{let ke=[...(l??ZC(i)).filters.filter(($,ae)=>ae!=ye)];u({filters:ke})},N={table:{name:H.menu.tableView,icon:"ui//table",view:"table",listView:"",listGroup:"",listItem:""},list:{name:H.menu.listView,icon:"ui//list",view:"list",listView:"spaces://$kit/#*listView",listGroup:"spaces://$kit/#*listGroup",listItem:"spaces://$kit/#*rowItem"},details:{name:H.menu.detailsView,icon:"ui//layout-grid",view:"list",listView:"spaces://$kit/#*listView",listGroup:"spaces://$kit/#*listGroup",listItem:"spaces://$kit/#*detailItem"},board:{name:H.menu.boardView,icon:"ui//square-kanban",view:"list",listView:"spaces://$kit/#*columnView",listGroup:"spaces://$kit/#*columnGroup",listItem:"spaces://$kit/#*cardListItem"},cards:{name:H.menu.cardView,icon:"ui//layout-dashboard",view:"list",listView:"spaces://$kit/#*listView",listGroup:"spaces://$kit/#*gridGroup",listItem:"spaces://$kit/#*cardsListItem"},catalog:{name:H.menu.catalogView,icon:"ui//gallery-horizontal-end",view:"list",listView:"spaces://$kit/#*listView",listGroup:"spaces://$kit/#*rowGroup",listItem:"spaces://$kit/#*coverListItem"},gallery:{name:H.menu.galleryView,icon:"ui//layout-dashboard",view:"list",listView:"spaces://$kit/#*listView",listGroup:"spaces://$kit/#*masonryGroup",listItem:"spaces://$kit/#*imageListItem"},flow:{name:H.menu.flowView,icon:"ui//edit",view:"list",listView:"spaces://$kit/#*listView",listGroup:"spaces://$kit/#*listGroup",listItem:"spaces://$kit/#*flowListItem"},day:{name:"Day View",icon:"ui//calendar",view:"day",listView:"",listGroup:"",listItem:""},week:{name:"Week View",icon:"ui//calendar",view:"week",listView:"",listGroup:"",listItem:""},month:{name:"Month View",icon:"ui//calendar",view:"month",listView:"",listGroup:"",listItem:""}},D=ve=>{let ye=ve.target.getBoundingClientRect(),me=[];return Object.keys(N).forEach(ke=>{let $=N[ke];me.push({name:$.name,icon:$.icon,onClick:ae=>{u({view:$.view,listView:$.listView,listGroup:$.listGroup,listItem:$.listItem})}})}),e.superstate.settings.experimental&&me.push({name:H.menu.customView,icon:"ui//brush",onClick:ke=>{s(3)}}),e.superstate.ui.openMenu(ye,Ht(e.superstate.ui,me),Ne(ve.view.document))},P=(ve,ye)=>Fa(ve,ye,e.superstate,me=>{let ke={...p,name:p.name,def:{db:i.id,context:me},type:"view"};h(ke).then($=>m(ke))}),q=async ve=>{let ye=[];if(r||(ye.push(uh(p.name??"",U=>h({...p,name:U}))),ye.push(Rt),ye.push({name:H.menu.properties,icon:"ui//list",type:6,onSubmenu:(U,R)=>Ie(U,Ne(ve.view.document),R)})),ye.push({name:H.menu.groupBy,icon:"ui//columns",type:6,onSubmenu:(U,R)=>Se(U,Ne(ve.view.document),R)}),ye.push({name:H.menu.sortBy,icon:"ui//sort-desc",type:6,onSubmenu:(U,R)=>te(U,Ne(ve.view.document),R)}),ye.push({name:H.menu.filters,icon:"ui//filter",type:6,onSubmenu:(U,R)=>oe(U,Ne(ve.view.document),R)}),ye.push(Rt),i?.primary=="true"){let U=e.superstate.spacesIndex.get(n);ye.push({name:"Source",icon:"ui//table",type:1,value:U.name,onSubmenu:(R,J)=>P(R,Ne(ve.view.document))}),ye.push(Rt)}let me=await v(l,"listView"),ke=await v(l,"listGroup"),$=await v(l,"listItem"),ae=(U,R,J)=>{u({[U]:{...l[U],[R]:J}})};me.forEach(U=>{ye.push({name:Vo(U,e.superstate),icon:Ii(U),type:1,onClick:R=>{y9(R.target.getBoundingClientRect(),Ne(R.view.document),e.superstate,U,J=>ae("listViewProps",U.name,la(U.type,J,!0)),t.path)}})}),ke.forEach(U=>{ye.push({name:Vo(U,e.superstate),icon:Ii(U),type:1,onClick:R=>{y9(R.target.getBoundingClientRect(),Ne(R.view.document),e.superstate,U,J=>ae("listGroupProps",U.name,la(U.type,J,!0)),t.path)}})}),$.forEach(U=>{ye.push({name:Vo(U,e.superstate),icon:Ii(U),type:1,onClick:R=>{y9(R.target.getBoundingClientRect(),Ne(R.view.document),e.superstate,U,J=>ae("listItemProps",U.name,la(U.type,J,!0)),t.path)}})});let ce=ve.target.getBoundingClientRect();e.superstate.ui.openMenu(ce,Ht(e.superstate.ui,ye),Ne(ve.view.document))},z=(ve,ye)=>{let me=ye[0],ke=x.find(ae=>ae.name+ae.table==me),$=ho(ke);if($){let ae=GQ($,Yp),ce={field:me,fn:ae};u({sort:[...l?.sort.filter(U=>U.field!=ce.field)??[],ce]})}},I=(ve,ye)=>{u({groupBy:ye})},T=ve=>{let ye=[...(l?.sort??[]).filter(me=>me.field!=ve.field)];u({sort:ye})},L=ve=>{let ye=x.find(ke=>ke.name+ke.table==ve),me=ho(ye);if(me){let ke=GQ(me,qi);if(!ke)return;let $=me=="boolean"?{field:ve,fn:ke,fType:qi[ke].valueType,value:"true"}:{field:ve,fn:ke,fType:qi[ke].valueType,value:""};u({filters:[...l?.filters??[],$]})}},_=(ve,ye)=>{let me=ve.target.getBoundingClientRect(),ke=(U,R)=>{let J=R[0],ee={...ye,fn:J};u({sort:[...(l?.sort??[]).filter(ie=>ie.field!=ee.field),ee]})},$=x.find(U=>U.name+U.table==ye.field),ae=ho($),ce=m2(ae,Yp);e.superstate.ui.openMenu(me,{ui:e.superstate.ui,multi:!1,editable:!1,value:[],options:ce.map(U=>({name:Yp[U].label,value:U})),saveOptions:ke,placeholder:H.labels.sortItemSelectPlaceholder,searchable:!1,showAll:!0},Ne(ve.view.document))},Y=(ve,ye,me)=>{let ke=ve.target.getBoundingClientRect(),$=(R,J)=>{let ee=J[0],ie={...ye,fn:ee,fType:qi[ee].valueType};u({filters:(l?.filters??[]).map((re,Ee)=>Ee==me?ie:re)})},ae=x.find(R=>R.name+R.table==ye.field),ce=ho(ae),U=m2(ce,qi);e.superstate.ui.openMenu(ke,{ui:e.superstate.ui,multi:!1,editable:!1,value:[],options:U.map(R=>({name:Dv[R],value:R})),saveOptions:$,placeholder:H.labels.filterItemSelectPlaceholder,searchable:!1,showAll:!0},Ne(ve.view.document))},oe=(ve,ye,me)=>{let ke=x.filter($=>$.type=="fileprop"||m2($.type,qi).length>0).map($=>({name:$.name+$.table,value:$.name+$.table,icon:Ii($),onClick:ae=>{L($.name+$.table)}}));return ke.push(Rt),ke.push({name:H.menu.clearFilters,icon:"ui//x-square",onClick:$=>{j()}}),e.superstate.ui.openMenu(ve,{ui:e.superstate.ui,multi:!1,editable:!1,value:[],options:ke,placeholder:H.labels.propertyItemSelectPlaceholder,searchable:!0,showAll:!0},ye,null,me)},te=(ve,ye,me)=>e.superstate.ui.openMenu(ve,{ui:e.superstate.ui,multi:!1,editable:!1,value:[],options:x.map(ke=>({name:ke.name+ke.table,icon:Ii(ke),value:ke.name+ke.table})),saveOptions:z,placeholder:H.labels.sortItemSelectPlaceholder,searchable:!0,showAll:!0},ye,"right",me),Q=(ve,ye)=>{if(ve.name.length>0&&(ve.name!=ye.name||ve.type!=ye.type||ve.value!=ye.value||ve.attrs!=ye.attrs)){let me=d(ve,ye)}},fe=(ve,ye)=>d({...ye,table:""}),Ie=(ve,ye,me)=>{let ke=(ae,ce,U)=>yh({superstate:e.superstate,rect:ce,editable:ae.primary!="true",win:ye,options:[],field:ae,fields:x,contextPath:t.path,saveField:R=>Q(R,ae),hide:c,deleteColumn:f,hidden:l?.colsHidden.includes(ae.name+ae.table)},U,!0),$=[];return $.push({name:H.labels.newProperty,icon:"ui//plus",type:6,onSubmenu:(ae,ce)=>Nf(e.superstate,ae,ye,{spaces:[],fields:[],saveField:fe,schemaId:i.id,contextPath:t.path},ce)}),$.push(Rt),$.push(...x.filter(ae=>l.colsHidden.some(ce=>ce==ae.name+ae.table)==!1).map(ae=>({name:ae.name+ae.table,icon:Ii(ae),value:ae.name+ae.table,type:6,onSubmenu:(ce,U)=>ke(ae,ce,U)}))),$.push(Rt),$.push(...x.filter(ae=>l.colsHidden.some(ce=>ce==ae.name+ae.table)).map(ae=>({name:ae.name+ae.table,icon:Ii(ae),value:ae.name+ae.table,type:6,onSubmenu:(ce,U)=>ke(ae,ce,U)}))),$.push(Rt),$.push({name:H.menu.unhideFields,icon:"ui//eye",onClick:ae=>{O()}}),e.superstate.ui.openMenu(ve,{ui:e.superstate.ui,multi:!1,editable:!1,value:[],options:$,placeholder:H.labels.propertyItemSelectPlaceholder,searchable:!1,showAll:!0},ye,"right",me)},Se=(ve,ye,me)=>e.superstate.ui.openMenu(ve,{ui:e.superstate.ui,multi:!1,editable:!1,value:[],options:x.map(ke=>({name:ke.name+ke.table,icon:Ii(ke),value:ke.name+ke.table})),saveOptions:I,placeholder:H.labels.propertyItemSelectPlaceholder,searchable:!1,showAll:!0},ye,"right",me),Oe=(ve,ye,me)=>{switch(ye.fType??qi[ye.fn].valueType){case"property":u({filters:(l?.filters??[]).map((ke,$)=>$==me?ye:ke)});break;case"text":case"number":u({filters:(l?.filters??[]).map((ke,$)=>$==me?ye:ke)});break;case"date":{let ke=ce=>{let U={...ye,value:ce?_r(e.superstate,ce):""};u({filters:(l?.filters??[]).map((R,J)=>J==me?U:R)})},$=ve.target.getBoundingClientRect(),ae=new Date(ye.value);kv(e.superstate.ui,$,Ne(ve.view.document),ae.getTime()?ae:null,ke,0);break}case"link":{let ke=a.find(ce=>ce.name+ce.table==ye.field);if(ke?.type.startsWith("context")){let ce=pr(ke.value,ke.type)?.space;if(!ce)return;let U=e.superstate.getSpaceItems(ce)??[],R=ve.target.getBoundingClientRect();e.superstate.ui.openMenu(R,{ui:e.superstate.ui,multi:!1,editable:!1,value:sr(ye.value),options:U.map(J=>({name:J.name,value:J.path}))??[],saveOptions:(J,ee)=>{let ie={...ye,value:ee[0]};u({filters:(l?.filters??[]).map((re,Ee)=>Ee==me?ie:re)})},placeholder:H.labels.optionItemSelectPlaceholder,searchable:!0,showAll:!0},Ne(ve.view.document));return}let $=ce=>{let U={...ye,value:ce};u({filters:(l?.filters??[]).map((R,J)=>J==me?U:R)})},ae=ve.target.getBoundingClientRect();jl(ae,Ne(ve.view.document),e.superstate,ce=>{$(ce)},{multi:!0}),ve.stopPropagation()}break;case"list":{let ke=a.find(ae=>ae.name+ae.table==ye.field),$=(ae,ce)=>{let U={...ye,value:Bi(ce)};u({filters:(l?.filters??[]).map((R,J)=>J==me?U:R)})};if(ke.type.startsWith("option")){let ae=ve.target.getBoundingClientRect(),ce=pr(ke.value,ke.type).options;e.superstate.ui.openMenu(ae,{ui:e.superstate.ui,multi:!0,editable:!1,value:sr(ye.value),options:ce??[],saveOptions:$,placeholder:H.labels.optionItemSelectPlaceholder,searchable:!0,showAll:!0},Ne(ve.view.document))}else if(ke.type.startsWith("context")){let ae=pr(ke.value,ke.type)?.space;if(!ae)return;let ce=e.superstate.getSpaceItems(ae)??[],U=ve.target.getBoundingClientRect();e.superstate.ui.openMenu(U,{ui:e.superstate.ui,multi:!0,editable:!1,value:sr(ye.value),options:ce.map(R=>({name:R.name,value:R.path}))??[],saveOptions:$,placeholder:H.labels.optionItemSelectPlaceholder,searchable:!0,showAll:!0},Ne(ve.view.document))}else if(ke.type.startsWith("link")){let ae=ve.target.getBoundingClientRect();jl(ae,Ne(ve.view.document),e.superstate,ce=>{$([ce],[ce])},{multi:!0}),ve.stopPropagation()}else if(ke.type.startsWith("tags")){let ae=e.superstate.spaceManager.readTags(),ce=ve.target.getBoundingClientRect();e.superstate.ui.openMenu(ce,{ui:e.superstate.ui,multi:!0,editable:!1,value:sr(ye.value),options:ae.map(U=>({name:U,value:U}))??[],saveOptions:$,placeholder:H.labels.tagItemSelectPlaceholder,searchable:!0,showAll:!0},Ne(ve.view.document))}}break}};return Kt.default.createElement(Kt.default.Fragment,null,e.minMode?Kt.default.createElement("div",{className:"mk-view-config"},Kt.default.createElement(x9,{superstate:e.superstate,setSearchString:o,closeSearch:()=>A(!1)}),Kt.default.createElement("button",{className:"mk-toolbar-button",onClick:ve=>{let ye=ve.target.getBoundingClientRect();te(ye,Ne(ve.view.document),null)},dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//sort-desc")}}),Kt.default.createElement("button",{className:"mk-toolbar-button",onClick:ve=>{let ye=ve.target.getBoundingClientRect();oe(ye,Ne(ve.view.document),null)},dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//filter")}})):Kt.default.createElement(Kt.default.Fragment,null,e.showTitle&&Kt.default.createElement("div",{className:"mk-context-config"},Kt.default.createElement(hEe,{superstate:e.superstate}),Kt.default.createElement("span",null),i?.id==Er&&!t.space.readOnly&&Kt.default.createElement(Kt.default.Fragment,null,Kt.default.createElement("button",{className:"mk-button-new",onClick:ve=>s9(e.superstate,ve.target.getBoundingClientRect(),Ne(ve.view.document),t,!0),dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//plus")}}))),Kt.default.createElement("div",{className:"mk-view-config"},!w&&Kt.default.createElement(yEe,{superstate:e.superstate,expanded:!1,setView:e.setView}),Kt.default.createElement("div",{className:"mk-view-options"},Kt.default.createElement("span",null),(jc(e.superstate.ui)||!g)&&Kt.default.createElement("button",{className:(0,bEe.default)("mk-toolbar-button",g&&"mk-active"),onClick:ve=>{ve.stopPropagation(),A(ye=>!ye)},dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//search")}}),!jc(e.superstate.ui)&&g&&Kt.default.createElement(x9,{superstate:e.superstate,setSearchString:o,closeSearch:()=>A(!1)}),Kt.default.createElement("button",{className:"mk-toolbar-button",onClick:ve=>D(ve),dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//layout")}}),Kt.default.createElement("button",{className:"mk-toolbar-button",onClick:ve=>q(ve),dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//view-options")}}))),jc(e.superstate.ui)&&g&&Kt.default.createElement(x9,{superstate:e.superstate,setSearchString:o})),(l?.filters.length>0||l?.sort.length>0||l?.groupBy.length>0)&&Kt.default.createElement("div",{className:"mk-filter-bar"},l.groupBy.length>0&&Kt.default.createElement("div",{className:"mk-filter"},Kt.default.createElement("span",null,H.menu.groupBy),Kt.default.createElement("span",{onClick:ve=>Se(ve.target.getBoundingClientRect(),Ne(ve.view.document),null)},l.groupBy[0]),Kt.default.createElement("div",{onClick:()=>I(null,[]),dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//close")}})),(l?.sort??[]).map((ve,ye)=>Kt.default.createElement("div",{key:ye,className:"mk-filter"},Kt.default.createElement("span",null,ve.field),Kt.default.createElement("span",{onClick:me=>_(me,ve)},Yp[ve.fn].label),Kt.default.createElement("div",{onClick:()=>T(ve),dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//close")}}))),(l?.filters??[]??[]).map((ve,ye)=>Kt.default.createElement("div",{key:ye,className:"mk-filter"},Kt.default.createElement("span",null,ve.field),Kt.default.createElement("span",{onClick:me=>Y(me,ve,ye)},Dv[ve.fn]),Kt.default.createElement(FY,{superstate:e.superstate,fieldType:a.find(me=>me.name+me.table==ve.field)?.type,filter:ve,selectFilterValue:(me,ke)=>Oe(me,ke,ye)}),b.length>0&&Kt.default.createElement("span",{onClick:me=>{me.stopPropagation(),e.superstate.ui.openMenu(me.currentTarget.getBoundingClientRect(),{ui:e.superstate.ui,multi:!1,editable:!1,value:[],options:b.map(ke=>({name:ke.name,value:ke.name,section:ke.type})),saveOptions:(ke,$)=>Oe(me,{...ve,fType:"property",value:$[0]},ye),placeholder:H.labels.contextItemSelectPlaceholder,searchable:!0,showAll:!0,sections:[],showSections:!1},Ne(me.view.document))}},Kt.default.createElement("div",{className:"mk-icon-xsmall",dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//plug")}})),Kt.default.createElement("div",{onClick:()=>C(ve,ye),dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//close")}}))),(l?.filters??[]).length>0&&Kt.default.createElement("div",{className:"mk-filter-add",onClick:ve=>{let ye=ve.target.getBoundingClientRect();oe(ye,Ne(ve.view.document),null)}},Kt.default.createElement("span",null,Kt.default.createElement("span",{className:"mk-icon-xsmall",dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//plus")}}),H.buttons.addFilter)),Kt.default.createElement("span",null)))},FY=e=>{let{filter:t,selectFilterValue:r,fieldType:n}=e,i=qi[t.fn],[a,o]=(0,Kt.useState)(t.value);if((0,Kt.useEffect)(()=>o(t.value),[t.value]),t.fType=="property")return Kt.default.createElement("span",null,t.value);if(!n||!i||i.valueType=="none")return Kt.default.createElement(Kt.default.Fragment,null);if(i.valueType=="text"||i.valueType=="number")return Kt.default.createElement("input",{type:"text",onChange:s=>o(s.currentTarget.value),onBlur:s=>{r(null,{...t,value:a})},onKeyDown:s=>{s.key=="Escape"&&(o(t.value),s.currentTarget.blur()),s.key=="Enter"&&s.currentTarget.blur()},value:a});if(n.startsWith("option")||n.startsWith("context")||n.startsWith("link")||n.startsWith("tag")){let s=sr(t.value);return Kt.default.createElement("span",{onClick:l=>r(l,t)},s.length==0?H.labels.select:s.map((l,u)=>n.startsWith("option")?Kt.default.createElement("span",{key:u},l):Kt.default.createElement(oo,{superstate:e.superstate,key:u,path:l})))}else if(!t.value||t.value.length==0)return Kt.default.createElement("span",{onClick:s=>r(s,t)},H.labels.select);return Kt.default.createElement("span",{onClick:s=>r(s,t)},t.value)};var E2=e=>{(0,ki.useEffect)(()=>{e.superstate.refreshMetadata()},[]);let{filters:t,setFilters:r}=e,n=(h,m,g,A)=>{let b=v=>{l(v,g,A)};if(m.fType=="property"){r(t.map((v,x)=>g==x?{...v,filters:v.filters.map((w,S)=>A==S?{...w,fType:"property",value:m.value}:w)}:v));return}switch(qi[m.fn]?.valueType){case"text":case"number":b(m.value);break;case"date":{let v=S=>{b(Za(S,"yyyy-MM-dd"))},x=h.target.getBoundingClientRect(),w=new Date(m.value);kv(e.superstate.ui,x,Ne(h.view.document),w.getTime()?w:null,v,0);break}case"link":{let v=w=>{b(w)},x=h.target.getBoundingClientRect();jl(x,Ne(h.view.document),e.superstate,v),h.stopPropagation();break}case"space":{let v=w=>{b(w)},x=h.target.getBoundingClientRect();Fa(x,Ne(h.view.document),e.superstate,v);break}case"list":{let v=m.fType,x=(k,j)=>{b(Bi(j))},w=[];v.startsWith("option")?w=sr(m.value).map(k=>({name:k,value:k})):v.startsWith("tags")?w=e.superstate.spaceManager.readTags().map(k=>({value:k,name:k})):v.startsWith("link")&&(w=e.superstate.spaceManager.allPaths().map(k=>({name:Lx(k),value:k,description:k})));let S=h.target.getBoundingClientRect();e.superstate.ui.openMenu(S,{ui:e.superstate.ui,multi:!0,editable:!0,value:sr(m.value),options:w,saveOptions:x,placeholder:H.labels.optionItemSelectPlaceholder,searchable:!1,showAll:!0},Ne(h.view.document))}break}},i=()=>{r(h=>[...h,{type:"any",trueFalse:!0,filters:[]}])},a=h=>{r(t.filter((m,g)=>g!=h))},o=(h,m,g)=>{if(!!h){if(t.length==0){r([{type:"all",trueFalse:!0,filters:[{type:h.type,field:h.field,fType:h.vType,fn:h.defaultFilter,value:""}]}]);return}if(t[m]?.filters.length==0){r(t.map((A,b)=>b==m?{...A,filters:[{type:h.type,field:h.field,fType:h.vType,fn:h.defaultFilter,value:""}]}:A));return}r(t.map((A,b)=>b==m?{...A,filters:!A.filters||g==A.filters.length?[...A.filters??[],{type:h.type,field:h.field,fType:h.vType,fn:h.defaultFilter,value:""}]:A.filters.map((v,x)=>x==g?{...v,type:h.type,field:h.field,fType:h.vType,fn:h.defaultFilter}:v)}:A))}},s=(h,m,g)=>{r(t.map((A,b)=>b==m?{...A,filters:A.filters.map((v,x)=>x==g?{...v,fn:h}:v)}:A))},l=(h,m,g)=>{r(t.map((A,b)=>b==m?{...A,filters:A.filters.map((v,x)=>x==g?{...v,value:h}:v)}:A))},u=(h,m)=>{r(t.map((g,A)=>A==m?{...g,filters:g.filters.filter((b,v)=>v!=h)}:g))},c=(h,m)=>{h==0&&t.length==0?r([{type:m,trueFalse:!0,filters:[]}]):r(t.map((g,A)=>A==h?{...g,type:m}:g))},f=(h,m)=>{let g=h.target.getBoundingClientRect(),A=["any","all"];e.superstate.ui.openMenu(g,{ui:e.superstate.ui,multi:!1,editable:!1,value:[],options:A.map(b=>({name:b=="any"?"or":"and",value:b})),saveOptions:(b,v)=>c(m,v[0]),searchable:!1,showAll:!0},Ne(h.view.document))},d=(h,m,g)=>{let A=h.target.getBoundingClientRect(),{type:b,field:v,fType:x}=t[m].filters[g],w=x=="any"?ZSe(qi):m2(x,qi);e.superstate.ui.openMenu(A,{ui:e.superstate.ui,multi:!1,editable:!0,value:[],options:w.map(S=>({name:Dv[S],value:S})),saveOptions:(S,k)=>s(k[0],m,g),placeholder:H.labels.contextItemSelectPlaceholder,searchable:!0,showAll:!0},Ne(h.view.document))},p=async(h,m,g)=>{let A=h.target.getBoundingClientRect();e.superstate.ui.openMenu(A,{ui:e.superstate.ui,multi:!1,editable:!1,value:[],options:e.fields.map(b=>({name:b.label,value:b,section:b.type,description:b.description})),saveOptions:(b,v)=>o(v[0],m,g),placeholder:H.labels.contextItemSelectPlaceholder,searchable:!0,showAll:!0,sections:e.sections,showSections:!0},Ne(h.view.document))};return ki.default.createElement("div",{className:"mk-query"},t.length==0?ki.default.createElement(xEe,{superstate:e.superstate,selectGroupType:f,group:null,addDefGroup:i,selectField:p,i:0,removeable:e.removeable,removeDefGroup:a}):t.map((h,m)=>ki.default.createElement(xEe,{superstate:e.superstate,key:m,group:h,selectGroupType:f,addDefGroup:i,selectField:p,removeable:e.removeable,i:m,removeDefGroup:a},h.filters.map((g,A,b)=>ki.default.createElement(ki.default.Fragment,{key:A},ki.default.createElement(rJe,{superstate:e.superstate,key:A,filter:g,i:m,k:A,selectField:p,selectFilter:d,selectFilterValue:n,removeDefFilter:u,linkProps:e.linkProps}),A!=b.length-1&&ki.default.createElement("div",{className:"mk-filter",onClick:v=>f(v,m)},ki.default.createElement("span",null,h.type=="any"?"or":"and")))))))},rJe=e=>{let{filter:t,selectField:r,selectFilter:n,selectFilterValue:i,removeDefFilter:a,i:o,k:s}=e,l=e.superstate.allMetadata[t.type]?.properties.find(u=>u.field==t.field)?.label??t.field;return ki.default.createElement("div",{className:"mk-filter"},ki.default.createElement("span",{onClick:u=>r(u,o,s)},t.field.length==0?H.labels.select:l),t.field.length>0&&ki.default.createElement("span",{onClick:u=>n(u,o,s)},Dv[t.fn]?Dv[t.fn]:H.labels.select),t.field.length>0&&Dv[t.fn]&&qi[t.fn]?.valueType!="none"&&ki.default.createElement(ki.default.Fragment,null,ki.default.createElement("span",null,ki.default.createElement(FY,{superstate:e.superstate,fieldType:t.fType,filter:t,selectFilterValue:(u,c)=>i(u,c,o,s)})),e.linkProps&&e.linkProps.length>0&&ki.default.createElement("span",{onClick:u=>{u.stopPropagation(),e.superstate.ui.openMenu(u.currentTarget.getBoundingClientRect(),{ui:e.superstate.ui,multi:!1,editable:!1,value:[],options:e.linkProps.map(c=>({name:c.name,value:c.name,section:c.type})),saveOptions:(c,f)=>i(u,{...t,fType:"property",value:f[0]},o,s),placeholder:H.labels.contextItemSelectPlaceholder,searchable:!0,showAll:!0,sections:[],showSections:!1},Ne(u.view.document))}},ki.default.createElement("div",{className:"mk-icon-xsmall",dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//plug")}}))),ki.default.createElement("span",{onClick:u=>{a(s,o),u.stopPropagation()}},ki.default.createElement("div",{className:"mk-icon-xsmall",dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//close")}})))},xEe=e=>{let{group:t,selectGroupType:r,addDefGroup:n,selectField:i,i:a,removeDefGroup:o}=e;return ki.default.createElement("div",{className:"mk-query-group"},ki.default.createElement("div",{className:"mk-filter-bar mk-query-filters"},e.children,ki.default.createElement("div",{className:"mk-filter-add",onClick:s=>i(s,a,t?.filters.length??0)},ki.default.createElement("span",null,ki.default.createElement("span",{className:"mk-icon-xsmall",dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//plus")}}),H.buttons.addCondition))),e.removeable&&ki.default.createElement("div",{className:"mk-filter-add",onClick:s=>{o(a),s.stopPropagation()}},ki.default.createElement("span",null,ki.default.createElement("span",{className:"mk-icon-small",dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//close")}}))))};var wEe=e=>{let[t,r]=(0,hu.useState)(e.space.metadata??{}),n=l=>{i({...t,filters:l})},i=l=>{r(l),du(e.superstate,e.space.space,l)},a=e.superstate.allMetadata,o=[];Object.keys(a).forEach(l=>{a[l].properties.forEach(u=>{o.push(u)})});let s=Object.keys(a).map(l=>({name:a[l].name,value:l}));return(0,hu.useEffect)(()=>{let l=u=>{if(u.path==e.space.path){let c=e.superstate.spacesIndex.get(e.space.path)?.metadata;c&&r(c)}};return e.superstate.eventsDispatcher.addListener("spaceStateUpdated",l),()=>{e.superstate.eventsDispatcher.removeListener("spaceStateUpdated",l)}},[e.space]),t?.filters?.length>0&&hu.default.createElement("div",{className:"mk-path-context-row"},hu.default.createElement("div",{className:"mk-path-context-field"},hu.default.createElement("div",{className:"mk-path-context-field-icon",dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//live")}}),hu.default.createElement("div",{className:"mk-path-context-field-key"},H.subViews.smartSearch)),hu.default.createElement("div",{className:"mk-path-context-value"},hu.default.createElement("div",{className:"mk-props-value"},hu.default.createElement("div",{className:"mk-props-list"},hu.default.createElement("div",{className:"mk-space-editor-smart"},t?.filters?.length>0&&hu.default.createElement(E2,{superstate:e.superstate,filters:t.filters??[],setFilters:n,removeable:!0,fields:o,sections:s,linkProps:e.space.propertyTypes}),hu.default.createElement("button",{className:"mk-filter-add","aria-label":H.buttons.addSmartSearch,onClick:l=>i({...t,filters:[...t.filters??[],{type:"any",trueFalse:!0,filters:[]}]})},hu.default.createElement("div",{className:"mk-icon-xsmall",dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//plus")}}),H.buttons.addSmartSearch))))))};var _a=Ae(Te());var SEe=e=>{let{pathState:t}=(0,_a.useContext)($r),{spaceState:r}=(0,_a.useContext)(ur),[n,i]=(0,_a.useState)(!0),[a,o]=_a.default.useState([]);(0,_a.useEffect)(()=>{s({path:t.path})},[]);let s=c=>{c.path==t?.path&&e.superstate.spaceManager.commandsForSpace(t.path).then(f=>o(f))};(0,_a.useEffect)(()=>(e.superstate.eventsDispatcher.addListener("actionStateUpdated",s),()=>{e.superstate.eventsDispatcher.removeListener("actionStateUpdated",s)}),[t]);let l=c=>{e.superstate.ui.openModal(H.labels.newAction,_a.default.createElement(Ki,{value:"",saveLabel:H.buttons.save,saveValue:f=>{e.superstate.spaceManager.createCommand(r.path,{id:f,name:f,type:"actions"})}}),Ne(c.view.document))},u=(c,f)=>{c.preventDefault();let d=c.target.getBoundingClientRect(),p=[];p.push({name:"Run Action",icon:"lucide//play",onClick:()=>e.superstate.cli.runCommand(TY(r,f.schema.id),{iterations:0,instanceProps:{},props:{}})}),p.push({name:"Delete Action",icon:"ui//trash",onClick:()=>e.superstate.spaceManager.deleteCommand(r.path,f.schema.id)}),e.superstate.ui.openMenu(d,Ht(e.superstate.ui,p),Ne(c.view.document))};return a.length>0?e.compactMode?_a.default.createElement("div",{className:"mk-props-pill",onClick:()=>i(c=>!c)},a.length," Actions"):_a.default.createElement("div",{className:"mk-path-context-row"},_a.default.createElement("div",{className:"mk-path-context-field"},_a.default.createElement("div",{className:"mk-path-context-field-icon",dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//mouse-pointer-click")}}),_a.default.createElement("div",{className:"mk-path-context-field-key"},"Actions")),_a.default.createElement("div",{className:"mk-path-context-value"},_a.default.createElement("div",{className:"mk-props-pill",onClick:()=>i(c=>!c)},a.length," Actions",_a.default.createElement(gh,{superstate:e.superstate,collapsed:n})),!n&&_a.default.createElement("div",{className:"mk-props-list"},a.map((c,f)=>_a.default.createElement("div",{key:f,className:"mk-path",onContextMenu:d=>u(d,c)},_a.default.createElement("div",{className:"mk-path-icon",dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker(Ix(c.schema))}}),_a.default.createElement("div",{onClick:d=>{e.superstate.ui.openPath(TY(r,c.schema.id),d.metaKey)}},c.schema.name)))))):_a.default.createElement(_a.default.Fragment,null)};var Ua=Ae(Te());var EEe=e=>{let[t,r]=(0,Ua.useState)(!0),[n,i]=(0,Ua.useState)(e.space.metadata??{}),a=l=>{i(l),du(e.superstate,e.space.space,l)},o=(0,Ua.useMemo)(()=>(n?.links??[]).map(l=>e.superstate.pathsIndex.get(l)).filter(l=>l),[n]),s=(0,Ua.useMemo)(()=>[...e.superstate.spacesMap.getInverse(e.space.path)].map(l=>e.superstate.pathsIndex.get(l)).filter(l=>l.parent==e.space.path),[e.space]);return(0,Ua.useEffect)(()=>{let l=u=>{if(u.path==e.space.path){let c=e.superstate.spacesIndex.get(e.space.path)?.metadata;c&&i(c)}};return e.superstate.eventsDispatcher.addListener("spaceStateUpdated",l),()=>{e.superstate.eventsDispatcher.removeListener("spaceStateUpdated",l)}},[e.space]),e.compactMode?Ua.default.createElement("div",{className:"mk-props-pill",onClick:()=>r(l=>!l)},Ua.default.createElement("div",{className:"mk-path-context-field-icon",dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//file-stack")}}),o.length+s.length," Items"):Ua.default.createElement("div",{className:"mk-path-context-row"},Ua.default.createElement("div",{className:"mk-path-context-field"},Ua.default.createElement("div",{className:"mk-path-context-field-icon",dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//file-stack")}}),Ua.default.createElement("div",{className:"mk-path-context-field-key","aria-label":H.descriptions.spaceItems},"Items")),Ua.default.createElement("div",{className:"mk-path-context-value"},Ua.default.createElement("div",{className:"mk-props-value"},Ua.default.createElement("div",{className:"mk-props-list"},Ua.default.createElement("div",{className:"mk-props-pill",onClick:()=>r(l=>!l)},o.length+s.length," Items",Ua.default.createElement(gh,{superstate:e.superstate,collapsed:t})),Ua.default.createElement("button",{className:"mk-toolbar-button","aria-label":H.buttons.addSmartSearch,onClick:l=>{let u=[];u.push({name:H.buttons.addSmartSearch,icon:"ui//live",onClick:()=>{a({...n,filters:[...n.filters??[],{type:"any",trueFalse:!0,filters:[]}]})}}),u.push({name:H.buttons.subFolders,icon:"ui//folder",type:6,onSubmenu:(f,d)=>{let p=[];return p.push({name:"Include all items in subfolders",onClick:()=>{a({...n,recursive:"file"})}}),p.push({name:"Include all folders and items in subfolders",onClick:()=>{a({...n,recursive:"all"})}}),p.push({name:"Don't include items in subfolder",onClick:()=>{a({...n,recursive:""})}}),e.superstate.ui.openMenu(f,Ht(e.superstate.ui,p),Ne(l.view.document),null,d)}});let c=l.currentTarget.getBoundingClientRect();e.superstate.ui.openMenu(c,Ht(e.superstate.ui,u),Ne(l.view.document))},dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//plus")}})),!t&&Ua.default.createElement("div",{className:"mk-props-list"},o.map((l,u)=>Ua.default.createElement(oo,{key:u,superstate:e.superstate,path:l.path,source:e.space.path})),s.map((l,u)=>Ua.default.createElement(oo,{key:u,superstate:e.superstate,path:l.path,source:e.space.path}))))))};var lg=Ae(Te()),kEe=e=>{let{setDragNode:t}=(0,lg.useContext)(vh),{spaceInfo:r}=(0,lg.useContext)(ur),n=r.path+e.schema?.id,{attributes:i,listeners:a,setNodeRef:o,transform:s}=Us({id:n,data:{id:n,type:"context",space:r?.path,schema:e.schema?.id}}),l=(0,lg.useRef)(null);return Ca({onDragStart:u=>{u.active.data.current.id==n&&t(lg.default.createElement("div",{dangerouslySetInnerHTML:{__html:l.current.innerHTML}}))}}),lg.default.createElement("div",{className:"mk-path",onClick:u=>e.onClick(u),ref:u=>{o(u),l.current=u},onContextMenu:u=>e.onContextMenu(u),...i,...a},lg.default.createElement("div",{className:"mk-path-icon",dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker(e.schema?.primary=="true"?"ui//layout-list":"ui//table")}}),e.schema?.name)};var Li=Ae(Te());var CEe=e=>{let{pathState:t}=(0,Li.useContext)($r),{spaceState:r}=(0,Li.useContext)(ur),[n,i]=(0,Li.useState)(!0),[a,o]=(0,Li.useState)([]);(0,Li.useEffect)(()=>{s({path:t.path})},[]);let s=c=>{c.path==t?.path&&e.superstate.spaceManager.readAllTables(t?.path)?.then(f=>f?(Object.values(f).map(d=>d.schema)??[]).filter(d=>d.primary!="true"):null).then(f=>{f&&o(f)})};(0,Li.useEffect)(()=>(e.superstate.eventsDispatcher.addListener("contextStateUpdated",s),()=>{e.superstate.eventsDispatcher.removeListener("contextStateUpdated",s)}),[t]);let l=c=>{e.superstate.ui.openModal(H.labels.newTable,Li.default.createElement(Ki,{value:"",saveLabel:H.buttons.save,saveValue:f=>{e.superstate.spaceManager.tablesForSpace(r.path).then(d=>{if(d){let p={id:Mi(eh(f),d.map(h=>h.id)),name:f,type:"db"};return e.superstate.spaceManager.createTable(r.path,p).then(h=>e.superstate.spaceManager.addSpaceProperty(r.path,{...Px[0],schemaId:p.id}))}})}}),Ne(c.view.document))},u=(c,f)=>{let d=[];d.push({name:H.menu.copyEmbedLink,icon:"ui//link",onClick:p=>{navigator.clipboard.writeText(b9(r,f.id))}}),d.push({name:H.menu.moveFile,icon:"ui//move",onClick:p=>{let h=p.target.getBoundingClientRect();Fa(h,Ne(p.view.document),e.superstate,async m=>{let g=await e.superstate.spaceManager.readTable(r.path,f.id),A=await e.superstate.spaceManager.readAllTables(r.path);g.schema.id=Mi(eh(g.schema.id),Object.keys(A)),g.cols=g.cols.map(b=>({...b,schemaId:g.schema.id})),e.superstate.spaceManager.createTable(m,g.schema).then(b=>e.superstate.spaceManager.saveTable(m,g))})}}),d.push({name:H.menu.duplicate,icon:"ui//copy",onClick:p=>{e.superstate.ui.openModal("Duplicate Table",Li.default.createElement(Ki,{value:"",saveLabel:"Save",saveValue:async h=>{let m=await e.superstate.spaceManager.readTable(r.path,f.id),g=await e.superstate.spaceManager.readAllTables(r.path);m.schema.id=Mi(eh(h),Object.keys(g)),m.cols=m.cols.map(A=>({...A,schemaId:m.schema.id})),e.superstate.spaceManager.createTable(r.path,m.schema).then(A=>e.superstate.spaceManager.saveTable(r.path,m)).then(A=>A&&e.superstate.reloadContextByPath(r.path,!0))}}),Ne(p.view.document))}}),d.push({name:H.buttons.renameView,icon:"ui//edit",onClick:p=>{e.superstate.ui.openModal(H.labels.renameView,Li.default.createElement(Ki,{value:f.name,saveLabel:H.labels.renameView,saveValue:h=>{e.superstate.spaceManager.saveTableSchema(t.path,f.id,()=>({...f,name:h}))}}),Ne(p.view.document))}}),d.push({name:H.buttons.delete,icon:"ui//trash",onClick:p=>{e.superstate.spaceManager.deleteTable(t.path,f.id)}}),e.superstate.ui.openMenu(c.target.getBoundingClientRect(),Ht(e.superstate.ui,d),Ne(c.view.document))};return a.length>0?e.compactMode?Li.default.createElement("div",{className:"mk-props-pill",onClick:()=>i(c=>!c)},a.length," Lists"):Li.default.createElement("div",{className:"mk-path-context-row"},Li.default.createElement("div",{className:"mk-path-context-field"},Li.default.createElement("div",{className:"mk-path-context-field-icon",dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//layout-list")}}),Li.default.createElement("div",{className:"mk-path-context-field-key"},"Lists")),Li.default.createElement("div",{className:"mk-props-value"},Li.default.createElement("div",{className:"mk-props-pill",onClick:()=>i(c=>!c)},a.length," Lists",Li.default.createElement(gh,{superstate:e.superstate,collapsed:n})),!n&&Li.default.createElement(Li.default.Fragment,null,Li.default.createElement("div",{className:"mk-props-list"},a.map((c,f)=>Li.default.createElement(kEe,{key:f,superstate:e.superstate,schema:c,onClick:d=>{e.superstate.ui.openPath(rb(r,c.id),d.metaKey)},onContextMenu:d=>{u(d,c)}})),Li.default.createElement("button",{className:"mk-toolbar-button","aria-label":H.labels.newTable,onClick:c=>l(c),dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//plus")}}))))):Li.default.createElement(Li.default.Fragment,null)};var zi=Ae(Te());var DEe=e=>{let{pathState:t}=(0,zi.useContext)($r),{spaceState:r}=(0,zi.useContext)(ur),[n,i]=(0,zi.useState)(!0),[a,o]=zi.default.useState([]);(0,zi.useEffect)(()=>{s({path:t.path})},[]);let s=f=>{f.path==t?.path&&o(e.superstate.spacesIndex.get(r.path)?.templates)};(0,zi.useEffect)(()=>(e.superstate.eventsDispatcher.addListener("spaceStateUpdated",s),()=>{e.superstate.eventsDispatcher.removeListener("spaceStateUpdated",s)}),[t]);let l=f=>{let d=f.target.getBoundingClientRect();jl(d,Ne(f.view.document),e.superstate,p=>{sv(e.superstate,t.path,p)}),f.stopPropagation()},u=(f,d)=>{let p=f.target.getBoundingClientRect(),h=[];h.push({name:"Set as Default",icon:"ui//clipboard-pen",onClick:()=>Tye(e.superstate,t.path,d)}),h.push({name:"Delete",icon:"ui//trash",onClick:()=>e.superstate.spaceManager.deleteTemplate(d,r.path)}),e.superstate.ui.openMenu(p,Ht(e.superstate.ui,h),Ne(f.view.document),"bottom")},c=f=>{let d={superstate:e.superstate,saveFormula:p=>Fye(e.superstate,t.path,p),formula:r.metadata.templateName,value:{},fields:[],description:"Automatically set a template name using a formula",path:t.path};e.superstate.ui.openCustomMenu(f.target.getBoundingClientRect(),zi.default.createElement(Ah,{...d}),{...d},Ne(f.view.document),"bottom")};return a?.length>0?e.compactMode?zi.default.createElement("div",{className:"mk-props-pill",onClick:()=>i(f=>!f)},a.length," Templates"):zi.default.createElement("div",{className:"mk-path-context-row"},zi.default.createElement("div",{className:"mk-path-context-field"},zi.default.createElement("div",{className:"mk-path-context-field-icon",dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//clipboard-pen")}}),zi.default.createElement("div",{className:"mk-path-context-field-key"},"Templates")),zi.default.createElement("div",{className:"mk-path-context-value"},zi.default.createElement("div",{className:"mk-props-pill",onClick:()=>i(f=>!f)},a.length," Templates",zi.default.createElement(gh,{superstate:e.superstate,collapsed:n})),zi.default.createElement("button",{className:"mk-toolbar-button","aria-label":H.labels.editFormula,onClick:f=>c(f),dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//formula")}}),!n&&zi.default.createElement("div",{className:"mk-props-list"},a.map((f,d)=>zi.default.createElement("div",{key:d,className:"mk-path",onContextMenu:p=>u(p,f)},zi.default.createElement("div",{className:"mk-path-icon",dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//clipboard-pen")}}),zi.default.createElement("div",null,f),r.metadata.template==f&&zi.default.createElement("div",{className:"mk-path-icon","aria-label":"Default",dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//check")}}))),zi.default.createElement("button",{className:"mk-toolbar-button","aria-label":H.labels.newAction,onClick:f=>l(f),dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//plus")}})))):zi.default.createElement(zi.default.Fragment,null)};var dr=Ae(Te());var k2=e=>{let[t,r]=(0,dr.useState)(!e.superstate.settings.inlineContextExpanded||!e.collapseSpaces);(0,dr.useEffect)(()=>{e.superstate.settings.inlineContextExpanded=!t,e.superstate.saveSettings()},[t]);let[n,i]=(0,dr.useState)({}),{spaceState:a}=(0,dr.useContext)(ur),{addToSpace:o,readMode:s,removeFromSpace:l,pathState:u}=(0,dr.useContext)($r),c=u.type=="space",f=(I,T)=>{let L=e.superstate.spacesIndex.get(T);if(!L)return;let _=!1;L.type=="tag"&&!(u.metadata?.tags??[]).includes(L.space.name)&&(_=!0),L.type=="folder"&&(u.liveSpaces??[]).includes(T)&&(_=!0),I.preventDefault();let Y=[];Y.push({name:H.menu.openSpace,icon:"ui//layout-grid",onClick:te=>{e.superstate.ui.openPath(L.path,te.metaKey)}}),Y.push({name:H.labels.newProperty,icon:"ui//plus",onClick:te=>{g(te,L.path)}}),l&&!_&&Y.push({name:H.menu.removeFromSpace,icon:"ui//trash",onClick:te=>{l(L.path)}});let oe=I.target.getBoundingClientRect();e.superstate.ui.openMenu(oe,Ht(e.superstate.ui,Y),Ne(I.view.document))},d=I=>[...e.superstate.spacesMap.get(I)].map(T=>e.superstate.spacesIndex.get(T)).filter(T=>T&&T.type!="default"&&T.path!="/").map(T=>e.superstate.pathsIndex.get(T.path)).sort((T,L)=>I.startsWith(T.path)?-1:I.startsWith(L.path)?1:0).filter(T=>T),p=(0,dr.useMemo)(()=>d(u.path),[u]),h=(0,dr.useMemo)(()=>[...e.superstate.spacesMap.get(u?.path)??[]].map(I=>e.superstate.spacesIndex.get(I)?.space).filter(I=>I),[u]),m=(I,T)=>I=="$fm"?(Pye(e.superstate,u.path,T),!0):(e.superstate.spaceManager.addSpaceProperty(I,T),!0),g=(I,T)=>{let L=I.target.getBoundingClientRect();Nf(e.superstate,L,Ne(I.view.document),{spaces:p.map(_=>_.path),fields:[],saveField:(_,Y)=>m(T,Y),schemaId:Er,contextPath:T,fileMetadata:!c})},A=I=>{let T=I.target.getBoundingClientRect();Fa(T,Ne(I.view.document),e.superstate,(L,_)=>{_?L.charAt(0)=="#"?th(e.superstate,u.path,L):kf(e.superstate,L,{links:[u.path]}):o(L)},!1,!0)},b=I=>{e.superstate.ui.openModal(H.labels.newAction,dr.default.createElement(Ki,{value:"",saveLabel:H.buttons.save,saveValue:T=>{e.superstate.spaceManager.createCommand(a.path,{id:T,name:T,type:"actions"})}}),Ne(I.view.document))},v=I=>{e.superstate.ui.openModal(H.labels.newTable,dr.default.createElement(Ki,{value:"",saveLabel:H.buttons.save,saveValue:T=>{e.superstate.spaceManager.tablesForSpace(a.path).then(L=>{if(L){let _={id:Mi(eh(T),L.map(Y=>Y.id)),name:T,type:"db"};return e.superstate.spaceManager.createTable(a.path,_).then(Y=>e.superstate.spaceManager.addSpaceProperty(a.path,{...Px[0],schemaId:_.id}))}})}}),Ne(I.view.document))},x=(I,T)=>jl(I,T,e.superstate,L=>{sv(e.superstate,u.path,L)}),w=I=>{let T=I.target.getBoundingClientRect(),L=Ne(I.view.document);e.superstate.ui.openMenu(T,Ht(e.superstate.ui,[{name:H.labels.newTable,description:H.descriptions.spaceLists,icon:"ui//table",onClick:_=>v(_)},{name:H.labels.template,description:H.descriptions.spaceTemplates,icon:"ui//clipboard-pen",onClick:_=>x(T,L)},{name:H.labels.newAction,description:H.descriptions.spaceActions,icon:"ui//mouse-pointer-click",onClick:_=>b(_)},Rt,{name:"Toggle Read Mode",description:"Toggle read mode for the space",icon:"ui//eye",onClick:_=>{du(e.superstate,a.space,{...a.metadata,readMode:!a.metadata.readMode})}},Rt,{name:"Apply to Items",description:H.descriptions.spaceProperties,icon:"ui//list",type:6,onSubmenu:_=>a9(_,e.superstate,a,L)},Rt,{name:"Reset View",description:"Reset the view to the default settings",icon:"ui//table",onClick:_=>{e.superstate.spaceManager.saveFrame(a.path,e.superstate.spaceManager.superstate.settings.enableFolderNote?oj.main:aw.main)}}]),L)},[S,k]=(0,dr.useState)([]);(0,dr.useEffect)(()=>{j()},[u]),(0,dr.useEffect)(()=>{let I=T=>{![...e.superstate.spacesMap.get(u?.path)??[]].includes(T.path)||j()};return e.superstate.eventsDispatcher.addListener("contextStateUpdated",I),()=>{e.superstate.eventsDispatcher.removeListener("contextStateUpdated",I)}},[u]);let j=async()=>{let I=[...e.superstate.spacesMap.get(u?.path)??[]],T=await Promise.all(I.map(async Q=>e.superstate.spaceManager.readTable(Q,Er).then(fe=>({path:Q,schema:fe.schema,cols:fe.cols,rows:fe.rows})))),L=I.flatMap(Q=>e.superstate.spacesIndex.get(Q)?.contexts),_=S.filter(Q=>Q.property.type.startsWith("context")).map(Q=>pr(Q.property.value,Q.property.type,e.superstate).space).filter(Q=>Q),oe=(await Promise.all([...L,..._].filter(Q=>!I.includes(Q)).map(Q=>e.superstate.spaceManager.readTable(Q,Er).then(fe=>({[Q]:fe}))))).reduce((Q,fe)=>({...Q,...fe}),{});i({...oe,...T.reduce((Q,fe)=>({...Q,[fe.path]:{schema:fe.schema,cols:fe.cols,rows:fe.rows}}),{})});let te=[];T.forEach(Q=>{let fe=Q.rows.find(Ie=>Ie[mt]==u.path);Q.cols.filter(Ie=>Ie.primary!="true").forEach(Ie=>{let Se=te.findIndex(Oe=>Oe.property.name==Ie.name);Se==-1?te.push({property:Ie,contexts:[Q.path],value:fe?.[Ie.name]??""}):te[Se].contexts.push(Q.path)})},[]),k(te)},O=(I,T)=>{pi(e.superstate,u.path,{[T.property.name]:la(T.property.type,I,!0)})},C=(I,T,L)=>{pi(e.superstate,u.path,{[L.property.name]:la(L.property.type,T,!0)}),e.superstate.spaceManager.saveSpaceProperty(L.contexts[0],{...L.property,value:I},L.property)},N=(I,T)=>{let L=I.target.getBoundingClientRect();yh({superstate:e.superstate,field:T.property,rect:L,win:Ne(I.view.document),options:[],fields:S.map(_=>_.property),contextPath:u.path,saveField:_=>{e.superstate.spaceManager.saveSpaceProperty(T.contexts[0],_,T.property)},anchor:"bottom",deleteColumn:_=>{e.superstate.spaceManager.deleteSpaceProperty(T.contexts[0],T.property)},editable:!0})},[D,P]=(0,dr.useTransition)();(0,dr.useEffect)(()=>{P(()=>null)},[]);let q=()=>{P(()=>r(I=>!I))},z=[...d0(e.superstate.settings)];return dr.default.createElement("div",{className:"mk-props-contexts"},!s&&e.collapseSpaces&&dr.default.createElement("div",{style:{position:"relative"}},dr.default.createElement("div",{className:"mk-fold"},dr.default.createElement(Vd,{superstate:e.superstate,collapsed:t,onToggle:I=>q()}))),e.collapseSpaces&&dr.default.createElement("div",{className:"mk-path-context-row"},dr.default.createElement("div",{className:"mk-props-contexts-space-list"},p.map((I,T)=>dr.default.createElement("div",{key:T,className:"mk-props-contexts-space-name",onContextMenu:L=>f(L,I.path),onClick:L=>e.superstate.ui.openPath(I.path,L.metaKey),style:I.label?.color?.length>0?{"--tag-background":I.label?.color,"--tag-color":"var(--color-white)"}:{}},dr.default.createElement("div",{className:"mk-icon-xsmall",dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker(I.label?.sticker)}}),I.name)),dr.default.createElement("div",{className:"mk-props-contexts-space-name",onClick:I=>A(I),style:{opacity:.5}},dr.default.createElement("span",{className:"mk-icon-xsmall",dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//space-add")}}),H.labels.spaces))),(!t||!e.collapseSpaces||D)&&dr.default.createElement("div",{className:"mk-header-space",style:{transition:"all 0.3s ease-in-out",maxHeight:D?"0px":"unset"}},!e.collapseSpaces&&dr.default.createElement("div",{className:"mk-path-context-row"},dr.default.createElement("div",{className:"mk-path-context-field"},dr.default.createElement("div",{className:"mk-path-context-field-icon",dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//file-stack")}}),dr.default.createElement("div",{className:"mk-path-context-field-key"},"Spaces")),dr.default.createElement("div",{className:"mk-path-context-value"},dr.default.createElement("div",{className:"mk-props-value"},dr.default.createElement("div",{className:"mk-props-list"},p.map((I,T)=>dr.default.createElement(oo,{key:T,superstate:e.superstate,path:I.path})))))),c&&a&&dr.default.createElement(dr.default.Fragment,null,dr.default.createElement(EEe,{superstate:e.superstate,space:a,compactMode:!1}),dr.default.createElement(wEe,{superstate:e.superstate,space:a}),dr.default.createElement(CEe,{superstate:e.superstate,compactMode:!1}),dr.default.createElement(DEe,{superstate:e.superstate,compactMode:!1}),dr.default.createElement(SEe,{superstate:e.superstate,compactMode:!1})),S.map((I,T)=>dr.default.createElement(bs,{key:T,superstate:e.superstate,initialValue:I.value,row:u.metadata.property,compactMode:!1,column:{...I.property,table:""},columns:S.map(L=>L.property),editMode:5,updateValue:L=>O(L,I),updateFieldValue:(L,_)=>C(L,_,I),contextTable:n,source:u.path,path:u.path,contexts:I.contexts,propertyMenu:L=>N(L,I),contextPath:I.contexts[0]})),dr.default.createElement(mEe,{superstate:e.superstate,spaces:h.map(I=>I.path),force:!0,compactMode:!1,excludeKeys:[...z,e.superstate.settings.fmKeyAlias],editable:!0}),dr.default.createElement("div",{className:"mk-path-context-row-new"},dr.default.createElement("div",{className:"mk-path-context-new",onClick:I=>g(I,"$fm")},dr.default.createElement("div",{className:"mk-path-context-field-icon",dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//plus")}}),dr.default.createElement("div",{className:"mk-path-context-field-key"},H.labels.newProperty)),c&&dr.default.createElement("div",{className:"mk-path-context-new",onClick:I=>w(I)},dr.default.createElement("div",{className:"mk-path-context-field-icon",dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//options")}})))),z.length>0&&dr.default.createElement("style",null,`${z.map(I=>`.metadata-property[data-property-key="${I}"]`).join(", ")} + }`))};var hu=Ae(Te());var Dv={isEmpty:H.filterTypes.isEmpty,isNotEmpty:H.filterTypes.isNotEmpty,include:H.filterTypes.contains,notInclude:H.filterTypes.notContains,is:H.filterTypes.is,isNot:H.filterTypes.isNot,isLink:H.filterTypes.is,isNotLink:H.filterTypes.isNot,equal:"=",isGreatThan:">",isLessThan:"<",isLessThanOrEqual:"\u2264",isGreatThanOrEqual:"\u2265",dateBefore:H.filterTypes.before,dateAfter:H.filterTypes.after,isSameDate:H.filterTypes.isSameDate,isSameDateAsToday:H.filterTypes.isSameDateAsToday,isExactList:H.filterTypes.is,isAnyInList:H.filterTypes.anyOf,isNoneInList:H.filterTypes.noneOf,isTrue:H.filterTypes.checked,isFalse:H.filterTypes.unchecked};var ki=Ae(Te());var bEe=Ae(Ya());var y9=(e,t,r,n,i,a)=>{if(!!n&&n.type!="text"){if(n.type=="number"){let o=uh("",s=>i(s));r.ui.openMenu(e,{...Ht(r.ui,[o])},t)}else if(n.type=="date")kv(r.ui,e,t,new Date,o=>i(o.toISOString()),0);else if(n.type=="option"){let o=pr(n.value,n.type,r,a)?.options??[];r.ui.openMenu(e,{...Ht(r.ui,o),saveOptions:(s,l)=>{i(l[0])}},t)}else if(n.type=="boolean"){let o=[{name:"Yes",value:"true"},{name:"No",value:"false"}];r.ui.openMenu(e,{...Ht(r.ui,o),saveOptions:(s,l)=>{i(l[0])}},t)}}};var Kt=Ae(Te());var tJe=(e,t)=>e.type=="folder"?`${e.path}/#*${t}`:e.type=="vault"?`/#*${t}`:`${e.path}/#*${t}`,TY=(e,t)=>e.type=="folder"?`${e.path}/#;${t}`:e.type=="vault"?`/#;${t}`:`${e.path}/#;${t}`,rb=(e,t)=>e.type=="folder"?`${e.path}/#^${t}`:e.type=="vault"?`/#^${t}`:`${e.path}/#^${t}`,dD=(e,t)=>`![![${tJe(e,t)}]]`,b9=(e,t)=>`![![${rb(e,t)}]]`;var Ov=Ae(Te());var hEe=e=>{let{dbSchema:t,source:r}=(0,Ov.useContext)(Na),n=u=>{e.superstate.ui.openPalette(Ov.default.createElement(Ta,{ui:e.superstate.ui,selectedSticker:c=>e.superstate.spaceManager.saveTableSchema(r,t.id,()=>({...t,def:JSON.stringify({...or(t?.def)??{},icon:c})}))}),Ne(u.view.document))},i=t?.name,a=u=>{let c=u.target.innerText;c!=i&&e.superstate.spaceManager.saveTableSchema(r,t.id,()=>({...t,name:c}))},o=u=>{u.stopPropagation()},s=u=>{u.stopPropagation()},l=u=>{if(u.stopPropagation(),u.key=="a"&&u.metaKey){u.preventDefault();let c=window.getSelection(),f=document.createRange();f.selectNodeContents(u.target),c.removeAllRanges(),c.addRange(f)}u.key=="Enter"&&(u.target.blur(),u.preventDefault()),u.key=="Escape"&&(u.target.blur(),u.preventDefault())};return Ov.default.createElement("div",{className:"mk-context-title"},Ov.default.createElement("div",{className:"mk-path-icon",onClick:u=>n(u),dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker(UJ(t))}}),Ov.default.createElement("div",{contentEditable:!0,dangerouslySetInnerHTML:{__html:t?.name},onBlur:a,onKeyPress:o,onKeyUp:s,onKeyDown:l}),Ov.default.createElement("button",{className:"mk-toolbar-button",onClick:()=>e.superstate.ui.openPath(rb(e.superstate.spacesIndex.get(r),t.id)),dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//expand")}}))};var AEe=Ae(Te()),gEe=e=>AEe.default.createElement("div",{onClick:t=>e.onSelect(t),onContextMenu:t=>e.onContextMenu(t,e.schema),className:`mk-context ${e.active?"mk-active":""}`},hM(e.schema.name,"Untitled"),e.children);var vEe=Ae(Te()),Vd=e=>vEe.default.createElement("button",{className:`mk-collapse ${e.collapsed?"mk-collapsed":""}`,onClick:t=>{!e.onToggle||(t.stopPropagation(),e.onToggle(!e.collapsed,t))},dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//collapse")}});var el=Ae(Te());var yEe=e=>{let{views:t,dbSchema:r,source:n}=(0,el.useContext)(Na),{readMode:i}=(0,el.useContext)($r),{spaceState:a}=(0,el.useContext)(ur),{frameSchema:o,setFrameSchema:s,saveSchema:l,deleteSchema:u}=(0,el.useContext)(ma),c=(m,g)=>{let A=[];A.push({name:H.menu.copyEmbedLink,icon:"ui//link",onClick:b=>{navigator.clipboard.writeText(dD(a,g.id))}}),A.push({name:H.buttons.renameView,icon:"ui//edit",onClick:b=>{e.superstate.ui.openModal(H.labels.renameView,el.default.createElement(Ki,{value:g.name,saveLabel:H.labels.renameView,saveValue:v=>l({...g,name:v})}),Ne(b.view.document))}}),t.length>1&&A.push({name:H.buttons.delete,icon:"ui//trash",onClick:b=>{o.id==g.id&&e.setView&&(t[0].id==g.id?(e.setView(t[1].id),s(t[1])):(e.setView(t[0].id),s(t[0]))),u(g)}}),e.superstate.ui.openMenu(m.target.getBoundingClientRect(),Ht(e.superstate.ui,A),Ne(m.view.document))},f=m=>{s(t.find(g=>g.id==m)),e.setView&&e.setView(m)},d=(0,el.useRef)(null),p=m=>{e.superstate.ui.openModal(H.labels.saveView,el.default.createElement(Ki,{value:"",saveLabel:H.labels.saveView,saveValue:g=>{let A={...o??{name:r.name,def:{db:r.id},type:"view"},id:g.replace(/ /g,"_"),name:g};l(A).then(b=>f(A.id))}}),Ne(m.view.document))},h=m=>{let g=[];(t??[]).forEach(A=>{g.push({name:hM(A.name,"Untitled"),value:A.id,icon:Ix(A),onClick:()=>f(A.id),onMoreOptions:i?null:b=>c(b,A)})}),i||(g.push(Rt),g.push({name:H.menu.newView,icon:"ui//plus",value:"",onClick:A=>p(A)})),e.superstate.ui.openMenu(m.target.getBoundingClientRect(),Ht(e.superstate.ui,g),Ne(m.view.document),"bottom")};return r&&(o?el.default.createElement(el.default.Fragment,null,el.default.createElement("div",{className:"mk-view-selector",ref:d},t.map((m,g)=>el.default.createElement(gEe,{key:g,active:o.id==m.id,superstate:e.superstate,schema:m,onSelect:()=>s(t.find(A=>A.id==m.id)),onContextMenu:c})),el.default.createElement("button",{className:"mk-toolbar-button",onClick:m=>p(m),dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//plus")}}))):el.default.createElement("div",{onClick:m=>h(m),className:"mk-context"},el.default.createElement("div",{className:"mk-path-icon",dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//table")}}),r.name,el.default.createElement(Vd,{collapsed:!1,onToggle:null,superstate:e.superstate})))};var nm=Ae(Te());var x9=e=>{let[t,r]=nm.default.useState(!1),n=()=>{r(!1),e.setSearchString("")},i=nm.default.useRef(null);return(0,nm.useEffect)(()=>{t&&i.current?.focus()},[t]),nm.default.createElement("div",{className:"mk-view-search"},nm.default.createElement("button",{className:"mk-toolbar-button",dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//search")}}),nm.default.createElement(nm.default.Fragment,null,nm.default.createElement("input",{onChange:a=>e.setSearchString(a.target.value),placeholder:H.labels.searchPlaceholder,className:"mk-search-bar",ref:i}),e.closeSearch&&nm.default.createElement("button",{className:"mk-toolbar-button",dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//clear")},onClick:a=>{a.stopPropagation(),n(),e.closeSearch()}})))};var w9=e=>{let{spaceState:t}=(0,Kt.useContext)(ur),{readMode:r}=(0,Kt.useContext)($r),{source:n,dbSchema:i,cols:a,setSearchString:o,setEditMode:s,predicate:l,savePredicate:u,hideColumn:c,delColumn:f,saveColumn:d}=(0,Kt.useContext)(Na),{frameSchema:p,saveSchema:h,setFrameSchema:m}=(0,Kt.useContext)(ma),[g,A]=(0,Kt.useState)(!1),b=t?.propertyTypes??[],v=async(ve,ye)=>{if(ve.view=="table")return[];if(ve.view=="day"||ve.view=="week"||ve.view=="month")return ye!="listView"?[]:[{name:"start",type:"option",value:JSON.stringify({alias:"Start Time Property",source:"$properties"})},{name:"end",type:"option",value:JSON.stringify({alias:"End Time Property",source:"$properties"})},{name:"repeat",type:"option",value:JSON.stringify({alias:"Repeat Property",source:"$properties"})},{name:"startOfDay",type:"number",value:JSON.stringify({alias:"Start of Day"})},{name:"endOfDay",type:"number",value:JSON.stringify({alias:"End of Day"})},{name:"hideHeader",type:"boolean",value:JSON.stringify({alias:"Hide Header"})}];let me=ve?.[ye];if(!me)return[];let ke=e.superstate.spaceManager.uriByString(me);if(ke.authority=="$kit"){let{node:$}=e.superstate.kitFrames.get(ke.ref);return Object.keys($.types).map(ae=>({type:$.types[ae],name:ae,attrs:JSON.stringify($.propsAttrs?.[ae]),schemaId:$.schemaId,value:JSON.stringify($.propsValue?.[ae])})).filter(ae=>!ae.name.startsWith("_"))}return e.superstate.spaceManager.readFrame(ke.path,ke.ref).then($=>$?.cols.filter(ae=>!ae.name.startsWith("_"))??[])},x=a.filter(ve=>ve.hidden!="true"),[w,S]=(0,Kt.useState)(!1),k=ve=>{ve=="table"&&u({view:"table",listView:"",listGroup:"",listItem:""}),ve=="flow"&&u({view:"list",listView:"spaces://$kit/#*listView",listGroup:"spaces://$kit/#*listGroup",listItem:"spaces://$kit/#*flowListItem"}),ve=="list"&&u({view:"list",listView:"spaces://$kit/#*listView",listGroup:"spaces://$kit/#*listGroup",listItem:"spaces://$kit/#*rowItem"}),ve=="details"&&u({view:"list",listView:"spaces://$kit/#*listView",listGroup:"spaces://$kit/#*listGroup",listItem:"spaces://$kit/#*detailItem"}),ve=="board"&&u({view:"list",listView:"spaces://$kit/#*columnView",listGroup:"spaces://$kit/#*columnGroup",listItem:"spaces://$kit/#*cardListItem"}),ve=="cards"&&u({view:"list",listView:"spaces://$kit/#*listView",listGroup:"spaces://$kit/#*gridGroup",listItem:"spaces://$kit/#*cardsListItem"}),ve=="catalog"&&u({view:"list",listView:"spaces://$kit/#*listView",listGroup:"spaces://$kit/#*rowGroup",listItem:"spaces://$kit/#*coverListItem"}),ve=="gallery"&&u({view:"list",listView:"spaces://$kit/#*listView",listGroup:"spaces://$kit/#*masonryGroup",listItem:"spaces://$kit/#*imageListItem"}),ve=="calendar"&&u({view:"list",listView:"spaces://$kit/#*calendarView",listGroup:"spaces://$kit/#*dateGroup",listItem:"spaces://$kit/#*eventItem"})},j=()=>{u({filters:[],sort:[]})},O=()=>{u({colsHidden:[]})},C=(ve,ye)=>{let ke=[...(l??ZC(i)).filters.filter(($,ae)=>ae!=ye)];u({filters:ke})},N={table:{name:H.menu.tableView,icon:"ui//table",view:"table",listView:"",listGroup:"",listItem:""},list:{name:H.menu.listView,icon:"ui//list",view:"list",listView:"spaces://$kit/#*listView",listGroup:"spaces://$kit/#*listGroup",listItem:"spaces://$kit/#*rowItem"},details:{name:H.menu.detailsView,icon:"ui//layout-grid",view:"list",listView:"spaces://$kit/#*listView",listGroup:"spaces://$kit/#*listGroup",listItem:"spaces://$kit/#*detailItem"},board:{name:H.menu.boardView,icon:"ui//square-kanban",view:"list",listView:"spaces://$kit/#*columnView",listGroup:"spaces://$kit/#*columnGroup",listItem:"spaces://$kit/#*cardListItem"},cards:{name:H.menu.cardView,icon:"ui//layout-dashboard",view:"list",listView:"spaces://$kit/#*listView",listGroup:"spaces://$kit/#*gridGroup",listItem:"spaces://$kit/#*cardsListItem"},catalog:{name:H.menu.catalogView,icon:"ui//gallery-horizontal-end",view:"list",listView:"spaces://$kit/#*listView",listGroup:"spaces://$kit/#*rowGroup",listItem:"spaces://$kit/#*coverListItem"},gallery:{name:H.menu.galleryView,icon:"ui//layout-dashboard",view:"list",listView:"spaces://$kit/#*listView",listGroup:"spaces://$kit/#*masonryGroup",listItem:"spaces://$kit/#*imageListItem"},flow:{name:H.menu.flowView,icon:"ui//edit",view:"list",listView:"spaces://$kit/#*listView",listGroup:"spaces://$kit/#*listGroup",listItem:"spaces://$kit/#*flowListItem"},day:{name:"Day View",icon:"ui//calendar",view:"day",listView:"",listGroup:"",listItem:""},week:{name:"Week View",icon:"ui//calendar",view:"week",listView:"",listGroup:"",listItem:""},month:{name:"Month View",icon:"ui//calendar",view:"month",listView:"",listGroup:"",listItem:""}},D=ve=>{let ye=ve.target.getBoundingClientRect(),me=[];return Object.keys(N).forEach(ke=>{let $=N[ke];me.push({name:$.name,icon:$.icon,onClick:ae=>{u({view:$.view,listView:$.listView,listGroup:$.listGroup,listItem:$.listItem})}})}),e.superstate.settings.experimental&&me.push({name:H.menu.customView,icon:"ui//brush",onClick:ke=>{s(3)}}),e.superstate.ui.openMenu(ye,Ht(e.superstate.ui,me),Ne(ve.view.document))},P=(ve,ye)=>Fa(ve,ye,e.superstate,me=>{let ke={...p,name:p.name,def:{db:i.id,context:me},type:"view"};h(ke).then($=>m(ke))}),q=async ve=>{let ye=[];if(r||(ye.push(uh(p.name??"",U=>h({...p,name:U}))),ye.push(Rt),ye.push({name:H.menu.properties,icon:"ui//list",type:6,onSubmenu:(U,R)=>Ie(U,Ne(ve.view.document),R)})),ye.push({name:H.menu.groupBy,icon:"ui//columns",type:6,onSubmenu:(U,R)=>Se(U,Ne(ve.view.document),R)}),ye.push({name:H.menu.sortBy,icon:"ui//sort-desc",type:6,onSubmenu:(U,R)=>te(U,Ne(ve.view.document),R)}),ye.push({name:H.menu.filters,icon:"ui//filter",type:6,onSubmenu:(U,R)=>oe(U,Ne(ve.view.document),R)}),ye.push(Rt),i?.primary=="true"){let U=e.superstate.spacesIndex.get(n);ye.push({name:"Source",icon:"ui//table",type:1,value:U.name,onSubmenu:(R,J)=>P(R,Ne(ve.view.document))}),ye.push(Rt)}let me=await v(l,"listView"),ke=await v(l,"listGroup"),$=await v(l,"listItem"),ae=(U,R,J)=>{u({[U]:{...l[U],[R]:J}})};me.forEach(U=>{ye.push({name:Vo(U,e.superstate),icon:Ii(U),type:1,onClick:R=>{y9(R.target.getBoundingClientRect(),Ne(R.view.document),e.superstate,U,J=>ae("listViewProps",U.name,la(U.type,J,!0)),t.path)}})}),ke.forEach(U=>{ye.push({name:Vo(U,e.superstate),icon:Ii(U),type:1,onClick:R=>{y9(R.target.getBoundingClientRect(),Ne(R.view.document),e.superstate,U,J=>ae("listGroupProps",U.name,la(U.type,J,!0)),t.path)}})}),$.forEach(U=>{ye.push({name:Vo(U,e.superstate),icon:Ii(U),type:1,onClick:R=>{y9(R.target.getBoundingClientRect(),Ne(R.view.document),e.superstate,U,J=>ae("listItemProps",U.name,la(U.type,J,!0)),t.path)}})});let ce=ve.target.getBoundingClientRect();e.superstate.ui.openMenu(ce,Ht(e.superstate.ui,ye),Ne(ve.view.document))},z=(ve,ye)=>{let me=ye[0],ke=x.find(ae=>ae.name+ae.table==me),$=ho(ke);if($){let ae=GQ($,Zp),ce={field:me,fn:ae};u({sort:[...l?.sort.filter(U=>U.field!=ce.field)??[],ce]})}},I=(ve,ye)=>{u({groupBy:ye})},T=ve=>{let ye=[...(l?.sort??[]).filter(me=>me.field!=ve.field)];u({sort:ye})},L=ve=>{let ye=x.find(ke=>ke.name+ke.table==ve),me=ho(ye);if(me){let ke=GQ(me,qi);if(!ke)return;let $=me=="boolean"?{field:ve,fn:ke,fType:qi[ke].valueType,value:"true"}:{field:ve,fn:ke,fType:qi[ke].valueType,value:""};u({filters:[...l?.filters??[],$]})}},_=(ve,ye)=>{let me=ve.target.getBoundingClientRect(),ke=(U,R)=>{let J=R[0],ee={...ye,fn:J};u({sort:[...(l?.sort??[]).filter(ie=>ie.field!=ee.field),ee]})},$=x.find(U=>U.name+U.table==ye.field),ae=ho($),ce=m2(ae,Zp);e.superstate.ui.openMenu(me,{ui:e.superstate.ui,multi:!1,editable:!1,value:[],options:ce.map(U=>({name:Zp[U].label,value:U})),saveOptions:ke,placeholder:H.labels.sortItemSelectPlaceholder,searchable:!1,showAll:!0},Ne(ve.view.document))},Y=(ve,ye,me)=>{let ke=ve.target.getBoundingClientRect(),$=(R,J)=>{let ee=J[0],ie={...ye,fn:ee,fType:qi[ee].valueType};u({filters:(l?.filters??[]).map((re,Ee)=>Ee==me?ie:re)})},ae=x.find(R=>R.name+R.table==ye.field),ce=ho(ae),U=m2(ce,qi);e.superstate.ui.openMenu(ke,{ui:e.superstate.ui,multi:!1,editable:!1,value:[],options:U.map(R=>({name:Dv[R],value:R})),saveOptions:$,placeholder:H.labels.filterItemSelectPlaceholder,searchable:!1,showAll:!0},Ne(ve.view.document))},oe=(ve,ye,me)=>{let ke=x.filter($=>$.type=="fileprop"||m2($.type,qi).length>0).map($=>({name:$.name+$.table,value:$.name+$.table,icon:Ii($),onClick:ae=>{L($.name+$.table)}}));return ke.push(Rt),ke.push({name:H.menu.clearFilters,icon:"ui//x-square",onClick:$=>{j()}}),e.superstate.ui.openMenu(ve,{ui:e.superstate.ui,multi:!1,editable:!1,value:[],options:ke,placeholder:H.labels.propertyItemSelectPlaceholder,searchable:!0,showAll:!0},ye,null,me)},te=(ve,ye,me)=>e.superstate.ui.openMenu(ve,{ui:e.superstate.ui,multi:!1,editable:!1,value:[],options:x.map(ke=>({name:ke.name+ke.table,icon:Ii(ke),value:ke.name+ke.table})),saveOptions:z,placeholder:H.labels.sortItemSelectPlaceholder,searchable:!0,showAll:!0},ye,"right",me),Q=(ve,ye)=>{if(ve.name.length>0&&(ve.name!=ye.name||ve.type!=ye.type||ve.value!=ye.value||ve.attrs!=ye.attrs)){let me=d(ve,ye)}},fe=(ve,ye)=>d({...ye,table:""}),Ie=(ve,ye,me)=>{let ke=(ae,ce,U)=>yh({superstate:e.superstate,rect:ce,editable:ae.primary!="true",win:ye,options:[],field:ae,fields:x,contextPath:t.path,saveField:R=>Q(R,ae),hide:c,deleteColumn:f,hidden:l?.colsHidden.includes(ae.name+ae.table)},U,!0),$=[];return $.push({name:H.labels.newProperty,icon:"ui//plus",type:6,onSubmenu:(ae,ce)=>Nf(e.superstate,ae,ye,{spaces:[],fields:[],saveField:fe,schemaId:i.id,contextPath:t.path},ce)}),$.push(Rt),$.push(...x.filter(ae=>l.colsHidden.some(ce=>ce==ae.name+ae.table)==!1).map(ae=>({name:ae.name+ae.table,icon:Ii(ae),value:ae.name+ae.table,type:6,onSubmenu:(ce,U)=>ke(ae,ce,U)}))),$.push(Rt),$.push(...x.filter(ae=>l.colsHidden.some(ce=>ce==ae.name+ae.table)).map(ae=>({name:ae.name+ae.table,icon:Ii(ae),value:ae.name+ae.table,type:6,onSubmenu:(ce,U)=>ke(ae,ce,U)}))),$.push(Rt),$.push({name:H.menu.unhideFields,icon:"ui//eye",onClick:ae=>{O()}}),e.superstate.ui.openMenu(ve,{ui:e.superstate.ui,multi:!1,editable:!1,value:[],options:$,placeholder:H.labels.propertyItemSelectPlaceholder,searchable:!1,showAll:!0},ye,"right",me)},Se=(ve,ye,me)=>e.superstate.ui.openMenu(ve,{ui:e.superstate.ui,multi:!1,editable:!1,value:[],options:x.map(ke=>({name:ke.name+ke.table,icon:Ii(ke),value:ke.name+ke.table})),saveOptions:I,placeholder:H.labels.propertyItemSelectPlaceholder,searchable:!1,showAll:!0},ye,"right",me),Oe=(ve,ye,me)=>{switch(ye.fType??qi[ye.fn].valueType){case"property":u({filters:(l?.filters??[]).map((ke,$)=>$==me?ye:ke)});break;case"text":case"number":u({filters:(l?.filters??[]).map((ke,$)=>$==me?ye:ke)});break;case"date":{let ke=ce=>{let U={...ye,value:ce?_r(e.superstate,ce):""};u({filters:(l?.filters??[]).map((R,J)=>J==me?U:R)})},$=ve.target.getBoundingClientRect(),ae=new Date(ye.value);kv(e.superstate.ui,$,Ne(ve.view.document),ae.getTime()?ae:null,ke,0);break}case"link":{let ke=a.find(ce=>ce.name+ce.table==ye.field);if(ke?.type.startsWith("context")){let ce=pr(ke.value,ke.type)?.space;if(!ce)return;let U=e.superstate.getSpaceItems(ce)??[],R=ve.target.getBoundingClientRect();e.superstate.ui.openMenu(R,{ui:e.superstate.ui,multi:!1,editable:!1,value:sr(ye.value),options:U.map(J=>({name:J.name,value:J.path}))??[],saveOptions:(J,ee)=>{let ie={...ye,value:ee[0]};u({filters:(l?.filters??[]).map((re,Ee)=>Ee==me?ie:re)})},placeholder:H.labels.optionItemSelectPlaceholder,searchable:!0,showAll:!0},Ne(ve.view.document));return}let $=ce=>{let U={...ye,value:ce};u({filters:(l?.filters??[]).map((R,J)=>J==me?U:R)})},ae=ve.target.getBoundingClientRect();jl(ae,Ne(ve.view.document),e.superstate,ce=>{$(ce)},{multi:!0}),ve.stopPropagation()}break;case"list":{let ke=a.find(ae=>ae.name+ae.table==ye.field),$=(ae,ce)=>{let U={...ye,value:Bi(ce)};u({filters:(l?.filters??[]).map((R,J)=>J==me?U:R)})};if(ke.type.startsWith("option")){let ae=ve.target.getBoundingClientRect(),ce=pr(ke.value,ke.type).options;e.superstate.ui.openMenu(ae,{ui:e.superstate.ui,multi:!0,editable:!1,value:sr(ye.value),options:ce??[],saveOptions:$,placeholder:H.labels.optionItemSelectPlaceholder,searchable:!0,showAll:!0},Ne(ve.view.document))}else if(ke.type.startsWith("context")){let ae=pr(ke.value,ke.type)?.space;if(!ae)return;let ce=e.superstate.getSpaceItems(ae)??[],U=ve.target.getBoundingClientRect();e.superstate.ui.openMenu(U,{ui:e.superstate.ui,multi:!0,editable:!1,value:sr(ye.value),options:ce.map(R=>({name:R.name,value:R.path}))??[],saveOptions:$,placeholder:H.labels.optionItemSelectPlaceholder,searchable:!0,showAll:!0},Ne(ve.view.document))}else if(ke.type.startsWith("link")){let ae=ve.target.getBoundingClientRect();jl(ae,Ne(ve.view.document),e.superstate,ce=>{$([ce],[ce])},{multi:!0}),ve.stopPropagation()}else if(ke.type.startsWith("tags")){let ae=e.superstate.spaceManager.readTags(),ce=ve.target.getBoundingClientRect();e.superstate.ui.openMenu(ce,{ui:e.superstate.ui,multi:!0,editable:!1,value:sr(ye.value),options:ae.map(U=>({name:U,value:U}))??[],saveOptions:$,placeholder:H.labels.tagItemSelectPlaceholder,searchable:!0,showAll:!0},Ne(ve.view.document))}}break}};return Kt.default.createElement(Kt.default.Fragment,null,e.minMode?Kt.default.createElement("div",{className:"mk-view-config"},Kt.default.createElement(x9,{superstate:e.superstate,setSearchString:o,closeSearch:()=>A(!1)}),Kt.default.createElement("button",{className:"mk-toolbar-button",onClick:ve=>{let ye=ve.target.getBoundingClientRect();te(ye,Ne(ve.view.document),null)},dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//sort-desc")}}),Kt.default.createElement("button",{className:"mk-toolbar-button",onClick:ve=>{let ye=ve.target.getBoundingClientRect();oe(ye,Ne(ve.view.document),null)},dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//filter")}})):Kt.default.createElement(Kt.default.Fragment,null,e.showTitle&&Kt.default.createElement("div",{className:"mk-context-config"},Kt.default.createElement(hEe,{superstate:e.superstate}),Kt.default.createElement("span",null),i?.id==Er&&!t.space.readOnly&&Kt.default.createElement(Kt.default.Fragment,null,Kt.default.createElement("button",{className:"mk-button-new",onClick:ve=>s9(e.superstate,ve.target.getBoundingClientRect(),Ne(ve.view.document),t,!0),dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//plus")}}))),Kt.default.createElement("div",{className:"mk-view-config"},!w&&Kt.default.createElement(yEe,{superstate:e.superstate,expanded:!1,setView:e.setView}),Kt.default.createElement("div",{className:"mk-view-options"},Kt.default.createElement("span",null),(jc(e.superstate.ui)||!g)&&Kt.default.createElement("button",{className:(0,bEe.default)("mk-toolbar-button",g&&"mk-active"),onClick:ve=>{ve.stopPropagation(),A(ye=>!ye)},dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//search")}}),!jc(e.superstate.ui)&&g&&Kt.default.createElement(x9,{superstate:e.superstate,setSearchString:o,closeSearch:()=>A(!1)}),Kt.default.createElement("button",{className:"mk-toolbar-button",onClick:ve=>D(ve),dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//layout")}}),Kt.default.createElement("button",{className:"mk-toolbar-button",onClick:ve=>q(ve),dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//view-options")}}))),jc(e.superstate.ui)&&g&&Kt.default.createElement(x9,{superstate:e.superstate,setSearchString:o})),(l?.filters.length>0||l?.sort.length>0||l?.groupBy.length>0)&&Kt.default.createElement("div",{className:"mk-filter-bar"},l.groupBy.length>0&&Kt.default.createElement("div",{className:"mk-filter"},Kt.default.createElement("span",null,H.menu.groupBy),Kt.default.createElement("span",{onClick:ve=>Se(ve.target.getBoundingClientRect(),Ne(ve.view.document),null)},l.groupBy[0]),Kt.default.createElement("div",{onClick:()=>I(null,[]),dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//close")}})),(l?.sort??[]).map((ve,ye)=>Kt.default.createElement("div",{key:ye,className:"mk-filter"},Kt.default.createElement("span",null,ve.field),Kt.default.createElement("span",{onClick:me=>_(me,ve)},Zp[ve.fn].label),Kt.default.createElement("div",{onClick:()=>T(ve),dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//close")}}))),(l?.filters??[]??[]).map((ve,ye)=>Kt.default.createElement("div",{key:ye,className:"mk-filter"},Kt.default.createElement("span",null,ve.field),Kt.default.createElement("span",{onClick:me=>Y(me,ve,ye)},Dv[ve.fn]),Kt.default.createElement(FY,{superstate:e.superstate,fieldType:a.find(me=>me.name+me.table==ve.field)?.type,filter:ve,selectFilterValue:(me,ke)=>Oe(me,ke,ye)}),b.length>0&&Kt.default.createElement("span",{onClick:me=>{me.stopPropagation(),e.superstate.ui.openMenu(me.currentTarget.getBoundingClientRect(),{ui:e.superstate.ui,multi:!1,editable:!1,value:[],options:b.map(ke=>({name:ke.name,value:ke.name,section:ke.type})),saveOptions:(ke,$)=>Oe(me,{...ve,fType:"property",value:$[0]},ye),placeholder:H.labels.contextItemSelectPlaceholder,searchable:!0,showAll:!0,sections:[],showSections:!1},Ne(me.view.document))}},Kt.default.createElement("div",{className:"mk-icon-xsmall",dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//plug")}})),Kt.default.createElement("div",{onClick:()=>C(ve,ye),dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//close")}}))),(l?.filters??[]).length>0&&Kt.default.createElement("div",{className:"mk-filter-add",onClick:ve=>{let ye=ve.target.getBoundingClientRect();oe(ye,Ne(ve.view.document),null)}},Kt.default.createElement("span",null,Kt.default.createElement("span",{className:"mk-icon-xsmall",dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//plus")}}),H.buttons.addFilter)),Kt.default.createElement("span",null)))},FY=e=>{let{filter:t,selectFilterValue:r,fieldType:n}=e,i=qi[t.fn],[a,o]=(0,Kt.useState)(t.value);if((0,Kt.useEffect)(()=>o(t.value),[t.value]),t.fType=="property")return Kt.default.createElement("span",null,t.value);if(!n||!i||i.valueType=="none")return Kt.default.createElement(Kt.default.Fragment,null);if(i.valueType=="text"||i.valueType=="number")return Kt.default.createElement("input",{type:"text",onChange:s=>o(s.currentTarget.value),onBlur:s=>{r(null,{...t,value:a})},onKeyDown:s=>{s.key=="Escape"&&(o(t.value),s.currentTarget.blur()),s.key=="Enter"&&s.currentTarget.blur()},value:a});if(n.startsWith("option")||n.startsWith("context")||n.startsWith("link")||n.startsWith("tag")){let s=sr(t.value);return Kt.default.createElement("span",{onClick:l=>r(l,t)},s.length==0?H.labels.select:s.map((l,u)=>n.startsWith("option")?Kt.default.createElement("span",{key:u},l):Kt.default.createElement(oo,{superstate:e.superstate,key:u,path:l})))}else if(!t.value||t.value.length==0)return Kt.default.createElement("span",{onClick:s=>r(s,t)},H.labels.select);return Kt.default.createElement("span",{onClick:s=>r(s,t)},t.value)};var E2=e=>{(0,ki.useEffect)(()=>{e.superstate.refreshMetadata()},[]);let{filters:t,setFilters:r}=e,n=(h,m,g,A)=>{let b=v=>{l(v,g,A)};if(m.fType=="property"){r(t.map((v,x)=>g==x?{...v,filters:v.filters.map((w,S)=>A==S?{...w,fType:"property",value:m.value}:w)}:v));return}switch(qi[m.fn]?.valueType){case"text":case"number":b(m.value);break;case"date":{let v=S=>{b(Za(S,"yyyy-MM-dd"))},x=h.target.getBoundingClientRect(),w=new Date(m.value);kv(e.superstate.ui,x,Ne(h.view.document),w.getTime()?w:null,v,0);break}case"link":{let v=w=>{b(w)},x=h.target.getBoundingClientRect();jl(x,Ne(h.view.document),e.superstate,v),h.stopPropagation();break}case"space":{let v=w=>{b(w)},x=h.target.getBoundingClientRect();Fa(x,Ne(h.view.document),e.superstate,v);break}case"list":{let v=m.fType,x=(k,j)=>{b(Bi(j))},w=[];v.startsWith("option")?w=sr(m.value).map(k=>({name:k,value:k})):v.startsWith("tags")?w=e.superstate.spaceManager.readTags().map(k=>({value:k,name:k})):v.startsWith("link")&&(w=e.superstate.spaceManager.allPaths().map(k=>({name:Lx(k),value:k,description:k})));let S=h.target.getBoundingClientRect();e.superstate.ui.openMenu(S,{ui:e.superstate.ui,multi:!0,editable:!0,value:sr(m.value),options:w,saveOptions:x,placeholder:H.labels.optionItemSelectPlaceholder,searchable:!1,showAll:!0},Ne(h.view.document))}break}},i=()=>{r(h=>[...h,{type:"any",trueFalse:!0,filters:[]}])},a=h=>{r(t.filter((m,g)=>g!=h))},o=(h,m,g)=>{if(!!h){if(t.length==0){r([{type:"all",trueFalse:!0,filters:[{type:h.type,field:h.field,fType:h.vType,fn:h.defaultFilter,value:""}]}]);return}if(t[m]?.filters.length==0){r(t.map((A,b)=>b==m?{...A,filters:[{type:h.type,field:h.field,fType:h.vType,fn:h.defaultFilter,value:""}]}:A));return}r(t.map((A,b)=>b==m?{...A,filters:!A.filters||g==A.filters.length?[...A.filters??[],{type:h.type,field:h.field,fType:h.vType,fn:h.defaultFilter,value:""}]:A.filters.map((v,x)=>x==g?{...v,type:h.type,field:h.field,fType:h.vType,fn:h.defaultFilter}:v)}:A))}},s=(h,m,g)=>{r(t.map((A,b)=>b==m?{...A,filters:A.filters.map((v,x)=>x==g?{...v,fn:h}:v)}:A))},l=(h,m,g)=>{r(t.map((A,b)=>b==m?{...A,filters:A.filters.map((v,x)=>x==g?{...v,value:h}:v)}:A))},u=(h,m)=>{r(t.map((g,A)=>A==m?{...g,filters:g.filters.filter((b,v)=>v!=h)}:g))},c=(h,m)=>{h==0&&t.length==0?r([{type:m,trueFalse:!0,filters:[]}]):r(t.map((g,A)=>A==h?{...g,type:m}:g))},f=(h,m)=>{let g=h.target.getBoundingClientRect(),A=["any","all"];e.superstate.ui.openMenu(g,{ui:e.superstate.ui,multi:!1,editable:!1,value:[],options:A.map(b=>({name:b=="any"?"or":"and",value:b})),saveOptions:(b,v)=>c(m,v[0]),searchable:!1,showAll:!0},Ne(h.view.document))},d=(h,m,g)=>{let A=h.target.getBoundingClientRect(),{type:b,field:v,fType:x}=t[m].filters[g],w=x=="any"?ZSe(qi):m2(x,qi);e.superstate.ui.openMenu(A,{ui:e.superstate.ui,multi:!1,editable:!0,value:[],options:w.map(S=>({name:Dv[S],value:S})),saveOptions:(S,k)=>s(k[0],m,g),placeholder:H.labels.contextItemSelectPlaceholder,searchable:!0,showAll:!0},Ne(h.view.document))},p=async(h,m,g)=>{let A=h.target.getBoundingClientRect();e.superstate.ui.openMenu(A,{ui:e.superstate.ui,multi:!1,editable:!1,value:[],options:e.fields.map(b=>({name:b.label,value:b,section:b.type,description:b.description})),saveOptions:(b,v)=>o(v[0],m,g),placeholder:H.labels.contextItemSelectPlaceholder,searchable:!0,showAll:!0,sections:e.sections,showSections:!0},Ne(h.view.document))};return ki.default.createElement("div",{className:"mk-query"},t.length==0?ki.default.createElement(xEe,{superstate:e.superstate,selectGroupType:f,group:null,addDefGroup:i,selectField:p,i:0,removeable:e.removeable,removeDefGroup:a}):t.map((h,m)=>ki.default.createElement(xEe,{superstate:e.superstate,key:m,group:h,selectGroupType:f,addDefGroup:i,selectField:p,removeable:e.removeable,i:m,removeDefGroup:a},h.filters.map((g,A,b)=>ki.default.createElement(ki.default.Fragment,{key:A},ki.default.createElement(rJe,{superstate:e.superstate,key:A,filter:g,i:m,k:A,selectField:p,selectFilter:d,selectFilterValue:n,removeDefFilter:u,linkProps:e.linkProps}),A!=b.length-1&&ki.default.createElement("div",{className:"mk-filter",onClick:v=>f(v,m)},ki.default.createElement("span",null,h.type=="any"?"or":"and")))))))},rJe=e=>{let{filter:t,selectField:r,selectFilter:n,selectFilterValue:i,removeDefFilter:a,i:o,k:s}=e,l=e.superstate.allMetadata[t.type]?.properties.find(u=>u.field==t.field)?.label??t.field;return ki.default.createElement("div",{className:"mk-filter"},ki.default.createElement("span",{onClick:u=>r(u,o,s)},t.field.length==0?H.labels.select:l),t.field.length>0&&ki.default.createElement("span",{onClick:u=>n(u,o,s)},Dv[t.fn]?Dv[t.fn]:H.labels.select),t.field.length>0&&Dv[t.fn]&&qi[t.fn]?.valueType!="none"&&ki.default.createElement(ki.default.Fragment,null,ki.default.createElement("span",null,ki.default.createElement(FY,{superstate:e.superstate,fieldType:t.fType,filter:t,selectFilterValue:(u,c)=>i(u,c,o,s)})),e.linkProps&&e.linkProps.length>0&&ki.default.createElement("span",{onClick:u=>{u.stopPropagation(),e.superstate.ui.openMenu(u.currentTarget.getBoundingClientRect(),{ui:e.superstate.ui,multi:!1,editable:!1,value:[],options:e.linkProps.map(c=>({name:c.name,value:c.name,section:c.type})),saveOptions:(c,f)=>i(u,{...t,fType:"property",value:f[0]},o,s),placeholder:H.labels.contextItemSelectPlaceholder,searchable:!0,showAll:!0,sections:[],showSections:!1},Ne(u.view.document))}},ki.default.createElement("div",{className:"mk-icon-xsmall",dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//plug")}}))),ki.default.createElement("span",{onClick:u=>{a(s,o),u.stopPropagation()}},ki.default.createElement("div",{className:"mk-icon-xsmall",dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//close")}})))},xEe=e=>{let{group:t,selectGroupType:r,addDefGroup:n,selectField:i,i:a,removeDefGroup:o}=e;return ki.default.createElement("div",{className:"mk-query-group"},ki.default.createElement("div",{className:"mk-filter-bar mk-query-filters"},e.children,ki.default.createElement("div",{className:"mk-filter-add",onClick:s=>i(s,a,t?.filters.length??0)},ki.default.createElement("span",null,ki.default.createElement("span",{className:"mk-icon-xsmall",dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//plus")}}),H.buttons.addCondition))),e.removeable&&ki.default.createElement("div",{className:"mk-filter-add",onClick:s=>{o(a),s.stopPropagation()}},ki.default.createElement("span",null,ki.default.createElement("span",{className:"mk-icon-small",dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//close")}}))))};var wEe=e=>{let[t,r]=(0,hu.useState)(e.space.metadata??{}),n=l=>{i({...t,filters:l})},i=l=>{r(l),du(e.superstate,e.space.space,l)},a=e.superstate.allMetadata,o=[];Object.keys(a).forEach(l=>{a[l].properties.forEach(u=>{o.push(u)})});let s=Object.keys(a).map(l=>({name:a[l].name,value:l}));return(0,hu.useEffect)(()=>{let l=u=>{if(u.path==e.space.path){let c=e.superstate.spacesIndex.get(e.space.path)?.metadata;c&&r(c)}};return e.superstate.eventsDispatcher.addListener("spaceStateUpdated",l),()=>{e.superstate.eventsDispatcher.removeListener("spaceStateUpdated",l)}},[e.space]),t?.filters?.length>0&&hu.default.createElement("div",{className:"mk-path-context-row"},hu.default.createElement("div",{className:"mk-path-context-field"},hu.default.createElement("div",{className:"mk-path-context-field-icon",dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//live")}}),hu.default.createElement("div",{className:"mk-path-context-field-key"},H.subViews.smartSearch)),hu.default.createElement("div",{className:"mk-path-context-value"},hu.default.createElement("div",{className:"mk-props-value"},hu.default.createElement("div",{className:"mk-props-list"},hu.default.createElement("div",{className:"mk-space-editor-smart"},t?.filters?.length>0&&hu.default.createElement(E2,{superstate:e.superstate,filters:t.filters??[],setFilters:n,removeable:!0,fields:o,sections:s,linkProps:e.space.propertyTypes}),hu.default.createElement("button",{className:"mk-filter-add","aria-label":H.buttons.addSmartSearch,onClick:l=>i({...t,filters:[...t.filters??[],{type:"any",trueFalse:!0,filters:[]}]})},hu.default.createElement("div",{className:"mk-icon-xsmall",dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//plus")}}),H.buttons.addSmartSearch))))))};var _a=Ae(Te());var SEe=e=>{let{pathState:t}=(0,_a.useContext)($r),{spaceState:r}=(0,_a.useContext)(ur),[n,i]=(0,_a.useState)(!0),[a,o]=_a.default.useState([]);(0,_a.useEffect)(()=>{s({path:t.path})},[]);let s=c=>{c.path==t?.path&&e.superstate.spaceManager.commandsForSpace(t.path).then(f=>o(f))};(0,_a.useEffect)(()=>(e.superstate.eventsDispatcher.addListener("actionStateUpdated",s),()=>{e.superstate.eventsDispatcher.removeListener("actionStateUpdated",s)}),[t]);let l=c=>{e.superstate.ui.openModal(H.labels.newAction,_a.default.createElement(Ki,{value:"",saveLabel:H.buttons.save,saveValue:f=>{e.superstate.spaceManager.createCommand(r.path,{id:f,name:f,type:"actions"})}}),Ne(c.view.document))},u=(c,f)=>{c.preventDefault();let d=c.target.getBoundingClientRect(),p=[];p.push({name:"Run Action",icon:"lucide//play",onClick:()=>e.superstate.cli.runCommand(TY(r,f.schema.id),{iterations:0,instanceProps:{},props:{}})}),p.push({name:"Delete Action",icon:"ui//trash",onClick:()=>e.superstate.spaceManager.deleteCommand(r.path,f.schema.id)}),e.superstate.ui.openMenu(d,Ht(e.superstate.ui,p),Ne(c.view.document))};return a.length>0?e.compactMode?_a.default.createElement("div",{className:"mk-props-pill",onClick:()=>i(c=>!c)},a.length," Actions"):_a.default.createElement("div",{className:"mk-path-context-row"},_a.default.createElement("div",{className:"mk-path-context-field"},_a.default.createElement("div",{className:"mk-path-context-field-icon",dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//mouse-pointer-click")}}),_a.default.createElement("div",{className:"mk-path-context-field-key"},"Actions")),_a.default.createElement("div",{className:"mk-path-context-value"},_a.default.createElement("div",{className:"mk-props-pill",onClick:()=>i(c=>!c)},a.length," Actions",_a.default.createElement(gh,{superstate:e.superstate,collapsed:n})),!n&&_a.default.createElement("div",{className:"mk-props-list"},a.map((c,f)=>_a.default.createElement("div",{key:f,className:"mk-path",onContextMenu:d=>u(d,c)},_a.default.createElement("div",{className:"mk-path-icon",dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker(Ix(c.schema))}}),_a.default.createElement("div",{onClick:d=>{e.superstate.ui.openPath(TY(r,c.schema.id),d.metaKey)}},c.schema.name)))))):_a.default.createElement(_a.default.Fragment,null)};var Ua=Ae(Te());var EEe=e=>{let[t,r]=(0,Ua.useState)(!0),[n,i]=(0,Ua.useState)(e.space.metadata??{}),a=l=>{i(l),du(e.superstate,e.space.space,l)},o=(0,Ua.useMemo)(()=>(n?.links??[]).map(l=>e.superstate.pathsIndex.get(l)).filter(l=>l),[n]),s=(0,Ua.useMemo)(()=>[...e.superstate.spacesMap.getInverse(e.space.path)].map(l=>e.superstate.pathsIndex.get(l)).filter(l=>l.parent==e.space.path),[e.space]);return(0,Ua.useEffect)(()=>{let l=u=>{if(u.path==e.space.path){let c=e.superstate.spacesIndex.get(e.space.path)?.metadata;c&&i(c)}};return e.superstate.eventsDispatcher.addListener("spaceStateUpdated",l),()=>{e.superstate.eventsDispatcher.removeListener("spaceStateUpdated",l)}},[e.space]),e.compactMode?Ua.default.createElement("div",{className:"mk-props-pill",onClick:()=>r(l=>!l)},Ua.default.createElement("div",{className:"mk-path-context-field-icon",dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//file-stack")}}),o.length+s.length," Items"):Ua.default.createElement("div",{className:"mk-path-context-row"},Ua.default.createElement("div",{className:"mk-path-context-field"},Ua.default.createElement("div",{className:"mk-path-context-field-icon",dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//file-stack")}}),Ua.default.createElement("div",{className:"mk-path-context-field-key","aria-label":H.descriptions.spaceItems},"Items")),Ua.default.createElement("div",{className:"mk-path-context-value"},Ua.default.createElement("div",{className:"mk-props-value"},Ua.default.createElement("div",{className:"mk-props-list"},Ua.default.createElement("div",{className:"mk-props-pill",onClick:()=>r(l=>!l)},o.length+s.length," Items",Ua.default.createElement(gh,{superstate:e.superstate,collapsed:t})),Ua.default.createElement("button",{className:"mk-toolbar-button","aria-label":H.buttons.addSmartSearch,onClick:l=>{let u=[];u.push({name:H.buttons.addSmartSearch,icon:"ui//live",onClick:()=>{a({...n,filters:[...n.filters??[],{type:"any",trueFalse:!0,filters:[]}]})}}),u.push({name:H.buttons.subFolders,icon:"ui//folder",type:6,onSubmenu:(f,d)=>{let p=[];return p.push({name:"Include all items in subfolders",onClick:()=>{a({...n,recursive:"file"})}}),p.push({name:"Include all folders and items in subfolders",onClick:()=>{a({...n,recursive:"all"})}}),p.push({name:"Don't include items in subfolder",onClick:()=>{a({...n,recursive:""})}}),e.superstate.ui.openMenu(f,Ht(e.superstate.ui,p),Ne(l.view.document),null,d)}});let c=l.currentTarget.getBoundingClientRect();e.superstate.ui.openMenu(c,Ht(e.superstate.ui,u),Ne(l.view.document))},dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//plus")}})),!t&&Ua.default.createElement("div",{className:"mk-props-list"},o.map((l,u)=>Ua.default.createElement(oo,{key:u,superstate:e.superstate,path:l.path,source:e.space.path})),s.map((l,u)=>Ua.default.createElement(oo,{key:u,superstate:e.superstate,path:l.path,source:e.space.path}))))))};var lg=Ae(Te()),kEe=e=>{let{setDragNode:t}=(0,lg.useContext)(vh),{spaceInfo:r}=(0,lg.useContext)(ur),n=r.path+e.schema?.id,{attributes:i,listeners:a,setNodeRef:o,transform:s}=Us({id:n,data:{id:n,type:"context",space:r?.path,schema:e.schema?.id}}),l=(0,lg.useRef)(null);return Ca({onDragStart:u=>{u.active.data.current.id==n&&t(lg.default.createElement("div",{dangerouslySetInnerHTML:{__html:l.current.innerHTML}}))}}),lg.default.createElement("div",{className:"mk-path",onClick:u=>e.onClick(u),ref:u=>{o(u),l.current=u},onContextMenu:u=>e.onContextMenu(u),...i,...a},lg.default.createElement("div",{className:"mk-path-icon",dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker(e.schema?.primary=="true"?"ui//layout-list":"ui//table")}}),e.schema?.name)};var Li=Ae(Te());var CEe=e=>{let{pathState:t}=(0,Li.useContext)($r),{spaceState:r}=(0,Li.useContext)(ur),[n,i]=(0,Li.useState)(!0),[a,o]=(0,Li.useState)([]);(0,Li.useEffect)(()=>{s({path:t.path})},[]);let s=c=>{c.path==t?.path&&e.superstate.spaceManager.readAllTables(t?.path)?.then(f=>f?(Object.values(f).map(d=>d.schema)??[]).filter(d=>d.primary!="true"):null).then(f=>{f&&o(f)})};(0,Li.useEffect)(()=>(e.superstate.eventsDispatcher.addListener("contextStateUpdated",s),()=>{e.superstate.eventsDispatcher.removeListener("contextStateUpdated",s)}),[t]);let l=c=>{e.superstate.ui.openModal(H.labels.newTable,Li.default.createElement(Ki,{value:"",saveLabel:H.buttons.save,saveValue:f=>{e.superstate.spaceManager.tablesForSpace(r.path).then(d=>{if(d){let p={id:Mi(eh(f),d.map(h=>h.id)),name:f,type:"db"};return e.superstate.spaceManager.createTable(r.path,p).then(h=>e.superstate.spaceManager.addSpaceProperty(r.path,{...Px[0],schemaId:p.id}))}})}}),Ne(c.view.document))},u=(c,f)=>{let d=[];d.push({name:H.menu.copyEmbedLink,icon:"ui//link",onClick:p=>{navigator.clipboard.writeText(b9(r,f.id))}}),d.push({name:H.menu.moveFile,icon:"ui//move",onClick:p=>{let h=p.target.getBoundingClientRect();Fa(h,Ne(p.view.document),e.superstate,async m=>{let g=await e.superstate.spaceManager.readTable(r.path,f.id),A=await e.superstate.spaceManager.readAllTables(r.path);g.schema.id=Mi(eh(g.schema.id),Object.keys(A)),g.cols=g.cols.map(b=>({...b,schemaId:g.schema.id})),e.superstate.spaceManager.createTable(m,g.schema).then(b=>e.superstate.spaceManager.saveTable(m,g))})}}),d.push({name:H.menu.duplicate,icon:"ui//copy",onClick:p=>{e.superstate.ui.openModal("Duplicate Table",Li.default.createElement(Ki,{value:"",saveLabel:"Save",saveValue:async h=>{let m=await e.superstate.spaceManager.readTable(r.path,f.id),g=await e.superstate.spaceManager.readAllTables(r.path);m.schema.id=Mi(eh(h),Object.keys(g)),m.cols=m.cols.map(A=>({...A,schemaId:m.schema.id})),e.superstate.spaceManager.createTable(r.path,m.schema).then(A=>e.superstate.spaceManager.saveTable(r.path,m)).then(A=>A&&e.superstate.reloadContextByPath(r.path,!0))}}),Ne(p.view.document))}}),d.push({name:H.buttons.renameView,icon:"ui//edit",onClick:p=>{e.superstate.ui.openModal(H.labels.renameView,Li.default.createElement(Ki,{value:f.name,saveLabel:H.labels.renameView,saveValue:h=>{e.superstate.spaceManager.saveTableSchema(t.path,f.id,()=>({...f,name:h}))}}),Ne(p.view.document))}}),d.push({name:H.buttons.delete,icon:"ui//trash",onClick:p=>{e.superstate.spaceManager.deleteTable(t.path,f.id)}}),e.superstate.ui.openMenu(c.target.getBoundingClientRect(),Ht(e.superstate.ui,d),Ne(c.view.document))};return a.length>0?e.compactMode?Li.default.createElement("div",{className:"mk-props-pill",onClick:()=>i(c=>!c)},a.length," Lists"):Li.default.createElement("div",{className:"mk-path-context-row"},Li.default.createElement("div",{className:"mk-path-context-field"},Li.default.createElement("div",{className:"mk-path-context-field-icon",dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//layout-list")}}),Li.default.createElement("div",{className:"mk-path-context-field-key"},"Lists")),Li.default.createElement("div",{className:"mk-props-value"},Li.default.createElement("div",{className:"mk-props-pill",onClick:()=>i(c=>!c)},a.length," Lists",Li.default.createElement(gh,{superstate:e.superstate,collapsed:n})),!n&&Li.default.createElement(Li.default.Fragment,null,Li.default.createElement("div",{className:"mk-props-list"},a.map((c,f)=>Li.default.createElement(kEe,{key:f,superstate:e.superstate,schema:c,onClick:d=>{e.superstate.ui.openPath(rb(r,c.id),d.metaKey)},onContextMenu:d=>{u(d,c)}})),Li.default.createElement("button",{className:"mk-toolbar-button","aria-label":H.labels.newTable,onClick:c=>l(c),dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//plus")}}))))):Li.default.createElement(Li.default.Fragment,null)};var zi=Ae(Te());var DEe=e=>{let{pathState:t}=(0,zi.useContext)($r),{spaceState:r}=(0,zi.useContext)(ur),[n,i]=(0,zi.useState)(!0),[a,o]=zi.default.useState([]);(0,zi.useEffect)(()=>{s({path:t.path})},[]);let s=f=>{f.path==t?.path&&o(e.superstate.spacesIndex.get(r.path)?.templates)};(0,zi.useEffect)(()=>(e.superstate.eventsDispatcher.addListener("spaceStateUpdated",s),()=>{e.superstate.eventsDispatcher.removeListener("spaceStateUpdated",s)}),[t]);let l=f=>{let d=f.target.getBoundingClientRect();jl(d,Ne(f.view.document),e.superstate,p=>{sv(e.superstate,t.path,p)}),f.stopPropagation()},u=(f,d)=>{let p=f.target.getBoundingClientRect(),h=[];h.push({name:"Set as Default",icon:"ui//clipboard-pen",onClick:()=>Tye(e.superstate,t.path,d)}),h.push({name:"Delete",icon:"ui//trash",onClick:()=>e.superstate.spaceManager.deleteTemplate(d,r.path)}),e.superstate.ui.openMenu(p,Ht(e.superstate.ui,h),Ne(f.view.document),"bottom")},c=f=>{let d={superstate:e.superstate,saveFormula:p=>Fye(e.superstate,t.path,p),formula:r.metadata.templateName,value:{},fields:[],description:"Automatically set a template name using a formula",path:t.path};e.superstate.ui.openCustomMenu(f.target.getBoundingClientRect(),zi.default.createElement(Ah,{...d}),{...d},Ne(f.view.document),"bottom")};return a?.length>0?e.compactMode?zi.default.createElement("div",{className:"mk-props-pill",onClick:()=>i(f=>!f)},a.length," Templates"):zi.default.createElement("div",{className:"mk-path-context-row"},zi.default.createElement("div",{className:"mk-path-context-field"},zi.default.createElement("div",{className:"mk-path-context-field-icon",dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//clipboard-pen")}}),zi.default.createElement("div",{className:"mk-path-context-field-key"},"Templates")),zi.default.createElement("div",{className:"mk-path-context-value"},zi.default.createElement("div",{className:"mk-props-pill",onClick:()=>i(f=>!f)},a.length," Templates",zi.default.createElement(gh,{superstate:e.superstate,collapsed:n})),zi.default.createElement("button",{className:"mk-toolbar-button","aria-label":H.labels.editFormula,onClick:f=>c(f),dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//formula")}}),!n&&zi.default.createElement("div",{className:"mk-props-list"},a.map((f,d)=>zi.default.createElement("div",{key:d,className:"mk-path",onContextMenu:p=>u(p,f)},zi.default.createElement("div",{className:"mk-path-icon",dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//clipboard-pen")}}),zi.default.createElement("div",null,f),r.metadata.template==f&&zi.default.createElement("div",{className:"mk-path-icon","aria-label":"Default",dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//check")}}))),zi.default.createElement("button",{className:"mk-toolbar-button","aria-label":H.labels.newAction,onClick:f=>l(f),dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//plus")}})))):zi.default.createElement(zi.default.Fragment,null)};var dr=Ae(Te());var k2=e=>{let[t,r]=(0,dr.useState)(!e.superstate.settings.inlineContextExpanded||!e.collapseSpaces);(0,dr.useEffect)(()=>{e.superstate.settings.inlineContextExpanded=!t,e.superstate.saveSettings()},[t]);let[n,i]=(0,dr.useState)({}),{spaceState:a}=(0,dr.useContext)(ur),{addToSpace:o,readMode:s,removeFromSpace:l,pathState:u}=(0,dr.useContext)($r),c=u.type=="space",f=(I,T)=>{let L=e.superstate.spacesIndex.get(T);if(!L)return;let _=!1;L.type=="tag"&&!(u.metadata?.tags??[]).includes(L.space.name)&&(_=!0),L.type=="folder"&&(u.liveSpaces??[]).includes(T)&&(_=!0),I.preventDefault();let Y=[];Y.push({name:H.menu.openSpace,icon:"ui//layout-grid",onClick:te=>{e.superstate.ui.openPath(L.path,te.metaKey)}}),Y.push({name:H.labels.newProperty,icon:"ui//plus",onClick:te=>{g(te,L.path)}}),l&&!_&&Y.push({name:H.menu.removeFromSpace,icon:"ui//trash",onClick:te=>{l(L.path)}});let oe=I.target.getBoundingClientRect();e.superstate.ui.openMenu(oe,Ht(e.superstate.ui,Y),Ne(I.view.document))},d=I=>[...e.superstate.spacesMap.get(I)].map(T=>e.superstate.spacesIndex.get(T)).filter(T=>T&&T.type!="default"&&T.path!="/").map(T=>e.superstate.pathsIndex.get(T.path)).sort((T,L)=>I.startsWith(T.path)?-1:I.startsWith(L.path)?1:0).filter(T=>T),p=(0,dr.useMemo)(()=>d(u.path),[u]),h=(0,dr.useMemo)(()=>[...e.superstate.spacesMap.get(u?.path)??[]].map(I=>e.superstate.spacesIndex.get(I)?.space).filter(I=>I),[u]),m=(I,T)=>I=="$fm"?(Pye(e.superstate,u.path,T),!0):(e.superstate.spaceManager.addSpaceProperty(I,T),!0),g=(I,T)=>{let L=I.target.getBoundingClientRect();Nf(e.superstate,L,Ne(I.view.document),{spaces:p.map(_=>_.path),fields:[],saveField:(_,Y)=>m(T,Y),schemaId:Er,contextPath:T,fileMetadata:!c})},A=I=>{let T=I.target.getBoundingClientRect();Fa(T,Ne(I.view.document),e.superstate,(L,_)=>{_?L.charAt(0)=="#"?th(e.superstate,u.path,L):kf(e.superstate,L,{links:[u.path]}):o(L)},!1,!0)},b=I=>{e.superstate.ui.openModal(H.labels.newAction,dr.default.createElement(Ki,{value:"",saveLabel:H.buttons.save,saveValue:T=>{e.superstate.spaceManager.createCommand(a.path,{id:T,name:T,type:"actions"})}}),Ne(I.view.document))},v=I=>{e.superstate.ui.openModal(H.labels.newTable,dr.default.createElement(Ki,{value:"",saveLabel:H.buttons.save,saveValue:T=>{e.superstate.spaceManager.tablesForSpace(a.path).then(L=>{if(L){let _={id:Mi(eh(T),L.map(Y=>Y.id)),name:T,type:"db"};return e.superstate.spaceManager.createTable(a.path,_).then(Y=>e.superstate.spaceManager.addSpaceProperty(a.path,{...Px[0],schemaId:_.id}))}})}}),Ne(I.view.document))},x=(I,T)=>jl(I,T,e.superstate,L=>{sv(e.superstate,u.path,L)}),w=I=>{let T=I.target.getBoundingClientRect(),L=Ne(I.view.document);e.superstate.ui.openMenu(T,Ht(e.superstate.ui,[{name:H.labels.newTable,description:H.descriptions.spaceLists,icon:"ui//table",onClick:_=>v(_)},{name:H.labels.template,description:H.descriptions.spaceTemplates,icon:"ui//clipboard-pen",onClick:_=>x(T,L)},{name:H.labels.newAction,description:H.descriptions.spaceActions,icon:"ui//mouse-pointer-click",onClick:_=>b(_)},Rt,{name:"Toggle Read Mode",description:"Toggle read mode for the space",icon:"ui//eye",onClick:_=>{du(e.superstate,a.space,{...a.metadata,readMode:!a.metadata.readMode})}},Rt,{name:"Apply to Items",description:H.descriptions.spaceProperties,icon:"ui//list",type:6,onSubmenu:_=>a9(_,e.superstate,a,L)},Rt,{name:"Reset View",description:"Reset the view to the default settings",icon:"ui//table",onClick:_=>{e.superstate.spaceManager.saveFrame(a.path,e.superstate.spaceManager.superstate.settings.enableFolderNote?oj.main:aw.main)}}]),L)},[S,k]=(0,dr.useState)([]);(0,dr.useEffect)(()=>{j()},[u]),(0,dr.useEffect)(()=>{let I=T=>{![...e.superstate.spacesMap.get(u?.path)??[]].includes(T.path)||j()};return e.superstate.eventsDispatcher.addListener("contextStateUpdated",I),()=>{e.superstate.eventsDispatcher.removeListener("contextStateUpdated",I)}},[u]);let j=async()=>{let I=[...e.superstate.spacesMap.get(u?.path)??[]],T=await Promise.all(I.map(async Q=>e.superstate.spaceManager.readTable(Q,Er).then(fe=>({path:Q,schema:fe.schema,cols:fe.cols,rows:fe.rows})))),L=I.flatMap(Q=>e.superstate.spacesIndex.get(Q)?.contexts),_=S.filter(Q=>Q.property.type.startsWith("context")).map(Q=>pr(Q.property.value,Q.property.type,e.superstate).space).filter(Q=>Q),oe=(await Promise.all([...L,..._].filter(Q=>!I.includes(Q)).map(Q=>e.superstate.spaceManager.readTable(Q,Er).then(fe=>({[Q]:fe}))))).reduce((Q,fe)=>({...Q,...fe}),{});i({...oe,...T.reduce((Q,fe)=>({...Q,[fe.path]:{schema:fe.schema,cols:fe.cols,rows:fe.rows}}),{})});let te=[];T.forEach(Q=>{let fe=Q.rows.find(Ie=>Ie[mt]==u.path);Q.cols.filter(Ie=>Ie.primary!="true").forEach(Ie=>{let Se=te.findIndex(Oe=>Oe.property.name==Ie.name);Se==-1?te.push({property:Ie,contexts:[Q.path],value:fe?.[Ie.name]??""}):te[Se].contexts.push(Q.path)})},[]),k(te)},O=(I,T)=>{pi(e.superstate,u.path,{[T.property.name]:la(T.property.type,I,!0)})},C=(I,T,L)=>{pi(e.superstate,u.path,{[L.property.name]:la(L.property.type,T,!0)}),e.superstate.spaceManager.saveSpaceProperty(L.contexts[0],{...L.property,value:I},L.property)},N=(I,T)=>{let L=I.target.getBoundingClientRect();yh({superstate:e.superstate,field:T.property,rect:L,win:Ne(I.view.document),options:[],fields:S.map(_=>_.property),contextPath:u.path,saveField:_=>{e.superstate.spaceManager.saveSpaceProperty(T.contexts[0],_,T.property)},anchor:"bottom",deleteColumn:_=>{e.superstate.spaceManager.deleteSpaceProperty(T.contexts[0],T.property)},editable:!0})},[D,P]=(0,dr.useTransition)();(0,dr.useEffect)(()=>{P(()=>null)},[]);let q=()=>{P(()=>r(I=>!I))},z=[...d0(e.superstate.settings)];return dr.default.createElement("div",{className:"mk-props-contexts"},!s&&e.collapseSpaces&&dr.default.createElement("div",{style:{position:"relative"}},dr.default.createElement("div",{className:"mk-fold"},dr.default.createElement(Vd,{superstate:e.superstate,collapsed:t,onToggle:I=>q()}))),e.collapseSpaces&&dr.default.createElement("div",{className:"mk-path-context-row"},dr.default.createElement("div",{className:"mk-props-contexts-space-list"},p.map((I,T)=>dr.default.createElement("div",{key:T,className:"mk-props-contexts-space-name",onContextMenu:L=>f(L,I.path),onClick:L=>e.superstate.ui.openPath(I.path,L.metaKey),style:I.label?.color?.length>0?{"--tag-background":I.label?.color,"--tag-color":"var(--color-white)"}:{}},dr.default.createElement("div",{className:"mk-icon-xsmall",dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker(I.label?.sticker)}}),I.name)),dr.default.createElement("div",{className:"mk-props-contexts-space-name",onClick:I=>A(I),style:{opacity:.5}},dr.default.createElement("span",{className:"mk-icon-xsmall",dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//space-add")}}),H.labels.spaces))),(!t||!e.collapseSpaces||D)&&dr.default.createElement("div",{className:"mk-header-space",style:{transition:"all 0.3s ease-in-out",maxHeight:D?"0px":"unset"}},!e.collapseSpaces&&dr.default.createElement("div",{className:"mk-path-context-row"},dr.default.createElement("div",{className:"mk-path-context-field"},dr.default.createElement("div",{className:"mk-path-context-field-icon",dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//file-stack")}}),dr.default.createElement("div",{className:"mk-path-context-field-key"},"Spaces")),dr.default.createElement("div",{className:"mk-path-context-value"},dr.default.createElement("div",{className:"mk-props-value"},dr.default.createElement("div",{className:"mk-props-list"},p.map((I,T)=>dr.default.createElement(oo,{key:T,superstate:e.superstate,path:I.path})))))),c&&a&&dr.default.createElement(dr.default.Fragment,null,dr.default.createElement(EEe,{superstate:e.superstate,space:a,compactMode:!1}),dr.default.createElement(wEe,{superstate:e.superstate,space:a}),dr.default.createElement(CEe,{superstate:e.superstate,compactMode:!1}),dr.default.createElement(DEe,{superstate:e.superstate,compactMode:!1}),dr.default.createElement(SEe,{superstate:e.superstate,compactMode:!1})),S.map((I,T)=>dr.default.createElement(bs,{key:T,superstate:e.superstate,initialValue:I.value,row:u.metadata.property,compactMode:!1,column:{...I.property,table:""},columns:S.map(L=>L.property),editMode:5,updateValue:L=>O(L,I),updateFieldValue:(L,_)=>C(L,_,I),contextTable:n,source:u.path,path:u.path,contexts:I.contexts,propertyMenu:L=>N(L,I),contextPath:I.contexts[0]})),dr.default.createElement(mEe,{superstate:e.superstate,spaces:h.map(I=>I.path),force:!0,compactMode:!1,excludeKeys:[...z,e.superstate.settings.fmKeyAlias],editable:!0}),dr.default.createElement("div",{className:"mk-path-context-row-new"},dr.default.createElement("div",{className:"mk-path-context-new",onClick:I=>g(I,"$fm")},dr.default.createElement("div",{className:"mk-path-context-field-icon",dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//plus")}}),dr.default.createElement("div",{className:"mk-path-context-field-key"},H.labels.newProperty)),c&&dr.default.createElement("div",{className:"mk-path-context-new",onClick:I=>w(I)},dr.default.createElement("div",{className:"mk-path-context-field-icon",dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//options")}})))),z.length>0&&dr.default.createElement("style",null,`${z.map(I=>`.metadata-property[data-property-key="${I}"]`).join(", ")} { display: none; - }`))};var _Y=e=>{let[t,r]=(0,Xo.useState)(null),n=a=>{r(a)};(0,Xo.useEffect)(()=>(e.superstate.ui.eventsDispatch.addListener("activePathChanged",n),()=>{e.superstate.ui.eventsDispatch.removeListener("activePathChanged",n)}),[]);let i=e.superstate.spacesIndex.has(t);return Xo.default.createElement(Qs,{superstate:e.superstate,path:t,readMode:!1},i?Xo.default.createElement(lh,{superstate:e.superstate},Xo.default.createElement(OEe,{superstate:e.superstate})):Xo.default.createElement(OEe,{superstate:e.superstate}))},OEe=e=>{let[t,r]=(0,Xo.useState)([]),{pathState:n}=(0,Xo.useContext)($r);return(0,Xo.useEffect)(()=>{n&&r([n.path])},[n]),Xo.default.createElement("div",{className:"mk-path-explorer"},Xo.default.createElement("div",{className:"mk-path-context-properties"},Xo.default.createElement("div",{onClick:i=>{i.stopPropagation()},className:"mk-path-context-title"},Xo.default.createElement("div",{dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//list")}}),H.labels.properties),Xo.default.createElement(k2,{superstate:e.superstate,collapseSpaces:!1})),Xo.default.createElement(nb,{superstate:e.superstate,path:n.path}))};var nm={frameSelected:"mkmd-active-frame",frameLayerSelected:"mkmd-frame-layer",refreshView:"mkmd-refresh-view",revealPath:"mkmd-reveal-file",collapseFolders:"mkmd-collapse-folders",toggleBacklinks:"mkmd-toggle-backlinks",metadataChange:"mkmd-tags-change",vaultChange:"mkmd-vault-change",mdbChange:"mkmd-mdb-change",spacesChange:"mkmd-spaces-change",frameChange:"mkmd-frame-change",updateSections:"mkmd-update-sections",settingsChanged:"mkmd-settings-changed"};var Ci=Ae(Te());var nJe=e=>{let[t,r]=(0,Ci.useState)(null),n=o=>{let s=e.superstate.pathsIndex.get(o),l=[...s.metadata.links??[],...s.metadata.embeds??[]].find(u=>e.source.includes(u.displayText));if(l){let u=s.metadata.sections.find(c=>c.position.start.offset<=l.position.start.offset&&c.position.end.offset>=l.position.end.offset);r([Math.max(1,u.position.start.line),Math.max(u.position.start.line+1,u.position.end.line+1)])}else r([null,null])};(0,Ci.useEffect)(()=>{n(e.path)},[]),(0,Ci.useEffect)(()=>{n(e.path)},[e.path]);let[i,a]=(0,Ci.useState)(!0);return Ci.default.createElement(Ci.default.Fragment,null,Ci.default.createElement("div",{className:"mk-path-backlink-title"},Ci.default.createElement(oo,{superstate:e.superstate,path:e.path},Ci.default.createElement(Vd,{superstate:e.superstate,collapsed:i,onToggle:o=>a(o)}))),!i&&t?Ci.default.createElement("div",{className:"mk-path-context-backlink"},Ci.default.createElement(dv,{load:!0,forceNote:!0,superstate:e.superstate,path:e.path,properties:{from:t[0],to:t[1]},classname:"mk-path-context-flow"})):Ci.default.createElement(Ci.default.Fragment,null))},nb=e=>{let[t,r]=(0,Ci.useState)(!e.superstate.settings.inlineBacklinksExpanded),[n,i]=(0,Ci.useState)([]);(0,Ci.useEffect)(()=>{!e.path||i(kr([...e.superstate.linksMap.getInverse(e.path)]).map(o=>e.superstate.pathsIndex.get(o).path))},[e.path]),(0,Ci.useEffect)(()=>{e.superstate.settings.inlineBacklinksExpanded=!t,e.superstate.saveSettings()},[t]);let a=()=>{r(!t)};return(0,Ci.useEffect)(()=>(window.addEventListener(nm.toggleBacklinks,a),()=>{window.removeEventListener(nm.toggleBacklinks,a)}),[t]),n.length>0&&e.path?Ci.default.createElement("div",{className:"mk-path-context-component mk-note-footer"},Ci.default.createElement("div",{onClick:o=>{r(!t),o.stopPropagation()},className:"mk-path-context-title"},Ci.default.createElement("div",{dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//backlink")}}),H.labels.backlinks),Ci.default.createElement("div",{className:"mk-fold"},Ci.default.createElement(Vd,{superstate:e.superstate,collapsed:t,onToggle:o=>a()})),Ci.default.createElement("div",{className:"mk-path-backlinks"},!t&&n.map((o,s)=>Ci.default.createElement(nJe,{path:o,key:s,superstate:e.superstate,source:e.path})))):Ci.default.createElement(Ci.default.Fragment,null)};var Bc=Ae(Te());var MEe=Ae(Ya());var Qn=Ae(Te());var S9=e=>{let{pathState:t}=(0,Qn.useContext)($r),{spaceState:r}=(0,Qn.useContext)(ur),n=t?.metadata.property?.aliases??[],[i,a]=(0,Qn.useState)(e.superstate.settings.spacesUseAlias&&n?.[0]?.length>0),o=(0,Qn.useMemo)(()=>t?i?n?.[0]:t.subtype=="tag"?hl(t?.name):t?.name:null,[t,i]);(0,Qn.useEffect)(()=>{e.superstate.settings.spacesUseAlias&&n?.[0]?.length>0?a(!0):a(!1)},[t]);let s=(0,Qn.useRef)(null),l=!e.readOnly&&r?.type!="default",u=A=>{let b=A.target.innerText;if(b!=o){if(t.path=="/"){e.superstate.settings.systemName=b,e.superstate.saveSettings(),e.superstate.reloadPath("/",!0);return}if(i)nD(e.superstate,t.path,t.metadata?.property?.aliases,b);else{let v=ov(b);Ux(e.superstate,t.path,v).then(x=>{x&&v!=b&&nD(e.superstate,x,t.metadata?.property?.aliases,b)})}}};(0,Qn.useEffect)(()=>{if(!!s?.current&&s.current.innerText.startsWith("Untitled")){s.current.focus();let A=window.getSelection(),b=document.createRange();b.selectNodeContents(s.current),A.removeAllRanges(),A.addRange(b)}},[]);let c=A=>{A.stopPropagation()},f=A=>{A.stopPropagation()},d=A=>{if(A.stopPropagation(),A.key=="a"&&A.metaKey){A.preventDefault();let b=window.getSelection(),v=document.createRange();v.selectNodeContents(A.target),b.removeAllRanges(),b.addRange(v)}A.key=="Enter"&&(A.target.blur(),A.preventDefault()),A.key=="Escape"&&(A.target.blur(),A.preventDefault())},p=t?.metadata.label?.[e.superstate.settings.fmKeySticker]?.length>0,h=t?.metadata.property?.[e.superstate.settings.fmKeyBanner],m=jc(e.superstate.ui),g=A=>{let b=A.target.getBoundingClientRect(),v=[];p?(v.push({name:H.buttons.changeIcon,icon:"ui//sticker",onClick:x=>e.superstate.ui.openPalette(Qn.default.createElement(Ta,{ui:e.superstate.ui,selectedSticker:w=>v2(e.superstate,t.path,w)}),Ne(x.view.document))}),v.push({name:H.buttons.removeIcon,icon:"ui//sticker",onClick:x=>{y2(e.superstate,t.path)}})):v.push({name:H.buttons.addIcon,icon:"ui//sticker",onClick:x=>e.superstate.ui.openPalette(Qn.default.createElement(Ta,{ui:e.superstate.ui,selectedSticker:w=>v2(e.superstate,t.path,w)}),Ne(x.view.document))}),v.push(Rt),h?(v.push({name:H.buttons.changeBanner,icon:"ui//mk-make-image",onClick:x=>e.superstate.ui.openPalette(Qn.default.createElement(_f,{superstate:e.superstate,selectedPath:w=>Zy(e.superstate,t.path,w)}),Ne(x.view.document))}),v.push({name:H.labels.reposition,icon:"ui//move",onClick:x=>e.setReposition(w=>!w)}),v.push({name:H.buttons.removeBanner,icon:"ui//file-minus",onClick:x=>{e.superstate.spacesIndex.has(t.path)&&e.superstate.spaceManager.deleteProperty(Af(e.superstate,e.superstate.spacesIndex.get(t.path).space),e.superstate.settings.fmKeyBanner),e.superstate.spaceManager.deleteProperty(t.path,e.superstate.settings.fmKeyBanner)}})):v.push({name:H.buttons.addCover,icon:"ui//mk-make-image",onClick:x=>e.superstate.ui.openPalette(Qn.default.createElement(_f,{superstate:e.superstate,selectedPath:w=>Zy(e.superstate,t.path,w)}),Ne(x.view.document))}),v.push(Rt),i?v.push({name:"Edit File Name",icon:"ui//alias",onClick:()=>a(!1)}):v.push({name:"Edit Display Name",icon:"ui//alias",onClick:()=>a(!0)}),e.superstate.ui.openMenu(b,Ht(e.superstate.ui,v),Ne(A.view.document))};return t&&Qn.default.createElement(Qn.default.Fragment,null,!m&&Qn.default.createElement(iJe,{superstate:e.superstate,pathState:t,hasBanner:h,hasSticker:p}),e.superstate.settings.spacesStickers&&p&&Qn.default.createElement("div",{className:"mk-header-icon",style:h?{"--label-color":"var(--mk-ui-background)"}:{}},Qn.default.createElement(f9,{superstate:e.superstate,path:t.path})),Qn.default.createElement("div",{className:"mk-title-container"},t?.subtype=="tag"?Qn.default.createElement("div",{className:"mk-title-prefix"},"#"):"",Qn.default.createElement("div",{ref:s,className:"mk-inline-title inline-title",contentEditable:l,onBlur:u,onDrop:A=>A.preventDefault(),onKeyDown:d,onKeyPress:c,onKeyUp:f,dangerouslySetInnerHTML:{__html:o},"data-ph":i?H.hintText.alias:H.hintText.fileName}),m?Qn.default.createElement("div",{className:"mk-toolbar-button",dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//edit")},onClick:A=>g(A)}):Qn.default.createElement("button",{className:(0,MEe.default)("mk-title-alias",i&&"mk-active"),dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//alias")},"aria-label":H.buttons.alias,onClick:()=>a(!i)})))},iJe=e=>{let{pathState:t,hasBanner:r,hasSticker:n}=e;return Qn.default.createElement("div",{className:"mk-header-label-actions"},e.superstate.settings.spacesStickers&&!n&&Qn.default.createElement("button",{className:"mk-inline-button",onClick:i=>e.superstate.ui.openPalette(Qn.default.createElement(Ta,{ui:e.superstate.ui,selectedSticker:a=>v2(e.superstate,t.path,a)}),Ne(i.view.document))},Qn.default.createElement("div",{className:"mk-icon-xsmall",dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//smile")}}),H.buttons.addIcon),!r&&Qn.default.createElement("button",{className:"mk-inline-button",onClick:i=>e.superstate.ui.openPalette(Qn.default.createElement(_f,{superstate:e.superstate,selectedPath:a=>Zy(e.superstate,t.path,a)}),Ne(i.view.document))},Qn.default.createElement("div",{className:"mk-icon-xsmall",dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//mk-make-image")}}),H.buttons.addCover))};var Yn=Ae(Te());var C2=e=>{let[t,r]=(0,Yn.useState)(!1),{pathState:n}=(0,Yn.useContext)($r),[i,a]=(0,Yn.useState)(e.superstate.spaceManager.uriByString(n?.metadata.property?.[e.superstate.settings.fmKeyBanner])),o=n.readOnly;(0,Yn.useEffect)(()=>{let k=e.superstate.spaceManager.uriByString(n?.metadata.property?.[e.superstate.settings.fmKeyBanner]),j=n?.metadata.property?.[e.superstate.settings.fmKeySticker]?.length>0;r(j),l(n?.metadata.property?.[e.superstate.settings.fmKeyBannerOffset]?`${Math.min(100,parseFloat(n?.metadata.property?.[e.superstate.settings.fmKeyBannerOffset])*100).toString()}%`:"center"),a(k||null)},[n]);let[s,l]=(0,Yn.useState)(n?.metadata.property?.[e.superstate.settings.fmKeyBannerOffset]?`${Math.min(100,parseFloat(n?.metadata.property?.[e.superstate.settings.fmKeyBannerOffset])*100).toString()}%`:"center"),u=k=>{e.superstate.ui.openPalette(Yn.default.createElement(_f,{superstate:e.superstate,selectedPath:j=>Zy(e.superstate,n.path,j)}),Ne(k.view.document))},c=k=>{k.preventDefault();let j=[{name:H.buttons.changeBanner,value:"change",icon:"ui//image",onClick:O=>{u(O)}},{name:H.buttons.removeBanner,value:"remove",icon:"ui//file-minus",onClick:O=>{e.superstate.spacesIndex.has(n.path)&&e.superstate.spaceManager.deleteProperty(Af(e.superstate,e.superstate.spacesIndex.get(n.path).space),e.superstate.settings.fmKeyBanner),e.superstate.spaceManager.deleteProperty(n.path,e.superstate.settings.fmKeyBanner)}}];return e.superstate.ui.openMenu({x:k.clientX,y:k.clientY,width:0,height:0},Ht(e.superstate.ui,j),Ne(k.view.document)),!1},[f,d]=(0,Yn.useState)(null),p=(0,Yn.useRef)(s=="center"?50:parseFloat(s)),h=(0,Yn.useRef)(s=="center"?50:parseFloat(s)),m=k=>{l(k+"%"),pi(e.superstate,n.path,{[e.superstate.settings.fmKeyBannerOffset]:k.toString()})},[,g]=(0,Yn.useState)([0,0]),A=.5,b=(0,Yn.useCallback)(k=>{g(j=>{let{clientX:O,clientY:C}=k,[N,D]=j,P=O-N,q=D-C,I=A*1,T=Math.sqrt((P+q)/2*(P+q)/2)*I;P+q<0&&(T=-T),T=q*I;let L=p.current+T;return L=Math.max(L,0),L=Math.min(L,100),h.current=L,m(L),j}),k.stopPropagation()},[f,A]),v=(0,Yn.useCallback)(k=>{let j=O=>{O.stopPropagation(),window.removeEventListener("click",j,!0)};window.addEventListener("click",j,!0),document.removeEventListener("mousemove",b),document.removeEventListener("mouseup",v),m(h.current),k.preventDefault(),k.stopPropagation()},[b]),x=(0,Yn.useCallback)(k=>{!e.reposition||(p.current=s=="center"?50:parseFloat(s),g([k.clientX,k.clientY]),document.addEventListener("mousemove",b),document.addEventListener("mouseup",v),k.stopPropagation())},[b,v,s,e.reposition]),w=k=>{k.metaKey?d("metaKey"):k.ctrlKey?d("ctrlKey"):k.altKey?d("altKey"):k.shiftKey&&d("shiftKey")},S=()=>{d(null)};return(0,Yn.useEffect)(()=>(document.addEventListener("keydown",w),document.addEventListener("keyup",S),()=>{document.removeEventListener("mousemove",b),document.removeEventListener("mouseup",v),document.removeEventListener("keydown",w),document.removeEventListener("keyup",S)}),[]),i?Yn.default.createElement(Yn.default.Fragment,null,Yn.default.createElement("div",{className:"mk-space-banner",onContextMenu:!o&&c,style:{"--mk-banner-height":e.superstate.settings.bannerHeight+"px",backgroundImage:`url("${i.scheme=="vault"?e.superstate.ui.getUIPath(i.basePath):i.fullPath}")`,backgroundPositionY:s,cursor:e.reposition?"grab":"inherit"},onMouseDown:x}),e.setReposition&&Yn.default.createElement("div",{className:"mk-space-banner-buttons"},e.reposition?Yn.default.createElement("button",{className:"mk-hover-button",onClick:()=>e.setReposition(!1)},Yn.default.createElement("div",{dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//check")}}),H.labels.done):Yn.default.createElement("button",{className:"mk-hover-button",onClick:()=>e.setReposition(!0)},Yn.default.createElement("div",{dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//move")}}),H.labels.reposition),Yn.default.createElement("button",{className:"mk-hover-button",onClick:k=>u(k)},Yn.default.createElement("div",{dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//edit")}}),H.labels.changeCoverShort),Yn.default.createElement("button",{className:"mk-hover-button",dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//options")},onClick:k=>c(k)})),Yn.default.createElement("div",{className:"mk-spacer",style:{"--mk-header-height":((Gr(e.superstate.ui)?1:0)*26+(e.superstate.settings.bannerHeight-62)+(!e.superstate.settings.spacesStickers||e.superstate.settings.inlineContextNameLayout=="horizontal"?50:t?0:40)).toString()+"px"},onContextMenu:k=>k.preventDefault()})):Yn.default.createElement(Yn.default.Fragment,null)};var pD=e=>{let{pathState:t}=(0,Bc.useContext)($r);(0,Bc.useLayoutEffect)(()=>{e.editorView?.requestMeasure()},[]);let[r,n]=Bc.default.useState(!1);return t&&Bc.default.createElement(Bc.default.Fragment,null,Bc.default.createElement("div",{className:"mk-path-context-component"},Bc.default.createElement("div",{className:`mk-path-context-label ${e.superstate.settings.inlineContextNameLayout=="horizontal"?"mk-path-context-file-horizontal":""}`},e.superstate.settings.banners&&Bc.default.createElement(C2,{superstate:e.superstate,reposition:r,setReposition:n}),Bc.default.createElement(S9,{superstate:e.superstate,readOnly:!e.editable,setReposition:n})),e.editable&&e.superstate.settings.inlineContextProperties&&Bc.default.createElement(k2,{superstate:e.superstate,collapseSpaces:!0})))};var iE=Ae(Te());var Fl=Ae(Te());var Nv=Ae(yi()),Wa=Ae(Te());var TEe=Ae(yi()),Tl=Ae(Te());var Mv={def:{icon:"ui//gem"},node:{icon:"ui//gem",schemaId:"slides",parentId:"",name:"Slides",rank:0,id:"slides",styles:{},type:"slides",props:{value:""},types:{value:"string"}}},Rc={def:{icon:"ui//gem"},node:{icon:"ui//gem",schemaId:"slide",parentId:"",name:"Slide",rank:0,id:"slide",styles:{},type:"slide",props:{value:""},types:{value:"string"}}},Ui={def:{icon:"ui//gem"},node:{icon:"ui//gem",schemaId:"delta",parentId:"",name:"Delta",rank:0,id:"delta",styles:{},type:"delta"}};var jEe=["content","group","container","column","list","slides","slide"],E9={def:{id:"list",icon:"ui//list"},node:{icon:"ui//list",schemaId:"list",parentId:"",name:"List",rank:0,id:"list",styles:{},type:"list",props:{value:""},types:{value:"multi"}}},k9={def:{id:"listItem",icon:"ui//list"},node:{icon:"ui//list",schemaId:"listItem",parentId:"",name:"List Item",rank:0,id:"listItem",styles:{},type:"listItem",props:{value:""},types:{value:"object"}}},C9={def:{id:"divider",icon:"ui//minus",description:H.frames.divider.description},node:{icon:"ui//minus",schemaId:"divider",parentId:"",name:H.frames.divider.label,rank:0,id:"divider",type:"group",styles:{width:"'100%'",height:"'16px'",borderBottom:"'1px solid var(--mk-ui-divider)'"}}},opr={def:{id:"countdown",icon:"ui//clock"},node:{icon:"ui//clock",schemaId:"countdown",parentId:"",name:"Countdown",rank:0,id:"countdown",type:"group",props:{date:""},types:{date:"date"}},children:[{...mn,node:{...mn.node,props:{date:"",value:`var _second = 1000; + }`))};var _Y=e=>{let[t,r]=(0,Xo.useState)(null),n=a=>{r(a)};(0,Xo.useEffect)(()=>(e.superstate.ui.eventsDispatch.addListener("activePathChanged",n),()=>{e.superstate.ui.eventsDispatch.removeListener("activePathChanged",n)}),[]);let i=e.superstate.spacesIndex.has(t);return Xo.default.createElement(Qs,{superstate:e.superstate,path:t,readMode:!1},i?Xo.default.createElement(lh,{superstate:e.superstate},Xo.default.createElement(OEe,{superstate:e.superstate})):Xo.default.createElement(OEe,{superstate:e.superstate}))},OEe=e=>{let[t,r]=(0,Xo.useState)([]),{pathState:n}=(0,Xo.useContext)($r);return(0,Xo.useEffect)(()=>{n&&r([n.path])},[n]),Xo.default.createElement("div",{className:"mk-path-explorer"},Xo.default.createElement("div",{className:"mk-path-context-properties"},Xo.default.createElement("div",{onClick:i=>{i.stopPropagation()},className:"mk-path-context-title"},Xo.default.createElement("div",{dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//list")}}),H.labels.properties),Xo.default.createElement(k2,{superstate:e.superstate,collapseSpaces:!1})),Xo.default.createElement(nb,{superstate:e.superstate,path:n.path}))};var im={frameSelected:"mkmd-active-frame",frameLayerSelected:"mkmd-frame-layer",refreshView:"mkmd-refresh-view",revealPath:"mkmd-reveal-file",collapseFolders:"mkmd-collapse-folders",toggleBacklinks:"mkmd-toggle-backlinks",metadataChange:"mkmd-tags-change",vaultChange:"mkmd-vault-change",mdbChange:"mkmd-mdb-change",spacesChange:"mkmd-spaces-change",frameChange:"mkmd-frame-change",updateSections:"mkmd-update-sections",settingsChanged:"mkmd-settings-changed"};var Ci=Ae(Te());var nJe=e=>{let[t,r]=(0,Ci.useState)(null),n=o=>{let s=e.superstate.pathsIndex.get(o),l=[...s.metadata.links??[],...s.metadata.embeds??[]].find(u=>e.source.includes(u.displayText));if(l){let u=s.metadata.sections.find(c=>c.position.start.offset<=l.position.start.offset&&c.position.end.offset>=l.position.end.offset);r([Math.max(1,u.position.start.line),Math.max(u.position.start.line+1,u.position.end.line+1)])}else r([null,null])};(0,Ci.useEffect)(()=>{n(e.path)},[]),(0,Ci.useEffect)(()=>{n(e.path)},[e.path]);let[i,a]=(0,Ci.useState)(!0);return Ci.default.createElement(Ci.default.Fragment,null,Ci.default.createElement("div",{className:"mk-path-backlink-title"},Ci.default.createElement(oo,{superstate:e.superstate,path:e.path},Ci.default.createElement(Vd,{superstate:e.superstate,collapsed:i,onToggle:o=>a(o)}))),!i&&t?Ci.default.createElement("div",{className:"mk-path-context-backlink"},Ci.default.createElement(dv,{load:!0,forceNote:!0,superstate:e.superstate,path:e.path,properties:{from:t[0],to:t[1]},classname:"mk-path-context-flow"})):Ci.default.createElement(Ci.default.Fragment,null))},nb=e=>{let[t,r]=(0,Ci.useState)(!e.superstate.settings.inlineBacklinksExpanded),[n,i]=(0,Ci.useState)([]);(0,Ci.useEffect)(()=>{!e.path||i(kr([...e.superstate.linksMap.getInverse(e.path)]).map(o=>e.superstate.pathsIndex.get(o).path))},[e.path]),(0,Ci.useEffect)(()=>{e.superstate.settings.inlineBacklinksExpanded=!t,e.superstate.saveSettings()},[t]);let a=()=>{r(!t)};return(0,Ci.useEffect)(()=>(window.addEventListener(im.toggleBacklinks,a),()=>{window.removeEventListener(im.toggleBacklinks,a)}),[t]),n.length>0&&e.path?Ci.default.createElement("div",{className:"mk-path-context-component mk-note-footer"},Ci.default.createElement("div",{onClick:o=>{r(!t),o.stopPropagation()},className:"mk-path-context-title"},Ci.default.createElement("div",{dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//backlink")}}),H.labels.backlinks),Ci.default.createElement("div",{className:"mk-fold"},Ci.default.createElement(Vd,{superstate:e.superstate,collapsed:t,onToggle:o=>a()})),Ci.default.createElement("div",{className:"mk-path-backlinks"},!t&&n.map((o,s)=>Ci.default.createElement(nJe,{path:o,key:s,superstate:e.superstate,source:e.path})))):Ci.default.createElement(Ci.default.Fragment,null)};var Bc=Ae(Te());var MEe=Ae(Ya());var Qn=Ae(Te());var S9=e=>{let{pathState:t}=(0,Qn.useContext)($r),{spaceState:r}=(0,Qn.useContext)(ur),n=t?.metadata.property?.aliases??[],[i,a]=(0,Qn.useState)(e.superstate.settings.spacesUseAlias&&n?.[0]?.length>0),o=(0,Qn.useMemo)(()=>t?i?n?.[0]:t.subtype=="tag"?hl(t?.name):t?.name:null,[t,i]);(0,Qn.useEffect)(()=>{e.superstate.settings.spacesUseAlias&&n?.[0]?.length>0?a(!0):a(!1)},[t]);let s=(0,Qn.useRef)(null),l=!e.readOnly&&r?.type!="default",u=A=>{let b=A.target.innerText;if(b!=o){if(t.path=="/"){e.superstate.settings.systemName=b,e.superstate.saveSettings(),e.superstate.reloadPath("/",!0);return}if(i)nD(e.superstate,t.path,t.metadata?.property?.aliases,b);else{let v=ov(b);Ux(e.superstate,t.path,v).then(x=>{x&&v!=b&&nD(e.superstate,x,t.metadata?.property?.aliases,b)})}}};(0,Qn.useEffect)(()=>{if(!!s?.current&&s.current.innerText.startsWith("Untitled")){s.current.focus();let A=window.getSelection(),b=document.createRange();b.selectNodeContents(s.current),A.removeAllRanges(),A.addRange(b)}},[]);let c=A=>{A.stopPropagation()},f=A=>{A.stopPropagation()},d=A=>{if(A.stopPropagation(),A.key=="a"&&A.metaKey){A.preventDefault();let b=window.getSelection(),v=document.createRange();v.selectNodeContents(A.target),b.removeAllRanges(),b.addRange(v)}A.key=="Enter"&&(A.target.blur(),A.preventDefault()),A.key=="Escape"&&(A.target.blur(),A.preventDefault())},p=t?.metadata.label?.[e.superstate.settings.fmKeySticker]?.length>0,h=t?.metadata.property?.[e.superstate.settings.fmKeyBanner],m=jc(e.superstate.ui),g=A=>{let b=A.target.getBoundingClientRect(),v=[];p?(v.push({name:H.buttons.changeIcon,icon:"ui//sticker",onClick:x=>e.superstate.ui.openPalette(Qn.default.createElement(Ta,{ui:e.superstate.ui,selectedSticker:w=>v2(e.superstate,t.path,w)}),Ne(x.view.document))}),v.push({name:H.buttons.removeIcon,icon:"ui//sticker",onClick:x=>{y2(e.superstate,t.path)}})):v.push({name:H.buttons.addIcon,icon:"ui//sticker",onClick:x=>e.superstate.ui.openPalette(Qn.default.createElement(Ta,{ui:e.superstate.ui,selectedSticker:w=>v2(e.superstate,t.path,w)}),Ne(x.view.document))}),v.push(Rt),h?(v.push({name:H.buttons.changeBanner,icon:"ui//mk-make-image",onClick:x=>e.superstate.ui.openPalette(Qn.default.createElement(_f,{superstate:e.superstate,selectedPath:w=>Zy(e.superstate,t.path,w)}),Ne(x.view.document))}),v.push({name:H.labels.reposition,icon:"ui//move",onClick:x=>e.setReposition(w=>!w)}),v.push({name:H.buttons.removeBanner,icon:"ui//file-minus",onClick:x=>{e.superstate.spacesIndex.has(t.path)&&e.superstate.spaceManager.deleteProperty(Af(e.superstate,e.superstate.spacesIndex.get(t.path).space),e.superstate.settings.fmKeyBanner),e.superstate.spaceManager.deleteProperty(t.path,e.superstate.settings.fmKeyBanner)}})):v.push({name:H.buttons.addCover,icon:"ui//mk-make-image",onClick:x=>e.superstate.ui.openPalette(Qn.default.createElement(_f,{superstate:e.superstate,selectedPath:w=>Zy(e.superstate,t.path,w)}),Ne(x.view.document))}),v.push(Rt),i?v.push({name:"Edit File Name",icon:"ui//alias",onClick:()=>a(!1)}):v.push({name:"Edit Display Name",icon:"ui//alias",onClick:()=>a(!0)}),e.superstate.ui.openMenu(b,Ht(e.superstate.ui,v),Ne(A.view.document))};return t&&Qn.default.createElement(Qn.default.Fragment,null,!m&&Qn.default.createElement(iJe,{superstate:e.superstate,pathState:t,hasBanner:h,hasSticker:p}),e.superstate.settings.spacesStickers&&p&&Qn.default.createElement("div",{className:"mk-header-icon",style:h?{"--label-color":"var(--mk-ui-background)"}:{}},Qn.default.createElement(f9,{superstate:e.superstate,path:t.path})),Qn.default.createElement("div",{className:"mk-title-container"},t?.subtype=="tag"?Qn.default.createElement("div",{className:"mk-title-prefix"},"#"):"",Qn.default.createElement("div",{ref:s,className:"mk-inline-title inline-title",contentEditable:l,onBlur:u,onDrop:A=>A.preventDefault(),onKeyDown:d,onKeyPress:c,onKeyUp:f,dangerouslySetInnerHTML:{__html:o},"data-ph":i?H.hintText.alias:H.hintText.fileName}),m?Qn.default.createElement("div",{className:"mk-toolbar-button",dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//edit")},onClick:A=>g(A)}):Qn.default.createElement("button",{className:(0,MEe.default)("mk-title-alias",i&&"mk-active"),dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//alias")},"aria-label":H.buttons.alias,onClick:()=>a(!i)})))},iJe=e=>{let{pathState:t,hasBanner:r,hasSticker:n}=e;return Qn.default.createElement("div",{className:"mk-header-label-actions"},e.superstate.settings.spacesStickers&&!n&&Qn.default.createElement("button",{className:"mk-inline-button",onClick:i=>e.superstate.ui.openPalette(Qn.default.createElement(Ta,{ui:e.superstate.ui,selectedSticker:a=>v2(e.superstate,t.path,a)}),Ne(i.view.document))},Qn.default.createElement("div",{className:"mk-icon-xsmall",dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//smile")}}),H.buttons.addIcon),!r&&Qn.default.createElement("button",{className:"mk-inline-button",onClick:i=>e.superstate.ui.openPalette(Qn.default.createElement(_f,{superstate:e.superstate,selectedPath:a=>Zy(e.superstate,t.path,a)}),Ne(i.view.document))},Qn.default.createElement("div",{className:"mk-icon-xsmall",dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//mk-make-image")}}),H.buttons.addCover))};var Yn=Ae(Te());var C2=e=>{let[t,r]=(0,Yn.useState)(!1),{pathState:n}=(0,Yn.useContext)($r),[i,a]=(0,Yn.useState)(e.superstate.spaceManager.uriByString(n?.metadata.property?.[e.superstate.settings.fmKeyBanner])),o=n.readOnly;(0,Yn.useEffect)(()=>{let k=e.superstate.spaceManager.uriByString(n?.metadata.property?.[e.superstate.settings.fmKeyBanner]),j=n?.metadata.property?.[e.superstate.settings.fmKeySticker]?.length>0;r(j),l(n?.metadata.property?.[e.superstate.settings.fmKeyBannerOffset]?`${Math.min(100,parseFloat(n?.metadata.property?.[e.superstate.settings.fmKeyBannerOffset])).toString()}%`:"center"),a(k||null)},[n]);let[s,l]=(0,Yn.useState)(n?.metadata.property?.[e.superstate.settings.fmKeyBannerOffset]?`${Math.min(100,parseFloat(n?.metadata.property?.[e.superstate.settings.fmKeyBannerOffset])*100).toString()}%`:"center"),u=k=>{e.superstate.ui.openPalette(Yn.default.createElement(_f,{superstate:e.superstate,selectedPath:j=>Zy(e.superstate,n.path,j)}),Ne(k.view.document))},c=k=>{k.preventDefault();let j=[{name:H.buttons.changeBanner,value:"change",icon:"ui//image",onClick:O=>{u(O)}},{name:H.buttons.removeBanner,value:"remove",icon:"ui//file-minus",onClick:O=>{e.superstate.spacesIndex.has(n.path)&&e.superstate.spaceManager.deleteProperty(Af(e.superstate,e.superstate.spacesIndex.get(n.path).space),e.superstate.settings.fmKeyBanner),e.superstate.spaceManager.deleteProperty(n.path,e.superstate.settings.fmKeyBanner)}}];return e.superstate.ui.openMenu({x:k.clientX,y:k.clientY,width:0,height:0},Ht(e.superstate.ui,j),Ne(k.view.document)),!1},[f,d]=(0,Yn.useState)(null),p=(0,Yn.useRef)(s=="center"?50:parseFloat(s)),h=(0,Yn.useRef)(s=="center"?50:parseFloat(s)),m=k=>{l(k+"%"),pi(e.superstate,n.path,{[e.superstate.settings.fmKeyBannerOffset]:k.toString()})},[,g]=(0,Yn.useState)([0,0]),A=.5,b=(0,Yn.useCallback)(k=>{g(j=>{let{clientX:O,clientY:C}=k,[N,D]=j,P=O-N,q=D-C,I=A*1,T=Math.sqrt((P+q)/2*(P+q)/2)*I;P+q<0&&(T=-T),T=q*I;let L=p.current+T;return L=Math.max(L,0),L=Math.min(L,100),h.current=L,l(L+"%"),j}),k.stopPropagation()},[f,A]),v=(0,Yn.useCallback)(k=>{let j=O=>{O.stopPropagation(),window.removeEventListener("click",j,!0)};window.addEventListener("click",j,!0),document.removeEventListener("mousemove",b),document.removeEventListener("mouseup",v),m(h.current),k.preventDefault(),k.stopPropagation()},[b]),x=(0,Yn.useCallback)(k=>{!e.reposition||(p.current=s=="center"?50:parseFloat(s),g([k.clientX,k.clientY]),document.addEventListener("mousemove",b),document.addEventListener("mouseup",v),k.stopPropagation())},[b,v,s,e.reposition]),w=k=>{k.metaKey?d("metaKey"):k.ctrlKey?d("ctrlKey"):k.altKey?d("altKey"):k.shiftKey&&d("shiftKey")},S=()=>{d(null)};return(0,Yn.useEffect)(()=>(document.addEventListener("keydown",w),document.addEventListener("keyup",S),()=>{document.removeEventListener("mousemove",b),document.removeEventListener("mouseup",v),document.removeEventListener("keydown",w),document.removeEventListener("keyup",S)}),[]),i?Yn.default.createElement(Yn.default.Fragment,null,Yn.default.createElement("div",{className:"mk-space-banner",onContextMenu:!o&&c,style:{"--mk-banner-height":e.superstate.settings.bannerHeight+"px",backgroundImage:`url("${i.scheme=="vault"?e.superstate.ui.getUIPath(i.basePath):i.fullPath}")`,backgroundPositionY:s,cursor:e.reposition?"grab":"inherit"},onMouseDown:x}),e.setReposition&&Yn.default.createElement("div",{className:"mk-space-banner-buttons"},e.reposition?Yn.default.createElement("button",{className:"mk-hover-button",onClick:()=>e.setReposition(!1)},Yn.default.createElement("div",{dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//check")}}),H.labels.done):Yn.default.createElement("button",{className:"mk-hover-button",onClick:()=>e.setReposition(!0)},Yn.default.createElement("div",{dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//move")}}),H.labels.reposition),Yn.default.createElement("button",{className:"mk-hover-button",onClick:k=>u(k)},Yn.default.createElement("div",{dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//edit")}}),H.labels.changeCoverShort),Yn.default.createElement("button",{className:"mk-hover-button",dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//options")},onClick:k=>c(k)})),Yn.default.createElement("div",{className:"mk-spacer",style:{"--mk-header-height":((Gr(e.superstate.ui)?1:0)*26+(e.superstate.settings.bannerHeight-62)+(!e.superstate.settings.spacesStickers||e.superstate.settings.inlineContextNameLayout=="horizontal"?50:t?0:40)).toString()+"px"},onContextMenu:k=>k.preventDefault()})):Yn.default.createElement(Yn.default.Fragment,null)};var pD=e=>{let{pathState:t}=(0,Bc.useContext)($r);(0,Bc.useLayoutEffect)(()=>{e.editorView?.requestMeasure()},[]);let[r,n]=Bc.default.useState(!1);return t&&Bc.default.createElement(Bc.default.Fragment,null,Bc.default.createElement("div",{className:"mk-path-context-component"},Bc.default.createElement("div",{className:`mk-path-context-label ${e.superstate.settings.inlineContextNameLayout=="horizontal"?"mk-path-context-file-horizontal":""}`},e.superstate.settings.banners&&Bc.default.createElement(C2,{superstate:e.superstate,reposition:r,setReposition:n}),Bc.default.createElement(S9,{superstate:e.superstate,readOnly:!e.editable,setReposition:n})),e.editable&&e.superstate.settings.inlineContextProperties&&Bc.default.createElement(k2,{superstate:e.superstate,collapseSpaces:!0})))};var iE=Ae(Te());var Fl=Ae(Te());var Nv=Ae(yi()),Wa=Ae(Te());var TEe=Ae(yi()),Tl=Ae(Te());var Mv={def:{icon:"ui//gem"},node:{icon:"ui//gem",schemaId:"slides",parentId:"",name:"Slides",rank:0,id:"slides",styles:{},type:"slides",props:{value:""},types:{value:"string"}}},Rc={def:{icon:"ui//gem"},node:{icon:"ui//gem",schemaId:"slide",parentId:"",name:"Slide",rank:0,id:"slide",styles:{},type:"slide",props:{value:""},types:{value:"string"}}},Ui={def:{icon:"ui//gem"},node:{icon:"ui//gem",schemaId:"delta",parentId:"",name:"Delta",rank:0,id:"delta",styles:{},type:"delta"}};var jEe=["content","group","container","column","list","slides","slide"],E9={def:{id:"list",icon:"ui//list"},node:{icon:"ui//list",schemaId:"list",parentId:"",name:"List",rank:0,id:"list",styles:{},type:"list",props:{value:""},types:{value:"multi"}}},k9={def:{id:"listItem",icon:"ui//list"},node:{icon:"ui//list",schemaId:"listItem",parentId:"",name:"List Item",rank:0,id:"listItem",styles:{},type:"listItem",props:{value:""},types:{value:"object"}}},C9={def:{id:"divider",icon:"ui//minus",description:H.frames.divider.description},node:{icon:"ui//minus",schemaId:"divider",parentId:"",name:H.frames.divider.label,rank:0,id:"divider",type:"group",styles:{width:"'100%'",height:"'16px'",borderBottom:"'1px solid var(--mk-ui-divider)'"}}},opr={def:{id:"countdown",icon:"ui//clock"},node:{icon:"ui//clock",schemaId:"countdown",parentId:"",name:"Countdown",rank:0,id:"countdown",type:"group",props:{date:""},types:{date:"date"}},children:[{...mn,node:{...mn.node,props:{date:"",value:`var _second = 1000; var _minute = _second * 60; var _hour = _minute * 60; var _day = _hour * 24; @@ -200,7 +200,7 @@ For more information, see https://radix-ui.com/primitives/docs/components/${t.do var hours = Math.floor((distance % _day) / _hour); var minutes = Math.floor((distance % _hour) / _minute); var seconds = Math.floor((distance % _minute) / _second); - return days + ":" + hours + ":" + minutes + ':' + seconds;`},types:{date:"date",value:"string"},actions:{onRun:"setTimeout(() => $saveState({}), 1000)"}}}]},jv={id:"button",def:{id:"button",icon:"ui//mouse-pointer-click",description:H.frames.button.description},node:{icon:"ui//mouse-pointer-click",schemaId:"button",parentId:"",name:H.frames.button.label,rank:0,id:"button",type:"group",props:{icon:"",label:"",iconSize:"18",action:"",actionValue:""},types:{icon:"icon",iconSize:"number",label:"text",action:"option",actionValue:"super"},propsAttrs:{action:JSON.stringify({name:H.properties.super.whenClicked,icon:"ui//mouse-pointer-click"}),actionValue:JSON.stringify({name:H.properties.super.performAction})},propsValue:{icon:JSON.stringify({alias:"Icon"}),label:JSON.stringify({alias:"Label"}),iconSize:JSON.stringify({alias:"Icon Size"}),action:JSON.stringify({alias:"Action",options:[],source:"$super"}),actionValue:JSON.stringify({alias:"Action Properties",dynamic:!0,field:"action"})},actions:{onClick:"$api.commands.run(button.props.action, button.props.actionValue, $contexts, $saveState)"},styles:{class:"'mk-button'",gap:"'4px'"}},children:[{...Xa,node:{...Xa.node,props:{value:"button.props.icon"},styles:{"--icon-size":'button.props.iconSize+"px"'}}},{...mn,node:{...mn.node,props:{value:"button.props.label"}}}]},D9={id:"tabs",def:{id:"tabs",icon:"ui//tabs"},node:{icon:"ui//tabs",schemaId:"tabs",parentId:"",name:H.commands.tabs,rank:0,id:"tabs",type:"group",props:{currentTab:"0",tabs:"[{'name': 'Tab 1', 'view': ''}, {'name': 'Tab 2', 'view': ''}]"},propsValue:{tabs:JSON.stringify({alias:"Tabs",typeName:"Tab",type:{name:{type:"text",value:JSON.stringify({alias:"Label"})},view:{type:"link",value:JSON.stringify({alias:"Page"})}}}),currentTab:JSON.stringify({alias:"Selected Tab"})},types:{tabs:"object-multi",currentTab:"number"},styles:{layout:"'row'",width:"'100%'",gap:"'8px'"}},children:[ct({...E9,children:[ct({...k9,children:[ct(mn,{value:"listItem.props.value.name"},{padding:"'4px 8px'",color:"$root.props.currentTab == listItem.props._index ? 'var(--mk-ui-text-primary)' : 'var(--mk-ui-text-tertiary)'",borderBottom:"$root.props.currentTab == listItem.props._index ? '2px solid var(--mk-ui-active)' : 'none'"},{onClick:"$saveState({$root: {props: {currentTab: listItem.props._index}}})"})]},{})]},{value:"$root.props.tabs"},{layout:"'row'",columnGap:"'8px'",flexWrap:"'wrap'",rowGap:"'4px'"}),ct(Mo,{value:"$root.props.tabs[$root.props.currentTab].view"},{padding:"'0px'","--mk-expanded":"true","--mk-min-mode":"true"},{})]},xh={id:"field",def:{id:"field",description:H.frames.field.description},node:{schemaId:"field",parentId:"",name:H.frames.field.label,rank:0,id:"field",type:"group",props:{type:"",value:"",sticker:"",property:""},types:{value:"text",type:"text",sticker:"text",property:"object"},styles:{"--font-text-size":"'14px'",fontSize:"'14px'",hidden:"$root.props.value?.length == 0"}},children:[ct({...hn,children:[ct(mn,{value:"$root.props.value"},{padding:"'4px 8px'",borderRadius:"'4px'",background:"$api.properties.color($root.props.property, $root.props.value)",hidden:"$root.props.type != 'option'"}),ct(mn,{value:"$root.props.value"},{hidden:"$root.props.type != 'text' && $root.props.type != 'number' && $root.props.type != 'fileprop'"}),ct({...hn,children:[ct(Xa,{value:"'ui//check'"},{background:"'var(--mk-ui-active)'",width:"'16px'",height:"'16px'"}),ct(mn,{value:"$root.props.property?.name"})]},{},{layout:"'row'",gap:"'4px'",layoutAlign:"'w'",height:"'auto'",hidden:"$root.props.type != 'boolean'"}),ct(uf,{value:"$root.props.value"},{width:"'50px'",height:"'50px'",hidden:"$root.props.type != 'image'"}),ct(Xa,{value:"$root.props.value"},{hidden:"$root.props.type != 'icon'"}),ct(Mo,{value:"$root.props.value"},{hidden:"$root.props.type != 'link' && $root.props.type != 'file' && $root.props.type != 'context'",padding:"'0px'"})]},{},{layout:"'row'",layoutAlign:"'w'",height:"'auto'",gap:"'8px'",minHeight:"'24px'",hidden:"!($root.props.value?.length > 0) || $root.props.type?.contains('multi')"}),ct({...E9,children:[ct({...k9,children:[ct(mn,{value:"listItem.props.value"},{padding:"'4px 8px'",borderRadius:"'4px'",background:"$api.properties.color($root.props.property, listItem.props.value)",hidden:"$root.props.type != 'option-multi' && $root.props.type != 'tags'"}),ct(Mo,{value:"listItem.props.value"},{hidden:"$root.props.type != 'link-multi' && $root.props.type != 'context-multi'",padding:"'0px'"})]},{})]},{value:"$api.properties.value($root.props.type, $root.props.value)"},{layout:"'row'",columnGap:"'8px'",flexWrap:"'wrap'",rowGap:"'4px'",hidden:"!$root.props.type?.includes('multi')"})]},mD={id:"preview",def:{id:"preview"},node:{schemaId:"preview",parentId:"",name:"Preview",rank:0,id:"preview",type:"group",props:{path:"",width:'"50px"',height:"'50px'",radius:"'8px'",padding:"'16px'"},types:{path:"link",width:"text",height:"text",radius:"text",padding:"text"},styles:{background:"'var(--background-secondary)'",height:"$root.props.height",borderRadius:"$root.props.radius",overflow:"'hidden'"}},children:[ct(uf,{value:"$api.path.label(preview.props.path)?.thumbnail"},{width:"$root.props.width",height:"$root.props.height",hidden:"$api.path.label(preview.props.path)?.thumbnail?.length == 0",borderRadius:"$root.props.radius"}),ct(Xa,{value:"$api.path.label(preview.props.path)?.sticker"},{width:"$root.props.width",height:"$root.props.height",hidden:"$api.path.label(preview.props.path)?.thumbnail?.length > 0",borderRadius:"$root.props.radius",background:"$api.path.label(preview.props.path)?.color",padding:"$root.props.padding",overflow:"'hidden'"})]},O9={id:"rating",def:{id:"rating",icon:"ui//star"},node:{icon:"ui//star",schemaId:"rating",parentId:"",name:H.commands.rating,rank:0,id:"rating",type:"group",props:{value:"5",icon:"'ui//star'"},types:{value:"number",icon:"icon"},styles:{layout:"'row'",height:"'16px'"}},children:[ct(Xa,{value:"$root.props.icon"},{width:"$root.styles.height",height:"$root.styles.height",hidden:"$root.props.value < 1"}),ct(Xa,{value:"$root.props.icon"},{width:"$root.styles.height",height:"$root.styles.height",hidden:"$root.props.value < 2"}),ct(Xa,{value:"$root.props.icon"},{width:"$root.styles.height",height:"$root.styles.height",hidden:"$root.props.value < 3"}),ct(Xa,{value:"$root.props.icon"},{width:"$root.styles.height",height:"$root.styles.height",hidden:"$root.props.value < 4"}),ct(Xa,{value:"$root.props.icon"},{width:"$root.styles.height",height:"$root.styles.height",hidden:"$root.props.value < 5"})]},M9={id:"callout",def:{id:"callout",icon:"ui//callout"},node:{icon:"ui//callout",schemaId:"callout",parentId:"",name:H.commands.callout,rank:0,id:"callout",type:"group",props:{icon:"",note:""},types:{icon:"icon",note:"link"},styles:{borderRadius:"'8px'",background:"'var(--mk-ui-background-contrast)'",width:"'100%'",layout:"'row'",gap:"'8px'",padding:"'16px'"}},children:[ct(Xa,{value:"callout.props.icon"},{width:"'18px'",height:"'18px'"}),ct({...mc,children:[ct(Mo,{value:"callout.props.note"},{width:"'100%'","--mk-expanded":"true","--mk-min-mode":"true"})]},{},{width:"'auto'",flex:"'1'"})]},j9={id:"toggle",def:{id:"toggle",icon:"ui//collapse-solid",description:H.frames.toggle.description},node:{icon:"ui//collapse-solid",schemaId:"toggle",parentId:"",name:H.commands.toggle,rank:0,id:"toggle",type:"group",props:{value:"false",label:"",note:""},types:{value:"boolean",label:"text",note:"link"},styles:{width:"'100%'"}},children:[ct({...Mv,children:[ct({...Rc,children:[ct({...Ui,node:{...Ui.node,ref:"icon"}},{},{transform:"'rotate(90deg)'"})]},{value:"true"}),ct({...Rc,children:[ct({...Ui,node:{...Ui.node,ref:"icon"}},{},{transform:"'rotate(0deg)'"})]},{value:"false"})]},{value:"'value'"}),ct({...hn,children:[{...Xa,node:{...Xa.node,props:{value:"'ui//collapse-solid'"},styles:{width:"'16px'",height:"'16px'",transform:"'rotate(90deg)'"},actions:{onClick:"$saveState({ toggle: {props: { value: !toggle.props.value }} })"}}},{...mn,node:{...mn.node,props:{value:"toggle.props.label"}}}]},{},{height:"'auto'",layoutAlign:"'w'",gap:"'8px'",layout:"'row'"}),ct({...mc,children:[ct(Mo,{value:"toggle.props.note"},{width:"'auto'",flex:"'1'","--mk-expanded":"true","--mk-min-mode":"true"})]},{},{paddingLeft:"'24px'",hidden:"!toggle.props.value"})]},N9={id:"progress",def:{id:"progress",icon:"ui//pie-chart"},node:{icon:"ui//pie-chart",schemaId:"progress",parentId:"",name:H.commands.progress,rank:0,id:"progress",type:"group",props:{value:"50",max:"100",color:"'var(--background-modifier-form-field)'",backgroundColor:"'var(--color-orange)'"},types:{value:"number",max:"number",color:"color",backgroundColor:"color"},styles:{background:"$root.props.color",height:"'10px'",width:"'100px'",borderRadius:"'5px'"}},children:[{...hn,node:{...hn.node,styles:{width:"$root.props.value/$root.props.max*100+'%'",height:"'100%'",borderRadius:"'5px'",background:"$root.props.backgroundColor",display:"'block'"}}}]},T9={id:"circularProgress",def:{id:"circularProgress",icon:"ui//pie-chart"},node:{icon:"ui//pie-chart",schemaId:"circularProgress",parentId:"",name:H.commands.circularProgress,rank:0,id:"circularProgress",type:"group",props:{value:"50",max:"100",color:"'var(--color-orange)'",backgroundColor:"'var(--background-modifier-form-field)'",ringWidth:"5"},types:{value:"number",color:"color",max:"number",backgroundColor:"color",ringWidth:"number"},styles:{height:"'100px'",width:"'100px'"}},children:[ct(hn,{},{background:"`conic-gradient(${$root.props.color} ${$root.props.value/$root.props.max*100}%, ${$root.props.backgroundColor} 0)`",maskImage:"`radial-gradient(circle calc(calc(${$root.styles.width} - ${$root.props.ringWidth}px) / 2) at calc(50%) calc(50%),transparent 100%,black 0%)`",height:"'100%'",width:"'100%'",borderRadius:"'50%'"})]},spr={id:"card",def:{id:"card",icon:"ui//mouse-pointer-click"},node:{icon:"ui//mouse-pointer-click",schemaId:"card",parentId:"",name:H.commands.card,rank:0,id:"card",type:"group",props:{icon:"",label:""},types:{icon:"icon",label:"text"},actions:{},styles:{borderRadius:"'10px'",background:"'var(--background-primary-alt)'",width:"'160px'",height:"'80px'",padding:"'16px'",border:"'thin solid var(--mk-ui-divider)'"}},children:[{...Xa,node:{...Xa.node,props:{value:"card.props.icon"}}},{...mn,node:{...mn.node,props:{value:"card.props.label"}}}]},NEe={id:"link",def:{id:"link",icon:"ui//link"},node:{icon:"ui//link",schemaId:"link",parentId:"",name:H.commands.link,rank:0,id:"link",type:"group",props:{link:"",label:"$api.path.label(link.props.link)?.name",sticker:"$api.path.label(link.props.link)?.sticker"},styles:{class:"'mk-a'",layout:'"row"'},actions:{onClick:"$api.path.open(link.props.link, false)"},types:{link:"link",label:"text",sticker:"sticker"}},children:[{...Xa,node:{...Xa.node,props:{value:"link.props.sticker"},styles:{width:"'18px'",height:"'18px'"}}},{...mn,node:{...mn.node,props:{value:"link.props.label"}}}]};var Wi=(0,Tl.createContext)({root:null,nodes:[],properties:[],groupNodes:()=>null,ungroupNode:()=>null,addNode:()=>null,deleteNode:()=>null,saveNodes:()=>null,moveUp:()=>null,moveDown:()=>null,moveToRank:()=>null,moveNodeFromSchema:()=>null,selectedSlide:null,setSelectedSlide:()=>null,updateNode:()=>null,frameProperties:[],lastCreatedId:null,setLastCreatedId:()=>null}),FEe=e=>{let{spaceInfo:t}=(0,Tl.useContext)(ur),[r,n]=(0,Tl.useState)(null),[i,a]=(0,Tl.useState)(null),{frameSchema:o,saveFrame:s,frameSchemas:l,tableData:u,getMDBData:c}=(0,Tl.useContext)(ma),f=(0,Tl.useMemo)(()=>{if(!o)return[];let D=u?.rows.map(q=>q.id==o.id?{...W1(q),types:u.cols.reduce((z,I)=>({...z,[I.name]:I.type}),{}),propsValue:u.cols.reduce((z,I)=>({...z,[I.name]:I.value}),{})}:W1(q))??[],P=sL(o);return D.some(q=>q.id==P.id)?D:[...D,P]},[u,o]),[d,p]=(0,Tl.useState)(null),h=(0,Tl.useMemo)(()=>{let D=[...d0(e.superstate.settings)];return d?.id?[...u?.cols.map(P=>({...P,table:""}))??[],...(e.cols??[]).map(P=>({...P,schemaId:d.id}))].filter(P=>D.some(q=>q==P.name)==!1):[]},[d,e.cols]),m=async()=>{if(o?.type=="frame"){let D=await lL(o,[...u?.cols??[],...(e.cols??[]).map(P=>({...P,schemaId:o.id}))],f,e.superstate,{editMode:e.editMode,screenType:e.superstate.ui.getScreenType()});ij(D,d)&&p(D)}},g=D=>{D.path==t.path&&(!D.schemaId||D.schemaId==o?.id)&&m()};(0,Tl.useEffect)(()=>(e.superstate.eventsDispatcher.addListener("frameStateUpdated",g),()=>{e.superstate.eventsDispatcher.removeListener("frameStateUpdated",g)}),[t]),(0,Tl.useEffect)(()=>{m()},[o,f,u,e.editMode]);let A=(D,P)=>{let q=f.find(z=>z.id==D.id);if(!!q)if(r){let z=f.find(I=>I.parentId==r&&I.ref==q.id);z?j([{...z,props:P.props?{...z.props,...P.props}:z.props,styles:P.styles?{...z.styles,...P.styles}:z.styles,actions:P.actions?{...z.actions,...P.actions}:z.actions}]):k({...Ui.node,ref:q.id,...P},f.find(I=>I.id==r),!0)}else j([{...q,props:P.props?{...q.props,...P.props}:q.props,styles:P.styles?{...q.styles,...P.styles}:q.styles,actions:P.actions?{...q.actions,...P.actions}:q.actions}])},b=D=>{let P=f.filter(T=>T.parentId==D.parentId).sort((T,L)=>T.rank-L.rank).map((T,L)=>({...T,rank:L})),q=P.findIndex(T=>T.id===D.id);if(q<=0){j(P);return}let z=P[q],I=P[q-1];[z.rank,I.rank]=[I.rank,z.rank],j(P)},v=D=>{let P=f.filter(T=>T.parentId==D.parentId).sort((T,L)=>T.rank-L.rank).map((T,L)=>({...T,rank:L})),q=P.findIndex(T=>T.id===D.id);if(q<0||q>=P.length-1){j(P);return}let z=P[q],I=P[q+1];[z.rank,I.rank]=[I.rank,z.rank],j(P.sort((T,L)=>T.rank-L.rank))},x=D=>{let P=f.filter(T=>T.parentId==D.id),q=D.rank,z=f.filter(T=>T.parentId==D.parentId).sort((T,L)=>T.rank-L.rank),I=Dx(z,q,P.map(T=>({...T,parentId:D.parentId}))).filter(T=>T.id!=D.id).map((T,L)=>({...T,rank:L}));return j(I,[D])},w=(D,P)=>{let q=f.filter(L=>L.parentId==D.parentId).sort((L,_)=>L.rank-_.rank).map((L,_)=>({...L,rank:_})),z=q.findIndex(L=>L.id===D.id);if(z<0||P<0||P>=q.length){j(q);return}let I=q[z];I.rank=P;let T=Ws(q,z,P).map((L,_)=>({...L,rank:_}));j(T)},S=(D,P)=>{let q=D[0].id==o.id?"":D[0].parentId,z={...z1(hn,q,f,o.id)},I=D.map(T=>{let L=TEe.default.cloneDeep(T);return L.parentId=z.id,L});j([{...z,styles:{...z.styles,...P}},...I])},k=async(D,P,q)=>{let z=sf("$root",o.id,D,o.id),I=Mi(z.id,f.map(oe=>oe.id));z=sf(D.id,I,D,o.id);let T=P||d.node,L=P?P.rank+1:T.rank;!q||!jEe.some(oe=>T.type==oe)?T=pc(d,T.id).node:L=f.filter(oe=>oe.parentId==T.id).length;let _={...z,id:I,schemaId:o.id,parentId:T.id},Y=Cx(f.filter(oe=>oe.parentId==T.id).sort((oe,te)=>oe.rank-te.rank),L,_).map((oe,te)=>({...oe,rank:te}));return await j(Y).then(oe=>_)},j=async(D,P)=>{if(!u)return;let q=u?.rows?.some(L=>L.id==d.id)?u.rows:[...u?.rows??[],lf(d.node)],z=D.filter(L=>!q.some(_=>_.id==L.id)).map(L=>lf(L)),I=D.filter(L=>q.some(_=>_.id==L.id)).map(L=>lf(L)),T={...u,cols:u.cols??[],rows:[...q.map(L=>I.find(_=>_.id==L.id)??L),...z].filter(L=>P?!P.some(_=>_.id==L.id):L)};await s(T)},O=async(D,P,q,z)=>{let I=await c();if(!I[P])return;let T=I[P].rows.map(Q=>W1(Q)),L=l.find(Q=>Q.id==P),_=T.find(Q=>Q.id==D);if(!L||!_)return;let Y=await Ok(_,T,e.superstate,0,!1,{editMode:e.editMode}).then(Q=>Q[0]),oe=H1(Y,Y.node.schemaId),te=oe.map(Q=>({...Q,schemaId:o.id,styles:Q.id==D&&z?{...Q.styles,...z}:Q.styles,parentId:Q.id==D?q:Q.parentId}));await s({...I[o.id],rows:I[o.id].rows.filter(Q=>!oe.some(fe=>Q.schemaId==fe.schemaId&&Q.id==fe.id))}),await s({...u,rows:[...u.rows,...te.map(Q=>lf(Q))]})},C=async D=>{let P=await Ok(D,f,e.superstate,0,!1,{editMode:e.editMode},!0).then(T=>T[0]),q=pc(d,D.id),z=[],I=H1(P,P.node.schemaId);if(q){q.children.length==1&&q.node.type=="column"&&I.push(q.node);let T=pc(d,q.id);T?.node.type=="container"&&(T.children.length==1?I.push(T.node):T.children.filter(L=>L.node.type=="column").length==1&&(T.children.forEach(L=>{L.node.type!="column"&&z.push({...L.node,parentId:T.node.parentId})}),I.push(T.node)))}s({...u,rows:u.rows.filter(T=>!I.some(L=>T.schemaId==L.schemaId&&T.id==L.id)).map(T=>z.find(L=>L.id==T.id)?lf(z.find(L=>L.id==T.id)):T)})},N=u?.cols??[];return Tl.default.createElement(Wi.Provider,{value:{root:d,nodes:f,properties:N,addNode:k,deleteNode:C,saveNodes:j,ungroupNode:x,moveUp:b,moveDown:v,moveToRank:w,moveNodeFromSchema:O,groupNodes:S,selectedSlide:r,setSelectedSlide:n,updateNode:A,frameProperties:h,lastCreatedId:i,setLastCreatedId:a}},e.children)};var ib=Ae(Te());var PY=ib.default.createContext({root:null,path:null}),F9=e=>{let[t,r]=(0,ib.useState)(null),n=i=>{if(!(i.path!=e.path.basePath&&e.path.authority!="$kit")){if(e.path.authority=="$kit"){r(e.superstate.kitFrames.get(e.path.ref));return}e.superstate.spaceManager.readFrame(e.path.basePath,e.path.ref).then(a=>rj(e.superstate,a,{...c0,screenType:e.superstate.ui.getScreenType()})).then(a=>r(a))}};return(0,ib.useEffect)(()=>(e.superstate.eventsDispatcher.addListener("frameStateUpdated",n),n({path:e.path.basePath}),()=>{e.superstate.eventsDispatcher.removeListener("frameStateUpdated",n)}),[e.path]),ib.default.createElement(PY.Provider,{value:{root:t,path:e.path.fullPath}},e.children)};var _i=(0,Wa.createContext)({id:"",hoverNode:{id:null,node:"",direction:null},setHoverNode:e=>null,selectableNodeBounds:{current:{}},runRoot:()=>null,instance:null,saveState:(e,t)=>null,fastSaveState:e=>null,linkedProps:[]}),ug=e=>{let[t,r]=(0,Wa.useState)(null),[n,i]=(0,Wa.useState)({state:{},id:null,root:null,exec:null,slides:{},contexts:{}}),[a,o]=(0,Wa.useState)(e.props);(0,Wa.useEffect)(()=>{o(x=>Nv.default.isEqual(x,e.props)?x:e.props)},[e.props]);let{selectedSlide:s}=(0,Wa.useContext)(Wi),l=e.editable?s:null,{root:u}=(0,Wa.useContext)(Wi),{root:c,path:f}=(0,Wa.useContext)(PY),d=(0,Wa.useMemo)(()=>e.editable?u:c,[e.editable,u,c]),p=(0,Wa.useRef)(null),h=(0,Wa.useRef)(null),m=(0,Wa.useMemo)(()=>Object.keys(e.propSetters||{}),[e.propSetters]),g=(x,w)=>{let{root:S,exec:k,id:j,state:O}=w;if(Tte(x,"$root",k.id),p.current!=j)return;let{$api:C,...N}=O;KB(k,{state:O,newState:oL(x,a,k.id),prevState:Nv.default.cloneDeep(N),slides:{}},{api:e.superstate.api,saveState:g,root:S,contexts:e.contexts,runID:j,selectedSlide:l,exec:k}).then(D=>{i(P=>D)})};(0,Wa.useEffect)(()=>{n?.root&&e.propSetters&&ere(Object.keys(e.propSetters),a,n.state,n.root.id).forEach(x=>{e.propSetters[x](n.state[n.root.id].props[x])})},[n]);let A=(0,Wa.useRef)({}),b=x=>{i(w=>({...w,state:x}))};(0,Wa.useEffect)(()=>()=>{p.current=null},[]);let v=()=>{if(d){let x=Nv.default.cloneDeep(d),w=(0,Nv.uniqueId)();p.current=w,KB(x,{prevState:{},state:{},newState:oL({},a,x.id),slides:{}},{api:e.superstate.api,contexts:e.contexts,saveState:g,root:d,exec:x,runID:w,selectedSlide:l}).then(S=>{i(k=>S),p.current=S.id})}};return(0,Wa.useEffect)(()=>{n.root&&!ij(d,n.root)&&(0,Nv.isEqual)(e.contexts,n.contexts)?g({[n.root.id]:{props:a}},n):v()},[a,d,e.contexts]),Wa.default.createElement(_i.Provider,{value:{id:e.id,linkedProps:m,hoverNode:t,setHoverNode:r,selectableNodeBounds:A,runRoot:v,instance:n,saveState:g,fastSaveState:b}},e.children)};var Hi=(0,Fl.createContext)({selectable:!1,selected:!1,selection:[],selectionMode:0,select:(e,t)=>null,selectMulti:(e,t)=>null,deselect:e=>null,isParentToSelection:!1,setIsParentToSelection:e=>null,id:""}),Tv=e=>{let{selection:t,selectionMode:r,setIsParentToSelection:n}=(0,Fl.useContext)(Hi),{spaceState:i}=(0,Fl.useContext)(ur),a=(0,Fl.useMemo)(()=>t.includes(e.id)||e.selected,[t,e.id,e.selected]),o=(0,Fl.useMemo)(()=>i?.metadata.readMode?0:e.editMode??0,[e.editMode,i]),{instance:s}=(0,Fl.useContext)(_i),[l,u]=(0,Fl.useState)([]),[c,f]=(0,Fl.useState)(!1),d=(0,Fl.useMemo)(()=>!!(l.length>0||c||a&&o>=3||o==1),[a,o,l,c]);(0,Fl.useEffect)(()=>{let g=A=>{A!=e.id&&(u([]),f(!1))};return e.superstate.ui.addResetFunction(g),()=>{e.superstate.ui.removeResetFunction(g)}},[u,f]);let p=(g,A)=>{if(o==0)return;let b=l;if(e.superstate.ui.resetSelection(e.id),!g){u([]);return}A?(u(v=>[...l.filter(x=>x!=g),g]),n(!0)):(u([g]),n(!0))},h=(g,A)=>{if(o==0)return;let b=l;e.superstate.ui.resetSelection(e.id),A?(u(v=>[...l.filter(x=>!g.some(w=>w==x)),...g]),n(!0)):(u([...g]),n(!0))},m=g=>{o!=0&&u(A=>A.filter(b=>b!=g))};return Fl.default.createElement(Hi.Provider,{value:{selectable:d,selected:a,selection:l,selectionMode:o,select:p,selectMulti:h,isParentToSelection:c,deselect:m,setIsParentToSelection:f,id:e.id}},e.children)};var sCe=Ae(yi());var ta=Ae(Te());var cg=(e,t)=>{let r=t.substring(0,1)==="#",n=(r?t.substring(1):t).split(""),i=n.length>3,a=[],o=0,s=3;for(a.push(n.shift()+(i?n.shift():"")),a.push(n.shift()+(i?n.shift():"")),a.push(n.shift()+(i?n.shift():""));o({label:{name:H.metadataTypes.label,properties:_Ee},file:{name:H.metadataTypes.fileMetadata,properties:PEe},path:{name:H.metadataTypes.outlinks,properties:IEe},frontmatter:{name:H.metadataTypes.frontmatter,properties:e.spaceManager.keysForCacheType("frontmatter").map(t=>({id:"frontmatter."+t,label:t,field:t,vType:"any",defaultFilter:"contains",type:"frontmatter",description:"Frontmatter property"}))},context:{name:H.metadataTypes.contexts,properties:[...e.contextsIndex.values()].flatMap(t=>t?.contextTable?.cols.filter(r=>r.primary!="true").map(r=>({id:"contexts."+t.path+"."+r.name,label:r.name,field:t.path+"."+r.name,vType:ho(r),defaultFilter:"contains",type:"context",description:t.path+" context property"})))}});var G6e=Ae(yi());var br=Ae(Te()),Q6e=Ae(Ya());var aJe=(e,t,r)=>t.reduce((i,a)=>{let[o,s]=i,l=a.type=="context"?BEe(s,a,r):a.type=="path"?$Ee(s,a,r):a.type=="frontmatter"?REe(s,a,r):qEe(s,a,r),u=s.filter(c=>!l.includes(c));return[[...o,...l],u]},[[],e])[0],oJe=(e,t,r)=>t.reduce((n,i)=>i.type=="context"?BEe(n,i,r):i.type=="path"?$Ee(n,i,r):i.type=="frontmatter"?REe(n,i,r):qEe(n,i,r),e),BEe=(e,t,r)=>{let n=qi[t.fn];return!n||n.valueType!="none"&&t.value.length==0?[]:e.filter(i=>{let[a,o]=t.field.split("."),s=i.metadata?.property;if(!i.spaces?.includes(a)||!s||!s[o])return!1;let l=!0;if(n){let u=t.fType=="property"?r[t.value]:t.value;l=n.fn(Ri(o,s[o]),u)}return l})},REe=(e,t,r)=>{let n=qi[t.fn];return!n||n.valueType!="none"&&t.value.length==0?[]:e.filter(i=>{let a=i.metadata?.property;if(!a||a[t.field]===void 0)return!1;let o=!0;if(n){let s=t.fType=="property"?r[t.value]:t.value;o=n.fn(Ri(t.field,a[t.field]),s)}return o})},$Ee=(e,t,r)=>{let n=qi[t.fn];return!n||n.valueType!="none"&&t.value.length==0?[]:e.filter(i=>{let a="";t.field=="outlinks"?a=Bi(i.outlinks??[]):t.field=="inlinks"?a=Bi(i.metadata?.inlinks??[]):t.field=="tags"&&(a=Bi(i.tags??[]));let o=!0;if(n){let s=t.fType=="property"?r[t.value]:t.value;o=n.fn(a,s)}return o})},qEe=(e,t,r)=>{let n=qi[t.fn];return!n||n.valueType!="none"&&t.value.length==0?[]:e.filter(i=>{let a=!0;if(n){let o=t.fType=="property"?r[t.value]:t.value;a=n.fn(i.metadata?.[t.type]?.[t.field],o)}return a})},P9=(e,t,r)=>e.reduce((i,a)=>!i||a.filters.length==0?!1:a.type=="any"?aJe([t],a.filters,r).length>0:oJe([t],a.filters,r).length>0,!0);function LEe(e){let{query:t,pathsIndex:r,count:n}=e,i=[],a={shouldSort:!0,threshold:0,ignoreLocation:!0,keys:[{name:"name",weight:2},"path","label.preview",{name:"spaceNames",weight:.5}]};return new Vp([...r.values()].filter(s=>s.hidden==!1),a).search(t).map(s=>s.item).slice(0,n)}function zEe(e){let{queries:t,pathsIndex:r,count:n}=e,i=[];for(let[a,o]of r)!o.hidden&&P9(t,o,{})&&i.push(o);return i.slice(0,n)}var Lc=Ae(Te());var ea=Ae(Te());var I9=Ae(Te());var B9=e=>{let t=r=>{let n=r.target.getBoundingClientRect();e.superstate.ui.openMenu(n,{ui:e.superstate.ui,editable:!0,value:[e.value],options:e.options,saveOptions:(i,a)=>{e.selectValue(a[0])}},Ne(r.view.document))};return I9.default.createElement("div",{className:"mk-cell-option-item",onClick:r=>e.triggerMenu?e.triggerMenu(r):t(r)},I9.default.createElement("div",null,e.options?e.options.find(r=>r.value==e.value)?.name:e.value),I9.default.createElement("div",{className:"mk-cell-option-select mk-icon-xxsmall mk-icon-rotated",dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//collapse-solid")}}))};var R9=Ae(Te());var Ko=Ae(Te());var Fv=Ae(Te());var UEe=e=>{let t=(0,Fv.useMemo)(()=>e.fields.map(i=>({id:i.name,field:i.name,vType:i.type,label:i.name,defaultFilter:"is",type:"property",description:""})),[]),r=n=>{let i={superstate:e.superstate,saveFormula:a=>e.saveTree({...e.actionTree,props:{...e.actionTree.props,$function:a}}),formula:e.actionTree.props.$function,value:e.values,fields:e.fields,path:e.path};e.superstate.ui.openCustomMenu(n.target.getBoundingClientRect(),Fv.default.createElement(Ah,{...i}),{...i},Ne(n.view.document),"bottom")};return e.command.schema.id=="formula"?Fv.default.createElement("button",{onClick:n=>r(n)},"Edit Formula"):e.command.schema.id=="filter"?Fv.default.createElement(E2,{superstate:e.superstate,filters:e.actionTree.props.$function??[],setFilters:n=>{e.saveTree({...e.actionTree,props:{...e.actionTree.props,$function:n}})},fields:t,sections:[],removeable:!0}):Fv.default.createElement(Fv.default.Fragment,null)};var IY=e=>{let[t,r]=Ko.default.useState(e.actionTree?.action),n=(0,Ko.useMemo)(()=>e.superstate.cli.commandForAction(t),[t]);(0,Ko.useEffect)(()=>{r(e.actionTree?.action)},[e.actionTree]);let i=(o,s)=>{let l=[...bq(e.superstate,e.path)],u=[...new Set(l.map(f=>f.section))].map(f=>({name:f,value:f})),c=o.target.getBoundingClientRect();e.superstate.ui.openMenu(c,{ui:e.superstate.ui,editable:!0,value:[t],options:l,sections:u,showSections:!0,saveOptions:(f,d)=>{if(s){e.saveTree({...e.actionTree,children:[...e.actionTree.children,{action:d[0],props:{},propsValue:{},children:[]}]});return}e.saveTree({...e.actionTree,action:d[0]})}},Ne(o.view.document))},a=(o,s)=>{let l=e.fields.map(c=>({name:c.name,value:c.name})),u=o.target.getBoundingClientRect();e.superstate.ui.openMenu(u,{ui:e.superstate.ui,editable:!0,value:[],options:l,saveOptions:(c,f)=>{e.saveTree({...e.actionTree,linked:{...e.actionTree.linked,[s]:f[0]}})}},Ne(o.view.document))};return Ko.default.createElement("div",{className:"mk-editor-actions-node"},Ko.default.createElement("div",{className:"mk-editor-actions-body"},Ko.default.createElement("div",{className:"mk-editor-actions-name"},Ko.default.createElement("div",{className:"mk-path-icon",dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker(n?Ix(n.schema):"ui//plus")}}),Ko.default.createElement("div",{onClick:o=>!n&&i(o),className:"mk-editor-actions-selector"},n?.schema.name??"Select"),Ko.default.createElement("span",null),e.deleteTree&&Ko.default.createElement("div",{className:"mk-icon-small",onClick:o=>e.deleteTree(),dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//close")}})),n&&Ko.default.createElement("div",{className:"mk-editor-actions-fields"},n.schema.type=="builtin"?Ko.default.createElement(UEe,{superstate:e.superstate,command:n,actionTree:e.actionTree,saveTree:e.saveTree,fields:[...e.fields,e.prevField].filter(o=>o),values:e.values,path:e.path}):n?.fields.map((o,s)=>Ko.default.createElement(bs,{key:s,superstate:e.superstate,column:o,columns:e.fields,initialValue:e.actionTree.props[o.name],updateValue:l=>{let u={...e.actionTree};u.props[o.name]=l,e.saveTree(u)},updateFieldValue:(l,u)=>{let c={...e.actionTree};c.props[o.name]=u,c.propsValue[o.name]=l,e.saveTree(c)},editMode:5,linkProp:l=>a(l,o.name)})))),Ko.default.createElement("div",{className:e.hasSiblings?"mk-editor-actions-children":""},e.actionTree.children.map((o,s)=>Ko.default.createElement(IY,{key:s,hasSiblings:e.actionTree.children.length>1,prevField:n?.fields[s],superstate:e.superstate,path:e.path,fields:e.fields,actionTree:o,saveTree:l=>{let u={...e.actionTree};u.children[s]=l,e.saveTree(u)},values:e.values,deleteTree:()=>{let l={...e.actionTree};l.children.splice(s,1),e.saveTree(l)}})),e.actionTree.children.length==0&&Ko.default.createElement("button",{onClick:o=>i(o,!0),className:"mk-inline-button"},Ko.default.createElement("div",{className:"mk-icon-xsmall",dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//plus")}}),"Add Step")))};var WEe=e=>{let[t,r]=R9.default.useState(HQ(e.formula)??{action:"",props:{},propsValue:{},children:[]});return R9.default.createElement("div",{className:"mk-editor-actions-nodes"},R9.default.createElement(IY,{hasSiblings:!1,superstate:e.superstate,prevField:null,actionTree:t,path:e.path,fields:e.fields,values:e.value,saveTree:n=>{e.saveFormula(JSON.stringify(n)),r(n)}}))};var V2=Ae(Te());var sJe=0,hD=class{constructor(t,r){this.from=t,this.to=r}},Pi=class{constructor(t={}){this.id=sJe++,this.perNode=!!t.perNode,this.deserialize=t.deserialize||(()=>{throw new Error("This node type doesn't define a deserialize function")})}add(t){if(this.perNode)throw new RangeError("Can't add per-node props to node types");return typeof t!="function"&&(t=$c.match(t)),r=>{let n=t(r);return n===void 0?null:[this,n]}}};Pi.closedBy=new Pi({deserialize:e=>e.split(" ")});Pi.openedBy=new Pi({deserialize:e=>e.split(" ")});Pi.group=new Pi({deserialize:e=>e.split(" ")});Pi.contextHash=new Pi({perNode:!0});Pi.lookAhead=new Pi({perNode:!0});Pi.mounted=new Pi({perNode:!0});var lJe=Object.create(null),$c=class{constructor(t,r,n,i=0){this.name=t,this.props=r,this.id=n,this.flags=i}static define(t){let r=t.props&&t.props.length?Object.create(null):lJe,n=(t.top?1:0)|(t.skipped?2:0)|(t.error?4:0)|(t.name==null?8:0),i=new $c(t.name||"",r,t.id,n);if(t.props){for(let a of t.props)if(Array.isArray(a)||(a=a(i)),a){if(a[0].perNode)throw new RangeError("Can't store a per-node prop on a node type");r[a[0].id]=a[1]}}return i}prop(t){return this.props[t.id]}get isTop(){return(this.flags&1)>0}get isSkipped(){return(this.flags&2)>0}get isError(){return(this.flags&4)>0}get isAnonymous(){return(this.flags&8)>0}is(t){if(typeof t=="string"){if(this.name==t)return!0;let r=this.prop(Pi.group);return r?r.indexOf(t)>-1:!1}return this.id==t}static match(t){let r=Object.create(null);for(let n in t)for(let i of n.split(" "))r[i]=t[n];return n=>{for(let i=n.prop(Pi.group),a=-1;a<(i?i.length:0);a++){let o=r[a<0?n.name:i[a]];if(o)return o}}}};$c.none=new $c("",Object.create(null),0,8);var D2=class{constructor(t){this.types=t;for(let r=0;r=i&&(o.type.isAnonymous||r(o)!==!1)){if(o.firstChild())continue;s=!0}for(;s&&n&&!o.type.isAnonymous&&n(o),!o.nextSibling();){if(!o.parent())return;s=!0}}}prop(t){return t.perNode?this.props?this.props[t.id]:void 0:this.type.prop(t)}get propValues(){let t=[];if(this.props)for(let r in this.props)t.push([+r,this.props[r]]);return t}balance(t={}){return this.children.length<=8?this:qY($c.none,this.children,this.positions,0,this.children.length,0,this.length,(r,n,i)=>new Pl(this.type,r,n,i,this.propValues),t.makeTree||((r,n,i)=>new Pl($c.none,r,n,i)))}static build(t){return uJe(t)}};Pl.empty=new Pl($c.none,[],[],0);var AD=class{constructor(t,r){this.buffer=t,this.index=r}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}get pos(){return this.index}next(){this.index-=4}fork(){return new AD(this.buffer,this.index)}},fg=class{constructor(t,r,n){this.buffer=t,this.length=r,this.set=n}get type(){return $c.none}toString(){let t=[];for(let r=0;r0));l=o[l+3]);return s}slice(t,r,n,i){let a=this.buffer,o=new Uint16Array(r-t);for(let s=t,l=0;s=t&&rt;case 1:return r<=t&&n>t;case 2:return n>t;case 4:return!0}}function QEe(e,t){let r=e.childBefore(t);for(;r;){let n=r.lastChild;if(!n||n.to!=r.to)break;n.type.isError&&n.from==n.to?(e=r,r=n.prevSibling):r=n}return e}function O2(e,t,r,n){for(var i;e.from==e.to||(r<1?e.from>=t:e.from>t)||(r>-1?e.to<=t:e.to0?s.length:-1;t!=u;t+=r){let c=s[t],f=l[t]+o.from;if(!!GEe(i,n,f,f+c.length)){if(c instanceof fg){if(a&_l.ExcludeBuffers)continue;let d=c.findChild(0,c.buffer.length,r,n-f,i);if(d>-1)return new wh(new BY(o,c,t,f),null,d)}else if(a&_l.IncludeAnonymous||!c.type.isAnonymous||$Y(c)){let d;if(!(a&_l.IgnoreMounts)&&c.props&&(d=c.prop(Pi.mounted))&&!d.overlay)return new im(d.tree,f,t,o);let p=new im(c,f,t,o);return a&_l.IncludeAnonymous||!p.type.isAnonymous?p:p.nextChild(r<0?c.children.length-1:0,r,n,i)}}}if(a&_l.IncludeAnonymous||!o.type.isAnonymous||(o.index>=0?t=o.index+r:t=r<0?-1:o._parent._tree.children.length,o=o._parent,!o))return null}}get firstChild(){return this.nextChild(0,1,0,4)}get lastChild(){return this.nextChild(this._tree.children.length-1,-1,0,4)}childAfter(t){return this.nextChild(0,1,t,2)}childBefore(t){return this.nextChild(this._tree.children.length-1,-1,t,-2)}enter(t,r,n=0){let i;if(!(n&_l.IgnoreOverlays)&&(i=this._tree.prop(Pi.mounted))&&i.overlay){let a=t-this.from;for(let{from:o,to:s}of i.overlay)if((r>0?o<=a:o=a:s>a))return new im(i.tree,i.overlay[0].from+this.from,-1,this)}return this.nextChild(0,1,t,r,n)}nextSignificantParent(){let t=this;for(;t.type.isAnonymous&&t._parent;)t=t._parent;return t}get parent(){return this._parent?this._parent.nextSignificantParent():null}get nextSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index+1,1,0,4):null}get prevSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index-1,-1,0,4):null}cursor(t=0){return new M2(this,t)}get tree(){return this._tree}toTree(){return this._tree}resolve(t,r=0){return O2(this,t,r,!1)}resolveInner(t,r=0){return O2(this,t,r,!0)}enterUnfinishedNodesBefore(t){return QEe(this,t)}getChild(t,r=null,n=null){let i=L9(this,t,r,n);return i.length?i[0]:null}getChildren(t,r=null,n=null){return L9(this,t,r,n)}toString(){return this._tree.toString()}get node(){return this}matchContext(t){return z9(this,t)}};function L9(e,t,r,n){let i=e.cursor(),a=[];if(!i.firstChild())return a;if(r!=null){for(;!i.type.is(r);)if(!i.nextSibling())return a}for(;;){if(n!=null&&i.type.is(n))return a;if(i.type.is(t)&&a.push(i.node),!i.nextSibling())return n==null?a:[]}}function z9(e,t,r=t.length-1){for(let n=e.parent;r>=0;n=n.parent){if(!n)return!1;if(!n.type.isAnonymous){if(t[r]&&t[r]!=n.name)return!1;r--}}return!0}var BY=class{constructor(t,r,n,i){this.parent=t,this.buffer=r,this.index=n,this.start=i}},wh=class{constructor(t,r,n){this.context=t,this._parent=r,this.index=n,this.type=t.buffer.set.types[t.buffer.buffer[n]]}get name(){return this.type.name}get from(){return this.context.start+this.context.buffer.buffer[this.index+1]}get to(){return this.context.start+this.context.buffer.buffer[this.index+2]}child(t,r,n){let{buffer:i}=this.context,a=i.findChild(this.index+4,i.buffer[this.index+3],t,r-this.context.start,n);return a<0?null:new wh(this.context,this,a)}get firstChild(){return this.child(1,0,4)}get lastChild(){return this.child(-1,0,4)}childAfter(t){return this.child(1,t,2)}childBefore(t){return this.child(-1,t,-2)}enter(t,r,n=0){if(n&_l.ExcludeBuffers)return null;let{buffer:i}=this.context,a=i.findChild(this.index+4,i.buffer[this.index+3],r>0?1:-1,t-this.context.start,r);return a<0?null:new wh(this.context,this,a)}get parent(){return this._parent||this.context.parent.nextSignificantParent()}externalSibling(t){return this._parent?null:this.context.parent.nextChild(this.context.index+t,t,0,4)}get nextSibling(){let{buffer:t}=this.context,r=t.buffer[this.index+3];return r<(this._parent?t.buffer[this._parent.index+3]:t.buffer.length)?new wh(this.context,this._parent,r):this.externalSibling(1)}get prevSibling(){let{buffer:t}=this.context,r=this._parent?this._parent.index+4:0;return this.index==r?this.externalSibling(-1):new wh(this.context,this._parent,t.findChild(r,this.index,-1,0,4))}cursor(t=0){return new M2(this,t)}get tree(){return null}toTree(){let t=[],r=[],{buffer:n}=this.context,i=this.index+4,a=n.buffer[this.index+3];if(a>i){let o=n.buffer[this.index+1],s=n.buffer[this.index+2];t.push(n.slice(i,a,o,s)),r.push(0)}return new Pl(this.type,t,r,this.to-this.from)}resolve(t,r=0){return O2(this,t,r,!1)}resolveInner(t,r=0){return O2(this,t,r,!0)}enterUnfinishedNodesBefore(t){return QEe(this,t)}toString(){return this.context.buffer.childString(this.index)}getChild(t,r=null,n=null){let i=L9(this,t,r,n);return i.length?i[0]:null}getChildren(t,r=null,n=null){return L9(this,t,r,n)}get node(){return this}matchContext(t){return z9(this,t)}},M2=class{constructor(t,r=0){if(this.mode=r,this.buffer=null,this.stack=[],this.index=0,this.bufferNode=null,t instanceof im)this.yieldNode(t);else{this._tree=t.context.parent,this.buffer=t.context;for(let n=t._parent;n;n=n._parent)this.stack.unshift(n.index);this.bufferNode=t,this.yieldBuf(t.index)}}get name(){return this.type.name}yieldNode(t){return t?(this._tree=t,this.type=t.type,this.from=t.from,this.to=t.to,!0):!1}yieldBuf(t,r){this.index=t;let{start:n,buffer:i}=this.buffer;return this.type=r||i.set.types[i.buffer[t]],this.from=n+i.buffer[t+1],this.to=n+i.buffer[t+2],!0}yield(t){return t?t instanceof im?(this.buffer=null,this.yieldNode(t)):(this.buffer=t.context,this.yieldBuf(t.index,t.type)):!1}toString(){return this.buffer?this.buffer.buffer.childString(this.index):this._tree.toString()}enterChild(t,r,n){if(!this.buffer)return this.yield(this._tree.nextChild(t<0?this._tree._tree.children.length-1:0,t,r,n,this.mode));let{buffer:i}=this.buffer,a=i.findChild(this.index+4,i.buffer[this.index+3],t,r-this.buffer.start,n);return a<0?!1:(this.stack.push(this.index),this.yieldBuf(a))}firstChild(){return this.enterChild(1,0,4)}lastChild(){return this.enterChild(-1,0,4)}childAfter(t){return this.enterChild(1,t,2)}childBefore(t){return this.enterChild(-1,t,-2)}enter(t,r,n=this.mode){return this.buffer?n&_l.ExcludeBuffers?!1:this.enterChild(1,t,r):this.yield(this._tree.enter(t,r,n))}parent(){if(!this.buffer)return this.yieldNode(this.mode&_l.IncludeAnonymous?this._tree._parent:this._tree.parent);if(this.stack.length)return this.yieldBuf(this.stack.pop());let t=this.mode&_l.IncludeAnonymous?this.buffer.parent:this.buffer.parent.nextSignificantParent();return this.buffer=null,this.yieldNode(t)}sibling(t){if(!this.buffer)return this._tree._parent?this.yield(this._tree.index<0?null:this._tree._parent.nextChild(this._tree.index+t,t,0,4,this.mode)):!1;let{buffer:r}=this.buffer,n=this.stack.length-1;if(t<0){let i=n<0?0:this.stack[n]+4;if(this.index!=i)return this.yieldBuf(r.findChild(i,this.index,-1,0,4))}else{let i=r.buffer[this.index+3];if(i<(n<0?r.buffer.length:r.buffer[this.stack[n]+3]))return this.yieldBuf(i)}return n<0?this.yield(this.buffer.parent.nextChild(this.buffer.index+t,t,0,4,this.mode)):!1}nextSibling(){return this.sibling(1)}prevSibling(){return this.sibling(-1)}atLastNode(t){let r,n,{buffer:i}=this;if(i){if(t>0){if(this.index-1)for(let a=r+t,o=t<0?-1:n._tree.children.length;a!=o;a+=t){let s=n._tree.children[a];if(this.mode&_l.IncludeAnonymous||s instanceof fg||!s.type.isAnonymous||$Y(s))return!1}return!0}move(t,r){if(r&&this.enterChild(t,0,4))return!0;for(;;){if(this.sibling(t))return!0;if(this.atLastNode(t)||!this.parent())return!1}}next(t=!0){return this.move(1,t)}prev(t=!0){return this.move(-1,t)}moveTo(t,r=0){for(;(this.from==this.to||(r<1?this.from>=t:this.from>t)||(r>-1?this.to<=t:this.to=0;){for(let o=t;o;o=o._parent)if(o.index==i){if(i==this.index)return o;r=o,n=a+1;break e}i=this.stack[--a]}}for(let i=n;i=0;a--){if(a<0)return z9(this.node,t,i);let o=n[r.buffer[this.stack[a]]];if(!o.isAnonymous){if(t[i]&&t[i]!=o.name)return!1;i--}}return!0}};function $Y(e){return e.children.some(t=>t instanceof fg||!t.type.isAnonymous||$Y(t))}function uJe(e){var t;let{buffer:r,nodeSet:n,maxBufferLength:i=1024,reused:a=[],minRepeatType:o=n.types.length}=e,s=Array.isArray(r)?new AD(r,r.length):r,l=n.types,u=0,c=0;function f(x,w,S,k,j){let{id:O,start:C,end:N,size:D}=s,P=c;for(;D<0;)if(s.next(),D==-1){let L=a[O];S.push(L),k.push(C-x);return}else if(D==-3){u=O;return}else if(D==-4){c=O;return}else throw new RangeError(`Unrecognized record size: ${D}`);let q=l[O],z,I,T=C-x;if(N-C<=i&&(I=m(s.pos-w,j))){let L=new Uint16Array(I.size-I.skip),_=s.pos-I.size,Y=L.length;for(;s.pos>_;)Y=g(I.start,L,Y);z=new fg(L,N-I.start,n),T=I.start-x}else{let L=s.pos-D;s.next();let _=[],Y=[],oe=O>=o?O:-1,te=0,Q=N;for(;s.pos>L;)oe>=0&&s.id==oe&&s.size>=0?(s.end<=Q-i&&(p(_,Y,C,te,s.end,Q,oe,P),te=_.length,Q=s.end),s.next()):f(C,L,_,Y,oe);if(oe>=0&&te>0&&te<_.length&&p(_,Y,C,te,C,Q,oe,P),_.reverse(),Y.reverse(),oe>-1&&te>0){let fe=d(q);z=qY(q,_,Y,0,_.length,0,N-C,fe,fe)}else z=h(q,_,Y,N-C,P-N)}S.push(z),k.push(T)}function d(x){return(w,S,k)=>{let j=0,O=w.length-1,C,N;if(O>=0&&(C=w[O])instanceof Pl){if(!O&&C.type==x&&C.length==k)return C;(N=C.prop(Pi.lookAhead))&&(j=S[O]+C.length+N)}return h(x,w,S,k,j)}}function p(x,w,S,k,j,O,C,N){let D=[],P=[];for(;x.length>k;)D.push(x.pop()),P.push(w.pop()+S-j);x.push(h(n.types[C],D,P,O-j,N-O)),w.push(j-S)}function h(x,w,S,k,j=0,O){if(u){let C=[Pi.contextHash,u];O=O?[C].concat(O):[C]}if(j>25){let C=[Pi.lookAhead,j];O=O?[C].concat(O):[C]}return new Pl(x,w,S,k,O)}function m(x,w){let S=s.fork(),k=0,j=0,O=0,C=S.end-i,N={size:0,start:0,skip:0};e:for(let D=S.pos-x;S.pos>D;){let P=S.size;if(S.id==w&&P>=0){N.size=k,N.start=j,N.skip=O,O+=4,k+=4,S.next();continue}let q=S.pos-P;if(P<0||q=o?4:0,I=S.start;for(S.next();S.pos>q;){if(S.size<0)if(S.size==-3)z+=4;else break e;else S.id>=o&&(z+=4);S.next()}j=I,k+=P,O+=z}return(w<0||k==x)&&(N.size=k,N.start=j,N.skip=O),N.size>4?N:void 0}function g(x,w,S){let{id:k,start:j,end:O,size:C}=s;if(s.next(),C>=0&&k4){let D=s.pos-(C-4);for(;s.pos>D;)S=g(x,w,S)}w[--S]=N,w[--S]=O-x,w[--S]=j-x,w[--S]=k}else C==-3?u=k:C==-4&&(c=k);return S}let A=[],b=[];for(;s.pos>0;)f(e.start||0,e.bufferStart||0,A,b,-1);let v=(t=e.length)!==null&&t!==void 0?t:A.length?b[0]+A[0].length:0;return new Pl(l[e.topID],A.reverse(),b.reverse(),v)}var VEe=new WeakMap;function q9(e,t){if(!e.isAnonymous||t instanceof fg||t.type!=e)return 1;let r=VEe.get(t);if(r==null){r=1;for(let n of t.children){if(n.type!=e||!(n instanceof Pl)){r=1;break}r+=q9(e,n)}VEe.set(t,r)}return r}function qY(e,t,r,n,i,a,o,s,l){let u=0;for(let h=n;h=c)break;S+=k}if(v==x+1){if(S>c){let k=h[x];p(k.children,k.positions,0,k.children.length,m[x]+b);continue}f.push(h[x])}else{let k=m[v-1]+h[v-1].length-w;f.push(qY(e,h,m,x,v,w,k,null,l))}d.push(w+b-a)}}return p(t,r,n,i,0),(s||l)(f,d,o)}var U9=class{startParse(t,r,n){return typeof t=="string"&&(t=new RY(t)),n=n?n.length?n.map(i=>new hD(i.from,i.to)):[new hD(0,0)]:[new hD(0,t.length)],this.createParse(t,r||[],n)}parse(t,r,n){let i=this.startParse(t,r,n);for(;;){let a=i.advance();if(a)return a}}},RY=class{constructor(t){this.string=t}get length(){return this.string.length}chunk(t){return this.string.slice(t)}get lineChunks(){return!1}read(t,r){return this.string.slice(t,r)}};var ymr=new Pi({perNode:!0});var T2=class{constructor(t,r,n,i,a,o,s,l,u,c=0,f){this.p=t,this.stack=r,this.state=n,this.reducePos=i,this.pos=a,this.score=o,this.buffer=s,this.bufferBase=l,this.curContext=u,this.lookAhead=c,this.parent=f}toString(){return`[${this.stack.filter((t,r)=>r%3==0).concat(this.state)}]@${this.pos}${this.score?"!"+this.score:""}`}static start(t,r,n=0){let i=t.parser.context;return new T2(t,[],r,n,n,0,[],0,i?new H9(i,i.start):null,0,null)}get context(){return this.curContext?this.curContext.context:null}pushState(t,r){this.stack.push(this.state,r,this.bufferBase+this.buffer.length),this.state=t}reduce(t){let r=t>>19,n=t&65535,{parser:i}=this.p,a=i.dynamicPrecedence(n);if(a&&(this.score+=a),r==0){this.pushState(i.getGoto(this.state,n,!0),this.reducePos),no;)this.stack.pop();this.reduceContext(n,s)}storeNode(t,r,n,i=4,a=!1){if(t==0&&(!this.stack.length||this.stack[this.stack.length-1]0&&o.buffer[s-4]==0&&o.buffer[s-1]>-1){if(r==n)return;if(o.buffer[s-2]>=r){o.buffer[s-2]=n;return}}}if(!a||this.pos==n)this.buffer.push(t,r,n,i);else{let o=this.buffer.length;if(o>0&&this.buffer[o-4]!=0)for(;o>0&&this.buffer[o-2]>n;)this.buffer[o]=this.buffer[o-4],this.buffer[o+1]=this.buffer[o-3],this.buffer[o+2]=this.buffer[o-2],this.buffer[o+3]=this.buffer[o-1],o-=4,i>4&&(i-=4);this.buffer[o]=t,this.buffer[o+1]=r,this.buffer[o+2]=n,this.buffer[o+3]=i}}shift(t,r,n){let i=this.pos;if(t&131072)this.pushState(t&65535,this.pos);else if((t&262144)==0){let a=t,{parser:o}=this.p;(n>this.pos||r<=o.maxNode)&&(this.pos=n,o.stateFlag(a,1)||(this.reducePos=n)),this.pushState(a,i),this.shiftContext(r,i),r<=o.maxNode&&this.buffer.push(r,i,n,4)}else this.pos=n,this.shiftContext(r,i),r<=this.p.parser.maxNode&&this.buffer.push(r,i,n,4)}apply(t,r,n){t&65536?this.reduce(t):this.shift(t,r,n)}useNode(t,r){let n=this.p.reused.length-1;(n<0||this.p.reused[n]!=t)&&(this.p.reused.push(t),n++);let i=this.pos;this.reducePos=this.pos=i+t.length,this.pushState(r,i),this.buffer.push(n,i,this.reducePos,-1),this.curContext&&this.updateContext(this.curContext.tracker.reuse(this.curContext.context,t,this,this.p.stream.reset(this.pos-t.length)))}split(){let t=this,r=t.buffer.length;for(;r>0&&t.buffer[r-2]>t.reducePos;)r-=4;let n=t.buffer.slice(r),i=t.bufferBase+r;for(;t&&i==t.bufferBase;)t=t.parent;return new T2(this.p,this.stack.slice(),this.state,this.reducePos,this.pos,this.score,n,i,this.curContext,this.lookAhead,t)}recoverByDelete(t,r){let n=t<=this.p.parser.maxNode;n&&this.storeNode(t,this.pos,r,4),this.storeNode(0,this.pos,r,n?8:4),this.pos=this.reducePos=r,this.score-=190}canShift(t){for(let r=new UY(this);;){let n=this.p.parser.stateSlot(r.state,4)||this.p.parser.hasAction(r.state,t);if((n&65536)==0)return!0;if(n==0)return!1;r.reduce(n)}}recoverByInsert(t){if(this.stack.length>=300)return[];let r=this.p.parser.nextStates(this.state);if(r.length>4<<1||this.stack.length>=120){let i=[];for(let a=0,o;al&1&&s==o)||i.push(r[a],o)}r=i}let n=[];for(let i=0;i>19,i=t&65535,a=this.stack.length-n*3;if(a<0||r.getGoto(this.stack[a],i,!1)<0)return!1;this.storeNode(0,this.reducePos,this.reducePos,4,!0),this.score-=100}return this.reducePos=this.pos,this.reduce(t),!0}forceAll(){for(;!this.p.parser.stateFlag(this.state,2);)if(!this.forceReduce()){this.storeNode(0,this.pos,this.pos,4,!0);break}return this}get deadEnd(){if(this.stack.length!=3)return!1;let{parser:t}=this.p;return t.data[t.stateSlot(this.state,1)]==65535&&!t.stateSlot(this.state,4)}restart(){this.state=this.stack[0],this.stack.length=0}sameState(t){if(this.state!=t.state||this.stack.length!=t.stack.length)return!1;for(let r=0;rthis.lookAhead&&(this.emitLookAhead(),this.lookAhead=t)}close(){this.curContext&&this.curContext.tracker.strict&&this.emitContext(),this.lookAhead>0&&this.emitLookAhead()}},H9=class{constructor(t,r){this.tracker=t,this.context=r,this.hash=t.strict?t.hash(r):0}},YEe;(function(e){e[e.Insert=200]="Insert",e[e.Delete=190]="Delete",e[e.Reduce=100]="Reduce",e[e.MaxNext=4]="MaxNext",e[e.MaxInsertStackDepth=300]="MaxInsertStackDepth",e[e.DampenInsertStackDepth=120]="DampenInsertStackDepth"})(YEe||(YEe={}));var UY=class{constructor(t){this.start=t,this.state=t.state,this.stack=t.stack,this.base=this.stack.length}reduce(t){let r=t&65535,n=t>>19;n==0?(this.stack==this.start.stack&&(this.stack=this.stack.slice()),this.stack.push(this.state,0,0),this.base+=3):this.base-=(n-1)*3;let i=this.start.p.parser.getGoto(this.stack[this.base-3],r,!0);this.state=i}},F2=class{constructor(t,r,n){this.stack=t,this.pos=r,this.index=n,this.buffer=t.buffer,this.index==0&&this.maybeNext()}static create(t,r=t.bufferBase+t.buffer.length){return new F2(t,r,r-t.bufferBase)}maybeNext(){let t=this.stack.parent;t!=null&&(this.index=this.stack.bufferBase-t.bufferBase,this.stack=t,this.buffer=t.buffer)}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}next(){this.index-=4,this.pos-=4,this.index==0&&this.maybeNext()}fork(){return new F2(this.stack,this.pos,this.index)}},j2=class{constructor(){this.start=-1,this.value=-1,this.end=-1,this.extended=-1,this.lookAhead=0,this.mask=0,this.context=0}},ZEe=new j2,WY=class{constructor(t,r){this.input=t,this.ranges=r,this.chunk="",this.chunkOff=0,this.chunk2="",this.chunk2Pos=0,this.next=-1,this.token=ZEe,this.rangeIndex=0,this.pos=this.chunkPos=r[0].from,this.range=r[0],this.end=r[r.length-1].to,this.readNext()}resolveOffset(t,r){let n=this.range,i=this.rangeIndex,a=this.pos+t;for(;an.to:a>=n.to;){if(i==this.ranges.length-1)return null;let o=this.ranges[++i];a+=o.from-n.to,n=o}return a}peek(t){let r=this.chunkOff+t,n,i;if(r>=0&&r=this.chunk2Pos&&ns.to&&(this.chunk2=this.chunk2.slice(0,s.to-n)),i=this.chunk2.charCodeAt(0)}}return n>=this.token.lookAhead&&(this.token.lookAhead=n+1),i}acceptToken(t,r=0){let n=r?this.resolveOffset(r,-1):this.pos;if(n==null||n=this.chunk2Pos&&this.posthis.range.to?t.slice(0,this.range.to-this.pos):t,this.chunkPos=this.pos,this.chunkOff=0}}readNext(){return this.chunkOff>=this.chunk.length&&(this.getChunk(),this.chunkOff==this.chunk.length)?this.next=-1:this.next=this.chunk.charCodeAt(this.chunkOff)}advance(t=1){for(this.chunkOff+=t;this.pos+t>=this.range.to;){if(this.rangeIndex==this.ranges.length-1)return this.setDone();t-=this.range.to-this.pos,this.range=this.ranges[++this.rangeIndex],this.pos=this.range.from}return this.pos+=t,this.pos>=this.token.lookAhead&&(this.token.lookAhead=this.pos+1),this.readNext()}setDone(){return this.pos=this.chunkPos=this.end,this.range=this.ranges[this.rangeIndex=this.ranges.length-1],this.chunk="",this.next=-1}reset(t,r){if(r?(this.token=r,r.start=t,r.lookAhead=t+1,r.value=r.extended=-1):this.token=ZEe,this.pos!=t){if(this.pos=t,t==this.end)return this.setDone(),this;for(;t=this.range.to;)this.range=this.ranges[++this.rangeIndex];t>=this.chunkPos&&t=this.chunkPos&&r<=this.chunkPos+this.chunk.length)return this.chunk.slice(t-this.chunkPos,r-this.chunkPos);if(t>=this.chunk2Pos&&r<=this.chunk2Pos+this.chunk2.length)return this.chunk2.slice(t-this.chunk2Pos,r-this.chunk2Pos);if(t>=this.range.from&&r<=this.range.to)return this.input.read(t,r);let n="";for(let i of this.ranges){if(i.from>=r)break;i.to>t&&(n+=this.input.read(Math.max(i.from,t),Math.min(i.to,r)))}return n}},N2=class{constructor(t,r){this.data=t,this.id=r}token(t,r){fJe(this.data,t,r,this.id)}};N2.prototype.contextual=N2.prototype.fallback=N2.prototype.extend=!1;var ab=class{constructor(t,r={}){this.token=t,this.contextual=!!r.contextual,this.fallback=!!r.fallback,this.extend=!!r.extend}};function fJe(e,t,r,n){let i=0,a=1<0){let c=e[u];if(s.allows(c)&&(t.token.value==-1||t.token.value==c||o.overrides(c,t.token.value))){t.acceptToken(c);break}}for(let u=t.next,c=0,f=e[i+2];c>1,p=l+d+(d<<1),h=e[p],m=e[p+1];if(u=m)c=d+1;else{i=e[p+2],t.advance();continue e}}break}}function W9(e,t=Uint16Array){if(typeof e!="string")return e;let r=null;for(let n=0,i=0;n=92&&o--,o>=34&&o--;let l=o-32;if(l>=46&&(l-=46,s=!0),a+=l,s)break;a*=46}r?r[i++]=a:r=new t(a)}return r}var am=typeof process<"u"&&process.env&&/\bparse\b/.test(process.env.LOG),LY=null,XEe;(function(e){e[e.Margin=25]="Margin"})(XEe||(XEe={}));function KEe(e,t,r){let n=e.cursor(_l.IncludeAnonymous);for(n.moveTo(t);;)if(!(r<0?n.childBefore(t):n.childAfter(t)))for(;;){if((r<0?n.tot)&&!n.type.isError)return r<0?Math.max(0,Math.min(n.to-1,t-25)):Math.min(e.length,Math.max(n.from+1,t+25));if(r<0?n.prevSibling():n.nextSibling())break;if(!n.parent())return r<0?0:e.length}}var HY=class{constructor(t,r){this.fragments=t,this.nodeSet=r,this.i=0,this.fragment=null,this.safeFrom=-1,this.safeTo=-1,this.trees=[],this.start=[],this.index=[],this.nextFragment()}nextFragment(){let t=this.fragment=this.i==this.fragments.length?null:this.fragments[this.i++];if(t){for(this.safeFrom=t.openStart?KEe(t.tree,t.from+t.offset,1)-t.offset:t.from,this.safeTo=t.openEnd?KEe(t.tree,t.to+t.offset,-1)-t.offset:t.to;this.trees.length;)this.trees.pop(),this.start.pop(),this.index.pop();this.trees.push(t.tree),this.start.push(-t.offset),this.index.push(0),this.nextStart=this.safeFrom}else this.nextStart=1e9}nodeAt(t){if(tt)return this.nextStart=o,null;if(a instanceof Pl){if(o==t){if(o=Math.max(this.safeFrom,t)&&(this.trees.push(a),this.start.push(o),this.index.push(0))}else this.index[r]++,this.nextStart=o+a.length}}},VY=class{constructor(t,r){this.stream=r,this.tokens=[],this.mainToken=null,this.actions=[],this.tokens=t.tokenizers.map(n=>new j2)}getActions(t){let r=0,n=null,{parser:i}=t.p,{tokenizers:a}=i,o=i.stateSlot(t.state,3),s=t.curContext?t.curContext.hash:0,l=0;for(let u=0;uf.end+25&&(l=Math.max(f.lookAhead,l)),f.value!=0)){let d=r;if(f.extended>-1&&(r=this.addActions(t,f.extended,f.end,r)),r=this.addActions(t,f.value,f.end,r),!c.extend&&(n=f,r>d))break}}for(;this.actions.length>r;)this.actions.pop();return l&&t.setLookAhead(l),!n&&t.pos==this.stream.end&&(n=new j2,n.value=t.p.parser.eofTerm,n.start=n.end=t.pos,r=this.addActions(t,n.value,n.end,r)),this.mainToken=n,this.actions}getMainToken(t){if(this.mainToken)return this.mainToken;let r=new j2,{pos:n,p:i}=t;return r.start=n,r.end=Math.min(n+1,i.stream.end),r.value=n==i.stream.end?i.parser.eofTerm:0,r}updateCachedToken(t,r,n){if(r.token(this.stream.reset(n.pos,t),n),t.value>-1){let{parser:i}=n.p;for(let a=0;a=0&&n.p.parser.dialect.allows(o>>1)){(o&1)==0?t.value=o>>1:t.extended=o>>1;break}}}else t.value=0,t.end=Math.min(n.p.stream.end,n.pos+1)}putAction(t,r,n,i){for(let a=0;at.bufferLength*4?new HY(n,t.nodeSet):null}get parsedPos(){return this.minStackPos}advance(){let t=this.stacks,r=this.minStackPos,n=this.stacks=[],i,a;for(let o=0;or)n.push(s);else{if(this.advanceStack(s,n,t))continue;{i||(i=[],a=[]),i.push(s);let l=this.tokens.getMainToken(s);a.push(l.value,l.end)}}break}}if(!n.length){let o=i&&dJe(i);if(o)return this.stackToTree(o);if(this.parser.strict)throw am&&i&&console.log("Stuck with token "+(this.tokens.mainToken?this.parser.getName(this.tokens.mainToken.value):"none")),new SyntaxError("No parse at "+r);this.recovering||(this.recovering=5)}if(this.recovering&&i){let o=this.stoppedAt!=null&&i[0].pos>this.stoppedAt?i[0]:this.runRecovery(i,a,n);if(o)return this.stackToTree(o.forceAll())}if(this.recovering){let o=this.recovering==1?1:this.recovering*3;if(n.length>o)for(n.sort((s,l)=>l.score-s.score);n.length>o;)n.pop();n.some(s=>s.reducePos>r)&&this.recovering--}else if(n.length>1){e:for(let o=0;o500&&u.buffer.length>500)if((s.score-u.score||s.buffer.length-u.buffer.length)>0)n.splice(l--,1);else{n.splice(o--,1);continue e}}}}this.minStackPos=n[0].pos;for(let o=1;o ":"";if(this.stoppedAt!=null&&i>this.stoppedAt)return t.forceReduce()?t:null;if(this.fragments){let u=t.curContext&&t.curContext.tracker.strict,c=u?t.curContext.hash:0;for(let f=this.fragments.nodeAt(i);f;){let d=this.parser.nodeSet.types[f.type.id]==f.type?a.getGoto(t.state,f.type.id):-1;if(d>-1&&f.length&&(!u||(f.prop(Pi.contextHash)||0)==c))return t.useNode(f,d),am&&console.log(o+this.stackID(t)+` (via reuse of ${a.getName(f.type.id)})`),!0;if(!(f instanceof Pl)||f.children.length==0||f.positions[0]>0)break;let p=f.children[0];if(p instanceof Pl&&f.positions[0]==0)f=p;else break}}let s=a.stateSlot(t.state,4);if(s>0)return t.reduce(s),am&&console.log(o+this.stackID(t)+` (via always-reduce ${a.getName(s&65535)})`),!0;if(t.stack.length>=15e3)for(;t.stack.length>9e3&&t.forceReduce(););let l=this.tokens.getActions(t);for(let u=0;ui?r.push(h):n.push(h)}return!1}advanceFully(t,r){let n=t.pos;for(;;){if(!this.advanceStack(t,null,null))return!1;if(t.pos>n)return eke(t,r),!0}}runRecovery(t,r,n){let i=null,a=!1;for(let o=0;o ":"";if(s.deadEnd&&(a||(a=!0,s.restart(),am&&console.log(c+this.stackID(s)+" (restarted)"),this.advanceFully(s,n))))continue;let f=s.split(),d=c;for(let p=0;f.forceReduce()&&p<10&&(am&&console.log(d+this.stackID(f)+" (via force-reduce)"),!this.advanceFully(f,n));p++)am&&(d=this.stackID(f)+" -> ");for(let p of s.recoverByInsert(l))am&&console.log(c+this.stackID(p)+" (via recover-insert)"),this.advanceFully(p,n);this.stream.end>s.pos?(u==s.pos&&(u++,l=0),s.recoverByDelete(l,u),am&&console.log(c+this.stackID(s)+` (via recover-delete ${this.parser.getName(l)})`),eke(s,n)):(!i||i.scoree,V9=class{constructor(t){this.start=t.start,this.shift=t.shift||zY,this.reduce=t.reduce||zY,this.reuse=t.reuse||zY,this.hash=t.hash||(()=>0),this.strict=t.strict!==!1}},ob=class extends U9{constructor(t){if(super(),this.wrappers=[],t.version!=14)throw new RangeError(`Parser version (${t.version}) doesn't match runtime version (${14})`);let r=t.nodeNames.split(" ");this.minRepeatTerm=r.length;for(let s=0;st.topRules[s][1]),i=[];for(let s=0;s=0)a(c,l,s[u++]);else{let f=s[u+-c];for(let d=-c;d>0;d--)a(s[u++],l,f);u++}}}this.nodeSet=new D2(r.map((s,l)=>$c.define({name:l>=this.minRepeatTerm?void 0:s,id:l,props:i[l],top:n.indexOf(l)>-1,error:l==0,skipped:t.skippedNodes&&t.skippedNodes.indexOf(l)>-1}))),t.propSources&&(this.nodeSet=this.nodeSet.extend(...t.propSources)),this.strict=!1,this.bufferLength=1024;let o=W9(t.tokenData);if(this.context=t.context,this.specialized=new Uint16Array(t.specialized?t.specialized.length:0),this.specializers=[],t.specialized)for(let s=0;stypeof s=="number"?new N2(o,s):s),this.topRules=t.topRules,this.dialects=t.dialects||{},this.dynamicPrecedences=t.dynamicPrecedences||null,this.tokenPrecTable=t.tokenPrec,this.termNames=t.termNames||null,this.maxNode=this.nodeSet.types.length-1,this.dialect=this.parseDialect(),this.top=this.topRules[Object.keys(this.topRules)[0]]}createParse(t,r,n){let i=new GY(this,t,r,n);for(let a of this.wrappers)i=a(i,t,r,n);return i}getGoto(t,r,n=!1){let i=this.goto;if(r>=i[0])return-1;for(let a=i[r+1];;){let o=i[a++],s=o&1,l=i[a++];if(s&&n)return l;for(let u=a+(o>>1);a0}validAction(t,r){if(r==this.stateSlot(t,4))return!0;for(let n=this.stateSlot(t,1);;n+=3){if(this.data[n]==65535)if(this.data[n+1]==1)n=dg(this.data,n+2);else return!1;if(r==dg(this.data,n+1))return!0}}nextStates(t){let r=[];for(let n=this.stateSlot(t,1);;n+=3){if(this.data[n]==65535)if(this.data[n+1]==1)n=dg(this.data,n+2);else break;if((this.data[n+2]&1)==0){let i=this.data[n+1];r.some((a,o)=>o&1&&a==i)||r.push(this.data[n],i)}}return r}overrides(t,r){let n=tke(this.data,this.tokenPrecTable,r);return n<0||tke(this.data,this.tokenPrecTable,t){let i=t.tokenizers.find(a=>a.from==n);return i?i.to:n})),t.contextTracker&&(r.context=t.contextTracker),t.dialect&&(r.dialect=this.parseDialect(t.dialect)),t.strict!=null&&(r.strict=t.strict),t.wrap&&(r.wrappers=r.wrappers.concat(t.wrap)),t.bufferLength!=null&&(r.bufferLength=t.bufferLength),r}hasWrappers(){return this.wrappers.length>0}getName(t){return this.termNames?this.termNames[t]:String(t<=this.maxNode&&this.nodeSet.types[t].name||t)}get eofTerm(){return this.maxNode+1}get topNode(){return this.nodeSet.types[this.top[1]]}dynamicPrecedence(t){let r=this.dynamicPrecedences;return r==null?0:r[t]||0}parseDialect(t){let r=Object.keys(this.dialects),n=r.map(()=>!1);if(t)for(let a of t.split(" ")){let o=r.indexOf(a);o>=0&&(n[o]=!0)}let i=null;for(let a=0;an)&&r.p.parser.stateFlag(r.state,2)&&(!t||t.scorer.modified.indexOf(t)>-1?r:_2.get(r.base||r,r.modified.concat(t).sort((n,i)=>n.id-i.id))}},mJe=0,_2=class{constructor(){this.instances=[],this.id=mJe++}static get(t,r){if(!r.length)return t;let n=r[0].instances.find(s=>s.base==t&&hJe(r,s.modified));if(n)return n;let i=[],a=new Gd(i,t,r);for(let s of r)s.instances.push(a);let o=ike(r);for(let s of t.set)for(let l of o)i.push(_2.get(s,l));return a}};function hJe(e,t){return e.length==t.length&&e.every((r,n)=>r==t[n])}function ike(e){let t=[e];for(let r=0;r0&&f+3==i.length){o=1;break}let d=/^"(?:[^"\\]|\\.)*?"|[^\/!]+/.exec(s);if(!d)throw new RangeError("Invalid path: "+i);if(a.push(d[0]=="*"?"":d[0][0]=='"'?JSON.parse(d[0]):d[0]),f+=d[0].length,f==i.length)break;let p=i[f++];if(f==i.length&&p=="!"){o=0;break}if(p!="/")throw new RangeError("Invalid path: "+i);s=i.slice(f)}let l=a.length-1,u=a[l];if(!u)throw new RangeError("Invalid path: "+i);let c=new ZY(n,o,l>0?a.slice(0,l):null);t[u]=c.sort(t[u])}}return AJe.add(t)}var AJe=new Pi,ZY=class{constructor(t,r,n,i){this.tags=t,this.mode=r,this.context=n,this.next=i}sort(t){return!t||t.depth{let o=i;for(let s of a)for(let l of s.set){let u=r[l.id];if(u){o=o?o+" "+u:u;break}}return o},scope:n}}var Tt=Gd.define,G9=Tt(),_v=Tt(),rke=Tt(_v),nke=Tt(_v),Pv=Tt(),Q9=Tt(Pv),YY=Tt(Pv),kh=Tt(),sb=Tt(kh),Sh=Tt(),Eh=Tt(),XY=Tt(),gD=Tt(XY),Y9=Tt(),gt={comment:G9,lineComment:Tt(G9),blockComment:Tt(G9),docComment:Tt(G9),name:_v,variableName:Tt(_v),typeName:rke,tagName:Tt(rke),propertyName:nke,attributeName:Tt(nke),className:Tt(_v),labelName:Tt(_v),namespace:Tt(_v),macroName:Tt(_v),literal:Pv,string:Q9,docString:Tt(Q9),character:Tt(Q9),attributeValue:Tt(Q9),number:YY,integer:Tt(YY),float:Tt(YY),bool:Tt(Pv),regexp:Tt(Pv),escape:Tt(Pv),color:Tt(Pv),url:Tt(Pv),keyword:Sh,self:Tt(Sh),null:Tt(Sh),atom:Tt(Sh),unit:Tt(Sh),modifier:Tt(Sh),operatorKeyword:Tt(Sh),controlKeyword:Tt(Sh),definitionKeyword:Tt(Sh),moduleKeyword:Tt(Sh),operator:Eh,derefOperator:Tt(Eh),arithmeticOperator:Tt(Eh),logicOperator:Tt(Eh),bitwiseOperator:Tt(Eh),compareOperator:Tt(Eh),updateOperator:Tt(Eh),definitionOperator:Tt(Eh),typeOperator:Tt(Eh),controlOperator:Tt(Eh),punctuation:XY,separator:Tt(XY),bracket:gD,angleBracket:Tt(gD),squareBracket:Tt(gD),paren:Tt(gD),brace:Tt(gD),content:kh,heading:sb,heading1:Tt(sb),heading2:Tt(sb),heading3:Tt(sb),heading4:Tt(sb),heading5:Tt(sb),heading6:Tt(sb),contentSeparator:Tt(kh),list:Tt(kh),quote:Tt(kh),emphasis:Tt(kh),strong:Tt(kh),link:Tt(kh),monospace:Tt(kh),strikethrough:Tt(kh),inserted:Tt(),deleted:Tt(),changed:Tt(),invalid:Tt(),meta:Y9,documentMeta:Tt(Y9),annotation:Tt(Y9),processingInstruction:Tt(Y9),definition:Gd.defineModifier(),constant:Gd.defineModifier(),function:Gd.defineModifier(),standard:Gd.defineModifier(),local:Gd.defineModifier(),special:Gd.defineModifier()},Emr=gJe([{tag:gt.link,class:"tok-link"},{tag:gt.heading,class:"tok-heading"},{tag:gt.emphasis,class:"tok-emphasis"},{tag:gt.strong,class:"tok-strong"},{tag:gt.keyword,class:"tok-keyword"},{tag:gt.atom,class:"tok-atom"},{tag:gt.bool,class:"tok-bool"},{tag:gt.url,class:"tok-url"},{tag:gt.labelName,class:"tok-labelName"},{tag:gt.inserted,class:"tok-inserted"},{tag:gt.deleted,class:"tok-deleted"},{tag:gt.literal,class:"tok-literal"},{tag:gt.string,class:"tok-string"},{tag:gt.number,class:"tok-number"},{tag:[gt.regexp,gt.escape,gt.special(gt.string)],class:"tok-string2"},{tag:gt.variableName,class:"tok-variableName"},{tag:gt.local(gt.variableName),class:"tok-variableName tok-local"},{tag:gt.definition(gt.variableName),class:"tok-variableName tok-definition"},{tag:gt.special(gt.variableName),class:"tok-variableName2"},{tag:gt.definition(gt.propertyName),class:"tok-propertyName tok-definition"},{tag:gt.typeName,class:"tok-typeName"},{tag:gt.namespace,class:"tok-namespace"},{tag:gt.className,class:"tok-className"},{tag:gt.macroName,class:"tok-macroName"},{tag:gt.propertyName,class:"tok-propertyName"},{tag:gt.operator,class:"tok-operator"},{tag:gt.comment,class:"tok-comment"},{tag:gt.meta,class:"tok-meta"},{tag:gt.invalid,class:"tok-invalid"},{tag:gt.punctuation,class:"tok-punctuation"}]);var oke=281,ske=1,vJe=2,Z9=282,yJe=3,bJe=283,lke=284,xJe=4,wJe=286,SJe=287,EJe=5,kJe=6,CJe=1,DJe=[9,10,11,12,13,32,133,160,5760,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202,8232,8233,8239,8287,12288],cke=125,OJe=123,MJe=59,uke=47,jJe=42,NJe=43,TJe=45,FJe=36,_Je=96,PJe=92,IJe=new V9({start:!1,shift(e,t){return t==EJe||t==kJe||t==wJe?e:t==SJe},strict:!1}),BJe=new ab((e,t)=>{let{next:r}=e;(r==cke||r==-1||t.context)&&t.canShift(lke)&&e.acceptToken(lke)},{contextual:!0,fallback:!0}),RJe=new ab((e,t)=>{let{next:r}=e,n;DJe.indexOf(r)>-1||r==uke&&((n=e.peek(1))==uke||n==jJe)||r!=cke&&r!=MJe&&r!=-1&&!t.context&&t.canShift(oke)&&e.acceptToken(oke)},{contextual:!0}),$Je=new ab((e,t)=>{let{next:r}=e;if((r==NJe||r==TJe)&&(e.advance(),r==e.next)){e.advance();let n=!t.context&&t.canShift(ske);e.acceptToken(n?ske:vJe)}},{contextual:!0}),qJe=new ab(e=>{for(let t=!1,r=0;;r++){let{next:n}=e;if(n<0){r&&e.acceptToken(Z9);break}else if(n==_Je){r?e.acceptToken(Z9):e.acceptToken(bJe,1);break}else if(n==OJe&&t){r==1?e.acceptToken(yJe,1):e.acceptToken(Z9,-1);break}else if(n==10&&r){e.advance(),e.acceptToken(Z9);break}else n==PJe&&e.advance();t=n==FJe,e.advance()}});function LJe(e,t){return e=="extends"&&t.dialectEnabled(CJe)?xJe:-1}var zJe=ake({"get set async static":gt.modifier,"for while do if else switch try catch finally return throw break continue default case":gt.controlKeyword,"in of await yield void typeof delete instanceof":gt.operatorKeyword,"let var const function class extends":gt.definitionKeyword,"import export from":gt.moduleKeyword,"with debugger as new":gt.keyword,TemplateString:gt.special(gt.string),Super:gt.atom,BooleanLiteral:gt.bool,this:gt.self,null:gt.null,Star:gt.modifier,VariableName:gt.variableName,"CallExpression/VariableName TaggedTemplateExpression/VariableName":gt.function(gt.variableName),VariableDefinition:gt.definition(gt.variableName),Label:gt.labelName,PropertyName:gt.propertyName,PrivatePropertyName:gt.special(gt.propertyName),"CallExpression/MemberExpression/PropertyName":gt.function(gt.propertyName),"FunctionDeclaration/VariableDefinition":gt.function(gt.definition(gt.variableName)),"ClassDeclaration/VariableDefinition":gt.definition(gt.className),PropertyDefinition:gt.definition(gt.propertyName),PrivatePropertyDefinition:gt.definition(gt.special(gt.propertyName)),UpdateOp:gt.updateOperator,LineComment:gt.lineComment,BlockComment:gt.blockComment,Number:gt.number,String:gt.string,ArithOp:gt.arithmeticOperator,LogicOp:gt.logicOperator,BitOp:gt.bitwiseOperator,CompareOp:gt.compareOperator,RegExp:gt.regexp,Equals:gt.definitionOperator,"Arrow : Spread":gt.punctuation,"( )":gt.paren,"[ ]":gt.squareBracket,"{ }":gt.brace,"InterpolationStart InterpolationEnd":gt.special(gt.brace),".":gt.derefOperator,", ;":gt.separator,TypeName:gt.typeName,TypeDefinition:gt.definition(gt.typeName),"type enum interface implements namespace module declare":gt.definitionKeyword,"abstract global Privacy readonly override":gt.modifier,"is keyof unique infer":gt.operatorKeyword,JSXAttributeValue:gt.attributeValue,JSXText:gt.content,"JSXStartTag JSXStartCloseTag JSXSelfCloseEndTag JSXEndTag":gt.angleBracket,"JSXIdentifier JSXNameSpacedName":gt.tagName,"JSXAttribute/JSXIdentifier JSXAttribute/JSXNameSpacedName":gt.attributeName}),UJe={__proto__:null,export:18,as:23,from:29,default:32,async:37,function:38,this:48,true:56,false:56,void:66,typeof:70,null:86,super:88,new:122,await:139,yield:141,delete:142,class:152,extends:154,public:197,private:197,protected:197,readonly:199,instanceof:220,in:222,const:224,import:256,keyof:307,unique:311,infer:317,is:351,abstract:371,implements:373,type:375,let:378,var:380,interface:387,enum:391,namespace:397,module:399,declare:403,global:407,for:428,of:437,while:440,with:444,do:448,if:452,else:454,switch:458,case:464,try:470,catch:474,finally:478,return:482,throw:486,break:490,continue:494,debugger:498},WJe={__proto__:null,async:109,get:111,set:113,public:161,private:161,protected:161,static:163,abstract:165,override:167,readonly:173,new:355},HJe={__proto__:null,"<":129},fke=ob.deserialize({version:14,states:"$4|O`QYOOO'QQ$IfO'#ChO'XOSO'#DVO)dQYO'#D]O)tQYO'#DhO){QYO'#DrO-xQYO'#DxOOQO'#E]'#E]O.]QWO'#E[O.bQWO'#E[OOQ$IU'#Ef'#EfO0aQ$IfO'#ItO2wQ$IfO'#IuO3eQWO'#EzO3jQpO'#FaOOQ$IU'#FS'#FSO3rO!bO'#FSO4QQWO'#FhO5_QWO'#FgOOQ$IU'#Iu'#IuOOQ$IS'#It'#ItOOQQ'#J^'#J^O5dQWO'#HpO5iQ$I[O'#HqOOQQ'#Ih'#IhOOQQ'#Hr'#HrQ`QYOOO){QYO'#DjO5qQWO'#G[O5vQ#tO'#CmO6UQWO'#EZO6aQWO'#EgO6fQ#tO'#FRO7QQWO'#G[O7VQWO'#G`O7bQWO'#G`O7pQWO'#GcO7pQWO'#GdO7pQWO'#GfO5qQWO'#GiO8aQWO'#GlO9oQWO'#CdO:PQWO'#GyO:XQWO'#HPO:XQWO'#HRO`QYO'#HTO:XQWO'#HVO:XQWO'#HYO:^QWO'#H`O:cQ$I]O'#HfO){QYO'#HhO:nQ$I]O'#HjO:yQ$I]O'#HlO5iQ$I[O'#HnO){QYO'#DWOOOS'#Ht'#HtO;UOSO,59qOOQ$IU,59q,59qO=gQbO'#ChO=qQYO'#HuO>UQWO'#IvO@TQbO'#IvO'dQYO'#IvO@[QWO,59wO@rQ&jO'#DbOAkQWO'#E]OAxQWO'#JROBTQWO'#JQOBTQWO'#JQOB]QWO,5:yOBbQWO'#JPOBiQWO'#DyO5vQ#tO'#EZOBwQWO'#EZOCSQ`O'#FROOQ$IU,5:S,5:SOC[QYO,5:SOEYQ$IfO,5:^OEvQWO,5:dOFaQ$I[O'#JOO7VQWO'#I}OFhQWO'#I}OFpQWO,5:xOFuQWO'#I}OGTQYO,5:vOITQWO'#EWOJ_QWO,5:vOKnQWO'#DlOKuQYO'#DqOLPQ&jO,5;PO){QYO,5;POOQQ'#Er'#ErOOQQ'#Et'#EtO){QYO,5;RO){QYO,5;RO){QYO,5;RO){QYO,5;RO){QYO,5;RO){QYO,5;RO){QYO,5;RO){QYO,5;RO){QYO,5;RO){QYO,5;RO){QYO,5;ROOQQ'#Ex'#ExOLXQYO,5;cOOQ$IU,5;h,5;hOOQ$IU,5;i,5;iONXQWO,5;iOOQ$IU,5;j,5;jO){QYO'#IPON^Q$I[O,5[OOQQ'#Ik'#IkOOQQ,5>],5>]OOQQ-E;p-E;pO!+VQ$IfO,5:UOOQ$IS'#Cp'#CpO!+vQ#tO,5Q,5>QO){QYO,5>QO5iQ$I[O,5>SOOQQ,5>U,5>UO!8VQWO,5>UOOQQ,5>W,5>WO!8VQWO,5>WOOQQ,5>Y,5>YO!8[Q`O,59rOOOS-E;r-E;rOOQ$IU1G/]1G/]O!8aQbO,5>aO'dQYO,5>aOOQO,5>f,5>fO!8kQYO'#HuOOQO-E;s-E;sO!8xQWO,5?bO!9QQbO,5?bO!9XQWO,5?lOOQ$IU1G/c1G/cO!9aQpO'#DTOOQO'#Ix'#IxO){QYO'#IxO!:OQpO'#IxO!:mQpO'#DcO!;OQ&jO'#DcO!=ZQYO'#DcO!=bQWO'#IwO!=jQWO,59|O!=oQWO'#EaO!=}QWO'#JSO!>VQWO,5:zO!>mQ&jO'#DcO){QYO,5?mO!>wQWO'#HzOOQO-E;x-E;xO!9XQWO,5?lOOQ$IS1G0e1G0eO!@TQ&jO'#D|OOQ$IU,5:e,5:eO){QYO,5:eOITQWO,5:eO!@[QWO,5:eO:^QWO,5:uO!,rQpO,5:uO!,zQ#tO,5:uO5vQ#tO,5:uOOQ$IU1G/n1G/nOOQ$IU1G0O1G0OOOQ$IS'#EV'#EVO){QYO,5?jO!@gQ$I[O,5?jO!@xQ$I[O,5?jO!APQWO,5?iO!AXQWO'#H|O!APQWO,5?iOOQ$IS1G0d1G0dO7VQWO,5?iOOQ$IU1G0b1G0bO!AsQ$IfO1G0bO!BdQ$IdO,5:rOOQ$IU'#Fq'#FqO!CQQ$IfO'#IqOGTQYO1G0bO!EPQ#tO'#IyO!EZQWO,5:WO!E`QbO'#IzO){QYO'#IzO!EjQWO,5:]OOQ$IU'#DT'#DTOOQ$IU1G0k1G0kO!EoQWO1G0kO!HQQ$IfO1G0mO!HXQ$IfO1G0mO!JlQ$IfO1G0mO!JsQ$IfO1G0mO!LzQ$IfO1G0mO!M_Q$IfO1G0mO#!OQ$IfO1G0mO#!VQ$IfO1G0mO#$jQ$IfO1G0mO#$qQ$IfO1G0mO#&fQ$IfO1G0mO#)`Q7^O'#ChO#+ZQ7^O1G0}O#-UQ7^O'#IuOOQ$IU1G1T1G1TO#-iQ$IfO,5>kOOQ$IS-E;}-E;}O#.YQ$IfO1G0mOOQ$IU1G0m1G0mO#0[Q$IfO1G1QO#0{QpO,5;sO#1QQpO,5;tO#1VQpO'#F[O#1kQWO'#FZOOQO'#JW'#JWOOQO'#H}'#H}O#1pQpO1G1]OOQ$IU1G1]1G1]OOOO1G1f1G1fO#2OQ7^O'#ItO#2YQWO,5;}OLXQYO,5;}OOOO-E;|-E;|OOQ$IU1G1Y1G1YOOQ$IU,5WQWO1G2iOOQQ1G2j1G2jOITQWO1G2jO#>]QWO1G2jO#>eQ&jO'#GhOOQQ1G2l1G2lO!&tQ&jO'#IYO!0OQ`O1G2oOOQQ1G2o1G2oOOQQ,5=Y,5=YO#>mQ#tO,5=[O5qQWO,5=[O#5YQWO,5=_O5_QWO,5=_O!,rQpO,5=_O!,zQ#tO,5=_O5vQ#tO,5=_O#?OQWO'#JaO#?ZQWO,5=`OOQQ1G.j1G.jO#?`Q$I[O1G.jO#?kQWO1G.jO#?pQWO1G.jO5iQ$I[O1G.jO#?xQbO,5@OO#@SQWO,5@OO#@_QYO,5=gO#@fQWO,5=gO7VQWO,5@OOOQQ1G3P1G3PO`QYO1G3POOQQ1G3V1G3VOOQQ1G3X1G3XO:XQWO1G3ZO#@kQYO1G3]O#DfQYO'#H[OOQQ1G3`1G3`O#DsQWO'#HbO:^QWO'#HdOOQQ1G3f1G3fO#D{QYO1G3fO5iQ$I[O1G3lOOQQ1G3n1G3nOOQ$IS'#Fx'#FxO5iQ$I[O1G3pO5iQ$I[O1G3rOOOS1G/^1G/^O#HyQ`O,5aO#I]QWO1G4|O#IeQWO1G5WO#ImQWO,5?dOLXQYO,5:{O7VQWO,5:{O:^QWO,59}OLXQYO,59}O!,rQpO,59}O#IrQ7^O,59}OOQO,5:{,5:{O#I|Q&jO'#HvO#JdQWO,5?cOOQ$IU1G/h1G/hO#JlQ&jO'#H{O#KQQWO,5?nOOQ$IS1G0f1G0fO!;OQ&jO,59}O#KYQbO1G5XO7VQWO,5>fOOQ$IS'#ES'#ESO#KdQ$ItO'#ETO!?{Q&jO'#D}OOQO'#Hy'#HyO#LOQ&jO,5:hOOQ$IU,5:h,5:hO#LVQ&jO'#D}O#LhQ&jO'#D}O#LoQ&jO'#EYO#LrQ&jO'#ETO#MPQ&jO'#ETO!?{Q&jO'#ETO#MdQWO1G0PO#MiQ`O1G0POOQ$IU1G0P1G0PO){QYO1G0POITQWO1G0POOQ$IU1G0a1G0aO:^QWO1G0aO!,rQpO1G0aO!,zQ#tO1G0aO#MpQ$IfO1G5UO){QYO1G5UO#NQQ$I[O1G5UO#NcQWO1G5TO7VQWO,5>hOOQO,5>h,5>hO#NkQWO,5>hOOQO-E;z-E;zO#NcQWO1G5TO#NyQ$IfO,59jO$!xQ$IfO,5m,5>mO$,iQWO,5>mOOQ$IU1G2P1G2PP$,nQWO'#IRPOQ$IU-Eo,5>oOOQO-Ep,5>pOOQO-Ex,5>xOOQO-E<[-E<[OOQ$IU7+&q7+&qO$4uQWO7+(iO5iQ$I[O7+(iO5qQWO7+(iO$4zQWO7+(iO$5PQWO7+'|OOQ$IS,5>r,5>rOOQ$IS-Et,5>tOOQO-EO,5>OOOQQ7+)Q7+)QOOQQ7+)W7+)WOOQQ7+)[7+)[OOQQ7+)^7+)^OOQO1G5O1G5OO$9eQ7^O1G0gO$9oQWO1G0gOOQO1G/i1G/iO$9zQ7^O1G/iO:^QWO1G/iOLXQYO'#DcOOQO,5>b,5>bOOQO-E;t-E;tOOQO,5>g,5>gOOQO-E;y-E;yO!,rQpO1G/iO:^QWO,5:iOOQO,5:o,5:oO){QYO,5:oO$:UQ$I[O,5:oO$:aQ$I[O,5:oO!,rQpO,5:iOOQO-E;w-E;wOOQ$IU1G0S1G0SO!?{Q&jO,5:iO$:oQ&jO,5:iO$;QQ$ItO,5:oO$;lQ&jO,5:iO!?{Q&jO,5:oOOQO,5:t,5:tO$;sQ&jO,5:oO$cOOQO-E;u-E;uO$CfQbO,5>dO){QYO,5>dOOQO-E;v-E;vO$CpQWO1G5QO$CxQ7^O1G0bO$FPQ7^O1G0mO$FWQ7^O1G0mO$HXQ7^O1G0mO$H`Q7^O1G0mO$JTQ7^O1G0mO$JhQ7^O1G0mO$LuQ7^O1G0mO$L|Q7^O1G0mO$N}Q7^O1G0mO% UQ7^O1G0mO%!yQ7^O1G0mO%#^Q$IfO<kOOOO7+'T7+'TOOOS1G/R1G/ROOQ$IU1G4X1G4XOJdQWO7+'zO%([QWO,5>lO5qQWO,5>lOOQO-EnO%)XQWO,5>nOITQWO,5>nOOQO-Ew,5>wO%,kQWO,5>wO%,pQWO,5>wOOQO-EvOOQO-EWQ7^O7+'WO%>eQ7^O7+'XO%>rQWO,5;xOOQO7+&{7+&{O%>wQ#tO<qOOQO-EsOOQO-E{AN>{OOQOAN>uAN>uO%1gQ$IfOAN>{O:^QWOAN>uO){QYOAN>{O!,rQpOAN>uO&%SQ$I[OAN>{O&%_Q7^O<^O!O&OO~Ox&RO!W&]O!X&UO!Y&UO'^$bO~O]&SOk&SO!Q&VO'g&PO!S'kP!S'vP~P@aO!O'sX!R'sX!]'sX!c'sX'p'sX~O!{'sX#W#PX!S'sX~PAYO!{&^O!O'uX!R'uX~O!R&_O!O'tX~O!O&bO~O!{#eO~PAYOS&fO!T&cO!o&eO']$`O~Oc&kO!d$XO']$`O~Ou$nO!d$mO~O!S&lO~P`Ou!{Ov!{Ox!|O!b!yO!d!zO'fQOP!faZ!faj!fa!R!fa!a!fa!j!fa#[!fa#]!fa#^!fa#_!fa#`!fa#a!fa#b!fa#c!fa#e!fa#g!fa#i!fa#j!fa'p!fa'w!fa'x!fa~O_!fa'W!fa!O!fa!c!fan!fa!T!fa%Q!fa!]!fa~PCcO!c&mO~O!]!wO!{&oO'p&nO!R'rX_'rX'W'rX~O!c'rX~PE{O!R&sO!c'qX~O!c&uO~Ox$tO!T$uO#V&vO']$`O~OPTOQTO]cOb!kOc!jOhcOjTOkcOlcOqTOsTOxRO{cO|cO}cO!TSO!_kO!dUO!gTO!hTO!iTO!jTO!kTO!n!iO#t!lO#x^O']9WO'fQO'oYO'|aO~O]#qOh$OOj#rOk#qOl#qOq$POs9kOx#xO!T#yO!_;RO!d#vO#V9tO#t$TO$_9nO$a9qO$d$UO']&zO'f#sO~O#W&|O~O]#qOh$OOj#rOk#qOl#qOq$POs$QOx#xO!T#yO!_$VO!d#vO#V$WO#t$TO$_$RO$a$SO$d$UO']&zO'f#sO~O'a'mP~PJdO!Q'QO!c'nP~P){O'g'SO'oYO~OP9TOQ9TO]cOb;POc!jOhcOj9TOkcOlcOq9TOs9TOxRO{cO|cO}cO!T!bO!_9VO!dUO!g9TO!h9TO!i9TO!j9TO!k9TO!n!iO#t!lO#x^O']'bO'fQO'oYO'|:}O~O!d!zO~O!R#bO_$]a'W$]a!c$]a!O$]a!T$]a%Q$]a!]$]a~O#d'iO~PITO!]'kO!T'yX#w'yX#z'yX$R'yX~Ou'lO~P! POu'lO!T'yX#w'yX#z'yX$R'yX~O!T'nO#w'rO#z'mO$R'sO~O!Q'vO~PLXO#z#fO$R'yO~Ou$eXx$eX!b$eX'p$eX'w$eX'x$eX~OSfX!RfX!{fX'afX'a$eX~P!!iOk'{O~OR'|O'U'}O'V(PO~Ou(ROx(SO'p#[O'w(UO'x(WO~O'a(QO~P!#rO'a(ZO~O]#qOh$OOj#rOk#qOl#qOq$POs9kOx#xO!T#yO!_;RO!d#vO#V9tO#t$TO$_9nO$a9qO$d$UO'f#sO~O!Q(_O']([O!c'}P~P!$aO#W(aO~O!Q(eO'](bO!O(OP~P!$aOj(sOx(kO!W(qO!X(jO!Y(jO!d(hO!x(rO$w(mO'^$bO'g(gO~O!S(pO~P!&XO!b!yOu'eXx'eX'p'eX'w'eX'x'eX!R'eX!{'eX~O'a'eX#m'eX~P!'QOS(vO!{(uO!R'dX'a'dX~O!R(wO'a'cX~O'](yO~O!d)OO~O']&zO~O!d(hO~Ox$tO!Q!rO!T$uO#U!uO#V!rO']$`O!c'qP~O!]!wO#W)SO~OP#^OZ#dOj#ROu!{Ov!{Ox!|O!a#TO!b!yO!d!zO!j#^O#[#PO#]#QO#^#QO#_#QO#`#SO#a#TO#b#TO#c#TO#e#UO#g#WO#i#YO#j#ZO'fQO'p#[O'w!}O'x#OO~O_!^a!R!^a'W!^a!O!^a!c!^an!^a!T!^a%Q!^a!]!^a~P!)cOS)[O!T&cO!o)ZO%Q)YO'b$cO~O']$zO'a'cP~O!])_O!T'`X_'`X!R'`X'W'`X~O!d$XO'b$cO~O!d$XO']$`O'b$cO~O!]!wO#W&|O~O])jO%R)kO'])gO!S(VP~O!R)lO^(UX~O'g'SO~OZ)pO~O^)qO~O!T$kO']$`O'^$bO^(UP~Ox$tO!Q)vO!R&_O!T$uO']$`O!O'tP~O]&YOk&YO!Q)wO'g'SO!S'vP~O!R)xO_(RX'W(RX~O!{)|O'b$cO~OS*PO!T#yO'b$cO~O!T*RO~Ou*TO!TSO~O!n*YO~Oc*_O~O'](yO!S(TP~Oc$iO~O%RtO']$zO~P8tOZ*eO^*dO~OPTOQTO]cObnOcmOhcOjTOkcOlcOqTOsTOxRO{cO|cO}cO!_kO!dUO!gTO!hTO!iTO!jTO!kTO!nlO#x^O%PqO'fQO'oYO'|aO~O!T!bO#t!lO']9WO~P!1RO^*dO_$[O'W$[O~O_*iO#d*kO%T*kO%U*kO~P){O!d%_O~O%t*pO~O!T*rO~O&V*tO&X*uOP&SaQ&SaX&Sa]&Sa_&Sab&Sac&Sah&Saj&Sak&Sal&Saq&Sas&Sax&Sa{&Sa|&Sa}&Sa!T&Sa!_&Sa!d&Sa!g&Sa!h&Sa!i&Sa!j&Sa!k&Sa!n&Sa#d&Sa#t&Sa#x&Sa%P&Sa%R&Sa%T&Sa%U&Sa%X&Sa%Z&Sa%^&Sa%_&Sa%a&Sa%n&Sa%t&Sa%v&Sa%x&Sa%z&Sa%}&Sa&T&Sa&Z&Sa&]&Sa&_&Sa&a&Sa&c&Sa'S&Sa']&Sa'f&Sa'o&Sa'|&Sa!S&Sa%{&Sa`&Sa&Q&Sa~O']*zO~On*}O~O!O&ia!R&ia~P!)cO!Q+RO!O&iX!R&iX~P){O!R%yO!O'ja~O!O'ja~P>^O!R&_O!O'ta~O!RwX!R!ZX!SwX!S!ZX!]wX!]!ZX!d!ZX!{wX'b!ZX~O!]+WO!{+VO!R#TX!R'lX!S#TX!S'lX!]'lX!d'lX'b'lX~O!]+YO!d$XO'b$cO!R!VX!S!VX~O]&QOk&QOx&RO'g(gO~OP9TOQ9TO]cOb;POc!jOhcOj9TOkcOlcOq9TOs9TOxRO{cO|cO}cO!T!bO!_9VO!dUO!g9TO!h9TO!i9TO!j9TO!k9TO!n!iO#t!lO#x^O'fQO'oYO'|:}O~O']9yO~P!;^O!R+^O!S'kX~O!S+`O~O!]+WO!{+VO!R#TX!S#TX~O!R+aO!S'vX~O!S+cO~O]&QOk&QOx&RO'^$bO'g(gO~O!X+dO!Y+dO~P!>[Ox$tO!Q+fO!T$uO']$`O!O&nX!R&nX~O_+jO!W+mO!X+iO!Y+iO!r+qO!s+oO!t+pO!u+nO!x+rO'^$bO'g(gO'o+gO~O!S+lO~P!?]OS+wO!T&cO!o+vO~O!{+}O!R'ra!c'ra_'ra'W'ra~O!]!wO~P!@gO!R&sO!c'qa~Ox$tO!Q,QO!T$uO#U,SO#V,QO']$`O!R&pX!c&pX~O_#Oi!R#Oi'W#Oi!O#Oi!c#Oin#Oi!T#Oi%Q#Oi!]#Oi~P!)cO#W!za!R!za!c!za!{!za!T!za_!za'W!za!O!za~P!#rO#W'eXP'eXZ'eX_'eXj'eXv'eX!a'eX!d'eX!j'eX#['eX#]'eX#^'eX#_'eX#`'eX#a'eX#b'eX#c'eX#e'eX#g'eX#i'eX#j'eX'W'eX'f'eX!c'eX!O'eX!T'eXn'eX%Q'eX!]'eX~P!'QO!R,]O'a'mX~P!#rO'a,_O~O!R,`O!c'nX~P!)cO!c,cO~O!O,dO~OP#^Ou!{Ov!{Ox!|O!b!yO!d!zO!j#^O'fQOZ#Zi_#Zij#Zi!R#Zi!a#Zi#]#Zi#^#Zi#_#Zi#`#Zi#a#Zi#b#Zi#c#Zi#e#Zi#g#Zi#i#Zi#j#Zi'W#Zi'p#Zi'w#Zi'x#Zi!O#Zi!c#Zin#Zi!T#Zi%Q#Zi!]#Zi~O#[#Zi~P!EtO#[#PO~P!EtOP#^Ou!{Ov!{Ox!|O!b!yO!d!zO!j#^O#[#PO#]#QO#^#QO#_#QO'fQOZ#Zi_#Zi!R#Zi!a#Zi#`#Zi#a#Zi#b#Zi#c#Zi#e#Zi#g#Zi#i#Zi#j#Zi'W#Zi'p#Zi'w#Zi'x#Zi!O#Zi!c#Zin#Zi!T#Zi%Q#Zi!]#Zi~Oj#Zi~P!H`Oj#RO~P!H`OP#^Oj#ROu!{Ov!{Ox!|O!b!yO!d!zO!j#^O#[#PO#]#QO#^#QO#_#QO#`#SO'fQO_#Zi!R#Zi#e#Zi#g#Zi#i#Zi#j#Zi'W#Zi'p#Zi'w#Zi'x#Zi!O#Zi!c#Zin#Zi!T#Zi%Q#Zi!]#Zi~OZ#Zi!a#Zi#a#Zi#b#Zi#c#Zi~P!JzOZ#dO!a#TO#a#TO#b#TO#c#TO~P!JzOP#^OZ#dOj#ROu!{Ov!{Ox!|O!a#TO!b!yO!d!zO!j#^O#[#PO#]#QO#^#QO#_#QO#`#SO#a#TO#b#TO#c#TO#e#UO'fQO_#Zi!R#Zi#g#Zi#i#Zi#j#Zi'W#Zi'p#Zi'x#Zi!O#Zi!c#Zin#Zi!T#Zi%Q#Zi!]#Zi~O'w#Zi~P!MrO'w!}O~P!MrOP#^OZ#dOj#ROu!{Ov!{Ox!|O!a#TO!b!yO!d!zO!j#^O#[#PO#]#QO#^#QO#_#QO#`#SO#a#TO#b#TO#c#TO#e#UO#g#WO'fQO'w!}O_#Zi!R#Zi#i#Zi#j#Zi'W#Zi'p#Zi!O#Zi!c#Zin#Zi!T#Zi%Q#Zi!]#Zi~O'x#Zi~P#!^O'x#OO~P#!^OP#^OZ#dOj#ROu!{Ov!{Ox!|O!a#TO!b!yO!d!zO!j#^O#[#PO#]#QO#^#QO#_#QO#`#SO#a#TO#b#TO#c#TO#e#UO#g#WO#i#YO'fQO'w!}O'x#OO~O_#Zi!R#Zi#j#Zi'W#Zi'p#Zi!O#Zi!c#Zin#Zi!T#Zi%Q#Zi!]#Zi~P#$xOP[XZ[Xj[Xu[Xv[Xx[X!a[X!b[X!d[X!j[X!{[X#WdX#[[X#][X#^[X#_[X#`[X#a[X#b[X#c[X#e[X#g[X#i[X#j[X#o[X'f[X'p[X'w[X'x[X!R[X!S[X~O#m[X~P#']OP#^OZ9iOj9^Ou!{Ov!{Ox!|O!a9`O!b!yO!d!zO!j#^O#[9[O#]9]O#^9]O#_9]O#`9_O#a9`O#b9`O#c9`O#e9aO#g9cO#i9eO#j9fO'fQO'p#[O'w!}O'x#OO~O#m,fO~P#)gOP'iXZ'iXj'iXu'iXv'iXx'iX!a'iX!b'iX!d'iX!j'iX#['iX#]'iX#^'iX#_'iX#`'iX#a'iX#b'iX#e'iX#g'iX#i'iX#j'iX'f'iX'p'iX'w'iX'x'iX!R'iX~O!{9jO#o9jO#c'iX#m'iX!S'iX~P#+bO_&sa!R&sa'W&sa!c&san&sa!O&sa!T&sa%Q&sa!]&sa~P!)cOP#ZiZ#Zi_#Zij#Ziv#Zi!R#Zi!a#Zi!b#Zi!d#Zi!j#Zi#[#Zi#]#Zi#^#Zi#_#Zi#`#Zi#a#Zi#b#Zi#c#Zi#e#Zi#g#Zi#i#Zi#j#Zi'W#Zi'f#Zi!O#Zi!c#Zin#Zi!T#Zi%Q#Zi!]#Zi~P!#rO_#ni!R#ni'W#ni!O#ni!c#nin#ni!T#ni%Q#ni!]#ni~P!)cO#z,hO~O#z,iO~O!]'kO!{,jO!T$OX#w$OX#z$OX$R$OX~O!Q,kO~O!T'nO#w,mO#z'mO$R,nO~O!R9gO!S'hX~P#)gO!S,oO~O$R,qO~OR'|O'U'}O'V,tO~O],wOk,wO!O,xO~O!RdX!]dX!cdX!c$eX'pdX~P!!iO!c-OO~P!#rO!R-PO!]!wO'p&nO!c'}X~O!c-UO~O!O$eX!R$eX!]$lX~P!!iO!R-WO!O(OX~P!#rO!]-YO~O!O-[O~O!Q(_O']$`O!c'}P~Oj-`O!]!wO!d$XO'b$cO'p&nO~O!])_O~O_$[O!R-eO'W$[O~O!S-gO~P!&XO!X-hO!Y-hO'^$bO'g(gO~Ox-jO'g(gO~O!x-kO~O']$zO!R&xX'a&xX~O!R(wO'a'ca~Ou-pOv-pOx-qO'pra'wra'xra!Rra!{ra~O'ara#mra~P#6qOu(ROx(SO'p$^a'w$^a'x$^a!R$^a!{$^a~O'a$^a#m$^a~P#7gOu(ROx(SO'p$`a'w$`a'x$`a!R$`a!{$`a~O'a$`a#m$`a~P#8YO]-rO~O#W-sO~O'a$na!R$na#m$na!{$na~P!#rO#W-vO~OS.PO!T&cO!o.OO%Q-}O~O'a.QO~O]#qOj#rOk#qOl#qOq$POs9kOx#xO!T#yO!_;RO!d#vO#V9tO#t$TO$_9nO$a9qO$d$UO'f#sO~Oh.SO'].RO~P#:PO!])_O!T'`a_'`a!R'`a'W'`a~O#W.YO~OZ[X!RdX!SdX~O!R.ZO!S(VX~O!S.]O~OZ.^O~O].`O'])gO~O!T$kO']$`O^'QX!R'QX~O!R)lO^(Ua~O!c.cO~P!)cO].eO~OZ.fO~O^.gO~OS.PO!T&cO!o.OO%Q-}O'b$cO~O!R)xO_(Ra'W(Ra~O!{.mO~OS.pO!T#yO~O'g'SO!S(SP~OS.zO!T.vO!o.yO%Q.xO'b$cO~OZ/UO!R/SO!S(TX~O!S/VO~O^/XO_$[O'W$[O~O]/YO~O]/ZO'](yO~O#c/[O%r/]O~P0zO!{#eO#c/[O%r/]O~O_/^O~P){O_/`O~O%{/dOP%yiQ%yiX%yi]%yi_%yib%yic%yih%yij%yik%yil%yiq%yis%yix%yi{%yi|%yi}%yi!T%yi!_%yi!d%yi!g%yi!h%yi!i%yi!j%yi!k%yi!n%yi#d%yi#t%yi#x%yi%P%yi%R%yi%T%yi%U%yi%X%yi%Z%yi%^%yi%_%yi%a%yi%n%yi%t%yi%v%yi%x%yi%z%yi%}%yi&T%yi&Z%yi&]%yi&_%yi&a%yi&c%yi'S%yi']%yi'f%yi'o%yi'|%yi!S%yi`%yi&Q%yi~O`/jO!S/hO&Q/iO~P`O!TSO!d/lO~O&X*uOP&SiQ&SiX&Si]&Si_&Sib&Sic&Sih&Sij&Sik&Sil&Siq&Sis&Six&Si{&Si|&Si}&Si!T&Si!_&Si!d&Si!g&Si!h&Si!i&Si!j&Si!k&Si!n&Si#d&Si#t&Si#x&Si%P&Si%R&Si%T&Si%U&Si%X&Si%Z&Si%^&Si%_&Si%a&Si%n&Si%t&Si%v&Si%x&Si%z&Si%}&Si&T&Si&Z&Si&]&Si&_&Si&a&Si&c&Si'S&Si']&Si'f&Si'o&Si'|&Si!S&Si%{&Si`&Si&Q&Si~O!R#bOn$]a~O!O&ii!R&ii~P!)cO!R%yO!O'ji~O!R&_O!O'ti~O!O/rO~O!R!Va!S!Va~P#)gO]&QOk&QO!Q/xO'g(gO!R&jX!S&jX~P@aO!R+^O!S'ka~O]&YOk&YO!Q)wO'g'SO!R&oX!S&oX~O!R+aO!S'va~O!O'ui!R'ui~P!)cO_$[O!]!wO!d$XO!j0SO!{0QO'W$[O'b$cO'p&nO~O!S0VO~P!?]O!X0WO!Y0WO'^$bO'g(gO'o+gO~O!W0XO~P#LVO!TSO!W0XO!u0ZO!x0[O~P#LVO!W0XO!s0^O!t0^O!u0ZO!x0[O~P#LVO!T&cO~O!T&cO~P!#rO!R'ri!c'ri_'ri'W'ri~P!)cO!{0gO!R'ri!c'ri_'ri'W'ri~O!R&sO!c'qi~Ox$tO!T$uO#V0iO']$`O~O#WraPraZra_rajra!ara!bra!dra!jra#[ra#]ra#^ra#_ra#`ra#ara#bra#cra#era#gra#ira#jra'Wra'fra!cra!Ora!Tranra%Qra!]ra~P#6qO#W$^aP$^aZ$^a_$^aj$^av$^a!a$^a!b$^a!d$^a!j$^a#[$^a#]$^a#^$^a#_$^a#`$^a#a$^a#b$^a#c$^a#e$^a#g$^a#i$^a#j$^a'W$^a'f$^a!c$^a!O$^a!T$^an$^a%Q$^a!]$^a~P#7gO#W$`aP$`aZ$`a_$`aj$`av$`a!a$`a!b$`a!d$`a!j$`a#[$`a#]$`a#^$`a#_$`a#`$`a#a$`a#b$`a#c$`a#e$`a#g$`a#i$`a#j$`a'W$`a'f$`a!c$`a!O$`a!T$`an$`a%Q$`a!]$`a~P#8YO#W$naP$naZ$na_$naj$nav$na!R$na!a$na!b$na!d$na!j$na#[$na#]$na#^$na#_$na#`$na#a$na#b$na#c$na#e$na#g$na#i$na#j$na'W$na'f$na!c$na!O$na!T$na!{$nan$na%Q$na!]$na~P!#rO_#Oq!R#Oq'W#Oq!O#Oq!c#Oqn#Oq!T#Oq%Q#Oq!]#Oq~P!)cO!R&kX'a&kX~PJdO!R,]O'a'ma~O!Q0qO!R&lX!c&lX~P){O!R,`O!c'na~O!R,`O!c'na~P!)cO#m!fa!S!fa~PCcO#m!^a!R!^a!S!^a~P#)gO!T1UO#x^O$P1VO~O!S1ZO~On1[O~P!#rO_$Yq!R$Yq'W$Yq!O$Yq!c$Yqn$Yq!T$Yq%Q$Yq!]$Yq~P!)cO!O1]O~O],wOk,wO~Ou(ROx(SO'x(WO'p$xi'w$xi!R$xi!{$xi~O'a$xi#m$xi~P$,vOu(ROx(SO'p$zi'w$zi'x$zi!R$zi!{$zi~O'a$zi#m$zi~P$-iO#m1^O~P!#rO!Q1`O']$`O!R&tX!c&tX~O!R-PO!c'}a~O!R-PO!]!wO!c'}a~O!R-PO!]!wO'p&nO!c'}a~O'a$gi!R$gi#m$gi!{$gi~P!#rO!Q1gO'](bO!O&vX!R&vX~P!$aO!R-WO!O(Oa~O!R-WO!O(Oa~P!#rO!]!wO~O!]!wO#c1oO~Oj1rO!]!wO'p&nO~O!R'di'a'di~P!#rO!{1uO!R'di'a'di~P!#rO!c1xO~O_$Zq!R$Zq'W$Zq!O$Zq!c$Zqn$Zq!T$Zq%Q$Zq!]$Zq~P!)cO!R1|O!T(PX~P!#rO!T&cO%Q2PO~O!T&cO%Q2PO~P!#rO!T$eX$u[X_$eX!R$eX'W$eX~P!!iO$u2TOugXxgX!TgX'pgX'wgX'xgX_gX!RgX'WgX~O$u2TO~O]2ZO%R2[O'])gO!R'PX!S'PX~O!R.ZO!S(Va~OZ2`O~O^2aO~O]2dO~OS2fO!T&cO!o2eO%Q2PO~O_$[O'W$[O~P!#rO!T#yO~P!#rO!R2kO!{2mO!S(SX~O!S2nO~Ox;]O!W2wO!X2pO!Y2pO!r2vO!s2uO!t2uO!x2tO'^$bO'g(gO'o+gO~O!S2sO~P$6QOS3OO!T.vO!o2}O%Q2|O~OS3OO!T.vO!o2}O%Q2|O'b$cO~O'](yO!R'OX!S'OX~O!R/SO!S(Ta~O]3YO'g3XO~O]3ZO~O^3]O~O!c3`O~P){O_3bO~O_3bO~P){O#c3dO%r3eO~PE{O`/jO!S3iO&Q/iO~P`O!]3kO~O!R#Ti!S#Ti~P#)gO!{3mO!R#Ti!S#Ti~O!R!Vi!S!Vi~P#)gO_$[O!{3tO'W$[O~O_$[O!]!wO!{3tO'W$[O~O!X3xO!Y3xO'^$bO'g(gO'o+gO~O_$[O!]!wO!d$XO!j3yO!{3tO'W$[O'b$cO'p&nO~O!W3zO~P$:oO!W3zO!u3}O!x4OO~P$:oO_$[O!]!wO!j3yO!{3tO'W$[O'p&nO~O!R'rq!c'rq_'rq'W'rq~P!)cO!R&sO!c'qq~O#W$xiP$xiZ$xi_$xij$xiv$xi!a$xi!b$xi!d$xi!j$xi#[$xi#]$xi#^$xi#_$xi#`$xi#a$xi#b$xi#c$xi#e$xi#g$xi#i$xi#j$xi'W$xi'f$xi!c$xi!O$xi!T$xin$xi%Q$xi!]$xi~P$,vO#W$ziP$ziZ$zi_$zij$ziv$zi!a$zi!b$zi!d$zi!j$zi#[$zi#]$zi#^$zi#_$zi#`$zi#a$zi#b$zi#c$zi#e$zi#g$zi#i$zi#j$zi'W$zi'f$zi!c$zi!O$zi!T$zin$zi%Q$zi!]$zi~P$-iO#W$giP$giZ$gi_$gij$giv$gi!R$gi!a$gi!b$gi!d$gi!j$gi#[$gi#]$gi#^$gi#_$gi#`$gi#a$gi#b$gi#c$gi#e$gi#g$gi#i$gi#j$gi'W$gi'f$gi!c$gi!O$gi!T$gi!{$gin$gi%Q$gi!]$gi~P!#rO!R&ka'a&ka~P!#rO!R&la!c&la~P!)cO!R,`O!c'ni~O#m#Oi!R#Oi!S#Oi~P#)gOP#^Ou!{Ov!{Ox!|O!b!yO!d!zO!j#^O'fQOZ#Zij#Zi!a#Zi#]#Zi#^#Zi#_#Zi#`#Zi#a#Zi#b#Zi#c#Zi#e#Zi#g#Zi#i#Zi#j#Zi#m#Zi'p#Zi'w#Zi'x#Zi!R#Zi!S#Zi~O#[#Zi~P$DVO#[9[O~P$DVOP#^Ou!{Ov!{Ox!|O!b!yO!d!zO!j#^O#[9[O#]9]O#^9]O#_9]O'fQOZ#Zi!a#Zi#`#Zi#a#Zi#b#Zi#c#Zi#e#Zi#g#Zi#i#Zi#j#Zi#m#Zi'p#Zi'w#Zi'x#Zi!R#Zi!S#Zi~Oj#Zi~P$F_Oj9^O~P$F_OP#^Oj9^Ou!{Ov!{Ox!|O!b!yO!d!zO!j#^O#[9[O#]9]O#^9]O#_9]O#`9_O'fQO#e#Zi#g#Zi#i#Zi#j#Zi#m#Zi'p#Zi'w#Zi'x#Zi!R#Zi!S#Zi~OZ#Zi!a#Zi#a#Zi#b#Zi#c#Zi~P$HgOZ9iO!a9`O#a9`O#b9`O#c9`O~P$HgOP#^OZ9iOj9^Ou!{Ov!{Ox!|O!a9`O!b!yO!d!zO!j#^O#[9[O#]9]O#^9]O#_9]O#`9_O#a9`O#b9`O#c9`O#e9aO'fQO#g#Zi#i#Zi#j#Zi#m#Zi'p#Zi'x#Zi!R#Zi!S#Zi~O'w#Zi~P$J{O'w!}O~P$J{OP#^OZ9iOj9^Ou!{Ov!{Ox!|O!a9`O!b!yO!d!zO!j#^O#[9[O#]9]O#^9]O#_9]O#`9_O#a9`O#b9`O#c9`O#e9aO#g9cO'fQO'w!}O#i#Zi#j#Zi#m#Zi'p#Zi!R#Zi!S#Zi~O'x#Zi~P$MTO'x#OO~P$MTOP#^OZ9iOj9^Ou!{Ov!{Ox!|O!a9`O!b!yO!d!zO!j#^O#[9[O#]9]O#^9]O#_9]O#`9_O#a9`O#b9`O#c9`O#e9aO#g9cO#i9eO'fQO'w!}O'x#OO~O#j#Zi#m#Zi'p#Zi!R#Zi!S#Zi~P% ]O_#ky!R#ky'W#ky!O#ky!c#kyn#ky!T#ky%Q#ky!]#ky~P!)cOP#ZiZ#Zij#Ziv#Zi!a#Zi!b#Zi!d#Zi!j#Zi#[#Zi#]#Zi#^#Zi#_#Zi#`#Zi#a#Zi#b#Zi#c#Zi#e#Zi#g#Zi#i#Zi#j#Zi#m#Zi'f#Zi!R#Zi!S#Zi~P!#rO!b!yOu'eXx'eX'p'eX'w'eX'x'eX!S'eX~OP'eXZ'eXj'eXv'eX!a'eX!d'eX!j'eX#['eX#]'eX#^'eX#_'eX#`'eX#a'eX#b'eX#c'eX#e'eX#g'eX#i'eX#j'eX#m'eX'f'eX!R'eX~P%%mO#m#ni!R#ni!S#ni~P#)gO!S4`O~O!R&sa!S&sa~P#)gO!]!wO'p&nO!R&ta!c&ta~O!R-PO!c'}i~O!R-PO!]!wO!c'}i~O!O&va!R&va~P!#rO!]4gO~O!R-WO!O(Oi~P!#rO!R-WO!O(Oi~O!O4kO~O!]!wO#c4pO~Oj4qO!]!wO'p&nO~O!O4sO~O'a$iq!R$iq#m$iq!{$iq~P!#rO_$Zy!R$Zy'W$Zy!O$Zy!c$Zyn$Zy!T$Zy%Q$Zy!]$Zy~P!)cO!R1|O!T(Pa~O!T&cO%Q4xO~O!T&cO%Q4xO~P!#rO_#Oy!R#Oy'W#Oy!O#Oy!c#Oyn#Oy!T#Oy%Q#Oy!]#Oy~P!)cOZ4{O~O]4}O'])gO~O!R.ZO!S(Vi~O]5QO~O^5RO~O'g'SO!R&{X!S&{X~O!R2kO!S(Sa~O!S5`O~P$6QOx;^O'g(gO'o+gO~O!W5cO!X5bO!Y5bO!x0[O'^$bO'g(gO'o+gO~O!s5dO!t5dO~P%.RO!X5bO!Y5bO'^$bO'g(gO'o+gO~O!T.vO~O!T.vO%Q5fO~O!T.vO%Q5fO~P!#rOS5kO!T.vO!o5jO%Q5fO~OZ5pO!R'Oa!S'Oa~O!R/SO!S(Ti~O]5sO~O!c5tO~O!c5uO~O!c5vO~O!c5vO~P){O_5xO~O!]5{O~O!c5|O~O!R'ui!S'ui~P#)gO_$[O'W$[O~P!)cO_$[O!{6RO'W$[O~O_$[O!]!wO!{6RO'W$[O~O!X6WO!Y6WO'^$bO'g(gO'o+gO~O_$[O!]!wO!j6XO!{6RO'W$[O'p&nO~O!d$XO'b$cO~P%2mO!W6YO~P%2[O!R'ry!c'ry_'ry'W'ry~P!)cO#W$iqP$iqZ$iq_$iqj$iqv$iq!R$iq!a$iq!b$iq!d$iq!j$iq#[$iq#]$iq#^$iq#_$iq#`$iq#a$iq#b$iq#c$iq#e$iq#g$iq#i$iq#j$iq'W$iq'f$iq!c$iq!O$iq!T$iq!{$iqn$iq%Q$iq!]$iq~P!#rO!R&li!c&li~P!)cO#m#Oq!R#Oq!S#Oq~P#)gOu-pOv-pOx-qO'pra'wra'xra!Sra~OPraZrajra!ara!bra!dra!jra#[ra#]ra#^ra#_ra#`ra#ara#bra#cra#era#gra#ira#jra#mra'fra!Rra~P%6eOu(ROx(SO'p$^a'w$^a'x$^a!S$^a~OP$^aZ$^aj$^av$^a!a$^a!b$^a!d$^a!j$^a#[$^a#]$^a#^$^a#_$^a#`$^a#a$^a#b$^a#c$^a#e$^a#g$^a#i$^a#j$^a#m$^a'f$^a!R$^a~P%8fOu(ROx(SO'p$`a'w$`a'x$`a!S$`a~OP$`aZ$`aj$`av$`a!a$`a!b$`a!d$`a!j$`a#[$`a#]$`a#^$`a#_$`a#`$`a#a$`a#b$`a#c$`a#e$`a#g$`a#i$`a#j$`a#m$`a'f$`a!R$`a~P%:gOP$naZ$naj$nav$na!a$na!b$na!d$na!j$na#[$na#]$na#^$na#_$na#`$na#a$na#b$na#c$na#e$na#g$na#i$na#j$na#m$na'f$na!R$na!S$na~P!#rO#m$Yq!R$Yq!S$Yq~P#)gO#m$Zq!R$Zq!S$Zq~P#)gO!S6dO~O'a$|y!R$|y#m$|y!{$|y~P!#rO!]!wO!R&ti!c&ti~O!]!wO'p&nO!R&ti!c&ti~O!R-PO!c'}q~O!O&vi!R&vi~P!#rO!R-WO!O(Oq~O!O6jO~P!#rO!O6jO~O!R'dy'a'dy~P!#rO!R&ya!T&ya~P!#rO!T$tq_$tq!R$tq'W$tq~P!#rOZ6qO~O!R.ZO!S(Vq~O]6tO~O!T&cO%Q6uO~O!T&cO%Q6uO~P!#rO!{6vO!R&{a!S&{a~O!R2kO!S(Si~P#)gO!X6|O!Y6|O'^$bO'g(gO'o+gO~O!W7OO!x4OO~P%BkO!T.vO%Q7RO~O!T.vO%Q7RO~P!#rO]7YO'g7XO~O!R/SO!S(Tq~O!c7[O~O!c7[O~P){O!c7^O~O!c7_O~O!R#Ty!S#Ty~P#)gO_$[O!{7eO'W$[O~O_$[O!]!wO!{7eO'W$[O~O!X7hO!Y7hO'^$bO'g(gO'o+gO~O_$[O!]!wO!j7iO!{7eO'W$[O'p&nO~O#W$|yP$|yZ$|y_$|yj$|yv$|y!R$|y!a$|y!b$|y!d$|y!j$|y#[$|y#]$|y#^$|y#_$|y#`$|y#a$|y#b$|y#c$|y#e$|y#g$|y#i$|y#j$|y'W$|y'f$|y!c$|y!O$|y!T$|y!{$|yn$|y%Q$|y!]$|y~P!#rO#m#ky!R#ky!S#ky~P#)gOP$giZ$gij$giv$gi!a$gi!b$gi!d$gi!j$gi#[$gi#]$gi#^$gi#_$gi#`$gi#a$gi#b$gi#c$gi#e$gi#g$gi#i$gi#j$gi#m$gi'f$gi!R$gi!S$gi~P!#rOu(ROx(SO'x(WO'p$xi'w$xi!S$xi~OP$xiZ$xij$xiv$xi!a$xi!b$xi!d$xi!j$xi#[$xi#]$xi#^$xi#_$xi#`$xi#a$xi#b$xi#c$xi#e$xi#g$xi#i$xi#j$xi#m$xi'f$xi!R$xi~P%JROu(ROx(SO'p$zi'w$zi'x$zi!S$zi~OP$ziZ$zij$ziv$zi!a$zi!b$zi!d$zi!j$zi#[$zi#]$zi#^$zi#_$zi#`$zi#a$zi#b$zi#c$zi#e$zi#g$zi#i$zi#j$zi#m$zi'f$zi!R$zi~P%LSO#m$Zy!R$Zy!S$Zy~P#)gO#m#Oy!R#Oy!S#Oy~P#)gO!]!wO!R&tq!c&tq~O!R-PO!c'}y~O!O&vq!R&vq~P!#rO!O7mO~P!#rO!R.ZO!S(Vy~O!R2kO!S(Sq~O!X7yO!Y7yO'^$bO'g(gO'o+gO~O!T.vO%Q7|O~O!T.vO%Q7|O~P!#rO!c8PO~O_$[O!{8UO'W$[O~O_$[O!]!wO!{8UO'W$[O~OP$iqZ$iqj$iqv$iq!a$iq!b$iq!d$iq!j$iq#[$iq#]$iq#^$iq#_$iq#`$iq#a$iq#b$iq#c$iq#e$iq#g$iq#i$iq#j$iq#m$iq'f$iq!R$iq!S$iq~P!#rO!R&{q!S&{q~P#)gO_$[O!{8hO'W$[O~OP$|yZ$|yj$|yv$|y!a$|y!b$|y!d$|y!j$|y#[$|y#]$|y#^$|y#_$|y#`$|y#a$|y#b$|y#c$|y#e$|y#g$|y#i$|y#j$|y#m$|y'f$|y!R$|y!S$|y~P!#rO!S!za!W!za!X!za!Y!za!r!za!s!za!t!za!x!za'^!za'g!za'o!za~P!#rO!W'eX!X'eX!Y'eX!r'eX!s'eX!t'eX!x'eX'^'eX'g'eX'o'eX~P%%mO!Wra!Xra!Yra!rra!sra!tra!xra'^ra'gra'ora~P%6eO!W$^a!X$^a!Y$^a!r$^a!s$^a!t$^a!x$^a'^$^a'g$^a'o$^a~P%8fO!W$`a!X$`a!Y$`a!r$`a!s$`a!t$`a!x$`a'^$`a'g$`a'o$`a~P%:gO!S$na!W$na!X$na!Y$na!r$na!s$na!t$na!x$na'^$na'g$na'o$na~P!#rO!W$xi!X$xi!Y$xi!r$xi!s$xi!t$xi!x$xi'^$xi'g$xi'o$xi~P%JRO!W$zi!X$zi!Y$zi!r$zi!s$zi!t$zi!x$zi'^$zi'g$zi'o$zi~P%LSO!S$gi!W$gi!X$gi!Y$gi!r$gi!s$gi!t$gi!x$gi'^$gi'g$gi'o$gi~P!#rO!S$iq!W$iq!X$iq!Y$iq!r$iq!s$iq!t$iq!x$iq'^$iq'g$iq'o$iq~P!#rO!S$|y!W$|y!X$|y!Y$|y!r$|y!s$|y!t$|y!x$|y'^$|y'g$|y'o$|y~P!#rOn'hX~P.jOn[X!O[X!c[X%r[X!T[X%Q[X!][X~P$zO!]dX!c[X!cdX'pdX~P;aOP9TOQ9TO]cOb;POc!jOhcOj9TOkcOlcOq9TOs9TOxRO{cO|cO}cO!TSO!_9VO!dUO!g9TO!h9TO!i9TO!j9TO!k9TO!n!iO#t!lO#x^O']'bO'fQO'oYO'|:}O~O]#qOh$OOj#rOk#qOl#qOq$POs9lOx#xO!T#yO!_;SO!d#vO#V9uO#t$TO$_9oO$a9rO$d$UO']&zO'f#sO~O!R9gO!S$]a~O]#qOh$OOj#rOk#qOl#qOq$POs9mOx#xO!T#yO!_;TO!d#vO#V9vO#t$TO$_9pO$a9sO$d$UO']&zO'f#sO~O#d'iO~P&3xO!S[X!SdX~P;aO!]9ZO~O#W9YO~O!]!wO#W9YO~O!{9jO~O#c9`O~O!{9wO!R'uX!S'uX~O!{9jO!R'sX!S'sX~O#W9xO~O'a9zO~P!#rO#W:RO~O#W:SO~O#W:TO~O!]!wO#W:UO~O!]!wO#W9xO~O#m:VO~P#)gO#W:WO~O#W:XO~O#W:YO~O#W:ZO~O#W:[O~O#m:]O~P!#rO#m:^O~P!#rO#m:_O~P!#rO!O:`O~O!O:aO~P!#rO!O:aO~O!O:bO~P!#rO!]!wO#c;YO~O!]!wO#c;[O~O#x~!b!r!t!u#U#V'|$_$a$d$u%P%Q%R%X%Z%^%_%a%c~UT#x'|#]}'Y'Z#z'Y']'g~",goto:"#Hc(ZPPPPPPPP([P(lP*`PPPP-zPP.a3s5g5zP5zPPP5zP7t5zP5zP7xPP8OP8dk|}?O}!O>k!O!P?`!P!QCl!Q!R!0[!R![!1q![!]!7s!]!^!8V!^!_!8g!_!`!9d!`!a!:[!a!b!U#R#S2`#S#T!>i#T#o2`#o#p!>y#p#q!?O#q#r!?f#r#s!?x#s$f%T$f$g%c$g#BY2`#BY#BZ!@Y#BZ$IS2`$IS$I_!@Y$I_$I|2`$I|$I}!Bq$I}$JO!Bq$JO$JT2`$JT$JU!@Y$JU$KV2`$KV$KW!@Y$KW&FU2`&FU&FV!@Y&FV?HT2`?HT?HU!@Y?HU~2`W%YR$UWO!^%T!_#o%T#p~%T7Z%jg$UW'Y7ROX%TXY%cYZ%TZ[%c[p%Tpq%cq!^%T!_#o%T#p$f%T$f$g%c$g#BY%T#BY#BZ%c#BZ$IS%T$IS$I_%c$I_$JT%T$JT$JU%c$JU$KV%T$KV$KW%c$KW&FU%T&FU&FV%c&FV?HT%T?HT?HU%c?HU~%T7Z'YR$UW'Z7RO!^%T!_#o%T#p~%T$T'jS$UW!j#{O!^%T!_!`'v!`#o%T#p~%T$O'}S#e#v$UWO!^%T!_!`(Z!`#o%T#p~%T$O(bR#e#v$UWO!^%T!_#o%T#p~%T'u(rZ$UW]!ROY(kYZ)eZr(krs*rs!^(k!^!_+U!_#O(k#O#P-b#P#o(k#o#p+U#p~(k&r)jV$UWOr)ers*Ps!^)e!^!_*a!_#o)e#o#p*a#p~)e&r*WR$P&j$UWO!^%T!_#o%T#p~%T&j*dROr*ars*ms~*a&j*rO$P&j'u*{R$P&j$UW]!RO!^%T!_#o%T#p~%T'm+ZV]!ROY+UYZ*aZr+Urs+ps#O+U#O#P+w#P~+U'm+wO$P&j]!R'm+zROr+Urs,Ts~+U'm,[U$P&j]!ROY,nZr,nrs-Vs#O,n#O#P-[#P~,n!R,sU]!ROY,nZr,nrs-Vs#O,n#O#P-[#P~,n!R-[O]!R!R-_PO~,n'u-gV$UWOr(krs-|s!^(k!^!_+U!_#o(k#o#p+U#p~(k'u.VZ$P&j$UW]!ROY.xYZ%TZr.xrs/rs!^.x!^!_,n!_#O.x#O#P0S#P#o.x#o#p,n#p~.x!Z/PZ$UW]!ROY.xYZ%TZr.xrs/rs!^.x!^!_,n!_#O.x#O#P0S#P#o.x#o#p,n#p~.x!Z/yR$UW]!RO!^%T!_#o%T#p~%T!Z0XT$UWO!^.x!^!_,n!_#o.x#o#p,n#p~.x2k0mZ$UWOt%Ttu1`u!^%T!_!c%T!c!}1`!}#R%T#R#S1`#S#T%T#T#o1`#p$g%T$g~1`2k1g]$UW'o2cOt%Ttu1`u!Q%T!Q![1`![!^%T!_!c%T!c!}1`!}#R%T#R#S1`#S#T%T#T#o1`#p$g%T$g~1`7Z2k_$UW#zS']%k'g2bOt%Ttu2`u}%T}!O3j!O!Q%T!Q![2`![!^%T!_!c%T!c!}2`!}#R%T#R#S2`#S#T%T#T#o2`#p$g%T$g~2`[3q_$UW#zSOt%Ttu3ju}%T}!O3j!O!Q%T!Q![3j![!^%T!_!c%T!c!}3j!}#R%T#R#S3j#S#T%T#T#o3j#p$g%T$g~3j$O4wS#^#v$UWO!^%T!_!`5T!`#o%T#p~%T$O5[R$UW#o#vO!^%T!_#o%T#p~%T6d5lU'x6[$UWOv%Tvw6Ow!^%T!_!`5T!`#o%T#p~%T$O6VS$UW#i#vO!^%T!_!`5T!`#o%T#p~%T'u6jZ$UW]!ROY6cYZ7]Zw6cwx*rx!^6c!^!_8T!_#O6c#O#P:T#P#o6c#o#p8T#p~6c&r7bV$UWOw7]wx*Px!^7]!^!_7w!_#o7]#o#p7w#p~7]&j7zROw7wwx*mx~7w'm8YV]!ROY8TYZ7wZw8Twx+px#O8T#O#P8o#P~8T'm8rROw8Twx8{x~8T'm9SU$P&j]!ROY9fZw9fwx-Vx#O9f#O#P9}#P~9f!R9kU]!ROY9fZw9fwx-Vx#O9f#O#P9}#P~9f!R:QPO~9f'u:YV$UWOw6cwx:ox!^6c!^!_8T!_#o6c#o#p8T#p~6c'u:xZ$P&j$UW]!ROY;kYZ%TZw;kwx/rx!^;k!^!_9f!_#O;k#O#PW{!^%T!_!`5T!`#o%T#p~%T$O>_S#[#v$UWO!^%T!_!`5T!`#o%T#p~%T$u>rSj$m$UWO!^%T!_!`5T!`#o%T#p~%T&i?VR!R&a$UWO!^%T!_#o%T#p~%T7Z?gVu6`$UWO!O%T!O!P?|!P!Q%T!Q![@r![!^%T!_#o%T#p~%Ty@RT$UWO!O%T!O!P@b!P!^%T!_#o%T#p~%Ty@iR!Qq$UWO!^%T!_#o%T#p~%Ty@yZ$UWkqO!Q%T!Q![@r![!^%T!_!g%T!g!hAl!h#R%T#R#S@r#S#X%T#X#YAl#Y#o%T#p~%TyAqZ$UWO{%T{|Bd|}%T}!OBd!O!Q%T!Q![CO![!^%T!_#R%T#R#SCO#S#o%T#p~%TyBiV$UWO!Q%T!Q![CO![!^%T!_#R%T#R#SCO#S#o%T#p~%TyCVV$UWkqO!Q%T!Q![CO![!^%T!_#R%T#R#SCO#S#o%T#p~%T7ZCs`$UW#]#vOYDuYZ%TZzDuz{Jl{!PDu!P!Q!-e!Q!^Du!^!_Fx!_!`!.^!`!a!/]!a!}Du!}#OHq#O#PJQ#P#oDu#o#pFx#p~DuXD|[$UW}POYDuYZ%TZ!PDu!P!QEr!Q!^Du!^!_Fx!_!}Du!}#OHq#O#PJQ#P#oDu#o#pFx#p~DuXEy_$UW}PO!^%T!_#Z%T#Z#[Er#[#]%T#]#^Er#^#a%T#a#bEr#b#g%T#g#hEr#h#i%T#i#jEr#j#m%T#m#nEr#n#o%T#p~%TPF}V}POYFxZ!PFx!P!QGd!Q!}Fx!}#OG{#O#PHh#P~FxPGiU}P#Z#[Gd#]#^Gd#a#bGd#g#hGd#i#jGd#m#nGdPHOTOYG{Z#OG{#O#PH_#P#QFx#Q~G{PHbQOYG{Z~G{PHkQOYFxZ~FxXHvY$UWOYHqYZ%TZ!^Hq!^!_G{!_#OHq#O#PIf#P#QDu#Q#oHq#o#pG{#p~HqXIkV$UWOYHqYZ%TZ!^Hq!^!_G{!_#oHq#o#pG{#p~HqXJVV$UWOYDuYZ%TZ!^Du!^!_Fx!_#oDu#o#pFx#p~Du7ZJs^$UW}POYJlYZKoZzJlz{NQ{!PJl!P!Q!,R!Q!^Jl!^!_!!]!_!}Jl!}#O!'|#O#P!+a#P#oJl#o#p!!]#p~Jl7ZKtV$UWOzKoz{LZ{!^Ko!^!_M]!_#oKo#o#pM]#p~Ko7ZL`X$UWOzKoz{LZ{!PKo!P!QL{!Q!^Ko!^!_M]!_#oKo#o#pM]#p~Ko7ZMSR$UWU7RO!^%T!_#o%T#p~%T7RM`ROzM]z{Mi{~M]7RMlTOzM]z{Mi{!PM]!P!QM{!Q~M]7RNQOU7R7ZNX^$UW}POYJlYZKoZzJlz{NQ{!PJl!P!Q! T!Q!^Jl!^!_!!]!_!}Jl!}#O!'|#O#P!+a#P#oJl#o#p!!]#p~Jl7Z! ^_$UWU7R}PO!^%T!_#Z%T#Z#[Er#[#]%T#]#^Er#^#a%T#a#bEr#b#g%T#g#hEr#h#i%T#i#jEr#j#m%T#m#nEr#n#o%T#p~%T7R!!bY}POY!!]YZM]Zz!!]z{!#Q{!P!!]!P!Q!&x!Q!}!!]!}#O!$`#O#P!&f#P~!!]7R!#VY}POY!!]YZM]Zz!!]z{!#Q{!P!!]!P!Q!#u!Q!}!!]!}#O!$`#O#P!&f#P~!!]7R!#|UU7R}P#Z#[Gd#]#^Gd#a#bGd#g#hGd#i#jGd#m#nGd7R!$cWOY!$`YZM]Zz!$`z{!${{#O!$`#O#P!&S#P#Q!!]#Q~!$`7R!%OYOY!$`YZM]Zz!$`z{!${{!P!$`!P!Q!%n!Q#O!$`#O#P!&S#P#Q!!]#Q~!$`7R!%sTU7ROYG{Z#OG{#O#PH_#P#QFx#Q~G{7R!&VTOY!$`YZM]Zz!$`z{!${{~!$`7R!&iTOY!!]YZM]Zz!!]z{!#Q{~!!]7R!&}_}POzM]z{Mi{#ZM]#Z#[!&x#[#]M]#]#^!&x#^#aM]#a#b!&x#b#gM]#g#h!&x#h#iM]#i#j!&x#j#mM]#m#n!&x#n~M]7Z!(R[$UWOY!'|YZKoZz!'|z{!(w{!^!'|!^!_!$`!_#O!'|#O#P!*o#P#QJl#Q#o!'|#o#p!$`#p~!'|7Z!(|^$UWOY!'|YZKoZz!'|z{!(w{!P!'|!P!Q!)x!Q!^!'|!^!_!$`!_#O!'|#O#P!*o#P#QJl#Q#o!'|#o#p!$`#p~!'|7Z!*PY$UWU7ROYHqYZ%TZ!^Hq!^!_G{!_#OHq#O#PIf#P#QDu#Q#oHq#o#pG{#p~Hq7Z!*tX$UWOY!'|YZKoZz!'|z{!(w{!^!'|!^!_!$`!_#o!'|#o#p!$`#p~!'|7Z!+fX$UWOYJlYZKoZzJlz{NQ{!^Jl!^!_!!]!_#oJl#o#p!!]#p~Jl7Z!,Yc$UW}POzKoz{LZ{!^Ko!^!_M]!_#ZKo#Z#[!,R#[#]Ko#]#^!,R#^#aKo#a#b!,R#b#gKo#g#h!,R#h#iKo#i#j!,R#j#mKo#m#n!,R#n#oKo#o#pM]#p~Ko7Z!-lV$UWT7ROY!-eYZ%TZ!^!-e!^!_!.R!_#o!-e#o#p!.R#p~!-e7R!.WQT7ROY!.RZ~!.R$P!.g[$UW#o#v}POYDuYZ%TZ!PDu!P!QEr!Q!^Du!^!_Fx!_!}Du!}#OHq#O#PJQ#P#oDu#o#pFx#p~Du]!/f[#wS$UW}POYDuYZ%TZ!PDu!P!QEr!Q!^Du!^!_Fx!_!}Du!}#OHq#O#PJQ#P#oDu#o#pFx#p~Duy!0cd$UWkqO!O%T!O!P@r!P!Q%T!Q![!1q![!^%T!_!g%T!g!hAl!h#R%T#R#S!1q#S#U%T#U#V!3X#V#X%T#X#YAl#Y#b%T#b#c!2w#c#d!4m#d#l%T#l#m!5{#m#o%T#p~%Ty!1x_$UWkqO!O%T!O!P@r!P!Q%T!Q![!1q![!^%T!_!g%T!g!hAl!h#R%T#R#S!1q#S#X%T#X#YAl#Y#b%T#b#c!2w#c#o%T#p~%Ty!3OR$UWkqO!^%T!_#o%T#p~%Ty!3^W$UWO!Q%T!Q!R!3v!R!S!3v!S!^%T!_#R%T#R#S!3v#S#o%T#p~%Ty!3}Y$UWkqO!Q%T!Q!R!3v!R!S!3v!S!^%T!_#R%T#R#S!3v#S#b%T#b#c!2w#c#o%T#p~%Ty!4rV$UWO!Q%T!Q!Y!5X!Y!^%T!_#R%T#R#S!5X#S#o%T#p~%Ty!5`X$UWkqO!Q%T!Q!Y!5X!Y!^%T!_#R%T#R#S!5X#S#b%T#b#c!2w#c#o%T#p~%Ty!6QZ$UWO!Q%T!Q![!6s![!^%T!_!c%T!c!i!6s!i#R%T#R#S!6s#S#T%T#T#Z!6s#Z#o%T#p~%Ty!6z]$UWkqO!Q%T!Q![!6s![!^%T!_!c%T!c!i!6s!i#R%T#R#S!6s#S#T%T#T#Z!6s#Z#b%T#b#c!2w#c#o%T#p~%T%w!7|R!]V$UW#m%hO!^%T!_#o%T#p~%T!P!8^R_w$UWO!^%T!_#o%T#p~%T6i!8rR'bd!a0`#x&s'|P!P!Q!8{!^!_!9Q!_!`!9_W!9QO$WW#v!9VP#`#v!_!`!9Y#v!9_O#o#v#v!9dO#a#v%w!9kT!{%o$UWO!^%T!_!`'v!`!a!9z!a#o%T#p~%T$P!:RR#W#w$UWO!^%T!_#o%T#p~%T%w!:gT'a!s#a#v$RS$UWO!^%T!_!`!:v!`!a!;W!a#o%T#p~%T$O!:}R#a#v$UWO!^%T!_#o%T#p~%T$O!;_T#`#v$UWO!^%T!_!`5T!`!a!;n!a#o%T#p~%T$O!;uS#`#v$UWO!^%T!_!`5T!`#o%T#p~%T6i!]S#g#v$UWO!^%T!_!`5T!`#o%T#p~%T$P!>pR$UW'f#wO!^%T!_#o%T#p~%T~!?OO!T~6d!?VT'w6[$UWO!^%T!_!`5T!`#o%T#p#q!=P#q~%T5g!?oR!S5]nQ$UWO!^%T!_#o%T#p~%TX!@PR!kP$UWO!^%T!_#o%T#p~%T7Z!@gr$UW'Y7R#zS']%k'g2bOX%TXY%cYZ%TZ[%c[p%Tpq%cqt%Ttu2`u}%T}!O3j!O!Q%T!Q![2`![!^%T!_!c%T!c!}2`!}#R%T#R#S2`#S#T%T#T#o2`#p$f%T$f$g%c$g#BY2`#BY#BZ!@Y#BZ$IS2`$IS$I_!@Y$I_$JT2`$JT$JU!@Y$JU$KV2`$KV$KW!@Y$KW&FU2`&FU&FV!@Y&FV?HT2`?HT?HU!@Y?HU~2`7Z!CO_$UW'Z7R#zS']%k'g2bOt%Ttu2`u}%T}!O3j!O!Q%T!Q![2`![!^%T!_!c%T!c!}2`!}#R%T#R#S2`#S#T%T#T#o2`#p$g%T$g~2`",tokenizers:[RJe,$Je,qJe,0,1,2,3,4,5,6,7,8,9,BJe],topRules:{Script:[0,7]},dialects:{jsx:11707,ts:11709},dynamicPrecedences:{149:1,176:1},specialized:[{term:289,get:(e,t)=>LJe(e,t)<<1},{term:289,get:e=>UJe[e]||-1},{term:299,get:e=>WJe[e]||-1},{term:63,get:e=>HJe[e]||-1}],tokenPrec:11730});var VJe=0,vD=class{constructor(t,r){this.from=t,this.to=r}},Di=class{constructor(t={}){this.id=VJe++,this.perNode=!!t.perNode,this.deserialize=t.deserialize||(()=>{throw new Error("This node type doesn't define a deserialize function")})}add(t){if(this.perNode)throw new RangeError("Can't add per-node props to node types");return typeof t!="function"&&(t=Yu.match(t)),r=>{let n=t(r);return n===void 0?null:[this,n]}}};Di.closedBy=new Di({deserialize:e=>e.split(" ")});Di.openedBy=new Di({deserialize:e=>e.split(" ")});Di.group=new Di({deserialize:e=>e.split(" ")});Di.contextHash=new Di({perNode:!0});Di.lookAhead=new Di({perNode:!0});Di.mounted=new Di({perNode:!0});var GJe=Object.create(null),Yu=class{constructor(t,r,n,i=0){this.name=t,this.props=r,this.id=n,this.flags=i}static define(t){let r=t.props&&t.props.length?Object.create(null):GJe,n=(t.top?1:0)|(t.skipped?2:0)|(t.error?4:0)|(t.name==null?8:0),i=new Yu(t.name||"",r,t.id,n);if(t.props){for(let a of t.props)if(Array.isArray(a)||(a=a(i)),a){if(a[0].perNode)throw new RangeError("Can't store a per-node prop on a node type");r[a[0].id]=a[1]}}return i}prop(t){return this.props[t.id]}get isTop(){return(this.flags&1)>0}get isSkipped(){return(this.flags&2)>0}get isError(){return(this.flags&4)>0}get isAnonymous(){return(this.flags&8)>0}is(t){if(typeof t=="string"){if(this.name==t)return!0;let r=this.prop(Di.group);return r?r.indexOf(t)>-1:!1}return this.id==t}static match(t){let r=Object.create(null);for(let n in t)for(let i of n.split(" "))r[i]=t[n];return n=>{for(let i=n.prop(Di.group),a=-1;a<(i?i.length:0);a++){let o=r[a<0?n.name:i[a]];if(o)return o}}}};Yu.none=new Yu("",Object.create(null),0,8);var X9=new WeakMap,dke=new WeakMap,Ss;(function(e){e[e.ExcludeBuffers=1]="ExcludeBuffers",e[e.IncludeAnonymous=2]="IncludeAnonymous",e[e.IgnoreMounts=4]="IgnoreMounts",e[e.IgnoreOverlays=8]="IgnoreOverlays"})(Ss||(Ss={}));var Es=class{constructor(t,r,n,i,a){if(this.type=t,this.children=r,this.positions=n,this.length=i,this.props=null,a&&a.length){this.props=Object.create(null);for(let[o,s]of a)this.props[typeof o=="number"?o:o.id]=s}}toString(){let t=this.prop(Di.mounted);if(t&&!t.overlay)return t.tree.toString();let r="";for(let n of this.children){let i=n.toString();i&&(r&&(r+=","),r+=i)}return this.type.name?(/\W/.test(this.type.name)&&!this.type.isError?JSON.stringify(this.type.name):this.type.name)+(r.length?"("+r+")":""):r}cursor(t=0){return new I2(this.topNode,t)}cursorAt(t,r=0,n=0){let i=X9.get(this)||this.topNode,a=new I2(i);return a.moveTo(t,r),X9.set(this,a._tree),a}get topNode(){return new Pf(this,0,0,null)}resolve(t,r=0){let n=P2(X9.get(this)||this.topNode,t,r,!1);return X9.set(this,n),n}resolveInner(t,r=0){let n=P2(dke.get(this)||this.topNode,t,r,!0);return dke.set(this,n),n}iterate(t){let{enter:r,leave:n,from:i=0,to:a=this.length}=t;for(let o=this.cursor((t.mode||0)|Ss.IncludeAnonymous);;){let s=!1;if(o.from<=a&&o.to>=i&&(o.type.isAnonymous||r(o)!==!1)){if(o.firstChild())continue;s=!0}for(;s&&n&&!o.type.isAnonymous&&n(o),!o.nextSibling();){if(!o.parent())return;s=!0}}}prop(t){return t.perNode?this.props?this.props[t.id]:void 0:this.type.prop(t)}get propValues(){let t=[];if(this.props)for(let r in this.props)t.push([+r,this.props[r]]);return t}balance(t={}){return this.children.length<=8?this:tZ(Yu.none,this.children,this.positions,0,this.children.length,0,this.length,(r,n,i)=>new Es(this.type,r,n,i,this.propValues),t.makeTree||((r,n,i)=>new Es(Yu.none,r,n,i)))}static build(t){return QJe(t)}};Es.empty=new Es(Yu.none,[],[],0);var yD=class{constructor(t,r){this.buffer=t,this.index=r}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}get pos(){return this.index}next(){this.index-=4}fork(){return new yD(this.buffer,this.index)}},pg=class{constructor(t,r,n){this.buffer=t,this.length=r,this.set=n}get type(){return Yu.none}toString(){let t=[];for(let r=0;r0));l=o[l+3]);return s}slice(t,r,n,i){let a=this.buffer,o=new Uint16Array(r-t);for(let s=t,l=0;s=t&&rt;case 1:return r<=t&&n>t;case 2:return n>t;case 4:return!0}}function hke(e,t){let r=e.childBefore(t);for(;r;){let n=r.lastChild;if(!n||n.to!=r.to)break;n.type.isError&&n.from==n.to?(e=r,r=n.prevSibling):r=n}return e}function P2(e,t,r,n){for(var i;e.from==e.to||(r<1?e.from>=t:e.from>t)||(r>-1?e.to<=t:e.to0?s.length:-1;t!=u;t+=r){let c=s[t],f=l[t]+o.from;if(!!mke(i,n,f,f+c.length)){if(c instanceof pg){if(a&Ss.ExcludeBuffers)continue;let d=c.findChild(0,c.buffer.length,r,n-f,i);if(d>-1)return new Qd(new KY(o,c,t,f),null,d)}else if(a&Ss.IncludeAnonymous||!c.type.isAnonymous||eZ(c)){let d;if(!(a&Ss.IgnoreMounts)&&c.props&&(d=c.prop(Di.mounted))&&!d.overlay)return new Pf(d.tree,f,t,o);let p=new Pf(c,f,t,o);return a&Ss.IncludeAnonymous||!p.type.isAnonymous?p:p.nextChild(r<0?c.children.length-1:0,r,n,i)}}}if(a&Ss.IncludeAnonymous||!o.type.isAnonymous||(o.index>=0?t=o.index+r:t=r<0?-1:o._parent._tree.children.length,o=o._parent,!o))return null}}get firstChild(){return this.nextChild(0,1,0,4)}get lastChild(){return this.nextChild(this._tree.children.length-1,-1,0,4)}childAfter(t){return this.nextChild(0,1,t,2)}childBefore(t){return this.nextChild(this._tree.children.length-1,-1,t,-2)}enter(t,r,n=0){let i;if(!(n&Ss.IgnoreOverlays)&&(i=this._tree.prop(Di.mounted))&&i.overlay){let a=t-this.from;for(let{from:o,to:s}of i.overlay)if((r>0?o<=a:o=a:s>a))return new Pf(i.tree,i.overlay[0].from+this.from,-1,this)}return this.nextChild(0,1,t,r,n)}nextSignificantParent(){let t=this;for(;t.type.isAnonymous&&t._parent;)t=t._parent;return t}get parent(){return this._parent?this._parent.nextSignificantParent():null}get nextSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index+1,1,0,4):null}get prevSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index-1,-1,0,4):null}cursor(t=0){return new I2(this,t)}get tree(){return this._tree}toTree(){return this._tree}resolve(t,r=0){return P2(this,t,r,!1)}resolveInner(t,r=0){return P2(this,t,r,!0)}enterUnfinishedNodesBefore(t){return hke(this,t)}getChild(t,r=null,n=null){let i=J9(this,t,r,n);return i.length?i[0]:null}getChildren(t,r=null,n=null){return J9(this,t,r,n)}toString(){return this._tree.toString()}get node(){return this}matchContext(t){return e8(this,t)}};function J9(e,t,r,n){let i=e.cursor(),a=[];if(!i.firstChild())return a;if(r!=null){for(;!i.type.is(r);)if(!i.nextSibling())return a}for(;;){if(n!=null&&i.type.is(n))return a;if(i.type.is(t)&&a.push(i.node),!i.nextSibling())return n==null?a:[]}}function e8(e,t,r=t.length-1){for(let n=e.parent;r>=0;n=n.parent){if(!n)return!1;if(!n.type.isAnonymous){if(t[r]&&t[r]!=n.name)return!1;r--}}return!0}var KY=class{constructor(t,r,n,i){this.parent=t,this.buffer=r,this.index=n,this.start=i}},Qd=class{constructor(t,r,n){this.context=t,this._parent=r,this.index=n,this.type=t.buffer.set.types[t.buffer.buffer[n]]}get name(){return this.type.name}get from(){return this.context.start+this.context.buffer.buffer[this.index+1]}get to(){return this.context.start+this.context.buffer.buffer[this.index+2]}child(t,r,n){let{buffer:i}=this.context,a=i.findChild(this.index+4,i.buffer[this.index+3],t,r-this.context.start,n);return a<0?null:new Qd(this.context,this,a)}get firstChild(){return this.child(1,0,4)}get lastChild(){return this.child(-1,0,4)}childAfter(t){return this.child(1,t,2)}childBefore(t){return this.child(-1,t,-2)}enter(t,r,n=0){if(n&Ss.ExcludeBuffers)return null;let{buffer:i}=this.context,a=i.findChild(this.index+4,i.buffer[this.index+3],r>0?1:-1,t-this.context.start,r);return a<0?null:new Qd(this.context,this,a)}get parent(){return this._parent||this.context.parent.nextSignificantParent()}externalSibling(t){return this._parent?null:this.context.parent.nextChild(this.context.index+t,t,0,4)}get nextSibling(){let{buffer:t}=this.context,r=t.buffer[this.index+3];return r<(this._parent?t.buffer[this._parent.index+3]:t.buffer.length)?new Qd(this.context,this._parent,r):this.externalSibling(1)}get prevSibling(){let{buffer:t}=this.context,r=this._parent?this._parent.index+4:0;return this.index==r?this.externalSibling(-1):new Qd(this.context,this._parent,t.findChild(r,this.index,-1,0,4))}cursor(t=0){return new I2(this,t)}get tree(){return null}toTree(){let t=[],r=[],{buffer:n}=this.context,i=this.index+4,a=n.buffer[this.index+3];if(a>i){let o=n.buffer[this.index+1],s=n.buffer[this.index+2];t.push(n.slice(i,a,o,s)),r.push(0)}return new Es(this.type,t,r,this.to-this.from)}resolve(t,r=0){return P2(this,t,r,!1)}resolveInner(t,r=0){return P2(this,t,r,!0)}enterUnfinishedNodesBefore(t){return hke(this,t)}toString(){return this.context.buffer.childString(this.index)}getChild(t,r=null,n=null){let i=J9(this,t,r,n);return i.length?i[0]:null}getChildren(t,r=null,n=null){return J9(this,t,r,n)}get node(){return this}matchContext(t){return e8(this,t)}},I2=class{constructor(t,r=0){if(this.mode=r,this.buffer=null,this.stack=[],this.index=0,this.bufferNode=null,t instanceof Pf)this.yieldNode(t);else{this._tree=t.context.parent,this.buffer=t.context;for(let n=t._parent;n;n=n._parent)this.stack.unshift(n.index);this.bufferNode=t,this.yieldBuf(t.index)}}get name(){return this.type.name}yieldNode(t){return t?(this._tree=t,this.type=t.type,this.from=t.from,this.to=t.to,!0):!1}yieldBuf(t,r){this.index=t;let{start:n,buffer:i}=this.buffer;return this.type=r||i.set.types[i.buffer[t]],this.from=n+i.buffer[t+1],this.to=n+i.buffer[t+2],!0}yield(t){return t?t instanceof Pf?(this.buffer=null,this.yieldNode(t)):(this.buffer=t.context,this.yieldBuf(t.index,t.type)):!1}toString(){return this.buffer?this.buffer.buffer.childString(this.index):this._tree.toString()}enterChild(t,r,n){if(!this.buffer)return this.yield(this._tree.nextChild(t<0?this._tree._tree.children.length-1:0,t,r,n,this.mode));let{buffer:i}=this.buffer,a=i.findChild(this.index+4,i.buffer[this.index+3],t,r-this.buffer.start,n);return a<0?!1:(this.stack.push(this.index),this.yieldBuf(a))}firstChild(){return this.enterChild(1,0,4)}lastChild(){return this.enterChild(-1,0,4)}childAfter(t){return this.enterChild(1,t,2)}childBefore(t){return this.enterChild(-1,t,-2)}enter(t,r,n=this.mode){return this.buffer?n&Ss.ExcludeBuffers?!1:this.enterChild(1,t,r):this.yield(this._tree.enter(t,r,n))}parent(){if(!this.buffer)return this.yieldNode(this.mode&Ss.IncludeAnonymous?this._tree._parent:this._tree.parent);if(this.stack.length)return this.yieldBuf(this.stack.pop());let t=this.mode&Ss.IncludeAnonymous?this.buffer.parent:this.buffer.parent.nextSignificantParent();return this.buffer=null,this.yieldNode(t)}sibling(t){if(!this.buffer)return this._tree._parent?this.yield(this._tree.index<0?null:this._tree._parent.nextChild(this._tree.index+t,t,0,4,this.mode)):!1;let{buffer:r}=this.buffer,n=this.stack.length-1;if(t<0){let i=n<0?0:this.stack[n]+4;if(this.index!=i)return this.yieldBuf(r.findChild(i,this.index,-1,0,4))}else{let i=r.buffer[this.index+3];if(i<(n<0?r.buffer.length:r.buffer[this.stack[n]+3]))return this.yieldBuf(i)}return n<0?this.yield(this.buffer.parent.nextChild(this.buffer.index+t,t,0,4,this.mode)):!1}nextSibling(){return this.sibling(1)}prevSibling(){return this.sibling(-1)}atLastNode(t){let r,n,{buffer:i}=this;if(i){if(t>0){if(this.index-1)for(let a=r+t,o=t<0?-1:n._tree.children.length;a!=o;a+=t){let s=n._tree.children[a];if(this.mode&Ss.IncludeAnonymous||s instanceof pg||!s.type.isAnonymous||eZ(s))return!1}return!0}move(t,r){if(r&&this.enterChild(t,0,4))return!0;for(;;){if(this.sibling(t))return!0;if(this.atLastNode(t)||!this.parent())return!1}}next(t=!0){return this.move(1,t)}prev(t=!0){return this.move(-1,t)}moveTo(t,r=0){for(;(this.from==this.to||(r<1?this.from>=t:this.from>t)||(r>-1?this.to<=t:this.to=0;){for(let o=t;o;o=o._parent)if(o.index==i){if(i==this.index)return o;r=o,n=a+1;break e}i=this.stack[--a]}}for(let i=n;i=0;a--){if(a<0)return e8(this.node,t,i);let o=n[r.buffer[this.stack[a]]];if(!o.isAnonymous){if(t[i]&&t[i]!=o.name)return!1;i--}}return!0}};function eZ(e){return e.children.some(t=>t instanceof pg||!t.type.isAnonymous||eZ(t))}function QJe(e){var t;let{buffer:r,nodeSet:n,maxBufferLength:i=1024,reused:a=[],minRepeatType:o=n.types.length}=e,s=Array.isArray(r)?new yD(r,r.length):r,l=n.types,u=0,c=0;function f(x,w,S,k,j){let{id:O,start:C,end:N,size:D}=s,P=c;for(;D<0;)if(s.next(),D==-1){let L=a[O];S.push(L),k.push(C-x);return}else if(D==-3){u=O;return}else if(D==-4){c=O;return}else throw new RangeError(`Unrecognized record size: ${D}`);let q=l[O],z,I,T=C-x;if(N-C<=i&&(I=m(s.pos-w,j))){let L=new Uint16Array(I.size-I.skip),_=s.pos-I.size,Y=L.length;for(;s.pos>_;)Y=g(I.start,L,Y);z=new pg(L,N-I.start,n),T=I.start-x}else{let L=s.pos-D;s.next();let _=[],Y=[],oe=O>=o?O:-1,te=0,Q=N;for(;s.pos>L;)oe>=0&&s.id==oe&&s.size>=0?(s.end<=Q-i&&(p(_,Y,C,te,s.end,Q,oe,P),te=_.length,Q=s.end),s.next()):f(C,L,_,Y,oe);if(oe>=0&&te>0&&te<_.length&&p(_,Y,C,te,C,Q,oe,P),_.reverse(),Y.reverse(),oe>-1&&te>0){let fe=d(q);z=tZ(q,_,Y,0,_.length,0,N-C,fe,fe)}else z=h(q,_,Y,N-C,P-N)}S.push(z),k.push(T)}function d(x){return(w,S,k)=>{let j=0,O=w.length-1,C,N;if(O>=0&&(C=w[O])instanceof Es){if(!O&&C.type==x&&C.length==k)return C;(N=C.prop(Di.lookAhead))&&(j=S[O]+C.length+N)}return h(x,w,S,k,j)}}function p(x,w,S,k,j,O,C,N){let D=[],P=[];for(;x.length>k;)D.push(x.pop()),P.push(w.pop()+S-j);x.push(h(n.types[C],D,P,O-j,N-O)),w.push(j-S)}function h(x,w,S,k,j=0,O){if(u){let C=[Di.contextHash,u];O=O?[C].concat(O):[C]}if(j>25){let C=[Di.lookAhead,j];O=O?[C].concat(O):[C]}return new Es(x,w,S,k,O)}function m(x,w){let S=s.fork(),k=0,j=0,O=0,C=S.end-i,N={size:0,start:0,skip:0};e:for(let D=S.pos-x;S.pos>D;){let P=S.size;if(S.id==w&&P>=0){N.size=k,N.start=j,N.skip=O,O+=4,k+=4,S.next();continue}let q=S.pos-P;if(P<0||q=o?4:0,I=S.start;for(S.next();S.pos>q;){if(S.size<0)if(S.size==-3)z+=4;else break e;else S.id>=o&&(z+=4);S.next()}j=I,k+=P,O+=z}return(w<0||k==x)&&(N.size=k,N.start=j,N.skip=O),N.size>4?N:void 0}function g(x,w,S){let{id:k,start:j,end:O,size:C}=s;if(s.next(),C>=0&&k4){let D=s.pos-(C-4);for(;s.pos>D;)S=g(x,w,S)}w[--S]=N,w[--S]=O-x,w[--S]=j-x,w[--S]=k}else C==-3?u=k:C==-4&&(c=k);return S}let A=[],b=[];for(;s.pos>0;)f(e.start||0,e.bufferStart||0,A,b,-1);let v=(t=e.length)!==null&&t!==void 0?t:A.length?b[0]+A[0].length:0;return new Es(l[e.topID],A.reverse(),b.reverse(),v)}var pke=new WeakMap;function K9(e,t){if(!e.isAnonymous||t instanceof pg||t.type!=e)return 1;let r=pke.get(t);if(r==null){r=1;for(let n of t.children){if(n.type!=e||!(n instanceof Es)){r=1;break}r+=K9(e,n)}pke.set(t,r)}return r}function tZ(e,t,r,n,i,a,o,s,l){let u=0;for(let h=n;h=c)break;S+=k}if(v==x+1){if(S>c){let k=h[x];p(k.children,k.positions,0,k.children.length,m[x]+b);continue}f.push(h[x])}else{let k=m[v-1]+h[v-1].length-w;f.push(tZ(e,h,m,x,v,w,k,null,l))}d.push(w+b-a)}}return p(t,r,n,i,0),(s||l)(f,d,o)}var t8=class{constructor(){this.map=new WeakMap}setBuffer(t,r,n){let i=this.map.get(t);i||this.map.set(t,i=new Map),i.set(r,n)}getBuffer(t,r){let n=this.map.get(t);return n&&n.get(r)}set(t,r){t instanceof Qd?this.setBuffer(t.context.buffer,t.index,r):t instanceof Pf&&this.map.set(t.tree,r)}get(t){return t instanceof Qd?this.getBuffer(t.context.buffer,t.index):t instanceof Pf?this.map.get(t.tree):void 0}cursorSet(t,r){t.buffer?this.setBuffer(t.buffer.buffer,t.index,r):this.map.set(t.tree,r)}cursorGet(t){return t.buffer?this.getBuffer(t.buffer.buffer,t.index):this.map.get(t.tree)}},Ch=class{constructor(t,r,n,i,a=!1,o=!1){this.from=t,this.to=r,this.tree=n,this.offset=i,this.open=(a?1:0)|(o?2:0)}get openStart(){return(this.open&1)>0}get openEnd(){return(this.open&2)>0}static addTree(t,r=[],n=!1){let i=[new Ch(0,t.length,t,0,!1,n)];for(let a of r)a.to>t.length&&i.push(a);return i}static applyChanges(t,r,n=128){if(!r.length)return t;let i=[],a=1,o=t.length?t[0]:null;for(let s=0,l=0,u=0;;s++){let c=s=n)for(;o&&o.from=d.from||f<=d.to||u){let p=Math.max(d.from,l)-u,h=Math.min(d.to,f)-u;d=p>=h?null:new Ch(p,h,d.tree,d.offset+u,s>0,!!c)}if(d&&i.push(d),o.to>f)break;o=anew vD(i.from,i.to)):[new vD(0,0)]:[new vD(0,t.length)],this.createParse(t,r||[],n)}parse(t,r,n){let i=this.startParse(t,r,n);for(;;){let a=i.advance();if(a)return a}}},JY=class{constructor(t){this.string=t}get length(){return this.string.length}chunk(t){return this.string.slice(t)}get lineChunks(){return!1}read(t,r){return this.string.slice(t,r)}};var Mmr=new Di({perNode:!0});var Au=require("@codemirror/state"),mg=require("@codemirror/view");var YJe=0,Yd=class{constructor(t,r,n){this.set=t,this.base=r,this.modified=n,this.id=YJe++}static define(t){if(t?.base)throw new Error("Can not derive from a modified tag");let r=new Yd([],null,[]);if(r.set.push(r),t)for(let n of t.set)r.set.push(n);return r}static defineModifier(){let t=new B2;return r=>r.modified.indexOf(t)>-1?r:B2.get(r.base||r,r.modified.concat(t).sort((n,i)=>n.id-i.id))}},ZJe=0,B2=class{constructor(){this.instances=[],this.id=ZJe++}static get(t,r){if(!r.length)return t;let n=r[0].instances.find(s=>s.base==t&&XJe(r,s.modified));if(n)return n;let i=[],a=new Yd(i,t,r);for(let s of r)s.instances.push(a);let o=vke(r);for(let s of t.set)for(let l of o)i.push(B2.get(s,l));return a}};function XJe(e,t){return e.length==t.length&&e.every((r,n)=>r==t[n])}function vke(e){let t=[e];for(let r=0;r0&&f+3==i.length){o=1;break}let d=/^"(?:[^"\\]|\\.)*?"|[^\/!]+/.exec(s);if(!d)throw new RangeError("Invalid path: "+i);if(a.push(d[0]=="*"?"":d[0][0]=='"'?JSON.parse(d[0]):d[0]),f+=d[0].length,f==i.length)break;let p=i[f++];if(f==i.length&&p=="!"){o=0;break}if(p!="/")throw new RangeError("Invalid path: "+i);s=i.slice(f)}let l=a.length-1,u=a[l];if(!u)throw new RangeError("Invalid path: "+i);let c=new nZ(n,o,l>0?a.slice(0,l):null);t[u]=c.sort(t[u])}}return KJe.add(t)}var KJe=new Di,nZ=class{constructor(t,r,n,i){this.tags=t,this.mode=r,this.context=n,this.next=i}sort(t){return!t||t.depth{let o=i;for(let s of a)for(let l of s.set){let u=r[l.id];if(u){o=o?o+" "+u:u;break}}return o},scope:n}}var Ft=Yd.define,n8=Ft(),Iv=Ft(),Ake=Ft(Iv),gke=Ft(Iv),Bv=Ft(),i8=Ft(Bv),rZ=Ft(Bv),Mh=Ft(),lb=Ft(Mh),Dh=Ft(),Oh=Ft(),iZ=Ft(),bD=Ft(iZ),a8=Ft(),$t={comment:n8,lineComment:Ft(n8),blockComment:Ft(n8),docComment:Ft(n8),name:Iv,variableName:Ft(Iv),typeName:Ake,tagName:Ft(Ake),propertyName:gke,attributeName:Ft(gke),className:Ft(Iv),labelName:Ft(Iv),namespace:Ft(Iv),macroName:Ft(Iv),literal:Bv,string:i8,docString:Ft(i8),character:Ft(i8),attributeValue:Ft(i8),number:rZ,integer:Ft(rZ),float:Ft(rZ),bool:Ft(Bv),regexp:Ft(Bv),escape:Ft(Bv),color:Ft(Bv),url:Ft(Bv),keyword:Dh,self:Ft(Dh),null:Ft(Dh),atom:Ft(Dh),unit:Ft(Dh),modifier:Ft(Dh),operatorKeyword:Ft(Dh),controlKeyword:Ft(Dh),definitionKeyword:Ft(Dh),moduleKeyword:Ft(Dh),operator:Oh,derefOperator:Ft(Oh),arithmeticOperator:Ft(Oh),logicOperator:Ft(Oh),bitwiseOperator:Ft(Oh),compareOperator:Ft(Oh),updateOperator:Ft(Oh),definitionOperator:Ft(Oh),typeOperator:Ft(Oh),controlOperator:Ft(Oh),punctuation:iZ,separator:Ft(iZ),bracket:bD,angleBracket:Ft(bD),squareBracket:Ft(bD),paren:Ft(bD),brace:Ft(bD),content:Mh,heading:lb,heading1:Ft(lb),heading2:Ft(lb),heading3:Ft(lb),heading4:Ft(lb),heading5:Ft(lb),heading6:Ft(lb),contentSeparator:Ft(Mh),list:Ft(Mh),quote:Ft(Mh),emphasis:Ft(Mh),strong:Ft(Mh),link:Ft(Mh),monospace:Ft(Mh),strikethrough:Ft(Mh),inserted:Ft(),deleted:Ft(),changed:Ft(),invalid:Ft(),meta:a8,documentMeta:Ft(a8),annotation:Ft(a8),processingInstruction:Ft(a8),definition:Yd.defineModifier(),constant:Yd.defineModifier(),function:Yd.defineModifier(),standard:Yd.defineModifier(),local:Yd.defineModifier(),special:Yd.defineModifier()},Tmr=aZ([{tag:$t.link,class:"tok-link"},{tag:$t.heading,class:"tok-heading"},{tag:$t.emphasis,class:"tok-emphasis"},{tag:$t.strong,class:"tok-strong"},{tag:$t.keyword,class:"tok-keyword"},{tag:$t.atom,class:"tok-atom"},{tag:$t.bool,class:"tok-bool"},{tag:$t.url,class:"tok-url"},{tag:$t.labelName,class:"tok-labelName"},{tag:$t.inserted,class:"tok-inserted"},{tag:$t.deleted,class:"tok-deleted"},{tag:$t.literal,class:"tok-literal"},{tag:$t.string,class:"tok-string"},{tag:$t.number,class:"tok-number"},{tag:[$t.regexp,$t.escape,$t.special($t.string)],class:"tok-string2"},{tag:$t.variableName,class:"tok-variableName"},{tag:$t.local($t.variableName),class:"tok-variableName tok-local"},{tag:$t.definition($t.variableName),class:"tok-variableName tok-definition"},{tag:$t.special($t.variableName),class:"tok-variableName2"},{tag:$t.definition($t.propertyName),class:"tok-propertyName tok-definition"},{tag:$t.typeName,class:"tok-typeName"},{tag:$t.namespace,class:"tok-namespace"},{tag:$t.className,class:"tok-className"},{tag:$t.macroName,class:"tok-macroName"},{tag:$t.propertyName,class:"tok-propertyName"},{tag:$t.operator,class:"tok-operator"},{tag:$t.comment,class:"tok-comment"},{tag:$t.meta,class:"tok-meta"},{tag:$t.invalid,class:"tok-invalid"},{tag:$t.punctuation,class:"tok-punctuation"}]);var oZ,wD=new Di;function JJe(e){return Au.Facet.define({combine:e?t=>t.concat(e):void 0})}var If=class{constructor(t,r,n=[]){this.data=t,Au.EditorState.prototype.hasOwnProperty("tree")||Object.defineProperty(Au.EditorState.prototype,"tree",{get(){return R2(this)}}),this.parser=r,this.extension=[q2.of(this),Au.EditorState.languageData.of((i,a,o)=>i.facet(bke(i,a,o)))].concat(n)}isActiveAt(t,r,n=-1){return bke(t,r,n)==this.data}findRegions(t){let r=t.facet(q2);if(r?.data==this.data)return[{from:0,to:t.doc.length}];if(!r||!r.allowsNesting)return[];let n=[],i=(a,o)=>{if(a.prop(wD)==this.data){n.push({from:o,to:o+a.length});return}let s=a.prop(Di.mounted);if(s){if(s.tree.prop(wD)==this.data){if(s.overlay)for(let l of s.overlay)n.push({from:l.from+o,to:l.to+o});else n.push({from:o,to:o+a.length});return}else if(s.overlay){let l=n.length;if(i(s.tree,s.overlay[0].from+o),n.length>l)return}}for(let l=0;ln.isTop?r:void 0)]}))}configure(t){return new ub(this.data,this.parser.configure(t))}get allowsNesting(){return this.parser.hasWrappers()}};function R2(e){let t=e.field(If.state,!1);return t?t.tree:Es.empty}var uZ=class{constructor(t,r=t.length){this.doc=t,this.length=r,this.cursorPos=0,this.string="",this.cursor=t.iter()}syncTo(t){return this.string=this.cursor.next(t-this.cursorPos).value,this.cursorPos=t+this.string.length,this.cursorPos-this.string.length}chunk(t){return this.syncTo(t),this.string}get lineChunks(){return!0}read(t,r){let n=this.cursorPos-this.string.length;return t=this.cursorPos?this.doc.sliceString(t,r):this.string.slice(t-n,r-n)}},xD=null,$2=class{constructor(t,r,n=[],i,a,o,s,l){this.parser=t,this.state=r,this.fragments=n,this.tree=i,this.treeLen=a,this.viewport=o,this.skipped=s,this.scheduleOn=l,this.parse=null,this.tempSkipped=[]}static create(t,r,n){return new $2(t,r,[],Es.empty,0,n,[],null)}startParse(){return this.parser.startParse(new uZ(this.state.doc),this.fragments)}work(t,r){return r!=null&&r>=this.state.doc.length&&(r=void 0),this.tree!=Es.empty&&this.isDone(r??this.state.doc.length)?(this.takeTree(),!0):this.withContext(()=>{var n;if(typeof t=="number"){let i=Date.now()+t;t=()=>Date.now()>i}for(this.parse||(this.parse=this.startParse()),r!=null&&(this.parse.stoppedAt==null||this.parse.stoppedAt>r)&&r=this.treeLen&&((this.parse.stoppedAt==null||this.parse.stoppedAt>t)&&this.parse.stopAt(t),this.withContext(()=>{for(;!(r=this.parse.advance()););}),this.treeLen=t,this.tree=r,this.fragments=this.withoutTempSkipped(Ch.addTree(this.tree,this.fragments,!0)),this.parse=null)}withContext(t){let r=xD;xD=this;try{return t()}finally{xD=r}}withoutTempSkipped(t){for(let r;r=this.tempSkipped.pop();)t=xke(t,r.from,r.to);return t}changes(t,r){let{fragments:n,tree:i,treeLen:a,viewport:o,skipped:s}=this;if(this.takeTree(),!t.empty){let l=[];if(t.iterChangedRanges((u,c,f,d)=>l.push({fromA:u,toA:c,fromB:f,toB:d})),n=Ch.applyChanges(n,l),i=Es.empty,a=0,o={from:t.mapPos(o.from,-1),to:t.mapPos(o.to,1)},this.skipped.length){s=[];for(let u of this.skipped){let c=t.mapPos(u.from,1),f=t.mapPos(u.to,-1);ct.from&&(this.fragments=xke(this.fragments,i,a),this.skipped.splice(n--,1))}return this.skipped.length>=r?!1:(this.reset(),!0)}reset(){this.parse&&(this.takeTree(),this.parse=null)}skipUntilInView(t,r){this.skipped.push({from:t,to:r})}static getSkippingParser(t){return new class extends r8{createParse(r,n,i){let a=i[0].from,o=i[i.length-1].to;return{parsedPos:a,advance(){let l=xD;if(l){for(let u of i)l.tempSkipped.push(u);t&&(l.scheduleOn=l.scheduleOn?Promise.all([l.scheduleOn,t]):t)}return this.parsedPos=o,new Es(Yu.none,[],[],o-a)},stoppedAt:null,stopAt(){}}}}}isDone(t){t=Math.min(t,this.state.doc.length);let r=this.fragments;return this.treeLen>=t&&r.length&&r[0].from==0&&r[0].to>=t}static get(){return xD}};function xke(e,t,r){return Ch.applyChanges(e,[{fromA:t,toA:r,fromB:t,toB:r}])}var Rv=class{constructor(t){this.context=t,this.tree=t.tree}apply(t){if(!t.docChanged&&this.tree==this.context.tree)return this;let r=this.context.changes(t.changes,t.state),n=this.context.treeLen==t.startState.doc.length?void 0:Math.max(t.changes.mapPos(this.context.treeLen),r.viewport.to);return r.work(20,n)||r.takeTree(),new Rv(r)}static init(t){let r=Math.min(3e3,t.doc.length),n=$2.create(t.facet(q2).parser,t,{from:0,to:r});return n.work(20,r)||n.takeTree(),new Rv(n)}};If.state=Au.StateField.define({create:Rv.init,update(e,t){for(let r of t.effects)if(r.is(If.setState))return r.value;return t.startState.facet(q2)!=t.state.facet(q2)?Rv.init(t.state):e.apply(t)}});var Eke=e=>{let t=setTimeout(()=>e(),500);return()=>clearTimeout(t)};typeof requestIdleCallback<"u"&&(Eke=e=>{let t=-1,r=setTimeout(()=>{t=requestIdleCallback(e,{timeout:500-100})},100);return()=>t<0?clearTimeout(r):cancelIdleCallback(t)});var sZ=typeof navigator<"u"&&((oZ=navigator.scheduling)===null||oZ===void 0?void 0:oZ.isInputPending)?()=>navigator.scheduling.isInputPending():null,eet=mg.ViewPlugin.fromClass(class{constructor(t){this.view=t,this.working=null,this.workScheduled=0,this.chunkEnd=-1,this.chunkBudget=-1,this.work=this.work.bind(this),this.scheduleWork()}update(t){let r=this.view.state.field(If.state).context;(r.updateViewport(t.view.viewport)||this.view.viewport.to>r.treeLen)&&this.scheduleWork(),t.docChanged&&(this.view.hasFocus&&(this.chunkBudget+=50),this.scheduleWork()),this.checkAsyncSchedule(r)}scheduleWork(){if(this.working)return;let{state:t}=this.view,r=t.field(If.state);(r.tree!=r.context.tree||!r.context.isDone(t.doc.length))&&(this.working=Eke(this.work))}work(t){this.working=null;let r=Date.now();if(this.chunkEndi+1e3,l=a.context.work(()=>sZ&&sZ()||Date.now()>o,i+(s?0:1e5));this.chunkBudget-=Date.now()-r,(l||this.chunkBudget<=0)&&(a.context.takeTree(),this.view.dispatch({effects:If.setState.of(new Rv(a.context))})),this.chunkBudget>0&&!(l&&!s)&&this.scheduleWork(),this.checkAsyncSchedule(a.context)}checkAsyncSchedule(t){t.scheduleOn&&(this.workScheduled++,t.scheduleOn.then(()=>this.scheduleWork()).catch(r=>(0,mg.logException)(this.view.state,r)).then(()=>this.workScheduled--),t.scheduleOn=null)}destroy(){this.working&&this.working()}isWorking(){return!!(this.working||this.workScheduled>0)}},{eventHandlers:{focus(){this.scheduleWork()}}}),q2=Au.Facet.define({combine(e){return e.length?e[0]:null},enables:[If.state,eet]}),o8=class{constructor(t,r=[]){this.language=t,this.support=r,this.extension=[t,r]}};var kke=new Di;function tet(e){let t=e.node,r=t.childAfter(t.from),n=t.lastChild;if(!r)return null;let i=e.options.simulateBreak,a=e.state.doc.lineAt(r.from),o=i==null||i<=a.from?a.to:Math.min(a.to,i);for(let s=r.to;;){let l=t.childAfter(s);if(!l||l==n)return null;if(!l.type.isSkipped)return l.fromret(n,t,r,e)}function ret(e,t,r,n,i){let a=e.textAfter,o=a.match(/^\s*/)[0].length,s=n&&a.slice(o,o+n.length)==n||i==e.pos+o,l=t?tet(e):null;return l?s?e.column(l.from):e.column(l.to):e.baseIndent+(s?0:e.unit*r)}var Dke=e=>e.baseIndent;function s8({except:e,units:t=1}={}){return r=>{let n=e&&e.test(r.textAfter);return r.baseIndent+(n?0:t*r.unit)}}var Oke=new Di;function Mke(e){let t=e.firstChild,r=e.lastChild;return t&&t.tos.prop(wD)==o.data:o?s=>s==o:void 0,this.style=aZ(t.map(s=>({tag:s.tag,class:s.class||i(Object.assign({},s,{tag:null}))})),{all:a}).style,this.module=n?new Gp(n):null,this.themeType=r.themeType}static define(t,r){return new SD(t,r||{})}};var qmr=SD.define([{tag:$t.meta,color:"#7a757a"},{tag:$t.link,textDecoration:"underline"},{tag:$t.heading,textDecoration:"underline",fontWeight:"bold"},{tag:$t.emphasis,fontStyle:"italic"},{tag:$t.strong,fontWeight:"bold"},{tag:$t.strikethrough,textDecoration:"line-through"},{tag:$t.keyword,color:"#708"},{tag:[$t.atom,$t.bool,$t.url,$t.contentSeparator,$t.labelName],color:"#219"},{tag:[$t.literal,$t.inserted],color:"#164"},{tag:[$t.string,$t.deleted],color:"#a11"},{tag:[$t.regexp,$t.escape,$t.special($t.string)],color:"#e40"},{tag:$t.definition($t.variableName),color:"#00f"},{tag:$t.local($t.variableName),color:"#30a"},{tag:[$t.typeName,$t.namespace],color:"#085"},{tag:$t.className,color:"#167"},{tag:[$t.special($t.variableName),$t.macroName],color:"#256"},{tag:$t.definition($t.propertyName),color:"#00c"},{tag:$t.comment,color:"#940"},{tag:$t.invalid,color:"#f00"}]);var net=Object.create(null),wke=[Yu.none];var Ske=[],iet=Object.create(null);for(let[e,t]of[["variable","variableName"],["variable-2","variableName.special"],["string-2","string.special"],["def","variableName.definition"],["tag","typeName"],["attribute","propertyName"],["type","typeName"],["builtin","variableName.standard"],["qualifier","modifier"],["error","invalid"],["header","heading"],["property","propertyName"]])iet[e]=aet(net,t);function lZ(e,t){Ske.indexOf(e)>-1||(Ske.push(e),console.warn(t))}function aet(e,t){let r=null;for(let a of t.split(".")){let o=e[a]||$t[a];o?typeof o=="function"?r?r=o(r):lZ(a,`Modifier ${a} used at start of tag`):r?lZ(a,`Tag ${a} used as modifier`):r=o:lZ(a,`Unknown highlighting tag ${a}`)}if(!r)return 0;let n=t.replace(/ /g,"_"),i=Yu.define({id:wke.length,name:n,props:[yke({[n]:r})]});return wke.push(i),i.id}var g8=require("@codemirror/state"),Jke=require("@codemirror/view");var Ji=require("@codemirror/state"),tl=require("@codemirror/view");var oet=0,ED=class{constructor(t,r){this.from=t,this.to=r}},Vi=class{constructor(t={}){this.id=oet++,this.perNode=!!t.perNode,this.deserialize=t.deserialize||(()=>{throw new Error("This node type doesn't define a deserialize function")})}add(t){if(this.perNode)throw new RangeError("Can't add per-node props to node types");return typeof t!="function"&&(t=Zu.match(t)),r=>{let n=t(r);return n===void 0?null:[this,n]}}};Vi.closedBy=new Vi({deserialize:e=>e.split(" ")});Vi.openedBy=new Vi({deserialize:e=>e.split(" ")});Vi.group=new Vi({deserialize:e=>e.split(" ")});Vi.contextHash=new Vi({perNode:!0});Vi.lookAhead=new Vi({perNode:!0});Vi.mounted=new Vi({perNode:!0});var set=Object.create(null),Zu=class{constructor(t,r,n,i=0){this.name=t,this.props=r,this.id=n,this.flags=i}static define(t){let r=t.props&&t.props.length?Object.create(null):set,n=(t.top?1:0)|(t.skipped?2:0)|(t.error?4:0)|(t.name==null?8:0),i=new Zu(t.name||"",r,t.id,n);if(t.props){for(let a of t.props)if(Array.isArray(a)||(a=a(i)),a){if(a[0].perNode)throw new RangeError("Can't store a per-node prop on a node type");r[a[0].id]=a[1]}}return i}prop(t){return this.props[t.id]}get isTop(){return(this.flags&1)>0}get isSkipped(){return(this.flags&2)>0}get isError(){return(this.flags&4)>0}get isAnonymous(){return(this.flags&8)>0}is(t){if(typeof t=="string"){if(this.name==t)return!0;let r=this.prop(Vi.group);return r?r.indexOf(t)>-1:!1}return this.id==t}static match(t){let r=Object.create(null);for(let n in t)for(let i of n.split(" "))r[i]=t[n];return n=>{for(let i=n.prop(Vi.group),a=-1;a<(i?i.length:0);a++){let o=r[a<0?n.name:i[a]];if(o)return o}}}};Zu.none=new Zu("",Object.create(null),0,8);var l8=new WeakMap,jke=new WeakMap,Il;(function(e){e[e.ExcludeBuffers=1]="ExcludeBuffers",e[e.IncludeAnonymous=2]="IncludeAnonymous",e[e.IgnoreMounts=4]="IgnoreMounts",e[e.IgnoreOverlays=8]="IgnoreOverlays"})(Il||(Il={}));var ks=class{constructor(t,r,n,i,a){if(this.type=t,this.children=r,this.positions=n,this.length=i,this.props=null,a&&a.length){this.props=Object.create(null);for(let[o,s]of a)this.props[typeof o=="number"?o:o.id]=s}}toString(){let t=this.prop(Vi.mounted);if(t&&!t.overlay)return t.tree.toString();let r="";for(let n of this.children){let i=n.toString();i&&(r&&(r+=","),r+=i)}return this.type.name?(/\W/.test(this.type.name)&&!this.type.isError?JSON.stringify(this.type.name):this.type.name)+(r.length?"("+r+")":""):r}cursor(t=0){return new z2(this.topNode,t)}cursorAt(t,r=0,n=0){let i=l8.get(this)||this.topNode,a=new z2(i);return a.moveTo(t,r),l8.set(this,a._tree),a}get topNode(){return new om(this,0,0,null)}resolve(t,r=0){let n=L2(l8.get(this)||this.topNode,t,r,!1);return l8.set(this,n),n}resolveInner(t,r=0){let n=L2(jke.get(this)||this.topNode,t,r,!0);return jke.set(this,n),n}iterate(t){let{enter:r,leave:n,from:i=0,to:a=this.length}=t;for(let o=this.cursor((t.mode||0)|Il.IncludeAnonymous);;){let s=!1;if(o.from<=a&&o.to>=i&&(o.type.isAnonymous||r(o)!==!1)){if(o.firstChild())continue;s=!0}for(;s&&n&&!o.type.isAnonymous&&n(o),!o.nextSibling();){if(!o.parent())return;s=!0}}}prop(t){return t.perNode?this.props?this.props[t.id]:void 0:this.type.prop(t)}get propValues(){let t=[];if(this.props)for(let r in this.props)t.push([+r,this.props[r]]);return t}balance(t={}){return this.children.length<=8?this:pZ(Zu.none,this.children,this.positions,0,this.children.length,0,this.length,(r,n,i)=>new ks(this.type,r,n,i,this.propValues),t.makeTree||((r,n,i)=>new ks(Zu.none,r,n,i)))}static build(t){return uet(t)}};ks.empty=new ks(Zu.none,[],[],0);var kD=class{constructor(t,r){this.buffer=t,this.index=r}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}get pos(){return this.index}next(){this.index-=4}fork(){return new kD(this.buffer,this.index)}},hg=class{constructor(t,r,n){this.buffer=t,this.length=r,this.set=n}get type(){return Zu.none}toString(){let t=[];for(let r=0;r0));l=o[l+3]);return s}slice(t,r,n,i){let a=this.buffer,o=new Uint16Array(r-t);for(let s=t,l=0;s=t&&rt;case 1:return r<=t&&n>t;case 2:return n>t;case 4:return!0}}function Fke(e,t){let r=e.childBefore(t);for(;r;){let n=r.lastChild;if(!n||n.to!=r.to)break;n.type.isError&&n.from==n.to?(e=r,r=n.prevSibling):r=n}return e}function L2(e,t,r,n){for(var i;e.from==e.to||(r<1?e.from>=t:e.from>t)||(r>-1?e.to<=t:e.to0?s.length:-1;t!=u;t+=r){let c=s[t],f=l[t]+o.from;if(!!Tke(i,n,f,f+c.length)){if(c instanceof hg){if(a&Il.ExcludeBuffers)continue;let d=c.findChild(0,c.buffer.length,r,n-f,i);if(d>-1)return new jh(new cZ(o,c,t,f),null,d)}else if(a&Il.IncludeAnonymous||!c.type.isAnonymous||dZ(c)){let d;if(!(a&Il.IgnoreMounts)&&c.props&&(d=c.prop(Vi.mounted))&&!d.overlay)return new om(d.tree,f,t,o);let p=new om(c,f,t,o);return a&Il.IncludeAnonymous||!p.type.isAnonymous?p:p.nextChild(r<0?c.children.length-1:0,r,n,i)}}}if(a&Il.IncludeAnonymous||!o.type.isAnonymous||(o.index>=0?t=o.index+r:t=r<0?-1:o._parent._tree.children.length,o=o._parent,!o))return null}}get firstChild(){return this.nextChild(0,1,0,4)}get lastChild(){return this.nextChild(this._tree.children.length-1,-1,0,4)}childAfter(t){return this.nextChild(0,1,t,2)}childBefore(t){return this.nextChild(this._tree.children.length-1,-1,t,-2)}enter(t,r,n=0){let i;if(!(n&Il.IgnoreOverlays)&&(i=this._tree.prop(Vi.mounted))&&i.overlay){let a=t-this.from;for(let{from:o,to:s}of i.overlay)if((r>0?o<=a:o=a:s>a))return new om(i.tree,i.overlay[0].from+this.from,-1,this)}return this.nextChild(0,1,t,r,n)}nextSignificantParent(){let t=this;for(;t.type.isAnonymous&&t._parent;)t=t._parent;return t}get parent(){return this._parent?this._parent.nextSignificantParent():null}get nextSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index+1,1,0,4):null}get prevSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index-1,-1,0,4):null}cursor(t=0){return new z2(this,t)}get tree(){return this._tree}toTree(){return this._tree}resolve(t,r=0){return L2(this,t,r,!1)}resolveInner(t,r=0){return L2(this,t,r,!0)}enterUnfinishedNodesBefore(t){return Fke(this,t)}getChild(t,r=null,n=null){let i=c8(this,t,r,n);return i.length?i[0]:null}getChildren(t,r=null,n=null){return c8(this,t,r,n)}toString(){return this._tree.toString()}get node(){return this}matchContext(t){return f8(this,t)}};function c8(e,t,r,n){let i=e.cursor(),a=[];if(!i.firstChild())return a;if(r!=null){for(;!i.type.is(r);)if(!i.nextSibling())return a}for(;;){if(n!=null&&i.type.is(n))return a;if(i.type.is(t)&&a.push(i.node),!i.nextSibling())return n==null?a:[]}}function f8(e,t,r=t.length-1){for(let n=e.parent;r>=0;n=n.parent){if(!n)return!1;if(!n.type.isAnonymous){if(t[r]&&t[r]!=n.name)return!1;r--}}return!0}var cZ=class{constructor(t,r,n,i){this.parent=t,this.buffer=r,this.index=n,this.start=i}},jh=class{constructor(t,r,n){this.context=t,this._parent=r,this.index=n,this.type=t.buffer.set.types[t.buffer.buffer[n]]}get name(){return this.type.name}get from(){return this.context.start+this.context.buffer.buffer[this.index+1]}get to(){return this.context.start+this.context.buffer.buffer[this.index+2]}child(t,r,n){let{buffer:i}=this.context,a=i.findChild(this.index+4,i.buffer[this.index+3],t,r-this.context.start,n);return a<0?null:new jh(this.context,this,a)}get firstChild(){return this.child(1,0,4)}get lastChild(){return this.child(-1,0,4)}childAfter(t){return this.child(1,t,2)}childBefore(t){return this.child(-1,t,-2)}enter(t,r,n=0){if(n&Il.ExcludeBuffers)return null;let{buffer:i}=this.context,a=i.findChild(this.index+4,i.buffer[this.index+3],r>0?1:-1,t-this.context.start,r);return a<0?null:new jh(this.context,this,a)}get parent(){return this._parent||this.context.parent.nextSignificantParent()}externalSibling(t){return this._parent?null:this.context.parent.nextChild(this.context.index+t,t,0,4)}get nextSibling(){let{buffer:t}=this.context,r=t.buffer[this.index+3];return r<(this._parent?t.buffer[this._parent.index+3]:t.buffer.length)?new jh(this.context,this._parent,r):this.externalSibling(1)}get prevSibling(){let{buffer:t}=this.context,r=this._parent?this._parent.index+4:0;return this.index==r?this.externalSibling(-1):new jh(this.context,this._parent,t.findChild(r,this.index,-1,0,4))}cursor(t=0){return new z2(this,t)}get tree(){return null}toTree(){let t=[],r=[],{buffer:n}=this.context,i=this.index+4,a=n.buffer[this.index+3];if(a>i){let o=n.buffer[this.index+1],s=n.buffer[this.index+2];t.push(n.slice(i,a,o,s)),r.push(0)}return new ks(this.type,t,r,this.to-this.from)}resolve(t,r=0){return L2(this,t,r,!1)}resolveInner(t,r=0){return L2(this,t,r,!0)}enterUnfinishedNodesBefore(t){return Fke(this,t)}toString(){return this.context.buffer.childString(this.index)}getChild(t,r=null,n=null){let i=c8(this,t,r,n);return i.length?i[0]:null}getChildren(t,r=null,n=null){return c8(this,t,r,n)}get node(){return this}matchContext(t){return f8(this,t)}},z2=class{constructor(t,r=0){if(this.mode=r,this.buffer=null,this.stack=[],this.index=0,this.bufferNode=null,t instanceof om)this.yieldNode(t);else{this._tree=t.context.parent,this.buffer=t.context;for(let n=t._parent;n;n=n._parent)this.stack.unshift(n.index);this.bufferNode=t,this.yieldBuf(t.index)}}get name(){return this.type.name}yieldNode(t){return t?(this._tree=t,this.type=t.type,this.from=t.from,this.to=t.to,!0):!1}yieldBuf(t,r){this.index=t;let{start:n,buffer:i}=this.buffer;return this.type=r||i.set.types[i.buffer[t]],this.from=n+i.buffer[t+1],this.to=n+i.buffer[t+2],!0}yield(t){return t?t instanceof om?(this.buffer=null,this.yieldNode(t)):(this.buffer=t.context,this.yieldBuf(t.index,t.type)):!1}toString(){return this.buffer?this.buffer.buffer.childString(this.index):this._tree.toString()}enterChild(t,r,n){if(!this.buffer)return this.yield(this._tree.nextChild(t<0?this._tree._tree.children.length-1:0,t,r,n,this.mode));let{buffer:i}=this.buffer,a=i.findChild(this.index+4,i.buffer[this.index+3],t,r-this.buffer.start,n);return a<0?!1:(this.stack.push(this.index),this.yieldBuf(a))}firstChild(){return this.enterChild(1,0,4)}lastChild(){return this.enterChild(-1,0,4)}childAfter(t){return this.enterChild(1,t,2)}childBefore(t){return this.enterChild(-1,t,-2)}enter(t,r,n=this.mode){return this.buffer?n&Il.ExcludeBuffers?!1:this.enterChild(1,t,r):this.yield(this._tree.enter(t,r,n))}parent(){if(!this.buffer)return this.yieldNode(this.mode&Il.IncludeAnonymous?this._tree._parent:this._tree.parent);if(this.stack.length)return this.yieldBuf(this.stack.pop());let t=this.mode&Il.IncludeAnonymous?this.buffer.parent:this.buffer.parent.nextSignificantParent();return this.buffer=null,this.yieldNode(t)}sibling(t){if(!this.buffer)return this._tree._parent?this.yield(this._tree.index<0?null:this._tree._parent.nextChild(this._tree.index+t,t,0,4,this.mode)):!1;let{buffer:r}=this.buffer,n=this.stack.length-1;if(t<0){let i=n<0?0:this.stack[n]+4;if(this.index!=i)return this.yieldBuf(r.findChild(i,this.index,-1,0,4))}else{let i=r.buffer[this.index+3];if(i<(n<0?r.buffer.length:r.buffer[this.stack[n]+3]))return this.yieldBuf(i)}return n<0?this.yield(this.buffer.parent.nextChild(this.buffer.index+t,t,0,4,this.mode)):!1}nextSibling(){return this.sibling(1)}prevSibling(){return this.sibling(-1)}atLastNode(t){let r,n,{buffer:i}=this;if(i){if(t>0){if(this.index-1)for(let a=r+t,o=t<0?-1:n._tree.children.length;a!=o;a+=t){let s=n._tree.children[a];if(this.mode&Il.IncludeAnonymous||s instanceof hg||!s.type.isAnonymous||dZ(s))return!1}return!0}move(t,r){if(r&&this.enterChild(t,0,4))return!0;for(;;){if(this.sibling(t))return!0;if(this.atLastNode(t)||!this.parent())return!1}}next(t=!0){return this.move(1,t)}prev(t=!0){return this.move(-1,t)}moveTo(t,r=0){for(;(this.from==this.to||(r<1?this.from>=t:this.from>t)||(r>-1?this.to<=t:this.to=0;){for(let o=t;o;o=o._parent)if(o.index==i){if(i==this.index)return o;r=o,n=a+1;break e}i=this.stack[--a]}}for(let i=n;i=0;a--){if(a<0)return f8(this.node,t,i);let o=n[r.buffer[this.stack[a]]];if(!o.isAnonymous){if(t[i]&&t[i]!=o.name)return!1;i--}}return!0}};function dZ(e){return e.children.some(t=>t instanceof hg||!t.type.isAnonymous||dZ(t))}function uet(e){var t;let{buffer:r,nodeSet:n,maxBufferLength:i=1024,reused:a=[],minRepeatType:o=n.types.length}=e,s=Array.isArray(r)?new kD(r,r.length):r,l=n.types,u=0,c=0;function f(x,w,S,k,j){let{id:O,start:C,end:N,size:D}=s,P=c;for(;D<0;)if(s.next(),D==-1){let L=a[O];S.push(L),k.push(C-x);return}else if(D==-3){u=O;return}else if(D==-4){c=O;return}else throw new RangeError(`Unrecognized record size: ${D}`);let q=l[O],z,I,T=C-x;if(N-C<=i&&(I=m(s.pos-w,j))){let L=new Uint16Array(I.size-I.skip),_=s.pos-I.size,Y=L.length;for(;s.pos>_;)Y=g(I.start,L,Y);z=new hg(L,N-I.start,n),T=I.start-x}else{let L=s.pos-D;s.next();let _=[],Y=[],oe=O>=o?O:-1,te=0,Q=N;for(;s.pos>L;)oe>=0&&s.id==oe&&s.size>=0?(s.end<=Q-i&&(p(_,Y,C,te,s.end,Q,oe,P),te=_.length,Q=s.end),s.next()):f(C,L,_,Y,oe);if(oe>=0&&te>0&&te<_.length&&p(_,Y,C,te,C,Q,oe,P),_.reverse(),Y.reverse(),oe>-1&&te>0){let fe=d(q);z=pZ(q,_,Y,0,_.length,0,N-C,fe,fe)}else z=h(q,_,Y,N-C,P-N)}S.push(z),k.push(T)}function d(x){return(w,S,k)=>{let j=0,O=w.length-1,C,N;if(O>=0&&(C=w[O])instanceof ks){if(!O&&C.type==x&&C.length==k)return C;(N=C.prop(Vi.lookAhead))&&(j=S[O]+C.length+N)}return h(x,w,S,k,j)}}function p(x,w,S,k,j,O,C,N){let D=[],P=[];for(;x.length>k;)D.push(x.pop()),P.push(w.pop()+S-j);x.push(h(n.types[C],D,P,O-j,N-O)),w.push(j-S)}function h(x,w,S,k,j=0,O){if(u){let C=[Vi.contextHash,u];O=O?[C].concat(O):[C]}if(j>25){let C=[Vi.lookAhead,j];O=O?[C].concat(O):[C]}return new ks(x,w,S,k,O)}function m(x,w){let S=s.fork(),k=0,j=0,O=0,C=S.end-i,N={size:0,start:0,skip:0};e:for(let D=S.pos-x;S.pos>D;){let P=S.size;if(S.id==w&&P>=0){N.size=k,N.start=j,N.skip=O,O+=4,k+=4,S.next();continue}let q=S.pos-P;if(P<0||q=o?4:0,I=S.start;for(S.next();S.pos>q;){if(S.size<0)if(S.size==-3)z+=4;else break e;else S.id>=o&&(z+=4);S.next()}j=I,k+=P,O+=z}return(w<0||k==x)&&(N.size=k,N.start=j,N.skip=O),N.size>4?N:void 0}function g(x,w,S){let{id:k,start:j,end:O,size:C}=s;if(s.next(),C>=0&&k4){let D=s.pos-(C-4);for(;s.pos>D;)S=g(x,w,S)}w[--S]=N,w[--S]=O-x,w[--S]=j-x,w[--S]=k}else C==-3?u=k:C==-4&&(c=k);return S}let A=[],b=[];for(;s.pos>0;)f(e.start||0,e.bufferStart||0,A,b,-1);let v=(t=e.length)!==null&&t!==void 0?t:A.length?b[0]+A[0].length:0;return new ks(l[e.topID],A.reverse(),b.reverse(),v)}var Nke=new WeakMap;function u8(e,t){if(!e.isAnonymous||t instanceof hg||t.type!=e)return 1;let r=Nke.get(t);if(r==null){r=1;for(let n of t.children){if(n.type!=e||!(n instanceof ks)){r=1;break}r+=u8(e,n)}Nke.set(t,r)}return r}function pZ(e,t,r,n,i,a,o,s,l){let u=0;for(let h=n;h=c)break;S+=k}if(v==x+1){if(S>c){let k=h[x];p(k.children,k.positions,0,k.children.length,m[x]+b);continue}f.push(h[x])}else{let k=m[v-1]+h[v-1].length-w;f.push(pZ(e,h,m,x,v,w,k,null,l))}d.push(w+b-a)}}return p(t,r,n,i,0),(s||l)(f,d,o)}var Nh=class{constructor(t,r,n,i,a=!1,o=!1){this.from=t,this.to=r,this.tree=n,this.offset=i,this.open=(a?1:0)|(o?2:0)}get openStart(){return(this.open&1)>0}get openEnd(){return(this.open&2)>0}static addTree(t,r=[],n=!1){let i=[new Nh(0,t.length,t,0,!1,n)];for(let a of r)a.to>t.length&&i.push(a);return i}static applyChanges(t,r,n=128){if(!r.length)return t;let i=[],a=1,o=t.length?t[0]:null;for(let s=0,l=0,u=0;;s++){let c=s=n)for(;o&&o.from=d.from||f<=d.to||u){let p=Math.max(d.from,l)-u,h=Math.min(d.to,f)-u;d=p>=h?null:new Nh(p,h,d.tree,d.offset+u,s>0,!!c)}if(d&&i.push(d),o.to>f)break;o=anew ED(i.from,i.to)):[new ED(0,0)]:[new ED(0,t.length)],this.createParse(t,r||[],n)}parse(t,r,n){let i=this.startParse(t,r,n);for(;;){let a=i.advance();if(a)return a}}},fZ=class{constructor(t){this.string=t}get length(){return this.string.length}chunk(t){return this.string.slice(t)}get lineChunks(){return!1}read(t,r){return this.string.slice(t,r)}};var Umr=new Vi({perNode:!0});var gu=require("@codemirror/state"),Ag=require("@codemirror/view");var cet=0,Zd=class{constructor(t,r,n){this.set=t,this.base=r,this.modified=n,this.id=cet++}static define(t){if(t?.base)throw new Error("Can not derive from a modified tag");let r=new Zd([],null,[]);if(r.set.push(r),t)for(let n of t.set)r.set.push(n);return r}static defineModifier(){let t=new U2;return r=>r.modified.indexOf(t)>-1?r:U2.get(r.base||r,r.modified.concat(t).sort((n,i)=>n.id-i.id))}},fet=0,U2=class{constructor(){this.instances=[],this.id=fet++}static get(t,r){if(!r.length)return t;let n=r[0].instances.find(s=>s.base==t&&det(r,s.modified));if(n)return n;let i=[],a=new Zd(i,t,r);for(let s of r)s.instances.push(a);let o=Ike(r);for(let s of t.set)for(let l of o)i.push(U2.get(s,l));return a}};function det(e,t){return e.length==t.length&&e.every((r,n)=>r==t[n])}function Ike(e){let t=[e];for(let r=0;r0&&f+3==i.length){o=1;break}let d=/^"(?:[^"\\]|\\.)*?"|[^\/!]+/.exec(s);if(!d)throw new RangeError("Invalid path: "+i);if(a.push(d[0]=="*"?"":d[0][0]=='"'?JSON.parse(d[0]):d[0]),f+=d[0].length,f==i.length)break;let p=i[f++];if(f==i.length&&p=="!"){o=0;break}if(p!="/")throw new RangeError("Invalid path: "+i);s=i.slice(f)}let l=a.length-1,u=a[l];if(!u)throw new RangeError("Invalid path: "+i);let c=new hZ(n,o,l>0?a.slice(0,l):null);t[u]=c.sort(t[u])}}return pet.add(t)}var pet=new Vi,hZ=class{constructor(t,r,n,i){this.tags=t,this.mode=r,this.context=n,this.next=i}sort(t){return!t||t.depth{let o=i;for(let s of a)for(let l of s.set){let u=r[l.id];if(u){o=o?o+" "+u:u;break}}return o},scope:n}}var _t=Zd.define,p8=_t(),$v=_t(),_ke=_t($v),Pke=_t($v),qv=_t(),m8=_t(qv),mZ=_t(qv),_h=_t(),cb=_t(_h),Th=_t(),Fh=_t(),AZ=_t(),CD=_t(AZ),h8=_t(),qt={comment:p8,lineComment:_t(p8),blockComment:_t(p8),docComment:_t(p8),name:$v,variableName:_t($v),typeName:_ke,tagName:_t(_ke),propertyName:Pke,attributeName:_t(Pke),className:_t($v),labelName:_t($v),namespace:_t($v),macroName:_t($v),literal:qv,string:m8,docString:_t(m8),character:_t(m8),attributeValue:_t(m8),number:mZ,integer:_t(mZ),float:_t(mZ),bool:_t(qv),regexp:_t(qv),escape:_t(qv),color:_t(qv),url:_t(qv),keyword:Th,self:_t(Th),null:_t(Th),atom:_t(Th),unit:_t(Th),modifier:_t(Th),operatorKeyword:_t(Th),controlKeyword:_t(Th),definitionKeyword:_t(Th),moduleKeyword:_t(Th),operator:Fh,derefOperator:_t(Fh),arithmeticOperator:_t(Fh),logicOperator:_t(Fh),bitwiseOperator:_t(Fh),compareOperator:_t(Fh),updateOperator:_t(Fh),definitionOperator:_t(Fh),typeOperator:_t(Fh),controlOperator:_t(Fh),punctuation:AZ,separator:_t(AZ),bracket:CD,angleBracket:_t(CD),squareBracket:_t(CD),paren:_t(CD),brace:_t(CD),content:_h,heading:cb,heading1:_t(cb),heading2:_t(cb),heading3:_t(cb),heading4:_t(cb),heading5:_t(cb),heading6:_t(cb),contentSeparator:_t(_h),list:_t(_h),quote:_t(_h),emphasis:_t(_h),strong:_t(_h),link:_t(_h),monospace:_t(_h),strikethrough:_t(_h),inserted:_t(),deleted:_t(),changed:_t(),invalid:_t(),meta:h8,documentMeta:_t(h8),annotation:_t(h8),processingInstruction:_t(h8),definition:Zd.defineModifier(),constant:Zd.defineModifier(),function:Zd.defineModifier(),standard:Zd.defineModifier(),local:Zd.defineModifier(),special:Zd.defineModifier()},Vmr=gZ([{tag:qt.link,class:"tok-link"},{tag:qt.heading,class:"tok-heading"},{tag:qt.emphasis,class:"tok-emphasis"},{tag:qt.strong,class:"tok-strong"},{tag:qt.keyword,class:"tok-keyword"},{tag:qt.atom,class:"tok-atom"},{tag:qt.bool,class:"tok-bool"},{tag:qt.url,class:"tok-url"},{tag:qt.labelName,class:"tok-labelName"},{tag:qt.inserted,class:"tok-inserted"},{tag:qt.deleted,class:"tok-deleted"},{tag:qt.literal,class:"tok-literal"},{tag:qt.string,class:"tok-string"},{tag:qt.number,class:"tok-number"},{tag:[qt.regexp,qt.escape,qt.special(qt.string)],class:"tok-string2"},{tag:qt.variableName,class:"tok-variableName"},{tag:qt.local(qt.variableName),class:"tok-variableName tok-local"},{tag:qt.definition(qt.variableName),class:"tok-variableName tok-definition"},{tag:qt.special(qt.variableName),class:"tok-variableName2"},{tag:qt.definition(qt.propertyName),class:"tok-propertyName tok-definition"},{tag:qt.typeName,class:"tok-typeName"},{tag:qt.namespace,class:"tok-namespace"},{tag:qt.className,class:"tok-className"},{tag:qt.macroName,class:"tok-macroName"},{tag:qt.propertyName,class:"tok-propertyName"},{tag:qt.operator,class:"tok-operator"},{tag:qt.comment,class:"tok-comment"},{tag:qt.meta,class:"tok-meta"},{tag:qt.invalid,class:"tok-invalid"},{tag:qt.punctuation,class:"tok-punctuation"}]);var vZ,A8=new Vi;var Xd=class{constructor(t,r,n=[]){this.data=t,gu.EditorState.prototype.hasOwnProperty("tree")||Object.defineProperty(gu.EditorState.prototype,"tree",{get(){return OD(this)}}),this.parser=r,this.extension=[H2.of(this),gu.EditorState.languageData.of((i,a,o)=>i.facet(Rke(i,a,o)))].concat(n)}isActiveAt(t,r,n=-1){return Rke(t,r,n)==this.data}findRegions(t){let r=t.facet(H2);if(r?.data==this.data)return[{from:0,to:t.doc.length}];if(!r||!r.allowsNesting)return[];let n=[],i=(a,o)=>{if(a.prop(A8)==this.data){n.push({from:o,to:o+a.length});return}let s=a.prop(Vi.mounted);if(s){if(s.tree.prop(A8)==this.data){if(s.overlay)for(let l of s.overlay)n.push({from:l.from+o,to:l.to+o});else n.push({from:o,to:o+a.length});return}else if(s.overlay){let l=n.length;if(i(s.tree,s.overlay[0].from+o),n.length>l)return}}for(let l=0;l=this.cursorPos?this.doc.sliceString(t,r):this.string.slice(t-n,r-n)}},DD=null,W2=class{constructor(t,r,n=[],i,a,o,s,l){this.parser=t,this.state=r,this.fragments=n,this.tree=i,this.treeLen=a,this.viewport=o,this.skipped=s,this.scheduleOn=l,this.parse=null,this.tempSkipped=[]}static create(t,r,n){return new W2(t,r,[],ks.empty,0,n,[],null)}startParse(){return this.parser.startParse(new xZ(this.state.doc),this.fragments)}work(t,r){return r!=null&&r>=this.state.doc.length&&(r=void 0),this.tree!=ks.empty&&this.isDone(r??this.state.doc.length)?(this.takeTree(),!0):this.withContext(()=>{var n;if(typeof t=="number"){let i=Date.now()+t;t=()=>Date.now()>i}for(this.parse||(this.parse=this.startParse()),r!=null&&(this.parse.stoppedAt==null||this.parse.stoppedAt>r)&&r=this.treeLen&&((this.parse.stoppedAt==null||this.parse.stoppedAt>t)&&this.parse.stopAt(t),this.withContext(()=>{for(;!(r=this.parse.advance()););}),this.treeLen=t,this.tree=r,this.fragments=this.withoutTempSkipped(Nh.addTree(this.tree,this.fragments,!0)),this.parse=null)}withContext(t){let r=DD;DD=this;try{return t()}finally{DD=r}}withoutTempSkipped(t){for(let r;r=this.tempSkipped.pop();)t=$ke(t,r.from,r.to);return t}changes(t,r){let{fragments:n,tree:i,treeLen:a,viewport:o,skipped:s}=this;if(this.takeTree(),!t.empty){let l=[];if(t.iterChangedRanges((u,c,f,d)=>l.push({fromA:u,toA:c,fromB:f,toB:d})),n=Nh.applyChanges(n,l),i=ks.empty,a=0,o={from:t.mapPos(o.from,-1),to:t.mapPos(o.to,1)},this.skipped.length){s=[];for(let u of this.skipped){let c=t.mapPos(u.from,1),f=t.mapPos(u.to,-1);ct.from&&(this.fragments=$ke(this.fragments,i,a),this.skipped.splice(n--,1))}return this.skipped.length>=r?!1:(this.reset(),!0)}reset(){this.parse&&(this.takeTree(),this.parse=null)}skipUntilInView(t,r){this.skipped.push({from:t,to:r})}static getSkippingParser(t){return new class extends d8{createParse(r,n,i){let a=i[0].from,o=i[i.length-1].to;return{parsedPos:a,advance(){let l=DD;if(l){for(let u of i)l.tempSkipped.push(u);t&&(l.scheduleOn=l.scheduleOn?Promise.all([l.scheduleOn,t]):t)}return this.parsedPos=o,new ks(Zu.none,[],[],o-a)},stoppedAt:null,stopAt(){}}}}}isDone(t){t=Math.min(t,this.state.doc.length);let r=this.fragments;return this.treeLen>=t&&r.length&&r[0].from==0&&r[0].to>=t}static get(){return DD}};function $ke(e,t,r){return Nh.applyChanges(e,[{fromA:t,toA:r,fromB:t,toB:r}])}var Lv=class{constructor(t){this.context=t,this.tree=t.tree}apply(t){if(!t.docChanged&&this.tree==this.context.tree)return this;let r=this.context.changes(t.changes,t.state),n=this.context.treeLen==t.startState.doc.length?void 0:Math.max(t.changes.mapPos(this.context.treeLen),r.viewport.to);return r.work(20,n)||r.takeTree(),new Lv(r)}static init(t){let r=Math.min(3e3,t.doc.length),n=W2.create(t.facet(H2).parser,t,{from:0,to:r});return n.work(20,r)||n.takeTree(),new Lv(n)}};Xd.state=gu.StateField.define({create:Lv.init,update(e,t){for(let r of t.effects)if(r.is(Xd.setState))return r.value;return t.startState.facet(H2)!=t.state.facet(H2)?Lv.init(t.state):e.apply(t)}});var zke=e=>{let t=setTimeout(()=>e(),500);return()=>clearTimeout(t)};typeof requestIdleCallback<"u"&&(zke=e=>{let t=-1,r=setTimeout(()=>{t=requestIdleCallback(e,{timeout:500-100})},100);return()=>t<0?clearTimeout(r):cancelIdleCallback(t)});var yZ=typeof navigator<"u"&&((vZ=navigator.scheduling)===null||vZ===void 0?void 0:vZ.isInputPending)?()=>navigator.scheduling.isInputPending():null,met=Ag.ViewPlugin.fromClass(class{constructor(t){this.view=t,this.working=null,this.workScheduled=0,this.chunkEnd=-1,this.chunkBudget=-1,this.work=this.work.bind(this),this.scheduleWork()}update(t){let r=this.view.state.field(Xd.state).context;(r.updateViewport(t.view.viewport)||this.view.viewport.to>r.treeLen)&&this.scheduleWork(),t.docChanged&&(this.view.hasFocus&&(this.chunkBudget+=50),this.scheduleWork()),this.checkAsyncSchedule(r)}scheduleWork(){if(this.working)return;let{state:t}=this.view,r=t.field(Xd.state);(r.tree!=r.context.tree||!r.context.isDone(t.doc.length))&&(this.working=zke(this.work))}work(t){this.working=null;let r=Date.now();if(this.chunkEndi+1e3,l=a.context.work(()=>yZ&&yZ()||Date.now()>o,i+(s?0:1e5));this.chunkBudget-=Date.now()-r,(l||this.chunkBudget<=0)&&(a.context.takeTree(),this.view.dispatch({effects:Xd.setState.of(new Lv(a.context))})),this.chunkBudget>0&&!(l&&!s)&&this.scheduleWork(),this.checkAsyncSchedule(a.context)}checkAsyncSchedule(t){t.scheduleOn&&(this.workScheduled++,t.scheduleOn.then(()=>this.scheduleWork()).catch(r=>(0,Ag.logException)(this.view.state,r)).then(()=>this.workScheduled--),t.scheduleOn=null)}destroy(){this.working&&this.working()}isWorking(){return!!(this.working||this.workScheduled>0)}},{eventHandlers:{focus(){this.scheduleWork()}}}),H2=gu.Facet.define({combine(e){return e.length?e[0]:null},enables:[Xd.state,met]});var Uke=gu.Facet.define({combine:e=>{if(!e.length)return" ";if(!/^(?: +|\t+)$/.test(e[0]))throw new Error("Invalid indent unit: "+JSON.stringify(e[0]));return e[0]}});var MD=class{constructor(t,r){let n;function i(s){let l=Gp.newName();return(n||(n=Object.create(null)))["."+l]=s,l}let a=typeof r.all=="string"?r.all:r.all?i(r.all):void 0,o=r.scope;this.scope=o instanceof Xd?s=>s.prop(A8)==o.data:o?s=>s==o:void 0,this.style=gZ(t.map(s=>({tag:s.tag,class:s.class||i(Object.assign({},s,{tag:null}))})),{all:a}).style,this.module=n?new Gp(n):null,this.themeType=r.themeType}static define(t,r){return new MD(t,r||{})}};var ehr=MD.define([{tag:qt.meta,color:"#7a757a"},{tag:qt.link,textDecoration:"underline"},{tag:qt.heading,textDecoration:"underline",fontWeight:"bold"},{tag:qt.emphasis,fontStyle:"italic"},{tag:qt.strong,fontWeight:"bold"},{tag:qt.strikethrough,textDecoration:"line-through"},{tag:qt.keyword,color:"#708"},{tag:[qt.atom,qt.bool,qt.url,qt.contentSeparator,qt.labelName],color:"#219"},{tag:[qt.literal,qt.inserted],color:"#164"},{tag:[qt.string,qt.deleted],color:"#a11"},{tag:[qt.regexp,qt.escape,qt.special(qt.string)],color:"#e40"},{tag:qt.definition(qt.variableName),color:"#00f"},{tag:qt.local(qt.variableName),color:"#30a"},{tag:[qt.typeName,qt.namespace],color:"#085"},{tag:qt.className,color:"#167"},{tag:[qt.special(qt.variableName),qt.macroName],color:"#256"},{tag:qt.definition(qt.propertyName),color:"#00c"},{tag:qt.comment,color:"#940"},{tag:qt.invalid,color:"#f00"}]);var het=Object.create(null),qke=[Zu.none];var Lke=[],Aet=Object.create(null);for(let[e,t]of[["variable","variableName"],["variable-2","variableName.special"],["string-2","string.special"],["def","variableName.definition"],["tag","typeName"],["attribute","propertyName"],["type","typeName"],["builtin","variableName.standard"],["qualifier","modifier"],["error","invalid"],["header","heading"],["property","propertyName"]])Aet[e]=get(het,t);function bZ(e,t){Lke.indexOf(e)>-1||(Lke.push(e),console.warn(t))}function get(e,t){let r=null;for(let a of t.split(".")){let o=e[a]||qt[a];o?typeof o=="function"?r?r=o(r):bZ(a,`Modifier ${a} used at start of tag`):r?bZ(a,`Tag ${a} used as modifier`):r=o:bZ(a,`Unknown highlighting tag ${a}`)}if(!r)return 0;let n=t.replace(/ /g,"_"),i=Zu.define({id:qke.length,name:n,props:[Bke({[n]:r})]});return qke.push(i),i.id}function Wke(e){let t=Object.keys(e).join(""),r=/\w/.test(t);return r&&(t=t.replace(/\w/g,"")),`[${r?"\\w":""}${t.replace(/[^\w\s]/g,"\\$&")}]`}function vet(e){let t=Object.create(null),r=Object.create(null);for(let{label:i}of e){t[i[0]]=!0;for(let a=1;atypeof i=="string"?{label:i}:i),[r,n]=t.every(i=>/^\w+$/.test(i.label))?[/\w*$/,/\w+$/]:vet(t);return i=>{let a=i.matchBefore(n);return a||i.explicit?{from:a?a.from:i.pos,options:t,validFor:r}:null}}function Gke(e,t){return r=>{for(let n=OD(r.state).resolveInner(r.pos,-1);n;n=n.parent)if(e.indexOf(n.name)>-1)return null;return t(r)}}var yet=tl.EditorView.baseTheme({".cm-tooltip.cm-tooltip-autocomplete":{"& > ul":{fontFamily:"monospace",whiteSpace:"nowrap",overflow:"hidden auto",maxWidth_fallback:"700px",maxWidth:"min(700px, 95vw)",minWidth:"250px",maxHeight:"10em",listStyle:"none",margin:0,padding:0,"& > li":{overflowX:"hidden",textOverflow:"ellipsis",cursor:"pointer",padding:"1px 3px",lineHeight:1.2}}},"&light .cm-tooltip-autocomplete ul li[aria-selected]":{background:"#17c",color:"white"},"&dark .cm-tooltip-autocomplete ul li[aria-selected]":{background:"#347",color:"white"},".cm-completionListIncompleteTop:before, .cm-completionListIncompleteBottom:after":{content:'"\xB7\xB7\xB7"',opacity:.5,display:"block",textAlign:"center"},".cm-tooltip.cm-completionInfo":{position:"absolute",padding:"3px 9px",width:"max-content",maxWidth:"300px"},".cm-completionInfo.cm-completionInfo-left":{right:"100%"},".cm-completionInfo.cm-completionInfo-right":{left:"100%"},"&light .cm-snippetField":{backgroundColor:"#00000022"},"&dark .cm-snippetField":{backgroundColor:"#ffffff22"},".cm-snippetFieldPosition":{verticalAlign:"text-top",width:0,height:"1.15em",margin:"0 -0.7px -.7em",borderLeft:"1.4px dotted #888"},".cm-completionMatchedText":{textDecoration:"underline"},".cm-completionDetail":{marginLeft:"0.5em",fontStyle:"italic"},".cm-completionIcon":{fontSize:"90%",width:".8em",display:"inline-block",textAlign:"center",paddingRight:".6em",opacity:"0.6"},".cm-completionIcon-function, .cm-completionIcon-method":{"&:after":{content:"'\u0192'"}},".cm-completionIcon-class":{"&:after":{content:"'\u25CB'"}},".cm-completionIcon-interface":{"&:after":{content:"'\u25CC'"}},".cm-completionIcon-variable":{"&:after":{content:"'\u{1D465}'"}},".cm-completionIcon-constant":{"&:after":{content:"'\u{1D436}'"}},".cm-completionIcon-type":{"&:after":{content:"'\u{1D461}'"}},".cm-completionIcon-enum":{"&:after":{content:"'\u222A'"}},".cm-completionIcon-property":{"&:after":{content:"'\u25A1'"}},".cm-completionIcon-keyword":{"&:after":{content:"'\u{1F511}\uFE0E'"}},".cm-completionIcon-namespace":{"&:after":{content:"'\u25A2'"}},".cm-completionIcon-text":{"&:after":{content:"'abc'",fontSize:"50%",verticalAlign:"middle"}}}),wZ=class{constructor(t,r,n,i){this.field=t,this.line=r,this.from=n,this.to=i}},jD=class{constructor(t,r,n){this.field=t,this.from=r,this.to=n}map(t){let r=t.mapPos(this.from,-1,Ji.MapMode.TrackDel),n=t.mapPos(this.to,1,Ji.MapMode.TrackDel);return r==null||n==null?null:new jD(this.field,r,n)}},ND=class{constructor(t,r){this.lines=t,this.fieldPositions=r}instantiate(t,r){let n=[],i=[r],a=t.doc.lineAt(r),o=/^\s*/.exec(a.text)[0];for(let l of this.lines){if(n.length){let u=o,c=/^\t*/.exec(l)[0].length;for(let f=0;fnew jD(l.field,i[l.line]+l.from,i[l.line]+l.to));return{text:n,ranges:s}}static parse(t){let r=[],n=[],i=[],a;for(let o of t.split(/\r\n?|\n/)){for(;a=/[#$]\{(?:(\d+)(?::([^}]*))?|([^}]*))\}/.exec(o);){let s=a[1]?+a[1]:null,l=a[2]||a[3]||"",u=-1;for(let c=0;c=u&&f.field++}i.push(new wZ(u,n.length,a.index,a.index+l.length)),o=o.slice(0,a.index)+l+o.slice(a.index+a[0].length)}n.push(o)}return new ND(n,i)}},bet=tl.Decoration.widget({widget:new class extends tl.WidgetType{toDOM(){let e=document.createElement("span");return e.className="cm-snippetFieldPosition",e}ignoreEvent(){return!1}}}),xet=tl.Decoration.mark({class:"cm-snippetField"}),zv=class{constructor(t,r){this.ranges=t,this.active=r,this.deco=tl.Decoration.set(t.map(n=>(n.from==n.to?bet:xet).range(n.from,n.to)))}map(t){let r=[];for(let n of this.ranges){let i=n.map(t);if(!i)return null;r.push(i)}return new zv(r,this.active)}selectionInsideField(t){return t.ranges.every(r=>this.ranges.some(n=>n.field==this.active&&n.from<=r.from&&n.to>=r.to))}},FD=Ji.StateEffect.define({map(e,t){return e&&e.map(t)}}),wet=Ji.StateEffect.define(),TD=Ji.StateField.define({create(){return null},update(e,t){for(let r of t.effects){if(r.is(FD))return r.value;if(r.is(wet)&&e)return new zv(e.ranges,r.value)}return e&&t.docChanged&&(e=e.map(t.changes)),e&&t.selection&&!e.selectionInsideField(t.selection)&&(e=null),e},provide:e=>tl.EditorView.decorations.from(e,t=>t?t.deco:tl.Decoration.none)});function SZ(e,t){return Ji.EditorSelection.create(e.filter(r=>r.field==t).map(r=>Ji.EditorSelection.range(r.from,r.to)))}function Eet(e){let t=ND.parse(e);return(r,n,i,a)=>{let{text:o,ranges:s}=t.instantiate(r.state,i),l={changes:{from:i,to:a,insert:Ji.Text.of(o)}};if(s.length&&(l.selection=SZ(s,0)),s.length>1){let u=new zv(s,0),c=l.effects=[FD.of(u)];r.state.field(TD,!1)===void 0&&c.push(Ji.StateEffect.appendConfig.of([TD,Met,jet,yet]))}r.dispatch(r.state.update(l))}}function Qke(e){return({state:t,dispatch:r})=>{let n=t.field(TD,!1);if(!n||e<0&&n.active==0)return!1;let i=n.active+e,a=e>0&&!n.ranges.some(o=>o.field==i+e);return r(t.update({selection:SZ(n.ranges,i),effects:FD.of(a?null:new zv(n.ranges,i))})),!0}}var ket=({state:e,dispatch:t})=>e.field(TD,!1)?(t(e.update({effects:FD.of(null)})),!0):!1,Cet=Qke(1),Det=Qke(-1),Oet=[{key:"Tab",run:Cet,shift:Det},{key:"Escape",run:ket}],Hke=Ji.Facet.define({combine(e){return e.length?e[0]:Oet}}),Met=Ji.Prec.highest(tl.keymap.compute([Hke],e=>e.facet(Hke)));function Uv(e,t){return Object.assign(Object.assign({},t),{apply:Eet(e)})}var jet=tl.EditorView.domEventHandlers({mousedown(e,t){let r=t.state.field(TD,!1),n;if(!r||(n=t.posAtCoords({x:e.clientX,y:e.clientY}))==null)return!1;let i=r.ranges.find(a=>a.from<=n&&a.to>=n);return!i||i.field==r.active?!1:(t.dispatch({selection:SZ(r.ranges,i.field),effects:FD.of(r.ranges.some(a=>a.field>i.field)?new zv(r.ranges,i.field):null)}),!0)}});var Yke=new class extends Ji.RangeValue{};Yke.startSide=1;Yke.endSide=-1;var ihr=typeof navigator=="object"&&/Android\b/.test(navigator.userAgent);var Net=[Uv("function ${name}(${params}) {\n ${}\n}",{label:"function",detail:"definition",type:"keyword"}),Uv("for (let ${index} = 0; ${index} < ${bound}; ${index}++) {\n ${}\n}",{label:"for",detail:"loop",type:"keyword"}),Uv("for (let ${name} of ${collection}) {\n ${}\n}",{label:"for",detail:"of loop",type:"keyword"}),Uv(`try { + return days + ":" + hours + ":" + minutes + ':' + seconds;`},types:{date:"date",value:"string"},actions:{onRun:"setTimeout(() => $saveState({}), 1000)"}}}]},jv={id:"button",def:{id:"button",icon:"ui//mouse-pointer-click",description:H.frames.button.description},node:{icon:"ui//mouse-pointer-click",schemaId:"button",parentId:"",name:H.frames.button.label,rank:0,id:"button",type:"group",props:{icon:"",label:"",iconSize:"18",action:"",actionValue:""},types:{icon:"icon",iconSize:"number",label:"text",action:"option",actionValue:"super"},propsAttrs:{action:JSON.stringify({name:H.properties.super.whenClicked,icon:"ui//mouse-pointer-click"}),actionValue:JSON.stringify({name:H.properties.super.performAction})},propsValue:{icon:JSON.stringify({alias:"Icon"}),label:JSON.stringify({alias:"Label"}),iconSize:JSON.stringify({alias:"Icon Size"}),action:JSON.stringify({alias:"Action",options:[],source:"$super"}),actionValue:JSON.stringify({alias:"Action Properties",dynamic:!0,field:"action"})},actions:{onClick:"$api.commands.run(button.props.action, button.props.actionValue, $contexts, $saveState)"},styles:{class:"'mk-button'",gap:"'4px'"}},children:[{...Xa,node:{...Xa.node,props:{value:"button.props.icon"},styles:{"--icon-size":'button.props.iconSize+"px"'}}},{...mn,node:{...mn.node,props:{value:"button.props.label"}}}]},D9={id:"tabs",def:{id:"tabs",icon:"ui//tabs"},node:{icon:"ui//tabs",schemaId:"tabs",parentId:"",name:H.commands.tabs,rank:0,id:"tabs",type:"group",props:{currentTab:"0",tabs:"[{'name': 'Tab 1', 'view': ''}, {'name': 'Tab 2', 'view': ''}]"},propsValue:{tabs:JSON.stringify({alias:"Tabs",typeName:"Tab",type:{name:{type:"text",value:JSON.stringify({alias:"Label"})},view:{type:"link",value:JSON.stringify({alias:"Page"})}}}),currentTab:JSON.stringify({alias:"Selected Tab"})},types:{tabs:"object-multi",currentTab:"number"},styles:{layout:"'row'",width:"'100%'",gap:"'8px'"}},children:[ct({...E9,children:[ct({...k9,children:[ct(mn,{value:"listItem.props.value.name"},{padding:"'4px 8px'",color:"$root.props.currentTab == listItem.props._index ? 'var(--mk-ui-text-primary)' : 'var(--mk-ui-text-tertiary)'",borderBottom:"$root.props.currentTab == listItem.props._index ? '2px solid var(--mk-ui-active)' : 'none'"},{onClick:"$saveState({$root: {props: {currentTab: listItem.props._index}}})"})]},{})]},{value:"$root.props.tabs"},{layout:"'row'",columnGap:"'8px'",flexWrap:"'wrap'",rowGap:"'4px'"}),ct(Mo,{value:"$root.props.tabs[$root.props.currentTab].view"},{padding:"'0px'","--mk-expanded":"true","--mk-min-mode":"true"},{})]},xh={id:"field",def:{id:"field",description:H.frames.field.description},node:{schemaId:"field",parentId:"",name:H.frames.field.label,rank:0,id:"field",type:"group",props:{type:"",value:"",sticker:"",property:""},types:{value:"text",type:"text",sticker:"text",property:"object"},styles:{"--font-text-size":"'14px'",fontSize:"'14px'",hidden:"$root.props.value?.length == 0"}},children:[ct({...hn,children:[ct(mn,{value:"$root.props.value"},{padding:"'4px 8px'",borderRadius:"'4px'",background:"$api.properties.color($root.props.property, $root.props.value)",hidden:"$root.props.type != 'option'"}),ct(mn,{value:"$root.props.value"},{hidden:"$root.props.type != 'text' && $root.props.type != 'number' && $root.props.type != 'fileprop'"}),ct({...hn,children:[ct(Xa,{value:"'ui//check'"},{background:"'var(--mk-ui-active)'",width:"'16px'",height:"'16px'"}),ct(mn,{value:"$root.props.property?.name"})]},{},{layout:"'row'",gap:"'4px'",layoutAlign:"'w'",height:"'auto'",hidden:"$root.props.type != 'boolean'"}),ct(uf,{value:"$root.props.value"},{width:"'50px'",height:"'50px'",hidden:"$root.props.type != 'image'"}),ct(Xa,{value:"$root.props.value"},{hidden:"$root.props.type != 'icon'"}),ct(Mo,{value:"$root.props.value"},{hidden:"$root.props.type != 'link' && $root.props.type != 'file' && $root.props.type != 'context'",padding:"'0px'"})]},{},{layout:"'row'",layoutAlign:"'w'",height:"'auto'",gap:"'8px'",minHeight:"'24px'",hidden:"!($root.props.value?.length > 0) || $root.props.type?.contains('multi')"}),ct({...E9,children:[ct({...k9,children:[ct(mn,{value:"listItem.props.value"},{padding:"'4px 8px'",borderRadius:"'4px'",background:"$api.properties.color($root.props.property, listItem.props.value)",hidden:"$root.props.type != 'option-multi' && $root.props.type != 'tags'"}),ct(Mo,{value:"listItem.props.value"},{hidden:"$root.props.type != 'link-multi' && $root.props.type != 'context-multi'",padding:"'0px'"})]},{})]},{value:"$api.properties.value($root.props.type, $root.props.value)"},{layout:"'row'",columnGap:"'8px'",flexWrap:"'wrap'",rowGap:"'4px'",hidden:"!$root.props.type?.includes('multi')"})]},mD={id:"preview",def:{id:"preview"},node:{schemaId:"preview",parentId:"",name:"Preview",rank:0,id:"preview",type:"group",props:{path:"",width:'"50px"',height:"'50px'",radius:"'8px'",padding:"'16px'"},types:{path:"link",width:"text",height:"text",radius:"text",padding:"text"},styles:{background:"'var(--background-secondary)'",height:"$root.props.height",borderRadius:"$root.props.radius",overflow:"'hidden'"}},children:[ct(uf,{value:"$api.path.label(preview.props.path)?.thumbnail"},{width:"$root.props.width",height:"$root.props.height",hidden:"$api.path.label(preview.props.path)?.thumbnail?.length == 0",borderRadius:"$root.props.radius"}),ct(Xa,{value:"$api.path.label(preview.props.path)?.sticker"},{width:"$root.props.width",height:"$root.props.height",hidden:"$api.path.label(preview.props.path)?.thumbnail?.length > 0",borderRadius:"$root.props.radius",background:"$api.path.label(preview.props.path)?.color",padding:"$root.props.padding",overflow:"'hidden'"})]},O9={id:"rating",def:{id:"rating",icon:"ui//star"},node:{icon:"ui//star",schemaId:"rating",parentId:"",name:H.commands.rating,rank:0,id:"rating",type:"group",props:{value:"5",icon:"'ui//star'"},types:{value:"number",icon:"icon"},styles:{layout:"'row'",height:"'16px'"}},children:[ct(Xa,{value:"$root.props.icon"},{width:"$root.styles.height",height:"$root.styles.height",hidden:"$root.props.value < 1"}),ct(Xa,{value:"$root.props.icon"},{width:"$root.styles.height",height:"$root.styles.height",hidden:"$root.props.value < 2"}),ct(Xa,{value:"$root.props.icon"},{width:"$root.styles.height",height:"$root.styles.height",hidden:"$root.props.value < 3"}),ct(Xa,{value:"$root.props.icon"},{width:"$root.styles.height",height:"$root.styles.height",hidden:"$root.props.value < 4"}),ct(Xa,{value:"$root.props.icon"},{width:"$root.styles.height",height:"$root.styles.height",hidden:"$root.props.value < 5"})]},M9={id:"callout",def:{id:"callout",icon:"ui//callout"},node:{icon:"ui//callout",schemaId:"callout",parentId:"",name:H.commands.callout,rank:0,id:"callout",type:"group",props:{icon:"",note:""},types:{icon:"icon",note:"link"},styles:{borderRadius:"'8px'",background:"'var(--mk-ui-background-contrast)'",width:"'100%'",layout:"'row'",gap:"'8px'",padding:"'16px'"}},children:[ct(Xa,{value:"callout.props.icon"},{width:"'18px'",height:"'18px'"}),ct({...mc,children:[ct(Mo,{value:"callout.props.note"},{width:"'100%'","--mk-expanded":"true","--mk-min-mode":"true"})]},{},{width:"'auto'",flex:"'1'"})]},j9={id:"toggle",def:{id:"toggle",icon:"ui//collapse-solid",description:H.frames.toggle.description},node:{icon:"ui//collapse-solid",schemaId:"toggle",parentId:"",name:H.commands.toggle,rank:0,id:"toggle",type:"group",props:{value:"false",label:"",note:""},types:{value:"boolean",label:"text",note:"link"},styles:{width:"'100%'"}},children:[ct({...Mv,children:[ct({...Rc,children:[ct({...Ui,node:{...Ui.node,ref:"icon"}},{},{transform:"'rotate(90deg)'"})]},{value:"true"}),ct({...Rc,children:[ct({...Ui,node:{...Ui.node,ref:"icon"}},{},{transform:"'rotate(0deg)'"})]},{value:"false"})]},{value:"'value'"}),ct({...hn,children:[{...Xa,node:{...Xa.node,props:{value:"'ui//collapse-solid'"},styles:{width:"'16px'",height:"'16px'",transform:"'rotate(90deg)'"},actions:{onClick:"$saveState({ toggle: {props: { value: !toggle.props.value }} })"}}},{...mn,node:{...mn.node,props:{value:"toggle.props.label"}}}]},{},{height:"'auto'",layoutAlign:"'w'",gap:"'8px'",layout:"'row'"}),ct({...mc,children:[ct(Mo,{value:"toggle.props.note"},{width:"'auto'",flex:"'1'","--mk-expanded":"true","--mk-min-mode":"true"})]},{},{paddingLeft:"'24px'",hidden:"!toggle.props.value"})]},N9={id:"progress",def:{id:"progress",icon:"ui//pie-chart"},node:{icon:"ui//pie-chart",schemaId:"progress",parentId:"",name:H.commands.progress,rank:0,id:"progress",type:"group",props:{value:"50",max:"100",color:"'var(--background-modifier-form-field)'",backgroundColor:"'var(--color-orange)'"},types:{value:"number",max:"number",color:"color",backgroundColor:"color"},styles:{background:"$root.props.color",height:"'10px'",width:"'100px'",borderRadius:"'5px'"}},children:[{...hn,node:{...hn.node,styles:{width:"$root.props.value/$root.props.max*100+'%'",height:"'100%'",borderRadius:"'5px'",background:"$root.props.backgroundColor",display:"'block'"}}}]},T9={id:"circularProgress",def:{id:"circularProgress",icon:"ui//pie-chart"},node:{icon:"ui//pie-chart",schemaId:"circularProgress",parentId:"",name:H.commands.circularProgress,rank:0,id:"circularProgress",type:"group",props:{value:"50",max:"100",color:"'var(--color-orange)'",backgroundColor:"'var(--background-modifier-form-field)'",ringWidth:"5"},types:{value:"number",color:"color",max:"number",backgroundColor:"color",ringWidth:"number"},styles:{height:"'100px'",width:"'100px'"}},children:[ct(hn,{},{background:"`conic-gradient(${$root.props.color} ${$root.props.value/$root.props.max*100}%, ${$root.props.backgroundColor} 0)`",maskImage:"`radial-gradient(circle calc(calc(${$root.styles.width} - ${$root.props.ringWidth}px) / 2) at calc(50%) calc(50%),transparent 100%,black 0%)`",height:"'100%'",width:"'100%'",borderRadius:"'50%'"})]},spr={id:"card",def:{id:"card",icon:"ui//mouse-pointer-click"},node:{icon:"ui//mouse-pointer-click",schemaId:"card",parentId:"",name:H.commands.card,rank:0,id:"card",type:"group",props:{icon:"",label:""},types:{icon:"icon",label:"text"},actions:{},styles:{borderRadius:"'10px'",background:"'var(--background-primary-alt)'",width:"'160px'",height:"'80px'",padding:"'16px'",border:"'thin solid var(--mk-ui-divider)'"}},children:[{...Xa,node:{...Xa.node,props:{value:"card.props.icon"}}},{...mn,node:{...mn.node,props:{value:"card.props.label"}}}]},NEe={id:"link",def:{id:"link",icon:"ui//link"},node:{icon:"ui//link",schemaId:"link",parentId:"",name:H.commands.link,rank:0,id:"link",type:"group",props:{link:"",label:"$api.path.label(link.props.link)?.name",sticker:"$api.path.label(link.props.link)?.sticker"},styles:{class:"'mk-a'",layout:'"row"'},actions:{onClick:"$api.path.open(link.props.link, false)"},types:{link:"link",label:"text",sticker:"sticker"}},children:[{...Xa,node:{...Xa.node,props:{value:"link.props.sticker"},styles:{width:"'18px'",height:"'18px'"}}},{...mn,node:{...mn.node,props:{value:"link.props.label"}}}]};var Wi=(0,Tl.createContext)({root:null,nodes:[],properties:[],groupNodes:()=>null,ungroupNode:()=>null,addNode:()=>null,deleteNode:()=>null,saveNodes:()=>null,moveUp:()=>null,moveDown:()=>null,moveToRank:()=>null,moveNodeFromSchema:()=>null,selectedSlide:null,setSelectedSlide:()=>null,updateNode:()=>null,frameProperties:[],lastCreatedId:null,setLastCreatedId:()=>null}),FEe=e=>{let{spaceInfo:t}=(0,Tl.useContext)(ur),[r,n]=(0,Tl.useState)(null),[i,a]=(0,Tl.useState)(null),{frameSchema:o,saveFrame:s,frameSchemas:l,tableData:u,getMDBData:c}=(0,Tl.useContext)(ma),f=(0,Tl.useMemo)(()=>{if(!o)return[];let D=u?.rows.map(q=>q.id==o.id?{...W1(q),types:u.cols.reduce((z,I)=>({...z,[I.name]:I.type}),{}),propsValue:u.cols.reduce((z,I)=>({...z,[I.name]:I.value}),{})}:W1(q))??[],P=sL(o);return D.some(q=>q.id==P.id)?D:[...D,P]},[u,o]),[d,p]=(0,Tl.useState)(null),h=(0,Tl.useMemo)(()=>{let D=[...d0(e.superstate.settings)];return d?.id?[...u?.cols.map(P=>({...P,table:""}))??[],...(e.cols??[]).map(P=>({...P,schemaId:d.id}))].filter(P=>D.some(q=>q==P.name)==!1):[]},[d,e.cols]),m=async()=>{if(o?.type=="frame"){let D=await lL(o,[...u?.cols??[],...(e.cols??[]).map(P=>({...P,schemaId:o.id}))],f,e.superstate,{editMode:e.editMode,screenType:e.superstate.ui.getScreenType()});ij(D,d)&&p(D)}},g=D=>{D.path==t.path&&(!D.schemaId||D.schemaId==o?.id)&&m()};(0,Tl.useEffect)(()=>(e.superstate.eventsDispatcher.addListener("frameStateUpdated",g),()=>{e.superstate.eventsDispatcher.removeListener("frameStateUpdated",g)}),[t]),(0,Tl.useEffect)(()=>{m()},[o,f,u,e.editMode]);let A=(D,P)=>{let q=f.find(z=>z.id==D.id);if(!!q)if(r){let z=f.find(I=>I.parentId==r&&I.ref==q.id);z?j([{...z,props:P.props?{...z.props,...P.props}:z.props,styles:P.styles?{...z.styles,...P.styles}:z.styles,actions:P.actions?{...z.actions,...P.actions}:z.actions}]):k({...Ui.node,ref:q.id,...P},f.find(I=>I.id==r),!0)}else j([{...q,props:P.props?{...q.props,...P.props}:q.props,styles:P.styles?{...q.styles,...P.styles}:q.styles,actions:P.actions?{...q.actions,...P.actions}:q.actions}])},b=D=>{let P=f.filter(T=>T.parentId==D.parentId).sort((T,L)=>T.rank-L.rank).map((T,L)=>({...T,rank:L})),q=P.findIndex(T=>T.id===D.id);if(q<=0){j(P);return}let z=P[q],I=P[q-1];[z.rank,I.rank]=[I.rank,z.rank],j(P)},v=D=>{let P=f.filter(T=>T.parentId==D.parentId).sort((T,L)=>T.rank-L.rank).map((T,L)=>({...T,rank:L})),q=P.findIndex(T=>T.id===D.id);if(q<0||q>=P.length-1){j(P);return}let z=P[q],I=P[q+1];[z.rank,I.rank]=[I.rank,z.rank],j(P.sort((T,L)=>T.rank-L.rank))},x=D=>{let P=f.filter(T=>T.parentId==D.id),q=D.rank,z=f.filter(T=>T.parentId==D.parentId).sort((T,L)=>T.rank-L.rank),I=Dx(z,q,P.map(T=>({...T,parentId:D.parentId}))).filter(T=>T.id!=D.id).map((T,L)=>({...T,rank:L}));return j(I,[D])},w=(D,P)=>{let q=f.filter(L=>L.parentId==D.parentId).sort((L,_)=>L.rank-_.rank).map((L,_)=>({...L,rank:_})),z=q.findIndex(L=>L.id===D.id);if(z<0||P<0||P>=q.length){j(q);return}let I=q[z];I.rank=P;let T=Ws(q,z,P).map((L,_)=>({...L,rank:_}));j(T)},S=(D,P)=>{let q=D[0].id==o.id?"":D[0].parentId,z={...z1(hn,q,f,o.id)},I=D.map(T=>{let L=TEe.default.cloneDeep(T);return L.parentId=z.id,L});j([{...z,styles:{...z.styles,...P}},...I])},k=async(D,P,q)=>{let z=sf("$root",o.id,D,o.id),I=Mi(z.id,f.map(oe=>oe.id));z=sf(D.id,I,D,o.id);let T=P||d.node,L=P?P.rank+1:T.rank;!q||!jEe.some(oe=>T.type==oe)?T=pc(d,T.id).node:L=f.filter(oe=>oe.parentId==T.id).length;let _={...z,id:I,schemaId:o.id,parentId:T.id},Y=Cx(f.filter(oe=>oe.parentId==T.id).sort((oe,te)=>oe.rank-te.rank),L,_).map((oe,te)=>({...oe,rank:te}));return await j(Y).then(oe=>_)},j=async(D,P)=>{if(!u)return;let q=u?.rows?.some(L=>L.id==d.id)?u.rows:[...u?.rows??[],lf(d.node)],z=D.filter(L=>!q.some(_=>_.id==L.id)).map(L=>lf(L)),I=D.filter(L=>q.some(_=>_.id==L.id)).map(L=>lf(L)),T={...u,cols:u.cols??[],rows:[...q.map(L=>I.find(_=>_.id==L.id)??L),...z].filter(L=>P?!P.some(_=>_.id==L.id):L)};await s(T)},O=async(D,P,q,z)=>{let I=await c();if(!I[P])return;let T=I[P].rows.map(Q=>W1(Q)),L=l.find(Q=>Q.id==P),_=T.find(Q=>Q.id==D);if(!L||!_)return;let Y=await Ok(_,T,e.superstate,0,!1,{editMode:e.editMode}).then(Q=>Q[0]),oe=H1(Y,Y.node.schemaId),te=oe.map(Q=>({...Q,schemaId:o.id,styles:Q.id==D&&z?{...Q.styles,...z}:Q.styles,parentId:Q.id==D?q:Q.parentId}));await s({...I[o.id],rows:I[o.id].rows.filter(Q=>!oe.some(fe=>Q.schemaId==fe.schemaId&&Q.id==fe.id))}),await s({...u,rows:[...u.rows,...te.map(Q=>lf(Q))]})},C=async D=>{let P=await Ok(D,f,e.superstate,0,!1,{editMode:e.editMode},!0).then(T=>T[0]),q=pc(d,D.id),z=[],I=H1(P,P.node.schemaId);if(q){q.children.length==1&&q.node.type=="column"&&I.push(q.node);let T=pc(d,q.id);T?.node.type=="container"&&(T.children.length==1?I.push(T.node):T.children.filter(L=>L.node.type=="column").length==1&&(T.children.forEach(L=>{L.node.type!="column"&&z.push({...L.node,parentId:T.node.parentId})}),I.push(T.node)))}s({...u,rows:u.rows.filter(T=>!I.some(L=>T.schemaId==L.schemaId&&T.id==L.id)).map(T=>z.find(L=>L.id==T.id)?lf(z.find(L=>L.id==T.id)):T)})},N=u?.cols??[];return Tl.default.createElement(Wi.Provider,{value:{root:d,nodes:f,properties:N,addNode:k,deleteNode:C,saveNodes:j,ungroupNode:x,moveUp:b,moveDown:v,moveToRank:w,moveNodeFromSchema:O,groupNodes:S,selectedSlide:r,setSelectedSlide:n,updateNode:A,frameProperties:h,lastCreatedId:i,setLastCreatedId:a}},e.children)};var ib=Ae(Te());var PY=ib.default.createContext({root:null,path:null}),F9=e=>{let[t,r]=(0,ib.useState)(null),n=i=>{if(!(i.path!=e.path.basePath&&e.path.authority!="$kit")){if(e.path.authority=="$kit"){r(e.superstate.kitFrames.get(e.path.ref));return}e.superstate.spaceManager.readFrame(e.path.basePath,e.path.ref).then(a=>rj(e.superstate,a,{...c0,screenType:e.superstate.ui.getScreenType()})).then(a=>r(a))}};return(0,ib.useEffect)(()=>(e.superstate.eventsDispatcher.addListener("frameStateUpdated",n),n({path:e.path.basePath}),()=>{e.superstate.eventsDispatcher.removeListener("frameStateUpdated",n)}),[e.path]),ib.default.createElement(PY.Provider,{value:{root:t,path:e.path.fullPath}},e.children)};var _i=(0,Wa.createContext)({id:"",hoverNode:{id:null,node:"",direction:null},setHoverNode:e=>null,selectableNodeBounds:{current:{}},runRoot:()=>null,instance:null,saveState:(e,t)=>null,fastSaveState:e=>null,linkedProps:[]}),ug=e=>{let[t,r]=(0,Wa.useState)(null),[n,i]=(0,Wa.useState)({state:{},id:null,root:null,exec:null,slides:{},contexts:{}}),[a,o]=(0,Wa.useState)(e.props);(0,Wa.useEffect)(()=>{o(x=>Nv.default.isEqual(x,e.props)?x:e.props)},[e.props]);let{selectedSlide:s}=(0,Wa.useContext)(Wi),l=e.editable?s:null,{root:u}=(0,Wa.useContext)(Wi),{root:c,path:f}=(0,Wa.useContext)(PY),d=(0,Wa.useMemo)(()=>e.editable?u:c,[e.editable,u,c]),p=(0,Wa.useRef)(null),h=(0,Wa.useRef)(null),m=(0,Wa.useMemo)(()=>Object.keys(e.propSetters||{}),[e.propSetters]),g=(x,w)=>{let{root:S,exec:k,id:j,state:O}=w;if(Tte(x,"$root",k.id),p.current!=j)return;let{$api:C,...N}=O;KB(k,{state:O,newState:oL(x,a,k.id),prevState:Nv.default.cloneDeep(N),slides:{}},{api:e.superstate.api,saveState:g,root:S,contexts:e.contexts,runID:j,selectedSlide:l,exec:k}).then(D=>{i(P=>D)})};(0,Wa.useEffect)(()=>{n?.root&&e.propSetters&&ere(Object.keys(e.propSetters),a,n.state,n.root.id).forEach(x=>{e.propSetters[x](n.state[n.root.id].props[x])})},[n]);let A=(0,Wa.useRef)({}),b=x=>{i(w=>({...w,state:x}))};(0,Wa.useEffect)(()=>()=>{p.current=null},[]);let v=()=>{if(d){let x=Nv.default.cloneDeep(d),w=(0,Nv.uniqueId)();p.current=w,KB(x,{prevState:{},state:{},newState:oL({},a,x.id),slides:{}},{api:e.superstate.api,contexts:e.contexts,saveState:g,root:d,exec:x,runID:w,selectedSlide:l}).then(S=>{i(k=>S),p.current=S.id})}};return(0,Wa.useEffect)(()=>{n.root&&!ij(d,n.root)&&(0,Nv.isEqual)(e.contexts,n.contexts)?g({[n.root.id]:{props:a}},n):v()},[a,d,e.contexts]),Wa.default.createElement(_i.Provider,{value:{id:e.id,linkedProps:m,hoverNode:t,setHoverNode:r,selectableNodeBounds:A,runRoot:v,instance:n,saveState:g,fastSaveState:b}},e.children)};var Hi=(0,Fl.createContext)({selectable:!1,selected:!1,selection:[],selectionMode:0,select:(e,t)=>null,selectMulti:(e,t)=>null,deselect:e=>null,isParentToSelection:!1,setIsParentToSelection:e=>null,id:""}),Tv=e=>{let{selection:t,selectionMode:r,setIsParentToSelection:n}=(0,Fl.useContext)(Hi),{spaceState:i}=(0,Fl.useContext)(ur),a=(0,Fl.useMemo)(()=>t.includes(e.id)||e.selected,[t,e.id,e.selected]),o=(0,Fl.useMemo)(()=>i?.metadata.readMode?0:e.editMode??0,[e.editMode,i]),{instance:s}=(0,Fl.useContext)(_i),[l,u]=(0,Fl.useState)([]),[c,f]=(0,Fl.useState)(!1),d=(0,Fl.useMemo)(()=>!!(l.length>0||c||a&&o>=3||o==1),[a,o,l,c]);(0,Fl.useEffect)(()=>{let g=A=>{A!=e.id&&(u([]),f(!1))};return e.superstate.ui.addResetFunction(g),()=>{e.superstate.ui.removeResetFunction(g)}},[u,f]);let p=(g,A)=>{if(o==0)return;let b=l;if(e.superstate.ui.resetSelection(e.id),!g){u([]);return}A?(u(v=>[...l.filter(x=>x!=g),g]),n(!0)):(u([g]),n(!0))},h=(g,A)=>{if(o==0)return;let b=l;e.superstate.ui.resetSelection(e.id),A?(u(v=>[...l.filter(x=>!g.some(w=>w==x)),...g]),n(!0)):(u([...g]),n(!0))},m=g=>{o!=0&&u(A=>A.filter(b=>b!=g))};return Fl.default.createElement(Hi.Provider,{value:{selectable:d,selected:a,selection:l,selectionMode:o,select:p,selectMulti:h,isParentToSelection:c,deselect:m,setIsParentToSelection:f,id:e.id}},e.children)};var sCe=Ae(yi());var ta=Ae(Te());var cg=(e,t)=>{let r=t.substring(0,1)==="#",n=(r?t.substring(1):t).split(""),i=n.length>3,a=[],o=0,s=3;for(a.push(n.shift()+(i?n.shift():"")),a.push(n.shift()+(i?n.shift():"")),a.push(n.shift()+(i?n.shift():""));o({label:{name:H.metadataTypes.label,properties:_Ee},file:{name:H.metadataTypes.fileMetadata,properties:PEe},path:{name:H.metadataTypes.outlinks,properties:IEe},frontmatter:{name:H.metadataTypes.frontmatter,properties:e.spaceManager.keysForCacheType("frontmatter").map(t=>({id:"frontmatter."+t,label:t,field:t,vType:"any",defaultFilter:"contains",type:"frontmatter",description:"Frontmatter property"}))},context:{name:H.metadataTypes.contexts,properties:[...e.contextsIndex.values()].flatMap(t=>t?.contextTable?.cols.filter(r=>r.primary!="true").map(r=>({id:"contexts."+t.path+"."+r.name,label:r.name,field:t.path+"."+r.name,vType:ho(r),defaultFilter:"contains",type:"context",description:t.path+" context property"})))}});var G6e=Ae(yi());var br=Ae(Te()),Q6e=Ae(Ya());var aJe=(e,t,r)=>t.reduce((i,a)=>{let[o,s]=i,l=a.type=="context"?BEe(s,a,r):a.type=="path"?$Ee(s,a,r):a.type=="frontmatter"?REe(s,a,r):qEe(s,a,r),u=s.filter(c=>!l.includes(c));return[[...o,...l],u]},[[],e])[0],oJe=(e,t,r)=>t.reduce((n,i)=>i.type=="context"?BEe(n,i,r):i.type=="path"?$Ee(n,i,r):i.type=="frontmatter"?REe(n,i,r):qEe(n,i,r),e),BEe=(e,t,r)=>{let n=qi[t.fn];return!n||n.valueType!="none"&&t.value.length==0?[]:e.filter(i=>{let[a,o]=t.field.split("."),s=i.metadata?.property;if(!i.spaces?.includes(a)||!s||!s[o])return!1;let l=!0;if(n){let u=t.fType=="property"?r[t.value]:t.value;l=n.fn(Ri(o,s[o]),u)}return l})},REe=(e,t,r)=>{let n=qi[t.fn];return!n||n.valueType!="none"&&t.value.length==0?[]:e.filter(i=>{let a=i.metadata?.property;if(!a||a[t.field]===void 0)return!1;let o=!0;if(n){let s=t.fType=="property"?r[t.value]:t.value;o=n.fn(Ri(t.field,a[t.field]),s)}return o})},$Ee=(e,t,r)=>{let n=qi[t.fn];return!n||n.valueType!="none"&&t.value.length==0?[]:e.filter(i=>{let a="";t.field=="outlinks"?a=Bi(i.outlinks??[]):t.field=="inlinks"?a=Bi(i.metadata?.inlinks??[]):t.field=="tags"&&(a=Bi(i.tags??[]));let o=!0;if(n){let s=t.fType=="property"?r[t.value]:t.value;o=n.fn(a,s)}return o})},qEe=(e,t,r)=>{let n=qi[t.fn];return!n||n.valueType!="none"&&t.value.length==0?[]:e.filter(i=>{let a=!0;if(n){let o=t.fType=="property"?r[t.value]:t.value;a=n.fn(i.metadata?.[t.type]?.[t.field],o)}return a})},P9=(e,t,r)=>e.reduce((i,a)=>!i||a.filters.length==0?!1:a.type=="any"?aJe([t],a.filters,r).length>0:oJe([t],a.filters,r).length>0,!0);function LEe(e){let{query:t,pathsIndex:r,count:n}=e,i=[],a={shouldSort:!0,threshold:0,ignoreLocation:!0,keys:[{name:"name",weight:2},"path","label.preview",{name:"spaceNames",weight:.5}]};return new Gp([...r.values()].filter(s=>s.hidden==!1),a).search(t).map(s=>s.item).slice(0,n)}function zEe(e){let{queries:t,pathsIndex:r,count:n}=e,i=[];for(let[a,o]of r)!o.hidden&&P9(t,o,{})&&i.push(o);return i.slice(0,n)}var Lc=Ae(Te());var ea=Ae(Te());var I9=Ae(Te());var B9=e=>{let t=r=>{let n=r.target.getBoundingClientRect();e.superstate.ui.openMenu(n,{ui:e.superstate.ui,editable:!0,value:[e.value],options:e.options,saveOptions:(i,a)=>{e.selectValue(a[0])}},Ne(r.view.document))};return I9.default.createElement("div",{className:"mk-cell-option-item",onClick:r=>e.triggerMenu?e.triggerMenu(r):t(r)},I9.default.createElement("div",null,e.options?e.options.find(r=>r.value==e.value)?.name:e.value),I9.default.createElement("div",{className:"mk-cell-option-select mk-icon-xxsmall mk-icon-rotated",dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//collapse-solid")}}))};var R9=Ae(Te());var Ko=Ae(Te());var Fv=Ae(Te());var UEe=e=>{let t=(0,Fv.useMemo)(()=>e.fields.map(i=>({id:i.name,field:i.name,vType:i.type,label:i.name,defaultFilter:"is",type:"property",description:""})),[]),r=n=>{let i={superstate:e.superstate,saveFormula:a=>e.saveTree({...e.actionTree,props:{...e.actionTree.props,$function:a}}),formula:e.actionTree.props.$function,value:e.values,fields:e.fields,path:e.path};e.superstate.ui.openCustomMenu(n.target.getBoundingClientRect(),Fv.default.createElement(Ah,{...i}),{...i},Ne(n.view.document),"bottom")};return e.command.schema.id=="formula"?Fv.default.createElement("button",{onClick:n=>r(n)},"Edit Formula"):e.command.schema.id=="filter"?Fv.default.createElement(E2,{superstate:e.superstate,filters:e.actionTree.props.$function??[],setFilters:n=>{e.saveTree({...e.actionTree,props:{...e.actionTree.props,$function:n}})},fields:t,sections:[],removeable:!0}):Fv.default.createElement(Fv.default.Fragment,null)};var IY=e=>{let[t,r]=Ko.default.useState(e.actionTree?.action),n=(0,Ko.useMemo)(()=>e.superstate.cli.commandForAction(t),[t]);(0,Ko.useEffect)(()=>{r(e.actionTree?.action)},[e.actionTree]);let i=(o,s)=>{let l=[...bq(e.superstate,e.path)],u=[...new Set(l.map(f=>f.section))].map(f=>({name:f,value:f})),c=o.target.getBoundingClientRect();e.superstate.ui.openMenu(c,{ui:e.superstate.ui,editable:!0,value:[t],options:l,sections:u,showSections:!0,saveOptions:(f,d)=>{if(s){e.saveTree({...e.actionTree,children:[...e.actionTree.children,{action:d[0],props:{},propsValue:{},children:[]}]});return}e.saveTree({...e.actionTree,action:d[0]})}},Ne(o.view.document))},a=(o,s)=>{let l=e.fields.map(c=>({name:c.name,value:c.name})),u=o.target.getBoundingClientRect();e.superstate.ui.openMenu(u,{ui:e.superstate.ui,editable:!0,value:[],options:l,saveOptions:(c,f)=>{e.saveTree({...e.actionTree,linked:{...e.actionTree.linked,[s]:f[0]}})}},Ne(o.view.document))};return Ko.default.createElement("div",{className:"mk-editor-actions-node"},Ko.default.createElement("div",{className:"mk-editor-actions-body"},Ko.default.createElement("div",{className:"mk-editor-actions-name"},Ko.default.createElement("div",{className:"mk-path-icon",dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker(n?Ix(n.schema):"ui//plus")}}),Ko.default.createElement("div",{onClick:o=>!n&&i(o),className:"mk-editor-actions-selector"},n?.schema.name??"Select"),Ko.default.createElement("span",null),e.deleteTree&&Ko.default.createElement("div",{className:"mk-icon-small",onClick:o=>e.deleteTree(),dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//close")}})),n&&Ko.default.createElement("div",{className:"mk-editor-actions-fields"},n.schema.type=="builtin"?Ko.default.createElement(UEe,{superstate:e.superstate,command:n,actionTree:e.actionTree,saveTree:e.saveTree,fields:[...e.fields,e.prevField].filter(o=>o),values:e.values,path:e.path}):n?.fields.map((o,s)=>Ko.default.createElement(bs,{key:s,superstate:e.superstate,column:o,columns:e.fields,initialValue:e.actionTree.props[o.name],updateValue:l=>{let u={...e.actionTree};u.props[o.name]=l,e.saveTree(u)},updateFieldValue:(l,u)=>{let c={...e.actionTree};c.props[o.name]=u,c.propsValue[o.name]=l,e.saveTree(c)},editMode:5,linkProp:l=>a(l,o.name)})))),Ko.default.createElement("div",{className:e.hasSiblings?"mk-editor-actions-children":""},e.actionTree.children.map((o,s)=>Ko.default.createElement(IY,{key:s,hasSiblings:e.actionTree.children.length>1,prevField:n?.fields[s],superstate:e.superstate,path:e.path,fields:e.fields,actionTree:o,saveTree:l=>{let u={...e.actionTree};u.children[s]=l,e.saveTree(u)},values:e.values,deleteTree:()=>{let l={...e.actionTree};l.children.splice(s,1),e.saveTree(l)}})),e.actionTree.children.length==0&&Ko.default.createElement("button",{onClick:o=>i(o,!0),className:"mk-inline-button"},Ko.default.createElement("div",{className:"mk-icon-xsmall",dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//plus")}}),"Add Step")))};var WEe=e=>{let[t,r]=R9.default.useState(HQ(e.formula)??{action:"",props:{},propsValue:{},children:[]});return R9.default.createElement("div",{className:"mk-editor-actions-nodes"},R9.default.createElement(IY,{hasSiblings:!1,superstate:e.superstate,prevField:null,actionTree:t,path:e.path,fields:e.fields,values:e.value,saveTree:n=>{e.saveFormula(JSON.stringify(n)),r(n)}}))};var V2=Ae(Te());var sJe=0,hD=class{constructor(t,r){this.from=t,this.to=r}},Pi=class{constructor(t={}){this.id=sJe++,this.perNode=!!t.perNode,this.deserialize=t.deserialize||(()=>{throw new Error("This node type doesn't define a deserialize function")})}add(t){if(this.perNode)throw new RangeError("Can't add per-node props to node types");return typeof t!="function"&&(t=$c.match(t)),r=>{let n=t(r);return n===void 0?null:[this,n]}}};Pi.closedBy=new Pi({deserialize:e=>e.split(" ")});Pi.openedBy=new Pi({deserialize:e=>e.split(" ")});Pi.group=new Pi({deserialize:e=>e.split(" ")});Pi.contextHash=new Pi({perNode:!0});Pi.lookAhead=new Pi({perNode:!0});Pi.mounted=new Pi({perNode:!0});var lJe=Object.create(null),$c=class{constructor(t,r,n,i=0){this.name=t,this.props=r,this.id=n,this.flags=i}static define(t){let r=t.props&&t.props.length?Object.create(null):lJe,n=(t.top?1:0)|(t.skipped?2:0)|(t.error?4:0)|(t.name==null?8:0),i=new $c(t.name||"",r,t.id,n);if(t.props){for(let a of t.props)if(Array.isArray(a)||(a=a(i)),a){if(a[0].perNode)throw new RangeError("Can't store a per-node prop on a node type");r[a[0].id]=a[1]}}return i}prop(t){return this.props[t.id]}get isTop(){return(this.flags&1)>0}get isSkipped(){return(this.flags&2)>0}get isError(){return(this.flags&4)>0}get isAnonymous(){return(this.flags&8)>0}is(t){if(typeof t=="string"){if(this.name==t)return!0;let r=this.prop(Pi.group);return r?r.indexOf(t)>-1:!1}return this.id==t}static match(t){let r=Object.create(null);for(let n in t)for(let i of n.split(" "))r[i]=t[n];return n=>{for(let i=n.prop(Pi.group),a=-1;a<(i?i.length:0);a++){let o=r[a<0?n.name:i[a]];if(o)return o}}}};$c.none=new $c("",Object.create(null),0,8);var D2=class{constructor(t){this.types=t;for(let r=0;r=i&&(o.type.isAnonymous||r(o)!==!1)){if(o.firstChild())continue;s=!0}for(;s&&n&&!o.type.isAnonymous&&n(o),!o.nextSibling();){if(!o.parent())return;s=!0}}}prop(t){return t.perNode?this.props?this.props[t.id]:void 0:this.type.prop(t)}get propValues(){let t=[];if(this.props)for(let r in this.props)t.push([+r,this.props[r]]);return t}balance(t={}){return this.children.length<=8?this:qY($c.none,this.children,this.positions,0,this.children.length,0,this.length,(r,n,i)=>new Pl(this.type,r,n,i,this.propValues),t.makeTree||((r,n,i)=>new Pl($c.none,r,n,i)))}static build(t){return uJe(t)}};Pl.empty=new Pl($c.none,[],[],0);var AD=class{constructor(t,r){this.buffer=t,this.index=r}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}get pos(){return this.index}next(){this.index-=4}fork(){return new AD(this.buffer,this.index)}},fg=class{constructor(t,r,n){this.buffer=t,this.length=r,this.set=n}get type(){return $c.none}toString(){let t=[];for(let r=0;r0));l=o[l+3]);return s}slice(t,r,n,i){let a=this.buffer,o=new Uint16Array(r-t);for(let s=t,l=0;s=t&&rt;case 1:return r<=t&&n>t;case 2:return n>t;case 4:return!0}}function QEe(e,t){let r=e.childBefore(t);for(;r;){let n=r.lastChild;if(!n||n.to!=r.to)break;n.type.isError&&n.from==n.to?(e=r,r=n.prevSibling):r=n}return e}function O2(e,t,r,n){for(var i;e.from==e.to||(r<1?e.from>=t:e.from>t)||(r>-1?e.to<=t:e.to0?s.length:-1;t!=u;t+=r){let c=s[t],f=l[t]+o.from;if(!!GEe(i,n,f,f+c.length)){if(c instanceof fg){if(a&_l.ExcludeBuffers)continue;let d=c.findChild(0,c.buffer.length,r,n-f,i);if(d>-1)return new wh(new BY(o,c,t,f),null,d)}else if(a&_l.IncludeAnonymous||!c.type.isAnonymous||$Y(c)){let d;if(!(a&_l.IgnoreMounts)&&c.props&&(d=c.prop(Pi.mounted))&&!d.overlay)return new am(d.tree,f,t,o);let p=new am(c,f,t,o);return a&_l.IncludeAnonymous||!p.type.isAnonymous?p:p.nextChild(r<0?c.children.length-1:0,r,n,i)}}}if(a&_l.IncludeAnonymous||!o.type.isAnonymous||(o.index>=0?t=o.index+r:t=r<0?-1:o._parent._tree.children.length,o=o._parent,!o))return null}}get firstChild(){return this.nextChild(0,1,0,4)}get lastChild(){return this.nextChild(this._tree.children.length-1,-1,0,4)}childAfter(t){return this.nextChild(0,1,t,2)}childBefore(t){return this.nextChild(this._tree.children.length-1,-1,t,-2)}enter(t,r,n=0){let i;if(!(n&_l.IgnoreOverlays)&&(i=this._tree.prop(Pi.mounted))&&i.overlay){let a=t-this.from;for(let{from:o,to:s}of i.overlay)if((r>0?o<=a:o=a:s>a))return new am(i.tree,i.overlay[0].from+this.from,-1,this)}return this.nextChild(0,1,t,r,n)}nextSignificantParent(){let t=this;for(;t.type.isAnonymous&&t._parent;)t=t._parent;return t}get parent(){return this._parent?this._parent.nextSignificantParent():null}get nextSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index+1,1,0,4):null}get prevSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index-1,-1,0,4):null}cursor(t=0){return new M2(this,t)}get tree(){return this._tree}toTree(){return this._tree}resolve(t,r=0){return O2(this,t,r,!1)}resolveInner(t,r=0){return O2(this,t,r,!0)}enterUnfinishedNodesBefore(t){return QEe(this,t)}getChild(t,r=null,n=null){let i=L9(this,t,r,n);return i.length?i[0]:null}getChildren(t,r=null,n=null){return L9(this,t,r,n)}toString(){return this._tree.toString()}get node(){return this}matchContext(t){return z9(this,t)}};function L9(e,t,r,n){let i=e.cursor(),a=[];if(!i.firstChild())return a;if(r!=null){for(;!i.type.is(r);)if(!i.nextSibling())return a}for(;;){if(n!=null&&i.type.is(n))return a;if(i.type.is(t)&&a.push(i.node),!i.nextSibling())return n==null?a:[]}}function z9(e,t,r=t.length-1){for(let n=e.parent;r>=0;n=n.parent){if(!n)return!1;if(!n.type.isAnonymous){if(t[r]&&t[r]!=n.name)return!1;r--}}return!0}var BY=class{constructor(t,r,n,i){this.parent=t,this.buffer=r,this.index=n,this.start=i}},wh=class{constructor(t,r,n){this.context=t,this._parent=r,this.index=n,this.type=t.buffer.set.types[t.buffer.buffer[n]]}get name(){return this.type.name}get from(){return this.context.start+this.context.buffer.buffer[this.index+1]}get to(){return this.context.start+this.context.buffer.buffer[this.index+2]}child(t,r,n){let{buffer:i}=this.context,a=i.findChild(this.index+4,i.buffer[this.index+3],t,r-this.context.start,n);return a<0?null:new wh(this.context,this,a)}get firstChild(){return this.child(1,0,4)}get lastChild(){return this.child(-1,0,4)}childAfter(t){return this.child(1,t,2)}childBefore(t){return this.child(-1,t,-2)}enter(t,r,n=0){if(n&_l.ExcludeBuffers)return null;let{buffer:i}=this.context,a=i.findChild(this.index+4,i.buffer[this.index+3],r>0?1:-1,t-this.context.start,r);return a<0?null:new wh(this.context,this,a)}get parent(){return this._parent||this.context.parent.nextSignificantParent()}externalSibling(t){return this._parent?null:this.context.parent.nextChild(this.context.index+t,t,0,4)}get nextSibling(){let{buffer:t}=this.context,r=t.buffer[this.index+3];return r<(this._parent?t.buffer[this._parent.index+3]:t.buffer.length)?new wh(this.context,this._parent,r):this.externalSibling(1)}get prevSibling(){let{buffer:t}=this.context,r=this._parent?this._parent.index+4:0;return this.index==r?this.externalSibling(-1):new wh(this.context,this._parent,t.findChild(r,this.index,-1,0,4))}cursor(t=0){return new M2(this,t)}get tree(){return null}toTree(){let t=[],r=[],{buffer:n}=this.context,i=this.index+4,a=n.buffer[this.index+3];if(a>i){let o=n.buffer[this.index+1],s=n.buffer[this.index+2];t.push(n.slice(i,a,o,s)),r.push(0)}return new Pl(this.type,t,r,this.to-this.from)}resolve(t,r=0){return O2(this,t,r,!1)}resolveInner(t,r=0){return O2(this,t,r,!0)}enterUnfinishedNodesBefore(t){return QEe(this,t)}toString(){return this.context.buffer.childString(this.index)}getChild(t,r=null,n=null){let i=L9(this,t,r,n);return i.length?i[0]:null}getChildren(t,r=null,n=null){return L9(this,t,r,n)}get node(){return this}matchContext(t){return z9(this,t)}},M2=class{constructor(t,r=0){if(this.mode=r,this.buffer=null,this.stack=[],this.index=0,this.bufferNode=null,t instanceof am)this.yieldNode(t);else{this._tree=t.context.parent,this.buffer=t.context;for(let n=t._parent;n;n=n._parent)this.stack.unshift(n.index);this.bufferNode=t,this.yieldBuf(t.index)}}get name(){return this.type.name}yieldNode(t){return t?(this._tree=t,this.type=t.type,this.from=t.from,this.to=t.to,!0):!1}yieldBuf(t,r){this.index=t;let{start:n,buffer:i}=this.buffer;return this.type=r||i.set.types[i.buffer[t]],this.from=n+i.buffer[t+1],this.to=n+i.buffer[t+2],!0}yield(t){return t?t instanceof am?(this.buffer=null,this.yieldNode(t)):(this.buffer=t.context,this.yieldBuf(t.index,t.type)):!1}toString(){return this.buffer?this.buffer.buffer.childString(this.index):this._tree.toString()}enterChild(t,r,n){if(!this.buffer)return this.yield(this._tree.nextChild(t<0?this._tree._tree.children.length-1:0,t,r,n,this.mode));let{buffer:i}=this.buffer,a=i.findChild(this.index+4,i.buffer[this.index+3],t,r-this.buffer.start,n);return a<0?!1:(this.stack.push(this.index),this.yieldBuf(a))}firstChild(){return this.enterChild(1,0,4)}lastChild(){return this.enterChild(-1,0,4)}childAfter(t){return this.enterChild(1,t,2)}childBefore(t){return this.enterChild(-1,t,-2)}enter(t,r,n=this.mode){return this.buffer?n&_l.ExcludeBuffers?!1:this.enterChild(1,t,r):this.yield(this._tree.enter(t,r,n))}parent(){if(!this.buffer)return this.yieldNode(this.mode&_l.IncludeAnonymous?this._tree._parent:this._tree.parent);if(this.stack.length)return this.yieldBuf(this.stack.pop());let t=this.mode&_l.IncludeAnonymous?this.buffer.parent:this.buffer.parent.nextSignificantParent();return this.buffer=null,this.yieldNode(t)}sibling(t){if(!this.buffer)return this._tree._parent?this.yield(this._tree.index<0?null:this._tree._parent.nextChild(this._tree.index+t,t,0,4,this.mode)):!1;let{buffer:r}=this.buffer,n=this.stack.length-1;if(t<0){let i=n<0?0:this.stack[n]+4;if(this.index!=i)return this.yieldBuf(r.findChild(i,this.index,-1,0,4))}else{let i=r.buffer[this.index+3];if(i<(n<0?r.buffer.length:r.buffer[this.stack[n]+3]))return this.yieldBuf(i)}return n<0?this.yield(this.buffer.parent.nextChild(this.buffer.index+t,t,0,4,this.mode)):!1}nextSibling(){return this.sibling(1)}prevSibling(){return this.sibling(-1)}atLastNode(t){let r,n,{buffer:i}=this;if(i){if(t>0){if(this.index-1)for(let a=r+t,o=t<0?-1:n._tree.children.length;a!=o;a+=t){let s=n._tree.children[a];if(this.mode&_l.IncludeAnonymous||s instanceof fg||!s.type.isAnonymous||$Y(s))return!1}return!0}move(t,r){if(r&&this.enterChild(t,0,4))return!0;for(;;){if(this.sibling(t))return!0;if(this.atLastNode(t)||!this.parent())return!1}}next(t=!0){return this.move(1,t)}prev(t=!0){return this.move(-1,t)}moveTo(t,r=0){for(;(this.from==this.to||(r<1?this.from>=t:this.from>t)||(r>-1?this.to<=t:this.to=0;){for(let o=t;o;o=o._parent)if(o.index==i){if(i==this.index)return o;r=o,n=a+1;break e}i=this.stack[--a]}}for(let i=n;i=0;a--){if(a<0)return z9(this.node,t,i);let o=n[r.buffer[this.stack[a]]];if(!o.isAnonymous){if(t[i]&&t[i]!=o.name)return!1;i--}}return!0}};function $Y(e){return e.children.some(t=>t instanceof fg||!t.type.isAnonymous||$Y(t))}function uJe(e){var t;let{buffer:r,nodeSet:n,maxBufferLength:i=1024,reused:a=[],minRepeatType:o=n.types.length}=e,s=Array.isArray(r)?new AD(r,r.length):r,l=n.types,u=0,c=0;function f(x,w,S,k,j){let{id:O,start:C,end:N,size:D}=s,P=c;for(;D<0;)if(s.next(),D==-1){let L=a[O];S.push(L),k.push(C-x);return}else if(D==-3){u=O;return}else if(D==-4){c=O;return}else throw new RangeError(`Unrecognized record size: ${D}`);let q=l[O],z,I,T=C-x;if(N-C<=i&&(I=m(s.pos-w,j))){let L=new Uint16Array(I.size-I.skip),_=s.pos-I.size,Y=L.length;for(;s.pos>_;)Y=g(I.start,L,Y);z=new fg(L,N-I.start,n),T=I.start-x}else{let L=s.pos-D;s.next();let _=[],Y=[],oe=O>=o?O:-1,te=0,Q=N;for(;s.pos>L;)oe>=0&&s.id==oe&&s.size>=0?(s.end<=Q-i&&(p(_,Y,C,te,s.end,Q,oe,P),te=_.length,Q=s.end),s.next()):f(C,L,_,Y,oe);if(oe>=0&&te>0&&te<_.length&&p(_,Y,C,te,C,Q,oe,P),_.reverse(),Y.reverse(),oe>-1&&te>0){let fe=d(q);z=qY(q,_,Y,0,_.length,0,N-C,fe,fe)}else z=h(q,_,Y,N-C,P-N)}S.push(z),k.push(T)}function d(x){return(w,S,k)=>{let j=0,O=w.length-1,C,N;if(O>=0&&(C=w[O])instanceof Pl){if(!O&&C.type==x&&C.length==k)return C;(N=C.prop(Pi.lookAhead))&&(j=S[O]+C.length+N)}return h(x,w,S,k,j)}}function p(x,w,S,k,j,O,C,N){let D=[],P=[];for(;x.length>k;)D.push(x.pop()),P.push(w.pop()+S-j);x.push(h(n.types[C],D,P,O-j,N-O)),w.push(j-S)}function h(x,w,S,k,j=0,O){if(u){let C=[Pi.contextHash,u];O=O?[C].concat(O):[C]}if(j>25){let C=[Pi.lookAhead,j];O=O?[C].concat(O):[C]}return new Pl(x,w,S,k,O)}function m(x,w){let S=s.fork(),k=0,j=0,O=0,C=S.end-i,N={size:0,start:0,skip:0};e:for(let D=S.pos-x;S.pos>D;){let P=S.size;if(S.id==w&&P>=0){N.size=k,N.start=j,N.skip=O,O+=4,k+=4,S.next();continue}let q=S.pos-P;if(P<0||q=o?4:0,I=S.start;for(S.next();S.pos>q;){if(S.size<0)if(S.size==-3)z+=4;else break e;else S.id>=o&&(z+=4);S.next()}j=I,k+=P,O+=z}return(w<0||k==x)&&(N.size=k,N.start=j,N.skip=O),N.size>4?N:void 0}function g(x,w,S){let{id:k,start:j,end:O,size:C}=s;if(s.next(),C>=0&&k4){let D=s.pos-(C-4);for(;s.pos>D;)S=g(x,w,S)}w[--S]=N,w[--S]=O-x,w[--S]=j-x,w[--S]=k}else C==-3?u=k:C==-4&&(c=k);return S}let A=[],b=[];for(;s.pos>0;)f(e.start||0,e.bufferStart||0,A,b,-1);let v=(t=e.length)!==null&&t!==void 0?t:A.length?b[0]+A[0].length:0;return new Pl(l[e.topID],A.reverse(),b.reverse(),v)}var VEe=new WeakMap;function q9(e,t){if(!e.isAnonymous||t instanceof fg||t.type!=e)return 1;let r=VEe.get(t);if(r==null){r=1;for(let n of t.children){if(n.type!=e||!(n instanceof Pl)){r=1;break}r+=q9(e,n)}VEe.set(t,r)}return r}function qY(e,t,r,n,i,a,o,s,l){let u=0;for(let h=n;h=c)break;S+=k}if(v==x+1){if(S>c){let k=h[x];p(k.children,k.positions,0,k.children.length,m[x]+b);continue}f.push(h[x])}else{let k=m[v-1]+h[v-1].length-w;f.push(qY(e,h,m,x,v,w,k,null,l))}d.push(w+b-a)}}return p(t,r,n,i,0),(s||l)(f,d,o)}var U9=class{startParse(t,r,n){return typeof t=="string"&&(t=new RY(t)),n=n?n.length?n.map(i=>new hD(i.from,i.to)):[new hD(0,0)]:[new hD(0,t.length)],this.createParse(t,r||[],n)}parse(t,r,n){let i=this.startParse(t,r,n);for(;;){let a=i.advance();if(a)return a}}},RY=class{constructor(t){this.string=t}get length(){return this.string.length}chunk(t){return this.string.slice(t)}get lineChunks(){return!1}read(t,r){return this.string.slice(t,r)}};var ymr=new Pi({perNode:!0});var T2=class{constructor(t,r,n,i,a,o,s,l,u,c=0,f){this.p=t,this.stack=r,this.state=n,this.reducePos=i,this.pos=a,this.score=o,this.buffer=s,this.bufferBase=l,this.curContext=u,this.lookAhead=c,this.parent=f}toString(){return`[${this.stack.filter((t,r)=>r%3==0).concat(this.state)}]@${this.pos}${this.score?"!"+this.score:""}`}static start(t,r,n=0){let i=t.parser.context;return new T2(t,[],r,n,n,0,[],0,i?new H9(i,i.start):null,0,null)}get context(){return this.curContext?this.curContext.context:null}pushState(t,r){this.stack.push(this.state,r,this.bufferBase+this.buffer.length),this.state=t}reduce(t){let r=t>>19,n=t&65535,{parser:i}=this.p,a=i.dynamicPrecedence(n);if(a&&(this.score+=a),r==0){this.pushState(i.getGoto(this.state,n,!0),this.reducePos),no;)this.stack.pop();this.reduceContext(n,s)}storeNode(t,r,n,i=4,a=!1){if(t==0&&(!this.stack.length||this.stack[this.stack.length-1]0&&o.buffer[s-4]==0&&o.buffer[s-1]>-1){if(r==n)return;if(o.buffer[s-2]>=r){o.buffer[s-2]=n;return}}}if(!a||this.pos==n)this.buffer.push(t,r,n,i);else{let o=this.buffer.length;if(o>0&&this.buffer[o-4]!=0)for(;o>0&&this.buffer[o-2]>n;)this.buffer[o]=this.buffer[o-4],this.buffer[o+1]=this.buffer[o-3],this.buffer[o+2]=this.buffer[o-2],this.buffer[o+3]=this.buffer[o-1],o-=4,i>4&&(i-=4);this.buffer[o]=t,this.buffer[o+1]=r,this.buffer[o+2]=n,this.buffer[o+3]=i}}shift(t,r,n){let i=this.pos;if(t&131072)this.pushState(t&65535,this.pos);else if((t&262144)==0){let a=t,{parser:o}=this.p;(n>this.pos||r<=o.maxNode)&&(this.pos=n,o.stateFlag(a,1)||(this.reducePos=n)),this.pushState(a,i),this.shiftContext(r,i),r<=o.maxNode&&this.buffer.push(r,i,n,4)}else this.pos=n,this.shiftContext(r,i),r<=this.p.parser.maxNode&&this.buffer.push(r,i,n,4)}apply(t,r,n){t&65536?this.reduce(t):this.shift(t,r,n)}useNode(t,r){let n=this.p.reused.length-1;(n<0||this.p.reused[n]!=t)&&(this.p.reused.push(t),n++);let i=this.pos;this.reducePos=this.pos=i+t.length,this.pushState(r,i),this.buffer.push(n,i,this.reducePos,-1),this.curContext&&this.updateContext(this.curContext.tracker.reuse(this.curContext.context,t,this,this.p.stream.reset(this.pos-t.length)))}split(){let t=this,r=t.buffer.length;for(;r>0&&t.buffer[r-2]>t.reducePos;)r-=4;let n=t.buffer.slice(r),i=t.bufferBase+r;for(;t&&i==t.bufferBase;)t=t.parent;return new T2(this.p,this.stack.slice(),this.state,this.reducePos,this.pos,this.score,n,i,this.curContext,this.lookAhead,t)}recoverByDelete(t,r){let n=t<=this.p.parser.maxNode;n&&this.storeNode(t,this.pos,r,4),this.storeNode(0,this.pos,r,n?8:4),this.pos=this.reducePos=r,this.score-=190}canShift(t){for(let r=new UY(this);;){let n=this.p.parser.stateSlot(r.state,4)||this.p.parser.hasAction(r.state,t);if((n&65536)==0)return!0;if(n==0)return!1;r.reduce(n)}}recoverByInsert(t){if(this.stack.length>=300)return[];let r=this.p.parser.nextStates(this.state);if(r.length>4<<1||this.stack.length>=120){let i=[];for(let a=0,o;al&1&&s==o)||i.push(r[a],o)}r=i}let n=[];for(let i=0;i>19,i=t&65535,a=this.stack.length-n*3;if(a<0||r.getGoto(this.stack[a],i,!1)<0)return!1;this.storeNode(0,this.reducePos,this.reducePos,4,!0),this.score-=100}return this.reducePos=this.pos,this.reduce(t),!0}forceAll(){for(;!this.p.parser.stateFlag(this.state,2);)if(!this.forceReduce()){this.storeNode(0,this.pos,this.pos,4,!0);break}return this}get deadEnd(){if(this.stack.length!=3)return!1;let{parser:t}=this.p;return t.data[t.stateSlot(this.state,1)]==65535&&!t.stateSlot(this.state,4)}restart(){this.state=this.stack[0],this.stack.length=0}sameState(t){if(this.state!=t.state||this.stack.length!=t.stack.length)return!1;for(let r=0;rthis.lookAhead&&(this.emitLookAhead(),this.lookAhead=t)}close(){this.curContext&&this.curContext.tracker.strict&&this.emitContext(),this.lookAhead>0&&this.emitLookAhead()}},H9=class{constructor(t,r){this.tracker=t,this.context=r,this.hash=t.strict?t.hash(r):0}},YEe;(function(e){e[e.Insert=200]="Insert",e[e.Delete=190]="Delete",e[e.Reduce=100]="Reduce",e[e.MaxNext=4]="MaxNext",e[e.MaxInsertStackDepth=300]="MaxInsertStackDepth",e[e.DampenInsertStackDepth=120]="DampenInsertStackDepth"})(YEe||(YEe={}));var UY=class{constructor(t){this.start=t,this.state=t.state,this.stack=t.stack,this.base=this.stack.length}reduce(t){let r=t&65535,n=t>>19;n==0?(this.stack==this.start.stack&&(this.stack=this.stack.slice()),this.stack.push(this.state,0,0),this.base+=3):this.base-=(n-1)*3;let i=this.start.p.parser.getGoto(this.stack[this.base-3],r,!0);this.state=i}},F2=class{constructor(t,r,n){this.stack=t,this.pos=r,this.index=n,this.buffer=t.buffer,this.index==0&&this.maybeNext()}static create(t,r=t.bufferBase+t.buffer.length){return new F2(t,r,r-t.bufferBase)}maybeNext(){let t=this.stack.parent;t!=null&&(this.index=this.stack.bufferBase-t.bufferBase,this.stack=t,this.buffer=t.buffer)}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}next(){this.index-=4,this.pos-=4,this.index==0&&this.maybeNext()}fork(){return new F2(this.stack,this.pos,this.index)}},j2=class{constructor(){this.start=-1,this.value=-1,this.end=-1,this.extended=-1,this.lookAhead=0,this.mask=0,this.context=0}},ZEe=new j2,WY=class{constructor(t,r){this.input=t,this.ranges=r,this.chunk="",this.chunkOff=0,this.chunk2="",this.chunk2Pos=0,this.next=-1,this.token=ZEe,this.rangeIndex=0,this.pos=this.chunkPos=r[0].from,this.range=r[0],this.end=r[r.length-1].to,this.readNext()}resolveOffset(t,r){let n=this.range,i=this.rangeIndex,a=this.pos+t;for(;an.to:a>=n.to;){if(i==this.ranges.length-1)return null;let o=this.ranges[++i];a+=o.from-n.to,n=o}return a}peek(t){let r=this.chunkOff+t,n,i;if(r>=0&&r=this.chunk2Pos&&ns.to&&(this.chunk2=this.chunk2.slice(0,s.to-n)),i=this.chunk2.charCodeAt(0)}}return n>=this.token.lookAhead&&(this.token.lookAhead=n+1),i}acceptToken(t,r=0){let n=r?this.resolveOffset(r,-1):this.pos;if(n==null||n=this.chunk2Pos&&this.posthis.range.to?t.slice(0,this.range.to-this.pos):t,this.chunkPos=this.pos,this.chunkOff=0}}readNext(){return this.chunkOff>=this.chunk.length&&(this.getChunk(),this.chunkOff==this.chunk.length)?this.next=-1:this.next=this.chunk.charCodeAt(this.chunkOff)}advance(t=1){for(this.chunkOff+=t;this.pos+t>=this.range.to;){if(this.rangeIndex==this.ranges.length-1)return this.setDone();t-=this.range.to-this.pos,this.range=this.ranges[++this.rangeIndex],this.pos=this.range.from}return this.pos+=t,this.pos>=this.token.lookAhead&&(this.token.lookAhead=this.pos+1),this.readNext()}setDone(){return this.pos=this.chunkPos=this.end,this.range=this.ranges[this.rangeIndex=this.ranges.length-1],this.chunk="",this.next=-1}reset(t,r){if(r?(this.token=r,r.start=t,r.lookAhead=t+1,r.value=r.extended=-1):this.token=ZEe,this.pos!=t){if(this.pos=t,t==this.end)return this.setDone(),this;for(;t=this.range.to;)this.range=this.ranges[++this.rangeIndex];t>=this.chunkPos&&t=this.chunkPos&&r<=this.chunkPos+this.chunk.length)return this.chunk.slice(t-this.chunkPos,r-this.chunkPos);if(t>=this.chunk2Pos&&r<=this.chunk2Pos+this.chunk2.length)return this.chunk2.slice(t-this.chunk2Pos,r-this.chunk2Pos);if(t>=this.range.from&&r<=this.range.to)return this.input.read(t,r);let n="";for(let i of this.ranges){if(i.from>=r)break;i.to>t&&(n+=this.input.read(Math.max(i.from,t),Math.min(i.to,r)))}return n}},N2=class{constructor(t,r){this.data=t,this.id=r}token(t,r){fJe(this.data,t,r,this.id)}};N2.prototype.contextual=N2.prototype.fallback=N2.prototype.extend=!1;var ab=class{constructor(t,r={}){this.token=t,this.contextual=!!r.contextual,this.fallback=!!r.fallback,this.extend=!!r.extend}};function fJe(e,t,r,n){let i=0,a=1<0){let c=e[u];if(s.allows(c)&&(t.token.value==-1||t.token.value==c||o.overrides(c,t.token.value))){t.acceptToken(c);break}}for(let u=t.next,c=0,f=e[i+2];c>1,p=l+d+(d<<1),h=e[p],m=e[p+1];if(u=m)c=d+1;else{i=e[p+2],t.advance();continue e}}break}}function W9(e,t=Uint16Array){if(typeof e!="string")return e;let r=null;for(let n=0,i=0;n=92&&o--,o>=34&&o--;let l=o-32;if(l>=46&&(l-=46,s=!0),a+=l,s)break;a*=46}r?r[i++]=a:r=new t(a)}return r}var om=typeof process<"u"&&process.env&&/\bparse\b/.test(process.env.LOG),LY=null,XEe;(function(e){e[e.Margin=25]="Margin"})(XEe||(XEe={}));function KEe(e,t,r){let n=e.cursor(_l.IncludeAnonymous);for(n.moveTo(t);;)if(!(r<0?n.childBefore(t):n.childAfter(t)))for(;;){if((r<0?n.tot)&&!n.type.isError)return r<0?Math.max(0,Math.min(n.to-1,t-25)):Math.min(e.length,Math.max(n.from+1,t+25));if(r<0?n.prevSibling():n.nextSibling())break;if(!n.parent())return r<0?0:e.length}}var HY=class{constructor(t,r){this.fragments=t,this.nodeSet=r,this.i=0,this.fragment=null,this.safeFrom=-1,this.safeTo=-1,this.trees=[],this.start=[],this.index=[],this.nextFragment()}nextFragment(){let t=this.fragment=this.i==this.fragments.length?null:this.fragments[this.i++];if(t){for(this.safeFrom=t.openStart?KEe(t.tree,t.from+t.offset,1)-t.offset:t.from,this.safeTo=t.openEnd?KEe(t.tree,t.to+t.offset,-1)-t.offset:t.to;this.trees.length;)this.trees.pop(),this.start.pop(),this.index.pop();this.trees.push(t.tree),this.start.push(-t.offset),this.index.push(0),this.nextStart=this.safeFrom}else this.nextStart=1e9}nodeAt(t){if(tt)return this.nextStart=o,null;if(a instanceof Pl){if(o==t){if(o=Math.max(this.safeFrom,t)&&(this.trees.push(a),this.start.push(o),this.index.push(0))}else this.index[r]++,this.nextStart=o+a.length}}},VY=class{constructor(t,r){this.stream=r,this.tokens=[],this.mainToken=null,this.actions=[],this.tokens=t.tokenizers.map(n=>new j2)}getActions(t){let r=0,n=null,{parser:i}=t.p,{tokenizers:a}=i,o=i.stateSlot(t.state,3),s=t.curContext?t.curContext.hash:0,l=0;for(let u=0;uf.end+25&&(l=Math.max(f.lookAhead,l)),f.value!=0)){let d=r;if(f.extended>-1&&(r=this.addActions(t,f.extended,f.end,r)),r=this.addActions(t,f.value,f.end,r),!c.extend&&(n=f,r>d))break}}for(;this.actions.length>r;)this.actions.pop();return l&&t.setLookAhead(l),!n&&t.pos==this.stream.end&&(n=new j2,n.value=t.p.parser.eofTerm,n.start=n.end=t.pos,r=this.addActions(t,n.value,n.end,r)),this.mainToken=n,this.actions}getMainToken(t){if(this.mainToken)return this.mainToken;let r=new j2,{pos:n,p:i}=t;return r.start=n,r.end=Math.min(n+1,i.stream.end),r.value=n==i.stream.end?i.parser.eofTerm:0,r}updateCachedToken(t,r,n){if(r.token(this.stream.reset(n.pos,t),n),t.value>-1){let{parser:i}=n.p;for(let a=0;a=0&&n.p.parser.dialect.allows(o>>1)){(o&1)==0?t.value=o>>1:t.extended=o>>1;break}}}else t.value=0,t.end=Math.min(n.p.stream.end,n.pos+1)}putAction(t,r,n,i){for(let a=0;at.bufferLength*4?new HY(n,t.nodeSet):null}get parsedPos(){return this.minStackPos}advance(){let t=this.stacks,r=this.minStackPos,n=this.stacks=[],i,a;for(let o=0;or)n.push(s);else{if(this.advanceStack(s,n,t))continue;{i||(i=[],a=[]),i.push(s);let l=this.tokens.getMainToken(s);a.push(l.value,l.end)}}break}}if(!n.length){let o=i&&dJe(i);if(o)return this.stackToTree(o);if(this.parser.strict)throw om&&i&&console.log("Stuck with token "+(this.tokens.mainToken?this.parser.getName(this.tokens.mainToken.value):"none")),new SyntaxError("No parse at "+r);this.recovering||(this.recovering=5)}if(this.recovering&&i){let o=this.stoppedAt!=null&&i[0].pos>this.stoppedAt?i[0]:this.runRecovery(i,a,n);if(o)return this.stackToTree(o.forceAll())}if(this.recovering){let o=this.recovering==1?1:this.recovering*3;if(n.length>o)for(n.sort((s,l)=>l.score-s.score);n.length>o;)n.pop();n.some(s=>s.reducePos>r)&&this.recovering--}else if(n.length>1){e:for(let o=0;o500&&u.buffer.length>500)if((s.score-u.score||s.buffer.length-u.buffer.length)>0)n.splice(l--,1);else{n.splice(o--,1);continue e}}}}this.minStackPos=n[0].pos;for(let o=1;o ":"";if(this.stoppedAt!=null&&i>this.stoppedAt)return t.forceReduce()?t:null;if(this.fragments){let u=t.curContext&&t.curContext.tracker.strict,c=u?t.curContext.hash:0;for(let f=this.fragments.nodeAt(i);f;){let d=this.parser.nodeSet.types[f.type.id]==f.type?a.getGoto(t.state,f.type.id):-1;if(d>-1&&f.length&&(!u||(f.prop(Pi.contextHash)||0)==c))return t.useNode(f,d),om&&console.log(o+this.stackID(t)+` (via reuse of ${a.getName(f.type.id)})`),!0;if(!(f instanceof Pl)||f.children.length==0||f.positions[0]>0)break;let p=f.children[0];if(p instanceof Pl&&f.positions[0]==0)f=p;else break}}let s=a.stateSlot(t.state,4);if(s>0)return t.reduce(s),om&&console.log(o+this.stackID(t)+` (via always-reduce ${a.getName(s&65535)})`),!0;if(t.stack.length>=15e3)for(;t.stack.length>9e3&&t.forceReduce(););let l=this.tokens.getActions(t);for(let u=0;ui?r.push(h):n.push(h)}return!1}advanceFully(t,r){let n=t.pos;for(;;){if(!this.advanceStack(t,null,null))return!1;if(t.pos>n)return eke(t,r),!0}}runRecovery(t,r,n){let i=null,a=!1;for(let o=0;o ":"";if(s.deadEnd&&(a||(a=!0,s.restart(),om&&console.log(c+this.stackID(s)+" (restarted)"),this.advanceFully(s,n))))continue;let f=s.split(),d=c;for(let p=0;f.forceReduce()&&p<10&&(om&&console.log(d+this.stackID(f)+" (via force-reduce)"),!this.advanceFully(f,n));p++)om&&(d=this.stackID(f)+" -> ");for(let p of s.recoverByInsert(l))om&&console.log(c+this.stackID(p)+" (via recover-insert)"),this.advanceFully(p,n);this.stream.end>s.pos?(u==s.pos&&(u++,l=0),s.recoverByDelete(l,u),om&&console.log(c+this.stackID(s)+` (via recover-delete ${this.parser.getName(l)})`),eke(s,n)):(!i||i.scoree,V9=class{constructor(t){this.start=t.start,this.shift=t.shift||zY,this.reduce=t.reduce||zY,this.reuse=t.reuse||zY,this.hash=t.hash||(()=>0),this.strict=t.strict!==!1}},ob=class extends U9{constructor(t){if(super(),this.wrappers=[],t.version!=14)throw new RangeError(`Parser version (${t.version}) doesn't match runtime version (${14})`);let r=t.nodeNames.split(" ");this.minRepeatTerm=r.length;for(let s=0;st.topRules[s][1]),i=[];for(let s=0;s=0)a(c,l,s[u++]);else{let f=s[u+-c];for(let d=-c;d>0;d--)a(s[u++],l,f);u++}}}this.nodeSet=new D2(r.map((s,l)=>$c.define({name:l>=this.minRepeatTerm?void 0:s,id:l,props:i[l],top:n.indexOf(l)>-1,error:l==0,skipped:t.skippedNodes&&t.skippedNodes.indexOf(l)>-1}))),t.propSources&&(this.nodeSet=this.nodeSet.extend(...t.propSources)),this.strict=!1,this.bufferLength=1024;let o=W9(t.tokenData);if(this.context=t.context,this.specialized=new Uint16Array(t.specialized?t.specialized.length:0),this.specializers=[],t.specialized)for(let s=0;stypeof s=="number"?new N2(o,s):s),this.topRules=t.topRules,this.dialects=t.dialects||{},this.dynamicPrecedences=t.dynamicPrecedences||null,this.tokenPrecTable=t.tokenPrec,this.termNames=t.termNames||null,this.maxNode=this.nodeSet.types.length-1,this.dialect=this.parseDialect(),this.top=this.topRules[Object.keys(this.topRules)[0]]}createParse(t,r,n){let i=new GY(this,t,r,n);for(let a of this.wrappers)i=a(i,t,r,n);return i}getGoto(t,r,n=!1){let i=this.goto;if(r>=i[0])return-1;for(let a=i[r+1];;){let o=i[a++],s=o&1,l=i[a++];if(s&&n)return l;for(let u=a+(o>>1);a0}validAction(t,r){if(r==this.stateSlot(t,4))return!0;for(let n=this.stateSlot(t,1);;n+=3){if(this.data[n]==65535)if(this.data[n+1]==1)n=dg(this.data,n+2);else return!1;if(r==dg(this.data,n+1))return!0}}nextStates(t){let r=[];for(let n=this.stateSlot(t,1);;n+=3){if(this.data[n]==65535)if(this.data[n+1]==1)n=dg(this.data,n+2);else break;if((this.data[n+2]&1)==0){let i=this.data[n+1];r.some((a,o)=>o&1&&a==i)||r.push(this.data[n],i)}}return r}overrides(t,r){let n=tke(this.data,this.tokenPrecTable,r);return n<0||tke(this.data,this.tokenPrecTable,t){let i=t.tokenizers.find(a=>a.from==n);return i?i.to:n})),t.contextTracker&&(r.context=t.contextTracker),t.dialect&&(r.dialect=this.parseDialect(t.dialect)),t.strict!=null&&(r.strict=t.strict),t.wrap&&(r.wrappers=r.wrappers.concat(t.wrap)),t.bufferLength!=null&&(r.bufferLength=t.bufferLength),r}hasWrappers(){return this.wrappers.length>0}getName(t){return this.termNames?this.termNames[t]:String(t<=this.maxNode&&this.nodeSet.types[t].name||t)}get eofTerm(){return this.maxNode+1}get topNode(){return this.nodeSet.types[this.top[1]]}dynamicPrecedence(t){let r=this.dynamicPrecedences;return r==null?0:r[t]||0}parseDialect(t){let r=Object.keys(this.dialects),n=r.map(()=>!1);if(t)for(let a of t.split(" ")){let o=r.indexOf(a);o>=0&&(n[o]=!0)}let i=null;for(let a=0;an)&&r.p.parser.stateFlag(r.state,2)&&(!t||t.scorer.modified.indexOf(t)>-1?r:_2.get(r.base||r,r.modified.concat(t).sort((n,i)=>n.id-i.id))}},mJe=0,_2=class{constructor(){this.instances=[],this.id=mJe++}static get(t,r){if(!r.length)return t;let n=r[0].instances.find(s=>s.base==t&&hJe(r,s.modified));if(n)return n;let i=[],a=new Gd(i,t,r);for(let s of r)s.instances.push(a);let o=ike(r);for(let s of t.set)for(let l of o)i.push(_2.get(s,l));return a}};function hJe(e,t){return e.length==t.length&&e.every((r,n)=>r==t[n])}function ike(e){let t=[e];for(let r=0;r0&&f+3==i.length){o=1;break}let d=/^"(?:[^"\\]|\\.)*?"|[^\/!]+/.exec(s);if(!d)throw new RangeError("Invalid path: "+i);if(a.push(d[0]=="*"?"":d[0][0]=='"'?JSON.parse(d[0]):d[0]),f+=d[0].length,f==i.length)break;let p=i[f++];if(f==i.length&&p=="!"){o=0;break}if(p!="/")throw new RangeError("Invalid path: "+i);s=i.slice(f)}let l=a.length-1,u=a[l];if(!u)throw new RangeError("Invalid path: "+i);let c=new ZY(n,o,l>0?a.slice(0,l):null);t[u]=c.sort(t[u])}}return AJe.add(t)}var AJe=new Pi,ZY=class{constructor(t,r,n,i){this.tags=t,this.mode=r,this.context=n,this.next=i}sort(t){return!t||t.depth{let o=i;for(let s of a)for(let l of s.set){let u=r[l.id];if(u){o=o?o+" "+u:u;break}}return o},scope:n}}var Tt=Gd.define,G9=Tt(),_v=Tt(),rke=Tt(_v),nke=Tt(_v),Pv=Tt(),Q9=Tt(Pv),YY=Tt(Pv),kh=Tt(),sb=Tt(kh),Sh=Tt(),Eh=Tt(),XY=Tt(),gD=Tt(XY),Y9=Tt(),gt={comment:G9,lineComment:Tt(G9),blockComment:Tt(G9),docComment:Tt(G9),name:_v,variableName:Tt(_v),typeName:rke,tagName:Tt(rke),propertyName:nke,attributeName:Tt(nke),className:Tt(_v),labelName:Tt(_v),namespace:Tt(_v),macroName:Tt(_v),literal:Pv,string:Q9,docString:Tt(Q9),character:Tt(Q9),attributeValue:Tt(Q9),number:YY,integer:Tt(YY),float:Tt(YY),bool:Tt(Pv),regexp:Tt(Pv),escape:Tt(Pv),color:Tt(Pv),url:Tt(Pv),keyword:Sh,self:Tt(Sh),null:Tt(Sh),atom:Tt(Sh),unit:Tt(Sh),modifier:Tt(Sh),operatorKeyword:Tt(Sh),controlKeyword:Tt(Sh),definitionKeyword:Tt(Sh),moduleKeyword:Tt(Sh),operator:Eh,derefOperator:Tt(Eh),arithmeticOperator:Tt(Eh),logicOperator:Tt(Eh),bitwiseOperator:Tt(Eh),compareOperator:Tt(Eh),updateOperator:Tt(Eh),definitionOperator:Tt(Eh),typeOperator:Tt(Eh),controlOperator:Tt(Eh),punctuation:XY,separator:Tt(XY),bracket:gD,angleBracket:Tt(gD),squareBracket:Tt(gD),paren:Tt(gD),brace:Tt(gD),content:kh,heading:sb,heading1:Tt(sb),heading2:Tt(sb),heading3:Tt(sb),heading4:Tt(sb),heading5:Tt(sb),heading6:Tt(sb),contentSeparator:Tt(kh),list:Tt(kh),quote:Tt(kh),emphasis:Tt(kh),strong:Tt(kh),link:Tt(kh),monospace:Tt(kh),strikethrough:Tt(kh),inserted:Tt(),deleted:Tt(),changed:Tt(),invalid:Tt(),meta:Y9,documentMeta:Tt(Y9),annotation:Tt(Y9),processingInstruction:Tt(Y9),definition:Gd.defineModifier(),constant:Gd.defineModifier(),function:Gd.defineModifier(),standard:Gd.defineModifier(),local:Gd.defineModifier(),special:Gd.defineModifier()},Emr=gJe([{tag:gt.link,class:"tok-link"},{tag:gt.heading,class:"tok-heading"},{tag:gt.emphasis,class:"tok-emphasis"},{tag:gt.strong,class:"tok-strong"},{tag:gt.keyword,class:"tok-keyword"},{tag:gt.atom,class:"tok-atom"},{tag:gt.bool,class:"tok-bool"},{tag:gt.url,class:"tok-url"},{tag:gt.labelName,class:"tok-labelName"},{tag:gt.inserted,class:"tok-inserted"},{tag:gt.deleted,class:"tok-deleted"},{tag:gt.literal,class:"tok-literal"},{tag:gt.string,class:"tok-string"},{tag:gt.number,class:"tok-number"},{tag:[gt.regexp,gt.escape,gt.special(gt.string)],class:"tok-string2"},{tag:gt.variableName,class:"tok-variableName"},{tag:gt.local(gt.variableName),class:"tok-variableName tok-local"},{tag:gt.definition(gt.variableName),class:"tok-variableName tok-definition"},{tag:gt.special(gt.variableName),class:"tok-variableName2"},{tag:gt.definition(gt.propertyName),class:"tok-propertyName tok-definition"},{tag:gt.typeName,class:"tok-typeName"},{tag:gt.namespace,class:"tok-namespace"},{tag:gt.className,class:"tok-className"},{tag:gt.macroName,class:"tok-macroName"},{tag:gt.propertyName,class:"tok-propertyName"},{tag:gt.operator,class:"tok-operator"},{tag:gt.comment,class:"tok-comment"},{tag:gt.meta,class:"tok-meta"},{tag:gt.invalid,class:"tok-invalid"},{tag:gt.punctuation,class:"tok-punctuation"}]);var oke=281,ske=1,vJe=2,Z9=282,yJe=3,bJe=283,lke=284,xJe=4,wJe=286,SJe=287,EJe=5,kJe=6,CJe=1,DJe=[9,10,11,12,13,32,133,160,5760,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202,8232,8233,8239,8287,12288],cke=125,OJe=123,MJe=59,uke=47,jJe=42,NJe=43,TJe=45,FJe=36,_Je=96,PJe=92,IJe=new V9({start:!1,shift(e,t){return t==EJe||t==kJe||t==wJe?e:t==SJe},strict:!1}),BJe=new ab((e,t)=>{let{next:r}=e;(r==cke||r==-1||t.context)&&t.canShift(lke)&&e.acceptToken(lke)},{contextual:!0,fallback:!0}),RJe=new ab((e,t)=>{let{next:r}=e,n;DJe.indexOf(r)>-1||r==uke&&((n=e.peek(1))==uke||n==jJe)||r!=cke&&r!=MJe&&r!=-1&&!t.context&&t.canShift(oke)&&e.acceptToken(oke)},{contextual:!0}),$Je=new ab((e,t)=>{let{next:r}=e;if((r==NJe||r==TJe)&&(e.advance(),r==e.next)){e.advance();let n=!t.context&&t.canShift(ske);e.acceptToken(n?ske:vJe)}},{contextual:!0}),qJe=new ab(e=>{for(let t=!1,r=0;;r++){let{next:n}=e;if(n<0){r&&e.acceptToken(Z9);break}else if(n==_Je){r?e.acceptToken(Z9):e.acceptToken(bJe,1);break}else if(n==OJe&&t){r==1?e.acceptToken(yJe,1):e.acceptToken(Z9,-1);break}else if(n==10&&r){e.advance(),e.acceptToken(Z9);break}else n==PJe&&e.advance();t=n==FJe,e.advance()}});function LJe(e,t){return e=="extends"&&t.dialectEnabled(CJe)?xJe:-1}var zJe=ake({"get set async static":gt.modifier,"for while do if else switch try catch finally return throw break continue default case":gt.controlKeyword,"in of await yield void typeof delete instanceof":gt.operatorKeyword,"let var const function class extends":gt.definitionKeyword,"import export from":gt.moduleKeyword,"with debugger as new":gt.keyword,TemplateString:gt.special(gt.string),Super:gt.atom,BooleanLiteral:gt.bool,this:gt.self,null:gt.null,Star:gt.modifier,VariableName:gt.variableName,"CallExpression/VariableName TaggedTemplateExpression/VariableName":gt.function(gt.variableName),VariableDefinition:gt.definition(gt.variableName),Label:gt.labelName,PropertyName:gt.propertyName,PrivatePropertyName:gt.special(gt.propertyName),"CallExpression/MemberExpression/PropertyName":gt.function(gt.propertyName),"FunctionDeclaration/VariableDefinition":gt.function(gt.definition(gt.variableName)),"ClassDeclaration/VariableDefinition":gt.definition(gt.className),PropertyDefinition:gt.definition(gt.propertyName),PrivatePropertyDefinition:gt.definition(gt.special(gt.propertyName)),UpdateOp:gt.updateOperator,LineComment:gt.lineComment,BlockComment:gt.blockComment,Number:gt.number,String:gt.string,ArithOp:gt.arithmeticOperator,LogicOp:gt.logicOperator,BitOp:gt.bitwiseOperator,CompareOp:gt.compareOperator,RegExp:gt.regexp,Equals:gt.definitionOperator,"Arrow : Spread":gt.punctuation,"( )":gt.paren,"[ ]":gt.squareBracket,"{ }":gt.brace,"InterpolationStart InterpolationEnd":gt.special(gt.brace),".":gt.derefOperator,", ;":gt.separator,TypeName:gt.typeName,TypeDefinition:gt.definition(gt.typeName),"type enum interface implements namespace module declare":gt.definitionKeyword,"abstract global Privacy readonly override":gt.modifier,"is keyof unique infer":gt.operatorKeyword,JSXAttributeValue:gt.attributeValue,JSXText:gt.content,"JSXStartTag JSXStartCloseTag JSXSelfCloseEndTag JSXEndTag":gt.angleBracket,"JSXIdentifier JSXNameSpacedName":gt.tagName,"JSXAttribute/JSXIdentifier JSXAttribute/JSXNameSpacedName":gt.attributeName}),UJe={__proto__:null,export:18,as:23,from:29,default:32,async:37,function:38,this:48,true:56,false:56,void:66,typeof:70,null:86,super:88,new:122,await:139,yield:141,delete:142,class:152,extends:154,public:197,private:197,protected:197,readonly:199,instanceof:220,in:222,const:224,import:256,keyof:307,unique:311,infer:317,is:351,abstract:371,implements:373,type:375,let:378,var:380,interface:387,enum:391,namespace:397,module:399,declare:403,global:407,for:428,of:437,while:440,with:444,do:448,if:452,else:454,switch:458,case:464,try:470,catch:474,finally:478,return:482,throw:486,break:490,continue:494,debugger:498},WJe={__proto__:null,async:109,get:111,set:113,public:161,private:161,protected:161,static:163,abstract:165,override:167,readonly:173,new:355},HJe={__proto__:null,"<":129},fke=ob.deserialize({version:14,states:"$4|O`QYOOO'QQ$IfO'#ChO'XOSO'#DVO)dQYO'#D]O)tQYO'#DhO){QYO'#DrO-xQYO'#DxOOQO'#E]'#E]O.]QWO'#E[O.bQWO'#E[OOQ$IU'#Ef'#EfO0aQ$IfO'#ItO2wQ$IfO'#IuO3eQWO'#EzO3jQpO'#FaOOQ$IU'#FS'#FSO3rO!bO'#FSO4QQWO'#FhO5_QWO'#FgOOQ$IU'#Iu'#IuOOQ$IS'#It'#ItOOQQ'#J^'#J^O5dQWO'#HpO5iQ$I[O'#HqOOQQ'#Ih'#IhOOQQ'#Hr'#HrQ`QYOOO){QYO'#DjO5qQWO'#G[O5vQ#tO'#CmO6UQWO'#EZO6aQWO'#EgO6fQ#tO'#FRO7QQWO'#G[O7VQWO'#G`O7bQWO'#G`O7pQWO'#GcO7pQWO'#GdO7pQWO'#GfO5qQWO'#GiO8aQWO'#GlO9oQWO'#CdO:PQWO'#GyO:XQWO'#HPO:XQWO'#HRO`QYO'#HTO:XQWO'#HVO:XQWO'#HYO:^QWO'#H`O:cQ$I]O'#HfO){QYO'#HhO:nQ$I]O'#HjO:yQ$I]O'#HlO5iQ$I[O'#HnO){QYO'#DWOOOS'#Ht'#HtO;UOSO,59qOOQ$IU,59q,59qO=gQbO'#ChO=qQYO'#HuO>UQWO'#IvO@TQbO'#IvO'dQYO'#IvO@[QWO,59wO@rQ&jO'#DbOAkQWO'#E]OAxQWO'#JROBTQWO'#JQOBTQWO'#JQOB]QWO,5:yOBbQWO'#JPOBiQWO'#DyO5vQ#tO'#EZOBwQWO'#EZOCSQ`O'#FROOQ$IU,5:S,5:SOC[QYO,5:SOEYQ$IfO,5:^OEvQWO,5:dOFaQ$I[O'#JOO7VQWO'#I}OFhQWO'#I}OFpQWO,5:xOFuQWO'#I}OGTQYO,5:vOITQWO'#EWOJ_QWO,5:vOKnQWO'#DlOKuQYO'#DqOLPQ&jO,5;PO){QYO,5;POOQQ'#Er'#ErOOQQ'#Et'#EtO){QYO,5;RO){QYO,5;RO){QYO,5;RO){QYO,5;RO){QYO,5;RO){QYO,5;RO){QYO,5;RO){QYO,5;RO){QYO,5;RO){QYO,5;RO){QYO,5;ROOQQ'#Ex'#ExOLXQYO,5;cOOQ$IU,5;h,5;hOOQ$IU,5;i,5;iONXQWO,5;iOOQ$IU,5;j,5;jO){QYO'#IPON^Q$I[O,5[OOQQ'#Ik'#IkOOQQ,5>],5>]OOQQ-E;p-E;pO!+VQ$IfO,5:UOOQ$IS'#Cp'#CpO!+vQ#tO,5Q,5>QO){QYO,5>QO5iQ$I[O,5>SOOQQ,5>U,5>UO!8VQWO,5>UOOQQ,5>W,5>WO!8VQWO,5>WOOQQ,5>Y,5>YO!8[Q`O,59rOOOS-E;r-E;rOOQ$IU1G/]1G/]O!8aQbO,5>aO'dQYO,5>aOOQO,5>f,5>fO!8kQYO'#HuOOQO-E;s-E;sO!8xQWO,5?bO!9QQbO,5?bO!9XQWO,5?lOOQ$IU1G/c1G/cO!9aQpO'#DTOOQO'#Ix'#IxO){QYO'#IxO!:OQpO'#IxO!:mQpO'#DcO!;OQ&jO'#DcO!=ZQYO'#DcO!=bQWO'#IwO!=jQWO,59|O!=oQWO'#EaO!=}QWO'#JSO!>VQWO,5:zO!>mQ&jO'#DcO){QYO,5?mO!>wQWO'#HzOOQO-E;x-E;xO!9XQWO,5?lOOQ$IS1G0e1G0eO!@TQ&jO'#D|OOQ$IU,5:e,5:eO){QYO,5:eOITQWO,5:eO!@[QWO,5:eO:^QWO,5:uO!,rQpO,5:uO!,zQ#tO,5:uO5vQ#tO,5:uOOQ$IU1G/n1G/nOOQ$IU1G0O1G0OOOQ$IS'#EV'#EVO){QYO,5?jO!@gQ$I[O,5?jO!@xQ$I[O,5?jO!APQWO,5?iO!AXQWO'#H|O!APQWO,5?iOOQ$IS1G0d1G0dO7VQWO,5?iOOQ$IU1G0b1G0bO!AsQ$IfO1G0bO!BdQ$IdO,5:rOOQ$IU'#Fq'#FqO!CQQ$IfO'#IqOGTQYO1G0bO!EPQ#tO'#IyO!EZQWO,5:WO!E`QbO'#IzO){QYO'#IzO!EjQWO,5:]OOQ$IU'#DT'#DTOOQ$IU1G0k1G0kO!EoQWO1G0kO!HQQ$IfO1G0mO!HXQ$IfO1G0mO!JlQ$IfO1G0mO!JsQ$IfO1G0mO!LzQ$IfO1G0mO!M_Q$IfO1G0mO#!OQ$IfO1G0mO#!VQ$IfO1G0mO#$jQ$IfO1G0mO#$qQ$IfO1G0mO#&fQ$IfO1G0mO#)`Q7^O'#ChO#+ZQ7^O1G0}O#-UQ7^O'#IuOOQ$IU1G1T1G1TO#-iQ$IfO,5>kOOQ$IS-E;}-E;}O#.YQ$IfO1G0mOOQ$IU1G0m1G0mO#0[Q$IfO1G1QO#0{QpO,5;sO#1QQpO,5;tO#1VQpO'#F[O#1kQWO'#FZOOQO'#JW'#JWOOQO'#H}'#H}O#1pQpO1G1]OOQ$IU1G1]1G1]OOOO1G1f1G1fO#2OQ7^O'#ItO#2YQWO,5;}OLXQYO,5;}OOOO-E;|-E;|OOQ$IU1G1Y1G1YOOQ$IU,5WQWO1G2iOOQQ1G2j1G2jOITQWO1G2jO#>]QWO1G2jO#>eQ&jO'#GhOOQQ1G2l1G2lO!&tQ&jO'#IYO!0OQ`O1G2oOOQQ1G2o1G2oOOQQ,5=Y,5=YO#>mQ#tO,5=[O5qQWO,5=[O#5YQWO,5=_O5_QWO,5=_O!,rQpO,5=_O!,zQ#tO,5=_O5vQ#tO,5=_O#?OQWO'#JaO#?ZQWO,5=`OOQQ1G.j1G.jO#?`Q$I[O1G.jO#?kQWO1G.jO#?pQWO1G.jO5iQ$I[O1G.jO#?xQbO,5@OO#@SQWO,5@OO#@_QYO,5=gO#@fQWO,5=gO7VQWO,5@OOOQQ1G3P1G3PO`QYO1G3POOQQ1G3V1G3VOOQQ1G3X1G3XO:XQWO1G3ZO#@kQYO1G3]O#DfQYO'#H[OOQQ1G3`1G3`O#DsQWO'#HbO:^QWO'#HdOOQQ1G3f1G3fO#D{QYO1G3fO5iQ$I[O1G3lOOQQ1G3n1G3nOOQ$IS'#Fx'#FxO5iQ$I[O1G3pO5iQ$I[O1G3rOOOS1G/^1G/^O#HyQ`O,5aO#I]QWO1G4|O#IeQWO1G5WO#ImQWO,5?dOLXQYO,5:{O7VQWO,5:{O:^QWO,59}OLXQYO,59}O!,rQpO,59}O#IrQ7^O,59}OOQO,5:{,5:{O#I|Q&jO'#HvO#JdQWO,5?cOOQ$IU1G/h1G/hO#JlQ&jO'#H{O#KQQWO,5?nOOQ$IS1G0f1G0fO!;OQ&jO,59}O#KYQbO1G5XO7VQWO,5>fOOQ$IS'#ES'#ESO#KdQ$ItO'#ETO!?{Q&jO'#D}OOQO'#Hy'#HyO#LOQ&jO,5:hOOQ$IU,5:h,5:hO#LVQ&jO'#D}O#LhQ&jO'#D}O#LoQ&jO'#EYO#LrQ&jO'#ETO#MPQ&jO'#ETO!?{Q&jO'#ETO#MdQWO1G0PO#MiQ`O1G0POOQ$IU1G0P1G0PO){QYO1G0POITQWO1G0POOQ$IU1G0a1G0aO:^QWO1G0aO!,rQpO1G0aO!,zQ#tO1G0aO#MpQ$IfO1G5UO){QYO1G5UO#NQQ$I[O1G5UO#NcQWO1G5TO7VQWO,5>hOOQO,5>h,5>hO#NkQWO,5>hOOQO-E;z-E;zO#NcQWO1G5TO#NyQ$IfO,59jO$!xQ$IfO,5m,5>mO$,iQWO,5>mOOQ$IU1G2P1G2PP$,nQWO'#IRPOQ$IU-Eo,5>oOOQO-Ep,5>pOOQO-Ex,5>xOOQO-E<[-E<[OOQ$IU7+&q7+&qO$4uQWO7+(iO5iQ$I[O7+(iO5qQWO7+(iO$4zQWO7+(iO$5PQWO7+'|OOQ$IS,5>r,5>rOOQ$IS-Et,5>tOOQO-EO,5>OOOQQ7+)Q7+)QOOQQ7+)W7+)WOOQQ7+)[7+)[OOQQ7+)^7+)^OOQO1G5O1G5OO$9eQ7^O1G0gO$9oQWO1G0gOOQO1G/i1G/iO$9zQ7^O1G/iO:^QWO1G/iOLXQYO'#DcOOQO,5>b,5>bOOQO-E;t-E;tOOQO,5>g,5>gOOQO-E;y-E;yO!,rQpO1G/iO:^QWO,5:iOOQO,5:o,5:oO){QYO,5:oO$:UQ$I[O,5:oO$:aQ$I[O,5:oO!,rQpO,5:iOOQO-E;w-E;wOOQ$IU1G0S1G0SO!?{Q&jO,5:iO$:oQ&jO,5:iO$;QQ$ItO,5:oO$;lQ&jO,5:iO!?{Q&jO,5:oOOQO,5:t,5:tO$;sQ&jO,5:oO$cOOQO-E;u-E;uO$CfQbO,5>dO){QYO,5>dOOQO-E;v-E;vO$CpQWO1G5QO$CxQ7^O1G0bO$FPQ7^O1G0mO$FWQ7^O1G0mO$HXQ7^O1G0mO$H`Q7^O1G0mO$JTQ7^O1G0mO$JhQ7^O1G0mO$LuQ7^O1G0mO$L|Q7^O1G0mO$N}Q7^O1G0mO% UQ7^O1G0mO%!yQ7^O1G0mO%#^Q$IfO<kOOOO7+'T7+'TOOOS1G/R1G/ROOQ$IU1G4X1G4XOJdQWO7+'zO%([QWO,5>lO5qQWO,5>lOOQO-EnO%)XQWO,5>nOITQWO,5>nOOQO-Ew,5>wO%,kQWO,5>wO%,pQWO,5>wOOQO-EvOOQO-EWQ7^O7+'WO%>eQ7^O7+'XO%>rQWO,5;xOOQO7+&{7+&{O%>wQ#tO<qOOQO-EsOOQO-E{AN>{OOQOAN>uAN>uO%1gQ$IfOAN>{O:^QWOAN>uO){QYOAN>{O!,rQpOAN>uO&%SQ$I[OAN>{O&%_Q7^O<^O!O&OO~Ox&RO!W&]O!X&UO!Y&UO'^$bO~O]&SOk&SO!Q&VO'g&PO!S'kP!S'vP~P@aO!O'sX!R'sX!]'sX!c'sX'p'sX~O!{'sX#W#PX!S'sX~PAYO!{&^O!O'uX!R'uX~O!R&_O!O'tX~O!O&bO~O!{#eO~PAYOS&fO!T&cO!o&eO']$`O~Oc&kO!d$XO']$`O~Ou$nO!d$mO~O!S&lO~P`Ou!{Ov!{Ox!|O!b!yO!d!zO'fQOP!faZ!faj!fa!R!fa!a!fa!j!fa#[!fa#]!fa#^!fa#_!fa#`!fa#a!fa#b!fa#c!fa#e!fa#g!fa#i!fa#j!fa'p!fa'w!fa'x!fa~O_!fa'W!fa!O!fa!c!fan!fa!T!fa%Q!fa!]!fa~PCcO!c&mO~O!]!wO!{&oO'p&nO!R'rX_'rX'W'rX~O!c'rX~PE{O!R&sO!c'qX~O!c&uO~Ox$tO!T$uO#V&vO']$`O~OPTOQTO]cOb!kOc!jOhcOjTOkcOlcOqTOsTOxRO{cO|cO}cO!TSO!_kO!dUO!gTO!hTO!iTO!jTO!kTO!n!iO#t!lO#x^O']9WO'fQO'oYO'|aO~O]#qOh$OOj#rOk#qOl#qOq$POs9kOx#xO!T#yO!_;RO!d#vO#V9tO#t$TO$_9nO$a9qO$d$UO']&zO'f#sO~O#W&|O~O]#qOh$OOj#rOk#qOl#qOq$POs$QOx#xO!T#yO!_$VO!d#vO#V$WO#t$TO$_$RO$a$SO$d$UO']&zO'f#sO~O'a'mP~PJdO!Q'QO!c'nP~P){O'g'SO'oYO~OP9TOQ9TO]cOb;POc!jOhcOj9TOkcOlcOq9TOs9TOxRO{cO|cO}cO!T!bO!_9VO!dUO!g9TO!h9TO!i9TO!j9TO!k9TO!n!iO#t!lO#x^O']'bO'fQO'oYO'|:}O~O!d!zO~O!R#bO_$]a'W$]a!c$]a!O$]a!T$]a%Q$]a!]$]a~O#d'iO~PITO!]'kO!T'yX#w'yX#z'yX$R'yX~Ou'lO~P! POu'lO!T'yX#w'yX#z'yX$R'yX~O!T'nO#w'rO#z'mO$R'sO~O!Q'vO~PLXO#z#fO$R'yO~Ou$eXx$eX!b$eX'p$eX'w$eX'x$eX~OSfX!RfX!{fX'afX'a$eX~P!!iOk'{O~OR'|O'U'}O'V(PO~Ou(ROx(SO'p#[O'w(UO'x(WO~O'a(QO~P!#rO'a(ZO~O]#qOh$OOj#rOk#qOl#qOq$POs9kOx#xO!T#yO!_;RO!d#vO#V9tO#t$TO$_9nO$a9qO$d$UO'f#sO~O!Q(_O']([O!c'}P~P!$aO#W(aO~O!Q(eO'](bO!O(OP~P!$aOj(sOx(kO!W(qO!X(jO!Y(jO!d(hO!x(rO$w(mO'^$bO'g(gO~O!S(pO~P!&XO!b!yOu'eXx'eX'p'eX'w'eX'x'eX!R'eX!{'eX~O'a'eX#m'eX~P!'QOS(vO!{(uO!R'dX'a'dX~O!R(wO'a'cX~O'](yO~O!d)OO~O']&zO~O!d(hO~Ox$tO!Q!rO!T$uO#U!uO#V!rO']$`O!c'qP~O!]!wO#W)SO~OP#^OZ#dOj#ROu!{Ov!{Ox!|O!a#TO!b!yO!d!zO!j#^O#[#PO#]#QO#^#QO#_#QO#`#SO#a#TO#b#TO#c#TO#e#UO#g#WO#i#YO#j#ZO'fQO'p#[O'w!}O'x#OO~O_!^a!R!^a'W!^a!O!^a!c!^an!^a!T!^a%Q!^a!]!^a~P!)cOS)[O!T&cO!o)ZO%Q)YO'b$cO~O']$zO'a'cP~O!])_O!T'`X_'`X!R'`X'W'`X~O!d$XO'b$cO~O!d$XO']$`O'b$cO~O!]!wO#W&|O~O])jO%R)kO'])gO!S(VP~O!R)lO^(UX~O'g'SO~OZ)pO~O^)qO~O!T$kO']$`O'^$bO^(UP~Ox$tO!Q)vO!R&_O!T$uO']$`O!O'tP~O]&YOk&YO!Q)wO'g'SO!S'vP~O!R)xO_(RX'W(RX~O!{)|O'b$cO~OS*PO!T#yO'b$cO~O!T*RO~Ou*TO!TSO~O!n*YO~Oc*_O~O'](yO!S(TP~Oc$iO~O%RtO']$zO~P8tOZ*eO^*dO~OPTOQTO]cObnOcmOhcOjTOkcOlcOqTOsTOxRO{cO|cO}cO!_kO!dUO!gTO!hTO!iTO!jTO!kTO!nlO#x^O%PqO'fQO'oYO'|aO~O!T!bO#t!lO']9WO~P!1RO^*dO_$[O'W$[O~O_*iO#d*kO%T*kO%U*kO~P){O!d%_O~O%t*pO~O!T*rO~O&V*tO&X*uOP&SaQ&SaX&Sa]&Sa_&Sab&Sac&Sah&Saj&Sak&Sal&Saq&Sas&Sax&Sa{&Sa|&Sa}&Sa!T&Sa!_&Sa!d&Sa!g&Sa!h&Sa!i&Sa!j&Sa!k&Sa!n&Sa#d&Sa#t&Sa#x&Sa%P&Sa%R&Sa%T&Sa%U&Sa%X&Sa%Z&Sa%^&Sa%_&Sa%a&Sa%n&Sa%t&Sa%v&Sa%x&Sa%z&Sa%}&Sa&T&Sa&Z&Sa&]&Sa&_&Sa&a&Sa&c&Sa'S&Sa']&Sa'f&Sa'o&Sa'|&Sa!S&Sa%{&Sa`&Sa&Q&Sa~O']*zO~On*}O~O!O&ia!R&ia~P!)cO!Q+RO!O&iX!R&iX~P){O!R%yO!O'ja~O!O'ja~P>^O!R&_O!O'ta~O!RwX!R!ZX!SwX!S!ZX!]wX!]!ZX!d!ZX!{wX'b!ZX~O!]+WO!{+VO!R#TX!R'lX!S#TX!S'lX!]'lX!d'lX'b'lX~O!]+YO!d$XO'b$cO!R!VX!S!VX~O]&QOk&QOx&RO'g(gO~OP9TOQ9TO]cOb;POc!jOhcOj9TOkcOlcOq9TOs9TOxRO{cO|cO}cO!T!bO!_9VO!dUO!g9TO!h9TO!i9TO!j9TO!k9TO!n!iO#t!lO#x^O'fQO'oYO'|:}O~O']9yO~P!;^O!R+^O!S'kX~O!S+`O~O!]+WO!{+VO!R#TX!S#TX~O!R+aO!S'vX~O!S+cO~O]&QOk&QOx&RO'^$bO'g(gO~O!X+dO!Y+dO~P!>[Ox$tO!Q+fO!T$uO']$`O!O&nX!R&nX~O_+jO!W+mO!X+iO!Y+iO!r+qO!s+oO!t+pO!u+nO!x+rO'^$bO'g(gO'o+gO~O!S+lO~P!?]OS+wO!T&cO!o+vO~O!{+}O!R'ra!c'ra_'ra'W'ra~O!]!wO~P!@gO!R&sO!c'qa~Ox$tO!Q,QO!T$uO#U,SO#V,QO']$`O!R&pX!c&pX~O_#Oi!R#Oi'W#Oi!O#Oi!c#Oin#Oi!T#Oi%Q#Oi!]#Oi~P!)cO#W!za!R!za!c!za!{!za!T!za_!za'W!za!O!za~P!#rO#W'eXP'eXZ'eX_'eXj'eXv'eX!a'eX!d'eX!j'eX#['eX#]'eX#^'eX#_'eX#`'eX#a'eX#b'eX#c'eX#e'eX#g'eX#i'eX#j'eX'W'eX'f'eX!c'eX!O'eX!T'eXn'eX%Q'eX!]'eX~P!'QO!R,]O'a'mX~P!#rO'a,_O~O!R,`O!c'nX~P!)cO!c,cO~O!O,dO~OP#^Ou!{Ov!{Ox!|O!b!yO!d!zO!j#^O'fQOZ#Zi_#Zij#Zi!R#Zi!a#Zi#]#Zi#^#Zi#_#Zi#`#Zi#a#Zi#b#Zi#c#Zi#e#Zi#g#Zi#i#Zi#j#Zi'W#Zi'p#Zi'w#Zi'x#Zi!O#Zi!c#Zin#Zi!T#Zi%Q#Zi!]#Zi~O#[#Zi~P!EtO#[#PO~P!EtOP#^Ou!{Ov!{Ox!|O!b!yO!d!zO!j#^O#[#PO#]#QO#^#QO#_#QO'fQOZ#Zi_#Zi!R#Zi!a#Zi#`#Zi#a#Zi#b#Zi#c#Zi#e#Zi#g#Zi#i#Zi#j#Zi'W#Zi'p#Zi'w#Zi'x#Zi!O#Zi!c#Zin#Zi!T#Zi%Q#Zi!]#Zi~Oj#Zi~P!H`Oj#RO~P!H`OP#^Oj#ROu!{Ov!{Ox!|O!b!yO!d!zO!j#^O#[#PO#]#QO#^#QO#_#QO#`#SO'fQO_#Zi!R#Zi#e#Zi#g#Zi#i#Zi#j#Zi'W#Zi'p#Zi'w#Zi'x#Zi!O#Zi!c#Zin#Zi!T#Zi%Q#Zi!]#Zi~OZ#Zi!a#Zi#a#Zi#b#Zi#c#Zi~P!JzOZ#dO!a#TO#a#TO#b#TO#c#TO~P!JzOP#^OZ#dOj#ROu!{Ov!{Ox!|O!a#TO!b!yO!d!zO!j#^O#[#PO#]#QO#^#QO#_#QO#`#SO#a#TO#b#TO#c#TO#e#UO'fQO_#Zi!R#Zi#g#Zi#i#Zi#j#Zi'W#Zi'p#Zi'x#Zi!O#Zi!c#Zin#Zi!T#Zi%Q#Zi!]#Zi~O'w#Zi~P!MrO'w!}O~P!MrOP#^OZ#dOj#ROu!{Ov!{Ox!|O!a#TO!b!yO!d!zO!j#^O#[#PO#]#QO#^#QO#_#QO#`#SO#a#TO#b#TO#c#TO#e#UO#g#WO'fQO'w!}O_#Zi!R#Zi#i#Zi#j#Zi'W#Zi'p#Zi!O#Zi!c#Zin#Zi!T#Zi%Q#Zi!]#Zi~O'x#Zi~P#!^O'x#OO~P#!^OP#^OZ#dOj#ROu!{Ov!{Ox!|O!a#TO!b!yO!d!zO!j#^O#[#PO#]#QO#^#QO#_#QO#`#SO#a#TO#b#TO#c#TO#e#UO#g#WO#i#YO'fQO'w!}O'x#OO~O_#Zi!R#Zi#j#Zi'W#Zi'p#Zi!O#Zi!c#Zin#Zi!T#Zi%Q#Zi!]#Zi~P#$xOP[XZ[Xj[Xu[Xv[Xx[X!a[X!b[X!d[X!j[X!{[X#WdX#[[X#][X#^[X#_[X#`[X#a[X#b[X#c[X#e[X#g[X#i[X#j[X#o[X'f[X'p[X'w[X'x[X!R[X!S[X~O#m[X~P#']OP#^OZ9iOj9^Ou!{Ov!{Ox!|O!a9`O!b!yO!d!zO!j#^O#[9[O#]9]O#^9]O#_9]O#`9_O#a9`O#b9`O#c9`O#e9aO#g9cO#i9eO#j9fO'fQO'p#[O'w!}O'x#OO~O#m,fO~P#)gOP'iXZ'iXj'iXu'iXv'iXx'iX!a'iX!b'iX!d'iX!j'iX#['iX#]'iX#^'iX#_'iX#`'iX#a'iX#b'iX#e'iX#g'iX#i'iX#j'iX'f'iX'p'iX'w'iX'x'iX!R'iX~O!{9jO#o9jO#c'iX#m'iX!S'iX~P#+bO_&sa!R&sa'W&sa!c&san&sa!O&sa!T&sa%Q&sa!]&sa~P!)cOP#ZiZ#Zi_#Zij#Ziv#Zi!R#Zi!a#Zi!b#Zi!d#Zi!j#Zi#[#Zi#]#Zi#^#Zi#_#Zi#`#Zi#a#Zi#b#Zi#c#Zi#e#Zi#g#Zi#i#Zi#j#Zi'W#Zi'f#Zi!O#Zi!c#Zin#Zi!T#Zi%Q#Zi!]#Zi~P!#rO_#ni!R#ni'W#ni!O#ni!c#nin#ni!T#ni%Q#ni!]#ni~P!)cO#z,hO~O#z,iO~O!]'kO!{,jO!T$OX#w$OX#z$OX$R$OX~O!Q,kO~O!T'nO#w,mO#z'mO$R,nO~O!R9gO!S'hX~P#)gO!S,oO~O$R,qO~OR'|O'U'}O'V,tO~O],wOk,wO!O,xO~O!RdX!]dX!cdX!c$eX'pdX~P!!iO!c-OO~P!#rO!R-PO!]!wO'p&nO!c'}X~O!c-UO~O!O$eX!R$eX!]$lX~P!!iO!R-WO!O(OX~P!#rO!]-YO~O!O-[O~O!Q(_O']$`O!c'}P~Oj-`O!]!wO!d$XO'b$cO'p&nO~O!])_O~O_$[O!R-eO'W$[O~O!S-gO~P!&XO!X-hO!Y-hO'^$bO'g(gO~Ox-jO'g(gO~O!x-kO~O']$zO!R&xX'a&xX~O!R(wO'a'ca~Ou-pOv-pOx-qO'pra'wra'xra!Rra!{ra~O'ara#mra~P#6qOu(ROx(SO'p$^a'w$^a'x$^a!R$^a!{$^a~O'a$^a#m$^a~P#7gOu(ROx(SO'p$`a'w$`a'x$`a!R$`a!{$`a~O'a$`a#m$`a~P#8YO]-rO~O#W-sO~O'a$na!R$na#m$na!{$na~P!#rO#W-vO~OS.PO!T&cO!o.OO%Q-}O~O'a.QO~O]#qOj#rOk#qOl#qOq$POs9kOx#xO!T#yO!_;RO!d#vO#V9tO#t$TO$_9nO$a9qO$d$UO'f#sO~Oh.SO'].RO~P#:PO!])_O!T'`a_'`a!R'`a'W'`a~O#W.YO~OZ[X!RdX!SdX~O!R.ZO!S(VX~O!S.]O~OZ.^O~O].`O'])gO~O!T$kO']$`O^'QX!R'QX~O!R)lO^(Ua~O!c.cO~P!)cO].eO~OZ.fO~O^.gO~OS.PO!T&cO!o.OO%Q-}O'b$cO~O!R)xO_(Ra'W(Ra~O!{.mO~OS.pO!T#yO~O'g'SO!S(SP~OS.zO!T.vO!o.yO%Q.xO'b$cO~OZ/UO!R/SO!S(TX~O!S/VO~O^/XO_$[O'W$[O~O]/YO~O]/ZO'](yO~O#c/[O%r/]O~P0zO!{#eO#c/[O%r/]O~O_/^O~P){O_/`O~O%{/dOP%yiQ%yiX%yi]%yi_%yib%yic%yih%yij%yik%yil%yiq%yis%yix%yi{%yi|%yi}%yi!T%yi!_%yi!d%yi!g%yi!h%yi!i%yi!j%yi!k%yi!n%yi#d%yi#t%yi#x%yi%P%yi%R%yi%T%yi%U%yi%X%yi%Z%yi%^%yi%_%yi%a%yi%n%yi%t%yi%v%yi%x%yi%z%yi%}%yi&T%yi&Z%yi&]%yi&_%yi&a%yi&c%yi'S%yi']%yi'f%yi'o%yi'|%yi!S%yi`%yi&Q%yi~O`/jO!S/hO&Q/iO~P`O!TSO!d/lO~O&X*uOP&SiQ&SiX&Si]&Si_&Sib&Sic&Sih&Sij&Sik&Sil&Siq&Sis&Six&Si{&Si|&Si}&Si!T&Si!_&Si!d&Si!g&Si!h&Si!i&Si!j&Si!k&Si!n&Si#d&Si#t&Si#x&Si%P&Si%R&Si%T&Si%U&Si%X&Si%Z&Si%^&Si%_&Si%a&Si%n&Si%t&Si%v&Si%x&Si%z&Si%}&Si&T&Si&Z&Si&]&Si&_&Si&a&Si&c&Si'S&Si']&Si'f&Si'o&Si'|&Si!S&Si%{&Si`&Si&Q&Si~O!R#bOn$]a~O!O&ii!R&ii~P!)cO!R%yO!O'ji~O!R&_O!O'ti~O!O/rO~O!R!Va!S!Va~P#)gO]&QOk&QO!Q/xO'g(gO!R&jX!S&jX~P@aO!R+^O!S'ka~O]&YOk&YO!Q)wO'g'SO!R&oX!S&oX~O!R+aO!S'va~O!O'ui!R'ui~P!)cO_$[O!]!wO!d$XO!j0SO!{0QO'W$[O'b$cO'p&nO~O!S0VO~P!?]O!X0WO!Y0WO'^$bO'g(gO'o+gO~O!W0XO~P#LVO!TSO!W0XO!u0ZO!x0[O~P#LVO!W0XO!s0^O!t0^O!u0ZO!x0[O~P#LVO!T&cO~O!T&cO~P!#rO!R'ri!c'ri_'ri'W'ri~P!)cO!{0gO!R'ri!c'ri_'ri'W'ri~O!R&sO!c'qi~Ox$tO!T$uO#V0iO']$`O~O#WraPraZra_rajra!ara!bra!dra!jra#[ra#]ra#^ra#_ra#`ra#ara#bra#cra#era#gra#ira#jra'Wra'fra!cra!Ora!Tranra%Qra!]ra~P#6qO#W$^aP$^aZ$^a_$^aj$^av$^a!a$^a!b$^a!d$^a!j$^a#[$^a#]$^a#^$^a#_$^a#`$^a#a$^a#b$^a#c$^a#e$^a#g$^a#i$^a#j$^a'W$^a'f$^a!c$^a!O$^a!T$^an$^a%Q$^a!]$^a~P#7gO#W$`aP$`aZ$`a_$`aj$`av$`a!a$`a!b$`a!d$`a!j$`a#[$`a#]$`a#^$`a#_$`a#`$`a#a$`a#b$`a#c$`a#e$`a#g$`a#i$`a#j$`a'W$`a'f$`a!c$`a!O$`a!T$`an$`a%Q$`a!]$`a~P#8YO#W$naP$naZ$na_$naj$nav$na!R$na!a$na!b$na!d$na!j$na#[$na#]$na#^$na#_$na#`$na#a$na#b$na#c$na#e$na#g$na#i$na#j$na'W$na'f$na!c$na!O$na!T$na!{$nan$na%Q$na!]$na~P!#rO_#Oq!R#Oq'W#Oq!O#Oq!c#Oqn#Oq!T#Oq%Q#Oq!]#Oq~P!)cO!R&kX'a&kX~PJdO!R,]O'a'ma~O!Q0qO!R&lX!c&lX~P){O!R,`O!c'na~O!R,`O!c'na~P!)cO#m!fa!S!fa~PCcO#m!^a!R!^a!S!^a~P#)gO!T1UO#x^O$P1VO~O!S1ZO~On1[O~P!#rO_$Yq!R$Yq'W$Yq!O$Yq!c$Yqn$Yq!T$Yq%Q$Yq!]$Yq~P!)cO!O1]O~O],wOk,wO~Ou(ROx(SO'x(WO'p$xi'w$xi!R$xi!{$xi~O'a$xi#m$xi~P$,vOu(ROx(SO'p$zi'w$zi'x$zi!R$zi!{$zi~O'a$zi#m$zi~P$-iO#m1^O~P!#rO!Q1`O']$`O!R&tX!c&tX~O!R-PO!c'}a~O!R-PO!]!wO!c'}a~O!R-PO!]!wO'p&nO!c'}a~O'a$gi!R$gi#m$gi!{$gi~P!#rO!Q1gO'](bO!O&vX!R&vX~P!$aO!R-WO!O(Oa~O!R-WO!O(Oa~P!#rO!]!wO~O!]!wO#c1oO~Oj1rO!]!wO'p&nO~O!R'di'a'di~P!#rO!{1uO!R'di'a'di~P!#rO!c1xO~O_$Zq!R$Zq'W$Zq!O$Zq!c$Zqn$Zq!T$Zq%Q$Zq!]$Zq~P!)cO!R1|O!T(PX~P!#rO!T&cO%Q2PO~O!T&cO%Q2PO~P!#rO!T$eX$u[X_$eX!R$eX'W$eX~P!!iO$u2TOugXxgX!TgX'pgX'wgX'xgX_gX!RgX'WgX~O$u2TO~O]2ZO%R2[O'])gO!R'PX!S'PX~O!R.ZO!S(Va~OZ2`O~O^2aO~O]2dO~OS2fO!T&cO!o2eO%Q2PO~O_$[O'W$[O~P!#rO!T#yO~P!#rO!R2kO!{2mO!S(SX~O!S2nO~Ox;]O!W2wO!X2pO!Y2pO!r2vO!s2uO!t2uO!x2tO'^$bO'g(gO'o+gO~O!S2sO~P$6QOS3OO!T.vO!o2}O%Q2|O~OS3OO!T.vO!o2}O%Q2|O'b$cO~O'](yO!R'OX!S'OX~O!R/SO!S(Ta~O]3YO'g3XO~O]3ZO~O^3]O~O!c3`O~P){O_3bO~O_3bO~P){O#c3dO%r3eO~PE{O`/jO!S3iO&Q/iO~P`O!]3kO~O!R#Ti!S#Ti~P#)gO!{3mO!R#Ti!S#Ti~O!R!Vi!S!Vi~P#)gO_$[O!{3tO'W$[O~O_$[O!]!wO!{3tO'W$[O~O!X3xO!Y3xO'^$bO'g(gO'o+gO~O_$[O!]!wO!d$XO!j3yO!{3tO'W$[O'b$cO'p&nO~O!W3zO~P$:oO!W3zO!u3}O!x4OO~P$:oO_$[O!]!wO!j3yO!{3tO'W$[O'p&nO~O!R'rq!c'rq_'rq'W'rq~P!)cO!R&sO!c'qq~O#W$xiP$xiZ$xi_$xij$xiv$xi!a$xi!b$xi!d$xi!j$xi#[$xi#]$xi#^$xi#_$xi#`$xi#a$xi#b$xi#c$xi#e$xi#g$xi#i$xi#j$xi'W$xi'f$xi!c$xi!O$xi!T$xin$xi%Q$xi!]$xi~P$,vO#W$ziP$ziZ$zi_$zij$ziv$zi!a$zi!b$zi!d$zi!j$zi#[$zi#]$zi#^$zi#_$zi#`$zi#a$zi#b$zi#c$zi#e$zi#g$zi#i$zi#j$zi'W$zi'f$zi!c$zi!O$zi!T$zin$zi%Q$zi!]$zi~P$-iO#W$giP$giZ$gi_$gij$giv$gi!R$gi!a$gi!b$gi!d$gi!j$gi#[$gi#]$gi#^$gi#_$gi#`$gi#a$gi#b$gi#c$gi#e$gi#g$gi#i$gi#j$gi'W$gi'f$gi!c$gi!O$gi!T$gi!{$gin$gi%Q$gi!]$gi~P!#rO!R&ka'a&ka~P!#rO!R&la!c&la~P!)cO!R,`O!c'ni~O#m#Oi!R#Oi!S#Oi~P#)gOP#^Ou!{Ov!{Ox!|O!b!yO!d!zO!j#^O'fQOZ#Zij#Zi!a#Zi#]#Zi#^#Zi#_#Zi#`#Zi#a#Zi#b#Zi#c#Zi#e#Zi#g#Zi#i#Zi#j#Zi#m#Zi'p#Zi'w#Zi'x#Zi!R#Zi!S#Zi~O#[#Zi~P$DVO#[9[O~P$DVOP#^Ou!{Ov!{Ox!|O!b!yO!d!zO!j#^O#[9[O#]9]O#^9]O#_9]O'fQOZ#Zi!a#Zi#`#Zi#a#Zi#b#Zi#c#Zi#e#Zi#g#Zi#i#Zi#j#Zi#m#Zi'p#Zi'w#Zi'x#Zi!R#Zi!S#Zi~Oj#Zi~P$F_Oj9^O~P$F_OP#^Oj9^Ou!{Ov!{Ox!|O!b!yO!d!zO!j#^O#[9[O#]9]O#^9]O#_9]O#`9_O'fQO#e#Zi#g#Zi#i#Zi#j#Zi#m#Zi'p#Zi'w#Zi'x#Zi!R#Zi!S#Zi~OZ#Zi!a#Zi#a#Zi#b#Zi#c#Zi~P$HgOZ9iO!a9`O#a9`O#b9`O#c9`O~P$HgOP#^OZ9iOj9^Ou!{Ov!{Ox!|O!a9`O!b!yO!d!zO!j#^O#[9[O#]9]O#^9]O#_9]O#`9_O#a9`O#b9`O#c9`O#e9aO'fQO#g#Zi#i#Zi#j#Zi#m#Zi'p#Zi'x#Zi!R#Zi!S#Zi~O'w#Zi~P$J{O'w!}O~P$J{OP#^OZ9iOj9^Ou!{Ov!{Ox!|O!a9`O!b!yO!d!zO!j#^O#[9[O#]9]O#^9]O#_9]O#`9_O#a9`O#b9`O#c9`O#e9aO#g9cO'fQO'w!}O#i#Zi#j#Zi#m#Zi'p#Zi!R#Zi!S#Zi~O'x#Zi~P$MTO'x#OO~P$MTOP#^OZ9iOj9^Ou!{Ov!{Ox!|O!a9`O!b!yO!d!zO!j#^O#[9[O#]9]O#^9]O#_9]O#`9_O#a9`O#b9`O#c9`O#e9aO#g9cO#i9eO'fQO'w!}O'x#OO~O#j#Zi#m#Zi'p#Zi!R#Zi!S#Zi~P% ]O_#ky!R#ky'W#ky!O#ky!c#kyn#ky!T#ky%Q#ky!]#ky~P!)cOP#ZiZ#Zij#Ziv#Zi!a#Zi!b#Zi!d#Zi!j#Zi#[#Zi#]#Zi#^#Zi#_#Zi#`#Zi#a#Zi#b#Zi#c#Zi#e#Zi#g#Zi#i#Zi#j#Zi#m#Zi'f#Zi!R#Zi!S#Zi~P!#rO!b!yOu'eXx'eX'p'eX'w'eX'x'eX!S'eX~OP'eXZ'eXj'eXv'eX!a'eX!d'eX!j'eX#['eX#]'eX#^'eX#_'eX#`'eX#a'eX#b'eX#c'eX#e'eX#g'eX#i'eX#j'eX#m'eX'f'eX!R'eX~P%%mO#m#ni!R#ni!S#ni~P#)gO!S4`O~O!R&sa!S&sa~P#)gO!]!wO'p&nO!R&ta!c&ta~O!R-PO!c'}i~O!R-PO!]!wO!c'}i~O!O&va!R&va~P!#rO!]4gO~O!R-WO!O(Oi~P!#rO!R-WO!O(Oi~O!O4kO~O!]!wO#c4pO~Oj4qO!]!wO'p&nO~O!O4sO~O'a$iq!R$iq#m$iq!{$iq~P!#rO_$Zy!R$Zy'W$Zy!O$Zy!c$Zyn$Zy!T$Zy%Q$Zy!]$Zy~P!)cO!R1|O!T(Pa~O!T&cO%Q4xO~O!T&cO%Q4xO~P!#rO_#Oy!R#Oy'W#Oy!O#Oy!c#Oyn#Oy!T#Oy%Q#Oy!]#Oy~P!)cOZ4{O~O]4}O'])gO~O!R.ZO!S(Vi~O]5QO~O^5RO~O'g'SO!R&{X!S&{X~O!R2kO!S(Sa~O!S5`O~P$6QOx;^O'g(gO'o+gO~O!W5cO!X5bO!Y5bO!x0[O'^$bO'g(gO'o+gO~O!s5dO!t5dO~P%.RO!X5bO!Y5bO'^$bO'g(gO'o+gO~O!T.vO~O!T.vO%Q5fO~O!T.vO%Q5fO~P!#rOS5kO!T.vO!o5jO%Q5fO~OZ5pO!R'Oa!S'Oa~O!R/SO!S(Ti~O]5sO~O!c5tO~O!c5uO~O!c5vO~O!c5vO~P){O_5xO~O!]5{O~O!c5|O~O!R'ui!S'ui~P#)gO_$[O'W$[O~P!)cO_$[O!{6RO'W$[O~O_$[O!]!wO!{6RO'W$[O~O!X6WO!Y6WO'^$bO'g(gO'o+gO~O_$[O!]!wO!j6XO!{6RO'W$[O'p&nO~O!d$XO'b$cO~P%2mO!W6YO~P%2[O!R'ry!c'ry_'ry'W'ry~P!)cO#W$iqP$iqZ$iq_$iqj$iqv$iq!R$iq!a$iq!b$iq!d$iq!j$iq#[$iq#]$iq#^$iq#_$iq#`$iq#a$iq#b$iq#c$iq#e$iq#g$iq#i$iq#j$iq'W$iq'f$iq!c$iq!O$iq!T$iq!{$iqn$iq%Q$iq!]$iq~P!#rO!R&li!c&li~P!)cO#m#Oq!R#Oq!S#Oq~P#)gOu-pOv-pOx-qO'pra'wra'xra!Sra~OPraZrajra!ara!bra!dra!jra#[ra#]ra#^ra#_ra#`ra#ara#bra#cra#era#gra#ira#jra#mra'fra!Rra~P%6eOu(ROx(SO'p$^a'w$^a'x$^a!S$^a~OP$^aZ$^aj$^av$^a!a$^a!b$^a!d$^a!j$^a#[$^a#]$^a#^$^a#_$^a#`$^a#a$^a#b$^a#c$^a#e$^a#g$^a#i$^a#j$^a#m$^a'f$^a!R$^a~P%8fOu(ROx(SO'p$`a'w$`a'x$`a!S$`a~OP$`aZ$`aj$`av$`a!a$`a!b$`a!d$`a!j$`a#[$`a#]$`a#^$`a#_$`a#`$`a#a$`a#b$`a#c$`a#e$`a#g$`a#i$`a#j$`a#m$`a'f$`a!R$`a~P%:gOP$naZ$naj$nav$na!a$na!b$na!d$na!j$na#[$na#]$na#^$na#_$na#`$na#a$na#b$na#c$na#e$na#g$na#i$na#j$na#m$na'f$na!R$na!S$na~P!#rO#m$Yq!R$Yq!S$Yq~P#)gO#m$Zq!R$Zq!S$Zq~P#)gO!S6dO~O'a$|y!R$|y#m$|y!{$|y~P!#rO!]!wO!R&ti!c&ti~O!]!wO'p&nO!R&ti!c&ti~O!R-PO!c'}q~O!O&vi!R&vi~P!#rO!R-WO!O(Oq~O!O6jO~P!#rO!O6jO~O!R'dy'a'dy~P!#rO!R&ya!T&ya~P!#rO!T$tq_$tq!R$tq'W$tq~P!#rOZ6qO~O!R.ZO!S(Vq~O]6tO~O!T&cO%Q6uO~O!T&cO%Q6uO~P!#rO!{6vO!R&{a!S&{a~O!R2kO!S(Si~P#)gO!X6|O!Y6|O'^$bO'g(gO'o+gO~O!W7OO!x4OO~P%BkO!T.vO%Q7RO~O!T.vO%Q7RO~P!#rO]7YO'g7XO~O!R/SO!S(Tq~O!c7[O~O!c7[O~P){O!c7^O~O!c7_O~O!R#Ty!S#Ty~P#)gO_$[O!{7eO'W$[O~O_$[O!]!wO!{7eO'W$[O~O!X7hO!Y7hO'^$bO'g(gO'o+gO~O_$[O!]!wO!j7iO!{7eO'W$[O'p&nO~O#W$|yP$|yZ$|y_$|yj$|yv$|y!R$|y!a$|y!b$|y!d$|y!j$|y#[$|y#]$|y#^$|y#_$|y#`$|y#a$|y#b$|y#c$|y#e$|y#g$|y#i$|y#j$|y'W$|y'f$|y!c$|y!O$|y!T$|y!{$|yn$|y%Q$|y!]$|y~P!#rO#m#ky!R#ky!S#ky~P#)gOP$giZ$gij$giv$gi!a$gi!b$gi!d$gi!j$gi#[$gi#]$gi#^$gi#_$gi#`$gi#a$gi#b$gi#c$gi#e$gi#g$gi#i$gi#j$gi#m$gi'f$gi!R$gi!S$gi~P!#rOu(ROx(SO'x(WO'p$xi'w$xi!S$xi~OP$xiZ$xij$xiv$xi!a$xi!b$xi!d$xi!j$xi#[$xi#]$xi#^$xi#_$xi#`$xi#a$xi#b$xi#c$xi#e$xi#g$xi#i$xi#j$xi#m$xi'f$xi!R$xi~P%JROu(ROx(SO'p$zi'w$zi'x$zi!S$zi~OP$ziZ$zij$ziv$zi!a$zi!b$zi!d$zi!j$zi#[$zi#]$zi#^$zi#_$zi#`$zi#a$zi#b$zi#c$zi#e$zi#g$zi#i$zi#j$zi#m$zi'f$zi!R$zi~P%LSO#m$Zy!R$Zy!S$Zy~P#)gO#m#Oy!R#Oy!S#Oy~P#)gO!]!wO!R&tq!c&tq~O!R-PO!c'}y~O!O&vq!R&vq~P!#rO!O7mO~P!#rO!R.ZO!S(Vy~O!R2kO!S(Sq~O!X7yO!Y7yO'^$bO'g(gO'o+gO~O!T.vO%Q7|O~O!T.vO%Q7|O~P!#rO!c8PO~O_$[O!{8UO'W$[O~O_$[O!]!wO!{8UO'W$[O~OP$iqZ$iqj$iqv$iq!a$iq!b$iq!d$iq!j$iq#[$iq#]$iq#^$iq#_$iq#`$iq#a$iq#b$iq#c$iq#e$iq#g$iq#i$iq#j$iq#m$iq'f$iq!R$iq!S$iq~P!#rO!R&{q!S&{q~P#)gO_$[O!{8hO'W$[O~OP$|yZ$|yj$|yv$|y!a$|y!b$|y!d$|y!j$|y#[$|y#]$|y#^$|y#_$|y#`$|y#a$|y#b$|y#c$|y#e$|y#g$|y#i$|y#j$|y#m$|y'f$|y!R$|y!S$|y~P!#rO!S!za!W!za!X!za!Y!za!r!za!s!za!t!za!x!za'^!za'g!za'o!za~P!#rO!W'eX!X'eX!Y'eX!r'eX!s'eX!t'eX!x'eX'^'eX'g'eX'o'eX~P%%mO!Wra!Xra!Yra!rra!sra!tra!xra'^ra'gra'ora~P%6eO!W$^a!X$^a!Y$^a!r$^a!s$^a!t$^a!x$^a'^$^a'g$^a'o$^a~P%8fO!W$`a!X$`a!Y$`a!r$`a!s$`a!t$`a!x$`a'^$`a'g$`a'o$`a~P%:gO!S$na!W$na!X$na!Y$na!r$na!s$na!t$na!x$na'^$na'g$na'o$na~P!#rO!W$xi!X$xi!Y$xi!r$xi!s$xi!t$xi!x$xi'^$xi'g$xi'o$xi~P%JRO!W$zi!X$zi!Y$zi!r$zi!s$zi!t$zi!x$zi'^$zi'g$zi'o$zi~P%LSO!S$gi!W$gi!X$gi!Y$gi!r$gi!s$gi!t$gi!x$gi'^$gi'g$gi'o$gi~P!#rO!S$iq!W$iq!X$iq!Y$iq!r$iq!s$iq!t$iq!x$iq'^$iq'g$iq'o$iq~P!#rO!S$|y!W$|y!X$|y!Y$|y!r$|y!s$|y!t$|y!x$|y'^$|y'g$|y'o$|y~P!#rOn'hX~P.jOn[X!O[X!c[X%r[X!T[X%Q[X!][X~P$zO!]dX!c[X!cdX'pdX~P;aOP9TOQ9TO]cOb;POc!jOhcOj9TOkcOlcOq9TOs9TOxRO{cO|cO}cO!TSO!_9VO!dUO!g9TO!h9TO!i9TO!j9TO!k9TO!n!iO#t!lO#x^O']'bO'fQO'oYO'|:}O~O]#qOh$OOj#rOk#qOl#qOq$POs9lOx#xO!T#yO!_;SO!d#vO#V9uO#t$TO$_9oO$a9rO$d$UO']&zO'f#sO~O!R9gO!S$]a~O]#qOh$OOj#rOk#qOl#qOq$POs9mOx#xO!T#yO!_;TO!d#vO#V9vO#t$TO$_9pO$a9sO$d$UO']&zO'f#sO~O#d'iO~P&3xO!S[X!SdX~P;aO!]9ZO~O#W9YO~O!]!wO#W9YO~O!{9jO~O#c9`O~O!{9wO!R'uX!S'uX~O!{9jO!R'sX!S'sX~O#W9xO~O'a9zO~P!#rO#W:RO~O#W:SO~O#W:TO~O!]!wO#W:UO~O!]!wO#W9xO~O#m:VO~P#)gO#W:WO~O#W:XO~O#W:YO~O#W:ZO~O#W:[O~O#m:]O~P!#rO#m:^O~P!#rO#m:_O~P!#rO!O:`O~O!O:aO~P!#rO!O:aO~O!O:bO~P!#rO!]!wO#c;YO~O!]!wO#c;[O~O#x~!b!r!t!u#U#V'|$_$a$d$u%P%Q%R%X%Z%^%_%a%c~UT#x'|#]}'Y'Z#z'Y']'g~",goto:"#Hc(ZPPPPPPPP([P(lP*`PPPP-zPP.a3s5g5zP5zPPP5zP7t5zP5zP7xPP8OP8dk|}?O}!O>k!O!P?`!P!QCl!Q!R!0[!R![!1q![!]!7s!]!^!8V!^!_!8g!_!`!9d!`!a!:[!a!b!U#R#S2`#S#T!>i#T#o2`#o#p!>y#p#q!?O#q#r!?f#r#s!?x#s$f%T$f$g%c$g#BY2`#BY#BZ!@Y#BZ$IS2`$IS$I_!@Y$I_$I|2`$I|$I}!Bq$I}$JO!Bq$JO$JT2`$JT$JU!@Y$JU$KV2`$KV$KW!@Y$KW&FU2`&FU&FV!@Y&FV?HT2`?HT?HU!@Y?HU~2`W%YR$UWO!^%T!_#o%T#p~%T7Z%jg$UW'Y7ROX%TXY%cYZ%TZ[%c[p%Tpq%cq!^%T!_#o%T#p$f%T$f$g%c$g#BY%T#BY#BZ%c#BZ$IS%T$IS$I_%c$I_$JT%T$JT$JU%c$JU$KV%T$KV$KW%c$KW&FU%T&FU&FV%c&FV?HT%T?HT?HU%c?HU~%T7Z'YR$UW'Z7RO!^%T!_#o%T#p~%T$T'jS$UW!j#{O!^%T!_!`'v!`#o%T#p~%T$O'}S#e#v$UWO!^%T!_!`(Z!`#o%T#p~%T$O(bR#e#v$UWO!^%T!_#o%T#p~%T'u(rZ$UW]!ROY(kYZ)eZr(krs*rs!^(k!^!_+U!_#O(k#O#P-b#P#o(k#o#p+U#p~(k&r)jV$UWOr)ers*Ps!^)e!^!_*a!_#o)e#o#p*a#p~)e&r*WR$P&j$UWO!^%T!_#o%T#p~%T&j*dROr*ars*ms~*a&j*rO$P&j'u*{R$P&j$UW]!RO!^%T!_#o%T#p~%T'm+ZV]!ROY+UYZ*aZr+Urs+ps#O+U#O#P+w#P~+U'm+wO$P&j]!R'm+zROr+Urs,Ts~+U'm,[U$P&j]!ROY,nZr,nrs-Vs#O,n#O#P-[#P~,n!R,sU]!ROY,nZr,nrs-Vs#O,n#O#P-[#P~,n!R-[O]!R!R-_PO~,n'u-gV$UWOr(krs-|s!^(k!^!_+U!_#o(k#o#p+U#p~(k'u.VZ$P&j$UW]!ROY.xYZ%TZr.xrs/rs!^.x!^!_,n!_#O.x#O#P0S#P#o.x#o#p,n#p~.x!Z/PZ$UW]!ROY.xYZ%TZr.xrs/rs!^.x!^!_,n!_#O.x#O#P0S#P#o.x#o#p,n#p~.x!Z/yR$UW]!RO!^%T!_#o%T#p~%T!Z0XT$UWO!^.x!^!_,n!_#o.x#o#p,n#p~.x2k0mZ$UWOt%Ttu1`u!^%T!_!c%T!c!}1`!}#R%T#R#S1`#S#T%T#T#o1`#p$g%T$g~1`2k1g]$UW'o2cOt%Ttu1`u!Q%T!Q![1`![!^%T!_!c%T!c!}1`!}#R%T#R#S1`#S#T%T#T#o1`#p$g%T$g~1`7Z2k_$UW#zS']%k'g2bOt%Ttu2`u}%T}!O3j!O!Q%T!Q![2`![!^%T!_!c%T!c!}2`!}#R%T#R#S2`#S#T%T#T#o2`#p$g%T$g~2`[3q_$UW#zSOt%Ttu3ju}%T}!O3j!O!Q%T!Q![3j![!^%T!_!c%T!c!}3j!}#R%T#R#S3j#S#T%T#T#o3j#p$g%T$g~3j$O4wS#^#v$UWO!^%T!_!`5T!`#o%T#p~%T$O5[R$UW#o#vO!^%T!_#o%T#p~%T6d5lU'x6[$UWOv%Tvw6Ow!^%T!_!`5T!`#o%T#p~%T$O6VS$UW#i#vO!^%T!_!`5T!`#o%T#p~%T'u6jZ$UW]!ROY6cYZ7]Zw6cwx*rx!^6c!^!_8T!_#O6c#O#P:T#P#o6c#o#p8T#p~6c&r7bV$UWOw7]wx*Px!^7]!^!_7w!_#o7]#o#p7w#p~7]&j7zROw7wwx*mx~7w'm8YV]!ROY8TYZ7wZw8Twx+px#O8T#O#P8o#P~8T'm8rROw8Twx8{x~8T'm9SU$P&j]!ROY9fZw9fwx-Vx#O9f#O#P9}#P~9f!R9kU]!ROY9fZw9fwx-Vx#O9f#O#P9}#P~9f!R:QPO~9f'u:YV$UWOw6cwx:ox!^6c!^!_8T!_#o6c#o#p8T#p~6c'u:xZ$P&j$UW]!ROY;kYZ%TZw;kwx/rx!^;k!^!_9f!_#O;k#O#PW{!^%T!_!`5T!`#o%T#p~%T$O>_S#[#v$UWO!^%T!_!`5T!`#o%T#p~%T$u>rSj$m$UWO!^%T!_!`5T!`#o%T#p~%T&i?VR!R&a$UWO!^%T!_#o%T#p~%T7Z?gVu6`$UWO!O%T!O!P?|!P!Q%T!Q![@r![!^%T!_#o%T#p~%Ty@RT$UWO!O%T!O!P@b!P!^%T!_#o%T#p~%Ty@iR!Qq$UWO!^%T!_#o%T#p~%Ty@yZ$UWkqO!Q%T!Q![@r![!^%T!_!g%T!g!hAl!h#R%T#R#S@r#S#X%T#X#YAl#Y#o%T#p~%TyAqZ$UWO{%T{|Bd|}%T}!OBd!O!Q%T!Q![CO![!^%T!_#R%T#R#SCO#S#o%T#p~%TyBiV$UWO!Q%T!Q![CO![!^%T!_#R%T#R#SCO#S#o%T#p~%TyCVV$UWkqO!Q%T!Q![CO![!^%T!_#R%T#R#SCO#S#o%T#p~%T7ZCs`$UW#]#vOYDuYZ%TZzDuz{Jl{!PDu!P!Q!-e!Q!^Du!^!_Fx!_!`!.^!`!a!/]!a!}Du!}#OHq#O#PJQ#P#oDu#o#pFx#p~DuXD|[$UW}POYDuYZ%TZ!PDu!P!QEr!Q!^Du!^!_Fx!_!}Du!}#OHq#O#PJQ#P#oDu#o#pFx#p~DuXEy_$UW}PO!^%T!_#Z%T#Z#[Er#[#]%T#]#^Er#^#a%T#a#bEr#b#g%T#g#hEr#h#i%T#i#jEr#j#m%T#m#nEr#n#o%T#p~%TPF}V}POYFxZ!PFx!P!QGd!Q!}Fx!}#OG{#O#PHh#P~FxPGiU}P#Z#[Gd#]#^Gd#a#bGd#g#hGd#i#jGd#m#nGdPHOTOYG{Z#OG{#O#PH_#P#QFx#Q~G{PHbQOYG{Z~G{PHkQOYFxZ~FxXHvY$UWOYHqYZ%TZ!^Hq!^!_G{!_#OHq#O#PIf#P#QDu#Q#oHq#o#pG{#p~HqXIkV$UWOYHqYZ%TZ!^Hq!^!_G{!_#oHq#o#pG{#p~HqXJVV$UWOYDuYZ%TZ!^Du!^!_Fx!_#oDu#o#pFx#p~Du7ZJs^$UW}POYJlYZKoZzJlz{NQ{!PJl!P!Q!,R!Q!^Jl!^!_!!]!_!}Jl!}#O!'|#O#P!+a#P#oJl#o#p!!]#p~Jl7ZKtV$UWOzKoz{LZ{!^Ko!^!_M]!_#oKo#o#pM]#p~Ko7ZL`X$UWOzKoz{LZ{!PKo!P!QL{!Q!^Ko!^!_M]!_#oKo#o#pM]#p~Ko7ZMSR$UWU7RO!^%T!_#o%T#p~%T7RM`ROzM]z{Mi{~M]7RMlTOzM]z{Mi{!PM]!P!QM{!Q~M]7RNQOU7R7ZNX^$UW}POYJlYZKoZzJlz{NQ{!PJl!P!Q! T!Q!^Jl!^!_!!]!_!}Jl!}#O!'|#O#P!+a#P#oJl#o#p!!]#p~Jl7Z! ^_$UWU7R}PO!^%T!_#Z%T#Z#[Er#[#]%T#]#^Er#^#a%T#a#bEr#b#g%T#g#hEr#h#i%T#i#jEr#j#m%T#m#nEr#n#o%T#p~%T7R!!bY}POY!!]YZM]Zz!!]z{!#Q{!P!!]!P!Q!&x!Q!}!!]!}#O!$`#O#P!&f#P~!!]7R!#VY}POY!!]YZM]Zz!!]z{!#Q{!P!!]!P!Q!#u!Q!}!!]!}#O!$`#O#P!&f#P~!!]7R!#|UU7R}P#Z#[Gd#]#^Gd#a#bGd#g#hGd#i#jGd#m#nGd7R!$cWOY!$`YZM]Zz!$`z{!${{#O!$`#O#P!&S#P#Q!!]#Q~!$`7R!%OYOY!$`YZM]Zz!$`z{!${{!P!$`!P!Q!%n!Q#O!$`#O#P!&S#P#Q!!]#Q~!$`7R!%sTU7ROYG{Z#OG{#O#PH_#P#QFx#Q~G{7R!&VTOY!$`YZM]Zz!$`z{!${{~!$`7R!&iTOY!!]YZM]Zz!!]z{!#Q{~!!]7R!&}_}POzM]z{Mi{#ZM]#Z#[!&x#[#]M]#]#^!&x#^#aM]#a#b!&x#b#gM]#g#h!&x#h#iM]#i#j!&x#j#mM]#m#n!&x#n~M]7Z!(R[$UWOY!'|YZKoZz!'|z{!(w{!^!'|!^!_!$`!_#O!'|#O#P!*o#P#QJl#Q#o!'|#o#p!$`#p~!'|7Z!(|^$UWOY!'|YZKoZz!'|z{!(w{!P!'|!P!Q!)x!Q!^!'|!^!_!$`!_#O!'|#O#P!*o#P#QJl#Q#o!'|#o#p!$`#p~!'|7Z!*PY$UWU7ROYHqYZ%TZ!^Hq!^!_G{!_#OHq#O#PIf#P#QDu#Q#oHq#o#pG{#p~Hq7Z!*tX$UWOY!'|YZKoZz!'|z{!(w{!^!'|!^!_!$`!_#o!'|#o#p!$`#p~!'|7Z!+fX$UWOYJlYZKoZzJlz{NQ{!^Jl!^!_!!]!_#oJl#o#p!!]#p~Jl7Z!,Yc$UW}POzKoz{LZ{!^Ko!^!_M]!_#ZKo#Z#[!,R#[#]Ko#]#^!,R#^#aKo#a#b!,R#b#gKo#g#h!,R#h#iKo#i#j!,R#j#mKo#m#n!,R#n#oKo#o#pM]#p~Ko7Z!-lV$UWT7ROY!-eYZ%TZ!^!-e!^!_!.R!_#o!-e#o#p!.R#p~!-e7R!.WQT7ROY!.RZ~!.R$P!.g[$UW#o#v}POYDuYZ%TZ!PDu!P!QEr!Q!^Du!^!_Fx!_!}Du!}#OHq#O#PJQ#P#oDu#o#pFx#p~Du]!/f[#wS$UW}POYDuYZ%TZ!PDu!P!QEr!Q!^Du!^!_Fx!_!}Du!}#OHq#O#PJQ#P#oDu#o#pFx#p~Duy!0cd$UWkqO!O%T!O!P@r!P!Q%T!Q![!1q![!^%T!_!g%T!g!hAl!h#R%T#R#S!1q#S#U%T#U#V!3X#V#X%T#X#YAl#Y#b%T#b#c!2w#c#d!4m#d#l%T#l#m!5{#m#o%T#p~%Ty!1x_$UWkqO!O%T!O!P@r!P!Q%T!Q![!1q![!^%T!_!g%T!g!hAl!h#R%T#R#S!1q#S#X%T#X#YAl#Y#b%T#b#c!2w#c#o%T#p~%Ty!3OR$UWkqO!^%T!_#o%T#p~%Ty!3^W$UWO!Q%T!Q!R!3v!R!S!3v!S!^%T!_#R%T#R#S!3v#S#o%T#p~%Ty!3}Y$UWkqO!Q%T!Q!R!3v!R!S!3v!S!^%T!_#R%T#R#S!3v#S#b%T#b#c!2w#c#o%T#p~%Ty!4rV$UWO!Q%T!Q!Y!5X!Y!^%T!_#R%T#R#S!5X#S#o%T#p~%Ty!5`X$UWkqO!Q%T!Q!Y!5X!Y!^%T!_#R%T#R#S!5X#S#b%T#b#c!2w#c#o%T#p~%Ty!6QZ$UWO!Q%T!Q![!6s![!^%T!_!c%T!c!i!6s!i#R%T#R#S!6s#S#T%T#T#Z!6s#Z#o%T#p~%Ty!6z]$UWkqO!Q%T!Q![!6s![!^%T!_!c%T!c!i!6s!i#R%T#R#S!6s#S#T%T#T#Z!6s#Z#b%T#b#c!2w#c#o%T#p~%T%w!7|R!]V$UW#m%hO!^%T!_#o%T#p~%T!P!8^R_w$UWO!^%T!_#o%T#p~%T6i!8rR'bd!a0`#x&s'|P!P!Q!8{!^!_!9Q!_!`!9_W!9QO$WW#v!9VP#`#v!_!`!9Y#v!9_O#o#v#v!9dO#a#v%w!9kT!{%o$UWO!^%T!_!`'v!`!a!9z!a#o%T#p~%T$P!:RR#W#w$UWO!^%T!_#o%T#p~%T%w!:gT'a!s#a#v$RS$UWO!^%T!_!`!:v!`!a!;W!a#o%T#p~%T$O!:}R#a#v$UWO!^%T!_#o%T#p~%T$O!;_T#`#v$UWO!^%T!_!`5T!`!a!;n!a#o%T#p~%T$O!;uS#`#v$UWO!^%T!_!`5T!`#o%T#p~%T6i!]S#g#v$UWO!^%T!_!`5T!`#o%T#p~%T$P!>pR$UW'f#wO!^%T!_#o%T#p~%T~!?OO!T~6d!?VT'w6[$UWO!^%T!_!`5T!`#o%T#p#q!=P#q~%T5g!?oR!S5]nQ$UWO!^%T!_#o%T#p~%TX!@PR!kP$UWO!^%T!_#o%T#p~%T7Z!@gr$UW'Y7R#zS']%k'g2bOX%TXY%cYZ%TZ[%c[p%Tpq%cqt%Ttu2`u}%T}!O3j!O!Q%T!Q![2`![!^%T!_!c%T!c!}2`!}#R%T#R#S2`#S#T%T#T#o2`#p$f%T$f$g%c$g#BY2`#BY#BZ!@Y#BZ$IS2`$IS$I_!@Y$I_$JT2`$JT$JU!@Y$JU$KV2`$KV$KW!@Y$KW&FU2`&FU&FV!@Y&FV?HT2`?HT?HU!@Y?HU~2`7Z!CO_$UW'Z7R#zS']%k'g2bOt%Ttu2`u}%T}!O3j!O!Q%T!Q![2`![!^%T!_!c%T!c!}2`!}#R%T#R#S2`#S#T%T#T#o2`#p$g%T$g~2`",tokenizers:[RJe,$Je,qJe,0,1,2,3,4,5,6,7,8,9,BJe],topRules:{Script:[0,7]},dialects:{jsx:11707,ts:11709},dynamicPrecedences:{149:1,176:1},specialized:[{term:289,get:(e,t)=>LJe(e,t)<<1},{term:289,get:e=>UJe[e]||-1},{term:299,get:e=>WJe[e]||-1},{term:63,get:e=>HJe[e]||-1}],tokenPrec:11730});var VJe=0,vD=class{constructor(t,r){this.from=t,this.to=r}},Di=class{constructor(t={}){this.id=VJe++,this.perNode=!!t.perNode,this.deserialize=t.deserialize||(()=>{throw new Error("This node type doesn't define a deserialize function")})}add(t){if(this.perNode)throw new RangeError("Can't add per-node props to node types");return typeof t!="function"&&(t=Yu.match(t)),r=>{let n=t(r);return n===void 0?null:[this,n]}}};Di.closedBy=new Di({deserialize:e=>e.split(" ")});Di.openedBy=new Di({deserialize:e=>e.split(" ")});Di.group=new Di({deserialize:e=>e.split(" ")});Di.contextHash=new Di({perNode:!0});Di.lookAhead=new Di({perNode:!0});Di.mounted=new Di({perNode:!0});var GJe=Object.create(null),Yu=class{constructor(t,r,n,i=0){this.name=t,this.props=r,this.id=n,this.flags=i}static define(t){let r=t.props&&t.props.length?Object.create(null):GJe,n=(t.top?1:0)|(t.skipped?2:0)|(t.error?4:0)|(t.name==null?8:0),i=new Yu(t.name||"",r,t.id,n);if(t.props){for(let a of t.props)if(Array.isArray(a)||(a=a(i)),a){if(a[0].perNode)throw new RangeError("Can't store a per-node prop on a node type");r[a[0].id]=a[1]}}return i}prop(t){return this.props[t.id]}get isTop(){return(this.flags&1)>0}get isSkipped(){return(this.flags&2)>0}get isError(){return(this.flags&4)>0}get isAnonymous(){return(this.flags&8)>0}is(t){if(typeof t=="string"){if(this.name==t)return!0;let r=this.prop(Di.group);return r?r.indexOf(t)>-1:!1}return this.id==t}static match(t){let r=Object.create(null);for(let n in t)for(let i of n.split(" "))r[i]=t[n];return n=>{for(let i=n.prop(Di.group),a=-1;a<(i?i.length:0);a++){let o=r[a<0?n.name:i[a]];if(o)return o}}}};Yu.none=new Yu("",Object.create(null),0,8);var X9=new WeakMap,dke=new WeakMap,Ss;(function(e){e[e.ExcludeBuffers=1]="ExcludeBuffers",e[e.IncludeAnonymous=2]="IncludeAnonymous",e[e.IgnoreMounts=4]="IgnoreMounts",e[e.IgnoreOverlays=8]="IgnoreOverlays"})(Ss||(Ss={}));var Es=class{constructor(t,r,n,i,a){if(this.type=t,this.children=r,this.positions=n,this.length=i,this.props=null,a&&a.length){this.props=Object.create(null);for(let[o,s]of a)this.props[typeof o=="number"?o:o.id]=s}}toString(){let t=this.prop(Di.mounted);if(t&&!t.overlay)return t.tree.toString();let r="";for(let n of this.children){let i=n.toString();i&&(r&&(r+=","),r+=i)}return this.type.name?(/\W/.test(this.type.name)&&!this.type.isError?JSON.stringify(this.type.name):this.type.name)+(r.length?"("+r+")":""):r}cursor(t=0){return new I2(this.topNode,t)}cursorAt(t,r=0,n=0){let i=X9.get(this)||this.topNode,a=new I2(i);return a.moveTo(t,r),X9.set(this,a._tree),a}get topNode(){return new Pf(this,0,0,null)}resolve(t,r=0){let n=P2(X9.get(this)||this.topNode,t,r,!1);return X9.set(this,n),n}resolveInner(t,r=0){let n=P2(dke.get(this)||this.topNode,t,r,!0);return dke.set(this,n),n}iterate(t){let{enter:r,leave:n,from:i=0,to:a=this.length}=t;for(let o=this.cursor((t.mode||0)|Ss.IncludeAnonymous);;){let s=!1;if(o.from<=a&&o.to>=i&&(o.type.isAnonymous||r(o)!==!1)){if(o.firstChild())continue;s=!0}for(;s&&n&&!o.type.isAnonymous&&n(o),!o.nextSibling();){if(!o.parent())return;s=!0}}}prop(t){return t.perNode?this.props?this.props[t.id]:void 0:this.type.prop(t)}get propValues(){let t=[];if(this.props)for(let r in this.props)t.push([+r,this.props[r]]);return t}balance(t={}){return this.children.length<=8?this:tZ(Yu.none,this.children,this.positions,0,this.children.length,0,this.length,(r,n,i)=>new Es(this.type,r,n,i,this.propValues),t.makeTree||((r,n,i)=>new Es(Yu.none,r,n,i)))}static build(t){return QJe(t)}};Es.empty=new Es(Yu.none,[],[],0);var yD=class{constructor(t,r){this.buffer=t,this.index=r}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}get pos(){return this.index}next(){this.index-=4}fork(){return new yD(this.buffer,this.index)}},pg=class{constructor(t,r,n){this.buffer=t,this.length=r,this.set=n}get type(){return Yu.none}toString(){let t=[];for(let r=0;r0));l=o[l+3]);return s}slice(t,r,n,i){let a=this.buffer,o=new Uint16Array(r-t);for(let s=t,l=0;s=t&&rt;case 1:return r<=t&&n>t;case 2:return n>t;case 4:return!0}}function hke(e,t){let r=e.childBefore(t);for(;r;){let n=r.lastChild;if(!n||n.to!=r.to)break;n.type.isError&&n.from==n.to?(e=r,r=n.prevSibling):r=n}return e}function P2(e,t,r,n){for(var i;e.from==e.to||(r<1?e.from>=t:e.from>t)||(r>-1?e.to<=t:e.to0?s.length:-1;t!=u;t+=r){let c=s[t],f=l[t]+o.from;if(!!mke(i,n,f,f+c.length)){if(c instanceof pg){if(a&Ss.ExcludeBuffers)continue;let d=c.findChild(0,c.buffer.length,r,n-f,i);if(d>-1)return new Qd(new KY(o,c,t,f),null,d)}else if(a&Ss.IncludeAnonymous||!c.type.isAnonymous||eZ(c)){let d;if(!(a&Ss.IgnoreMounts)&&c.props&&(d=c.prop(Di.mounted))&&!d.overlay)return new Pf(d.tree,f,t,o);let p=new Pf(c,f,t,o);return a&Ss.IncludeAnonymous||!p.type.isAnonymous?p:p.nextChild(r<0?c.children.length-1:0,r,n,i)}}}if(a&Ss.IncludeAnonymous||!o.type.isAnonymous||(o.index>=0?t=o.index+r:t=r<0?-1:o._parent._tree.children.length,o=o._parent,!o))return null}}get firstChild(){return this.nextChild(0,1,0,4)}get lastChild(){return this.nextChild(this._tree.children.length-1,-1,0,4)}childAfter(t){return this.nextChild(0,1,t,2)}childBefore(t){return this.nextChild(this._tree.children.length-1,-1,t,-2)}enter(t,r,n=0){let i;if(!(n&Ss.IgnoreOverlays)&&(i=this._tree.prop(Di.mounted))&&i.overlay){let a=t-this.from;for(let{from:o,to:s}of i.overlay)if((r>0?o<=a:o=a:s>a))return new Pf(i.tree,i.overlay[0].from+this.from,-1,this)}return this.nextChild(0,1,t,r,n)}nextSignificantParent(){let t=this;for(;t.type.isAnonymous&&t._parent;)t=t._parent;return t}get parent(){return this._parent?this._parent.nextSignificantParent():null}get nextSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index+1,1,0,4):null}get prevSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index-1,-1,0,4):null}cursor(t=0){return new I2(this,t)}get tree(){return this._tree}toTree(){return this._tree}resolve(t,r=0){return P2(this,t,r,!1)}resolveInner(t,r=0){return P2(this,t,r,!0)}enterUnfinishedNodesBefore(t){return hke(this,t)}getChild(t,r=null,n=null){let i=J9(this,t,r,n);return i.length?i[0]:null}getChildren(t,r=null,n=null){return J9(this,t,r,n)}toString(){return this._tree.toString()}get node(){return this}matchContext(t){return e8(this,t)}};function J9(e,t,r,n){let i=e.cursor(),a=[];if(!i.firstChild())return a;if(r!=null){for(;!i.type.is(r);)if(!i.nextSibling())return a}for(;;){if(n!=null&&i.type.is(n))return a;if(i.type.is(t)&&a.push(i.node),!i.nextSibling())return n==null?a:[]}}function e8(e,t,r=t.length-1){for(let n=e.parent;r>=0;n=n.parent){if(!n)return!1;if(!n.type.isAnonymous){if(t[r]&&t[r]!=n.name)return!1;r--}}return!0}var KY=class{constructor(t,r,n,i){this.parent=t,this.buffer=r,this.index=n,this.start=i}},Qd=class{constructor(t,r,n){this.context=t,this._parent=r,this.index=n,this.type=t.buffer.set.types[t.buffer.buffer[n]]}get name(){return this.type.name}get from(){return this.context.start+this.context.buffer.buffer[this.index+1]}get to(){return this.context.start+this.context.buffer.buffer[this.index+2]}child(t,r,n){let{buffer:i}=this.context,a=i.findChild(this.index+4,i.buffer[this.index+3],t,r-this.context.start,n);return a<0?null:new Qd(this.context,this,a)}get firstChild(){return this.child(1,0,4)}get lastChild(){return this.child(-1,0,4)}childAfter(t){return this.child(1,t,2)}childBefore(t){return this.child(-1,t,-2)}enter(t,r,n=0){if(n&Ss.ExcludeBuffers)return null;let{buffer:i}=this.context,a=i.findChild(this.index+4,i.buffer[this.index+3],r>0?1:-1,t-this.context.start,r);return a<0?null:new Qd(this.context,this,a)}get parent(){return this._parent||this.context.parent.nextSignificantParent()}externalSibling(t){return this._parent?null:this.context.parent.nextChild(this.context.index+t,t,0,4)}get nextSibling(){let{buffer:t}=this.context,r=t.buffer[this.index+3];return r<(this._parent?t.buffer[this._parent.index+3]:t.buffer.length)?new Qd(this.context,this._parent,r):this.externalSibling(1)}get prevSibling(){let{buffer:t}=this.context,r=this._parent?this._parent.index+4:0;return this.index==r?this.externalSibling(-1):new Qd(this.context,this._parent,t.findChild(r,this.index,-1,0,4))}cursor(t=0){return new I2(this,t)}get tree(){return null}toTree(){let t=[],r=[],{buffer:n}=this.context,i=this.index+4,a=n.buffer[this.index+3];if(a>i){let o=n.buffer[this.index+1],s=n.buffer[this.index+2];t.push(n.slice(i,a,o,s)),r.push(0)}return new Es(this.type,t,r,this.to-this.from)}resolve(t,r=0){return P2(this,t,r,!1)}resolveInner(t,r=0){return P2(this,t,r,!0)}enterUnfinishedNodesBefore(t){return hke(this,t)}toString(){return this.context.buffer.childString(this.index)}getChild(t,r=null,n=null){let i=J9(this,t,r,n);return i.length?i[0]:null}getChildren(t,r=null,n=null){return J9(this,t,r,n)}get node(){return this}matchContext(t){return e8(this,t)}},I2=class{constructor(t,r=0){if(this.mode=r,this.buffer=null,this.stack=[],this.index=0,this.bufferNode=null,t instanceof Pf)this.yieldNode(t);else{this._tree=t.context.parent,this.buffer=t.context;for(let n=t._parent;n;n=n._parent)this.stack.unshift(n.index);this.bufferNode=t,this.yieldBuf(t.index)}}get name(){return this.type.name}yieldNode(t){return t?(this._tree=t,this.type=t.type,this.from=t.from,this.to=t.to,!0):!1}yieldBuf(t,r){this.index=t;let{start:n,buffer:i}=this.buffer;return this.type=r||i.set.types[i.buffer[t]],this.from=n+i.buffer[t+1],this.to=n+i.buffer[t+2],!0}yield(t){return t?t instanceof Pf?(this.buffer=null,this.yieldNode(t)):(this.buffer=t.context,this.yieldBuf(t.index,t.type)):!1}toString(){return this.buffer?this.buffer.buffer.childString(this.index):this._tree.toString()}enterChild(t,r,n){if(!this.buffer)return this.yield(this._tree.nextChild(t<0?this._tree._tree.children.length-1:0,t,r,n,this.mode));let{buffer:i}=this.buffer,a=i.findChild(this.index+4,i.buffer[this.index+3],t,r-this.buffer.start,n);return a<0?!1:(this.stack.push(this.index),this.yieldBuf(a))}firstChild(){return this.enterChild(1,0,4)}lastChild(){return this.enterChild(-1,0,4)}childAfter(t){return this.enterChild(1,t,2)}childBefore(t){return this.enterChild(-1,t,-2)}enter(t,r,n=this.mode){return this.buffer?n&Ss.ExcludeBuffers?!1:this.enterChild(1,t,r):this.yield(this._tree.enter(t,r,n))}parent(){if(!this.buffer)return this.yieldNode(this.mode&Ss.IncludeAnonymous?this._tree._parent:this._tree.parent);if(this.stack.length)return this.yieldBuf(this.stack.pop());let t=this.mode&Ss.IncludeAnonymous?this.buffer.parent:this.buffer.parent.nextSignificantParent();return this.buffer=null,this.yieldNode(t)}sibling(t){if(!this.buffer)return this._tree._parent?this.yield(this._tree.index<0?null:this._tree._parent.nextChild(this._tree.index+t,t,0,4,this.mode)):!1;let{buffer:r}=this.buffer,n=this.stack.length-1;if(t<0){let i=n<0?0:this.stack[n]+4;if(this.index!=i)return this.yieldBuf(r.findChild(i,this.index,-1,0,4))}else{let i=r.buffer[this.index+3];if(i<(n<0?r.buffer.length:r.buffer[this.stack[n]+3]))return this.yieldBuf(i)}return n<0?this.yield(this.buffer.parent.nextChild(this.buffer.index+t,t,0,4,this.mode)):!1}nextSibling(){return this.sibling(1)}prevSibling(){return this.sibling(-1)}atLastNode(t){let r,n,{buffer:i}=this;if(i){if(t>0){if(this.index-1)for(let a=r+t,o=t<0?-1:n._tree.children.length;a!=o;a+=t){let s=n._tree.children[a];if(this.mode&Ss.IncludeAnonymous||s instanceof pg||!s.type.isAnonymous||eZ(s))return!1}return!0}move(t,r){if(r&&this.enterChild(t,0,4))return!0;for(;;){if(this.sibling(t))return!0;if(this.atLastNode(t)||!this.parent())return!1}}next(t=!0){return this.move(1,t)}prev(t=!0){return this.move(-1,t)}moveTo(t,r=0){for(;(this.from==this.to||(r<1?this.from>=t:this.from>t)||(r>-1?this.to<=t:this.to=0;){for(let o=t;o;o=o._parent)if(o.index==i){if(i==this.index)return o;r=o,n=a+1;break e}i=this.stack[--a]}}for(let i=n;i=0;a--){if(a<0)return e8(this.node,t,i);let o=n[r.buffer[this.stack[a]]];if(!o.isAnonymous){if(t[i]&&t[i]!=o.name)return!1;i--}}return!0}};function eZ(e){return e.children.some(t=>t instanceof pg||!t.type.isAnonymous||eZ(t))}function QJe(e){var t;let{buffer:r,nodeSet:n,maxBufferLength:i=1024,reused:a=[],minRepeatType:o=n.types.length}=e,s=Array.isArray(r)?new yD(r,r.length):r,l=n.types,u=0,c=0;function f(x,w,S,k,j){let{id:O,start:C,end:N,size:D}=s,P=c;for(;D<0;)if(s.next(),D==-1){let L=a[O];S.push(L),k.push(C-x);return}else if(D==-3){u=O;return}else if(D==-4){c=O;return}else throw new RangeError(`Unrecognized record size: ${D}`);let q=l[O],z,I,T=C-x;if(N-C<=i&&(I=m(s.pos-w,j))){let L=new Uint16Array(I.size-I.skip),_=s.pos-I.size,Y=L.length;for(;s.pos>_;)Y=g(I.start,L,Y);z=new pg(L,N-I.start,n),T=I.start-x}else{let L=s.pos-D;s.next();let _=[],Y=[],oe=O>=o?O:-1,te=0,Q=N;for(;s.pos>L;)oe>=0&&s.id==oe&&s.size>=0?(s.end<=Q-i&&(p(_,Y,C,te,s.end,Q,oe,P),te=_.length,Q=s.end),s.next()):f(C,L,_,Y,oe);if(oe>=0&&te>0&&te<_.length&&p(_,Y,C,te,C,Q,oe,P),_.reverse(),Y.reverse(),oe>-1&&te>0){let fe=d(q);z=tZ(q,_,Y,0,_.length,0,N-C,fe,fe)}else z=h(q,_,Y,N-C,P-N)}S.push(z),k.push(T)}function d(x){return(w,S,k)=>{let j=0,O=w.length-1,C,N;if(O>=0&&(C=w[O])instanceof Es){if(!O&&C.type==x&&C.length==k)return C;(N=C.prop(Di.lookAhead))&&(j=S[O]+C.length+N)}return h(x,w,S,k,j)}}function p(x,w,S,k,j,O,C,N){let D=[],P=[];for(;x.length>k;)D.push(x.pop()),P.push(w.pop()+S-j);x.push(h(n.types[C],D,P,O-j,N-O)),w.push(j-S)}function h(x,w,S,k,j=0,O){if(u){let C=[Di.contextHash,u];O=O?[C].concat(O):[C]}if(j>25){let C=[Di.lookAhead,j];O=O?[C].concat(O):[C]}return new Es(x,w,S,k,O)}function m(x,w){let S=s.fork(),k=0,j=0,O=0,C=S.end-i,N={size:0,start:0,skip:0};e:for(let D=S.pos-x;S.pos>D;){let P=S.size;if(S.id==w&&P>=0){N.size=k,N.start=j,N.skip=O,O+=4,k+=4,S.next();continue}let q=S.pos-P;if(P<0||q=o?4:0,I=S.start;for(S.next();S.pos>q;){if(S.size<0)if(S.size==-3)z+=4;else break e;else S.id>=o&&(z+=4);S.next()}j=I,k+=P,O+=z}return(w<0||k==x)&&(N.size=k,N.start=j,N.skip=O),N.size>4?N:void 0}function g(x,w,S){let{id:k,start:j,end:O,size:C}=s;if(s.next(),C>=0&&k4){let D=s.pos-(C-4);for(;s.pos>D;)S=g(x,w,S)}w[--S]=N,w[--S]=O-x,w[--S]=j-x,w[--S]=k}else C==-3?u=k:C==-4&&(c=k);return S}let A=[],b=[];for(;s.pos>0;)f(e.start||0,e.bufferStart||0,A,b,-1);let v=(t=e.length)!==null&&t!==void 0?t:A.length?b[0]+A[0].length:0;return new Es(l[e.topID],A.reverse(),b.reverse(),v)}var pke=new WeakMap;function K9(e,t){if(!e.isAnonymous||t instanceof pg||t.type!=e)return 1;let r=pke.get(t);if(r==null){r=1;for(let n of t.children){if(n.type!=e||!(n instanceof Es)){r=1;break}r+=K9(e,n)}pke.set(t,r)}return r}function tZ(e,t,r,n,i,a,o,s,l){let u=0;for(let h=n;h=c)break;S+=k}if(v==x+1){if(S>c){let k=h[x];p(k.children,k.positions,0,k.children.length,m[x]+b);continue}f.push(h[x])}else{let k=m[v-1]+h[v-1].length-w;f.push(tZ(e,h,m,x,v,w,k,null,l))}d.push(w+b-a)}}return p(t,r,n,i,0),(s||l)(f,d,o)}var t8=class{constructor(){this.map=new WeakMap}setBuffer(t,r,n){let i=this.map.get(t);i||this.map.set(t,i=new Map),i.set(r,n)}getBuffer(t,r){let n=this.map.get(t);return n&&n.get(r)}set(t,r){t instanceof Qd?this.setBuffer(t.context.buffer,t.index,r):t instanceof Pf&&this.map.set(t.tree,r)}get(t){return t instanceof Qd?this.getBuffer(t.context.buffer,t.index):t instanceof Pf?this.map.get(t.tree):void 0}cursorSet(t,r){t.buffer?this.setBuffer(t.buffer.buffer,t.index,r):this.map.set(t.tree,r)}cursorGet(t){return t.buffer?this.getBuffer(t.buffer.buffer,t.index):this.map.get(t.tree)}},Ch=class{constructor(t,r,n,i,a=!1,o=!1){this.from=t,this.to=r,this.tree=n,this.offset=i,this.open=(a?1:0)|(o?2:0)}get openStart(){return(this.open&1)>0}get openEnd(){return(this.open&2)>0}static addTree(t,r=[],n=!1){let i=[new Ch(0,t.length,t,0,!1,n)];for(let a of r)a.to>t.length&&i.push(a);return i}static applyChanges(t,r,n=128){if(!r.length)return t;let i=[],a=1,o=t.length?t[0]:null;for(let s=0,l=0,u=0;;s++){let c=s=n)for(;o&&o.from=d.from||f<=d.to||u){let p=Math.max(d.from,l)-u,h=Math.min(d.to,f)-u;d=p>=h?null:new Ch(p,h,d.tree,d.offset+u,s>0,!!c)}if(d&&i.push(d),o.to>f)break;o=anew vD(i.from,i.to)):[new vD(0,0)]:[new vD(0,t.length)],this.createParse(t,r||[],n)}parse(t,r,n){let i=this.startParse(t,r,n);for(;;){let a=i.advance();if(a)return a}}},JY=class{constructor(t){this.string=t}get length(){return this.string.length}chunk(t){return this.string.slice(t)}get lineChunks(){return!1}read(t,r){return this.string.slice(t,r)}};var Mmr=new Di({perNode:!0});var Au=require("@codemirror/state"),mg=require("@codemirror/view");var YJe=0,Yd=class{constructor(t,r,n){this.set=t,this.base=r,this.modified=n,this.id=YJe++}static define(t){if(t?.base)throw new Error("Can not derive from a modified tag");let r=new Yd([],null,[]);if(r.set.push(r),t)for(let n of t.set)r.set.push(n);return r}static defineModifier(){let t=new B2;return r=>r.modified.indexOf(t)>-1?r:B2.get(r.base||r,r.modified.concat(t).sort((n,i)=>n.id-i.id))}},ZJe=0,B2=class{constructor(){this.instances=[],this.id=ZJe++}static get(t,r){if(!r.length)return t;let n=r[0].instances.find(s=>s.base==t&&XJe(r,s.modified));if(n)return n;let i=[],a=new Yd(i,t,r);for(let s of r)s.instances.push(a);let o=vke(r);for(let s of t.set)for(let l of o)i.push(B2.get(s,l));return a}};function XJe(e,t){return e.length==t.length&&e.every((r,n)=>r==t[n])}function vke(e){let t=[e];for(let r=0;r0&&f+3==i.length){o=1;break}let d=/^"(?:[^"\\]|\\.)*?"|[^\/!]+/.exec(s);if(!d)throw new RangeError("Invalid path: "+i);if(a.push(d[0]=="*"?"":d[0][0]=='"'?JSON.parse(d[0]):d[0]),f+=d[0].length,f==i.length)break;let p=i[f++];if(f==i.length&&p=="!"){o=0;break}if(p!="/")throw new RangeError("Invalid path: "+i);s=i.slice(f)}let l=a.length-1,u=a[l];if(!u)throw new RangeError("Invalid path: "+i);let c=new nZ(n,o,l>0?a.slice(0,l):null);t[u]=c.sort(t[u])}}return KJe.add(t)}var KJe=new Di,nZ=class{constructor(t,r,n,i){this.tags=t,this.mode=r,this.context=n,this.next=i}sort(t){return!t||t.depth{let o=i;for(let s of a)for(let l of s.set){let u=r[l.id];if(u){o=o?o+" "+u:u;break}}return o},scope:n}}var Ft=Yd.define,n8=Ft(),Iv=Ft(),Ake=Ft(Iv),gke=Ft(Iv),Bv=Ft(),i8=Ft(Bv),rZ=Ft(Bv),Mh=Ft(),lb=Ft(Mh),Dh=Ft(),Oh=Ft(),iZ=Ft(),bD=Ft(iZ),a8=Ft(),$t={comment:n8,lineComment:Ft(n8),blockComment:Ft(n8),docComment:Ft(n8),name:Iv,variableName:Ft(Iv),typeName:Ake,tagName:Ft(Ake),propertyName:gke,attributeName:Ft(gke),className:Ft(Iv),labelName:Ft(Iv),namespace:Ft(Iv),macroName:Ft(Iv),literal:Bv,string:i8,docString:Ft(i8),character:Ft(i8),attributeValue:Ft(i8),number:rZ,integer:Ft(rZ),float:Ft(rZ),bool:Ft(Bv),regexp:Ft(Bv),escape:Ft(Bv),color:Ft(Bv),url:Ft(Bv),keyword:Dh,self:Ft(Dh),null:Ft(Dh),atom:Ft(Dh),unit:Ft(Dh),modifier:Ft(Dh),operatorKeyword:Ft(Dh),controlKeyword:Ft(Dh),definitionKeyword:Ft(Dh),moduleKeyword:Ft(Dh),operator:Oh,derefOperator:Ft(Oh),arithmeticOperator:Ft(Oh),logicOperator:Ft(Oh),bitwiseOperator:Ft(Oh),compareOperator:Ft(Oh),updateOperator:Ft(Oh),definitionOperator:Ft(Oh),typeOperator:Ft(Oh),controlOperator:Ft(Oh),punctuation:iZ,separator:Ft(iZ),bracket:bD,angleBracket:Ft(bD),squareBracket:Ft(bD),paren:Ft(bD),brace:Ft(bD),content:Mh,heading:lb,heading1:Ft(lb),heading2:Ft(lb),heading3:Ft(lb),heading4:Ft(lb),heading5:Ft(lb),heading6:Ft(lb),contentSeparator:Ft(Mh),list:Ft(Mh),quote:Ft(Mh),emphasis:Ft(Mh),strong:Ft(Mh),link:Ft(Mh),monospace:Ft(Mh),strikethrough:Ft(Mh),inserted:Ft(),deleted:Ft(),changed:Ft(),invalid:Ft(),meta:a8,documentMeta:Ft(a8),annotation:Ft(a8),processingInstruction:Ft(a8),definition:Yd.defineModifier(),constant:Yd.defineModifier(),function:Yd.defineModifier(),standard:Yd.defineModifier(),local:Yd.defineModifier(),special:Yd.defineModifier()},Tmr=aZ([{tag:$t.link,class:"tok-link"},{tag:$t.heading,class:"tok-heading"},{tag:$t.emphasis,class:"tok-emphasis"},{tag:$t.strong,class:"tok-strong"},{tag:$t.keyword,class:"tok-keyword"},{tag:$t.atom,class:"tok-atom"},{tag:$t.bool,class:"tok-bool"},{tag:$t.url,class:"tok-url"},{tag:$t.labelName,class:"tok-labelName"},{tag:$t.inserted,class:"tok-inserted"},{tag:$t.deleted,class:"tok-deleted"},{tag:$t.literal,class:"tok-literal"},{tag:$t.string,class:"tok-string"},{tag:$t.number,class:"tok-number"},{tag:[$t.regexp,$t.escape,$t.special($t.string)],class:"tok-string2"},{tag:$t.variableName,class:"tok-variableName"},{tag:$t.local($t.variableName),class:"tok-variableName tok-local"},{tag:$t.definition($t.variableName),class:"tok-variableName tok-definition"},{tag:$t.special($t.variableName),class:"tok-variableName2"},{tag:$t.definition($t.propertyName),class:"tok-propertyName tok-definition"},{tag:$t.typeName,class:"tok-typeName"},{tag:$t.namespace,class:"tok-namespace"},{tag:$t.className,class:"tok-className"},{tag:$t.macroName,class:"tok-macroName"},{tag:$t.propertyName,class:"tok-propertyName"},{tag:$t.operator,class:"tok-operator"},{tag:$t.comment,class:"tok-comment"},{tag:$t.meta,class:"tok-meta"},{tag:$t.invalid,class:"tok-invalid"},{tag:$t.punctuation,class:"tok-punctuation"}]);var oZ,wD=new Di;function JJe(e){return Au.Facet.define({combine:e?t=>t.concat(e):void 0})}var If=class{constructor(t,r,n=[]){this.data=t,Au.EditorState.prototype.hasOwnProperty("tree")||Object.defineProperty(Au.EditorState.prototype,"tree",{get(){return R2(this)}}),this.parser=r,this.extension=[q2.of(this),Au.EditorState.languageData.of((i,a,o)=>i.facet(bke(i,a,o)))].concat(n)}isActiveAt(t,r,n=-1){return bke(t,r,n)==this.data}findRegions(t){let r=t.facet(q2);if(r?.data==this.data)return[{from:0,to:t.doc.length}];if(!r||!r.allowsNesting)return[];let n=[],i=(a,o)=>{if(a.prop(wD)==this.data){n.push({from:o,to:o+a.length});return}let s=a.prop(Di.mounted);if(s){if(s.tree.prop(wD)==this.data){if(s.overlay)for(let l of s.overlay)n.push({from:l.from+o,to:l.to+o});else n.push({from:o,to:o+a.length});return}else if(s.overlay){let l=n.length;if(i(s.tree,s.overlay[0].from+o),n.length>l)return}}for(let l=0;ln.isTop?r:void 0)]}))}configure(t){return new ub(this.data,this.parser.configure(t))}get allowsNesting(){return this.parser.hasWrappers()}};function R2(e){let t=e.field(If.state,!1);return t?t.tree:Es.empty}var uZ=class{constructor(t,r=t.length){this.doc=t,this.length=r,this.cursorPos=0,this.string="",this.cursor=t.iter()}syncTo(t){return this.string=this.cursor.next(t-this.cursorPos).value,this.cursorPos=t+this.string.length,this.cursorPos-this.string.length}chunk(t){return this.syncTo(t),this.string}get lineChunks(){return!0}read(t,r){let n=this.cursorPos-this.string.length;return t=this.cursorPos?this.doc.sliceString(t,r):this.string.slice(t-n,r-n)}},xD=null,$2=class{constructor(t,r,n=[],i,a,o,s,l){this.parser=t,this.state=r,this.fragments=n,this.tree=i,this.treeLen=a,this.viewport=o,this.skipped=s,this.scheduleOn=l,this.parse=null,this.tempSkipped=[]}static create(t,r,n){return new $2(t,r,[],Es.empty,0,n,[],null)}startParse(){return this.parser.startParse(new uZ(this.state.doc),this.fragments)}work(t,r){return r!=null&&r>=this.state.doc.length&&(r=void 0),this.tree!=Es.empty&&this.isDone(r??this.state.doc.length)?(this.takeTree(),!0):this.withContext(()=>{var n;if(typeof t=="number"){let i=Date.now()+t;t=()=>Date.now()>i}for(this.parse||(this.parse=this.startParse()),r!=null&&(this.parse.stoppedAt==null||this.parse.stoppedAt>r)&&r=this.treeLen&&((this.parse.stoppedAt==null||this.parse.stoppedAt>t)&&this.parse.stopAt(t),this.withContext(()=>{for(;!(r=this.parse.advance()););}),this.treeLen=t,this.tree=r,this.fragments=this.withoutTempSkipped(Ch.addTree(this.tree,this.fragments,!0)),this.parse=null)}withContext(t){let r=xD;xD=this;try{return t()}finally{xD=r}}withoutTempSkipped(t){for(let r;r=this.tempSkipped.pop();)t=xke(t,r.from,r.to);return t}changes(t,r){let{fragments:n,tree:i,treeLen:a,viewport:o,skipped:s}=this;if(this.takeTree(),!t.empty){let l=[];if(t.iterChangedRanges((u,c,f,d)=>l.push({fromA:u,toA:c,fromB:f,toB:d})),n=Ch.applyChanges(n,l),i=Es.empty,a=0,o={from:t.mapPos(o.from,-1),to:t.mapPos(o.to,1)},this.skipped.length){s=[];for(let u of this.skipped){let c=t.mapPos(u.from,1),f=t.mapPos(u.to,-1);ct.from&&(this.fragments=xke(this.fragments,i,a),this.skipped.splice(n--,1))}return this.skipped.length>=r?!1:(this.reset(),!0)}reset(){this.parse&&(this.takeTree(),this.parse=null)}skipUntilInView(t,r){this.skipped.push({from:t,to:r})}static getSkippingParser(t){return new class extends r8{createParse(r,n,i){let a=i[0].from,o=i[i.length-1].to;return{parsedPos:a,advance(){let l=xD;if(l){for(let u of i)l.tempSkipped.push(u);t&&(l.scheduleOn=l.scheduleOn?Promise.all([l.scheduleOn,t]):t)}return this.parsedPos=o,new Es(Yu.none,[],[],o-a)},stoppedAt:null,stopAt(){}}}}}isDone(t){t=Math.min(t,this.state.doc.length);let r=this.fragments;return this.treeLen>=t&&r.length&&r[0].from==0&&r[0].to>=t}static get(){return xD}};function xke(e,t,r){return Ch.applyChanges(e,[{fromA:t,toA:r,fromB:t,toB:r}])}var Rv=class{constructor(t){this.context=t,this.tree=t.tree}apply(t){if(!t.docChanged&&this.tree==this.context.tree)return this;let r=this.context.changes(t.changes,t.state),n=this.context.treeLen==t.startState.doc.length?void 0:Math.max(t.changes.mapPos(this.context.treeLen),r.viewport.to);return r.work(20,n)||r.takeTree(),new Rv(r)}static init(t){let r=Math.min(3e3,t.doc.length),n=$2.create(t.facet(q2).parser,t,{from:0,to:r});return n.work(20,r)||n.takeTree(),new Rv(n)}};If.state=Au.StateField.define({create:Rv.init,update(e,t){for(let r of t.effects)if(r.is(If.setState))return r.value;return t.startState.facet(q2)!=t.state.facet(q2)?Rv.init(t.state):e.apply(t)}});var Eke=e=>{let t=setTimeout(()=>e(),500);return()=>clearTimeout(t)};typeof requestIdleCallback<"u"&&(Eke=e=>{let t=-1,r=setTimeout(()=>{t=requestIdleCallback(e,{timeout:500-100})},100);return()=>t<0?clearTimeout(r):cancelIdleCallback(t)});var sZ=typeof navigator<"u"&&((oZ=navigator.scheduling)===null||oZ===void 0?void 0:oZ.isInputPending)?()=>navigator.scheduling.isInputPending():null,eet=mg.ViewPlugin.fromClass(class{constructor(t){this.view=t,this.working=null,this.workScheduled=0,this.chunkEnd=-1,this.chunkBudget=-1,this.work=this.work.bind(this),this.scheduleWork()}update(t){let r=this.view.state.field(If.state).context;(r.updateViewport(t.view.viewport)||this.view.viewport.to>r.treeLen)&&this.scheduleWork(),t.docChanged&&(this.view.hasFocus&&(this.chunkBudget+=50),this.scheduleWork()),this.checkAsyncSchedule(r)}scheduleWork(){if(this.working)return;let{state:t}=this.view,r=t.field(If.state);(r.tree!=r.context.tree||!r.context.isDone(t.doc.length))&&(this.working=Eke(this.work))}work(t){this.working=null;let r=Date.now();if(this.chunkEndi+1e3,l=a.context.work(()=>sZ&&sZ()||Date.now()>o,i+(s?0:1e5));this.chunkBudget-=Date.now()-r,(l||this.chunkBudget<=0)&&(a.context.takeTree(),this.view.dispatch({effects:If.setState.of(new Rv(a.context))})),this.chunkBudget>0&&!(l&&!s)&&this.scheduleWork(),this.checkAsyncSchedule(a.context)}checkAsyncSchedule(t){t.scheduleOn&&(this.workScheduled++,t.scheduleOn.then(()=>this.scheduleWork()).catch(r=>(0,mg.logException)(this.view.state,r)).then(()=>this.workScheduled--),t.scheduleOn=null)}destroy(){this.working&&this.working()}isWorking(){return!!(this.working||this.workScheduled>0)}},{eventHandlers:{focus(){this.scheduleWork()}}}),q2=Au.Facet.define({combine(e){return e.length?e[0]:null},enables:[If.state,eet]}),o8=class{constructor(t,r=[]){this.language=t,this.support=r,this.extension=[t,r]}};var kke=new Di;function tet(e){let t=e.node,r=t.childAfter(t.from),n=t.lastChild;if(!r)return null;let i=e.options.simulateBreak,a=e.state.doc.lineAt(r.from),o=i==null||i<=a.from?a.to:Math.min(a.to,i);for(let s=r.to;;){let l=t.childAfter(s);if(!l||l==n)return null;if(!l.type.isSkipped)return l.fromret(n,t,r,e)}function ret(e,t,r,n,i){let a=e.textAfter,o=a.match(/^\s*/)[0].length,s=n&&a.slice(o,o+n.length)==n||i==e.pos+o,l=t?tet(e):null;return l?s?e.column(l.from):e.column(l.to):e.baseIndent+(s?0:e.unit*r)}var Dke=e=>e.baseIndent;function s8({except:e,units:t=1}={}){return r=>{let n=e&&e.test(r.textAfter);return r.baseIndent+(n?0:t*r.unit)}}var Oke=new Di;function Mke(e){let t=e.firstChild,r=e.lastChild;return t&&t.tos.prop(wD)==o.data:o?s=>s==o:void 0,this.style=aZ(t.map(s=>({tag:s.tag,class:s.class||i(Object.assign({},s,{tag:null}))})),{all:a}).style,this.module=n?new Qp(n):null,this.themeType=r.themeType}static define(t,r){return new SD(t,r||{})}};var qmr=SD.define([{tag:$t.meta,color:"#7a757a"},{tag:$t.link,textDecoration:"underline"},{tag:$t.heading,textDecoration:"underline",fontWeight:"bold"},{tag:$t.emphasis,fontStyle:"italic"},{tag:$t.strong,fontWeight:"bold"},{tag:$t.strikethrough,textDecoration:"line-through"},{tag:$t.keyword,color:"#708"},{tag:[$t.atom,$t.bool,$t.url,$t.contentSeparator,$t.labelName],color:"#219"},{tag:[$t.literal,$t.inserted],color:"#164"},{tag:[$t.string,$t.deleted],color:"#a11"},{tag:[$t.regexp,$t.escape,$t.special($t.string)],color:"#e40"},{tag:$t.definition($t.variableName),color:"#00f"},{tag:$t.local($t.variableName),color:"#30a"},{tag:[$t.typeName,$t.namespace],color:"#085"},{tag:$t.className,color:"#167"},{tag:[$t.special($t.variableName),$t.macroName],color:"#256"},{tag:$t.definition($t.propertyName),color:"#00c"},{tag:$t.comment,color:"#940"},{tag:$t.invalid,color:"#f00"}]);var net=Object.create(null),wke=[Yu.none];var Ske=[],iet=Object.create(null);for(let[e,t]of[["variable","variableName"],["variable-2","variableName.special"],["string-2","string.special"],["def","variableName.definition"],["tag","typeName"],["attribute","propertyName"],["type","typeName"],["builtin","variableName.standard"],["qualifier","modifier"],["error","invalid"],["header","heading"],["property","propertyName"]])iet[e]=aet(net,t);function lZ(e,t){Ske.indexOf(e)>-1||(Ske.push(e),console.warn(t))}function aet(e,t){let r=null;for(let a of t.split(".")){let o=e[a]||$t[a];o?typeof o=="function"?r?r=o(r):lZ(a,`Modifier ${a} used at start of tag`):r?lZ(a,`Tag ${a} used as modifier`):r=o:lZ(a,`Unknown highlighting tag ${a}`)}if(!r)return 0;let n=t.replace(/ /g,"_"),i=Yu.define({id:wke.length,name:n,props:[yke({[n]:r})]});return wke.push(i),i.id}var g8=require("@codemirror/state"),Jke=require("@codemirror/view");var Ji=require("@codemirror/state"),tl=require("@codemirror/view");var oet=0,ED=class{constructor(t,r){this.from=t,this.to=r}},Vi=class{constructor(t={}){this.id=oet++,this.perNode=!!t.perNode,this.deserialize=t.deserialize||(()=>{throw new Error("This node type doesn't define a deserialize function")})}add(t){if(this.perNode)throw new RangeError("Can't add per-node props to node types");return typeof t!="function"&&(t=Zu.match(t)),r=>{let n=t(r);return n===void 0?null:[this,n]}}};Vi.closedBy=new Vi({deserialize:e=>e.split(" ")});Vi.openedBy=new Vi({deserialize:e=>e.split(" ")});Vi.group=new Vi({deserialize:e=>e.split(" ")});Vi.contextHash=new Vi({perNode:!0});Vi.lookAhead=new Vi({perNode:!0});Vi.mounted=new Vi({perNode:!0});var set=Object.create(null),Zu=class{constructor(t,r,n,i=0){this.name=t,this.props=r,this.id=n,this.flags=i}static define(t){let r=t.props&&t.props.length?Object.create(null):set,n=(t.top?1:0)|(t.skipped?2:0)|(t.error?4:0)|(t.name==null?8:0),i=new Zu(t.name||"",r,t.id,n);if(t.props){for(let a of t.props)if(Array.isArray(a)||(a=a(i)),a){if(a[0].perNode)throw new RangeError("Can't store a per-node prop on a node type");r[a[0].id]=a[1]}}return i}prop(t){return this.props[t.id]}get isTop(){return(this.flags&1)>0}get isSkipped(){return(this.flags&2)>0}get isError(){return(this.flags&4)>0}get isAnonymous(){return(this.flags&8)>0}is(t){if(typeof t=="string"){if(this.name==t)return!0;let r=this.prop(Vi.group);return r?r.indexOf(t)>-1:!1}return this.id==t}static match(t){let r=Object.create(null);for(let n in t)for(let i of n.split(" "))r[i]=t[n];return n=>{for(let i=n.prop(Vi.group),a=-1;a<(i?i.length:0);a++){let o=r[a<0?n.name:i[a]];if(o)return o}}}};Zu.none=new Zu("",Object.create(null),0,8);var l8=new WeakMap,jke=new WeakMap,Il;(function(e){e[e.ExcludeBuffers=1]="ExcludeBuffers",e[e.IncludeAnonymous=2]="IncludeAnonymous",e[e.IgnoreMounts=4]="IgnoreMounts",e[e.IgnoreOverlays=8]="IgnoreOverlays"})(Il||(Il={}));var ks=class{constructor(t,r,n,i,a){if(this.type=t,this.children=r,this.positions=n,this.length=i,this.props=null,a&&a.length){this.props=Object.create(null);for(let[o,s]of a)this.props[typeof o=="number"?o:o.id]=s}}toString(){let t=this.prop(Vi.mounted);if(t&&!t.overlay)return t.tree.toString();let r="";for(let n of this.children){let i=n.toString();i&&(r&&(r+=","),r+=i)}return this.type.name?(/\W/.test(this.type.name)&&!this.type.isError?JSON.stringify(this.type.name):this.type.name)+(r.length?"("+r+")":""):r}cursor(t=0){return new z2(this.topNode,t)}cursorAt(t,r=0,n=0){let i=l8.get(this)||this.topNode,a=new z2(i);return a.moveTo(t,r),l8.set(this,a._tree),a}get topNode(){return new sm(this,0,0,null)}resolve(t,r=0){let n=L2(l8.get(this)||this.topNode,t,r,!1);return l8.set(this,n),n}resolveInner(t,r=0){let n=L2(jke.get(this)||this.topNode,t,r,!0);return jke.set(this,n),n}iterate(t){let{enter:r,leave:n,from:i=0,to:a=this.length}=t;for(let o=this.cursor((t.mode||0)|Il.IncludeAnonymous);;){let s=!1;if(o.from<=a&&o.to>=i&&(o.type.isAnonymous||r(o)!==!1)){if(o.firstChild())continue;s=!0}for(;s&&n&&!o.type.isAnonymous&&n(o),!o.nextSibling();){if(!o.parent())return;s=!0}}}prop(t){return t.perNode?this.props?this.props[t.id]:void 0:this.type.prop(t)}get propValues(){let t=[];if(this.props)for(let r in this.props)t.push([+r,this.props[r]]);return t}balance(t={}){return this.children.length<=8?this:pZ(Zu.none,this.children,this.positions,0,this.children.length,0,this.length,(r,n,i)=>new ks(this.type,r,n,i,this.propValues),t.makeTree||((r,n,i)=>new ks(Zu.none,r,n,i)))}static build(t){return uet(t)}};ks.empty=new ks(Zu.none,[],[],0);var kD=class{constructor(t,r){this.buffer=t,this.index=r}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}get pos(){return this.index}next(){this.index-=4}fork(){return new kD(this.buffer,this.index)}},hg=class{constructor(t,r,n){this.buffer=t,this.length=r,this.set=n}get type(){return Zu.none}toString(){let t=[];for(let r=0;r0));l=o[l+3]);return s}slice(t,r,n,i){let a=this.buffer,o=new Uint16Array(r-t);for(let s=t,l=0;s=t&&rt;case 1:return r<=t&&n>t;case 2:return n>t;case 4:return!0}}function Fke(e,t){let r=e.childBefore(t);for(;r;){let n=r.lastChild;if(!n||n.to!=r.to)break;n.type.isError&&n.from==n.to?(e=r,r=n.prevSibling):r=n}return e}function L2(e,t,r,n){for(var i;e.from==e.to||(r<1?e.from>=t:e.from>t)||(r>-1?e.to<=t:e.to0?s.length:-1;t!=u;t+=r){let c=s[t],f=l[t]+o.from;if(!!Tke(i,n,f,f+c.length)){if(c instanceof hg){if(a&Il.ExcludeBuffers)continue;let d=c.findChild(0,c.buffer.length,r,n-f,i);if(d>-1)return new jh(new cZ(o,c,t,f),null,d)}else if(a&Il.IncludeAnonymous||!c.type.isAnonymous||dZ(c)){let d;if(!(a&Il.IgnoreMounts)&&c.props&&(d=c.prop(Vi.mounted))&&!d.overlay)return new sm(d.tree,f,t,o);let p=new sm(c,f,t,o);return a&Il.IncludeAnonymous||!p.type.isAnonymous?p:p.nextChild(r<0?c.children.length-1:0,r,n,i)}}}if(a&Il.IncludeAnonymous||!o.type.isAnonymous||(o.index>=0?t=o.index+r:t=r<0?-1:o._parent._tree.children.length,o=o._parent,!o))return null}}get firstChild(){return this.nextChild(0,1,0,4)}get lastChild(){return this.nextChild(this._tree.children.length-1,-1,0,4)}childAfter(t){return this.nextChild(0,1,t,2)}childBefore(t){return this.nextChild(this._tree.children.length-1,-1,t,-2)}enter(t,r,n=0){let i;if(!(n&Il.IgnoreOverlays)&&(i=this._tree.prop(Vi.mounted))&&i.overlay){let a=t-this.from;for(let{from:o,to:s}of i.overlay)if((r>0?o<=a:o=a:s>a))return new sm(i.tree,i.overlay[0].from+this.from,-1,this)}return this.nextChild(0,1,t,r,n)}nextSignificantParent(){let t=this;for(;t.type.isAnonymous&&t._parent;)t=t._parent;return t}get parent(){return this._parent?this._parent.nextSignificantParent():null}get nextSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index+1,1,0,4):null}get prevSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index-1,-1,0,4):null}cursor(t=0){return new z2(this,t)}get tree(){return this._tree}toTree(){return this._tree}resolve(t,r=0){return L2(this,t,r,!1)}resolveInner(t,r=0){return L2(this,t,r,!0)}enterUnfinishedNodesBefore(t){return Fke(this,t)}getChild(t,r=null,n=null){let i=c8(this,t,r,n);return i.length?i[0]:null}getChildren(t,r=null,n=null){return c8(this,t,r,n)}toString(){return this._tree.toString()}get node(){return this}matchContext(t){return f8(this,t)}};function c8(e,t,r,n){let i=e.cursor(),a=[];if(!i.firstChild())return a;if(r!=null){for(;!i.type.is(r);)if(!i.nextSibling())return a}for(;;){if(n!=null&&i.type.is(n))return a;if(i.type.is(t)&&a.push(i.node),!i.nextSibling())return n==null?a:[]}}function f8(e,t,r=t.length-1){for(let n=e.parent;r>=0;n=n.parent){if(!n)return!1;if(!n.type.isAnonymous){if(t[r]&&t[r]!=n.name)return!1;r--}}return!0}var cZ=class{constructor(t,r,n,i){this.parent=t,this.buffer=r,this.index=n,this.start=i}},jh=class{constructor(t,r,n){this.context=t,this._parent=r,this.index=n,this.type=t.buffer.set.types[t.buffer.buffer[n]]}get name(){return this.type.name}get from(){return this.context.start+this.context.buffer.buffer[this.index+1]}get to(){return this.context.start+this.context.buffer.buffer[this.index+2]}child(t,r,n){let{buffer:i}=this.context,a=i.findChild(this.index+4,i.buffer[this.index+3],t,r-this.context.start,n);return a<0?null:new jh(this.context,this,a)}get firstChild(){return this.child(1,0,4)}get lastChild(){return this.child(-1,0,4)}childAfter(t){return this.child(1,t,2)}childBefore(t){return this.child(-1,t,-2)}enter(t,r,n=0){if(n&Il.ExcludeBuffers)return null;let{buffer:i}=this.context,a=i.findChild(this.index+4,i.buffer[this.index+3],r>0?1:-1,t-this.context.start,r);return a<0?null:new jh(this.context,this,a)}get parent(){return this._parent||this.context.parent.nextSignificantParent()}externalSibling(t){return this._parent?null:this.context.parent.nextChild(this.context.index+t,t,0,4)}get nextSibling(){let{buffer:t}=this.context,r=t.buffer[this.index+3];return r<(this._parent?t.buffer[this._parent.index+3]:t.buffer.length)?new jh(this.context,this._parent,r):this.externalSibling(1)}get prevSibling(){let{buffer:t}=this.context,r=this._parent?this._parent.index+4:0;return this.index==r?this.externalSibling(-1):new jh(this.context,this._parent,t.findChild(r,this.index,-1,0,4))}cursor(t=0){return new z2(this,t)}get tree(){return null}toTree(){let t=[],r=[],{buffer:n}=this.context,i=this.index+4,a=n.buffer[this.index+3];if(a>i){let o=n.buffer[this.index+1],s=n.buffer[this.index+2];t.push(n.slice(i,a,o,s)),r.push(0)}return new ks(this.type,t,r,this.to-this.from)}resolve(t,r=0){return L2(this,t,r,!1)}resolveInner(t,r=0){return L2(this,t,r,!0)}enterUnfinishedNodesBefore(t){return Fke(this,t)}toString(){return this.context.buffer.childString(this.index)}getChild(t,r=null,n=null){let i=c8(this,t,r,n);return i.length?i[0]:null}getChildren(t,r=null,n=null){return c8(this,t,r,n)}get node(){return this}matchContext(t){return f8(this,t)}},z2=class{constructor(t,r=0){if(this.mode=r,this.buffer=null,this.stack=[],this.index=0,this.bufferNode=null,t instanceof sm)this.yieldNode(t);else{this._tree=t.context.parent,this.buffer=t.context;for(let n=t._parent;n;n=n._parent)this.stack.unshift(n.index);this.bufferNode=t,this.yieldBuf(t.index)}}get name(){return this.type.name}yieldNode(t){return t?(this._tree=t,this.type=t.type,this.from=t.from,this.to=t.to,!0):!1}yieldBuf(t,r){this.index=t;let{start:n,buffer:i}=this.buffer;return this.type=r||i.set.types[i.buffer[t]],this.from=n+i.buffer[t+1],this.to=n+i.buffer[t+2],!0}yield(t){return t?t instanceof sm?(this.buffer=null,this.yieldNode(t)):(this.buffer=t.context,this.yieldBuf(t.index,t.type)):!1}toString(){return this.buffer?this.buffer.buffer.childString(this.index):this._tree.toString()}enterChild(t,r,n){if(!this.buffer)return this.yield(this._tree.nextChild(t<0?this._tree._tree.children.length-1:0,t,r,n,this.mode));let{buffer:i}=this.buffer,a=i.findChild(this.index+4,i.buffer[this.index+3],t,r-this.buffer.start,n);return a<0?!1:(this.stack.push(this.index),this.yieldBuf(a))}firstChild(){return this.enterChild(1,0,4)}lastChild(){return this.enterChild(-1,0,4)}childAfter(t){return this.enterChild(1,t,2)}childBefore(t){return this.enterChild(-1,t,-2)}enter(t,r,n=this.mode){return this.buffer?n&Il.ExcludeBuffers?!1:this.enterChild(1,t,r):this.yield(this._tree.enter(t,r,n))}parent(){if(!this.buffer)return this.yieldNode(this.mode&Il.IncludeAnonymous?this._tree._parent:this._tree.parent);if(this.stack.length)return this.yieldBuf(this.stack.pop());let t=this.mode&Il.IncludeAnonymous?this.buffer.parent:this.buffer.parent.nextSignificantParent();return this.buffer=null,this.yieldNode(t)}sibling(t){if(!this.buffer)return this._tree._parent?this.yield(this._tree.index<0?null:this._tree._parent.nextChild(this._tree.index+t,t,0,4,this.mode)):!1;let{buffer:r}=this.buffer,n=this.stack.length-1;if(t<0){let i=n<0?0:this.stack[n]+4;if(this.index!=i)return this.yieldBuf(r.findChild(i,this.index,-1,0,4))}else{let i=r.buffer[this.index+3];if(i<(n<0?r.buffer.length:r.buffer[this.stack[n]+3]))return this.yieldBuf(i)}return n<0?this.yield(this.buffer.parent.nextChild(this.buffer.index+t,t,0,4,this.mode)):!1}nextSibling(){return this.sibling(1)}prevSibling(){return this.sibling(-1)}atLastNode(t){let r,n,{buffer:i}=this;if(i){if(t>0){if(this.index-1)for(let a=r+t,o=t<0?-1:n._tree.children.length;a!=o;a+=t){let s=n._tree.children[a];if(this.mode&Il.IncludeAnonymous||s instanceof hg||!s.type.isAnonymous||dZ(s))return!1}return!0}move(t,r){if(r&&this.enterChild(t,0,4))return!0;for(;;){if(this.sibling(t))return!0;if(this.atLastNode(t)||!this.parent())return!1}}next(t=!0){return this.move(1,t)}prev(t=!0){return this.move(-1,t)}moveTo(t,r=0){for(;(this.from==this.to||(r<1?this.from>=t:this.from>t)||(r>-1?this.to<=t:this.to=0;){for(let o=t;o;o=o._parent)if(o.index==i){if(i==this.index)return o;r=o,n=a+1;break e}i=this.stack[--a]}}for(let i=n;i=0;a--){if(a<0)return f8(this.node,t,i);let o=n[r.buffer[this.stack[a]]];if(!o.isAnonymous){if(t[i]&&t[i]!=o.name)return!1;i--}}return!0}};function dZ(e){return e.children.some(t=>t instanceof hg||!t.type.isAnonymous||dZ(t))}function uet(e){var t;let{buffer:r,nodeSet:n,maxBufferLength:i=1024,reused:a=[],minRepeatType:o=n.types.length}=e,s=Array.isArray(r)?new kD(r,r.length):r,l=n.types,u=0,c=0;function f(x,w,S,k,j){let{id:O,start:C,end:N,size:D}=s,P=c;for(;D<0;)if(s.next(),D==-1){let L=a[O];S.push(L),k.push(C-x);return}else if(D==-3){u=O;return}else if(D==-4){c=O;return}else throw new RangeError(`Unrecognized record size: ${D}`);let q=l[O],z,I,T=C-x;if(N-C<=i&&(I=m(s.pos-w,j))){let L=new Uint16Array(I.size-I.skip),_=s.pos-I.size,Y=L.length;for(;s.pos>_;)Y=g(I.start,L,Y);z=new hg(L,N-I.start,n),T=I.start-x}else{let L=s.pos-D;s.next();let _=[],Y=[],oe=O>=o?O:-1,te=0,Q=N;for(;s.pos>L;)oe>=0&&s.id==oe&&s.size>=0?(s.end<=Q-i&&(p(_,Y,C,te,s.end,Q,oe,P),te=_.length,Q=s.end),s.next()):f(C,L,_,Y,oe);if(oe>=0&&te>0&&te<_.length&&p(_,Y,C,te,C,Q,oe,P),_.reverse(),Y.reverse(),oe>-1&&te>0){let fe=d(q);z=pZ(q,_,Y,0,_.length,0,N-C,fe,fe)}else z=h(q,_,Y,N-C,P-N)}S.push(z),k.push(T)}function d(x){return(w,S,k)=>{let j=0,O=w.length-1,C,N;if(O>=0&&(C=w[O])instanceof ks){if(!O&&C.type==x&&C.length==k)return C;(N=C.prop(Vi.lookAhead))&&(j=S[O]+C.length+N)}return h(x,w,S,k,j)}}function p(x,w,S,k,j,O,C,N){let D=[],P=[];for(;x.length>k;)D.push(x.pop()),P.push(w.pop()+S-j);x.push(h(n.types[C],D,P,O-j,N-O)),w.push(j-S)}function h(x,w,S,k,j=0,O){if(u){let C=[Vi.contextHash,u];O=O?[C].concat(O):[C]}if(j>25){let C=[Vi.lookAhead,j];O=O?[C].concat(O):[C]}return new ks(x,w,S,k,O)}function m(x,w){let S=s.fork(),k=0,j=0,O=0,C=S.end-i,N={size:0,start:0,skip:0};e:for(let D=S.pos-x;S.pos>D;){let P=S.size;if(S.id==w&&P>=0){N.size=k,N.start=j,N.skip=O,O+=4,k+=4,S.next();continue}let q=S.pos-P;if(P<0||q=o?4:0,I=S.start;for(S.next();S.pos>q;){if(S.size<0)if(S.size==-3)z+=4;else break e;else S.id>=o&&(z+=4);S.next()}j=I,k+=P,O+=z}return(w<0||k==x)&&(N.size=k,N.start=j,N.skip=O),N.size>4?N:void 0}function g(x,w,S){let{id:k,start:j,end:O,size:C}=s;if(s.next(),C>=0&&k4){let D=s.pos-(C-4);for(;s.pos>D;)S=g(x,w,S)}w[--S]=N,w[--S]=O-x,w[--S]=j-x,w[--S]=k}else C==-3?u=k:C==-4&&(c=k);return S}let A=[],b=[];for(;s.pos>0;)f(e.start||0,e.bufferStart||0,A,b,-1);let v=(t=e.length)!==null&&t!==void 0?t:A.length?b[0]+A[0].length:0;return new ks(l[e.topID],A.reverse(),b.reverse(),v)}var Nke=new WeakMap;function u8(e,t){if(!e.isAnonymous||t instanceof hg||t.type!=e)return 1;let r=Nke.get(t);if(r==null){r=1;for(let n of t.children){if(n.type!=e||!(n instanceof ks)){r=1;break}r+=u8(e,n)}Nke.set(t,r)}return r}function pZ(e,t,r,n,i,a,o,s,l){let u=0;for(let h=n;h=c)break;S+=k}if(v==x+1){if(S>c){let k=h[x];p(k.children,k.positions,0,k.children.length,m[x]+b);continue}f.push(h[x])}else{let k=m[v-1]+h[v-1].length-w;f.push(pZ(e,h,m,x,v,w,k,null,l))}d.push(w+b-a)}}return p(t,r,n,i,0),(s||l)(f,d,o)}var Nh=class{constructor(t,r,n,i,a=!1,o=!1){this.from=t,this.to=r,this.tree=n,this.offset=i,this.open=(a?1:0)|(o?2:0)}get openStart(){return(this.open&1)>0}get openEnd(){return(this.open&2)>0}static addTree(t,r=[],n=!1){let i=[new Nh(0,t.length,t,0,!1,n)];for(let a of r)a.to>t.length&&i.push(a);return i}static applyChanges(t,r,n=128){if(!r.length)return t;let i=[],a=1,o=t.length?t[0]:null;for(let s=0,l=0,u=0;;s++){let c=s=n)for(;o&&o.from=d.from||f<=d.to||u){let p=Math.max(d.from,l)-u,h=Math.min(d.to,f)-u;d=p>=h?null:new Nh(p,h,d.tree,d.offset+u,s>0,!!c)}if(d&&i.push(d),o.to>f)break;o=anew ED(i.from,i.to)):[new ED(0,0)]:[new ED(0,t.length)],this.createParse(t,r||[],n)}parse(t,r,n){let i=this.startParse(t,r,n);for(;;){let a=i.advance();if(a)return a}}},fZ=class{constructor(t){this.string=t}get length(){return this.string.length}chunk(t){return this.string.slice(t)}get lineChunks(){return!1}read(t,r){return this.string.slice(t,r)}};var Umr=new Vi({perNode:!0});var gu=require("@codemirror/state"),Ag=require("@codemirror/view");var cet=0,Zd=class{constructor(t,r,n){this.set=t,this.base=r,this.modified=n,this.id=cet++}static define(t){if(t?.base)throw new Error("Can not derive from a modified tag");let r=new Zd([],null,[]);if(r.set.push(r),t)for(let n of t.set)r.set.push(n);return r}static defineModifier(){let t=new U2;return r=>r.modified.indexOf(t)>-1?r:U2.get(r.base||r,r.modified.concat(t).sort((n,i)=>n.id-i.id))}},fet=0,U2=class{constructor(){this.instances=[],this.id=fet++}static get(t,r){if(!r.length)return t;let n=r[0].instances.find(s=>s.base==t&&det(r,s.modified));if(n)return n;let i=[],a=new Zd(i,t,r);for(let s of r)s.instances.push(a);let o=Ike(r);for(let s of t.set)for(let l of o)i.push(U2.get(s,l));return a}};function det(e,t){return e.length==t.length&&e.every((r,n)=>r==t[n])}function Ike(e){let t=[e];for(let r=0;r0&&f+3==i.length){o=1;break}let d=/^"(?:[^"\\]|\\.)*?"|[^\/!]+/.exec(s);if(!d)throw new RangeError("Invalid path: "+i);if(a.push(d[0]=="*"?"":d[0][0]=='"'?JSON.parse(d[0]):d[0]),f+=d[0].length,f==i.length)break;let p=i[f++];if(f==i.length&&p=="!"){o=0;break}if(p!="/")throw new RangeError("Invalid path: "+i);s=i.slice(f)}let l=a.length-1,u=a[l];if(!u)throw new RangeError("Invalid path: "+i);let c=new hZ(n,o,l>0?a.slice(0,l):null);t[u]=c.sort(t[u])}}return pet.add(t)}var pet=new Vi,hZ=class{constructor(t,r,n,i){this.tags=t,this.mode=r,this.context=n,this.next=i}sort(t){return!t||t.depth{let o=i;for(let s of a)for(let l of s.set){let u=r[l.id];if(u){o=o?o+" "+u:u;break}}return o},scope:n}}var _t=Zd.define,p8=_t(),$v=_t(),_ke=_t($v),Pke=_t($v),qv=_t(),m8=_t(qv),mZ=_t(qv),_h=_t(),cb=_t(_h),Th=_t(),Fh=_t(),AZ=_t(),CD=_t(AZ),h8=_t(),qt={comment:p8,lineComment:_t(p8),blockComment:_t(p8),docComment:_t(p8),name:$v,variableName:_t($v),typeName:_ke,tagName:_t(_ke),propertyName:Pke,attributeName:_t(Pke),className:_t($v),labelName:_t($v),namespace:_t($v),macroName:_t($v),literal:qv,string:m8,docString:_t(m8),character:_t(m8),attributeValue:_t(m8),number:mZ,integer:_t(mZ),float:_t(mZ),bool:_t(qv),regexp:_t(qv),escape:_t(qv),color:_t(qv),url:_t(qv),keyword:Th,self:_t(Th),null:_t(Th),atom:_t(Th),unit:_t(Th),modifier:_t(Th),operatorKeyword:_t(Th),controlKeyword:_t(Th),definitionKeyword:_t(Th),moduleKeyword:_t(Th),operator:Fh,derefOperator:_t(Fh),arithmeticOperator:_t(Fh),logicOperator:_t(Fh),bitwiseOperator:_t(Fh),compareOperator:_t(Fh),updateOperator:_t(Fh),definitionOperator:_t(Fh),typeOperator:_t(Fh),controlOperator:_t(Fh),punctuation:AZ,separator:_t(AZ),bracket:CD,angleBracket:_t(CD),squareBracket:_t(CD),paren:_t(CD),brace:_t(CD),content:_h,heading:cb,heading1:_t(cb),heading2:_t(cb),heading3:_t(cb),heading4:_t(cb),heading5:_t(cb),heading6:_t(cb),contentSeparator:_t(_h),list:_t(_h),quote:_t(_h),emphasis:_t(_h),strong:_t(_h),link:_t(_h),monospace:_t(_h),strikethrough:_t(_h),inserted:_t(),deleted:_t(),changed:_t(),invalid:_t(),meta:h8,documentMeta:_t(h8),annotation:_t(h8),processingInstruction:_t(h8),definition:Zd.defineModifier(),constant:Zd.defineModifier(),function:Zd.defineModifier(),standard:Zd.defineModifier(),local:Zd.defineModifier(),special:Zd.defineModifier()},Vmr=gZ([{tag:qt.link,class:"tok-link"},{tag:qt.heading,class:"tok-heading"},{tag:qt.emphasis,class:"tok-emphasis"},{tag:qt.strong,class:"tok-strong"},{tag:qt.keyword,class:"tok-keyword"},{tag:qt.atom,class:"tok-atom"},{tag:qt.bool,class:"tok-bool"},{tag:qt.url,class:"tok-url"},{tag:qt.labelName,class:"tok-labelName"},{tag:qt.inserted,class:"tok-inserted"},{tag:qt.deleted,class:"tok-deleted"},{tag:qt.literal,class:"tok-literal"},{tag:qt.string,class:"tok-string"},{tag:qt.number,class:"tok-number"},{tag:[qt.regexp,qt.escape,qt.special(qt.string)],class:"tok-string2"},{tag:qt.variableName,class:"tok-variableName"},{tag:qt.local(qt.variableName),class:"tok-variableName tok-local"},{tag:qt.definition(qt.variableName),class:"tok-variableName tok-definition"},{tag:qt.special(qt.variableName),class:"tok-variableName2"},{tag:qt.definition(qt.propertyName),class:"tok-propertyName tok-definition"},{tag:qt.typeName,class:"tok-typeName"},{tag:qt.namespace,class:"tok-namespace"},{tag:qt.className,class:"tok-className"},{tag:qt.macroName,class:"tok-macroName"},{tag:qt.propertyName,class:"tok-propertyName"},{tag:qt.operator,class:"tok-operator"},{tag:qt.comment,class:"tok-comment"},{tag:qt.meta,class:"tok-meta"},{tag:qt.invalid,class:"tok-invalid"},{tag:qt.punctuation,class:"tok-punctuation"}]);var vZ,A8=new Vi;var Xd=class{constructor(t,r,n=[]){this.data=t,gu.EditorState.prototype.hasOwnProperty("tree")||Object.defineProperty(gu.EditorState.prototype,"tree",{get(){return OD(this)}}),this.parser=r,this.extension=[H2.of(this),gu.EditorState.languageData.of((i,a,o)=>i.facet(Rke(i,a,o)))].concat(n)}isActiveAt(t,r,n=-1){return Rke(t,r,n)==this.data}findRegions(t){let r=t.facet(H2);if(r?.data==this.data)return[{from:0,to:t.doc.length}];if(!r||!r.allowsNesting)return[];let n=[],i=(a,o)=>{if(a.prop(A8)==this.data){n.push({from:o,to:o+a.length});return}let s=a.prop(Vi.mounted);if(s){if(s.tree.prop(A8)==this.data){if(s.overlay)for(let l of s.overlay)n.push({from:l.from+o,to:l.to+o});else n.push({from:o,to:o+a.length});return}else if(s.overlay){let l=n.length;if(i(s.tree,s.overlay[0].from+o),n.length>l)return}}for(let l=0;l=this.cursorPos?this.doc.sliceString(t,r):this.string.slice(t-n,r-n)}},DD=null,W2=class{constructor(t,r,n=[],i,a,o,s,l){this.parser=t,this.state=r,this.fragments=n,this.tree=i,this.treeLen=a,this.viewport=o,this.skipped=s,this.scheduleOn=l,this.parse=null,this.tempSkipped=[]}static create(t,r,n){return new W2(t,r,[],ks.empty,0,n,[],null)}startParse(){return this.parser.startParse(new xZ(this.state.doc),this.fragments)}work(t,r){return r!=null&&r>=this.state.doc.length&&(r=void 0),this.tree!=ks.empty&&this.isDone(r??this.state.doc.length)?(this.takeTree(),!0):this.withContext(()=>{var n;if(typeof t=="number"){let i=Date.now()+t;t=()=>Date.now()>i}for(this.parse||(this.parse=this.startParse()),r!=null&&(this.parse.stoppedAt==null||this.parse.stoppedAt>r)&&r=this.treeLen&&((this.parse.stoppedAt==null||this.parse.stoppedAt>t)&&this.parse.stopAt(t),this.withContext(()=>{for(;!(r=this.parse.advance()););}),this.treeLen=t,this.tree=r,this.fragments=this.withoutTempSkipped(Nh.addTree(this.tree,this.fragments,!0)),this.parse=null)}withContext(t){let r=DD;DD=this;try{return t()}finally{DD=r}}withoutTempSkipped(t){for(let r;r=this.tempSkipped.pop();)t=$ke(t,r.from,r.to);return t}changes(t,r){let{fragments:n,tree:i,treeLen:a,viewport:o,skipped:s}=this;if(this.takeTree(),!t.empty){let l=[];if(t.iterChangedRanges((u,c,f,d)=>l.push({fromA:u,toA:c,fromB:f,toB:d})),n=Nh.applyChanges(n,l),i=ks.empty,a=0,o={from:t.mapPos(o.from,-1),to:t.mapPos(o.to,1)},this.skipped.length){s=[];for(let u of this.skipped){let c=t.mapPos(u.from,1),f=t.mapPos(u.to,-1);ct.from&&(this.fragments=$ke(this.fragments,i,a),this.skipped.splice(n--,1))}return this.skipped.length>=r?!1:(this.reset(),!0)}reset(){this.parse&&(this.takeTree(),this.parse=null)}skipUntilInView(t,r){this.skipped.push({from:t,to:r})}static getSkippingParser(t){return new class extends d8{createParse(r,n,i){let a=i[0].from,o=i[i.length-1].to;return{parsedPos:a,advance(){let l=DD;if(l){for(let u of i)l.tempSkipped.push(u);t&&(l.scheduleOn=l.scheduleOn?Promise.all([l.scheduleOn,t]):t)}return this.parsedPos=o,new ks(Zu.none,[],[],o-a)},stoppedAt:null,stopAt(){}}}}}isDone(t){t=Math.min(t,this.state.doc.length);let r=this.fragments;return this.treeLen>=t&&r.length&&r[0].from==0&&r[0].to>=t}static get(){return DD}};function $ke(e,t,r){return Nh.applyChanges(e,[{fromA:t,toA:r,fromB:t,toB:r}])}var Lv=class{constructor(t){this.context=t,this.tree=t.tree}apply(t){if(!t.docChanged&&this.tree==this.context.tree)return this;let r=this.context.changes(t.changes,t.state),n=this.context.treeLen==t.startState.doc.length?void 0:Math.max(t.changes.mapPos(this.context.treeLen),r.viewport.to);return r.work(20,n)||r.takeTree(),new Lv(r)}static init(t){let r=Math.min(3e3,t.doc.length),n=W2.create(t.facet(H2).parser,t,{from:0,to:r});return n.work(20,r)||n.takeTree(),new Lv(n)}};Xd.state=gu.StateField.define({create:Lv.init,update(e,t){for(let r of t.effects)if(r.is(Xd.setState))return r.value;return t.startState.facet(H2)!=t.state.facet(H2)?Lv.init(t.state):e.apply(t)}});var zke=e=>{let t=setTimeout(()=>e(),500);return()=>clearTimeout(t)};typeof requestIdleCallback<"u"&&(zke=e=>{let t=-1,r=setTimeout(()=>{t=requestIdleCallback(e,{timeout:500-100})},100);return()=>t<0?clearTimeout(r):cancelIdleCallback(t)});var yZ=typeof navigator<"u"&&((vZ=navigator.scheduling)===null||vZ===void 0?void 0:vZ.isInputPending)?()=>navigator.scheduling.isInputPending():null,met=Ag.ViewPlugin.fromClass(class{constructor(t){this.view=t,this.working=null,this.workScheduled=0,this.chunkEnd=-1,this.chunkBudget=-1,this.work=this.work.bind(this),this.scheduleWork()}update(t){let r=this.view.state.field(Xd.state).context;(r.updateViewport(t.view.viewport)||this.view.viewport.to>r.treeLen)&&this.scheduleWork(),t.docChanged&&(this.view.hasFocus&&(this.chunkBudget+=50),this.scheduleWork()),this.checkAsyncSchedule(r)}scheduleWork(){if(this.working)return;let{state:t}=this.view,r=t.field(Xd.state);(r.tree!=r.context.tree||!r.context.isDone(t.doc.length))&&(this.working=zke(this.work))}work(t){this.working=null;let r=Date.now();if(this.chunkEndi+1e3,l=a.context.work(()=>yZ&&yZ()||Date.now()>o,i+(s?0:1e5));this.chunkBudget-=Date.now()-r,(l||this.chunkBudget<=0)&&(a.context.takeTree(),this.view.dispatch({effects:Xd.setState.of(new Lv(a.context))})),this.chunkBudget>0&&!(l&&!s)&&this.scheduleWork(),this.checkAsyncSchedule(a.context)}checkAsyncSchedule(t){t.scheduleOn&&(this.workScheduled++,t.scheduleOn.then(()=>this.scheduleWork()).catch(r=>(0,Ag.logException)(this.view.state,r)).then(()=>this.workScheduled--),t.scheduleOn=null)}destroy(){this.working&&this.working()}isWorking(){return!!(this.working||this.workScheduled>0)}},{eventHandlers:{focus(){this.scheduleWork()}}}),H2=gu.Facet.define({combine(e){return e.length?e[0]:null},enables:[Xd.state,met]});var Uke=gu.Facet.define({combine:e=>{if(!e.length)return" ";if(!/^(?: +|\t+)$/.test(e[0]))throw new Error("Invalid indent unit: "+JSON.stringify(e[0]));return e[0]}});var MD=class{constructor(t,r){let n;function i(s){let l=Qp.newName();return(n||(n=Object.create(null)))["."+l]=s,l}let a=typeof r.all=="string"?r.all:r.all?i(r.all):void 0,o=r.scope;this.scope=o instanceof Xd?s=>s.prop(A8)==o.data:o?s=>s==o:void 0,this.style=gZ(t.map(s=>({tag:s.tag,class:s.class||i(Object.assign({},s,{tag:null}))})),{all:a}).style,this.module=n?new Qp(n):null,this.themeType=r.themeType}static define(t,r){return new MD(t,r||{})}};var ehr=MD.define([{tag:qt.meta,color:"#7a757a"},{tag:qt.link,textDecoration:"underline"},{tag:qt.heading,textDecoration:"underline",fontWeight:"bold"},{tag:qt.emphasis,fontStyle:"italic"},{tag:qt.strong,fontWeight:"bold"},{tag:qt.strikethrough,textDecoration:"line-through"},{tag:qt.keyword,color:"#708"},{tag:[qt.atom,qt.bool,qt.url,qt.contentSeparator,qt.labelName],color:"#219"},{tag:[qt.literal,qt.inserted],color:"#164"},{tag:[qt.string,qt.deleted],color:"#a11"},{tag:[qt.regexp,qt.escape,qt.special(qt.string)],color:"#e40"},{tag:qt.definition(qt.variableName),color:"#00f"},{tag:qt.local(qt.variableName),color:"#30a"},{tag:[qt.typeName,qt.namespace],color:"#085"},{tag:qt.className,color:"#167"},{tag:[qt.special(qt.variableName),qt.macroName],color:"#256"},{tag:qt.definition(qt.propertyName),color:"#00c"},{tag:qt.comment,color:"#940"},{tag:qt.invalid,color:"#f00"}]);var het=Object.create(null),qke=[Zu.none];var Lke=[],Aet=Object.create(null);for(let[e,t]of[["variable","variableName"],["variable-2","variableName.special"],["string-2","string.special"],["def","variableName.definition"],["tag","typeName"],["attribute","propertyName"],["type","typeName"],["builtin","variableName.standard"],["qualifier","modifier"],["error","invalid"],["header","heading"],["property","propertyName"]])Aet[e]=get(het,t);function bZ(e,t){Lke.indexOf(e)>-1||(Lke.push(e),console.warn(t))}function get(e,t){let r=null;for(let a of t.split(".")){let o=e[a]||qt[a];o?typeof o=="function"?r?r=o(r):bZ(a,`Modifier ${a} used at start of tag`):r?bZ(a,`Tag ${a} used as modifier`):r=o:bZ(a,`Unknown highlighting tag ${a}`)}if(!r)return 0;let n=t.replace(/ /g,"_"),i=Zu.define({id:qke.length,name:n,props:[Bke({[n]:r})]});return qke.push(i),i.id}function Wke(e){let t=Object.keys(e).join(""),r=/\w/.test(t);return r&&(t=t.replace(/\w/g,"")),`[${r?"\\w":""}${t.replace(/[^\w\s]/g,"\\$&")}]`}function vet(e){let t=Object.create(null),r=Object.create(null);for(let{label:i}of e){t[i[0]]=!0;for(let a=1;atypeof i=="string"?{label:i}:i),[r,n]=t.every(i=>/^\w+$/.test(i.label))?[/\w*$/,/\w+$/]:vet(t);return i=>{let a=i.matchBefore(n);return a||i.explicit?{from:a?a.from:i.pos,options:t,validFor:r}:null}}function Gke(e,t){return r=>{for(let n=OD(r.state).resolveInner(r.pos,-1);n;n=n.parent)if(e.indexOf(n.name)>-1)return null;return t(r)}}var yet=tl.EditorView.baseTheme({".cm-tooltip.cm-tooltip-autocomplete":{"& > ul":{fontFamily:"monospace",whiteSpace:"nowrap",overflow:"hidden auto",maxWidth_fallback:"700px",maxWidth:"min(700px, 95vw)",minWidth:"250px",maxHeight:"10em",listStyle:"none",margin:0,padding:0,"& > li":{overflowX:"hidden",textOverflow:"ellipsis",cursor:"pointer",padding:"1px 3px",lineHeight:1.2}}},"&light .cm-tooltip-autocomplete ul li[aria-selected]":{background:"#17c",color:"white"},"&dark .cm-tooltip-autocomplete ul li[aria-selected]":{background:"#347",color:"white"},".cm-completionListIncompleteTop:before, .cm-completionListIncompleteBottom:after":{content:'"\xB7\xB7\xB7"',opacity:.5,display:"block",textAlign:"center"},".cm-tooltip.cm-completionInfo":{position:"absolute",padding:"3px 9px",width:"max-content",maxWidth:"300px"},".cm-completionInfo.cm-completionInfo-left":{right:"100%"},".cm-completionInfo.cm-completionInfo-right":{left:"100%"},"&light .cm-snippetField":{backgroundColor:"#00000022"},"&dark .cm-snippetField":{backgroundColor:"#ffffff22"},".cm-snippetFieldPosition":{verticalAlign:"text-top",width:0,height:"1.15em",margin:"0 -0.7px -.7em",borderLeft:"1.4px dotted #888"},".cm-completionMatchedText":{textDecoration:"underline"},".cm-completionDetail":{marginLeft:"0.5em",fontStyle:"italic"},".cm-completionIcon":{fontSize:"90%",width:".8em",display:"inline-block",textAlign:"center",paddingRight:".6em",opacity:"0.6"},".cm-completionIcon-function, .cm-completionIcon-method":{"&:after":{content:"'\u0192'"}},".cm-completionIcon-class":{"&:after":{content:"'\u25CB'"}},".cm-completionIcon-interface":{"&:after":{content:"'\u25CC'"}},".cm-completionIcon-variable":{"&:after":{content:"'\u{1D465}'"}},".cm-completionIcon-constant":{"&:after":{content:"'\u{1D436}'"}},".cm-completionIcon-type":{"&:after":{content:"'\u{1D461}'"}},".cm-completionIcon-enum":{"&:after":{content:"'\u222A'"}},".cm-completionIcon-property":{"&:after":{content:"'\u25A1'"}},".cm-completionIcon-keyword":{"&:after":{content:"'\u{1F511}\uFE0E'"}},".cm-completionIcon-namespace":{"&:after":{content:"'\u25A2'"}},".cm-completionIcon-text":{"&:after":{content:"'abc'",fontSize:"50%",verticalAlign:"middle"}}}),wZ=class{constructor(t,r,n,i){this.field=t,this.line=r,this.from=n,this.to=i}},jD=class{constructor(t,r,n){this.field=t,this.from=r,this.to=n}map(t){let r=t.mapPos(this.from,-1,Ji.MapMode.TrackDel),n=t.mapPos(this.to,1,Ji.MapMode.TrackDel);return r==null||n==null?null:new jD(this.field,r,n)}},ND=class{constructor(t,r){this.lines=t,this.fieldPositions=r}instantiate(t,r){let n=[],i=[r],a=t.doc.lineAt(r),o=/^\s*/.exec(a.text)[0];for(let l of this.lines){if(n.length){let u=o,c=/^\t*/.exec(l)[0].length;for(let f=0;fnew jD(l.field,i[l.line]+l.from,i[l.line]+l.to));return{text:n,ranges:s}}static parse(t){let r=[],n=[],i=[],a;for(let o of t.split(/\r\n?|\n/)){for(;a=/[#$]\{(?:(\d+)(?::([^}]*))?|([^}]*))\}/.exec(o);){let s=a[1]?+a[1]:null,l=a[2]||a[3]||"",u=-1;for(let c=0;c=u&&f.field++}i.push(new wZ(u,n.length,a.index,a.index+l.length)),o=o.slice(0,a.index)+l+o.slice(a.index+a[0].length)}n.push(o)}return new ND(n,i)}},bet=tl.Decoration.widget({widget:new class extends tl.WidgetType{toDOM(){let e=document.createElement("span");return e.className="cm-snippetFieldPosition",e}ignoreEvent(){return!1}}}),xet=tl.Decoration.mark({class:"cm-snippetField"}),zv=class{constructor(t,r){this.ranges=t,this.active=r,this.deco=tl.Decoration.set(t.map(n=>(n.from==n.to?bet:xet).range(n.from,n.to)))}map(t){let r=[];for(let n of this.ranges){let i=n.map(t);if(!i)return null;r.push(i)}return new zv(r,this.active)}selectionInsideField(t){return t.ranges.every(r=>this.ranges.some(n=>n.field==this.active&&n.from<=r.from&&n.to>=r.to))}},FD=Ji.StateEffect.define({map(e,t){return e&&e.map(t)}}),wet=Ji.StateEffect.define(),TD=Ji.StateField.define({create(){return null},update(e,t){for(let r of t.effects){if(r.is(FD))return r.value;if(r.is(wet)&&e)return new zv(e.ranges,r.value)}return e&&t.docChanged&&(e=e.map(t.changes)),e&&t.selection&&!e.selectionInsideField(t.selection)&&(e=null),e},provide:e=>tl.EditorView.decorations.from(e,t=>t?t.deco:tl.Decoration.none)});function SZ(e,t){return Ji.EditorSelection.create(e.filter(r=>r.field==t).map(r=>Ji.EditorSelection.range(r.from,r.to)))}function Eet(e){let t=ND.parse(e);return(r,n,i,a)=>{let{text:o,ranges:s}=t.instantiate(r.state,i),l={changes:{from:i,to:a,insert:Ji.Text.of(o)}};if(s.length&&(l.selection=SZ(s,0)),s.length>1){let u=new zv(s,0),c=l.effects=[FD.of(u)];r.state.field(TD,!1)===void 0&&c.push(Ji.StateEffect.appendConfig.of([TD,Met,jet,yet]))}r.dispatch(r.state.update(l))}}function Qke(e){return({state:t,dispatch:r})=>{let n=t.field(TD,!1);if(!n||e<0&&n.active==0)return!1;let i=n.active+e,a=e>0&&!n.ranges.some(o=>o.field==i+e);return r(t.update({selection:SZ(n.ranges,i),effects:FD.of(a?null:new zv(n.ranges,i))})),!0}}var ket=({state:e,dispatch:t})=>e.field(TD,!1)?(t(e.update({effects:FD.of(null)})),!0):!1,Cet=Qke(1),Det=Qke(-1),Oet=[{key:"Tab",run:Cet,shift:Det},{key:"Escape",run:ket}],Hke=Ji.Facet.define({combine(e){return e.length?e[0]:Oet}}),Met=Ji.Prec.highest(tl.keymap.compute([Hke],e=>e.facet(Hke)));function Uv(e,t){return Object.assign(Object.assign({},t),{apply:Eet(e)})}var jet=tl.EditorView.domEventHandlers({mousedown(e,t){let r=t.state.field(TD,!1),n;if(!r||(n=t.posAtCoords({x:e.clientX,y:e.clientY}))==null)return!1;let i=r.ranges.find(a=>a.from<=n&&a.to>=n);return!i||i.field==r.active?!1:(t.dispatch({selection:SZ(r.ranges,i.field),effects:FD.of(r.ranges.some(a=>a.field>i.field)?new zv(r.ranges,i.field):null)}),!0)}});var Yke=new class extends Ji.RangeValue{};Yke.startSide=1;Yke.endSide=-1;var ihr=typeof navigator=="object"&&/Android\b/.test(navigator.userAgent);var Net=[Uv("function ${name}(${params}) {\n ${}\n}",{label:"function",detail:"definition",type:"keyword"}),Uv("for (let ${index} = 0; ${index} < ${bound}; ${index}++) {\n ${}\n}",{label:"for",detail:"loop",type:"keyword"}),Uv("for (let ${name} of ${collection}) {\n ${}\n}",{label:"for",detail:"of loop",type:"keyword"}),Uv(`try { \${} } catch (\${error}) { \${} @@ -212,15 +212,15 @@ For more information, see https://radix-ui.com/primitives/docs/components/${t.do ${t.code} }`:"",[t]),n=i=>{e.saveCommand({...t,code:i.split(` `).slice(1,-1).join(` -`),codeType:"script"})};return V2.default.createElement("div",null,V2.default.createElement(VC,{className:"mk-editor-code",value:r,height:"100%",theme:i6e,extensions:[r6e({jsx:!0})],onChange:n}),V2.default.createElement(G5,{type:"script",code:t.code,fields:t.fields,value:{},superstate:e.superstate,path:e.path}))};var o6e=e=>{let[t,r]=(0,ea.useState)(null),n=(0,ea.useMemo)(()=>e.superstate.spaceManager.uriByString(e.action),[e.action]),i=p=>{if(r(p),n.authority=="$actions"){e.superstate.spaceManager.saveSystemCommand(n.path.split("/").pop(),p);return}e.superstate.spaceManager.saveCommand(n.path,p.schema.id,()=>p)};(0,ea.useEffect)(()=>{r(e.superstate.cli.commandForAction(e.action))},[e.action]),(0,ea.useEffect)(()=>{let p=h=>{h.path==n.basePath&&r(e.superstate.cli.commandForAction(e.action))};return e.superstate.eventsDispatcher.addListener("actionStateUpdated",p),()=>{e.superstate.eventsDispatcher.removeListener("actionStateUpdated",p)}});let a=(p,h)=>(i({...t,fields:[...t.fields,h]}),!0),o=p=>{i({...t,fields:t.fields.filter(h=>h.name!=p.name)})},s=(p,h)=>{i({...t,fields:t.fields.map(m=>m.name==h.name?p:m)})},l=p=>{let h=p.target.getBoundingClientRect();Nf(e.superstate,h,Ne(p.view.document),{spaces:[],fields:[],saveField:a,schemaId:t.schema.id,fileMetadata:!0,isSpace:!0})},u=[{name:"Actions",value:"actions"},{name:"Script",value:"script"},{name:"Formula",value:"formula"}],c=p=>{let h=pr(p.value,p.type);if(h)return h?.default},f=(p,h)=>{let m=pr(p.value,p.type)??{};m.default=h,s({...p,value:JSON.stringify(m)},p)},d=(0,ea.useMemo)(()=>t?.fields.reduce((p,h)=>({...p,[h.name]:c(h)}),{})??{},[t?.fields]);return ea.default.createElement("div",{className:"mk-editor-actions"},t&&ea.default.createElement(ea.default.Fragment,null,ea.default.createElement("div",{className:"mk-props-contexts"},ea.default.createElement("div",{className:"mk-path-context-row"},ea.default.createElement("div",{className:"mk-path-context-field"},"Type"),ea.default.createElement("div",{className:"mk-path-context-value"},ea.default.createElement(B9,{superstate:e.superstate,options:u,value:t.schema.type,selectValue:p=>i({...t,schema:{...t.schema,type:p}})}))),ea.default.createElement("div",{className:"mk-path-context-row"},ea.default.createElement("div",{className:"mk-path-context-field"},"Properties")),ea.default.createElement("div",{className:"mk-cell-object"},t.fields.map(p=>ea.default.createElement(bs,{key:p.name,superstate:e.superstate,initialValue:c(p),column:p,editMode:5,updateValue:h=>{f(p,h)},updateFieldValue:(h,m)=>{i({...t,fields:t.fields.map(g=>p.name==g.name?{...g,value:h}:g)})},propertyMenu:h=>{let m=h.target.getBoundingClientRect();yh({superstate:e.superstate,rect:m,win:Ne(h.view.document),editable:!0,options:[],field:p,fields:t.fields,contextPath:null,saveField:g=>s(g,p),deleteColumn:o})}}))),ea.default.createElement("button",{className:"mk-inline-button",onClick:p=>l(p)},ea.default.createElement("div",{className:"mk-icon-xsmall",dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//plus")}}),H.labels.newProperty)),t.schema.type=="script"?ea.default.createElement(a6e,{superstate:e.superstate,command:t,saveCommand:i,values:d,path:n.path}):t.schema.type=="actions"?ea.default.createElement(WEe,{superstate:e.superstate,formula:t.code,path:n.path,saveOutputType:p=>{i({...t,codeType:p})},saveFormula:p=>{i({...t,code:p})},fields:t.fields,value:d}):t.schema.type=="formula"?ea.default.createElement(Ah,{superstate:e.superstate,formula:t.code,saveFormula:p=>{i({...t,code:p})},fields:t.fields,value:d,path:n.path}):ea.default.createElement("div",null)))};var es=Ae(Te());var P8=Ae(Te());var G2=e=>{let t=[];return e.class&&t.push(`${e.class}`),e.layout&&t.push(`mk-layout-${e.layout}`),e.layoutAlign&&t.push(`mk-layout-align-${e.layoutAlign}`),e.layoutWrap&&t.push(`mk-layout-wrap-${e.layoutWrap}`),e.iconSize&&t.push(`mk-icon-size-${e.iconSize}`),e.imageSize&&t.push(`mk-image-size-${e.imageSize}`),t.join(" ")};var ep=Ae(Te());var Q2=Ae(Te()),v8=e=>{let t=e.state.props.value,r=(0,Q2.useMemo)(()=>e.superstate.ui.getUIPath(t),[t]);return e.state?.props.value?.length>0?Q2.default.createElement("audio",{controls:!0,preload:"none",src:r}):Q2.default.createElement(Q2.default.Fragment,null)};var kZ=Ae(Te()),y8=e=>kZ.default.createElement(kZ.default.Fragment,null,e.children);var Y2=Ae(Te());function Vet(e){return e?.replace(/([^/])#([*^])/g,"$1/#$2")}var b8=e=>{let t=Vet(e.state?.props?.value),{updateNode:r}=(0,Y2.useContext)(Wi),{id:n}=(0,Y2.useContext)(_i),i=o=>{Fa(o,Ne(o.view.document),e.superstate,s=>r(e.treeNode.node,{props:{...e.treeNode.node.props,value:jr(s+"/#^"+Er)}}))},a=o=>{if(e.treeNode.node.props.value=="$contexts['$space']['space']"){r(e.treeNode.node,{props:{...e.treeNode.node.props,value:`$contexts['$space']['space']+"/#*${o}"`}});return}zN(e.superstate,e.superstate.spaceManager.resolvePath(t,e.source)).then(s=>{r(e.treeNode.node,{props:{...e.treeNode.node.props,value:jr(s?.space+"#*"+o)}})})};return e.state&&t?Y2.default.createElement(Wv,{id:n,source:e.source,showTitle:!0,superstate:e.superstate,path:t,minMode:e.state?.styles?.["--mk-min-mode"],containerRef:e.containerRef,setFrameSchema:a}):Y2.default.createElement("div",{className:"mk-frame-placeholder",onClick:o=>i(o)},H.labels.selectSpace)};var Cs=Ae(Te());function Get(e){let t=/!\[!\[(.*?)\]\]/,r=/!!\[\[(.*?)\]\]/,n=e.match(t),i=e.match(r);return n?n[1]:i?i[1]:e}var x8=e=>{let{spaceState:t}=(0,Cs.useContext)(ur),r=(0,Cs.useMemo)(()=>{let h=e.state?.props?.value,m=h?e.superstate.spaceManager.resolvePath(Get(h),e.source):null,g=e.superstate.spaceManager.uriByString(h);return g?.scheme=="https"||g?.scheme=="http"?{path:h,label:{sticker:g.scheme,name:g.path,color:""},hidden:!1,subtype:"md",type:"remote",readOnly:!0}:e.superstate.pathsIndex.get(m)},[e.state,e.source]),{updateNode:n,nodes:i}=(0,Cs.useContext)(Wi),{selectionMode:a}=(0,Cs.useContext)(Hi),[o,s]=(0,Cs.useState)(e.state?.styles?.["--mk-expanded"]),l=h=>{if(h!=e.state.props?.value)if(e.treeNode.editorProps?.linkedNode){let m=i.find(g=>g.id==e.treeNode.editorProps.linkedNode.node);n(m,{props:{...m.props,[e.treeNode.editorProps.linkedNode.prop]:jr(h)}})}else n(e.treeNode.node,{props:{...e.treeNode.node.props,value:jr(h)}})},u=e.state?.styles?.["--mk-link"],{id:c}=(0,Cs.useContext)(_i),[f,d]=(0,Cs.useState)(""),p=()=>{s(h=>!h),a>0&&n(e.treeNode.node,{styles:{...e.treeNode.node.styles,"--mk-expanded":(!e.state?.styles?.["--mk-expanded"]).toString()}})};return Cs.default.createElement("div",{className:"mk-node-flow"},r?e.state?.styles?.["--mk-min-mode"]?Cs.default.createElement(Cs.default.Fragment,null):Cs.default.createElement("div",{className:"mk-node-link"},Cs.default.createElement(oo,{superstate:e.superstate,path:r.path},!u&&Cs.default.createElement(Vd,{superstate:e.superstate,collapsed:!o,onToggle:p}))):a>0&&Cs.default.createElement("div",{className:"mk-node-text-placeholder",onClick:h=>{let m=h.currentTarget.getBoundingClientRect();e.superstate.ui.quickOpen(2,m,Ne(h.view.document),g=>{l(g)})}},H.hintText.selectNote),e.state&&o&&e.state?.props?.value?.length>0&&Cs.default.createElement(w8,{id:c,superstate:e.superstate,path:r?.path??e.state?.props?.value,containerRef:e.containerRef,styles:{},readOnly:!0}))};var NZ=Ae(Ya());var zt=Ae(Te()),V6e=Ae(bl());var Kd=Ae(Te());var s6e=e=>{let{groupNodes:t,saveNodes:r,nodes:n}=(0,Kd.useContext)(Wi),{selection:i,select:a}=(0,Kd.useContext)(Hi),o=i.map(s=>n.find(l=>l.id==s)).filter(s=>s);return Kd.default.createElement("div",{className:"mk-editor-frame-node-selector",style:{pointerEvents:"auto"},onClick:s=>s.stopPropagation()},Kd.default.createElement("div",{className:"mk-editor-frame-node-button"},Kd.default.createElement("div",{dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//copy-check")}}),H.labels.itemsSelected.replace("${1}",i.length.toString())),Kd.default.createElement("div",{className:"mk-divider"}),Kd.default.createElement("div",{"aria-label":H.editor.createVerticalSection,className:"mk-editor-frame-node-button",dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//rows")},onClick:()=>t(o,{layoutAlign:'"left"',gap:'"8px"'})}),Kd.default.createElement("div",{"aria-label":H.editor.createHorizontalSection,className:"mk-editor-frame-node-button ",dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//columns")},onClick:()=>t(o,{layout:'"row"',gap:'"8px"'})}),Kd.default.createElement("div",{className:"mk-divider"}),Kd.default.createElement("div",{className:"mk-editor-frame-node-button ","aria-label":H.menu.delete,onClick:()=>r([],o),dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//trash")}}))};var ir=Ae(Te());var S8={table:{name:H.menu.tableView,icon:"ui//table",view:"table",listView:"",listGroup:"",listItem:""},day:{name:"Day View",icon:"ui//calendar",view:"day",listView:"",listGroup:"",listItem:""},week:{name:"Week View",icon:"ui//calendar",view:"week",listView:"",listGroup:"",listItem:""},month:{name:"Month View",icon:"ui//calendar",view:"month",listView:"",listGroup:"",listItem:""},list:{name:H.menu.listView,icon:"ui//list",view:"list",listView:"spaces://$kit/#*listView",listGroup:"spaces://$kit/#*listGroup",listItem:"spaces://$kit/#*rowItem"},details:{name:H.menu.detailsView,icon:"ui//layout-grid",view:"list",listView:"spaces://$kit/#*listView",listGroup:"spaces://$kit/#*listGroup",listItem:"spaces://$kit/#*detailItem"},board:{name:H.menu.boardView,icon:"ui//square-kanban",view:"list",listView:"spaces://$kit/#*columnView",listGroup:"spaces://$kit/#*columnGroup",listItem:"spaces://$kit/#*cardListItem"},tasks:{name:"Checklist",icon:"ui//square-kanban",view:"list",listView:"spaces://$kit/#*listView",listGroup:"spaces://$kit/#*taskGroup",listItem:"spaces://$kit/#*taskListItem"},cards:{name:H.menu.cardView,icon:"ui//layout-dashboard",view:"list",listView:"spaces://$kit/#*listView",listGroup:"spaces://$kit/#*gridGroup",listItem:"spaces://$kit/#*cardsListItem"},catalog:{name:H.menu.catalogView,icon:"ui//gallery-horizontal-end",view:"list",listView:"spaces://$kit/#*listView",listGroup:"spaces://$kit/#*rowGroup",listItem:"spaces://$kit/#*coverListItem"},gallery:{name:H.menu.galleryView,icon:"ui//layout-dashboard",view:"list",listView:"spaces://$kit/#*listView",listGroup:"spaces://$kit/#*masonryGroup",listItem:"spaces://$kit/#*imageListItem"},flow:{name:H.menu.flowView,icon:"ui//edit",view:"list",listView:"spaces://$kit/#*listView",listGroup:"spaces://$kit/#*listGroup",listItem:"spaces://$kit/#*flowListItem"}};var Qet=e=>{if(e=="table")return{view:"table",listView:"",listGroup:"",listItem:""};if(e=="flow")return{view:"list",listView:"spaces://$kit/#*listView",listGroup:"spaces://$kit/#*listGroup",listItem:"spaces://$kit/#*flowListItem"};if(e=="list")return{view:"list",listView:"spaces://$kit/#*listView",listGroup:"spaces://$kit/#*listGroup",listItem:"spaces://$kit/#*rowItem"};if(e=="details")return{view:"list",listView:"spaces://$kit/#*listView",listGroup:"spaces://$kit/#*listGroup",listItem:"spaces://$kit/#*detailItem"};if(e=="board")return{view:"list",listView:"spaces://$kit/#*columnView",listGroup:"spaces://$kit/#*columnGroup",listItem:"spaces://$kit/#*cardListItem"};if(e=="cards")return{view:"list",listView:"spaces://$kit/#*listView",listGroup:"spaces://$kit/#*gridGroup",listItem:"spaces://$kit/#*cardsListItem"};if(e=="catalog")return{view:"list",listView:"spaces://$kit/#*listView",listGroup:"spaces://$kit/#*rowGroup",listItem:"spaces://$kit/#*coverListItem"};if(e=="gallery")return{view:"list",listView:"spaces://$kit/#*listView",listGroup:"spaces://$kit/#*masonryGroup",listItem:"spaces://$kit/#*imageListItem"};if(e=="calendar")return{view:"list",listView:"spaces://$kit/#*calendarView",listGroup:"spaces://$kit/#*dateGroup",listItem:"spaces://$kit/#*eventItem"}},PD=async(e,t,r)=>{let n=r=="board"?"Board":"Table",i=await e.spaceManager.tablesForSpace(t);return i&&(n=Mi(n,i.map(o=>o.id))),await e.spaceManager.createTable(t,{id:n,name:n,type:"db"}).then(o=>e.spaceManager.addSpaceProperty(t,{...Px[0],schemaId:n})).then(async o=>{let s=await e.spaceManager.framesForSpace(t),l={id:Mi(n,s?.map(u=>u.id)??[]),name:n,type:"view",predicate:JSON.stringify({...Wy,...r?Qet(r):{view:"table"}}),def:JSON.stringify({db:n,icon:r=="board"?"ui//square-kanban":"ui//table"})};return await e.spaceManager.createFrame(t,l),l.id})};var Z2=(e,t,r,n,i,a={searchable:!0})=>{let o=async m=>{if(m=="note")r.ui.quickOpen(2,e,t,g=>{i({...Mo.node,props:{value:jr(g)},styles:{"--mk-min-mode":"true","--mk-expanded":"true",width:"'100%'"}})});else if(m=="table"){let g=await PD(r,n.path);i({...f0.node,props:{value:jr(`./#*${g}`)}})}else m=="link"&&r.ui.quickOpen(2,e,t,g=>{i({...Mo.node,props:{value:jr(g)}})})},s=(m,g)=>{i({...m,type:"frame",ref:"spaces://$kit/#*"+g})},l=m=>{i({...m})},u=[{name:H.commands.newNote,value:"presetnote",onClick:()=>{o("note")},icon:"ui//mk-make-flow"},{name:H.commands.internalLink,value:"presetlink",onClick:()=>{o("link")},icon:"ui//mk-make-link"},{name:H.commands.table,value:"presettable",onClick:()=>{o("table")},icon:"ui//mk-make-table"}],c=async m=>{let g=await r.spaceManager.framesForSpace(n.path),A=Mi(m,g.map(x=>x.id)),b=S8[m],v={name:b.name,id:A,type:"view",def:{db:"files"},predicate:JSON.stringify({view:b.view,listView:b.listView,listGroup:b.listGroup,listItem:b.listItem})};r.spaceManager.saveFrameSchema(n.path,A,()=>Sp(v)).then(()=>i({...f0.node,props:{value:jr(`./#*${v.id}`)}}))},f=Object.keys(S8).map(m=>{let g=S8[m];return{name:g.name,value:g.view,onClick:()=>{c(m)},icon:g.icon}}),d=[mn,uf,C9,Xa,hn],p=[jv,O9,j9,M9,N9,T9,D9],h=[...u,{name:"List View",value:"frame",type:6,onSubmenu:m=>r.ui.openMenu(m,Ht(r.ui,f),t),icon:"ui//mk-make-list"},...d.map(m=>({name:m.node.name,onClick:()=>{l(m.node)},value:m.node.name,icon:m.def?.icon})),...p.map(m=>({name:m.node.name,value:"frame"+m.node.name,onClick:()=>{s(m.node,m.def.id)},icon:m.def?.icon}))];r.ui.openMenu(e,{ui:r.ui,multi:!1,editable:!1,value:[],options:h,searchable:a.searchable,showAll:!0},t)};var l6e=Ae(Te());var E8=e=>{let t=(r,n)=>{let i=o=>{e.setValue(o)},a=r.target.getBoundingClientRect();Gu(e.superstate,a,Ne(r.view.document),e.value,i)};return l6e.default.createElement("div",{className:"mk-color",style:{background:e.value},onClick:r=>{t(r,"--text-normal")}})};var Bo=Ae(Te());var u6e=Ae(yi()),so=Ae(Te());function Yet(e){if(Math.floor(e)===e)return 0;let t=e.toString();return t.split(".")[1].length||t.split(",")[1].length||0}function c6e({style:e={},modifiers:t={},onChange:r,onInput:n,...i}){let[a,o]=(0,so.useState)(i.value),[s,l]=(0,so.useState)(""),u=(0,so.useRef)(0),c=(0,so.useRef)(null),f=i.step?+i.step:1,d=(0,so.useMemo)(()=>({shiftKey:.1,...t}),[t]),[,p]=(0,so.useState)([0,0]),h={cursor:"ew-resize",...e},m=k=>{let j=k.target.value;isNaN(+j)||(o(+j),r?.(+j,c.current))},g=(0,u6e.debounce)(k=>{r?.(k,c.current)},200),A=(0,so.useCallback)(k=>{requestAnimationFrame(()=>{n?.(k,c.current)}),g(k)},[g,n]),b=(0,so.useCallback)(k=>{p(j=>{let{clientX:O,clientY:C}=k,[N,D]=j,P=N-O,q=D-C,z=1;s&&(z=d[s]||1);let I=f*z,T=Yet(I),L=Math.sqrt(P*P+q*q)*I;O{document.removeEventListener("mousemove",b),document.removeEventListener("mouseup",v)},[b]),x=(0,so.useCallback)(k=>{let j=+a;isNaN(j)&&(j=+(i.defaultValue||i.min||0)),u.current=j,p([k.clientX,k.clientY]),document.addEventListener("mousemove",b),document.addEventListener("mouseup",v)},[b,v,a,i.min,i.defaultValue]),w=k=>{k.metaKey?l("metaKey"):k.ctrlKey?l("ctrlKey"):k.altKey?l("altKey"):k.shiftKey&&l("shiftKey")},S=()=>{l("")};return(0,so.useEffect)(()=>{i.value!==a&&typeof i.value=="number"&&o(i.value)},[i.value]),(0,so.useEffect)(()=>(document.addEventListener("keydown",w),document.addEventListener("keyup",S),()=>{document.removeEventListener("mousemove",b),document.removeEventListener("mouseup",v),document.removeEventListener("keydown",w),document.removeEventListener("keyup",S)}),[]),so.default.createElement("input",{placeholder:"auto",type:"number",...i,value:a,style:h,onMouseDown:x,onChange:m,ref:c})}var va=e=>{let t=e.value&&Pu(e.value)?wa(e.value).match(/^(\d+(?:\.\d+)?)\s?([a-zA-Z%]+)$/):null,r=t?parseInt(t[1]):0,n=t&&t[2]?t[2]:e.units[0],i=a=>{let o=[];e.units.forEach(l=>{o.push({name:l,onClick:()=>{if(l=="%"){e.setValue(jr(`${100}${l}`));return}e.setValue(jr(`${r}${l}`))}})});let s=a.target.getBoundingClientRect();e.superstate.ui.openMenu(s,Ht(e.superstate.ui,o),Ne(a.view.document))};return so.default.createElement("div",{className:"mk-setter-step"},so.default.createElement("span",null,e.name),so.default.createElement(c6e,{min:e.min,max:e.max,value:r,onKeyDown:a=>{a.key=="Backspace"&&(a.currentTarget.value.length==1&&e.setValue(null),a.stopPropagation())},onChange:a=>{e.setValue(jr(`${a.toString()+n}`))}}),so.default.createElement("span",{onClick:a=>i(a)},n))};var ID=Ae(Te()),f6e=e=>{let t=["nw","n","ne","w","m","e","sw","s","se"],[r,n]=(0,ID.useState)(e.state?.styles?.layoutAlign);return ID.default.createElement("div",{className:"mk-editor-alignment-menu"},t.map(i=>ID.default.createElement("div",{className:`mk-editor-alignment-selector ${r==i&&"mk-active"}`,key:"d",onClick:()=>{n(i),e.saveStyleValue("layoutAlign",jr(i))}})))};var d6e=e=>{let{spaceInfo:t}=(0,Bo.useContext)(ur),{addNode:r}=(0,Bo.useContext)(Wi),{select:n}=(0,Bo.useContext)(Hi),{selectedNode:i,saveStyleValue:a}=e;return Bo.default.createElement(Bo.default.Fragment,null,Bo.default.createElement("div",{className:"mk-editor-frame-node-button-primary",dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//plus")},onClick:o=>{Z2(o.target.getBoundingClientRect(),Ne(o.view.document),e.superstate,t,s=>r(s,e.selectedNode,!0).then(l=>n(l.id))),o.stopPropagation()}}),Bo.default.createElement(Io,{icon:"ui//arrow-right",superstate:e.superstate,name:H.editor.rows,value:i.styles?.layout,setValue:o=>a("layout",o),onValue:"'row'",defaultValue:"'row'"}),Bo.default.createElement(Io,{icon:"ui//arrow-down",superstate:e.superstate,name:H.editor.columns,value:i.styles?.layout,setValue:o=>a("layout",o),onValue:"'column'",defaultValue:"'column'"}),Bo.default.createElement(Io,{icon:"ui//layout-dashboard",superstate:e.superstate,name:H.editor.gallery,value:i.styles?.layout,setValue:o=>a("layout",o),onValue:"'masonry'",defaultValue:"'masonry'"}),Bo.default.createElement("div",{className:"mk-divider"}),e.state.styles?.layout=="row"||e.state.styles?.layout=="column"?Bo.default.createElement(Bo.default.Fragment,null,Bo.default.createElement("div",{className:"mk-editor-frame-node-button",onClick:o=>{e.superstate.ui.openCustomMenu(o.target.getBoundingClientRect(),Bo.default.createElement(f6e,{...e}),{...e},Ne(o.view.document))},dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//grid")}}),Bo.default.createElement("div",{className:"mk-editor-frame-node-button",onClick:o=>{o.preventDefault(),o.stopPropagation(),a("flexWrap",`${wa(i.styles.flexWrap)=="wrap"?"":jr("wrap")}`)},dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//wrap-text")}}),Bo.default.createElement(va,{superstate:e.superstate,name:H.editor.gap,value:i.styles?.gap,setValue:o=>a("gap",o),units:["px"]})):Bo.default.createElement(Bo.default.Fragment,null,Bo.default.createElement(va,{superstate:e.superstate,name:H.editor.columns,value:i.styles?.columnCount,min:0,setValue:o=>a("columnCount",o),units:[""]})))};var hb=Ae(Te());var db=Ae(Te());var p6e=e=>{let{selectedNode:t,saveStyleValue:r}=e;return db.default.createElement(db.default.Fragment,null,db.default.createElement("div",{className:"mk-divider"}),db.default.createElement(va,{superstate:e.superstate,name:H.editor.width,min:0,value:t.styles?.width,setValue:n=>r("width",n),units:["px","%","em"]}),db.default.createElement("div",{className:"mk-divider"}),db.default.createElement(va,{superstate:e.superstate,name:H.editor.height,min:0,value:t.styles?.height,setValue:n=>r("height",n),units:["px","%","em"]}))};var gg=Ae(Te());var pb=Ae(Te());var m6e=e=>{let{selectedNode:t,saveStyleValue:r}=e;return pb.default.createElement(pb.default.Fragment,null,pb.default.createElement(va,{superstate:e.superstate,name:H.editor.marginLeft,value:t.styles?.marginLeft,setValue:n=>r("marginLeft",n),units:["px","em"]}),pb.default.createElement(va,{superstate:e.superstate,name:H.editor.marginTop,value:t.styles?.marginTop,setValue:n=>r("marginTop",n),units:["px","em"]}),pb.default.createElement(va,{superstate:e.superstate,name:H.editor.marginRight,value:t.styles?.marginRight,setValue:n=>r("marginRight",n),units:["px","em"]}),pb.default.createElement(va,{superstate:e.superstate,name:H.editor.marginBottom,value:t.styles?.marginBottom,setValue:n=>r("marginBottom",n),units:["px","em"]}))};var mb=Ae(Te());var h6e=e=>{let{selectedNode:t,saveStyleValue:r}=e;return mb.default.createElement(mb.default.Fragment,null,mb.default.createElement(va,{superstate:e.superstate,name:H.editor.paddingLeft,value:t.styles?.paddingLeft,setValue:n=>r("paddingLeft",n),units:["px","em"]}),mb.default.createElement(va,{superstate:e.superstate,name:H.editor.paddingTop,min:0,value:t.styles?.paddingTop,setValue:n=>r("paddingTop",n),units:["px","em"]}),mb.default.createElement(va,{superstate:e.superstate,name:H.editor.paddingRight,min:0,value:t.styles?.paddingRight,setValue:n=>r("paddingRight",n),units:["px","em"]}),mb.default.createElement(va,{superstate:e.superstate,name:H.editor.paddingBottom,min:0,value:t.styles?.paddingBottom,setValue:n=>r("paddingBottom",n),units:["px","em"]}))};var A6e=e=>{let{selectedNode:t,saveStyleValue:r}=e,n=a=>{let o=a.target.getBoundingClientRect();return e.superstate.ui.openCustomMenu(o,gg.default.createElement(h6e,{...e}),e,Ne(a.view.document))},i=a=>{let o=a.target.getBoundingClientRect();return e.superstate.ui.openCustomMenu(o,gg.default.createElement(m6e,{...e}),e,Ne(a.view.document))};return gg.default.createElement(gg.default.Fragment,null,gg.default.createElement(va,{superstate:e.superstate,name:H.editor.margin,value:t.styles?.margin,setValue:a=>r("margin",a),units:["px","em"]}),gg.default.createElement("div",{dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//plus")},onClick:a=>{i(a)}}),gg.default.createElement(va,{superstate:e.superstate,name:H.editor.padding,min:0,value:t.styles?.padding,setValue:a=>r("padding",a),units:["px","em"]}),gg.default.createElement("div",{dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//plus")},onClick:a=>{n(a)}}))};var g6e=e=>{let{selectedNode:t,saveStyleValue:r}=e,n=(i,a)=>{let o=a=="icon"?"iconSize":"imageSize",s=[];s.push({name:H.labels.styleSmall,icon:"type",onClick:()=>{r(o,"'s'")}}),s.push({name:H.labels.styleMedium,icon:"type",onClick:()=>{r(o,"'m'")}}),s.push({name:H.labels.styleLarge,icon:"type",onClick:()=>{r(o,"'l'")}});let l=i.target.getBoundingClientRect();e.superstate.ui.openMenu(l,Ht(e.superstate.ui,s),Ne(i.view.document))};return hb.default.createElement(hb.default.Fragment,null,hb.default.createElement("div",{className:"mk-divider"}),hb.default.createElement(A6e,{...e}),hb.default.createElement(p6e,{...e}),hb.default.createElement("div",{className:"mk-divider"}))};var k8=Ae(Te());var v6e=e=>{let{selectedNode:t,saveStyleValue:r}=e;return k8.default.createElement(k8.default.Fragment,null,k8.default.createElement(Io,{superstate:e.superstate,name:H.editor.minimize,value:t.styles?.["--mk-min-mode"],defaultValue:"false",onValue:"true",icon:"ui//panel-top-close",setValue:n=>r("--mk-min-mode",n)}))};var y6e=Ae(Ya());var Ro=Ae(Te());var b6e=e=>{let{selectedNode:t,pathState:r,savePropValue:n,frameProps:i,fields:a,frameProperties:o,instance:s}=e,l=(d,p)=>{d.preventDefault();let h=Pu(i?.[p.name]),m=[];h||(m.push({name:H.editor.unlinkProperty,icon:"ui//unplug",onClick:()=>{n(p.name,jr(e.state.props?.[p.name]))}}),m.push(Rt));let g=[p.type];g.push("fileprop"),(p.type=="image"||p.type=="link"||p.type=="context")&&(g.push("file"),g.push("link"),g.push("image"),g.push("context"));let A=v=>v=="$space"?H.editor.currentSpace:v;Object.keys(s.state.$contexts).forEach(v=>{Poe(e.superstate,v).forEach(x=>{v!=s.state.$contexts?.$context?._path&&x.primary=="true"||(g.includes(x.type)&&m.push({name:Vo(x,e.superstate),icon:Ii(x),description:A(v),onClick:()=>{n(p.name,`$contexts['${v}']['${x.name}']`)}}),(x.type=="link"||x.type=="image"||x.type=="file")&&(p.type=="icon"&&m.push({name:`${Vo(x,e.superstate)} Sticker`,icon:Ii(x),description:A(v),onClick:()=>{n(p.name,`$api.path.label($contexts['${v}']['${x.name}'])?.sticker`)}}),p.type=="text"&&m.push({name:H.editor.linkName.replace("${1}",Vo(x,e.superstate)),icon:Ii(x),description:A(v),onClick:()=>{n(p.name,`$api.path.label($contexts['${v}']['${x.name}'])?.name`)}}),p.type=="image"&&m.push({name:H.editor.linkThumbnail.replace("${1}",Vo(x,e.superstate)),icon:Ii(x),description:A(v),onClick:()=>{n(p.name,`$api.path.label($contexts['${v}']['${x.name}'])?.thumbnail`)}})))}),m.push(Rt)}),o.filter(v=>g.some(x=>x==v.type)).forEach(v=>{m.push({name:v.name,icon:Ii(v),onClick:()=>{n(p.name,`${v.schemaId}.props['${v.name}']`)}})}),m.push(Rt),o.filter(v=>v.type!=p.type).forEach(v=>{(v.type=="link"||v.type=="image"||v.type=="file")&&(p.type=="icon"&&m.push({name:H.editor.linkSticker.replace("${1}",Vo(v,e.superstate)),icon:Ii(v),onClick:()=>{n(p.name,`$api.path.label(${v.schemaId}.props['${v.name}'])?.sticker`)}}),p.type=="image"&&m.push({name:H.editor.linkThumbnail.replace("${1}",v.name),icon:Ii(v),onClick:()=>{n(p.name,`$api.path.label(${v.schemaId}.props['${v.name}'])?.thumbnail`)}})),p.type=="text"&&(v.type=="link"||v.type=="file")&&m.push({name:H.editor.linkName.replace("${1}",Vo(v,e.superstate)),icon:Ii(v),onClick:()=>{n(p.name,`$api.path.label(${v.schemaId}.props['${v.name}'])?.name`)}})});let b=d.target.getBoundingClientRect();e.superstate.ui.openMenu(b,Ht(e.superstate.ui,m),Ne(d.view.document),"bottom")},u=d=>o?.find(h=>h.name==Pm(i?.[d])?.prop),c=(d,p)=>{if(!d||!p)return null;if(d.type.startsWith("object"))return rL(p);if(d.type=="option")return(pr(d.value,d.type,e.superstate,r.path).options??[]).find(g=>g.value==wa(p))?.name??null;if(d.type=="super"){let h=pr(d.value,d.type,e.superstate);if(h.dynamic?wa(i[h.field??""]):h.field)return p}return Pu(p)?wa(p):null},f=d=>d.type.startsWith("object")||d.type=="super";return Ro.default.createElement("div",{className:"mk-editor-frame-properties"},Ro.default.createElement("div",{className:"mk-editor-actions-name"},Ro.default.createElement("div",{className:"mk-editor-actions-name-icon"},Ro.default.createElement("div",{className:"mk-icon-small",dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//list")}})),Ro.default.createElement("div",{className:"mk-editor-actions-name-text"},H.buttons.editProperty),Ro.default.createElement("span",null),Ro.default.createElement("div",{className:"mk-icon-small mk-inline-button",dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//close")},onClick:()=>e.hide()})),Ro.default.createElement("div",{className:"mk-props-contexts"},a.map((d,p)=>{let h=d.type.startsWith("object")?JM(i?.[d.name],d.type):d.type=="super"||Pu(i?.[d.name]),m=f(d);return Ro.default.createElement(Ro.default.Fragment,{key:p},h?Ro.default.createElement(bs,{initialValue:c(d,i?.[d.name]),column:d,compactMode:!1,superstate:e.superstate,editMode:3,row:e.state?.props,updateValue:g=>{Rx(d)?n(d.name,g):n(d.name,jr(g))},linkProp:g=>l(g,d),source:r.path,columns:o}):Ro.default.createElement("div",{className:(0,y6e.default)("mk-path-context-row",m&&"mk-path-context-stacked")},d.type=="input"?Ro.default.createElement(v9,{initialValue:i?.[d.name],superstate:e.superstate,compactMode:!0,property:d,editMode:3,saveValue:g=>n(d.name,jr(g)),columns:o}):Ro.default.createElement(Ro.default.Fragment,null,Ro.default.createElement(JC,{path:r.path,superstate:e.superstate,property:d,draggable:!0}),Ro.default.createElement("div",{className:"mk-active"},Ro.default.createElement("div",{"aria-label":H.editor.linkedProperty},Mk(i?.[d.name])))),Ro.default.createElement("span",null),!m&&Ro.default.createElement("div",{"aria-label":H.editor.linkProperty,className:"mk-icon-small mk-inline-button",onClick:g=>l(g,d),dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//plug")}})))})))};var X2=Ae(Te());var Vv=Ae(Te());var x6e=e=>{let{selectedNode:t,saveStyleValue:r}=e,n=a=>{let o=[];o.push({name:H.editor.strokeNone,icon:"ui//type",onClick:()=>{r("outlineStyle","'none'")}}),o.push({name:H.editor.strokeSolid,icon:"ui//type",onClick:()=>{r("outlineStyle","'solid'")}}),o.push({name:H.editor.strokeDashed,icon:"ui//type",onClick:()=>{r("outlineStyle","'dashed'")}}),o.push({name:H.editor.strokeDotted,icon:"ui//type",onClick:()=>{r("outlineStyle","'dotted'")}});let s=a.target.getBoundingClientRect();e.superstate.ui.openMenu(s,Ht(e.superstate.ui,o),Ne(a.view.document))},i=(a,o)=>{let s=u=>{r(o,`'${u}'`)},l=a.target.getBoundingClientRect();Gu(e.superstate,l,Ne(a.view.document),wa(t.styles?.[o]),s)};return Vv.default.createElement(Vv.default.Fragment,null,Vv.default.createElement("div",{className:"mk-divider"}),Vv.default.createElement("div",{className:"mk-editor-frame-node-button",onClick:a=>n(a)},Vv.default.createElement("div",{dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//case-sensitive")}}),e.state.styles?.outlineStyle??H.labels.none),Vv.default.createElement(va,{superstate:e.superstate,name:H.editor.size,value:e.state.styles?.outlineWidth,setValue:a=>r("outlineWidth",a),units:["px","em"]}),Vv.default.createElement("div",{onClick:a=>{i(a,"outlineColor")},className:"mk-color",style:{background:e.state.styles?.outlineColor}}))};var w6e=e=>{let{selectedNode:t,saveStyleValue:r}=e,n=(i,a)=>{let o=l=>{r(a,`'${l}'`)},s=i.target.getBoundingClientRect();Gu(e.superstate,s,Ne(i.view.document),wa(e.selectedNode.styles?.[a]),o)};return X2.default.createElement(X2.default.Fragment,null,X2.default.createElement("div",{className:"mk-color",onClick:i=>n(i,"background"),style:{background:wa(e.selectedNode.styles?.background)}}),X2.default.createElement(x6e,{...e}),X2.default.createElement(va,{superstate:e.superstate,name:H.editor.opacity,min:0,max:100,value:t.styles?.opacity,setValue:i=>r("opacity",i),units:["%"]}))};function S6e(){let{fonts:e}=document,t=e.entries(),r=[],n=!1;for(;!n;){let i=t.next();i.done?n=i.done:r.push(i.value[0].family)}return Array.from(new Set(r))}var rl=Ae(Te());var E6e=e=>{let{selectedNode:t,saveStyleValue:r}=e,n=o=>{let s=S6e().map(l=>({name:l,value:l}));e.superstate.ui.openMenu(o.target.getBoundingClientRect(),{ui:e.superstate.ui,multi:!1,editable:!1,searchable:!0,saveOptions:(l,u)=>{r("--font-text",`'${u[0]}'`)},value:[t.styles?.["--font-text"]??""],options:s},Ne(o.view.document))},i=(o,s)=>{o.stopPropagation(),o.preventDefault(),r("textAlign",`'${s}'`)},a=(o,s)=>{let l=c=>{r(s,`'${c}'`)},u=o.target.getBoundingClientRect();Gu(e.superstate,u,Ne(o.view.document),wa(e.selectedNode.styles?.[s]),l)};return rl.default.createElement(rl.default.Fragment,null,rl.default.createElement("div",{className:"mk-editor-frame-node-button",onClick:o=>n(o)},rl.default.createElement("div",{dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//type")}}),t.styles?.["--font-text"]),rl.default.createElement("div",{className:"mk-divider"}),rl.default.createElement(va,{superstate:e.superstate,name:H.editor.size,value:t.styles?.["--font-text-size"],setValue:o=>r("--font-text-size",o),units:["px","em"]}),rl.default.createElement(Io,{superstate:e.superstate,name:H.editor.bold,value:t.styles?.["--font-text-weight"],defaultValue:"'normal'",onValue:"'bold'",icon:"ui//bold",setValue:o=>r("--font-text-weight",o)}),rl.default.createElement(Io,{superstate:e.superstate,name:H.editor.italic,value:t.styles?.["--font-text-style"],defaultValue:"'normal'",onValue:"'italic'",icon:"ui//italic",setValue:o=>r("--font-text-style",o)}),rl.default.createElement(Io,{superstate:e.superstate,name:H.editor.underline,value:t.styles?.["--font-text-decoration"],defaultValue:"'none'",onValue:"'underline'",icon:"ui//underline",setValue:o=>r("--font-text-decoration",o)}),rl.default.createElement(E8,{superstate:e.superstate,value:wa(t.styles?.["--font-text-color"]),setValue:o=>r("--font-text-color",`'${o}'`)}),rl.default.createElement("div",{className:"mk-divider"}),rl.default.createElement(Io,{superstate:e.superstate,name:H.editor.alignLeft,value:t.styles?.textAlign,defaultValue:"'left'",onValue:"'left'",icon:"ui//align-left",setValue:o=>r("textAlign",o)}),rl.default.createElement(Io,{superstate:e.superstate,name:H.editor.alignCenter,value:t.styles?.textAlign,defaultValue:"'center'",onValue:"'center'",icon:"ui//align-center",setValue:o=>r("textAlign",o)}),rl.default.createElement(Io,{superstate:e.superstate,name:H.editor.alignRight,value:t.styles?.textAlign,defaultValue:"'left'",onValue:"'right'",icon:"ui//align-right",setValue:o=>r("textAlign",o)}),rl.default.createElement(Io,{superstate:e.superstate,name:H.editor.alignJustify,value:t.styles?.textAlign,defaultValue:"'left'",onValue:"'justify'",icon:"ui//align-justify",setValue:o=>r("textAlign",o)}),rl.default.createElement("div",{className:"mk-divider"}),rl.default.createElement(va,{superstate:e.superstate,name:H.editor.numberOfLines,value:t.styles?.["--line-count"],setValue:o=>r("--line-count",o),units:[""]}))};var k6e=e=>{let{pathState:t}=(0,ir.useContext)($r),{deleteFrame:r,duplicateFrame:n}=e,{spaceInfo:i}=(0,ir.useContext)(ur),{addNode:a,ungroupNode:o,updateNode:s,saveNodes:l,frameProperties:u}=(0,ir.useContext)(Wi),{selectionMode:c}=(0,ir.useContext)(Hi),{instance:f}=(0,ir.useContext)(_i),d=(0,ir.useCallback)((C,N)=>{s(N,{props:{...C}})},[s]),p=(C,N)=>{s(e.node,{styles:{[C]:N}})},[h,m]=(0,ir.useState)(0),[g,A]=(0,ir.useState)(e.node.props),b=(0,ir.useMemo)(()=>Object.keys(e.node.types).map(C=>({type:e.node.types[C],name:C,attrs:e.node.propsAttrs?.[C],schemaId:e.node.schemaId,value:e.node.propsValue?.[C]})),[e.node]);(0,ir.useEffect)(()=>{A(e.node.props)},[e.node]);let v=(0,ir.useCallback)((C,N)=>{A(D=>({...D,[C]:N})),d({[C]:N},e.node)},[A,d,e.node]),x=[{type:"h1",name:H.commands.h1,icon:"ui//heading-1",class:"mk-t-h1"},{type:"h2",name:H.commands.h2,icon:"ui//heading-2",class:"mk-t-h2"},{type:"h3",name:H.commands.h3,icon:"ui//heading-3",class:"mk-t-h3"},{type:"h4",name:H.commands.h4,icon:"ui//heading-4",class:"mk-t-h4"},{type:"h5",name:H.commands.h5,icon:"ui//heading-5",class:"mk-t-h5"},{type:"h6",name:H.commands.h6,icon:"ui//heading-6",class:"mk-t-h6"},{type:"p",name:H.commands.paragraph,icon:"ui//type",class:"mk-t-p"}],w=C=>{let N=[];x.forEach(P=>{N.push({name:P.name,icon:P.icon,onClick:()=>{p("class",`'${P.class}'`)}})});let D=C.target.getBoundingClientRect();e.superstate.ui.openMenu(D,Ht(e.superstate.ui,N),Ne(C.view.document))},S=(0,ir.useRef)(null),k={superstate:e.superstate,exitMenu:()=>m(0),saveStyleValue:p,savePropValue:v,frameProps:g,selectedNode:e.node,setHoverMenu:m,fields:b,state:e.state},j={...k,pathState:t,frameProperties:u,instance:f};(0,ir.useEffect)(()=>{S.current&&S.current.update(j)},[f,b,e.state,e.node,g]);let O=(0,ir.useRef)(null);return ir.default.createElement("div",{className:"mk-editor-frame-node-selector",style:{pointerEvents:"auto"},ref:O,onClick:C=>{C.preventDefault()}},e.node.type=="new"&&ir.default.createElement(ir.default.Fragment,null,ir.default.createElement("div",{className:"mk-editor-frame-node-button-primary",dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//plus")},onClick:C=>{Z2(C.target.getBoundingClientRect(),Ne(C.view.document),e.superstate,i,N=>l([{...N,id:e.node.id,parentId:e.node.parentId,schemaId:e.node.schemaId,rank:e.node.rank,props:{...N.props,value:e.node.props?.value}}])),C.stopPropagation()}}),ir.default.createElement("div",{className:"mk-editor-frame-node-button-primary",dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//plus")},onClick:C=>{let N=e.superstate.spacesIndex.get(i.path);N&&za(e.superstate,N,"md",e.state?.props?.value,!0).then(D=>l([{...e.node,type:Mo.node.type,props:{...e.node.props,value:jr(D)}}])),C.stopPropagation()}})),h==0?ir.default.createElement(ir.default.Fragment,null,e.node.type=="group"||e.node.type=="content"?ir.default.createElement(d6e,{...k}):b.length>0&&ir.default.createElement("div",{"aria-label":"Properties",className:"mk-editor-frame-node-button",onClick:C=>{if(S.current){S.current.hide(),S.current=null;return}C.preventDefault(),S.current=e.superstate.ui.openCustomMenu(O.current.getBoundingClientRect(),ir.default.createElement(b6e,{...j}),j,Ne(C.view.document),"bottom")},dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//list")}}),e.node.type=="text"&&ir.default.createElement(ir.default.Fragment,null,ir.default.createElement("div",{className:"mk-editor-frame-node-button",onClick:C=>w(C)},ir.default.createElement("div",{dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker(x.find(C=>C.class==wa(e.node.styles?.class))?.icon??"ui//type")}}),x.find(C=>C.class==wa(e.node.styles?.class))?.name??"Paragraph"),ir.default.createElement("div",{className:"mk-divider"})),e.node.type=="icon"&&ir.default.createElement(E8,{superstate:e.superstate,value:wa(e.node.styles?.color),setValue:C=>p("color",`'${C}'`)}),ir.default.createElement("div",{"aria-label":"Layout",className:"mk-editor-frame-node-button",onClick:C=>{C.preventDefault(),C.stopPropagation(),e.editLayout(!0),m(4)},dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//scaling")}}),ir.default.createElement("div",{"aria-label":"Style",className:"mk-editor-frame-node-button",onClick:C=>{C.preventDefault(),C.stopPropagation(),m(5)},dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//paintbrush")}}),(e.node.type=="flow"||e.node.type=="space")&&ir.default.createElement(v6e,{...k}),ir.default.createElement("div",{"aria-label":"Text Style",className:"mk-editor-frame-node-button",onClick:C=>{C.preventDefault(),C.stopPropagation(),m(3)},dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//type")}}),c==1&&ir.default.createElement(ir.default.Fragment,null,ir.default.createElement("div",{className:"mk-divider"}),ir.default.createElement(Io,{superstate:e.superstate,name:"Page Width",setValue:C=>{p("--max-width",C)},defaultValue:"",onValue:jr("100%"),value:e.node.styles?.["--max-width"],icon:"ui//full-width"})),ir.default.createElement("div",{className:"mk-divider"}),e.node.type=="group"||e.node.type=="container"?ir.default.createElement("div",{"aria-label":"Ungroup",className:"mk-editor-frame-node-button",onClick:()=>o(e.node),dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//copy-x")}}):ir.default.createElement(ir.default.Fragment,null),ir.default.createElement("div",{className:"mk-editor-frame-node-button","aria-label":"Delete",onClick:()=>r(),dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//trash")}})):ir.default.createElement(ir.default.Fragment,null,ir.default.createElement("div",{className:"mk-editor-frame-node-button",onMouseDown:C=>{C.stopPropagation(),e.editLayout(!1),m(0)},dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//close")}}),ir.default.createElement("div",{className:"mk-editor-frame-node-divider"}),h==3?ir.default.createElement(E6e,{...k}):h==4?ir.default.createElement(g6e,{...k}):h==5?ir.default.createElement(w6e,{...k}):ir.default.createElement(ir.default.Fragment,null)))};var Ph=Ae(Te()),C6e=e=>{let{spaceInfo:t}=(0,Ph.useContext)(ur),{addNode:r,moveUp:n,moveDown:i,setLastCreatedId:a}=(0,Ph.useContext)(Wi),{select:o,selection:s}=(0,Ph.useContext)(Hi),l=s.includes(e.node.id);return Ph.default.createElement(Ph.default.Fragment,null,Ph.default.createElement("div",{className:"mk-editor-frame-hover-horizontal",style:{pointerEvents:"auto",opacity:e.visible?"1":"0"}},e.dragRef&&Ph.default.createElement("div",{className:"mk-icon-small mk-editor-frame-hover-button",dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//handle")},style:{cursor:"grab"},ref:e.dragRef,onClick:u=>{if(u.stopPropagation(),s.length==1&&l){o(null);return}u.shiftKey?o(e.node.id,!0):o(e.node.id)},...e.listeners??{},...e.attributes??{}}),!Gr(e.superstate.ui)&&Ph.default.createElement("div",{onClick:u=>{Z2(u.target.getBoundingClientRect(),window,e.superstate,t,c=>r(c,e.node).then(f=>o(f.id))),u.stopPropagation()},className:"mk-icon-small mk-editor-frame-hover-button",dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//plus")}})))};var vg=Ae(Te()),CZ=e=>{let t=(0,vg.useRef)(null),[r,n]=(0,vg.useState)(0),i=(s,l,u)=>{let c=s.x-e.containerRect.x,f=c+l.width-u.width,d=c;return f>0&&(s.x-e.containerRect.x-l.width>0?d=u.width-l.width:d=0),d},[a,o]=(0,vg.useState)(!1);return(0,vg.useEffect)(()=>{let s=new ResizeObserver(l=>{let u=l[0].target.getBoundingClientRect();o(!0),n(i(e.nodeRect,u,e.containerRect))});return t.current&&s.observe(t.current),()=>{s.disconnect()}},[t]),vg.default.createElement("div",{className:"mk-editor-frame-node-container",ref:t,style:{visibility:a?"visible":"hidden",pointerEvents:"auto",left:r,bottom:`calc(100% - ${e.nodeRect.y-e.containerRect.y-10}px)`,maxWidth:e.containerRect.width},onClick:s=>{s.preventDefault(),s.stopPropagation()}},e.children)};var D6e=Ae(Ya()),qc=Ae(Te());var Xu=Ae(Te()),nl=e=>{let[t,r]=(0,Xu.useState)(null),n=(0,Xu.useRef)(e.value),i=(0,Xu.useRef)(e.value),[,a]=(0,Xu.useState)([0,0]),o=e.step??1,s=(0,Xu.useCallback)(d=>{a(p=>{let{clientX:h,clientY:m}=d,[g,A]=p,b=e.reverseX?g-h:h-g,v=e.reverseY?m-A:A-m,x=e.mod??1,w=o*x,S=Math.sqrt((b+v)/2*(b+v)/2)*w;b+v<0&&(S=-S),e.disableX&&(S=v*w),e.disableY&&(S=b*w);let k=n.current+S;return k=e.min!=null?Math.max(k,e.min):k,k=e.max!=null?Math.min(k,e.max):k,i.current=k,e.onDragMove(k,{ctrlKey:d.ctrlKey,metaKey:d.metaKey,altKey:d.altKey,shiftKey:d.shiftKey}),p}),d.stopPropagation()},[t,e.max,e.min,o,e.onDragMove,e.mod]),l=(0,Xu.useCallback)(d=>{let p=h=>{h.stopPropagation(),window.removeEventListener("click",p,!0)};window.addEventListener("click",p,!0),document.removeEventListener("mousemove",s),document.removeEventListener("mouseup",l),e.onDragEnd(i.current,{ctrlKey:d.ctrlKey,metaKey:d.metaKey,altKey:d.altKey,shiftKey:d.shiftKey}),d.preventDefault(),d.stopPropagation()},[s,e.onDragEnd]),u=(0,Xu.useCallback)(d=>{n.current=e.value,a([d.clientX,d.clientY]),document.addEventListener("mousemove",s),document.addEventListener("mouseup",l),d.stopPropagation()},[s,l,e.value]),c=d=>{d.metaKey?r("metaKey"):d.ctrlKey?r("ctrlKey"):d.altKey?r("altKey"):d.shiftKey&&r("shiftKey")},f=()=>{r(null)};return(0,Xu.useEffect)(()=>(document.addEventListener("keydown",c),document.addEventListener("keyup",f),()=>{document.removeEventListener("mousemove",s),document.removeEventListener("mouseup",l),document.removeEventListener("keydown",c),document.removeEventListener("keyup",f)}),[]),Xu.default.createElement("div",{className:"mk-frame-draggable-handle",onMouseDown:u,"data-placeholder":i.current.toString(),style:{cursor:e.cursor,width:"100%",height:"100%",pointerEvents:"auto"}},Xu.default.createElement("span",null))};var O6e=e=>{let t=e.styles.borderRadius?e.styles.borderRadius.match(/^(\d+(?:\.\d+)?)\s?([a-zA-Z%]+)$/):null,r=t?parseInt(t[1]):0,n=t&&t[2]?t[2]:"px",[i,a]=qc.default.useState(Math.max(8,r));(0,qc.useEffect)(()=>{a(r)},[r]);let o={min:0,max:Math.min(e.clientSize.height/2,e.clientSize.width/2),value:i,onDragMove:l=>{a(l)},onDragEnd:l=>{e.saveStyles({borderRadius:`"${l}${n}"`})}},s=Math.max(8,i);return qc.default.createElement("div",{style:{position:"absolute",top:0,left:0,width:e.clientSize.width,height:e.clientSize.height,display:"flex",zIndex:200,borderRadius:i,border:"1px solid var(--mk-ui-border-accent)"}},qc.default.createElement("div",{className:(0,D6e.default)("mk-frame-corners")},qc.default.createElement("div",{className:"mk-frame-corner",style:{position:"absolute",transform:`translate(${s}px, ${s}px)`,zIndex:"var(--mk-layer-editor-overlay)"}},qc.default.createElement(nl,{...o,cursor:"nwse-resize",reverseY:!0})),qc.default.createElement("div",{className:"mk-frame-corner",style:{position:"absolute",transform:`translate(${e.clientSize.width-s}px, ${s}px)`,zIndex:"var(--mk-layer-editor-overlay)"}},qc.default.createElement(nl,{...o,cursor:"nesw-resize",reverseX:!0,reverseY:!0})),qc.default.createElement("div",{className:"mk-frame-corner",style:{position:"absolute",transform:`translate(${s}px, ${e.clientSize.height-s}px)`,zIndex:"var(--mk-layer-editor-overlay)"}},qc.default.createElement(nl,{...o,cursor:"nesw-resize"})),qc.default.createElement("div",{className:"mk-frame-corner",style:{position:"absolute",transform:`translate(${e.clientSize.width-s}px, ${e.clientSize.height-s}px)`,zIndex:"var(--mk-layer-editor-overlay)"}},qc.default.createElement(nl,{...o,reverseX:!0,cursor:"nwse-resize"}))))};var M6e=Ae(Ya());var yg=Ae(Te());var Zet=e=>{let{instance:t,id:r}=(0,yg.useContext)(_i),{spaceInfo:n}=(0,yg.useContext)(ur),{setNodeRef:i}=zu({id:e.id+e.direction,data:{id:e.id+e.direction,direction:e.direction,type:"node",parent:e.parentId,root:r,frame:e.schemaID,space:n.path,node:e.node}}),a=20,o=e.direction=="left"?-a:e.direction=="right"?e.width:0,s=e.direction=="bottom"?e.insertMode!=0?e.height:e.height/2:e.direction=="top"&&e.insertMode!=0?-a:0,l=e.direction=="left"||e.direction=="right"?a:e.width,u=e.direction=="top"||e.direction=="bottom"?e.insertMode!=0?a:e.height/2:e.height,c=e.insertMode!=0?e.direction=="top"?"bottom":e.direction=="bottom"?"top":e.direction:e.direction;return yg.default.createElement("div",{ref:i,className:(0,M6e.default)(e.active?`mk-indicator-${c}`:"","mk-frame-drop-zone"),style:{left:o,top:s,width:l,height:u}})},j6e=e=>{let{frameSchema:t}=(0,yg.useContext)(ma),{hoverNode:r}=(0,yg.useContext)(_i),n=[...e.mode==1?["top","bottom","left","right"]:e.mode==2?["top","bottom"]:e.mode==3?["left","right"]:[],...e.insertMode==1?["inside"]:[]];return yg.default.createElement("div",{className:"mk-frame-drop-zone-container",style:{width:e.width,height:e.height}},n.map(i=>yg.default.createElement(Zet,{...e,key:i,active:r?.node==e.node&&r?.direction==i,direction:i,mode:e.mode,schemaID:t.id})))};var ya=Ae(Te());var Xet=(e,t,r,n)=>{let i={},a=0,o=0,s=r?"width":"height",l=r?"height":"width";return e.forEach((u,c,f)=>{c==0?(i[a]={start:c,end:c,maxValue:u[l],items:[{...u,row:a}]},o=u[s]):f[c][s]+n>t[s]?(a++,i[a]={start:c,end:c,maxValue:u[l],items:[{...u,row:a}]}):f[c][s]+n+o>t[s]?(a++,i[a]={start:c,end:c,maxValue:u[l],items:[{...u,row:a}]},o=u[s]):i[a]?(i[a]={start:i[a].start,end:c,maxValue:Math.max(i[a].maxValue,u[l]),items:[...i[a].items,{...u,row:a}]},o+=u[s]+n):console.log("Warning: Flexbox found orphan row")}),i},N6e=e=>{let t=l=>{let u=l?l.match(/^(\d+(?:\.\d+)?)\s?([a-zA-Z%]+)$/):null;return u?parseInt(u[1]):0},[r,n]=ya.default.useState({row:t(e.styles.rowGap),column:t(e.styles.columnGap)});(0,ya.useEffect)(()=>{n({row:t(e.styles.rowGap),column:t(e.styles.columnGap)})},[e.styles]);let i={value:r[e.direction],onDragMove:l=>{n({...r,[e.direction=="column"?"row":"column"]:l})},onDragEnd:l=>{e.saveStyles(e.direction=="column"?{rowGap:`"${l}px"`}:{columnGap:`"${l}px"`})}},a={value:r[e.direction=="column"?"row":"column"],onDragMove:l=>{n({...r,[e.direction]:l})},onDragEnd:l=>{e.saveStyles(e.direction=="column"?{columnGap:`"${l}px"`}:{rowGap:`"${l}px"`})}},o=(0,ya.useMemo)(()=>Xet(e.childSizes,{width:e.clientSize.width-e.clientSize.paddingLeft-e.clientSize.paddingRight,height:e.clientSize.height-e.clientSize.paddingTop-e.clientSize.paddingBottom},e.direction=="row",r[e.direction=="column"?"row":"column"]),[e.childSizes,e.clientSize,e.direction,r]),s=(0,ya.useMemo)(()=>{let l=[];return Object.keys(o).forEach(u=>{l.push(...o[u].items)}),l},[o]);return ya.default.createElement("div",{className:`mk-frame-gaps ${G2(e.styles)}`,style:{position:"absolute",top:0,left:0,width:e.clientSize.width,height:e.clientSize.height,padding:e.clientSize.paddingTop,paddingLeft:e.clientSize.paddingLeft,paddingBottom:e.clientSize.paddingBottom,paddingRight:e.clientSize.paddingRight,flexWrap:e.styles.flexWrap}},e.direction==="row"?s.map((l,u,c)=>ya.default.createElement(ya.default.Fragment,null,ya.default.createElement("div",{style:{width:l.width,height:l.height}}),u==c.length-1?ya.default.createElement(ya.default.Fragment,null):o[l.row].end==u?ya.default.createElement("div",{key:u,className:"mk-frame-gap-handle-h",style:{width:"100%",height:Math.max(8,Math.abs(r.row)),zIndex:"var(--mk-layer-editor-overlay)"}},ya.default.createElement(nl,{...a,cursor:"col-resize",disableX:!0,reverseY:!0})):ya.default.createElement("div",{key:u,className:"mk-frame-gap-handle-v",style:{width:Math.max(8,Math.abs(r.column)),height:o[l.row].maxValue,zIndex:"var(--mk-layer-editor-overlay)"}},ya.default.createElement(nl,{...i,cursor:"col-resize",disableY:!0})))):s.map((l,u,c)=>ya.default.createElement(ya.default.Fragment,null,ya.default.createElement("div",{style:{width:l.width,height:l.height}}),u==c.length-1?ya.default.createElement(ya.default.Fragment,null):o[l.row].end==u?ya.default.createElement("div",{key:u,className:"mk-frame-gap-handle-v",style:{height:"100%",width:Math.max(8,Math.abs(r.column)),zIndex:"var(--mk-layer-editor-overlay)"}},ya.default.createElement(nl,{...a,cursor:"col-resize",disableX:!0,reverseY:!0})):ya.default.createElement("div",{key:u,className:"mk-frame-gap-handle-h",style:{height:Math.max(8,Math.abs(r.row)),width:o[l.row].maxValue,zIndex:"var(--mk-layer-editor-overlay)"}},ya.default.createElement(nl,{...i,cursor:"row-resize",disableX:!0,reverseY:!0})))))};var T6e=Ae(Ya()),vu=Ae(Te());var F6e=e=>{let t=["padding","paddingTop","paddingBottom","paddingLeft","paddingRight"],[r,n]=vu.default.useState({padding:0,paddingTop:null,paddingBottom:null,paddingLeft:null,paddingRight:null}),i="px";(0,vu.useEffect)(()=>{let f=d=>{if(!e.styles[d])return null;let p=e.styles[d]?e.styles[d].match(/^(\d+(?:\.\d+)?)\s?([a-zA-Z%]+)$/):null;return Math.max(p?parseInt(p[1]):0,8)};n(d=>t.reduce((p,h)=>({...p,[h]:f(h)}),d))},[e.styles]);let[a,o]=vu.default.useState(!1),s={min:0,mod:2},l=f=>Math.max(5,r[f]??r.padding),u=(f,d,p)=>{n(h=>p.shiftKey?{padding:d,paddingBottom:null,paddingTop:null,paddingLeft:null,paddingRight:null}:{...h,[f]:d})},c=(f,d,p)=>{e.saveStyles(p.shiftKey?{padding:`'${d}${i}'`,paddingBottom:"",paddingTop:"",paddingLeft:"",paddingRight:""}:{[f]:`'${d}${i}'`})};return(0,vu.useEffect)(()=>{let f=p=>{p.key==="Shift"&&o(!0)},d=p=>{p.key==="Shift"&&o(!1)};return window.addEventListener("keydown",f),window.addEventListener("keyup",d),()=>{window.removeEventListener("keydown",f),window.removeEventListener("keyup",d)}},[]),vu.default.createElement("div",{style:{position:"absolute",top:0,left:0,width:e.clientSize.width,height:e.clientSize.height,display:"flex",zIndex:200,border:"1px solid var(--mk-ui-color-border-accent)"}},vu.default.createElement("div",{className:(0,T6e.default)("mk-frame-paddings",a&&"mk-modifier-shift")},vu.default.createElement("div",{className:"mk-frame-padding-handle-h",style:{position:"absolute",transform:`translate(${0}px, ${0}px)`,height:l("paddingTop"),zIndex:"var(--mk-layer-editor-overlay)"}},vu.default.createElement(nl,{...s,value:r.paddingTop??r.padding,cursor:"s-resize",max:e.clientSize.height,onDragMove:(f,d)=>{u("paddingTop",f,d)},onDragEnd:(f,d)=>{c("paddingTop",f,d)},reverseY:!0,disableX:!0})),vu.default.createElement("div",{className:"mk-frame-padding-handle-v",style:{position:"absolute",transform:`translate(${e.clientSize.width-l("paddingRight")}px, ${0}px)`,width:l("paddingRight"),zIndex:"var(--mk-layer-editor-overlay)"}},vu.default.createElement(nl,{...s,value:r.paddingRight??r.padding,cursor:"w-resize",onDragMove:(f,d)=>{u("paddingRight",f,d)},max:e.clientSize.width,onDragEnd:(f,d)=>{c("paddingRight",f,d)},reverseX:!0,reverseY:!0,disableY:!0})),vu.default.createElement("div",{className:"mk-frame-padding-handle-v",style:{position:"absolute",transform:`translate(${0}px, ${0}px)`,width:l("paddingLeft"),zIndex:"var(--mk-layer-editor-overlay)"}},vu.default.createElement(nl,{...s,value:r.paddingLeft??r.padding,cursor:"e-resize",max:e.clientSize.width,onDragMove:(f,d)=>{u("paddingLeft",f,d)},onDragEnd:(f,d)=>{c("paddingLeft",f,d)},disableY:!0})),vu.default.createElement("div",{className:"mk-frame-padding-handle-h",style:{position:"absolute",transform:`translate(${0}px, ${e.clientSize.height-l("paddingBottom")}px)`,height:l("paddingBottom"),zIndex:"var(--mk-layer-editor-overlay)"}},vu.default.createElement(nl,{...s,value:r.paddingBottom??r.padding,cursor:"n-resize",max:e.clientSize.height,onDragMove:(f,d)=>{u("paddingBottom",f,d)},onDragEnd:(f,d)=>{c("paddingBottom",f,d)},reverseX:!0,disableX:!0}))))};var z6e=Ae(Ya());var Ab=Ae(Te()),q6e=Ae(bl());var D8=Ae(Te()),Ket=function(){var e=function(t,r){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var a in i)Object.prototype.hasOwnProperty.call(i,a)&&(n[a]=i[a])},e(t,r)};return function(t,r){e(t,r);function n(){this.constructor=t}t.prototype=r===null?Object.create(r):(n.prototype=r.prototype,new n)}}(),Jo=function(){return Jo=Object.assign||function(e){for(var t,r=1,n=arguments.length;r"u"?void 0:Number(n),maxHeight:typeof i>"u"?void 0:Number(i),minWidth:typeof a>"u"?void 0:Number(a),minHeight:typeof o>"u"?void 0:Number(o)}},itt=["as","style","className","grid","snap","bounds","boundsByDirection","size","defaultSize","minWidth","minHeight","maxWidth","maxHeight","lockAspectRatio","lockAspectRatioExtraWidth","lockAspectRatioExtraHeight","enable","handleStyles","handleClasses","handleWrapperStyle","handleWrapperClass","children","onResizeStart","onResize","onResizeStop","handleComponent","scale","resizeRatio","snapGap"],$6e="__resizable_base__",L6e=function(e){ett(t,e);function t(r){var n=e.call(this,r)||this;return n.ratio=1,n.resizable=null,n.parentLeft=0,n.parentTop=0,n.resizableLeft=0,n.resizableRight=0,n.resizableTop=0,n.resizableBottom=0,n.targetLeft=0,n.targetTop=0,n.appendBase=function(){if(!n.resizable||!n.window)return null;var i=n.parentNode;if(!i)return null;var a=n.window.document.createElement("div");return a.style.width="100%",a.style.height="100%",a.style.position="absolute",a.style.transform="scale(0, 0)",a.style.left="0",a.style.flex="0 0 100%",a.classList?a.classList.add($6e):a.className+=$6e,i.appendChild(a),a},n.removeBase=function(i){var a=n.parentNode;!a||a.removeChild(i)},n.ref=function(i){i&&(n.resizable=i)},n.state={isResizing:!1,width:typeof(n.propsSize&&n.propsSize.width)>"u"?"auto":n.propsSize&&n.propsSize.width,height:typeof(n.propsSize&&n.propsSize.height)>"u"?"auto":n.propsSize&&n.propsSize.height,direction:"right",original:{x:0,y:0,width:0,height:0},backgroundStyle:{height:"100%",width:"100%",backgroundColor:"rgba(0,0,0,0)",cursor:"auto",opacity:0,position:"fixed",zIndex:9999,top:"0",left:"0",bottom:"0",right:"0"},flexBasis:void 0},n.onResizeStart=n.onResizeStart.bind(n),n.onMouseMove=n.onMouseMove.bind(n),n.onMouseUp=n.onMouseUp.bind(n),n}return Object.defineProperty(t.prototype,"parentNode",{get:function(){return this.resizable?this.resizable.parentNode:null},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"window",{get:function(){return!this.resizable||!this.resizable.ownerDocument?null:this.resizable.ownerDocument.defaultView},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"propsSize",{get:function(){return this.props.size||this.props.defaultSize||ttt},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"size",{get:function(){var r=0,n=0;if(this.resizable&&this.window){var i=this.resizable.offsetWidth,a=this.resizable.offsetHeight,o=this.resizable.style.position;o!=="relative"&&(this.resizable.style.position="relative"),r=this.resizable.style.width!=="auto"?this.resizable.offsetWidth:i,n=this.resizable.style.height!=="auto"?this.resizable.offsetHeight:a,this.resizable.style.position=o}return{width:r,height:n}},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"sizeStyle",{get:function(){var r=this,n=this.props.size,i=function(s){if(typeof r.state[s]>"u"||r.state[s]==="auto")return"auto";if(r.propsSize&&r.propsSize[s]&&r.propsSize[s].toString().endsWith("%")){if(r.state[s].toString().endsWith("%"))return r.state[s].toString();var l=r.getParentSize(),u=Number(r.state[s].toString().replace("px","")),c=u/l[s]*100;return c+"%"}return DZ(r.state[s])},a=n&&typeof n.width<"u"&&!this.state.isResizing?DZ(n.width):i("width"),o=n&&typeof n.height<"u"&&!this.state.isResizing?DZ(n.height):i("height");return{width:a,height:o}},enumerable:!1,configurable:!0}),t.prototype.getParentSize=function(){if(!this.parentNode)return this.window?{width:this.window.innerWidth,height:this.window.innerHeight}:{width:0,height:0};var r=this.appendBase();if(!r)return{width:0,height:0};var n=!1,i=this.parentNode.style.flexWrap;i!=="wrap"&&(n=!0,this.parentNode.style.flexWrap="wrap"),r.style.position="relative",r.style.minWidth="100%",r.style.minHeight="100%";var a={width:r.offsetWidth,height:r.offsetHeight};return n&&(this.parentNode.style.flexWrap=i),this.removeBase(r),a},t.prototype.bindEvents=function(){this.window&&(this.window.addEventListener("mouseup",this.onMouseUp),this.window.addEventListener("mousemove",this.onMouseMove),this.window.addEventListener("mouseleave",this.onMouseUp),this.window.addEventListener("touchmove",this.onMouseMove,{capture:!0,passive:!1}),this.window.addEventListener("touchend",this.onMouseUp))},t.prototype.unbindEvents=function(){this.window&&(this.window.removeEventListener("mouseup",this.onMouseUp),this.window.removeEventListener("mousemove",this.onMouseMove),this.window.removeEventListener("mouseleave",this.onMouseUp),this.window.removeEventListener("touchmove",this.onMouseMove,!0),this.window.removeEventListener("touchend",this.onMouseUp))},t.prototype.componentDidMount=function(){if(!(!this.resizable||!this.window)){var r=this.window.getComputedStyle(this.resizable);this.setState({width:this.state.width||this.size.width,height:this.state.height||this.size.height,flexBasis:r.flexBasis!=="auto"?r.flexBasis:void 0})}},t.prototype.componentWillUnmount=function(){this.window&&this.unbindEvents()},t.prototype.createSizeForCssProperty=function(r,n){var i=this.propsSize&&this.propsSize[n];return this.state[n]==="auto"&&this.state.original[n]===r&&(typeof i>"u"||i==="auto")?"auto":r},t.prototype.calculateNewMaxFromBoundary=function(r,n){var i=this.props.boundsByDirection,a=this.state.direction,o=i&&K2("left",a),s=i&&K2("top",a),l,u;if(this.props.bounds==="parent"){var c=this.parentNode;c&&(l=o?this.resizableRight-this.parentLeft:c.offsetWidth+(this.parentLeft-this.resizableLeft),u=s?this.resizableBottom-this.parentTop:c.offsetHeight+(this.parentTop-this.resizableTop))}else this.props.bounds==="window"?this.window&&(l=o?this.resizableRight:this.window.innerWidth-this.resizableLeft,u=s?this.resizableBottom:this.window.innerHeight-this.resizableTop):this.props.bounds&&(l=o?this.resizableRight-this.targetLeft:this.props.bounds.offsetWidth+(this.targetLeft-this.resizableLeft),u=s?this.resizableBottom-this.targetTop:this.props.bounds.offsetHeight+(this.targetTop-this.resizableTop));return l&&Number.isFinite(l)&&(r=r&&r"u"?10:a.width,f=typeof i.width>"u"||i.width<0?r:i.width,d=typeof a.height>"u"?10:a.height,p=typeof i.height>"u"||i.height<0?n:i.height,h=l||0,m=u||0;if(s){var g=(d-h)*this.ratio+m,A=(p-h)*this.ratio+m,b=(c-m)/this.ratio+h,v=(f-m)/this.ratio+h,x=Math.max(c,g),w=Math.min(f,A),S=Math.max(d,b),k=Math.min(p,v);r=O8(r,x,w),n=O8(n,S,k)}else r=O8(r,c,f),n=O8(n,d,p);return{newWidth:r,newHeight:n}},t.prototype.setBoundingClientRect=function(){if(this.props.bounds==="parent"){var r=this.parentNode;if(r){var n=r.getBoundingClientRect();this.parentLeft=n.left,this.parentTop=n.top}}if(this.props.bounds&&typeof this.props.bounds!="string"){var i=this.props.bounds.getBoundingClientRect();this.targetLeft=i.left,this.targetTop=i.top}if(this.resizable){var a=this.resizable.getBoundingClientRect(),o=a.left,s=a.top,l=a.right,u=a.bottom;this.resizableLeft=o,this.resizableRight=l,this.resizableTop=s,this.resizableBottom=u}},t.prototype.onResizeStart=function(r,n){if(!(!this.resizable||!this.window)){var i=0,a=0;if(r.nativeEvent&&rtt(r.nativeEvent)?(i=r.nativeEvent.clientX,a=r.nativeEvent.clientY):r.nativeEvent&&M8(r.nativeEvent)&&(i=r.nativeEvent.touches[0].clientX,a=r.nativeEvent.touches[0].clientY),this.props.onResizeStart&&this.resizable){var o=this.props.onResizeStart(r,n,this.resizable);if(o===!1)return}this.props.size&&(typeof this.props.size.height<"u"&&this.props.size.height!==this.state.height&&this.setState({height:this.props.size.height}),typeof this.props.size.width<"u"&&this.props.size.width!==this.state.width&&this.setState({width:this.props.size.width})),this.ratio=typeof this.props.lockAspectRatio=="number"?this.props.lockAspectRatio:this.size.width/this.size.height;var s,l=this.window.getComputedStyle(this.resizable);if(l.flexBasis!=="auto"){var u=this.parentNode;if(u){var c=this.window.getComputedStyle(u).flexDirection;this.flexDir=c.startsWith("row")?"row":"column",s=l.flexBasis}}this.setBoundingClientRect(),this.bindEvents();var f={original:{x:i,y:a,width:this.size.width,height:this.size.height},isResizing:!0,backgroundStyle:Ih(Ih({},this.state.backgroundStyle),{cursor:this.window.getComputedStyle(r.target).cursor||"auto"}),direction:n,flexBasis:s};this.setState(f)}},t.prototype.onMouseMove=function(r){var n=this;if(!(!this.state.isResizing||!this.resizable||!this.window)){if(this.window.TouchEvent&&M8(r))try{r.preventDefault(),r.stopPropagation()}catch{}var i=this.props,a=i.maxWidth,o=i.maxHeight,s=i.minWidth,l=i.minHeight,u=M8(r)?r.touches[0].clientX:r.clientX,c=M8(r)?r.touches[0].clientY:r.clientY,f=this.state,d=f.direction,p=f.original,h=f.width,m=f.height,g=this.getParentSize(),A=ntt(g,this.window.innerWidth,this.window.innerHeight,a,o,s,l);a=A.maxWidth,o=A.maxHeight,s=A.minWidth,l=A.minHeight;var b=this.calculateNewSizeFromDirection(u,c),v=b.newHeight,x=b.newWidth,w=this.calculateNewMaxFromBoundary(a,o);this.props.snap&&this.props.snap.x&&(x=R6e(x,this.props.snap.x,this.props.snapGap)),this.props.snap&&this.props.snap.y&&(v=R6e(v,this.props.snap.y,this.props.snapGap));var S=this.calculateNewSizeFromAspectRatio(x,v,{width:w.maxWidth,height:w.maxHeight},{width:s,height:l});if(x=S.newWidth,v=S.newHeight,this.props.grid){var k=B6e(x,this.props.grid[0]),j=B6e(v,this.props.grid[1]),O=this.props.snapGap||0;x=O===0||Math.abs(k-x)<=O?k:x,v=O===0||Math.abs(j-v)<=O?j:v}var C={width:x-p.width,height:v-p.height};if(h&&typeof h=="string"){if(h.endsWith("%")){var N=x/g.width*100;x=N+"%"}else if(h.endsWith("vw")){var D=x/this.window.innerWidth*100;x=D+"vw"}else if(h.endsWith("vh")){var P=x/this.window.innerHeight*100;x=P+"vh"}}if(m&&typeof m=="string"){if(m.endsWith("%")){var N=v/g.height*100;v=N+"%"}else if(m.endsWith("vw")){var D=v/this.window.innerWidth*100;v=D+"vw"}else if(m.endsWith("vh")){var P=v/this.window.innerHeight*100;v=P+"vh"}}var q={width:this.createSizeForCssProperty(x,"width"),height:this.createSizeForCssProperty(v,"height")};this.flexDir==="row"?q.flexBasis=q.width:this.flexDir==="column"&&(q.flexBasis=q.height),(0,q6e.flushSync)(function(){n.setState(q)}),this.props.onResize&&this.props.onResize(r,d,this.resizable,C)}},t.prototype.onMouseUp=function(r){var n=this.state,i=n.isResizing,a=n.direction,o=n.original;if(!(!i||!this.resizable)){var s={width:this.size.width-o.width,height:this.size.height-o.height};this.props.onResizeStop&&this.props.onResizeStop(r,a,this.resizable,s),this.props.size&&this.setState(this.props.size),this.unbindEvents(),this.setState({isResizing:!1,backgroundStyle:Ih(Ih({},this.state.backgroundStyle),{cursor:"auto"})})}},t.prototype.updateSize=function(r){this.setState({width:r.width,height:r.height})},t.prototype.renderResizer=function(){var r=this,n=this.props,i=n.enable,a=n.handleStyles,o=n.handleClasses,s=n.handleWrapperStyle,l=n.handleWrapperClass,u=n.handleComponent;if(!i)return null;var c=Object.keys(i).map(function(f){return i[f]!==!1?Ab.createElement(I6e,{key:f,direction:f,onResizeStart:r.onResizeStart,replaceStyles:a&&a[f],className:o&&o[f]},u&&u[f]?u[f]:null):null});return Ab.createElement("div",{className:l,style:s},c)},t.prototype.render=function(){var r=this,n=Object.keys(this.props).reduce(function(o,s){return itt.indexOf(s)!==-1||(o[s]=r.props[s]),o},{}),i=Ih(Ih(Ih({position:"relative",userSelect:this.state.isResizing?"none":"auto"},this.props.style),this.sizeStyle),{maxWidth:this.props.maxWidth,maxHeight:this.props.maxHeight,minWidth:this.props.minWidth,minHeight:this.props.minHeight,boxSizing:"border-box",flexShrink:0});this.state.flexBasis&&(i.flexBasis=this.state.flexBasis);var a=this.props.as||"div";return Ab.createElement(a,Ih({ref:this.ref,style:i,className:this.props.className},n),this.state.isResizing&&Ab.createElement("div",{style:this.state.backgroundStyle}),this.props.children,this.renderResizer())},t.defaultProps={as:"div",onResizeStart:function(){},onResize:function(){},onResizeStop:function(){},enable:{top:!0,right:!0,bottom:!0,left:!0,topRight:!0,bottomRight:!0,bottomLeft:!0,topLeft:!0},style:{},grid:[1,1],lockAspectRatio:!1,lockAspectRatioExtraWidth:0,lockAspectRatioExtraHeight:0,scale:1,resizeRatio:1,snapGap:0},t}(Ab.PureComponent);var il=Ae(Te());var OZ=e=>{let t=o=>o?o=="auto"?"Fit":o=="100%"?"Fill":o:null,[r,n]=il.default.useState(null),[i,a]=il.default.useState({width:e.resizeMode!=2?e.size.width:e.size.minWidth,height:e.size.height});return il.default.useEffect(()=>{a({width:e.resizeMode!=2?e.size.width:e.size.minWidth,height:e.size.height})},[e.size,e.resizeMode]),(0,il.useEffect)(()=>{let o=s=>{n({shiftKey:s.shiftKey})};return e.superstate.ui.inputManager.on("keydown",o),e.superstate.ui.inputManager.on("keyup",o),()=>{e.superstate.ui.inputManager.off("keydown",o),e.superstate.ui.inputManager.off("keyup",o)}},[n]),il.default.createElement("div",{style:{position:"absolute",top:0,left:0,width:e.clientSize.width,height:e.clientSize.height}},il.default.createElement(L6e,{lockAspectRatio:r?.shiftKey,className:(0,z6e.default)(e.resizeMode==2?"mk-frame-column":"mk-frame-bounds"),enable:e.resizeMode==2?{right:!0}:{right:!0,bottom:!0,bottomRight:!0},onResize:(o,s,l,u)=>{a({width:l.clientWidth,height:l.clientHeight})},onResizeStop:(o,s,l,u)=>{let c=f=>{f.stopPropagation(),window.removeEventListener("click",c,!0)};window.addEventListener("click",c,!0),e.resizeMode==2?e.resize({minWidth:`'${l.clientWidth}px'`}):s=="bottom"?e.resize({height:`'${l.clientHeight}px'`}):s=="right"?e.resize({width:`'${l.clientWidth}px'`}):e.resize({width:`'${l.clientWidth}px'`,height:`'${l.clientHeight}px'`}),o.stopPropagation()},onResizeStart:o=>{o.stopPropagation()},handleClasses:e.resizeMode==2?{right:"mk-frame-column-resize-handle"}:e.resizeMode==1?{bottomRight:"mk-frame-resize-handle"}:{},handleWrapperStyle:{pointerEvents:"auto"},size:{width:i.width&&i.width!="auto"?i.width:"100%",height:i.height&&i.height!="auto"?i.height:"100%"},...e.listeners}),e.clientSize?.width>50&&e.resizeMode==1&&il.default.createElement("div",{className:"mk-frame-resize-label-width"},il.default.createElement("div",null,il.default.createElement("span",null,t(i.width)??H.editor.fit),i.width&&i.width!="auto"?il.default.createElement("div",{onClick:o=>{e.resize({width:jr("auto")}),o.stopPropagation()},"aria-label":H.editor.scaleToFit,style:{display:"flex"},dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//fold-horizontal")}}):il.default.createElement("div",{onClick:o=>{e.resize({width:jr("100%")}),o.stopPropagation()},"aria-label":H.editor.scaleToFill,style:{display:"flex"},dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//unfold-horizontal")}}))),e.clientSize?.height>50&&e.resizeMode==1&&il.default.createElement("div",{className:"mk-frame-resize-label-height"},il.default.createElement("div",null,il.default.createElement("span",null,t(i.height)??H.editor.fit),i.height&&i.height!="auto"?il.default.createElement("div",{onClick:o=>{e.resize({height:jr("auto")}),o.stopPropagation()},"aria-label":H.editor.scaleToFit,style:{display:"flex"},dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//fold-vertical")}}):il.default.createElement("div",{onClick:o=>{e.resize({height:jr("100%")}),o.stopPropagation()},"aria-label":H.editor.scaleToFill,style:{display:"flex"},dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//unfold-vertical")}}))))};var Jd=Ae(Te());var N8=e=>{let{selectionMode:t,selected:r,selection:n}=(0,Jd.useContext)(Hi),{updateNode:i,nodes:a}=(0,Jd.useContext)(Wi),o=d=>{if(d!=e.state.props?.value)if(e.treeNode.editorProps?.linkedNode){let p=a.find(h=>h.id==e.treeNode.editorProps.linkedNode.node);i(p,{props:{...p.props,[e.treeNode.editorProps.linkedNode.prop]:jr(d)}})}else i(e.treeNode.node,{props:{...e.treeNode.node.props,value:jr(d)}})},s=n?.includes(e.treeNode.node.id),l=(0,Jd.useMemo)(()=>t==0?!1:t==1||t==3&&s?!0:e.treeNode.isRef?!!(e.treeNode.editorProps.linkedNode&&r):!0,[e.treeNode,t,r,s]),u=d=>{e.superstate.ui.openPalette(Jd.default.createElement(Ta,{ui:e.superstate.ui,selectedSticker:p=>o(p)}),Ne(d.view.document))},[c,f]=e.state.props?.value?rg(e.state.props?.value):[null,null];return e.state&&(e.state.props?.value?.length>0?c=="image"?Jd.default.createElement("img",{className:"mk-frame-icon",src:e.superstate.ui.getUIPath(e.superstate.imagesCache.get(f))}):Jd.default.createElement("div",{className:"mk-frame-icon",style:{},dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker(e.state.props?.value)}}):l?Jd.default.createElement("div",{onClick:d=>u(d),"aria-label":"Select Sticker",className:"mk-node-icon-placeholder",dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//smile")}}):Jd.default.createElement(Jd.default.Fragment,null))};var Bf=Ae(Te());var T8=e=>{let t=e.state.props.value,r=(0,Bf.useMemo)(()=>e.superstate.ui.getUIPath(t,!0),[t]),{nodes:n,updateNode:i}=(0,Bf.useContext)(Wi),{linkedProps:a}=(0,Bf.useContext)(_i),{selectionMode:o,selected:s,selection:l}=(0,Bf.useContext)(Hi),u=l?.includes(e.treeNode.node.id),c=p=>{!Pu(e.treeNode.node.props.value)&&!a.some(h=>e.treeNode.editorProps.linkedNode?.node==e.treeNode.node.schemaId&&e.treeNode.editorProps.linkedNode?.prop==h)||e.superstate.ui.openPalette(Bf.default.createElement(_f,{superstate:e.superstate,selectedPath:h=>f(h)}),Ne(p.view.document))},f=p=>{if(p!=e.state.props?.value)if(e.treeNode.editorProps?.linkedNode){let h=n.find(m=>m.id==e.treeNode.editorProps.linkedNode.node);i(h,{props:{...h.props,[e.treeNode.editorProps.linkedNode.prop]:jr(p)}})}else i(e.treeNode.node,{props:{...e.treeNode.node.props,value:jr(p)}})},d=(0,Bf.useMemo)(()=>o==0?!1:o==1||o==3&&u?!0:e.treeNode.isRef?!!(e.treeNode.editorProps.linkedNode&&s):!0,[e.treeNode,o,s,u]);return e.state?.props.value?.length>0?Bf.default.createElement("img",{className:"mk-node-image",width:e.state?.styles.width,height:e.state?.styles.height,style:{borderRadius:e.state?.styles.borderRadius,maxHeight:e.state?.styles.maxHeight},src:r}):d?Bf.default.createElement("div",{className:"mk-node-image-placeholder",dangerouslySetInnerHTML:{__html:e.superstate.ui.getPlaceholderImage("image-select")},style:{borderRadius:e.state?.styles.borderRadius,maxHeight:e.state?.styles.maxHeight},onClick:p=>c(p)}):Bf.default.createElement(Bf.default.Fragment,null)};var bg=Ae(Te()),F8=e=>{let{selectionMode:t}=(0,bg.useContext)(Hi),{saveState:r,instance:n}=(0,bg.useContext)(_i),[i,a]=(0,bg.useState)(""),o=e.state,s=e.state.styles?.as;return(0,bg.useEffect)(()=>{let l=Pm(e.state?.props?.value);if(l){let u=l.node=="$root"?n.exec.id:l.node;a(n.state?.[u]?.props?.[l.prop])}},[e.state.props]),bg.default.createElement("input",{className:"mk-node-input",type:s,value:s=="checkbox"?null:i,checked:i=="true",onKeyDown:l=>{if(l.stopPropagation(),l.key=="Enter"){let u=s=="text"?l.currentTarget.value:s=="checkbox"?(!l.currentTarget.checked).toString():l.currentTarget.value;a(""),typeof o.actions?.onEnter=="function"&&o.actions?.onEnter(l,u,n.state,c=>r(c,n),e.superstate.api)}},onChange:l=>{let u=s=="text"?l.target.value:s=="checkbox"?(!l.target.checked).toString():l.target.value;a(u),typeof o.actions?.onChange=="function"&&o.actions?.onChange(l,u,n.state,c=>r(c,n),e.superstate.api)},placeholder:o.styles.placeholder,style:{...o?.styles}})};var U6e=Ae(Te()),W6e=e=>U6e.default.createElement("div",{className:"mk-node-new"});var Rh=Ae(Te());var H6e=Ae(Te());function MZ(e){(0,H6e.useEffect)(e,[])}var BD=Ae(Te());function gb(e,t,r=window){let n=(0,BD.useRef)(t);(0,BD.useEffect)(()=>{n.current=t},[t]),(0,BD.useEffect)(()=>{if(r==null)return;let i=a=>n.current(a);return r.addEventListener(e,i),()=>r.removeEventListener(e,i)},[e,r])}var Bh=Ae(Te());function jZ(e,t){let r=(0,Bh.useRef)(e),n=(0,Bh.useRef)(null);(0,Bh.useEffect)(()=>{r.current=e},[e]);let i=(0,Bh.useCallback)(()=>{n.current=setTimeout(()=>r.current(),t)},[t]),a=(0,Bh.useCallback)(()=>{n.current&&clearTimeout(n.current)},[]);return(0,Bh.useEffect)(()=>(i(),a),[t,i,a]),{reset:(0,Bh.useCallback)(()=>{a(),i()},[a,i]),clear:a}}function RD(e,t,{delay:r=400}={}){let{reset:n,clear:i}=jZ(t,r);MZ(i),gb("mousedown",n,e.current),gb("touchstart",n,e.current),gb("mouseup",i,e.current),gb("mouseleave",i,e.current),gb("touchend",i,e.current)}var _8=e=>{let{selectionMode:t,selection:r,selectable:n,selected:i,select:a}=(0,Rh.useContext)(Hi),o=(0,Rh.useRef)(null),{updateNode:s,nodes:l,deleteNode:u}=(0,Rh.useContext)(Wi),c=w=>{if(w!=e.state.props?.value)if(e.treeNode.editorProps?.linkedNode){let S=l.find(k=>k.id==e.treeNode.editorProps.linkedNode.node);s(S,{props:{...S.props,[e.treeNode.editorProps.linkedNode.prop]:jr(w)}})}else s(e.treeNode.node,{props:{...e.treeNode.node.props,value:jr(w)}})},f=w=>{let S=w.target.innerHTML;c(S)},d=w=>{w.stopPropagation()},p=w=>{w.stopPropagation()},h=w=>{if(w.stopPropagation(),(w.key=="Delete"||w.key=="Backspace")&&w.target.innerHTML==""&&u(e.treeNode.node),w.key=="a"&&w.metaKey){w.preventDefault();let S=window.getSelection(),k=document.createRange();k.selectNodeContents(w.target),S.removeAllRanges(),S.addRange(k)}w.key=="Enter"&&(w.target.blur(),w.preventDefault()),w.key=="Escape"&&(w.target.blur(),w.preventDefault())},m=w=>{x&&w.stopPropagation()},g=w=>{x&&w.stopPropagation(),t==3&&!e.treeNode.isRef&&a(e.treeNode.id)};RD(o,()=>{if(x){a(e.treeNode.node.id,!1);return}});let b=r.includes(e.treeNode.id),{linkedProps:v}=(0,Rh.useContext)(_i),x=(0,Rh.useMemo)(()=>t==0?!1:e.treeNode.isRef?!!(e.treeNode.editorProps.linkedNode&&i):v.some(w=>e.treeNode.editorProps.linkedNode?.node==e.treeNode.node.schemaId&&e.treeNode.editorProps.linkedNode?.prop==w)?!0:Pu(e.treeNode.node.props.value)?!!(t==1||t==3&&b):!1,[e.treeNode,t,i,b,v]);return e.state&&Rh.default.createElement("div",{className:"mk-frame-text","data-placeholder":x||n?H.labels.textPlaceholder:"",dangerouslySetInnerHTML:{__html:e.state.props?.value},onClick:m,onMouseDown:g,onBlur:f,onDrop:w=>w.preventDefault(),onKeyDown:h,onKeyPress:d,onKeyUp:p,ref:o,contentEditable:x})};var TZ={position:"relative"},att=(0,zt.memo)(function(t){let r={superstate:t.superstate,treeNode:t.treeNode,state:t.state},{treeNode:n}=t,{pathState:i}=(0,zt.useContext)($r),{instance:a}=(0,zt.useContext)(_i);return zt.default.createElement(zt.default.Fragment,null,n.node.type=="new"?zt.default.createElement(W6e,{...r}):n.node.type=="input"?zt.default.createElement(F8,{...r}):n.node.type=="text"?zt.default.createElement(_8,{...r}):n.node.type=="icon"?zt.default.createElement(N8,{...r}):n.node.type=="audio"?zt.default.createElement(v8,{...r}):n.node.type=="image"?zt.default.createElement(T8,{...r}):n.node.type=="space"?zt.default.createElement(b8,{...r,containerRef:t.containerRef,source:i.path}):n.node.type=="flow"?zt.default.createElement(x8,{...r,source:i.path,containerRef:t.containerRef}):n.node.type=="content"?zt.default.createElement(y8,{editable:!t.treeNode.isRef},t.treeNode.children.map((o,s)=>o.node.type=="slides"?null:zt.default.createElement($D,{superstate:t.superstate,key:o.id,treeNode:o,instance:t.instance,containerRef:t.containerRef},t.children)),t.children):(n.node.type=="column"||n.node.type=="container")&&n.children.length==0?null:t.treeNode.id==t.instance.exec.id||n.node.type=="column"||n.node.type=="container"?t.treeNode.children.map((o,s)=>o.node.type=="slides"?null:zt.default.createElement($D,{superstate:t.superstate,key:o.id,treeNode:o,instance:t.instance,containerRef:t.containerRef},t.children)):zt.default.createElement(zt.default.Fragment,null,zt.default.createElement(Tv,{superstate:t.superstate,id:n.id,editMode:t.editMode},n.children.map((o,s)=>o.node.type=="slides"?null:zt.default.createElement($D,{superstate:t.superstate,key:o.id,treeNode:o,instance:t.instance,containerRef:t.containerRef},t.children)))))}),$D=e=>{let{selectionMode:t,selectable:r,selected:n,isParentToSelection:i,select:a,selection:o}=(0,zt.useContext)(Hi),{updateNode:s,addNode:l,deleteNode:u,nodes:c,selectedSlide:f}=(0,zt.useContext)(Wi),{setDragNode:d}=(0,zt.useContext)(vh),{saveState:p,selectableNodeBounds:h,id:m}=(0,zt.useContext)(_i),{dragActive:g}=(0,zt.useContext)(vh),A=e.treeNode.isRef?0:e.treeNode.id==e.instance.exec.id?t:3,b=o.some(ee=>ee==e.treeNode.id),v=r&&!e.treeNode.isRef&&!b,x=e.instance.state[e.treeNode.id],w=(0,zt.useMemo)(()=>f?c.find(ee=>ee.ref==e.treeNode.id&&f==ee.parentId)??null:null,[c,e.treeNode,f]),S=(0,zt.useMemo)(()=>w?{...e.treeNode,node:{...e.treeNode.node,styles:{...e.treeNode.node.styles,...w.styles},props:{...e.treeNode.node.props,...w.props},actions:{...e.treeNode.node.actions,...w.actions}}}:e.treeNode,[w,e.treeNode]),{frameSchema:k}=(0,zt.useContext)(ma),j=m+k.id+e.treeNode.id,[O,C]=(0,zt.useState)(!1),[N,D]=zt.default.useState(!1),[P,q]=zt.default.useState(!1),z=e.treeNode.editorProps.dragMode==1||(v&&!i||b)&&e.treeNode.editorProps.dragMode!=0,{attributes:I,listeners:T,setNodeRef:L,transform:_}=Us({id:j,data:{id:j,root:m,type:"node",parent:e.treeNode.node.parentId,frame:k.id,node:e.treeNode.id},disabled:!z}),Y=(0,zt.useRef)(null),oe=()=>{if(v&&e.treeNode.id!=e.instance.exec.id){a(S.node.id);return}},te=e.instance.state[e.treeNode.id]?.styles?!!e.instance.state[e.treeNode.id]?.styles?.hidden:!1,Q={superstate:e.superstate,treeNode:S,state:x},fe=ee=>{s(S.node,{styles:{...ee}})},Ie=ee=>{if(v&&(t!=1||i&&e.treeNode.id!=e.instance.exec.id)){ee.shiftKey?a(S.node.id,!0):a(S.node.id),ee.stopPropagation();return}else e.treeNode.id==e.instance.exec.id&&a(null);if(b)ee.stopPropagation();else{if((ee.detail===2||Gr(e.superstate.ui))&&typeof x.actions?.onDoubleClick=="function"){x.actions?.onDoubleClick(ee,null,e.instance.state,ie=>p(ie,e.instance),e.superstate.api),ee.stopPropagation();return}ee.detail===1&&typeof x.actions?.onClick=="function"&&(x.actions?.onClick(ee,null,e.instance.state,ie=>p(ie,e.instance),e.superstate.api),ee.stopPropagation())}};(0,zt.useEffect)(()=>{o.some(ee=>ee!=e.treeNode.id)&&C(!1)},[o,e.treeNode]);let[Se,Oe]=(0,zt.useState)(!1);(0,zt.useEffect)(()=>{b&&Gr(e.superstate.ui)&&(e.treeNode.node.type=="group"||e.treeNode.node.type=="image"||t>=3)?Oe(!0):b&&Se||Oe(!1)},[e.treeNode,t,b]);let ve=e.treeNode.editorProps.dropMode,ye=Y.current&&getComputedStyle(Y.current),me=Y.current&&Y.current.clientWidth,ke=Y.current&&Y.current.clientHeight,[$,ae]=(0,zt.useState)([]),ce=(ee,ie)=>({left:ee.x-ie.x,top:ee.y-ie.y,width:ee.width,height:ee.height});(0,zt.useEffect)(()=>{if(!Y.current||!e.containerRef?.current)return()=>null;e.treeNode.node.parentId==e.instance.exec.id&&(h.current[e.treeNode.id]=ce(Y.current.getBoundingClientRect(),e.containerRef.current.getBoundingClientRect())),ae(()=>Array.from(Y.current?.children??[]).map(re=>({x:re.offsetLeft,y:re.offsetTop,width:re.clientWidth,height:re.clientHeight})));let ee=new ResizeObserver(()=>{e.treeNode.node.parentId==e.instance.exec.id&&Y.current&&(h.current[e.treeNode.id]=ce(Y.current.getBoundingClientRect(),e.containerRef.current.getBoundingClientRect())),ae(()=>Array.from(Y.current?.children??[]).map(re=>({x:re.offsetLeft,y:re.offsetTop,width:re.clientWidth,height:re.clientHeight})))});return ee.observe(Y.current),()=>ee.disconnect()},[x]);let U=Y.current?.getBoundingClientRect(),R=e.containerRef?.current?.getBoundingClientRect(),J={...TZ,...e.treeNode.node.type!="flow"?x?.styles:{width:x?.styles?.width,height:x?.styles?.height,"--max-width":x?.styles?.["--max-width"]},"--translate-x":`${_?.x??0}px`,"--translate-y":`${_?.y??0}px`};return Ca({onDragStart:ee=>{ee.active?.id==j&&d(zt.default.createElement("div",{style:{width:Y.current.clientWidth}},zt.default.createElement(J2,{superstate:e.superstate,treeNode:e.treeNode,instance:e.instance,saveState:null})))}}),zt.default.createElement(zt.default.Fragment,null,(!te||!e.treeNode.isRef)&&zt.default.createElement("div",{ref:ee=>{Y.current=ee,t>1&&z&&L(ee)},onContextMenu:()=>Gr(e.superstate.ui)&&oe(),className:(0,NZ.default)(`mk-frame-edit ${G2(x?.styles)}`,v&&t!=1&&"mk-f-editable",b&&t==1&&"mk-selected"),"data-path":S.id,"data-type":S.node.type,onMouseEnter:()=>{C(!0),D(!0)},onMouseLeave:()=>{P||C(!1),D(!1)},...{onClick:Ie},...t>1?{...T,...I}:{},style:J},zt.default.createElement(att,{...Q,containerRef:e.containerRef,editMode:A,instance:e.instance},e.children)),x&&e.treeNode.node.type!="new"&&e.containerRef?.current&&t>0&&Y.current&&(0,V6e.createPortal)(zt.default.createElement(zt.default.Fragment,null,zt.default.createElement("div",{style:{position:"absolute",top:U.top-R.top,left:U.left-R.left,width:me,height:ke,pointerEvents:"none"},className:(0,NZ.default)(!g&&v&&t!=1&&"mk-f-editable",!g&&b&&(t!=1||e.treeNode.node.type=="group")&&"mk-f-edit",!g&&O&&t!=1&&"mk-f-edit-hover"),onClick:ee=>{if(v&&t!=1){ee.shiftKey?a(S.node.id,!0):a(S.node.id),ee.stopPropagation();return}}},e.treeNode.editorProps.resizeMode==2&&zt.default.createElement(OZ,{size:x?.styles,superstate:e.superstate,resizeMode:e.treeNode.editorProps.resizeMode,resize:fe,clientSize:{width:me,height:ke}}),g&&(t==1||t==3)&&ve>0&&zt.default.createElement(j6e,{parentId:S.node.parentId,superstate:e.superstate,height:ke,width:me,node:S.node.id,id:j,mode:ve,insertMode:S.node.type=="group"?1:S.node.type=="space"?-1:0}),Se&&zt.default.createElement(zt.default.Fragment,null,zt.default.createElement(OZ,{superstate:e.superstate,resizeMode:1,size:x?.styles,resize:fe,clientSize:{width:me,height:ke}}),zt.default.createElement(O6e,{styles:x?.styles,saveStyles:fe,clientSize:{width:me,height:ke}}),(S.node.type=="group"||S.node.type=="content")&&(x.styles?.layout=="row"||x.styles?.layout=="column")&&zt.default.createElement(zt.default.Fragment,null,zt.default.createElement(N6e,{childSizes:$,clientSize:{width:me,height:ke,paddingBottom:parseInt(ye?.paddingBottom??"0"),paddingLeft:parseInt(ye?.paddingLeft??"0"),paddingRight:parseInt(ye?.paddingRight??"0"),paddingTop:parseInt(ye?.paddingTop??"0")},styles:x?.styles,saveStyles:fe,direction:x?.styles.layout=="column"?"column":"row"}),zt.default.createElement(F6e,{clientSize:{width:me,height:ke},styles:x?.styles,saveStyles:fe}))),S.editorProps.dragMode==1&&(!Gr(e.superstate.ui)||b)?zt.default.createElement("div",{onMouseEnter:()=>{q(!0),C(!0)},onMouseLeave:()=>{N||C(!1),q(!1)},className:"mk-editor-frame-hover-menu-container",style:{zIndex:O?"calc(var(--layer-popover) + 1)":"var(--layer-popover)"}},zt.default.createElement(C6e,{superstate:e.superstate,node:S.node,mode:t==1?0:1,selected:b,visible:Gr(e.superstate.ui)||O,dragRef:L,attributes:I,listeners:T})):zt.default.createElement(zt.default.Fragment,null)),o&&!g&&b&&o.length==1?zt.default.createElement(CZ,{nodeRect:U,containerRect:R},zt.default.createElement(k6e,{editLayout:ee=>Oe(ee),superstate:e.superstate,node:S.node,duplicateFrame:()=>{l(S.node,S.node)},state:x,deleteFrame:()=>u(S.node),fields:Jte(S.node)})):o.length>1&&o[0]==S.id?zt.default.createElement(CZ,{nodeRect:U,containerRect:R},zt.default.createElement(s6e,{superstate:e.superstate})):null),e.containerRef.current))};var J2=e=>{let t={superstate:e.superstate,treeNode:e.treeNode,state:e.instance.state[e.treeNode.id]},r=e.treeNode.node.type=="input"?ep.default.createElement(F8,{...t}):e.treeNode.node.type=="text"?ep.default.createElement(_8,{...t}):e.treeNode.node.type=="icon"?ep.default.createElement(N8,{...t}):e.treeNode.node.type=="audio"?ep.default.createElement(v8,{...t}):e.treeNode.node.type=="image"?ep.default.createElement(T8,{...t}):e.treeNode.node.type=="space"?ep.default.createElement(b8,{...t,source:e.source}):e.treeNode.node.type=="content"?ep.default.createElement(y8,null,e.treeNode.children.filter(i=>i.node.type!="slides").map((i,a)=>ep.default.createElement(J2,{superstate:e.superstate,key:a,treeNode:i,instance:e.instance,saveState:e.saveState,source:e.source},e.children)),e.children):e.treeNode.node.type=="flow"?ep.default.createElement(x8,{...t,source:e.source}):e.treeNode.children.filter(i=>i.node.type!="slides").map((i,a)=>ep.default.createElement(J2,{superstate:e.superstate,key:a,treeNode:i,instance:e.instance,saveState:e.saveState,source:e.source},e.children)),n=e.instance.state[e.treeNode.id]?.styles?!!e.instance.state[e.treeNode.id]?.styles?.hidden:!1;return e.instance.state[e.treeNode.id]&&!n&&ep.default.createElement("div",{className:`mk-frame ${G2(e.instance.state[e.treeNode.id]?.styles)}`,"data-path":e.treeNode.id,"data-type":e.treeNode.node.type,onContextMenu:i=>{typeof e.instance.state[e.treeNode.id].actions?.onContextMenu=="function"&&(e.instance.state[e.treeNode.id].actions?.onContextMenu(i,null,e.instance.state,a=>e.saveState(a,e.instance),e.superstate.api),i.stopPropagation())},onClick:i=>{if((i.detail===2||Gr(e.superstate.ui))&&typeof e.instance.state[e.treeNode.id].actions?.onDoubleClick=="function"){e.instance.state[e.treeNode.id].actions?.onDoubleClick(i,null,e.instance.state,a=>e.saveState(a,e.instance),e.superstate.api),i.stopPropagation();return}i.detail===1&&typeof e.instance.state[e.treeNode.id].actions?.onClick=="function"&&(e.instance.state[e.treeNode.id].actions?.onClick(i,null,e.instance.state,a=>e.saveState(a,e.instance),e.superstate.api),i.stopPropagation())},style:{...TZ,...e.instance.state[e.treeNode.id]?.styles}},r)};var vb=e=>{let{saveState:t,instance:r}=(0,P8.useContext)(_i);return r.exec&&P8.default.createElement(J2,{superstate:e.superstate,treeNode:r.exec,instance:r,saveState:t,source:e.source},e.children)};var Wv=e=>{let t=(0,es.useMemo)(()=>e.superstate.spaceManager.uriByString(e.path,e.source),[e.path,e.source]),[r,n]=(0,es.useState)(null);return(0,es.useEffect)(()=>{t.refType=="context"?n({type:"context",path:t.basePath,contextSchema:t.ref,frameSchema:t.query?.frameSchema}):t.refType=="frame"?e.superstate.spaceManager.readFrame(t.basePath,t.ref).then(i=>{let a=i?.schema;!a&&t.ref==bp.id&&(a=bp,n({type:"context",path:t.basePath,frameSchema:a.id})),a?.type=="view"?n({type:"context",path:t.basePath,frameSchema:t.ref}):n({type:"frame",path:t.basePath,frameSchema:t.ref})}):t.refType=="action"?n({type:"action",path:t.basePath,actionSchema:t.ref}):n({type:"context",path:t.basePath,frameSchema:r0})},[t]),es.default.createElement(es.default.Fragment,null,r?.path&&(r?.type=="context"?es.default.createElement(Qs,{superstate:e.superstate,path:r.path,readMode:!1},es.default.createElement(lh,{superstate:e.superstate},es.default.createElement(pv,{superstate:e.superstate,contextSchema:r.contextSchema,schema:r.frameSchema},es.default.createElement(h2,{superstate:e.superstate},es.default.createElement(eE,{showTitle:e.showTitle,superstate:e.superstate,minMode:e.minMode,containerRef:e.containerRef,setView:e.setFrameSchema}))))):r?.type=="frame"?es.default.createElement(F9,{superstate:e.superstate,path:t,cols:[]},es.default.createElement(ug,{id:e.id,superstate:e.superstate,props:{},editable:!1},es.default.createElement(vb,{superstate:e.superstate,source:e.source}))):r?.type=="action"?es.default.createElement(o6e,{superstate:e.superstate,action:e.path}):es.default.createElement(es.default.Fragment,null)))};var w8=e=>{let[t,r]=(0,Lc.useState)(e.superstate.pathsIndex.get(e.path)),n=(0,Lc.useRef)(null);return(0,Lc.useEffect)(()=>{let i=e.superstate.spaceManager.uriByString(e.path),a=e.superstate.pathsIndex.get(e.path);if(!a&&(i?.scheme=="https"||i?.scheme=="http")){r({path:e.path,label:{sticker:i.scheme,name:i.path,color:""},hidden:!1,readOnly:!0,subtype:"md",type:"remote"});return}r(a)},[e.path]),Lc.default.createElement("div",{className:"mk-path-view",style:{...e.styles??{}}},t?.type=="remote"?t.subtype=="note"?Lc.default.createElement(dv,{superstate:e.superstate,path:e.path,load:!0,classname:"mk-flow-node"}):Lc.default.createElement("iframe",{src:e.path}):t?.type=="space"?Lc.default.createElement(Wv,{id:e.id,showTitle:!0,containerRef:n,superstate:e.superstate,path:e.path}):e.superstate.ui.availableViews().some(i=>i==e.path?.split(".").pop())?Lc.default.createElement(dv,{superstate:e.superstate,path:e.path,load:!0,classname:"mk-flow-node"}):Lc.default.createElement(Lc.default.Fragment,null))};var Y6e=e=>{let[t,r]=(0,br.useState)(null),[n,i]=(0,br.useState)(!1),[a,o]=(0,br.useState)(!1),[s,l]=(0,br.useState)(""),[u,c]=(0,br.useState)(0),f=N=>{l(N)},[d,p]=(0,br.useState)([]),h=(0,br.useMemo)(()=>s.length>0?[{type:"any",trueFalse:!0,filters:[{type:"file",fType:"text",field:"name",fn:"include",value:s}]},...d]:d,[s,d]),m=N=>({type:"path",value:N.path,cache:N,sticker:N.label.sticker,description:N.label.preview,label:N.name}),g=e.parentSpace?[{type:"section",label:"Items"},...[...e.superstate.spacesMap.getInverse(e.parentSpace)].map(N=>e.superstate.pathsIndex.get(N)).filter(N=>N&&!N.hidden).map(N=>m(N))]:[],A=[{type:"section",label:"Recent"},...e.superstate.ui.navigationHistory().map(N=>e.superstate.pathsIndex.get(N)).filter(N=>N&&!N.hidden).map(N=>m(N))],[b,v]=(0,br.useState)(e.parentSpace?g:A);(0,br.useEffect)(()=>{let N=(D,P)=>{if(D.length==0&&s.length==0){v(e.parentSpace?g:A);return}if(d.length==0){if(!e.superstate.settings.searchWorker){let q=LEe({query:s,pathsIndex:e.superstate.pathsIndex,count:10});v([{type:"section",label:"Results"},...q.map(z=>m(z)),{type:"section",label:"Create New"},{type:"new-note",sticker:"ui//edit",value:s,label:"New Note"},{type:"new-space",sticker:"ui//folder-plus",value:s,label:"New Space"}]);return}e.superstate.search(D,s).then(q=>v([{type:"section",label:"Results"},...q.map(z=>m(z)),{type:"section",label:"Create New"},{type:"new-note",sticker:"ui//edit",value:s,label:"New Note"},{type:"new-space",sticker:"ui//folder-plus",value:s,label:"New Space"}]));return}if(!e.superstate.settings.searchWorker){let q=zEe({queries:P,count:10,pathsIndex:e.superstate.pathsIndex});v([{type:"section",label:"Results"},...q.map(z=>m(z)),{type:"new-note",sticker:"ui//plus",value:s,label:"New Note"},{type:"new-space",sticker:"ui//plus",value:s,label:"New Space"}]);return}e.superstate.search(D,null,P).then(q=>v(q.map(z=>m(z))))};(0,G6e.debounce)(()=>N(s,h),300)()},[s,h]),(0,br.useEffect)(()=>{if(!b[u]||b[u].type!="path")return;let N=b[u]?.cache?.path;!N||N==t||r(b[u]?.cache?.path)},[u,b]);let x=(N,D)=>{if(!!N&&N.type!="section"){if(N.type=="new-note"){if(e.parentSpace){let P=e.superstate.spacesIndex.get(e.parentSpace);if(P){za(e.superstate,P,"md",s,!!e.onSelect).then(q=>{e.mode==2&&e.onSelect(q),e.hide()});return}}YS(e.superstate,e.superstate.pathsIndex.get(e.superstate.ui.activePath)).then(P=>za(e.superstate,P,"md",s).then(q=>{e.mode==2&&e.onSelect(q),e.hide()}));return}if(N.type=="new-space"){let P=e.superstate.pathsIndex.get(e.parentSpace)??e.superstate.pathsIndex.get("/"),q=s.replace(/\//g,""),z=P?.subtype=="folder"?P.path:P.parent?P.parent:"/",I=!z||z=="/"?q:z+"/"+q;if(q.length==0){e.superstate.ui.notify(H.notice.newSpaceName);return}if(e.superstate.spacesIndex.has(I)){e.superstate.ui.notify(H.notice.duplicateSpaceName);return}kf(e.superstate,I,{}).then(T=>{e.mode==2&&e.onSelect(T.path),e.hide()});return}if(N.cache){if(e.mode==2){e.onSelect(N.cache?.path),e.hide();return}if(!n||D){e.superstate.ui.openPath(N.cache?.path),e.hide();return}}c(b.findIndex(P=>P.cache?.path==N.cache?.path))}},w=[],S=N=>{if(N.key=="Tab"&&w&&(N.preventDefault(),N.stopPropagation()),N.key=="ArrowUp"){let P=u<=0?b.length-1:u-1;if(b.length==0)return;!b[P]||b[P].type=="section"?c(P<0?b.length-1:P-1):c(P),N.preventDefault()}if(N.key=="ArrowDown"){let D=b.length-1,P=u>=D?0:u+1;!b[P]||b[P].type=="section"?c(P>=D?0:P+1):c(P),c(P),N.preventDefault()}N.key=="Enter"&&(x(b[u],!0),N.preventDefault())},k=br.default.useRef(null);(0,br.useEffect)(()=>{k.current?.focus()},[k.current]);let j=_9(e.superstate),O=[];Object.keys(j).forEach(N=>{j[N].properties.forEach(D=>{O.push({...D})})});let C=Object.keys(j).map(N=>({name:j[N].name,value:N}));return br.default.createElement(br.default.Fragment,null,br.default.createElement("div",{className:"mk-blink-input-container"},br.default.createElement("div",{className:"mk-icon-small",dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//search")}}),br.default.createElement("div",{"data-placeholder":H.labels.blinkPlaceholder,onInput:N=>f(N.currentTarget.innerText),onKeyDown:N=>S(N),ref:k,contentEditable:!0,className:"mk-blink-input"}),e.mode==1&&br.default.createElement(br.default.Fragment,null,br.default.createElement("button",{onClick:()=>i(N=>!N),className:"mk-toolbar-button",dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//blink")}}),br.default.createElement("button",{className:"mk-toolbar-button",dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//filter")},onClick:()=>o(!a)}))),a&&br.default.createElement("div",{className:"mk-blink-filters"},br.default.createElement("div",{className:"mk-icon-xsmall",dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//filter")}}),br.default.createElement(E2,{superstate:e.superstate,filters:d,setFilters:p,fields:O,sections:C})),br.default.createElement("div",{className:"mk-blink-suggester",style:{}},br.default.createElement("div",{className:"mk-blink-suggestions"},b.map((N,D)=>br.default.createElement("div",{key:D,className:(0,Q6e.default)(N.type=="section"?"mk-blink-section":"mk-blink-suggestion",u==D&&"mk-active"),onClick:P=>x(N)},N.type=="section"?br.default.createElement("div",{className:"mk-blink-suggestion-title"},N.label):br.default.createElement(br.default.Fragment,null,br.default.createElement("div",{className:"mk-blink-suggestion-icon",dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker(N.sticker)}}),br.default.createElement("div",{className:"mk-blink-suggestion-text"},br.default.createElement("div",{className:"mk-blink-suggestion-title"},N.label),br.default.createElement("div",{className:"mk-blink-suggestion-description"},N.value),N.description&&br.default.createElement("div",{className:"mk-blink-suggestion-preview"},N.description)))))),e.mode==1&&n&&br.default.createElement(ott,{superstate:e.superstate,path:t})))},ott=e=>{let t=br.default.useRef(null),[r,n]=(0,br.useState)(!1);return br.default.createElement("div",{className:"mk-blink-preview",ref:t},br.default.createElement("div",{className:"mk-blink-preview-title"},br.default.createElement(oo,{superstate:e.superstate,path:e.path}),br.default.createElement("span",null),br.default.createElement("button",{className:r?"is-active mk-icon-small":"mk-icon-small",dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//list")},onClick:()=>n(!r)})),br.default.createElement(w8,{id:"blink",superstate:e.superstate,path:e.path,containerRef:t,styles:{},readOnly:!0}),r&&br.default.createElement("div",{className:"mk-blink-properties"},br.default.createElement("div",{className:"mk-blink-properties-header"},"Properties"),br.default.createElement(Qs,{path:e.path,superstate:e.superstate,readMode:!1})))};var X6e=(e,t,r,n,i)=>{e.ui.openPalette(Z6e.default.createElement(Y6e,{superstate:e,mode:t,onSelect:n,parentSpace:i}),r,"mk-blink-modal")};var Bl=Ae(Te());var Gv=Ae(Te()),tE=e=>{let t=_r(e.superstate,e.date,e.mode=="day"?"MMMM d":"MMMM");return Gv.default.createElement("div",{className:"mk-calendar-header"},Gv.default.createElement("div",{className:"mk-calendar-header-title"},Gv.default.createElement("span",null,t),_r(e.superstate,e.date,"yyyy")),Gv.default.createElement("span",null),Gv.default.createElement("button",{dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//chevron-left")},onClick:()=>{if(e.mode=="day"){e.setDate(new Date(e.date.setDate(e.date.getDate()-1)));return}else if(e.mode=="week"){e.setDate(new Date(e.date.setDate(e.date.getDate()-7)));return}e.setDate(new Date(e.date.setMonth(e.date.getMonth()-1)))}}),Gv.default.createElement("button",{onClick:()=>{e.setDate(new Date)}},"Today"),Gv.default.createElement("button",{onClick:()=>{if(e.mode=="day"){e.setDate(new Date(e.date.setDate(e.date.getDate()+1)));return}if(e.mode=="week"){e.setDate(new Date(e.date.setDate(e.date.getDate()+7)));return}e.setDate(new Date(e.date.setMonth(e.date.getMonth()+1)))},dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//chevron-right")}}))};var FZ=Ae(Te());var I8=e=>{let{attributes:t,listeners:r,setNodeRef:n,transform:i}=Us({id:"event-"+e.index,data:{type:"event",index:e.index}});return FZ.default.createElement("div",{className:"mk-week-event",ref:n,...t,...r,style:{...e.style,left:"2px",width:`calc(${(e.endDay-e.startDay+1)*100}% - 4px)`,top:`${e.topOffset*22+2}px`}},FZ.default.createElement(oo,{superstate:e.superstate,path:e.data[mt]}))};var qD=Ae(Te()),B8=e=>qD.default.createElement("div",{className:"mk-day-view-gutter"},e.allDay&&qD.default.createElement("div",{className:"mk-day-view-hour-title"},"all day"),Array.from({length:e.endHour-e.startHour+1}).map((t,r)=>{let n=r+e.startHour;return qD.default.createElement("div",{key:n,className:"mk-day-view-hour-title"},qD.default.createElement("span",null,n%12===0?12:n%12)," ",n<12?"AM":"PM")}));var So=Ae(Te());var LD=e=>{let{event:t,hourHeight:r,startHour:n}=e,{spaceState:i}=(0,So.useContext)(ur),{attributes:a,listeners:o,setNodeRef:s,transform:l}=Us({id:`event-${t?.index??""}-${t?.start?.getTime().toString()??""}-${e.clone?"clone":""}`,data:{type:"event",index:t?.index}}),u="#0098FF",[c,f]=(0,So.useState)(null),d=c||t,p=(0,So.useMemo)(()=>{let h=t.start??JE(Hn(new Date),e.event.startOffset),m=t.end??JE(Hn(new Date),e.event.endOffset),g=_r(e.superstate,h,"a")===_r(e.superstate,m,"a"),A=`h${h.getMinutes()==0?"":":mm"} ${g?"":"a"}`,b=`h${m.getMinutes()==0?"":":mm"} a`;return e.event.startOffset>0?`${_r(e.superstate,h,A)} - ${_r(e.superstate,m,b)}`:null},[e.event]);return So.default.createElement("div",{key:t.index,onMouseDown:h=>{h.stopPropagation()},onContextMenu:h=>{let m=h.currentTarget.getBoundingClientRect();Kp(e.superstate,e.item[mt],i.path,m,Ne(h.currentTarget.ownerDocument))},className:"mk-day-block",style:{zIndex:1,...e.style||{},...e.clone?{top:`${(d.startOffset/60-n)*r}px`,width:`calc(${t.widthPercentage}% - ${t.leftOffset*8}px)`,height:`${(d.endOffset-d.startOffset)*r/60}px`}:{top:`${(d.startOffset/60-n)*r}px`,height:`${(d.endOffset-d.startOffset)*r/60}px`,left:`calc(${d.column*d.widthPercentage}% + ${d.leftOffset*8}px)`,width:`calc(${d.widthPercentage}% - ${d.leftOffset*8}px)`}}},So.default.createElement("div",{...a,...o,ref:s,className:"mk-day-block-inner",style:{"--block-color":u,"--block-bg-color":cg(40,u)}},So.default.createElement("div",{className:"mk-day-block-inner-indicator"}),So.default.createElement("div",{className:"mk-day-block-content"},e.item[mt]?So.default.createElement(oo,{superstate:e.superstate,path:e.item[mt],hideIcon:!0}):"New Event",p&&So.default.createElement("div",{className:"mk-day-block-time"},So.default.createElement("div",{dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//clock")}}),p)),So.default.createElement("span",null),d.repeat&&So.default.createElement("div",{className:"mk-icon-xsmall",dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//sync")}}),!d.allDay&&So.default.createElement(So.default.Fragment,null,So.default.createElement("div",{className:"mk-day-handle-n"},So.default.createElement(nl,{value:d.startOffset,cursor:"s",reverseY:!0,disableX:!0,step:60/r,onDragMove:h=>{let m={...t,startOffset:Math.round(h/15)*15};f(m)},onDragEnd:h=>{e.updateStartEnd&&e.updateStartEnd(Math.round(h/15)*15,d.endOffset),f(null)}})),So.default.createElement("div",{className:"mk-day-handle-s"},So.default.createElement(nl,{value:d.endOffset,cursor:"s",reverseY:!0,disableX:!0,step:60/r,onDragMove:h=>{let m={...t,endOffset:Math.round(h/15)*15};f(m)},onDragEnd:h=>{e.updateStartEnd&&e.updateStartEnd(d.startOffset,Math.round(h/15)*15),f(null)}})))))};var R8=e=>{let{hourHeight:t}=e,[r,n]=(0,zc.useState)(e.date??Hn(new Date)),{source:i}=(0,zc.useContext)(Na),[a,o]=(0,zc.useState)(null),s=`day-view-${r.toDateString()}`,l=e.startHour??0,u=(N,D,P,q,z)=>{if(!N||!P||!q)return[];let I=[],T=[];N.forEach((L,_)=>{let Y=or(L[z]),oe=[],te=Yi(L[P]);if(te>=D&&te<=Sa(D,{days:1})&&oe.push(L),Y&&Y.freq){let Q=Yi(L[q]).getTime()-te.getTime(),fe={dtstart:te,freq:Y.freq&&zM(Y.freq),count:Y.count&&Math.min(parseInt(Y.count),100),interval:Y.interval&&parseInt(Y.interval),byweekday:Y.byweekday&&Y.byweekday.map(Oe=>Xx(Oe)),until:Y.until&&new Date(Math.min((Yi(Y.until)??Sa(D,{days:1})).getTime(),Sa(D,{days:1}).getTime())),wkst:Y.wkst&&Xx(Y.wkst)};new Wt(Object.entries(fe).filter(([Oe,ve])=>ve!==void 0).reduce((Oe,[ve,ye])=>(Oe[ve]=ye,Oe),{})).between(D,Sa(D,{days:1}),!0).forEach(Oe=>{Oe.getTime()!=te.getTime()&&oe.push({...L,[P]:_r(e.superstate,Oe,$s),[q]:_r(e.superstate,ad(Oe,Q),$s)})})}oe.forEach(Q=>{let fe=Hn(r).getTime(),Ie=Sa(r,{days:1}).getTime(),Se=Yi(Q[P]),Oe=Yi(Q[q])?Yi(Q[q]):Hn(Se).getTime()==Se.getTime()?Se:Sa(Se,{hours:1}),ve=Math.max(l*60,(Se.getTime()-fe)/6e4),ye=Math.min(Oe.getTime()-fe,Ie-fe)/6e4;if(Se.getTime()==Hn(Se).getTime()){T.push({index:_,start:Se,end:Oe,startOffset:l*60,endOffset:60*24,leftOffset:0,widthPercentage:100,column:0,columnTotal:1,allDay:!0});return}let ke=!1;for(let $=0;$=ce.startOffset-15&&ve<=ce.startOffset+15){ae.push({index:_,start:Se,end:Oe,repeat:!!Y,startOffset:ve,endOffset:ye}),ke=!0;break}}ke||I.push([{index:_,repeat:!!Y,start:Se,end:Oe,startOffset:ve,endOffset:ye}])})}),I.forEach((L,_)=>{L.forEach((Y,oe)=>{T.push({...Y,leftOffset:0,widthPercentage:100/L.length,column:oe,columnTotal:L.length})})}),T.sort((L,_)=>L.startOffset-_.startOffset);for(let L=0;LT[_].startOffset&&T[L].startOffsetu(e.data,r,e.field,e.fieldEnd,e.fieldRepeat),[e.data,r,e.field,e.fieldEnd,e.fieldRepeat]),[d,p]=(0,zc.useState)(null),[h,m]=(0,zc.useState)(null),[g,A]=(0,zc.useState)(null),[b,v]=(0,zc.useState)(null),x=()=>{p(null),m(null),A(null),v(null)},w=N=>Math.round(N/15)*15;Ca({onDragStart:N=>{N.active.data.current.type==="event"&&(p(N.active.data.current.index),o(null))},onDragOver:N=>{if(N.over?.id!=s||(p(N.active.data.current.index),N.active.data.current.type==="event"))return;let D=N.activatorEvent.clientY,P=N.over.rect.top;v(D-P),m(N.active?.data.current.path)},onDragMove:N=>{if(N.over?.id!=s)return;N.active.data.current.type!="event"&&m(N.active?.data.current.path);let D=N.over.rect,P=N.delta.y,q=2*Math.round(P/2);g!==q&&A(q)},onDragCancel:()=>{x()},onDragEnd:N=>{if(N.active.data.current.type==="event"&&N.over?.id==s){let{index:D}=N.active.data.current,P=f.find(I=>I.index==D);if(!P){x();return}let q=Sa(r,{minutes:Math.round(w(P.startOffset+g/t*60))}),z=Sa(r,{minutes:Math.round(w(P.endOffset+g/t*60))});e.updateItem({...e.data[D],[e.field]:_r(e.superstate,q,$s),[e.fieldEnd]:_r(e.superstate,z,$s)})}else if(h){let D=Sa(r,{minutes:Math.round(g/t*60)}),P=Sa(r,{minutes:Math.round(g/t*60)+60});e.insertItem({[e.field]:_r(e.superstate,D,$s),[e.fieldEnd]:_r(e.superstate,P,$s),[mt]:h})}x()}});let{setNodeRef:S}=zu({id:s,data:{type:"day-view",date:r}}),k=new Date().toDateString()===r.toDateString(),[j,O]=(0,zc.useState)(0),C=f.find(N=>N.index==d);return(0,zc.useEffect)(()=>{let N;return k&&(O((new Date().getHours()-l)*60+new Date().getMinutes()),N=setInterval(()=>{O((new Date().getHours()-l)*60+new Date().getMinutes())},6e4)),()=>{N&&clearInterval(N)}},[]),Bl.default.createElement("div",{className:"mk-day-view-container",style:{"--hour-height":`${t}px`}},e.header&&Bl.default.createElement(tE,{superstate:e.superstate,date:r,mode:"day",setDate:n}),e.gutter&&Bl.default.createElement("div",{className:"mk-day-view-all-day"},Bl.default.createElement("div",{className:"mk-day-view-gutter"},Bl.default.createElement("div",{className:"mk-day-view-hour-title"},"all day")),Bl.default.createElement("div",{className:"mk-day-view-hour"},f.filter(N=>N.allDay).map((N,D)=>Bl.default.createElement(I8,{superstate:e.superstate,key:D,index:N.index,startDay:0,endDay:0,topOffset:0,data:e.data[N.index],style:{position:"relative","--block-bg-color":cg(40,"#0098FF"),"--block-color":"#0098FF"}})))),Bl.default.createElement("div",{className:"mk-day-view"},e.gutter&&Bl.default.createElement(B8,{hourHeight:t,startHour:l,endHour:c}),Bl.default.createElement("div",{className:"mk-day-view-content",ref:S,onMouseDown:N=>{if(N.button!=0)return;let D=N.currentTarget.scrollTop,P=N.clientY-N.currentTarget.getBoundingClientRect().top+D;o({index:-1,startOffset:w((P/t+l)*60),endOffset:w((P/t+l)*60),leftOffset:0,widthPercentage:100,column:0,columnTotal:1})},onMouseMove:N=>{if(a){let D=N.currentTarget.scrollTop,P=N.clientY-N.currentTarget.getBoundingClientRect().top+D,q=w((P/t+l)*60);q<=a.startOffset?o({...a,startOffset:q}):o({...a,endOffset:q}),N.preventDefault()}},onMouseUp:N=>{if(!a||a.startOffset==a.endOffset){o(null);return}let D=Sa(r,{minutes:a.startOffset}),P=Sa(r,{minutes:a.endOffset});N.preventDefault();let q=N.currentTarget.getBoundingClientRect();e.superstate.ui.quickOpen(2,q,window,z=>{!z||e.insertItem({[e.field]:_r(e.superstate,D,$s),[e.fieldEnd]:_r(e.superstate,P,$s),[mt]:z})},i),o(null)}},Array.from({length:c-l}).map((N,D)=>Bl.default.createElement("div",{key:D,className:"mk-day-view-hour"})),k&&j>0&&Bl.default.createElement("div",{className:"mk-day-view-hour-current",style:{top:`${j*t/60}px`}}),f.filter(N=>!N.allDay).map((N,D)=>Bl.default.createElement(LD,{superstate:e.superstate,key:D,event:N,item:e.data[N.index],hourHeight:t,startHour:l,updateStartEnd:(P,q)=>{let z=Sa(r,{minutes:P}),I=Sa(r,{minutes:q});e.updateItem({...e.data[N.index],[e.field]:_r(e.superstate,z,$s),[e.fieldEnd]:_r(e.superstate,I,$s)})}})),a&&a.endOffset>a.startOffset&&Bl.default.createElement(LD,{superstate:e.superstate,event:a,item:{},hourHeight:t,startHour:l,clone:!0}),d!==null&&C?Bl.default.createElement(LD,{superstate:e.superstate,event:{...C,start:null,end:null,startOffset:Math.round(w(C.startOffset+g/t*60)),endOffset:Math.round(w(C.endOffset+g/t*60))},item:e.data[d],hourHeight:t,startHour:l,clone:!0}):h?Bl.default.createElement(LD,{superstate:e.superstate,event:{index:-1,startOffset:0,endOffset:60,leftOffset:0,widthPercentage:100,column:0,columnTotal:1},startHour:e.startHour,item:{[mt]:h},hourHeight:t,style:{transform:`translateY(${g+b}px)`},clone:!0}):null)))};var Rl=Ae(Te());var Rf=Ae(Te()),J6e=Ae(bl());var _Z=Ae(Te()),K6e=e=>{let{attributes:t,listeners:r,setNodeRef:n,transform:i}=Us({id:"day-"+e.date.getTime(),data:{type:"day",date:e.date.getTime()}}),{setNodeRef:a}=zu({id:"day-"+e.date.getTime(),data:{type:"day",weekStart:e.weekStart.getTime(),date:e.date.getTime()}}),o=e.date.toDateString()===new Date().toDateString(),s=r9(a,n);return _Z.default.createElement("div",{ref:s,...t,...r,className:`mk-month-day ${e.active?"mk-active":"mk-inactive"} ${o?"mk-today":""}`,onClick:l=>{l.detail==2&&e.insertItem(l)},style:{opacity:"1 !important"}},_Z.default.createElement("div",{className:"mk-month-day-number"},e.date.getDate()),e.children)};var yb=Ae(Te());var PZ=e=>{let{attributes:t,listeners:r,setNodeRef:n,transform:i}=Us({id:"event-"+e.index,data:{type:"event",index:e.index}}),a=(0,yb.useMemo)(()=>{let o=new Date(e.startEvent),s=`h${o.getMinutes()==0?"":":mm"} a`;return e.allDay?null:`${_r(e.superstate,o,s)}`},[e.startEvent,e.endEvent,e.allDay]);return yb.default.createElement("div",{className:"mk-month-event",ref:n,style:e.style,...t,...r},!e.allDay&&yb.default.createElement("div",{className:"mk-day-block-inner-indicator"}),yb.default.createElement(oo,{superstate:e.superstate,path:e.data[mt],hideIcon:!0}),yb.default.createElement("div",{className:"mk-day-block-time"},a))};var eCe=e=>{let t=mo(e.date),r=AA(t),{source:n}=(0,Rf.useContext)(Na),i=(0,Rf.useMemo)(()=>{let u=[];return e.events.forEach((c,f)=>{let d=[],p=or(c[e.fieldRepeat]),h=Yi(c[e.field]),m=Yi(c[e.fieldEnd])??h;if(h<=Mx(r)&&m>=Hn(t)&&d.push(c),p&&p.freq){let g=Yi(c[e.fieldEnd]).getTime()-h.getTime(),A={dtstart:h,freq:p.freq&&zM(p.freq),count:p.count&&Math.min(p.count,100),interval:parseInt(p.interval),byweekday:p.byweekday&&p.byweekday.map(x=>Xx(x)),until:Yi(p.until),wkst:p.wkst&&Xx(p.wkst)};new Wt(Object.entries(A).filter(([x,w])=>w!==void 0).reduce((x,[w,S])=>(x[w]=S,x),{})).between(Hn(t),Mx(r),!0).forEach(x=>{x.getTime()!=h.getTime()&&d.push({...c,[e.field]:_r(e.superstate,x,$s),[e.fieldEnd]:_r(e.superstate,ad(x,g),$s)})})}d.forEach(g=>{let A=Yi(g[e.field]),b=Yi(g[e.fieldEnd])??Hn(A).getTime()==A.getTime()?Hn(A):Ox(A,1),v=A>t?A:t,x=bc.startDay==f.startDay?c.endDay==f.endDay?c.allDay?-1:1:f.endDay-c.endDay:c.startDay-f.startDay),u.map((c,f,d)=>{let p=d.slice(0,f).reduce((h,m)=>m.endDay>=c.startDay?h+1:h,0);return{...c,offset:p}})},[e.events,e.fieldRepeat,e.field,e.fieldEnd,t,r]),[a,o]=(0,Rf.useState)(null),[s,l]=(0,Rf.useState)(null);return Ca({onDragStart:u=>{u.active.data.current.type=="day"&&l(new Date(u.active.data.current.date))},onDragOver:u=>{if(u.active?.data.current.type=="day"&&u.over?.data.current.type=="day"){let c=new Date(u.over?.data.current.date),f=c>s?s:c,d=c>s?c:s;if(f>=r||d<=t){o(null);return}let p=i.reduce((h,m)=>m.endDay>=r.getDay()?h+1:h,0);o({offset:p,index:-1,startDay:td?d.getDay():r.getDay(),allDay:!1,startTime:f.getTime(),endTime:d.getTime()})}},onDragEnd:u=>{if(a&&u.over?.data.current.weekStart==t.getTime()){let c=_r(e.superstate,s,"yyyy-MM-dd"),f=_r(e.superstate,new Date(u.over.data.current.date),"yyyy-MM-dd"),d=u.over?.data?.current?.rect;e.superstate.ui.quickOpen(2,d,window,p=>{p&&e.insertItem({[mt]:p,[e.field]:c,[e.fieldEnd]:f}),o(null)},n)}else o(null);l(null)}}),Rf.default.createElement("div",{className:"mk-month-week"},Array.from({length:7}).map((u,c)=>{let f=Sa(t,{days:c}),d=f.getMonth()===e.date.getMonth();return Rf.default.createElement(K6e,{key:c,superstate:e.superstate,weekStart:t,active:d,date:f,insertItem:p=>{let h=i.reduce((v,x)=>{let w=Yi(e.events[x.index])?.getHours();return w>v?w:v},9),m=_r(e.superstate,Ox(Hn(f),h),$s),g=_r(e.superstate,Ox(Hn(f),h+1),$s),A=i.reduce((v,x)=>x.endDay>=c?v+1:v,0);o({offset:A,index:-1,startDay:c,endDay:c,startTime:Hn(f).getTime(),endTime:Mx(f).getTime(),allDay:!1});let b=p.currentTarget.getBoundingClientRect();e.superstate.ui.quickOpen(2,b,window,v=>{v&&e.insertItem({[mt]:v,[e.field]:m,[e.fieldEnd]:g}),o(null)})}},a?.startDay==c&&Rf.default.createElement(PZ,{superstate:e.superstate,index:-1,style:{"--block-bg-color":cg(40,"#0098FF"),"--block-color":"#0098FF","--block-text-color":"var(--mk-ui-text-accent)",top:`${30}px`,width:`${(a.endDay-a.startDay+1)*100}%`},data:{[mt]:"New Event"},startEvent:a.startTime,endEvent:a.endTime,allDay:!1}),i.filter(p=>p.startDay==c).map((p,h)=>{let m=a?p.startDay<=a.endDay&&p.endDay>=a.startDay:!1;return Rf.default.createElement(PZ,{superstate:e.superstate,key:h,index:p.index,startEvent:p.startTime,endEvent:p.endTime,allDay:p.allDay,style:{"--block-bg-color":p.allDay?cg(40,"#0098FF"):"transparent","--block-color":"#0098FF","--block-text-color":p.allDay?"var(--mk-ui-text-accent)":"var(--mk-ui-text-primary)",top:`${p.offset*22+30+(m?22:0)}px`,width:`${(p.endDay-p.startDay+1)*100}%`},data:e.events[p.index]})}))}),s&&(0,J6e.createPortal)(Rf.default.createElement(Um,{dropAnimation:WU}),document.body))};var tCe=e=>{let[t,r]=(0,Rl.useState)(e.date??new Date),n=(0,Rl.useMemo)(()=>{let o=Wo(t),s=Jg(t),l=[],u=o;for(;u<=s;)l.push(u),u=Xg(u,1);return l},[t]),[i,a]=(0,Rl.useState)(null);return Ca({onDragStart:o=>{a(o.active.id)},onDragEnd:o=>{a(null)}}),Rl.default.createElement("div",{className:"mk-month-grid"},e.header&&Rl.default.createElement(tE,{superstate:e.superstate,date:t,setDate:r,mode:"month"}),Rl.default.createElement("div",{className:"mk-month-header"},Rl.default.createElement("div",null,"S"),Rl.default.createElement("div",null,"M"),Rl.default.createElement("div",null,"T"),Rl.default.createElement("div",null,"W"),Rl.default.createElement("div",null,"T"),Rl.default.createElement("div",null,"F"),Rl.default.createElement("div",null,"S")),n.map((o,s)=>Rl.default.createElement(eCe,{key:s,superstate:e.superstate,date:o,events:e.data,field:e.field,fieldEnd:e.fieldEnd,fieldRepeat:e.fieldRepeat,insertItem:e.insertItem,updateItem:e.updateItem})))};var Ds=Ae(Te());var $8=Ae(Te());var rCe=e=>{let{source:t}=(0,$8.useContext)(Na),{setNodeRef:r}=zu({id:"allday-"+e.date.toISOString()});return $8.default.createElement("div",{className:"mk-week-view-all-day-cell",ref:r,onClick:i=>{if(i.stopPropagation(),i.detail===2){let a=i.currentTarget.getBoundingClientRect();e.superstate.ui.quickOpen(2,a,Ne(i.currentTarget.ownerDocument),o=>{e.insertItem(o)},t)}},style:{"--block-bg-color":cg(40,"#0098FF"),"--block-color":"#0098FF","--block-text-color":"var(--mk-ui-text-accent)",height:`${e.height*24}px`}},e.children)};var nCe=e=>{let t=e.hourHeight,[r,n]=(0,Ds.useState)(e.weekStart??mo(new Date)),i=e.startHour??0,a=e.endHour??24,[o,s]=(0,Ds.useState)(0),l=(0,Ds.useMemo)(()=>{let u=[];e.data.forEach((f,d)=>{let p=Yi(f[e.field]),h=Yi(f[e.fieldEnd])??p;h>=r&&p<=Sa(r,{days:7})&&Hn(p).getTime()==p.getTime()&&Hn(h).getTime()==h.getTime()&&u.push({index:d,startDay:new Date(Math.max(r.getTime(),p.getTime())).getDay(),endDay:new Date(Math.min(Sa(r,{days:7}).getTime(),h.getTime())).getDay(),topOffset:0})});let c=0;return u.forEach((f,d)=>{for(let p=0;p=f.endDay&&u[p].topOffset==u[d].topOffset&&(u[d].topOffset+=1,c=Math.max(c,u[d].topOffset))}),s(c),u},[e.data,r,e.field,e.weekStart]);return Ds.default.createElement("div",{className:"mk-week-view",style:{"--hour-height":`${t}px`}},e.header&&Ds.default.createElement(tE,{superstate:e.superstate,date:r,mode:"week",setDate:n}),Ds.default.createElement("div",{className:"mk-week-view-header"},Ds.default.createElement("div",{className:"mk-day-view-gutter"}),Array.from({length:7}).map((u,c)=>Ds.default.createElement("div",{key:c},_r(e.superstate,Sa(r,{days:c}),"EEE d")))),Ds.default.createElement("div",{className:"mk-week-view-all-day"},Ds.default.createElement("div",{className:"mk-day-view-gutter"},Ds.default.createElement("div",{className:"mk-day-view-hour-title",style:{height:`${o*30}px`}},"all day")),Array.from({length:7}).map((u,c)=>Ds.default.createElement(rCe,{key:c,height:o+1,superstate:e.superstate,date:oa(r,c),insertItem:f=>{e.insertItem({[e.field]:_r(e.superstate,oa(r,c),"yyyy-MM-dd"),[e.fieldEnd]:_r(e.superstate,oa(r,c),"yyyy-MM-dd"),[mt]:f})}},l.filter(f=>f.startDay==c).map((f,d)=>Ds.default.createElement(I8,{superstate:e.superstate,data:e.data[f.index],index:f.index,startDay:f.startDay,endDay:f.endDay,topOffset:f.topOffset,key:d}))))),Ds.default.createElement("div",{className:"mk-week-view-content"},Ds.default.createElement(B8,{hourHeight:t,startHour:i,endHour:a}),Array.from({length:7}).map((u,c)=>Ds.default.createElement(R8,{superstate:e.superstate,key:_r(e.superstate,Sa(r,{days:c})),field:e.field,fieldEnd:e.fieldEnd,fieldRepeat:e.fieldRepeat,date:Sa(r,{days:c}),data:e.data,hourHeight:t,startHour:i,endHour:a,insertItem:f=>{e.insertItem(f)},updateItem:f=>{e.updateItem(f)}}))))};var iCe=Ae(yi()),$o=Ae(Te());var stt=e=>e.node.type=="column"&&e.children.length==1,ltt=e=>e.node.type=="container"&&e.children.length==1,utt=e=>e.node.type=="container"&&e.children.length==2,zD=(e,t,r,n,i)=>{let a=e;if(a.schemaId!=r.id){a=sf("$root",r.id,a,r.id);let d=Mi(a.id,n.map(p=>p.id));a=sf(a.id,d,a,r.id),a.id=d,a.schemaId=r.id}let o=[],s=[];if(a.id==t.id)return[[],[]];let l=r.node.schemaId,u=pc(r,t.id),c=pc(r,a.id);if(!u)return[[],[]];let f=t.node.type=="column";if(i=="inside"){let d={...a,parentId:t.node.id};o.push(d)}else if(f||r.editorProps.editMode==1&&t.node.parentId==r.id&&(i=="left"||i=="right")){let d=t.node.parentId==r.id,p=t.node.type=="container",h=t.node.type=="column",m=!1;h&&u.node.parentId==r.id&&(m=!0);let g=d&&!p,A=d&&p||h&&m;if(g){let b={...z1(rre,u.id,n,l),rank:t.node.rank},v={...z1(aj,b.id,[...n,b],l),rank:i=="left"?1:0},x={...z1(aj,b.id,[...n,b,v],l),rank:i=="left"?0:1},w=[b,v,x,{...t.node,rank:0,parentId:v.id}];o.push(...w,{...a,rank:0,parentId:x.id})}else if(A){let b=p?t.id:t.node.parentId,v={...z1(aj,b,n,l),rank:i=="left"?p?0:t.node.rank:p?t.children.length:t.node.rank+1},x=[v,{...a,parentId:v.id}];o.push(...x)}}else{let d=n.filter(A=>A.parentId==u.id&&A.id!=a.id).sort((A,b)=>A.rank-b.rank).map((A,b)=>({...A,rank:b})),p=d.find(A=>A.id==t.id)?.rank??0,h=i=="bottom"||i=="right"?p+1:p,m={...a,parentId:t.node.parentId},g=Cx(d,h,m).map((A,b)=>({...A,rank:b}));o.push(...g)}if(c&&stt(c)){let d=pc(r,c.id);if(s.push(c.node),ltt(d))s.push(d.node);else if(utt(d)){let p=d.children.filter(m=>m.id!=c.id);s.push(...p.map(m=>m.node),d.node);let h=p.flatMap(m=>m.children.map(g=>({...g.node,parentId:r.id,rank:d.node.rank})));h.push(...o.filter(m=>p.some(g=>g.id==m.parentId))),o=[...o.map(m=>h.some(g=>g.id==m.id)?{...m,parentId:r.id}:m),...h.filter(m=>!o.some(g=>m.id==g.id))]}}return[o,s]};var $l=Ae(Te());var q8=e=>{let{spaceInfo:t}=(0,$l.useContext)(ur),{undoLastAction:r,redoAction:n,frameSchema:i}=(0,$l.useContext)(ma),{nodes:a,addNode:o,saveNodes:s,setLastCreatedId:l}=(0,$l.useContext)(Wi),{hoverNode:u,setHoverNode:c,instance:f,id:d}=(0,$l.useContext)(_i),{selectionMode:p,selection:h,select:m}=(0,$l.useContext)(Hi),g=()=>{c(null)};Ca({onDragOver:({active:v,over:x})=>{let w=x?.data.current.node;x?.data.current.root==d?w&&c({id:x?.data.current.id,node:x?.data.current.node,direction:x?.data.current?.direction}):c(null)},onDragCancel:()=>{g()},onDragEnd:({active:v,over:x})=>{if(!v||!u){g();return}let w=u?.node;if(w==v.data.current.id||u?.id!=x.data.current.id){g();return}let k=pc(f.exec,w)?.children.find(j=>j.id==w);if(v.data.current.type=="node"){let O=pc(f.exec,v.data.current.node)?.children.find(C=>C.id==v.data.current.node);if(k&&O){let[C,N]=zD(O.node,k,f.exec,a,u.direction);s(C,N)}}else if(v.data.current.type=="property"){if(v.data.current.path==t.path&&k){let[j,O]=zD(A(v.data.current.property,v.data.current.context),k,f.exec,a,u.direction);s(j,O)}}else if(v.data.current.type=="listItem"){if(k){let[j,O]=zD({...Mo.node,props:{value:`'${v.data.current.contexts?.$context?._keyValue}'`}},k,f.exec,a,u.direction);s(j,O)}}else if(v.data.current.type=="context"&&k){let j=e.superstate.spacesIndex.get(v.data.current.space);if(j){let[O,C]=zD({...f0.node,props:{value:jr(rb(j,v.data.current.schema))}},k,f.exec,a,u.direction);s(O,C)}}g()}});let A=(v,x)=>{let w=mn.node;return v.type=="boolean"?w={...V1.node,styles:{...V1.node.styles,as:"'checkbox'"}}:v.type=="link"||v.type=="context"||v.type=="file"?w=Mo.node:v.type=="image"&&(w=uf.node),w.type=="input"?w={...w,props:{...w.props,value:jr(v.name)}}:x.length>0?w={...w,props:{...w.props,value:`$contexts['${x}']['${v.name}']`}}:w={...w,props:{...w.props,value:`${i.id}.props['${v.name}']`}},w},b=(0,$l.useCallback)(v=>{if(v.key=="ArrowUp"&&h.length>0){let x=a.find(w=>w.id==h[0]);if(x){let w=pc(f.exec,x.id);if(w){let S=w.children.find(k=>k.id==x.id).node.rank;S>0&&m(w.children.find(k=>k.node.rank==S-1)?.id)}}}if(v.key=="ArrowDown"&&h.length>0){let x=a.find(w=>w.id==h[0]);if(x){let w=pc(f.exec,x.id);if(w){let S=w.children.find(k=>k.id==x.id).node.rank;Sk.node.rank==S+1)?.id)}}}(v.key=="Delete"||v.key=="Backspace")&&h.length>0&&s([],h.map(x=>a.find(w=>w.id==x)).filter(x=>x)),v.key=="z"&&v.metaKey&&(v.shiftKey?n():r())},[h,a,r,n,s]);return(0,$l.useEffect)(()=>(e.superstate.ui.inputManager.on("keydown",b),()=>{e.superstate.ui.inputManager.off("keydown",b)}),[b]),$l.default.createElement($l.default.Fragment,null,f.exec&&$l.default.createElement("div",{className:"mk-f-root",style:{position:"relative"}},p>=3&&$l.default.createElement("div",{className:"mk-f-root-label",onClick:v=>{m(f.exec.id),v.stopPropagation()}},f.exec.node.name),f.exec.children.length==0&&i.id=="main"&&$l.default.createElement("button",{onClick:()=>{e.superstate.spaceManager.saveFrame(t.path,aw.main)}},"+ Add View"),$l.default.createElement($D,{key:t.path,superstate:e.superstate,treeNode:f.exec,instance:f,containerRef:e.containerRef},e.children)))};var UD=e=>{let[t,r]=(0,$o.useState)(e.contexts);(0,$o.useEffect)(()=>r(g=>iCe.default.isEqual(e.contexts,g)?g:e.contexts),[e.contexts]);let{spaceInfo:n}=(0,$o.useContext)(ur),{dbSchema:i}=(0,$o.useContext)(Na),{setDragNode:a}=(0,$o.useContext)(vh),o=$o.default.useRef(null),{attributes:s,listeners:l,active:u,setNodeRef:c,transform:f,isDragging:d,transition:p,isOver:h,over:m}=Noe({id:e.id,data:{id:e.id,type:e.type,space:n?.path,schema:i?.id,props:e.props,contexts:t},disabled:e.type!="listItem"||e.editMode>0,animateLayoutChanges:VU});return Ca({onDragStart:g=>{g.active.data.current.id==e.id&&a($o.default.createElement("div",{dangerouslySetInnerHTML:{__html:o.current.innerHTML}}))},onDragOver:g=>{},onDragEnd:({active:g,over:A})=>{let b=A&&A.data.current.space==n?.path&&A.data.current.schema==i?.id;ctt(b,A,e,g,n)}}),e.editMode>=1&&e.uri.authority!="$kit"?$o.default.createElement(Tv,{superstate:e.superstate,id:e.id,editMode:e.editMode,selected:e.editMode==3},$o.default.createElement(ug,{id:e.id,superstate:e.superstate,props:e.props,propSetters:e.propSetters,contexts:t,editable:!0},$o.default.createElement(q8,{superstate:e.superstate,containerRef:e.containerRef},e.children))):$o.default.createElement($o.default.Fragment,null,m?.id==e.id&&u.data.current.type==e.type&&!(u.data.current.space==n?.path&&u.data.current.schema==i?.id&&u.data.current.props?._groupValue==e.props?._groupValue)&&$o.default.createElement(ug,{id:e.id,superstate:e.superstate,props:e.props,propSetters:e.propSetters,contexts:t,editable:!1},$o.default.createElement(vb,{superstate:e.superstate})),$o.default.createElement("div",{ref:g=>{c(g),o.current=g},...s,...l,style:{transform:Lu.Transform.toString(f),transition:p}},$o.default.createElement(ug,{id:e.id,superstate:e.superstate,props:e.props,propSetters:e.propSetters,contexts:t,editable:!1},$o.default.createElement(vb,{superstate:e.superstate},e.children))))},ctt=async(e,t,r,n,i)=>{if(e&&t.id==r.id)if(n.data.current.schema==Er){let a=n.data.current.contexts?.$context?._keyValue,o=t.data.current.contexts?.$context,s=r.props?._groupValue!=n.data.current.props?._groupValue;a&&o&&(s?pi(r.superstate,a,{[r.props?._groupField]:r.props?._groupValue}):GS(r.superstate,a,o._index,i.path))}else{let a=t.data.current.contexts?.$context;_oe(r.superstate.spaceManager,i,n.data.current.schema,n.data.current.contexts?.$context?._index,r.props?._groupField,r.props?._groupValue,a?._index)}};var Eo=Ae(Te());var rE=Ae(Te()),aCe=e=>{let t=(0,rE.useRef)(null);return(0,rE.useEffect)(()=>{let r=new IntersectionObserver(n=>{n[0].isIntersecting&&e.onScroll()},{threshold:1});return t.current&&r.observe(t.current),()=>{t.current&&r.unobserve(t.current)}},[t]),rE.default.createElement("div",{ref:t})};var nE=Ae(Te());var bb=e=>{let{selected:t}=(0,nE.useContext)(Hi);return e.editMode>=1&&e.uri.authority!="$kit"?nE.default.createElement(pv,{superstate:e.superstate,schema:e.uri.ref},nE.default.createElement(FEe,{superstate:e.superstate,cols:e.cols,editMode:e.editMode},e.children)):nE.default.createElement(F9,{superstate:e.superstate,path:e.uri,cols:e.cols},e.children)};var oCe=e=>{let{editSection:t,selectedIndex:r,setSelectedIndex:n,groupURI:i,itemURI:a}=e,{readMode:o}=(0,Eo.useContext)($r),{spaceInfo:s,spaceState:l}=(0,Eo.useContext)(ur),{predicate:u,filteredData:c,editMode:f,sortedColumns:d,contextTable:p,cols:h,dbSchema:m,source:g}=(0,Eo.useContext)(Na),[A,b]=(0,Eo.useState)(1),v=25,{instance:x}=(0,Eo.useContext)(_i),w=u?.groupBy?.length>0?h.find(P=>P.name+P.table==u.groupBy[0]):null,S=(0,Eo.useMemo)(()=>{let P=x?.state[x?.root?.id].props?.groupOptions;return P?dl(P):w?kr(["",...(pr(w.value,w.type,e.superstate)?.options??[]).map(z=>z.value),...c.reduce((z,I)=>[...z,I[w.name+w.table]??""],[])]):[""]},[w,c,x]),k=(0,Eo.useMemo)(()=>{let P=x?.state[x?.root?.id].props?.groupFilter;return qi[P]??qi.is},[x]),j=(0,Eo.useMemo)(()=>S.reduce((P,q)=>{let[z,I]=P;if(!w)return[q==""?{...z,[q]:c.map((L,_)=>({...L,_pageId:I+_}))??[]}:{...z,[q]:[]},I+c.length];let T=c.filter(L=>k.fn(L[w.name+w.table],q));return[T.length>0?{...z,[q]:T.map((L,_)=>({...L,_pageId:I+_}))}:{...z,[q]:[]},I+T.length]},[{},0])[0],[c,S,k,w]),O=(0,Eo.useMemo)(()=>h.find(P=>P.primary=="true")?.name,[h]),C=(0,Eo.useMemo)(()=>d.filter(P=>!u?.colsHidden.includes(P.name)),[u,d]),N={_path:g,_schema:m?.id,_key:O,_properties:C},D=(0,Eo.useMemo)(()=>m?m?.primary=="true"?c.reduce((P,q)=>({...P,[q._index]:{$context:{_index:q._index,_keyValue:q[O],_schema:m.id,_name:e.superstate.pathsIndex.get(q[O])?.name,...N},$properties:h,[g]:h.reduce((z,I)=>({...z,[I.name]:q[I.name]}),{}),...Object.keys(p).filter(z=>l.contexts.some(I=>Wn(I)==z)).reduce((z,I)=>({...z,[I]:p[I].cols.reduce((T,L)=>({...T,[L.name]:q[L.name+I]}),{})}),{})}}),{}):c.reduce((P,q)=>({...P,[q._index]:{$context:{_index:q._index,_keyValue:q[O],_schema:m.id,_name:q[O],...N},$properties:h,[g]:h.reduce((z,I)=>({...z,[I.name]:q[I.name]}),{})}}),{}):{},[c,h,g,p,l]);return Eo.default.createElement(bb,{superstate:e.superstate,uri:i,editMode:t=="listGroup"?f:0,cols:[]},Eo.default.createElement(HU,{items:Object.keys(j).map((P,q)=>s.path+"listGroup"+q),strategy:q6},Object.keys(j).map((P,q)=>Eo.default.createElement(UD,{key:"listGroup"+q,id:s.path+"listGroup"+q,type:"listGroup",superstate:e.superstate,uri:i,props:{_selectedIndex:r,_groupValue:P,_groupField:w?.name,_groupType:w?.type,_readMode:o,...u.listGroupProps},propSetters:null,editMode:t=="listGroup"?f:0,cols:[],containerRef:e.containerRef,contexts:{$context:N}},Eo.default.createElement(bb,{uri:a,superstate:e.superstate,cols:[],editMode:t=="listItem"?f:0},Eo.default.createElement(HU,{items:j[P].flatMap((z,I)=>s.path+"listGroup"+q+"_listItem"+I),strategy:q6},j[P].filter(z=>parseInt(z._pageId)<=A*v).map((z,I)=>parseInt(z._pageId)==A*v?Eo.default.createElement(aCe,{key:I,onScroll:()=>b(T=>T+1)}):Eo.default.createElement(UD,{key:"listGroup"+q+"_listItem"+I,id:s.path+"listGroup"+q+"_listItem"+I,type:"listItem",uri:a,superstate:e.superstate,cols:[],props:{_selectedIndex:r,_groupValue:P,_groupField:w?.name,_readMode:o,...u.listItemProps},propSetters:{_selectedIndex:n},containerRef:e.containerRef,editMode:t=="listItem"?f:0,contexts:D[z._index]}))))))))};var eE=e=>{let{pathState:t}=(0,ta.useContext)($r),{predicate:r,editMode:n,setEditMode:i,dbSchema:a,tableData:o,data:s,updateRow:l}=(0,ta.useContext)(Na),{frameSchema:u}=(0,ta.useContext)(ma),[c,f]=(0,ta.useState)(null),[d,p]=(0,ta.useState)(null),[h,m]=(0,ta.useState)(r?{listView:e.superstate.spaceManager.uriByString(mA(r.listView,"spaces://$kit/#*listView"),t.path),listGroup:e.superstate.spaceManager.uriByString(mA(r.listGroup,"spaces://$kit/#*listGroup"),t.path),listItem:e.superstate.spaceManager.uriByString(mA(r.listItem,"spaces://$kit/#*rowItem"),t.path)}:null);(0,ta.useEffect)(()=>{if(!r)return;let A={listView:e.superstate.spaceManager.uriByString(mA(r.listView,"spaces://$kit/#*listView"),t.path),listGroup:e.superstate.spaceManager.uriByString(mA(r.listGroup,"spaces://$kit/#*listGroup"),t.path),listItem:e.superstate.spaceManager.uriByString(mA(r.listItem,"spaces://$kit/#*rowItem"),t.path)};m(b=>sCe.default.isEqual(A,b)?b:A)},[r,t]);let g=A=>{A.key=="Escape"&&p(null),A.key!="Enter"&&(A.key=="ArrowDown"&&(p(b=>b==null?"0":(parseInt(b)+1).toString()),A.preventDefault()),A.key=="ArrowUp"&&(p(b=>b==null||b=="0"?null:(parseInt(b)-1).toString()),A.preventDefault()),A.key=="ArrowLeft",A.key=="ArrowRight")};return o?ta.default.createElement("div",{className:"mk-context-container"},!e.minMode&&ta.default.createElement(w9,{showTitle:e.showTitle,superstate:e.superstate,setView:e.setView}),h?r.view=="table"||r.view=="db"||a?.primary!="true"&&!u?ta.default.createElement(pEe,{superstate:e.superstate}):r.view=="day"?ta.default.createElement(R8,{superstate:e.superstate,field:r.listViewProps?.start||"start",fieldEnd:r.listViewProps?.end||"end",fieldRepeat:r.listViewProps?.repeat,startHour:r.listViewProps?.startOfDay??0,endHour:r.listViewProps?.endOfDay??24,gutter:!0,header:r.listViewProps?.hideHeader!=!0,hourHeight:60,data:s,insertItem:A=>{l(A,-1)},updateItem:A=>{l(A,parseInt(A._index))}}):r.view=="week"?ta.default.createElement(nCe,{superstate:e.superstate,field:r.listViewProps?.start||"start",fieldEnd:r.listViewProps?.end||"end",fieldRepeat:r.listViewProps?.repeat,startHour:r.listViewProps?.startOfDay??0,endHour:r.listViewProps?.endOfDay??24,hourHeight:40,header:r.listViewProps?.hideHeader!=!0,data:s,insertItem:A=>{l(A,-1)},updateItem:A=>{l(A,parseInt(A._index))}}):r.view=="month"?ta.default.createElement(tCe,{superstate:e.superstate,data:s,field:r.listViewProps?.start||"start",fieldEnd:r.listViewProps?.end||"end",fieldRepeat:r.listViewProps?.repeat,header:!0,insertItem:A=>{l(A,-1)},updateItem:A=>{l(A,parseInt(A._index))}}):ta.default.createElement("div",{className:"mk-editor-context",onKeyDown:g},ta.default.createElement(Tv,{superstate:e.superstate,id:"list",editMode:c=="listView"?n:0},n>0&&ta.default.createElement(e2e,{editSection:c,superstate:e.superstate,setEditSection:f,setEditMode:i}),ta.default.createElement(bb,{superstate:e.superstate,uri:h.listView,cols:[],editMode:c=="listView"?n:0},ta.default.createElement(UD,{superstate:e.superstate,id:"listView",type:"listView",uri:h.listView,props:{_selectedIndex:d,...r.listViewProps},propSetters:{_selectedIndex:p},containerRef:e.containerRef,editMode:c=="listView"?n:0,cols:[],contexts:null},ta.default.createElement(oCe,{superstate:e.superstate,containerRef:e.containerRef,editSection:c,selectedIndex:d,setSelectedIndex:p,groupURI:h.listGroup,itemURI:h.listItem}))))):ta.default.createElement(ta.default.Fragment,null)):ta.default.createElement(ta.default.Fragment,null)};var IZ=e=>iE.default.createElement(Qs,{superstate:e.superstate,path:e.space.path,readMode:!1},iE.default.createElement(lh,{superstate:e.superstate},iE.default.createElement(pv,{superstate:e.superstate,schema:e.schema},iE.default.createElement(h2,{superstate:e.superstate},iE.default.createElement(eE,{showTitle:!1,superstate:e.superstate})))));var $h=Ae(yi()),Ku=Ae(Te()),yu=(0,Ku.createContext)({dragPaths:[],setDragPaths:$h.default.noop,selectedPaths:[],setSelectedPaths:$h.default.noop,activePath:null,setActivePath:$h.default.noop,activeFocus:0,setActiveFocus:$h.default.noop,activeViewSpaces:[],focuses:[],setFocuses:$h.default.noop,saveActiveSpace:$h.default.noop,closeActiveSpace:$h.default.noop,modifier:null,setModifier:$h.default.noop,editFocus:!1,setEditFocus:$h.default.noop}),lCe=e=>{let[t,r]=(0,Ku.useState)(null),[n,i]=(0,Ku.useState)([]),[a,o]=(0,Ku.useState)([]),[s,l]=(0,Ku.useState)(null),[u,c]=(0,Ku.useState)(!1),[f,d]=(0,Ku.useState)(e.superstate.focuses),[p,h]=(0,Ku.useState)(e.superstate.settings.currentWaypoint),[m,g]=(0,Ku.useState)((e.superstate.focuses[p]?.paths??[]).map(S=>e.superstate.pathsIndex.get(S)).filter(S=>S)),A=S=>{let k=e.superstate.focuses[p]??{sticker:"",name:"Waypoint",paths:[]};k.paths=[...k.paths.filter(O=>O!=S),S],p>e.superstate.focuses.length&&e.superstate.spaceManager.saveFocuses([...e.superstate.focuses,k]);let j=e.superstate.focuses.map((O,C)=>C==p?k:O);e.superstate.spaceManager.saveFocuses(j.filter(O=>O))},b=S=>{let k=e.superstate.focuses[p]??{sticker:"",name:"Waypoint",paths:[]};k.paths=[...k.paths.filter(O=>O!=S)],p>e.superstate.focuses.length&&e.superstate.spaceManager.saveFocuses([...e.superstate.focuses,k]);let j=e.superstate.focuses.map((O,C)=>C==p?k:O);e.superstate.spaceManager.saveFocuses(j.filter(O=>O))},v=S=>{e.superstate.spaceManager.saveFocuses(S.filter(k=>k))},x=S=>{e.superstate.focuses[e.superstate.settings.currentWaypoint]?.paths?.includes(S.path)&&g((e.superstate.focuses[e.superstate.settings.currentWaypoint]?.paths??[]).map(k=>e.superstate.pathsIndex.get(k)).filter(k=>k))},w=()=>{d(e.superstate.focuses);let S=e.superstate.settings.currentWaypoint;h(S),g((e.superstate.focuses[S]?.paths??[]).map(k=>e.superstate.pathsIndex.get(k)).filter(k=>k))};return(0,Ku.useEffect)(()=>(e.superstate.eventsDispatcher.addListener("spaceStateUpdated",x),e.superstate.eventsDispatcher.addListener("settingsChanged",w),e.superstate.eventsDispatcher.addListener("focusesChanged",w),e.superstate.eventsDispatcher.addListener("superstateUpdated",w),()=>{e.superstate.eventsDispatcher.removeListener("spaceStateUpdated",x),e.superstate.eventsDispatcher.removeListener("settingsChanged",w),e.superstate.eventsDispatcher.removeListener("focusesChanged",w),e.superstate.eventsDispatcher.removeListener("superstateUpdated",w)}),[]),Ku.default.createElement(yu.Provider,{value:{dragPaths:n,setDragPaths:i,activeFocus:p,selectedPaths:a,setSelectedPaths:o,activePath:s,setActiveFocus:h,setActivePath:l,activeViewSpaces:m,focuses:f,setFocuses:v,saveActiveSpace:A,closeActiveSpace:b,modifier:t,setModifier:r,editFocus:u,setEditFocus:c}},e.children)};var Q8=Ae(Te());var iDe=Ae(yi());function ftt(e,t){return e?e.item?.type=="space"&&!e.collapsed&&t?e.depth+1:e.depth:0}function dtt(e){return e?Math.max(0,e.depth-1):0}function uCe(e,t){return Math.round(e/t)}var ptt=(e,t,r,n)=>{let i=e[r];if(!i)return;let a=i.type=="file"?e.find(o=>o.id==i.parentId):i;return a&&a.type!="file"?{depth:i.depth,overId:i.id,parentId:a.id,sortable:!1,insert:a.collapsed,droppable:!0,copy:n=="link"||n=="copy",reorder:!1}:null};function cCe(e,t,r,n,i,a,o,s,l){if(r.length==0)return null;if(r.length>1)return ptt(t,r,n,s);let u=t[n],c=t[n],f=t[n+1];if(!c)return;let d=c.type!="file",p=e.depth>0&&u.collapsed&&d&&(!u.sortable||o&&a<=13||!o&&a>=13),h=u.sortable||d&&!p&&f.sortable,m=i,g=e.depth==0?0:ftt(c,o),A=dtt(c),b=m;m>=g?b=g:mS.id==v);return{depth:b,overId:c.id,parentId:v,sortable:h,insert:p,droppable:x?.type!="file",copy:s=="link"||s=="copy",reorder:p?e?.parentId==u?.id:e?.parentId==x?.id||e?.parentId==l};function w(){return b===0||!c?null:b===c.depth||b>c.depth&&c.item.type!="space"?c.parentId:b>c.depth?c.id:t.slice(0,n).reverse().find(k=>k.depth===b)?.parentId??null}}var fCe=()=>window.navigator.platform.startsWith("Mac")?"\u2325":"Alt";var Jr=Ae(Te());var dCe=Ae(Ya());var ts=Ae(Te());var pCe=e=>{let{saveActiveSpace:t,editFocus:r,activeFocus:n,setFocuses:i,focuses:a,setEditFocus:o}=(0,ts.useContext)(yu),[s,l]=(0,ts.useState)(e.focus);return(0,ts.useEffect)(()=>{l(e.focus)},[e.focus]),s&&e.focus?e.focus.name?.length==0||r?ts.default.createElement("div",{className:"mk-path-tree-focus"},ts.default.createElement("div",{className:(0,dCe.default)("mk-focuses-item"),dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker(s.sticker)},onClick:u=>e.superstate.ui.openPalette(ts.default.createElement(Ta,{ui:e.superstate.ui,selectedSticker:c=>{l({...s,sticker:c})}}),Ne(u.view.document))}),ts.default.createElement("input",{value:s.name,onChange:u=>l({...s,name:u.target.value})}),ts.default.createElement("div",{className:"mk-button-group"},ts.default.createElement("button",{onClick:()=>e.saveFocus(s)},H.buttons.save),ts.default.createElement("button",{onClick:()=>{e.focus.name.length==0?(i(a.filter((u,c)=>c!=n)),e.superstate.saveSettings()):o(!1)}},H.buttons.cancel))):ts.default.createElement("div",{className:"mk-path-tree-empty"},ts.default.createElement("div",{className:"mk-empty-state-title"},"Open a Space"),ts.default.createElement("div",{className:"mk-empty-state-description"},"Open an existing folders and tags as a space or create a new one"),ts.default.createElement("button",{onClick:u=>{let c=u.target.getBoundingClientRect();e.superstate.ui.quickOpen(2,c,Ne(u.view.document),f=>{if(!e.superstate.pathsIndex.has(f)){kf(e.superstate,f,{}).then(p=>{t(f),e.superstate.ui.openPath(f,!1)});return}t(f)})}},"Open a Space")):ts.default.createElement(ts.default.Fragment,null)};var U8=Ae(Ya());var Zn=Ae(Te());var dn=Ae(Te()),Gi=Ae(xCe());var Att=new Map([["aac","audio/aac"],["abw","application/x-abiword"],["arc","application/x-freearc"],["avif","image/avif"],["avi","video/x-msvideo"],["azw","application/vnd.amazon.ebook"],["bin","application/octet-stream"],["bmp","image/bmp"],["bz","application/x-bzip"],["bz2","application/x-bzip2"],["cda","application/x-cdf"],["csh","application/x-csh"],["css","text/css"],["csv","text/csv"],["doc","application/msword"],["docx","application/vnd.openxmlformats-officedocument.wordprocessingml.document"],["eot","application/vnd.ms-fontobject"],["epub","application/epub+zip"],["gz","application/gzip"],["gif","image/gif"],["heic","image/heic"],["heif","image/heif"],["htm","text/html"],["html","text/html"],["ico","image/vnd.microsoft.icon"],["ics","text/calendar"],["jar","application/java-archive"],["jpeg","image/jpeg"],["jpg","image/jpeg"],["js","text/javascript"],["json","application/json"],["jsonld","application/ld+json"],["mid","audio/midi"],["midi","audio/midi"],["mjs","text/javascript"],["mp3","audio/mpeg"],["mp4","video/mp4"],["mpeg","video/mpeg"],["mpkg","application/vnd.apple.installer+xml"],["odp","application/vnd.oasis.opendocument.presentation"],["ods","application/vnd.oasis.opendocument.spreadsheet"],["odt","application/vnd.oasis.opendocument.text"],["oga","audio/ogg"],["ogv","video/ogg"],["ogx","application/ogg"],["opus","audio/opus"],["otf","font/otf"],["png","image/png"],["pdf","application/pdf"],["php","application/x-httpd-php"],["ppt","application/vnd.ms-powerpoint"],["pptx","application/vnd.openxmlformats-officedocument.presentationml.presentation"],["rar","application/vnd.rar"],["rtf","application/rtf"],["sh","application/x-sh"],["svg","image/svg+xml"],["swf","application/x-shockwave-flash"],["tar","application/x-tar"],["tif","image/tiff"],["tiff","image/tiff"],["ts","video/mp2t"],["ttf","font/ttf"],["txt","text/plain"],["vsd","application/vnd.visio"],["wav","audio/wav"],["weba","audio/webm"],["webm","video/webm"],["webp","image/webp"],["woff","font/woff"],["woff2","font/woff2"],["xhtml","application/xhtml+xml"],["xls","application/vnd.ms-excel"],["xlsx","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"],["xml","application/xml"],["xul","application/vnd.mozilla.xul+xml"],["zip","application/zip"],["7z","application/x-7z-compressed"],["mkv","video/x-matroska"],["mov","video/quicktime"],["msg","application/vnd.ms-outlook"]]);function aE(e,t){var r=gtt(e);if(typeof r.path!="string"){var n=e.webkitRelativePath;Object.defineProperty(r,"path",{value:typeof t=="string"?t:typeof n=="string"&&n.length>0?n:e.name,writable:!1,configurable:!1,enumerable:!0})}return r}function gtt(e){var t=e.name,r=t&&t.lastIndexOf(".")!==-1;if(r&&!e.type){var n=t.split(".").pop().toLowerCase(),i=Att.get(n);i&&Object.defineProperty(e,"type",{value:i,writable:!1,configurable:!1,enumerable:!0})}return e}var vtt=[".DS_Store","Thumbs.db"];function RZ(e){return I1(this,void 0,void 0,function(){return B1(this,function(t){return L8(e)&&ytt(e.dataTransfer)?[2,Stt(e.dataTransfer,e.type)]:btt(e)?[2,xtt(e)]:Array.isArray(e)&&e.every(function(r){return"getFile"in r&&typeof r.getFile=="function"})?[2,wtt(e)]:[2,[]]})})}function ytt(e){return L8(e)}function btt(e){return L8(e)&&L8(e.target)}function L8(e){return typeof e=="object"&&e!==null}function xtt(e){return BZ(e.target.files).map(function(t){return aE(t)})}function wtt(e){return I1(this,void 0,void 0,function(){var t;return B1(this,function(r){switch(r.label){case 0:return[4,Promise.all(e.map(function(n){return n.getFile()}))];case 1:return t=r.sent(),[2,t.map(function(n){return aE(n)})]}})})}function Stt(e,t){return I1(this,void 0,void 0,function(){var r,n;return B1(this,function(i){switch(i.label){case 0:return e.items?(r=BZ(e.items).filter(function(a){return a.kind==="file"}),t!=="drop"?[2,r]:[4,Promise.all(r.map(Ett))]):[3,2];case 1:return n=i.sent(),[2,wCe(ECe(n))];case 2:return[2,wCe(BZ(e.files).map(function(a){return aE(a)}))]}})})}function wCe(e){return e.filter(function(t){return vtt.indexOf(t.name)===-1})}function BZ(e){if(e===null)return[];for(var t=[],r=0;r{let[t,r]=(0,ea.useState)(null),n=(0,ea.useMemo)(()=>e.superstate.spaceManager.uriByString(e.action),[e.action]),i=p=>{if(r(p),n.authority=="$actions"){e.superstate.spaceManager.saveSystemCommand(n.path.split("/").pop(),p);return}e.superstate.spaceManager.saveCommand(n.path,p.schema.id,()=>p)};(0,ea.useEffect)(()=>{r(e.superstate.cli.commandForAction(e.action))},[e.action]),(0,ea.useEffect)(()=>{let p=h=>{h.path==n.basePath&&r(e.superstate.cli.commandForAction(e.action))};return e.superstate.eventsDispatcher.addListener("actionStateUpdated",p),()=>{e.superstate.eventsDispatcher.removeListener("actionStateUpdated",p)}});let a=(p,h)=>(i({...t,fields:[...t.fields,h]}),!0),o=p=>{i({...t,fields:t.fields.filter(h=>h.name!=p.name)})},s=(p,h)=>{i({...t,fields:t.fields.map(m=>m.name==h.name?p:m)})},l=p=>{let h=p.target.getBoundingClientRect();Nf(e.superstate,h,Ne(p.view.document),{spaces:[],fields:[],saveField:a,schemaId:t.schema.id,fileMetadata:!0,isSpace:!0})},u=[{name:"Actions",value:"actions"},{name:"Script",value:"script"},{name:"Formula",value:"formula"}],c=p=>{let h=pr(p.value,p.type);if(h)return h?.default},f=(p,h)=>{let m=pr(p.value,p.type)??{};m.default=h,s({...p,value:JSON.stringify(m)},p)},d=(0,ea.useMemo)(()=>t?.fields.reduce((p,h)=>({...p,[h.name]:c(h)}),{})??{},[t?.fields]);return ea.default.createElement("div",{className:"mk-editor-actions"},t&&ea.default.createElement(ea.default.Fragment,null,ea.default.createElement("div",{className:"mk-props-contexts"},ea.default.createElement("div",{className:"mk-path-context-row"},ea.default.createElement("div",{className:"mk-path-context-field"},"Type"),ea.default.createElement("div",{className:"mk-path-context-value"},ea.default.createElement(B9,{superstate:e.superstate,options:u,value:t.schema.type,selectValue:p=>i({...t,schema:{...t.schema,type:p}})}))),ea.default.createElement("div",{className:"mk-path-context-row"},ea.default.createElement("div",{className:"mk-path-context-field"},"Properties")),ea.default.createElement("div",{className:"mk-cell-object"},t.fields.map(p=>ea.default.createElement(bs,{key:p.name,superstate:e.superstate,initialValue:c(p),column:p,editMode:5,updateValue:h=>{f(p,h)},updateFieldValue:(h,m)=>{i({...t,fields:t.fields.map(g=>p.name==g.name?{...g,value:h}:g)})},propertyMenu:h=>{let m=h.target.getBoundingClientRect();yh({superstate:e.superstate,rect:m,win:Ne(h.view.document),editable:!0,options:[],field:p,fields:t.fields,contextPath:null,saveField:g=>s(g,p),deleteColumn:o})}}))),ea.default.createElement("button",{className:"mk-inline-button",onClick:p=>l(p)},ea.default.createElement("div",{className:"mk-icon-xsmall",dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//plus")}}),H.labels.newProperty)),t.schema.type=="script"?ea.default.createElement(a6e,{superstate:e.superstate,command:t,saveCommand:i,values:d,path:n.path}):t.schema.type=="actions"?ea.default.createElement(WEe,{superstate:e.superstate,formula:t.code,path:n.path,saveOutputType:p=>{i({...t,codeType:p})},saveFormula:p=>{i({...t,code:p})},fields:t.fields,value:d}):t.schema.type=="formula"?ea.default.createElement(Ah,{superstate:e.superstate,formula:t.code,saveFormula:p=>{i({...t,code:p})},fields:t.fields,value:d,path:n.path}):ea.default.createElement("div",null)))};var es=Ae(Te());var P8=Ae(Te());var G2=e=>{let t=[];return e.class&&t.push(`${e.class}`),e.layout&&t.push(`mk-layout-${e.layout}`),e.layoutAlign&&t.push(`mk-layout-align-${e.layoutAlign}`),e.layoutWrap&&t.push(`mk-layout-wrap-${e.layoutWrap}`),e.iconSize&&t.push(`mk-icon-size-${e.iconSize}`),e.imageSize&&t.push(`mk-image-size-${e.imageSize}`),t.join(" ")};var ep=Ae(Te());var Q2=Ae(Te()),v8=e=>{let t=e.state.props.value,r=(0,Q2.useMemo)(()=>e.superstate.ui.getUIPath(t),[t]);return e.state?.props.value?.length>0?Q2.default.createElement("audio",{controls:!0,preload:"none",src:r}):Q2.default.createElement(Q2.default.Fragment,null)};var kZ=Ae(Te()),y8=e=>kZ.default.createElement(kZ.default.Fragment,null,e.children);var Y2=Ae(Te());function Vet(e){return e?.replace(/([^/])#([*^])/g,"$1/#$2")}var b8=e=>{let t=Vet(e.state?.props?.value),{updateNode:r}=(0,Y2.useContext)(Wi),{id:n}=(0,Y2.useContext)(_i),i=o=>{Fa(o,Ne(o.view.document),e.superstate,s=>r(e.treeNode.node,{props:{...e.treeNode.node.props,value:jr(s+"/#^"+Er)}}))},a=o=>{if(e.treeNode.node.props.value=="$contexts['$space']['space']"){r(e.treeNode.node,{props:{...e.treeNode.node.props,value:`$contexts['$space']['space']+"/#*${o}"`}});return}zN(e.superstate,e.superstate.spaceManager.resolvePath(t,e.source)).then(s=>{r(e.treeNode.node,{props:{...e.treeNode.node.props,value:jr(s?.space+"#*"+o)}})})};return e.state&&t?Y2.default.createElement(Wv,{id:n,source:e.source,showTitle:!0,superstate:e.superstate,path:t,minMode:e.state?.styles?.["--mk-min-mode"],containerRef:e.containerRef,setFrameSchema:a}):Y2.default.createElement("div",{className:"mk-frame-placeholder",onClick:o=>i(o)},H.labels.selectSpace)};var Cs=Ae(Te());function Get(e){let t=/!\[!\[(.*?)\]\]/,r=/!!\[\[(.*?)\]\]/,n=e.match(t),i=e.match(r);return n?n[1]:i?i[1]:e}var x8=e=>{let{spaceState:t}=(0,Cs.useContext)(ur),r=(0,Cs.useMemo)(()=>{let h=e.state?.props?.value,m=h?e.superstate.spaceManager.resolvePath(Get(h),e.source):null,g=e.superstate.spaceManager.uriByString(h);return g?.scheme=="https"||g?.scheme=="http"?{path:h,label:{sticker:g.scheme,name:g.path,color:""},hidden:!1,subtype:"md",type:"remote",readOnly:!0}:e.superstate.pathsIndex.get(m)},[e.state,e.source]),{updateNode:n,nodes:i}=(0,Cs.useContext)(Wi),{selectionMode:a}=(0,Cs.useContext)(Hi),[o,s]=(0,Cs.useState)(e.state?.styles?.["--mk-expanded"]),l=h=>{if(h!=e.state.props?.value)if(e.treeNode.editorProps?.linkedNode){let m=i.find(g=>g.id==e.treeNode.editorProps.linkedNode.node);n(m,{props:{...m.props,[e.treeNode.editorProps.linkedNode.prop]:jr(h)}})}else n(e.treeNode.node,{props:{...e.treeNode.node.props,value:jr(h)}})},u=e.state?.styles?.["--mk-link"],{id:c}=(0,Cs.useContext)(_i),[f,d]=(0,Cs.useState)(""),p=()=>{s(h=>!h),a>0&&n(e.treeNode.node,{styles:{...e.treeNode.node.styles,"--mk-expanded":(!e.state?.styles?.["--mk-expanded"]).toString()}})};return Cs.default.createElement("div",{className:"mk-node-flow"},r&&(e.state?.styles?.["--mk-min-mode"]?Cs.default.createElement(Cs.default.Fragment,null):Cs.default.createElement("div",{className:"mk-node-link"},Cs.default.createElement(oo,{superstate:e.superstate,path:r.path},!u&&Cs.default.createElement(Vd,{superstate:e.superstate,collapsed:!o,onToggle:p})))),e.state&&o&&e.state?.props?.value?.length>0?Cs.default.createElement(w8,{id:c,superstate:e.superstate,path:r?.path??e.state?.props?.value,containerRef:e.containerRef,styles:{},readOnly:!0}):a>0&&Cs.default.createElement("div",{className:"mk-node-text-placeholder",onClick:h=>{let m=h.currentTarget.getBoundingClientRect();e.superstate.ui.quickOpen(2,m,Ne(h.view.document),g=>{l(g)})}},H.hintText.selectNote))};var NZ=Ae(Ya());var zt=Ae(Te()),V6e=Ae(bl());var Kd=Ae(Te());var s6e=e=>{let{groupNodes:t,saveNodes:r,nodes:n}=(0,Kd.useContext)(Wi),{selection:i,select:a}=(0,Kd.useContext)(Hi),o=i.map(s=>n.find(l=>l.id==s)).filter(s=>s);return Kd.default.createElement("div",{className:"mk-editor-frame-node-selector",style:{pointerEvents:"auto"},onClick:s=>s.stopPropagation()},Kd.default.createElement("div",{className:"mk-editor-frame-node-button"},Kd.default.createElement("div",{dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//copy-check")}}),H.labels.itemsSelected.replace("${1}",i.length.toString())),Kd.default.createElement("div",{className:"mk-divider"}),Kd.default.createElement("div",{"aria-label":H.editor.createVerticalSection,className:"mk-editor-frame-node-button",dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//rows")},onClick:()=>t(o,{layoutAlign:'"left"',gap:'"8px"'})}),Kd.default.createElement("div",{"aria-label":H.editor.createHorizontalSection,className:"mk-editor-frame-node-button ",dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//columns")},onClick:()=>t(o,{layout:'"row"',gap:'"8px"'})}),Kd.default.createElement("div",{className:"mk-divider"}),Kd.default.createElement("div",{className:"mk-editor-frame-node-button ","aria-label":H.menu.delete,onClick:()=>r([],o),dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//trash")}}))};var ir=Ae(Te());var S8={table:{name:H.menu.tableView,icon:"ui//table",view:"table",listView:"",listGroup:"",listItem:""},day:{name:"Day View",icon:"ui//calendar",view:"day",listView:"",listGroup:"",listItem:""},week:{name:"Week View",icon:"ui//calendar",view:"week",listView:"",listGroup:"",listItem:""},month:{name:"Month View",icon:"ui//calendar",view:"month",listView:"",listGroup:"",listItem:""},list:{name:H.menu.listView,icon:"ui//list",view:"list",listView:"spaces://$kit/#*listView",listGroup:"spaces://$kit/#*listGroup",listItem:"spaces://$kit/#*rowItem"},details:{name:H.menu.detailsView,icon:"ui//layout-grid",view:"list",listView:"spaces://$kit/#*listView",listGroup:"spaces://$kit/#*listGroup",listItem:"spaces://$kit/#*detailItem"},board:{name:H.menu.boardView,icon:"ui//square-kanban",view:"list",listView:"spaces://$kit/#*columnView",listGroup:"spaces://$kit/#*columnGroup",listItem:"spaces://$kit/#*cardListItem"},tasks:{name:"Checklist",icon:"ui//square-kanban",view:"list",listView:"spaces://$kit/#*listView",listGroup:"spaces://$kit/#*taskGroup",listItem:"spaces://$kit/#*taskListItem"},cards:{name:H.menu.cardView,icon:"ui//layout-dashboard",view:"list",listView:"spaces://$kit/#*listView",listGroup:"spaces://$kit/#*gridGroup",listItem:"spaces://$kit/#*cardsListItem"},catalog:{name:H.menu.catalogView,icon:"ui//gallery-horizontal-end",view:"list",listView:"spaces://$kit/#*listView",listGroup:"spaces://$kit/#*rowGroup",listItem:"spaces://$kit/#*coverListItem"},gallery:{name:H.menu.galleryView,icon:"ui//layout-dashboard",view:"list",listView:"spaces://$kit/#*listView",listGroup:"spaces://$kit/#*masonryGroup",listItem:"spaces://$kit/#*imageListItem"},flow:{name:H.menu.flowView,icon:"ui//edit",view:"list",listView:"spaces://$kit/#*listView",listGroup:"spaces://$kit/#*listGroup",listItem:"spaces://$kit/#*flowListItem"}};var Qet=e=>{if(e=="table")return{view:"table",listView:"",listGroup:"",listItem:""};if(e=="flow")return{view:"list",listView:"spaces://$kit/#*listView",listGroup:"spaces://$kit/#*listGroup",listItem:"spaces://$kit/#*flowListItem"};if(e=="list")return{view:"list",listView:"spaces://$kit/#*listView",listGroup:"spaces://$kit/#*listGroup",listItem:"spaces://$kit/#*rowItem"};if(e=="details")return{view:"list",listView:"spaces://$kit/#*listView",listGroup:"spaces://$kit/#*listGroup",listItem:"spaces://$kit/#*detailItem"};if(e=="board")return{view:"list",listView:"spaces://$kit/#*columnView",listGroup:"spaces://$kit/#*columnGroup",listItem:"spaces://$kit/#*cardListItem"};if(e=="cards")return{view:"list",listView:"spaces://$kit/#*listView",listGroup:"spaces://$kit/#*gridGroup",listItem:"spaces://$kit/#*cardsListItem"};if(e=="catalog")return{view:"list",listView:"spaces://$kit/#*listView",listGroup:"spaces://$kit/#*rowGroup",listItem:"spaces://$kit/#*coverListItem"};if(e=="gallery")return{view:"list",listView:"spaces://$kit/#*listView",listGroup:"spaces://$kit/#*masonryGroup",listItem:"spaces://$kit/#*imageListItem"};if(e=="calendar")return{view:"list",listView:"spaces://$kit/#*calendarView",listGroup:"spaces://$kit/#*dateGroup",listItem:"spaces://$kit/#*eventItem"}},PD=async(e,t,r)=>{let n=r=="board"?"Board":"Table",i=await e.spaceManager.tablesForSpace(t);return i&&(n=Mi(n,i.map(o=>o.id))),await e.spaceManager.createTable(t,{id:n,name:n,type:"db"}).then(o=>e.spaceManager.addSpaceProperty(t,{...Px[0],schemaId:n})).then(async o=>{let s=await e.spaceManager.framesForSpace(t),l={id:Mi(n,s?.map(u=>u.id)??[]),name:n,type:"view",predicate:JSON.stringify({...Wy,...r?Qet(r):{view:"table"}}),def:JSON.stringify({db:n,icon:r=="board"?"ui//square-kanban":"ui//table"})};return await e.spaceManager.createFrame(t,l),l.id})};var Z2=(e,t,r,n,i,a={searchable:!0})=>{let o=async m=>{if(m=="note")r.ui.quickOpen(2,e,t,g=>{i({...Mo.node,props:{value:jr(g)},styles:{"--mk-min-mode":"true","--mk-expanded":"true",width:"'100%'"}})});else if(m=="table"){let g=await PD(r,n.path);i({...f0.node,props:{value:jr(`./#*${g}`)}})}else m=="link"&&r.ui.quickOpen(2,e,t,g=>{i({...Mo.node,props:{value:jr(g)}})})},s=(m,g)=>{i({...m,type:"frame",ref:"spaces://$kit/#*"+g})},l=m=>{i({...m})},u=[{name:H.commands.newNote,value:"presetnote",onClick:()=>{o("note")},icon:"ui//mk-make-flow"},{name:H.commands.internalLink,value:"presetlink",onClick:()=>{o("link")},icon:"ui//mk-make-link"},{name:H.commands.table,value:"presettable",onClick:()=>{o("table")},icon:"ui//mk-make-table"}],c=async m=>{let g=await r.spaceManager.framesForSpace(n.path),A=Mi(m,g.map(x=>x.id)),b=S8[m],v={name:b.name,id:A,type:"view",def:{db:"files"},predicate:JSON.stringify({view:b.view,listView:b.listView,listGroup:b.listGroup,listItem:b.listItem})};r.spaceManager.saveFrameSchema(n.path,A,()=>Sp(v)).then(()=>i({...f0.node,props:{value:jr(`./#*${v.id}`)}}))},f=Object.keys(S8).map(m=>{let g=S8[m];return{name:g.name,value:g.view,onClick:()=>{c(m)},icon:g.icon}}),d=[mn,uf,C9,Xa,hn],p=[jv,O9,j9,M9,N9,T9,D9],h=[...u,{name:"List View",value:"frame",type:6,onSubmenu:m=>r.ui.openMenu(m,Ht(r.ui,f),t),icon:"ui//mk-make-list"},...d.map(m=>({name:m.node.name,onClick:()=>{l(m.node)},value:m.node.name,icon:m.def?.icon})),...p.map(m=>({name:m.node.name,value:"frame"+m.node.name,onClick:()=>{s(m.node,m.def.id)},icon:m.def?.icon}))];r.ui.openMenu(e,{ui:r.ui,multi:!1,editable:!1,value:[],options:h,searchable:a.searchable,showAll:!0},t)};var l6e=Ae(Te());var E8=e=>{let t=(r,n)=>{let i=o=>{e.setValue(o)},a=r.target.getBoundingClientRect();Gu(e.superstate,a,Ne(r.view.document),e.value,i)};return l6e.default.createElement("div",{className:"mk-color",style:{background:e.value},onClick:r=>{t(r,"--text-normal")}})};var Bo=Ae(Te());var u6e=Ae(yi()),so=Ae(Te());function Yet(e){if(Math.floor(e)===e)return 0;let t=e.toString();return t.split(".")[1].length||t.split(",")[1].length||0}function c6e({style:e={},modifiers:t={},onChange:r,onInput:n,...i}){let[a,o]=(0,so.useState)(i.value),[s,l]=(0,so.useState)(""),u=(0,so.useRef)(0),c=(0,so.useRef)(null),f=i.step?+i.step:1,d=(0,so.useMemo)(()=>({shiftKey:.1,...t}),[t]),[,p]=(0,so.useState)([0,0]),h={cursor:"ew-resize",...e},m=k=>{let j=k.target.value;isNaN(+j)||(o(+j),r?.(+j,c.current))},g=(0,u6e.debounce)(k=>{r?.(k,c.current)},200),A=(0,so.useCallback)(k=>{requestAnimationFrame(()=>{n?.(k,c.current)}),g(k)},[g,n]),b=(0,so.useCallback)(k=>{p(j=>{let{clientX:O,clientY:C}=k,[N,D]=j,P=N-O,q=D-C,z=1;s&&(z=d[s]||1);let I=f*z,T=Yet(I),L=Math.sqrt(P*P+q*q)*I;O{document.removeEventListener("mousemove",b),document.removeEventListener("mouseup",v)},[b]),x=(0,so.useCallback)(k=>{let j=+a;isNaN(j)&&(j=+(i.defaultValue||i.min||0)),u.current=j,p([k.clientX,k.clientY]),document.addEventListener("mousemove",b),document.addEventListener("mouseup",v)},[b,v,a,i.min,i.defaultValue]),w=k=>{k.metaKey?l("metaKey"):k.ctrlKey?l("ctrlKey"):k.altKey?l("altKey"):k.shiftKey&&l("shiftKey")},S=()=>{l("")};return(0,so.useEffect)(()=>{i.value!==a&&typeof i.value=="number"&&o(i.value)},[i.value]),(0,so.useEffect)(()=>(document.addEventListener("keydown",w),document.addEventListener("keyup",S),()=>{document.removeEventListener("mousemove",b),document.removeEventListener("mouseup",v),document.removeEventListener("keydown",w),document.removeEventListener("keyup",S)}),[]),so.default.createElement("input",{placeholder:"auto",type:"number",...i,value:a,style:h,onMouseDown:x,onChange:m,ref:c})}var va=e=>{let t=e.value&&Pu(e.value)?wa(e.value).match(/^(\d+(?:\.\d+)?)\s?([a-zA-Z%]+)$/):null,r=t?parseInt(t[1]):0,n=t&&t[2]?t[2]:e.units[0],i=a=>{let o=[];e.units.forEach(l=>{o.push({name:l,onClick:()=>{if(l=="%"){e.setValue(jr(`${100}${l}`));return}e.setValue(jr(`${r}${l}`))}})});let s=a.target.getBoundingClientRect();e.superstate.ui.openMenu(s,Ht(e.superstate.ui,o),Ne(a.view.document))};return so.default.createElement("div",{className:"mk-setter-step"},so.default.createElement("span",null,e.name),so.default.createElement(c6e,{min:e.min,max:e.max,value:r,onKeyDown:a=>{a.key=="Backspace"&&(a.currentTarget.value.length==1&&e.setValue(null),a.stopPropagation())},onChange:a=>{e.setValue(jr(`${a.toString()+n}`))}}),so.default.createElement("span",{onClick:a=>i(a)},n))};var ID=Ae(Te()),f6e=e=>{let t=["nw","n","ne","w","m","e","sw","s","se"],[r,n]=(0,ID.useState)(e.state?.styles?.layoutAlign);return ID.default.createElement("div",{className:"mk-editor-alignment-menu"},t.map(i=>ID.default.createElement("div",{className:`mk-editor-alignment-selector ${r==i&&"mk-active"}`,key:"d",onClick:()=>{n(i),e.saveStyleValue("layoutAlign",jr(i))}})))};var d6e=e=>{let{spaceInfo:t}=(0,Bo.useContext)(ur),{addNode:r}=(0,Bo.useContext)(Wi),{select:n}=(0,Bo.useContext)(Hi),{selectedNode:i,saveStyleValue:a}=e;return Bo.default.createElement(Bo.default.Fragment,null,Bo.default.createElement("div",{className:"mk-editor-frame-node-button-primary",dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//plus")},onClick:o=>{Z2(o.target.getBoundingClientRect(),Ne(o.view.document),e.superstate,t,s=>r(s,e.selectedNode,!0).then(l=>n(l.id))),o.stopPropagation()}}),Bo.default.createElement(Io,{icon:"ui//arrow-right",superstate:e.superstate,name:H.editor.rows,value:i.styles?.layout,setValue:o=>a("layout",o),onValue:"'row'",defaultValue:"'row'"}),Bo.default.createElement(Io,{icon:"ui//arrow-down",superstate:e.superstate,name:H.editor.columns,value:i.styles?.layout,setValue:o=>a("layout",o),onValue:"'column'",defaultValue:"'column'"}),Bo.default.createElement(Io,{icon:"ui//layout-dashboard",superstate:e.superstate,name:H.editor.gallery,value:i.styles?.layout,setValue:o=>a("layout",o),onValue:"'masonry'",defaultValue:"'masonry'"}),Bo.default.createElement("div",{className:"mk-divider"}),e.state.styles?.layout=="row"||e.state.styles?.layout=="column"?Bo.default.createElement(Bo.default.Fragment,null,Bo.default.createElement("div",{className:"mk-editor-frame-node-button",onClick:o=>{e.superstate.ui.openCustomMenu(o.target.getBoundingClientRect(),Bo.default.createElement(f6e,{...e}),{...e},Ne(o.view.document))},dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//grid")}}),Bo.default.createElement("div",{className:"mk-editor-frame-node-button",onClick:o=>{o.preventDefault(),o.stopPropagation(),a("flexWrap",`${wa(i.styles.flexWrap)=="wrap"?"":jr("wrap")}`)},dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//wrap-text")}}),Bo.default.createElement(va,{superstate:e.superstate,name:H.editor.gap,value:i.styles?.gap,setValue:o=>a("gap",o),units:["px"]})):Bo.default.createElement(Bo.default.Fragment,null,Bo.default.createElement(va,{superstate:e.superstate,name:H.editor.columns,value:i.styles?.columnCount,min:0,setValue:o=>a("columnCount",o),units:[""]})))};var hb=Ae(Te());var db=Ae(Te());var p6e=e=>{let{selectedNode:t,saveStyleValue:r}=e;return db.default.createElement(db.default.Fragment,null,db.default.createElement("div",{className:"mk-divider"}),db.default.createElement(va,{superstate:e.superstate,name:H.editor.width,min:0,value:t.styles?.width,setValue:n=>r("width",n),units:["px","%","em"]}),db.default.createElement("div",{className:"mk-divider"}),db.default.createElement(va,{superstate:e.superstate,name:H.editor.height,min:0,value:t.styles?.height,setValue:n=>r("height",n),units:["px","%","em"]}))};var gg=Ae(Te());var pb=Ae(Te());var m6e=e=>{let{selectedNode:t,saveStyleValue:r}=e;return pb.default.createElement(pb.default.Fragment,null,pb.default.createElement(va,{superstate:e.superstate,name:H.editor.marginLeft,value:t.styles?.marginLeft,setValue:n=>r("marginLeft",n),units:["px","em"]}),pb.default.createElement(va,{superstate:e.superstate,name:H.editor.marginTop,value:t.styles?.marginTop,setValue:n=>r("marginTop",n),units:["px","em"]}),pb.default.createElement(va,{superstate:e.superstate,name:H.editor.marginRight,value:t.styles?.marginRight,setValue:n=>r("marginRight",n),units:["px","em"]}),pb.default.createElement(va,{superstate:e.superstate,name:H.editor.marginBottom,value:t.styles?.marginBottom,setValue:n=>r("marginBottom",n),units:["px","em"]}))};var mb=Ae(Te());var h6e=e=>{let{selectedNode:t,saveStyleValue:r}=e;return mb.default.createElement(mb.default.Fragment,null,mb.default.createElement(va,{superstate:e.superstate,name:H.editor.paddingLeft,value:t.styles?.paddingLeft,setValue:n=>r("paddingLeft",n),units:["px","em"]}),mb.default.createElement(va,{superstate:e.superstate,name:H.editor.paddingTop,min:0,value:t.styles?.paddingTop,setValue:n=>r("paddingTop",n),units:["px","em"]}),mb.default.createElement(va,{superstate:e.superstate,name:H.editor.paddingRight,min:0,value:t.styles?.paddingRight,setValue:n=>r("paddingRight",n),units:["px","em"]}),mb.default.createElement(va,{superstate:e.superstate,name:H.editor.paddingBottom,min:0,value:t.styles?.paddingBottom,setValue:n=>r("paddingBottom",n),units:["px","em"]}))};var A6e=e=>{let{selectedNode:t,saveStyleValue:r}=e,n=a=>{let o=a.target.getBoundingClientRect();return e.superstate.ui.openCustomMenu(o,gg.default.createElement(h6e,{...e}),e,Ne(a.view.document))},i=a=>{let o=a.target.getBoundingClientRect();return e.superstate.ui.openCustomMenu(o,gg.default.createElement(m6e,{...e}),e,Ne(a.view.document))};return gg.default.createElement(gg.default.Fragment,null,gg.default.createElement(va,{superstate:e.superstate,name:H.editor.margin,value:t.styles?.margin,setValue:a=>r("margin",a),units:["px","em"]}),gg.default.createElement("div",{dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//plus")},onClick:a=>{i(a)}}),gg.default.createElement(va,{superstate:e.superstate,name:H.editor.padding,min:0,value:t.styles?.padding,setValue:a=>r("padding",a),units:["px","em"]}),gg.default.createElement("div",{dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//plus")},onClick:a=>{n(a)}}))};var g6e=e=>{let{selectedNode:t,saveStyleValue:r}=e,n=(i,a)=>{let o=a=="icon"?"iconSize":"imageSize",s=[];s.push({name:H.labels.styleSmall,icon:"type",onClick:()=>{r(o,"'s'")}}),s.push({name:H.labels.styleMedium,icon:"type",onClick:()=>{r(o,"'m'")}}),s.push({name:H.labels.styleLarge,icon:"type",onClick:()=>{r(o,"'l'")}});let l=i.target.getBoundingClientRect();e.superstate.ui.openMenu(l,Ht(e.superstate.ui,s),Ne(i.view.document))};return hb.default.createElement(hb.default.Fragment,null,hb.default.createElement("div",{className:"mk-divider"}),hb.default.createElement(A6e,{...e}),hb.default.createElement(p6e,{...e}),hb.default.createElement("div",{className:"mk-divider"}))};var k8=Ae(Te());var v6e=e=>{let{selectedNode:t,saveStyleValue:r}=e;return k8.default.createElement(k8.default.Fragment,null,k8.default.createElement(Io,{superstate:e.superstate,name:H.editor.minimize,value:t.styles?.["--mk-min-mode"],defaultValue:"false",onValue:"true",icon:"ui//panel-top-close",setValue:n=>r("--mk-min-mode",n)}))};var y6e=Ae(Ya());var Ro=Ae(Te());var b6e=e=>{let{selectedNode:t,pathState:r,savePropValue:n,frameProps:i,fields:a,frameProperties:o,instance:s}=e,l=(d,p)=>{d.preventDefault();let h=Pu(i?.[p.name]),m=[];h||(m.push({name:H.editor.unlinkProperty,icon:"ui//unplug",onClick:()=>{n(p.name,jr(e.state.props?.[p.name]))}}),m.push(Rt));let g=[p.type];g.push("fileprop"),(p.type=="image"||p.type=="link"||p.type=="context")&&(g.push("file"),g.push("link"),g.push("image"),g.push("context"));let A=v=>v=="$space"?H.editor.currentSpace:v;Object.keys(s.state.$contexts).forEach(v=>{Poe(e.superstate,v).forEach(x=>{v!=s.state.$contexts?.$context?._path&&x.primary=="true"||(g.includes(x.type)&&m.push({name:Vo(x,e.superstate),icon:Ii(x),description:A(v),onClick:()=>{n(p.name,`$contexts['${v}']['${x.name}']`)}}),(x.type=="link"||x.type=="image"||x.type=="file")&&(p.type=="icon"&&m.push({name:`${Vo(x,e.superstate)} Sticker`,icon:Ii(x),description:A(v),onClick:()=>{n(p.name,`$api.path.label($contexts['${v}']['${x.name}'])?.sticker`)}}),p.type=="text"&&m.push({name:H.editor.linkName.replace("${1}",Vo(x,e.superstate)),icon:Ii(x),description:A(v),onClick:()=>{n(p.name,`$api.path.label($contexts['${v}']['${x.name}'])?.name`)}}),p.type=="image"&&m.push({name:H.editor.linkThumbnail.replace("${1}",Vo(x,e.superstate)),icon:Ii(x),description:A(v),onClick:()=>{n(p.name,`$api.path.label($contexts['${v}']['${x.name}'])?.thumbnail`)}})))}),m.push(Rt)}),o.filter(v=>g.some(x=>x==v.type)).forEach(v=>{m.push({name:v.name,icon:Ii(v),onClick:()=>{n(p.name,`${v.schemaId}.props['${v.name}']`)}})}),m.push(Rt),o.filter(v=>v.type!=p.type).forEach(v=>{(v.type=="link"||v.type=="image"||v.type=="file")&&(p.type=="icon"&&m.push({name:H.editor.linkSticker.replace("${1}",Vo(v,e.superstate)),icon:Ii(v),onClick:()=>{n(p.name,`$api.path.label(${v.schemaId}.props['${v.name}'])?.sticker`)}}),p.type=="image"&&m.push({name:H.editor.linkThumbnail.replace("${1}",v.name),icon:Ii(v),onClick:()=>{n(p.name,`$api.path.label(${v.schemaId}.props['${v.name}'])?.thumbnail`)}})),p.type=="text"&&(v.type=="link"||v.type=="file")&&m.push({name:H.editor.linkName.replace("${1}",Vo(v,e.superstate)),icon:Ii(v),onClick:()=>{n(p.name,`$api.path.label(${v.schemaId}.props['${v.name}'])?.name`)}})});let b=d.target.getBoundingClientRect();e.superstate.ui.openMenu(b,Ht(e.superstate.ui,m),Ne(d.view.document),"bottom")},u=d=>o?.find(h=>h.name==Im(i?.[d])?.prop),c=(d,p)=>{if(!d||!p)return null;if(d.type.startsWith("object"))return rL(p);if(d.type=="option")return(pr(d.value,d.type,e.superstate,r.path).options??[]).find(g=>g.value==wa(p))?.name??null;if(d.type=="super"){let h=pr(d.value,d.type,e.superstate);if(h.dynamic?wa(i[h.field??""]):h.field)return p}return Pu(p)?wa(p):null},f=d=>d.type.startsWith("object")||d.type=="super";return Ro.default.createElement("div",{className:"mk-editor-frame-properties"},Ro.default.createElement("div",{className:"mk-editor-actions-name"},Ro.default.createElement("div",{className:"mk-editor-actions-name-icon"},Ro.default.createElement("div",{className:"mk-icon-small",dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//list")}})),Ro.default.createElement("div",{className:"mk-editor-actions-name-text"},H.buttons.editProperty),Ro.default.createElement("span",null),Ro.default.createElement("div",{className:"mk-icon-small mk-inline-button",dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//close")},onClick:()=>e.hide()})),Ro.default.createElement("div",{className:"mk-props-contexts"},a.map((d,p)=>{let h=d.type.startsWith("object")?JM(i?.[d.name],d.type):d.type=="super"||Pu(i?.[d.name]),m=f(d);return Ro.default.createElement(Ro.default.Fragment,{key:p},h?Ro.default.createElement(bs,{initialValue:c(d,i?.[d.name]),column:d,compactMode:!1,superstate:e.superstate,editMode:3,row:e.state?.props,updateValue:g=>{Rx(d)?n(d.name,g):n(d.name,jr(g))},linkProp:g=>l(g,d),source:r.path,columns:o}):Ro.default.createElement("div",{className:(0,y6e.default)("mk-path-context-row",m&&"mk-path-context-stacked")},d.type=="input"?Ro.default.createElement(v9,{initialValue:i?.[d.name],superstate:e.superstate,compactMode:!0,property:d,editMode:3,saveValue:g=>n(d.name,jr(g)),columns:o}):Ro.default.createElement(Ro.default.Fragment,null,Ro.default.createElement(JC,{path:r.path,superstate:e.superstate,property:d,draggable:!0}),Ro.default.createElement("div",{className:"mk-active"},Ro.default.createElement("div",{"aria-label":H.editor.linkedProperty},Mk(i?.[d.name])))),Ro.default.createElement("span",null),!m&&Ro.default.createElement("div",{"aria-label":H.editor.linkProperty,className:"mk-icon-small mk-inline-button",onClick:g=>l(g,d),dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//plug")}})))})))};var X2=Ae(Te());var Vv=Ae(Te());var x6e=e=>{let{selectedNode:t,saveStyleValue:r}=e,n=a=>{let o=[];o.push({name:H.editor.strokeNone,icon:"ui//type",onClick:()=>{r("outlineStyle","'none'")}}),o.push({name:H.editor.strokeSolid,icon:"ui//type",onClick:()=>{r("outlineStyle","'solid'")}}),o.push({name:H.editor.strokeDashed,icon:"ui//type",onClick:()=>{r("outlineStyle","'dashed'")}}),o.push({name:H.editor.strokeDotted,icon:"ui//type",onClick:()=>{r("outlineStyle","'dotted'")}});let s=a.target.getBoundingClientRect();e.superstate.ui.openMenu(s,Ht(e.superstate.ui,o),Ne(a.view.document))},i=(a,o)=>{let s=u=>{r(o,`'${u}'`)},l=a.target.getBoundingClientRect();Gu(e.superstate,l,Ne(a.view.document),wa(t.styles?.[o]),s)};return Vv.default.createElement(Vv.default.Fragment,null,Vv.default.createElement("div",{className:"mk-divider"}),Vv.default.createElement("div",{className:"mk-editor-frame-node-button",onClick:a=>n(a)},Vv.default.createElement("div",{dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//case-sensitive")}}),e.state.styles?.outlineStyle??H.labels.none),Vv.default.createElement(va,{superstate:e.superstate,name:H.editor.size,value:e.state.styles?.outlineWidth,setValue:a=>r("outlineWidth",a),units:["px","em"]}),Vv.default.createElement("div",{onClick:a=>{i(a,"outlineColor")},className:"mk-color",style:{background:e.state.styles?.outlineColor}}))};var w6e=e=>{let{selectedNode:t,saveStyleValue:r}=e,n=(i,a)=>{let o=l=>{r(a,`'${l}'`)},s=i.target.getBoundingClientRect();Gu(e.superstate,s,Ne(i.view.document),wa(e.selectedNode.styles?.[a]),o)};return X2.default.createElement(X2.default.Fragment,null,X2.default.createElement("div",{className:"mk-color",onClick:i=>n(i,"background"),style:{background:wa(e.selectedNode.styles?.background)}}),X2.default.createElement(x6e,{...e}),X2.default.createElement(va,{superstate:e.superstate,name:H.editor.opacity,min:0,max:100,value:t.styles?.opacity,setValue:i=>r("opacity",i),units:["%"]}))};function S6e(){let{fonts:e}=document,t=e.entries(),r=[],n=!1;for(;!n;){let i=t.next();i.done?n=i.done:r.push(i.value[0].family)}return Array.from(new Set(r))}var rl=Ae(Te());var E6e=e=>{let{selectedNode:t,saveStyleValue:r}=e,n=o=>{let s=S6e().map(l=>({name:l,value:l}));e.superstate.ui.openMenu(o.target.getBoundingClientRect(),{ui:e.superstate.ui,multi:!1,editable:!1,searchable:!0,saveOptions:(l,u)=>{r("--font-text",`'${u[0]}'`)},value:[t.styles?.["--font-text"]??""],options:s},Ne(o.view.document))},i=(o,s)=>{o.stopPropagation(),o.preventDefault(),r("textAlign",`'${s}'`)},a=(o,s)=>{let l=c=>{r(s,`'${c}'`)},u=o.target.getBoundingClientRect();Gu(e.superstate,u,Ne(o.view.document),wa(e.selectedNode.styles?.[s]),l)};return rl.default.createElement(rl.default.Fragment,null,rl.default.createElement("div",{className:"mk-editor-frame-node-button",onClick:o=>n(o)},rl.default.createElement("div",{dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//type")}}),t.styles?.["--font-text"]),rl.default.createElement("div",{className:"mk-divider"}),rl.default.createElement(va,{superstate:e.superstate,name:H.editor.size,value:t.styles?.["--font-text-size"],setValue:o=>r("--font-text-size",o),units:["px","em"]}),rl.default.createElement(Io,{superstate:e.superstate,name:H.editor.bold,value:t.styles?.["--font-text-weight"],defaultValue:"'normal'",onValue:"'bold'",icon:"ui//bold",setValue:o=>r("--font-text-weight",o)}),rl.default.createElement(Io,{superstate:e.superstate,name:H.editor.italic,value:t.styles?.["--font-text-style"],defaultValue:"'normal'",onValue:"'italic'",icon:"ui//italic",setValue:o=>r("--font-text-style",o)}),rl.default.createElement(Io,{superstate:e.superstate,name:H.editor.underline,value:t.styles?.["--font-text-decoration"],defaultValue:"'none'",onValue:"'underline'",icon:"ui//underline",setValue:o=>r("--font-text-decoration",o)}),rl.default.createElement(E8,{superstate:e.superstate,value:wa(t.styles?.["--font-text-color"]),setValue:o=>r("--font-text-color",`'${o}'`)}),rl.default.createElement("div",{className:"mk-divider"}),rl.default.createElement(Io,{superstate:e.superstate,name:H.editor.alignLeft,value:t.styles?.textAlign,defaultValue:"'left'",onValue:"'left'",icon:"ui//align-left",setValue:o=>r("textAlign",o)}),rl.default.createElement(Io,{superstate:e.superstate,name:H.editor.alignCenter,value:t.styles?.textAlign,defaultValue:"'center'",onValue:"'center'",icon:"ui//align-center",setValue:o=>r("textAlign",o)}),rl.default.createElement(Io,{superstate:e.superstate,name:H.editor.alignRight,value:t.styles?.textAlign,defaultValue:"'left'",onValue:"'right'",icon:"ui//align-right",setValue:o=>r("textAlign",o)}),rl.default.createElement(Io,{superstate:e.superstate,name:H.editor.alignJustify,value:t.styles?.textAlign,defaultValue:"'left'",onValue:"'justify'",icon:"ui//align-justify",setValue:o=>r("textAlign",o)}),rl.default.createElement("div",{className:"mk-divider"}),rl.default.createElement(va,{superstate:e.superstate,name:H.editor.numberOfLines,value:t.styles?.["--line-count"],setValue:o=>r("--line-count",o),units:[""]}))};var k6e=e=>{let{pathState:t}=(0,ir.useContext)($r),{deleteFrame:r,duplicateFrame:n}=e,{spaceInfo:i}=(0,ir.useContext)(ur),{addNode:a,ungroupNode:o,updateNode:s,saveNodes:l,frameProperties:u}=(0,ir.useContext)(Wi),{selectionMode:c}=(0,ir.useContext)(Hi),{instance:f}=(0,ir.useContext)(_i),d=(0,ir.useCallback)((C,N)=>{s(N,{props:{...C}})},[s]),p=(C,N)=>{s(e.node,{styles:{[C]:N}})},[h,m]=(0,ir.useState)(0),[g,A]=(0,ir.useState)(e.node.props),b=(0,ir.useMemo)(()=>Object.keys(e.node.types).map(C=>({type:e.node.types[C],name:C,attrs:e.node.propsAttrs?.[C],schemaId:e.node.schemaId,value:e.node.propsValue?.[C]})),[e.node]);(0,ir.useEffect)(()=>{A(e.node.props)},[e.node]);let v=(0,ir.useCallback)((C,N)=>{A(D=>({...D,[C]:N})),d({[C]:N},e.node)},[A,d,e.node]),x=[{type:"h1",name:H.commands.h1,icon:"ui//heading-1",class:"mk-t-h1"},{type:"h2",name:H.commands.h2,icon:"ui//heading-2",class:"mk-t-h2"},{type:"h3",name:H.commands.h3,icon:"ui//heading-3",class:"mk-t-h3"},{type:"h4",name:H.commands.h4,icon:"ui//heading-4",class:"mk-t-h4"},{type:"h5",name:H.commands.h5,icon:"ui//heading-5",class:"mk-t-h5"},{type:"h6",name:H.commands.h6,icon:"ui//heading-6",class:"mk-t-h6"},{type:"p",name:H.commands.paragraph,icon:"ui//type",class:"mk-t-p"}],w=C=>{let N=[];x.forEach(P=>{N.push({name:P.name,icon:P.icon,onClick:()=>{p("class",`'${P.class}'`)}})});let D=C.target.getBoundingClientRect();e.superstate.ui.openMenu(D,Ht(e.superstate.ui,N),Ne(C.view.document))},S=(0,ir.useRef)(null),k={superstate:e.superstate,exitMenu:()=>m(0),saveStyleValue:p,savePropValue:v,frameProps:g,selectedNode:e.node,setHoverMenu:m,fields:b,state:e.state},j={...k,pathState:t,frameProperties:u,instance:f};(0,ir.useEffect)(()=>{S.current&&S.current.update(j)},[f,b,e.state,e.node,g]);let O=(0,ir.useRef)(null);return ir.default.createElement("div",{className:"mk-editor-frame-node-selector",style:{pointerEvents:"auto"},ref:O,onClick:C=>{C.preventDefault()}},e.node.type=="new"&&ir.default.createElement(ir.default.Fragment,null,ir.default.createElement("div",{className:"mk-editor-frame-node-button-primary",dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//plus")},onClick:C=>{Z2(C.target.getBoundingClientRect(),Ne(C.view.document),e.superstate,i,N=>l([{...N,id:e.node.id,parentId:e.node.parentId,schemaId:e.node.schemaId,rank:e.node.rank,props:{...N.props,value:e.node.props?.value}}])),C.stopPropagation()}}),ir.default.createElement("div",{className:"mk-editor-frame-node-button-primary",dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//plus")},onClick:C=>{let N=e.superstate.spacesIndex.get(i.path);N&&za(e.superstate,N,"md",e.state?.props?.value,!0).then(D=>l([{...e.node,type:Mo.node.type,props:{...e.node.props,value:jr(D)}}])),C.stopPropagation()}})),h==0?ir.default.createElement(ir.default.Fragment,null,e.node.type=="group"||e.node.type=="content"?ir.default.createElement(d6e,{...k}):b.length>0&&ir.default.createElement("div",{"aria-label":"Properties",className:"mk-editor-frame-node-button",onClick:C=>{if(S.current){S.current.hide(),S.current=null;return}C.preventDefault(),S.current=e.superstate.ui.openCustomMenu(O.current.getBoundingClientRect(),ir.default.createElement(b6e,{...j}),j,Ne(C.view.document),"bottom")},dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//list")}}),e.node.type=="text"&&ir.default.createElement(ir.default.Fragment,null,ir.default.createElement("div",{className:"mk-editor-frame-node-button",onClick:C=>w(C)},ir.default.createElement("div",{dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker(x.find(C=>C.class==wa(e.node.styles?.class))?.icon??"ui//type")}}),x.find(C=>C.class==wa(e.node.styles?.class))?.name??"Paragraph"),ir.default.createElement("div",{className:"mk-divider"})),e.node.type=="icon"&&ir.default.createElement(E8,{superstate:e.superstate,value:wa(e.node.styles?.color),setValue:C=>p("color",`'${C}'`)}),ir.default.createElement("div",{"aria-label":"Layout",className:"mk-editor-frame-node-button",onClick:C=>{C.preventDefault(),C.stopPropagation(),e.editLayout(!0),m(4)},dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//scaling")}}),ir.default.createElement("div",{"aria-label":"Style",className:"mk-editor-frame-node-button",onClick:C=>{C.preventDefault(),C.stopPropagation(),m(5)},dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//paintbrush")}}),(e.node.type=="flow"||e.node.type=="space")&&ir.default.createElement(v6e,{...k}),ir.default.createElement("div",{"aria-label":"Text Style",className:"mk-editor-frame-node-button",onClick:C=>{C.preventDefault(),C.stopPropagation(),m(3)},dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//type")}}),c==1&&ir.default.createElement(ir.default.Fragment,null,ir.default.createElement("div",{className:"mk-divider"}),ir.default.createElement(Io,{superstate:e.superstate,name:"Page Width",setValue:C=>{p("--max-width",C)},defaultValue:"",onValue:jr("100%"),value:e.node.styles?.["--max-width"],icon:"ui//full-width"})),ir.default.createElement("div",{className:"mk-divider"}),e.node.type=="group"||e.node.type=="container"?ir.default.createElement("div",{"aria-label":"Ungroup",className:"mk-editor-frame-node-button",onClick:()=>o(e.node),dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//copy-x")}}):ir.default.createElement(ir.default.Fragment,null),ir.default.createElement("div",{className:"mk-editor-frame-node-button","aria-label":"Delete",onClick:()=>r(),dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//trash")}})):ir.default.createElement(ir.default.Fragment,null,ir.default.createElement("div",{className:"mk-editor-frame-node-button",onMouseDown:C=>{C.stopPropagation(),e.editLayout(!1),m(0)},dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//close")}}),ir.default.createElement("div",{className:"mk-editor-frame-node-divider"}),h==3?ir.default.createElement(E6e,{...k}):h==4?ir.default.createElement(g6e,{...k}):h==5?ir.default.createElement(w6e,{...k}):ir.default.createElement(ir.default.Fragment,null)))};var Ph=Ae(Te()),C6e=e=>{let{spaceInfo:t}=(0,Ph.useContext)(ur),{addNode:r,moveUp:n,moveDown:i,setLastCreatedId:a}=(0,Ph.useContext)(Wi),{select:o,selection:s}=(0,Ph.useContext)(Hi),l=s.includes(e.node.id);return Ph.default.createElement(Ph.default.Fragment,null,Ph.default.createElement("div",{className:"mk-editor-frame-hover-horizontal",style:{pointerEvents:"auto",opacity:e.visible?"1":"0"}},e.dragRef&&Ph.default.createElement("div",{className:"mk-icon-small mk-editor-frame-hover-button",dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//handle")},style:{cursor:"grab"},ref:e.dragRef,onClick:u=>{if(u.stopPropagation(),s.length==1&&l){o(null);return}u.shiftKey?o(e.node.id,!0):o(e.node.id)},...e.listeners??{},...e.attributes??{}}),!Gr(e.superstate.ui)&&Ph.default.createElement("div",{onClick:u=>{Z2(u.target.getBoundingClientRect(),window,e.superstate,t,c=>r(c,e.node).then(f=>o(f.id))),u.stopPropagation()},className:"mk-icon-small mk-editor-frame-hover-button",dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//plus")}})))};var vg=Ae(Te()),CZ=e=>{let t=(0,vg.useRef)(null),[r,n]=(0,vg.useState)(0),i=(s,l,u)=>{let c=s.x-e.containerRect.x,f=c+l.width-u.width,d=c;return f>0&&(s.x-e.containerRect.x-l.width>0?d=u.width-l.width:d=0),d},[a,o]=(0,vg.useState)(!1);return(0,vg.useEffect)(()=>{let s=new ResizeObserver(l=>{let u=l[0].target.getBoundingClientRect();o(!0),n(i(e.nodeRect,u,e.containerRect))});return t.current&&s.observe(t.current),()=>{s.disconnect()}},[t]),vg.default.createElement("div",{className:"mk-editor-frame-node-container",ref:t,style:{visibility:a?"visible":"hidden",pointerEvents:"auto",left:r,bottom:`calc(100% - ${e.nodeRect.y-e.containerRect.y-10}px)`,maxWidth:e.containerRect.width},onClick:s=>{s.preventDefault(),s.stopPropagation()}},e.children)};var D6e=Ae(Ya()),qc=Ae(Te());var Xu=Ae(Te()),nl=e=>{let[t,r]=(0,Xu.useState)(null),n=(0,Xu.useRef)(e.value),i=(0,Xu.useRef)(e.value),[,a]=(0,Xu.useState)([0,0]),o=e.step??1,s=(0,Xu.useCallback)(d=>{a(p=>{let{clientX:h,clientY:m}=d,[g,A]=p,b=e.reverseX?g-h:h-g,v=e.reverseY?m-A:A-m,x=e.mod??1,w=o*x,S=Math.sqrt((b+v)/2*(b+v)/2)*w;b+v<0&&(S=-S),e.disableX&&(S=v*w),e.disableY&&(S=b*w);let k=n.current+S;return k=e.min!=null?Math.max(k,e.min):k,k=e.max!=null?Math.min(k,e.max):k,i.current=k,e.onDragMove(k,{ctrlKey:d.ctrlKey,metaKey:d.metaKey,altKey:d.altKey,shiftKey:d.shiftKey}),p}),d.stopPropagation()},[t,e.max,e.min,o,e.onDragMove,e.mod]),l=(0,Xu.useCallback)(d=>{let p=h=>{h.stopPropagation(),window.removeEventListener("click",p,!0)};window.addEventListener("click",p,!0),document.removeEventListener("mousemove",s),document.removeEventListener("mouseup",l),e.onDragEnd(i.current,{ctrlKey:d.ctrlKey,metaKey:d.metaKey,altKey:d.altKey,shiftKey:d.shiftKey}),d.preventDefault(),d.stopPropagation()},[s,e.onDragEnd]),u=(0,Xu.useCallback)(d=>{n.current=e.value,a([d.clientX,d.clientY]),document.addEventListener("mousemove",s),document.addEventListener("mouseup",l),d.stopPropagation()},[s,l,e.value]),c=d=>{d.metaKey?r("metaKey"):d.ctrlKey?r("ctrlKey"):d.altKey?r("altKey"):d.shiftKey&&r("shiftKey")},f=()=>{r(null)};return(0,Xu.useEffect)(()=>(document.addEventListener("keydown",c),document.addEventListener("keyup",f),()=>{document.removeEventListener("mousemove",s),document.removeEventListener("mouseup",l),document.removeEventListener("keydown",c),document.removeEventListener("keyup",f)}),[]),Xu.default.createElement("div",{className:"mk-frame-draggable-handle",onMouseDown:u,"data-placeholder":i.current.toString(),style:{cursor:e.cursor,width:"100%",height:"100%",pointerEvents:"auto"}},Xu.default.createElement("span",null))};var O6e=e=>{let t=e.styles.borderRadius?e.styles.borderRadius.match(/^(\d+(?:\.\d+)?)\s?([a-zA-Z%]+)$/):null,r=t?parseInt(t[1]):0,n=t&&t[2]?t[2]:"px",[i,a]=qc.default.useState(Math.max(8,r));(0,qc.useEffect)(()=>{a(r)},[r]);let o={min:0,max:Math.min(e.clientSize.height/2,e.clientSize.width/2),value:i,onDragMove:l=>{a(l)},onDragEnd:l=>{e.saveStyles({borderRadius:`"${l}${n}"`})}},s=Math.max(8,i);return qc.default.createElement("div",{style:{position:"absolute",top:0,left:0,width:e.clientSize.width,height:e.clientSize.height,display:"flex",zIndex:200,borderRadius:i,border:"1px solid var(--mk-ui-border-accent)"}},qc.default.createElement("div",{className:(0,D6e.default)("mk-frame-corners")},qc.default.createElement("div",{className:"mk-frame-corner",style:{position:"absolute",transform:`translate(${s}px, ${s}px)`,zIndex:"var(--mk-layer-editor-overlay)"}},qc.default.createElement(nl,{...o,cursor:"nwse-resize",reverseY:!0})),qc.default.createElement("div",{className:"mk-frame-corner",style:{position:"absolute",transform:`translate(${e.clientSize.width-s}px, ${s}px)`,zIndex:"var(--mk-layer-editor-overlay)"}},qc.default.createElement(nl,{...o,cursor:"nesw-resize",reverseX:!0,reverseY:!0})),qc.default.createElement("div",{className:"mk-frame-corner",style:{position:"absolute",transform:`translate(${s}px, ${e.clientSize.height-s}px)`,zIndex:"var(--mk-layer-editor-overlay)"}},qc.default.createElement(nl,{...o,cursor:"nesw-resize"})),qc.default.createElement("div",{className:"mk-frame-corner",style:{position:"absolute",transform:`translate(${e.clientSize.width-s}px, ${e.clientSize.height-s}px)`,zIndex:"var(--mk-layer-editor-overlay)"}},qc.default.createElement(nl,{...o,reverseX:!0,cursor:"nwse-resize"}))))};var M6e=Ae(Ya());var yg=Ae(Te());var Zet=e=>{let{instance:t,id:r}=(0,yg.useContext)(_i),{spaceInfo:n}=(0,yg.useContext)(ur),{setNodeRef:i}=zu({id:e.id+e.direction,data:{id:e.id+e.direction,direction:e.direction,type:"node",parent:e.parentId,root:r,frame:e.schemaID,space:n.path,node:e.node}}),a=20,o=e.direction=="left"?-a:e.direction=="right"?e.width:0,s=e.direction=="bottom"?e.insertMode!=0?e.height:e.height/2:e.direction=="top"&&e.insertMode!=0?-a:0,l=e.direction=="left"||e.direction=="right"?a:e.width,u=e.direction=="top"||e.direction=="bottom"?e.insertMode!=0?a:e.height/2:e.height,c=e.insertMode!=0?e.direction=="top"?"bottom":e.direction=="bottom"?"top":e.direction:e.direction;return yg.default.createElement("div",{ref:i,className:(0,M6e.default)(e.active?`mk-indicator-${c}`:"","mk-frame-drop-zone"),style:{left:o,top:s,width:l,height:u}})},j6e=e=>{let{frameSchema:t}=(0,yg.useContext)(ma),{hoverNode:r}=(0,yg.useContext)(_i),n=[...e.mode==1?["top","bottom","left","right"]:e.mode==2?["top","bottom"]:e.mode==3?["left","right"]:[],...e.insertMode==1?["inside"]:[]];return yg.default.createElement("div",{className:"mk-frame-drop-zone-container",style:{width:e.width,height:e.height}},n.map(i=>yg.default.createElement(Zet,{...e,key:i,active:r?.node==e.node&&r?.direction==i,direction:i,mode:e.mode,schemaID:t.id})))};var ya=Ae(Te());var Xet=(e,t,r,n)=>{let i={},a=0,o=0,s=r?"width":"height",l=r?"height":"width";return e.forEach((u,c,f)=>{c==0?(i[a]={start:c,end:c,maxValue:u[l],items:[{...u,row:a}]},o=u[s]):f[c][s]+n>t[s]?(a++,i[a]={start:c,end:c,maxValue:u[l],items:[{...u,row:a}]}):f[c][s]+n+o>t[s]?(a++,i[a]={start:c,end:c,maxValue:u[l],items:[{...u,row:a}]},o=u[s]):i[a]?(i[a]={start:i[a].start,end:c,maxValue:Math.max(i[a].maxValue,u[l]),items:[...i[a].items,{...u,row:a}]},o+=u[s]+n):console.log("Warning: Flexbox found orphan row")}),i},N6e=e=>{let t=l=>{let u=l?l.match(/^(\d+(?:\.\d+)?)\s?([a-zA-Z%]+)$/):null;return u?parseInt(u[1]):0},[r,n]=ya.default.useState({row:t(e.styles.rowGap),column:t(e.styles.columnGap)});(0,ya.useEffect)(()=>{n({row:t(e.styles.rowGap),column:t(e.styles.columnGap)})},[e.styles]);let i={value:r[e.direction],onDragMove:l=>{n({...r,[e.direction=="column"?"row":"column"]:l})},onDragEnd:l=>{e.saveStyles(e.direction=="column"?{rowGap:`"${l}px"`}:{columnGap:`"${l}px"`})}},a={value:r[e.direction=="column"?"row":"column"],onDragMove:l=>{n({...r,[e.direction]:l})},onDragEnd:l=>{e.saveStyles(e.direction=="column"?{columnGap:`"${l}px"`}:{rowGap:`"${l}px"`})}},o=(0,ya.useMemo)(()=>Xet(e.childSizes,{width:e.clientSize.width-e.clientSize.paddingLeft-e.clientSize.paddingRight,height:e.clientSize.height-e.clientSize.paddingTop-e.clientSize.paddingBottom},e.direction=="row",r[e.direction=="column"?"row":"column"]),[e.childSizes,e.clientSize,e.direction,r]),s=(0,ya.useMemo)(()=>{let l=[];return Object.keys(o).forEach(u=>{l.push(...o[u].items)}),l},[o]);return ya.default.createElement("div",{className:`mk-frame-gaps ${G2(e.styles)}`,style:{position:"absolute",top:0,left:0,width:e.clientSize.width,height:e.clientSize.height,padding:e.clientSize.paddingTop,paddingLeft:e.clientSize.paddingLeft,paddingBottom:e.clientSize.paddingBottom,paddingRight:e.clientSize.paddingRight,flexWrap:e.styles.flexWrap}},e.direction==="row"?s.map((l,u,c)=>ya.default.createElement(ya.default.Fragment,null,ya.default.createElement("div",{style:{width:l.width,height:l.height}}),u==c.length-1?ya.default.createElement(ya.default.Fragment,null):o[l.row].end==u?ya.default.createElement("div",{key:u,className:"mk-frame-gap-handle-h",style:{width:"100%",height:Math.max(8,Math.abs(r.row)),zIndex:"var(--mk-layer-editor-overlay)"}},ya.default.createElement(nl,{...a,cursor:"col-resize",disableX:!0,reverseY:!0})):ya.default.createElement("div",{key:u,className:"mk-frame-gap-handle-v",style:{width:Math.max(8,Math.abs(r.column)),height:o[l.row].maxValue,zIndex:"var(--mk-layer-editor-overlay)"}},ya.default.createElement(nl,{...i,cursor:"col-resize",disableY:!0})))):s.map((l,u,c)=>ya.default.createElement(ya.default.Fragment,null,ya.default.createElement("div",{style:{width:l.width,height:l.height}}),u==c.length-1?ya.default.createElement(ya.default.Fragment,null):o[l.row].end==u?ya.default.createElement("div",{key:u,className:"mk-frame-gap-handle-v",style:{height:"100%",width:Math.max(8,Math.abs(r.column)),zIndex:"var(--mk-layer-editor-overlay)"}},ya.default.createElement(nl,{...a,cursor:"col-resize",disableX:!0,reverseY:!0})):ya.default.createElement("div",{key:u,className:"mk-frame-gap-handle-h",style:{height:Math.max(8,Math.abs(r.row)),width:o[l.row].maxValue,zIndex:"var(--mk-layer-editor-overlay)"}},ya.default.createElement(nl,{...i,cursor:"row-resize",disableX:!0,reverseY:!0})))))};var T6e=Ae(Ya()),vu=Ae(Te());var F6e=e=>{let t=["padding","paddingTop","paddingBottom","paddingLeft","paddingRight"],[r,n]=vu.default.useState({padding:0,paddingTop:null,paddingBottom:null,paddingLeft:null,paddingRight:null}),i="px";(0,vu.useEffect)(()=>{let f=d=>{if(!e.styles[d])return null;let p=e.styles[d]?e.styles[d].match(/^(\d+(?:\.\d+)?)\s?([a-zA-Z%]+)$/):null;return Math.max(p?parseInt(p[1]):0,8)};n(d=>t.reduce((p,h)=>({...p,[h]:f(h)}),d))},[e.styles]);let[a,o]=vu.default.useState(!1),s={min:0,mod:2},l=f=>Math.max(5,r[f]??r.padding),u=(f,d,p)=>{n(h=>p.shiftKey?{padding:d,paddingBottom:null,paddingTop:null,paddingLeft:null,paddingRight:null}:{...h,[f]:d})},c=(f,d,p)=>{e.saveStyles(p.shiftKey?{padding:`'${d}${i}'`,paddingBottom:"",paddingTop:"",paddingLeft:"",paddingRight:""}:{[f]:`'${d}${i}'`})};return(0,vu.useEffect)(()=>{let f=p=>{p.key==="Shift"&&o(!0)},d=p=>{p.key==="Shift"&&o(!1)};return window.addEventListener("keydown",f),window.addEventListener("keyup",d),()=>{window.removeEventListener("keydown",f),window.removeEventListener("keyup",d)}},[]),vu.default.createElement("div",{style:{position:"absolute",top:0,left:0,width:e.clientSize.width,height:e.clientSize.height,display:"flex",zIndex:200,border:"1px solid var(--mk-ui-color-border-accent)"}},vu.default.createElement("div",{className:(0,T6e.default)("mk-frame-paddings",a&&"mk-modifier-shift")},vu.default.createElement("div",{className:"mk-frame-padding-handle-h",style:{position:"absolute",transform:`translate(${0}px, ${0}px)`,height:l("paddingTop"),zIndex:"var(--mk-layer-editor-overlay)"}},vu.default.createElement(nl,{...s,value:r.paddingTop??r.padding,cursor:"s-resize",max:e.clientSize.height,onDragMove:(f,d)=>{u("paddingTop",f,d)},onDragEnd:(f,d)=>{c("paddingTop",f,d)},reverseY:!0,disableX:!0})),vu.default.createElement("div",{className:"mk-frame-padding-handle-v",style:{position:"absolute",transform:`translate(${e.clientSize.width-l("paddingRight")}px, ${0}px)`,width:l("paddingRight"),zIndex:"var(--mk-layer-editor-overlay)"}},vu.default.createElement(nl,{...s,value:r.paddingRight??r.padding,cursor:"w-resize",onDragMove:(f,d)=>{u("paddingRight",f,d)},max:e.clientSize.width,onDragEnd:(f,d)=>{c("paddingRight",f,d)},reverseX:!0,reverseY:!0,disableY:!0})),vu.default.createElement("div",{className:"mk-frame-padding-handle-v",style:{position:"absolute",transform:`translate(${0}px, ${0}px)`,width:l("paddingLeft"),zIndex:"var(--mk-layer-editor-overlay)"}},vu.default.createElement(nl,{...s,value:r.paddingLeft??r.padding,cursor:"e-resize",max:e.clientSize.width,onDragMove:(f,d)=>{u("paddingLeft",f,d)},onDragEnd:(f,d)=>{c("paddingLeft",f,d)},disableY:!0})),vu.default.createElement("div",{className:"mk-frame-padding-handle-h",style:{position:"absolute",transform:`translate(${0}px, ${e.clientSize.height-l("paddingBottom")}px)`,height:l("paddingBottom"),zIndex:"var(--mk-layer-editor-overlay)"}},vu.default.createElement(nl,{...s,value:r.paddingBottom??r.padding,cursor:"n-resize",max:e.clientSize.height,onDragMove:(f,d)=>{u("paddingBottom",f,d)},onDragEnd:(f,d)=>{c("paddingBottom",f,d)},reverseX:!0,disableX:!0}))))};var z6e=Ae(Ya());var Ab=Ae(Te()),q6e=Ae(bl());var D8=Ae(Te()),Ket=function(){var e=function(t,r){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var a in i)Object.prototype.hasOwnProperty.call(i,a)&&(n[a]=i[a])},e(t,r)};return function(t,r){e(t,r);function n(){this.constructor=t}t.prototype=r===null?Object.create(r):(n.prototype=r.prototype,new n)}}(),Jo=function(){return Jo=Object.assign||function(e){for(var t,r=1,n=arguments.length;r"u"?void 0:Number(n),maxHeight:typeof i>"u"?void 0:Number(i),minWidth:typeof a>"u"?void 0:Number(a),minHeight:typeof o>"u"?void 0:Number(o)}},itt=["as","style","className","grid","snap","bounds","boundsByDirection","size","defaultSize","minWidth","minHeight","maxWidth","maxHeight","lockAspectRatio","lockAspectRatioExtraWidth","lockAspectRatioExtraHeight","enable","handleStyles","handleClasses","handleWrapperStyle","handleWrapperClass","children","onResizeStart","onResize","onResizeStop","handleComponent","scale","resizeRatio","snapGap"],$6e="__resizable_base__",L6e=function(e){ett(t,e);function t(r){var n=e.call(this,r)||this;return n.ratio=1,n.resizable=null,n.parentLeft=0,n.parentTop=0,n.resizableLeft=0,n.resizableRight=0,n.resizableTop=0,n.resizableBottom=0,n.targetLeft=0,n.targetTop=0,n.appendBase=function(){if(!n.resizable||!n.window)return null;var i=n.parentNode;if(!i)return null;var a=n.window.document.createElement("div");return a.style.width="100%",a.style.height="100%",a.style.position="absolute",a.style.transform="scale(0, 0)",a.style.left="0",a.style.flex="0 0 100%",a.classList?a.classList.add($6e):a.className+=$6e,i.appendChild(a),a},n.removeBase=function(i){var a=n.parentNode;!a||a.removeChild(i)},n.ref=function(i){i&&(n.resizable=i)},n.state={isResizing:!1,width:typeof(n.propsSize&&n.propsSize.width)>"u"?"auto":n.propsSize&&n.propsSize.width,height:typeof(n.propsSize&&n.propsSize.height)>"u"?"auto":n.propsSize&&n.propsSize.height,direction:"right",original:{x:0,y:0,width:0,height:0},backgroundStyle:{height:"100%",width:"100%",backgroundColor:"rgba(0,0,0,0)",cursor:"auto",opacity:0,position:"fixed",zIndex:9999,top:"0",left:"0",bottom:"0",right:"0"},flexBasis:void 0},n.onResizeStart=n.onResizeStart.bind(n),n.onMouseMove=n.onMouseMove.bind(n),n.onMouseUp=n.onMouseUp.bind(n),n}return Object.defineProperty(t.prototype,"parentNode",{get:function(){return this.resizable?this.resizable.parentNode:null},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"window",{get:function(){return!this.resizable||!this.resizable.ownerDocument?null:this.resizable.ownerDocument.defaultView},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"propsSize",{get:function(){return this.props.size||this.props.defaultSize||ttt},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"size",{get:function(){var r=0,n=0;if(this.resizable&&this.window){var i=this.resizable.offsetWidth,a=this.resizable.offsetHeight,o=this.resizable.style.position;o!=="relative"&&(this.resizable.style.position="relative"),r=this.resizable.style.width!=="auto"?this.resizable.offsetWidth:i,n=this.resizable.style.height!=="auto"?this.resizable.offsetHeight:a,this.resizable.style.position=o}return{width:r,height:n}},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"sizeStyle",{get:function(){var r=this,n=this.props.size,i=function(s){if(typeof r.state[s]>"u"||r.state[s]==="auto")return"auto";if(r.propsSize&&r.propsSize[s]&&r.propsSize[s].toString().endsWith("%")){if(r.state[s].toString().endsWith("%"))return r.state[s].toString();var l=r.getParentSize(),u=Number(r.state[s].toString().replace("px","")),c=u/l[s]*100;return c+"%"}return DZ(r.state[s])},a=n&&typeof n.width<"u"&&!this.state.isResizing?DZ(n.width):i("width"),o=n&&typeof n.height<"u"&&!this.state.isResizing?DZ(n.height):i("height");return{width:a,height:o}},enumerable:!1,configurable:!0}),t.prototype.getParentSize=function(){if(!this.parentNode)return this.window?{width:this.window.innerWidth,height:this.window.innerHeight}:{width:0,height:0};var r=this.appendBase();if(!r)return{width:0,height:0};var n=!1,i=this.parentNode.style.flexWrap;i!=="wrap"&&(n=!0,this.parentNode.style.flexWrap="wrap"),r.style.position="relative",r.style.minWidth="100%",r.style.minHeight="100%";var a={width:r.offsetWidth,height:r.offsetHeight};return n&&(this.parentNode.style.flexWrap=i),this.removeBase(r),a},t.prototype.bindEvents=function(){this.window&&(this.window.addEventListener("mouseup",this.onMouseUp),this.window.addEventListener("mousemove",this.onMouseMove),this.window.addEventListener("mouseleave",this.onMouseUp),this.window.addEventListener("touchmove",this.onMouseMove,{capture:!0,passive:!1}),this.window.addEventListener("touchend",this.onMouseUp))},t.prototype.unbindEvents=function(){this.window&&(this.window.removeEventListener("mouseup",this.onMouseUp),this.window.removeEventListener("mousemove",this.onMouseMove),this.window.removeEventListener("mouseleave",this.onMouseUp),this.window.removeEventListener("touchmove",this.onMouseMove,!0),this.window.removeEventListener("touchend",this.onMouseUp))},t.prototype.componentDidMount=function(){if(!(!this.resizable||!this.window)){var r=this.window.getComputedStyle(this.resizable);this.setState({width:this.state.width||this.size.width,height:this.state.height||this.size.height,flexBasis:r.flexBasis!=="auto"?r.flexBasis:void 0})}},t.prototype.componentWillUnmount=function(){this.window&&this.unbindEvents()},t.prototype.createSizeForCssProperty=function(r,n){var i=this.propsSize&&this.propsSize[n];return this.state[n]==="auto"&&this.state.original[n]===r&&(typeof i>"u"||i==="auto")?"auto":r},t.prototype.calculateNewMaxFromBoundary=function(r,n){var i=this.props.boundsByDirection,a=this.state.direction,o=i&&K2("left",a),s=i&&K2("top",a),l,u;if(this.props.bounds==="parent"){var c=this.parentNode;c&&(l=o?this.resizableRight-this.parentLeft:c.offsetWidth+(this.parentLeft-this.resizableLeft),u=s?this.resizableBottom-this.parentTop:c.offsetHeight+(this.parentTop-this.resizableTop))}else this.props.bounds==="window"?this.window&&(l=o?this.resizableRight:this.window.innerWidth-this.resizableLeft,u=s?this.resizableBottom:this.window.innerHeight-this.resizableTop):this.props.bounds&&(l=o?this.resizableRight-this.targetLeft:this.props.bounds.offsetWidth+(this.targetLeft-this.resizableLeft),u=s?this.resizableBottom-this.targetTop:this.props.bounds.offsetHeight+(this.targetTop-this.resizableTop));return l&&Number.isFinite(l)&&(r=r&&r"u"?10:a.width,f=typeof i.width>"u"||i.width<0?r:i.width,d=typeof a.height>"u"?10:a.height,p=typeof i.height>"u"||i.height<0?n:i.height,h=l||0,m=u||0;if(s){var g=(d-h)*this.ratio+m,A=(p-h)*this.ratio+m,b=(c-m)/this.ratio+h,v=(f-m)/this.ratio+h,x=Math.max(c,g),w=Math.min(f,A),S=Math.max(d,b),k=Math.min(p,v);r=O8(r,x,w),n=O8(n,S,k)}else r=O8(r,c,f),n=O8(n,d,p);return{newWidth:r,newHeight:n}},t.prototype.setBoundingClientRect=function(){if(this.props.bounds==="parent"){var r=this.parentNode;if(r){var n=r.getBoundingClientRect();this.parentLeft=n.left,this.parentTop=n.top}}if(this.props.bounds&&typeof this.props.bounds!="string"){var i=this.props.bounds.getBoundingClientRect();this.targetLeft=i.left,this.targetTop=i.top}if(this.resizable){var a=this.resizable.getBoundingClientRect(),o=a.left,s=a.top,l=a.right,u=a.bottom;this.resizableLeft=o,this.resizableRight=l,this.resizableTop=s,this.resizableBottom=u}},t.prototype.onResizeStart=function(r,n){if(!(!this.resizable||!this.window)){var i=0,a=0;if(r.nativeEvent&&rtt(r.nativeEvent)?(i=r.nativeEvent.clientX,a=r.nativeEvent.clientY):r.nativeEvent&&M8(r.nativeEvent)&&(i=r.nativeEvent.touches[0].clientX,a=r.nativeEvent.touches[0].clientY),this.props.onResizeStart&&this.resizable){var o=this.props.onResizeStart(r,n,this.resizable);if(o===!1)return}this.props.size&&(typeof this.props.size.height<"u"&&this.props.size.height!==this.state.height&&this.setState({height:this.props.size.height}),typeof this.props.size.width<"u"&&this.props.size.width!==this.state.width&&this.setState({width:this.props.size.width})),this.ratio=typeof this.props.lockAspectRatio=="number"?this.props.lockAspectRatio:this.size.width/this.size.height;var s,l=this.window.getComputedStyle(this.resizable);if(l.flexBasis!=="auto"){var u=this.parentNode;if(u){var c=this.window.getComputedStyle(u).flexDirection;this.flexDir=c.startsWith("row")?"row":"column",s=l.flexBasis}}this.setBoundingClientRect(),this.bindEvents();var f={original:{x:i,y:a,width:this.size.width,height:this.size.height},isResizing:!0,backgroundStyle:Ih(Ih({},this.state.backgroundStyle),{cursor:this.window.getComputedStyle(r.target).cursor||"auto"}),direction:n,flexBasis:s};this.setState(f)}},t.prototype.onMouseMove=function(r){var n=this;if(!(!this.state.isResizing||!this.resizable||!this.window)){if(this.window.TouchEvent&&M8(r))try{r.preventDefault(),r.stopPropagation()}catch{}var i=this.props,a=i.maxWidth,o=i.maxHeight,s=i.minWidth,l=i.minHeight,u=M8(r)?r.touches[0].clientX:r.clientX,c=M8(r)?r.touches[0].clientY:r.clientY,f=this.state,d=f.direction,p=f.original,h=f.width,m=f.height,g=this.getParentSize(),A=ntt(g,this.window.innerWidth,this.window.innerHeight,a,o,s,l);a=A.maxWidth,o=A.maxHeight,s=A.minWidth,l=A.minHeight;var b=this.calculateNewSizeFromDirection(u,c),v=b.newHeight,x=b.newWidth,w=this.calculateNewMaxFromBoundary(a,o);this.props.snap&&this.props.snap.x&&(x=R6e(x,this.props.snap.x,this.props.snapGap)),this.props.snap&&this.props.snap.y&&(v=R6e(v,this.props.snap.y,this.props.snapGap));var S=this.calculateNewSizeFromAspectRatio(x,v,{width:w.maxWidth,height:w.maxHeight},{width:s,height:l});if(x=S.newWidth,v=S.newHeight,this.props.grid){var k=B6e(x,this.props.grid[0]),j=B6e(v,this.props.grid[1]),O=this.props.snapGap||0;x=O===0||Math.abs(k-x)<=O?k:x,v=O===0||Math.abs(j-v)<=O?j:v}var C={width:x-p.width,height:v-p.height};if(h&&typeof h=="string"){if(h.endsWith("%")){var N=x/g.width*100;x=N+"%"}else if(h.endsWith("vw")){var D=x/this.window.innerWidth*100;x=D+"vw"}else if(h.endsWith("vh")){var P=x/this.window.innerHeight*100;x=P+"vh"}}if(m&&typeof m=="string"){if(m.endsWith("%")){var N=v/g.height*100;v=N+"%"}else if(m.endsWith("vw")){var D=v/this.window.innerWidth*100;v=D+"vw"}else if(m.endsWith("vh")){var P=v/this.window.innerHeight*100;v=P+"vh"}}var q={width:this.createSizeForCssProperty(x,"width"),height:this.createSizeForCssProperty(v,"height")};this.flexDir==="row"?q.flexBasis=q.width:this.flexDir==="column"&&(q.flexBasis=q.height),(0,q6e.flushSync)(function(){n.setState(q)}),this.props.onResize&&this.props.onResize(r,d,this.resizable,C)}},t.prototype.onMouseUp=function(r){var n=this.state,i=n.isResizing,a=n.direction,o=n.original;if(!(!i||!this.resizable)){var s={width:this.size.width-o.width,height:this.size.height-o.height};this.props.onResizeStop&&this.props.onResizeStop(r,a,this.resizable,s),this.props.size&&this.setState(this.props.size),this.unbindEvents(),this.setState({isResizing:!1,backgroundStyle:Ih(Ih({},this.state.backgroundStyle),{cursor:"auto"})})}},t.prototype.updateSize=function(r){this.setState({width:r.width,height:r.height})},t.prototype.renderResizer=function(){var r=this,n=this.props,i=n.enable,a=n.handleStyles,o=n.handleClasses,s=n.handleWrapperStyle,l=n.handleWrapperClass,u=n.handleComponent;if(!i)return null;var c=Object.keys(i).map(function(f){return i[f]!==!1?Ab.createElement(I6e,{key:f,direction:f,onResizeStart:r.onResizeStart,replaceStyles:a&&a[f],className:o&&o[f]},u&&u[f]?u[f]:null):null});return Ab.createElement("div",{className:l,style:s},c)},t.prototype.render=function(){var r=this,n=Object.keys(this.props).reduce(function(o,s){return itt.indexOf(s)!==-1||(o[s]=r.props[s]),o},{}),i=Ih(Ih(Ih({position:"relative",userSelect:this.state.isResizing?"none":"auto"},this.props.style),this.sizeStyle),{maxWidth:this.props.maxWidth,maxHeight:this.props.maxHeight,minWidth:this.props.minWidth,minHeight:this.props.minHeight,boxSizing:"border-box",flexShrink:0});this.state.flexBasis&&(i.flexBasis=this.state.flexBasis);var a=this.props.as||"div";return Ab.createElement(a,Ih({ref:this.ref,style:i,className:this.props.className},n),this.state.isResizing&&Ab.createElement("div",{style:this.state.backgroundStyle}),this.props.children,this.renderResizer())},t.defaultProps={as:"div",onResizeStart:function(){},onResize:function(){},onResizeStop:function(){},enable:{top:!0,right:!0,bottom:!0,left:!0,topRight:!0,bottomRight:!0,bottomLeft:!0,topLeft:!0},style:{},grid:[1,1],lockAspectRatio:!1,lockAspectRatioExtraWidth:0,lockAspectRatioExtraHeight:0,scale:1,resizeRatio:1,snapGap:0},t}(Ab.PureComponent);var il=Ae(Te());var OZ=e=>{let t=o=>o?o=="auto"?"Fit":o=="100%"?"Fill":o:null,[r,n]=il.default.useState(null),[i,a]=il.default.useState({width:e.resizeMode!=2?e.size.width:e.size.minWidth,height:e.size.height});return il.default.useEffect(()=>{a({width:e.resizeMode!=2?e.size.width:e.size.minWidth,height:e.size.height})},[e.size,e.resizeMode]),(0,il.useEffect)(()=>{let o=s=>{n({shiftKey:s.shiftKey})};return e.superstate.ui.inputManager.on("keydown",o),e.superstate.ui.inputManager.on("keyup",o),()=>{e.superstate.ui.inputManager.off("keydown",o),e.superstate.ui.inputManager.off("keyup",o)}},[n]),il.default.createElement("div",{style:{position:"absolute",top:0,left:0,width:e.clientSize.width,height:e.clientSize.height}},il.default.createElement(L6e,{lockAspectRatio:r?.shiftKey,className:(0,z6e.default)(e.resizeMode==2?"mk-frame-column":"mk-frame-bounds"),enable:e.resizeMode==2?{right:!0}:{right:!0,bottom:!0,bottomRight:!0},onResize:(o,s,l,u)=>{a({width:l.clientWidth,height:l.clientHeight})},onResizeStop:(o,s,l,u)=>{let c=f=>{f.stopPropagation(),window.removeEventListener("click",c,!0)};window.addEventListener("click",c,!0),e.resizeMode==2?e.resize({minWidth:`'${l.clientWidth}px'`}):s=="bottom"?e.resize({height:`'${l.clientHeight}px'`}):s=="right"?e.resize({width:`'${l.clientWidth}px'`}):e.resize({width:`'${l.clientWidth}px'`,height:`'${l.clientHeight}px'`}),o.stopPropagation()},onResizeStart:o=>{o.stopPropagation()},handleClasses:e.resizeMode==2?{right:"mk-frame-column-resize-handle"}:e.resizeMode==1?{bottomRight:"mk-frame-resize-handle"}:{},handleWrapperStyle:{pointerEvents:"auto"},size:{width:i.width&&i.width!="auto"?i.width:"100%",height:i.height&&i.height!="auto"?i.height:"100%"},...e.listeners}),e.clientSize?.width>50&&e.resizeMode==1&&il.default.createElement("div",{className:"mk-frame-resize-label-width"},il.default.createElement("div",null,il.default.createElement("span",null,t(i.width)??H.editor.fit),i.width&&i.width!="auto"?il.default.createElement("div",{onClick:o=>{e.resize({width:jr("auto")}),o.stopPropagation()},"aria-label":H.editor.scaleToFit,style:{display:"flex"},dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//fold-horizontal")}}):il.default.createElement("div",{onClick:o=>{e.resize({width:jr("100%")}),o.stopPropagation()},"aria-label":H.editor.scaleToFill,style:{display:"flex"},dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//unfold-horizontal")}}))),e.clientSize?.height>50&&e.resizeMode==1&&il.default.createElement("div",{className:"mk-frame-resize-label-height"},il.default.createElement("div",null,il.default.createElement("span",null,t(i.height)??H.editor.fit),i.height&&i.height!="auto"?il.default.createElement("div",{onClick:o=>{e.resize({height:jr("auto")}),o.stopPropagation()},"aria-label":H.editor.scaleToFit,style:{display:"flex"},dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//fold-vertical")}}):il.default.createElement("div",{onClick:o=>{e.resize({height:jr("100%")}),o.stopPropagation()},"aria-label":H.editor.scaleToFill,style:{display:"flex"},dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//unfold-vertical")}}))))};var Jd=Ae(Te());var N8=e=>{let{selectionMode:t,selected:r,selection:n}=(0,Jd.useContext)(Hi),{updateNode:i,nodes:a}=(0,Jd.useContext)(Wi),o=d=>{if(d!=e.state.props?.value)if(e.treeNode.editorProps?.linkedNode){let p=a.find(h=>h.id==e.treeNode.editorProps.linkedNode.node);i(p,{props:{...p.props,[e.treeNode.editorProps.linkedNode.prop]:jr(d)}})}else i(e.treeNode.node,{props:{...e.treeNode.node.props,value:jr(d)}})},s=n?.includes(e.treeNode.node.id),l=(0,Jd.useMemo)(()=>t==0?!1:t==1||t==3&&s?!0:e.treeNode.isRef?!!(e.treeNode.editorProps.linkedNode&&r):!0,[e.treeNode,t,r,s]),u=d=>{e.superstate.ui.openPalette(Jd.default.createElement(Ta,{ui:e.superstate.ui,selectedSticker:p=>o(p)}),Ne(d.view.document))},[c,f]=e.state.props?.value?rg(e.state.props?.value):[null,null];return e.state&&(e.state.props?.value?.length>0?c=="image"?Jd.default.createElement("img",{className:"mk-frame-icon",src:e.superstate.ui.getUIPath(e.superstate.imagesCache.get(f))}):Jd.default.createElement("div",{className:"mk-frame-icon",style:{},dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker(e.state.props?.value)}}):l?Jd.default.createElement("div",{onClick:d=>u(d),"aria-label":"Select Sticker",className:"mk-node-icon-placeholder",dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//smile")}}):Jd.default.createElement(Jd.default.Fragment,null))};var Bf=Ae(Te());var T8=e=>{let t=e.state.props.value,r=(0,Bf.useMemo)(()=>e.superstate.ui.getUIPath(t,!0),[t]),{nodes:n,updateNode:i}=(0,Bf.useContext)(Wi),{linkedProps:a}=(0,Bf.useContext)(_i),{selectionMode:o,selected:s,selection:l}=(0,Bf.useContext)(Hi),u=l?.includes(e.treeNode.node.id),c=p=>{!Pu(e.treeNode.node.props.value)&&!a.some(h=>e.treeNode.editorProps.linkedNode?.node==e.treeNode.node.schemaId&&e.treeNode.editorProps.linkedNode?.prop==h)||e.superstate.ui.openPalette(Bf.default.createElement(_f,{superstate:e.superstate,selectedPath:h=>f(h)}),Ne(p.view.document))},f=p=>{if(p!=e.state.props?.value)if(e.treeNode.editorProps?.linkedNode){let h=n.find(m=>m.id==e.treeNode.editorProps.linkedNode.node);i(h,{props:{...h.props,[e.treeNode.editorProps.linkedNode.prop]:jr(p)}})}else i(e.treeNode.node,{props:{...e.treeNode.node.props,value:jr(p)}})},d=(0,Bf.useMemo)(()=>o==0?!1:o==1||o==3&&u?!0:e.treeNode.isRef?!!(e.treeNode.editorProps.linkedNode&&s):!0,[e.treeNode,o,s,u]);return e.state?.props.value?.length>0?Bf.default.createElement("img",{className:"mk-node-image",width:e.state?.styles.width,height:e.state?.styles.height,style:{borderRadius:e.state?.styles.borderRadius,maxHeight:e.state?.styles.maxHeight},src:r}):d?Bf.default.createElement("div",{className:"mk-node-image-placeholder",dangerouslySetInnerHTML:{__html:e.superstate.ui.getPlaceholderImage("image-select")},style:{borderRadius:e.state?.styles.borderRadius,maxHeight:e.state?.styles.maxHeight},onClick:p=>c(p)}):Bf.default.createElement(Bf.default.Fragment,null)};var bg=Ae(Te()),F8=e=>{let{selectionMode:t}=(0,bg.useContext)(Hi),{saveState:r,instance:n}=(0,bg.useContext)(_i),[i,a]=(0,bg.useState)(""),o=e.state,s=e.state.styles?.as;return(0,bg.useEffect)(()=>{let l=Im(e.state?.props?.value);if(l){let u=l.node=="$root"?n.exec.id:l.node;a(n.state?.[u]?.props?.[l.prop])}},[e.state.props]),bg.default.createElement("input",{className:"mk-node-input",type:s,value:s=="checkbox"?null:i,checked:i=="true",onKeyDown:l=>{if(l.stopPropagation(),l.key=="Enter"){let u=s=="text"?l.currentTarget.value:s=="checkbox"?(!l.currentTarget.checked).toString():l.currentTarget.value;a(""),typeof o.actions?.onEnter=="function"&&o.actions?.onEnter(l,u,n.state,c=>r(c,n),e.superstate.api)}},onChange:l=>{let u=s=="text"?l.target.value:s=="checkbox"?(!l.target.checked).toString():l.target.value;a(u),typeof o.actions?.onChange=="function"&&o.actions?.onChange(l,u,n.state,c=>r(c,n),e.superstate.api)},placeholder:o.styles.placeholder,style:{...o?.styles}})};var U6e=Ae(Te()),W6e=e=>U6e.default.createElement("div",{className:"mk-node-new"});var Rh=Ae(Te());var H6e=Ae(Te());function MZ(e){(0,H6e.useEffect)(e,[])}var BD=Ae(Te());function gb(e,t,r=window){let n=(0,BD.useRef)(t);(0,BD.useEffect)(()=>{n.current=t},[t]),(0,BD.useEffect)(()=>{if(r==null)return;let i=a=>n.current(a);return r.addEventListener(e,i),()=>r.removeEventListener(e,i)},[e,r])}var Bh=Ae(Te());function jZ(e,t){let r=(0,Bh.useRef)(e),n=(0,Bh.useRef)(null);(0,Bh.useEffect)(()=>{r.current=e},[e]);let i=(0,Bh.useCallback)(()=>{n.current=setTimeout(()=>r.current(),t)},[t]),a=(0,Bh.useCallback)(()=>{n.current&&clearTimeout(n.current)},[]);return(0,Bh.useEffect)(()=>(i(),a),[t,i,a]),{reset:(0,Bh.useCallback)(()=>{a(),i()},[a,i]),clear:a}}function RD(e,t,{delay:r=400}={}){let{reset:n,clear:i}=jZ(t,r);MZ(i),gb("mousedown",n,e.current),gb("touchstart",n,e.current),gb("mouseup",i,e.current),gb("mouseleave",i,e.current),gb("touchend",i,e.current)}var _8=e=>{let{selectionMode:t,selection:r,selectable:n,selected:i,select:a}=(0,Rh.useContext)(Hi),o=(0,Rh.useRef)(null),{updateNode:s,nodes:l,deleteNode:u}=(0,Rh.useContext)(Wi),c=w=>{if(w!=e.state.props?.value)if(e.treeNode.editorProps?.linkedNode){let S=l.find(k=>k.id==e.treeNode.editorProps.linkedNode.node);s(S,{props:{...S.props,[e.treeNode.editorProps.linkedNode.prop]:jr(w)}})}else s(e.treeNode.node,{props:{...e.treeNode.node.props,value:jr(w)}})},f=w=>{let S=w.target.innerHTML;c(S)},d=w=>{w.stopPropagation()},p=w=>{w.stopPropagation()},h=w=>{if(w.stopPropagation(),(w.key=="Delete"||w.key=="Backspace")&&w.target.innerHTML==""&&u(e.treeNode.node),w.key=="a"&&w.metaKey){w.preventDefault();let S=window.getSelection(),k=document.createRange();k.selectNodeContents(w.target),S.removeAllRanges(),S.addRange(k)}w.key=="Enter"&&(w.target.blur(),w.preventDefault()),w.key=="Escape"&&(w.target.blur(),w.preventDefault())},m=w=>{x&&w.stopPropagation()},g=w=>{x&&w.stopPropagation(),t==3&&!e.treeNode.isRef&&a(e.treeNode.id)};RD(o,()=>{if(x){a(e.treeNode.node.id,!1);return}});let b=r.includes(e.treeNode.id),{linkedProps:v}=(0,Rh.useContext)(_i),x=(0,Rh.useMemo)(()=>t==0?!1:e.treeNode.isRef?!!(e.treeNode.editorProps.linkedNode&&i):v.some(w=>e.treeNode.editorProps.linkedNode?.node==e.treeNode.node.schemaId&&e.treeNode.editorProps.linkedNode?.prop==w)?!0:Pu(e.treeNode.node.props.value)?!!(t==1||t==3&&b):!1,[e.treeNode,t,i,b,v]);return e.state&&Rh.default.createElement("div",{className:"mk-frame-text","data-placeholder":x||n?H.labels.textPlaceholder:"",dangerouslySetInnerHTML:{__html:e.state.props?.value},onClick:m,onMouseDown:g,onBlur:f,onDrop:w=>w.preventDefault(),onKeyDown:h,onKeyPress:d,onKeyUp:p,ref:o,contentEditable:x})};var TZ={position:"relative"},att=(0,zt.memo)(function(t){let r={superstate:t.superstate,treeNode:t.treeNode,state:t.state},{treeNode:n}=t,{pathState:i}=(0,zt.useContext)($r),{instance:a}=(0,zt.useContext)(_i);return zt.default.createElement(zt.default.Fragment,null,n.node.type=="new"?zt.default.createElement(W6e,{...r}):n.node.type=="input"?zt.default.createElement(F8,{...r}):n.node.type=="text"?zt.default.createElement(_8,{...r}):n.node.type=="icon"?zt.default.createElement(N8,{...r}):n.node.type=="audio"?zt.default.createElement(v8,{...r}):n.node.type=="image"?zt.default.createElement(T8,{...r}):n.node.type=="space"?zt.default.createElement(b8,{...r,containerRef:t.containerRef,source:i.path}):n.node.type=="flow"?zt.default.createElement(x8,{...r,source:i.path,containerRef:t.containerRef}):n.node.type=="content"?zt.default.createElement(y8,{editable:!t.treeNode.isRef},t.treeNode.children.map((o,s)=>o.node.type=="slides"?null:zt.default.createElement($D,{superstate:t.superstate,key:o.id,treeNode:o,instance:t.instance,containerRef:t.containerRef},t.children)),t.children):(n.node.type=="column"||n.node.type=="container")&&n.children.length==0?null:t.treeNode.id==t.instance.exec.id||n.node.type=="column"||n.node.type=="container"?t.treeNode.children.map((o,s)=>o.node.type=="slides"?null:zt.default.createElement($D,{superstate:t.superstate,key:o.id,treeNode:o,instance:t.instance,containerRef:t.containerRef},t.children)):zt.default.createElement(zt.default.Fragment,null,zt.default.createElement(Tv,{superstate:t.superstate,id:n.id,editMode:t.editMode},n.children.map((o,s)=>o.node.type=="slides"?null:zt.default.createElement($D,{superstate:t.superstate,key:o.id,treeNode:o,instance:t.instance,containerRef:t.containerRef},t.children)))))}),$D=e=>{let{selectionMode:t,selectable:r,selected:n,isParentToSelection:i,select:a,selection:o}=(0,zt.useContext)(Hi),{updateNode:s,addNode:l,deleteNode:u,nodes:c,selectedSlide:f}=(0,zt.useContext)(Wi),{setDragNode:d}=(0,zt.useContext)(vh),{saveState:p,selectableNodeBounds:h,id:m}=(0,zt.useContext)(_i),{dragActive:g}=(0,zt.useContext)(vh),A=e.treeNode.isRef?0:e.treeNode.id==e.instance.exec.id?t:3,b=o.some(ee=>ee==e.treeNode.id),v=r&&!e.treeNode.isRef&&!b,x=e.instance.state[e.treeNode.id],w=(0,zt.useMemo)(()=>f?c.find(ee=>ee.ref==e.treeNode.id&&f==ee.parentId)??null:null,[c,e.treeNode,f]),S=(0,zt.useMemo)(()=>w?{...e.treeNode,node:{...e.treeNode.node,styles:{...e.treeNode.node.styles,...w.styles},props:{...e.treeNode.node.props,...w.props},actions:{...e.treeNode.node.actions,...w.actions}}}:e.treeNode,[w,e.treeNode]),{frameSchema:k}=(0,zt.useContext)(ma),j=m+k.id+e.treeNode.id,[O,C]=(0,zt.useState)(!1),[N,D]=zt.default.useState(!1),[P,q]=zt.default.useState(!1),z=e.treeNode.editorProps.dragMode==1||(v&&!i||b)&&e.treeNode.editorProps.dragMode!=0,{attributes:I,listeners:T,setNodeRef:L,transform:_}=Us({id:j,data:{id:j,root:m,type:"node",parent:e.treeNode.node.parentId,frame:k.id,node:e.treeNode.id},disabled:!z}),Y=(0,zt.useRef)(null),oe=()=>{if(v&&e.treeNode.id!=e.instance.exec.id){a(S.node.id);return}},te=e.instance.state[e.treeNode.id]?.styles?!!e.instance.state[e.treeNode.id]?.styles?.hidden:!1,Q={superstate:e.superstate,treeNode:S,state:x},fe=ee=>{s(S.node,{styles:{...ee}})},Ie=ee=>{if(v&&(t!=1||i&&e.treeNode.id!=e.instance.exec.id)){ee.shiftKey?a(S.node.id,!0):a(S.node.id),ee.stopPropagation();return}else e.treeNode.id==e.instance.exec.id&&a(null);if(b)ee.stopPropagation();else{if((ee.detail===2||Gr(e.superstate.ui))&&typeof x.actions?.onDoubleClick=="function"){x.actions?.onDoubleClick(ee,null,e.instance.state,ie=>p(ie,e.instance),e.superstate.api),ee.stopPropagation();return}ee.detail===1&&typeof x.actions?.onClick=="function"&&(x.actions?.onClick(ee,null,e.instance.state,ie=>p(ie,e.instance),e.superstate.api),ee.stopPropagation())}};(0,zt.useEffect)(()=>{o.some(ee=>ee!=e.treeNode.id)&&C(!1)},[o,e.treeNode]);let[Se,Oe]=(0,zt.useState)(!1);(0,zt.useEffect)(()=>{b&&Gr(e.superstate.ui)&&(e.treeNode.node.type=="group"||e.treeNode.node.type=="image"||t>=3)?Oe(!0):b&&Se||Oe(!1)},[e.treeNode,t,b]);let ve=e.treeNode.editorProps.dropMode,ye=Y.current&&getComputedStyle(Y.current),me=Y.current&&Y.current.clientWidth,ke=Y.current&&Y.current.clientHeight,[$,ae]=(0,zt.useState)([]),ce=(ee,ie)=>({left:ee.x-ie.x,top:ee.y-ie.y,width:ee.width,height:ee.height});(0,zt.useEffect)(()=>{if(!Y.current||!e.containerRef?.current)return()=>null;e.treeNode.node.parentId==e.instance.exec.id&&(h.current[e.treeNode.id]=ce(Y.current.getBoundingClientRect(),e.containerRef.current.getBoundingClientRect())),ae(()=>Array.from(Y.current?.children??[]).map(re=>({x:re.offsetLeft,y:re.offsetTop,width:re.clientWidth,height:re.clientHeight})));let ee=new ResizeObserver(()=>{e.treeNode.node.parentId==e.instance.exec.id&&Y.current&&(h.current[e.treeNode.id]=ce(Y.current.getBoundingClientRect(),e.containerRef.current.getBoundingClientRect())),ae(()=>Array.from(Y.current?.children??[]).map(re=>({x:re.offsetLeft,y:re.offsetTop,width:re.clientWidth,height:re.clientHeight})))});return ee.observe(Y.current),()=>ee.disconnect()},[x]);let U=Y.current?.getBoundingClientRect(),R=e.containerRef?.current?.getBoundingClientRect(),J={...TZ,...e.treeNode.node.type!="flow"?x?.styles:{width:x?.styles?.width,height:x?.styles?.height,"--max-width":x?.styles?.["--max-width"]},"--translate-x":`${_?.x??0}px`,"--translate-y":`${_?.y??0}px`};return Ca({onDragStart:ee=>{ee.active?.id==j&&d(zt.default.createElement("div",{style:{width:Y.current.clientWidth}},zt.default.createElement(J2,{superstate:e.superstate,treeNode:e.treeNode,instance:e.instance,saveState:null})))}}),zt.default.createElement(zt.default.Fragment,null,(!te||!e.treeNode.isRef)&&zt.default.createElement("div",{ref:ee=>{Y.current=ee,t>1&&z&&L(ee)},onContextMenu:()=>Gr(e.superstate.ui)&&oe(),className:(0,NZ.default)(`mk-frame-edit ${G2(x?.styles)}`,v&&t!=1&&"mk-f-editable",b&&t==1&&"mk-selected"),"data-path":S.id,"data-type":S.node.type,onMouseEnter:()=>{C(!0),D(!0)},onMouseLeave:()=>{P||C(!1),D(!1)},...{onClick:Ie},...t>1?{...T,...I}:{},style:J},zt.default.createElement(att,{...Q,containerRef:e.containerRef,editMode:A,instance:e.instance},e.children)),x&&e.treeNode.node.type!="new"&&e.containerRef?.current&&t>0&&Y.current&&(0,V6e.createPortal)(zt.default.createElement(zt.default.Fragment,null,zt.default.createElement("div",{style:{position:"absolute",top:U.top-R.top,left:U.left-R.left,width:me,height:ke,pointerEvents:"none"},className:(0,NZ.default)(!g&&v&&t!=1&&"mk-f-editable",!g&&b&&(t!=1||e.treeNode.node.type=="group")&&"mk-f-edit",!g&&O&&t!=1&&"mk-f-edit-hover"),onClick:ee=>{if(v&&t!=1){ee.shiftKey?a(S.node.id,!0):a(S.node.id),ee.stopPropagation();return}}},e.treeNode.editorProps.resizeMode==2&&zt.default.createElement(OZ,{size:x?.styles,superstate:e.superstate,resizeMode:e.treeNode.editorProps.resizeMode,resize:fe,clientSize:{width:me,height:ke}}),g&&(t==1||t==3)&&ve>0&&zt.default.createElement(j6e,{parentId:S.node.parentId,superstate:e.superstate,height:ke,width:me,node:S.node.id,id:j,mode:ve,insertMode:S.node.type=="group"?1:S.node.type=="space"?-1:0}),Se&&zt.default.createElement(zt.default.Fragment,null,zt.default.createElement(OZ,{superstate:e.superstate,resizeMode:1,size:x?.styles,resize:fe,clientSize:{width:me,height:ke}}),zt.default.createElement(O6e,{styles:x?.styles,saveStyles:fe,clientSize:{width:me,height:ke}}),(S.node.type=="group"||S.node.type=="content")&&(x.styles?.layout=="row"||x.styles?.layout=="column")&&zt.default.createElement(zt.default.Fragment,null,zt.default.createElement(N6e,{childSizes:$,clientSize:{width:me,height:ke,paddingBottom:parseInt(ye?.paddingBottom??"0"),paddingLeft:parseInt(ye?.paddingLeft??"0"),paddingRight:parseInt(ye?.paddingRight??"0"),paddingTop:parseInt(ye?.paddingTop??"0")},styles:x?.styles,saveStyles:fe,direction:x?.styles.layout=="column"?"column":"row"}),zt.default.createElement(F6e,{clientSize:{width:me,height:ke},styles:x?.styles,saveStyles:fe}))),S.editorProps.dragMode==1&&(!Gr(e.superstate.ui)||b)?zt.default.createElement("div",{onMouseEnter:()=>{q(!0),C(!0)},onMouseLeave:()=>{N||C(!1),q(!1)},className:"mk-editor-frame-hover-menu-container",style:{zIndex:O?"calc(var(--layer-popover) + 1)":"var(--layer-popover)"}},zt.default.createElement(C6e,{superstate:e.superstate,node:S.node,mode:t==1?0:1,selected:b,visible:Gr(e.superstate.ui)||O,dragRef:L,attributes:I,listeners:T})):zt.default.createElement(zt.default.Fragment,null)),o&&!g&&b&&o.length==1?zt.default.createElement(CZ,{nodeRect:U,containerRect:R},zt.default.createElement(k6e,{editLayout:ee=>Oe(ee),superstate:e.superstate,node:S.node,duplicateFrame:()=>{l(S.node,S.node)},state:x,deleteFrame:()=>u(S.node),fields:Jte(S.node)})):o.length>1&&o[0]==S.id?zt.default.createElement(CZ,{nodeRect:U,containerRect:R},zt.default.createElement(s6e,{superstate:e.superstate})):null),e.containerRef.current))};var J2=e=>{let t={superstate:e.superstate,treeNode:e.treeNode,state:e.instance.state[e.treeNode.id]},r=e.treeNode.node.type=="input"?ep.default.createElement(F8,{...t}):e.treeNode.node.type=="text"?ep.default.createElement(_8,{...t}):e.treeNode.node.type=="icon"?ep.default.createElement(N8,{...t}):e.treeNode.node.type=="audio"?ep.default.createElement(v8,{...t}):e.treeNode.node.type=="image"?ep.default.createElement(T8,{...t}):e.treeNode.node.type=="space"?ep.default.createElement(b8,{...t,source:e.source}):e.treeNode.node.type=="content"?ep.default.createElement(y8,null,e.treeNode.children.filter(i=>i.node.type!="slides").map((i,a)=>ep.default.createElement(J2,{superstate:e.superstate,key:a,treeNode:i,instance:e.instance,saveState:e.saveState,source:e.source},e.children)),e.children):e.treeNode.node.type=="flow"?ep.default.createElement(x8,{...t,source:e.source}):e.treeNode.children.filter(i=>i.node.type!="slides").map((i,a)=>ep.default.createElement(J2,{superstate:e.superstate,key:a,treeNode:i,instance:e.instance,saveState:e.saveState,source:e.source},e.children)),n=e.instance.state[e.treeNode.id]?.styles?!!e.instance.state[e.treeNode.id]?.styles?.hidden:!1;return e.instance.state[e.treeNode.id]&&!n&&ep.default.createElement("div",{className:`mk-frame ${G2(e.instance.state[e.treeNode.id]?.styles)}`,"data-path":e.treeNode.id,"data-type":e.treeNode.node.type,onContextMenu:i=>{typeof e.instance.state[e.treeNode.id].actions?.onContextMenu=="function"&&(e.instance.state[e.treeNode.id].actions?.onContextMenu(i,null,e.instance.state,a=>e.saveState(a,e.instance),e.superstate.api),i.stopPropagation())},onClick:i=>{if((i.detail===2||Gr(e.superstate.ui))&&typeof e.instance.state[e.treeNode.id].actions?.onDoubleClick=="function"){e.instance.state[e.treeNode.id].actions?.onDoubleClick(i,null,e.instance.state,a=>e.saveState(a,e.instance),e.superstate.api),i.stopPropagation();return}i.detail===1&&typeof e.instance.state[e.treeNode.id].actions?.onClick=="function"&&(e.instance.state[e.treeNode.id].actions?.onClick(i,null,e.instance.state,a=>e.saveState(a,e.instance),e.superstate.api),i.stopPropagation())},style:{...TZ,...e.instance.state[e.treeNode.id]?.styles}},r)};var vb=e=>{let{saveState:t,instance:r}=(0,P8.useContext)(_i);return r.exec&&P8.default.createElement(J2,{superstate:e.superstate,treeNode:r.exec,instance:r,saveState:t,source:e.source},e.children)};var Wv=e=>{let t=(0,es.useMemo)(()=>e.superstate.spaceManager.uriByString(e.path,e.source),[e.path,e.source]),[r,n]=(0,es.useState)(null);return(0,es.useEffect)(()=>{t.refType=="context"?n({type:"context",path:t.basePath,contextSchema:t.ref,frameSchema:t.query?.frameSchema}):t.refType=="frame"?e.superstate.spaceManager.readFrame(t.basePath,t.ref).then(i=>{let a=i?.schema;!a&&t.ref==bp.id&&(a=bp,n({type:"context",path:t.basePath,frameSchema:a.id})),a?.type=="view"?n({type:"context",path:t.basePath,frameSchema:t.ref}):n({type:"frame",path:t.basePath,frameSchema:t.ref})}):t.refType=="action"?n({type:"action",path:t.basePath,actionSchema:t.ref}):n({type:"context",path:t.basePath,frameSchema:r0})},[t]),es.default.createElement(es.default.Fragment,null,r?.path&&(r?.type=="context"?es.default.createElement(Qs,{superstate:e.superstate,path:r.path,readMode:!1},es.default.createElement(lh,{superstate:e.superstate},es.default.createElement(pv,{superstate:e.superstate,contextSchema:r.contextSchema,schema:r.frameSchema},es.default.createElement(h2,{superstate:e.superstate},es.default.createElement(eE,{showTitle:e.showTitle,superstate:e.superstate,minMode:e.minMode,containerRef:e.containerRef,setView:e.setFrameSchema}))))):r?.type=="frame"?es.default.createElement(F9,{superstate:e.superstate,path:t,cols:[]},es.default.createElement(ug,{id:e.id,superstate:e.superstate,props:{},editable:!1},es.default.createElement(vb,{superstate:e.superstate,source:e.source}))):r?.type=="action"?es.default.createElement(o6e,{superstate:e.superstate,action:e.path}):es.default.createElement(es.default.Fragment,null)))};var w8=e=>{let[t,r]=(0,Lc.useState)(e.superstate.pathsIndex.get(e.path)),n=(0,Lc.useRef)(null);return(0,Lc.useEffect)(()=>{let i=e.superstate.spaceManager.uriByString(e.path),a=e.superstate.pathsIndex.get(e.path);if(!a&&(i?.scheme=="https"||i?.scheme=="http")){r({path:e.path,label:{sticker:i.scheme,name:i.path,color:""},hidden:!1,readOnly:!0,subtype:"md",type:"remote"});return}r(a)},[e.path]),Lc.default.createElement("div",{className:"mk-path-view",style:{...e.styles??{}}},t?.type=="remote"?t.subtype=="note"?Lc.default.createElement(dv,{superstate:e.superstate,path:e.path,load:!0,classname:"mk-flow-node"}):Lc.default.createElement("iframe",{src:e.path}):t?.type=="space"?Lc.default.createElement(Wv,{id:e.id,showTitle:!0,containerRef:n,superstate:e.superstate,path:e.path}):e.superstate.ui.availableViews().some(i=>i==e.path?.split(".").pop())?Lc.default.createElement(dv,{superstate:e.superstate,path:e.path,load:!0,classname:"mk-flow-node"}):Lc.default.createElement(Lc.default.Fragment,null))};var Y6e=e=>{let[t,r]=(0,br.useState)(null),[n,i]=(0,br.useState)(!1),[a,o]=(0,br.useState)(!1),[s,l]=(0,br.useState)(""),[u,c]=(0,br.useState)(0),f=N=>{l(N)},[d,p]=(0,br.useState)([]),h=(0,br.useMemo)(()=>s.length>0?[{type:"any",trueFalse:!0,filters:[{type:"file",fType:"text",field:"name",fn:"include",value:s}]},...d]:d,[s,d]),m=N=>({type:"path",value:N.path,cache:N,sticker:N.label.sticker,description:N.label.preview,label:N.name}),g=e.parentSpace?[{type:"section",label:"Items"},...[...e.superstate.spacesMap.getInverse(e.parentSpace)].map(N=>e.superstate.pathsIndex.get(N)).filter(N=>N&&!N.hidden).map(N=>m(N))]:[],A=[{type:"section",label:"Recent"},...e.superstate.ui.navigationHistory().map(N=>e.superstate.pathsIndex.get(N)).filter(N=>N&&!N.hidden).map(N=>m(N))],[b,v]=(0,br.useState)(e.parentSpace?g:A);(0,br.useEffect)(()=>{let N=(D,P)=>{if(D.length==0&&s.length==0){v(e.parentSpace?g:A);return}if(d.length==0){if(!e.superstate.settings.searchWorker){let q=LEe({query:s,pathsIndex:e.superstate.pathsIndex,count:10});v([{type:"section",label:"Results"},...q.map(z=>m(z)),{type:"section",label:"Create New"},{type:"new-note",sticker:"ui//edit",value:s,label:"New Note"},{type:"new-space",sticker:"ui//folder-plus",value:s,label:"New Space"}]);return}e.superstate.search(D,s).then(q=>v([{type:"section",label:"Results"},...q.map(z=>m(z)),{type:"section",label:"Create New"},{type:"new-note",sticker:"ui//edit",value:s,label:"New Note"},{type:"new-space",sticker:"ui//folder-plus",value:s,label:"New Space"}]));return}if(!e.superstate.settings.searchWorker){let q=zEe({queries:P,count:10,pathsIndex:e.superstate.pathsIndex});v([{type:"section",label:"Results"},...q.map(z=>m(z)),{type:"new-note",sticker:"ui//plus",value:s,label:"New Note"},{type:"new-space",sticker:"ui//plus",value:s,label:"New Space"}]);return}e.superstate.search(D,null,P).then(q=>v(q.map(z=>m(z))))};(0,G6e.debounce)(()=>N(s,h),300)()},[s,h]),(0,br.useEffect)(()=>{if(!b[u]||b[u].type!="path")return;let N=b[u]?.cache?.path;!N||N==t||r(b[u]?.cache?.path)},[u,b]);let x=(N,D)=>{if(!!N&&N.type!="section"){if(N.type=="new-note"){if(e.parentSpace){let P=e.superstate.spacesIndex.get(e.parentSpace);if(P){za(e.superstate,P,"md",s,!!e.onSelect).then(q=>{e.mode==2&&e.onSelect(q),e.hide()});return}}YS(e.superstate,e.superstate.pathsIndex.get(e.superstate.ui.activePath)).then(P=>za(e.superstate,P,"md",s).then(q=>{e.mode==2&&e.onSelect(q),e.hide()}));return}if(N.type=="new-space"){let P=e.superstate.pathsIndex.get(e.parentSpace)??e.superstate.pathsIndex.get("/"),q=s.replace(/\//g,""),z=P?.subtype=="folder"?P.path:P.parent?P.parent:"/",I=!z||z=="/"?q:z+"/"+q;if(q.length==0){e.superstate.ui.notify(H.notice.newSpaceName);return}if(e.superstate.spacesIndex.has(I)){e.superstate.ui.notify(H.notice.duplicateSpaceName);return}kf(e.superstate,I,{}).then(T=>{e.mode==2&&e.onSelect(T.path),e.hide()});return}if(N.cache){if(e.mode==2){e.onSelect(N.cache?.path),e.hide();return}if(!n||D){e.superstate.ui.openPath(N.cache?.path),e.hide();return}}c(b.findIndex(P=>P.cache?.path==N.cache?.path))}},w=[],S=N=>{if(N.key=="Tab"&&w&&(N.preventDefault(),N.stopPropagation()),N.key=="ArrowUp"){let P=u<=0?b.length-1:u-1;if(b.length==0)return;!b[P]||b[P].type=="section"?c(P<0?b.length-1:P-1):c(P),N.preventDefault()}if(N.key=="ArrowDown"){let D=b.length-1,P=u>=D?0:u+1;!b[P]||b[P].type=="section"?c(P>=D?0:P+1):c(P),c(P),N.preventDefault()}N.key=="Enter"&&(x(b[u],!0),N.preventDefault())},k=br.default.useRef(null);(0,br.useEffect)(()=>{k.current?.focus()},[k.current]);let j=_9(e.superstate),O=[];Object.keys(j).forEach(N=>{j[N].properties.forEach(D=>{O.push({...D})})});let C=Object.keys(j).map(N=>({name:j[N].name,value:N}));return br.default.createElement(br.default.Fragment,null,br.default.createElement("div",{className:"mk-blink-input-container"},br.default.createElement("div",{className:"mk-icon-small",dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//search")}}),br.default.createElement("div",{"data-placeholder":H.labels.blinkPlaceholder,onInput:N=>f(N.currentTarget.innerText),onKeyDown:N=>S(N),ref:k,contentEditable:!0,className:"mk-blink-input"}),e.mode==1&&br.default.createElement(br.default.Fragment,null,br.default.createElement("button",{onClick:()=>i(N=>!N),className:"mk-toolbar-button",dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//blink")}}),br.default.createElement("button",{className:"mk-toolbar-button",dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//filter")},onClick:()=>o(!a)}))),a&&br.default.createElement("div",{className:"mk-blink-filters"},br.default.createElement("div",{className:"mk-icon-xsmall",dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//filter")}}),br.default.createElement(E2,{superstate:e.superstate,filters:d,setFilters:p,fields:O,sections:C})),br.default.createElement("div",{className:"mk-blink-suggester",style:{}},br.default.createElement("div",{className:"mk-blink-suggestions"},b.map((N,D)=>br.default.createElement("div",{key:D,className:(0,Q6e.default)(N.type=="section"?"mk-blink-section":"mk-blink-suggestion",u==D&&"mk-active"),onClick:P=>x(N)},N.type=="section"?br.default.createElement("div",{className:"mk-blink-suggestion-title"},N.label):br.default.createElement(br.default.Fragment,null,br.default.createElement("div",{className:"mk-blink-suggestion-icon",dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker(N.sticker)}}),br.default.createElement("div",{className:"mk-blink-suggestion-text"},br.default.createElement("div",{className:"mk-blink-suggestion-title"},N.label),br.default.createElement("div",{className:"mk-blink-suggestion-description"},N.value),N.description&&br.default.createElement("div",{className:"mk-blink-suggestion-preview"},N.description)))))),e.mode==1&&n&&br.default.createElement(ott,{superstate:e.superstate,path:t})))},ott=e=>{let t=br.default.useRef(null),[r,n]=(0,br.useState)(!1);return br.default.createElement("div",{className:"mk-blink-preview",ref:t},br.default.createElement("div",{className:"mk-blink-preview-title"},br.default.createElement(oo,{superstate:e.superstate,path:e.path}),br.default.createElement("span",null),br.default.createElement("button",{className:r?"is-active mk-icon-small":"mk-icon-small",dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//list")},onClick:()=>n(!r)})),br.default.createElement(w8,{id:"blink",superstate:e.superstate,path:e.path,containerRef:t,styles:{},readOnly:!0}),r&&br.default.createElement("div",{className:"mk-blink-properties"},br.default.createElement("div",{className:"mk-blink-properties-header"},"Properties"),br.default.createElement(Qs,{path:e.path,superstate:e.superstate,readMode:!1})))};var X6e=(e,t,r,n,i)=>{e.ui.openPalette(Z6e.default.createElement(Y6e,{superstate:e,mode:t,onSelect:n,parentSpace:i}),r,"mk-blink-modal")};var Bl=Ae(Te());var Gv=Ae(Te()),tE=e=>{let t=_r(e.superstate,e.date,e.mode=="day"?"MMMM d":"MMMM");return Gv.default.createElement("div",{className:"mk-calendar-header"},Gv.default.createElement("div",{className:"mk-calendar-header-title"},Gv.default.createElement("span",null,t),_r(e.superstate,e.date,"yyyy")),Gv.default.createElement("span",null),Gv.default.createElement("button",{dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//chevron-left")},onClick:()=>{if(e.mode=="day"){e.setDate(new Date(e.date.setDate(e.date.getDate()-1)));return}else if(e.mode=="week"){e.setDate(new Date(e.date.setDate(e.date.getDate()-7)));return}e.setDate(new Date(e.date.setMonth(e.date.getMonth()-1)))}}),Gv.default.createElement("button",{onClick:()=>{e.setDate(new Date)}},"Today"),Gv.default.createElement("button",{onClick:()=>{if(e.mode=="day"){e.setDate(new Date(e.date.setDate(e.date.getDate()+1)));return}if(e.mode=="week"){e.setDate(new Date(e.date.setDate(e.date.getDate()+7)));return}e.setDate(new Date(e.date.setMonth(e.date.getMonth()+1)))},dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//chevron-right")}}))};var FZ=Ae(Te());var I8=e=>{let{attributes:t,listeners:r,setNodeRef:n,transform:i}=Us({id:"event-"+e.index,data:{type:"event",index:e.index}});return FZ.default.createElement("div",{className:"mk-week-event",ref:n,...t,...r,style:{...e.style,left:"2px",width:`calc(${(e.endDay-e.startDay+1)*100}% - 4px)`,top:`${e.topOffset*22+2}px`}},FZ.default.createElement(oo,{superstate:e.superstate,path:e.data[mt]}))};var qD=Ae(Te()),B8=e=>qD.default.createElement("div",{className:"mk-day-view-gutter"},e.allDay&&qD.default.createElement("div",{className:"mk-day-view-hour-title"},"all day"),Array.from({length:e.endHour-e.startHour+1}).map((t,r)=>{let n=r+e.startHour;return qD.default.createElement("div",{key:n,className:"mk-day-view-hour-title"},qD.default.createElement("span",null,n%12===0?12:n%12)," ",n<12?"AM":"PM")}));var So=Ae(Te());var LD=e=>{let{event:t,hourHeight:r,startHour:n}=e,{spaceState:i}=(0,So.useContext)(ur),{attributes:a,listeners:o,setNodeRef:s,transform:l}=Us({id:`event-${t?.index??""}-${t?.start?.getTime().toString()??""}-${e.clone?"clone":""}`,data:{type:"event",index:t?.index}}),u="#0098FF",[c,f]=(0,So.useState)(null),d=c||t,p=(0,So.useMemo)(()=>{let h=t.start??JE(Hn(new Date),e.event.startOffset),m=t.end??JE(Hn(new Date),e.event.endOffset),g=_r(e.superstate,h,"a")===_r(e.superstate,m,"a"),A=`h${h.getMinutes()==0?"":":mm"} ${g?"":"a"}`,b=`h${m.getMinutes()==0?"":":mm"} a`;return e.event.startOffset>0?`${_r(e.superstate,h,A)} - ${_r(e.superstate,m,b)}`:null},[e.event]);return So.default.createElement("div",{key:t.index,onMouseDown:h=>{h.stopPropagation()},onContextMenu:h=>{let m=h.currentTarget.getBoundingClientRect();Jp(e.superstate,e.item[mt],i.path,m,Ne(h.currentTarget.ownerDocument))},className:"mk-day-block",style:{zIndex:1,...e.style||{},...e.clone?{top:`${(d.startOffset/60-n)*r}px`,width:`calc(${t.widthPercentage}% - ${t.leftOffset*8}px)`,height:`${(d.endOffset-d.startOffset)*r/60}px`}:{top:`${(d.startOffset/60-n)*r}px`,height:`${(d.endOffset-d.startOffset)*r/60}px`,left:`calc(${d.column*d.widthPercentage}% + ${d.leftOffset*8}px)`,width:`calc(${d.widthPercentage}% - ${d.leftOffset*8}px)`}}},So.default.createElement("div",{...a,...o,ref:s,className:"mk-day-block-inner",style:{"--block-color":u,"--block-bg-color":cg(40,u)}},So.default.createElement("div",{className:"mk-day-block-inner-indicator"}),So.default.createElement("div",{className:"mk-day-block-content"},e.item[mt]?So.default.createElement(oo,{superstate:e.superstate,path:e.item[mt],hideIcon:!0}):"New Event",p&&So.default.createElement("div",{className:"mk-day-block-time"},So.default.createElement("div",{dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//clock")}}),p)),So.default.createElement("span",null),d.repeat&&So.default.createElement("div",{className:"mk-icon-xsmall",dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//sync")}}),!d.allDay&&So.default.createElement(So.default.Fragment,null,So.default.createElement("div",{className:"mk-day-handle-n"},So.default.createElement(nl,{value:d.startOffset,cursor:"s",reverseY:!0,disableX:!0,step:60/r,onDragMove:h=>{let m={...t,startOffset:Math.round(h/15)*15};f(m)},onDragEnd:h=>{e.updateStartEnd&&e.updateStartEnd(Math.round(h/15)*15,d.endOffset),f(null)}})),So.default.createElement("div",{className:"mk-day-handle-s"},So.default.createElement(nl,{value:d.endOffset,cursor:"s",reverseY:!0,disableX:!0,step:60/r,onDragMove:h=>{let m={...t,endOffset:Math.round(h/15)*15};f(m)},onDragEnd:h=>{e.updateStartEnd&&e.updateStartEnd(d.startOffset,Math.round(h/15)*15),f(null)}})))))};var R8=e=>{let{hourHeight:t}=e,[r,n]=(0,zc.useState)(e.date??Hn(new Date)),{source:i}=(0,zc.useContext)(Na),[a,o]=(0,zc.useState)(null),s=`day-view-${r.toDateString()}`,l=e.startHour??0,u=(N,D,P,q,z)=>{if(!N||!P||!q)return[];let I=[],T=[];N.forEach((L,_)=>{let Y=or(L[z]),oe=[],te=Yi(L[P]);if(te>=D&&te<=Sa(D,{days:1})&&oe.push(L),Y&&Y.freq){let Q=Yi(L[q]).getTime()-te.getTime(),fe={dtstart:te,freq:Y.freq&&zM(Y.freq),count:Y.count&&Math.min(parseInt(Y.count),100),interval:Y.interval&&parseInt(Y.interval),byweekday:Y.byweekday&&Y.byweekday.map(Oe=>Xx(Oe)),until:Y.until&&new Date(Math.min((Yi(Y.until)??Sa(D,{days:1})).getTime(),Sa(D,{days:1}).getTime())),wkst:Y.wkst&&Xx(Y.wkst)};new Wt(Object.entries(fe).filter(([Oe,ve])=>ve!==void 0).reduce((Oe,[ve,ye])=>(Oe[ve]=ye,Oe),{})).between(D,Sa(D,{days:1}),!0).forEach(Oe=>{Oe.getTime()!=te.getTime()&&oe.push({...L,[P]:_r(e.superstate,Oe,$s),[q]:_r(e.superstate,ad(Oe,Q),$s)})})}oe.forEach(Q=>{let fe=Hn(r).getTime(),Ie=Sa(r,{days:1}).getTime(),Se=Yi(Q[P]),Oe=Yi(Q[q])?Yi(Q[q]):Hn(Se).getTime()==Se.getTime()?Se:Sa(Se,{hours:1}),ve=Math.max(l*60,(Se.getTime()-fe)/6e4),ye=Math.min(Oe.getTime()-fe,Ie-fe)/6e4;if(Se.getTime()==Hn(Se).getTime()){T.push({index:_,start:Se,end:Oe,startOffset:l*60,endOffset:60*24,leftOffset:0,widthPercentage:100,column:0,columnTotal:1,allDay:!0});return}let ke=!1;for(let $=0;$=ce.startOffset-15&&ve<=ce.startOffset+15){ae.push({index:_,start:Se,end:Oe,repeat:!!Y,startOffset:ve,endOffset:ye}),ke=!0;break}}ke||I.push([{index:_,repeat:!!Y,start:Se,end:Oe,startOffset:ve,endOffset:ye}])})}),I.forEach((L,_)=>{L.forEach((Y,oe)=>{T.push({...Y,leftOffset:0,widthPercentage:100/L.length,column:oe,columnTotal:L.length})})}),T.sort((L,_)=>L.startOffset-_.startOffset);for(let L=0;LT[_].startOffset&&T[L].startOffsetu(e.data,r,e.field,e.fieldEnd,e.fieldRepeat),[e.data,r,e.field,e.fieldEnd,e.fieldRepeat]),[d,p]=(0,zc.useState)(null),[h,m]=(0,zc.useState)(null),[g,A]=(0,zc.useState)(null),[b,v]=(0,zc.useState)(null),x=()=>{p(null),m(null),A(null),v(null)},w=N=>Math.round(N/15)*15;Ca({onDragStart:N=>{N.active.data.current.type==="event"&&(p(N.active.data.current.index),o(null))},onDragOver:N=>{if(N.over?.id!=s||(p(N.active.data.current.index),N.active.data.current.type==="event"))return;let D=N.activatorEvent.clientY,P=N.over.rect.top;v(D-P),m(N.active?.data.current.path)},onDragMove:N=>{if(N.over?.id!=s)return;N.active.data.current.type!="event"&&m(N.active?.data.current.path);let D=N.over.rect,P=N.delta.y,q=2*Math.round(P/2);g!==q&&A(q)},onDragCancel:()=>{x()},onDragEnd:N=>{if(N.active.data.current.type==="event"&&N.over?.id==s){let{index:D}=N.active.data.current,P=f.find(I=>I.index==D);if(!P){x();return}let q=Sa(r,{minutes:Math.round(w(P.startOffset+g/t*60))}),z=Sa(r,{minutes:Math.round(w(P.endOffset+g/t*60))});e.updateItem({...e.data[D],[e.field]:_r(e.superstate,q,$s),[e.fieldEnd]:_r(e.superstate,z,$s)})}else if(h){let D=Sa(r,{minutes:Math.round(g/t*60)}),P=Sa(r,{minutes:Math.round(g/t*60)+60});e.insertItem({[e.field]:_r(e.superstate,D,$s),[e.fieldEnd]:_r(e.superstate,P,$s),[mt]:h})}x()}});let{setNodeRef:S}=zu({id:s,data:{type:"day-view",date:r}}),k=new Date().toDateString()===r.toDateString(),[j,O]=(0,zc.useState)(0),C=f.find(N=>N.index==d);return(0,zc.useEffect)(()=>{let N;return k&&(O((new Date().getHours()-l)*60+new Date().getMinutes()),N=setInterval(()=>{O((new Date().getHours()-l)*60+new Date().getMinutes())},6e4)),()=>{N&&clearInterval(N)}},[]),Bl.default.createElement("div",{className:"mk-day-view-container",style:{"--hour-height":`${t}px`}},e.header&&Bl.default.createElement(tE,{superstate:e.superstate,date:r,mode:"day",setDate:n}),e.gutter&&Bl.default.createElement("div",{className:"mk-day-view-all-day"},Bl.default.createElement("div",{className:"mk-day-view-gutter"},Bl.default.createElement("div",{className:"mk-day-view-hour-title"},"all day")),Bl.default.createElement("div",{className:"mk-day-view-hour"},f.filter(N=>N.allDay).map((N,D)=>Bl.default.createElement(I8,{superstate:e.superstate,key:D,index:N.index,startDay:0,endDay:0,topOffset:0,data:e.data[N.index],style:{position:"relative","--block-bg-color":cg(40,"#0098FF"),"--block-color":"#0098FF"}})))),Bl.default.createElement("div",{className:"mk-day-view"},e.gutter&&Bl.default.createElement(B8,{hourHeight:t,startHour:l,endHour:c}),Bl.default.createElement("div",{className:"mk-day-view-content",ref:S,onMouseDown:N=>{if(N.button!=0)return;let D=N.currentTarget.scrollTop,P=N.clientY-N.currentTarget.getBoundingClientRect().top+D;o({index:-1,startOffset:w((P/t+l)*60),endOffset:w((P/t+l)*60),leftOffset:0,widthPercentage:100,column:0,columnTotal:1})},onMouseMove:N=>{if(a){let D=N.currentTarget.scrollTop,P=N.clientY-N.currentTarget.getBoundingClientRect().top+D,q=w((P/t+l)*60);q<=a.startOffset?o({...a,startOffset:q}):o({...a,endOffset:q}),N.preventDefault()}},onMouseUp:N=>{if(!a||a.startOffset==a.endOffset){o(null);return}let D=Sa(r,{minutes:a.startOffset}),P=Sa(r,{minutes:a.endOffset});N.preventDefault();let q=N.currentTarget.getBoundingClientRect();e.superstate.ui.quickOpen(2,q,window,z=>{!z||e.insertItem({[e.field]:_r(e.superstate,D,$s),[e.fieldEnd]:_r(e.superstate,P,$s),[mt]:z})},i),o(null)}},Array.from({length:c-l}).map((N,D)=>Bl.default.createElement("div",{key:D,className:"mk-day-view-hour"})),k&&j>0&&Bl.default.createElement("div",{className:"mk-day-view-hour-current",style:{top:`${j*t/60}px`}}),f.filter(N=>!N.allDay).map((N,D)=>Bl.default.createElement(LD,{superstate:e.superstate,key:D,event:N,item:e.data[N.index],hourHeight:t,startHour:l,updateStartEnd:(P,q)=>{let z=Sa(r,{minutes:P}),I=Sa(r,{minutes:q});e.updateItem({...e.data[N.index],[e.field]:_r(e.superstate,z,$s),[e.fieldEnd]:_r(e.superstate,I,$s)})}})),a&&a.endOffset>a.startOffset&&Bl.default.createElement(LD,{superstate:e.superstate,event:a,item:{},hourHeight:t,startHour:l,clone:!0}),d!==null&&C?Bl.default.createElement(LD,{superstate:e.superstate,event:{...C,start:null,end:null,startOffset:Math.round(w(C.startOffset+g/t*60)),endOffset:Math.round(w(C.endOffset+g/t*60))},item:e.data[d],hourHeight:t,startHour:l,clone:!0}):h?Bl.default.createElement(LD,{superstate:e.superstate,event:{index:-1,startOffset:0,endOffset:60,leftOffset:0,widthPercentage:100,column:0,columnTotal:1},startHour:e.startHour,item:{[mt]:h},hourHeight:t,style:{transform:`translateY(${g+b}px)`},clone:!0}):null)))};var Rl=Ae(Te());var Rf=Ae(Te()),J6e=Ae(bl());var _Z=Ae(Te()),K6e=e=>{let{attributes:t,listeners:r,setNodeRef:n,transform:i}=Us({id:"day-"+e.date.getTime(),data:{type:"day",date:e.date.getTime()}}),{setNodeRef:a}=zu({id:"day-"+e.date.getTime(),data:{type:"day",weekStart:e.weekStart.getTime(),date:e.date.getTime()}}),o=e.date.toDateString()===new Date().toDateString(),s=r9(a,n);return _Z.default.createElement("div",{ref:s,...t,...r,className:`mk-month-day ${e.active?"mk-active":"mk-inactive"} ${o?"mk-today":""}`,onClick:l=>{l.detail==2&&e.insertItem(l)},style:{opacity:"1 !important"}},_Z.default.createElement("div",{className:"mk-month-day-number"},e.date.getDate()),e.children)};var yb=Ae(Te());var PZ=e=>{let{attributes:t,listeners:r,setNodeRef:n,transform:i}=Us({id:"event-"+e.index,data:{type:"event",index:e.index}}),a=(0,yb.useMemo)(()=>{let o=new Date(e.startEvent),s=`h${o.getMinutes()==0?"":":mm"} a`;return e.allDay?null:`${_r(e.superstate,o,s)}`},[e.startEvent,e.endEvent,e.allDay]);return yb.default.createElement("div",{className:"mk-month-event",ref:n,style:e.style,...t,...r},!e.allDay&&yb.default.createElement("div",{className:"mk-day-block-inner-indicator"}),yb.default.createElement(oo,{superstate:e.superstate,path:e.data[mt],hideIcon:!0}),yb.default.createElement("div",{className:"mk-day-block-time"},a))};var eCe=e=>{let t=mo(e.date),r=AA(t),{source:n}=(0,Rf.useContext)(Na),i=(0,Rf.useMemo)(()=>{let u=[];return e.events.forEach((c,f)=>{let d=[],p=or(c[e.fieldRepeat]),h=Yi(c[e.field]),m=Yi(c[e.fieldEnd])??h;if(h<=Mx(r)&&m>=Hn(t)&&d.push(c),p&&p.freq){let g=Yi(c[e.fieldEnd]).getTime()-h.getTime(),A={dtstart:h,freq:p.freq&&zM(p.freq),count:p.count&&Math.min(p.count,100),interval:parseInt(p.interval),byweekday:p.byweekday&&p.byweekday.map(x=>Xx(x)),until:Yi(p.until),wkst:p.wkst&&Xx(p.wkst)};new Wt(Object.entries(A).filter(([x,w])=>w!==void 0).reduce((x,[w,S])=>(x[w]=S,x),{})).between(Hn(t),Mx(r),!0).forEach(x=>{x.getTime()!=h.getTime()&&d.push({...c,[e.field]:_r(e.superstate,x,$s),[e.fieldEnd]:_r(e.superstate,ad(x,g),$s)})})}d.forEach(g=>{let A=Yi(g[e.field]),b=Yi(g[e.fieldEnd])??Hn(A).getTime()==A.getTime()?Hn(A):Ox(A,1),v=A>t?A:t,x=bc.startDay==f.startDay?c.endDay==f.endDay?c.allDay?-1:1:f.endDay-c.endDay:c.startDay-f.startDay),u.map((c,f,d)=>{let p=d.slice(0,f).reduce((h,m)=>m.endDay>=c.startDay?h+1:h,0);return{...c,offset:p}})},[e.events,e.fieldRepeat,e.field,e.fieldEnd,t,r]),[a,o]=(0,Rf.useState)(null),[s,l]=(0,Rf.useState)(null);return Ca({onDragStart:u=>{u.active.data.current.type=="day"&&l(new Date(u.active.data.current.date))},onDragOver:u=>{if(u.active?.data.current.type=="day"&&u.over?.data.current.type=="day"){let c=new Date(u.over?.data.current.date),f=c>s?s:c,d=c>s?c:s;if(f>=r||d<=t){o(null);return}let p=i.reduce((h,m)=>m.endDay>=r.getDay()?h+1:h,0);o({offset:p,index:-1,startDay:td?d.getDay():r.getDay(),allDay:!1,startTime:f.getTime(),endTime:d.getTime()})}},onDragEnd:u=>{if(a&&u.over?.data.current.weekStart==t.getTime()){let c=_r(e.superstate,s,"yyyy-MM-dd"),f=_r(e.superstate,new Date(u.over.data.current.date),"yyyy-MM-dd"),d=u.over?.data?.current?.rect;e.superstate.ui.quickOpen(2,d,window,p=>{p&&e.insertItem({[mt]:p,[e.field]:c,[e.fieldEnd]:f}),o(null)},n)}else o(null);l(null)}}),Rf.default.createElement("div",{className:"mk-month-week"},Array.from({length:7}).map((u,c)=>{let f=Sa(t,{days:c}),d=f.getMonth()===e.date.getMonth();return Rf.default.createElement(K6e,{key:c,superstate:e.superstate,weekStart:t,active:d,date:f,insertItem:p=>{let h=i.reduce((v,x)=>{let w=Yi(e.events[x.index])?.getHours();return w>v?w:v},9),m=_r(e.superstate,Ox(Hn(f),h),$s),g=_r(e.superstate,Ox(Hn(f),h+1),$s),A=i.reduce((v,x)=>x.endDay>=c?v+1:v,0);o({offset:A,index:-1,startDay:c,endDay:c,startTime:Hn(f).getTime(),endTime:Mx(f).getTime(),allDay:!1});let b=p.currentTarget.getBoundingClientRect();e.superstate.ui.quickOpen(2,b,window,v=>{v&&e.insertItem({[mt]:v,[e.field]:m,[e.fieldEnd]:g}),o(null)})}},a?.startDay==c&&Rf.default.createElement(PZ,{superstate:e.superstate,index:-1,style:{"--block-bg-color":cg(40,"#0098FF"),"--block-color":"#0098FF","--block-text-color":"var(--mk-ui-text-accent)",top:`${30}px`,width:`${(a.endDay-a.startDay+1)*100}%`},data:{[mt]:"New Event"},startEvent:a.startTime,endEvent:a.endTime,allDay:!1}),i.filter(p=>p.startDay==c).map((p,h)=>{let m=a?p.startDay<=a.endDay&&p.endDay>=a.startDay:!1;return Rf.default.createElement(PZ,{superstate:e.superstate,key:h,index:p.index,startEvent:p.startTime,endEvent:p.endTime,allDay:p.allDay,style:{"--block-bg-color":p.allDay?cg(40,"#0098FF"):"transparent","--block-color":"#0098FF","--block-text-color":p.allDay?"var(--mk-ui-text-accent)":"var(--mk-ui-text-primary)",top:`${p.offset*22+30+(m?22:0)}px`,width:`${(p.endDay-p.startDay+1)*100}%`},data:e.events[p.index]})}))}),s&&(0,J6e.createPortal)(Rf.default.createElement(Um,{dropAnimation:WU}),document.body))};var tCe=e=>{let[t,r]=(0,Rl.useState)(e.date??new Date),n=(0,Rl.useMemo)(()=>{let o=Wo(t),s=Jg(t),l=[],u=o;for(;u<=s;)l.push(u),u=Xg(u,1);return l},[t]),[i,a]=(0,Rl.useState)(null);return Ca({onDragStart:o=>{a(o.active.id)},onDragEnd:o=>{a(null)}}),Rl.default.createElement("div",{className:"mk-month-grid"},e.header&&Rl.default.createElement(tE,{superstate:e.superstate,date:t,setDate:r,mode:"month"}),Rl.default.createElement("div",{className:"mk-month-header"},Rl.default.createElement("div",null,"S"),Rl.default.createElement("div",null,"M"),Rl.default.createElement("div",null,"T"),Rl.default.createElement("div",null,"W"),Rl.default.createElement("div",null,"T"),Rl.default.createElement("div",null,"F"),Rl.default.createElement("div",null,"S")),n.map((o,s)=>Rl.default.createElement(eCe,{key:s,superstate:e.superstate,date:o,events:e.data,field:e.field,fieldEnd:e.fieldEnd,fieldRepeat:e.fieldRepeat,insertItem:e.insertItem,updateItem:e.updateItem})))};var Ds=Ae(Te());var $8=Ae(Te());var rCe=e=>{let{source:t}=(0,$8.useContext)(Na),{setNodeRef:r}=zu({id:"allday-"+e.date.toISOString()});return $8.default.createElement("div",{className:"mk-week-view-all-day-cell",ref:r,onClick:i=>{if(i.stopPropagation(),i.detail===2){let a=i.currentTarget.getBoundingClientRect();e.superstate.ui.quickOpen(2,a,Ne(i.currentTarget.ownerDocument),o=>{e.insertItem(o)},t)}},style:{"--block-bg-color":cg(40,"#0098FF"),"--block-color":"#0098FF","--block-text-color":"var(--mk-ui-text-accent)",height:`${e.height*24}px`}},e.children)};var nCe=e=>{let t=e.hourHeight,[r,n]=(0,Ds.useState)(e.weekStart??mo(new Date)),i=e.startHour??0,a=e.endHour??24,[o,s]=(0,Ds.useState)(0),l=(0,Ds.useMemo)(()=>{let u=[];e.data.forEach((f,d)=>{let p=Yi(f[e.field]),h=Yi(f[e.fieldEnd])??p;h>=r&&p<=Sa(r,{days:7})&&Hn(p).getTime()==p.getTime()&&Hn(h).getTime()==h.getTime()&&u.push({index:d,startDay:new Date(Math.max(r.getTime(),p.getTime())).getDay(),endDay:new Date(Math.min(Sa(r,{days:7}).getTime(),h.getTime())).getDay(),topOffset:0})});let c=0;return u.forEach((f,d)=>{for(let p=0;p=f.endDay&&u[p].topOffset==u[d].topOffset&&(u[d].topOffset+=1,c=Math.max(c,u[d].topOffset))}),s(c),u},[e.data,r,e.field,e.weekStart]);return Ds.default.createElement("div",{className:"mk-week-view",style:{"--hour-height":`${t}px`}},e.header&&Ds.default.createElement(tE,{superstate:e.superstate,date:r,mode:"week",setDate:n}),Ds.default.createElement("div",{className:"mk-week-view-header"},Ds.default.createElement("div",{className:"mk-day-view-gutter"}),Array.from({length:7}).map((u,c)=>Ds.default.createElement("div",{key:c},_r(e.superstate,Sa(r,{days:c}),"EEE d")))),Ds.default.createElement("div",{className:"mk-week-view-all-day"},Ds.default.createElement("div",{className:"mk-day-view-gutter"},Ds.default.createElement("div",{className:"mk-day-view-hour-title",style:{height:`${o*30}px`}},"all day")),Array.from({length:7}).map((u,c)=>Ds.default.createElement(rCe,{key:c,height:o+1,superstate:e.superstate,date:oa(r,c),insertItem:f=>{e.insertItem({[e.field]:_r(e.superstate,oa(r,c),"yyyy-MM-dd"),[e.fieldEnd]:_r(e.superstate,oa(r,c),"yyyy-MM-dd"),[mt]:f})}},l.filter(f=>f.startDay==c).map((f,d)=>Ds.default.createElement(I8,{superstate:e.superstate,data:e.data[f.index],index:f.index,startDay:f.startDay,endDay:f.endDay,topOffset:f.topOffset,key:d}))))),Ds.default.createElement("div",{className:"mk-week-view-content"},Ds.default.createElement(B8,{hourHeight:t,startHour:i,endHour:a}),Array.from({length:7}).map((u,c)=>Ds.default.createElement(R8,{superstate:e.superstate,key:_r(e.superstate,Sa(r,{days:c})),field:e.field,fieldEnd:e.fieldEnd,fieldRepeat:e.fieldRepeat,date:Sa(r,{days:c}),data:e.data,hourHeight:t,startHour:i,endHour:a,insertItem:f=>{e.insertItem(f)},updateItem:f=>{e.updateItem(f)}}))))};var iCe=Ae(yi()),$o=Ae(Te());var stt=e=>e.node.type=="column"&&e.children.length==1,ltt=e=>e.node.type=="container"&&e.children.length==1,utt=e=>e.node.type=="container"&&e.children.length==2,zD=(e,t,r,n,i)=>{let a=e;if(a.schemaId!=r.id){a=sf("$root",r.id,a,r.id);let d=Mi(a.id,n.map(p=>p.id));a=sf(a.id,d,a,r.id),a.id=d,a.schemaId=r.id}let o=[],s=[];if(a.id==t.id)return[[],[]];let l=r.node.schemaId,u=pc(r,t.id),c=pc(r,a.id);if(!u)return[[],[]];let f=t.node.type=="column";if(i=="inside"){let d={...a,parentId:t.node.id};o.push(d)}else if(f||r.editorProps.editMode==1&&t.node.parentId==r.id&&(i=="left"||i=="right")){let d=t.node.parentId==r.id,p=t.node.type=="container",h=t.node.type=="column",m=!1;h&&u.node.parentId==r.id&&(m=!0);let g=d&&!p,A=d&&p||h&&m;if(g){let b={...z1(rre,u.id,n,l),rank:t.node.rank},v={...z1(aj,b.id,[...n,b],l),rank:i=="left"?1:0},x={...z1(aj,b.id,[...n,b,v],l),rank:i=="left"?0:1},w=[b,v,x,{...t.node,rank:0,parentId:v.id}];o.push(...w,{...a,rank:0,parentId:x.id})}else if(A){let b=p?t.id:t.node.parentId,v={...z1(aj,b,n,l),rank:i=="left"?p?0:t.node.rank:p?t.children.length:t.node.rank+1},x=[v,{...a,parentId:v.id}];o.push(...x)}}else{let d=n.filter(A=>A.parentId==u.id&&A.id!=a.id).sort((A,b)=>A.rank-b.rank).map((A,b)=>({...A,rank:b})),p=d.find(A=>A.id==t.id)?.rank??0,h=i=="bottom"||i=="right"?p+1:p,m={...a,parentId:t.node.parentId},g=Cx(d,h,m).map((A,b)=>({...A,rank:b}));o.push(...g)}if(c&&stt(c)){let d=pc(r,c.id);if(s.push(c.node),ltt(d))s.push(d.node);else if(utt(d)){let p=d.children.filter(m=>m.id!=c.id);s.push(...p.map(m=>m.node),d.node);let h=p.flatMap(m=>m.children.map(g=>({...g.node,parentId:r.id,rank:d.node.rank})));h.push(...o.filter(m=>p.some(g=>g.id==m.parentId))),o=[...o.map(m=>h.some(g=>g.id==m.id)?{...m,parentId:r.id}:m),...h.filter(m=>!o.some(g=>m.id==g.id))]}}return[o,s]};var $l=Ae(Te());var q8=e=>{let{spaceInfo:t}=(0,$l.useContext)(ur),{undoLastAction:r,redoAction:n,frameSchema:i}=(0,$l.useContext)(ma),{nodes:a,addNode:o,saveNodes:s,setLastCreatedId:l}=(0,$l.useContext)(Wi),{hoverNode:u,setHoverNode:c,instance:f,id:d}=(0,$l.useContext)(_i),{selectionMode:p,selection:h,select:m}=(0,$l.useContext)(Hi),g=()=>{c(null)};Ca({onDragOver:({active:v,over:x})=>{let w=x?.data.current.node;x?.data.current.root==d?w&&c({id:x?.data.current.id,node:x?.data.current.node,direction:x?.data.current?.direction}):c(null)},onDragCancel:()=>{g()},onDragEnd:({active:v,over:x})=>{if(!v||!u){g();return}let w=u?.node;if(w==v.data.current.id||u?.id!=x.data.current.id){g();return}let k=pc(f.exec,w)?.children.find(j=>j.id==w);if(v.data.current.type=="node"){let O=pc(f.exec,v.data.current.node)?.children.find(C=>C.id==v.data.current.node);if(k&&O){let[C,N]=zD(O.node,k,f.exec,a,u.direction);s(C,N)}}else if(v.data.current.type=="property"){if(v.data.current.path==t.path&&k){let[j,O]=zD(A(v.data.current.property,v.data.current.context),k,f.exec,a,u.direction);s(j,O)}}else if(v.data.current.type=="listItem"){if(k){let[j,O]=zD({...Mo.node,props:{value:`'${v.data.current.contexts?.$context?._keyValue}'`}},k,f.exec,a,u.direction);s(j,O)}}else if(v.data.current.type=="context"&&k){let j=e.superstate.spacesIndex.get(v.data.current.space);if(j){let[O,C]=zD({...f0.node,props:{value:jr(rb(j,v.data.current.schema))}},k,f.exec,a,u.direction);s(O,C)}}g()}});let A=(v,x)=>{let w=mn.node;return v.type=="boolean"?w={...V1.node,styles:{...V1.node.styles,as:"'checkbox'"}}:v.type=="link"||v.type=="context"||v.type=="file"?w=Mo.node:v.type=="image"&&(w=uf.node),w.type=="input"?w={...w,props:{...w.props,value:jr(v.name)}}:x.length>0?w={...w,props:{...w.props,value:`$contexts['${x}']['${v.name}']`}}:w={...w,props:{...w.props,value:`${i.id}.props['${v.name}']`}},w},b=(0,$l.useCallback)(v=>{if(v.key=="ArrowUp"&&h.length>0){let x=a.find(w=>w.id==h[0]);if(x){let w=pc(f.exec,x.id);if(w){let S=w.children.find(k=>k.id==x.id).node.rank;S>0&&m(w.children.find(k=>k.node.rank==S-1)?.id)}}}if(v.key=="ArrowDown"&&h.length>0){let x=a.find(w=>w.id==h[0]);if(x){let w=pc(f.exec,x.id);if(w){let S=w.children.find(k=>k.id==x.id).node.rank;Sk.node.rank==S+1)?.id)}}}(v.key=="Delete"||v.key=="Backspace")&&h.length>0&&s([],h.map(x=>a.find(w=>w.id==x)).filter(x=>x)),v.key=="z"&&v.metaKey&&(v.shiftKey?n():r())},[h,a,r,n,s]);return(0,$l.useEffect)(()=>(e.superstate.ui.inputManager.on("keydown",b),()=>{e.superstate.ui.inputManager.off("keydown",b)}),[b]),$l.default.createElement($l.default.Fragment,null,f.exec&&$l.default.createElement("div",{className:"mk-f-root",style:{position:"relative"}},p>=3&&$l.default.createElement("div",{className:"mk-f-root-label",onClick:v=>{m(f.exec.id),v.stopPropagation()}},f.exec.node.name),f.exec.children.length==0&&i.id=="main"&&$l.default.createElement("button",{onClick:()=>{e.superstate.spaceManager.saveFrame(t.path,aw.main)}},"+ Add View"),$l.default.createElement($D,{key:t.path,superstate:e.superstate,treeNode:f.exec,instance:f,containerRef:e.containerRef},e.children)))};var UD=e=>{let[t,r]=(0,$o.useState)(e.contexts);(0,$o.useEffect)(()=>r(g=>iCe.default.isEqual(e.contexts,g)?g:e.contexts),[e.contexts]);let{spaceInfo:n}=(0,$o.useContext)(ur),{dbSchema:i}=(0,$o.useContext)(Na),{setDragNode:a}=(0,$o.useContext)(vh),o=$o.default.useRef(null),{attributes:s,listeners:l,active:u,setNodeRef:c,transform:f,isDragging:d,transition:p,isOver:h,over:m}=Noe({id:e.id,data:{id:e.id,type:e.type,space:n?.path,schema:i?.id,props:e.props,contexts:t},disabled:e.type!="listItem"||e.editMode>0,animateLayoutChanges:VU});return Ca({onDragStart:g=>{g.active.data.current.id==e.id&&a($o.default.createElement("div",{dangerouslySetInnerHTML:{__html:o.current.innerHTML}}))},onDragOver:g=>{},onDragEnd:({active:g,over:A})=>{let b=A&&A.data.current.space==n?.path&&A.data.current.schema==i?.id;ctt(b,A,e,g,n)}}),e.editMode>=1&&e.uri.authority!="$kit"?$o.default.createElement(Tv,{superstate:e.superstate,id:e.id,editMode:e.editMode,selected:e.editMode==3},$o.default.createElement(ug,{id:e.id,superstate:e.superstate,props:e.props,propSetters:e.propSetters,contexts:t,editable:!0},$o.default.createElement(q8,{superstate:e.superstate,containerRef:e.containerRef},e.children))):$o.default.createElement($o.default.Fragment,null,m?.id==e.id&&u.data.current.type==e.type&&!(u.data.current.space==n?.path&&u.data.current.schema==i?.id&&u.data.current.props?._groupValue==e.props?._groupValue)&&$o.default.createElement(ug,{id:e.id,superstate:e.superstate,props:e.props,propSetters:e.propSetters,contexts:t,editable:!1},$o.default.createElement(vb,{superstate:e.superstate})),$o.default.createElement("div",{ref:g=>{c(g),o.current=g},...s,...l,style:{transform:Lu.Transform.toString(f),transition:p}},$o.default.createElement(ug,{id:e.id,superstate:e.superstate,props:e.props,propSetters:e.propSetters,contexts:t,editable:!1},$o.default.createElement(vb,{superstate:e.superstate},e.children))))},ctt=async(e,t,r,n,i)=>{if(e&&t.id==r.id)if(n.data.current.schema==Er){let a=n.data.current.contexts?.$context?._keyValue,o=t.data.current.contexts?.$context,s=r.props?._groupValue!=n.data.current.props?._groupValue;a&&o&&(s?pi(r.superstate,a,{[r.props?._groupField]:r.props?._groupValue}):GS(r.superstate,a,o._index,i.path))}else{let a=t.data.current.contexts?.$context;_oe(r.superstate.spaceManager,i,n.data.current.schema,n.data.current.contexts?.$context?._index,r.props?._groupField,r.props?._groupValue,a?._index)}};var Eo=Ae(Te());var rE=Ae(Te()),aCe=e=>{let t=(0,rE.useRef)(null);return(0,rE.useEffect)(()=>{let r=new IntersectionObserver(n=>{n[0].isIntersecting&&e.onScroll()},{threshold:1});return t.current&&r.observe(t.current),()=>{t.current&&r.unobserve(t.current)}},[t]),rE.default.createElement("div",{ref:t})};var nE=Ae(Te());var bb=e=>{let{selected:t}=(0,nE.useContext)(Hi);return e.editMode>=1&&e.uri.authority!="$kit"?nE.default.createElement(pv,{superstate:e.superstate,schema:e.uri.ref},nE.default.createElement(FEe,{superstate:e.superstate,cols:e.cols,editMode:e.editMode},e.children)):nE.default.createElement(F9,{superstate:e.superstate,path:e.uri,cols:e.cols},e.children)};var oCe=e=>{let{editSection:t,selectedIndex:r,setSelectedIndex:n,groupURI:i,itemURI:a}=e,{readMode:o}=(0,Eo.useContext)($r),{spaceInfo:s,spaceState:l}=(0,Eo.useContext)(ur),{predicate:u,filteredData:c,editMode:f,sortedColumns:d,contextTable:p,cols:h,dbSchema:m,source:g}=(0,Eo.useContext)(Na),[A,b]=(0,Eo.useState)(1),v=25,{instance:x}=(0,Eo.useContext)(_i),w=u?.groupBy?.length>0?h.find(P=>P.name+P.table==u.groupBy[0]):null,S=(0,Eo.useMemo)(()=>{let P=x?.state[x?.root?.id].props?.groupOptions;return P?dl(P):w?kr(["",...(pr(w.value,w.type,e.superstate)?.options??[]).map(z=>z.value),...c.reduce((z,I)=>[...z,I[w.name+w.table]??""],[])]):[""]},[w,c,x]),k=(0,Eo.useMemo)(()=>{let P=x?.state[x?.root?.id].props?.groupFilter;return qi[P]??qi.is},[x]),j=(0,Eo.useMemo)(()=>S.reduce((P,q)=>{let[z,I]=P;if(!w)return[q==""?{...z,[q]:c.map((L,_)=>({...L,_pageId:I+_}))??[]}:{...z,[q]:[]},I+c.length];let T=c.filter(L=>k.fn(L[w.name+w.table],q));return[T.length>0?{...z,[q]:T.map((L,_)=>({...L,_pageId:I+_}))}:{...z,[q]:[]},I+T.length]},[{},0])[0],[c,S,k,w]),O=(0,Eo.useMemo)(()=>h.find(P=>P.primary=="true")?.name,[h]),C=(0,Eo.useMemo)(()=>d.filter(P=>!u?.colsHidden.includes(P.name)),[u,d]),N={_path:g,_schema:m?.id,_key:O,_properties:C},D=(0,Eo.useMemo)(()=>m?m?.primary=="true"?c.reduce((P,q)=>({...P,[q._index]:{$context:{_index:q._index,_keyValue:q[O],_schema:m.id,_name:e.superstate.pathsIndex.get(q[O])?.name,...N},$properties:h,[g]:h.reduce((z,I)=>({...z,[I.name]:q[I.name]}),{}),...Object.keys(p).filter(z=>l.contexts.some(I=>Wn(I)==z)).reduce((z,I)=>({...z,[I]:p[I].cols.reduce((T,L)=>({...T,[L.name]:q[L.name+I]}),{})}),{})}}),{}):c.reduce((P,q)=>({...P,[q._index]:{$context:{_index:q._index,_keyValue:q[O],_schema:m.id,_name:q[O],...N},$properties:h,[g]:h.reduce((z,I)=>({...z,[I.name]:q[I.name]}),{})}}),{}):{},[c,h,g,p,l]);return Eo.default.createElement(bb,{superstate:e.superstate,uri:i,editMode:t=="listGroup"?f:0,cols:[]},Eo.default.createElement(HU,{items:Object.keys(j).map((P,q)=>s.path+"listGroup"+q),strategy:q6},Object.keys(j).map((P,q)=>Eo.default.createElement(UD,{key:"listGroup"+q,id:s.path+"listGroup"+q,type:"listGroup",superstate:e.superstate,uri:i,props:{_selectedIndex:r,_groupValue:P,_groupField:w?.name,_groupType:w?.type,_readMode:o,...u.listGroupProps},propSetters:null,editMode:t=="listGroup"?f:0,cols:[],containerRef:e.containerRef,contexts:{$context:N}},Eo.default.createElement(bb,{uri:a,superstate:e.superstate,cols:[],editMode:t=="listItem"?f:0},Eo.default.createElement(HU,{items:j[P].flatMap((z,I)=>s.path+"listGroup"+q+"_listItem"+I),strategy:q6},j[P].filter(z=>parseInt(z._pageId)<=A*v).map((z,I)=>parseInt(z._pageId)==A*v?Eo.default.createElement(aCe,{key:I,onScroll:()=>b(T=>T+1)}):Eo.default.createElement(UD,{key:"listGroup"+q+"_listItem"+I,id:s.path+"listGroup"+q+"_listItem"+I,type:"listItem",uri:a,superstate:e.superstate,cols:[],props:{_selectedIndex:r,_groupValue:P,_groupField:w?.name,_readMode:o,...u.listItemProps},propSetters:{_selectedIndex:n},containerRef:e.containerRef,editMode:t=="listItem"?f:0,contexts:D[z._index]}))))))))};var eE=e=>{let{pathState:t}=(0,ta.useContext)($r),{predicate:r,editMode:n,setEditMode:i,dbSchema:a,tableData:o,data:s,updateRow:l}=(0,ta.useContext)(Na),{frameSchema:u}=(0,ta.useContext)(ma),[c,f]=(0,ta.useState)(null),[d,p]=(0,ta.useState)(null),[h,m]=(0,ta.useState)(r?{listView:e.superstate.spaceManager.uriByString(mA(r.listView,"spaces://$kit/#*listView"),t.path),listGroup:e.superstate.spaceManager.uriByString(mA(r.listGroup,"spaces://$kit/#*listGroup"),t.path),listItem:e.superstate.spaceManager.uriByString(mA(r.listItem,"spaces://$kit/#*rowItem"),t.path)}:null);(0,ta.useEffect)(()=>{if(!r)return;let A={listView:e.superstate.spaceManager.uriByString(mA(r.listView,"spaces://$kit/#*listView"),t.path),listGroup:e.superstate.spaceManager.uriByString(mA(r.listGroup,"spaces://$kit/#*listGroup"),t.path),listItem:e.superstate.spaceManager.uriByString(mA(r.listItem,"spaces://$kit/#*rowItem"),t.path)};m(b=>sCe.default.isEqual(A,b)?b:A)},[r,t]);let g=A=>{A.key=="Escape"&&p(null),A.key!="Enter"&&(A.key=="ArrowDown"&&(p(b=>b==null?"0":(parseInt(b)+1).toString()),A.preventDefault()),A.key=="ArrowUp"&&(p(b=>b==null||b=="0"?null:(parseInt(b)-1).toString()),A.preventDefault()),A.key=="ArrowLeft",A.key=="ArrowRight")};return o?ta.default.createElement("div",{className:"mk-context-container"},!e.minMode&&ta.default.createElement(w9,{showTitle:e.showTitle,superstate:e.superstate,setView:e.setView}),h?r.view=="table"||r.view=="db"||a?.primary!="true"&&!u?ta.default.createElement(pEe,{superstate:e.superstate}):r.view=="day"?ta.default.createElement(R8,{superstate:e.superstate,field:r.listViewProps?.start||"start",fieldEnd:r.listViewProps?.end||"end",fieldRepeat:r.listViewProps?.repeat,startHour:r.listViewProps?.startOfDay??0,endHour:r.listViewProps?.endOfDay??24,gutter:!0,header:r.listViewProps?.hideHeader!=!0,hourHeight:60,data:s,insertItem:A=>{l(A,-1)},updateItem:A=>{l(A,parseInt(A._index))}}):r.view=="week"?ta.default.createElement(nCe,{superstate:e.superstate,field:r.listViewProps?.start||"start",fieldEnd:r.listViewProps?.end||"end",fieldRepeat:r.listViewProps?.repeat,startHour:r.listViewProps?.startOfDay??0,endHour:r.listViewProps?.endOfDay??24,hourHeight:40,header:r.listViewProps?.hideHeader!=!0,data:s,insertItem:A=>{l(A,-1)},updateItem:A=>{l(A,parseInt(A._index))}}):r.view=="month"?ta.default.createElement(tCe,{superstate:e.superstate,data:s,field:r.listViewProps?.start||"start",fieldEnd:r.listViewProps?.end||"end",fieldRepeat:r.listViewProps?.repeat,header:!0,insertItem:A=>{l(A,-1)},updateItem:A=>{l(A,parseInt(A._index))}}):ta.default.createElement("div",{className:"mk-editor-context",onKeyDown:g},ta.default.createElement(Tv,{superstate:e.superstate,id:"list",editMode:c=="listView"?n:0},n>0&&ta.default.createElement(e2e,{editSection:c,superstate:e.superstate,setEditSection:f,setEditMode:i}),ta.default.createElement(bb,{superstate:e.superstate,uri:h.listView,cols:[],editMode:c=="listView"?n:0},ta.default.createElement(UD,{superstate:e.superstate,id:"listView",type:"listView",uri:h.listView,props:{_selectedIndex:d,...r.listViewProps},propSetters:{_selectedIndex:p},containerRef:e.containerRef,editMode:c=="listView"?n:0,cols:[],contexts:null},ta.default.createElement(oCe,{superstate:e.superstate,containerRef:e.containerRef,editSection:c,selectedIndex:d,setSelectedIndex:p,groupURI:h.listGroup,itemURI:h.listItem}))))):ta.default.createElement(ta.default.Fragment,null)):ta.default.createElement(ta.default.Fragment,null)};var IZ=e=>iE.default.createElement(Qs,{superstate:e.superstate,path:e.space.path,readMode:!1},iE.default.createElement(lh,{superstate:e.superstate},iE.default.createElement(pv,{superstate:e.superstate,schema:e.schema},iE.default.createElement(h2,{superstate:e.superstate},iE.default.createElement(eE,{showTitle:!1,superstate:e.superstate})))));var $h=Ae(yi()),Ku=Ae(Te()),yu=(0,Ku.createContext)({dragPaths:[],setDragPaths:$h.default.noop,selectedPaths:[],setSelectedPaths:$h.default.noop,activePath:null,setActivePath:$h.default.noop,activeFocus:0,setActiveFocus:$h.default.noop,activeViewSpaces:[],focuses:[],setFocuses:$h.default.noop,saveActiveSpace:$h.default.noop,closeActiveSpace:$h.default.noop,modifier:null,setModifier:$h.default.noop,editFocus:!1,setEditFocus:$h.default.noop}),lCe=e=>{let[t,r]=(0,Ku.useState)(null),[n,i]=(0,Ku.useState)([]),[a,o]=(0,Ku.useState)([]),[s,l]=(0,Ku.useState)(null),[u,c]=(0,Ku.useState)(!1),[f,d]=(0,Ku.useState)(e.superstate.focuses),[p,h]=(0,Ku.useState)(e.superstate.settings.currentWaypoint),[m,g]=(0,Ku.useState)((e.superstate.focuses[p]?.paths??[]).map(S=>e.superstate.pathsIndex.get(S)).filter(S=>S)),A=S=>{let k=e.superstate.focuses[p]??{sticker:"",name:"Waypoint",paths:[]};k.paths=[...k.paths.filter(O=>O!=S),S],p>e.superstate.focuses.length&&e.superstate.spaceManager.saveFocuses([...e.superstate.focuses,k]);let j=e.superstate.focuses.map((O,C)=>C==p?k:O);e.superstate.spaceManager.saveFocuses(j.filter(O=>O))},b=S=>{let k=e.superstate.focuses[p]??{sticker:"",name:"Waypoint",paths:[]};k.paths=[...k.paths.filter(O=>O!=S)],p>e.superstate.focuses.length&&e.superstate.spaceManager.saveFocuses([...e.superstate.focuses,k]);let j=e.superstate.focuses.map((O,C)=>C==p?k:O);e.superstate.spaceManager.saveFocuses(j.filter(O=>O))},v=S=>{e.superstate.spaceManager.saveFocuses(S.filter(k=>k))},x=S=>{e.superstate.focuses[e.superstate.settings.currentWaypoint]?.paths?.includes(S.path)&&g((e.superstate.focuses[e.superstate.settings.currentWaypoint]?.paths??[]).map(k=>e.superstate.pathsIndex.get(k)).filter(k=>k))},w=()=>{d(e.superstate.focuses);let S=e.superstate.settings.currentWaypoint;h(S),g((e.superstate.focuses[S]?.paths??[]).map(k=>e.superstate.pathsIndex.get(k)).filter(k=>k))};return(0,Ku.useEffect)(()=>(e.superstate.eventsDispatcher.addListener("spaceStateUpdated",x),e.superstate.eventsDispatcher.addListener("settingsChanged",w),e.superstate.eventsDispatcher.addListener("focusesChanged",w),e.superstate.eventsDispatcher.addListener("superstateUpdated",w),()=>{e.superstate.eventsDispatcher.removeListener("spaceStateUpdated",x),e.superstate.eventsDispatcher.removeListener("settingsChanged",w),e.superstate.eventsDispatcher.removeListener("focusesChanged",w),e.superstate.eventsDispatcher.removeListener("superstateUpdated",w)}),[]),Ku.default.createElement(yu.Provider,{value:{dragPaths:n,setDragPaths:i,activeFocus:p,selectedPaths:a,setSelectedPaths:o,activePath:s,setActiveFocus:h,setActivePath:l,activeViewSpaces:m,focuses:f,setFocuses:v,saveActiveSpace:A,closeActiveSpace:b,modifier:t,setModifier:r,editFocus:u,setEditFocus:c}},e.children)};var Q8=Ae(Te());var iDe=Ae(yi());function ftt(e,t){return e?e.item?.type=="space"&&!e.collapsed&&t?e.depth+1:e.depth:0}function dtt(e){return e?Math.max(0,e.depth-1):0}function uCe(e,t){return Math.round(e/t)}var ptt=(e,t,r,n)=>{let i=e[r];if(!i)return;let a=i.type=="file"?e.find(o=>o.id==i.parentId):i;return a&&a.type!="file"?{depth:i.depth,overId:i.id,parentId:a.id,sortable:!1,insert:a.collapsed,droppable:!0,copy:n=="link"||n=="copy",reorder:!1}:null};function cCe(e,t,r,n,i,a,o,s,l){if(r.length==0)return null;if(r.length>1)return ptt(t,r,n,s);let u=t[n],c=t[n],f=t[n+1];if(!c)return;let d=c.type!="file",p=e.depth>0&&u.collapsed&&d&&(!u.sortable||o&&a<=13||!o&&a>=13),h=u.sortable||d&&!p&&f.sortable,m=i,g=e.depth==0?0:ftt(c,o),A=dtt(c),b=m;m>=g?b=g:mS.id==v);return{depth:b,overId:c.id,parentId:v,sortable:h,insert:p,droppable:x?.type!="file",copy:s=="link"||s=="copy",reorder:p?e?.parentId==u?.id:e?.parentId==x?.id||e?.parentId==l};function w(){return b===0||!c?null:b===c.depth||b>c.depth&&c.item.type!="space"?c.parentId:b>c.depth?c.id:t.slice(0,n).reverse().find(k=>k.depth===b)?.parentId??null}}var fCe=()=>window.navigator.platform.startsWith("Mac")?"\u2325":"Alt";var Jr=Ae(Te());var dCe=Ae(Ya());var ts=Ae(Te());var pCe=e=>{let{saveActiveSpace:t,editFocus:r,activeFocus:n,setFocuses:i,focuses:a,setEditFocus:o}=(0,ts.useContext)(yu),[s,l]=(0,ts.useState)(e.focus);return(0,ts.useEffect)(()=>{l(e.focus)},[e.focus]),s&&e.focus?e.focus.name?.length==0||r?ts.default.createElement("div",{className:"mk-path-tree-focus"},ts.default.createElement("div",{className:(0,dCe.default)("mk-focuses-item"),dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker(s.sticker)},onClick:u=>e.superstate.ui.openPalette(ts.default.createElement(Ta,{ui:e.superstate.ui,selectedSticker:c=>{l({...s,sticker:c})}}),Ne(u.view.document))}),ts.default.createElement("input",{value:s.name,onChange:u=>l({...s,name:u.target.value})}),ts.default.createElement("div",{className:"mk-button-group"},ts.default.createElement("button",{onClick:()=>e.saveFocus(s)},H.buttons.save),ts.default.createElement("button",{onClick:()=>{e.focus.name.length==0?(i(a.filter((u,c)=>c!=n)),e.superstate.saveSettings()):o(!1)}},H.buttons.cancel))):ts.default.createElement("div",{className:"mk-path-tree-empty"},ts.default.createElement("div",{className:"mk-empty-state-title"},"Open a Space"),ts.default.createElement("div",{className:"mk-empty-state-description"},"Open an existing folders and tags as a space or create a new one"),ts.default.createElement("button",{onClick:u=>{let c=u.target.getBoundingClientRect();e.superstate.ui.quickOpen(2,c,Ne(u.view.document),f=>{if(!e.superstate.pathsIndex.has(f)){kf(e.superstate,f,{}).then(p=>{t(f),e.superstate.ui.openPath(f,!1)});return}t(f)})}},"Open a Space")):ts.default.createElement(ts.default.Fragment,null)};var U8=Ae(Ya());var Zn=Ae(Te());var dn=Ae(Te()),Gi=Ae(xCe());var Att=new Map([["aac","audio/aac"],["abw","application/x-abiword"],["arc","application/x-freearc"],["avif","image/avif"],["avi","video/x-msvideo"],["azw","application/vnd.amazon.ebook"],["bin","application/octet-stream"],["bmp","image/bmp"],["bz","application/x-bzip"],["bz2","application/x-bzip2"],["cda","application/x-cdf"],["csh","application/x-csh"],["css","text/css"],["csv","text/csv"],["doc","application/msword"],["docx","application/vnd.openxmlformats-officedocument.wordprocessingml.document"],["eot","application/vnd.ms-fontobject"],["epub","application/epub+zip"],["gz","application/gzip"],["gif","image/gif"],["heic","image/heic"],["heif","image/heif"],["htm","text/html"],["html","text/html"],["ico","image/vnd.microsoft.icon"],["ics","text/calendar"],["jar","application/java-archive"],["jpeg","image/jpeg"],["jpg","image/jpeg"],["js","text/javascript"],["json","application/json"],["jsonld","application/ld+json"],["mid","audio/midi"],["midi","audio/midi"],["mjs","text/javascript"],["mp3","audio/mpeg"],["mp4","video/mp4"],["mpeg","video/mpeg"],["mpkg","application/vnd.apple.installer+xml"],["odp","application/vnd.oasis.opendocument.presentation"],["ods","application/vnd.oasis.opendocument.spreadsheet"],["odt","application/vnd.oasis.opendocument.text"],["oga","audio/ogg"],["ogv","video/ogg"],["ogx","application/ogg"],["opus","audio/opus"],["otf","font/otf"],["png","image/png"],["pdf","application/pdf"],["php","application/x-httpd-php"],["ppt","application/vnd.ms-powerpoint"],["pptx","application/vnd.openxmlformats-officedocument.presentationml.presentation"],["rar","application/vnd.rar"],["rtf","application/rtf"],["sh","application/x-sh"],["svg","image/svg+xml"],["swf","application/x-shockwave-flash"],["tar","application/x-tar"],["tif","image/tiff"],["tiff","image/tiff"],["ts","video/mp2t"],["ttf","font/ttf"],["txt","text/plain"],["vsd","application/vnd.visio"],["wav","audio/wav"],["weba","audio/webm"],["webm","video/webm"],["webp","image/webp"],["woff","font/woff"],["woff2","font/woff2"],["xhtml","application/xhtml+xml"],["xls","application/vnd.ms-excel"],["xlsx","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"],["xml","application/xml"],["xul","application/vnd.mozilla.xul+xml"],["zip","application/zip"],["7z","application/x-7z-compressed"],["mkv","video/x-matroska"],["mov","video/quicktime"],["msg","application/vnd.ms-outlook"]]);function aE(e,t){var r=gtt(e);if(typeof r.path!="string"){var n=e.webkitRelativePath;Object.defineProperty(r,"path",{value:typeof t=="string"?t:typeof n=="string"&&n.length>0?n:e.name,writable:!1,configurable:!1,enumerable:!0})}return r}function gtt(e){var t=e.name,r=t&&t.lastIndexOf(".")!==-1;if(r&&!e.type){var n=t.split(".").pop().toLowerCase(),i=Att.get(n);i&&Object.defineProperty(e,"type",{value:i,writable:!1,configurable:!1,enumerable:!0})}return e}var vtt=[".DS_Store","Thumbs.db"];function RZ(e){return I1(this,void 0,void 0,function(){return B1(this,function(t){return L8(e)&&ytt(e.dataTransfer)?[2,Stt(e.dataTransfer,e.type)]:btt(e)?[2,xtt(e)]:Array.isArray(e)&&e.every(function(r){return"getFile"in r&&typeof r.getFile=="function"})?[2,wtt(e)]:[2,[]]})})}function ytt(e){return L8(e)}function btt(e){return L8(e)&&L8(e.target)}function L8(e){return typeof e=="object"&&e!==null}function xtt(e){return BZ(e.target.files).map(function(t){return aE(t)})}function wtt(e){return I1(this,void 0,void 0,function(){var t;return B1(this,function(r){switch(r.label){case 0:return[4,Promise.all(e.map(function(n){return n.getFile()}))];case 1:return t=r.sent(),[2,t.map(function(n){return aE(n)})]}})})}function Stt(e,t){return I1(this,void 0,void 0,function(){var r,n;return B1(this,function(i){switch(i.label){case 0:return e.items?(r=BZ(e.items).filter(function(a){return a.kind==="file"}),t!=="drop"?[2,r]:[4,Promise.all(r.map(Ett))]):[3,2];case 1:return n=i.sent(),[2,wCe(ECe(n))];case 2:return[2,wCe(BZ(e.files).map(function(a){return aE(a)}))]}})})}function wCe(e){return e.filter(function(t){return vtt.indexOf(t.name)===-1})}function BZ(e){if(e===null)return[];for(var t=[],r=0;re.length)&&(t=e.length);for(var r=0,n=new Array(t);rr)return[!1,jCe(r)];if(e.sizer)return[!1,jCe(r)]}return[!0,null]}function xb(e){return e!=null}function ICe(e){var t=e.files,r=e.accept,n=e.minSize,i=e.maxSize,a=e.multiple,o=e.maxFiles,s=e.validator;return!a&&t.length>1||a&&o>=1&&t.length>o?!1:t.every(function(l){var u=LZ(l,r),c=WD(u,1),f=c[0],d=zZ(l,n,i),p=WD(d,1),h=p[0],m=s?s(l):null;return f&&h&&!m})}function HD(e){return typeof e.isPropagationStopped=="function"?e.isPropagationStopped():typeof e.cancelBubble<"u"?e.cancelBubble:!1}function VD(e){return e.dataTransfer?Array.prototype.some.call(e.dataTransfer.types,function(t){return t==="Files"||t==="application/x-moz-file"}):!!e.target&&!!e.target.files}function UZ(e){e.preventDefault()}function Rtt(e){return e.indexOf("MSIE")!==-1||e.indexOf("Trident/")!==-1}function $tt(e){return e.indexOf("Edge/")!==-1}function BCe(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:window.navigator.userAgent;return Rtt(e)||$tt(e)}function sm(){for(var e=arguments.length,t=new Array(e),r=0;r1?i-1:0),o=1;oe.length)&&(t=e.length);for(var r=0,n=new Array(t);rr)return[!1,jCe(r)];if(e.sizer)return[!1,jCe(r)]}return[!0,null]}function xb(e){return e!=null}function ICe(e){var t=e.files,r=e.accept,n=e.minSize,i=e.maxSize,a=e.multiple,o=e.maxFiles,s=e.validator;return!a&&t.length>1||a&&o>=1&&t.length>o?!1:t.every(function(l){var u=LZ(l,r),c=WD(u,1),f=c[0],d=zZ(l,n,i),p=WD(d,1),h=p[0],m=s?s(l):null;return f&&h&&!m})}function HD(e){return typeof e.isPropagationStopped=="function"?e.isPropagationStopped():typeof e.cancelBubble<"u"?e.cancelBubble:!1}function VD(e){return e.dataTransfer?Array.prototype.some.call(e.dataTransfer.types,function(t){return t==="Files"||t==="application/x-moz-file"}):!!e.target&&!!e.target.files}function UZ(e){e.preventDefault()}function Rtt(e){return e.indexOf("MSIE")!==-1||e.indexOf("Trident/")!==-1}function $tt(e){return e.indexOf("Edge/")!==-1}function BCe(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:window.navigator.userAgent;return Rtt(e)||$tt(e)}function lm(){for(var e=arguments.length,t=new Array(e),r=0;r1?i-1:0),o=1;oe.length)&&(t=e.length);for(var r=0,n=new Array(t);r=0)&&(!Object.prototype.propertyIsEnumerable.call(e,n)||(r[n]=e[n]))}return r}function Xtt(e,t){if(e==null)return{};var r={},n=Object.keys(e),i,a;for(a=0;a=0)&&(r[i]=e[i]);return r}var QZ=(0,dn.forwardRef)(function(e,t){var r=e.children,n=z8(e,qtt),i=YZ(n),a=i.open,o=z8(i,Ltt);return(0,dn.useImperativeHandle)(t,function(){return{open:a}},[a]),dn.default.createElement(dn.Fragment,null,r(lo(lo({},o),{},{open:a})))});QZ.displayName="Dropzone";var QCe={disabled:!1,getFilesFromEvent:RZ,maxSize:1/0,minSize:0,multiple:!0,maxFiles:0,preventDropOnDocument:!0,noClick:!1,noKeyboard:!1,noDrag:!1,noDragEventsBubbling:!1,validator:null,useFsAccessApi:!0,autoFocus:!1};QZ.defaultProps=QCe;QZ.propTypes={children:Gi.default.func,accept:Gi.default.objectOf(Gi.default.arrayOf(Gi.default.string)),multiple:Gi.default.bool,preventDropOnDocument:Gi.default.bool,noClick:Gi.default.bool,noKeyboard:Gi.default.bool,noDrag:Gi.default.bool,noDragEventsBubbling:Gi.default.bool,minSize:Gi.default.number,maxSize:Gi.default.number,maxFiles:Gi.default.number,disabled:Gi.default.bool,getFilesFromEvent:Gi.default.func,onFileDialogCancel:Gi.default.func,onFileDialogOpen:Gi.default.func,useFsAccessApi:Gi.default.bool,autoFocus:Gi.default.bool,onDragEnter:Gi.default.func,onDragLeave:Gi.default.func,onDragOver:Gi.default.func,onDrop:Gi.default.func,onDropAccepted:Gi.default.func,onDropRejected:Gi.default.func,onError:Gi.default.func,validator:Gi.default.func};var GZ={isFocused:!1,isFileDialogActive:!1,isDragActive:!1,isDragAccept:!1,isDragReject:!1,acceptedFiles:[],fileRejections:[]};function YZ(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t=lo(lo({},QCe),e),r=t.accept,n=t.disabled,i=t.getFilesFromEvent,a=t.maxSize,o=t.minSize,s=t.multiple,l=t.maxFiles,u=t.onDragEnter,c=t.onDragLeave,f=t.onDragOver,d=t.onDrop,p=t.onDropAccepted,h=t.onDropRejected,m=t.onFileDialogCancel,g=t.onFileDialogOpen,A=t.useFsAccessApi,b=t.autoFocus,v=t.preventDropOnDocument,x=t.noClick,w=t.noKeyboard,S=t.noDrag,k=t.noDragEventsBubbling,j=t.onError,O=t.validator,C=(0,dn.useMemo)(function(){return qCe(r)},[r]),N=(0,dn.useMemo)(function(){return $Ce(r)},[r]),D=(0,dn.useMemo)(function(){return typeof g=="function"?g:VCe},[g]),P=(0,dn.useMemo)(function(){return typeof m=="function"?m:VCe},[m]),q=(0,dn.useRef)(null),z=(0,dn.useRef)(null),I=(0,dn.useReducer)(Ktt,GZ),T=WZ(I,2),L=T[0],_=T[1],Y=L.isFocused,oe=L.isFileDialogActive,te=(0,dn.useRef)(typeof window<"u"&&window.isSecureContext&&A&&RCe()),Q=function(){!te.current&&oe&&setTimeout(function(){if(z.current){var ze=z.current.files;ze.length||(_({type:"closeDialog"}),P())}},300)};(0,dn.useEffect)(function(){return window.addEventListener("focus",Q,!1),function(){window.removeEventListener("focus",Q,!1)}},[z,oe,P,te]);var fe=(0,dn.useRef)([]),Ie=function(ze){q.current&&q.current.contains(ze.target)||(ze.preventDefault(),fe.current=[])};(0,dn.useEffect)(function(){return v&&(document.addEventListener("dragover",UZ,!1),document.addEventListener("drop",Ie,!1)),function(){v&&(document.removeEventListener("dragover",UZ),document.removeEventListener("drop",Ie))}},[q,v]),(0,dn.useEffect)(function(){return!n&&b&&q.current&&q.current.focus(),function(){}},[q,b,n]);var Se=(0,dn.useCallback)(function(he){j?j(he):console.error(he)},[j]),Oe=(0,dn.useCallback)(function(he){he.preventDefault(),he.persist(),re(he),fe.current=[].concat(Wtt(fe.current),[he.target]),VD(he)&&Promise.resolve(i(he)).then(function(ze){if(!(HD(he)&&!k)){var Ye=ze.length,tt=Ye>0&&ICe({files:ze,accept:C,minSize:o,maxSize:a,multiple:s,maxFiles:l,validator:O}),Ct=Ye>0&&!tt;_({isDragAccept:tt,isDragReject:Ct,isDragActive:!0,type:"setDraggedFiles"}),u&&u(he)}}).catch(function(ze){return Se(ze)})},[i,u,Se,k,C,o,a,s,l,O]),ve=(0,dn.useCallback)(function(he){he.preventDefault(),he.persist(),re(he);var ze=VD(he);if(ze&&he.dataTransfer)try{he.dataTransfer.dropEffect="copy"}catch{}return ze&&f&&f(he),!1},[f,k]),ye=(0,dn.useCallback)(function(he){he.preventDefault(),he.persist(),re(he);var ze=fe.current.filter(function(tt){return q.current&&q.current.contains(tt)}),Ye=ze.indexOf(he.target);Ye!==-1&&ze.splice(Ye,1),fe.current=ze,!(ze.length>0)&&(_({type:"setDraggedFiles",isDragActive:!1,isDragAccept:!1,isDragReject:!1}),VD(he)&&c&&c(he))},[q,c,k]),me=(0,dn.useCallback)(function(he,ze){var Ye=[],tt=[];he.forEach(function(Ct){var we=LZ(Ct,C),Be=WZ(we,2),Le=Be[0],Ze=Be[1],He=zZ(Ct,o,a),Qe=WZ(He,2),et=Qe[0],Ge=Qe[1],G=O?O(Ct):null;if(Le&&et&&!G)Ye.push(Ct);else{var ue=[Ze,Ge];G&&(ue=ue.concat(G)),tt.push({file:Ct,errors:ue.filter(function(Pe){return Pe})})}}),(!s&&Ye.length>1||s&&l>=1&&Ye.length>l)&&(Ye.forEach(function(Ct){tt.push({file:Ct,errors:[PCe]})}),Ye.splice(0)),_({acceptedFiles:Ye,fileRejections:tt,type:"setFiles"}),d&&d(Ye,tt,ze),tt.length>0&&h&&h(tt,ze),Ye.length>0&&p&&p(Ye,ze)},[_,s,C,o,a,l,d,p,h,O]),ke=(0,dn.useCallback)(function(he){he.preventDefault(),he.persist(),re(he),fe.current=[],VD(he)&&Promise.resolve(i(he)).then(function(ze){HD(he)&&!k||me(ze,he)}).catch(function(ze){return Se(ze)}),_({type:"reset"})},[i,me,Se,k]),$=(0,dn.useCallback)(function(){if(te.current){_({type:"openDialog"}),D();var he={multiple:s,types:N};window.showOpenFilePicker(he).then(function(ze){return i(ze)}).then(function(ze){me(ze,null),_({type:"closeDialog"})}).catch(function(ze){LCe(ze)?(P(ze),_({type:"closeDialog"})):zCe(ze)?(te.current=!1,z.current?(z.current.value=null,z.current.click()):Se(new Error("Cannot open the file picker because the https://developer.mozilla.org/en-US/docs/Web/API/File_System_Access_API is not supported and no `)}else{let o=tO(n.label.sticker,e);t.tabHeaderInnerIconEl.innerHTML=o}}return}else if(t=e.app.workspace.getActiveViewOfType(Sb)?.leaf,t){let r=t.view.getState().path,n=e.superstate.pathsIndex.get(r);if(n?.label?.sticker&&t.tabHeaderInnerIconEl){let[i,a]=rg(n.label.sticker);if(i=="image"){let o=e.superstate.ui.getUIPath(e.superstate.imagesCache.get(a));if(!o)return o;t.tabHeaderInnerIconEl.innerHTML=``}else{let o=tO(n.label.sticker,e);t.tabHeaderInnerIconEl.innerHTML=o}}return}};var _b=Ae(Te()),UOe=Ae(bl());function WOe(){let[e,t]=(0,_b.useState)(new Map),[r,n]=(0,_b.useState)(new Map),i=s=>r.get(s),a=(0,_b.useCallback)((s,l)=>{let u={render:c=>{t(f=>{let d=new Map(f);return d.set(s,c),d})},unmount:()=>{t(c=>{let f=new Map(c);return f.delete(s),f}),n(c=>{let f=new Map(c);return f.delete(s),f})}};return t(c=>new Map(c).set(s,null)),n(c=>new Map(c).set(s,u)),u},[]),o=(0,_b.useMemo)(()=>[...e.entries()].map(([s,l])=>(0,UOe.createPortal)(l,s)),[e]);return{createRoot:a,portals:o,getRoot:i}}var bE=Ae(Te()),HOe=e=>{let t=qw(_p(BA,{activationConstraint:{distance:10}}),_p(RA,{activationConstraint:{delay:250,tolerance:5}}),_p(B0,{coordinateGetter:LN})),{createRoot:r,portals:n,getRoot:i}=WOe();(0,bE.useEffect)(()=>{e.ui.createRoot=r,e.ui.getRoot=i,e.ui.manager.eventsDispatch.dispatchEvent("windowReady",null)},[r]);let[a,o]=bE.default.useState(!1);return bE.default.createElement(Lw,{sensors:t,onDragStart:()=>{o(!0)},onDragEnd:()=>{o(!1),document.body.style.setProperty("cursor","")},onDragCancel:()=>{o(!1)},collisionDetection:LU,measuring:{droppable:{strategy:Fp.Always}}},bE.default.createElement(KSe,{dragActive:a},n))};var dm=Ae(Te());function SX(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,ok(e,t)}var nO=Ae(Te()),iO=Ae(bl());var EX={disabled:!1};var VOe=Ae(Te()),kX=VOe.default.createContext(null);var GOe=function(t){return t.scrollTop};var aO="unmounted",Pb="exited",Ib="entering",wE="entered",CX="exiting",wg=function(e){SX(t,e);function t(n,i){var a;a=e.call(this,n,i)||this;var o=i,s=o&&!o.isMounting?n.enter:n.appear,l;return a.appearStatus=null,n.in?s?(l=Pb,a.appearStatus=Ib):l=wE:n.unmountOnExit||n.mountOnEnter?l=aO:l=Pb,a.state={status:l},a.nextCallback=null,a}t.getDerivedStateFromProps=function(i,a){var o=i.in;return o&&a.status===aO?{status:Pb}:null};var r=t.prototype;return r.componentDidMount=function(){this.updateStatus(!0,this.appearStatus)},r.componentDidUpdate=function(i){var a=null;if(i!==this.props){var o=this.state.status;this.props.in?o!==Ib&&o!==wE&&(a=Ib):(o===Ib||o===wE)&&(a=CX)}this.updateStatus(!1,a)},r.componentWillUnmount=function(){this.cancelNextCallback()},r.getTimeouts=function(){var i=this.props.timeout,a,o,s;return a=o=s=i,i!=null&&typeof i!="number"&&(a=i.exit,o=i.enter,s=i.appear!==void 0?i.appear:o),{exit:a,enter:o,appear:s}},r.updateStatus=function(i,a){if(i===void 0&&(i=!1),a!==null)if(this.cancelNextCallback(),a===Ib){if(this.props.unmountOnExit||this.props.mountOnEnter){var o=this.props.nodeRef?this.props.nodeRef.current:iO.default.findDOMNode(this);o&&GOe(o)}this.performEnter(i)}else this.performExit();else this.props.unmountOnExit&&this.state.status===Pb&&this.setState({status:aO})},r.performEnter=function(i){var a=this,o=this.props.enter,s=this.context?this.context.isMounting:i,l=this.props.nodeRef?[s]:[iO.default.findDOMNode(this),s],u=l[0],c=l[1],f=this.getTimeouts(),d=s?f.appear:f.enter;if(!i&&!o||EX.disabled){this.safeSetState({status:wE},function(){a.props.onEntered(u)});return}this.props.onEnter(u,c),this.safeSetState({status:Ib},function(){a.props.onEntering(u,c),a.onTransitionEnd(d,function(){a.safeSetState({status:wE},function(){a.props.onEntered(u,c)})})})},r.performExit=function(){var i=this,a=this.props.exit,o=this.getTimeouts(),s=this.props.nodeRef?void 0:iO.default.findDOMNode(this);if(!a||EX.disabled){this.safeSetState({status:Pb},function(){i.props.onExited(s)});return}this.props.onExit(s),this.safeSetState({status:CX},function(){i.props.onExiting(s),i.onTransitionEnd(o.exit,function(){i.safeSetState({status:Pb},function(){i.props.onExited(s)})})})},r.cancelNextCallback=function(){this.nextCallback!==null&&(this.nextCallback.cancel(),this.nextCallback=null)},r.safeSetState=function(i,a){a=this.setNextCallback(a),this.setState(i,a)},r.setNextCallback=function(i){var a=this,o=!0;return this.nextCallback=function(s){o&&(o=!1,a.nextCallback=null,i(s))},this.nextCallback.cancel=function(){o=!1},this.nextCallback},r.onTransitionEnd=function(i,a){this.setNextCallback(a);var o=this.props.nodeRef?this.props.nodeRef.current:iO.default.findDOMNode(this),s=i==null&&!this.props.addEndListener;if(!o||s){setTimeout(this.nextCallback,0);return}if(this.props.addEndListener){var l=this.props.nodeRef?[this.nextCallback]:[o,this.nextCallback],u=l[0],c=l[1];this.props.addEndListener(u,c)}i!=null&&setTimeout(this.nextCallback,i)},r.render=function(){var i=this.state.status;if(i===aO)return null;var a=this.props,o=a.children,s=a.in,l=a.mountOnEnter,u=a.unmountOnExit,c=a.appear,f=a.enter,d=a.exit,p=a.timeout,h=a.addEndListener,m=a.onEnter,g=a.onEntering,A=a.onEntered,b=a.onExit,v=a.onExiting,x=a.onExited,w=a.nodeRef,S=LC(a,["children","in","mountOnEnter","unmountOnExit","appear","enter","exit","timeout","addEndListener","onEnter","onEntering","onEntered","onExit","onExiting","onExited","nodeRef"]);return nO.default.createElement(kX.Provider,{value:null},typeof o=="function"?o(i,S):nO.default.cloneElement(nO.default.Children.only(o),S))},t}(nO.default.Component);wg.contextType=kX;wg.propTypes={};function xE(){}wg.defaultProps={in:!1,mountOnEnter:!1,unmountOnExit:!1,appear:!1,enter:!0,exit:!0,onEnter:xE,onEntering:xE,onEntered:xE,onExit:xE,onExiting:xE,onExited:xE};wg.UNMOUNTED=aO;wg.EXITED=Pb;wg.ENTERING=Ib;wg.ENTERED=wE;wg.EXITING=CX;var DX=wg;var QOe=e=>{let{setNodeRef:t,isOver:r}=zu({id:"_modal",data:{id:"_modal"}});return Ca({onDragOver:n=>{r&&e.hide()}}),dm.default.createElement("div",{className:"mk-modal-container",ref:t},dm.default.createElement(Xrt,{ui:e.ui,hide:e.hide,className:e.className},e.children))},Xrt=e=>{let t=dm.default.useRef(null),{setNodeRef:r,isOver:n}=zu({id:"_modalInner",data:{id:"_modalInner"}}),[i,a]=(0,dm.useTransition)();(0,dm.useEffect)(()=>{a(()=>null)},[]),(0,dm.useEffect)(()=>{let s=u=>u.key=="Escape"?(e.hide(),!0):!1;function l(u){let c=d=>!!(d.classList.contains("mk-menu")||d.classList.contains("mk-menu-mobile")||d.classList.contains("mk-modal")),f=u.target;for(;!c(f)&&f.parentElement;)f=f.parentElement;c(f)||t.current&&!t.current.contains(u.target)&&e.hide()}return e.ui.inputManager.on("mousedown",l),e.ui.inputManager.on("contextmenu",l),e.ui.inputManager.on("keydown",s),()=>{e.ui.inputManager.off("mousedown",l),e.ui.inputManager.off("contextmenu",l),e.ui.inputManager.off("keydown",s)}},[e.hide]);let o={entering:{opacity:1},entered:{opacity:1},exiting:{opacity:0},exited:{opacity:0},unmounted:{opacity:0}};return dm.default.createElement(DX,{timeout:300,appear:!0,in:!0,nodeRef:t},s=>dm.default.createElement("div",{className:`${e.className}`,style:{transition:"all 100ms ease-in",transform:"translateY(0px)",...o[s]},ref:l=>{r(l),t.current=l}},e.children))};var Zv=Ae(Te()),OX=e=>{let t=e.win.document.createElement("div");Gr(e.ui.manager)?t.classList.add("mk-modal-wrapper-mobile"):t.classList.add("mk-modal-wrapper"),e.win.document.body.appendChild(t);let r=o=>{let s=!1;return()=>{s||(o.unmount(),e.win.document.body.removeChild(t),s=!0)}},n=e.ui.createRoot(t),i=r(n),a=o=>{if(Gr(e.ui.manager)){n.render(Zv.default.createElement(h5,{fc:e.fc,hide:()=>i(),newProps:o,className:`${e.isPalette?"mk-drawer-palette":"mk-drawer-modal"} ${e.className?e.className:""}`}));return}n.render(Zv.default.createElement(QOe,{ui:e.ui.manager,hide:()=>i(),className:`${e.isPalette?"mk-palette":"mk-modal"} ${e.className?e.className:""}`},!e.isPalette&&Zv.default.createElement("div",{className:"mk-modal-header"},e.title&&Zv.default.createElement("div",{className:"mk-modal-title"},e.title),Zv.default.createElement("div",{className:"mk-x-small",dangerouslySetInnerHTML:{__html:e.ui.getSticker("ui//close")},onClick:()=>i()})),(0,Zv.cloneElement)(e.fc,{hide:()=>i(),...o})))};return a(e.props),{hide:i,update:a}};var Ns=Ae(Te()),T7=(e,t)=>{e.ui.openModal("Sync Warnings",Ns.default.createElement(Krt,{superstate:e}),t)},Krt=e=>{let{superstate:t}=e,[r,n]=(0,Ns.useState)(t.ui.getWarnings()),i=()=>{n(e.superstate.ui.getWarnings().filter(a=>!e.superstate.settings.suppressedWarnings.some(o=>a.id==o)))};return(0,Ns.useEffect)(()=>(e.superstate.eventsDispatcher.addListener("settingsChanged",i),()=>{e.superstate.eventsDispatcher.removeListener("settingsChanged",i)}),[]),Ns.default.createElement("div",{className:"mk-modal-contents"},Ns.default.createElement("div",{className:"mk-modal-message"},"The following issues may affect the synchronization of your files. Please review and resolve them."),Ns.default.createElement("div",{className:"mk-button-group"},Ns.default.createElement("button",{onClick:()=>{t.eventsDispatcher.dispatchEvent("warningsChanged",null)}},H.buttons.refresh),t.settings.suppressedWarnings.length>0&&Ns.default.createElement("button",{onClick:()=>{t.settings.suppressedWarnings=[],t.saveSettings()}},H.buttons.showHidden)),r.length==0&&Ns.default.createElement("div",null,Ns.default.createElement("div",{className:"mk-modal-heading"},"No warnings")),r.map((a,o)=>Ns.default.createElement("div",{key:o,className:"mk-modal-card"},Ns.default.createElement("div",{className:"mk-modal-heading"},a.message),Ns.default.createElement("div",{className:"mk-modal-description"},a.description),Ns.default.createElement("div",{className:"mk-button-group"},a.command.length>0&&Ns.default.createElement("button",{onClick:()=>{t.cli.runCommand(a.command,{iterations:0,instanceProps:{},props:{}})}},"Resolve"),Ns.default.createElement("button",{onClick:()=>{t.settings.suppressedWarnings=[...t.settings.suppressedWarnings,a.id],t.saveSettings()}},"Ignore")))))};var xa=Ae(Te());var YOe=e=>{let{superstate:t}=e,r=(0,xa.useRef)(null),[n,i]=(0,xa.useState)(t.settings.hiddenFiles),[a,o]=(0,xa.useState)(t.settings.hiddenExtensions),s=h=>{t.settings.hiddenExtensions=[...t.settings.hiddenExtensions,h],t.saveSettings(),t.initializePaths()},l=(h,m)=>{t.settings.hiddenFiles=[...t.settings.hiddenFiles,...m],t.saveSettings(),t.initializePaths()},u=h=>{t.settings.hiddenExtensions=t.settings.hiddenExtensions.filter((m,g)=>g!=h),t.saveSettings(),t.initializePaths()},c=h=>{t.settings.hiddenFiles=t.settings.hiddenFiles.filter((m,g)=>g!=h),t.saveSettings(),t.initializePaths()},f=()=>{r?.current.value.length>0&&(s(r.current.value),r.current.innerHTML="")},d=()=>{i(t.settings.hiddenFiles),o(t.settings.hiddenExtensions)};(0,xa.useEffect)(()=>(e.superstate.eventsDispatcher.addListener("settingsChanged",d),()=>{e.superstate.eventsDispatcher.removeListener("settingsChanged",d)}),[]);let p=h=>{let m=h.target.getBoundingClientRect(),g=e.superstate.spaceManager.allPaths().map(A=>({name:Lx(A),value:A}));h.stopPropagation(),e.superstate.ui.openMenu(m,{ui:e.superstate.ui,multi:!1,editable:!1,value:[],options:g,saveOptions:l,placeholder:H.labels.linkItemSelectPlaceholder,detail:!0,searchable:!0},Ne(h.view.document))};return xa.default.createElement("div",{className:"mk-modal-contents"},xa.default.createElement("div",{className:"mk-modal-heading"},H.labels.hiddenFilePattern),xa.default.createElement("div",{className:"mk-modal-description"},H.descriptions.hiddenFileOptions),xa.default.createElement("div",{className:"mk-modal-items"},a.map((h,m)=>xa.default.createElement("div",{key:m,className:"mk-modal-item"},xa.default.createElement("span",null,h),xa.default.createElement("div",{className:"mk-modal-item-button","aria-label":H.buttons.delete,dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//close")},onClick:()=>u(m)})))),xa.default.createElement("div",{className:"mk-modal-item"},xa.default.createElement("input",{placeholder:H.labels.addExtension,type:"text",ref:r}),xa.default.createElement("button",{onClick:h=>f()},H.buttons.add)),xa.default.createElement("div",{className:"mk-modal-heading"},H.subViews.filesAndFolders),xa.default.createElement("div",{className:"mk-modal-description"},H.labels.hiddenFileSpecific),xa.default.createElement("div",{className:"mk-modal-items"},n.map((h,m)=>xa.default.createElement("div",{key:m,className:"mk-modal-item"},xa.default.createElement("span",{className:"mk-modal-item-name"},h),xa.default.createElement("div",{className:"mk-modal-item-button","aria-label":H.buttons.delete,dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//close")},onClick:()=>c(m)})))),xa.default.createElement("div",{className:"mk-modal-item"},xa.default.createElement("button",{onClick:h=>p(h)},"+ ",H.buttons.addFile)))};var MX=Ae(Te());var ZOe=(e,t,r)=>{let n=c=>{let f=t.focuses[t.settings.currentWaypoint].paths,d=c?[]:f;t.settings.expandedSpaces=d,t.saveSettings()},i=r.app.workspace.leftSplit&&Gr(t.ui),a=()=>{let c=[],f=!0;if(i){let d=r.superstate.settings.spacesRightSplit?r.app.workspace.rightSplit:r.app.workspace.leftSplit,p=d.children,h=p.reduce((m,g,A)=>g.getViewState().type==qf?A:m,-1);f=h==d.currentTab,c.push(...p.filter((m,g)=>g!=h))}return{leafs:c,spaceActive:f}},{spaceActive:o,leafs:s}=a(),l=[];t.ui.getWarnings().length>0&&(l.push({name:"Show Warnings",icon:"ui//warning",onClick:c=>{T7(t,Ne(c.view.document))}}),l.push(Rt)),jc(t.ui)||(l.push({name:"Open Overview",icon:"ui//columns",onClick:()=>{r.openEverView()}}),l.push(Rt)),l.push({name:H.menu.collapseAllSections,icon:"ui//chevrons-down-up",onClick:()=>{n(!0)}}),l.push({name:H.menu.expandAllSections,icon:"ui//chevrons-up-down",onClick:()=>{n(!1)}}),l.push(Rt),l.push({name:"Rename System",icon:"ui//edit",onClick:c=>{t.ui.openModal("Rename System",MX.default.createElement(Ki,{value:"",saveLabel:"Rename System",saveValue:f=>{t.settings.systemName=f,t.saveSettings(),t.reloadPath("/",!0)}}),Ne(c.view.document))}}),l.push({name:H.menu.manageHiddenFiles,icon:"ui//eye-off",onClick:c=>{t.ui.openModal(H.labels.hiddenFiles,MX.default.createElement(YOe,{superstate:t}),Ne(c.view.document))}}),l.push(Rt),i&&l.push({name:H.views.navigator,icon:"ui//spaces",onClick:()=>{let c=r.app.workspace.getLeavesOfType(qf);c.length>0&&r.app.workspace.revealLeaf(c[0])}}),s.map(c=>l.push({name:c.getDisplayText(),icon:"lucide//"+c.view.icon,onClick:()=>{r.app.workspace.revealLeaf(c)}})),l.push(Rt),l.push({name:H.menu.obSettings,icon:"ui//settings",onClick:()=>{r.app.commands.commands["app:open-settings"].callback()}}),l.push({name:H.menu.openVault,icon:"ui//vault",onClick:()=>{r.app.commands.commands["app:open-vault"].callback()}}),l.push(Rt),l.push({name:H.menu.getHelp,icon:"ui//mk-logo",onClick:()=>{window.open("https://make.md/community")}});let u=e.getBoundingClientRect();t.ui.openMenu(u,Ht(t.ui,l),Ne(e.ownerDocument),"bottom")};var F7=class{constructor(t){this.plugin=t;this.destroy=()=>{this.root.unmount()};this.availableViews=()=>Object.keys(this.plugin.app.viewRegistry.typeByExtension);this.quickOpen=(t,r,n,i,a)=>{if(this.manager.superstate.settings.blinkEnabled)this.plugin.quickOpen(this.manager.superstate,t,i,a);else{if(!r)return;t==2?jl(r,n,this.manager.superstate,i):Fa(r,n,this.manager.superstate,i)}};this.mainMenu=(t,r)=>{ZOe(t,r,this.plugin)};this.onMetadataRefresh=()=>{rO(this.plugin)};this.navigationHistory=()=>this.plugin.app.workspace.getLastOpenFiles();this.getSticker=t=>tO(t,this.plugin);this.getOS=()=>al.Platform.isMacOS?"mac":al.Platform.isWin?"windows":al.Platform.isLinux?"linux":al.Platform.isIosApp?"ios":al.Platform.isAndroidApp?"android":"unknown";this.openToast=t=>{new al.Notice(t)};this.openPalette=(t,r,n)=>OX({ui:this,fc:t,isPalette:!0,className:n,win:r});this.openModal=(t,r,n,i,a)=>OX({ui:this,fc:r,title:t,className:i,props:a,win:n});this.openPopover=(t,r)=>{};this.dragStarted=(t,r)=>{if(r.length!=0)if(r.length==1){let n=r[0],i=ba(this.plugin.app,n);if(!i)return;if(i instanceof al.TFile){let a=this.plugin.app.dragManager.dragFile(t.nativeEvent,i);this.plugin.app.dragManager.onDragStart(t.nativeEvent,a)}else this.plugin.app.dragManager.onDragStart(t.nativeEvent,{icon:"lucide-file",source:void 0,title:i.name,type:"file",file:i}),this.plugin.app.dragManager.dragFolder(t.nativeEvent,i,!0)}else{let n=r.map(i=>ba(this.plugin.app,i)).filter(i=>i);this.plugin.app.dragManager.onDragStart({...t,doc:document},{icon:"lucide-files",source:void 0,title:H.labels.filesCount.replace("{$1}",n.length.toString()),type:"files",files:n}),this.plugin.app.dragManager.dragFiles({...t,doc:document},n,!0)}};this.setDragLabel=t=>{this.plugin.app.dragManager.setAction(t)};this.dragEnded=t=>{};this.getWarnings=()=>{let t=[];if(this.plugin.obsidianAdapter.fileNameWarnings.size>0&&t.push({id:"obsidian-sync-space-folder",message:"Some files have invalid names",description:"Files contain invalid characters which may cause issues during sync, use alias to display these characters to prevent the issue",command:"obsidian://make-md:path-fixer"}),this.plugin.app.internalPlugins.config.sync){this.plugin.superstate.settings.spaceSubFolder.startsWith(".")&&t.push({id:"obsidian-sync-space-folder",message:"Obsidian Sync currently won't sync your Spaces",description:"Change the space folder name to a non-hidden folder",command:"obsidian://make-md:move-space-folder"});let r=this.plugin.app.internalPlugins.plugins?.sync?.instance?.allowTypes;r&&![...r].some(n=>n=="unsupported")&&t.push({id:"obsidian-sync-space-config",message:"Obsidian Sync currently won't sync your Space Views or Context",description:"Change the sync settings to include unsupported file types",command:"obsidian://app:open-settings"})}return t};this.allStickers=()=>{let t=nOe.map(i=>({name:i,type:"lucide",keywords:i,value:i,html:(0,al.getIcon)(i).outerHTML})),r=[...this.plugin.superstate.iconsCache.keys()].map(i=>({name:i,type:"vault",keywords:i,value:i,html:this.plugin.superstate.iconsCache.get(i)}));return[...Object.keys(gE).reduce((i,a)=>[...i,...gE[a].map(o=>({type:"emoji",name:o.n[0],value:o.u,html:o.u}))],[]),...r,...t]};this.getUIPath=(t,r)=>{let n=this.plugin.app.vault.getAbstractFileByPath(t);if(n instanceof al.TFile){if(r){let a=this.plugin.superstate.pathsIndex.get(n.path)?.label?.thumbnail;if(a)return this.getUIPath(a)}return this.plugin.app.vault.getResourcePath(n)}else if(t?.match(Cv))return t;return`${Fu(this.plugin.app.vault.getResourcePath(this.plugin.app.vault.getRoot()))}${t}`};this.viewsByPath=t=>{let r=ba(this.plugin.app,t);return r instanceof al.TFile?this.plugin.app.workspace.getLeavesOfType("markdown").filter(n=>n.view.file?.path==t).map(n=>({path:n.view.file?.path,openPath:i=>{n.openFile(r)},parent:null,children:[]})):this.plugin.app.workspace.getLeavesOfType(bu).filter(n=>n.view.getState().path==t).map(n=>({path:n.view.getState().path,openPath:i=>{n.setViewState({type:bu,state:{path:i}})},parent:null,children:[]}))};this.isEverViewOpen=()=>this.plugin.app.workspace.getLeavesOfType("mk-ever-view").length>0;this.openPath=(t,r,n,i)=>{if(r=="system"){this.plugin.app.showInFolder(t);return}if(r=="overview"){let o=this.plugin.app.workspace.getLeavesOfType("mk-ever-view");if(o.length>0){o[0].setViewState({type:"mk-ever-view",state:{path:t}});return}}if(r=="hover"){this.plugin.app.workspace.trigger("link-hover",{},n,t,t);return}else if(n){let o=this.plugin.superstate.spaceManager.uriByString(t);vE(this.plugin.app,this.plugin.app.workspace.getLeaf(),n,null,async s=>{let l=s.attachLeaf();if(this.plugin.app.vault.getAbstractFileByPath(o.basePath)instanceof al.TFile){await l.openFile(this.plugin.app.vault.getAbstractFileByPath(o.basePath));let u=yE(o.basePath,o.refStr,this.plugin.app);if(!l.view?.editor)return;u[0]&&u[1]&&l.view.editor?.cm.dispatch({annotations:[zf.of(u)]})}else await Cb(l,t,this.plugin,!0)});return}let a=sX(this.plugin.app,r);Cb(a,t,this.plugin)};this.primaryInteractionType=()=>al.Platform.isMobile?0:1;this.getScreenType=()=>al.Platform.isPhone?0:al.Platform.isTablet?2:1;let r=document.createElement("div");document.body.appendChild(r),r.className="mk-root",this.createRoot=()=>null,this.getRoot=()=>null,this.root=(0,KOe.createRoot)(r),this.root.render(XOe.default.createElement(HOe,{ui:this}))}};var _7=class{constructor(t){this.plugin=t;this.supportedFileTypes=["svg"];this.id="icons.make.md";this.plugin=t}initiate(t){this.middleware=t,this.cache=new Map}async parseCache(t,r){let n={svg:`@font-face { + `;if(r=="ui")return oi[n];if(r=="lucide")return tOe(n);{let i=t.superstate.iconsCache.get(n);if(!i){let a=t.superstate.imagesCache.get(n);a&&(i=t.superstate.iconsCache.get(a))}return i}};var rO=e=>{if(!e.superstate.settings.spacesStickers)return;let t=e.app.workspace.getActiveViewOfType(zOe.MarkdownView)?.leaf;if(t){let r=e.app.workspace.getActiveFile();if(!r)return;let n=e.superstate.pathsIndex.get(r.path);if(n?.label.sticker&&t.tabHeaderInnerIconEl){let[i,a]=rg(n.label.sticker);if(i=="image"){let o=e.superstate.ui.getUIPath(e.superstate.imagesCache.get(a));o&&(t.tabHeaderInnerIconEl.innerHTML=``)}else{let o=tO(n.label.sticker,e);t.tabHeaderInnerIconEl.innerHTML=o}}return}else if(t=e.app.workspace.getActiveViewOfType(Sb)?.leaf,t){let r=t.view.getState().path,n=e.superstate.pathsIndex.get(r);if(n?.label?.sticker&&t.tabHeaderInnerIconEl){let[i,a]=rg(n.label.sticker);if(i=="image"){let o=e.superstate.ui.getUIPath(e.superstate.imagesCache.get(a));if(!o)return o;t.tabHeaderInnerIconEl.innerHTML=``}else{let o=tO(n.label.sticker,e);t.tabHeaderInnerIconEl.innerHTML=o}}return}};var _b=Ae(Te()),UOe=Ae(bl());function WOe(){let[e,t]=(0,_b.useState)(new Map),[r,n]=(0,_b.useState)(new Map),i=s=>r.get(s),a=(0,_b.useCallback)((s,l)=>{let u={render:c=>{t(f=>{let d=new Map(f);return d.set(s,c),d})},unmount:()=>{t(c=>{let f=new Map(c);return f.delete(s),f}),n(c=>{let f=new Map(c);return f.delete(s),f})}};return t(c=>new Map(c).set(s,null)),n(c=>new Map(c).set(s,u)),u},[]),o=(0,_b.useMemo)(()=>[...e.entries()].map(([s,l])=>(0,UOe.createPortal)(l,s)),[e]);return{createRoot:a,portals:o,getRoot:i}}var bE=Ae(Te()),HOe=e=>{let t=qw(Pp(BA,{activationConstraint:{distance:10}}),Pp(RA,{activationConstraint:{delay:250,tolerance:5}}),Pp(B0,{coordinateGetter:LN})),{createRoot:r,portals:n,getRoot:i}=WOe();(0,bE.useEffect)(()=>{e.ui.createRoot=r,e.ui.getRoot=i,e.ui.manager.eventsDispatch.dispatchEvent("windowReady",null)},[r]);let[a,o]=bE.default.useState(!1);return bE.default.createElement(Lw,{sensors:t,onDragStart:()=>{o(!0)},onDragEnd:()=>{o(!1),document.body.style.setProperty("cursor","")},onDragCancel:()=>{o(!1)},collisionDetection:LU,measuring:{droppable:{strategy:_p.Always}}},bE.default.createElement(KSe,{dragActive:a},n))};var pm=Ae(Te());function SX(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,ok(e,t)}var nO=Ae(Te()),iO=Ae(bl());var EX={disabled:!1};var VOe=Ae(Te()),kX=VOe.default.createContext(null);var GOe=function(t){return t.scrollTop};var aO="unmounted",Pb="exited",Ib="entering",wE="entered",CX="exiting",wg=function(e){SX(t,e);function t(n,i){var a;a=e.call(this,n,i)||this;var o=i,s=o&&!o.isMounting?n.enter:n.appear,l;return a.appearStatus=null,n.in?s?(l=Pb,a.appearStatus=Ib):l=wE:n.unmountOnExit||n.mountOnEnter?l=aO:l=Pb,a.state={status:l},a.nextCallback=null,a}t.getDerivedStateFromProps=function(i,a){var o=i.in;return o&&a.status===aO?{status:Pb}:null};var r=t.prototype;return r.componentDidMount=function(){this.updateStatus(!0,this.appearStatus)},r.componentDidUpdate=function(i){var a=null;if(i!==this.props){var o=this.state.status;this.props.in?o!==Ib&&o!==wE&&(a=Ib):(o===Ib||o===wE)&&(a=CX)}this.updateStatus(!1,a)},r.componentWillUnmount=function(){this.cancelNextCallback()},r.getTimeouts=function(){var i=this.props.timeout,a,o,s;return a=o=s=i,i!=null&&typeof i!="number"&&(a=i.exit,o=i.enter,s=i.appear!==void 0?i.appear:o),{exit:a,enter:o,appear:s}},r.updateStatus=function(i,a){if(i===void 0&&(i=!1),a!==null)if(this.cancelNextCallback(),a===Ib){if(this.props.unmountOnExit||this.props.mountOnEnter){var o=this.props.nodeRef?this.props.nodeRef.current:iO.default.findDOMNode(this);o&&GOe(o)}this.performEnter(i)}else this.performExit();else this.props.unmountOnExit&&this.state.status===Pb&&this.setState({status:aO})},r.performEnter=function(i){var a=this,o=this.props.enter,s=this.context?this.context.isMounting:i,l=this.props.nodeRef?[s]:[iO.default.findDOMNode(this),s],u=l[0],c=l[1],f=this.getTimeouts(),d=s?f.appear:f.enter;if(!i&&!o||EX.disabled){this.safeSetState({status:wE},function(){a.props.onEntered(u)});return}this.props.onEnter(u,c),this.safeSetState({status:Ib},function(){a.props.onEntering(u,c),a.onTransitionEnd(d,function(){a.safeSetState({status:wE},function(){a.props.onEntered(u,c)})})})},r.performExit=function(){var i=this,a=this.props.exit,o=this.getTimeouts(),s=this.props.nodeRef?void 0:iO.default.findDOMNode(this);if(!a||EX.disabled){this.safeSetState({status:Pb},function(){i.props.onExited(s)});return}this.props.onExit(s),this.safeSetState({status:CX},function(){i.props.onExiting(s),i.onTransitionEnd(o.exit,function(){i.safeSetState({status:Pb},function(){i.props.onExited(s)})})})},r.cancelNextCallback=function(){this.nextCallback!==null&&(this.nextCallback.cancel(),this.nextCallback=null)},r.safeSetState=function(i,a){a=this.setNextCallback(a),this.setState(i,a)},r.setNextCallback=function(i){var a=this,o=!0;return this.nextCallback=function(s){o&&(o=!1,a.nextCallback=null,i(s))},this.nextCallback.cancel=function(){o=!1},this.nextCallback},r.onTransitionEnd=function(i,a){this.setNextCallback(a);var o=this.props.nodeRef?this.props.nodeRef.current:iO.default.findDOMNode(this),s=i==null&&!this.props.addEndListener;if(!o||s){setTimeout(this.nextCallback,0);return}if(this.props.addEndListener){var l=this.props.nodeRef?[this.nextCallback]:[o,this.nextCallback],u=l[0],c=l[1];this.props.addEndListener(u,c)}i!=null&&setTimeout(this.nextCallback,i)},r.render=function(){var i=this.state.status;if(i===aO)return null;var a=this.props,o=a.children,s=a.in,l=a.mountOnEnter,u=a.unmountOnExit,c=a.appear,f=a.enter,d=a.exit,p=a.timeout,h=a.addEndListener,m=a.onEnter,g=a.onEntering,A=a.onEntered,b=a.onExit,v=a.onExiting,x=a.onExited,w=a.nodeRef,S=LC(a,["children","in","mountOnEnter","unmountOnExit","appear","enter","exit","timeout","addEndListener","onEnter","onEntering","onEntered","onExit","onExiting","onExited","nodeRef"]);return nO.default.createElement(kX.Provider,{value:null},typeof o=="function"?o(i,S):nO.default.cloneElement(nO.default.Children.only(o),S))},t}(nO.default.Component);wg.contextType=kX;wg.propTypes={};function xE(){}wg.defaultProps={in:!1,mountOnEnter:!1,unmountOnExit:!1,appear:!1,enter:!0,exit:!0,onEnter:xE,onEntering:xE,onEntered:xE,onExit:xE,onExiting:xE,onExited:xE};wg.UNMOUNTED=aO;wg.EXITED=Pb;wg.ENTERING=Ib;wg.ENTERED=wE;wg.EXITING=CX;var DX=wg;var QOe=e=>{let{setNodeRef:t,isOver:r}=zu({id:"_modal",data:{id:"_modal"}});return Ca({onDragOver:n=>{r&&e.hide()}}),pm.default.createElement("div",{className:"mk-modal-container",ref:t},pm.default.createElement(Xrt,{ui:e.ui,hide:e.hide,className:e.className},e.children))},Xrt=e=>{let t=pm.default.useRef(null),{setNodeRef:r,isOver:n}=zu({id:"_modalInner",data:{id:"_modalInner"}}),[i,a]=(0,pm.useTransition)();(0,pm.useEffect)(()=>{a(()=>null)},[]),(0,pm.useEffect)(()=>{let s=u=>u.key=="Escape"?(e.hide(),!0):!1;function l(u){let c=d=>!!(d.classList.contains("mk-menu")||d.classList.contains("mk-menu-mobile")||d.classList.contains("mk-modal")),f=u.target;for(;!c(f)&&f.parentElement;)f=f.parentElement;c(f)||t.current&&!t.current.contains(u.target)&&e.hide()}return e.ui.inputManager.on("mousedown",l),e.ui.inputManager.on("contextmenu",l),e.ui.inputManager.on("keydown",s),()=>{e.ui.inputManager.off("mousedown",l),e.ui.inputManager.off("contextmenu",l),e.ui.inputManager.off("keydown",s)}},[e.hide]);let o={entering:{opacity:1},entered:{opacity:1},exiting:{opacity:0},exited:{opacity:0},unmounted:{opacity:0}};return pm.default.createElement(DX,{timeout:300,appear:!0,in:!0,nodeRef:t},s=>pm.default.createElement("div",{className:`${e.className}`,style:{transition:"all 100ms ease-in",transform:"translateY(0px)",...o[s]},ref:l=>{r(l),t.current=l}},e.children))};var Zv=Ae(Te()),OX=e=>{let t=e.win.document.createElement("div");Gr(e.ui.manager)?t.classList.add("mk-modal-wrapper-mobile"):t.classList.add("mk-modal-wrapper"),e.win.document.body.appendChild(t);let r=o=>{let s=!1;return()=>{s||(o.unmount(),e.win.document.body.removeChild(t),s=!0)}},n=e.ui.createRoot(t),i=r(n),a=o=>{if(Gr(e.ui.manager)){n.render(Zv.default.createElement(h5,{fc:e.fc,hide:()=>i(),newProps:o,className:`${e.isPalette?"mk-drawer-palette":"mk-drawer-modal"} ${e.className?e.className:""}`}));return}n.render(Zv.default.createElement(QOe,{ui:e.ui.manager,hide:()=>i(),className:`${e.isPalette?"mk-palette":"mk-modal"} ${e.className?e.className:""}`},!e.isPalette&&Zv.default.createElement("div",{className:"mk-modal-header"},e.title&&Zv.default.createElement("div",{className:"mk-modal-title"},e.title),Zv.default.createElement("div",{className:"mk-x-small",dangerouslySetInnerHTML:{__html:e.ui.getSticker("ui//close")},onClick:()=>i()})),(0,Zv.cloneElement)(e.fc,{hide:()=>i(),...o})))};return a(e.props),{hide:i,update:a}};var Ns=Ae(Te()),T7=(e,t)=>{e.ui.openModal("Sync Warnings",Ns.default.createElement(Krt,{superstate:e}),t)},Krt=e=>{let{superstate:t}=e,[r,n]=(0,Ns.useState)(t.ui.getWarnings()),i=()=>{n(e.superstate.ui.getWarnings().filter(a=>!e.superstate.settings.suppressedWarnings.some(o=>a.id==o)))};return(0,Ns.useEffect)(()=>(e.superstate.eventsDispatcher.addListener("settingsChanged",i),()=>{e.superstate.eventsDispatcher.removeListener("settingsChanged",i)}),[]),Ns.default.createElement("div",{className:"mk-modal-contents"},Ns.default.createElement("div",{className:"mk-modal-message"},"The following issues may affect the synchronization of your files. Please review and resolve them."),Ns.default.createElement("div",{className:"mk-button-group"},Ns.default.createElement("button",{onClick:()=>{t.eventsDispatcher.dispatchEvent("warningsChanged",null)}},H.buttons.refresh),t.settings.suppressedWarnings.length>0&&Ns.default.createElement("button",{onClick:()=>{t.settings.suppressedWarnings=[],t.saveSettings()}},H.buttons.showHidden)),r.length==0&&Ns.default.createElement("div",null,Ns.default.createElement("div",{className:"mk-modal-heading"},"No warnings")),r.map((a,o)=>Ns.default.createElement("div",{key:o,className:"mk-modal-card"},Ns.default.createElement("div",{className:"mk-modal-heading"},a.message),Ns.default.createElement("div",{className:"mk-modal-description"},a.description),Ns.default.createElement("div",{className:"mk-button-group"},a.command.length>0&&Ns.default.createElement("button",{onClick:()=>{t.cli.runCommand(a.command,{iterations:0,instanceProps:{},props:{}})}},"Resolve"),Ns.default.createElement("button",{onClick:()=>{t.settings.suppressedWarnings=[...t.settings.suppressedWarnings,a.id],t.saveSettings()}},"Ignore")))))};var xa=Ae(Te());var YOe=e=>{let{superstate:t}=e,r=(0,xa.useRef)(null),[n,i]=(0,xa.useState)(t.settings.hiddenFiles),[a,o]=(0,xa.useState)(t.settings.hiddenExtensions),s=h=>{t.settings.hiddenExtensions=[...t.settings.hiddenExtensions,h],t.saveSettings(),t.initializePaths()},l=(h,m)=>{t.settings.hiddenFiles=[...t.settings.hiddenFiles,...m],t.saveSettings(),t.initializePaths()},u=h=>{t.settings.hiddenExtensions=t.settings.hiddenExtensions.filter((m,g)=>g!=h),t.saveSettings(),t.initializePaths()},c=h=>{t.settings.hiddenFiles=t.settings.hiddenFiles.filter((m,g)=>g!=h),t.saveSettings(),t.initializePaths()},f=()=>{r?.current.value.length>0&&(s(r.current.value),r.current.innerHTML="")},d=()=>{i(t.settings.hiddenFiles),o(t.settings.hiddenExtensions)};(0,xa.useEffect)(()=>(e.superstate.eventsDispatcher.addListener("settingsChanged",d),()=>{e.superstate.eventsDispatcher.removeListener("settingsChanged",d)}),[]);let p=h=>{let m=h.target.getBoundingClientRect(),g=e.superstate.spaceManager.allPaths().map(A=>({name:Lx(A),value:A}));h.stopPropagation(),e.superstate.ui.openMenu(m,{ui:e.superstate.ui,multi:!1,editable:!1,value:[],options:g,saveOptions:l,placeholder:H.labels.linkItemSelectPlaceholder,detail:!0,searchable:!0},Ne(h.view.document))};return xa.default.createElement("div",{className:"mk-modal-contents"},xa.default.createElement("div",{className:"mk-modal-heading"},H.labels.hiddenFilePattern),xa.default.createElement("div",{className:"mk-modal-description"},H.descriptions.hiddenFileOptions),xa.default.createElement("div",{className:"mk-modal-items"},a.map((h,m)=>xa.default.createElement("div",{key:m,className:"mk-modal-item"},xa.default.createElement("span",null,h),xa.default.createElement("div",{className:"mk-modal-item-button","aria-label":H.buttons.delete,dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//close")},onClick:()=>u(m)})))),xa.default.createElement("div",{className:"mk-modal-item"},xa.default.createElement("input",{placeholder:H.labels.addExtension,type:"text",ref:r}),xa.default.createElement("button",{onClick:h=>f()},H.buttons.add)),xa.default.createElement("div",{className:"mk-modal-heading"},H.subViews.filesAndFolders),xa.default.createElement("div",{className:"mk-modal-description"},H.labels.hiddenFileSpecific),xa.default.createElement("div",{className:"mk-modal-items"},n.map((h,m)=>xa.default.createElement("div",{key:m,className:"mk-modal-item"},xa.default.createElement("span",{className:"mk-modal-item-name"},h),xa.default.createElement("div",{className:"mk-modal-item-button","aria-label":H.buttons.delete,dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//close")},onClick:()=>c(m)})))),xa.default.createElement("div",{className:"mk-modal-item"},xa.default.createElement("button",{onClick:h=>p(h)},"+ ",H.buttons.addFile)))};var MX=Ae(Te());var ZOe=(e,t,r)=>{let n=c=>{let f=t.focuses[t.settings.currentWaypoint].paths,d=c?[]:f;t.settings.expandedSpaces=d,t.saveSettings()},i=r.app.workspace.leftSplit&&Gr(t.ui),a=()=>{let c=[],f=!0;if(i){let d=r.superstate.settings.spacesRightSplit?r.app.workspace.rightSplit:r.app.workspace.leftSplit,p=d.children,h=p.reduce((m,g,A)=>g.getViewState().type==qf?A:m,-1);f=h==d.currentTab,c.push(...p.filter((m,g)=>g!=h))}return{leafs:c,spaceActive:f}},{spaceActive:o,leafs:s}=a(),l=[];t.ui.getWarnings().length>0&&(l.push({name:"Show Warnings",icon:"ui//warning",onClick:c=>{T7(t,Ne(c.view.document))}}),l.push(Rt)),jc(t.ui)||(l.push({name:"Open Overview",icon:"ui//columns",onClick:()=>{r.openEverView()}}),l.push(Rt)),l.push({name:H.menu.collapseAllSections,icon:"ui//chevrons-down-up",onClick:()=>{n(!0)}}),l.push({name:H.menu.expandAllSections,icon:"ui//chevrons-up-down",onClick:()=>{n(!1)}}),l.push(Rt),l.push({name:"Rename System",icon:"ui//edit",onClick:c=>{t.ui.openModal("Rename System",MX.default.createElement(Ki,{value:"",saveLabel:"Rename System",saveValue:f=>{t.settings.systemName=f,t.saveSettings(),t.reloadPath("/",!0)}}),Ne(c.view.document))}}),l.push({name:H.menu.manageHiddenFiles,icon:"ui//eye-off",onClick:c=>{t.ui.openModal(H.labels.hiddenFiles,MX.default.createElement(YOe,{superstate:t}),Ne(c.view.document))}}),l.push(Rt),i&&l.push({name:H.views.navigator,icon:"ui//spaces",onClick:()=>{let c=r.app.workspace.getLeavesOfType(qf);c.length>0&&r.app.workspace.revealLeaf(c[0])}}),s.map(c=>l.push({name:c.getDisplayText(),icon:"lucide//"+c.view.icon,onClick:()=>{r.app.workspace.revealLeaf(c)}})),l.push(Rt),l.push({name:H.menu.obSettings,icon:"ui//settings",onClick:()=>{r.app.commands.commands["app:open-settings"].callback()}}),l.push({name:H.menu.openVault,icon:"ui//vault",onClick:()=>{r.app.commands.commands["app:open-vault"].callback()}}),l.push(Rt),l.push({name:H.menu.getHelp,icon:"ui//mk-logo",onClick:()=>{window.open("https://make.md/community")}});let u=e.getBoundingClientRect();t.ui.openMenu(u,Ht(t.ui,l),Ne(e.ownerDocument),"bottom")};var F7=class{constructor(t){this.plugin=t;this.destroy=()=>{this.root.unmount()};this.availableViews=()=>Object.keys(this.plugin.app.viewRegistry.typeByExtension);this.quickOpen=(t,r,n,i,a)=>{if(this.manager.superstate.settings.blinkEnabled)this.plugin.quickOpen(this.manager.superstate,t,i,a);else{if(!r)return;t==2?jl(r,n,this.manager.superstate,i):Fa(r,n,this.manager.superstate,i)}};this.mainMenu=(t,r)=>{ZOe(t,r,this.plugin)};this.onMetadataRefresh=()=>{rO(this.plugin)};this.navigationHistory=()=>this.plugin.app.workspace.getLastOpenFiles();this.getSticker=t=>tO(t,this.plugin);this.getOS=()=>al.Platform.isMacOS?"mac":al.Platform.isWin?"windows":al.Platform.isLinux?"linux":al.Platform.isIosApp?"ios":al.Platform.isAndroidApp?"android":"unknown";this.openToast=t=>{new al.Notice(t)};this.openPalette=(t,r,n)=>OX({ui:this,fc:t,isPalette:!0,className:n,win:r});this.openModal=(t,r,n,i,a)=>OX({ui:this,fc:r,title:t,className:i,props:a,win:n});this.openPopover=(t,r)=>{};this.dragStarted=(t,r)=>{if(r.length!=0)if(r.length==1){let n=r[0],i=ba(this.plugin.app,n);if(!i)return;if(i instanceof al.TFile){let a=this.plugin.app.dragManager.dragFile(t.nativeEvent,i);this.plugin.app.dragManager.onDragStart(t.nativeEvent,a)}else this.plugin.app.dragManager.onDragStart(t.nativeEvent,{icon:"lucide-file",source:void 0,title:i.name,type:"file",file:i}),this.plugin.app.dragManager.dragFolder(t.nativeEvent,i,!0)}else{let n=r.map(i=>ba(this.plugin.app,i)).filter(i=>i);this.plugin.app.dragManager.onDragStart({...t,doc:document},{icon:"lucide-files",source:void 0,title:H.labels.filesCount.replace("{$1}",n.length.toString()),type:"files",files:n}),this.plugin.app.dragManager.dragFiles({...t,doc:document},n,!0)}};this.setDragLabel=t=>{this.plugin.app.dragManager.setAction(t)};this.dragEnded=t=>{};this.getWarnings=()=>{let t=[];if(this.plugin.obsidianAdapter.fileNameWarnings.size>0&&t.push({id:"obsidian-sync-space-folder",message:"Some files have invalid names",description:"Files contain invalid characters which may cause issues during sync, use alias to display these characters to prevent the issue",command:"obsidian://make-md:path-fixer"}),this.plugin.app.internalPlugins.config.sync){this.plugin.superstate.settings.spaceSubFolder.startsWith(".")&&t.push({id:"obsidian-sync-space-folder",message:"Obsidian Sync currently won't sync your Spaces",description:"Change the space folder name to a non-hidden folder",command:"obsidian://make-md:move-space-folder"});let r=this.plugin.app.internalPlugins.plugins?.sync?.instance?.allowTypes;r&&![...r].some(n=>n=="unsupported")&&t.push({id:"obsidian-sync-space-config",message:"Obsidian Sync currently won't sync your Space Views or Context",description:"Change the sync settings to include unsupported file types",command:"obsidian://app:open-settings"})}return t};this.allStickers=()=>{let t=nOe.map(i=>({name:i,type:"lucide",keywords:i,value:i,html:(0,al.getIcon)(i).outerHTML})),r=[...this.plugin.superstate.iconsCache.keys()].map(i=>({name:i,type:"vault",keywords:i,value:i,html:this.plugin.superstate.iconsCache.get(i)}));return[...Object.keys(gE).reduce((i,a)=>[...i,...gE[a].map(o=>({type:"emoji",name:o.n[0],value:o.u,html:o.u}))],[]),...r,...t]};this.getUIPath=(t,r)=>{let n=this.plugin.app.vault.getAbstractFileByPath(t);if(n instanceof al.TFile){if(r){let a=this.plugin.superstate.pathsIndex.get(n.path)?.label?.thumbnail;if(a)return this.getUIPath(a)}return this.plugin.app.vault.getResourcePath(n)}else if(t?.match(Cv))return t;return`${Fu(this.plugin.app.vault.getResourcePath(this.plugin.app.vault.getRoot()))}${t}`};this.viewsByPath=t=>{let r=ba(this.plugin.app,t);return r instanceof al.TFile?this.plugin.app.workspace.getLeavesOfType("markdown").filter(n=>n.view.file?.path==t).map(n=>({path:n.view.file?.path,openPath:i=>{n.openFile(r)},parent:null,children:[]})):this.plugin.app.workspace.getLeavesOfType(bu).filter(n=>n.view.getState().path==t).map(n=>({path:n.view.getState().path,openPath:i=>{n.setViewState({type:bu,state:{path:i}})},parent:null,children:[]}))};this.isEverViewOpen=()=>this.plugin.app.workspace.getLeavesOfType("mk-ever-view").length>0;this.openPath=(t,r,n,i)=>{if(r=="system"){this.plugin.app.showInFolder(t);return}if(r=="overview"){let o=this.plugin.app.workspace.getLeavesOfType("mk-ever-view");if(o.length>0){o[0].setViewState({type:"mk-ever-view",state:{path:t}});return}}if(r=="hover"){this.plugin.app.workspace.trigger("link-hover",{},n,t,t);return}else if(n){let o=this.plugin.superstate.spaceManager.uriByString(t);vE(this.plugin.app,this.plugin.app.workspace.getLeaf(),n,null,async s=>{let l=s.attachLeaf();if(this.plugin.app.vault.getAbstractFileByPath(o.basePath)instanceof al.TFile){await l.openFile(this.plugin.app.vault.getAbstractFileByPath(o.basePath));let u=yE(o.basePath,o.refStr,this.plugin.app);if(!l.view?.editor)return;u[0]&&u[1]&&l.view.editor?.cm.dispatch({annotations:[zf.of(u)]})}else await Cb(l,t,this.plugin,!0)});return}let a=sX(this.plugin.app,r);Cb(a,t,this.plugin)};this.primaryInteractionType=()=>al.Platform.isMobile?0:1;this.getScreenType=()=>al.Platform.isPhone?0:al.Platform.isTablet?2:1;let r=document.createElement("div");document.body.appendChild(r),r.className="mk-root",this.createRoot=()=>null,this.getRoot=()=>null,this.root=(0,KOe.createRoot)(r),this.root.render(XOe.default.createElement(HOe,{ui:this}))}};var _7=class{constructor(t){this.plugin=t;this.supportedFileTypes=["svg"];this.id="icons.make.md";this.plugin=t}initiate(t){this.middleware=t,this.cache=new Map}async parseCache(t,r){let n={svg:`@font-face { font-family: '${t.name}'; src: url('${this.middleware.resourcePathForPath(t.path)}'); }`};this.cache.set(t.path,n),this.middleware.updateFileCache(t.path,this.cache.get(t.path),r)}cacheTypes(t){return["svg"]}contentTypes(t){return["svg"]}async readContent(t,r,n){if(r=="svg")return this.cache.get(t.path).svg}};var JOe=e=>e?{scheme:"obsidian",schema:{id:e.id,name:e.name,type:"command"},path:"obsidian://"+e.id,fields:[],code:e.callback,codeType:"closure"}:null,P7=class{constructor(t){this.plugin=t;this.scheme="obsidian";this.allCommands=()=>Object.values(this.plugin.app.commands.commands).map(t=>JOe(t));this.commandForAction=t=>{if(!t)return null;let r=cc(t);return JOe(this.plugin.app.commands.commands[r.authority])};this.runCommand=async(t,r)=>{if(!t)return;let i=cc(t).authority;this.plugin.app.commands.commands[i]?.callback?this.plugin.app.commands.commands[i].callback():this.plugin.app.commands.commands[i].checkCallback&&this.plugin.app.commands.commands[i].checkCallback(!1)}}};var Jrt=[{id:"filter",icon:"lucide//filter",description:"Only continue if a condition is met",name:"Filter",fields:[]},{id:"formula",icon:"lucide//sigma",description:"Use a formula to calculate a result",name:"Formula",fields:[]}],SE=class{constructor(t){this.terminals=[];this.terminalForURI=t=>t?t.scheme==null||t.scheme=="vault"?this.mainTerminal:this.terminals.find(r=>r.scheme==t.scheme):null;this.commandForAction=t=>{if(!t)return null;let r=cc(t);return r.scheme=="builtin"?this.builtinCommands.find(n=>n.schema.id==r.authority):this.terminalForURI(r)?.commandForAction(t)};this.runCommand=(t,r)=>{if(!t)return;let n=cc(t);return n.scheme=="builtin"?void 0:this.terminalForURI(n)?.runCommand(t,r)};this.terminals=[t],t.manager=this,this.mainTerminal=t,this.builtinCommands=Jrt.map(r=>({schema:{id:r.id,name:r.name,def:{icon:r.icon,description:r.description},type:"builtin"},fields:r.fields}))}static create(t){return new SE(t)}allCommands(){return[...this.builtinCommands.map(t=>({scheme:"builtin",path:"builtin://"+t.schema.id,...t})),...this.terminals.flatMap(t=>t.allCommands())]}};var eMe=e=>{let t=0;for(let r=0,n=e.length;r{a.onload=()=>p(!0),a.onerror=()=>p(!1)}))return!1;let s=document.createElement("canvas");s.width=a.width,s.height=a.height;let l=Math.max(n/a.width,n/a.height);s.getContext("2d").drawImage(a,0,0);let c=document.createElement("canvas");c.width=l*s.width,c.height=l*s.height,await this.picaInstance.resize(s,c);let d=await(await this.picaInstance.toBlob(c,"image/jpeg",.8)).arrayBuffer();return await this.middleware.fileExists(this.cacheDirectory)||await this.middleware.createFolder(this.cacheDirectory),await this.middleware.writeBinaryToFile(r,d),!0}async parseCache(t,r){if(!t)return;let n=`${this.cacheDirectory}/${eMe(t.path)}.${t.extension}`,i=t.path;this.plugin.superstate.settings.imageThumbnails&&(await this.middleware.fileExists(n)?i=n:nMe.Platform.isMobile||await this.generateThumnail(t,n)&&(i=n));let a=this.middleware.getFileCache(t.path)?.label,o={subtype:"image",label:{name:t.name,sticker:a?.sticker.length>0?a.sticker:"ui//mk-make-image",color:a?.color,thumbnail:i}};this.cache.set(t.path,o),this.middleware.updateFileCache(t.path,this.cache.get(t.path),r)}cacheTypes(t){return[]}contentTypes(t){return[]}};var aMe=require("obsidian"),oMe=Ae(Te());var NX=e=>{let t=e.superstate,r=[...e.obsidianAdapter.fileNameWarnings],n=`The following files have issues with their names. Would you like to fix them? ${r.join(` -`)}`;t.ui.openModal("Path Fixer",oMe.default.createElement(Xy,{message:n,confirmLabel:"Rename",confirmAction:async()=>{for(let i of r){let a=ba(e.app,i),o=a instanceof aMe.TFile?a?.basename:a.name;if(!a)return;await nD(e.superstate,i,e.superstate.pathsIndex.get(i)?.metadata?.property?.aliases,o),await HDe(e,a,ov(o))}e.obsidianAdapter.fileNameWarnings=new Set}}),window)};var ent=Ae(Te());var sMe=async(e,t,r)=>{let n=e.superstate.allSpaces();e.superstate.settings.spaceSubFolder=r,e.superstate.saveSettings();for(let i of n)await e.superstate.spaceManager.pathExists(i.space?.folderPath+"/"+t)&&await e.superstate.spaceManager.renamePath(i.space?.folderPath+"/"+t,i.space?.folderPath+"/"+r);await e.superstate.spaceManager.pathExists(t)&&await e.superstate.spaceManager.renamePath(t,r),await e.superstate.initializeSpaces(),e.superstate.ui.notify("All space files have been move.")};var TX=Ae(yi());var B7=class{constructor(t){this.plugin=t;this.supportedFileTypes=["json","mkit"];this.id="json.make.md";this.plugin=t,this.cache=new Map}initiate(t){this.middleware=t}async parseCache(t,r){if(!t)return;let n=or(await this.middleware.readTextFromFile(t.path))??{},i=n.label??{},a=n.property??{},o=(0,TX.omit)(n,["label","property"]),s={property:a,definition:o,label:{name:t.name,sticker:i?.sticker?.length>0?i.sticker:"ui//json",color:i?.color,preview:"",thumbnail:""}};if(t.parent.split("/").pop()==this.plugin.superstate.settings.spaceSubFolder&&t.path.split("/").pop()=="def.json"){let l=await this.middleware.getFile(t.parent),u=l.parent=="/"?this.plugin.superstate.settings.systemName:l.parent.split("/").pop(),c=await this.readContent(t,"label",null);s.label={...c,name:u}}this.cache.set(t.path,s),this.middleware.updateFileCache(t.path,s,r)}contentTypes(t){return["property","label","definition"]}async newFile(t,r,n,i){let a=t=="/"?r+".json":`${t}/${r}.json`;return await this.middleware.fileExists(t)||await this.middleware.createFolder(t),await this.middleware.writeTextToFile(a,i??""),this.middleware.getFile(a)}async readContent(t,r,n){if(r=="definition"){let i=await this.middleware.readTextFromFile(t.path);return(0,TX.omit)(or(i)??{},["label","property"])}if(r=="property"){let i=await this.middleware.readTextFromFile(t.path);return or(i)?.property??{}}if(r=="label"){let i=await this.middleware.readTextFromFile(t.path),a=or(i)?.label??{},o=Ri("sticker",a[this.plugin.superstate.settings.fmKeySticker]),s=Ri("color",a[this.plugin.superstate.settings.fmKeyColor]),l=Ri("aliases",a[this.plugin.superstate.settings.fmKeyAlias])[0],u={};return o?.length>0&&(u.sticker=o),s?.length>0&&(u.color=s),l?.length>0&&(u.name=l),u}return null}async saveContent(t,r,n,i){if(r=="label"){let a=await this.readContent(t,"label",n);n=="sticker"?a[this.plugin.superstate.settings.fmKeySticker]=i(a):n=="color"?a[this.plugin.superstate.settings.fmKeyColor]=i(a):n=="name"&&(a[this.plugin.superstate.settings.fmKeyAlias]=[i(a)]);let o=or(await this.middleware.readTextFromFile(t.path))??{};await this.middleware.writeTextToFile(t.path,JSON.stringify({...o,label:a})),this.parseCache(t,!0)}if(r=="definition"){let a=await this.readContent(t,r,n),o=i(a),s=or(await this.middleware.readTextFromFile(t.path))??{};await this.middleware.writeTextToFile(t.path,JSON.stringify({...s,...o})),this.parseCache(t,!0)}if(r=="property"){let a=await this.readContent(t,r,n),o=i(a),s=or(await this.middleware.readTextFromFile(t.path))?.property??{};await this.middleware.writeTextToFile(t.path,JSON.stringify({...s,property:o})),this.parseCache(t,!0)}return!0}async deleteContent(t,r,n){if(r=="property"){let i=await this.readContent(t,r,n);delete i[n];let a=or(await this.middleware.readTextFromFile(t.path))??{};await this.middleware.writeTextToFile(t.path,JSON.stringify({...a,property:i})),this.parseCache(t,!0)}}};var lMe=require("obsidian");var tnt=async(e,t,r,n)=>{n.type==="folder"?n.content&&await R7(e,t,n.content,`${r}/${e.superstate.settings.spaceSubFolder}/templates`,!0):await e.files.writeTextToFile(`${r}/${e.superstate.settings.spaceSubFolder}/templates/${n.name}`,n.content)},rnt=e=>{let t=Object.values(e).map(i=>i.schema),r=Object.values(e).flatMap(i=>i.cols);return{...Object.keys(e).reduce((i,a)=>({...i,[a]:{uniques:iw.uniques,cols:iw.cols,rows:e[a].rows}}),{}),m_schema:{uniques:[],cols:["id","name","type","def","predicate","primary"],rows:t},m_fields:{uniques:sa.uniques,cols:sa.cols,rows:r}}},nnt=e=>{let t=Object.values(e).map(i=>i.schema),r=Object.values(e).flatMap(i=>i.cols);return{...Object.keys(e).reduce((i,a)=>({...i,[a]:{uniques:[],cols:e[a].cols.map(o=>o.name),rows:e[a].rows}}),{}),m_schema:{uniques:[],cols:["id","name","type","def","predicate","primary"],rows:t},m_fields:{uniques:sa.uniques,cols:sa.cols,rows:r}}},R7=async(e,t,r,n,i)=>{if(!r)return;let a=n=="/"?r.name:n+"/"+r.name,o;if(i?(await e.files.createFolder(a),o={name:r.name,type:"folder",path:a,space:{path:a,name:r.name,isRemote:!1,readOnly:!1,defPath:`${a}/${e.superstate.settings.spaceSubFolder}/def.json`,notePath:`${a}/${r.name}.md`,dbPath:`${a}/${e.superstate.settings.spaceSubFolder}/context.mdb`,framePath:`${a}/${e.superstate.settings.spaceSubFolder}/views.mdb`}}):(o=await kf(t,a,r.definition),await pi(t,o.path,r.properties)),r.content&&await e.files.writeTextToFile(o.space.notePath,r.content),r.frames){let s=o.space.framePath;e.mdbFileAdapter.newContent({path:s,isFolder:!1,name:"frames",parent:"",filename:"views.mdb"},"tables","",rnt(r.frames),{})}if(r.context){let s=o.space.dbPath;e.mdbFileAdapter.newContent({path:s,isFolder:!1,name:"context",parent:"",filename:"context.mdb"},"tables","",nnt(r.context),{})}if(r.templates?.length>0){await e.files.createFolder(`${n}/${e.superstate.settings.spaceSubFolder}/templates`);for(let s of r.templates)await tnt(e,t,o.path,s)}for(let s of r.notes)i?await e.files.writeTextToFile(o.path+"/"+s.name,s.content):za(t,o,"md",s.name,!0,s.content);for(let s of r.children)await R7(e,t,s,o.path,i);i||await t.reloadSpaceByPath(o.path)},uMe=(e,t)=>{let r=e.replace(t,"");if(r.startsWith("/"))return"."+r;{let n=t.split("/").length;return(n>0?"../".repeat(n):"")+r}},int=(e,t)=>{let r={...e};return e[Er].rows=e[Er].rows.map(n=>(n[mt]=uMe(n[mt],t),n)),r},oO=async(e,t,r,n)=>{let i=t.spacesIndex.get(r),a,o,s,l,u,c=[],f=[],d=[],p;if(i){a=i.name,u=i.metadata,o=await t.spaceManager.readAllTables(r),p=await t.spaceManager.readPath(i.space.notePath),s=await t.spaceManager.readAllFrames(r),l=Object.keys(i.properties).reduce((g,A)=>({...g,[A]:i.properties[A]}),{});let m=[...t.spacesMap.getInverse(r)];for(let g of m)if(t.spacesIndex.has(g)){let A=await oO(e,t,g,n);c.push(A)}else{let A=t.pathsIndex.get(g),b=await t.spaceManager.readPath(g);f.push({name:A.name,properties:{},content:b})}for(let g of i.templates){let A=`${i.path}/${e.superstate.settings.spaceSubFolder}/templates/${g}`,b=await t.spaceManager.getPathInfo(A);if(!g.startsWith("."))if(b.isFolder){let v=await oO(e,t,A,n);d.push({name:b.name,type:"folder",content:v})}else{let v=await t.spaceManager.readPath(A);d.push({name:b.name,type:"file",content:v})}}}else{let m=await t.spaceManager.spaceInfoForPath(r);a=m.name;let g=await t.spaceManager.readPath(m.defPath),A=await t.spaceManager.readPath(m.notePath);if(p=A,A){let x=g.match(Qv);if(x){let w=x[1];l=(0,lMe.parseYaml)(w)}}g&&(u=pC(or(g),t.settings)),o=await pE(e.mdbFileAdapter,m.dbPath),s=await pE(e.mdbFileAdapter,m.framePath);let b=await t.spaceManager.childrenForPath(r,"folder");for(let x of b){let w=await oO(e,t,x,n);c.push(w)}let v=await t.spaceManager.childrenForPath(r,"file");for(let x of v){let w=x.split("/").pop();if(w.startsWith("."))continue;let S=await t.spaceManager.readPath(x);f.push({name:w,properties:{},content:S})}}return{name:a,path:uMe(r,n),definition:u,properties:l,context:int(o,r),frames:s,children:c,content:p,notes:f,assets:[],templates:d}};var Ll=Ae(Te());var FX=(e,t,r,n)=>{t.ui.openModal("Add Kit",Ll.default.createElement(ant,{plugin:e,superstate:t,kit:r}),n)},ant=e=>{let[t,r]=(0,Ll.useState)(e.kit),[n,i]=(0,Ll.useState)("/"),a=()=>{if(!t.startsWith("https://www.make.md/static/kits/")){e.superstate.ui.notify("Invalid Kit URL");return}fetch(t).then(o=>o.text()).then(o=>{if(!o){e.superstate.ui.notify("Kit doesn't exist");return}return console.log("Adding Kit"),R7(e.plugin,e.superstate,or(o),n)}).then(o=>{e.superstate.ui.notify("Kit added"),e.hide()})};return Ll.default.createElement("div",null,Ll.default.createElement("div",{className:"setting-item"},Ll.default.createElement("div",{className:"setting-item-heading"},"Kit Location"),Ll.default.createElement("span",null),Ll.default.createElement("input",{type:"text",value:t,onChange:o=>r(o.target.value)})),Ll.default.createElement("div",{className:"setting-item"},Ll.default.createElement("div",{className:"setting-item-heading"},"Add Kit to Space"),Ll.default.createElement("span",null),Ll.default.createElement(B9,{superstate:e.superstate,triggerMenu:o=>{let s=o.target.getBoundingClientRect();Fa(s,Ne(o.view.document),e.superstate,l=>i(l))},value:e.superstate.spacesIndex.get(n)?.name,selectValue:o=>{i(o)}})),Ll.default.createElement("div",{className:"setting-item"},Ll.default.createElement("button",{onClick:()=>a()},"Add"),Ll.default.createElement("button",{onClick:e.hide},"Cancel")))};var Rb=require("@codemirror/state"),Eg=require("@codemirror/view");var Sg=e=>{let t;return e.app.workspace.iterateLeaves(r=>{let n=r.view.editor?.cm;if(n?.hasFocus)return t=n,!0},e.app.workspace.rootSplit),t},sO=e=>{let t;return e.app.workspace.iterateLeaves(r=>{if(r.view.editor?.cm?.hasFocus)return t=r.view,!0},e.app.workspace.rootSplit),t};function cMe(e,t,r){Zs(t).iterate({...r,from:e,to:e})}function lO(e,t,r){Zs(t).iterate({...r,from:e.from,to:e.to})}var pm=require("@codemirror/state"),Hh=require("@codemirror/view"),ont=typeof navigator<"u"&&!/Edge\/(\d+)/.exec(navigator.userAgent)&&/Apple Computer/.test(navigator.vendor)&&(/Mobile\/\w+/.test(navigator.userAgent)||navigator.maxTouchPoints>2),_X="-10000px";var q7=class{constructor(t,r,n){this.facet=r;this.createTooltipView=n;this.input=t.state.facet(r),this.tooltips=this.input.filter(i=>i),this.tooltipViews=this.tooltips.map(n)}update(t){if(t.focusChanged&&!t.view.hasFocus){let a=t.state.facet(this.facet);for(let o of this.tooltipViews)o.dom.remove();return this.input=a,this.tooltips=[],this.tooltipViews=[],!0}let r=t.state.facet(this.facet),n=r.filter(a=>a);if(r===this.input){for(let a of this.tooltipViews)a.update&&a.update(t);return!1}let i=[];for(let a=0;a({position:ont?"absolute":e.find(t=>t.position)?.position||"fixed",parent:e.find(t=>t.parent)?.parent||null,tooltipSpace:e.find(t=>t.tooltipSpace)?.tooltipSpace||snt})}),lnt=Hh.ViewPlugin.fromClass(class{constructor(e){this.view=e;this.inView=!0;this.lastTransaction=0;this.measureTimeout=-1;let t=e.state.facet($7);this.position=t.position,this.parent=t.parent,this.classes=e.themeClasses,this.createContainer(),this.measureReq={read:this.readMeasure.bind(this),write:this.writeMeasure.bind(this),key:this},this.manager=new q7(e,z7,r=>this.createTooltip(r)),this.intersectionObserver=typeof IntersectionObserver=="function"?new IntersectionObserver(r=>{Date.now()>this.lastTransaction-50&&r.length>0&&r[r.length-1].intersectionRatio<1&&this.measureSoon()},{threshold:[1]}):null,this.observeIntersection(),e.dom.ownerDocument.defaultView?.addEventListener("resize",this.measureSoon=this.measureSoon.bind(this)),this.maybeMeasure()}createContainer(){this.parent?(this.container=document.createElement("div"),this.container.style.position="relative",this.container.className=this.view.themeClasses,this.parent.appendChild(this.container)):this.container=this.view.dom}observeIntersection(){if(this.intersectionObserver){this.intersectionObserver.disconnect();for(let e of this.manager.tooltipViews)this.intersectionObserver.observe(e.dom)}}measureSoon(){this.measureTimeout<0&&(this.measureTimeout=setTimeout(()=>{this.measureTimeout=-1,this.maybeMeasure()},50))}update(e){e.transactions.length&&(this.lastTransaction=Date.now());let t=this.manager.update(e);t&&this.observeIntersection();let r=t||e.geometryChanged,n=e.state.facet($7);if(n.position!=this.position){this.position=n.position;for(let i of this.manager.tooltipViews)i.dom.style.position=this.position;r=!0}if(n.parent!=this.parent){this.parent&&this.container.remove(),this.parent=n.parent,this.createContainer();for(let i of this.manager.tooltipViews)this.container.appendChild(i.dom);r=!0}else this.parent&&this.view.themeClasses!=this.classes&&(this.classes=this.container.className=this.view.themeClasses);r&&this.maybeMeasure()}createTooltip(e){let t=e.create(this.view);if(t.dom.classList.add("cm-tooltip"),e.arrow&&!t.dom.querySelector(".cm-tooltip > .cm-tooltip-arrow")){let r=document.createElement("div");r.className="cm-tooltip-arrow",t.dom.appendChild(r)}return t.dom.style.position=this.position,t.dom.style.top=_X,this.container.appendChild(t.dom),t.mount&&t.mount(this.view),t}destroy(){this.view.dom.ownerDocument.defaultView?.removeEventListener("resize",this.measureSoon);for(let{dom:e}of this.manager.tooltipViews)e.remove();this.intersectionObserver?.disconnect(),clearTimeout(this.measureTimeout)}readMeasure(){let e=this.view.dom.getBoundingClientRect();return{editor:e,parent:this.parent?this.container.getBoundingClientRect():e,pos:this.manager.tooltips.map((t,r)=>{let n=this.manager.tooltipViews[r];return n.getCoords?n.getCoords(t.pos):this.view.coordsAtPos(t.pos)}),size:this.manager.tooltipViews.map(({dom:t})=>t.getBoundingClientRect()),space:this.view.state.facet($7).tooltipSpace(this.view)}}writeMeasure(e){let{editor:t,space:r}=e,n=[];for(let i=0;i=Math.min(t.bottom,r.bottom)||l.rightMath.min(t.right,r.right)+.1){s.style.top=_X;continue}let c=a.arrow?o.dom.querySelector(".cm-tooltip-arrow"):null,f=c?7:0,d=u.right-u.left,p=u.bottom-u.top,h=o.offset||cnt,m=this.view.textDirection==Hh.Direction.LTR,g=u.width>r.right-r.left?m?r.left:r.right-u.width:m?Math.min(l.left-(c?14:0)+h.x,r.right-d):Math.max(r.left,l.left-d+(c?14:0)-h.x),A=!!a.above;!a.strictSide&&(A?l.top-(u.bottom-u.top)-h.yr.bottom)&&A==r.bottom-l.bottom>l.top-r.top&&(A=!A);let b=A?l.top-p-f-h.y:l.bottom+f+h.y,v=g+d;if(o.overlap!==!0)for(let S of n)S.leftg&&S.topb&&(b=A?S.top-p-2-f:S.bottom+f+2);let x=(S,k)=>{let{top:j,right:O,bottom:C,left:N,width:D,height:P,x:q,y:z}=k,I={top:j,right:O,bottom:C,left:N};if(typeof I>"u"){let Y={top:0,left:0}}let T=S.parent.document.getElementsByTagName("iframe"),L,_=!1;for(let Y=0,oe=T.length;Ythis.createHostedView(r))}static create(t){return new uO(t)}createHostedView(t){let r=t.create(this.view);return r.dom.classList.add("cm-tooltip-section"),this.dom.appendChild(r.dom),this.mounted&&r.mount&&r.mount(this.view),r}mount(t){for(let r of this.manager.tooltipViews)r.mount&&r.mount(t);this.mounted=!0}positioned(){for(let t of this.manager.tooltipViews)t.positioned&&t.positioned()}update(t){this.manager.update(t)}},fnt=z7.compute([L7],e=>{let t=e.facet(L7).filter(r=>r);return t.length===0?null:{pos:Math.min(...t.map(r=>r.pos)),end:Math.max(...t.filter(r=>r.end!=null).map(r=>r.end)),create:uO.create,above:t[0].above,arrow:t.some(r=>r.arrow)}});var PX=class{constructor(t,r,n,i,a){this.view=t;this.source=r;this.field=n;this.setHover=i;this.hoverTime=a;this.hoverTimeout=-1;this.restartTimeout=-1;this.pending=null;this.lastMove={x:0,y:0,target:t.dom,time:0},this.checkHover=this.checkHover.bind(this),t.dom.addEventListener("mouseleave",this.mouseleave),t.dom.addEventListener("mousemove",this.mousemove)}update(){this.pending&&(this.pending=null,clearTimeout(this.restartTimeout),this.restartTimeout=setTimeout(()=>this.startHover(),20))}get active(){return this.view.state.field(this.field)}checkHover(){if(this.hoverTimeout=-1,this.active)return;let t=Date.now()-this.lastMove.time;tn.bottom||t.xn.right+this.view.defaultCharacterWidth)return;let i=this.view.bidiSpans(this.view.state.doc.lineAt(r)).find(s=>s.from<=r&&s.to>=r),a=i&&i.dir==Hh.Direction.RTL?-1:1,o=this.source(this.view,r,t.x{this.pending==s&&(this.pending=null,l&&this.view.dispatch({effects:this.setHover.of(l)}))},l=>(0,Hh.logException)(this.view.state,l,"hover tooltip"))}else o&&this.view.dispatch({effects:this.setHover.of(o)})}mousemove(t){this.lastMove={x:t.clientX,y:t.clientY,target:t.target,time:Date.now()},this.hoverTimeout<0&&(this.hoverTimeout=setTimeout(this.checkHover,this.hoverTime));let r=this.active;if(r&&!fMe(this.lastMove.target)||this.pending){let{pos:n}=r||this.pending,i=r?.end??n;(n==i?this.view.posAtCoords(this.lastMove)!=n:!dnt(this.view,n,i,t.clientX,t.clientY,6))&&(this.view.dispatch({effects:this.setHover.of(null)}),this.pending=null)}}mouseleave(t){clearTimeout(this.hoverTimeout),this.hoverTimeout=-1,this.active&&!fMe(t.relatedTarget)&&this.view.dispatch({effects:this.setHover.of(null)})}destroy(){clearTimeout(this.hoverTimeout),this.view.dom.removeEventListener("mouseleave",this.mouseleave),this.view.dom.removeEventListener("mousemove",this.mousemove)}};function fMe(e){for(let t=e;t;t=t.parentNode)if(t.nodeType==1&&t.classList.contains("cm-tooltip"))return!0;return!1}function dnt(e,t,r,n,i,a){let o=document.createRange(),s=e.domAtPos(t),l=e.domAtPos(r);o.setEnd(l.node,l.offset),o.setStart(s.node,s.offset);let u=o.getClientRects();o.detach();for(let c=0;cL7.from(i)});return[n,Hh.ViewPlugin.define(i=>new PX(i,e,n,r,t.hoverTime||300)),fnt]}var mMe=pm.StateEffect.define(),jjr=mMe.of(null);var BX=Ae(Te());var EE=require("@codemirror/state"),U7=EE.Annotation.define(),hMe=EE.Annotation.define(),W7=EE.StateField.define({create:()=>{},update(e,t){return t.annotation(hMe)?t.annotation(hMe):e}}),Bb=EE.StateField.define({create:e=>"none",update(e,t){return t.annotation(U7)?t.annotation(U7):e}});var mm=Ae(Te());var H7=e=>{let t=e.plugin.enactor.resolvePath(e.path,e.source),[r,n]=mm.default.useState();(0,mm.useMemo)(()=>e.plugin.enactor.spaceFragmentSchema(t).then(l=>n(l)),[t]);let i=()=>{navigator.clipboard.writeText(`![![${e.path}]]`),e.view.dispatch({changes:{from:e.pos.from-4,to:e.pos.to+2}})},a=()=>{e.view.dispatch({changes:{from:e.pos.from-4,to:e.pos.to+2}}),e.plugin.enactor.notify(H.notice.tableDeleted)},o=()=>{let l=e.view.posAtDOM(e.dom),c=e.view.state.doc.lineAt(l).from;e.toggleState?e.view.dispatch({changes:{from:c,to:c+1}}):e.view.dispatch({changes:{from:c,to:c,insert:"!"}})},s=l=>{let u=[];u.push({name:H.buttons.convertTable,icon:"ui//sync",onClick:c=>{e.plugin.enactor.convertSpaceFragmentToMarkdown(r,f=>{e.view.dispatch({changes:{from:e.pos.from-4,to:e.pos.to+2,insert:f}})})}}),u.push({name:H.buttons.cutTable,icon:"ui//cut",onClick:c=>{i()}}),u.push({name:H.buttons.deleteTable,icon:"ui//close",onClick:c=>{a()}}),e.plugin.enactor.openMenu(l,u)};return mm.default.createElement("div",{className:"mk-flowblock-menu"},r?r.type=="context"||r.frameType=="view"?mm.default.createElement("button",{className:"mk-toolbar-button",dangerouslySetInnerHTML:{__html:oi.options},onClick:l=>{s(l)}}):mm.default.createElement(mm.default.Fragment,null):mm.default.createElement(mm.default.Fragment,null,e.toggle&&mm.default.createElement("button",{"aria-label":H.buttons.toggleFlow,onClick:o,className:`mk-toolbar-button ${e.toggleState?"mk-toggle-on":""}`,dangerouslySetInnerHTML:{__html:e.toggleState?oi["book-open"]:oi["edit-3"]}})))};var zl=Ae(Te()),pnt=e=>e.charAt(0)=="/"?e.substring(1):e,AMe=e=>e.lastIndexOf("/")!=-1?e.lastIndexOf(".")!=-1?pnt(e.substring(e.lastIndexOf("/")+1,e.lastIndexOf("."))):e.substring(e.lastIndexOf("/")+1):e.lastIndexOf(".")!=-1?e.substring(0,e.lastIndexOf(".")):e,cO=(0,zl.forwardRef)((e,t)=>{let r=(0,zl.useRef)(null),[n,i]=(0,zl.useState)(!1),[a,o]=(0,zl.useState)(!1),s=async u=>{let c=r.current,f=e.plugin.enactor.uriByString(e.path,e.source),d=await e.plugin.app.vault.adapter.exists(f.basePath),p=e.plugin.enactor.isSpace(f.basePath),h=p&&e.forceNote?e.plugin.enactor.spaceNotePath(e.path):d?f.fullPath:null;if(h)i(!1),e.plugin.enactor.openPath(h,c);else if(u){let m=p?e.plugin.enactor.spaceFolderPath(e.path):e.plugin.enactor.parentPath(f.basePath);if(!m)return;let g=await e.plugin.enactor.createNote(m,AMe(e.path));i(!1),await e.plugin.enactor.openPath(g,c)}else{i(!0),o(!1);return}o(!0)},l=()=>{e.load?s():r?.current&&(r.current.innerHTML="")};return(0,zl.useEffect)(()=>{l()},[e.load,e.path]),(0,zl.useEffect)(()=>{let u=()=>{r.current&&!r.current.hasChildNodes()&&e.load&&!n&&s()};return e.plugin.enactor.addActiveStateListener(u),()=>{r.current=null,e.plugin.enactor.removeActiveStateListener(u)}},[]),zl.default.createElement(zl.default.Fragment,null,zl.default.createElement("div",{className:`${e.classname??""} mk-flowspace-editor`,ref:r,onClick:u=>u.stopPropagation()}),n?zl.default.createElement("div",{onClick:()=>s(!0),className:"mk-placeholder",style:{color:"var(--mk-ui-text-tertiary)"}},H.labels.notePlaceholder.replace("${1}",AMe(e.path))):zl.default.createElement(zl.default.Fragment,null))});cO.displayName="UINote";var kE=(e,t)=>(r,n)=>{let i=t?r:n,a=t?n:r;return i[e]a[e]?1:0};var fO=require("obsidian");var Uf=Rb.Annotation.define(),hm=Rb.Annotation.define(),gMe=Rb.EditorState.transactionFilter.of(e=>{let t=[],r=e.state.field(Wc,!1);return r&&!e.annotation(Uf)&&t.push(...r.filter(n=>n.expandedState==1).map(n=>e.state.field(Bb,!1)=="doc"?{annotations:Uf.of([n.id,2])}:{annotations:Uf.of([n.id,0])})),[e,...t]}),vMe=Eg.ViewPlugin.fromClass(class{constructor(e){}},{eventHandlers:{mousedown:(e,t)=>{if(!e.shiftKey)return;let r=t.posAtDOM(e.target),{from:n,to:i,text:a}=t.state.doc.lineAt(r);for(let o of a.matchAll(/(?!!)\[\[([^\]]+)\]\]/g)){let l=t.state.field(Wc,!1).find(u=>u.to==n+o.index+o[1].length+2&&r>=u.from&&r<=u.to);l&&(e.preventDefault(),t.dispatch({annotations:Uf.of([l.id,2])}))}}}}),yMe=e=>pMe((t,r,n)=>{let{from:i,to:a}=t.state.doc.lineAt(r),o=null;return lO({from:i,to:a},t.state,{enter:({name:s,from:l,to:u})=>{if(s.includes("hmd-internal-link")&&r<=u&&r>=l){let f=t.state.field(Wc,!1).find(d=>d.to==u);if(f)return o={pos:r,end:u,above:!0,create(d){let p=document.createElement("div");p.classList.add("mk-flow-hover"),p.classList.add("menu");let h=p.createDiv();h.setAttribute("aria-label",f.expandedState==0?H.buttons.openFlow:H.buttons.hideFlow),h.addEventListener("click",()=>{d.dispatch({annotations:Uf.of([f.id,2])})});let m=h.createDiv();return m.innerHTML=oi["mk-ui-flow-hover"],h.insertAdjacentText("beforeend",f.expandedState==0?H.buttons.openFlow:H.buttons.hideFlow),{dom:p}}},!1}}}),o}),Wc=Rb.StateField.define({create(){return[]},update(e,t){let r=[],n=e,i=[],a=t.newDoc.sliceString(0),o=s=>s!=2?2:0;for(let s of a.matchAll(/(?:!\[!\[|!!\[\[)([^\]]+)\]\]/g)){let l=s[1],u=n.filter(h=>h.link==l),c=i.filter(h=>h==l).length,f=u[c],d=f?f.id:fv();i.push(l);let p={id:d,link:s[1],from:s.index+4,to:s.index+4+s[1].length,type:1,height:f?t.annotation(hm)?.[0]==d&&t.annotation(hm)?.[1]!=0?t.annotation(hm)?.[1]:f.height:-1,expandedState:f?t.annotation(Uf)?.[0]==d?o(f.expandedState):f.expandedState:1};r.push(p)}for(let s of a.matchAll(/\[\[([^\]]+)\]\]/g))if(a.charAt(s.index-1)!="!"){let l=s[1],u=n.filter(h=>h.link==l),c=i.filter(h=>h==l).length,f=u[c],d=f?f.id:fv();i.push(l);let p={id:d,link:s[1],from:s.index+2,to:s.index+2+s[1].length,type:0,height:f?t.annotation(hm)?.[0]==d&&t.annotation(hm)?.[1]!=0?t.annotation(hm)?.[1]:f.height:-1,expandedState:f?t.annotation(Uf)?.[0]==d?o(f.expandedState):f.expandedState:0};r.push(p)}else if(a.charAt(s.index-2)!="!"){let l=s[1],u=n.filter(h=>h.link==l),c=i.filter(h=>h==l).length,f=u[c],d=f?f.id:fv();i.push(l);let p={id:d,link:s[1],from:s.index+3,to:s.index+3+s[1].length,type:2,height:f?t.annotation(hm)?.[0]==d&&t.annotation(hm)?.[1]!=0?t.annotation(hm)?.[1]:f.height:-1,expandedState:f?t.annotation(Uf)?.[0]==d?o(f.expandedState):f.expandedState:1};r.push(p)}return r.sort(kE("from",!0)),r}}),V7=class extends Eg.WidgetType{constructor(r,n){super();this.info=r;this.plugin=n}eq(r){return r.info.id===this.info.id}toDOM(r){let n=document.createElement("div");if(n.classList.add("mk-floweditor-container"),n.setAttribute("id","mk-flow-"+this.info.id),n.style.setProperty("height",this.info.height+"px"),this.info.link&&r.state.field(fO.editorInfoField,!1)){let a=r.state.field(fO.editorInfoField,!1).file;this.root=this.plugin.enactor.createRoot(n),this.root.render(BX.default.createElement(cO,{load:!0,plugin:this.plugin,path:this.info.link,source:a.path}))}return n}get estimatedHeight(){return this.info.height}destroy(r){this.root&&this.root.unmount()}},IX=class extends Eg.WidgetType{constructor(r,n){super();this.info=r;this.flowInfo=r,this.plugin=n}eq(r){return r.info.id===this.info.id}toDOM(r){let n=document.createElement("div");n.classList.add("mk-floweditor-selector");let i=this.plugin.enactor.createRoot(n);if(this.info.link&&r.state.field(fO.editorInfoField,!1)){let o=r.state.field(fO.editorInfoField,!1).file;i.render(BX.default.createElement(H7,{app:this.plugin.app,plugin:this.plugin,toggle:!0,path:this.info.link,source:o?.path,toggleState:!0,view:r,pos:{from:this.info.from,to:this.info.to},dom:n}))}return n}},G7=(e,t)=>Eg.Decoration.replace({widget:new IX(e,t),inclusive:!0,block:!1}),CE=(e,t)=>Eg.Decoration.replace({widget:new V7(e,t),inclusive:!0,block:!1}),Q7=(e,t)=>Eg.Decoration.widget({widget:new V7(e,t),inclusiveStart:!0,block:!0});var bMe=require("obsidian");var dO=class extends bMe.EditorSuggest{constructor(r,n){super(r);this.inCmd=!1;this.cmdStartCh=0;this.plugin=n}resetInfos(){this.cmdStartCh=0,this.inCmd=!1}onTrigger(r,n,i){let a=n.getLine(r.line).slice(0,r.ch),o=this.plugin.settings.menuTriggerChar.length;if(this.file=i,!this.inCmd&&a.slice(0,o)!==this.plugin.settings.menuTriggerChar&&a.slice(-2-o)!=="- "+this.plugin.settings.menuTriggerChar)return this.resetInfos(),null;this.inCmd||(this.cmdStartCh=a.length-o,this.inCmd=!0);let s=a.slice(this.cmdStartCh,r.ch);return s.length>1&&s.includes(" ")||!s.includes(this.plugin.settings.menuTriggerChar)?(this.resetInfos(),null):{start:r,end:r,query:s.slice(o)}}getSuggestions(r){let n=this.plugin.commands.filter(({label:i})=>i.toLowerCase().includes(r.query.toLowerCase())||H.commands[i]&&H.commands[i].toLowerCase().includes(r.query.toLowerCase()));return n.length>0?n:[{label:H.commandsSuggest.noResult,value:"",icon:"",type:0}]}renderSuggestion(r,n){if(r.value==""){n.setText(H.commandsSuggest.noResult);return}let i=n.createDiv("mk-slash-item"),a=i.createDiv("mk-slash-icon");a.innerHTML=oi[r.icon],i.createDiv().setText(H.commands[r.label]??r.label)}selectSuggestion(r,n){let i=this.context.start,a=this.context.end,o=this.cmdStartCh,s=this.context.editor;r.label!==H.commandsSuggest.noResult&&(r.onSelect?r.onSelect(n,this.plugin,this.file,s,i,o,a,()=>{this.resetInfos(),this.close()}):(this.context.editor.replaceRange(r.value,{...this.context.start,ch:this.cmdStartCh},this.context.end),r.offset&&this.context.editor.setSelection({...this.context.start,ch:this.cmdStartCh+r.offset[1]},{...this.context.end,ch:this.cmdStartCh+r.value.length+r.offset[0]}),this.resetInfos(),this.close()))}};var xMe=require("obsidian"),RX=Ae(Te());var pO=class extends xMe.EditorSuggest{constructor(r,n){super(r);this.inCmd=!1;this.cmdStartCh=0;this.plugin=n,this.emojis=Object.keys(gE).reduce((i,a)=>[...i,...gE[a].map(o=>({label:o.n[0],desc:o.n[1],variants:o.v,unicode:o.u}))],[])}resetInfos(){this.cmdStartCh=0,this.inCmd=!1}onTrigger(r,n,i){let a=n.getLine(r.line).slice(0,r.ch);if(!this.inCmd&&!(a.slice(-2)==" "+this.plugin.settings.emojiTriggerChar||a[0]==this.plugin.settings.emojiTriggerChar))return this.resetInfos(),null;this.inCmd||(this.cmdStartCh=a.length-1,this.inCmd=!0);let o=a.slice(this.cmdStartCh,r.ch);return o.includes(" ")||!o.includes(this.plugin.settings.emojiTriggerChar)?(this.resetInfos(),null):(this.suggestEl.classList.toggle("mk-emoji-menu",!0),{start:r,end:r,query:o.slice(1)})}getSuggestions(r){let n=this.emojis.filter(({label:i,desc:a})=>i.includes(r.query)||a?.includes(r.query));return n.length>0?n:[{label:H.commandsSuggest.noResult,unicode:"",desc:""}]}renderSuggestion(r,n){let i=document.createElement("div");i.setAttribute("aria-label",r.label),this.plugin.enactor.createRoot(i).render(RX.default.createElement(RX.default.Fragment,null,r.unicode.length>0?Yy(r.unicode):H.commandsSuggest.noResult)),n.appendChild(i)}selectSuggestion(r,n){r.label!==H.commandsSuggest.noResult&&(this.context.editor.replaceRange(Yy(r.unicode),{...this.context.start,ch:this.cmdStartCh},this.context.end),this.resetInfos(),this.close())}};var X7=require("@codemirror/state");var Y7=[{mark:"em",formatting:"formatting-em",altFormatting:"em_formatting_formatting-strong",formatChar:"*"},{mark:"strong",formatting:"formatting-strong",formatChar:"**"},{mark:"strikethrough",formatting:"formatting-strikethrough",formatChar:"~~"},{mark:"inline-code",formatting:"formatting-code",formatChar:"`"}];var $b=X7.Annotation.define(),wMe=(e,t,r)=>t&&r.sliceDoc(e,e+1)==" "?e+1:!t&&r.sliceDoc(e-1,e)==" "?e-1:e,SMe=(e,t,r)=>{let n=r.doc.lineAt(e),i=t?n.from:e,a=t?e:n.to,o=i,s=i,l=!1;return lO({from:i,to:a},r,{enter:u=>{if(l)return!1;if(u.name.includes("formatting")){if(!t&&u.from>i)return!1;t?(o=u.from,s=u.to):o=u.to}}}),t&&s{let r=wMe(SMe(e.from,!0,t),!0,t),n=wMe(SMe(e.to,!1,t),!1,t);return{from:r,to:n}},Xv=(e,t)=>({changes:{from:e,to:e,insert:t.formatChar}}),LX=(e,t,r)=>mO(r.from,e,t.mark)&&mO(r.to,e,t.mark),mO=(e,t,r)=>{let n=!1;return cMe(e,t,{enter:({name:i,from:a,to:o})=>{$X(i,r)&&(n=!0)}}),n},$X=(e,t)=>e.includes(t),Z7=(e,t,r)=>mO(e,t,r.mark),DE=(e,t,r)=>mO(e,t,r.formatting)?!0:r.altFormatting?mO(e,t,r.altFormatting):!1,mnt=(e,t,r)=>{let n=[];return LX(r,t,e)?(DE(e.from,r,t)&&!DE(e.to,r,t)&&n.push(Xv(e.to,t)),DE(e.to,r,t)&&!DE(e.from,r,t)&&n.push(Xv(e.from,t))):Z7(e.from,r,t)?(DE(e.from,r,t)&&!Z7(e.from-1,r,t)&&n.push(Xv(e.from,t)),n.push(Xv(e.to,t))):Z7(e.to,r,t)?(DE(e.to,r,t)&&!Z7(e.to+1,r,t)&&n.push(Xv(e.to,t)),n.push(Xv(e.from,t))):(n.push(Xv(e.to,t)),n.push(Xv(e.from,t))),n},hnt=(e,t,r)=>{let n=[];return lO({from:e.from,to:e.to},t,{enter:({name:i,from:a,to:o})=>{($X(i,r.formatting)||(r.altFormatting?$X(i,r.altFormatting):!1))&&n.push({from:a,to:a+r.formatChar.length})}}),{changes:n}},EMe=X7.EditorState.transactionFilter.of(e=>{if(!e.annotation($b))return e;let t=e.annotation($b),r=Y7.find(l=>l.mark==t);if(!r)return e;let n=e.startState.selection.main,i=[];if(n.head==n.anchor)return e.startState.sliceDoc(n.head-r.formatChar.length,n.head)==r.formatChar&&e.startState.sliceDoc(n.head,n.head+r.formatChar.length)==r.formatChar?i.push({changes:{from:n.head-r.formatChar.length,to:n.head+r.formatChar.length}}):i.push({changes:{from:n.head,insert:r.formatChar+r.formatChar},selection:{anchor:n.head+r.formatChar.length,head:n.head+r.formatChar.length}}),[e,...i];let a=qX(n,e.startState);i.push(hnt(a,e.startState,r));let o=a.from,s=a.to;return i.push(...mnt(a,r,e.startState)),[e,...i,{selection:{anchor:o,head:s}}]});var MMe=Ae(Ya());var zX=require("obsidian"),zn=Ae(Te());var kMe=Ae(Te());var CMe=e=>{let{i:t,style:r,active:n,toggleMarkAction:i}=e;return kMe.default.createElement("div",{key:t,"aria-label":e.plugin.isTouchScreen()?void 0:H.styles[r.label],className:`mk-mark ${r.mark&&n?"mk-mark-active":""}`,dangerouslySetInnerHTML:{__html:oi[`${r.icon}`]},onMouseDown:a=>i(a,r)})};var DMe=[{label:"bold",value:"****",insertOffset:2,icon:"mk-mark-strong",mark:"strong"},{label:"italics",value:"**",insertOffset:1,icon:"mk-mark-em",mark:"em"},{label:"strikethrough",value:"~~~~",insertOffset:2,icon:"mk-mark-strikethrough",mark:"strikethrough"},{label:"code",value:"``",insertOffset:1,icon:"mk-mark-code",mark:"inline-code"},{label:"link",value:"[]()",insertOffset:1,cursorOffset:2,icon:"mk-mark-link"}];function OMe(){return DMe}var jMe=(e,t)=>{t.enactor.createRoot(e).render(zn.default.createElement(UX,{mobile:!0,activeMarks:[],plugin:t}))},UX=e=>{let[t,r]=(0,zn.useState)(e.mobile?0:1),[n,i]=(0,zn.useState)(null),a=g=>{g.preventDefault();let A=e.cm??Sg(e.plugin);if(!A)return;let b=A.state.selection.main.to,v=A.state.sliceDoc(b-1,b)==A.state.lineBreak?e.plugin.settings.menuTriggerChar:A.state.lineBreak+e.plugin.settings.menuTriggerChar;A.dispatch({changes:{from:b,to:b,insert:v},selection:{head:b+v.length,anchor:b+v.length}})},o=(g,A)=>{g.preventDefault();let b=e.cm??Sg(e.plugin);if(!b)return;if(A.mark){b.dispatch({annotations:$b.of(A.mark)});return}let v=b.state.selection.main,x=b.state.sliceDoc(v.from,v.to);b.dispatch({changes:{from:v.from,to:v.to,insert:A.value.substring(0,A.insertOffset)+x+A.value.substring(A.insertOffset)},selection:A.cursorOffset?{anchor:v.from+A.value.substring(0,A.insertOffset).length+x.length+A.cursorOffset,head:v.from+A.value.substring(0,A.insertOffset).length+x.length+A.cursorOffset}:{anchor:v.from+A.value.substring(0,A.insertOffset).length,head:v.from+A.value.substring(0,A.insertOffset).length+x.length}})},s=()=>zn.default.createElement(zn.default.Fragment,null,zn.default.createElement("div",{"aria-label":e.plugin.isTouchScreen()?void 0:H.commands.makeMenu,onMouseDown:g=>{a(g)},className:"mk-mark",dangerouslySetInnerHTML:{__html:oi["mk-make-slash"]}}),zn.default.createElement("div",{"aria-label":e.plugin.isTouchScreen()?void 0:H.commands.selectStyle,onMouseDown:()=>{r(1)},className:"mk-mark",dangerouslySetInnerHTML:{__html:oi["mk-make-style"]}}),zn.default.createElement("div",{"aria-label":e.plugin.isTouchScreen()?void 0:H.commands.image,onMouseDown:()=>{let g=sO(e.plugin);e.plugin.app.commands.commands["editor:attach-file"].editorCallback(g.editor,g)},className:"mk-mark",dangerouslySetInnerHTML:{__html:oi["mk-make-attach"]}}),zn.default.createElement("div",{"aria-label":e.plugin.isTouchScreen()?void 0:H.commands.toggleKeyboard,onMouseDown:()=>{let g=sO(e.plugin);e.plugin.app.commands.commands["editor:indent-list"].editorCallback(g.editor,g)},className:"mk-mark",dangerouslySetInnerHTML:{__html:oi["mk-make-indent"]}}),zn.default.createElement("div",{"aria-label":e.plugin.isTouchScreen()?void 0:H.commands.toggleKeyboard,onMouseDown:()=>{let g=sO(e.plugin);e.plugin.app.commands.commands["editor:unindent-list"].editorCallback(g.editor,g)},className:"mk-mark",dangerouslySetInnerHTML:{__html:oi["mk-make-unindent"]}}),zn.default.createElement("div",{"aria-label":e.plugin.isTouchScreen()?void 0:H.commands.toggleKeyboard,onMouseDown:()=>{let g=sO(e.plugin);e.plugin.app.commands.commands["editor:toggle-keyboard"].editorCallback(g.editor,g)},className:"mk-mark",dangerouslySetInnerHTML:{__html:oi["mk-make-keyboard"]}})),l=()=>zn.default.createElement(zn.default.Fragment,null,zn.default.createElement("div",{className:"mk-mark",onMouseDown:()=>{i(null),r(1)},dangerouslySetInnerHTML:{__html:oi.close}}),x2.map((g,A)=>zn.default.createElement("div",{key:A,onMouseDown:()=>{r(1),i(null);let b=e.cm??Sg(e.plugin);if(!b)return;let v=b.state.selection.main,x=b.state.sliceDoc(v.from,v.to);b.dispatch({changes:{from:v.from,to:v.to,insert:n.prefix+g[1]+n.suffix+x+n.closeTag}})},className:"mk-color",style:{background:g[1]}})));function u(g){let A=/^(\s*)(-|\d+\.)\s+(\[[ x]\]\s+)?/,b=g.match(A);return b?b[1].length:-1}function c(g,A){let v=(x=>new RegExp(`^([\\t]|[ ]{2,4}){0,${x}}`,"gm"))(A);return g.replace(v,"")}function f(g){let A=/^(\s*)([-*+]|\d+\.)\s+(\[[ x]\]\s+)?/gm;return g.replace(A,"")}let d=async()=>{let g=e.cm.state.doc.lineAt(e.cm.state.selection.main.from),A=u(e.cm.state.sliceDoc(g.from,g.to)),b=e.cm.state.doc.lineAt(e.cm.state.selection.main.from).number,v=e.cm.state.doc.lineAt(e.cm.state.selection.main.to).number,x=[],S=e.cm.state.field(zX.editorInfoField,!1).file;if(S&&e.plugin.enactor.isSpace(S.parent.path)){for(let k=b;k<=v;k++){let j=e.cm.state.doc.line(k),O=u(j.text),C=f(j.text),N=await e.plugin.enactor.createNote(S.parent.path,C);x.push({from:j.to-C.length,to:j.to,insert:`[[${N}|${C}]]`})}e.cm.dispatch({changes:x})}},p=g=>{e.plugin.enactor.selectLink(g,A=>{let b=e.cm.state.selection.main,v=e.cm.state.sliceDoc(b.from,b.to),x=[{from:b.from,to:b.to,insert:`[[${A}|${v}]]`}];e.cm.dispatch({changes:x})})},h=g=>{let A=e.cm.state.doc.lineAt(e.cm.state.selection.main.from),b=[],v=null;if(g>0){let O=e.cm.state.doc.lineAt(e.cm.state.selection.main.from).number,C=u(A.text),N=O+1;for(;N<=e.cm.state.doc.lines;){let D=e.cm.state.doc.line(N);if(u(D.text)>C&&b.push(D),u(D.text)<=C)break;N++}g==1&&(v=b.map(D=>c(D.text,C+1)).join(` -`))}let x=e.cm.state.selection.main.to,w=e.cm.state.selection.main,k=e.cm.state.field(zX.editorInfoField,!1).file,j=e.cm.state.sliceDoc(w.from,w.to);if(k&&e.plugin.enactor.isSpace(k.parent.path)){let C=ov(j).trim();e.plugin.enactor.createNote(k.parent.path,C,v).then(N=>{if(N){let D=[{from:w.from,to:w.to,insert:`[[${N}|${j}]]`}];g==1&&D.push({from:e.cm.state.doc.lineAt(w.from+1).to,to:e.cm.state.doc.line(A.number+b.length).to,insert:""}),e.cm.dispatch({changes:D})}})}},m=()=>zn.default.createElement(zn.default.Fragment,null,e.mobile?zn.default.createElement("div",{className:"mk-mark",onMouseDown:()=>{r(0)},dangerouslySetInnerHTML:{__html:oi.close}}):zn.default.createElement(zn.default.Fragment,null),OMe().map((g,A)=>zn.default.createElement(CMe,{plugin:e.plugin,key:A,i:A,style:g,active:!!e.activeMarks.find(b=>b==g.mark),toggleMarkAction:o})),zn.default.createElement("div",{className:"mk-divider"}),zn.default.createElement("div",{"aria-label":H.styles.blocklink,onClick:g=>{p(g)},className:"mk-mark",dangerouslySetInnerHTML:{__html:oi["mk-mark-blocklink"]}}),zn.default.createElement("div",{className:"mk-mark-group"},zn.default.createElement("div",{"aria-label":"New Note",onMouseDown:()=>{h(0)},className:"mk-mark",dangerouslySetInnerHTML:{__html:oi["new-note"]}})),e.plugin.settings.inlineStylerColors?zn.default.createElement(zn.default.Fragment,null,zn.default.createElement("div",{className:"mk-divider"}),zn.default.createElement("div",{"aria-label":e.plugin.isTouchScreen()?void 0:H.styles.textColor,onMouseDown:()=>{r(2),i({prefix:"",closeTag:""})},className:"mk-mark",dangerouslySetInnerHTML:{__html:oi["mk-mark-color"]}}),zn.default.createElement("div",{"aria-label":e.plugin.isTouchScreen()?void 0:H.styles.highlight,onMouseDown:()=>{r(2),i({prefix:"",closeTag:""})},className:"mk-mark",dangerouslySetInnerHTML:{__html:oi["mk-mark-highlight"]}})):zn.default.createElement(zn.default.Fragment,null));return zn.default.createElement("div",{className:(0,MMe.default)(e.mobile?"mk-style-toolbar":"mk-style-menu"),onMouseDown:g=>g.preventDefault()},t==0&&e.mobile?s():t==2?l():m())};var NMe=e=>{e.settings.flowMenuEnabled&&e.plugin.registerEditorSuggest(new dO(e.app,e)),e.settings.inlineStickerMenu&&e.plugin.registerEditorSuggest(new pO(e.app,e)),e.isTouchScreen()&&e.settings.mobileMakeBar&&e.settings.inlineStyler&&jMe(e.app.mobileToolbar.containerEl,e)};var JMe=require("obsidian");var nR=require("@codemirror/state"),Kv=require("@codemirror/view");var TMe=require("@codemirror/view");var FMe=e=>TMe.EditorView.updateListener.of(t=>{if(t.heightChanged&&e.app.workspace.iterateRootLeaves(r=>{let n=r.view.editor?.cm;n&&t.view.dom==n.dom&&n.state.field(Bb,!1)&&r.containerEl.parentElement?.hasClass("workspace-tab-container")&&n.state.field(Bb,!1)!="doc"&&n.dispatch({annotations:U7.of("doc")})}),t.heightChanged){let r=t.state.field(W7,!1);r&&e.app.workspace.iterateLeaves(n=>{let i=n.view.editor?.cm;if(i){let a=i.state.field(Wc,!1);a&&a.find(o=>o.id==r)&&i.dispatch({annotations:hm.of([r,t.view.contentHeight])})}},e.app.workspace.rootSplit)}});var K7=require("@codemirror/state"),hO=require("@codemirror/view");var Ant=e=>hO.Decoration.line({attributes:{"data-ph":H.labels.placeholder.replace("${1}",e.settings.menuTriggerChar)},class:"mk-placeholder"}),_Me=e=>K7.StateField.define({create(){return hO.Decoration.none},update(t,r){let n=new K7.RangeSetBuilder,i=r.state.doc.lineAt(r.state.selection.main.head);return i?.length==0&&n.add(i.from,i.from,Ant(e)),n.finish()},provide:t=>hO.EditorView.decorations.from(t)});var IMe=require("@codemirror/state");var J7=Ae(Te());var gnt=e=>IMe.StateField.define({create:PMe(e),update(t,r){return!r.docChanged&&!r.selection?t:PMe(e)(r.state)},provide:t=>z7.computeN([t],r=>r.field(t))}),PMe=e=>t=>t.selection.ranges.filter(r=>!r.empty).map(r=>{let n=qX(r,t),i=t.doc.lineAt(r.head),a=Y7.map(o=>LX(t,o,n)?o.mark:"").filter(o=>o!="");return{pos:Math.min(r.head,r.anchor),above:!0,strictSide:!0,arrow:!1,create:o=>{let s=document.createElement("div");return s.className="cm-tooltip-cursor",e.enactor.createRoot(s).render(J7.default.createElement(J7.default.Fragment,null,J7.default.createElement(UX,{plugin:e,cm:o,activeMarks:a,mobile:!1}))),{dom:s}}}});function BMe(e){return gnt(e)}var eR=(e,t)=>{let r=[...LOe()];return e.settings.makerMode&&(r.push(EMe,dMe({parent:document.body})),!t&&e.settings.inlineStyler&&r.push(BMe(e)),e.settings.flowMenuEnabled&&e.settings.makeMenuPlaceholder&&r.push(_Me(e)),e.settings.editorFlow&&(r.push(Bb,gMe),r.push(Wc,W7,FMe(e)),e.settings.internalLinkClickFlow?r.push(vMe):r.push(yMe(e)))),r};var RMe=Ae(Ya());var $Me=require("obsidian"),rs=Ae(Te());var qMe=(e,t)=>{if(e.isTouchScreen()){let r=e.app.workspace.containerEl.querySelector(t.settings.spacesRightSplit?".workspace-drawer.mod-right .workspace-drawer-header-left":".workspace-drawer.mod-left .workspace-drawer-header-left");r.innerHTML="",e.enactor.createRoot(r).render(rs.default.createElement(vnt,{superstate:t,plugin:e}))}},vnt=e=>{let t=(0,rs.useRef)(),[r,n]=rs.default.useState([]);(0,rs.useEffect)(()=>{setTimeout(()=>{e.superstate.ui.getWarnings().filter(a=>!e.superstate.settings.suppressedWarnings.some(o=>a.id==o))},1e3)},[]);let i=()=>{n(e.superstate.ui.getWarnings().filter(a=>!e.superstate.settings.suppressedWarnings.some(o=>a.id==o)))};return(0,rs.useEffect)(()=>(e.superstate.eventsDispatcher.addListener("superstateUpdated",i),e.superstate.eventsDispatcher.addListener("settingsChanged",i),e.superstate.eventsDispatcher.addListener("warningsChanged",i),()=>{e.superstate.eventsDispatcher.removeListener("superstateUpdated",i),e.superstate.eventsDispatcher.removeListener("settingsChanged",i),e.superstate.eventsDispatcher.removeListener("warningsChanged",i)}),[]),rs.default.createElement("div",{className:"mk-main-menu-container"},rs.default.createElement("div",{className:"mk-main-menu-inner"},rs.default.createElement("div",{className:(0,RMe.default)("mk-main-menu")},rs.default.createElement("div",{className:"mk-main-menu-button mk-main-menu-button-primary",ref:t,onClick:a=>{e.superstate.ui.mainMenu(t.current,e.superstate)}},e.superstate.settings.systemName,r.length>0&&rs.default.createElement("div",{className:"mk-icon-xsmall",dangerouslySetInnerHTML:{__html:oi.warning}}),rs.default.createElement("div",{className:"mk-icon-xsmall",dangerouslySetInnerHTML:{__html:oi["chevrons-up-down"]}})),e.superstate.settings.blinkEnabled&&rs.default.createElement("div",{className:"mk-main-menu-button",onClick:a=>e.superstate.ui.quickOpen()},rs.default.createElement("div",{className:"mk-icon-small",dangerouslySetInnerHTML:{__html:oi.search}}))),rs.default.createElement("button",{"aria-label":H.buttons.newNote,className:"mk-main-menu-button",onClick:a=>w2(e.superstate,null,Ne(a.view.document),a.metaKey?"tab":!1)},rs.default.createElement("div",{className:"mk-icon-small",dangerouslySetInnerHTML:{__html:oi["new-note"]}})),$Me.Platform.isTablet&&rs.default.createElement("div",{"aria-label":H.buttons.togglePin,className:"mk-main-menu-button",onClick:a=>e.superstate.settings.spacesRightSplit?e.plugin.app.workspace.rightSplit.togglePinned():e.plugin.app.workspace.leftSplit.togglePinned()},rs.default.createElement("div",{className:"mk-icon-small",dangerouslySetInnerHTML:{__html:oi.pin}}))))};var tR={flowMenuEnabled:!0,markSans:!1,makeMenuPlaceholder:!0,mobileMakeBar:!1,mobileSidepanel:!1,inlineStyler:!0,makerMode:!0,inlineStylerColors:!1,editorFlow:!0,internalLinkClickFlow:!0,internalLinkSticker:!0,editorFlowStyle:"minimal",menuTriggerChar:"/",inlineStickerMenu:!0,emojiTriggerChar:":",dataviewInlineContext:!1,flowState:!1};var LMe=Ae(Te());var zMe=e=>LMe.default.createElement("button",{className:`mk-collapse ${e.collapsed?"mk-collapsed":""}`,onClick:t=>{!e.onToggle||(t.stopPropagation(),e.onToggle(!e.collapsed,t))},dangerouslySetInnerHTML:{__html:oi.collapse}});var OE=require("obsidian"),iR=Ae(Te());var UMe=(e,t)=>{let r=t.map(a=>a.name),n="|",i=n+r.join(n)+`| +`)}`;t.ui.openModal("Path Fixer",oMe.default.createElement(Xy,{message:n,confirmLabel:"Rename",confirmAction:async()=>{for(let i of r){let a=ba(e.app,i),o=a instanceof aMe.TFile?a?.basename:a.name;if(!a)return;await nD(e.superstate,i,e.superstate.pathsIndex.get(i)?.metadata?.property?.aliases,o),await HDe(e,a,ov(o))}e.obsidianAdapter.fileNameWarnings=new Set}}),window)};var ent=Ae(Te());var sMe=async(e,t,r)=>{let n=e.superstate.allSpaces();e.superstate.settings.spaceSubFolder=r,e.superstate.saveSettings();for(let i of n)await e.superstate.spaceManager.pathExists(i.space?.folderPath+"/"+t)&&await e.superstate.spaceManager.renamePath(i.space?.folderPath+"/"+t,i.space?.folderPath+"/"+r);await e.superstate.spaceManager.pathExists(t)&&await e.superstate.spaceManager.renamePath(t,r),await e.superstate.initializeSpaces(),e.superstate.ui.notify("All space files have been move.")};var TX=Ae(yi());var B7=class{constructor(t){this.plugin=t;this.supportedFileTypes=["json","mkit"];this.id="json.make.md";this.plugin=t,this.cache=new Map}initiate(t){this.middleware=t}async parseCache(t,r){if(!t)return;let n=or(await this.middleware.readTextFromFile(t.path))??{},i=n.label??{},a=n.property??{},o=(0,TX.omit)(n,["label","property"]),s={property:a,definition:o,label:{name:t.name,sticker:i?.sticker?.length>0?i.sticker:"ui//json",color:i?.color,preview:"",thumbnail:""}};if(t.parent.split("/").pop()==this.plugin.superstate.settings.spaceSubFolder&&t.path.split("/").pop()=="def.json"){let l=await this.middleware.getFile(t.parent),u=l.parent=="/"?this.plugin.superstate.settings.systemName:l.parent.split("/").pop(),c=await this.readContent(t,"label",null);s.label={...c,name:u}}this.cache.set(t.path,s),this.middleware.updateFileCache(t.path,s,r)}contentTypes(t){return["property","label","definition"]}async newFile(t,r,n,i){let a=t=="/"?r+".json":`${t}/${r}.json`;return await this.middleware.fileExists(t)||await this.middleware.createFolder(t),await this.middleware.writeTextToFile(a,i??""),this.middleware.getFile(a)}async readContent(t,r,n){if(r=="definition"){let i=await this.middleware.readTextFromFile(t.path);return(0,TX.omit)(or(i)??{},["label","property"])}if(r=="property"){let i=await this.middleware.readTextFromFile(t.path);return or(i)?.property??{}}if(r=="label"){let i=await this.middleware.readTextFromFile(t.path),a=or(i)?.label??{},o=Ri("sticker",a[this.plugin.superstate.settings.fmKeySticker]),s=Ri("color",a[this.plugin.superstate.settings.fmKeyColor]),l=Ri("aliases",a[this.plugin.superstate.settings.fmKeyAlias])[0],u={};return o?.length>0&&(u.sticker=o),s?.length>0&&(u.color=s),l?.length>0&&(u.name=l),u}return null}async saveContent(t,r,n,i){if(r=="label"){let a=await this.readContent(t,"label",n);n=="sticker"?a[this.plugin.superstate.settings.fmKeySticker]=i(a):n=="color"?a[this.plugin.superstate.settings.fmKeyColor]=i(a):n=="name"&&(a[this.plugin.superstate.settings.fmKeyAlias]=[i(a)]);let o=or(await this.middleware.readTextFromFile(t.path))??{};await this.middleware.writeTextToFile(t.path,JSON.stringify({...o,label:a})),this.parseCache(t,!0)}if(r=="definition"){let a=await this.readContent(t,r,n),o=i(a),s=or(await this.middleware.readTextFromFile(t.path))??{};await this.middleware.writeTextToFile(t.path,JSON.stringify({...s,...o})),this.parseCache(t,!0)}if(r=="property"){let a=await this.readContent(t,r,n),o=i(a),s=or(await this.middleware.readTextFromFile(t.path))?.property??{};await this.middleware.writeTextToFile(t.path,JSON.stringify({...s,property:o})),this.parseCache(t,!0)}return!0}async deleteContent(t,r,n){if(r=="property"){let i=await this.readContent(t,r,n);delete i[n];let a=or(await this.middleware.readTextFromFile(t.path))??{};await this.middleware.writeTextToFile(t.path,JSON.stringify({...a,property:i})),this.parseCache(t,!0)}}};var lMe=require("obsidian");var tnt=async(e,t,r,n)=>{n.type==="folder"?n.content&&await R7(e,t,n.content,`${r}/${e.superstate.settings.spaceSubFolder}/templates`,!0):await e.files.writeTextToFile(`${r}/${e.superstate.settings.spaceSubFolder}/templates/${n.name}`,n.content)},rnt=e=>{let t=Object.values(e).map(i=>i.schema),r=Object.values(e).flatMap(i=>i.cols);return{...Object.keys(e).reduce((i,a)=>({...i,[a]:{uniques:iw.uniques,cols:iw.cols,rows:e[a].rows}}),{}),m_schema:{uniques:[],cols:["id","name","type","def","predicate","primary"],rows:t},m_fields:{uniques:sa.uniques,cols:sa.cols,rows:r}}},nnt=e=>{let t=Object.values(e).map(i=>i.schema),r=Object.values(e).flatMap(i=>i.cols);return{...Object.keys(e).reduce((i,a)=>({...i,[a]:{uniques:[],cols:e[a].cols.map(o=>o.name),rows:e[a].rows}}),{}),m_schema:{uniques:[],cols:["id","name","type","def","predicate","primary"],rows:t},m_fields:{uniques:sa.uniques,cols:sa.cols,rows:r}}},R7=async(e,t,r,n,i)=>{if(!r)return;let a=n=="/"?r.name:n+"/"+r.name,o;if(i?(await e.files.createFolder(a),o={name:r.name,type:"folder",path:a,space:{path:a,name:r.name,isRemote:!1,readOnly:!1,defPath:`${a}/${e.superstate.settings.spaceSubFolder}/def.json`,notePath:`${a}/${r.name}.md`,dbPath:`${a}/${e.superstate.settings.spaceSubFolder}/context.mdb`,framePath:`${a}/${e.superstate.settings.spaceSubFolder}/views.mdb`}}):(o=await kf(t,a,r.definition),await pi(t,o.path,r.properties)),r.content&&await e.files.writeTextToFile(o.space.notePath,r.content),r.frames){let s=o.space.framePath;e.mdbFileAdapter.newContent({path:s,isFolder:!1,name:"frames",parent:"",filename:"views.mdb"},"tables","",rnt(r.frames),{})}if(r.context){let s=o.space.dbPath;e.mdbFileAdapter.newContent({path:s,isFolder:!1,name:"context",parent:"",filename:"context.mdb"},"tables","",nnt(r.context),{})}if(r.templates?.length>0){await e.files.createFolder(`${n}/${e.superstate.settings.spaceSubFolder}/templates`);for(let s of r.templates)await tnt(e,t,o.path,s)}for(let s of r.notes)i?await e.files.writeTextToFile(o.path+"/"+s.name,s.content):za(t,o,"md",s.name,!0,s.content);for(let s of r.children)await R7(e,t,s,o.path,i);i||await t.reloadSpaceByPath(o.path)},uMe=(e,t)=>{let r=e.replace(t,"");if(r.startsWith("/"))return"."+r;{let n=t.split("/").length;return(n>0?"../".repeat(n):"")+r}},int=(e,t)=>{let r={...e};return e[Er].rows=e[Er].rows.map(n=>(n[mt]=uMe(n[mt],t),n)),r},oO=async(e,t,r,n)=>{let i=t.spacesIndex.get(r),a,o,s,l,u,c=[],f=[],d=[],p;if(i){a=i.name,u=i.metadata,o=await t.spaceManager.readAllTables(r),p=await t.spaceManager.readPath(i.space.notePath),s=await t.spaceManager.readAllFrames(r),l=Object.keys(i.properties).reduce((g,A)=>({...g,[A]:i.properties[A]}),{});let m=[...t.spacesMap.getInverse(r)];for(let g of m)if(t.spacesIndex.has(g)){let A=await oO(e,t,g,n);c.push(A)}else{let A=t.pathsIndex.get(g),b=await t.spaceManager.readPath(g);f.push({name:A.name,properties:{},content:b})}for(let g of i.templates){let A=`${i.path}/${e.superstate.settings.spaceSubFolder}/templates/${g}`,b=await t.spaceManager.getPathInfo(A);if(!g.startsWith("."))if(b.isFolder){let v=await oO(e,t,A,n);d.push({name:b.name,type:"folder",content:v})}else{let v=await t.spaceManager.readPath(A);d.push({name:b.name,type:"file",content:v})}}}else{let m=await t.spaceManager.spaceInfoForPath(r);a=m.name;let g=await t.spaceManager.readPath(m.defPath),A=await t.spaceManager.readPath(m.notePath);if(p=A,A){let x=g.match(Qv);if(x){let w=x[1];l=(0,lMe.parseYaml)(w)}}g&&(u=pC(or(g),t.settings)),o=await pE(e.mdbFileAdapter,m.dbPath),s=await pE(e.mdbFileAdapter,m.framePath);let b=await t.spaceManager.childrenForPath(r,"folder");for(let x of b){let w=await oO(e,t,x,n);c.push(w)}let v=await t.spaceManager.childrenForPath(r,"file");for(let x of v){let w=x.split("/").pop();if(w.startsWith("."))continue;let S=await t.spaceManager.readPath(x);f.push({name:w,properties:{},content:S})}}return{name:a,path:uMe(r,n),definition:u,properties:l,context:int(o,r),frames:s,children:c,content:p,notes:f,assets:[],templates:d}};var Ll=Ae(Te());var FX=(e,t,r,n)=>{t.ui.openModal("Add Kit",Ll.default.createElement(ant,{plugin:e,superstate:t,kit:r}),n)},ant=e=>{let[t,r]=(0,Ll.useState)(e.kit),[n,i]=(0,Ll.useState)("/"),a=()=>{if(!t.startsWith("https://www.make.md/static/kits/")){e.superstate.ui.notify("Invalid Kit URL");return}fetch(t).then(o=>o.text()).then(o=>{if(!o){e.superstate.ui.notify("Kit doesn't exist");return}return console.log("Adding Kit"),R7(e.plugin,e.superstate,or(o),n)}).then(o=>{e.superstate.ui.notify("Kit added"),e.hide()})};return Ll.default.createElement("div",null,Ll.default.createElement("div",{className:"setting-item"},Ll.default.createElement("div",{className:"setting-item-heading"},"Kit Location"),Ll.default.createElement("span",null),Ll.default.createElement("input",{type:"text",value:t,onChange:o=>r(o.target.value)})),Ll.default.createElement("div",{className:"setting-item"},Ll.default.createElement("div",{className:"setting-item-heading"},"Add Kit to Space"),Ll.default.createElement("span",null),Ll.default.createElement(B9,{superstate:e.superstate,triggerMenu:o=>{let s=o.target.getBoundingClientRect();Fa(s,Ne(o.view.document),e.superstate,l=>i(l))},value:e.superstate.spacesIndex.get(n)?.name,selectValue:o=>{i(o)}})),Ll.default.createElement("div",{className:"setting-item"},Ll.default.createElement("button",{onClick:()=>a()},"Add"),Ll.default.createElement("button",{onClick:e.hide},"Cancel")))};var Rb=require("@codemirror/state"),Eg=require("@codemirror/view");var Sg=e=>{let t;return e.app.workspace.iterateLeaves(r=>{let n=r.view.editor?.cm;if(n?.hasFocus)return t=n,!0},e.app.workspace.rootSplit),t},sO=e=>{let t;return e.app.workspace.iterateLeaves(r=>{if(r.view.editor?.cm?.hasFocus)return t=r.view,!0},e.app.workspace.rootSplit),t};function cMe(e,t,r){Zs(t).iterate({...r,from:e,to:e})}function lO(e,t,r){Zs(t).iterate({...r,from:e.from,to:e.to})}var mm=require("@codemirror/state"),Hh=require("@codemirror/view"),ont=typeof navigator<"u"&&!/Edge\/(\d+)/.exec(navigator.userAgent)&&/Apple Computer/.test(navigator.vendor)&&(/Mobile\/\w+/.test(navigator.userAgent)||navigator.maxTouchPoints>2),_X="-10000px";var q7=class{constructor(t,r,n){this.facet=r;this.createTooltipView=n;this.input=t.state.facet(r),this.tooltips=this.input.filter(i=>i),this.tooltipViews=this.tooltips.map(n)}update(t){if(t.focusChanged&&!t.view.hasFocus){let a=t.state.facet(this.facet);for(let o of this.tooltipViews)o.dom.remove();return this.input=a,this.tooltips=[],this.tooltipViews=[],!0}let r=t.state.facet(this.facet),n=r.filter(a=>a);if(r===this.input){for(let a of this.tooltipViews)a.update&&a.update(t);return!1}let i=[];for(let a=0;a({position:ont?"absolute":e.find(t=>t.position)?.position||"fixed",parent:e.find(t=>t.parent)?.parent||null,tooltipSpace:e.find(t=>t.tooltipSpace)?.tooltipSpace||snt})}),lnt=Hh.ViewPlugin.fromClass(class{constructor(e){this.view=e;this.inView=!0;this.lastTransaction=0;this.measureTimeout=-1;let t=e.state.facet($7);this.position=t.position,this.parent=t.parent,this.classes=e.themeClasses,this.createContainer(),this.measureReq={read:this.readMeasure.bind(this),write:this.writeMeasure.bind(this),key:this},this.manager=new q7(e,z7,r=>this.createTooltip(r)),this.intersectionObserver=typeof IntersectionObserver=="function"?new IntersectionObserver(r=>{Date.now()>this.lastTransaction-50&&r.length>0&&r[r.length-1].intersectionRatio<1&&this.measureSoon()},{threshold:[1]}):null,this.observeIntersection(),e.dom.ownerDocument.defaultView?.addEventListener("resize",this.measureSoon=this.measureSoon.bind(this)),this.maybeMeasure()}createContainer(){this.parent?(this.container=document.createElement("div"),this.container.style.position="relative",this.container.className=this.view.themeClasses,this.parent.appendChild(this.container)):this.container=this.view.dom}observeIntersection(){if(this.intersectionObserver){this.intersectionObserver.disconnect();for(let e of this.manager.tooltipViews)this.intersectionObserver.observe(e.dom)}}measureSoon(){this.measureTimeout<0&&(this.measureTimeout=setTimeout(()=>{this.measureTimeout=-1,this.maybeMeasure()},50))}update(e){e.transactions.length&&(this.lastTransaction=Date.now());let t=this.manager.update(e);t&&this.observeIntersection();let r=t||e.geometryChanged,n=e.state.facet($7);if(n.position!=this.position){this.position=n.position;for(let i of this.manager.tooltipViews)i.dom.style.position=this.position;r=!0}if(n.parent!=this.parent){this.parent&&this.container.remove(),this.parent=n.parent,this.createContainer();for(let i of this.manager.tooltipViews)this.container.appendChild(i.dom);r=!0}else this.parent&&this.view.themeClasses!=this.classes&&(this.classes=this.container.className=this.view.themeClasses);r&&this.maybeMeasure()}createTooltip(e){let t=e.create(this.view);if(t.dom.classList.add("cm-tooltip"),e.arrow&&!t.dom.querySelector(".cm-tooltip > .cm-tooltip-arrow")){let r=document.createElement("div");r.className="cm-tooltip-arrow",t.dom.appendChild(r)}return t.dom.style.position=this.position,t.dom.style.top=_X,this.container.appendChild(t.dom),t.mount&&t.mount(this.view),t}destroy(){this.view.dom.ownerDocument.defaultView?.removeEventListener("resize",this.measureSoon);for(let{dom:e}of this.manager.tooltipViews)e.remove();this.intersectionObserver?.disconnect(),clearTimeout(this.measureTimeout)}readMeasure(){let e=this.view.dom.getBoundingClientRect();return{editor:e,parent:this.parent?this.container.getBoundingClientRect():e,pos:this.manager.tooltips.map((t,r)=>{let n=this.manager.tooltipViews[r];return n.getCoords?n.getCoords(t.pos):this.view.coordsAtPos(t.pos)}),size:this.manager.tooltipViews.map(({dom:t})=>t.getBoundingClientRect()),space:this.view.state.facet($7).tooltipSpace(this.view)}}writeMeasure(e){let{editor:t,space:r}=e,n=[];for(let i=0;i=Math.min(t.bottom,r.bottom)||l.rightMath.min(t.right,r.right)+.1){s.style.top=_X;continue}let c=a.arrow?o.dom.querySelector(".cm-tooltip-arrow"):null,f=c?7:0,d=u.right-u.left,p=u.bottom-u.top,h=o.offset||cnt,m=this.view.textDirection==Hh.Direction.LTR,g=u.width>r.right-r.left?m?r.left:r.right-u.width:m?Math.min(l.left-(c?14:0)+h.x,r.right-d):Math.max(r.left,l.left-d+(c?14:0)-h.x),A=!!a.above;!a.strictSide&&(A?l.top-(u.bottom-u.top)-h.yr.bottom)&&A==r.bottom-l.bottom>l.top-r.top&&(A=!A);let b=A?l.top-p-f-h.y:l.bottom+f+h.y,v=g+d;if(o.overlap!==!0)for(let S of n)S.leftg&&S.topb&&(b=A?S.top-p-2-f:S.bottom+f+2);let x=(S,k)=>{let{top:j,right:O,bottom:C,left:N,width:D,height:P,x:q,y:z}=k,I={top:j,right:O,bottom:C,left:N};if(typeof I>"u"){let Y={top:0,left:0}}let T=S.parent.document.getElementsByTagName("iframe"),L,_=!1;for(let Y=0,oe=T.length;Ythis.createHostedView(r))}static create(t){return new uO(t)}createHostedView(t){let r=t.create(this.view);return r.dom.classList.add("cm-tooltip-section"),this.dom.appendChild(r.dom),this.mounted&&r.mount&&r.mount(this.view),r}mount(t){for(let r of this.manager.tooltipViews)r.mount&&r.mount(t);this.mounted=!0}positioned(){for(let t of this.manager.tooltipViews)t.positioned&&t.positioned()}update(t){this.manager.update(t)}},fnt=z7.compute([L7],e=>{let t=e.facet(L7).filter(r=>r);return t.length===0?null:{pos:Math.min(...t.map(r=>r.pos)),end:Math.max(...t.filter(r=>r.end!=null).map(r=>r.end)),create:uO.create,above:t[0].above,arrow:t.some(r=>r.arrow)}});var PX=class{constructor(t,r,n,i,a){this.view=t;this.source=r;this.field=n;this.setHover=i;this.hoverTime=a;this.hoverTimeout=-1;this.restartTimeout=-1;this.pending=null;this.lastMove={x:0,y:0,target:t.dom,time:0},this.checkHover=this.checkHover.bind(this),t.dom.addEventListener("mouseleave",this.mouseleave),t.dom.addEventListener("mousemove",this.mousemove)}update(){this.pending&&(this.pending=null,clearTimeout(this.restartTimeout),this.restartTimeout=setTimeout(()=>this.startHover(),20))}get active(){return this.view.state.field(this.field)}checkHover(){if(this.hoverTimeout=-1,this.active)return;let t=Date.now()-this.lastMove.time;tn.bottom||t.xn.right+this.view.defaultCharacterWidth)return;let i=this.view.bidiSpans(this.view.state.doc.lineAt(r)).find(s=>s.from<=r&&s.to>=r),a=i&&i.dir==Hh.Direction.RTL?-1:1,o=this.source(this.view,r,t.x{this.pending==s&&(this.pending=null,l&&this.view.dispatch({effects:this.setHover.of(l)}))},l=>(0,Hh.logException)(this.view.state,l,"hover tooltip"))}else o&&this.view.dispatch({effects:this.setHover.of(o)})}mousemove(t){this.lastMove={x:t.clientX,y:t.clientY,target:t.target,time:Date.now()},this.hoverTimeout<0&&(this.hoverTimeout=setTimeout(this.checkHover,this.hoverTime));let r=this.active;if(r&&!fMe(this.lastMove.target)||this.pending){let{pos:n}=r||this.pending,i=r?.end??n;(n==i?this.view.posAtCoords(this.lastMove)!=n:!dnt(this.view,n,i,t.clientX,t.clientY,6))&&(this.view.dispatch({effects:this.setHover.of(null)}),this.pending=null)}}mouseleave(t){clearTimeout(this.hoverTimeout),this.hoverTimeout=-1,this.active&&!fMe(t.relatedTarget)&&this.view.dispatch({effects:this.setHover.of(null)})}destroy(){clearTimeout(this.hoverTimeout),this.view.dom.removeEventListener("mouseleave",this.mouseleave),this.view.dom.removeEventListener("mousemove",this.mousemove)}};function fMe(e){for(let t=e;t;t=t.parentNode)if(t.nodeType==1&&t.classList.contains("cm-tooltip"))return!0;return!1}function dnt(e,t,r,n,i,a){let o=document.createRange(),s=e.domAtPos(t),l=e.domAtPos(r);o.setEnd(l.node,l.offset),o.setStart(s.node,s.offset);let u=o.getClientRects();o.detach();for(let c=0;cL7.from(i)});return[n,Hh.ViewPlugin.define(i=>new PX(i,e,n,r,t.hoverTime||300)),fnt]}var mMe=mm.StateEffect.define(),jjr=mMe.of(null);var BX=Ae(Te());var EE=require("@codemirror/state"),U7=EE.Annotation.define(),hMe=EE.Annotation.define(),W7=EE.StateField.define({create:()=>{},update(e,t){return t.annotation(hMe)?t.annotation(hMe):e}}),Bb=EE.StateField.define({create:e=>"none",update(e,t){return t.annotation(U7)?t.annotation(U7):e}});var hm=Ae(Te());var H7=e=>{let t=e.plugin.enactor.resolvePath(e.path,e.source),[r,n]=hm.default.useState();(0,hm.useMemo)(()=>e.plugin.enactor.spaceFragmentSchema(t).then(l=>n(l)),[t]);let i=()=>{navigator.clipboard.writeText(`![![${e.path}]]`),e.view.dispatch({changes:{from:e.pos.from-4,to:e.pos.to+2}})},a=()=>{e.view.dispatch({changes:{from:e.pos.from-4,to:e.pos.to+2}}),e.plugin.enactor.notify(H.notice.tableDeleted)},o=()=>{let l=e.view.posAtDOM(e.dom),c=e.view.state.doc.lineAt(l).from;e.toggleState?e.view.dispatch({changes:{from:c,to:c+1}}):e.view.dispatch({changes:{from:c,to:c,insert:"!"}})},s=l=>{let u=[];u.push({name:H.buttons.convertTable,icon:"ui//sync",onClick:c=>{e.plugin.enactor.convertSpaceFragmentToMarkdown(r,f=>{e.view.dispatch({changes:{from:e.pos.from-4,to:e.pos.to+2,insert:f}})})}}),u.push({name:H.buttons.cutTable,icon:"ui//cut",onClick:c=>{i()}}),u.push({name:H.buttons.deleteTable,icon:"ui//close",onClick:c=>{a()}}),e.plugin.enactor.openMenu(l,u)};return hm.default.createElement("div",{className:"mk-flowblock-menu"},r?r.type=="context"||r.frameType=="view"?hm.default.createElement("button",{className:"mk-toolbar-button",dangerouslySetInnerHTML:{__html:oi.options},onClick:l=>{s(l)}}):hm.default.createElement(hm.default.Fragment,null):hm.default.createElement(hm.default.Fragment,null,e.toggle&&hm.default.createElement("button",{"aria-label":H.buttons.toggleFlow,onClick:o,className:`mk-toolbar-button ${e.toggleState?"mk-toggle-on":""}`,dangerouslySetInnerHTML:{__html:e.toggleState?oi["book-open"]:oi["edit-3"]}})))};var zl=Ae(Te()),pnt=e=>e.charAt(0)=="/"?e.substring(1):e,AMe=e=>e.lastIndexOf("/")!=-1?e.lastIndexOf(".")!=-1?pnt(e.substring(e.lastIndexOf("/")+1,e.lastIndexOf("."))):e.substring(e.lastIndexOf("/")+1):e.lastIndexOf(".")!=-1?e.substring(0,e.lastIndexOf(".")):e,cO=(0,zl.forwardRef)((e,t)=>{let r=(0,zl.useRef)(null),[n,i]=(0,zl.useState)(!1),[a,o]=(0,zl.useState)(!1),s=async u=>{let c=r.current,f=e.plugin.enactor.uriByString(e.path,e.source),d=await e.plugin.enactor.pathExists(f.basePath),p=e.plugin.enactor.isSpace(f.basePath),h=p&&e.forceNote?e.plugin.enactor.spaceNotePath(e.path):d?f.fullPath:null;if(h)i(!1),e.plugin.enactor.openPath(h,c);else if(u){let m=p?e.plugin.enactor.spaceFolderPath(e.path):e.plugin.enactor.parentPath(f.basePath);if(!m)return;let g=await e.plugin.enactor.createNote(m,AMe(e.path));i(!1),await e.plugin.enactor.openPath(g,c)}else{i(!0),o(!1);return}o(!0)},l=()=>{e.load?s():r?.current&&(r.current.innerHTML="")};return(0,zl.useEffect)(()=>{l()},[e.load,e.path]),(0,zl.useEffect)(()=>{let u=()=>{r.current&&!r.current.hasChildNodes()&&e.load&&!n&&s()};return e.plugin.enactor.addActiveStateListener(u),()=>{r.current=null,e.plugin.enactor.removeActiveStateListener(u)}},[]),zl.default.createElement(zl.default.Fragment,null,zl.default.createElement("div",{className:`${e.classname??""} mk-flowspace-editor`,ref:r,onClick:u=>u.stopPropagation()}),n?zl.default.createElement("div",{onClick:()=>s(!0),className:"mk-placeholder",style:{color:"var(--mk-ui-text-tertiary)"}},H.labels.notePlaceholder.replace("${1}",AMe(e.path))):zl.default.createElement(zl.default.Fragment,null))});cO.displayName="UINote";var kE=(e,t)=>(r,n)=>{let i=t?r:n,a=t?n:r;return i[e]a[e]?1:0};var fO=require("obsidian");var Uf=Rb.Annotation.define(),Am=Rb.Annotation.define(),gMe=Rb.EditorState.transactionFilter.of(e=>{let t=[],r=e.state.field(Wc,!1);return r&&!e.annotation(Uf)&&t.push(...r.filter(n=>n.expandedState==1).map(n=>e.state.field(Bb,!1)=="doc"?{annotations:Uf.of([n.id,2])}:{annotations:Uf.of([n.id,0])})),[e,...t]}),vMe=Eg.ViewPlugin.fromClass(class{constructor(e){}},{eventHandlers:{mousedown:(e,t)=>{if(!e.shiftKey)return;let r=t.posAtDOM(e.target),{from:n,to:i,text:a}=t.state.doc.lineAt(r);for(let o of a.matchAll(/(?!!)\[\[([^\]]+)\]\]/g)){let l=t.state.field(Wc,!1).find(u=>u.to==n+o.index+o[1].length+2&&r>=u.from&&r<=u.to);l&&(e.preventDefault(),t.dispatch({annotations:Uf.of([l.id,2])}))}}}}),yMe=e=>pMe((t,r,n)=>{let{from:i,to:a}=t.state.doc.lineAt(r),o=null;return lO({from:i,to:a},t.state,{enter:({name:s,from:l,to:u})=>{if(s.includes("hmd-internal-link")&&r<=u&&r>=l){let f=t.state.field(Wc,!1).find(d=>d.to==u);if(f)return o={pos:r,end:u,above:!0,create(d){let p=document.createElement("div");p.classList.add("mk-flow-hover"),p.classList.add("menu");let h=p.createDiv();h.setAttribute("aria-label",f.expandedState==0?H.buttons.openFlow:H.buttons.hideFlow),h.addEventListener("click",()=>{d.dispatch({annotations:Uf.of([f.id,2])})});let m=h.createDiv();return m.innerHTML=oi["mk-ui-flow-hover"],h.insertAdjacentText("beforeend",f.expandedState==0?H.buttons.openFlow:H.buttons.hideFlow),{dom:p}}},!1}}}),o}),Wc=Rb.StateField.define({create(){return[]},update(e,t){let r=[],n=e,i=[],a=t.newDoc.sliceString(0),o=s=>s!=2?2:0;for(let s of a.matchAll(/(?:!\[!\[|!!\[\[)([^\]]+)\]\]/g)){let l=s[1],u=n.filter(h=>h.link==l),c=i.filter(h=>h==l).length,f=u[c],d=f?f.id:fv();i.push(l);let p={id:d,link:s[1],from:s.index+4,to:s.index+4+s[1].length,type:1,height:f?t.annotation(Am)?.[0]==d&&t.annotation(Am)?.[1]!=0?t.annotation(Am)?.[1]:f.height:-1,expandedState:f?t.annotation(Uf)?.[0]==d?o(f.expandedState):f.expandedState:1};r.push(p)}for(let s of a.matchAll(/\[\[([^\]]+)\]\]/g))if(a.charAt(s.index-1)!="!"){let l=s[1],u=n.filter(h=>h.link==l),c=i.filter(h=>h==l).length,f=u[c],d=f?f.id:fv();i.push(l);let p={id:d,link:s[1],from:s.index+2,to:s.index+2+s[1].length,type:0,height:f?t.annotation(Am)?.[0]==d&&t.annotation(Am)?.[1]!=0?t.annotation(Am)?.[1]:f.height:-1,expandedState:f?t.annotation(Uf)?.[0]==d?o(f.expandedState):f.expandedState:0};r.push(p)}else if(a.charAt(s.index-2)!="!"){let l=s[1],u=n.filter(h=>h.link==l),c=i.filter(h=>h==l).length,f=u[c],d=f?f.id:fv();i.push(l);let p={id:d,link:s[1],from:s.index+3,to:s.index+3+s[1].length,type:2,height:f?t.annotation(Am)?.[0]==d&&t.annotation(Am)?.[1]!=0?t.annotation(Am)?.[1]:f.height:-1,expandedState:f?t.annotation(Uf)?.[0]==d?o(f.expandedState):f.expandedState:1};r.push(p)}return r.sort(kE("from",!0)),r}}),V7=class extends Eg.WidgetType{constructor(r,n){super();this.info=r;this.plugin=n}eq(r){return r.info.id===this.info.id}toDOM(r){let n=document.createElement("div");if(n.classList.add("mk-floweditor-container"),n.setAttribute("id","mk-flow-"+this.info.id),n.style.setProperty("height",this.info.height+"px"),this.info.link&&r.state.field(fO.editorInfoField,!1)){let a=r.state.field(fO.editorInfoField,!1).file;this.root=this.plugin.enactor.createRoot(n),this.root.render(BX.default.createElement(cO,{load:!0,plugin:this.plugin,path:this.info.link,source:a.path}))}return n}get estimatedHeight(){return this.info.height}destroy(r){this.root&&this.root.unmount()}},IX=class extends Eg.WidgetType{constructor(r,n){super();this.info=r;this.flowInfo=r,this.plugin=n}eq(r){return r.info.id===this.info.id}toDOM(r){let n=document.createElement("div");n.classList.add("mk-floweditor-selector");let i=this.plugin.enactor.createRoot(n);if(this.info.link&&r.state.field(fO.editorInfoField,!1)){let o=r.state.field(fO.editorInfoField,!1).file;i.render(BX.default.createElement(H7,{app:this.plugin.app,plugin:this.plugin,toggle:!0,path:this.info.link,source:o?.path,toggleState:!0,view:r,pos:{from:this.info.from,to:this.info.to},dom:n}))}return n}},G7=(e,t)=>Eg.Decoration.replace({widget:new IX(e,t),inclusive:!0,block:!1}),CE=(e,t)=>Eg.Decoration.replace({widget:new V7(e,t),inclusive:!0,block:!1}),Q7=(e,t)=>Eg.Decoration.widget({widget:new V7(e,t),inclusiveStart:!0,block:!0});var bMe=require("obsidian");var dO=class extends bMe.EditorSuggest{constructor(r,n){super(r);this.inCmd=!1;this.cmdStartCh=0;this.plugin=n}resetInfos(){this.cmdStartCh=0,this.inCmd=!1}onTrigger(r,n,i){let a=n.getLine(r.line).slice(0,r.ch),o=this.plugin.settings.menuTriggerChar.length;if(this.file=i,!this.inCmd&&a.slice(0,o)!==this.plugin.settings.menuTriggerChar&&a.slice(-2-o)!=="- "+this.plugin.settings.menuTriggerChar)return this.resetInfos(),null;this.inCmd||(this.cmdStartCh=a.length-o,this.inCmd=!0);let s=a.slice(this.cmdStartCh,r.ch);return s.length>1&&s.includes(" ")||!s.includes(this.plugin.settings.menuTriggerChar)?(this.resetInfos(),null):{start:r,end:r,query:s.slice(o)}}getSuggestions(r){let n=this.plugin.commands.filter(({label:i})=>i.toLowerCase().includes(r.query.toLowerCase())||H.commands[i]&&H.commands[i].toLowerCase().includes(r.query.toLowerCase()));return n.length>0?n:[{label:H.commandsSuggest.noResult,value:"",icon:"",type:0}]}renderSuggestion(r,n){if(r.value==""){n.setText(H.commandsSuggest.noResult);return}let i=n.createDiv("mk-slash-item"),a=i.createDiv("mk-slash-icon");a.innerHTML=oi[r.icon],i.createDiv().setText(H.commands[r.label]??r.label)}selectSuggestion(r,n){let i=this.context.start,a=this.context.end,o=this.cmdStartCh,s=this.context.editor;r.label!==H.commandsSuggest.noResult&&(r.onSelect?r.onSelect(n,this.plugin,this.file,s,i,o,a,()=>{this.resetInfos(),this.close()}):(this.context.editor.replaceRange(r.value,{...this.context.start,ch:this.cmdStartCh},this.context.end),r.offset&&this.context.editor.setSelection({...this.context.start,ch:this.cmdStartCh+r.offset[1]},{...this.context.end,ch:this.cmdStartCh+r.value.length+r.offset[0]}),this.resetInfos(),this.close()))}};var xMe=require("obsidian"),RX=Ae(Te());var pO=class extends xMe.EditorSuggest{constructor(r,n){super(r);this.inCmd=!1;this.cmdStartCh=0;this.plugin=n,this.emojis=Object.keys(gE).reduce((i,a)=>[...i,...gE[a].map(o=>({label:o.n[0],desc:o.n[1],variants:o.v,unicode:o.u}))],[])}resetInfos(){this.cmdStartCh=0,this.inCmd=!1}onTrigger(r,n,i){let a=n.getLine(r.line).slice(0,r.ch);if(!this.inCmd&&!(a.slice(-2)==" "+this.plugin.settings.emojiTriggerChar||a[0]==this.plugin.settings.emojiTriggerChar))return this.resetInfos(),null;this.inCmd||(this.cmdStartCh=a.length-1,this.inCmd=!0);let o=a.slice(this.cmdStartCh,r.ch);return o.includes(" ")||!o.includes(this.plugin.settings.emojiTriggerChar)?(this.resetInfos(),null):(this.suggestEl.classList.toggle("mk-emoji-menu",!0),{start:r,end:r,query:o.slice(1)})}getSuggestions(r){let n=this.emojis.filter(({label:i,desc:a})=>i.includes(r.query)||a?.includes(r.query));return n.length>0?n:[{label:H.commandsSuggest.noResult,unicode:"",desc:""}]}renderSuggestion(r,n){let i=document.createElement("div");i.setAttribute("aria-label",r.label),this.plugin.enactor.createRoot(i).render(RX.default.createElement(RX.default.Fragment,null,r.unicode.length>0?Yy(r.unicode):H.commandsSuggest.noResult)),n.appendChild(i)}selectSuggestion(r,n){r.label!==H.commandsSuggest.noResult&&(this.context.editor.replaceRange(Yy(r.unicode),{...this.context.start,ch:this.cmdStartCh},this.context.end),this.resetInfos(),this.close())}};var X7=require("@codemirror/state");var Y7=[{mark:"em",formatting:"formatting-em",altFormatting:"em_formatting_formatting-strong",formatChar:"*"},{mark:"strong",formatting:"formatting-strong",formatChar:"**"},{mark:"strikethrough",formatting:"formatting-strikethrough",formatChar:"~~"},{mark:"inline-code",formatting:"formatting-code",formatChar:"`"}];var $b=X7.Annotation.define(),wMe=(e,t,r)=>t&&r.sliceDoc(e,e+1)==" "?e+1:!t&&r.sliceDoc(e-1,e)==" "?e-1:e,SMe=(e,t,r)=>{let n=r.doc.lineAt(e),i=t?n.from:e,a=t?e:n.to,o=i,s=i,l=!1;return lO({from:i,to:a},r,{enter:u=>{if(l)return!1;if(u.name.includes("formatting")){if(!t&&u.from>i)return!1;t?(o=u.from,s=u.to):o=u.to}}}),t&&s{let r=wMe(SMe(e.from,!0,t),!0,t),n=wMe(SMe(e.to,!1,t),!1,t);return{from:r,to:n}},Xv=(e,t)=>({changes:{from:e,to:e,insert:t.formatChar}}),LX=(e,t,r)=>mO(r.from,e,t.mark)&&mO(r.to,e,t.mark),mO=(e,t,r)=>{let n=!1;return cMe(e,t,{enter:({name:i,from:a,to:o})=>{$X(i,r)&&(n=!0)}}),n},$X=(e,t)=>e.includes(t),Z7=(e,t,r)=>mO(e,t,r.mark),DE=(e,t,r)=>mO(e,t,r.formatting)?!0:r.altFormatting?mO(e,t,r.altFormatting):!1,mnt=(e,t,r)=>{let n=[];return LX(r,t,e)?(DE(e.from,r,t)&&!DE(e.to,r,t)&&n.push(Xv(e.to,t)),DE(e.to,r,t)&&!DE(e.from,r,t)&&n.push(Xv(e.from,t))):Z7(e.from,r,t)?(DE(e.from,r,t)&&!Z7(e.from-1,r,t)&&n.push(Xv(e.from,t)),n.push(Xv(e.to,t))):Z7(e.to,r,t)?(DE(e.to,r,t)&&!Z7(e.to+1,r,t)&&n.push(Xv(e.to,t)),n.push(Xv(e.from,t))):(n.push(Xv(e.to,t)),n.push(Xv(e.from,t))),n},hnt=(e,t,r)=>{let n=[];return lO({from:e.from,to:e.to},t,{enter:({name:i,from:a,to:o})=>{($X(i,r.formatting)||(r.altFormatting?$X(i,r.altFormatting):!1))&&n.push({from:a,to:a+r.formatChar.length})}}),{changes:n}},EMe=X7.EditorState.transactionFilter.of(e=>{if(!e.annotation($b))return e;let t=e.annotation($b),r=Y7.find(l=>l.mark==t);if(!r)return e;let n=e.startState.selection.main,i=[];if(n.head==n.anchor)return e.startState.sliceDoc(n.head-r.formatChar.length,n.head)==r.formatChar&&e.startState.sliceDoc(n.head,n.head+r.formatChar.length)==r.formatChar?i.push({changes:{from:n.head-r.formatChar.length,to:n.head+r.formatChar.length}}):i.push({changes:{from:n.head,insert:r.formatChar+r.formatChar},selection:{anchor:n.head+r.formatChar.length,head:n.head+r.formatChar.length}}),[e,...i];let a=qX(n,e.startState);i.push(hnt(a,e.startState,r));let o=a.from,s=a.to;return i.push(...mnt(a,r,e.startState)),[e,...i,{selection:{anchor:o,head:s}}]});var MMe=Ae(Ya());var zX=require("obsidian"),zn=Ae(Te());var kMe=Ae(Te());var CMe=e=>{let{i:t,style:r,active:n,toggleMarkAction:i}=e;return kMe.default.createElement("div",{key:t,"aria-label":e.plugin.isTouchScreen()?void 0:H.styles[r.label],className:`mk-mark ${r.mark&&n?"mk-mark-active":""}`,dangerouslySetInnerHTML:{__html:oi[`${r.icon}`]},onMouseDown:a=>i(a,r)})};var DMe=[{label:"bold",value:"****",insertOffset:2,icon:"mk-mark-strong",mark:"strong"},{label:"italics",value:"**",insertOffset:1,icon:"mk-mark-em",mark:"em"},{label:"strikethrough",value:"~~~~",insertOffset:2,icon:"mk-mark-strikethrough",mark:"strikethrough"},{label:"code",value:"``",insertOffset:1,icon:"mk-mark-code",mark:"inline-code"},{label:"link",value:"[]()",insertOffset:1,cursorOffset:2,icon:"mk-mark-link"}];function OMe(){return DMe}var jMe=(e,t)=>{t.enactor.createRoot(e).render(zn.default.createElement(UX,{mobile:!0,activeMarks:[],plugin:t}))},UX=e=>{let[t,r]=(0,zn.useState)(e.mobile?0:1),[n,i]=(0,zn.useState)(null),a=g=>{g.preventDefault();let A=e.cm??Sg(e.plugin);if(!A)return;let b=A.state.selection.main.to,v=A.state.sliceDoc(b-1,b)==A.state.lineBreak?e.plugin.settings.menuTriggerChar:A.state.lineBreak+e.plugin.settings.menuTriggerChar;A.dispatch({changes:{from:b,to:b,insert:v},selection:{head:b+v.length,anchor:b+v.length}})},o=(g,A)=>{g.preventDefault();let b=e.cm??Sg(e.plugin);if(!b)return;if(A.mark){b.dispatch({annotations:$b.of(A.mark)});return}let v=b.state.selection.main,x=b.state.sliceDoc(v.from,v.to);b.dispatch({changes:{from:v.from,to:v.to,insert:A.value.substring(0,A.insertOffset)+x+A.value.substring(A.insertOffset)},selection:A.cursorOffset?{anchor:v.from+A.value.substring(0,A.insertOffset).length+x.length+A.cursorOffset,head:v.from+A.value.substring(0,A.insertOffset).length+x.length+A.cursorOffset}:{anchor:v.from+A.value.substring(0,A.insertOffset).length,head:v.from+A.value.substring(0,A.insertOffset).length+x.length}})},s=()=>zn.default.createElement(zn.default.Fragment,null,zn.default.createElement("div",{"aria-label":e.plugin.isTouchScreen()?void 0:H.commands.makeMenu,onMouseDown:g=>{a(g)},className:"mk-mark",dangerouslySetInnerHTML:{__html:oi["mk-make-slash"]}}),zn.default.createElement("div",{"aria-label":e.plugin.isTouchScreen()?void 0:H.commands.selectStyle,onMouseDown:()=>{r(1)},className:"mk-mark",dangerouslySetInnerHTML:{__html:oi["mk-make-style"]}}),zn.default.createElement("div",{"aria-label":e.plugin.isTouchScreen()?void 0:H.commands.image,onMouseDown:()=>{let g=sO(e.plugin);e.plugin.app.commands.commands["editor:attach-file"].editorCallback(g.editor,g)},className:"mk-mark",dangerouslySetInnerHTML:{__html:oi["mk-make-attach"]}}),zn.default.createElement("div",{"aria-label":e.plugin.isTouchScreen()?void 0:H.commands.toggleKeyboard,onMouseDown:()=>{let g=sO(e.plugin);e.plugin.app.commands.commands["editor:indent-list"].editorCallback(g.editor,g)},className:"mk-mark",dangerouslySetInnerHTML:{__html:oi["mk-make-indent"]}}),zn.default.createElement("div",{"aria-label":e.plugin.isTouchScreen()?void 0:H.commands.toggleKeyboard,onMouseDown:()=>{let g=sO(e.plugin);e.plugin.app.commands.commands["editor:unindent-list"].editorCallback(g.editor,g)},className:"mk-mark",dangerouslySetInnerHTML:{__html:oi["mk-make-unindent"]}}),zn.default.createElement("div",{"aria-label":e.plugin.isTouchScreen()?void 0:H.commands.toggleKeyboard,onMouseDown:()=>{let g=sO(e.plugin);e.plugin.app.commands.commands["editor:toggle-keyboard"].editorCallback(g.editor,g)},className:"mk-mark",dangerouslySetInnerHTML:{__html:oi["mk-make-keyboard"]}})),l=()=>zn.default.createElement(zn.default.Fragment,null,zn.default.createElement("div",{className:"mk-mark",onMouseDown:()=>{i(null),r(1)},dangerouslySetInnerHTML:{__html:oi.close}}),x2.map((g,A)=>zn.default.createElement("div",{key:A,onMouseDown:()=>{r(1),i(null);let b=e.cm??Sg(e.plugin);if(!b)return;let v=b.state.selection.main,x=b.state.sliceDoc(v.from,v.to);b.dispatch({changes:{from:v.from,to:v.to,insert:n.prefix+g[1]+n.suffix+x+n.closeTag}})},className:"mk-color",style:{background:g[1]}})));function u(g){let A=/^(\s*)(-|\d+\.)\s+(\[[ x]\]\s+)?/,b=g.match(A);return b?b[1].length:-1}function c(g,A){let v=(x=>new RegExp(`^([\\t]|[ ]{2,4}){0,${x}}`,"gm"))(A);return g.replace(v,"")}function f(g){let A=/^(\s*)([-*+]|\d+\.)\s+(\[[ x]\]\s+)?/gm;return g.replace(A,"")}let d=async()=>{let g=e.cm.state.doc.lineAt(e.cm.state.selection.main.from),A=u(e.cm.state.sliceDoc(g.from,g.to)),b=e.cm.state.doc.lineAt(e.cm.state.selection.main.from).number,v=e.cm.state.doc.lineAt(e.cm.state.selection.main.to).number,x=[],S=e.cm.state.field(zX.editorInfoField,!1).file;if(S&&e.plugin.enactor.isSpace(S.parent.path)){for(let k=b;k<=v;k++){let j=e.cm.state.doc.line(k),O=u(j.text),C=f(j.text),N=await e.plugin.enactor.createNote(S.parent.path,C);x.push({from:j.to-C.length,to:j.to,insert:`[[${N}|${C}]]`})}e.cm.dispatch({changes:x})}},p=g=>{e.plugin.enactor.selectLink(g,A=>{let b=e.cm.state.selection.main,v=e.cm.state.sliceDoc(b.from,b.to),x=[{from:b.from,to:b.to,insert:`[[${A}|${v}]]`}];e.cm.dispatch({changes:x})})},h=g=>{let A=e.cm.state.doc.lineAt(e.cm.state.selection.main.from),b=[],v=null;if(g>0){let O=e.cm.state.doc.lineAt(e.cm.state.selection.main.from).number,C=u(A.text),N=O+1;for(;N<=e.cm.state.doc.lines;){let D=e.cm.state.doc.line(N);if(u(D.text)>C&&b.push(D),u(D.text)<=C)break;N++}g==1&&(v=b.map(D=>c(D.text,C+1)).join(` +`))}let x=e.cm.state.selection.main.to,w=e.cm.state.selection.main,k=e.cm.state.field(zX.editorInfoField,!1).file,j=e.cm.state.sliceDoc(w.from,w.to);if(k&&e.plugin.enactor.isSpace(k.parent.path)){let C=ov(j).trim();e.plugin.enactor.createNote(k.parent.path,C,v).then(N=>{if(N){let D=[{from:w.from,to:w.to,insert:`[[${N}|${j}]]`}];g==1&&D.push({from:e.cm.state.doc.lineAt(w.from+1).to,to:e.cm.state.doc.line(A.number+b.length).to,insert:""}),e.cm.dispatch({changes:D})}})}},m=()=>zn.default.createElement(zn.default.Fragment,null,e.mobile?zn.default.createElement("div",{className:"mk-mark",onMouseDown:()=>{r(0)},dangerouslySetInnerHTML:{__html:oi.close}}):zn.default.createElement(zn.default.Fragment,null),OMe().map((g,A)=>zn.default.createElement(CMe,{plugin:e.plugin,key:A,i:A,style:g,active:!!e.activeMarks.find(b=>b==g.mark),toggleMarkAction:o})),zn.default.createElement("div",{className:"mk-divider"}),zn.default.createElement("div",{"aria-label":H.styles.blocklink,onClick:g=>{p(g)},className:"mk-mark",dangerouslySetInnerHTML:{__html:oi["mk-mark-blocklink"]}}),zn.default.createElement("div",{className:"mk-mark-group"},zn.default.createElement("div",{"aria-label":"New Note",onMouseDown:()=>{h(0)},className:"mk-mark",dangerouslySetInnerHTML:{__html:oi["new-note"]}})),e.plugin.settings.inlineStylerColors?zn.default.createElement(zn.default.Fragment,null,zn.default.createElement("div",{className:"mk-divider"}),zn.default.createElement("div",{"aria-label":e.plugin.isTouchScreen()?void 0:H.styles.textColor,onMouseDown:()=>{r(2),i({prefix:"",closeTag:""})},className:"mk-mark",dangerouslySetInnerHTML:{__html:oi["mk-mark-color"]}}),zn.default.createElement("div",{"aria-label":e.plugin.isTouchScreen()?void 0:H.styles.highlight,onMouseDown:()=>{r(2),i({prefix:"",closeTag:""})},className:"mk-mark",dangerouslySetInnerHTML:{__html:oi["mk-mark-highlight"]}})):zn.default.createElement(zn.default.Fragment,null));return zn.default.createElement("div",{className:(0,MMe.default)(e.mobile?"mk-style-toolbar":"mk-style-menu"),onMouseDown:g=>g.preventDefault()},t==0&&e.mobile?s():t==2?l():m())};var NMe=e=>{e.settings.flowMenuEnabled&&e.plugin.registerEditorSuggest(new dO(e.app,e)),e.settings.inlineStickerMenu&&e.plugin.registerEditorSuggest(new pO(e.app,e)),e.isTouchScreen()&&e.settings.mobileMakeBar&&e.settings.inlineStyler&&jMe(e.app.mobileToolbar.containerEl,e)};var JMe=require("obsidian");var nR=require("@codemirror/state"),Kv=require("@codemirror/view");var TMe=require("@codemirror/view");var FMe=e=>TMe.EditorView.updateListener.of(t=>{if(t.heightChanged&&e.app.workspace.iterateRootLeaves(r=>{let n=r.view.editor?.cm;n&&t.view.dom==n.dom&&n.state.field(Bb,!1)&&r.containerEl.parentElement?.hasClass("workspace-tab-container")&&n.state.field(Bb,!1)!="doc"&&n.dispatch({annotations:U7.of("doc")})}),t.heightChanged){let r=t.state.field(W7,!1);r&&e.app.workspace.iterateLeaves(n=>{let i=n.view.editor?.cm;if(i){let a=i.state.field(Wc,!1);a&&a.find(o=>o.id==r)&&i.dispatch({annotations:Am.of([r,t.view.contentHeight])})}},e.app.workspace.rootSplit)}});var K7=require("@codemirror/state"),hO=require("@codemirror/view");var Ant=e=>hO.Decoration.line({attributes:{"data-ph":H.labels.placeholder.replace("${1}",e.settings.menuTriggerChar)},class:"mk-placeholder"}),_Me=e=>K7.StateField.define({create(){return hO.Decoration.none},update(t,r){let n=new K7.RangeSetBuilder,i=r.state.doc.lineAt(r.state.selection.main.head);return i?.length==0&&n.add(i.from,i.from,Ant(e)),n.finish()},provide:t=>hO.EditorView.decorations.from(t)});var IMe=require("@codemirror/state");var J7=Ae(Te());var gnt=e=>IMe.StateField.define({create:PMe(e),update(t,r){return!r.docChanged&&!r.selection?t:PMe(e)(r.state)},provide:t=>z7.computeN([t],r=>r.field(t))}),PMe=e=>t=>t.selection.ranges.filter(r=>!r.empty).map(r=>{let n=qX(r,t),i=t.doc.lineAt(r.head),a=Y7.map(o=>LX(t,o,n)?o.mark:"").filter(o=>o!="");return{pos:Math.min(r.head,r.anchor),above:!0,strictSide:!0,arrow:!1,create:o=>{let s=document.createElement("div");return s.className="cm-tooltip-cursor",e.enactor.createRoot(s).render(J7.default.createElement(J7.default.Fragment,null,J7.default.createElement(UX,{plugin:e,cm:o,activeMarks:a,mobile:!1}))),{dom:s}}}});function BMe(e){return gnt(e)}var eR=(e,t)=>{let r=[...LOe()];return r.push(EMe,dMe({parent:document.body})),!t&&e.settings.inlineStyler&&r.push(BMe(e)),e.settings.flowMenuEnabled&&e.settings.makeMenuPlaceholder&&r.push(_Me(e)),e.settings.editorFlow&&(r.push(Bb,gMe),r.push(Wc,W7,FMe(e)),e.settings.internalLinkClickFlow?r.push(vMe):r.push(yMe(e))),r};var RMe=Ae(Ya());var $Me=require("obsidian"),rs=Ae(Te());var qMe=(e,t)=>{if(e.isTouchScreen()){let r=e.app.workspace.containerEl.querySelector(t.settings.spacesRightSplit?".workspace-drawer.mod-right .workspace-drawer-header-left":".workspace-drawer.mod-left .workspace-drawer-header-left");r.innerHTML="",e.enactor.createRoot(r).render(rs.default.createElement(vnt,{superstate:t,plugin:e}))}},vnt=e=>{let t=(0,rs.useRef)(),[r,n]=rs.default.useState([]);(0,rs.useEffect)(()=>{setTimeout(()=>{e.superstate.ui.getWarnings().filter(a=>!e.superstate.settings.suppressedWarnings.some(o=>a.id==o))},1e3)},[]);let i=()=>{n(e.superstate.ui.getWarnings().filter(a=>!e.superstate.settings.suppressedWarnings.some(o=>a.id==o)))};return(0,rs.useEffect)(()=>(e.superstate.eventsDispatcher.addListener("superstateUpdated",i),e.superstate.eventsDispatcher.addListener("settingsChanged",i),e.superstate.eventsDispatcher.addListener("warningsChanged",i),()=>{e.superstate.eventsDispatcher.removeListener("superstateUpdated",i),e.superstate.eventsDispatcher.removeListener("settingsChanged",i),e.superstate.eventsDispatcher.removeListener("warningsChanged",i)}),[]),rs.default.createElement("div",{className:"mk-main-menu-container"},rs.default.createElement("div",{className:"mk-main-menu-inner"},rs.default.createElement("div",{className:(0,RMe.default)("mk-main-menu")},rs.default.createElement("div",{className:"mk-main-menu-button mk-main-menu-button-primary",ref:t,onClick:a=>{e.superstate.ui.mainMenu(t.current,e.superstate)}},e.superstate.settings.systemName,r.length>0&&rs.default.createElement("div",{className:"mk-icon-xsmall",dangerouslySetInnerHTML:{__html:oi.warning}}),rs.default.createElement("div",{className:"mk-icon-xsmall",dangerouslySetInnerHTML:{__html:oi["chevrons-up-down"]}})),e.superstate.settings.blinkEnabled&&rs.default.createElement("div",{className:"mk-main-menu-button",onClick:a=>e.superstate.ui.quickOpen()},rs.default.createElement("div",{className:"mk-icon-small",dangerouslySetInnerHTML:{__html:oi.search}}))),rs.default.createElement("button",{"aria-label":H.buttons.newNote,className:"mk-main-menu-button",onClick:a=>w2(e.superstate,null,Ne(a.view.document),a.metaKey?"tab":!1)},rs.default.createElement("div",{className:"mk-icon-small",dangerouslySetInnerHTML:{__html:oi["new-note"]}})),$Me.Platform.isTablet&&rs.default.createElement("div",{"aria-label":H.buttons.togglePin,className:"mk-main-menu-button",onClick:a=>e.superstate.settings.spacesRightSplit?e.plugin.app.workspace.rightSplit.togglePinned():e.plugin.app.workspace.leftSplit.togglePinned()},rs.default.createElement("div",{className:"mk-icon-small",dangerouslySetInnerHTML:{__html:oi.pin}}))))};var tR={flowMenuEnabled:!0,markSans:!1,makeMenuPlaceholder:!0,mobileMakeBar:!1,mobileSidepanel:!1,inlineStyler:!0,inlineStylerColors:!1,editorFlow:!0,internalLinkClickFlow:!0,internalLinkSticker:!0,editorFlowStyle:"minimal",menuTriggerChar:"/",inlineStickerMenu:!0,emojiTriggerChar:":",dataviewInlineContext:!1,flowState:!1};var LMe=Ae(Te());var zMe=e=>LMe.default.createElement("button",{className:`mk-collapse ${e.collapsed?"mk-collapsed":""}`,onClick:t=>{!e.onToggle||(t.stopPropagation(),e.onToggle(!e.collapsed,t))},dangerouslySetInnerHTML:{__html:oi.collapse}});var OE=require("obsidian"),iR=Ae(Te());var UMe=(e,t)=>{let r=t.map(a=>a.name),n="|",i=n+r.join(n)+`| `;return t.forEach(a=>{i+=n+"----"}),i+=n+` `,e.forEach(a=>{i+=r.map(o=>n+a[o]).join("")+`| `}),i},WX=class extends Kv.WidgetType{constructor(r,n){super();this.info=r;this.flowInfo=r,this.superstate=n}eq(r){return r.info.id===this.info.id}toDOM(r){let n=document.createElement("div");n.classList.add("mk-floweditor-sticker");let i=this.superstate.ui.createRoot(n);if(this.info.link&&r.state.field(OE.editorInfoField,!1)){let o=r.state.field(OE.editorInfoField,!1).file,s=this.superstate.spaceManager.uriByString(this.info.link,o?.path);i.render(iR.default.createElement(f9,{superstate:this.superstate,path:s.basePath}))}return n}},HX=class extends Kv.WidgetType{constructor(r,n){super();this.info=r;this.flowInfo=r,this.superstate=n}eq(r){return r.info.id===this.info.id&&r.info.expandedState==this.info.expandedState}toDOM(r){let n=document.createElement("div");n.classList.add("mk-floweditor-toggle");let i=this.superstate.ui.createRoot(n);return this.info.link&&r.state.field(OE.editorInfoField,!1)&&i.render(iR.default.createElement(zMe,{collapsed:this.info.expandedState==0,onToggle:a=>{r.dispatch({annotations:Uf.of([this.info.id,a?2:0])})}})),n}},WMe=(e,t,r)=>{let n=new nR.RangeSetBuilder,i=e.field(Wc,!1),a=[];for(let s of i){let{from:l,to:u,type:c,expandedState:f}=s,d=l-3==e.doc.lineAt(l).from&&u+2==e.doc.lineAt(l).to;c==0?(t.settings.internalLinkSticker&&a.push({start:l-2,end:l-2,decoration:Kv.Decoration.widget({widget:new WX(s,r),side:-1})}),t.settings.internalLinkClickFlow&&a.push({start:u+2,end:u+2,decoration:Kv.Decoration.widget({widget:new HX(s,r),side:-1})}),f==2&&a.push({start:u+2,end:u+2,decoration:CE(s,t)})):f==2&&c==1&&(e.selection.main.from==l-4&&e.selection.main.to==u+2||e.selection.main.from>=l-3&&e.selection.main.to<=u+1||(a.push({start:l-4,end:l-3,decoration:G7(s,t)}),d?a.push({start:l-3,end:u+2,decoration:Q7(s,t)}):a.push({start:l-3,end:u+2,decoration:CE(s,t)})))}a.sort(kE("start",!0));for(let s of a)n.add(s.start,s.end,s.decoration);return n.finish()},xnt=(e,t)=>nR.StateField.define({create(r){return WMe(r,e,t)},update(r,n){return WMe(n.state,e,t)},provide:r=>Kv.EditorView.decorations.from(r)}),rR=class{constructor(t,r){this.superstate=t;this.plugin=r;this.name="MakeMD"}load(){this.plugin.settings=Object.assign({},tR,this.superstate.settings,this.superstate.settings.basicsSettings),this.plugin.settings.mobileSidepanel&&this.plugin.app.workspace.onLayoutReady(async()=>{qMe(this.plugin,this.superstate)}),this.plugin.commands=this.loadCommands()}loadCommands(){return[{label:"todo",value:"- [ ] ",icon:"mk-make-todo"},{label:"list",value:"- ",icon:"mk-make-list"},{label:"ordered-list",value:"1. ",icon:"mk-make-ordered"},{label:"h1",value:"# ",icon:"mk-make-h1"},{label:"h2",value:"## ",icon:"mk-make-h2"},{label:"h3",value:"### ",icon:"mk-make-h3"},{label:"quote",value:"> ",icon:"mk-make-quote"},{label:"divider",value:` --- `,icon:"mk-make-hr",section:"Basic"},{label:"codeblock",value:"\n ```\n Type/Paste Your Code\n ```",offset:[-4,5],icon:"mk-make-codeblock"},{label:"callout",value:`> [!NOTE] - > Content`,offset:[-7,12],icon:"mk-make-callout"},{label:"internal",value:"link",icon:"mk-make-note",onSelect:(t,r,n,i,a,o,s,l)=>{r.enactor.selectLink(t,u=>{i.replaceRange(`[[${u}]]`,{...a,ch:o},s),l()})}},{label:"link",value:"",offset:[-1,1],icon:"mk-make-link"},{label:"image",value:"image",icon:"mk-make-image",onSelect:(t,r,n,i,a,o,s,l)=>{r.enactor.selectImage(u=>{i.replaceRange(`![[${u}]]`,{...a,ch:o},s),l()},i.cm.dom.win)}},{label:"flow",value:"note",offset:[-2,4],icon:"mk-make-flow",onSelect:(t,r,n,i,a,o,s,l)=>{r.enactor.selectLink(t,u=>{i.replaceRange(`![![${u}]]`,{...a,ch:o},s),l()})}},{label:"context",value:"context",icon:"layout-list",onSelect:(t,r,n,i,a,o,s,l)=>{r.enactor.selectSpace(t,u=>{i.replaceRange(b9(r.enactor.superstate.spacesIndex.get(u),"files"),{...a,ch:o},s),i.setSelection({line:a.line,ch:0}),l()})}},{label:"table",value:"table",icon:"mk-make-table",onSelect:(t,r,n,i,a,o,s,l)=>{PD(r.enactor.superstate,n.parent.path,"table").then(u=>{i.replaceRange(dD(r.enactor.superstate.spacesIndex.get(n.parent.path),u),{...a,ch:o},s),i.setSelection({line:a.line,ch:0}),l()})}},{label:"board",value:"board",icon:"square-kanban",onSelect:(t,r,n,i,a,o,s,l)=>{PD(r.enactor.superstate,n.parent.path,"board").then(u=>{i.replaceRange(dD(r.enactor.superstate.spacesIndex.get(n.parent.path),u),{...a,ch:o},s),i.setSelection({line:a.line,ch:0}),l()})}},{label:"tag",value:"#tag",offset:[0,1],icon:"mk-make-tag"}]}loadExtensions(t){let r=eR(this.plugin,this.plugin.isTouchScreen());this.plugin.settings.editorFlow&&r.push(xnt(this.plugin,this.superstate)),this.plugin.extensions=r,t?this.plugin.plugin.registerEditorExtension(this.plugin.extensions):this.plugin.app.workspace.updateOptions()}async convertSpaceFragmentToMarkdown(t,r){if(t.type=="frame"){let n=await this.superstate.spaceManager.readFrame(t.path,t.id).then(i=>i?.schema);if(n){let i=Ao(n);this.superstate.spaceManager.readTable(t.path,i.def.db).then(a=>{if(!a)return;let o=UMe(a.rows,a.cols);r(o)})}}else this.superstate.spaceManager.readTable(t.path,t.id).then(n=>{if(!n)return;let i=UMe(n.rows,n.cols);r(i)})}selectLink(t,r){let n=t.target.getBoundingClientRect();return jl(n,Ne(t.view.document),this.superstate,r)}selectSpace(t,r){let n=t.target.getBoundingClientRect();return Fa(n,Ne(t.view.document),this.superstate,r)}selectImage(t,r){this.superstate.ui.openPalette(iR.default.createElement(_f,{superstate:this.superstate,selectedPath:n=>{t(n)}}),r)}isSpace(t){return this.superstate.spacesIndex.has(t)}spaceNotePath(t){return this.superstate.spacesIndex.get(t)?.space.notePath}spaceFolderPath(t){return(this.superstate.spacesIndex.get(t)?.space).folderPath}parentPath(t){return this.superstate.spaceManager.parentPathForPath(t)}createNote(t,r,n){return this.superstate.spaceManager.createItemAtPath(t,"md",r,n)}createRoot(t){return this.superstate.ui.createRoot(t)}notify(t){return this.superstate.ui.notify(t)}uriByString(t,r){return this.superstate.spaceManager.uriByString(t,r)}spaceFragmentSchema(t){return ZB(this.superstate,t)}saveSettings(){this.superstate.settings.basicsSettings=this.plugin.settings,this.plugin.plugin.saveSettings()}resolvePath(t,r){return this.superstate.spaceManager.resolvePath(t,r)}openMenu(t,r){let n=t.target.getBoundingClientRect();return this.superstate.ui.openMenu(n,{ui:this.superstate.ui,multi:!1,value:[],editable:!1,options:r,searchable:!1,showAll:!0},Ne(t.view.document))}openPath(t,r){let n=this.uriByString(t);vE(this.plugin.app,this.plugin.app.workspace.getLeaf(),r,null,async i=>{let a=i.attachLeaf();if(this.plugin.app.vault.getAbstractFileByPath(n.basePath)instanceof OE.TFile){await a.openFile(this.plugin.app.vault.getAbstractFileByPath(n.basePath));let o=yE(n.basePath,n.refStr,this.plugin.app);if(!a.view?.editor)return;o[0]&&o[1]&&a.view.editor?.cm.dispatch({annotations:[zf.of(o)]})}else await Cb(a,t,this.plugin.plugin,!0)})}addActiveStateListener(t){this.superstate.ui.eventsDispatch.addListener("activeStateChanged",t)}removeActiveStateListener(t){this.superstate.ui.eventsDispatch.removeListener("activeStateChanged",t)}};var oR=require("@codemirror/state"),VMe=require("@codemirror/view");var Jv=require("obsidian"),GMe=Ae(bX());var HMe=(e,t)=>{let r=new oR.RangeSetBuilder,n=e.field(Wc,!1),i=[];for(let o of n){let{from:s,to:l,type:u,expandedState:c}=o,f=s-3==e.doc.lineAt(s).from&&l+2==e.doc.lineAt(s).to;u==0?c==2&&i.push({start:l+2,end:l+2,decoration:CE(o,t)}):c==2&&u==1&&(e.selection.main.from==s-4&&e.selection.main.to==l+2||e.selection.main.from>=s-3&&e.selection.main.to<=l+1||(i.push({start:s-4,end:s-3,decoration:G7(o,t)}),f?i.push({start:s-3,end:l+2,decoration:Q7(o,t)}):i.push({start:s-3,end:l+2,decoration:CE(o,t)})))}i.sort(kE("start",!0));for(let o of i)r.add(o.start,o.end,o.decoration);return r.finish()},wnt=e=>oR.StateField.define({create(t){return HMe(t,e)},update(t,r){return HMe(r.state,e)},provide:t=>VMe.EditorView.decorations.from(t)}),VX=class extends Jv.FuzzySuggestModal{constructor(r,n){super(r);this.EMPTY_TEXT="Files not found";this.selectedLink=n,this.init()}init(){this.files=this.app.vault.getMarkdownFiles(),this.emptyStateText=this.EMPTY_TEXT,this.setInstructions([{command:"\u2191\u2193",purpose:"to navigate"},{command:"\u21B5",purpose:"to append link to the file"},{command:"esc",purpose:"to dismiss"}]),this.initNewNoteItem()}getItems(){return this.files}getItemText(r){return this.noSuggestion=!1,r.basename}onNoSuggestion(){this.noSuggestion=!0}onChooseItem(r,n){this.noSuggestion||this.selectedLink(r.path)}initNewNoteItem(){this.newNoteResult=document.createElement("div"),this.newNoteResult.addClasses(["suggestion-item","is-selected"]),this.suggestionEmpty=document.createElement("div"),this.suggestionEmpty.addClass("suggestion-empty"),this.suggestionEmpty.innerText=this.EMPTY_TEXT}itemInstructionMessage(r,n){let i=document.createElement("kbd");i.addClass("suggestion-hotkey"),i.innerText=n,r.appendChild(i)}},aR=class{constructor(t){this.plugin=t;this.name="Obsidian"}load(){this.plugin.settings=Object.assign({},tR,this.plugin.settings),this.plugin.commands=this.loadCommands()}loadCommands(){return[{label:"todo",value:"- [ ] ",icon:"mk-make-todo"},{label:"list",value:"- ",icon:"mk-make-list"},{label:"ordered-list",value:"1. ",icon:"mk-make-ordered"},{label:"h1",value:"# ",icon:"mk-make-h1"},{label:"h2",value:"## ",icon:"mk-make-h2"},{label:"h3",value:"### ",icon:"mk-make-h3"},{label:"quote",value:"> ",icon:"mk-make-quote"},{label:"divider",value:` + > Content`,offset:[-7,12],icon:"mk-make-callout"},{label:"internal",value:"link",icon:"mk-make-note",onSelect:(t,r,n,i,a,o,s,l)=>{r.enactor.selectLink(t,u=>{i.replaceRange(`[[${u}]]`,{...a,ch:o},s),l()})}},{label:"link",value:"",offset:[-1,1],icon:"mk-make-link"},{label:"image",value:"image",icon:"mk-make-image",onSelect:(t,r,n,i,a,o,s,l)=>{r.enactor.selectImage(u=>{i.replaceRange(`![[${u}]]`,{...a,ch:o},s),l()},i.cm.dom.win)}},{label:"flow",value:"note",offset:[-2,4],icon:"mk-make-flow",onSelect:(t,r,n,i,a,o,s,l)=>{r.enactor.selectLink(t,u=>{i.replaceRange(`![![${u}]]`,{...a,ch:o},s),l()})}},{label:"context",value:"context",icon:"layout-list",onSelect:(t,r,n,i,a,o,s,l)=>{r.enactor.selectSpace(t,u=>{i.replaceRange(b9(r.enactor.superstate.spacesIndex.get(u),"files"),{...a,ch:o},s),i.setSelection({line:a.line,ch:0}),l()})}},{label:"table",value:"table",icon:"mk-make-table",onSelect:(t,r,n,i,a,o,s,l)=>{PD(r.enactor.superstate,n.parent.path,"table").then(u=>{i.replaceRange(dD(r.enactor.superstate.spacesIndex.get(n.parent.path),u),{...a,ch:o},s),i.setSelection({line:a.line,ch:0}),l()})}},{label:"board",value:"board",icon:"square-kanban",onSelect:(t,r,n,i,a,o,s,l)=>{PD(r.enactor.superstate,n.parent.path,"board").then(u=>{i.replaceRange(dD(r.enactor.superstate.spacesIndex.get(n.parent.path),u),{...a,ch:o},s),i.setSelection({line:a.line,ch:0}),l()})}},{label:"tag",value:"#tag",offset:[0,1],icon:"mk-make-tag"}]}loadExtensions(t){let r=eR(this.plugin,this.plugin.isTouchScreen());this.plugin.settings.editorFlow&&r.push(xnt(this.plugin,this.superstate)),this.plugin.extensions=r,t?this.plugin.plugin.registerEditorExtension(this.plugin.extensions):this.plugin.app.workspace.updateOptions()}async convertSpaceFragmentToMarkdown(t,r){if(t.type=="frame"){let n=await this.superstate.spaceManager.readFrame(t.path,t.id).then(i=>i?.schema);if(n){let i=Ao(n);this.superstate.spaceManager.readTable(t.path,i.def.db).then(a=>{if(!a)return;let o=UMe(a.rows,a.cols);r(o)})}}else this.superstate.spaceManager.readTable(t.path,t.id).then(n=>{if(!n)return;let i=UMe(n.rows,n.cols);r(i)})}selectLink(t,r){let n=t.target.getBoundingClientRect();return jl(n,Ne(t.view.document),this.superstate,r)}selectSpace(t,r){let n=t.target.getBoundingClientRect();return Fa(n,Ne(t.view.document),this.superstate,r)}selectImage(t,r){this.superstate.ui.openPalette(iR.default.createElement(_f,{superstate:this.superstate,selectedPath:n=>{t(n)}}),r)}isSpace(t){return this.superstate.spacesIndex.has(t)}spaceNotePath(t){return this.superstate.spacesIndex.get(t)?.space.notePath}spaceFolderPath(t){return(this.superstate.spacesIndex.get(t)?.space).folderPath}parentPath(t){return this.superstate.spaceManager.parentPathForPath(t)}createNote(t,r,n){return this.superstate.spaceManager.createItemAtPath(t,"md",r,n)}createRoot(t){return this.superstate.ui.createRoot(t)}notify(t){return this.superstate.ui.notify(t)}uriByString(t,r){return this.superstate.spaceManager.uriByString(t,r)}spaceFragmentSchema(t){return ZB(this.superstate,t)}saveSettings(){this.superstate.settings.basicsSettings=this.plugin.settings,this.plugin.plugin.saveSettings()}resolvePath(t,r){return this.superstate.spaceManager.resolvePath(t,r)}openMenu(t,r){let n=t.target.getBoundingClientRect();return this.superstate.ui.openMenu(n,{ui:this.superstate.ui,multi:!1,value:[],editable:!1,options:r,searchable:!1,showAll:!0},Ne(t.view.document))}pathExists(t){return this.superstate.spaceManager.pathExists(t)}openPath(t,r){let n=this.uriByString(t);vE(this.plugin.app,this.plugin.app.workspace.getLeaf(),r,null,async i=>{let a=i.attachLeaf();if(this.plugin.app.vault.getAbstractFileByPath(n.basePath)instanceof OE.TFile){await a.openFile(this.plugin.app.vault.getAbstractFileByPath(n.basePath));let o=yE(n.basePath,n.refStr,this.plugin.app);if(!a.view?.editor)return;o[0]&&o[1]&&a.view.editor?.cm.dispatch({annotations:[zf.of(o)]})}else await Cb(a,t,this.plugin.plugin,!0)})}addActiveStateListener(t){this.superstate.ui.eventsDispatch.addListener("activeStateChanged",t)}removeActiveStateListener(t){this.superstate.ui.eventsDispatch.removeListener("activeStateChanged",t)}};var oR=require("@codemirror/state"),VMe=require("@codemirror/view");var Jv=require("obsidian"),GMe=Ae(bX());var HMe=(e,t)=>{let r=new oR.RangeSetBuilder,n=e.field(Wc,!1),i=[];for(let o of n){let{from:s,to:l,type:u,expandedState:c}=o,f=s-3==e.doc.lineAt(s).from&&l+2==e.doc.lineAt(s).to;u==0?c==2&&i.push({start:l+2,end:l+2,decoration:CE(o,t)}):c==2&&u==1&&(e.selection.main.from==s-4&&e.selection.main.to==l+2||e.selection.main.from>=s-3&&e.selection.main.to<=l+1||(i.push({start:s-4,end:s-3,decoration:G7(o,t)}),f?i.push({start:s-3,end:l+2,decoration:Q7(o,t)}):i.push({start:s-3,end:l+2,decoration:CE(o,t)})))}i.sort(kE("start",!0));for(let o of i)r.add(o.start,o.end,o.decoration);return r.finish()},wnt=e=>oR.StateField.define({create(t){return HMe(t,e)},update(t,r){return HMe(r.state,e)},provide:t=>VMe.EditorView.decorations.from(t)}),VX=class extends Jv.FuzzySuggestModal{constructor(r,n){super(r);this.EMPTY_TEXT="Files not found";this.selectedLink=n,this.init()}init(){this.files=this.app.vault.getMarkdownFiles(),this.emptyStateText=this.EMPTY_TEXT,this.setInstructions([{command:"\u2191\u2193",purpose:"to navigate"},{command:"\u21B5",purpose:"to append link to the file"},{command:"esc",purpose:"to dismiss"}]),this.initNewNoteItem()}getItems(){return this.files}getItemText(r){return this.noSuggestion=!1,r.basename}onNoSuggestion(){this.noSuggestion=!0}onChooseItem(r,n){this.noSuggestion||this.selectedLink(r.path)}initNewNoteItem(){this.newNoteResult=document.createElement("div"),this.newNoteResult.addClasses(["suggestion-item","is-selected"]),this.suggestionEmpty=document.createElement("div"),this.suggestionEmpty.addClass("suggestion-empty"),this.suggestionEmpty.innerText=this.EMPTY_TEXT}itemInstructionMessage(r,n){let i=document.createElement("kbd");i.addClass("suggestion-hotkey"),i.innerText=n,r.appendChild(i)}},aR=class{constructor(t){this.plugin=t;this.name="Obsidian"}load(){this.plugin.settings=Object.assign({},tR,this.plugin.settings),this.plugin.commands=this.loadCommands()}loadCommands(){return[{label:"todo",value:"- [ ] ",icon:"mk-make-todo"},{label:"list",value:"- ",icon:"mk-make-list"},{label:"ordered-list",value:"1. ",icon:"mk-make-ordered"},{label:"h1",value:"# ",icon:"mk-make-h1"},{label:"h2",value:"## ",icon:"mk-make-h2"},{label:"h3",value:"### ",icon:"mk-make-h3"},{label:"quote",value:"> ",icon:"mk-make-quote"},{label:"divider",value:` --- `,icon:"mk-make-hr",section:"Basic"},{label:"codeblock",value:"\n ```\n Type/Paste Your Code\n ```",offset:[-4,5],icon:"mk-make-codeblock"},{label:"callout",value:`> [!NOTE] > Content`,offset:[-7,12],icon:"mk-make-callout"},{label:"internal",value:"link",icon:"mk-make-note",onSelect:(t,r,n,i,a,o,s,l)=>{r.enactor.selectLink(t,u=>{i.replaceRange(`[[${u}]]`,{...a,ch:o},s),l()})}},{label:"link",value:"",offset:[-1,1],icon:"mk-make-link"},{label:"image",value:"image",icon:"mk-make-image",onSelect:(t,r,n,i,a,o,s,l)=>{r.enactor.selectImage(u=>{i.replaceRange(`![[${u}]]`,{...a,ch:o},s),l()},i.cm.dom.win)}},{label:"flow",value:"note",offset:[-2,4],icon:"mk-make-flow",onSelect:(t,r,n,i,a,o,s,l)=>{r.enactor.selectLink(t,u=>{i.replaceRange(`![![${u}]]`,{...a,ch:o},s),l()})}},{label:"table",value:`| | | | --- | --- | | | | -`,icon:"mk-make-table"},{label:"tag",value:"#tag",offset:[0,1],icon:"mk-make-tag"}]}async convertSpaceFragmentToMarkdown(t,r){r("")}selectLink(t,r){new VX(this.plugin.app,r).open()}selectSpace(t,r){return this.notify("Not implemented")}selectImage(t,r){return this.notify("Not implemented")}isSpace(t){return!1}spaceNotePath(t){return null}spaceFolderPath(t){return t}parentPath(t){return this.plugin.app.vault.getAbstractFileByPath(t)?.parent?.path}loadExtensions(t){let r=eR(this.plugin,this.plugin.isTouchScreen());this.plugin.settings.editorFlow&&r.push(wnt(this.plugin)),this.plugin.extensions=r,t?this.plugin.plugin.registerEditorExtension(this.plugin.extensions):this.plugin.app.workspace.updateOptions()}createNote(t,r,n){return this.plugin.app.fileManager.createNewMarkdownFile(this.plugin.app.vault.getAbstractFileByPath(t),r).then(i=>i.path)}createRoot(t){return(0,GMe.createRoot)(t)}notify(t){new Jv.Notice(t)}uriByString(t,r){return cc(t)}spaceFragmentSchema(t){return Promise.resolve(null)}saveSettings(){this.plugin.plugin.saveData(this.plugin.settings)}resolvePath(t,r){return this.plugin.app.metadataCache.getFirstLinkpathDest(t,r)?.path}openMenu(t,r){let n=new Jv.Menu;for(let i of r)n.addItem(a=>{a.setTitle(i.name),a.onClick(o=>i.onClick(o))});n.showAtMouseEvent(t)}openPath(t,r){let n=this.uriByString(t);vE(this.plugin.app,this.plugin.app.workspace.getLeaf(),r,null,async i=>{let a=i.attachLeaf();if(this.plugin.app.vault.getAbstractFileByPath(n.basePath)instanceof Jv.TFile){await a.openFile(this.plugin.app.vault.getAbstractFileByPath(n.basePath));let o=yE(n.basePath,n.refStr,this.plugin.app);if(!a.view?.editor)return;o[0]&&o[1]&&a.view.editor?.cm.dispatch({annotations:[zf.of(o)]})}else await Cb(a,t,this.plugin.plugin,!0)})}addActiveStateListener(t){}removeActiveStateListener(t){}};var QMe=e=>{e.plugin.addCommand({id:"mk-open-flow",name:H.commandPalette.openFlow,callback:()=>e.openFlow()}),e.plugin.addCommand({id:"mk-close-flow",name:H.commandPalette.closeFlow,callback:()=>e.closeFlow()})};var GX=Ae(Te()),Snt=(e,t)=>{let r=e;for(;!r.hasClass("cm-editor")&&r.parentElement;)r=r.parentElement;if(!r.hasClass("cm-editor"))return;let n;return t.workspace.iterateLeaves(i=>{let a=i.view.editor?.cm;if(a&&r==a.dom)return n=a,!0},t.workspace.rootSplit),n},YMe=(e,t,r)=>{t.querySelectorAll("p").forEach(n=>{for(let i of n.textContent.matchAll(/(?:!\[!\[|!!\[\[)([^\]]+)\]\]/g)){let a=i[1];n.style.display="none",e.enactor.createRoot(n.parentElement).render(GX.default.createElement(cO,{load:!0,plugin:e,path:a,source:r.sourcePath}))}})},Ent=(e,t)=>{let r=e;setTimeout(async()=>{let n=0;for(;!e.parentElement&&n++<=50;)await sleep(50);if(!!e.parentElement){for(;!r.hasClass("markdown-embed")&&r.parentElement;)r=r.parentElement;r&&t(r)}})};var ZMe=(e,t,r,n)=>{Ent(e,async i=>{let a=i.querySelectorAll(".markdown-embed-link");for(let o=0;o{let t=!1,r=Ob(e1.Workspace.prototype,{changeLayout(n){return async function(i){t=!0;try{await n.call(this,i)}finally{t=!1}}},getLeaf(n){return function(i){let a=n.call(this,i);if(a.isFlowBlock){let o=a.id,s=!1;e.app.workspace.iterateLeaves(l=>{l.flowEditors&&!s&&l.flowEditors.forEach(u=>{u.leaves().forEach(c=>{if(c.id==o){s=!0,a=l;return}})})},e.app.workspace.rootSplit)}return a}},setActiveLeaf(n){return function(a,o){return a.view.getViewType()=="markdown"&&(this.activeEditor=a.view,a.view.file),n.call(this,a,o)}},getDropLocation(n){return function(a){for(let o of Wh.activePopovers(e.app)){let s=this.recursiveGetTarget(a,o.rootSplit);if(s)return s}return n.call(this,a)}},onDragLeaf(n){return function(i,a){let o=Wh.forLeaf(a);return n.call(this,i,a)}}});e.plugin.register(r)},KMe=e=>{e.plugin.register(Ob(e1.WorkspaceLeaf.prototype,{getRoot(t){return function(){let r=t.call(this);return r.getRoot===this.getRoot?r:r.getRoot()}},setViewState(t){return async function(r,n){let i=await t.call(this,r,n);try{if(this.flowEditors)for(let a of this.flowEditors)a.hide();this.flowEditors=[]}catch{}return i}},setEphemeralState(t){return function(r){t.call(this,r),r.focus&&this.view?.getViewType()==="empty"&&(this.view.contentEl.tabIndex=-1,this.view.contentEl.focus())}}})),e.plugin.register(Ob(e1.WorkspaceItem.prototype,{getContainer(t){return function(){if(!!t)return!this.parentSplit||this instanceof e1.WorkspaceContainer?t.call(this):this.parentSplit.getContainer()}}}))};var AO=class{constructor(t){this.plugin=t;if(this.settings=t.superstate.settings.basicsSettings,this.app=t.app,t.app.plugins.getPlugin("make-md")){let r=new rR(t.app.plugins.getPlugin("make-md").superstate,this);this.enactor=r}else this.enactor=new aR(this)}isTouchScreen(){return JMe.Platform.isMobile}toggleBold(){let t=Sg(this);t&&t.dispatch({annotations:$b.of("strong")})}toggleEm(){let t=Sg(this);t&&t.dispatch({annotations:$b.of("em")})}openFlow(){let t=Sg(this);if(t){let r=t.state.field(Wc,!1),n=t.state.selection.main;for(let i of r)i.fromn.from&&t.dispatch({annotations:Uf.of([i.id,2])})}}closeFlow(){let t=Sg(this);if(t){let r=t.state.field(Wc,!1),n=t.state.selection.main;for(let i of r)i.fromn.from&&t.dispatch({annotations:Uf.of([i.id,0])})}}loadBasics(){this.enactor.load(),document.body.classList.toggle("mk-mobile-sidepanel",this.settings.mobileSidepanel),document.body.classList.toggle("mk-mobile-styler",this.settings.mobileMakeBar),NMe(this),this.settings.editorFlow&&(XMe(this),KMe(this),document.body.classList.toggle("mk-flow-replace",this.settings.editorFlow),document.body.classList.toggle("mk-flow-"+this.settings.editorFlowStyle,!0),this.plugin.registerMarkdownPostProcessor((t,r)=>{(i=>{let a=i.querySelectorAll(".internal-embed.markdown-embed");for(let o=0;ofetch(t).then(i=>(this.loading[t]=!1,i.status!==200?n(i.statusText):i.json())).then(i=>{let a=i;return this.loadedKit(t,t,a).then(o=>i)}).then(i=>r(i))))}};var lR=class{constructor(){this.schemes=["http","https"];this.onNoteCreate=async(t,r)=>{this.spaceManager.onPathCreated(t)};this.onCreate=async(t,r)=>{let n=this.spaceInfoForPath(t);await this.spaceManager.onSpaceCreated(t),await this.spaceManager.superstate.reloadContext(n)};this.webCache=new sR(this)}initiateAdapter(t){this.spaceManager=t}async readTemplates(t){return[]}async saveTemplate(t,r){return null}deleteTemplate(t,r){}async readFocuses(){return[]}async saveFocuses(t){}async readTemplate(t){}async readAllKits(){return[]}async readAllTemplates(){return{}}async readKitFrames(t){return{}}async saveFrameKit(t,r){}async saveSpaceTemplate(t,r){}allPaths(t){return[]}async pathExists(t){return!!t.startsWith("https://www.make.md")}async createItemAtPath(t,r,n,i){return null}async renamePath(t,r){return null}async deletePath(t){}async getPathInfo(t){return{}}keysForCacheType(t){return null}async readPathCache(t){if(this.webCache.notes.has(t))return{metadata:{properties:{}},type:"remote",ctime:0,subtype:"note",contentTypes:[],tags:[],readOnly:!0,label:{name:this.webCache.notes.get(t).name,sticker:this.webCache.notes.get(t).properties.sticker,color:null},parent:[...this.webCache.parentMap.get(t)][0]};let r=await this.webCache.load(t);return{metadata:{properties:r.properties},ctime:0,type:"space",subtype:"web",contentTypes:[],tags:[],readOnly:!0,label:{name:r.name,sticker:r.properties.sticker,color:r.properties.color},parent:[...this.webCache.parentMap.get(t)][0]}}async readPath(t){return this.webCache.notes.get(t).content}async copyPath(t,r,n){}async writeToPath(t,r,n){}async childrenForPath(t,r){return[...this.webCache.parentMap.getInverse(t)]}parentPathForPath(t){return[...this.webCache.parentMap.get(t)][0]}async readFrame(t,r){return(await this.webCache.load(t)).frames[r]}async readAllFrames(t){return(await this.webCache.load(t)).frames}async readTable(t,r){return(await this.webCache.load(t)).context[r]}async spaceInitiated(t){return!!this.webCache.cache.has(t)}async contextInitiated(t){return!!this.webCache.cache.has(t)}async tablesForSpace(t){let r=await this.webCache.load(t);return Object.values(r.context).map(n=>n.schema)}async createTable(t,r){}async saveTableSchema(t,r,n){return!1}async saveTable(t,r,n){return!1}async deleteTable(t,r){}async readAllTables(t){return(await this.webCache.load(t)).context}async framesForSpace(t){let r=await this.webCache.load(t);return Object.values(r.frames).map(n=>n.schema)}async createFrame(t,r){}async deleteFrame(t,r){}async saveFrameSchema(t,r,n){return!1}async saveFrame(t,r){return!1}async commandsForSpace(t){return[]}async runCommand(t,r,n){return null}async createCommand(t,r){}async readSystemCommands(){return[]}async readLibraryCommands(t){return[]}async saveSystemCommand(t,r){}async deleteCommand(t,r){}async saveCommand(t,r,n){return!1}async contextForSpace(t){return null}async addSpaceProperty(t,r){}async deleteSpaceProperty(t,r){}async saveSpaceProperty(t,r,n){return!1}async addProperty(t,r){}async readLabel(t){return null}async saveLabel(t,r,n){}async renameProperty(t,r,n){}async readProperties(t){return(await this.webCache.load(t)).context[Er].cols}async deleteProperty(t,r){}async saveProperties(t,r){return!1}allSpaces(){return[]}readTags(){return[]}spaceInfoForPath(t){return{name:t.split("/").pop(),path:t,isRemote:!0,readOnly:!0,defPath:t+"/.def",notePath:t}}allCaches(){return new Map}async spaceDefForSpace(t){return(await this.webCache.load(t)).definition}async createSpace(t,r,n){}async saveSpace(t,r,n){}async renameSpace(t,r){return null}deleteSpace(t){}childrenForSpace(t){return[...this.webCache.parentMap.getInverse(t)]}addTag(t,r){}renameTag(t,r,n){}deleteTag(t,r){}pathsForTag(t){return[]}resolvePath(t,r){return t}};var eje=e=>JSON.stringify(e),ME=e=>`${e.type}:${e.path}`;var t1=Ae(yi());var tje={def:{id:"eventItem",type:"listItem"},node:{type:"group",id:"$root",schemaId:"$root",name:H.frames.event.label,rank:0},id:"$root",children:[ct(Mo,{value:"$contexts.$context['_keyValue']"},{padding:"'0'","--font-text-weight":"'bold'"})]},rje={def:{id:"dateGroup",type:"listGroup"},node:{type:"group",props:{_groupValue:""},styles:{layout:"'column'",background:"'var(--mk-ui-background-variant)'",padding:"'6px'",height:"'150px'",overflow:"'hidden'",width:"'100%'"},id:"$root",schemaId:"$root",name:"Date",rank:0},id:"$root",children:[ct(mn,{value:"$api.date.component($api.date.parse($root.props['_groupValue']), 'day')"},{padding:"'4px'","--font-text-weight":"'bold'"}),ct(mc,{},{gap:"'2px'",layout:"'column'"})]},nje={def:{id:"calendarView",type:"listView"},node:{type:"group",props:{year:"$api.date.component($api.date.offset($api.date.now(), $root.props.offset, 'month'), 'year')",month:"$api.date.component($api.date.offset($api.date.now(), $root.props.offset, 'month'), 'month')",offset:"0",startOfMonth:"$root.props.year+'-'+$root.props.month+'-01'",endOfMonth:"$root.props.year+'-'+$root.props.month+'-'+$api.date.daysInMonth($api.date.parse($root.props.startOfMonth))",dayOfWeek:"$api.date.component($api.date.parse($root.props.startOfMonth), 'dayOfWeek')",groupFilter:"'isSameDate'",groupOptions:"$api.date.range($api.date.parse($root.props.startOfMonth), $api.date.parse($root.props.endOfMonth))"},id:"$root",schemaId:"$root",name:H.frames.calendar.label,rank:0},id:"$root",children:[ct({...hn,children:[ct({...hn,children:[ct(mn,{value:"$api.date.format($api.date.parse($root.props.startOfMonth), 'MMMM')"},{padding:"'8px'","--font-text-weight":"'bold'",class:"'mk-t-h1'"}),ct({...hn,children:[ls(jv,{icon:"'ui//chevron-left'"},{},{onClick:"$saveState({$root: {props: {offset: $root.props.offset - 1}}})"}),ls(jv,{label:"'Today'"},{},{onClick:"$saveState({$root: {props: {offset: 0}}})"}),ls(jv,{icon:"'ui//chevron-right'"},{},{onClick:"$saveState({$root: {props: {offset: $root.props.offset + 1}}})"})]},{},{layout:"'row'"})]},{},{width:"'100%'"})]},{}),ct({...hn,children:[ct(mn,{value:"'Sunday'"},{padding:"'8px'","--font-text-weight":"'bold'"}),ct(mn,{value:"'Monday'"},{padding:"'8px'","--font-text-weight":"'bold'"}),ct(mn,{value:"'Tuesday'"},{padding:"'8px'","--font-text-weight":"'bold'"}),ct(mn,{value:"'Wednesday'"},{padding:"'8px'","--font-text-weight":"'bold'"}),ct(mn,{value:"'Thursday'"},{padding:"'8px'","--font-text-weight":"'bold'"}),ct(mn,{value:"'Friday'"},{padding:"'8px'","--font-text-weight":"'bold'"}),ct(mn,{value:"'Saturday'"},{padding:"'8px'","--font-text-weight":"'bold'"})]},{},{width:"'100%'",height:"'auto'",layout:"'grid'","--mk-grid-columns":"'7'","--mk-grid-width":"'0'"}),ct({...mc,children:[ct(hn,{},{gridColumn:"'span '+$root.props.dayOfWeek"})]},{},{padding:"'8px'",layout:"'grid'","--mk-grid-columns":"'7'","--mk-grid-width":"'0'",gap:"'1px'"})]};var gO={id:"fieldsView",def:{id:"fieldsView"},node:{schemaId:"fieldsView",parentId:"",name:"Properties",rank:0,id:"fieldsView",type:"group"},children:[ct({...E9,children:[ct({...k9,children:[ls(xh,{sticker:"$api.properties.sticker(listItem.props.value)",type:"listItem.props.value.type",value:"$contexts[listItem.props.value.table?.length > 0 ? listItem.props.value.table : $contexts.$context._path]?.[listItem.props.value.name]",property:"listItem.props.value"})]},{},{layout:"'row'",gap:"'8px'",hidden:"!($contexts[listItem.props.value.table?.length > 0 ? listItem.props.value.table : $contexts.$context._path]?.[listItem.props.value.name]?.length > 0)"})]},{value:"$contexts.$context._properties?.filter(f => f.primary != 'true') ?? []"},{layout:"'column'",gap:"'4px'"})]},ije={def:{id:"coverListItem",type:"listItem"},node:{type:"group",id:"$root",schemaId:"$root",name:"Cover Item",rank:0,props:{coverProperty:"'File'"},types:{coverProperty:"option"},propsValue:{coverProperty:{alias:"Cover Image",source:"$properties"}},styles:{layout:'"column"'}},id:"$root",children:[ct(uf,{value:"$api.path.label($contexts[$contexts.$context['_path']]?.[$root.props.coverProperty])?.thumbnail"},{background:"'var(--mk-ui-background-contrast)'",borderRadius:"'8px'",width:"'200px'",height:"'300px'"}),ct(Mo,{value:"$contexts.$context['_keyValue']"},{padding:"'4px'"})]},aje={def:{id:"imageListItem",type:"listItem"},node:{type:"group",id:"$root",schemaId:"$root",name:"Image Item",rank:0,props:{_selected:"$root.props['_selectedIndex'] == $contexts.$context['_index']"},styles:{layout:'"row"',padding:"'4px'"},actions:{onClick:"$saveState({ $root: {props: {_selectedIndex: $contexts.$context['_index']}} });",onDoubleClick:"$api.table.open($contexts.$context['_path'], $contexts.$context['_schema'], $contexts.$context['_index'], false)",onContextMenu:"$api.table.contextMenu($event, $contexts.$context['_path'], $contexts.$context['_schema'], $contexts.$context['_index'])"}},id:"$root",children:[ct(uf,{value:"$api.path.label($contexts.$context['_keyValue'])?.thumbnail"},{borderRadius:"'8px'"})]},oje={def:{id:"flowListItem",type:"listItem"},node:{type:"group",id:"$root",schemaId:"$root",name:"Flow Item",rank:0,props:{_selected:"$root.props['_selectedIndex'] == $contexts.$context['_index']",expanded:"true",seamless:"false"},types:{expanded:"boolean",seamless:"boolean"},propsValue:{expanded:{alias:"Expanded"},seamless:{alias:"Seamless"}},styles:{layout:'"row"',gap:"'8px'"},actions:{}},id:"$root",children:[ct(Mo,{value:"$contexts.$context['_keyValue']"},{"--mk-expanded":"$root.props.expanded","--mk-min-mode":"$root.props.seamless",padding:"'4px'",marginBottom:"'8px'"})]},sje={def:{id:"cardsListItem",type:"listItem"},node:{type:"group",id:"$root",schemaId:"$root",name:"Cards Item",rank:0,props:{_selected:"$root.props['_selectedIndex'] == $contexts.$context['_index']",coverProperty:"'File'"},types:{coverProperty:"option"},propsValue:{coverProperty:{alias:"Cover Image",source:"$properties"}},styles:{layout:'"column"',overflow:"'hidden'",borderRadius:"'8px'",width:"'100%'",height:"'100%'",border:"'1px solid var(--mk-ui-border)'",boxShadow:"'var(--mk-shadow-card)'"},actions:{onClick:"$saveState({ $root: {props: {_selectedIndex: $contexts.$context['_index']}} });",onDoubleClick:"$api.table.open($contexts.$context['_path'], $contexts.$context['_schema'], $contexts.$context['_index'], false)",onContextMenu:"$api.table.contextMenu($event, $contexts.$context['_path'], $contexts.$context['_schema'], $contexts.$context['_index'])"}},id:"$root",children:[ct({...Mv,children:[ct({...Rc,children:[ct({...Ui,node:{...Ui.node,ref:"$root"}},{},{background:"'var(--mk-ui-background-selected)'"})]},{value:"true"}),ct({...Rc,children:[ct({...Ui,node:{...Ui.node,ref:"$root"}},{},{background:"'var(--mk-ui-background)'"})]},{value:"false"})]},{value:"'_selected'"}),ct({...hn,children:[ct(uf,{value:"$api.path.label($contexts[$contexts.$context['_path']]?.[$root.props.coverProperty])?.thumbnail"},{width:"'100%'",height:"'80px'"})]},{},{width:"'100%'",height:"'80px'",background:"'var(--mk-ui-background-contrast)'"}),ct({...hn,children:[ct(Xa,{value:"$api.path.label($contexts.$context['_keyValue'])?.sticker"},{width:"'32px'",height:"'32px'",padding:"'4px'","--icon-size":"'24px'",borderRadius:"'4px'",overflow:"'hidden'",background:"$api.path.label($contexts.$context['_keyValue'])?.color"})]},{},{width:"'32px'",height:"'32px'",marginTop:"'-16px'",marginLeft:"'4px'",borderRadius:"'4px'",background:"'var(--mk-ui-background-contrast)'"}),{...hn,node:{...hn.node,styles:{gap:"'8px'",padding:"'8px'",flex:"'1'"}},children:[ct(mn,{value:"$contexts.$context['_name']"},{"--font-text-weight":"'var(--bold-weight)'"}),ls(gO,{},{marginTop:"'8px'"})]}]},lje={def:{id:"cardListItem",type:"listItem"},node:{type:"group",id:"$root",schemaId:"$root",name:"Card Item",rank:0,props:{_selected:"$root.props['_selectedIndex'] == $contexts.$context['_index']"},styles:{layout:'"column"',overflow:"'hidden'",borderRadius:"'8px'",width:"'100%'",border:"'1px solid var(--mk-ui-border)'"},actions:{onClick:"$saveState({ $root: {props: {_selectedIndex: $contexts.$context['_index']}} });",onDoubleClick:"$api.path.open($contexts.$context['_keyValue'], false)",onContextMenu:"$api.table.contextMenu($event, $contexts.$context['_path'], $contexts.$context['_schema'], $contexts.$context['_index'])"}},id:"$root",children:[ct({...Mv,children:[ct({...Rc,children:[ct({...Ui,node:{...Ui.node,ref:"$root"}},{},{background:"'var(--mk-ui-background-selected)'"})]},{value:"true"}),ct({...Rc,children:[ct({...Ui,node:{...Ui.node,ref:"$root"}},{},{background:"'var(--mk-ui-background)'"})]},{value:"false"})]},{value:"'_selected'"}),ct(uf,{value:"$api.path.label($contexts.$context['_keyValue'])?.thumbnail"},{width:"'100%'",maxHeight:"'80px'"}),{...hn,node:{...hn.node,styles:{gap:"'8px'",padding:"'8px'",flex:"'1'"}},children:[ct(mn,{value:"$contexts.$context['_name']"},{"--font-text-weight":"'var(--bold-weight)'"}),ls(gO,{})]}]},uje={def:{id:"rowItem",type:"listItem"},node:{type:"group",id:"$root",schemaId:"$root",name:"List View",rank:0,props:{_selected:"$root.props['_selectedIndex'] == $contexts.$context['_index']",previewField:"'Created'"},styles:{layout:'"row"',gap:"'12px'",padding:"'4px'",overflow:"'hidden'",width:"'100%'",layoutAlign:"'n'"},actions:{onClick:"$saveState({ $root: {props: {_selectedIndex: $contexts.$context['_index']}} });",onDoubleClick:"$api.table.open($contexts.$context['_path'], $contexts.$context['_schema'], $contexts.$context['_index'], false)",onContextMenu:"$api.table.contextMenu($event, $contexts.$context['_path'], $contexts.$context['_schema'], $contexts.$context['_index'])"},types:{previewField:"option"},propsValue:{previewField:{alias:"Preview",source:"$properties"}}},id:"$root",children:[ct({...Mv,children:[ct({...Rc,children:[ct({...Ui,node:{...Ui.node,ref:"$root"}},{},{background:"'var(--mk-ui-background-selected)'"})]},{value:"true"}),ct({...Rc,children:[ct({...Ui,node:{...Ui.node,ref:"$root"}},{},{background:"'transparent'"})]},{value:"false"})]},{value:"'_selected'"}),ls(mD,{path:"$contexts.$context['_keyValue']",width:"'32px'",height:"'32px'",padding:"'8px'",radius:"'4px'"},{borderRadius:"'4px'",background:"'var(--background-secondary)'"}),{...hn,node:{...hn.node,styles:{gap:"'8px'",flex:"'1'",padding:"'2px'",layout:"'column'",layoutAlign:"'w'",height:"'auto'"}},children:[{...hn,node:{...hn.node,styles:{gap:"'8px'",flex:"'1'",padding:"'2px'",layout:"'row'",layoutAlign:"'w'",height:"'auto'",width:"'100%'"}},children:[ct(mn,{value:"$contexts.$context['_name']"},{"--font-text-size":"'14px'","--font-text-weight":"'var(--bold-weight)'",width:"'auto'"}),ct(hn,{},{flex:"'1'",height:"'auto'"}),ls(xh,{type:"$contexts.$context._properties?.find(f => f.name == $root.props['previewField'])?.type",value:"$contexts[$contexts.$context['_path']]?.[$root.props.previewField]"},{"--font-text-color":"'var(--mk-ui-text-tertiary)'"})]}]}]},cje={def:{id:"overviewItem",type:"listItem"},node:{type:"group",id:"$root",schemaId:"$root",name:"Overview Item",rank:0,props:{_selected:"$root.props['_selectedIndex'] == $contexts.$context['_index']"},styles:{layout:'"row"',gap:"'12px'",padding:"'8px'",overflow:"'hidden'",width:"'100%'",borderBottom:"'thin solid var(--mk-ui-border)'"},actions:{onClick:"$saveState({ $root: {props: {_selectedIndex: $contexts.$context['_index']}} }); $api.table.open($contexts.$context['_path'], $contexts.$context['_schema'], $contexts.$context['_index'], false)",onContextMenu:"$api.table.contextMenu($event, $contexts.$context['_path'], $contexts.$context['_schema'], $contexts.$context['_index'])"}},id:"$root",children:[ct({...Mv,children:[ct({...Rc,children:[ct({...Ui,node:{...Ui.node,ref:"$root"}},{},{background:"'var(--mk-ui-background-selected)'"})]},{value:"true"}),ct({...Rc,children:[ct({...Ui,node:{...Ui.node,ref:"$root"}},{},{background:"'transparent'"})]},{value:"false"})]},{value:"'_selected'"}),{...hn,node:{...hn.node,styles:{gap:"'8px'",flex:"'1'",padding:"'2px'",layout:"'column'",overflow:"'hidden'"}},children:[ct({...hn,children:[ct(Xa,{value:"$api.path.label($contexts.$context['_keyValue'])?.sticker"},{width:"'20px'",height:"'20px'",padding:"'2px'","--icon-size":"'14px'",borderRadius:"'4px'",overflow:"'hidden'",background:"$api.path.label($contexts.$context['_keyValue'])?.color"}),ct(mn,{value:"$contexts.$context['_name']"},{"--font-text-size":"'14px'","--font-text-weight":"'var(--bold-weight)'"})]},{},{layout:'"row"',height:"'auto'",width:"'auto'",gap:"'4px'"}),ct(mn,{value:"$api.path.label($contexts.$context['_keyValue'])?.preview"},{"--font-text-size":"'14px'","--font-text-color":"'var(--mk-ui-text-tertiary)'","--line-count":"2"})]},ct(uf,{value:"$api.path.label($contexts.$context['_keyValue'])?.thumbnail"},{radius:"'4px'",width:"'64px'",height:"'64px'",borderRadius:"'8px'",hidden:"($api.path.label($contexts.$context['_keyValue'])?.thumbnail ?? '').length == 0"})]},fje={def:{id:"detailItem",type:"listItem"},node:{type:"group",id:"$root",schemaId:"$root",name:"Detail View",rank:0,props:{_selected:"$root.props['_selectedIndex'] == $contexts.$context['_index']"},styles:{layout:'"row"',gap:"'12px'",padding:"'8px'",overflow:"'hidden'",width:"'100%'"},actions:{onClick:"$saveState({ $root: {props: {_selectedIndex: $contexts.$context['_index']}} });",onDoubleClick:"$api.table.open($contexts.$context['_path'], $contexts.$context['_schema'], $contexts.$context['_index'], false)",onContextMenu:"$api.table.contextMenu($event, $contexts.$context['_path'], $contexts.$context['_schema'], $contexts.$context['_index'])"}},id:"$root",children:[ct({...Mv,children:[ct({...Rc,children:[ct({...Ui,node:{...Ui.node,ref:"$root"}},{},{background:"'var(--mk-ui-background-selected)'"})]},{value:"true"}),ct({...Rc,children:[ct({...Ui,node:{...Ui.node,ref:"$root"}},{},{background:"'transparent'"})]},{value:"false"})]},{value:"'_selected'"}),ls(mD,{path:"$contexts.$context['_keyValue']",radius:"'4px'",width:"'50px'",height:"'50px'"},{height:"'50px'",borderRadius:"'8px'",background:"'var(--background-secondary)'"}),{...hn,node:{...hn.node,styles:{gap:"'8px'",flex:"'1'",padding:"'2px'",layout:"'column'",borderBottom:"'thin solid var(--mk-ui-border)'"}},children:[ct(mn,{value:"$contexts.$context['_name']"},{"--font-text-size":"'18px'","--font-text-weight":"'var(--bold-weight)'"}),ct(mn,{value:"$api.path.label($contexts.$context['_keyValue'])?.preview"},{"--font-text-size":"'14px'","--font-text-color":"'var(--mk-ui-text-tertiary)'"}),ls(gO,{})]}]},uR={id:"newItem",def:{id:"newItem"},node:{schemaId:"newItem",parentId:"",name:"New Item",rank:0,id:"newItem",type:"group",props:{space:"",schema:"",key:"",group:"",groupValue:""},types:{space:"text",schema:"text",key:"text",group:"text",groupValue:"text"},actions:{},styles:{gap:"'4px'"}},children:[{...V1,node:{...V1.node,styles:{...V1.node.styles,placeholder:"'+ New Item'",border:"'none'",background:"'transparent'"},actions:{onEnter:"$api.table.insert($root.props.space, $root.props.schema, {[$root.props.group]: $root.props.groupValue, [$root.props.key]: $value}); $event.currentTarget.value = ''"}}}]},dje={def:{id:"listGroup",type:"listGroup"},node:{type:"group",props:{_groupType:"",_groupField:"",_groupValue:"",_readMode:"false",showNew:"true"},types:{_groupType:"text",_groupField:"text",_groupValue:"text",_readMode:"boolean",showNew:"boolean"},propsValue:{showNew:{alias:"Show New Item Button"}},id:"$root",schemaId:"$root",name:"Rows",rank:0},id:"$root",children:[ls(xh,{type:"$root.props['_groupType']",value:"$root.props['_groupValue']"}),ct(mc,{},{layout:"'column'",alignItems:"'stretch'"}),ls(uR,{space:"$contexts.$context['_path']",schema:"$contexts.$context['_schema']",key:"$contexts.$context['_key']",group:"$root.props['_groupField']",groupValue:"$root.props['_groupValue']"},{hidden:"!$root.props['showNew'] || $root.props['_readMode']"})]},pje={def:{id:"columnGroup",type:"listGroup"},node:{type:"group",props:{_groupType:"",_groupField:"",_groupValue:"",_readMode:"false",showNew:"true"},types:{_groupType:"text",_groupField:"text",_groupValue:"text",_readMode:"boolean",showNew:"boolean"},propsValue:{showNew:{alias:"Show New Item Button"}},styles:{layout:"'column'",width:"'262px'",background:"'var(--mk-ui-background-variant)'",borderRadius:"'8px'",padding:"'6px'"},id:"$root",schemaId:"$root",name:"Columns",rank:0},id:"$root",children:[ls(xh,{type:"$root.props['_groupType']",value:"$root.props['_groupValue']"}),ct(mc,{},{gap:"'8px'",layout:"'column'",width:"'100%'",alignItems:"'stretch'"}),ct({...hn,children:[ls(uR,{space:"$contexts.$context['_path']",schema:"$contexts.$context['_schema']",key:"$contexts.$context['_key']",group:"$root.props['_groupField']",groupValue:"$root.props['_groupValue']"},{})]},{},{height:"'auto'",marginTop:"'8px'",borderRadius:"'8px'",width:"'250px'",border:"'1px solid var(--mk-ui-border)'",background:"'var(--mk-ui-background)'",hidden:"!$root.props['showNew'] || $root.props['_readMode']"})]},mje={def:{id:"rowGroup",type:"listGroup"},node:{type:"group",props:{_groupType:"",_groupField:"",_groupValue:""},types:{_groupType:"text",_groupField:"text",_groupValue:"text"},styles:{layout:"'column'",padding:"'6px'",gap:"'8px'"},id:"$root",schemaId:"$root",name:"Catalog Group",rank:0},id:"$root",children:[ls(xh,{type:"$root.props['_groupType']",value:"$root.props['_groupValue']"}),ct(mc,{},{gap:"'8px'",layout:"'row'",width:"'100%'",overflow:"'scroll'"})]},hje={def:{id:"gridGroup",type:"listGroup"},node:{type:"group",props:{_groupType:"",_groupField:"",_groupValue:""},types:{_groupType:"text",_groupField:"text",_groupValue:"text"},styles:{layout:"'column'",padding:"'6px'",gap:"'8px'"},id:"$root",schemaId:"$root",name:"Grid Group",rank:0},id:"$root",children:[ls(xh,{type:"$root.props['_groupType']",value:"$root.props['_groupValue']"}),ct(mc,{},{gap:"'8px'",layout:"'grid'",width:"'100%'","--mk-grid-columns":"'auto-fill'","--mk-grid-width":"'250px'"})]},Aje={def:{id:"masonryGroup",type:"listGroup"},node:{type:"group",props:{},id:"$root",schemaId:"$root",name:"Masonry",rank:0,styles:{layout:"'column'"}},id:"$root",children:[ls(xh,{type:"$root.props['_groupType']",value:"$root.props['_groupValue']"}),ct(mc,{},{padding:"'8px'",layout:"'masonry'"})]},gje={def:{id:"listView",type:"listView"},node:{type:"group",props:{},id:"$root",schemaId:"$root",name:"List View",rank:0},id:"$root",children:[mc]},vje={def:{id:"columnView",type:"listView"},node:{type:"group",props:{},id:"$root",schemaId:"$root",name:"Column View",rank:0},id:"$root",children:[ct(mc,{},{padding:"'8px'",layout:"'row'",gap:"'8px'"})]};var cR=class{constructor(t){this.frame={update:(t,r,n,i)=>{if(t.startsWith("$contexts")){let{context:a,prop:o}=cL(t);a&&o&&this.context.update(a,n,o,r)}else{let a=Pm(t);a.node&&a.prop&&i({[a.node]:{props:{[a.prop]:r}}})}}};this.properties={color:(t,r)=>{if(t?.type?.includes("option")){let i=pr(t.value,t.type).options?.find(a=>a.value==r);if(i?.color.length>0)return i.color}return"var(--mk-ui-background-contrast)"},sticker:t=>Ii(t),value:(t,r)=>t?la(t,r,!0):r};this.path={label:t=>this.superstate.pathsIndex.get(t)?.label,open:(t,r)=>{this.superstate.ui.openPath(t,r)},create:(t,r,n,i)=>i instanceof Promise?i.then(a=>{za(this.superstate,this.superstate.spacesIndex.get(r),n,t,!0,a)}):za(this.superstate,this.superstate.spacesIndex.get(r),n,t,!0,i),setProperty:(t,r,n)=>{if(n instanceof Promise){n.then(i=>{pi(this.superstate,t,{[r]:i})});return}pi(this.superstate,t,{[r]:n})},contextMenu:(t,r)=>{Kp(this.superstate,r,null,{x:t.clientX,y:t.clientY,width:0,height:0},Ne(t.view.document))}};this.commands={run:(t,r,n)=>this.superstate.cli.runCommand(t,{instanceProps:{...r,$api:this,$contexts:n},props:{},iterations:0}),formula:(t,r,n)=>Pd(this.superstate.formulaContext,this.superstate.pathsIndex,this.superstate.spacesMap,t,n.$properties,r,n?.$contexts?.$space?.path)};this.buttonCommand=(t,r,n,i)=>{alert("Button actions have been upgraded, please rebind your buttons to use the new API.")};this.table={select:(t,r)=>this.superstate.spaceManager.readTable(t,r)?.then(n=>n?.rows),update:(t,r,n,i)=>{let a=this.superstate.spacesIndex.get(t);if(a)return HN(this.superstate.spaceManager,a.space,r,n,i)},insert:(t,r,n)=>{if(r==Er){this.context.insert(t,r,n[mt],n);return}let i=this.superstate.spacesIndex.get(t);return i?$oe(this.superstate.spaceManager,n,i.space,r):Promise.resolve()},create:(t,r,n)=>{let i={id:eh(r),name:r,type:"db"};this.superstate.spaceManager.createTable(t,i)},open:async(t,r,n,i)=>{let a=await this.superstate.spaceManager.readTable(t,r);if(r==Er){let o=this.superstate.spaceManager.resolvePath(a?.rows[n]?.[mt],t);this.superstate.ui.openPath(o,i)}},contextMenu:async(t,r,n,i)=>{let a=await this.superstate.spaceManager.readTable(r,n);if(n==Er){let o=a?.rows[i]?.[mt];Kp(this.superstate,o,r,{x:t.clientX,y:t.clientY,width:0,height:0},Ne(t.view.document))}else u9(t,this.superstate,r,n,i)}};this.context={select:(t,r)=>this.superstate.spaceManager.readTable(t,r).then(n=>n?.rows),update:(t,r,n,i)=>{let a=this.superstate.spacesIndex.get(t);a&&Ioe(this.superstate.spaceManager,r,n,i,a.space)},insert:async(t,r,n,i)=>{if(r==Er)za(this.superstate,this.superstate.spacesIndex.get(t),"md",n,!0).then(a=>{i&&pi(this.superstate,a,{...i,[mt]:a})});else{let a=await this.superstate.spaceManager.readTable(t,r);if(a){let o=a.cols.find(l=>l.primary=="true"),s=o?{...i,[o.name]:n}:i;this.table.insert(t,r,s)}}}};this.date={parse:t=>new Date(t?.replace(/-/g,"/").replace(/T.+/,"")),daysInMonth:t=>new Date(t.getFullYear(),t.getMonth()+1,0).getDate(),format:(t,r)=>_r(this.superstate,t,r??"yyyy-MM-dd"),component:(t,r)=>{if(r=="year")return t.getFullYear();if(r=="month")return t.getMonth()+1;if(r=="day")return t.getDate();if(r=="dayOfWeek")return t.getDay();if(r=="hour")return t.getHours();if(r=="minute")return t.getMinutes();if(r=="second")return t.getSeconds()},offset:(t,r,n)=>{let i=new Date(t);return n=="day"&&i.setDate(i.getDate()+r),n=="month"&&i.setMonth(i.getMonth()+r),n=="year"&&i.setFullYear(i.getFullYear()+r),i},now:()=>new Date,range:(t,r,n)=>{let i=[],a=new Date(t);for(;a<=r;)i.push(_r(this.superstate,a,n??"yyyy-MM-dd")),a.setDate(a.getDate()+1);return i}};this.superstate=t}};var fR=class{constructor(t,r){this.superstate=r;this.scheme="spaces";this.apiCommands={path:{open:{schema:{id:"path.open",name:"Open Path",type:"api"},fields:[{name:"path",type:"link"}]},create:{schema:{id:"path.create",name:"Create Item",type:"api"},fields:[{name:"name",type:"text"},{name:"space",type:"space"},{name:"content",type:"text"}]},setProperty:{schema:{id:"path.setProperty",name:"Save Property",type:"api"},fields:[{name:"path",type:"link"},{name:"property",type:"option",value:JSON.stringify({source:"$properties"})},{name:"value",type:"text"}]}},table:{select:{schema:{id:"table.select",name:"Get All List Items from Table",type:"api"},fields:[{name:"path",type:"link"},{name:"table",type:"text"}]},update:{schema:{id:"table.update",name:"Update List Item in Table",type:"api"},fields:[{name:"path",type:"link"},{name:"table",type:"text"},{name:"index",type:"number"},{name:"row",type:"object"}]},insert:{schema:{id:"table.insert",name:"Insert List Item into Table",type:"api"},fields:[{name:"path",type:"link"},{name:"schema",type:"text"},{name:"row",type:"object"}]}},context:{select:{schema:{id:"context.select",name:"Select Items from Context",type:"api"},fields:[{name:"path",type:"link"},{name:"table",type:"text"}]},update:{schema:{id:"context.update",name:"Update Item in Context",type:"api"},fields:[{name:"path",type:"space"},{name:"file",type:"link"},{name:"field",type:"text"},{name:"value",type:"text"}]},insert:{schema:{id:"context.insert",name:"Insert Item into Context",type:"api"},fields:[{name:"path",type:"link"},{name:"schema",type:"text"},{name:"name",type:"text"},{name:"row",type:"object"}]}}};this.manager=t}commandForAction(t){if(!t)return null;let r=cc(t);return r.authority=="$api"?this.apiCommands[r.path]?.[r.ref]:r.authority=="$actions"?this.superstate.actions.get(r.path)?.find(n=>n.schema.id==r.ref):this.superstate.actionsIndex.get(r.path)?.find(n=>n.schema.id==r.ref)}runCommand(t,r){let n=this.commandForAction(t),i,a;try{if(n.schema.type=="api"){let[o,s]=n.schema.id.split(".");i=this.superstate.api[o]?.[s]?.(...n.fields.map(l=>r.instanceProps[l.name]))}n.schema.type=="actions"&&(i=V5(this.superstate,n.code,r)),n.schema.type=="script"&&(i=ZS(n.code,r.instanceProps)),n.schema.type=="formula"&&(i=Pd(this.superstate.formulaContext,this.superstate.pathsIndex,this.superstate.spacesMap,n.code,n.fields.reduce((o,s)=>({...o,[s.name]:s}),{}),r.instanceProps))}catch(o){a=o}return console.log(i,a),i}allCommands(){let t=Object.keys(this.apiCommands).flatMap(n=>Object.keys(this.apiCommands[n]).map(i=>({scheme:"spaces",path:`spaces://$api/${n}/#;${i}`,...this.apiCommands[n][i]}))),r=[...this.superstate.actions.entries()].flatMap(n=>n[1].map(i=>({scheme:"spaces",path:`spaces://$api/${n[0]}/#;${i.schema.id}`,...i})));return[...t,...r]}};function vO(e,t){let r=new Blob([e],{type:"text/javascript"}),n=URL.createObjectURL(r),i=new Worker(n,t);return URL.revokeObjectURL(n),i}function QX(){return vO(`"use strict";var bq=Object.create;var yw=Object.defineProperty;var wq=Object.getOwnPropertyDescriptor;var Dq=Object.getOwnPropertyNames;var Sq=Object.getPrototypeOf,Nq=Object.prototype.hasOwnProperty;var Nn=(e,r)=>()=>(r||e((r={exports:{}}).exports,r),r.exports),Aq=(e,r)=>{for(var t in r)yw(e,t,{get:r[t],enumerable:!0})},Mq=(e,r,t,n)=>{if(r&&typeof r=="object"||typeof r=="function")for(let a of Dq(r))!Nq.call(e,a)&&a!==t&&yw(e,a,{get:()=>r[a],enumerable:!(n=wq(r,a))||n.enumerable});return e};var Aa=(e,r,t)=>(t=e!=null?bq(Sq(e)):{},Mq(r||!e||!e.__esModule?yw(t,"default",{value:e,enumerable:!0}):t,e));var LM=Nn((Rw,Zu)=>{(function(e,r){typeof Rw=="object"&&typeof Zu<"u"?Zu.exports=r():typeof define=="function"&&define.amd?define(r):e.moment=r()})(Rw,function(){"use strict";var e;function r(){return e.apply(null,arguments)}function t(g){e=g}function n(g){return g instanceof Array||Object.prototype.toString.call(g)==="[object Array]"}function a(g){return g!=null&&Object.prototype.toString.call(g)==="[object Object]"}function i(g,A){return Object.prototype.hasOwnProperty.call(g,A)}function s(g){if(Object.getOwnPropertyNames)return Object.getOwnPropertyNames(g).length===0;var A;for(A in g)if(i(g,A))return!1;return!0}function c(g){return g===void 0}function f(g){return typeof g=="number"||Object.prototype.toString.call(g)==="[object Number]"}function o(g){return g instanceof Date||Object.prototype.toString.call(g)==="[object Date]"}function u(g,A){var P=[],z,G=g.length;for(z=0;z>>0,z;for(z=0;z0)for(P=0;Pi.path)}createRoot(t){return(0,GMe.createRoot)(t)}notify(t){new Jv.Notice(t)}uriByString(t,r){return cc(t)}spaceFragmentSchema(t){return Promise.resolve(null)}saveSettings(){this.plugin.plugin.saveData(this.plugin.settings)}resolvePath(t,r){return this.plugin.app.metadataCache.getFirstLinkpathDest(t,r)?.path}openMenu(t,r){let n=new Jv.Menu;for(let i of r)n.addItem(a=>{a.setTitle(i.name),a.onClick(o=>i.onClick(o))});n.showAtMouseEvent(t)}openPath(t,r){let n=this.uriByString(t);vE(this.plugin.app,this.plugin.app.workspace.getLeaf(),r,null,async i=>{let a=i.attachLeaf();if(this.plugin.app.vault.getAbstractFileByPath(n.basePath)instanceof Jv.TFile){await a.openFile(this.plugin.app.vault.getAbstractFileByPath(n.basePath));let o=yE(n.basePath,n.refStr,this.plugin.app);if(!a.view?.editor)return;o[0]&&o[1]&&a.view.editor?.cm.dispatch({annotations:[zf.of(o)]})}else await Cb(a,t,this.plugin.plugin,!0)})}addActiveStateListener(t){}removeActiveStateListener(t){}};var QMe=e=>{e.plugin.addCommand({id:"mk-open-flow",name:H.commandPalette.openFlow,callback:()=>e.openFlow()}),e.plugin.addCommand({id:"mk-close-flow",name:H.commandPalette.closeFlow,callback:()=>e.closeFlow()})};var GX=Ae(Te()),Snt=(e,t)=>{let r=e;for(;!r.hasClass("cm-editor")&&r.parentElement;)r=r.parentElement;if(!r.hasClass("cm-editor"))return;let n;return t.workspace.iterateLeaves(i=>{let a=i.view.editor?.cm;if(a&&r==a.dom)return n=a,!0},t.workspace.rootSplit),n},YMe=(e,t,r)=>{t.querySelectorAll("p").forEach(n=>{for(let i of n.textContent.matchAll(/(?:!\[!\[|!!\[\[)([^\]]+)\]\]/g)){let a=i[1];n.style.display="none",e.enactor.createRoot(n.parentElement).render(GX.default.createElement(cO,{load:!0,plugin:e,path:a,source:r.sourcePath}))}})},Ent=(e,t)=>{let r=e;setTimeout(async()=>{let n=0;for(;!e.parentElement&&n++<=50;)await sleep(50);if(!!e.parentElement){for(;!r.hasClass("markdown-embed")&&r.parentElement;)r=r.parentElement;r&&t(r)}})};var ZMe=(e,t,r,n)=>{Ent(e,async i=>{let a=i.querySelectorAll(".markdown-embed-link");for(let o=0;o{let t=!1,r=Ob(e1.Workspace.prototype,{changeLayout(n){return async function(i){t=!0;try{await n.call(this,i)}finally{t=!1}}},getLeaf(n){return function(i){let a=n.call(this,i);if(a.isFlowBlock){let o=a.id,s=!1;e.app.workspace.iterateLeaves(l=>{l.flowEditors&&!s&&l.flowEditors.forEach(u=>{u.leaves().forEach(c=>{if(c.id==o){s=!0,a=l;return}})})},e.app.workspace.rootSplit)}return a}},setActiveLeaf(n){return function(a,o){return a.view.getViewType()=="markdown"&&(this.activeEditor=a.view,a.view.file),n.call(this,a,o)}},getDropLocation(n){return function(a){for(let o of Wh.activePopovers(e.app)){let s=this.recursiveGetTarget(a,o.rootSplit);if(s)return s}return n.call(this,a)}},onDragLeaf(n){return function(i,a){let o=Wh.forLeaf(a);return n.call(this,i,a)}}});e.plugin.register(r)},KMe=e=>{e.plugin.register(Ob(e1.WorkspaceLeaf.prototype,{getRoot(t){return function(){let r=t.call(this);return r.getRoot===this.getRoot?r:r.getRoot()}},setViewState(t){return async function(r,n){let i=await t.call(this,r,n);try{if(this.flowEditors)for(let a of this.flowEditors)a.hide();this.flowEditors=[]}catch{}return i}},setEphemeralState(t){return function(r){t.call(this,r),r.focus&&this.view?.getViewType()==="empty"&&(this.view.contentEl.tabIndex=-1,this.view.contentEl.focus())}}})),e.plugin.register(Ob(e1.WorkspaceItem.prototype,{getContainer(t){return function(){if(!!t)return!this.parentSplit||this instanceof e1.WorkspaceContainer?t.call(this):this.parentSplit.getContainer()}}}))};var AO=class{constructor(t){this.plugin=t;if(this.settings=t.superstate.settings.basicsSettings,this.app=t.app,t.app.plugins.getPlugin("make-md")){let r=new rR(t.app.plugins.getPlugin("make-md").superstate,this);this.enactor=r}else this.enactor=new aR(this)}isTouchScreen(){return JMe.Platform.isMobile}toggleBold(){let t=Sg(this);t&&t.dispatch({annotations:$b.of("strong")})}toggleEm(){let t=Sg(this);t&&t.dispatch({annotations:$b.of("em")})}openFlow(){let t=Sg(this);if(t){let r=t.state.field(Wc,!1),n=t.state.selection.main;for(let i of r)i.fromn.from&&t.dispatch({annotations:Uf.of([i.id,2])})}}closeFlow(){let t=Sg(this);if(t){let r=t.state.field(Wc,!1),n=t.state.selection.main;for(let i of r)i.fromn.from&&t.dispatch({annotations:Uf.of([i.id,0])})}}loadBasics(){this.enactor.load(),document.body.classList.toggle("mk-mobile-sidepanel",this.settings.mobileSidepanel),document.body.classList.toggle("mk-mobile-styler",this.settings.mobileMakeBar),NMe(this),this.settings.editorFlow&&(XMe(this),KMe(this),document.body.classList.toggle("mk-flow-replace",this.settings.editorFlow),document.body.classList.toggle("mk-flow-"+this.settings.editorFlowStyle,!0),this.plugin.registerMarkdownPostProcessor((t,r)=>{(i=>{let a=i.querySelectorAll(".internal-embed.markdown-embed");for(let o=0;ofetch(t).then(i=>(this.loading[t]=!1,i.status!==200?n(i.statusText):i.json())).then(i=>{let a=i;return this.loadedKit(t,t,a).then(o=>i)}).then(i=>r(i))))}};var lR=class{constructor(){this.schemes=["http","https"];this.onNoteCreate=async(t,r)=>{this.spaceManager.onPathCreated(t)};this.onCreate=async(t,r)=>{let n=this.spaceInfoForPath(t);await this.spaceManager.onSpaceCreated(t),await this.spaceManager.superstate.reloadContext(n)};this.webCache=new sR(this)}initiateAdapter(t){this.spaceManager=t}async readTemplates(t){return[]}async saveTemplate(t,r){return null}deleteTemplate(t,r){}async readFocuses(){return[]}async saveFocuses(t){}async readTemplate(t){}async readAllKits(){return[]}async readAllTemplates(){return{}}async readKitFrames(t){return{}}async saveFrameKit(t,r){}async saveSpaceTemplate(t,r){}allPaths(t){return[]}async pathExists(t){return!!t.startsWith("https://www.make.md")}async createItemAtPath(t,r,n,i){return null}async renamePath(t,r){return null}async deletePath(t){}async getPathInfo(t){return{}}keysForCacheType(t){return null}async readPathCache(t){if(this.webCache.notes.has(t))return{metadata:{properties:{}},type:"remote",ctime:0,subtype:"note",contentTypes:[],tags:[],readOnly:!0,label:{name:this.webCache.notes.get(t).name,sticker:this.webCache.notes.get(t).properties.sticker,color:null},parent:[...this.webCache.parentMap.get(t)][0]};let r=await this.webCache.load(t);return{metadata:{properties:r.properties},ctime:0,type:"space",subtype:"web",contentTypes:[],tags:[],readOnly:!0,label:{name:r.name,sticker:r.properties.sticker,color:r.properties.color},parent:[...this.webCache.parentMap.get(t)][0]}}async readPath(t){return this.webCache.notes.get(t).content}async copyPath(t,r,n){}async writeToPath(t,r,n){}async childrenForPath(t,r){return[...this.webCache.parentMap.getInverse(t)]}parentPathForPath(t){return[...this.webCache.parentMap.get(t)][0]}async readFrame(t,r){return(await this.webCache.load(t)).frames[r]}async readAllFrames(t){return(await this.webCache.load(t)).frames}async readTable(t,r){return(await this.webCache.load(t)).context[r]}async spaceInitiated(t){return!!this.webCache.cache.has(t)}async contextInitiated(t){return!!this.webCache.cache.has(t)}async tablesForSpace(t){let r=await this.webCache.load(t);return Object.values(r.context).map(n=>n.schema)}async createTable(t,r){}async saveTableSchema(t,r,n){return!1}async saveTable(t,r,n){return!1}async deleteTable(t,r){}async readAllTables(t){return(await this.webCache.load(t)).context}async framesForSpace(t){let r=await this.webCache.load(t);return Object.values(r.frames).map(n=>n.schema)}async createFrame(t,r){}async deleteFrame(t,r){}async saveFrameSchema(t,r,n){return!1}async saveFrame(t,r){return!1}async commandsForSpace(t){return[]}async runCommand(t,r,n){return null}async createCommand(t,r){}async readSystemCommands(){return[]}async readLibraryCommands(t){return[]}async saveSystemCommand(t,r){}async deleteCommand(t,r){}async saveCommand(t,r,n){return!1}async contextForSpace(t){return null}async addSpaceProperty(t,r){}async deleteSpaceProperty(t,r){}async saveSpaceProperty(t,r,n){return!1}async addProperty(t,r){}async readLabel(t){return null}async saveLabel(t,r,n){}async renameProperty(t,r,n){}async readProperties(t){return(await this.webCache.load(t)).context[Er].cols}async deleteProperty(t,r){}async saveProperties(t,r){return!1}allSpaces(){return[]}readTags(){return[]}spaceInfoForPath(t){return{name:t.split("/").pop(),path:t,isRemote:!0,readOnly:!0,defPath:t+"/.def",notePath:t}}allCaches(){return new Map}async spaceDefForSpace(t){return(await this.webCache.load(t)).definition}async createSpace(t,r,n){}async saveSpace(t,r,n){}async renameSpace(t,r){return null}deleteSpace(t){}childrenForSpace(t){return[...this.webCache.parentMap.getInverse(t)]}addTag(t,r){}renameTag(t,r,n){}deleteTag(t,r){}pathsForTag(t){return[]}resolvePath(t,r){return t}};var eje=e=>JSON.stringify(e),ME=e=>`${e.type}:${e.path}`;var t1=Ae(yi());var tje={def:{id:"eventItem",type:"listItem"},node:{type:"group",id:"$root",schemaId:"$root",name:H.frames.event.label,rank:0},id:"$root",children:[ct(Mo,{value:"$contexts.$context['_keyValue']"},{padding:"'0'","--font-text-weight":"'bold'"})]},rje={def:{id:"dateGroup",type:"listGroup"},node:{type:"group",props:{_groupValue:""},styles:{layout:"'column'",background:"'var(--mk-ui-background-variant)'",padding:"'6px'",height:"'150px'",overflow:"'hidden'",width:"'100%'"},id:"$root",schemaId:"$root",name:"Date",rank:0},id:"$root",children:[ct(mn,{value:"$api.date.component($api.date.parse($root.props['_groupValue']), 'day')"},{padding:"'4px'","--font-text-weight":"'bold'"}),ct(mc,{},{gap:"'2px'",layout:"'column'"})]},nje={def:{id:"calendarView",type:"listView"},node:{type:"group",props:{year:"$api.date.component($api.date.offset($api.date.now(), $root.props.offset, 'month'), 'year')",month:"$api.date.component($api.date.offset($api.date.now(), $root.props.offset, 'month'), 'month')",offset:"0",startOfMonth:"$root.props.year+'-'+$root.props.month+'-01'",endOfMonth:"$root.props.year+'-'+$root.props.month+'-'+$api.date.daysInMonth($api.date.parse($root.props.startOfMonth))",dayOfWeek:"$api.date.component($api.date.parse($root.props.startOfMonth), 'dayOfWeek')",groupFilter:"'isSameDate'",groupOptions:"$api.date.range($api.date.parse($root.props.startOfMonth), $api.date.parse($root.props.endOfMonth))"},id:"$root",schemaId:"$root",name:H.frames.calendar.label,rank:0},id:"$root",children:[ct({...hn,children:[ct({...hn,children:[ct(mn,{value:"$api.date.format($api.date.parse($root.props.startOfMonth), 'MMMM')"},{padding:"'8px'","--font-text-weight":"'bold'",class:"'mk-t-h1'"}),ct({...hn,children:[ls(jv,{icon:"'ui//chevron-left'"},{},{onClick:"$saveState({$root: {props: {offset: $root.props.offset - 1}}})"}),ls(jv,{label:"'Today'"},{},{onClick:"$saveState({$root: {props: {offset: 0}}})"}),ls(jv,{icon:"'ui//chevron-right'"},{},{onClick:"$saveState({$root: {props: {offset: $root.props.offset + 1}}})"})]},{},{layout:"'row'"})]},{},{width:"'100%'"})]},{}),ct({...hn,children:[ct(mn,{value:"'Sunday'"},{padding:"'8px'","--font-text-weight":"'bold'"}),ct(mn,{value:"'Monday'"},{padding:"'8px'","--font-text-weight":"'bold'"}),ct(mn,{value:"'Tuesday'"},{padding:"'8px'","--font-text-weight":"'bold'"}),ct(mn,{value:"'Wednesday'"},{padding:"'8px'","--font-text-weight":"'bold'"}),ct(mn,{value:"'Thursday'"},{padding:"'8px'","--font-text-weight":"'bold'"}),ct(mn,{value:"'Friday'"},{padding:"'8px'","--font-text-weight":"'bold'"}),ct(mn,{value:"'Saturday'"},{padding:"'8px'","--font-text-weight":"'bold'"})]},{},{width:"'100%'",height:"'auto'",layout:"'grid'","--mk-grid-columns":"'7'","--mk-grid-width":"'0'"}),ct({...mc,children:[ct(hn,{},{gridColumn:"'span '+$root.props.dayOfWeek"})]},{},{padding:"'8px'",layout:"'grid'","--mk-grid-columns":"'7'","--mk-grid-width":"'0'",gap:"'1px'"})]};var gO={id:"fieldsView",def:{id:"fieldsView"},node:{schemaId:"fieldsView",parentId:"",name:"Properties",rank:0,id:"fieldsView",type:"group"},children:[ct({...E9,children:[ct({...k9,children:[ls(xh,{sticker:"$api.properties.sticker(listItem.props.value)",type:"listItem.props.value.type",value:"$contexts[listItem.props.value.table?.length > 0 ? listItem.props.value.table : $contexts.$context._path]?.[listItem.props.value.name]",property:"listItem.props.value"})]},{},{layout:"'row'",gap:"'8px'",hidden:"!($contexts[listItem.props.value.table?.length > 0 ? listItem.props.value.table : $contexts.$context._path]?.[listItem.props.value.name]?.length > 0)"})]},{value:"$contexts.$context._properties?.filter(f => f.primary != 'true') ?? []"},{layout:"'column'",gap:"'4px'"})]},ije={def:{id:"coverListItem",type:"listItem"},node:{type:"group",id:"$root",schemaId:"$root",name:"Cover Item",rank:0,props:{coverProperty:"'File'"},types:{coverProperty:"option"},propsValue:{coverProperty:{alias:"Cover Image",source:"$properties"}},styles:{layout:'"column"'}},id:"$root",children:[ct(uf,{value:"$api.path.label($contexts[$contexts.$context['_path']]?.[$root.props.coverProperty])?.thumbnail"},{background:"'var(--mk-ui-background-contrast)'",borderRadius:"'8px'",width:"'200px'",height:"'300px'"}),ct(Mo,{value:"$contexts.$context['_keyValue']"},{padding:"'4px'"})]},aje={def:{id:"imageListItem",type:"listItem"},node:{type:"group",id:"$root",schemaId:"$root",name:"Image Item",rank:0,props:{_selected:"$root.props['_selectedIndex'] == $contexts.$context['_index']"},styles:{layout:'"row"',padding:"'4px'"},actions:{onClick:"$saveState({ $root: {props: {_selectedIndex: $contexts.$context['_index']}} });",onDoubleClick:"$api.table.open($contexts.$context['_path'], $contexts.$context['_schema'], $contexts.$context['_index'], false)",onContextMenu:"$api.table.contextMenu($event, $contexts.$context['_path'], $contexts.$context['_schema'], $contexts.$context['_index'])"}},id:"$root",children:[ct(uf,{value:"$api.path.label($contexts.$context['_keyValue'])?.thumbnail"},{borderRadius:"'8px'"})]},oje={def:{id:"flowListItem",type:"listItem"},node:{type:"group",id:"$root",schemaId:"$root",name:"Flow Item",rank:0,props:{_selected:"$root.props['_selectedIndex'] == $contexts.$context['_index']",expanded:"true",seamless:"false"},types:{expanded:"boolean",seamless:"boolean"},propsValue:{expanded:{alias:"Expanded"},seamless:{alias:"Seamless"}},styles:{layout:'"row"',gap:"'8px'"},actions:{}},id:"$root",children:[ct(Mo,{value:"$contexts.$context['_keyValue']"},{"--mk-expanded":"$root.props.expanded","--mk-min-mode":"$root.props.seamless",padding:"'4px'",marginBottom:"'8px'"})]},sje={def:{id:"cardsListItem",type:"listItem"},node:{type:"group",id:"$root",schemaId:"$root",name:"Cards Item",rank:0,props:{_selected:"$root.props['_selectedIndex'] == $contexts.$context['_index']",coverProperty:"'File'"},types:{coverProperty:"option"},propsValue:{coverProperty:{alias:"Cover Image",source:"$properties"}},styles:{layout:'"column"',overflow:"'hidden'",borderRadius:"'8px'",width:"'100%'",height:"'100%'",border:"'1px solid var(--mk-ui-border)'",boxShadow:"'var(--mk-shadow-card)'"},actions:{onClick:"$saveState({ $root: {props: {_selectedIndex: $contexts.$context['_index']}} });",onDoubleClick:"$api.table.open($contexts.$context['_path'], $contexts.$context['_schema'], $contexts.$context['_index'], false)",onContextMenu:"$api.table.contextMenu($event, $contexts.$context['_path'], $contexts.$context['_schema'], $contexts.$context['_index'])"}},id:"$root",children:[ct({...Mv,children:[ct({...Rc,children:[ct({...Ui,node:{...Ui.node,ref:"$root"}},{},{background:"'var(--mk-ui-background-selected)'"})]},{value:"true"}),ct({...Rc,children:[ct({...Ui,node:{...Ui.node,ref:"$root"}},{},{background:"'var(--mk-ui-background)'"})]},{value:"false"})]},{value:"'_selected'"}),ct({...hn,children:[ct(uf,{value:"$api.path.label($contexts[$contexts.$context['_path']]?.[$root.props.coverProperty])?.thumbnail"},{width:"'100%'",height:"'80px'"})]},{},{width:"'100%'",height:"'80px'",background:"'var(--mk-ui-background-contrast)'"}),ct({...hn,children:[ct(Xa,{value:"$api.path.label($contexts.$context['_keyValue'])?.sticker"},{width:"'32px'",height:"'32px'",padding:"'4px'","--icon-size":"'24px'",borderRadius:"'4px'",overflow:"'hidden'",background:"$api.path.label($contexts.$context['_keyValue'])?.color"})]},{},{width:"'32px'",height:"'32px'",marginTop:"'-16px'",marginLeft:"'4px'",borderRadius:"'4px'",background:"'var(--mk-ui-background-contrast)'"}),{...hn,node:{...hn.node,styles:{gap:"'8px'",padding:"'8px'",flex:"'1'"}},children:[ct(mn,{value:"$contexts.$context['_name']"},{"--font-text-weight":"'var(--bold-weight)'"}),ls(gO,{},{marginTop:"'8px'"})]}]},lje={def:{id:"cardListItem",type:"listItem"},node:{type:"group",id:"$root",schemaId:"$root",name:"Card Item",rank:0,props:{_selected:"$root.props['_selectedIndex'] == $contexts.$context['_index']"},styles:{layout:'"column"',overflow:"'hidden'",borderRadius:"'8px'",width:"'100%'",border:"'1px solid var(--mk-ui-border)'"},actions:{onClick:"$saveState({ $root: {props: {_selectedIndex: $contexts.$context['_index']}} });",onDoubleClick:"$api.path.open($contexts.$context['_keyValue'], false)",onContextMenu:"$api.table.contextMenu($event, $contexts.$context['_path'], $contexts.$context['_schema'], $contexts.$context['_index'])"}},id:"$root",children:[ct({...Mv,children:[ct({...Rc,children:[ct({...Ui,node:{...Ui.node,ref:"$root"}},{},{background:"'var(--mk-ui-background-selected)'"})]},{value:"true"}),ct({...Rc,children:[ct({...Ui,node:{...Ui.node,ref:"$root"}},{},{background:"'var(--mk-ui-background)'"})]},{value:"false"})]},{value:"'_selected'"}),ct(uf,{value:"$api.path.label($contexts.$context['_keyValue'])?.thumbnail"},{width:"'100%'",maxHeight:"'80px'"}),{...hn,node:{...hn.node,styles:{gap:"'8px'",padding:"'8px'",flex:"'1'"}},children:[ct(mn,{value:"$contexts.$context['_name']"},{"--font-text-weight":"'var(--bold-weight)'"}),ls(gO,{})]}]},uje={def:{id:"rowItem",type:"listItem"},node:{type:"group",id:"$root",schemaId:"$root",name:"List View",rank:0,props:{_selected:"$root.props['_selectedIndex'] == $contexts.$context['_index']",previewField:"'Created'"},styles:{layout:'"row"',gap:"'12px'",padding:"'4px'",overflow:"'hidden'",width:"'100%'",layoutAlign:"'n'"},actions:{onClick:"$saveState({ $root: {props: {_selectedIndex: $contexts.$context['_index']}} });",onDoubleClick:"$api.table.open($contexts.$context['_path'], $contexts.$context['_schema'], $contexts.$context['_index'], false)",onContextMenu:"$api.table.contextMenu($event, $contexts.$context['_path'], $contexts.$context['_schema'], $contexts.$context['_index'])"},types:{previewField:"option"},propsValue:{previewField:{alias:"Preview",source:"$properties"}}},id:"$root",children:[ct({...Mv,children:[ct({...Rc,children:[ct({...Ui,node:{...Ui.node,ref:"$root"}},{},{background:"'var(--mk-ui-background-selected)'"})]},{value:"true"}),ct({...Rc,children:[ct({...Ui,node:{...Ui.node,ref:"$root"}},{},{background:"'transparent'"})]},{value:"false"})]},{value:"'_selected'"}),ls(mD,{path:"$contexts.$context['_keyValue']",width:"'32px'",height:"'32px'",padding:"'8px'",radius:"'4px'"},{borderRadius:"'4px'",background:"'var(--background-secondary)'"}),{...hn,node:{...hn.node,styles:{gap:"'8px'",flex:"'1'",padding:"'2px'",layout:"'column'",layoutAlign:"'w'",height:"'auto'"}},children:[{...hn,node:{...hn.node,styles:{gap:"'8px'",flex:"'1'",padding:"'2px'",layout:"'row'",layoutAlign:"'w'",height:"'auto'",width:"'100%'"}},children:[ct(mn,{value:"$contexts.$context['_name']"},{"--font-text-size":"'14px'","--font-text-weight":"'var(--bold-weight)'",width:"'auto'"}),ct(hn,{},{flex:"'1'",height:"'auto'"}),ls(xh,{type:"$contexts.$context._properties?.find(f => f.name == $root.props['previewField'])?.type",value:"$contexts[$contexts.$context['_path']]?.[$root.props.previewField]"},{"--font-text-color":"'var(--mk-ui-text-tertiary)'"})]}]}]},cje={def:{id:"overviewItem",type:"listItem"},node:{type:"group",id:"$root",schemaId:"$root",name:"Overview Item",rank:0,props:{_selected:"$root.props['_selectedIndex'] == $contexts.$context['_index']"},styles:{layout:'"row"',gap:"'12px'",padding:"'8px'",overflow:"'hidden'",width:"'100%'",borderBottom:"'thin solid var(--mk-ui-border)'"},actions:{onClick:"$saveState({ $root: {props: {_selectedIndex: $contexts.$context['_index']}} }); $api.table.open($contexts.$context['_path'], $contexts.$context['_schema'], $contexts.$context['_index'], false)",onContextMenu:"$api.table.contextMenu($event, $contexts.$context['_path'], $contexts.$context['_schema'], $contexts.$context['_index'])"}},id:"$root",children:[ct({...Mv,children:[ct({...Rc,children:[ct({...Ui,node:{...Ui.node,ref:"$root"}},{},{background:"'var(--mk-ui-background-selected)'"})]},{value:"true"}),ct({...Rc,children:[ct({...Ui,node:{...Ui.node,ref:"$root"}},{},{background:"'transparent'"})]},{value:"false"})]},{value:"'_selected'"}),{...hn,node:{...hn.node,styles:{gap:"'8px'",flex:"'1'",padding:"'2px'",layout:"'column'",overflow:"'hidden'"}},children:[ct({...hn,children:[ct(Xa,{value:"$api.path.label($contexts.$context['_keyValue'])?.sticker"},{width:"'20px'",height:"'20px'",padding:"'2px'","--icon-size":"'14px'",borderRadius:"'4px'",overflow:"'hidden'",background:"$api.path.label($contexts.$context['_keyValue'])?.color"}),ct(mn,{value:"$contexts.$context['_name']"},{"--font-text-size":"'14px'","--font-text-weight":"'var(--bold-weight)'"})]},{},{layout:'"row"',height:"'auto'",width:"'auto'",gap:"'4px'"}),ct(mn,{value:"$api.path.label($contexts.$context['_keyValue'])?.preview"},{"--font-text-size":"'14px'","--font-text-color":"'var(--mk-ui-text-tertiary)'","--line-count":"2"})]},ct(uf,{value:"$api.path.label($contexts.$context['_keyValue'])?.thumbnail"},{radius:"'4px'",width:"'64px'",height:"'64px'",borderRadius:"'8px'",hidden:"($api.path.label($contexts.$context['_keyValue'])?.thumbnail ?? '').length == 0"})]},fje={def:{id:"detailItem",type:"listItem"},node:{type:"group",id:"$root",schemaId:"$root",name:"Detail View",rank:0,props:{_selected:"$root.props['_selectedIndex'] == $contexts.$context['_index']"},styles:{layout:'"row"',gap:"'12px'",padding:"'8px'",overflow:"'hidden'",width:"'100%'"},actions:{onClick:"$saveState({ $root: {props: {_selectedIndex: $contexts.$context['_index']}} });",onDoubleClick:"$api.table.open($contexts.$context['_path'], $contexts.$context['_schema'], $contexts.$context['_index'], false)",onContextMenu:"$api.table.contextMenu($event, $contexts.$context['_path'], $contexts.$context['_schema'], $contexts.$context['_index'])"}},id:"$root",children:[ct({...Mv,children:[ct({...Rc,children:[ct({...Ui,node:{...Ui.node,ref:"$root"}},{},{background:"'var(--mk-ui-background-selected)'"})]},{value:"true"}),ct({...Rc,children:[ct({...Ui,node:{...Ui.node,ref:"$root"}},{},{background:"'transparent'"})]},{value:"false"})]},{value:"'_selected'"}),ls(mD,{path:"$contexts.$context['_keyValue']",radius:"'4px'",width:"'50px'",height:"'50px'"},{height:"'50px'",borderRadius:"'8px'",background:"'var(--background-secondary)'"}),{...hn,node:{...hn.node,styles:{gap:"'8px'",flex:"'1'",padding:"'2px'",layout:"'column'",borderBottom:"'thin solid var(--mk-ui-border)'"}},children:[ct(mn,{value:"$contexts.$context['_name']"},{"--font-text-size":"'18px'","--font-text-weight":"'var(--bold-weight)'"}),ct(mn,{value:"$api.path.label($contexts.$context['_keyValue'])?.preview"},{"--font-text-size":"'14px'","--font-text-color":"'var(--mk-ui-text-tertiary)'"}),ls(gO,{})]}]},uR={id:"newItem",def:{id:"newItem"},node:{schemaId:"newItem",parentId:"",name:"New Item",rank:0,id:"newItem",type:"group",props:{space:"",schema:"",key:"",group:"",groupValue:""},types:{space:"text",schema:"text",key:"text",group:"text",groupValue:"text"},actions:{},styles:{gap:"'4px'"}},children:[{...V1,node:{...V1.node,styles:{...V1.node.styles,placeholder:"'+ New Item'",border:"'none'",background:"'transparent'"},actions:{onEnter:"$api.table.insert($root.props.space, $root.props.schema, {[$root.props.group]: $root.props.groupValue, [$root.props.key]: $value}); $event.currentTarget.value = ''"}}}]},dje={def:{id:"listGroup",type:"listGroup"},node:{type:"group",props:{_groupType:"",_groupField:"",_groupValue:"",_readMode:"false",showNew:"true"},types:{_groupType:"text",_groupField:"text",_groupValue:"text",_readMode:"boolean",showNew:"boolean"},propsValue:{showNew:{alias:"Show New Item Button"}},id:"$root",schemaId:"$root",name:"Rows",rank:0},id:"$root",children:[ls(xh,{type:"$root.props['_groupType']",value:"$root.props['_groupValue']"}),ct(mc,{},{layout:"'column'",alignItems:"'stretch'"}),ls(uR,{space:"$contexts.$context['_path']",schema:"$contexts.$context['_schema']",key:"$contexts.$context['_key']",group:"$root.props['_groupField']",groupValue:"$root.props['_groupValue']"},{hidden:"!$root.props['showNew'] || $root.props['_readMode']"})]},pje={def:{id:"columnGroup",type:"listGroup"},node:{type:"group",props:{_groupType:"",_groupField:"",_groupValue:"",_readMode:"false",showNew:"true"},types:{_groupType:"text",_groupField:"text",_groupValue:"text",_readMode:"boolean",showNew:"boolean"},propsValue:{showNew:{alias:"Show New Item Button"}},styles:{layout:"'column'",width:"'262px'",background:"'var(--mk-ui-background-variant)'",borderRadius:"'8px'",padding:"'6px'"},id:"$root",schemaId:"$root",name:"Columns",rank:0},id:"$root",children:[ls(xh,{type:"$root.props['_groupType']",value:"$root.props['_groupValue']"}),ct(mc,{},{gap:"'8px'",layout:"'column'",width:"'100%'",alignItems:"'stretch'"}),ct({...hn,children:[ls(uR,{space:"$contexts.$context['_path']",schema:"$contexts.$context['_schema']",key:"$contexts.$context['_key']",group:"$root.props['_groupField']",groupValue:"$root.props['_groupValue']"},{})]},{},{height:"'auto'",marginTop:"'8px'",borderRadius:"'8px'",width:"'250px'",border:"'1px solid var(--mk-ui-border)'",background:"'var(--mk-ui-background)'",hidden:"!$root.props['showNew'] || $root.props['_readMode']"})]},mje={def:{id:"rowGroup",type:"listGroup"},node:{type:"group",props:{_groupType:"",_groupField:"",_groupValue:""},types:{_groupType:"text",_groupField:"text",_groupValue:"text"},styles:{layout:"'column'",padding:"'6px'",gap:"'8px'"},id:"$root",schemaId:"$root",name:"Catalog Group",rank:0},id:"$root",children:[ls(xh,{type:"$root.props['_groupType']",value:"$root.props['_groupValue']"}),ct(mc,{},{gap:"'8px'",layout:"'row'",width:"'100%'",overflow:"'scroll'"})]},hje={def:{id:"gridGroup",type:"listGroup"},node:{type:"group",props:{_groupType:"",_groupField:"",_groupValue:""},types:{_groupType:"text",_groupField:"text",_groupValue:"text"},styles:{layout:"'column'",padding:"'6px'",gap:"'8px'"},id:"$root",schemaId:"$root",name:"Grid Group",rank:0},id:"$root",children:[ls(xh,{type:"$root.props['_groupType']",value:"$root.props['_groupValue']"}),ct(mc,{},{gap:"'8px'",layout:"'grid'",width:"'100%'","--mk-grid-columns":"'auto-fill'","--mk-grid-width":"'250px'"})]},Aje={def:{id:"masonryGroup",type:"listGroup"},node:{type:"group",props:{},id:"$root",schemaId:"$root",name:"Masonry",rank:0,styles:{layout:"'column'"}},id:"$root",children:[ls(xh,{type:"$root.props['_groupType']",value:"$root.props['_groupValue']"}),ct(mc,{},{padding:"'8px'",layout:"'masonry'"})]},gje={def:{id:"listView",type:"listView"},node:{type:"group",props:{},id:"$root",schemaId:"$root",name:"List View",rank:0},id:"$root",children:[mc]},vje={def:{id:"columnView",type:"listView"},node:{type:"group",props:{},id:"$root",schemaId:"$root",name:"Column View",rank:0},id:"$root",children:[ct(mc,{},{padding:"'8px'",layout:"'row'",gap:"'8px'"})]};var cR=class{constructor(t){this.frame={update:(t,r,n,i)=>{if(t.startsWith("$contexts")){let{context:a,prop:o}=cL(t);a&&o&&this.context.update(a,n,o,r)}else{let a=Im(t);a.node&&a.prop&&i({[a.node]:{props:{[a.prop]:r}}})}}};this.properties={color:(t,r)=>{if(t?.type?.includes("option")){let i=pr(t.value,t.type).options?.find(a=>a.value==r);if(i?.color.length>0)return i.color}return"var(--mk-ui-background-contrast)"},sticker:t=>Ii(t),value:(t,r)=>t?la(t,r,!0):r};this.path={label:t=>this.superstate.pathsIndex.get(t)?.label,open:(t,r)=>{this.superstate.ui.openPath(t,r)},create:(t,r,n,i)=>i instanceof Promise?i.then(a=>{za(this.superstate,this.superstate.spacesIndex.get(r),n,t,!0,a)}):za(this.superstate,this.superstate.spacesIndex.get(r),n,t,!0,i),setProperty:(t,r,n)=>{if(n instanceof Promise){n.then(i=>{pi(this.superstate,t,{[r]:i})});return}pi(this.superstate,t,{[r]:n})},contextMenu:(t,r)=>{Jp(this.superstate,r,null,{x:t.clientX,y:t.clientY,width:0,height:0},Ne(t.view.document))}};this.commands={run:(t,r,n)=>this.superstate.cli.runCommand(t,{instanceProps:{...r,$api:this,$contexts:n},props:{},iterations:0}),formula:(t,r,n)=>Pd(this.superstate.formulaContext,this.superstate.pathsIndex,this.superstate.spacesMap,t,n.$properties,r,n?.$contexts?.$space?.path)};this.buttonCommand=(t,r,n,i)=>{alert("Button actions have been upgraded, please rebind your buttons to use the new API.")};this.table={select:(t,r)=>this.superstate.spaceManager.readTable(t,r)?.then(n=>n?.rows),update:(t,r,n,i)=>{let a=this.superstate.spacesIndex.get(t);if(a)return HN(this.superstate.spaceManager,a.space,r,n,i)},insert:(t,r,n)=>{if(r==Er){this.context.insert(t,r,n[mt],n);return}let i=this.superstate.spacesIndex.get(t);return i?$oe(this.superstate.spaceManager,n,i.space,r):Promise.resolve()},create:(t,r,n)=>{let i={id:eh(r),name:r,type:"db"};this.superstate.spaceManager.createTable(t,i)},open:async(t,r,n,i)=>{let a=await this.superstate.spaceManager.readTable(t,r);if(r==Er){let o=this.superstate.spaceManager.resolvePath(a?.rows[n]?.[mt],t);this.superstate.ui.openPath(o,i)}},contextMenu:async(t,r,n,i)=>{let a=await this.superstate.spaceManager.readTable(r,n);if(n==Er){let o=a?.rows[i]?.[mt];Jp(this.superstate,o,r,{x:t.clientX,y:t.clientY,width:0,height:0},Ne(t.view.document))}else u9(t,this.superstate,r,n,i)}};this.context={select:(t,r)=>this.superstate.spaceManager.readTable(t,r).then(n=>n?.rows),update:(t,r,n,i)=>{let a=this.superstate.spacesIndex.get(t);a&&Ioe(this.superstate.spaceManager,r,n,i,a.space)},insert:async(t,r,n,i)=>{if(r==Er)za(this.superstate,this.superstate.spacesIndex.get(t),"md",n,!0).then(a=>{i&&pi(this.superstate,a,{...i,[mt]:a})});else{let a=await this.superstate.spaceManager.readTable(t,r);if(a){let o=a.cols.find(l=>l.primary=="true"),s=o?{...i,[o.name]:n}:i;this.table.insert(t,r,s)}}}};this.date={parse:t=>new Date(t?.replace(/-/g,"/").replace(/T.+/,"")),daysInMonth:t=>new Date(t.getFullYear(),t.getMonth()+1,0).getDate(),format:(t,r)=>_r(this.superstate,t,r??"yyyy-MM-dd"),component:(t,r)=>{if(r=="year")return t.getFullYear();if(r=="month")return t.getMonth()+1;if(r=="day")return t.getDate();if(r=="dayOfWeek")return t.getDay();if(r=="hour")return t.getHours();if(r=="minute")return t.getMinutes();if(r=="second")return t.getSeconds()},offset:(t,r,n)=>{let i=new Date(t);return n=="day"&&i.setDate(i.getDate()+r),n=="month"&&i.setMonth(i.getMonth()+r),n=="year"&&i.setFullYear(i.getFullYear()+r),i},now:()=>new Date,range:(t,r,n)=>{let i=[],a=new Date(t);for(;a<=r;)i.push(_r(this.superstate,a,n??"yyyy-MM-dd")),a.setDate(a.getDate()+1);return i}};this.superstate=t}};var fR=class{constructor(t,r){this.superstate=r;this.scheme="spaces";this.apiCommands={path:{open:{schema:{id:"path.open",name:"Open Path",type:"api"},fields:[{name:"path",type:"link"}]},create:{schema:{id:"path.create",name:"Create Item",type:"api"},fields:[{name:"name",type:"text"},{name:"space",type:"space"},{name:"content",type:"text"}]},setProperty:{schema:{id:"path.setProperty",name:"Save Property",type:"api"},fields:[{name:"path",type:"link"},{name:"property",type:"option",value:JSON.stringify({source:"$properties"})},{name:"value",type:"text"}]}},table:{select:{schema:{id:"table.select",name:"Get All List Items from Table",type:"api"},fields:[{name:"path",type:"link"},{name:"table",type:"text"}]},update:{schema:{id:"table.update",name:"Update List Item in Table",type:"api"},fields:[{name:"path",type:"link"},{name:"table",type:"text"},{name:"index",type:"number"},{name:"row",type:"object"}]},insert:{schema:{id:"table.insert",name:"Insert List Item into Table",type:"api"},fields:[{name:"path",type:"link"},{name:"schema",type:"text"},{name:"row",type:"object"}]}},context:{select:{schema:{id:"context.select",name:"Select Items from Context",type:"api"},fields:[{name:"path",type:"link"},{name:"table",type:"text"}]},update:{schema:{id:"context.update",name:"Update Item in Context",type:"api"},fields:[{name:"path",type:"space"},{name:"file",type:"link"},{name:"field",type:"text"},{name:"value",type:"text"}]},insert:{schema:{id:"context.insert",name:"Insert Item into Context",type:"api"},fields:[{name:"path",type:"link"},{name:"schema",type:"text"},{name:"name",type:"text"},{name:"row",type:"object"}]}}};this.manager=t}commandForAction(t){if(!t)return null;let r=cc(t);return r.authority=="$api"?this.apiCommands[r.path]?.[r.ref]:r.authority=="$actions"?this.superstate.actions.get(r.path)?.find(n=>n.schema.id==r.ref):this.superstate.actionsIndex.get(r.path)?.find(n=>n.schema.id==r.ref)}runCommand(t,r){let n=this.commandForAction(t),i,a;try{if(n.schema.type=="api"){let[o,s]=n.schema.id.split(".");i=this.superstate.api[o]?.[s]?.(...n.fields.map(l=>r.instanceProps[l.name]))}n.schema.type=="actions"&&(i=V5(this.superstate,n.code,r)),n.schema.type=="script"&&(i=ZS(n.code,r.instanceProps)),n.schema.type=="formula"&&(i=Pd(this.superstate.formulaContext,this.superstate.pathsIndex,this.superstate.spacesMap,n.code,n.fields.reduce((o,s)=>({...o,[s.name]:s}),{}),r.instanceProps))}catch(o){a=o}return console.log(i,a),i}allCommands(){let t=Object.keys(this.apiCommands).flatMap(n=>Object.keys(this.apiCommands[n]).map(i=>({scheme:"spaces",path:`spaces://$api/${n}/#;${i}`,...this.apiCommands[n][i]}))),r=[...this.superstate.actions.entries()].flatMap(n=>n[1].map(i=>({scheme:"spaces",path:`spaces://$api/${n[0]}/#;${i.schema.id}`,...i})));return[...t,...r]}};function vO(e,t){let r=new Blob([e],{type:"text/javascript"}),n=URL.createObjectURL(r),i=new Worker(n,t);return URL.revokeObjectURL(n),i}function QX(){return vO(`"use strict";var bq=Object.create;var yw=Object.defineProperty;var wq=Object.getOwnPropertyDescriptor;var Dq=Object.getOwnPropertyNames;var Sq=Object.getPrototypeOf,Nq=Object.prototype.hasOwnProperty;var Nn=(e,r)=>()=>(r||e((r={exports:{}}).exports,r),r.exports),Aq=(e,r)=>{for(var t in r)yw(e,t,{get:r[t],enumerable:!0})},Mq=(e,r,t,n)=>{if(r&&typeof r=="object"||typeof r=="function")for(let a of Dq(r))!Nq.call(e,a)&&a!==t&&yw(e,a,{get:()=>r[a],enumerable:!(n=wq(r,a))||n.enumerable});return e};var Aa=(e,r,t)=>(t=e!=null?bq(Sq(e)):{},Mq(r||!e||!e.__esModule?yw(t,"default",{value:e,enumerable:!0}):t,e));var LM=Nn((Rw,Zu)=>{(function(e,r){typeof Rw=="object"&&typeof Zu<"u"?Zu.exports=r():typeof define=="function"&&define.amd?define(r):e.moment=r()})(Rw,function(){"use strict";var e;function r(){return e.apply(null,arguments)}function t(g){e=g}function n(g){return g instanceof Array||Object.prototype.toString.call(g)==="[object Array]"}function a(g){return g!=null&&Object.prototype.toString.call(g)==="[object Object]"}function i(g,A){return Object.prototype.hasOwnProperty.call(g,A)}function s(g){if(Object.getOwnPropertyNames)return Object.getOwnPropertyNames(g).length===0;var A;for(A in g)if(i(g,A))return!1;return!0}function c(g){return g===void 0}function f(g){return typeof g=="number"||Object.prototype.toString.call(g)==="[object Number]"}function o(g){return g instanceof Date||Object.prototype.toString.call(g)==="[object Date]"}function u(g,A){var P=[],z,G=g.length;for(z=0;z>>0,z;for(z=0;z0)for(P=0;P=0;return(se?P?"+":"":"-")+Math.pow(10,Math.max(0,G)).toString().substr(1)+z}var U=/(\\[[^\\[]*\\])|(\\\\)?([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,oe=/(\\[[^\\[]*\\])|(\\\\)?(LTS|LT|LL?L?L?|l{1,4})/g,me={},ae={};function $(g,A,P,z){var G=z;typeof z=="string"&&(G=function(){return this[z]()}),g&&(ae[g]=G),A&&(ae[A[0]]=function(){return X(G.apply(this,arguments),A[1],A[2])}),P&&(ae[P]=function(){return this.localeData().ordinal(G.apply(this,arguments),g)})}function ce(g){return g.match(/\\[[\\s\\S]/)?g.replace(/^\\[|\\]$/g,""):g.replace(/\\\\/g,"")}function Ce(g){var A=g.match(U),P,z;for(P=0,z=A.length;P=0&&oe.test(g);)g=g.replace(oe,z),oe.lastIndex=0,P-=1;return g}var Se={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 ye(g){var A=this._longDateFormat[g],P=this._longDateFormat[g.toUpperCase()];return A||!P?A:(this._longDateFormat[g]=P.match(U).map(function(z){return z==="MMMM"||z==="MM"||z==="DD"||z==="dddd"?z.slice(1):z}).join(""),this._longDateFormat[g])}var be="Invalid date";function De(){return this._invalidDate}var Ae="%d",Ye=/\\d{1,2}/;function Ke(g){return this._ordinal.replace("%d",g)}var J={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 re(g,A,P,z){var G=this._relativeTime[P];return k(G)?G(g,A,P,z):G.replace(/%d/i,g)}function xe(g,A){var P=this._relativeTime[g>0?"future":"past"];return k(P)?P(A):P.replace(/%s/i,A)}var j={};function ne(g,A){var P=g.toLowerCase();j[P]=j[P+"s"]=j[A]=g}function ue(g){return typeof g=="string"?j[g]||j[g.toLowerCase()]:void 0}function Me(g){var A={},P,z;for(z in g)i(g,z)&&(P=ue(z),P&&(A[P]=g[z]));return A}var Ee={};function qe(g,A){Ee[g]=A}function Pe(g){var A=[],P;for(P in g)i(g,P)&&A.push({unit:P,priority:Ee[P]});return A.sort(function(z,G){return z.priority-G.priority}),A}function lr(g){return g%4===0&&g%100!==0||g%400===0}function sr(g){return g<0?Math.ceil(g)||0:Math.floor(g)}function Je(g){var A=+g,P=0;return A!==0&&isFinite(A)&&(P=sr(A)),P}function Pr(g,A){return function(P){return P!=null?(le(this,g,P),r.updateOffset(this,A),this):ee(this,g)}}function ee(g,A){return g.isValid()?g._d["get"+(g._isUTC?"UTC":"")+A]():NaN}function le(g,A,P){g.isValid()&&!isNaN(P)&&(A==="FullYear"&&lr(g.year())&&g.month()===1&&g.date()===29?(P=Je(P),g._d["set"+(g._isUTC?"UTC":"")+A](P,g.month(),Bo(P,g.month()))):g._d["set"+(g._isUTC?"UTC":"")+A](P))}function we(g){return g=ue(g),k(this[g])?this[g]():this}function Be(g,A){if(typeof g=="object"){g=Me(g);var P=Pe(g),z,G=P.length;for(z=0;z68?1900:2e3)};var bl=Pr("FullYear",!0);function v1(){return lr(this.year())}function kc(g,A,P,z,G,se,_e){var hr;return g<100&&g>=0?(hr=new Date(g+400,A,P,z,G,se,_e),isFinite(hr.getFullYear())&&hr.setFullYear(g)):hr=new Date(g,A,P,z,G,se,_e),hr}function Io(g){var A,P;return g<100&&g>=0?(P=Array.prototype.slice.call(arguments),P[0]=g+400,A=new Date(Date.UTC.apply(null,P)),isFinite(A.getUTCFullYear())&&A.setUTCFullYear(g)):A=new Date(Date.UTC.apply(null,arguments)),A}function Po(g,A,P){var z=7+A-P,G=(7+Io(g,0,z).getUTCDay()-A)%7;return-G+z-1}function Lc(g,A,P,z,G){var se=(7+P-z)%7,_e=Po(g,z,G),hr=1+7*(A-1)+se+_e,Br,st;return hr<=0?(Br=g-1,st=Fi(Br)+hr):hr>Fi(g)?(Br=g+1,st=hr-Fi(g)):(Br=g,st=hr),{year:Br,dayOfYear:st}}function Ro(g,A,P){var z=Po(g.year(),A,P),G=Math.floor((g.dayOfYear()-z-1)/7)+1,se,_e;return G<1?(_e=g.year()-1,se=G+ya(_e,A,P)):G>ya(g.year(),A,P)?(se=G-ya(g.year(),A,P),_e=g.year()+1):(_e=g.year(),se=G),{week:se,year:_e}}function ya(g,A,P){var z=Po(g,A,P),G=Po(g+1,A,P);return(Fi(g)-z+G)/7}$("w",["ww",2],"wo","week"),$("W",["WW",2],"Wo","isoWeek"),ne("week","w"),ne("isoWeek","W"),qe("week",5),qe("isoWeek",5),ar("w",Q),ar("ww",Q,Te),ar("W",Q),ar("WW",Q,Te),eo(["w","ww","W","WW"],function(g,A,P,z){A[z.substr(0,1)]=Je(g)});function wl(g){return Ro(g,this._week.dow,this._week.doy).week}var ko={dow:0,doy:6};function qc(){return this._week.dow}function Uc(){return this._week.doy}function g1(g){var A=this.localeData().week(this);return g==null?A:this.add((g-A)*7,"d")}function zc(g){var A=Ro(this,1,4).week;return g==null?A:this.add((g-A)*7,"d")}$("d",0,"do","day"),$("dd",0,0,function(g){return this.localeData().weekdaysMin(this,g)}),$("ddd",0,0,function(g){return this.localeData().weekdaysShort(this,g)}),$("dddd",0,0,function(g){return this.localeData().weekdays(this,g)}),$("e",0,0,"weekday"),$("E",0,0,"isoWeekday"),ne("day","d"),ne("weekday","e"),ne("isoWeekday","E"),qe("day",11),qe("weekday",11),qe("isoWeekday",11),ar("d",Q),ar("e",Q),ar("E",Q),ar("dd",function(g,A){return A.weekdaysMinRegex(g)}),ar("ddd",function(g,A){return A.weekdaysShortRegex(g)}),ar("dddd",function(g,A){return A.weekdaysRegex(g)}),eo(["dd","ddd","dddd"],function(g,A,P,z){var G=P._locale.weekdaysParse(g,z,P._strict);G!=null?A.d=G:y(P).invalidWeekday=g}),eo(["d","e","E"],function(g,A,P,z){A[z]=Je(g)});function Yc(g,A){return typeof g!="string"?g:isNaN(g)?(g=A.weekdaysParse(g),typeof g=="number"?g:null):parseInt(g,10)}function Wc(g,A){return typeof g=="string"?A.weekdaysParse(g)%7||7:isNaN(g)?null:g}function bu(g,A){return g.slice(A,7).concat(g.slice(0,A))}var y1="Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),Hc="Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_"),x1="Su_Mo_Tu_We_Th_Fr_Sa".split("_"),$c=ui,b1=ui,w1=ui;function D1(g,A){var P=n(this._weekdays)?this._weekdays:this._weekdays[g&&g!==!0&&this._weekdays.isFormat.test(A)?"format":"standalone"];return g===!0?bu(P,this._week.dow):g?P[g.day()]:P}function S1(g){return g===!0?bu(this._weekdaysShort,this._week.dow):g?this._weekdaysShort[g.day()]:this._weekdaysShort}function Dl(g){return g===!0?bu(this._weekdaysMin,this._week.dow):g?this._weekdaysMin[g.day()]:this._weekdaysMin}function N1(g,A,P){var z,G,se,_e=g.toLocaleLowerCase();if(!this._weekdaysParse)for(this._weekdaysParse=[],this._shortWeekdaysParse=[],this._minWeekdaysParse=[],z=0;z<7;++z)se=p([2e3,1]).day(z),this._minWeekdaysParse[z]=this.weekdaysMin(se,"").toLocaleLowerCase(),this._shortWeekdaysParse[z]=this.weekdaysShort(se,"").toLocaleLowerCase(),this._weekdaysParse[z]=this.weekdays(se,"").toLocaleLowerCase();return P?A==="dddd"?(G=wt.call(this._weekdaysParse,_e),G!==-1?G:null):A==="ddd"?(G=wt.call(this._shortWeekdaysParse,_e),G!==-1?G:null):(G=wt.call(this._minWeekdaysParse,_e),G!==-1?G:null):A==="dddd"?(G=wt.call(this._weekdaysParse,_e),G!==-1||(G=wt.call(this._shortWeekdaysParse,_e),G!==-1)?G:(G=wt.call(this._minWeekdaysParse,_e),G!==-1?G:null)):A==="ddd"?(G=wt.call(this._shortWeekdaysParse,_e),G!==-1||(G=wt.call(this._weekdaysParse,_e),G!==-1)?G:(G=wt.call(this._minWeekdaysParse,_e),G!==-1?G:null)):(G=wt.call(this._minWeekdaysParse,_e),G!==-1||(G=wt.call(this._weekdaysParse,_e),G!==-1)?G:(G=wt.call(this._shortWeekdaysParse,_e),G!==-1?G:null))}function A1(g,A,P){var z,G,se;if(this._weekdaysParseExact)return N1.call(this,g,A,P);for(this._weekdaysParse||(this._weekdaysParse=[],this._minWeekdaysParse=[],this._shortWeekdaysParse=[],this._fullWeekdaysParse=[]),z=0;z<7;z++){if(G=p([2e3,1]).day(z),P&&!this._fullWeekdaysParse[z]&&(this._fullWeekdaysParse[z]=new RegExp("^"+this.weekdays(G,"").replace(".","\\\\.?")+"$","i"),this._shortWeekdaysParse[z]=new RegExp("^"+this.weekdaysShort(G,"").replace(".","\\\\.?")+"$","i"),this._minWeekdaysParse[z]=new RegExp("^"+this.weekdaysMin(G,"").replace(".","\\\\.?")+"$","i")),this._weekdaysParse[z]||(se="^"+this.weekdays(G,"")+"|^"+this.weekdaysShort(G,"")+"|^"+this.weekdaysMin(G,""),this._weekdaysParse[z]=new RegExp(se.replace(".",""),"i")),P&&A==="dddd"&&this._fullWeekdaysParse[z].test(g))return z;if(P&&A==="ddd"&&this._shortWeekdaysParse[z].test(g))return z;if(P&&A==="dd"&&this._minWeekdaysParse[z].test(g))return z;if(!P&&this._weekdaysParse[z].test(g))return z}}function M1(g){if(!this.isValid())return g!=null?this:NaN;var A=this._isUTC?this._d.getUTCDay():this._d.getDay();return g!=null?(g=Yc(g,this.localeData()),this.add(g-A,"d")):A}function E1(g){if(!this.isValid())return g!=null?this:NaN;var A=(this.day()+7-this.localeData()._week.dow)%7;return g==null?A:this.add(g-A,"d")}function C1(g){if(!this.isValid())return g!=null?this:NaN;if(g!=null){var A=Wc(g,this.localeData());return this.day(this.day()%7?A:A-7)}else return this.day()||7}function Nt(g){return this._weekdaysParseExact?(i(this,"_weekdaysRegex")||Sl.call(this),g?this._weekdaysStrictRegex:this._weekdaysRegex):(i(this,"_weekdaysRegex")||(this._weekdaysRegex=$c),this._weekdaysStrictRegex&&g?this._weekdaysStrictRegex:this._weekdaysRegex)}function Dt(g){return this._weekdaysParseExact?(i(this,"_weekdaysRegex")||Sl.call(this),g?this._weekdaysShortStrictRegex:this._weekdaysShortRegex):(i(this,"_weekdaysShortRegex")||(this._weekdaysShortRegex=b1),this._weekdaysShortStrictRegex&&g?this._weekdaysShortStrictRegex:this._weekdaysShortRegex)}function T1(g){return this._weekdaysParseExact?(i(this,"_weekdaysRegex")||Sl.call(this),g?this._weekdaysMinStrictRegex:this._weekdaysMinRegex):(i(this,"_weekdaysMinRegex")||(this._weekdaysMinRegex=w1),this._weekdaysMinStrictRegex&&g?this._weekdaysMinStrictRegex:this._weekdaysMinRegex)}function Sl(){function g(Sn,Wa){return Wa.length-Sn.length}var A=[],P=[],z=[],G=[],se,_e,hr,Br,st;for(se=0;se<7;se++)_e=p([2e3,1]).day(se),hr=bn(this.weekdaysMin(_e,"")),Br=bn(this.weekdaysShort(_e,"")),st=bn(this.weekdays(_e,"")),A.push(hr),P.push(Br),z.push(st),G.push(hr),G.push(Br),G.push(st);A.sort(g),P.sort(g),z.sort(g),G.sort(g),this._weekdaysRegex=new RegExp("^("+G.join("|")+")","i"),this._weekdaysShortRegex=this._weekdaysRegex,this._weekdaysMinRegex=this._weekdaysRegex,this._weekdaysStrictRegex=new RegExp("^("+z.join("|")+")","i"),this._weekdaysShortStrictRegex=new RegExp("^("+P.join("|")+")","i"),this._weekdaysMinStrictRegex=new RegExp("^("+A.join("|")+")","i")}function Nl(){return this.hours()%12||12}function _1(){return this.hours()||24}$("H",["HH",2],0,"hour"),$("h",["hh",2],0,Nl),$("k",["kk",2],0,_1),$("hmm",0,0,function(){return""+Nl.apply(this)+X(this.minutes(),2)}),$("hmmss",0,0,function(){return""+Nl.apply(this)+X(this.minutes(),2)+X(this.seconds(),2)}),$("Hmm",0,0,function(){return""+this.hours()+X(this.minutes(),2)}),$("Hmmss",0,0,function(){return""+this.hours()+X(this.minutes(),2)+X(this.seconds(),2)});function Gc(g,A){$(g,0,0,function(){return this.localeData().meridiem(this.hours(),this.minutes(),A)})}Gc("a",!0),Gc("A",!1),ne("hour","h"),qe("hour",13);function Vc(g,A){return A._meridiemParse}ar("a",Vc),ar("A",Vc),ar("H",Q),ar("h",Q),ar("k",Q),ar("HH",Q,Te),ar("hh",Q,Te),ar("kk",Q,Te),ar("hmm",ve),ar("hmmss",Ie),ar("Hmm",ve),ar("Hmmss",Ie),ct(["H","HH"],Pt),ct(["k","kk"],function(g,A,P){var z=Je(g);A[Pt]=z===24?0:z}),ct(["a","A"],function(g,A,P){P._isPm=P._locale.isPM(g),P._meridiem=g}),ct(["h","hh"],function(g,A,P){A[Pt]=Je(g),y(P).bigHour=!0}),ct("hmm",function(g,A,P){var z=g.length-2;A[Pt]=Je(g.substr(0,z)),A[Gn]=Je(g.substr(z)),y(P).bigHour=!0}),ct("hmmss",function(g,A,P){var z=g.length-4,G=g.length-2;A[Pt]=Je(g.substr(0,z)),A[Gn]=Je(g.substr(z,2)),A[ga]=Je(g.substr(G)),y(P).bigHour=!0}),ct("Hmm",function(g,A,P){var z=g.length-2;A[Pt]=Je(g.substr(0,z)),A[Gn]=Je(g.substr(z))}),ct("Hmmss",function(g,A,P){var z=g.length-4,G=g.length-2;A[Pt]=Je(g.substr(0,z)),A[Gn]=Je(g.substr(z,2)),A[ga]=Je(g.substr(G))});function Zc(g){return(g+"").toLowerCase().charAt(0)==="p"}var F1=/[ap]\\.?m?\\.?/i,en=Pr("Hours",!0);function Al(g,A,P){return g>11?P?"pm":"PM":P?"am":"AM"}var Oi={calendar:q,longDateFormat:Se,invalidDate:be,ordinal:Ae,dayOfMonthOrdinalParse:Ye,relativeTime:J,months:vl,monthsShort:vu,week:ko,weekdays:y1,weekdaysMin:x1,weekdaysShort:Hc,meridiemParse:F1},At={},to={},hn;function Qc(g,A){var P,z=Math.min(g.length,A.length);for(P=0;P0;){if(G=As(se.slice(0,P).join("-")),G)return G;if(z&&z.length>=P&&Qc(se,z)>=P-1)break;P--}A++}return hn}function Kc(g){return g.match("^[^/\\\\\\\\]*$")!=null}function As(g){var A=null,P;if(At[g]===void 0&&typeof Zu<"u"&&Zu&&Zu.exports&&Kc(g))try{A=hn._abbr,P=require,P("./locale/"+g),ci(A)}catch{At[g]=null}return At[g]}function ci(g,A){var P;return g&&(c(A)?P=zt(g):P=wn(g,A),P?hn=P:typeof console<"u"&&console.warn&&console.warn("Locale "+g+" not found. Did you forget to load it?")),hn._abbr}function wn(g,A){if(A!==null){var P,z=Oi;if(A.abbr=g,At[g]!=null)T("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."),z=At[g]._config;else if(A.parentLocale!=null)if(At[A.parentLocale]!=null)z=At[A.parentLocale]._config;else if(P=As(A.parentLocale),P!=null)z=P._config;else return to[A.parentLocale]||(to[A.parentLocale]=[]),to[A.parentLocale].push({name:g,config:A}),null;return At[g]=new V(H(z,A)),to[g]&&to[g].forEach(function(G){wn(G.name,G.config)}),ci(g),At[g]}else return delete At[g],null}function O1(g,A){if(A!=null){var P,z,G=Oi;At[g]!=null&&At[g].parentLocale!=null?At[g].set(H(At[g]._config,A)):(z=As(g),z!=null&&(G=z._config),A=H(G,A),z==null&&(A.abbr=g),P=new V(A),P.parentLocale=At[g],At[g]=P),ci(g)}else At[g]!=null&&(At[g].parentLocale!=null?(At[g]=At[g].parentLocale,g===ci()&&ci(g)):At[g]!=null&&delete At[g]);return At[g]}function zt(g){var A;if(g&&g._locale&&g._locale._abbr&&(g=g._locale._abbr),!g)return hn;if(!n(g)){if(A=As(g),A)return A;g=[g]}return Xc(g)}function B1(){return W(At)}function wu(g){var A,P=g._a;return P&&y(g).overflow===-2&&(A=P[ra]<0||P[ra]>11?ra:P[ta]<1||P[ta]>Bo(P[jt],P[ra])?ta:P[Pt]<0||P[Pt]>24||P[Pt]===24&&(P[Gn]!==0||P[ga]!==0||P[fi]!==0)?Pt:P[Gn]<0||P[Gn]>59?Gn:P[ga]<0||P[ga]>59?ga:P[fi]<0||P[fi]>999?fi:-1,y(g)._overflowDayOfYear&&(Ata)&&(A=ta),y(g)._overflowWeeks&&A===-1&&(A=dl),y(g)._overflowWeekday&&A===-1&&(A=Oo),y(g).overflow=A),g}var Bi=/^\\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)?)?$/,Du=/^\\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)?)?$/,El=/Z|[+-]\\d\\d(?::?\\d\\d)?/,xt=[["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]],La=[["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/]],Cl=/^\\/?Date\\((-?\\d+)/i,I1=/^(?:(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:-4*60,EST:-5*60,CDT:-5*60,CST:-6*60,MDT:-6*60,MST:-7*60,PDT:-7*60,PST:-8*60};function Jc(g){var A,P,z=g._i,G=Bi.exec(z)||Du.exec(z),se,_e,hr,Br,st=xt.length,Sn=La.length;if(G){for(y(g).iso=!0,A=0,P=st;AFi(_e)||g._dayOfYear===0)&&(y(g)._overflowDayOfYear=!0),P=Io(_e,0,g._dayOfYear),g._a[ra]=P.getUTCMonth(),g._a[ta]=P.getUTCDate()),A=0;A<3&&g._a[A]==null;++A)g._a[A]=z[A]=G[A];for(;A<7;A++)g._a[A]=z[A]=g._a[A]==null?A===2?1:0:g._a[A];g._a[Pt]===24&&g._a[Gn]===0&&g._a[ga]===0&&g._a[fi]===0&&(g._nextDay=!0,g._a[Pt]=0),g._d=(g._useUTC?Io:kc).apply(null,z),se=g._useUTC?g._d.getUTCDay():g._d.getDay(),g._tzm!=null&&g._d.setUTCMinutes(g._d.getUTCMinutes()-g._tzm),g._nextDay&&(g._a[Pt]=24),g._w&&typeof g._w.d<"u"&&g._w.d!==se&&(y(g).weekdayMismatch=!0)}}function tm(g){var A,P,z,G,se,_e,hr,Br,st;A=g._w,A.GG!=null||A.W!=null||A.E!=null?(se=1,_e=4,P=no(A.GG,g._a[jt],Ro(St(),1,4).year),z=no(A.W,1),G=no(A.E,1),(G<1||G>7)&&(Br=!0)):(se=g._locale._week.dow,_e=g._locale._week.doy,st=Ro(St(),se,_e),P=no(A.gg,g._a[jt],st.year),z=no(A.w,st.week),A.d!=null?(G=A.d,(G<0||G>6)&&(Br=!0)):A.e!=null?(G=A.e+se,(A.e<0||A.e>6)&&(Br=!0)):G=se),z<1||z>ya(P,se,_e)?y(g)._overflowWeeks=!0:Br!=null?y(g)._overflowWeekday=!0:(hr=Lc(P,z,G,se,_e),g._a[jt]=hr.year,g._dayOfYear=hr.dayOfYear)}r.ISO_8601=function(){},r.RFC_2822=function(){};function Fl(g){if(g._f===r.ISO_8601){Jc(g);return}if(g._f===r.RFC_2822){em(g);return}g._a=[],y(g).empty=!0;var A=""+g._i,P,z,G,se,_e,hr=A.length,Br=0,st,Sn;for(G=ge(g._f,g._locale).match(U)||[],Sn=G.length,P=0;P0&&y(g).unusedInput.push(_e),A=A.slice(A.indexOf(z)+z.length),Br+=z.length),ae[se]?(z?y(g).empty=!1:y(g).unusedTokens.push(se),pl(se,z,g)):g._strict&&!z&&y(g).unusedTokens.push(se);y(g).charsLeftOver=hr-Br,A.length>0&&y(g).unusedInput.push(A),g._a[Pt]<=12&&y(g).bigHour===!0&&g._a[Pt]>0&&(y(g).bigHour=void 0),y(g).parsedDateParts=g._a.slice(0),y(g).meridiem=g._meridiem,g._a[Pt]=Ol(g._locale,g._a[Pt],g._meridiem),st=y(g).era,st!==null&&(g._a[jt]=g._locale.erasConvertYear(st,g._a[jt])),Ms(g),wu(g)}function Ol(g,A,P){var z;return P==null?A:g.meridiemHour!=null?g.meridiemHour(A,P):(g.isPM!=null&&(z=g.isPM(P),z&&A<12&&(A+=12),!z&&A===12&&(A=0)),A)}function Bl(g){var A,P,z,G,se,_e,hr=!1,Br=g._f.length;if(Br===0){y(g).invalidFormat=!0,g._d=new Date(NaN);return}for(G=0;Gthis?this:g:b()});function im(g,A){var P,z;if(A.length===1&&n(A[0])&&(A=A[0]),!A.length)return St();for(P=A[0],z=1;zthis.clone().month(0).utcOffset()||this.utcOffset()>this.clone().month(5).utcOffset()}function Fe(){if(!c(this._isDSTShifted))return this._isDSTShifted;var g={},A;return N(g,this),g=Fn(g),g._a?(A=g._isUTC?p(g._a):St(g._a),this._isDSTShifted=this.isValid()&&H1(g._a,A.toArray())>0):this._isDSTShifted=!1,this._isDSTShifted}function Ne(){return this.isValid()?!this._isUTC:!1}function or(){return this.isValid()?this._isUTC:!1}function Er(){return this.isValid()?this._isUTC&&this._offset===0:!1}var ot=/^(-|\\+)?(?:(\\d*)[. ])?(\\d+):(\\d+)(?::(\\d+)(\\.\\d*)?)?$/,Gt=/^(-|\\+)?P(?:([-+]?[0-9,.]*)Y)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)W)?(?:([-+]?[0-9,.]*)D)?(?:T(?:([-+]?[0-9,.]*)H)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)S)?)?$/;function zr(g,A){var P=g,z=null,G,se,_e;return xa(g)?P={ms:g._milliseconds,d:g._days,M:g._months}:f(g)||!isNaN(+g)?(P={},A?P[A]=+g:P.milliseconds=+g):(z=ot.exec(g))?(G=z[1]==="-"?-1:1,P={y:0,d:Je(z[ta])*G,h:Je(z[Pt])*G,m:Je(z[Gn])*G,s:Je(z[ga])*G,ms:Je(Uo(z[fi]*1e3))*G}):(z=Gt.exec(g))?(G=z[1]==="-"?-1:1,P={y:mi(z[2],G),M:mi(z[3],G),w:mi(z[4],G),d:mi(z[5],G),h:mi(z[6],G),m:mi(z[7],G),s:mi(z[8],G)}):P==null?P={}:typeof P=="object"&&("from"in P||"to"in P)&&(_e=na(St(P.from),St(P.to)),P={},P.ms=_e.milliseconds,P.M=_e.months),se=new Es(P),xa(g)&&i(g,"_locale")&&(se._locale=g._locale),xa(g)&&i(g,"_isValid")&&(se._isValid=g._isValid),se}zr.fn=Es.prototype,zr.invalid=Pl;function mi(g,A){var P=g&&parseFloat(g.replace(",","."));return(isNaN(P)?0:P)*A}function sm(g,A){var P={};return P.months=A.month()-g.month()+(A.year()-g.year())*12,g.clone().add(P.months,"M").isAfter(A)&&--P.months,P.milliseconds=+A-+g.clone().add(P.months,"M"),P}function na(g,A){var P;return g.isValid()&&A.isValid()?(A=Vn(A,g),g.isBefore(A)?P=sm(g,A):(P=sm(A,g),P.milliseconds=-P.milliseconds,P.months=-P.months),P):{milliseconds:0,months:0}}function Cs(g,A){return function(P,z){var G,se;return z!==null&&!isNaN(+z)&&(T(A,"moment()."+A+"(period, number) is deprecated. Please use moment()."+A+"(number, period). See http://momentjs.com/guides/#/warnings/add-inverted-param/ for more info."),se=P,P=z,z=se),G=zr(P,z),um(this,G,g),this}}function um(g,A,P,z){var G=A._milliseconds,se=Uo(A._days),_e=Uo(A._months);!g.isValid()||(z=z??!0,_e&&_i(g,ee(g,"Month")+_e*P),se&&le(g,"Date",ee(g,"Date")+se*P),G&&g._d.setTime(g._d.valueOf()+G*P),z&&r.updateOffset(g,se||_e))}var zo=Cs(1,"add"),Au=Cs(-1,"subtract");function Ts(g){return typeof g=="string"||g instanceof String}function pt(g){return D(g)||o(g)||Ts(g)||f(g)||fm(g)||K1(g)||g===null||g===void 0}function K1(g){var A=a(g)&&!s(g),P=!1,z=["years","year","y","months","month","M","days","day","d","dates","date","D","hours","hour","h","minutes","minute","m","seconds","second","s","milliseconds","millisecond","ms"],G,se,_e=z.length;for(G=0;G<_e;G+=1)se=z[G],P=P||i(g,se);return A&&P}function fm(g){var A=n(g),P=!1;return A&&(P=g.filter(function(z){return!f(z)&&Ts(g)}).length===0),A&&P}function Mu(g){var A=a(g)&&!s(g),P=!1,z=["sameDay","nextDay","lastDay","nextWeek","lastWeek","sameElse"],G,se;for(G=0;GP.valueOf():P.valueOf()9999?pe(P,A?"YYYYYY-MM-DD[T]HH:mm:ss.SSS[Z]":"YYYYYY-MM-DD[T]HH:mm:ss.SSSZ"):k(Date.prototype.toISOString)?A?this.toDate().toISOString():new Date(this.valueOf()+this.utcOffset()*60*1e3).toISOString().replace("Z",pe(P,"Z")):pe(P,A?"YYYY-MM-DD[T]HH:mm:ss.SSS[Z]":"YYYY-MM-DD[T]HH:mm:ss.SSSZ")}function io(){if(!this.isValid())return"moment.invalid(/* "+this._i+" */)";var g="moment",A="",P,z,G,se;return this.isLocal()||(g=this.utcOffset()===0?"moment.utc":"moment.parseZone",A="Z"),P="["+g+'("]',z=0<=this.year()&&this.year()<=9999?"YYYY":"YYYYYY",G="-MM-DD[T]HH:mm:ss.SSS",se=A+'[")]',this.format(P+z+G+se)}function _u(g){g||(g=this.isUtc()?r.defaultFormatUtc:r.defaultFormat);var A=pe(this,g);return this.localeData().postformat(A)}function rb(g,A){return this.isValid()&&(D(g)&&g.isValid()||St(g).isValid())?zr({to:this,from:g}).locale(this.locale()).humanize(!A):this.localeData().invalidDate()}function tb(g){return this.from(St(),g)}function nb(g,A){return this.isValid()&&(D(g)&&g.isValid()||St(g).isValid())?zr({from:this,to:g}).locale(this.locale()).humanize(!A):this.localeData().invalidDate()}function Fu(g){return this.to(St(),g)}function Fs(g){var A;return g===void 0?this._locale._abbr:(A=zt(g),A!=null&&(this._locale=A),this)}var Ou=_("moment().lang() is deprecated. Instead, use moment().localeData() to get the language configuration. Use moment().locale() to change languages.",function(g){return g===void 0?this.localeData():this.locale(g)});function dm(){return this._locale}var Os=1e3,Yo=60*Os,Bu=60*Yo,Yt=(365*400+97)*24*Bu;function Rt(g,A){return(g%A+A)%A}function hm(g,A,P){return g<100&&g>=0?new Date(g+400,A,P)-Yt:new Date(g,A,P).valueOf()}function vm(g,A,P){return g<100&&g>=0?Date.UTC(g+400,A,P)-Yt:Date.UTC(g,A,P)}function gm(g){var A,P;if(g=ue(g),g===void 0||g==="millisecond"||!this.isValid())return this;switch(P=this._isUTC?vm:hm,g){case"year":A=P(this.year(),0,1);break;case"quarter":A=P(this.year(),this.month()-this.month()%3,1);break;case"month":A=P(this.year(),this.month(),1);break;case"week":A=P(this.year(),this.month(),this.date()-this.weekday());break;case"isoWeek":A=P(this.year(),this.month(),this.date()-(this.isoWeekday()-1));break;case"day":case"date":A=P(this.year(),this.month(),this.date());break;case"hour":A=this._d.valueOf(),A-=Rt(A+(this._isUTC?0:this.utcOffset()*Yo),Bu);break;case"minute":A=this._d.valueOf(),A-=Rt(A,Yo);break;case"second":A=this._d.valueOf(),A-=Rt(A,Os);break}return this._d.setTime(A),r.updateOffset(this,!0),this}function ab(g){var A,P;if(g=ue(g),g===void 0||g==="millisecond"||!this.isValid())return this;switch(P=this._isUTC?vm:hm,g){case"year":A=P(this.year()+1,0,1)-1;break;case"quarter":A=P(this.year(),this.month()-this.month()%3+3,1)-1;break;case"month":A=P(this.year(),this.month()+1,1)-1;break;case"week":A=P(this.year(),this.month(),this.date()-this.weekday()+7)-1;break;case"isoWeek":A=P(this.year(),this.month(),this.date()-(this.isoWeekday()-1)+7)-1;break;case"day":case"date":A=P(this.year(),this.month(),this.date()+1)-1;break;case"hour":A=this._d.valueOf(),A+=Bu-Rt(A+(this._isUTC?0:this.utcOffset()*Yo),Bu)-1;break;case"minute":A=this._d.valueOf(),A+=Yo-Rt(A,Yo)-1;break;case"second":A=this._d.valueOf(),A+=Os-Rt(A,Os)-1;break}return this._d.setTime(A),r.updateOffset(this,!0),this}function Rl(){return this._d.valueOf()-(this._offset||0)*6e4}function Bs(){return Math.floor(this.valueOf()/1e3)}function kl(){return new Date(this.valueOf())}function Wo(){var g=this;return[g.year(),g.month(),g.date(),g.hour(),g.minute(),g.second(),g.millisecond()]}function Is(){var g=this;return{years:g.year(),months:g.month(),date:g.date(),hours:g.hours(),minutes:g.minutes(),seconds:g.seconds(),milliseconds:g.milliseconds()}}function Ps(){return this.isValid()?this.toISOString():null}function Iu(){return x(this)}function Ho(){return m({},y(this))}function ib(){return y(this).overflow}function ob(){return{input:this._i,format:this._f,locale:this._locale,isUTC:this._isUTC,strict:this._strict}}$("N",0,0,"eraAbbr"),$("NN",0,0,"eraAbbr"),$("NNN",0,0,"eraAbbr"),$("NNNN",0,0,"eraName"),$("NNNNN",0,0,"eraNarrow"),$("y",["y",1],"yo","eraYear"),$("y",["yy",2],0,"eraYear"),$("y",["yyy",3],0,"eraYear"),$("y",["yyyy",4],0,"eraYear"),ar("N",Lr),ar("NN",Lr),ar("NNN",Lr),ar("NNNN",lb),ar("NNNNN",cb),ct(["N","NN","NNN","NNNN","NNNNN"],function(g,A,P,z){var G=P._locale.erasParse(g,z,P._strict);G?y(P).era=G:y(P).invalidEra=g}),ar("y",Ut),ar("yy",Ut),ar("yyy",Ut),ar("yyyy",Ut),ar("yo",mb),ct(["y","yy","yyy","yyyy"],jt),ct(["yo"],function(g,A,P,z){var G;P._locale._eraYearOrdinalRegex&&(G=g.match(P._locale._eraYearOrdinalRegex)),P._locale.eraYearOrdinalParse?A[jt]=P._locale.eraYearOrdinalParse(g,G):A[jt]=parseInt(g,10)});function sb(g,A){var P,z,G,se=this._eras||zt("en")._eras;for(P=0,z=se.length;P=0)return se[z]}function fb(g,A){var P=g.since<=g.until?1:-1;return A===void 0?r(g.since).year():r(g.since).year()+(A-g.offset)*P}function Pu(){var g,A,P,z=this.localeData().eras();for(g=0,A=z.length;gse&&(A=se),yb.call(this,g,A,P,z,G))}function yb(g,A,P,z,G){var se=Lc(g,A,P,z,G),_e=Io(se.year,0,se.dayOfYear);return this.year(_e.getUTCFullYear()),this.month(_e.getUTCMonth()),this.date(_e.getUTCDate()),this}$("Q",0,"Qo","quarter"),ne("quarter","Q"),qe("quarter",7),ar("Q",ke),ct("Q",function(g,A){A[ra]=(Je(g)-1)*3});function xb(g){return g==null?Math.ceil((this.month()+1)/3):this.month((g-1)*3+this.month()%3)}$("D",["DD",2],"Do","date"),ne("date","D"),qe("date",9),ar("D",Q),ar("DD",Q,Te),ar("Do",function(g,A){return g?A._dayOfMonthOrdinalParse||A._ordinalParse:A._dayOfMonthOrdinalParseLenient}),ct(["D","DD"],ta),ct("Do",function(g,A){A[ta]=Je(g.match(Q)[0])});var bm=Pr("Date",!0);$("DDD",["DDDD",3],"DDDo","dayOfYear"),ne("dayOfYear","DDD"),qe("dayOfYear",4),ar("DDD",nr),ar("DDDD",Re),ct(["DDD","DDDD"],function(g,A,P){P._dayOfYear=Je(g)});function hi(g){var A=Math.round((this.clone().startOf("day")-this.clone().startOf("year"))/864e5)+1;return g==null?A:this.add(g-A,"d")}$("m",["mm",2],0,"minute"),ne("minute","m"),qe("minute",14),ar("m",Q),ar("mm",Q,Te),ct(["m","mm"],Gn);var bb=Pr("Minutes",!1);$("s",["ss",2],0,"second"),ne("second","s"),qe("second",15),ar("s",Q),ar("ss",Q,Te),ct(["s","ss"],ga);var wb=Pr("Seconds",!1);$("S",0,0,function(){return~~(this.millisecond()/100)}),$(0,["SS",2],0,function(){return~~(this.millisecond()/10)}),$(0,["SSS",3],0,"millisecond"),$(0,["SSSS",4],0,function(){return this.millisecond()*10}),$(0,["SSSSS",5],0,function(){return this.millisecond()*100}),$(0,["SSSSSS",6],0,function(){return this.millisecond()*1e3}),$(0,["SSSSSSS",7],0,function(){return this.millisecond()*1e4}),$(0,["SSSSSSSS",8],0,function(){return this.millisecond()*1e5}),$(0,["SSSSSSSSS",9],0,function(){return this.millisecond()*1e6}),ne("millisecond","ms"),qe("millisecond",16),ar("S",nr,ke),ar("SS",nr,Te),ar("SSS",nr,Re);var ki,wm;for(ki="SSSS";ki.length<=9;ki+="S")ar(ki,Ut);function Db(g,A){A[fi]=Je(("0."+g)*1e3)}for(ki="S";ki.length<=9;ki+="S")ct(ki,Db);wm=Pr("Milliseconds",!1),$("z",0,0,"zoneAbbr"),$("zz",0,0,"zoneName");function oo(){return this._isUTC?"UTC":""}function Sb(){return this._isUTC?"Coordinated Universal Time":""}var Ve=M.prototype;Ve.add=zo,Ve.calendar=j1,Ve.clone=eb,Ve.diff=mm,Ve.endOf=ab,Ve.format=_u,Ve.from=rb,Ve.fromNow=tb,Ve.to=nb,Ve.toNow=Fu,Ve.get=we,Ve.invalidAt=ib,Ve.isAfter=Eu,Ve.isBefore=Ri,Ve.isBetween=Cu,Ve.isSame=lm,Ve.isSameOrAfter=Tu,Ve.isSameOrBefore=cm,Ve.isValid=Iu,Ve.lang=Ou,Ve.locale=Fs,Ve.localeData=dm,Ve.max=L1,Ve.min=am,Ve.parsingFlags=Ho,Ve.set=Be,Ve.startOf=gm,Ve.subtract=Au,Ve.toArray=Wo,Ve.toObject=Is,Ve.toDate=kl,Ve.toISOString=_s,Ve.inspect=io,typeof Symbol<"u"&&Symbol.for!=null&&(Ve[Symbol.for("nodejs.util.inspect.custom")]=function(){return"Moment<"+this.format()+">"}),Ve.toJSON=Ps,Ve.toString=pm,Ve.unix=Bs,Ve.valueOf=Rl,Ve.creationData=ob,Ve.eraName=Pu,Ve.eraNarrow=Rs,Ve.eraAbbr=ym,Ve.eraYear=Z,Ve.year=bl,Ve.isLeapYear=v1,Ve.weekYear=pb,Ve.isoWeekYear=db,Ve.quarter=Ve.quarters=xb,Ve.month=li,Ve.daysInMonth=xu,Ve.week=Ve.weeks=g1,Ve.isoWeek=Ve.isoWeeks=zc,Ve.weeksInYear=di,Ve.weeksInWeekYear=gb,Ve.isoWeeksInYear=hb,Ve.isoWeeksInISOWeekYear=vb,Ve.date=bm,Ve.day=Ve.days=M1,Ve.weekday=E1,Ve.isoWeekday=C1,Ve.dayOfYear=hi,Ve.hour=Ve.hours=en,Ve.minute=Ve.minutes=bb,Ve.second=Ve.seconds=wb,Ve.millisecond=Ve.milliseconds=wm,Ve.utcOffset=G1,Ve.utc=Z1,Ve.local=Q1,Ve.parseZone=X1,Ve.hasAlignedHourOffset=Pi,Ve.isDST=de,Ve.isLocal=Ne,Ve.isUtcOffset=or,Ve.isUtc=Er,Ve.isUTC=Er,Ve.zoneAbbr=oo,Ve.zoneName=Sb,Ve.dates=_("dates accessor is deprecated. Use date instead.",bm),Ve.months=_("months accessor is deprecated. Use month instead",li),Ve.years=_("years accessor is deprecated. Use year instead",bl),Ve.zone=_("moment().zone is deprecated, use moment().utcOffset instead. http://momentjs.com/guides/#/warnings/zone/",V1),Ve.isDSTShifted=_("isDSTShifted is deprecated. See http://momentjs.com/guides/#/warnings/dst-shifted/ for more information",Fe);function ba(g){return St(g*1e3)}function Nb(){return St.apply(null,arguments).parseZone()}function Dm(g){return g}var tt=V.prototype;tt.calendar=R,tt.longDateFormat=ye,tt.invalidDate=De,tt.ordinal=Ke,tt.preparse=Dm,tt.postformat=Dm,tt.relativeTime=re,tt.pastFuture=xe,tt.set=L,tt.eras=sb,tt.erasParse=ub,tt.erasConvertYear=fb,tt.erasAbbrRegex=Ru,tt.erasNameRegex=$o,tt.erasNarrowRegex=aa,tt.months=ro,tt.monthsShort=it,tt.monthsParse=gl,tt.monthsRegex=h1,tt.monthsShortRegex=yl,tt.week=wl,tt.firstDayOfYear=Uc,tt.firstDayOfWeek=qc,tt.weekdays=D1,tt.weekdaysMin=Dl,tt.weekdaysShort=S1,tt.weekdaysParse=A1,tt.weekdaysRegex=Nt,tt.weekdaysShortRegex=Dt,tt.weekdaysMinRegex=T1,tt.isPM=Zc,tt.meridiem=Al;function Lu(g,A,P,z){var G=zt(),se=p().set(z,A);return G[P](se,g)}function Sm(g,A,P){if(f(g)&&(A=g,g=void 0),g=g||"",A!=null)return Lu(g,A,P,"month");var z,G=[];for(z=0;z<12;z++)G[z]=Lu(g,z,P,"month");return G}function qu(g,A,P,z){typeof g=="boolean"?(f(A)&&(P=A,A=void 0),A=A||""):(A=g,P=A,g=!1,f(A)&&(P=A,A=void 0),A=A||"");var G=zt(),se=g?G._week.dow:0,_e,hr=[];if(P!=null)return Lu(A,(P+se)%7,z,"day");for(_e=0;_e<7;_e++)hr[_e]=Lu(A,(_e+se)%7,z,"day");return hr}function Nm(g,A){return Sm(g,A,"months")}function Ab(g,A){return Sm(g,A,"monthsShort")}function Mb(g,A,P){return qu(g,A,P,"weekdays")}function Ll(g,A,P){return qu(g,A,P,"weekdaysShort")}function ks(g,A,P){return qu(g,A,P,"weekdaysMin")}ci("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(g){var A=g%10,P=Je(g%100/10)===1?"th":A===1?"st":A===2?"nd":A===3?"rd":"th";return g+P}}),r.lang=_("moment.lang is deprecated. Use moment.locale instead.",ci),r.langData=_("moment.langData is deprecated. Use moment.localeData instead.",zt);var ia=Math.abs;function Eb(){var g=this._data;return this._milliseconds=ia(this._milliseconds),this._days=ia(this._days),this._months=ia(this._months),g.milliseconds=ia(g.milliseconds),g.seconds=ia(g.seconds),g.minutes=ia(g.minutes),g.hours=ia(g.hours),g.months=ia(g.months),g.years=ia(g.years),this}function ql(g,A,P,z){var G=zr(A,P);return g._milliseconds+=z*G._milliseconds,g._days+=z*G._days,g._months+=z*G._months,g._bubble()}function Cb(g,A){return ql(this,g,A,1)}function vi(g,A){return ql(this,g,A,-1)}function Uu(g){return g<0?Math.floor(g):Math.ceil(g)}function so(){var g=this._milliseconds,A=this._days,P=this._months,z=this._data,G,se,_e,hr,Br;return g>=0&&A>=0&&P>=0||g<=0&&A<=0&&P<=0||(g+=Uu(Ul(P)+A)*864e5,A=0,P=0),z.milliseconds=g%1e3,G=sr(g/1e3),z.seconds=G%60,se=sr(G/60),z.minutes=se%60,_e=sr(se/60),z.hours=_e%24,A+=sr(_e/24),Br=sr(Zn(A)),P+=Br,A-=Uu(Ul(Br)),hr=sr(P/12),P%=12,z.days=A,z.months=P,z.years=hr,this}function Zn(g){return g*4800/146097}function Ul(g){return g*146097/4800}function Am(g){if(!this.isValid())return NaN;var A,P,z=this._milliseconds;if(g=ue(g),g==="month"||g==="quarter"||g==="year")switch(A=this._days+z/864e5,P=this._months+Zn(A),g){case"month":return P;case"quarter":return P/3;case"year":return P/12}else switch(A=this._days+Math.round(Ul(this._months)),g){case"week":return A/7+z/6048e5;case"day":return A+z/864e5;case"hour":return A*24+z/36e5;case"minute":return A*1440+z/6e4;case"second":return A*86400+z/1e3;case"millisecond":return Math.floor(A*864e5)+z;default:throw new Error("Unknown unit "+g)}}function Mm(){return this.isValid()?this._milliseconds+this._days*864e5+this._months%12*2592e6+Je(this._months/12)*31536e6:NaN}function Qn(g){return function(){return this.as(g)}}var Li=Qn("ms"),Em=Qn("s"),Tb=Qn("m"),zu=Qn("h"),_b=Qn("d"),Cm=Qn("w"),on=Qn("M"),zl=Qn("Q"),Tm=Qn("y");function Ua(){return zr(this)}function Yl(g){return g=ue(g),this.isValid()?this[g+"s"]():NaN}function za(g){return function(){return this.isValid()?this._data[g]:NaN}}var uo=za("milliseconds"),_m=za("seconds"),Dn=za("minutes"),Wl=za("hours"),Fb=za("days"),Ob=za("months"),Bb=za("years");function Hl(){return sr(this.days()/7)}var gi=Math.round,Ya={ss:44,s:45,m:45,h:22,d:26,w:null,M:11};function Fm(g,A,P,z,G){return G.relativeTime(A||1,!!P,g,z)}function Ib(g,A,P,z){var G=zr(g).abs(),se=gi(G.as("s")),_e=gi(G.as("m")),hr=gi(G.as("h")),Br=gi(G.as("d")),st=gi(G.as("M")),Sn=gi(G.as("w")),Wa=gi(G.as("y")),yi=se<=P.ss&&["s",se]||se0,yi[4]=z,Fm.apply(null,yi)}function Pb(g){return g===void 0?gi:typeof g=="function"?(gi=g,!0):!1}function Ls(g,A){return Ya[g]===void 0?!1:A===void 0?Ya[g]:(Ya[g]=A,g==="s"&&(Ya.ss=A-1),!0)}function Rb(g,A){if(!this.isValid())return this.localeData().invalidDate();var P=!1,z=Ya,G,se;return typeof g=="object"&&(A=g,g=!1),typeof g=="boolean"&&(P=g),typeof A=="object"&&(z=Object.assign({},Ya,A),A.s!=null&&A.ss==null&&(z.ss=A.s-1)),G=this.localeData(),se=Ib(this,!P,z,G),P&&(se=G.pastFuture(+this,se)),G.postformat(se)}var $l=Math.abs;function qi(g){return(g>0)-(g<0)||+g}function qs(){if(!this.isValid())return this.localeData().invalidDate();var g=$l(this._milliseconds)/1e3,A=$l(this._days),P=$l(this._months),z,G,se,_e,hr=this.asSeconds(),Br,st,Sn,Wa;return hr?(z=sr(g/60),G=sr(z/60),g%=60,z%=60,se=sr(P/12),P%=12,_e=g?g.toFixed(3).replace(/\\.?0+$/,""):"",Br=hr<0?"-":"",st=qi(this._months)!==qi(hr)?"-":"",Sn=qi(this._days)!==qi(hr)?"-":"",Wa=qi(this._milliseconds)!==qi(hr)?"-":"",Br+"P"+(se?st+se+"Y":"")+(P?st+P+"M":"")+(A?Sn+A+"D":"")+(G||z||g?"T":"")+(G?Wa+G+"H":"")+(z?Wa+z+"M":"")+(g?Wa+_e+"S":"")):"P0D"}var Xr=Es.prototype;Xr.isValid=W1,Xr.abs=Eb,Xr.add=Cb,Xr.subtract=vi,Xr.as=Am,Xr.asMilliseconds=Li,Xr.asSeconds=Em,Xr.asMinutes=Tb,Xr.asHours=zu,Xr.asDays=_b,Xr.asWeeks=Cm,Xr.asMonths=on,Xr.asQuarters=zl,Xr.asYears=Tm,Xr.valueOf=Mm,Xr._bubble=so,Xr.clone=Ua,Xr.get=Yl,Xr.milliseconds=uo,Xr.seconds=_m,Xr.minutes=Dn,Xr.hours=Wl,Xr.days=Fb,Xr.weeks=Hl,Xr.months=Ob,Xr.years=Bb,Xr.humanize=Rb,Xr.toISOString=qs,Xr.toString=qs,Xr.toJSON=qs,Xr.locale=Fs,Xr.localeData=dm,Xr.toIsoString=_("toIsoString() is deprecated. Please use toISOString() instead (notice the capitals)",qs),Xr.lang=Ou,$("X",0,0,"unix"),$("x",0,0,"valueOf"),ar("x",an),ar("X",ll),ct("X",function(g,A,P){P._d=new Date(parseFloat(g)*1e3)}),ct("x",function(g,A,P){P._d=new Date(Je(g))});return r.version="2.29.4",t(St),r.fn=Ve,r.min=q1,r.max=U1,r.now=z1,r.utc=p,r.unix=ba,r.months=Nm,r.isDate=o,r.locale=ci,r.invalid=b,r.duration=zr,r.isMoment=D,r.weekdays=Mb,r.parseZone=Nb,r.localeData=zt,r.isDuration=xa,r.monthsShort=Ab,r.weekdaysMin=ks,r.defineLocale=wn,r.updateLocale=O1,r.locales=B1,r.weekdaysShort=Ll,r.normalizeUnits=ue,r.relativeTimeRounding=Pb,r.relativeTimeThreshold=Ls,r.calendarFormat=J1,r.prototype=Ve,r.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"},r})});var tp=Nn((Xu,ac)=>{(function(){var e,r="4.17.21",t=200,n="Unsupported core-js use. Try https://npms.io/search?q=ponyfill.",a="Expected a function",i="Invalid \`variable\` option passed into \`_.template\`",s="__lodash_hash_undefined__",c=500,f="__lodash_placeholder__",o=1,u=2,m=4,p=1,h=2,y=1,v=2,x=4,b=8,E=16,w=32,N=64,M=128,D=256,O=512,_=30,C="...",T=800,k=16,L=1,H=2,V=3,W=1/0,q=9007199254740991,R=17976931348623157e292,X=0/0,U=4294967295,oe=U-1,me=U>>>1,ae=[["ary",M],["bind",y],["bindKey",v],["curry",b],["curryRight",E],["flip",O],["partial",w],["partialRight",N],["rearg",D]],$="[object Arguments]",ce="[object Array]",Ce="[object AsyncFunction]",pe="[object Boolean]",ge="[object Date]",Se="[object DOMException]",ye="[object Error]",be="[object Function]",De="[object GeneratorFunction]",Ae="[object Map]",Ye="[object Number]",Ke="[object Null]",J="[object Object]",re="[object Promise]",xe="[object Proxy]",j="[object RegExp]",ne="[object Set]",ue="[object String]",Me="[object Symbol]",Ee="[object Undefined]",qe="[object WeakMap]",Pe="[object WeakSet]",lr="[object ArrayBuffer]",sr="[object DataView]",Je="[object Float32Array]",Pr="[object Float64Array]",ee="[object Int8Array]",le="[object Int16Array]",we="[object Int32Array]",Be="[object Uint8Array]",ke="[object Uint8ClampedArray]",Te="[object Uint16Array]",Re="[object Uint32Array]",We=/\\b__p \\+= '';/g,B=/\\b(__p \\+=) '' \\+/g,Q=/(__e\\(.*?\\)|\\b__t\\)) \\+\\n'';/g,ve=/&(?:amp|lt|gt|quot|#39);/g,Ie=/[&<>"']/g,nr=RegExp(ve.source),cr=RegExp(Ie.source),rt=/<%-([\\s\\S]+?)%>/g,Ut=/<%([\\s\\S]+?)%>/g,an=/<%=([\\s\\S]+?)%>/g,Ti=/\\.|\\[(?:[^[\\]]*|(["'])(?:(?!\\1)[^\\\\]|\\\\.)*?\\1)\\]/,si=/^\\w*$/,ll=/[^.[\\]]+|\\[(?:(-?\\d+(?:\\.\\d+)?)|(["'])((?:(?!\\2)[^\\\\]|\\\\.)*?)\\2)\\]|(?=(?:\\.|\\[\\])(?:\\.|\\[\\]|$))/g,ui=/[\\\\^$.*+?()[\\]{}|]/g,Fo=RegExp(ui.source),ar=/^\\s+/,cl=/\\s/,ml=/\\{(?:\\n\\/\\* \\[wrapped with .+\\] \\*\\/)?\\n?/,bn=/\\{\\n\\/\\* \\[wrapped with (.+)\\] \\*/,Ss=/,? & /,ct=/[^\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\x7f]+/g,eo=/[()=,{}\\[\\]\\/\\s]/,pl=/\\\\(\\\\)?/g,jt=/\\$\\{([^\\\\}]*(?:\\\\.[^\\\\}]*)*)\\}/g,ra=/\\w*$/,ta=/^[-+]0x[0-9a-f]+$/i,Pt=/^0b[01]+$/i,Gn=/^\\[object .+?Constructor\\]$/,ga=/^0o[0-7]+$/i,fi=/^(?:0|[1-9]\\d*)$/,dl=/[\\xc0-\\xd6\\xd8-\\xf6\\xf8-\\xff\\u0100-\\u017f]/g,Oo=/($^)/,hl=/['\\n\\r\\u2028\\u2029\\\\]/g,wt="\\\\ud800-\\\\udfff",Bo="\\\\u0300-\\\\u036f",vl="\\\\ufe20-\\\\ufe2f",vu="\\\\u20d0-\\\\u20ff",Ns=Bo+vl+vu,gu="\\\\u2700-\\\\u27bf",yu="a-z\\\\xdf-\\\\xf6\\\\xf8-\\\\xff",ro="\\\\xac\\\\xb1\\\\xd7\\\\xf7",it="\\\\x00-\\\\x2f\\\\x3a-\\\\x40\\\\x5b-\\\\x60\\\\x7b-\\\\xbf",dn="\\\\u2000-\\\\u206f",gl=" \\\\t\\\\x0b\\\\f\\\\xa0\\\\ufeff\\\\n\\\\r\\\\u2028\\\\u2029\\\\u1680\\\\u180e\\\\u2000\\\\u2001\\\\u2002\\\\u2003\\\\u2004\\\\u2005\\\\u2006\\\\u2007\\\\u2008\\\\u2009\\\\u200a\\\\u202f\\\\u205f\\\\u3000",_i="A-Z\\\\xc0-\\\\xd6\\\\xd8-\\\\xde",li="\\\\ufe0e\\\\ufe0f",xu=ro+it+dn+gl,yl="['\\u2019]",h1="["+wt+"]",xl="["+xu+"]",Fi="["+Ns+"]",bl="\\\\d+",v1="["+gu+"]",kc="["+yu+"]",Io="[^"+wt+xu+bl+gu+yu+_i+"]",Po="\\\\ud83c[\\\\udffb-\\\\udfff]",Lc="(?:"+Fi+"|"+Po+")",Ro="[^"+wt+"]",ya="(?:\\\\ud83c[\\\\udde6-\\\\uddff]){2}",wl="[\\\\ud800-\\\\udbff][\\\\udc00-\\\\udfff]",ko="["+_i+"]",qc="\\\\u200d",Uc="(?:"+kc+"|"+Io+")",g1="(?:"+ko+"|"+Io+")",zc="(?:"+yl+"(?:d|ll|m|re|s|t|ve))?",Yc="(?:"+yl+"(?:D|LL|M|RE|S|T|VE))?",Wc=Lc+"?",bu="["+li+"]?",y1="(?:"+qc+"(?:"+[Ro,ya,wl].join("|")+")"+bu+Wc+")*",Hc="\\\\d*(?:1st|2nd|3rd|(?![123])\\\\dth)(?=\\\\b|[A-Z_])",x1="\\\\d*(?:1ST|2ND|3RD|(?![123])\\\\dTH)(?=\\\\b|[a-z_])",$c=bu+Wc+y1,b1="(?:"+[v1,ya,wl].join("|")+")"+$c,w1="(?:"+[Ro+Fi+"?",Fi,ya,wl,h1].join("|")+")",D1=RegExp(yl,"g"),S1=RegExp(Fi,"g"),Dl=RegExp(Po+"(?="+Po+")|"+w1+$c,"g"),N1=RegExp([ko+"?"+kc+"+"+zc+"(?="+[xl,ko,"$"].join("|")+")",g1+"+"+Yc+"(?="+[xl,ko+Uc,"$"].join("|")+")",ko+"?"+Uc+"+"+zc,ko+"+"+Yc,x1,Hc,bl,b1].join("|"),"g"),A1=RegExp("["+qc+wt+Ns+li+"]"),M1=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,E1=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],C1=-1,Nt={};Nt[Je]=Nt[Pr]=Nt[ee]=Nt[le]=Nt[we]=Nt[Be]=Nt[ke]=Nt[Te]=Nt[Re]=!0,Nt[$]=Nt[ce]=Nt[lr]=Nt[pe]=Nt[sr]=Nt[ge]=Nt[ye]=Nt[be]=Nt[Ae]=Nt[Ye]=Nt[J]=Nt[j]=Nt[ne]=Nt[ue]=Nt[qe]=!1;var Dt={};Dt[$]=Dt[ce]=Dt[lr]=Dt[sr]=Dt[pe]=Dt[ge]=Dt[Je]=Dt[Pr]=Dt[ee]=Dt[le]=Dt[we]=Dt[Ae]=Dt[Ye]=Dt[J]=Dt[j]=Dt[ne]=Dt[ue]=Dt[Me]=Dt[Be]=Dt[ke]=Dt[Te]=Dt[Re]=!0,Dt[ye]=Dt[be]=Dt[qe]=!1;var T1={\\u00C0:"A",\\u00C1:"A",\\u00C2:"A",\\u00C3:"A",\\u00C4:"A",\\u00C5:"A",\\u00E0:"a",\\u00E1:"a",\\u00E2:"a",\\u00E3:"a",\\u00E4:"a",\\u00E5:"a",\\u00C7:"C",\\u00E7:"c",\\u00D0:"D",\\u00F0:"d",\\u00C8:"E",\\u00C9:"E",\\u00CA:"E",\\u00CB:"E",\\u00E8:"e",\\u00E9:"e",\\u00EA:"e",\\u00EB:"e",\\u00CC:"I",\\u00CD:"I",\\u00CE:"I",\\u00CF:"I",\\u00EC:"i",\\u00ED:"i",\\u00EE:"i",\\u00EF:"i",\\u00D1:"N",\\u00F1:"n",\\u00D2:"O",\\u00D3:"O",\\u00D4:"O",\\u00D5:"O",\\u00D6:"O",\\u00D8:"O",\\u00F2:"o",\\u00F3:"o",\\u00F4:"o",\\u00F5:"o",\\u00F6:"o",\\u00F8:"o",\\u00D9:"U",\\u00DA:"U",\\u00DB:"U",\\u00DC:"U",\\u00F9:"u",\\u00FA:"u",\\u00FB:"u",\\u00FC:"u",\\u00DD:"Y",\\u00FD:"y",\\u00FF:"y",\\u00C6:"Ae",\\u00E6:"ae",\\u00DE:"Th",\\u00FE:"th",\\u00DF:"ss",\\u0100:"A",\\u0102:"A",\\u0104:"A",\\u0101:"a",\\u0103:"a",\\u0105:"a",\\u0106:"C",\\u0108:"C",\\u010A:"C",\\u010C:"C",\\u0107:"c",\\u0109:"c",\\u010B:"c",\\u010D:"c",\\u010E:"D",\\u0110:"D",\\u010F:"d",\\u0111:"d",\\u0112:"E",\\u0114:"E",\\u0116:"E",\\u0118:"E",\\u011A:"E",\\u0113:"e",\\u0115:"e",\\u0117:"e",\\u0119:"e",\\u011B:"e",\\u011C:"G",\\u011E:"G",\\u0120:"G",\\u0122:"G",\\u011D:"g",\\u011F:"g",\\u0121:"g",\\u0123:"g",\\u0124:"H",\\u0126:"H",\\u0125:"h",\\u0127:"h",\\u0128:"I",\\u012A:"I",\\u012C:"I",\\u012E:"I",\\u0130:"I",\\u0129:"i",\\u012B:"i",\\u012D:"i",\\u012F:"i",\\u0131:"i",\\u0134:"J",\\u0135:"j",\\u0136:"K",\\u0137:"k",\\u0138:"k",\\u0139:"L",\\u013B:"L",\\u013D:"L",\\u013F:"L",\\u0141:"L",\\u013A:"l",\\u013C:"l",\\u013E:"l",\\u0140:"l",\\u0142:"l",\\u0143:"N",\\u0145:"N",\\u0147:"N",\\u014A:"N",\\u0144:"n",\\u0146:"n",\\u0148:"n",\\u014B:"n",\\u014C:"O",\\u014E:"O",\\u0150:"O",\\u014D:"o",\\u014F:"o",\\u0151:"o",\\u0154:"R",\\u0156:"R",\\u0158:"R",\\u0155:"r",\\u0157:"r",\\u0159:"r",\\u015A:"S",\\u015C:"S",\\u015E:"S",\\u0160:"S",\\u015B:"s",\\u015D:"s",\\u015F:"s",\\u0161:"s",\\u0162:"T",\\u0164:"T",\\u0166:"T",\\u0163:"t",\\u0165:"t",\\u0167:"t",\\u0168:"U",\\u016A:"U",\\u016C:"U",\\u016E:"U",\\u0170:"U",\\u0172:"U",\\u0169:"u",\\u016B:"u",\\u016D:"u",\\u016F:"u",\\u0171:"u",\\u0173:"u",\\u0174:"W",\\u0175:"w",\\u0176:"Y",\\u0177:"y",\\u0178:"Y",\\u0179:"Z",\\u017B:"Z",\\u017D:"Z",\\u017A:"z",\\u017C:"z",\\u017E:"z",\\u0132:"IJ",\\u0133:"ij",\\u0152:"Oe",\\u0153:"oe",\\u0149:"'n",\\u017F:"s"},Sl={"&":"&","<":"<",">":">",'"':""","'":"'"},Nl={"&":"&","<":"<",">":">",""":'"',"'":"'"},_1={"\\\\":"\\\\","'":"'","\\n":"n","\\r":"r","\\u2028":"u2028","\\u2029":"u2029"},Gc=parseFloat,Vc=parseInt,Zc=typeof global=="object"&&global&&global.Object===Object&&global,F1=typeof self=="object"&&self&&self.Object===Object&&self,en=Zc||F1||Function("return this")(),Al=typeof Xu=="object"&&Xu&&!Xu.nodeType&&Xu,Oi=Al&&typeof ac=="object"&&ac&&!ac.nodeType&&ac,At=Oi&&Oi.exports===Al,to=At&&Zc.process,hn=function(){try{var de=Oi&&Oi.require&&Oi.require("util").types;return de||to&&to.binding&&to.binding("util")}catch{}}(),Qc=hn&&hn.isArrayBuffer,Ml=hn&&hn.isDate,Xc=hn&&hn.isMap,Kc=hn&&hn.isRegExp,As=hn&&hn.isSet,ci=hn&&hn.isTypedArray;function wn(de,Fe,Ne){switch(Ne.length){case 0:return de.call(Fe);case 1:return de.call(Fe,Ne[0]);case 2:return de.call(Fe,Ne[0],Ne[1]);case 3:return de.call(Fe,Ne[0],Ne[1],Ne[2])}return de.apply(Fe,Ne)}function O1(de,Fe,Ne,or){for(var Er=-1,ot=de==null?0:de.length;++Er-1}function El(de,Fe,Ne){for(var or=-1,Er=de==null?0:de.length;++or-1;);return Ne}function am(de,Fe){for(var Ne=de.length;Ne--&&Lo(Fe,de[Ne],0)>-1;);return Ne}function L1(de,Fe){for(var Ne=de.length,or=0;Ne--;)de[Ne]===Fe&&++or;return or}var im=Ms(T1),q1=Ms(Sl);function U1(de){return"\\\\"+_1[de]}function z1(de,Fe){return de==null?e:de[Fe]}function qa(de){return A1.test(de)}function Y1(de){return M1.test(de)}function W1(de){for(var Fe,Ne=[];!(Fe=de.next()).done;)Ne.push(Fe.value);return Ne}function Pl(de){var Fe=-1,Ne=Array(de.size);return de.forEach(function(or,Er){Ne[++Fe]=[Er,or]}),Ne}function Es(de,Fe){return function(Ne){return de(Fe(Ne))}}function xa(de,Fe){for(var Ne=-1,or=de.length,Er=0,ot=[];++Ne-1}function bm(l,d){var S=this.__data__,I=ia(S,l);return I<0?(++this.size,S.push([l,d])):S[I][1]=d,this}di.prototype.clear=gb,di.prototype.delete=xm,di.prototype.get=yb,di.prototype.has=xb,di.prototype.set=bm;function hi(l){var d=-1,S=l==null?0:l.length;for(this.clear();++d=d?l:d)),l}function Zn(l,d,S,I,Y,K){var ie,fe=d&o,he=d&u,Le=d&m;if(S&&(ie=Y?S(l,I,Y,K):S(l)),ie!==e)return ie;if(!kt(l))return l;var Ue=Ir(l);if(Ue){if(ie=Q6(l),!fe)return oa(l,ie)}else{var He=On(l),rr=He==be||He==De;if(Qo(l))return iA(l,fe);if(He==J||He==$||rr&&!Y){if(ie=he||rr?{}:NA(l),!fe)return he?L6(l,Cb(ie,l)):k6(l,ql(ie,l))}else{if(!Dt[He])return Y?l:{};ie=X6(l,He,fe)}}K||(K=new ba);var pr=K.get(l);if(pr)return pr;K.set(l,ie),jA(l)?l.forEach(function(Ar){ie.add(Zn(Ar,d,S,Ar,l,K))}):KA(l)&&l.forEach(function(Ar,Gr){ie.set(Gr,Zn(Ar,d,S,Gr,l,K))});var Nr=Le?he?Qb:Zb:he?ua:vn,qr=Ue?e:Nr(l);return zt(qr||l,function(Ar,Gr){qr&&(Gr=Ar,Ar=l[Gr]),ks(ie,Gr,Zn(Ar,d,S,Gr,l,K))}),ie}function Ul(l){var d=vn(l);return function(S){return Am(S,l,d)}}function Am(l,d,S){var I=S.length;if(l==null)return!I;for(l=zr(l);I--;){var Y=S[I],K=d[Y],ie=l[Y];if(ie===e&&!(Y in l)||!K(ie))return!1}return!0}function Mm(l,d,S){if(typeof l!="function")throw new na(a);return Ql(function(){l.apply(e,S)},d)}function Qn(l,d,S,I){var Y=-1,K=Du,ie=!0,fe=l.length,he=[],Le=d.length;if(!fe)return he;S&&(d=xt(d,Fn(S))),I?(K=El,ie=!1):d.length>=t&&(K=qo,ie=!1,d=new oo(d));e:for(;++YY?0:Y+S),I=I===e||I>Y?Y:kr(I),I<0&&(I+=Y),I=S>I?0:rM(I);S0&&S(fe)?d>1?on(fe,d-1,S,I,Y):La(Y,fe):I||(Y[Y.length]=fe)}return Y}var zl=cA(),Tm=cA(!0);function Ua(l,d){return l&&zl(l,d,vn)}function Yl(l,d){return l&&Tm(l,d,vn)}function za(l,d){return Bi(d,function(S){return mo(l[S])})}function uo(l,d){d=Vo(d,l);for(var S=0,I=d.length;l!=null&&Sd}function Fb(l,d){return l!=null&&pt.call(l,d)}function Ob(l,d){return l!=null&&d in zr(l)}function Bb(l,d,S){return l>=Rt(d,S)&&l=120&&Ue.length>=120)?new oo(ie&&Ue):e}Ue=l[0];var He=-1,rr=fe[0];e:for(;++He-1;)fe!==l&&ao.call(fe,he,1),ao.call(l,he,1);return l}function KN(l,d){for(var S=l?d.length:0,I=S-1;S--;){var Y=d[S];if(S==I||Y!==K){var K=Y;co(Y)?ao.call(l,Y,1):zb(l,Y)}}return l}function Lb(l,d){return l+Fs(gm()*(d-l+1))}function M6(l,d,S,I){for(var Y=-1,K=Yt(Fu((d-l)/(S||1)),0),ie=Ne(K);K--;)ie[I?K:++Y]=l,l+=S;return ie}function qb(l,d){var S="";if(!l||d<1||d>q)return S;do d%2&&(S+=l),d=Fs(d/2),d&&(l+=l);while(d);return S}function Yr(l,d){return tw(EA(l,d,fa),l+"")}function E6(l){return Nm(Gu(l))}function C6(l,d){var S=Gu(l);return zm(S,so(d,0,S.length))}function Gl(l,d,S,I){if(!kt(l))return l;d=Vo(d,l);for(var Y=-1,K=d.length,ie=K-1,fe=l;fe!=null&&++YY?0:Y+d),S=S>Y?Y:S,S<0&&(S+=Y),Y=d>S?0:S-d>>>0,d>>>=0;for(var K=Ne(Y);++I>>1,ie=l[K];ie!==null&&!Da(ie)&&(S?ie<=d:ie=t){var Le=d?null:Y6(l);if(Le)return Uo(Le);ie=!1,Y=qo,he=new oo}else he=d?[]:fe;e:for(;++I=I?l:Ha(l,d,S)}var aA=rb||function(l){return en.clearTimeout(l)};function iA(l,d){if(d)return l.slice();var S=l.length,I=lm?lm(S):new l.constructor(S);return l.copy(I),I}function $b(l){var d=new l.constructor(l.byteLength);return new Cu(d).set(new Cu(l)),d}function B6(l,d){var S=d?$b(l.buffer):l.buffer;return new l.constructor(S,l.byteOffset,l.byteLength)}function I6(l){var d=new l.constructor(l.source,ra.exec(l));return d.lastIndex=l.lastIndex,d}function P6(l){return Rs?zr(Rs.call(l)):{}}function oA(l,d){var S=d?$b(l.buffer):l.buffer;return new l.constructor(S,l.byteOffset,l.length)}function sA(l,d){if(l!==d){var S=l!==e,I=l===null,Y=l===l,K=Da(l),ie=d!==e,fe=d===null,he=d===d,Le=Da(d);if(!fe&&!Le&&!K&&l>d||K&&ie&&he&&!fe&&!Le||I&&ie&&he||!S&&he||!Y)return 1;if(!I&&!K&&!Le&&l=fe)return he;var Le=S[I];return he*(Le=="desc"?-1:1)}}return l.index-d.index}function uA(l,d,S,I){for(var Y=-1,K=l.length,ie=S.length,fe=-1,he=d.length,Le=Yt(K-ie,0),Ue=Ne(he+Le),He=!I;++fe1?S[Y-1]:e,ie=Y>2?S[2]:e;for(K=l.length>3&&typeof K=="function"?(Y--,K):e,ie&&Xn(S[0],S[1],ie)&&(K=Y<3?e:K,Y=1),d=zr(d);++I-1?Y[K?d[ie]:ie]:e}}function dA(l){return lo(function(d){var S=d.length,I=S,Y=aa.prototype.thru;for(l&&d.reverse();I--;){var K=d[I];if(typeof K!="function")throw new na(a);if(Y&&!ie&&qm(K)=="wrapper")var ie=new aa([],!0)}for(I=ie?I:S;++I1&&Jr.reverse(),Ue&&hefe))return!1;var Le=K.get(l),Ue=K.get(d);if(Le&&Ue)return Le==d&&Ue==l;var He=-1,rr=!0,pr=S&h?new oo:e;for(K.set(l,d),K.set(d,l);++He1?"& ":"")+d[I],d=d.join(S>2?", ":" "),l.replace(ml,\`{ @@ -857,7 +857,7 @@ function print() { __p += __j.call(arguments, '') } \`:\`; \`)+He+\`return __p }\`;var qr=cM(function(){return ot(K,pr+"return "+He).apply(e,ie)});if(qr.source=He,sw(qr))throw qr;return qr}function E9(l){return dt(l).toLowerCase()}function C9(l){return dt(l).toUpperCase()}function T9(l,d,S){if(l=dt(l),l&&(S||d===e))return nm(l);if(!l||!(d=wa(d)))return l;var I=Vn(l),Y=Vn(d),K=St(I,Y),ie=am(I,Y)+1;return Zo(I,K,ie).join("")}function _9(l,d,S){if(l=dt(l),l&&(S||d===e))return l.slice(0,Nu(l)+1);if(!l||!(d=wa(d)))return l;var I=Vn(l),Y=am(I,Vn(d))+1;return Zo(I,0,Y).join("")}function F9(l,d,S){if(l=dt(l),l&&(S||d===e))return l.replace(ar,"");if(!l||!(d=wa(d)))return l;var I=Vn(l),Y=St(I,Vn(d));return Zo(I,Y).join("")}function O9(l,d){var S=_,I=C;if(kt(d)){var Y="separator"in d?d.separator:Y;S="length"in d?kr(d.length):S,I="omission"in d?wa(d.omission):I}l=dt(l);var K=l.length;if(qa(l)){var ie=Vn(l);K=ie.length}if(S>=K)return l;var fe=S-Ii(I);if(fe<1)return I;var he=ie?Zo(ie,0,fe).join(""):l.slice(0,fe);if(Y===e)return he+I;if(ie&&(fe+=he.length-fe),uw(Y)){if(l.slice(fe).search(Y)){var Le,Ue=he;for(Y.global||(Y=mi(Y.source,dt(ra.exec(Y))+"g")),Y.lastIndex=0;Le=Y.exec(Ue);)var He=Le.index;he=he.slice(0,He===e?fe:He)}}else if(l.indexOf(wa(Y),fe)!=fe){var rr=he.lastIndexOf(Y);rr>-1&&(he=he.slice(0,rr))}return he+I}function B9(l){return l=dt(l),l&&nr.test(l)?l.replace(ve,G1):l}var I9=Wu(function(l,d,S){return l+(S?" ":"")+d.toUpperCase()}),cw=mA("toUpperCase");function lM(l,d,S){return l=dt(l),d=S?e:d,d===e?Y1(l)?Q1(l):R1(l):l.match(d)||[]}var cM=Yr(function(l,d){try{return wn(l,e,d)}catch(S){return sw(S)?S:new Er(S)}}),P9=lo(function(l,d){return zt(d,function(S){S=zi(S),vi(l,S,iw(l[S],l))}),l});function R9(l){var d=l==null?0:l.length,S=br();return l=d?xt(l,function(I){if(typeof I[1]!="function")throw new na(a);return[S(I[0]),I[1]]}):[],Yr(function(I){for(var Y=-1;++Yq)return[];var S=U,I=Rt(l,U);d=br(d),l-=U;for(var Y=Bl(I,d);++S0||d<0)?new Lr(S):(l<0?S=S.takeRight(-l):l&&(S=S.drop(l)),d!==e&&(d=kr(d),S=d<0?S.dropRight(-d):S.take(d-l)),S)},Lr.prototype.takeRightWhile=function(l){return this.reverse().takeWhile(l).reverse()},Lr.prototype.toArray=function(){return this.take(U)},Ua(Lr.prototype,function(l,d){var S=/^(?:filter|find|map|reject)|While$/.test(d),I=/^(?:head|last)$/.test(d),Y=Z[I?"take"+(d=="last"?"Right":""):d],K=I||/^find/.test(d);!Y||(Z.prototype[d]=function(){var ie=this.__wrapped__,fe=I?[1]:arguments,he=ie instanceof Lr,Le=fe[0],Ue=he||Ir(ie),He=function(Gr){var Jr=Y.apply(Z,La([Gr],fe));return I&&rr?Jr[0]:Jr};Ue&&S&&typeof Le=="function"&&Le.length!=1&&(he=Ue=!1);var rr=this.__chain__,pr=!!this.__actions__.length,Nr=K&&!rr,qr=he&&!pr;if(!K&&Ue){ie=qr?ie:new Lr(this);var Ar=l.apply(ie,fe);return Ar.__actions__.push({func:Ym,args:[He],thisArg:e}),new aa(Ar,rr)}return Nr&&qr?l.apply(this,fe):(Ar=this.thru(He),Nr?I?Ar.value()[0]:Ar.value():Ar)})}),zt(["pop","push","shift","sort","splice","unshift"],function(l){var d=Cs[l],S=/^(?:push|sort|unshift)$/.test(l)?"tap":"thru",I=/^(?:pop|shift)$/.test(l);Z.prototype[l]=function(){var Y=arguments;if(I&&!this.__chain__){var K=this.value();return d.apply(Ir(K)?K:[],Y)}return this[S](function(ie){return d.apply(Ir(ie)?ie:[],Y)})}}),Ua(Lr.prototype,function(l,d){var S=Z[d];if(S){var I=S.name+"";pt.call(Ho,I)||(Ho[I]=[]),Ho[I].push({name:d,func:S})}}),Ho[Pm(e,v).name]=[{name:"wrapper",func:e}],Lr.prototype.clone=lb,Lr.prototype.reverse=cb,Lr.prototype.value=mb,Z.prototype.at=lL,Z.prototype.chain=cL,Z.prototype.commit=mL,Z.prototype.next=pL,Z.prototype.plant=hL,Z.prototype.reverse=vL,Z.prototype.toJSON=Z.prototype.valueOf=Z.prototype.value=gL,Z.prototype.first=Z.prototype.head,_s&&(Z.prototype[_s]=dL),Z},Pi=X1();typeof define=="function"&&typeof define.amd=="object"&&define.amd?(en._=Pi,define(function(){return Pi})):Oi?((Oi.exports=Pi)._=Pi,Al._=Pi):en._=Pi}).call(Xu)});var Mp=Nn((jw,eD)=>{(function(e,r){typeof jw=="object"&&typeof eD<"u"?eD.exports=r():typeof define=="function"&&define.amd?define(r):(e=typeof globalThis<"u"?globalThis:e||self,e["'typed'"]=r())})(jw,function(){"use strict";function e(){return!0}function r(){return!1}function t(){}let n="Argument is not a typed-function.";function a(){function s(ee){return typeof ee=="object"&&ee!==null&&ee.constructor===Object}let c=[{name:"number",test:function(ee){return typeof ee=="number"}},{name:"string",test:function(ee){return typeof ee=="string"}},{name:"boolean",test:function(ee){return typeof ee=="boolean"}},{name:"Function",test:function(ee){return typeof ee=="function"}},{name:"Array",test:Array.isArray},{name:"Date",test:function(ee){return ee instanceof Date}},{name:"RegExp",test:function(ee){return ee instanceof RegExp}},{name:"Object",test:s},{name:"null",test:function(ee){return ee===null}},{name:"undefined",test:function(ee){return ee===void 0}}],f={name:"any",test:e,isAny:!0},o,u,m=0,p={createCount:0};function h(ee){let le=o.get(ee);if(le)return le;let we='Unknown type "'+ee+'"',Be=ee.toLowerCase(),ke;for(ke of u)if(ke.toLowerCase()===Be){we+='. Did you mean "'+ke+'" ?';break}throw new TypeError(we)}function y(ee){let le=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"any",we=le?h(le).index:u.length,Be=[];for(let Te=0;Te{let Be=o.get(we);return!Be.isAny&&Be.test(ee)});return le.length?le:["any"]}function E(ee){return ee&&typeof ee=="function"&&"_typedFunctionData"in ee}function w(ee,le,we){if(!E(ee))throw new TypeError(n);let Be=we&&we.exact,ke=Array.isArray(le)?le.join(","):le,Te=T(ke),Re=D(Te);if(!Be||Re in ee.signatures){let ve=ee._typedFunctionData.signatureMap.get(Re);if(ve)return ve}let We=Te.length,B;if(Be){B=[];let ve;for(ve in ee.signatures)B.push(ee._typedFunctionData.signatureMap.get(ve))}else B=ee._typedFunctionData.signatures;for(let ve=0;ve!Ut.has(an.name)))continue}nr.push(cr)}}if(B=nr,B.length===0)break}let Q;for(Q of B)if(Q.params.length<=We)return Q;throw new TypeError("Signature not found (signature: "+(ee.name||"unnamed")+"("+D(Te,", ")+"))")}function N(ee,le,we){return w(ee,le,we).implementation}function M(ee,le){let we=h(le);if(we.test(ee))return ee;let Be=we.conversionsTo;if(Be.length===0)throw new Error("There are no conversions to "+le+" defined.");for(let ke=0;ke1&&arguments[1]!==void 0?arguments[1]:",";return ee.map(we=>we.name).join(le)}function O(ee){let le=ee.indexOf("...")===0,Be=(le?ee.length>3?ee.slice(3):"any":ee).split("|").map(We=>h(We.trim())),ke=!1,Te=le?"...":"";return{types:Be.map(function(We){return ke=We.isAny||ke,Te+=We.name+"|",{name:We.name,typeIndex:We.index,test:We.test,isAny:We.isAny,conversion:null,conversionIndex:-1}}),name:Te.slice(0,-1),hasAny:ke,hasConversion:!1,restParam:le}}function _(ee){let le=ee.types.map(Re=>Re.name),we=$(le),Be=ee.hasAny,ke=ee.name,Te=we.map(function(Re){let We=h(Re.from);return Be=We.isAny||Be,ke+="|"+Re.from,{name:Re.from,typeIndex:We.index,test:We.test,isAny:We.isAny,conversion:Re,conversionIndex:Re.index}});return{types:ee.types.concat(Te),name:ke,hasAny:Be,hasConversion:Te.length>0,restParam:ee.restParam}}function C(ee){return ee.typeSet||(ee.typeSet=new Set,ee.types.forEach(le=>ee.typeSet.add(le.name))),ee.typeSet}function T(ee){let le=[];if(typeof ee!="string")throw new TypeError("Signatures must be strings");let we=ee.trim();if(we==="")return le;let Be=we.split(",");for(let ke=0;ke=ke+1}}else return ee.length===0?function(Te){return Te.length===0}:ee.length===1?(we=L(ee[0]),function(Te){return we(Te[0])&&Te.length===1}):ee.length===2?(we=L(ee[0]),Be=L(ee[1]),function(Te){return we(Te[0])&&Be(Te[1])&&Te.length===2}):(le=ee.map(L),function(Te){for(let Re=0;Re{let ke=W(Be.params,le),Te;for(Te of ke)we.add(Te)}),we.has("any")?["any"]:Array.from(we)}function X(ee,le,we){let Be,ke,Te=ee||"unnamed",Re=we,We;for(We=0;We{let cr=V(nr.params,We),rt=L(cr);(We0){let nr=b(le[We]);return Be=new TypeError("Unexpected type of argument in function "+Te+" (expected: "+ke.join(" or ")+", actual: "+nr.join(" | ")+", index: "+We+")"),Be.data={category:"wrongType",fn:Te,index:We,actual:nr,expected:ke},Be}}else Re=Ie}let B=Re.map(function(Ie){return k(Ie.params)?1/0:Ie.params.length});if(le.lengthQ)return Be=new TypeError("Too many arguments in function "+Te+" (expected: "+Q+", actual: "+le.length+")"),Be.data={category:"tooManyArgs",fn:Te,index:le.length,expectedLength:Q},Be;let ve=[];for(let Ie=0;Ie0)return 1;let Be=oe(ee)-oe(le);return Be<0?-1:Be>0?1:0}function ae(ee,le){let we=ee.params,Be=le.params,ke=J(we),Te=J(Be),Re=k(we),We=k(Be);if(Re&&ke.hasAny){if(!We||!Te.hasAny)return 1}else if(We&&Te.hasAny)return-1;let B=0,Q=0,ve;for(ve of we)ve.hasAny&&++B,ve.hasConversion&&++Q;let Ie=0,nr=0;for(ve of Be)ve.hasAny&&++Ie,ve.hasConversion&&++nr;if(B!==Ie)return B-Ie;if(Re&&ke.hasConversion){if(!We||!Te.hasConversion)return 1}else if(We&&Te.hasConversion)return-1;if(Q!==nr)return Q-nr;if(Re){if(!We)return 1}else if(We)return-1;let cr=(we.length-Be.length)*(Re?-1:1);if(cr!==0)return cr;let rt=[],Ut=0;for(let Ti=0;Ti1&&le.sort((ke,Te)=>ke.index-Te.index);let we=le[0].conversionsTo;if(ee.length===1)return we;we=we.concat([]);let Be=new Set(ee);for(let ke=1;keke.hasConversion)){let ke=k(ee),Te=ee.map(Ce);we=function(){let We=[],B=ke?arguments.length-1:arguments.length;for(let Q=0;QB.name).join("|"),hasAny:We.some(B=>B.isAny),hasConversion:!1,restParam:!0}),Re.push(Te)}else Re=Te.types.map(function(We){return{types:[We],name:We.name,hasAny:We.isAny,hasConversion:We.conversion,restParam:!1}});return j(Re,function(We){return le(we,Be+1,ke.concat([We]))})}else return[ke]}return le(ee,0,[])}function ge(ee,le){let we=Math.max(ee.length,le.length);for(let We=0;We=Be:Re?Be>=ke:Be===ke}function Se(ee){return ee.map(le=>qe(le)?Me(le.referToSelf.callback):Ee(le)?ue(le.referTo.references,le.referTo.callback):le)}function ye(ee,le,we){let Be=[],ke;for(ke of ee){let Te=we[ke];if(typeof Te!="number")throw new TypeError('No definition for referenced signature "'+ke+'"');if(Te=le[Te],typeof Te!="function")return!1;Be.push(Te)}return Be}function be(ee,le,we){let Be=Se(ee),ke=new Array(Be.length).fill(!1),Te=!0;for(;Te;){Te=!1;let Re=!0;for(let We=0;We{let Be=ee[we];if(le.test(Be.toString()))throw new SyntaxError("Using \`this\` to self-reference a function is deprecated since typed-function@3. Use typed.referTo and typed.referToSelf instead.")})}function Ae(ee,le){if(p.createCount++,Object.keys(le).length===0)throw new SyntaxError("No signatures provided");p.warnAgainstDeprecatedThis&&De(le);let we=[],Be=[],ke={},Te=[],Re;for(Re in le){if(!Object.prototype.hasOwnProperty.call(le,Re))continue;let it=T(Re);if(!it)continue;we.forEach(function(li){if(ge(li,it))throw new TypeError('Conflicting signatures "'+D(li)+'" and "'+D(it)+'".')}),we.push(it);let dn=Be.length;Be.push(le[Re]);let gl=it.map(_),_i;for(_i of pe(gl)){let li=D(_i);Te.push({params:_i,name:li,fn:dn}),_i.every(xu=>!xu.hasConversion)&&(ke[li]=dn)}}Te.sort(ae);let We=be(Be,ke,ro),B;for(B in ke)Object.prototype.hasOwnProperty.call(ke,B)&&(ke[B]=We[ke[B]]);let Q=[],ve=new Map;for(B of Te)ve.has(B.name)||(B.fn=We[B.fn],Q.push(B),ve.set(B.name,B));let Ie=Q[0]&&Q[0].params.length<=2&&!k(Q[0].params),nr=Q[1]&&Q[1].params.length<=2&&!k(Q[1].params),cr=Q[2]&&Q[2].params.length<=2&&!k(Q[2].params),rt=Q[3]&&Q[3].params.length<=2&&!k(Q[3].params),Ut=Q[4]&&Q[4].params.length<=2&&!k(Q[4].params),an=Q[5]&&Q[5].params.length<=2&&!k(Q[5].params),Ti=Ie&&nr&&cr&&rt&&Ut&&an;for(let it=0;itit.test),gu=Q.map(it=>it.implementation),yu=function(){for(let dn=vl;dnD(T(we))),le=J(arguments);if(typeof le!="function")throw new TypeError("Callback function expected as last argument");return ue(ee,le)}function ue(ee,le){return{referTo:{references:ee,callback:le}}}function Me(ee){if(typeof ee!="function")throw new TypeError("Callback function expected as first argument");return{referToSelf:{callback:ee}}}function Ee(ee){return ee&&typeof ee.referTo=="object"&&Array.isArray(ee.referTo.references)&&typeof ee.referTo.callback=="function"}function qe(ee){return ee&&typeof ee.referToSelf=="object"&&typeof ee.referToSelf.callback=="function"}function Pe(ee,le){if(!ee)return le;if(le&&le!==ee){let we=new Error("Function names do not match (expected: "+ee+", actual: "+le+")");throw we.data={actual:le,expected:ee},we}return ee}function lr(ee){let le;for(let we in ee)Object.prototype.hasOwnProperty.call(ee,we)&&(E(ee[we])||typeof ee[we].signature=="string")&&(le=Pe(le,ee[we].name));return le}function sr(ee,le){let we;for(we in le)if(Object.prototype.hasOwnProperty.call(le,we)){if(we in ee&&le[we]!==ee[we]){let Be=new Error('Signature "'+we+'" is defined twice');throw Be.data={signature:we,sourceFunction:le[we],destFunction:ee[we]},Be}ee[we]=le[we]}}let Je=p;p=function(ee){let le=typeof ee=="string",we=le?1:0,Be=le?ee:"",ke={};for(let Te=we;Teke.from===ee.from);if(!we)throw new Error("Attempt to remove nonexistent conversion from "+ee.from+" to "+ee.to);if(we.convert!==ee.convert)throw new Error("Conversion to remove does not match existing conversion");let Be=le.conversionsTo.indexOf(we);le.conversionsTo.splice(Be,1)},p.resolve=function(ee,le){if(!E(ee))throw new TypeError(n);let we=ee._typedFunctionData.signatures;for(let Be=0;Be{(function(e){"use strict";var r=Math.cosh||function(o){return Math.abs(o)<1e-9?1-o:(Math.exp(o)+Math.exp(-o))*.5},t=Math.sinh||function(o){return Math.abs(o)<1e-9?o:(Math.exp(o)-Math.exp(-o))*.5},n=function(o){var u=Math.PI/4;if(-u>o||o>u)return Math.cos(o)-1;var m=o*o;return m*(m*(m*(m*(m*(m*(m*(m/20922789888e3-1/87178291200)+1/479001600)-1/3628800)+1/40320)-1/720)+1/24)-1/2)},a=function(o,u){var m=Math.abs(o),p=Math.abs(u);return m<3e3&&p<3e3?Math.sqrt(m*m+p*p):(m0&&i();break;case"number":m.im=0,m.re=o;break;default:i()}return isNaN(m.re)||isNaN(m.im),m};function f(o,u){if(!(this instanceof f))return new f(o,u);var m=c(o,u);this.re=m.re,this.im=m.im}f.prototype={re:0,im:0,sign:function(){var o=this.abs();return new f(this.re/o,this.im/o)},add:function(o,u){var m=new f(o,u);return this.isInfinite()&&m.isInfinite()?f.NAN:this.isInfinite()||m.isInfinite()?f.INFINITY:new f(this.re+m.re,this.im+m.im)},sub:function(o,u){var m=new f(o,u);return this.isInfinite()&&m.isInfinite()?f.NAN:this.isInfinite()||m.isInfinite()?f.INFINITY:new f(this.re-m.re,this.im-m.im)},mul:function(o,u){var m=new f(o,u);return this.isInfinite()&&m.isZero()||this.isZero()&&m.isInfinite()?f.NAN:this.isInfinite()||m.isInfinite()?f.INFINITY:m.im===0&&this.im===0?new f(this.re*m.re,0):new f(this.re*m.re-this.im*m.im,this.re*m.im+this.im*m.re)},div:function(o,u){var m=new f(o,u);if(this.isZero()&&m.isZero()||this.isInfinite()&&m.isInfinite())return f.NAN;if(this.isInfinite()||m.isZero())return f.INFINITY;if(this.isZero()||m.isInfinite())return f.ZERO;o=this.re,u=this.im;var p=m.re,h=m.im,y,v;return h===0?new f(o/p,u/p):Math.abs(p)0)return new f(Math.pow(o,m.re),0);if(o===0)switch((m.re%4+4)%4){case 0:return new f(Math.pow(u,m.re),0);case 1:return new f(0,Math.pow(u,m.re));case 2:return new f(-Math.pow(u,m.re),0);case 3:return new f(0,-Math.pow(u,m.re))}}if(o===0&&u===0&&m.re>0&&m.im>=0)return f.ZERO;var p=Math.atan2(u,o),h=s(o,u);return o=Math.exp(m.re*h-m.im*p),u=m.im*h+m.re*p,new f(o*Math.cos(u),o*Math.sin(u))},sqrt:function(){var o=this.re,u=this.im,m=this.abs(),p,h;if(o>=0){if(u===0)return new f(Math.sqrt(o),0);p=.5*Math.sqrt(2*(m+o))}else p=Math.abs(u)/Math.sqrt(2*(m-o));return o<=0?h=.5*Math.sqrt(2*(m-o)):h=Math.abs(u)/Math.sqrt(2*(m+o)),new f(p,u<0?-h:h)},exp:function(){var o=Math.exp(this.re);return this.im,new f(o*Math.cos(this.im),o*Math.sin(this.im))},expm1:function(){var o=this.re,u=this.im;return new f(Math.expm1(o)*Math.cos(u)+n(u),Math.exp(o)*Math.sin(u))},log:function(){var o=this.re,u=this.im;return u===0&&o>0,new f(s(o,u),Math.atan2(u,o))},abs:function(){return a(this.re,this.im)},arg:function(){return Math.atan2(this.im,this.re)},sin:function(){var o=this.re,u=this.im;return new f(Math.sin(o)*r(u),Math.cos(o)*t(u))},cos:function(){var o=this.re,u=this.im;return new f(Math.cos(o)*r(u),-Math.sin(o)*t(u))},tan:function(){var o=2*this.re,u=2*this.im,m=Math.cos(o)+r(u);return new f(Math.sin(o)/m,t(u)/m)},cot:function(){var o=2*this.re,u=2*this.im,m=Math.cos(o)-r(u);return new f(-Math.sin(o)/m,t(u)/m)},sec:function(){var o=this.re,u=this.im,m=.5*r(2*u)+.5*Math.cos(2*o);return new f(Math.cos(o)*r(u)/m,Math.sin(o)*t(u)/m)},csc:function(){var o=this.re,u=this.im,m=.5*r(2*u)-.5*Math.cos(2*o);return new f(Math.sin(o)*r(u)/m,-Math.cos(o)*t(u)/m)},asin:function(){var o=this.re,u=this.im,m=new f(u*u-o*o+1,-2*o*u).sqrt(),p=new f(m.re-u,m.im+o).log();return new f(p.im,-p.re)},acos:function(){var o=this.re,u=this.im,m=new f(u*u-o*o+1,-2*o*u).sqrt(),p=new f(m.re-u,m.im+o).log();return new f(Math.PI/2-p.im,p.re)},atan:function(){var o=this.re,u=this.im;if(o===0){if(u===1)return new f(0,1/0);if(u===-1)return new f(0,-1/0)}var m=o*o+(1-u)*(1-u),p=new f((1-u*u-o*o)/m,-2*o/m).log();return new f(-.5*p.im,.5*p.re)},acot:function(){var o=this.re,u=this.im;if(u===0)return new f(Math.atan2(1,o),0);var m=o*o+u*u;return m!==0?new f(o/m,-u/m).atan():new f(o!==0?o/0:0,u!==0?-u/0:0).atan()},asec:function(){var o=this.re,u=this.im;if(o===0&&u===0)return new f(0,1/0);var m=o*o+u*u;return m!==0?new f(o/m,-u/m).acos():new f(o!==0?o/0:0,u!==0?-u/0:0).acos()},acsc:function(){var o=this.re,u=this.im;if(o===0&&u===0)return new f(Math.PI/2,1/0);var m=o*o+u*u;return m!==0?new f(o/m,-u/m).asin():new f(o!==0?o/0:0,u!==0?-u/0:0).asin()},sinh:function(){var o=this.re,u=this.im;return new f(t(o)*Math.cos(u),r(o)*Math.sin(u))},cosh:function(){var o=this.re,u=this.im;return new f(r(o)*Math.cos(u),t(o)*Math.sin(u))},tanh:function(){var o=2*this.re,u=2*this.im,m=r(o)+Math.cos(u);return new f(t(o)/m,Math.sin(u)/m)},coth:function(){var o=2*this.re,u=2*this.im,m=r(o)-Math.cos(u);return new f(t(o)/m,-Math.sin(u)/m)},csch:function(){var o=this.re,u=this.im,m=Math.cos(2*u)-r(2*o);return new f(-2*t(o)*Math.cos(u)/m,2*r(o)*Math.sin(u)/m)},sech:function(){var o=this.re,u=this.im,m=Math.cos(2*u)+r(2*o);return new f(2*r(o)*Math.cos(u)/m,-2*t(o)*Math.sin(u)/m)},asinh:function(){var o=this.im;this.im=-this.re,this.re=o;var u=this.asin();return this.re=-this.im,this.im=o,o=u.re,u.re=-u.im,u.im=o,u},acosh:function(){var o=this.acos();if(o.im<=0){var u=o.re;o.re=-o.im,o.im=u}else{var u=o.im;o.im=-o.re,o.re=u}return o},atanh:function(){var o=this.re,u=this.im,m=o>1&&u===0,p=1-o,h=1+o,y=p*p+u*u,v=y!==0?new f((h*p-u*u)/y,(u*p+h*u)/y):new f(o!==-1?o/0:0,u!==0?u/0:0),x=v.re;return v.re=s(v.re,v.im)/2,v.im=Math.atan2(v.im,x)/2,m&&(v.im=-v.im),v},acoth:function(){var o=this.re,u=this.im;if(o===0&&u===0)return new f(0,Math.PI/2);var m=o*o+u*u;return m!==0?new f(o/m,-u/m).atanh():new f(o!==0?o/0:0,u!==0?-u/0:0).atanh()},acsch:function(){var o=this.re,u=this.im;if(u===0)return new f(o!==0?Math.log(o+Math.sqrt(o*o+1)):1/0,0);var m=o*o+u*u;return m!==0?new f(o/m,-u/m).asinh():new f(o!==0?o/0:0,u!==0?-u/0:0).asinh()},asech:function(){var o=this.re,u=this.im;if(this.isZero())return f.INFINITY;var m=o*o+u*u;return m!==0?new f(o/m,-u/m).acosh():new f(o!==0?o/0:0,u!==0?-u/0:0).acosh()},inverse:function(){if(this.isZero())return f.INFINITY;if(this.isInfinite())return f.ZERO;var o=this.re,u=this.im,m=o*o+u*u;return new f(o/m,-u/m)},conjugate:function(){return new f(this.re,-this.im)},neg:function(){return new f(-this.re,-this.im)},ceil:function(o){return o=Math.pow(10,o||0),new f(Math.ceil(this.re*o)/o,Math.ceil(this.im*o)/o)},floor:function(o){return o=Math.pow(10,o||0),new f(Math.floor(this.re*o)/o,Math.floor(this.im*o)/o)},round:function(o){return o=Math.pow(10,o||0),new f(Math.round(this.re*o)/o,Math.round(this.im*o)/o)},equals:function(o,u){var m=new f(o,u);return Math.abs(m.re-this.re)<=f.EPSILON&&Math.abs(m.im-this.im)<=f.EPSILON},clone:function(){return new f(this.re,this.im)},toString:function(){var o=this.re,u=this.im,m="";return this.isNaN()?"NaN":this.isInfinite()?"Infinity":(Math.abs(o){(function(e){"use strict";var r=2e3,t={s:1,n:0,d:1};function n(v,x){if(isNaN(v=parseInt(v,10)))throw h();return v*x}function a(v,x){if(x===0)throw p();var b=Object.create(m.prototype);b.s=v<0?-1:1,v=v<0?-v:v;var E=u(v,x);return b.n=v/E,b.d=x/E,b}function i(v){for(var x={},b=v,E=2,w=4;w<=b;){for(;b%E===0;)b/=E,x[E]=(x[E]||0)+1;w+=1+2*E++}return b!==v?b>1&&(x[b]=(x[b]||0)+1):x[v]=(x[v]||0)+1,x}var s=function(v,x){var b=0,E=1,w=1,N=0,M=0,D=0,O=1,_=1,C=0,T=1,k=1,L=1,H=1e7,V;if(v!=null)if(x!==void 0){if(b=v,E=x,w=b*E,b%1!==0||E%1!==0)throw y()}else switch(typeof v){case"object":{if("d"in v&&"n"in v)b=v.n,E=v.d,"s"in v&&(b*=v.s);else if(0 in v)b=v[0],1 in v&&(E=v[1]);else throw h();w=b*E;break}case"number":{if(v<0&&(w=v,v=-v),v%1===0)b=v;else if(v>0){for(v>=1&&(_=Math.pow(10,Math.floor(1+Math.log(v)/Math.LN10)),v/=_);T<=H&&L<=H;)if(V=(C+k)/(T+L),v===V){T+L<=H?(b=C+k,E=T+L):L>T?(b=k,E=L):(b=C,E=T);break}else v>V?(C+=k,T+=L):(k+=C,L+=T),T>H?(b=k,E=L):(b=C,E=T);b*=_}else(isNaN(v)||isNaN(x))&&(E=b=NaN);break}case"string":{if(T=v.match(/\\d+|./g),T===null)throw h();if(T[C]==="-"?(w=-1,C++):T[C]==="+"&&C++,T.length===C+1?M=n(T[C++],w):T[C+1]==="."||T[C]==="."?(T[C]!=="."&&(N=n(T[C++],w)),C++,(C+1===T.length||T[C+1]==="("&&T[C+3]===")"||T[C+1]==="'"&&T[C+3]==="'")&&(M=n(T[C],w),O=Math.pow(10,T[C].length),C++),(T[C]==="("&&T[C+2]===")"||T[C]==="'"&&T[C+2]==="'")&&(D=n(T[C+1],w),_=Math.pow(10,T[C+1].length)-1,C+=3)):T[C+1]==="/"||T[C+1]===":"?(M=n(T[C],w),O=n(T[C+2],1),C+=3):T[C+3]==="/"&&T[C+1]===" "&&(N=n(T[C],w),M=n(T[C+2],w),O=n(T[C+4],1),C+=5),T.length<=C){E=O*_,w=b=D+E*N+_*M;break}}default:throw h()}if(E===0)throw p();t.s=w<0?-1:1,t.n=Math.abs(b),t.d=Math.abs(E)};function c(v,x,b){for(var E=1;x>0;v=v*v%b,x>>=1)x&1&&(E=E*v%b);return E}function f(v,x){for(;x%2===0;x/=2);for(;x%5===0;x/=5);if(x===1)return 0;for(var b=10%x,E=1;b!==1;E++)if(b=b*10%x,E>r)return 0;return E}function o(v,x,b){for(var E=1,w=c(10,b,x),N=0;N<300;N++){if(E===w)return N;E=E*10%x,w=w*10%x}return 0}function u(v,x){if(!v)return x;if(!x)return v;for(;;){if(v%=x,!v)return x;if(x%=v,!x)return v}}function m(v,x){if(s(v,x),this instanceof m)v=u(t.d,t.n),this.s=t.s,this.n=t.n/v,this.d=t.d/v;else return a(t.s*t.n,t.d)}var p=function(){return new Error("Division by Zero")},h=function(){return new Error("Invalid argument")},y=function(){return new Error("Parameters must be integer")};m.prototype={s:1,n:0,d:1,abs:function(){return a(this.n,this.d)},neg:function(){return a(-this.s*this.n,this.d)},add:function(v,x){return s(v,x),a(this.s*this.n*t.d+t.s*this.d*t.n,this.d*t.d)},sub:function(v,x){return s(v,x),a(this.s*this.n*t.d-t.s*this.d*t.n,this.d*t.d)},mul:function(v,x){return s(v,x),a(this.s*t.s*this.n*t.n,this.d*t.d)},div:function(v,x){return s(v,x),a(this.s*t.s*this.n*t.d,this.d*t.n)},clone:function(){return a(this.s*this.n,this.d)},mod:function(v,x){if(isNaN(this.n)||isNaN(this.d))return new m(NaN);if(v===void 0)return a(this.s*this.n%this.d,1);if(s(v,x),t.n===0&&this.d===0)throw p();return a(this.s*(t.d*this.n)%(t.n*this.d),t.d*this.d)},gcd:function(v,x){return s(v,x),a(u(t.n,this.n)*u(t.d,this.d),t.d*this.d)},lcm:function(v,x){return s(v,x),t.n===0&&this.n===0?a(0,1):a(t.n*this.n,u(t.n,this.n)*u(t.d,this.d))},ceil:function(v){return v=Math.pow(10,v||0),isNaN(this.n)||isNaN(this.d)?new m(NaN):a(Math.ceil(v*this.s*this.n/this.d),v)},floor:function(v){return v=Math.pow(10,v||0),isNaN(this.n)||isNaN(this.d)?new m(NaN):a(Math.floor(v*this.s*this.n/this.d),v)},round:function(v){return v=Math.pow(10,v||0),isNaN(this.n)||isNaN(this.d)?new m(NaN):a(Math.round(v*this.s*this.n/this.d),v)},inverse:function(){return a(this.s*this.d,this.n)},pow:function(v,x){if(s(v,x),t.d===1)return t.s<0?a(Math.pow(this.s*this.d,t.n),Math.pow(this.n,t.n)):a(Math.pow(this.s*this.n,t.n),Math.pow(this.d,t.n));if(this.s<0)return null;var b=i(this.n),E=i(this.d),w=1,N=1;for(var M in b)if(M!=="1"){if(M==="0"){w=0;break}if(b[M]*=t.n,b[M]%t.d===0)b[M]/=t.d;else return null;w*=Math.pow(M,b[M])}for(var M in E)if(M!=="1"){if(E[M]*=t.n,E[M]%t.d===0)E[M]/=t.d;else return null;N*=Math.pow(M,E[M])}return t.s<0?a(N,w):a(w,N)},equals:function(v,x){return s(v,x),this.s*this.n*t.d===t.s*t.n*this.d},compare:function(v,x){s(v,x);var b=this.s*this.n*t.d-t.s*t.n*this.d;return(0=0;N--)w=w.inverse().add(b[N]);if(Math.abs(w.sub(x).valueOf())0&&(b+=x,b+=" ",E%=w),b+=E,b+="/",b+=w),b},toLatex:function(v){var x,b="",E=this.n,w=this.d;return this.s<0&&(b+="-"),w===1?b+=E:(v&&(x=Math.floor(E/w))>0&&(b+=x,E%=w),b+="\\\\frac{",b+=E,b+="}{",b+=w,b+="}"),b},toContinued:function(){var v,x=this.n,b=this.d,E=[];if(isNaN(x)||isNaN(b))return E;do E.push(Math.floor(x/b)),v=x%b,x=b,b=v;while(x!==1);return E},toString:function(v){var x=this.n,b=this.d;if(isNaN(x)||isNaN(b))return"NaN";v=v||15;var E=f(x,b),w=o(x,b,E),N=this.s<0?"-":"";if(N+=x/b|0,x%=b,x*=10,x&&(N+="."),E){for(var M=w;M--;)N+=x/b|0,x%=b,x*=10;N+="(";for(var M=E;M--;)N+=x/b|0,x%=b,x*=10;N+=")"}else for(var M=v;x&&M--;)N+=x/b|0,x%=b,x*=10;return N}},typeof SD=="object"?(Object.defineProperty(m,"__esModule",{value:!0}),m.default=m,m.Fraction=m,WE.exports=m):e.Fraction=m})(SD)});var i_=Nn((Qhe,a_)=>{a_.exports=function e(r,t){"use strict";var n=/(^([+\\-]?(?:0|[1-9]\\d*)(?:\\.\\d*)?(?:[eE][+\\-]?\\d+)?)?$|^0x[0-9a-f]+$|\\d+)/gi,a=/(^[ ]*|[ ]*$)/g,i=/(^([\\w ]+,?[\\w ]+)?[\\w ]+,?[\\w ]+\\d+:\\d+(:\\d+)?[\\w ]?|^\\d{1,4}[\\/\\-]\\d{1,4}[\\/\\-]\\d{1,4}|^\\w+, \\w+ \\d+, \\d{4})/,s=/^0x[0-9a-f]+$/i,c=/^0/,f=function(w){return e.insensitive&&(""+w).toLowerCase()||""+w},o=f(r).replace(a,"")||"",u=f(t).replace(a,"")||"",m=o.replace(n,"\\0$1\\0").replace(/\\0$/,"").replace(/^\\0/,"").split("\\0"),p=u.replace(n,"\\0$1\\0").replace(/\\0$/,"").replace(/^\\0/,"").split("\\0"),h=parseInt(o.match(s),16)||m.length!==1&&o.match(i)&&Date.parse(o),y=parseInt(u.match(s),16)||h&&u.match(i)&&Date.parse(u)||null,v,x;if(y){if(hy)return 1}for(var b=0,E=Math.max(m.length,p.length);bx)return 1}return 0}});var uF=Nn((m1e,sF)=>{"use strict";var CS=Object.assign||function(e){for(var r=1;r1&&arguments[1]!==void 0?arguments[1]:{},t=r.preserveFormatting,n=t===void 0?!1:t,a=r.escapeMapFn,i=a===void 0?vZ:a,s=String(e),c="",f=i(CS({},dZ),n?CS({},hZ):{}),o=Object.keys(f),u=function(){var p=!1;o.forEach(function(h,y){p||s.length>=h.length&&s.slice(0,h.length)===h&&(c+=f[o[y]],s=s.slice(h.length,s.length),p=!0)}),p||(c+=s.slice(0,1),s=s.slice(1,s.length))};s;)u();return c}});var LP=Nn((kP,RS)=>{(function(e,r,t){function n(c){var f=this,o=s();f.next=function(){var u=2091639*f.s0+f.c*23283064365386963e-26;return f.s0=f.s1,f.s1=f.s2,f.s2=u-(f.c=u|0)},f.c=1,f.s0=o(" "),f.s1=o(" "),f.s2=o(" "),f.s0-=o(c),f.s0<0&&(f.s0+=1),f.s1-=o(c),f.s1<0&&(f.s1+=1),f.s2-=o(c),f.s2<0&&(f.s2+=1),o=null}function a(c,f){return f.c=c.c,f.s0=c.s0,f.s1=c.s1,f.s2=c.s2,f}function i(c,f){var o=new n(c),u=f&&f.state,m=o.next;return m.int32=function(){return o.next()*4294967296|0},m.double=function(){return m()+(m()*2097152|0)*11102230246251565e-32},m.quick=m,u&&(typeof u=="object"&&a(u,o),m.state=function(){return a(o,{})}),m}function s(){var c=4022871197,f=function(o){o=String(o);for(var u=0;u>>0,m-=c,m*=c,c=m>>>0,m-=c,c+=m*4294967296}return(c>>>0)*23283064365386963e-26};return f}r&&r.exports?r.exports=i:t&&t.amd?t(function(){return i}):this.alea=i})(kP,typeof RS=="object"&&RS,typeof define=="function"&&define)});var UP=Nn((qP,kS)=>{(function(e,r,t){function n(s){var c=this,f="";c.x=0,c.y=0,c.z=0,c.w=0,c.next=function(){var u=c.x^c.x<<11;return c.x=c.y,c.y=c.z,c.z=c.w,c.w^=c.w>>>19^u^u>>>8},s===(s|0)?c.x=s:f+=s;for(var o=0;o>>0)/4294967296};return u.double=function(){do var m=f.next()>>>11,p=(f.next()>>>0)/4294967296,h=(m+p)/(1<<21);while(h===0);return h},u.int32=f.next,u.quick=u,o&&(typeof o=="object"&&a(o,f),u.state=function(){return a(f,{})}),u}r&&r.exports?r.exports=i:t&&t.amd?t(function(){return i}):this.xor128=i})(qP,typeof kS=="object"&&kS,typeof define=="function"&&define)});var YP=Nn((zP,LS)=>{(function(e,r,t){function n(s){var c=this,f="";c.next=function(){var u=c.x^c.x>>>2;return c.x=c.y,c.y=c.z,c.z=c.w,c.w=c.v,(c.d=c.d+362437|0)+(c.v=c.v^c.v<<4^(u^u<<1))|0},c.x=0,c.y=0,c.z=0,c.w=0,c.v=0,s===(s|0)?c.x=s:f+=s;for(var o=0;o>>4),c.next()}function a(s,c){return c.x=s.x,c.y=s.y,c.z=s.z,c.w=s.w,c.v=s.v,c.d=s.d,c}function i(s,c){var f=new n(s),o=c&&c.state,u=function(){return(f.next()>>>0)/4294967296};return u.double=function(){do var m=f.next()>>>11,p=(f.next()>>>0)/4294967296,h=(m+p)/(1<<21);while(h===0);return h},u.int32=f.next,u.quick=u,o&&(typeof o=="object"&&a(o,f),u.state=function(){return a(f,{})}),u}r&&r.exports?r.exports=i:t&&t.amd?t(function(){return i}):this.xorwow=i})(zP,typeof LS=="object"&&LS,typeof define=="function"&&define)});var HP=Nn((WP,qS)=>{(function(e,r,t){function n(s){var c=this;c.next=function(){var o=c.x,u=c.i,m,p,h;return m=o[u],m^=m>>>7,p=m^m<<24,m=o[u+1&7],p^=m^m>>>10,m=o[u+3&7],p^=m^m>>>3,m=o[u+4&7],p^=m^m<<7,m=o[u+7&7],m=m^m<<13,p^=m^m<<9,o[u]=p,c.i=u+1&7,p};function f(o,u){var m,p,h=[];if(u===(u|0))p=h[0]=u;else for(u=""+u,m=0;m0;--m)o.next()}f(c,s)}function a(s,c){return c.x=s.x.slice(),c.i=s.i,c}function i(s,c){s==null&&(s=+new Date);var f=new n(s),o=c&&c.state,u=function(){return(f.next()>>>0)/4294967296};return u.double=function(){do var m=f.next()>>>11,p=(f.next()>>>0)/4294967296,h=(m+p)/(1<<21);while(h===0);return h},u.int32=f.next,u.quick=u,o&&(o.x&&a(o,f),u.state=function(){return a(f,{})}),u}r&&r.exports?r.exports=i:t&&t.amd?t(function(){return i}):this.xorshift7=i})(WP,typeof qS=="object"&&qS,typeof define=="function"&&define)});var GP=Nn(($P,US)=>{(function(e,r,t){function n(s){var c=this;c.next=function(){var o=c.w,u=c.X,m=c.i,p,h;return c.w=o=o+1640531527|0,h=u[m+34&127],p=u[m=m+1&127],h^=h<<13,p^=p<<17,h^=h>>>15,p^=p>>>12,h=u[m]=h^p,c.i=m,h+(o^o>>>16)|0};function f(o,u){var m,p,h,y,v,x=[],b=128;for(u===(u|0)?(p=u,u=null):(u=u+"\\0",p=0,b=Math.max(b,u.length)),h=0,y=-32;y>>15,p^=p<<4,p^=p>>>13,y>=0&&(v=v+1640531527|0,m=x[y&127]^=p+v,h=m==0?h+1:0);for(h>=128&&(x[(u&&u.length||0)&127]=-1),h=127,y=4*128;y>0;--y)p=x[h+34&127],m=x[h=h+1&127],p^=p<<13,m^=m<<17,p^=p>>>15,m^=m>>>12,x[h]=p^m;o.w=v,o.X=x,o.i=h}f(c,s)}function a(s,c){return c.i=s.i,c.w=s.w,c.X=s.X.slice(),c}function i(s,c){s==null&&(s=+new Date);var f=new n(s),o=c&&c.state,u=function(){return(f.next()>>>0)/4294967296};return u.double=function(){do var m=f.next()>>>11,p=(f.next()>>>0)/4294967296,h=(m+p)/(1<<21);while(h===0);return h},u.int32=f.next,u.quick=u,o&&(o.X&&a(o,f),u.state=function(){return a(f,{})}),u}r&&r.exports?r.exports=i:t&&t.amd?t(function(){return i}):this.xor4096=i})($P,typeof US=="object"&&US,typeof define=="function"&&define)});var ZP=Nn((VP,zS)=>{(function(e,r,t){function n(s){var c=this,f="";c.next=function(){var u=c.b,m=c.c,p=c.d,h=c.a;return u=u<<25^u>>>7^m,m=m-p|0,p=p<<24^p>>>8^h,h=h-u|0,c.b=u=u<<20^u>>>12^m,c.c=m=m-p|0,c.d=p<<16^m>>>16^h,c.a=h-u|0},c.a=0,c.b=0,c.c=-1640531527,c.d=1367130551,s===Math.floor(s)?(c.a=s/4294967296|0,c.b=s|0):f+=s;for(var o=0;o>>0)/4294967296};return u.double=function(){do var m=f.next()>>>11,p=(f.next()>>>0)/4294967296,h=(m+p)/(1<<21);while(h===0);return h},u.int32=f.next,u.quick=u,o&&(typeof o=="object"&&a(o,f),u.state=function(){return a(f,{})}),u}r&&r.exports?r.exports=i:t&&t.amd?t(function(){return i}):this.tychei=i})(VP,typeof zS=="object"&&zS,typeof define=="function"&&define)});var QP=Nn(()=>{});var KP=Nn((XP,Yy)=>{(function(e,r,t){var n=256,a=6,i=52,s="random",c=t.pow(n,a),f=t.pow(2,i),o=f*2,u=n-1,m;function p(w,N,M){var D=[];N=N==!0?{entropy:!0}:N||{};var O=x(v(N.entropy?[w,E(r)]:w??b(),3),D),_=new h(D),C=function(){for(var T=_.g(a),k=c,L=0;T=o;)T/=2,k/=2,L>>>=1;return(T+L)/k};return C.int32=function(){return _.g(4)|0},C.quick=function(){return _.g(4)/4294967296},C.double=C,x(E(_.S),r),(N.pass||M||function(T,k,L,H){return H&&(H.S&&y(H,_),T.state=function(){return y(_,{})}),L?(t[s]=T,k):T})(C,O,"global"in N?N.global:this==t,N.state)}function h(w){var N,M=w.length,D=this,O=0,_=D.i=D.j=0,C=D.S=[];for(M||(w=[M++]);O{var BQ=LP(),IQ=UP(),PQ=YP(),RQ=HP(),kQ=GP(),LQ=ZP(),lu=KP();lu.alea=BQ;lu.xor128=IQ;lu.xorwow=PQ;lu.xorshift7=RQ;lu.xor4096=kQ;lu.tychei=LQ;JP.exports=lu});var e6=Nn((J6e,LN)=>{function kN(){}kN.prototype={on:function(e,r,t){var n=this.e||(this.e={});return(n[e]||(n[e]=[])).push({fn:r,ctx:t}),this},once:function(e,r,t){var n=this;function a(){n.off(e,a),r.apply(t,arguments)}return a._=r,this.on(e,a,t)},emit:function(e){var r=[].slice.call(arguments,1),t=((this.e||(this.e={}))[e]||[]).slice(),n=0,a=t.length;for(n;n1?"s":"")+" required, but only "+r.length+" present")}function Qt(e){ut(1,arguments);var r=Object.prototype.toString.call(e);return e instanceof Date||Va(e)==="object"&&r==="[object Date]"?new Date(e.getTime()):typeof e=="number"||r==="[object Number]"?new Date(e):((typeof e=="string"||r==="[object String]")&&typeof console<"u"&&(console.warn("Starting with v2.0.0-beta.1 date-fns doesn't accept strings as date arguments. Please use \`parseISO\` to parse strings. See: https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#string-arguments"),console.warn(new Error().stack)),new Date(NaN))}function xw(e,r){ut(2,arguments);var t=Qt(e).getTime(),n=Bn(r);return new Date(t+n)}var Eq={};function Xo(){return Eq}function bw(e){var r=new Date(Date.UTC(e.getFullYear(),e.getMonth(),e.getDate(),e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds()));return r.setUTCFullYear(e.getFullYear()),e.getTime()-r.getTime()}var Cq=365.2425,Tq=Math.pow(10,8)*24*60*60*1e3,ww=6e4,Dw=36e5;var OK=-Tq;var _q=3600;var dM=_q*24,BK=dM*7,Fq=dM*Cq,Oq=Fq/12,IK=Oq*3;function Sw(e){return ut(1,arguments),e instanceof Date||Va(e)==="object"&&Object.prototype.toString.call(e)==="[object Date]"}function Nw(e){if(ut(1,arguments),!Sw(e)&&typeof e!="number")return!1;var r=Qt(e);return!isNaN(Number(r))}function Aw(e,r){ut(2,arguments);var t=Bn(r);return xw(e,-t)}var Bq=864e5;function Mw(e){ut(1,arguments);var r=Qt(e),t=r.getTime();r.setUTCMonth(0,1),r.setUTCHours(0,0,0,0);var n=r.getTime(),a=t-n;return Math.floor(a/Bq)+1}function Ko(e){ut(1,arguments);var r=1,t=Qt(e),n=t.getUTCDay(),a=(n=a.getTime()?t+1:r.getTime()>=s.getTime()?t:t-1}function Ew(e){ut(1,arguments);var r=Kl(e),t=new Date(0);t.setUTCFullYear(r,0,4),t.setUTCHours(0,0,0,0);var n=Ko(t);return n}var Iq=6048e5;function Cw(e){ut(1,arguments);var r=Qt(e),t=Ko(r).getTime()-Ew(r).getTime();return Math.round(t/Iq)+1}function Jo(e,r){var t,n,a,i,s,c,f,o;ut(1,arguments);var u=Xo(),m=Bn((t=(n=(a=(i=r?.weekStartsOn)!==null&&i!==void 0?i:r==null||(s=r.locale)===null||s===void 0||(c=s.options)===null||c===void 0?void 0:c.weekStartsOn)!==null&&a!==void 0?a:u.weekStartsOn)!==null&&n!==void 0?n:(f=u.locale)===null||f===void 0||(o=f.options)===null||o===void 0?void 0:o.weekStartsOn)!==null&&t!==void 0?t:0);if(!(m>=0&&m<=6))throw new RangeError("weekStartsOn must be between 0 and 6 inclusively");var p=Qt(e),h=p.getUTCDay(),y=(h=1&&h<=7))throw new RangeError("firstWeekContainsDate must be between 1 and 7 inclusively");var y=new Date(0);y.setUTCFullYear(m+1,0,h),y.setUTCHours(0,0,0,0);var v=Jo(y,r),x=new Date(0);x.setUTCFullYear(m,0,h),x.setUTCHours(0,0,0,0);var b=Jo(x,r);return u.getTime()>=v.getTime()?m+1:u.getTime()>=b.getTime()?m:m-1}function Tw(e,r){var t,n,a,i,s,c,f,o;ut(1,arguments);var u=Xo(),m=Bn((t=(n=(a=(i=r?.firstWeekContainsDate)!==null&&i!==void 0?i:r==null||(s=r.locale)===null||s===void 0||(c=s.options)===null||c===void 0?void 0:c.firstWeekContainsDate)!==null&&a!==void 0?a:u.firstWeekContainsDate)!==null&&n!==void 0?n:(f=u.locale)===null||f===void 0||(o=f.options)===null||o===void 0?void 0:o.firstWeekContainsDate)!==null&&t!==void 0?t:1),p=Jl(e,r),h=new Date(0);h.setUTCFullYear(p,0,m),h.setUTCHours(0,0,0,0);var y=Jo(h,r);return y}var Pq=6048e5;function _w(e,r){ut(1,arguments);var t=Qt(e),n=Jo(t,r).getTime()-Tw(t,r).getTime();return Math.round(n/Pq)+1}function mt(e,r){for(var t=e<0?"-":"",n=Math.abs(e).toString();n.length0?n:1-n;return mt(t==="yy"?a%100:a,t.length)},M:function(r,t){var n=r.getUTCMonth();return t==="M"?String(n+1):mt(n+1,2)},d:function(r,t){return mt(r.getUTCDate(),t.length)},a:function(r,t){var n=r.getUTCHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":return n.toUpperCase();case"aaa":return n;case"aaaaa":return n[0];case"aaaa":default:return n==="am"?"a.m.":"p.m."}},h:function(r,t){return mt(r.getUTCHours()%12||12,t.length)},H:function(r,t){return mt(r.getUTCHours(),t.length)},m:function(r,t){return mt(r.getUTCMinutes(),t.length)},s:function(r,t){return mt(r.getUTCSeconds(),t.length)},S:function(r,t){var n=t.length,a=r.getUTCMilliseconds(),i=Math.floor(a*Math.pow(10,n-3));return mt(i,t.length)}},vo=Rq;var Vu={am:"am",pm:"pm",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},kq={G:function(r,t,n){var a=r.getUTCFullYear()>0?1:0;switch(t){case"G":case"GG":case"GGG":return n.era(a,{width:"abbreviated"});case"GGGGG":return n.era(a,{width:"narrow"});case"GGGG":default:return n.era(a,{width:"wide"})}},y:function(r,t,n){if(t==="yo"){var a=r.getUTCFullYear(),i=a>0?a:1-a;return n.ordinalNumber(i,{unit:"year"})}return vo.y(r,t)},Y:function(r,t,n,a){var i=Jl(r,a),s=i>0?i:1-i;if(t==="YY"){var c=s%100;return mt(c,2)}return t==="Yo"?n.ordinalNumber(s,{unit:"year"}):mt(s,t.length)},R:function(r,t){var n=Kl(r);return mt(n,t.length)},u:function(r,t){var n=r.getUTCFullYear();return mt(n,t.length)},Q:function(r,t,n){var a=Math.ceil((r.getUTCMonth()+1)/3);switch(t){case"Q":return String(a);case"QQ":return mt(a,2);case"Qo":return n.ordinalNumber(a,{unit:"quarter"});case"QQQ":return n.quarter(a,{width:"abbreviated",context:"formatting"});case"QQQQQ":return n.quarter(a,{width:"narrow",context:"formatting"});case"QQQQ":default:return n.quarter(a,{width:"wide",context:"formatting"})}},q:function(r,t,n){var a=Math.ceil((r.getUTCMonth()+1)/3);switch(t){case"q":return String(a);case"qq":return mt(a,2);case"qo":return n.ordinalNumber(a,{unit:"quarter"});case"qqq":return n.quarter(a,{width:"abbreviated",context:"standalone"});case"qqqqq":return n.quarter(a,{width:"narrow",context:"standalone"});case"qqqq":default:return n.quarter(a,{width:"wide",context:"standalone"})}},M:function(r,t,n){var a=r.getUTCMonth();switch(t){case"M":case"MM":return vo.M(r,t);case"Mo":return n.ordinalNumber(a+1,{unit:"month"});case"MMM":return n.month(a,{width:"abbreviated",context:"formatting"});case"MMMMM":return n.month(a,{width:"narrow",context:"formatting"});case"MMMM":default:return n.month(a,{width:"wide",context:"formatting"})}},L:function(r,t,n){var a=r.getUTCMonth();switch(t){case"L":return String(a+1);case"LL":return mt(a+1,2);case"Lo":return n.ordinalNumber(a+1,{unit:"month"});case"LLL":return n.month(a,{width:"abbreviated",context:"standalone"});case"LLLLL":return n.month(a,{width:"narrow",context:"standalone"});case"LLLL":default:return n.month(a,{width:"wide",context:"standalone"})}},w:function(r,t,n,a){var i=_w(r,a);return t==="wo"?n.ordinalNumber(i,{unit:"week"}):mt(i,t.length)},I:function(r,t,n){var a=Cw(r);return t==="Io"?n.ordinalNumber(a,{unit:"week"}):mt(a,t.length)},d:function(r,t,n){return t==="do"?n.ordinalNumber(r.getUTCDate(),{unit:"date"}):vo.d(r,t)},D:function(r,t,n){var a=Mw(r);return t==="Do"?n.ordinalNumber(a,{unit:"dayOfYear"}):mt(a,t.length)},E:function(r,t,n){var a=r.getUTCDay();switch(t){case"E":case"EE":case"EEE":return n.day(a,{width:"abbreviated",context:"formatting"});case"EEEEE":return n.day(a,{width:"narrow",context:"formatting"});case"EEEEEE":return n.day(a,{width:"short",context:"formatting"});case"EEEE":default:return n.day(a,{width:"wide",context:"formatting"})}},e:function(r,t,n,a){var i=r.getUTCDay(),s=(i-a.weekStartsOn+8)%7||7;switch(t){case"e":return String(s);case"ee":return mt(s,2);case"eo":return n.ordinalNumber(s,{unit:"day"});case"eee":return n.day(i,{width:"abbreviated",context:"formatting"});case"eeeee":return n.day(i,{width:"narrow",context:"formatting"});case"eeeeee":return n.day(i,{width:"short",context:"formatting"});case"eeee":default:return n.day(i,{width:"wide",context:"formatting"})}},c:function(r,t,n,a){var i=r.getUTCDay(),s=(i-a.weekStartsOn+8)%7||7;switch(t){case"c":return String(s);case"cc":return mt(s,t.length);case"co":return n.ordinalNumber(s,{unit:"day"});case"ccc":return n.day(i,{width:"abbreviated",context:"standalone"});case"ccccc":return n.day(i,{width:"narrow",context:"standalone"});case"cccccc":return n.day(i,{width:"short",context:"standalone"});case"cccc":default:return n.day(i,{width:"wide",context:"standalone"})}},i:function(r,t,n){var a=r.getUTCDay(),i=a===0?7:a;switch(t){case"i":return String(i);case"ii":return mt(i,t.length);case"io":return n.ordinalNumber(i,{unit:"day"});case"iii":return n.day(a,{width:"abbreviated",context:"formatting"});case"iiiii":return n.day(a,{width:"narrow",context:"formatting"});case"iiiiii":return n.day(a,{width:"short",context:"formatting"});case"iiii":default:return n.day(a,{width:"wide",context:"formatting"})}},a:function(r,t,n){var a=r.getUTCHours(),i=a/12>=1?"pm":"am";switch(t){case"a":case"aa":return n.dayPeriod(i,{width:"abbreviated",context:"formatting"});case"aaa":return n.dayPeriod(i,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return n.dayPeriod(i,{width:"narrow",context:"formatting"});case"aaaa":default:return n.dayPeriod(i,{width:"wide",context:"formatting"})}},b:function(r,t,n){var a=r.getUTCHours(),i;switch(a===12?i=Vu.noon:a===0?i=Vu.midnight:i=a/12>=1?"pm":"am",t){case"b":case"bb":return n.dayPeriod(i,{width:"abbreviated",context:"formatting"});case"bbb":return n.dayPeriod(i,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return n.dayPeriod(i,{width:"narrow",context:"formatting"});case"bbbb":default:return n.dayPeriod(i,{width:"wide",context:"formatting"})}},B:function(r,t,n){var a=r.getUTCHours(),i;switch(a>=17?i=Vu.evening:a>=12?i=Vu.afternoon:a>=4?i=Vu.morning:i=Vu.night,t){case"B":case"BB":case"BBB":return n.dayPeriod(i,{width:"abbreviated",context:"formatting"});case"BBBBB":return n.dayPeriod(i,{width:"narrow",context:"formatting"});case"BBBB":default:return n.dayPeriod(i,{width:"wide",context:"formatting"})}},h:function(r,t,n){if(t==="ho"){var a=r.getUTCHours()%12;return a===0&&(a=12),n.ordinalNumber(a,{unit:"hour"})}return vo.h(r,t)},H:function(r,t,n){return t==="Ho"?n.ordinalNumber(r.getUTCHours(),{unit:"hour"}):vo.H(r,t)},K:function(r,t,n){var a=r.getUTCHours()%12;return t==="Ko"?n.ordinalNumber(a,{unit:"hour"}):mt(a,t.length)},k:function(r,t,n){var a=r.getUTCHours();return a===0&&(a=24),t==="ko"?n.ordinalNumber(a,{unit:"hour"}):mt(a,t.length)},m:function(r,t,n){return t==="mo"?n.ordinalNumber(r.getUTCMinutes(),{unit:"minute"}):vo.m(r,t)},s:function(r,t,n){return t==="so"?n.ordinalNumber(r.getUTCSeconds(),{unit:"second"}):vo.s(r,t)},S:function(r,t){return vo.S(r,t)},X:function(r,t,n,a){var i=a._originalDate||r,s=i.getTimezoneOffset();if(s===0)return"Z";switch(t){case"X":return vM(s);case"XXXX":case"XX":return Ws(s);case"XXXXX":case"XXX":default:return Ws(s,":")}},x:function(r,t,n,a){var i=a._originalDate||r,s=i.getTimezoneOffset();switch(t){case"x":return vM(s);case"xxxx":case"xx":return Ws(s);case"xxxxx":case"xxx":default:return Ws(s,":")}},O:function(r,t,n,a){var i=a._originalDate||r,s=i.getTimezoneOffset();switch(t){case"O":case"OO":case"OOO":return"GMT"+hM(s,":");case"OOOO":default:return"GMT"+Ws(s,":")}},z:function(r,t,n,a){var i=a._originalDate||r,s=i.getTimezoneOffset();switch(t){case"z":case"zz":case"zzz":return"GMT"+hM(s,":");case"zzzz":default:return"GMT"+Ws(s,":")}},t:function(r,t,n,a){var i=a._originalDate||r,s=Math.floor(i.getTime()/1e3);return mt(s,t.length)},T:function(r,t,n,a){var i=a._originalDate||r,s=i.getTime();return mt(s,t.length)}};function hM(e,r){var t=e>0?"-":"+",n=Math.abs(e),a=Math.floor(n/60),i=n%60;if(i===0)return t+String(a);var s=r||"";return t+String(a)+s+mt(i,2)}function vM(e,r){if(e%60===0){var t=e>0?"-":"+";return t+mt(Math.abs(e)/60,2)}return Ws(e,r)}function Ws(e,r){var t=r||"",n=e>0?"-":"+",a=Math.abs(e),i=mt(Math.floor(a/60),2),s=mt(a%60,2);return n+i+t+s}var gM=kq;var yM=function(r,t){switch(r){case"P":return t.date({width:"short"});case"PP":return t.date({width:"medium"});case"PPP":return t.date({width:"long"});case"PPPP":default:return t.date({width:"full"})}},xM=function(r,t){switch(r){case"p":return t.time({width:"short"});case"pp":return t.time({width:"medium"});case"ppp":return t.time({width:"long"});case"pppp":default:return t.time({width:"full"})}},Lq=function(r,t){var n=r.match(/(P+)(p+)?/)||[],a=n[1],i=n[2];if(!i)return yM(r,t);var s;switch(a){case"P":s=t.dateTime({width:"short"});break;case"PP":s=t.dateTime({width:"medium"});break;case"PPP":s=t.dateTime({width:"long"});break;case"PPPP":default:s=t.dateTime({width:"full"});break}return s.replace("{{date}}",yM(a,t)).replace("{{time}}",xM(i,t))},qq={p:xM,P:Lq},bM=qq;var Uq=["D","DD"],zq=["YY","YYYY"];function wM(e){return Uq.indexOf(e)!==-1}function DM(e){return zq.indexOf(e)!==-1}function Fw(e,r,t){if(e==="YYYY")throw new RangeError("Use \`yyyy\` instead of \`YYYY\` (in \`".concat(r,"\`) for formatting years to the input \`").concat(t,"\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md"));if(e==="YY")throw new RangeError("Use \`yy\` instead of \`YY\` (in \`".concat(r,"\`) for formatting years to the input \`").concat(t,"\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md"));if(e==="D")throw new RangeError("Use \`d\` instead of \`D\` (in \`".concat(r,"\`) for formatting days of the month to the input \`").concat(t,"\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md"));if(e==="DD")throw new RangeError("Use \`dd\` instead of \`DD\` (in \`".concat(r,"\`) for formatting days of the month to the input \`").concat(t,"\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md"))}var Yq={lessThanXSeconds:{one:"less than a second",other:"less than {{count}} seconds"},xSeconds:{one:"1 second",other:"{{count}} seconds"},halfAMinute:"half a minute",lessThanXMinutes:{one:"less than a minute",other:"less than {{count}} minutes"},xMinutes:{one:"1 minute",other:"{{count}} minutes"},aboutXHours:{one:"about 1 hour",other:"about {{count}} hours"},xHours:{one:"1 hour",other:"{{count}} hours"},xDays:{one:"1 day",other:"{{count}} days"},aboutXWeeks:{one:"about 1 week",other:"about {{count}} weeks"},xWeeks:{one:"1 week",other:"{{count}} weeks"},aboutXMonths:{one:"about 1 month",other:"about {{count}} months"},xMonths:{one:"1 month",other:"{{count}} months"},aboutXYears:{one:"about 1 year",other:"about {{count}} years"},xYears:{one:"1 year",other:"{{count}} years"},overXYears:{one:"over 1 year",other:"over {{count}} years"},almostXYears:{one:"almost 1 year",other:"almost {{count}} years"}},Wq=function(r,t,n){var a,i=Yq[r];return typeof i=="string"?a=i:t===1?a=i.one:a=i.other.replace("{{count}}",t.toString()),n!=null&&n.addSuffix?n.comparison&&n.comparison>0?"in "+a:a+" ago":a},SM=Wq;function jl(e){return function(){var r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t=r.width?String(r.width):e.defaultWidth,n=e.formats[t]||e.formats[e.defaultWidth];return n}}var Hq={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},$q={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},Gq={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},Vq={date:jl({formats:Hq,defaultWidth:"full"}),time:jl({formats:$q,defaultWidth:"full"}),dateTime:jl({formats:Gq,defaultWidth:"full"})},NM=Vq;var Zq={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},Qq=function(r,t,n,a){return Zq[r]},AM=Qq;function Hs(e){return function(r,t){var n=t!=null&&t.context?String(t.context):"standalone",a;if(n==="formatting"&&e.formattingValues){var i=e.defaultFormattingWidth||e.defaultWidth,s=t!=null&&t.width?String(t.width):i;a=e.formattingValues[s]||e.formattingValues[i]}else{var c=e.defaultWidth,f=t!=null&&t.width?String(t.width):e.defaultWidth;a=e.values[f]||e.values[c]}var o=e.argumentCallback?e.argumentCallback(r):r;return a[o]}}var Xq={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},Kq={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},Jq={narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],wide:["January","February","March","April","May","June","July","August","September","October","November","December"]},jq={narrow:["S","M","T","W","T","F","S"],short:["Su","Mo","Tu","We","Th","Fr","Sa"],abbreviated:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],wide:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},eU={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"}},rU={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"}},tU=function(r,t){var n=Number(r),a=n%100;if(a>20||a<10)switch(a%10){case 1:return n+"st";case 2:return n+"nd";case 3:return n+"rd"}return n+"th"},nU={ordinalNumber:tU,era:Hs({values:Xq,defaultWidth:"wide"}),quarter:Hs({values:Kq,defaultWidth:"wide",argumentCallback:function(r){return r-1}}),month:Hs({values:Jq,defaultWidth:"wide"}),day:Hs({values:jq,defaultWidth:"wide"}),dayPeriod:Hs({values:eU,defaultWidth:"wide",formattingValues:rU,defaultFormattingWidth:"wide"})},MM=nU;function $s(e){return function(r){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=t.width,a=n&&e.matchPatterns[n]||e.matchPatterns[e.defaultMatchWidth],i=r.match(a);if(!i)return null;var s=i[0],c=n&&e.parsePatterns[n]||e.parsePatterns[e.defaultParseWidth],f=Array.isArray(c)?iU(c,function(m){return m.test(s)}):aU(c,function(m){return m.test(s)}),o;o=e.valueCallback?e.valueCallback(f):f,o=t.valueCallback?t.valueCallback(o):o;var u=r.slice(s.length);return{value:o,rest:u}}}function aU(e,r){for(var t in e)if(e.hasOwnProperty(t)&&r(e[t]))return t}function iU(e,r){for(var t=0;t1&&arguments[1]!==void 0?arguments[1]:{},n=r.match(e.matchPattern);if(!n)return null;var a=n[0],i=r.match(e.parsePattern);if(!i)return null;var s=e.valueCallback?e.valueCallback(i[0]):i[0];s=t.valueCallback?t.valueCallback(s):s;var c=r.slice(a.length);return{value:s,rest:c}}}var oU=/^(\\d+)(th|st|nd|rd)?/i,sU=/\\d+/i,uU={narrow:/^(b|a)/i,abbreviated:/^(b\\.?\\s?c\\.?|b\\.?\\s?c\\.?\\s?e\\.?|a\\.?\\s?d\\.?|c\\.?\\s?e\\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},fU={any:[/^b/i,/^(a|c)/i]},lU={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},cU={any:[/1/i,/2/i,/3/i,/4/i]},mU={narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},pU={narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},dU={narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},hU={narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},vU={narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\\.?\\s?m\\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},gU={any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},yU={ordinalNumber:Ow({matchPattern:oU,parsePattern:sU,valueCallback:function(r){return parseInt(r,10)}}),era:$s({matchPatterns:uU,defaultMatchWidth:"wide",parsePatterns:fU,defaultParseWidth:"any"}),quarter:$s({matchPatterns:lU,defaultMatchWidth:"wide",parsePatterns:cU,defaultParseWidth:"any",valueCallback:function(r){return r+1}}),month:$s({matchPatterns:mU,defaultMatchWidth:"wide",parsePatterns:pU,defaultParseWidth:"any"}),day:$s({matchPatterns:dU,defaultMatchWidth:"wide",parsePatterns:hU,defaultParseWidth:"any"}),dayPeriod:$s({matchPatterns:vU,defaultMatchWidth:"any",parsePatterns:gU,defaultParseWidth:"any"})},EM=yU;var xU={code:"en-US",formatDistance:SM,formatLong:NM,formatRelative:AM,localize:MM,match:EM,options:{weekStartsOn:0,firstWeekContainsDate:1}},CM=xU;var TM=CM;var bU=/[yYQqMLwIdDecihHKkms]o|(\\w)\\1*|''|'(''|[^'])+('|$)|./g,wU=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,DU=/^'([^]*?)'?$/,SU=/''/g,NU=/[a-zA-Z]/;function Yi(e,r,t){var n,a,i,s,c,f,o,u,m,p,h,y,v,x,b,E,w,N;ut(2,arguments);var M=String(r),D=Xo(),O=(n=(a=t?.locale)!==null&&a!==void 0?a:D.locale)!==null&&n!==void 0?n:TM,_=Bn((i=(s=(c=(f=t?.firstWeekContainsDate)!==null&&f!==void 0?f:t==null||(o=t.locale)===null||o===void 0||(u=o.options)===null||u===void 0?void 0:u.firstWeekContainsDate)!==null&&c!==void 0?c:D.firstWeekContainsDate)!==null&&s!==void 0?s:(m=D.locale)===null||m===void 0||(p=m.options)===null||p===void 0?void 0:p.firstWeekContainsDate)!==null&&i!==void 0?i:1);if(!(_>=1&&_<=7))throw new RangeError("firstWeekContainsDate must be between 1 and 7 inclusively");var C=Bn((h=(y=(v=(x=t?.weekStartsOn)!==null&&x!==void 0?x:t==null||(b=t.locale)===null||b===void 0||(E=b.options)===null||E===void 0?void 0:E.weekStartsOn)!==null&&v!==void 0?v:D.weekStartsOn)!==null&&y!==void 0?y:(w=D.locale)===null||w===void 0||(N=w.options)===null||N===void 0?void 0:N.weekStartsOn)!==null&&h!==void 0?h:0);if(!(C>=0&&C<=6))throw new RangeError("weekStartsOn must be between 0 and 6 inclusively");if(!O.localize)throw new RangeError("locale must contain localize property");if(!O.formatLong)throw new RangeError("locale must contain formatLong property");var T=Qt(e);if(!Nw(T))throw new RangeError("Invalid time value");var k=bw(T),L=Aw(T,k),H={firstWeekContainsDate:_,weekStartsOn:C,locale:O,_originalDate:T},V=M.match(wU).map(function(W){var q=W[0];if(q==="p"||q==="P"){var R=bM[q];return R(W,O.formatLong)}return W}).join("").match(bU).map(function(W){if(W==="''")return"'";var q=W[0];if(q==="'")return AU(W);var R=gM[q];if(R)return!(t!=null&&t.useAdditionalWeekYearTokens)&&DM(W)&&Fw(W,r,String(e)),!(t!=null&&t.useAdditionalDayOfYearTokens)&&wM(W)&&Fw(W,r,String(e)),R(L,W,O.localize,H);if(q.match(NU))throw new RangeError("Format string contains an unescaped latin alphabet character \`"+q+"\`");return W}).join("");return V}function AU(e){var r=e.match(DU);return r?r[1].replace(SU,"'"):e}function Bw(e,r){if(Va(e)!="object"||!e)return e;var t=e[Symbol.toPrimitive];if(t!==void 0){var n=t.call(e,r||"default");if(Va(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(r==="string"?String:Number)(e)}function Iw(e){var r=Bw(e,"string");return Va(r)=="symbol"?r:r+""}function Vr(e,r,t){return r=Iw(r),r in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}function Km(e,r){var t;ut(1,arguments);var n=Bn((t=r?.additionalDigits)!==null&&t!==void 0?t:2);if(n!==2&&n!==1&&n!==0)throw new RangeError("additionalDigits must be 0, 1 or 2");if(!(typeof e=="string"||Object.prototype.toString.call(e)==="[object String]"))return new Date(NaN);var a=TU(e),i;if(a.date){var s=_U(a.date,n);i=FU(s.restDateString,s.year)}if(!i||isNaN(i.getTime()))return new Date(NaN);var c=i.getTime(),f=0,o;if(a.time&&(f=OU(a.time),isNaN(f)))return new Date(NaN);if(a.timezone){if(o=BU(a.timezone),isNaN(o))return new Date(NaN)}else{var u=new Date(c+f),m=new Date(0);return m.setFullYear(u.getUTCFullYear(),u.getUTCMonth(),u.getUTCDate()),m.setHours(u.getUTCHours(),u.getUTCMinutes(),u.getUTCSeconds(),u.getUTCMilliseconds()),m}return new Date(c+f+o)}var Xm={dateTimeDelimiter:/[T ]/,timeZoneDelimiter:/[Z ]/i,timezone:/([Z+-].*)$/},MU=/^-?(?:(\\d{3})|(\\d{2})(?:-?(\\d{2}))?|W(\\d{2})(?:-?(\\d{1}))?|)$/,EU=/^(\\d{2}(?:[.,]\\d*)?)(?::?(\\d{2}(?:[.,]\\d*)?))?(?::?(\\d{2}(?:[.,]\\d*)?))?$/,CU=/^([+-])(\\d{2})(?::?(\\d{2}))?$/;function TU(e){var r={},t=e.split(Xm.dateTimeDelimiter),n;if(t.length>2)return r;if(/:/.test(t[0])?n=t[0]:(r.date=t[0],n=t[1],Xm.timeZoneDelimiter.test(r.date)&&(r.date=e.split(Xm.timeZoneDelimiter)[0],n=e.substr(r.date.length,e.length))),n){var a=Xm.timezone.exec(n);a?(r.time=n.replace(a[1],""),r.timezone=a[1]):r.time=n}return r}function _U(e,r){var t=new RegExp("^(?:(\\\\d{4}|[+-]\\\\d{"+(4+r)+"})|(\\\\d{2}|[+-]\\\\d{"+(2+r)+"})$)"),n=e.match(t);if(!n)return{year:NaN,restDateString:""};var a=n[1]?parseInt(n[1]):null,i=n[2]?parseInt(n[2]):null;return{year:i===null?a:i*100,restDateString:e.slice((n[1]||n[2]).length)}}function FU(e,r){if(r===null)return new Date(NaN);var t=e.match(MU);if(!t)return new Date(NaN);var n=!!t[4],a=ec(t[1]),i=ec(t[2])-1,s=ec(t[3]),c=ec(t[4]),f=ec(t[5])-1;if(n)return LU(r,c,f)?IU(r,c,f):new Date(NaN);var o=new Date(0);return!RU(r,i,s)||!kU(r,a)?new Date(NaN):(o.setUTCFullYear(r,i,Math.max(a,s)),o)}function ec(e){return e?parseInt(e):1}function OU(e){var r=e.match(EU);if(!r)return NaN;var t=Pw(r[1]),n=Pw(r[2]),a=Pw(r[3]);return qU(t,n,a)?t*Dw+n*ww+a*1e3:NaN}function Pw(e){return e&&parseFloat(e.replace(",","."))||0}function BU(e){if(e==="Z")return 0;var r=e.match(CU);if(!r)return 0;var t=r[1]==="+"?-1:1,n=parseInt(r[2]),a=r[3]&&parseInt(r[3])||0;return UU(n,a)?t*(n*Dw+a*ww):NaN}function IU(e,r,t){var n=new Date(0);n.setUTCFullYear(e,0,4);var a=n.getUTCDay()||7,i=(r-1)*7+t+1-a;return n.setUTCDate(n.getUTCDate()+i),n}var PU=[31,null,31,30,31,30,31,31,30,31,30,31];function _M(e){return e%400===0||e%4===0&&e%100!==0}function RU(e,r,t){return r>=0&&r<=11&&t>=1&&t<=(PU[r]||(_M(e)?29:28))}function kU(e,r){return r>=1&&r<=(_M(e)?366:365)}function LU(e,r,t){return r>=1&&r<=53&&t>=0&&t<=6}function qU(e,r,t){return e===24?r===0&&t===0:t>=0&&t<60&&r>=0&&r<60&&e>=0&&e<25}function UU(e,r){return r>=0&&r<=59}var Ma=e=>[...new Set(e)];var FM=(e,r)=>e.sort(function(t,n){let a=r.indexOf(t),i=r.indexOf(n);return a>i?a!=-1&&i==-1?-1:1:i!=-1&&a==-1?1:-1});function Jm(e){return Array.isArray(e)?e:typeof e=="string"?[e]:[]}function OM(e){if(!e)return"";if(typeof e!="string"){let r=e.toString();return typeof r=="string"?r:""}return e}var BM=(e,r)=>r.indexOf(e)>0?r.indexOf(e):r.length;var rc=e=>"spaces://"+e;var IM=(e,r)=>!e||e.length==0?r:e,PM=e=>e.charAt(0)=="/"?e.substring(1):e;var In="File";var zU=(e,r)=>{let t=n=>n=="builtin"?"Builtin":n=="api"?"Spaces":"Action";return[...(e.actionsIndex.get(r)??[]).map(n=>({name:n.schema.name,description:"Action",value:\`\${r}/#;\${n.schema.id}\`,section:"Action"}))??[],...[...e.cli.allCommands()].map(n=>({name:n.schema.name,description:t(n.schema.type),value:n.path,section:t(n.schema.type)}))]};var RM=({field:e,value:r})=>r=="ctime"?{value:"parseDate(prop('File')['metadata']['ctime'])",type:"date"}:{value:"",type:"string"},jm=(e,r,t,n)=>{let a=tc(e);if(a)return r=="fileprop"&&a.field?RM(a):(r=="option"&&a.source?.length>0&&(a.source=="$commands"?a.options=t.cli.allCommands():a.source=="$links"?a.options=t.spaceManager.allPaths().map(i=>({name:i,value:i})):a.source=="$super"?a.options=zU(t,n):a.source=="$properties"&&(a.options=t.contextsIndex.get(n)?.contextTable?.cols?.map(i=>({name:i.name,value:i.name}))??[])),[...kM(r).configKeys??[],"alias","default"].reduce((i,s)=>({...i,[s]:a[s]}),{}));if(!r)return{};if(!a)if(r=="context")e?.length>0?a={space:e}:a={};else if(r.startsWith("date"))e?.length>0?a={format:e}:a={};else if(r.startsWith("fileprop"))if(e?.length>0){let[i,s]=e.split(".");a=RM({field:i,value:s})}else a={};else r.startsWith("option")&&(e?.length>0?a={options:An(e).map(s=>({name:s,value:s}))}:a={});return a??{}};var qM=Aa(LM()),kw=class{constructor(){this.lang="en";this.all={en:{hintText:{fileName:"Enter File Name",alias:"Enter Display Name",dragDropModifierKeys:"Hold \${1} to Pin and \${2} to Copy",createListItem:"Select/Create List Item Frame",dragDropProperties:"Drag and drop properties to link them into the list",newItem:"+ New",selectNote:"Select Note...",newFrame:"New"},defaults:{spaceNote:"Current Note",spaceContext:"Current Space"},commands:{h1:"Heading 1",h2:"Heading 2",h3:"Heading 3",h4:"Heading 4",h5:"Heading 5",h6:"Heading 6",columns:"Columns",tabs:"Tabs",button:"Button",label:"Label",column:"Column",idea:"New",group:"Group",paragraph:"Text",card:"Card",progress:"Progress",rating:"Rating",circularProgress:"Circular Progress",list:"Bullet List","ordered-list":"Numbered List",todo:"To-do List",quote:"Quote",internal:"Link to Note",context:"Embed Existing Context",flow:"Embed Note or Space",board:"New Board",divider:"Divider",note:"Note Block",link:"Web Link",internalLink:"Link",callout:"Callout",bookmark:"Bookmark",table:"New Table",codeblock:"Code Block",toggle:"Toggle",emoji:"Emoji",image:"Image",newNote:"Note",tag:"Tag",makeMenu:"Flow Menu",selectStyle:"Style",toggleKeyboard:"Toggle Keyboard",rows:"Rows",masonry:"Gallery"},styles:{bold:"Bold",italics:"Italics",strikethrough:"Strikethrough",code:"Code",link:"Web Link",blocklink:"Link to Note",textColor:"Text Color",highlight:"Highlight"},commandsSuggest:{noResult:"No result"},commandPalette:{enable:"Enable",disabled:"Disable",openFlow:"Open Flow Blocks in Selection",closeFlow:"Close Flow Blocks in Selection",toggleBold:"Toggle Bold",toggleItalics:"Toggle Italics",openSpaces:"Open Navigator",blink:"Blink",openFileContext:"Open Explorer",convertPathToSpace:"Convert to Space",revealFile:"Reveal File in Navigator",releaseNotes:"Release Notes",getStarted:"Get Started",toggleBacklinks:"Toggle Backlinks",collapseAllFolders:"Collapse All Folders",addFileSpace:"Add File to Space",removeFileSpace:"Remove File from Space"},frames:{sections:{kit:"Kit",paths:"Paths"},label:{label:"Label",description:"Label"},note:{label:"Note",description:"Link to a note"},table:{label:"Table",description:"Table"},context:{label:"Context",description:"Display a context view from another space"},calendar:{label:"Calendar View"},field:{label:"Field",description:"Dynamic node that displays a value based on property type"},event:{label:"Event"},divider:{label:"Divider",description:"Divider to separate your content"},button:{label:"Button",description:"Buttons can perform actions and open links"},callout:{label:"Callout",description:"Callout to highlight important information"},toggle:{label:"Toggle",description:"Toggle to show/hide content"}},menu:{layout:"Layout",enterFlowState:"Enter Flow State",exitFlowState:"Exit Flow State",newView:"New View",calendarView:"Calendar View",dayView:"Day View",closeSpace:"Close Space in Focus",customView:"Custom View",detailsView:"Details View",catalogView:"Catalog View",galleryView:"Gallery View",deleteContext:"Delete Context",openSpace:"Open",revealInDefault:"Reveal in Finder",revealInExplorer:"Reveal in Explorer",setNone:"None",fileMetadataDescription:"This note only",openFilePane:"Open in a new pane",rename:"Rename",changeToFolderNote:"New Space from Note",moveFile:"Move file to...",moveFolder:"Move folder to...",duplicate:"Make a copy",edit:"Edit",delete:"Delete",getHelp:"Make.md Community",vault:"Vault",openVault:"Open Another Vault",openVaultInFolder:"Open Vault Folder",obSettings:"Obsidian Settings",commandPalette:"Command Palette",backToSpace:"Back to Navigator",collapseAllSections:"Collapse All Spaces",expandAllSections:"Expand All Spaces",collapseAllFolders:"Collapse All Folders",expandAllFolders:"Expand All Folders",spaceTitle:"Add/Remove in Space",home:"Home",none:"None",tableView:"Table View",cardView:"Card View",boardView:"Board View",listView:"List View",flowView:"Flow View",groupBy:"Group",sortBy:"Sort",filters:"Filters",newFilter:"New Filter",clearFilters:"Clear Filters",hide:"Hide",unhideFields:"Unhide All Properties",importDataview:"Import All Dataview Properties",saveAllProperties:"Save All Properties to Files",mergeProperties:"Merge Properties",removeFromSpace:"Unpin from Space",editCode:"Edit Code",editProperties:"Edit Properties",properties:"Properties",deleteProperty:"Delete Property",hideProperty:"Hide Property",unhideProperty:"Unhide Property",saveProperty:"Save Property",sortAscending:"Sort Ascending",sortDescending:"Sort Descending",deleteRow:"Delete Item",collapseAll:"Collapse All",customSort:"Custom Sort",groupSpaces:"Group Spaces",recurisveSort:"Apply to Subfolders",fileNameSortAlphaAsc:"File Name (A to Z)",fileNameSortAlphaDesc:"File Name (Z to A)",fileNameSortNumericalAsc:"File Name (1 to 9)",fileNameSortNumericalDesc:"File Name (9 to 1)",createdTimeSortAsc:"Created Time (new to old)",createdTimeSortDesc:"Created Time (old to new)",modifiedTimeSortAsc:"Modified Time (new to old)",modifiedTimeSortDesc:"Modified Time (old to new)",sizeSortAsc:"Size (smallest to largest)",sizeSortDesc:"Size (largest to smallest)",spaces:"Spaces",tags:"Tags",manageHiddenFiles:"Manage Hidden Files",manageActions:"Manage Actions",deleteSpace:"Delete",changeColor:"Change Color",changePropertyType:"Change Type",deleteFiles:"Delete Files",createFolderSpace:"Create Space from Folder",folder:"Folder",syncToContext:"Add Property to Context",setIcon:"Set Icon",copyEmbedLink:"Copy Embed Link",moveUp:"Move Up",moveDown:"Move Down",moveTo:"Move To",groupNodes:"Group Nodes",moveFrame:"Move Frame",renameFrame:"Rename Frame",deleteFrame:"Delete Frame",insertAbove:"Insert Above",insertBelow:"Insert Below"},editor:{rows:"Rows",columns:"Columns",catalog:"Catalog",gallery:"Gallery",grid:"Grid",scaleToFit:"Change to Fit",scaleToFill:"Change to Fill",fit:"Fit",strokeNone:"None",strokeSolid:"Solid",strokeDotted:"Dotted",strokeDashed:"Dashed",size:"Size",gap:"Gap",marginLeft:"Left",marginTop:"Top",marginRight:"Right",marginBottom:"Bottom",minimize:"Minimize",paddingLeft:"Left",paddingTop:"Top",paddingRight:"Right",paddingBottom:"Bottom",unlinkProperty:"Unlink Property",linkedProperty:"Linked Property",linkProperty:"Link Property",currentSpace:"Current Space",linkName:"\${1} Link",linkThumbnail:"\${1} Thumbnail",linkSticker:"\${1} Sticker",opacity:"Opacity",shadowSpread:"Spread",shadowBlur:"Blur",width:"Width",height:"Height",margin:"Margin",padding:"Padding",bold:"Bold",italic:"Italic",underline:"Underline",alignLeft:"Align Left",alignCenter:"Align Center",alignRight:"Align Right",alignJustify:"Align Justify",numberOfLines:"Lines",createVerticalSection:"Create Vertical Section",createHorizontalSection:"Create Horizontal Section",themeColors:"Theme Colors",uiColors:"UI Colors",hex:"Hex"},buttons:{add:"Add",togglePin:"Toggle Pin",refresh:"Refresh",showHidden:"Show Hidden",alias:"Alias",addFilter:"Add Filter",loadMore:"Load More",addCondition:"Add Condition",customize:"Customize",moreOptions:"More Options",saveProperty:"Save Property",newNote:"New Note",changeIcon:"Change Sticker",removeIcon:"Remove Sticker",addIcon:"Add Sticker",addCover:"Add Cover",addDisplay:"Display Name",changeBanner:"Change Cover",changeBannerShort:"Cover",saveChanges:"Save Changes",removeBanner:"Remove Cover",rename:"Change Name",editFrame:"Edit Frame",saveSpace:"Save Space",createSpace:"New Space",createFolder:"New Folder",createNote:"New Note",createCanvas:"New Canvas",addIntoSpace:"New Pin",addSmartSearch:"Add Live Search",subFolders:"Sub Folders",addItem:"Add Item",addProperty:"Add Property",editProperty:"Edit Property",addContext:"Add Context",cancel:"Cancel",search:"Search",delete:"Delete",toggleFlow:"Toggle Flow",openFlow:"Open Flow",hideFlow:"Hide Flow",openLink:"Open Link",addToSpace:"Add to Space",addToSpaceShort:"Pin",addTag:"Add Tag",tag:"Tag",syncFields:"Sync Properties",convertTable:"Convert to Markdown",cutTable:"Cut Table",deleteTable:"Delete From Note",blink:"Blink",addFile:"Add Item",merge:"Merge",saveView:"Save View",saveTable:"Save Table",renameView:"Rename View",deleteView:"Delete View",renameTable:"Rename Table",renameTag:"Rename Tag",createTag:"Create Tag",currentFolder:"Current Folder",sync:"Sync",pasteCSS:"Paste CSS",save:"Save",run:"Run"},metadataTypes:{fileName:"File Name",contexts:"Contexts",path:"Path",folder:"Folder",sticker:"Sticker",color:"Color",created:"Created",lastModified:"Last Modified",extension:"Extension",size:"Size",tags:"Tags",inlinks:"Linked Mentions",outlinks:"Links",label:"Label",fileMetadata:"File Metadata",frontmatter:"Frontmatter"},filterTypes:{contains:"contains",notContains:"does not contain",is:"is",isNot:"is not",before:"before",after:"on or after",anyOf:"is any of",noneOf:"is none of",checked:"is checked",unchecked:"is unchecked",isEmpty:"is empty",isNotEmpty:"is not empty",isSameDate:"is same date",isSameDateAsToday:"today"},sortTypes:{alphaAsc:"A to Z",alphaDesc:"Z to A",earliest:"Earliest",latest:"Latest",checkAsc:"Checked \\u2192 Unchecked",checkDesc:"Unchecked \\u2192 Checked",itemsAsc:"Least Items",itemsDesc:"Most Items"},properties:{defaultField:"Name",aggregate:{label:"Aggregate",description:"Aggregate functions to calculate values"},audio:{label:"Audio",description:"Audio"},text:{label:"Text",description:"Text field"},number:{label:"Number",description:"Number field with optional unit"},boolean:{label:"Yes/No",description:"Yes or No toggle to indicate the status"},date:{label:"Date",description:"Select a date from a calendar"},option:{label:"Option",description:"Select one or multiple option from a list"},file:{label:"File"},link:{label:"Link",description:"Link to another note or a website"},tags:{label:"Tags",description:"Use tags to quickly organize your items"},object:{label:"Object",description:"Store any complex objects"},context:{label:"Relation",description:"Connect to another context property and create a relation"},image:{label:"Image",description:"Select any image from your system or from the internet"},color:{label:"Color",description:"Use colors to label your items or status"},space:{label:"Context",description:"Link to a context"},icon:{label:"Sticker",description:"Use stickers to uniquely label your items or status"},super:{label:"Super Property",links:"Open Link",properties:"Update Property",api:"API",obsidianCommands:"Run Command",runCommand:"Run Command",performAction:"Perform Action",whenClicked:"When Clicked"},fileProperty:{name:"Name",label:"Formula",createdTime:"Created",modifiedTime:"Last Edited",sticker:"Sticker",links:"Links",tags:"Tags",spaces:"Spaces",extension:"Extension",size:"Size",preview:"Note Preview",parentFolder:"Folder",description:"Use a formula to dynamically display a property"}},views:{navigator:"Navigator",explorer:"Explorer",space:"Space"},subViews:{spaceItems:"Items",spaceContext:"Context",spaceLists:"Lists",spaceActions:"Actions",spaceTemplates:"Templates",smartSearch:"Live Searches",filesAndFolders:"Files and Folders"},labels:{duplicateTable:"Duplicate Table",aggregateBy:"Aggregate By",pinned:"Pinned",live:"Pinned by Live Search",moveTable:"Move Table",editFormula:"Edit Formula",editObject:"Edit Object",properties:"Properties",newAction:"Action",newTable:"List",template:"Template",createFolder:"New Folder Name",rename:"Rename",createNew:"New",default:"Default",done:"Done",changeCoverShort:"Change",reposition:"Reposition",tables:"Tables",selectDateFormat:"Select/Type Date Format",renameSection:"Edit Space",createSection:"New Folder",createNote:"New Note",contextMaker:"Context Maker",select:"Select",pinnedItems:"Pinned Items",collapse:"Collapse",expand:"Expand",all:"All",none:"None",view:"View",findStickers:"Find Sticker",mergeProperties:"Merge Properties",placeholder:"Type '\${1}' for commands",notePlaceholder:"New Note for \${1}",itemsSelected:"\${1} Selected",selectNote:"Select Note",selectIcon:"Select Icon",selectImage:"Select Image",selectSpace:"Select Space",styleSmall:"Small",styleMedium:"Medium",styleLarge:"Large",hiddenFilePattern:"Name, Suffixes and Extension",hiddenFileSpecific:"Exclude specific files and folders",textPlaceholder:"Enter Text",noFile:"is not created yet. Click to create.",navigatorSearchPlaceholder:"Search by Text or Filters",blinkPlaceholder:"Search for notes, spaces...",searchPlaceholder:"Type to search...",contextItemSelectPlaceholder:"Find Item",linkItemSelectPlaceholder:"Find or Create Note",pinNotePlaceholder:"Select a Note or Space to Pin",optionItemSelectPlaceholder:"Select Option",viewItemSelectPlaceholder:"Select View",tagItemSelectPlaceholder:"Find Tag",spaceSelectPlaceholder:"Select any Folder or Tag",propertyItemSelectPlaceholder:"Select Property",sortItemSelectPlaceholder:"Select Sort",filterItemSelectPlaceholder:"Select Filter",imageSelectPlaceholder:"Select an image or paste a URL",imageNotFoundPlaceholder:"No Images Found",syncFrontmatterProperty:"Sync Frontmatter Property",newProperty:"New Property",newPropertyShort:"New Property",propertyType:"Type",propertyDynamic:"Dyanmic",propertyValueSpace:"Space",propertyValueReference:"Related Property",propertyValueAggregate:"Aggregate Property",propertyValueProperty:"Property",propertyLookup:"Edit Formula",existingFrontmatter:"Existing Property",dateFormat:"Date Format",propertyFileProp:"Property",multiple:"Multiple",filesCount:"{$1} Files",hiddenFiles:"Hidden Files",addExtension:"Add Rule",saveView:"Save View",saveTable:"Save Table",renameView:"Rename View",renameTable:"Rename Table",syncMetadata:"Sync Metadata",syncProperties:"Sync Properties",selectContext:"Select Context",metadata:"Metadata",backlinks:"Backlinks",spaces:"Spaces",contexts:"Contexts",content:"Content",deleteSpace:"Delete Space",deleteFiles:"Delete Files",outgoingLinks:"Outgoing Links",moveTo:"Move to",addTo:"Pin to",copyTo:"Copy to",reorderIn:"Reorder in",border:"Border",corners:"Corners",color:"Color",backgroundColor:"Background",cornerRadius:"Radius",onClick:"On Click",layout:"Layout",element:"Element",name:"Name",display:"Display",alignment:"Alignment",margin:"Margin",padding:"Padding",gap:"Gap",width:"Width",height:"Height",opacity:"Opacity",shadow:"Shadow",shadowBlur:"Blur",shadowSpread:"Spread",typography:"Typography",layers:"Layers",fontSize:"Size",props:"Props",styles:"Styles",events:"Events",code:"Code",selectedLayers:"\${1} Layers"},descriptions:{spaceActions:"Create actions that runs when you press a button",spaceLists:"Create lists to track data and organize them in your space",spaceItems:"Add new items to the space or pin items to the space",spaceTemplates:"Create templates to quickly add items to your space",smartSearch:"Automatically pin notes to this space based on a set of searches",hiddenFileOptions:"Exclude any files and folders by name, suffix or extension.",deleteSpace:"Deleting the space will also delete the folder and its contents.",deleteFiles:"Delete \${1} files/folders and their contents?",addContext:"Contexts lets you connect properties from your tags",spaceProperties:"Define Properties for your Space Items",syncMetadata:"Select which fields from your notes to start syncing with the context.",syncProperties:"Contexts defines and syncs the same fields across your notes depending on their folder or tag.",selectContext:"Select which folder or tag context you want to sync the fields."},flowView:{emptyDoc:"Empty Document",itemsCount:" Items",emptyFolder:"This Folder is Empty"},notice:{duplicateFile:"Folder already contains note with same name",addedToSection:"Added to Space",fileExists:"File Already Exists",folderExists:"Folder Already Exists",noPropertyName:"Property Name is Required",noPropertiesFound:"No Properties Found",duplicatePropertyName:"Duplicate Property Name",newSpaceName:"Enter a name for your space",duplicateSpaceName:"Space name already exists",cantConvertNoteToSpace:"The view is not a note",templateSaved:"Template saved to space: ",tableDeleted:"Table removed from note, you can find the table in the folder space"},settings:{sections:{general:"General",navigator:"Navigator",appearance:"Appearance",interaction:"Preferences",context:"Context",label:"Labels",tags:"Tags",space:"Spaces",performance:"Performance",advanced:"Advanced",folderNote:"Folder Note",notes:"Notes"},searchWorker:{name:"Background Search",desc:"Search in background to improve reponsiveness while searching"},cacheIndex:{name:"Cache Search Index",desc:"Cache the index for faster search results"},layoutVertical:"Vertical",layoutHorizontal:"Horizontal",sectionGeneral:"General",sectionSidebar:"Spaces",sectionEditor:"Maker Mode",sectionFlow:"Flow",sectionAdvanced:"Advanced",sectionDataview:"Dataview",sectionContext:"Context",sectionStickers:"Labels",sectionNavigator:"Navigator",sectionDefault:"Default Spaces",sectionSpaceView:"Space View",sectionBlink:"Blink",sectionInlineContext:"Inline Context",sectionFlowBlock:"Flow Block",sectionFlowMenu:"Flow Menu",sectionFlowStyler:"Flow Styler",experimental:{name:"Experimental",desc:"Experimental features that are subject to change and may not be optimized for performance"},imageThumbnails:{name:"Generate Thumbnails",desc:"Create thumbnails for images to speed up performance"},minimalThemeFix:{name:"Minimal Theme Fix",description:"Apply fixes for the popular theme Minimal"},inlineStickerMenu:{name:"Inline Stickers",desc:"Add inline stickers by typing :"},openSpacesOnLaunch:{name:"Open Navigator as Default Tab",desc:"Open the Navigator tab when Obsidian launches"},spacesRightSplit:{name:"Navigator on Right Side",desc:"Open the Navigator in the right panel"},defaultSpaceTemplate:{name:"Default Space Template",desc:"Select the default template for new spaces"},defaultDateFormat:{name:"Default Date Format",desc:"Set the default date format, example: yyyy-MM-dd (see https://date-fns.org/v2.30.0/docs/format)"},defaultTimeFormat:{name:"Default Time Format",desc:"Set the default time format, example: h:mm a (see https://date-fns.org/v2.30.0/docs/format)"},autoAddContextsToSubtags:{name:"Apply Properties to Subtags",desc:"Automatically apply context properties to subtags"},newNotePlaceholder:{name:"New Note Placeholder",desc:"Default name for new notes"},folderIndentationLines:{name:"Show Folder Indentation Lines",desc:"Turn on to show a line on the left of folders to indicate indentation"},folderNoteLocation:{name:"Folder Note Location Inside Folder",desc:"Turn on to have folder notes inside the folder, turn off to have it outside"},folderViewDefault:{name:"Show Folder Note by Default",desc:"Show the folder note by default when opening a folder"},internalLinkFlowEditor:{name:"Show Toggles to Open Flow Editor on Links",desc:"Turn on to toggle Flow Blocks directly in inline links"},internalLinkSticker:{name:"Show Stickers on Links",desc:"Turn on to toggle stickers shown directly by beside internal links"},saveAllContextToFrontmatter:{name:"Sync Context Fields to Frontmatter",desc:"Turn on to automatically save all context fields to frontmatter fields, not just existing frontmatter fields."},syncFormulaToFrontmatter:{name:"Sync Formula Fields to Frontmatter",desc:"Turn on to save calculated formula values to frontmatter fields."},spaceSubFolder:{name:"Space Folder Name",desc:"Name of the folder for spaces"},basics:{name:"Make.md Basics",desc:"Enable features from Make.md Basics including styler and flow blocks"},spacesFolder:{name:"Tag Space Folder",desc:"Name of the folder for tag spaces"},dataviewInlineContext:{name:"Show Dataview in Inline Context",desc:"Show dataview when inline context is enabled"},inlineContext:{name:"Notes Header",desc:"Show a header to display labels and properties"},banners:{name:"Cover Image",desc:"Show a cover image for notes and spaces"},inlineContextProperties:{name:"Show Context Properties in Header",desc:"Show the properties in the header for notes and spaces"},inlineContextExpanded:{name:"Auto Expand Context Properties",desc:"Expand the inline context sections when opening a note"},inlineContextNameLayout:{name:"Title and Sticker Layout",desc:"Layout for inline title and sticker in Inline Context"},hideFrontmatter:{name:"Hide Context Properties",desc:"Hide properties you have added in context from the Obsidian properties panel"},autoOpenFileContext:{name:"Auto Open Explorer",desc:"Automatically open explorer panel in the right panel"},enableFolderNote:{name:"Enable Folder Note",desc:"Access the folder note in the folder page and hide the folder note from spaces"},folderNoteName:{name:"Folder Note Name",desc:"Name of the folder note, keep blank to use the same name as the folder"},expandFolderOnClick:{name:"Auto Expand Folder",desc:"Auto expand folders on click"},filePreviewOnHover:{name:"Preview on Hover",desc:"Preview on Hover while holding Control/Command key"},revealActiveFile:{name:"Reveal Active File",desc:"Automatically reveal the active file in Navigator"},contextEnabled:{name:"Contexts",desc:"Contexts allows you to have full control over the metadata of your files"},navigatorEnabled:{name:"Navigator",desc:"The navigator lets you create and organize your spaces"},spacesStickers:{name:"Stickers",desc:"Use Emojis to make it easier to find your notes"},spacesUseAlias:{name:"Alias",desc:"Use the alias metadata to show in Navigator"},spacesDisablePatch:{name:"Compatibility Mode",desc:"This will improve the compatibility of plugins while using the Navigator"},deleteFileOption:{name:"Delete File Option",desc:"Select how you want files to be deleted"},spacesDeleteOptions:{permanant:"Delete Permanently",trash:"Move to Obsidian Trash","system-trash":"Move to System Trash"},flowState:{name:"Flow State",desc:"Toggle the flow state"},showRibbon:{name:"App Ribbon",desc:"Show/hide the left menu aka. ribbon"},spaceViewEnabled:{name:"Spaces",desc:"Customize your folders and tags with properties and views"},defaultSpaces:{name:"Default Spaces",desc:"Recommended spaces for quickly organizing your vault"},homeSpace:{name:"Home Space",desc:"An easy-to-access space where you can add/organize your other spaces"},enableDefaultSpaces:{name:"Tag Spaces",desc:"Automatically create spaces for each of your tags"},readableLineWidth:{name:"Readable Line Width",desc:"Use Readable Line Width"},sidebarTabs:{name:"Sidebar Tabs",desc:"Show/hide other sidebar tabs"},spacesPerformance:{name:"Navigator Scroll Performance",desc:"Turn on performance mode for Navigator, may affect scrolling appearance. Requires Restart"},indexSVG:{name:"Use SVGs as Stickers",desc:"Use any svg file in your vault as a sticker"},inlineStyler:{name:"Flow Styler",desc:"Select text to add styling"},inlineStylerColor:{name:"Text and Highlight Colors \\u{1F9EA}",desc:"Select text color and highlight color, (this may change in the future because of the limitations with HTML and Obsidian)"},spaceRowHeight:{name:"Row Height",desc:"The height for each row in navigator (in pixels), default is 29"},contextPagination:{name:"Table View Pagination",desc:"Number of items per page in table view"},bannerHeight:{name:"Cover Height",desc:"The height for the cover of the note or space, default is 200"},makeChar:{name:"Flow Menu Trigger",desc:"Character to open the Flow Menu"},mobileMakeBar:{name:"Flow Styler (Mobile)",desc:"Replaces the mobile toolbar"},editorMarkSans:{name:"Mark Sans \\u{1F9EA}",desc:"Use the editor without Markdown."},editorMakerMode:{name:"Flow (Beta)",desc:"An integrated and intuitive editor experience"},editorMakePlacholder:{name:"Flow Menu Hint Text",desc:"Show a hint text on how to open the Flow Menu Shortcut"},blinkEnabled:{name:"Blink",desc:"A faster way to search and edit your notes"},editorMakeMenu:{name:"Flow Menu",desc:"Open the Flow menu to quickly add content"},editorMakeMenuTrigger:{name:"Flow Menu Shortcut",desc:"Trigger key to use flow menu"},editorFlowReplace:{name:"Flow Block",desc:"Open your internal links or toggle your embeds in the flow block."},editorFlowStyle:{name:"Flow Block Style",desc:"Select a theme for your flow block",seamless:"Seamless",minimal:"Minimal"}}}};this.lang="en";let r=qM.default.locale();["en"].includes(r)&&(this.lang=r)}get texts(){return this.all.en}},Wr=new kw().texts;var Ea="files",Gs={id:Ea,name:"Items",type:"db",primary:"true"};var UM={uniques:["name,schemaId"],cols:["name","schemaId","type","value","attrs","hidden","unique","primary"]},Vs={...UM,rows:[{name:In,schemaId:Ea,type:"file",primary:"true",hidden:"",unique:"",attrs:"",value:""},{name:"Created",schemaId:Ea,type:"fileprop",value:In+".ctime",hidden:"",unique:"",attrs:"",primary:"true"}]};var ep={...UM,rows:[{name:In,schemaId:Ea,type:"file",primary:"true",hidden:"",unique:"",attrs:"",value:""}]};var kM=(e,r)=>r==In?Qu.find(t=>t.type=="file"):r=="tags"?Qu.find(t=>t.type=="tags-multi"):r=="aliases"?Qu.find(t=>t.type=="option-multi"):r=="sticker"?Qu.find(t=>e=="icon"):Qu.find(t=>e==t.type)||Qu.find(t=>e==t.multiType),Qu=[{type:"unknown",label:"",restricted:!0,icon:"ui//file-question"},{type:"any",label:"",restricted:!0,icon:"ui//wildcard",multi:!0,multiType:"any-multi"},{type:"text",label:Wr.properties.text.label,metadata:!0,icon:"ui//text",primative:!0,description:Wr.properties.text.description},{type:"number",label:Wr.properties.number.label,metadata:!0,icon:"ui//binary",configKeys:["unit"],primative:!0,description:Wr.properties.number.description},{type:"boolean",label:Wr.properties.boolean.label,metadata:!0,icon:"ui//check-square",primative:!0,description:Wr.properties.boolean.description},{type:"date",label:Wr.properties.date.label,metadata:!0,icon:"ui//calendar",configKeys:["format"],primative:!0,description:Wr.properties.date.description},{type:"option",label:Wr.properties.option.label,multi:!0,multiType:"option-multi",icon:"ui//list",configKeys:["options","source"],description:Wr.properties.option.description},{type:"tags-multi",label:Wr.properties.tags.label,icon:"ui//tags",description:Wr.properties.tags.description},{type:"file",label:Wr.properties.file.label,restricted:!0,icon:"ui//mk-make-h3"},{type:"fileprop",label:Wr.properties.fileProperty.label,icon:"ui//formula",configKeys:["field","value","type"],description:Wr.properties.fileProperty.description},{type:"link",label:Wr.properties.link.label,multi:!0,multiType:"link-multi",metadata:!0,icon:"ui//file-text",primative:!0,description:Wr.properties.link.description},{type:"context",label:Wr.properties.context.label,icon:"ui//mk-make-note",multi:!0,multiType:"context-multi",configKeys:["space","field"],description:Wr.properties.context.description},{type:"aggregate",label:Wr.properties.aggregate.label,icon:"ui//mk-make-note",multi:!1,configKeys:["ref","field","fn"],description:Wr.properties.aggregate.description},{type:"object",label:Wr.properties.object.label,multi:!0,multiType:"object-multi",metadata:!0,icon:"ui//list-tree",configKeys:["type","typeName"],description:Wr.properties.object.description},{type:"icon",label:Wr.properties.icon.label,multi:!0,multiType:"icon-multi",icon:"ui//gem",restricted:!0,primative:!0,description:Wr.properties.icon.description},{type:"image",label:Wr.properties.image.label,multi:!0,multiType:"image-multi",metadata:!0,icon:"ui//mk-make-image",primative:!0,description:Wr.properties.image.description},{type:"color",label:Wr.properties.color.label,icon:"ui//mk-make-image",restricted:!0,description:Wr.properties.color.description},{type:"space",label:Wr.properties.space.label,icon:"ui//layout-grid",restricted:!0,description:Wr.properties.space.description},{type:"table",label:Wr.properties.space.label,icon:"ui//layout-grid",restricted:!0,description:Wr.properties.space.description},{type:"super",label:Wr.properties.super.label,icon:"ui//zap",restricted:!0,configKeys:["dynamic","field"]},{type:"input",label:Wr.properties.super.label,icon:"ui//input",restricted:!0}];var YU="filesView",WU={id:YU,name:"All",type:"view",def:JSON.stringify({db:Ea,icon:"ui//file-stack"})},HU="main",$U=e=>({id:e,name:e,type:"frame",def:"",predicate:"",primary:"true"}),iee={uniques:[],cols:["id","name","type","def","predicate","primary"],rows:[$U(HU),WU]},rp={uniques:[],cols:["id","name","type","def","predicate","primary"],rows:[Gs]};var oee={schema:Gs,cols:Vs.rows,rows:[]},see={schema:Gs,cols:Vs.rows,rows:[]},uee={schema:Gs,cols:ep.rows,rows:[]},zM=(e,r)=>e.filter(t=>r.find(n=>n.id==t.schemaId&&n.type=="db")).reduce((t,n)=>({...t,...t[n.schemaId]?{[n.schemaId]:{uniques:n.unique=="true"?[...t[n.schemaId].uniques,n.name]:t[n.schemaId].uniques,cols:[...t[n.schemaId].cols,n.name],rows:[]}}:{[n.schemaId]:{uniques:n.unique=="true"?[n.name]:[],cols:[n.name],rows:[]}}}),{});var fee={m_schema:rp,m_fields:Vs,...zM(Vs.rows,rp.rows)},lee={m_schema:rp,m_fields:ep,...zM(ep.rows,rp.rows)};var Lw=(e,r)=>{if(e instanceof Date)return"date";if(typeof e=="string"){if(/\\/\\/(\\S+?(?:jpe?g|png|gif|svg))/gi.test(e)||e.includes("unsplash"))return"image";if(/^\\d{4}-\\d{2}-\\d{2}$/.test(e))return"date";if(r=="tag"||r=="tags")return"tags-multi";if(/\\[\\[.*?\\]\\]/.test(e))return"link"}else{if(typeof e=="number")return"number";if(typeof e=="boolean")return"boolean";if(e)if(Array.isArray(e)||typeof e=="string"&&e.indexOf(",")>-1){let t=Array.isArray(e)?e:[];if(typeof e=="string"&&e.indexOf(",")>-1&&(t=An(e)),r=="tag"||r=="tags")return"tags-multi";if(t.length==1&&Array.isArray(t[0])&&t[0].length==1&&typeof t[0][0]=="string")return"link";let n=Ma(t.map(a=>Lw(a,r)));return n.length==1&&n[0]=="link"?"link-multi":n.some(a=>a=="object")?"object-multi":"option-multi"}else return e.isLuxonDateTime?"date":e.isLuxonDuration?"duration":e.type=="file"?"link":typeof e=="object"&&!Array.isArray(e)&&e!==null?"object":"unknown";else return"unknown"}return"text"};var qw=(e,r,t)=>e?e=="object"||e=="object-multi"?JSON.parse(r):e=="number"?parseFloat(r):e=="boolean"?r=="true":e.includes("-multi")?An(r).map(n=>qw(e.replace("-multi",""),n,t)):(e.includes("link")||e.includes("context"))&&t?\`[[\${r}]]\`:r:r;var YM=e=>e.map(r=>r.replace(",","\\\\,")).join(", "),Zs=e=>JSON.stringify(e);var An=e=>e?.startsWith("[")?Jm(tc(e)).map(r=>OM(r)):GU(e),GU=e=>(e?.replace("\\\\,",",")?.match(/(\\\\.|[^,])+/g)??[]).map(r=>r.trim()),Qs=(e,r,t)=>{let n=t??Lw(r,e);if(!r)return"";switch(n){case"tags-multi":return r;case"object":case"object-multi":{if(Array.isArray(r)){if(r[0].path)return JSON.stringify(r.map(a=>a.path))}else if(r.path)return r.path;return JSON.stringify(r)}break;case"number":return r.toString();case"boolean":return r?"true":"false";case"date":{if(r instanceof Date){let a=Yi(r,"yyyy-MM-dd");return typeof a=="string"?a:""}return typeof r!="string"?"":r}break;case"duration":return YM(Object.keys(r.values).reduce((a,i)=>[...a,...r.values[i]>0?[r.values[i]+" "+i]:[]],[]));case"option-multi":case"link-multi":case"context-multi":return typeof r=="string"?nc(r):Zs(r.map(a=>a?typeof a=="string"?nc(a):a.path?a.path:Array.isArray(r)&&a.length==1&&Array.isArray(a[0])&&a[0].length==1&&typeof a[0][0]=="string"?a[0][0]:JSON.stringify(a):""));case"link":case"context":return Array.isArray(r)&&r.length==1&&Array.isArray(r[0])&&r[0].length==1&&typeof r[0][0]=="string"?r[0][0]:typeof r=="string"?nc(r):r.path;case"text":case"tag":case"option":case"image":return r}return""};var tc=e=>{let r;try{r=JSON.parse(e)}catch{}return r};var nc=e=>{if(!e)return"";let r=/\\[\\[(.*?)\\]\\]/g.exec(e),t=r?.length>1?r[1].substring(0,BM("|",r[1])):e;return t||e};var tf=Aa(tp());var ic=["MO","TU","WE","TH","FR","SA","SU"],rn=function(){function e(r,t){if(t===0)throw new Error("Can't create weekday with n == 0");this.weekday=r,this.n=t}return e.fromStr=function(r){return new e(ic.indexOf(r))},e.prototype.nth=function(r){return this.n===r?this:new e(this.weekday,r)},e.prototype.equals=function(r){return this.weekday===r.weekday&&this.n===r.n},e.prototype.toString=function(){var r=ic[this.weekday];return this.n&&(r=(this.n>0?"+":"")+String(this.n)+r),r},e.prototype.getJsWeekday=function(){return this.weekday===6?0:this.weekday+1},e}();var Ct=function(e){return e!=null},Ca=function(e){return typeof e=="number"},Uw=function(e){return typeof e=="string"&&ic.includes(e)},Mn=Array.isArray,Za=function(e,r){r===void 0&&(r=e),arguments.length===1&&(r=e,e=0);for(var t=[],n=e;n>0,n.length>r?String(n):(r=r-n.length,r>t.length&&(t+=Kr(t,r/t.length)),t.slice(0,r)+String(n))}var HM=function(e,r,t){var n=e.split(r);return t?n.slice(0,t).concat([n.slice(t).join(r)]):n},Pn=function(e,r){var t=e%r;return t*r<0?t+r:t},np=function(e,r){return{div:Math.floor(e/r),mod:Pn(e,r)}},Ta=function(e){return!Ct(e)||e.length===0},Xt=function(e){return!Ta(e)},jr=function(e,r){return Xt(e)&&e.indexOf(r)!==-1};var Wi=function(e,r,t,n,a,i){return n===void 0&&(n=0),a===void 0&&(a=0),i===void 0&&(i=0),new Date(Date.UTC(e,r-1,t,n,a,i))},VU=[31,28,31,30,31,30,31,31,30,31,30,31],GM=1e3*60*60*24,ap=9999,VM=Wi(1970,1,1),ZU=[6,0,1,2,3,4,5];var Ku=function(e){return e%4===0&&e%100!==0||e%400===0},zw=function(e){return e instanceof Date},Ks=function(e){return zw(e)&&!isNaN(e.getTime())};var QU=function(e,r){var t=e.getTime(),n=r.getTime(),a=t-n;return Math.round(a/GM)},oc=function(e){return QU(e,VM)},ip=function(e){return new Date(VM.getTime()+e*GM)},XU=function(e){var r=e.getUTCMonth();return r===1&&Ku(e.getUTCFullYear())?29:VU[r]},go=function(e){return ZU[e.getUTCDay()]},Yw=function(e,r){var t=Wi(e,r+1,1);return[go(t),XU(t)]},op=function(e,r){return r=r||e,new Date(Date.UTC(e.getUTCFullYear(),e.getUTCMonth(),e.getUTCDate(),r.getHours(),r.getMinutes(),r.getSeconds(),r.getMilliseconds()))},sp=function(e){var r=new Date(e.getTime());return r},Ww=function(e){for(var r=[],t=0;tthis.maxDate;if(this.method==="between"){if(t)return!0;if(n)return!1}else if(this.method==="before"){if(n)return!1}else if(this.method==="after")return t?!0:(this.add(r),!1);return this.add(r)},e.prototype.add=function(r){return this._result.push(r),!0},e.prototype.getValue=function(){var r=this._result;switch(this.method){case"all":case"between":return r;case"before":case"after":default:return r.length?r[r.length-1]:null}},e.prototype.clone=function(){return new e(this.method,this.args)},e}(),xo=KU;var Hw=function(e,r){return Hw=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var a in n)Object.prototype.hasOwnProperty.call(n,a)&&(t[a]=n[a])},Hw(e,r)};function ju(e,r){if(typeof r!="function"&&r!==null)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");Hw(e,r);function t(){this.constructor=e}e.prototype=r===null?Object.create(r):(t.prototype=r.prototype,new t)}var En=function(){return En=Object.assign||function(r){for(var t,n=1,a=arguments.length;nr[0].length)&&(r=i,t=a)}if(r!=null&&(this.text=this.text.substr(r[0].length),this.text===""&&(this.done=!0)),r==null){this.done=!0,this.symbol=null,this.value=null;return}}while(t==="SKIP");return this.symbol=t,this.value=r,!0},e.prototype.accept=function(r){if(this.symbol===r){if(this.value){var t=this.value;return this.nextSymbol(),t}return this.nextSymbol(),!0}return!1},e.prototype.acceptNumber=function(){return this.accept("number")},e.prototype.expect=function(r){if(this.accept(r))return!0;throw new Error("expected "+r+" but found "+this.symbol)},e}();function uc(e,r){r===void 0&&(r=Js);var t={},n=new nz(r.tokens);if(!n.start(e))return null;return a(),t;function a(){n.expect("every");var p=n.acceptNumber();if(p&&(t.interval=parseInt(p[0],10)),n.isDone())throw new Error("Unexpected end");switch(n.symbol){case"day(s)":t.freq=vr.DAILY,n.nextSymbol()&&(s(),m());break;case"weekday(s)":t.freq=vr.WEEKLY,t.byweekday=[vr.MO,vr.TU,vr.WE,vr.TH,vr.FR],n.nextSymbol(),s(),m();break;case"week(s)":t.freq=vr.WEEKLY,n.nextSymbol()&&(i(),s(),m());break;case"hour(s)":t.freq=vr.HOURLY,n.nextSymbol()&&(i(),m());break;case"minute(s)":t.freq=vr.MINUTELY,n.nextSymbol()&&(i(),m());break;case"month(s)":t.freq=vr.MONTHLY,n.nextSymbol()&&(i(),m());break;case"year(s)":t.freq=vr.YEARLY,n.nextSymbol()&&(i(),m());break;case"monday":case"tuesday":case"wednesday":case"thursday":case"friday":case"saturday":case"sunday":t.freq=vr.WEEKLY;var h=n.symbol.substr(0,2).toUpperCase();if(t.byweekday=[vr[h]],!n.nextSymbol())return;for(;n.accept("comma");){if(n.isDone())throw new Error("Unexpected end");var y=f();if(!y)throw new Error("Unexpected symbol "+n.symbol+", expected weekday");t.byweekday.push(vr[y]),n.nextSymbol()}s(),u(),m();break;case"january":case"february":case"march":case"april":case"may":case"june":case"july":case"august":case"september":case"october":case"november":case"december":if(t.freq=vr.YEARLY,t.bymonth=[c()],!n.nextSymbol())return;for(;n.accept("comma");){if(n.isDone())throw new Error("Unexpected end");var v=c();if(!v)throw new Error("Unexpected symbol "+n.symbol+", expected month");t.bymonth.push(v),n.nextSymbol()}i(),m();break;default:throw new Error("Unknown symbol")}}function i(){var p=n.accept("on"),h=n.accept("the");if(!!(p||h))do{var y=o(),v=f(),x=c();if(y)v?(n.nextSymbol(),t.byweekday||(t.byweekday=[]),t.byweekday.push(vr[v].nth(y))):(t.bymonthday||(t.bymonthday=[]),t.bymonthday.push(y),n.accept("day(s)"));else if(v)n.nextSymbol(),t.byweekday||(t.byweekday=[]),t.byweekday.push(vr[v]);else if(n.symbol==="weekday(s)")n.nextSymbol(),t.byweekday||(t.byweekday=[vr.MO,vr.TU,vr.WE,vr.TH,vr.FR]);else if(n.symbol==="week(s)"){n.nextSymbol();var b=n.acceptNumber();if(!b)throw new Error("Unexpected symbol "+n.symbol+", expected week number");for(t.byweekno=[parseInt(b[0],10)];n.accept("comma");){if(b=n.acceptNumber(),!b)throw new Error("Unexpected symbol "+n.symbol+"; expected monthday");t.byweekno.push(parseInt(b[0],10))}}else if(x)n.nextSymbol(),t.bymonth||(t.bymonth=[]),t.bymonth.push(x);else return}while(n.accept("comma")||n.accept("the")||n.accept("on"))}function s(){var p=n.accept("at");if(!!p)do{var h=n.acceptNumber();if(!h)throw new Error("Unexpected symbol "+n.symbol+", expected hour");for(t.byhour=[parseInt(h[0],10)];n.accept("comma");){if(h=n.acceptNumber(),!h)throw new Error("Unexpected symbol "+n.symbol+"; expected hour");t.byhour.push(parseInt(h[0],10))}}while(n.accept("comma")||n.accept("at"))}function c(){switch(n.symbol){case"january":return 1;case"february":return 2;case"march":return 3;case"april":return 4;case"may":return 5;case"june":return 6;case"july":return 7;case"august":return 8;case"september":return 9;case"october":return 10;case"november":return 11;case"december":return 12;default:return!1}}function f(){switch(n.symbol){case"monday":case"tuesday":case"wednesday":case"thursday":case"friday":case"saturday":case"sunday":return n.symbol.substr(0,2).toUpperCase();default:return!1}}function o(){switch(n.symbol){case"last":return n.nextSymbol(),-1;case"first":return n.nextSymbol(),1;case"second":return n.nextSymbol(),n.accept("last")?-2:2;case"third":return n.nextSymbol(),n.accept("last")?-3:3;case"nth":var p=parseInt(n.value[1],10);if(p<-366||p>366)throw new Error("Nth out of range: "+p);return n.nextSymbol(),n.accept("last")?-p:p;default:return!1}}function u(){n.accept("on"),n.accept("the");var p=o();if(!!p)for(t.bymonthday=[p],n.nextSymbol();n.accept("comma");){if(p=o(),!p)throw new Error("Unexpected symbol "+n.symbol+"; expected monthday");t.bymonthday.push(p),n.nextSymbol()}}function m(){if(n.symbol==="until"){var p=Date.parse(n.text);if(!p)throw new Error("Cannot parse until date:"+n.text);t.until=new Date(p)}else n.accept("for")&&(t.count=parseInt(n.value[0],10),n.expect("number"))}}var Hr;(function(e){e[e.YEARLY=0]="YEARLY",e[e.MONTHLY=1]="MONTHLY",e[e.WEEKLY=2]="WEEKLY",e[e.DAILY=3]="DAILY",e[e.HOURLY=4]="HOURLY",e[e.MINUTELY=5]="MINUTELY",e[e.SECONDLY=6]="SECONDLY"})(Hr||(Hr={}));function fc(e){return e12){var n=Math.floor(this.month/12),a=Pn(this.month,12);this.month=a,this.year+=n,this.month===0&&(this.month=12,--this.year)}},r.prototype.addWeekly=function(t,n){n>this.getWeekday()?this.day+=-(this.getWeekday()+1+(6-n))+t*7:this.day+=-(this.getWeekday()-n)+t*7,this.fixDay()},r.prototype.addDaily=function(t){this.day+=t,this.fixDay()},r.prototype.addHours=function(t,n,a){for(n&&(this.hour+=Math.floor((23-this.hour)/t)*t);;){this.hour+=t;var i=np(this.hour,24),s=i.div,c=i.mod;if(s&&(this.hour=c,this.addDaily(s)),Ta(a)||jr(a,this.hour))break}},r.prototype.addMinutes=function(t,n,a,i){for(n&&(this.minute+=Math.floor((1439-(this.hour*60+this.minute))/t)*t);;){this.minute+=t;var s=np(this.minute,60),c=s.div,f=s.mod;if(c&&(this.minute=f,this.addHours(c,!1,a)),(Ta(a)||jr(a,this.hour))&&(Ta(i)||jr(i,this.minute)))break}},r.prototype.addSeconds=function(t,n,a,i,s){for(n&&(this.second+=Math.floor((86399-(this.hour*3600+this.minute*60+this.second))/t)*t);;){this.second+=t;var c=np(this.second,60),f=c.div,o=c.mod;if(f&&(this.second=o,this.addMinutes(f,!1,a,i)),(Ta(a)||jr(a,this.hour))&&(Ta(i)||jr(i,this.minute))&&(Ta(s)||jr(s,this.second)))break}},r.prototype.fixDay=function(){if(!(this.day<=28)){var t=Yw(this.year,this.month-1)[1];if(!(this.day<=t))for(;this.day>t;){if(this.day-=t,++this.month,this.month===13&&(this.month=1,++this.year,this.year>ap))return;t=Yw(this.year,this.month-1)[1]}}},r.prototype.add=function(t,n){var a=t.freq,i=t.interval,s=t.wkst,c=t.byhour,f=t.byminute,o=t.bysecond;switch(a){case Hr.YEARLY:return this.addYears(i);case Hr.MONTHLY:return this.addMonths(i);case Hr.WEEKLY:return this.addWeekly(i,s);case Hr.DAILY:return this.addDaily(i);case Hr.HOURLY:return this.addHours(i,n,c);case Hr.MINUTELY:return this.addMinutes(i,n,c,f);case Hr.SECONDLY:return this.addSeconds(i,n,c,f,o)}},r}(rf);function Gw(e){for(var r=[],t=Object.keys(e),n=0,a=t;n=-366&&n<=366))throw new Error("bysetpos must be between 1 and 366, or between -366 and -1")}}if(!(Boolean(r.byweekno)||Xt(r.byweekno)||Xt(r.byyearday)||Boolean(r.bymonthday)||Xt(r.bymonthday)||Ct(r.byweekday)||Ct(r.byeaster)))switch(r.freq){case vr.YEARLY:r.bymonth||(r.bymonth=r.dtstart.getUTCMonth()+1),r.bymonthday=r.dtstart.getUTCDate();break;case vr.MONTHLY:r.bymonthday=r.dtstart.getUTCDate();break;case vr.WEEKLY:r.byweekday=[go(r.dtstart)];break}if(Ct(r.bymonth)&&!Mn(r.bymonth)&&(r.bymonth=[r.bymonth]),Ct(r.byyearday)&&!Mn(r.byyearday)&&Ca(r.byyearday)&&(r.byyearday=[r.byyearday]),!Ct(r.bymonthday))r.bymonthday=[],r.bynmonthday=[];else if(Mn(r.bymonthday)){for(var a=[],i=[],t=0;t0?a.push(n):n<0&&i.push(n)}r.bymonthday=a,r.bynmonthday=i}else r.bymonthday<0?(r.bynmonthday=[r.bymonthday],r.bymonthday=[]):(r.bynmonthday=[],r.bymonthday=[r.bymonthday]);if(Ct(r.byweekno)&&!Mn(r.byweekno)&&(r.byweekno=[r.byweekno]),!Ct(r.byweekday))r.bynweekday=null;else if(Ca(r.byweekday))r.byweekday=[r.byweekday],r.bynweekday=null;else if(Uw(r.byweekday))r.byweekday=[rn.fromStr(r.byweekday).weekday],r.bynweekday=null;else if(r.byweekday instanceof rn)!r.byweekday.n||r.freq>vr.MONTHLY?(r.byweekday=[r.byweekday.weekday],r.bynweekday=null):(r.bynweekday=[[r.byweekday.weekday,r.byweekday.n]],r.byweekday=null);else{for(var s=[],c=[],t=0;tvr.MONTHLY?s.push(f.weekday):c.push([f.weekday,f.n])}r.byweekday=Xt(s)?s:null,r.bynweekday=Xt(c)?c:null}return Ct(r.byhour)?Ca(r.byhour)&&(r.byhour=[r.byhour]):r.byhour=r.freq0&&i();break;case"number":m.im=0,m.re=o;break;default:i()}return isNaN(m.re)||isNaN(m.im),m};function f(o,u){if(!(this instanceof f))return new f(o,u);var m=c(o,u);this.re=m.re,this.im=m.im}f.prototype={re:0,im:0,sign:function(){var o=this.abs();return new f(this.re/o,this.im/o)},add:function(o,u){var m=new f(o,u);return this.isInfinite()&&m.isInfinite()?f.NAN:this.isInfinite()||m.isInfinite()?f.INFINITY:new f(this.re+m.re,this.im+m.im)},sub:function(o,u){var m=new f(o,u);return this.isInfinite()&&m.isInfinite()?f.NAN:this.isInfinite()||m.isInfinite()?f.INFINITY:new f(this.re-m.re,this.im-m.im)},mul:function(o,u){var m=new f(o,u);return this.isInfinite()&&m.isZero()||this.isZero()&&m.isInfinite()?f.NAN:this.isInfinite()||m.isInfinite()?f.INFINITY:m.im===0&&this.im===0?new f(this.re*m.re,0):new f(this.re*m.re-this.im*m.im,this.re*m.im+this.im*m.re)},div:function(o,u){var m=new f(o,u);if(this.isZero()&&m.isZero()||this.isInfinite()&&m.isInfinite())return f.NAN;if(this.isInfinite()||m.isZero())return f.INFINITY;if(this.isZero()||m.isInfinite())return f.ZERO;o=this.re,u=this.im;var p=m.re,h=m.im,y,v;return h===0?new f(o/p,u/p):Math.abs(p)0)return new f(Math.pow(o,m.re),0);if(o===0)switch((m.re%4+4)%4){case 0:return new f(Math.pow(u,m.re),0);case 1:return new f(0,Math.pow(u,m.re));case 2:return new f(-Math.pow(u,m.re),0);case 3:return new f(0,-Math.pow(u,m.re))}}if(o===0&&u===0&&m.re>0&&m.im>=0)return f.ZERO;var p=Math.atan2(u,o),h=s(o,u);return o=Math.exp(m.re*h-m.im*p),u=m.im*h+m.re*p,new f(o*Math.cos(u),o*Math.sin(u))},sqrt:function(){var o=this.re,u=this.im,m=this.abs(),p,h;if(o>=0){if(u===0)return new f(Math.sqrt(o),0);p=.5*Math.sqrt(2*(m+o))}else p=Math.abs(u)/Math.sqrt(2*(m-o));return o<=0?h=.5*Math.sqrt(2*(m-o)):h=Math.abs(u)/Math.sqrt(2*(m+o)),new f(p,u<0?-h:h)},exp:function(){var o=Math.exp(this.re);return this.im,new f(o*Math.cos(this.im),o*Math.sin(this.im))},expm1:function(){var o=this.re,u=this.im;return new f(Math.expm1(o)*Math.cos(u)+n(u),Math.exp(o)*Math.sin(u))},log:function(){var o=this.re,u=this.im;return u===0&&o>0,new f(s(o,u),Math.atan2(u,o))},abs:function(){return a(this.re,this.im)},arg:function(){return Math.atan2(this.im,this.re)},sin:function(){var o=this.re,u=this.im;return new f(Math.sin(o)*r(u),Math.cos(o)*t(u))},cos:function(){var o=this.re,u=this.im;return new f(Math.cos(o)*r(u),-Math.sin(o)*t(u))},tan:function(){var o=2*this.re,u=2*this.im,m=Math.cos(o)+r(u);return new f(Math.sin(o)/m,t(u)/m)},cot:function(){var o=2*this.re,u=2*this.im,m=Math.cos(o)-r(u);return new f(-Math.sin(o)/m,t(u)/m)},sec:function(){var o=this.re,u=this.im,m=.5*r(2*u)+.5*Math.cos(2*o);return new f(Math.cos(o)*r(u)/m,Math.sin(o)*t(u)/m)},csc:function(){var o=this.re,u=this.im,m=.5*r(2*u)-.5*Math.cos(2*o);return new f(Math.sin(o)*r(u)/m,-Math.cos(o)*t(u)/m)},asin:function(){var o=this.re,u=this.im,m=new f(u*u-o*o+1,-2*o*u).sqrt(),p=new f(m.re-u,m.im+o).log();return new f(p.im,-p.re)},acos:function(){var o=this.re,u=this.im,m=new f(u*u-o*o+1,-2*o*u).sqrt(),p=new f(m.re-u,m.im+o).log();return new f(Math.PI/2-p.im,p.re)},atan:function(){var o=this.re,u=this.im;if(o===0){if(u===1)return new f(0,1/0);if(u===-1)return new f(0,-1/0)}var m=o*o+(1-u)*(1-u),p=new f((1-u*u-o*o)/m,-2*o/m).log();return new f(-.5*p.im,.5*p.re)},acot:function(){var o=this.re,u=this.im;if(u===0)return new f(Math.atan2(1,o),0);var m=o*o+u*u;return m!==0?new f(o/m,-u/m).atan():new f(o!==0?o/0:0,u!==0?-u/0:0).atan()},asec:function(){var o=this.re,u=this.im;if(o===0&&u===0)return new f(0,1/0);var m=o*o+u*u;return m!==0?new f(o/m,-u/m).acos():new f(o!==0?o/0:0,u!==0?-u/0:0).acos()},acsc:function(){var o=this.re,u=this.im;if(o===0&&u===0)return new f(Math.PI/2,1/0);var m=o*o+u*u;return m!==0?new f(o/m,-u/m).asin():new f(o!==0?o/0:0,u!==0?-u/0:0).asin()},sinh:function(){var o=this.re,u=this.im;return new f(t(o)*Math.cos(u),r(o)*Math.sin(u))},cosh:function(){var o=this.re,u=this.im;return new f(r(o)*Math.cos(u),t(o)*Math.sin(u))},tanh:function(){var o=2*this.re,u=2*this.im,m=r(o)+Math.cos(u);return new f(t(o)/m,Math.sin(u)/m)},coth:function(){var o=2*this.re,u=2*this.im,m=r(o)-Math.cos(u);return new f(t(o)/m,-Math.sin(u)/m)},csch:function(){var o=this.re,u=this.im,m=Math.cos(2*u)-r(2*o);return new f(-2*t(o)*Math.cos(u)/m,2*r(o)*Math.sin(u)/m)},sech:function(){var o=this.re,u=this.im,m=Math.cos(2*u)+r(2*o);return new f(2*r(o)*Math.cos(u)/m,-2*t(o)*Math.sin(u)/m)},asinh:function(){var o=this.im;this.im=-this.re,this.re=o;var u=this.asin();return this.re=-this.im,this.im=o,o=u.re,u.re=-u.im,u.im=o,u},acosh:function(){var o=this.acos();if(o.im<=0){var u=o.re;o.re=-o.im,o.im=u}else{var u=o.im;o.im=-o.re,o.re=u}return o},atanh:function(){var o=this.re,u=this.im,m=o>1&&u===0,p=1-o,h=1+o,y=p*p+u*u,v=y!==0?new f((h*p-u*u)/y,(u*p+h*u)/y):new f(o!==-1?o/0:0,u!==0?u/0:0),x=v.re;return v.re=s(v.re,v.im)/2,v.im=Math.atan2(v.im,x)/2,m&&(v.im=-v.im),v},acoth:function(){var o=this.re,u=this.im;if(o===0&&u===0)return new f(0,Math.PI/2);var m=o*o+u*u;return m!==0?new f(o/m,-u/m).atanh():new f(o!==0?o/0:0,u!==0?-u/0:0).atanh()},acsch:function(){var o=this.re,u=this.im;if(u===0)return new f(o!==0?Math.log(o+Math.sqrt(o*o+1)):1/0,0);var m=o*o+u*u;return m!==0?new f(o/m,-u/m).asinh():new f(o!==0?o/0:0,u!==0?-u/0:0).asinh()},asech:function(){var o=this.re,u=this.im;if(this.isZero())return f.INFINITY;var m=o*o+u*u;return m!==0?new f(o/m,-u/m).acosh():new f(o!==0?o/0:0,u!==0?-u/0:0).acosh()},inverse:function(){if(this.isZero())return f.INFINITY;if(this.isInfinite())return f.ZERO;var o=this.re,u=this.im,m=o*o+u*u;return new f(o/m,-u/m)},conjugate:function(){return new f(this.re,-this.im)},neg:function(){return new f(-this.re,-this.im)},ceil:function(o){return o=Math.pow(10,o||0),new f(Math.ceil(this.re*o)/o,Math.ceil(this.im*o)/o)},floor:function(o){return o=Math.pow(10,o||0),new f(Math.floor(this.re*o)/o,Math.floor(this.im*o)/o)},round:function(o){return o=Math.pow(10,o||0),new f(Math.round(this.re*o)/o,Math.round(this.im*o)/o)},equals:function(o,u){var m=new f(o,u);return Math.abs(m.re-this.re)<=f.EPSILON&&Math.abs(m.im-this.im)<=f.EPSILON},clone:function(){return new f(this.re,this.im)},toString:function(){var o=this.re,u=this.im,m="";return this.isNaN()?"NaN":this.isInfinite()?"Infinity":(Math.abs(o){(function(e){"use strict";var r=2e3,t={s:1,n:0,d:1};function n(v,x){if(isNaN(v=parseInt(v,10)))throw h();return v*x}function a(v,x){if(x===0)throw p();var b=Object.create(m.prototype);b.s=v<0?-1:1,v=v<0?-v:v;var E=u(v,x);return b.n=v/E,b.d=x/E,b}function i(v){for(var x={},b=v,E=2,w=4;w<=b;){for(;b%E===0;)b/=E,x[E]=(x[E]||0)+1;w+=1+2*E++}return b!==v?b>1&&(x[b]=(x[b]||0)+1):x[v]=(x[v]||0)+1,x}var s=function(v,x){var b=0,E=1,w=1,N=0,M=0,D=0,O=1,_=1,C=0,T=1,k=1,L=1,H=1e7,V;if(v!=null)if(x!==void 0){if(b=v,E=x,w=b*E,b%1!==0||E%1!==0)throw y()}else switch(typeof v){case"object":{if("d"in v&&"n"in v)b=v.n,E=v.d,"s"in v&&(b*=v.s);else if(0 in v)b=v[0],1 in v&&(E=v[1]);else throw h();w=b*E;break}case"number":{if(v<0&&(w=v,v=-v),v%1===0)b=v;else if(v>0){for(v>=1&&(_=Math.pow(10,Math.floor(1+Math.log(v)/Math.LN10)),v/=_);T<=H&&L<=H;)if(V=(C+k)/(T+L),v===V){T+L<=H?(b=C+k,E=T+L):L>T?(b=k,E=L):(b=C,E=T);break}else v>V?(C+=k,T+=L):(k+=C,L+=T),T>H?(b=k,E=L):(b=C,E=T);b*=_}else(isNaN(v)||isNaN(x))&&(E=b=NaN);break}case"string":{if(T=v.match(/\\d+|./g),T===null)throw h();if(T[C]==="-"?(w=-1,C++):T[C]==="+"&&C++,T.length===C+1?M=n(T[C++],w):T[C+1]==="."||T[C]==="."?(T[C]!=="."&&(N=n(T[C++],w)),C++,(C+1===T.length||T[C+1]==="("&&T[C+3]===")"||T[C+1]==="'"&&T[C+3]==="'")&&(M=n(T[C],w),O=Math.pow(10,T[C].length),C++),(T[C]==="("&&T[C+2]===")"||T[C]==="'"&&T[C+2]==="'")&&(D=n(T[C+1],w),_=Math.pow(10,T[C+1].length)-1,C+=3)):T[C+1]==="/"||T[C+1]===":"?(M=n(T[C],w),O=n(T[C+2],1),C+=3):T[C+3]==="/"&&T[C+1]===" "&&(N=n(T[C],w),M=n(T[C+2],w),O=n(T[C+4],1),C+=5),T.length<=C){E=O*_,w=b=D+E*N+_*M;break}}default:throw h()}if(E===0)throw p();t.s=w<0?-1:1,t.n=Math.abs(b),t.d=Math.abs(E)};function c(v,x,b){for(var E=1;x>0;v=v*v%b,x>>=1)x&1&&(E=E*v%b);return E}function f(v,x){for(;x%2===0;x/=2);for(;x%5===0;x/=5);if(x===1)return 0;for(var b=10%x,E=1;b!==1;E++)if(b=b*10%x,E>r)return 0;return E}function o(v,x,b){for(var E=1,w=c(10,b,x),N=0;N<300;N++){if(E===w)return N;E=E*10%x,w=w*10%x}return 0}function u(v,x){if(!v)return x;if(!x)return v;for(;;){if(v%=x,!v)return x;if(x%=v,!x)return v}}function m(v,x){if(s(v,x),this instanceof m)v=u(t.d,t.n),this.s=t.s,this.n=t.n/v,this.d=t.d/v;else return a(t.s*t.n,t.d)}var p=function(){return new Error("Division by Zero")},h=function(){return new Error("Invalid argument")},y=function(){return new Error("Parameters must be integer")};m.prototype={s:1,n:0,d:1,abs:function(){return a(this.n,this.d)},neg:function(){return a(-this.s*this.n,this.d)},add:function(v,x){return s(v,x),a(this.s*this.n*t.d+t.s*this.d*t.n,this.d*t.d)},sub:function(v,x){return s(v,x),a(this.s*this.n*t.d-t.s*this.d*t.n,this.d*t.d)},mul:function(v,x){return s(v,x),a(this.s*t.s*this.n*t.n,this.d*t.d)},div:function(v,x){return s(v,x),a(this.s*t.s*this.n*t.d,this.d*t.n)},clone:function(){return a(this.s*this.n,this.d)},mod:function(v,x){if(isNaN(this.n)||isNaN(this.d))return new m(NaN);if(v===void 0)return a(this.s*this.n%this.d,1);if(s(v,x),t.n===0&&this.d===0)throw p();return a(this.s*(t.d*this.n)%(t.n*this.d),t.d*this.d)},gcd:function(v,x){return s(v,x),a(u(t.n,this.n)*u(t.d,this.d),t.d*this.d)},lcm:function(v,x){return s(v,x),t.n===0&&this.n===0?a(0,1):a(t.n*this.n,u(t.n,this.n)*u(t.d,this.d))},ceil:function(v){return v=Math.pow(10,v||0),isNaN(this.n)||isNaN(this.d)?new m(NaN):a(Math.ceil(v*this.s*this.n/this.d),v)},floor:function(v){return v=Math.pow(10,v||0),isNaN(this.n)||isNaN(this.d)?new m(NaN):a(Math.floor(v*this.s*this.n/this.d),v)},round:function(v){return v=Math.pow(10,v||0),isNaN(this.n)||isNaN(this.d)?new m(NaN):a(Math.round(v*this.s*this.n/this.d),v)},inverse:function(){return a(this.s*this.d,this.n)},pow:function(v,x){if(s(v,x),t.d===1)return t.s<0?a(Math.pow(this.s*this.d,t.n),Math.pow(this.n,t.n)):a(Math.pow(this.s*this.n,t.n),Math.pow(this.d,t.n));if(this.s<0)return null;var b=i(this.n),E=i(this.d),w=1,N=1;for(var M in b)if(M!=="1"){if(M==="0"){w=0;break}if(b[M]*=t.n,b[M]%t.d===0)b[M]/=t.d;else return null;w*=Math.pow(M,b[M])}for(var M in E)if(M!=="1"){if(E[M]*=t.n,E[M]%t.d===0)E[M]/=t.d;else return null;N*=Math.pow(M,E[M])}return t.s<0?a(N,w):a(w,N)},equals:function(v,x){return s(v,x),this.s*this.n*t.d===t.s*t.n*this.d},compare:function(v,x){s(v,x);var b=this.s*this.n*t.d-t.s*t.n*this.d;return(0=0;N--)w=w.inverse().add(b[N]);if(Math.abs(w.sub(x).valueOf())0&&(b+=x,b+=" ",E%=w),b+=E,b+="/",b+=w),b},toLatex:function(v){var x,b="",E=this.n,w=this.d;return this.s<0&&(b+="-"),w===1?b+=E:(v&&(x=Math.floor(E/w))>0&&(b+=x,E%=w),b+="\\\\frac{",b+=E,b+="}{",b+=w,b+="}"),b},toContinued:function(){var v,x=this.n,b=this.d,E=[];if(isNaN(x)||isNaN(b))return E;do E.push(Math.floor(x/b)),v=x%b,x=b,b=v;while(x!==1);return E},toString:function(v){var x=this.n,b=this.d;if(isNaN(x)||isNaN(b))return"NaN";v=v||15;var E=f(x,b),w=o(x,b,E),N=this.s<0?"-":"";if(N+=x/b|0,x%=b,x*=10,x&&(N+="."),E){for(var M=w;M--;)N+=x/b|0,x%=b,x*=10;N+="(";for(var M=E;M--;)N+=x/b|0,x%=b,x*=10;N+=")"}else for(var M=v;x&&M--;)N+=x/b|0,x%=b,x*=10;return N}},typeof SD=="object"?(Object.defineProperty(m,"__esModule",{value:!0}),m.default=m,m.Fraction=m,WE.exports=m):e.Fraction=m})(SD)});var i_=Nn((Qhe,a_)=>{a_.exports=function e(r,t){"use strict";var n=/(^([+\\-]?(?:0|[1-9]\\d*)(?:\\.\\d*)?(?:[eE][+\\-]?\\d+)?)?$|^0x[0-9a-f]+$|\\d+)/gi,a=/(^[ ]*|[ ]*$)/g,i=/(^([\\w ]+,?[\\w ]+)?[\\w ]+,?[\\w ]+\\d+:\\d+(:\\d+)?[\\w ]?|^\\d{1,4}[\\/\\-]\\d{1,4}[\\/\\-]\\d{1,4}|^\\w+, \\w+ \\d+, \\d{4})/,s=/^0x[0-9a-f]+$/i,c=/^0/,f=function(w){return e.insensitive&&(""+w).toLowerCase()||""+w},o=f(r).replace(a,"")||"",u=f(t).replace(a,"")||"",m=o.replace(n,"\\0$1\\0").replace(/\\0$/,"").replace(/^\\0/,"").split("\\0"),p=u.replace(n,"\\0$1\\0").replace(/\\0$/,"").replace(/^\\0/,"").split("\\0"),h=parseInt(o.match(s),16)||m.length!==1&&o.match(i)&&Date.parse(o),y=parseInt(u.match(s),16)||h&&u.match(i)&&Date.parse(u)||null,v,x;if(y){if(hy)return 1}for(var b=0,E=Math.max(m.length,p.length);bx)return 1}return 0}});var uF=Nn((m1e,sF)=>{"use strict";var CS=Object.assign||function(e){for(var r=1;r1&&arguments[1]!==void 0?arguments[1]:{},t=r.preserveFormatting,n=t===void 0?!1:t,a=r.escapeMapFn,i=a===void 0?vZ:a,s=String(e),c="",f=i(CS({},dZ),n?CS({},hZ):{}),o=Object.keys(f),u=function(){var p=!1;o.forEach(function(h,y){p||s.length>=h.length&&s.slice(0,h.length)===h&&(c+=f[o[y]],s=s.slice(h.length,s.length),p=!0)}),p||(c+=s.slice(0,1),s=s.slice(1,s.length))};s;)u();return c}});var LP=Nn((kP,RS)=>{(function(e,r,t){function n(c){var f=this,o=s();f.next=function(){var u=2091639*f.s0+f.c*23283064365386963e-26;return f.s0=f.s1,f.s1=f.s2,f.s2=u-(f.c=u|0)},f.c=1,f.s0=o(" "),f.s1=o(" "),f.s2=o(" "),f.s0-=o(c),f.s0<0&&(f.s0+=1),f.s1-=o(c),f.s1<0&&(f.s1+=1),f.s2-=o(c),f.s2<0&&(f.s2+=1),o=null}function a(c,f){return f.c=c.c,f.s0=c.s0,f.s1=c.s1,f.s2=c.s2,f}function i(c,f){var o=new n(c),u=f&&f.state,m=o.next;return m.int32=function(){return o.next()*4294967296|0},m.double=function(){return m()+(m()*2097152|0)*11102230246251565e-32},m.quick=m,u&&(typeof u=="object"&&a(u,o),m.state=function(){return a(o,{})}),m}function s(){var c=4022871197,f=function(o){o=String(o);for(var u=0;u>>0,m-=c,m*=c,c=m>>>0,m-=c,c+=m*4294967296}return(c>>>0)*23283064365386963e-26};return f}r&&r.exports?r.exports=i:t&&t.amd?t(function(){return i}):this.alea=i})(kP,typeof RS=="object"&&RS,typeof define=="function"&&define)});var UP=Nn((qP,kS)=>{(function(e,r,t){function n(s){var c=this,f="";c.x=0,c.y=0,c.z=0,c.w=0,c.next=function(){var u=c.x^c.x<<11;return c.x=c.y,c.y=c.z,c.z=c.w,c.w^=c.w>>>19^u^u>>>8},s===(s|0)?c.x=s:f+=s;for(var o=0;o>>0)/4294967296};return u.double=function(){do var m=f.next()>>>11,p=(f.next()>>>0)/4294967296,h=(m+p)/(1<<21);while(h===0);return h},u.int32=f.next,u.quick=u,o&&(typeof o=="object"&&a(o,f),u.state=function(){return a(f,{})}),u}r&&r.exports?r.exports=i:t&&t.amd?t(function(){return i}):this.xor128=i})(qP,typeof kS=="object"&&kS,typeof define=="function"&&define)});var YP=Nn((zP,LS)=>{(function(e,r,t){function n(s){var c=this,f="";c.next=function(){var u=c.x^c.x>>>2;return c.x=c.y,c.y=c.z,c.z=c.w,c.w=c.v,(c.d=c.d+362437|0)+(c.v=c.v^c.v<<4^(u^u<<1))|0},c.x=0,c.y=0,c.z=0,c.w=0,c.v=0,s===(s|0)?c.x=s:f+=s;for(var o=0;o>>4),c.next()}function a(s,c){return c.x=s.x,c.y=s.y,c.z=s.z,c.w=s.w,c.v=s.v,c.d=s.d,c}function i(s,c){var f=new n(s),o=c&&c.state,u=function(){return(f.next()>>>0)/4294967296};return u.double=function(){do var m=f.next()>>>11,p=(f.next()>>>0)/4294967296,h=(m+p)/(1<<21);while(h===0);return h},u.int32=f.next,u.quick=u,o&&(typeof o=="object"&&a(o,f),u.state=function(){return a(f,{})}),u}r&&r.exports?r.exports=i:t&&t.amd?t(function(){return i}):this.xorwow=i})(zP,typeof LS=="object"&&LS,typeof define=="function"&&define)});var HP=Nn((WP,qS)=>{(function(e,r,t){function n(s){var c=this;c.next=function(){var o=c.x,u=c.i,m,p,h;return m=o[u],m^=m>>>7,p=m^m<<24,m=o[u+1&7],p^=m^m>>>10,m=o[u+3&7],p^=m^m>>>3,m=o[u+4&7],p^=m^m<<7,m=o[u+7&7],m=m^m<<13,p^=m^m<<9,o[u]=p,c.i=u+1&7,p};function f(o,u){var m,p,h=[];if(u===(u|0))p=h[0]=u;else for(u=""+u,m=0;m0;--m)o.next()}f(c,s)}function a(s,c){return c.x=s.x.slice(),c.i=s.i,c}function i(s,c){s==null&&(s=+new Date);var f=new n(s),o=c&&c.state,u=function(){return(f.next()>>>0)/4294967296};return u.double=function(){do var m=f.next()>>>11,p=(f.next()>>>0)/4294967296,h=(m+p)/(1<<21);while(h===0);return h},u.int32=f.next,u.quick=u,o&&(o.x&&a(o,f),u.state=function(){return a(f,{})}),u}r&&r.exports?r.exports=i:t&&t.amd?t(function(){return i}):this.xorshift7=i})(WP,typeof qS=="object"&&qS,typeof define=="function"&&define)});var GP=Nn(($P,US)=>{(function(e,r,t){function n(s){var c=this;c.next=function(){var o=c.w,u=c.X,m=c.i,p,h;return c.w=o=o+1640531527|0,h=u[m+34&127],p=u[m=m+1&127],h^=h<<13,p^=p<<17,h^=h>>>15,p^=p>>>12,h=u[m]=h^p,c.i=m,h+(o^o>>>16)|0};function f(o,u){var m,p,h,y,v,x=[],b=128;for(u===(u|0)?(p=u,u=null):(u=u+"\\0",p=0,b=Math.max(b,u.length)),h=0,y=-32;y>>15,p^=p<<4,p^=p>>>13,y>=0&&(v=v+1640531527|0,m=x[y&127]^=p+v,h=m==0?h+1:0);for(h>=128&&(x[(u&&u.length||0)&127]=-1),h=127,y=4*128;y>0;--y)p=x[h+34&127],m=x[h=h+1&127],p^=p<<13,m^=m<<17,p^=p>>>15,m^=m>>>12,x[h]=p^m;o.w=v,o.X=x,o.i=h}f(c,s)}function a(s,c){return c.i=s.i,c.w=s.w,c.X=s.X.slice(),c}function i(s,c){s==null&&(s=+new Date);var f=new n(s),o=c&&c.state,u=function(){return(f.next()>>>0)/4294967296};return u.double=function(){do var m=f.next()>>>11,p=(f.next()>>>0)/4294967296,h=(m+p)/(1<<21);while(h===0);return h},u.int32=f.next,u.quick=u,o&&(o.X&&a(o,f),u.state=function(){return a(f,{})}),u}r&&r.exports?r.exports=i:t&&t.amd?t(function(){return i}):this.xor4096=i})($P,typeof US=="object"&&US,typeof define=="function"&&define)});var ZP=Nn((VP,zS)=>{(function(e,r,t){function n(s){var c=this,f="";c.next=function(){var u=c.b,m=c.c,p=c.d,h=c.a;return u=u<<25^u>>>7^m,m=m-p|0,p=p<<24^p>>>8^h,h=h-u|0,c.b=u=u<<20^u>>>12^m,c.c=m=m-p|0,c.d=p<<16^m>>>16^h,c.a=h-u|0},c.a=0,c.b=0,c.c=-1640531527,c.d=1367130551,s===Math.floor(s)?(c.a=s/4294967296|0,c.b=s|0):f+=s;for(var o=0;o>>0)/4294967296};return u.double=function(){do var m=f.next()>>>11,p=(f.next()>>>0)/4294967296,h=(m+p)/(1<<21);while(h===0);return h},u.int32=f.next,u.quick=u,o&&(typeof o=="object"&&a(o,f),u.state=function(){return a(f,{})}),u}r&&r.exports?r.exports=i:t&&t.amd?t(function(){return i}):this.tychei=i})(VP,typeof zS=="object"&&zS,typeof define=="function"&&define)});var QP=Nn(()=>{});var KP=Nn((XP,Yy)=>{(function(e,r,t){var n=256,a=6,i=52,s="random",c=t.pow(n,a),f=t.pow(2,i),o=f*2,u=n-1,m;function p(w,N,M){var D=[];N=N==!0?{entropy:!0}:N||{};var O=x(v(N.entropy?[w,E(r)]:w??b(),3),D),_=new h(D),C=function(){for(var T=_.g(a),k=c,L=0;T=o;)T/=2,k/=2,L>>>=1;return(T+L)/k};return C.int32=function(){return _.g(4)|0},C.quick=function(){return _.g(4)/4294967296},C.double=C,x(E(_.S),r),(N.pass||M||function(T,k,L,H){return H&&(H.S&&y(H,_),T.state=function(){return y(_,{})}),L?(t[s]=T,k):T})(C,O,"global"in N?N.global:this==t,N.state)}function h(w){var N,M=w.length,D=this,O=0,_=D.i=D.j=0,C=D.S=[];for(M||(w=[M++]);O{var BQ=LP(),IQ=UP(),PQ=YP(),RQ=HP(),kQ=GP(),LQ=ZP(),lu=KP();lu.alea=BQ;lu.xor128=IQ;lu.xorwow=PQ;lu.xorshift7=RQ;lu.xor4096=kQ;lu.tychei=LQ;JP.exports=lu});var e6=Nn((J6e,LN)=>{function kN(){}kN.prototype={on:function(e,r,t){var n=this.e||(this.e={});return(n[e]||(n[e]=[])).push({fn:r,ctx:t}),this},once:function(e,r,t){var n=this;function a(){n.off(e,a),r.apply(t,arguments)}return a._=r,this.on(e,a,t)},emit:function(e){var r=[].slice.call(arguments,1),t=((this.e||(this.e={}))[e]||[]).slice(),n=0,a=t.length;for(n;n1?"s":"")+" required, but only "+r.length+" present")}function Qt(e){ut(1,arguments);var r=Object.prototype.toString.call(e);return e instanceof Date||Va(e)==="object"&&r==="[object Date]"?new Date(e.getTime()):typeof e=="number"||r==="[object Number]"?new Date(e):((typeof e=="string"||r==="[object String]")&&typeof console<"u"&&(console.warn("Starting with v2.0.0-beta.1 date-fns doesn't accept strings as date arguments. Please use \`parseISO\` to parse strings. See: https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#string-arguments"),console.warn(new Error().stack)),new Date(NaN))}function xw(e,r){ut(2,arguments);var t=Qt(e).getTime(),n=Bn(r);return new Date(t+n)}var Eq={};function Xo(){return Eq}function bw(e){var r=new Date(Date.UTC(e.getFullYear(),e.getMonth(),e.getDate(),e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds()));return r.setUTCFullYear(e.getFullYear()),e.getTime()-r.getTime()}var Cq=365.2425,Tq=Math.pow(10,8)*24*60*60*1e3,ww=6e4,Dw=36e5;var OK=-Tq;var _q=3600;var dM=_q*24,BK=dM*7,Fq=dM*Cq,Oq=Fq/12,IK=Oq*3;function Sw(e){return ut(1,arguments),e instanceof Date||Va(e)==="object"&&Object.prototype.toString.call(e)==="[object Date]"}function Nw(e){if(ut(1,arguments),!Sw(e)&&typeof e!="number")return!1;var r=Qt(e);return!isNaN(Number(r))}function Aw(e,r){ut(2,arguments);var t=Bn(r);return xw(e,-t)}var Bq=864e5;function Mw(e){ut(1,arguments);var r=Qt(e),t=r.getTime();r.setUTCMonth(0,1),r.setUTCHours(0,0,0,0);var n=r.getTime(),a=t-n;return Math.floor(a/Bq)+1}function Ko(e){ut(1,arguments);var r=1,t=Qt(e),n=t.getUTCDay(),a=(n=a.getTime()?t+1:r.getTime()>=s.getTime()?t:t-1}function Ew(e){ut(1,arguments);var r=Kl(e),t=new Date(0);t.setUTCFullYear(r,0,4),t.setUTCHours(0,0,0,0);var n=Ko(t);return n}var Iq=6048e5;function Cw(e){ut(1,arguments);var r=Qt(e),t=Ko(r).getTime()-Ew(r).getTime();return Math.round(t/Iq)+1}function Jo(e,r){var t,n,a,i,s,c,f,o;ut(1,arguments);var u=Xo(),m=Bn((t=(n=(a=(i=r?.weekStartsOn)!==null&&i!==void 0?i:r==null||(s=r.locale)===null||s===void 0||(c=s.options)===null||c===void 0?void 0:c.weekStartsOn)!==null&&a!==void 0?a:u.weekStartsOn)!==null&&n!==void 0?n:(f=u.locale)===null||f===void 0||(o=f.options)===null||o===void 0?void 0:o.weekStartsOn)!==null&&t!==void 0?t:0);if(!(m>=0&&m<=6))throw new RangeError("weekStartsOn must be between 0 and 6 inclusively");var p=Qt(e),h=p.getUTCDay(),y=(h=1&&h<=7))throw new RangeError("firstWeekContainsDate must be between 1 and 7 inclusively");var y=new Date(0);y.setUTCFullYear(m+1,0,h),y.setUTCHours(0,0,0,0);var v=Jo(y,r),x=new Date(0);x.setUTCFullYear(m,0,h),x.setUTCHours(0,0,0,0);var b=Jo(x,r);return u.getTime()>=v.getTime()?m+1:u.getTime()>=b.getTime()?m:m-1}function Tw(e,r){var t,n,a,i,s,c,f,o;ut(1,arguments);var u=Xo(),m=Bn((t=(n=(a=(i=r?.firstWeekContainsDate)!==null&&i!==void 0?i:r==null||(s=r.locale)===null||s===void 0||(c=s.options)===null||c===void 0?void 0:c.firstWeekContainsDate)!==null&&a!==void 0?a:u.firstWeekContainsDate)!==null&&n!==void 0?n:(f=u.locale)===null||f===void 0||(o=f.options)===null||o===void 0?void 0:o.firstWeekContainsDate)!==null&&t!==void 0?t:1),p=Jl(e,r),h=new Date(0);h.setUTCFullYear(p,0,m),h.setUTCHours(0,0,0,0);var y=Jo(h,r);return y}var Pq=6048e5;function _w(e,r){ut(1,arguments);var t=Qt(e),n=Jo(t,r).getTime()-Tw(t,r).getTime();return Math.round(n/Pq)+1}function mt(e,r){for(var t=e<0?"-":"",n=Math.abs(e).toString();n.length0?n:1-n;return mt(t==="yy"?a%100:a,t.length)},M:function(r,t){var n=r.getUTCMonth();return t==="M"?String(n+1):mt(n+1,2)},d:function(r,t){return mt(r.getUTCDate(),t.length)},a:function(r,t){var n=r.getUTCHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":return n.toUpperCase();case"aaa":return n;case"aaaaa":return n[0];case"aaaa":default:return n==="am"?"a.m.":"p.m."}},h:function(r,t){return mt(r.getUTCHours()%12||12,t.length)},H:function(r,t){return mt(r.getUTCHours(),t.length)},m:function(r,t){return mt(r.getUTCMinutes(),t.length)},s:function(r,t){return mt(r.getUTCSeconds(),t.length)},S:function(r,t){var n=t.length,a=r.getUTCMilliseconds(),i=Math.floor(a*Math.pow(10,n-3));return mt(i,t.length)}},vo=Rq;var Vu={am:"am",pm:"pm",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},kq={G:function(r,t,n){var a=r.getUTCFullYear()>0?1:0;switch(t){case"G":case"GG":case"GGG":return n.era(a,{width:"abbreviated"});case"GGGGG":return n.era(a,{width:"narrow"});case"GGGG":default:return n.era(a,{width:"wide"})}},y:function(r,t,n){if(t==="yo"){var a=r.getUTCFullYear(),i=a>0?a:1-a;return n.ordinalNumber(i,{unit:"year"})}return vo.y(r,t)},Y:function(r,t,n,a){var i=Jl(r,a),s=i>0?i:1-i;if(t==="YY"){var c=s%100;return mt(c,2)}return t==="Yo"?n.ordinalNumber(s,{unit:"year"}):mt(s,t.length)},R:function(r,t){var n=Kl(r);return mt(n,t.length)},u:function(r,t){var n=r.getUTCFullYear();return mt(n,t.length)},Q:function(r,t,n){var a=Math.ceil((r.getUTCMonth()+1)/3);switch(t){case"Q":return String(a);case"QQ":return mt(a,2);case"Qo":return n.ordinalNumber(a,{unit:"quarter"});case"QQQ":return n.quarter(a,{width:"abbreviated",context:"formatting"});case"QQQQQ":return n.quarter(a,{width:"narrow",context:"formatting"});case"QQQQ":default:return n.quarter(a,{width:"wide",context:"formatting"})}},q:function(r,t,n){var a=Math.ceil((r.getUTCMonth()+1)/3);switch(t){case"q":return String(a);case"qq":return mt(a,2);case"qo":return n.ordinalNumber(a,{unit:"quarter"});case"qqq":return n.quarter(a,{width:"abbreviated",context:"standalone"});case"qqqqq":return n.quarter(a,{width:"narrow",context:"standalone"});case"qqqq":default:return n.quarter(a,{width:"wide",context:"standalone"})}},M:function(r,t,n){var a=r.getUTCMonth();switch(t){case"M":case"MM":return vo.M(r,t);case"Mo":return n.ordinalNumber(a+1,{unit:"month"});case"MMM":return n.month(a,{width:"abbreviated",context:"formatting"});case"MMMMM":return n.month(a,{width:"narrow",context:"formatting"});case"MMMM":default:return n.month(a,{width:"wide",context:"formatting"})}},L:function(r,t,n){var a=r.getUTCMonth();switch(t){case"L":return String(a+1);case"LL":return mt(a+1,2);case"Lo":return n.ordinalNumber(a+1,{unit:"month"});case"LLL":return n.month(a,{width:"abbreviated",context:"standalone"});case"LLLLL":return n.month(a,{width:"narrow",context:"standalone"});case"LLLL":default:return n.month(a,{width:"wide",context:"standalone"})}},w:function(r,t,n,a){var i=_w(r,a);return t==="wo"?n.ordinalNumber(i,{unit:"week"}):mt(i,t.length)},I:function(r,t,n){var a=Cw(r);return t==="Io"?n.ordinalNumber(a,{unit:"week"}):mt(a,t.length)},d:function(r,t,n){return t==="do"?n.ordinalNumber(r.getUTCDate(),{unit:"date"}):vo.d(r,t)},D:function(r,t,n){var a=Mw(r);return t==="Do"?n.ordinalNumber(a,{unit:"dayOfYear"}):mt(a,t.length)},E:function(r,t,n){var a=r.getUTCDay();switch(t){case"E":case"EE":case"EEE":return n.day(a,{width:"abbreviated",context:"formatting"});case"EEEEE":return n.day(a,{width:"narrow",context:"formatting"});case"EEEEEE":return n.day(a,{width:"short",context:"formatting"});case"EEEE":default:return n.day(a,{width:"wide",context:"formatting"})}},e:function(r,t,n,a){var i=r.getUTCDay(),s=(i-a.weekStartsOn+8)%7||7;switch(t){case"e":return String(s);case"ee":return mt(s,2);case"eo":return n.ordinalNumber(s,{unit:"day"});case"eee":return n.day(i,{width:"abbreviated",context:"formatting"});case"eeeee":return n.day(i,{width:"narrow",context:"formatting"});case"eeeeee":return n.day(i,{width:"short",context:"formatting"});case"eeee":default:return n.day(i,{width:"wide",context:"formatting"})}},c:function(r,t,n,a){var i=r.getUTCDay(),s=(i-a.weekStartsOn+8)%7||7;switch(t){case"c":return String(s);case"cc":return mt(s,t.length);case"co":return n.ordinalNumber(s,{unit:"day"});case"ccc":return n.day(i,{width:"abbreviated",context:"standalone"});case"ccccc":return n.day(i,{width:"narrow",context:"standalone"});case"cccccc":return n.day(i,{width:"short",context:"standalone"});case"cccc":default:return n.day(i,{width:"wide",context:"standalone"})}},i:function(r,t,n){var a=r.getUTCDay(),i=a===0?7:a;switch(t){case"i":return String(i);case"ii":return mt(i,t.length);case"io":return n.ordinalNumber(i,{unit:"day"});case"iii":return n.day(a,{width:"abbreviated",context:"formatting"});case"iiiii":return n.day(a,{width:"narrow",context:"formatting"});case"iiiiii":return n.day(a,{width:"short",context:"formatting"});case"iiii":default:return n.day(a,{width:"wide",context:"formatting"})}},a:function(r,t,n){var a=r.getUTCHours(),i=a/12>=1?"pm":"am";switch(t){case"a":case"aa":return n.dayPeriod(i,{width:"abbreviated",context:"formatting"});case"aaa":return n.dayPeriod(i,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return n.dayPeriod(i,{width:"narrow",context:"formatting"});case"aaaa":default:return n.dayPeriod(i,{width:"wide",context:"formatting"})}},b:function(r,t,n){var a=r.getUTCHours(),i;switch(a===12?i=Vu.noon:a===0?i=Vu.midnight:i=a/12>=1?"pm":"am",t){case"b":case"bb":return n.dayPeriod(i,{width:"abbreviated",context:"formatting"});case"bbb":return n.dayPeriod(i,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return n.dayPeriod(i,{width:"narrow",context:"formatting"});case"bbbb":default:return n.dayPeriod(i,{width:"wide",context:"formatting"})}},B:function(r,t,n){var a=r.getUTCHours(),i;switch(a>=17?i=Vu.evening:a>=12?i=Vu.afternoon:a>=4?i=Vu.morning:i=Vu.night,t){case"B":case"BB":case"BBB":return n.dayPeriod(i,{width:"abbreviated",context:"formatting"});case"BBBBB":return n.dayPeriod(i,{width:"narrow",context:"formatting"});case"BBBB":default:return n.dayPeriod(i,{width:"wide",context:"formatting"})}},h:function(r,t,n){if(t==="ho"){var a=r.getUTCHours()%12;return a===0&&(a=12),n.ordinalNumber(a,{unit:"hour"})}return vo.h(r,t)},H:function(r,t,n){return t==="Ho"?n.ordinalNumber(r.getUTCHours(),{unit:"hour"}):vo.H(r,t)},K:function(r,t,n){var a=r.getUTCHours()%12;return t==="Ko"?n.ordinalNumber(a,{unit:"hour"}):mt(a,t.length)},k:function(r,t,n){var a=r.getUTCHours();return a===0&&(a=24),t==="ko"?n.ordinalNumber(a,{unit:"hour"}):mt(a,t.length)},m:function(r,t,n){return t==="mo"?n.ordinalNumber(r.getUTCMinutes(),{unit:"minute"}):vo.m(r,t)},s:function(r,t,n){return t==="so"?n.ordinalNumber(r.getUTCSeconds(),{unit:"second"}):vo.s(r,t)},S:function(r,t){return vo.S(r,t)},X:function(r,t,n,a){var i=a._originalDate||r,s=i.getTimezoneOffset();if(s===0)return"Z";switch(t){case"X":return vM(s);case"XXXX":case"XX":return Ws(s);case"XXXXX":case"XXX":default:return Ws(s,":")}},x:function(r,t,n,a){var i=a._originalDate||r,s=i.getTimezoneOffset();switch(t){case"x":return vM(s);case"xxxx":case"xx":return Ws(s);case"xxxxx":case"xxx":default:return Ws(s,":")}},O:function(r,t,n,a){var i=a._originalDate||r,s=i.getTimezoneOffset();switch(t){case"O":case"OO":case"OOO":return"GMT"+hM(s,":");case"OOOO":default:return"GMT"+Ws(s,":")}},z:function(r,t,n,a){var i=a._originalDate||r,s=i.getTimezoneOffset();switch(t){case"z":case"zz":case"zzz":return"GMT"+hM(s,":");case"zzzz":default:return"GMT"+Ws(s,":")}},t:function(r,t,n,a){var i=a._originalDate||r,s=Math.floor(i.getTime()/1e3);return mt(s,t.length)},T:function(r,t,n,a){var i=a._originalDate||r,s=i.getTime();return mt(s,t.length)}};function hM(e,r){var t=e>0?"-":"+",n=Math.abs(e),a=Math.floor(n/60),i=n%60;if(i===0)return t+String(a);var s=r||"";return t+String(a)+s+mt(i,2)}function vM(e,r){if(e%60===0){var t=e>0?"-":"+";return t+mt(Math.abs(e)/60,2)}return Ws(e,r)}function Ws(e,r){var t=r||"",n=e>0?"-":"+",a=Math.abs(e),i=mt(Math.floor(a/60),2),s=mt(a%60,2);return n+i+t+s}var gM=kq;var yM=function(r,t){switch(r){case"P":return t.date({width:"short"});case"PP":return t.date({width:"medium"});case"PPP":return t.date({width:"long"});case"PPPP":default:return t.date({width:"full"})}},xM=function(r,t){switch(r){case"p":return t.time({width:"short"});case"pp":return t.time({width:"medium"});case"ppp":return t.time({width:"long"});case"pppp":default:return t.time({width:"full"})}},Lq=function(r,t){var n=r.match(/(P+)(p+)?/)||[],a=n[1],i=n[2];if(!i)return yM(r,t);var s;switch(a){case"P":s=t.dateTime({width:"short"});break;case"PP":s=t.dateTime({width:"medium"});break;case"PPP":s=t.dateTime({width:"long"});break;case"PPPP":default:s=t.dateTime({width:"full"});break}return s.replace("{{date}}",yM(a,t)).replace("{{time}}",xM(i,t))},qq={p:xM,P:Lq},bM=qq;var Uq=["D","DD"],zq=["YY","YYYY"];function wM(e){return Uq.indexOf(e)!==-1}function DM(e){return zq.indexOf(e)!==-1}function Fw(e,r,t){if(e==="YYYY")throw new RangeError("Use \`yyyy\` instead of \`YYYY\` (in \`".concat(r,"\`) for formatting years to the input \`").concat(t,"\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md"));if(e==="YY")throw new RangeError("Use \`yy\` instead of \`YY\` (in \`".concat(r,"\`) for formatting years to the input \`").concat(t,"\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md"));if(e==="D")throw new RangeError("Use \`d\` instead of \`D\` (in \`".concat(r,"\`) for formatting days of the month to the input \`").concat(t,"\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md"));if(e==="DD")throw new RangeError("Use \`dd\` instead of \`DD\` (in \`".concat(r,"\`) for formatting days of the month to the input \`").concat(t,"\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md"))}var Yq={lessThanXSeconds:{one:"less than a second",other:"less than {{count}} seconds"},xSeconds:{one:"1 second",other:"{{count}} seconds"},halfAMinute:"half a minute",lessThanXMinutes:{one:"less than a minute",other:"less than {{count}} minutes"},xMinutes:{one:"1 minute",other:"{{count}} minutes"},aboutXHours:{one:"about 1 hour",other:"about {{count}} hours"},xHours:{one:"1 hour",other:"{{count}} hours"},xDays:{one:"1 day",other:"{{count}} days"},aboutXWeeks:{one:"about 1 week",other:"about {{count}} weeks"},xWeeks:{one:"1 week",other:"{{count}} weeks"},aboutXMonths:{one:"about 1 month",other:"about {{count}} months"},xMonths:{one:"1 month",other:"{{count}} months"},aboutXYears:{one:"about 1 year",other:"about {{count}} years"},xYears:{one:"1 year",other:"{{count}} years"},overXYears:{one:"over 1 year",other:"over {{count}} years"},almostXYears:{one:"almost 1 year",other:"almost {{count}} years"}},Wq=function(r,t,n){var a,i=Yq[r];return typeof i=="string"?a=i:t===1?a=i.one:a=i.other.replace("{{count}}",t.toString()),n!=null&&n.addSuffix?n.comparison&&n.comparison>0?"in "+a:a+" ago":a},SM=Wq;function jl(e){return function(){var r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t=r.width?String(r.width):e.defaultWidth,n=e.formats[t]||e.formats[e.defaultWidth];return n}}var Hq={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},$q={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},Gq={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},Vq={date:jl({formats:Hq,defaultWidth:"full"}),time:jl({formats:$q,defaultWidth:"full"}),dateTime:jl({formats:Gq,defaultWidth:"full"})},NM=Vq;var Zq={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},Qq=function(r,t,n,a){return Zq[r]},AM=Qq;function Hs(e){return function(r,t){var n=t!=null&&t.context?String(t.context):"standalone",a;if(n==="formatting"&&e.formattingValues){var i=e.defaultFormattingWidth||e.defaultWidth,s=t!=null&&t.width?String(t.width):i;a=e.formattingValues[s]||e.formattingValues[i]}else{var c=e.defaultWidth,f=t!=null&&t.width?String(t.width):e.defaultWidth;a=e.values[f]||e.values[c]}var o=e.argumentCallback?e.argumentCallback(r):r;return a[o]}}var Xq={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},Kq={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},Jq={narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],wide:["January","February","March","April","May","June","July","August","September","October","November","December"]},jq={narrow:["S","M","T","W","T","F","S"],short:["Su","Mo","Tu","We","Th","Fr","Sa"],abbreviated:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],wide:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},eU={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"}},rU={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"}},tU=function(r,t){var n=Number(r),a=n%100;if(a>20||a<10)switch(a%10){case 1:return n+"st";case 2:return n+"nd";case 3:return n+"rd"}return n+"th"},nU={ordinalNumber:tU,era:Hs({values:Xq,defaultWidth:"wide"}),quarter:Hs({values:Kq,defaultWidth:"wide",argumentCallback:function(r){return r-1}}),month:Hs({values:Jq,defaultWidth:"wide"}),day:Hs({values:jq,defaultWidth:"wide"}),dayPeriod:Hs({values:eU,defaultWidth:"wide",formattingValues:rU,defaultFormattingWidth:"wide"})},MM=nU;function $s(e){return function(r){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=t.width,a=n&&e.matchPatterns[n]||e.matchPatterns[e.defaultMatchWidth],i=r.match(a);if(!i)return null;var s=i[0],c=n&&e.parsePatterns[n]||e.parsePatterns[e.defaultParseWidth],f=Array.isArray(c)?iU(c,function(m){return m.test(s)}):aU(c,function(m){return m.test(s)}),o;o=e.valueCallback?e.valueCallback(f):f,o=t.valueCallback?t.valueCallback(o):o;var u=r.slice(s.length);return{value:o,rest:u}}}function aU(e,r){for(var t in e)if(e.hasOwnProperty(t)&&r(e[t]))return t}function iU(e,r){for(var t=0;t1&&arguments[1]!==void 0?arguments[1]:{},n=r.match(e.matchPattern);if(!n)return null;var a=n[0],i=r.match(e.parsePattern);if(!i)return null;var s=e.valueCallback?e.valueCallback(i[0]):i[0];s=t.valueCallback?t.valueCallback(s):s;var c=r.slice(a.length);return{value:s,rest:c}}}var oU=/^(\\d+)(th|st|nd|rd)?/i,sU=/\\d+/i,uU={narrow:/^(b|a)/i,abbreviated:/^(b\\.?\\s?c\\.?|b\\.?\\s?c\\.?\\s?e\\.?|a\\.?\\s?d\\.?|c\\.?\\s?e\\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},fU={any:[/^b/i,/^(a|c)/i]},lU={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},cU={any:[/1/i,/2/i,/3/i,/4/i]},mU={narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},pU={narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},dU={narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},hU={narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},vU={narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\\.?\\s?m\\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},gU={any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},yU={ordinalNumber:Ow({matchPattern:oU,parsePattern:sU,valueCallback:function(r){return parseInt(r,10)}}),era:$s({matchPatterns:uU,defaultMatchWidth:"wide",parsePatterns:fU,defaultParseWidth:"any"}),quarter:$s({matchPatterns:lU,defaultMatchWidth:"wide",parsePatterns:cU,defaultParseWidth:"any",valueCallback:function(r){return r+1}}),month:$s({matchPatterns:mU,defaultMatchWidth:"wide",parsePatterns:pU,defaultParseWidth:"any"}),day:$s({matchPatterns:dU,defaultMatchWidth:"wide",parsePatterns:hU,defaultParseWidth:"any"}),dayPeriod:$s({matchPatterns:vU,defaultMatchWidth:"any",parsePatterns:gU,defaultParseWidth:"any"})},EM=yU;var xU={code:"en-US",formatDistance:SM,formatLong:NM,formatRelative:AM,localize:MM,match:EM,options:{weekStartsOn:0,firstWeekContainsDate:1}},CM=xU;var TM=CM;var bU=/[yYQqMLwIdDecihHKkms]o|(\\w)\\1*|''|'(''|[^'])+('|$)|./g,wU=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,DU=/^'([^]*?)'?$/,SU=/''/g,NU=/[a-zA-Z]/;function Yi(e,r,t){var n,a,i,s,c,f,o,u,m,p,h,y,v,x,b,E,w,N;ut(2,arguments);var M=String(r),D=Xo(),O=(n=(a=t?.locale)!==null&&a!==void 0?a:D.locale)!==null&&n!==void 0?n:TM,_=Bn((i=(s=(c=(f=t?.firstWeekContainsDate)!==null&&f!==void 0?f:t==null||(o=t.locale)===null||o===void 0||(u=o.options)===null||u===void 0?void 0:u.firstWeekContainsDate)!==null&&c!==void 0?c:D.firstWeekContainsDate)!==null&&s!==void 0?s:(m=D.locale)===null||m===void 0||(p=m.options)===null||p===void 0?void 0:p.firstWeekContainsDate)!==null&&i!==void 0?i:1);if(!(_>=1&&_<=7))throw new RangeError("firstWeekContainsDate must be between 1 and 7 inclusively");var C=Bn((h=(y=(v=(x=t?.weekStartsOn)!==null&&x!==void 0?x:t==null||(b=t.locale)===null||b===void 0||(E=b.options)===null||E===void 0?void 0:E.weekStartsOn)!==null&&v!==void 0?v:D.weekStartsOn)!==null&&y!==void 0?y:(w=D.locale)===null||w===void 0||(N=w.options)===null||N===void 0?void 0:N.weekStartsOn)!==null&&h!==void 0?h:0);if(!(C>=0&&C<=6))throw new RangeError("weekStartsOn must be between 0 and 6 inclusively");if(!O.localize)throw new RangeError("locale must contain localize property");if(!O.formatLong)throw new RangeError("locale must contain formatLong property");var T=Qt(e);if(!Nw(T))throw new RangeError("Invalid time value");var k=bw(T),L=Aw(T,k),H={firstWeekContainsDate:_,weekStartsOn:C,locale:O,_originalDate:T},V=M.match(wU).map(function(W){var q=W[0];if(q==="p"||q==="P"){var R=bM[q];return R(W,O.formatLong)}return W}).join("").match(bU).map(function(W){if(W==="''")return"'";var q=W[0];if(q==="'")return AU(W);var R=gM[q];if(R)return!(t!=null&&t.useAdditionalWeekYearTokens)&&DM(W)&&Fw(W,r,String(e)),!(t!=null&&t.useAdditionalDayOfYearTokens)&&wM(W)&&Fw(W,r,String(e)),R(L,W,O.localize,H);if(q.match(NU))throw new RangeError("Format string contains an unescaped latin alphabet character \`"+q+"\`");return W}).join("");return V}function AU(e){var r=e.match(DU);return r?r[1].replace(SU,"'"):e}function Bw(e,r){if(Va(e)!="object"||!e)return e;var t=e[Symbol.toPrimitive];if(t!==void 0){var n=t.call(e,r||"default");if(Va(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(r==="string"?String:Number)(e)}function Iw(e){var r=Bw(e,"string");return Va(r)=="symbol"?r:r+""}function Vr(e,r,t){return r=Iw(r),r in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}function Km(e,r){var t;ut(1,arguments);var n=Bn((t=r?.additionalDigits)!==null&&t!==void 0?t:2);if(n!==2&&n!==1&&n!==0)throw new RangeError("additionalDigits must be 0, 1 or 2");if(!(typeof e=="string"||Object.prototype.toString.call(e)==="[object String]"))return new Date(NaN);var a=TU(e),i;if(a.date){var s=_U(a.date,n);i=FU(s.restDateString,s.year)}if(!i||isNaN(i.getTime()))return new Date(NaN);var c=i.getTime(),f=0,o;if(a.time&&(f=OU(a.time),isNaN(f)))return new Date(NaN);if(a.timezone){if(o=BU(a.timezone),isNaN(o))return new Date(NaN)}else{var u=new Date(c+f),m=new Date(0);return m.setFullYear(u.getUTCFullYear(),u.getUTCMonth(),u.getUTCDate()),m.setHours(u.getUTCHours(),u.getUTCMinutes(),u.getUTCSeconds(),u.getUTCMilliseconds()),m}return new Date(c+f+o)}var Xm={dateTimeDelimiter:/[T ]/,timeZoneDelimiter:/[Z ]/i,timezone:/([Z+-].*)$/},MU=/^-?(?:(\\d{3})|(\\d{2})(?:-?(\\d{2}))?|W(\\d{2})(?:-?(\\d{1}))?|)$/,EU=/^(\\d{2}(?:[.,]\\d*)?)(?::?(\\d{2}(?:[.,]\\d*)?))?(?::?(\\d{2}(?:[.,]\\d*)?))?$/,CU=/^([+-])(\\d{2})(?::?(\\d{2}))?$/;function TU(e){var r={},t=e.split(Xm.dateTimeDelimiter),n;if(t.length>2)return r;if(/:/.test(t[0])?n=t[0]:(r.date=t[0],n=t[1],Xm.timeZoneDelimiter.test(r.date)&&(r.date=e.split(Xm.timeZoneDelimiter)[0],n=e.substr(r.date.length,e.length))),n){var a=Xm.timezone.exec(n);a?(r.time=n.replace(a[1],""),r.timezone=a[1]):r.time=n}return r}function _U(e,r){var t=new RegExp("^(?:(\\\\d{4}|[+-]\\\\d{"+(4+r)+"})|(\\\\d{2}|[+-]\\\\d{"+(2+r)+"})$)"),n=e.match(t);if(!n)return{year:NaN,restDateString:""};var a=n[1]?parseInt(n[1]):null,i=n[2]?parseInt(n[2]):null;return{year:i===null?a:i*100,restDateString:e.slice((n[1]||n[2]).length)}}function FU(e,r){if(r===null)return new Date(NaN);var t=e.match(MU);if(!t)return new Date(NaN);var n=!!t[4],a=ec(t[1]),i=ec(t[2])-1,s=ec(t[3]),c=ec(t[4]),f=ec(t[5])-1;if(n)return LU(r,c,f)?IU(r,c,f):new Date(NaN);var o=new Date(0);return!RU(r,i,s)||!kU(r,a)?new Date(NaN):(o.setUTCFullYear(r,i,Math.max(a,s)),o)}function ec(e){return e?parseInt(e):1}function OU(e){var r=e.match(EU);if(!r)return NaN;var t=Pw(r[1]),n=Pw(r[2]),a=Pw(r[3]);return qU(t,n,a)?t*Dw+n*ww+a*1e3:NaN}function Pw(e){return e&&parseFloat(e.replace(",","."))||0}function BU(e){if(e==="Z")return 0;var r=e.match(CU);if(!r)return 0;var t=r[1]==="+"?-1:1,n=parseInt(r[2]),a=r[3]&&parseInt(r[3])||0;return UU(n,a)?t*(n*Dw+a*ww):NaN}function IU(e,r,t){var n=new Date(0);n.setUTCFullYear(e,0,4);var a=n.getUTCDay()||7,i=(r-1)*7+t+1-a;return n.setUTCDate(n.getUTCDate()+i),n}var PU=[31,null,31,30,31,30,31,31,30,31,30,31];function _M(e){return e%400===0||e%4===0&&e%100!==0}function RU(e,r,t){return r>=0&&r<=11&&t>=1&&t<=(PU[r]||(_M(e)?29:28))}function kU(e,r){return r>=1&&r<=(_M(e)?366:365)}function LU(e,r,t){return r>=1&&r<=53&&t>=0&&t<=6}function qU(e,r,t){return e===24?r===0&&t===0:t>=0&&t<60&&r>=0&&r<60&&e>=0&&e<25}function UU(e,r){return r>=0&&r<=59}var Ma=e=>[...new Set(e)];var FM=(e,r)=>e.sort(function(t,n){let a=r.indexOf(t),i=r.indexOf(n);return a>i?a!=-1&&i==-1?-1:1:i!=-1&&a==-1?1:-1});function Jm(e){return Array.isArray(e)?e:typeof e=="string"?[e]:[]}function OM(e){if(!e)return"";if(typeof e!="string"){let r=e.toString();return typeof r=="string"?r:""}return e}var BM=(e,r)=>r.indexOf(e)>0?r.indexOf(e):r.length;var rc=e=>"spaces://"+e;var IM=(e,r)=>!e||e.length==0?r:e,PM=e=>e.charAt(0)=="/"?e.substring(1):e;var In="File";var zU=(e,r)=>{let t=n=>n=="builtin"?"Builtin":n=="api"?"Spaces":"Action";return[...(e.actionsIndex.get(r)??[]).map(n=>({name:n.schema.name,description:"Action",value:\`\${r}/#;\${n.schema.id}\`,section:"Action"}))??[],...[...e.cli.allCommands()].map(n=>({name:n.schema.name,description:t(n.schema.type),value:n.path,section:t(n.schema.type)}))]};var RM=({field:e,value:r})=>r=="ctime"?{value:"parseDate(prop('File')['metadata']['ctime'])",type:"date"}:{value:"",type:"string"},jm=(e,r,t,n)=>{let a=tc(e);if(a)return r=="fileprop"&&a.field?RM(a):(r=="option"&&a.source?.length>0&&(a.source=="$commands"?a.options=t.cli.allCommands():a.source=="$links"?a.options=t.spaceManager.allPaths().map(i=>({name:i,value:i})):a.source=="$super"?a.options=zU(t,n):a.source=="$properties"&&(a.options=t.contextsIndex.get(n)?.contextTable?.cols?.map(i=>({name:i.name,value:i.name}))??[])),[...kM(r).configKeys??[],"alias","default"].reduce((i,s)=>({...i,[s]:a[s]}),{}));if(!r)return{};if(!a)if(r=="context")e?.length>0?a={space:e}:a={};else if(r.startsWith("date"))e?.length>0?a={format:e}:a={};else if(r.startsWith("fileprop"))if(e?.length>0){let[i,s]=e.split(".");a=RM({field:i,value:s})}else a={};else r.startsWith("option")&&(e?.length>0?a={options:An(e).map(s=>({name:s,value:s}))}:a={});return a??{}};var qM=Aa(LM()),kw=class{constructor(){this.lang="en";this.all={en:{hintText:{fileName:"Enter File Name",alias:"Enter Display Name",dragDropModifierKeys:"Hold \${1} to Pin and \${2} to Copy",createListItem:"Select/Create List Item Frame",dragDropProperties:"Drag and drop properties to link them into the list",newItem:"+ New",selectNote:"Select Note...",newFrame:"New"},defaults:{spaceNote:"Current Note",spaceContext:"Current Space"},commands:{h1:"Heading 1",h2:"Heading 2",h3:"Heading 3",h4:"Heading 4",h5:"Heading 5",h6:"Heading 6",columns:"Columns",tabs:"Tabs",button:"Button",label:"Label",column:"Column",idea:"New",group:"Group",paragraph:"Text",card:"Card",progress:"Progress",rating:"Rating",circularProgress:"Circular Progress",list:"Bullet List","ordered-list":"Numbered List",todo:"To-do List",quote:"Quote",internal:"Link to Note",context:"Embed Existing Context",flow:"Embed Note or Space",board:"New Board",divider:"Divider",note:"Note Block",link:"Web Link",internalLink:"Link",callout:"Callout",bookmark:"Bookmark",table:"New Table",codeblock:"Code Block",toggle:"Toggle",emoji:"Emoji",image:"Image",newNote:"Note",tag:"Tag",makeMenu:"Flow Menu",selectStyle:"Style",toggleKeyboard:"Toggle Keyboard",rows:"Rows",masonry:"Gallery"},styles:{bold:"Bold",italics:"Italics",strikethrough:"Strikethrough",code:"Code",link:"Web Link",blocklink:"Link to Note",textColor:"Text Color",highlight:"Highlight"},commandsSuggest:{noResult:"No result"},commandPalette:{enable:"Enable",disabled:"Disable",openFlow:"Open Flow Blocks in Selection",closeFlow:"Close Flow Blocks in Selection",toggleBold:"Toggle Bold",toggleItalics:"Toggle Italics",openSpaces:"Open Navigator",blink:"Blink",openFileContext:"Open Explorer",convertPathToSpace:"Convert to Space",revealFile:"Reveal File in Navigator",releaseNotes:"Release Notes",getStarted:"Get Started",toggleBacklinks:"Toggle Backlinks",collapseAllFolders:"Collapse All Folders",addFileSpace:"Add File to Space",removeFileSpace:"Remove File from Space"},frames:{sections:{kit:"Kit",paths:"Paths"},label:{label:"Label",description:"Label"},note:{label:"Note",description:"Link to a note"},table:{label:"Table",description:"Table"},context:{label:"Context",description:"Display a context view from another space"},calendar:{label:"Calendar View"},field:{label:"Field",description:"Dynamic node that displays a value based on property type"},event:{label:"Event"},divider:{label:"Divider",description:"Divider to separate your content"},button:{label:"Button",description:"Buttons can perform actions and open links"},callout:{label:"Callout",description:"Callout to highlight important information"},toggle:{label:"Toggle",description:"Toggle to show/hide content"}},menu:{layout:"Layout",enterFlowState:"Enter Flow State",exitFlowState:"Exit Flow State",newView:"New View",calendarView:"Calendar View",dayView:"Day View",closeSpace:"Close Space in Focus",customView:"Custom View",detailsView:"Details View",catalogView:"Catalog View",galleryView:"Gallery View",deleteContext:"Delete Context",openSpace:"Open",revealInDefault:"Reveal in Finder",revealInExplorer:"Reveal in Explorer",setNone:"None",fileMetadataDescription:"This note only",openFilePane:"Open in a new pane",rename:"Rename",changeToFolderNote:"New Space from Note",moveFile:"Move file to...",moveFolder:"Move folder to...",duplicate:"Make a copy",edit:"Edit",delete:"Delete",getHelp:"Make.md Community",vault:"Vault",openVault:"Open Another Vault",openVaultInFolder:"Open Vault Folder",obSettings:"Obsidian Settings",commandPalette:"Command Palette",backToSpace:"Back to Navigator",collapseAllSections:"Collapse All Spaces",expandAllSections:"Expand All Spaces",collapseAllFolders:"Collapse All Folders",expandAllFolders:"Expand All Folders",spaceTitle:"Add/Remove in Space",home:"Home",none:"None",tableView:"Table View",cardView:"Card View",boardView:"Board View",listView:"List View",flowView:"Flow View",groupBy:"Group",sortBy:"Sort",filters:"Filters",newFilter:"New Filter",clearFilters:"Clear Filters",hide:"Hide",unhideFields:"Unhide All Properties",importDataview:"Import All Dataview Properties",saveAllProperties:"Save All Properties to Files",mergeProperties:"Merge Properties",removeFromSpace:"Unpin from Space",editCode:"Edit Code",editProperties:"Edit Properties",properties:"Properties",deleteProperty:"Delete Property",hideProperty:"Hide Property",unhideProperty:"Unhide Property",saveProperty:"Save Property",sortAscending:"Sort Ascending",sortDescending:"Sort Descending",deleteRow:"Delete Item",collapseAll:"Collapse All",customSort:"Custom Sort",groupSpaces:"Group Spaces",recurisveSort:"Apply to Subfolders",fileNameSortAlphaAsc:"File Name (A to Z)",fileNameSortAlphaDesc:"File Name (Z to A)",fileNameSortNumericalAsc:"File Name (1 to 9)",fileNameSortNumericalDesc:"File Name (9 to 1)",createdTimeSortAsc:"Created Time (new to old)",createdTimeSortDesc:"Created Time (old to new)",modifiedTimeSortAsc:"Modified Time (new to old)",modifiedTimeSortDesc:"Modified Time (old to new)",sizeSortAsc:"Size (smallest to largest)",sizeSortDesc:"Size (largest to smallest)",spaces:"Spaces",tags:"Tags",manageHiddenFiles:"Manage Hidden Files",manageActions:"Manage Actions",deleteSpace:"Delete",changeColor:"Change Color",changePropertyType:"Change Type",deleteFiles:"Delete Files",createFolderSpace:"Create Space from Folder",folder:"Folder",syncToContext:"Add Property to Context",setIcon:"Set Icon",copyEmbedLink:"Copy Embed Link",moveUp:"Move Up",moveDown:"Move Down",moveTo:"Move To",groupNodes:"Group Nodes",moveFrame:"Move Frame",renameFrame:"Rename Frame",deleteFrame:"Delete Frame",insertAbove:"Insert Above",insertBelow:"Insert Below"},editor:{rows:"Rows",columns:"Columns",catalog:"Catalog",gallery:"Gallery",grid:"Grid",scaleToFit:"Change to Fit",scaleToFill:"Change to Fill",fit:"Fit",strokeNone:"None",strokeSolid:"Solid",strokeDotted:"Dotted",strokeDashed:"Dashed",size:"Size",gap:"Gap",marginLeft:"Left",marginTop:"Top",marginRight:"Right",marginBottom:"Bottom",minimize:"Minimize",paddingLeft:"Left",paddingTop:"Top",paddingRight:"Right",paddingBottom:"Bottom",unlinkProperty:"Unlink Property",linkedProperty:"Linked Property",linkProperty:"Link Property",currentSpace:"Current Space",linkName:"\${1} Link",linkThumbnail:"\${1} Thumbnail",linkSticker:"\${1} Sticker",opacity:"Opacity",shadowSpread:"Spread",shadowBlur:"Blur",width:"Width",height:"Height",margin:"Margin",padding:"Padding",bold:"Bold",italic:"Italic",underline:"Underline",alignLeft:"Align Left",alignCenter:"Align Center",alignRight:"Align Right",alignJustify:"Align Justify",numberOfLines:"Lines",createVerticalSection:"Create Vertical Section",createHorizontalSection:"Create Horizontal Section",themeColors:"Theme Colors",uiColors:"UI Colors",hex:"Hex"},buttons:{add:"Add",togglePin:"Toggle Pin",refresh:"Refresh",showHidden:"Show Hidden",alias:"Alias",addFilter:"Add Filter",loadMore:"Load More",addCondition:"Add Condition",customize:"Customize",moreOptions:"More Options",saveProperty:"Save Property",newNote:"New Note",changeIcon:"Change Sticker",removeIcon:"Remove Sticker",addIcon:"Add Sticker",addCover:"Add Cover",addDisplay:"Display Name",changeBanner:"Change Cover",changeBannerShort:"Cover",saveChanges:"Save Changes",removeBanner:"Remove Cover",rename:"Change Name",editFrame:"Edit Frame",saveSpace:"Save Space",createSpace:"New Space",createFolder:"New Folder",createNote:"New Note",createCanvas:"New Canvas",addIntoSpace:"New Pin",addSmartSearch:"Add Live Search",subFolders:"Sub Folders",addItem:"Add Item",addProperty:"Add Property",editProperty:"Edit Property",addContext:"Add Context",cancel:"Cancel",search:"Search",delete:"Delete",toggleFlow:"Toggle Flow",openFlow:"Open Flow",hideFlow:"Hide Flow",openLink:"Open Link",addToSpace:"Add to Space",addToSpaceShort:"Pin",addTag:"Add Tag",tag:"Tag",syncFields:"Sync Properties",convertTable:"Convert to Markdown",cutTable:"Cut Table",deleteTable:"Delete From Note",blink:"Blink",addFile:"Add Item",merge:"Merge",saveView:"Save View",saveTable:"Save Table",renameView:"Rename View",deleteView:"Delete View",renameTable:"Rename Table",renameTag:"Rename Tag",createTag:"Create Tag",currentFolder:"Current Folder",sync:"Sync",pasteCSS:"Paste CSS",save:"Save",run:"Run"},metadataTypes:{fileName:"File Name",contexts:"Contexts",path:"Path",folder:"Folder",sticker:"Sticker",color:"Color",created:"Created",lastModified:"Last Modified",extension:"Extension",size:"Size",tags:"Tags",inlinks:"Linked Mentions",outlinks:"Links",label:"Label",fileMetadata:"File Metadata",frontmatter:"Frontmatter"},filterTypes:{contains:"contains",notContains:"does not contain",is:"is",isNot:"is not",before:"before",after:"on or after",anyOf:"is any of",noneOf:"is none of",checked:"is checked",unchecked:"is unchecked",isEmpty:"is empty",isNotEmpty:"is not empty",isSameDate:"is same date",isSameDateAsToday:"today"},sortTypes:{alphaAsc:"A to Z",alphaDesc:"Z to A",earliest:"Earliest",latest:"Latest",checkAsc:"Checked \\u2192 Unchecked",checkDesc:"Unchecked \\u2192 Checked",itemsAsc:"Least Items",itemsDesc:"Most Items"},properties:{defaultField:"Name",aggregate:{label:"Aggregate",description:"Aggregate functions to calculate values"},audio:{label:"Audio",description:"Audio"},text:{label:"Text",description:"Text field"},number:{label:"Number",description:"Number field with optional unit"},boolean:{label:"Yes/No",description:"Yes or No toggle to indicate the status"},date:{label:"Date",description:"Select a date from a calendar"},option:{label:"Option",description:"Select one or multiple option from a list"},file:{label:"File"},link:{label:"Link",description:"Link to another note or a website"},tags:{label:"Tags",description:"Use tags to quickly organize your items"},object:{label:"Object",description:"Store any complex objects"},context:{label:"Relation",description:"Connect to another context property and create a relation"},image:{label:"Image",description:"Select any image from your system or from the internet"},color:{label:"Color",description:"Use colors to label your items or status"},space:{label:"Context",description:"Link to a context"},icon:{label:"Sticker",description:"Use stickers to uniquely label your items or status"},super:{label:"Super Property",links:"Open Link",properties:"Update Property",api:"API",obsidianCommands:"Run Command",runCommand:"Run Command",performAction:"Perform Action",whenClicked:"When Clicked"},fileProperty:{name:"Name",label:"Formula",createdTime:"Created",modifiedTime:"Last Edited",sticker:"Sticker",links:"Links",tags:"Tags",spaces:"Spaces",extension:"Extension",size:"Size",preview:"Note Preview",parentFolder:"Folder",description:"Use a formula to dynamically display a property"}},views:{navigator:"Navigator",explorer:"Explorer",space:"Space"},subViews:{spaceItems:"Items",spaceContext:"Context",spaceLists:"Lists",spaceActions:"Actions",spaceTemplates:"Templates",smartSearch:"Live Searches",filesAndFolders:"Files and Folders"},labels:{duplicateTable:"Duplicate Table",aggregateBy:"Aggregate By",pinned:"Pinned",live:"Pinned by Live Search",moveTable:"Move Table",editFormula:"Edit Formula",editObject:"Edit Object",properties:"Properties",newAction:"Action",newTable:"List",template:"Template",createFolder:"New Folder Name",rename:"Rename",createNew:"New",default:"Default",done:"Done",changeCoverShort:"Change",reposition:"Reposition",tables:"Tables",selectDateFormat:"Select/Type Date Format",renameSection:"Edit Space",createSection:"New Folder",createNote:"New Note",contextMaker:"Context Maker",select:"Select",pinnedItems:"Pinned Items",collapse:"Collapse",expand:"Expand",all:"All",none:"None",view:"View",findStickers:"Find Sticker",mergeProperties:"Merge Properties",placeholder:"Type '\${1}' for commands",notePlaceholder:"New Note for \${1}",itemsSelected:"\${1} Selected",selectNote:"Select Note",selectIcon:"Select Icon",selectImage:"Select Image",selectSpace:"Select Space",styleSmall:"Small",styleMedium:"Medium",styleLarge:"Large",hiddenFilePattern:"Name, Suffixes and Extension",hiddenFileSpecific:"Exclude specific files and folders",textPlaceholder:"Enter Text",noFile:"is not created yet. Click to create.",navigatorSearchPlaceholder:"Search by Text or Filters",blinkPlaceholder:"Search for notes, spaces...",searchPlaceholder:"Type to search...",contextItemSelectPlaceholder:"Find Item",linkItemSelectPlaceholder:"Find or Create Note",pinNotePlaceholder:"Select a Note or Space to Pin",optionItemSelectPlaceholder:"Select Option",viewItemSelectPlaceholder:"Select View",tagItemSelectPlaceholder:"Find Tag",spaceSelectPlaceholder:"Select any Folder or Tag",propertyItemSelectPlaceholder:"Select Property",sortItemSelectPlaceholder:"Select Sort",filterItemSelectPlaceholder:"Select Filter",imageSelectPlaceholder:"Select an image or paste a URL",imageNotFoundPlaceholder:"No Images Found",syncFrontmatterProperty:"Sync Frontmatter Property",newProperty:"New Property",newPropertyShort:"New Property",propertyType:"Type",propertyDynamic:"Dyanmic",propertyValueSpace:"Space",propertyValueReference:"Related Property",propertyValueAggregate:"Aggregate Property",propertyValueProperty:"Property",propertyLookup:"Edit Formula",existingFrontmatter:"Existing Property",dateFormat:"Date Format",propertyFileProp:"Property",multiple:"Multiple",filesCount:"{$1} Files",hiddenFiles:"Hidden Files",addExtension:"Add Rule",saveView:"Save View",saveTable:"Save Table",renameView:"Rename View",renameTable:"Rename Table",syncMetadata:"Sync Metadata",syncProperties:"Sync Properties",selectContext:"Select Context",metadata:"Metadata",backlinks:"Backlinks",spaces:"Spaces",contexts:"Contexts",content:"Content",deleteSpace:"Delete Space",deleteFiles:"Delete Files",outgoingLinks:"Outgoing Links",moveTo:"Move to",addTo:"Pin to",copyTo:"Copy to",reorderIn:"Reorder in",border:"Border",corners:"Corners",color:"Color",backgroundColor:"Background",cornerRadius:"Radius",onClick:"On Click",layout:"Layout",element:"Element",name:"Name",display:"Display",alignment:"Alignment",margin:"Margin",padding:"Padding",gap:"Gap",width:"Width",height:"Height",opacity:"Opacity",shadow:"Shadow",shadowBlur:"Blur",shadowSpread:"Spread",typography:"Typography",layers:"Layers",fontSize:"Size",props:"Props",styles:"Styles",events:"Events",code:"Code",selectedLayers:"\${1} Layers"},descriptions:{spaceActions:"Create actions that runs when you press a button",spaceLists:"Create lists to track data and organize them in your space",spaceItems:"Add new items to the space or pin items to the space",spaceTemplates:"Create templates to quickly add items to your space",smartSearch:"Automatically pin notes to this space based on a set of searches",hiddenFileOptions:"Exclude any files and folders by name, suffix or extension.",deleteSpace:"Deleting the space will also delete the folder and its contents.",deleteFiles:"Delete \${1} files/folders and their contents?",addContext:"Contexts lets you connect properties from your tags",spaceProperties:"Define Properties for your Space Items",syncMetadata:"Select which fields from your notes to start syncing with the context.",syncProperties:"Contexts defines and syncs the same fields across your notes depending on their folder or tag.",selectContext:"Select which folder or tag context you want to sync the fields."},flowView:{emptyDoc:"Empty Document",itemsCount:" Items",emptyFolder:"This Folder is Empty"},notice:{duplicateFile:"Folder already contains note with same name",addedToSection:"Added to Space",fileExists:"File Already Exists",folderExists:"Folder Already Exists",noPropertyName:"Property Name is Required",noPropertiesFound:"No Properties Found",duplicatePropertyName:"Duplicate Property Name",newSpaceName:"Enter a name for your space",duplicateSpaceName:"Space name already exists",cantConvertNoteToSpace:"The view is not a note",templateSaved:"Template saved to space: ",tableDeleted:"Table removed from note, you can find the table in the folder space"},settings:{sections:{general:"General",navigator:"Navigator",appearance:"Appearance",interaction:"Preferences",context:"Context",label:"Labels",tags:"Tags",space:"Spaces",performance:"Performance",advanced:"Advanced",folderNote:"Folder Note",notes:"Notes"},searchWorker:{name:"Background Search",desc:"Search in background to improve reponsiveness while searching"},cacheIndex:{name:"Cache Search Index",desc:"Cache the index for faster search results"},layoutVertical:"Vertical",layoutHorizontal:"Horizontal",sectionGeneral:"General",sectionSidebar:"Spaces",sectionEditor:"Maker Mode",sectionFlow:"Flow",sectionAdvanced:"Advanced",sectionDataview:"Dataview",sectionContext:"Context",sectionStickers:"Labels",sectionNavigator:"Navigator",sectionDefault:"Default Spaces",sectionSpaceView:"Space View",sectionBlink:"Blink",sectionInlineContext:"Inline Context",sectionFlowBlock:"Flow Block",sectionFlowMenu:"Flow Menu",sectionFlowStyler:"Flow Styler",experimental:{name:"Experimental",desc:"Experimental features that are subject to change and may not be optimized for performance"},imageThumbnails:{name:"Generate Thumbnails",desc:"Create thumbnails for images to speed up performance"},minimalThemeFix:{name:"Minimal Theme Fix",description:"Apply fixes for the popular theme Minimal"},inlineStickerMenu:{name:"Inline Stickers",desc:"Add inline stickers by typing :"},openSpacesOnLaunch:{name:"Open Navigator as Default Tab",desc:"Open the Navigator tab when Obsidian launches"},spacesRightSplit:{name:"Navigator on Right Side",desc:"Open the Navigator in the right panel"},defaultSpaceTemplate:{name:"Default Space Template",desc:"Select the default template for new spaces"},defaultDateFormat:{name:"Default Date Format",desc:"Set the default date format, example: yyyy-MM-dd (see https://date-fns.org/v2.30.0/docs/format)"},defaultTimeFormat:{name:"Default Time Format",desc:"Set the default time format, example: h:mm a (see https://date-fns.org/v2.30.0/docs/format)"},autoAddContextsToSubtags:{name:"Apply Properties to Subtags",desc:"Automatically apply context properties to subtags"},newNotePlaceholder:{name:"New Note Placeholder",desc:"Default name for new notes"},folderIndentationLines:{name:"Show Folder Indentation Lines",desc:"Turn on to show a line on the left of folders to indicate indentation"},folderNoteLocation:{name:"Folder Note Location Inside Folder",desc:"Turn on to have folder notes inside the folder, turn off to have it outside"},folderViewDefault:{name:"Show Folder Note by Default",desc:"Show the folder note by default when opening a folder"},internalLinkFlowEditor:{name:"Show Toggles to Open Flow Editor on Links",desc:"Turn on to toggle Flow Blocks directly in inline links"},internalLinkSticker:{name:"Show Stickers on Links",desc:"Turn on to toggle stickers shown directly by beside internal links"},saveAllContextToFrontmatter:{name:"Sync Context Fields to Frontmatter",desc:"Turn on to automatically save all context fields to frontmatter fields, not just existing frontmatter fields."},syncFormulaToFrontmatter:{name:"Sync Formula Fields to Frontmatter",desc:"Turn on to save calculated formula values to frontmatter fields."},spaceSubFolder:{name:"Space Folder Name",desc:"Name of the folder for spaces"},basics:{name:"Make.md Basics",desc:"Enable features from Make.md Basics including styler and flow blocks"},spacesFolder:{name:"Tag Space Folder",desc:"Name of the folder for tag spaces"},dataviewInlineContext:{name:"Show Dataview in Inline Context",desc:"Show dataview when inline context is enabled"},inlineContext:{name:"Notes Header",desc:"Show a header to display labels and properties"},banners:{name:"Cover Image",desc:"Show a cover image for notes and spaces"},inlineContextProperties:{name:"Show Context Properties in Header",desc:"Show the properties in the header for notes and spaces"},inlineContextExpanded:{name:"Auto Expand Context Properties",desc:"Expand the inline context sections when opening a note"},inlineContextNameLayout:{name:"Title and Sticker Layout",desc:"Layout for inline title and sticker in Inline Context"},hideFrontmatter:{name:"Hide Context Properties",desc:"Hide properties you have added in context from the Obsidian properties panel"},autoOpenFileContext:{name:"Auto Open Explorer",desc:"Automatically open explorer panel in the right panel"},enableFolderNote:{name:"Enable Folder Note",desc:"Access the folder note in the folder page and hide the folder note from spaces"},folderNoteName:{name:"Folder Note Name",desc:"Name of the folder note, keep blank to use the same name as the folder"},expandFolderOnClick:{name:"Auto Expand Folder",desc:"Auto expand folders on click"},filePreviewOnHover:{name:"Preview on Hover",desc:"Preview on Hover while holding Control/Command key"},revealActiveFile:{name:"Reveal Active File",desc:"Automatically reveal the active file in Navigator"},contextEnabled:{name:"Contexts",desc:"Contexts allows you to have full control over the metadata of your files"},navigatorEnabled:{name:"Navigator",desc:"The navigator lets you create and organize your spaces"},spacesStickers:{name:"Stickers",desc:"Use Emojis to make it easier to find your notes"},spacesUseAlias:{name:"Alias",desc:"Use the alias metadata to show in Navigator"},spacesDisablePatch:{name:"Compatibility Mode",desc:"This will improve the compatibility of plugins while using the Navigator"},deleteFileOption:{name:"Delete File Option",desc:"Select how you want files to be deleted"},spacesDeleteOptions:{permanant:"Delete Permanently",trash:"Move to Obsidian Trash","system-trash":"Move to System Trash"},flowState:{name:"Flow State",desc:"Toggle the flow state"},showRibbon:{name:"App Ribbon",desc:"Show/hide the left menu aka. ribbon"},spaceViewEnabled:{name:"Spaces",desc:"Customize your folders and tags with properties and views"},defaultSpaces:{name:"Default Spaces",desc:"Recommended spaces for quickly organizing your vault"},homeSpace:{name:"Home Space",desc:"An easy-to-access space where you can add/organize your other spaces"},enableDefaultSpaces:{name:"Tag Spaces",desc:"Automatically create spaces for each of your tags"},readableLineWidth:{name:"Readable Line Width",desc:"Use Readable Line Width"},sidebarTabs:{name:"Sidebar Tabs",desc:"Show/hide other sidebar tabs"},spacesPerformance:{name:"Navigator Scroll Performance",desc:"Turn on performance mode for Navigator, may affect scrolling appearance. Requires Restart"},indexSVG:{name:"Use SVGs as Stickers",desc:"Use any svg file in your vault as a sticker"},inlineStyler:{name:"Flow Styler",desc:"Select text to add styling"},inlineStylerColor:{name:"Text and Highlight Colors \\u{1F9EA}",desc:"Select text color and highlight color, (this may change in the future because of the limitations with HTML and Obsidian)"},spaceRowHeight:{name:"Row Height",desc:"The height for each row in navigator (in pixels), default is 29"},contextPagination:{name:"Table View Pagination",desc:"Number of items per page in table view"},bannerHeight:{name:"Cover Height",desc:"The height for the cover of the note or space, default is 200"},makeChar:{name:"Flow Menu Trigger",desc:"Character to open the Flow Menu"},mobileMakeBar:{name:"Flow Styler (Mobile)",desc:"Replaces the mobile toolbar"},editorMarkSans:{name:"Mark Sans \\u{1F9EA}",desc:"Use the editor without Markdown."},editorMakePlacholder:{name:"Flow Menu Hint Text",desc:"Show a hint text on how to open the Flow Menu Shortcut"},blinkEnabled:{name:"Blink",desc:"A faster way to search and edit your notes"},editorMakeMenu:{name:"Flow Menu",desc:"Open the Flow menu to quickly add content"},editorMakeMenuTrigger:{name:"Flow Menu Shortcut",desc:"Trigger key to use flow menu"},editorFlowReplace:{name:"Flow Block",desc:"Open your internal links or toggle your embeds in the flow block."},editorFlowStyle:{name:"Flow Block Style",desc:"Select a theme for your flow block",seamless:"Seamless",minimal:"Minimal"}}}};this.lang="en";let r=qM.default.locale();["en"].includes(r)&&(this.lang=r)}get texts(){return this.all.en}},Wr=new kw().texts;var Ea="files",Gs={id:Ea,name:"Items",type:"db",primary:"true"};var UM={uniques:["name,schemaId"],cols:["name","schemaId","type","value","attrs","hidden","unique","primary"]},Vs={...UM,rows:[{name:In,schemaId:Ea,type:"file",primary:"true",hidden:"",unique:"",attrs:"",value:""},{name:"Created",schemaId:Ea,type:"fileprop",value:In+".ctime",hidden:"",unique:"",attrs:"",primary:"true"}]};var ep={...UM,rows:[{name:In,schemaId:Ea,type:"file",primary:"true",hidden:"",unique:"",attrs:"",value:""}]};var kM=(e,r)=>r==In?Qu.find(t=>t.type=="file"):r=="tags"?Qu.find(t=>t.type=="tags-multi"):r=="aliases"?Qu.find(t=>t.type=="option-multi"):r=="sticker"?Qu.find(t=>e=="icon"):Qu.find(t=>e==t.type)||Qu.find(t=>e==t.multiType),Qu=[{type:"unknown",label:"",restricted:!0,icon:"ui//file-question"},{type:"any",label:"",restricted:!0,icon:"ui//wildcard",multi:!0,multiType:"any-multi"},{type:"text",label:Wr.properties.text.label,metadata:!0,icon:"ui//text",primative:!0,description:Wr.properties.text.description},{type:"number",label:Wr.properties.number.label,metadata:!0,icon:"ui//binary",configKeys:["unit"],primative:!0,description:Wr.properties.number.description},{type:"boolean",label:Wr.properties.boolean.label,metadata:!0,icon:"ui//check-square",primative:!0,description:Wr.properties.boolean.description},{type:"date",label:Wr.properties.date.label,metadata:!0,icon:"ui//calendar",configKeys:["format"],primative:!0,description:Wr.properties.date.description},{type:"option",label:Wr.properties.option.label,multi:!0,multiType:"option-multi",icon:"ui//list",configKeys:["options","source"],description:Wr.properties.option.description},{type:"tags-multi",label:Wr.properties.tags.label,icon:"ui//tags",description:Wr.properties.tags.description},{type:"file",label:Wr.properties.file.label,restricted:!0,icon:"ui//mk-make-h3"},{type:"fileprop",label:Wr.properties.fileProperty.label,icon:"ui//formula",configKeys:["field","value","type"],description:Wr.properties.fileProperty.description},{type:"link",label:Wr.properties.link.label,multi:!0,multiType:"link-multi",metadata:!0,icon:"ui//file-text",primative:!0,description:Wr.properties.link.description},{type:"context",label:Wr.properties.context.label,icon:"ui//mk-make-note",multi:!0,multiType:"context-multi",configKeys:["space","field"],description:Wr.properties.context.description},{type:"aggregate",label:Wr.properties.aggregate.label,icon:"ui//mk-make-note",multi:!1,configKeys:["ref","field","fn"],description:Wr.properties.aggregate.description},{type:"object",label:Wr.properties.object.label,multi:!0,multiType:"object-multi",metadata:!0,icon:"ui//list-tree",configKeys:["type","typeName"],description:Wr.properties.object.description},{type:"icon",label:Wr.properties.icon.label,multi:!0,multiType:"icon-multi",icon:"ui//gem",restricted:!0,primative:!0,description:Wr.properties.icon.description},{type:"image",label:Wr.properties.image.label,multi:!0,multiType:"image-multi",metadata:!0,icon:"ui//mk-make-image",primative:!0,description:Wr.properties.image.description},{type:"color",label:Wr.properties.color.label,icon:"ui//mk-make-image",restricted:!0,description:Wr.properties.color.description},{type:"space",label:Wr.properties.space.label,icon:"ui//layout-grid",restricted:!0,description:Wr.properties.space.description},{type:"table",label:Wr.properties.space.label,icon:"ui//layout-grid",restricted:!0,description:Wr.properties.space.description},{type:"super",label:Wr.properties.super.label,icon:"ui//zap",restricted:!0,configKeys:["dynamic","field"]},{type:"input",label:Wr.properties.super.label,icon:"ui//input",restricted:!0}];var YU="filesView",WU={id:YU,name:"All",type:"view",def:JSON.stringify({db:Ea,icon:"ui//file-stack"})},HU="main",$U=e=>({id:e,name:e,type:"frame",def:"",predicate:"",primary:"true"}),iee={uniques:[],cols:["id","name","type","def","predicate","primary"],rows:[$U(HU),WU]},rp={uniques:[],cols:["id","name","type","def","predicate","primary"],rows:[Gs]};var oee={schema:Gs,cols:Vs.rows,rows:[]},see={schema:Gs,cols:Vs.rows,rows:[]},uee={schema:Gs,cols:ep.rows,rows:[]},zM=(e,r)=>e.filter(t=>r.find(n=>n.id==t.schemaId&&n.type=="db")).reduce((t,n)=>({...t,...t[n.schemaId]?{[n.schemaId]:{uniques:n.unique=="true"?[...t[n.schemaId].uniques,n.name]:t[n.schemaId].uniques,cols:[...t[n.schemaId].cols,n.name],rows:[]}}:{[n.schemaId]:{uniques:n.unique=="true"?[n.name]:[],cols:[n.name],rows:[]}}}),{});var fee={m_schema:rp,m_fields:Vs,...zM(Vs.rows,rp.rows)},lee={m_schema:rp,m_fields:ep,...zM(ep.rows,rp.rows)};var Lw=(e,r)=>{if(e instanceof Date)return"date";if(typeof e=="string"){if(/\\/\\/(\\S+?(?:jpe?g|png|gif|svg))/gi.test(e)||e.includes("unsplash"))return"image";if(/^\\d{4}-\\d{2}-\\d{2}$/.test(e))return"date";if(r=="tag"||r=="tags")return"tags-multi";if(/\\[\\[.*?\\]\\]/.test(e))return"link"}else{if(typeof e=="number")return"number";if(typeof e=="boolean")return"boolean";if(e)if(Array.isArray(e)||typeof e=="string"&&e.indexOf(",")>-1){let t=Array.isArray(e)?e:[];if(typeof e=="string"&&e.indexOf(",")>-1&&(t=An(e)),r=="tag"||r=="tags")return"tags-multi";if(t.length==1&&Array.isArray(t[0])&&t[0].length==1&&typeof t[0][0]=="string")return"link";let n=Ma(t.map(a=>Lw(a,r)));return n.length==1&&n[0]=="link"?"link-multi":n.some(a=>a=="object")?"object-multi":"option-multi"}else return e.isLuxonDateTime?"date":e.isLuxonDuration?"duration":e.type=="file"?"link":typeof e=="object"&&!Array.isArray(e)&&e!==null?"object":"unknown";else return"unknown"}return"text"};var qw=(e,r,t)=>e?e=="object"||e=="object-multi"?JSON.parse(r):e=="number"?parseFloat(r):e=="boolean"?r=="true":e.includes("-multi")?An(r).map(n=>qw(e.replace("-multi",""),n,t)):(e.includes("link")||e.includes("context"))&&t?\`[[\${r}]]\`:r:r;var YM=e=>e.map(r=>r.replace(",","\\\\,")).join(", "),Zs=e=>JSON.stringify(e);var An=e=>e?.startsWith("[")?Jm(tc(e)).map(r=>OM(r)):GU(e),GU=e=>(e?.replace("\\\\,",",")?.match(/(\\\\.|[^,])+/g)??[]).map(r=>r.trim()),Qs=(e,r,t)=>{let n=t??Lw(r,e);if(!r)return"";switch(n){case"tags-multi":return r;case"object":case"object-multi":{if(Array.isArray(r)){if(r[0].path)return JSON.stringify(r.map(a=>a.path))}else if(r.path)return r.path;return JSON.stringify(r)}break;case"number":return r.toString();case"boolean":return r?"true":"false";case"date":{if(r instanceof Date){let a=Yi(r,"yyyy-MM-dd");return typeof a=="string"?a:""}return typeof r!="string"?"":r}break;case"duration":return YM(Object.keys(r.values).reduce((a,i)=>[...a,...r.values[i]>0?[r.values[i]+" "+i]:[]],[]));case"option-multi":case"link-multi":case"context-multi":return typeof r=="string"?nc(r):Zs(r.map(a=>a?typeof a=="string"?nc(a):a.path?a.path:Array.isArray(r)&&a.length==1&&Array.isArray(a[0])&&a[0].length==1&&typeof a[0][0]=="string"?a[0][0]:JSON.stringify(a):""));case"link":case"context":return Array.isArray(r)&&r.length==1&&Array.isArray(r[0])&&r[0].length==1&&typeof r[0][0]=="string"?r[0][0]:typeof r=="string"?nc(r):r.path;case"text":case"tag":case"option":case"image":return r}return""};var tc=e=>{let r;try{r=JSON.parse(e)}catch{}return r};var nc=e=>{if(!e)return"";let r=/\\[\\[(.*?)\\]\\]/g.exec(e),t=r?.length>1?r[1].substring(0,BM("|",r[1])):e;return t||e};var tf=Aa(tp());var ic=["MO","TU","WE","TH","FR","SA","SU"],rn=function(){function e(r,t){if(t===0)throw new Error("Can't create weekday with n == 0");this.weekday=r,this.n=t}return e.fromStr=function(r){return new e(ic.indexOf(r))},e.prototype.nth=function(r){return this.n===r?this:new e(this.weekday,r)},e.prototype.equals=function(r){return this.weekday===r.weekday&&this.n===r.n},e.prototype.toString=function(){var r=ic[this.weekday];return this.n&&(r=(this.n>0?"+":"")+String(this.n)+r),r},e.prototype.getJsWeekday=function(){return this.weekday===6?0:this.weekday+1},e}();var Ct=function(e){return e!=null},Ca=function(e){return typeof e=="number"},Uw=function(e){return typeof e=="string"&&ic.includes(e)},Mn=Array.isArray,Za=function(e,r){r===void 0&&(r=e),arguments.length===1&&(r=e,e=0);for(var t=[],n=e;n>0,n.length>r?String(n):(r=r-n.length,r>t.length&&(t+=Kr(t,r/t.length)),t.slice(0,r)+String(n))}var HM=function(e,r,t){var n=e.split(r);return t?n.slice(0,t).concat([n.slice(t).join(r)]):n},Pn=function(e,r){var t=e%r;return t*r<0?t+r:t},np=function(e,r){return{div:Math.floor(e/r),mod:Pn(e,r)}},Ta=function(e){return!Ct(e)||e.length===0},Xt=function(e){return!Ta(e)},jr=function(e,r){return Xt(e)&&e.indexOf(r)!==-1};var Wi=function(e,r,t,n,a,i){return n===void 0&&(n=0),a===void 0&&(a=0),i===void 0&&(i=0),new Date(Date.UTC(e,r-1,t,n,a,i))},VU=[31,28,31,30,31,30,31,31,30,31,30,31],GM=1e3*60*60*24,ap=9999,VM=Wi(1970,1,1),ZU=[6,0,1,2,3,4,5];var Ku=function(e){return e%4===0&&e%100!==0||e%400===0},zw=function(e){return e instanceof Date},Ks=function(e){return zw(e)&&!isNaN(e.getTime())};var QU=function(e,r){var t=e.getTime(),n=r.getTime(),a=t-n;return Math.round(a/GM)},oc=function(e){return QU(e,VM)},ip=function(e){return new Date(VM.getTime()+e*GM)},XU=function(e){var r=e.getUTCMonth();return r===1&&Ku(e.getUTCFullYear())?29:VU[r]},go=function(e){return ZU[e.getUTCDay()]},Yw=function(e,r){var t=Wi(e,r+1,1);return[go(t),XU(t)]},op=function(e,r){return r=r||e,new Date(Date.UTC(e.getUTCFullYear(),e.getUTCMonth(),e.getUTCDate(),r.getHours(),r.getMinutes(),r.getSeconds(),r.getMilliseconds()))},sp=function(e){var r=new Date(e.getTime());return r},Ww=function(e){for(var r=[],t=0;tthis.maxDate;if(this.method==="between"){if(t)return!0;if(n)return!1}else if(this.method==="before"){if(n)return!1}else if(this.method==="after")return t?!0:(this.add(r),!1);return this.add(r)},e.prototype.add=function(r){return this._result.push(r),!0},e.prototype.getValue=function(){var r=this._result;switch(this.method){case"all":case"between":return r;case"before":case"after":default:return r.length?r[r.length-1]:null}},e.prototype.clone=function(){return new e(this.method,this.args)},e}(),xo=KU;var Hw=function(e,r){return Hw=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var a in n)Object.prototype.hasOwnProperty.call(n,a)&&(t[a]=n[a])},Hw(e,r)};function ju(e,r){if(typeof r!="function"&&r!==null)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");Hw(e,r);function t(){this.constructor=e}e.prototype=r===null?Object.create(r):(t.prototype=r.prototype,new t)}var En=function(){return En=Object.assign||function(r){for(var t,n=1,a=arguments.length;nr[0].length)&&(r=i,t=a)}if(r!=null&&(this.text=this.text.substr(r[0].length),this.text===""&&(this.done=!0)),r==null){this.done=!0,this.symbol=null,this.value=null;return}}while(t==="SKIP");return this.symbol=t,this.value=r,!0},e.prototype.accept=function(r){if(this.symbol===r){if(this.value){var t=this.value;return this.nextSymbol(),t}return this.nextSymbol(),!0}return!1},e.prototype.acceptNumber=function(){return this.accept("number")},e.prototype.expect=function(r){if(this.accept(r))return!0;throw new Error("expected "+r+" but found "+this.symbol)},e}();function uc(e,r){r===void 0&&(r=Js);var t={},n=new nz(r.tokens);if(!n.start(e))return null;return a(),t;function a(){n.expect("every");var p=n.acceptNumber();if(p&&(t.interval=parseInt(p[0],10)),n.isDone())throw new Error("Unexpected end");switch(n.symbol){case"day(s)":t.freq=vr.DAILY,n.nextSymbol()&&(s(),m());break;case"weekday(s)":t.freq=vr.WEEKLY,t.byweekday=[vr.MO,vr.TU,vr.WE,vr.TH,vr.FR],n.nextSymbol(),s(),m();break;case"week(s)":t.freq=vr.WEEKLY,n.nextSymbol()&&(i(),s(),m());break;case"hour(s)":t.freq=vr.HOURLY,n.nextSymbol()&&(i(),m());break;case"minute(s)":t.freq=vr.MINUTELY,n.nextSymbol()&&(i(),m());break;case"month(s)":t.freq=vr.MONTHLY,n.nextSymbol()&&(i(),m());break;case"year(s)":t.freq=vr.YEARLY,n.nextSymbol()&&(i(),m());break;case"monday":case"tuesday":case"wednesday":case"thursday":case"friday":case"saturday":case"sunday":t.freq=vr.WEEKLY;var h=n.symbol.substr(0,2).toUpperCase();if(t.byweekday=[vr[h]],!n.nextSymbol())return;for(;n.accept("comma");){if(n.isDone())throw new Error("Unexpected end");var y=f();if(!y)throw new Error("Unexpected symbol "+n.symbol+", expected weekday");t.byweekday.push(vr[y]),n.nextSymbol()}s(),u(),m();break;case"january":case"february":case"march":case"april":case"may":case"june":case"july":case"august":case"september":case"october":case"november":case"december":if(t.freq=vr.YEARLY,t.bymonth=[c()],!n.nextSymbol())return;for(;n.accept("comma");){if(n.isDone())throw new Error("Unexpected end");var v=c();if(!v)throw new Error("Unexpected symbol "+n.symbol+", expected month");t.bymonth.push(v),n.nextSymbol()}i(),m();break;default:throw new Error("Unknown symbol")}}function i(){var p=n.accept("on"),h=n.accept("the");if(!!(p||h))do{var y=o(),v=f(),x=c();if(y)v?(n.nextSymbol(),t.byweekday||(t.byweekday=[]),t.byweekday.push(vr[v].nth(y))):(t.bymonthday||(t.bymonthday=[]),t.bymonthday.push(y),n.accept("day(s)"));else if(v)n.nextSymbol(),t.byweekday||(t.byweekday=[]),t.byweekday.push(vr[v]);else if(n.symbol==="weekday(s)")n.nextSymbol(),t.byweekday||(t.byweekday=[vr.MO,vr.TU,vr.WE,vr.TH,vr.FR]);else if(n.symbol==="week(s)"){n.nextSymbol();var b=n.acceptNumber();if(!b)throw new Error("Unexpected symbol "+n.symbol+", expected week number");for(t.byweekno=[parseInt(b[0],10)];n.accept("comma");){if(b=n.acceptNumber(),!b)throw new Error("Unexpected symbol "+n.symbol+"; expected monthday");t.byweekno.push(parseInt(b[0],10))}}else if(x)n.nextSymbol(),t.bymonth||(t.bymonth=[]),t.bymonth.push(x);else return}while(n.accept("comma")||n.accept("the")||n.accept("on"))}function s(){var p=n.accept("at");if(!!p)do{var h=n.acceptNumber();if(!h)throw new Error("Unexpected symbol "+n.symbol+", expected hour");for(t.byhour=[parseInt(h[0],10)];n.accept("comma");){if(h=n.acceptNumber(),!h)throw new Error("Unexpected symbol "+n.symbol+"; expected hour");t.byhour.push(parseInt(h[0],10))}}while(n.accept("comma")||n.accept("at"))}function c(){switch(n.symbol){case"january":return 1;case"february":return 2;case"march":return 3;case"april":return 4;case"may":return 5;case"june":return 6;case"july":return 7;case"august":return 8;case"september":return 9;case"october":return 10;case"november":return 11;case"december":return 12;default:return!1}}function f(){switch(n.symbol){case"monday":case"tuesday":case"wednesday":case"thursday":case"friday":case"saturday":case"sunday":return n.symbol.substr(0,2).toUpperCase();default:return!1}}function o(){switch(n.symbol){case"last":return n.nextSymbol(),-1;case"first":return n.nextSymbol(),1;case"second":return n.nextSymbol(),n.accept("last")?-2:2;case"third":return n.nextSymbol(),n.accept("last")?-3:3;case"nth":var p=parseInt(n.value[1],10);if(p<-366||p>366)throw new Error("Nth out of range: "+p);return n.nextSymbol(),n.accept("last")?-p:p;default:return!1}}function u(){n.accept("on"),n.accept("the");var p=o();if(!!p)for(t.bymonthday=[p],n.nextSymbol();n.accept("comma");){if(p=o(),!p)throw new Error("Unexpected symbol "+n.symbol+"; expected monthday");t.bymonthday.push(p),n.nextSymbol()}}function m(){if(n.symbol==="until"){var p=Date.parse(n.text);if(!p)throw new Error("Cannot parse until date:"+n.text);t.until=new Date(p)}else n.accept("for")&&(t.count=parseInt(n.value[0],10),n.expect("number"))}}var Hr;(function(e){e[e.YEARLY=0]="YEARLY",e[e.MONTHLY=1]="MONTHLY",e[e.WEEKLY=2]="WEEKLY",e[e.DAILY=3]="DAILY",e[e.HOURLY=4]="HOURLY",e[e.MINUTELY=5]="MINUTELY",e[e.SECONDLY=6]="SECONDLY"})(Hr||(Hr={}));function fc(e){return e12){var n=Math.floor(this.month/12),a=Pn(this.month,12);this.month=a,this.year+=n,this.month===0&&(this.month=12,--this.year)}},r.prototype.addWeekly=function(t,n){n>this.getWeekday()?this.day+=-(this.getWeekday()+1+(6-n))+t*7:this.day+=-(this.getWeekday()-n)+t*7,this.fixDay()},r.prototype.addDaily=function(t){this.day+=t,this.fixDay()},r.prototype.addHours=function(t,n,a){for(n&&(this.hour+=Math.floor((23-this.hour)/t)*t);;){this.hour+=t;var i=np(this.hour,24),s=i.div,c=i.mod;if(s&&(this.hour=c,this.addDaily(s)),Ta(a)||jr(a,this.hour))break}},r.prototype.addMinutes=function(t,n,a,i){for(n&&(this.minute+=Math.floor((1439-(this.hour*60+this.minute))/t)*t);;){this.minute+=t;var s=np(this.minute,60),c=s.div,f=s.mod;if(c&&(this.minute=f,this.addHours(c,!1,a)),(Ta(a)||jr(a,this.hour))&&(Ta(i)||jr(i,this.minute)))break}},r.prototype.addSeconds=function(t,n,a,i,s){for(n&&(this.second+=Math.floor((86399-(this.hour*3600+this.minute*60+this.second))/t)*t);;){this.second+=t;var c=np(this.second,60),f=c.div,o=c.mod;if(f&&(this.second=o,this.addMinutes(f,!1,a,i)),(Ta(a)||jr(a,this.hour))&&(Ta(i)||jr(i,this.minute))&&(Ta(s)||jr(s,this.second)))break}},r.prototype.fixDay=function(){if(!(this.day<=28)){var t=Yw(this.year,this.month-1)[1];if(!(this.day<=t))for(;this.day>t;){if(this.day-=t,++this.month,this.month===13&&(this.month=1,++this.year,this.year>ap))return;t=Yw(this.year,this.month-1)[1]}}},r.prototype.add=function(t,n){var a=t.freq,i=t.interval,s=t.wkst,c=t.byhour,f=t.byminute,o=t.bysecond;switch(a){case Hr.YEARLY:return this.addYears(i);case Hr.MONTHLY:return this.addMonths(i);case Hr.WEEKLY:return this.addWeekly(i,s);case Hr.DAILY:return this.addDaily(i);case Hr.HOURLY:return this.addHours(i,n,c);case Hr.MINUTELY:return this.addMinutes(i,n,c,f);case Hr.SECONDLY:return this.addSeconds(i,n,c,f,o)}},r}(rf);function Gw(e){for(var r=[],t=Object.keys(e),n=0,a=t;n=-366&&n<=366))throw new Error("bysetpos must be between 1 and 366, or between -366 and -1")}}if(!(Boolean(r.byweekno)||Xt(r.byweekno)||Xt(r.byyearday)||Boolean(r.bymonthday)||Xt(r.bymonthday)||Ct(r.byweekday)||Ct(r.byeaster)))switch(r.freq){case vr.YEARLY:r.bymonth||(r.bymonth=r.dtstart.getUTCMonth()+1),r.bymonthday=r.dtstart.getUTCDate();break;case vr.MONTHLY:r.bymonthday=r.dtstart.getUTCDate();break;case vr.WEEKLY:r.byweekday=[go(r.dtstart)];break}if(Ct(r.bymonth)&&!Mn(r.bymonth)&&(r.bymonth=[r.bymonth]),Ct(r.byyearday)&&!Mn(r.byyearday)&&Ca(r.byyearday)&&(r.byyearday=[r.byyearday]),!Ct(r.bymonthday))r.bymonthday=[],r.bynmonthday=[];else if(Mn(r.bymonthday)){for(var a=[],i=[],t=0;t0?a.push(n):n<0&&i.push(n)}r.bymonthday=a,r.bynmonthday=i}else r.bymonthday<0?(r.bynmonthday=[r.bymonthday],r.bymonthday=[]):(r.bynmonthday=[],r.bymonthday=[r.bymonthday]);if(Ct(r.byweekno)&&!Mn(r.byweekno)&&(r.byweekno=[r.byweekno]),!Ct(r.byweekday))r.bynweekday=null;else if(Ca(r.byweekday))r.byweekday=[r.byweekday],r.bynweekday=null;else if(Uw(r.byweekday))r.byweekday=[rn.fromStr(r.byweekday).weekday],r.bynweekday=null;else if(r.byweekday instanceof rn)!r.byweekday.n||r.freq>vr.MONTHLY?(r.byweekday=[r.byweekday.weekday],r.bynweekday=null):(r.bynweekday=[[r.byweekday.weekday,r.byweekday.n]],r.byweekday=null);else{for(var s=[],c=[],t=0;tvr.MONTHLY?s.push(f.weekday):c.push([f.weekday,f.n])}r.byweekday=Xt(s)?s:null,r.bynweekday=Xt(c)?c:null}return Ct(r.byhour)?Ca(r.byhour)&&(r.byhour=[r.byhour]):r.byhour=r.freq=4?(u=0,o=c.yearlen+Pn(s-r.wkst,7)):o=n-u;for(var m=Math.floor(o/7),p=Pn(o,7),h=Math.floor(m+p/4),y=0;y0&&v<=h){var x=void 0;v>1?(x=u+(v-1)*7,u!==f&&(x-=7-f)):x=u;for(var b=0;b<7&&(c.wnomask[x]=1,x++,c.wdaymask[x]!==r.wkst);b++);}}if(jr(r.byweekno,1)){var x=u+h*7;if(u!==f&&(x-=7-f),x=4?(N=0,D=M+Pn(w-r.wkst,7)):D=n-u,E=Math.floor(52+Pn(D,7)/4)}if(jr(r.byweekno,E))for(var x=0;xi)return bo(e);if(E>=t){var w=x2(E,r);if(!e.accept(w)||c&&(--c,!c))return bo(e)}}else for(var b=h;bi)return bo(e);if(E>=t){var w=x2(E,r);if(!e.accept(w)||c&&(--c,!c))return bo(e)}}}if(r.interval===0||(f.add(r,v),f.year>ap))return bo(e);fc(n)||(u=o.gettimeset(n)(f.hour,f.minute,f.second,0)),o.rebuild(f.year,f.month)}}function hz(e,r,t){var n=t.bymonth,a=t.byweekno,i=t.byweekday,s=t.byeaster,c=t.bymonthday,f=t.bynmonthday,o=t.byyearday;return Xt(n)&&!jr(n,e.mmask[r])||Xt(a)&&!e.wnomask[r]||Xt(i)&&!jr(i,e.wdaymask[r])||Xt(e.nwdaymask)&&!e.nwdaymask[r]||s!==null&&!jr(e.eastermask,r)||(Xt(c)||Xt(f))&&!jr(c,e.mdaymask[r])&&!jr(f,e.nmdaymask[r])||Xt(o)&&(r=e.yearlen&&!jr(o,r+1-e.yearlen)&&!jr(o,-e.nextyearlen+r-e.yearlen))}function x2(e,r){return new js(e,r.tzid).rezonedDate()}function bo(e){return e.getValue()}function vz(e,r,t,n,a){for(var i=!1,s=r;s=vr.HOURLY&&Xt(a)&&!jr(a,r.hour)||n>=vr.MINUTELY&&Xt(i)&&!jr(i,r.minute)||n>=vr.SECONDLY&&Xt(s)&&!jr(s,r.second)?[]:e.gettimeset(n)(r.hour,r.minute,r.second,r.millisecond)}var Qa={MO:new rn(0),TU:new rn(1),WE:new rn(2),TH:new rn(3),FR:new rn(4),SA:new rn(5),SU:new rn(6)},lc={freq:Hr.YEARLY,dtstart:null,interval:1,wkst:Qa.MO,count:null,until:null,tzid:null,bysetpos:null,bymonth:null,bymonthday:null,bynmonthday:null,byyearday:null,byweekno:null,byweekday:null,bynweekday:null,byhour:null,byminute:null,bysecond:null,byeaster:null},t2=Object.keys(lc),vr=function(){function e(r,t){r===void 0&&(r={}),t===void 0&&(t=!1),this._cache=t?null:new i2,this.origOptions=Gw(r);var n=e2(r).parsedOptions;this.options=n}return e.parseText=function(r,t){return uc(r,t)},e.fromText=function(r,t){return XM(r,t)},e.fromString=function(r){return new e(e.parseString(r)||void 0)},e.prototype._iter=function(r){return up(r,this.options)},e.prototype._cacheGet=function(r,t){return this._cache?this._cache._cacheGet(r,t):!1},e.prototype._cacheAdd=function(r,t,n){if(!!this._cache)return this._cache._cacheAdd(r,t,n)},e.prototype.all=function(r){if(r)return this._iter(new $w("all",{},r));var t=this._cacheGet("all");return t===!1&&(t=this._iter(new xo("all",{})),this._cacheAdd("all",t)),t},e.prototype.between=function(r,t,n,a){if(n===void 0&&(n=!1),!Ks(r)||!Ks(t))throw new Error("Invalid date passed in to RRule.between");var i={before:t,after:r,inc:n};if(a)return this._iter(new $w("between",i,a));var s=this._cacheGet("between",i);return s===!1&&(s=this._iter(new xo("between",i)),this._cacheAdd("between",s,i)),s},e.prototype.before=function(r,t){if(t===void 0&&(t=!1),!Ks(r))throw new Error("Invalid date passed in to RRule.before");var n={dt:r,inc:t},a=this._cacheGet("before",n);return a===!1&&(a=this._iter(new xo("before",n)),this._cacheAdd("before",a,n)),a},e.prototype.after=function(r,t){if(t===void 0&&(t=!1),!Ks(r))throw new Error("Invalid date passed in to RRule.after");var n={dt:r,inc:t},a=this._cacheGet("after",n);return a===!1&&(a=this._iter(new xo("after",n)),this._cacheAdd("after",a,n)),a},e.prototype.count=function(){return this.all().length},e.prototype.toString=function(){return pc(this.origOptions)},e.prototype.toText=function(r,t,n){return KM(this,r,t,n)},e.prototype.isFullyConvertibleToText=function(){return JM(this)},e.prototype.clone=function(){return new e(this.origOptions)},e.FREQUENCIES=["YEARLY","MONTHLY","WEEKLY","DAILY","HOURLY","MINUTELY","SECONDLY"],e.YEARLY=Hr.YEARLY,e.MONTHLY=Hr.MONTHLY,e.WEEKLY=Hr.WEEKLY,e.DAILY=Hr.DAILY,e.HOURLY=Hr.HOURLY,e.MINUTELY=Hr.MINUTELY,e.SECONDLY=Hr.SECONDLY,e.MO=Qa.MO,e.TU=Qa.TU,e.WE=Qa.WE,e.TH=Qa.TH,e.FR=Qa.FR,e.SA=Qa.SA,e.SU=Qa.SU,e.parseString=mc,e.optionsToString=pc,e}();function b2(e,r,t,n,a,i){var s={},c=e.accept;function f(p,h){t.forEach(function(y){y.between(p,h,!0).forEach(function(v){s[Number(v)]=!0})})}a.forEach(function(p){var h=new js(p,i).rezonedDate();s[Number(h)]=!0}),e.accept=function(p){var h=Number(p);return isNaN(h)?c.call(this,p):!s[h]&&(f(new Date(h-1),new Date(h+1)),!s[h])?(s[h]=!0,c.call(this,p)):!0},e.method==="between"&&(f(e.args.after,e.args.before),e.accept=function(p){var h=Number(p);return s[h]?!0:(s[h]=!0,c.call(this,p))});for(var o=0;o1||a.length||i.length||s.length){var u=new Qw(o);return u.dtstart(c),u.tzid(f||void 0),n.forEach(function(p){u.rrule(new vr(Zw(p,c,f),o))}),a.forEach(function(p){u.rdate(p)}),i.forEach(function(p){u.exrule(new vr(Zw(p,c,f),o))}),s.forEach(function(p){u.exdate(p)}),r.compatible&&r.dtstart&&u.rdate(c),u}var m=n[0]||{};return new vr(Zw(m,m.dtstart||r.dtstart||c,m.tzid||r.tzid||f),o)}function fp(e,r){return r===void 0&&(r={}),xz(e,bz(r))}function Zw(e,r,t){return En(En({},e),{dtstart:r,tzid:t})}function bz(e){var r=[],t=Object.keys(e),n=Object.keys(w2);if(t.forEach(function(a){jr(n,a)||r.push(a)}),r.length)throw new Error("Invalid options: "+r.join(", "));return En(En({},w2),e)}function wz(e){if(e.indexOf(":")===-1)return{name:"RRULE",value:e};var r=HM(e,":",1),t=r[0],n=r[1];return{name:t,value:n}}function Dz(e){var r=wz(e),t=r.name,n=r.value,a=t.split(";");if(!a)throw new Error("empty property name");return{name:a[0].toUpperCase(),parms:a.slice(1),value:n}}function Sz(e,r){if(r===void 0&&(r=!1),e=e&&e.trim(),!e)throw new Error("Invalid empty string");if(!r)return e.split(/\\s/);for(var t=e.split(\` \`),n=0;n0&&a[0]===" "?(t[n-1]+=a.slice(1),t.splice(n,1)):n+=1:t.splice(n,1)}return t}function Nz(e){e.forEach(function(r){if(!/(VALUE=DATE(-TIME)?)|(TZID=)/.test(r))throw new Error("unsupported RDATE/EXDATE parm: "+r)})}function D2(e,r){return Nz(r),e.split(",").map(function(t){return sc(t)})}function S2(e){var r=this;return function(t){if(t!==void 0&&(r["_".concat(e)]=t),r["_".concat(e)]!==void 0)return r["_".concat(e)];for(var n=0;ni!=="mathjs").forEach(i=>{a[i]=n[i]}),new t(a)},t.prototype.valueOf=t.prototype.toString,t},{isClass:!0});var KZ="Chain",JZ=["?on","math","typed"],hy=F(KZ,JZ,e=>{var{on:r,math:t,typed:n}=e;function a(o){if(!(this instanceof a))throw new SyntaxError("Constructor must be called with the new operator");af(o)?this.value=o.value:this.value=o}a.prototype.type="Chain",a.prototype.isChain=!0,a.prototype.done=function(){return this.value},a.prototype.valueOf=function(){return this.value},a.prototype.toString=function(){return mr(this.value)},a.prototype.toJSON=function(){return{mathjs:"Chain",value:this.value}},a.fromJSON=function(o){return new a(o.value)};function i(o,u){typeof u=="function"&&(a.prototype[o]=c(u))}function s(o,u){sf(a.prototype,o,function(){var p=u();if(typeof p=="function")return c(p)})}function c(o){return function(){if(arguments.length===0)return new a(o(this.value));for(var u=[this.value],m=0;mo[y])};for(var p in o)m(p)}};var f={expression:!0,docs:!0,type:!0,classes:!0,json:!0,error:!0,isChain:!0};return a.createProxy(t),r&&r("import",function(o,u,m){m||s(o,u)}),a},{isClass:!0});var BS={name:"e",category:"Constants",syntax:["e"],description:"Euler's number, the base of the natural logarithm. Approximately equal to 2.71828",examples:["e","e ^ 2","exp(2)","log(e)"],seealso:["exp"]};var BF={name:"false",category:"Constants",syntax:["false"],description:"Boolean value false",examples:["false"],seealso:["true"]};var IF={name:"i",category:"Constants",syntax:["i"],description:"Imaginary unit, defined as i*i=-1. A complex number is described as a + b*i, where a is the real part, and b is the imaginary part.",examples:["i","i * i","sqrt(-1)"],seealso:[]};var PF={name:"Infinity",category:"Constants",syntax:["Infinity"],description:"Infinity, a number which is larger than the maximum number that can be handled by a floating point number.",examples:["Infinity","1 / 0"],seealso:[]};var RF={name:"LN10",category:"Constants",syntax:["LN10"],description:"Returns the natural logarithm of 10, approximately equal to 2.302",examples:["LN10","log(10)"],seealso:[]};var kF={name:"LN2",category:"Constants",syntax:["LN2"],description:"Returns the natural logarithm of 2, approximately equal to 0.693",examples:["LN2","log(2)"],seealso:[]};var LF={name:"LOG10E",category:"Constants",syntax:["LOG10E"],description:"Returns the base-10 logarithm of E, approximately equal to 0.434",examples:["LOG10E","log(e, 10)"],seealso:[]};var qF={name:"LOG2E",category:"Constants",syntax:["LOG2E"],description:"Returns the base-2 logarithm of E, approximately equal to 1.442",examples:["LOG2E","log(e, 2)"],seealso:[]};var UF={name:"NaN",category:"Constants",syntax:["NaN"],description:"Not a number",examples:["NaN","0 / 0"],seealso:[]};var zF={name:"null",category:"Constants",syntax:["null"],description:"Value null",examples:["null"],seealso:["true","false"]};var YF={name:"phi",category:"Constants",syntax:["phi"],description:"Phi is the golden ratio. Two quantities are in the golden ratio if their ratio is the same as the ratio of their sum to the larger of the two quantities. Phi is defined as \`(1 + sqrt(5)) / 2\` and is approximately 1.618034...",examples:["phi"],seealso:[]};var IS={name:"pi",category:"Constants",syntax:["pi"],description:"The number pi is a mathematical constant that is the ratio of a circle's circumference to its diameter, and is approximately equal to 3.14159",examples:["pi","sin(pi/2)"],seealso:["tau"]};var WF={name:"SQRT1_2",category:"Constants",syntax:["SQRT1_2"],description:"Returns the square root of 1/2, approximately equal to 0.707",examples:["SQRT1_2","sqrt(1/2)"],seealso:[]};var HF={name:"SQRT2",category:"Constants",syntax:["SQRT2"],description:"Returns the square root of 2, approximately equal to 1.414",examples:["SQRT2","sqrt(2)"],seealso:[]};var $F={name:"tau",category:"Constants",syntax:["tau"],description:"Tau is the ratio constant of a circle's circumference to radius, equal to 2 * pi, approximately 6.2832.",examples:["tau","2 * pi"],seealso:["pi"]};var GF={name:"true",category:"Constants",syntax:["true"],description:"Boolean value true",examples:["true"],seealso:["false"]};var VF={name:"version",category:"Constants",syntax:["version"],description:"A string with the version number of math.js",examples:["version"],seealso:[]};var ZF={name:"bignumber",category:"Construction",syntax:["bignumber(x)"],description:"Create a big number from a number or string.",examples:["0.1 + 0.2","bignumber(0.1) + bignumber(0.2)",'bignumber("7.2")','bignumber("7.2e500")',"bignumber([0.1, 0.2, 0.3])"],seealso:["boolean","complex","fraction","index","matrix","string","unit"]};var QF={name:"boolean",category:"Construction",syntax:["x","boolean(x)"],description:"Convert a string or number into a boolean.",examples:["boolean(0)","boolean(1)","boolean(3)",'boolean("true")','boolean("false")',"boolean([1, 0, 1, 1])"],seealso:["bignumber","complex","index","matrix","number","string","unit"]};var XF={name:"complex",category:"Construction",syntax:["complex()","complex(re, im)","complex(string)"],description:"Create a complex number.",examples:["complex()","complex(2, 3)",'complex("7 - 2i")'],seealso:["bignumber","boolean","index","matrix","number","string","unit"]};var KF={name:"createUnit",category:"Construction",syntax:["createUnit(definitions)","createUnit(name, definition)"],description:"Create a user-defined unit and register it with the Unit type.",examples:['createUnit("foo")','createUnit("knot", {definition: "0.514444444 m/s", aliases: ["knots", "kt", "kts"]})','createUnit("mph", "1 mile/hour")'],seealso:["unit","splitUnit"]};var JF={name:"fraction",category:"Construction",syntax:["fraction(num)","fraction(matrix)","fraction(num,den)","fraction({n: num, d: den})"],description:"Create a fraction from a number or from integer numerator and denominator.",examples:["fraction(0.125)","fraction(1, 3) + fraction(2, 5)","fraction({n: 333, d: 53})","fraction([sqrt(9), sqrt(10), sqrt(11)])"],seealso:["bignumber","boolean","complex","index","matrix","string","unit"]};var jF={name:"index",category:"Construction",syntax:["[start]","[start:end]","[start:step:end]","[start1, start 2, ...]","[start1:end1, start2:end2, ...]","[start1:step1:end1, start2:step2:end2, ...]"],description:"Create an index to get or replace a subset of a matrix",examples:["A = [1, 2, 3; 4, 5, 6]","A[1, :]","A[1, 2] = 50","A[1:2, 1:2] = 1","B = [1, 2, 3]","B[B>1 and B<3]"],seealso:["bignumber","boolean","complex","matrix,","number","range","string","unit"]};var eO={name:"matrix",category:"Construction",syntax:["[]","[a1, b1, ...; a2, b2, ...]","matrix()",'matrix("dense")',"matrix([...])"],description:"Create a matrix.",examples:["[]","[1, 2, 3]","[1, 2, 3; 4, 5, 6]","matrix()","matrix([3, 4])",'matrix([3, 4; 5, 6], "sparse")','matrix([3, 4; 5, 6], "sparse", "number")'],seealso:["bignumber","boolean","complex","index","number","string","unit","sparse"]};var rO={name:"number",category:"Construction",syntax:["x","number(x)","number(unit, valuelessUnit)"],description:"Create a number or convert a string or boolean into a number.",examples:["2","2e3","4.05","number(2)",'number("7.2")',"number(true)","number([true, false, true, true])",'number(unit("52cm"), "m")'],seealso:["bignumber","boolean","complex","fraction","index","matrix","string","unit"]};var tO={name:"sparse",category:"Construction",syntax:["sparse()","sparse([a1, b1, ...; a1, b2, ...])",'sparse([a1, b1, ...; a1, b2, ...], "number")'],description:"Create a sparse matrix.",examples:["sparse()","sparse([3, 4; 5, 6])",'sparse([3, 0; 5, 0], "number")'],seealso:["bignumber","boolean","complex","index","number","string","unit","matrix"]};var nO={name:"splitUnit",category:"Construction",syntax:["splitUnit(unit: Unit, parts: Unit[])"],description:"Split a unit in an array of units whose sum is equal to the original unit.",examples:['splitUnit(1 m, ["feet", "inch"])'],seealso:["unit","createUnit"]};var aO={name:"string",category:"Construction",syntax:['"text"',"string(x)"],description:"Create a string or convert a value to a string",examples:['"Hello World!"',"string(4.2)","string(3 + 2i)"],seealso:["bignumber","boolean","complex","index","matrix","number","unit"]};var iO={name:"unit",category:"Construction",syntax:["value unit","unit(value, unit)","unit(string)"],description:"Create a unit.",examples:["5.5 mm","3 inch",'unit(7.1, "kilogram")','unit("23 deg")'],seealso:["bignumber","boolean","complex","index","matrix","number","string"]};var oO={name:"config",category:"Core",syntax:["config()","config(options)"],description:"Get configuration or change configuration.",examples:["config()","1/3 + 1/4",'config({number: "Fraction"})',"1/3 + 1/4"],seealso:[]};var sO={name:"import",category:"Core",syntax:["import(functions)","import(functions, options)"],description:"Import functions or constants from an object.",examples:["import({myFn: f(x)=x^2, myConstant: 32 })","myFn(2)","myConstant"],seealso:[]};var uO={name:"typed",category:"Core",syntax:["typed(signatures)","typed(name, signatures)"],description:"Create a typed function.",examples:['double = typed({ "number": f(x)=x+x, "string": f(x)=concat(x,x) })',"double(2)",'double("hello")'],seealso:[]};var fO={name:"derivative",category:"Algebra",syntax:["derivative(expr, variable)","derivative(expr, variable, {simplify: boolean})"],description:"Takes the derivative of an expression expressed in parser Nodes. The derivative will be taken over the supplied variable in the second parameter. If there are multiple variables in the expression, it will return a partial derivative.",examples:['derivative("2x^3", "x")','derivative("2x^3", "x", {simplify: false})','derivative("2x^2 + 3x + 4", "x")','derivative("sin(2x)", "x")','f = parse("x^2 + x")','x = parse("x")',"df = derivative(f, x)","df.evaluate({x: 3})"],seealso:["simplify","parse","evaluate"]};var lO={name:"leafCount",category:"Algebra",syntax:["leafCount(expr)"],description:"Computes the number of leaves in the parse tree of the given expression",examples:['leafCount("e^(i*pi)-1")','leafCount(parse("{a: 22/7, b: 10^(1/2)}"))'],seealso:["simplify"]};var cO={name:"lsolve",category:"Algebra",syntax:["x=lsolve(L, b)"],description:"Finds one solution of the linear system L * x = b where L is an [n x n] lower triangular matrix and b is a [n] column vector.",examples:["a = [-2, 3; 2, 1]","b = [11, 9]","x = lsolve(a, b)"],seealso:["lsolveAll","lup","lusolve","usolve","matrix","sparse"]};var mO={name:"lsolveAll",category:"Algebra",syntax:["x=lsolveAll(L, b)"],description:"Finds all solutions of the linear system L * x = b where L is an [n x n] lower triangular matrix and b is a [n] column vector.",examples:["a = [-2, 3; 2, 1]","b = [11, 9]","x = lsolve(a, b)"],seealso:["lsolve","lup","lusolve","usolve","matrix","sparse"]};var pO={name:"lup",category:"Algebra",syntax:["lup(m)"],description:"Calculate the Matrix LU decomposition with partial pivoting. Matrix A is decomposed in three matrices (L, U, P) where P * A = L * U",examples:["lup([[2, 1], [1, 4]])","lup(matrix([[2, 1], [1, 4]]))","lup(sparse([[2, 1], [1, 4]]))"],seealso:["lusolve","lsolve","usolve","matrix","sparse","slu","qr"]};var dO={name:"lusolve",category:"Algebra",syntax:["x=lusolve(A, b)","x=lusolve(lu, b)"],description:"Solves the linear system A * x = b where A is an [n x n] matrix and b is a [n] column vector.",examples:["a = [-2, 3; 2, 1]","b = [11, 9]","x = lusolve(a, b)"],seealso:["lup","slu","lsolve","usolve","matrix","sparse"]};var hO={name:"polynomialRoot",category:"Algebra",syntax:["x=polynomialRoot(-6, 3)","x=polynomialRoot(4, -4, 1)","x=polynomialRoot(-8, 12, -6, 1)"],description:"Finds the roots of a univariate polynomial given by its coefficients starting from constant, linear, and so on, increasing in degree.",examples:["a = polynomialRoot(-6, 11, -6, 1)"],seealso:["cbrt","sqrt"]};var vO={name:"qr",category:"Algebra",syntax:["qr(A)"],description:"Calculates the Matrix QR decomposition. Matrix \`A\` is decomposed in two matrices (\`Q\`, \`R\`) where \`Q\` is an orthogonal matrix and \`R\` is an upper triangular matrix.",examples:["qr([[1, -1, 4], [1, 4, -2], [1, 4, 2], [1, -1, 0]])"],seealso:["lup","slu","matrix"]};var gO={name:"rationalize",category:"Algebra",syntax:["rationalize(expr)","rationalize(expr, scope)","rationalize(expr, scope, detailed)"],description:"Transform a rationalizable expression in a rational fraction. If rational fraction is one variable polynomial then converts the numerator and denominator in canonical form, with decreasing exponents, returning the coefficients of numerator.",examples:['rationalize("2x/y - y/(x+1)")','rationalize("2x/y - y/(x+1)", true)'],seealso:["simplify"]};var yO={name:"resolve",category:"Algebra",syntax:["resolve(node, scope)"],description:"Recursively substitute variables in an expression tree.",examples:['resolve(parse("1 + x"), { x: 7 })','resolve(parse("size(text)"), { text: "Hello World" })','resolve(parse("x + y"), { x: parse("3z") })','resolve(parse("3x"), { x: parse("y+z"), z: parse("w^y") })'],seealso:["simplify","evaluate"],mayThrow:["ReferenceError"]};var xO={name:"simplify",category:"Algebra",syntax:["simplify(expr)","simplify(expr, rules)"],description:"Simplify an expression tree.",examples:['simplify("3 + 2 / 4")','simplify("2x + x")','f = parse("x * (x + 2 + x)")',"simplified = simplify(f)","simplified.evaluate({x: 2})"],seealso:["simplifyCore","derivative","evaluate","parse","rationalize","resolve"]};var bO={name:"simplifyConstant",category:"Algebra",syntax:["simplifyConstant(expr)","simplifyConstant(expr, options)"],description:"Replace constant subexpressions of node with their values.",examples:['simplifyConstant("(3-3)*x")','simplifyConstant(parse("z-cos(tau/8)"))'],seealso:["simplify","simplifyCore","evaluate"]};var wO={name:"simplifyCore",category:"Algebra",syntax:["simplifyCore(node)"],description:"Perform simple one-pass simplifications on an expression tree.",examples:['simplifyCore(parse("0*x"))','simplifyCore(parse("(x+0)*2"))'],seealso:["simplify","simplifyConstant","evaluate"]};var DO={name:"slu",category:"Algebra",syntax:["slu(A, order, threshold)"],description:"Calculate the Matrix LU decomposition with full pivoting. Matrix A is decomposed in two matrices (L, U) and two permutation vectors (pinv, q) where P * A * Q = L * U",examples:["slu(sparse([4.5, 0, 3.2, 0; 3.1, 2.9, 0, 0.9; 0, 1.7, 3, 0; 3.5, 0.4, 0, 1]), 1, 0.001)"],seealso:["lusolve","lsolve","usolve","matrix","sparse","lup","qr"]};var SO={name:"symbolicEqual",category:"Algebra",syntax:["symbolicEqual(expr1, expr2)","symbolicEqual(expr1, expr2, options)"],description:"Returns true if the difference of the expressions simplifies to 0",examples:['symbolicEqual("x*y","y*x")','symbolicEqual("abs(x^2)", "x^2")','symbolicEqual("abs(x)", "x", {context: {abs: {trivial: true}}})'],seealso:["simplify","evaluate"]};var NO={name:"usolve",category:"Algebra",syntax:["x=usolve(U, b)"],description:"Finds one solution of the linear system U * x = b where U is an [n x n] upper triangular matrix and b is a [n] column vector.",examples:["x=usolve(sparse([1, 1, 1, 1; 0, 1, 1, 1; 0, 0, 1, 1; 0, 0, 0, 1]), [1; 2; 3; 4])"],seealso:["usolveAll","lup","lusolve","lsolve","matrix","sparse"]};var AO={name:"usolveAll",category:"Algebra",syntax:["x=usolve(U, b)"],description:"Finds all solutions of the linear system U * x = b where U is an [n x n] upper triangular matrix and b is a [n] column vector.",examples:["x=usolve(sparse([1, 1, 1, 1; 0, 1, 1, 1; 0, 0, 1, 1; 0, 0, 0, 1]), [1; 2; 3; 4])"],seealso:["usolve","lup","lusolve","lsolve","matrix","sparse"]};var MO={name:"abs",category:"Arithmetic",syntax:["abs(x)"],description:"Compute the absolute value.",examples:["abs(3.5)","abs(-4.2)"],seealso:["sign"]};var EO={name:"add",category:"Operators",syntax:["x + y","add(x, y)"],description:"Add two values.",examples:["a = 2.1 + 3.6","a - 3.6","3 + 2i","3 cm + 2 inch",'"2.3" + "4"'],seealso:["subtract"]};var CO={name:"cbrt",category:"Arithmetic",syntax:["cbrt(x)","cbrt(x, allRoots)"],description:"Compute the cubic root value. If x = y * y * y, then y is the cubic root of x. When \`x\` is a number or complex number, an optional second argument \`allRoots\` can be provided to return all three cubic roots. If not provided, the principal root is returned",examples:["cbrt(64)","cube(4)","cbrt(-8)","cbrt(2 + 3i)","cbrt(8i)","cbrt(8i, true)","cbrt(27 m^3)"],seealso:["square","sqrt","cube","multiply"]};var TO={name:"ceil",category:"Arithmetic",syntax:["ceil(x)"],description:"Round a value towards plus infinity. If x is complex, both real and imaginary part are rounded towards plus infinity.",examples:["ceil(3.2)","ceil(3.8)","ceil(-4.2)"],seealso:["floor","fix","round"]};var _O={name:"cube",category:"Arithmetic",syntax:["cube(x)"],description:"Compute the cube of a value. The cube of x is x * x * x.",examples:["cube(2)","2^3","2 * 2 * 2"],seealso:["multiply","square","pow"]};var FO={name:"divide",category:"Operators",syntax:["x / y","divide(x, y)"],description:"Divide two values.",examples:["a = 2 / 3","a * 3","4.5 / 2","3 + 4 / 2","(3 + 4) / 2","18 km / 4.5"],seealso:["multiply"]};var OO={name:"dotDivide",category:"Operators",syntax:["x ./ y","dotDivide(x, y)"],description:"Divide two values element wise.",examples:["a = [1, 2, 3; 4, 5, 6]","b = [2, 1, 1; 3, 2, 5]","a ./ b"],seealso:["multiply","dotMultiply","divide"]};var BO={name:"dotMultiply",category:"Operators",syntax:["x .* y","dotMultiply(x, y)"],description:"Multiply two values element wise.",examples:["a = [1, 2, 3; 4, 5, 6]","b = [2, 1, 1; 3, 2, 5]","a .* b"],seealso:["multiply","divide","dotDivide"]};var IO={name:"dotPow",category:"Operators",syntax:["x .^ y","dotPow(x, y)"],description:"Calculates the power of x to y element wise.",examples:["a = [1, 2, 3; 4, 5, 6]","a .^ 2"],seealso:["pow"]};var PO={name:"exp",category:"Arithmetic",syntax:["exp(x)"],description:"Calculate the exponent of a value.",examples:["exp(1.3)","e ^ 1.3","log(exp(1.3))","x = 2.4","(exp(i*x) == cos(x) + i*sin(x)) # Euler's formula"],seealso:["expm","expm1","pow","log"]};var RO={name:"expm",category:"Arithmetic",syntax:["exp(x)"],description:"Compute the matrix exponential, expm(A) = e^A. The matrix must be square. Not to be confused with exp(a), which performs element-wise exponentiation.",examples:["expm([[0,2],[0,0]])"],seealso:["exp"]};var kO={name:"expm1",category:"Arithmetic",syntax:["expm1(x)"],description:"Calculate the value of subtracting 1 from the exponential value.",examples:["expm1(2)","pow(e, 2) - 1","log(expm1(2) + 1)"],seealso:["exp","pow","log"]};var LO={name:"fix",category:"Arithmetic",syntax:["fix(x)"],description:"Round a value towards zero. If x is complex, both real and imaginary part are rounded towards zero.",examples:["fix(3.2)","fix(3.8)","fix(-4.2)","fix(-4.8)"],seealso:["ceil","floor","round"]};var qO={name:"floor",category:"Arithmetic",syntax:["floor(x)"],description:"Round a value towards minus infinity.If x is complex, both real and imaginary part are rounded towards minus infinity.",examples:["floor(3.2)","floor(3.8)","floor(-4.2)"],seealso:["ceil","fix","round"]};var UO={name:"gcd",category:"Arithmetic",syntax:["gcd(a, b)","gcd(a, b, c, ...)"],description:"Compute the greatest common divisor.",examples:["gcd(8, 12)","gcd(-4, 6)","gcd(25, 15, -10)"],seealso:["lcm","xgcd"]};var zO={name:"hypot",category:"Arithmetic",syntax:["hypot(a, b, c, ...)","hypot([a, b, c, ...])"],description:"Calculate the hypotenusa of a list with values. ",examples:["hypot(3, 4)","sqrt(3^2 + 4^2)","hypot(-2)","hypot([3, 4, 5])"],seealso:["abs","norm"]};var YO={name:"invmod",category:"Arithmetic",syntax:["invmod(a, b)"],description:"Calculate the (modular) multiplicative inverse of a modulo b. Solution to the equation ax \\u2263 1 (mod b)",examples:["invmod(8, 12)","invmod(7, 13)","invmod(15151, 15122)"],seealso:["gcd","xgcd"]};var WO={name:"lcm",category:"Arithmetic",syntax:["lcm(x, y)"],description:"Compute the least common multiple.",examples:["lcm(4, 6)","lcm(6, 21)","lcm(6, 21, 5)"],seealso:["gcd"]};var HO={name:"log",category:"Arithmetic",syntax:["log(x)","log(x, base)"],description:"Compute the logarithm of a value. If no base is provided, the natural logarithm of x is calculated. If base if provided, the logarithm is calculated for the specified base. log(x, base) is defined as log(x) / log(base).",examples:["log(3.5)","a = log(2.4)","exp(a)","10 ^ 4","log(10000, 10)","log(10000) / log(10)","b = log(1024, 2)","2 ^ b"],seealso:["exp","log1p","log2","log10"]};var $O={name:"log10",category:"Arithmetic",syntax:["log10(x)"],description:"Compute the 10-base logarithm of a value.",examples:["log10(0.00001)","log10(10000)","10 ^ 4","log(10000) / log(10)","log(10000, 10)"],seealso:["exp","log"]};var GO={name:"log1p",category:"Arithmetic",syntax:["log1p(x)","log1p(x, base)"],description:"Calculate the logarithm of a \`value+1\`",examples:["log1p(2.5)","exp(log1p(1.4))","pow(10, 4)","log1p(9999, 10)","log1p(9999) / log(10)"],seealso:["exp","log","log2","log10"]};var VO={name:"log2",category:"Arithmetic",syntax:["log2(x)"],description:"Calculate the 2-base of a value. This is the same as calculating \`log(x, 2)\`.",examples:["log2(0.03125)","log2(16)","log2(16) / log2(2)","pow(2, 4)"],seealso:["exp","log1p","log","log10"]};var ZO={name:"mod",category:"Operators",syntax:["x % y","x mod y","mod(x, y)"],description:"Calculates the modulus, the remainder of an integer division.",examples:["7 % 3","11 % 2","10 mod 4","isOdd(x) = x % 2","isOdd(2)","isOdd(3)"],seealso:["divide"]};var QO={name:"multiply",category:"Operators",syntax:["x * y","multiply(x, y)"],description:"multiply two values.",examples:["a = 2.1 * 3.4","a / 3.4","2 * 3 + 4","2 * (3 + 4)","3 * 2.1 km"],seealso:["divide"]};var XO={name:"norm",category:"Arithmetic",syntax:["norm(x)","norm(x, p)"],description:"Calculate the norm of a number, vector or matrix.",examples:["abs(-3.5)","norm(-3.5)","norm(3 - 4i)","norm([1, 2, -3], Infinity)","norm([1, 2, -3], -Infinity)","norm([3, 4], 2)","norm([[1, 2], [3, 4]], 1)",'norm([[1, 2], [3, 4]], "inf")','norm([[1, 2], [3, 4]], "fro")']};var KO={name:"nthRoot",category:"Arithmetic",syntax:["nthRoot(a)","nthRoot(a, root)"],description:'Calculate the nth root of a value. The principal nth root of a positive real number A, is the positive real solution of the equation "x^root = A".',examples:["4 ^ 3","nthRoot(64, 3)","nthRoot(9, 2)","sqrt(9)"],seealso:["nthRoots","pow","sqrt"]};var JO={name:"nthRoots",category:"Arithmetic",syntax:["nthRoots(A)","nthRoots(A, root)"],description:'Calculate the nth roots of a value. An nth root of a positive real number A, is a positive real solution of the equation "x^root = A". This function returns an array of complex values.',examples:["nthRoots(1)","nthRoots(1, 3)"],seealso:["sqrt","pow","nthRoot"]};var jO={name:"pow",category:"Operators",syntax:["x ^ y","pow(x, y)"],description:"Calculates the power of x to y, x^y.",examples:["2^3","2*2*2","1 + e ^ (pi * i)","pow([[1, 2], [4, 3]], 2)","pow([[1, 2], [4, 3]], -1)"],seealso:["multiply","nthRoot","nthRoots","sqrt"]};var e3={name:"round",category:"Arithmetic",syntax:["round(x)","round(x, n)","round(unit, valuelessUnit)","round(unit, n, valuelessUnit)"],description:"round a value towards the nearest integer.If x is complex, both real and imaginary part are rounded towards the nearest integer. When n is specified, the value is rounded to n decimals.",examples:["round(3.2)","round(3.8)","round(-4.2)","round(-4.8)","round(pi, 3)","round(123.45678, 2)","round(3.241cm, 2, cm)","round([3.2, 3.8, -4.7])"],seealso:["ceil","floor","fix"]};var r3={name:"sign",category:"Arithmetic",syntax:["sign(x)"],description:"Compute the sign of a value. The sign of a value x is 1 when x>1, -1 when x<0, and 0 when x=0.",examples:["sign(3.5)","sign(-4.2)","sign(0)"],seealso:["abs"]};var t3={name:"sqrt",category:"Arithmetic",syntax:["sqrt(x)"],description:"Compute the square root value. If x = y * y, then y is the square root of x.",examples:["sqrt(25)","5 * 5","sqrt(-1)"],seealso:["square","sqrtm","multiply","nthRoot","nthRoots","pow"]};var n3={name:"sqrtm",category:"Arithmetic",syntax:["sqrtm(x)"],description:"Calculate the principal square root of a square matrix. The principal square root matrix \`X\` of another matrix \`A\` is such that \`X * X = A\`.",examples:["sqrtm([[33, 24], [48, 57]])"],seealso:["sqrt","abs","square","multiply"]};var a3={name:"sylvester",category:"Algebra",syntax:["sylvester(A,B,C)"],description:"Solves the real-valued Sylvester equation AX+XB=C for X",examples:["sylvester([[-1, -2], [1, 1]], [[-2, 1], [-1, 2]], [[-3, 2], [3, 0]])","A = [[-1, -2], [1, 1]]; B = [[2, -1], [1, -2]]; C = [[-3, 2], [3, 0]]","sylvester(A, B, C)"],seealso:["schur","lyap"]};var i3={name:"schur",category:"Algebra",syntax:["schur(A)"],description:"Performs a real Schur decomposition of the real matrix A = UTU'",examples:["schur([[1, 0], [-4, 3]])","A = [[1, 0], [-4, 3]]","schur(A)"],seealso:["lyap","sylvester"]};var o3={name:"lyap",category:"Algebra",syntax:["lyap(A,Q)"],description:"Solves the Continuous-time Lyapunov equation AP+PA'+Q=0 for P",examples:["lyap([[-2, 0], [1, -4]], [[3, 1], [1, 3]])","A = [[-2, 0], [1, -4]]","Q = [[3, 1], [1, 3]]","lyap(A,Q)"],seealso:["schur","sylvester"]};var s3={name:"square",category:"Arithmetic",syntax:["square(x)"],description:"Compute the square of a value. The square of x is x * x.",examples:["square(3)","sqrt(9)","3^2","3 * 3"],seealso:["multiply","pow","sqrt","cube"]};var u3={name:"subtract",category:"Operators",syntax:["x - y","subtract(x, y)"],description:"subtract two values.",examples:["a = 5.3 - 2","a + 2","2/3 - 1/6","2 * 3 - 3","2.1 km - 500m"],seealso:["add"]};var f3={name:"unaryMinus",category:"Operators",syntax:["-x","unaryMinus(x)"],description:"Inverse the sign of a value. Converts booleans and strings to numbers.",examples:["-4.5","-(-5.6)",'-"22"'],seealso:["add","subtract","unaryPlus"]};var l3={name:"unaryPlus",category:"Operators",syntax:["+x","unaryPlus(x)"],description:"Converts booleans and strings to numbers.",examples:["+true",'+"2"'],seealso:["add","subtract","unaryMinus"]};var c3={name:"xgcd",category:"Arithmetic",syntax:["xgcd(a, b)"],description:"Calculate the extended greatest common divisor for two values. The result is an array [d, x, y] with 3 entries, where d is the greatest common divisor, and d = x * a + y * b.",examples:["xgcd(8, 12)","gcd(8, 12)","xgcd(36163, 21199)"],seealso:["gcd","lcm"]};var m3={name:"bitAnd",category:"Bitwise",syntax:["x & y","bitAnd(x, y)"],description:"Bitwise AND operation. Performs the logical AND operation on each pair of the corresponding bits of the two given values by multiplying them. If both bits in the compared position are 1, the bit in the resulting binary representation is 1, otherwise, the result is 0",examples:["5 & 3","bitAnd(53, 131)","[1, 12, 31] & 42"],seealso:["bitNot","bitOr","bitXor","leftShift","rightArithShift","rightLogShift"]};var p3={name:"bitNot",category:"Bitwise",syntax:["~x","bitNot(x)"],description:"Bitwise NOT operation. Performs a logical negation on each bit of the given value. Bits that are 0 become 1, and those that are 1 become 0.",examples:["~1","~2","bitNot([2, -3, 4])"],seealso:["bitAnd","bitOr","bitXor","leftShift","rightArithShift","rightLogShift"]};var d3={name:"bitOr",category:"Bitwise",syntax:["x | y","bitOr(x, y)"],description:"Bitwise OR operation. Performs the logical inclusive OR operation on each pair of corresponding bits of the two given values. The result in each position is 1 if the first bit is 1 or the second bit is 1 or both bits are 1, otherwise, the result is 0.",examples:["5 | 3","bitOr([1, 2, 3], 4)"],seealso:["bitAnd","bitNot","bitXor","leftShift","rightArithShift","rightLogShift"]};var h3={name:"bitXor",category:"Bitwise",syntax:["bitXor(x, y)"],description:"Bitwise XOR operation, exclusive OR. Performs the logical exclusive OR operation on each pair of corresponding bits of the two given values. The result in each position is 1 if only the first bit is 1 or only the second bit is 1, but will be 0 if both are 0 or both are 1.",examples:["bitOr(1, 2)","bitXor([2, 3, 4], 4)"],seealso:["bitAnd","bitNot","bitOr","leftShift","rightArithShift","rightLogShift"]};var v3={name:"leftShift",category:"Bitwise",syntax:["x << y","leftShift(x, y)"],description:"Bitwise left logical shift of a value x by y number of bits.",examples:["4 << 1","8 >> 1"],seealso:["bitAnd","bitNot","bitOr","bitXor","rightArithShift","rightLogShift"]};var g3={name:"rightArithShift",category:"Bitwise",syntax:["x >> y","rightArithShift(x, y)"],description:"Bitwise right arithmetic shift of a value x by y number of bits.",examples:["8 >> 1","4 << 1","-12 >> 2"],seealso:["bitAnd","bitNot","bitOr","bitXor","leftShift","rightLogShift"]};var y3={name:"rightLogShift",category:"Bitwise",syntax:["x >>> y","rightLogShift(x, y)"],description:"Bitwise right logical shift of a value x by y number of bits.",examples:["8 >>> 1","4 << 1","-12 >>> 2"],seealso:["bitAnd","bitNot","bitOr","bitXor","leftShift","rightArithShift"]};var x3={name:"bellNumbers",category:"Combinatorics",syntax:["bellNumbers(n)"],description:"The Bell Numbers count the number of partitions of a set. A partition is a pairwise disjoint subset of S whose union is S. \`bellNumbers\` only takes integer arguments. The following condition must be enforced: n >= 0.",examples:["bellNumbers(3)","bellNumbers(8)"],seealso:["stirlingS2"]};var b3={name:"catalan",category:"Combinatorics",syntax:["catalan(n)"],description:"The Catalan Numbers enumerate combinatorial structures of many different types. catalan only takes integer arguments. The following condition must be enforced: n >= 0.",examples:["catalan(3)","catalan(8)"],seealso:["bellNumbers"]};var w3={name:"composition",category:"Combinatorics",syntax:["composition(n, k)"],description:"The composition counts of n into k parts. composition only takes integer arguments. The following condition must be enforced: k <= n.",examples:["composition(5, 3)"],seealso:["combinations"]};var D3={name:"stirlingS2",category:"Combinatorics",syntax:["stirlingS2(n, k)"],description:"he Stirling numbers of the second kind, counts the number of ways to partition a set of n labelled objects into k nonempty unlabelled subsets. \`stirlingS2\` only takes integer arguments. The following condition must be enforced: k <= n. If n = k or k = 1, then s(n,k) = 1.",examples:["stirlingS2(5, 3)"],seealso:["bellNumbers"]};var S3={name:"arg",category:"Complex",syntax:["arg(x)"],description:"Compute the argument of a complex value. If x = a+bi, the argument is computed as atan2(b, a).",examples:["arg(2 + 2i)","atan2(3, 2)","arg(2 + 3i)"],seealso:["re","im","conj","abs"]};var N3={name:"conj",category:"Complex",syntax:["conj(x)"],description:"Compute the complex conjugate of a complex value. If x = a+bi, the complex conjugate is a-bi.",examples:["conj(2 + 3i)","conj(2 - 3i)","conj(-5.2i)"],seealso:["re","im","abs","arg"]};var A3={name:"im",category:"Complex",syntax:["im(x)"],description:"Get the imaginary part of a complex number.",examples:["im(2 + 3i)","re(2 + 3i)","im(-5.2i)","im(2.4)"],seealso:["re","conj","abs","arg"]};var M3={name:"re",category:"Complex",syntax:["re(x)"],description:"Get the real part of a complex number.",examples:["re(2 + 3i)","im(2 + 3i)","re(-5.2i)","re(2.4)"],seealso:["im","conj","abs","arg"]};var E3={name:"evaluate",category:"Expression",syntax:["evaluate(expression)","evaluate(expression, scope)","evaluate([expr1, expr2, expr3, ...])","evaluate([expr1, expr2, expr3, ...], scope)"],description:"Evaluate an expression or an array with expressions.",examples:['evaluate("2 + 3")','evaluate("sqrt(16)")','evaluate("2 inch to cm")','evaluate("sin(x * pi)", { "x": 1/2 })','evaluate(["width=2", "height=4","width*height"])'],seealso:[]};var C3={name:"help",category:"Expression",syntax:["help(object)","help(string)"],description:"Display documentation on a function or data type.",examples:["help(sqrt)",'help("complex")'],seealso:[]};var T3={name:"distance",category:"Geometry",syntax:["distance([x1, y1], [x2, y2])","distance([[x1, y1], [x2, y2]])"],description:"Calculates the Euclidean distance between two points.",examples:["distance([0,0], [4,4])","distance([[0,0], [4,4]])"],seealso:[]};var _3={name:"intersect",category:"Geometry",syntax:["intersect(expr1, expr2, expr3, expr4)","intersect(expr1, expr2, expr3)"],description:"Computes the intersection point of lines and/or planes.",examples:["intersect([0, 0], [10, 10], [10, 0], [0, 10])","intersect([1, 0, 1], [4, -2, 2], [1, 1, 1, 6])"],seealso:[]};var F3={name:"and",category:"Logical",syntax:["x and y","and(x, y)"],description:"Logical and. Test whether two values are both defined with a nonzero/nonempty value.",examples:["true and false","true and true","2 and 4"],seealso:["not","or","xor"]};var O3={name:"not",category:"Logical",syntax:["not x","not(x)"],description:"Logical not. Flips the boolean value of given argument.",examples:["not true","not false","not 2","not 0"],seealso:["and","or","xor"]};var B3={name:"or",category:"Logical",syntax:["x or y","or(x, y)"],description:"Logical or. Test if at least one value is defined with a nonzero/nonempty value.",examples:["true or false","false or false","0 or 4"],seealso:["not","and","xor"]};var I3={name:"xor",category:"Logical",syntax:["x xor y","xor(x, y)"],description:"Logical exclusive or, xor. Test whether one and only one value is defined with a nonzero/nonempty value.",examples:["true xor false","false xor false","true xor true","0 xor 4"],seealso:["not","and","or"]};var P3={name:"column",category:"Matrix",syntax:["column(x, index)"],description:"Return a column from a matrix or array.",examples:["A = [[1, 2], [3, 4]]","column(A, 1)","column(A, 2)"],seealso:["row","matrixFromColumns"]};var R3={name:"concat",category:"Matrix",syntax:["concat(A, B, C, ...)","concat(A, B, C, ..., dim)"],description:"Concatenate matrices. By default, the matrices are concatenated by the last dimension. The dimension on which to concatenate can be provided as last argument.",examples:["A = [1, 2; 5, 6]","B = [3, 4; 7, 8]","concat(A, B)","concat(A, B, 1)","concat(A, B, 2)"],seealso:["det","diag","identity","inv","ones","range","size","squeeze","subset","trace","transpose","zeros"]};var k3={name:"count",category:"Matrix",syntax:["count(x)"],description:"Count the number of elements of a matrix, array or string.",examples:["a = [1, 2; 3, 4; 5, 6]","count(a)","size(a)",'count("hello world")'],seealso:["size"]};var L3={name:"cross",category:"Matrix",syntax:["cross(A, B)"],description:"Calculate the cross product for two vectors in three dimensional space.",examples:["cross([1, 1, 0], [0, 1, 1])","cross([3, -3, 1], [4, 9, 2])","cross([2, 3, 4], [5, 6, 7])"],seealso:["multiply","dot"]};var q3={name:"ctranspose",category:"Matrix",syntax:["x'","ctranspose(x)"],description:"Complex Conjugate and Transpose a matrix",examples:["a = [1, 2, 3; 4, 5, 6]","a'","ctranspose(a)"],seealso:["concat","det","diag","identity","inv","ones","range","size","squeeze","subset","trace","zeros"]};var U3={name:"det",category:"Matrix",syntax:["det(x)"],description:"Calculate the determinant of a matrix",examples:["det([1, 2; 3, 4])","det([-2, 2, 3; -1, 1, 3; 2, 0, -1])"],seealso:["concat","diag","identity","inv","ones","range","size","squeeze","subset","trace","transpose","zeros"]};var z3={name:"diag",category:"Matrix",syntax:["diag(x)","diag(x, k)"],description:"Create a diagonal matrix or retrieve the diagonal of a matrix. When x is a vector, a matrix with the vector values on the diagonal will be returned. When x is a matrix, a vector with the diagonal values of the matrix is returned. When k is provided, the k-th diagonal will be filled in or retrieved, if k is positive, the values are placed on the super diagonal. When k is negative, the values are placed on the sub diagonal.",examples:["diag(1:3)","diag(1:3, 1)","a = [1, 2, 3; 4, 5, 6; 7, 8, 9]","diag(a)"],seealso:["concat","det","identity","inv","ones","range","size","squeeze","subset","trace","transpose","zeros"]};var Y3={name:"diff",category:"Matrix",syntax:["diff(arr)","diff(arr, dim)"],description:["Create a new matrix or array with the difference of the passed matrix or array.","Dim parameter is optional and used to indicant the dimension of the array/matrix to apply the difference","If no dimension parameter is passed it is assumed as dimension 0","Dimension is zero-based in javascript and one-based in the parser","Arrays must be 'rectangular' meaning arrays like [1, 2]","If something is passed as a matrix it will be returned as a matrix but other than that all matrices are converted to arrays"],examples:["A = [1, 2, 4, 7, 0]","diff(A)","diff(A, 1)","B = [[1, 2], [3, 4]]","diff(B)","diff(B, 1)","diff(B, 2)","diff(B, bignumber(2))","diff([[1, 2], matrix([3, 4])], 2)"],seealso:["subtract","partitionSelect"]};var W3={name:"dot",category:"Matrix",syntax:["dot(A, B)","A * B"],description:"Calculate the dot product of two vectors. The dot product of A = [a1, a2, a3, ..., an] and B = [b1, b2, b3, ..., bn] is defined as dot(A, B) = a1 * b1 + a2 * b2 + a3 * b3 + ... + an * bn",examples:["dot([2, 4, 1], [2, 2, 3])","[2, 4, 1] * [2, 2, 3]"],seealso:["multiply","cross"]};var H3={name:"eigs",category:"Matrix",syntax:["eigs(x)"],description:"Calculate the eigenvalues and optionally eigenvectors of a square matrix",examples:["eigs([[5, 2.3], [2.3, 1]])","eigs([[1, 2, 3], [4, 5, 6], [7, 8, 9]], { precision: 1e-6, eigenvectors: false })"],seealso:["inv"]};var $3={name:"filter",category:"Matrix",syntax:["filter(x, test)"],description:"Filter items in a matrix.",examples:["isPositive(x) = x > 0","filter([6, -2, -1, 4, 3], isPositive)","filter([6, -2, 0, 1, 0], x != 0)"],seealso:["sort","map","forEach"]};var G3={name:"flatten",category:"Matrix",syntax:["flatten(x)"],description:"Flatten a multi dimensional matrix into a single dimensional matrix.",examples:["a = [1, 2, 3; 4, 5, 6]","size(a)","b = flatten(a)","size(b)"],seealso:["concat","resize","size","squeeze"]};var V3={name:"forEach",category:"Matrix",syntax:["forEach(x, callback)"],description:"Iterates over all elements of a matrix/array, and executes the given callback function.",examples:["numberOfPets = {}","addPet(n) = numberOfPets[n] = (numberOfPets[n] ? numberOfPets[n]:0 ) + 1;",'forEach(["Dog","Cat","Cat"], addPet)',"numberOfPets"],seealso:["map","sort","filter"]};var Z3={name:"getMatrixDataType",category:"Matrix",syntax:["getMatrixDataType(x)"],description:'Find the data type of all elements in a matrix or array, for example "number" if all items are a number and "Complex" if all values are complex numbers. If a matrix contains more than one data type, it will return "mixed".',examples:["getMatrixDataType([1, 2, 3])","getMatrixDataType([[5 cm], [2 inch]])",'getMatrixDataType([1, "text"])',"getMatrixDataType([1, bignumber(4)])"],seealso:["matrix","sparse","typeOf"]};var Q3={name:"identity",category:"Matrix",syntax:["identity(n)","identity(m, n)","identity([m, n])"],description:"Returns the identity matrix with size m-by-n. The matrix has ones on the diagonal and zeros elsewhere.",examples:["identity(3)","identity(3, 5)","a = [1, 2, 3; 4, 5, 6]","identity(size(a))"],seealso:["concat","det","diag","inv","ones","range","size","squeeze","subset","trace","transpose","zeros"]};var X3={name:"inv",category:"Matrix",syntax:["inv(x)"],description:"Calculate the inverse of a matrix",examples:["inv([1, 2; 3, 4])","inv(4)","1 / 4"],seealso:["concat","det","diag","identity","ones","range","size","squeeze","subset","trace","transpose","zeros"]};var K3={name:"pinv",category:"Matrix",syntax:["pinv(x)"],description:"Calculate the Moore\\u2013Penrose inverse of a matrix",examples:["pinv([1, 2; 3, 4])","pinv([[1, 0], [0, 1], [0, 1]])","pinv(4)"],seealso:["inv"]};var J3={name:"kron",category:"Matrix",syntax:["kron(x, y)"],description:"Calculates the kronecker product of 2 matrices or vectors.",examples:["kron([[1, 0], [0, 1]], [[1, 2], [3, 4]])","kron([1,1], [2,3,4])"],seealso:["multiply","dot","cross"]};var j3={name:"map",category:"Matrix",syntax:["map(x, callback)"],description:"Create a new matrix or array with the results of the callback function executed on each entry of the matrix/array.",examples:["map([1, 2, 3], square)"],seealso:["filter","forEach"]};var eB={name:"matrixFromColumns",category:"Matrix",syntax:["matrixFromColumns(...arr)","matrixFromColumns(row1, row2)","matrixFromColumns(row1, row2, row3)"],description:"Create a dense matrix from vectors as individual columns.",examples:["matrixFromColumns([1, 2, 3], [[4],[5],[6]])"],seealso:["matrix","matrixFromRows","matrixFromFunction","zeros"]};var rB={name:"matrixFromFunction",category:"Matrix",syntax:["matrixFromFunction(size, fn)","matrixFromFunction(size, fn, format)","matrixFromFunction(size, fn, format, datatype)","matrixFromFunction(size, format, fn)","matrixFromFunction(size, format, datatype, fn)"],description:"Create a matrix by evaluating a generating function at each index.",examples:["f(I) = I[1] - I[2]","matrixFromFunction([3,3], f)","g(I) = I[1] - I[2] == 1 ? 4 : 0",'matrixFromFunction([100, 100], "sparse", g)',"matrixFromFunction([5], random)"],seealso:["matrix","matrixFromRows","matrixFromColumns","zeros"]};var tB={name:"matrixFromRows",category:"Matrix",syntax:["matrixFromRows(...arr)","matrixFromRows(row1, row2)","matrixFromRows(row1, row2, row3)"],description:"Create a dense matrix from vectors as individual rows.",examples:["matrixFromRows([1, 2, 3], [[4],[5],[6]])"],seealso:["matrix","matrixFromColumns","matrixFromFunction","zeros"]};var nB={name:"ones",category:"Matrix",syntax:["ones(m)","ones(m, n)","ones(m, n, p, ...)","ones([m])","ones([m, n])","ones([m, n, p, ...])"],description:"Create a matrix containing ones.",examples:["ones(3)","ones(3, 5)","ones([2,3]) * 4.5","a = [1, 2, 3; 4, 5, 6]","ones(size(a))"],seealso:["concat","det","diag","identity","inv","range","size","squeeze","subset","trace","transpose","zeros"]};var aB={name:"partitionSelect",category:"Matrix",syntax:["partitionSelect(x, k)","partitionSelect(x, k, compare)"],description:"Partition-based selection of an array or 1D matrix. Will find the kth smallest value, and mutates the input array. Uses Quickselect.",examples:["partitionSelect([5, 10, 1], 2)",'partitionSelect(["C", "B", "A", "D"], 1, compareText)',"arr = [5, 2, 1]","partitionSelect(arr, 0) # returns 1, arr is now: [1, 2, 5]","arr","partitionSelect(arr, 1, 'desc') # returns 2, arr is now: [5, 2, 1]","arr"],seealso:["sort"]};var iB={name:"range",category:"Type",syntax:["start:end","start:step:end","range(start, end)","range(start, end, step)","range(string)"],description:"Create a range. Lower bound of the range is included, upper bound is excluded.",examples:["1:5","3:-1:-3","range(3, 7)","range(0, 12, 2)",'range("4:10")',"range(1m, 1m, 3m)","a = [1, 2, 3, 4; 5, 6, 7, 8]","a[1:2, 1:2]"],seealso:["concat","det","diag","identity","inv","ones","size","squeeze","subset","trace","transpose","zeros"]};var oB={name:"reshape",category:"Matrix",syntax:["reshape(x, sizes)"],description:"Reshape a multi dimensional array to fit the specified dimensions.",examples:["reshape([1, 2, 3, 4, 5, 6], [2, 3])","reshape([[1, 2], [3, 4]], [1, 4])","reshape([[1, 2], [3, 4]], [4])","reshape([1, 2, 3, 4], [-1, 2])"],seealso:["size","squeeze","resize"]};var sB={name:"resize",category:"Matrix",syntax:["resize(x, size)","resize(x, size, defaultValue)"],description:"Resize a matrix.",examples:["resize([1,2,3,4,5], [3])","resize([1,2,3], [5])","resize([1,2,3], [5], -1)","resize(2, [2, 3])",'resize("hello", [8], "!")'],seealso:["size","subset","squeeze","reshape"]};var uB={name:"rotate",category:"Matrix",syntax:["rotate(w, theta)","rotate(w, theta, v)"],description:"Returns a 2-D rotation matrix (2x2) for a given angle (in radians). Returns a 2-D rotation matrix (3x3) of a given angle (in radians) around given axis.",examples:["rotate([1, 0], pi / 2)",'rotate(matrix([1, 0]), unit("35deg"))','rotate([1, 0, 0], unit("90deg"), [0, 0, 1])','rotate(matrix([1, 0, 0]), unit("90deg"), matrix([0, 0, 1]))'],seealso:["matrix","rotationMatrix"]};var fB={name:"rotationMatrix",category:"Matrix",syntax:["rotationMatrix(theta)","rotationMatrix(theta, v)","rotationMatrix(theta, v, format)"],description:"Returns a 2-D rotation matrix (2x2) for a given angle (in radians). Returns a 2-D rotation matrix (3x3) of a given angle (in radians) around given axis.",examples:["rotationMatrix(pi / 2)",'rotationMatrix(unit("45deg"), [0, 0, 1])','rotationMatrix(1, matrix([0, 0, 1]), "sparse")'],seealso:["cos","sin"]};var lB={name:"row",category:"Matrix",syntax:["row(x, index)"],description:"Return a row from a matrix or array.",examples:["A = [[1, 2], [3, 4]]","row(A, 1)","row(A, 2)"],seealso:["column","matrixFromRows"]};var cB={name:"size",category:"Matrix",syntax:["size(x)"],description:"Calculate the size of a matrix.",examples:["size(2.3)",'size("hello world")',"a = [1, 2; 3, 4; 5, 6]","size(a)","size(1:6)"],seealso:["concat","count","det","diag","identity","inv","ones","range","squeeze","subset","trace","transpose","zeros"]};var mB={name:"sort",category:"Matrix",syntax:["sort(x)","sort(x, compare)"],description:'Sort the items in a matrix. Compare can be a string "asc", "desc", "natural", or a custom sort function.',examples:["sort([5, 10, 1])",'sort(["C", "B", "A", "D"], "natural")',"sortByLength(a, b) = size(a)[1] - size(b)[1]",'sort(["Langdon", "Tom", "Sara"], sortByLength)','sort(["10", "1", "2"], "natural")'],seealso:["map","filter","forEach"]};var pB={name:"squeeze",category:"Matrix",syntax:["squeeze(x)"],description:"Remove inner and outer singleton dimensions from a matrix.",examples:["a = zeros(3,2,1)","size(squeeze(a))","b = zeros(1,1,3)","size(squeeze(b))"],seealso:["concat","det","diag","identity","inv","ones","range","size","subset","trace","transpose","zeros"]};var dB={name:"subset",category:"Matrix",syntax:["value(index)","value(index) = replacement","subset(value, [index])","subset(value, [index], replacement)"],description:"Get or set a subset of the entries of a matrix or characters of a string. Indexes are one-based. There should be one index specification for each dimension of the target. Each specification can be a single index, a list of indices, or a range in colon notation \`l:u\`. In a range, both the lower bound l and upper bound u are included; and if a bound is omitted it defaults to the most extreme valid value. The cartesian product of the indices specified in each dimension determines the target of the operation.",examples:["d = [1, 2; 3, 4]","e = []","e[1, 1:2] = [5, 6]","e[2, :] = [7, 8]","f = d * e","f[2, 1]","f[:, 1]","f[[1,2], [1,3]] = [9, 10; 11, 12]","f"],seealso:["concat","det","diag","identity","inv","ones","range","size","squeeze","trace","transpose","zeros"]};var hB={name:"trace",category:"Matrix",syntax:["trace(A)"],description:"Calculate the trace of a matrix: the sum of the elements on the main diagonal of a square matrix.",examples:["A = [1, 2, 3; -1, 2, 3; 2, 0, 3]","trace(A)"],seealso:["concat","det","diag","identity","inv","ones","range","size","squeeze","subset","transpose","zeros"]};var vB={name:"transpose",category:"Matrix",syntax:["x'","transpose(x)"],description:"Transpose a matrix",examples:["a = [1, 2, 3; 4, 5, 6]","a'","transpose(a)"],seealso:["concat","det","diag","identity","inv","ones","range","size","squeeze","subset","trace","zeros"]};var gB={name:"zeros",category:"Matrix",syntax:["zeros(m)","zeros(m, n)","zeros(m, n, p, ...)","zeros([m])","zeros([m, n])","zeros([m, n, p, ...])"],description:"Create a matrix containing zeros.",examples:["zeros(3)","zeros(3, 5)","a = [1, 2, 3; 4, 5, 6]","zeros(size(a))"],seealso:["concat","det","diag","identity","inv","ones","range","size","squeeze","subset","trace","transpose"]};var yB={name:"fft",category:"Matrix",syntax:["fft(x)"],description:"Calculate N-dimensional fourier transform",examples:["fft([[1, 0], [1, 0]])"],seealso:["ifft"]};var xB={name:"ifft",category:"Matrix",syntax:["ifft(x)"],description:"Calculate N-dimensional inverse fourier transform",examples:["ifft([[2, 2], [0, 0]])"],seealso:["fft"]};var bB={name:"combinations",category:"Probability",syntax:["combinations(n, k)"],description:"Compute the number of combinations of n items taken k at a time",examples:["combinations(7, 5)"],seealso:["combinationsWithRep","permutations","factorial"]};var wB={name:"combinationsWithRep",category:"Probability",syntax:["combinationsWithRep(n, k)"],description:"Compute the number of combinations of n items taken k at a time with replacements.",examples:["combinationsWithRep(7, 5)"],seealso:["combinations","permutations","factorial"]};var DB={name:"factorial",category:"Probability",syntax:["n!","factorial(n)"],description:"Compute the factorial of a value",examples:["5!","5 * 4 * 3 * 2 * 1","3!"],seealso:["combinations","combinationsWithRep","permutations","gamma"]};var SB={name:"gamma",category:"Probability",syntax:["gamma(n)"],description:"Compute the gamma function. For small values, the Lanczos approximation is used, and for large values the extended Stirling approximation.",examples:["gamma(4)","3!","gamma(1/2)","sqrt(pi)"],seealso:["factorial"]};var NB={name:"lgamma",category:"Probability",syntax:["lgamma(n)"],description:"Logarithm of the gamma function for real, positive numbers and complex numbers, using Lanczos approximation for numbers and Stirling series for complex numbers.",examples:["lgamma(4)","lgamma(1/2)","lgamma(i)","lgamma(complex(1.1, 2))"],seealso:["gamma"]};var AB={name:"kldivergence",category:"Probability",syntax:["kldivergence(x, y)"],description:"Calculate the Kullback-Leibler (KL) divergence between two distributions.",examples:["kldivergence([0.7,0.5,0.4], [0.2,0.9,0.5])"],seealso:[]};var MB={name:"multinomial",category:"Probability",syntax:["multinomial(A)"],description:"Multinomial Coefficients compute the number of ways of picking a1, a2, ..., ai unordered outcomes from \`n\` possibilities. multinomial takes one array of integers as an argument. The following condition must be enforced: every ai > 0.",examples:["multinomial([1, 2, 1])"],seealso:["combinations","factorial"]};var EB={name:"permutations",category:"Probability",syntax:["permutations(n)","permutations(n, k)"],description:"Compute the number of permutations of n items taken k at a time",examples:["permutations(5)","permutations(5, 3)"],seealso:["combinations","combinationsWithRep","factorial"]};var CB={name:"pickRandom",category:"Probability",syntax:["pickRandom(array)","pickRandom(array, number)","pickRandom(array, weights)","pickRandom(array, number, weights)","pickRandom(array, weights, number)"],description:"Pick a random entry from a given array.",examples:["pickRandom(0:10)","pickRandom([1, 3, 1, 6])","pickRandom([1, 3, 1, 6], 2)","pickRandom([1, 3, 1, 6], [2, 3, 2, 1])","pickRandom([1, 3, 1, 6], 2, [2, 3, 2, 1])","pickRandom([1, 3, 1, 6], [2, 3, 2, 1], 2)"],seealso:["random","randomInt"]};var TB={name:"random",category:"Probability",syntax:["random()","random(max)","random(min, max)","random(size)","random(size, max)","random(size, min, max)"],description:"Return a random number.",examples:["random()","random(10, 20)","random([2, 3])"],seealso:["pickRandom","randomInt"]};var _B={name:"randomInt",category:"Probability",syntax:["randomInt(max)","randomInt(min, max)","randomInt(size)","randomInt(size, max)","randomInt(size, min, max)"],description:"Return a random integer number",examples:["randomInt(10, 20)","randomInt([2, 3], 10)"],seealso:["pickRandom","random"]};var FB={name:"compare",category:"Relational",syntax:["compare(x, y)"],description:"Compare two values. Returns 1 when x > y, -1 when x < y, and 0 when x == y.",examples:["compare(2, 3)","compare(3, 2)","compare(2, 2)","compare(5cm, 40mm)","compare(2, [1, 2, 3])"],seealso:["equal","unequal","smaller","smallerEq","largerEq","compareNatural","compareText"]};var OB={name:"compareNatural",category:"Relational",syntax:["compareNatural(x, y)"],description:"Compare two values of any type in a deterministic, natural way. Returns 1 when x > y, -1 when x < y, and 0 when x == y.",examples:["compareNatural(2, 3)","compareNatural(3, 2)","compareNatural(2, 2)","compareNatural(5cm, 40mm)",'compareNatural("2", "10")',"compareNatural(2 + 3i, 2 + 4i)","compareNatural([1, 2, 4], [1, 2, 3])","compareNatural([1, 5], [1, 2, 3])","compareNatural([1, 2], [1, 2])","compareNatural({a: 2}, {a: 4})"],seealso:["equal","unequal","smaller","smallerEq","largerEq","compare","compareText"]};var BB={name:"compareText",category:"Relational",syntax:["compareText(x, y)"],description:"Compare two strings lexically. Comparison is case sensitive. Returns 1 when x > y, -1 when x < y, and 0 when x == y.",examples:['compareText("B", "A")','compareText("A", "B")','compareText("A", "A")','compareText("2", "10")','compare("2", "10")',"compare(2, 10)",'compareNatural("2", "10")','compareText("B", ["A", "B", "C"])'],seealso:["compare","compareNatural"]};var IB={name:"deepEqual",category:"Relational",syntax:["deepEqual(x, y)"],description:"Check equality of two matrices element wise. Returns true if the size of both matrices is equal and when and each of the elements are equal.",examples:["deepEqual([1,3,4], [1,3,4])","deepEqual([1,3,4], [1,3])"],seealso:["equal","unequal","smaller","larger","smallerEq","largerEq","compare"]};var PB={name:"equal",category:"Relational",syntax:["x == y","equal(x, y)"],description:"Check equality of two values. Returns true if the values are equal, and false if not.",examples:["2+2 == 3","2+2 == 4","a = 3.2","b = 6-2.8","a == b","50cm == 0.5m"],seealso:["unequal","smaller","larger","smallerEq","largerEq","compare","deepEqual","equalText"]};var RB={name:"equalText",category:"Relational",syntax:["equalText(x, y)"],description:"Check equality of two strings. Comparison is case sensitive. Returns true if the values are equal, and false if not.",examples:['equalText("Hello", "Hello")','equalText("a", "A")','equal("2e3", "2000")','equalText("2e3", "2000")','equalText("B", ["A", "B", "C"])'],seealso:["compare","compareNatural","compareText","equal"]};var kB={name:"larger",category:"Relational",syntax:["x > y","larger(x, y)"],description:"Check if value x is larger than y. Returns true if x is larger than y, and false if not.",examples:["2 > 3","5 > 2*2","a = 3.3","b = 6-2.8","(a > b)","(b < a)","5 cm > 2 inch"],seealso:["equal","unequal","smaller","smallerEq","largerEq","compare"]};var LB={name:"largerEq",category:"Relational",syntax:["x >= y","largerEq(x, y)"],description:"Check if value x is larger or equal to y. Returns true if x is larger or equal to y, and false if not.",examples:["2 >= 1+1","2 > 1+1","a = 3.2","b = 6-2.8","(a >= b)"],seealso:["equal","unequal","smallerEq","smaller","compare"]};var qB={name:"smaller",category:"Relational",syntax:["x < y","smaller(x, y)"],description:"Check if value x is smaller than value y. Returns true if x is smaller than y, and false if not.",examples:["2 < 3","5 < 2*2","a = 3.3","b = 6-2.8","(a < b)","5 cm < 2 inch"],seealso:["equal","unequal","larger","smallerEq","largerEq","compare"]};var UB={name:"smallerEq",category:"Relational",syntax:["x <= y","smallerEq(x, y)"],description:"Check if value x is smaller or equal to value y. Returns true if x is smaller than y, and false if not.",examples:["2 <= 1+1","2 < 1+1","a = 3.2","b = 6-2.8","(a <= b)"],seealso:["equal","unequal","larger","smaller","largerEq","compare"]};var zB={name:"unequal",category:"Relational",syntax:["x != y","unequal(x, y)"],description:"Check unequality of two values. Returns true if the values are unequal, and false if they are equal.",examples:["2+2 != 3","2+2 != 4","a = 3.2","b = 6-2.8","a != b","50cm != 0.5m","5 cm != 2 inch"],seealso:["equal","smaller","larger","smallerEq","largerEq","compare","deepEqual"]};var YB={name:"setCartesian",category:"Set",syntax:["setCartesian(set1, set2)"],description:"Create the cartesian product of two (multi)sets. Multi-dimension arrays will be converted to single-dimension arrays and the values will be sorted in ascending order before the operation.",examples:["setCartesian([1, 2], [3, 4])"],seealso:["setUnion","setIntersect","setDifference","setPowerset"]};var WB={name:"setDifference",category:"Set",syntax:["setDifference(set1, set2)"],description:"Create the difference of two (multi)sets: every element of set1, that is not the element of set2. Multi-dimension arrays will be converted to single-dimension arrays before the operation.",examples:["setDifference([1, 2, 3, 4], [3, 4, 5, 6])","setDifference([[1, 2], [3, 4]], [[3, 4], [5, 6]])"],seealso:["setUnion","setIntersect","setSymDifference"]};var HB={name:"setDistinct",category:"Set",syntax:["setDistinct(set)"],description:"Collect the distinct elements of a multiset. A multi-dimension array will be converted to a single-dimension array before the operation.",examples:["setDistinct([1, 1, 1, 2, 2, 3])"],seealso:["setMultiplicity"]};var $B={name:"setIntersect",category:"Set",syntax:["setIntersect(set1, set2)"],description:"Create the intersection of two (multi)sets. Multi-dimension arrays will be converted to single-dimension arrays before the operation.",examples:["setIntersect([1, 2, 3, 4], [3, 4, 5, 6])","setIntersect([[1, 2], [3, 4]], [[3, 4], [5, 6]])"],seealso:["setUnion","setDifference"]};var GB={name:"setIsSubset",category:"Set",syntax:["setIsSubset(set1, set2)"],description:"Check whether a (multi)set is a subset of another (multi)set: every element of set1 is the element of set2. Multi-dimension arrays will be converted to single-dimension arrays before the operation.",examples:["setIsSubset([1, 2], [3, 4, 5, 6])","setIsSubset([3, 4], [3, 4, 5, 6])"],seealso:["setUnion","setIntersect","setDifference"]};var VB={name:"setMultiplicity",category:"Set",syntax:["setMultiplicity(element, set)"],description:"Count the multiplicity of an element in a multiset. A multi-dimension array will be converted to a single-dimension array before the operation.",examples:["setMultiplicity(1, [1, 2, 2, 4])","setMultiplicity(2, [1, 2, 2, 4])"],seealso:["setDistinct","setSize"]};var ZB={name:"setPowerset",category:"Set",syntax:["setPowerset(set)"],description:"Create the powerset of a (multi)set: the powerset contains very possible subsets of a (multi)set. A multi-dimension array will be converted to a single-dimension array before the operation.",examples:["setPowerset([1, 2, 3])"],seealso:["setCartesian"]};var QB={name:"setSize",category:"Set",syntax:["setSize(set)","setSize(set, unique)"],description:'Count the number of elements of a (multi)set. When the second parameter "unique" is true, count only the unique values. A multi-dimension array will be converted to a single-dimension array before the operation.',examples:["setSize([1, 2, 2, 4])","setSize([1, 2, 2, 4], true)"],seealso:["setUnion","setIntersect","setDifference"]};var XB={name:"setSymDifference",category:"Set",syntax:["setSymDifference(set1, set2)"],description:"Create the symmetric difference of two (multi)sets. Multi-dimension arrays will be converted to single-dimension arrays before the operation.",examples:["setSymDifference([1, 2, 3, 4], [3, 4, 5, 6])","setSymDifference([[1, 2], [3, 4]], [[3, 4], [5, 6]])"],seealso:["setUnion","setIntersect","setDifference"]};var KB={name:"setUnion",category:"Set",syntax:["setUnion(set1, set2)"],description:"Create the union of two (multi)sets. Multi-dimension arrays will be converted to single-dimension arrays before the operation.",examples:["setUnion([1, 2, 3, 4], [3, 4, 5, 6])","setUnion([[1, 2], [3, 4]], [[3, 4], [5, 6]])"],seealso:["setIntersect","setDifference"]};var JB={name:"zpk2tf",category:"Signal",syntax:["zpk2tf(z, p, k)"],description:"Compute the transfer function of a zero-pole-gain model.",examples:["zpk2tf([1, 2], [-1, -2], 1)","zpk2tf([1, 2], [-1, -2])","zpk2tf([1 - 3i, 2 + 2i], [-1, -2])"],seealso:[]};var jB={name:"freqz",category:"Signal",syntax:["freqz(b, a)","freqz(b, a, w)"],description:"Calculates the frequency response of a filter given its numerator and denominator coefficients.",examples:["freqz([1, 2], [1, 2, 3])","freqz([1, 2], [1, 2, 3], [0, 1])","freqz([1, 2], [1, 2, 3], 512)"],seealso:[]};var eI={name:"erf",category:"Special",syntax:["erf(x)"],description:"Compute the erf function of a value using a rational Chebyshev approximations for different intervals of x",examples:["erf(0.2)","erf(-0.5)","erf(4)"],seealso:[]};var rI={name:"zeta",category:"Special",syntax:["zeta(s)"],description:"Compute the Riemann Zeta Function using an infinite series and Riemanns Functional Equation for the entire complex plane",examples:["zeta(0.2)","zeta(-0.5)","zeta(4)"],seealso:[]};var tI={name:"mad",category:"Statistics",syntax:["mad(a, b, c, ...)","mad(A)"],description:"Compute the median absolute deviation of a matrix or a list with values. The median absolute deviation is defined as the median of the absolute deviations from the median.",examples:["mad(10, 20, 30)","mad([1, 2, 3])"],seealso:["mean","median","std","abs"]};var nI={name:"max",category:"Statistics",syntax:["max(a, b, c, ...)","max(A)","max(A, dimension)"],description:"Compute the maximum value of a list of values.",examples:["max(2, 3, 4, 1)","max([2, 3, 4, 1])","max([2, 5; 4, 3])","max([2, 5; 4, 3], 1)","max([2, 5; 4, 3], 2)","max(2.7, 7.1, -4.5, 2.0, 4.1)","min(2.7, 7.1, -4.5, 2.0, 4.1)"],seealso:["mean","median","min","prod","std","sum","variance"]};var aI={name:"mean",category:"Statistics",syntax:["mean(a, b, c, ...)","mean(A)","mean(A, dimension)"],description:"Compute the arithmetic mean of a list of values.",examples:["mean(2, 3, 4, 1)","mean([2, 3, 4, 1])","mean([2, 5; 4, 3])","mean([2, 5; 4, 3], 1)","mean([2, 5; 4, 3], 2)","mean([1.0, 2.7, 3.2, 4.0])"],seealso:["max","median","min","prod","std","sum","variance"]};var iI={name:"median",category:"Statistics",syntax:["median(a, b, c, ...)","median(A)"],description:"Compute the median of all values. The values are sorted and the middle value is returned. In case of an even number of values, the average of the two middle values is returned.",examples:["median(5, 2, 7)","median([3, -1, 5, 7])"],seealso:["max","mean","min","prod","std","sum","variance","quantileSeq"]};var oI={name:"min",category:"Statistics",syntax:["min(a, b, c, ...)","min(A)","min(A, dimension)"],description:"Compute the minimum value of a list of values.",examples:["min(2, 3, 4, 1)","min([2, 3, 4, 1])","min([2, 5; 4, 3])","min([2, 5; 4, 3], 1)","min([2, 5; 4, 3], 2)","min(2.7, 7.1, -4.5, 2.0, 4.1)","max(2.7, 7.1, -4.5, 2.0, 4.1)"],seealso:["max","mean","median","prod","std","sum","variance"]};var sI={name:"mode",category:"Statistics",syntax:["mode(a, b, c, ...)","mode(A)","mode(A, a, b, B, c, ...)"],description:"Computes the mode of all values as an array. In case mode being more than one, multiple values are returned in an array.",examples:["mode(2, 1, 4, 3, 1)","mode([1, 2.7, 3.2, 4, 2.7])","mode(1, 4, 6, 1, 6)"],seealso:["max","mean","min","median","prod","std","sum","variance"]};var uI={name:"prod",category:"Statistics",syntax:["prod(a, b, c, ...)","prod(A)"],description:"Compute the product of all values.",examples:["prod(2, 3, 4)","prod([2, 3, 4])","prod([2, 5; 4, 3])"],seealso:["max","mean","min","median","min","std","sum","variance"]};var fI={name:"quantileSeq",category:"Statistics",syntax:["quantileSeq(A, prob[, sorted])","quantileSeq(A, [prob1, prob2, ...][, sorted])","quantileSeq(A, N[, sorted])"],description:\`Compute the prob order quantile of a matrix or a list with values. The sequence is sorted and the middle value is returned. Supported types of sequence values are: Number, BigNumber, Unit Supported types of probablity are: Number, BigNumber. -In case of a (multi dimensional) array or matrix, the prob order quantile of all elements will be calculated.\`,examples:["quantileSeq([3, -1, 5, 7], 0.5)","quantileSeq([3, -1, 5, 7], [1/3, 2/3])","quantileSeq([3, -1, 5, 7], 2)","quantileSeq([-1, 3, 5, 7], 0.5, true)"],seealso:["mean","median","min","max","prod","std","sum","variance"]};var lI={name:"std",category:"Statistics",syntax:["std(a, b, c, ...)","std(A)","std(A, dimension)","std(A, normalization)","std(A, dimension, normalization)"],description:'Compute the standard deviation of all values, defined as std(A) = sqrt(variance(A)). Optional parameter normalization can be "unbiased" (default), "uncorrected", or "biased".',examples:["std(2, 4, 6)","std([2, 4, 6, 8])",'std([2, 4, 6, 8], "uncorrected")','std([2, 4, 6, 8], "biased")',"std([1, 2, 3; 4, 5, 6])"],seealso:["max","mean","min","median","prod","sum","variance"]};var cI={name:"cumsum",category:"Statistics",syntax:["cumsum(a, b, c, ...)","cumsum(A)"],description:"Compute the cumulative sum of all values.",examples:["cumsum(2, 3, 4, 1)","cumsum([2, 3, 4, 1])","cumsum([1, 2; 3, 4])","cumsum([1, 2; 3, 4], 1)","cumsum([1, 2; 3, 4], 2)"],seealso:["max","mean","median","min","prod","std","sum","variance"]};var mI={name:"sum",category:"Statistics",syntax:["sum(a, b, c, ...)","sum(A)","sum(A, dimension)"],description:"Compute the sum of all values.",examples:["sum(2, 3, 4, 1)","sum([2, 3, 4, 1])","sum([2, 5; 4, 3])"],seealso:["max","mean","median","min","prod","std","sum","variance"]};var pI={name:"variance",category:"Statistics",syntax:["variance(a, b, c, ...)","variance(A)","variance(A, dimension)","variance(A, normalization)","variance(A, dimension, normalization)"],description:'Compute the variance of all values. Optional parameter normalization can be "unbiased" (default), "uncorrected", or "biased".',examples:["variance(2, 4, 6)","variance([2, 4, 6, 8])",'variance([2, 4, 6, 8], "uncorrected")','variance([2, 4, 6, 8], "biased")',"variance([1, 2, 3; 4, 5, 6])"],seealso:["max","mean","min","median","min","prod","std","sum"]};var dI={name:"corr",category:"Statistics",syntax:["corr(A,B)"],description:"Compute the correlation coefficient of a two list with values, For matrices, the matrix correlation coefficient is calculated.",examples:["corr([2, 4, 6, 8],[1, 2, 3, 6])","corr(matrix([[1, 2.2, 3, 4.8, 5], [1, 2, 3, 4, 5]]), matrix([[4, 5.3, 6.6, 7, 8], [1, 2, 3, 4, 5]]))"],seealso:["max","mean","min","median","min","prod","std","sum"]};var hI={name:"acos",category:"Trigonometry",syntax:["acos(x)"],description:"Compute the inverse cosine of a value in radians.",examples:["acos(0.5)","acos(cos(2.3))"],seealso:["cos","atan","asin"]};var vI={name:"acosh",category:"Trigonometry",syntax:["acosh(x)"],description:"Calculate the hyperbolic arccos of a value, defined as \`acosh(x) = ln(sqrt(x^2 - 1) + x)\`.",examples:["acosh(1.5)"],seealso:["cosh","asinh","atanh"]};var gI={name:"acot",category:"Trigonometry",syntax:["acot(x)"],description:"Calculate the inverse cotangent of a value.",examples:["acot(0.5)","acot(cot(0.5))","acot(2)"],seealso:["cot","atan"]};var yI={name:"acoth",category:"Trigonometry",syntax:["acoth(x)"],description:"Calculate the hyperbolic arccotangent of a value, defined as \`acoth(x) = (ln((x+1)/x) + ln(x/(x-1))) / 2\`.",examples:["acoth(2)","acoth(0.5)"],seealso:["acsch","asech"]};var xI={name:"acsc",category:"Trigonometry",syntax:["acsc(x)"],description:"Calculate the inverse cotangent of a value.",examples:["acsc(2)","acsc(csc(0.5))","acsc(0.5)"],seealso:["csc","asin","asec"]};var bI={name:"acsch",category:"Trigonometry",syntax:["acsch(x)"],description:"Calculate the hyperbolic arccosecant of a value, defined as \`acsch(x) = ln(1/x + sqrt(1/x^2 + 1))\`.",examples:["acsch(0.5)"],seealso:["asech","acoth"]};var wI={name:"asec",category:"Trigonometry",syntax:["asec(x)"],description:"Calculate the inverse secant of a value.",examples:["asec(0.5)","asec(sec(0.5))","asec(2)"],seealso:["acos","acot","acsc"]};var DI={name:"asech",category:"Trigonometry",syntax:["asech(x)"],description:"Calculate the inverse secant of a value.",examples:["asech(0.5)"],seealso:["acsch","acoth"]};var SI={name:"asin",category:"Trigonometry",syntax:["asin(x)"],description:"Compute the inverse sine of a value in radians.",examples:["asin(0.5)","asin(sin(0.5))"],seealso:["sin","acos","atan"]};var NI={name:"asinh",category:"Trigonometry",syntax:["asinh(x)"],description:"Calculate the hyperbolic arcsine of a value, defined as \`asinh(x) = ln(x + sqrt(x^2 + 1))\`.",examples:["asinh(0.5)"],seealso:["acosh","atanh"]};var AI={name:"atan",category:"Trigonometry",syntax:["atan(x)"],description:"Compute the inverse tangent of a value in radians.",examples:["atan(0.5)","atan(tan(0.5))"],seealso:["tan","acos","asin"]};var MI={name:"atan2",category:"Trigonometry",syntax:["atan2(y, x)"],description:"Computes the principal value of the arc tangent of y/x in radians.",examples:["atan2(2, 2) / pi","angle = 60 deg in rad","x = cos(angle)","y = sin(angle)","atan2(y, x)"],seealso:["sin","cos","tan"]};var EI={name:"atanh",category:"Trigonometry",syntax:["atanh(x)"],description:"Calculate the hyperbolic arctangent of a value, defined as \`atanh(x) = ln((1 + x)/(1 - x)) / 2\`.",examples:["atanh(0.5)"],seealso:["acosh","asinh"]};var CI={name:"cos",category:"Trigonometry",syntax:["cos(x)"],description:"Compute the cosine of x in radians.",examples:["cos(2)","cos(pi / 4) ^ 2","cos(180 deg)","cos(60 deg)","sin(0.2)^2 + cos(0.2)^2"],seealso:["acos","sin","tan"]};var TI={name:"cosh",category:"Trigonometry",syntax:["cosh(x)"],description:"Compute the hyperbolic cosine of x in radians.",examples:["cosh(0.5)"],seealso:["sinh","tanh","coth"]};var _I={name:"cot",category:"Trigonometry",syntax:["cot(x)"],description:"Compute the cotangent of x in radians. Defined as 1/tan(x)",examples:["cot(2)","1 / tan(2)"],seealso:["sec","csc","tan"]};var FI={name:"coth",category:"Trigonometry",syntax:["coth(x)"],description:"Compute the hyperbolic cotangent of x in radians.",examples:["coth(2)","1 / tanh(2)"],seealso:["sech","csch","tanh"]};var OI={name:"csc",category:"Trigonometry",syntax:["csc(x)"],description:"Compute the cosecant of x in radians. Defined as 1/sin(x)",examples:["csc(2)","1 / sin(2)"],seealso:["sec","cot","sin"]};var BI={name:"csch",category:"Trigonometry",syntax:["csch(x)"],description:"Compute the hyperbolic cosecant of x in radians. Defined as 1/sinh(x)",examples:["csch(2)","1 / sinh(2)"],seealso:["sech","coth","sinh"]};var II={name:"sec",category:"Trigonometry",syntax:["sec(x)"],description:"Compute the secant of x in radians. Defined as 1/cos(x)",examples:["sec(2)","1 / cos(2)"],seealso:["cot","csc","cos"]};var PI={name:"sech",category:"Trigonometry",syntax:["sech(x)"],description:"Compute the hyperbolic secant of x in radians. Defined as 1/cosh(x)",examples:["sech(2)","1 / cosh(2)"],seealso:["coth","csch","cosh"]};var RI={name:"sin",category:"Trigonometry",syntax:["sin(x)"],description:"Compute the sine of x in radians.",examples:["sin(2)","sin(pi / 4) ^ 2","sin(90 deg)","sin(30 deg)","sin(0.2)^2 + cos(0.2)^2"],seealso:["asin","cos","tan"]};var kI={name:"sinh",category:"Trigonometry",syntax:["sinh(x)"],description:"Compute the hyperbolic sine of x in radians.",examples:["sinh(0.5)"],seealso:["cosh","tanh"]};var LI={name:"tan",category:"Trigonometry",syntax:["tan(x)"],description:"Compute the tangent of x in radians.",examples:["tan(0.5)","sin(0.5) / cos(0.5)","tan(pi / 4)","tan(45 deg)"],seealso:["atan","sin","cos"]};var qI={name:"tanh",category:"Trigonometry",syntax:["tanh(x)"],description:"Compute the hyperbolic tangent of x in radians.",examples:["tanh(0.5)","sinh(0.5) / cosh(0.5)"],seealso:["sinh","cosh"]};var UI={name:"to",category:"Units",syntax:["x to unit","to(x, unit)"],description:"Change the unit of a value.",examples:["5 inch to cm","3.2kg to g","16 bytes in bits"],seealso:[]};var zI={name:"bin",category:"Utils",syntax:["bin(value)"],description:"Format a number as binary",examples:["bin(2)"],seealso:["oct","hex"]};var YI={name:"clone",category:"Utils",syntax:["clone(x)"],description:"Clone a variable. Creates a copy of primitive variables,and a deep copy of matrices",examples:["clone(3.5)","clone(2 - 4i)","clone(45 deg)","clone([1, 2; 3, 4])",'clone("hello world")'],seealso:[]};var WI={name:"format",category:"Utils",syntax:["format(value)","format(value, precision)"],description:"Format a value of any type as string.",examples:["format(2.3)","format(3 - 4i)","format([])","format(pi, 3)"],seealso:["print"]};var HI={name:"hasNumericValue",category:"Utils",syntax:["hasNumericValue(x)"],description:"Test whether a value is an numeric value. In case of a string, true is returned if the string contains a numeric value.",examples:["hasNumericValue(2)",'hasNumericValue("2")','isNumeric("2")',"hasNumericValue(0)","hasNumericValue(bignumber(500))","hasNumericValue(fraction(0.125))","hasNumericValue(2 + 3i)",'hasNumericValue([2.3, "foo", false])'],seealso:["isInteger","isZero","isNegative","isPositive","isNaN","isNumeric"]};var $I={name:"hex",category:"Utils",syntax:["hex(value)"],description:"Format a number as hexadecimal",examples:["hex(240)"],seealso:["bin","oct"]};var GI={name:"isInteger",category:"Utils",syntax:["isInteger(x)"],description:"Test whether a value is an integer number.",examples:["isInteger(2)","isInteger(3.5)","isInteger([3, 0.5, -2])"],seealso:["isNegative","isNumeric","isPositive","isZero"]};var VI={name:"isNaN",category:"Utils",syntax:["isNaN(x)"],description:"Test whether a value is NaN (not a number)",examples:["isNaN(2)","isNaN(0 / 0)","isNaN(NaN)","isNaN(Infinity)"],seealso:["isNegative","isNumeric","isPositive","isZero"]};var ZI={name:"isNegative",category:"Utils",syntax:["isNegative(x)"],description:"Test whether a value is negative: smaller than zero.",examples:["isNegative(2)","isNegative(0)","isNegative(-4)","isNegative([3, 0.5, -2])"],seealso:["isInteger","isNumeric","isPositive","isZero"]};var QI={name:"isNumeric",category:"Utils",syntax:["isNumeric(x)"],description:"Test whether a value is a numeric value. Returns true when the input is a number, BigNumber, Fraction, or boolean.",examples:["isNumeric(2)",'isNumeric("2")','hasNumericValue("2")',"isNumeric(0)","isNumeric(bignumber(500))","isNumeric(fraction(0.125))","isNumeric(2 + 3i)",'isNumeric([2.3, "foo", false])'],seealso:["isInteger","isZero","isNegative","isPositive","isNaN","hasNumericValue"]};var XI={name:"isPositive",category:"Utils",syntax:["isPositive(x)"],description:"Test whether a value is positive: larger than zero.",examples:["isPositive(2)","isPositive(0)","isPositive(-4)","isPositive([3, 0.5, -2])"],seealso:["isInteger","isNumeric","isNegative","isZero"]};var KI={name:"isPrime",category:"Utils",syntax:["isPrime(x)"],description:"Test whether a value is prime: has no divisors other than itself and one.",examples:["isPrime(3)","isPrime(-2)","isPrime([2, 17, 100])"],seealso:["isInteger","isNumeric","isNegative","isZero"]};var JI={name:"isZero",category:"Utils",syntax:["isZero(x)"],description:"Test whether a value is zero.",examples:["isZero(2)","isZero(0)","isZero(-4)","isZero([3, 0, -2, 0])"],seealso:["isInteger","isNumeric","isNegative","isPositive"]};var jI={name:"numeric",category:"Utils",syntax:["numeric(x)"],description:"Convert a numeric input to a specific numeric type: number, BigNumber, or Fraction.",examples:['numeric("4")','numeric("4", "number")','numeric("4", "BigNumber")','numeric("4", "Fraction")','numeric(4, "Fraction")','numeric(fraction(2, 5), "number")'],seealso:["number","fraction","bignumber","string","format"]};var eP={name:"oct",category:"Utils",syntax:["oct(value)"],description:"Format a number as octal",examples:["oct(56)"],seealso:["bin","hex"]};var rP={name:"print",category:"Utils",syntax:["print(template, values)","print(template, values, precision)"],description:"Interpolate values into a string template.",examples:['print("Lucy is $age years old", {age: 5})','print("The value of pi is $pi", {pi: pi}, 3)','print("Hello, $user.name!", {user: {name: "John"}})','print("Values: $1, $2, $3", [6, 9, 4])'],seealso:["format"]};var tP={name:"typeOf",category:"Utils",syntax:["typeOf(x)"],description:"Get the type of a variable.",examples:["typeOf(3.5)","typeOf(2 - 4i)","typeOf(45 deg)",'typeOf("hello world")'],seealso:["getMatrixDataType"]};var nP={name:"solveODE",category:"Numeric",syntax:["solveODE(func, tspan, y0)","solveODE(func, tspan, y0, options)"],description:"Numerical Integration of Ordinary Differential Equations.",examples:["f(t,y) = y","tspan = [0, 4]","solveODE(f, tspan, 1)","solveODE(f, tspan, [1, 2])",'solveODE(f, tspan, 1, { method:"RK23", maxStep:0.1 })'],seealso:["derivative","simplifyCore"]};var aP={bignumber:ZF,boolean:QF,complex:XF,createUnit:KF,fraction:JF,index:jF,matrix:eO,number:rO,sparse:tO,splitUnit:nO,string:aO,unit:iO,e:BS,E:BS,false:BF,i:IF,Infinity:PF,LN2:kF,LN10:RF,LOG2E:qF,LOG10E:LF,NaN:UF,null:zF,pi:IS,PI:IS,phi:YF,SQRT1_2:WF,SQRT2:HF,tau:$F,true:GF,version:VF,speedOfLight:{description:"Speed of light in vacuum",examples:["speedOfLight"]},gravitationConstant:{description:"Newtonian constant of gravitation",examples:["gravitationConstant"]},planckConstant:{description:"Planck constant",examples:["planckConstant"]},reducedPlanckConstant:{description:"Reduced Planck constant",examples:["reducedPlanckConstant"]},magneticConstant:{description:"Magnetic constant (vacuum permeability)",examples:["magneticConstant"]},electricConstant:{description:"Electric constant (vacuum permeability)",examples:["electricConstant"]},vacuumImpedance:{description:"Characteristic impedance of vacuum",examples:["vacuumImpedance"]},coulomb:{description:"Coulomb's constant",examples:["coulomb"]},elementaryCharge:{description:"Elementary charge",examples:["elementaryCharge"]},bohrMagneton:{description:"Borh magneton",examples:["bohrMagneton"]},conductanceQuantum:{description:"Conductance quantum",examples:["conductanceQuantum"]},inverseConductanceQuantum:{description:"Inverse conductance quantum",examples:["inverseConductanceQuantum"]},magneticFluxQuantum:{description:"Magnetic flux quantum",examples:["magneticFluxQuantum"]},nuclearMagneton:{description:"Nuclear magneton",examples:["nuclearMagneton"]},klitzing:{description:"Von Klitzing constant",examples:["klitzing"]},bohrRadius:{description:"Borh radius",examples:["bohrRadius"]},classicalElectronRadius:{description:"Classical electron radius",examples:["classicalElectronRadius"]},electronMass:{description:"Electron mass",examples:["electronMass"]},fermiCoupling:{description:"Fermi coupling constant",examples:["fermiCoupling"]},fineStructure:{description:"Fine-structure constant",examples:["fineStructure"]},hartreeEnergy:{description:"Hartree energy",examples:["hartreeEnergy"]},protonMass:{description:"Proton mass",examples:["protonMass"]},deuteronMass:{description:"Deuteron Mass",examples:["deuteronMass"]},neutronMass:{description:"Neutron mass",examples:["neutronMass"]},quantumOfCirculation:{description:"Quantum of circulation",examples:["quantumOfCirculation"]},rydberg:{description:"Rydberg constant",examples:["rydberg"]},thomsonCrossSection:{description:"Thomson cross section",examples:["thomsonCrossSection"]},weakMixingAngle:{description:"Weak mixing angle",examples:["weakMixingAngle"]},efimovFactor:{description:"Efimov factor",examples:["efimovFactor"]},atomicMass:{description:"Atomic mass constant",examples:["atomicMass"]},avogadro:{description:"Avogadro's number",examples:["avogadro"]},boltzmann:{description:"Boltzmann constant",examples:["boltzmann"]},faraday:{description:"Faraday constant",examples:["faraday"]},firstRadiation:{description:"First radiation constant",examples:["firstRadiation"]},loschmidt:{description:"Loschmidt constant at T=273.15 K and p=101.325 kPa",examples:["loschmidt"]},gasConstant:{description:"Gas constant",examples:["gasConstant"]},molarPlanckConstant:{description:"Molar Planck constant",examples:["molarPlanckConstant"]},molarVolume:{description:"Molar volume of an ideal gas at T=273.15 K and p=101.325 kPa",examples:["molarVolume"]},sackurTetrode:{description:"Sackur-Tetrode constant at T=1 K and p=101.325 kPa",examples:["sackurTetrode"]},secondRadiation:{description:"Second radiation constant",examples:["secondRadiation"]},stefanBoltzmann:{description:"Stefan-Boltzmann constant",examples:["stefanBoltzmann"]},wienDisplacement:{description:"Wien displacement law constant",examples:["wienDisplacement"]},molarMass:{description:"Molar mass constant",examples:["molarMass"]},molarMassC12:{description:"Molar mass constant of carbon-12",examples:["molarMassC12"]},gravity:{description:"Standard acceleration of gravity (standard acceleration of free-fall on Earth)",examples:["gravity"]},planckLength:{description:"Planck length",examples:["planckLength"]},planckMass:{description:"Planck mass",examples:["planckMass"]},planckTime:{description:"Planck time",examples:["planckTime"]},planckCharge:{description:"Planck charge",examples:["planckCharge"]},planckTemperature:{description:"Planck temperature",examples:["planckTemperature"]},derivative:fO,lsolve:cO,lsolveAll:mO,lup:pO,lusolve:dO,leafCount:lO,polynomialRoot:hO,resolve:yO,simplify:xO,simplifyConstant:bO,simplifyCore:wO,symbolicEqual:SO,rationalize:gO,slu:DO,usolve:NO,usolveAll:AO,qr:vO,abs:MO,add:EO,cbrt:CO,ceil:TO,cube:_O,divide:FO,dotDivide:OO,dotMultiply:BO,dotPow:IO,exp:PO,expm:RO,expm1:kO,fix:LO,floor:qO,gcd:UO,hypot:zO,lcm:WO,log:HO,log2:VO,log1p:GO,log10:$O,mod:ZO,multiply:QO,norm:XO,nthRoot:KO,nthRoots:JO,pow:jO,round:e3,sign:r3,sqrt:t3,sqrtm:n3,square:s3,subtract:u3,unaryMinus:f3,unaryPlus:l3,xgcd:c3,invmod:YO,bitAnd:m3,bitNot:p3,bitOr:d3,bitXor:h3,leftShift:v3,rightArithShift:g3,rightLogShift:y3,bellNumbers:x3,catalan:b3,composition:w3,stirlingS2:D3,config:oO,import:sO,typed:uO,arg:S3,conj:N3,re:M3,im:A3,evaluate:E3,help:C3,distance:T3,intersect:_3,and:F3,not:O3,or:B3,xor:I3,concat:R3,count:k3,cross:L3,column:P3,ctranspose:q3,det:U3,diag:z3,diff:Y3,dot:W3,getMatrixDataType:Z3,identity:Q3,filter:$3,flatten:G3,forEach:V3,inv:X3,pinv:K3,eigs:H3,kron:J3,matrixFromFunction:rB,matrixFromRows:tB,matrixFromColumns:eB,map:j3,ones:nB,partitionSelect:aB,range:iB,resize:sB,reshape:oB,rotate:uB,rotationMatrix:fB,row:lB,size:cB,sort:mB,squeeze:pB,subset:dB,trace:hB,transpose:vB,zeros:gB,fft:yB,ifft:xB,sylvester:a3,schur:i3,lyap:o3,solveODE:nP,combinations:bB,combinationsWithRep:wB,factorial:DB,gamma:SB,kldivergence:AB,lgamma:NB,multinomial:MB,permutations:EB,pickRandom:CB,random:TB,randomInt:_B,compare:FB,compareNatural:OB,compareText:BB,deepEqual:IB,equal:PB,equalText:RB,larger:kB,largerEq:LB,smaller:qB,smallerEq:UB,unequal:zB,setCartesian:YB,setDifference:WB,setDistinct:HB,setIntersect:$B,setIsSubset:GB,setMultiplicity:VB,setPowerset:ZB,setSize:QB,setSymDifference:XB,setUnion:KB,zpk2tf:JB,freqz:jB,erf:eI,zeta:rI,cumsum:cI,mad:tI,max:nI,mean:aI,median:iI,min:oI,mode:sI,prod:uI,quantileSeq:fI,std:lI,sum:mI,variance:pI,corr:dI,acos:hI,acosh:vI,acot:gI,acoth:yI,acsc:xI,acsch:bI,asec:wI,asech:DI,asin:SI,asinh:NI,atan:AI,atanh:EI,atan2:MI,cos:CI,cosh:TI,cot:_I,coth:FI,csc:OI,csch:BI,sec:II,sech:PI,sin:RI,sinh:kI,tan:LI,tanh:qI,to:UI,clone:YI,format:WI,bin:zI,oct:eP,hex:$I,isNaN:VI,isInteger:GI,isNegative:ZI,isNumeric:QI,hasNumericValue:HI,isPositive:XI,isPrime:KI,isZero:JI,print:rP,typeOf:tP,numeric:jI};var iP="help",jZ=["typed","mathWithTransform","Help"],vy=F(iP,jZ,e=>{var{typed:r,mathWithTransform:t,Help:n}=e;return r(iP,{any:function(i){var s,c=i;if(typeof i!="string"){for(s in t)if(Xe(t,s)&&i===t[s]){c=s;break}}var f=Mt(aP,c);if(!f){var o=typeof c=="function"?c.name:c;throw new Error('No documentation found on "'+o+'"')}return new n(f)}})});var oP="chain",eQ=["typed","Chain"],gy=F(oP,eQ,e=>{var{typed:r,Chain:t}=e;return r(oP,{"":function(){return new t},any:function(a){return new t(a)}})});var sP="det",rQ=["typed","matrix","subtractScalar","multiply","divideScalar","isZero","unaryMinus"],yy=F(sP,rQ,e=>{var{typed:r,matrix:t,subtractScalar:n,multiply:a,divideScalar:i,isZero:s,unaryMinus:c}=e;return r(sP,{any:function(u){return ir(u)},"Array | Matrix":function(u){var m;switch(Qe(u)?m=u.size():Array.isArray(u)?(u=t(u),m=u.size()):m=[],m.length){case 0:return ir(u);case 1:if(m[0]===1)return ir(u.valueOf()[0]);if(m[0]===0)return 1;throw new RangeError("Matrix must be square (size: "+mr(m)+")");case 2:{var p=m[0],h=m[1];if(p===h)return f(u.clone().valueOf(),p,h);if(h===0)return 1;throw new RangeError("Matrix must be square (size: "+mr(m)+")")}default:throw new RangeError("Matrix must be two dimensional (size: "+mr(m)+")")}}});function f(o,u,m){if(u===1)return ir(o[0][0]);if(u===2)return n(a(o[0][0],o[1][1]),a(o[1][0],o[0][1]));for(var p=!1,h=new Array(u).fill(0).map((O,_)=>_),y=0;y{var{typed:r,matrix:t,divideScalar:n,addScalar:a,multiply:i,unaryMinus:s,det:c,identity:f,abs:o}=e;return r(uP,{"Array | Matrix":function(p){var h=Qe(p)?p.size():fr(p);switch(h.length){case 1:if(h[0]===1)return Qe(p)?t([n(1,p.valueOf()[0])]):[n(1,p[0])];throw new RangeError("Matrix must be square (size: "+mr(h)+")");case 2:{var y=h[0],v=h[1];if(y===v)return Qe(p)?t(u(p.valueOf(),y,v),p.storage()):u(p,y,v);throw new RangeError("Matrix must be square (size: "+mr(h)+")")}default:throw new RangeError("Matrix must be two dimensional (size: "+mr(h)+")")}},any:function(p){return n(1,p)}});function u(m,p,h){var y,v,x,b,E;if(p===1){if(b=m[0][0],b===0)throw Error("Cannot calculate inverse, determinant is zero");return[[n(1,b)]]}else if(p===2){var w=c(m);if(w===0)throw Error("Cannot calculate inverse, determinant is zero");return[[n(m[1][1],w),n(s(m[0][1]),w)],[n(s(m[1][0]),w),n(m[0][0],w)]]}else{var N=m.concat();for(y=0;yO&&(O=o(N[y][D]),_=y),y++;if(O===0)throw Error("Cannot calculate inverse, determinant is zero");y=_,y!==D&&(E=N[D],N[D]=N[y],N[y]=E,E=M[D],M[D]=M[y],M[y]=E);var C=N[D],T=M[D];for(y=0;y{var{typed:r,matrix:t,inv:n,deepEqual:a,equal:i,dotDivide:s,dot:c,ctranspose:f,divideScalar:o,multiply:u,add:m,Complex:p}=e;return r(fP,{"Array | Matrix":function(w){var N=Qe(w)?w.size():fr(w);switch(N.length){case 1:return b(w)?f(w):N[0]===1?n(w):s(f(w),c(w,w));case 2:{if(b(w))return f(w);var M=N[0],D=N[1];if(M===D)try{return n(w)}catch(O){if(!(O instanceof Error&&O.message.match(/Cannot calculate inverse, determinant is zero/)))throw O}return Qe(w)?t(h(w.valueOf(),M,D),w.storage()):h(w,M,D)}default:throw new RangeError("Matrix must be two dimensional (size: "+mr(N)+")")}},any:function(w){return i(w,0)?ir(w):o(1,w)}});function h(E,w,N){var{C:M,F:D}=v(E,w,N),O=u(n(u(f(M),M)),f(M)),_=u(f(D),n(u(D,f(D))));return u(_,O)}function y(E,w,N){for(var M=ir(E),D=0,O=0;O_.filter((T,k)=>k!x(c(M[C],M[C])));return{C:D,F:O}}function x(E){return i(m(E,p(1,1)),m(0,p(1,1)))}function b(E){return a(m(E,p(1,1)),m(u(E,0),p(1,1)))}});function lP(e){var{addScalar:r,subtract:t,flatten:n,multiply:a,multiplyScalar:i,divideScalar:s,sqrt:c,abs:f,bignumber:o,diag:u,size:m,reshape:p,inv:h,qr:y,usolve:v,usolveAll:x,equal:b,complex:E,larger:w,smaller:N,matrixFromColumns:M,dot:D}=e;function O(ae,$,ce,Ce){var pe=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,ge=_(ae,$,ce,Ce,pe);C(ae,$,ce,Ce,pe,ge);var{values:Se,C:ye}=T(ae,$,ce,Ce,pe);if(pe){var be=k(ae,$,ye,ge,Se,ce,Ce);return{values:Se,eigenvectors:be}}return{values:Se}}function _(ae,$,ce,Ce,pe){var ge=Ce==="BigNumber",Se=Ce==="Complex",ye=ge?o(0):0,be=ge?o(1):Se?E(1):1,De=ge?o(1):1,Ae=ge?o(10):2,Ye=i(Ae,Ae),Ke;pe&&(Ke=Array($).fill(be));for(var J=!1;!J;){J=!0;for(var re=0;re<$;re++){for(var xe=ye,j=ye,ne=0;ne<$;ne++)re!==ne&&(xe=r(xe,f(ae[ne][re])),j=r(j,f(ae[re][ne])));if(!b(xe,0)&&!b(j,0)){for(var ue=De,Me=xe,Ee=s(j,Ae),qe=i(j,Ae);N(Me,Ee);)Me=i(Me,Ye),ue=i(ue,Ae);for(;w(Me,qe);)Me=s(Me,Ye),ue=s(ue,Ae);var Pe=N(s(r(Me,j),ue),i(r(xe,j),.95));if(Pe){J=!1;for(var lr=s(1,ue),sr=0;sr<$;sr++)re!==sr&&(ae[re][sr]=i(ae[re][sr],lr),ae[sr][re]=i(ae[sr][re],ue));pe&&(Ke[re]=i(Ke[re],lr))}}}}return pe?u(Ke):null}function C(ae,$,ce,Ce,pe,ge){var Se=Ce==="BigNumber",ye=Ce==="Complex",be=Se?o(0):ye?E(0):0;Se&&(ce=o(ce));for(var De=0;De<$-2;De++){for(var Ae=0,Ye=be,Ke=De+1;Ke<$;Ke++){var J=ae[Ke][De];N(f(Ye),f(J))&&(Ye=J,Ae=Ke)}if(!N(f(Ye),ce)){if(Ae!==De+1){var re=ae[Ae];ae[Ae]=ae[De+1],ae[De+1]=re;for(var xe=0;xe<$;xe++){var j=ae[xe][Ae];ae[xe][Ae]=ae[xe][De+1],ae[xe][De+1]=j}if(pe){var ne=ge[Ae];ge[Ae]=ge[De+1],ge[De+1]=ne}}for(var ue=De+2;ue<$;ue++){var Me=s(ae[ue][De],Ye);if(Me!==0){for(var Ee=0;Ee<$;Ee++)ae[ue][Ee]=t(ae[ue][Ee],i(Me,ae[De+1][Ee]));for(var qe=0;qe<$;qe++)ae[qe][De+1]=r(ae[qe][De+1],i(Me,ae[qe][ue]));if(pe)for(var Pe=0;Pe<$;Pe++)ge[ue][Pe]=t(ge[ue][Pe],i(Me,ge[De+1][Pe]))}}}}return ge}function T(ae,$,ce,Ce,pe){var ge=Ce==="BigNumber",Se=Ce==="Complex",ye=ge?o(1):Se?E(1):1;ge&&(ce=o(ce));for(var be=ir(ae),De=[],Ae=$,Ye=[],Ke=pe?u(Array($).fill(ye)):void 0,J=pe?u(Array(Ae).fill(ye)):void 0,re=0;re<=100;){re+=1;for(var xe=be[Ae-1][Ae-1],j=0;j1&&(J=u(Array(Ae-1).fill(ye)))),Ae-=1,be.pop();for(var Ee=0;Ee2&&(J=u(Array(Ae-2).fill(ye)))),Ae-=2,be.pop(),be.pop();for(var Pe=0;Pe+t(f(Je),f(Pr))),re>100){var lr=Error("The eigenvalues failed to converge. Only found these eigenvalues: "+De.join(", "));throw lr.values=De,lr.vectors=[],lr}var sr=pe?a(Ke,W(Ye,$)):void 0;return{values:De,C:sr}}function k(ae,$,ce,Ce,pe,ge,Se){var ye=h(ce),be=a(ye,ae,ce),De=Se==="BigNumber",Ae=Se==="Complex",Ye=De?o(0):Ae?E(0):0,Ke=De?o(1):Ae?E(1):1,J=[],re=[];for(var xe of pe){var j=q(J,xe,b);j===-1?(J.push(xe),re.push(1)):re[j]+=1}for(var ne=[],ue=J.length,Me=Array($).fill(Ye),Ee=u(Array($).fill(Ke)),qe=function(){var sr=J[Pe],Je=t(be,a(sr,Ee)),Pr=x(Je,Me);for(Pr.shift();Pr.lengtha(le,we)),ne.push(...Pr.map(we=>({value:sr,vector:n(we)})))},Pe=0;Pe=5)return null;for(ye=0;;){var be=v(ae,Se);if(N(oe(U(Se,[be])),Ce))break;if(++ye>=10)return null;Se=me(be)}return Se}function X(ae,$,ce){var Ce=ce==="BigNumber",pe=ce==="Complex",ge=Array(ae).fill(0).map(Se=>2*Math.random()-1);return Ce&&(ge=ge.map(Se=>o(Se))),pe&&(ge=ge.map(Se=>E(Se))),ge=U(ge,$),me(ge,ce)}function U(ae,$){var ce=m(ae);for(var Ce of $)Ce=p(Ce,ce),ae=t(ae,a(s(D(Ce,ae),D(Ce,Ce)),Ce));return ae}function oe(ae){return f(c(D(ae,ae)))}function me(ae,$){var ce=$==="BigNumber",Ce=$==="Complex",pe=ce?o(1):Ce?E(1):1;return a(s(pe,oe(ae)),ae)}return O}function cP(e){var{config:r,addScalar:t,subtract:n,abs:a,atan:i,cos:s,sin:c,multiplyScalar:f,inv:o,bignumber:u,multiply:m,add:p}=e;function h(C,T){var k=arguments.length>2&&arguments[2]!==void 0?arguments[2]:r.epsilon,L=arguments.length>3?arguments[3]:void 0,H=arguments.length>4?arguments[4]:void 0;if(L==="number")return y(C,k,H);if(L==="BigNumber")return v(C,k,H);throw TypeError("Unsupported data type: "+L)}function y(C,T,k){var L=C.length,H=Math.abs(T/L),V,W;if(k){W=new Array(L);for(var q=0;q=Math.abs(H);){var X=R[0][0],U=R[0][1];V=x(C[X][X],C[U][U],C[X][U]),C=M(C,V,X,U),k&&(W=E(W,V,X,U)),R=D(C)}for(var oe=Array(L).fill(0),me=0;me=a(H);){var X=R[0][0],U=R[0][1];V=b(C[X][X],C[U][U],C[X][U]),C=N(C,V,X,U),k&&(W=w(W,V,X,U)),R=O(C)}for(var oe=Array(L).fill(0),me=0;me({value:H[$],vector:ae}));return{values:H,eigenvectors:me}}return h}var aQ="eigs",iQ=["config","typed","matrix","addScalar","equal","subtract","abs","atan","cos","sin","multiplyScalar","divideScalar","inv","bignumber","multiply","add","larger","column","flatten","number","complex","sqrt","diag","size","reshape","qr","usolve","usolveAll","im","re","smaller","matrixFromColumns","dot"],wy=F(aQ,iQ,e=>{var{config:r,typed:t,matrix:n,addScalar:a,subtract:i,equal:s,abs:c,atan:f,cos:o,sin:u,multiplyScalar:m,divideScalar:p,inv:h,bignumber:y,multiply:v,add:x,larger:b,column:E,flatten:w,number:N,complex:M,sqrt:D,diag:O,size:_,reshape:C,qr:T,usolve:k,usolveAll:L,im:H,re:V,smaller:W,matrixFromColumns:q,dot:R}=e,X=cP({config:r,addScalar:a,subtract:i,column:E,flatten:w,equal:s,abs:c,atan:f,cos:o,sin:u,multiplyScalar:m,inv:h,bignumber:y,complex:M,multiply:v,add:x}),U=lP({config:r,addScalar:a,subtract:i,multiply:v,multiplyScalar:m,flatten:w,divideScalar:p,sqrt:D,abs:c,bignumber:y,diag:O,size:_,reshape:C,qr:T,inv:h,usolve:k,usolveAll:L,equal:s,complex:M,larger:b,smaller:W,matrixFromColumns:q,dot:R});return t("eigs",{Array:function(ge){return oe(n(ge))},"Array, number|BigNumber":function(ge,Se){return oe(n(ge),{precision:Se})},"Array, Object"(pe,ge){return oe(n(pe),ge)},Matrix:function(ge){return oe(ge,{matricize:!0})},"Matrix, number|BigNumber":function(ge,Se){return oe(ge,{precision:Se,matricize:!0})},"Matrix, Object":function(ge,Se){var ye={matricize:!0};return bt(ye,Se),oe(ge,ye)}});function oe(pe){var ge,Se=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},ye="eigenvectors"in Se?Se.eigenvectors:!0,be=(ge=Se.precision)!==null&&ge!==void 0?ge:r.epsilon,De=me(pe,be,ye);return Se.matricize&&(De.values=n(De.values),ye&&(De.eigenvectors=De.eigenvectors.map(Ae=>{var{value:Ye,vector:Ke}=Ae;return{value:Ye,vector:n(Ke)}}))),ye&&Object.defineProperty(De,"vectors",{enumerable:!1,get:()=>{throw new Error("eigs(M).vectors replaced with eigs(M).eigenvectors")}}),De}function me(pe,ge,Se){var ye=pe.toArray(),be=pe.size();if(be.length!==2||be[0]!==be[1])throw new RangeError("Matrix must be square (size: ".concat(mr(be),")"));var De=be[0];if($(ye,De,ge)&&(ce(ye,De),ae(ye,De,ge))){var Ae=Ce(pe,ye,De);return X(ye,De,ge,Ae,Se)}var Ye=Ce(pe,ye,De);return U(ye,De,ge,Ye,Se)}function ae(pe,ge,Se){for(var ye=0;ye{var{typed:r,abs:t,add:n,identity:a,inv:i,multiply:s}=e;return r(mP,{Matrix:function(m){var p=m.size();if(p.length!==2||p[0]!==p[1])throw new RangeError("Matrix must be square (size: "+mr(p)+")");for(var h=p[0],y=1e-15,v=c(m),x=f(v,y),b=x.q,E=x.j,w=s(m,Math.pow(2,-E)),N=a(h),M=a(h),D=1,O=w,_=-1,C=1;C<=b;C++)C>1&&(O=s(O,w),_=-_),D=D*(b-C+1)/((2*b-C+1)*C),N=n(N,s(D,O)),M=n(M,s(D*_,O));for(var T=s(i(M),N),k=0;k{var{typed:r,abs:t,add:n,multiply:a,map:i,sqrt:s,subtract:c,inv:f,size:o,max:u,identity:m}=e,p=1e3,h=1e-6;function y(v){var x,b=0,E=v,w=m(o(v));do{var N=E;if(E=a(.5,n(N,f(w))),w=a(.5,n(w,f(N))),x=u(t(c(E,N))),x>h&&++b>p)throw new Error("computing square root of matrix: iterative method could not converge")}while(x>h);return E}return r(pP,{"Array | Matrix":function(x){var b=Qe(x)?x.size():fr(x);switch(b.length){case 1:if(b[0]===1)return i(x,s);throw new RangeError("Matrix must be square (size: "+mr(b)+")");case 2:{var E=b[0],w=b[1];if(E===w)return y(x);throw new RangeError("Matrix must be square (size: "+mr(b)+")")}default:throw new RangeError("Matrix must be at most two dimensional (size: "+mr(b)+")")}}})});var dP="sylvester",uQ=["typed","schur","matrixFromColumns","matrix","multiply","range","concat","transpose","index","subset","add","subtract","identity","lusolve","abs"],Ny=F(dP,uQ,e=>{var{typed:r,schur:t,matrixFromColumns:n,matrix:a,multiply:i,range:s,concat:c,transpose:f,index:o,subset:u,add:m,subtract:p,identity:h,lusolve:y,abs:v}=e;return r(dP,{"Matrix, Matrix, Matrix":x,"Array, Matrix, Matrix":function(E,w,N){return x(a(E),w,N)},"Array, Array, Matrix":function(E,w,N){return x(a(E),a(w),N)},"Array, Matrix, Array":function(E,w,N){return x(a(E),w,a(N))},"Matrix, Array, Matrix":function(E,w,N){return x(E,a(w),N)},"Matrix, Array, Array":function(E,w,N){return x(E,a(w),a(N))},"Matrix, Matrix, Array":function(E,w,N){return x(E,w,a(N))},"Array, Array, Array":function(E,w,N){return x(a(E),a(w),a(N)).toArray()}});function x(b,E,w){for(var N=E.size()[0],M=b.size()[0],D=t(b),O=D.T,_=D.U,C=t(i(-1,E)),T=C.T,k=C.U,L=i(i(f(_),w),k),H=s(0,M),V=[],W=(Ae,Ye)=>c(Ae,Ye,1),q=(Ae,Ye)=>c(Ae,Ye,0),R=0;R1e-5){for(var X=q(u(L,o(H,R)),u(L,o(H,R+1))),U=0;U{var{typed:r,matrix:t,identity:n,multiply:a,qr:i,norm:s,subtract:c}=e;return r(hP,{Array:function(u){var m=f(t(u));return{U:m.U.valueOf(),T:m.T.valueOf()}},Matrix:function(u){return f(u)}});function f(o){var u=o.size()[0],m=o,p=n(u),h=0,y;do{y=m;var v=i(m),x=v.Q,b=v.R;if(m=a(b,x),p=a(p,x),h++>100)break}while(s(c(m,y))>1e-4);return{U:p,T:m}}});var vP="lyap",lQ=["typed","matrix","sylvester","multiply","transpose"],My=F(vP,lQ,e=>{var{typed:r,matrix:t,sylvester:n,multiply:a,transpose:i}=e;return r(vP,{"Matrix, Matrix":function(c,f){return n(c,i(c),a(-1,f))},"Array, Matrix":function(c,f){return n(t(c),i(t(c)),a(-1,f))},"Matrix, Array":function(c,f){return n(c,i(t(c)),t(a(-1,f)))},"Array, Array":function(c,f){return n(t(c),i(t(c)),t(a(-1,f))).toArray()}})});var cQ="divide",mQ=["typed","matrix","multiply","equalScalar","divideScalar","inv"],Ey=F(cQ,mQ,e=>{var{typed:r,matrix:t,multiply:n,equalScalar:a,divideScalar:i,inv:s}=e,c=at({typed:r,equalScalar:a}),f=Ht({typed:r});return r("divide",Sp({"Array | Matrix, Array | Matrix":function(u,m){return n(u,s(m))},"DenseMatrix, any":function(u,m){return f(u,m,i,!1)},"SparseMatrix, any":function(u,m){return c(u,m,i,!1)},"Array, any":function(u,m){return f(t(u),m,i,!1).valueOf()},"any, Array | Matrix":function(u,m){return n(u,s(m))}},i.signatures))});var gP="distance",pQ=["typed","addScalar","subtractScalar","divideScalar","multiplyScalar","deepEqual","sqrt","abs"],Cy=F(gP,pQ,e=>{var{typed:r,addScalar:t,subtractScalar:n,multiplyScalar:a,divideScalar:i,deepEqual:s,sqrt:c,abs:f}=e;return r(gP,{"Array, Array, Array":function(M,D,O){if(M.length===2&&D.length===2&&O.length===2){if(!u(M))throw new TypeError("Array with 2 numbers or BigNumbers expected for first argument");if(!u(D))throw new TypeError("Array with 2 numbers or BigNumbers expected for second argument");if(!u(O))throw new TypeError("Array with 2 numbers or BigNumbers expected for third argument");if(s(D,O))throw new TypeError("LinePoint1 should not be same with LinePoint2");var _=n(O[1],D[1]),C=n(D[0],O[0]),T=n(a(O[0],D[1]),a(D[0],O[1]));return x(M[0],M[1],_,C,T)}else throw new TypeError("Invalid Arguments: Try again")},"Object, Object, Object":function(M,D,O){if(Object.keys(M).length===2&&Object.keys(D).length===2&&Object.keys(O).length===2){if(!u(M))throw new TypeError("Values of pointX and pointY should be numbers or BigNumbers");if(!u(D))throw new TypeError("Values of lineOnePtX and lineOnePtY should be numbers or BigNumbers");if(!u(O))throw new TypeError("Values of lineTwoPtX and lineTwoPtY should be numbers or BigNumbers");if(s(y(D),y(O)))throw new TypeError("LinePoint1 should not be same with LinePoint2");if("pointX"in M&&"pointY"in M&&"lineOnePtX"in D&&"lineOnePtY"in D&&"lineTwoPtX"in O&&"lineTwoPtY"in O){var _=n(O.lineTwoPtY,D.lineOnePtY),C=n(D.lineOnePtX,O.lineTwoPtX),T=n(a(O.lineTwoPtX,D.lineOnePtY),a(D.lineOnePtX,O.lineTwoPtY));return x(M.pointX,M.pointY,_,C,T)}else throw new TypeError("Key names do not match")}else throw new TypeError("Invalid Arguments: Try again")},"Array, Array":function(M,D){if(M.length===2&&D.length===3){if(!u(M))throw new TypeError("Array with 2 numbers or BigNumbers expected for first argument");if(!m(D))throw new TypeError("Array with 3 numbers or BigNumbers expected for second argument");return x(M[0],M[1],D[0],D[1],D[2])}else if(M.length===3&&D.length===6){if(!m(M))throw new TypeError("Array with 3 numbers or BigNumbers expected for first argument");if(!h(D))throw new TypeError("Array with 6 numbers or BigNumbers expected for second argument");return b(M[0],M[1],M[2],D[0],D[1],D[2],D[3],D[4],D[5])}else if(M.length===D.length&&M.length>0){if(!p(M))throw new TypeError("All values of an array should be numbers or BigNumbers");if(!p(D))throw new TypeError("All values of an array should be numbers or BigNumbers");return E(M,D)}else throw new TypeError("Invalid Arguments: Try again")},"Object, Object":function(M,D){if(Object.keys(M).length===2&&Object.keys(D).length===3){if(!u(M))throw new TypeError("Values of pointX and pointY should be numbers or BigNumbers");if(!m(D))throw new TypeError("Values of xCoeffLine, yCoeffLine and constant should be numbers or BigNumbers");if("pointX"in M&&"pointY"in M&&"xCoeffLine"in D&&"yCoeffLine"in D&&"constant"in D)return x(M.pointX,M.pointY,D.xCoeffLine,D.yCoeffLine,D.constant);throw new TypeError("Key names do not match")}else if(Object.keys(M).length===3&&Object.keys(D).length===6){if(!m(M))throw new TypeError("Values of pointX, pointY and pointZ should be numbers or BigNumbers");if(!h(D))throw new TypeError("Values of x0, y0, z0, a, b and c should be numbers or BigNumbers");if("pointX"in M&&"pointY"in M&&"x0"in D&&"y0"in D&&"z0"in D&&"a"in D&&"b"in D&&"c"in D)return b(M.pointX,M.pointY,M.pointZ,D.x0,D.y0,D.z0,D.a,D.b,D.c);throw new TypeError("Key names do not match")}else if(Object.keys(M).length===2&&Object.keys(D).length===2){if(!u(M))throw new TypeError("Values of pointOneX and pointOneY should be numbers or BigNumbers");if(!u(D))throw new TypeError("Values of pointTwoX and pointTwoY should be numbers or BigNumbers");if("pointOneX"in M&&"pointOneY"in M&&"pointTwoX"in D&&"pointTwoY"in D)return E([M.pointOneX,M.pointOneY],[D.pointTwoX,D.pointTwoY]);throw new TypeError("Key names do not match")}else if(Object.keys(M).length===3&&Object.keys(D).length===3){if(!m(M))throw new TypeError("Values of pointOneX, pointOneY and pointOneZ should be numbers or BigNumbers");if(!m(D))throw new TypeError("Values of pointTwoX, pointTwoY and pointTwoZ should be numbers or BigNumbers");if("pointOneX"in M&&"pointOneY"in M&&"pointOneZ"in M&&"pointTwoX"in D&&"pointTwoY"in D&&"pointTwoZ"in D)return E([M.pointOneX,M.pointOneY,M.pointOneZ],[D.pointTwoX,D.pointTwoY,D.pointTwoZ]);throw new TypeError("Key names do not match")}else throw new TypeError("Invalid Arguments: Try again")},Array:function(M){if(!v(M))throw new TypeError("Incorrect array format entered for pairwise distance calculation");return w(M)}});function o(N){return typeof N=="number"||tr(N)}function u(N){return N.constructor!==Array&&(N=y(N)),o(N[0])&&o(N[1])}function m(N){return N.constructor!==Array&&(N=y(N)),o(N[0])&&o(N[1])&&o(N[2])}function p(N){return Array.isArray(N)||(N=y(N)),N.every(o)}function h(N){return N.constructor!==Array&&(N=y(N)),o(N[0])&&o(N[1])&&o(N[2])&&o(N[3])&&o(N[4])&&o(N[5])}function y(N){for(var M=Object.keys(N),D=[],O=0;OM.length!==2||!o(M[0])||!o(M[1])))return!1}else if(N[0].length===3&&o(N[0][0])&&o(N[0][1])&&o(N[0][2])){if(N.some(M=>M.length!==3||!o(M[0])||!o(M[1])||!o(M[2])))return!1}else return!1;return!0}function x(N,M,D,O,_){var C=f(t(t(a(D,N),a(O,M)),_)),T=c(t(a(D,D),a(O,O)));return i(C,T)}function b(N,M,D,O,_,C,T,k,L){var H=[n(a(n(_,M),L),a(n(C,D),k)),n(a(n(C,D),T),a(n(O,N),L)),n(a(n(O,N),k),a(n(_,M),T))];H=c(t(t(a(H[0],H[0]),a(H[1],H[1])),a(H[2],H[2])));var V=c(t(t(a(T,T),a(k,k)),a(L,L)));return i(H,V)}function E(N,M){for(var D=N.length,O=0,_=0,C=0;C{var{typed:r,config:t,abs:n,add:a,addScalar:i,matrix:s,multiply:c,multiplyScalar:f,divideScalar:o,subtract:u,smaller:m,equalScalar:p,flatten:h,isZero:y,isNumeric:v}=e;return r("intersect",{"Array, Array, Array":x,"Array, Array, Array, Array":b,"Matrix, Matrix, Matrix":function(k,L,H){var V=x(k.valueOf(),L.valueOf(),H.valueOf());return V===null?null:s(V)},"Matrix, Matrix, Matrix, Matrix":function(k,L,H,V){var W=b(k.valueOf(),L.valueOf(),H.valueOf(),V.valueOf());return W===null?null:s(W)}});function x(T,k,L){if(T=E(T),k=E(k),L=E(L),!N(T))throw new TypeError("Array with 3 numbers or BigNumbers expected for first argument");if(!N(k))throw new TypeError("Array with 3 numbers or BigNumbers expected for second argument");if(!M(L))throw new TypeError("Array with 4 numbers expected as third argument");return C(T[0],T[1],T[2],k[0],k[1],k[2],L[0],L[1],L[2],L[3])}function b(T,k,L,H){if(T=E(T),k=E(k),L=E(L),H=E(H),T.length===2){if(!w(T))throw new TypeError("Array with 2 numbers or BigNumbers expected for first argument");if(!w(k))throw new TypeError("Array with 2 numbers or BigNumbers expected for second argument");if(!w(L))throw new TypeError("Array with 2 numbers or BigNumbers expected for third argument");if(!w(H))throw new TypeError("Array with 2 numbers or BigNumbers expected for fourth argument");return D(T,k,L,H)}else if(T.length===3){if(!N(T))throw new TypeError("Array with 3 numbers or BigNumbers expected for first argument");if(!N(k))throw new TypeError("Array with 3 numbers or BigNumbers expected for second argument");if(!N(L))throw new TypeError("Array with 3 numbers or BigNumbers expected for third argument");if(!N(H))throw new TypeError("Array with 3 numbers or BigNumbers expected for fourth argument");return _(T[0],T[1],T[2],k[0],k[1],k[2],L[0],L[1],L[2],H[0],H[1],H[2])}else throw new TypeError("Arrays with two or thee dimensional points expected")}function E(T){return T.length===1?T[0]:T.length>1&&Array.isArray(T[0])&&T.every(k=>Array.isArray(k)&&k.length===1)?h(T):T}function w(T){return T.length===2&&v(T[0])&&v(T[1])}function N(T){return T.length===3&&v(T[0])&&v(T[1])&&v(T[2])}function M(T){return T.length===4&&v(T[0])&&v(T[1])&&v(T[2])&&v(T[3])}function D(T,k,L,H){var V=T,W=L,q=u(V,k),R=u(W,H),X=u(f(q[0],R[1]),f(R[0],q[1]));if(y(X)||m(n(X),t.epsilon))return null;var U=f(R[0],V[1]),oe=f(R[1],V[0]),me=f(R[0],W[1]),ae=f(R[1],W[0]),$=o(i(u(u(U,oe),me),ae),X);return a(c(q,$),V)}function O(T,k,L,H,V,W,q,R,X,U,oe,me){var ae=f(u(T,k),u(L,H)),$=f(u(V,W),u(q,R)),ce=f(u(X,U),u(oe,me));return i(i(ae,$),ce)}function _(T,k,L,H,V,W,q,R,X,U,oe,me){var ae=O(T,q,U,q,k,R,oe,R,L,X,me,X),$=O(U,q,H,T,oe,R,V,k,me,X,W,L),ce=O(T,q,H,T,k,R,V,k,L,X,W,L),Ce=O(U,q,U,q,oe,R,oe,R,me,X,me,X),pe=O(H,T,H,T,V,k,V,k,W,L,W,L),ge=u(f(ae,$),f(ce,Ce)),Se=u(f(pe,Ce),f($,$));if(y(Se))return null;var ye=o(ge,Se),be=o(i(ae,f(ye,$)),Ce),De=i(T,f(ye,u(H,T))),Ae=i(k,f(ye,u(V,k))),Ye=i(L,f(ye,u(W,L))),Ke=i(q,f(be,u(U,q))),J=i(R,f(be,u(oe,R))),re=i(X,f(be,u(me,X)));return p(De,Ke)&&p(Ae,J)&&p(Ye,re)?[De,Ae,Ye]:null}function C(T,k,L,H,V,W,q,R,X,U){var oe=f(T,q),me=f(H,q),ae=f(k,R),$=f(V,R),ce=f(L,X),Ce=f(W,X),pe=u(u(u(U,oe),ae),ce),ge=u(u(u(i(i(me,$),Ce),oe),ae),ce),Se=o(pe,ge),ye=i(T,f(Se,u(H,T))),be=i(k,f(Se,u(V,k))),De=i(L,f(Se,u(W,L)));return[ye,be,De]}});var yP="sum",vQ=["typed","config","add","numeric"],Yf=F(yP,vQ,e=>{var{typed:r,config:t,add:n,numeric:a}=e;return r(yP,{"Array | Matrix":i,"Array | Matrix, number | BigNumber":s,"...":function(f){if(Ja(f))throw new TypeError("Scalar values expected in function sum");return i(f)}});function i(c){var f;return qn(c,function(o){try{f=f===void 0?o:n(f,o)}catch(u){throw It(u,"sum",o)}}),f===void 0&&(f=a(0,t.number)),typeof f=="string"&&(f=a(f,t.number)),f}function s(c,f){try{var o=fs(c,f,n);return o}catch(u){throw It(u,"sum")}}});var _y="cumsum",gQ=["typed","add","unaryPlus"],Wf=F(_y,gQ,e=>{var{typed:r,add:t,unaryPlus:n}=e;return r(_y,{Array:a,Matrix:function(o){return o.create(a(o.valueOf()))},"Array, number | BigNumber":s,"Matrix, number | BigNumber":function(o,u){return o.create(s(o.valueOf(),u))},"...":function(o){if(Ja(o))throw new TypeError("All values expected to be scalar in function cumsum");return a(o)}});function a(f){try{return i(f)}catch(o){throw It(o,_y)}}function i(f){if(f.length===0)return[];for(var o=[n(f[0])],u=1;u=u.length)throw new cn(o,u.length);try{return c(f,o)}catch(m){throw It(m,_y)}}function c(f,o){var u,m,p;if(o<=0){var h=f[0][0];if(Array.isArray(h)){for(p=jp(f),m=[],u=0;u{var{typed:r,add:t,divide:n}=e;return r(xP,{"Array | Matrix":i,"Array | Matrix, number | BigNumber":a,"...":function(c){if(Ja(c))throw new TypeError("Scalar values expected in function mean");return i(c)}});function a(s,c){try{var f=fs(s,c,t),o=Array.isArray(s)?fr(s):s.size();return n(f,o[c])}catch(u){throw It(u,"mean")}}function i(s){var c,f=0;if(qn(s,function(o){try{c=c===void 0?o:t(c,o),f++}catch(u){throw It(u,"mean",o)}}),f===0)throw new Error("Cannot calculate the mean of an empty array");return n(c,f)}});var bP="median",xQ=["typed","add","divide","compare","partitionSelect"],Fy=F(bP,xQ,e=>{var{typed:r,add:t,divide:n,compare:a,partitionSelect:i}=e;function s(o){try{o=xr(o.valueOf());var u=o.length;if(u===0)throw new Error("Cannot calculate median of an empty array");if(u%2===0){for(var m=u/2-1,p=i(o,m+1),h=o[m],y=0;y0&&(h=o[y]);return f(h,p)}else{var v=i(o,(u-1)/2);return c(v)}}catch(x){throw It(x,"median")}}var c=r({"number | BigNumber | Complex | Unit":function(u){return u}}),f=r({"number | BigNumber | Complex | Unit, number | BigNumber | Complex | Unit":function(u,m){return n(t(u,m),2)}});return r(bP,{"Array | Matrix":s,"Array | Matrix, number | BigNumber":function(u,m){throw new Error("median(A, dim) is not yet supported")},"...":function(u){if(Ja(u))throw new TypeError("Scalar values expected in function median");return s(u)}})});var wP="mad",bQ=["typed","abs","map","median","subtract"],Oy=F(wP,bQ,e=>{var{typed:r,abs:t,map:n,median:a,subtract:i}=e;return r(wP,{"Array | Matrix":s,"...":function(f){return s(f)}});function s(c){if(c=xr(c.valueOf()),c.length===0)throw new Error("Cannot calculate median absolute deviation (mad) of an empty array");try{var f=a(c);return a(n(c,function(o){return t(i(o,f))}))}catch(o){throw o instanceof TypeError&&o.message.indexOf("median")!==-1?new TypeError(o.message.replace("median","mad")):It(o,"mad")}}});var PS="unbiased",DP="variance",wQ=["typed","add","subtract","multiply","divide","apply","isNaN"],$f=F(DP,wQ,e=>{var{typed:r,add:t,subtract:n,multiply:a,divide:i,apply:s,isNaN:c}=e;return r(DP,{"Array | Matrix":function(m){return f(m,PS)},"Array | Matrix, string":f,"Array | Matrix, number | BigNumber":function(m,p){return o(m,p,PS)},"Array | Matrix, number | BigNumber, string":o,"...":function(m){return f(m,PS)}});function f(u,m){var p,h=0;if(u.length===0)throw new SyntaxError("Function variance requires one or more parameters (0 provided)");if(qn(u,function(x){try{p=p===void 0?x:t(p,x),h++}catch(b){throw It(b,"variance",x)}}),h===0)throw new Error("Cannot calculate variance of an empty array");var y=i(p,h);if(p=void 0,qn(u,function(x){var b=n(x,y);p=p===void 0?a(b,b):t(p,a(b,b))}),c(p))return p;switch(m){case"uncorrected":return i(p,h);case"biased":return i(p,h+1);case"unbiased":{var v=tr(p)?p.mul(0):0;return h===1?v:i(p,h-1)}default:throw new Error('Unknown normalization "'+m+'". Choose "unbiased" (default), "uncorrected", or "biased".')}}function o(u,m,p){try{if(u.length===0)throw new SyntaxError("Function variance requires one or more parameters (0 provided)");return s(u,m,h=>f(h,p))}catch(h){throw It(h,"variance")}}});var SP="quantileSeq",DQ=["typed","?bignumber","add","subtract","divide","multiply","partitionSelect","compare","isInteger","smaller","smallerEq","larger"],Gf=F(SP,DQ,e=>{var{typed:r,bignumber:t,add:n,subtract:a,divide:i,multiply:s,partitionSelect:c,compare:f,isInteger:o,smaller:u,smallerEq:m,larger:p}=e,h=ls({typed:r,isInteger:o});return r(SP,{"Array | Matrix, number | BigNumber":(E,w)=>v(E,w,!1),"Array | Matrix, number | BigNumber, number":(E,w,N)=>y(E,w,!1,N,v),"Array | Matrix, number | BigNumber, boolean":v,"Array | Matrix, number | BigNumber, boolean, number":(E,w,N,M)=>y(E,w,N,M,v),"Array | Matrix, Array | Matrix":(E,w)=>x(E,w,!1),"Array | Matrix, Array | Matrix, number":(E,w,N)=>y(E,w,!1,N,x),"Array | Matrix, Array | Matrix, boolean":x,"Array | Matrix, Array | Matrix, boolean, number":(E,w,N,M)=>y(E,w,N,M,x)});function y(E,w,N,M,D){return h(E,M,O=>D(O,w,N))}function v(E,w,N){var M,D=E.valueOf();if(u(w,0))throw new Error("N/prob must be non-negative");if(m(w,1))return ur(w)?b(D,w,N):t(b(D,w,N));if(p(w,1)){if(!o(w))throw new Error("N must be a positive integer");if(p(w,4294967295))throw new Error("N must be less than or equal to 2^32-1, as that is the maximum length of an Array");var O=n(w,1);M=[];for(var _=0;u(_,w);_++){var C=i(_+1,O);M.push(b(D,C,N))}return ur(w)?M:t(M)}}function x(E,w,N){for(var M=E.valueOf(),D=w.valueOf(),O=[],_=0;_0&&(T=M[L])}return n(s(T,a(1,C)),s(k,C))}});var NP="std",SQ=["typed","map","sqrt","variance"],Vf=F(NP,SQ,e=>{var{typed:r,map:t,sqrt:n,variance:a}=e;return r(NP,{"Array | Matrix":i,"Array | Matrix, string":i,"Array | Matrix, number | BigNumber":i,"Array | Matrix, number | BigNumber, string":i,"...":function(c){return i(c)}});function i(s,c){if(s.length===0)throw new SyntaxError("Function std requires one or more parameters (0 provided)");try{var f=a.apply(null,arguments);return _t(f)?t(f,n):n(f)}catch(o){throw o instanceof TypeError&&o.message.indexOf(" variance")!==-1?new TypeError(o.message.replace(" variance"," std")):o}}});var AP="corr",NQ=["typed","matrix","mean","sqrt","sum","add","subtract","multiply","pow","divide"],By=F(AP,NQ,e=>{var{typed:r,matrix:t,sqrt:n,sum:a,add:i,subtract:s,multiply:c,pow:f,divide:o}=e;return r(AP,{"Array, Array":function(h,y){return u(h,y)},"Matrix, Matrix":function(h,y){var v=u(h.toArray(),y.toArray());return Array.isArray(v)?t(v):v}});function u(p,h){var y=[];if(Array.isArray(p[0])&&Array.isArray(h[0])){if(p.length!==h.length)throw new SyntaxError("Dimension mismatch. Array A and B must have the same length.");for(var v=0;vi(D,c(O,h[_])),0),E=a(p.map(D=>f(D,2))),w=a(h.map(D=>f(D,2))),N=s(c(y,b),c(v,x)),M=n(c(s(c(y,E),f(v,2)),s(c(y,w),f(x,2))));return o(N,M)}});var MP="combinations",AQ=["typed"],Iy=F(MP,AQ,e=>{var{typed:r}=e;return r(MP,{"number, number":ZD,"BigNumber, BigNumber":function(n,a){var i=n.constructor,s,c,f=n.minus(a),o=new i(1);if(!EP(n)||!EP(a))throw new TypeError("Positive integer value expected in function combinations");if(a.gt(n))throw new TypeError("k must be less than n in function combinations");if(s=o,a.lt(f))for(c=o;c.lte(f);c=c.plus(o))s=s.times(a.plus(c)).dividedBy(c);else for(c=o;c.lte(a);c=c.plus(o))s=s.times(f.plus(c)).dividedBy(c);return s}})});function EP(e){return e.isInteger()&&e.gte(0)}var CP="combinationsWithRep",MQ=["typed"],Py=F(CP,MQ,e=>{var{typed:r}=e;return r(CP,{"number, number":function(n,a){if(!Ze(n)||n<0)throw new TypeError("Positive integer value expected in function combinationsWithRep");if(!Ze(a)||a<0)throw new TypeError("Positive integer value expected in function combinationsWithRep");if(n<1)throw new TypeError("k must be less than or equal to n + k - 1");if(a{var{typed:r,config:t,multiplyScalar:n,pow:a,BigNumber:i,Complex:s}=e;function c(o){if(o.im===0)return wc(o.re);if(o.re<.5){var u=new s(1-o.re,-o.im),m=new s(Math.PI*o.re,Math.PI*o.im);return new s(Math.PI).div(m.sin()).div(c(u))}o=new s(o.re-1,o.im);for(var p=new s(su[0],0),h=1;h2;)p-=2,y+=p,h=h.times(y);return new i(h.toPrecision(i.precision))}});var FP="lgamma",CQ=["Complex","typed"],ky=F(FP,CQ,e=>{var{Complex:r,typed:t}=e,n=7,a=7,i=[-.029550653594771242,.00641025641025641,-.0019175269175269176,.0008417508417508417,-.0005952380952380953,.0007936507936507937,-.002777777777777778,.08333333333333333];return t(FP,{number:Dc,Complex:s,BigNumber:function(){throw new Error("mathjs doesn't yet provide an implementation of the algorithm lgamma for BigNumber")}});function s(o){var u=6.283185307179586,m=1.1447298858494002,p=.1;if(o.isNaN())return new r(NaN,NaN);if(o.im===0)return new r(Dc(o.re),0);if(o.re>=n||Math.abs(o.im)>=a)return c(o);if(o.re<=p){var h=uE(u,o.im)*Math.floor(.5*o.re+.25),y=o.mul(Math.PI).sin().log(),v=s(new r(1-o.re,-o.im));return new r(m,h).sub(y).sub(v)}else return o.im>=0?f(o):f(o.conjugate()).conjugate()}function c(o){for(var u=o.sub(.5).mul(o.log()).sub(o).add(rS),m=new r(1,0).div(o),p=m.div(o),h=i[0],y=i[1],v=2*p.re,x=p.re*p.re+p.im*p.im,b=2;b<8;b++){var E=y;y=-x*h+i[b],h=v*h+E}var w=m.mul(p.mul(h).add(y));return u.add(w)}function f(o){var u=0,m=0,p=o;for(o=o.add(1);o.re<=n;){p=p.mul(o);var h=p.im<0?1:0;h!==0&&m===0&&u++,m=h,o=o.add(1)}return c(o).sub(p.log()).sub(new r(0,u*2*Math.PI*1))}});var OP="factorial",TQ=["typed","gamma"],Ly=F(OP,TQ,e=>{var{typed:r,gamma:t}=e;return r(OP,{number:function(a){if(a<0)throw new Error("Value must be non-negative");return t(a+1)},BigNumber:function(a){if(a.isNegative())throw new Error("Value must be non-negative");return t(a.plus(1))},"Array | Matrix":r.referToSelf(n=>a=>er(a,n))})});var BP="kldivergence",_Q=["typed","matrix","divide","sum","multiply","map","dotDivide","log","isNumeric"],qy=F(BP,_Q,e=>{var{typed:r,matrix:t,divide:n,sum:a,multiply:i,map:s,dotDivide:c,log:f,isNumeric:o}=e;return r(BP,{"Array, Array":function(p,h){return u(t(p),t(h))},"Matrix, Array":function(p,h){return u(p,t(h))},"Array, Matrix":function(p,h){return u(t(p),h)},"Matrix, Matrix":function(p,h){return u(p,h)}});function u(m,p){var h=p.size().length,y=m.size().length;if(h>1)throw new Error("first object must be one dimensional");if(y>1)throw new Error("second object must be one dimensional");if(h!==y)throw new Error("Length of two vectors must be equal");var v=a(m);if(v===0)throw new Error("Sum of elements in first object must be non zero");var x=a(p);if(x===0)throw new Error("Sum of elements in second object must be non zero");var b=n(m,a(m)),E=n(p,a(p)),w=a(i(b,s(c(b,E),N=>f(N))));return o(w)?w:Number.NaN}});var IP="multinomial",FQ=["typed","add","divide","multiply","factorial","isInteger","isPositive"],Uy=F(IP,FQ,e=>{var{typed:r,add:t,divide:n,multiply:a,factorial:i,isInteger:s,isPositive:c}=e;return r(IP,{"Array | Matrix":function(o){var u=0,m=1;return qn(o,function(p){if(!s(p)||!c(p))throw new TypeError("Positive integer value expected in function multinomial");u=t(u,p),m=a(m,i(p))}),n(i(u),m)}})});var PP="permutations",OQ=["typed","factorial"],zy=F(PP,OQ,e=>{var{typed:r,factorial:t}=e;return r(PP,{"number | BigNumber":t,"number, number":function(a,i){if(!Ze(a)||a<0)throw new TypeError("Positive integer value expected in function permutations");if(!Ze(i)||i<0)throw new TypeError("Positive integer value expected in function permutations");if(i>a)throw new TypeError("second argument k must be less than or equal to first argument n");return Oa(a-i+1,a)},"BigNumber, BigNumber":function(a,i){var s,c;if(!RP(a)||!RP(i))throw new TypeError("Positive integer value expected in function permutations");if(i.gt(a))throw new TypeError("second argument k must be less than or equal to first argument n");var f=a.mul(0).add(1);for(s=f,c=a.minus(i).plus(1);c.lte(a);c=c.plus(1))s=s.times(c);return s}})});function RP(e){return e.isInteger()&&e.gte(0)}var YS=Aa(jP(),1),qQ=(0,YS.default)(Date.now());function Eo(e){var r;function t(a){r=a===null?qQ:(0,YS.default)(String(a))}t(e);function n(){return r()}return n}var e4="pickRandom",UQ=["typed","config","?on"],Wy=F(e4,UQ,e=>{var{typed:r,config:t,on:n}=e,a=Eo(t.randomSeed);return n&&n("config",function(s,c){s.randomSeed!==c.randomSeed&&(a=Eo(s.randomSeed))}),r(e4,{"Array | Matrix":function(c){return i(c,{})},"Array | Matrix, Object":function(c,f){return i(c,f)},"Array | Matrix, number":function(c,f){return i(c,{number:f})},"Array | Matrix, Array | Matrix":function(c,f){return i(c,{weights:f})},"Array | Matrix, Array | Matrix, number":function(c,f,o){return i(c,{number:o,weights:f})},"Array | Matrix, number, Array | Matrix":function(c,f,o){return i(c,{number:f,weights:o})}});function i(s,c){var{number:f,weights:o,elementWise:u=!0}=c,m=typeof f>"u";m&&(f=1);var p=Qe(s)?s.create:Qe(o)?o.create:null;s=s.valueOf(),o&&(o=o.valueOf()),u===!0&&(s=xr(s),o=xr(o));var h=0;if(typeof o<"u"){if(o.length!==s.length)throw new Error("Weights must have the same length as possibles");for(var y=0,v=o.length;y"u")E=s[Math.floor(a()*x)];else for(var w=a()*h,N=0,M=s.length;N1)for(var n=0,a=e.shift();n{var{typed:r,config:t,on:n}=e,a=Eo(t.randomSeed);return n&&n("config",function(c,f){c.randomSeed!==f.randomSeed&&(a=Eo(c.randomSeed))}),r(r4,{"":()=>s(0,1),number:c=>s(0,c),"number, number":(c,f)=>s(c,f),"Array | Matrix":c=>i(c,0,1),"Array | Matrix, number":(c,f)=>i(c,0,f),"Array | Matrix, number, number":(c,f,o)=>i(c,f,o)});function i(c,f,o){var u=Ec(c.valueOf(),()=>s(f,o));return Qe(c)?c.create(u):u}function s(c,f){return c+a()*(f-c)}});var t4="randomInt",YQ=["typed","config","?on"],$y=F(t4,YQ,e=>{var{typed:r,config:t,on:n}=e,a=Eo(t.randomSeed);return n&&n("config",function(c,f){c.randomSeed!==f.randomSeed&&(a=Eo(c.randomSeed))}),r(t4,{"":()=>s(0,1),number:c=>s(0,c),"number, number":(c,f)=>s(c,f),"Array | Matrix":c=>i(c,0,1),"Array | Matrix, number":(c,f)=>i(c,0,f),"Array | Matrix, number, number":(c,f,o)=>i(c,f,o)});function i(c,f,o){var u=Ec(c.valueOf(),()=>s(f,o));return Qe(c)?c.create(u):u}function s(c,f){return Math.floor(c+a()*(f-c))}});var n4="stirlingS2",WQ=["typed","addScalar","subtractScalar","multiplyScalar","divideScalar","pow","factorial","combinations","isNegative","isInteger","number","?bignumber","larger"],Gy=F(n4,WQ,e=>{var{typed:r,addScalar:t,subtractScalar:n,multiplyScalar:a,divideScalar:i,pow:s,factorial:c,combinations:f,isNegative:o,isInteger:u,number:m,bignumber:p,larger:h}=e,y=[],v=[];return r(n4,{"number | BigNumber, number | BigNumber":function(b,E){if(!u(b)||o(b)||!u(E)||o(E))throw new TypeError("Non-negative integer value expected in function stirlingS2");if(h(E,b))throw new TypeError("k must be less than or equal to n in function stirlingS2");var w=!(ur(b)&&ur(E)),N=w?v:y,M=w?p:m,D=m(b),O=m(E);if(N[D]&&N[D].length>O)return N[D][O];for(var _=0;_<=D;++_)if(N[_]||(N[_]=[M(_===0?1:0)]),_!==0)for(var C=N[_],T=N[_-1],k=C.length;k<=_&&k<=O;++k)k===_?C[k]=1:C[k]=t(a(M(k),T[k]),T[k-1]);return N[D][O]}})});var a4="bellNumbers",HQ=["typed","addScalar","isNegative","isInteger","stirlingS2"],Vy=F(a4,HQ,e=>{var{typed:r,addScalar:t,isNegative:n,isInteger:a,stirlingS2:i}=e;return r(a4,{"number | BigNumber":function(c){if(!a(c)||n(c))throw new TypeError("Non-negative integer value expected in function bellNumbers");for(var f=0,o=0;o<=c;o++)f=t(f,i(c,o));return f}})});var i4="catalan",$Q=["typed","addScalar","divideScalar","multiplyScalar","combinations","isNegative","isInteger"],Zy=F(i4,$Q,e=>{var{typed:r,addScalar:t,divideScalar:n,multiplyScalar:a,combinations:i,isNegative:s,isInteger:c}=e;return r(i4,{"number | BigNumber":function(o){if(!c(o)||s(o))throw new TypeError("Non-negative integer value expected in function catalan");return n(i(a(o,2),o),t(o,1))}})});var o4="composition",GQ=["typed","addScalar","combinations","isNegative","isPositive","isInteger","larger"],Qy=F(o4,GQ,e=>{var{typed:r,addScalar:t,combinations:n,isPositive:a,isNegative:i,isInteger:s,larger:c}=e;return r(o4,{"number | BigNumber, number | BigNumber":function(o,u){if(!s(o)||!a(o)||!s(u)||!a(u))throw new TypeError("Positive integer value expected in function composition");if(c(u,o))throw new TypeError("k must be less than or equal to n in function composition");return n(t(o,-1),t(u,-1))}})});var s4="leafCount",VQ=["parse","typed"],Xy=F(s4,VQ,e=>{var{parse:r,typed:t}=e;function n(a){var i=0;return a.forEach(s=>{i+=n(s)}),i||1}return t(s4,{Node:function(i){return n(i)}})});function WS(e){return wr(e)||ht(e)&&e.isUnary()&&wr(e.args[0])}function Cc(e){return!!(wr(e)||(Cn(e)||ht(e))&&e.args.every(Cc)||fn(e)&&Cc(e.content))}function u4(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),t.push.apply(t,n)}return t}function HS(e){for(var r=1;r{var{FunctionNode:r,OperatorNode:t,SymbolNode:n}=e,a=!0,i=!1,s="defaultF",c={add:{trivial:a,total:a,commutative:a,associative:a},unaryPlus:{trivial:a,total:a,commutative:a,associative:a},subtract:{trivial:i,total:a,commutative:i,associative:i},multiply:{trivial:a,total:a,commutative:a,associative:a},divide:{trivial:i,total:a,commutative:i,associative:i},paren:{trivial:a,total:a,commutative:a,associative:i},defaultF:{trivial:i,total:a,commutative:i,associative:i}},f={divide:{total:i},log:{total:i}},o={subtract:{total:i},abs:{trivial:a},log:{total:a}};function u(w,N){var M=arguments.length>2&&arguments[2]!==void 0?arguments[2]:c,D=s;if(typeof w=="string"?D=w:ht(w)?D=w.fn.toString():Cn(w)?D=w.name:fn(w)&&(D="paren"),Xe(M,D)){var O=M[D];if(Xe(O,N))return O[N];if(Xe(c,D))return c[D][N]}if(Xe(M,s)){var _=M[s];return Xe(_,N)?_[N]:c[s][N]}if(Xe(c,D)){var C=c[D];if(Xe(C,N))return C[N]}return c[s][N]}function m(w){var N=arguments.length>1&&arguments[1]!==void 0?arguments[1]:c;return u(w,"commutative",N)}function p(w){var N=arguments.length>1&&arguments[1]!==void 0?arguments[1]:c;return u(w,"associative",N)}function h(w,N){var M=HS({},w);for(var D in N)Xe(w,D)?M[D]=HS(HS({},N[D]),w[D]):M[D]=N[D];return M}function y(w,N){if(!w.args||w.args.length===0)return w;w.args=v(w,N);for(var M=0;M2&&p(w,N)){for(var _=w.args.pop();w.args.length>0;)_=M([w.args.pop(),_]);w.args=_.args}}}function b(w,N){if(!(!w.args||w.args.length===0)){for(var M=E(w),D=w.args.length,O=0;O2&&p(w,N)){for(var _=w.args.shift();w.args.length>0;)_=M([_,w.args.shift()]);w.args=_.args}}}function E(w){return ht(w)?function(N){try{return new t(w.op,w.fn,N,w.implicit)}catch(M){return console.error(M),[]}}:function(N){return new r(new n(w.name),N)}}return{createMakeNodeFunction:E,hasProperty:u,isCommutative:m,isAssociative:p,mergeContext:h,flatten:y,allChildren:v,unflattenr:x,unflattenl:b,defaultContext:c,realContext:f,positiveContext:o}});var XQ="simplify",KQ=["config","typed","parse","add","subtract","multiply","divide","pow","isZero","equal","resolve","simplifyConstant","simplifyCore","?fraction","?bignumber","mathWithTransform","matrix","AccessorNode","ArrayNode","ConstantNode","FunctionNode","IndexNode","ObjectNode","OperatorNode","ParenthesisNode","SymbolNode"],Ky=F(XQ,KQ,e=>{var{config:r,typed:t,parse:n,add:a,subtract:i,multiply:s,divide:c,pow:f,isZero:o,equal:u,resolve:m,simplifyConstant:p,simplifyCore:h,fraction:y,bignumber:v,mathWithTransform:x,matrix:b,AccessorNode:E,ArrayNode:w,ConstantNode:N,FunctionNode:M,IndexNode:D,ObjectNode:O,OperatorNode:_,ParenthesisNode:C,SymbolNode:T}=e,{hasProperty:k,isCommutative:L,isAssociative:H,mergeContext:V,flatten:W,unflattenr:q,unflattenl:R,createMakeNodeFunction:X,defaultContext:U,realContext:oe,positiveContext:me}=Zf({FunctionNode:M,OperatorNode:_,SymbolNode:T});t.addConversion({from:"Object",to:"Map",convert:So});var ae=t("simplify",{Node:ye,"Node, Map":(j,ne)=>ye(j,!1,ne),"Node, Map, Object":(j,ne,ue)=>ye(j,!1,ne,ue),"Node, Array":ye,"Node, Array, Map":ye,"Node, Array, Map, Object":ye});t.removeConversion({from:"Object",to:"Map",convert:So}),ae.defaultContext=U,ae.realContext=oe,ae.positiveContext=me;function $(j){return j.transform(function(ne,ue,Me){return fn(ne)?$(ne.content):ne})}var ce={true:!0,false:!0,e:!0,i:!0,Infinity:!0,LN2:!0,LN10:!0,LOG2E:!0,LOG10E:!0,NaN:!0,phi:!0,pi:!0,SQRT1_2:!0,SQRT2:!0,tau:!0};ae.rules=[h,{l:"log(e)",r:"1"},{s:"n-n1 -> n+-n1",assuming:{subtract:{total:!0}}},{s:"n-n -> 0",assuming:{subtract:{total:!1}}},{s:"-(cl*v) -> v * (-cl)",assuming:{multiply:{commutative:!0},subtract:{total:!0}}},{s:"-(cl*v) -> (-cl) * v",assuming:{multiply:{commutative:!1},subtract:{total:!0}}},{s:"-(v*cl) -> v * (-cl)",assuming:{multiply:{commutative:!1},subtract:{total:!0}}},{l:"-(n1/n2)",r:"-n1/n2"},{l:"-v",r:"v * (-1)"},{l:"(n1 + n2)*(-1)",r:"n1*(-1) + n2*(-1)",repeat:!0},{l:"n/n1^n2",r:"n*n1^-n2"},{l:"n/n1",r:"n*n1^-1"},{s:"(n1*n2)^n3 -> n1^n3 * n2^n3",assuming:{multiply:{commutative:!0}}},{s:"(n1*n2)^(-1) -> n2^(-1) * n1^(-1)",assuming:{multiply:{commutative:!1}}},{s:"(n ^ n1) ^ n2 -> n ^ (n1 * n2)",assuming:{divide:{total:!0}}},{l:" vd * ( vd * n1 + n2)",r:"vd^2 * n1 + vd * n2"},{s:" vd * (vd^n4 * n1 + n2) -> vd^(1+n4) * n1 + vd * n2",assuming:{divide:{total:!0}}},{s:"vd^n3 * ( vd * n1 + n2) -> vd^(n3+1) * n1 + vd^n3 * n2",assuming:{divide:{total:!0}}},{s:"vd^n3 * (vd^n4 * n1 + n2) -> vd^(n3+n4) * n1 + vd^n3 * n2",assuming:{divide:{total:!0}}},{l:"n*n",r:"n^2"},{s:"n * n^n1 -> n^(n1+1)",assuming:{divide:{total:!0}}},{s:"n^n1 * n^n2 -> n^(n1+n2)",assuming:{divide:{total:!0}}},p,{s:"n+n -> 2*n",assuming:{add:{total:!0}}},{l:"n+-n",r:"0"},{l:"vd*n + vd",r:"vd*(n+1)"},{l:"n3*n1 + n3*n2",r:"n3*(n1+n2)"},{l:"n3^(-n4)*n1 + n3 * n2",r:"n3^(-n4)*(n1 + n3^(n4+1) *n2)"},{l:"n3^(-n4)*n1 + n3^n5 * n2",r:"n3^(-n4)*(n1 + n3^(n4+n5)*n2)"},{s:"n*vd + vd -> (n+1)*vd",assuming:{multiply:{commutative:!1}}},{s:"vd + n*vd -> (1+n)*vd",assuming:{multiply:{commutative:!1}}},{s:"n1*n3 + n2*n3 -> (n1+n2)*n3",assuming:{multiply:{commutative:!1}}},{s:"n^n1 * n -> n^(n1+1)",assuming:{divide:{total:!0},multiply:{commutative:!1}}},{s:"n1*n3^(-n4) + n2 * n3 -> (n1 + n2*n3^(n4 + 1))*n3^(-n4)",assuming:{multiply:{commutative:!1}}},{s:"n1*n3^(-n4) + n2 * n3^n5 -> (n1 + n2*n3^(n4 + n5))*n3^(-n4)",assuming:{multiply:{commutative:!1}}},{l:"n*cd + cd",r:"(n+1)*cd"},{s:"cd*n + cd -> cd*(n+1)",assuming:{multiply:{commutative:!1}}},{s:"cd + cd*n -> cd*(1+n)",assuming:{multiply:{commutative:!1}}},p,{s:"(-n)*n1 -> -(n*n1)",assuming:{subtract:{total:!0}}},{s:"n1*(-n) -> -(n1*n)",assuming:{subtract:{total:!0},multiply:{commutative:!1}}},{s:"ce+ve -> ve+ce",assuming:{add:{commutative:!0}},imposeContext:{add:{commutative:!1}}},{s:"vd*cd -> cd*vd",assuming:{multiply:{commutative:!0}},imposeContext:{multiply:{commutative:!1}}},{l:"n+-n1",r:"n-n1"},{l:"n+-(n1)",r:"n-(n1)"},{s:"n*(n1^-1) -> n/n1",assuming:{multiply:{commutative:!0}}},{s:"n*n1^-n2 -> n/n1^n2",assuming:{multiply:{commutative:!0}}},{s:"n^-1 -> 1/n",assuming:{multiply:{commutative:!0}}},{l:"n^1",r:"n"},{s:"n*(n1/n2) -> (n*n1)/n2",assuming:{multiply:{associative:!0}}},{s:"n-(n1+n2) -> n-n1-n2",assuming:{addition:{associative:!0,commutative:!0}}},{l:"1*n",r:"n",imposeContext:{multiply:{commutative:!0}}},{s:"n1/(n2/n3) -> (n1*n3)/n2",assuming:{multiply:{associative:!0}}},{l:"n1/(-n2)",r:"-n1/n2"}];function Ce(j,ne){var ue={};if(j.s){var Me=j.s.split("->");if(Me.length===2)ue.l=Me[0],ue.r=Me[1];else throw SyntaxError("Could not parse rule: "+j.s)}else ue.l=j.l,ue.r=j.r;ue.l=$(n(ue.l)),ue.r=$(n(ue.r));for(var Ee of["imposeContext","repeat","assuming"])Ee in j&&(ue[Ee]=j[Ee]);if(j.evaluate&&(ue.evaluate=n(j.evaluate)),H(ue.l,ne)){var qe=!L(ue.l,ne),Pe;qe&&(Pe=Se());var lr=X(ue.l),sr=Se();ue.expanded={},ue.expanded.l=lr([ue.l,sr]),W(ue.expanded.l,ne),q(ue.expanded.l,ne),ue.expanded.r=lr([ue.r,sr]),qe&&(ue.expandedNC1={},ue.expandedNC1.l=lr([Pe,ue.l]),ue.expandedNC1.r=lr([Pe,ue.r]),ue.expandedNC2={},ue.expandedNC2.l=lr([Pe,ue.expanded.l]),ue.expandedNC2.r=lr([Pe,ue.expanded.r]))}return ue}function pe(j,ne){for(var ue=[],Me=0;Me2&&arguments[2]!==void 0?arguments[2]:as(),Me=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{},Ee=Me.consoleDebug;ne=pe(ne||ae.rules,Me.context);var qe=m(j,ue);qe=$(qe);for(var Pe={},lr=qe.toString({parenthesis:"all"});!Pe[lr];){Pe[lr]=!0,ge=0;var sr=lr;Ee&&console.log("Working on: ",lr);for(var Je=0;Je ").concat(ne[Je].r.toString()))),Ee){var ee=qe.toString({parenthesis:"all"});ee!==sr&&(console.log("Applying",Pr,"produced",ee),sr=ee)}R(qe,Me.context)}lr=qe.toString({parenthesis:"all"})}return qe}function be(j,ne,ue){var Me=j;if(j)for(var Ee=0;Ee1&&(sr=qe(j.args.slice(0,lr))),Ee=j.args.slice(lr),Me=Ee.length===1?Ee[0]:qe(Ee),ue.push(qe([sr,Me]))}return ue}function Ye(j,ne){var ue={placeholders:{}};if(!j.placeholders&&!ne.placeholders)return ue;if(j.placeholders){if(!ne.placeholders)return j}else return ne;for(var Me in j.placeholders)if(Xe(j.placeholders,Me)&&(ue.placeholders[Me]=j.placeholders[Me],Xe(ne.placeholders,Me)&&!xe(j.placeholders[Me],ne.placeholders[Me])))return null;for(var Ee in ne.placeholders)Xe(ne.placeholders,Ee)&&(ue.placeholders[Ee]=ne.placeholders[Ee]);return ue}function Ke(j,ne){var ue=[];if(j.length===0||ne.length===0)return ue;for(var Me,Ee=0;Ee2)throw new Error("permuting >2 commutative non-associative rule arguments not yet implemented");var sr=re(j.args[0],ne.args[1],ue);if(sr.length===0)return[];var Je=re(j.args[1],ne.args[0],ue);if(Je.length===0)return[];qe=[sr,Je]}Ee=J(qe)}else if(ne.args.length>=2&&j.args.length===2){for(var Pr=Ae(ne,ue),ee=[],le=0;le2)throw Error("Unexpected non-binary associative function: "+j.toString());return[]}}else if(j instanceof T){if(j.name.length===0)throw new Error("Symbol in rule has 0 length...!?");if(ce[j.name]){if(j.name!==ne.name)return[]}else switch(j.name[1]>="a"&&j.name[1]<="z"?j.name.substring(0,2):j.name[0]){case"n":case"_p":Ee[0].placeholders[j.name]=ne;break;case"c":case"cl":if(wr(ne))Ee[0].placeholders[j.name]=ne;else return[];break;case"v":if(!wr(ne))Ee[0].placeholders[j.name]=ne;else return[];break;case"vl":if(ft(ne))Ee[0].placeholders[j.name]=ne;else return[];break;case"cd":if(WS(ne))Ee[0].placeholders[j.name]=ne;else return[];break;case"vd":if(!WS(ne))Ee[0].placeholders[j.name]=ne;else return[];break;case"ce":if(Cc(ne))Ee[0].placeholders[j.name]=ne;else return[];break;case"ve":if(!Cc(ne))Ee[0].placeholders[j.name]=ne;else return[];break;default:throw new Error("Invalid symbol in rule: "+j.name)}}else if(j instanceof N){if(!u(j.value,ne.value))return[]}else return[];return Ee}function xe(j,ne){if(j instanceof N&&ne instanceof N){if(!u(j.value,ne.value))return!1}else if(j instanceof T&&ne instanceof T){if(j.name!==ne.name)return!1}else if(j instanceof _&&ne instanceof _||j instanceof M&&ne instanceof M){if(j instanceof _){if(j.op!==ne.op||j.fn!==ne.fn)return!1}else if(j instanceof M&&j.name!==ne.name)return!1;if(j.args.length!==ne.args.length)return!1;for(var ue=0;ue{var{typed:r,config:t,mathWithTransform:n,matrix:a,fraction:i,bignumber:s,AccessorNode:c,ArrayNode:f,ConstantNode:o,FunctionNode:u,IndexNode:m,ObjectNode:p,OperatorNode:h,SymbolNode:y}=e,{isCommutative:v,isAssociative:x,allChildren:b,createMakeNodeFunction:E}=Zf({FunctionNode:u,OperatorNode:h,SymbolNode:y}),w=r("simplifyConstant",{Node:W=>O(V(W,{})),"Node, Object":function(q,R){return O(V(q,R))}});function N(W){return _a(W)?W.valueOf():W instanceof Array?W.map(N):Qe(W)?a(N(W.valueOf())):W}function M(W,q,R){try{return n[W].apply(null,q)}catch{return q=q.map(N),C(n[W].apply(null,q),R)}}var D=r({Fraction:k,number:function(q){return q<0?T(new o(-q)):new o(q)},BigNumber:function(q){return q<0?T(new o(-q)):new o(q)},Complex:function(q){throw new Error("Cannot convert Complex number to Node")},string:function(q){return new o(q)},Matrix:function(q){return new f(q.valueOf().map(R=>D(R)))}});function O(W){return Mr(W)?W:D(W)}function _(W,q){var R=q&&q.exactFractions!==!1;if(R&&isFinite(W)&&i){var X=i(W),U=q&&typeof q.fractionsLimit=="number"?q.fractionsLimit:1/0;if(X.valueOf()===W&&X.n0;)if(wr(X[0])&&typeof X[0].value!="string"){var U=C(X.shift().value,R);un(W)?W=W.items[U-1]:(W=W.valueOf()[U-1],W instanceof Array&&(W=a(W)))}else if(X.length>1&&wr(X[1])&&typeof X[1].value!="string"){var oe=C(X[1].value,R),me=[],ae=un(W)?W.items:W.valueOf();for(var $ of ae)if(un($))me.push($.items[oe-1]);else if(Qe(W))me.push($[oe-1]);else break;if(me.length===ae.length)un(W)?W=new f(me):W=a(me),X.splice(1,1);else break}else break;return X.length===q.dimensions.length?new c(O(W),q):X.length>0?(q=new m(X),new c(O(W),q)):W}if(Vi(W)&&q.dimensions.length===1&&wr(q.dimensions[0])){var ce=q.dimensions[0].value;return ce in W.properties?W.properties[ce]:new o}return new c(O(W),q)}function H(W,q,R,X){var U=q.shift(),oe=q.reduce((me,ae)=>{if(!Mr(ae)){var $=me.pop();if(Mr($))return[$,ae];try{return me.push(M(W,[$,ae],X)),me}catch{me.push($)}}me.push(O(me.pop()));var ce=me.length===1?me[0]:R(me);return[R([ce,O(ae)])]},[U]);return oe.length===1?oe[0]:R([oe[0],D(oe[1])])}function V(W,q){switch(W.type){case"SymbolNode":return W;case"ConstantNode":switch(typeof W.value){case"number":return C(W.value,q);case"string":return W.value;default:if(!isNaN(W.value))return C(W.value,q)}return W;case"FunctionNode":if(n[W.name]&&n[W.name].rawArgs)return W;{var R=["add","multiply"];if(R.indexOf(W.name)===-1){var X=W.args.map(De=>V(De,q));if(!X.some(Mr))try{return M(W.name,X,q)}catch{}if(W.name==="size"&&X.length===1&&un(X[0])){for(var U=[],oe=X[0];un(oe);)U.push(oe.items.length),oe=oe.items[0];return a(U)}return new u(W.name,X.map(O))}}case"OperatorNode":{var me=W.fn.toString(),ae,$,ce=E(W);if(ht(W)&&W.isUnary())ae=[V(W.args[0],q)],Mr(ae[0])?$=ce(ae):$=M(me,ae,q);else if(x(W,q.context))if(ae=b(W,q.context),ae=ae.map(De=>V(De,q)),v(me,q.context)){for(var Ce=[],pe=[],ge=0;ge1?($=H(me,Ce,ce,q),pe.unshift($),$=H(me,pe,ce,q)):$=H(me,ae,ce,q)}else $=H(me,ae,ce,q);else ae=W.args.map(De=>V(De,q)),$=H(me,ae,ce,q);return $}case"ParenthesisNode":return V(W.content,q);case"AccessorNode":return L(V(W.object,q),V(W.index,q),q);case"ArrayNode":{var Se=W.items.map(De=>V(De,q));return Se.some(Mr)?new f(Se.map(O)):a(Se)}case"IndexNode":return new m(W.dimensions.map(De=>w(De,q)));case"ObjectNode":{var ye={};for(var be in W.properties)ye[be]=w(W.properties[be],q);return new p(ye)}case"AssignmentNode":case"BlockNode":case"FunctionAssignmentNode":case"RangeNode":case"ConditionalNode":default:throw new Error("Unimplemented node type in simplifyConstant: ".concat(W.type))}}return w});var f4="simplifyCore",eX=["typed","parse","equal","isZero","add","subtract","multiply","divide","pow","AccessorNode","ArrayNode","ConstantNode","FunctionNode","IndexNode","ObjectNode","OperatorNode","ParenthesisNode","SymbolNode"],jy=F(f4,eX,e=>{var{typed:r,parse:t,equal:n,isZero:a,add:i,subtract:s,multiply:c,divide:f,pow:o,AccessorNode:u,ArrayNode:m,ConstantNode:p,FunctionNode:h,IndexNode:y,ObjectNode:v,OperatorNode:x,ParenthesisNode:b,SymbolNode:E}=e,w=new p(0),N=new p(1),M=new p(!0),D=new p(!1);function O(k){return ht(k)&&["and","not","or"].includes(k.op)}var{hasProperty:_,isCommutative:C}=Zf({FunctionNode:h,OperatorNode:x,SymbolNode:E});function T(k){var L=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},H=L?L.context:void 0;if(_(k,"trivial",H)){if(Cn(k)&&k.args.length===1)return T(k.args[0],L);var V=!1,W=0;if(k.forEach(pe=>{++W,W===1&&(V=T(pe,L))}),W===1)return V}var q=k;if(Cn(q)){var R=oF(q.name);if(R){if(q.args.length>2&&_(q,"associative",H))for(;q.args.length>2;){var X=q.args.pop(),U=q.args.pop();q.args.push(new x(R,q.name,[X,U]))}q=new x(R,q.name,q.args)}else return new h(T(q.fn),q.args.map(pe=>T(pe,L)))}if(ht(q)&&q.isUnary()){var oe=T(q.args[0],L);if(q.op==="~"&&ht(oe)&&oe.isUnary()&&oe.op==="~"||q.op==="not"&&ht(oe)&&oe.isUnary()&&oe.op==="not"&&O(oe.args[0]))return oe.args[0];var me=!0;if(q.op==="-"&&ht(oe)&&(oe.isBinary()&&oe.fn==="subtract"&&(q=new x("-","subtract",[oe.args[1],oe.args[0]]),me=!1),oe.isUnary()&&oe.op==="-"))return oe.args[0];if(me)return new x(q.op,q.fn,[oe])}if(ht(q)&&q.isBinary()){var ae=T(q.args[0],L),$=T(q.args[1],L);if(q.op==="+"){if(wr(ae)&&a(ae.value))return $;if(wr($)&&a($.value))return ae;ht($)&&$.isUnary()&&$.op==="-"&&($=$.args[0],q=new x("-","subtract",[ae,$]))}if(q.op==="-")return ht($)&&$.isUnary()&&$.op==="-"?T(new x("+","add",[ae,$.args[0]]),L):wr(ae)&&a(ae.value)?T(new x("-","unaryMinus",[$])):wr($)&&a($.value)?ae:new x(q.op,q.fn,[ae,$]);if(q.op==="*"){if(wr(ae)){if(a(ae.value))return w;if(n(ae.value,1))return $}if(wr($)){if(a($.value))return w;if(n($.value,1))return ae;if(C(q,H))return new x(q.op,q.fn,[$,ae],q.implicit)}return new x(q.op,q.fn,[ae,$],q.implicit)}if(q.op==="/")return wr(ae)&&a(ae.value)?w:wr($)&&n($.value,1)?ae:new x(q.op,q.fn,[ae,$]);if(q.op==="^"&&wr($)){if(a($.value))return N;if(n($.value,1))return ae}if(q.op==="and"){if(wr(ae))if(ae.value){if(O($))return $;if(wr($))return $.value?M:D}else return D;if(wr($))if($.value){if(O(ae))return ae}else return D}if(q.op==="or"){if(wr(ae)){if(ae.value)return M;if(O($))return $}if(wr($)){if($.value)return M;if(O(ae))return ae}}return new x(q.op,q.fn,[ae,$])}if(ht(q))return new x(q.op,q.fn,q.args.map(pe=>T(pe,L)));if(un(q))return new m(q.items.map(pe=>T(pe,L)));if(jn(q))return new u(T(q.object,L),T(q.index,L));if(la(q))return new y(q.dimensions.map(pe=>T(pe,L)));if(Vi(q)){var ce={};for(var Ce in q.properties)ce[Ce]=T(q.properties[Ce],L);return new v(ce)}return q}return r(f4,{Node:T,"Node,Object":T})});var rX="resolve",tX=["typed","parse","ConstantNode","FunctionNode","OperatorNode","ParenthesisNode"],e0=F(rX,tX,e=>{var{typed:r,parse:t,ConstantNode:n,FunctionNode:a,OperatorNode:i,ParenthesisNode:s}=e;function c(f,o){var u=arguments.length>2&&arguments[2]!==void 0?arguments[2]:new Set;if(!o)return f;if(ft(f)){if(u.has(f.name)){var m=Array.from(u).join(", ");throw new ReferenceError("recursive loop of variable definitions among {".concat(m,"}"))}var p=o.get(f.name);if(Mr(p)){var h=new Set(u);return h.add(f.name),c(p,o,h)}else return typeof p=="number"?t(String(p)):p!==void 0?new n(p):f}else if(ht(f)){var y=f.args.map(function(x){return c(x,o,u)});return new i(f.op,f.fn,y,f.implicit)}else{if(fn(f))return new s(c(f.content,o,u));if(Cn(f)){var v=f.args.map(function(x){return c(x,o,u)});return new a(f.name,v)}}return f.map(x=>c(x,o,u))}return r("resolve",{Node:c,"Node, Map | null | undefined":c,"Node, Object":(f,o)=>c(f,So(o)),"Array | Matrix":r.referToSelf(f=>o=>o.map(u=>f(u))),"Array | Matrix, null | undefined":r.referToSelf(f=>o=>o.map(u=>f(u))),"Array, Object":r.referTo("Array,Map",f=>(o,u)=>f(o,So(u))),"Matrix, Object":r.referTo("Matrix,Map",f=>(o,u)=>f(o,So(u))),"Array | Matrix, Map":r.referToSelf(f=>(o,u)=>o.map(m=>f(m,u)))})});var l4="symbolicEqual",nX=["parse","simplify","typed","OperatorNode"],r0=F(l4,nX,e=>{var{parse:r,simplify:t,typed:n,OperatorNode:a}=e;function i(s,c){var f=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},o=new a("-","subtract",[s,c]),u=t(o,{},f);return wr(u)&&!u.value}return n(l4,{"Node, Node":i,"Node, Node, Object":i})});var c4="derivative",aX=["typed","config","parse","simplify","equal","isZero","numeric","ConstantNode","FunctionNode","OperatorNode","ParenthesisNode","SymbolNode"],t0=F(c4,aX,e=>{var{typed:r,config:t,parse:n,simplify:a,equal:i,isZero:s,numeric:c,ConstantNode:f,FunctionNode:o,OperatorNode:u,ParenthesisNode:m,SymbolNode:p}=e;function h(w,N){var M=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{simplify:!0},D={};x(D,w,N.name);var O=b(w,D);return M.simplify?a(O):O}r.addConversion({from:"identifier",to:"SymbolNode",convert:n});var y=r(c4,{"Node, SymbolNode":h,"Node, SymbolNode, Object":h});r.removeConversion({from:"identifier",to:"SymbolNode",convert:n}),y._simplify=!0,y.toTex=function(w){return v.apply(null,w.args)};var v=r("_derivTex",{"Node, SymbolNode":function(N,M){return wr(N)&&Fr(N.value)==="string"?v(n(N.value).toString(),M.toString(),1):v(N.toTex(),M.toString(),1)},"Node, ConstantNode":function(N,M){if(Fr(M.value)==="string")return v(N,n(M.value));throw new Error("The second parameter to 'derivative' is a non-string constant")},"Node, SymbolNode, ConstantNode":function(N,M,D){return v(N.toString(),M.name,D.value)},"string, string, number":function(N,M,D){var O;return D===1?O="{d\\\\over d"+M+"}":O="{d^{"+D+"}\\\\over d"+M+"^{"+D+"}}",O+"\\\\left[".concat(N,"\\\\right]")}}),x=r("constTag",{"Object, ConstantNode, string":function(N,M){return N[M]=!0,!0},"Object, SymbolNode, string":function(N,M,D){return M.name!==D?(N[M]=!0,!0):!1},"Object, ParenthesisNode, string":function(N,M,D){return x(N,M.content,D)},"Object, FunctionAssignmentNode, string":function(N,M,D){return M.params.indexOf(D)===-1?(N[M]=!0,!0):x(N,M.expr,D)},"Object, FunctionNode | OperatorNode, string":function(N,M,D){if(M.args.length>0){for(var O=x(N,M.args[0],D),_=1;_0){var O=N.args.filter(function(W){return M[W]===void 0}),_=O.length===1?O[0]:new u("*","multiply",O),C=D.concat(b(_,M));return new u("*","multiply",C)}return new u("+","add",N.args.map(function(W){return new u("*","multiply",N.args.map(function(q){return q===W?b(q,M):q.clone()}))}))}if(N.op==="/"&&N.isBinary()){var T=N.args[0],k=N.args[1];return M[k]!==void 0?new u("/","divide",[b(T,M),k]):M[T]!==void 0?new u("*","multiply",[new u("-","unaryMinus",[T]),new u("/","divide",[b(k,M),new u("^","pow",[k.clone(),E(2)])])]):new u("/","divide",[new u("-","subtract",[new u("*","multiply",[b(T,M),k.clone()]),new u("*","multiply",[T.clone(),b(k,M)])]),new u("^","pow",[k.clone(),E(2)])])}if(N.op==="^"&&N.isBinary()){var L=N.args[0],H=N.args[1];if(M[L]!==void 0)return wr(L)&&(s(L.value)||i(L.value,1))?E(0):new u("*","multiply",[N,new u("*","multiply",[new o("log",[L.clone()]),b(H.clone(),M)])]);if(M[H]!==void 0){if(wr(H)){if(s(H.value))return E(0);if(i(H.value,1))return b(L,M)}var V=new u("^","pow",[L.clone(),new u("-","subtract",[H,E(1)])]);return new u("*","multiply",[H.clone(),new u("*","multiply",[b(L,M),V])])}return new u("*","multiply",[new u("^","pow",[L.clone(),H.clone()]),new u("+","add",[new u("*","multiply",[b(L,M),new u("/","divide",[H.clone(),L.clone()])]),new u("*","multiply",[b(H,M),new o("log",[L.clone()])])])])}throw new Error('Cannot process operator "'+N.op+'" in derivative: the operator is not supported, undefined, or the number of arguments passed to it are not supported')}});function E(w,N){return new f(c(w,N||t.number))}return y});var m4="rationalize",iX=["config","typed","equal","isZero","add","subtract","multiply","divide","pow","parse","simplifyConstant","simplifyCore","simplify","?bignumber","?fraction","mathWithTransform","matrix","AccessorNode","ArrayNode","ConstantNode","FunctionNode","IndexNode","ObjectNode","OperatorNode","SymbolNode","ParenthesisNode"],n0=F(m4,iX,e=>{var{config:r,typed:t,equal:n,isZero:a,add:i,subtract:s,multiply:c,divide:f,pow:o,parse:u,simplifyConstant:m,simplifyCore:p,simplify:h,fraction:y,bignumber:v,mathWithTransform:x,matrix:b,AccessorNode:E,ArrayNode:w,ConstantNode:N,FunctionNode:M,IndexNode:D,ObjectNode:O,OperatorNode:_,SymbolNode:C,ParenthesisNode:T}=e;function k(q){var R=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},X=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,U=H(),oe=L(q,R,!0,U.firstRules),me=oe.variables.length,ae={exactFractions:!1},$={exactFractions:!0};if(q=oe.expression,me>=1){q=V(q);var ce,Ce,pe=!0,ge=!1;q=h(q,U.firstRules,{},ae);for(var Se;Ce=pe?U.distrDivRules:U.sucDivRules,q=h(q,Ce,{},$),pe=!pe,Se=q.toString(),Se!==ce;)ge=!0,ce=Se;ge&&(q=h(q,U.firstRulesAgain,{},ae)),q=h(q,U.finalRules,{},ae)}var ye=[],be={};return q.type==="OperatorNode"&&q.isBinary()&&q.op==="/"?(me===1&&(q.args[0]=W(q.args[0],ye),q.args[1]=W(q.args[1])),X&&(be.numerator=q.args[0],be.denominator=q.args[1])):(me===1&&(q=W(q,ye)),X&&(be.numerator=q,be.denominator=null)),X?(be.coefficients=ye,be.variables=oe.variables,be.expression=q,be):q}return t(m4,{Node:k,"Node, boolean":(q,R)=>k(q,{},R),"Node, Object":k,"Node, Object, boolean":k});function L(q,R,X,U){var oe=[],me=h(q,U,R,{exactFractions:!1});X=!!X;var ae="+-*"+(X?"/":"");ce(me);var $={};return $.expression=me,$.variables=oe,$;function ce(Ce){var pe=Ce.type;if(pe==="FunctionNode")throw new Error("There is an unsolved function call");if(pe==="OperatorNode")if(Ce.op==="^"){if(Ce.args[1].type!=="ConstantNode"||!Ze(parseFloat(Ce.args[1].value)))throw new Error("There is a non-integer exponent");ce(Ce.args[0])}else{if(ae.indexOf(Ce.op)===-1)throw new Error("Operator "+Ce.op+" invalid in polynomial expression");for(var ge=0;ge1;if(U==="OperatorNode"&&q.isBinary()){var me=!1,ae;if(q.op==="^"&&(q.args[0].type==="ParenthesisNode"||q.args[0].type==="OperatorNode")&&q.args[1].type==="ConstantNode"&&(ae=parseFloat(q.args[1].value),me=ae>=2&&Ze(ae)),me){if(ae>2){var $=q.args[0],ce=new _("^","pow",[q.args[0].cloneDeep(),new N(ae-1)]);q=new _("*","multiply",[$,ce])}else q=new _("*","multiply",[q.args[0],q.args[0].cloneDeep()]);oe&&(X==="content"?R.content=q:R.args[X]=q)}}if(U==="ParenthesisNode")V(q.content,q,"content");else if(U!=="ConstantNode"&&U!=="SymbolNode")for(var Ce=0;Ce=0;$--)if(R[$]!==0){var ce=new N(me?R[$]:Math.abs(R[$])),Ce=R[$]<0?"-":"+";if($>0){var pe=new C(oe);if($>1){var ge=new N($);pe=new _("^","pow",[pe,ge])}R[$]===-1&&me?ce=new _("-","unaryMinus",[pe]):Math.abs(R[$])===1?ce=pe:ce=new _("*","multiply",[ce,pe])}me?ae=ce:Ce==="+"?ae=new _("+","add",[ae,ce]):ae=new _("-","subtract",[ae,ce]),me=!1}if(me)return new N(0);return ae;function Se(ye,be,De){var Ae=ye.type;if(Ae==="FunctionNode")throw new Error("There is an unsolved function call");if(Ae==="OperatorNode"){if("+-*^".indexOf(ye.op)===-1)throw new Error("Operator "+ye.op+" invalid");if(be!==null){if((ye.fn==="unaryMinus"||ye.fn==="pow")&&be.fn!=="add"&&be.fn!=="subtract"&&be.fn!=="multiply")throw new Error("Invalid "+ye.op+" placing");if((ye.fn==="subtract"||ye.fn==="add"||ye.fn==="multiply")&&be.fn!=="add"&&be.fn!=="subtract")throw new Error("Invalid "+ye.op+" placing");if((ye.fn==="subtract"||ye.fn==="add"||ye.fn==="unaryMinus")&&De.noFil!==0)throw new Error("Invalid "+ye.op+" placing")}(ye.op==="^"||ye.op==="*")&&(De.fire=ye.op);for(var Ye=0;YeU&&(R[Ke]=0),R[Ke]+=De.cte*(De.oper==="+"?1:-1),U=Math.max(Ke,U);return}De.cte=Ke,De.fire===""&&(R[0]+=De.cte*(De.oper==="+"?1:-1))}else throw new Error("Type "+Ae+" is not allowed")}}});var p4="zpk2tf",oX=["typed","add","multiply","Complex","number"],a0=F(p4,oX,e=>{var{typed:r,add:t,multiply:n,Complex:a,number:i}=e;return r(p4,{"Array,Array,number":function(o,u,m){return s(o,u,m)},"Array,Array":function(o,u){return s(o,u,1)},"Matrix,Matrix,number":function(o,u,m){return s(o.valueOf(),u.valueOf(),m)},"Matrix,Matrix":function(o,u){return s(o.valueOf(),u.valueOf(),1)}});function s(f,o,u){f.some(E=>E.type==="BigNumber")&&(f=f.map(E=>i(E))),o.some(E=>E.type==="BigNumber")&&(o=o.map(E=>i(E)));for(var m=[a(1,0)],p=[a(1,0)],h=0;h=0&&m-p{var{typed:r,add:t,multiply:n,Complex:a,divide:i,matrix:s}=e;return r(d4,{"Array, Array":function(u,m){var p=f(512);return c(u,m,p)},"Array, Array, Array":function(u,m,p){return c(u,m,p)},"Array, Array, number":function(u,m,p){if(p<0)throw new Error("w must be a positive number");var h=f(p);return c(u,m,h)},"Matrix, Matrix":function(u,m){var p=f(512),{w:h,h:y}=c(u.valueOf(),m.valueOf(),p);return{w:s(h),h:s(y)}},"Matrix, Matrix, Matrix":function(u,m,p){var{h}=c(u.valueOf(),m.valueOf(),p.valueOf());return{h:s(h),w:s(p)}},"Matrix, Matrix, number":function(u,m,p){if(p<0)throw new Error("w must be a positive number");var h=f(p),{h:y}=c(u.valueOf(),m.valueOf(),h);return{h:s(y),w:s(h)}}});function c(o,u,m){for(var p=[],h=[],y=0;y{var{classes:r}=e;return function(n,a){var i=r[a&&a.mathjs];return i&&typeof i.fromJSON=="function"?i.fromJSON(a):a}});var lX="replacer",cX=[],s0=F(lX,cX,()=>function(r,t){return typeof t=="number"&&(!isFinite(t)||isNaN(t))?{mathjs:"number",value:String(t)}:t});var h4="12.4.1";var u0=F("true",[],()=>!0),f0=F("false",[],()=>!1),l0=F("null",[],()=>null),c0=Ia("Infinity",["config","?BigNumber"],e=>{var{config:r,BigNumber:t}=e;return r.number==="BigNumber"?new t(1/0):1/0}),m0=Ia("NaN",["config","?BigNumber"],e=>{var{config:r,BigNumber:t}=e;return r.number==="BigNumber"?new t(NaN):NaN}),p0=Ia("pi",["config","?BigNumber"],e=>{var{config:r,BigNumber:t}=e;return r.number==="BigNumber"?Ac(t):QE}),d0=Ia("tau",["config","?BigNumber"],e=>{var{config:r,BigNumber:t}=e;return r.number==="BigNumber"?g_(t):XE}),h0=Ia("e",["config","?BigNumber"],e=>{var{config:r,BigNumber:t}=e;return r.number==="BigNumber"?h_(t):KE}),v0=Ia("phi",["config","?BigNumber"],e=>{var{config:r,BigNumber:t}=e;return r.number==="BigNumber"?v_(t):JE}),g0=Ia("LN2",["config","?BigNumber"],e=>{var{config:r,BigNumber:t}=e;return r.number==="BigNumber"?new t(2).ln():Math.LN2}),y0=Ia("LN10",["config","?BigNumber"],e=>{var{config:r,BigNumber:t}=e;return r.number==="BigNumber"?new t(10).ln():Math.LN10}),x0=Ia("LOG2E",["config","?BigNumber"],e=>{var{config:r,BigNumber:t}=e;return r.number==="BigNumber"?new t(1).div(new t(2).ln()):Math.LOG2E}),b0=Ia("LOG10E",["config","?BigNumber"],e=>{var{config:r,BigNumber:t}=e;return r.number==="BigNumber"?new t(1).div(new t(10).ln()):Math.LOG10E}),w0=Ia("SQRT1_2",["config","?BigNumber"],e=>{var{config:r,BigNumber:t}=e;return r.number==="BigNumber"?new t("0.5").sqrt():Math.SQRT1_2}),D0=Ia("SQRT2",["config","?BigNumber"],e=>{var{config:r,BigNumber:t}=e;return r.number==="BigNumber"?new t(2).sqrt():Math.SQRT2}),S0=Ia("i",["Complex"],e=>{var{Complex:r}=e;return r.I}),v4=F("PI",["pi"],e=>{var{pi:r}=e;return r}),g4=F("E",["e"],e=>{var{e:r}=e;return r}),N0=F("version",[],()=>h4);function Ia(e,r,t){return F(e,r,t,{recreateOnConfigChange:!0})}var A0=_r("speedOfLight","299792458","m s^-1"),M0=_r("gravitationConstant","6.67430e-11","m^3 kg^-1 s^-2"),E0=_r("planckConstant","6.62607015e-34","J s"),C0=_r("reducedPlanckConstant","1.0545718176461565e-34","J s"),T0=_r("magneticConstant","1.25663706212e-6","N A^-2"),_0=_r("electricConstant","8.8541878128e-12","F m^-1"),F0=_r("vacuumImpedance","376.730313667","ohm"),O0=_r("coulomb","8.987551792261171e9","N m^2 C^-2"),B0=_r("elementaryCharge","1.602176634e-19","C"),I0=_r("bohrMagneton","9.2740100783e-24","J T^-1"),P0=_r("conductanceQuantum","7.748091729863649e-5","S"),R0=_r("inverseConductanceQuantum","12906.403729652257","ohm"),k0=_r("magneticFluxQuantum","2.0678338484619295e-15","Wb"),L0=_r("nuclearMagneton","5.0507837461e-27","J T^-1"),q0=_r("klitzing","25812.807459304513","ohm");var U0=_r("bohrRadius","5.29177210903e-11","m"),z0=_r("classicalElectronRadius","2.8179403262e-15","m"),Y0=_r("electronMass","9.1093837015e-31","kg"),W0=_r("fermiCoupling","1.1663787e-5","GeV^-2"),H0=wx("fineStructure",.0072973525693),$0=_r("hartreeEnergy","4.3597447222071e-18","J"),G0=_r("protonMass","1.67262192369e-27","kg"),V0=_r("deuteronMass","3.3435830926e-27","kg"),Z0=_r("neutronMass","1.6749271613e-27","kg"),Q0=_r("quantumOfCirculation","3.6369475516e-4","m^2 s^-1"),X0=_r("rydberg","10973731.568160","m^-1"),K0=_r("thomsonCrossSection","6.6524587321e-29","m^2"),J0=wx("weakMixingAngle",.2229),j0=wx("efimovFactor",22.7),ex=_r("atomicMass","1.66053906660e-27","kg"),rx=_r("avogadro","6.02214076e23","mol^-1"),tx=_r("boltzmann","1.380649e-23","J K^-1"),nx=_r("faraday","96485.33212331001","C mol^-1"),ax=_r("firstRadiation","3.7417718521927573e-16","W m^2"),ix=_r("loschmidt","2.686780111798444e25","m^-3"),ox=_r("gasConstant","8.31446261815324","J K^-1 mol^-1"),sx=_r("molarPlanckConstant","3.990312712893431e-10","J s mol^-1"),ux=_r("molarVolume","0.022413969545014137","m^3 mol^-1"),fx=wx("sackurTetrode",-1.16487052358),lx=_r("secondRadiation","0.014387768775039337","m K"),cx=_r("stefanBoltzmann","5.67037441918443e-8","W m^-2 K^-4"),mx=_r("wienDisplacement","2.897771955e-3","m K"),px=_r("molarMass","0.99999999965e-3","kg mol^-1"),dx=_r("molarMassC12","11.9999999958e-3","kg mol^-1"),hx=_r("gravity","9.80665","m s^-2"),vx=_r("planckLength","1.616255e-35","m"),gx=_r("planckMass","2.176435e-8","kg"),yx=_r("planckTime","5.391245e-44","s"),xx=_r("planckCharge","1.87554603778e-18","C"),bx=_r("planckTemperature","1.416785e+32","K");function _r(e,r,t){var n=["config","Unit","BigNumber"];return F(e,n,a=>{var{config:i,Unit:s,BigNumber:c}=a,f=i.number==="BigNumber"?new c(r):parseFloat(r),o=new s(f,t);return o.fixPrefix=!0,o})}function wx(e,r){var t=["config","BigNumber"];return F(e,t,n=>{var{config:a,BigNumber:i}=n;return a.number==="BigNumber"?new i(r):r})}var mX="apply",pX=["typed","isInteger"],Dx=F(mX,pX,e=>{var{typed:r,isInteger:t}=e,n=ls({typed:r,isInteger:t});return r("apply",{"...any":function(i){var s=i[1];ur(s)?i[1]=s-1:tr(s)&&(i[1]=s.minus(1));try{return n.apply(null,i)}catch(c){throw gt(c)}}})},{isTransformFunction:!0});var dX="column",hX=["typed","Index","matrix","range"],Sx=F(dX,hX,e=>{var{typed:r,Index:t,matrix:n,range:a}=e,i=Ef({typed:r,Index:t,matrix:n,range:a});return r("column",{"...any":function(c){var f=c.length-1,o=c[f];ur(o)&&(c[f]=o-1);try{return i.apply(null,c)}catch(u){throw gt(u)}}})},{isTransformFunction:!0});function Qf(e,r,t){var n=e.filter(function(f){return ft(f)&&!(f.name in r)&&!t.has(f.name)})[0];if(!n)throw new Error('No undefined variable found in inline expression "'+e+'"');var a=n.name,i=new Map,s=new pf(t,i,new Set([a])),c=e.compile();return function(o){return i.set(a,o),c.evaluate(s)}}var vX="filter",gX=["typed"],Nx=F(vX,gX,e=>{var{typed:r}=e;function t(a,i,s){var c,f;return a[0]&&(c=a[0].compile().evaluate(s)),a[1]&&(ft(a[1])||Xa(a[1])?f=a[1].compile().evaluate(s):f=Qf(a[1],i,s)),n(c,f)}t.rawArgs=!0;var n=r("filter",{"Array, function":y4,"Matrix, function":function(i,s){return i.create(y4(i.toArray(),s))},"Array, RegExp":cf,"Matrix, RegExp":function(i,s){return i.create(cf(i.toArray(),s))}});return t},{isTransformFunction:!0});function y4(e,r){return Bp(e,function(t,n,a){return ei(r,t,[n+1],a,"filter")})}var yX="forEach",xX=["typed"],Ax=F(yX,xX,e=>{var{typed:r}=e;function t(a,i,s){var c,f;return a[0]&&(c=a[0].compile().evaluate(s)),a[1]&&(ft(a[1])||Xa(a[1])?f=a[1].compile().evaluate(s):f=Qf(a[1],i,s)),n(c,f)}t.rawArgs=!0;var n=r("forEach",{"Array | Matrix, function":function(i,s){var c=function f(o,u){if(Array.isArray(o))ts(o,function(m,p){f(m,u.concat(p+1))});else return ei(s,o,u,i,"forEach")};c(i.valueOf(),[])}});return t},{isTransformFunction:!0});var bX="index",wX=["Index","getMatrixDataType"],Mx=F(bX,wX,e=>{var{Index:r,getMatrixDataType:t}=e;return function(){for(var a=[],i=0,s=arguments.length;i0?0:2;else if(c&&c.isSet===!0)c=c.map(function(o){return o-1});else if(Cr(c)||Qe(c))t(c)!=="boolean"&&(c=c.map(function(o){return o-1}));else if(ur(c))c--;else if(tr(c))c=c.toNumber()-1;else if(typeof c!="string")throw new TypeError("Dimension must be an Array, Matrix, number, string, or Range");a[i]=c}var f=new r;return r.apply(f,a),f}},{isTransformFunction:!0});var DX="map",SX=["typed"],Ex=F(DX,SX,e=>{var{typed:r}=e;function t(a,i,s){var c,f;return a[0]&&(c=a[0].compile().evaluate(s)),a[1]&&(ft(a[1])||Xa(a[1])?f=a[1].compile().evaluate(s):f=Qf(a[1],i,s)),n(c,f)}t.rawArgs=!0;var n=r("map",{"Array, function":function(i,s){return x4(i,s,i)},"Matrix, function":function(i,s){return i.create(x4(i.valueOf(),s,i))}});return t},{isTransformFunction:!0});function x4(e,r,t){function n(a,i){return Array.isArray(a)?ca(a,function(s,c){return n(s,i.concat(c+1))}):ei(r,a,i,t,"map")}return n(e,[])}function zn(e){if(e.length===2&&_t(e[0])){e=e.slice();var r=e[1];ur(r)?e[1]=r-1:tr(r)&&(e[1]=r.minus(1))}return e}var NX="max",AX=["typed","config","numeric","larger"],Cx=F(NX,AX,e=>{var{typed:r,config:t,numeric:n,larger:a}=e,i=qf({typed:r,config:t,numeric:n,larger:a});return r("max",{"...any":function(c){c=zn(c);try{return i.apply(null,c)}catch(f){throw gt(f)}}})},{isTransformFunction:!0});var MX="mean",EX=["typed","add","divide"],Tx=F(MX,EX,e=>{var{typed:r,add:t,divide:n}=e,a=Hf({typed:r,add:t,divide:n});return r("mean",{"...any":function(s){s=zn(s);try{return a.apply(null,s)}catch(c){throw gt(c)}}})},{isTransformFunction:!0});var CX="min",TX=["typed","config","numeric","smaller"],_x=F(CX,TX,e=>{var{typed:r,config:t,numeric:n,smaller:a}=e,i=Uf({typed:r,config:t,numeric:n,smaller:a});return r("min",{"...any":function(c){c=zn(c);try{return i.apply(null,c)}catch(f){throw gt(f)}}})},{isTransformFunction:!0});var _X="range",FX=["typed","config","?matrix","?bignumber","smaller","smallerEq","larger","largerEq","add","isPositive"],Fx=F(_X,FX,e=>{var{typed:r,config:t,matrix:n,bignumber:a,smaller:i,smallerEq:s,larger:c,largerEq:f,add:o,isPositive:u}=e,m=_f({typed:r,config:t,matrix:n,bignumber:a,smaller:i,smallerEq:s,larger:c,largerEq:f,add:o,isPositive:u});return r("range",{"...any":function(h){var y=h.length-1,v=h[y];return typeof v!="boolean"&&h.push(!0),m.apply(null,h)}})},{isTransformFunction:!0});var OX="row",BX=["typed","Index","matrix","range"],Ox=F(OX,BX,e=>{var{typed:r,Index:t,matrix:n,range:a}=e,i=Ff({typed:r,Index:t,matrix:n,range:a});return r("row",{"...any":function(c){var f=c.length-1,o=c[f];ur(o)&&(c[f]=o-1);try{return i.apply(null,c)}catch(u){throw gt(u)}}})},{isTransformFunction:!0});var IX="subset",PX=["typed","matrix","zeros","add"],Bx=F(IX,PX,e=>{var{typed:r,matrix:t,zeros:n,add:a}=e,i=Of({typed:r,matrix:t,zeros:n,add:a});return r("subset",{"...any":function(c){try{return i.apply(null,c)}catch(f){throw gt(f)}}})},{isTransformFunction:!0});var RX="concat",kX=["typed","matrix","isInteger"],Ix=F(RX,kX,e=>{var{typed:r,matrix:t,isInteger:n}=e,a=Mf({typed:r,matrix:t,isInteger:n});return r("concat",{"...any":function(s){var c=s.length-1,f=s[c];ur(f)?s[c]=f-1:tr(f)&&(s[c]=f.minus(1));try{return a.apply(null,s)}catch(o){throw gt(o)}}})},{isTransformFunction:!0});var b4="diff",LX=["typed","matrix","subtract","number","bignumber"],Px=F(b4,LX,e=>{var{typed:r,matrix:t,subtract:n,number:a,bignumber:i}=e,s=Cf({typed:r,matrix:t,subtract:n,number:a,bignumber:i});return r(b4,{"...any":function(f){f=zn(f);try{return s.apply(null,f)}catch(o){throw gt(o)}}})},{isTransformFunction:!0});var qX="std",UX=["typed","map","sqrt","variance"],Rx=F(qX,UX,e=>{var{typed:r,map:t,sqrt:n,variance:a}=e,i=Vf({typed:r,map:t,sqrt:n,variance:a});return r("std",{"...any":function(c){c=zn(c);try{return i.apply(null,c)}catch(f){throw gt(f)}}})},{isTransformFunction:!0});var w4="sum",zX=["typed","config","add","numeric"],kx=F(w4,zX,e=>{var{typed:r,config:t,add:n,numeric:a}=e,i=Yf({typed:r,config:t,add:n,numeric:a});return r(w4,{"...any":function(c){c=zn(c);try{return i.apply(null,c)}catch(f){throw gt(f)}}})},{isTransformFunction:!0});var YX="quantileSeq",WX=["typed","bignumber","add","subtract","divide","multiply","partitionSelect","compare","isInteger","smaller","smallerEq","larger"],Lx=F(YX,WX,e=>{var{typed:r,bignumber:t,add:n,subtract:a,divide:i,multiply:s,partitionSelect:c,compare:f,isInteger:o,smaller:u,smallerEq:m,larger:p}=e,h=Gf({typed:r,bignumber:t,add:n,subtract:a,divide:i,multiply:s,partitionSelect:c,compare:f,isInteger:o,smaller:u,smallerEq:m,larger:p});return r("quantileSeq",{"Array | Matrix, number | BigNumber":h,"Array | Matrix, number | BigNumber, number":(v,x,b)=>h(v,x,y(b)),"Array | Matrix, number | BigNumber, boolean":h,"Array | Matrix, number | BigNumber, boolean, number":(v,x,b,E)=>h(v,x,b,y(E)),"Array | Matrix, Array | Matrix":h,"Array | Matrix, Array | Matrix, number":(v,x,b)=>h(v,x,y(b)),"Array | Matrix, Array | Matrix, boolean":h,"Array | Matrix, Array | Matrix, boolean, number":(v,x,b,E)=>h(v,x,b,y(E))});function y(v){return zn([[],v])[1]}},{isTransformFunction:!0});var D4="cumsum",HX=["typed","add","unaryPlus"],qx=F(D4,HX,e=>{var{typed:r,add:t,unaryPlus:n}=e,a=Wf({typed:r,add:t,unaryPlus:n});return r(D4,{"...any":function(s){if(s.length===2&&_t(s[0])){var c=s[1];ur(c)?s[1]=c-1:tr(c)&&(s[1]=c.minus(1))}try{return a.apply(null,s)}catch(f){throw gt(f)}}})},{isTransformFunction:!0});var S4="variance",$X=["typed","add","subtract","multiply","divide","apply","isNaN"],Ux=F(S4,$X,e=>{var{typed:r,add:t,subtract:n,multiply:a,divide:i,apply:s,isNaN:c}=e,f=$f({typed:r,add:t,subtract:n,multiply:a,divide:i,apply:s,isNaN:c});return r(S4,{"...any":function(u){u=zn(u);try{return f.apply(null,u)}catch(m){throw gt(m)}}})},{isTransformFunction:!0});var N4="print",GX=["typed","matrix","zeros","add"],zx=F(N4,GX,e=>{var{typed:r,matrix:t,zeros:n,add:a}=e,i=If({typed:r,matrix:t,zeros:n,add:a});return r(N4,{"string, Object | Array":function(f,o){return i(s(f),o)},"string, Object | Array, number | Object":function(f,o,u){return i(s(f),o,u)}});function s(c){return c.replace(qh,f=>{var o=f.slice(1).split("."),u=o.map(function(m){return!isNaN(m)&&m.length>0?parseInt(m)-1:m});return"$"+u.join(".")})}},{isTransformFunction:!0});var VX="and",ZX=["typed","matrix","zeros","add","equalScalar","not","concat"],Yx=F(VX,ZX,e=>{var{typed:r,matrix:t,equalScalar:n,zeros:a,not:i,concat:s}=e,c=Lf({typed:r,matrix:t,equalScalar:n,zeros:a,not:i,concat:s});function f(o,u,m){var p=o[0].compile().evaluate(m);if(!_t(p)&&!c(p,!0))return!1;var h=o[1].compile().evaluate(m);return c(p,h)}return f.rawArgs=!0,f},{isTransformFunction:!0});var QX="or",XX=["typed","matrix","equalScalar","DenseMatrix","concat"],Wx=F(QX,XX,e=>{var{typed:r,matrix:t,equalScalar:n,DenseMatrix:a,concat:i}=e,s=Af({typed:r,matrix:t,equalScalar:n,DenseMatrix:a,concat:i});function c(f,o,u){var m=f[0].compile().evaluate(u);if(!_t(m)&&s(m,!1))return!0;var p=f[1].compile().evaluate(u);return s(m,p)}return c.rawArgs=!0,c},{isTransformFunction:!0});var KX="bitAnd",JX=["typed","matrix","zeros","add","equalScalar","not","concat"],Hx=F(KX,JX,e=>{var{typed:r,matrix:t,equalScalar:n,zeros:a,not:i,concat:s}=e,c=Sf({typed:r,matrix:t,equalScalar:n,zeros:a,not:i,concat:s});function f(o,u,m){var p=o[0].compile().evaluate(m);if(!_t(p)){if(isNaN(p))return NaN;if(p===0||p===!1)return 0}var h=o[1].compile().evaluate(m);return c(p,h)}return f.rawArgs=!0,f},{isTransformFunction:!0});var jX="bitOr",eK=["typed","matrix","equalScalar","DenseMatrix","concat"],$x=F(jX,eK,e=>{var{typed:r,matrix:t,equalScalar:n,DenseMatrix:a,concat:i}=e,s=Nf({typed:r,matrix:t,equalScalar:n,DenseMatrix:a,concat:i});function c(f,o,u){var m=f[0].compile().evaluate(u);if(!_t(m)){if(isNaN(m))return NaN;if(m===-1)return-1;if(m===!0)return 1}var p=f[1].compile().evaluate(u);return s(m,p)}return c.rawArgs=!0,c},{isTransformFunction:!0});var Ge=$p({config:Oe}),yt=Gp({}),GS=h0({BigNumber:Ge,config:Oe}),A4=f0({}),M4=H0({BigNumber:Ge,config:Oe}),ps=Vp({}),VS=S0({Complex:yt}),E4=c0({BigNumber:Ge,config:Oe}),C4=y0({BigNumber:Ge,config:Oe}),T4=b0({BigNumber:Ge,config:Oe}),Tc=Qp({}),_4=m0({BigNumber:Ge,config:Oe}),F4=l0({}),O4=v0({BigNumber:Ge,config:Oe}),B4=Zp({}),ZS=kp({}),I4=w0({BigNumber:Ge,config:Oe}),P4=fx({BigNumber:Ge,config:Oe}),QS=d0({BigNumber:Ge,config:Oe}),R4=u0({}),k4=N0({}),Or=Kp({Matrix:Tc}),L4=j0({BigNumber:Ge,config:Oe}),q4=g0({BigNumber:Ge,config:Oe}),Gx=p0({BigNumber:Ge,config:Oe}),U4=s0({}),z4=D0({BigNumber:Ge,config:Oe}),te=Rp({BigNumber:Ge,Complex:yt,DenseMatrix:Or,Fraction:ps}),Vx=Ad({BigNumber:Ge,config:Oe,typed:te}),Y4=J0({BigNumber:Ge,config:Oe}),Yn=Md({typed:te}),W4=Bv({Complex:yt,config:Oe,typed:te}),H4=Pv({BigNumber:Ge,typed:te}),$4=kv({BigNumber:Ge,Complex:yt,config:Oe,typed:te}),nn=Cd({typed:te}),G4=eh({typed:te}),V4=Uv({BigNumber:Ge,Complex:yt,config:Oe,typed:te}),Z4=Yv({typed:te}),XS=Wv({typed:te}),Q4=$v({Complex:yt,config:Oe,typed:te}),ha=vd({BigNumber:Ge,typed:te}),X4=Jd({typed:te}),K4=hd({typed:te}),J4=Jp({typed:te}),_c=Iy({typed:te}),Fc=gd({Complex:yt,typed:te}),ds=rh({typed:te}),Zx=Gv({typed:te}),j4=Zv({BigNumber:Ge,typed:te}),eR=Xv({BigNumber:Ge,typed:te}),rR=Od({typed:te}),Rr=cd({config:Oe,typed:te}),tR=Fh({typed:te}),KS=Bd({typed:te}),nR=Id({Complex:yt,typed:te}),aR=fh({typed:te}),iR=ch({typed:te}),Xf=Ph({typed:te}),Qx=mh({typed:te}),oR=Lh({format:Xf,typed:te}),Xx=th({typed:te}),ea=rd({typed:te}),Co=nd({typed:te}),hs=od({typed:te}),ni=sd({typed:te}),sR=x0({BigNumber:Ge,config:Oe}),uR=ky({Complex:yt,typed:te}),fR=Ld({Complex:yt,config:Oe,typed:te}),JS=qd({Complex:yt,config:Oe,typed:te}),vs=hh({typed:te}),Lt=Ud({typed:te}),Oc=ah({typed:te}),Ji=pd({typed:te}),lR=kh({format:Xf,typed:te}),cR=Wy({config:Oe,typed:te}),mR=If({typed:te}),pR=Hy({config:Oe,typed:te}),Kx=nh({typed:te}),dR=Jv({BigNumber:Ge,typed:te}),jS=Wd({BigNumber:Ge,Fraction:ps,complex:Fc,typed:te}),Bc=eg({typed:te}),ji=md({Matrix:Tc,equalScalar:Rr,typed:te}),hR=Sd({typed:te}),vR=$d({typed:te}),gR=dd({typed:te}),Pa=Td({typed:te}),yR=tg({typed:te}),eN=fd({typed:te}),xR=Iv({Complex:yt,config:Oe,typed:te}),bR=Lv({BigNumber:Ge,typed:te}),Jx=ls({isInteger:ea,typed:te}),wR=qv({BigNumber:Ge,Complex:yt,config:Oe,typed:te}),DR=Rh({format:Xf,typed:te}),SR=Py({typed:te}),NR=Vv({typed:te}),AR=Kv({BigNumber:Ge,typed:te}),Kf=ud({typed:te}),MR=zh({typed:te}),ER=$y({config:Oe,typed:te}),CR=jv({BigNumber:Ge,typed:te}),TR=rg({typed:te}),_R=Fv({SparseMatrix:ji,typed:te}),ai=Hd({Complex:yt,config:Oe,typed:te}),FR=ng({typed:te}),Ei=Nd({typed:te}),OR=Rv({BigNumber:Ge,Complex:yt,config:Oe,typed:te}),BR=Qv({BigNumber:Ge,typed:te}),cu=yd({Fraction:ps,typed:te}),gs=ad({typed:te}),$e=xd({DenseMatrix:Or,Matrix:Tc,SparseMatrix:ji,typed:te}),IR=bd({isZero:ni,matrix:$e,typed:te}),PR=Bh({isNaN:Kf,isNumeric:gs,typed:te}),ii=Yh({bignumber:ha,fraction:cu,number:Ji}),rN=Ih({config:Oe,multiplyScalar:Lt,numeric:ii,typed:te}),tN=xh({isInteger:ea,matrix:$e,typed:te}),yn=Sh({matrix:$e,config:Oe,typed:te}),RR=Nh({matrix:$e,typed:te}),Jf=Ah({matrix:$e,typed:te}),nN=Vd({BigNumber:Ge,config:Oe,matrix:$e,typed:te}),xn=Eh({BigNumber:Ge,config:Oe,matrix:$e,typed:te}),kR=zv({Complex:yt,config:Oe,typed:te}),aN=_d({BigNumber:Ge,Complex:yt,Fraction:ps,config:Oe,isNegative:Co,matrix:$e,typed:te,unaryMinus:Ei}),Qr=Mf({isInteger:ea,matrix:$e,typed:te}),LR=oh({prod:rN,size:yn,typed:te}),jx=Mh({conj:ds,transpose:Jf,typed:te}),iN=uh({DenseMatrix:Or,SparseMatrix:ji,matrix:$e,typed:te}),Ot=Wh({numeric:ii,typed:te}),jf=Xh({DenseMatrix:Or,concat:Qr,divideScalar:Ot,equalScalar:Rr,matrix:$e,typed:te}),Ra=fv({DenseMatrix:Or,concat:Qr,equalScalar:Rr,matrix:$e,typed:te}),el=lh({matrix:$e,typed:te}),qR=id({isNumeric:gs,typed:te}),To=ph({BigNumber:Ge,DenseMatrix:Or,SparseMatrix:ji,config:Oe,matrix:$e,typed:te}),UR=dh({matrix:$e,multiplyScalar:Lt,typed:te}),Ic=yv({DenseMatrix:Or,concat:Qr,config:Oe,matrix:$e,typed:te}),zR=rv({DenseMatrix:Or,concat:Qr,equalScalar:Rr,matrix:$e,typed:te,zeros:xn}),oN=Kh({DenseMatrix:Or,divideScalar:Ot,equalScalar:Rr,matrix:$e,multiplyScalar:Lt,subtractScalar:Pa,typed:te}),e1=Dd({flatten:el,matrix:$e,size:yn,typed:te}),YR=Yd({BigNumber:Ge,concat:Qr,equalScalar:Rr,matrix:$e,typed:te}),WR=vh({BigNumber:Ge,config:Oe,matrix:$e,typed:te}),r1=uy({addScalar:nn,complex:Fc,conj:ds,divideScalar:Ot,equal:Ra,identity:To,isZero:ni,matrix:$e,multiplyScalar:Lt,sign:jS,sqrt:ai,subtractScalar:Pa,typed:te,unaryMinus:Ei,zeros:xn}),HR=bh({config:Oe,matrix:$e}),$R=tv({DenseMatrix:Or,concat:Qr,equalScalar:Rr,matrix:$e,typed:te,zeros:xn}),mu=$h({BigNumber:Ge,DenseMatrix:Or,config:Oe,equalScalar:Rr,matrix:$e,typed:te,zeros:xn}),Wn=mv({DenseMatrix:Or,concat:Qr,config:Oe,matrix:$e,typed:te}),qt=Gd({DenseMatrix:Or,concat:Qr,equalScalar:Rr,matrix:$e,subtractScalar:Pa,typed:te,unaryMinus:Ei}),GR=Uh({concat:Qr,matrix:$e,typed:te}),VR=wv({DenseMatrix:Or,concat:Qr,config:Oe,equalScalar:Rr,matrix:$e,typed:te}),t1=Jh({DenseMatrix:Or,divideScalar:Ot,equalScalar:Rr,matrix:$e,multiplyScalar:Lt,subtractScalar:Pa,typed:te}),ZR=ih({DenseMatrix:Or,concat:Qr,matrix:$e,typed:te}),Ur=dg({DenseMatrix:Or,SparseMatrix:ji,addScalar:nn,concat:Qr,equalScalar:Rr,matrix:$e,typed:te}),QR=Hv({BigNumber:Ge,DenseMatrix:Or,concat:Qr,equalScalar:Rr,matrix:$e,typed:te}),XR=Sf({concat:Qr,equalScalar:Rr,matrix:$e,typed:te}),KR=Nf({DenseMatrix:Or,concat:Qr,equalScalar:Rr,matrix:$e,typed:te}),JR=jd({DenseMatrix:Or,concat:Qr,matrix:$e,typed:te}),jR=Zy({addScalar:nn,combinations:_c,divideScalar:Ot,isInteger:ea,isNegative:Co,multiplyScalar:Lt,typed:te}),ys=iv({BigNumber:Ge,DenseMatrix:Or,Fraction:ps,concat:Qr,config:Oe,equalScalar:Rr,matrix:$e,typed:te}),sN=sv({concat:Qr,matrix:$e,typed:te}),e5=Wf({add:Ur,typed:te,unaryPlus:Vx}),n1=xv({equal:Ra,typed:te}),r5=Cf({matrix:$e,number:Ji,subtract:qt,typed:te}),t5=Cy({abs:Yn,addScalar:nn,deepEqual:n1,divideScalar:Ot,multiplyScalar:Lt,sqrt:ai,subtractScalar:Pa,typed:te}),Pc=gg({addScalar:nn,conj:ds,multiplyScalar:Lt,size:yn,typed:te}),n5=lv({compareText:sN,isZero:ni,typed:te}),uN=xf({DenseMatrix:Or,config:Oe,equalScalar:Rr,matrix:$e,round:mu,typed:te,zeros:xn}),a5=Rd({BigNumber:Ge,DenseMatrix:Or,concat:Qr,config:Oe,equalScalar:Rr,matrix:$e,round:mu,typed:te,zeros:xn}),i5=hg({abs:Yn,addScalar:nn,divideScalar:Ot,isPositive:hs,multiplyScalar:Lt,smaller:Wn,sqrt:ai,typed:te}),fN=Nv({DenseMatrix:Or,smaller:Wn}),_n=Av({ImmutableDenseMatrix:fN,getMatrixDataType:Qx}),Hn=vv({DenseMatrix:Or,concat:Qr,config:Oe,matrix:$e,typed:te}),a1=Gh({Complex:yt,config:Oe,divideScalar:Ot,typed:te}),o5=jh({DenseMatrix:Or,divideScalar:Ot,equalScalar:Rr,matrix:$e,multiplyScalar:Lt,subtractScalar:Pa,typed:te}),s5=wd({flatten:el,matrix:$e,size:yn,typed:te}),u5=Uf({config:Oe,numeric:ii,smaller:Wn,typed:te}),lN=bf({DenseMatrix:Or,concat:Qr,config:Oe,equalScalar:Rr,matrix:$e,round:mu,typed:te,zeros:xn}),lt=zd({addScalar:nn,dot:Pc,equalScalar:Rr,matrix:$e,multiplyScalar:Lt,typed:te}),f5=Zh({Complex:yt,config:Oe,divideScalar:Ot,typed:te}),l5=Af({DenseMatrix:Or,concat:Qr,equalScalar:Rr,matrix:$e,typed:te}),Rc=Dv({compare:ys,isNaN:Kf,isNumeric:gs,typed:te}),c5=nv({DenseMatrix:Or,concat:Qr,equalScalar:Rr,matrix:$e,typed:te,zeros:xn}),cN=cy({SparseMatrix:ji,abs:Yn,add:Ur,divideScalar:Ot,larger:Hn,largerEq:Ic,multiply:lt,subtract:qt,transpose:Jf,typed:te}),va=Of({add:Ur,matrix:$e,typed:te,zeros:xn}),i1=Yf({add:Ur,config:Oe,numeric:ii,typed:te}),m5=yg({add:Ur,matrix:$e,typed:te}),mN=ev({DenseMatrix:Or,divideScalar:Ot,equalScalar:Rr,matrix:$e,multiplyScalar:Lt,subtractScalar:Pa,typed:te}),p5=a0({Complex:yt,add:Ur,multiply:lt,number:Ji,typed:te}),o1=Fd({DenseMatrix:Or,config:Oe,equalScalar:Rr,matrix:$e,round:mu,typed:te,zeros:xn}),Ci=ov({compare:ys,typed:te}),d5=Qy({addScalar:nn,combinations:_c,isInteger:ea,isNegative:Co,isPositive:hs,larger:Hn,typed:te}),h5=sh({matrix:$e,multiply:lt,subtract:qt,typed:te}),pN=yy({divideScalar:Ot,isZero:ni,matrix:$e,multiply:lt,subtractScalar:Pa,typed:te,unaryMinus:Ei}),v5=Xd({concat:Qr,equalScalar:Rr,matrix:$e,multiplyScalar:Lt,typed:te}),dN=Mv({larger:Hn,smaller:Wn}),hN=Pd({Complex:yt,DenseMatrix:Or,ceil:o1,equalScalar:Rr,floor:uN,matrix:$e,typed:te,zeros:xn}),vN=xg({Index:_n,typed:te}),g5=Ty({abs:Yn,add:Ur,addScalar:nn,config:Oe,divideScalar:Ot,equalScalar:Rr,flatten:el,isNumeric:gs,isZero:ni,matrix:$e,multiply:lt,multiplyScalar:Lt,smaller:Wn,subtract:qt,typed:te}),y5=Zd({BigNumber:Ge,add:Ur,config:Oe,equal:Ra,isInteger:ea,mod:lN,smaller:Wn,typed:te,xgcd:nN}),x5=kd({concat:Qr,equalScalar:Rr,matrix:$e,typed:te}),b5=Vh({Complex:yt,config:Oe,divideScalar:Ot,log:a1,typed:te}),s1=qf({config:Oe,larger:Hn,numeric:ii,typed:te}),w5=ag({DenseMatrix:Or,Index:_n,compareNatural:Ci,size:yn,subset:va,typed:te}),D5=og({DenseMatrix:Or,Index:_n,compareNatural:Ci,size:yn,subset:va,typed:te}),S5=ug({Index:_n,compareNatural:Ci,size:yn,subset:va,typed:te}),N5=lg({Index:_n,compareNatural:Ci,size:yn,subset:va,typed:te}),pu=dv({DenseMatrix:Or,concat:Qr,config:Oe,matrix:$e,typed:te}),A5=Sv({compare:ys,compareNatural:Ci,matrix:$e,typed:te}),M5=Lf({concat:Qr,equalScalar:Rr,matrix:$e,not:Oc,typed:te,zeros:xn}),du=_f({bignumber:ha,matrix:$e,add:Ur,config:Oe,isPositive:hs,larger:Hn,largerEq:Ic,smaller:Wn,smallerEq:pu,typed:te}),E5=Ff({Index:_n,matrix:$e,range:du,typed:te}),gN=ig({DenseMatrix:Or,Index:_n,compareNatural:Ci,size:yn,subset:va,typed:te}),C5=fg({Index:_n,compareNatural:Ci,size:yn,subset:va,typed:te}),yN=mg({Index:_n,concat:Qr,setDifference:gN,size:yn,subset:va,typed:te}),xN=Ev({FibonacciHeap:dN,addScalar:nn,equalScalar:Rr}),bN=Ef({Index:_n,matrix:$e,range:du,typed:te}),xs=xy({abs:Yn,addScalar:nn,det:pN,divideScalar:Ot,identity:To,matrix:$e,multiply:lt,typed:te,unaryMinus:Ei}),wN=sy({DenseMatrix:Or,Spa:xN,SparseMatrix:ji,abs:Yn,addScalar:nn,divideScalar:Ot,equalScalar:Rr,larger:Hn,matrix:$e,multiplyScalar:Lt,subtractScalar:Pa,typed:te,unaryMinus:Ei}),T5=by({Complex:yt,add:Ur,ctranspose:jx,deepEqual:n1,divideScalar:Ot,dot:Pc,dotDivide:jf,equal:Ra,inv:xs,matrix:$e,multiply:lt,typed:te}),ka=Hh({Complex:yt,config:Oe,fraction:cu,identity:To,inv:xs,matrix:$e,multiply:lt,number:Ji,typed:te}),DN=sg({DenseMatrix:Or,Index:_n,compareNatural:Ci,size:yn,subset:va,typed:te}),_5=pg({Index:_n,concat:Qr,setIntersect:DN,setSymDifference:yN,size:yn,subset:va,typed:te}),F5=Sy({abs:Yn,add:Ur,identity:To,inv:xs,map:vs,max:s1,multiply:lt,size:yn,sqrt:ai,subtract:qt,typed:te}),Sr=Tv({BigNumber:Ge,Complex:yt,Fraction:ps,abs:Yn,addScalar:nn,config:Oe,divideScalar:Ot,equal:Ra,fix:hN,format:Xf,isNumeric:gs,multiplyScalar:Lt,number:Ji,pow:ka,round:mu,subtractScalar:Pa}),O5=F0({BigNumber:Ge,Unit:Sr,config:Oe}),B5=mx({BigNumber:Ge,Unit:Sr,config:Oe}),I5=ex({BigNumber:Ge,Unit:Sr,config:Oe}),P5=I0({BigNumber:Ge,Unit:Sr,config:Oe}),R5=tx({BigNumber:Ge,Unit:Sr,config:Oe}),k5=P0({BigNumber:Ge,Unit:Sr,config:Oe}),L5=O0({BigNumber:Ge,Unit:Sr,config:Oe}),q5=V0({BigNumber:Ge,Unit:Sr,config:Oe}),U5=Qh({DenseMatrix:Or,concat:Qr,equalScalar:Rr,matrix:$e,pow:ka,typed:te}),z5=_0({BigNumber:Ge,Unit:Sr,config:Oe}),Y5=B0({BigNumber:Ge,Unit:Sr,config:Oe}),W5=Dy({abs:Yn,add:Ur,identity:To,inv:xs,multiply:lt,typed:te}),H5=nx({BigNumber:Ge,Unit:Sr,config:Oe}),SN=Ch({addScalar:nn,ceil:o1,conj:ds,divideScalar:Ot,dotDivide:jf,exp:KS,i:VS,log2:JS,matrix:$e,multiplyScalar:Lt,pow:ka,tau:QS,typed:te}),u1=Ry({BigNumber:Ge,Complex:yt,config:Oe,multiplyScalar:Lt,pow:ka,typed:te}),$5=M0({BigNumber:Ge,Unit:Sr,config:Oe}),G5=$0({BigNumber:Ge,Unit:Sr,config:Oe}),V5=Th({conj:ds,dotDivide:jf,fft:SN,typed:te}),Z5=q0({BigNumber:Ge,Unit:Sr,config:Oe}),Q5=ix({BigNumber:Ge,Unit:Sr,config:Oe}),X5=T0({BigNumber:Ge,Unit:Sr,config:Oe}),K5=px({BigNumber:Ge,Unit:Sr,config:Oe}),J5=sx({BigNumber:Ge,Unit:Sr,config:Oe}),j5=Z0({BigNumber:Ge,Unit:Sr,config:Oe}),ek=L0({BigNumber:Ge,Unit:Sr,config:Oe}),rk=xx({BigNumber:Ge,Unit:Sr,config:Oe}),tk=vx({BigNumber:Ge,Unit:Sr,config:Oe}),nk=bx({BigNumber:Ge,Unit:Sr,config:Oe}),ak=G0({BigNumber:Ge,Unit:Sr,config:Oe}),ik=Q0({BigNumber:Ge,Unit:Sr,config:Oe}),ok=C0({BigNumber:Ge,Unit:Sr,config:Oe}),sk=X0({BigNumber:Ge,Unit:Sr,config:Oe}),uk=lx({BigNumber:Ge,Unit:Sr,config:Oe}),fk=A0({BigNumber:Ge,Unit:Sr,config:Oe}),lk=cx({BigNumber:Ge,Unit:Sr,config:Oe}),ck=K0({BigNumber:Ge,Unit:Sr,config:Oe}),mk=rx({BigNumber:Ge,Unit:Sr,config:Oe}),pk=U0({BigNumber:Ge,Unit:Sr,config:Oe}),dk=Ov({Unit:Sr,typed:te}),pn=Ey({divideScalar:Ot,equalScalar:Rr,inv:xs,matrix:$e,multiply:lt,typed:te}),hk=Y0({BigNumber:Ge,Unit:Sr,config:Oe}),rl=Ly({gamma:u1,typed:te}),vk=ax({BigNumber:Ge,Unit:Sr,config:Oe}),gk=hx({BigNumber:Ge,Unit:Sr,config:Oe}),yk=R0({BigNumber:Ge,Unit:Sr,config:Oe}),NN=my({DenseMatrix:Or,lsolve:oN,lup:wN,matrix:$e,slu:cN,typed:te,usolve:t1}),xk=k0({BigNumber:Ge,Unit:Sr,config:Oe}),bk=dx({BigNumber:Ge,Unit:Sr,config:Oe}),wk=Uy({add:Ur,divide:pn,factorial:rl,isInteger:ea,isPositive:hs,multiply:lt,typed:te}),Dk=zy({factorial:rl,typed:te}),Sk=gx({BigNumber:Ge,Unit:Sr,config:Oe}),Nk=py({add:Ur,cbrt:aN,divide:pn,equalScalar:Rr,im:Xx,isZero:ni,multiply:lt,re:Kx,sqrt:ai,subtract:qt,typeOf:eN,typed:te,unaryMinus:Ei}),Ak=cg({compareNatural:Ci,typed:te}),Mk=_h({abs:Yn,add:Ur,bignumber:ha,divide:pn,isNegative:Co,isPositive:hs,larger:Hn,map:vs,matrix:$e,max:s1,multiply:lt,smaller:Wn,subtract:qt,typed:te,unaryMinus:Ei}),AN=Gy({bignumber:ha,addScalar:nn,combinations:_c,divideScalar:Ot,factorial:rl,isInteger:ea,isNegative:Co,larger:Hn,multiplyScalar:Lt,number:Ji,pow:ka,subtractScalar:Pa,typed:te}),Ek=_v({Unit:Sr,typed:te}),Ck=Vy({addScalar:nn,isInteger:ea,isNegative:Co,stirlingS2:AN,typed:te}),MN=wy({abs:Yn,add:Ur,addScalar:nn,atan:XS,bignumber:ha,column:bN,complex:Fc,config:Oe,cos:Zx,diag:iN,divideScalar:Ot,dot:Pc,equal:Ra,flatten:el,im:Xx,inv:xs,larger:Hn,matrix:$e,matrixFromColumns:e1,multiply:lt,multiplyScalar:Lt,number:Ji,qr:r1,re:Kx,reshape:tN,sin:Bc,size:yn,smaller:Wn,sqrt:ai,subtract:qt,typed:te,usolve:t1,usolveAll:mN}),Tk=W0({BigNumber:Ge,Unit:Sr,config:Oe}),_k=ox({BigNumber:Ge,Unit:Sr,config:Oe}),Fk=qy({divide:pn,dotDivide:jf,isNumeric:gs,log:a1,map:vs,matrix:$e,multiply:lt,sum:i1,typed:te}),EN=Hf({add:Ur,divide:pn,typed:te}),Ok=ux({BigNumber:Ge,Unit:Sr,config:Oe}),Bk=E0({BigNumber:Ge,Unit:Sr,config:Oe}),Ik=Gf({bignumber:ha,add:Ur,compare:ys,divide:pn,isInteger:ea,larger:Hn,multiply:lt,partitionSelect:Rc,smaller:Wn,smallerEq:pu,subtract:qt,typed:te}),f1=$f({add:Ur,apply:Jx,divide:pn,isNaN:Kf,multiply:lt,subtract:qt,typed:te}),Pk=z0({BigNumber:Ge,Unit:Sr,config:Oe}),CN=Fy({add:Ur,compare:ys,divide:pn,partitionSelect:Rc,typed:te}),Rk=By({add:Ur,divide:pn,matrix:$e,mean:EN,multiply:lt,pow:ka,sqrt:ai,subtract:qt,sum:i1,typed:te}),kk=i0({Complex:yt,add:Ur,divide:pn,matrix:$e,multiply:lt,typed:te}),Lk=Oy({abs:Yn,map:vs,median:CN,subtract:qt,typed:te}),qk=Vf({map:vs,sqrt:ai,typed:te,variance:f1}),Uk=Oh({BigNumber:Ge,Complex:yt,add:Ur,config:Oe,divide:pn,equal:Ra,factorial:rl,gamma:u1,isNegative:Co,multiply:lt,pi:Gx,pow:ka,sin:Bc,smallerEq:pu,subtract:qt,typed:te}),l1=vg({abs:Yn,add:Ur,conj:ds,ctranspose:jx,eigs:MN,equalScalar:Rr,larger:Hn,matrix:$e,multiply:lt,pow:ka,smaller:Wn,sqrt:ai,typed:te}),TN=Dh({BigNumber:Ge,DenseMatrix:Or,SparseMatrix:ji,addScalar:nn,config:Oe,cos:Zx,matrix:$e,multiplyScalar:Lt,norm:l1,sin:Bc,typed:te,unaryMinus:Ei}),zk=yx({BigNumber:Ge,Unit:Sr,config:Oe}),_N=Ay({identity:To,matrix:$e,multiply:lt,norm:l1,qr:r1,subtract:qt,typed:te}),Yk=wh({multiply:lt,rotationMatrix:TN,typed:te}),FN=Ny({abs:Yn,add:Ur,concat:Qr,identity:To,index:vN,lusolve:NN,matrix:$e,matrixFromColumns:e1,multiply:lt,range:du,schur:_N,subset:va,subtract:qt,transpose:Jf,typed:te}),Wk=My({matrix:$e,multiply:lt,sylvester:FN,transpose:Jf,typed:te});var tl={},nl={},Hk={},$n=wg({mathWithTransform:nl}),al=Hg({Node:$n}),_o=Gg({Node:$n}),hu=Zg({Node:$n}),$k=Jg({Node:$n}),il=Mg({Node:$n}),Gk=Og({Node:$n,ResultSet:ZS}),Vk=Ig({Node:$n}),bs=Lg({Node:$n}),Zk=Xg({Node:$n}),rK=o0({classes:Hk}),ON=hy({math:tl,typed:te}),Qk=Ug({Node:$n,typed:te}),tK=gy({Chain:ON,typed:te}),ol=Yg({Node:$n,size:yn}),sl=Ng({Node:$n,subset:va}),Xk=_g({matrix:$e,Node:$n,subset:va}),ws=jg({Unit:Sr,Node:$n,math:tl}),Ds=ry({Node:$n,SymbolNode:ws,math:tl}),oi=ty({AccessorNode:sl,ArrayNode:il,AssignmentNode:Xk,BlockNode:Gk,ConditionalNode:Vk,ConstantNode:bs,FunctionAssignmentNode:Qk,FunctionNode:Ds,IndexNode:ol,ObjectNode:al,OperatorNode:_o,ParenthesisNode:hu,RangeNode:Zk,RelationalNode:$k,SymbolNode:ws,config:Oe,numeric:ii,typed:te}),Kk=e0({ConstantNode:bs,FunctionNode:Ds,OperatorNode:_o,ParenthesisNode:hu,parse:oi,typed:te}),BN=Jy({bignumber:ha,fraction:cu,AccessorNode:sl,ArrayNode:il,ConstantNode:bs,FunctionNode:Ds,IndexNode:ol,ObjectNode:al,OperatorNode:_o,SymbolNode:ws,config:Oe,mathWithTransform:nl,matrix:$e,typed:te}),nK=ny({parse:oi,typed:te}),IN=jy({AccessorNode:sl,ArrayNode:il,ConstantNode:bs,FunctionNode:Ds,IndexNode:ol,ObjectNode:al,OperatorNode:_o,ParenthesisNode:hu,SymbolNode:ws,add:Ur,divide:pn,equal:Ra,isZero:ni,multiply:lt,parse:oi,pow:ka,subtract:qt,typed:te}),PN=ay({parse:oi,typed:te}),Jk=dy({evaluate:PN}),jk=iy({evaluate:PN}),c1=Ky({bignumber:ha,fraction:cu,AccessorNode:sl,ArrayNode:il,ConstantNode:bs,FunctionNode:Ds,IndexNode:ol,ObjectNode:al,OperatorNode:_o,ParenthesisNode:hu,SymbolNode:ws,add:Ur,config:Oe,divide:pn,equal:Ra,isZero:ni,mathWithTransform:nl,matrix:$e,multiply:lt,parse:oi,pow:ka,resolve:Kk,simplifyConstant:BN,simplifyCore:IN,subtract:qt,typed:te}),aK=r0({OperatorNode:_o,parse:oi,simplify:c1,typed:te}),iK=Xy({parse:oi,typed:te}),oK=oy({Parser:jk,typed:te}),sK=n0({bignumber:ha,fraction:cu,AccessorNode:sl,ArrayNode:il,ConstantNode:bs,FunctionNode:Ds,IndexNode:ol,ObjectNode:al,OperatorNode:_o,ParenthesisNode:hu,SymbolNode:ws,add:Ur,config:Oe,divide:pn,equal:Ra,isZero:ni,mathWithTransform:nl,matrix:$e,multiply:lt,parse:oi,pow:ka,simplify:c1,simplifyConstant:BN,simplifyCore:IN,subtract:qt,typed:te}),uK=t0({ConstantNode:bs,FunctionNode:Ds,OperatorNode:_o,ParenthesisNode:hu,SymbolNode:ws,config:Oe,equal:Ra,isZero:ni,numeric:ii,parse:oi,simplify:c1,typed:te}),fK=vy({Help:Jk,mathWithTransform:nl,typed:te});bt(tl,{e:GS,false:A4,fineStructure:M4,i:VS,Infinity:E4,LN10:C4,LOG10E:T4,NaN:_4,null:F4,phi:O4,SQRT1_2:I4,sackurTetrode:P4,tau:QS,true:R4,E:GS,version:k4,efimovFactor:L4,LN2:q4,pi:Gx,replacer:U4,reviver:rK,SQRT2:z4,typed:te,unaryPlus:Vx,PI:Gx,weakMixingAngle:Y4,abs:Yn,acos:W4,acot:H4,acsc:$4,addScalar:nn,arg:G4,asech:V4,asinh:Z4,atan:XS,atanh:Q4,bignumber:ha,bitNot:X4,boolean:K4,clone:J4,combinations:_c,complex:Fc,conj:ds,cos:Zx,cot:j4,csc:eR,cube:rR,equalScalar:Rr,erf:tR,exp:KS,expm1:nR,filter:aR,forEach:iR,format:Xf,getMatrixDataType:Qx,hex:oR,im:Xx,isInteger:ea,isNegative:Co,isPositive:hs,isZero:ni,LOG2E:sR,lgamma:uR,log10:fR,log2:JS,map:vs,multiplyScalar:Lt,not:Oc,number:Ji,oct:lR,pickRandom:cR,print:mR,random:pR,re:Kx,sec:dR,sign:jS,sin:Bc,splitUnit:hR,square:vR,string:gR,subtractScalar:Pa,tan:yR,typeOf:eN,acosh:xR,acsch:bR,apply:Jx,asec:wR,bin:DR,chain:tK,combinationsWithRep:SR,cosh:NR,csch:AR,isNaN:Kf,isPrime:MR,randomInt:ER,sech:CR,sinh:TR,sparse:_R,sqrt:ai,tanh:FR,unaryMinus:Ei,acoth:OR,coth:BR,fraction:cu,isNumeric:gs,matrix:$e,matrixFromFunction:IR,mode:PR,numeric:ii,prod:rN,reshape:tN,size:yn,squeeze:RR,transpose:Jf,xgcd:nN,zeros:xn,asin:kR,cbrt:aN,concat:Qr,count:LR,ctranspose:jx,diag:iN,divideScalar:Ot,dotDivide:jf,equal:Ra,flatten:el,hasNumericValue:qR,identity:To,kron:UR,largerEq:Ic,leftShift:zR,lsolve:oN,matrixFromColumns:e1,nthRoot:YR,ones:WR,qr:r1,resize:HR,rightArithShift:$R,round:mu,smaller:Wn,subtract:qt,to:GR,unequal:VR,usolve:t1,xor:ZR,add:Ur,atan2:QR,bitAnd:XR,bitOr:KR,bitXor:JR,catalan:jR,compare:ys,compareText:sN,cumsum:e5,deepEqual:n1,diff:r5,distance:t5,dot:Pc,equalText:n5,floor:uN,gcd:a5,hypot:i5,larger:Hn,log:a1,lsolveAll:o5,matrixFromRows:s5,min:u5,mod:lN,multiply:lt,nthRoots:f5,or:l5,partitionSelect:Rc,rightLogShift:c5,slu:cN,subset:va,sum:i1,trace:m5,usolveAll:mN,zpk2tf:p5,ceil:o1,compareNatural:Ci,composition:d5,cross:h5,det:pN,dotMultiply:v5,fix:hN,index:vN,intersect:g5,invmod:y5,lcm:x5,log1p:b5,max:s1,setCartesian:w5,setDistinct:D5,setIsSubset:S5,setPowerset:N5,smallerEq:pu,sort:A5,and:M5,range:du,row:E5,setDifference:gN,setMultiplicity:C5,setSymDifference:yN,column:bN,inv:xs,lup:wN,pinv:T5,pow:ka,setIntersect:DN,setUnion:_5,sqrtm:F5,vacuumImpedance:O5,wienDisplacement:B5,atomicMass:I5,bohrMagneton:P5,boltzmann:R5,conductanceQuantum:k5,coulomb:L5,deuteronMass:q5,dotPow:U5,electricConstant:z5,elementaryCharge:Y5,expm:W5,faraday:H5,fft:SN,gamma:u1,gravitationConstant:$5,hartreeEnergy:G5,ifft:V5,klitzing:Z5,loschmidt:Q5,magneticConstant:X5,molarMass:K5,molarPlanckConstant:J5,neutronMass:j5,nuclearMagneton:ek,planckCharge:rk,planckLength:tk,planckTemperature:nk,protonMass:ak,quantumOfCirculation:ik,reducedPlanckConstant:ok,rydberg:sk,secondRadiation:uk,speedOfLight:fk,stefanBoltzmann:lk,thomsonCrossSection:ck,avogadro:mk,bohrRadius:pk,createUnit:dk,divide:pn,electronMass:hk,factorial:rl,firstRadiation:vk,gravity:gk,inverseConductanceQuantum:yk,lusolve:NN,magneticFluxQuantum:xk,molarMassC12:bk,multinomial:wk,parse:oi,permutations:Dk,planckMass:Sk,polynomialRoot:Nk,resolve:Kk,setSize:Ak,simplifyConstant:BN,solveODE:Mk,stirlingS2:AN,unit:Ek,bellNumbers:Ck,compile:nK,eigs:MN,fermiCoupling:Tk,gasConstant:_k,kldivergence:Fk,mean:EN,molarVolume:Ok,planckConstant:Bk,quantileSeq:Ik,simplifyCore:IN,variance:f1,classicalElectronRadius:Pk,evaluate:PN,median:CN,simplify:c1,symbolicEqual:aK,corr:Rk,freqz:kk,leafCount:iK,mad:Lk,parser:oK,rationalize:sK,std:qk,zeta:Uk,derivative:uK,norm:l1,rotationMatrix:TN,help:fK,planckTime:zk,schur:_N,rotate:Yk,sylvester:FN,lyap:Wk,config:Oe});bt(nl,tl,{filter:Nx({typed:te}),forEach:Ax({typed:te}),map:Ex({typed:te}),apply:Dx({isInteger:ea,typed:te}),or:Wx({DenseMatrix:Or,concat:Qr,equalScalar:Rr,matrix:$e,typed:te}),and:Yx({add:Ur,concat:Qr,equalScalar:Rr,matrix:$e,not:Oc,typed:te,zeros:xn}),concat:Ix({isInteger:ea,matrix:$e,typed:te}),max:Cx({config:Oe,larger:Hn,numeric:ii,typed:te}),print:zx({add:Ur,matrix:$e,typed:te,zeros:xn}),bitAnd:Hx({add:Ur,concat:Qr,equalScalar:Rr,matrix:$e,not:Oc,typed:te,zeros:xn}),diff:Px({bignumber:ha,matrix:$e,number:Ji,subtract:qt,typed:te}),min:_x({config:Oe,numeric:ii,smaller:Wn,typed:te}),subset:Bx({add:Ur,matrix:$e,typed:te,zeros:xn}),bitOr:$x({DenseMatrix:Or,concat:Qr,equalScalar:Rr,matrix:$e,typed:te}),cumsum:qx({add:Ur,typed:te,unaryPlus:Vx}),index:Mx({Index:_n,getMatrixDataType:Qx}),sum:kx({add:Ur,config:Oe,numeric:ii,typed:te}),range:Fx({bignumber:ha,matrix:$e,add:Ur,config:Oe,isPositive:hs,larger:Hn,largerEq:Ic,smaller:Wn,smallerEq:pu,typed:te}),row:Ox({Index:_n,matrix:$e,range:du,typed:te}),column:Sx({Index:_n,matrix:$e,range:du,typed:te}),mean:Tx({add:Ur,divide:pn,typed:te}),quantileSeq:Lx({add:Ur,bignumber:ha,compare:ys,divide:pn,isInteger:ea,larger:Hn,multiply:lt,partitionSelect:Rc,smaller:Wn,smallerEq:pu,subtract:qt,typed:te}),variance:Ux({add:Ur,apply:Jx,divide:pn,isNaN:Kf,multiply:lt,subtract:qt,typed:te}),std:Rx({map:vs,sqrt:ai,typed:te,variance:f1})});bt(Hk,{BigNumber:Ge,Complex:yt,Fraction:ps,Matrix:Tc,Node:$n,ObjectNode:al,OperatorNode:_o,ParenthesisNode:hu,Range:B4,RelationalNode:$k,ResultSet:ZS,ArrayNode:il,BlockNode:Gk,ConditionalNode:Vk,ConstantNode:bs,DenseMatrix:Or,RangeNode:Zk,Chain:ON,FunctionAssignmentNode:Qk,SparseMatrix:ji,IndexNode:ol,ImmutableDenseMatrix:fN,Index:_n,AccessorNode:sl,AssignmentNode:Xk,FibonacciHeap:dN,Spa:xN,Unit:Sr,SymbolNode:ws,FunctionNode:Ds,Help:Jk,Parser:jk});ON.createProxy(tl);var RN=$S;var a6=Aa(Mp(),1);var r6=Aa(e6(),1);function t6(e){var r=new r6.default;return e.on=r.on.bind(r),e.off=r.off.bind(r),e.once=r.once.bind(r),e.emit=r.emit.bind(r),e}function n6(e,r,t,n){function a(x,b){var E=arguments.length;if(E!==1&&E!==2)throw new Ba("import",E,1,2);b||(b={});function w(O,_,C){if(Array.isArray(_))_.forEach(L=>w(O,L));else if(typeof _=="object")for(var T in _)Xe(_,T)&&w(O,_[T],T);else if(nu(_)||C!==void 0){var k=nu(_)?y(_)?_.fn+".transform":_.fn:C;if(Xe(O,k)&&O[k]!==_&&!b.silent)throw new Error('Cannot import "'+k+'" twice');O[k]=_}else if(!b.silent)throw new TypeError("Factory, Object, or Array expected")}var N={};w(N,x);for(var M in N)if(Xe(N,M)){var D=N[M];if(nu(D))o(D,b);else if(u(D))i(M,D,b);else if(!b.silent)throw new TypeError("Factory, Object, or Array expected")}}function i(x,b,E){if(E.wrap&&typeof b=="function"&&(b=f(b)),m(b)&&(b=e(x,{[b.signature]:b})),e.isTypedFunction(t[x])&&e.isTypedFunction(b)){E.override?b=e(x,b.signatures):b=e(t[x],b),t[x]=b,delete n[x],s(x,b),t.emit("import",x,function(){return b});return}if(t[x]===void 0||E.override){t[x]=b,delete n[x],s(x,b),t.emit("import",x,function(){return b});return}if(!E.silent)throw new Error('Cannot import "'+x+'": already exists')}function s(x,b){b&&typeof b.transform=="function"?(t.expression.transform[x]=b.transform,p(x)&&(t.expression.mathWithTransform[x]=b.transform)):(delete t.expression.transform[x],p(x)&&(t.expression.mathWithTransform[x]=b))}function c(x){delete t.expression.transform[x],p(x)?t.expression.mathWithTransform[x]=t[x]:delete t.expression.mathWithTransform[x]}function f(x){var b=function(){for(var w=[],N=0,M=arguments.length;N2&&arguments[2]!==void 0?arguments[2]:x.fn;if(uD(E,"."))throw new Error("Factory name should not contain a nested path. Name: "+JSON.stringify(E));var w=y(x)?t.expression.transform:t,N=E in t.expression.transform,M=Xe(w,E)?w[E]:void 0,D=function(){var _={};x.dependencies.map(cD).forEach(T=>{if(uD(T,"."))throw new Error("Factory dependency should not contain a nested path. Name: "+JSON.stringify(T));T==="math"?_.math=t:T==="mathWithTransform"?_.mathWithTransform=t.expression.mathWithTransform:T==="classes"?_.classes=t:_[T]=t[T]});var C=x(_);if(C&&typeof C.transform=="function")throw new Error('Transforms cannot be attached to factory functions. Please create a separate function for it with exports.path="expression.transform"');if(M===void 0||b.override)return C;if(e.isTypedFunction(M)&&e.isTypedFunction(C))return e(M,C);if(b.silent)return M;throw new Error('Cannot import "'+E+'": already exists')};!x.meta||x.meta.lazy!==!1?(sf(w,E,D),M&&N?c(E):(y(x)||h(x))&&sf(t.expression.mathWithTransform,E,()=>w[E])):(w[E]=D(),M&&N?c(E):(y(x)||h(x))&&sf(t.expression.mathWithTransform,E,()=>w[E])),n[E]=x,t.emit("import",E,D)}function u(x){return typeof x=="function"||typeof x=="number"||typeof x=="string"||typeof x=="boolean"||x===null||Kt(x)||sn(x)||tr(x)||_a(x)||Qe(x)||Array.isArray(x)}function m(x){return typeof x=="function"&&typeof x.signature=="string"}function p(x){return!Xe(v,x)}function h(x){return x.fn.indexOf(".")===-1&&!Xe(v,x.fn)&&(!x.meta||!x.meta.isClass)}function y(x){return x!==void 0&&x.meta!==void 0&&x.meta.isTransformFunction===!0||!1}var v={expression:!0,type:!0,docs:!0,error:!0,json:!0,chain:!0};return a}function m1(e,r){var t=bt({},eu,r);if(typeof Object.create!="function")throw new Error("ES5 not supported by this JavaScript engine. Please load the es5-shim and es5-sham library for compatibility.");var n=t6({isNumber:ur,isComplex:sn,isBigNumber:tr,isFraction:_a,isUnit:Kt,isString:Tt,isArray:Cr,isMatrix:Qe,isCollection:_t,isDenseMatrix:wo,isSparseMatrix:Fa,isRange:rs,isIndex:$i,isBoolean:cp,isResultSet:mp,isHelp:nf,isFunction:pp,isDate:dp,isRegExp:hp,isObject:Gi,isNull:vp,isUndefined:gp,isAccessorNode:jn,isArrayNode:un,isAssignmentNode:yp,isBlockNode:xp,isConditionalNode:bp,isConstantNode:wr,isFunctionAssignmentNode:Xa,isFunctionNode:Cn,isIndexNode:la,isNode:Mr,isObjectNode:Vi,isOperatorNode:ht,isParenthesisNode:fn,isRangeNode:wp,isRelationalNode:Dp,isSymbolNode:ft,isChain:af});n.config=Q2(t,n.emit),n.expression={transform:{},mathWithTransform:{config:n.config}};var a=[],i=[];function s(u){if(nu(u))return u(n);var m=u[Object.keys(u)[0]];if(nu(m))return m(n);if(!G2(u))throw console.warn("Factory object with properties \`type\`, \`name\`, and \`factory\` expected",u),new Error("Factory object with properties \`type\`, \`name\`, and \`factory\` expected");var p=a.indexOf(u),h;return p===-1?(u.math===!0?h=u.factory(n.type,t,s,n.typed,n):h=u.factory(n.type,t,s,n.typed),a.push(u),i.push(h)):h=i[p],h}var c={};function f(){for(var u=arguments.length,m=new Array(u),p=0;p{Jw(c).forEach(u=>{u&&u.meta&&u.meta.recreateOnConfigChange&&o(u,{override:!0})})}),n.create=m1.bind(null,e),n.factory=F,n.import(Jw(H2(e))),n.ArgumentsError=Ba,n.DimensionError=dr,n.IndexError=cn,n}var GN=Aa(tp());var mK=Aa(tp());var qN=e=>e.lastIndexOf("/")!=-1?e.lastIndexOf(".")!=-1?PM(e.substring(e.lastIndexOf("/")+1,e.lastIndexOf("."))):e.substring(e.lastIndexOf("/")+1):e.lastIndexOf(".")!=-1?e.substring(0,e.lastIndexOf(".")):e;var p1="spaces://$",i6="spaces://$tags";var bLe={name:Wr.menu.vault,readOnly:!1,path:"/",label:{thumbnail:"",name:Wr.menu.vault,sticker:"ui//vault",color:""},type:"default"},d1={tags:{name:"Tags",icon:"ui//tags",readOnly:!1,hidden:!1},overview:{name:"Overview",icon:"ui//overview",readOnly:!0,hidden:!0}};var o6=(e,r,t,n,a,i,s,c)=>{if(!n)return"";let f=new Map;Object.keys(i).forEach(u=>f.set(u,i[u])),f.set("$properties",a),f.set("$paths",r),f.set("$items",t.invMap),f.set("$spaces",t.map),s&&f.set("$current",s);let o;try{if(e.evaluate("current = _current()",f),o=e.evaluate(n,f),o=Qs("",o),typeof o!="string"&&c)throw o}catch(u){if(o="",c)throw u;console.log(n,u)}return o};var UN=e=>{let r=new Map;e.filter(s=>s.type=="fileprop"||s.name.startsWith("tags")).forEach(s=>{let{value:c}=jm(s.value,s.type),f=[];try{let u=oi(c).filter(m=>m.type=="FunctionNode").filter(m=>m.fn.name=="prop"&&m.args[0].type=="ConstantNode").map(m=>m.args[0]?.value);f.push(...u)}catch{}let o=s.name;r.has(o)||r.set(o,new Set);for(let u of f){let m=u;m!==o&&r.get(o).add(m)}});let t=new Set,n=[],a=new Set,i=s=>{if(a.has(s))throw new Error("Circular dependency detected");if(!t.has(s)){a.add(s);let c=r.get(s)||new Set;for(let f of c)i(f);t.add(s),a.delete(s),n.push(s)}};for(let s of e)t.has(s.name)||i(s.name);return n},s6=(e,r,t,n,a,i,s)=>{if(!n)return{};let c=s??UN(a),f=r.get(n[In])?.metadata?.property??{},o=Object.keys(f).filter(p=>a.some(h=>h.name==p)&&p!=In).reduce((p,h)=>({...p,[h]:Qs(h,f[h])}),{}),u=c.map(p=>a.find(h=>h.name==p)).filter(p=>p&&(p.type=="fileprop"||p.name=="tags")),m=a.reduce((p,h)=>({...p,[h.name]:h}),{});return{...n,...o,...u.reduce((p,h)=>{let{value:y}=jm(h.value,h.type);return{...p,[h.name]:o6(e,r,t,y,m,{...n,...p},i)}},{})}};var u6=(e,r)=>{let t=e?An(e):[],n=r?An(r):[];return n.every(a=>t.some(i=>i==a))&&t.every(a=>n.some(i=>i==a))},ul=(e,r)=>e==r,zN=(e,r)=>(e??"").length==0,YN=(e,r)=>(e??"").toLowerCase().includes((r??"").toLowerCase()),WN=(e,r)=>parseFloat(e)>parseFloat(r),HN=(e,r)=>parseInt(e){let t=isNaN(Date.parse(e))?new Date(parseInt(e)):new Date(e),n=isNaN(Date.parse(r))?new Date(parseInt(r)):new Date(r);return t.valueOf()>=n.valueOf()},l6=(e,r)=>{let t=isNaN(Date.parse(e))?new Date(parseInt(e)):new Date(e),n=isNaN(Date.parse(r))?new Date(parseInt(r)):new Date(r);return t.valueOf(){let t=e?An(e):[],n=r?An(r):[];return t.length==0?!1:n.some(a=>t.some(i=>i==a))},c6=(e,r)=>{if(!e)return!1;let t=new Date(\`\${e.toString().replace(".",":")}\`),n=new Date(\`\${r}\`);return t.getMonth()===n.getMonth()&&t.getDate()===n.getDate()},m6=e=>{if(!e)return!1;let r=new Date(\`\${e.toString()}T00:00\`),t=new Date;return r.getMonth()===t.getMonth()&&r.getDate()===t.getDate()};var fl={isNotEmpty:{type:["text","file","number","option","option-multi","link","link-multi","image"],fn:(e,r)=>!zN(e,""),valueType:"none"},isEmpty:{type:["text","file","number","option","option-multi","link","link-multi","image"],fn:(e,r)=>zN(e,""),valueType:"none"},include:{fn:(e,r)=>YN(e,r),type:["text","file","link","image"],valueType:"text"},notInclude:{type:["text","file","link","image"],fn:(e,r)=>!YN(e,r),valueType:"text"},is:{type:["text"],fn:(e,r)=>ul(e,r),valueType:"text"},isNot:{type:["text"],fn:(e,r)=>!ul(e,r),valueType:"text"},equal:{type:["number"],fn:(e,r)=>ul(e,r),valueType:"number"},isLink:{type:["link","context"],fn:(e,r)=>ul(e,r),valueType:"link"},isNotLink:{type:["link","context"],fn:(e,r)=>!ul(e,r),valueType:"link"},isGreatThan:{type:["number"],fn:(e,r)=>WN(e,r),valueType:"number"},isLessThan:{type:["number"],fn:(e,r)=>HN(e,r),valueType:"number"},isLessThanOrEqual:{type:["number"],fn:(e,r)=>!WN(e,r),valueType:"number"},isGreatThanOrEqual:{type:["number"],fn:(e,r)=>!HN(e,r),valueType:"number"},dateBefore:{type:["date"],fn:(e,r)=>l6(e,r),valueType:"date"},dateAfter:{type:["date"],fn:(e,r)=>f6(e,r),valueType:"date"},isSameDate:{type:["date"],fn:(e,r)=>c6(e,r),valueType:"date"},isSameDateAsToday:{type:["date"],fn:(e,r)=>m6(e,r),valueType:"none"},isExactList:{type:["option","option-multi","link-multi","context-multi","tags-multi"],fn:(e,r)=>u6(e,r),valueType:"list"},isAnyInList:{type:["option","context","link","option-multi","link-multi","context-multi","tags-multi"],fn:(e,r)=>$N(e,r),valueType:"list"},isNoneInList:{type:["option","context","link","option-multi","link-multi","context-multi","tags-multi"],fn:(e,r)=>!$N(e,r),valueType:"list"},isTrue:{type:["boolean"],fn:(e,r)=>e=="true",valueType:"none"},isFalse:{type:["boolean"],fn:(e,r)=>e!="true",valueType:"none"}};var dK=(e,r,t)=>r.reduce((a,i)=>{let[s,c]=a,f=i.type=="context"?p6(c,i,t):i.type=="path"?h6(c,i,t):i.type=="frontmatter"?d6(c,i,t):v6(c,i,t),o=c.filter(u=>!f.includes(u));return[[...s,...f],o]},[[],e])[0],hK=(e,r,t)=>r.reduce((n,a)=>a.type=="context"?p6(n,a,t):a.type=="path"?h6(n,a,t):a.type=="frontmatter"?d6(n,a,t):v6(n,a,t),e),p6=(e,r,t)=>{let n=fl[r.fn];return!n||n.valueType!="none"&&r.value.length==0?[]:e.filter(a=>{let[i,s]=r.field.split("."),c=a.metadata?.property;if(!a.spaces?.includes(i)||!c||!c[s])return!1;let f=!0;if(n){let o=r.fType=="property"?t[r.value]:r.value;f=n.fn(Qs(s,c[s]),o)}return f})},d6=(e,r,t)=>{let n=fl[r.fn];return!n||n.valueType!="none"&&r.value.length==0?[]:e.filter(a=>{let i=a.metadata?.property;if(!i||i[r.field]===void 0)return!1;let s=!0;if(n){let c=r.fType=="property"?t[r.value]:r.value;s=n.fn(Qs(r.field,i[r.field]),c)}return s})},h6=(e,r,t)=>{let n=fl[r.fn];return!n||n.valueType!="none"&&r.value.length==0?[]:e.filter(a=>{let i="";r.field=="outlinks"?i=Zs(a.outlinks??[]):r.field=="inlinks"?i=Zs(a.metadata?.inlinks??[]):r.field=="tags"&&(i=Zs(a.tags??[]));let s=!0;if(n){let c=r.fType=="property"?t[r.value]:r.value;s=n.fn(i,c)}return s})},v6=(e,r,t)=>{let n=fl[r.fn];return!n||n.valueType!="none"&&r.value.length==0?[]:e.filter(a=>{let i=!0;if(n){let s=r.fType=="property"?t[r.value]:r.value;i=n.fn(a.metadata?.[r.type]?.[r.field],s)}return i})},g6=(e,r,t)=>e.reduce((a,i)=>!a||i.filters.length==0?!1:i.type=="any"?dK([r],i.filters,t).length>0:hK([r],i.filters,t).length>0,!0);var y6=(e,r)=>e.hiddenExtensions.some(t=>r.endsWith(t))||r.endsWith("/"+e.spaceSubFolder)||r==e.spaceSubFolder||r.split("/").pop()==e.spaceSubFolder||r.startsWith(e.spacesFolder+"/#")||e.hiddenFiles.some(t=>t==r);var x6=(e,r,t,n,a,i,s)=>{let c={};if(!e)return{changed:!1,cache:null};if(!r)return{changed:!1,cache:{path:e.path,schemas:[],outlinks:[],contexts:[],paths:[],contextTable:null,spaceMap:c,dbExists:!1}};let f=Object.values(r).map(O=>O.schema),o=r[Ea]?.cols;(!o||o.length==0)&&(o=Vs.rows);let u=r[Ea]?.schema??Gs,m=r[Ea]?.rows?.map(O=>O[In])??[],p=t.filter(O=>!m.includes(O)),h=[...FM(t??[],m),...p],y=UN(o),v=[...(r[Ea]?.rows??[]).filter(O=>t.includes(O[In])),...p.map(O=>({[In]:O}))].map(O=>s6(s,a,i,O,o,a.get(e.path),y)),x={schema:u,cols:o,rows:v},b=x.cols?.filter(O=>O.type.startsWith("context"))??[],E=x.cols?.filter(O=>O.type.startsWith("link"))??[],w=Ma(b.map(O=>O.value));b.forEach(O=>{c[O.name]={},x.rows.forEach(_=>{An(_[O.name]).forEach(C=>c[O.name][C]=[...c[O.name][C]??[],_[In]])})});let N=Ma(x.rows.reduce((O,_)=>Ma([...O,...[...b,...E].flatMap(C=>An(_[C.name]).map(T=>nc(T)))]),[])),M={contextTable:x,path:e.path,contexts:w,outlinks:N,paths:h,schemas:f,spaceMap:c,dbExists:n},D=!1;return GN.default.isEqual(x,r[Ea])||(D=!0),{changed:D,cache:M}},b6=(e,r,t,n)=>{let a={};for(let[i,s]of e){let c=r.enableFolderNote?t.get(i)?.space.notePath??i:i,f=e.get(c)??s;if(!s)continue;let o=s?.parent??"",u=s?.type??"",m=s?.subtype??"",p=t.has(i)?t.get(i).space.name:s?.label?.name,h=n?.get(i),{changed:y,cache:v}=VN(i,r,t,f,p,u,m,o,h);a[i]={changed:y,cache:v}}return a},VN=(e,r,t,n,a,i,s,c,f)=>{if(!n)return{changed:!1,cache:null};let o=(R,X,U,oe)=>R?.length>0||R?.length>0?R:X=="space"?oe=="Spaces/Home"?"ui//home":oe=="/"?"ui//vault":oe.startsWith("spaces://")?"ui//tags":"ui//folder":"ui//file",u={label:n?.label,path:e,name:n?.label?.name??qN(e),readOnly:n?.readOnly},m=[],p=n?.tags?.map(R=>R.toLowerCase())??[],h=y6(r,e);if(e.startsWith(p1)){let R=e.replace(p1,"");h=d1[R]?.hidden,u.readOnly=d1[R]?.readOnly}let y=(R,X,U=new Set)=>{let oe=[];for(let me of X){let ae=(R.get(me)?.contexts??[]).map($=>$.toLowerCase());for(let $ of ae)U.has($)||(oe.push($),U.add($),oe.push(...y(R,[rc($)],U)))}return oe};if(t.has(c))for(let R of t.get(c).contexts??[])m.push(R.toLowerCase());m.push(...p);let v=n?.property?Jm(n.property[r.fmKeyAlias]):[],x=t.get(c)?.metadata?.defaultSticker,b=o(IM(n?.label?.sticker,x),i,s,e),E=t.get(c)?.metadata?.defaultColor,w=n?.label?.color??E??"",N=n?.resolvedLinks??[],M=[],D=!1,O,_={...u,name:a,tags:Ma(m),type:i,subtype:s,parent:c,label:{name:r.spacesUseAlias&&v?.length>0?v[0]:a,sticker:b,color:w,thumbnail:n?.label?.thumbnail??"",preview:n?.label?.preview??""},metadata:{...n},outlinks:N},C=[],T=[],k=[];s=="tag"&&C.push(i6);for(let R of m)C.push(rc(R)),M.push(R);let L=new Set,H=(R,X)=>{if(!L.has(R)){if(L.add(R),X.dependencies?.length>0)for(let U of X.dependencies)t.has(U)&&H(U,t.get(U));if(X.metadata.recursive?.length>0&&_.path.startsWith(\`\${X.path}/\`)){if(X.metadata.recursive=="all"){C.push(R),M.push(X.name);return}if(X.metadata.recursive=="file"&&_.type!="space"){C.push(R),M.push(X.name);return}}if(X.space.notePath==e&&X.path!=X.space.notePath&&(D=!0,O=X.path,r.enableFolderNote&&(h=!0)),s!="tag"&&s!="default"&&X.space&&X.space.path==c){C.push(R),M.push(X.name);return}if(X.metadata?.filters?.length>0&&g6(X.metadata.filters,{..._,spaces:C},X.properties)){C.push(R),M.push(X.name),k.push(R);return}X.metadata?.links?.length>0&&(X.metadata?.links??[]).find(oe=>oe==_.path)&&(C.push(R),M.push(X.name),T.push(R))}};for(let[R,X]of t)H(R,X);let V=y(t,C);C.push(...V.map(R=>rc(R))),M.push(...V),_.tags.push(...V),D&&(_.metadata.spacePath=O);let W=h?{..._,spaces:[],hidden:h}:{..._,spaces:Ma(C),linkedSpaces:T,liveSpaces:k,spaceNames:M,hidden:h},q=!0;return f&&GN.default.isEqual(W,f)&&(q=!1),{changed:q,cache:W}};function w6(e){let{path:r,settings:t,spacesCache:n,pathMetadata:a,name:i,type:s,subtype:c,parent:f,oldMetadata:o}=e;return VN(r,t,n,a,i,s,c,f,o)}function ZN(e,r){let{space:t,mdb:n,paths:a,dbExists:i,spacesMap:s,pathsIndex:c}=e;return x6(t,n,a,i,c,s,r)}function D6(e,r){let{map:t,pathsIndex:n,spacesMap:a}=e,i=new Map;for(let[s,c]of t)i.set(s,ZN({...c,pathsIndex:n,spacesMap:a},r));return i}function S6(e){let{pathCache:r,settings:t,spacesCache:n,oldMetadata:a}=e;return b6(r,t,n,a)}var vK=self,gK={...RN,createAdd:F("add",[],()=>function(r,t){return r+t}),createEqual:F("equal",[],()=>function(r,t){return r==t}),createUnequal:F("unequal",[],()=>function(r,t){return r!=t})},yK={matrix:"Array"},QN=m1(gK,yK);QN.import(Xw,{override:!0});vK.onmessage=async e=>{let{payload:r,job:t}=e.data,n;t.type=="path"?n=w6(r):t.type=="context"?n=ZN(r,QN):t.type=="contexts"?n=D6(r,QN):t.type=="paths"&&(n=S6(r));try{postMessage({job:t,result:n})}catch(a){console.log(a),postMessage({job:t,result:{$error:\`Failed to index \${t.type} \${t.path}: \${a}\`}})}}; +In case of a (multi dimensional) array or matrix, the prob order quantile of all elements will be calculated.\`,examples:["quantileSeq([3, -1, 5, 7], 0.5)","quantileSeq([3, -1, 5, 7], [1/3, 2/3])","quantileSeq([3, -1, 5, 7], 2)","quantileSeq([-1, 3, 5, 7], 0.5, true)"],seealso:["mean","median","min","max","prod","std","sum","variance"]};var lI={name:"std",category:"Statistics",syntax:["std(a, b, c, ...)","std(A)","std(A, dimension)","std(A, normalization)","std(A, dimension, normalization)"],description:'Compute the standard deviation of all values, defined as std(A) = sqrt(variance(A)). Optional parameter normalization can be "unbiased" (default), "uncorrected", or "biased".',examples:["std(2, 4, 6)","std([2, 4, 6, 8])",'std([2, 4, 6, 8], "uncorrected")','std([2, 4, 6, 8], "biased")',"std([1, 2, 3; 4, 5, 6])"],seealso:["max","mean","min","median","prod","sum","variance"]};var cI={name:"cumsum",category:"Statistics",syntax:["cumsum(a, b, c, ...)","cumsum(A)"],description:"Compute the cumulative sum of all values.",examples:["cumsum(2, 3, 4, 1)","cumsum([2, 3, 4, 1])","cumsum([1, 2; 3, 4])","cumsum([1, 2; 3, 4], 1)","cumsum([1, 2; 3, 4], 2)"],seealso:["max","mean","median","min","prod","std","sum","variance"]};var mI={name:"sum",category:"Statistics",syntax:["sum(a, b, c, ...)","sum(A)","sum(A, dimension)"],description:"Compute the sum of all values.",examples:["sum(2, 3, 4, 1)","sum([2, 3, 4, 1])","sum([2, 5; 4, 3])"],seealso:["max","mean","median","min","prod","std","sum","variance"]};var pI={name:"variance",category:"Statistics",syntax:["variance(a, b, c, ...)","variance(A)","variance(A, dimension)","variance(A, normalization)","variance(A, dimension, normalization)"],description:'Compute the variance of all values. Optional parameter normalization can be "unbiased" (default), "uncorrected", or "biased".',examples:["variance(2, 4, 6)","variance([2, 4, 6, 8])",'variance([2, 4, 6, 8], "uncorrected")','variance([2, 4, 6, 8], "biased")',"variance([1, 2, 3; 4, 5, 6])"],seealso:["max","mean","min","median","min","prod","std","sum"]};var dI={name:"corr",category:"Statistics",syntax:["corr(A,B)"],description:"Compute the correlation coefficient of a two list with values, For matrices, the matrix correlation coefficient is calculated.",examples:["corr([2, 4, 6, 8],[1, 2, 3, 6])","corr(matrix([[1, 2.2, 3, 4.8, 5], [1, 2, 3, 4, 5]]), matrix([[4, 5.3, 6.6, 7, 8], [1, 2, 3, 4, 5]]))"],seealso:["max","mean","min","median","min","prod","std","sum"]};var hI={name:"acos",category:"Trigonometry",syntax:["acos(x)"],description:"Compute the inverse cosine of a value in radians.",examples:["acos(0.5)","acos(cos(2.3))"],seealso:["cos","atan","asin"]};var vI={name:"acosh",category:"Trigonometry",syntax:["acosh(x)"],description:"Calculate the hyperbolic arccos of a value, defined as \`acosh(x) = ln(sqrt(x^2 - 1) + x)\`.",examples:["acosh(1.5)"],seealso:["cosh","asinh","atanh"]};var gI={name:"acot",category:"Trigonometry",syntax:["acot(x)"],description:"Calculate the inverse cotangent of a value.",examples:["acot(0.5)","acot(cot(0.5))","acot(2)"],seealso:["cot","atan"]};var yI={name:"acoth",category:"Trigonometry",syntax:["acoth(x)"],description:"Calculate the hyperbolic arccotangent of a value, defined as \`acoth(x) = (ln((x+1)/x) + ln(x/(x-1))) / 2\`.",examples:["acoth(2)","acoth(0.5)"],seealso:["acsch","asech"]};var xI={name:"acsc",category:"Trigonometry",syntax:["acsc(x)"],description:"Calculate the inverse cotangent of a value.",examples:["acsc(2)","acsc(csc(0.5))","acsc(0.5)"],seealso:["csc","asin","asec"]};var bI={name:"acsch",category:"Trigonometry",syntax:["acsch(x)"],description:"Calculate the hyperbolic arccosecant of a value, defined as \`acsch(x) = ln(1/x + sqrt(1/x^2 + 1))\`.",examples:["acsch(0.5)"],seealso:["asech","acoth"]};var wI={name:"asec",category:"Trigonometry",syntax:["asec(x)"],description:"Calculate the inverse secant of a value.",examples:["asec(0.5)","asec(sec(0.5))","asec(2)"],seealso:["acos","acot","acsc"]};var DI={name:"asech",category:"Trigonometry",syntax:["asech(x)"],description:"Calculate the inverse secant of a value.",examples:["asech(0.5)"],seealso:["acsch","acoth"]};var SI={name:"asin",category:"Trigonometry",syntax:["asin(x)"],description:"Compute the inverse sine of a value in radians.",examples:["asin(0.5)","asin(sin(0.5))"],seealso:["sin","acos","atan"]};var NI={name:"asinh",category:"Trigonometry",syntax:["asinh(x)"],description:"Calculate the hyperbolic arcsine of a value, defined as \`asinh(x) = ln(x + sqrt(x^2 + 1))\`.",examples:["asinh(0.5)"],seealso:["acosh","atanh"]};var AI={name:"atan",category:"Trigonometry",syntax:["atan(x)"],description:"Compute the inverse tangent of a value in radians.",examples:["atan(0.5)","atan(tan(0.5))"],seealso:["tan","acos","asin"]};var MI={name:"atan2",category:"Trigonometry",syntax:["atan2(y, x)"],description:"Computes the principal value of the arc tangent of y/x in radians.",examples:["atan2(2, 2) / pi","angle = 60 deg in rad","x = cos(angle)","y = sin(angle)","atan2(y, x)"],seealso:["sin","cos","tan"]};var EI={name:"atanh",category:"Trigonometry",syntax:["atanh(x)"],description:"Calculate the hyperbolic arctangent of a value, defined as \`atanh(x) = ln((1 + x)/(1 - x)) / 2\`.",examples:["atanh(0.5)"],seealso:["acosh","asinh"]};var CI={name:"cos",category:"Trigonometry",syntax:["cos(x)"],description:"Compute the cosine of x in radians.",examples:["cos(2)","cos(pi / 4) ^ 2","cos(180 deg)","cos(60 deg)","sin(0.2)^2 + cos(0.2)^2"],seealso:["acos","sin","tan"]};var TI={name:"cosh",category:"Trigonometry",syntax:["cosh(x)"],description:"Compute the hyperbolic cosine of x in radians.",examples:["cosh(0.5)"],seealso:["sinh","tanh","coth"]};var _I={name:"cot",category:"Trigonometry",syntax:["cot(x)"],description:"Compute the cotangent of x in radians. Defined as 1/tan(x)",examples:["cot(2)","1 / tan(2)"],seealso:["sec","csc","tan"]};var FI={name:"coth",category:"Trigonometry",syntax:["coth(x)"],description:"Compute the hyperbolic cotangent of x in radians.",examples:["coth(2)","1 / tanh(2)"],seealso:["sech","csch","tanh"]};var OI={name:"csc",category:"Trigonometry",syntax:["csc(x)"],description:"Compute the cosecant of x in radians. Defined as 1/sin(x)",examples:["csc(2)","1 / sin(2)"],seealso:["sec","cot","sin"]};var BI={name:"csch",category:"Trigonometry",syntax:["csch(x)"],description:"Compute the hyperbolic cosecant of x in radians. Defined as 1/sinh(x)",examples:["csch(2)","1 / sinh(2)"],seealso:["sech","coth","sinh"]};var II={name:"sec",category:"Trigonometry",syntax:["sec(x)"],description:"Compute the secant of x in radians. Defined as 1/cos(x)",examples:["sec(2)","1 / cos(2)"],seealso:["cot","csc","cos"]};var PI={name:"sech",category:"Trigonometry",syntax:["sech(x)"],description:"Compute the hyperbolic secant of x in radians. Defined as 1/cosh(x)",examples:["sech(2)","1 / cosh(2)"],seealso:["coth","csch","cosh"]};var RI={name:"sin",category:"Trigonometry",syntax:["sin(x)"],description:"Compute the sine of x in radians.",examples:["sin(2)","sin(pi / 4) ^ 2","sin(90 deg)","sin(30 deg)","sin(0.2)^2 + cos(0.2)^2"],seealso:["asin","cos","tan"]};var kI={name:"sinh",category:"Trigonometry",syntax:["sinh(x)"],description:"Compute the hyperbolic sine of x in radians.",examples:["sinh(0.5)"],seealso:["cosh","tanh"]};var LI={name:"tan",category:"Trigonometry",syntax:["tan(x)"],description:"Compute the tangent of x in radians.",examples:["tan(0.5)","sin(0.5) / cos(0.5)","tan(pi / 4)","tan(45 deg)"],seealso:["atan","sin","cos"]};var qI={name:"tanh",category:"Trigonometry",syntax:["tanh(x)"],description:"Compute the hyperbolic tangent of x in radians.",examples:["tanh(0.5)","sinh(0.5) / cosh(0.5)"],seealso:["sinh","cosh"]};var UI={name:"to",category:"Units",syntax:["x to unit","to(x, unit)"],description:"Change the unit of a value.",examples:["5 inch to cm","3.2kg to g","16 bytes in bits"],seealso:[]};var zI={name:"bin",category:"Utils",syntax:["bin(value)"],description:"Format a number as binary",examples:["bin(2)"],seealso:["oct","hex"]};var YI={name:"clone",category:"Utils",syntax:["clone(x)"],description:"Clone a variable. Creates a copy of primitive variables,and a deep copy of matrices",examples:["clone(3.5)","clone(2 - 4i)","clone(45 deg)","clone([1, 2; 3, 4])",'clone("hello world")'],seealso:[]};var WI={name:"format",category:"Utils",syntax:["format(value)","format(value, precision)"],description:"Format a value of any type as string.",examples:["format(2.3)","format(3 - 4i)","format([])","format(pi, 3)"],seealso:["print"]};var HI={name:"hasNumericValue",category:"Utils",syntax:["hasNumericValue(x)"],description:"Test whether a value is an numeric value. In case of a string, true is returned if the string contains a numeric value.",examples:["hasNumericValue(2)",'hasNumericValue("2")','isNumeric("2")',"hasNumericValue(0)","hasNumericValue(bignumber(500))","hasNumericValue(fraction(0.125))","hasNumericValue(2 + 3i)",'hasNumericValue([2.3, "foo", false])'],seealso:["isInteger","isZero","isNegative","isPositive","isNaN","isNumeric"]};var $I={name:"hex",category:"Utils",syntax:["hex(value)"],description:"Format a number as hexadecimal",examples:["hex(240)"],seealso:["bin","oct"]};var GI={name:"isInteger",category:"Utils",syntax:["isInteger(x)"],description:"Test whether a value is an integer number.",examples:["isInteger(2)","isInteger(3.5)","isInteger([3, 0.5, -2])"],seealso:["isNegative","isNumeric","isPositive","isZero"]};var VI={name:"isNaN",category:"Utils",syntax:["isNaN(x)"],description:"Test whether a value is NaN (not a number)",examples:["isNaN(2)","isNaN(0 / 0)","isNaN(NaN)","isNaN(Infinity)"],seealso:["isNegative","isNumeric","isPositive","isZero"]};var ZI={name:"isNegative",category:"Utils",syntax:["isNegative(x)"],description:"Test whether a value is negative: smaller than zero.",examples:["isNegative(2)","isNegative(0)","isNegative(-4)","isNegative([3, 0.5, -2])"],seealso:["isInteger","isNumeric","isPositive","isZero"]};var QI={name:"isNumeric",category:"Utils",syntax:["isNumeric(x)"],description:"Test whether a value is a numeric value. Returns true when the input is a number, BigNumber, Fraction, or boolean.",examples:["isNumeric(2)",'isNumeric("2")','hasNumericValue("2")',"isNumeric(0)","isNumeric(bignumber(500))","isNumeric(fraction(0.125))","isNumeric(2 + 3i)",'isNumeric([2.3, "foo", false])'],seealso:["isInteger","isZero","isNegative","isPositive","isNaN","hasNumericValue"]};var XI={name:"isPositive",category:"Utils",syntax:["isPositive(x)"],description:"Test whether a value is positive: larger than zero.",examples:["isPositive(2)","isPositive(0)","isPositive(-4)","isPositive([3, 0.5, -2])"],seealso:["isInteger","isNumeric","isNegative","isZero"]};var KI={name:"isPrime",category:"Utils",syntax:["isPrime(x)"],description:"Test whether a value is prime: has no divisors other than itself and one.",examples:["isPrime(3)","isPrime(-2)","isPrime([2, 17, 100])"],seealso:["isInteger","isNumeric","isNegative","isZero"]};var JI={name:"isZero",category:"Utils",syntax:["isZero(x)"],description:"Test whether a value is zero.",examples:["isZero(2)","isZero(0)","isZero(-4)","isZero([3, 0, -2, 0])"],seealso:["isInteger","isNumeric","isNegative","isPositive"]};var jI={name:"numeric",category:"Utils",syntax:["numeric(x)"],description:"Convert a numeric input to a specific numeric type: number, BigNumber, or Fraction.",examples:['numeric("4")','numeric("4", "number")','numeric("4", "BigNumber")','numeric("4", "Fraction")','numeric(4, "Fraction")','numeric(fraction(2, 5), "number")'],seealso:["number","fraction","bignumber","string","format"]};var eP={name:"oct",category:"Utils",syntax:["oct(value)"],description:"Format a number as octal",examples:["oct(56)"],seealso:["bin","hex"]};var rP={name:"print",category:"Utils",syntax:["print(template, values)","print(template, values, precision)"],description:"Interpolate values into a string template.",examples:['print("Lucy is $age years old", {age: 5})','print("The value of pi is $pi", {pi: pi}, 3)','print("Hello, $user.name!", {user: {name: "John"}})','print("Values: $1, $2, $3", [6, 9, 4])'],seealso:["format"]};var tP={name:"typeOf",category:"Utils",syntax:["typeOf(x)"],description:"Get the type of a variable.",examples:["typeOf(3.5)","typeOf(2 - 4i)","typeOf(45 deg)",'typeOf("hello world")'],seealso:["getMatrixDataType"]};var nP={name:"solveODE",category:"Numeric",syntax:["solveODE(func, tspan, y0)","solveODE(func, tspan, y0, options)"],description:"Numerical Integration of Ordinary Differential Equations.",examples:["f(t,y) = y","tspan = [0, 4]","solveODE(f, tspan, 1)","solveODE(f, tspan, [1, 2])",'solveODE(f, tspan, 1, { method:"RK23", maxStep:0.1 })'],seealso:["derivative","simplifyCore"]};var aP={bignumber:ZF,boolean:QF,complex:XF,createUnit:KF,fraction:JF,index:jF,matrix:eO,number:rO,sparse:tO,splitUnit:nO,string:aO,unit:iO,e:BS,E:BS,false:BF,i:IF,Infinity:PF,LN2:kF,LN10:RF,LOG2E:qF,LOG10E:LF,NaN:UF,null:zF,pi:IS,PI:IS,phi:YF,SQRT1_2:WF,SQRT2:HF,tau:$F,true:GF,version:VF,speedOfLight:{description:"Speed of light in vacuum",examples:["speedOfLight"]},gravitationConstant:{description:"Newtonian constant of gravitation",examples:["gravitationConstant"]},planckConstant:{description:"Planck constant",examples:["planckConstant"]},reducedPlanckConstant:{description:"Reduced Planck constant",examples:["reducedPlanckConstant"]},magneticConstant:{description:"Magnetic constant (vacuum permeability)",examples:["magneticConstant"]},electricConstant:{description:"Electric constant (vacuum permeability)",examples:["electricConstant"]},vacuumImpedance:{description:"Characteristic impedance of vacuum",examples:["vacuumImpedance"]},coulomb:{description:"Coulomb's constant",examples:["coulomb"]},elementaryCharge:{description:"Elementary charge",examples:["elementaryCharge"]},bohrMagneton:{description:"Borh magneton",examples:["bohrMagneton"]},conductanceQuantum:{description:"Conductance quantum",examples:["conductanceQuantum"]},inverseConductanceQuantum:{description:"Inverse conductance quantum",examples:["inverseConductanceQuantum"]},magneticFluxQuantum:{description:"Magnetic flux quantum",examples:["magneticFluxQuantum"]},nuclearMagneton:{description:"Nuclear magneton",examples:["nuclearMagneton"]},klitzing:{description:"Von Klitzing constant",examples:["klitzing"]},bohrRadius:{description:"Borh radius",examples:["bohrRadius"]},classicalElectronRadius:{description:"Classical electron radius",examples:["classicalElectronRadius"]},electronMass:{description:"Electron mass",examples:["electronMass"]},fermiCoupling:{description:"Fermi coupling constant",examples:["fermiCoupling"]},fineStructure:{description:"Fine-structure constant",examples:["fineStructure"]},hartreeEnergy:{description:"Hartree energy",examples:["hartreeEnergy"]},protonMass:{description:"Proton mass",examples:["protonMass"]},deuteronMass:{description:"Deuteron Mass",examples:["deuteronMass"]},neutronMass:{description:"Neutron mass",examples:["neutronMass"]},quantumOfCirculation:{description:"Quantum of circulation",examples:["quantumOfCirculation"]},rydberg:{description:"Rydberg constant",examples:["rydberg"]},thomsonCrossSection:{description:"Thomson cross section",examples:["thomsonCrossSection"]},weakMixingAngle:{description:"Weak mixing angle",examples:["weakMixingAngle"]},efimovFactor:{description:"Efimov factor",examples:["efimovFactor"]},atomicMass:{description:"Atomic mass constant",examples:["atomicMass"]},avogadro:{description:"Avogadro's number",examples:["avogadro"]},boltzmann:{description:"Boltzmann constant",examples:["boltzmann"]},faraday:{description:"Faraday constant",examples:["faraday"]},firstRadiation:{description:"First radiation constant",examples:["firstRadiation"]},loschmidt:{description:"Loschmidt constant at T=273.15 K and p=101.325 kPa",examples:["loschmidt"]},gasConstant:{description:"Gas constant",examples:["gasConstant"]},molarPlanckConstant:{description:"Molar Planck constant",examples:["molarPlanckConstant"]},molarVolume:{description:"Molar volume of an ideal gas at T=273.15 K and p=101.325 kPa",examples:["molarVolume"]},sackurTetrode:{description:"Sackur-Tetrode constant at T=1 K and p=101.325 kPa",examples:["sackurTetrode"]},secondRadiation:{description:"Second radiation constant",examples:["secondRadiation"]},stefanBoltzmann:{description:"Stefan-Boltzmann constant",examples:["stefanBoltzmann"]},wienDisplacement:{description:"Wien displacement law constant",examples:["wienDisplacement"]},molarMass:{description:"Molar mass constant",examples:["molarMass"]},molarMassC12:{description:"Molar mass constant of carbon-12",examples:["molarMassC12"]},gravity:{description:"Standard acceleration of gravity (standard acceleration of free-fall on Earth)",examples:["gravity"]},planckLength:{description:"Planck length",examples:["planckLength"]},planckMass:{description:"Planck mass",examples:["planckMass"]},planckTime:{description:"Planck time",examples:["planckTime"]},planckCharge:{description:"Planck charge",examples:["planckCharge"]},planckTemperature:{description:"Planck temperature",examples:["planckTemperature"]},derivative:fO,lsolve:cO,lsolveAll:mO,lup:pO,lusolve:dO,leafCount:lO,polynomialRoot:hO,resolve:yO,simplify:xO,simplifyConstant:bO,simplifyCore:wO,symbolicEqual:SO,rationalize:gO,slu:DO,usolve:NO,usolveAll:AO,qr:vO,abs:MO,add:EO,cbrt:CO,ceil:TO,cube:_O,divide:FO,dotDivide:OO,dotMultiply:BO,dotPow:IO,exp:PO,expm:RO,expm1:kO,fix:LO,floor:qO,gcd:UO,hypot:zO,lcm:WO,log:HO,log2:VO,log1p:GO,log10:$O,mod:ZO,multiply:QO,norm:XO,nthRoot:KO,nthRoots:JO,pow:jO,round:e3,sign:r3,sqrt:t3,sqrtm:n3,square:s3,subtract:u3,unaryMinus:f3,unaryPlus:l3,xgcd:c3,invmod:YO,bitAnd:m3,bitNot:p3,bitOr:d3,bitXor:h3,leftShift:v3,rightArithShift:g3,rightLogShift:y3,bellNumbers:x3,catalan:b3,composition:w3,stirlingS2:D3,config:oO,import:sO,typed:uO,arg:S3,conj:N3,re:M3,im:A3,evaluate:E3,help:C3,distance:T3,intersect:_3,and:F3,not:O3,or:B3,xor:I3,concat:R3,count:k3,cross:L3,column:P3,ctranspose:q3,det:U3,diag:z3,diff:Y3,dot:W3,getMatrixDataType:Z3,identity:Q3,filter:$3,flatten:G3,forEach:V3,inv:X3,pinv:K3,eigs:H3,kron:J3,matrixFromFunction:rB,matrixFromRows:tB,matrixFromColumns:eB,map:j3,ones:nB,partitionSelect:aB,range:iB,resize:sB,reshape:oB,rotate:uB,rotationMatrix:fB,row:lB,size:cB,sort:mB,squeeze:pB,subset:dB,trace:hB,transpose:vB,zeros:gB,fft:yB,ifft:xB,sylvester:a3,schur:i3,lyap:o3,solveODE:nP,combinations:bB,combinationsWithRep:wB,factorial:DB,gamma:SB,kldivergence:AB,lgamma:NB,multinomial:MB,permutations:EB,pickRandom:CB,random:TB,randomInt:_B,compare:FB,compareNatural:OB,compareText:BB,deepEqual:IB,equal:PB,equalText:RB,larger:kB,largerEq:LB,smaller:qB,smallerEq:UB,unequal:zB,setCartesian:YB,setDifference:WB,setDistinct:HB,setIntersect:$B,setIsSubset:GB,setMultiplicity:VB,setPowerset:ZB,setSize:QB,setSymDifference:XB,setUnion:KB,zpk2tf:JB,freqz:jB,erf:eI,zeta:rI,cumsum:cI,mad:tI,max:nI,mean:aI,median:iI,min:oI,mode:sI,prod:uI,quantileSeq:fI,std:lI,sum:mI,variance:pI,corr:dI,acos:hI,acosh:vI,acot:gI,acoth:yI,acsc:xI,acsch:bI,asec:wI,asech:DI,asin:SI,asinh:NI,atan:AI,atanh:EI,atan2:MI,cos:CI,cosh:TI,cot:_I,coth:FI,csc:OI,csch:BI,sec:II,sech:PI,sin:RI,sinh:kI,tan:LI,tanh:qI,to:UI,clone:YI,format:WI,bin:zI,oct:eP,hex:$I,isNaN:VI,isInteger:GI,isNegative:ZI,isNumeric:QI,hasNumericValue:HI,isPositive:XI,isPrime:KI,isZero:JI,print:rP,typeOf:tP,numeric:jI};var iP="help",jZ=["typed","mathWithTransform","Help"],vy=F(iP,jZ,e=>{var{typed:r,mathWithTransform:t,Help:n}=e;return r(iP,{any:function(i){var s,c=i;if(typeof i!="string"){for(s in t)if(Xe(t,s)&&i===t[s]){c=s;break}}var f=Mt(aP,c);if(!f){var o=typeof c=="function"?c.name:c;throw new Error('No documentation found on "'+o+'"')}return new n(f)}})});var oP="chain",eQ=["typed","Chain"],gy=F(oP,eQ,e=>{var{typed:r,Chain:t}=e;return r(oP,{"":function(){return new t},any:function(a){return new t(a)}})});var sP="det",rQ=["typed","matrix","subtractScalar","multiply","divideScalar","isZero","unaryMinus"],yy=F(sP,rQ,e=>{var{typed:r,matrix:t,subtractScalar:n,multiply:a,divideScalar:i,isZero:s,unaryMinus:c}=e;return r(sP,{any:function(u){return ir(u)},"Array | Matrix":function(u){var m;switch(Qe(u)?m=u.size():Array.isArray(u)?(u=t(u),m=u.size()):m=[],m.length){case 0:return ir(u);case 1:if(m[0]===1)return ir(u.valueOf()[0]);if(m[0]===0)return 1;throw new RangeError("Matrix must be square (size: "+mr(m)+")");case 2:{var p=m[0],h=m[1];if(p===h)return f(u.clone().valueOf(),p,h);if(h===0)return 1;throw new RangeError("Matrix must be square (size: "+mr(m)+")")}default:throw new RangeError("Matrix must be two dimensional (size: "+mr(m)+")")}}});function f(o,u,m){if(u===1)return ir(o[0][0]);if(u===2)return n(a(o[0][0],o[1][1]),a(o[1][0],o[0][1]));for(var p=!1,h=new Array(u).fill(0).map((O,_)=>_),y=0;y{var{typed:r,matrix:t,divideScalar:n,addScalar:a,multiply:i,unaryMinus:s,det:c,identity:f,abs:o}=e;return r(uP,{"Array | Matrix":function(p){var h=Qe(p)?p.size():fr(p);switch(h.length){case 1:if(h[0]===1)return Qe(p)?t([n(1,p.valueOf()[0])]):[n(1,p[0])];throw new RangeError("Matrix must be square (size: "+mr(h)+")");case 2:{var y=h[0],v=h[1];if(y===v)return Qe(p)?t(u(p.valueOf(),y,v),p.storage()):u(p,y,v);throw new RangeError("Matrix must be square (size: "+mr(h)+")")}default:throw new RangeError("Matrix must be two dimensional (size: "+mr(h)+")")}},any:function(p){return n(1,p)}});function u(m,p,h){var y,v,x,b,E;if(p===1){if(b=m[0][0],b===0)throw Error("Cannot calculate inverse, determinant is zero");return[[n(1,b)]]}else if(p===2){var w=c(m);if(w===0)throw Error("Cannot calculate inverse, determinant is zero");return[[n(m[1][1],w),n(s(m[0][1]),w)],[n(s(m[1][0]),w),n(m[0][0],w)]]}else{var N=m.concat();for(y=0;yO&&(O=o(N[y][D]),_=y),y++;if(O===0)throw Error("Cannot calculate inverse, determinant is zero");y=_,y!==D&&(E=N[D],N[D]=N[y],N[y]=E,E=M[D],M[D]=M[y],M[y]=E);var C=N[D],T=M[D];for(y=0;y{var{typed:r,matrix:t,inv:n,deepEqual:a,equal:i,dotDivide:s,dot:c,ctranspose:f,divideScalar:o,multiply:u,add:m,Complex:p}=e;return r(fP,{"Array | Matrix":function(w){var N=Qe(w)?w.size():fr(w);switch(N.length){case 1:return b(w)?f(w):N[0]===1?n(w):s(f(w),c(w,w));case 2:{if(b(w))return f(w);var M=N[0],D=N[1];if(M===D)try{return n(w)}catch(O){if(!(O instanceof Error&&O.message.match(/Cannot calculate inverse, determinant is zero/)))throw O}return Qe(w)?t(h(w.valueOf(),M,D),w.storage()):h(w,M,D)}default:throw new RangeError("Matrix must be two dimensional (size: "+mr(N)+")")}},any:function(w){return i(w,0)?ir(w):o(1,w)}});function h(E,w,N){var{C:M,F:D}=v(E,w,N),O=u(n(u(f(M),M)),f(M)),_=u(f(D),n(u(D,f(D))));return u(_,O)}function y(E,w,N){for(var M=ir(E),D=0,O=0;O_.filter((T,k)=>k!x(c(M[C],M[C])));return{C:D,F:O}}function x(E){return i(m(E,p(1,1)),m(0,p(1,1)))}function b(E){return a(m(E,p(1,1)),m(u(E,0),p(1,1)))}});function lP(e){var{addScalar:r,subtract:t,flatten:n,multiply:a,multiplyScalar:i,divideScalar:s,sqrt:c,abs:f,bignumber:o,diag:u,size:m,reshape:p,inv:h,qr:y,usolve:v,usolveAll:x,equal:b,complex:E,larger:w,smaller:N,matrixFromColumns:M,dot:D}=e;function O(ae,$,ce,Ce){var pe=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,ge=_(ae,$,ce,Ce,pe);C(ae,$,ce,Ce,pe,ge);var{values:Se,C:ye}=T(ae,$,ce,Ce,pe);if(pe){var be=k(ae,$,ye,ge,Se,ce,Ce);return{values:Se,eigenvectors:be}}return{values:Se}}function _(ae,$,ce,Ce,pe){var ge=Ce==="BigNumber",Se=Ce==="Complex",ye=ge?o(0):0,be=ge?o(1):Se?E(1):1,De=ge?o(1):1,Ae=ge?o(10):2,Ye=i(Ae,Ae),Ke;pe&&(Ke=Array($).fill(be));for(var J=!1;!J;){J=!0;for(var re=0;re<$;re++){for(var xe=ye,j=ye,ne=0;ne<$;ne++)re!==ne&&(xe=r(xe,f(ae[ne][re])),j=r(j,f(ae[re][ne])));if(!b(xe,0)&&!b(j,0)){for(var ue=De,Me=xe,Ee=s(j,Ae),qe=i(j,Ae);N(Me,Ee);)Me=i(Me,Ye),ue=i(ue,Ae);for(;w(Me,qe);)Me=s(Me,Ye),ue=s(ue,Ae);var Pe=N(s(r(Me,j),ue),i(r(xe,j),.95));if(Pe){J=!1;for(var lr=s(1,ue),sr=0;sr<$;sr++)re!==sr&&(ae[re][sr]=i(ae[re][sr],lr),ae[sr][re]=i(ae[sr][re],ue));pe&&(Ke[re]=i(Ke[re],lr))}}}}return pe?u(Ke):null}function C(ae,$,ce,Ce,pe,ge){var Se=Ce==="BigNumber",ye=Ce==="Complex",be=Se?o(0):ye?E(0):0;Se&&(ce=o(ce));for(var De=0;De<$-2;De++){for(var Ae=0,Ye=be,Ke=De+1;Ke<$;Ke++){var J=ae[Ke][De];N(f(Ye),f(J))&&(Ye=J,Ae=Ke)}if(!N(f(Ye),ce)){if(Ae!==De+1){var re=ae[Ae];ae[Ae]=ae[De+1],ae[De+1]=re;for(var xe=0;xe<$;xe++){var j=ae[xe][Ae];ae[xe][Ae]=ae[xe][De+1],ae[xe][De+1]=j}if(pe){var ne=ge[Ae];ge[Ae]=ge[De+1],ge[De+1]=ne}}for(var ue=De+2;ue<$;ue++){var Me=s(ae[ue][De],Ye);if(Me!==0){for(var Ee=0;Ee<$;Ee++)ae[ue][Ee]=t(ae[ue][Ee],i(Me,ae[De+1][Ee]));for(var qe=0;qe<$;qe++)ae[qe][De+1]=r(ae[qe][De+1],i(Me,ae[qe][ue]));if(pe)for(var Pe=0;Pe<$;Pe++)ge[ue][Pe]=t(ge[ue][Pe],i(Me,ge[De+1][Pe]))}}}}return ge}function T(ae,$,ce,Ce,pe){var ge=Ce==="BigNumber",Se=Ce==="Complex",ye=ge?o(1):Se?E(1):1;ge&&(ce=o(ce));for(var be=ir(ae),De=[],Ae=$,Ye=[],Ke=pe?u(Array($).fill(ye)):void 0,J=pe?u(Array(Ae).fill(ye)):void 0,re=0;re<=100;){re+=1;for(var xe=be[Ae-1][Ae-1],j=0;j1&&(J=u(Array(Ae-1).fill(ye)))),Ae-=1,be.pop();for(var Ee=0;Ee2&&(J=u(Array(Ae-2).fill(ye)))),Ae-=2,be.pop(),be.pop();for(var Pe=0;Pe+t(f(Je),f(Pr))),re>100){var lr=Error("The eigenvalues failed to converge. Only found these eigenvalues: "+De.join(", "));throw lr.values=De,lr.vectors=[],lr}var sr=pe?a(Ke,W(Ye,$)):void 0;return{values:De,C:sr}}function k(ae,$,ce,Ce,pe,ge,Se){var ye=h(ce),be=a(ye,ae,ce),De=Se==="BigNumber",Ae=Se==="Complex",Ye=De?o(0):Ae?E(0):0,Ke=De?o(1):Ae?E(1):1,J=[],re=[];for(var xe of pe){var j=q(J,xe,b);j===-1?(J.push(xe),re.push(1)):re[j]+=1}for(var ne=[],ue=J.length,Me=Array($).fill(Ye),Ee=u(Array($).fill(Ke)),qe=function(){var sr=J[Pe],Je=t(be,a(sr,Ee)),Pr=x(Je,Me);for(Pr.shift();Pr.lengtha(le,we)),ne.push(...Pr.map(we=>({value:sr,vector:n(we)})))},Pe=0;Pe=5)return null;for(ye=0;;){var be=v(ae,Se);if(N(oe(U(Se,[be])),Ce))break;if(++ye>=10)return null;Se=me(be)}return Se}function X(ae,$,ce){var Ce=ce==="BigNumber",pe=ce==="Complex",ge=Array(ae).fill(0).map(Se=>2*Math.random()-1);return Ce&&(ge=ge.map(Se=>o(Se))),pe&&(ge=ge.map(Se=>E(Se))),ge=U(ge,$),me(ge,ce)}function U(ae,$){var ce=m(ae);for(var Ce of $)Ce=p(Ce,ce),ae=t(ae,a(s(D(Ce,ae),D(Ce,Ce)),Ce));return ae}function oe(ae){return f(c(D(ae,ae)))}function me(ae,$){var ce=$==="BigNumber",Ce=$==="Complex",pe=ce?o(1):Ce?E(1):1;return a(s(pe,oe(ae)),ae)}return O}function cP(e){var{config:r,addScalar:t,subtract:n,abs:a,atan:i,cos:s,sin:c,multiplyScalar:f,inv:o,bignumber:u,multiply:m,add:p}=e;function h(C,T){var k=arguments.length>2&&arguments[2]!==void 0?arguments[2]:r.epsilon,L=arguments.length>3?arguments[3]:void 0,H=arguments.length>4?arguments[4]:void 0;if(L==="number")return y(C,k,H);if(L==="BigNumber")return v(C,k,H);throw TypeError("Unsupported data type: "+L)}function y(C,T,k){var L=C.length,H=Math.abs(T/L),V,W;if(k){W=new Array(L);for(var q=0;q=Math.abs(H);){var X=R[0][0],U=R[0][1];V=x(C[X][X],C[U][U],C[X][U]),C=M(C,V,X,U),k&&(W=E(W,V,X,U)),R=D(C)}for(var oe=Array(L).fill(0),me=0;me=a(H);){var X=R[0][0],U=R[0][1];V=b(C[X][X],C[U][U],C[X][U]),C=N(C,V,X,U),k&&(W=w(W,V,X,U)),R=O(C)}for(var oe=Array(L).fill(0),me=0;me({value:H[$],vector:ae}));return{values:H,eigenvectors:me}}return h}var aQ="eigs",iQ=["config","typed","matrix","addScalar","equal","subtract","abs","atan","cos","sin","multiplyScalar","divideScalar","inv","bignumber","multiply","add","larger","column","flatten","number","complex","sqrt","diag","size","reshape","qr","usolve","usolveAll","im","re","smaller","matrixFromColumns","dot"],wy=F(aQ,iQ,e=>{var{config:r,typed:t,matrix:n,addScalar:a,subtract:i,equal:s,abs:c,atan:f,cos:o,sin:u,multiplyScalar:m,divideScalar:p,inv:h,bignumber:y,multiply:v,add:x,larger:b,column:E,flatten:w,number:N,complex:M,sqrt:D,diag:O,size:_,reshape:C,qr:T,usolve:k,usolveAll:L,im:H,re:V,smaller:W,matrixFromColumns:q,dot:R}=e,X=cP({config:r,addScalar:a,subtract:i,column:E,flatten:w,equal:s,abs:c,atan:f,cos:o,sin:u,multiplyScalar:m,inv:h,bignumber:y,complex:M,multiply:v,add:x}),U=lP({config:r,addScalar:a,subtract:i,multiply:v,multiplyScalar:m,flatten:w,divideScalar:p,sqrt:D,abs:c,bignumber:y,diag:O,size:_,reshape:C,qr:T,inv:h,usolve:k,usolveAll:L,equal:s,complex:M,larger:b,smaller:W,matrixFromColumns:q,dot:R});return t("eigs",{Array:function(ge){return oe(n(ge))},"Array, number|BigNumber":function(ge,Se){return oe(n(ge),{precision:Se})},"Array, Object"(pe,ge){return oe(n(pe),ge)},Matrix:function(ge){return oe(ge,{matricize:!0})},"Matrix, number|BigNumber":function(ge,Se){return oe(ge,{precision:Se,matricize:!0})},"Matrix, Object":function(ge,Se){var ye={matricize:!0};return bt(ye,Se),oe(ge,ye)}});function oe(pe){var ge,Se=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},ye="eigenvectors"in Se?Se.eigenvectors:!0,be=(ge=Se.precision)!==null&&ge!==void 0?ge:r.epsilon,De=me(pe,be,ye);return Se.matricize&&(De.values=n(De.values),ye&&(De.eigenvectors=De.eigenvectors.map(Ae=>{var{value:Ye,vector:Ke}=Ae;return{value:Ye,vector:n(Ke)}}))),ye&&Object.defineProperty(De,"vectors",{enumerable:!1,get:()=>{throw new Error("eigs(M).vectors replaced with eigs(M).eigenvectors")}}),De}function me(pe,ge,Se){var ye=pe.toArray(),be=pe.size();if(be.length!==2||be[0]!==be[1])throw new RangeError("Matrix must be square (size: ".concat(mr(be),")"));var De=be[0];if($(ye,De,ge)&&(ce(ye,De),ae(ye,De,ge))){var Ae=Ce(pe,ye,De);return X(ye,De,ge,Ae,Se)}var Ye=Ce(pe,ye,De);return U(ye,De,ge,Ye,Se)}function ae(pe,ge,Se){for(var ye=0;ye{var{typed:r,abs:t,add:n,identity:a,inv:i,multiply:s}=e;return r(mP,{Matrix:function(m){var p=m.size();if(p.length!==2||p[0]!==p[1])throw new RangeError("Matrix must be square (size: "+mr(p)+")");for(var h=p[0],y=1e-15,v=c(m),x=f(v,y),b=x.q,E=x.j,w=s(m,Math.pow(2,-E)),N=a(h),M=a(h),D=1,O=w,_=-1,C=1;C<=b;C++)C>1&&(O=s(O,w),_=-_),D=D*(b-C+1)/((2*b-C+1)*C),N=n(N,s(D,O)),M=n(M,s(D*_,O));for(var T=s(i(M),N),k=0;k{var{typed:r,abs:t,add:n,multiply:a,map:i,sqrt:s,subtract:c,inv:f,size:o,max:u,identity:m}=e,p=1e3,h=1e-6;function y(v){var x,b=0,E=v,w=m(o(v));do{var N=E;if(E=a(.5,n(N,f(w))),w=a(.5,n(w,f(N))),x=u(t(c(E,N))),x>h&&++b>p)throw new Error("computing square root of matrix: iterative method could not converge")}while(x>h);return E}return r(pP,{"Array | Matrix":function(x){var b=Qe(x)?x.size():fr(x);switch(b.length){case 1:if(b[0]===1)return i(x,s);throw new RangeError("Matrix must be square (size: "+mr(b)+")");case 2:{var E=b[0],w=b[1];if(E===w)return y(x);throw new RangeError("Matrix must be square (size: "+mr(b)+")")}default:throw new RangeError("Matrix must be at most two dimensional (size: "+mr(b)+")")}}})});var dP="sylvester",uQ=["typed","schur","matrixFromColumns","matrix","multiply","range","concat","transpose","index","subset","add","subtract","identity","lusolve","abs"],Ny=F(dP,uQ,e=>{var{typed:r,schur:t,matrixFromColumns:n,matrix:a,multiply:i,range:s,concat:c,transpose:f,index:o,subset:u,add:m,subtract:p,identity:h,lusolve:y,abs:v}=e;return r(dP,{"Matrix, Matrix, Matrix":x,"Array, Matrix, Matrix":function(E,w,N){return x(a(E),w,N)},"Array, Array, Matrix":function(E,w,N){return x(a(E),a(w),N)},"Array, Matrix, Array":function(E,w,N){return x(a(E),w,a(N))},"Matrix, Array, Matrix":function(E,w,N){return x(E,a(w),N)},"Matrix, Array, Array":function(E,w,N){return x(E,a(w),a(N))},"Matrix, Matrix, Array":function(E,w,N){return x(E,w,a(N))},"Array, Array, Array":function(E,w,N){return x(a(E),a(w),a(N)).toArray()}});function x(b,E,w){for(var N=E.size()[0],M=b.size()[0],D=t(b),O=D.T,_=D.U,C=t(i(-1,E)),T=C.T,k=C.U,L=i(i(f(_),w),k),H=s(0,M),V=[],W=(Ae,Ye)=>c(Ae,Ye,1),q=(Ae,Ye)=>c(Ae,Ye,0),R=0;R1e-5){for(var X=q(u(L,o(H,R)),u(L,o(H,R+1))),U=0;U{var{typed:r,matrix:t,identity:n,multiply:a,qr:i,norm:s,subtract:c}=e;return r(hP,{Array:function(u){var m=f(t(u));return{U:m.U.valueOf(),T:m.T.valueOf()}},Matrix:function(u){return f(u)}});function f(o){var u=o.size()[0],m=o,p=n(u),h=0,y;do{y=m;var v=i(m),x=v.Q,b=v.R;if(m=a(b,x),p=a(p,x),h++>100)break}while(s(c(m,y))>1e-4);return{U:p,T:m}}});var vP="lyap",lQ=["typed","matrix","sylvester","multiply","transpose"],My=F(vP,lQ,e=>{var{typed:r,matrix:t,sylvester:n,multiply:a,transpose:i}=e;return r(vP,{"Matrix, Matrix":function(c,f){return n(c,i(c),a(-1,f))},"Array, Matrix":function(c,f){return n(t(c),i(t(c)),a(-1,f))},"Matrix, Array":function(c,f){return n(c,i(t(c)),t(a(-1,f)))},"Array, Array":function(c,f){return n(t(c),i(t(c)),t(a(-1,f))).toArray()}})});var cQ="divide",mQ=["typed","matrix","multiply","equalScalar","divideScalar","inv"],Ey=F(cQ,mQ,e=>{var{typed:r,matrix:t,multiply:n,equalScalar:a,divideScalar:i,inv:s}=e,c=at({typed:r,equalScalar:a}),f=Ht({typed:r});return r("divide",Sp({"Array | Matrix, Array | Matrix":function(u,m){return n(u,s(m))},"DenseMatrix, any":function(u,m){return f(u,m,i,!1)},"SparseMatrix, any":function(u,m){return c(u,m,i,!1)},"Array, any":function(u,m){return f(t(u),m,i,!1).valueOf()},"any, Array | Matrix":function(u,m){return n(u,s(m))}},i.signatures))});var gP="distance",pQ=["typed","addScalar","subtractScalar","divideScalar","multiplyScalar","deepEqual","sqrt","abs"],Cy=F(gP,pQ,e=>{var{typed:r,addScalar:t,subtractScalar:n,multiplyScalar:a,divideScalar:i,deepEqual:s,sqrt:c,abs:f}=e;return r(gP,{"Array, Array, Array":function(M,D,O){if(M.length===2&&D.length===2&&O.length===2){if(!u(M))throw new TypeError("Array with 2 numbers or BigNumbers expected for first argument");if(!u(D))throw new TypeError("Array with 2 numbers or BigNumbers expected for second argument");if(!u(O))throw new TypeError("Array with 2 numbers or BigNumbers expected for third argument");if(s(D,O))throw new TypeError("LinePoint1 should not be same with LinePoint2");var _=n(O[1],D[1]),C=n(D[0],O[0]),T=n(a(O[0],D[1]),a(D[0],O[1]));return x(M[0],M[1],_,C,T)}else throw new TypeError("Invalid Arguments: Try again")},"Object, Object, Object":function(M,D,O){if(Object.keys(M).length===2&&Object.keys(D).length===2&&Object.keys(O).length===2){if(!u(M))throw new TypeError("Values of pointX and pointY should be numbers or BigNumbers");if(!u(D))throw new TypeError("Values of lineOnePtX and lineOnePtY should be numbers or BigNumbers");if(!u(O))throw new TypeError("Values of lineTwoPtX and lineTwoPtY should be numbers or BigNumbers");if(s(y(D),y(O)))throw new TypeError("LinePoint1 should not be same with LinePoint2");if("pointX"in M&&"pointY"in M&&"lineOnePtX"in D&&"lineOnePtY"in D&&"lineTwoPtX"in O&&"lineTwoPtY"in O){var _=n(O.lineTwoPtY,D.lineOnePtY),C=n(D.lineOnePtX,O.lineTwoPtX),T=n(a(O.lineTwoPtX,D.lineOnePtY),a(D.lineOnePtX,O.lineTwoPtY));return x(M.pointX,M.pointY,_,C,T)}else throw new TypeError("Key names do not match")}else throw new TypeError("Invalid Arguments: Try again")},"Array, Array":function(M,D){if(M.length===2&&D.length===3){if(!u(M))throw new TypeError("Array with 2 numbers or BigNumbers expected for first argument");if(!m(D))throw new TypeError("Array with 3 numbers or BigNumbers expected for second argument");return x(M[0],M[1],D[0],D[1],D[2])}else if(M.length===3&&D.length===6){if(!m(M))throw new TypeError("Array with 3 numbers or BigNumbers expected for first argument");if(!h(D))throw new TypeError("Array with 6 numbers or BigNumbers expected for second argument");return b(M[0],M[1],M[2],D[0],D[1],D[2],D[3],D[4],D[5])}else if(M.length===D.length&&M.length>0){if(!p(M))throw new TypeError("All values of an array should be numbers or BigNumbers");if(!p(D))throw new TypeError("All values of an array should be numbers or BigNumbers");return E(M,D)}else throw new TypeError("Invalid Arguments: Try again")},"Object, Object":function(M,D){if(Object.keys(M).length===2&&Object.keys(D).length===3){if(!u(M))throw new TypeError("Values of pointX and pointY should be numbers or BigNumbers");if(!m(D))throw new TypeError("Values of xCoeffLine, yCoeffLine and constant should be numbers or BigNumbers");if("pointX"in M&&"pointY"in M&&"xCoeffLine"in D&&"yCoeffLine"in D&&"constant"in D)return x(M.pointX,M.pointY,D.xCoeffLine,D.yCoeffLine,D.constant);throw new TypeError("Key names do not match")}else if(Object.keys(M).length===3&&Object.keys(D).length===6){if(!m(M))throw new TypeError("Values of pointX, pointY and pointZ should be numbers or BigNumbers");if(!h(D))throw new TypeError("Values of x0, y0, z0, a, b and c should be numbers or BigNumbers");if("pointX"in M&&"pointY"in M&&"x0"in D&&"y0"in D&&"z0"in D&&"a"in D&&"b"in D&&"c"in D)return b(M.pointX,M.pointY,M.pointZ,D.x0,D.y0,D.z0,D.a,D.b,D.c);throw new TypeError("Key names do not match")}else if(Object.keys(M).length===2&&Object.keys(D).length===2){if(!u(M))throw new TypeError("Values of pointOneX and pointOneY should be numbers or BigNumbers");if(!u(D))throw new TypeError("Values of pointTwoX and pointTwoY should be numbers or BigNumbers");if("pointOneX"in M&&"pointOneY"in M&&"pointTwoX"in D&&"pointTwoY"in D)return E([M.pointOneX,M.pointOneY],[D.pointTwoX,D.pointTwoY]);throw new TypeError("Key names do not match")}else if(Object.keys(M).length===3&&Object.keys(D).length===3){if(!m(M))throw new TypeError("Values of pointOneX, pointOneY and pointOneZ should be numbers or BigNumbers");if(!m(D))throw new TypeError("Values of pointTwoX, pointTwoY and pointTwoZ should be numbers or BigNumbers");if("pointOneX"in M&&"pointOneY"in M&&"pointOneZ"in M&&"pointTwoX"in D&&"pointTwoY"in D&&"pointTwoZ"in D)return E([M.pointOneX,M.pointOneY,M.pointOneZ],[D.pointTwoX,D.pointTwoY,D.pointTwoZ]);throw new TypeError("Key names do not match")}else throw new TypeError("Invalid Arguments: Try again")},Array:function(M){if(!v(M))throw new TypeError("Incorrect array format entered for pairwise distance calculation");return w(M)}});function o(N){return typeof N=="number"||tr(N)}function u(N){return N.constructor!==Array&&(N=y(N)),o(N[0])&&o(N[1])}function m(N){return N.constructor!==Array&&(N=y(N)),o(N[0])&&o(N[1])&&o(N[2])}function p(N){return Array.isArray(N)||(N=y(N)),N.every(o)}function h(N){return N.constructor!==Array&&(N=y(N)),o(N[0])&&o(N[1])&&o(N[2])&&o(N[3])&&o(N[4])&&o(N[5])}function y(N){for(var M=Object.keys(N),D=[],O=0;OM.length!==2||!o(M[0])||!o(M[1])))return!1}else if(N[0].length===3&&o(N[0][0])&&o(N[0][1])&&o(N[0][2])){if(N.some(M=>M.length!==3||!o(M[0])||!o(M[1])||!o(M[2])))return!1}else return!1;return!0}function x(N,M,D,O,_){var C=f(t(t(a(D,N),a(O,M)),_)),T=c(t(a(D,D),a(O,O)));return i(C,T)}function b(N,M,D,O,_,C,T,k,L){var H=[n(a(n(_,M),L),a(n(C,D),k)),n(a(n(C,D),T),a(n(O,N),L)),n(a(n(O,N),k),a(n(_,M),T))];H=c(t(t(a(H[0],H[0]),a(H[1],H[1])),a(H[2],H[2])));var V=c(t(t(a(T,T),a(k,k)),a(L,L)));return i(H,V)}function E(N,M){for(var D=N.length,O=0,_=0,C=0;C{var{typed:r,config:t,abs:n,add:a,addScalar:i,matrix:s,multiply:c,multiplyScalar:f,divideScalar:o,subtract:u,smaller:m,equalScalar:p,flatten:h,isZero:y,isNumeric:v}=e;return r("intersect",{"Array, Array, Array":x,"Array, Array, Array, Array":b,"Matrix, Matrix, Matrix":function(k,L,H){var V=x(k.valueOf(),L.valueOf(),H.valueOf());return V===null?null:s(V)},"Matrix, Matrix, Matrix, Matrix":function(k,L,H,V){var W=b(k.valueOf(),L.valueOf(),H.valueOf(),V.valueOf());return W===null?null:s(W)}});function x(T,k,L){if(T=E(T),k=E(k),L=E(L),!N(T))throw new TypeError("Array with 3 numbers or BigNumbers expected for first argument");if(!N(k))throw new TypeError("Array with 3 numbers or BigNumbers expected for second argument");if(!M(L))throw new TypeError("Array with 4 numbers expected as third argument");return C(T[0],T[1],T[2],k[0],k[1],k[2],L[0],L[1],L[2],L[3])}function b(T,k,L,H){if(T=E(T),k=E(k),L=E(L),H=E(H),T.length===2){if(!w(T))throw new TypeError("Array with 2 numbers or BigNumbers expected for first argument");if(!w(k))throw new TypeError("Array with 2 numbers or BigNumbers expected for second argument");if(!w(L))throw new TypeError("Array with 2 numbers or BigNumbers expected for third argument");if(!w(H))throw new TypeError("Array with 2 numbers or BigNumbers expected for fourth argument");return D(T,k,L,H)}else if(T.length===3){if(!N(T))throw new TypeError("Array with 3 numbers or BigNumbers expected for first argument");if(!N(k))throw new TypeError("Array with 3 numbers or BigNumbers expected for second argument");if(!N(L))throw new TypeError("Array with 3 numbers or BigNumbers expected for third argument");if(!N(H))throw new TypeError("Array with 3 numbers or BigNumbers expected for fourth argument");return _(T[0],T[1],T[2],k[0],k[1],k[2],L[0],L[1],L[2],H[0],H[1],H[2])}else throw new TypeError("Arrays with two or thee dimensional points expected")}function E(T){return T.length===1?T[0]:T.length>1&&Array.isArray(T[0])&&T.every(k=>Array.isArray(k)&&k.length===1)?h(T):T}function w(T){return T.length===2&&v(T[0])&&v(T[1])}function N(T){return T.length===3&&v(T[0])&&v(T[1])&&v(T[2])}function M(T){return T.length===4&&v(T[0])&&v(T[1])&&v(T[2])&&v(T[3])}function D(T,k,L,H){var V=T,W=L,q=u(V,k),R=u(W,H),X=u(f(q[0],R[1]),f(R[0],q[1]));if(y(X)||m(n(X),t.epsilon))return null;var U=f(R[0],V[1]),oe=f(R[1],V[0]),me=f(R[0],W[1]),ae=f(R[1],W[0]),$=o(i(u(u(U,oe),me),ae),X);return a(c(q,$),V)}function O(T,k,L,H,V,W,q,R,X,U,oe,me){var ae=f(u(T,k),u(L,H)),$=f(u(V,W),u(q,R)),ce=f(u(X,U),u(oe,me));return i(i(ae,$),ce)}function _(T,k,L,H,V,W,q,R,X,U,oe,me){var ae=O(T,q,U,q,k,R,oe,R,L,X,me,X),$=O(U,q,H,T,oe,R,V,k,me,X,W,L),ce=O(T,q,H,T,k,R,V,k,L,X,W,L),Ce=O(U,q,U,q,oe,R,oe,R,me,X,me,X),pe=O(H,T,H,T,V,k,V,k,W,L,W,L),ge=u(f(ae,$),f(ce,Ce)),Se=u(f(pe,Ce),f($,$));if(y(Se))return null;var ye=o(ge,Se),be=o(i(ae,f(ye,$)),Ce),De=i(T,f(ye,u(H,T))),Ae=i(k,f(ye,u(V,k))),Ye=i(L,f(ye,u(W,L))),Ke=i(q,f(be,u(U,q))),J=i(R,f(be,u(oe,R))),re=i(X,f(be,u(me,X)));return p(De,Ke)&&p(Ae,J)&&p(Ye,re)?[De,Ae,Ye]:null}function C(T,k,L,H,V,W,q,R,X,U){var oe=f(T,q),me=f(H,q),ae=f(k,R),$=f(V,R),ce=f(L,X),Ce=f(W,X),pe=u(u(u(U,oe),ae),ce),ge=u(u(u(i(i(me,$),Ce),oe),ae),ce),Se=o(pe,ge),ye=i(T,f(Se,u(H,T))),be=i(k,f(Se,u(V,k))),De=i(L,f(Se,u(W,L)));return[ye,be,De]}});var yP="sum",vQ=["typed","config","add","numeric"],Yf=F(yP,vQ,e=>{var{typed:r,config:t,add:n,numeric:a}=e;return r(yP,{"Array | Matrix":i,"Array | Matrix, number | BigNumber":s,"...":function(f){if(Ja(f))throw new TypeError("Scalar values expected in function sum");return i(f)}});function i(c){var f;return qn(c,function(o){try{f=f===void 0?o:n(f,o)}catch(u){throw It(u,"sum",o)}}),f===void 0&&(f=a(0,t.number)),typeof f=="string"&&(f=a(f,t.number)),f}function s(c,f){try{var o=fs(c,f,n);return o}catch(u){throw It(u,"sum")}}});var _y="cumsum",gQ=["typed","add","unaryPlus"],Wf=F(_y,gQ,e=>{var{typed:r,add:t,unaryPlus:n}=e;return r(_y,{Array:a,Matrix:function(o){return o.create(a(o.valueOf()))},"Array, number | BigNumber":s,"Matrix, number | BigNumber":function(o,u){return o.create(s(o.valueOf(),u))},"...":function(o){if(Ja(o))throw new TypeError("All values expected to be scalar in function cumsum");return a(o)}});function a(f){try{return i(f)}catch(o){throw It(o,_y)}}function i(f){if(f.length===0)return[];for(var o=[n(f[0])],u=1;u=u.length)throw new cn(o,u.length);try{return c(f,o)}catch(m){throw It(m,_y)}}function c(f,o){var u,m,p;if(o<=0){var h=f[0][0];if(Array.isArray(h)){for(p=jp(f),m=[],u=0;u{var{typed:r,add:t,divide:n}=e;return r(xP,{"Array | Matrix":i,"Array | Matrix, number | BigNumber":a,"...":function(c){if(Ja(c))throw new TypeError("Scalar values expected in function mean");return i(c)}});function a(s,c){try{var f=fs(s,c,t),o=Array.isArray(s)?fr(s):s.size();return n(f,o[c])}catch(u){throw It(u,"mean")}}function i(s){var c,f=0;if(qn(s,function(o){try{c=c===void 0?o:t(c,o),f++}catch(u){throw It(u,"mean",o)}}),f===0)throw new Error("Cannot calculate the mean of an empty array");return n(c,f)}});var bP="median",xQ=["typed","add","divide","compare","partitionSelect"],Fy=F(bP,xQ,e=>{var{typed:r,add:t,divide:n,compare:a,partitionSelect:i}=e;function s(o){try{o=xr(o.valueOf());var u=o.length;if(u===0)throw new Error("Cannot calculate median of an empty array");if(u%2===0){for(var m=u/2-1,p=i(o,m+1),h=o[m],y=0;y0&&(h=o[y]);return f(h,p)}else{var v=i(o,(u-1)/2);return c(v)}}catch(x){throw It(x,"median")}}var c=r({"number | BigNumber | Complex | Unit":function(u){return u}}),f=r({"number | BigNumber | Complex | Unit, number | BigNumber | Complex | Unit":function(u,m){return n(t(u,m),2)}});return r(bP,{"Array | Matrix":s,"Array | Matrix, number | BigNumber":function(u,m){throw new Error("median(A, dim) is not yet supported")},"...":function(u){if(Ja(u))throw new TypeError("Scalar values expected in function median");return s(u)}})});var wP="mad",bQ=["typed","abs","map","median","subtract"],Oy=F(wP,bQ,e=>{var{typed:r,abs:t,map:n,median:a,subtract:i}=e;return r(wP,{"Array | Matrix":s,"...":function(f){return s(f)}});function s(c){if(c=xr(c.valueOf()),c.length===0)throw new Error("Cannot calculate median absolute deviation (mad) of an empty array");try{var f=a(c);return a(n(c,function(o){return t(i(o,f))}))}catch(o){throw o instanceof TypeError&&o.message.indexOf("median")!==-1?new TypeError(o.message.replace("median","mad")):It(o,"mad")}}});var PS="unbiased",DP="variance",wQ=["typed","add","subtract","multiply","divide","apply","isNaN"],$f=F(DP,wQ,e=>{var{typed:r,add:t,subtract:n,multiply:a,divide:i,apply:s,isNaN:c}=e;return r(DP,{"Array | Matrix":function(m){return f(m,PS)},"Array | Matrix, string":f,"Array | Matrix, number | BigNumber":function(m,p){return o(m,p,PS)},"Array | Matrix, number | BigNumber, string":o,"...":function(m){return f(m,PS)}});function f(u,m){var p,h=0;if(u.length===0)throw new SyntaxError("Function variance requires one or more parameters (0 provided)");if(qn(u,function(x){try{p=p===void 0?x:t(p,x),h++}catch(b){throw It(b,"variance",x)}}),h===0)throw new Error("Cannot calculate variance of an empty array");var y=i(p,h);if(p=void 0,qn(u,function(x){var b=n(x,y);p=p===void 0?a(b,b):t(p,a(b,b))}),c(p))return p;switch(m){case"uncorrected":return i(p,h);case"biased":return i(p,h+1);case"unbiased":{var v=tr(p)?p.mul(0):0;return h===1?v:i(p,h-1)}default:throw new Error('Unknown normalization "'+m+'". Choose "unbiased" (default), "uncorrected", or "biased".')}}function o(u,m,p){try{if(u.length===0)throw new SyntaxError("Function variance requires one or more parameters (0 provided)");return s(u,m,h=>f(h,p))}catch(h){throw It(h,"variance")}}});var SP="quantileSeq",DQ=["typed","?bignumber","add","subtract","divide","multiply","partitionSelect","compare","isInteger","smaller","smallerEq","larger"],Gf=F(SP,DQ,e=>{var{typed:r,bignumber:t,add:n,subtract:a,divide:i,multiply:s,partitionSelect:c,compare:f,isInteger:o,smaller:u,smallerEq:m,larger:p}=e,h=ls({typed:r,isInteger:o});return r(SP,{"Array | Matrix, number | BigNumber":(E,w)=>v(E,w,!1),"Array | Matrix, number | BigNumber, number":(E,w,N)=>y(E,w,!1,N,v),"Array | Matrix, number | BigNumber, boolean":v,"Array | Matrix, number | BigNumber, boolean, number":(E,w,N,M)=>y(E,w,N,M,v),"Array | Matrix, Array | Matrix":(E,w)=>x(E,w,!1),"Array | Matrix, Array | Matrix, number":(E,w,N)=>y(E,w,!1,N,x),"Array | Matrix, Array | Matrix, boolean":x,"Array | Matrix, Array | Matrix, boolean, number":(E,w,N,M)=>y(E,w,N,M,x)});function y(E,w,N,M,D){return h(E,M,O=>D(O,w,N))}function v(E,w,N){var M,D=E.valueOf();if(u(w,0))throw new Error("N/prob must be non-negative");if(m(w,1))return ur(w)?b(D,w,N):t(b(D,w,N));if(p(w,1)){if(!o(w))throw new Error("N must be a positive integer");if(p(w,4294967295))throw new Error("N must be less than or equal to 2^32-1, as that is the maximum length of an Array");var O=n(w,1);M=[];for(var _=0;u(_,w);_++){var C=i(_+1,O);M.push(b(D,C,N))}return ur(w)?M:t(M)}}function x(E,w,N){for(var M=E.valueOf(),D=w.valueOf(),O=[],_=0;_0&&(T=M[L])}return n(s(T,a(1,C)),s(k,C))}});var NP="std",SQ=["typed","map","sqrt","variance"],Vf=F(NP,SQ,e=>{var{typed:r,map:t,sqrt:n,variance:a}=e;return r(NP,{"Array | Matrix":i,"Array | Matrix, string":i,"Array | Matrix, number | BigNumber":i,"Array | Matrix, number | BigNumber, string":i,"...":function(c){return i(c)}});function i(s,c){if(s.length===0)throw new SyntaxError("Function std requires one or more parameters (0 provided)");try{var f=a.apply(null,arguments);return _t(f)?t(f,n):n(f)}catch(o){throw o instanceof TypeError&&o.message.indexOf(" variance")!==-1?new TypeError(o.message.replace(" variance"," std")):o}}});var AP="corr",NQ=["typed","matrix","mean","sqrt","sum","add","subtract","multiply","pow","divide"],By=F(AP,NQ,e=>{var{typed:r,matrix:t,sqrt:n,sum:a,add:i,subtract:s,multiply:c,pow:f,divide:o}=e;return r(AP,{"Array, Array":function(h,y){return u(h,y)},"Matrix, Matrix":function(h,y){var v=u(h.toArray(),y.toArray());return Array.isArray(v)?t(v):v}});function u(p,h){var y=[];if(Array.isArray(p[0])&&Array.isArray(h[0])){if(p.length!==h.length)throw new SyntaxError("Dimension mismatch. Array A and B must have the same length.");for(var v=0;vi(D,c(O,h[_])),0),E=a(p.map(D=>f(D,2))),w=a(h.map(D=>f(D,2))),N=s(c(y,b),c(v,x)),M=n(c(s(c(y,E),f(v,2)),s(c(y,w),f(x,2))));return o(N,M)}});var MP="combinations",AQ=["typed"],Iy=F(MP,AQ,e=>{var{typed:r}=e;return r(MP,{"number, number":ZD,"BigNumber, BigNumber":function(n,a){var i=n.constructor,s,c,f=n.minus(a),o=new i(1);if(!EP(n)||!EP(a))throw new TypeError("Positive integer value expected in function combinations");if(a.gt(n))throw new TypeError("k must be less than n in function combinations");if(s=o,a.lt(f))for(c=o;c.lte(f);c=c.plus(o))s=s.times(a.plus(c)).dividedBy(c);else for(c=o;c.lte(a);c=c.plus(o))s=s.times(f.plus(c)).dividedBy(c);return s}})});function EP(e){return e.isInteger()&&e.gte(0)}var CP="combinationsWithRep",MQ=["typed"],Py=F(CP,MQ,e=>{var{typed:r}=e;return r(CP,{"number, number":function(n,a){if(!Ze(n)||n<0)throw new TypeError("Positive integer value expected in function combinationsWithRep");if(!Ze(a)||a<0)throw new TypeError("Positive integer value expected in function combinationsWithRep");if(n<1)throw new TypeError("k must be less than or equal to n + k - 1");if(a{var{typed:r,config:t,multiplyScalar:n,pow:a,BigNumber:i,Complex:s}=e;function c(o){if(o.im===0)return wc(o.re);if(o.re<.5){var u=new s(1-o.re,-o.im),m=new s(Math.PI*o.re,Math.PI*o.im);return new s(Math.PI).div(m.sin()).div(c(u))}o=new s(o.re-1,o.im);for(var p=new s(su[0],0),h=1;h2;)p-=2,y+=p,h=h.times(y);return new i(h.toPrecision(i.precision))}});var FP="lgamma",CQ=["Complex","typed"],ky=F(FP,CQ,e=>{var{Complex:r,typed:t}=e,n=7,a=7,i=[-.029550653594771242,.00641025641025641,-.0019175269175269176,.0008417508417508417,-.0005952380952380953,.0007936507936507937,-.002777777777777778,.08333333333333333];return t(FP,{number:Dc,Complex:s,BigNumber:function(){throw new Error("mathjs doesn't yet provide an implementation of the algorithm lgamma for BigNumber")}});function s(o){var u=6.283185307179586,m=1.1447298858494002,p=.1;if(o.isNaN())return new r(NaN,NaN);if(o.im===0)return new r(Dc(o.re),0);if(o.re>=n||Math.abs(o.im)>=a)return c(o);if(o.re<=p){var h=uE(u,o.im)*Math.floor(.5*o.re+.25),y=o.mul(Math.PI).sin().log(),v=s(new r(1-o.re,-o.im));return new r(m,h).sub(y).sub(v)}else return o.im>=0?f(o):f(o.conjugate()).conjugate()}function c(o){for(var u=o.sub(.5).mul(o.log()).sub(o).add(rS),m=new r(1,0).div(o),p=m.div(o),h=i[0],y=i[1],v=2*p.re,x=p.re*p.re+p.im*p.im,b=2;b<8;b++){var E=y;y=-x*h+i[b],h=v*h+E}var w=m.mul(p.mul(h).add(y));return u.add(w)}function f(o){var u=0,m=0,p=o;for(o=o.add(1);o.re<=n;){p=p.mul(o);var h=p.im<0?1:0;h!==0&&m===0&&u++,m=h,o=o.add(1)}return c(o).sub(p.log()).sub(new r(0,u*2*Math.PI*1))}});var OP="factorial",TQ=["typed","gamma"],Ly=F(OP,TQ,e=>{var{typed:r,gamma:t}=e;return r(OP,{number:function(a){if(a<0)throw new Error("Value must be non-negative");return t(a+1)},BigNumber:function(a){if(a.isNegative())throw new Error("Value must be non-negative");return t(a.plus(1))},"Array | Matrix":r.referToSelf(n=>a=>er(a,n))})});var BP="kldivergence",_Q=["typed","matrix","divide","sum","multiply","map","dotDivide","log","isNumeric"],qy=F(BP,_Q,e=>{var{typed:r,matrix:t,divide:n,sum:a,multiply:i,map:s,dotDivide:c,log:f,isNumeric:o}=e;return r(BP,{"Array, Array":function(p,h){return u(t(p),t(h))},"Matrix, Array":function(p,h){return u(p,t(h))},"Array, Matrix":function(p,h){return u(t(p),h)},"Matrix, Matrix":function(p,h){return u(p,h)}});function u(m,p){var h=p.size().length,y=m.size().length;if(h>1)throw new Error("first object must be one dimensional");if(y>1)throw new Error("second object must be one dimensional");if(h!==y)throw new Error("Length of two vectors must be equal");var v=a(m);if(v===0)throw new Error("Sum of elements in first object must be non zero");var x=a(p);if(x===0)throw new Error("Sum of elements in second object must be non zero");var b=n(m,a(m)),E=n(p,a(p)),w=a(i(b,s(c(b,E),N=>f(N))));return o(w)?w:Number.NaN}});var IP="multinomial",FQ=["typed","add","divide","multiply","factorial","isInteger","isPositive"],Uy=F(IP,FQ,e=>{var{typed:r,add:t,divide:n,multiply:a,factorial:i,isInteger:s,isPositive:c}=e;return r(IP,{"Array | Matrix":function(o){var u=0,m=1;return qn(o,function(p){if(!s(p)||!c(p))throw new TypeError("Positive integer value expected in function multinomial");u=t(u,p),m=a(m,i(p))}),n(i(u),m)}})});var PP="permutations",OQ=["typed","factorial"],zy=F(PP,OQ,e=>{var{typed:r,factorial:t}=e;return r(PP,{"number | BigNumber":t,"number, number":function(a,i){if(!Ze(a)||a<0)throw new TypeError("Positive integer value expected in function permutations");if(!Ze(i)||i<0)throw new TypeError("Positive integer value expected in function permutations");if(i>a)throw new TypeError("second argument k must be less than or equal to first argument n");return Oa(a-i+1,a)},"BigNumber, BigNumber":function(a,i){var s,c;if(!RP(a)||!RP(i))throw new TypeError("Positive integer value expected in function permutations");if(i.gt(a))throw new TypeError("second argument k must be less than or equal to first argument n");var f=a.mul(0).add(1);for(s=f,c=a.minus(i).plus(1);c.lte(a);c=c.plus(1))s=s.times(c);return s}})});function RP(e){return e.isInteger()&&e.gte(0)}var YS=Aa(jP(),1),qQ=(0,YS.default)(Date.now());function Eo(e){var r;function t(a){r=a===null?qQ:(0,YS.default)(String(a))}t(e);function n(){return r()}return n}var e4="pickRandom",UQ=["typed","config","?on"],Wy=F(e4,UQ,e=>{var{typed:r,config:t,on:n}=e,a=Eo(t.randomSeed);return n&&n("config",function(s,c){s.randomSeed!==c.randomSeed&&(a=Eo(s.randomSeed))}),r(e4,{"Array | Matrix":function(c){return i(c,{})},"Array | Matrix, Object":function(c,f){return i(c,f)},"Array | Matrix, number":function(c,f){return i(c,{number:f})},"Array | Matrix, Array | Matrix":function(c,f){return i(c,{weights:f})},"Array | Matrix, Array | Matrix, number":function(c,f,o){return i(c,{number:o,weights:f})},"Array | Matrix, number, Array | Matrix":function(c,f,o){return i(c,{number:f,weights:o})}});function i(s,c){var{number:f,weights:o,elementWise:u=!0}=c,m=typeof f>"u";m&&(f=1);var p=Qe(s)?s.create:Qe(o)?o.create:null;s=s.valueOf(),o&&(o=o.valueOf()),u===!0&&(s=xr(s),o=xr(o));var h=0;if(typeof o<"u"){if(o.length!==s.length)throw new Error("Weights must have the same length as possibles");for(var y=0,v=o.length;y"u")E=s[Math.floor(a()*x)];else for(var w=a()*h,N=0,M=s.length;N1)for(var n=0,a=e.shift();n{var{typed:r,config:t,on:n}=e,a=Eo(t.randomSeed);return n&&n("config",function(c,f){c.randomSeed!==f.randomSeed&&(a=Eo(c.randomSeed))}),r(r4,{"":()=>s(0,1),number:c=>s(0,c),"number, number":(c,f)=>s(c,f),"Array | Matrix":c=>i(c,0,1),"Array | Matrix, number":(c,f)=>i(c,0,f),"Array | Matrix, number, number":(c,f,o)=>i(c,f,o)});function i(c,f,o){var u=Ec(c.valueOf(),()=>s(f,o));return Qe(c)?c.create(u):u}function s(c,f){return c+a()*(f-c)}});var t4="randomInt",YQ=["typed","config","?on"],$y=F(t4,YQ,e=>{var{typed:r,config:t,on:n}=e,a=Eo(t.randomSeed);return n&&n("config",function(c,f){c.randomSeed!==f.randomSeed&&(a=Eo(c.randomSeed))}),r(t4,{"":()=>s(0,1),number:c=>s(0,c),"number, number":(c,f)=>s(c,f),"Array | Matrix":c=>i(c,0,1),"Array | Matrix, number":(c,f)=>i(c,0,f),"Array | Matrix, number, number":(c,f,o)=>i(c,f,o)});function i(c,f,o){var u=Ec(c.valueOf(),()=>s(f,o));return Qe(c)?c.create(u):u}function s(c,f){return Math.floor(c+a()*(f-c))}});var n4="stirlingS2",WQ=["typed","addScalar","subtractScalar","multiplyScalar","divideScalar","pow","factorial","combinations","isNegative","isInteger","number","?bignumber","larger"],Gy=F(n4,WQ,e=>{var{typed:r,addScalar:t,subtractScalar:n,multiplyScalar:a,divideScalar:i,pow:s,factorial:c,combinations:f,isNegative:o,isInteger:u,number:m,bignumber:p,larger:h}=e,y=[],v=[];return r(n4,{"number | BigNumber, number | BigNumber":function(b,E){if(!u(b)||o(b)||!u(E)||o(E))throw new TypeError("Non-negative integer value expected in function stirlingS2");if(h(E,b))throw new TypeError("k must be less than or equal to n in function stirlingS2");var w=!(ur(b)&&ur(E)),N=w?v:y,M=w?p:m,D=m(b),O=m(E);if(N[D]&&N[D].length>O)return N[D][O];for(var _=0;_<=D;++_)if(N[_]||(N[_]=[M(_===0?1:0)]),_!==0)for(var C=N[_],T=N[_-1],k=C.length;k<=_&&k<=O;++k)k===_?C[k]=1:C[k]=t(a(M(k),T[k]),T[k-1]);return N[D][O]}})});var a4="bellNumbers",HQ=["typed","addScalar","isNegative","isInteger","stirlingS2"],Vy=F(a4,HQ,e=>{var{typed:r,addScalar:t,isNegative:n,isInteger:a,stirlingS2:i}=e;return r(a4,{"number | BigNumber":function(c){if(!a(c)||n(c))throw new TypeError("Non-negative integer value expected in function bellNumbers");for(var f=0,o=0;o<=c;o++)f=t(f,i(c,o));return f}})});var i4="catalan",$Q=["typed","addScalar","divideScalar","multiplyScalar","combinations","isNegative","isInteger"],Zy=F(i4,$Q,e=>{var{typed:r,addScalar:t,divideScalar:n,multiplyScalar:a,combinations:i,isNegative:s,isInteger:c}=e;return r(i4,{"number | BigNumber":function(o){if(!c(o)||s(o))throw new TypeError("Non-negative integer value expected in function catalan");return n(i(a(o,2),o),t(o,1))}})});var o4="composition",GQ=["typed","addScalar","combinations","isNegative","isPositive","isInteger","larger"],Qy=F(o4,GQ,e=>{var{typed:r,addScalar:t,combinations:n,isPositive:a,isNegative:i,isInteger:s,larger:c}=e;return r(o4,{"number | BigNumber, number | BigNumber":function(o,u){if(!s(o)||!a(o)||!s(u)||!a(u))throw new TypeError("Positive integer value expected in function composition");if(c(u,o))throw new TypeError("k must be less than or equal to n in function composition");return n(t(o,-1),t(u,-1))}})});var s4="leafCount",VQ=["parse","typed"],Xy=F(s4,VQ,e=>{var{parse:r,typed:t}=e;function n(a){var i=0;return a.forEach(s=>{i+=n(s)}),i||1}return t(s4,{Node:function(i){return n(i)}})});function WS(e){return wr(e)||ht(e)&&e.isUnary()&&wr(e.args[0])}function Cc(e){return!!(wr(e)||(Cn(e)||ht(e))&&e.args.every(Cc)||fn(e)&&Cc(e.content))}function u4(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),t.push.apply(t,n)}return t}function HS(e){for(var r=1;r{var{FunctionNode:r,OperatorNode:t,SymbolNode:n}=e,a=!0,i=!1,s="defaultF",c={add:{trivial:a,total:a,commutative:a,associative:a},unaryPlus:{trivial:a,total:a,commutative:a,associative:a},subtract:{trivial:i,total:a,commutative:i,associative:i},multiply:{trivial:a,total:a,commutative:a,associative:a},divide:{trivial:i,total:a,commutative:i,associative:i},paren:{trivial:a,total:a,commutative:a,associative:i},defaultF:{trivial:i,total:a,commutative:i,associative:i}},f={divide:{total:i},log:{total:i}},o={subtract:{total:i},abs:{trivial:a},log:{total:a}};function u(w,N){var M=arguments.length>2&&arguments[2]!==void 0?arguments[2]:c,D=s;if(typeof w=="string"?D=w:ht(w)?D=w.fn.toString():Cn(w)?D=w.name:fn(w)&&(D="paren"),Xe(M,D)){var O=M[D];if(Xe(O,N))return O[N];if(Xe(c,D))return c[D][N]}if(Xe(M,s)){var _=M[s];return Xe(_,N)?_[N]:c[s][N]}if(Xe(c,D)){var C=c[D];if(Xe(C,N))return C[N]}return c[s][N]}function m(w){var N=arguments.length>1&&arguments[1]!==void 0?arguments[1]:c;return u(w,"commutative",N)}function p(w){var N=arguments.length>1&&arguments[1]!==void 0?arguments[1]:c;return u(w,"associative",N)}function h(w,N){var M=HS({},w);for(var D in N)Xe(w,D)?M[D]=HS(HS({},N[D]),w[D]):M[D]=N[D];return M}function y(w,N){if(!w.args||w.args.length===0)return w;w.args=v(w,N);for(var M=0;M2&&p(w,N)){for(var _=w.args.pop();w.args.length>0;)_=M([w.args.pop(),_]);w.args=_.args}}}function b(w,N){if(!(!w.args||w.args.length===0)){for(var M=E(w),D=w.args.length,O=0;O2&&p(w,N)){for(var _=w.args.shift();w.args.length>0;)_=M([_,w.args.shift()]);w.args=_.args}}}function E(w){return ht(w)?function(N){try{return new t(w.op,w.fn,N,w.implicit)}catch(M){return console.error(M),[]}}:function(N){return new r(new n(w.name),N)}}return{createMakeNodeFunction:E,hasProperty:u,isCommutative:m,isAssociative:p,mergeContext:h,flatten:y,allChildren:v,unflattenr:x,unflattenl:b,defaultContext:c,realContext:f,positiveContext:o}});var XQ="simplify",KQ=["config","typed","parse","add","subtract","multiply","divide","pow","isZero","equal","resolve","simplifyConstant","simplifyCore","?fraction","?bignumber","mathWithTransform","matrix","AccessorNode","ArrayNode","ConstantNode","FunctionNode","IndexNode","ObjectNode","OperatorNode","ParenthesisNode","SymbolNode"],Ky=F(XQ,KQ,e=>{var{config:r,typed:t,parse:n,add:a,subtract:i,multiply:s,divide:c,pow:f,isZero:o,equal:u,resolve:m,simplifyConstant:p,simplifyCore:h,fraction:y,bignumber:v,mathWithTransform:x,matrix:b,AccessorNode:E,ArrayNode:w,ConstantNode:N,FunctionNode:M,IndexNode:D,ObjectNode:O,OperatorNode:_,ParenthesisNode:C,SymbolNode:T}=e,{hasProperty:k,isCommutative:L,isAssociative:H,mergeContext:V,flatten:W,unflattenr:q,unflattenl:R,createMakeNodeFunction:X,defaultContext:U,realContext:oe,positiveContext:me}=Zf({FunctionNode:M,OperatorNode:_,SymbolNode:T});t.addConversion({from:"Object",to:"Map",convert:So});var ae=t("simplify",{Node:ye,"Node, Map":(j,ne)=>ye(j,!1,ne),"Node, Map, Object":(j,ne,ue)=>ye(j,!1,ne,ue),"Node, Array":ye,"Node, Array, Map":ye,"Node, Array, Map, Object":ye});t.removeConversion({from:"Object",to:"Map",convert:So}),ae.defaultContext=U,ae.realContext=oe,ae.positiveContext=me;function $(j){return j.transform(function(ne,ue,Me){return fn(ne)?$(ne.content):ne})}var ce={true:!0,false:!0,e:!0,i:!0,Infinity:!0,LN2:!0,LN10:!0,LOG2E:!0,LOG10E:!0,NaN:!0,phi:!0,pi:!0,SQRT1_2:!0,SQRT2:!0,tau:!0};ae.rules=[h,{l:"log(e)",r:"1"},{s:"n-n1 -> n+-n1",assuming:{subtract:{total:!0}}},{s:"n-n -> 0",assuming:{subtract:{total:!1}}},{s:"-(cl*v) -> v * (-cl)",assuming:{multiply:{commutative:!0},subtract:{total:!0}}},{s:"-(cl*v) -> (-cl) * v",assuming:{multiply:{commutative:!1},subtract:{total:!0}}},{s:"-(v*cl) -> v * (-cl)",assuming:{multiply:{commutative:!1},subtract:{total:!0}}},{l:"-(n1/n2)",r:"-n1/n2"},{l:"-v",r:"v * (-1)"},{l:"(n1 + n2)*(-1)",r:"n1*(-1) + n2*(-1)",repeat:!0},{l:"n/n1^n2",r:"n*n1^-n2"},{l:"n/n1",r:"n*n1^-1"},{s:"(n1*n2)^n3 -> n1^n3 * n2^n3",assuming:{multiply:{commutative:!0}}},{s:"(n1*n2)^(-1) -> n2^(-1) * n1^(-1)",assuming:{multiply:{commutative:!1}}},{s:"(n ^ n1) ^ n2 -> n ^ (n1 * n2)",assuming:{divide:{total:!0}}},{l:" vd * ( vd * n1 + n2)",r:"vd^2 * n1 + vd * n2"},{s:" vd * (vd^n4 * n1 + n2) -> vd^(1+n4) * n1 + vd * n2",assuming:{divide:{total:!0}}},{s:"vd^n3 * ( vd * n1 + n2) -> vd^(n3+1) * n1 + vd^n3 * n2",assuming:{divide:{total:!0}}},{s:"vd^n3 * (vd^n4 * n1 + n2) -> vd^(n3+n4) * n1 + vd^n3 * n2",assuming:{divide:{total:!0}}},{l:"n*n",r:"n^2"},{s:"n * n^n1 -> n^(n1+1)",assuming:{divide:{total:!0}}},{s:"n^n1 * n^n2 -> n^(n1+n2)",assuming:{divide:{total:!0}}},p,{s:"n+n -> 2*n",assuming:{add:{total:!0}}},{l:"n+-n",r:"0"},{l:"vd*n + vd",r:"vd*(n+1)"},{l:"n3*n1 + n3*n2",r:"n3*(n1+n2)"},{l:"n3^(-n4)*n1 + n3 * n2",r:"n3^(-n4)*(n1 + n3^(n4+1) *n2)"},{l:"n3^(-n4)*n1 + n3^n5 * n2",r:"n3^(-n4)*(n1 + n3^(n4+n5)*n2)"},{s:"n*vd + vd -> (n+1)*vd",assuming:{multiply:{commutative:!1}}},{s:"vd + n*vd -> (1+n)*vd",assuming:{multiply:{commutative:!1}}},{s:"n1*n3 + n2*n3 -> (n1+n2)*n3",assuming:{multiply:{commutative:!1}}},{s:"n^n1 * n -> n^(n1+1)",assuming:{divide:{total:!0},multiply:{commutative:!1}}},{s:"n1*n3^(-n4) + n2 * n3 -> (n1 + n2*n3^(n4 + 1))*n3^(-n4)",assuming:{multiply:{commutative:!1}}},{s:"n1*n3^(-n4) + n2 * n3^n5 -> (n1 + n2*n3^(n4 + n5))*n3^(-n4)",assuming:{multiply:{commutative:!1}}},{l:"n*cd + cd",r:"(n+1)*cd"},{s:"cd*n + cd -> cd*(n+1)",assuming:{multiply:{commutative:!1}}},{s:"cd + cd*n -> cd*(1+n)",assuming:{multiply:{commutative:!1}}},p,{s:"(-n)*n1 -> -(n*n1)",assuming:{subtract:{total:!0}}},{s:"n1*(-n) -> -(n1*n)",assuming:{subtract:{total:!0},multiply:{commutative:!1}}},{s:"ce+ve -> ve+ce",assuming:{add:{commutative:!0}},imposeContext:{add:{commutative:!1}}},{s:"vd*cd -> cd*vd",assuming:{multiply:{commutative:!0}},imposeContext:{multiply:{commutative:!1}}},{l:"n+-n1",r:"n-n1"},{l:"n+-(n1)",r:"n-(n1)"},{s:"n*(n1^-1) -> n/n1",assuming:{multiply:{commutative:!0}}},{s:"n*n1^-n2 -> n/n1^n2",assuming:{multiply:{commutative:!0}}},{s:"n^-1 -> 1/n",assuming:{multiply:{commutative:!0}}},{l:"n^1",r:"n"},{s:"n*(n1/n2) -> (n*n1)/n2",assuming:{multiply:{associative:!0}}},{s:"n-(n1+n2) -> n-n1-n2",assuming:{addition:{associative:!0,commutative:!0}}},{l:"1*n",r:"n",imposeContext:{multiply:{commutative:!0}}},{s:"n1/(n2/n3) -> (n1*n3)/n2",assuming:{multiply:{associative:!0}}},{l:"n1/(-n2)",r:"-n1/n2"}];function Ce(j,ne){var ue={};if(j.s){var Me=j.s.split("->");if(Me.length===2)ue.l=Me[0],ue.r=Me[1];else throw SyntaxError("Could not parse rule: "+j.s)}else ue.l=j.l,ue.r=j.r;ue.l=$(n(ue.l)),ue.r=$(n(ue.r));for(var Ee of["imposeContext","repeat","assuming"])Ee in j&&(ue[Ee]=j[Ee]);if(j.evaluate&&(ue.evaluate=n(j.evaluate)),H(ue.l,ne)){var qe=!L(ue.l,ne),Pe;qe&&(Pe=Se());var lr=X(ue.l),sr=Se();ue.expanded={},ue.expanded.l=lr([ue.l,sr]),W(ue.expanded.l,ne),q(ue.expanded.l,ne),ue.expanded.r=lr([ue.r,sr]),qe&&(ue.expandedNC1={},ue.expandedNC1.l=lr([Pe,ue.l]),ue.expandedNC1.r=lr([Pe,ue.r]),ue.expandedNC2={},ue.expandedNC2.l=lr([Pe,ue.expanded.l]),ue.expandedNC2.r=lr([Pe,ue.expanded.r]))}return ue}function pe(j,ne){for(var ue=[],Me=0;Me2&&arguments[2]!==void 0?arguments[2]:as(),Me=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{},Ee=Me.consoleDebug;ne=pe(ne||ae.rules,Me.context);var qe=m(j,ue);qe=$(qe);for(var Pe={},lr=qe.toString({parenthesis:"all"});!Pe[lr];){Pe[lr]=!0,ge=0;var sr=lr;Ee&&console.log("Working on: ",lr);for(var Je=0;Je ").concat(ne[Je].r.toString()))),Ee){var ee=qe.toString({parenthesis:"all"});ee!==sr&&(console.log("Applying",Pr,"produced",ee),sr=ee)}R(qe,Me.context)}lr=qe.toString({parenthesis:"all"})}return qe}function be(j,ne,ue){var Me=j;if(j)for(var Ee=0;Ee1&&(sr=qe(j.args.slice(0,lr))),Ee=j.args.slice(lr),Me=Ee.length===1?Ee[0]:qe(Ee),ue.push(qe([sr,Me]))}return ue}function Ye(j,ne){var ue={placeholders:{}};if(!j.placeholders&&!ne.placeholders)return ue;if(j.placeholders){if(!ne.placeholders)return j}else return ne;for(var Me in j.placeholders)if(Xe(j.placeholders,Me)&&(ue.placeholders[Me]=j.placeholders[Me],Xe(ne.placeholders,Me)&&!xe(j.placeholders[Me],ne.placeholders[Me])))return null;for(var Ee in ne.placeholders)Xe(ne.placeholders,Ee)&&(ue.placeholders[Ee]=ne.placeholders[Ee]);return ue}function Ke(j,ne){var ue=[];if(j.length===0||ne.length===0)return ue;for(var Me,Ee=0;Ee2)throw new Error("permuting >2 commutative non-associative rule arguments not yet implemented");var sr=re(j.args[0],ne.args[1],ue);if(sr.length===0)return[];var Je=re(j.args[1],ne.args[0],ue);if(Je.length===0)return[];qe=[sr,Je]}Ee=J(qe)}else if(ne.args.length>=2&&j.args.length===2){for(var Pr=Ae(ne,ue),ee=[],le=0;le2)throw Error("Unexpected non-binary associative function: "+j.toString());return[]}}else if(j instanceof T){if(j.name.length===0)throw new Error("Symbol in rule has 0 length...!?");if(ce[j.name]){if(j.name!==ne.name)return[]}else switch(j.name[1]>="a"&&j.name[1]<="z"?j.name.substring(0,2):j.name[0]){case"n":case"_p":Ee[0].placeholders[j.name]=ne;break;case"c":case"cl":if(wr(ne))Ee[0].placeholders[j.name]=ne;else return[];break;case"v":if(!wr(ne))Ee[0].placeholders[j.name]=ne;else return[];break;case"vl":if(ft(ne))Ee[0].placeholders[j.name]=ne;else return[];break;case"cd":if(WS(ne))Ee[0].placeholders[j.name]=ne;else return[];break;case"vd":if(!WS(ne))Ee[0].placeholders[j.name]=ne;else return[];break;case"ce":if(Cc(ne))Ee[0].placeholders[j.name]=ne;else return[];break;case"ve":if(!Cc(ne))Ee[0].placeholders[j.name]=ne;else return[];break;default:throw new Error("Invalid symbol in rule: "+j.name)}}else if(j instanceof N){if(!u(j.value,ne.value))return[]}else return[];return Ee}function xe(j,ne){if(j instanceof N&&ne instanceof N){if(!u(j.value,ne.value))return!1}else if(j instanceof T&&ne instanceof T){if(j.name!==ne.name)return!1}else if(j instanceof _&&ne instanceof _||j instanceof M&&ne instanceof M){if(j instanceof _){if(j.op!==ne.op||j.fn!==ne.fn)return!1}else if(j instanceof M&&j.name!==ne.name)return!1;if(j.args.length!==ne.args.length)return!1;for(var ue=0;ue{var{typed:r,config:t,mathWithTransform:n,matrix:a,fraction:i,bignumber:s,AccessorNode:c,ArrayNode:f,ConstantNode:o,FunctionNode:u,IndexNode:m,ObjectNode:p,OperatorNode:h,SymbolNode:y}=e,{isCommutative:v,isAssociative:x,allChildren:b,createMakeNodeFunction:E}=Zf({FunctionNode:u,OperatorNode:h,SymbolNode:y}),w=r("simplifyConstant",{Node:W=>O(V(W,{})),"Node, Object":function(q,R){return O(V(q,R))}});function N(W){return _a(W)?W.valueOf():W instanceof Array?W.map(N):Qe(W)?a(N(W.valueOf())):W}function M(W,q,R){try{return n[W].apply(null,q)}catch{return q=q.map(N),C(n[W].apply(null,q),R)}}var D=r({Fraction:k,number:function(q){return q<0?T(new o(-q)):new o(q)},BigNumber:function(q){return q<0?T(new o(-q)):new o(q)},Complex:function(q){throw new Error("Cannot convert Complex number to Node")},string:function(q){return new o(q)},Matrix:function(q){return new f(q.valueOf().map(R=>D(R)))}});function O(W){return Mr(W)?W:D(W)}function _(W,q){var R=q&&q.exactFractions!==!1;if(R&&isFinite(W)&&i){var X=i(W),U=q&&typeof q.fractionsLimit=="number"?q.fractionsLimit:1/0;if(X.valueOf()===W&&X.n0;)if(wr(X[0])&&typeof X[0].value!="string"){var U=C(X.shift().value,R);un(W)?W=W.items[U-1]:(W=W.valueOf()[U-1],W instanceof Array&&(W=a(W)))}else if(X.length>1&&wr(X[1])&&typeof X[1].value!="string"){var oe=C(X[1].value,R),me=[],ae=un(W)?W.items:W.valueOf();for(var $ of ae)if(un($))me.push($.items[oe-1]);else if(Qe(W))me.push($[oe-1]);else break;if(me.length===ae.length)un(W)?W=new f(me):W=a(me),X.splice(1,1);else break}else break;return X.length===q.dimensions.length?new c(O(W),q):X.length>0?(q=new m(X),new c(O(W),q)):W}if(Vi(W)&&q.dimensions.length===1&&wr(q.dimensions[0])){var ce=q.dimensions[0].value;return ce in W.properties?W.properties[ce]:new o}return new c(O(W),q)}function H(W,q,R,X){var U=q.shift(),oe=q.reduce((me,ae)=>{if(!Mr(ae)){var $=me.pop();if(Mr($))return[$,ae];try{return me.push(M(W,[$,ae],X)),me}catch{me.push($)}}me.push(O(me.pop()));var ce=me.length===1?me[0]:R(me);return[R([ce,O(ae)])]},[U]);return oe.length===1?oe[0]:R([oe[0],D(oe[1])])}function V(W,q){switch(W.type){case"SymbolNode":return W;case"ConstantNode":switch(typeof W.value){case"number":return C(W.value,q);case"string":return W.value;default:if(!isNaN(W.value))return C(W.value,q)}return W;case"FunctionNode":if(n[W.name]&&n[W.name].rawArgs)return W;{var R=["add","multiply"];if(R.indexOf(W.name)===-1){var X=W.args.map(De=>V(De,q));if(!X.some(Mr))try{return M(W.name,X,q)}catch{}if(W.name==="size"&&X.length===1&&un(X[0])){for(var U=[],oe=X[0];un(oe);)U.push(oe.items.length),oe=oe.items[0];return a(U)}return new u(W.name,X.map(O))}}case"OperatorNode":{var me=W.fn.toString(),ae,$,ce=E(W);if(ht(W)&&W.isUnary())ae=[V(W.args[0],q)],Mr(ae[0])?$=ce(ae):$=M(me,ae,q);else if(x(W,q.context))if(ae=b(W,q.context),ae=ae.map(De=>V(De,q)),v(me,q.context)){for(var Ce=[],pe=[],ge=0;ge1?($=H(me,Ce,ce,q),pe.unshift($),$=H(me,pe,ce,q)):$=H(me,ae,ce,q)}else $=H(me,ae,ce,q);else ae=W.args.map(De=>V(De,q)),$=H(me,ae,ce,q);return $}case"ParenthesisNode":return V(W.content,q);case"AccessorNode":return L(V(W.object,q),V(W.index,q),q);case"ArrayNode":{var Se=W.items.map(De=>V(De,q));return Se.some(Mr)?new f(Se.map(O)):a(Se)}case"IndexNode":return new m(W.dimensions.map(De=>w(De,q)));case"ObjectNode":{var ye={};for(var be in W.properties)ye[be]=w(W.properties[be],q);return new p(ye)}case"AssignmentNode":case"BlockNode":case"FunctionAssignmentNode":case"RangeNode":case"ConditionalNode":default:throw new Error("Unimplemented node type in simplifyConstant: ".concat(W.type))}}return w});var f4="simplifyCore",eX=["typed","parse","equal","isZero","add","subtract","multiply","divide","pow","AccessorNode","ArrayNode","ConstantNode","FunctionNode","IndexNode","ObjectNode","OperatorNode","ParenthesisNode","SymbolNode"],jy=F(f4,eX,e=>{var{typed:r,parse:t,equal:n,isZero:a,add:i,subtract:s,multiply:c,divide:f,pow:o,AccessorNode:u,ArrayNode:m,ConstantNode:p,FunctionNode:h,IndexNode:y,ObjectNode:v,OperatorNode:x,ParenthesisNode:b,SymbolNode:E}=e,w=new p(0),N=new p(1),M=new p(!0),D=new p(!1);function O(k){return ht(k)&&["and","not","or"].includes(k.op)}var{hasProperty:_,isCommutative:C}=Zf({FunctionNode:h,OperatorNode:x,SymbolNode:E});function T(k){var L=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},H=L?L.context:void 0;if(_(k,"trivial",H)){if(Cn(k)&&k.args.length===1)return T(k.args[0],L);var V=!1,W=0;if(k.forEach(pe=>{++W,W===1&&(V=T(pe,L))}),W===1)return V}var q=k;if(Cn(q)){var R=oF(q.name);if(R){if(q.args.length>2&&_(q,"associative",H))for(;q.args.length>2;){var X=q.args.pop(),U=q.args.pop();q.args.push(new x(R,q.name,[X,U]))}q=new x(R,q.name,q.args)}else return new h(T(q.fn),q.args.map(pe=>T(pe,L)))}if(ht(q)&&q.isUnary()){var oe=T(q.args[0],L);if(q.op==="~"&&ht(oe)&&oe.isUnary()&&oe.op==="~"||q.op==="not"&&ht(oe)&&oe.isUnary()&&oe.op==="not"&&O(oe.args[0]))return oe.args[0];var me=!0;if(q.op==="-"&&ht(oe)&&(oe.isBinary()&&oe.fn==="subtract"&&(q=new x("-","subtract",[oe.args[1],oe.args[0]]),me=!1),oe.isUnary()&&oe.op==="-"))return oe.args[0];if(me)return new x(q.op,q.fn,[oe])}if(ht(q)&&q.isBinary()){var ae=T(q.args[0],L),$=T(q.args[1],L);if(q.op==="+"){if(wr(ae)&&a(ae.value))return $;if(wr($)&&a($.value))return ae;ht($)&&$.isUnary()&&$.op==="-"&&($=$.args[0],q=new x("-","subtract",[ae,$]))}if(q.op==="-")return ht($)&&$.isUnary()&&$.op==="-"?T(new x("+","add",[ae,$.args[0]]),L):wr(ae)&&a(ae.value)?T(new x("-","unaryMinus",[$])):wr($)&&a($.value)?ae:new x(q.op,q.fn,[ae,$]);if(q.op==="*"){if(wr(ae)){if(a(ae.value))return w;if(n(ae.value,1))return $}if(wr($)){if(a($.value))return w;if(n($.value,1))return ae;if(C(q,H))return new x(q.op,q.fn,[$,ae],q.implicit)}return new x(q.op,q.fn,[ae,$],q.implicit)}if(q.op==="/")return wr(ae)&&a(ae.value)?w:wr($)&&n($.value,1)?ae:new x(q.op,q.fn,[ae,$]);if(q.op==="^"&&wr($)){if(a($.value))return N;if(n($.value,1))return ae}if(q.op==="and"){if(wr(ae))if(ae.value){if(O($))return $;if(wr($))return $.value?M:D}else return D;if(wr($))if($.value){if(O(ae))return ae}else return D}if(q.op==="or"){if(wr(ae)){if(ae.value)return M;if(O($))return $}if(wr($)){if($.value)return M;if(O(ae))return ae}}return new x(q.op,q.fn,[ae,$])}if(ht(q))return new x(q.op,q.fn,q.args.map(pe=>T(pe,L)));if(un(q))return new m(q.items.map(pe=>T(pe,L)));if(jn(q))return new u(T(q.object,L),T(q.index,L));if(la(q))return new y(q.dimensions.map(pe=>T(pe,L)));if(Vi(q)){var ce={};for(var Ce in q.properties)ce[Ce]=T(q.properties[Ce],L);return new v(ce)}return q}return r(f4,{Node:T,"Node,Object":T})});var rX="resolve",tX=["typed","parse","ConstantNode","FunctionNode","OperatorNode","ParenthesisNode"],e0=F(rX,tX,e=>{var{typed:r,parse:t,ConstantNode:n,FunctionNode:a,OperatorNode:i,ParenthesisNode:s}=e;function c(f,o){var u=arguments.length>2&&arguments[2]!==void 0?arguments[2]:new Set;if(!o)return f;if(ft(f)){if(u.has(f.name)){var m=Array.from(u).join(", ");throw new ReferenceError("recursive loop of variable definitions among {".concat(m,"}"))}var p=o.get(f.name);if(Mr(p)){var h=new Set(u);return h.add(f.name),c(p,o,h)}else return typeof p=="number"?t(String(p)):p!==void 0?new n(p):f}else if(ht(f)){var y=f.args.map(function(x){return c(x,o,u)});return new i(f.op,f.fn,y,f.implicit)}else{if(fn(f))return new s(c(f.content,o,u));if(Cn(f)){var v=f.args.map(function(x){return c(x,o,u)});return new a(f.name,v)}}return f.map(x=>c(x,o,u))}return r("resolve",{Node:c,"Node, Map | null | undefined":c,"Node, Object":(f,o)=>c(f,So(o)),"Array | Matrix":r.referToSelf(f=>o=>o.map(u=>f(u))),"Array | Matrix, null | undefined":r.referToSelf(f=>o=>o.map(u=>f(u))),"Array, Object":r.referTo("Array,Map",f=>(o,u)=>f(o,So(u))),"Matrix, Object":r.referTo("Matrix,Map",f=>(o,u)=>f(o,So(u))),"Array | Matrix, Map":r.referToSelf(f=>(o,u)=>o.map(m=>f(m,u)))})});var l4="symbolicEqual",nX=["parse","simplify","typed","OperatorNode"],r0=F(l4,nX,e=>{var{parse:r,simplify:t,typed:n,OperatorNode:a}=e;function i(s,c){var f=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},o=new a("-","subtract",[s,c]),u=t(o,{},f);return wr(u)&&!u.value}return n(l4,{"Node, Node":i,"Node, Node, Object":i})});var c4="derivative",aX=["typed","config","parse","simplify","equal","isZero","numeric","ConstantNode","FunctionNode","OperatorNode","ParenthesisNode","SymbolNode"],t0=F(c4,aX,e=>{var{typed:r,config:t,parse:n,simplify:a,equal:i,isZero:s,numeric:c,ConstantNode:f,FunctionNode:o,OperatorNode:u,ParenthesisNode:m,SymbolNode:p}=e;function h(w,N){var M=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{simplify:!0},D={};x(D,w,N.name);var O=b(w,D);return M.simplify?a(O):O}r.addConversion({from:"identifier",to:"SymbolNode",convert:n});var y=r(c4,{"Node, SymbolNode":h,"Node, SymbolNode, Object":h});r.removeConversion({from:"identifier",to:"SymbolNode",convert:n}),y._simplify=!0,y.toTex=function(w){return v.apply(null,w.args)};var v=r("_derivTex",{"Node, SymbolNode":function(N,M){return wr(N)&&Fr(N.value)==="string"?v(n(N.value).toString(),M.toString(),1):v(N.toTex(),M.toString(),1)},"Node, ConstantNode":function(N,M){if(Fr(M.value)==="string")return v(N,n(M.value));throw new Error("The second parameter to 'derivative' is a non-string constant")},"Node, SymbolNode, ConstantNode":function(N,M,D){return v(N.toString(),M.name,D.value)},"string, string, number":function(N,M,D){var O;return D===1?O="{d\\\\over d"+M+"}":O="{d^{"+D+"}\\\\over d"+M+"^{"+D+"}}",O+"\\\\left[".concat(N,"\\\\right]")}}),x=r("constTag",{"Object, ConstantNode, string":function(N,M){return N[M]=!0,!0},"Object, SymbolNode, string":function(N,M,D){return M.name!==D?(N[M]=!0,!0):!1},"Object, ParenthesisNode, string":function(N,M,D){return x(N,M.content,D)},"Object, FunctionAssignmentNode, string":function(N,M,D){return M.params.indexOf(D)===-1?(N[M]=!0,!0):x(N,M.expr,D)},"Object, FunctionNode | OperatorNode, string":function(N,M,D){if(M.args.length>0){for(var O=x(N,M.args[0],D),_=1;_0){var O=N.args.filter(function(W){return M[W]===void 0}),_=O.length===1?O[0]:new u("*","multiply",O),C=D.concat(b(_,M));return new u("*","multiply",C)}return new u("+","add",N.args.map(function(W){return new u("*","multiply",N.args.map(function(q){return q===W?b(q,M):q.clone()}))}))}if(N.op==="/"&&N.isBinary()){var T=N.args[0],k=N.args[1];return M[k]!==void 0?new u("/","divide",[b(T,M),k]):M[T]!==void 0?new u("*","multiply",[new u("-","unaryMinus",[T]),new u("/","divide",[b(k,M),new u("^","pow",[k.clone(),E(2)])])]):new u("/","divide",[new u("-","subtract",[new u("*","multiply",[b(T,M),k.clone()]),new u("*","multiply",[T.clone(),b(k,M)])]),new u("^","pow",[k.clone(),E(2)])])}if(N.op==="^"&&N.isBinary()){var L=N.args[0],H=N.args[1];if(M[L]!==void 0)return wr(L)&&(s(L.value)||i(L.value,1))?E(0):new u("*","multiply",[N,new u("*","multiply",[new o("log",[L.clone()]),b(H.clone(),M)])]);if(M[H]!==void 0){if(wr(H)){if(s(H.value))return E(0);if(i(H.value,1))return b(L,M)}var V=new u("^","pow",[L.clone(),new u("-","subtract",[H,E(1)])]);return new u("*","multiply",[H.clone(),new u("*","multiply",[b(L,M),V])])}return new u("*","multiply",[new u("^","pow",[L.clone(),H.clone()]),new u("+","add",[new u("*","multiply",[b(L,M),new u("/","divide",[H.clone(),L.clone()])]),new u("*","multiply",[b(H,M),new o("log",[L.clone()])])])])}throw new Error('Cannot process operator "'+N.op+'" in derivative: the operator is not supported, undefined, or the number of arguments passed to it are not supported')}});function E(w,N){return new f(c(w,N||t.number))}return y});var m4="rationalize",iX=["config","typed","equal","isZero","add","subtract","multiply","divide","pow","parse","simplifyConstant","simplifyCore","simplify","?bignumber","?fraction","mathWithTransform","matrix","AccessorNode","ArrayNode","ConstantNode","FunctionNode","IndexNode","ObjectNode","OperatorNode","SymbolNode","ParenthesisNode"],n0=F(m4,iX,e=>{var{config:r,typed:t,equal:n,isZero:a,add:i,subtract:s,multiply:c,divide:f,pow:o,parse:u,simplifyConstant:m,simplifyCore:p,simplify:h,fraction:y,bignumber:v,mathWithTransform:x,matrix:b,AccessorNode:E,ArrayNode:w,ConstantNode:N,FunctionNode:M,IndexNode:D,ObjectNode:O,OperatorNode:_,SymbolNode:C,ParenthesisNode:T}=e;function k(q){var R=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},X=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,U=H(),oe=L(q,R,!0,U.firstRules),me=oe.variables.length,ae={exactFractions:!1},$={exactFractions:!0};if(q=oe.expression,me>=1){q=V(q);var ce,Ce,pe=!0,ge=!1;q=h(q,U.firstRules,{},ae);for(var Se;Ce=pe?U.distrDivRules:U.sucDivRules,q=h(q,Ce,{},$),pe=!pe,Se=q.toString(),Se!==ce;)ge=!0,ce=Se;ge&&(q=h(q,U.firstRulesAgain,{},ae)),q=h(q,U.finalRules,{},ae)}var ye=[],be={};return q.type==="OperatorNode"&&q.isBinary()&&q.op==="/"?(me===1&&(q.args[0]=W(q.args[0],ye),q.args[1]=W(q.args[1])),X&&(be.numerator=q.args[0],be.denominator=q.args[1])):(me===1&&(q=W(q,ye)),X&&(be.numerator=q,be.denominator=null)),X?(be.coefficients=ye,be.variables=oe.variables,be.expression=q,be):q}return t(m4,{Node:k,"Node, boolean":(q,R)=>k(q,{},R),"Node, Object":k,"Node, Object, boolean":k});function L(q,R,X,U){var oe=[],me=h(q,U,R,{exactFractions:!1});X=!!X;var ae="+-*"+(X?"/":"");ce(me);var $={};return $.expression=me,$.variables=oe,$;function ce(Ce){var pe=Ce.type;if(pe==="FunctionNode")throw new Error("There is an unsolved function call");if(pe==="OperatorNode")if(Ce.op==="^"){if(Ce.args[1].type!=="ConstantNode"||!Ze(parseFloat(Ce.args[1].value)))throw new Error("There is a non-integer exponent");ce(Ce.args[0])}else{if(ae.indexOf(Ce.op)===-1)throw new Error("Operator "+Ce.op+" invalid in polynomial expression");for(var ge=0;ge1;if(U==="OperatorNode"&&q.isBinary()){var me=!1,ae;if(q.op==="^"&&(q.args[0].type==="ParenthesisNode"||q.args[0].type==="OperatorNode")&&q.args[1].type==="ConstantNode"&&(ae=parseFloat(q.args[1].value),me=ae>=2&&Ze(ae)),me){if(ae>2){var $=q.args[0],ce=new _("^","pow",[q.args[0].cloneDeep(),new N(ae-1)]);q=new _("*","multiply",[$,ce])}else q=new _("*","multiply",[q.args[0],q.args[0].cloneDeep()]);oe&&(X==="content"?R.content=q:R.args[X]=q)}}if(U==="ParenthesisNode")V(q.content,q,"content");else if(U!=="ConstantNode"&&U!=="SymbolNode")for(var Ce=0;Ce=0;$--)if(R[$]!==0){var ce=new N(me?R[$]:Math.abs(R[$])),Ce=R[$]<0?"-":"+";if($>0){var pe=new C(oe);if($>1){var ge=new N($);pe=new _("^","pow",[pe,ge])}R[$]===-1&&me?ce=new _("-","unaryMinus",[pe]):Math.abs(R[$])===1?ce=pe:ce=new _("*","multiply",[ce,pe])}me?ae=ce:Ce==="+"?ae=new _("+","add",[ae,ce]):ae=new _("-","subtract",[ae,ce]),me=!1}if(me)return new N(0);return ae;function Se(ye,be,De){var Ae=ye.type;if(Ae==="FunctionNode")throw new Error("There is an unsolved function call");if(Ae==="OperatorNode"){if("+-*^".indexOf(ye.op)===-1)throw new Error("Operator "+ye.op+" invalid");if(be!==null){if((ye.fn==="unaryMinus"||ye.fn==="pow")&&be.fn!=="add"&&be.fn!=="subtract"&&be.fn!=="multiply")throw new Error("Invalid "+ye.op+" placing");if((ye.fn==="subtract"||ye.fn==="add"||ye.fn==="multiply")&&be.fn!=="add"&&be.fn!=="subtract")throw new Error("Invalid "+ye.op+" placing");if((ye.fn==="subtract"||ye.fn==="add"||ye.fn==="unaryMinus")&&De.noFil!==0)throw new Error("Invalid "+ye.op+" placing")}(ye.op==="^"||ye.op==="*")&&(De.fire=ye.op);for(var Ye=0;YeU&&(R[Ke]=0),R[Ke]+=De.cte*(De.oper==="+"?1:-1),U=Math.max(Ke,U);return}De.cte=Ke,De.fire===""&&(R[0]+=De.cte*(De.oper==="+"?1:-1))}else throw new Error("Type "+Ae+" is not allowed")}}});var p4="zpk2tf",oX=["typed","add","multiply","Complex","number"],a0=F(p4,oX,e=>{var{typed:r,add:t,multiply:n,Complex:a,number:i}=e;return r(p4,{"Array,Array,number":function(o,u,m){return s(o,u,m)},"Array,Array":function(o,u){return s(o,u,1)},"Matrix,Matrix,number":function(o,u,m){return s(o.valueOf(),u.valueOf(),m)},"Matrix,Matrix":function(o,u){return s(o.valueOf(),u.valueOf(),1)}});function s(f,o,u){f.some(E=>E.type==="BigNumber")&&(f=f.map(E=>i(E))),o.some(E=>E.type==="BigNumber")&&(o=o.map(E=>i(E)));for(var m=[a(1,0)],p=[a(1,0)],h=0;h=0&&m-p{var{typed:r,add:t,multiply:n,Complex:a,divide:i,matrix:s}=e;return r(d4,{"Array, Array":function(u,m){var p=f(512);return c(u,m,p)},"Array, Array, Array":function(u,m,p){return c(u,m,p)},"Array, Array, number":function(u,m,p){if(p<0)throw new Error("w must be a positive number");var h=f(p);return c(u,m,h)},"Matrix, Matrix":function(u,m){var p=f(512),{w:h,h:y}=c(u.valueOf(),m.valueOf(),p);return{w:s(h),h:s(y)}},"Matrix, Matrix, Matrix":function(u,m,p){var{h}=c(u.valueOf(),m.valueOf(),p.valueOf());return{h:s(h),w:s(p)}},"Matrix, Matrix, number":function(u,m,p){if(p<0)throw new Error("w must be a positive number");var h=f(p),{h:y}=c(u.valueOf(),m.valueOf(),h);return{h:s(y),w:s(h)}}});function c(o,u,m){for(var p=[],h=[],y=0;y{var{classes:r}=e;return function(n,a){var i=r[a&&a.mathjs];return i&&typeof i.fromJSON=="function"?i.fromJSON(a):a}});var lX="replacer",cX=[],s0=F(lX,cX,()=>function(r,t){return typeof t=="number"&&(!isFinite(t)||isNaN(t))?{mathjs:"number",value:String(t)}:t});var h4="12.4.1";var u0=F("true",[],()=>!0),f0=F("false",[],()=>!1),l0=F("null",[],()=>null),c0=Ia("Infinity",["config","?BigNumber"],e=>{var{config:r,BigNumber:t}=e;return r.number==="BigNumber"?new t(1/0):1/0}),m0=Ia("NaN",["config","?BigNumber"],e=>{var{config:r,BigNumber:t}=e;return r.number==="BigNumber"?new t(NaN):NaN}),p0=Ia("pi",["config","?BigNumber"],e=>{var{config:r,BigNumber:t}=e;return r.number==="BigNumber"?Ac(t):QE}),d0=Ia("tau",["config","?BigNumber"],e=>{var{config:r,BigNumber:t}=e;return r.number==="BigNumber"?g_(t):XE}),h0=Ia("e",["config","?BigNumber"],e=>{var{config:r,BigNumber:t}=e;return r.number==="BigNumber"?h_(t):KE}),v0=Ia("phi",["config","?BigNumber"],e=>{var{config:r,BigNumber:t}=e;return r.number==="BigNumber"?v_(t):JE}),g0=Ia("LN2",["config","?BigNumber"],e=>{var{config:r,BigNumber:t}=e;return r.number==="BigNumber"?new t(2).ln():Math.LN2}),y0=Ia("LN10",["config","?BigNumber"],e=>{var{config:r,BigNumber:t}=e;return r.number==="BigNumber"?new t(10).ln():Math.LN10}),x0=Ia("LOG2E",["config","?BigNumber"],e=>{var{config:r,BigNumber:t}=e;return r.number==="BigNumber"?new t(1).div(new t(2).ln()):Math.LOG2E}),b0=Ia("LOG10E",["config","?BigNumber"],e=>{var{config:r,BigNumber:t}=e;return r.number==="BigNumber"?new t(1).div(new t(10).ln()):Math.LOG10E}),w0=Ia("SQRT1_2",["config","?BigNumber"],e=>{var{config:r,BigNumber:t}=e;return r.number==="BigNumber"?new t("0.5").sqrt():Math.SQRT1_2}),D0=Ia("SQRT2",["config","?BigNumber"],e=>{var{config:r,BigNumber:t}=e;return r.number==="BigNumber"?new t(2).sqrt():Math.SQRT2}),S0=Ia("i",["Complex"],e=>{var{Complex:r}=e;return r.I}),v4=F("PI",["pi"],e=>{var{pi:r}=e;return r}),g4=F("E",["e"],e=>{var{e:r}=e;return r}),N0=F("version",[],()=>h4);function Ia(e,r,t){return F(e,r,t,{recreateOnConfigChange:!0})}var A0=_r("speedOfLight","299792458","m s^-1"),M0=_r("gravitationConstant","6.67430e-11","m^3 kg^-1 s^-2"),E0=_r("planckConstant","6.62607015e-34","J s"),C0=_r("reducedPlanckConstant","1.0545718176461565e-34","J s"),T0=_r("magneticConstant","1.25663706212e-6","N A^-2"),_0=_r("electricConstant","8.8541878128e-12","F m^-1"),F0=_r("vacuumImpedance","376.730313667","ohm"),O0=_r("coulomb","8.987551792261171e9","N m^2 C^-2"),B0=_r("elementaryCharge","1.602176634e-19","C"),I0=_r("bohrMagneton","9.2740100783e-24","J T^-1"),P0=_r("conductanceQuantum","7.748091729863649e-5","S"),R0=_r("inverseConductanceQuantum","12906.403729652257","ohm"),k0=_r("magneticFluxQuantum","2.0678338484619295e-15","Wb"),L0=_r("nuclearMagneton","5.0507837461e-27","J T^-1"),q0=_r("klitzing","25812.807459304513","ohm");var U0=_r("bohrRadius","5.29177210903e-11","m"),z0=_r("classicalElectronRadius","2.8179403262e-15","m"),Y0=_r("electronMass","9.1093837015e-31","kg"),W0=_r("fermiCoupling","1.1663787e-5","GeV^-2"),H0=wx("fineStructure",.0072973525693),$0=_r("hartreeEnergy","4.3597447222071e-18","J"),G0=_r("protonMass","1.67262192369e-27","kg"),V0=_r("deuteronMass","3.3435830926e-27","kg"),Z0=_r("neutronMass","1.6749271613e-27","kg"),Q0=_r("quantumOfCirculation","3.6369475516e-4","m^2 s^-1"),X0=_r("rydberg","10973731.568160","m^-1"),K0=_r("thomsonCrossSection","6.6524587321e-29","m^2"),J0=wx("weakMixingAngle",.2229),j0=wx("efimovFactor",22.7),ex=_r("atomicMass","1.66053906660e-27","kg"),rx=_r("avogadro","6.02214076e23","mol^-1"),tx=_r("boltzmann","1.380649e-23","J K^-1"),nx=_r("faraday","96485.33212331001","C mol^-1"),ax=_r("firstRadiation","3.7417718521927573e-16","W m^2"),ix=_r("loschmidt","2.686780111798444e25","m^-3"),ox=_r("gasConstant","8.31446261815324","J K^-1 mol^-1"),sx=_r("molarPlanckConstant","3.990312712893431e-10","J s mol^-1"),ux=_r("molarVolume","0.022413969545014137","m^3 mol^-1"),fx=wx("sackurTetrode",-1.16487052358),lx=_r("secondRadiation","0.014387768775039337","m K"),cx=_r("stefanBoltzmann","5.67037441918443e-8","W m^-2 K^-4"),mx=_r("wienDisplacement","2.897771955e-3","m K"),px=_r("molarMass","0.99999999965e-3","kg mol^-1"),dx=_r("molarMassC12","11.9999999958e-3","kg mol^-1"),hx=_r("gravity","9.80665","m s^-2"),vx=_r("planckLength","1.616255e-35","m"),gx=_r("planckMass","2.176435e-8","kg"),yx=_r("planckTime","5.391245e-44","s"),xx=_r("planckCharge","1.87554603778e-18","C"),bx=_r("planckTemperature","1.416785e+32","K");function _r(e,r,t){var n=["config","Unit","BigNumber"];return F(e,n,a=>{var{config:i,Unit:s,BigNumber:c}=a,f=i.number==="BigNumber"?new c(r):parseFloat(r),o=new s(f,t);return o.fixPrefix=!0,o})}function wx(e,r){var t=["config","BigNumber"];return F(e,t,n=>{var{config:a,BigNumber:i}=n;return a.number==="BigNumber"?new i(r):r})}var mX="apply",pX=["typed","isInteger"],Dx=F(mX,pX,e=>{var{typed:r,isInteger:t}=e,n=ls({typed:r,isInteger:t});return r("apply",{"...any":function(i){var s=i[1];ur(s)?i[1]=s-1:tr(s)&&(i[1]=s.minus(1));try{return n.apply(null,i)}catch(c){throw gt(c)}}})},{isTransformFunction:!0});var dX="column",hX=["typed","Index","matrix","range"],Sx=F(dX,hX,e=>{var{typed:r,Index:t,matrix:n,range:a}=e,i=Ef({typed:r,Index:t,matrix:n,range:a});return r("column",{"...any":function(c){var f=c.length-1,o=c[f];ur(o)&&(c[f]=o-1);try{return i.apply(null,c)}catch(u){throw gt(u)}}})},{isTransformFunction:!0});function Qf(e,r,t){var n=e.filter(function(f){return ft(f)&&!(f.name in r)&&!t.has(f.name)})[0];if(!n)throw new Error('No undefined variable found in inline expression "'+e+'"');var a=n.name,i=new Map,s=new pf(t,i,new Set([a])),c=e.compile();return function(o){return i.set(a,o),c.evaluate(s)}}var vX="filter",gX=["typed"],Nx=F(vX,gX,e=>{var{typed:r}=e;function t(a,i,s){var c,f;return a[0]&&(c=a[0].compile().evaluate(s)),a[1]&&(ft(a[1])||Xa(a[1])?f=a[1].compile().evaluate(s):f=Qf(a[1],i,s)),n(c,f)}t.rawArgs=!0;var n=r("filter",{"Array, function":y4,"Matrix, function":function(i,s){return i.create(y4(i.toArray(),s))},"Array, RegExp":cf,"Matrix, RegExp":function(i,s){return i.create(cf(i.toArray(),s))}});return t},{isTransformFunction:!0});function y4(e,r){return Bp(e,function(t,n,a){return ei(r,t,[n+1],a,"filter")})}var yX="forEach",xX=["typed"],Ax=F(yX,xX,e=>{var{typed:r}=e;function t(a,i,s){var c,f;return a[0]&&(c=a[0].compile().evaluate(s)),a[1]&&(ft(a[1])||Xa(a[1])?f=a[1].compile().evaluate(s):f=Qf(a[1],i,s)),n(c,f)}t.rawArgs=!0;var n=r("forEach",{"Array | Matrix, function":function(i,s){var c=function f(o,u){if(Array.isArray(o))ts(o,function(m,p){f(m,u.concat(p+1))});else return ei(s,o,u,i,"forEach")};c(i.valueOf(),[])}});return t},{isTransformFunction:!0});var bX="index",wX=["Index","getMatrixDataType"],Mx=F(bX,wX,e=>{var{Index:r,getMatrixDataType:t}=e;return function(){for(var a=[],i=0,s=arguments.length;i0?0:2;else if(c&&c.isSet===!0)c=c.map(function(o){return o-1});else if(Cr(c)||Qe(c))t(c)!=="boolean"&&(c=c.map(function(o){return o-1}));else if(ur(c))c--;else if(tr(c))c=c.toNumber()-1;else if(typeof c!="string")throw new TypeError("Dimension must be an Array, Matrix, number, string, or Range");a[i]=c}var f=new r;return r.apply(f,a),f}},{isTransformFunction:!0});var DX="map",SX=["typed"],Ex=F(DX,SX,e=>{var{typed:r}=e;function t(a,i,s){var c,f;return a[0]&&(c=a[0].compile().evaluate(s)),a[1]&&(ft(a[1])||Xa(a[1])?f=a[1].compile().evaluate(s):f=Qf(a[1],i,s)),n(c,f)}t.rawArgs=!0;var n=r("map",{"Array, function":function(i,s){return x4(i,s,i)},"Matrix, function":function(i,s){return i.create(x4(i.valueOf(),s,i))}});return t},{isTransformFunction:!0});function x4(e,r,t){function n(a,i){return Array.isArray(a)?ca(a,function(s,c){return n(s,i.concat(c+1))}):ei(r,a,i,t,"map")}return n(e,[])}function zn(e){if(e.length===2&&_t(e[0])){e=e.slice();var r=e[1];ur(r)?e[1]=r-1:tr(r)&&(e[1]=r.minus(1))}return e}var NX="max",AX=["typed","config","numeric","larger"],Cx=F(NX,AX,e=>{var{typed:r,config:t,numeric:n,larger:a}=e,i=qf({typed:r,config:t,numeric:n,larger:a});return r("max",{"...any":function(c){c=zn(c);try{return i.apply(null,c)}catch(f){throw gt(f)}}})},{isTransformFunction:!0});var MX="mean",EX=["typed","add","divide"],Tx=F(MX,EX,e=>{var{typed:r,add:t,divide:n}=e,a=Hf({typed:r,add:t,divide:n});return r("mean",{"...any":function(s){s=zn(s);try{return a.apply(null,s)}catch(c){throw gt(c)}}})},{isTransformFunction:!0});var CX="min",TX=["typed","config","numeric","smaller"],_x=F(CX,TX,e=>{var{typed:r,config:t,numeric:n,smaller:a}=e,i=Uf({typed:r,config:t,numeric:n,smaller:a});return r("min",{"...any":function(c){c=zn(c);try{return i.apply(null,c)}catch(f){throw gt(f)}}})},{isTransformFunction:!0});var _X="range",FX=["typed","config","?matrix","?bignumber","smaller","smallerEq","larger","largerEq","add","isPositive"],Fx=F(_X,FX,e=>{var{typed:r,config:t,matrix:n,bignumber:a,smaller:i,smallerEq:s,larger:c,largerEq:f,add:o,isPositive:u}=e,m=_f({typed:r,config:t,matrix:n,bignumber:a,smaller:i,smallerEq:s,larger:c,largerEq:f,add:o,isPositive:u});return r("range",{"...any":function(h){var y=h.length-1,v=h[y];return typeof v!="boolean"&&h.push(!0),m.apply(null,h)}})},{isTransformFunction:!0});var OX="row",BX=["typed","Index","matrix","range"],Ox=F(OX,BX,e=>{var{typed:r,Index:t,matrix:n,range:a}=e,i=Ff({typed:r,Index:t,matrix:n,range:a});return r("row",{"...any":function(c){var f=c.length-1,o=c[f];ur(o)&&(c[f]=o-1);try{return i.apply(null,c)}catch(u){throw gt(u)}}})},{isTransformFunction:!0});var IX="subset",PX=["typed","matrix","zeros","add"],Bx=F(IX,PX,e=>{var{typed:r,matrix:t,zeros:n,add:a}=e,i=Of({typed:r,matrix:t,zeros:n,add:a});return r("subset",{"...any":function(c){try{return i.apply(null,c)}catch(f){throw gt(f)}}})},{isTransformFunction:!0});var RX="concat",kX=["typed","matrix","isInteger"],Ix=F(RX,kX,e=>{var{typed:r,matrix:t,isInteger:n}=e,a=Mf({typed:r,matrix:t,isInteger:n});return r("concat",{"...any":function(s){var c=s.length-1,f=s[c];ur(f)?s[c]=f-1:tr(f)&&(s[c]=f.minus(1));try{return a.apply(null,s)}catch(o){throw gt(o)}}})},{isTransformFunction:!0});var b4="diff",LX=["typed","matrix","subtract","number","bignumber"],Px=F(b4,LX,e=>{var{typed:r,matrix:t,subtract:n,number:a,bignumber:i}=e,s=Cf({typed:r,matrix:t,subtract:n,number:a,bignumber:i});return r(b4,{"...any":function(f){f=zn(f);try{return s.apply(null,f)}catch(o){throw gt(o)}}})},{isTransformFunction:!0});var qX="std",UX=["typed","map","sqrt","variance"],Rx=F(qX,UX,e=>{var{typed:r,map:t,sqrt:n,variance:a}=e,i=Vf({typed:r,map:t,sqrt:n,variance:a});return r("std",{"...any":function(c){c=zn(c);try{return i.apply(null,c)}catch(f){throw gt(f)}}})},{isTransformFunction:!0});var w4="sum",zX=["typed","config","add","numeric"],kx=F(w4,zX,e=>{var{typed:r,config:t,add:n,numeric:a}=e,i=Yf({typed:r,config:t,add:n,numeric:a});return r(w4,{"...any":function(c){c=zn(c);try{return i.apply(null,c)}catch(f){throw gt(f)}}})},{isTransformFunction:!0});var YX="quantileSeq",WX=["typed","bignumber","add","subtract","divide","multiply","partitionSelect","compare","isInteger","smaller","smallerEq","larger"],Lx=F(YX,WX,e=>{var{typed:r,bignumber:t,add:n,subtract:a,divide:i,multiply:s,partitionSelect:c,compare:f,isInteger:o,smaller:u,smallerEq:m,larger:p}=e,h=Gf({typed:r,bignumber:t,add:n,subtract:a,divide:i,multiply:s,partitionSelect:c,compare:f,isInteger:o,smaller:u,smallerEq:m,larger:p});return r("quantileSeq",{"Array | Matrix, number | BigNumber":h,"Array | Matrix, number | BigNumber, number":(v,x,b)=>h(v,x,y(b)),"Array | Matrix, number | BigNumber, boolean":h,"Array | Matrix, number | BigNumber, boolean, number":(v,x,b,E)=>h(v,x,b,y(E)),"Array | Matrix, Array | Matrix":h,"Array | Matrix, Array | Matrix, number":(v,x,b)=>h(v,x,y(b)),"Array | Matrix, Array | Matrix, boolean":h,"Array | Matrix, Array | Matrix, boolean, number":(v,x,b,E)=>h(v,x,b,y(E))});function y(v){return zn([[],v])[1]}},{isTransformFunction:!0});var D4="cumsum",HX=["typed","add","unaryPlus"],qx=F(D4,HX,e=>{var{typed:r,add:t,unaryPlus:n}=e,a=Wf({typed:r,add:t,unaryPlus:n});return r(D4,{"...any":function(s){if(s.length===2&&_t(s[0])){var c=s[1];ur(c)?s[1]=c-1:tr(c)&&(s[1]=c.minus(1))}try{return a.apply(null,s)}catch(f){throw gt(f)}}})},{isTransformFunction:!0});var S4="variance",$X=["typed","add","subtract","multiply","divide","apply","isNaN"],Ux=F(S4,$X,e=>{var{typed:r,add:t,subtract:n,multiply:a,divide:i,apply:s,isNaN:c}=e,f=$f({typed:r,add:t,subtract:n,multiply:a,divide:i,apply:s,isNaN:c});return r(S4,{"...any":function(u){u=zn(u);try{return f.apply(null,u)}catch(m){throw gt(m)}}})},{isTransformFunction:!0});var N4="print",GX=["typed","matrix","zeros","add"],zx=F(N4,GX,e=>{var{typed:r,matrix:t,zeros:n,add:a}=e,i=If({typed:r,matrix:t,zeros:n,add:a});return r(N4,{"string, Object | Array":function(f,o){return i(s(f),o)},"string, Object | Array, number | Object":function(f,o,u){return i(s(f),o,u)}});function s(c){return c.replace(qh,f=>{var o=f.slice(1).split("."),u=o.map(function(m){return!isNaN(m)&&m.length>0?parseInt(m)-1:m});return"$"+u.join(".")})}},{isTransformFunction:!0});var VX="and",ZX=["typed","matrix","zeros","add","equalScalar","not","concat"],Yx=F(VX,ZX,e=>{var{typed:r,matrix:t,equalScalar:n,zeros:a,not:i,concat:s}=e,c=Lf({typed:r,matrix:t,equalScalar:n,zeros:a,not:i,concat:s});function f(o,u,m){var p=o[0].compile().evaluate(m);if(!_t(p)&&!c(p,!0))return!1;var h=o[1].compile().evaluate(m);return c(p,h)}return f.rawArgs=!0,f},{isTransformFunction:!0});var QX="or",XX=["typed","matrix","equalScalar","DenseMatrix","concat"],Wx=F(QX,XX,e=>{var{typed:r,matrix:t,equalScalar:n,DenseMatrix:a,concat:i}=e,s=Af({typed:r,matrix:t,equalScalar:n,DenseMatrix:a,concat:i});function c(f,o,u){var m=f[0].compile().evaluate(u);if(!_t(m)&&s(m,!1))return!0;var p=f[1].compile().evaluate(u);return s(m,p)}return c.rawArgs=!0,c},{isTransformFunction:!0});var KX="bitAnd",JX=["typed","matrix","zeros","add","equalScalar","not","concat"],Hx=F(KX,JX,e=>{var{typed:r,matrix:t,equalScalar:n,zeros:a,not:i,concat:s}=e,c=Sf({typed:r,matrix:t,equalScalar:n,zeros:a,not:i,concat:s});function f(o,u,m){var p=o[0].compile().evaluate(m);if(!_t(p)){if(isNaN(p))return NaN;if(p===0||p===!1)return 0}var h=o[1].compile().evaluate(m);return c(p,h)}return f.rawArgs=!0,f},{isTransformFunction:!0});var jX="bitOr",eK=["typed","matrix","equalScalar","DenseMatrix","concat"],$x=F(jX,eK,e=>{var{typed:r,matrix:t,equalScalar:n,DenseMatrix:a,concat:i}=e,s=Nf({typed:r,matrix:t,equalScalar:n,DenseMatrix:a,concat:i});function c(f,o,u){var m=f[0].compile().evaluate(u);if(!_t(m)){if(isNaN(m))return NaN;if(m===-1)return-1;if(m===!0)return 1}var p=f[1].compile().evaluate(u);return s(m,p)}return c.rawArgs=!0,c},{isTransformFunction:!0});var Ge=$p({config:Oe}),yt=Gp({}),GS=h0({BigNumber:Ge,config:Oe}),A4=f0({}),M4=H0({BigNumber:Ge,config:Oe}),ps=Vp({}),VS=S0({Complex:yt}),E4=c0({BigNumber:Ge,config:Oe}),C4=y0({BigNumber:Ge,config:Oe}),T4=b0({BigNumber:Ge,config:Oe}),Tc=Qp({}),_4=m0({BigNumber:Ge,config:Oe}),F4=l0({}),O4=v0({BigNumber:Ge,config:Oe}),B4=Zp({}),ZS=kp({}),I4=w0({BigNumber:Ge,config:Oe}),P4=fx({BigNumber:Ge,config:Oe}),QS=d0({BigNumber:Ge,config:Oe}),R4=u0({}),k4=N0({}),Or=Kp({Matrix:Tc}),L4=j0({BigNumber:Ge,config:Oe}),q4=g0({BigNumber:Ge,config:Oe}),Gx=p0({BigNumber:Ge,config:Oe}),U4=s0({}),z4=D0({BigNumber:Ge,config:Oe}),te=Rp({BigNumber:Ge,Complex:yt,DenseMatrix:Or,Fraction:ps}),Vx=Ad({BigNumber:Ge,config:Oe,typed:te}),Y4=J0({BigNumber:Ge,config:Oe}),Yn=Md({typed:te}),W4=Bv({Complex:yt,config:Oe,typed:te}),H4=Pv({BigNumber:Ge,typed:te}),$4=kv({BigNumber:Ge,Complex:yt,config:Oe,typed:te}),nn=Cd({typed:te}),G4=eh({typed:te}),V4=Uv({BigNumber:Ge,Complex:yt,config:Oe,typed:te}),Z4=Yv({typed:te}),XS=Wv({typed:te}),Q4=$v({Complex:yt,config:Oe,typed:te}),ha=vd({BigNumber:Ge,typed:te}),X4=Jd({typed:te}),K4=hd({typed:te}),J4=Jp({typed:te}),_c=Iy({typed:te}),Fc=gd({Complex:yt,typed:te}),ds=rh({typed:te}),Zx=Gv({typed:te}),j4=Zv({BigNumber:Ge,typed:te}),eR=Xv({BigNumber:Ge,typed:te}),rR=Od({typed:te}),Rr=cd({config:Oe,typed:te}),tR=Fh({typed:te}),KS=Bd({typed:te}),nR=Id({Complex:yt,typed:te}),aR=fh({typed:te}),iR=ch({typed:te}),Xf=Ph({typed:te}),Qx=mh({typed:te}),oR=Lh({format:Xf,typed:te}),Xx=th({typed:te}),ea=rd({typed:te}),Co=nd({typed:te}),hs=od({typed:te}),ni=sd({typed:te}),sR=x0({BigNumber:Ge,config:Oe}),uR=ky({Complex:yt,typed:te}),fR=Ld({Complex:yt,config:Oe,typed:te}),JS=qd({Complex:yt,config:Oe,typed:te}),vs=hh({typed:te}),Lt=Ud({typed:te}),Oc=ah({typed:te}),Ji=pd({typed:te}),lR=kh({format:Xf,typed:te}),cR=Wy({config:Oe,typed:te}),mR=If({typed:te}),pR=Hy({config:Oe,typed:te}),Kx=nh({typed:te}),dR=Jv({BigNumber:Ge,typed:te}),jS=Wd({BigNumber:Ge,Fraction:ps,complex:Fc,typed:te}),Bc=eg({typed:te}),ji=md({Matrix:Tc,equalScalar:Rr,typed:te}),hR=Sd({typed:te}),vR=$d({typed:te}),gR=dd({typed:te}),Pa=Td({typed:te}),yR=tg({typed:te}),eN=fd({typed:te}),xR=Iv({Complex:yt,config:Oe,typed:te}),bR=Lv({BigNumber:Ge,typed:te}),Jx=ls({isInteger:ea,typed:te}),wR=qv({BigNumber:Ge,Complex:yt,config:Oe,typed:te}),DR=Rh({format:Xf,typed:te}),SR=Py({typed:te}),NR=Vv({typed:te}),AR=Kv({BigNumber:Ge,typed:te}),Kf=ud({typed:te}),MR=zh({typed:te}),ER=$y({config:Oe,typed:te}),CR=jv({BigNumber:Ge,typed:te}),TR=rg({typed:te}),_R=Fv({SparseMatrix:ji,typed:te}),ai=Hd({Complex:yt,config:Oe,typed:te}),FR=ng({typed:te}),Ei=Nd({typed:te}),OR=Rv({BigNumber:Ge,Complex:yt,config:Oe,typed:te}),BR=Qv({BigNumber:Ge,typed:te}),cu=yd({Fraction:ps,typed:te}),gs=ad({typed:te}),$e=xd({DenseMatrix:Or,Matrix:Tc,SparseMatrix:ji,typed:te}),IR=bd({isZero:ni,matrix:$e,typed:te}),PR=Bh({isNaN:Kf,isNumeric:gs,typed:te}),ii=Yh({bignumber:ha,fraction:cu,number:Ji}),rN=Ih({config:Oe,multiplyScalar:Lt,numeric:ii,typed:te}),tN=xh({isInteger:ea,matrix:$e,typed:te}),yn=Sh({matrix:$e,config:Oe,typed:te}),RR=Nh({matrix:$e,typed:te}),Jf=Ah({matrix:$e,typed:te}),nN=Vd({BigNumber:Ge,config:Oe,matrix:$e,typed:te}),xn=Eh({BigNumber:Ge,config:Oe,matrix:$e,typed:te}),kR=zv({Complex:yt,config:Oe,typed:te}),aN=_d({BigNumber:Ge,Complex:yt,Fraction:ps,config:Oe,isNegative:Co,matrix:$e,typed:te,unaryMinus:Ei}),Qr=Mf({isInteger:ea,matrix:$e,typed:te}),LR=oh({prod:rN,size:yn,typed:te}),jx=Mh({conj:ds,transpose:Jf,typed:te}),iN=uh({DenseMatrix:Or,SparseMatrix:ji,matrix:$e,typed:te}),Ot=Wh({numeric:ii,typed:te}),jf=Xh({DenseMatrix:Or,concat:Qr,divideScalar:Ot,equalScalar:Rr,matrix:$e,typed:te}),Ra=fv({DenseMatrix:Or,concat:Qr,equalScalar:Rr,matrix:$e,typed:te}),el=lh({matrix:$e,typed:te}),qR=id({isNumeric:gs,typed:te}),To=ph({BigNumber:Ge,DenseMatrix:Or,SparseMatrix:ji,config:Oe,matrix:$e,typed:te}),UR=dh({matrix:$e,multiplyScalar:Lt,typed:te}),Ic=yv({DenseMatrix:Or,concat:Qr,config:Oe,matrix:$e,typed:te}),zR=rv({DenseMatrix:Or,concat:Qr,equalScalar:Rr,matrix:$e,typed:te,zeros:xn}),oN=Kh({DenseMatrix:Or,divideScalar:Ot,equalScalar:Rr,matrix:$e,multiplyScalar:Lt,subtractScalar:Pa,typed:te}),e1=Dd({flatten:el,matrix:$e,size:yn,typed:te}),YR=Yd({BigNumber:Ge,concat:Qr,equalScalar:Rr,matrix:$e,typed:te}),WR=vh({BigNumber:Ge,config:Oe,matrix:$e,typed:te}),r1=uy({addScalar:nn,complex:Fc,conj:ds,divideScalar:Ot,equal:Ra,identity:To,isZero:ni,matrix:$e,multiplyScalar:Lt,sign:jS,sqrt:ai,subtractScalar:Pa,typed:te,unaryMinus:Ei,zeros:xn}),HR=bh({config:Oe,matrix:$e}),$R=tv({DenseMatrix:Or,concat:Qr,equalScalar:Rr,matrix:$e,typed:te,zeros:xn}),mu=$h({BigNumber:Ge,DenseMatrix:Or,config:Oe,equalScalar:Rr,matrix:$e,typed:te,zeros:xn}),Wn=mv({DenseMatrix:Or,concat:Qr,config:Oe,matrix:$e,typed:te}),qt=Gd({DenseMatrix:Or,concat:Qr,equalScalar:Rr,matrix:$e,subtractScalar:Pa,typed:te,unaryMinus:Ei}),GR=Uh({concat:Qr,matrix:$e,typed:te}),VR=wv({DenseMatrix:Or,concat:Qr,config:Oe,equalScalar:Rr,matrix:$e,typed:te}),t1=Jh({DenseMatrix:Or,divideScalar:Ot,equalScalar:Rr,matrix:$e,multiplyScalar:Lt,subtractScalar:Pa,typed:te}),ZR=ih({DenseMatrix:Or,concat:Qr,matrix:$e,typed:te}),Ur=dg({DenseMatrix:Or,SparseMatrix:ji,addScalar:nn,concat:Qr,equalScalar:Rr,matrix:$e,typed:te}),QR=Hv({BigNumber:Ge,DenseMatrix:Or,concat:Qr,equalScalar:Rr,matrix:$e,typed:te}),XR=Sf({concat:Qr,equalScalar:Rr,matrix:$e,typed:te}),KR=Nf({DenseMatrix:Or,concat:Qr,equalScalar:Rr,matrix:$e,typed:te}),JR=jd({DenseMatrix:Or,concat:Qr,matrix:$e,typed:te}),jR=Zy({addScalar:nn,combinations:_c,divideScalar:Ot,isInteger:ea,isNegative:Co,multiplyScalar:Lt,typed:te}),ys=iv({BigNumber:Ge,DenseMatrix:Or,Fraction:ps,concat:Qr,config:Oe,equalScalar:Rr,matrix:$e,typed:te}),sN=sv({concat:Qr,matrix:$e,typed:te}),e5=Wf({add:Ur,typed:te,unaryPlus:Vx}),n1=xv({equal:Ra,typed:te}),r5=Cf({matrix:$e,number:Ji,subtract:qt,typed:te}),t5=Cy({abs:Yn,addScalar:nn,deepEqual:n1,divideScalar:Ot,multiplyScalar:Lt,sqrt:ai,subtractScalar:Pa,typed:te}),Pc=gg({addScalar:nn,conj:ds,multiplyScalar:Lt,size:yn,typed:te}),n5=lv({compareText:sN,isZero:ni,typed:te}),uN=xf({DenseMatrix:Or,config:Oe,equalScalar:Rr,matrix:$e,round:mu,typed:te,zeros:xn}),a5=Rd({BigNumber:Ge,DenseMatrix:Or,concat:Qr,config:Oe,equalScalar:Rr,matrix:$e,round:mu,typed:te,zeros:xn}),i5=hg({abs:Yn,addScalar:nn,divideScalar:Ot,isPositive:hs,multiplyScalar:Lt,smaller:Wn,sqrt:ai,typed:te}),fN=Nv({DenseMatrix:Or,smaller:Wn}),_n=Av({ImmutableDenseMatrix:fN,getMatrixDataType:Qx}),Hn=vv({DenseMatrix:Or,concat:Qr,config:Oe,matrix:$e,typed:te}),a1=Gh({Complex:yt,config:Oe,divideScalar:Ot,typed:te}),o5=jh({DenseMatrix:Or,divideScalar:Ot,equalScalar:Rr,matrix:$e,multiplyScalar:Lt,subtractScalar:Pa,typed:te}),s5=wd({flatten:el,matrix:$e,size:yn,typed:te}),u5=Uf({config:Oe,numeric:ii,smaller:Wn,typed:te}),lN=bf({DenseMatrix:Or,concat:Qr,config:Oe,equalScalar:Rr,matrix:$e,round:mu,typed:te,zeros:xn}),lt=zd({addScalar:nn,dot:Pc,equalScalar:Rr,matrix:$e,multiplyScalar:Lt,typed:te}),f5=Zh({Complex:yt,config:Oe,divideScalar:Ot,typed:te}),l5=Af({DenseMatrix:Or,concat:Qr,equalScalar:Rr,matrix:$e,typed:te}),Rc=Dv({compare:ys,isNaN:Kf,isNumeric:gs,typed:te}),c5=nv({DenseMatrix:Or,concat:Qr,equalScalar:Rr,matrix:$e,typed:te,zeros:xn}),cN=cy({SparseMatrix:ji,abs:Yn,add:Ur,divideScalar:Ot,larger:Hn,largerEq:Ic,multiply:lt,subtract:qt,transpose:Jf,typed:te}),va=Of({add:Ur,matrix:$e,typed:te,zeros:xn}),i1=Yf({add:Ur,config:Oe,numeric:ii,typed:te}),m5=yg({add:Ur,matrix:$e,typed:te}),mN=ev({DenseMatrix:Or,divideScalar:Ot,equalScalar:Rr,matrix:$e,multiplyScalar:Lt,subtractScalar:Pa,typed:te}),p5=a0({Complex:yt,add:Ur,multiply:lt,number:Ji,typed:te}),o1=Fd({DenseMatrix:Or,config:Oe,equalScalar:Rr,matrix:$e,round:mu,typed:te,zeros:xn}),Ci=ov({compare:ys,typed:te}),d5=Qy({addScalar:nn,combinations:_c,isInteger:ea,isNegative:Co,isPositive:hs,larger:Hn,typed:te}),h5=sh({matrix:$e,multiply:lt,subtract:qt,typed:te}),pN=yy({divideScalar:Ot,isZero:ni,matrix:$e,multiply:lt,subtractScalar:Pa,typed:te,unaryMinus:Ei}),v5=Xd({concat:Qr,equalScalar:Rr,matrix:$e,multiplyScalar:Lt,typed:te}),dN=Mv({larger:Hn,smaller:Wn}),hN=Pd({Complex:yt,DenseMatrix:Or,ceil:o1,equalScalar:Rr,floor:uN,matrix:$e,typed:te,zeros:xn}),vN=xg({Index:_n,typed:te}),g5=Ty({abs:Yn,add:Ur,addScalar:nn,config:Oe,divideScalar:Ot,equalScalar:Rr,flatten:el,isNumeric:gs,isZero:ni,matrix:$e,multiply:lt,multiplyScalar:Lt,smaller:Wn,subtract:qt,typed:te}),y5=Zd({BigNumber:Ge,add:Ur,config:Oe,equal:Ra,isInteger:ea,mod:lN,smaller:Wn,typed:te,xgcd:nN}),x5=kd({concat:Qr,equalScalar:Rr,matrix:$e,typed:te}),b5=Vh({Complex:yt,config:Oe,divideScalar:Ot,log:a1,typed:te}),s1=qf({config:Oe,larger:Hn,numeric:ii,typed:te}),w5=ag({DenseMatrix:Or,Index:_n,compareNatural:Ci,size:yn,subset:va,typed:te}),D5=og({DenseMatrix:Or,Index:_n,compareNatural:Ci,size:yn,subset:va,typed:te}),S5=ug({Index:_n,compareNatural:Ci,size:yn,subset:va,typed:te}),N5=lg({Index:_n,compareNatural:Ci,size:yn,subset:va,typed:te}),pu=dv({DenseMatrix:Or,concat:Qr,config:Oe,matrix:$e,typed:te}),A5=Sv({compare:ys,compareNatural:Ci,matrix:$e,typed:te}),M5=Lf({concat:Qr,equalScalar:Rr,matrix:$e,not:Oc,typed:te,zeros:xn}),du=_f({bignumber:ha,matrix:$e,add:Ur,config:Oe,isPositive:hs,larger:Hn,largerEq:Ic,smaller:Wn,smallerEq:pu,typed:te}),E5=Ff({Index:_n,matrix:$e,range:du,typed:te}),gN=ig({DenseMatrix:Or,Index:_n,compareNatural:Ci,size:yn,subset:va,typed:te}),C5=fg({Index:_n,compareNatural:Ci,size:yn,subset:va,typed:te}),yN=mg({Index:_n,concat:Qr,setDifference:gN,size:yn,subset:va,typed:te}),xN=Ev({FibonacciHeap:dN,addScalar:nn,equalScalar:Rr}),bN=Ef({Index:_n,matrix:$e,range:du,typed:te}),xs=xy({abs:Yn,addScalar:nn,det:pN,divideScalar:Ot,identity:To,matrix:$e,multiply:lt,typed:te,unaryMinus:Ei}),wN=sy({DenseMatrix:Or,Spa:xN,SparseMatrix:ji,abs:Yn,addScalar:nn,divideScalar:Ot,equalScalar:Rr,larger:Hn,matrix:$e,multiplyScalar:Lt,subtractScalar:Pa,typed:te,unaryMinus:Ei}),T5=by({Complex:yt,add:Ur,ctranspose:jx,deepEqual:n1,divideScalar:Ot,dot:Pc,dotDivide:jf,equal:Ra,inv:xs,matrix:$e,multiply:lt,typed:te}),ka=Hh({Complex:yt,config:Oe,fraction:cu,identity:To,inv:xs,matrix:$e,multiply:lt,number:Ji,typed:te}),DN=sg({DenseMatrix:Or,Index:_n,compareNatural:Ci,size:yn,subset:va,typed:te}),_5=pg({Index:_n,concat:Qr,setIntersect:DN,setSymDifference:yN,size:yn,subset:va,typed:te}),F5=Sy({abs:Yn,add:Ur,identity:To,inv:xs,map:vs,max:s1,multiply:lt,size:yn,sqrt:ai,subtract:qt,typed:te}),Sr=Tv({BigNumber:Ge,Complex:yt,Fraction:ps,abs:Yn,addScalar:nn,config:Oe,divideScalar:Ot,equal:Ra,fix:hN,format:Xf,isNumeric:gs,multiplyScalar:Lt,number:Ji,pow:ka,round:mu,subtractScalar:Pa}),O5=F0({BigNumber:Ge,Unit:Sr,config:Oe}),B5=mx({BigNumber:Ge,Unit:Sr,config:Oe}),I5=ex({BigNumber:Ge,Unit:Sr,config:Oe}),P5=I0({BigNumber:Ge,Unit:Sr,config:Oe}),R5=tx({BigNumber:Ge,Unit:Sr,config:Oe}),k5=P0({BigNumber:Ge,Unit:Sr,config:Oe}),L5=O0({BigNumber:Ge,Unit:Sr,config:Oe}),q5=V0({BigNumber:Ge,Unit:Sr,config:Oe}),U5=Qh({DenseMatrix:Or,concat:Qr,equalScalar:Rr,matrix:$e,pow:ka,typed:te}),z5=_0({BigNumber:Ge,Unit:Sr,config:Oe}),Y5=B0({BigNumber:Ge,Unit:Sr,config:Oe}),W5=Dy({abs:Yn,add:Ur,identity:To,inv:xs,multiply:lt,typed:te}),H5=nx({BigNumber:Ge,Unit:Sr,config:Oe}),SN=Ch({addScalar:nn,ceil:o1,conj:ds,divideScalar:Ot,dotDivide:jf,exp:KS,i:VS,log2:JS,matrix:$e,multiplyScalar:Lt,pow:ka,tau:QS,typed:te}),u1=Ry({BigNumber:Ge,Complex:yt,config:Oe,multiplyScalar:Lt,pow:ka,typed:te}),$5=M0({BigNumber:Ge,Unit:Sr,config:Oe}),G5=$0({BigNumber:Ge,Unit:Sr,config:Oe}),V5=Th({conj:ds,dotDivide:jf,fft:SN,typed:te}),Z5=q0({BigNumber:Ge,Unit:Sr,config:Oe}),Q5=ix({BigNumber:Ge,Unit:Sr,config:Oe}),X5=T0({BigNumber:Ge,Unit:Sr,config:Oe}),K5=px({BigNumber:Ge,Unit:Sr,config:Oe}),J5=sx({BigNumber:Ge,Unit:Sr,config:Oe}),j5=Z0({BigNumber:Ge,Unit:Sr,config:Oe}),ek=L0({BigNumber:Ge,Unit:Sr,config:Oe}),rk=xx({BigNumber:Ge,Unit:Sr,config:Oe}),tk=vx({BigNumber:Ge,Unit:Sr,config:Oe}),nk=bx({BigNumber:Ge,Unit:Sr,config:Oe}),ak=G0({BigNumber:Ge,Unit:Sr,config:Oe}),ik=Q0({BigNumber:Ge,Unit:Sr,config:Oe}),ok=C0({BigNumber:Ge,Unit:Sr,config:Oe}),sk=X0({BigNumber:Ge,Unit:Sr,config:Oe}),uk=lx({BigNumber:Ge,Unit:Sr,config:Oe}),fk=A0({BigNumber:Ge,Unit:Sr,config:Oe}),lk=cx({BigNumber:Ge,Unit:Sr,config:Oe}),ck=K0({BigNumber:Ge,Unit:Sr,config:Oe}),mk=rx({BigNumber:Ge,Unit:Sr,config:Oe}),pk=U0({BigNumber:Ge,Unit:Sr,config:Oe}),dk=Ov({Unit:Sr,typed:te}),pn=Ey({divideScalar:Ot,equalScalar:Rr,inv:xs,matrix:$e,multiply:lt,typed:te}),hk=Y0({BigNumber:Ge,Unit:Sr,config:Oe}),rl=Ly({gamma:u1,typed:te}),vk=ax({BigNumber:Ge,Unit:Sr,config:Oe}),gk=hx({BigNumber:Ge,Unit:Sr,config:Oe}),yk=R0({BigNumber:Ge,Unit:Sr,config:Oe}),NN=my({DenseMatrix:Or,lsolve:oN,lup:wN,matrix:$e,slu:cN,typed:te,usolve:t1}),xk=k0({BigNumber:Ge,Unit:Sr,config:Oe}),bk=dx({BigNumber:Ge,Unit:Sr,config:Oe}),wk=Uy({add:Ur,divide:pn,factorial:rl,isInteger:ea,isPositive:hs,multiply:lt,typed:te}),Dk=zy({factorial:rl,typed:te}),Sk=gx({BigNumber:Ge,Unit:Sr,config:Oe}),Nk=py({add:Ur,cbrt:aN,divide:pn,equalScalar:Rr,im:Xx,isZero:ni,multiply:lt,re:Kx,sqrt:ai,subtract:qt,typeOf:eN,typed:te,unaryMinus:Ei}),Ak=cg({compareNatural:Ci,typed:te}),Mk=_h({abs:Yn,add:Ur,bignumber:ha,divide:pn,isNegative:Co,isPositive:hs,larger:Hn,map:vs,matrix:$e,max:s1,multiply:lt,smaller:Wn,subtract:qt,typed:te,unaryMinus:Ei}),AN=Gy({bignumber:ha,addScalar:nn,combinations:_c,divideScalar:Ot,factorial:rl,isInteger:ea,isNegative:Co,larger:Hn,multiplyScalar:Lt,number:Ji,pow:ka,subtractScalar:Pa,typed:te}),Ek=_v({Unit:Sr,typed:te}),Ck=Vy({addScalar:nn,isInteger:ea,isNegative:Co,stirlingS2:AN,typed:te}),MN=wy({abs:Yn,add:Ur,addScalar:nn,atan:XS,bignumber:ha,column:bN,complex:Fc,config:Oe,cos:Zx,diag:iN,divideScalar:Ot,dot:Pc,equal:Ra,flatten:el,im:Xx,inv:xs,larger:Hn,matrix:$e,matrixFromColumns:e1,multiply:lt,multiplyScalar:Lt,number:Ji,qr:r1,re:Kx,reshape:tN,sin:Bc,size:yn,smaller:Wn,sqrt:ai,subtract:qt,typed:te,usolve:t1,usolveAll:mN}),Tk=W0({BigNumber:Ge,Unit:Sr,config:Oe}),_k=ox({BigNumber:Ge,Unit:Sr,config:Oe}),Fk=qy({divide:pn,dotDivide:jf,isNumeric:gs,log:a1,map:vs,matrix:$e,multiply:lt,sum:i1,typed:te}),EN=Hf({add:Ur,divide:pn,typed:te}),Ok=ux({BigNumber:Ge,Unit:Sr,config:Oe}),Bk=E0({BigNumber:Ge,Unit:Sr,config:Oe}),Ik=Gf({bignumber:ha,add:Ur,compare:ys,divide:pn,isInteger:ea,larger:Hn,multiply:lt,partitionSelect:Rc,smaller:Wn,smallerEq:pu,subtract:qt,typed:te}),f1=$f({add:Ur,apply:Jx,divide:pn,isNaN:Kf,multiply:lt,subtract:qt,typed:te}),Pk=z0({BigNumber:Ge,Unit:Sr,config:Oe}),CN=Fy({add:Ur,compare:ys,divide:pn,partitionSelect:Rc,typed:te}),Rk=By({add:Ur,divide:pn,matrix:$e,mean:EN,multiply:lt,pow:ka,sqrt:ai,subtract:qt,sum:i1,typed:te}),kk=i0({Complex:yt,add:Ur,divide:pn,matrix:$e,multiply:lt,typed:te}),Lk=Oy({abs:Yn,map:vs,median:CN,subtract:qt,typed:te}),qk=Vf({map:vs,sqrt:ai,typed:te,variance:f1}),Uk=Oh({BigNumber:Ge,Complex:yt,add:Ur,config:Oe,divide:pn,equal:Ra,factorial:rl,gamma:u1,isNegative:Co,multiply:lt,pi:Gx,pow:ka,sin:Bc,smallerEq:pu,subtract:qt,typed:te}),l1=vg({abs:Yn,add:Ur,conj:ds,ctranspose:jx,eigs:MN,equalScalar:Rr,larger:Hn,matrix:$e,multiply:lt,pow:ka,smaller:Wn,sqrt:ai,typed:te}),TN=Dh({BigNumber:Ge,DenseMatrix:Or,SparseMatrix:ji,addScalar:nn,config:Oe,cos:Zx,matrix:$e,multiplyScalar:Lt,norm:l1,sin:Bc,typed:te,unaryMinus:Ei}),zk=yx({BigNumber:Ge,Unit:Sr,config:Oe}),_N=Ay({identity:To,matrix:$e,multiply:lt,norm:l1,qr:r1,subtract:qt,typed:te}),Yk=wh({multiply:lt,rotationMatrix:TN,typed:te}),FN=Ny({abs:Yn,add:Ur,concat:Qr,identity:To,index:vN,lusolve:NN,matrix:$e,matrixFromColumns:e1,multiply:lt,range:du,schur:_N,subset:va,subtract:qt,transpose:Jf,typed:te}),Wk=My({matrix:$e,multiply:lt,sylvester:FN,transpose:Jf,typed:te});var tl={},nl={},Hk={},$n=wg({mathWithTransform:nl}),al=Hg({Node:$n}),_o=Gg({Node:$n}),hu=Zg({Node:$n}),$k=Jg({Node:$n}),il=Mg({Node:$n}),Gk=Og({Node:$n,ResultSet:ZS}),Vk=Ig({Node:$n}),bs=Lg({Node:$n}),Zk=Xg({Node:$n}),rK=o0({classes:Hk}),ON=hy({math:tl,typed:te}),Qk=Ug({Node:$n,typed:te}),tK=gy({Chain:ON,typed:te}),ol=Yg({Node:$n,size:yn}),sl=Ng({Node:$n,subset:va}),Xk=_g({matrix:$e,Node:$n,subset:va}),ws=jg({Unit:Sr,Node:$n,math:tl}),Ds=ry({Node:$n,SymbolNode:ws,math:tl}),oi=ty({AccessorNode:sl,ArrayNode:il,AssignmentNode:Xk,BlockNode:Gk,ConditionalNode:Vk,ConstantNode:bs,FunctionAssignmentNode:Qk,FunctionNode:Ds,IndexNode:ol,ObjectNode:al,OperatorNode:_o,ParenthesisNode:hu,RangeNode:Zk,RelationalNode:$k,SymbolNode:ws,config:Oe,numeric:ii,typed:te}),Kk=e0({ConstantNode:bs,FunctionNode:Ds,OperatorNode:_o,ParenthesisNode:hu,parse:oi,typed:te}),BN=Jy({bignumber:ha,fraction:cu,AccessorNode:sl,ArrayNode:il,ConstantNode:bs,FunctionNode:Ds,IndexNode:ol,ObjectNode:al,OperatorNode:_o,SymbolNode:ws,config:Oe,mathWithTransform:nl,matrix:$e,typed:te}),nK=ny({parse:oi,typed:te}),IN=jy({AccessorNode:sl,ArrayNode:il,ConstantNode:bs,FunctionNode:Ds,IndexNode:ol,ObjectNode:al,OperatorNode:_o,ParenthesisNode:hu,SymbolNode:ws,add:Ur,divide:pn,equal:Ra,isZero:ni,multiply:lt,parse:oi,pow:ka,subtract:qt,typed:te}),PN=ay({parse:oi,typed:te}),Jk=dy({evaluate:PN}),jk=iy({evaluate:PN}),c1=Ky({bignumber:ha,fraction:cu,AccessorNode:sl,ArrayNode:il,ConstantNode:bs,FunctionNode:Ds,IndexNode:ol,ObjectNode:al,OperatorNode:_o,ParenthesisNode:hu,SymbolNode:ws,add:Ur,config:Oe,divide:pn,equal:Ra,isZero:ni,mathWithTransform:nl,matrix:$e,multiply:lt,parse:oi,pow:ka,resolve:Kk,simplifyConstant:BN,simplifyCore:IN,subtract:qt,typed:te}),aK=r0({OperatorNode:_o,parse:oi,simplify:c1,typed:te}),iK=Xy({parse:oi,typed:te}),oK=oy({Parser:jk,typed:te}),sK=n0({bignumber:ha,fraction:cu,AccessorNode:sl,ArrayNode:il,ConstantNode:bs,FunctionNode:Ds,IndexNode:ol,ObjectNode:al,OperatorNode:_o,ParenthesisNode:hu,SymbolNode:ws,add:Ur,config:Oe,divide:pn,equal:Ra,isZero:ni,mathWithTransform:nl,matrix:$e,multiply:lt,parse:oi,pow:ka,simplify:c1,simplifyConstant:BN,simplifyCore:IN,subtract:qt,typed:te}),uK=t0({ConstantNode:bs,FunctionNode:Ds,OperatorNode:_o,ParenthesisNode:hu,SymbolNode:ws,config:Oe,equal:Ra,isZero:ni,numeric:ii,parse:oi,simplify:c1,typed:te}),fK=vy({Help:Jk,mathWithTransform:nl,typed:te});bt(tl,{e:GS,false:A4,fineStructure:M4,i:VS,Infinity:E4,LN10:C4,LOG10E:T4,NaN:_4,null:F4,phi:O4,SQRT1_2:I4,sackurTetrode:P4,tau:QS,true:R4,E:GS,version:k4,efimovFactor:L4,LN2:q4,pi:Gx,replacer:U4,reviver:rK,SQRT2:z4,typed:te,unaryPlus:Vx,PI:Gx,weakMixingAngle:Y4,abs:Yn,acos:W4,acot:H4,acsc:$4,addScalar:nn,arg:G4,asech:V4,asinh:Z4,atan:XS,atanh:Q4,bignumber:ha,bitNot:X4,boolean:K4,clone:J4,combinations:_c,complex:Fc,conj:ds,cos:Zx,cot:j4,csc:eR,cube:rR,equalScalar:Rr,erf:tR,exp:KS,expm1:nR,filter:aR,forEach:iR,format:Xf,getMatrixDataType:Qx,hex:oR,im:Xx,isInteger:ea,isNegative:Co,isPositive:hs,isZero:ni,LOG2E:sR,lgamma:uR,log10:fR,log2:JS,map:vs,multiplyScalar:Lt,not:Oc,number:Ji,oct:lR,pickRandom:cR,print:mR,random:pR,re:Kx,sec:dR,sign:jS,sin:Bc,splitUnit:hR,square:vR,string:gR,subtractScalar:Pa,tan:yR,typeOf:eN,acosh:xR,acsch:bR,apply:Jx,asec:wR,bin:DR,chain:tK,combinationsWithRep:SR,cosh:NR,csch:AR,isNaN:Kf,isPrime:MR,randomInt:ER,sech:CR,sinh:TR,sparse:_R,sqrt:ai,tanh:FR,unaryMinus:Ei,acoth:OR,coth:BR,fraction:cu,isNumeric:gs,matrix:$e,matrixFromFunction:IR,mode:PR,numeric:ii,prod:rN,reshape:tN,size:yn,squeeze:RR,transpose:Jf,xgcd:nN,zeros:xn,asin:kR,cbrt:aN,concat:Qr,count:LR,ctranspose:jx,diag:iN,divideScalar:Ot,dotDivide:jf,equal:Ra,flatten:el,hasNumericValue:qR,identity:To,kron:UR,largerEq:Ic,leftShift:zR,lsolve:oN,matrixFromColumns:e1,nthRoot:YR,ones:WR,qr:r1,resize:HR,rightArithShift:$R,round:mu,smaller:Wn,subtract:qt,to:GR,unequal:VR,usolve:t1,xor:ZR,add:Ur,atan2:QR,bitAnd:XR,bitOr:KR,bitXor:JR,catalan:jR,compare:ys,compareText:sN,cumsum:e5,deepEqual:n1,diff:r5,distance:t5,dot:Pc,equalText:n5,floor:uN,gcd:a5,hypot:i5,larger:Hn,log:a1,lsolveAll:o5,matrixFromRows:s5,min:u5,mod:lN,multiply:lt,nthRoots:f5,or:l5,partitionSelect:Rc,rightLogShift:c5,slu:cN,subset:va,sum:i1,trace:m5,usolveAll:mN,zpk2tf:p5,ceil:o1,compareNatural:Ci,composition:d5,cross:h5,det:pN,dotMultiply:v5,fix:hN,index:vN,intersect:g5,invmod:y5,lcm:x5,log1p:b5,max:s1,setCartesian:w5,setDistinct:D5,setIsSubset:S5,setPowerset:N5,smallerEq:pu,sort:A5,and:M5,range:du,row:E5,setDifference:gN,setMultiplicity:C5,setSymDifference:yN,column:bN,inv:xs,lup:wN,pinv:T5,pow:ka,setIntersect:DN,setUnion:_5,sqrtm:F5,vacuumImpedance:O5,wienDisplacement:B5,atomicMass:I5,bohrMagneton:P5,boltzmann:R5,conductanceQuantum:k5,coulomb:L5,deuteronMass:q5,dotPow:U5,electricConstant:z5,elementaryCharge:Y5,expm:W5,faraday:H5,fft:SN,gamma:u1,gravitationConstant:$5,hartreeEnergy:G5,ifft:V5,klitzing:Z5,loschmidt:Q5,magneticConstant:X5,molarMass:K5,molarPlanckConstant:J5,neutronMass:j5,nuclearMagneton:ek,planckCharge:rk,planckLength:tk,planckTemperature:nk,protonMass:ak,quantumOfCirculation:ik,reducedPlanckConstant:ok,rydberg:sk,secondRadiation:uk,speedOfLight:fk,stefanBoltzmann:lk,thomsonCrossSection:ck,avogadro:mk,bohrRadius:pk,createUnit:dk,divide:pn,electronMass:hk,factorial:rl,firstRadiation:vk,gravity:gk,inverseConductanceQuantum:yk,lusolve:NN,magneticFluxQuantum:xk,molarMassC12:bk,multinomial:wk,parse:oi,permutations:Dk,planckMass:Sk,polynomialRoot:Nk,resolve:Kk,setSize:Ak,simplifyConstant:BN,solveODE:Mk,stirlingS2:AN,unit:Ek,bellNumbers:Ck,compile:nK,eigs:MN,fermiCoupling:Tk,gasConstant:_k,kldivergence:Fk,mean:EN,molarVolume:Ok,planckConstant:Bk,quantileSeq:Ik,simplifyCore:IN,variance:f1,classicalElectronRadius:Pk,evaluate:PN,median:CN,simplify:c1,symbolicEqual:aK,corr:Rk,freqz:kk,leafCount:iK,mad:Lk,parser:oK,rationalize:sK,std:qk,zeta:Uk,derivative:uK,norm:l1,rotationMatrix:TN,help:fK,planckTime:zk,schur:_N,rotate:Yk,sylvester:FN,lyap:Wk,config:Oe});bt(nl,tl,{filter:Nx({typed:te}),forEach:Ax({typed:te}),map:Ex({typed:te}),apply:Dx({isInteger:ea,typed:te}),or:Wx({DenseMatrix:Or,concat:Qr,equalScalar:Rr,matrix:$e,typed:te}),and:Yx({add:Ur,concat:Qr,equalScalar:Rr,matrix:$e,not:Oc,typed:te,zeros:xn}),concat:Ix({isInteger:ea,matrix:$e,typed:te}),max:Cx({config:Oe,larger:Hn,numeric:ii,typed:te}),print:zx({add:Ur,matrix:$e,typed:te,zeros:xn}),bitAnd:Hx({add:Ur,concat:Qr,equalScalar:Rr,matrix:$e,not:Oc,typed:te,zeros:xn}),diff:Px({bignumber:ha,matrix:$e,number:Ji,subtract:qt,typed:te}),min:_x({config:Oe,numeric:ii,smaller:Wn,typed:te}),subset:Bx({add:Ur,matrix:$e,typed:te,zeros:xn}),bitOr:$x({DenseMatrix:Or,concat:Qr,equalScalar:Rr,matrix:$e,typed:te}),cumsum:qx({add:Ur,typed:te,unaryPlus:Vx}),index:Mx({Index:_n,getMatrixDataType:Qx}),sum:kx({add:Ur,config:Oe,numeric:ii,typed:te}),range:Fx({bignumber:ha,matrix:$e,add:Ur,config:Oe,isPositive:hs,larger:Hn,largerEq:Ic,smaller:Wn,smallerEq:pu,typed:te}),row:Ox({Index:_n,matrix:$e,range:du,typed:te}),column:Sx({Index:_n,matrix:$e,range:du,typed:te}),mean:Tx({add:Ur,divide:pn,typed:te}),quantileSeq:Lx({add:Ur,bignumber:ha,compare:ys,divide:pn,isInteger:ea,larger:Hn,multiply:lt,partitionSelect:Rc,smaller:Wn,smallerEq:pu,subtract:qt,typed:te}),variance:Ux({add:Ur,apply:Jx,divide:pn,isNaN:Kf,multiply:lt,subtract:qt,typed:te}),std:Rx({map:vs,sqrt:ai,typed:te,variance:f1})});bt(Hk,{BigNumber:Ge,Complex:yt,Fraction:ps,Matrix:Tc,Node:$n,ObjectNode:al,OperatorNode:_o,ParenthesisNode:hu,Range:B4,RelationalNode:$k,ResultSet:ZS,ArrayNode:il,BlockNode:Gk,ConditionalNode:Vk,ConstantNode:bs,DenseMatrix:Or,RangeNode:Zk,Chain:ON,FunctionAssignmentNode:Qk,SparseMatrix:ji,IndexNode:ol,ImmutableDenseMatrix:fN,Index:_n,AccessorNode:sl,AssignmentNode:Xk,FibonacciHeap:dN,Spa:xN,Unit:Sr,SymbolNode:ws,FunctionNode:Ds,Help:Jk,Parser:jk});ON.createProxy(tl);var RN=$S;var a6=Aa(Mp(),1);var r6=Aa(e6(),1);function t6(e){var r=new r6.default;return e.on=r.on.bind(r),e.off=r.off.bind(r),e.once=r.once.bind(r),e.emit=r.emit.bind(r),e}function n6(e,r,t,n){function a(x,b){var E=arguments.length;if(E!==1&&E!==2)throw new Ba("import",E,1,2);b||(b={});function w(O,_,C){if(Array.isArray(_))_.forEach(L=>w(O,L));else if(typeof _=="object")for(var T in _)Xe(_,T)&&w(O,_[T],T);else if(nu(_)||C!==void 0){var k=nu(_)?y(_)?_.fn+".transform":_.fn:C;if(Xe(O,k)&&O[k]!==_&&!b.silent)throw new Error('Cannot import "'+k+'" twice');O[k]=_}else if(!b.silent)throw new TypeError("Factory, Object, or Array expected")}var N={};w(N,x);for(var M in N)if(Xe(N,M)){var D=N[M];if(nu(D))o(D,b);else if(u(D))i(M,D,b);else if(!b.silent)throw new TypeError("Factory, Object, or Array expected")}}function i(x,b,E){if(E.wrap&&typeof b=="function"&&(b=f(b)),m(b)&&(b=e(x,{[b.signature]:b})),e.isTypedFunction(t[x])&&e.isTypedFunction(b)){E.override?b=e(x,b.signatures):b=e(t[x],b),t[x]=b,delete n[x],s(x,b),t.emit("import",x,function(){return b});return}if(t[x]===void 0||E.override){t[x]=b,delete n[x],s(x,b),t.emit("import",x,function(){return b});return}if(!E.silent)throw new Error('Cannot import "'+x+'": already exists')}function s(x,b){b&&typeof b.transform=="function"?(t.expression.transform[x]=b.transform,p(x)&&(t.expression.mathWithTransform[x]=b.transform)):(delete t.expression.transform[x],p(x)&&(t.expression.mathWithTransform[x]=b))}function c(x){delete t.expression.transform[x],p(x)?t.expression.mathWithTransform[x]=t[x]:delete t.expression.mathWithTransform[x]}function f(x){var b=function(){for(var w=[],N=0,M=arguments.length;N2&&arguments[2]!==void 0?arguments[2]:x.fn;if(uD(E,"."))throw new Error("Factory name should not contain a nested path. Name: "+JSON.stringify(E));var w=y(x)?t.expression.transform:t,N=E in t.expression.transform,M=Xe(w,E)?w[E]:void 0,D=function(){var _={};x.dependencies.map(cD).forEach(T=>{if(uD(T,"."))throw new Error("Factory dependency should not contain a nested path. Name: "+JSON.stringify(T));T==="math"?_.math=t:T==="mathWithTransform"?_.mathWithTransform=t.expression.mathWithTransform:T==="classes"?_.classes=t:_[T]=t[T]});var C=x(_);if(C&&typeof C.transform=="function")throw new Error('Transforms cannot be attached to factory functions. Please create a separate function for it with exports.path="expression.transform"');if(M===void 0||b.override)return C;if(e.isTypedFunction(M)&&e.isTypedFunction(C))return e(M,C);if(b.silent)return M;throw new Error('Cannot import "'+E+'": already exists')};!x.meta||x.meta.lazy!==!1?(sf(w,E,D),M&&N?c(E):(y(x)||h(x))&&sf(t.expression.mathWithTransform,E,()=>w[E])):(w[E]=D(),M&&N?c(E):(y(x)||h(x))&&sf(t.expression.mathWithTransform,E,()=>w[E])),n[E]=x,t.emit("import",E,D)}function u(x){return typeof x=="function"||typeof x=="number"||typeof x=="string"||typeof x=="boolean"||x===null||Kt(x)||sn(x)||tr(x)||_a(x)||Qe(x)||Array.isArray(x)}function m(x){return typeof x=="function"&&typeof x.signature=="string"}function p(x){return!Xe(v,x)}function h(x){return x.fn.indexOf(".")===-1&&!Xe(v,x.fn)&&(!x.meta||!x.meta.isClass)}function y(x){return x!==void 0&&x.meta!==void 0&&x.meta.isTransformFunction===!0||!1}var v={expression:!0,type:!0,docs:!0,error:!0,json:!0,chain:!0};return a}function m1(e,r){var t=bt({},eu,r);if(typeof Object.create!="function")throw new Error("ES5 not supported by this JavaScript engine. Please load the es5-shim and es5-sham library for compatibility.");var n=t6({isNumber:ur,isComplex:sn,isBigNumber:tr,isFraction:_a,isUnit:Kt,isString:Tt,isArray:Cr,isMatrix:Qe,isCollection:_t,isDenseMatrix:wo,isSparseMatrix:Fa,isRange:rs,isIndex:$i,isBoolean:cp,isResultSet:mp,isHelp:nf,isFunction:pp,isDate:dp,isRegExp:hp,isObject:Gi,isNull:vp,isUndefined:gp,isAccessorNode:jn,isArrayNode:un,isAssignmentNode:yp,isBlockNode:xp,isConditionalNode:bp,isConstantNode:wr,isFunctionAssignmentNode:Xa,isFunctionNode:Cn,isIndexNode:la,isNode:Mr,isObjectNode:Vi,isOperatorNode:ht,isParenthesisNode:fn,isRangeNode:wp,isRelationalNode:Dp,isSymbolNode:ft,isChain:af});n.config=Q2(t,n.emit),n.expression={transform:{},mathWithTransform:{config:n.config}};var a=[],i=[];function s(u){if(nu(u))return u(n);var m=u[Object.keys(u)[0]];if(nu(m))return m(n);if(!G2(u))throw console.warn("Factory object with properties \`type\`, \`name\`, and \`factory\` expected",u),new Error("Factory object with properties \`type\`, \`name\`, and \`factory\` expected");var p=a.indexOf(u),h;return p===-1?(u.math===!0?h=u.factory(n.type,t,s,n.typed,n):h=u.factory(n.type,t,s,n.typed),a.push(u),i.push(h)):h=i[p],h}var c={};function f(){for(var u=arguments.length,m=new Array(u),p=0;p{Jw(c).forEach(u=>{u&&u.meta&&u.meta.recreateOnConfigChange&&o(u,{override:!0})})}),n.create=m1.bind(null,e),n.factory=F,n.import(Jw(H2(e))),n.ArgumentsError=Ba,n.DimensionError=dr,n.IndexError=cn,n}var GN=Aa(tp());var mK=Aa(tp());var qN=e=>e.lastIndexOf("/")!=-1?e.lastIndexOf(".")!=-1?PM(e.substring(e.lastIndexOf("/")+1,e.lastIndexOf("."))):e.substring(e.lastIndexOf("/")+1):e.lastIndexOf(".")!=-1?e.substring(0,e.lastIndexOf(".")):e;var p1="spaces://$",i6="spaces://$tags";var bLe={name:Wr.menu.vault,readOnly:!1,path:"/",label:{thumbnail:"",name:Wr.menu.vault,sticker:"ui//vault",color:""},type:"default"},d1={tags:{name:"Tags",icon:"ui//tags",readOnly:!1,hidden:!1},overview:{name:"Overview",icon:"ui//overview",readOnly:!0,hidden:!0}};var o6=(e,r,t,n,a,i,s,c)=>{if(!n)return"";let f=new Map;Object.keys(i).forEach(u=>f.set(u,i[u])),f.set("$properties",a),f.set("$paths",r),f.set("$items",t.invMap),f.set("$spaces",t.map),s&&f.set("$current",s);let o;try{if(e.evaluate("current = _current()",f),o=e.evaluate(n,f),o=Qs("",o),typeof o!="string"&&c)throw o}catch(u){if(o="",c)throw u}return o};var UN=e=>{let r=new Map;e.filter(s=>s.type=="fileprop"||s.name.startsWith("tags")).forEach(s=>{let{value:c}=jm(s.value,s.type),f=[];try{let u=oi(c).filter(m=>m.type=="FunctionNode").filter(m=>m.fn.name=="prop"&&m.args[0].type=="ConstantNode").map(m=>m.args[0]?.value);f.push(...u)}catch{}let o=s.name;r.has(o)||r.set(o,new Set);for(let u of f){let m=u;m!==o&&r.get(o).add(m)}});let t=new Set,n=[],a=new Set,i=s=>{if(a.has(s))throw new Error("Circular dependency detected");if(!t.has(s)){a.add(s);let c=r.get(s)||new Set;for(let f of c)i(f);t.add(s),a.delete(s),n.push(s)}};for(let s of e)t.has(s.name)||i(s.name);return n},s6=(e,r,t,n,a,i,s)=>{if(!n)return{};let c=s??UN(a),f=r.get(n[In])?.metadata?.property??{},o=Object.keys(f).filter(p=>a.some(h=>h.name==p)&&p!=In).reduce((p,h)=>({...p,[h]:Qs(h,f[h])}),{}),u=c.map(p=>a.find(h=>h.name==p)).filter(p=>p&&(p.type=="fileprop"||p.name=="tags")),m=a.reduce((p,h)=>({...p,[h.name]:h}),{});return{...n,...o,...u.reduce((p,h)=>{let{value:y}=jm(h.value,h.type);return{...p,[h.name]:o6(e,r,t,y,m,{...n,...p},i)}},{})}};var u6=(e,r)=>{let t=e?An(e):[],n=r?An(r):[];return n.every(a=>t.some(i=>i==a))&&t.every(a=>n.some(i=>i==a))},ul=(e,r)=>e==r,zN=(e,r)=>(e??"").length==0,YN=(e,r)=>(e??"").toLowerCase().includes((r??"").toLowerCase()),WN=(e,r)=>parseFloat(e)>parseFloat(r),HN=(e,r)=>parseInt(e){let t=isNaN(Date.parse(e))?new Date(parseInt(e)):new Date(e),n=isNaN(Date.parse(r))?new Date(parseInt(r)):new Date(r);return t.valueOf()>=n.valueOf()},l6=(e,r)=>{let t=isNaN(Date.parse(e))?new Date(parseInt(e)):new Date(e),n=isNaN(Date.parse(r))?new Date(parseInt(r)):new Date(r);return t.valueOf(){let t=e?An(e):[],n=r?An(r):[];return t.length==0?!1:n.some(a=>t.some(i=>i==a))},c6=(e,r)=>{if(!e)return!1;let t=new Date(\`\${e.toString().replace(".",":")}\`),n=new Date(\`\${r}\`);return t.getMonth()===n.getMonth()&&t.getDate()===n.getDate()},m6=e=>{if(!e)return!1;let r=new Date(\`\${e.toString()}T00:00\`),t=new Date;return r.getMonth()===t.getMonth()&&r.getDate()===t.getDate()};var fl={isNotEmpty:{type:["text","file","number","option","option-multi","link","link-multi","image"],fn:(e,r)=>!zN(e,""),valueType:"none"},isEmpty:{type:["text","file","number","option","option-multi","link","link-multi","image"],fn:(e,r)=>zN(e,""),valueType:"none"},include:{fn:(e,r)=>YN(e,r),type:["text","file","link","image"],valueType:"text"},notInclude:{type:["text","file","link","image"],fn:(e,r)=>!YN(e,r),valueType:"text"},is:{type:["text"],fn:(e,r)=>ul(e,r),valueType:"text"},isNot:{type:["text"],fn:(e,r)=>!ul(e,r),valueType:"text"},equal:{type:["number"],fn:(e,r)=>ul(e,r),valueType:"number"},isLink:{type:["link","context"],fn:(e,r)=>ul(e,r),valueType:"link"},isNotLink:{type:["link","context"],fn:(e,r)=>!ul(e,r),valueType:"link"},isGreatThan:{type:["number"],fn:(e,r)=>WN(e,r),valueType:"number"},isLessThan:{type:["number"],fn:(e,r)=>HN(e,r),valueType:"number"},isLessThanOrEqual:{type:["number"],fn:(e,r)=>!WN(e,r),valueType:"number"},isGreatThanOrEqual:{type:["number"],fn:(e,r)=>!HN(e,r),valueType:"number"},dateBefore:{type:["date"],fn:(e,r)=>l6(e,r),valueType:"date"},dateAfter:{type:["date"],fn:(e,r)=>f6(e,r),valueType:"date"},isSameDate:{type:["date"],fn:(e,r)=>c6(e,r),valueType:"date"},isSameDateAsToday:{type:["date"],fn:(e,r)=>m6(e,r),valueType:"none"},isExactList:{type:["option","option-multi","link-multi","context-multi","tags-multi"],fn:(e,r)=>u6(e,r),valueType:"list"},isAnyInList:{type:["option","context","link","option-multi","link-multi","context-multi","tags-multi"],fn:(e,r)=>$N(e,r),valueType:"list"},isNoneInList:{type:["option","context","link","option-multi","link-multi","context-multi","tags-multi"],fn:(e,r)=>!$N(e,r),valueType:"list"},isTrue:{type:["boolean"],fn:(e,r)=>e=="true",valueType:"none"},isFalse:{type:["boolean"],fn:(e,r)=>e!="true",valueType:"none"}};var dK=(e,r,t)=>r.reduce((a,i)=>{let[s,c]=a,f=i.type=="context"?p6(c,i,t):i.type=="path"?h6(c,i,t):i.type=="frontmatter"?d6(c,i,t):v6(c,i,t),o=c.filter(u=>!f.includes(u));return[[...s,...f],o]},[[],e])[0],hK=(e,r,t)=>r.reduce((n,a)=>a.type=="context"?p6(n,a,t):a.type=="path"?h6(n,a,t):a.type=="frontmatter"?d6(n,a,t):v6(n,a,t),e),p6=(e,r,t)=>{let n=fl[r.fn];return!n||n.valueType!="none"&&r.value.length==0?[]:e.filter(a=>{let[i,s]=r.field.split("."),c=a.metadata?.property;if(!a.spaces?.includes(i)||!c||!c[s])return!1;let f=!0;if(n){let o=r.fType=="property"?t[r.value]:r.value;f=n.fn(Qs(s,c[s]),o)}return f})},d6=(e,r,t)=>{let n=fl[r.fn];return!n||n.valueType!="none"&&r.value.length==0?[]:e.filter(a=>{let i=a.metadata?.property;if(!i||i[r.field]===void 0)return!1;let s=!0;if(n){let c=r.fType=="property"?t[r.value]:r.value;s=n.fn(Qs(r.field,i[r.field]),c)}return s})},h6=(e,r,t)=>{let n=fl[r.fn];return!n||n.valueType!="none"&&r.value.length==0?[]:e.filter(a=>{let i="";r.field=="outlinks"?i=Zs(a.outlinks??[]):r.field=="inlinks"?i=Zs(a.metadata?.inlinks??[]):r.field=="tags"&&(i=Zs(a.tags??[]));let s=!0;if(n){let c=r.fType=="property"?t[r.value]:r.value;s=n.fn(i,c)}return s})},v6=(e,r,t)=>{let n=fl[r.fn];return!n||n.valueType!="none"&&r.value.length==0?[]:e.filter(a=>{let i=!0;if(n){let s=r.fType=="property"?t[r.value]:r.value;i=n.fn(a.metadata?.[r.type]?.[r.field],s)}return i})},g6=(e,r,t)=>e.reduce((a,i)=>!a||i.filters.length==0?!1:i.type=="any"?dK([r],i.filters,t).length>0:hK([r],i.filters,t).length>0,!0);var y6=(e,r)=>e.hiddenExtensions.some(t=>r.endsWith(t))||r.endsWith("/"+e.spaceSubFolder)||r==e.spaceSubFolder||r.split("/").pop()==e.spaceSubFolder||r.startsWith(e.spacesFolder+"/#")||e.hiddenFiles.some(t=>t==r);var x6=(e,r,t,n,a,i,s)=>{let c={};if(!e)return{changed:!1,cache:null};if(!r)return{changed:!1,cache:{path:e.path,schemas:[],outlinks:[],contexts:[],paths:[],contextTable:null,spaceMap:c,dbExists:!1}};let f=Object.values(r).map(O=>O.schema),o=r[Ea]?.cols;(!o||o.length==0)&&(o=Vs.rows);let u=r[Ea]?.schema??Gs,m=r[Ea]?.rows?.map(O=>O[In])??[],p=t.filter(O=>!m.includes(O)),h=[...FM(t??[],m),...p],y=UN(o),v=[...(r[Ea]?.rows??[]).filter(O=>t.includes(O[In])),...p.map(O=>({[In]:O}))].map(O=>s6(s,a,i,O,o,a.get(e.path),y)),x={schema:u,cols:o,rows:v},b=x.cols?.filter(O=>O.type.startsWith("context"))??[],E=x.cols?.filter(O=>O.type.startsWith("link"))??[],w=Ma(b.map(O=>O.value));b.forEach(O=>{c[O.name]={},x.rows.forEach(_=>{An(_[O.name]).forEach(C=>c[O.name][C]=[...c[O.name][C]??[],_[In]])})});let N=Ma(x.rows.reduce((O,_)=>Ma([...O,...[...b,...E].flatMap(C=>An(_[C.name]).map(T=>nc(T)))]),[])),M={contextTable:x,path:e.path,contexts:w,outlinks:N,paths:h,schemas:f,spaceMap:c,dbExists:n},D=!1;return GN.default.isEqual(x,r[Ea])||(D=!0),{changed:D,cache:M}},b6=(e,r,t,n)=>{let a={};for(let[i,s]of e){let c=r.enableFolderNote?t.get(i)?.space.notePath??i:i,f=e.get(c)??s;if(!s)continue;let o=s?.parent??"",u=s?.type??"",m=s?.subtype??"",p=t.has(i)?t.get(i).space.name:s?.label?.name,h=n?.get(i),{changed:y,cache:v}=VN(i,r,t,f,p,u,m,o,h);a[i]={changed:y,cache:v}}return a},VN=(e,r,t,n,a,i,s,c,f)=>{if(!n)return{changed:!1,cache:null};let o=(R,X,U,oe)=>R?.length>0||R?.length>0?R:X=="space"?oe=="Spaces/Home"?"ui//home":oe=="/"?"ui//vault":oe.startsWith("spaces://")?"ui//tags":"ui//folder":"ui//file",u={label:n?.label,path:e,name:n?.label?.name??qN(e),readOnly:n?.readOnly},m=[],p=n?.tags?.map(R=>R.toLowerCase())??[],h=y6(r,e);if(e.startsWith(p1)){let R=e.replace(p1,"");h=d1[R]?.hidden,u.readOnly=d1[R]?.readOnly}let y=(R,X,U=new Set)=>{let oe=[];for(let me of X){let ae=(R.get(me)?.contexts??[]).map($=>$.toLowerCase());for(let $ of ae)U.has($)||(oe.push($),U.add($),oe.push(...y(R,[rc($)],U)))}return oe};if(t.has(c))for(let R of t.get(c).contexts??[])m.push(R.toLowerCase());m.push(...p);let v=n?.property?Jm(n.property[r.fmKeyAlias]):[],x=t.get(c)?.metadata?.defaultSticker,b=o(IM(n?.label?.sticker,x),i,s,e),E=t.get(c)?.metadata?.defaultColor,w=n?.label?.color??E??"",N=n?.resolvedLinks??[],M=[],D=!1,O,_={...u,name:a,tags:Ma(m),type:i,subtype:s,parent:c,label:{name:r.spacesUseAlias&&v?.length>0?v[0]:a,sticker:b,color:w,thumbnail:n?.label?.thumbnail??"",preview:n?.label?.preview??""},metadata:{...n},outlinks:N},C=[],T=[],k=[];s=="tag"&&C.push(i6);for(let R of m)C.push(rc(R)),M.push(R);let L=new Set,H=(R,X)=>{if(!L.has(R)){if(L.add(R),X.dependencies?.length>0)for(let U of X.dependencies)t.has(U)&&H(U,t.get(U));if(X.metadata.recursive?.length>0&&_.path.startsWith(\`\${X.path}/\`)){if(X.metadata.recursive=="all"){C.push(R),M.push(X.name);return}if(X.metadata.recursive=="file"&&_.type!="space"){C.push(R),M.push(X.name);return}}if(X.space.notePath==e&&X.path!=X.space.notePath&&(D=!0,O=X.path,r.enableFolderNote&&(h=!0)),s!="tag"&&s!="default"&&X.space&&X.space.path==c){C.push(R),M.push(X.name);return}if(X.metadata?.filters?.length>0&&g6(X.metadata.filters,{..._,spaces:C},X.properties)){C.push(R),M.push(X.name),k.push(R);return}X.metadata?.links?.length>0&&(X.metadata?.links??[]).find(oe=>oe==_.path)&&(C.push(R),M.push(X.name),T.push(R))}};for(let[R,X]of t)H(R,X);let V=y(t,C);C.push(...V.map(R=>rc(R))),M.push(...V),_.tags.push(...V),D&&(_.metadata.spacePath=O);let W=h?{..._,spaces:[],hidden:h}:{..._,spaces:Ma(C),linkedSpaces:T,liveSpaces:k,spaceNames:M,hidden:h},q=!0;return f&&GN.default.isEqual(W,f)&&(q=!1),{changed:q,cache:W}};function w6(e){let{path:r,settings:t,spacesCache:n,pathMetadata:a,name:i,type:s,subtype:c,parent:f,oldMetadata:o}=e;return VN(r,t,n,a,i,s,c,f,o)}function ZN(e,r){let{space:t,mdb:n,paths:a,dbExists:i,spacesMap:s,pathsIndex:c}=e;return x6(t,n,a,i,c,s,r)}function D6(e,r){let{map:t,pathsIndex:n,spacesMap:a}=e,i=new Map;for(let[s,c]of t)i.set(s,ZN({...c,pathsIndex:n,spacesMap:a},r));return i}function S6(e){let{pathCache:r,settings:t,spacesCache:n,oldMetadata:a}=e;return b6(r,t,n,a)}var vK=self,gK={...RN,createAdd:F("add",[],()=>function(r,t){return r+t}),createEqual:F("equal",[],()=>function(r,t){return r==t}),createUnequal:F("unequal",[],()=>function(r,t){return r!=t})},yK={matrix:"Array"},QN=m1(gK,yK);QN.import(Xw,{override:!0});vK.onmessage=async e=>{let{payload:r,job:t}=e.data,n;t.type=="path"?n=w6(r):t.type=="context"?n=ZN(r,QN):t.type=="contexts"?n=D6(r,QN):t.type=="paths"&&(n=S6(r));try{postMessage({job:t,result:n})}catch(a){console.log(a),postMessage({job:t,result:{$error:\`Failed to index \${t.type} \${t.path}: \${a}\`}})}}; /*! * decimal.js v10.4.3 * An arbitrary-precision Decimal type for JavaScript. @@ -949,7 +949,7 @@ In case of a (multi dimensional) array or matrix, the prob order quantile of all //! moment.js //! momentjs.com //! version : 2.29.4 -`,{name:"Superstate Indexer"})}var dR=class{constructor(t,r){this.numWorkers=t;this.cache=r;this.workers=[],this.busy=[],this.reloadQueue=[],this.reloadSet=new Set,this.callbacks=new Map;for(let n=0;nthis.finish(a.data.job,a.data.result,n),this.workers.push(i),this.busy.push(!1)}}reload(t){let r=ME(t),n=new Promise((a,o)=>{this.callbacks.has(r)?this.callbacks.get(r)?.push([a,o]):this.callbacks.set(r,[[a,o]])});if(this.reloadSet.has(r))return n;this.reloadSet.add(r);let i=this.nextAvailableWorker();return i!==void 0?this.send(t,i):this.reloadQueue.push(t),n}finish(t,r,n){let i=ME(t),a=[].concat(this.callbacks.get(i)??[]);this.reloadSet.delete(i),this.callbacks.delete(i),this.busy[n]=!1;let o=this.reloadQueue.shift();if(o!==void 0&&this.send(o,n),"$error"in r)for(let[s,l]of a)l(r.$error);else for(let[s,l]of a)s(r)}async send(t,r){if(t.type=="paths"){let n=await this.cache.spaceManager.allCaches(),i={settings:this.cache.settings,spacesCache:this.cache.spacesIndex,pathCache:n,oldMetadata:this.cache.pathsIndex};this.message(r,{job:t,payload:i}),this.busy[r]=!0;return}if(t.type=="path"){let n=this.cache.spacesIndex.get(t.path),i=t.path,a;n&&(a=n.space.name,this.cache.settings.enableFolderNote?i=n.space.notePath:i=n.space.defPath);let o=await this.cache.spaceManager.readPathCache(i)??await this.cache.spaceManager.readPathCache(t.path);a=a??o?.label.name;let s=await this.cache.spaceManager.parentPathForPath(t.path),l=n?"space":o.type,u=n?n.type:o?.subtype,c={path:t.path,settings:this.cache.settings,spacesCache:this.cache.spacesIndex,pathMetadata:o,name:a,parent:s,type:l,subtype:u,oldMetadata:this.cache.pathsIndex.get(t.path)};this.message(r,{job:t,payload:c}),this.busy[r]=!0;return}if(t.type=="context"){let n=this.cache.spacesIndex.get(t.path)?.space;if(!n||!n.path){this.message(r,{job:t,payload:{space:n,mdb:null,paths:[...this.cache.spacesMap.getInverse(t.path)],pathsIndex:this.cache.pathsIndex,spacesMap:this.cache.spacesMap}}),this.busy[r]=!0;return}let i=await this.cache.spaceManager.contextInitiated(n.path);this.cache.spaceManager.readAllTables(n.path).then(a=>{this.message(r,{job:t,payload:{space:n,mdb:a,paths:[...this.cache.spacesMap.getInverse(t.path)],spacesMap:this.cache.spacesMap,dbExists:i,pathsIndex:this.cache.pathsIndex}}),this.busy[r]=!0});return}if(t.type=="contexts"){let n=this.cache.allSpaces().filter(a=>a.type!="default").map(a=>a.space),i=new Map;for(let a of n){let o=await this.cache.spaceManager.contextInitiated(a.path);await this.cache.spaceManager.readAllTables(a.path).then(s=>{i.set(a.path,{space:a,mdb:s,paths:[...this.cache.spacesMap.getInverse(a.path)],spacesMap:this.cache.spacesMap,dbExists:o})})}this.message(r,{job:t,payload:{map:i,pathsIndex:this.cache.pathsIndex,spacesMap:this.cache.spacesMap}}),this.busy[r]=!0}}message(t,r){this.workers[t].postMessage(r)}nextAvailableWorker(){let t=this.busy.indexOf(!1);return t==-1?void 0:t}};function YX(){return vO('"use strict";var jl=Object.create;var Ka=Object.defineProperty;var $l=Object.getOwnPropertyDescriptor;var Bl=Object.getOwnPropertyNames;var Gl=Object.getPrototypeOf,ql=Object.prototype.hasOwnProperty;var zl=(n,r)=>()=>(r||n((r={exports:{}}).exports,r),r.exports);var Ql=(n,r,s,o)=>{if(r&&typeof r=="object"||typeof r=="function")for(let u of Bl(r))!ql.call(n,u)&&u!==s&&Ka(n,u,{get:()=>r[u],enumerable:!(o=$l(r,u))||o.enumerable});return n};var Zl=(n,r,s)=>(s=n!=null?jl(Gl(n)):{},Ql(r||!n||!n.__esModule?Ka(s,"default",{value:n,enumerable:!0}):s,n));var Sn=zl((Lr,st)=>{(function(n,r){typeof Lr=="object"&&typeof st<"u"?st.exports=r():typeof define=="function"&&define.amd?define(r):n.moment=r()})(Lr,function(){"use strict";var n;function r(){return n.apply(null,arguments)}function s(e){n=e}function o(e){return e instanceof Array||Object.prototype.toString.call(e)==="[object Array]"}function u(e){return e!=null&&Object.prototype.toString.call(e)==="[object Object]"}function d(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function f(e){if(Object.getOwnPropertyNames)return Object.getOwnPropertyNames(e).length===0;var t;for(t in e)if(d(e,t))return!1;return!0}function m(e){return e===void 0}function p(e){return typeof e=="number"||Object.prototype.toString.call(e)==="[object Number]"}function y(e){return e instanceof Date||Object.prototype.toString.call(e)==="[object Date]"}function w(e,t){var a=[],i,l=e.length;for(i=0;i>>0,i;for(i=0;i0)for(a=0;a=0;return(c?a?"+":"":"-")+Math.pow(10,Math.max(0,l)).toString().substr(1)+i}var rr=/(\\[[^\\[]*\\])|(\\\\)?([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,Tt=/(\\[[^\\[]*\\])|(\\\\)?(LTS|LT|LL?L?L?|l{1,4})/g,ar={},Ze={};function k(e,t,a,i){var l=i;typeof i=="string"&&(l=function(){return this[i]()}),e&&(Ze[e]=l),t&&(Ze[t[0]]=function(){return ge(l.apply(this,arguments),t[1],t[2])}),a&&(Ze[a]=function(){return this.localeData().ordinal(l.apply(this,arguments),e)})}function qn(e){return e.match(/\\[[\\s\\S]/)?e.replace(/^\\[|\\]$/g,""):e.replace(/\\\\/g,"")}function zn(e){var t=e.match(rr),a,i;for(a=0,i=t.length;a=0&&Tt.test(e);)e=e.replace(Tt,i),Tt.lastIndex=0,a-=1;return e}var Qn={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 Zn(e){var t=this._longDateFormat[e],a=this._longDateFormat[e.toUpperCase()];return t||!a?t:(this._longDateFormat[e]=a.match(rr).map(function(i){return i==="MMMM"||i==="MM"||i==="DD"||i==="dddd"?i.slice(1):i}).join(""),this._longDateFormat[e])}var Jn="Invalid date";function Kn(){return this._invalidDate}var Xn="%d",ei=/\\d{1,2}/;function ti(e){return this._ordinal.replace("%d",e)}var ri={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 ai(e,t,a,i){var l=this._relativeTime[a];return Z(l)?l(e,t,a,i):l.replace(/%d/i,e)}function ni(e,t){var a=this._relativeTime[e>0?"future":"past"];return Z(a)?a(t):a.replace(/%s/i,t)}var dt={};function J(e,t){var a=e.toLowerCase();dt[a]=dt[a+"s"]=dt[t]=e}function de(e){return typeof e=="string"?dt[e]||dt[e.toLowerCase()]:void 0}function nr(e){var t={},a,i;for(i in e)d(e,i)&&(a=de(i),a&&(t[a]=e[i]));return t}var ua={};function K(e,t){ua[e]=t}function ii(e){var t=[],a;for(a in e)d(e,a)&&t.push({unit:a,priority:ua[a]});return t.sort(function(i,l){return i.priority-l.priority}),t}function Dt(e){return e%4===0&&e%100!==0||e%400===0}function ce(e){return e<0?Math.ceil(e)||0:Math.floor(e)}function O(e){var t=+e,a=0;return t!==0&&isFinite(t)&&(a=ce(t)),a}function Je(e,t){return function(a){return a!=null?(da(this,e,a),r.updateOffset(this,t),this):Ot(this,e)}}function Ot(e,t){return e.isValid()?e._d["get"+(e._isUTC?"UTC":"")+t]():NaN}function da(e,t,a){e.isValid()&&!isNaN(a)&&(t==="FullYear"&&Dt(e.year())&&e.month()===1&&e.date()===29?(a=O(a),e._d["set"+(e._isUTC?"UTC":"")+t](a,e.month(),Wt(a,e.month()))):e._d["set"+(e._isUTC?"UTC":"")+t](a))}function si(e){return e=de(e),Z(this[e])?this[e]():this}function oi(e,t){if(typeof e=="object"){e=nr(e);var a=ii(e),i,l=a.length;for(i=0;i68?1900:2e3)};var xa=Je("FullYear",!0);function Mi(){return Dt(this.year())}function Di(e,t,a,i,l,c,h){var _;return e<100&&e>=0?(_=new Date(e+400,t,a,i,l,c,h),isFinite(_.getFullYear())&&_.setFullYear(e)):_=new Date(e,t,a,i,l,c,h),_}function mt(e){var t,a;return e<100&&e>=0?(a=Array.prototype.slice.call(arguments),a[0]=e+400,t=new Date(Date.UTC.apply(null,a)),isFinite(t.getUTCFullYear())&&t.setUTCFullYear(e)):t=new Date(Date.UTC.apply(null,arguments)),t}function At(e,t,a){var i=7+t-a,l=(7+mt(e,0,i).getUTCDay()-t)%7;return-l+i-1}function va(e,t,a,i,l){var c=(7+a-i)%7,h=At(e,i,l),_=1+7*(t-1)+c+h,D,W;return _<=0?(D=e-1,W=ht(D)+_):_>ht(e)?(D=e+1,W=_-ht(e)):(D=e,W=_),{year:D,dayOfYear:W}}function pt(e,t,a){var i=At(e.year(),t,a),l=Math.floor((e.dayOfYear()-i-1)/7)+1,c,h;return l<1?(h=e.year()-1,c=l+ke(h,t,a)):l>ke(e.year(),t,a)?(c=l-ke(e.year(),t,a),h=e.year()+1):(h=e.year(),c=l),{week:c,year:h}}function ke(e,t,a){var i=At(e,t,a),l=At(e+1,t,a);return(ht(e)-i+l)/7}k("w",["ww",2],"wo","week"),k("W",["WW",2],"Wo","isoWeek"),J("week","w"),J("isoWeek","W"),K("week",5),K("isoWeek",5),v("w",L),v("ww",L,se),v("W",L),v("WW",L,se),ft(["w","ww","W","WW"],function(e,t,a,i){t[i.substr(0,1)]=O(e)});function Oi(e){return pt(e,this._week.dow,this._week.doy).week}var Fi={dow:0,doy:6};function Ci(){return this._week.dow}function Pi(){return this._week.doy}function Ni(e){var t=this.localeData().week(this);return e==null?t:this.add((e-t)*7,"d")}function Yi(e){var t=pt(this,1,4).week;return e==null?t:this.add((e-t)*7,"d")}k("d",0,"do","day"),k("dd",0,0,function(e){return this.localeData().weekdaysMin(this,e)}),k("ddd",0,0,function(e){return this.localeData().weekdaysShort(this,e)}),k("dddd",0,0,function(e){return this.localeData().weekdays(this,e)}),k("e",0,0,"weekday"),k("E",0,0,"isoWeekday"),J("day","d"),J("weekday","e"),J("isoWeekday","E"),K("day",11),K("weekday",11),K("isoWeekday",11),v("d",L),v("e",L),v("E",L),v("dd",function(e,t){return t.weekdaysMinRegex(e)}),v("ddd",function(e,t){return t.weekdaysShortRegex(e)}),v("dddd",function(e,t){return t.weekdaysRegex(e)}),ft(["dd","ddd","dddd"],function(e,t,a,i){var l=a._locale.weekdaysParse(e,i,a._strict);l!=null?t.d=l:S(a).invalidWeekday=e}),ft(["d","e","E"],function(e,t,a,i){t[i]=O(e)});function Ii(e,t){return typeof e!="string"?e:isNaN(e)?(e=t.weekdaysParse(e),typeof e=="number"?e:null):parseInt(e,10)}function Wi(e,t){return typeof e=="string"?t.weekdaysParse(e)%7||7:isNaN(e)?null:e}function lr(e,t){return e.slice(t,7).concat(e.slice(0,t))}var Ai="Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),ba="Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_"),Li="Su_Mo_Tu_We_Th_Fr_Sa".split("_"),Ei=ct,Ri=ct,Ui=ct;function Hi(e,t){var a=o(this._weekdays)?this._weekdays:this._weekdays[e&&e!==!0&&this._weekdays.isFormat.test(t)?"format":"standalone"];return e===!0?lr(a,this._week.dow):e?a[e.day()]:a}function Vi(e){return e===!0?lr(this._weekdaysShort,this._week.dow):e?this._weekdaysShort[e.day()]:this._weekdaysShort}function ji(e){return e===!0?lr(this._weekdaysMin,this._week.dow):e?this._weekdaysMin[e.day()]:this._weekdaysMin}function $i(e,t,a){var i,l,c,h=e.toLocaleLowerCase();if(!this._weekdaysParse)for(this._weekdaysParse=[],this._shortWeekdaysParse=[],this._minWeekdaysParse=[],i=0;i<7;++i)c=b([2e3,1]).day(i),this._minWeekdaysParse[i]=this.weekdaysMin(c,"").toLocaleLowerCase(),this._shortWeekdaysParse[i]=this.weekdaysShort(c,"").toLocaleLowerCase(),this._weekdaysParse[i]=this.weekdays(c,"").toLocaleLowerCase();return a?t==="dddd"?(l=$.call(this._weekdaysParse,h),l!==-1?l:null):t==="ddd"?(l=$.call(this._shortWeekdaysParse,h),l!==-1?l:null):(l=$.call(this._minWeekdaysParse,h),l!==-1?l:null):t==="dddd"?(l=$.call(this._weekdaysParse,h),l!==-1||(l=$.call(this._shortWeekdaysParse,h),l!==-1)?l:(l=$.call(this._minWeekdaysParse,h),l!==-1?l:null)):t==="ddd"?(l=$.call(this._shortWeekdaysParse,h),l!==-1||(l=$.call(this._weekdaysParse,h),l!==-1)?l:(l=$.call(this._minWeekdaysParse,h),l!==-1?l:null)):(l=$.call(this._minWeekdaysParse,h),l!==-1||(l=$.call(this._weekdaysParse,h),l!==-1)?l:(l=$.call(this._shortWeekdaysParse,h),l!==-1?l:null))}function Bi(e,t,a){var i,l,c;if(this._weekdaysParseExact)return $i.call(this,e,t,a);for(this._weekdaysParse||(this._weekdaysParse=[],this._minWeekdaysParse=[],this._shortWeekdaysParse=[],this._fullWeekdaysParse=[]),i=0;i<7;i++){if(l=b([2e3,1]).day(i),a&&!this._fullWeekdaysParse[i]&&(this._fullWeekdaysParse[i]=new RegExp("^"+this.weekdays(l,"").replace(".","\\\\.?")+"$","i"),this._shortWeekdaysParse[i]=new RegExp("^"+this.weekdaysShort(l,"").replace(".","\\\\.?")+"$","i"),this._minWeekdaysParse[i]=new RegExp("^"+this.weekdaysMin(l,"").replace(".","\\\\.?")+"$","i")),this._weekdaysParse[i]||(c="^"+this.weekdays(l,"")+"|^"+this.weekdaysShort(l,"")+"|^"+this.weekdaysMin(l,""),this._weekdaysParse[i]=new RegExp(c.replace(".",""),"i")),a&&t==="dddd"&&this._fullWeekdaysParse[i].test(e))return i;if(a&&t==="ddd"&&this._shortWeekdaysParse[i].test(e))return i;if(a&&t==="dd"&&this._minWeekdaysParse[i].test(e))return i;if(!a&&this._weekdaysParse[i].test(e))return i}}function Gi(e){if(!this.isValid())return e!=null?this:NaN;var t=this._isUTC?this._d.getUTCDay():this._d.getDay();return e!=null?(e=Ii(e,this.localeData()),this.add(e-t,"d")):t}function qi(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 zi(e){if(!this.isValid())return e!=null?this:NaN;if(e!=null){var t=Wi(e,this.localeData());return this.day(this.day()%7?t:t-7)}else return this.day()||7}function Qi(e){return this._weekdaysParseExact?(d(this,"_weekdaysRegex")||ur.call(this),e?this._weekdaysStrictRegex:this._weekdaysRegex):(d(this,"_weekdaysRegex")||(this._weekdaysRegex=Ei),this._weekdaysStrictRegex&&e?this._weekdaysStrictRegex:this._weekdaysRegex)}function Zi(e){return this._weekdaysParseExact?(d(this,"_weekdaysRegex")||ur.call(this),e?this._weekdaysShortStrictRegex:this._weekdaysShortRegex):(d(this,"_weekdaysShortRegex")||(this._weekdaysShortRegex=Ri),this._weekdaysShortStrictRegex&&e?this._weekdaysShortStrictRegex:this._weekdaysShortRegex)}function Ji(e){return this._weekdaysParseExact?(d(this,"_weekdaysRegex")||ur.call(this),e?this._weekdaysMinStrictRegex:this._weekdaysMinRegex):(d(this,"_weekdaysMinRegex")||(this._weekdaysMinRegex=Ui),this._weekdaysMinStrictRegex&&e?this._weekdaysMinStrictRegex:this._weekdaysMinRegex)}function ur(){function e(re,Oe){return Oe.length-re.length}var t=[],a=[],i=[],l=[],c,h,_,D,W;for(c=0;c<7;c++)h=b([2e3,1]).day(c),_=oe(this.weekdaysMin(h,"")),D=oe(this.weekdaysShort(h,"")),W=oe(this.weekdays(h,"")),t.push(_),a.push(D),i.push(W),l.push(_),l.push(D),l.push(W);t.sort(e),a.sort(e),i.sort(e),l.sort(e),this._weekdaysRegex=new RegExp("^("+l.join("|")+")","i"),this._weekdaysShortRegex=this._weekdaysRegex,this._weekdaysMinRegex=this._weekdaysRegex,this._weekdaysStrictRegex=new RegExp("^("+i.join("|")+")","i"),this._weekdaysShortStrictRegex=new RegExp("^("+a.join("|")+")","i"),this._weekdaysMinStrictRegex=new RegExp("^("+t.join("|")+")","i")}function dr(){return this.hours()%12||12}function Ki(){return this.hours()||24}k("H",["HH",2],0,"hour"),k("h",["hh",2],0,dr),k("k",["kk",2],0,Ki),k("hmm",0,0,function(){return""+dr.apply(this)+ge(this.minutes(),2)}),k("hmmss",0,0,function(){return""+dr.apply(this)+ge(this.minutes(),2)+ge(this.seconds(),2)}),k("Hmm",0,0,function(){return""+this.hours()+ge(this.minutes(),2)}),k("Hmmss",0,0,function(){return""+this.hours()+ge(this.minutes(),2)+ge(this.seconds(),2)});function ka(e,t){k(e,0,0,function(){return this.localeData().meridiem(this.hours(),this.minutes(),t)})}ka("a",!0),ka("A",!1),J("hour","h"),K("hour",13);function _a(e,t){return t._meridiemParse}v("a",_a),v("A",_a),v("H",L),v("h",L),v("k",L),v("HH",L,se),v("hh",L,se),v("kk",L,se),v("hmm",ha),v("hmmss",ma),v("Hmm",ha),v("Hmmss",ma),I(["H","HH"],z),I(["k","kk"],function(e,t,a){var i=O(e);t[z]=i===24?0:i}),I(["a","A"],function(e,t,a){a._isPm=a._locale.isPM(e),a._meridiem=e}),I(["h","hh"],function(e,t,a){t[z]=O(e),S(a).bigHour=!0}),I("hmm",function(e,t,a){var i=e.length-2;t[z]=O(e.substr(0,i)),t[fe]=O(e.substr(i)),S(a).bigHour=!0}),I("hmmss",function(e,t,a){var i=e.length-4,l=e.length-2;t[z]=O(e.substr(0,i)),t[fe]=O(e.substr(i,2)),t[be]=O(e.substr(l)),S(a).bigHour=!0}),I("Hmm",function(e,t,a){var i=e.length-2;t[z]=O(e.substr(0,i)),t[fe]=O(e.substr(i))}),I("Hmmss",function(e,t,a){var i=e.length-4,l=e.length-2;t[z]=O(e.substr(0,i)),t[fe]=O(e.substr(i,2)),t[be]=O(e.substr(l))});function Xi(e){return(e+"").toLowerCase().charAt(0)==="p"}var es=/[ap]\\.?m?\\.?/i,ts=Je("Hours",!0);function rs(e,t,a){return e>11?a?"pm":"PM":a?"am":"AM"}var Ta={calendar:ie,longDateFormat:Qn,invalidDate:Jn,ordinal:Xn,dayOfMonthOrdinalParse:ei,relativeTime:ri,months:gi,monthsShort:pa,week:Fi,weekdays:Ai,weekdaysMin:Li,weekdaysShort:ba,meridiemParse:es},R={},gt={},yt;function as(e,t){var a,i=Math.min(e.length,t.length);for(a=0;a0;){if(l=Lt(c.slice(0,a).join("-")),l)return l;if(i&&i.length>=a&&as(c,i)>=a-1)break;a--}t++}return yt}function is(e){return e.match("^[^/\\\\\\\\]*$")!=null}function Lt(e){var t=null,a;if(R[e]===void 0&&typeof st<"u"&&st&&st.exports&&is(e))try{t=yt._abbr,a=require,a("./locale/"+e),Ne(t)}catch{R[e]=null}return R[e]}function Ne(e,t){var a;return e&&(m(t)?a=_e(e):a=cr(e,t),a?yt=a:typeof console<"u"&&console.warn&&console.warn("Locale "+e+" not found. Did you forget to load it?")),yt._abbr}function cr(e,t){if(t!==null){var a,i=Ta;if(t.abbr=e,R[e]!=null)me("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."),i=R[e]._config;else if(t.parentLocale!=null)if(R[t.parentLocale]!=null)i=R[t.parentLocale]._config;else if(a=Lt(t.parentLocale),a!=null)i=a._config;else return gt[t.parentLocale]||(gt[t.parentLocale]=[]),gt[t.parentLocale].push({name:e,config:t}),null;return R[e]=new Q(ze(i,t)),gt[e]&>[e].forEach(function(l){cr(l.name,l.config)}),Ne(e),R[e]}else return delete R[e],null}function ss(e,t){if(t!=null){var a,i,l=Ta;R[e]!=null&&R[e].parentLocale!=null?R[e].set(ze(R[e]._config,t)):(i=Lt(e),i!=null&&(l=i._config),t=ze(l,t),i==null&&(t.abbr=e),a=new Q(t),a.parentLocale=R[e],R[e]=a),Ne(e)}else R[e]!=null&&(R[e].parentLocale!=null?(R[e]=R[e].parentLocale,e===Ne()&&Ne(e)):R[e]!=null&&delete R[e]);return R[e]}function _e(e){var t;if(e&&e._locale&&e._locale._abbr&&(e=e._locale._abbr),!e)return yt;if(!o(e)){if(t=Lt(e),t)return t;e=[e]}return ns(e)}function os(){return H(R)}function fr(e){var t,a=e._a;return a&&S(e).overflow===-2&&(t=a[ve]<0||a[ve]>11?ve:a[ye]<1||a[ye]>Wt(a[X],a[ve])?ye:a[z]<0||a[z]>24||a[z]===24&&(a[fe]!==0||a[be]!==0||a[Re]!==0)?z:a[fe]<0||a[fe]>59?fe:a[be]<0||a[be]>59?be:a[Re]<0||a[Re]>999?Re:-1,S(e)._overflowDayOfYear&&(tye)&&(t=ye),S(e)._overflowWeeks&&t===-1&&(t=hi),S(e)._overflowWeekday&&t===-1&&(t=mi),S(e).overflow=t),e}var ls=/^\\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)?)?$/,us=/^\\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)?)?$/,ds=/Z|[+-]\\d\\d(?::?\\d\\d)?/,Et=[["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]],hr=[["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/]],cs=/^\\/?Date\\((-?\\d+)/i,fs=/^(?:(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}))$/,hs={UT:0,GMT:0,EDT:-4*60,EST:-5*60,CDT:-5*60,CST:-6*60,MDT:-6*60,MST:-7*60,PDT:-7*60,PST:-8*60};function Da(e){var t,a,i=e._i,l=ls.exec(i)||us.exec(i),c,h,_,D,W=Et.length,re=hr.length;if(l){for(S(e).iso=!0,t=0,a=W;tht(h)||e._dayOfYear===0)&&(S(e)._overflowDayOfYear=!0),a=mt(h,0,e._dayOfYear),e._a[ve]=a.getUTCMonth(),e._a[ye]=a.getUTCDate()),t=0;t<3&&e._a[t]==null;++t)e._a[t]=i[t]=l[t];for(;t<7;t++)e._a[t]=i[t]=e._a[t]==null?t===2?1:0:e._a[t];e._a[z]===24&&e._a[fe]===0&&e._a[be]===0&&e._a[Re]===0&&(e._nextDay=!0,e._a[z]=0),e._d=(e._useUTC?mt:Di).apply(null,i),c=e._useUTC?e._d.getUTCDay():e._d.getDay(),e._tzm!=null&&e._d.setUTCMinutes(e._d.getUTCMinutes()-e._tzm),e._nextDay&&(e._a[z]=24),e._w&&typeof e._w.d<"u"&&e._w.d!==c&&(S(e).weekdayMismatch=!0)}}function vs(e){var t,a,i,l,c,h,_,D,W;t=e._w,t.GG!=null||t.W!=null||t.E!=null?(c=1,h=4,a=Xe(t.GG,e._a[X],pt(E(),1,4).year),i=Xe(t.W,1),l=Xe(t.E,1),(l<1||l>7)&&(D=!0)):(c=e._locale._week.dow,h=e._locale._week.doy,W=pt(E(),c,h),a=Xe(t.gg,e._a[X],W.year),i=Xe(t.w,W.week),t.d!=null?(l=t.d,(l<0||l>6)&&(D=!0)):t.e!=null?(l=t.e+c,(t.e<0||t.e>6)&&(D=!0)):l=c),i<1||i>ke(a,c,h)?S(e)._overflowWeeks=!0:D!=null?S(e)._overflowWeekday=!0:(_=va(a,i,l,c,h),e._a[X]=_.year,e._dayOfYear=_.dayOfYear)}r.ISO_8601=function(){},r.RFC_2822=function(){};function pr(e){if(e._f===r.ISO_8601){Da(e);return}if(e._f===r.RFC_2822){Oa(e);return}e._a=[],S(e).empty=!0;var t=""+e._i,a,i,l,c,h,_=t.length,D=0,W,re;for(l=la(e._f,e._locale).match(rr)||[],re=l.length,a=0;a0&&S(e).unusedInput.push(h),t=t.slice(t.indexOf(i)+i.length),D+=i.length),Ze[c]?(i?S(e).empty=!1:S(e).unusedTokens.push(c),fi(c,i,e)):e._strict&&!i&&S(e).unusedTokens.push(c);S(e).charsLeftOver=_-D,t.length>0&&S(e).unusedInput.push(t),e._a[z]<=12&&S(e).bigHour===!0&&e._a[z]>0&&(S(e).bigHour=void 0),S(e).parsedDateParts=e._a.slice(0),S(e).meridiem=e._meridiem,e._a[z]=bs(e._locale,e._a[z],e._meridiem),W=S(e).era,W!==null&&(e._a[X]=e._locale.erasConvertYear(W,e._a[X])),mr(e),fr(e)}function bs(e,t,a){var i;return a==null?t:e.meridiemHour!=null?e.meridiemHour(t,a):(e.isPM!=null&&(i=e.isPM(a),i&&t<12&&(t+=12),!i&&t===12&&(t=0)),t)}function ks(e){var t,a,i,l,c,h,_=!1,D=e._f.length;if(D===0){S(e).invalidFormat=!0,e._d=new Date(NaN);return}for(l=0;lthis?this:e:G()});function Pa(e,t){var a,i;if(t.length===1&&o(t[0])&&(t=t[0]),!t.length)return E();for(a=t[0],i=1;ithis.clone().month(0).utcOffset()||this.utcOffset()>this.clone().month(5).utcOffset()}function $s(){if(!m(this._isDSTShifted))return this._isDSTShifted;var e={},t;return ue(e,this),e=Fa(e),e._a?(t=e._isUTC?b(e._a):E(e._a),this._isDSTShifted=this.isValid()&&Ws(e._a,t.toArray())>0):this._isDSTShifted=!1,this._isDSTShifted}function Bs(){return this.isValid()?!this._isUTC:!1}function Gs(){return this.isValid()?this._isUTC:!1}function Ya(){return this.isValid()?this._isUTC&&this._offset===0:!1}var qs=/^(-|\\+)?(?:(\\d*)[. ])?(\\d+):(\\d+)(?::(\\d+)(\\.\\d*)?)?$/,zs=/^(-|\\+)?P(?:([-+]?[0-9,.]*)Y)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)W)?(?:([-+]?[0-9,.]*)D)?(?:T(?:([-+]?[0-9,.]*)H)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)S)?)?$/;function he(e,t){var a=e,i=null,l,c,h;return Ut(e)?a={ms:e._milliseconds,d:e._days,M:e._months}:p(e)||!isNaN(+e)?(a={},t?a[t]=+e:a.milliseconds=+e):(i=qs.exec(e))?(l=i[1]==="-"?-1:1,a={y:0,d:O(i[ye])*l,h:O(i[z])*l,m:O(i[fe])*l,s:O(i[be])*l,ms:O(gr(i[Re]*1e3))*l}):(i=zs.exec(e))?(l=i[1]==="-"?-1:1,a={y:Ue(i[2],l),M:Ue(i[3],l),w:Ue(i[4],l),d:Ue(i[5],l),h:Ue(i[6],l),m:Ue(i[7],l),s:Ue(i[8],l)}):a==null?a={}:typeof a=="object"&&("from"in a||"to"in a)&&(h=Qs(E(a.from),E(a.to)),a={},a.ms=h.milliseconds,a.M=h.months),c=new Rt(a),Ut(e)&&d(e,"_locale")&&(c._locale=e._locale),Ut(e)&&d(e,"_isValid")&&(c._isValid=e._isValid),c}he.fn=Rt.prototype,he.invalid=Is;function Ue(e,t){var a=e&&parseFloat(e.replace(",","."));return(isNaN(a)?0:a)*t}function Ia(e,t){var a={};return a.months=t.month()-e.month()+(t.year()-e.year())*12,e.clone().add(a.months,"M").isAfter(t)&&--a.months,a.milliseconds=+t-+e.clone().add(a.months,"M"),a}function Qs(e,t){var a;return e.isValid()&&t.isValid()?(t=Sr(t,e),e.isBefore(t)?a=Ia(e,t):(a=Ia(t,e),a.milliseconds=-a.milliseconds,a.months=-a.months),a):{milliseconds:0,months:0}}function Wa(e,t){return function(a,i){var l,c;return i!==null&&!isNaN(+i)&&(me(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."),c=a,a=i,i=c),l=he(a,i),Aa(this,l,e),this}}function Aa(e,t,a,i){var l=t._milliseconds,c=gr(t._days),h=gr(t._months);!e.isValid()||(i=i??!0,h&&ya(e,Ot(e,"Month")+h*a),c&&da(e,"Date",Ot(e,"Date")+c*a),l&&e._d.setTime(e._d.valueOf()+l*a),i&&r.updateOffset(e,c||h))}var Zs=Wa(1,"add"),Js=Wa(-1,"subtract");function La(e){return typeof e=="string"||e instanceof String}function Ks(e){return V(e)||y(e)||La(e)||p(e)||eo(e)||Xs(e)||e===null||e===void 0}function Xs(e){var t=u(e)&&!f(e),a=!1,i=["years","year","y","months","month","M","days","day","d","dates","date","D","hours","hour","h","minutes","minute","m","seconds","second","s","milliseconds","millisecond","ms"],l,c,h=i.length;for(l=0;la.valueOf():a.valueOf()9999?Mt(a,t?"YYYYYY-MM-DD[T]HH:mm:ss.SSS[Z]":"YYYYYY-MM-DD[T]HH:mm:ss.SSSZ"):Z(Date.prototype.toISOString)?t?this.toDate().toISOString():new Date(this.valueOf()+this.utcOffset()*60*1e3).toISOString().replace("Z",Mt(a,"Z")):Mt(a,t?"YYYY-MM-DD[T]HH:mm:ss.SSS[Z]":"YYYY-MM-DD[T]HH:mm:ss.SSSZ")}function po(){if(!this.isValid())return"moment.invalid(/* "+this._i+" */)";var e="moment",t="",a,i,l,c;return this.isLocal()||(e=this.utcOffset()===0?"moment.utc":"moment.parseZone",t="Z"),a="["+e+\'("]\',i=0<=this.year()&&this.year()<=9999?"YYYY":"YYYYYY",l="-MM-DD[T]HH:mm:ss.SSS",c=t+\'[")]\',this.format(a+i+l+c)}function go(e){e||(e=this.isUtc()?r.defaultFormatUtc:r.defaultFormat);var t=Mt(this,e);return this.localeData().postformat(t)}function yo(e,t){return this.isValid()&&(V(e)&&e.isValid()||E(e).isValid())?he({to:this,from:e}).locale(this.locale()).humanize(!t):this.localeData().invalidDate()}function So(e){return this.from(E(),e)}function wo(e,t){return this.isValid()&&(V(e)&&e.isValid()||E(e).isValid())?he({from:this,to:e}).locale(this.locale()).humanize(!t):this.localeData().invalidDate()}function xo(e){return this.to(E(),e)}function Ea(e){var t;return e===void 0?this._locale._abbr:(t=_e(e),t!=null&&(this._locale=t),this)}var Ra=A("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 Vt=1e3,et=60*Vt,jt=60*et,Ha=(365*400+97)*24*jt;function tt(e,t){return(e%t+t)%t}function Va(e,t,a){return e<100&&e>=0?new Date(e+400,t,a)-Ha:new Date(e,t,a).valueOf()}function ja(e,t,a){return e<100&&e>=0?Date.UTC(e+400,t,a)-Ha:Date.UTC(e,t,a)}function vo(e){var t,a;if(e=de(e),e===void 0||e==="millisecond"||!this.isValid())return this;switch(a=this._isUTC?ja:Va,e){case"year":t=a(this.year(),0,1);break;case"quarter":t=a(this.year(),this.month()-this.month()%3,1);break;case"month":t=a(this.year(),this.month(),1);break;case"week":t=a(this.year(),this.month(),this.date()-this.weekday());break;case"isoWeek":t=a(this.year(),this.month(),this.date()-(this.isoWeekday()-1));break;case"day":case"date":t=a(this.year(),this.month(),this.date());break;case"hour":t=this._d.valueOf(),t-=tt(t+(this._isUTC?0:this.utcOffset()*et),jt);break;case"minute":t=this._d.valueOf(),t-=tt(t,et);break;case"second":t=this._d.valueOf(),t-=tt(t,Vt);break}return this._d.setTime(t),r.updateOffset(this,!0),this}function bo(e){var t,a;if(e=de(e),e===void 0||e==="millisecond"||!this.isValid())return this;switch(a=this._isUTC?ja:Va,e){case"year":t=a(this.year()+1,0,1)-1;break;case"quarter":t=a(this.year(),this.month()-this.month()%3+3,1)-1;break;case"month":t=a(this.year(),this.month()+1,1)-1;break;case"week":t=a(this.year(),this.month(),this.date()-this.weekday()+7)-1;break;case"isoWeek":t=a(this.year(),this.month(),this.date()-(this.isoWeekday()-1)+7)-1;break;case"day":case"date":t=a(this.year(),this.month(),this.date()+1)-1;break;case"hour":t=this._d.valueOf(),t+=jt-tt(t+(this._isUTC?0:this.utcOffset()*et),jt)-1;break;case"minute":t=this._d.valueOf(),t+=et-tt(t,et)-1;break;case"second":t=this._d.valueOf(),t+=Vt-tt(t,Vt)-1;break}return this._d.setTime(t),r.updateOffset(this,!0),this}function ko(){return this._d.valueOf()-(this._offset||0)*6e4}function _o(){return Math.floor(this.valueOf()/1e3)}function To(){return new Date(this.valueOf())}function Mo(){var e=this;return[e.year(),e.month(),e.date(),e.hour(),e.minute(),e.second(),e.millisecond()]}function Do(){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 Oo(){return this.isValid()?this.toISOString():null}function Fo(){return q(this)}function Co(){return x({},S(this))}function Po(){return S(this).overflow}function No(){return{input:this._i,format:this._f,locale:this._locale,isUTC:this._isUTC,strict:this._strict}}k("N",0,0,"eraAbbr"),k("NN",0,0,"eraAbbr"),k("NNN",0,0,"eraAbbr"),k("NNNN",0,0,"eraName"),k("NNNNN",0,0,"eraNarrow"),k("y",["y",1],"yo","eraYear"),k("y",["yy",2],0,"eraYear"),k("y",["yyy",3],0,"eraYear"),k("y",["yyyy",4],0,"eraYear"),v("N",xr),v("NN",xr),v("NNN",xr),v("NNNN",jo),v("NNNNN",$o),I(["N","NN","NNN","NNNN","NNNNN"],function(e,t,a,i){var l=a._locale.erasParse(e,i,a._strict);l?S(a).era=l:S(a).invalidEra=e}),v("y",Ke),v("yy",Ke),v("yyy",Ke),v("yyyy",Ke),v("yo",Bo),I(["y","yy","yyy","yyyy"],X),I(["yo"],function(e,t,a,i){var l;a._locale._eraYearOrdinalRegex&&(l=e.match(a._locale._eraYearOrdinalRegex)),a._locale.eraYearOrdinalParse?t[X]=a._locale.eraYearOrdinalParse(e,l):t[X]=parseInt(e,10)});function Yo(e,t){var a,i,l,c=this._eras||_e("en")._eras;for(a=0,i=c.length;a=0)return c[i]}function Wo(e,t){var a=e.since<=e.until?1:-1;return t===void 0?r(e.since).year():r(e.since).year()+(t-e.offset)*a}function Ao(){var e,t,a,i=this.localeData().eras();for(e=0,t=i.length;ec&&(t=c),Ko.call(this,e,t,a,i,l))}function Ko(e,t,a,i,l){var c=va(e,t,a,i,l),h=mt(c.year,0,c.dayOfYear);return this.year(h.getUTCFullYear()),this.month(h.getUTCMonth()),this.date(h.getUTCDate()),this}k("Q",0,"Qo","quarter"),J("quarter","Q"),K("quarter",7),v("Q",ca),I("Q",function(e,t){t[ve]=(O(e)-1)*3});function Xo(e){return e==null?Math.ceil((this.month()+1)/3):this.month((e-1)*3+this.month()%3)}k("D",["DD",2],"Do","date"),J("date","D"),K("date",9),v("D",L),v("DD",L,se),v("Do",function(e,t){return e?t._dayOfMonthOrdinalParse||t._ordinalParse:t._dayOfMonthOrdinalParseLenient}),I(["D","DD"],ye),I("Do",function(e,t){t[ye]=O(e.match(L)[0])});var Ba=Je("Date",!0);k("DDD",["DDDD",3],"DDDo","dayOfYear"),J("dayOfYear","DDD"),K("dayOfYear",4),v("DDD",Ct),v("DDDD",fa),I(["DDD","DDDD"],function(e,t,a){a._dayOfYear=O(e)});function el(e){var t=Math.round((this.clone().startOf("day")-this.clone().startOf("year"))/864e5)+1;return e==null?t:this.add(e-t,"d")}k("m",["mm",2],0,"minute"),J("minute","m"),K("minute",14),v("m",L),v("mm",L,se),I(["m","mm"],fe);var tl=Je("Minutes",!1);k("s",["ss",2],0,"second"),J("second","s"),K("second",15),v("s",L),v("ss",L,se),I(["s","ss"],be);var rl=Je("Seconds",!1);k("S",0,0,function(){return~~(this.millisecond()/100)}),k(0,["SS",2],0,function(){return~~(this.millisecond()/10)}),k(0,["SSS",3],0,"millisecond"),k(0,["SSSS",4],0,function(){return this.millisecond()*10}),k(0,["SSSSS",5],0,function(){return this.millisecond()*100}),k(0,["SSSSSS",6],0,function(){return this.millisecond()*1e3}),k(0,["SSSSSSS",7],0,function(){return this.millisecond()*1e4}),k(0,["SSSSSSSS",8],0,function(){return this.millisecond()*1e5}),k(0,["SSSSSSSSS",9],0,function(){return this.millisecond()*1e6}),J("millisecond","ms"),K("millisecond",16),v("S",Ct,ca),v("SS",Ct,se),v("SSS",Ct,fa);var Ye,Ga;for(Ye="SSSS";Ye.length<=9;Ye+="S")v(Ye,Ke);function al(e,t){t[Re]=O(("0."+e)*1e3)}for(Ye="S";Ye.length<=9;Ye+="S")I(Ye,al);Ga=Je("Milliseconds",!1),k("z",0,0,"zoneAbbr"),k("zz",0,0,"zoneName");function nl(){return this._isUTC?"UTC":""}function il(){return this._isUTC?"Coordinated Universal Time":""}var g=xe.prototype;g.add=Zs,g.calendar=ao,g.clone=no,g.diff=fo,g.endOf=bo,g.format=go,g.from=yo,g.fromNow=So,g.to=wo,g.toNow=xo,g.get=si,g.invalidAt=Po,g.isAfter=io,g.isBefore=so,g.isBetween=oo,g.isSame=lo,g.isSameOrAfter=uo,g.isSameOrBefore=co,g.isValid=Fo,g.lang=Ra,g.locale=Ea,g.localeData=Ua,g.max=Os,g.min=Ds,g.parsingFlags=Co,g.set=oi,g.startOf=vo,g.subtract=Js,g.toArray=Mo,g.toObject=Do,g.toDate=To,g.toISOString=mo,g.inspect=po,typeof Symbol<"u"&&Symbol.for!=null&&(g[Symbol.for("nodejs.util.inspect.custom")]=function(){return"Moment<"+this.format()+">"}),g.toJSON=Oo,g.toString=ho,g.unix=_o,g.valueOf=ko,g.creationData=No,g.eraName=Ao,g.eraNarrow=Lo,g.eraAbbr=Eo,g.eraYear=Ro,g.year=xa,g.isLeapYear=Mi,g.weekYear=Go,g.isoWeekYear=qo,g.quarter=g.quarters=Xo,g.month=Sa,g.daysInMonth=ki,g.week=g.weeks=Ni,g.isoWeek=g.isoWeeks=Yi,g.weeksInYear=Zo,g.weeksInWeekYear=Jo,g.isoWeeksInYear=zo,g.isoWeeksInISOWeekYear=Qo,g.date=Ba,g.day=g.days=Gi,g.weekday=qi,g.isoWeekday=zi,g.dayOfYear=el,g.hour=g.hours=ts,g.minute=g.minutes=tl,g.second=g.seconds=rl,g.millisecond=g.milliseconds=Ga,g.utcOffset=Ls,g.utc=Rs,g.local=Us,g.parseZone=Hs,g.hasAlignedHourOffset=Vs,g.isDST=js,g.isLocal=Bs,g.isUtcOffset=Gs,g.isUtc=Ya,g.isUTC=Ya,g.zoneAbbr=nl,g.zoneName=il,g.dates=A("dates accessor is deprecated. Use date instead.",Ba),g.months=A("months accessor is deprecated. Use month instead",Sa),g.years=A("years accessor is deprecated. Use year instead",xa),g.zone=A("moment().zone is deprecated, use moment().utcOffset instead. http://momentjs.com/guides/#/warnings/zone/",Es),g.isDSTShifted=A("isDSTShifted is deprecated. See http://momentjs.com/guides/#/warnings/dst-shifted/ for more information",$s);function sl(e){return E(e*1e3)}function ol(){return E.apply(null,arguments).parseZone()}function qa(e){return e}var P=Q.prototype;P.calendar=Qe,P.longDateFormat=Zn,P.invalidDate=Kn,P.ordinal=ti,P.preparse=qa,P.postformat=qa,P.relativeTime=ai,P.pastFuture=ni,P.set=pe,P.eras=Yo,P.erasParse=Io,P.erasConvertYear=Wo,P.erasAbbrRegex=Ho,P.erasNameRegex=Uo,P.erasNarrowRegex=Vo,P.months=wi,P.monthsShort=xi,P.monthsParse=bi,P.monthsRegex=Ti,P.monthsShortRegex=_i,P.week=Oi,P.firstDayOfYear=Pi,P.firstDayOfWeek=Ci,P.weekdays=Hi,P.weekdaysMin=ji,P.weekdaysShort=Vi,P.weekdaysParse=Bi,P.weekdaysRegex=Qi,P.weekdaysShortRegex=Zi,P.weekdaysMinRegex=Ji,P.isPM=Xi,P.meridiem=rs;function Bt(e,t,a,i){var l=_e(),c=b().set(i,t);return l[a](c,e)}function za(e,t,a){if(p(e)&&(t=e,e=void 0),e=e||"",t!=null)return Bt(e,t,a,"month");var i,l=[];for(i=0;i<12;i++)l[i]=Bt(e,i,a,"month");return l}function br(e,t,a,i){typeof e=="boolean"?(p(t)&&(a=t,t=void 0),t=t||""):(t=e,a=t,e=!1,p(t)&&(a=t,t=void 0),t=t||"");var l=_e(),c=e?l._week.dow:0,h,_=[];if(a!=null)return Bt(t,(a+c)%7,i,"day");for(h=0;h<7;h++)_[h]=Bt(t,(h+c)%7,i,"day");return _}function ll(e,t){return za(e,t,"months")}function ul(e,t){return za(e,t,"monthsShort")}function dl(e,t,a){return br(e,t,a,"weekdays")}function cl(e,t,a){return br(e,t,a,"weekdaysShort")}function fl(e,t,a){return br(e,t,a,"weekdaysMin")}Ne("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,a=O(e%100/10)===1?"th":t===1?"st":t===2?"nd":t===3?"rd":"th";return e+a}}),r.lang=A("moment.lang is deprecated. Use moment.locale instead.",Ne),r.langData=A("moment.langData is deprecated. Use moment.localeData instead.",_e);var Te=Math.abs;function hl(){var e=this._data;return this._milliseconds=Te(this._milliseconds),this._days=Te(this._days),this._months=Te(this._months),e.milliseconds=Te(e.milliseconds),e.seconds=Te(e.seconds),e.minutes=Te(e.minutes),e.hours=Te(e.hours),e.months=Te(e.months),e.years=Te(e.years),this}function Qa(e,t,a,i){var l=he(t,a);return e._milliseconds+=i*l._milliseconds,e._days+=i*l._days,e._months+=i*l._months,e._bubble()}function ml(e,t){return Qa(this,e,t,1)}function pl(e,t){return Qa(this,e,t,-1)}function Za(e){return e<0?Math.floor(e):Math.ceil(e)}function gl(){var e=this._milliseconds,t=this._days,a=this._months,i=this._data,l,c,h,_,D;return e>=0&&t>=0&&a>=0||e<=0&&t<=0&&a<=0||(e+=Za(kr(a)+t)*864e5,t=0,a=0),i.milliseconds=e%1e3,l=ce(e/1e3),i.seconds=l%60,c=ce(l/60),i.minutes=c%60,h=ce(c/60),i.hours=h%24,t+=ce(h/24),D=ce(Ja(t)),a+=D,t-=Za(kr(D)),_=ce(a/12),a%=12,i.days=t,i.months=a,i.years=_,this}function Ja(e){return e*4800/146097}function kr(e){return e*146097/4800}function yl(e){if(!this.isValid())return NaN;var t,a,i=this._milliseconds;if(e=de(e),e==="month"||e==="quarter"||e==="year")switch(t=this._days+i/864e5,a=this._months+Ja(t),e){case"month":return a;case"quarter":return a/3;case"year":return a/12}else switch(t=this._days+Math.round(kr(this._months)),e){case"week":return t/7+i/6048e5;case"day":return t+i/864e5;case"hour":return t*24+i/36e5;case"minute":return t*1440+i/6e4;case"second":return t*86400+i/1e3;case"millisecond":return Math.floor(t*864e5)+i;default:throw new Error("Unknown unit "+e)}}function Sl(){return this.isValid()?this._milliseconds+this._days*864e5+this._months%12*2592e6+O(this._months/12)*31536e6:NaN}function Me(e){return function(){return this.as(e)}}var wl=Me("ms"),xl=Me("s"),vl=Me("m"),bl=Me("h"),kl=Me("d"),_l=Me("w"),Tl=Me("M"),Ml=Me("Q"),Dl=Me("y");function Ol(){return he(this)}function Fl(e){return e=de(e),this.isValid()?this[e+"s"]():NaN}function He(e){return function(){return this.isValid()?this._data[e]:NaN}}var Cl=He("milliseconds"),Pl=He("seconds"),Nl=He("minutes"),Yl=He("hours"),Il=He("days"),Wl=He("months"),Al=He("years");function Ll(){return ce(this.days()/7)}var De=Math.round,rt={ss:44,s:45,m:45,h:22,d:26,w:null,M:11};function El(e,t,a,i,l){return l.relativeTime(t||1,!!a,e,i)}function Rl(e,t,a,i){var l=he(e).abs(),c=De(l.as("s")),h=De(l.as("m")),_=De(l.as("h")),D=De(l.as("d")),W=De(l.as("M")),re=De(l.as("w")),Oe=De(l.as("y")),Ie=c<=a.ss&&["s",c]||c0,Ie[4]=i,El.apply(null,Ie)}function Ul(e){return e===void 0?De:typeof e=="function"?(De=e,!0):!1}function Hl(e,t){return rt[e]===void 0?!1:t===void 0?rt[e]:(rt[e]=t,e==="s"&&(rt.ss=t-1),!0)}function Vl(e,t){if(!this.isValid())return this.localeData().invalidDate();var a=!1,i=rt,l,c;return typeof e=="object"&&(t=e,e=!1),typeof e=="boolean"&&(a=e),typeof t=="object"&&(i=Object.assign({},rt,t),t.s!=null&&t.ss==null&&(i.ss=t.s-1)),l=this.localeData(),c=Rl(this,!a,i,l),a&&(c=l.pastFuture(+this,c)),l.postformat(c)}var _r=Math.abs;function at(e){return(e>0)-(e<0)||+e}function Gt(){if(!this.isValid())return this.localeData().invalidDate();var e=_r(this._milliseconds)/1e3,t=_r(this._days),a=_r(this._months),i,l,c,h,_=this.asSeconds(),D,W,re,Oe;return _?(i=ce(e/60),l=ce(i/60),e%=60,i%=60,c=ce(a/12),a%=12,h=e?e.toFixed(3).replace(/\\.?0+$/,""):"",D=_<0?"-":"",W=at(this._months)!==at(_)?"-":"",re=at(this._days)!==at(_)?"-":"",Oe=at(this._milliseconds)!==at(_)?"-":"",D+"P"+(c?W+c+"Y":"")+(a?W+a+"M":"")+(t?re+t+"D":"")+(l||i||e?"T":"")+(l?Oe+l+"H":"")+(i?Oe+i+"M":"")+(e?Oe+h+"S":"")):"P0D"}var C=Rt.prototype;C.isValid=Ys,C.abs=hl,C.add=ml,C.subtract=pl,C.as=yl,C.asMilliseconds=wl,C.asSeconds=xl,C.asMinutes=vl,C.asHours=bl,C.asDays=kl,C.asWeeks=_l,C.asMonths=Tl,C.asQuarters=Ml,C.asYears=Dl,C.valueOf=Sl,C._bubble=gl,C.clone=Ol,C.get=Fl,C.milliseconds=Cl,C.seconds=Pl,C.minutes=Nl,C.hours=Yl,C.days=Il,C.weeks=Ll,C.months=Wl,C.years=Al,C.humanize=Vl,C.toISOString=Gt,C.toString=Gt,C.toJSON=Gt,C.locale=Ea,C.localeData=Ua,C.toIsoString=A("toIsoString() is deprecated. Please use toISOString() instead (notice the capitals)",Gt),C.lang=Ra,k("X",0,0,"unix"),k("x",0,0,"valueOf"),v("x",Nt),v("X",ui),I("X",function(e,t,a){a._d=new Date(parseFloat(e)*1e3)}),I("x",function(e,t,a){a._d=new Date(O(e))});return r.version="2.29.4",s(E),r.fn=g,r.min=Fs,r.max=Cs,r.now=Ps,r.utc=b,r.unix=sl,r.months=ll,r.isDate=y,r.locale=Ne,r.invalid=G,r.duration=he,r.isMoment=V,r.weekdays=dl,r.parseZone=ol,r.localeData=_e,r.isDuration=Ut,r.monthsShort=ul,r.weekdaysMin=fl,r.defineLocale=cr,r.updateLocale=ss,r.locales=os,r.weekdaysShort=cl,r.normalizeUnits=de,r.relativeTimeRounding=Ul,r.relativeTimeThreshold=Hl,r.calendarFormat=ro,r.prototype=g,r.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"},r})});function Xa(n){return Array.isArray(n)?n:typeof n=="string"?[n]:[]}function en(n){if(!n)return"";if(typeof n!="string"){let r=n.toString();return typeof r=="string"?r:""}return n}var tn=(n,r)=>r.indexOf(n)>0?r.indexOf(n):r.length;function Ve(n){return Ve=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(r){return typeof r}:function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},Ve(n)}function ae(n){if(n===null||n===!0||n===!1)return NaN;var r=Number(n);return isNaN(r)?r:r<0?Math.ceil(r):Math.floor(r)}function Y(n,r){if(r.length1?"s":"")+" required, but only "+r.length+" present")}function B(n){Y(1,arguments);var r=Object.prototype.toString.call(n);return n instanceof Date||Ve(n)==="object"&&r==="[object Date]"?new Date(n.getTime()):typeof n=="number"||r==="[object Number]"?new Date(n):((typeof n=="string"||r==="[object String]")&&typeof console<"u"&&(console.warn("Starting with v2.0.0-beta.1 date-fns doesn\'t accept strings as date arguments. Please use `parseISO` to parse strings. See: https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#string-arguments"),console.warn(new Error().stack)),new Date(NaN))}function Tr(n,r){Y(2,arguments);var s=B(n).getTime(),o=ae(r);return new Date(s+o)}var Jl={};function We(){return Jl}function Mr(n){var r=new Date(Date.UTC(n.getFullYear(),n.getMonth(),n.getDate(),n.getHours(),n.getMinutes(),n.getSeconds(),n.getMilliseconds()));return r.setUTCFullYear(n.getFullYear()),n.getTime()-r.getTime()}function Dr(n){return Y(1,arguments),n instanceof Date||Ve(n)==="object"&&Object.prototype.toString.call(n)==="[object Date]"}function Or(n){if(Y(1,arguments),!Dr(n)&&typeof n!="number")return!1;var r=B(n);return!isNaN(Number(r))}function Fr(n,r){Y(2,arguments);var s=ae(r);return Tr(n,-s)}var Kl=864e5;function Cr(n){Y(1,arguments);var r=B(n),s=r.getTime();r.setUTCMonth(0,1),r.setUTCHours(0,0,0,0);var o=r.getTime(),u=s-o;return Math.floor(u/Kl)+1}function Ae(n){Y(1,arguments);var r=1,s=B(n),o=s.getUTCDay(),u=(o=u.getTime()?s+1:r.getTime()>=f.getTime()?s:s-1}function Pr(n){Y(1,arguments);var r=wt(n),s=new Date(0);s.setUTCFullYear(r,0,4),s.setUTCHours(0,0,0,0);var o=Ae(s);return o}var Xl=6048e5;function Nr(n){Y(1,arguments);var r=B(n),s=Ae(r).getTime()-Pr(r).getTime();return Math.round(s/Xl)+1}function Le(n,r){var s,o,u,d,f,m,p,y;Y(1,arguments);var w=We(),x=ae((s=(o=(u=(d=r?.weekStartsOn)!==null&&d!==void 0?d:r==null||(f=r.locale)===null||f===void 0||(m=f.options)===null||m===void 0?void 0:m.weekStartsOn)!==null&&u!==void 0?u:w.weekStartsOn)!==null&&o!==void 0?o:(p=w.locale)===null||p===void 0||(y=p.options)===null||y===void 0?void 0:y.weekStartsOn)!==null&&s!==void 0?s:0);if(!(x>=0&&x<=6))throw new RangeError("weekStartsOn must be between 0 and 6 inclusively");var b=B(n),M=b.getUTCDay(),S=(M=1&&M<=7))throw new RangeError("firstWeekContainsDate must be between 1 and 7 inclusively");var S=new Date(0);S.setUTCFullYear(x+1,0,M),S.setUTCHours(0,0,0,0);var U=Le(S,r),q=new Date(0);q.setUTCFullYear(x,0,M),q.setUTCHours(0,0,0,0);var G=Le(q,r);return w.getTime()>=U.getTime()?x+1:w.getTime()>=G.getTime()?x:x-1}function Yr(n,r){var s,o,u,d,f,m,p,y;Y(1,arguments);var w=We(),x=ae((s=(o=(u=(d=r?.firstWeekContainsDate)!==null&&d!==void 0?d:r==null||(f=r.locale)===null||f===void 0||(m=f.options)===null||m===void 0?void 0:m.firstWeekContainsDate)!==null&&u!==void 0?u:w.firstWeekContainsDate)!==null&&o!==void 0?o:(p=w.locale)===null||p===void 0||(y=p.options)===null||y===void 0?void 0:y.firstWeekContainsDate)!==null&&s!==void 0?s:1),b=xt(n,r),M=new Date(0);M.setUTCFullYear(b,0,x),M.setUTCHours(0,0,0,0);var S=Le(M,r);return S}var eu=6048e5;function Ir(n,r){Y(1,arguments);var s=B(n),o=Le(s,r).getTime()-Yr(s,r).getTime();return Math.round(o/eu)+1}function N(n,r){for(var s=n<0?"-":"",o=Math.abs(n).toString();o.length0?o:1-o;return N(s==="yy"?u%100:u,s.length)},M:function(r,s){var o=r.getUTCMonth();return s==="M"?String(o+1):N(o+1,2)},d:function(r,s){return N(r.getUTCDate(),s.length)},a:function(r,s){var o=r.getUTCHours()/12>=1?"pm":"am";switch(s){case"a":case"aa":return o.toUpperCase();case"aaa":return o;case"aaaaa":return o[0];case"aaaa":default:return o==="am"?"a.m.":"p.m."}},h:function(r,s){return N(r.getUTCHours()%12||12,s.length)},H:function(r,s){return N(r.getUTCHours(),s.length)},m:function(r,s){return N(r.getUTCMinutes(),s.length)},s:function(r,s){return N(r.getUTCSeconds(),s.length)},S:function(r,s){var o=s.length,u=r.getUTCMilliseconds(),d=Math.floor(u*Math.pow(10,o-3));return N(d,s.length)}},Fe=tu;var nt={am:"am",pm:"pm",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},ru={G:function(r,s,o){var u=r.getUTCFullYear()>0?1:0;switch(s){case"G":case"GG":case"GGG":return o.era(u,{width:"abbreviated"});case"GGGGG":return o.era(u,{width:"narrow"});case"GGGG":default:return o.era(u,{width:"wide"})}},y:function(r,s,o){if(s==="yo"){var u=r.getUTCFullYear(),d=u>0?u:1-u;return o.ordinalNumber(d,{unit:"year"})}return Fe.y(r,s)},Y:function(r,s,o,u){var d=xt(r,u),f=d>0?d:1-d;if(s==="YY"){var m=f%100;return N(m,2)}return s==="Yo"?o.ordinalNumber(f,{unit:"year"}):N(f,s.length)},R:function(r,s){var o=wt(r);return N(o,s.length)},u:function(r,s){var o=r.getUTCFullYear();return N(o,s.length)},Q:function(r,s,o){var u=Math.ceil((r.getUTCMonth()+1)/3);switch(s){case"Q":return String(u);case"QQ":return N(u,2);case"Qo":return o.ordinalNumber(u,{unit:"quarter"});case"QQQ":return o.quarter(u,{width:"abbreviated",context:"formatting"});case"QQQQQ":return o.quarter(u,{width:"narrow",context:"formatting"});case"QQQQ":default:return o.quarter(u,{width:"wide",context:"formatting"})}},q:function(r,s,o){var u=Math.ceil((r.getUTCMonth()+1)/3);switch(s){case"q":return String(u);case"qq":return N(u,2);case"qo":return o.ordinalNumber(u,{unit:"quarter"});case"qqq":return o.quarter(u,{width:"abbreviated",context:"standalone"});case"qqqqq":return o.quarter(u,{width:"narrow",context:"standalone"});case"qqqq":default:return o.quarter(u,{width:"wide",context:"standalone"})}},M:function(r,s,o){var u=r.getUTCMonth();switch(s){case"M":case"MM":return Fe.M(r,s);case"Mo":return o.ordinalNumber(u+1,{unit:"month"});case"MMM":return o.month(u,{width:"abbreviated",context:"formatting"});case"MMMMM":return o.month(u,{width:"narrow",context:"formatting"});case"MMMM":default:return o.month(u,{width:"wide",context:"formatting"})}},L:function(r,s,o){var u=r.getUTCMonth();switch(s){case"L":return String(u+1);case"LL":return N(u+1,2);case"Lo":return o.ordinalNumber(u+1,{unit:"month"});case"LLL":return o.month(u,{width:"abbreviated",context:"standalone"});case"LLLLL":return o.month(u,{width:"narrow",context:"standalone"});case"LLLL":default:return o.month(u,{width:"wide",context:"standalone"})}},w:function(r,s,o,u){var d=Ir(r,u);return s==="wo"?o.ordinalNumber(d,{unit:"week"}):N(d,s.length)},I:function(r,s,o){var u=Nr(r);return s==="Io"?o.ordinalNumber(u,{unit:"week"}):N(u,s.length)},d:function(r,s,o){return s==="do"?o.ordinalNumber(r.getUTCDate(),{unit:"date"}):Fe.d(r,s)},D:function(r,s,o){var u=Cr(r);return s==="Do"?o.ordinalNumber(u,{unit:"dayOfYear"}):N(u,s.length)},E:function(r,s,o){var u=r.getUTCDay();switch(s){case"E":case"EE":case"EEE":return o.day(u,{width:"abbreviated",context:"formatting"});case"EEEEE":return o.day(u,{width:"narrow",context:"formatting"});case"EEEEEE":return o.day(u,{width:"short",context:"formatting"});case"EEEE":default:return o.day(u,{width:"wide",context:"formatting"})}},e:function(r,s,o,u){var d=r.getUTCDay(),f=(d-u.weekStartsOn+8)%7||7;switch(s){case"e":return String(f);case"ee":return N(f,2);case"eo":return o.ordinalNumber(f,{unit:"day"});case"eee":return o.day(d,{width:"abbreviated",context:"formatting"});case"eeeee":return o.day(d,{width:"narrow",context:"formatting"});case"eeeeee":return o.day(d,{width:"short",context:"formatting"});case"eeee":default:return o.day(d,{width:"wide",context:"formatting"})}},c:function(r,s,o,u){var d=r.getUTCDay(),f=(d-u.weekStartsOn+8)%7||7;switch(s){case"c":return String(f);case"cc":return N(f,s.length);case"co":return o.ordinalNumber(f,{unit:"day"});case"ccc":return o.day(d,{width:"abbreviated",context:"standalone"});case"ccccc":return o.day(d,{width:"narrow",context:"standalone"});case"cccccc":return o.day(d,{width:"short",context:"standalone"});case"cccc":default:return o.day(d,{width:"wide",context:"standalone"})}},i:function(r,s,o){var u=r.getUTCDay(),d=u===0?7:u;switch(s){case"i":return String(d);case"ii":return N(d,s.length);case"io":return o.ordinalNumber(d,{unit:"day"});case"iii":return o.day(u,{width:"abbreviated",context:"formatting"});case"iiiii":return o.day(u,{width:"narrow",context:"formatting"});case"iiiiii":return o.day(u,{width:"short",context:"formatting"});case"iiii":default:return o.day(u,{width:"wide",context:"formatting"})}},a:function(r,s,o){var u=r.getUTCHours(),d=u/12>=1?"pm":"am";switch(s){case"a":case"aa":return o.dayPeriod(d,{width:"abbreviated",context:"formatting"});case"aaa":return o.dayPeriod(d,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return o.dayPeriod(d,{width:"narrow",context:"formatting"});case"aaaa":default:return o.dayPeriod(d,{width:"wide",context:"formatting"})}},b:function(r,s,o){var u=r.getUTCHours(),d;switch(u===12?d=nt.noon:u===0?d=nt.midnight:d=u/12>=1?"pm":"am",s){case"b":case"bb":return o.dayPeriod(d,{width:"abbreviated",context:"formatting"});case"bbb":return o.dayPeriod(d,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return o.dayPeriod(d,{width:"narrow",context:"formatting"});case"bbbb":default:return o.dayPeriod(d,{width:"wide",context:"formatting"})}},B:function(r,s,o){var u=r.getUTCHours(),d;switch(u>=17?d=nt.evening:u>=12?d=nt.afternoon:u>=4?d=nt.morning:d=nt.night,s){case"B":case"BB":case"BBB":return o.dayPeriod(d,{width:"abbreviated",context:"formatting"});case"BBBBB":return o.dayPeriod(d,{width:"narrow",context:"formatting"});case"BBBB":default:return o.dayPeriod(d,{width:"wide",context:"formatting"})}},h:function(r,s,o){if(s==="ho"){var u=r.getUTCHours()%12;return u===0&&(u=12),o.ordinalNumber(u,{unit:"hour"})}return Fe.h(r,s)},H:function(r,s,o){return s==="Ho"?o.ordinalNumber(r.getUTCHours(),{unit:"hour"}):Fe.H(r,s)},K:function(r,s,o){var u=r.getUTCHours()%12;return s==="Ko"?o.ordinalNumber(u,{unit:"hour"}):N(u,s.length)},k:function(r,s,o){var u=r.getUTCHours();return u===0&&(u=24),s==="ko"?o.ordinalNumber(u,{unit:"hour"}):N(u,s.length)},m:function(r,s,o){return s==="mo"?o.ordinalNumber(r.getUTCMinutes(),{unit:"minute"}):Fe.m(r,s)},s:function(r,s,o){return s==="so"?o.ordinalNumber(r.getUTCSeconds(),{unit:"second"}):Fe.s(r,s)},S:function(r,s){return Fe.S(r,s)},X:function(r,s,o,u){var d=u._originalDate||r,f=d.getTimezoneOffset();if(f===0)return"Z";switch(s){case"X":return an(f);case"XXXX":case"XX":return je(f);case"XXXXX":case"XXX":default:return je(f,":")}},x:function(r,s,o,u){var d=u._originalDate||r,f=d.getTimezoneOffset();switch(s){case"x":return an(f);case"xxxx":case"xx":return je(f);case"xxxxx":case"xxx":default:return je(f,":")}},O:function(r,s,o,u){var d=u._originalDate||r,f=d.getTimezoneOffset();switch(s){case"O":case"OO":case"OOO":return"GMT"+rn(f,":");case"OOOO":default:return"GMT"+je(f,":")}},z:function(r,s,o,u){var d=u._originalDate||r,f=d.getTimezoneOffset();switch(s){case"z":case"zz":case"zzz":return"GMT"+rn(f,":");case"zzzz":default:return"GMT"+je(f,":")}},t:function(r,s,o,u){var d=u._originalDate||r,f=Math.floor(d.getTime()/1e3);return N(f,s.length)},T:function(r,s,o,u){var d=u._originalDate||r,f=d.getTime();return N(f,s.length)}};function rn(n,r){var s=n>0?"-":"+",o=Math.abs(n),u=Math.floor(o/60),d=o%60;if(d===0)return s+String(u);var f=r||"";return s+String(u)+f+N(d,2)}function an(n,r){if(n%60===0){var s=n>0?"-":"+";return s+N(Math.abs(n)/60,2)}return je(n,r)}function je(n,r){var s=r||"",o=n>0?"-":"+",u=Math.abs(n),d=N(Math.floor(u/60),2),f=N(u%60,2);return o+d+s+f}var nn=ru;var sn=function(r,s){switch(r){case"P":return s.date({width:"short"});case"PP":return s.date({width:"medium"});case"PPP":return s.date({width:"long"});case"PPPP":default:return s.date({width:"full"})}},on=function(r,s){switch(r){case"p":return s.time({width:"short"});case"pp":return s.time({width:"medium"});case"ppp":return s.time({width:"long"});case"pppp":default:return s.time({width:"full"})}},au=function(r,s){var o=r.match(/(P+)(p+)?/)||[],u=o[1],d=o[2];if(!d)return sn(r,s);var f;switch(u){case"P":f=s.dateTime({width:"short"});break;case"PP":f=s.dateTime({width:"medium"});break;case"PPP":f=s.dateTime({width:"long"});break;case"PPPP":default:f=s.dateTime({width:"full"});break}return f.replace("{{date}}",sn(u,s)).replace("{{time}}",on(d,s))},nu={p:on,P:au},ln=nu;var iu=["D","DD"],su=["YY","YYYY"];function un(n){return iu.indexOf(n)!==-1}function dn(n){return su.indexOf(n)!==-1}function Wr(n,r,s){if(n==="YYYY")throw new RangeError("Use `yyyy` instead of `YYYY` (in `".concat(r,"`) for formatting years to the input `").concat(s,"`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md"));if(n==="YY")throw new RangeError("Use `yy` instead of `YY` (in `".concat(r,"`) for formatting years to the input `").concat(s,"`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md"));if(n==="D")throw new RangeError("Use `d` instead of `D` (in `".concat(r,"`) for formatting days of the month to the input `").concat(s,"`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md"));if(n==="DD")throw new RangeError("Use `dd` instead of `DD` (in `".concat(r,"`) for formatting days of the month to the input `").concat(s,"`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md"))}var ou={lessThanXSeconds:{one:"less than a second",other:"less than {{count}} seconds"},xSeconds:{one:"1 second",other:"{{count}} seconds"},halfAMinute:"half a minute",lessThanXMinutes:{one:"less than a minute",other:"less than {{count}} minutes"},xMinutes:{one:"1 minute",other:"{{count}} minutes"},aboutXHours:{one:"about 1 hour",other:"about {{count}} hours"},xHours:{one:"1 hour",other:"{{count}} hours"},xDays:{one:"1 day",other:"{{count}} days"},aboutXWeeks:{one:"about 1 week",other:"about {{count}} weeks"},xWeeks:{one:"1 week",other:"{{count}} weeks"},aboutXMonths:{one:"about 1 month",other:"about {{count}} months"},xMonths:{one:"1 month",other:"{{count}} months"},aboutXYears:{one:"about 1 year",other:"about {{count}} years"},xYears:{one:"1 year",other:"{{count}} years"},overXYears:{one:"over 1 year",other:"over {{count}} years"},almostXYears:{one:"almost 1 year",other:"almost {{count}} years"}},lu=function(r,s,o){var u,d=ou[r];return typeof d=="string"?u=d:s===1?u=d.one:u=d.other.replace("{{count}}",s.toString()),o!=null&&o.addSuffix?o.comparison&&o.comparison>0?"in "+u:u+" ago":u},cn=lu;function vt(n){return function(){var r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},s=r.width?String(r.width):n.defaultWidth,o=n.formats[s]||n.formats[n.defaultWidth];return o}}var uu={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},du={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},cu={full:"{{date}} \'at\' {{time}}",long:"{{date}} \'at\' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},fu={date:vt({formats:uu,defaultWidth:"full"}),time:vt({formats:du,defaultWidth:"full"}),dateTime:vt({formats:cu,defaultWidth:"full"})},fn=fu;var hu={lastWeek:"\'last\' eeee \'at\' p",yesterday:"\'yesterday at\' p",today:"\'today at\' p",tomorrow:"\'tomorrow at\' p",nextWeek:"eeee \'at\' p",other:"P"},mu=function(r,s,o,u){return hu[r]},hn=mu;function $e(n){return function(r,s){var o=s!=null&&s.context?String(s.context):"standalone",u;if(o==="formatting"&&n.formattingValues){var d=n.defaultFormattingWidth||n.defaultWidth,f=s!=null&&s.width?String(s.width):d;u=n.formattingValues[f]||n.formattingValues[d]}else{var m=n.defaultWidth,p=s!=null&&s.width?String(s.width):n.defaultWidth;u=n.values[p]||n.values[m]}var y=n.argumentCallback?n.argumentCallback(r):r;return u[y]}}var pu={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},gu={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},yu={narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],wide:["January","February","March","April","May","June","July","August","September","October","November","December"]},Su={narrow:["S","M","T","W","T","F","S"],short:["Su","Mo","Tu","We","Th","Fr","Sa"],abbreviated:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],wide:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},wu={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"}},xu={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"}},vu=function(r,s){var o=Number(r),u=o%100;if(u>20||u<10)switch(u%10){case 1:return o+"st";case 2:return o+"nd";case 3:return o+"rd"}return o+"th"},bu={ordinalNumber:vu,era:$e({values:pu,defaultWidth:"wide"}),quarter:$e({values:gu,defaultWidth:"wide",argumentCallback:function(r){return r-1}}),month:$e({values:yu,defaultWidth:"wide"}),day:$e({values:Su,defaultWidth:"wide"}),dayPeriod:$e({values:wu,defaultWidth:"wide",formattingValues:xu,defaultFormattingWidth:"wide"})},mn=bu;function Be(n){return function(r){var s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},o=s.width,u=o&&n.matchPatterns[o]||n.matchPatterns[n.defaultMatchWidth],d=r.match(u);if(!d)return null;var f=d[0],m=o&&n.parsePatterns[o]||n.parsePatterns[n.defaultParseWidth],p=Array.isArray(m)?_u(m,function(x){return x.test(f)}):ku(m,function(x){return x.test(f)}),y;y=n.valueCallback?n.valueCallback(p):p,y=s.valueCallback?s.valueCallback(y):y;var w=r.slice(f.length);return{value:y,rest:w}}}function ku(n,r){for(var s in n)if(n.hasOwnProperty(s)&&r(n[s]))return s}function _u(n,r){for(var s=0;s1&&arguments[1]!==void 0?arguments[1]:{},o=r.match(n.matchPattern);if(!o)return null;var u=o[0],d=r.match(n.parsePattern);if(!d)return null;var f=n.valueCallback?n.valueCallback(d[0]):d[0];f=s.valueCallback?s.valueCallback(f):f;var m=r.slice(u.length);return{value:f,rest:m}}}var Tu=/^(\\d+)(th|st|nd|rd)?/i,Mu=/\\d+/i,Du={narrow:/^(b|a)/i,abbreviated:/^(b\\.?\\s?c\\.?|b\\.?\\s?c\\.?\\s?e\\.?|a\\.?\\s?d\\.?|c\\.?\\s?e\\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},Ou={any:[/^b/i,/^(a|c)/i]},Fu={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},Cu={any:[/1/i,/2/i,/3/i,/4/i]},Pu={narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},Nu={narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},Yu={narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},Iu={narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},Wu={narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\\.?\\s?m\\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},Au={any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},Lu={ordinalNumber:Ar({matchPattern:Tu,parsePattern:Mu,valueCallback:function(r){return parseInt(r,10)}}),era:Be({matchPatterns:Du,defaultMatchWidth:"wide",parsePatterns:Ou,defaultParseWidth:"any"}),quarter:Be({matchPatterns:Fu,defaultMatchWidth:"wide",parsePatterns:Cu,defaultParseWidth:"any",valueCallback:function(r){return r+1}}),month:Be({matchPatterns:Pu,defaultMatchWidth:"wide",parsePatterns:Nu,defaultParseWidth:"any"}),day:Be({matchPatterns:Yu,defaultMatchWidth:"wide",parsePatterns:Iu,defaultParseWidth:"any"}),dayPeriod:Be({matchPatterns:Wu,defaultMatchWidth:"any",parsePatterns:Au,defaultParseWidth:"any"})},pn=Lu;var Eu={code:"en-US",formatDistance:cn,formatLong:fn,formatRelative:hn,localize:mn,match:pn,options:{weekStartsOn:0,firstWeekContainsDate:1}},gn=Eu;var yn=gn;var Ru=/[yYQqMLwIdDecihHKkms]o|(\\w)\\1*|\'\'|\'(\'\'|[^\'])+(\'|$)|./g,Uu=/P+p+|P+|p+|\'\'|\'(\'\'|[^\'])+(\'|$)|./g,Hu=/^\'([^]*?)\'?$/,Vu=/\'\'/g,ju=/[a-zA-Z]/;function zt(n,r,s){var o,u,d,f,m,p,y,w,x,b,M,S,U,q,G,ne,ee,ue;Y(2,arguments);var xe=String(r),V=We(),j=(o=(u=s?.locale)!==null&&u!==void 0?u:V.locale)!==null&&o!==void 0?o:yn,A=ae((d=(f=(m=(p=s?.firstWeekContainsDate)!==null&&p!==void 0?p:s==null||(y=s.locale)===null||y===void 0||(w=y.options)===null||w===void 0?void 0:w.firstWeekContainsDate)!==null&&m!==void 0?m:V.firstWeekContainsDate)!==null&&f!==void 0?f:(x=V.locale)===null||x===void 0||(b=x.options)===null||b===void 0?void 0:b.firstWeekContainsDate)!==null&&d!==void 0?d:1);if(!(A>=1&&A<=7))throw new RangeError("firstWeekContainsDate must be between 1 and 7 inclusively");var te=ae((M=(S=(U=(q=s?.weekStartsOn)!==null&&q!==void 0?q:s==null||(G=s.locale)===null||G===void 0||(ne=G.options)===null||ne===void 0?void 0:ne.weekStartsOn)!==null&&U!==void 0?U:V.weekStartsOn)!==null&&S!==void 0?S:(ee=V.locale)===null||ee===void 0||(ue=ee.options)===null||ue===void 0?void 0:ue.weekStartsOn)!==null&&M!==void 0?M:0);if(!(te>=0&&te<=6))throw new RangeError("weekStartsOn must be between 0 and 6 inclusively");if(!j.localize)throw new RangeError("locale must contain localize property");if(!j.formatLong)throw new RangeError("locale must contain formatLong property");var me=B(n);if(!Or(me))throw new RangeError("Invalid time value");var Z=Mr(me),pe=Fr(me,Z),ze={firstWeekContainsDate:A,weekStartsOn:te,locale:j,_originalDate:me},Q=xe.match(Uu).map(function(H){var ie=H[0];if(ie==="p"||ie==="P"){var Qe=ln[ie];return Qe(H,j.formatLong)}return H}).join("").match(Ru).map(function(H){if(H==="\'\'")return"\'";var ie=H[0];if(ie==="\'")return $u(H);var Qe=nn[ie];if(Qe)return!(s!=null&&s.useAdditionalWeekYearTokens)&&dn(H)&&Wr(H,r,String(n)),!(s!=null&&s.useAdditionalDayOfYearTokens)&&un(H)&&Wr(H,r,String(n)),Qe(pe,H,j.localize,ze);if(ie.match(ju))throw new RangeError("Format string contains an unescaped latin alphabet character `"+ie+"`");return H}).join("");return Q}function $u(n){var r=n.match(Hu);return r?r[1].replace(Vu,"\'"):n}var it="File";var wn=Zl(Sn()),Er=class{constructor(){this.lang="en";this.all={en:{hintText:{fileName:"Enter File Name",alias:"Enter Display Name",dragDropModifierKeys:"Hold ${1} to Pin and ${2} to Copy",createListItem:"Select/Create List Item Frame",dragDropProperties:"Drag and drop properties to link them into the list",newItem:"+ New",selectNote:"Select Note...",newFrame:"New"},defaults:{spaceNote:"Current Note",spaceContext:"Current Space"},commands:{h1:"Heading 1",h2:"Heading 2",h3:"Heading 3",h4:"Heading 4",h5:"Heading 5",h6:"Heading 6",columns:"Columns",tabs:"Tabs",button:"Button",label:"Label",column:"Column",idea:"New",group:"Group",paragraph:"Text",card:"Card",progress:"Progress",rating:"Rating",circularProgress:"Circular Progress",list:"Bullet List","ordered-list":"Numbered List",todo:"To-do List",quote:"Quote",internal:"Link to Note",context:"Embed Existing Context",flow:"Embed Note or Space",board:"New Board",divider:"Divider",note:"Note Block",link:"Web Link",internalLink:"Link",callout:"Callout",bookmark:"Bookmark",table:"New Table",codeblock:"Code Block",toggle:"Toggle",emoji:"Emoji",image:"Image",newNote:"Note",tag:"Tag",makeMenu:"Flow Menu",selectStyle:"Style",toggleKeyboard:"Toggle Keyboard",rows:"Rows",masonry:"Gallery"},styles:{bold:"Bold",italics:"Italics",strikethrough:"Strikethrough",code:"Code",link:"Web Link",blocklink:"Link to Note",textColor:"Text Color",highlight:"Highlight"},commandsSuggest:{noResult:"No result"},commandPalette:{enable:"Enable",disabled:"Disable",openFlow:"Open Flow Blocks in Selection",closeFlow:"Close Flow Blocks in Selection",toggleBold:"Toggle Bold",toggleItalics:"Toggle Italics",openSpaces:"Open Navigator",blink:"Blink",openFileContext:"Open Explorer",convertPathToSpace:"Convert to Space",revealFile:"Reveal File in Navigator",releaseNotes:"Release Notes",getStarted:"Get Started",toggleBacklinks:"Toggle Backlinks",collapseAllFolders:"Collapse All Folders",addFileSpace:"Add File to Space",removeFileSpace:"Remove File from Space"},frames:{sections:{kit:"Kit",paths:"Paths"},label:{label:"Label",description:"Label"},note:{label:"Note",description:"Link to a note"},table:{label:"Table",description:"Table"},context:{label:"Context",description:"Display a context view from another space"},calendar:{label:"Calendar View"},field:{label:"Field",description:"Dynamic node that displays a value based on property type"},event:{label:"Event"},divider:{label:"Divider",description:"Divider to separate your content"},button:{label:"Button",description:"Buttons can perform actions and open links"},callout:{label:"Callout",description:"Callout to highlight important information"},toggle:{label:"Toggle",description:"Toggle to show/hide content"}},menu:{layout:"Layout",enterFlowState:"Enter Flow State",exitFlowState:"Exit Flow State",newView:"New View",calendarView:"Calendar View",dayView:"Day View",closeSpace:"Close Space in Focus",customView:"Custom View",detailsView:"Details View",catalogView:"Catalog View",galleryView:"Gallery View",deleteContext:"Delete Context",openSpace:"Open",revealInDefault:"Reveal in Finder",revealInExplorer:"Reveal in Explorer",setNone:"None",fileMetadataDescription:"This note only",openFilePane:"Open in a new pane",rename:"Rename",changeToFolderNote:"New Space from Note",moveFile:"Move file to...",moveFolder:"Move folder to...",duplicate:"Make a copy",edit:"Edit",delete:"Delete",getHelp:"Make.md Community",vault:"Vault",openVault:"Open Another Vault",openVaultInFolder:"Open Vault Folder",obSettings:"Obsidian Settings",commandPalette:"Command Palette",backToSpace:"Back to Navigator",collapseAllSections:"Collapse All Spaces",expandAllSections:"Expand All Spaces",collapseAllFolders:"Collapse All Folders",expandAllFolders:"Expand All Folders",spaceTitle:"Add/Remove in Space",home:"Home",none:"None",tableView:"Table View",cardView:"Card View",boardView:"Board View",listView:"List View",flowView:"Flow View",groupBy:"Group",sortBy:"Sort",filters:"Filters",newFilter:"New Filter",clearFilters:"Clear Filters",hide:"Hide",unhideFields:"Unhide All Properties",importDataview:"Import All Dataview Properties",saveAllProperties:"Save All Properties to Files",mergeProperties:"Merge Properties",removeFromSpace:"Unpin from Space",editCode:"Edit Code",editProperties:"Edit Properties",properties:"Properties",deleteProperty:"Delete Property",hideProperty:"Hide Property",unhideProperty:"Unhide Property",saveProperty:"Save Property",sortAscending:"Sort Ascending",sortDescending:"Sort Descending",deleteRow:"Delete Item",collapseAll:"Collapse All",customSort:"Custom Sort",groupSpaces:"Group Spaces",recurisveSort:"Apply to Subfolders",fileNameSortAlphaAsc:"File Name (A to Z)",fileNameSortAlphaDesc:"File Name (Z to A)",fileNameSortNumericalAsc:"File Name (1 to 9)",fileNameSortNumericalDesc:"File Name (9 to 1)",createdTimeSortAsc:"Created Time (new to old)",createdTimeSortDesc:"Created Time (old to new)",modifiedTimeSortAsc:"Modified Time (new to old)",modifiedTimeSortDesc:"Modified Time (old to new)",sizeSortAsc:"Size (smallest to largest)",sizeSortDesc:"Size (largest to smallest)",spaces:"Spaces",tags:"Tags",manageHiddenFiles:"Manage Hidden Files",manageActions:"Manage Actions",deleteSpace:"Delete",changeColor:"Change Color",changePropertyType:"Change Type",deleteFiles:"Delete Files",createFolderSpace:"Create Space from Folder",folder:"Folder",syncToContext:"Add Property to Context",setIcon:"Set Icon",copyEmbedLink:"Copy Embed Link",moveUp:"Move Up",moveDown:"Move Down",moveTo:"Move To",groupNodes:"Group Nodes",moveFrame:"Move Frame",renameFrame:"Rename Frame",deleteFrame:"Delete Frame",insertAbove:"Insert Above",insertBelow:"Insert Below"},editor:{rows:"Rows",columns:"Columns",catalog:"Catalog",gallery:"Gallery",grid:"Grid",scaleToFit:"Change to Fit",scaleToFill:"Change to Fill",fit:"Fit",strokeNone:"None",strokeSolid:"Solid",strokeDotted:"Dotted",strokeDashed:"Dashed",size:"Size",gap:"Gap",marginLeft:"Left",marginTop:"Top",marginRight:"Right",marginBottom:"Bottom",minimize:"Minimize",paddingLeft:"Left",paddingTop:"Top",paddingRight:"Right",paddingBottom:"Bottom",unlinkProperty:"Unlink Property",linkedProperty:"Linked Property",linkProperty:"Link Property",currentSpace:"Current Space",linkName:"${1} Link",linkThumbnail:"${1} Thumbnail",linkSticker:"${1} Sticker",opacity:"Opacity",shadowSpread:"Spread",shadowBlur:"Blur",width:"Width",height:"Height",margin:"Margin",padding:"Padding",bold:"Bold",italic:"Italic",underline:"Underline",alignLeft:"Align Left",alignCenter:"Align Center",alignRight:"Align Right",alignJustify:"Align Justify",numberOfLines:"Lines",createVerticalSection:"Create Vertical Section",createHorizontalSection:"Create Horizontal Section",themeColors:"Theme Colors",uiColors:"UI Colors",hex:"Hex"},buttons:{add:"Add",togglePin:"Toggle Pin",refresh:"Refresh",showHidden:"Show Hidden",alias:"Alias",addFilter:"Add Filter",loadMore:"Load More",addCondition:"Add Condition",customize:"Customize",moreOptions:"More Options",saveProperty:"Save Property",newNote:"New Note",changeIcon:"Change Sticker",removeIcon:"Remove Sticker",addIcon:"Add Sticker",addCover:"Add Cover",addDisplay:"Display Name",changeBanner:"Change Cover",changeBannerShort:"Cover",saveChanges:"Save Changes",removeBanner:"Remove Cover",rename:"Change Name",editFrame:"Edit Frame",saveSpace:"Save Space",createSpace:"New Space",createFolder:"New Folder",createNote:"New Note",createCanvas:"New Canvas",addIntoSpace:"New Pin",addSmartSearch:"Add Live Search",subFolders:"Sub Folders",addItem:"Add Item",addProperty:"Add Property",editProperty:"Edit Property",addContext:"Add Context",cancel:"Cancel",search:"Search",delete:"Delete",toggleFlow:"Toggle Flow",openFlow:"Open Flow",hideFlow:"Hide Flow",openLink:"Open Link",addToSpace:"Add to Space",addToSpaceShort:"Pin",addTag:"Add Tag",tag:"Tag",syncFields:"Sync Properties",convertTable:"Convert to Markdown",cutTable:"Cut Table",deleteTable:"Delete From Note",blink:"Blink",addFile:"Add Item",merge:"Merge",saveView:"Save View",saveTable:"Save Table",renameView:"Rename View",deleteView:"Delete View",renameTable:"Rename Table",renameTag:"Rename Tag",createTag:"Create Tag",currentFolder:"Current Folder",sync:"Sync",pasteCSS:"Paste CSS",save:"Save",run:"Run"},metadataTypes:{fileName:"File Name",contexts:"Contexts",path:"Path",folder:"Folder",sticker:"Sticker",color:"Color",created:"Created",lastModified:"Last Modified",extension:"Extension",size:"Size",tags:"Tags",inlinks:"Linked Mentions",outlinks:"Links",label:"Label",fileMetadata:"File Metadata",frontmatter:"Frontmatter"},filterTypes:{contains:"contains",notContains:"does not contain",is:"is",isNot:"is not",before:"before",after:"on or after",anyOf:"is any of",noneOf:"is none of",checked:"is checked",unchecked:"is unchecked",isEmpty:"is empty",isNotEmpty:"is not empty",isSameDate:"is same date",isSameDateAsToday:"today"},sortTypes:{alphaAsc:"A to Z",alphaDesc:"Z to A",earliest:"Earliest",latest:"Latest",checkAsc:"Checked \\u2192 Unchecked",checkDesc:"Unchecked \\u2192 Checked",itemsAsc:"Least Items",itemsDesc:"Most Items"},properties:{defaultField:"Name",aggregate:{label:"Aggregate",description:"Aggregate functions to calculate values"},audio:{label:"Audio",description:"Audio"},text:{label:"Text",description:"Text field"},number:{label:"Number",description:"Number field with optional unit"},boolean:{label:"Yes/No",description:"Yes or No toggle to indicate the status"},date:{label:"Date",description:"Select a date from a calendar"},option:{label:"Option",description:"Select one or multiple option from a list"},file:{label:"File"},link:{label:"Link",description:"Link to another note or a website"},tags:{label:"Tags",description:"Use tags to quickly organize your items"},object:{label:"Object",description:"Store any complex objects"},context:{label:"Relation",description:"Connect to another context property and create a relation"},image:{label:"Image",description:"Select any image from your system or from the internet"},color:{label:"Color",description:"Use colors to label your items or status"},space:{label:"Context",description:"Link to a context"},icon:{label:"Sticker",description:"Use stickers to uniquely label your items or status"},super:{label:"Super Property",links:"Open Link",properties:"Update Property",api:"API",obsidianCommands:"Run Command",runCommand:"Run Command",performAction:"Perform Action",whenClicked:"When Clicked"},fileProperty:{name:"Name",label:"Formula",createdTime:"Created",modifiedTime:"Last Edited",sticker:"Sticker",links:"Links",tags:"Tags",spaces:"Spaces",extension:"Extension",size:"Size",preview:"Note Preview",parentFolder:"Folder",description:"Use a formula to dynamically display a property"}},views:{navigator:"Navigator",explorer:"Explorer",space:"Space"},subViews:{spaceItems:"Items",spaceContext:"Context",spaceLists:"Lists",spaceActions:"Actions",spaceTemplates:"Templates",smartSearch:"Live Searches",filesAndFolders:"Files and Folders"},labels:{duplicateTable:"Duplicate Table",aggregateBy:"Aggregate By",pinned:"Pinned",live:"Pinned by Live Search",moveTable:"Move Table",editFormula:"Edit Formula",editObject:"Edit Object",properties:"Properties",newAction:"Action",newTable:"List",template:"Template",createFolder:"New Folder Name",rename:"Rename",createNew:"New",default:"Default",done:"Done",changeCoverShort:"Change",reposition:"Reposition",tables:"Tables",selectDateFormat:"Select/Type Date Format",renameSection:"Edit Space",createSection:"New Folder",createNote:"New Note",contextMaker:"Context Maker",select:"Select",pinnedItems:"Pinned Items",collapse:"Collapse",expand:"Expand",all:"All",none:"None",view:"View",findStickers:"Find Sticker",mergeProperties:"Merge Properties",placeholder:"Type \'${1}\' for commands",notePlaceholder:"New Note for ${1}",itemsSelected:"${1} Selected",selectNote:"Select Note",selectIcon:"Select Icon",selectImage:"Select Image",selectSpace:"Select Space",styleSmall:"Small",styleMedium:"Medium",styleLarge:"Large",hiddenFilePattern:"Name, Suffixes and Extension",hiddenFileSpecific:"Exclude specific files and folders",textPlaceholder:"Enter Text",noFile:"is not created yet. Click to create.",navigatorSearchPlaceholder:"Search by Text or Filters",blinkPlaceholder:"Search for notes, spaces...",searchPlaceholder:"Type to search...",contextItemSelectPlaceholder:"Find Item",linkItemSelectPlaceholder:"Find or Create Note",pinNotePlaceholder:"Select a Note or Space to Pin",optionItemSelectPlaceholder:"Select Option",viewItemSelectPlaceholder:"Select View",tagItemSelectPlaceholder:"Find Tag",spaceSelectPlaceholder:"Select any Folder or Tag",propertyItemSelectPlaceholder:"Select Property",sortItemSelectPlaceholder:"Select Sort",filterItemSelectPlaceholder:"Select Filter",imageSelectPlaceholder:"Select an image or paste a URL",imageNotFoundPlaceholder:"No Images Found",syncFrontmatterProperty:"Sync Frontmatter Property",newProperty:"New Property",newPropertyShort:"New Property",propertyType:"Type",propertyDynamic:"Dyanmic",propertyValueSpace:"Space",propertyValueReference:"Related Property",propertyValueAggregate:"Aggregate Property",propertyValueProperty:"Property",propertyLookup:"Edit Formula",existingFrontmatter:"Existing Property",dateFormat:"Date Format",propertyFileProp:"Property",multiple:"Multiple",filesCount:"{$1} Files",hiddenFiles:"Hidden Files",addExtension:"Add Rule",saveView:"Save View",saveTable:"Save Table",renameView:"Rename View",renameTable:"Rename Table",syncMetadata:"Sync Metadata",syncProperties:"Sync Properties",selectContext:"Select Context",metadata:"Metadata",backlinks:"Backlinks",spaces:"Spaces",contexts:"Contexts",content:"Content",deleteSpace:"Delete Space",deleteFiles:"Delete Files",outgoingLinks:"Outgoing Links",moveTo:"Move to",addTo:"Pin to",copyTo:"Copy to",reorderIn:"Reorder in",border:"Border",corners:"Corners",color:"Color",backgroundColor:"Background",cornerRadius:"Radius",onClick:"On Click",layout:"Layout",element:"Element",name:"Name",display:"Display",alignment:"Alignment",margin:"Margin",padding:"Padding",gap:"Gap",width:"Width",height:"Height",opacity:"Opacity",shadow:"Shadow",shadowBlur:"Blur",shadowSpread:"Spread",typography:"Typography",layers:"Layers",fontSize:"Size",props:"Props",styles:"Styles",events:"Events",code:"Code",selectedLayers:"${1} Layers"},descriptions:{spaceActions:"Create actions that runs when you press a button",spaceLists:"Create lists to track data and organize them in your space",spaceItems:"Add new items to the space or pin items to the space",spaceTemplates:"Create templates to quickly add items to your space",smartSearch:"Automatically pin notes to this space based on a set of searches",hiddenFileOptions:"Exclude any files and folders by name, suffix or extension.",deleteSpace:"Deleting the space will also delete the folder and its contents.",deleteFiles:"Delete ${1} files/folders and their contents?",addContext:"Contexts lets you connect properties from your tags",spaceProperties:"Define Properties for your Space Items",syncMetadata:"Select which fields from your notes to start syncing with the context.",syncProperties:"Contexts defines and syncs the same fields across your notes depending on their folder or tag.",selectContext:"Select which folder or tag context you want to sync the fields."},flowView:{emptyDoc:"Empty Document",itemsCount:" Items",emptyFolder:"This Folder is Empty"},notice:{duplicateFile:"Folder already contains note with same name",addedToSection:"Added to Space",fileExists:"File Already Exists",folderExists:"Folder Already Exists",noPropertyName:"Property Name is Required",noPropertiesFound:"No Properties Found",duplicatePropertyName:"Duplicate Property Name",newSpaceName:"Enter a name for your space",duplicateSpaceName:"Space name already exists",cantConvertNoteToSpace:"The view is not a note",templateSaved:"Template saved to space: ",tableDeleted:"Table removed from note, you can find the table in the folder space"},settings:{sections:{general:"General",navigator:"Navigator",appearance:"Appearance",interaction:"Preferences",context:"Context",label:"Labels",tags:"Tags",space:"Spaces",performance:"Performance",advanced:"Advanced",folderNote:"Folder Note",notes:"Notes"},searchWorker:{name:"Background Search",desc:"Search in background to improve reponsiveness while searching"},cacheIndex:{name:"Cache Search Index",desc:"Cache the index for faster search results"},layoutVertical:"Vertical",layoutHorizontal:"Horizontal",sectionGeneral:"General",sectionSidebar:"Spaces",sectionEditor:"Maker Mode",sectionFlow:"Flow",sectionAdvanced:"Advanced",sectionDataview:"Dataview",sectionContext:"Context",sectionStickers:"Labels",sectionNavigator:"Navigator",sectionDefault:"Default Spaces",sectionSpaceView:"Space View",sectionBlink:"Blink",sectionInlineContext:"Inline Context",sectionFlowBlock:"Flow Block",sectionFlowMenu:"Flow Menu",sectionFlowStyler:"Flow Styler",experimental:{name:"Experimental",desc:"Experimental features that are subject to change and may not be optimized for performance"},imageThumbnails:{name:"Generate Thumbnails",desc:"Create thumbnails for images to speed up performance"},minimalThemeFix:{name:"Minimal Theme Fix",description:"Apply fixes for the popular theme Minimal"},inlineStickerMenu:{name:"Inline Stickers",desc:"Add inline stickers by typing :"},openSpacesOnLaunch:{name:"Open Navigator as Default Tab",desc:"Open the Navigator tab when Obsidian launches"},spacesRightSplit:{name:"Navigator on Right Side",desc:"Open the Navigator in the right panel"},defaultSpaceTemplate:{name:"Default Space Template",desc:"Select the default template for new spaces"},defaultDateFormat:{name:"Default Date Format",desc:"Set the default date format, example: yyyy-MM-dd (see https://date-fns.org/v2.30.0/docs/format)"},defaultTimeFormat:{name:"Default Time Format",desc:"Set the default time format, example: h:mm a (see https://date-fns.org/v2.30.0/docs/format)"},autoAddContextsToSubtags:{name:"Apply Properties to Subtags",desc:"Automatically apply context properties to subtags"},newNotePlaceholder:{name:"New Note Placeholder",desc:"Default name for new notes"},folderIndentationLines:{name:"Show Folder Indentation Lines",desc:"Turn on to show a line on the left of folders to indicate indentation"},folderNoteLocation:{name:"Folder Note Location Inside Folder",desc:"Turn on to have folder notes inside the folder, turn off to have it outside"},folderViewDefault:{name:"Show Folder Note by Default",desc:"Show the folder note by default when opening a folder"},internalLinkFlowEditor:{name:"Show Toggles to Open Flow Editor on Links",desc:"Turn on to toggle Flow Blocks directly in inline links"},internalLinkSticker:{name:"Show Stickers on Links",desc:"Turn on to toggle stickers shown directly by beside internal links"},saveAllContextToFrontmatter:{name:"Sync Context Fields to Frontmatter",desc:"Turn on to automatically save all context fields to frontmatter fields, not just existing frontmatter fields."},syncFormulaToFrontmatter:{name:"Sync Formula Fields to Frontmatter",desc:"Turn on to save calculated formula values to frontmatter fields."},spaceSubFolder:{name:"Space Folder Name",desc:"Name of the folder for spaces"},basics:{name:"Make.md Basics",desc:"Enable features from Make.md Basics including styler and flow blocks"},spacesFolder:{name:"Tag Space Folder",desc:"Name of the folder for tag spaces"},dataviewInlineContext:{name:"Show Dataview in Inline Context",desc:"Show dataview when inline context is enabled"},inlineContext:{name:"Notes Header",desc:"Show a header to display labels and properties"},banners:{name:"Cover Image",desc:"Show a cover image for notes and spaces"},inlineContextProperties:{name:"Show Context Properties in Header",desc:"Show the properties in the header for notes and spaces"},inlineContextExpanded:{name:"Auto Expand Context Properties",desc:"Expand the inline context sections when opening a note"},inlineContextNameLayout:{name:"Title and Sticker Layout",desc:"Layout for inline title and sticker in Inline Context"},hideFrontmatter:{name:"Hide Context Properties",desc:"Hide properties you have added in context from the Obsidian properties panel"},autoOpenFileContext:{name:"Auto Open Explorer",desc:"Automatically open explorer panel in the right panel"},enableFolderNote:{name:"Enable Folder Note",desc:"Access the folder note in the folder page and hide the folder note from spaces"},folderNoteName:{name:"Folder Note Name",desc:"Name of the folder note, keep blank to use the same name as the folder"},expandFolderOnClick:{name:"Auto Expand Folder",desc:"Auto expand folders on click"},filePreviewOnHover:{name:"Preview on Hover",desc:"Preview on Hover while holding Control/Command key"},revealActiveFile:{name:"Reveal Active File",desc:"Automatically reveal the active file in Navigator"},contextEnabled:{name:"Contexts",desc:"Contexts allows you to have full control over the metadata of your files"},navigatorEnabled:{name:"Navigator",desc:"The navigator lets you create and organize your spaces"},spacesStickers:{name:"Stickers",desc:"Use Emojis to make it easier to find your notes"},spacesUseAlias:{name:"Alias",desc:"Use the alias metadata to show in Navigator"},spacesDisablePatch:{name:"Compatibility Mode",desc:"This will improve the compatibility of plugins while using the Navigator"},deleteFileOption:{name:"Delete File Option",desc:"Select how you want files to be deleted"},spacesDeleteOptions:{permanant:"Delete Permanently",trash:"Move to Obsidian Trash","system-trash":"Move to System Trash"},flowState:{name:"Flow State",desc:"Toggle the flow state"},showRibbon:{name:"App Ribbon",desc:"Show/hide the left menu aka. ribbon"},spaceViewEnabled:{name:"Spaces",desc:"Customize your folders and tags with properties and views"},defaultSpaces:{name:"Default Spaces",desc:"Recommended spaces for quickly organizing your vault"},homeSpace:{name:"Home Space",desc:"An easy-to-access space where you can add/organize your other spaces"},enableDefaultSpaces:{name:"Tag Spaces",desc:"Automatically create spaces for each of your tags"},readableLineWidth:{name:"Readable Line Width",desc:"Use Readable Line Width"},sidebarTabs:{name:"Sidebar Tabs",desc:"Show/hide other sidebar tabs"},spacesPerformance:{name:"Navigator Scroll Performance",desc:"Turn on performance mode for Navigator, may affect scrolling appearance. Requires Restart"},indexSVG:{name:"Use SVGs as Stickers",desc:"Use any svg file in your vault as a sticker"},inlineStyler:{name:"Flow Styler",desc:"Select text to add styling"},inlineStylerColor:{name:"Text and Highlight Colors \\u{1F9EA}",desc:"Select text color and highlight color, (this may change in the future because of the limitations with HTML and Obsidian)"},spaceRowHeight:{name:"Row Height",desc:"The height for each row in navigator (in pixels), default is 29"},contextPagination:{name:"Table View Pagination",desc:"Number of items per page in table view"},bannerHeight:{name:"Cover Height",desc:"The height for the cover of the note or space, default is 200"},makeChar:{name:"Flow Menu Trigger",desc:"Character to open the Flow Menu"},mobileMakeBar:{name:"Flow Styler (Mobile)",desc:"Replaces the mobile toolbar"},editorMarkSans:{name:"Mark Sans \\u{1F9EA}",desc:"Use the editor without Markdown."},editorMakerMode:{name:"Flow (Beta)",desc:"An integrated and intuitive editor experience"},editorMakePlacholder:{name:"Flow Menu Hint Text",desc:"Show a hint text on how to open the Flow Menu Shortcut"},blinkEnabled:{name:"Blink",desc:"A faster way to search and edit your notes"},editorMakeMenu:{name:"Flow Menu",desc:"Open the Flow menu to quickly add content"},editorMakeMenuTrigger:{name:"Flow Menu Shortcut",desc:"Trigger key to use flow menu"},editorFlowReplace:{name:"Flow Block",desc:"Open your internal links or toggle your embeds in the flow block."},editorFlowStyle:{name:"Flow Block Style",desc:"Select a theme for your flow block",seamless:"Seamless",minimal:"Minimal"}}}};this.lang="en";let r=wn.default.locale();["en"].includes(r)&&(this.lang=r)}get texts(){return this.all.en}},F=new Er().texts;var Ge="files",bt={id:Ge,name:"Items",type:"db",primary:"true"};var xn={uniques:["name,schemaId"],cols:["name","schemaId","type","value","attrs","hidden","unique","primary"]},kt={...xn,rows:[{name:it,schemaId:Ge,type:"file",primary:"true",hidden:"",unique:"",attrs:"",value:""},{name:"Created",schemaId:Ge,type:"fileprop",value:it+".ctime",hidden:"",unique:"",attrs:"",primary:"true"}]};var Qt={...xn,rows:[{name:it,schemaId:Ge,type:"file",primary:"true",hidden:"",unique:"",attrs:"",value:""}]};var ah=[{type:"unknown",label:"",restricted:!0,icon:"ui//file-question"},{type:"any",label:"",restricted:!0,icon:"ui//wildcard",multi:!0,multiType:"any-multi"},{type:"text",label:F.properties.text.label,metadata:!0,icon:"ui//text",primative:!0,description:F.properties.text.description},{type:"number",label:F.properties.number.label,metadata:!0,icon:"ui//binary",configKeys:["unit"],primative:!0,description:F.properties.number.description},{type:"boolean",label:F.properties.boolean.label,metadata:!0,icon:"ui//check-square",primative:!0,description:F.properties.boolean.description},{type:"date",label:F.properties.date.label,metadata:!0,icon:"ui//calendar",configKeys:["format"],primative:!0,description:F.properties.date.description},{type:"option",label:F.properties.option.label,multi:!0,multiType:"option-multi",icon:"ui//list",configKeys:["options","source"],description:F.properties.option.description},{type:"tags-multi",label:F.properties.tags.label,icon:"ui//tags",description:F.properties.tags.description},{type:"file",label:F.properties.file.label,restricted:!0,icon:"ui//mk-make-h3"},{type:"fileprop",label:F.properties.fileProperty.label,icon:"ui//formula",configKeys:["field","value","type"],description:F.properties.fileProperty.description},{type:"link",label:F.properties.link.label,multi:!0,multiType:"link-multi",metadata:!0,icon:"ui//file-text",primative:!0,description:F.properties.link.description},{type:"context",label:F.properties.context.label,icon:"ui//mk-make-note",multi:!0,multiType:"context-multi",configKeys:["space","field"],description:F.properties.context.description},{type:"aggregate",label:F.properties.aggregate.label,icon:"ui//mk-make-note",multi:!1,configKeys:["ref","field","fn"],description:F.properties.aggregate.description},{type:"object",label:F.properties.object.label,multi:!0,multiType:"object-multi",metadata:!0,icon:"ui//list-tree",configKeys:["type","typeName"],description:F.properties.object.description},{type:"icon",label:F.properties.icon.label,multi:!0,multiType:"icon-multi",icon:"ui//gem",restricted:!0,primative:!0,description:F.properties.icon.description},{type:"image",label:F.properties.image.label,multi:!0,multiType:"image-multi",metadata:!0,icon:"ui//mk-make-image",primative:!0,description:F.properties.image.description},{type:"color",label:F.properties.color.label,icon:"ui//mk-make-image",restricted:!0,description:F.properties.color.description},{type:"space",label:F.properties.space.label,icon:"ui//layout-grid",restricted:!0,description:F.properties.space.description},{type:"table",label:F.properties.space.label,icon:"ui//layout-grid",restricted:!0,description:F.properties.space.description},{type:"super",label:F.properties.super.label,icon:"ui//zap",restricted:!0,configKeys:["dynamic","field"]},{type:"input",label:F.properties.super.label,icon:"ui//input",restricted:!0}];var Bu="filesView",Gu={id:Bu,name:"All",type:"view",def:JSON.stringify({db:Ge,icon:"ui//file-stack"})},qu="main",zu=n=>({id:n,name:n,type:"frame",def:"",predicate:"",primary:"true"}),nh={uniques:[],cols:["id","name","type","def","predicate","primary"],rows:[zu(qu),Gu]},Zt={uniques:[],cols:["id","name","type","def","predicate","primary"],rows:[bt]};var ih={schema:bt,cols:kt.rows,rows:[]},sh={schema:bt,cols:kt.rows,rows:[]},oh={schema:bt,cols:Qt.rows,rows:[]},vn=(n,r)=>n.filter(s=>r.find(o=>o.id==s.schemaId&&o.type=="db")).reduce((s,o)=>({...s,...s[o.schemaId]?{[o.schemaId]:{uniques:o.unique=="true"?[...s[o.schemaId].uniques,o.name]:s[o.schemaId].uniques,cols:[...s[o.schemaId].cols,o.name],rows:[]}}:{[o.schemaId]:{uniques:o.unique=="true"?[o.name]:[],cols:[o.name],rows:[]}}}),{});var lh={m_schema:Zt,m_fields:kt,...vn(kt.rows,Zt.rows)},uh={m_schema:Zt,m_fields:Qt,...vn(Qt.rows,Zt.rows)};var bn=n=>[...new Set(n)];var Rr=(n,r)=>{if(n instanceof Date)return"date";if(typeof n=="string"){if(/\\/\\/(\\S+?(?:jpe?g|png|gif|svg))/gi.test(n)||n.includes("unsplash"))return"image";if(/^\\d{4}-\\d{2}-\\d{2}$/.test(n))return"date";if(r=="tag"||r=="tags")return"tags-multi";if(/\\[\\[.*?\\]\\]/.test(n))return"link"}else{if(typeof n=="number")return"number";if(typeof n=="boolean")return"boolean";if(n)if(Array.isArray(n)||typeof n=="string"&&n.indexOf(",")>-1){let s=Array.isArray(n)?n:[];if(typeof n=="string"&&n.indexOf(",")>-1&&(s=Ee(n)),r=="tag"||r=="tags")return"tags-multi";if(s.length==1&&Array.isArray(s[0])&&s[0].length==1&&typeof s[0][0]=="string")return"link";let o=bn(s.map(u=>Rr(u,r)));return o.length==1&&o[0]=="link"?"link-multi":o.some(u=>u=="object")?"object-multi":"option-multi"}else return n.isLuxonDateTime?"date":n.isLuxonDuration?"duration":n.type=="file"?"link":typeof n=="object"&&!Array.isArray(n)&&n!==null?"object":"unknown";else return"unknown"}return"text"};var kn=n=>n.map(r=>r.replace(",","\\\\,")).join(", "),ot=n=>JSON.stringify(n);var Ee=n=>n?.startsWith("[")?Xa(qt(n)).map(r=>en(r)):Qu(n),Qu=n=>(n?.replace("\\\\,",",")?.match(/(\\\\.|[^,])+/g)??[]).map(r=>r.trim()),Hr=(n,r,s)=>{let o=s??Rr(r,n);if(!r)return"";switch(o){case"tags-multi":return r;case"object":case"object-multi":{if(Array.isArray(r)){if(r[0].path)return JSON.stringify(r.map(u=>u.path))}else if(r.path)return r.path;return JSON.stringify(r)}break;case"number":return r.toString();case"boolean":return r?"true":"false";case"date":{if(r instanceof Date){let u=zt(r,"yyyy-MM-dd");return typeof u=="string"?u:""}return typeof r!="string"?"":r}break;case"duration":return kn(Object.keys(r.values).reduce((u,d)=>[...u,...r.values[d]>0?[r.values[d]+" "+d]:[]],[]));case"option-multi":case"link-multi":case"context-multi":return typeof r=="string"?Ur(r):ot(r.map(u=>u?typeof u=="string"?Ur(u):u.path?u.path:Array.isArray(r)&&u.length==1&&Array.isArray(u[0])&&u[0].length==1&&typeof u[0][0]=="string"?u[0][0]:JSON.stringify(u):""));case"link":case"context":return Array.isArray(r)&&r.length==1&&Array.isArray(r[0])&&r[0].length==1&&typeof r[0][0]=="string"?r[0][0]:typeof r=="string"?Ur(r):r.path;case"text":case"tag":case"option":case"image":return r}return""};var qt=n=>{let r;try{r=JSON.parse(n)}catch{}return r};var Ur=n=>{if(!n)return"";let r=/\\[\\[(.*?)\\]\\]/g.exec(n),s=r?.length>1?r[1].substring(0,tn("|",r[1])):n;return s||n};var _n=(n,r)=>{let s=n?Ee(n):[],o=r?Ee(r):[];return o.every(u=>s.some(d=>d==u))&&s.every(u=>o.some(d=>d==u))},lt=(n,r)=>n==r,Vr=(n,r)=>(n??"").length==0,jr=(n,r)=>(n??"").toLowerCase().includes((r??"").toLowerCase()),$r=(n,r)=>parseFloat(n)>parseFloat(r),Br=(n,r)=>parseInt(n){let s=isNaN(Date.parse(n))?new Date(parseInt(n)):new Date(n),o=isNaN(Date.parse(r))?new Date(parseInt(r)):new Date(r);return s.valueOf()>=o.valueOf()},Mn=(n,r)=>{let s=isNaN(Date.parse(n))?new Date(parseInt(n)):new Date(n),o=isNaN(Date.parse(r))?new Date(parseInt(r)):new Date(r);return s.valueOf(){let s=n?Ee(n):[],o=r?Ee(r):[];return s.length==0?!1:o.some(u=>s.some(d=>d==u))},Dn=(n,r)=>{if(!n)return!1;let s=new Date(`${n.toString().replace(".",":")}`),o=new Date(`${r}`);return s.getMonth()===o.getMonth()&&s.getDate()===o.getDate()},On=n=>{if(!n)return!1;let r=new Date(`${n.toString()}T00:00`),s=new Date;return r.getMonth()===s.getMonth()&&r.getDate()===s.getDate()};var ut={isNotEmpty:{type:["text","file","number","option","option-multi","link","link-multi","image"],fn:(n,r)=>!Vr(n,""),valueType:"none"},isEmpty:{type:["text","file","number","option","option-multi","link","link-multi","image"],fn:(n,r)=>Vr(n,""),valueType:"none"},include:{fn:(n,r)=>jr(n,r),type:["text","file","link","image"],valueType:"text"},notInclude:{type:["text","file","link","image"],fn:(n,r)=>!jr(n,r),valueType:"text"},is:{type:["text"],fn:(n,r)=>lt(n,r),valueType:"text"},isNot:{type:["text"],fn:(n,r)=>!lt(n,r),valueType:"text"},equal:{type:["number"],fn:(n,r)=>lt(n,r),valueType:"number"},isLink:{type:["link","context"],fn:(n,r)=>lt(n,r),valueType:"link"},isNotLink:{type:["link","context"],fn:(n,r)=>!lt(n,r),valueType:"link"},isGreatThan:{type:["number"],fn:(n,r)=>$r(n,r),valueType:"number"},isLessThan:{type:["number"],fn:(n,r)=>Br(n,r),valueType:"number"},isLessThanOrEqual:{type:["number"],fn:(n,r)=>!$r(n,r),valueType:"number"},isGreatThanOrEqual:{type:["number"],fn:(n,r)=>!Br(n,r),valueType:"number"},dateBefore:{type:["date"],fn:(n,r)=>Mn(n,r),valueType:"date"},dateAfter:{type:["date"],fn:(n,r)=>Tn(n,r),valueType:"date"},isSameDate:{type:["date"],fn:(n,r)=>Dn(n,r),valueType:"date"},isSameDateAsToday:{type:["date"],fn:(n,r)=>On(n,r),valueType:"none"},isExactList:{type:["option","option-multi","link-multi","context-multi","tags-multi"],fn:(n,r)=>_n(n,r),valueType:"list"},isAnyInList:{type:["option","context","link","option-multi","link-multi","context-multi","tags-multi"],fn:(n,r)=>Gr(n,r),valueType:"list"},isNoneInList:{type:["option","context","link","option-multi","link-multi","context-multi","tags-multi"],fn:(n,r)=>!Gr(n,r),valueType:"list"},isTrue:{type:["boolean"],fn:(n,r)=>n=="true",valueType:"none"},isFalse:{type:["boolean"],fn:(n,r)=>n!="true",valueType:"none"}};var Zu=(n,r,s)=>r.reduce((u,d)=>{let[f,m]=u,p=d.type=="context"?Fn(m,d,s):d.type=="path"?Pn(m,d,s):d.type=="frontmatter"?Cn(m,d,s):Nn(m,d,s),y=m.filter(w=>!p.includes(w));return[[...f,...p],y]},[[],n])[0],Ju=(n,r,s)=>r.reduce((o,u)=>u.type=="context"?Fn(o,u,s):u.type=="path"?Pn(o,u,s):u.type=="frontmatter"?Cn(o,u,s):Nn(o,u,s),n),Fn=(n,r,s)=>{let o=ut[r.fn];return!o||o.valueType!="none"&&r.value.length==0?[]:n.filter(u=>{let[d,f]=r.field.split("."),m=u.metadata?.property;if(!u.spaces?.includes(d)||!m||!m[f])return!1;let p=!0;if(o){let y=r.fType=="property"?s[r.value]:r.value;p=o.fn(Hr(f,m[f]),y)}return p})},Cn=(n,r,s)=>{let o=ut[r.fn];return!o||o.valueType!="none"&&r.value.length==0?[]:n.filter(u=>{let d=u.metadata?.property;if(!d||d[r.field]===void 0)return!1;let f=!0;if(o){let m=r.fType=="property"?s[r.value]:r.value;f=o.fn(Hr(r.field,d[r.field]),m)}return f})},Pn=(n,r,s)=>{let o=ut[r.fn];return!o||o.valueType!="none"&&r.value.length==0?[]:n.filter(u=>{let d="";r.field=="outlinks"?d=ot(u.outlinks??[]):r.field=="inlinks"?d=ot(u.metadata?.inlinks??[]):r.field=="tags"&&(d=ot(u.tags??[]));let f=!0;if(o){let m=r.fType=="property"?s[r.value]:r.value;f=o.fn(d,m)}return f})},Nn=(n,r,s)=>{let o=ut[r.fn];return!o||o.valueType!="none"&&r.value.length==0?[]:n.filter(u=>{let d=!0;if(o){let f=r.fType=="property"?s[r.value]:r.value;d=o.fn(u.metadata?.[r.type]?.[r.field],f)}return d})},Yn=(n,r,s)=>n.reduce((u,d)=>!u||d.filters.length==0?!1:d.type=="any"?Zu([r],d.filters,s).length>0:Ju([r],d.filters,s).length>0,!0);function Ce(n){return Array.isArray?Array.isArray(n):Hn(n)==="[object Array]"}var Ku=1/0;function Xu(n){if(typeof n=="string")return n;let r=n+"";return r=="0"&&1/n==-Ku?"-0":r}function ed(n){return n==null?"":Xu(n)}function Se(n){return typeof n=="string"}function Rn(n){return typeof n=="number"}function td(n){return n===!0||n===!1||rd(n)&&Hn(n)=="[object Boolean]"}function Un(n){return typeof n=="object"}function rd(n){return Un(n)&&n!==null}function le(n){return n!=null}function qr(n){return!n.trim().length}function Hn(n){return n==null?n===void 0?"[object Undefined]":"[object Null]":Object.prototype.toString.call(n)}var ad="Incorrect \'index\' type",nd=n=>`Invalid value for key ${n}`,id=n=>`Pattern length exceeds max of ${n}.`,sd=n=>`Missing ${n} property in key`,od=n=>`Property \'weight\' in key \'${n}\' must be a positive integer`,In=Object.prototype.hasOwnProperty,zr=class{constructor(r){this._keys=[],this._keyMap={};let s=0;r.forEach(o=>{let u=Vn(o);this._keys.push(u),this._keyMap[u.id]=u,s+=u.weight}),this._keys.forEach(o=>{o.weight/=s})}get(r){return this._keyMap[r]}keys(){return this._keys}toJSON(){return JSON.stringify(this._keys)}};function Vn(n){let r=null,s=null,o=null,u=1,d=null;if(Se(n)||Ce(n))o=n,r=Wn(n),s=Qr(n);else{if(!In.call(n,"name"))throw new Error(sd("name"));let f=n.name;if(o=f,In.call(n,"weight")&&(u=n.weight,u<=0))throw new Error(od(f));r=Wn(f),s=Qr(f),d=n.getFn}return{path:r,id:s,weight:u,src:o,getFn:d}}function Wn(n){return Ce(n)?n:n.split(".")}function Qr(n){return Ce(n)?n.join("."):n}function ld(n,r){let s=[],o=!1,u=(d,f,m)=>{if(!!le(d))if(!f[m])s.push(d);else{let p=f[m],y=d[p];if(!le(y))return;if(m===f.length-1&&(Se(y)||Rn(y)||td(y)))s.push(ed(y));else if(Ce(y)){o=!0;for(let w=0,x=y.length;wn.score===r.score?n.idx{this._keysMap[s.id]=o})}create(){this.isCreated||!this.docs.length||(this.isCreated=!0,Se(this.docs[0])?this.docs.forEach((r,s)=>{this._addString(r,s)}):this.docs.forEach((r,s)=>{this._addObject(r,s)}),this.norm.clear())}add(r){let s=this.size();Se(r)?this._addString(r,s):this._addObject(r,s)}removeAt(r){this.records.splice(r,1);for(let s=r,o=this.size();s{let f=u.getFn?u.getFn(r):this.getFn(r,u.path);if(!!le(f)){if(Ce(f)){let m=[],p=[{nestedArrIndex:-1,value:f}];for(;p.length;){let{nestedArrIndex:y,value:w}=p.pop();if(!!le(w))if(Se(w)&&!qr(w)){let x={v:w,i:y,n:this.norm.get(w)};m.push(x)}else Ce(w)&&w.forEach((x,b)=>{p.push({nestedArrIndex:b,value:x})})}o.$[d]=m}else if(Se(f)&&!qr(f)){let m={v:f,n:this.norm.get(f)};o.$[d]=m}}}),this.records.push(o)}toJSON(){return{keys:this.keys,records:this.records}}};function jn(n,r,{getFn:s=T.getFn,fieldNormWeight:o=T.fieldNormWeight}={}){let u=new _t({getFn:s,fieldNormWeight:o});return u.setKeys(n.map(Vn)),u.setSources(r),u.create(),u}function pd(n,{getFn:r=T.getFn,fieldNormWeight:s=T.fieldNormWeight}={}){let{keys:o,records:u}=n,d=new _t({getFn:r,fieldNormWeight:s});return d.setKeys(o),d.setIndexRecords(u),d}function Jt(n,{errors:r=0,currentLocation:s=0,expectedLocation:o=0,distance:u=T.distance,ignoreLocation:d=T.ignoreLocation}={}){let f=r/n.length;if(d)return f;let m=Math.abs(o-s);return u?f+m/u:m?1:f}function gd(n=[],r=T.minMatchCharLength){let s=[],o=-1,u=-1,d=0;for(let f=n.length;d=r&&s.push([o,u]),o=-1)}return n[d-1]&&d-o>=r&&s.push([o,d-1]),s}var qe=32;function yd(n,r,s,{location:o=T.location,distance:u=T.distance,threshold:d=T.threshold,findAllMatches:f=T.findAllMatches,minMatchCharLength:m=T.minMatchCharLength,includeMatches:p=T.includeMatches,ignoreLocation:y=T.ignoreLocation}={}){if(r.length>qe)throw new Error(id(qe));let w=r.length,x=n.length,b=Math.max(0,Math.min(o,x)),M=d,S=b,U=m>1||p,q=U?Array(x):[],G;for(;(G=n.indexOf(r,S))>-1;){let j=Jt(r,{currentLocation:G,expectedLocation:b,distance:u,ignoreLocation:y});if(M=Math.min(j,M),S=G+w,U){let A=0;for(;A=me;Q-=1){let H=Q-1,ie=s[n.charAt(H)];if(U&&(q[H]=+!!ie),pe[Q]=(pe[Q+1]<<1|1)&ie,j&&(pe[Q]|=(ne[Q+1]|ne[Q])<<1|1|ne[Q+1]),pe[Q]&xe&&(ee=Jt(r,{errors:j,currentLocation:H,expectedLocation:b,distance:u,ignoreLocation:y}),ee<=M)){if(M=ee,S=H,S<=b)break;me=Math.max(1,2*b-S)}}if(Jt(r,{errors:j+1,currentLocation:b,expectedLocation:b,distance:u,ignoreLocation:y})>M)break;ne=pe}let V={isMatch:S>=0,score:Math.max(.001,ee)};if(U){let j=gd(q,m);j.length?p&&(V.indices=j):V.isMatch=!1}return V}function Sd(n){let r={};for(let s=0,o=n.length;s{this.chunks.push({pattern:b,alphabet:Sd(b),startIndex:M})},x=this.pattern.length;if(x>qe){let b=0,M=x%qe,S=x-M;for(;b{let{isMatch:G,score:ne,indices:ee}=yd(r,S,U,{location:u+q,distance:d,threshold:f,findAllMatches:m,minMatchCharLength:p,includeMatches:o,ignoreLocation:y});G&&(b=!0),x+=ne,G&&ee&&(w=[...w,...ee])});let M={isMatch:b,score:b?x/this.chunks.length:1};return b&&o&&(M.indices=w),M}},we=class{constructor(r){this.pattern=r}static isMultiMatch(r){return An(r,this.multiRegex)}static isSingleMatch(r){return An(r,this.singleRegex)}search(){}};function An(n,r){let s=n.match(r);return s?s[1]:null}var Zr=class extends we{constructor(r){super(r)}static get type(){return"exact"}static get multiRegex(){return/^="(.*)"$/}static get singleRegex(){return/^=(.*)$/}search(r){let s=r===this.pattern;return{isMatch:s,score:s?0:1,indices:[0,this.pattern.length-1]}}},Jr=class extends we{constructor(r){super(r)}static get type(){return"inverse-exact"}static get multiRegex(){return/^!"(.*)"$/}static get singleRegex(){return/^!(.*)$/}search(r){let o=r.indexOf(this.pattern)===-1;return{isMatch:o,score:o?0:1,indices:[0,r.length-1]}}},Kr=class extends we{constructor(r){super(r)}static get type(){return"prefix-exact"}static get multiRegex(){return/^\\^"(.*)"$/}static get singleRegex(){return/^\\^(.*)$/}search(r){let s=r.startsWith(this.pattern);return{isMatch:s,score:s?0:1,indices:[0,this.pattern.length-1]}}},Xr=class extends we{constructor(r){super(r)}static get type(){return"inverse-prefix-exact"}static get multiRegex(){return/^!\\^"(.*)"$/}static get singleRegex(){return/^!\\^(.*)$/}search(r){let s=!r.startsWith(this.pattern);return{isMatch:s,score:s?0:1,indices:[0,r.length-1]}}},ea=class extends we{constructor(r){super(r)}static get type(){return"suffix-exact"}static get multiRegex(){return/^"(.*)"\\$$/}static get singleRegex(){return/^(.*)\\$$/}search(r){let s=r.endsWith(this.pattern);return{isMatch:s,score:s?0:1,indices:[r.length-this.pattern.length,r.length-1]}}},ta=class extends we{constructor(r){super(r)}static get type(){return"inverse-suffix-exact"}static get multiRegex(){return/^!"(.*)"\\$$/}static get singleRegex(){return/^!(.*)\\$$/}search(r){let s=!r.endsWith(this.pattern);return{isMatch:s,score:s?0:1,indices:[0,r.length-1]}}},Xt=class extends we{constructor(r,{location:s=T.location,threshold:o=T.threshold,distance:u=T.distance,includeMatches:d=T.includeMatches,findAllMatches:f=T.findAllMatches,minMatchCharLength:m=T.minMatchCharLength,isCaseSensitive:p=T.isCaseSensitive,ignoreLocation:y=T.ignoreLocation}={}){super(r),this._bitapSearch=new Kt(r,{location:s,threshold:o,distance:u,includeMatches:d,findAllMatches:f,minMatchCharLength:m,isCaseSensitive:p,ignoreLocation:y})}static get type(){return"fuzzy"}static get multiRegex(){return/^"(.*)"$/}static get singleRegex(){return/^(.*)$/}search(r){return this._bitapSearch.searchIn(r)}},er=class extends we{constructor(r){super(r)}static get type(){return"include"}static get multiRegex(){return/^\'"(.*)"$/}static get singleRegex(){return/^\'(.*)$/}search(r){let s=0,o,u=[],d=this.pattern.length;for(;(o=r.indexOf(this.pattern,s))>-1;)s=o+d,u.push([o,s-1]);let f=!!u.length;return{isMatch:f,score:f?0:1,indices:u}}},ra=[Zr,er,Kr,Xr,ta,ea,Jr,Xt],Ln=ra.length,wd=/ +(?=(?:[^\\"]*\\"[^\\"]*\\")*[^\\"]*$)/,xd="|";function vd(n,r={}){return n.split(xd).map(s=>{let o=s.trim().split(wd).filter(d=>d&&!!d.trim()),u=[];for(let d=0,f=o.length;d!!(n[tr.AND]||n[tr.OR]),_d=n=>!!n[sa.PATH],Td=n=>!Ce(n)&&Un(n)&&!oa(n),En=n=>({[tr.AND]:Object.keys(n).map(r=>({[r]:n[r]}))});function $n(n,r,{auto:s=!0}={}){let o=u=>{let d=Object.keys(u),f=_d(u);if(!f&&d.length>1&&!oa(u))return o(En(u));if(Td(u)){let p=f?u[sa.PATH]:d[0],y=f?u[sa.PATTERN]:u[p];if(!Se(y))throw new Error(nd(p));let w={keyId:Qr(p),pattern:y};return s&&(w.searcher=ia(y,r)),w}let m={children:[],operator:d[0]};return d.forEach(p=>{let y=u[p];Ce(y)&&y.forEach(w=>{m.children.push(o(w))})}),m};return oa(n)||(n=En(n)),o(n)}function Md(n,{ignoreFieldNorm:r=T.ignoreFieldNorm}){n.forEach(s=>{let o=1;s.matches.forEach(({key:u,norm:d,score:f})=>{let m=u?u.weight:null;o*=Math.pow(f===0&&m?Number.EPSILON:f,(m||1)*(r?1:d))}),s.score=o})}function Dd(n,r){let s=n.matches;r.matches=[],le(s)&&s.forEach(o=>{if(!le(o.indices)||!o.indices.length)return;let{indices:u,value:d}=o,f={indices:u,value:d};o.key&&(f.key=o.key.src),o.idx>-1&&(f.refIndex=o.idx),r.matches.push(f)})}function Od(n,r){r.score=n.score}function Fd(n,r,{includeMatches:s=T.includeMatches,includeScore:o=T.includeScore}={}){let u=[];return s&&u.push(Dd),o&&u.push(Od),n.map(d=>{let{idx:f}=d,m={item:r[f],refIndex:f};return u.length&&u.forEach(p=>{p(d,m)}),m})}var Pe=class{constructor(r,s={},o){this.options={...T,...s},this.options.useExtendedSearch,this._keyStore=new zr(this.options.keys),this.setCollection(r,o)}setCollection(r,s){if(this._docs=r,s&&!(s instanceof _t))throw new Error(ad);this._myIndex=s||jn(this.options.keys,this._docs,{getFn:this.options.getFn,fieldNormWeight:this.options.fieldNormWeight})}add(r){!le(r)||(this._docs.push(r),this._myIndex.add(r))}remove(r=()=>!1){let s=[];for(let o=0,u=this._docs.length;o-1&&(p=p.slice(0,s)),Fd(p,this._docs,{includeMatches:o,includeScore:u})}_searchStringList(r){let s=ia(r,this.options),{records:o}=this._myIndex,u=[];return o.forEach(({v:d,i:f,n:m})=>{if(!le(d))return;let{isMatch:p,score:y,indices:w}=s.searchIn(d);p&&u.push({item:d,idx:f,matches:[{score:y,value:d,norm:m,indices:w}]})}),u}_searchLogical(r){let s=$n(r,this.options),o=(m,p,y)=>{if(!m.children){let{keyId:x,searcher:b}=m,M=this._findMatches({key:this._keyStore.get(x),value:this._myIndex.getValueForItemAtKeyId(p,x),searcher:b});return M&&M.length?[{idx:y,item:p,matches:M}]:[]}let w=[];for(let x=0,b=m.children.length;x{if(le(m)){let y=o(s,m,p);y.length&&(d[p]||(d[p]={idx:p,item:m,matches:[]},f.push(d[p])),y.forEach(({matches:w})=>{d[p].matches.push(...w)}))}}),f}_searchObjectList(r){let s=ia(r,this.options),{keys:o,records:u}=this._myIndex,d=[];return u.forEach(({$:f,i:m})=>{if(!le(f))return;let p=[];o.forEach((y,w)=>{p.push(...this._findMatches({key:y,value:f[w],searcher:s}))}),p.length&&d.push({idx:m,item:f,matches:p})}),d}_findMatches({key:r,value:s,searcher:o}){if(!le(s))return[];let u=[];if(Ce(s))s.forEach(({v:d,i:f,n:m})=>{if(!le(d))return;let{isMatch:p,score:y,indices:w}=o.searchIn(d);p&&u.push({score:y,key:r,value:d,idx:f,norm:m,indices:w})});else{let{v:d,n:f}=s,{isMatch:m,score:p,indices:y}=o.searchIn(d);m&&u.push({score:p,key:r,value:d,norm:f,indices:y})}return u}};Pe.version="7.0.0";Pe.createIndex=jn;Pe.parseIndex=pd;Pe.config=T;Pe.parseQuery=$n;kd(aa);function Bn(n){let{query:r,pathsIndex:s,count:o}=n,u=[],d={shouldSort:!0,threshold:0,ignoreLocation:!0,keys:[{name:"name",weight:2},"path","label.preview",{name:"spaceNames",weight:.5}]};return new Pe([...s.values()].filter(m=>m.hidden==!1),d).search(r).map(m=>m.item).slice(0,o)}function Gn(n){let{queries:r,pathsIndex:s,count:o}=n,u=[];for(let[d,f]of s)!f.hidden&&Yn(r,f,{})&&u.push(f);return u.slice(0,o)}var Cd=self;Cd.onmessage=async n=>{let{payload:r,job:s}=n.data,o;s.type=="search"&&(o=Gn(r)),s.type=="fastSearch"&&(o=Bn(r));try{postMessage({job:s,result:o})}catch(u){console.log(u),postMessage({job:s,result:{$error:`Failed to run ${s.type} ${s.path}: ${u}`}})}};\n//! authors : Tim Wood, Iskren Chernev, Moment.js contributors\n//! license : MIT\n//! moment.js\n//! momentjs.com\n//! version : 2.29.4\n',{name:"Superstate Search"})}var pR=class{constructor(t,r){this.numWorkers=t;this.cache=r;this.workers=[],this.busy=[],this.reloadQueue=[],this.reloadSet=new Set,this.callbacks=new Map;for(let n=0;nthis.finish(a.data.job,a.data.result,n),this.workers.push(i),this.busy.push(!1)}}run(t){let r=ME(t),n=new Promise((a,o)=>{this.callbacks.has(r)?this.callbacks.get(r)?.push([a,o]):this.callbacks.set(r,[[a,o]])});if(this.reloadSet.has(r))return n;this.reloadSet.add(r);let i=this.nextAvailableWorker();return i!==void 0?this.send(t,i):this.reloadQueue.push(t),n}finish(t,r,n){let i=ME(t),a=[].concat(this.callbacks.get(i)??[]);this.reloadSet.delete(i),this.callbacks.delete(i),this.busy[n]=!1;let o=this.reloadQueue.shift();if(o!==void 0&&this.send(o,n),"$error"in r)for(let[s,l]of a)l(r.$error);else for(let[s,l]of a)s(r)}async send(t,r){t.type=="search"&&(this.message(r,{job:t,payload:{queries:t.payload.queries,pathsIndex:this.cache.pathsIndex,count:t.payload.count}}),this.busy[r]=!0),t.type=="fastSearch"&&(this.message(r,{job:t,payload:{query:t.payload.query,pathsIndex:this.cache.pathsIndex,count:t.payload.count}}),this.busy[r]=!0)}message(t,r){this.workers[t].postMessage(r)}nextAvailableWorker(){let t=this.busy.indexOf(!1);return t==-1?void 0:t}};var jE=class{constructor(t,r,n,i,a){this.indexVersion=t;this.onChange=r;this.kit=[jv,C9,N9,M9,j9,tje,T9,mD,NEe,aje,fje,cje,oje,lje,sje,uje,dje,pje,Aje,gje,nje,rje,D9,xh,hje,uR,O9,gO,mje,ije,vje];this.eventsDispatcher=new n0;let o={...TV,createAdd:V("add",[],()=>function(f,d){return f+d}),createEqual:V("equal",[],()=>function(f,d){return f==d}),createUnequal:V("unequal",[],()=>function(f,d){return f!=d})},l=GB(o,{matrix:"Array"});l.import(dC,{override:!0}),this.formulaContext=l,this.initialized=!1,this.spaceManager=n,this.spaceManager.superstate=this,this.ui=i,this.ui.superstate=this,this.cli=a;let u=new fR(this.cli,this);this.cli.superstate=this,this.cli.terminals.splice(0,0,u),this.cli.mainTerminal=u,this.allMetadata={},this.api=new cR(this),this.pathsIndex=new Map,this.spacesIndex=new Map,this.contextsIndex=new Map,this.actionsIndex=new Map,this.kitFrames=new Map,this.kits=new Map,this.actions=new Map,this.templateCache=new Map,this.focuses=[],this.spacesMap=new op,this.linksMap=new op,this.tagsMap=new op,this.liveSpaceLinkMap=new op,this.iconsCache=new Map,this.imagesCache=new Map,this.contextStateQueue=Promise.resolve(),this.indexer=new dR(2,this),this.searcher=new pR(1,this)}static create(t,r,n,i,a){return new jE(t,r,n,i,a)}search(t,r,n){return r?this.searcher.run({type:"fastSearch",path:t,payload:{query:r,count:10}}):this.searcher.run({type:"search",path:t,payload:{queries:n,count:10}})}refreshMetadata(){this.allMetadata=_9(this)}async initializeIndex(){await this.loadFromCache()}addToContextStateQueue(t){this.contextStateQueue=this.contextStateQueue.then(t).catch(()=>{})}async initialize(){if(!this.persister){console.log("Cache Persister Not Found");return}let t=Date.now();this.initializeActions(),this.initializeFocuses(),this.initializeKits(),this.initializeTemplates(),this.settings.spacesEnabled&&await this.initializeSpaces(),await this.initializeBuiltins(),await this.initializeTags(),await this.initializePaths(),await this.initializeContexts(),await this.initializeFrames(),this.refreshMetadata(),this.dispatchEvent("superstateUpdated",null),this.ui.notify(`Make.md - Superstate Loaded in ${(Date.now()-t)/1e3} seconds`,"console"),this.persister.cleanType("space"),this.persister.cleanType("path"),this.persister.cleanType("context"),this.persister.cleanType("frame")}async reloadSystemActions(){(await this.spaceManager.readSystemCommands()).forEach(r=>this.actions.set(r.name,r.commands)),this.dispatchEvent("actionStateUpdated",{path:"spaces://$actions"})}async initializeActions(){await this.reloadSystemActions();let t=this.allSpaces().filter(r=>r.type!="default").map(r=>r.space).map(r=>this.reloadActions(r));await Promise.all(t)}async initializeKits(){let t=await this.spaceManager.readAllKits();t.forEach(r=>this.kits.set(r.id,r)),t.length==0&&this.kits.set("default",{id:"default",name:"Default",colors:{},frames:[]}),this.selectedKit=this.kits.get(this.settings.selectedKit)??this.kits.get("default"),this.selectedKit.frames=[...this.selectedKit.frames,...this.kit.map(r=>nj(r)).filter(r=>!this.selectedKit.frames.some(n=>n.schema.id==r.schema.id))];for(let r of this.selectedKit.frames){let n=Ao(r.schema).def.id,i=await rj(this,r,{...c0,screenType:this.ui.getScreenType()});this.kitFrames.set(n,i)}this.dispatchEvent("frameStateUpdated",{path:"spaces://$kit"})}async initializeTemplates(){let t=await this.spaceManager.readAllTemplates();Object.keys(t).forEach(r=>{this.templateCache.set(r,t[r])})}async initializeSpaces(){let t=[...this.spaceManager.allSpaces().values()],r=t.map(n=>this.reloadSpace(n,null,!0));[...this.spacesIndex.keys()].filter(n=>!t.some(i=>i.path==n)).forEach(n=>this.onSpaceDeleted(n)),await Promise.all(r)}getSpaceItems(t,r){let n=[...this.spacesMap.getInverse(t)],i=this.contextsIndex.get(t)?.paths??[];return n.map((a,o)=>({...this.pathsIndex.get(a),rank:i.indexOf(a)})).filter(a=>a?.hidden!=!0&&a.path!=t)}async initializeFrames(){await this.initializeTemplates()}async initializeContexts(){await this.indexer.reload({type:"contexts",path:""}).then(async t=>{let r=[...t.entries()].map(([n,{cache:i,changed:a}])=>this.contextReloaded(n,i,a,!0));await Promise.all(r)})}async loadFromCache(){if(this.dispatchEvent("superstateReindex",null),this.settings.indexSVG){let i=await this.persister.loadAll("icon");this.spaceManager.allPaths(["svg"]).forEach(a=>{let o=i.find(s=>s.path==a);o?.cache.length>0&&this.iconsCache.set(a,o.cache)})}let t=await this.persister.loadAll("path"),r=await this.persister.loadAll("space"),n=await this.persister.loadAll("context");r.forEach(i=>{let a=or(i.cache);a&&a.type&&this.spacesIndex.set(i.path,a)}),n.forEach(i=>{let a=or(i.cache);a&&this.contextsIndex.set(i.path,a)}),t.forEach(i=>{let a=S7(i.cache);this.pathsIndex.set(i.path,a),this.tagsMap.set(i.path,new Set(a.tags)),this.spacesMap.set(i.path,new Set(a.spaces)),this.linksMap.set(i.path,new Set(a.outlinks))}),this.settings.enhancedLogs&&console.log("Initial Cache Loaded"),this.dispatchEvent("superstateUpdated",null)}dispatchEvent(t,r){this.eventsDispatcher.dispatchEvent(t,r)}async initializeBuiltins(){let r=Object.keys(Im).map(n=>this.reloadPath("spaces://$"+n,!0));await Promise.all(r)}async initializeTags(){let r=[...this.spaceManager.readTags().map(n=>Wn(n))].map(n=>this.reloadPath(n,!0));await Promise.all(r)}async onSpaceDefinitionChanged(t,r){if(t.space.readOnly)return;let n=this.spacesMap.getInverse(t.path),i=[];if(t.metadata?.links&&!t1.default.isEqual(t.metadata.links,r?.links)&&i.push(...t.metadata.links),t.metadata?.filters?.length>0){let s=t.metadata.filters.some(l=>l.filters.some(u=>u.fType=="property"));if(!t1.default.isEqual(t.metadata?.filters,r?.filters)||s)for(let[l,u]of this.pathsIndex)!u.hidden&&P9(t.metadata?.filters,u,t.properties)&&i.push(l)}let o=[...t1.default.difference(i,[...n]),...t1.default.difference([...n],i)].map(s=>this.reloadPath(s,!0).then(l=>this.dispatchEvent("pathStateUpdated",{path:s})));await Promise.all(o)}async initializeFocuses(){let t=await this.spaceManager.readFocuses();if(t.length==0){this.spaceManager.saveFocuses([{name:"Home",sticker:"ui//home",paths:["/"]}]);return}this.focuses=t,this.dispatchEvent("focusesChanged",null)}async initializePaths(){this.dispatchEvent("superstateReindex",null);let t=this.spaceManager.allPaths(),r=Date.now();await this.indexer.reload({type:"paths",path:""}).then(async i=>{for await(let[a,{cache:o,changed:s}]of Object.entries(i))await this.pathReloaded(a,o,s,!1)}),this.ui.notify(`Make.md - ${t.length} Paths Cached in ${(Date.now()-r)/1e3} seconds`,"console");let n=kr([...this.spacesIndex.keys(),...t]);[...this.pathsIndex.keys()].filter(i=>!n.some(a=>a==i)).forEach(i=>this.onPathDeleted(i)),this.dispatchEvent("superstateUpdated",null)}async onTagRenamed(t,r){let n=SJ(t),i=p0(this.spaceManager,r);await this.onSpaceRenamed(n,i),await this.onPathRename(n,i.path),this.dispatchEvent("spaceChanged",{path:n,newPath:i.path});let a=[];for(let[o,s]of this.spacesIndex)this.contextsIndex.get(o)?.contexts.includes(t)&&this.addToContextStateQueue(()=>Boe(this.spaceManager,t,r,a)),s.metadata?.contexts.includes(t)&&du(this,s.space,{...s.metadata,contexts:s.metadata.contexts.map(u=>u==t?r:u)});this.dispatchEvent("spaceStateUpdated",{path:kx})}async onTagDeleted(t){this.tagsMap.getInverse(t).forEach(i=>{this.deleteTagInPath(t,i)});let r=FM(t,this.settings);await this.spaceManager.deletePath(r),this.onSpaceDeleted(Wn(t));for(let[i,a]of this.spacesIndex)a.metadata?.contexts.includes(t)&&du(this,a.space,{...a.metadata,contexts:a.metadata.contexts.filter(o=>o!=t)});let n=[];for(let[i,a]of this.contextsIndex)a.contexts.includes(t)&&n.push(this.spaceManager.spaceInfoForPath(a.path));this.addToContextStateQueue(()=>Roe(this.spaceManager,t,n)),this.dispatchEvent("spaceStateUpdated",{path:kx})}async deleteTagInPath(t,r){let n;if(this.pathsIndex.has(r)&&(n=this.pathsIndex.get(r)),n){let i={...n,tags:n.tags.filter(a=>a!=t),spaces:n.spaces.filter(a=>a!=Wn(t))};this.pathsIndex.set(r,i),this.tagsMap.set(r,new Set(i.tags)),this.spacesMap.set(r,new Set(i.spaces))}else await this.reloadPath(r);this.onPathReloaded(r),this.dispatchEvent("pathStateUpdated",{path:r})}onMetadataChange(t){this.settings.enhancedLogs&&console.log("Metadata Changed",t),this.pathsIndex.has(t)&&this.reloadPath(t).then(r=>{let n=this.pathsIndex.get(t),i=this.spacesIndex.get(t);i&&this.reloadSpace(i.space).then(o=>this.onSpaceDefinitionChanged(o,i.metadata));let a=n.spaces.map(o=>this.spacesIndex.get(o)?.space).filter(o=>o);this.addToContextStateQueue(()=>GU(this,t,a)),this.dispatchEvent("pathStateUpdated",{path:t})})}reloadSpaceByPath(t,r){return this.reloadSpace(this.spaceManager.spaceInfoForPath(t),r)}async onPathRename(t,r){let n=r,i=this.pathsIndex.get(t),a=i?.spaces??[];if(i){this.spacesMap.delete(t),this.spacesMap.deleteInverse(t),this.linksMap.delete(t),this.linksMap.deleteInverse(t),this.pathsIndex.delete(t);let u=a.map(f=>this.spacesIndex.get(f)).filter(f=>f);await Uoe(this.spaceManager,t,n,u.map(f=>f.space));for(let f of u)f.metadata?.links?.includes(t)&&this.addToContextStateQueue(()=>mC(this,f.path,"links",f.metadata.links.map(d=>d==t?r:d))),await this.reloadContext(f.space,!0);let c=[];for(let[f,d]of this.contextsIndex)d.outlinks.includes(t)&&c.push(this.spacesIndex.get(d.path).space);this.addToContextStateQueue(()=>Loe(this.spaceManager,t,n,c).then(f=>Promise.all(c.map(d=>this.reloadContext(d,!0)))))}let o=!1;this.focuses.forEach(u=>{u.paths.includes(t)&&(u.paths=u.paths.map(c=>c==t?r:c),o=!0)}),o&&(await this.spaceManager.saveFocuses(this.focuses),this.dispatchEvent("focusesChanged",null)),await this.reloadPath(r,!0);let s=kr([...this.spacesMap.get(r)??[],...a]),l=s.map(u=>this.reloadContext(this.spacesIndex.get(u)?.space));await Promise.all(l),s.forEach(u=>this.dispatchEvent("spaceStateUpdated",{path:u})),this.dispatchEvent("pathChanged",{path:t,newPath:r}),this.ui.viewsByPath(t).forEach(u=>{u.openPath(r)})}async onPathCreated(t){await this.reloadPath(t,!0);let r=Fu(t);this.spacesIndex.has(r)&&this.spacesIndex.get(r).space.notePath==t&&await this.reloadSpace(this.spacesIndex.get(r).space),this.dispatchEvent("pathCreated",{path:t})}onPathDeleted(t){this.spacesMap.delete(t),this.linksMap.delete(t),this.linksMap.deleteInverse(t),this.persister.remove(t,"path");let r=this.pathsIndex.get(t);if(!r)return;let n=(r.spaces??[]).map(a=>this.spacesIndex.get(a)?.space).filter(a=>a);this.addToContextStateQueue(()=>Woe(this.spaceManager,t,n).then(a=>n.forEach(o=>this.reloadContext(o))));let i=[];for(let[a,o]of this.contextsIndex)o.outlinks.includes(t)&&this.spacesIndex.has(o.path)&&i.push(this.spacesIndex.get(o.path).space);this.addToContextStateQueue(()=>zoe(this.spaceManager,t,i).then(a=>n.forEach(o=>this.reloadContext(o)))),(r.spaces??[]).forEach(a=>{this.dispatchEvent("spaceStateUpdated",{path:a})}),this.pathsIndex.delete(t),this.dispatchEvent("pathDeleted",{path:t})}async onSpaceRenamed(t,r){if(this.spacesIndex.has(t)){let n=this.spacesIndex.get(t).metadata;this.spacesIndex.set(r.path,{...this.spacesIndex.get(t),path:r.path,name:r.name,space:r}),this.spacesMap.rename(t,r.path),this.spacesMap.renameInverse(t,r.path),this.spacesIndex.delete(t),this.contextsIndex.delete(t),this.actionsIndex.delete(t),await this.reloadSpace(r,n).then(i=>this.onSpaceDefinitionChanged(i,n)),await this.reloadContext(r,!0),await this.reloadActions(r)}}onSpaceDeleted(t){this.spacesIndex.has(t)&&(this.spacesIndex.delete(t),this.contextsIndex.delete(t)),this.spacesMap.delete(t),this.spacesMap.deleteInverse(t),this.persister.remove(t,"space"),this.dispatchEvent("spaceDeleted",{path:t})}async reloadActions(t){if(!t)return!1;this.spaceManager.commandsForSpace(t.path).then(r=>{this.actionsIndex.set(t.path,r),this.dispatchEvent("actionStateUpdated",{path:t.path})})}async reloadContextByPath(t,r){return this.reloadContext(this.spaceManager.spaceInfoForPath(t),r)}async reloadContext(t,r){return t?this.indexer.reload({type:"context",path:t.path}).then(n=>this.contextReloaded(t.path,n.cache,n.changed,r)):!1}async contextReloaded(t,r,n,i){if(!r||(this.settings.enhancedLogs&&console.log("Context Reloaded"),!n&&!i))return!1;this.contextsIndex.set(t,r);let a=this.pathsIndex.get(t);if(a&&r.dbExists&&!a.readOnly&&this.settings.syncFormulaToFrontmatter){let o=r.contextTable?.rows??[],s=r.contextTable?.cols??[],l=o.filter(u=>{let c=u[mt],f=this.pathsIndex.get(c);return!f||f.type=="file"&&f.subtype!="md"?!1:s.reduce((d,p,h)=>d||p.type!="fileprop"||p.primary=="true"?d:u[p.name]?.length>0&&f.metadata?.property?.[p.name]!=u[p.name]?!0:d,!1)});l.length>0&&l.forEach(u=>pi(this,u[mt],s.reduce((c,f,d)=>f.type=="fileprop"&&f.primary!="true"?{...c,[f.name]:la(ho(f),u[f.name],!0)}:c,{})))}return r.dbExists&&n&&await this.spaceManager.saveTable(t,r.contextTable),this.persister.store(t,JSON.stringify(r),"context"),this.dispatchEvent("contextStateUpdated",{path:t}),!0}allSpaces(t){return t?gJ([...this.spacesIndex.values()],this.spaceOrder(),"path"):[...this.spacesIndex.values()]}spaceOrder(){return[...this.focuses.flatMap(t=>t.paths)]}async updateSpaceMetadata(t,r){let n=this.spacesIndex.get(t),i=n?.metadata;if(!n)return this.reloadSpaceByPath(t);let a=!1,s=(r?.sort??{field:"rank",asc:!0,group:!0}).field=="rank";(!t1.default.isEqual(n.metadata.links,r.links)||!t1.default.isEqual(n.metadata.filters,r.filters))&&(a=!0);let l={...n,metadata:r,contexts:r?.contexts??[],sortable:s};return this.spacesIndex.set(t,l),a&&await this.onSpaceDefinitionChanged(l,i),this.dispatchEvent("spaceStateUpdated",{path:n.path}),l}async reloadSpace(t,r,n=!0){if(!t)return;this.settings.enhancedLogs&&console.log("Reloading Space");let i=r??await this.spaceManager.spaceDefForSpace(t.path),a=this.pathsIndex.get(t.path),o=this.spaceManager.uriByString(t.path);if(!o)return null;let s=this.spaceManager.spaceTypeByString(o);(s=="default"||s=="tag")&&(i.filters=[],i.links=[]);let l=[],u={},c=await this.spaceManager.readFrame(t.path,j1).then(b=>b?.cols??[]);if(l.push(...c),l.length>0){if(!a)if(this.settings.enableFolderNote){let b=await this.spaceManager.readPathCache(t.notePath);a={path:t.path,name:t.name,tags:[],spaces:[],outlinks:[],readOnly:t.readOnly,hidden:!1,metadata:b?.metadata,type:"space",subtype:s,label:b?.label}}else{let b=await this.spaceManager.readPathCache(t.path);a={path:t.path,name:t.name,tags:[],spaces:[],outlinks:[],readOnly:t.readOnly,hidden:!1,metadata:b?.metadata,type:"space",subtype:s,label:b?.label}}u=await this.spaceManager.readProperties(t.notePath).then(b=>nh(this.formulaContext,this.pathsIndex,this.spacesMap,b,l,a))}[...this.spacesMap.get(t.path)].map(b=>this.contextsIndex.get(b)).forEach(b=>{if(b){let v=b.contextTable?.cols??[];l.push(...v),u={...u,...b.contextTable?.rows.find(x=>x[mt]==t.path)??{}}}});let f=i?.sort??{field:"rank",asc:!0,group:!0},d=f.field=="rank"||!f,p=i?.contexts??[],h=kr((i.filters??[]).flatMap(b=>b.filters).flatMap(b=>b.type=="context"?[b.field.split(".")[0]]:b.type=="path"&&b.field=="space"?sr(b.value):[])),m=kr((i.filters??[]).flatMap(b=>b.filters).flatMap(b=>b.type.startsWith("link")?sr(b.value):[]));if(s=="tag"&&this.settings.autoAddContextsToSubtags){let b=XJ(t.name);p.push(...b)}let g=await this.spaceManager.readTemplates(t.path),A={name:t.name,space:t,path:t.path,type:s,templates:g,contexts:p.map(b=>b.toLowerCase()),metadata:i,dependencies:h,sortable:d,properties:u,propertyTypes:l};if(this.spacesIndex.set(t.path,A),this.persister.store(t.path,JSON.stringify(A),"space"),A.metadata?.links?.forEach(b=>{ree(this,b)&&this.spacesMap.set(b,new Set([...this.spacesMap.get(b),t.path]))}),n)return this.dispatchEvent("spaceStateUpdated",{path:t.path}),A}async pathReloaded(t,r,n,i){if(!r||(this.settings.enhancedLogs&&console.log("Path Reloaded"),this.pathsIndex.set(t,r),await this.onPathReloaded(t),(r.subtype=="image"||r.metadata?.file?.extension=="svg")&&this.imagesCache.set(r.metadata.file.filename,t),!n&&!i))return!1;if(this.tagsMap.set(t,new Set(r.tags)),this.linksMap.set(t,new Set(r.outlinks)),!t1.default.isEqual(r.spaces,Array.from(this.spacesMap.get(t)))){this.spacesMap.set(t,new Set(r.spaces));let a=r.tags.map(s=>p0(this.spaceManager,s)).filter(s=>!this.spacesIndex.has(s.path)).map(async s=>{await this.reloadSpace(s),this.reloadContext(s),await this.reloadPath(s.path)});await Promise.all(a).then(s=>{this.dispatchEvent("spaceStateUpdated",{path:kx})})}if(i){let a=r.spaces.map(o=>this.spacesIndex.get(o)?.space).filter(o=>o);this.addToContextStateQueue(()=>GU(this,t,a).then(o=>{a.forEach(s=>{this.dispatchEvent("spaceStateUpdated",{path:s.path})})}))}r.metadata?.file?.extension=="svg"&&this.settings.indexSVG&&this.spaceManager.readPath(t).then(a=>{this.iconsCache.set(t,a),this.persister.store(t,a,"icon")})}async reloadPath(t,r){return t?this.indexer.reload({type:"path",path:t}).then(async n=>(await this.pathReloaded(t,n.cache,n.changed,r),!0)):!1}async onPathReloaded(t){let r;if(this.pathsIndex.has(t)&&(r=this.pathsIndex.get(t)),!r)return!1;await this.persister.store(t,eje(r),"path")}};var yje=.999,mR=class extends Su.Plugin{constructor(){super(...arguments);this.debouncedRefresh=()=>null;this.metadataChange=r=>{this.markdownAdapter.metadataChange(r)};this.onDelete=async r=>{this.activeFileChange()};this.onRename=async(r,n)=>{this.activeFileChange()};this.openFileTreeLeaf=async r=>{if(this.app.workspace.getLeavesOfType(qf).length==0){let i=this.superstate.settings.spacesRightSplit?this.app.workspace.getRightLeaf(!1):this.app.workspace.getLeftLeaf(!1);await i.setViewState({type:qf}),r&&!this.app.workspace.leftSplit.collapsed&&this.app.workspace.revealLeaf(i)}else if(!this.app.workspace.leftSplit.collapsed&&r){let i=this.app.workspace.getLeavesOfType(qf);for(let o of i)o.view instanceof uE&&o.view.destroy(),o.detach();let a=this.superstate.settings.spacesRightSplit?this.app.workspace.getRightLeaf(!1):this.app.workspace.getLeftLeaf(!1);await a.setViewState({type:qf}),this.app.workspace.revealLeaf(a)}Gr(this.superstate.ui)&&this.app.workspace.leftSplit.collapse(),this.closeDuplicateTabs()};this.closeDuplicateTabs=()=>{try{this.app.workspace.leftSplit.children[0].children.filter((r,n,i)=>n!=i.findIndex(a=>a.view.getViewType()==r.view.getViewType())).forEach(r=>this.app.workspace.leftSplit.children[0].removeChild(r))}catch{}};this.detachFileTreeLeafs=()=>{let r=this.app.workspace.getLeavesOfType(qf);for(let n of r)n.view instanceof uE&&n.view.destroy(),n.detach()};this.detachFileContextLeafs=()=>{let r=this.app.workspace.getLeavesOfType(Db);for(let n of r)n.view instanceof XD&&n.view.destroy(),n.detach()};this.openFileContextLeaf=async(r,n)=>{let i=this.app.workspace.getLeavesOfType(r);if(i.length==0){let a=this.app.workspace.getRightLeaf(!1);await a.setViewState({type:r}),this.app.workspace.revealLeaf(a)}else i.forEach(a=>this.app.workspace.revealLeaf(a));Gr(this.superstate.ui)&&!n&&this.app.workspace.rightSplit.collapse()};this.refreshFileContextLeafs=()=>{this.detachFileContextLeafs(),this.openFileContextLeaf(Db)}}quickOpen(r,n,i,a){let o=Ne(this.app.workspace.getLeaf()?.containerEl.ownerDocument);X6e(r,n,o,i,a)}loadSuperState(){this.app.workspace.onLayoutReady(async()=>{this.superstate.settings.spacesEnabled?(await this.superstate.initializeIndex(),this.obsidianAdapter.loadCacheFromObsidianCache(),this.superstate.settings.navigatorEnabled&&this.openFileTreeLeaf(this.superstate.settings.openSpacesOnLaunch)):(await this.superstate.loadFromCache(),this.superstate.initialize()),this.registerEvent(this.app.vault.on("delete",this.onDelete)),this.registerEvent(this.app.vault.on("rename",this.onRename)),this.app.metadataCache.on("changed",this.metadataChange),yje>this.superstate.settings.releaseNotesPrompt&&(this.releaseTheNotes(),this.superstate.settings.releaseNotesPrompt=yje,this.saveSettings()),this.superstate.settings.firstLaunch||(this.getStarted(),this.superstate.settings.firstLaunch=!0,this.saveSettings())})}loadViews(){this.registerView(Lh,r=>new u7(r,this.superstate,this.ui)),this.registerView(qf,r=>new uE(r,this.superstate,this.ui)),this.registerView(bu,r=>new Sb(r,this.superstate,this.ui,bu)),this.registerView(ZD,r=>new l7(r,this)),this.registerView(Eb,r=>new r7(r,this)),this.superstate.settings.contextEnabled&&(this.registerView(kb,r=>new o7(r,this.app,kb,this.superstate)),this.registerView(Db,r=>new XD(r,this.superstate,this.ui)),this.registerView(f7,r=>new c7(r,this)))}async loadSpaces(){document.body.querySelector(".app-container").setAttribute("vaul-drawer-wrapper",""),document.body.classList.toggle("mk-spaces-right",this.superstate.settings.spacesRightSplit),document.body.classList.toggle("mk-readable-line",this.app.vault.getConfig("readableLineLength")),this.superstate.settings.readableLineWidth=this.app.vault.getConfig("readableLineLength"),this.superstate.settings.spacesEnabled&&(document.body.classList.toggle("mk-hide-tabs",!this.superstate.settings.sidebarTabs),document.body.classList.toggle("mk-hide-ribbon",!this.superstate.settings.showRibbon),document.body.classList.toggle("mk-folder-lines",this.superstate.settings.folderIndentationLines),this.app.vault.config.cssTheme=="Minimal"&&document.body.classList.toggle("mk-minimal-fix",!0),document.body.classList.toggle("mk-spaces-enabled",this.superstate.settings.spacesEnabled),!this.superstate.settings.spacesDisablePatch&&this.superstate.settings.navigatorEnabled&&iOe(this)),this.registerEvent(this.app.workspace.on("active-leaf-change",()=>this.activeFileChange())),this.registerEvent(this.app.workspace.on("layout-change",()=>{this.activeFileChange()}))}convertPathToSpace(){if(this.app.workspace.activeLeaf?.view.getViewType()=="markdown"){let n=this.app.workspace.getActiveViewOfType(Su.MarkdownView);n instanceof Su.MarkdownView&&n.file instanceof Su.TFile&&TM(this.superstate,n.file.path,!0)}else this.superstate.ui.notify(H.notice.cantConvertNoteToSpace)}toggleExperimental(){this.superstate.settings.experimental=!this.superstate.settings.experimental,this.saveSettings()}getActiveFile(){let r=null,n=null,i=this.app.workspace.getActiveViewOfType(Su.MarkdownView)?.leaf;i||(i=this.app.workspace.getActiveViewOfType(Sb)?.leaf);let a=i?.view;return!a||i.isFlowBlock||(a.getViewType()==bu?(rO(this),n=a.getState(),r=a.getState().path):a.getViewType()=="markdown"&&(r=a.file.path,n=a.getState(),oOe(this),rO(this)),!r||!n)?null:{path:r,state:n}}fixFileWarnings(){NX(this)}activeFileChange(){let r=this.getActiveFile();if(r){if(this.superstate.ui.activePath==r?.path){this.superstate.ui.setActiveState(r.state);return}this.superstate.ui.setActivePath(r.path),this.superstate.ui.setActiveState(r.state)}}releaseTheNotes(){lX("https://www.make.md/static/latest.md",this.app,!0)}getStarted(){lX("https://www.make.md/static/GetStarted.md",this.app,!0)}closeExtraFileTabs(){let r=!1;if(Su.Platform.isMobile){this.app.workspace.leftSplit?.children.forEach(n=>{n.view.getViewType()=="file-explorer"&&(r?this.app.workspace.leftSplit.removeChild(n):r=!0)});return}this.app.workspace.leftSplit?.children.forEach(n=>{n?.children.forEach(i=>{i.view.getViewType()=="file-explorer"&&(r?n.removeChild(i):r=!0)})})}loadCommands(){this.registerObsidianProtocolHandler("make",async r=>{let n=r;n.kit&&FX(this,this.superstate,n.kit,window),n.open&&this.superstate.ui.openPath(n.open)}),jc(this.superstate.ui)||this.addCommand({id:"open-ever-view",name:"Open Overview",callback:()=>{this.openEverView()}}),this.addCommand({id:"show-warnings",name:"Show Sync Warnings",callback:()=>{T7(this.superstate,window)}}),this.addCommand({id:"logs",name:"Toggle Enhanced Logs",callback:()=>{this.superstate.settings.enhancedLogs=!this.superstate.settings.enhancedLogs,this.saveSettings()}}),this.addCommand({id:"path-fixer",name:"Fix Unsupported Characters in Paths",callback:()=>{NX(this)}}),this.addCommand({id:"move-space-folder",name:"Move Space Data Folder",callback:()=>{let r=Ne(this.app.workspace.getLeaf()?.containerEl.ownerDocument);zSe(this.superstate,"Move Space Data Folder",this.superstate.settings.spaceSubFolder,n=>{sMe(this,this.superstate.settings.spaceSubFolder,n)},"Move",r)}}),this.superstate.settings.spacesEnabled&&(this.addCommand({id:"mk-debug-close-tabs",name:"Close Extra File Tabs",callback:()=>{this.closeExtraFileTabs()}}),this.addCommand({id:"mk-open-kit",name:"Open Kit",callback:()=>{FX(this,this.superstate,"",window)}}),this.addCommand({id:"mk-kit",name:"Save Space as Kit",callback:()=>{let r=this.getActiveFile().path;this.superstate.spacesIndex.has(r)&&oO(this,this.superstate,r,r).then(n=>{this.superstate.spaceManager.createItemAtPath("/","mkit","kit",JSON.stringify(n))})}}),this.addCommand({id:"mk-collapse-folders",name:H.commandPalette.collapseAllFolders,callback:()=>{this.superstate.settings.expandedSpaces=[],this.saveSettings()}}),this.addCommand({id:"mk-release-notes",name:H.commandPalette.releaseNotes,callback:()=>{this.releaseTheNotes()}}),this.addCommand({id:"mk-get-started",name:H.commandPalette.getStarted,callback:()=>{this.getStarted()}}),this.addCommand({id:"mk-reveal-file",name:H.commandPalette.revealFile,callback:()=>{let r=this.superstate.ui.activePath;if(!r)return;let n=new CustomEvent(nm.revealPath,{detail:{path:r}});window.dispatchEvent(n)}}),this.addCommand({id:"mk-spaces",name:H.commandPalette.openSpaces,callback:()=>this.openFileTreeLeaf(!0)})),this.superstate.settings.enableFolderNote&&this.addCommand({id:"mk-convert-folder-note",name:H.commandPalette.convertPathToSpace,callback:()=>this.convertPathToSpace()}),this.superstate.settings.contextEnabled&&this.addCommand({id:"mk-open-file-context",name:H.commandPalette.openFileContext,callback:()=>this.openFileContextLeaf(Db,!0)}),this.superstate.settings.inlineBacklinks&&this.addCommand({id:"mk-toggle-backlinks",name:H.commandPalette.toggleBacklinks,callback:()=>{let r=new CustomEvent(nm.toggleBacklinks);window.dispatchEvent(r)}}),this.superstate.settings.blinkEnabled&&this.addCommand({id:"mk-blink",name:H.commandPalette.blink,callback:()=>this.quickOpen(this.superstate),hotkeys:[{modifiers:["Mod"],key:"o"}]})}loadContext(){this.superstate.settings.contextEnabled&&(this.app.workspace.onLayoutReady(async()=>{this.closeExtraFileTabs(),this.superstate.settings.enableDefaultSpaces&&await this.files.createFolder(this.superstate.settings.spacesFolder)}),this.registerExtensions(["mdb"],f7),this.app.workspace.onLayoutReady(async()=>{this.superstate.settings.autoOpenFileContext&&await this.openFileContextLeaf(Db),setTimeout(()=>this.activeFileChange(),2e3)}),this.superstate.settings.inlineContext&&(this.registerMarkdownPostProcessor((r,n)=>{JDe(this,r,n)}),document.body.classList.toggle("mk-inline-context-enabled",this.superstate.settings.inlineContext)))}openEverView(){let r=this.app.workspace.getLeavesOfType(Lh);if(r.length==0){let n=this.app.workspace.createLeafBySplit(this.app.workspace.getLeaf(),"vertical",!0);n.setViewState({type:Lh}),n.setPinned(!0)}else r.forEach(n=>{n.getRoot()!=this.app.workspace.rootSplit&&n.detach();let i=this.app.workspace.createLeafBySplit(this.app.workspace.getLeaf(),"vertical",!0);i.setViewState({type:Lh}),i.setPinned(!0)});aOe(this)}async onload(){let r=Date.now(),n=Object.assign({},lE,await this.loadData());this.mdbFileAdapter=new x7(this),this.files=N1.create(),this.obsidianAdapter=new k7(this,this.files,(0,Su.normalizePath)(this.app.vault.configDir+"/plugins/make-md/Spaces.mdb")),this.files.initiateFileSystemAdapter(this.obsidianAdapter,!0),this.markdownAdapter=new O7(this),this.files.initiateFiletypeAdapter(this.mdbFileAdapter),this.files.initiateFiletypeAdapter(this.markdownAdapter),this.files.initiateFiletypeAdapter(new D7(this)),this.files.initiateFiletypeAdapter(new B7(this)),this.files.initiateFiletypeAdapter(new I7(this)),this.files.initiateFiletypeAdapter(new _7(this));let i=new bC(this.files,n.spaceSubFolder),a=new lR;this.ui=new F7(this);let o=Ly.create(this.ui),s=SE.create(new P7(this));this.superstate=jE.create("0.9",()=>{this.debouncedRefresh()},new uk,o,s),await this.loadSettings(),this.superstate.settings.experimental&&this.files.initiateFiletypeAdapter(new n7(this)),this.superstate.spaceManager.addSpaceAdapter(i,!0),this.superstate.spaceManager.addSpaceAdapter(a),(0,Su.addIcon)("mk-logo",rOe),this.superstate.saveSettings=()=>this.saveSettings(),this.loadViews();let l;Su.Platform.isMobile?l=new AE(".makemd/superstate.mdc",this.mdbFileAdapter,["path","space","frame","context","icon"]):l=new hE(".makemd/superstate.mdc",this.mdbFileAdapter,["path","space","frame","context","icon"]),this.superstate.settings.cacheIndex&&await l.initialize(),this.superstate.persister=l,this.loadSuperState(),this.addSettingTab(new J8(this.app,this)),await this.loadSpaces(),this.loadContext(),this.superstate.settings.basics&&(this.basics=new AO(this),this.basics.loadBasics()),this.loadCommands(),this.superstate.ui.notify(`Make.md - Plugin loaded in ${(Date.now()-r)/1e3} seconds`,"console"),this.superstate.settings.systemName=="Vault"&&(this.superstate.settings.systemName=this.app.vault.getName(),this.saveSettings())}async loadSettings(){this.superstate.settings=Object.assign({},lE,await this.loadData()),this.superstate.settings.hiddenExtensions.length==1&&this.superstate.settings.hiddenExtensions[0]==".mdb"&&(this.superstate.settings.hiddenExtensions=lE.hiddenExtensions);let r=or(await WDe(this));this.superstate.settings.newFileFolderPath=r.newFileFolderPath,this.superstate.settings.newFileLocation=r.newFileLocation,this.saveSettings()}async saveSettings(r=!0){await this.saveData(this.superstate.settings),this.obsidianAdapter.pathLastUpdated.set((0,Su.normalizePath)(this.app.vault.configDir+"/plugins/make-md/data.json"),Date.now()),r&&this.superstate.dispatchEvent("settingsChanged",null)}onunload(){console.log("Unloading Make.md"),this.superstate.persister.unload(),this.detachFileTreeLeafs()}}; +`,{name:"Superstate Indexer"})}var dR=class{constructor(t,r){this.numWorkers=t;this.cache=r;this.workers=[],this.busy=[],this.reloadQueue=[],this.reloadSet=new Set,this.callbacks=new Map;for(let n=0;nthis.finish(a.data.job,a.data.result,n),this.workers.push(i),this.busy.push(!1)}}reload(t){let r=ME(t),n=new Promise((a,o)=>{this.callbacks.has(r)?this.callbacks.get(r)?.push([a,o]):this.callbacks.set(r,[[a,o]])});if(this.reloadSet.has(r))return n;this.reloadSet.add(r);let i=this.nextAvailableWorker();return i!==void 0?this.send(t,i):this.reloadQueue.push(t),n}finish(t,r,n){let i=ME(t),a=[].concat(this.callbacks.get(i)??[]);this.reloadSet.delete(i),this.callbacks.delete(i),this.busy[n]=!1;let o=this.reloadQueue.shift();if(o!==void 0&&this.send(o,n),"$error"in r)for(let[s,l]of a)l(r.$error);else for(let[s,l]of a)s(r)}async send(t,r){if(t.type=="paths"){let n=await this.cache.spaceManager.allCaches(),i={settings:this.cache.settings,spacesCache:this.cache.spacesIndex,pathCache:n,oldMetadata:this.cache.pathsIndex};this.message(r,{job:t,payload:i}),this.busy[r]=!0;return}if(t.type=="path"){let n=this.cache.spacesIndex.get(t.path),i=t.path,a;n&&(a=n.space.name,this.cache.settings.enableFolderNote?i=n.space.notePath:i=n.space.defPath);let o=await this.cache.spaceManager.readPathCache(i)??await this.cache.spaceManager.readPathCache(t.path);a=a??o?.label.name;let s=await this.cache.spaceManager.parentPathForPath(t.path),l=n?"space":o.type,u=n?n.type:o?.subtype,c={path:t.path,settings:this.cache.settings,spacesCache:this.cache.spacesIndex,pathMetadata:o,name:a,parent:s,type:l,subtype:u,oldMetadata:this.cache.pathsIndex.get(t.path)};this.message(r,{job:t,payload:c}),this.busy[r]=!0;return}if(t.type=="context"){let n=this.cache.spacesIndex.get(t.path)?.space;if(!n||!n.path){this.message(r,{job:t,payload:{space:n,mdb:null,paths:[...this.cache.spacesMap.getInverse(t.path)],pathsIndex:this.cache.pathsIndex,spacesMap:this.cache.spacesMap}}),this.busy[r]=!0;return}let i=await this.cache.spaceManager.contextInitiated(n.path);this.cache.spaceManager.readAllTables(n.path).then(a=>{this.message(r,{job:t,payload:{space:n,mdb:a,paths:[...this.cache.spacesMap.getInverse(t.path)],spacesMap:this.cache.spacesMap,dbExists:i,pathsIndex:this.cache.pathsIndex}}),this.busy[r]=!0});return}if(t.type=="contexts"){let n=this.cache.allSpaces().filter(a=>a.type!="default").map(a=>a.space),i=new Map;for(let a of n){let o=await this.cache.spaceManager.contextInitiated(a.path);await this.cache.spaceManager.readAllTables(a.path).then(s=>{i.set(a.path,{space:a,mdb:s,paths:[...this.cache.spacesMap.getInverse(a.path)],spacesMap:this.cache.spacesMap,dbExists:o})})}this.message(r,{job:t,payload:{map:i,pathsIndex:this.cache.pathsIndex,spacesMap:this.cache.spacesMap}}),this.busy[r]=!0}}message(t,r){this.workers[t].postMessage(r)}nextAvailableWorker(){let t=this.busy.indexOf(!1);return t==-1?void 0:t}};function YX(){return vO('"use strict";var jl=Object.create;var Ka=Object.defineProperty;var $l=Object.getOwnPropertyDescriptor;var Bl=Object.getOwnPropertyNames;var Gl=Object.getPrototypeOf,ql=Object.prototype.hasOwnProperty;var zl=(n,r)=>()=>(r||n((r={exports:{}}).exports,r),r.exports);var Ql=(n,r,s,o)=>{if(r&&typeof r=="object"||typeof r=="function")for(let u of Bl(r))!ql.call(n,u)&&u!==s&&Ka(n,u,{get:()=>r[u],enumerable:!(o=$l(r,u))||o.enumerable});return n};var Zl=(n,r,s)=>(s=n!=null?jl(Gl(n)):{},Ql(r||!n||!n.__esModule?Ka(s,"default",{value:n,enumerable:!0}):s,n));var Sn=zl((Lr,st)=>{(function(n,r){typeof Lr=="object"&&typeof st<"u"?st.exports=r():typeof define=="function"&&define.amd?define(r):n.moment=r()})(Lr,function(){"use strict";var n;function r(){return n.apply(null,arguments)}function s(e){n=e}function o(e){return e instanceof Array||Object.prototype.toString.call(e)==="[object Array]"}function u(e){return e!=null&&Object.prototype.toString.call(e)==="[object Object]"}function d(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function f(e){if(Object.getOwnPropertyNames)return Object.getOwnPropertyNames(e).length===0;var t;for(t in e)if(d(e,t))return!1;return!0}function m(e){return e===void 0}function p(e){return typeof e=="number"||Object.prototype.toString.call(e)==="[object Number]"}function y(e){return e instanceof Date||Object.prototype.toString.call(e)==="[object Date]"}function w(e,t){var a=[],i,l=e.length;for(i=0;i>>0,i;for(i=0;i0)for(a=0;a=0;return(c?a?"+":"":"-")+Math.pow(10,Math.max(0,l)).toString().substr(1)+i}var rr=/(\\[[^\\[]*\\])|(\\\\)?([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,Tt=/(\\[[^\\[]*\\])|(\\\\)?(LTS|LT|LL?L?L?|l{1,4})/g,ar={},Ze={};function k(e,t,a,i){var l=i;typeof i=="string"&&(l=function(){return this[i]()}),e&&(Ze[e]=l),t&&(Ze[t[0]]=function(){return ge(l.apply(this,arguments),t[1],t[2])}),a&&(Ze[a]=function(){return this.localeData().ordinal(l.apply(this,arguments),e)})}function qn(e){return e.match(/\\[[\\s\\S]/)?e.replace(/^\\[|\\]$/g,""):e.replace(/\\\\/g,"")}function zn(e){var t=e.match(rr),a,i;for(a=0,i=t.length;a=0&&Tt.test(e);)e=e.replace(Tt,i),Tt.lastIndex=0,a-=1;return e}var Qn={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 Zn(e){var t=this._longDateFormat[e],a=this._longDateFormat[e.toUpperCase()];return t||!a?t:(this._longDateFormat[e]=a.match(rr).map(function(i){return i==="MMMM"||i==="MM"||i==="DD"||i==="dddd"?i.slice(1):i}).join(""),this._longDateFormat[e])}var Jn="Invalid date";function Kn(){return this._invalidDate}var Xn="%d",ei=/\\d{1,2}/;function ti(e){return this._ordinal.replace("%d",e)}var ri={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 ai(e,t,a,i){var l=this._relativeTime[a];return Z(l)?l(e,t,a,i):l.replace(/%d/i,e)}function ni(e,t){var a=this._relativeTime[e>0?"future":"past"];return Z(a)?a(t):a.replace(/%s/i,t)}var dt={};function J(e,t){var a=e.toLowerCase();dt[a]=dt[a+"s"]=dt[t]=e}function de(e){return typeof e=="string"?dt[e]||dt[e.toLowerCase()]:void 0}function nr(e){var t={},a,i;for(i in e)d(e,i)&&(a=de(i),a&&(t[a]=e[i]));return t}var ua={};function K(e,t){ua[e]=t}function ii(e){var t=[],a;for(a in e)d(e,a)&&t.push({unit:a,priority:ua[a]});return t.sort(function(i,l){return i.priority-l.priority}),t}function Mt(e){return e%4===0&&e%100!==0||e%400===0}function ce(e){return e<0?Math.ceil(e)||0:Math.floor(e)}function O(e){var t=+e,a=0;return t!==0&&isFinite(t)&&(a=ce(t)),a}function Je(e,t){return function(a){return a!=null?(da(this,e,a),r.updateOffset(this,t),this):Ot(this,e)}}function Ot(e,t){return e.isValid()?e._d["get"+(e._isUTC?"UTC":"")+t]():NaN}function da(e,t,a){e.isValid()&&!isNaN(a)&&(t==="FullYear"&&Mt(e.year())&&e.month()===1&&e.date()===29?(a=O(a),e._d["set"+(e._isUTC?"UTC":"")+t](a,e.month(),Wt(a,e.month()))):e._d["set"+(e._isUTC?"UTC":"")+t](a))}function si(e){return e=de(e),Z(this[e])?this[e]():this}function oi(e,t){if(typeof e=="object"){e=nr(e);var a=ii(e),i,l=a.length;for(i=0;i68?1900:2e3)};var xa=Je("FullYear",!0);function Di(){return Mt(this.year())}function Mi(e,t,a,i,l,c,h){var _;return e<100&&e>=0?(_=new Date(e+400,t,a,i,l,c,h),isFinite(_.getFullYear())&&_.setFullYear(e)):_=new Date(e,t,a,i,l,c,h),_}function mt(e){var t,a;return e<100&&e>=0?(a=Array.prototype.slice.call(arguments),a[0]=e+400,t=new Date(Date.UTC.apply(null,a)),isFinite(t.getUTCFullYear())&&t.setUTCFullYear(e)):t=new Date(Date.UTC.apply(null,arguments)),t}function At(e,t,a){var i=7+t-a,l=(7+mt(e,0,i).getUTCDay()-t)%7;return-l+i-1}function va(e,t,a,i,l){var c=(7+a-i)%7,h=At(e,i,l),_=1+7*(t-1)+c+h,M,W;return _<=0?(M=e-1,W=ht(M)+_):_>ht(e)?(M=e+1,W=_-ht(e)):(M=e,W=_),{year:M,dayOfYear:W}}function pt(e,t,a){var i=At(e.year(),t,a),l=Math.floor((e.dayOfYear()-i-1)/7)+1,c,h;return l<1?(h=e.year()-1,c=l+ke(h,t,a)):l>ke(e.year(),t,a)?(c=l-ke(e.year(),t,a),h=e.year()+1):(h=e.year(),c=l),{week:c,year:h}}function ke(e,t,a){var i=At(e,t,a),l=At(e+1,t,a);return(ht(e)-i+l)/7}k("w",["ww",2],"wo","week"),k("W",["WW",2],"Wo","isoWeek"),J("week","w"),J("isoWeek","W"),K("week",5),K("isoWeek",5),v("w",L),v("ww",L,se),v("W",L),v("WW",L,se),ft(["w","ww","W","WW"],function(e,t,a,i){t[i.substr(0,1)]=O(e)});function Oi(e){return pt(e,this._week.dow,this._week.doy).week}var Fi={dow:0,doy:6};function Ci(){return this._week.dow}function Pi(){return this._week.doy}function Ni(e){var t=this.localeData().week(this);return e==null?t:this.add((e-t)*7,"d")}function Yi(e){var t=pt(this,1,4).week;return e==null?t:this.add((e-t)*7,"d")}k("d",0,"do","day"),k("dd",0,0,function(e){return this.localeData().weekdaysMin(this,e)}),k("ddd",0,0,function(e){return this.localeData().weekdaysShort(this,e)}),k("dddd",0,0,function(e){return this.localeData().weekdays(this,e)}),k("e",0,0,"weekday"),k("E",0,0,"isoWeekday"),J("day","d"),J("weekday","e"),J("isoWeekday","E"),K("day",11),K("weekday",11),K("isoWeekday",11),v("d",L),v("e",L),v("E",L),v("dd",function(e,t){return t.weekdaysMinRegex(e)}),v("ddd",function(e,t){return t.weekdaysShortRegex(e)}),v("dddd",function(e,t){return t.weekdaysRegex(e)}),ft(["dd","ddd","dddd"],function(e,t,a,i){var l=a._locale.weekdaysParse(e,i,a._strict);l!=null?t.d=l:S(a).invalidWeekday=e}),ft(["d","e","E"],function(e,t,a,i){t[i]=O(e)});function Ii(e,t){return typeof e!="string"?e:isNaN(e)?(e=t.weekdaysParse(e),typeof e=="number"?e:null):parseInt(e,10)}function Wi(e,t){return typeof e=="string"?t.weekdaysParse(e)%7||7:isNaN(e)?null:e}function lr(e,t){return e.slice(t,7).concat(e.slice(0,t))}var Ai="Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),ba="Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_"),Li="Su_Mo_Tu_We_Th_Fr_Sa".split("_"),Ei=ct,Ri=ct,Ui=ct;function Hi(e,t){var a=o(this._weekdays)?this._weekdays:this._weekdays[e&&e!==!0&&this._weekdays.isFormat.test(t)?"format":"standalone"];return e===!0?lr(a,this._week.dow):e?a[e.day()]:a}function Vi(e){return e===!0?lr(this._weekdaysShort,this._week.dow):e?this._weekdaysShort[e.day()]:this._weekdaysShort}function ji(e){return e===!0?lr(this._weekdaysMin,this._week.dow):e?this._weekdaysMin[e.day()]:this._weekdaysMin}function $i(e,t,a){var i,l,c,h=e.toLocaleLowerCase();if(!this._weekdaysParse)for(this._weekdaysParse=[],this._shortWeekdaysParse=[],this._minWeekdaysParse=[],i=0;i<7;++i)c=b([2e3,1]).day(i),this._minWeekdaysParse[i]=this.weekdaysMin(c,"").toLocaleLowerCase(),this._shortWeekdaysParse[i]=this.weekdaysShort(c,"").toLocaleLowerCase(),this._weekdaysParse[i]=this.weekdays(c,"").toLocaleLowerCase();return a?t==="dddd"?(l=$.call(this._weekdaysParse,h),l!==-1?l:null):t==="ddd"?(l=$.call(this._shortWeekdaysParse,h),l!==-1?l:null):(l=$.call(this._minWeekdaysParse,h),l!==-1?l:null):t==="dddd"?(l=$.call(this._weekdaysParse,h),l!==-1||(l=$.call(this._shortWeekdaysParse,h),l!==-1)?l:(l=$.call(this._minWeekdaysParse,h),l!==-1?l:null)):t==="ddd"?(l=$.call(this._shortWeekdaysParse,h),l!==-1||(l=$.call(this._weekdaysParse,h),l!==-1)?l:(l=$.call(this._minWeekdaysParse,h),l!==-1?l:null)):(l=$.call(this._minWeekdaysParse,h),l!==-1||(l=$.call(this._weekdaysParse,h),l!==-1)?l:(l=$.call(this._shortWeekdaysParse,h),l!==-1?l:null))}function Bi(e,t,a){var i,l,c;if(this._weekdaysParseExact)return $i.call(this,e,t,a);for(this._weekdaysParse||(this._weekdaysParse=[],this._minWeekdaysParse=[],this._shortWeekdaysParse=[],this._fullWeekdaysParse=[]),i=0;i<7;i++){if(l=b([2e3,1]).day(i),a&&!this._fullWeekdaysParse[i]&&(this._fullWeekdaysParse[i]=new RegExp("^"+this.weekdays(l,"").replace(".","\\\\.?")+"$","i"),this._shortWeekdaysParse[i]=new RegExp("^"+this.weekdaysShort(l,"").replace(".","\\\\.?")+"$","i"),this._minWeekdaysParse[i]=new RegExp("^"+this.weekdaysMin(l,"").replace(".","\\\\.?")+"$","i")),this._weekdaysParse[i]||(c="^"+this.weekdays(l,"")+"|^"+this.weekdaysShort(l,"")+"|^"+this.weekdaysMin(l,""),this._weekdaysParse[i]=new RegExp(c.replace(".",""),"i")),a&&t==="dddd"&&this._fullWeekdaysParse[i].test(e))return i;if(a&&t==="ddd"&&this._shortWeekdaysParse[i].test(e))return i;if(a&&t==="dd"&&this._minWeekdaysParse[i].test(e))return i;if(!a&&this._weekdaysParse[i].test(e))return i}}function Gi(e){if(!this.isValid())return e!=null?this:NaN;var t=this._isUTC?this._d.getUTCDay():this._d.getDay();return e!=null?(e=Ii(e,this.localeData()),this.add(e-t,"d")):t}function qi(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 zi(e){if(!this.isValid())return e!=null?this:NaN;if(e!=null){var t=Wi(e,this.localeData());return this.day(this.day()%7?t:t-7)}else return this.day()||7}function Qi(e){return this._weekdaysParseExact?(d(this,"_weekdaysRegex")||ur.call(this),e?this._weekdaysStrictRegex:this._weekdaysRegex):(d(this,"_weekdaysRegex")||(this._weekdaysRegex=Ei),this._weekdaysStrictRegex&&e?this._weekdaysStrictRegex:this._weekdaysRegex)}function Zi(e){return this._weekdaysParseExact?(d(this,"_weekdaysRegex")||ur.call(this),e?this._weekdaysShortStrictRegex:this._weekdaysShortRegex):(d(this,"_weekdaysShortRegex")||(this._weekdaysShortRegex=Ri),this._weekdaysShortStrictRegex&&e?this._weekdaysShortStrictRegex:this._weekdaysShortRegex)}function Ji(e){return this._weekdaysParseExact?(d(this,"_weekdaysRegex")||ur.call(this),e?this._weekdaysMinStrictRegex:this._weekdaysMinRegex):(d(this,"_weekdaysMinRegex")||(this._weekdaysMinRegex=Ui),this._weekdaysMinStrictRegex&&e?this._weekdaysMinStrictRegex:this._weekdaysMinRegex)}function ur(){function e(re,Oe){return Oe.length-re.length}var t=[],a=[],i=[],l=[],c,h,_,M,W;for(c=0;c<7;c++)h=b([2e3,1]).day(c),_=oe(this.weekdaysMin(h,"")),M=oe(this.weekdaysShort(h,"")),W=oe(this.weekdays(h,"")),t.push(_),a.push(M),i.push(W),l.push(_),l.push(M),l.push(W);t.sort(e),a.sort(e),i.sort(e),l.sort(e),this._weekdaysRegex=new RegExp("^("+l.join("|")+")","i"),this._weekdaysShortRegex=this._weekdaysRegex,this._weekdaysMinRegex=this._weekdaysRegex,this._weekdaysStrictRegex=new RegExp("^("+i.join("|")+")","i"),this._weekdaysShortStrictRegex=new RegExp("^("+a.join("|")+")","i"),this._weekdaysMinStrictRegex=new RegExp("^("+t.join("|")+")","i")}function dr(){return this.hours()%12||12}function Ki(){return this.hours()||24}k("H",["HH",2],0,"hour"),k("h",["hh",2],0,dr),k("k",["kk",2],0,Ki),k("hmm",0,0,function(){return""+dr.apply(this)+ge(this.minutes(),2)}),k("hmmss",0,0,function(){return""+dr.apply(this)+ge(this.minutes(),2)+ge(this.seconds(),2)}),k("Hmm",0,0,function(){return""+this.hours()+ge(this.minutes(),2)}),k("Hmmss",0,0,function(){return""+this.hours()+ge(this.minutes(),2)+ge(this.seconds(),2)});function ka(e,t){k(e,0,0,function(){return this.localeData().meridiem(this.hours(),this.minutes(),t)})}ka("a",!0),ka("A",!1),J("hour","h"),K("hour",13);function _a(e,t){return t._meridiemParse}v("a",_a),v("A",_a),v("H",L),v("h",L),v("k",L),v("HH",L,se),v("hh",L,se),v("kk",L,se),v("hmm",ha),v("hmmss",ma),v("Hmm",ha),v("Hmmss",ma),I(["H","HH"],z),I(["k","kk"],function(e,t,a){var i=O(e);t[z]=i===24?0:i}),I(["a","A"],function(e,t,a){a._isPm=a._locale.isPM(e),a._meridiem=e}),I(["h","hh"],function(e,t,a){t[z]=O(e),S(a).bigHour=!0}),I("hmm",function(e,t,a){var i=e.length-2;t[z]=O(e.substr(0,i)),t[fe]=O(e.substr(i)),S(a).bigHour=!0}),I("hmmss",function(e,t,a){var i=e.length-4,l=e.length-2;t[z]=O(e.substr(0,i)),t[fe]=O(e.substr(i,2)),t[be]=O(e.substr(l)),S(a).bigHour=!0}),I("Hmm",function(e,t,a){var i=e.length-2;t[z]=O(e.substr(0,i)),t[fe]=O(e.substr(i))}),I("Hmmss",function(e,t,a){var i=e.length-4,l=e.length-2;t[z]=O(e.substr(0,i)),t[fe]=O(e.substr(i,2)),t[be]=O(e.substr(l))});function Xi(e){return(e+"").toLowerCase().charAt(0)==="p"}var es=/[ap]\\.?m?\\.?/i,ts=Je("Hours",!0);function rs(e,t,a){return e>11?a?"pm":"PM":a?"am":"AM"}var Ta={calendar:ie,longDateFormat:Qn,invalidDate:Jn,ordinal:Xn,dayOfMonthOrdinalParse:ei,relativeTime:ri,months:gi,monthsShort:pa,week:Fi,weekdays:Ai,weekdaysMin:Li,weekdaysShort:ba,meridiemParse:es},R={},gt={},yt;function as(e,t){var a,i=Math.min(e.length,t.length);for(a=0;a0;){if(l=Lt(c.slice(0,a).join("-")),l)return l;if(i&&i.length>=a&&as(c,i)>=a-1)break;a--}t++}return yt}function is(e){return e.match("^[^/\\\\\\\\]*$")!=null}function Lt(e){var t=null,a;if(R[e]===void 0&&typeof st<"u"&&st&&st.exports&&is(e))try{t=yt._abbr,a=require,a("./locale/"+e),Ne(t)}catch{R[e]=null}return R[e]}function Ne(e,t){var a;return e&&(m(t)?a=_e(e):a=cr(e,t),a?yt=a:typeof console<"u"&&console.warn&&console.warn("Locale "+e+" not found. Did you forget to load it?")),yt._abbr}function cr(e,t){if(t!==null){var a,i=Ta;if(t.abbr=e,R[e]!=null)me("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."),i=R[e]._config;else if(t.parentLocale!=null)if(R[t.parentLocale]!=null)i=R[t.parentLocale]._config;else if(a=Lt(t.parentLocale),a!=null)i=a._config;else return gt[t.parentLocale]||(gt[t.parentLocale]=[]),gt[t.parentLocale].push({name:e,config:t}),null;return R[e]=new Q(ze(i,t)),gt[e]&>[e].forEach(function(l){cr(l.name,l.config)}),Ne(e),R[e]}else return delete R[e],null}function ss(e,t){if(t!=null){var a,i,l=Ta;R[e]!=null&&R[e].parentLocale!=null?R[e].set(ze(R[e]._config,t)):(i=Lt(e),i!=null&&(l=i._config),t=ze(l,t),i==null&&(t.abbr=e),a=new Q(t),a.parentLocale=R[e],R[e]=a),Ne(e)}else R[e]!=null&&(R[e].parentLocale!=null?(R[e]=R[e].parentLocale,e===Ne()&&Ne(e)):R[e]!=null&&delete R[e]);return R[e]}function _e(e){var t;if(e&&e._locale&&e._locale._abbr&&(e=e._locale._abbr),!e)return yt;if(!o(e)){if(t=Lt(e),t)return t;e=[e]}return ns(e)}function os(){return H(R)}function fr(e){var t,a=e._a;return a&&S(e).overflow===-2&&(t=a[ve]<0||a[ve]>11?ve:a[ye]<1||a[ye]>Wt(a[X],a[ve])?ye:a[z]<0||a[z]>24||a[z]===24&&(a[fe]!==0||a[be]!==0||a[Re]!==0)?z:a[fe]<0||a[fe]>59?fe:a[be]<0||a[be]>59?be:a[Re]<0||a[Re]>999?Re:-1,S(e)._overflowDayOfYear&&(tye)&&(t=ye),S(e)._overflowWeeks&&t===-1&&(t=hi),S(e)._overflowWeekday&&t===-1&&(t=mi),S(e).overflow=t),e}var ls=/^\\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)?)?$/,us=/^\\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)?)?$/,ds=/Z|[+-]\\d\\d(?::?\\d\\d)?/,Et=[["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]],hr=[["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/]],cs=/^\\/?Date\\((-?\\d+)/i,fs=/^(?:(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}))$/,hs={UT:0,GMT:0,EDT:-4*60,EST:-5*60,CDT:-5*60,CST:-6*60,MDT:-6*60,MST:-7*60,PDT:-7*60,PST:-8*60};function Ma(e){var t,a,i=e._i,l=ls.exec(i)||us.exec(i),c,h,_,M,W=Et.length,re=hr.length;if(l){for(S(e).iso=!0,t=0,a=W;tht(h)||e._dayOfYear===0)&&(S(e)._overflowDayOfYear=!0),a=mt(h,0,e._dayOfYear),e._a[ve]=a.getUTCMonth(),e._a[ye]=a.getUTCDate()),t=0;t<3&&e._a[t]==null;++t)e._a[t]=i[t]=l[t];for(;t<7;t++)e._a[t]=i[t]=e._a[t]==null?t===2?1:0:e._a[t];e._a[z]===24&&e._a[fe]===0&&e._a[be]===0&&e._a[Re]===0&&(e._nextDay=!0,e._a[z]=0),e._d=(e._useUTC?mt:Mi).apply(null,i),c=e._useUTC?e._d.getUTCDay():e._d.getDay(),e._tzm!=null&&e._d.setUTCMinutes(e._d.getUTCMinutes()-e._tzm),e._nextDay&&(e._a[z]=24),e._w&&typeof e._w.d<"u"&&e._w.d!==c&&(S(e).weekdayMismatch=!0)}}function vs(e){var t,a,i,l,c,h,_,M,W;t=e._w,t.GG!=null||t.W!=null||t.E!=null?(c=1,h=4,a=Xe(t.GG,e._a[X],pt(E(),1,4).year),i=Xe(t.W,1),l=Xe(t.E,1),(l<1||l>7)&&(M=!0)):(c=e._locale._week.dow,h=e._locale._week.doy,W=pt(E(),c,h),a=Xe(t.gg,e._a[X],W.year),i=Xe(t.w,W.week),t.d!=null?(l=t.d,(l<0||l>6)&&(M=!0)):t.e!=null?(l=t.e+c,(t.e<0||t.e>6)&&(M=!0)):l=c),i<1||i>ke(a,c,h)?S(e)._overflowWeeks=!0:M!=null?S(e)._overflowWeekday=!0:(_=va(a,i,l,c,h),e._a[X]=_.year,e._dayOfYear=_.dayOfYear)}r.ISO_8601=function(){},r.RFC_2822=function(){};function pr(e){if(e._f===r.ISO_8601){Ma(e);return}if(e._f===r.RFC_2822){Oa(e);return}e._a=[],S(e).empty=!0;var t=""+e._i,a,i,l,c,h,_=t.length,M=0,W,re;for(l=la(e._f,e._locale).match(rr)||[],re=l.length,a=0;a0&&S(e).unusedInput.push(h),t=t.slice(t.indexOf(i)+i.length),M+=i.length),Ze[c]?(i?S(e).empty=!1:S(e).unusedTokens.push(c),fi(c,i,e)):e._strict&&!i&&S(e).unusedTokens.push(c);S(e).charsLeftOver=_-M,t.length>0&&S(e).unusedInput.push(t),e._a[z]<=12&&S(e).bigHour===!0&&e._a[z]>0&&(S(e).bigHour=void 0),S(e).parsedDateParts=e._a.slice(0),S(e).meridiem=e._meridiem,e._a[z]=bs(e._locale,e._a[z],e._meridiem),W=S(e).era,W!==null&&(e._a[X]=e._locale.erasConvertYear(W,e._a[X])),mr(e),fr(e)}function bs(e,t,a){var i;return a==null?t:e.meridiemHour!=null?e.meridiemHour(t,a):(e.isPM!=null&&(i=e.isPM(a),i&&t<12&&(t+=12),!i&&t===12&&(t=0)),t)}function ks(e){var t,a,i,l,c,h,_=!1,M=e._f.length;if(M===0){S(e).invalidFormat=!0,e._d=new Date(NaN);return}for(l=0;lthis?this:e:G()});function Pa(e,t){var a,i;if(t.length===1&&o(t[0])&&(t=t[0]),!t.length)return E();for(a=t[0],i=1;ithis.clone().month(0).utcOffset()||this.utcOffset()>this.clone().month(5).utcOffset()}function $s(){if(!m(this._isDSTShifted))return this._isDSTShifted;var e={},t;return ue(e,this),e=Fa(e),e._a?(t=e._isUTC?b(e._a):E(e._a),this._isDSTShifted=this.isValid()&&Ws(e._a,t.toArray())>0):this._isDSTShifted=!1,this._isDSTShifted}function Bs(){return this.isValid()?!this._isUTC:!1}function Gs(){return this.isValid()?this._isUTC:!1}function Ya(){return this.isValid()?this._isUTC&&this._offset===0:!1}var qs=/^(-|\\+)?(?:(\\d*)[. ])?(\\d+):(\\d+)(?::(\\d+)(\\.\\d*)?)?$/,zs=/^(-|\\+)?P(?:([-+]?[0-9,.]*)Y)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)W)?(?:([-+]?[0-9,.]*)D)?(?:T(?:([-+]?[0-9,.]*)H)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)S)?)?$/;function he(e,t){var a=e,i=null,l,c,h;return Ut(e)?a={ms:e._milliseconds,d:e._days,M:e._months}:p(e)||!isNaN(+e)?(a={},t?a[t]=+e:a.milliseconds=+e):(i=qs.exec(e))?(l=i[1]==="-"?-1:1,a={y:0,d:O(i[ye])*l,h:O(i[z])*l,m:O(i[fe])*l,s:O(i[be])*l,ms:O(gr(i[Re]*1e3))*l}):(i=zs.exec(e))?(l=i[1]==="-"?-1:1,a={y:Ue(i[2],l),M:Ue(i[3],l),w:Ue(i[4],l),d:Ue(i[5],l),h:Ue(i[6],l),m:Ue(i[7],l),s:Ue(i[8],l)}):a==null?a={}:typeof a=="object"&&("from"in a||"to"in a)&&(h=Qs(E(a.from),E(a.to)),a={},a.ms=h.milliseconds,a.M=h.months),c=new Rt(a),Ut(e)&&d(e,"_locale")&&(c._locale=e._locale),Ut(e)&&d(e,"_isValid")&&(c._isValid=e._isValid),c}he.fn=Rt.prototype,he.invalid=Is;function Ue(e,t){var a=e&&parseFloat(e.replace(",","."));return(isNaN(a)?0:a)*t}function Ia(e,t){var a={};return a.months=t.month()-e.month()+(t.year()-e.year())*12,e.clone().add(a.months,"M").isAfter(t)&&--a.months,a.milliseconds=+t-+e.clone().add(a.months,"M"),a}function Qs(e,t){var a;return e.isValid()&&t.isValid()?(t=Sr(t,e),e.isBefore(t)?a=Ia(e,t):(a=Ia(t,e),a.milliseconds=-a.milliseconds,a.months=-a.months),a):{milliseconds:0,months:0}}function Wa(e,t){return function(a,i){var l,c;return i!==null&&!isNaN(+i)&&(me(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."),c=a,a=i,i=c),l=he(a,i),Aa(this,l,e),this}}function Aa(e,t,a,i){var l=t._milliseconds,c=gr(t._days),h=gr(t._months);!e.isValid()||(i=i??!0,h&&ya(e,Ot(e,"Month")+h*a),c&&da(e,"Date",Ot(e,"Date")+c*a),l&&e._d.setTime(e._d.valueOf()+l*a),i&&r.updateOffset(e,c||h))}var Zs=Wa(1,"add"),Js=Wa(-1,"subtract");function La(e){return typeof e=="string"||e instanceof String}function Ks(e){return V(e)||y(e)||La(e)||p(e)||eo(e)||Xs(e)||e===null||e===void 0}function Xs(e){var t=u(e)&&!f(e),a=!1,i=["years","year","y","months","month","M","days","day","d","dates","date","D","hours","hour","h","minutes","minute","m","seconds","second","s","milliseconds","millisecond","ms"],l,c,h=i.length;for(l=0;la.valueOf():a.valueOf()9999?Dt(a,t?"YYYYYY-MM-DD[T]HH:mm:ss.SSS[Z]":"YYYYYY-MM-DD[T]HH:mm:ss.SSSZ"):Z(Date.prototype.toISOString)?t?this.toDate().toISOString():new Date(this.valueOf()+this.utcOffset()*60*1e3).toISOString().replace("Z",Dt(a,"Z")):Dt(a,t?"YYYY-MM-DD[T]HH:mm:ss.SSS[Z]":"YYYY-MM-DD[T]HH:mm:ss.SSSZ")}function po(){if(!this.isValid())return"moment.invalid(/* "+this._i+" */)";var e="moment",t="",a,i,l,c;return this.isLocal()||(e=this.utcOffset()===0?"moment.utc":"moment.parseZone",t="Z"),a="["+e+\'("]\',i=0<=this.year()&&this.year()<=9999?"YYYY":"YYYYYY",l="-MM-DD[T]HH:mm:ss.SSS",c=t+\'[")]\',this.format(a+i+l+c)}function go(e){e||(e=this.isUtc()?r.defaultFormatUtc:r.defaultFormat);var t=Dt(this,e);return this.localeData().postformat(t)}function yo(e,t){return this.isValid()&&(V(e)&&e.isValid()||E(e).isValid())?he({to:this,from:e}).locale(this.locale()).humanize(!t):this.localeData().invalidDate()}function So(e){return this.from(E(),e)}function wo(e,t){return this.isValid()&&(V(e)&&e.isValid()||E(e).isValid())?he({from:this,to:e}).locale(this.locale()).humanize(!t):this.localeData().invalidDate()}function xo(e){return this.to(E(),e)}function Ea(e){var t;return e===void 0?this._locale._abbr:(t=_e(e),t!=null&&(this._locale=t),this)}var Ra=A("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 Vt=1e3,et=60*Vt,jt=60*et,Ha=(365*400+97)*24*jt;function tt(e,t){return(e%t+t)%t}function Va(e,t,a){return e<100&&e>=0?new Date(e+400,t,a)-Ha:new Date(e,t,a).valueOf()}function ja(e,t,a){return e<100&&e>=0?Date.UTC(e+400,t,a)-Ha:Date.UTC(e,t,a)}function vo(e){var t,a;if(e=de(e),e===void 0||e==="millisecond"||!this.isValid())return this;switch(a=this._isUTC?ja:Va,e){case"year":t=a(this.year(),0,1);break;case"quarter":t=a(this.year(),this.month()-this.month()%3,1);break;case"month":t=a(this.year(),this.month(),1);break;case"week":t=a(this.year(),this.month(),this.date()-this.weekday());break;case"isoWeek":t=a(this.year(),this.month(),this.date()-(this.isoWeekday()-1));break;case"day":case"date":t=a(this.year(),this.month(),this.date());break;case"hour":t=this._d.valueOf(),t-=tt(t+(this._isUTC?0:this.utcOffset()*et),jt);break;case"minute":t=this._d.valueOf(),t-=tt(t,et);break;case"second":t=this._d.valueOf(),t-=tt(t,Vt);break}return this._d.setTime(t),r.updateOffset(this,!0),this}function bo(e){var t,a;if(e=de(e),e===void 0||e==="millisecond"||!this.isValid())return this;switch(a=this._isUTC?ja:Va,e){case"year":t=a(this.year()+1,0,1)-1;break;case"quarter":t=a(this.year(),this.month()-this.month()%3+3,1)-1;break;case"month":t=a(this.year(),this.month()+1,1)-1;break;case"week":t=a(this.year(),this.month(),this.date()-this.weekday()+7)-1;break;case"isoWeek":t=a(this.year(),this.month(),this.date()-(this.isoWeekday()-1)+7)-1;break;case"day":case"date":t=a(this.year(),this.month(),this.date()+1)-1;break;case"hour":t=this._d.valueOf(),t+=jt-tt(t+(this._isUTC?0:this.utcOffset()*et),jt)-1;break;case"minute":t=this._d.valueOf(),t+=et-tt(t,et)-1;break;case"second":t=this._d.valueOf(),t+=Vt-tt(t,Vt)-1;break}return this._d.setTime(t),r.updateOffset(this,!0),this}function ko(){return this._d.valueOf()-(this._offset||0)*6e4}function _o(){return Math.floor(this.valueOf()/1e3)}function To(){return new Date(this.valueOf())}function Do(){var e=this;return[e.year(),e.month(),e.date(),e.hour(),e.minute(),e.second(),e.millisecond()]}function Mo(){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 Oo(){return this.isValid()?this.toISOString():null}function Fo(){return q(this)}function Co(){return x({},S(this))}function Po(){return S(this).overflow}function No(){return{input:this._i,format:this._f,locale:this._locale,isUTC:this._isUTC,strict:this._strict}}k("N",0,0,"eraAbbr"),k("NN",0,0,"eraAbbr"),k("NNN",0,0,"eraAbbr"),k("NNNN",0,0,"eraName"),k("NNNNN",0,0,"eraNarrow"),k("y",["y",1],"yo","eraYear"),k("y",["yy",2],0,"eraYear"),k("y",["yyy",3],0,"eraYear"),k("y",["yyyy",4],0,"eraYear"),v("N",xr),v("NN",xr),v("NNN",xr),v("NNNN",jo),v("NNNNN",$o),I(["N","NN","NNN","NNNN","NNNNN"],function(e,t,a,i){var l=a._locale.erasParse(e,i,a._strict);l?S(a).era=l:S(a).invalidEra=e}),v("y",Ke),v("yy",Ke),v("yyy",Ke),v("yyyy",Ke),v("yo",Bo),I(["y","yy","yyy","yyyy"],X),I(["yo"],function(e,t,a,i){var l;a._locale._eraYearOrdinalRegex&&(l=e.match(a._locale._eraYearOrdinalRegex)),a._locale.eraYearOrdinalParse?t[X]=a._locale.eraYearOrdinalParse(e,l):t[X]=parseInt(e,10)});function Yo(e,t){var a,i,l,c=this._eras||_e("en")._eras;for(a=0,i=c.length;a=0)return c[i]}function Wo(e,t){var a=e.since<=e.until?1:-1;return t===void 0?r(e.since).year():r(e.since).year()+(t-e.offset)*a}function Ao(){var e,t,a,i=this.localeData().eras();for(e=0,t=i.length;ec&&(t=c),Ko.call(this,e,t,a,i,l))}function Ko(e,t,a,i,l){var c=va(e,t,a,i,l),h=mt(c.year,0,c.dayOfYear);return this.year(h.getUTCFullYear()),this.month(h.getUTCMonth()),this.date(h.getUTCDate()),this}k("Q",0,"Qo","quarter"),J("quarter","Q"),K("quarter",7),v("Q",ca),I("Q",function(e,t){t[ve]=(O(e)-1)*3});function Xo(e){return e==null?Math.ceil((this.month()+1)/3):this.month((e-1)*3+this.month()%3)}k("D",["DD",2],"Do","date"),J("date","D"),K("date",9),v("D",L),v("DD",L,se),v("Do",function(e,t){return e?t._dayOfMonthOrdinalParse||t._ordinalParse:t._dayOfMonthOrdinalParseLenient}),I(["D","DD"],ye),I("Do",function(e,t){t[ye]=O(e.match(L)[0])});var Ba=Je("Date",!0);k("DDD",["DDDD",3],"DDDo","dayOfYear"),J("dayOfYear","DDD"),K("dayOfYear",4),v("DDD",Ct),v("DDDD",fa),I(["DDD","DDDD"],function(e,t,a){a._dayOfYear=O(e)});function el(e){var t=Math.round((this.clone().startOf("day")-this.clone().startOf("year"))/864e5)+1;return e==null?t:this.add(e-t,"d")}k("m",["mm",2],0,"minute"),J("minute","m"),K("minute",14),v("m",L),v("mm",L,se),I(["m","mm"],fe);var tl=Je("Minutes",!1);k("s",["ss",2],0,"second"),J("second","s"),K("second",15),v("s",L),v("ss",L,se),I(["s","ss"],be);var rl=Je("Seconds",!1);k("S",0,0,function(){return~~(this.millisecond()/100)}),k(0,["SS",2],0,function(){return~~(this.millisecond()/10)}),k(0,["SSS",3],0,"millisecond"),k(0,["SSSS",4],0,function(){return this.millisecond()*10}),k(0,["SSSSS",5],0,function(){return this.millisecond()*100}),k(0,["SSSSSS",6],0,function(){return this.millisecond()*1e3}),k(0,["SSSSSSS",7],0,function(){return this.millisecond()*1e4}),k(0,["SSSSSSSS",8],0,function(){return this.millisecond()*1e5}),k(0,["SSSSSSSSS",9],0,function(){return this.millisecond()*1e6}),J("millisecond","ms"),K("millisecond",16),v("S",Ct,ca),v("SS",Ct,se),v("SSS",Ct,fa);var Ye,Ga;for(Ye="SSSS";Ye.length<=9;Ye+="S")v(Ye,Ke);function al(e,t){t[Re]=O(("0."+e)*1e3)}for(Ye="S";Ye.length<=9;Ye+="S")I(Ye,al);Ga=Je("Milliseconds",!1),k("z",0,0,"zoneAbbr"),k("zz",0,0,"zoneName");function nl(){return this._isUTC?"UTC":""}function il(){return this._isUTC?"Coordinated Universal Time":""}var g=xe.prototype;g.add=Zs,g.calendar=ao,g.clone=no,g.diff=fo,g.endOf=bo,g.format=go,g.from=yo,g.fromNow=So,g.to=wo,g.toNow=xo,g.get=si,g.invalidAt=Po,g.isAfter=io,g.isBefore=so,g.isBetween=oo,g.isSame=lo,g.isSameOrAfter=uo,g.isSameOrBefore=co,g.isValid=Fo,g.lang=Ra,g.locale=Ea,g.localeData=Ua,g.max=Os,g.min=Ms,g.parsingFlags=Co,g.set=oi,g.startOf=vo,g.subtract=Js,g.toArray=Do,g.toObject=Mo,g.toDate=To,g.toISOString=mo,g.inspect=po,typeof Symbol<"u"&&Symbol.for!=null&&(g[Symbol.for("nodejs.util.inspect.custom")]=function(){return"Moment<"+this.format()+">"}),g.toJSON=Oo,g.toString=ho,g.unix=_o,g.valueOf=ko,g.creationData=No,g.eraName=Ao,g.eraNarrow=Lo,g.eraAbbr=Eo,g.eraYear=Ro,g.year=xa,g.isLeapYear=Di,g.weekYear=Go,g.isoWeekYear=qo,g.quarter=g.quarters=Xo,g.month=Sa,g.daysInMonth=ki,g.week=g.weeks=Ni,g.isoWeek=g.isoWeeks=Yi,g.weeksInYear=Zo,g.weeksInWeekYear=Jo,g.isoWeeksInYear=zo,g.isoWeeksInISOWeekYear=Qo,g.date=Ba,g.day=g.days=Gi,g.weekday=qi,g.isoWeekday=zi,g.dayOfYear=el,g.hour=g.hours=ts,g.minute=g.minutes=tl,g.second=g.seconds=rl,g.millisecond=g.milliseconds=Ga,g.utcOffset=Ls,g.utc=Rs,g.local=Us,g.parseZone=Hs,g.hasAlignedHourOffset=Vs,g.isDST=js,g.isLocal=Bs,g.isUtcOffset=Gs,g.isUtc=Ya,g.isUTC=Ya,g.zoneAbbr=nl,g.zoneName=il,g.dates=A("dates accessor is deprecated. Use date instead.",Ba),g.months=A("months accessor is deprecated. Use month instead",Sa),g.years=A("years accessor is deprecated. Use year instead",xa),g.zone=A("moment().zone is deprecated, use moment().utcOffset instead. http://momentjs.com/guides/#/warnings/zone/",Es),g.isDSTShifted=A("isDSTShifted is deprecated. See http://momentjs.com/guides/#/warnings/dst-shifted/ for more information",$s);function sl(e){return E(e*1e3)}function ol(){return E.apply(null,arguments).parseZone()}function qa(e){return e}var P=Q.prototype;P.calendar=Qe,P.longDateFormat=Zn,P.invalidDate=Kn,P.ordinal=ti,P.preparse=qa,P.postformat=qa,P.relativeTime=ai,P.pastFuture=ni,P.set=pe,P.eras=Yo,P.erasParse=Io,P.erasConvertYear=Wo,P.erasAbbrRegex=Ho,P.erasNameRegex=Uo,P.erasNarrowRegex=Vo,P.months=wi,P.monthsShort=xi,P.monthsParse=bi,P.monthsRegex=Ti,P.monthsShortRegex=_i,P.week=Oi,P.firstDayOfYear=Pi,P.firstDayOfWeek=Ci,P.weekdays=Hi,P.weekdaysMin=ji,P.weekdaysShort=Vi,P.weekdaysParse=Bi,P.weekdaysRegex=Qi,P.weekdaysShortRegex=Zi,P.weekdaysMinRegex=Ji,P.isPM=Xi,P.meridiem=rs;function Bt(e,t,a,i){var l=_e(),c=b().set(i,t);return l[a](c,e)}function za(e,t,a){if(p(e)&&(t=e,e=void 0),e=e||"",t!=null)return Bt(e,t,a,"month");var i,l=[];for(i=0;i<12;i++)l[i]=Bt(e,i,a,"month");return l}function br(e,t,a,i){typeof e=="boolean"?(p(t)&&(a=t,t=void 0),t=t||""):(t=e,a=t,e=!1,p(t)&&(a=t,t=void 0),t=t||"");var l=_e(),c=e?l._week.dow:0,h,_=[];if(a!=null)return Bt(t,(a+c)%7,i,"day");for(h=0;h<7;h++)_[h]=Bt(t,(h+c)%7,i,"day");return _}function ll(e,t){return za(e,t,"months")}function ul(e,t){return za(e,t,"monthsShort")}function dl(e,t,a){return br(e,t,a,"weekdays")}function cl(e,t,a){return br(e,t,a,"weekdaysShort")}function fl(e,t,a){return br(e,t,a,"weekdaysMin")}Ne("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,a=O(e%100/10)===1?"th":t===1?"st":t===2?"nd":t===3?"rd":"th";return e+a}}),r.lang=A("moment.lang is deprecated. Use moment.locale instead.",Ne),r.langData=A("moment.langData is deprecated. Use moment.localeData instead.",_e);var Te=Math.abs;function hl(){var e=this._data;return this._milliseconds=Te(this._milliseconds),this._days=Te(this._days),this._months=Te(this._months),e.milliseconds=Te(e.milliseconds),e.seconds=Te(e.seconds),e.minutes=Te(e.minutes),e.hours=Te(e.hours),e.months=Te(e.months),e.years=Te(e.years),this}function Qa(e,t,a,i){var l=he(t,a);return e._milliseconds+=i*l._milliseconds,e._days+=i*l._days,e._months+=i*l._months,e._bubble()}function ml(e,t){return Qa(this,e,t,1)}function pl(e,t){return Qa(this,e,t,-1)}function Za(e){return e<0?Math.floor(e):Math.ceil(e)}function gl(){var e=this._milliseconds,t=this._days,a=this._months,i=this._data,l,c,h,_,M;return e>=0&&t>=0&&a>=0||e<=0&&t<=0&&a<=0||(e+=Za(kr(a)+t)*864e5,t=0,a=0),i.milliseconds=e%1e3,l=ce(e/1e3),i.seconds=l%60,c=ce(l/60),i.minutes=c%60,h=ce(c/60),i.hours=h%24,t+=ce(h/24),M=ce(Ja(t)),a+=M,t-=Za(kr(M)),_=ce(a/12),a%=12,i.days=t,i.months=a,i.years=_,this}function Ja(e){return e*4800/146097}function kr(e){return e*146097/4800}function yl(e){if(!this.isValid())return NaN;var t,a,i=this._milliseconds;if(e=de(e),e==="month"||e==="quarter"||e==="year")switch(t=this._days+i/864e5,a=this._months+Ja(t),e){case"month":return a;case"quarter":return a/3;case"year":return a/12}else switch(t=this._days+Math.round(kr(this._months)),e){case"week":return t/7+i/6048e5;case"day":return t+i/864e5;case"hour":return t*24+i/36e5;case"minute":return t*1440+i/6e4;case"second":return t*86400+i/1e3;case"millisecond":return Math.floor(t*864e5)+i;default:throw new Error("Unknown unit "+e)}}function Sl(){return this.isValid()?this._milliseconds+this._days*864e5+this._months%12*2592e6+O(this._months/12)*31536e6:NaN}function De(e){return function(){return this.as(e)}}var wl=De("ms"),xl=De("s"),vl=De("m"),bl=De("h"),kl=De("d"),_l=De("w"),Tl=De("M"),Dl=De("Q"),Ml=De("y");function Ol(){return he(this)}function Fl(e){return e=de(e),this.isValid()?this[e+"s"]():NaN}function He(e){return function(){return this.isValid()?this._data[e]:NaN}}var Cl=He("milliseconds"),Pl=He("seconds"),Nl=He("minutes"),Yl=He("hours"),Il=He("days"),Wl=He("months"),Al=He("years");function Ll(){return ce(this.days()/7)}var Me=Math.round,rt={ss:44,s:45,m:45,h:22,d:26,w:null,M:11};function El(e,t,a,i,l){return l.relativeTime(t||1,!!a,e,i)}function Rl(e,t,a,i){var l=he(e).abs(),c=Me(l.as("s")),h=Me(l.as("m")),_=Me(l.as("h")),M=Me(l.as("d")),W=Me(l.as("M")),re=Me(l.as("w")),Oe=Me(l.as("y")),Ie=c<=a.ss&&["s",c]||c0,Ie[4]=i,El.apply(null,Ie)}function Ul(e){return e===void 0?Me:typeof e=="function"?(Me=e,!0):!1}function Hl(e,t){return rt[e]===void 0?!1:t===void 0?rt[e]:(rt[e]=t,e==="s"&&(rt.ss=t-1),!0)}function Vl(e,t){if(!this.isValid())return this.localeData().invalidDate();var a=!1,i=rt,l,c;return typeof e=="object"&&(t=e,e=!1),typeof e=="boolean"&&(a=e),typeof t=="object"&&(i=Object.assign({},rt,t),t.s!=null&&t.ss==null&&(i.ss=t.s-1)),l=this.localeData(),c=Rl(this,!a,i,l),a&&(c=l.pastFuture(+this,c)),l.postformat(c)}var _r=Math.abs;function at(e){return(e>0)-(e<0)||+e}function Gt(){if(!this.isValid())return this.localeData().invalidDate();var e=_r(this._milliseconds)/1e3,t=_r(this._days),a=_r(this._months),i,l,c,h,_=this.asSeconds(),M,W,re,Oe;return _?(i=ce(e/60),l=ce(i/60),e%=60,i%=60,c=ce(a/12),a%=12,h=e?e.toFixed(3).replace(/\\.?0+$/,""):"",M=_<0?"-":"",W=at(this._months)!==at(_)?"-":"",re=at(this._days)!==at(_)?"-":"",Oe=at(this._milliseconds)!==at(_)?"-":"",M+"P"+(c?W+c+"Y":"")+(a?W+a+"M":"")+(t?re+t+"D":"")+(l||i||e?"T":"")+(l?Oe+l+"H":"")+(i?Oe+i+"M":"")+(e?Oe+h+"S":"")):"P0D"}var C=Rt.prototype;C.isValid=Ys,C.abs=hl,C.add=ml,C.subtract=pl,C.as=yl,C.asMilliseconds=wl,C.asSeconds=xl,C.asMinutes=vl,C.asHours=bl,C.asDays=kl,C.asWeeks=_l,C.asMonths=Tl,C.asQuarters=Dl,C.asYears=Ml,C.valueOf=Sl,C._bubble=gl,C.clone=Ol,C.get=Fl,C.milliseconds=Cl,C.seconds=Pl,C.minutes=Nl,C.hours=Yl,C.days=Il,C.weeks=Ll,C.months=Wl,C.years=Al,C.humanize=Vl,C.toISOString=Gt,C.toString=Gt,C.toJSON=Gt,C.locale=Ea,C.localeData=Ua,C.toIsoString=A("toIsoString() is deprecated. Please use toISOString() instead (notice the capitals)",Gt),C.lang=Ra,k("X",0,0,"unix"),k("x",0,0,"valueOf"),v("x",Nt),v("X",ui),I("X",function(e,t,a){a._d=new Date(parseFloat(e)*1e3)}),I("x",function(e,t,a){a._d=new Date(O(e))});return r.version="2.29.4",s(E),r.fn=g,r.min=Fs,r.max=Cs,r.now=Ps,r.utc=b,r.unix=sl,r.months=ll,r.isDate=y,r.locale=Ne,r.invalid=G,r.duration=he,r.isMoment=V,r.weekdays=dl,r.parseZone=ol,r.localeData=_e,r.isDuration=Ut,r.monthsShort=ul,r.weekdaysMin=fl,r.defineLocale=cr,r.updateLocale=ss,r.locales=os,r.weekdaysShort=cl,r.normalizeUnits=de,r.relativeTimeRounding=Ul,r.relativeTimeThreshold=Hl,r.calendarFormat=ro,r.prototype=g,r.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"},r})});function Xa(n){return Array.isArray(n)?n:typeof n=="string"?[n]:[]}function en(n){if(!n)return"";if(typeof n!="string"){let r=n.toString();return typeof r=="string"?r:""}return n}var tn=(n,r)=>r.indexOf(n)>0?r.indexOf(n):r.length;function Ve(n){return Ve=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(r){return typeof r}:function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},Ve(n)}function ae(n){if(n===null||n===!0||n===!1)return NaN;var r=Number(n);return isNaN(r)?r:r<0?Math.ceil(r):Math.floor(r)}function Y(n,r){if(r.length1?"s":"")+" required, but only "+r.length+" present")}function B(n){Y(1,arguments);var r=Object.prototype.toString.call(n);return n instanceof Date||Ve(n)==="object"&&r==="[object Date]"?new Date(n.getTime()):typeof n=="number"||r==="[object Number]"?new Date(n):((typeof n=="string"||r==="[object String]")&&typeof console<"u"&&(console.warn("Starting with v2.0.0-beta.1 date-fns doesn\'t accept strings as date arguments. Please use `parseISO` to parse strings. See: https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#string-arguments"),console.warn(new Error().stack)),new Date(NaN))}function Tr(n,r){Y(2,arguments);var s=B(n).getTime(),o=ae(r);return new Date(s+o)}var Jl={};function We(){return Jl}function Dr(n){var r=new Date(Date.UTC(n.getFullYear(),n.getMonth(),n.getDate(),n.getHours(),n.getMinutes(),n.getSeconds(),n.getMilliseconds()));return r.setUTCFullYear(n.getFullYear()),n.getTime()-r.getTime()}function Mr(n){return Y(1,arguments),n instanceof Date||Ve(n)==="object"&&Object.prototype.toString.call(n)==="[object Date]"}function Or(n){if(Y(1,arguments),!Mr(n)&&typeof n!="number")return!1;var r=B(n);return!isNaN(Number(r))}function Fr(n,r){Y(2,arguments);var s=ae(r);return Tr(n,-s)}var Kl=864e5;function Cr(n){Y(1,arguments);var r=B(n),s=r.getTime();r.setUTCMonth(0,1),r.setUTCHours(0,0,0,0);var o=r.getTime(),u=s-o;return Math.floor(u/Kl)+1}function Ae(n){Y(1,arguments);var r=1,s=B(n),o=s.getUTCDay(),u=(o=u.getTime()?s+1:r.getTime()>=f.getTime()?s:s-1}function Pr(n){Y(1,arguments);var r=wt(n),s=new Date(0);s.setUTCFullYear(r,0,4),s.setUTCHours(0,0,0,0);var o=Ae(s);return o}var Xl=6048e5;function Nr(n){Y(1,arguments);var r=B(n),s=Ae(r).getTime()-Pr(r).getTime();return Math.round(s/Xl)+1}function Le(n,r){var s,o,u,d,f,m,p,y;Y(1,arguments);var w=We(),x=ae((s=(o=(u=(d=r?.weekStartsOn)!==null&&d!==void 0?d:r==null||(f=r.locale)===null||f===void 0||(m=f.options)===null||m===void 0?void 0:m.weekStartsOn)!==null&&u!==void 0?u:w.weekStartsOn)!==null&&o!==void 0?o:(p=w.locale)===null||p===void 0||(y=p.options)===null||y===void 0?void 0:y.weekStartsOn)!==null&&s!==void 0?s:0);if(!(x>=0&&x<=6))throw new RangeError("weekStartsOn must be between 0 and 6 inclusively");var b=B(n),D=b.getUTCDay(),S=(D=1&&D<=7))throw new RangeError("firstWeekContainsDate must be between 1 and 7 inclusively");var S=new Date(0);S.setUTCFullYear(x+1,0,D),S.setUTCHours(0,0,0,0);var U=Le(S,r),q=new Date(0);q.setUTCFullYear(x,0,D),q.setUTCHours(0,0,0,0);var G=Le(q,r);return w.getTime()>=U.getTime()?x+1:w.getTime()>=G.getTime()?x:x-1}function Yr(n,r){var s,o,u,d,f,m,p,y;Y(1,arguments);var w=We(),x=ae((s=(o=(u=(d=r?.firstWeekContainsDate)!==null&&d!==void 0?d:r==null||(f=r.locale)===null||f===void 0||(m=f.options)===null||m===void 0?void 0:m.firstWeekContainsDate)!==null&&u!==void 0?u:w.firstWeekContainsDate)!==null&&o!==void 0?o:(p=w.locale)===null||p===void 0||(y=p.options)===null||y===void 0?void 0:y.firstWeekContainsDate)!==null&&s!==void 0?s:1),b=xt(n,r),D=new Date(0);D.setUTCFullYear(b,0,x),D.setUTCHours(0,0,0,0);var S=Le(D,r);return S}var eu=6048e5;function Ir(n,r){Y(1,arguments);var s=B(n),o=Le(s,r).getTime()-Yr(s,r).getTime();return Math.round(o/eu)+1}function N(n,r){for(var s=n<0?"-":"",o=Math.abs(n).toString();o.length0?o:1-o;return N(s==="yy"?u%100:u,s.length)},M:function(r,s){var o=r.getUTCMonth();return s==="M"?String(o+1):N(o+1,2)},d:function(r,s){return N(r.getUTCDate(),s.length)},a:function(r,s){var o=r.getUTCHours()/12>=1?"pm":"am";switch(s){case"a":case"aa":return o.toUpperCase();case"aaa":return o;case"aaaaa":return o[0];case"aaaa":default:return o==="am"?"a.m.":"p.m."}},h:function(r,s){return N(r.getUTCHours()%12||12,s.length)},H:function(r,s){return N(r.getUTCHours(),s.length)},m:function(r,s){return N(r.getUTCMinutes(),s.length)},s:function(r,s){return N(r.getUTCSeconds(),s.length)},S:function(r,s){var o=s.length,u=r.getUTCMilliseconds(),d=Math.floor(u*Math.pow(10,o-3));return N(d,s.length)}},Fe=tu;var nt={am:"am",pm:"pm",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},ru={G:function(r,s,o){var u=r.getUTCFullYear()>0?1:0;switch(s){case"G":case"GG":case"GGG":return o.era(u,{width:"abbreviated"});case"GGGGG":return o.era(u,{width:"narrow"});case"GGGG":default:return o.era(u,{width:"wide"})}},y:function(r,s,o){if(s==="yo"){var u=r.getUTCFullYear(),d=u>0?u:1-u;return o.ordinalNumber(d,{unit:"year"})}return Fe.y(r,s)},Y:function(r,s,o,u){var d=xt(r,u),f=d>0?d:1-d;if(s==="YY"){var m=f%100;return N(m,2)}return s==="Yo"?o.ordinalNumber(f,{unit:"year"}):N(f,s.length)},R:function(r,s){var o=wt(r);return N(o,s.length)},u:function(r,s){var o=r.getUTCFullYear();return N(o,s.length)},Q:function(r,s,o){var u=Math.ceil((r.getUTCMonth()+1)/3);switch(s){case"Q":return String(u);case"QQ":return N(u,2);case"Qo":return o.ordinalNumber(u,{unit:"quarter"});case"QQQ":return o.quarter(u,{width:"abbreviated",context:"formatting"});case"QQQQQ":return o.quarter(u,{width:"narrow",context:"formatting"});case"QQQQ":default:return o.quarter(u,{width:"wide",context:"formatting"})}},q:function(r,s,o){var u=Math.ceil((r.getUTCMonth()+1)/3);switch(s){case"q":return String(u);case"qq":return N(u,2);case"qo":return o.ordinalNumber(u,{unit:"quarter"});case"qqq":return o.quarter(u,{width:"abbreviated",context:"standalone"});case"qqqqq":return o.quarter(u,{width:"narrow",context:"standalone"});case"qqqq":default:return o.quarter(u,{width:"wide",context:"standalone"})}},M:function(r,s,o){var u=r.getUTCMonth();switch(s){case"M":case"MM":return Fe.M(r,s);case"Mo":return o.ordinalNumber(u+1,{unit:"month"});case"MMM":return o.month(u,{width:"abbreviated",context:"formatting"});case"MMMMM":return o.month(u,{width:"narrow",context:"formatting"});case"MMMM":default:return o.month(u,{width:"wide",context:"formatting"})}},L:function(r,s,o){var u=r.getUTCMonth();switch(s){case"L":return String(u+1);case"LL":return N(u+1,2);case"Lo":return o.ordinalNumber(u+1,{unit:"month"});case"LLL":return o.month(u,{width:"abbreviated",context:"standalone"});case"LLLLL":return o.month(u,{width:"narrow",context:"standalone"});case"LLLL":default:return o.month(u,{width:"wide",context:"standalone"})}},w:function(r,s,o,u){var d=Ir(r,u);return s==="wo"?o.ordinalNumber(d,{unit:"week"}):N(d,s.length)},I:function(r,s,o){var u=Nr(r);return s==="Io"?o.ordinalNumber(u,{unit:"week"}):N(u,s.length)},d:function(r,s,o){return s==="do"?o.ordinalNumber(r.getUTCDate(),{unit:"date"}):Fe.d(r,s)},D:function(r,s,o){var u=Cr(r);return s==="Do"?o.ordinalNumber(u,{unit:"dayOfYear"}):N(u,s.length)},E:function(r,s,o){var u=r.getUTCDay();switch(s){case"E":case"EE":case"EEE":return o.day(u,{width:"abbreviated",context:"formatting"});case"EEEEE":return o.day(u,{width:"narrow",context:"formatting"});case"EEEEEE":return o.day(u,{width:"short",context:"formatting"});case"EEEE":default:return o.day(u,{width:"wide",context:"formatting"})}},e:function(r,s,o,u){var d=r.getUTCDay(),f=(d-u.weekStartsOn+8)%7||7;switch(s){case"e":return String(f);case"ee":return N(f,2);case"eo":return o.ordinalNumber(f,{unit:"day"});case"eee":return o.day(d,{width:"abbreviated",context:"formatting"});case"eeeee":return o.day(d,{width:"narrow",context:"formatting"});case"eeeeee":return o.day(d,{width:"short",context:"formatting"});case"eeee":default:return o.day(d,{width:"wide",context:"formatting"})}},c:function(r,s,o,u){var d=r.getUTCDay(),f=(d-u.weekStartsOn+8)%7||7;switch(s){case"c":return String(f);case"cc":return N(f,s.length);case"co":return o.ordinalNumber(f,{unit:"day"});case"ccc":return o.day(d,{width:"abbreviated",context:"standalone"});case"ccccc":return o.day(d,{width:"narrow",context:"standalone"});case"cccccc":return o.day(d,{width:"short",context:"standalone"});case"cccc":default:return o.day(d,{width:"wide",context:"standalone"})}},i:function(r,s,o){var u=r.getUTCDay(),d=u===0?7:u;switch(s){case"i":return String(d);case"ii":return N(d,s.length);case"io":return o.ordinalNumber(d,{unit:"day"});case"iii":return o.day(u,{width:"abbreviated",context:"formatting"});case"iiiii":return o.day(u,{width:"narrow",context:"formatting"});case"iiiiii":return o.day(u,{width:"short",context:"formatting"});case"iiii":default:return o.day(u,{width:"wide",context:"formatting"})}},a:function(r,s,o){var u=r.getUTCHours(),d=u/12>=1?"pm":"am";switch(s){case"a":case"aa":return o.dayPeriod(d,{width:"abbreviated",context:"formatting"});case"aaa":return o.dayPeriod(d,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return o.dayPeriod(d,{width:"narrow",context:"formatting"});case"aaaa":default:return o.dayPeriod(d,{width:"wide",context:"formatting"})}},b:function(r,s,o){var u=r.getUTCHours(),d;switch(u===12?d=nt.noon:u===0?d=nt.midnight:d=u/12>=1?"pm":"am",s){case"b":case"bb":return o.dayPeriod(d,{width:"abbreviated",context:"formatting"});case"bbb":return o.dayPeriod(d,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return o.dayPeriod(d,{width:"narrow",context:"formatting"});case"bbbb":default:return o.dayPeriod(d,{width:"wide",context:"formatting"})}},B:function(r,s,o){var u=r.getUTCHours(),d;switch(u>=17?d=nt.evening:u>=12?d=nt.afternoon:u>=4?d=nt.morning:d=nt.night,s){case"B":case"BB":case"BBB":return o.dayPeriod(d,{width:"abbreviated",context:"formatting"});case"BBBBB":return o.dayPeriod(d,{width:"narrow",context:"formatting"});case"BBBB":default:return o.dayPeriod(d,{width:"wide",context:"formatting"})}},h:function(r,s,o){if(s==="ho"){var u=r.getUTCHours()%12;return u===0&&(u=12),o.ordinalNumber(u,{unit:"hour"})}return Fe.h(r,s)},H:function(r,s,o){return s==="Ho"?o.ordinalNumber(r.getUTCHours(),{unit:"hour"}):Fe.H(r,s)},K:function(r,s,o){var u=r.getUTCHours()%12;return s==="Ko"?o.ordinalNumber(u,{unit:"hour"}):N(u,s.length)},k:function(r,s,o){var u=r.getUTCHours();return u===0&&(u=24),s==="ko"?o.ordinalNumber(u,{unit:"hour"}):N(u,s.length)},m:function(r,s,o){return s==="mo"?o.ordinalNumber(r.getUTCMinutes(),{unit:"minute"}):Fe.m(r,s)},s:function(r,s,o){return s==="so"?o.ordinalNumber(r.getUTCSeconds(),{unit:"second"}):Fe.s(r,s)},S:function(r,s){return Fe.S(r,s)},X:function(r,s,o,u){var d=u._originalDate||r,f=d.getTimezoneOffset();if(f===0)return"Z";switch(s){case"X":return an(f);case"XXXX":case"XX":return je(f);case"XXXXX":case"XXX":default:return je(f,":")}},x:function(r,s,o,u){var d=u._originalDate||r,f=d.getTimezoneOffset();switch(s){case"x":return an(f);case"xxxx":case"xx":return je(f);case"xxxxx":case"xxx":default:return je(f,":")}},O:function(r,s,o,u){var d=u._originalDate||r,f=d.getTimezoneOffset();switch(s){case"O":case"OO":case"OOO":return"GMT"+rn(f,":");case"OOOO":default:return"GMT"+je(f,":")}},z:function(r,s,o,u){var d=u._originalDate||r,f=d.getTimezoneOffset();switch(s){case"z":case"zz":case"zzz":return"GMT"+rn(f,":");case"zzzz":default:return"GMT"+je(f,":")}},t:function(r,s,o,u){var d=u._originalDate||r,f=Math.floor(d.getTime()/1e3);return N(f,s.length)},T:function(r,s,o,u){var d=u._originalDate||r,f=d.getTime();return N(f,s.length)}};function rn(n,r){var s=n>0?"-":"+",o=Math.abs(n),u=Math.floor(o/60),d=o%60;if(d===0)return s+String(u);var f=r||"";return s+String(u)+f+N(d,2)}function an(n,r){if(n%60===0){var s=n>0?"-":"+";return s+N(Math.abs(n)/60,2)}return je(n,r)}function je(n,r){var s=r||"",o=n>0?"-":"+",u=Math.abs(n),d=N(Math.floor(u/60),2),f=N(u%60,2);return o+d+s+f}var nn=ru;var sn=function(r,s){switch(r){case"P":return s.date({width:"short"});case"PP":return s.date({width:"medium"});case"PPP":return s.date({width:"long"});case"PPPP":default:return s.date({width:"full"})}},on=function(r,s){switch(r){case"p":return s.time({width:"short"});case"pp":return s.time({width:"medium"});case"ppp":return s.time({width:"long"});case"pppp":default:return s.time({width:"full"})}},au=function(r,s){var o=r.match(/(P+)(p+)?/)||[],u=o[1],d=o[2];if(!d)return sn(r,s);var f;switch(u){case"P":f=s.dateTime({width:"short"});break;case"PP":f=s.dateTime({width:"medium"});break;case"PPP":f=s.dateTime({width:"long"});break;case"PPPP":default:f=s.dateTime({width:"full"});break}return f.replace("{{date}}",sn(u,s)).replace("{{time}}",on(d,s))},nu={p:on,P:au},ln=nu;var iu=["D","DD"],su=["YY","YYYY"];function un(n){return iu.indexOf(n)!==-1}function dn(n){return su.indexOf(n)!==-1}function Wr(n,r,s){if(n==="YYYY")throw new RangeError("Use `yyyy` instead of `YYYY` (in `".concat(r,"`) for formatting years to the input `").concat(s,"`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md"));if(n==="YY")throw new RangeError("Use `yy` instead of `YY` (in `".concat(r,"`) for formatting years to the input `").concat(s,"`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md"));if(n==="D")throw new RangeError("Use `d` instead of `D` (in `".concat(r,"`) for formatting days of the month to the input `").concat(s,"`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md"));if(n==="DD")throw new RangeError("Use `dd` instead of `DD` (in `".concat(r,"`) for formatting days of the month to the input `").concat(s,"`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md"))}var ou={lessThanXSeconds:{one:"less than a second",other:"less than {{count}} seconds"},xSeconds:{one:"1 second",other:"{{count}} seconds"},halfAMinute:"half a minute",lessThanXMinutes:{one:"less than a minute",other:"less than {{count}} minutes"},xMinutes:{one:"1 minute",other:"{{count}} minutes"},aboutXHours:{one:"about 1 hour",other:"about {{count}} hours"},xHours:{one:"1 hour",other:"{{count}} hours"},xDays:{one:"1 day",other:"{{count}} days"},aboutXWeeks:{one:"about 1 week",other:"about {{count}} weeks"},xWeeks:{one:"1 week",other:"{{count}} weeks"},aboutXMonths:{one:"about 1 month",other:"about {{count}} months"},xMonths:{one:"1 month",other:"{{count}} months"},aboutXYears:{one:"about 1 year",other:"about {{count}} years"},xYears:{one:"1 year",other:"{{count}} years"},overXYears:{one:"over 1 year",other:"over {{count}} years"},almostXYears:{one:"almost 1 year",other:"almost {{count}} years"}},lu=function(r,s,o){var u,d=ou[r];return typeof d=="string"?u=d:s===1?u=d.one:u=d.other.replace("{{count}}",s.toString()),o!=null&&o.addSuffix?o.comparison&&o.comparison>0?"in "+u:u+" ago":u},cn=lu;function vt(n){return function(){var r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},s=r.width?String(r.width):n.defaultWidth,o=n.formats[s]||n.formats[n.defaultWidth];return o}}var uu={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},du={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},cu={full:"{{date}} \'at\' {{time}}",long:"{{date}} \'at\' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},fu={date:vt({formats:uu,defaultWidth:"full"}),time:vt({formats:du,defaultWidth:"full"}),dateTime:vt({formats:cu,defaultWidth:"full"})},fn=fu;var hu={lastWeek:"\'last\' eeee \'at\' p",yesterday:"\'yesterday at\' p",today:"\'today at\' p",tomorrow:"\'tomorrow at\' p",nextWeek:"eeee \'at\' p",other:"P"},mu=function(r,s,o,u){return hu[r]},hn=mu;function $e(n){return function(r,s){var o=s!=null&&s.context?String(s.context):"standalone",u;if(o==="formatting"&&n.formattingValues){var d=n.defaultFormattingWidth||n.defaultWidth,f=s!=null&&s.width?String(s.width):d;u=n.formattingValues[f]||n.formattingValues[d]}else{var m=n.defaultWidth,p=s!=null&&s.width?String(s.width):n.defaultWidth;u=n.values[p]||n.values[m]}var y=n.argumentCallback?n.argumentCallback(r):r;return u[y]}}var pu={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},gu={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},yu={narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],wide:["January","February","March","April","May","June","July","August","September","October","November","December"]},Su={narrow:["S","M","T","W","T","F","S"],short:["Su","Mo","Tu","We","Th","Fr","Sa"],abbreviated:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],wide:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},wu={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"}},xu={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"}},vu=function(r,s){var o=Number(r),u=o%100;if(u>20||u<10)switch(u%10){case 1:return o+"st";case 2:return o+"nd";case 3:return o+"rd"}return o+"th"},bu={ordinalNumber:vu,era:$e({values:pu,defaultWidth:"wide"}),quarter:$e({values:gu,defaultWidth:"wide",argumentCallback:function(r){return r-1}}),month:$e({values:yu,defaultWidth:"wide"}),day:$e({values:Su,defaultWidth:"wide"}),dayPeriod:$e({values:wu,defaultWidth:"wide",formattingValues:xu,defaultFormattingWidth:"wide"})},mn=bu;function Be(n){return function(r){var s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},o=s.width,u=o&&n.matchPatterns[o]||n.matchPatterns[n.defaultMatchWidth],d=r.match(u);if(!d)return null;var f=d[0],m=o&&n.parsePatterns[o]||n.parsePatterns[n.defaultParseWidth],p=Array.isArray(m)?_u(m,function(x){return x.test(f)}):ku(m,function(x){return x.test(f)}),y;y=n.valueCallback?n.valueCallback(p):p,y=s.valueCallback?s.valueCallback(y):y;var w=r.slice(f.length);return{value:y,rest:w}}}function ku(n,r){for(var s in n)if(n.hasOwnProperty(s)&&r(n[s]))return s}function _u(n,r){for(var s=0;s1&&arguments[1]!==void 0?arguments[1]:{},o=r.match(n.matchPattern);if(!o)return null;var u=o[0],d=r.match(n.parsePattern);if(!d)return null;var f=n.valueCallback?n.valueCallback(d[0]):d[0];f=s.valueCallback?s.valueCallback(f):f;var m=r.slice(u.length);return{value:f,rest:m}}}var Tu=/^(\\d+)(th|st|nd|rd)?/i,Du=/\\d+/i,Mu={narrow:/^(b|a)/i,abbreviated:/^(b\\.?\\s?c\\.?|b\\.?\\s?c\\.?\\s?e\\.?|a\\.?\\s?d\\.?|c\\.?\\s?e\\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},Ou={any:[/^b/i,/^(a|c)/i]},Fu={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},Cu={any:[/1/i,/2/i,/3/i,/4/i]},Pu={narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},Nu={narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},Yu={narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},Iu={narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},Wu={narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\\.?\\s?m\\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},Au={any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},Lu={ordinalNumber:Ar({matchPattern:Tu,parsePattern:Du,valueCallback:function(r){return parseInt(r,10)}}),era:Be({matchPatterns:Mu,defaultMatchWidth:"wide",parsePatterns:Ou,defaultParseWidth:"any"}),quarter:Be({matchPatterns:Fu,defaultMatchWidth:"wide",parsePatterns:Cu,defaultParseWidth:"any",valueCallback:function(r){return r+1}}),month:Be({matchPatterns:Pu,defaultMatchWidth:"wide",parsePatterns:Nu,defaultParseWidth:"any"}),day:Be({matchPatterns:Yu,defaultMatchWidth:"wide",parsePatterns:Iu,defaultParseWidth:"any"}),dayPeriod:Be({matchPatterns:Wu,defaultMatchWidth:"any",parsePatterns:Au,defaultParseWidth:"any"})},pn=Lu;var Eu={code:"en-US",formatDistance:cn,formatLong:fn,formatRelative:hn,localize:mn,match:pn,options:{weekStartsOn:0,firstWeekContainsDate:1}},gn=Eu;var yn=gn;var Ru=/[yYQqMLwIdDecihHKkms]o|(\\w)\\1*|\'\'|\'(\'\'|[^\'])+(\'|$)|./g,Uu=/P+p+|P+|p+|\'\'|\'(\'\'|[^\'])+(\'|$)|./g,Hu=/^\'([^]*?)\'?$/,Vu=/\'\'/g,ju=/[a-zA-Z]/;function zt(n,r,s){var o,u,d,f,m,p,y,w,x,b,D,S,U,q,G,ne,ee,ue;Y(2,arguments);var xe=String(r),V=We(),j=(o=(u=s?.locale)!==null&&u!==void 0?u:V.locale)!==null&&o!==void 0?o:yn,A=ae((d=(f=(m=(p=s?.firstWeekContainsDate)!==null&&p!==void 0?p:s==null||(y=s.locale)===null||y===void 0||(w=y.options)===null||w===void 0?void 0:w.firstWeekContainsDate)!==null&&m!==void 0?m:V.firstWeekContainsDate)!==null&&f!==void 0?f:(x=V.locale)===null||x===void 0||(b=x.options)===null||b===void 0?void 0:b.firstWeekContainsDate)!==null&&d!==void 0?d:1);if(!(A>=1&&A<=7))throw new RangeError("firstWeekContainsDate must be between 1 and 7 inclusively");var te=ae((D=(S=(U=(q=s?.weekStartsOn)!==null&&q!==void 0?q:s==null||(G=s.locale)===null||G===void 0||(ne=G.options)===null||ne===void 0?void 0:ne.weekStartsOn)!==null&&U!==void 0?U:V.weekStartsOn)!==null&&S!==void 0?S:(ee=V.locale)===null||ee===void 0||(ue=ee.options)===null||ue===void 0?void 0:ue.weekStartsOn)!==null&&D!==void 0?D:0);if(!(te>=0&&te<=6))throw new RangeError("weekStartsOn must be between 0 and 6 inclusively");if(!j.localize)throw new RangeError("locale must contain localize property");if(!j.formatLong)throw new RangeError("locale must contain formatLong property");var me=B(n);if(!Or(me))throw new RangeError("Invalid time value");var Z=Dr(me),pe=Fr(me,Z),ze={firstWeekContainsDate:A,weekStartsOn:te,locale:j,_originalDate:me},Q=xe.match(Uu).map(function(H){var ie=H[0];if(ie==="p"||ie==="P"){var Qe=ln[ie];return Qe(H,j.formatLong)}return H}).join("").match(Ru).map(function(H){if(H==="\'\'")return"\'";var ie=H[0];if(ie==="\'")return $u(H);var Qe=nn[ie];if(Qe)return!(s!=null&&s.useAdditionalWeekYearTokens)&&dn(H)&&Wr(H,r,String(n)),!(s!=null&&s.useAdditionalDayOfYearTokens)&&un(H)&&Wr(H,r,String(n)),Qe(pe,H,j.localize,ze);if(ie.match(ju))throw new RangeError("Format string contains an unescaped latin alphabet character `"+ie+"`");return H}).join("");return Q}function $u(n){var r=n.match(Hu);return r?r[1].replace(Vu,"\'"):n}var it="File";var wn=Zl(Sn()),Er=class{constructor(){this.lang="en";this.all={en:{hintText:{fileName:"Enter File Name",alias:"Enter Display Name",dragDropModifierKeys:"Hold ${1} to Pin and ${2} to Copy",createListItem:"Select/Create List Item Frame",dragDropProperties:"Drag and drop properties to link them into the list",newItem:"+ New",selectNote:"Select Note...",newFrame:"New"},defaults:{spaceNote:"Current Note",spaceContext:"Current Space"},commands:{h1:"Heading 1",h2:"Heading 2",h3:"Heading 3",h4:"Heading 4",h5:"Heading 5",h6:"Heading 6",columns:"Columns",tabs:"Tabs",button:"Button",label:"Label",column:"Column",idea:"New",group:"Group",paragraph:"Text",card:"Card",progress:"Progress",rating:"Rating",circularProgress:"Circular Progress",list:"Bullet List","ordered-list":"Numbered List",todo:"To-do List",quote:"Quote",internal:"Link to Note",context:"Embed Existing Context",flow:"Embed Note or Space",board:"New Board",divider:"Divider",note:"Note Block",link:"Web Link",internalLink:"Link",callout:"Callout",bookmark:"Bookmark",table:"New Table",codeblock:"Code Block",toggle:"Toggle",emoji:"Emoji",image:"Image",newNote:"Note",tag:"Tag",makeMenu:"Flow Menu",selectStyle:"Style",toggleKeyboard:"Toggle Keyboard",rows:"Rows",masonry:"Gallery"},styles:{bold:"Bold",italics:"Italics",strikethrough:"Strikethrough",code:"Code",link:"Web Link",blocklink:"Link to Note",textColor:"Text Color",highlight:"Highlight"},commandsSuggest:{noResult:"No result"},commandPalette:{enable:"Enable",disabled:"Disable",openFlow:"Open Flow Blocks in Selection",closeFlow:"Close Flow Blocks in Selection",toggleBold:"Toggle Bold",toggleItalics:"Toggle Italics",openSpaces:"Open Navigator",blink:"Blink",openFileContext:"Open Explorer",convertPathToSpace:"Convert to Space",revealFile:"Reveal File in Navigator",releaseNotes:"Release Notes",getStarted:"Get Started",toggleBacklinks:"Toggle Backlinks",collapseAllFolders:"Collapse All Folders",addFileSpace:"Add File to Space",removeFileSpace:"Remove File from Space"},frames:{sections:{kit:"Kit",paths:"Paths"},label:{label:"Label",description:"Label"},note:{label:"Note",description:"Link to a note"},table:{label:"Table",description:"Table"},context:{label:"Context",description:"Display a context view from another space"},calendar:{label:"Calendar View"},field:{label:"Field",description:"Dynamic node that displays a value based on property type"},event:{label:"Event"},divider:{label:"Divider",description:"Divider to separate your content"},button:{label:"Button",description:"Buttons can perform actions and open links"},callout:{label:"Callout",description:"Callout to highlight important information"},toggle:{label:"Toggle",description:"Toggle to show/hide content"}},menu:{layout:"Layout",enterFlowState:"Enter Flow State",exitFlowState:"Exit Flow State",newView:"New View",calendarView:"Calendar View",dayView:"Day View",closeSpace:"Close Space in Focus",customView:"Custom View",detailsView:"Details View",catalogView:"Catalog View",galleryView:"Gallery View",deleteContext:"Delete Context",openSpace:"Open",revealInDefault:"Reveal in Finder",revealInExplorer:"Reveal in Explorer",setNone:"None",fileMetadataDescription:"This note only",openFilePane:"Open in a new pane",rename:"Rename",changeToFolderNote:"New Space from Note",moveFile:"Move file to...",moveFolder:"Move folder to...",duplicate:"Make a copy",edit:"Edit",delete:"Delete",getHelp:"Make.md Community",vault:"Vault",openVault:"Open Another Vault",openVaultInFolder:"Open Vault Folder",obSettings:"Obsidian Settings",commandPalette:"Command Palette",backToSpace:"Back to Navigator",collapseAllSections:"Collapse All Spaces",expandAllSections:"Expand All Spaces",collapseAllFolders:"Collapse All Folders",expandAllFolders:"Expand All Folders",spaceTitle:"Add/Remove in Space",home:"Home",none:"None",tableView:"Table View",cardView:"Card View",boardView:"Board View",listView:"List View",flowView:"Flow View",groupBy:"Group",sortBy:"Sort",filters:"Filters",newFilter:"New Filter",clearFilters:"Clear Filters",hide:"Hide",unhideFields:"Unhide All Properties",importDataview:"Import All Dataview Properties",saveAllProperties:"Save All Properties to Files",mergeProperties:"Merge Properties",removeFromSpace:"Unpin from Space",editCode:"Edit Code",editProperties:"Edit Properties",properties:"Properties",deleteProperty:"Delete Property",hideProperty:"Hide Property",unhideProperty:"Unhide Property",saveProperty:"Save Property",sortAscending:"Sort Ascending",sortDescending:"Sort Descending",deleteRow:"Delete Item",collapseAll:"Collapse All",customSort:"Custom Sort",groupSpaces:"Group Spaces",recurisveSort:"Apply to Subfolders",fileNameSortAlphaAsc:"File Name (A to Z)",fileNameSortAlphaDesc:"File Name (Z to A)",fileNameSortNumericalAsc:"File Name (1 to 9)",fileNameSortNumericalDesc:"File Name (9 to 1)",createdTimeSortAsc:"Created Time (new to old)",createdTimeSortDesc:"Created Time (old to new)",modifiedTimeSortAsc:"Modified Time (new to old)",modifiedTimeSortDesc:"Modified Time (old to new)",sizeSortAsc:"Size (smallest to largest)",sizeSortDesc:"Size (largest to smallest)",spaces:"Spaces",tags:"Tags",manageHiddenFiles:"Manage Hidden Files",manageActions:"Manage Actions",deleteSpace:"Delete",changeColor:"Change Color",changePropertyType:"Change Type",deleteFiles:"Delete Files",createFolderSpace:"Create Space from Folder",folder:"Folder",syncToContext:"Add Property to Context",setIcon:"Set Icon",copyEmbedLink:"Copy Embed Link",moveUp:"Move Up",moveDown:"Move Down",moveTo:"Move To",groupNodes:"Group Nodes",moveFrame:"Move Frame",renameFrame:"Rename Frame",deleteFrame:"Delete Frame",insertAbove:"Insert Above",insertBelow:"Insert Below"},editor:{rows:"Rows",columns:"Columns",catalog:"Catalog",gallery:"Gallery",grid:"Grid",scaleToFit:"Change to Fit",scaleToFill:"Change to Fill",fit:"Fit",strokeNone:"None",strokeSolid:"Solid",strokeDotted:"Dotted",strokeDashed:"Dashed",size:"Size",gap:"Gap",marginLeft:"Left",marginTop:"Top",marginRight:"Right",marginBottom:"Bottom",minimize:"Minimize",paddingLeft:"Left",paddingTop:"Top",paddingRight:"Right",paddingBottom:"Bottom",unlinkProperty:"Unlink Property",linkedProperty:"Linked Property",linkProperty:"Link Property",currentSpace:"Current Space",linkName:"${1} Link",linkThumbnail:"${1} Thumbnail",linkSticker:"${1} Sticker",opacity:"Opacity",shadowSpread:"Spread",shadowBlur:"Blur",width:"Width",height:"Height",margin:"Margin",padding:"Padding",bold:"Bold",italic:"Italic",underline:"Underline",alignLeft:"Align Left",alignCenter:"Align Center",alignRight:"Align Right",alignJustify:"Align Justify",numberOfLines:"Lines",createVerticalSection:"Create Vertical Section",createHorizontalSection:"Create Horizontal Section",themeColors:"Theme Colors",uiColors:"UI Colors",hex:"Hex"},buttons:{add:"Add",togglePin:"Toggle Pin",refresh:"Refresh",showHidden:"Show Hidden",alias:"Alias",addFilter:"Add Filter",loadMore:"Load More",addCondition:"Add Condition",customize:"Customize",moreOptions:"More Options",saveProperty:"Save Property",newNote:"New Note",changeIcon:"Change Sticker",removeIcon:"Remove Sticker",addIcon:"Add Sticker",addCover:"Add Cover",addDisplay:"Display Name",changeBanner:"Change Cover",changeBannerShort:"Cover",saveChanges:"Save Changes",removeBanner:"Remove Cover",rename:"Change Name",editFrame:"Edit Frame",saveSpace:"Save Space",createSpace:"New Space",createFolder:"New Folder",createNote:"New Note",createCanvas:"New Canvas",addIntoSpace:"New Pin",addSmartSearch:"Add Live Search",subFolders:"Sub Folders",addItem:"Add Item",addProperty:"Add Property",editProperty:"Edit Property",addContext:"Add Context",cancel:"Cancel",search:"Search",delete:"Delete",toggleFlow:"Toggle Flow",openFlow:"Open Flow",hideFlow:"Hide Flow",openLink:"Open Link",addToSpace:"Add to Space",addToSpaceShort:"Pin",addTag:"Add Tag",tag:"Tag",syncFields:"Sync Properties",convertTable:"Convert to Markdown",cutTable:"Cut Table",deleteTable:"Delete From Note",blink:"Blink",addFile:"Add Item",merge:"Merge",saveView:"Save View",saveTable:"Save Table",renameView:"Rename View",deleteView:"Delete View",renameTable:"Rename Table",renameTag:"Rename Tag",createTag:"Create Tag",currentFolder:"Current Folder",sync:"Sync",pasteCSS:"Paste CSS",save:"Save",run:"Run"},metadataTypes:{fileName:"File Name",contexts:"Contexts",path:"Path",folder:"Folder",sticker:"Sticker",color:"Color",created:"Created",lastModified:"Last Modified",extension:"Extension",size:"Size",tags:"Tags",inlinks:"Linked Mentions",outlinks:"Links",label:"Label",fileMetadata:"File Metadata",frontmatter:"Frontmatter"},filterTypes:{contains:"contains",notContains:"does not contain",is:"is",isNot:"is not",before:"before",after:"on or after",anyOf:"is any of",noneOf:"is none of",checked:"is checked",unchecked:"is unchecked",isEmpty:"is empty",isNotEmpty:"is not empty",isSameDate:"is same date",isSameDateAsToday:"today"},sortTypes:{alphaAsc:"A to Z",alphaDesc:"Z to A",earliest:"Earliest",latest:"Latest",checkAsc:"Checked \\u2192 Unchecked",checkDesc:"Unchecked \\u2192 Checked",itemsAsc:"Least Items",itemsDesc:"Most Items"},properties:{defaultField:"Name",aggregate:{label:"Aggregate",description:"Aggregate functions to calculate values"},audio:{label:"Audio",description:"Audio"},text:{label:"Text",description:"Text field"},number:{label:"Number",description:"Number field with optional unit"},boolean:{label:"Yes/No",description:"Yes or No toggle to indicate the status"},date:{label:"Date",description:"Select a date from a calendar"},option:{label:"Option",description:"Select one or multiple option from a list"},file:{label:"File"},link:{label:"Link",description:"Link to another note or a website"},tags:{label:"Tags",description:"Use tags to quickly organize your items"},object:{label:"Object",description:"Store any complex objects"},context:{label:"Relation",description:"Connect to another context property and create a relation"},image:{label:"Image",description:"Select any image from your system or from the internet"},color:{label:"Color",description:"Use colors to label your items or status"},space:{label:"Context",description:"Link to a context"},icon:{label:"Sticker",description:"Use stickers to uniquely label your items or status"},super:{label:"Super Property",links:"Open Link",properties:"Update Property",api:"API",obsidianCommands:"Run Command",runCommand:"Run Command",performAction:"Perform Action",whenClicked:"When Clicked"},fileProperty:{name:"Name",label:"Formula",createdTime:"Created",modifiedTime:"Last Edited",sticker:"Sticker",links:"Links",tags:"Tags",spaces:"Spaces",extension:"Extension",size:"Size",preview:"Note Preview",parentFolder:"Folder",description:"Use a formula to dynamically display a property"}},views:{navigator:"Navigator",explorer:"Explorer",space:"Space"},subViews:{spaceItems:"Items",spaceContext:"Context",spaceLists:"Lists",spaceActions:"Actions",spaceTemplates:"Templates",smartSearch:"Live Searches",filesAndFolders:"Files and Folders"},labels:{duplicateTable:"Duplicate Table",aggregateBy:"Aggregate By",pinned:"Pinned",live:"Pinned by Live Search",moveTable:"Move Table",editFormula:"Edit Formula",editObject:"Edit Object",properties:"Properties",newAction:"Action",newTable:"List",template:"Template",createFolder:"New Folder Name",rename:"Rename",createNew:"New",default:"Default",done:"Done",changeCoverShort:"Change",reposition:"Reposition",tables:"Tables",selectDateFormat:"Select/Type Date Format",renameSection:"Edit Space",createSection:"New Folder",createNote:"New Note",contextMaker:"Context Maker",select:"Select",pinnedItems:"Pinned Items",collapse:"Collapse",expand:"Expand",all:"All",none:"None",view:"View",findStickers:"Find Sticker",mergeProperties:"Merge Properties",placeholder:"Type \'${1}\' for commands",notePlaceholder:"New Note for ${1}",itemsSelected:"${1} Selected",selectNote:"Select Note",selectIcon:"Select Icon",selectImage:"Select Image",selectSpace:"Select Space",styleSmall:"Small",styleMedium:"Medium",styleLarge:"Large",hiddenFilePattern:"Name, Suffixes and Extension",hiddenFileSpecific:"Exclude specific files and folders",textPlaceholder:"Enter Text",noFile:"is not created yet. Click to create.",navigatorSearchPlaceholder:"Search by Text or Filters",blinkPlaceholder:"Search for notes, spaces...",searchPlaceholder:"Type to search...",contextItemSelectPlaceholder:"Find Item",linkItemSelectPlaceholder:"Find or Create Note",pinNotePlaceholder:"Select a Note or Space to Pin",optionItemSelectPlaceholder:"Select Option",viewItemSelectPlaceholder:"Select View",tagItemSelectPlaceholder:"Find Tag",spaceSelectPlaceholder:"Select any Folder or Tag",propertyItemSelectPlaceholder:"Select Property",sortItemSelectPlaceholder:"Select Sort",filterItemSelectPlaceholder:"Select Filter",imageSelectPlaceholder:"Select an image or paste a URL",imageNotFoundPlaceholder:"No Images Found",syncFrontmatterProperty:"Sync Frontmatter Property",newProperty:"New Property",newPropertyShort:"New Property",propertyType:"Type",propertyDynamic:"Dyanmic",propertyValueSpace:"Space",propertyValueReference:"Related Property",propertyValueAggregate:"Aggregate Property",propertyValueProperty:"Property",propertyLookup:"Edit Formula",existingFrontmatter:"Existing Property",dateFormat:"Date Format",propertyFileProp:"Property",multiple:"Multiple",filesCount:"{$1} Files",hiddenFiles:"Hidden Files",addExtension:"Add Rule",saveView:"Save View",saveTable:"Save Table",renameView:"Rename View",renameTable:"Rename Table",syncMetadata:"Sync Metadata",syncProperties:"Sync Properties",selectContext:"Select Context",metadata:"Metadata",backlinks:"Backlinks",spaces:"Spaces",contexts:"Contexts",content:"Content",deleteSpace:"Delete Space",deleteFiles:"Delete Files",outgoingLinks:"Outgoing Links",moveTo:"Move to",addTo:"Pin to",copyTo:"Copy to",reorderIn:"Reorder in",border:"Border",corners:"Corners",color:"Color",backgroundColor:"Background",cornerRadius:"Radius",onClick:"On Click",layout:"Layout",element:"Element",name:"Name",display:"Display",alignment:"Alignment",margin:"Margin",padding:"Padding",gap:"Gap",width:"Width",height:"Height",opacity:"Opacity",shadow:"Shadow",shadowBlur:"Blur",shadowSpread:"Spread",typography:"Typography",layers:"Layers",fontSize:"Size",props:"Props",styles:"Styles",events:"Events",code:"Code",selectedLayers:"${1} Layers"},descriptions:{spaceActions:"Create actions that runs when you press a button",spaceLists:"Create lists to track data and organize them in your space",spaceItems:"Add new items to the space or pin items to the space",spaceTemplates:"Create templates to quickly add items to your space",smartSearch:"Automatically pin notes to this space based on a set of searches",hiddenFileOptions:"Exclude any files and folders by name, suffix or extension.",deleteSpace:"Deleting the space will also delete the folder and its contents.",deleteFiles:"Delete ${1} files/folders and their contents?",addContext:"Contexts lets you connect properties from your tags",spaceProperties:"Define Properties for your Space Items",syncMetadata:"Select which fields from your notes to start syncing with the context.",syncProperties:"Contexts defines and syncs the same fields across your notes depending on their folder or tag.",selectContext:"Select which folder or tag context you want to sync the fields."},flowView:{emptyDoc:"Empty Document",itemsCount:" Items",emptyFolder:"This Folder is Empty"},notice:{duplicateFile:"Folder already contains note with same name",addedToSection:"Added to Space",fileExists:"File Already Exists",folderExists:"Folder Already Exists",noPropertyName:"Property Name is Required",noPropertiesFound:"No Properties Found",duplicatePropertyName:"Duplicate Property Name",newSpaceName:"Enter a name for your space",duplicateSpaceName:"Space name already exists",cantConvertNoteToSpace:"The view is not a note",templateSaved:"Template saved to space: ",tableDeleted:"Table removed from note, you can find the table in the folder space"},settings:{sections:{general:"General",navigator:"Navigator",appearance:"Appearance",interaction:"Preferences",context:"Context",label:"Labels",tags:"Tags",space:"Spaces",performance:"Performance",advanced:"Advanced",folderNote:"Folder Note",notes:"Notes"},searchWorker:{name:"Background Search",desc:"Search in background to improve reponsiveness while searching"},cacheIndex:{name:"Cache Search Index",desc:"Cache the index for faster search results"},layoutVertical:"Vertical",layoutHorizontal:"Horizontal",sectionGeneral:"General",sectionSidebar:"Spaces",sectionEditor:"Maker Mode",sectionFlow:"Flow",sectionAdvanced:"Advanced",sectionDataview:"Dataview",sectionContext:"Context",sectionStickers:"Labels",sectionNavigator:"Navigator",sectionDefault:"Default Spaces",sectionSpaceView:"Space View",sectionBlink:"Blink",sectionInlineContext:"Inline Context",sectionFlowBlock:"Flow Block",sectionFlowMenu:"Flow Menu",sectionFlowStyler:"Flow Styler",experimental:{name:"Experimental",desc:"Experimental features that are subject to change and may not be optimized for performance"},imageThumbnails:{name:"Generate Thumbnails",desc:"Create thumbnails for images to speed up performance"},minimalThemeFix:{name:"Minimal Theme Fix",description:"Apply fixes for the popular theme Minimal"},inlineStickerMenu:{name:"Inline Stickers",desc:"Add inline stickers by typing :"},openSpacesOnLaunch:{name:"Open Navigator as Default Tab",desc:"Open the Navigator tab when Obsidian launches"},spacesRightSplit:{name:"Navigator on Right Side",desc:"Open the Navigator in the right panel"},defaultSpaceTemplate:{name:"Default Space Template",desc:"Select the default template for new spaces"},defaultDateFormat:{name:"Default Date Format",desc:"Set the default date format, example: yyyy-MM-dd (see https://date-fns.org/v2.30.0/docs/format)"},defaultTimeFormat:{name:"Default Time Format",desc:"Set the default time format, example: h:mm a (see https://date-fns.org/v2.30.0/docs/format)"},autoAddContextsToSubtags:{name:"Apply Properties to Subtags",desc:"Automatically apply context properties to subtags"},newNotePlaceholder:{name:"New Note Placeholder",desc:"Default name for new notes"},folderIndentationLines:{name:"Show Folder Indentation Lines",desc:"Turn on to show a line on the left of folders to indicate indentation"},folderNoteLocation:{name:"Folder Note Location Inside Folder",desc:"Turn on to have folder notes inside the folder, turn off to have it outside"},folderViewDefault:{name:"Show Folder Note by Default",desc:"Show the folder note by default when opening a folder"},internalLinkFlowEditor:{name:"Show Toggles to Open Flow Editor on Links",desc:"Turn on to toggle Flow Blocks directly in inline links"},internalLinkSticker:{name:"Show Stickers on Links",desc:"Turn on to toggle stickers shown directly by beside internal links"},saveAllContextToFrontmatter:{name:"Sync Context Fields to Frontmatter",desc:"Turn on to automatically save all context fields to frontmatter fields, not just existing frontmatter fields."},syncFormulaToFrontmatter:{name:"Sync Formula Fields to Frontmatter",desc:"Turn on to save calculated formula values to frontmatter fields."},spaceSubFolder:{name:"Space Folder Name",desc:"Name of the folder for spaces"},basics:{name:"Make.md Basics",desc:"Enable features from Make.md Basics including styler and flow blocks"},spacesFolder:{name:"Tag Space Folder",desc:"Name of the folder for tag spaces"},dataviewInlineContext:{name:"Show Dataview in Inline Context",desc:"Show dataview when inline context is enabled"},inlineContext:{name:"Notes Header",desc:"Show a header to display labels and properties"},banners:{name:"Cover Image",desc:"Show a cover image for notes and spaces"},inlineContextProperties:{name:"Show Context Properties in Header",desc:"Show the properties in the header for notes and spaces"},inlineContextExpanded:{name:"Auto Expand Context Properties",desc:"Expand the inline context sections when opening a note"},inlineContextNameLayout:{name:"Title and Sticker Layout",desc:"Layout for inline title and sticker in Inline Context"},hideFrontmatter:{name:"Hide Context Properties",desc:"Hide properties you have added in context from the Obsidian properties panel"},autoOpenFileContext:{name:"Auto Open Explorer",desc:"Automatically open explorer panel in the right panel"},enableFolderNote:{name:"Enable Folder Note",desc:"Access the folder note in the folder page and hide the folder note from spaces"},folderNoteName:{name:"Folder Note Name",desc:"Name of the folder note, keep blank to use the same name as the folder"},expandFolderOnClick:{name:"Auto Expand Folder",desc:"Auto expand folders on click"},filePreviewOnHover:{name:"Preview on Hover",desc:"Preview on Hover while holding Control/Command key"},revealActiveFile:{name:"Reveal Active File",desc:"Automatically reveal the active file in Navigator"},contextEnabled:{name:"Contexts",desc:"Contexts allows you to have full control over the metadata of your files"},navigatorEnabled:{name:"Navigator",desc:"The navigator lets you create and organize your spaces"},spacesStickers:{name:"Stickers",desc:"Use Emojis to make it easier to find your notes"},spacesUseAlias:{name:"Alias",desc:"Use the alias metadata to show in Navigator"},spacesDisablePatch:{name:"Compatibility Mode",desc:"This will improve the compatibility of plugins while using the Navigator"},deleteFileOption:{name:"Delete File Option",desc:"Select how you want files to be deleted"},spacesDeleteOptions:{permanant:"Delete Permanently",trash:"Move to Obsidian Trash","system-trash":"Move to System Trash"},flowState:{name:"Flow State",desc:"Toggle the flow state"},showRibbon:{name:"App Ribbon",desc:"Show/hide the left menu aka. ribbon"},spaceViewEnabled:{name:"Spaces",desc:"Customize your folders and tags with properties and views"},defaultSpaces:{name:"Default Spaces",desc:"Recommended spaces for quickly organizing your vault"},homeSpace:{name:"Home Space",desc:"An easy-to-access space where you can add/organize your other spaces"},enableDefaultSpaces:{name:"Tag Spaces",desc:"Automatically create spaces for each of your tags"},readableLineWidth:{name:"Readable Line Width",desc:"Use Readable Line Width"},sidebarTabs:{name:"Sidebar Tabs",desc:"Show/hide other sidebar tabs"},spacesPerformance:{name:"Navigator Scroll Performance",desc:"Turn on performance mode for Navigator, may affect scrolling appearance. Requires Restart"},indexSVG:{name:"Use SVGs as Stickers",desc:"Use any svg file in your vault as a sticker"},inlineStyler:{name:"Flow Styler",desc:"Select text to add styling"},inlineStylerColor:{name:"Text and Highlight Colors \\u{1F9EA}",desc:"Select text color and highlight color, (this may change in the future because of the limitations with HTML and Obsidian)"},spaceRowHeight:{name:"Row Height",desc:"The height for each row in navigator (in pixels), default is 29"},contextPagination:{name:"Table View Pagination",desc:"Number of items per page in table view"},bannerHeight:{name:"Cover Height",desc:"The height for the cover of the note or space, default is 200"},makeChar:{name:"Flow Menu Trigger",desc:"Character to open the Flow Menu"},mobileMakeBar:{name:"Flow Styler (Mobile)",desc:"Replaces the mobile toolbar"},editorMarkSans:{name:"Mark Sans \\u{1F9EA}",desc:"Use the editor without Markdown."},editorMakePlacholder:{name:"Flow Menu Hint Text",desc:"Show a hint text on how to open the Flow Menu Shortcut"},blinkEnabled:{name:"Blink",desc:"A faster way to search and edit your notes"},editorMakeMenu:{name:"Flow Menu",desc:"Open the Flow menu to quickly add content"},editorMakeMenuTrigger:{name:"Flow Menu Shortcut",desc:"Trigger key to use flow menu"},editorFlowReplace:{name:"Flow Block",desc:"Open your internal links or toggle your embeds in the flow block."},editorFlowStyle:{name:"Flow Block Style",desc:"Select a theme for your flow block",seamless:"Seamless",minimal:"Minimal"}}}};this.lang="en";let r=wn.default.locale();["en"].includes(r)&&(this.lang=r)}get texts(){return this.all.en}},F=new Er().texts;var Ge="files",bt={id:Ge,name:"Items",type:"db",primary:"true"};var xn={uniques:["name,schemaId"],cols:["name","schemaId","type","value","attrs","hidden","unique","primary"]},kt={...xn,rows:[{name:it,schemaId:Ge,type:"file",primary:"true",hidden:"",unique:"",attrs:"",value:""},{name:"Created",schemaId:Ge,type:"fileprop",value:it+".ctime",hidden:"",unique:"",attrs:"",primary:"true"}]};var Qt={...xn,rows:[{name:it,schemaId:Ge,type:"file",primary:"true",hidden:"",unique:"",attrs:"",value:""}]};var ah=[{type:"unknown",label:"",restricted:!0,icon:"ui//file-question"},{type:"any",label:"",restricted:!0,icon:"ui//wildcard",multi:!0,multiType:"any-multi"},{type:"text",label:F.properties.text.label,metadata:!0,icon:"ui//text",primative:!0,description:F.properties.text.description},{type:"number",label:F.properties.number.label,metadata:!0,icon:"ui//binary",configKeys:["unit"],primative:!0,description:F.properties.number.description},{type:"boolean",label:F.properties.boolean.label,metadata:!0,icon:"ui//check-square",primative:!0,description:F.properties.boolean.description},{type:"date",label:F.properties.date.label,metadata:!0,icon:"ui//calendar",configKeys:["format"],primative:!0,description:F.properties.date.description},{type:"option",label:F.properties.option.label,multi:!0,multiType:"option-multi",icon:"ui//list",configKeys:["options","source"],description:F.properties.option.description},{type:"tags-multi",label:F.properties.tags.label,icon:"ui//tags",description:F.properties.tags.description},{type:"file",label:F.properties.file.label,restricted:!0,icon:"ui//mk-make-h3"},{type:"fileprop",label:F.properties.fileProperty.label,icon:"ui//formula",configKeys:["field","value","type"],description:F.properties.fileProperty.description},{type:"link",label:F.properties.link.label,multi:!0,multiType:"link-multi",metadata:!0,icon:"ui//file-text",primative:!0,description:F.properties.link.description},{type:"context",label:F.properties.context.label,icon:"ui//mk-make-note",multi:!0,multiType:"context-multi",configKeys:["space","field"],description:F.properties.context.description},{type:"aggregate",label:F.properties.aggregate.label,icon:"ui//mk-make-note",multi:!1,configKeys:["ref","field","fn"],description:F.properties.aggregate.description},{type:"object",label:F.properties.object.label,multi:!0,multiType:"object-multi",metadata:!0,icon:"ui//list-tree",configKeys:["type","typeName"],description:F.properties.object.description},{type:"icon",label:F.properties.icon.label,multi:!0,multiType:"icon-multi",icon:"ui//gem",restricted:!0,primative:!0,description:F.properties.icon.description},{type:"image",label:F.properties.image.label,multi:!0,multiType:"image-multi",metadata:!0,icon:"ui//mk-make-image",primative:!0,description:F.properties.image.description},{type:"color",label:F.properties.color.label,icon:"ui//mk-make-image",restricted:!0,description:F.properties.color.description},{type:"space",label:F.properties.space.label,icon:"ui//layout-grid",restricted:!0,description:F.properties.space.description},{type:"table",label:F.properties.space.label,icon:"ui//layout-grid",restricted:!0,description:F.properties.space.description},{type:"super",label:F.properties.super.label,icon:"ui//zap",restricted:!0,configKeys:["dynamic","field"]},{type:"input",label:F.properties.super.label,icon:"ui//input",restricted:!0}];var Bu="filesView",Gu={id:Bu,name:"All",type:"view",def:JSON.stringify({db:Ge,icon:"ui//file-stack"})},qu="main",zu=n=>({id:n,name:n,type:"frame",def:"",predicate:"",primary:"true"}),nh={uniques:[],cols:["id","name","type","def","predicate","primary"],rows:[zu(qu),Gu]},Zt={uniques:[],cols:["id","name","type","def","predicate","primary"],rows:[bt]};var ih={schema:bt,cols:kt.rows,rows:[]},sh={schema:bt,cols:kt.rows,rows:[]},oh={schema:bt,cols:Qt.rows,rows:[]},vn=(n,r)=>n.filter(s=>r.find(o=>o.id==s.schemaId&&o.type=="db")).reduce((s,o)=>({...s,...s[o.schemaId]?{[o.schemaId]:{uniques:o.unique=="true"?[...s[o.schemaId].uniques,o.name]:s[o.schemaId].uniques,cols:[...s[o.schemaId].cols,o.name],rows:[]}}:{[o.schemaId]:{uniques:o.unique=="true"?[o.name]:[],cols:[o.name],rows:[]}}}),{});var lh={m_schema:Zt,m_fields:kt,...vn(kt.rows,Zt.rows)},uh={m_schema:Zt,m_fields:Qt,...vn(Qt.rows,Zt.rows)};var bn=n=>[...new Set(n)];var Rr=(n,r)=>{if(n instanceof Date)return"date";if(typeof n=="string"){if(/\\/\\/(\\S+?(?:jpe?g|png|gif|svg))/gi.test(n)||n.includes("unsplash"))return"image";if(/^\\d{4}-\\d{2}-\\d{2}$/.test(n))return"date";if(r=="tag"||r=="tags")return"tags-multi";if(/\\[\\[.*?\\]\\]/.test(n))return"link"}else{if(typeof n=="number")return"number";if(typeof n=="boolean")return"boolean";if(n)if(Array.isArray(n)||typeof n=="string"&&n.indexOf(",")>-1){let s=Array.isArray(n)?n:[];if(typeof n=="string"&&n.indexOf(",")>-1&&(s=Ee(n)),r=="tag"||r=="tags")return"tags-multi";if(s.length==1&&Array.isArray(s[0])&&s[0].length==1&&typeof s[0][0]=="string")return"link";let o=bn(s.map(u=>Rr(u,r)));return o.length==1&&o[0]=="link"?"link-multi":o.some(u=>u=="object")?"object-multi":"option-multi"}else return n.isLuxonDateTime?"date":n.isLuxonDuration?"duration":n.type=="file"?"link":typeof n=="object"&&!Array.isArray(n)&&n!==null?"object":"unknown";else return"unknown"}return"text"};var kn=n=>n.map(r=>r.replace(",","\\\\,")).join(", "),ot=n=>JSON.stringify(n);var Ee=n=>n?.startsWith("[")?Xa(qt(n)).map(r=>en(r)):Qu(n),Qu=n=>(n?.replace("\\\\,",",")?.match(/(\\\\.|[^,])+/g)??[]).map(r=>r.trim()),Hr=(n,r,s)=>{let o=s??Rr(r,n);if(!r)return"";switch(o){case"tags-multi":return r;case"object":case"object-multi":{if(Array.isArray(r)){if(r[0].path)return JSON.stringify(r.map(u=>u.path))}else if(r.path)return r.path;return JSON.stringify(r)}break;case"number":return r.toString();case"boolean":return r?"true":"false";case"date":{if(r instanceof Date){let u=zt(r,"yyyy-MM-dd");return typeof u=="string"?u:""}return typeof r!="string"?"":r}break;case"duration":return kn(Object.keys(r.values).reduce((u,d)=>[...u,...r.values[d]>0?[r.values[d]+" "+d]:[]],[]));case"option-multi":case"link-multi":case"context-multi":return typeof r=="string"?Ur(r):ot(r.map(u=>u?typeof u=="string"?Ur(u):u.path?u.path:Array.isArray(r)&&u.length==1&&Array.isArray(u[0])&&u[0].length==1&&typeof u[0][0]=="string"?u[0][0]:JSON.stringify(u):""));case"link":case"context":return Array.isArray(r)&&r.length==1&&Array.isArray(r[0])&&r[0].length==1&&typeof r[0][0]=="string"?r[0][0]:typeof r=="string"?Ur(r):r.path;case"text":case"tag":case"option":case"image":return r}return""};var qt=n=>{let r;try{r=JSON.parse(n)}catch{}return r};var Ur=n=>{if(!n)return"";let r=/\\[\\[(.*?)\\]\\]/g.exec(n),s=r?.length>1?r[1].substring(0,tn("|",r[1])):n;return s||n};var _n=(n,r)=>{let s=n?Ee(n):[],o=r?Ee(r):[];return o.every(u=>s.some(d=>d==u))&&s.every(u=>o.some(d=>d==u))},lt=(n,r)=>n==r,Vr=(n,r)=>(n??"").length==0,jr=(n,r)=>(n??"").toLowerCase().includes((r??"").toLowerCase()),$r=(n,r)=>parseFloat(n)>parseFloat(r),Br=(n,r)=>parseInt(n){let s=isNaN(Date.parse(n))?new Date(parseInt(n)):new Date(n),o=isNaN(Date.parse(r))?new Date(parseInt(r)):new Date(r);return s.valueOf()>=o.valueOf()},Dn=(n,r)=>{let s=isNaN(Date.parse(n))?new Date(parseInt(n)):new Date(n),o=isNaN(Date.parse(r))?new Date(parseInt(r)):new Date(r);return s.valueOf(){let s=n?Ee(n):[],o=r?Ee(r):[];return s.length==0?!1:o.some(u=>s.some(d=>d==u))},Mn=(n,r)=>{if(!n)return!1;let s=new Date(`${n.toString().replace(".",":")}`),o=new Date(`${r}`);return s.getMonth()===o.getMonth()&&s.getDate()===o.getDate()},On=n=>{if(!n)return!1;let r=new Date(`${n.toString()}T00:00`),s=new Date;return r.getMonth()===s.getMonth()&&r.getDate()===s.getDate()};var ut={isNotEmpty:{type:["text","file","number","option","option-multi","link","link-multi","image"],fn:(n,r)=>!Vr(n,""),valueType:"none"},isEmpty:{type:["text","file","number","option","option-multi","link","link-multi","image"],fn:(n,r)=>Vr(n,""),valueType:"none"},include:{fn:(n,r)=>jr(n,r),type:["text","file","link","image"],valueType:"text"},notInclude:{type:["text","file","link","image"],fn:(n,r)=>!jr(n,r),valueType:"text"},is:{type:["text"],fn:(n,r)=>lt(n,r),valueType:"text"},isNot:{type:["text"],fn:(n,r)=>!lt(n,r),valueType:"text"},equal:{type:["number"],fn:(n,r)=>lt(n,r),valueType:"number"},isLink:{type:["link","context"],fn:(n,r)=>lt(n,r),valueType:"link"},isNotLink:{type:["link","context"],fn:(n,r)=>!lt(n,r),valueType:"link"},isGreatThan:{type:["number"],fn:(n,r)=>$r(n,r),valueType:"number"},isLessThan:{type:["number"],fn:(n,r)=>Br(n,r),valueType:"number"},isLessThanOrEqual:{type:["number"],fn:(n,r)=>!$r(n,r),valueType:"number"},isGreatThanOrEqual:{type:["number"],fn:(n,r)=>!Br(n,r),valueType:"number"},dateBefore:{type:["date"],fn:(n,r)=>Dn(n,r),valueType:"date"},dateAfter:{type:["date"],fn:(n,r)=>Tn(n,r),valueType:"date"},isSameDate:{type:["date"],fn:(n,r)=>Mn(n,r),valueType:"date"},isSameDateAsToday:{type:["date"],fn:(n,r)=>On(n,r),valueType:"none"},isExactList:{type:["option","option-multi","link-multi","context-multi","tags-multi"],fn:(n,r)=>_n(n,r),valueType:"list"},isAnyInList:{type:["option","context","link","option-multi","link-multi","context-multi","tags-multi"],fn:(n,r)=>Gr(n,r),valueType:"list"},isNoneInList:{type:["option","context","link","option-multi","link-multi","context-multi","tags-multi"],fn:(n,r)=>!Gr(n,r),valueType:"list"},isTrue:{type:["boolean"],fn:(n,r)=>n=="true",valueType:"none"},isFalse:{type:["boolean"],fn:(n,r)=>n!="true",valueType:"none"}};var Zu=(n,r,s)=>r.reduce((u,d)=>{let[f,m]=u,p=d.type=="context"?Fn(m,d,s):d.type=="path"?Pn(m,d,s):d.type=="frontmatter"?Cn(m,d,s):Nn(m,d,s),y=m.filter(w=>!p.includes(w));return[[...f,...p],y]},[[],n])[0],Ju=(n,r,s)=>r.reduce((o,u)=>u.type=="context"?Fn(o,u,s):u.type=="path"?Pn(o,u,s):u.type=="frontmatter"?Cn(o,u,s):Nn(o,u,s),n),Fn=(n,r,s)=>{let o=ut[r.fn];return!o||o.valueType!="none"&&r.value.length==0?[]:n.filter(u=>{let[d,f]=r.field.split("."),m=u.metadata?.property;if(!u.spaces?.includes(d)||!m||!m[f])return!1;let p=!0;if(o){let y=r.fType=="property"?s[r.value]:r.value;p=o.fn(Hr(f,m[f]),y)}return p})},Cn=(n,r,s)=>{let o=ut[r.fn];return!o||o.valueType!="none"&&r.value.length==0?[]:n.filter(u=>{let d=u.metadata?.property;if(!d||d[r.field]===void 0)return!1;let f=!0;if(o){let m=r.fType=="property"?s[r.value]:r.value;f=o.fn(Hr(r.field,d[r.field]),m)}return f})},Pn=(n,r,s)=>{let o=ut[r.fn];return!o||o.valueType!="none"&&r.value.length==0?[]:n.filter(u=>{let d="";r.field=="outlinks"?d=ot(u.outlinks??[]):r.field=="inlinks"?d=ot(u.metadata?.inlinks??[]):r.field=="tags"&&(d=ot(u.tags??[]));let f=!0;if(o){let m=r.fType=="property"?s[r.value]:r.value;f=o.fn(d,m)}return f})},Nn=(n,r,s)=>{let o=ut[r.fn];return!o||o.valueType!="none"&&r.value.length==0?[]:n.filter(u=>{let d=!0;if(o){let f=r.fType=="property"?s[r.value]:r.value;d=o.fn(u.metadata?.[r.type]?.[r.field],f)}return d})},Yn=(n,r,s)=>n.reduce((u,d)=>!u||d.filters.length==0?!1:d.type=="any"?Zu([r],d.filters,s).length>0:Ju([r],d.filters,s).length>0,!0);function Ce(n){return Array.isArray?Array.isArray(n):Hn(n)==="[object Array]"}var Ku=1/0;function Xu(n){if(typeof n=="string")return n;let r=n+"";return r=="0"&&1/n==-Ku?"-0":r}function ed(n){return n==null?"":Xu(n)}function Se(n){return typeof n=="string"}function Rn(n){return typeof n=="number"}function td(n){return n===!0||n===!1||rd(n)&&Hn(n)=="[object Boolean]"}function Un(n){return typeof n=="object"}function rd(n){return Un(n)&&n!==null}function le(n){return n!=null}function qr(n){return!n.trim().length}function Hn(n){return n==null?n===void 0?"[object Undefined]":"[object Null]":Object.prototype.toString.call(n)}var ad="Incorrect \'index\' type",nd=n=>`Invalid value for key ${n}`,id=n=>`Pattern length exceeds max of ${n}.`,sd=n=>`Missing ${n} property in key`,od=n=>`Property \'weight\' in key \'${n}\' must be a positive integer`,In=Object.prototype.hasOwnProperty,zr=class{constructor(r){this._keys=[],this._keyMap={};let s=0;r.forEach(o=>{let u=Vn(o);this._keys.push(u),this._keyMap[u.id]=u,s+=u.weight}),this._keys.forEach(o=>{o.weight/=s})}get(r){return this._keyMap[r]}keys(){return this._keys}toJSON(){return JSON.stringify(this._keys)}};function Vn(n){let r=null,s=null,o=null,u=1,d=null;if(Se(n)||Ce(n))o=n,r=Wn(n),s=Qr(n);else{if(!In.call(n,"name"))throw new Error(sd("name"));let f=n.name;if(o=f,In.call(n,"weight")&&(u=n.weight,u<=0))throw new Error(od(f));r=Wn(f),s=Qr(f),d=n.getFn}return{path:r,id:s,weight:u,src:o,getFn:d}}function Wn(n){return Ce(n)?n:n.split(".")}function Qr(n){return Ce(n)?n.join("."):n}function ld(n,r){let s=[],o=!1,u=(d,f,m)=>{if(!!le(d))if(!f[m])s.push(d);else{let p=f[m],y=d[p];if(!le(y))return;if(m===f.length-1&&(Se(y)||Rn(y)||td(y)))s.push(ed(y));else if(Ce(y)){o=!0;for(let w=0,x=y.length;wn.score===r.score?n.idx{this._keysMap[s.id]=o})}create(){this.isCreated||!this.docs.length||(this.isCreated=!0,Se(this.docs[0])?this.docs.forEach((r,s)=>{this._addString(r,s)}):this.docs.forEach((r,s)=>{this._addObject(r,s)}),this.norm.clear())}add(r){let s=this.size();Se(r)?this._addString(r,s):this._addObject(r,s)}removeAt(r){this.records.splice(r,1);for(let s=r,o=this.size();s{let f=u.getFn?u.getFn(r):this.getFn(r,u.path);if(!!le(f)){if(Ce(f)){let m=[],p=[{nestedArrIndex:-1,value:f}];for(;p.length;){let{nestedArrIndex:y,value:w}=p.pop();if(!!le(w))if(Se(w)&&!qr(w)){let x={v:w,i:y,n:this.norm.get(w)};m.push(x)}else Ce(w)&&w.forEach((x,b)=>{p.push({nestedArrIndex:b,value:x})})}o.$[d]=m}else if(Se(f)&&!qr(f)){let m={v:f,n:this.norm.get(f)};o.$[d]=m}}}),this.records.push(o)}toJSON(){return{keys:this.keys,records:this.records}}};function jn(n,r,{getFn:s=T.getFn,fieldNormWeight:o=T.fieldNormWeight}={}){let u=new _t({getFn:s,fieldNormWeight:o});return u.setKeys(n.map(Vn)),u.setSources(r),u.create(),u}function pd(n,{getFn:r=T.getFn,fieldNormWeight:s=T.fieldNormWeight}={}){let{keys:o,records:u}=n,d=new _t({getFn:r,fieldNormWeight:s});return d.setKeys(o),d.setIndexRecords(u),d}function Jt(n,{errors:r=0,currentLocation:s=0,expectedLocation:o=0,distance:u=T.distance,ignoreLocation:d=T.ignoreLocation}={}){let f=r/n.length;if(d)return f;let m=Math.abs(o-s);return u?f+m/u:m?1:f}function gd(n=[],r=T.minMatchCharLength){let s=[],o=-1,u=-1,d=0;for(let f=n.length;d=r&&s.push([o,u]),o=-1)}return n[d-1]&&d-o>=r&&s.push([o,d-1]),s}var qe=32;function yd(n,r,s,{location:o=T.location,distance:u=T.distance,threshold:d=T.threshold,findAllMatches:f=T.findAllMatches,minMatchCharLength:m=T.minMatchCharLength,includeMatches:p=T.includeMatches,ignoreLocation:y=T.ignoreLocation}={}){if(r.length>qe)throw new Error(id(qe));let w=r.length,x=n.length,b=Math.max(0,Math.min(o,x)),D=d,S=b,U=m>1||p,q=U?Array(x):[],G;for(;(G=n.indexOf(r,S))>-1;){let j=Jt(r,{currentLocation:G,expectedLocation:b,distance:u,ignoreLocation:y});if(D=Math.min(j,D),S=G+w,U){let A=0;for(;A=me;Q-=1){let H=Q-1,ie=s[n.charAt(H)];if(U&&(q[H]=+!!ie),pe[Q]=(pe[Q+1]<<1|1)&ie,j&&(pe[Q]|=(ne[Q+1]|ne[Q])<<1|1|ne[Q+1]),pe[Q]&xe&&(ee=Jt(r,{errors:j,currentLocation:H,expectedLocation:b,distance:u,ignoreLocation:y}),ee<=D)){if(D=ee,S=H,S<=b)break;me=Math.max(1,2*b-S)}}if(Jt(r,{errors:j+1,currentLocation:b,expectedLocation:b,distance:u,ignoreLocation:y})>D)break;ne=pe}let V={isMatch:S>=0,score:Math.max(.001,ee)};if(U){let j=gd(q,m);j.length?p&&(V.indices=j):V.isMatch=!1}return V}function Sd(n){let r={};for(let s=0,o=n.length;s{this.chunks.push({pattern:b,alphabet:Sd(b),startIndex:D})},x=this.pattern.length;if(x>qe){let b=0,D=x%qe,S=x-D;for(;b{let{isMatch:G,score:ne,indices:ee}=yd(r,S,U,{location:u+q,distance:d,threshold:f,findAllMatches:m,minMatchCharLength:p,includeMatches:o,ignoreLocation:y});G&&(b=!0),x+=ne,G&&ee&&(w=[...w,...ee])});let D={isMatch:b,score:b?x/this.chunks.length:1};return b&&o&&(D.indices=w),D}},we=class{constructor(r){this.pattern=r}static isMultiMatch(r){return An(r,this.multiRegex)}static isSingleMatch(r){return An(r,this.singleRegex)}search(){}};function An(n,r){let s=n.match(r);return s?s[1]:null}var Zr=class extends we{constructor(r){super(r)}static get type(){return"exact"}static get multiRegex(){return/^="(.*)"$/}static get singleRegex(){return/^=(.*)$/}search(r){let s=r===this.pattern;return{isMatch:s,score:s?0:1,indices:[0,this.pattern.length-1]}}},Jr=class extends we{constructor(r){super(r)}static get type(){return"inverse-exact"}static get multiRegex(){return/^!"(.*)"$/}static get singleRegex(){return/^!(.*)$/}search(r){let o=r.indexOf(this.pattern)===-1;return{isMatch:o,score:o?0:1,indices:[0,r.length-1]}}},Kr=class extends we{constructor(r){super(r)}static get type(){return"prefix-exact"}static get multiRegex(){return/^\\^"(.*)"$/}static get singleRegex(){return/^\\^(.*)$/}search(r){let s=r.startsWith(this.pattern);return{isMatch:s,score:s?0:1,indices:[0,this.pattern.length-1]}}},Xr=class extends we{constructor(r){super(r)}static get type(){return"inverse-prefix-exact"}static get multiRegex(){return/^!\\^"(.*)"$/}static get singleRegex(){return/^!\\^(.*)$/}search(r){let s=!r.startsWith(this.pattern);return{isMatch:s,score:s?0:1,indices:[0,r.length-1]}}},ea=class extends we{constructor(r){super(r)}static get type(){return"suffix-exact"}static get multiRegex(){return/^"(.*)"\\$$/}static get singleRegex(){return/^(.*)\\$$/}search(r){let s=r.endsWith(this.pattern);return{isMatch:s,score:s?0:1,indices:[r.length-this.pattern.length,r.length-1]}}},ta=class extends we{constructor(r){super(r)}static get type(){return"inverse-suffix-exact"}static get multiRegex(){return/^!"(.*)"\\$$/}static get singleRegex(){return/^!(.*)\\$$/}search(r){let s=!r.endsWith(this.pattern);return{isMatch:s,score:s?0:1,indices:[0,r.length-1]}}},Xt=class extends we{constructor(r,{location:s=T.location,threshold:o=T.threshold,distance:u=T.distance,includeMatches:d=T.includeMatches,findAllMatches:f=T.findAllMatches,minMatchCharLength:m=T.minMatchCharLength,isCaseSensitive:p=T.isCaseSensitive,ignoreLocation:y=T.ignoreLocation}={}){super(r),this._bitapSearch=new Kt(r,{location:s,threshold:o,distance:u,includeMatches:d,findAllMatches:f,minMatchCharLength:m,isCaseSensitive:p,ignoreLocation:y})}static get type(){return"fuzzy"}static get multiRegex(){return/^"(.*)"$/}static get singleRegex(){return/^(.*)$/}search(r){return this._bitapSearch.searchIn(r)}},er=class extends we{constructor(r){super(r)}static get type(){return"include"}static get multiRegex(){return/^\'"(.*)"$/}static get singleRegex(){return/^\'(.*)$/}search(r){let s=0,o,u=[],d=this.pattern.length;for(;(o=r.indexOf(this.pattern,s))>-1;)s=o+d,u.push([o,s-1]);let f=!!u.length;return{isMatch:f,score:f?0:1,indices:u}}},ra=[Zr,er,Kr,Xr,ta,ea,Jr,Xt],Ln=ra.length,wd=/ +(?=(?:[^\\"]*\\"[^\\"]*\\")*[^\\"]*$)/,xd="|";function vd(n,r={}){return n.split(xd).map(s=>{let o=s.trim().split(wd).filter(d=>d&&!!d.trim()),u=[];for(let d=0,f=o.length;d!!(n[tr.AND]||n[tr.OR]),_d=n=>!!n[sa.PATH],Td=n=>!Ce(n)&&Un(n)&&!oa(n),En=n=>({[tr.AND]:Object.keys(n).map(r=>({[r]:n[r]}))});function $n(n,r,{auto:s=!0}={}){let o=u=>{let d=Object.keys(u),f=_d(u);if(!f&&d.length>1&&!oa(u))return o(En(u));if(Td(u)){let p=f?u[sa.PATH]:d[0],y=f?u[sa.PATTERN]:u[p];if(!Se(y))throw new Error(nd(p));let w={keyId:Qr(p),pattern:y};return s&&(w.searcher=ia(y,r)),w}let m={children:[],operator:d[0]};return d.forEach(p=>{let y=u[p];Ce(y)&&y.forEach(w=>{m.children.push(o(w))})}),m};return oa(n)||(n=En(n)),o(n)}function Dd(n,{ignoreFieldNorm:r=T.ignoreFieldNorm}){n.forEach(s=>{let o=1;s.matches.forEach(({key:u,norm:d,score:f})=>{let m=u?u.weight:null;o*=Math.pow(f===0&&m?Number.EPSILON:f,(m||1)*(r?1:d))}),s.score=o})}function Md(n,r){let s=n.matches;r.matches=[],le(s)&&s.forEach(o=>{if(!le(o.indices)||!o.indices.length)return;let{indices:u,value:d}=o,f={indices:u,value:d};o.key&&(f.key=o.key.src),o.idx>-1&&(f.refIndex=o.idx),r.matches.push(f)})}function Od(n,r){r.score=n.score}function Fd(n,r,{includeMatches:s=T.includeMatches,includeScore:o=T.includeScore}={}){let u=[];return s&&u.push(Md),o&&u.push(Od),n.map(d=>{let{idx:f}=d,m={item:r[f],refIndex:f};return u.length&&u.forEach(p=>{p(d,m)}),m})}var Pe=class{constructor(r,s={},o){this.options={...T,...s},this.options.useExtendedSearch,this._keyStore=new zr(this.options.keys),this.setCollection(r,o)}setCollection(r,s){if(this._docs=r,s&&!(s instanceof _t))throw new Error(ad);this._myIndex=s||jn(this.options.keys,this._docs,{getFn:this.options.getFn,fieldNormWeight:this.options.fieldNormWeight})}add(r){!le(r)||(this._docs.push(r),this._myIndex.add(r))}remove(r=()=>!1){let s=[];for(let o=0,u=this._docs.length;o-1&&(p=p.slice(0,s)),Fd(p,this._docs,{includeMatches:o,includeScore:u})}_searchStringList(r){let s=ia(r,this.options),{records:o}=this._myIndex,u=[];return o.forEach(({v:d,i:f,n:m})=>{if(!le(d))return;let{isMatch:p,score:y,indices:w}=s.searchIn(d);p&&u.push({item:d,idx:f,matches:[{score:y,value:d,norm:m,indices:w}]})}),u}_searchLogical(r){let s=$n(r,this.options),o=(m,p,y)=>{if(!m.children){let{keyId:x,searcher:b}=m,D=this._findMatches({key:this._keyStore.get(x),value:this._myIndex.getValueForItemAtKeyId(p,x),searcher:b});return D&&D.length?[{idx:y,item:p,matches:D}]:[]}let w=[];for(let x=0,b=m.children.length;x{if(le(m)){let y=o(s,m,p);y.length&&(d[p]||(d[p]={idx:p,item:m,matches:[]},f.push(d[p])),y.forEach(({matches:w})=>{d[p].matches.push(...w)}))}}),f}_searchObjectList(r){let s=ia(r,this.options),{keys:o,records:u}=this._myIndex,d=[];return u.forEach(({$:f,i:m})=>{if(!le(f))return;let p=[];o.forEach((y,w)=>{p.push(...this._findMatches({key:y,value:f[w],searcher:s}))}),p.length&&d.push({idx:m,item:f,matches:p})}),d}_findMatches({key:r,value:s,searcher:o}){if(!le(s))return[];let u=[];if(Ce(s))s.forEach(({v:d,i:f,n:m})=>{if(!le(d))return;let{isMatch:p,score:y,indices:w}=o.searchIn(d);p&&u.push({score:y,key:r,value:d,idx:f,norm:m,indices:w})});else{let{v:d,n:f}=s,{isMatch:m,score:p,indices:y}=o.searchIn(d);m&&u.push({score:p,key:r,value:d,norm:f,indices:y})}return u}};Pe.version="7.0.0";Pe.createIndex=jn;Pe.parseIndex=pd;Pe.config=T;Pe.parseQuery=$n;kd(aa);function Bn(n){let{query:r,pathsIndex:s,count:o}=n,u=[],d={shouldSort:!0,threshold:0,ignoreLocation:!0,keys:[{name:"name",weight:2},"path","label.preview",{name:"spaceNames",weight:.5}]};return new Pe([...s.values()].filter(m=>m.hidden==!1),d).search(r).map(m=>m.item).slice(0,o)}function Gn(n){let{queries:r,pathsIndex:s,count:o}=n,u=[];for(let[d,f]of s)!f.hidden&&Yn(r,f,{})&&u.push(f);return u.slice(0,o)}var Cd=self;Cd.onmessage=async n=>{let{payload:r,job:s}=n.data,o;s.type=="search"&&(o=Gn(r)),s.type=="fastSearch"&&(o=Bn(r));try{postMessage({job:s,result:o})}catch(u){console.log(u),postMessage({job:s,result:{$error:`Failed to run ${s.type} ${s.path}: ${u}`}})}};\n//! authors : Tim Wood, Iskren Chernev, Moment.js contributors\n//! license : MIT\n//! moment.js\n//! momentjs.com\n//! version : 2.29.4\n',{name:"Superstate Search"})}var pR=class{constructor(t,r){this.numWorkers=t;this.cache=r;this.workers=[],this.busy=[],this.reloadQueue=[],this.reloadSet=new Set,this.callbacks=new Map;for(let n=0;nthis.finish(a.data.job,a.data.result,n),this.workers.push(i),this.busy.push(!1)}}run(t){let r=ME(t),n=new Promise((a,o)=>{this.callbacks.has(r)?this.callbacks.get(r)?.push([a,o]):this.callbacks.set(r,[[a,o]])});if(this.reloadSet.has(r))return n;this.reloadSet.add(r);let i=this.nextAvailableWorker();return i!==void 0?this.send(t,i):this.reloadQueue.push(t),n}finish(t,r,n){let i=ME(t),a=[].concat(this.callbacks.get(i)??[]);this.reloadSet.delete(i),this.callbacks.delete(i),this.busy[n]=!1;let o=this.reloadQueue.shift();if(o!==void 0&&this.send(o,n),"$error"in r)for(let[s,l]of a)l(r.$error);else for(let[s,l]of a)s(r)}async send(t,r){t.type=="search"&&(this.message(r,{job:t,payload:{queries:t.payload.queries,pathsIndex:this.cache.pathsIndex,count:t.payload.count}}),this.busy[r]=!0),t.type=="fastSearch"&&(this.message(r,{job:t,payload:{query:t.payload.query,pathsIndex:this.cache.pathsIndex,count:t.payload.count}}),this.busy[r]=!0)}message(t,r){this.workers[t].postMessage(r)}nextAvailableWorker(){let t=this.busy.indexOf(!1);return t==-1?void 0:t}};var jE=class{constructor(t,r,n,i,a){this.indexVersion=t;this.onChange=r;this.kit=[jv,C9,N9,M9,j9,tje,T9,mD,NEe,aje,fje,cje,oje,lje,sje,uje,dje,pje,Aje,gje,nje,rje,D9,xh,hje,uR,O9,gO,mje,ije,vje];this.eventsDispatcher=new n0;let o={...TV,createAdd:V("add",[],()=>function(f,d){return f+d}),createEqual:V("equal",[],()=>function(f,d){return f==d}),createUnequal:V("unequal",[],()=>function(f,d){return f!=d})},l=GB(o,{matrix:"Array"});l.import(dC,{override:!0}),this.formulaContext=l,this.initialized=!1,this.spaceManager=n,this.spaceManager.superstate=this,this.ui=i,this.ui.superstate=this,this.cli=a;let u=new fR(this.cli,this);this.cli.superstate=this,this.cli.terminals.splice(0,0,u),this.cli.mainTerminal=u,this.allMetadata={},this.api=new cR(this),this.pathsIndex=new Map,this.spacesIndex=new Map,this.contextsIndex=new Map,this.actionsIndex=new Map,this.kitFrames=new Map,this.kits=new Map,this.actions=new Map,this.templateCache=new Map,this.focuses=[],this.spacesMap=new op,this.linksMap=new op,this.tagsMap=new op,this.liveSpaceLinkMap=new op,this.iconsCache=new Map,this.imagesCache=new Map,this.contextStateQueue=Promise.resolve(),this.indexer=new dR(2,this),this.searcher=new pR(1,this)}static create(t,r,n,i,a){return new jE(t,r,n,i,a)}search(t,r,n){return r?this.searcher.run({type:"fastSearch",path:t,payload:{query:r,count:10}}):this.searcher.run({type:"search",path:t,payload:{queries:n,count:10}})}refreshMetadata(){this.allMetadata=_9(this)}async initializeIndex(){await this.loadFromCache()}addToContextStateQueue(t){this.contextStateQueue=this.contextStateQueue.then(t).catch(()=>{})}async initialize(){if(!this.persister){console.log("Cache Persister Not Found");return}let t=Date.now();this.initializeActions(),this.initializeFocuses(),this.initializeKits(),this.initializeTemplates(),this.settings.spacesEnabled&&await this.initializeSpaces(),await this.initializeBuiltins(),await this.initializeTags(),await this.initializePaths(),await this.initializeContexts(),await this.initializeFrames(),this.refreshMetadata(),this.dispatchEvent("superstateUpdated",null),this.ui.notify(`Make.md - Superstate Loaded in ${(Date.now()-t)/1e3} seconds`,"console"),this.persister.cleanType("space"),this.persister.cleanType("path"),this.persister.cleanType("context"),this.persister.cleanType("frame")}async reloadSystemActions(){(await this.spaceManager.readSystemCommands()).forEach(r=>this.actions.set(r.name,r.commands)),this.dispatchEvent("actionStateUpdated",{path:"spaces://$actions"})}async initializeActions(){await this.reloadSystemActions();let t=this.allSpaces().filter(r=>r.type!="default").map(r=>r.space).map(r=>this.reloadActions(r));await Promise.all(t)}async initializeKits(){let t=await this.spaceManager.readAllKits();t.forEach(r=>this.kits.set(r.id,r)),t.length==0&&this.kits.set("default",{id:"default",name:"Default",colors:{},frames:[]}),this.selectedKit=this.kits.get(this.settings.selectedKit)??this.kits.get("default"),this.selectedKit.frames=[...this.selectedKit.frames,...this.kit.map(r=>nj(r)).filter(r=>!this.selectedKit.frames.some(n=>n.schema.id==r.schema.id))];for(let r of this.selectedKit.frames){let n=Ao(r.schema).def.id,i=await rj(this,r,{...c0,screenType:this.ui.getScreenType()});this.kitFrames.set(n,i)}this.dispatchEvent("frameStateUpdated",{path:"spaces://$kit"})}async initializeTemplates(){let t=await this.spaceManager.readAllTemplates();Object.keys(t).forEach(r=>{this.templateCache.set(r,t[r])})}async initializeSpaces(){let t=[...this.spaceManager.allSpaces().values()],r=t.map(n=>this.reloadSpace(n,null,!0));[...this.spacesIndex.keys()].filter(n=>!t.some(i=>i.path==n)).forEach(n=>this.onSpaceDeleted(n)),await Promise.all(r)}getSpaceItems(t,r){let n=[...this.spacesMap.getInverse(t)],i=this.contextsIndex.get(t)?.paths??[];return n.map((a,o)=>({...this.pathsIndex.get(a),rank:i.indexOf(a)})).filter(a=>a?.hidden!=!0&&a.path!=t)}async initializeFrames(){await this.initializeTemplates()}async initializeContexts(){await this.indexer.reload({type:"contexts",path:""}).then(async t=>{let r=[...t.entries()].map(([n,{cache:i,changed:a}])=>this.contextReloaded(n,i,a,!0));await Promise.all(r)})}async loadFromCache(){if(this.dispatchEvent("superstateReindex",null),this.settings.indexSVG){let i=await this.persister.loadAll("icon");this.spaceManager.allPaths(["svg"]).forEach(a=>{let o=i.find(s=>s.path==a);o?.cache.length>0&&this.iconsCache.set(a,o.cache)})}let t=await this.persister.loadAll("path"),r=await this.persister.loadAll("space"),n=await this.persister.loadAll("context");r.forEach(i=>{let a=or(i.cache);a&&a.type&&this.spacesIndex.set(i.path,a)}),n.forEach(i=>{let a=or(i.cache);a&&this.contextsIndex.set(i.path,a)}),t.forEach(i=>{let a=S7(i.cache);this.pathsIndex.set(i.path,a),this.tagsMap.set(i.path,new Set(a.tags)),this.spacesMap.set(i.path,new Set(a.spaces)),this.linksMap.set(i.path,new Set(a.outlinks))}),this.settings.enhancedLogs&&console.log("Initial Cache Loaded"),this.dispatchEvent("superstateUpdated",null)}dispatchEvent(t,r){this.eventsDispatcher.dispatchEvent(t,r)}async initializeBuiltins(){let r=Object.keys(Ep).map(n=>this.reloadPath("spaces://$"+n,!0));await Promise.all(r)}async initializeTags(){let r=[...this.spaceManager.readTags().map(n=>Wn(n))].map(n=>this.reloadPath(n,!0));await Promise.all(r)}async onSpaceDefinitionChanged(t,r){if(t.space.readOnly)return;let n=this.spacesMap.getInverse(t.path),i=[];if(t.metadata?.links&&!t1.default.isEqual(t.metadata.links,r?.links)&&i.push(...t.metadata.links),t.metadata?.filters?.length>0){let s=t.metadata.filters.some(l=>l.filters.some(u=>u.fType=="property"));if(!t1.default.isEqual(t.metadata?.filters,r?.filters)||s)for(let[l,u]of this.pathsIndex)!u.hidden&&P9(t.metadata?.filters,u,t.properties)&&i.push(l)}let o=[...t1.default.difference(i,[...n]),...t1.default.difference([...n],i)].map(s=>this.reloadPath(s,!0).then(l=>this.dispatchEvent("pathStateUpdated",{path:s})));await Promise.all(o)}async initializeFocuses(){let t=await this.spaceManager.readFocuses();if(t.length==0){this.spaceManager.saveFocuses([{name:"Home",sticker:"ui//home",paths:["/"]}]);return}this.focuses=t,this.dispatchEvent("focusesChanged",null)}async initializePaths(){this.dispatchEvent("superstateReindex",null);let t=this.spaceManager.allPaths(),r=Date.now();await this.indexer.reload({type:"paths",path:""}).then(async i=>{for await(let[a,{cache:o,changed:s}]of Object.entries(i))await this.pathReloaded(a,o,s,!1)}),this.ui.notify(`Make.md - ${t.length} Paths Cached in ${(Date.now()-r)/1e3} seconds`,"console");let n=kr([...this.spacesIndex.keys(),...t]);[...this.pathsIndex.keys()].filter(i=>!n.some(a=>a==i)).forEach(i=>this.onPathDeleted(i)),this.dispatchEvent("superstateUpdated",null)}async onTagRenamed(t,r){let n=SJ(t),i=p0(this.spaceManager,r);await this.onSpaceRenamed(n,i),await this.onPathRename(n,i.path),this.dispatchEvent("spaceChanged",{path:n,newPath:i.path});let a=[];for(let[o,s]of this.spacesIndex)this.contextsIndex.get(o)?.contexts.includes(t)&&this.addToContextStateQueue(()=>Boe(this.spaceManager,t,r,a)),s.metadata?.contexts.includes(t)&&du(this,s.space,{...s.metadata,contexts:s.metadata.contexts.map(u=>u==t?r:u)});this.dispatchEvent("spaceStateUpdated",{path:kx})}async onTagDeleted(t){this.tagsMap.getInverse(t).forEach(i=>{this.deleteTagInPath(t,i)});let r=FM(t,this.settings);await this.spaceManager.deletePath(r),this.onSpaceDeleted(Wn(t));for(let[i,a]of this.spacesIndex)a.metadata?.contexts.includes(t)&&du(this,a.space,{...a.metadata,contexts:a.metadata.contexts.filter(o=>o!=t)});let n=[];for(let[i,a]of this.contextsIndex)a.contexts.includes(t)&&n.push(this.spaceManager.spaceInfoForPath(a.path));this.addToContextStateQueue(()=>Roe(this.spaceManager,t,n)),this.dispatchEvent("spaceStateUpdated",{path:kx})}async deleteTagInPath(t,r){let n;if(this.pathsIndex.has(r)&&(n=this.pathsIndex.get(r)),n){let i={...n,tags:n.tags.filter(a=>a!=t),spaces:n.spaces.filter(a=>a!=Wn(t))};this.pathsIndex.set(r,i),this.tagsMap.set(r,new Set(i.tags)),this.spacesMap.set(r,new Set(i.spaces))}else await this.reloadPath(r);this.onPathReloaded(r),this.dispatchEvent("pathStateUpdated",{path:r})}onMetadataChange(t){this.settings.enhancedLogs&&console.log("Metadata Changed",t),this.pathsIndex.has(t)&&this.reloadPath(t).then(r=>{let n=this.pathsIndex.get(t),i=this.spacesIndex.get(t);i&&this.reloadSpace(i.space).then(o=>this.onSpaceDefinitionChanged(o,i.metadata));let a=n.spaces.map(o=>this.spacesIndex.get(o)?.space).filter(o=>o);this.addToContextStateQueue(()=>GU(this,t,a)),this.dispatchEvent("pathStateUpdated",{path:t})})}reloadSpaceByPath(t,r){return this.reloadSpace(this.spaceManager.spaceInfoForPath(t),r)}async onPathRename(t,r){let n=r,i=this.pathsIndex.get(t),a=i?.spaces??[];if(i){this.spacesMap.delete(t),this.spacesMap.deleteInverse(t),this.linksMap.delete(t),this.linksMap.deleteInverse(t),this.pathsIndex.delete(t);let u=a.map(f=>this.spacesIndex.get(f)).filter(f=>f);await Uoe(this.spaceManager,t,n,u.map(f=>f.space));for(let f of u)f.metadata?.links?.includes(t)&&this.addToContextStateQueue(()=>mC(this,f.path,"links",f.metadata.links.map(d=>d==t?r:d))),await this.reloadContext(f.space,!0);let c=[];for(let[f,d]of this.contextsIndex)d.outlinks.includes(t)&&c.push(this.spacesIndex.get(d.path).space);this.addToContextStateQueue(()=>Loe(this.spaceManager,t,n,c).then(f=>Promise.all(c.map(d=>this.reloadContext(d,!0)))))}let o=!1;this.focuses.forEach(u=>{u.paths.includes(t)&&(u.paths=u.paths.map(c=>c==t?r:c),o=!0)}),o&&(await this.spaceManager.saveFocuses(this.focuses),this.dispatchEvent("focusesChanged",null)),await this.reloadPath(r,!0);let s=kr([...this.spacesMap.get(r)??[],...a]),l=s.map(u=>this.reloadContext(this.spacesIndex.get(u)?.space));await Promise.all(l),s.forEach(u=>this.dispatchEvent("spaceStateUpdated",{path:u})),this.dispatchEvent("pathChanged",{path:t,newPath:r}),this.ui.viewsByPath(t).forEach(u=>{u.openPath(r)})}async onPathCreated(t){await this.reloadPath(t,!0);let r=Fu(t);this.spacesIndex.has(r)&&this.spacesIndex.get(r).space.notePath==t&&await this.reloadSpace(this.spacesIndex.get(r).space),this.dispatchEvent("pathCreated",{path:t})}onPathDeleted(t){this.spacesMap.delete(t),this.linksMap.delete(t),this.linksMap.deleteInverse(t),this.persister.remove(t,"path");let r=this.pathsIndex.get(t);if(!r)return;let n=(r.spaces??[]).map(a=>this.spacesIndex.get(a)?.space).filter(a=>a);this.addToContextStateQueue(()=>Woe(this.spaceManager,t,n).then(a=>n.forEach(o=>this.reloadContext(o))));let i=[];for(let[a,o]of this.contextsIndex)o.outlinks.includes(t)&&this.spacesIndex.has(o.path)&&i.push(this.spacesIndex.get(o.path).space);this.addToContextStateQueue(()=>zoe(this.spaceManager,t,i).then(a=>n.forEach(o=>this.reloadContext(o)))),(r.spaces??[]).forEach(a=>{this.dispatchEvent("spaceStateUpdated",{path:a})}),this.pathsIndex.delete(t),this.dispatchEvent("pathDeleted",{path:t})}async onSpaceRenamed(t,r){if(this.spacesIndex.has(t)){let n=this.spacesIndex.get(t).metadata;this.spacesIndex.set(r.path,{...this.spacesIndex.get(t),path:r.path,name:r.name,space:r}),this.spacesMap.rename(t,r.path),this.spacesMap.renameInverse(t,r.path),this.spacesIndex.delete(t),this.contextsIndex.delete(t),this.actionsIndex.delete(t),await this.reloadSpace(r,n).then(i=>this.onSpaceDefinitionChanged(i,n)),await this.reloadContext(r,!0),await this.reloadActions(r)}}onSpaceDeleted(t){this.spacesIndex.has(t)&&(this.spacesIndex.delete(t),this.contextsIndex.delete(t)),this.spacesMap.delete(t),this.spacesMap.deleteInverse(t),this.persister.remove(t,"space"),this.dispatchEvent("spaceDeleted",{path:t})}async reloadActions(t){if(!t)return!1;this.spaceManager.commandsForSpace(t.path).then(r=>{this.actionsIndex.set(t.path,r),this.dispatchEvent("actionStateUpdated",{path:t.path})})}async reloadContextByPath(t,r){return this.reloadContext(this.spaceManager.spaceInfoForPath(t),r)}async reloadContext(t,r){return t?this.indexer.reload({type:"context",path:t.path}).then(n=>this.contextReloaded(t.path,n.cache,n.changed,r)):!1}async contextReloaded(t,r,n,i){if(!r||(this.settings.enhancedLogs&&console.log("Context Reloaded"),!n&&!i))return!1;this.contextsIndex.set(t,r);let a=this.pathsIndex.get(t);if(a&&r.dbExists&&!a.readOnly&&this.settings.syncFormulaToFrontmatter){let o=r.contextTable?.rows??[],s=r.contextTable?.cols??[],l=o.filter(u=>{let c=u[mt],f=this.pathsIndex.get(c);return!f||f.type=="file"&&f.subtype!="md"?!1:s.reduce((d,p,h)=>d||p.type!="fileprop"||p.primary=="true"?d:u[p.name]?.length>0&&f.metadata?.property?.[p.name]!=u[p.name]?!0:d,!1)});l.length>0&&l.forEach(u=>pi(this,u[mt],s.reduce((c,f,d)=>f.type=="fileprop"&&f.primary!="true"?{...c,[f.name]:la(ho(f),u[f.name],!0)}:c,{})))}return r.dbExists&&n&&await this.spaceManager.saveTable(t,r.contextTable),this.persister.store(t,JSON.stringify(r),"context"),this.dispatchEvent("contextStateUpdated",{path:t}),!0}allSpaces(t){return t?gJ([...this.spacesIndex.values()],this.spaceOrder(),"path"):[...this.spacesIndex.values()]}spaceOrder(){return[...this.focuses.flatMap(t=>t.paths)]}async updateSpaceMetadata(t,r){let n=this.spacesIndex.get(t),i=n?.metadata;if(!n)return this.reloadSpaceByPath(t);let a=!1,s=(r?.sort??{field:"rank",asc:!0,group:!0}).field=="rank";(!t1.default.isEqual(n.metadata.links,r.links)||!t1.default.isEqual(n.metadata.filters,r.filters))&&(a=!0);let l={...n,metadata:r,contexts:r?.contexts??[],sortable:s};return this.spacesIndex.set(t,l),a&&await this.onSpaceDefinitionChanged(l,i),this.dispatchEvent("spaceStateUpdated",{path:n.path}),l}async reloadSpace(t,r,n=!0){if(!t)return;this.settings.enhancedLogs&&console.log("Reloading Space");let i=r??await this.spaceManager.spaceDefForSpace(t.path),a=this.pathsIndex.get(t.path),o=this.spaceManager.uriByString(t.path);if(!o)return null;let s=this.spaceManager.spaceTypeByString(o);(s=="default"||s=="tag")&&(i.filters=[],i.links=[]);let l=[],u={},c=await this.spaceManager.readFrame(t.path,j1).then(b=>b?.cols??[]);if(l.push(...c),l.length>0){if(!a)if(this.settings.enableFolderNote){let b=await this.spaceManager.readPathCache(t.notePath);a={path:t.path,name:t.name,tags:[],spaces:[],outlinks:[],readOnly:t.readOnly,hidden:!1,metadata:b?.metadata,type:"space",subtype:s,label:b?.label}}else{let b=await this.spaceManager.readPathCache(t.path);a={path:t.path,name:t.name,tags:[],spaces:[],outlinks:[],readOnly:t.readOnly,hidden:!1,metadata:b?.metadata,type:"space",subtype:s,label:b?.label}}u=await this.spaceManager.readProperties(t.notePath).then(b=>nh(this.formulaContext,this.pathsIndex,this.spacesMap,b,l,a))}[...this.spacesMap.get(t.path)].map(b=>this.contextsIndex.get(b)).forEach(b=>{if(b){let v=b.contextTable?.cols??[];l.push(...v),u={...u,...b.contextTable?.rows.find(x=>x[mt]==t.path)??{}}}});let f=i?.sort??{field:"rank",asc:!0,group:!0},d=f.field=="rank"||!f,p=i?.contexts??[],h=kr((i.filters??[]).flatMap(b=>b.filters).flatMap(b=>b.type=="context"?[b.field.split(".")[0]]:b.type=="path"&&b.field=="space"?sr(b.value):[])),m=kr((i.filters??[]).flatMap(b=>b.filters).flatMap(b=>b.type.startsWith("link")?sr(b.value):[]));if(s=="tag"&&this.settings.autoAddContextsToSubtags){let b=XJ(t.name);p.push(...b)}let g=await this.spaceManager.readTemplates(t.path),A={name:t.name,space:t,path:t.path,type:s,templates:g,contexts:p.map(b=>b.toLowerCase()),metadata:i,dependencies:h,sortable:d,properties:u,propertyTypes:l};if(this.spacesIndex.set(t.path,A),this.persister.store(t.path,JSON.stringify(A),"space"),A.metadata?.links?.forEach(b=>{ree(this,b)&&this.spacesMap.set(b,new Set([...this.spacesMap.get(b),t.path]))}),n)return this.dispatchEvent("spaceStateUpdated",{path:t.path}),A}async pathReloaded(t,r,n,i){if(!r||(this.settings.enhancedLogs&&console.log("Path Reloaded"),this.pathsIndex.set(t,r),await this.onPathReloaded(t),(r.subtype=="image"||r.metadata?.file?.extension=="svg")&&this.imagesCache.set(r.metadata.file.filename,t),!n&&!i))return!1;if(this.tagsMap.set(t,new Set(r.tags)),this.linksMap.set(t,new Set(r.outlinks)),!t1.default.isEqual(r.spaces,Array.from(this.spacesMap.get(t)))){this.spacesMap.set(t,new Set(r.spaces));let a=r.tags.map(s=>p0(this.spaceManager,s)).filter(s=>!this.spacesIndex.has(s.path)).map(async s=>{await this.reloadSpace(s),this.reloadContext(s),await this.reloadPath(s.path)});await Promise.all(a).then(s=>{this.dispatchEvent("spaceStateUpdated",{path:kx})})}if(i){let a=r.spaces.map(o=>this.spacesIndex.get(o)?.space).filter(o=>o);this.addToContextStateQueue(()=>GU(this,t,a).then(o=>{a.forEach(s=>{this.dispatchEvent("spaceStateUpdated",{path:s.path})})}))}r.metadata?.file?.extension=="svg"&&this.settings.indexSVG&&this.spaceManager.readPath(t).then(a=>{this.iconsCache.set(t,a),this.persister.store(t,a,"icon")})}async reloadPath(t,r){return t?this.indexer.reload({type:"path",path:t}).then(async n=>(await this.pathReloaded(t,n.cache,n.changed,r),!0)):!1}async onPathReloaded(t){let r;if(this.pathsIndex.has(t)&&(r=this.pathsIndex.get(t)),!r)return!1;await this.persister.store(t,eje(r),"path")}};var yje=.999,mR=class extends Su.Plugin{constructor(){super(...arguments);this.debouncedRefresh=()=>null;this.metadataChange=r=>{this.markdownAdapter.metadataChange(r)};this.onDelete=async r=>{this.activeFileChange()};this.onRename=async(r,n)=>{this.activeFileChange()};this.openFileTreeLeaf=async r=>{if(this.app.workspace.getLeavesOfType(qf).length==0){let i=this.superstate.settings.spacesRightSplit?this.app.workspace.getRightLeaf(!1):this.app.workspace.getLeftLeaf(!1);await i.setViewState({type:qf}),r&&!this.app.workspace.leftSplit.collapsed&&this.app.workspace.revealLeaf(i)}else if(!this.app.workspace.leftSplit.collapsed&&r){let i=this.app.workspace.getLeavesOfType(qf);for(let o of i)o.view instanceof uE&&o.view.destroy(),o.detach();let a=this.superstate.settings.spacesRightSplit?this.app.workspace.getRightLeaf(!1):this.app.workspace.getLeftLeaf(!1);await a.setViewState({type:qf}),this.app.workspace.revealLeaf(a)}Gr(this.superstate.ui)&&this.app.workspace.leftSplit.collapse(),this.closeDuplicateTabs()};this.closeDuplicateTabs=()=>{try{this.app.workspace.leftSplit.children[0].children.filter((r,n,i)=>n!=i.findIndex(a=>a.view.getViewType()==r.view.getViewType())).forEach(r=>this.app.workspace.leftSplit.children[0].removeChild(r))}catch{}};this.detachFileTreeLeafs=()=>{let r=this.app.workspace.getLeavesOfType(qf);for(let n of r)n.view instanceof uE&&n.view.destroy(),n.detach()};this.detachFileContextLeafs=()=>{let r=this.app.workspace.getLeavesOfType(Db);for(let n of r)n.view instanceof XD&&n.view.destroy(),n.detach()};this.openFileContextLeaf=async(r,n)=>{let i=this.app.workspace.getLeavesOfType(r);if(i.length==0){let a=this.app.workspace.getRightLeaf(!1);await a.setViewState({type:r}),this.app.workspace.revealLeaf(a)}else i.forEach(a=>this.app.workspace.revealLeaf(a));Gr(this.superstate.ui)&&!n&&this.app.workspace.rightSplit.collapse()};this.refreshFileContextLeafs=()=>{this.detachFileContextLeafs(),this.openFileContextLeaf(Db)}}quickOpen(r,n,i,a){let o=Ne(this.app.workspace.getLeaf()?.containerEl.ownerDocument);X6e(r,n,o,i,a)}loadSuperState(){this.app.workspace.onLayoutReady(async()=>{this.superstate.settings.spacesEnabled?(await this.superstate.initializeIndex(),this.obsidianAdapter.loadCacheFromObsidianCache(),this.superstate.settings.navigatorEnabled&&this.openFileTreeLeaf(this.superstate.settings.openSpacesOnLaunch)):(await this.superstate.loadFromCache(),this.superstate.initialize()),this.registerEvent(this.app.vault.on("delete",this.onDelete)),this.registerEvent(this.app.vault.on("rename",this.onRename)),this.app.metadataCache.on("changed",this.metadataChange),yje>this.superstate.settings.releaseNotesPrompt&&(this.releaseTheNotes(),this.superstate.settings.releaseNotesPrompt=yje,this.saveSettings()),this.superstate.settings.firstLaunch||(this.getStarted(),this.superstate.settings.firstLaunch=!0,this.saveSettings())})}loadViews(){this.registerView(Lh,r=>new u7(r,this.superstate,this.ui)),this.registerView(qf,r=>new uE(r,this.superstate,this.ui)),this.registerView(bu,r=>new Sb(r,this.superstate,this.ui,bu)),this.registerView(ZD,r=>new l7(r,this)),this.registerView(Eb,r=>new r7(r,this)),this.superstate.settings.contextEnabled&&(this.registerView(kb,r=>new o7(r,this.app,kb,this.superstate)),this.registerView(Db,r=>new XD(r,this.superstate,this.ui)),this.registerView(f7,r=>new c7(r,this)))}async loadSpaces(){document.body.querySelector(".app-container").setAttribute("vaul-drawer-wrapper",""),document.body.classList.toggle("mk-spaces-right",this.superstate.settings.spacesRightSplit),document.body.classList.toggle("mk-readable-line",this.app.vault.getConfig("readableLineLength")),this.superstate.settings.readableLineWidth=this.app.vault.getConfig("readableLineLength"),this.superstate.settings.spacesEnabled&&(document.body.classList.toggle("mk-hide-tabs",!this.superstate.settings.sidebarTabs),document.body.classList.toggle("mk-hide-ribbon",!this.superstate.settings.showRibbon),document.body.classList.toggle("mk-folder-lines",this.superstate.settings.folderIndentationLines),this.app.vault.config.cssTheme=="Minimal"&&document.body.classList.toggle("mk-minimal-fix",!0),document.body.classList.toggle("mk-spaces-enabled",this.superstate.settings.spacesEnabled),!this.superstate.settings.spacesDisablePatch&&this.superstate.settings.navigatorEnabled&&iOe(this)),this.registerEvent(this.app.workspace.on("active-leaf-change",()=>this.activeFileChange())),this.registerEvent(this.app.workspace.on("layout-change",()=>{this.activeFileChange()}))}convertPathToSpace(){if(this.app.workspace.activeLeaf?.view.getViewType()=="markdown"){let n=this.app.workspace.getActiveViewOfType(Su.MarkdownView);n instanceof Su.MarkdownView&&n.file instanceof Su.TFile&&TM(this.superstate,n.file.path,!0)}else this.superstate.ui.notify(H.notice.cantConvertNoteToSpace)}toggleExperimental(){this.superstate.settings.experimental=!this.superstate.settings.experimental,this.saveSettings()}getActiveFile(){let r=null,n=null,i=this.app.workspace.getActiveViewOfType(Su.MarkdownView)?.leaf;i||(i=this.app.workspace.getActiveViewOfType(Sb)?.leaf);let a=i?.view;return!a||i.isFlowBlock||(a.getViewType()==bu?(rO(this),n=a.getState(),r=a.getState().path):a.getViewType()=="markdown"&&(r=a.file.path,n=a.getState(),oOe(this),rO(this)),!r||!n)?null:{path:r,state:n}}fixFileWarnings(){NX(this)}activeFileChange(){let r=this.getActiveFile();if(r){if(this.superstate.ui.activePath==r?.path){this.superstate.ui.setActiveState(r.state);return}this.superstate.ui.setActivePath(r.path),this.superstate.ui.setActiveState(r.state)}}releaseTheNotes(){lX("https://www.make.md/static/latest.md",this.app,!0)}getStarted(){lX("https://www.make.md/static/GetStarted.md",this.app,!0)}closeExtraFileTabs(){let r=!1;if(Su.Platform.isMobile){this.app.workspace.leftSplit?.children.forEach(n=>{n.view.getViewType()=="file-explorer"&&(r?this.app.workspace.leftSplit.removeChild(n):r=!0)});return}this.app.workspace.leftSplit?.children.forEach(n=>{n?.children.forEach(i=>{i.view.getViewType()=="file-explorer"&&(r?n.removeChild(i):r=!0)})})}loadCommands(){this.registerObsidianProtocolHandler("make",async r=>{let n=r;n.kit&&FX(this,this.superstate,n.kit,window),n.open&&this.superstate.ui.openPath(n.open)}),jc(this.superstate.ui)||this.addCommand({id:"open-ever-view",name:"Open Overview",callback:()=>{this.openEverView()}}),this.addCommand({id:"show-warnings",name:"Show Sync Warnings",callback:()=>{T7(this.superstate,window)}}),this.addCommand({id:"logs",name:"Toggle Enhanced Logs",callback:()=>{this.superstate.settings.enhancedLogs=!this.superstate.settings.enhancedLogs,this.saveSettings()}}),this.addCommand({id:"path-fixer",name:"Fix Unsupported Characters in Paths",callback:()=>{NX(this)}}),this.addCommand({id:"move-space-folder",name:"Move Space Data Folder",callback:()=>{let r=Ne(this.app.workspace.getLeaf()?.containerEl.ownerDocument);zSe(this.superstate,"Move Space Data Folder",this.superstate.settings.spaceSubFolder,n=>{sMe(this,this.superstate.settings.spaceSubFolder,n)},"Move",r)}}),this.superstate.settings.spacesEnabled&&(this.addCommand({id:"mk-debug-close-tabs",name:"Close Extra File Tabs",callback:()=>{this.closeExtraFileTabs()}}),this.addCommand({id:"mk-open-kit",name:"Open Kit",callback:()=>{FX(this,this.superstate,"",window)}}),this.addCommand({id:"mk-kit",name:"Save Space as Kit",callback:()=>{let r=this.getActiveFile().path;this.superstate.spacesIndex.has(r)&&oO(this,this.superstate,r,r).then(n=>{this.superstate.spaceManager.createItemAtPath("/","mkit","kit",JSON.stringify(n))})}}),this.addCommand({id:"mk-collapse-folders",name:H.commandPalette.collapseAllFolders,callback:()=>{this.superstate.settings.expandedSpaces=[],this.saveSettings()}}),this.addCommand({id:"mk-release-notes",name:H.commandPalette.releaseNotes,callback:()=>{this.releaseTheNotes()}}),this.addCommand({id:"mk-get-started",name:H.commandPalette.getStarted,callback:()=>{this.getStarted()}}),this.addCommand({id:"mk-reveal-file",name:H.commandPalette.revealFile,callback:()=>{let r=this.superstate.ui.activePath;if(!r)return;let n=new CustomEvent(im.revealPath,{detail:{path:r}});window.dispatchEvent(n)}}),this.addCommand({id:"mk-spaces",name:H.commandPalette.openSpaces,callback:()=>this.openFileTreeLeaf(!0)})),this.superstate.settings.enableFolderNote&&this.addCommand({id:"mk-convert-folder-note",name:H.commandPalette.convertPathToSpace,callback:()=>this.convertPathToSpace()}),this.superstate.settings.contextEnabled&&this.addCommand({id:"mk-open-file-context",name:H.commandPalette.openFileContext,callback:()=>this.openFileContextLeaf(Db,!0)}),this.superstate.settings.inlineBacklinks&&this.addCommand({id:"mk-toggle-backlinks",name:H.commandPalette.toggleBacklinks,callback:()=>{let r=new CustomEvent(im.toggleBacklinks);window.dispatchEvent(r)}}),this.superstate.settings.blinkEnabled&&this.addCommand({id:"mk-blink",name:H.commandPalette.blink,callback:()=>this.quickOpen(this.superstate),hotkeys:[{modifiers:["Mod"],key:"o"}]})}loadContext(){this.superstate.settings.contextEnabled&&(this.app.workspace.onLayoutReady(async()=>{this.closeExtraFileTabs(),this.superstate.settings.enableDefaultSpaces&&await this.files.createFolder(this.superstate.settings.spacesFolder)}),this.registerExtensions(["mdb"],f7),this.app.workspace.onLayoutReady(async()=>{this.superstate.settings.autoOpenFileContext&&await this.openFileContextLeaf(Db),setTimeout(()=>this.activeFileChange(),2e3)}),this.superstate.settings.inlineContext&&(this.registerMarkdownPostProcessor((r,n)=>{JDe(this,r,n)}),document.body.classList.toggle("mk-inline-context-enabled",this.superstate.settings.inlineContext)))}openEverView(){let r=this.app.workspace.getLeavesOfType(Lh);if(r.length==0){let n=this.app.workspace.createLeafBySplit(this.app.workspace.getLeaf(),"vertical",!0);n.setViewState({type:Lh}),n.setPinned(!0)}else r.forEach(n=>{n.getRoot()!=this.app.workspace.rootSplit&&n.detach();let i=this.app.workspace.createLeafBySplit(this.app.workspace.getLeaf(),"vertical",!0);i.setViewState({type:Lh}),i.setPinned(!0)});aOe(this)}async onload(){let r=Date.now(),n=Object.assign({},lE,await this.loadData());this.mdbFileAdapter=new x7(this),this.files=N1.create(),this.obsidianAdapter=new k7(this,this.files,(0,Su.normalizePath)(this.app.vault.configDir+"/plugins/make-md/Spaces.mdb")),this.files.initiateFileSystemAdapter(this.obsidianAdapter,!0),this.markdownAdapter=new O7(this),this.files.initiateFiletypeAdapter(this.mdbFileAdapter),this.files.initiateFiletypeAdapter(this.markdownAdapter),this.files.initiateFiletypeAdapter(new D7(this)),this.files.initiateFiletypeAdapter(new B7(this)),this.files.initiateFiletypeAdapter(new I7(this)),this.files.initiateFiletypeAdapter(new _7(this));let i=new bC(this.files,n.spaceSubFolder),a=new lR;this.ui=new F7(this);let o=Ly.create(this.ui),s=SE.create(new P7(this));this.superstate=jE.create("0.9",()=>{this.debouncedRefresh()},new uk,o,s),await this.loadSettings(),this.superstate.settings.experimental&&this.files.initiateFiletypeAdapter(new n7(this)),this.superstate.spaceManager.addSpaceAdapter(i,!0),this.superstate.spaceManager.addSpaceAdapter(a),(0,Su.addIcon)("mk-logo",rOe),this.superstate.saveSettings=()=>this.saveSettings(),this.loadViews();let l;Su.Platform.isMobile?l=new AE(".makemd/superstate.mdc",this.mdbFileAdapter,["path","space","frame","context","icon"]):l=new hE(".makemd/superstate.mdc",this.mdbFileAdapter,["path","space","frame","context","icon"]),this.superstate.settings.cacheIndex&&await l.initialize(),this.superstate.persister=l,this.loadSuperState(),this.addSettingTab(new J8(this.app,this)),await this.loadSpaces(),this.loadContext(),Object.keys(this.superstate.settings).some(u=>u=="makerMode")&&(this.superstate.settings.basics=this.superstate.settings.makerMode,delete this.superstate.settings.makerMode,this.saveSettings()),this.superstate.settings.basics&&(this.basics=new AO(this),this.basics.loadBasics()),this.loadCommands(),this.superstate.ui.notify(`Make.md - Plugin loaded in ${(Date.now()-r)/1e3} seconds`,"console"),this.superstate.settings.systemName=="Vault"&&(this.superstate.settings.systemName=this.app.vault.getName(),this.saveSettings())}async loadSettings(){this.superstate.settings=Object.assign({},lE,await this.loadData()),this.superstate.settings.hiddenExtensions.length==1&&this.superstate.settings.hiddenExtensions[0]==".mdb"&&(this.superstate.settings.hiddenExtensions=lE.hiddenExtensions);let r=or(await WDe(this));this.superstate.settings.newFileFolderPath=r.newFileFolderPath,this.superstate.settings.newFileLocation=r.newFileLocation,this.saveSettings()}async saveSettings(r=!0){await this.saveData(this.superstate.settings),this.obsidianAdapter.pathLastUpdated.set((0,Su.normalizePath)(this.app.vault.configDir+"/plugins/make-md/data.json"),Date.now()),r&&this.superstate.dispatchEvent("settingsChanged",null)}onunload(){console.log("Unloading Make.md"),this.superstate.persister.unload(),this.detachFileTreeLeafs()}}; /* object-assign (c) Sindre Sorhus diff --git a/manifest.json b/manifest.json index d95066e..583a52c 100755 --- a/manifest.json +++ b/manifest.json @@ -1,7 +1,7 @@ { "id": "make-md", "name": "MAKE.md", - "version": "1.0.1", + "version": "1.0.2", "minAppVersion": "0.16.0", "description": "Make.md gives you everything you need to organize and personalize your notes.", "author": "MAKE.md", diff --git a/package.json b/package.json index 1fd5efe..8d249db 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "make-md", - "version": "1.0.0", + "version": "1.0.2", "description": "make.md", "main": "main.js", "scripts": { diff --git a/src/basics/cmExtensions.ts b/src/basics/cmExtensions.ts index 9298ddd..8a36a4b 100644 --- a/src/basics/cmExtensions.ts +++ b/src/basics/cmExtensions.ts @@ -19,10 +19,6 @@ import { tooltips } from "./tooltip"; export const cmExtensions = (plugin: MakeBasicsPlugin, mobile: boolean) => { const extensions : Extension[] = [...editBlockExtensions()]; - if (plugin.settings.makerMode) { - - - extensions.push( ...[toggleMarkExtension, tooltips({ parent: document.body })] ); @@ -48,7 +44,6 @@ export const cmExtensions = (plugin: MakeBasicsPlugin, mobile: boolean) => { extensions.push(internalLinkToggle); } else { extensions.push(internalLinkHover(plugin)); - } } } diff --git a/src/basics/enactor/enactor.ts b/src/basics/enactor/enactor.ts index fed18f1..f749fe3 100644 --- a/src/basics/enactor/enactor.ts +++ b/src/basics/enactor/enactor.ts @@ -12,6 +12,7 @@ export interface Enactor { ): void; selectLink(e: React.MouseEvent, onSelect: (path: string) => void): void; selectSpace(e: React.MouseEvent, onSelect: (path: string) => void): void; + pathExists(path: string): Promise; selectImage(onSelect: (path: string) => void, win: Window): void; isSpace(path: string): boolean; loadExtensions(firstLoad: boolean): void; diff --git a/src/basics/enactor/makemd.tsx b/src/basics/enactor/makemd.tsx index 88228fb..2a58010 100644 --- a/src/basics/enactor/makemd.tsx +++ b/src/basics/enactor/makemd.tsx @@ -640,6 +640,9 @@ export class MakeMDEnactor implements Enactor { // } // menu.showAtMouseEvent(ev); } + pathExists(path: string) { + return this.superstate.spaceManager.pathExists(path); + } openPath(path: string, source?: HTMLElement) { const uri = this.uriByString(path); openPathInElement( diff --git a/src/basics/enactor/obsidian.tsx b/src/basics/enactor/obsidian.tsx index a867997..34e93ac 100644 --- a/src/basics/enactor/obsidian.tsx +++ b/src/basics/enactor/obsidian.tsx @@ -346,6 +346,9 @@ export class ObsidianEnactor implements Enactor { selectSpace(e: React.MouseEvent, onSelect: (path: string) => void) { return this.notify("Not implemented"); } + pathExists(path: string) { + return this.plugin.app.vault.adapter.exists(path); + } selectImage(onSelect: (path: string) => void, win: Window) { return this.notify("Not implemented"); } diff --git a/src/basics/schemas/settings.ts b/src/basics/schemas/settings.ts index ceeba69..094a83c 100644 --- a/src/basics/schemas/settings.ts +++ b/src/basics/schemas/settings.ts @@ -7,7 +7,6 @@ export const BasicDefaultSettings: MakeBasicsSettings = { mobileMakeBar: false, mobileSidepanel: false, inlineStyler: true, - makerMode: true, inlineStylerColors: false, editorFlow: true, internalLinkClickFlow: true, diff --git a/src/basics/types/settings.ts b/src/basics/types/settings.ts index b7e3791..ff92bec 100644 --- a/src/basics/types/settings.ts +++ b/src/basics/types/settings.ts @@ -19,7 +19,6 @@ export interface MakeBasicsSettings { menuTriggerChar: string; inlineStickerMenu: boolean; emojiTriggerChar: string; - makerMode: boolean; dataviewInlineContext: boolean; } diff --git a/src/basics/ui/UINote.tsx b/src/basics/ui/UINote.tsx index a4e9b3e..27e211b 100644 --- a/src/basics/ui/UINote.tsx +++ b/src/basics/ui/UINote.tsx @@ -39,9 +39,7 @@ export const UINote = forwardRef((props: NoteViewProps, ref) => { const path = props.plugin.enactor.uriByString(props.path, props.source); - const pathExists = await props.plugin.app.vault.adapter.exists( - path.basePath - ); + const pathExists = await props.plugin.enactor.pathExists(path.basePath); const isFolder = props.plugin.enactor.isSpace(path.basePath); const filePath = isFolder && props.forceNote diff --git a/src/core/react/components/MarkdownEditor/BannerView.tsx b/src/core/react/components/MarkdownEditor/BannerView.tsx index 8872b86..d0f5046 100644 --- a/src/core/react/components/MarkdownEditor/BannerView.tsx +++ b/src/core/react/components/MarkdownEditor/BannerView.tsx @@ -42,6 +42,7 @@ export const BannerView = (props: { pathState?.metadata.property?.[props.superstate.settings.fmKeySticker] ?.length > 0; setHasSticker(hasSticker); + setOffset( pathState?.metadata.property?.[ props.superstate.settings.fmKeyBannerOffset @@ -52,7 +53,7 @@ export const BannerView = (props: { pathState?.metadata.property?.[ props.superstate.settings.fmKeyBannerOffset ] - ) * 100 + ) ).toString()}%` : "center" ); @@ -166,7 +167,7 @@ export const BannerView = (props: { newValue = Math.min(newValue, 100); currentValue.current = newValue; - saveOffset(newValue); + setOffset(newValue + "%"); return pos; }); diff --git a/src/core/react/components/SpaceView/Frames/EditorNodes/FlowNodeView.tsx b/src/core/react/components/SpaceView/Frames/EditorNodes/FlowNodeView.tsx index 861c5eb..6cd0eed 100644 --- a/src/core/react/components/SpaceView/Frames/EditorNodes/FlowNodeView.tsx +++ b/src/core/react/components/SpaceView/Frames/EditorNodes/FlowNodeView.tsx @@ -108,8 +108,8 @@ export const FlowNodeView = ( }; return (
- {pathState ? ( - !props.state?.styles?.["--mk-min-mode"] ? ( + {pathState && + (!props.state?.styles?.["--mk-min-mode"] ? (
{!hideToggle && ( @@ -123,7 +123,16 @@ export const FlowNodeView = (
) : ( <> - ) + ))} + {props.state && expanded && props.state?.props?.value?.length > 0 ? ( + ) : ( selectionMode > FrameEditorMode.Read && (
) )} - {props.state && expanded && props.state?.props?.value?.length > 0 && ( - - )}
); }; diff --git a/src/core/spaceManager/filesystemAdapter/filesystemAdapter.ts b/src/core/spaceManager/filesystemAdapter/filesystemAdapter.ts index e3ce45c..ab36f6c 100644 --- a/src/core/spaceManager/filesystemAdapter/filesystemAdapter.ts +++ b/src/core/spaceManager/filesystemAdapter/filesystemAdapter.ts @@ -194,6 +194,24 @@ export class FilesystemSpaceAdapter implements SpaceAdapter { return [...this.fileSystem.allFiles().filter(f => type ? type.some(g => g == 'folder' ? f.isFolder : f.extension == g) : true).map(g => g.path).filter(f => !excludeSpacesPredicate(this.spaceManager.superstate.settings, f))]; } public async pathExists (path: string) { + const uri = this.uriByPath(path); + if (uri.scheme == 'spaces') { + if (uri.authority.charAt(0) == '$') { + const builtIn = Object.keys(builtinSpaces).find(f => f == uri.authority.slice(1)); + if (builtIn) { + return true; + } + } + + if (uri.authority.charAt(0) == '#') + { + return true; + } + if (path == '/') { + return true; + } + + } return this.fileSystem.fileExists(path) } public async createItemAtPath (parent: string, type: string, name: string, content?: any) { @@ -831,7 +849,7 @@ const defaultSpaceTemplate = this.defaultFrame(path); const builtins = Object.keys(builtinSpaces).map(f => this.spaceManager.spaceInfoForPath(`spaces://$${f}`)); const getAllTagContextFiles = () : SpaceInfo[] => this.readTags().map(f => fileSystemSpaceInfoFromTag(this.spaceManager, tagPathToTag(f))) as SpaceInfo[] ?? []; - const allTagSpaces = this.spaceManager.superstate.settings.enableDefaultSpaces ? getAllTagContextFiles() : []; + const allTagSpaces = getAllTagContextFiles(); return [...builtins, ...allTagSpaces, ...allFolders] } return allFolders; diff --git a/src/main.ts b/src/main.ts index 7c80991..bc326e9 100644 --- a/src/main.ts +++ b/src/main.ts @@ -646,6 +646,12 @@ this.markdownAdapter = new ObsidianMarkdownFiletypeAdapter(this); await this.loadSpaces(); this.loadContext(); + if (Object.keys(this.superstate.settings as Record).some(f => f == "makerMode")){ + this.superstate.settings.basics = (this.superstate.settings as any).makerMode; + delete (this.superstate.settings as any).makerMode; + this.saveSettings(); + } + if (this.superstate.settings.basics) { this.basics = new MakeBasicsPlugin(this); this.basics.loadBasics(); diff --git a/src/shared/i18n.ts b/src/shared/i18n.ts index 6280c85..37da2cf 100644 --- a/src/shared/i18n.ts +++ b/src/shared/i18n.ts @@ -968,10 +968,7 @@ class T { name: "Mark Sans 🧪", desc: `Use the editor without Markdown.`, }, - editorMakerMode: { - name: "Flow (Beta)", - desc: `An integrated and intuitive editor experience`, - }, + editorMakePlacholder: { name: "Flow Menu Hint Text", desc: `Show a hint text on how to open the Flow Menu Shortcut`,