From 60356387ef4ee501e5d7f31b761f3664fc4a33be Mon Sep 17 00:00:00 2001 From: JP Cen Date: Fri, 17 Jan 2025 21:26:34 -0500 Subject: [PATCH] 1.0.4 --- main.js | 140 +++++++++--------- manifest.json | 2 +- package.json | 2 +- src/adapters/obsidian/ui/WindowManager.tsx | 4 +- .../Frames/EditorNodes/FlowNodeView.tsx | 60 ++++---- .../EditorNodes/FrameEditorNodeView.tsx | 3 +- src/core/superstate/superstate.ts | 3 +- 7 files changed, 109 insertions(+), 105 deletions(-) diff --git a/main.js b/main.js index 5dee863..8d19c08 100644 --- a/main.js +++ b/main.js @@ -3,12 +3,12 @@ THIS IS A GENERATED/BUNDLED FILE BY ESBUILD if you want to view the source, please visit the github repository of this plugin */ -var y_e=Object.create;var cM=Object.defineProperty;var b_e=Object.getOwnPropertyDescriptor;var x_e=Object.getOwnPropertyNames;var w_e=Object.getPrototypeOf,S_e=Object.prototype.hasOwnProperty;var vn=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),fM=(e,t)=>{for(var r in t)cM(e,r,{get:t[r],enumerable:!0})},uM=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of x_e(t))!S_e.call(e,i)&&i!==r&&cM(e,i,{get:()=>t[i],enumerable:!(n=b_e(t,i))||n.enumerable});return e},li=(e,t,r)=>(uM(e,t,"default"),r&&uM(r,t,"default")),Ae=(e,t,r)=>(r=e!=null?y_e(w_e(e)):{},uM(t||!e||!e.__esModule?cM(r,"default",{value:e,enumerable:!0}):r,e)),E_e=e=>uM(cM({},"__esModule",{value:!0}),e);var k_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 Qa=vn((Dnt,dM)=>{(function(){"use strict";var e={}.hasOwnProperty;function t(){for(var i="",a=0;a{(function(e,t){typeof Q$=="object"&&typeof kx<"u"?kx.exports=t():typeof define=="function"&&define.amd?define(t):e.moment=t()})(Q$,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()=>(t||e((t={exports:{}}).exports,t),t.exports),fM=(e,t)=>{for(var r in t)cM(e,r,{get:t[r],enumerable:!0})},uM=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of x_e(t))!S_e.call(e,i)&&i!==r&&cM(e,i,{get:()=>t[i],enumerable:!(n=b_e(t,i))||n.enumerable});return e},li=(e,t,r)=>(uM(e,t,"default"),r&&uM(r,t,"default")),Ae=(e,t,r)=>(r=e!=null?y_e(w_e(e)):{},uM(t||!e||!e.__esModule?cM(r,"default",{value:e,enumerable:!0}):r,e)),E_e=e=>uM(cM({},"__esModule",{value:!0}),e);var k_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 Qa=vn((Mnt,dM)=>{(function(){"use strict";var e={}.hasOwnProperty;function t(){for(var i="",a=0;a{(function(e,t){typeof Q$=="object"&&typeof kx<"u"?kx.exports=t():typeof define=="function"&&define.amd?define(t):e.moment=t()})(Q$,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 i1(){return ze(this.year())}function a1(M,B,X,ne,de,Re,Je){var sr;return M<100&&M>=0?(sr=new Date(M+400,B,X,ne,de,Re,Je),isFinite(sr.getFullYear())&&sr.setFullYear(M)):sr=new Date(M,B,X,ne,de,Re,Je),sr}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 o1(M,B,X,ne,de){var Re=(7+X-ne)%7,Je=Gf(M,ne,de),sr=1+7*(B-1)+Re+Je,Hr,Jn;return sr<=0?(Hr=M-1,Jn=ku(Hr)+sr):sr>ku(M)?(Hr=M+1,Jn=sr-ku(M)):(Hr=M,Jn=sr),{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+Wl(Je,B,X)):de>Wl(M.year(),B,X)?(Re=de-Wl(M.year(),B,X),Je=M.year()+1):(Je=M.year(),Re=de),{week:Re,year:Je}}function Wl(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),zl(["w","ww","W","WW"],function(M,B,X,ne){B[ne.substr(0,1)]=tt(M)});function Zh(M){return Qf(M,this._week.dow,this._week.doy).week}var ul={dow:0,doy:6};function Ng(){return this._week.dow}function Tg(){return this._week.doy}function Xh(M){var B=this.localeData().week(this);return M==null?B:this.add((M-B)*7,"d")}function Lb(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)}),zl(["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}),zl(["d","e","E"],function(M,B,X,ne){B[ne]=tt(M)});function zb(M,B){return typeof M!="string"?M:isNaN(M)?(M=B.weekdaysParse(M),typeof M=="number"?M:null):parseInt(M,10)}function Fg(M,B){return typeof M=="string"?B.weekdaysParse(M)%7||7:isNaN(M)?null:M}function _g(M,B){return M.slice(B,7).concat(M.slice(0,B))}var Ub="Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),Wb="Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_"),Hb="Su_Mo_Tu_We_Th_Fr_Sa".split("_"),Kh=Yi,Pg=Yi,Vb=Yi;function Jh(M,B){var X=n(this._weekdays)?this._weekdays:this._weekdays[M&&M!==!0&&this._weekdays.isFormat.test(B)?"format":"standalone"];return M===!0?_g(X,this._week.dow):M?X[M.day()]:X}function eA(M){return M===!0?_g(this._weekdaysShort,this._week.dow):M?this._weekdaysShort[M.day()]:this._weekdaysShort}function Cu(M){return M===!0?_g(this._weekdaysMin,this._week.dow):M?this._weekdaysMin[M.day()]:this._weekdaysMin}function Ig(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 Gb(M,B,X){var ne,de,Re;if(this._weekdaysParseExact)return Ig.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 H(M){if(!this.isValid())return M!=null?this:NaN;var B=this._isUTC?this._d.getUTCDay():this._d.getDay();return M!=null?(M=zb(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=Fg(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=Kh),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=Pg),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=Vb),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,sr,Hr,Jn;for(Re=0;Re<7;Re++)Je=d([2e3,1]).day(Re),sr=Ha(this.weekdaysMin(Je,"")),Hr=Ha(this.weekdaysShort(Je,"")),Jn=Ha(this.weekdays(Je,"")),B.push(sr),X.push(Hr),ne.push(Jn),de.push(sr),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 wr(){return this.hours()%12||12}function Pn(){return this.hours()||24}Q("H",["HH",2],0,"hour"),Q("h",["hh",2],0,wr),Q("k",["kk",2],0,Pn),Q("hmm",0,0,function(){return""+wr.apply(this)+L(this.minutes(),2)}),Q("hmmss",0,0,function(){return""+wr.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 sa(M,B){return B._meridiemParse}Dt("a",sa),Dt("A",sa),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"],oa),Yr(["k","kk"],function(M,B,X){var ne=tt(M);B[oa]=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[oa]=tt(M),h(X).bigHour=!0}),Yr("hmm",function(M,B,X){var ne=M.length-2;B[oa]=tt(M.substr(0,ne)),B[_s]=tt(M.substr(ne)),h(X).bigHour=!0}),Yr("hmmss",function(M,B,X){var ne=M.length-4,de=M.length-2;B[oa]=tt(M.substr(0,ne)),B[_s]=tt(M.substr(ne,2)),B[Ul]=tt(M.substr(de)),h(X).bigHour=!0}),Yr("Hmm",function(M,B,X){var ne=M.length-2;B[oa]=tt(M.substr(0,ne)),B[_s]=tt(M.substr(ne))}),Yr("Hmmss",function(M,B,X){var ne=M.length-4,de=M.length-2;B[oa]=tt(M.substr(0,ne)),B[_s]=tt(M.substr(ne,2)),B[Ul]=tt(M.substr(de))});function Ju(M){return(M+"").toLowerCase().charAt(0)==="p"}var Qb=/[ap]\.?m?\.?/i,co=Ct("Hours",!0);function Bg(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:Og,monthsShort:Gh,week:ul,weekdays:Ub,weekdaysMin:Hb,weekdaysShort:Wb,meridiemParse:Qb},gi={},lp={},Lo;function Yb(M,B){var X,ne=Math.min(M.length,B.length);for(X=0;X0;){if(de=tA(Re.slice(0,X).join("-")),de)return de;if(ne&&ne.length>=X&&Yb(Re,ne)>=X-1)break;X--}B++}return Lo}function Xb(M){return M.match("^[^/\\\\]*$")!=null}function tA(M){var B=null,X;if(gi[M]===void 0&&typeof kx<"u"&&kx&&kx.exports&&Xb(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=tA(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 ME(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=tA(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=tA(M),B)return B;M=[M]}return Zb(M)}function jE(){return z(gi)}function Rg(M){var B,X=M._a;return X&&h(M).overflow===-2&&(B=X[as]<0||X[as]>11?as:X[Fs]<1||X[Fs]>Hf(X[fi],X[as])?Fs:X[oa]<0||X[oa]>24||X[oa]===24&&(X[_s]!==0||X[Ul]!==0||X[ol]!==0)?oa:X[_s]<0||X[_s]>59?_s:X[Ul]<0||X[Ul]>59?Ul:X[ol]<0||X[ol]>999?ol:-1,h(M)._overflowDayOfYear&&(BFs)&&(B=Fs),h(M)._overflowWeeks&&B===-1&&(B=Cg),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)?)?$/,$g=/^\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)?)?$/,l1=/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/]],u1=/^\/?Date\((-?\d+)/i,NE=/^(?:(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}))$/,c1={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 Kb(M){var B,X,ne=M._i,de=Zf.exec(ne)||$g.exec(ne),Re,Je,sr,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[as]=X.getUTCMonth(),M._a[Fs]=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[oa]===24&&M._a[_s]===0&&M._a[Ul]===0&&M._a[ol]===0&&(M._nextDay=!0,M._a[oa]=0),M._d=(M._useUTC?bm:a1).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[oa]=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,sr,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>Wl(X,Re,Je)?h(M)._overflowWeeks=!0:Hr!=null?h(M)._overflowWeekday=!0:(sr=o1(X,ne,de,Re,Je),M._a[fi]=sr.year,M._dayOfYear=sr.dayOfYear)}t.ISO_8601=function(){},t.RFC_2822=function(){};function Ar(M){if(M._f===t.ISO_8601){Kb(M);return}if(M._f===t.RFC_2822){rA(M);return}M._a=[],h(M).empty=!0;var B=""+M._i,X,ne,de,Re,Je,sr=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=sr-Hr,B.length>0&&h(M).unusedInput.push(B),M._a[oa]<=12&&h(M).bigHour===!0&&M._a[oa]>0&&(h(M).bigHour=void 0),h(M).parsedDateParts=M._a.slice(0),h(M).meridiem=M._meridiem,M._a[oa]=Ur(M._locale,M._a[oa],M._meridiem),Jn=h(M).era,Jn!==null&&(M._a[fi]=M._locale.erasConvertYear(Jn,M._a[fi])),ft(M),Rg(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,sr=!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 vO(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=Mi(M),M._a?(B=M._isUTC?d(M._a):On(M._a),this._isDSTShifted=this.isValid()&&bR(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[Fs])*de,h:tt(ne[oa])*de,m:tt(ne[_s])*de,s:tt(ne[Ul])*de,ms:tt(Lg(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 d1(X),Yc(M)&&a(M,"_locale")&&(Re._locale=M._locale),Yc(M)&&a(M,"_isValid")&&(Re._isValid=M._isValid),Re}ln.fn=d1.prototype,ln.invalid=FE;function cp(M,B){var X=M&&parseFloat(M.replace(",","."));return(isNaN(X)?0:X)*B}function bO(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=bO(M,B):(X=bO(B,M),X.milliseconds=-X.milliseconds,X.months=-X.months),X):{milliseconds:0,months:0}}function p1(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),xO(this,de,M),this}}function xO(M,B,X,ne){var de=B._milliseconds,Re=Lg(B._days),Je=Lg(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 zg=p1(1,"add"),nx=p1(-1,"subtract");function m1(M){return typeof M=="string"||M instanceof String}function di(M){return S(M)||u(M)||m1(M)||l(M)||wO(M)||DR(M)||M===null||M===void 0}function DR(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 iA(){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 lx(M){M||(M=this.isUtc()?t.defaultFormatUtc:t.defaultFormat);var B=Se(this,M);return this.localeData().postformat(B)}function NR(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 TR(M){return this.from(On(),M)}function FR(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 ux(M){return this.to(On(),M)}function A1(M){var B;return M===void 0?this._locale._abbr:(B=Ba(M),B!=null&&(this._locale=B),this)}var cx=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 DO(){return this._locale}var g1=1e3,Ug=60*g1,fx=60*Ug,fo=(365*400+97)*24*fx;function Va(M,B){return(M%B+B)%B}function OO(M,B,X){return M<100&&M>=0?new Date(M+400,B,X)-fo:new Date(M,B,X).valueOf()}function MO(M,B,X){return M<100&&M>=0?Date.UTC(M+400,B,X)-fo:Date.UTC(M,B,X)}function jO(M){var B,X;if(M=re(M),M===void 0||M==="millisecond"||!this.isValid())return this;switch(X=this._isUTC?MO:OO,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-=Va(B+(this._isUTC?0:this.utcOffset()*Ug),fx);break;case"minute":B=this._d.valueOf(),B-=Va(B,Ug);break;case"second":B=this._d.valueOf(),B-=Va(B,g1);break}return this._d.setTime(B),t.updateOffset(this,!0),this}function _R(M){var B,X;if(M=re(M),M===void 0||M==="millisecond"||!this.isValid())return this;switch(X=this._isUTC?MO:OO,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+=fx-Va(B+(this._isUTC?0:this.utcOffset()*Ug),fx)-1;break;case"minute":B=this._d.valueOf(),B+=Ug-Va(B,Ug)-1;break;case"second":B=this._d.valueOf(),B+=g1-Va(B,g1)-1;break}return this._d.setTime(B),t.updateOffset(this,!0),this}function _E(){return this._d.valueOf()-(this._offset||0)*6e4}function v1(){return Math.floor(this.valueOf()/1e3)}function PE(){return new Date(this.valueOf())}function Wg(){var M=this;return[M.year(),M.month(),M.date(),M.hour(),M.minute(),M.second(),M.millisecond()]}function y1(){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 b1(){return this.isValid()?this.toISOString():null}function dx(){return g(this)}function Hg(){return f({},h(this))}function PR(){return h(this).overflow}function IR(){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",qR),Dt("NNNNN",LR),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",zR),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 BR(M,B){var X,ne,de,Re=this._eras||Ba("en")._eras;for(X=0,ne=Re.length;X=0)return Re[ne]}function $R(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 px(){var M,B,X,ne=this.localeData().eras();for(M=0,B=ne.length;MRe&&(B=Re),QR.call(this,M,B,X,ne,de))}function QR(M,B,X,ne,de){var Re=o1(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[as]=(tt(M)-1)*3});function YR(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"],Fs),Yr("Do",function(M,B){B[Fs]=tt(M.match(ue)[0])});var FO=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"],_s);var ZR=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"],Ul);var XR=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,_O;for(km="SSSS";km.length<=9;km+="S")Dt(km,Wr);function KR(M,B){B[ol]=tt(("0."+M)*1e3)}for(km="S";km.length<=9;km+="S")Yr(km,KR);_O=Ct("Milliseconds",!1),Q("z",0,0,"zoneAbbr"),Q("zz",0,0,"zoneName");function aA(){return this._isUTC?"UTC":""}function JR(){return this._isUTC?"Coordinated Universal Time":""}var bt=w.prototype;bt.add=zg,bt.calendar=MR,bt.clone=jR,bt.diff=kO,bt.endOf=_R,bt.format=lx,bt.from=NR,bt.fromNow=TR,bt.to=FR,bt.toNow=ux,bt.get=Le,bt.invalidAt=PR,bt.isAfter=ax,bt.isBefore=Em,bt.isBetween=ox,bt.isSame=SO,bt.isSameOrAfter=sx,bt.isSameOrBefore=EO,bt.isValid=dx,bt.lang=cx,bt.locale=A1,bt.localeData=DO,bt.max=mR,bt.min=tx,bt.parsingFlags=Hg,bt.set=Ze,bt.startOf=jO,bt.subtract=nx,bt.toArray=Wg,bt.toObject=y1,bt.toDate=PE,bt.toISOString=h1,bt.inspect=iA,typeof Symbol<"u"&&Symbol.for!=null&&(bt[Symbol.for("nodejs.util.inspect.custom")]=function(){return"Moment<"+this.format()+">"}),bt.toJSON=b1,bt.toString=CO,bt.unix=v1,bt.valueOf=_E,bt.creationData=IR,bt.eraName=px,bt.eraNarrow=x1,bt.eraAbbr=NO,bt.eraYear=pe,bt.year=ll,bt.isLeapYear=i1,bt.weekYear=UR,bt.isoWeekYear=WR,bt.quarter=bt.quarters=YR,bt.month=sl,bt.daysInMonth=sp,bt.week=bt.weeks=Xh,bt.isoWeek=bt.isoWeeks=Lb,bt.weeksInYear=dp,bt.weeksInWeekYear=GR,bt.isoWeeksInYear=HR,bt.isoWeeksInISOWeekYear=VR,bt.date=FO,bt.day=bt.days=H,bt.weekday=K,bt.isoWeekday=se,bt.dayOfYear=pp,bt.hour=bt.hours=co,bt.minute=bt.minutes=ZR,bt.second=bt.seconds=XR,bt.millisecond=bt.milliseconds=_O,bt.utcOffset=wR,bt.utc=ER,bt.local=kR,bt.parseZone=CR,bt.hasAlignedHourOffset=Sm,bt.isDST=Ue,bt.isLocal=Xe,bt.isUtcOffset=Ut,bt.isUtc=Fr,bt.isUTC=Fr,bt.zoneAbbr=aA,bt.zoneName=JR,bt.dates=j("dates accessor is deprecated. Use date instead.",FO),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/",SR),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 e$(){return On.apply(null,arguments).parseZone()}function PO(M){return M}var Wn=q.prototype;Wn.calendar=T,Wn.longDateFormat=ye,Wn.invalidDate=ke,Wn.ordinal=ce,Wn.preparse=PO,Wn.postformat=PO,Wn.relativeTime=R,Wn.pastFuture=J,Wn.set=D,Wn.eras=BR,Wn.erasParse=RR,Wn.erasConvertYear=$R,Wn.erasAbbrRegex=mx,Wn.erasNameRegex=Vg,Wn.erasNarrowRegex=ic,Wn.months=Vf,Wn.monthsShort=kn,Wn.monthsParse=Yh,Wn.monthsRegex=jg,Wn.monthsShortRegex=Gc,Wn.week=Zh,Wn.firstDayOfYear=Tg,Wn.firstDayOfWeek=Ng,Wn.weekdays=Jh,Wn.weekdaysMin=Cu,Wn.weekdaysShort=eA,Wn.weekdaysParse=Gb,Wn.weekdaysRegex=xe,Wn.weekdaysShortRegex=je,Wn.weekdaysMinRegex=Ke,Wn.isPM=Ju,Wn.meridiem=Bg;function Ax(M,B,X,ne){var de=Ba(),Re=d().set(ne,B);return de[X](Re,M)}function IO(M,B,X){if(l(M)&&(B=M,M=void 0),M=M||"",B!=null)return Ax(M,B,X,"month");var ne,de=[];for(ne=0;ne<12;ne++)de[ne]=Ax(M,ne,X,"month");return de}function gx(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,sr=[];if(X!=null)return Ax(B,(X+Re)%7,ne,"day");for(Je=0;Je<7;Je++)sr[Je]=Ax(B,(Je+Re)%7,ne,"day");return sr}function BO(M,B){return IO(M,B,"months")}function t$(M,B){return IO(M,B,"monthsShort")}function r$(M,B,X){return gx(M,B,X,"weekdays")}function IE(M,B,X){return gx(M,B,X,"weekdaysShort")}function w1(M,B,X){return gx(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 n$(){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 BE(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 i$(M,B){return BE(this,M,B,1)}function mp(M,B){return BE(this,M,B,-1)}function vx(M){return M<0?Math.floor(M):Math.ceil(M)}function oA(){var M=this._milliseconds,B=this._days,X=this._months,ne=this._data,de,Re,Je,sr,Hr;return M>=0&&B>=0&&X>=0||M<=0&&B<=0&&X<=0||(M+=vx(RE(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-=vx(RE(Hr)),sr=Ye(X/12),X%=12,ne.days=B,ne.months=X,ne.years=sr,this}function Ou(M){return M*4800/146097}function RE(M){return M*146097/4800}function RO(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(RE(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 $O(){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"),qO=Mu("s"),a$=Mu("m"),yx=Mu("h"),o$=Mu("d"),LO=Mu("w"),os=Mu("M"),$E=Mu("Q"),zO=Mu("y");function Kf(){return ln(this)}function qE(M){return M=re(M),this.isValid()?this[M+"s"]():NaN}function Jf(M){return function(){return this.isValid()?this._data[M]:NaN}}var sA=Jf("milliseconds"),UO=Jf("seconds"),cl=Jf("minutes"),LE=Jf("hours"),s$=Jf("days"),l$=Jf("months"),u$=Jf("years");function zE(){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 WO(M,B,X,ne,de){return de.relativeTime(B||1,!!X,M,ne)}function c$(M,B,X,ne){var de=ln(M).abs(),Re=hp(de.as("s")),Je=hp(de.as("m")),sr=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,WO.apply(null,Ap)}function f$(M){return M===void 0?hp:typeof M=="function"?(hp=M,!0):!1}function S1(M,B){return ed[M]===void 0?!1:B===void 0?ed[M]:(ed[M]=B,M==="s"&&(ed.ss=B-1),!0)}function d$(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=c$(this,!X,ne,de),X&&(Re=de.pastFuture(+this,Re)),de.postformat(Re)}var UE=Math.abs;function Dm(M){return(M>0)-(M<0)||+M}function E1(){if(!this.isValid())return this.localeData().invalidDate();var M=UE(this._milliseconds)/1e3,B=UE(this._days),X=UE(this._months),ne,de,Re,Je,sr=this.asSeconds(),Hr,Jn,fl,td;return sr?(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=sr<0?"-":"",Jn=Dm(this._months)!==Dm(sr)?"-":"",fl=Dm(this._days)!==Dm(sr)?"-":"",td=Dm(this._milliseconds)!==Dm(sr)?"-":"",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=d1.prototype;Mn.isValid=yR,Mn.abs=n$,Mn.add=i$,Mn.subtract=mp,Mn.as=RO,Mn.asMilliseconds=Cm,Mn.asSeconds=qO,Mn.asMinutes=a$,Mn.asHours=yx,Mn.asDays=o$,Mn.asWeeks=LO,Mn.asMonths=os,Mn.asQuarters=$E,Mn.asYears=zO,Mn.valueOf=$O,Mn._bubble=oA,Mn.clone=Kf,Mn.get=qE,Mn.milliseconds=sA,Mn.seconds=UO,Mn.minutes=cl,Mn.hours=LE,Mn.days=s$,Mn.weeks=zE,Mn.months=l$,Mn.years=u$,Mn.humanize=d$,Mn.toISOString=E1,Mn.toString=E1,Mn.toJSON=E1,Mn.locale=A1,Mn.localeData=DO,Mn.toIsoString=j("toIsoString() is deprecated. Please use toISOString() instead (notice the capitals)",E1),Mn.lang=cx,Q("X",0,0,"unix"),Q("x",0,0,"valueOf"),Dt("x",en),Dt("X",is),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=hR,t.max=AR,t.now=gR,t.utc=d,t.unix=Zc,t.months=BO,t.isDate=u,t.locale=Qc,t.invalid=A,t.duration=ln,t.isMoment=S,t.weekdays=r$,t.parseZone=e$,t.localeData=Ba,t.isDuration=Yc,t.monthsShort=t$,t.weekdaysMin=w1,t.defineLocale=zo,t.updateLocale=ME,t.locales=jE,t.weekdaysShort=IE,t.normalizeUnits=re,t.relativeTimeRounding=f$,t.relativeTimeThreshold=S1,t.calendarFormat=OR,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 bi=vn((Wx,lk)=>{(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),Yt=/<%-([\s\S]+?)%>/g,Wr=/<%([\s\S]+?)%>/g,en=/<%=([\s\S]+?)%>/g,tn=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,ci=/^\w*$/,is=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Yi=/[\\^$.*+?()[\]{}|]/g,Pa=RegExp(Yi.source),Dt=/^\s+/,Hc=/\s/,Wf=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,Ha=/\{\n\/\* \[wrapped with (.+)\] \*/,Eu=/,? & /,Yr=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,zl=/[()=,{}\[\]\/\s]/,gm=/\\(\\)?/g,fi=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,as=/\w*$/,Fs=/^[-+]0x[0-9a-f]+$/i,oa=/^0b[01]+$/i,_s=/^\[object .+?Constructor\]$/,Ul=/^0o[0-7]+$/i,ol=/^(?:0|[1-9]\d*)$/,Cg=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,Vc=/($^)/,Dg=/['\n\r\u2028\u2029\\]/g,_n="\\ud800-\\udfff",Hf="\\u0300-\\u036f",Og="\\ufe20-\\ufe2f",Gh="\\u20d0-\\u20ff",vm=Hf+Og+Gh,Mg="\\u2700-\\u27bf",Qh="a-z\\xdf-\\xf6\\xf8-\\xff",Vf="\\xac\\xb1\\xd7\\xf7",kn="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",Ia="\\u2000-\\u206f",Yh=" \\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+Yh,Gc="['\u2019]",jg="["+_n+"]",ym="["+sp+"]",ku="["+vm+"]",ll="\\d+",i1="["+Mg+"]",a1="["+Qh+"]",bm="[^"+_n+sp+ll+Mg+Qh+Cn+"]",Gf="\\ud83c[\\udffb-\\udfff]",o1="(?:"+ku+"|"+Gf+")",Qf="[^"+_n+"]",Wl="(?:\\ud83c[\\udde6-\\uddff]){2}",Zh="[\\ud800-\\udbff][\\udc00-\\udfff]",ul="["+Cn+"]",Ng="\\u200d",Tg="(?:"+a1+"|"+bm+")",Xh="(?:"+ul+"|"+bm+")",Lb="(?:"+Gc+"(?:d|ll|m|re|s|t|ve))?",zb="(?:"+Gc+"(?:D|LL|M|RE|S|T|VE))?",Fg=o1+"?",_g="["+sl+"]?",Ub="(?:"+Ng+"(?:"+[Qf,Wl,Zh].join("|")+")"+_g+Fg+")*",Wb="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",Hb="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",Kh=_g+Fg+Ub,Pg="(?:"+[i1,Wl,Zh].join("|")+")"+Kh,Vb="(?:"+[Qf+ku+"?",ku,Wl,Zh,jg].join("|")+")",Jh=RegExp(Gc,"g"),eA=RegExp(ku,"g"),Cu=RegExp(Gf+"(?="+Gf+")|"+Vb+Kh,"g"),Ig=RegExp([ul+"?"+a1+"+"+Lb+"(?="+[ym,ul,"$"].join("|")+")",Xh+"+"+zb+"(?="+[ym,ul+Tg,"$"].join("|")+")",ul+"?"+Tg+"+"+Lb,ul+"+"+zb,Hb,Wb,ll,Pg].join("|"),"g"),Gb=RegExp("["+Ng+_n+vm+sl+"]"),H=/[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={"&":"&","<":"<",">":">",'"':""","'":"'"},wr={"&":"&","<":"<",">":">",""":'"',"'":"'"},Pn={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},sn=parseFloat,sa=parseInt,Ju=typeof global=="object"&&global&&global.Object===Object&&global,Qb=typeof self=="object"&&self&&self.Object===Object&&self,co=Ju||Qb||Function("return this")(),Bg=typeof Wx=="object"&&Wx&&!Wx.nodeType&&Wx,Yf=Bg&&typeof lk=="object"&&lk&&!lk.nodeType&&lk,gi=Yf&&Yf.exports===Bg,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{}}(),Yb=Lo&&Lo.isArrayBuffer,s1=Lo&&Lo.isDate,Zb=Lo&&Lo.isMap,Xb=Lo&&Lo.isRegExp,tA=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 ME(Ue,rt,Xe,Ut){for(var Fr=-1,Kn=Ue==null?0:Ue.length;++Fr-1}function l1(Ue,rt,Xe){for(var Ut=-1,Fr=Ue==null?0:Ue.length;++Ut-1;);return Xe}function tx(Ue,rt){for(var Xe=Ue.length;Xe--&&xm(rt,Ue[Xe],0)>-1;);return Xe}function mR(Ue,rt){for(var Xe=Ue.length,Ut=0;Xe--;)Ue[Xe]===rt&&++Ut;return Ut}var vO=ft(Ke),hR=ft(ot);function AR(Ue){return"\\"+Pn[Ue]}function gR(Ue,rt){return Ue==null?e:Ue[rt]}function Xf(Ue){return Gb.test(Ue)}function vR(Ue){return H.test(Ue)}function yR(Ue){for(var rt,Xe=[];!(rt=Ue.next()).done;)Xe.push(rt.value);return Xe}function FE(Ue){var rt=-1,Xe=Array(Ue.size);return Ue.forEach(function(Ut,Fr){Xe[++rt]=[Fr,Ut]}),Xe}function d1(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 FO(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=GR,dp.prototype.delete=TO,dp.prototype.get=QR,dp.prototype.has=YR,dp.prototype.set=FO;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(!Ga(y))return y;var lt=Vr(y);if(lt){if(Fe=Qje(y),!$e)return oc(y,Fe)}else{var At=Hl(y),Pt=At==me||At==ke;if(Zg(y))return sK(y,$e);if(At==U||At==Q||Pt&&!le){if(Fe=We||Pt?{}:CK(y),!$e)return We?Bje(y,i$(Fe,y)):Ije(y,BE(Fe,y))}else{if(!je[At])return le?y:{};Fe=Yje(y,At,$e)}}be||(be=new Zc);var nr=be.get(y);if(nr)return nr;be.set(y,Fe),tJ(y)?y.forEach(function(Er){Fe.add(Ou(Er,E,F,Er,y,be))}):JK(y)&&y.forEach(function(Er,gn){Fe.set(gn,Ou(Er,E,F,gn,y,be))});var Sr=st?We?k$:E$:We?lc:Bs,nn=lt?e:Sr(y);return Ba(nn||y,function(Er,gn){nn&&(gn=Er,Er=y[gn]),w1(Fe,gn,Ou(Er,E,F,gn,y,be))}),Fe}function RE(y){var E=Bs(y);return function(F){return RO(F,y,E)}}function RO(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 $O(y,E,F){if(typeof y!="function")throw new nc(i);return GE(function(){y.apply(e,F)},E)}function Mu(y,E,F,Z){var le=-1,be=$g,Fe=!0,$e=y.length,We=[],st=E.length;if(!$e)return We;F&&(E=si(E,Mi(F))),Z?(be=l1,Fe=!1):E.length>=r&&(be=rc,Fe=!1,E=new aA(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=dK(Kf),qO=dK(qE,!0);function a$(y,E){var F=!0;return Cm(y,function(Z,le,be){return F=!!E(Z,le,be),F}),F}function yx(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:nJ(Z);F0&&F($e)?E>1?os($e,E-1,F,Z,le):ec(le,$e):Z||(le[le.length]=$e)}return le}var $E=pK(),zO=pK(!0);function Kf(y,E){return y&&$E(y,E,Bs)}function qE(y,E){return y&&zO(y,E,Bs)}function Jf(y,E){return Zf(E,function(F){return fA(y[F])})}function sA(y,E){E=Qg(E,y);for(var F=0,Z=E.length;y!=null&&FE}function s$(y,E){return y!=null&&di.call(y,E)}function l$(y,E){return y!=null&&E in ln(y)}function u$(y,E,F){return y>=Va(E,F)&&y=120&<.length>=120)?new aA(Fe&<):e}lt=y[0];var At=-1,Pt=$e[0];e:for(;++At-1;)$e!==y&&nA.call($e,We,1),nA.call(y,We,1);return y}function JX(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;cA(le)?nA.call(y,le,1):g$(y,le)}}return y}function m$(y,E){return y+A1(jO()*(E-y+1))}function kje(y,E,F,Z){for(var le=-1,be=fo(ux((E-y)/(F||1)),0),Fe=Xe(be);be--;)Fe[Z?be:++le]=y,y+=F;return Fe}function h$(y,E){var F="";if(!y||E<1||E>I)return F;do E%2&&(F+=y),E=A1(E/2),E&&(y+=y);while(E);return F}function un(y,E){return T$(MK(y,E,uc),y+"")}function Cje(y){return BO(Ex(y))}function Dje(y,E){var F=Ex(y);return eM(F,oA(E,0,F.length))}function WE(y,E,F,Z){if(!Ga(y))return y;E=Qg(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:Lje(y);if(st)return Lg(st);Fe=!1,le=rc,We=new aA}else We=E?[]:$e;e:for(;++Z=Z?y:rd(y,E,F)}var oK=NR||function(y){return co.clearTimeout(y)};function sK(y,E){if(E)return y.slice();var F=y.length,Z=SO?SO(F):new y.constructor(F);return y.copy(Z),Z}function x$(y){var E=new y.constructor(y.byteLength);return new ox(E).set(new ox(y)),E}function Tje(y,E){var F=E?x$(y.buffer):y.buffer;return new y.constructor(F,y.byteOffset,y.byteLength)}function Fje(y){var E=new y.constructor(y.source,as.exec(y));return E.lastIndex=y.lastIndex,E}function _je(y){return x1?ln(x1.call(y)):{}}function lK(y,E){var F=E?x$(y.buffer):y.buffer;return new y.constructor(F,y.byteOffset,y.length)}function uK(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 cK(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 AK(y){return uA(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&&KO(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,nr=F&p?new aA:e;for(be.set(y,E),be.set(E,y);++At<$e;){var Sr=y[At],nn=E[At];if(Z)var Er=Fe?Z(nn,Sr,At,E,y,be):Z(Sr,nn,At,y,E,be);if(Er!==e){if(Er)continue;Pt=!1;break}if(nr){if(!c1(E,function(gn,In){if(!rc(nr,In)&&(Sr===gn||le(Sr,gn,F,Z,be)))return nr.push(In)})){Pt=!1;break}}else if(!(Sr===nn||le(Sr,nn,F,Z,be))){Pt=!1;break}}return be.delete(y),be.delete(E),Pt}function Uje(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 ox(y),new ox(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=FE;case ie:var We=Z&d;if($e||($e=Lg),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=SK($e(y),$e(E),Z,le,be,Fe);return Fe.delete(y),lt;case Ee:if(x1)return x1.call(y)==x1.call(E)}return!1}function Wje(y,E,F,Z,le,be){var Fe=F&d,$e=E$(y),We=$e.length,st=E$(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 nr=be.get(y),Sr=be.get(E);if(nr&&Sr)return nr==E&&Sr==y;var nn=!0;be.set(y,E),be.set(E,y);for(var Er=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 i1(){return ze(this.year())}function a1(M,B,X,ne,de,Re,Je){var sr;return M<100&&M>=0?(sr=new Date(M+400,B,X,ne,de,Re,Je),isFinite(sr.getFullYear())&&sr.setFullYear(M)):sr=new Date(M,B,X,ne,de,Re,Je),sr}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 o1(M,B,X,ne,de){var Re=(7+X-ne)%7,Je=Gf(M,ne,de),sr=1+7*(B-1)+Re+Je,Hr,Jn;return sr<=0?(Hr=M-1,Jn=ku(Hr)+sr):sr>ku(M)?(Hr=M+1,Jn=sr-ku(M)):(Hr=M,Jn=sr),{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+Wl(Je,B,X)):de>Wl(M.year(),B,X)?(Re=de-Wl(M.year(),B,X),Je=M.year()+1):(Je=M.year(),Re=de),{week:Re,year:Je}}function Wl(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),zl(["w","ww","W","WW"],function(M,B,X,ne){B[ne.substr(0,1)]=tt(M)});function Zh(M){return Qf(M,this._week.dow,this._week.doy).week}var ul={dow:0,doy:6};function Ng(){return this._week.dow}function Tg(){return this._week.doy}function Xh(M){var B=this.localeData().week(this);return M==null?B:this.add((M-B)*7,"d")}function Lb(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)}),zl(["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}),zl(["d","e","E"],function(M,B,X,ne){B[ne]=tt(M)});function zb(M,B){return typeof M!="string"?M:isNaN(M)?(M=B.weekdaysParse(M),typeof M=="number"?M:null):parseInt(M,10)}function Fg(M,B){return typeof M=="string"?B.weekdaysParse(M)%7||7:isNaN(M)?null:M}function _g(M,B){return M.slice(B,7).concat(M.slice(0,B))}var Ub="Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),Wb="Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_"),Hb="Su_Mo_Tu_We_Th_Fr_Sa".split("_"),Kh=Yi,Pg=Yi,Vb=Yi;function Jh(M,B){var X=n(this._weekdays)?this._weekdays:this._weekdays[M&&M!==!0&&this._weekdays.isFormat.test(B)?"format":"standalone"];return M===!0?_g(X,this._week.dow):M?X[M.day()]:X}function eA(M){return M===!0?_g(this._weekdaysShort,this._week.dow):M?this._weekdaysShort[M.day()]:this._weekdaysShort}function Cu(M){return M===!0?_g(this._weekdaysMin,this._week.dow):M?this._weekdaysMin[M.day()]:this._weekdaysMin}function Ig(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 Gb(M,B,X){var ne,de,Re;if(this._weekdaysParseExact)return Ig.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 H(M){if(!this.isValid())return M!=null?this:NaN;var B=this._isUTC?this._d.getUTCDay():this._d.getDay();return M!=null?(M=zb(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=Fg(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=Kh),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=Pg),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=Vb),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,sr,Hr,Jn;for(Re=0;Re<7;Re++)Je=d([2e3,1]).day(Re),sr=Ha(this.weekdaysMin(Je,"")),Hr=Ha(this.weekdaysShort(Je,"")),Jn=Ha(this.weekdays(Je,"")),B.push(sr),X.push(Hr),ne.push(Jn),de.push(sr),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 wr(){return this.hours()%12||12}function Pn(){return this.hours()||24}Q("H",["HH",2],0,"hour"),Q("h",["hh",2],0,wr),Q("k",["kk",2],0,Pn),Q("hmm",0,0,function(){return""+wr.apply(this)+L(this.minutes(),2)}),Q("hmmss",0,0,function(){return""+wr.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 sa(M,B){return B._meridiemParse}Dt("a",sa),Dt("A",sa),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"],oa),Yr(["k","kk"],function(M,B,X){var ne=tt(M);B[oa]=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[oa]=tt(M),h(X).bigHour=!0}),Yr("hmm",function(M,B,X){var ne=M.length-2;B[oa]=tt(M.substr(0,ne)),B[_s]=tt(M.substr(ne)),h(X).bigHour=!0}),Yr("hmmss",function(M,B,X){var ne=M.length-4,de=M.length-2;B[oa]=tt(M.substr(0,ne)),B[_s]=tt(M.substr(ne,2)),B[Ul]=tt(M.substr(de)),h(X).bigHour=!0}),Yr("Hmm",function(M,B,X){var ne=M.length-2;B[oa]=tt(M.substr(0,ne)),B[_s]=tt(M.substr(ne))}),Yr("Hmmss",function(M,B,X){var ne=M.length-4,de=M.length-2;B[oa]=tt(M.substr(0,ne)),B[_s]=tt(M.substr(ne,2)),B[Ul]=tt(M.substr(de))});function Ju(M){return(M+"").toLowerCase().charAt(0)==="p"}var Qb=/[ap]\.?m?\.?/i,co=Ct("Hours",!0);function Bg(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:Og,monthsShort:Gh,week:ul,weekdays:Ub,weekdaysMin:Hb,weekdaysShort:Wb,meridiemParse:Qb},gi={},lp={},Lo;function Yb(M,B){var X,ne=Math.min(M.length,B.length);for(X=0;X0;){if(de=tA(Re.slice(0,X).join("-")),de)return de;if(ne&&ne.length>=X&&Yb(Re,ne)>=X-1)break;X--}B++}return Lo}function Xb(M){return M.match("^[^/\\\\]*$")!=null}function tA(M){var B=null,X;if(gi[M]===void 0&&typeof kx<"u"&&kx&&kx.exports&&Xb(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=tA(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 ME(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=tA(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=tA(M),B)return B;M=[M]}return Zb(M)}function jE(){return z(gi)}function Rg(M){var B,X=M._a;return X&&h(M).overflow===-2&&(B=X[as]<0||X[as]>11?as:X[Fs]<1||X[Fs]>Hf(X[fi],X[as])?Fs:X[oa]<0||X[oa]>24||X[oa]===24&&(X[_s]!==0||X[Ul]!==0||X[ol]!==0)?oa:X[_s]<0||X[_s]>59?_s:X[Ul]<0||X[Ul]>59?Ul:X[ol]<0||X[ol]>999?ol:-1,h(M)._overflowDayOfYear&&(BFs)&&(B=Fs),h(M)._overflowWeeks&&B===-1&&(B=Cg),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)?)?$/,$g=/^\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)?)?$/,l1=/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/]],u1=/^\/?Date\((-?\d+)/i,NE=/^(?:(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}))$/,c1={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 Kb(M){var B,X,ne=M._i,de=Zf.exec(ne)||$g.exec(ne),Re,Je,sr,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[as]=X.getUTCMonth(),M._a[Fs]=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[oa]===24&&M._a[_s]===0&&M._a[Ul]===0&&M._a[ol]===0&&(M._nextDay=!0,M._a[oa]=0),M._d=(M._useUTC?bm:a1).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[oa]=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,sr,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>Wl(X,Re,Je)?h(M)._overflowWeeks=!0:Hr!=null?h(M)._overflowWeekday=!0:(sr=o1(X,ne,de,Re,Je),M._a[fi]=sr.year,M._dayOfYear=sr.dayOfYear)}t.ISO_8601=function(){},t.RFC_2822=function(){};function Ar(M){if(M._f===t.ISO_8601){Kb(M);return}if(M._f===t.RFC_2822){rA(M);return}M._a=[],h(M).empty=!0;var B=""+M._i,X,ne,de,Re,Je,sr=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=sr-Hr,B.length>0&&h(M).unusedInput.push(B),M._a[oa]<=12&&h(M).bigHour===!0&&M._a[oa]>0&&(h(M).bigHour=void 0),h(M).parsedDateParts=M._a.slice(0),h(M).meridiem=M._meridiem,M._a[oa]=Ur(M._locale,M._a[oa],M._meridiem),Jn=h(M).era,Jn!==null&&(M._a[fi]=M._locale.erasConvertYear(Jn,M._a[fi])),ft(M),Rg(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,sr=!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 vO(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=Mi(M),M._a?(B=M._isUTC?d(M._a):On(M._a),this._isDSTShifted=this.isValid()&&bR(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[Fs])*de,h:tt(ne[oa])*de,m:tt(ne[_s])*de,s:tt(ne[Ul])*de,ms:tt(Lg(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 d1(X),Yc(M)&&a(M,"_locale")&&(Re._locale=M._locale),Yc(M)&&a(M,"_isValid")&&(Re._isValid=M._isValid),Re}ln.fn=d1.prototype,ln.invalid=FE;function cp(M,B){var X=M&&parseFloat(M.replace(",","."));return(isNaN(X)?0:X)*B}function bO(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=bO(M,B):(X=bO(B,M),X.milliseconds=-X.milliseconds,X.months=-X.months),X):{milliseconds:0,months:0}}function p1(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),xO(this,de,M),this}}function xO(M,B,X,ne){var de=B._milliseconds,Re=Lg(B._days),Je=Lg(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 zg=p1(1,"add"),nx=p1(-1,"subtract");function m1(M){return typeof M=="string"||M instanceof String}function di(M){return S(M)||u(M)||m1(M)||l(M)||wO(M)||DR(M)||M===null||M===void 0}function DR(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 iA(){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 lx(M){M||(M=this.isUtc()?t.defaultFormatUtc:t.defaultFormat);var B=Se(this,M);return this.localeData().postformat(B)}function NR(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 TR(M){return this.from(On(),M)}function FR(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 ux(M){return this.to(On(),M)}function A1(M){var B;return M===void 0?this._locale._abbr:(B=Ba(M),B!=null&&(this._locale=B),this)}var cx=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 DO(){return this._locale}var g1=1e3,Ug=60*g1,fx=60*Ug,fo=(365*400+97)*24*fx;function Va(M,B){return(M%B+B)%B}function OO(M,B,X){return M<100&&M>=0?new Date(M+400,B,X)-fo:new Date(M,B,X).valueOf()}function MO(M,B,X){return M<100&&M>=0?Date.UTC(M+400,B,X)-fo:Date.UTC(M,B,X)}function jO(M){var B,X;if(M=re(M),M===void 0||M==="millisecond"||!this.isValid())return this;switch(X=this._isUTC?MO:OO,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-=Va(B+(this._isUTC?0:this.utcOffset()*Ug),fx);break;case"minute":B=this._d.valueOf(),B-=Va(B,Ug);break;case"second":B=this._d.valueOf(),B-=Va(B,g1);break}return this._d.setTime(B),t.updateOffset(this,!0),this}function _R(M){var B,X;if(M=re(M),M===void 0||M==="millisecond"||!this.isValid())return this;switch(X=this._isUTC?MO:OO,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+=fx-Va(B+(this._isUTC?0:this.utcOffset()*Ug),fx)-1;break;case"minute":B=this._d.valueOf(),B+=Ug-Va(B,Ug)-1;break;case"second":B=this._d.valueOf(),B+=g1-Va(B,g1)-1;break}return this._d.setTime(B),t.updateOffset(this,!0),this}function _E(){return this._d.valueOf()-(this._offset||0)*6e4}function v1(){return Math.floor(this.valueOf()/1e3)}function PE(){return new Date(this.valueOf())}function Wg(){var M=this;return[M.year(),M.month(),M.date(),M.hour(),M.minute(),M.second(),M.millisecond()]}function y1(){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 b1(){return this.isValid()?this.toISOString():null}function dx(){return g(this)}function Hg(){return f({},h(this))}function PR(){return h(this).overflow}function IR(){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",qR),Dt("NNNNN",LR),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",zR),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 BR(M,B){var X,ne,de,Re=this._eras||Ba("en")._eras;for(X=0,ne=Re.length;X=0)return Re[ne]}function $R(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 px(){var M,B,X,ne=this.localeData().eras();for(M=0,B=ne.length;MRe&&(B=Re),QR.call(this,M,B,X,ne,de))}function QR(M,B,X,ne,de){var Re=o1(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[as]=(tt(M)-1)*3});function YR(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"],Fs),Yr("Do",function(M,B){B[Fs]=tt(M.match(ue)[0])});var FO=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"],_s);var ZR=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"],Ul);var XR=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,_O;for(km="SSSS";km.length<=9;km+="S")Dt(km,Wr);function KR(M,B){B[ol]=tt(("0."+M)*1e3)}for(km="S";km.length<=9;km+="S")Yr(km,KR);_O=Ct("Milliseconds",!1),Q("z",0,0,"zoneAbbr"),Q("zz",0,0,"zoneName");function aA(){return this._isUTC?"UTC":""}function JR(){return this._isUTC?"Coordinated Universal Time":""}var bt=w.prototype;bt.add=zg,bt.calendar=MR,bt.clone=jR,bt.diff=kO,bt.endOf=_R,bt.format=lx,bt.from=NR,bt.fromNow=TR,bt.to=FR,bt.toNow=ux,bt.get=Le,bt.invalidAt=PR,bt.isAfter=ax,bt.isBefore=Em,bt.isBetween=ox,bt.isSame=SO,bt.isSameOrAfter=sx,bt.isSameOrBefore=EO,bt.isValid=dx,bt.lang=cx,bt.locale=A1,bt.localeData=DO,bt.max=mR,bt.min=tx,bt.parsingFlags=Hg,bt.set=Ze,bt.startOf=jO,bt.subtract=nx,bt.toArray=Wg,bt.toObject=y1,bt.toDate=PE,bt.toISOString=h1,bt.inspect=iA,typeof Symbol<"u"&&Symbol.for!=null&&(bt[Symbol.for("nodejs.util.inspect.custom")]=function(){return"Moment<"+this.format()+">"}),bt.toJSON=b1,bt.toString=CO,bt.unix=v1,bt.valueOf=_E,bt.creationData=IR,bt.eraName=px,bt.eraNarrow=x1,bt.eraAbbr=NO,bt.eraYear=pe,bt.year=ll,bt.isLeapYear=i1,bt.weekYear=UR,bt.isoWeekYear=WR,bt.quarter=bt.quarters=YR,bt.month=sl,bt.daysInMonth=sp,bt.week=bt.weeks=Xh,bt.isoWeek=bt.isoWeeks=Lb,bt.weeksInYear=dp,bt.weeksInWeekYear=GR,bt.isoWeeksInYear=HR,bt.isoWeeksInISOWeekYear=VR,bt.date=FO,bt.day=bt.days=H,bt.weekday=K,bt.isoWeekday=se,bt.dayOfYear=pp,bt.hour=bt.hours=co,bt.minute=bt.minutes=ZR,bt.second=bt.seconds=XR,bt.millisecond=bt.milliseconds=_O,bt.utcOffset=wR,bt.utc=ER,bt.local=kR,bt.parseZone=CR,bt.hasAlignedHourOffset=Sm,bt.isDST=Ue,bt.isLocal=Xe,bt.isUtcOffset=Ut,bt.isUtc=Fr,bt.isUTC=Fr,bt.zoneAbbr=aA,bt.zoneName=JR,bt.dates=j("dates accessor is deprecated. Use date instead.",FO),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/",SR),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 e$(){return On.apply(null,arguments).parseZone()}function PO(M){return M}var Wn=q.prototype;Wn.calendar=T,Wn.longDateFormat=ye,Wn.invalidDate=ke,Wn.ordinal=ce,Wn.preparse=PO,Wn.postformat=PO,Wn.relativeTime=R,Wn.pastFuture=J,Wn.set=D,Wn.eras=BR,Wn.erasParse=RR,Wn.erasConvertYear=$R,Wn.erasAbbrRegex=mx,Wn.erasNameRegex=Vg,Wn.erasNarrowRegex=ic,Wn.months=Vf,Wn.monthsShort=kn,Wn.monthsParse=Yh,Wn.monthsRegex=jg,Wn.monthsShortRegex=Gc,Wn.week=Zh,Wn.firstDayOfYear=Tg,Wn.firstDayOfWeek=Ng,Wn.weekdays=Jh,Wn.weekdaysMin=Cu,Wn.weekdaysShort=eA,Wn.weekdaysParse=Gb,Wn.weekdaysRegex=xe,Wn.weekdaysShortRegex=je,Wn.weekdaysMinRegex=Ke,Wn.isPM=Ju,Wn.meridiem=Bg;function Ax(M,B,X,ne){var de=Ba(),Re=d().set(ne,B);return de[X](Re,M)}function IO(M,B,X){if(l(M)&&(B=M,M=void 0),M=M||"",B!=null)return Ax(M,B,X,"month");var ne,de=[];for(ne=0;ne<12;ne++)de[ne]=Ax(M,ne,X,"month");return de}function gx(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,sr=[];if(X!=null)return Ax(B,(X+Re)%7,ne,"day");for(Je=0;Je<7;Je++)sr[Je]=Ax(B,(Je+Re)%7,ne,"day");return sr}function BO(M,B){return IO(M,B,"months")}function t$(M,B){return IO(M,B,"monthsShort")}function r$(M,B,X){return gx(M,B,X,"weekdays")}function IE(M,B,X){return gx(M,B,X,"weekdaysShort")}function w1(M,B,X){return gx(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 n$(){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 BE(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 i$(M,B){return BE(this,M,B,1)}function mp(M,B){return BE(this,M,B,-1)}function vx(M){return M<0?Math.floor(M):Math.ceil(M)}function oA(){var M=this._milliseconds,B=this._days,X=this._months,ne=this._data,de,Re,Je,sr,Hr;return M>=0&&B>=0&&X>=0||M<=0&&B<=0&&X<=0||(M+=vx(RE(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-=vx(RE(Hr)),sr=Ye(X/12),X%=12,ne.days=B,ne.months=X,ne.years=sr,this}function Ou(M){return M*4800/146097}function RE(M){return M*146097/4800}function RO(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(RE(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 $O(){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"),qO=Mu("s"),a$=Mu("m"),yx=Mu("h"),o$=Mu("d"),LO=Mu("w"),os=Mu("M"),$E=Mu("Q"),zO=Mu("y");function Kf(){return ln(this)}function qE(M){return M=re(M),this.isValid()?this[M+"s"]():NaN}function Jf(M){return function(){return this.isValid()?this._data[M]:NaN}}var sA=Jf("milliseconds"),UO=Jf("seconds"),cl=Jf("minutes"),LE=Jf("hours"),s$=Jf("days"),l$=Jf("months"),u$=Jf("years");function zE(){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 WO(M,B,X,ne,de){return de.relativeTime(B||1,!!X,M,ne)}function c$(M,B,X,ne){var de=ln(M).abs(),Re=hp(de.as("s")),Je=hp(de.as("m")),sr=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,WO.apply(null,Ap)}function f$(M){return M===void 0?hp:typeof M=="function"?(hp=M,!0):!1}function S1(M,B){return ed[M]===void 0?!1:B===void 0?ed[M]:(ed[M]=B,M==="s"&&(ed.ss=B-1),!0)}function d$(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=c$(this,!X,ne,de),X&&(Re=de.pastFuture(+this,Re)),de.postformat(Re)}var UE=Math.abs;function Dm(M){return(M>0)-(M<0)||+M}function E1(){if(!this.isValid())return this.localeData().invalidDate();var M=UE(this._milliseconds)/1e3,B=UE(this._days),X=UE(this._months),ne,de,Re,Je,sr=this.asSeconds(),Hr,Jn,fl,td;return sr?(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=sr<0?"-":"",Jn=Dm(this._months)!==Dm(sr)?"-":"",fl=Dm(this._days)!==Dm(sr)?"-":"",td=Dm(this._milliseconds)!==Dm(sr)?"-":"",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=d1.prototype;Mn.isValid=yR,Mn.abs=n$,Mn.add=i$,Mn.subtract=mp,Mn.as=RO,Mn.asMilliseconds=Cm,Mn.asSeconds=qO,Mn.asMinutes=a$,Mn.asHours=yx,Mn.asDays=o$,Mn.asWeeks=LO,Mn.asMonths=os,Mn.asQuarters=$E,Mn.asYears=zO,Mn.valueOf=$O,Mn._bubble=oA,Mn.clone=Kf,Mn.get=qE,Mn.milliseconds=sA,Mn.seconds=UO,Mn.minutes=cl,Mn.hours=LE,Mn.days=s$,Mn.weeks=zE,Mn.months=l$,Mn.years=u$,Mn.humanize=d$,Mn.toISOString=E1,Mn.toString=E1,Mn.toJSON=E1,Mn.locale=A1,Mn.localeData=DO,Mn.toIsoString=j("toIsoString() is deprecated. Please use toISOString() instead (notice the capitals)",E1),Mn.lang=cx,Q("X",0,0,"unix"),Q("x",0,0,"valueOf"),Dt("x",en),Dt("X",is),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=hR,t.max=AR,t.now=gR,t.utc=d,t.unix=Zc,t.months=BO,t.isDate=u,t.locale=Qc,t.invalid=A,t.duration=ln,t.isMoment=S,t.weekdays=r$,t.parseZone=e$,t.localeData=Ba,t.isDuration=Yc,t.monthsShort=t$,t.weekdaysMin=w1,t.defineLocale=zo,t.updateLocale=ME,t.locales=jE,t.weekdaysShort=IE,t.normalizeUnits=re,t.relativeTimeRounding=f$,t.relativeTimeThreshold=S1,t.calendarFormat=OR,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 bi=vn((Wx,lk)=>{(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),Yt=/<%-([\s\S]+?)%>/g,Wr=/<%([\s\S]+?)%>/g,en=/<%=([\s\S]+?)%>/g,tn=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,ci=/^\w*$/,is=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Yi=/[\\^$.*+?()[\]{}|]/g,Pa=RegExp(Yi.source),Dt=/^\s+/,Hc=/\s/,Wf=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,Ha=/\{\n\/\* \[wrapped with (.+)\] \*/,Eu=/,? & /,Yr=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,zl=/[()=,{}\[\]\/\s]/,gm=/\\(\\)?/g,fi=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,as=/\w*$/,Fs=/^[-+]0x[0-9a-f]+$/i,oa=/^0b[01]+$/i,_s=/^\[object .+?Constructor\]$/,Ul=/^0o[0-7]+$/i,ol=/^(?:0|[1-9]\d*)$/,Cg=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,Vc=/($^)/,Dg=/['\n\r\u2028\u2029\\]/g,_n="\\ud800-\\udfff",Hf="\\u0300-\\u036f",Og="\\ufe20-\\ufe2f",Gh="\\u20d0-\\u20ff",vm=Hf+Og+Gh,Mg="\\u2700-\\u27bf",Qh="a-z\\xdf-\\xf6\\xf8-\\xff",Vf="\\xac\\xb1\\xd7\\xf7",kn="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",Ia="\\u2000-\\u206f",Yh=" \\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+Yh,Gc="['\u2019]",jg="["+_n+"]",ym="["+sp+"]",ku="["+vm+"]",ll="\\d+",i1="["+Mg+"]",a1="["+Qh+"]",bm="[^"+_n+sp+ll+Mg+Qh+Cn+"]",Gf="\\ud83c[\\udffb-\\udfff]",o1="(?:"+ku+"|"+Gf+")",Qf="[^"+_n+"]",Wl="(?:\\ud83c[\\udde6-\\uddff]){2}",Zh="[\\ud800-\\udbff][\\udc00-\\udfff]",ul="["+Cn+"]",Ng="\\u200d",Tg="(?:"+a1+"|"+bm+")",Xh="(?:"+ul+"|"+bm+")",Lb="(?:"+Gc+"(?:d|ll|m|re|s|t|ve))?",zb="(?:"+Gc+"(?:D|LL|M|RE|S|T|VE))?",Fg=o1+"?",_g="["+sl+"]?",Ub="(?:"+Ng+"(?:"+[Qf,Wl,Zh].join("|")+")"+_g+Fg+")*",Wb="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",Hb="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",Kh=_g+Fg+Ub,Pg="(?:"+[i1,Wl,Zh].join("|")+")"+Kh,Vb="(?:"+[Qf+ku+"?",ku,Wl,Zh,jg].join("|")+")",Jh=RegExp(Gc,"g"),eA=RegExp(ku,"g"),Cu=RegExp(Gf+"(?="+Gf+")|"+Vb+Kh,"g"),Ig=RegExp([ul+"?"+a1+"+"+Lb+"(?="+[ym,ul,"$"].join("|")+")",Xh+"+"+zb+"(?="+[ym,ul+Tg,"$"].join("|")+")",ul+"?"+Tg+"+"+Lb,ul+"+"+zb,Hb,Wb,ll,Pg].join("|"),"g"),Gb=RegExp("["+Ng+_n+vm+sl+"]"),H=/[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={"&":"&","<":"<",">":">",'"':""","'":"'"},wr={"&":"&","<":"<",">":">",""":'"',"'":"'"},Pn={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},sn=parseFloat,sa=parseInt,Ju=typeof global=="object"&&global&&global.Object===Object&&global,Qb=typeof self=="object"&&self&&self.Object===Object&&self,co=Ju||Qb||Function("return this")(),Bg=typeof Wx=="object"&&Wx&&!Wx.nodeType&&Wx,Yf=Bg&&typeof lk=="object"&&lk&&!lk.nodeType&&lk,gi=Yf&&Yf.exports===Bg,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{}}(),Yb=Lo&&Lo.isArrayBuffer,s1=Lo&&Lo.isDate,Zb=Lo&&Lo.isMap,Xb=Lo&&Lo.isRegExp,tA=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 ME(Ue,rt,Xe,Ut){for(var Fr=-1,Kn=Ue==null?0:Ue.length;++Fr-1}function l1(Ue,rt,Xe){for(var Ut=-1,Fr=Ue==null?0:Ue.length;++Ut-1;);return Xe}function tx(Ue,rt){for(var Xe=Ue.length;Xe--&&xm(rt,Ue[Xe],0)>-1;);return Xe}function mR(Ue,rt){for(var Xe=Ue.length,Ut=0;Xe--;)Ue[Xe]===rt&&++Ut;return Ut}var vO=ft(Ke),hR=ft(ot);function AR(Ue){return"\\"+Pn[Ue]}function gR(Ue,rt){return Ue==null?e:Ue[rt]}function Xf(Ue){return Gb.test(Ue)}function vR(Ue){return H.test(Ue)}function yR(Ue){for(var rt,Xe=[];!(rt=Ue.next()).done;)Xe.push(rt.value);return Xe}function FE(Ue){var rt=-1,Xe=Array(Ue.size);return Ue.forEach(function(Ut,Fr){Xe[++rt]=[Fr,Ut]}),Xe}function d1(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 FO(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=GR,dp.prototype.delete=TO,dp.prototype.get=QR,dp.prototype.has=YR,dp.prototype.set=FO;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(!Ga(y))return y;var lt=Vr(y);if(lt){if(Fe=Qje(y),!$e)return oc(y,Fe)}else{var At=Hl(y),Pt=At==me||At==ke;if(Zg(y))return uK(y,$e);if(At==U||At==Q||Pt&&!le){if(Fe=We||Pt?{}:OK(y),!$e)return We?Bje(y,i$(Fe,y)):Ije(y,BE(Fe,y))}else{if(!je[At])return le?y:{};Fe=Yje(y,At,$e)}}be||(be=new Zc);var nr=be.get(y);if(nr)return nr;be.set(y,Fe),nJ(y)?y.forEach(function(Er){Fe.add(Ou(Er,E,F,Er,y,be))}):tJ(y)&&y.forEach(function(Er,gn){Fe.set(gn,Ou(Er,E,F,gn,y,be))});var Sr=st?We?k$:E$:We?lc:Bs,nn=lt?e:Sr(y);return Ba(nn||y,function(Er,gn){nn&&(gn=Er,Er=y[gn]),w1(Fe,gn,Ou(Er,E,F,gn,y,be))}),Fe}function RE(y){var E=Bs(y);return function(F){return RO(F,y,E)}}function RO(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 $O(y,E,F){if(typeof y!="function")throw new nc(i);return GE(function(){y.apply(e,F)},E)}function Mu(y,E,F,Z){var le=-1,be=$g,Fe=!0,$e=y.length,We=[],st=E.length;if(!$e)return We;F&&(E=si(E,Mi(F))),Z?(be=l1,Fe=!1):E.length>=r&&(be=rc,Fe=!1,E=new aA(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=mK(Kf),qO=mK(qE,!0);function a$(y,E){var F=!0;return Cm(y,function(Z,le,be){return F=!!E(Z,le,be),F}),F}function yx(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:aJ(Z);F0&&F($e)?E>1?os($e,E-1,F,Z,le):ec(le,$e):Z||(le[le.length]=$e)}return le}var $E=hK(),zO=hK(!0);function Kf(y,E){return y&&$E(y,E,Bs)}function qE(y,E){return y&&zO(y,E,Bs)}function Jf(y,E){return Zf(E,function(F){return fA(y[F])})}function sA(y,E){E=Qg(E,y);for(var F=0,Z=E.length;y!=null&&FE}function s$(y,E){return y!=null&&di.call(y,E)}function l$(y,E){return y!=null&&E in ln(y)}function u$(y,E,F){return y>=Va(E,F)&&y=120&<.length>=120)?new aA(Fe&<):e}lt=y[0];var At=-1,Pt=$e[0];e:for(;++At-1;)$e!==y&&nA.call($e,We,1),nA.call(y,We,1);return y}function tK(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;cA(le)?nA.call(y,le,1):g$(y,le)}}return y}function m$(y,E){return y+A1(jO()*(E-y+1))}function kje(y,E,F,Z){for(var le=-1,be=fo(ux((E-y)/(F||1)),0),Fe=Xe(be);be--;)Fe[Z?be:++le]=y,y+=F;return Fe}function h$(y,E){var F="";if(!y||E<1||E>I)return F;do E%2&&(F+=y),E=A1(E/2),E&&(y+=y);while(E);return F}function un(y,E){return T$(NK(y,E,uc),y+"")}function Cje(y){return BO(Ex(y))}function Dje(y,E){var F=Ex(y);return eM(F,oA(E,0,F.length))}function WE(y,E,F,Z){if(!Ga(y))return y;E=Qg(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:Lje(y);if(st)return Lg(st);Fe=!1,le=rc,We=new aA}else We=E?[]:$e;e:for(;++Z=Z?y:rd(y,E,F)}var lK=NR||function(y){return co.clearTimeout(y)};function uK(y,E){if(E)return y.slice();var F=y.length,Z=SO?SO(F):new y.constructor(F);return y.copy(Z),Z}function x$(y){var E=new y.constructor(y.byteLength);return new ox(E).set(new ox(y)),E}function Tje(y,E){var F=E?x$(y.buffer):y.buffer;return new y.constructor(F,y.byteOffset,y.byteLength)}function Fje(y){var E=new y.constructor(y.source,as.exec(y));return E.lastIndex=y.lastIndex,E}function _je(y){return x1?ln(x1.call(y)):{}}function cK(y,E){var F=E?x$(y.buffer):y.buffer;return new y.constructor(F,y.byteOffset,y.length)}function fK(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 dK(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 vK(y){return uA(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&&KO(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,nr=F&p?new aA:e;for(be.set(y,E),be.set(E,y);++At<$e;){var Sr=y[At],nn=E[At];if(Z)var Er=Fe?Z(nn,Sr,At,E,y,be):Z(Sr,nn,At,y,E,be);if(Er!==e){if(Er)continue;Pt=!1;break}if(nr){if(!c1(E,function(gn,In){if(!rc(nr,In)&&(Sr===gn||le(Sr,gn,F,Z,be)))return nr.push(In)})){Pt=!1;break}}else if(!(Sr===nn||le(Sr,nn,F,Z,be))){Pt=!1;break}}return be.delete(y),be.delete(E),Pt}function Uje(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 ox(y),new ox(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=FE;case ie:var We=Z&d;if($e||($e=Lg),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=kK($e(y),$e(E),Z,le,be,Fe);return Fe.delete(y),lt;case Ee:if(x1)return x1.call(y)==x1.call(E)}return!1}function Wje(y,E,F,Z,le,be){var Fe=F&d,$e=E$(y),We=$e.length,st=E$(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 nr=be.get(y),Sr=be.get(E);if(nr&&Sr)return nr==E&&Sr==y;var nn=!0;be.set(y,E),be.set(E,y);for(var Er=Fe;++At1?"& ":"")+E[Z],E=E.join(F>2?", ":" "),y.replace(Wf,`{ /* [wrapped with `+E+`] */ -`)}function Xje(y){return Vr(y)||D1(y)||!!(CO&&y&&y[CO])}function cA(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 eM(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,LK(y,F)});function zK(y){var E=pe(y);return E.__chain__=!0,E}function lTe(y,E){return E(y),y}function tM(y,E){return E(y)}var uTe=uA(function(y){var E=y.length,F=E?y[0]:0,Z=this.__wrapped__,le=function(be){return vx(be,y)};return E>1||this.__actions__.length||!(Z instanceof rn)||!cA(F)?this.thru(le):(Z=Z.slice(F,+F+(E?1:0)),Z.__actions__.push({func:tM,args:[le],thisArg:e}),new ic(Z,this.__chain__).thru(function(be){return E&&!be.length&&be.push(e),be}))});function cTe(){return zK(this)}function fTe(){return new ic(this.value(),this.__chain__)}function dTe(){this.__values__===e&&(this.__values__=rJ(this.value()));var y=this.__index__>=this.__values__.length,E=y?e:this.__values__[this.__index__++];return{done:y,value:E}}function pTe(){return this}function mTe(y){for(var E,F=this;F instanceof mx;){var Z=PK(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 hTe(){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:tM,args:[F$],thisArg:e}),new ic(E,this.__chain__)}return this.thru(F$)}function ATe(){return iK(this.__wrapped__,this.__actions__)}var gTe=GO(function(y,E,F){di.call(y,F)?++y[F]:mp(y,F,1)});function vTe(y,E,F){var Z=Vr(y)?Rg:a$;return F&&ju(y,E,F)&&(E=e),Z(y,gr(E,3))}function yTe(y,E){var F=Vr(y)?Zf:LO;return F(y,gr(E,3))}var bTe=hK(IK),xTe=hK(BK);function wTe(y,E){return os(rM(y,E),1)}function STe(y,E){return os(rM(y,E),z)}function ETe(y,E,F){return F=F===e?1:Xr(F),os(rM(y,E),F)}function UK(y,E){var F=Vr(y)?Ba:Cm;return F(y,gr(E,3))}function WK(y,E){var F=Vr(y)?jE:qO;return F(y,gr(E,3))}var kTe=GO(function(y,E,F){di.call(y,F)?y[F].push(E):mp(y,F,[E])});function CTe(y,E,F,Z){y=sc(y)?y:Ex(y),F=F&&!Z?Xr(F):0;var le=y.length;return F<0&&(F=fo(le+F,0)),sM(y)?F<=le&&y.indexOf(E,F)>-1:!!le&&xm(y,E,F)>-1}var DTe=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}),OTe=GO(function(y,E,F){mp(y,F,E)});function rM(y,E){var F=Vr(y)?si:Je;return F(y,gr(E,3))}function MTe(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 jTe=GO(function(y,E,F){y[F?0:1].push(E)},function(){return[[],[]]});function NTe(y,E,F){var Z=Vr(y)?u1:Jt,le=arguments.length<3;return Z(y,gr(E,4),F,le,Cm)}function TTe(y,E,F){var Z=Vr(y)?NE:Jt,le=arguments.length<3;return Z(y,gr(E,4),F,le,qO)}function FTe(y,E){var F=Vr(y)?Zf:LO;return F(y,aM(gr(E,3)))}function _Te(y){var E=Vr(y)?BO:Cje;return E(y)}function PTe(y,E,F){(F?ju(y,E,F):E===e)?E=1:E=Xr(E);var Z=Vr(y)?t$:Dje;return Z(y,E)}function ITe(y){var E=Vr(y)?r$:Mje;return E(y)}function BTe(y){if(y==null)return 0;if(sc(y))return sM(y)?wm(y):y.length;var E=Hl(y);return E==$||E==ie?y.size:ne(y).length}function RTe(y,E,F){var Z=Vr(y)?c1:jje;return F&&ju(y,E,F)&&(E=e),Z(y,gr(E,3))}var $Te=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,os(E,1),[])}),nM=TR||function(){return co.Date.now()};function qTe(y,E){if(typeof E!="function")throw new nc(i);return y=Xr(y),function(){if(--y<1)return E.apply(this,arguments)}}function HK(y,E,F){return E=F?e:E,E=y&&E==null?y.length:E,lA(y,w,e,e,e,e,E)}function VK(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 P$=un(function(y,E,F){var Z=h;if(F.length){var le=Yc(F,wx(P$));Z|=v}return lA(y,Z,E,F,le)}),GK=un(function(y,E,F){var Z=h|m;if(F.length){var le=Yc(F,wx(GK));Z|=v}return lA(E,Z,y,F,le)});function QK(y,E,F){E=F?e:E;var Z=lA(y,A,e,e,e,e,e,E);return Z.placeholder=QK.placeholder,Z}function YK(y,E,F){E=F?e:E;var Z=lA(y,b,e,e,e,e,e,E);return Z.placeholder=YK.placeholder,Z}function ZK(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,Ga(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 nr(Do){var vp=Z,pA=le;return Z=le=e,st=Do,Fe=y.apply(pA,vp),Fe}function Sr(Do){return st=Do,$e=GE(gn,E),lt?nr(Do):Fe}function nn(Do){var vp=Do-We,pA=Do-st,hJ=E-vp;return At?Va(hJ,be-pA):hJ}function Er(Do){var vp=Do-We,pA=Do-st;return We===e||vp>=E||vp<0||At&&pA>=be}function gn(){var Do=nM();if(Er(Do))return In(Do);$e=GE(gn,nn(Do))}function In(Do){return $e=e,Pt&&Z?nr(Do):(Z=le=e,Fe)}function Jc(){$e!==e&&oK($e),st=0,Z=We=le=$e=e}function Nu(){return $e===e?Fe:In(nM())}function ef(){var Do=nM(),vp=Er(Do);if(Z=arguments,le=this,We=Do,vp){if($e===e)return Sr(We);if(At)return oK($e),$e=GE(gn,E),nr(We)}return $e===e&&($e=GE(gn,E)),Fe}return ef.cancel=Jc,ef.flush=Nu,ef}var LTe=un(function(y,E){return $O(y,1,E)}),zTe=un(function(y,E,F){return $O(y,id(E)||0,F)});function UTe(y){return lA(y,k)}function iM(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(iM.Cache||pp),F}iM.Cache=pp;function aM(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 WTe(y){return VK(2,y)}var HTe=Nje(function(y,E){E=E.length==1&&Vr(E[0])?si(E[0],Mi(gr())):si(os(E,1),Mi(gr()));var F=E.length;return un(function(Z){for(var le=-1,be=Va(Z.length,F);++le=E}),D1=WO(function(){return arguments}())?WO:function(y){return po(y)&&di.call(y,"callee")&&!kO.call(y,"callee")},Vr=Xe.isArray,oFe=Yb?Mi(Yb):c$;function sc(y){return y!=null&&oM(y.length)&&!fA(y)}function Co(y){return po(y)&&sc(y)}function sFe(y){return y===!0||y===!1||po(y)&&cl(y)==Se}var Zg=DO||G$,lFe=s1?Mi(s1):f$;function uFe(y){return po(y)&&y.nodeType===1&&!QE(y)}function cFe(y){if(y==null)return!0;if(sc(y)&&(Vr(y)||typeof y=="string"||typeof y.splice=="function"||Zg(y)||Sx(y)||D1(y)))return!y.length;var E=Hl(y);if(E==$||E==ie)return!y.size;if(VE(y))return!ne(y).length;for(var F in y)if(di.call(y,F))return!1;return!0}function fFe(y,E){return S1(y,E)}function dFe(y,E,F){F=typeof F=="function"?F:e;var Z=F?F(y,E):e;return Z===e?S1(y,E,e,F):!!Z}function B$(y){if(!po(y))return!1;var E=cl(y);return E==ye||E==ve||typeof y.message=="string"&&typeof y.name=="string"&&!QE(y)}function pFe(y){return typeof y=="number"&&g1(y)}function fA(y){if(!Ga(y))return!1;var E=cl(y);return E==me||E==ke||E==Ie||E==J}function KK(y){return typeof y=="number"&&y==Xr(y)}function oM(y){return typeof y=="number"&&y>-1&&y%1==0&&y<=I}function Ga(y){var E=typeof y;return y!=null&&(E=="object"||E=="function")}function po(y){return y!=null&&typeof y=="object"}var JK=Zb?Mi(Zb):UE;function mFe(y,E){return y===E||Dm(y,E,D$(E))}function hFe(y,E,F){return F=typeof F=="function"?F:e,Dm(y,E,D$(E),F)}function AFe(y){return eJ(y)&&y!=+y}function gFe(y){if(eNe(y))throw new Fr(n);return E1(y)}function vFe(y){return y===null}function yFe(y){return y==null}function eJ(y){return typeof y=="number"||po(y)&&cl(y)==ae}function QE(y){if(!po(y)||cl(y)!=U)return!1;var E=sx(y);if(E===null)return!0;var F=di.call(E,"constructor")&&E.constructor;return typeof F=="function"&&F instanceof F&&m1.call(F)==OR}var R$=Xb?Mi(Xb):Mn;function bFe(y){return KK(y)&&y>=-I&&y<=I}var tJ=tA?Mi(tA):M;function sM(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 Sx=Qc?Mi(Qc):B;function xFe(y){return y===e}function wFe(y){return po(y)&&Hl(y)==_e}function SFe(y){return po(y)&&cl(y)==he}var EFe=XO(Re),kFe=XO(function(y,E){return y<=E});function rJ(y){if(!y)return[];if(sc(y))return sM(y)?Du(y):oc(y);if(h1&&y[h1])return yR(y[h1]());var E=Hl(y),F=E==$?FE:E==ie?Lg:Ex;return F(y)}function dA(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=dA(y),F=E%1;return E===E?F?E-F:E:0}function nJ(y){return y?oA(Xr(y),0,_):0}function id(y){if(typeof y=="number")return y;if(Kc(y))return L;if(Ga(y)){var E=typeof y.valueOf=="function"?y.valueOf():y;y=Ga(E)?E+"":E}if(typeof y!="string")return y===0?y:+y;y=Ps(y);var F=oa.test(y);return F||Ul.test(y)?sa(y.slice(2),F?2:8):Fs.test(y)?L:+y}function iJ(y){return Om(y,lc(y))}function CFe(y){return y?oA(Xr(y),-I,I):y===0?y:0}function vi(y){return y==null?"":Xc(y)}var DFe=bx(function(y,E){if(VE(E)||sc(E)){Om(E,Bs(E),y);return}for(var F in E)di.call(E,F)&&w1(y,F,E[F])}),aJ=bx(function(y,E){Om(E,lc(E),y)}),lM=bx(function(y,E,F,Z){Om(E,lc(E),y,Z)}),OFe=bx(function(y,E,F,Z){Om(E,Bs(E),y,Z)}),MFe=uA(vx);function jFe(y,E){var F=Vg(y);return E==null?F:BE(F,E)}var NFe=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,k$(y),F),Z&&(F=Ou(F,u|c|f,zje));for(var le=E.length;le--;)g$(F,E[le]);return F});function YFe(y,E){return sJ(y,aM(gr(E)))}var ZFe=uA(function(y,E){return y==null?{}:Sje(y,E)});function sJ(y,E){if(y==null)return{};var F=si(k$(y),function(Z){return[Z]});return E=gr(E),KX(y,F,function(Z,le){return E(Z,le[0])})}function XFe(y,E,F){E=Qg(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=jO();return Va(y+le*(E-y+sn("1e-"+((le+"").length-1))),E)}return m$(y,E)}var l3e=xx(function(y,E,F){return E=E.toLowerCase(),y+(F?cJ(E):E)});function cJ(y){return L$(vi(y).toLowerCase())}function fJ(y){return y=vi(y),y&&y.replace(Cg,vO).replace(eA,"")}function u3e(y,E,F){y=vi(y),E=Xc(E);var Z=y.length;F=F===e?Z:oA(Xr(F),0,Z);var le=F;return F-=E.length,F>=0&&y.slice(F,le)==E}function c3e(y){return y=vi(y),y&&ht.test(y)?y.replace(De,hR):y}function f3e(y){return y=vi(y),y&&Pa.test(y)?y.replace(Yi,"\\$&"):y}var d3e=xx(function(y,E,F){return y+(F?"-":"")+E.toLowerCase()}),p3e=xx(function(y,E,F){return y+(F?" ":"")+E.toLowerCase()}),m3e=mK("toLowerCase");function h3e(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 ZO(A1(le),F)+y+ZO(ux(le),F)}function A3e(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&&!R$(E))&&(E=Xc(E),!E&&Xf(y))?Yg(Du(y),0,F):y.split(E,F)):[]}var S3e=xx(function(y,E,F){return y+(F?" ":"")+L$(E)});function E3e(y,E,F){return y=vi(y),F=F==null?0:oA(Xr(F),0,y.length),E=Xc(E),y.slice(F,F+E.length)==E}function k3e(y,E,F){var Z=pe.templateSettings;F&&ju(y,E,F)&&(E=e),y=vi(y),E=lM({},E,Z,xK);var le=lM({},E.imports,Z.imports,xK),be=Bs(le),Fe=Is(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"),nr="//# sourceURL="+(di.call(E,"sourceURL")?(E.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++se+"]")+` +`)}function Xje(y){return Vr(y)||D1(y)||!!(CO&&y&&y[CO])}function cA(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 eM(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,UK(y,F)});function WK(y){var E=pe(y);return E.__chain__=!0,E}function lTe(y,E){return E(y),y}function tM(y,E){return E(y)}var uTe=uA(function(y){var E=y.length,F=E?y[0]:0,Z=this.__wrapped__,le=function(be){return vx(be,y)};return E>1||this.__actions__.length||!(Z instanceof rn)||!cA(F)?this.thru(le):(Z=Z.slice(F,+F+(E?1:0)),Z.__actions__.push({func:tM,args:[le],thisArg:e}),new ic(Z,this.__chain__).thru(function(be){return E&&!be.length&&be.push(e),be}))});function cTe(){return WK(this)}function fTe(){return new ic(this.value(),this.__chain__)}function dTe(){this.__values__===e&&(this.__values__=iJ(this.value()));var y=this.__index__>=this.__values__.length,E=y?e:this.__values__[this.__index__++];return{done:y,value:E}}function pTe(){return this}function mTe(y){for(var E,F=this;F instanceof mx;){var Z=BK(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 hTe(){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:tM,args:[F$],thisArg:e}),new ic(E,this.__chain__)}return this.thru(F$)}function ATe(){return oK(this.__wrapped__,this.__actions__)}var gTe=GO(function(y,E,F){di.call(y,F)?++y[F]:mp(y,F,1)});function vTe(y,E,F){var Z=Vr(y)?Rg:a$;return F&&ju(y,E,F)&&(E=e),Z(y,gr(E,3))}function yTe(y,E){var F=Vr(y)?Zf:LO;return F(y,gr(E,3))}var bTe=gK(RK),xTe=gK($K);function wTe(y,E){return os(rM(y,E),1)}function STe(y,E){return os(rM(y,E),z)}function ETe(y,E,F){return F=F===e?1:Xr(F),os(rM(y,E),F)}function HK(y,E){var F=Vr(y)?Ba:Cm;return F(y,gr(E,3))}function VK(y,E){var F=Vr(y)?jE:qO;return F(y,gr(E,3))}var kTe=GO(function(y,E,F){di.call(y,F)?y[F].push(E):mp(y,F,[E])});function CTe(y,E,F,Z){y=sc(y)?y:Ex(y),F=F&&!Z?Xr(F):0;var le=y.length;return F<0&&(F=fo(le+F,0)),sM(y)?F<=le&&y.indexOf(E,F)>-1:!!le&&xm(y,E,F)>-1}var DTe=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}),OTe=GO(function(y,E,F){mp(y,F,E)});function rM(y,E){var F=Vr(y)?si:Je;return F(y,gr(E,3))}function MTe(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 jTe=GO(function(y,E,F){y[F?0:1].push(E)},function(){return[[],[]]});function NTe(y,E,F){var Z=Vr(y)?u1:Jt,le=arguments.length<3;return Z(y,gr(E,4),F,le,Cm)}function TTe(y,E,F){var Z=Vr(y)?NE:Jt,le=arguments.length<3;return Z(y,gr(E,4),F,le,qO)}function FTe(y,E){var F=Vr(y)?Zf:LO;return F(y,aM(gr(E,3)))}function _Te(y){var E=Vr(y)?BO:Cje;return E(y)}function PTe(y,E,F){(F?ju(y,E,F):E===e)?E=1:E=Xr(E);var Z=Vr(y)?t$:Dje;return Z(y,E)}function ITe(y){var E=Vr(y)?r$:Mje;return E(y)}function BTe(y){if(y==null)return 0;if(sc(y))return sM(y)?wm(y):y.length;var E=Hl(y);return E==$||E==ie?y.size:ne(y).length}function RTe(y,E,F){var Z=Vr(y)?c1:jje;return F&&ju(y,E,F)&&(E=e),Z(y,gr(E,3))}var $Te=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,os(E,1),[])}),nM=TR||function(){return co.Date.now()};function qTe(y,E){if(typeof E!="function")throw new nc(i);return y=Xr(y),function(){if(--y<1)return E.apply(this,arguments)}}function GK(y,E,F){return E=F?e:E,E=y&&E==null?y.length:E,lA(y,w,e,e,e,e,E)}function QK(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 P$=un(function(y,E,F){var Z=h;if(F.length){var le=Yc(F,wx(P$));Z|=v}return lA(y,Z,E,F,le)}),YK=un(function(y,E,F){var Z=h|m;if(F.length){var le=Yc(F,wx(YK));Z|=v}return lA(E,Z,y,F,le)});function ZK(y,E,F){E=F?e:E;var Z=lA(y,A,e,e,e,e,e,E);return Z.placeholder=ZK.placeholder,Z}function XK(y,E,F){E=F?e:E;var Z=lA(y,b,e,e,e,e,e,E);return Z.placeholder=XK.placeholder,Z}function KK(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,Ga(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 nr(Do){var vp=Z,pA=le;return Z=le=e,st=Do,Fe=y.apply(pA,vp),Fe}function Sr(Do){return st=Do,$e=GE(gn,E),lt?nr(Do):Fe}function nn(Do){var vp=Do-We,pA=Do-st,gJ=E-vp;return At?Va(gJ,be-pA):gJ}function Er(Do){var vp=Do-We,pA=Do-st;return We===e||vp>=E||vp<0||At&&pA>=be}function gn(){var Do=nM();if(Er(Do))return In(Do);$e=GE(gn,nn(Do))}function In(Do){return $e=e,Pt&&Z?nr(Do):(Z=le=e,Fe)}function Jc(){$e!==e&&lK($e),st=0,Z=We=le=$e=e}function Nu(){return $e===e?Fe:In(nM())}function ef(){var Do=nM(),vp=Er(Do);if(Z=arguments,le=this,We=Do,vp){if($e===e)return Sr(We);if(At)return lK($e),$e=GE(gn,E),nr(We)}return $e===e&&($e=GE(gn,E)),Fe}return ef.cancel=Jc,ef.flush=Nu,ef}var LTe=un(function(y,E){return $O(y,1,E)}),zTe=un(function(y,E,F){return $O(y,id(E)||0,F)});function UTe(y){return lA(y,k)}function iM(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(iM.Cache||pp),F}iM.Cache=pp;function aM(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 WTe(y){return QK(2,y)}var HTe=Nje(function(y,E){E=E.length==1&&Vr(E[0])?si(E[0],Mi(gr())):si(os(E,1),Mi(gr()));var F=E.length;return un(function(Z){for(var le=-1,be=Va(Z.length,F);++le=E}),D1=WO(function(){return arguments}())?WO:function(y){return po(y)&&di.call(y,"callee")&&!kO.call(y,"callee")},Vr=Xe.isArray,oFe=Yb?Mi(Yb):c$;function sc(y){return y!=null&&oM(y.length)&&!fA(y)}function Co(y){return po(y)&&sc(y)}function sFe(y){return y===!0||y===!1||po(y)&&cl(y)==Se}var Zg=DO||G$,lFe=s1?Mi(s1):f$;function uFe(y){return po(y)&&y.nodeType===1&&!QE(y)}function cFe(y){if(y==null)return!0;if(sc(y)&&(Vr(y)||typeof y=="string"||typeof y.splice=="function"||Zg(y)||Sx(y)||D1(y)))return!y.length;var E=Hl(y);if(E==$||E==ie)return!y.size;if(VE(y))return!ne(y).length;for(var F in y)if(di.call(y,F))return!1;return!0}function fFe(y,E){return S1(y,E)}function dFe(y,E,F){F=typeof F=="function"?F:e;var Z=F?F(y,E):e;return Z===e?S1(y,E,e,F):!!Z}function B$(y){if(!po(y))return!1;var E=cl(y);return E==ye||E==ve||typeof y.message=="string"&&typeof y.name=="string"&&!QE(y)}function pFe(y){return typeof y=="number"&&g1(y)}function fA(y){if(!Ga(y))return!1;var E=cl(y);return E==me||E==ke||E==Ie||E==J}function eJ(y){return typeof y=="number"&&y==Xr(y)}function oM(y){return typeof y=="number"&&y>-1&&y%1==0&&y<=I}function Ga(y){var E=typeof y;return y!=null&&(E=="object"||E=="function")}function po(y){return y!=null&&typeof y=="object"}var tJ=Zb?Mi(Zb):UE;function mFe(y,E){return y===E||Dm(y,E,D$(E))}function hFe(y,E,F){return F=typeof F=="function"?F:e,Dm(y,E,D$(E),F)}function AFe(y){return rJ(y)&&y!=+y}function gFe(y){if(eNe(y))throw new Fr(n);return E1(y)}function vFe(y){return y===null}function yFe(y){return y==null}function rJ(y){return typeof y=="number"||po(y)&&cl(y)==ae}function QE(y){if(!po(y)||cl(y)!=U)return!1;var E=sx(y);if(E===null)return!0;var F=di.call(E,"constructor")&&E.constructor;return typeof F=="function"&&F instanceof F&&m1.call(F)==OR}var R$=Xb?Mi(Xb):Mn;function bFe(y){return eJ(y)&&y>=-I&&y<=I}var nJ=tA?Mi(tA):M;function sM(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 Sx=Qc?Mi(Qc):B;function xFe(y){return y===e}function wFe(y){return po(y)&&Hl(y)==_e}function SFe(y){return po(y)&&cl(y)==he}var EFe=XO(Re),kFe=XO(function(y,E){return y<=E});function iJ(y){if(!y)return[];if(sc(y))return sM(y)?Du(y):oc(y);if(h1&&y[h1])return yR(y[h1]());var E=Hl(y),F=E==$?FE:E==ie?Lg:Ex;return F(y)}function dA(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=dA(y),F=E%1;return E===E?F?E-F:E:0}function aJ(y){return y?oA(Xr(y),0,_):0}function id(y){if(typeof y=="number")return y;if(Kc(y))return L;if(Ga(y)){var E=typeof y.valueOf=="function"?y.valueOf():y;y=Ga(E)?E+"":E}if(typeof y!="string")return y===0?y:+y;y=Ps(y);var F=oa.test(y);return F||Ul.test(y)?sa(y.slice(2),F?2:8):Fs.test(y)?L:+y}function oJ(y){return Om(y,lc(y))}function CFe(y){return y?oA(Xr(y),-I,I):y===0?y:0}function vi(y){return y==null?"":Xc(y)}var DFe=bx(function(y,E){if(VE(E)||sc(E)){Om(E,Bs(E),y);return}for(var F in E)di.call(E,F)&&w1(y,F,E[F])}),sJ=bx(function(y,E){Om(E,lc(E),y)}),lM=bx(function(y,E,F,Z){Om(E,lc(E),y,Z)}),OFe=bx(function(y,E,F,Z){Om(E,Bs(E),y,Z)}),MFe=uA(vx);function jFe(y,E){var F=Vg(y);return E==null?F:BE(F,E)}var NFe=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,k$(y),F),Z&&(F=Ou(F,u|c|f,zje));for(var le=E.length;le--;)g$(F,E[le]);return F});function YFe(y,E){return uJ(y,aM(gr(E)))}var ZFe=uA(function(y,E){return y==null?{}:Sje(y,E)});function uJ(y,E){if(y==null)return{};var F=si(k$(y),function(Z){return[Z]});return E=gr(E),eK(y,F,function(Z,le){return E(Z,le[0])})}function XFe(y,E,F){E=Qg(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=jO();return Va(y+le*(E-y+sn("1e-"+((le+"").length-1))),E)}return m$(y,E)}var l3e=xx(function(y,E,F){return E=E.toLowerCase(),y+(F?dJ(E):E)});function dJ(y){return L$(vi(y).toLowerCase())}function pJ(y){return y=vi(y),y&&y.replace(Cg,vO).replace(eA,"")}function u3e(y,E,F){y=vi(y),E=Xc(E);var Z=y.length;F=F===e?Z:oA(Xr(F),0,Z);var le=F;return F-=E.length,F>=0&&y.slice(F,le)==E}function c3e(y){return y=vi(y),y&&ht.test(y)?y.replace(De,hR):y}function f3e(y){return y=vi(y),y&&Pa.test(y)?y.replace(Yi,"\\$&"):y}var d3e=xx(function(y,E,F){return y+(F?"-":"")+E.toLowerCase()}),p3e=xx(function(y,E,F){return y+(F?" ":"")+E.toLowerCase()}),m3e=AK("toLowerCase");function h3e(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 ZO(A1(le),F)+y+ZO(ux(le),F)}function A3e(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&&!R$(E))&&(E=Xc(E),!E&&Xf(y))?Yg(Du(y),0,F):y.split(E,F)):[]}var S3e=xx(function(y,E,F){return y+(F?" ":"")+L$(E)});function E3e(y,E,F){return y=vi(y),F=F==null?0:oA(Xr(F),0,y.length),E=Xc(E),y.slice(F,F+E.length)==E}function k3e(y,E,F){var Z=pe.templateSettings;F&&ju(y,E,F)&&(E=e),y=vi(y),E=lM({},E,Z,SK);var le=lM({},E.imports,Z.imports,SK),be=Bs(le),Fe=Is(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"),nr="//# sourceURL="+(di.call(E,"sourceURL")?(E.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++se+"]")+` `;y.replace(Pt,function(Er,gn,In,Jc,Nu,ef){return In||(In=Jc),At+=y.slice(st,ef).replace(Dg,AR),gn&&($e=!0,At+=`' + __e(`+gn+`) + '`),Nu&&(We=!0,At+=`'; @@ -25,65 +25,65 @@ __p += '`),In&&(At+=`' + function print() { __p += __j.call(arguments, '') } `:`; `)+At+`return __p -}`;var nn=pJ(function(){return Kn(be,nr+"return "+At).apply(e,Fe)});if(nn.source=At,B$(nn))throw nn;return nn}function C3e(y){return vi(y).toLowerCase()}function D3e(y){return vi(y).toUpperCase()}function O3e(y,E,F){if(y=vi(y),y&&(F||E===e))return Ps(y);if(!y||!(E=Xc(E)))return y;var Z=Du(y),le=Du(E),be=On(Z,le),Fe=tx(Z,le)+1;return Yg(Z,be,Fe).join("")}function M3e(y,E,F){if(y=vi(y),y&&(F||E===e))return y.slice(0,rx(y)+1);if(!y||!(E=Xc(E)))return y;var Z=Du(y),le=tx(Z,Du(E))+1;return Yg(Z,0,le).join("")}function j3e(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 Yg(Z,le).join("")}function N3e(y,E){var F=j,Z=O;if(Ga(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-wm(Z);if($e<1)return Z;var We=Fe?Yg(Fe,0,$e).join(""):y.slice(0,$e);if(le===e)return We+Z;if(Fe&&($e+=We.length-$e),R$(le)){if(y.slice($e).search(le)){var st,lt=We;for(le.global||(le=cp(le.source,vi(as.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 T3e(y){return y=vi(y),y&&at.test(y)?y.replace(Pe,wR):y}var F3e=xx(function(y,E,F){return y+(F?" ":"")+E.toUpperCase()}),L$=mK("toUpperCase");function dJ(y,E,F){return y=vi(y),E=F?e:E,E===e?vR(y)?kR(y):Jb(y):y.match(E)||[]}var pJ=un(function(y,E){try{return zo(y,e,E)}catch(F){return B$(F)?F:new Fr(F)}}),_3e=uA(function(y,E){return Ba(E,function(F){F=Mm(F),mp(y,F,P$(y[F],y))}),y});function P3e(y){var E=y==null?0:y.length,F=gr();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=Va(y,_);E=gr(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__,nr=!!this.__actions__.length,Sr=be&&!Pt,nn=We&&!nr;if(!be&<){Fe=nn?Fe:new rn(this);var Er=y.apply(Fe,$e);return Er.__actions__.push({func:tM,args:[At],thisArg:e}),new ic(Er,Pt)}return Sr&&nn?y.apply(this,$e):(Er=this.thru(At),Sr?Z?Er.value()[0]:Er.value():Er)})}),Ba(["pop","push","shift","sort","splice","unshift"],function(y){var E=p1[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(Hg,Z)||(Hg[Z]=[]),Hg[Z].push({name:E,func:F})}}),Hg[QO(e,m).name]=[{name:"wrapper",func:e}],rn.prototype.clone=qR,rn.prototype.reverse=LR,rn.prototype.value=zR,pe.prototype.at=uTe,pe.prototype.chain=cTe,pe.prototype.commit=fTe,pe.prototype.next=dTe,pe.prototype.plant=mTe,pe.prototype.reverse=hTe,pe.prototype.toJSON=pe.prototype.valueOf=pe.prototype.value=ATe,pe.prototype.first=pe.prototype.head,h1&&(pe.prototype[h1]=pTe),pe},Sm=CR();typeof define=="function"&&typeof define.amd=="object"&&define.amd?(co._=Sm,define(function(){return Sm})):Yf?((Yf.exports=Sm)._=Sm,Bg._=Sm):co._=Sm}).call(Wx)});var Sre=vn(Tn=>{"use strict";var Ik=Symbol.for("react.element"),kIe=Symbol.for("react.portal"),CIe=Symbol.for("react.fragment"),DIe=Symbol.for("react.strict_mode"),OIe=Symbol.for("react.profiler"),MIe=Symbol.for("react.provider"),jIe=Symbol.for("react.context"),NIe=Symbol.for("react.forward_ref"),TIe=Symbol.for("react.suspense"),FIe=Symbol.for("react.memo"),_Ie=Symbol.for("react.lazy"),pre=Symbol.iterator;function PIe(e){return e===null||typeof e!="object"?null:(e=pre&&e[pre]||e["@@iterator"],typeof e=="function"?e:null)}var Are={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},gre=Object.assign,vre={};function ow(e,t,r){this.props=e,this.context=t,this.refs=vre,this.updater=r||Are}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 yre(){}yre.prototype=ow.prototype;function pL(e,t,r){this.props=e,this.context=t,this.refs=vre,this.updater=r||Are}var mL=pL.prototype=new yre;mL.constructor=pL;gre(mL,ow.prototype);mL.isPureReactComponent=!0;var mre=Array.isArray,bre=Object.prototype.hasOwnProperty,hL={current:null},xre={key:!0,ref:!0,__self:!0,__source:!0};function wre(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)bre.call(t,n)&&!xre.hasOwnProperty(n)&&(i[n]=t[n]);var s=arguments.length-2;if(s===1)i.children=r;else if(1{"use strict";Ere.exports=Sre()});var _re=vn(da=>{"use strict";function bL(e,t){var r=e.length;e.push(t);e:for(;0>>1,i=e[n];if(0>>1;ncj(s,r))lcj(u,s)?(e[n]=u,e[l]=r,n=l):(e[n]=s,e[o]=r,n=o);else if(lcj(u,r))e[n]=u,e[l]=r,n=l;else break e}}return t}function cj(e,t){var r=e.sortIndex-t.sortIndex;return r!==0?r:e.id-t.id}typeof performance=="object"&&typeof performance.now=="function"?(kre=performance,da.unstable_now=function(){return kre.now()}):(gL=Date,Cre=gL.now(),da.unstable_now=function(){return gL.now()-Cre});var kre,gL,Cre,Bm=[],A0=[],qIe=1,Ad=null,Kl=3,pj=!1,Y1=!1,Rk=!1,Mre=typeof setTimeout=="function"?setTimeout:null,jre=typeof clearTimeout=="function"?clearTimeout:null,Dre=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function xL(e){for(var t=kp(A0);t!==null;){if(t.callback===null)dj(A0);else if(t.startTime<=e)dj(A0),t.sortIndex=t.expirationTime,bL(Bm,t);else break;t=kp(A0)}}function wL(e){if(Rk=!1,xL(e),!Y1)if(kp(Bm)!==null)Y1=!0,EL(SL);else{var t=kp(A0);t!==null&&kL(wL,t.startTime-e)}}function SL(e,t){Y1=!1,Rk&&(Rk=!1,jre($k),$k=-1),pj=!0;var r=Kl;try{for(xL(t),Ad=kp(Bm);Ad!==null&&(!(Ad.expirationTime>t)||e&&!Fre());){var n=Ad.callback;if(typeof n=="function"){Ad.callback=null,Kl=Ad.priorityLevel;var i=n(Ad.expirationTime<=t);t=da.unstable_now(),typeof i=="function"?Ad.callback=i:Ad===kp(Bm)&&dj(Bm),xL(t)}else dj(Bm);Ad=kp(Bm)}if(Ad!==null)var a=!0;else{var o=kp(A0);o!==null&&kL(wL,o.startTime-t),a=!1}return a}finally{Ad=null,Kl=r,pj=!1}}var mj=!1,fj=null,$k=-1,Nre=5,Tre=-1;function Fre(){return!(da.unstable_now()-Tree||125n?(e.sortIndex=r,bL(A0,e),kp(Bm)===null&&e===kp(A0)&&(Rk?(jre($k),$k=-1):Rk=!0,kL(wL,r-n))):(e.sortIndex=i,bL(Bm,e),Y1||pj||(Y1=!0,EL(SL))),e};da.unstable_shouldYield=Fre;da.unstable_wrapCallback=function(e){var t=Kl;return function(){var r=Kl;Kl=t;try{return e.apply(this,arguments)}finally{Kl=r}}}});var Ire=vn((Qmt,Pre)=>{"use strict";Pre.exports=_re()});var zae=vn(hf=>{"use strict";var Une=Te(),pf=Ire();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"),QL=Object.prototype.hasOwnProperty,LIe=/^[: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]*$/,Bre={},Rre={};function zIe(e){return QL.call(Rre,e)?!0:QL.call(Bre,e)?!1:LIe.test(e)?Rre[e]=!0:(Bre[e]=!0,!1)}function UIe(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 WIe(e,t,r,n){if(t===null||typeof t>"u"||UIe(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 $u(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 $u(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 $u(t,1,!1,e[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(e){yl[e]=new $u(e,2,!1,e.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){yl[e]=new $u(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 $u(e,3,!1,e.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(e){yl[e]=new $u(e,3,!0,e,null,!1,!1)});["capture","download"].forEach(function(e){yl[e]=new $u(e,4,!1,e,null,!1,!1)});["cols","rows","size","span"].forEach(function(e){yl[e]=new $u(e,6,!1,e,null,!1,!1)});["rowSpan","start"].forEach(function(e){yl[e]=new $u(e,5,!1,e.toLowerCase(),null,!1,!1)});var qz=/[\-:]([a-z])/g;function Lz(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(qz,Lz);yl[t]=new $u(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(qz,Lz);yl[t]=new $u(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(qz,Lz);yl[t]=new $u(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(e){yl[e]=new $u(e,1,!1,e.toLowerCase(),null,!1,!1)});yl.xlinkHref=new $u("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(e){yl[e]=new $u(e,1,!1,e.toLowerCase(),null,!0,!0)});function zz(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?Yg(Fe,0,$e).join(""):y.slice(0,$e);if(le===e)return We+Z;if(Fe&&($e+=We.length-$e),R$(le)){if(y.slice($e).search(le)){var st,lt=We;for(le.global||(le=cp(le.source,vi(as.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 T3e(y){return y=vi(y),y&&at.test(y)?y.replace(Pe,wR):y}var F3e=xx(function(y,E,F){return y+(F?" ":"")+E.toUpperCase()}),L$=AK("toUpperCase");function mJ(y,E,F){return y=vi(y),E=F?e:E,E===e?vR(y)?kR(y):Jb(y):y.match(E)||[]}var hJ=un(function(y,E){try{return zo(y,e,E)}catch(F){return B$(F)?F:new Fr(F)}}),_3e=uA(function(y,E){return Ba(E,function(F){F=Mm(F),mp(y,F,P$(y[F],y))}),y});function P3e(y){var E=y==null?0:y.length,F=gr();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=Va(y,_);E=gr(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__,nr=!!this.__actions__.length,Sr=be&&!Pt,nn=We&&!nr;if(!be&<){Fe=nn?Fe:new rn(this);var Er=y.apply(Fe,$e);return Er.__actions__.push({func:tM,args:[At],thisArg:e}),new ic(Er,Pt)}return Sr&&nn?y.apply(this,$e):(Er=this.thru(At),Sr?Z?Er.value()[0]:Er.value():Er)})}),Ba(["pop","push","shift","sort","splice","unshift"],function(y){var E=p1[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(Hg,Z)||(Hg[Z]=[]),Hg[Z].push({name:E,func:F})}}),Hg[QO(e,m).name]=[{name:"wrapper",func:e}],rn.prototype.clone=qR,rn.prototype.reverse=LR,rn.prototype.value=zR,pe.prototype.at=uTe,pe.prototype.chain=cTe,pe.prototype.commit=fTe,pe.prototype.next=dTe,pe.prototype.plant=mTe,pe.prototype.reverse=hTe,pe.prototype.toJSON=pe.prototype.valueOf=pe.prototype.value=ATe,pe.prototype.first=pe.prototype.head,h1&&(pe.prototype[h1]=pTe),pe},Sm=CR();typeof define=="function"&&typeof define.amd=="object"&&define.amd?(co._=Sm,define(function(){return Sm})):Yf?((Yf.exports=Sm)._=Sm,Bg._=Sm):co._=Sm}).call(Wx)});var kre=vn(Tn=>{"use strict";var Ik=Symbol.for("react.element"),kIe=Symbol.for("react.portal"),CIe=Symbol.for("react.fragment"),DIe=Symbol.for("react.strict_mode"),OIe=Symbol.for("react.profiler"),MIe=Symbol.for("react.provider"),jIe=Symbol.for("react.context"),NIe=Symbol.for("react.forward_ref"),TIe=Symbol.for("react.suspense"),FIe=Symbol.for("react.memo"),_Ie=Symbol.for("react.lazy"),hre=Symbol.iterator;function PIe(e){return e===null||typeof e!="object"?null:(e=hre&&e[hre]||e["@@iterator"],typeof e=="function"?e:null)}var vre={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},yre=Object.assign,bre={};function ow(e,t,r){this.props=e,this.context=t,this.refs=bre,this.updater=r||vre}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 xre(){}xre.prototype=ow.prototype;function pL(e,t,r){this.props=e,this.context=t,this.refs=bre,this.updater=r||vre}var mL=pL.prototype=new xre;mL.constructor=pL;yre(mL,ow.prototype);mL.isPureReactComponent=!0;var Are=Array.isArray,wre=Object.prototype.hasOwnProperty,hL={current:null},Sre={key:!0,ref:!0,__self:!0,__source:!0};function Ere(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)wre.call(t,n)&&!Sre.hasOwnProperty(n)&&(i[n]=t[n]);var s=arguments.length-2;if(s===1)i.children=r;else if(1{"use strict";Cre.exports=kre()});var Ire=vn(da=>{"use strict";function bL(e,t){var r=e.length;e.push(t);e:for(;0>>1,i=e[n];if(0>>1;ncj(s,r))lcj(u,s)?(e[n]=u,e[l]=r,n=l):(e[n]=s,e[o]=r,n=o);else if(lcj(u,r))e[n]=u,e[l]=r,n=l;else break e}}return t}function cj(e,t){var r=e.sortIndex-t.sortIndex;return r!==0?r:e.id-t.id}typeof performance=="object"&&typeof performance.now=="function"?(Dre=performance,da.unstable_now=function(){return Dre.now()}):(gL=Date,Ore=gL.now(),da.unstable_now=function(){return gL.now()-Ore});var Dre,gL,Ore,Bm=[],A0=[],qIe=1,Ad=null,Kl=3,pj=!1,Y1=!1,Rk=!1,Nre=typeof setTimeout=="function"?setTimeout:null,Tre=typeof clearTimeout=="function"?clearTimeout:null,Mre=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function xL(e){for(var t=kp(A0);t!==null;){if(t.callback===null)dj(A0);else if(t.startTime<=e)dj(A0),t.sortIndex=t.expirationTime,bL(Bm,t);else break;t=kp(A0)}}function wL(e){if(Rk=!1,xL(e),!Y1)if(kp(Bm)!==null)Y1=!0,EL(SL);else{var t=kp(A0);t!==null&&kL(wL,t.startTime-e)}}function SL(e,t){Y1=!1,Rk&&(Rk=!1,Tre($k),$k=-1),pj=!0;var r=Kl;try{for(xL(t),Ad=kp(Bm);Ad!==null&&(!(Ad.expirationTime>t)||e&&!Pre());){var n=Ad.callback;if(typeof n=="function"){Ad.callback=null,Kl=Ad.priorityLevel;var i=n(Ad.expirationTime<=t);t=da.unstable_now(),typeof i=="function"?Ad.callback=i:Ad===kp(Bm)&&dj(Bm),xL(t)}else dj(Bm);Ad=kp(Bm)}if(Ad!==null)var a=!0;else{var o=kp(A0);o!==null&&kL(wL,o.startTime-t),a=!1}return a}finally{Ad=null,Kl=r,pj=!1}}var mj=!1,fj=null,$k=-1,Fre=5,_re=-1;function Pre(){return!(da.unstable_now()-_ree||125n?(e.sortIndex=r,bL(A0,e),kp(Bm)===null&&e===kp(A0)&&(Rk?(Tre($k),$k=-1):Rk=!0,kL(wL,r-n))):(e.sortIndex=i,bL(Bm,e),Y1||pj||(Y1=!0,EL(SL))),e};da.unstable_shouldYield=Pre;da.unstable_wrapCallback=function(e){var t=Kl;return function(){var r=Kl;Kl=t;try{return e.apply(this,arguments)}finally{Kl=r}}}});var Rre=vn((Zmt,Bre)=>{"use strict";Bre.exports=Ire()});var Wae=vn(hf=>{"use strict";var Hne=Te(),pf=Rre();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"),QL=Object.prototype.hasOwnProperty,LIe=/^[: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]*$/,$re={},qre={};function zIe(e){return QL.call(qre,e)?!0:QL.call($re,e)?!1:LIe.test(e)?qre[e]=!0:($re[e]=!0,!1)}function UIe(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 WIe(e,t,r,n){if(t===null||typeof t>"u"||UIe(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 $u(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 $u(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 $u(t,1,!1,e[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(e){yl[e]=new $u(e,2,!1,e.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){yl[e]=new $u(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 $u(e,3,!1,e.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(e){yl[e]=new $u(e,3,!0,e,null,!1,!1)});["capture","download"].forEach(function(e){yl[e]=new $u(e,4,!1,e,null,!1,!1)});["cols","rows","size","span"].forEach(function(e){yl[e]=new $u(e,6,!1,e,null,!1,!1)});["rowSpan","start"].forEach(function(e){yl[e]=new $u(e,5,!1,e.toLowerCase(),null,!1,!1)});var qz=/[\-:]([a-z])/g;function Lz(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(qz,Lz);yl[t]=new $u(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(qz,Lz);yl[t]=new $u(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(qz,Lz);yl[t]=new $u(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(e){yl[e]=new $u(e,1,!1,e.toLowerCase(),null,!1,!1)});yl.xlinkHref=new $u("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(e){yl[e]=new $u(e,1,!1,e.toLowerCase(),null,!0,!0)});function zz(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{DL=!1,Error.prepareStackTrace=r}return(e=e?e.displayName||e.name:"")?Qk(e):""}function HIe(e){switch(e.tag){case 5:return Qk(e.type);case 16:return Qk("Lazy");case 13:return Qk("Suspense");case 19:return Qk("SuspenseList");case 0:case 2:case 15:return e=OL(e.type,!1),e;case 11:return e=OL(e.type.render,!1),e;case 1:return e=OL(e.type,!0),e;default:return""}}function KL(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 YL:return"Profiler";case Uz:return"StrictMode";case ZL:return"Suspense";case XL:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case Vne:return(e.displayName||"Context")+".Consumer";case Hne:return(e._context.displayName||"Context")+".Provider";case Wz:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case Hz:return t=e.displayName||null,t!==null?t:KL(e.type)||"Memo";case v0:t=e._payload,e=e._init;try{return KL(e(t))}catch{}}return null}function VIe(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 KL(t);case 8:return t===Uz?"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 T0(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function Qne(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function GIe(e){var t=Qne(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 Aj(e){e._valueTracker||(e._valueTracker=GIe(e))}function Yne(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var r=t.getValue(),n="";return e&&(n=Qne(e)?e.checked?"true":"false":e.value),e=n,e!==r?(t.setValue(e),!0):!1}function Wj(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 JL(e,t){var r=t.checked;return Ja({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:r??e._wrapperState.initialChecked})}function qre(e,t){var r=t.defaultValue==null?"":t.defaultValue,n=t.checked!=null?t.checked:t.defaultChecked;r=T0(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 Zne(e,t){t=t.checked,t!=null&&zz(e,"checked",t,!1)}function ez(e,t){Zne(e,t);var r=T0(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")?tz(e,t.type,r):t.hasOwnProperty("defaultValue")&&tz(e,t.type,T0(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function Lre(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 tz(e,t,r){(t!=="number"||Wj(e.ownerDocument)!==e)&&(r==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+r&&(e.defaultValue=""+r))}var Yk=Array.isArray;function xw(e,t,r,n){if(e=e.options,t){t={};for(var i=0;i"+t.valueOf().toString()+"",t=gj.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function l6(e,t){if(t){var r=e.firstChild;if(r&&r===e.lastChild&&r.nodeType===3){r.nodeValue=t;return}}e.textContent=t}var Kk={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},QIe=["Webkit","ms","Moz","O"];Object.keys(Kk).forEach(function(e){QIe.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),Kk[t]=Kk[e]})});function eie(e,t,r){return t==null||typeof t=="boolean"||t===""?"":r||typeof t!="number"||t===0||Kk.hasOwnProperty(e)&&Kk[e]?(""+t).trim():t+"px"}function tie(e,t){e=e.style;for(var r in t)if(t.hasOwnProperty(r)){var n=r.indexOf("--")===0,i=eie(r,t[r],n);r==="float"&&(r="cssFloat"),n?e.setProperty(r,i):e[r]=i}}var YIe=Ja({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 iz(e,t){if(t){if(YIe[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 az(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 oz=null;function Vz(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var sz=null,ww=null,Sw=null;function Wre(e){if(e=C6(e)){if(typeof sz!="function")throw Error(xt(280));var t=e.stateNode;t&&(t=vN(t),sz(e.stateNode,e.type,t))}}function rie(e){ww?Sw?Sw.push(e):Sw=[e]:ww=e}function nie(){if(ww){var e=ww,t=Sw;if(Sw=ww=null,Wre(e),t)for(e=0;e>>=0,e===0?32:31-(oBe(e)/sBe|0)|0}var vj=64,yj=4194304;function Zk(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 Qj(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=Zk(s):(a&=o,a!==0&&(n=Zk(a)))}else o=r&~i,o!==0?n=Zk(o):a!==0&&(n=Zk(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 E6(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 fBe(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=e6),Jre=String.fromCharCode(32),ene=!1;function Sie(e,t){switch(e){case"keyup":return $Be.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Eie(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var fw=!1;function LBe(e,t){switch(e){case"compositionend":return Eie(t);case"keypress":return t.which!==32?null:(ene=!0,Jre);case"textInput":return e=t.data,e===Jre&&ene?null:e;default:return null}}function zBe(e,t){if(fw)return e==="compositionend"||!eU&&Sie(e,t)?(e=xie(),Pj=Xz=w0=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=nne(r)}}function Oie(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Oie(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Mie(){for(var e=window,t=Wj();t instanceof e.HTMLIFrameElement;){try{var r=typeof t.contentWindow.location.href=="string"}catch{r=!1}if(r)e=t.contentWindow;else break;t=Wj(e.document)}return t}function tU(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 XBe(e){var t=Mie(),r=e.focusedElem,n=e.selectionRange;if(t!==r&&r&&r.ownerDocument&&Oie(r.ownerDocument.documentElement,r)){if(n!==null&&tU(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=ine(r,a);var o=ine(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,pz=null,r6=null,mz=!1;function ane(e,t,r){var n=r.window===r?r.document:r.nodeType===9?r:r.ownerDocument;mz||dw==null||dw!==Wj(n)||(n=dw,"selectionStart"in n&&tU(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}),r6&&m6(r6,n)||(r6=n,n=Xj(pz,"onSelect"),0hw||(e.current=bz[hw],bz[hw]=null,hw--)}function pa(e,t){hw++,bz[hw]=e.current,e.current=t}var F0={},ru=P0(F0),gc=P0(!1),ny=F0;function Ow(e,t){var r=e.type.contextTypes;if(!r)return F0;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 Jj(){Ca(gc),Ca(ru)}function mne(e,t,r){if(ru.current!==F0)throw Error(xt(168));pa(ru,t),pa(gc,r)}function Rie(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,VIe(e)||"Unknown",i));return Ja({},r,n)}function eN(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||F0,ny=ru.current,pa(ru,e),pa(gc,gc.current),!0}function hne(e,t,r){var n=e.stateNode;if(!n)throw Error(xt(169));r?(e=Rie(e,t,ny),n.__reactInternalMemoizedMergedChildContext=e,Ca(gc),Ca(ru),pa(ru,e)):Ca(gc),pa(gc,r)}var MA=null,yN=!1,$L=!1;function $ie(e){MA===null?MA=[e]:MA.push(e)}function s5e(e){yN=!0,$ie(e)}function I0(){if(!$L&&MA!==null){$L=!0;var e=0,t=Ti;try{var r=MA;for(Ti=1;e>=o,i-=o,jA=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&&Z1(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&&Z1(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&&Z1(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&&Z1(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 hj: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===v0&&wne(w)===S.type){r(A,S.sibling),b=i(S,v.props),b.ref=Wk(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=ry(v.props.children,A.mode,x,v.key),b.return=A,A=b):(x=Uj(v.type,v.key,v.props,null,A.mode,x),x.ref=Wk(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=GL(v,A.mode,x),b.return=A,A=b}return o(A);case v0:return S=v._init,g(A,b,S(v._payload),x)}if(Yk(v))return h(A,b,v,x);if(qk(v))return m(A,b,v,x);jj(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=VL(v,A.mode,x),b.return=A,A=b),o(A)):r(A,b)}return g}var jw=Gie(!0),Qie=Gie(!1),D6={},zm=P0(D6),v6=P0(D6),y6=P0(D6);function ey(e){if(e===D6)throw Error(xt(174));return e}function cU(e,t){switch(pa(y6,t),pa(v6,e),pa(zm,D6),e=t.nodeType,e){case 9:case 11:t=(t=t.documentElement)?t.namespaceURI:nz(null,"");break;default:e=e===8?t.parentNode:t,t=e.namespaceURI||null,e=e.tagName,t=nz(t,e)}Ca(zm),pa(zm,t)}function Nw(){Ca(zm),Ca(v6),Ca(y6)}function Yie(e){ey(y6.current);var t=ey(zm.current),r=nz(t,e.type);t!==r&&(pa(v6,e),pa(zm,r))}function fU(e){v6.current===e&&(Ca(zm),Ca(v6))}var Xa=P0(0);function oN(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 qL=[];function dU(){for(var e=0;er?r:4,e(!0);var n=LL.transition;LL.transition={};try{e(!1),t()}finally{Ti=r,LL.transition=n}}function fae(){return wd().memoizedState}function f5e(e,t,r){var n=j0(e);if(r={lane:n,action:r,hasEagerState:!1,eagerState:null,next:null},dae(e))pae(t,r);else if(r=Uie(e,t,r,n),r!==null){var i=Ru();Np(r,e,n,i),mae(r,t,n)}}function d5e(e,t,r){var n=j0(e),i={lane:n,action:r,hasEagerState:!1,eagerState:null,next:null};if(dae(e))pae(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,lU(t)):(i.next=l.next,l.next=i),t.interleaved=i;return}}catch{}finally{}r=Uie(e,t,i,n),r!==null&&(i=Ru(),Np(r,e,n,i),mae(r,t,n))}}function dae(e){var t=e.alternate;return e===Ka||t!==null&&t===Ka}function pae(e,t){n6=sN=!0;var r=e.pending;r===null?t.next=t:(t.next=r.next,r.next=t),e.pending=t}function mae(e,t,r){if((r&4194240)!==0){var n=t.lanes;n&=e.pendingLanes,r|=n,t.lanes=r,Qz(e,r)}}var lN={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},p5e={readContext:xd,useCallback:function(e,t){return $m().memoizedState=[e,t===void 0?null:t],e},useContext:xd,useEffect:Ene,useImperativeHandle:function(e,t,r){return r=r!=null?r.concat([e]):null,$j(4194308,4,oae.bind(null,t,e),r)},useLayoutEffect:function(e,t){return $j(4194308,4,e,t)},useInsertionEffect:function(e,t){return $j(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=f5e.bind(null,Ka,e),[n.memoizedState,e]},useRef:function(e){var t=$m();return e={current:e},t.memoizedState=e},useState:Sne,useDebugValue:gU,useDeferredValue:function(e){return $m().memoizedState=e},useTransition:function(){var e=Sne(!1),t=e[0];return e=c5e.bind(null,e[1]),$m().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,r){var n=Ka,i=$m();if($a){if(r===void 0)throw Error(xt(407));r=r()}else{if(r=t(),zs===null)throw Error(xt(349));(ay&30)!==0||Kie(n,t,r)}i.memoizedState=r;var a={value:r,getSnapshot:t};return i.queue=a,Ene(eae.bind(null,n,a,e),[e]),n.flags|=2048,w6(9,Jie.bind(null,n,a,r,t),void 0,null),r},useId:function(){var e=$m(),t=zs.identifierPrefix;if($a){var r=NA,n=jA;r=(n&~(1<<32-jp(n)-1)).toString(32)+r,t=":"+t+"R"+r,r=b6++,0")&&(l=l.replace("",e.displayName)),l}while(1<=o&&0<=s);break}}}finally{DL=!1,Error.prepareStackTrace=r}return(e=e?e.displayName||e.name:"")?Qk(e):""}function HIe(e){switch(e.tag){case 5:return Qk(e.type);case 16:return Qk("Lazy");case 13:return Qk("Suspense");case 19:return Qk("SuspenseList");case 0:case 2:case 15:return e=OL(e.type,!1),e;case 11:return e=OL(e.type.render,!1),e;case 1:return e=OL(e.type,!0),e;default:return""}}function KL(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 YL:return"Profiler";case Uz:return"StrictMode";case ZL:return"Suspense";case XL:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case Qne:return(e.displayName||"Context")+".Consumer";case Gne:return(e._context.displayName||"Context")+".Provider";case Wz:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case Hz:return t=e.displayName||null,t!==null?t:KL(e.type)||"Memo";case v0:t=e._payload,e=e._init;try{return KL(e(t))}catch{}}return null}function VIe(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 KL(t);case 8:return t===Uz?"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 T0(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function Zne(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function GIe(e){var t=Zne(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 Aj(e){e._valueTracker||(e._valueTracker=GIe(e))}function Xne(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var r=t.getValue(),n="";return e&&(n=Zne(e)?e.checked?"true":"false":e.value),e=n,e!==r?(t.setValue(e),!0):!1}function Wj(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 JL(e,t){var r=t.checked;return Ja({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:r??e._wrapperState.initialChecked})}function zre(e,t){var r=t.defaultValue==null?"":t.defaultValue,n=t.checked!=null?t.checked:t.defaultChecked;r=T0(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 Kne(e,t){t=t.checked,t!=null&&zz(e,"checked",t,!1)}function ez(e,t){Kne(e,t);var r=T0(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")?tz(e,t.type,r):t.hasOwnProperty("defaultValue")&&tz(e,t.type,T0(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function Ure(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 tz(e,t,r){(t!=="number"||Wj(e.ownerDocument)!==e)&&(r==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+r&&(e.defaultValue=""+r))}var Yk=Array.isArray;function xw(e,t,r,n){if(e=e.options,t){t={};for(var i=0;i"+t.valueOf().toString()+"",t=gj.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function l6(e,t){if(t){var r=e.firstChild;if(r&&r===e.lastChild&&r.nodeType===3){r.nodeValue=t;return}}e.textContent=t}var Kk={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},QIe=["Webkit","ms","Moz","O"];Object.keys(Kk).forEach(function(e){QIe.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),Kk[t]=Kk[e]})});function rie(e,t,r){return t==null||typeof t=="boolean"||t===""?"":r||typeof t!="number"||t===0||Kk.hasOwnProperty(e)&&Kk[e]?(""+t).trim():t+"px"}function nie(e,t){e=e.style;for(var r in t)if(t.hasOwnProperty(r)){var n=r.indexOf("--")===0,i=rie(r,t[r],n);r==="float"&&(r="cssFloat"),n?e.setProperty(r,i):e[r]=i}}var YIe=Ja({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 iz(e,t){if(t){if(YIe[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 az(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 oz=null;function Vz(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var sz=null,ww=null,Sw=null;function Vre(e){if(e=C6(e)){if(typeof sz!="function")throw Error(xt(280));var t=e.stateNode;t&&(t=vN(t),sz(e.stateNode,e.type,t))}}function iie(e){ww?Sw?Sw.push(e):Sw=[e]:ww=e}function aie(){if(ww){var e=ww,t=Sw;if(Sw=ww=null,Vre(e),t)for(e=0;e>>=0,e===0?32:31-(oBe(e)/sBe|0)|0}var vj=64,yj=4194304;function Zk(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 Qj(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=Zk(s):(a&=o,a!==0&&(n=Zk(a)))}else o=r&~i,o!==0?n=Zk(o):a!==0&&(n=Zk(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 E6(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 fBe(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=e6),tne=String.fromCharCode(32),rne=!1;function kie(e,t){switch(e){case"keyup":return $Be.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Cie(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var fw=!1;function LBe(e,t){switch(e){case"compositionend":return Cie(t);case"keypress":return t.which!==32?null:(rne=!0,tne);case"textInput":return e=t.data,e===tne&&rne?null:e;default:return null}}function zBe(e,t){if(fw)return e==="compositionend"||!eU&&kie(e,t)?(e=Sie(),Pj=Xz=w0=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=ane(r)}}function jie(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?jie(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Nie(){for(var e=window,t=Wj();t instanceof e.HTMLIFrameElement;){try{var r=typeof t.contentWindow.location.href=="string"}catch{r=!1}if(r)e=t.contentWindow;else break;t=Wj(e.document)}return t}function tU(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 XBe(e){var t=Nie(),r=e.focusedElem,n=e.selectionRange;if(t!==r&&r&&r.ownerDocument&&jie(r.ownerDocument.documentElement,r)){if(n!==null&&tU(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=one(r,a);var o=one(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,pz=null,r6=null,mz=!1;function sne(e,t,r){var n=r.window===r?r.document:r.nodeType===9?r:r.ownerDocument;mz||dw==null||dw!==Wj(n)||(n=dw,"selectionStart"in n&&tU(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}),r6&&m6(r6,n)||(r6=n,n=Xj(pz,"onSelect"),0hw||(e.current=bz[hw],bz[hw]=null,hw--)}function pa(e,t){hw++,bz[hw]=e.current,e.current=t}var F0={},ru=P0(F0),gc=P0(!1),ny=F0;function Ow(e,t){var r=e.type.contextTypes;if(!r)return F0;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 Jj(){Ca(gc),Ca(ru)}function Ane(e,t,r){if(ru.current!==F0)throw Error(xt(168));pa(ru,t),pa(gc,r)}function qie(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,VIe(e)||"Unknown",i));return Ja({},r,n)}function eN(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||F0,ny=ru.current,pa(ru,e),pa(gc,gc.current),!0}function gne(e,t,r){var n=e.stateNode;if(!n)throw Error(xt(169));r?(e=qie(e,t,ny),n.__reactInternalMemoizedMergedChildContext=e,Ca(gc),Ca(ru),pa(ru,e)):Ca(gc),pa(gc,r)}var MA=null,yN=!1,$L=!1;function Lie(e){MA===null?MA=[e]:MA.push(e)}function s5e(e){yN=!0,Lie(e)}function I0(){if(!$L&&MA!==null){$L=!0;var e=0,t=Ti;try{var r=MA;for(Ti=1;e>=o,i-=o,jA=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&&Z1(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&&Z1(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&&Z1(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&&Z1(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 hj: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===v0&&Ene(w)===S.type){r(A,S.sibling),b=i(S,v.props),b.ref=Wk(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=ry(v.props.children,A.mode,x,v.key),b.return=A,A=b):(x=Uj(v.type,v.key,v.props,null,A.mode,x),x.ref=Wk(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=GL(v,A.mode,x),b.return=A,A=b}return o(A);case v0:return S=v._init,g(A,b,S(v._payload),x)}if(Yk(v))return h(A,b,v,x);if(qk(v))return m(A,b,v,x);jj(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=VL(v,A.mode,x),b.return=A,A=b),o(A)):r(A,b)}return g}var jw=Yie(!0),Zie=Yie(!1),D6={},zm=P0(D6),v6=P0(D6),y6=P0(D6);function ey(e){if(e===D6)throw Error(xt(174));return e}function cU(e,t){switch(pa(y6,t),pa(v6,e),pa(zm,D6),e=t.nodeType,e){case 9:case 11:t=(t=t.documentElement)?t.namespaceURI:nz(null,"");break;default:e=e===8?t.parentNode:t,t=e.namespaceURI||null,e=e.tagName,t=nz(t,e)}Ca(zm),pa(zm,t)}function Nw(){Ca(zm),Ca(v6),Ca(y6)}function Xie(e){ey(y6.current);var t=ey(zm.current),r=nz(t,e.type);t!==r&&(pa(v6,e),pa(zm,r))}function fU(e){v6.current===e&&(Ca(zm),Ca(v6))}var Xa=P0(0);function oN(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 qL=[];function dU(){for(var e=0;er?r:4,e(!0);var n=LL.transition;LL.transition={};try{e(!1),t()}finally{Ti=r,LL.transition=n}}function pae(){return wd().memoizedState}function f5e(e,t,r){var n=j0(e);if(r={lane:n,action:r,hasEagerState:!1,eagerState:null,next:null},mae(e))hae(t,r);else if(r=Hie(e,t,r,n),r!==null){var i=Ru();Np(r,e,n,i),Aae(r,t,n)}}function d5e(e,t,r){var n=j0(e),i={lane:n,action:r,hasEagerState:!1,eagerState:null,next:null};if(mae(e))hae(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,lU(t)):(i.next=l.next,l.next=i),t.interleaved=i;return}}catch{}finally{}r=Hie(e,t,i,n),r!==null&&(i=Ru(),Np(r,e,n,i),Aae(r,t,n))}}function mae(e){var t=e.alternate;return e===Ka||t!==null&&t===Ka}function hae(e,t){n6=sN=!0;var r=e.pending;r===null?t.next=t:(t.next=r.next,r.next=t),e.pending=t}function Aae(e,t,r){if((r&4194240)!==0){var n=t.lanes;n&=e.pendingLanes,r|=n,t.lanes=r,Qz(e,r)}}var lN={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},p5e={readContext:xd,useCallback:function(e,t){return $m().memoizedState=[e,t===void 0?null:t],e},useContext:xd,useEffect:Cne,useImperativeHandle:function(e,t,r){return r=r!=null?r.concat([e]):null,$j(4194308,4,lae.bind(null,t,e),r)},useLayoutEffect:function(e,t){return $j(4194308,4,e,t)},useInsertionEffect:function(e,t){return $j(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=f5e.bind(null,Ka,e),[n.memoizedState,e]},useRef:function(e){var t=$m();return e={current:e},t.memoizedState=e},useState:kne,useDebugValue:gU,useDeferredValue:function(e){return $m().memoizedState=e},useTransition:function(){var e=kne(!1),t=e[0];return e=c5e.bind(null,e[1]),$m().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,r){var n=Ka,i=$m();if($a){if(r===void 0)throw Error(xt(407));r=r()}else{if(r=t(),zs===null)throw Error(xt(349));(ay&30)!==0||eae(n,t,r)}i.memoizedState=r;var a={value:r,getSnapshot:t};return i.queue=a,Cne(rae.bind(null,n,a,e),[e]),n.flags|=2048,w6(9,tae.bind(null,n,a,r,t),void 0,null),r},useId:function(){var e=$m(),t=zs.identifierPrefix;if($a){var r=NA,n=jA;r=(n&~(1<<32-jp(n)-1)).toString(32)+r,t=":"+t+"R"+r,r=b6++,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[g6]=n,Sae(e,t,!1,!1),t.stateNode=e;e:{switch(o=az(r,n),r){case"dialog":ka("cancel",e),ka("close",e),i=n;break;case"iframe":case"object":case"embed":ka("load",e),i=n;break;case"video":case"audio":for(i=0;iFw&&(t.flags|=128,n=!0,Hk(a,!1),t.lanes=4194304)}else{if(!n)if(e=oN(o),e!==null){if(t.flags|=128,n=!0,r=e.updateQueue,r!==null&&(t.updateQueue=r,t.flags|=4),Hk(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,Hk(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=Xa.current,pa(Xa,n?r&1|2:r&1),t):(eu(t),null);case 22:case 23:return SU(),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 x5e(e,t){switch(nU(t),t.tag){case 1:return vc(t.type)&&Jj(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Nw(),Ca(gc),Ca(ru),dU(),e=t.flags,(e&65536)!==0&&(e&128)===0?(t.flags=e&-65537|128,t):null;case 5:return fU(t),null;case 13:if(Ca(Xa),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 Ca(Xa),null;case 4:return Nw(),null;case 10:return sU(t.type._context),null;case 22:case 23:return SU(),null;case 24:return null;default:return null}}var Tj=!1,tu=!1,w5e=typeof WeakSet=="function"?WeakSet:Set,Vt=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 Tz(e,t,r){try{r()}catch(n){go(e,t,n)}}var Fne=!1;function S5e(e,t){if(hz=Yj,e=Mie(),tU(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(Az={focusedElem:e,selectionRange:r},Yj=!1,Vt=t;Vt!==null;)if(t=Vt,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,Vt=e;else for(;Vt!==null;){t=Vt;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,Vt=e;break}Vt=t.return}return h=Fne,Fne=!1,h}function i6(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&&Tz(t,r,a)}i=i.next}while(i!==n)}}function wN(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 Fz(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 Cae(e){var t=e.alternate;t!==null&&(e.alternate=null,Cae(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[qm],delete t[g6],delete t[yz],delete t[a5e],delete t[o5e])),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 Dae(e){return e.tag===5||e.tag===3||e.tag===4}function _ne(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||Dae(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 _z(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=Kj));else if(n!==4&&(e=e.child,e!==null))for(_z(e,t,r),e=e.sibling;e!==null;)_z(e,t,r),e=e.sibling}function Pz(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(Pz(e,t,r),e=e.sibling;e!==null;)Pz(e,t,r),e=e.sibling}var gl=null,Op=!1;function g0(e,t,r){for(r=r.child;r!==null;)Oae(e,t,r),r=r.sibling}function Oae(e,t,r){if(Lm&&typeof Lm.onCommitFiberUnmount=="function")try{Lm.onCommitFiberUnmount(mN,r)}catch{}switch(r.tag){case 5:tu||yw(r,t);case 6:var n=gl,i=Op;gl=null,g0(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?RL(e.parentNode,r):e.nodeType===1&&RL(e,r),d6(e)):RL(gl,r.stateNode));break;case 4:n=gl,i=Op,gl=r.stateNode.containerInfo,Op=!0,g0(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)&&Tz(r,t,o),i=i.next}while(i!==n)}g0(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)}g0(e,t,r);break;case 21:g0(e,t,r);break;case 22:r.mode&1?(tu=(n=tu)||r.memoizedState!==null,g0(e,t,r),tu=n):g0(e,t,r);break;default:g0(e,t,r)}}function Pne(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var r=e.stateNode;r===null&&(r=e.stateNode=new w5e),t.forEach(function(n){var i=T5e.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*k5e(n/1960))-n,10e?16:e,S0===null)var n=!1;else{if(e=S0,S0=null,fN=0,(ti&6)!==0)throw Error(xt(331));var i=ti;for(ti|=4,Vt=e.current;Vt!==null;){var a=Vt,o=a.child;if((Vt.flags&16)!==0){var s=a.deletions;if(s!==null){for(var l=0;ljo()-xU?ty(e,0):bU|=r),yc(e,t)}function Iae(e,t){t===0&&((e.mode&1)===0?t=1:(t=yj,yj<<=1,(yj&130023424)===0&&(yj=4194304)));var r=Ru();e=PA(e,t),e!==null&&(E6(e,t,r),yc(e,r))}function N5e(e){var t=e.memoizedState,r=0;t!==null&&(r=t.retryLane),Iae(e,r)}function T5e(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),Iae(e,r)}var Bae;Bae=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,y5e(e,t,r);Ac=(e.flags&131072)!==0}else Ac=!1,$a&&(t.flags&1048576)!==0&&qie(t,rN,t.index);switch(t.lanes=0,t.tag){case 2:var n=t.type;qj(e,t),e=t.pendingProps;var i=Ow(t,ru.current);kw(t,r),i=mU(null,t,n,e,i,r);var a=hU();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,eN(t)):a=!1,t.memoizedState=i.state!==null&&i.state!==void 0?i.state:null,uU(t),i.updater=bN,t.stateNode=i,i._reactInternals=t,kz(t,n,e,r),t=Oz(null,t,n,!0,a,r)):(t.tag=0,$a&&a&&rU(t),Bu(null,t,i,r),t=t.child),t;case 16:n=t.elementType;e:{switch(qj(e,t),e=t.pendingProps,i=n._init,n=i(n._payload),t.type=n,i=t.tag=_5e(n),e=Dp(n,e),i){case 0:t=Dz(null,t,n,e,r);break e;case 1:t=jne(null,t,n,e,r);break e;case 11:t=One(null,t,n,e,r);break e;case 14:t=Mne(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),Dz(e,t,n,i,r);case 1:return n=t.type,i=t.pendingProps,i=t.elementType===n?i:Dp(n,i),jne(e,t,n,i,r);case 3:e:{if(bae(t),e===null)throw Error(xt(387));n=t.pendingProps,a=t.memoizedState,i=a.element,Wie(e,t),aN(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=Nne(e,t,n,r,i);break e}else if(n!==i){i=Tw(Error(xt(424)),t),t=Nne(e,t,n,r,i);break e}else for(ff=D0(t.stateNode.containerInfo.firstChild),df=t,$a=!0,Mp=null,r=Qie(t,null,n,r),t.child=r;r;)r.flags=r.flags&-3|4096,r=r.sibling;else{if(Mw(),n===i){t=IA(e,t,r);break e}Bu(e,t,n,r)}t=t.child}return t;case 5:return Yie(t),e===null&&wz(t),n=t.type,i=t.pendingProps,a=e!==null?e.memoizedProps:null,o=i.children,gz(n,i)?o=null:a!==null&&gz(n,a)&&(t.flags|=32),yae(e,t),Bu(e,t,o,r),t.child;case 6:return e===null&&wz(t),null;case 13:return xae(e,t,r);case 4:return cU(t,t.stateNode.containerInfo),n=t.pendingProps,e===null?t.child=jw(t,null,n,r):Bu(e,t,n,r),t.child;case 11:return n=t.type,i=t.pendingProps,i=t.elementType===n?i:Dp(n,i),One(e,t,n,i,r);case 7:return Bu(e,t,t.pendingProps,r),t.child;case 8:return Bu(e,t,t.pendingProps.children,r),t.child;case 12:return Bu(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,pa(nN,n._currentValue),n._currentValue=o,a!==null)if(Tp(a.value,o)){if(a.children===i.children&&!gc.current){t=IA(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=TA(-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),Sz(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),Sz(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}Bu(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,Bu(e,t,n,r),t.child;case 14:return n=t.type,i=Dp(n,t.pendingProps),i=Dp(n.type,i),Mne(e,t,n,i,r);case 15:return gae(e,t,t.type,t.pendingProps,r);case 17:return n=t.type,i=t.pendingProps,i=t.elementType===n?i:Dp(n,i),qj(e,t),t.tag=1,vc(n)?(e=!0,eN(t)):e=!1,kw(t,r),Vie(t,n,i),kz(t,n,i,r),Oz(null,t,n,!0,e,r);case 19:return wae(e,t,r);case 22:return vae(e,t,r)}throw Error(xt(156,t.tag))};function Rae(e,t){return cie(e,t)}function F5e(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 F5e(e,t,r,n)}function kU(e){return e=e.prototype,!(!e||!e.isReactComponent)}function _5e(e){if(typeof e=="function")return kU(e)?1:0;if(e!=null){if(e=e.$$typeof,e===Wz)return 11;if(e===Hz)return 14}return 2}function N0(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 Uj(e,t,r,n,i,a){var o=2;if(n=e,typeof e=="function")kU(e)&&(o=1);else if(typeof e=="string")o=5;else e:switch(e){case cw:return ry(r.children,i,a,t);case Uz:o=8,i|=8;break;case YL:return e=yd(12,r,t,i|2),e.elementType=YL,e.lanes=a,e;case ZL:return e=yd(13,r,t,i),e.elementType=ZL,e.lanes=a,e;case XL:return e=yd(19,r,t,i),e.elementType=XL,e.lanes=a,e;case Gne:return EN(r,i,a,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case Hne:o=10;break e;case Vne:o=9;break e;case Wz:o=11;break e;case Hz:o=14;break e;case v0: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 ry(e,t,r,n){return e=yd(7,e,n,t),e.lanes=r,e}function EN(e,t,r,n){return e=yd(22,e,n,t),e.elementType=Gne,e.lanes=r,e.stateNode={isHidden:!1},e}function VL(e,t,r){return e=yd(6,e,null,t),e.lanes=r,e}function GL(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 P5e(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=jL(0),this.expirationTimes=jL(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=jL(0),this.identifierPrefix=n,this.onRecoverableError=i,this.mutableSourceEagerHydrationData=null}function CU(e,t,r,n,i,a,o,s,l){return e=new P5e(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},uU(a),e}function I5e(e,t,r){var n=3{"use strict";function Uae(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(Uae)}catch(e){console.error(e)}}Uae(),Wae.exports=zae()});var oT=vn((YU,ZU)=>{(function(e,t){typeof YU=="object"&&typeof ZU<"u"?ZU.exports=t():typeof define=="function"&&define.amd?define(t):(e=typeof globalThis<"u"?globalThis:e||self,e["'typed'"]=t())})(YU,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),Yt=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 Yt=[],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 Yh=kn.map(j),Cn;for(Cn of Se(Yh)){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),Yt=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&&Yt&&Wr&&en;for(let kn=0;knkn.test),Mg=ue.map(kn=>kn.implementation),Qh=function(){for(let Ia=Og;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 yW=="object"?(Object.defineProperty(f,"__esModule",{value:!0}),f.default=f,f.Fraction=f,Gse.exports=f):e.Fraction=f})(yW)});var uce=vn((pkt,lce)=>{lce.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 dfe=vn((jMt,ffe)=>{"use strict";var EH=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?sUe:i,o=String(e),s="",l=a(EH({},aUe),n?EH({},oUe):{}),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 zAe=vn((LAe,TH)=>{(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})(LAe,typeof TH=="object"&&TH,typeof define=="function"&&define)});var WAe=vn((UAe,FH)=>{(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})(UAe,typeof FH=="object"&&FH,typeof define=="function"&&define)});var VAe=vn((HAe,_H)=>{(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})(HAe,typeof _H=="object"&&_H,typeof define=="function"&&define)});var QAe=vn((GAe,PH)=>{(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})(GAe,typeof PH=="object"&&PH,typeof define=="function"&&define)});var ZAe=vn((YAe,IH)=>{(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})(YAe,typeof IH=="object"&&IH,typeof define=="function"&&define)});var KAe=vn((XAe,BH)=>{(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})(XAe,typeof BH=="object"&&BH,typeof define=="function"&&define)});var ege=vn((JAe,wP)=>{(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 EWe=zAe(),kWe=WAe(),CWe=VAe(),DWe=QAe(),OWe=ZAe(),MWe=KAe(),My=ege();My.alea=EWe;My.xor128=kWe;My.xorwow=CWe;My.xorshift7=DWe;My.xor4096=OWe;My.tychei=MWe;tge.exports=My});var nye=vn((mGt,FV)=>{function TV(){}TV.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 dVe=Te(),pVe=Symbol.for("react.element"),mVe=Symbol.for("react.fragment"),hVe=Object.prototype.hasOwnProperty,AVe=dVe.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,gVe={key:!0,ref:!0,__self:!0,__source:!0};function Uye(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)hVe.call(t,n)&&!gVe.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:pVe,type:e,key:a,ref:o,props:i,_owner:AVe.current}}XB.Fragment=mVe;XB.jsx=Uye;XB.jsxs=Uye});var KA=vn((rYt,Hye)=>{"use strict";Hye.exports=Wye()});var iCe=vn((Swr,nCe)=>{"use strict";var mtt="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";nCe.exports=mtt});var lCe=vn((Ewr,sCe)=>{"use strict";var htt=iCe();function aCe(){}function oCe(){}oCe.resetWarningCache=aCe;sCe.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:oCe,resetWarningCache:aCe};return r.PropTypes=r,r}});var cCe=vn((Dwr,uCe)=>{uCe.exports=lCe()();var kwr,Cwr});var hCe=vn(BZ=>{"use strict";BZ.__esModule=!0;BZ.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 ZCe=vn(iE=>{"use strict";Object.defineProperty(iE,"__esModule",{value:!0});var um=Te(),ZZ=um.createContext(null),YZ={didCatch:!1,error:null},z8=class extends um.Component{constructor(t){super(t),this.resetErrorBoundary=this.resetErrorBoundary.bind(this),this.state=YZ}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(ZZ);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(z8,t,um.createElement(e,{...i,ref:a}))),n=e.displayName||e.name||"Unknown";return r.displayName="withErrorBoundary(".concat(n,")"),r}iE.ErrorBoundary=z8;iE.ErrorBoundaryContext=ZZ;iE.useErrorBoundary=lrt;iE.withErrorBoundary=urt});var oDe=vn((oEr,aDe)=>{"use strict";var G8={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(G8).forEach(function(e){prt.forEach(function(t){G8[drt(t,e)]=G8[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:G8,shorthandPropertyExpansions:mrt};aDe.exports=hrt});var lDe=vn((sEr,sDe)=>{"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-")}sDe.exports=yrt});var dDe=vn((lEr,fDe)=>{"use strict";var brt=oDe().isUnitlessNumber,xrt=lDe(),wrt=Array.isArray,uDe=Object.keys,Srt=/^(normal|none|(\b(url\([^)]*\)|chapter_counter|attr\([^)]*\)|(no-)?(open|close)-quote|inherit)((\b\s*)|$|\s+))+)$/;function cDe(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||uDe(e).length===0)return t;for(var r=uDe(e),n=0,i=r.length;n{(function(e){typeof ZDe=="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+=` +`+a.stack}return{value:e,source:t,stack:i,digest:null}}function WL(e,t,r){return{value:e,source:null,stack:r??null,digest:t??null}}function Cz(e,t){try{console.error(t.value)}catch(r){setTimeout(function(){throw r})}}var A5e=typeof WeakMap=="function"?WeakMap:Map;function gae(e,t,r){r=TA(-1,r),r.tag=3,r.payload={element:null};var n=t.value;return r.callback=function(){cN||(cN=!0,Iz=n),Cz(e,t)},r}function vae(e,t,r){r=TA(-1,r),r.tag=3;var n=e.type.getDerivedStateFromError;if(typeof n=="function"){var i=t.value;r.payload=function(){return n(i)},r.callback=function(){Cz(e,t)}}var a=e.stateNode;return a!==null&&typeof a.componentDidCatch=="function"&&(r.callback=function(){Cz(e,t),typeof n!="function"&&(M0===null?M0=new Set([this]):M0.add(this));var o=t.stack;this.componentDidCatch(t.value,{componentStack:o!==null?o:""})}),r}function Dne(e,t,r){var n=e.pingCache;if(n===null){n=e.pingCache=new A5e;var i=new Set;n.set(t,i)}else i=n.get(t),i===void 0&&(i=new Set,n.set(t,i));i.has(r)||(i.add(r),e=j5e.bind(null,e,t,r),t.then(e,e))}function One(e){do{var t;if((t=e.tag===13)&&(t=e.memoizedState,t=t!==null?t.dehydrated!==null:!0),t)return e;e=e.return}while(e!==null);return null}function Mne(e,t,r,n,i){return(e.mode&1)===0?(e===t?e.flags|=65536:(e.flags|=128,r.flags|=131072,r.flags&=-52805,r.tag===1&&(r.alternate===null?r.tag=17:(t=TA(-1,1),t.tag=2,O0(r,t,1))),r.lanes|=1),e):(e.flags|=65536,e.lanes=i,e)}var g5e=BA.ReactCurrentOwner,Ac=!1;function Bu(e,t,r,n){t.child=e===null?Zie(t,null,r,n):jw(t,e.child,r,n)}function jne(e,t,r,n,i){r=r.render;var a=t.ref;return kw(t,i),n=mU(e,t,r,n,a,i),r=hU(),e!==null&&!Ac?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~i,IA(e,t,i)):($a&&r&&rU(t),t.flags|=1,Bu(e,t,n,i),t.child)}function Nne(e,t,r,n,i){if(e===null){var a=r.type;return typeof a=="function"&&!kU(a)&&a.defaultProps===void 0&&r.compare===null&&r.defaultProps===void 0?(t.tag=15,t.type=a,yae(e,t,a,n,i)):(e=Uj(r.type,null,n,t,t.mode,i),e.ref=t.ref,e.return=t,t.child=e)}if(a=e.child,(e.lanes&i)===0){var o=a.memoizedProps;if(r=r.compare,r=r!==null?r:m6,r(o,n)&&e.ref===t.ref)return IA(e,t,i)}return t.flags|=1,e=N0(a,n),e.ref=t.ref,e.return=t,t.child=e}function yae(e,t,r,n,i){if(e!==null){var a=e.memoizedProps;if(m6(a,n)&&e.ref===t.ref)if(Ac=!1,t.pendingProps=n=a,(e.lanes&i)!==0)(e.flags&131072)!==0&&(Ac=!0);else return t.lanes=e.lanes,IA(e,t,i)}return Dz(e,t,r,n,i)}function bae(e,t,r){var n=t.pendingProps,i=n.children,a=e!==null?e.memoizedState:null;if(n.mode==="hidden")if((t.mode&1)===0)t.memoizedState={baseLanes:0,cachePool:null,transitions:null},pa(bw,cf),cf|=r;else{if((r&1073741824)===0)return e=a!==null?a.baseLanes|r:r,t.lanes=t.childLanes=1073741824,t.memoizedState={baseLanes:e,cachePool:null,transitions:null},t.updateQueue=null,pa(bw,cf),cf|=e,null;t.memoizedState={baseLanes:0,cachePool:null,transitions:null},n=a!==null?a.baseLanes:r,pa(bw,cf),cf|=n}else a!==null?(n=a.baseLanes|r,t.memoizedState=null):n=r,pa(bw,cf),cf|=n;return Bu(e,t,i,r),t.child}function xae(e,t){var r=t.ref;(e===null&&r!==null||e!==null&&e.ref!==r)&&(t.flags|=512,t.flags|=2097152)}function Dz(e,t,r,n,i){var a=vc(r)?ny:ru.current;return a=Ow(t,a),kw(t,i),r=mU(e,t,r,n,a,i),n=hU(),e!==null&&!Ac?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~i,IA(e,t,i)):($a&&n&&rU(t),t.flags|=1,Bu(e,t,r,i),t.child)}function Tne(e,t,r,n,i){if(vc(r)){var a=!0;eN(t)}else a=!1;if(kw(t,i),t.stateNode===null)qj(e,t),Qie(t,r,n),kz(t,r,n,i),n=!0;else if(e===null){var o=t.stateNode,s=t.memoizedProps;o.props=s;var l=o.context,u=r.contextType;typeof u=="object"&&u!==null?u=xd(u):(u=vc(r)?ny:ru.current,u=Ow(t,u));var c=r.getDerivedStateFromProps,f=typeof c=="function"||typeof o.getSnapshotBeforeUpdate=="function";f||typeof o.UNSAFE_componentWillReceiveProps!="function"&&typeof o.componentWillReceiveProps!="function"||(s!==n||l!==u)&&Sne(t,o,n,u),y0=!1;var d=t.memoizedState;o.state=d,aN(t,n,o,i),l=t.memoizedState,s!==n||d!==l||gc.current||y0?(typeof c=="function"&&(Ez(t,r,c,n),l=t.memoizedState),(s=y0||wne(t,r,s,n,d,l,u))?(f||typeof o.UNSAFE_componentWillMount!="function"&&typeof o.componentWillMount!="function"||(typeof o.componentWillMount=="function"&&o.componentWillMount(),typeof o.UNSAFE_componentWillMount=="function"&&o.UNSAFE_componentWillMount()),typeof o.componentDidMount=="function"&&(t.flags|=4194308)):(typeof o.componentDidMount=="function"&&(t.flags|=4194308),t.memoizedProps=n,t.memoizedState=l),o.props=n,o.state=l,o.context=u,n=s):(typeof o.componentDidMount=="function"&&(t.flags|=4194308),n=!1)}else{o=t.stateNode,Vie(e,t),s=t.memoizedProps,u=t.type===t.elementType?s:Dp(t.type,s),o.props=u,f=t.pendingProps,d=o.context,l=r.contextType,typeof l=="object"&&l!==null?l=xd(l):(l=vc(r)?ny:ru.current,l=Ow(t,l));var p=r.getDerivedStateFromProps;(c=typeof p=="function"||typeof o.getSnapshotBeforeUpdate=="function")||typeof o.UNSAFE_componentWillReceiveProps!="function"&&typeof o.componentWillReceiveProps!="function"||(s!==f||d!==l)&&Sne(t,o,n,l),y0=!1,d=t.memoizedState,o.state=d,aN(t,n,o,i);var h=t.memoizedState;s!==f||d!==h||gc.current||y0?(typeof p=="function"&&(Ez(t,r,p,n),h=t.memoizedState),(u=y0||wne(t,r,u,n,d,h,l)||!1)?(c||typeof o.UNSAFE_componentWillUpdate!="function"&&typeof o.componentWillUpdate!="function"||(typeof o.componentWillUpdate=="function"&&o.componentWillUpdate(n,h,l),typeof o.UNSAFE_componentWillUpdate=="function"&&o.UNSAFE_componentWillUpdate(n,h,l)),typeof o.componentDidUpdate=="function"&&(t.flags|=4),typeof o.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof o.componentDidUpdate!="function"||s===e.memoizedProps&&d===e.memoizedState||(t.flags|=4),typeof o.getSnapshotBeforeUpdate!="function"||s===e.memoizedProps&&d===e.memoizedState||(t.flags|=1024),t.memoizedProps=n,t.memoizedState=h),o.props=n,o.state=h,o.context=l,n=u):(typeof o.componentDidUpdate!="function"||s===e.memoizedProps&&d===e.memoizedState||(t.flags|=4),typeof o.getSnapshotBeforeUpdate!="function"||s===e.memoizedProps&&d===e.memoizedState||(t.flags|=1024),n=!1)}return Oz(e,t,r,n,a,i)}function Oz(e,t,r,n,i,a){xae(e,t);var o=(t.flags&128)!==0;if(!n&&!o)return i&&gne(t,r,!1),IA(e,t,a);n=t.stateNode,g5e.current=t;var s=o&&typeof r.getDerivedStateFromError!="function"?null:n.render();return t.flags|=1,e!==null&&o?(t.child=jw(t,e.child,null,a),t.child=jw(t,null,s,a)):Bu(e,t,s,a),t.memoizedState=n.state,i&&gne(t,r,!0),t.child}function wae(e){var t=e.stateNode;t.pendingContext?Ane(e,t.pendingContext,t.pendingContext!==t.context):t.context&&Ane(e,t.context,!1),cU(e,t.containerInfo)}function Fne(e,t,r,n,i){return Mw(),iU(i),t.flags|=256,Bu(e,t,r,n),t.child}var Mz={dehydrated:null,treeContext:null,retryLane:0};function jz(e){return{baseLanes:e,cachePool:null,transitions:null}}function Sae(e,t,r){var n=t.pendingProps,i=Xa.current,a=!1,o=(t.flags&128)!==0,s;if((s=o)||(s=e!==null&&e.memoizedState===null?!1:(i&2)!==0),s?(a=!0,t.flags&=-129):(e===null||e.memoizedState!==null)&&(i|=1),pa(Xa,i&1),e===null)return wz(t),e=t.memoizedState,e!==null&&(e=e.dehydrated,e!==null)?((t.mode&1)===0?t.lanes=1:e.data==="$!"?t.lanes=8:t.lanes=1073741824,null):(o=n.children,e=n.fallback,a?(n=t.mode,a=t.child,o={mode:"hidden",children:o},(n&1)===0&&a!==null?(a.childLanes=0,a.pendingProps=o):a=EN(o,n,0,null),e=ry(e,n,r,null),a.return=t,e.return=t,a.sibling=e,t.child=a,t.child.memoizedState=jz(r),t.memoizedState=Mz,e):vU(t,o));if(i=e.memoizedState,i!==null&&(s=i.dehydrated,s!==null))return v5e(e,t,o,n,s,i,r);if(a){a=n.fallback,o=t.mode,i=e.child,s=i.sibling;var l={mode:"hidden",children:n.children};return(o&1)===0&&t.child!==i?(n=t.child,n.childLanes=0,n.pendingProps=l,t.deletions=null):(n=N0(i,l),n.subtreeFlags=i.subtreeFlags&14680064),s!==null?a=N0(s,a):(a=ry(a,o,r,null),a.flags|=2),a.return=t,n.return=t,n.sibling=a,t.child=n,n=a,a=t.child,o=e.child.memoizedState,o=o===null?jz(r):{baseLanes:o.baseLanes|r,cachePool:null,transitions:o.transitions},a.memoizedState=o,a.childLanes=e.childLanes&~r,t.memoizedState=Mz,n}return a=e.child,e=a.sibling,n=N0(a,{mode:"visible",children:n.children}),(t.mode&1)===0&&(n.lanes=r),n.return=t,n.sibling=null,e!==null&&(r=t.deletions,r===null?(t.deletions=[e],t.flags|=16):r.push(e)),t.child=n,t.memoizedState=null,n}function vU(e,t){return t=EN({mode:"visible",children:t},e.mode,0,null),t.return=e,e.child=t}function Nj(e,t,r,n){return n!==null&&iU(n),jw(t,e.child,null,r),e=vU(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function v5e(e,t,r,n,i,a,o){if(r)return t.flags&256?(t.flags&=-257,n=WL(Error(xt(422))),Nj(e,t,o,n)):t.memoizedState!==null?(t.child=e.child,t.flags|=128,null):(a=n.fallback,i=t.mode,n=EN({mode:"visible",children:n.children},i,0,null),a=ry(a,i,o,null),a.flags|=2,n.return=t,a.return=t,n.sibling=a,t.child=n,(t.mode&1)!==0&&jw(t,e.child,null,o),t.child.memoizedState=jz(o),t.memoizedState=Mz,a);if((t.mode&1)===0)return Nj(e,t,o,null);if(i.data==="$!"){if(n=i.nextSibling&&i.nextSibling.dataset,n)var s=n.dgst;return n=s,a=Error(xt(419)),n=WL(a,n,void 0),Nj(e,t,o,n)}if(s=(o&e.childLanes)!==0,Ac||s){if(n=zs,n!==null){switch(o&-o){case 4:i=2;break;case 16:i=8;break;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:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:i=32;break;case 536870912:i=268435456;break;default:i=0}i=(i&(n.suspendedLanes|o))!==0?0:i,i!==0&&i!==a.retryLane&&(a.retryLane=i,PA(e,i),Np(n,e,i,-1))}return EU(),n=WL(Error(xt(421))),Nj(e,t,o,n)}return i.data==="$?"?(t.flags|=128,t.child=e.child,t=N5e.bind(null,e),i._reactRetry=t,null):(e=a.treeContext,ff=D0(i.nextSibling),df=t,$a=!0,Mp=null,e!==null&&(gd[vd++]=jA,gd[vd++]=NA,gd[vd++]=iy,jA=e.id,NA=e.overflow,iy=t),t=vU(t,n.children),t.flags|=4096,t)}function _ne(e,t,r){e.lanes|=t;var n=e.alternate;n!==null&&(n.lanes|=t),Sz(e.return,t,r)}function HL(e,t,r,n,i){var a=e.memoizedState;a===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:n,tail:r,tailMode:i}:(a.isBackwards=t,a.rendering=null,a.renderingStartTime=0,a.last=n,a.tail=r,a.tailMode=i)}function Eae(e,t,r){var n=t.pendingProps,i=n.revealOrder,a=n.tail;if(Bu(e,t,n.children,r),n=Xa.current,(n&2)!==0)n=n&1|2,t.flags|=128;else{if(e!==null&&(e.flags&128)!==0)e:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&_ne(e,r,t);else if(e.tag===19)_ne(e,r,t);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break e;for(;e.sibling===null;){if(e.return===null||e.return===t)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}n&=1}if(pa(Xa,n),(t.mode&1)===0)t.memoizedState=null;else switch(i){case"forwards":for(r=t.child,i=null;r!==null;)e=r.alternate,e!==null&&oN(e)===null&&(i=r),r=r.sibling;r=i,r===null?(i=t.child,t.child=null):(i=r.sibling,r.sibling=null),HL(t,!1,i,r,a);break;case"backwards":for(r=null,i=t.child,t.child=null;i!==null;){if(e=i.alternate,e!==null&&oN(e)===null){t.child=i;break}e=i.sibling,i.sibling=r,r=i,i=e}HL(t,!0,r,null,a);break;case"together":HL(t,!1,null,null,void 0);break;default:t.memoizedState=null}return t.child}function qj(e,t){(t.mode&1)===0&&e!==null&&(e.alternate=null,t.alternate=null,t.flags|=2)}function IA(e,t,r){if(e!==null&&(t.dependencies=e.dependencies),oy|=t.lanes,(r&t.childLanes)===0)return null;if(e!==null&&t.child!==e.child)throw Error(xt(153));if(t.child!==null){for(e=t.child,r=N0(e,e.pendingProps),t.child=r,r.return=t;e.sibling!==null;)e=e.sibling,r=r.sibling=N0(e,e.pendingProps),r.return=t;r.sibling=null}return t.child}function y5e(e,t,r){switch(t.tag){case 3:wae(t),Mw();break;case 5:Xie(t);break;case 1:vc(t.type)&&eN(t);break;case 4:cU(t,t.stateNode.containerInfo);break;case 10:var n=t.type._context,i=t.memoizedProps.value;pa(nN,n._currentValue),n._currentValue=i;break;case 13:if(n=t.memoizedState,n!==null)return n.dehydrated!==null?(pa(Xa,Xa.current&1),t.flags|=128,null):(r&t.child.childLanes)!==0?Sae(e,t,r):(pa(Xa,Xa.current&1),e=IA(e,t,r),e!==null?e.sibling:null);pa(Xa,Xa.current&1);break;case 19:if(n=(r&t.childLanes)!==0,(e.flags&128)!==0){if(n)return Eae(e,t,r);t.flags|=128}if(i=t.memoizedState,i!==null&&(i.rendering=null,i.tail=null,i.lastEffect=null),pa(Xa,Xa.current),n)break;return null;case 22:case 23:return t.lanes=0,bae(e,t,r)}return IA(e,t,r)}var kae,Nz,Cae,Dae;kae=function(e,t){for(var r=t.child;r!==null;){if(r.tag===5||r.tag===6)e.appendChild(r.stateNode);else if(r.tag!==4&&r.child!==null){r.child.return=r,r=r.child;continue}if(r===t)break;for(;r.sibling===null;){if(r.return===null||r.return===t)return;r=r.return}r.sibling.return=r.return,r=r.sibling}};Nz=function(){};Cae=function(e,t,r,n){var i=e.memoizedProps;if(i!==n){e=t.stateNode,ey(zm.current);var a=null;switch(r){case"input":i=JL(e,i),n=JL(e,n),a=[];break;case"select":i=Ja({},i,{value:void 0}),n=Ja({},n,{value:void 0}),a=[];break;case"textarea":i=rz(e,i),n=rz(e,n),a=[];break;default:typeof i.onClick!="function"&&typeof n.onClick=="function"&&(e.onclick=Kj)}iz(r,n);var o;r=null;for(u in i)if(!n.hasOwnProperty(u)&&i.hasOwnProperty(u)&&i[u]!=null)if(u==="style"){var s=i[u];for(o in s)s.hasOwnProperty(o)&&(r||(r={}),r[o]="")}else u!=="dangerouslySetInnerHTML"&&u!=="children"&&u!=="suppressContentEditableWarning"&&u!=="suppressHydrationWarning"&&u!=="autoFocus"&&(s6.hasOwnProperty(u)?a||(a=[]):(a=a||[]).push(u,null));for(u in n){var l=n[u];if(s=i?.[u],n.hasOwnProperty(u)&&l!==s&&(l!=null||s!=null))if(u==="style")if(s){for(o in s)!s.hasOwnProperty(o)||l&&l.hasOwnProperty(o)||(r||(r={}),r[o]="");for(o in l)l.hasOwnProperty(o)&&s[o]!==l[o]&&(r||(r={}),r[o]=l[o])}else r||(a||(a=[]),a.push(u,r)),r=l;else u==="dangerouslySetInnerHTML"?(l=l?l.__html:void 0,s=s?s.__html:void 0,l!=null&&s!==l&&(a=a||[]).push(u,l)):u==="children"?typeof l!="string"&&typeof l!="number"||(a=a||[]).push(u,""+l):u!=="suppressContentEditableWarning"&&u!=="suppressHydrationWarning"&&(s6.hasOwnProperty(u)?(l!=null&&u==="onScroll"&&ka("scroll",e),a||s===l||(a=[])):(a=a||[]).push(u,l))}r&&(a=a||[]).push("style",r);var u=a;(t.updateQueue=u)&&(t.flags|=4)}};Dae=function(e,t,r,n){r!==n&&(t.flags|=4)};function Hk(e,t){if(!$a)switch(e.tailMode){case"hidden":t=e.tail;for(var r=null;t!==null;)t.alternate!==null&&(r=t),t=t.sibling;r===null?e.tail=null:r.sibling=null;break;case"collapsed":r=e.tail;for(var n=null;r!==null;)r.alternate!==null&&(n=r),r=r.sibling;n===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:n.sibling=null}}function eu(e){var t=e.alternate!==null&&e.alternate.child===e.child,r=0,n=0;if(t)for(var i=e.child;i!==null;)r|=i.lanes|i.childLanes,n|=i.subtreeFlags&14680064,n|=i.flags&14680064,i.return=e,i=i.sibling;else for(i=e.child;i!==null;)r|=i.lanes|i.childLanes,n|=i.subtreeFlags,n|=i.flags,i.return=e,i=i.sibling;return e.subtreeFlags|=n,e.childLanes=r,t}function b5e(e,t,r){var n=t.pendingProps;switch(nU(t),t.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return eu(t),null;case 1:return vc(t.type)&&Jj(),eu(t),null;case 3:return n=t.stateNode,Nw(),Ca(gc),Ca(ru),dU(),n.pendingContext&&(n.context=n.pendingContext,n.pendingContext=null),(e===null||e.child===null)&&(Mj(t)?t.flags|=4:e===null||e.memoizedState.isDehydrated&&(t.flags&256)===0||(t.flags|=1024,Mp!==null&&($z(Mp),Mp=null))),Nz(e,t),eu(t),null;case 5:fU(t);var i=ey(y6.current);if(r=t.type,e!==null&&t.stateNode!=null)Cae(e,t,r,n,i),e.ref!==t.ref&&(t.flags|=512,t.flags|=2097152);else{if(!n){if(t.stateNode===null)throw Error(xt(166));return eu(t),null}if(e=ey(zm.current),Mj(t)){n=t.stateNode,r=t.type;var a=t.memoizedProps;switch(n[qm]=t,n[g6]=a,e=(t.mode&1)!==0,r){case"dialog":ka("cancel",n),ka("close",n);break;case"iframe":case"object":case"embed":ka("load",n);break;case"video":case"audio":for(i=0;i<\/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[g6]=n,kae(e,t,!1,!1),t.stateNode=e;e:{switch(o=az(r,n),r){case"dialog":ka("cancel",e),ka("close",e),i=n;break;case"iframe":case"object":case"embed":ka("load",e),i=n;break;case"video":case"audio":for(i=0;iFw&&(t.flags|=128,n=!0,Hk(a,!1),t.lanes=4194304)}else{if(!n)if(e=oN(o),e!==null){if(t.flags|=128,n=!0,r=e.updateQueue,r!==null&&(t.updateQueue=r,t.flags|=4),Hk(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,Hk(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=Xa.current,pa(Xa,n?r&1|2:r&1),t):(eu(t),null);case 22:case 23:return SU(),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 x5e(e,t){switch(nU(t),t.tag){case 1:return vc(t.type)&&Jj(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Nw(),Ca(gc),Ca(ru),dU(),e=t.flags,(e&65536)!==0&&(e&128)===0?(t.flags=e&-65537|128,t):null;case 5:return fU(t),null;case 13:if(Ca(Xa),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 Ca(Xa),null;case 4:return Nw(),null;case 10:return sU(t.type._context),null;case 22:case 23:return SU(),null;case 24:return null;default:return null}}var Tj=!1,tu=!1,w5e=typeof WeakSet=="function"?WeakSet:Set,Vt=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 Tz(e,t,r){try{r()}catch(n){go(e,t,n)}}var Pne=!1;function S5e(e,t){if(hz=Yj,e=Nie(),tU(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(Az={focusedElem:e,selectionRange:r},Yj=!1,Vt=t;Vt!==null;)if(t=Vt,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,Vt=e;else for(;Vt!==null;){t=Vt;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,Vt=e;break}Vt=t.return}return h=Pne,Pne=!1,h}function i6(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&&Tz(t,r,a)}i=i.next}while(i!==n)}}function wN(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 Fz(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 Oae(e){var t=e.alternate;t!==null&&(e.alternate=null,Oae(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[qm],delete t[g6],delete t[yz],delete t[a5e],delete t[o5e])),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 Mae(e){return e.tag===5||e.tag===3||e.tag===4}function Ine(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||Mae(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 _z(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=Kj));else if(n!==4&&(e=e.child,e!==null))for(_z(e,t,r),e=e.sibling;e!==null;)_z(e,t,r),e=e.sibling}function Pz(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(Pz(e,t,r),e=e.sibling;e!==null;)Pz(e,t,r),e=e.sibling}var gl=null,Op=!1;function g0(e,t,r){for(r=r.child;r!==null;)jae(e,t,r),r=r.sibling}function jae(e,t,r){if(Lm&&typeof Lm.onCommitFiberUnmount=="function")try{Lm.onCommitFiberUnmount(mN,r)}catch{}switch(r.tag){case 5:tu||yw(r,t);case 6:var n=gl,i=Op;gl=null,g0(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?RL(e.parentNode,r):e.nodeType===1&&RL(e,r),d6(e)):RL(gl,r.stateNode));break;case 4:n=gl,i=Op,gl=r.stateNode.containerInfo,Op=!0,g0(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)&&Tz(r,t,o),i=i.next}while(i!==n)}g0(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)}g0(e,t,r);break;case 21:g0(e,t,r);break;case 22:r.mode&1?(tu=(n=tu)||r.memoizedState!==null,g0(e,t,r),tu=n):g0(e,t,r);break;default:g0(e,t,r)}}function Bne(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var r=e.stateNode;r===null&&(r=e.stateNode=new w5e),t.forEach(function(n){var i=T5e.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*k5e(n/1960))-n,10e?16:e,S0===null)var n=!1;else{if(e=S0,S0=null,fN=0,(ti&6)!==0)throw Error(xt(331));var i=ti;for(ti|=4,Vt=e.current;Vt!==null;){var a=Vt,o=a.child;if((Vt.flags&16)!==0){var s=a.deletions;if(s!==null){for(var l=0;ljo()-xU?ty(e,0):bU|=r),yc(e,t)}function Rae(e,t){t===0&&((e.mode&1)===0?t=1:(t=yj,yj<<=1,(yj&130023424)===0&&(yj=4194304)));var r=Ru();e=PA(e,t),e!==null&&(E6(e,t,r),yc(e,r))}function N5e(e){var t=e.memoizedState,r=0;t!==null&&(r=t.retryLane),Rae(e,r)}function T5e(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),Rae(e,r)}var $ae;$ae=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,y5e(e,t,r);Ac=(e.flags&131072)!==0}else Ac=!1,$a&&(t.flags&1048576)!==0&&zie(t,rN,t.index);switch(t.lanes=0,t.tag){case 2:var n=t.type;qj(e,t),e=t.pendingProps;var i=Ow(t,ru.current);kw(t,r),i=mU(null,t,n,e,i,r);var a=hU();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,eN(t)):a=!1,t.memoizedState=i.state!==null&&i.state!==void 0?i.state:null,uU(t),i.updater=bN,t.stateNode=i,i._reactInternals=t,kz(t,n,e,r),t=Oz(null,t,n,!0,a,r)):(t.tag=0,$a&&a&&rU(t),Bu(null,t,i,r),t=t.child),t;case 16:n=t.elementType;e:{switch(qj(e,t),e=t.pendingProps,i=n._init,n=i(n._payload),t.type=n,i=t.tag=_5e(n),e=Dp(n,e),i){case 0:t=Dz(null,t,n,e,r);break e;case 1:t=Tne(null,t,n,e,r);break e;case 11:t=jne(null,t,n,e,r);break e;case 14:t=Nne(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),Dz(e,t,n,i,r);case 1:return n=t.type,i=t.pendingProps,i=t.elementType===n?i:Dp(n,i),Tne(e,t,n,i,r);case 3:e:{if(wae(t),e===null)throw Error(xt(387));n=t.pendingProps,a=t.memoizedState,i=a.element,Vie(e,t),aN(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=Fne(e,t,n,r,i);break e}else if(n!==i){i=Tw(Error(xt(424)),t),t=Fne(e,t,n,r,i);break e}else for(ff=D0(t.stateNode.containerInfo.firstChild),df=t,$a=!0,Mp=null,r=Zie(t,null,n,r),t.child=r;r;)r.flags=r.flags&-3|4096,r=r.sibling;else{if(Mw(),n===i){t=IA(e,t,r);break e}Bu(e,t,n,r)}t=t.child}return t;case 5:return Xie(t),e===null&&wz(t),n=t.type,i=t.pendingProps,a=e!==null?e.memoizedProps:null,o=i.children,gz(n,i)?o=null:a!==null&&gz(n,a)&&(t.flags|=32),xae(e,t),Bu(e,t,o,r),t.child;case 6:return e===null&&wz(t),null;case 13:return Sae(e,t,r);case 4:return cU(t,t.stateNode.containerInfo),n=t.pendingProps,e===null?t.child=jw(t,null,n,r):Bu(e,t,n,r),t.child;case 11:return n=t.type,i=t.pendingProps,i=t.elementType===n?i:Dp(n,i),jne(e,t,n,i,r);case 7:return Bu(e,t,t.pendingProps,r),t.child;case 8:return Bu(e,t,t.pendingProps.children,r),t.child;case 12:return Bu(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,pa(nN,n._currentValue),n._currentValue=o,a!==null)if(Tp(a.value,o)){if(a.children===i.children&&!gc.current){t=IA(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=TA(-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),Sz(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),Sz(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}Bu(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,Bu(e,t,n,r),t.child;case 14:return n=t.type,i=Dp(n,t.pendingProps),i=Dp(n.type,i),Nne(e,t,n,i,r);case 15:return yae(e,t,t.type,t.pendingProps,r);case 17:return n=t.type,i=t.pendingProps,i=t.elementType===n?i:Dp(n,i),qj(e,t),t.tag=1,vc(n)?(e=!0,eN(t)):e=!1,kw(t,r),Qie(t,n,i),kz(t,n,i,r),Oz(null,t,n,!0,e,r);case 19:return Eae(e,t,r);case 22:return bae(e,t,r)}throw Error(xt(156,t.tag))};function qae(e,t){return die(e,t)}function F5e(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 F5e(e,t,r,n)}function kU(e){return e=e.prototype,!(!e||!e.isReactComponent)}function _5e(e){if(typeof e=="function")return kU(e)?1:0;if(e!=null){if(e=e.$$typeof,e===Wz)return 11;if(e===Hz)return 14}return 2}function N0(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 Uj(e,t,r,n,i,a){var o=2;if(n=e,typeof e=="function")kU(e)&&(o=1);else if(typeof e=="string")o=5;else e:switch(e){case cw:return ry(r.children,i,a,t);case Uz:o=8,i|=8;break;case YL:return e=yd(12,r,t,i|2),e.elementType=YL,e.lanes=a,e;case ZL:return e=yd(13,r,t,i),e.elementType=ZL,e.lanes=a,e;case XL:return e=yd(19,r,t,i),e.elementType=XL,e.lanes=a,e;case Yne:return EN(r,i,a,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case Gne:o=10;break e;case Qne:o=9;break e;case Wz:o=11;break e;case Hz:o=14;break e;case v0: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 ry(e,t,r,n){return e=yd(7,e,n,t),e.lanes=r,e}function EN(e,t,r,n){return e=yd(22,e,n,t),e.elementType=Yne,e.lanes=r,e.stateNode={isHidden:!1},e}function VL(e,t,r){return e=yd(6,e,null,t),e.lanes=r,e}function GL(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 P5e(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=jL(0),this.expirationTimes=jL(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=jL(0),this.identifierPrefix=n,this.onRecoverableError=i,this.mutableSourceEagerHydrationData=null}function CU(e,t,r,n,i,a,o,s,l){return e=new P5e(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},uU(a),e}function I5e(e,t,r){var n=3{"use strict";function Hae(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(Hae)}catch(e){console.error(e)}}Hae(),Vae.exports=Wae()});var oT=vn((XU,KU)=>{(function(e,t){typeof XU=="object"&&typeof KU<"u"?KU.exports=t():typeof define=="function"&&define.amd?define(t):(e=typeof globalThis<"u"?globalThis:e||self,e["'typed'"]=t())})(XU,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),Yt=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 Yt=[],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 Yh=kn.map(j),Cn;for(Cn of Se(Yh)){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),Yt=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&&Yt&&Wr&&en;for(let kn=0;knkn.test),Mg=ue.map(kn=>kn.implementation),Qh=function(){for(let Ia=Og;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 xW=="object"?(Object.defineProperty(f,"__esModule",{value:!0}),f.default=f,f.Fraction=f,Gse.exports=f):e.Fraction=f})(xW)});var uce=vn((hkt,lce)=>{lce.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 dfe=vn((TMt,ffe)=>{"use strict";var CH=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?uUe:i,o=String(e),s="",l=a(CH({},sUe),n?CH({},lUe):{}),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 zAe=vn((LAe,_H)=>{(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})(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.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})(UAe,typeof PH=="object"&&PH,typeof define=="function"&&define)});var VAe=vn((HAe,IH)=>{(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})(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.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})(GAe,typeof BH=="object"&&BH,typeof define=="function"&&define)});var ZAe=vn((YAe,RH)=>{(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})(YAe,typeof RH=="object"&&RH,typeof define=="function"&&define)});var KAe=vn((XAe,$H)=>{(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})(XAe,typeof $H=="object"&&$H,typeof define=="function"&&define)});var ege=vn((JAe,wP)=>{(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 CWe=zAe(),DWe=WAe(),OWe=VAe(),MWe=QAe(),jWe=ZAe(),NWe=KAe(),My=ege();My.alea=CWe;My.xor128=DWe;My.xorwow=OWe;My.xorshift7=MWe;My.xor4096=jWe;My.tychei=NWe;tge.exports=My});var nye=vn((AGt,PV)=>{function _V(){}_V.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 mVe=Te(),hVe=Symbol.for("react.element"),AVe=Symbol.for("react.fragment"),gVe=Object.prototype.hasOwnProperty,vVe=mVe.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,yVe={key:!0,ref:!0,__self:!0,__source:!0};function Uye(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)gVe.call(t,n)&&!yVe.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:hVe,type:e,key:a,ref:o,props:i,_owner:vVe.current}}XB.Fragment=AVe;XB.jsx=Uye;XB.jsxs=Uye});var KA=vn((iYt,Hye)=>{"use strict";Hye.exports=Wye()});var iCe=vn((kwr,nCe)=>{"use strict";var Att="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";nCe.exports=Att});var lCe=vn((Cwr,sCe)=>{"use strict";var gtt=iCe();function aCe(){}function oCe(){}oCe.resetWarningCache=aCe;sCe.exports=function(){function e(n,i,a,o,s,l){if(l!==gtt){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:oCe,resetWarningCache:aCe};return r.PropTypes=r,r}});var cCe=vn((Mwr,uCe)=>{uCe.exports=lCe()();var Dwr,Owr});var hCe=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 ZCe=vn(iE=>{"use strict";Object.defineProperty(iE,"__esModule",{value:!0});var um=Te(),KZ=um.createContext(null),XZ={didCatch:!1,error:null},z8=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 urt(e){if(e==null||typeof e.didCatch!="boolean"||typeof e.resetErrorBoundary!="function")throw new Error("ErrorBoundaryContext not found")}function crt(){let e=um.useContext(KZ);urt(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 frt(e,t){let r=um.forwardRef((i,a)=>um.createElement(z8,t,um.createElement(e,{...i,ref:a}))),n=e.displayName||e.name||"Unknown";return r.displayName="withErrorBoundary(".concat(n,")"),r}iE.ErrorBoundary=z8;iE.ErrorBoundaryContext=KZ;iE.useErrorBoundary=crt;iE.withErrorBoundary=frt});var oDe=vn((lEr,aDe)=>{"use strict";var G8={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 mrt(e,t){return e+t.charAt(0).toUpperCase()+t.substring(1)}var hrt=["Webkit","ms","Moz","O"];Object.keys(G8).forEach(function(e){hrt.forEach(function(t){G8[mrt(t,e)]=G8[e]})});var Art={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}},grt={isUnitlessNumber:G8,shorthandPropertyExpansions:Art};aDe.exports=grt});var lDe=vn((uEr,sDe)=>{"use strict";var vrt=/^ms-/,yrt=/([A-Z])/g;function brt(e){return e.replace(yrt,"-$1").toLowerCase()}function xrt(e){return brt(e).replace(vrt,"-ms-")}sDe.exports=xrt});var dDe=vn((cEr,fDe)=>{"use strict";var wrt=oDe().isUnitlessNumber,Srt=lDe(),Ert=Array.isArray,uDe=Object.keys,krt=/^(normal|none|(\b(url\([^)]*\)|chapter_counter|attr\([^)]*\)|(no-)?(open|close)-quote|inherit)((\b\s*)|$|\s+))+)$/;function cDe(e,t){return!wrt[e]&&typeof t=="number"?t=""+t+"px":e==="content"&&!krt.test(t)&&(t="'"+t.replace(/'/g,"\\'")+"'"),Srt(e)+": "+t+"; "}function Crt(e){var t="";if(!e||uDe(e).length===0)return t;for(var r=uDe(e),n=0,i=r.length;n{(function(e){typeof ZDe=="object"&&typeof pX<"u"?pX.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 oOe=vn((p7,Tb)=>{var f7=void 0,d7=function(e){return f7||(f7=new Promise(function(t,r){var n=typeof e<"u"?e:{},i=n.onAbort;n.onAbort=function(H){r(new Error(H)),i&&i(H)},n.postRun=n.postRun||[],n.postRun.push(function(){t(n)}),Tb=void 0;var a;a||(a=typeof n<"u"?n:{}),a.onRuntimeInitialized=function(){function H(Ve,ft){switch(typeof ft){case"boolean":xm(Ve,ft?1:0);break;case"number":TE(Ve,ft);break;case"string":ex(Ve,ft,-1,-1);break;case"object":if(ft===null)Jb(Ve);else if(ft.length!=null){var Jt=Fg(ft);qg(Ve,Jt,ft.length,-1),Pg(Jt)}else rA(Ve,"Wrong API use : tried to return a value of an unknown type ("+ft+").",-1);break;default:Jb(Ve)}}function K(Ve,ft){for(var Jt=[],Ar=0;Ar>>0),Ve!=null){var ft=this.filename,Jt="/",Ar=ft;if(Jt&&(Jt=typeof Jt=="string"?Jt:Yt(Jt),Ar=ft?Ce(Jt+"/"+ft):Jt),ft=kn(!0,!0),Ar=gm(Ar,(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(H,K){return A(),H=g.normalize(H),m.readFileSync(H,K?void 0:"utf8")},h=H=>(H=d(H,!0),H.buffer||(H=new Uint8Array(H)),H),p=(H,K,se)=>{A(),H=g.normalize(H),m.readFile(H,function(xe,je){xe?se(xe):K(je.buffer)})},1{var K=new XMLHttpRequest;return K.open("GET",H,!1),K.send(null),K.responseText},u&&(h=H=>{var K=new XMLHttpRequest;return K.open("GET",H,!1),K.responseType="arraybuffer",K.send(null),new Uint8Array(K.response)}),p=(H,K,se)=>{var xe=new XMLHttpRequest;xe.open("GET",H,!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(H,K,se){var xe=K+se;for(se=K;H[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(H,K){return H?O(z,H,K):""}function N(H,K,se,xe){if(!(0=ot){var wr=H.charCodeAt(++Ke);ot=65536+((ot&1023)<<10)|wr&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(H){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 H=S.buffer;P=H,a.HEAP8=q=new Int8Array(H),a.HEAP16=I=new Int16Array(H),a.HEAP32=T=new Int32Array(H),a.HEAPU8=z=new Uint8Array(H),a.HEAPU16=new Uint16Array(H),a.HEAPU32=L=new Uint32Array(H),a.HEAPF32=_=new Float32Array(H),a.HEAPF64=Y=new Float64Array(H)}var te,Q=[],fe=[],Ie=[];function Se(){var H=a.preRun.shift();Q.unshift(H)}var Oe=0,ve=null,ye=null;function me(H){throw a.onAbort&&a.onAbort(H),H="Aborted("+H+")",v(H),k=!0,new WebAssembly.RuntimeError(H+". 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 H=$;try{if(H==$&&x)return new Uint8Array(x);if(h)return h(H);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(H){if(!H.ok)throw"failed to load wasm binary file at '"+$+"'";return H.arrayBuffer()}).catch(function(){return ce()});if(p)return new Promise(function(H,K){p($,function(se){H(new Uint8Array(se))},K)})}return Promise.resolve().then(function(){return ce()})}var R,J;function ee(H){for(;0>0];case"i8":return q[H>>0];case"i16":return I[H>>1];case"i32":return T[H>>2];case"i64":return T[H>>2];case"float":return _[H>>2];case"double":return Y[H>>3];case"*":return L[H>>2];default:me("invalid type for getValue: "+K)}return null}function re(H){var K="i32";switch(K.endsWith("*")&&(K="*"),K){case"i1":q[H>>0]=0;break;case"i8":q[H>>0]=0;break;case"i16":I[H>>1]=0;break;case"i32":T[H>>2]=0;break;case"i64":J=[0,(R=0,1<=+Math.abs(R)?0>>0:~~+Math.ceil((R-+(~~R>>>0))/4294967296)>>>0:0)],T[H>>2]=J[0],T[H+4>>2]=J[1];break;case"float":_[H>>2]=0;break;case"double":Y[H>>3]=0;break;case"*":L[H>>2]=0;break;default:me("invalid type for setValue: "+K)}}var Ee=(H,K)=>{for(var se=0,xe=H.length-1;0<=xe;xe--){var je=H[xe];je==="."?H.splice(xe,1):je===".."?(H.splice(xe,1),se++):se&&(H.splice(xe,1),se--)}if(K)for(;se;se--)H.unshift("..");return H},Ce=H=>{var K=H.charAt(0)==="/",se=H.substr(-1)==="/";return(H=Ee(H.split("/").filter(xe=>!!xe),!K).join("/"))||K||(H="."),H&&se&&(H+="/"),(K?"/":"")+H},_e=H=>{var K=/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/.exec(H).slice(1);return H=K[0],K=K[1],!H&&!K?".":(K&&(K=K.substr(0,K.length-1)),H+K)},he=H=>{if(H==="/")return"/";H=Ce(H),H=H.replace(/\/$/,"");var K=H.lastIndexOf("/");return K===-1?H:H.substr(K+1)};function ze(){if(typeof crypto=="object"&&typeof crypto.getRandomValues=="function"){var H=new Uint8Array(1);return()=>(crypto.getRandomValues(H),H[0])}if(c)try{var K=require("crypto");return()=>K.randomBytes(1)[0]}catch{}return()=>me("randomDevice")}function Ye(){for(var H="",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"";H=K+"/"+H,K=K.charAt(0)==="/"}return H=Ee(H.split("/").filter(xe=>!!xe),!K).join("/"),(K?"/":"")+H||"."}function tt(H,K){var se=Array(D(H)+1);return H=N(H,se,0,se.length),K&&(se.length=H),se}var Ct=[];function we(H,K){Ct[H]={input:[],output:[],Xa:K},Yr(H,Be)}var Be={open:function(H){var K=Ct[H.node.rdev];if(!K)throw new De(43);H.tty=K,H.seekable=!1},close:function(H){H.tty.Xa.fsync(H.tty)},fsync:function(H){H.tty.Xa.fsync(H.tty)},read:function(H,K,se,xe){if(!H.tty||!H.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=H.Ia,H.Ia=new Uint8Array(K),0=H.node.Ma)return 0;if(H=Math.min(H.node.Ma-je,xe),8K)throw new De(28);return K},lb:function(H,K,se){He.qb(H.node,K+se),H.node.Ma=Math.max(H.node.Ma,K+se)},bb:function(H,K,se,xe,je){if((H.node.mode&61440)!==32768)throw new De(43);if(H=H.node.Ia,je&2||H.buffer!==P){if((0{if(H=Ye("/",H),!H)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(H===H.parent)return H=H.Ra.ub,K?H[H.length-1]!=="/"?H+"/"+K:H+K:H;K=K?H.name+"/"+K:H.name,H=H.parent}},Wr=(H,K)=>{for(var se=0,xe=0;xe>>0)%ue.length},en=H=>{var K=Wr(H.parent.id,H.name);if(ue[K]===H)ue[K]=H.Wa;else for(K=ue[K];K;){if(K.Wa===H){K.Wa=H.Wa;break}K=K.Wa}},tn=(H,K)=>{var se;if(se=(se=Pa(H,"x"))?se:H.Ga.lookup?0:2)throw new De(se,H);for(se=ue[Wr(H.id,K)];se;se=se.Wa){var xe=se.name;if(se.parent.id===H.id&&xe===K)return se}return H.Ga.lookup(H,K)},ci=(H,K,se,xe)=>(H=new Ub(H,K,se,xe),K=Wr(H.parent.id,H.name),H.Wa=ue[K],ue[K]=H),is={r:0,"r+":2,w:577,"w+":578,a:1089,"a+":1090},Yi=H=>{var K=["r","w","rw"][H&3];return H&512&&(K+="w"),K},Pa=(H,K)=>{if(Pe)return 0;if(!K.includes("r")||H.mode&292){if(K.includes("w")&&!(H.mode&146)||K.includes("x")&&!(H.mode&73))return 2}else return 2;return 0},Dt=(H,K)=>{try{return tn(H,K),20}catch{}return Pa(H,"wx")},Hc=(H,K,se)=>{try{var xe=tn(H,K)}catch(je){return je.Ka}if(H=Pa(H,"wx"))return H;if(se){if((xe.mode&61440)!==16384)return 54;if(xe===xe.parent||Yt(xe)==="/")return 10}else if((xe.mode&61440)===16384)return 31;return 0},Wf=(H=0)=>{for(;4096>=H;H++)if(!Ge[H])return H;throw new De(33)},Ha=(H,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}}})),H=Object.assign(new sl,H),K=Wf(K),H.fd=K,Ge[K]=H),Eu={open:H=>{H.Ha=et[H.node.rdev].Ha,H.Ha.open&&H.Ha.open(H)},Ta:()=>{throw new De(70)}},Yr=(H,K)=>{et[H]={Ha:K}},zl=(H,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:H,Kb:{},ub:K,Eb:[]},H=H.Ra(K),H.Ra=K,K.root=H,se?Qe=H:je&&(je.Va=K,je.Ra&&je.Ra.Eb.push(K))},gm=(H,K,se)=>{var xe=ht(H,{parent:!0}).node;if(H=he(H),!H||H==="."||H==="..")throw new De(28);var je=Dt(xe,H);if(je)throw new De(je);if(!xe.Ga.ab)throw new De(63);return xe.Ga.ab(xe,H,K,se)},fi=(H,K)=>gm(H,(K!==void 0?K:511)&1023|16384,0),as=(H,K,se)=>{typeof se>"u"&&(se=K,K=438),gm(H,K|8192,se)},Fs=(H,K)=>{if(!Ye(H))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,H)},oa=H=>{var K=ht(H,{parent:!0}).node;H=he(H);var se=tn(K,H),xe=Hc(K,H,!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,H),en(se)},_s=H=>{var K=ht(H,{parent:!0}).node;if(!K)throw new De(44);H=he(H);var se=tn(K,H),xe=Hc(K,H,!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,H),en(se)},Ul=H=>{if(H=ht(H).node,!H)throw new De(44);if(!H.Ga.readlink)throw new De(28);return Ye(Yt(H.parent),H.Ga.readlink(H))},ol=(H,K)=>{if(H=ht(H,{Sa:!K}).node,!H)throw new De(44);if(!H.Ga.Pa)throw new De(63);return H.Ga.Pa(H)},Cg=H=>ol(H,!0),Vc=(H,K)=>{if(H=typeof H=="string"?ht(H,{Sa:!0}).node:H,!H.Ga.Oa)throw new De(63);H.Ga.Oa(H,{mode:K&4095|H.mode&-4096,timestamp:Date.now()})},Dg=(H,K)=>{if(0>K)throw new De(28);if(H=typeof H=="string"?ht(H,{Sa:!0}).node:H,!H.Ga.Oa)throw new De(63);if((H.mode&61440)===16384)throw new De(31);if((H.mode&61440)!==32768)throw new De(28);var se=Pa(H,"w");if(se)throw new De(se);H.Ga.Oa(H,{size:K,timestamp:Date.now()})},_n=(H,K,se)=>{if(H==="")throw new De(44);if(typeof K=="string"){var xe=is[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 H=="object")var je=H;else{H=Ce(H);try{je=ht(H,{Sa:!(K&131072)}).node}catch{}}if(xe=!1,K&64)if(je){if(K&128)throw new De(20)}else je=gm(H,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&&(Yi(K)!=="r"||K&512)?31:Pa(je,Yi(K)):44))throw new De(se);return K&512&&!xe&&Dg(je,0),K&=-131713,je=Ha({node:je,path:Yt(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={}),H in sp||(sp[H]=1)),je},Hf=H=>{if(H.fd===null)throw new De(8);H.hb&&(H.hb=null);try{H.Ha.close&&H.Ha.close(H)}catch(K){throw K}finally{Ge[H.fd]=null}H.fd=null},Og=(H,K,se)=>{if(H.fd===null)throw new De(8);if(!H.seekable||!H.Ha.Ta)throw new De(70);if(se!=0&&se!=1&&se!=2)throw new De(28);H.position=H.Ha.Ta(H,K,se),H.Ib=[]},Gh=(H,K,se,xe,je)=>{if(0>xe||0>je)throw new De(28);if(H.fd===null)throw new De(8);if((H.flags&2097155)===1)throw new De(8);if((H.node.mode&61440)===16384)throw new De(31);if(!H.Ha.read)throw new De(28);var Ke=typeof je<"u";if(!Ke)je=H.position;else if(!H.seekable)throw new De(70);return K=H.Ha.read(H,K,se,xe,je),Ke||(H.position+=K),K},vm=(H,K,se,xe,je)=>{if(0>xe||0>je)throw new De(28);if(H.fd===null)throw new De(8);if((H.flags&2097155)===0)throw new De(8);if((H.node.mode&61440)===16384)throw new De(31);if(!H.Ha.write)throw new De(28);H.seekable&&H.flags&1024&&Og(H,0,2);var Ke=typeof je<"u";if(!Ke)je=H.position;else if(!H.seekable)throw new De(70);return K=H.Ha.write(H,K,se,xe,je,void 0),Ke||(H.position+=K),K},Mg=H=>{var K="binary";if(K!=="utf8"&&K!=="binary")throw Error('Invalid encoding type "'+K+'"');var se,xe=_n(H,xe||0);H=ol(H).size;var je=new Uint8Array(H);return Gh(xe,je,0,H,0),K==="utf8"?se=O(je,0):K==="binary"&&(se=je),Hf(xe),se},Qh=()=>{De||(De=function(H,K){this.node=K,this.Hb=function(se){this.Ka=se},this.Hb(H),this.message="FS error"},De.prototype=Error(),De.prototype.constructor=De,[44].forEach(H=>{at[H]=new De(H),at[H].stack=""}))},Vf,kn=(H,K)=>{var se=0;return H&&(se|=365),K&&(se|=146),se},Ia=(H,K,se)=>{H=Ce("/dev/"+H);var xe=kn(!!K,!!se);Yh||(Yh=64);var je=Yh++<<8|0;Yr(je,{open:Ke=>{Ke.seekable=!1},close:()=>{se&&se.buffer&&se.buffer.length&&se(10)},read:(Ke,ot,wr,Pn)=>{for(var sn=0,sa=0;sa{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(H){if(H=Ge[H],!H)throw new De(8);return H}function i1(H){return L[H>>2]+4294967296*T[H+4>>2]}function a1(H){var K=D(H)+1,se=Kh(K);return se&&N(H,q,se,K),se}function bm(H,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 wr=ot.getTimezoneOffset();T[H>>2]=60*Math.max(je,wr),T[K>>2]=Number(je!=wr),H=xe(Ke),K=xe(ot),H=a1(H),K=a1(K),wr>2]=H,L[se+4>>2]=K):(L[se>>2]=K,L[se+4>>2]=H)}function Gf(H,K,se){Gf.Bb||(Gf.Bb=!0,bm(H,K,se))}var o1;o1=c?()=>{var H=process.hrtime();return 1e3*H[0]+H[1]/1e6}:()=>performance.now();var Qf={};function Wl(){if(!Zh){var H={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 H[K]:H[K]=Qf[K];var se=[];for(K in H)se.push(K+"="+H[K]);Zh=se}return Zh}var Zh,ul=void 0,Ng=[];function Tg(H,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(H))return ul.get(H);if(Ng.length)se=Ng.pop();else{try{te.grow(1)}catch(wr){throw wr instanceof RangeError?"Unable to grow wasm table. Set ALLOW_TABLE_GROWTH.":wr}se=te.length-1}try{te.set(se,H)}catch(wr){if(!(wr instanceof TypeError))throw wr;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:H}}).exports.f}te.set(se,K)}return ul.set(H,se),se}function Xh(H){ul.delete(te.get(H)),Ng.push(H)}var Lb=0,zb=1;function Fg(H){var K=Lb==zb?Cu(H.length):Kh(H.length);return H.subarray||H.slice||(H=new Uint8Array(H)),z.set(H,K),K}function _g(H,K,se,xe){var je={string:sn=>{var sa=0;if(sn!=null&&sn!==0){var Ju=(sn.length<<2)+1;sa=Cu(Ju),N(sn,z,sa,Ju)}return sa},array:sn=>{var sa=Cu(sn.length);return q.set(sn,sa),sa}};H=a["_"+H];var Ke=[],ot=0;if(xe)for(var wr=0;wr{fi("/dev"),Yr(259,{read:()=>0,write:(K,se,xe,je)=>je}),as("/dev/null",259),we(1280,Le),we(1536,Ze),as("/dev/tty",1280),as("/dev/tty1",1536);var H=ze();Ia("random",H),Ia("urandom",H),fi("/dev/shm"),fi("/dev/shm/tmp")})(),(()=>{fi("/proc");var H=fi("/proc/self");fi("/proc/self/fd"),zl({Ra:()=>{var K=ci(H,"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 Wb={a:function(H,K,se,xe){me("Assertion failed: "+C(H)+", at: "+[K?C(K):"unknown filename",se,xe?C(xe):"unknown function"])},h:function(H,K){try{return H=C(H),Vc(H,K),0}catch(se){if(typeof Cn>"u"||!(se instanceof De))throw se;return-se.Ka}},H:function(H,K,se){try{if(K=C(K),K=Gc(H,K),se&-8)return-28;var xe=ht(K,{Sa:!0}).node;return xe?(H="",se&4&&(H+="r"),se&2&&(H+="w"),se&1&&(H+="x"),H&&Pa(xe,H)?-2:0):-44}catch(je){if(typeof Cn>"u"||!(je instanceof De))throw je;return-je.Ka}},i:function(H,K){try{var se=Ge[H];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(H){try{var K=Ge[H];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(H,K,se){ym=se;try{var xe=ll(H);switch(K){case 0:var je=ku();return 0>je?-28:Ha(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[Hb()>>2]=28,-1;default:return-28}}catch(Ke){if(typeof Cn>"u"||!(Ke instanceof De))throw Ke;return-Ke.Ka}},G:function(H,K){try{var se=ll(H);return jg(ol,se.path,K)}catch(xe){if(typeof Cn>"u"||!(xe instanceof De))throw xe;return-xe.Ka}},l:function(H,K,se){try{if(K=se+2097152>>>0<4194305-!!K?(K>>>0)+4294967296*se:NaN,isNaN(K))return-61;var xe=Ge[H];if(!xe)throw new De(8);if((xe.flags&2097155)===0)throw new De(28);return Dg(xe.node,K),0}catch(je){if(typeof Cn>"u"||!(je instanceof De))throw je;return-je.Ka}},B:function(H,K){try{if(K===0)return-28;var se=D("/")+1;return K"u"||!(xe instanceof De))throw xe;return-xe.Ka}},E:function(H,K){try{return H=C(H),jg(Cg,H,K)}catch(se){if(typeof Cn>"u"||!(se instanceof De))throw se;return-se.Ka}},y:function(H,K,se){try{return K=C(K),K=Gc(H,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(H,K,se,xe){try{K=C(K);var je=xe&256;return K=Gc(H,K,xe&4096),jg(je?Cg:ol,K,se)}catch(Ke){if(typeof Cn>"u"||!(Ke instanceof De))throw Ke;return-Ke.Ka}},v:function(H,K,se,xe){ym=xe;try{K=C(K),K=Gc(H,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(H,K,se,xe){try{if(K=C(K),K=Gc(H,K),0>=xe)return-28;var je=Ul(K),Ke=Math.min(xe,D(je)),ot=q[se+Ke];return N(je,z,se,xe+1),q[se+Ke]=ot,Ke}catch(wr){if(typeof Cn>"u"||!(wr instanceof De))throw wr;return-wr.Ka}},s:function(H){try{return H=C(H),oa(H),0}catch(K){if(typeof Cn>"u"||!(K instanceof De))throw K;return-K.Ka}},F:function(H,K){try{return H=C(H),jg(ol,H,K)}catch(se){if(typeof Cn>"u"||!(se instanceof De))throw se;return-se.Ka}},p:function(H,K,se){try{return K=C(K),K=Gc(H,K),se===0?_s(K):se===512?oa(K):me("Invalid flags passed to unlinkat"),0}catch(xe){if(typeof Cn>"u"||!(xe instanceof De))throw xe;return-xe.Ka}},o:function(H,K,se){try{if(K=C(K),K=Gc(H,K,!0),se){var xe=i1(se),je=T[se+8>>2];Ke=1e3*xe+je/1e6,se+=16,xe=i1(se),je=T[se+8>>2],ot=1e3*xe+je/1e6}else var Ke=Date.now(),ot=Ke;H=Ke;var wr=ht(K,{Sa:!0}).node;return wr.Ga.Oa(wr,{timestamp:Math.max(H,ot)}),0}catch(Pn){if(typeof Cn>"u"||!(Pn instanceof De))throw Pn;return-Pn.Ka}},e:function(){return Date.now()},j:function(H,K){H=new Date(1e3*i1(H)),T[K>>2]=H.getSeconds(),T[K+4>>2]=H.getMinutes(),T[K+8>>2]=H.getHours(),T[K+12>>2]=H.getDate(),T[K+16>>2]=H.getMonth(),T[K+20>>2]=H.getFullYear()-1900,T[K+24>>2]=H.getDay();var se=new Date(H.getFullYear(),0,1);T[K+28>>2]=(H.getTime()-se.getTime())/864e5|0,T[K+36>>2]=-(60*H.getTimezoneOffset());var xe=new Date(H.getFullYear(),6,1).getTimezoneOffset();se=se.getTimezoneOffset(),T[K+32>>2]=(xe!=se&&H.getTimezoneOffset()==Math.min(se,xe))|0},w:function(H,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 wr=ot.Ha.bb(ot,H,je,K,se),Pn=wr.Fb;return T[Ke>>2]=wr.vb,Pn}catch(sn){if(typeof Cn>"u"||!(sn instanceof De))throw sn;return-sn.Ka}},x:function(H,K,se,xe,je,Ke){try{var ot=ll(je);if(se&2){var wr=z.slice(H,H+K);ot&&ot.Ha.cb&&ot.Ha.cb(ot,wr,Ke,K,xe)}}catch(Pn){if(typeof Cn>"u"||!(Pn instanceof De))throw Pn;return-Pn.Ka}},n:Gf,q:function(){return 2147483648},d:o1,c:function(H){var K=z.length;if(H>>>=0,2147483648=se;se*=2){var xe=K*(1+.2/se);xe=Math.min(xe,H+100663296);var je=Math;xe=Math.max(H,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(H,K){var se=0;return Wl().forEach(function(xe,je){var Ke=K+se;for(je=L[H+4*je>>2]=Ke,Ke=0;Ke>0]=xe.charCodeAt(Ke);q[je>>0]=0,se+=xe.length+1}),0},A:function(H,K){var se=Wl();L[H>>2]=se.length;var xe=0;return se.forEach(function(je){xe+=je.length+1}),L[K>>2]=xe,0},f:function(H){try{var K=ll(H);return Hf(K),0}catch(se){if(typeof Cn>"u"||!(se instanceof De))throw se;return se.Ka}},m:function(H,K){try{var se=ll(H);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(H,K,se,xe){try{e:{var je=ll(H);H=K;for(var Ke=K=0;Ke>2],wr=L[H+4>>2];H+=8;var Pn=Gh(je,q,ot,wr);if(0>Pn){var sn=-1;break e}if(K+=Pn,Pn>2]=sn,0}catch(sa){if(typeof Cn>"u"||!(sa instanceof De))throw sa;return sa.Ka}},k:function(H,K,se,xe,je){try{if(K=se+2097152>>>0<4194305-!!K?(K>>>0)+4294967296*se:NaN,isNaN(K))return 61;var Ke=ll(H);return Og(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(H){try{var K=ll(H);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(H,K,se,xe){try{e:{var je=ll(H);H=K;for(var Ke=K=0;Ke>2],wr=L[H+4>>2];H+=8;var Pn=vm(je,q,ot,wr);if(0>Pn){var sn=-1;break e}K+=Pn}sn=K}return L[xe>>2]=sn,0}catch(sa){if(typeof Cn>"u"||!(sa instanceof De))throw sa;return sa.Ka}}};(function(){function H(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){H(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:Wb};if(Oe++,a.monitorRunDependencies&&a.monitorRunDependencies(Oe),a.instantiateWasm)try{return a.instantiateWasm(xe,H)}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 Hb=a.___errno_location=function(){return(Hb=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 Kh=a._malloc=function(){return(Kh=a._malloc=a.asm.ya).apply(null,arguments)},Pg=a._free=function(){return(Pg=a._free=a.asm.za).apply(null,arguments)};a._RegisterExtensionFunctions=function(){return(a._RegisterExtensionFunctions=a.asm.Ba).apply(null,arguments)};var Vb=a._emscripten_builtin_memalign=function(){return(Vb=a._emscripten_builtin_memalign=a.asm.Ca).apply(null,arguments)},Jh=a.stackSave=function(){return(Jh=a.stackSave=a.asm.Da).apply(null,arguments)},eA=a.stackRestore=function(){return(eA=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=Jh,a.stackRestore=eA,a.cwrap=function(H,K,se,xe){se=se||[];var je=se.every(Ke=>Ke==="number"||Ke==="boolean");return K!=="string"&&je&&!xe?a["_"+H]:function(){return _g(H,K,se,arguments)}};var Ig;ye=function H(){Ig||Gb(),Ig||(ye=H)};function Gb(){function H(){if(!Ig&&(Ig=!0,a.calledRun=!0,!k)){if(a.noFSInit||Vf||(Vf=!0,Qh(),a.stdin=a.stdin,a.stdout=a.stdout,a.stderr=a.stderr,a.stdin?Ia("stdin",a.stdin):Fs("/dev/tty","/dev/stdin"),a.stdout?Ia("stdout",null,a.stdout):Fs("/dev/tty","/dev/stdout"),a.stderr?Ia("stderr",null,a.stderr):Fs("/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 OOe=bl();yX.createRoot=OOe.createRoot,yX.hydrateRoot=OOe.hydrateRoot;var TDr});var iMe=vn((nMe,NX)=>{(function(e){if(typeof nMe=="object"&&typeof NX<"u")NX.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;fepR});module.exports=E_e(knt);var vDe=Ae(Qa());var gJ=Ae(AJ()),Y$=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:{openNativeMenu:"Obsidian options",layout:"Layout",enterFlowState:"Enter Flow State",exitFlowState:"Exit Flow State",newView:"New View",calendarView:"Calendar View",dayView:"Day View",closeSpace:"Remove from 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",applyItems:"Apply to items in folder",rename:"Rename",changeToFolderNote:"Transform into Folder",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 ${1}",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:"Color",labels:"Labels",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:"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 Tag",cancel:"Cancel",search:"Search",delete:"Delete",toggleFlow:"Toggle Flow",openFlow:"Open Flow",hideFlow:"Hide Flow",openLink:"Open Link",addToSpace:"Pin file to...",addToSpaceShort:"Pin",addTag:"Add Tag",saveTemplate:"Make into template",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"},editStickerInSidebar:{name:"Edit Stickers in Sidebar",desc:"Edit stickers directly in the sidebar"},notesPreview:{name:"Notes Preview",desc:"Show a preview of notes, may cause performance issues"},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=gJ.default.locale();["en"].includes(t)&&(this.lang=t)}get texts(){return this.all.en}},W=new Y$().texts;var mA=(e,t)=>JSON.stringify({...t,options:e.map(r=>({name:r.name,value:r.value,color:r.color}))});var Xg="spaces://$",Kg="spaces://$tags";var pr="files",yp={id:pr,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)],pM=e=>[...new Map(e.map(t=>[t.toLowerCase(),t])).values()],ji=(e,t)=>{let r=e;if(t.includes(r)){let n=1;for(;t.includes(r);)r=e+n.toString(),n+=1}return r},vJ=e=>(t,r,n)=>n.findIndex(i=>t[e]==i[e])===r;var yJ=(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 Vl=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=Vl(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:Vl(`${a?`${f}://${a}/${o!="/"?o:""}`:o}`),authority:a,fullPath:t,scheme:f,path:Vl(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]},bJ=(e,t)=>{let r=e.substring(0,e.lastIndexOf("/"));return r.length>0?`${r}/${t}`:`${t}`},xJ=(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 ir=e=>{let t;try{t=JSON.parse(e)}catch{}return t};var mM=(e,t)=>!e||e.length==0?t:e;function dl(e){return Array.isArray(e)?e:typeof e=="string"?[e]:[]}function wJ(e,t,r){let n=Rs(e);return t.some(i=>i==n)?n:r}function Rs(e){if(!e)return"";if(typeof e!="string"){let t=e.toString();return typeof t=="string"?t:""}return e}function YE(e){return!!e}var SJ=(e,t)=>t.indexOf(e)>0?t.indexOf(e):t.length,EJ=(e,t)=>t.spacesIndex.get(e)?.name??e,kJ=e=>"spaces://"+ZE(e),ZE=e=>e?.replace(/\//g,"+"),Hn=e=>"spaces://"+e;var CJ=e=>e?`(${e})`:null,jr=e=>e?`"${e.replace(/"/g,'\\"').replace(/\n/g,"\\n")}"`:null,Z$=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},Sa=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,'"')},hA=(e,t)=>!e||e.length==0?t:e,hM=e=>e.charAt(0)=="/"?e.substring(1):e,DJ=e=>hM(e.substring(0,e.lastIndexOf("/")))||e;function $s(e){return $s=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},$s(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||$s(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 la(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 Ea(e,t){if(ut(2,arguments),!t||$s(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?la(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 C_e=36e5;function Ox(e,t){ut(2,arguments);var r=Cr(t);return ad(e,r*C_e)}var D_e={};function Gl(){return D_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 K$(e){ut(1,arguments);var t=X$(e),r=new Date(0);r.setFullYear(t,0,4),r.setHours(0,0,0,0);var n=tf(r);return n}function AA(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 Vn(e){ut(1,arguments);var t=Mt(e);return t.setHours(0,0,0,0),t}var O_e=864e5;function od(e,t){ut(2,arguments);var r=Vn(e),n=Vn(t),i=r.getTime()-AA(r),a=n.getTime()-AA(n);return Math.round((i-a)/O_e)}var M_e=6e4;function XE(e,t){ut(2,arguments);var r=Cr(t);return ad(e,r*M_e)}function Jg(e,t){ut(2,arguments);var r=Cr(t),n=r*7;return la(e,n)}function AM(e,t){ut(2,arguments);var r=Cr(t);return Uo(e,r*12)}function gM(e){ut(1,arguments);var t;if(e&&typeof e.forEach=="function")t=e;else if($s(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 j_e=365.2425,N_e=Math.pow(10,8)*24*60*60*1e3,J$=6e4,eq=36e5;var aat=-N_e;var T_e=3600;var OJ=T_e*24,oat=OJ*7,F_e=OJ*j_e,__e=F_e/12,sat=__e*3;function pl(e,t){ut(2,arguments);var r=Vn(e),n=Vn(t);return r.getTime()===n.getTime()}function O1(e){return ut(1,arguments),e instanceof Date||$s(e)==="object"&&Object.prototype.toString.call(e)==="[object Date]"}function tq(e){if(ut(1,arguments),!O1(e)&&typeof e!="number")return!1;var t=Mt(e);return!isNaN(Number(t))}function e0(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 P_e=6048e5;function rq(e,t,r){ut(2,arguments);var n=mo(e,r),i=mo(t,r),a=n.getTime()-AA(n),o=i.getTime()-AA(i);return Math.round((a-o)/P_e)}function Mx(e){ut(1,arguments);var t=Mt(e);return t.setHours(23,59,59,999),t}function t0(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 yM(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 gA(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 aq(e){ut(1,arguments);var t=JE(e),r=new Date(0);r.setUTCFullYear(t,0,4),r.setUTCHours(0,0,0,0);var n=r0(r);return n}var B_e=6048e5;function oq(e){ut(1,arguments);var t=Mt(e),r=r0(t).getTime()-aq(t).getTime();return Math.round(r/B_e)+1}function n0(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=n0(h,t),g=new Date(0);g.setUTCFullYear(f,0,p),g.setUTCHours(0,0,0,0);var A=n0(g,t);return c.getTime()>=m.getTime()?f+1:c.getTime()>=A.getTime()?f:f-1}function sq(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=ek(e,t),p=new Date(0);p.setUTCFullYear(d,0,f),p.setUTCHours(0,0,0,0);var h=n0(p,t);return h}var R_e=6048e5;function lq(e,t){ut(1,arguments);var r=Mt(e),n=n0(r,t).getTime()-sq(r,t).getTime();return Math.round(n/R_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)}},vA=$_e;var jx={am:"am",pm:"pm",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},q_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 vA.y(t,r)},Y:function(t,r,n,i){var a=ek(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=JE(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 vA.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=lq(t,i);return r==="wo"?n.ordinalNumber(a,{unit:"week"}):ui(a,r.length)},I:function(t,r,n){var i=oq(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"}):vA.d(t,r)},D:function(t,r,n){var i=iq(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 vA.h(t,r)},H:function(t,r,n){return r==="Ho"?n.ordinalNumber(t.getUTCHours(),{unit:"hour"}):vA.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"}):vA.m(t,r)},s:function(t,r,n){return r==="so"?n.ordinalNumber(t.getUTCSeconds(),{unit:"second"}):vA.s(t,r)},S:function(t,r){return vA.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 jJ(o);case"XXXX":case"XX":return M1(o);case"XXXXX":case"XXX":default:return M1(o,":")}},x:function(t,r,n,i){var a=i._originalDate||t,o=a.getTimezoneOffset();switch(r){case"x":return jJ(o);case"xxxx":case"xx":return M1(o);case"xxxxx":case"xxx":default:return M1(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"+MJ(o,":");case"OOOO":default:return"GMT"+M1(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"+MJ(o,":");case"zzzz":default:return"GMT"+M1(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 MJ(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 jJ(e,t){if(e%60===0){var r=e>0?"-":"+";return r+ui(Math.abs(e)/60,2)}return M1(e,t)}function M1(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 NJ=q_e;var TJ=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"})}},FJ=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"})}},L_e=function(t,r){var n=t.match(/(P+)(p+)?/)||[],i=n[1],a=n[2];if(!a)return TJ(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}}",TJ(i,r)).replace("{{time}}",FJ(a,r))},z_e={p:FJ,P:L_e},_J=z_e;var U_e=["D","DD"],W_e=["YY","YYYY"];function PJ(e){return U_e.indexOf(e)!==-1}function IJ(e){return W_e.indexOf(e)!==-1}function uq(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 H_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"}},V_e=function(t,r,n){var i,a=H_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},BJ=V_e;function tk(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 G_e={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},Q_e={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},Y_e={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},Z_e={date:tk({formats:G_e,defaultWidth:"full"}),time:tk({formats:Q_e,defaultWidth:"full"}),dateTime:tk({formats:Y_e,defaultWidth:"full"})},RJ=Z_e;var X_e={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},K_e=function(t,r,n,i){return X_e[t]},$J=K_e;function j1(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 J_e={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},e4e={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},t4e={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"]},r4e={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"]},n4e={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"}},i4e={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"}},a4e=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"},o4e={ordinalNumber:a4e,era:j1({values:J_e,defaultWidth:"wide"}),quarter:j1({values:e4e,defaultWidth:"wide",argumentCallback:function(t){return t-1}}),month:j1({values:t4e,defaultWidth:"wide"}),day:j1({values:r4e,defaultWidth:"wide"}),dayPeriod:j1({values:n4e,defaultWidth:"wide",formattingValues:i4e,defaultFormattingWidth:"wide"})},qJ=o4e;function N1(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)?l4e(s,function(f){return f.test(o)}):s4e(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 s4e(e,t){for(var r in e)if(e.hasOwnProperty(r)&&t(e[r]))return r}function l4e(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 u4e=/^(\d+)(th|st|nd|rd)?/i,c4e=/\d+/i,f4e={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},d4e={any:[/^b/i,/^(a|c)/i]},p4e={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},m4e={any:[/1/i,/2/i,/3/i,/4/i]},h4e={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},A4e={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]},g4e={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},v4e={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]},y4e={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},b4e={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}},x4e={ordinalNumber:cq({matchPattern:u4e,parsePattern:c4e,valueCallback:function(t){return parseInt(t,10)}}),era:N1({matchPatterns:f4e,defaultMatchWidth:"wide",parsePatterns:d4e,defaultParseWidth:"any"}),quarter:N1({matchPatterns:p4e,defaultMatchWidth:"wide",parsePatterns:m4e,defaultParseWidth:"any",valueCallback:function(t){return t+1}}),month:N1({matchPatterns:h4e,defaultMatchWidth:"wide",parsePatterns:A4e,defaultParseWidth:"any"}),day:N1({matchPatterns:g4e,defaultMatchWidth:"wide",parsePatterns:v4e,defaultParseWidth:"any"}),dayPeriod:N1({matchPatterns:y4e,defaultMatchWidth:"any",parsePatterns:b4e,defaultParseWidth:"any"})},LJ=x4e;var w4e={code:"en-US",formatDistance:BJ,formatLong:RJ,formatRelative:$J,localize:qJ,match:LJ,options:{weekStartsOn:0,firstWeekContainsDate:1}},rk=w4e;var zJ=rk;var S4e=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,E4e=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,k4e=/^'([^]*?)'?$/,C4e=/''/g,D4e=/[a-zA-Z]/;function Ya(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:zJ,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(!tq(C))throw new RangeError("Invalid time value");var N=AA(C),D=nq(C,N),P={firstWeekContainsDate:j,weekStartsOn:O,locale:k,_originalDate:C},q=w.match(E4e).map(function(z){var I=z[0];if(I==="p"||I==="P"){var T=_J[I];return T(z,k.formatLong)}return z}).join("").match(S4e).map(function(z){if(z==="''")return"'";var I=z[0];if(I==="'")return O4e(z);var T=NJ[I];if(T)return!(r!=null&&r.useAdditionalWeekYearTokens)&&IJ(z)&&uq(z,t,String(e)),!(r!=null&&r.useAdditionalDayOfYearTokens)&&PJ(z)&&uq(z,t,String(e)),T(D,z,k.localize,P);if(I.match(D4e))throw new RangeError("Format string contains an unescaped latin alphabet character `"+I+"`");return z}).join("");return q}function O4e(e){var t=e.match(k4e);return t?t[1].replace(C4e,"'"):e}function fq(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 M4e=6048e5;function bM(e){ut(1,arguments);var t=Mt(e),r=tf(t).getTime()-K$(t).getTime();return Math.round(r/M4e)+1}function dq(e){ut(1,arguments);var t=Mt(e),r=t.getTime();return r}function xM(e){return ut(1,arguments),Math.floor(dq(e)/1e3)}function pq(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 mq(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=pq(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 j4e=6048e5;function wM(e,t){ut(1,arguments);var r=Mt(e),n=mo(r,t).getTime()-mq(r,t).getTime();return Math.round(n/j4e)+1}function hq(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 SM(e,t){return ut(1,arguments),rq(hq(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 nk(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],kM.timeZoneDelimiter.test(t.date)&&(t.date=e.split(kM.timeZoneDelimiter)[0],n=e.substr(t.date.length,e.length))),n){var i=kM.timezone.exec(n);i?(t.time=n.replace(i[1],""),t.timezone=i[1]):t.time=n}return t}function P4e(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 I4e(e,t){if(t===null)return new Date(NaN);var r=e.match(N4e);if(!r)return new Date(NaN);var n=!!r[4],i=ak(r[1]),a=ak(r[2])-1,o=ak(r[3]),s=ak(r[4]),l=ak(r[5])-1;if(n)return U4e(t,s,l)?$4e(t,s,l):new Date(NaN);var u=new Date(0);return!L4e(t,a,o)||!z4e(t,i)?new Date(NaN):(u.setUTCFullYear(t,a,Math.max(i,o)),u)}function ak(e){return e?parseInt(e):1}function B4e(e){var t=e.match(T4e);if(!t)return NaN;var r=vq(t[1]),n=vq(t[2]),i=vq(t[3]);return W4e(r,n,i)?r*eq+n*J$+i*1e3:NaN}function vq(e){return e&&parseFloat(e.replace(",","."))||0}function R4e(e){if(e==="Z")return 0;var t=e.match(F4e);if(!t)return 0;var r=t[1]==="+"?-1:1,n=parseInt(t[2]),i=t[3]&&parseInt(t[3])||0;return H4e(n,i)?r*(n*eq+i*J$):NaN}function $4e(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 q4e=[31,null,31,30,31,30,31,31,30,31,30,31];function UJ(e){return e%400===0||e%4===0&&e%100!==0}function L4e(e,t,r){return t>=0&&t<=11&&r>=1&&r<=(q4e[t]||(UJ(e)?29:28))}function z4e(e,t){return t>=1&&t<=(UJ(e)?366:365)}function U4e(e,t,r){return t>=1&&t<=53&&r>=0&&r<=6}function W4e(e,t,r){return e===24?t===0&&r===0:r>=0&&r<60&&t>=0&&t<60&&e>=0&&e<25}function H4e(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=fq(o);return r.setMonth(n,Math.min(a,s)),r}function ok(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 yq=(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 WJ=({field:e,value:t})=>t=="ctime"?{value:"parseDate(prop('File')['metadata']['ctime'])",type:"date"}:{value:"",type:"string"},mr=(e,t,r,n)=>{let i=ir(e);if(i)return t=="fileprop"&&i.field?WJ(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=yq(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=WJ({field:a,value:o})}else i={};else t.startsWith("option")&&(e?.length>0?i={options:tr(e).map(o=>({name:o,value:o}))}:i={});return i??{}};var ua={uniques:["name,schemaId"],cols:["name","schemaId","type","value","attrs","hidden","unique","primary"]},sd={...ua,rows:[{name:mt,schemaId:pr,type:"file",primary:"true",hidden:"",unique:"",attrs:"",value:""},{name:"Created",schemaId:pr,type:"fileprop",value:mt+".ctime",hidden:"",unique:"",attrs:"",primary:"true"}]},bq=e=>sd,Px=[{name:"Name",schemaId:"",type:"text",primary:"true"}],DM={...ua,rows:[{name:mt,schemaId:pr,type:"file",primary:"true",hidden:"",unique:"",attrs:"",value:""}]};var ho=e=>e?e.type=="fileprop"?mr(e.value,"fileprop")?.type??"text":e.type:null,Ri=e=>e.attrs?.length>0?ir(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",HJ=e=>ir(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:W.properties.text.label,metadata:!0,icon:"ui//text",primative:!0,description:W.properties.text.description},{type:"number",label:W.properties.number.label,metadata:!0,icon:"ui//binary",configKeys:["unit"],primative:!0,description:W.properties.number.description},{type:"boolean",label:W.properties.boolean.label,metadata:!0,icon:"ui//check-square",primative:!0,description:W.properties.boolean.description},{type:"date",label:W.properties.date.label,metadata:!0,icon:"ui//calendar",configKeys:["format"],primative:!0,description:W.properties.date.description},{type:"option",label:W.properties.option.label,multi:!0,multiType:"option-multi",icon:"ui//list",configKeys:["options","source"],description:W.properties.option.description},{type:"tags-multi",label:W.properties.tags.label,icon:"ui//tags",description:W.properties.tags.description},{type:"file",label:W.properties.file.label,restricted:!0,icon:"ui//mk-make-h3"},{type:"fileprop",label:W.properties.fileProperty.label,icon:"ui//formula",configKeys:["field","value","type"],description:W.properties.fileProperty.description},{type:"link",label:W.properties.link.label,multi:!0,multiType:"link-multi",metadata:!0,icon:"ui//file-text",primative:!0,description:W.properties.link.description},{type:"context",label:W.properties.context.label,icon:"ui//mk-make-note",multi:!0,multiType:"context-multi",configKeys:["space","field"],description:W.properties.context.description},{type:"aggregate",label:W.properties.aggregate.label,icon:"ui//mk-make-note",multi:!1,configKeys:["ref","field","fn"],description:W.properties.aggregate.description},{type:"object",label:W.properties.object.label,multi:!0,multiType:"object-multi",metadata:!0,icon:"ui//list-tree",configKeys:["type","typeName"],description:W.properties.object.description},{type:"icon",label:W.properties.icon.label,multi:!0,multiType:"icon-multi",icon:"ui//gem",restricted:!0,primative:!0,description:W.properties.icon.description},{type:"image",label:W.properties.image.label,multi:!0,multiType:"image-multi",metadata:!0,icon:"ui//mk-make-image",primative:!0,description:W.properties.image.description},{type:"color",label:W.properties.color.label,icon:"ui//mk-make-image",restricted:!0,description:W.properties.color.description},{type:"space",label:W.properties.space.label,icon:"ui//layout-grid",restricted:!0,description:W.properties.space.description},{type:"table",label:W.properties.space.label,icon:"ui//layout-grid",restricted:!0,description:W.properties.space.description},{type:"super",label:W.properties.super.label,icon:"ui//zap",restricted:!0,configKeys:["dynamic","field"]},{type:"input",label:W.properties.super.label,icon:"ui//input",restricted:!0}];var i0="filesView",bp={id:i0,name:"All",type:"view",def:JSON.stringify({db:pr,icon:"ui//file-stack"})},T1="main",OM=e=>({id:e,name:e,type:"frame",def:"",predicate:"",primary:"true"}),VJ={uniques:[],cols:["id","name","type","def","predicate","primary"],rows:[OM(T1),bp]},yA={uniques:[],cols:["id","name","type","def","predicate","primary"],rows:[yp]},GJ=e=>V4e,V4e={schema:yp,cols:sd.rows,rows:[]},Zut={schema:yp,cols:sd.rows,rows:[]},Xut={schema:yp,cols:DM.rows,rows:[]},QJ=(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:[]}}}),{}),YJ=e=>G4e,G4e={m_schema:yA,m_fields:sd,...QJ(sd.rows,yA.rows)},Kut={m_schema:yA,m_fields:DM,...QJ(DM.rows,yA.rows)};var bA=(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=tr(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=>bA(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 Ya(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 xq=(e,t)=>t?t=="number"?parseFloat(e):t=="boolean"?e=="true":t.includes("-multi")?tr(e).map(r=>ca(t.replace("-multi",""),r,!1)):e:e,ca=(e,t,r)=>e?e=="object"||e=="object-multi"?JSON.parse(t):e=="number"?parseFloat(t):e=="boolean"?t=="true":e.includes("-multi")?tr(t).map(n=>ca(e.replace("-multi",""),n,r)):(e.includes("link")||e.includes("context"))&&r?`[[${t}]]`:t:t,wq=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 ss=e=>e.map(t=>t.replace(",","\\,")).join(", "),yi=e=>JSON.stringify(e),Sq=e=>e.join(", "),ZJ=e=>e.join("; "),XJ=e=>e.join(",");var tr=e=>e?.startsWith("[")?dl(ir(e)).map(t=>Rs(t)):qx(e),qx=e=>(e?.replace("\\,",",")?.match(/(\\.|[^,])+/g)??[]).map(t=>t.trim()),$i=(e,t,r)=>{let n=r??bA(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=Ya(t,"yyyy-MM-dd");return typeof i=="string"?i:""}return typeof t!="string"?"":t}break;case"duration":return ss(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):yi(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(ir(e)):ir(e)??{};var $x=e=>{if(!e)return"";let t=/\[\[(.*?)\]\]/g.exec(e),r=t?.length>1?t[1].substring(0,SJ("|",t[1])):e;return r||e};var sk=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(Xg)?"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==pr&&r.type.startsWith("option")){let n=kr([...this.superstate.spacesMap.getInverse(t)??[]].flatMap(a=>tr(this.superstate.pathsIndex.get(a)?.metadata?.property?.[r.name])??[])),i=mA(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 a0=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 F1=class{constructor(){this.filesystems=[];this.filetypes=[];this.eventDispatch=new a0}static create(){return new F1}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 _1=(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},o0=e=>hM(e.substring(e.lastIndexOf("/")))||e,KJ=e=>{let t=[],r=e.split("/"),n="";for(let i=0;ie.lastIndexOf("/")!=-1?e.lastIndexOf(".")!=-1?hM(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,Tu=e=>{let t=e.lastIndexOf("/");return t==-1?"/":e.substring(0,t+1)};var Eq=async(e,t,r)=>{let n=Q4e(e,t),i=zx(kq(r)),a=e.spaceManager.pathsForTag(t);for(let o of a)e.spaceManager.renameTag(o,t,i);await tee(e,t,i);for(let o of n)await Eq(e,o,o.replace(t,i));return i},JJ=e=>{e.startsWith("#")&&(e=e.slice(1));let t=e.split("/"),r=[];for(let n=0;ne.trim(),Q4e=(e,t)=>e.spaceManager.readTags().filter(n=>n.startsWith(t)&&n!=t),eee=e=>ZE(zx(e)),MM=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"?Eq(e,n.name,r):e.spaceManager.renameSpace(t,bJ(t,r))}else return e.spaceManager.renamePath(t,xJ(t,r))},jM=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))},ree=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))},P1=async(e,t)=>{e.spaceManager.deletePath(t),e.onPathDeleted(t)},nee=async(e,t,r)=>e.spaceManager.renamePath(t,jm(t,r)),NM=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 iee=(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 TM=(e,t)=>t.spacesFolder+"/"+e;var Wee=Ae(bi());var Zx=Ae(bi());var uk=["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(uk.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=uk[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 fa=function(e){return e!=null},af=function(e){return typeof e=="number"},Cq=function(e){return typeof e=="string"&&uk.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 oee=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},FM=function(e,t){return{div:Math.floor(e/t),mod:Ql(e,t)}},of=function(e){return!fa(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))},Y4e=[31,28,31,30,31,30,31,31,30,31,30,31],lee=1e3*60*60*24,_M=9999,uee=Tm(1970,1,1),Z4e=[6,0,1,2,3,4,5];var Hx=function(e){return e%4===0&&e%100!==0||e%400===0},Dq=function(e){return e instanceof Date},B1=function(e){return Dq(e)&&!isNaN(e.getTime())};var X4e=function(e,t){var r=e.getTime(),n=t.getTime(),i=r-n;return Math.round(i/lee)},ck=function(e){return X4e(e,uee)},PM=function(e){return new Date(uee.getTime()+e*lee)},K4e=function(e){var t=e.getUTCMonth();return t===1&&Hx(e.getUTCFullYear())?29:Y4e[t]},xA=function(e){return Z4e[e.getUTCDay()]},Oq=function(e,t){var r=Tm(e,t+1,1);return[xA(r),K4e(r)]},IM=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()))},BM=function(e){var t=new Date(e.getTime());return t},Mq=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}(),SA=J4e;var jq=function(e,t){return jq=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])},jq(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");jq(e,t);function r(){this.constructor=e}e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}var Ni=function(){return Ni=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 dk(e,t){t===void 0&&(t=q1);var r={},n=new aPe(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 pk(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=FM(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=FM(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=FM(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=Oq(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>_M))return;r=Oq(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 Fq(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)||fa(t.byweekday)||fa(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=[xA(t.dtstart)];break}if(fa(t.bymonth)&&!Al(t.bymonth)&&(t.bymonth=[t.bymonth]),fa(t.byyearday)&&!Al(t.byyearday)&&af(t.byyearday)&&(t.byyearday=[t.byyearday]),!fa(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(fa(t.byweekno)&&!Al(t.byweekno)&&(t.byweekno=[t.byweekno]),!fa(t.byweekday))t.bynweekday=null;else if(af(t.byweekday))t.byweekday=[t.byweekday],t.bynweekday=null;else if(Cq(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 fa(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 EA(e);if(b>=r){var v=Pee(b,t);if(!e.accept(v)||s&&(--s,!s))return EA(e)}}else for(var A=p;Aa)return EA(e);if(b>=r){var v=Pee(b,t);if(!e.accept(v)||s&&(--s,!s))return EA(e)}}}if(t.interval===0||(l.add(t,m),l.year>_M))return EA(e);pk(n)||(c=u.gettimeset(n)(l.hour,l.minute,l.second,0)),u.rebuild(l.year,l.month)}}function gPe(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 Pee(e,t){return new L1(e,t.tzid).rezonedDate()}function EA(e){return e.getValue()}function vPe(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)},mk={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},vee=Object.keys(mk),Wt=function(){function e(t,r){t===void 0&&(t={}),r===void 0&&(r=!1),this._cache=r?null:new xee,this.origOptions=Fq(t);var n=Aee(t).parsedOptions;this.options=n}return e.parseText=function(t,r){return dk(t,r)},e.fromText=function(t,r){return dee(t,r)},e.fromString=function(t){return new e(e.parseString(t)||void 0)},e.prototype._iter=function(t){return $M(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 Tq("all",{},t));var r=this._cacheGet("all");return r===!1&&(r=this._iter(new SA("all",{})),this._cacheAdd("all",r)),r},e.prototype.between=function(t,r,n,i){if(n===void 0&&(n=!1),!B1(t)||!B1(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 Tq("between",a,i));var o=this._cacheGet("between",a);return o===!1&&(o=this._iter(new SA("between",a)),this._cacheAdd("between",o,a)),o},e.prototype.before=function(t,r){if(r===void 0&&(r=!1),!B1(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 SA("before",n)),this._cacheAdd("before",i,n)),i},e.prototype.after=function(t,r){if(r===void 0&&(r=!1),!B1(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 SA("after",n)),this._cacheAdd("after",i,n)),i},e.prototype.count=function(){return this.all().length},e.prototype.toString=function(){return gk(this.origOptions)},e.prototype.toText=function(t,r,n){return pee(this,t,r,n)},e.prototype.isFullyConvertibleToText=function(){return mee(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=Ak,e.optionsToString=gk,e}();function Iee(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 L1(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 Iq(u);return c.dtstart(s),c.tzid(l||void 0),n.forEach(function(d){c.rrule(new Wt(Pq(d,s,l),u))}),i.forEach(function(d){c.rdate(d)}),a.forEach(function(d){c.exrule(new Wt(Pq(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(Pq(f,f.dtstart||t.dtstart||s,f.tzid||t.tzid||l),u)}function qM(e,t){return t===void 0&&(t={}),xPe(e,wPe(t))}function Pq(e,t,r){return Ni(Ni({},e),{dtstart:t,tzid:r})}function wPe(e){var t=[],r=Object.keys(e),n=Object.keys(Bee);if(r.forEach(function(i){Bn(n,i)||t.push(i)}),t.length)throw new Error("Invalid options: "+t.join(", "));return Ni(Ni({},Bee),e)}function SPe(e){if(e.indexOf(":")===-1)return{name:"RRULE",value:e};var t=oee(e,":",1),r=t[0],n=t[1];return{name:r,value:n}}function EPe(e){var t=SPe(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 kPe(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 CPe(e){e.forEach(function(t){if(!/(VALUE=DATE(-TIME)?)|(TZID=)/.test(t))throw new Error("unsupported RDATE/EXDATE parm: "+t)})}function Ree(e,t){return CPe(t),e.split(",").map(function(r){return fk(r)})}function $ee(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;n=K||(K=Math.max(K,se*(1048576>se?2:1.125)>>>0),se!=0&&(K=Math.max(K,256)),se=H.Ia,H.Ia=new Uint8Array(K),0=H.node.Ma)return 0;if(H=Math.min(H.node.Ma-je,xe),8K)throw new De(28);return K},lb:function(H,K,se){He.qb(H.node,K+se),H.node.Ma=Math.max(H.node.Ma,K+se)},bb:function(H,K,se,xe,je){if((H.node.mode&61440)!==32768)throw new De(43);if(H=H.node.Ia,je&2||H.buffer!==P){if((0{if(H=Ye("/",H),!H)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(H===H.parent)return H=H.Ra.ub,K?H[H.length-1]!=="/"?H+"/"+K:H+K:H;K=K?H.name+"/"+K:H.name,H=H.parent}},Wr=(H,K)=>{for(var se=0,xe=0;xe>>0)%ue.length},en=H=>{var K=Wr(H.parent.id,H.name);if(ue[K]===H)ue[K]=H.Wa;else for(K=ue[K];K;){if(K.Wa===H){K.Wa=H.Wa;break}K=K.Wa}},tn=(H,K)=>{var se;if(se=(se=Pa(H,"x"))?se:H.Ga.lookup?0:2)throw new De(se,H);for(se=ue[Wr(H.id,K)];se;se=se.Wa){var xe=se.name;if(se.parent.id===H.id&&xe===K)return se}return H.Ga.lookup(H,K)},ci=(H,K,se,xe)=>(H=new Ub(H,K,se,xe),K=Wr(H.parent.id,H.name),H.Wa=ue[K],ue[K]=H),is={r:0,"r+":2,w:577,"w+":578,a:1089,"a+":1090},Yi=H=>{var K=["r","w","rw"][H&3];return H&512&&(K+="w"),K},Pa=(H,K)=>{if(Pe)return 0;if(!K.includes("r")||H.mode&292){if(K.includes("w")&&!(H.mode&146)||K.includes("x")&&!(H.mode&73))return 2}else return 2;return 0},Dt=(H,K)=>{try{return tn(H,K),20}catch{}return Pa(H,"wx")},Hc=(H,K,se)=>{try{var xe=tn(H,K)}catch(je){return je.Ka}if(H=Pa(H,"wx"))return H;if(se){if((xe.mode&61440)!==16384)return 54;if(xe===xe.parent||Yt(xe)==="/")return 10}else if((xe.mode&61440)===16384)return 31;return 0},Wf=(H=0)=>{for(;4096>=H;H++)if(!Ge[H])return H;throw new De(33)},Ha=(H,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}}})),H=Object.assign(new sl,H),K=Wf(K),H.fd=K,Ge[K]=H),Eu={open:H=>{H.Ha=et[H.node.rdev].Ha,H.Ha.open&&H.Ha.open(H)},Ta:()=>{throw new De(70)}},Yr=(H,K)=>{et[H]={Ha:K}},zl=(H,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:H,Kb:{},ub:K,Eb:[]},H=H.Ra(K),H.Ra=K,K.root=H,se?Qe=H:je&&(je.Va=K,je.Ra&&je.Ra.Eb.push(K))},gm=(H,K,se)=>{var xe=ht(H,{parent:!0}).node;if(H=he(H),!H||H==="."||H==="..")throw new De(28);var je=Dt(xe,H);if(je)throw new De(je);if(!xe.Ga.ab)throw new De(63);return xe.Ga.ab(xe,H,K,se)},fi=(H,K)=>gm(H,(K!==void 0?K:511)&1023|16384,0),as=(H,K,se)=>{typeof se>"u"&&(se=K,K=438),gm(H,K|8192,se)},Fs=(H,K)=>{if(!Ye(H))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,H)},oa=H=>{var K=ht(H,{parent:!0}).node;H=he(H);var se=tn(K,H),xe=Hc(K,H,!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,H),en(se)},_s=H=>{var K=ht(H,{parent:!0}).node;if(!K)throw new De(44);H=he(H);var se=tn(K,H),xe=Hc(K,H,!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,H),en(se)},Ul=H=>{if(H=ht(H).node,!H)throw new De(44);if(!H.Ga.readlink)throw new De(28);return Ye(Yt(H.parent),H.Ga.readlink(H))},ol=(H,K)=>{if(H=ht(H,{Sa:!K}).node,!H)throw new De(44);if(!H.Ga.Pa)throw new De(63);return H.Ga.Pa(H)},Cg=H=>ol(H,!0),Vc=(H,K)=>{if(H=typeof H=="string"?ht(H,{Sa:!0}).node:H,!H.Ga.Oa)throw new De(63);H.Ga.Oa(H,{mode:K&4095|H.mode&-4096,timestamp:Date.now()})},Dg=(H,K)=>{if(0>K)throw new De(28);if(H=typeof H=="string"?ht(H,{Sa:!0}).node:H,!H.Ga.Oa)throw new De(63);if((H.mode&61440)===16384)throw new De(31);if((H.mode&61440)!==32768)throw new De(28);var se=Pa(H,"w");if(se)throw new De(se);H.Ga.Oa(H,{size:K,timestamp:Date.now()})},_n=(H,K,se)=>{if(H==="")throw new De(44);if(typeof K=="string"){var xe=is[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 H=="object")var je=H;else{H=Ce(H);try{je=ht(H,{Sa:!(K&131072)}).node}catch{}}if(xe=!1,K&64)if(je){if(K&128)throw new De(20)}else je=gm(H,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&&(Yi(K)!=="r"||K&512)?31:Pa(je,Yi(K)):44))throw new De(se);return K&512&&!xe&&Dg(je,0),K&=-131713,je=Ha({node:je,path:Yt(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={}),H in sp||(sp[H]=1)),je},Hf=H=>{if(H.fd===null)throw new De(8);H.hb&&(H.hb=null);try{H.Ha.close&&H.Ha.close(H)}catch(K){throw K}finally{Ge[H.fd]=null}H.fd=null},Og=(H,K,se)=>{if(H.fd===null)throw new De(8);if(!H.seekable||!H.Ha.Ta)throw new De(70);if(se!=0&&se!=1&&se!=2)throw new De(28);H.position=H.Ha.Ta(H,K,se),H.Ib=[]},Gh=(H,K,se,xe,je)=>{if(0>xe||0>je)throw new De(28);if(H.fd===null)throw new De(8);if((H.flags&2097155)===1)throw new De(8);if((H.node.mode&61440)===16384)throw new De(31);if(!H.Ha.read)throw new De(28);var Ke=typeof je<"u";if(!Ke)je=H.position;else if(!H.seekable)throw new De(70);return K=H.Ha.read(H,K,se,xe,je),Ke||(H.position+=K),K},vm=(H,K,se,xe,je)=>{if(0>xe||0>je)throw new De(28);if(H.fd===null)throw new De(8);if((H.flags&2097155)===0)throw new De(8);if((H.node.mode&61440)===16384)throw new De(31);if(!H.Ha.write)throw new De(28);H.seekable&&H.flags&1024&&Og(H,0,2);var Ke=typeof je<"u";if(!Ke)je=H.position;else if(!H.seekable)throw new De(70);return K=H.Ha.write(H,K,se,xe,je,void 0),Ke||(H.position+=K),K},Mg=H=>{var K="binary";if(K!=="utf8"&&K!=="binary")throw Error('Invalid encoding type "'+K+'"');var se,xe=_n(H,xe||0);H=ol(H).size;var je=new Uint8Array(H);return Gh(xe,je,0,H,0),K==="utf8"?se=O(je,0):K==="binary"&&(se=je),Hf(xe),se},Qh=()=>{De||(De=function(H,K){this.node=K,this.Hb=function(se){this.Ka=se},this.Hb(H),this.message="FS error"},De.prototype=Error(),De.prototype.constructor=De,[44].forEach(H=>{at[H]=new De(H),at[H].stack=""}))},Vf,kn=(H,K)=>{var se=0;return H&&(se|=365),K&&(se|=146),se},Ia=(H,K,se)=>{H=Ce("/dev/"+H);var xe=kn(!!K,!!se);Yh||(Yh=64);var je=Yh++<<8|0;Yr(je,{open:Ke=>{Ke.seekable=!1},close:()=>{se&&se.buffer&&se.buffer.length&&se(10)},read:(Ke,ot,wr,Pn)=>{for(var sn=0,sa=0;sa{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(H){if(H=Ge[H],!H)throw new De(8);return H}function i1(H){return L[H>>2]+4294967296*T[H+4>>2]}function a1(H){var K=D(H)+1,se=Kh(K);return se&&N(H,q,se,K),se}function bm(H,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 wr=ot.getTimezoneOffset();T[H>>2]=60*Math.max(je,wr),T[K>>2]=Number(je!=wr),H=xe(Ke),K=xe(ot),H=a1(H),K=a1(K),wr>2]=H,L[se+4>>2]=K):(L[se>>2]=K,L[se+4>>2]=H)}function Gf(H,K,se){Gf.Bb||(Gf.Bb=!0,bm(H,K,se))}var o1;o1=c?()=>{var H=process.hrtime();return 1e3*H[0]+H[1]/1e6}:()=>performance.now();var Qf={};function Wl(){if(!Zh){var H={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 H[K]:H[K]=Qf[K];var se=[];for(K in H)se.push(K+"="+H[K]);Zh=se}return Zh}var Zh,ul=void 0,Ng=[];function Tg(H,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(H))return ul.get(H);if(Ng.length)se=Ng.pop();else{try{te.grow(1)}catch(wr){throw wr instanceof RangeError?"Unable to grow wasm table. Set ALLOW_TABLE_GROWTH.":wr}se=te.length-1}try{te.set(se,H)}catch(wr){if(!(wr instanceof TypeError))throw wr;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:H}}).exports.f}te.set(se,K)}return ul.set(H,se),se}function Xh(H){ul.delete(te.get(H)),Ng.push(H)}var Lb=0,zb=1;function Fg(H){var K=Lb==zb?Cu(H.length):Kh(H.length);return H.subarray||H.slice||(H=new Uint8Array(H)),z.set(H,K),K}function _g(H,K,se,xe){var je={string:sn=>{var sa=0;if(sn!=null&&sn!==0){var Ju=(sn.length<<2)+1;sa=Cu(Ju),N(sn,z,sa,Ju)}return sa},array:sn=>{var sa=Cu(sn.length);return q.set(sn,sa),sa}};H=a["_"+H];var Ke=[],ot=0;if(xe)for(var wr=0;wr{fi("/dev"),Yr(259,{read:()=>0,write:(K,se,xe,je)=>je}),as("/dev/null",259),we(1280,Le),we(1536,Ze),as("/dev/tty",1280),as("/dev/tty1",1536);var H=ze();Ia("random",H),Ia("urandom",H),fi("/dev/shm"),fi("/dev/shm/tmp")})(),(()=>{fi("/proc");var H=fi("/proc/self");fi("/proc/self/fd"),zl({Ra:()=>{var K=ci(H,"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 Wb={a:function(H,K,se,xe){me("Assertion failed: "+C(H)+", at: "+[K?C(K):"unknown filename",se,xe?C(xe):"unknown function"])},h:function(H,K){try{return H=C(H),Vc(H,K),0}catch(se){if(typeof Cn>"u"||!(se instanceof De))throw se;return-se.Ka}},H:function(H,K,se){try{if(K=C(K),K=Gc(H,K),se&-8)return-28;var xe=ht(K,{Sa:!0}).node;return xe?(H="",se&4&&(H+="r"),se&2&&(H+="w"),se&1&&(H+="x"),H&&Pa(xe,H)?-2:0):-44}catch(je){if(typeof Cn>"u"||!(je instanceof De))throw je;return-je.Ka}},i:function(H,K){try{var se=Ge[H];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(H){try{var K=Ge[H];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(H,K,se){ym=se;try{var xe=ll(H);switch(K){case 0:var je=ku();return 0>je?-28:Ha(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[Hb()>>2]=28,-1;default:return-28}}catch(Ke){if(typeof Cn>"u"||!(Ke instanceof De))throw Ke;return-Ke.Ka}},G:function(H,K){try{var se=ll(H);return jg(ol,se.path,K)}catch(xe){if(typeof Cn>"u"||!(xe instanceof De))throw xe;return-xe.Ka}},l:function(H,K,se){try{if(K=se+2097152>>>0<4194305-!!K?(K>>>0)+4294967296*se:NaN,isNaN(K))return-61;var xe=Ge[H];if(!xe)throw new De(8);if((xe.flags&2097155)===0)throw new De(28);return Dg(xe.node,K),0}catch(je){if(typeof Cn>"u"||!(je instanceof De))throw je;return-je.Ka}},B:function(H,K){try{if(K===0)return-28;var se=D("/")+1;return K"u"||!(xe instanceof De))throw xe;return-xe.Ka}},E:function(H,K){try{return H=C(H),jg(Cg,H,K)}catch(se){if(typeof Cn>"u"||!(se instanceof De))throw se;return-se.Ka}},y:function(H,K,se){try{return K=C(K),K=Gc(H,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(H,K,se,xe){try{K=C(K);var je=xe&256;return K=Gc(H,K,xe&4096),jg(je?Cg:ol,K,se)}catch(Ke){if(typeof Cn>"u"||!(Ke instanceof De))throw Ke;return-Ke.Ka}},v:function(H,K,se,xe){ym=xe;try{K=C(K),K=Gc(H,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(H,K,se,xe){try{if(K=C(K),K=Gc(H,K),0>=xe)return-28;var je=Ul(K),Ke=Math.min(xe,D(je)),ot=q[se+Ke];return N(je,z,se,xe+1),q[se+Ke]=ot,Ke}catch(wr){if(typeof Cn>"u"||!(wr instanceof De))throw wr;return-wr.Ka}},s:function(H){try{return H=C(H),oa(H),0}catch(K){if(typeof Cn>"u"||!(K instanceof De))throw K;return-K.Ka}},F:function(H,K){try{return H=C(H),jg(ol,H,K)}catch(se){if(typeof Cn>"u"||!(se instanceof De))throw se;return-se.Ka}},p:function(H,K,se){try{return K=C(K),K=Gc(H,K),se===0?_s(K):se===512?oa(K):me("Invalid flags passed to unlinkat"),0}catch(xe){if(typeof Cn>"u"||!(xe instanceof De))throw xe;return-xe.Ka}},o:function(H,K,se){try{if(K=C(K),K=Gc(H,K,!0),se){var xe=i1(se),je=T[se+8>>2];Ke=1e3*xe+je/1e6,se+=16,xe=i1(se),je=T[se+8>>2],ot=1e3*xe+je/1e6}else var Ke=Date.now(),ot=Ke;H=Ke;var wr=ht(K,{Sa:!0}).node;return wr.Ga.Oa(wr,{timestamp:Math.max(H,ot)}),0}catch(Pn){if(typeof Cn>"u"||!(Pn instanceof De))throw Pn;return-Pn.Ka}},e:function(){return Date.now()},j:function(H,K){H=new Date(1e3*i1(H)),T[K>>2]=H.getSeconds(),T[K+4>>2]=H.getMinutes(),T[K+8>>2]=H.getHours(),T[K+12>>2]=H.getDate(),T[K+16>>2]=H.getMonth(),T[K+20>>2]=H.getFullYear()-1900,T[K+24>>2]=H.getDay();var se=new Date(H.getFullYear(),0,1);T[K+28>>2]=(H.getTime()-se.getTime())/864e5|0,T[K+36>>2]=-(60*H.getTimezoneOffset());var xe=new Date(H.getFullYear(),6,1).getTimezoneOffset();se=se.getTimezoneOffset(),T[K+32>>2]=(xe!=se&&H.getTimezoneOffset()==Math.min(se,xe))|0},w:function(H,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 wr=ot.Ha.bb(ot,H,je,K,se),Pn=wr.Fb;return T[Ke>>2]=wr.vb,Pn}catch(sn){if(typeof Cn>"u"||!(sn instanceof De))throw sn;return-sn.Ka}},x:function(H,K,se,xe,je,Ke){try{var ot=ll(je);if(se&2){var wr=z.slice(H,H+K);ot&&ot.Ha.cb&&ot.Ha.cb(ot,wr,Ke,K,xe)}}catch(Pn){if(typeof Cn>"u"||!(Pn instanceof De))throw Pn;return-Pn.Ka}},n:Gf,q:function(){return 2147483648},d:o1,c:function(H){var K=z.length;if(H>>>=0,2147483648=se;se*=2){var xe=K*(1+.2/se);xe=Math.min(xe,H+100663296);var je=Math;xe=Math.max(H,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(H,K){var se=0;return Wl().forEach(function(xe,je){var Ke=K+se;for(je=L[H+4*je>>2]=Ke,Ke=0;Ke>0]=xe.charCodeAt(Ke);q[je>>0]=0,se+=xe.length+1}),0},A:function(H,K){var se=Wl();L[H>>2]=se.length;var xe=0;return se.forEach(function(je){xe+=je.length+1}),L[K>>2]=xe,0},f:function(H){try{var K=ll(H);return Hf(K),0}catch(se){if(typeof Cn>"u"||!(se instanceof De))throw se;return se.Ka}},m:function(H,K){try{var se=ll(H);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(H,K,se,xe){try{e:{var je=ll(H);H=K;for(var Ke=K=0;Ke>2],wr=L[H+4>>2];H+=8;var Pn=Gh(je,q,ot,wr);if(0>Pn){var sn=-1;break e}if(K+=Pn,Pn>2]=sn,0}catch(sa){if(typeof Cn>"u"||!(sa instanceof De))throw sa;return sa.Ka}},k:function(H,K,se,xe,je){try{if(K=se+2097152>>>0<4194305-!!K?(K>>>0)+4294967296*se:NaN,isNaN(K))return 61;var Ke=ll(H);return Og(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(H){try{var K=ll(H);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(H,K,se,xe){try{e:{var je=ll(H);H=K;for(var Ke=K=0;Ke>2],wr=L[H+4>>2];H+=8;var Pn=vm(je,q,ot,wr);if(0>Pn){var sn=-1;break e}K+=Pn}sn=K}return L[xe>>2]=sn,0}catch(sa){if(typeof Cn>"u"||!(sa instanceof De))throw sa;return sa.Ka}}};(function(){function H(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){H(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:Wb};if(Oe++,a.monitorRunDependencies&&a.monitorRunDependencies(Oe),a.instantiateWasm)try{return a.instantiateWasm(xe,H)}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 Hb=a.___errno_location=function(){return(Hb=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 Kh=a._malloc=function(){return(Kh=a._malloc=a.asm.ya).apply(null,arguments)},Pg=a._free=function(){return(Pg=a._free=a.asm.za).apply(null,arguments)};a._RegisterExtensionFunctions=function(){return(a._RegisterExtensionFunctions=a.asm.Ba).apply(null,arguments)};var Vb=a._emscripten_builtin_memalign=function(){return(Vb=a._emscripten_builtin_memalign=a.asm.Ca).apply(null,arguments)},Jh=a.stackSave=function(){return(Jh=a.stackSave=a.asm.Da).apply(null,arguments)},eA=a.stackRestore=function(){return(eA=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=Jh,a.stackRestore=eA,a.cwrap=function(H,K,se,xe){se=se||[];var je=se.every(Ke=>Ke==="number"||Ke==="boolean");return K!=="string"&&je&&!xe?a["_"+H]:function(){return _g(H,K,se,arguments)}};var Ig;ye=function H(){Ig||Gb(),Ig||(ye=H)};function Gb(){function H(){if(!Ig&&(Ig=!0,a.calledRun=!0,!k)){if(a.noFSInit||Vf||(Vf=!0,Qh(),a.stdin=a.stdin,a.stdout=a.stdout,a.stderr=a.stderr,a.stdin?Ia("stdin",a.stdin):Fs("/dev/tty","/dev/stdin"),a.stdout?Ia("stdout",null,a.stdout):Fs("/dev/tty","/dev/stdout"),a.stderr?Ia("stderr",null,a.stderr):Fs("/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 OOe=bl();xX.createRoot=OOe.createRoot,xX.hydrateRoot=OOe.hydrateRoot;var _Dr});var iMe=vn((nMe,FX)=>{(function(e){if(typeof nMe=="object"&&typeof FX<"u")FX.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;fepR});module.exports=E_e(Dnt);var vDe=Ae(Qa());var yJ=Ae(vJ()),Y$=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:{openNativeMenu:"Obsidian options",layout:"Layout",enterFlowState:"Enter Flow State",exitFlowState:"Exit Flow State",newView:"New View",calendarView:"Calendar View",dayView:"Day View",closeSpace:"Remove from 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",applyItems:"Apply to items in folder",rename:"Rename",changeToFolderNote:"Transform into Folder",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 ${1}",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:"Color",labels:"Labels",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:"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 Tag",cancel:"Cancel",search:"Search",delete:"Delete",toggleFlow:"Toggle Flow",openFlow:"Open Flow",hideFlow:"Hide Flow",openLink:"Open Link",addToSpace:"Pin file to...",addToSpaceShort:"Pin",addTag:"Add Tag",saveTemplate:"Make into template",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"},editStickerInSidebar:{name:"Edit Stickers in Sidebar",desc:"Edit stickers directly in the sidebar"},notesPreview:{name:"Notes Preview",desc:"Show a preview of notes, may cause performance issues"},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=yJ.default.locale();["en"].includes(t)&&(this.lang=t)}get texts(){return this.all.en}},W=new Y$().texts;var mA=(e,t)=>JSON.stringify({...t,options:e.map(r=>({name:r.name,value:r.value,color:r.color}))});var Xg="spaces://$",Kg="spaces://$tags";var pr="files",yp={id:pr,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)],pM=e=>[...new Map(e.map(t=>[t.toLowerCase(),t])).values()],ji=(e,t)=>{let r=e;if(t.includes(r)){let n=1;for(;t.includes(r);)r=e+n.toString(),n+=1}return r},bJ=e=>(t,r,n)=>n.findIndex(i=>t[e]==i[e])===r;var xJ=(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 Vl=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=Vl(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:Vl(`${a?`${f}://${a}/${o!="/"?o:""}`:o}`),authority:a,fullPath:t,scheme:f,path:Vl(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]},wJ=(e,t)=>{let r=e.substring(0,e.lastIndexOf("/"));return r.length>0?`${r}/${t}`:`${t}`},SJ=(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 ir=e=>{let t;try{t=JSON.parse(e)}catch{}return t};var mM=(e,t)=>!e||e.length==0?t:e;function dl(e){return Array.isArray(e)?e:typeof e=="string"?[e]:[]}function EJ(e,t,r){let n=Rs(e);return t.some(i=>i==n)?n:r}function Rs(e){if(!e)return"";if(typeof e!="string"){let t=e.toString();return typeof t=="string"?t:""}return e}function YE(e){return!!e}var kJ=(e,t)=>t.indexOf(e)>0?t.indexOf(e):t.length,CJ=(e,t)=>t.spacesIndex.get(e)?.name??e,DJ=e=>"spaces://"+ZE(e),ZE=e=>e?.replace(/\//g,"+"),Hn=e=>"spaces://"+e;var OJ=e=>e?`(${e})`:null,jr=e=>e?`"${e.replace(/"/g,'\\"').replace(/\n/g,"\\n")}"`:null,Z$=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},Sa=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,'"')},hA=(e,t)=>!e||e.length==0?t:e,hM=e=>e.charAt(0)=="/"?e.substring(1):e,MJ=e=>hM(e.substring(0,e.lastIndexOf("/")))||e;function $s(e){return $s=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},$s(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||$s(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 la(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 Ea(e,t){if(ut(2,arguments),!t||$s(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?la(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 C_e=36e5;function Ox(e,t){ut(2,arguments);var r=Cr(t);return ad(e,r*C_e)}var D_e={};function Gl(){return D_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 K$(e){ut(1,arguments);var t=X$(e),r=new Date(0);r.setFullYear(t,0,4),r.setHours(0,0,0,0);var n=tf(r);return n}function AA(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 Vn(e){ut(1,arguments);var t=Mt(e);return t.setHours(0,0,0,0),t}var O_e=864e5;function od(e,t){ut(2,arguments);var r=Vn(e),n=Vn(t),i=r.getTime()-AA(r),a=n.getTime()-AA(n);return Math.round((i-a)/O_e)}var M_e=6e4;function XE(e,t){ut(2,arguments);var r=Cr(t);return ad(e,r*M_e)}function Jg(e,t){ut(2,arguments);var r=Cr(t),n=r*7;return la(e,n)}function AM(e,t){ut(2,arguments);var r=Cr(t);return Uo(e,r*12)}function gM(e){ut(1,arguments);var t;if(e&&typeof e.forEach=="function")t=e;else if($s(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 j_e=365.2425,N_e=Math.pow(10,8)*24*60*60*1e3,J$=6e4,eq=36e5;var sat=-N_e;var T_e=3600;var jJ=T_e*24,lat=jJ*7,F_e=jJ*j_e,__e=F_e/12,uat=__e*3;function pl(e,t){ut(2,arguments);var r=Vn(e),n=Vn(t);return r.getTime()===n.getTime()}function O1(e){return ut(1,arguments),e instanceof Date||$s(e)==="object"&&Object.prototype.toString.call(e)==="[object Date]"}function tq(e){if(ut(1,arguments),!O1(e)&&typeof e!="number")return!1;var t=Mt(e);return!isNaN(Number(t))}function e0(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 P_e=6048e5;function rq(e,t,r){ut(2,arguments);var n=mo(e,r),i=mo(t,r),a=n.getTime()-AA(n),o=i.getTime()-AA(i);return Math.round((a-o)/P_e)}function Mx(e){ut(1,arguments);var t=Mt(e);return t.setHours(23,59,59,999),t}function t0(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 yM(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 gA(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 aq(e){ut(1,arguments);var t=JE(e),r=new Date(0);r.setUTCFullYear(t,0,4),r.setUTCHours(0,0,0,0);var n=r0(r);return n}var B_e=6048e5;function oq(e){ut(1,arguments);var t=Mt(e),r=r0(t).getTime()-aq(t).getTime();return Math.round(r/B_e)+1}function n0(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=n0(h,t),g=new Date(0);g.setUTCFullYear(f,0,p),g.setUTCHours(0,0,0,0);var A=n0(g,t);return c.getTime()>=m.getTime()?f+1:c.getTime()>=A.getTime()?f:f-1}function sq(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=ek(e,t),p=new Date(0);p.setUTCFullYear(d,0,f),p.setUTCHours(0,0,0,0);var h=n0(p,t);return h}var R_e=6048e5;function lq(e,t){ut(1,arguments);var r=Mt(e),n=n0(r,t).getTime()-sq(r,t).getTime();return Math.round(n/R_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)}},vA=$_e;var jx={am:"am",pm:"pm",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},q_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 vA.y(t,r)},Y:function(t,r,n,i){var a=ek(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=JE(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 vA.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=lq(t,i);return r==="wo"?n.ordinalNumber(a,{unit:"week"}):ui(a,r.length)},I:function(t,r,n){var i=oq(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"}):vA.d(t,r)},D:function(t,r,n){var i=iq(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 vA.h(t,r)},H:function(t,r,n){return r==="Ho"?n.ordinalNumber(t.getUTCHours(),{unit:"hour"}):vA.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"}):vA.m(t,r)},s:function(t,r,n){return r==="so"?n.ordinalNumber(t.getUTCSeconds(),{unit:"second"}):vA.s(t,r)},S:function(t,r){return vA.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 TJ(o);case"XXXX":case"XX":return M1(o);case"XXXXX":case"XXX":default:return M1(o,":")}},x:function(t,r,n,i){var a=i._originalDate||t,o=a.getTimezoneOffset();switch(r){case"x":return TJ(o);case"xxxx":case"xx":return M1(o);case"xxxxx":case"xxx":default:return M1(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"+NJ(o,":");case"OOOO":default:return"GMT"+M1(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"+NJ(o,":");case"zzzz":default:return"GMT"+M1(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 NJ(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 TJ(e,t){if(e%60===0){var r=e>0?"-":"+";return r+ui(Math.abs(e)/60,2)}return M1(e,t)}function M1(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 FJ=q_e;var _J=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"})}},PJ=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"})}},L_e=function(t,r){var n=t.match(/(P+)(p+)?/)||[],i=n[1],a=n[2];if(!a)return _J(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}}",_J(i,r)).replace("{{time}}",PJ(a,r))},z_e={p:PJ,P:L_e},IJ=z_e;var U_e=["D","DD"],W_e=["YY","YYYY"];function BJ(e){return U_e.indexOf(e)!==-1}function RJ(e){return W_e.indexOf(e)!==-1}function uq(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 H_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"}},V_e=function(t,r,n){var i,a=H_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},$J=V_e;function tk(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 G_e={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},Q_e={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},Y_e={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},Z_e={date:tk({formats:G_e,defaultWidth:"full"}),time:tk({formats:Q_e,defaultWidth:"full"}),dateTime:tk({formats:Y_e,defaultWidth:"full"})},qJ=Z_e;var X_e={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},K_e=function(t,r,n,i){return X_e[t]},LJ=K_e;function j1(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 J_e={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},e4e={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},t4e={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"]},r4e={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"]},n4e={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"}},i4e={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"}},a4e=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"},o4e={ordinalNumber:a4e,era:j1({values:J_e,defaultWidth:"wide"}),quarter:j1({values:e4e,defaultWidth:"wide",argumentCallback:function(t){return t-1}}),month:j1({values:t4e,defaultWidth:"wide"}),day:j1({values:r4e,defaultWidth:"wide"}),dayPeriod:j1({values:n4e,defaultWidth:"wide",formattingValues:i4e,defaultFormattingWidth:"wide"})},zJ=o4e;function N1(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)?l4e(s,function(f){return f.test(o)}):s4e(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 s4e(e,t){for(var r in e)if(e.hasOwnProperty(r)&&t(e[r]))return r}function l4e(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 u4e=/^(\d+)(th|st|nd|rd)?/i,c4e=/\d+/i,f4e={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},d4e={any:[/^b/i,/^(a|c)/i]},p4e={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},m4e={any:[/1/i,/2/i,/3/i,/4/i]},h4e={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},A4e={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]},g4e={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},v4e={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]},y4e={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},b4e={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}},x4e={ordinalNumber:cq({matchPattern:u4e,parsePattern:c4e,valueCallback:function(t){return parseInt(t,10)}}),era:N1({matchPatterns:f4e,defaultMatchWidth:"wide",parsePatterns:d4e,defaultParseWidth:"any"}),quarter:N1({matchPatterns:p4e,defaultMatchWidth:"wide",parsePatterns:m4e,defaultParseWidth:"any",valueCallback:function(t){return t+1}}),month:N1({matchPatterns:h4e,defaultMatchWidth:"wide",parsePatterns:A4e,defaultParseWidth:"any"}),day:N1({matchPatterns:g4e,defaultMatchWidth:"wide",parsePatterns:v4e,defaultParseWidth:"any"}),dayPeriod:N1({matchPatterns:y4e,defaultMatchWidth:"any",parsePatterns:b4e,defaultParseWidth:"any"})},UJ=x4e;var w4e={code:"en-US",formatDistance:$J,formatLong:qJ,formatRelative:LJ,localize:zJ,match:UJ,options:{weekStartsOn:0,firstWeekContainsDate:1}},rk=w4e;var WJ=rk;var S4e=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,E4e=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,k4e=/^'([^]*?)'?$/,C4e=/''/g,D4e=/[a-zA-Z]/;function Ya(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:WJ,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(!tq(C))throw new RangeError("Invalid time value");var N=AA(C),D=nq(C,N),P={firstWeekContainsDate:j,weekStartsOn:O,locale:k,_originalDate:C},q=w.match(E4e).map(function(z){var I=z[0];if(I==="p"||I==="P"){var T=IJ[I];return T(z,k.formatLong)}return z}).join("").match(S4e).map(function(z){if(z==="''")return"'";var I=z[0];if(I==="'")return O4e(z);var T=FJ[I];if(T)return!(r!=null&&r.useAdditionalWeekYearTokens)&&RJ(z)&&uq(z,t,String(e)),!(r!=null&&r.useAdditionalDayOfYearTokens)&&BJ(z)&&uq(z,t,String(e)),T(D,z,k.localize,P);if(I.match(D4e))throw new RangeError("Format string contains an unescaped latin alphabet character `"+I+"`");return z}).join("");return q}function O4e(e){var t=e.match(k4e);return t?t[1].replace(C4e,"'"):e}function fq(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 M4e=6048e5;function bM(e){ut(1,arguments);var t=Mt(e),r=tf(t).getTime()-K$(t).getTime();return Math.round(r/M4e)+1}function dq(e){ut(1,arguments);var t=Mt(e),r=t.getTime();return r}function xM(e){return ut(1,arguments),Math.floor(dq(e)/1e3)}function pq(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 mq(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=pq(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 j4e=6048e5;function wM(e,t){ut(1,arguments);var r=Mt(e),n=mo(r,t).getTime()-mq(r,t).getTime();return Math.round(n/j4e)+1}function hq(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 SM(e,t){return ut(1,arguments),rq(hq(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 nk(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],kM.timeZoneDelimiter.test(t.date)&&(t.date=e.split(kM.timeZoneDelimiter)[0],n=e.substr(t.date.length,e.length))),n){var i=kM.timezone.exec(n);i?(t.time=n.replace(i[1],""),t.timezone=i[1]):t.time=n}return t}function P4e(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 I4e(e,t){if(t===null)return new Date(NaN);var r=e.match(N4e);if(!r)return new Date(NaN);var n=!!r[4],i=ak(r[1]),a=ak(r[2])-1,o=ak(r[3]),s=ak(r[4]),l=ak(r[5])-1;if(n)return U4e(t,s,l)?$4e(t,s,l):new Date(NaN);var u=new Date(0);return!L4e(t,a,o)||!z4e(t,i)?new Date(NaN):(u.setUTCFullYear(t,a,Math.max(i,o)),u)}function ak(e){return e?parseInt(e):1}function B4e(e){var t=e.match(T4e);if(!t)return NaN;var r=vq(t[1]),n=vq(t[2]),i=vq(t[3]);return W4e(r,n,i)?r*eq+n*J$+i*1e3:NaN}function vq(e){return e&&parseFloat(e.replace(",","."))||0}function R4e(e){if(e==="Z")return 0;var t=e.match(F4e);if(!t)return 0;var r=t[1]==="+"?-1:1,n=parseInt(t[2]),i=t[3]&&parseInt(t[3])||0;return H4e(n,i)?r*(n*eq+i*J$):NaN}function $4e(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 q4e=[31,null,31,30,31,30,31,31,30,31,30,31];function HJ(e){return e%400===0||e%4===0&&e%100!==0}function L4e(e,t,r){return t>=0&&t<=11&&r>=1&&r<=(q4e[t]||(HJ(e)?29:28))}function z4e(e,t){return t>=1&&t<=(HJ(e)?366:365)}function U4e(e,t,r){return t>=1&&t<=53&&r>=0&&r<=6}function W4e(e,t,r){return e===24?t===0&&r===0:r>=0&&r<60&&t>=0&&t<60&&e>=0&&e<25}function H4e(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=fq(o);return r.setMonth(n,Math.min(a,s)),r}function ok(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 yq=(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 VJ=({field:e,value:t})=>t=="ctime"?{value:"parseDate(prop('File')['metadata']['ctime'])",type:"date"}:{value:"",type:"string"},mr=(e,t,r,n)=>{let i=ir(e);if(i)return t=="fileprop"&&i.field?VJ(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=yq(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=VJ({field:a,value:o})}else i={};else t.startsWith("option")&&(e?.length>0?i={options:tr(e).map(o=>({name:o,value:o}))}:i={});return i??{}};var ua={uniques:["name,schemaId"],cols:["name","schemaId","type","value","attrs","hidden","unique","primary"]},sd={...ua,rows:[{name:mt,schemaId:pr,type:"file",primary:"true",hidden:"",unique:"",attrs:"",value:""},{name:"Created",schemaId:pr,type:"fileprop",value:mt+".ctime",hidden:"",unique:"",attrs:"",primary:"true"}]},bq=e=>sd,Px=[{name:"Name",schemaId:"",type:"text",primary:"true"}],DM={...ua,rows:[{name:mt,schemaId:pr,type:"file",primary:"true",hidden:"",unique:"",attrs:"",value:""}]};var ho=e=>e?e.type=="fileprop"?mr(e.value,"fileprop")?.type??"text":e.type:null,Ri=e=>e.attrs?.length>0?ir(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",GJ=e=>ir(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:W.properties.text.label,metadata:!0,icon:"ui//text",primative:!0,description:W.properties.text.description},{type:"number",label:W.properties.number.label,metadata:!0,icon:"ui//binary",configKeys:["unit"],primative:!0,description:W.properties.number.description},{type:"boolean",label:W.properties.boolean.label,metadata:!0,icon:"ui//check-square",primative:!0,description:W.properties.boolean.description},{type:"date",label:W.properties.date.label,metadata:!0,icon:"ui//calendar",configKeys:["format"],primative:!0,description:W.properties.date.description},{type:"option",label:W.properties.option.label,multi:!0,multiType:"option-multi",icon:"ui//list",configKeys:["options","source"],description:W.properties.option.description},{type:"tags-multi",label:W.properties.tags.label,icon:"ui//tags",description:W.properties.tags.description},{type:"file",label:W.properties.file.label,restricted:!0,icon:"ui//mk-make-h3"},{type:"fileprop",label:W.properties.fileProperty.label,icon:"ui//formula",configKeys:["field","value","type"],description:W.properties.fileProperty.description},{type:"link",label:W.properties.link.label,multi:!0,multiType:"link-multi",metadata:!0,icon:"ui//file-text",primative:!0,description:W.properties.link.description},{type:"context",label:W.properties.context.label,icon:"ui//mk-make-note",multi:!0,multiType:"context-multi",configKeys:["space","field"],description:W.properties.context.description},{type:"aggregate",label:W.properties.aggregate.label,icon:"ui//mk-make-note",multi:!1,configKeys:["ref","field","fn"],description:W.properties.aggregate.description},{type:"object",label:W.properties.object.label,multi:!0,multiType:"object-multi",metadata:!0,icon:"ui//list-tree",configKeys:["type","typeName"],description:W.properties.object.description},{type:"icon",label:W.properties.icon.label,multi:!0,multiType:"icon-multi",icon:"ui//gem",restricted:!0,primative:!0,description:W.properties.icon.description},{type:"image",label:W.properties.image.label,multi:!0,multiType:"image-multi",metadata:!0,icon:"ui//mk-make-image",primative:!0,description:W.properties.image.description},{type:"color",label:W.properties.color.label,icon:"ui//mk-make-image",restricted:!0,description:W.properties.color.description},{type:"space",label:W.properties.space.label,icon:"ui//layout-grid",restricted:!0,description:W.properties.space.description},{type:"table",label:W.properties.space.label,icon:"ui//layout-grid",restricted:!0,description:W.properties.space.description},{type:"super",label:W.properties.super.label,icon:"ui//zap",restricted:!0,configKeys:["dynamic","field"]},{type:"input",label:W.properties.super.label,icon:"ui//input",restricted:!0}];var i0="filesView",bp={id:i0,name:"All",type:"view",def:JSON.stringify({db:pr,icon:"ui//file-stack"})},T1="main",OM=e=>({id:e,name:e,type:"frame",def:"",predicate:"",primary:"true"}),QJ={uniques:[],cols:["id","name","type","def","predicate","primary"],rows:[OM(T1),bp]},yA={uniques:[],cols:["id","name","type","def","predicate","primary"],rows:[yp]},YJ=e=>V4e,V4e={schema:yp,cols:sd.rows,rows:[]},Kut={schema:yp,cols:sd.rows,rows:[]},Jut={schema:yp,cols:DM.rows,rows:[]},ZJ=(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:[]}}}),{}),XJ=e=>G4e,G4e={m_schema:yA,m_fields:sd,...ZJ(sd.rows,yA.rows)},ect={m_schema:yA,m_fields:DM,...ZJ(DM.rows,yA.rows)};var bA=(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=tr(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=>bA(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 Ya(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 xq=(e,t)=>t?t=="number"?parseFloat(e):t=="boolean"?e=="true":t.includes("-multi")?tr(e).map(r=>ca(t.replace("-multi",""),r,!1)):e:e,ca=(e,t,r)=>e?e=="object"||e=="object-multi"?JSON.parse(t):e=="number"?parseFloat(t):e=="boolean"?t=="true":e.includes("-multi")?tr(t).map(n=>ca(e.replace("-multi",""),n,r)):(e.includes("link")||e.includes("context"))&&r?`[[${t}]]`:t:t,wq=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 ss=e=>e.map(t=>t.replace(",","\\,")).join(", "),yi=e=>JSON.stringify(e),Sq=e=>e.join(", "),KJ=e=>e.join("; "),JJ=e=>e.join(",");var tr=e=>e?.startsWith("[")?dl(ir(e)).map(t=>Rs(t)):qx(e),qx=e=>(e?.replace("\\,",",")?.match(/(\\.|[^,])+/g)??[]).map(t=>t.trim()),$i=(e,t,r)=>{let n=r??bA(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=Ya(t,"yyyy-MM-dd");return typeof i=="string"?i:""}return typeof t!="string"?"":t}break;case"duration":return ss(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):yi(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(ir(e)):ir(e)??{};var $x=e=>{if(!e)return"";let t=/\[\[(.*?)\]\]/g.exec(e),r=t?.length>1?t[1].substring(0,kJ("|",t[1])):e;return r||e};var sk=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(Xg)?"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==pr&&r.type.startsWith("option")){let n=kr([...this.superstate.spacesMap.getInverse(t)??[]].flatMap(a=>tr(this.superstate.pathsIndex.get(a)?.metadata?.property?.[r.name])??[])),i=mA(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 a0=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 F1=class{constructor(){this.filesystems=[];this.filetypes=[];this.eventDispatch=new a0}static create(){return new F1}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 _1=(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},o0=e=>hM(e.substring(e.lastIndexOf("/")))||e,eee=e=>{let t=[],r=e.split("/"),n="";for(let i=0;ie.lastIndexOf("/")!=-1?e.lastIndexOf(".")!=-1?hM(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,Tu=e=>{let t=e.lastIndexOf("/");return t==-1?"/":e.substring(0,t+1)};var Eq=async(e,t,r)=>{let n=Q4e(e,t),i=zx(kq(r)),a=e.spaceManager.pathsForTag(t);for(let o of a)e.spaceManager.renameTag(o,t,i);await nee(e,t,i);for(let o of n)await Eq(e,o,o.replace(t,i));return i},tee=e=>{e.startsWith("#")&&(e=e.slice(1));let t=e.split("/"),r=[];for(let n=0;ne.trim(),Q4e=(e,t)=>e.spaceManager.readTags().filter(n=>n.startsWith(t)&&n!=t),ree=e=>ZE(zx(e)),MM=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"?Eq(e,n.name,r):e.spaceManager.renameSpace(t,wJ(t,r))}else return e.spaceManager.renamePath(t,SJ(t,r))},jM=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))},iee=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))},P1=async(e,t)=>{e.spaceManager.deletePath(t),e.onPathDeleted(t)},aee=async(e,t,r)=>e.spaceManager.renamePath(t,jm(t,r)),NM=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 oee=(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 TM=(e,t)=>t.spacesFolder+"/"+e;var Vee=Ae(bi());var Zx=Ae(bi());var uk=["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(uk.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=uk[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 fa=function(e){return e!=null},af=function(e){return typeof e=="number"},Cq=function(e){return typeof e=="string"&&uk.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 lee=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},FM=function(e,t){return{div:Math.floor(e/t),mod:Ql(e,t)}},of=function(e){return!fa(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))},Y4e=[31,28,31,30,31,30,31,31,30,31,30,31],cee=1e3*60*60*24,_M=9999,fee=Tm(1970,1,1),Z4e=[6,0,1,2,3,4,5];var Hx=function(e){return e%4===0&&e%100!==0||e%400===0},Dq=function(e){return e instanceof Date},B1=function(e){return Dq(e)&&!isNaN(e.getTime())};var X4e=function(e,t){var r=e.getTime(),n=t.getTime(),i=r-n;return Math.round(i/cee)},ck=function(e){return X4e(e,fee)},PM=function(e){return new Date(fee.getTime()+e*cee)},K4e=function(e){var t=e.getUTCMonth();return t===1&&Hx(e.getUTCFullYear())?29:Y4e[t]},xA=function(e){return Z4e[e.getUTCDay()]},Oq=function(e,t){var r=Tm(e,t+1,1);return[xA(r),K4e(r)]},IM=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()))},BM=function(e){var t=new Date(e.getTime());return t},Mq=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}(),SA=J4e;var jq=function(e,t){return jq=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])},jq(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");jq(e,t);function r(){this.constructor=e}e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}var Ni=function(){return Ni=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 dk(e,t){t===void 0&&(t=q1);var r={},n=new aPe(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 pk(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=FM(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=FM(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=FM(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=Oq(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>_M))return;r=Oq(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 Fq(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)||fa(t.byweekday)||fa(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=[xA(t.dtstart)];break}if(fa(t.bymonth)&&!Al(t.bymonth)&&(t.bymonth=[t.bymonth]),fa(t.byyearday)&&!Al(t.byyearday)&&af(t.byyearday)&&(t.byyearday=[t.byyearday]),!fa(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(fa(t.byweekno)&&!Al(t.byweekno)&&(t.byweekno=[t.byweekno]),!fa(t.byweekday))t.bynweekday=null;else if(af(t.byweekday))t.byweekday=[t.byweekday],t.bynweekday=null;else if(Cq(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 fa(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 EA(e);if(b>=r){var v=Bee(b,t);if(!e.accept(v)||s&&(--s,!s))return EA(e)}}else for(var A=p;Aa)return EA(e);if(b>=r){var v=Bee(b,t);if(!e.accept(v)||s&&(--s,!s))return EA(e)}}}if(t.interval===0||(l.add(t,m),l.year>_M))return EA(e);pk(n)||(c=u.gettimeset(n)(l.hour,l.minute,l.second,0)),u.rebuild(l.year,l.month)}}function gPe(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 Bee(e,t){return new L1(e,t.tzid).rezonedDate()}function EA(e){return e.getValue()}function vPe(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)},mk={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},bee=Object.keys(mk),Wt=function(){function e(t,r){t===void 0&&(t={}),r===void 0&&(r=!1),this._cache=r?null:new See,this.origOptions=Fq(t);var n=vee(t).parsedOptions;this.options=n}return e.parseText=function(t,r){return dk(t,r)},e.fromText=function(t,r){return mee(t,r)},e.fromString=function(t){return new e(e.parseString(t)||void 0)},e.prototype._iter=function(t){return $M(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 Tq("all",{},t));var r=this._cacheGet("all");return r===!1&&(r=this._iter(new SA("all",{})),this._cacheAdd("all",r)),r},e.prototype.between=function(t,r,n,i){if(n===void 0&&(n=!1),!B1(t)||!B1(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 Tq("between",a,i));var o=this._cacheGet("between",a);return o===!1&&(o=this._iter(new SA("between",a)),this._cacheAdd("between",o,a)),o},e.prototype.before=function(t,r){if(r===void 0&&(r=!1),!B1(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 SA("before",n)),this._cacheAdd("before",i,n)),i},e.prototype.after=function(t,r){if(r===void 0&&(r=!1),!B1(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 SA("after",n)),this._cacheAdd("after",i,n)),i},e.prototype.count=function(){return this.all().length},e.prototype.toString=function(){return gk(this.origOptions)},e.prototype.toText=function(t,r,n){return hee(this,t,r,n)},e.prototype.isFullyConvertibleToText=function(){return Aee(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=Ak,e.optionsToString=gk,e}();function Ree(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 L1(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 Iq(u);return c.dtstart(s),c.tzid(l||void 0),n.forEach(function(d){c.rrule(new Wt(Pq(d,s,l),u))}),i.forEach(function(d){c.rdate(d)}),a.forEach(function(d){c.exrule(new Wt(Pq(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(Pq(f,f.dtstart||t.dtstart||s,f.tzid||t.tzid||l),u)}function qM(e,t){return t===void 0&&(t={}),xPe(e,wPe(t))}function Pq(e,t,r){return Ni(Ni({},e),{dtstart:t,tzid:r})}function wPe(e){var t=[],r=Object.keys(e),n=Object.keys($ee);if(r.forEach(function(i){Bn(n,i)||t.push(i)}),t.length)throw new Error("Invalid options: "+t.join(", "));return Ni(Ni({},$ee),e)}function SPe(e){if(e.indexOf(":")===-1)return{name:"RRULE",value:e};var t=lee(e,":",1),r=t[0],n=t[1];return{name:r,value:n}}function EPe(e){var t=SPe(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 kPe(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 CPe(e){e.forEach(function(t){if(!/(VALUE=DATE(-TIME)?)|(TZID=)/.test(t))throw new Error("unsupported RDATE/EXDATE parm: "+t)})}function qee(e,t){return CPe(t),e.split(",").map(function(r){return fk(r)})}function Lee(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),qs="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=Ya(t,r?.length>0?r:i?`${e.settings.defaultDateFormat} ${e.settings.defaultTimeFormat}`:e.settings.defaultDateFormat)}catch{n=""}return n},Zi=e=>e?(0,Zx.isFinite)(e)?new Date(e):(0,Zx.isString)(e)?CM(e):(0,Zx.isDate)(e)?e:null:null,LM=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 Hee=(e,t)=>kr(t?.rows.reduce((r,n)=>(0,Wee.isString)(n[e])?[...r,...tr(n[e])]:[...r],[])??[]),Kx=(e,t)=>{let r=[...e.getSpaceItems(t.path,!0)];return{...GJ(t),rows:r.map(n=>({[mt]:n.path,Created:_r(e,Zi(n.metadata?.ctime),"yyyy-MM-dd")}))}},vk=(e,t,r)=>r?{...e,rows:Cx(e.rows,r,t)}:{...e,rows:[...e.rows,t]},tee=async(e,t,r)=>{let n=TM(t,e.settings);await e.spaceManager.pathExists(n)?e.spaceManager.renamePath(n,DJ(n)+"/"+r):P1(e,n),e.onTagRenamed(t,r)};var DPe=[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],Xee=[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],OPe="\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",Kee="\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",Bq={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"},Rq="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",MPe={5:Rq,"5module":Rq+" export import",6:Rq+" const class extends export import super"},jPe=/^in(stanceof)?$/,NPe=new RegExp("["+Kee+"]"),TPe=new RegExp("["+Kee+OPe+"]");function qq(e,t){for(var r=65536,n=0;ne)return!1;if(r+=t[n+1],r>=e)return!0}return!1}function kA(e,t){return e<65?e===36:e<91?!0:e<97?e===95:e<123?!0:e<=65535?e>=170&&NPe.test(String.fromCharCode(e)):t===!1?!1:qq(e,Xee)}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&&TPe.test(String.fromCharCode(e)):t===!1?!1:qq(e,Xee)||qq(e,DPe)}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},Uq={};function Rn(e,t){return t===void 0&&(t={}),t.keyword=e,Uq[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/,FPe=new RegExp(md.source,"g");function ew(e){return e===10||e===13||e===8232||e===8233}function Jee(e,t,r){r===void 0&&(r=e.length);for(var n=t;n>10)+55296,(e&1023)+56320))}var IPe=/(?:[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])/,bk=function(t,r){this.line=t,this.column=r};bk.prototype.offset=function(t){return new bk(this.line,this.column+t)};var VM=function(t,r,n){this.start=r,this.end=n,t.sourceFile!==null&&(this.source=t.sourceFile)};function rte(e,t){for(var r=1,n=0;;){var i=Jee(e,n,t);if(i<0)return new bk(r,t-n);++r,n=i}}var Lq={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},Qee=!1;function BPe(e){var t={};for(var r in Lq)t[r]=e&&wk(e,r)?e[r]:Lq[r];if(t.ecmaVersion==="latest"?t.ecmaVersion=1e8:t.ecmaVersion==null?(!Qee&&typeof console=="object"&&console.warn&&(Qee=!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),Vee(t.onToken)){var n=t.onToken;t.onToken=function(i){return n.push(i)}}return Vee(t.onComment)&&(t.onComment=RPe(t,t.onComment)),t}function RPe(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 VM(this,o,s)),e.ranges&&(l.range=[i,a]),t.push(l)}}var xk=1,tw=2,Wq=4,nte=8,ite=16,ate=32,Hq=64,ote=128,Sk=256,Vq=xk|tw|Sk;function Gq(e,t){return tw|(e?Wq:0)|(t?nte:0)}var UM=0,Qq=1,DA=2,ste=3,lte=4,ute=5,ls=function(t,r,n){this.options=t=BPe(t),this.sourceFile=t.sourceFile,this.keywords=u0(MPe[t.ecmaVersion>=6?6:t.sourceType==="module"?"5module":5]);var i="";t.allowReserved!==!0&&(i=Bq[t.ecmaVersion>=6?6:t.ecmaVersion===5?5:3],t.sourceType==="module"&&(i+=" await")),this.reservedWords=u0(i);var a=(i?i+" ":"")+Bq.strict;this.reservedWordsStrict=u0(a),this.reservedWordsStrictBind=u0(a+" "+Bq.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(xk),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}};ls.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&nte)>0&&!this.currentVarScope().inClassFieldInit};_m.inAsync.get=function(){return(this.currentVarScope().flags&Wq)>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&Sk)return!1;if(t.flags&tw)return(t.flags&Wq)>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&Hq)>0||r||this.options.allowSuperOutsideMethod};_m.allowDirectSuper.get=function(){return(this.currentThisScope().flags&ote)>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|Sk))>0||r};_m.inClassStaticBlock.get=function(){return(this.currentVarScope().flags&Sk)>0};ls.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++}};Fu.eat=function(e){return this.type===e?(this.next(),!0):!1};Fu.isContextual=function(e){return this.type===ge.name&&this.value===e&&!this.containsEsc};Fu.eatContextual=function(e){return this.isContextual(e)?(this.next(),!0):!1};Fu.expectContextual=function(e){this.eatContextual(e)||this.unexpected()};Fu.canInsertSemicolon=function(){return this.type===ge.eof||this.type===ge.braceR||md.test(this.input.slice(this.lastTokEnd,this.start))};Fu.insertSemicolon=function(){if(this.canInsertSemicolon())return this.options.onInsertedSemicolon&&this.options.onInsertedSemicolon(this.lastTokEnd,this.lastTokEndLoc),!0};Fu.semicolon=function(){!this.eat(ge.semi)&&!this.insertSemicolon()&&this.unexpected()};Fu.afterTrailingComma=function(e,t){if(this.type===e)return this.options.onTrailingComma&&this.options.onTrailingComma(this.lastTokStart,this.lastTokStartLoc),t||this.next(),!0};Fu.expect=function(e){this.eat(e)||this.unexpected()};Fu.unexpected=function(e){this.raise(e??this.start,"Unexpected token")};var GM=function(){this.shorthandAssign=this.trailingComma=this.parenthesizedAssign=this.parenthesizedBind=this.doubleProto=-1};Fu.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")}};Fu.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")};Fu.checkYieldAwaitInDefaultParams=function(){this.yieldPos&&(!this.awaitPos||this.yieldPos55295&&n<56320)return!0;if(kA(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(!jPe.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(Yq),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 GM,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,yk|(r?0:zq),!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(qPe),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 LPe=[];lr.parseCatchClauseParam=function(){var e=this.parseBindingAtom(),t=e.type==="Identifier";return this.enterScope(t?ate:0),this.checkLValPattern(e,t?lte:DA),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(Yq),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"?Qq:DA,!1)};var yk=1,zq=2,cte=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&zq&&this.unexpected(),e.generator=this.eat(ge.star)),this.options.ecmaVersion>=8&&(e.async=!!n),t&yk&&(e.id=t&cte&&this.type!==ge.name?null:this.parseIdent(),e.id&&!(t&zq)&&this.checkLValSimple(e.id,this.strict||e.generator||e.async?this.treatFunctionsAsVar?Qq:DA:ste));var a=this.yieldPos,o=this.awaitPos,s=this.awaitIdentPos;return this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0,this.enterScope(Gq(e.async,e.generator)),t&yk||(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&yk?"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"&&zPe(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&&WM(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&&WM(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(WM(e,"constructor")?this.raise(e.key.start,"Classes can't have a field named 'constructor'"):e.static&&WM(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(Sk|Hq);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,DA,!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 IPe.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=ls.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 GM,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 UPe=[];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=UPe,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(Gq(t,n.generator)|Hq|(r?ote: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(Gq(r,!1)|ite),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,ute),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&xk&&delete this.undefinedExports[e]}else if(t===lte){var a=this.currentScope();a.lexical.push(e)}else if(t===ste){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&ate&&l.lexical[0]===e)||!this.treatFunctionsAsVarInScope(l)&&l.functions.indexOf(e)>-1){n=!0;break}if(l.var.push(e),this.inModule&&l.flags&xk&&delete this.undefinedExports[e],l.flags&Vq)break}n&&this.raiseRecoverable(r,"Identifier '"+e+"' has already been declared")};f0.checkLocalExport=function(e){this.scopeStack[0].lexical.indexOf(e.name)===-1&&this.scopeStack[0].var.indexOf(e.name)===-1&&(this.undefinedExports[e.name]=e)};f0.currentScope=function(){return this.scopeStack[this.scopeStack.length-1]};f0.currentVarScope=function(){for(var e=this.scopeStack.length-1;;e--){var t=this.scopeStack[e];if(t.flags&Vq)return t}};f0.currentThisScope=function(){for(var e=this.scopeStack.length-1;;e--){var t=this.scopeStack[e];if(t.flags&Vq&&!(t.flags&ite))return t}};var QM=function(t,r,n){this.type="",this.start=r,this.end=0,t.options.locations&&(this.loc=new VM(t,n)),t.options.directSourceFile&&(this.sourceFile=t.options.directSourceFile),t.options.ranges&&(this.range=[r,0])},Ek=ls.prototype;Ek.startNode=function(){return new QM(this,this.start,this.startLoc)};Ek.startNodeAt=function(e,t){return new QM(this,e,t)};function dte(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}Ek.finishNode=function(e,t){return dte.call(this,e,t,this.lastTokEnd,this.lastTokEndLoc)};Ek.finishNodeAt=function(e,t,r,n){return dte.call(this,e,t,r,n)};Ek.copyNode=function(e){var t=new QM(this,e.start,this.startLoc);for(var r in e)t[r]=e[r];return t};var pte="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",mte=pte+" Extended_Pictographic",hte=mte,Ate=hte+" EBase EComp EMod EPres ExtPict",gte=Ate,HPe=gte,VPe={9:pte,10:mte,11:hte,12:Ate,13:gte,14:HPe},GPe="Basic_Emoji Emoji_Keycap_Sequence RGI_Emoji_Modifier_Sequence RGI_Emoji_Flag_Sequence RGI_Emoji_Tag_Sequence RGI_Emoji_ZWJ_Sequence RGI_Emoji",QPe={9:"",10:"",11:"",12:"",13:"",14:GPe},Yee="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",vte="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",yte=vte+" Dogra Dogr Gunjala_Gondi Gong Hanifi_Rohingya Rohg Makasar Maka Medefaidrin Medf Old_Sogdian Sogo Sogdian Sogd",bte=yte+" Elymaic Elym Nandinagari Nand Nyiakeng_Puachue_Hmong Hmnp Wancho Wcho",xte=bte+" Chorasmian Chrs Diak Dives_Akuru Khitan_Small_Script Kits Yezi Yezidi",wte=xte+" Cypro_Minoan Cpmn Old_Uyghur Ougr Tangsa Tnsa Toto Vithkuqi Vith",YPe=wte+" Hrkt Katakana_Or_Hiragana Kawi Nag_Mundari Nagm Unknown Zzzz",ZPe={9:vte,10:yte,11:bte,12:xte,13:wte,14:YPe},Ste={};function XPe(e){var t=Ste[e]={binary:u0(VPe[e]+" "+Yee),binaryOfStrings:u0(QPe[e]),nonBinary:{General_Category:u0(Yee),Script:u0(ZPe[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(zM=0,$q=[9,10,11,12,13,14];zM<$q.length;zM+=1)Zee=$q[zM],XPe(Zee);var Zee,zM,$q,er=ls.prototype,Pm=function(t){this.parser=t,this.validFlags="gim"+(t.options.ecmaVersion>=6?"uy":"")+(t.options.ecmaVersion>=9?"s":"")+(t.options.ecmaVersion>=13?"d":"")+(t.options.ecmaVersion>=15?"v":""),this.unicodeProperties=Ste[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 Ete(t)?(e.lastIntValue=t,e.advance(),!0):!1};function Ete(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&&!Ete(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+=c0(e.lastIntValue);this.regexp_eatRegExpIdentifierPart(e);)e.lastStringValue+=c0(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),KPe(n)?(e.lastIntValue=n,!0):(e.pos=t,!1)};function KPe(e){return kA(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),JPe(n)?(e.lastIntValue=n,!0):(e.pos=t,!1)};function JPe(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&&!YM(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 kte(t)?(e.lastIntValue=t%32,e.advance(),!0):!1};function kte(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)&&eIe(e.lastIntValue))return!0;n&&e.raise("Invalid unicode escape"),e.pos=r}return!1};function eIe(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 Cte=0,CA=1,pd=2;er.regexp_eatCharacterClassEscape=function(e){var t=e.current();if(tIe(t))return e.lastIntValue=-1,e.advance(),CA;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 Cte};function tIe(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),CA}}if(e.pos=t,this.regexp_eatLoneUnicodePropertyNameOrValue(e)){var i=e.lastStringValue;return this.regexp_validateUnicodePropertyNameOrValue(e,i)}return Cte};er.regexp_validateUnicodePropertyNameAndValue=function(e,t,r){wk(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 CA;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="";Dte(t=e.current());)e.lastStringValue+=c0(t),e.advance();return e.lastStringValue!==""};function Dte(e){return kte(e)||e===95}er.regexp_eatUnicodePropertyValue=function(e){var t=0;for(e.lastStringValue="";rIe(t=e.current());)e.lastStringValue+=c0(t),e.advance();return e.lastStringValue!==""};function rIe(e){return Dte(e)||YM(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?CA:e.switchV?this.regexp_classSetExpression(e):(this.regexp_nonEmptyClassRanges(e),CA)};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||jte(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=CA,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=CA);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)?CA: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?CA: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()&&nIe(r)||iIe(r)?!1:(e.advance(),e.lastIntValue=r,!0)};function nIe(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 iIe(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 aIe(t)?(e.lastIntValue=t,e.advance(),!0):!1};function aIe(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 YM(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;YM(r=e.current());)e.lastIntValue=10*e.lastIntValue+(r-48),e.advance();return e.pos!==t};function YM(e){return e>=48&&e<=57}er.regexp_eatHexDigits=function(e){var t=e.pos,r=0;for(e.lastIntValue=0;Ote(r=e.current());)e.lastIntValue=16*e.lastIntValue+Mte(r),e.advance();return e.pos!==t};function Ote(e){return e>=48&&e<=57||e>=65&&e<=70||e>=97&&e<=102}function Mte(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 jte(t)?(e.lastIntValue=t-48,e.advance(),!0):(e.lastIntValue=0,!1)};function jte(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 kA(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=Jee(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&&ete.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(),kA(t,!0)||t===92))return this.finishToken(ge.privateId,this.readWord1());this.raise(this.pos,"Unexpected character '"+c0(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 '"+c0(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 oIe(e,t){return t?parseInt(e,8):parseFloat(e.replace(/_/g,""))}function Nte(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=Nte(this.input.slice(t,this.pos)),++this.pos):kA(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=Nte(this.input.slice(t,this.pos));return++this.pos,kA(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")),kA(this.fullCharCodeAtPos())&&this.raise(this.pos,"Identifier directly after number");var a=oIe(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 Tte={};Nn.tryReadTemplateToken=function(){this.inTemplateElement=!0;try{this.readTmplToken()}catch(e){if(e===Tte)this.readInvalidTemplateToken();else throw e}this.inTemplateElement=!1};Nn.invalidStringToken=function(e,t){if(this.inTemplateElement&&this.options.ecmaVersion>=9)throw Tte;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+=` +`).map(function(i){return i.replace(/^RRULE:/,"EXRULE:")}).filter(function(i){return!/^DTSTART/.test(i)}))}),this._rdate.length&&r.push(Wee("RDATE",this._rdate,this.tzid())),this._exdate.length&&r.push(Wee("EXDATE",this._exdate,this.tzid())),r},t.prototype.toString=function(){return this.valueOf().join(` +`)},t.prototype.clone=function(){var r=new t(!!this._cache);return this._rrule.forEach(function(n){return r.rrule(n.clone())}),this._exrule.forEach(function(n){return r.exrule(n.clone())}),this._rdate.forEach(function(n){return r.rdate(new Date(n.getTime()))}),this._exdate.forEach(function(n){return r.exdate(new Date(n.getTime()))}),r},t}(Wt);function zee(e,t){if(!(e instanceof Wt))throw new TypeError(String(e)+" is not RRule instance");Bn(t.map(String),String(e))||t.push(e)}function Uee(e,t){if(!(e instanceof Date))throw new TypeError(String(e)+" is not Date instance");Bn(t.map(Number),Number(e))||(t.push(e),wA(t))}function Wee(e,t,r){var n=!r||r.toUpperCase()==="UTC",i=n?"".concat(e,":"):"".concat(e,";TZID=").concat(r,":"),a=t.map(function(o){return Vx(o.valueOf(),n)}).join(",");return"".concat(i).concat(a)}var Hee=e=>e instanceof Date&&!isNaN(e),qs="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=Ya(t,r?.length>0?r:i?`${e.settings.defaultDateFormat} ${e.settings.defaultTimeFormat}`:e.settings.defaultDateFormat)}catch{n=""}return n},Zi=e=>e?(0,Zx.isFinite)(e)?new Date(e):(0,Zx.isString)(e)?CM(e):(0,Zx.isDate)(e)?e:null:null,LM=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 Gee=(e,t)=>kr(t?.rows.reduce((r,n)=>(0,Vee.isString)(n[e])?[...r,...tr(n[e])]:[...r],[])??[]),Kx=(e,t)=>{let r=[...e.getSpaceItems(t.path,!0)];return{...YJ(t),rows:r.map(n=>({[mt]:n.path,Created:_r(e,Zi(n.metadata?.ctime),"yyyy-MM-dd")}))}},vk=(e,t,r)=>r?{...e,rows:Cx(e.rows,r,t)}:{...e,rows:[...e.rows,t]},nee=async(e,t,r)=>{let n=TM(t,e.settings);await e.spaceManager.pathExists(n)?e.spaceManager.renamePath(n,MJ(n)+"/"+r):P1(e,n),e.onTagRenamed(t,r)};var DPe=[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],Jee=[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],OPe="\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",ete="\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",Bq={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"},Rq="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",MPe={5:Rq,"5module":Rq+" export import",6:Rq+" const class extends export import super"},jPe=/^in(stanceof)?$/,NPe=new RegExp("["+ete+"]"),TPe=new RegExp("["+ete+OPe+"]");function qq(e,t){for(var r=65536,n=0;ne)return!1;if(r+=t[n+1],r>=e)return!0}return!1}function kA(e,t){return e<65?e===36:e<91?!0:e<97?e===95:e<123?!0:e<=65535?e>=170&&NPe.test(String.fromCharCode(e)):t===!1?!1:qq(e,Jee)}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&&TPe.test(String.fromCharCode(e)):t===!1?!1:qq(e,Jee)||qq(e,DPe)}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},Uq={};function Rn(e,t){return t===void 0&&(t={}),t.keyword=e,Uq[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/,FPe=new RegExp(md.source,"g");function ew(e){return e===10||e===13||e===8232||e===8233}function tte(e,t,r){r===void 0&&(r=e.length);for(var n=t;n>10)+55296,(e&1023)+56320))}var IPe=/(?:[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])/,bk=function(t,r){this.line=t,this.column=r};bk.prototype.offset=function(t){return new bk(this.line,this.column+t)};var VM=function(t,r,n){this.start=r,this.end=n,t.sourceFile!==null&&(this.source=t.sourceFile)};function ite(e,t){for(var r=1,n=0;;){var i=tte(e,n,t);if(i<0)return new bk(r,t-n);++r,n=i}}var Lq={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},Zee=!1;function BPe(e){var t={};for(var r in Lq)t[r]=e&&wk(e,r)?e[r]:Lq[r];if(t.ecmaVersion==="latest"?t.ecmaVersion=1e8:t.ecmaVersion==null?(!Zee&&typeof console=="object"&&console.warn&&(Zee=!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),Qee(t.onToken)){var n=t.onToken;t.onToken=function(i){return n.push(i)}}return Qee(t.onComment)&&(t.onComment=RPe(t,t.onComment)),t}function RPe(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 VM(this,o,s)),e.ranges&&(l.range=[i,a]),t.push(l)}}var xk=1,tw=2,Wq=4,ate=8,ote=16,ste=32,Hq=64,lte=128,Sk=256,Vq=xk|tw|Sk;function Gq(e,t){return tw|(e?Wq:0)|(t?ate:0)}var UM=0,Qq=1,DA=2,ute=3,cte=4,fte=5,ls=function(t,r,n){this.options=t=BPe(t),this.sourceFile=t.sourceFile,this.keywords=u0(MPe[t.ecmaVersion>=6?6:t.sourceType==="module"?"5module":5]);var i="";t.allowReserved!==!0&&(i=Bq[t.ecmaVersion>=6?6:t.ecmaVersion===5?5:3],t.sourceType==="module"&&(i+=" await")),this.reservedWords=u0(i);var a=(i?i+" ":"")+Bq.strict;this.reservedWordsStrict=u0(a),this.reservedWordsStrictBind=u0(a+" "+Bq.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(xk),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}};ls.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&ate)>0&&!this.currentVarScope().inClassFieldInit};_m.inAsync.get=function(){return(this.currentVarScope().flags&Wq)>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&Sk)return!1;if(t.flags&tw)return(t.flags&Wq)>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&Hq)>0||r||this.options.allowSuperOutsideMethod};_m.allowDirectSuper.get=function(){return(this.currentThisScope().flags<e)>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|Sk))>0||r};_m.inClassStaticBlock.get=function(){return(this.currentVarScope().flags&Sk)>0};ls.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++}};Fu.eat=function(e){return this.type===e?(this.next(),!0):!1};Fu.isContextual=function(e){return this.type===ge.name&&this.value===e&&!this.containsEsc};Fu.eatContextual=function(e){return this.isContextual(e)?(this.next(),!0):!1};Fu.expectContextual=function(e){this.eatContextual(e)||this.unexpected()};Fu.canInsertSemicolon=function(){return this.type===ge.eof||this.type===ge.braceR||md.test(this.input.slice(this.lastTokEnd,this.start))};Fu.insertSemicolon=function(){if(this.canInsertSemicolon())return this.options.onInsertedSemicolon&&this.options.onInsertedSemicolon(this.lastTokEnd,this.lastTokEndLoc),!0};Fu.semicolon=function(){!this.eat(ge.semi)&&!this.insertSemicolon()&&this.unexpected()};Fu.afterTrailingComma=function(e,t){if(this.type===e)return this.options.onTrailingComma&&this.options.onTrailingComma(this.lastTokStart,this.lastTokStartLoc),t||this.next(),!0};Fu.expect=function(e){this.eat(e)||this.unexpected()};Fu.unexpected=function(e){this.raise(e??this.start,"Unexpected token")};var GM=function(){this.shorthandAssign=this.trailingComma=this.parenthesizedAssign=this.parenthesizedBind=this.doubleProto=-1};Fu.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")}};Fu.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")};Fu.checkYieldAwaitInDefaultParams=function(){this.yieldPos&&(!this.awaitPos||this.yieldPos55295&&n<56320)return!0;if(kA(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(!jPe.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(Yq),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 GM,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,yk|(r?0:zq),!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(qPe),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 LPe=[];lr.parseCatchClauseParam=function(){var e=this.parseBindingAtom(),t=e.type==="Identifier";return this.enterScope(t?ste:0),this.checkLValPattern(e,t?cte:DA),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(Yq),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"?Qq:DA,!1)};var yk=1,zq=2,dte=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&zq&&this.unexpected(),e.generator=this.eat(ge.star)),this.options.ecmaVersion>=8&&(e.async=!!n),t&yk&&(e.id=t&dte&&this.type!==ge.name?null:this.parseIdent(),e.id&&!(t&zq)&&this.checkLValSimple(e.id,this.strict||e.generator||e.async?this.treatFunctionsAsVar?Qq:DA:ute));var a=this.yieldPos,o=this.awaitPos,s=this.awaitIdentPos;return this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0,this.enterScope(Gq(e.async,e.generator)),t&yk||(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&yk?"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"&&zPe(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&&WM(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&&WM(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(WM(e,"constructor")?this.raise(e.key.start,"Classes can't have a field named 'constructor'"):e.static&&WM(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(Sk|Hq);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,DA,!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 IPe.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=ls.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 GM,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 UPe=[];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=UPe,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(Gq(t,n.generator)|Hq|(r?lte: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(Gq(r,!1)|ote),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,fte),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&xk&&delete this.undefinedExports[e]}else if(t===cte){var a=this.currentScope();a.lexical.push(e)}else if(t===ute){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&ste&&l.lexical[0]===e)||!this.treatFunctionsAsVarInScope(l)&&l.functions.indexOf(e)>-1){n=!0;break}if(l.var.push(e),this.inModule&&l.flags&xk&&delete this.undefinedExports[e],l.flags&Vq)break}n&&this.raiseRecoverable(r,"Identifier '"+e+"' has already been declared")};f0.checkLocalExport=function(e){this.scopeStack[0].lexical.indexOf(e.name)===-1&&this.scopeStack[0].var.indexOf(e.name)===-1&&(this.undefinedExports[e.name]=e)};f0.currentScope=function(){return this.scopeStack[this.scopeStack.length-1]};f0.currentVarScope=function(){for(var e=this.scopeStack.length-1;;e--){var t=this.scopeStack[e];if(t.flags&Vq)return t}};f0.currentThisScope=function(){for(var e=this.scopeStack.length-1;;e--){var t=this.scopeStack[e];if(t.flags&Vq&&!(t.flags&ote))return t}};var QM=function(t,r,n){this.type="",this.start=r,this.end=0,t.options.locations&&(this.loc=new VM(t,n)),t.options.directSourceFile&&(this.sourceFile=t.options.directSourceFile),t.options.ranges&&(this.range=[r,0])},Ek=ls.prototype;Ek.startNode=function(){return new QM(this,this.start,this.startLoc)};Ek.startNodeAt=function(e,t){return new QM(this,e,t)};function mte(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}Ek.finishNode=function(e,t){return mte.call(this,e,t,this.lastTokEnd,this.lastTokEndLoc)};Ek.finishNodeAt=function(e,t,r,n){return mte.call(this,e,t,r,n)};Ek.copyNode=function(e){var t=new QM(this,e.start,this.startLoc);for(var r in e)t[r]=e[r];return t};var hte="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",Ate=hte+" Extended_Pictographic",gte=Ate,vte=gte+" EBase EComp EMod EPres ExtPict",yte=vte,HPe=yte,VPe={9:hte,10:Ate,11:gte,12:vte,13:yte,14:HPe},GPe="Basic_Emoji Emoji_Keycap_Sequence RGI_Emoji_Modifier_Sequence RGI_Emoji_Flag_Sequence RGI_Emoji_Tag_Sequence RGI_Emoji_ZWJ_Sequence RGI_Emoji",QPe={9:"",10:"",11:"",12:"",13:"",14:GPe},Xee="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",bte="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",xte=bte+" Dogra Dogr Gunjala_Gondi Gong Hanifi_Rohingya Rohg Makasar Maka Medefaidrin Medf Old_Sogdian Sogo Sogdian Sogd",wte=xte+" Elymaic Elym Nandinagari Nand Nyiakeng_Puachue_Hmong Hmnp Wancho Wcho",Ste=wte+" Chorasmian Chrs Diak Dives_Akuru Khitan_Small_Script Kits Yezi Yezidi",Ete=Ste+" Cypro_Minoan Cpmn Old_Uyghur Ougr Tangsa Tnsa Toto Vithkuqi Vith",YPe=Ete+" Hrkt Katakana_Or_Hiragana Kawi Nag_Mundari Nagm Unknown Zzzz",ZPe={9:bte,10:xte,11:wte,12:Ste,13:Ete,14:YPe},kte={};function XPe(e){var t=kte[e]={binary:u0(VPe[e]+" "+Xee),binaryOfStrings:u0(QPe[e]),nonBinary:{General_Category:u0(Xee),Script:u0(ZPe[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(zM=0,$q=[9,10,11,12,13,14];zM<$q.length;zM+=1)Kee=$q[zM],XPe(Kee);var Kee,zM,$q,er=ls.prototype,Pm=function(t){this.parser=t,this.validFlags="gim"+(t.options.ecmaVersion>=6?"uy":"")+(t.options.ecmaVersion>=9?"s":"")+(t.options.ecmaVersion>=13?"d":"")+(t.options.ecmaVersion>=15?"v":""),this.unicodeProperties=kte[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 Cte(t)?(e.lastIntValue=t,e.advance(),!0):!1};function Cte(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&&!Cte(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+=c0(e.lastIntValue);this.regexp_eatRegExpIdentifierPart(e);)e.lastStringValue+=c0(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),KPe(n)?(e.lastIntValue=n,!0):(e.pos=t,!1)};function KPe(e){return kA(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),JPe(n)?(e.lastIntValue=n,!0):(e.pos=t,!1)};function JPe(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&&!YM(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 Dte(t)?(e.lastIntValue=t%32,e.advance(),!0):!1};function Dte(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)&&eIe(e.lastIntValue))return!0;n&&e.raise("Invalid unicode escape"),e.pos=r}return!1};function eIe(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 Ote=0,CA=1,pd=2;er.regexp_eatCharacterClassEscape=function(e){var t=e.current();if(tIe(t))return e.lastIntValue=-1,e.advance(),CA;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 Ote};function tIe(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),CA}}if(e.pos=t,this.regexp_eatLoneUnicodePropertyNameOrValue(e)){var i=e.lastStringValue;return this.regexp_validateUnicodePropertyNameOrValue(e,i)}return Ote};er.regexp_validateUnicodePropertyNameAndValue=function(e,t,r){wk(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 CA;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="";Mte(t=e.current());)e.lastStringValue+=c0(t),e.advance();return e.lastStringValue!==""};function Mte(e){return Dte(e)||e===95}er.regexp_eatUnicodePropertyValue=function(e){var t=0;for(e.lastStringValue="";rIe(t=e.current());)e.lastStringValue+=c0(t),e.advance();return e.lastStringValue!==""};function rIe(e){return Mte(e)||YM(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?CA:e.switchV?this.regexp_classSetExpression(e):(this.regexp_nonEmptyClassRanges(e),CA)};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||Tte(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=CA,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=CA);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)?CA: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?CA: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()&&nIe(r)||iIe(r)?!1:(e.advance(),e.lastIntValue=r,!0)};function nIe(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 iIe(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 aIe(t)?(e.lastIntValue=t,e.advance(),!0):!1};function aIe(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 YM(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;YM(r=e.current());)e.lastIntValue=10*e.lastIntValue+(r-48),e.advance();return e.pos!==t};function YM(e){return e>=48&&e<=57}er.regexp_eatHexDigits=function(e){var t=e.pos,r=0;for(e.lastIntValue=0;jte(r=e.current());)e.lastIntValue=16*e.lastIntValue+Nte(r),e.advance();return e.pos!==t};function jte(e){return e>=48&&e<=57||e>=65&&e<=70||e>=97&&e<=102}function Nte(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 Tte(t)?(e.lastIntValue=t-48,e.advance(),!0):(e.lastIntValue=0,!1)};function Tte(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 kA(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=tte(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&&rte.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(),kA(t,!0)||t===92))return this.finishToken(ge.privateId,this.readWord1());this.raise(this.pos,"Unexpected character '"+c0(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 '"+c0(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 oIe(e,t){return t?parseInt(e,8):parseFloat(e.replace(/_/g,""))}function Fte(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=Fte(this.input.slice(t,this.pos)),++this.pos):kA(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=Fte(this.input.slice(t,this.pos));return++this.pos,kA(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")),kA(this.fullCharCodeAtPos())&&this.raise(this.pos,"Identifier directly after number");var a=oIe(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 _te={};Nn.tryReadTemplateToken=function(){this.inTemplateElement=!0;try{this.readTmplToken()}catch(e){if(e===_te)this.readInvalidTemplateToken();else throw e}this.inTemplateElement=!1};Nn.invalidStringToken=function(e,t){if(this.inTemplateElement&&this.options.ecmaVersion>=9)throw _te;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,def:JSON.stringify(e.def)}),Ao=e=>e?{...e,def:ir(e.def)}:null;var ZM=Ae(bi());function eL(e,t){let r=ZM.default.keyBy(Array.isArray(t)?t:[t]);function n(i){return ZM.default.transform(i,function(a,o,s){s in r||(a[s]=ZM.default.isObject(o)?n(o):o)})}return n(e)}var _te=(e,t,r)=>{!e||t!==r&&Object.prototype.hasOwnProperty.call(e,t)&&(Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(e,t)),delete e[t])};function XM(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?mr(e.value,e.type,t).alias??e.name:null,tL=e=>e.replace(/;+$/,""),KM=(e,t)=>{let r=tL(e.trim());return!!(t=="object"&&r.startsWith("{")&&r.endsWith("}")||t=="object-multi"&&r.startsWith("[")&&r.endsWith("]")||e==null||e=="")},_u=e=>{let t=/^["'](?:[^"\\]|\\.)*["'](?:;)?$/.test(e),r=e?.replace(/;+$/,""),n=!isNaN(parseFloat(r))&&!isNaN(r);return t||n||r=="false"||r=="true"||e==null||e==""},us=(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 W1=(e,t,r,n)=>{let i=ji(e.node.id,r.map(a=>a.id));return{...e.node,id:i,schemaId:n,parentId:t}};var rL=(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")&&KM(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},kk=e=>{let t={...e,execActions:{},execProps:{},execStyles:{},execPropsOptions:{}},{sortedKeys:r,dependencies:n}=Pte(t.node.props,`${t.id}.props`),{sortedKeys:i,dependencies:a}=Pte(t.node.styles,`${t.id}.styles`);t.execPropsOptions.props=r.map(s=>({name:s,isConst:_u(t.node.props[s]),deps:n.get(s)||[]})),t.execProps=XM(t.node.props,(s,l)=>rL(s,!1,t.node.types[l])),t.execStyles=XM(t.node.styles,s=>rL(s,!1)),t.execActions=XM(t.node.actions,s=>rL(s,!0)),t.children=t.children.map(s=>kk(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 lIe(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=z1(e.replace("return ",""),{ecmaVersion:2020});n(i)}catch{return[]}return t}function Pte(e,t){let r=new Map,n=new Map,i=new Map;for(let u in e){let c=e[u],f=lIe(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:uIe}=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 JM={"||":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},Sp=17,cIe={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:Sp,ClassExpression:Sp,FunctionExpression:Sp,ObjectExpression:Sp,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;i=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,def:JSON.stringify(e.def)}),Ao=e=>e?{...e,def:ir(e.def)}:null;var ZM=Ae(bi());function eL(e,t){let r=ZM.default.keyBy(Array.isArray(t)?t:[t]);function n(i){return ZM.default.transform(i,function(a,o,s){s in r||(a[s]=ZM.default.isObject(o)?n(o):o)})}return n(e)}var Ite=(e,t,r)=>{!e||t!==r&&Object.prototype.hasOwnProperty.call(e,t)&&(Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(e,t)),delete e[t])};function XM(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?mr(e.value,e.type,t).alias??e.name:null,tL=e=>e.replace(/;+$/,""),KM=(e,t)=>{let r=tL(e.trim());return!!(t=="object"&&r.startsWith("{")&&r.endsWith("}")||t=="object-multi"&&r.startsWith("[")&&r.endsWith("]")||e==null||e=="")},_u=e=>{let t=/^["'](?:[^"\\]|\\.)*["'](?:;)?$/.test(e),r=e?.replace(/;+$/,""),n=!isNaN(parseFloat(r))&&!isNaN(r);return t||n||r=="false"||r=="true"||e==null||e==""},us=(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 W1=(e,t,r,n)=>{let i=ji(e.node.id,r.map(a=>a.id));return{...e.node,id:i,schemaId:n,parentId:t}};var rL=(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")&&KM(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},kk=e=>{let t={...e,execActions:{},execProps:{},execStyles:{},execPropsOptions:{}},{sortedKeys:r,dependencies:n}=Bte(t.node.props,`${t.id}.props`),{sortedKeys:i,dependencies:a}=Bte(t.node.styles,`${t.id}.styles`);t.execPropsOptions.props=r.map(s=>({name:s,isConst:_u(t.node.props[s]),deps:n.get(s)||[]})),t.execProps=XM(t.node.props,(s,l)=>rL(s,!1,t.node.types[l])),t.execStyles=XM(t.node.styles,s=>rL(s,!1)),t.execActions=XM(t.node.actions,s=>rL(s,!0)),t.children=t.children.map(s=>kk(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 lIe(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=z1(e.replace("return ",""),{ecmaVersion:2020});n(i)}catch{return[]}return t}function Bte(e,t){let r=new Map,n=new Map,i=new Map;for(let u in e){let c=e[u],f=lIe(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:uIe}=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 JM={"||":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},Sp=17,cIe={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:Sp,ClassExpression:Sp,FunctionExpression:Sp,ObjectExpression:Sp,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;i0){e.write(n);for(let o=1;o0){r.VariableDeclarator(n[0],e);for(let a=1;a0){t.write(n),i&&e.comments!=null&&Pu(t,e.comments,a,n);let{length:s}=o;for(let l=0;l0){for(;i0&&t.write(", ");let a=r[i],o=a.type[6];if(o==="D")t.write(a.local.name,a),i++;else if(o==="N")t.write("* as "+a.local.name,a),i++;else break}if(i0)for(let i=0;;){let a=r[i],{name:o}=a.local;if(t.write(o,a),o!==a.exported.name&&t.write(" as "+a.exported.name),++i "),e.body.type[0]==="O"?(t.write("("),this.ObjectExpression(e.body,t),t.write(")")):this[e.body.type](e.body,t)},ThisExpression(e,t){t.write("this",e)},Super(e,t){t.write("super",e)},RestElement:Rte=function(e,t){t.write("..."),this[e.argument.type](e.argument,t)},SpreadElement:Rte,YieldExpression(e,t){t.write(e.delegate?"yield*":"yield"),e.argument&&(t.write(" "),this[e.argument.type](e.argument,t))},AwaitExpression(e,t){t.write("await ",e),ej(t,e.argument,e)},TemplateLiteral(e,t){let{quasis:r,expressions:n}=e;t.write("`");let{length:i}=n;for(let o=0;o0){let{elements:r}=e,{length:n}=r;for(let i=0;;){let a=r[i];if(a!=null&&this[a.type](a,t),++i0){t.write(n),i&&e.comments!=null&&Pu(t,e.comments,a,n);let o=","+n,{properties:s}=e,{length:l}=s;for(let u=0;;){let c=s[u];if(i&&c.comments!=null&&Pu(t,c.comments,a,n),t.write(a),this[c.type](c,t),++u0){let{properties:r}=e,{length:n}=r;for(let i=0;this[r[i].type](r[i],t),++i1||i[0]==="U"&&(i[1]==="n"||i[1]==="p")&&n.prefix&&n.operator[0]===r&&(r==="+"||r==="-"))&&t.write(" "),a?(t.write(r.length>1?" (":"("),this[i](n,t),t.write(")")):this[i](n,t)}else this[e.argument.type](e.argument,t),t.write(e.operator)},UpdateExpression(e,t){e.prefix?(t.write(e.operator),this[e.argument.type](e.argument,t)):(this[e.argument.type](e.argument,t),t.write(e.operator))},AssignmentExpression(e,t){this[e.left.type](e.left,t),t.write(" "+e.operator+" "),this[e.right.type](e.right,t)},AssignmentPattern(e,t){this[e.left.type](e.left,t),t.write(" = "),this[e.right.type](e.right,t)},BinaryExpression:$te=function(e,t){let r=e.operator==="in";r&&t.write("("),ej(t,e.left,e,!1),t.write(" "+e.operator+" "),ej(t,e.right,e,!0),r&&t.write(")")},LogicalExpression:$te,ConditionalExpression(e,t){let{test:r}=e,n=t.expressionsPrecedence[r.type];n===Sp||n<=t.expressionsPrecedence.ConditionalExpression?(t.write("("),this[r.type](r,t),t.write(")")):this[r.type](r,t),t.write(" ? "),this[e.consequent.type](e.consequent,t),t.write(" : "),this[e.alternate.type](e.alternate,t)},NewExpression(e,t){t.write("new ");let r=t.expressionsPrecedence[e.callee.type];r===Sp||r0){r.VariableDeclarator(n[0],e);for(let a=1;a0){t.write(n),i&&e.comments!=null&&Pu(t,e.comments,a,n);let{length:s}=o;for(let l=0;l0){for(;i0&&t.write(", ");let a=r[i],o=a.type[6];if(o==="D")t.write(a.local.name,a),i++;else if(o==="N")t.write("* as "+a.local.name,a),i++;else break}if(i0)for(let i=0;;){let a=r[i],{name:o}=a.local;if(t.write(o,a),o!==a.exported.name&&t.write(" as "+a.exported.name),++i "),e.body.type[0]==="O"?(t.write("("),this.ObjectExpression(e.body,t),t.write(")")):this[e.body.type](e.body,t)},ThisExpression(e,t){t.write("this",e)},Super(e,t){t.write("super",e)},RestElement:qte=function(e,t){t.write("..."),this[e.argument.type](e.argument,t)},SpreadElement:qte,YieldExpression(e,t){t.write(e.delegate?"yield*":"yield"),e.argument&&(t.write(" "),this[e.argument.type](e.argument,t))},AwaitExpression(e,t){t.write("await ",e),ej(t,e.argument,e)},TemplateLiteral(e,t){let{quasis:r,expressions:n}=e;t.write("`");let{length:i}=n;for(let o=0;o0){let{elements:r}=e,{length:n}=r;for(let i=0;;){let a=r[i];if(a!=null&&this[a.type](a,t),++i0){t.write(n),i&&e.comments!=null&&Pu(t,e.comments,a,n);let o=","+n,{properties:s}=e,{length:l}=s;for(let u=0;;){let c=s[u];if(i&&c.comments!=null&&Pu(t,c.comments,a,n),t.write(a),this[c.type](c,t),++u0){let{properties:r}=e,{length:n}=r;for(let i=0;this[r[i].type](r[i],t),++i1||i[0]==="U"&&(i[1]==="n"||i[1]==="p")&&n.prefix&&n.operator[0]===r&&(r==="+"||r==="-"))&&t.write(" "),a?(t.write(r.length>1?" (":"("),this[i](n,t),t.write(")")):this[i](n,t)}else this[e.argument.type](e.argument,t),t.write(e.operator)},UpdateExpression(e,t){e.prefix?(t.write(e.operator),this[e.argument.type](e.argument,t)):(this[e.argument.type](e.argument,t),t.write(e.operator))},AssignmentExpression(e,t){this[e.left.type](e.left,t),t.write(" "+e.operator+" "),this[e.right.type](e.right,t)},AssignmentPattern(e,t){this[e.left.type](e.left,t),t.write(" = "),this[e.right.type](e.right,t)},BinaryExpression:Lte=function(e,t){let r=e.operator==="in";r&&t.write("("),ej(t,e.left,e,!1),t.write(" "+e.operator+" "),ej(t,e.right,e,!0),r&&t.write(")")},LogicalExpression:Lte,ConditionalExpression(e,t){let{test:r}=e,n=t.expressionsPrecedence[r.type];n===Sp||n<=t.expressionsPrecedence.ConditionalExpression?(t.write("("),this[r.type](r,t),t.write(")")):this[r.type](r,t),t.write(" ? "),this[e.consequent.type](e.consequent,t),t.write(" : "),this[e.alternate.type](e.alternate,t)},NewExpression(e,t){t.write("new ");let r=t.expressionsPrecedence[e.callee.type];r===Sp||r0&&(this.lineEndSize>0&&(i.length===1?t[n-1]===i:t.endsWith(i))?(this.line+=this.lineEndSize,this.column=0):this.column+=n)}toString(){return this.output}};function Ute(e,t){let r=new iL(t);return r.generator[e.type](e,r),r.output}var H1=(e,t,r)=>{let n,i=Rs(e),a=i.includes(` +`?(s=0,l++):s++;this.column=s,this.line=l;return}}let{length:n}=t,{lineEnd:i}=this;n>0&&(this.lineEndSize>0&&(i.length===1?t[n-1]===i:t.endsWith(i))?(this.line+=this.lineEndSize,this.column=0):this.column+=n)}toString(){return this.output}};function Hte(e,t){let r=new iL(t);return r.generator[e.type](e,r),r.output}var H1=(e,t,r)=>{let n,i=Rs(e),a=i.includes(` `),o=!1;if(a){let s=i.split(` `).filter(l=>l.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=z1(i,{ecmaVersion:2020,locations:!0});Fte(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=Ute(s).trimEnd()}catch(s){console.log(s,e,name),n='"error"'}if(a&&o){let s=n.split(` +`)}try{let s=z1(i,{ecmaVersion:2020,locations:!0});Pte(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=Hte(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]:H1(r.props[a],e,t)}),r.props),actions:Object.keys(r?.actions??{}).reduce((i,a)=>({...i,[a]:H1(r.actions[a],e,t)}),r.actions),styles:Object.keys(r?.styles??{}).reduce((i,a)=>({...i,[a]:H1(r.styles[a],e,t)}),r.styles)}),Wte=(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)},Hte=(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]:H1(l.props[c],i,a)}),l.props),actions:Object.keys(l?.actions??{}).reduce((u,c)=>({...u,[c]:H1(l.actions[c],i,a)}),l.actions),styles:Object.keys(l?.styles??{}).reduce((u,c)=>({...u,[c]:H1(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 V1=e=>({...e,rank:parseInt(e.rank),contexts:ir(e.contexts),styles:ir(e.styles),actions:ir(e.actions),props:ir(e.props),types:Vte(e.type),propsValue:Gte(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 Qte=(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"?Sa(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"?Sa(t.parent.node.styles?.layout)=="column"?3:2:0;return{...e,dragMode:o,resizeMode:a,dropMode:s,linkedNode:Im(t.node.props?.value)}};var AIe=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?rj(i):void 0}return await e.spaceManager.readFrame(r.basePath,r.ref)};function G1(e,t){let r=[],n=[];function i(a,o){let s=ji(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 gIe(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 vIe=async(e,t,r)=>{if(e.node.type=="frame"){let n=await AIe(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=ere(n.cols,e),[a,o]=Wte(i.node,n.schema.id,i.node.props,n.rows.map(u=>V1(u)),t),[s,l]=await Ck(i.node,a,r,o,!0,e.editorProps);return s?[gIe({...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]},Jte=async(e,t,r=0,n)=>{let[i,a]=await e.children.reduce(async(l,u)=>{let[c,f]=await l,d=Qte({...n,parentType:e.node.type,parentLastChildID:e.children[e.children.length-1]?.id},u),[p,h]=await Jte(u,t,f+1,d);return[[...c,p],h+1]},Promise.resolve([[],r])),[o,s]=await vIe({...e,children:i,editorProps:n},a,t);return[{...o,editorProps:Qte(o.editorProps,o)},s]},ere=(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}}}},aL=(e,t,r)=>Kte.default.cloneDeep({...e,[r]:{...e[r]??{},props:{...t??{},...e[r]?.props??{}}}}),oL=e=>({schemaId:e.id,id:e.id,type:"group",rank:0,name:e.id});var tj=async(e,t,r=d0)=>t?sL(Ao(t.schema),t.cols,t.rows.map(n=>V1(n)),e,r):null,sL=async(e,t,r,n,i=d0)=>{let a=r.find(s=>s.id==e.id)??oL(e),o=await Ck(a,r,n,r.length,!1,{...i,rootId:e.id}).then(s=>s[0]);return o&&kk(ere(t,o))},tre=e=>Object.keys(e.types).map(t=>({type:e.types[t],name:t,schemaId:t,value:e.propsValue?.[t],attrs:e.propsAttrs?.[t]})),Ck=async(e,t,r,n=0,i,a=d0,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 Jte(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 Vte=e=>e=="flow"?{value:"link"}:e=="container"||e=="group"||e=="content"||e=="frame"?{}:{value:e},yIe=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}},Gte=e=>e=="container"||e=="group"||e=="content"||e=="frame"?{}:{value:JSON.stringify({alias:yIe(e)})},rj=(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:G1({...e,id:t,node:{...e.node,id:t}},t).map(r=>lf(sf("$root",t,r,t)))});var nj=(e,t)=>!lL.default.isEqual(eL(e,["execPropsOptions","execProps","execStyles","execActions","parent"]),eL(t,["execPropsOptions","execProps","execStyles","execActions","parent"])),rre=(e,t,r,n)=>e.filter(i=>r[n]?.props[i]&&!lL.default.isEqual(r[n].props[i],t?.[i])),Dk=e=>{if(!e)return null;if(e.startsWith("$contexts")){let{context:t,prop:r}=uL(e);return r}else return Im(e)?.prop},uL=e=>{if(!e||_u(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]:H1(r.props[a],e,t)}),r.props),actions:Object.keys(r?.actions??{}).reduce((i,a)=>({...i,[a]:H1(r.actions[a],e,t)}),r.actions),styles:Object.keys(r?.styles??{}).reduce((i,a)=>({...i,[a]:H1(r.styles[a],e,t)}),r.styles)}),Vte=(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)},Gte=(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]:H1(l.props[c],i,a)}),l.props),actions:Object.keys(l?.actions??{}).reduce((u,c)=>({...u,[c]:H1(l.actions[c],i,a)}),l.actions),styles:Object.keys(l?.styles??{}).reduce((u,c)=>({...u,[c]:H1(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 V1=e=>({...e,rank:parseInt(e.rank),contexts:ir(e.contexts),styles:ir(e.styles),actions:ir(e.actions),props:ir(e.props),types:Qte(e.type),propsValue:Yte(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 Zte=(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"?Sa(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"?Sa(t.parent.node.styles?.layout)=="column"?3:2:0;return{...e,dragMode:o,resizeMode:a,dropMode:s,linkedNode:Im(t.node.props?.value)}};var AIe=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?rj(i):void 0}return await e.spaceManager.readFrame(r.basePath,r.ref)};function G1(e,t){let r=[],n=[];function i(a,o){let s=ji(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 gIe(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 vIe=async(e,t,r)=>{if(e.node.type=="frame"){let n=await AIe(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=rre(n.cols,e),[a,o]=Vte(i.node,n.schema.id,i.node.props,n.rows.map(u=>V1(u)),t),[s,l]=await Ck(i.node,a,r,o,!0,e.editorProps);return s?[gIe({...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]},tre=async(e,t,r=0,n)=>{let[i,a]=await e.children.reduce(async(l,u)=>{let[c,f]=await l,d=Zte({...n,parentType:e.node.type,parentLastChildID:e.children[e.children.length-1]?.id},u),[p,h]=await tre(u,t,f+1,d);return[[...c,p],h+1]},Promise.resolve([[],r])),[o,s]=await vIe({...e,children:i,editorProps:n},a,t);return[{...o,editorProps:Zte(o.editorProps,o)},s]},rre=(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}}}},aL=(e,t,r)=>ere.default.cloneDeep({...e,[r]:{...e[r]??{},props:{...t??{},...e[r]?.props??{}}}}),oL=e=>({schemaId:e.id,id:e.id,type:"group",rank:0,name:e.id});var tj=async(e,t,r=d0)=>t?sL(Ao(t.schema),t.cols,t.rows.map(n=>V1(n)),e,r):null,sL=async(e,t,r,n,i=d0)=>{let a=r.find(s=>s.id==e.id)??oL(e),o=await Ck(a,r,n,r.length,!1,{...i,rootId:e.id}).then(s=>s[0]);return o&&kk(rre(t,o))},nre=e=>Object.keys(e.types).map(t=>({type:e.types[t],name:t,schemaId:t,value:e.propsValue?.[t],attrs:e.propsAttrs?.[t]})),Ck=async(e,t,r,n=0,i,a=d0,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 tre(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 Qte=e=>e=="flow"?{value:"link"}:e=="container"||e=="group"||e=="content"||e=="frame"?{}:{value:e},yIe=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}},Yte=e=>e=="container"||e=="group"||e=="content"||e=="frame"?{}:{value:JSON.stringify({alias:yIe(e)})},rj=(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:G1({...e,id:t,node:{...e.node,id:t}},t).map(r=>lf(sf("$root",t,r,t)))});var nj=(e,t)=>!lL.default.isEqual(eL(e,["execPropsOptions","execProps","execStyles","execActions","parent"]),eL(t,["execPropsOptions","execProps","execStyles","execActions","parent"])),ire=(e,t,r,n)=>e.filter(i=>r[n]?.props[i]&&!lL.default.isEqual(r[n].props[i],t?.[i])),Dk=e=>{if(!e)return null;if(e.startsWith("$contexts")){let{context:t,prop:r}=uL(e);return r}else return Im(e)?.prop},uL=e=>{if(!e||_u(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=z1(e,{ecmaVersion:2020});Kq(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||_u(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=z1(e,{ecmaVersion:2020});Kq(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]}},bIe=async(e,t,r,n)=>{if(!t)return;let i=G1(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)},nre=async(e,t,r,n)=>e.spaceManager.readFrame(t.path,r).then(i=>bIe(e,i,t,n)),Ok=(e,t)=>Object.keys(e).reduce((r,n)=>({...r,[n]:{uniques:iw.uniques,cols:iw.cols,rows:e[n].rows}}),{m_fields:{uniques:ua.uniques,cols:ua.cols,rows:Object.values(e).flatMap(r=>r.cols)}});var Za={def:{id:"icon",icon:"ui//gem"},node:{icon:"ui//gem",schemaId:"icon",parentId:"",name:W.properties.icon.label,rank:0,id:"icon",type:"icon",props:{value:""},types:{value:"icon"},styles:{"--icon-size":"'100%'",width:"'36px'",height:"'36px'"}}},p0={def:{id:"space",icon:"ui//layout-grid",description:W.frames.context.description},node:{icon:"ui//layout-grid",schemaId:"space",parentId:"",name:W.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:W.properties.image.label,rank:0,id:"image",type:"image",props:{value:""},types:{value:"image"}}},pmt={def:{id:"text",icon:"ui//audio"},node:{icon:"ui//audio",schemaId:"audio",parentId:"",name:W.properties.audio.label,rank:0,id:"audio",type:"audio",props:{value:""},types:{value:"audio"}}},mn={def:{id:"text",icon:"ui//type",description:W.frames.label.description},node:{icon:"ui//type",schemaId:"text",parentId:"",name:W.frames.label.label,rank:0,id:"text",type:"text",props:{value:""},types:{value:"text"},styles:{width:"'100%'"}}},Q1={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:W.commands.flow,rank:0,id:"flow",type:"flow",props:{value:""},styles:{width:"'100%'",padding:"'8px'"},types:{value:"link"}}},mmt={def:{id:"newNode",icon:"ui//lightbulb"},node:{id:"node",schemaId:"node",name:W.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:W.commands.group,rank:0,parentId:"",styles:{layout:'"column"',width:"'100%'",height:"'100px'"},type:"group"}},hmt={def:{id:"spacerNode",icon:"ui//unfold-horizontal"},node:{id:"group",schemaId:"group",name:W.commands.group,rank:0,parentId:"",styles:{flex:"'1'"},type:"group"}},ire={def:{id:"columnsNode",icon:"ui//columns"},node:{id:"container",schemaId:"container",name:W.commands.columns,rank:0,parentId:"",styles:{layout:'"row"',width:"'100%'",gap:"'24px'"},type:"container"}},ij={def:{id:"columnNode",icon:"ui//columns"},node:{icon:"ui//columns",id:"column",schemaId:"column",name:W.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 xIe=[{...hn.node,id:"main",type:"group",rank:0,schemaId:"main",props:{note:"",space:""},types:{note:"link",space:"space"},propsValue:{note:JSON.stringify({alias:W.defaults.spaceNote}),space:JSON.stringify({alias:W.defaults.spaceContext})},styles:{layout:'"column"'}},{...p0.node,id:"context",rank:1,props:{value:"$contexts.$space.space"},styles:{width:'"100%"'},parentId:"main",schemaId:"main"}],wIe=[{...hn.node,id:"main",type:"group",rank:0,schemaId:"main",props:{note:"",space:""},types:{note:"link",space:"space"},propsValue:{note:JSON.stringify({alias:W.defaults.spaceNote}),space:JSON.stringify({alias:W.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"},{...p0.node,id:"context",rank:1,props:{value:"$contexts.$space.space"},styles:{width:'"100%"'},parentId:"main",schemaId:"main"}],are={[i0]:{schema:{id:i0,name:"All",type:"view",def:JSON.stringify({db:pr,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:[]}},aj={main:{schema:OM(T1),cols:[],rows:wIe.map(e=>lf(e))},[i0]:{schema:bp,cols:sd.rows,rows:[]}},aw={main:{schema:OM(T1),cols:[],rows:xIe.map(e=>lf(e))},[i0]:{schema:bp,cols:sd.rows,rows:[]}},ore=[{name:"space",type:"space",schemaId:"main",value:JSON.stringify({alias:W.defaults.spaceContext})},{name:"note",type:"link",schemaId:"main",value:JSON.stringify({alias:W.defaults.spaceNote})}];var m0=e=>[e.fmKeyBanner,e.fmKeySticker,e.fmKeyColor,e.fmKeyBanner,e.fmKeyBannerOffset,Mk,Tk,Fk,_k,jk,Nk];var Cmt={name:W.menu.vault,readOnly:!1,path:"/",label:{thumbnail:"",name:W.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}},Mk="_contexts",jk="_template",Nk="_templateName",Tk="_filters",Fk="_links",_k="_sort",oj="_subfolders";var h0=(e,t,r)=>{let n=Hn(t.toLowerCase()),i=e.superstate.settings.spacesFolder+"/"+eee(t);return{name:t,path:n,isRemote:!1,readOnly:r,folderPath:i,defPath:`${i}/${e.superstate.settings.spaceSubFolder}/def.json`,notePath:`${i}/${ZE(t)}.md`,framePath:nf(i+"/",e)+"views.mdb",dbPath:nf(i+"/",e)+"context.mdb",commandsPath:nf(i+"/",e)+"commands.mdb"}},sre=(e,t)=>{if(!t)return;if(t.startsWith(Xg)){let i=t.slice(Xg.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"?Pk(e,Vl(r.path)):n=="tag"?r.path.length>1?h0(e,r.authority+"/"+r.path):h0(e,r.authority):n=="vault"?Pk(e,"/"):null},Pk=(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=o0(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 lre=(e,t)=>tr(t).some(r=>e==$x(r)),SIe=(e,t,r)=>yi(tr(r).map(n=>$x(n)==e?t:e)),EIe=(e,t)=>yi(tr(t).filter(r=>r!=e)),cL=e=>e.filter(t=>t.type.startsWith("link")||t.type.startsWith("context")),ure=(e,t,r,n)=>{if(n.length==0)return t;let i=n.reduce((a,o)=>{if(lre(r,t[o.name])){let s=EIe(r,t[o.name]);return e.saveProperties(t[mt],{[o.name]:ca(o.type,s,!0)}),{...a,[o.name]:s}}return a},{});return{...t,...i}},cre=(e,t,r,n,i)=>{if(i.length==0)return t;let a=i.reduce((o,s)=>{if(lre(r,t[s.name])){let l=SIe(r,n,t[s.name]);return e.saveProperties(t[mt],{[s.name]:ca(s.type,l,!0)}),{...o,[s.name]:l}}return o},{});return{...t,...a}};var fre=(e,t,r)=>({...e,rows:e.rows.map(n=>n[mt]==t?{...n,[mt]:r}:n)}),dre=(e,t)=>({...e,rows:e.rows.filter(r=>r[mt]!=t)});var fL=(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(bi());var To=Ae(Te());var nt=Ae(Te()),R0=Ae(bl());var No=Ae(Te());function Vae(){for(var e=arguments.length,t=new Array(e),r=0;rn=>{t.forEach(i=>i(n))},t)}var O6=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function cy(e){let t=Object.prototype.toString.call(e);return t==="[object Window]"||t==="[object global]"}function MN(e){return"nodeType"in e}function nu(e){var t,r;return e?cy(e)?e:MN(e)&&(t=(r=e.ownerDocument)==null?void 0:r.defaultView)!=null?t:window:window}function jN(e){let{Document:t}=nu(e);return e instanceof t}function Iw(e){return cy(e)?!1:e instanceof nu(e).HTMLElement}function NU(e){return e instanceof nu(e).SVGElement}function fy(e){return e?cy(e)?e.document:MN(e)?jN(e)?e:Iw(e)||NU(e)?e.ownerDocument:document:document:document}var bc=O6?No.useLayoutEffect:No.useEffect;function M6(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 j6(e){let t=M6(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 N6(e){let t=(0,No.useRef)();return(0,No.useEffect)(()=>{t.current=e},[e]),t.current}var jU={};function dy(e,t){return(0,No.useMemo)(()=>{if(t)return t;let r=jU[e]==null?0:jU[e]+1;return jU[e]=r,e+"-"+r},[e,t])}function Qae(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 py=Qae(1),my=Qae(-1);function L5e(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 z5e(e){if(!e)return!1;let{TouchEvent:t}=nu(e.target);return t&&e instanceof t}function T6(e){if(z5e(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 L5e(e)?{x:e.clientX,y:e.clientY}:null}var qu=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[qu.Translate.toString(e),qu.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:r,easing:n}=e;return t+" "+r+"ms "+n}}}),Hae="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function Yae(e){return e.matches(Hae)?e:e.querySelector(Hae)}var hy=Ae(Te()),U5e={display:"none"};function Zae(e){let{id:t,value:r}=e;return hy.default.createElement("div",{id:t,style:U5e},r)}function Xae(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 hy.default.createElement("div",{id:t,style:i,role:"status","aria-live":n,"aria-atomic":!0},r)}function Kae(){let[e,t]=(0,hy.useState)("");return{announce:(0,hy.useCallback)(n=>{n!=null&&t(n)},[]),announcement:e}}var foe=(0,nt.createContext)(null);function Da(e){let t=(0,nt.useContext)(foe);(0,nt.useEffect)(()=>{if(!t)throw new Error("useDndMonitor must be used within a children of ");return t(e)},[e,t])}function W5e(){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 H5e={draggable:` +`)}try{let n=z1(e,{ecmaVersion:2020});Kq(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]}},bIe=async(e,t,r,n)=>{if(!t)return;let i=G1(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)},are=async(e,t,r,n)=>e.spaceManager.readFrame(t.path,r).then(i=>bIe(e,i,t,n)),Ok=(e,t)=>Object.keys(e).reduce((r,n)=>({...r,[n]:{uniques:iw.uniques,cols:iw.cols,rows:e[n].rows}}),{m_fields:{uniques:ua.uniques,cols:ua.cols,rows:Object.values(e).flatMap(r=>r.cols)}});var Za={def:{id:"icon",icon:"ui//gem"},node:{icon:"ui//gem",schemaId:"icon",parentId:"",name:W.properties.icon.label,rank:0,id:"icon",type:"icon",props:{value:""},types:{value:"icon"},styles:{"--icon-size":"'100%'",width:"'36px'",height:"'36px'"}}},p0={def:{id:"space",icon:"ui//layout-grid",description:W.frames.context.description},node:{icon:"ui//layout-grid",schemaId:"space",parentId:"",name:W.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:W.properties.image.label,rank:0,id:"image",type:"image",props:{value:""},types:{value:"image"}}},hmt={def:{id:"text",icon:"ui//audio"},node:{icon:"ui//audio",schemaId:"audio",parentId:"",name:W.properties.audio.label,rank:0,id:"audio",type:"audio",props:{value:""},types:{value:"audio"}}},mn={def:{id:"text",icon:"ui//type",description:W.frames.label.description},node:{icon:"ui//type",schemaId:"text",parentId:"",name:W.frames.label.label,rank:0,id:"text",type:"text",props:{value:""},types:{value:"text"},styles:{width:"'100%'"}}},Q1={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:W.commands.flow,rank:0,id:"flow",type:"flow",props:{value:""},styles:{width:"'100%'",padding:"'8px'"},types:{value:"link"}}},Amt={def:{id:"newNode",icon:"ui//lightbulb"},node:{id:"node",schemaId:"node",name:W.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:W.commands.group,rank:0,parentId:"",styles:{layout:'"column"',width:"'100%'",height:"'100px'"},type:"group"}},gmt={def:{id:"spacerNode",icon:"ui//unfold-horizontal"},node:{id:"group",schemaId:"group",name:W.commands.group,rank:0,parentId:"",styles:{flex:"'1'"},type:"group"}},ore={def:{id:"columnsNode",icon:"ui//columns"},node:{id:"container",schemaId:"container",name:W.commands.columns,rank:0,parentId:"",styles:{layout:'"row"',width:"'100%'",gap:"'24px'"},type:"container"}},ij={def:{id:"columnNode",icon:"ui//columns"},node:{icon:"ui//columns",id:"column",schemaId:"column",name:W.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 xIe=[{...hn.node,id:"main",type:"group",rank:0,schemaId:"main",props:{note:"",space:""},types:{note:"link",space:"space"},propsValue:{note:JSON.stringify({alias:W.defaults.spaceNote}),space:JSON.stringify({alias:W.defaults.spaceContext})},styles:{layout:'"column"'}},{...p0.node,id:"context",rank:1,props:{value:"$contexts.$space.space"},styles:{width:'"100%"'},parentId:"main",schemaId:"main"}],wIe=[{...hn.node,id:"main",type:"group",rank:0,schemaId:"main",props:{note:"",space:""},types:{note:"link",space:"space"},propsValue:{note:JSON.stringify({alias:W.defaults.spaceNote}),space:JSON.stringify({alias:W.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"},{...p0.node,id:"context",rank:1,props:{value:"$contexts.$space.space"},styles:{width:'"100%"'},parentId:"main",schemaId:"main"}],sre={[i0]:{schema:{id:i0,name:"All",type:"view",def:JSON.stringify({db:pr,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:[]}},aj={main:{schema:OM(T1),cols:[],rows:wIe.map(e=>lf(e))},[i0]:{schema:bp,cols:sd.rows,rows:[]}},aw={main:{schema:OM(T1),cols:[],rows:xIe.map(e=>lf(e))},[i0]:{schema:bp,cols:sd.rows,rows:[]}},lre=[{name:"space",type:"space",schemaId:"main",value:JSON.stringify({alias:W.defaults.spaceContext})},{name:"note",type:"link",schemaId:"main",value:JSON.stringify({alias:W.defaults.spaceNote})}];var m0=e=>[e.fmKeyBanner,e.fmKeySticker,e.fmKeyColor,e.fmKeyBanner,e.fmKeyBannerOffset,Mk,Tk,Fk,_k,jk,Nk];var Omt={name:W.menu.vault,readOnly:!1,path:"/",label:{thumbnail:"",name:W.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}},Mk="_contexts",jk="_template",Nk="_templateName",Tk="_filters",Fk="_links",_k="_sort",oj="_subfolders";var h0=(e,t,r)=>{let n=Hn(t.toLowerCase()),i=e.superstate.settings.spacesFolder+"/"+ree(t);return{name:t,path:n,isRemote:!1,readOnly:r,folderPath:i,defPath:`${i}/${e.superstate.settings.spaceSubFolder}/def.json`,notePath:`${i}/${ZE(t)}.md`,framePath:nf(i+"/",e)+"views.mdb",dbPath:nf(i+"/",e)+"context.mdb",commandsPath:nf(i+"/",e)+"commands.mdb"}},ure=(e,t)=>{if(!t)return;if(t.startsWith(Xg)){let i=t.slice(Xg.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"?Pk(e,Vl(r.path)):n=="tag"?r.path.length>1?h0(e,r.authority+"/"+r.path):h0(e,r.authority):n=="vault"?Pk(e,"/"):null},Pk=(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=o0(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 cre=(e,t)=>tr(t).some(r=>e==$x(r)),SIe=(e,t,r)=>yi(tr(r).map(n=>$x(n)==e?t:e)),EIe=(e,t)=>yi(tr(t).filter(r=>r!=e)),cL=e=>e.filter(t=>t.type.startsWith("link")||t.type.startsWith("context")),fre=(e,t,r,n)=>{if(n.length==0)return t;let i=n.reduce((a,o)=>{if(cre(r,t[o.name])){let s=EIe(r,t[o.name]);return e.saveProperties(t[mt],{[o.name]:ca(o.type,s,!0)}),{...a,[o.name]:s}}return a},{});return{...t,...i}},dre=(e,t,r,n,i)=>{if(i.length==0)return t;let a=i.reduce((o,s)=>{if(cre(r,t[s.name])){let l=SIe(r,n,t[s.name]);return e.saveProperties(t[mt],{[s.name]:ca(s.type,l,!0)}),{...o,[s.name]:l}}return o},{});return{...t,...a}};var pre=(e,t,r)=>({...e,rows:e.rows.map(n=>n[mt]==t?{...n,[mt]:r}:n)}),mre=(e,t)=>({...e,rows:e.rows.filter(r=>r[mt]!=t)});var fL=(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(bi());var To=Ae(Te());var nt=Ae(Te()),R0=Ae(bl());var No=Ae(Te());function Qae(){for(var e=arguments.length,t=new Array(e),r=0;rn=>{t.forEach(i=>i(n))},t)}var O6=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function cy(e){let t=Object.prototype.toString.call(e);return t==="[object Window]"||t==="[object global]"}function MN(e){return"nodeType"in e}function nu(e){var t,r;return e?cy(e)?e:MN(e)&&(t=(r=e.ownerDocument)==null?void 0:r.defaultView)!=null?t:window:window}function jN(e){let{Document:t}=nu(e);return e instanceof t}function Iw(e){return cy(e)?!1:e instanceof nu(e).HTMLElement}function NU(e){return e instanceof nu(e).SVGElement}function fy(e){return e?cy(e)?e.document:MN(e)?jN(e)?e:Iw(e)||NU(e)?e.ownerDocument:document:document:document}var bc=O6?No.useLayoutEffect:No.useEffect;function M6(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 j6(e){let t=M6(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 N6(e){let t=(0,No.useRef)();return(0,No.useEffect)(()=>{t.current=e},[e]),t.current}var jU={};function dy(e,t){return(0,No.useMemo)(()=>{if(t)return t;let r=jU[e]==null?0:jU[e]+1;return jU[e]=r,e+"-"+r},[e,t])}function Zae(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 py=Zae(1),my=Zae(-1);function L5e(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 z5e(e){if(!e)return!1;let{TouchEvent:t}=nu(e.target);return t&&e instanceof t}function T6(e){if(z5e(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 L5e(e)?{x:e.clientX,y:e.clientY}:null}var qu=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[qu.Translate.toString(e),qu.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:r,easing:n}=e;return t+" "+r+"ms "+n}}}),Gae="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function Xae(e){return e.matches(Gae)?e:e.querySelector(Gae)}var hy=Ae(Te()),U5e={display:"none"};function Kae(e){let{id:t,value:r}=e;return hy.default.createElement("div",{id:t,style:U5e},r)}function Jae(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 hy.default.createElement("div",{id:t,style:i,role:"status","aria-live":n,"aria-atomic":!0},r)}function eoe(){let[e,t]=(0,hy.useState)("");return{announce:(0,hy.useCallback)(n=>{n!=null&&t(n)},[]),announcement:e}}var doe=(0,nt.createContext)(null);function Da(e){let t=(0,nt.useContext)(doe);(0,nt.useEffect)(()=>{if(!t)throw new Error("useDndMonitor must be used within a children of ");return t(e)},[e,t])}function W5e(){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 H5e={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. - `},V5e={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 G5e(e){let{announcements:t=V5e,container:r,hiddenTextDescribedById:n,screenReaderInstructions:i=H5e}=e,{announce:a,announcement:o}=Kae(),s=dy("DndLiveRegion"),[l,u]=(0,nt.useState)(!1);if((0,nt.useEffect)(()=>{u(!0)},[]),Da((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(Zae,{id:n,value:i.draggable}),nt.default.createElement(Xae,{id:s,announcement:o}));return r?(0,R0.createPortal)(c,r):c}var ds;(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"})(ds||(ds={}));function TN(){}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 doe(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function Q5e(e,t){let r=T6(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 poe(e,t){let{data:{value:r}}=e,{data:{value:n}}=t;return r-n}function Y5e(e,t){let{data:{value:r}}=e,{data:{value:n}}=t;return n-r}function Jae(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 $U(e,t){if(!e||e.length===0)return null;let[r]=e;return t?r[t]:r}function eoe(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 PN=e=>{let{collisionRect:t,droppableRects:r,droppableContainers:n}=e,i=eoe(t,t.left,t.top),a=[];for(let o of n){let{id:s}=o,l=r.get(s);if(l){let u=doe(eoe(l),i);a.push({id:s,data:{droppableContainer:o,value:u}})}}return a.sort(poe)},moe=e=>{let{collisionRect:t,droppableRects:r,droppableContainers:n}=e,i=Jae(t),a=[];for(let o of n){let{id:s}=o,l=r.get(s);if(l){let u=Jae(l),c=i.reduce((d,p,h)=>d+doe(u[h],p),0),f=Number((c/4).toFixed(4));a.push({id:s,data:{droppableContainer:o,value:f}})}}return a.sort(poe)};function Z5e(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=Z5e(s,t);l>0&&i.push({id:o,data:{droppableContainer:a,value:l}})}}return i.sort(Y5e)};function X5e(e,t,r){return{...e,scaleX:t&&r?t.width/r.width:1,scaleY:t&&r?t.height/r.height:1}}function hoe(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:Fp}function K5e(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 J5e=K5e(1);function Aoe(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 e9e(e,t,r){let n=Aoe(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 t9e={ignoreTransform:!1};function vy(e,t){t===void 0&&(t=t9e);let r=e.getBoundingClientRect();if(t.ignoreTransform){let{transform:u,transformOrigin:c}=nu(e).getComputedStyle(e);u&&(r=e9e(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 toe(e){return vy(e,{ignoreTransform:!0})}function r9e(e){let t=e.innerWidth,r=e.innerHeight;return{top:0,left:0,right:t,bottom:r,width:t,height:r}}function n9e(e,t){return t===void 0&&(t=nu(e).getComputedStyle(e)),t.position==="fixed"}function i9e(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 I6(e,t){let r=[];function n(i){if(t!=null&&r.length>=t||!i)return r;if(jN(i)&&i.scrollingElement!=null&&!r.includes(i.scrollingElement))return r.push(i.scrollingElement),r;if(!Iw(i)||NU(i)||r.includes(i))return r;let a=nu(e).getComputedStyle(i);return i!==e&&i9e(i,a)&&r.push(i),n9e(i,a)?r:n(i.parentNode)}return e?n(e):r}function goe(e){let[t]=I6(e,1);return t??null}function TU(e){return!O6||!e?null:cy(e)?e:MN(e)?jN(e)||e===fy(e).scrollingElement?window:Iw(e)?e:null:null}function voe(e){return cy(e)?e.scrollX:e.scrollLeft}function yoe(e){return cy(e)?e.scrollY:e.scrollTop}function IU(e){return{x:voe(e),y:yoe(e)}}var Us;(function(e){e[e.Forward=1]="Forward",e[e.Backward=-1]="Backward"})(Us||(Us={}));function boe(e){return!O6||!e?!1:e===document.scrollingElement}function xoe(e){let t={x:0,y:0},r=boe(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 a9e={x:.2,y:.2};function o9e(e,t,r,n,i){let{top:a,left:o,right:s,bottom:l}=r;n===void 0&&(n=10),i===void 0&&(i=a9e);let{isTop:u,isBottom:c,isLeft:f,isRight:d}=xoe(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=Us.Backward,h.y=n*Math.abs((t.top+m.height-a)/m.height)):!c&&l>=t.bottom-m.height&&(p.y=Us.Forward,h.y=n*Math.abs((t.bottom-m.height-l)/m.height)),!d&&s>=t.right-m.width?(p.x=Us.Forward,h.x=n*Math.abs((t.right-m.width-s)/m.width)):!f&&o<=t.left+m.width&&(p.x=Us.Backward,h.x=n*Math.abs((t.left+m.width-o)/m.width)),{direction:p,speed:h}}function s9e(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 woe(e){return e.reduce((t,r)=>py(t,IU(r)),Fp)}function l9e(e){return e.reduce((t,r)=>t+voe(r),0)}function u9e(e){return e.reduce((t,r)=>t+yoe(r),0)}function Soe(e,t){if(t===void 0&&(t=vy),!e)return;let{top:r,left:n,bottom:i,right:a}=t(e);!goe(e)||(i<=0||a<=0||r>=window.innerHeight||n>=window.innerWidth)&&e.scrollIntoView({block:"center",inline:"center"})}var c9e=[["x",["left","right"],l9e],["y",["top","bottom"],u9e]],_6=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=I6(r),i=woe(n);this.rect={...t},this.width=t.width,this.height=t.height;for(let[a,o,s]of c9e)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})}},Ay=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 f9e(e){let{EventTarget:t}=nu(e);return e instanceof t?e:fy(e)}function FU(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 roe(e){e.preventDefault()}function d9e(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 Eoe={start:[$n.Space,$n.Enter],cancel:[$n.Esc],end:[$n.Space,$n.Enter]},p9e=(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}}},$0=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 Ay(fy(r)),this.windowListeners=new Ay(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&&Soe(n),r(Fp)}handleKeyDown(t){if($w(t)){let{active:r,context:n,options:i}=this.props,{keyboardCodes:a=Eoe,coordinateGetter:o=p9e,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=my(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}=xoe(m),k=s9e(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,py(my(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()}};$0.activators=[{eventName:"onKeyDown",handler:(e,t,r)=>{let{keyboardCodes:n=Eoe,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 noe(e){return Boolean(e&&"distance"in e)}function ioe(e){return Boolean(e&&"delay"in e)}var P6=class{constructor(t,r,n){var i;n===void 0&&(n=f9e(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=fy(o),this.documentListeners=new Ay(this.document),this.listeners=new Ay(n),this.windowListeners=new Ay(nu(o)),this.initialCoordinates=(i=T6(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,roe),this.windowListeners.add(Sd.VisibilityChange,this.handleCancel),this.windowListeners.add(Sd.ContextMenu,roe),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(ioe(r)){this.timeoutId=setTimeout(this.handleStart,r.delay);return}if(noe(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,d9e,{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=T6(t))!=null?r:Fp,u=my(i,l);if(!n&&s){if(noe(s)){if(s.tolerance!=null&&FU(u,s.tolerance))return this.handleCancel();if(FU(u,s.distance))return this.handleStart()}return ioe(s)&&FU(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()}},m9e={move:{name:"pointermove"},end:{name:"pointerup"}},FN=class extends P6{constructor(t){let{event:r}=t,n=fy(r.target);super(t,m9e,n)}};FN.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 h9e={move:{name:"mousemove"},end:{name:"mouseup"}},BU;(function(e){e[e.RightClick=2]="RightClick"})(BU||(BU={}));var RA=class extends P6{constructor(t){super(t,h9e,fy(t.event.target))}};RA.activators=[{eventName:"onMouseDown",handler:(e,t)=>{let{nativeEvent:r}=e,{onActivation:n}=t;return r.button===BU.RightClick?!1:(n?.({event:r}),!0)}}];var _U={move:{name:"touchmove"},end:{name:"touchend"}},$A=class extends P6{constructor(t){super(t,_U)}static setup(){return window.addEventListener(_U.move.name,t,{capture:!1,passive:!1}),function(){window.removeEventListener(_U.move.name,t)};function t(){}}};$A.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 F6;(function(e){e[e.Pointer=0]="Pointer",e[e.DraggableRect=1]="DraggableRect"})(F6||(F6={}));var _N;(function(e){e[e.TreeOrder=0]="TreeOrder",e[e.ReversedTreeOrder=1]="ReversedTreeOrder"})(_N||(_N={}));function A9e(e){let{acceleration:t,activator:r=F6.Pointer,canScroll:n,draggingRect:i,enabled:a,interval:o=5,order:s=_N.TreeOrder,pointerCoordinates:l,scrollableAncestors:u,scrollableAncestorRects:c,delta:f,threshold:d}=e,p=v9e({delta:f,disabled:!a}),[h,m]=Gae(),g=(0,nt.useRef)({x:0,y:0}),A=(0,nt.useRef)({x:0,y:0}),b=(0,nt.useMemo)(()=>{switch(r){case F6.Pointer:return l?{top:l.y,bottom:l.y,left:l.x,right:l.x}:null;case F6.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===_N.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}=o9e(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 g9e={x:{[Us.Backward]:!1,[Us.Forward]:!1},y:{[Us.Backward]:!1,[Us.Forward]:!1}};function v9e(e){let{delta:t,disabled:r}=e,n=N6(t);return Rw(i=>{if(r||!n||!i)return g9e;let a={x:Math.sign(t.x-n.x),y:Math.sign(t.y-n.y)};return{x:{[Us.Backward]:i.x[Us.Backward]||a.x===-1,[Us.Forward]:i.x[Us.Forward]||a.x===1},y:{[Us.Backward]:i.y[Us.Backward]||a.y===-1,[Us.Forward]:i.y[Us.Forward]||a.y===1}}},[r,t,n])}function y9e(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 b9e(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 RU;(function(e){e.Optimized="optimized"})(RU||(RU={}));var aoe=new Map;function x9e(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 aoe;if(!A||A===aoe||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 _6(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 LU(e,t){return Rw(r=>e?r||(typeof t=="function"?t(e):e):null,[t,e])}function w9e(e,t){return LU(e,t)}function S9e(e){let{callback:t,disabled:r}=e,n=M6(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 IN(e){let{callback:t,disabled:r}=e,n=M6(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 E9e(e){return new _6(vy(e),e)}function ooe(e,t,r){t===void 0&&(t=E9e);let[n,i]=(0,nt.useReducer)(s,null),a=S9e({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=IN({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 k9e(e){let t=LU(e);return hoe(e,t)}var soe=[];function C9e(e){let t=(0,nt.useRef)(e),r=Rw(n=>e?n&&n!==soe&&e&&t.current&&e.parentNode===t.current.parentNode?n:I6(e):soe,[e]);return(0,nt.useEffect)(()=>{t.current=e},[e]),r}function D9e(e){let[t,r]=(0,nt.useState)(null),n=(0,nt.useRef)(e),i=(0,nt.useCallback)(a=>{let o=TU(a.target);!o||r(s=>s?(s.set(o,IU(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=TU(l);return u?(u.addEventListener("scroll",i,{passive:!0}),[u,IU(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=TU(l);u?.removeEventListener("scroll",i)})}},[i,e]),(0,nt.useMemo)(()=>e.length?t?Array.from(t.values()).reduce((a,o)=>py(a,o),Fp):woe(e):Fp,[e,t])}function loe(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?my(e,r.current):Fp}function O9e(e){(0,nt.useEffect)(()=>{if(!O6)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 M9e(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 koe(e){return(0,nt.useMemo)(()=>e?r9e(e):null,[e])}var PU=[];function j9e(e,t){t===void 0&&(t=vy);let[r]=e,n=koe(r?nu(r):null),[i,a]=(0,nt.useReducer)(s,PU),o=IN({callback:a});return e.length>0&&i===PU&&a(),bc(()=>{e.length?e.forEach(l=>o?.observe(l)):(o?.disconnect(),a())},[e]),i;function s(){return e.length?e.map(l=>boe(l)?n:new _6(t(l),l)):PU}}function Coe(e){if(!e)return null;if(e.children.length>1)return e;let t=e.children[0];return Iw(t)?t:e}function N9e(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=IN({callback:i}),o=(0,nt.useCallback)(u=>{let c=Coe(u);a?.disconnect(),c&&a?.observe(c),n(c?t(c):null)},[t,a]),[s,l]=j6(o);return(0,nt.useMemo)(()=>({nodeRef:s,rect:r,setRef:l}),[r,s,l])}var T9e=[{sensor:FN,options:{}},{sensor:$0,options:{}}],F9e={current:{}},NN={draggable:{measure:toe},droppable:{measure:toe,strategy:_p.WhileDragging,frequency:RU.Optimized},dragOverlay:{measure:vy}},gy=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}},_9e={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new gy,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:TN},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:NN,measureDroppableContainers:TN,windowRect:null,measuringScheduled:!1},Doe={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:TN,draggableNodes:new Map,over:null,measureDroppableContainers:TN},B6=(0,nt.createContext)(Doe),Ooe=(0,nt.createContext)(_9e);function P9e(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new gy}}}function I9e(e,t){switch(t.type){case ds.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case ds.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 ds.DragEnd:case ds.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case ds.RegisterDroppable:{let{element:r}=t,{id:n}=r,i=new gy(e.droppable.containers);return i.set(n,r),{...e,droppable:{...e.droppable,containers:i}}}case ds.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 gy(e.droppable.containers);return o.set(r,{...a,disabled:i}),{...e,droppable:{...e.droppable,containers:o}}}case ds.UnregisterDroppable:{let{id:r,key:n}=t,i=e.droppable.containers.get(r);if(!i||n!==i.key)return e;let a=new gy(e.droppable.containers);return a.delete(r),{...e,droppable:{...e.droppable,containers:a}}}default:return e}}function B9e(e){let{disabled:t}=e,{active:r,activatorEvent:n,draggableNodes:i}=(0,nt.useContext)(B6),a=N6(n),o=N6(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=Yae(c);if(f){f.focus();break}}})}},[n,t,i,o,a]),null}function Moe(e,t){let{transform:r,...n}=t;return e!=null&&e.length?e.reduce((i,a)=>a({transform:i,...n}),r):r}function R9e(e){return(0,nt.useMemo)(()=>({draggable:{...NN.draggable,...e?.draggable},droppable:{...NN.droppable,...e?.droppable},dragOverlay:{...NN.dragOverlay,...e?.dragOverlay}}),[e?.draggable,e?.droppable,e?.dragOverlay])}function $9e(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=hoe(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=goe(u);d&&d.scrollBy({top:f.y,left:f.x})}},[t,o,s,n,r])}var BN=(0,nt.createContext)({...Fp,scaleX:1,scaleY:1}),B0;(function(e){e[e.Uninitialized=0]="Uninitialized",e[e.Initializing=1]="Initializing",e[e.Initialized=2]="Initialized"})(B0||(B0={}));var Lw=(0,nt.memo)(function(t){var r,n,i,a;let{id:o,accessibility:s,autoScroll:l=!0,children:u,sensors:c=T9e,collisionDetection:f=qU,measuring:d,modifiers:p,...h}=t,m=(0,nt.useReducer)(I9e,void 0,P9e),[g,A]=m,[b,v]=W5e(),[x,w]=(0,nt.useState)(B0.Uninitialized),S=x===B0.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:F9e,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=dy("DndDescribedBy",o),oe=(0,nt.useMemo)(()=>C.getEnabled(),[C]),te=R9e(d),{droppableRects:Q,measureDroppableContainers:fe,measuringScheduled:Ie}=x9e(oe,{dragging:S,dependencies:[O.x,O.y],config:te.droppable}),Se=y9e(j,k),Oe=(0,nt.useMemo)(()=>T?T6(T):null,[T]),ve=De(),ye=w9e(Se,te.draggable.measure);$9e({activeNode:k?j.get(k):null,config:ve.layoutShiftCompensation,initialRect:ye,measure:te.draggable.measure});let me=ooe(Se,te.draggable.measure,ye),ke=ooe(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=N9e({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=k9e(J?null:me),ie=koe(U?nu(U):null),re=C9e(S?ae??Se:null),Ee=j9e(re),Ce=Moe(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?py(Oe,O):null,he=D9e(re),ze=loe(he),Ye=loe(he,[me]),tt=py(Ce,ze),Ct=R?J5e(R,Ce):null,we=P&&Ct?f({active:P,collisionRect:Ct,droppableRects:Q,droppableContainers:oe,pointerCoordinates:_e}):null,Be=$U(we,"id"),[Le,Ze]=(0,nt.useState)(null),He=J?Ce:py(Ce,Ye),Qe=X5e(He,(a=Le?.rect)!=null?a:null,me),et=(0,nt.useCallback)((at,ht)=>{let{sensor:Yt,options:Wr}=ht;if(q.current==null)return;let en=j.get(q.current);if(!en)return;let tn=at.nativeEvent,ci=new Yt({active:q.current,activeNode:en,event:tn,options:Wr,context:$,onStart(Yi){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,R0.unstable_batchedUpdates)(()=>{Hc?.(Wf),w(B0.Initializing),A({type:ds.DragStart,initialCoordinates:Yi,active:Pa}),b({type:"onDragStart",event:Wf})})},onMove(Yi){A({type:ds.DragMove,coordinates:Yi})},onEnd:is(ds.DragEnd),onCancel:is(ds.DragCancel)});(0,R0.unstable_batchedUpdates)(()=>{I(ci),L(at.nativeEvent)});function is(Yi){return async function(){let{active:Dt,collisions:Hc,over:Wf,scrollAdjustedTranslate:Ha}=$.current,Eu=null;if(Dt&&Ha){let{cancelDrop:Yr}=_.current;Eu={activatorEvent:tn,active:Dt,collisions:Hc,delta:Ha,over:Wf},Yi===ds.DragEnd&&typeof Yr=="function"&&await Promise.resolve(Yr(Eu))&&(Yi=ds.DragCancel)}q.current=null,(0,R0.unstable_batchedUpdates)(()=>{A({type:Yi}),w(B0.Uninitialized),Ze(null),I(null),L(null);let Yr=Yi===ds.DragEnd?"onDragEnd":"onDragCancel";if(Eu){let zl=_.current[Yr];zl?.(Eu),b({type:Yr,event:Eu})}})}}},[j]),Ge=(0,nt.useCallback)((at,ht)=>(Yt,Wr)=>{let en=Yt.nativeEvent,tn=j.get(Wr);if(q.current!==null||!tn||en.dndKit||en.defaultPrevented)return;let ci={active:tn};at(Yt,ht.options,ci)===!0&&(en.dndKit={capturedBy:ht.sensor},q.current=Wr,et(Yt,ht))},[j,et]),G=b9e(c,Ge);O9e(c),bc(()=>{me&&x===B0.Initializing&&w(B0.Initialized)},[me,x]),(0,nt.useEffect)(()=>{let{onDragMove:at}=_.current,{active:ht,activatorEvent:Yt,collisions:Wr,over:en}=$.current;if(!ht||!Yt)return;let tn={active:ht,activatorEvent:Yt,collisions:Wr,delta:{x:tt.x,y:tt.y},over:en};(0,R0.unstable_batchedUpdates)(()=>{at?.(tn),b({type:"onDragMove",event:tn})})},[tt.x,tt.y]),(0,nt.useEffect)(()=>{let{active:at,activatorEvent:ht,collisions:Yt,droppableContainers:Wr,scrollAdjustedTranslate:en}=$.current;if(!at||q.current==null||!ht||!en)return;let{onDragOver:tn}=_.current,ci=Wr.get(Be),is=ci&&ci.rect.current?{id:ci.id,rect:ci.rect.current,data:ci.data,disabled:ci.disabled}:null,Yi={active:at,activatorEvent:ht,collisions:Yt,delta:{x:en.x,y:en.y},over:is};(0,R0.unstable_batchedUpdates)(()=>{Ze(is),tn?.(Yi),b({type:"onDragOver",event:Yi})})},[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]),A9e({...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(foe.Provider,{value:v},nt.default.createElement(B6.Provider,{value:Pe},nt.default.createElement(Ooe.Provider,{value:ue},nt.default.createElement(BN.Provider,{value:Qe},u)),nt.default.createElement(B9e,{disabled:s?.restoreFocus===!1})),nt.default.createElement(G5e,{...s,hiddenTextDescribedById:Y}));function De(){let at=z?.autoScrollEnabled===!1,ht=typeof l=="object"?l.enabled===!1:l===!1,Yt=S&&!at&&!ht;return typeof l=="object"?{...l,enabled:Yt}:{enabled:Yt}}}),q9e=(0,nt.createContext)(null),uoe="button",L9e="Droppable";function Ws(e){let{id:t,data:r,disabled:n=!1,attributes:i}=e,a=dy(L9e),{activators:o,activatorEvent:s,active:l,activeNodeRect:u,ariaDescribedById:c,draggableNodes:f,over:d}=(0,nt.useContext)(B6),{role:p=uoe,roleDescription:h="draggable",tabIndex:m=0}=i??{},g=l?.id===t,A=(0,nt.useContext)(g?BN:q9e),[b,v]=j6(),[x,w]=j6(),S=M9e(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===uoe?!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 zU(){return(0,nt.useContext)(Ooe)}var z9e="Droppable",U9e={timeout:25};function Lu(e){let{data:t,disabled:r=!1,id:n,resizeObserverConfig:i}=e,a=dy(z9e),{active:o,dispatch:s,over:l,measureDroppableContainers:u}=(0,nt.useContext)(B6),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}={...U9e,...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=IN({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]=j6(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:ds.RegisterDroppable,element:{id:n,key:a,disabled:r,node:w,rect:d,data:k}}),()=>s({type:ds.UnregisterDroppable,key:a,id:n})),[n]),(0,nt.useEffect)(()=>{r!==c.current.disabled&&(s({type:ds.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 W9e(e){let{animation:t,children:r}=e,[n,i]=(0,nt.useState)(null),[a,o]=(0,nt.useState)(null),s=N6(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 H9e={x:0,y:0,scaleX:1,scaleY:1};function V9e(e){let{children:t}=e;return nt.default.createElement(B6.Provider,{value:Doe},nt.default.createElement(BN.Provider,{value:H9e},t))}var G9e={position:"fixed",touchAction:"none"},Q9e=e=>$w(e)?"transform 250ms ease":void 0,Y9e=(0,nt.forwardRef)((e,t)=>{let{as:r,activatorEvent:n,adjustScale:i,children:a,className:o,rect:s,style:l,transform:u,transition:c=Q9e}=e;if(!s)return null;let f=i?u:{...u,scaleX:1,scaleY:1},d={...G9e,width:s.width,height:s.height,top:s.top,left:s.left,transform:qu.Transform.toString(f),transformOrigin:i&&n?Q5e(n,s):void 0,transition:typeof c=="function"?c(n):c,...l};return nt.default.createElement(r,{className:o,style:d,ref:t},a)}),Z9e=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)}},X9e=e=>{let{transform:{initial:t,final:r}}=e;return[{transform:qu.Transform.toString(t)},{transform:qu.Transform.toString(r)}]},UU={duration:250,easing:"ease",keyframes:X9e,sideEffects:Z9e({styles:{active:{opacity:"0"}}})};function K9e(e){let{config:t,draggableNodes:r,droppableContainers:n,measuringConfiguration:i}=e;return M6((a,o)=>{if(t===null)return;let s=r.get(a);if(!s)return;let l=s.node.current;if(!l)return;let u=Coe(o);if(!u)return;let{transform:c}=nu(o).getComputedStyle(o),f=Aoe(c);if(!f)return;let d=typeof t=="function"?t:J9e(t);return Soe(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 J9e(e){let{duration:t,easing:r,sideEffects:n,keyframes:i}={...UU,...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 coe=0;function e8e(e){return(0,nt.useMemo)(()=>{if(e!=null)return coe++,coe},[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}=zU(),S=(0,nt.useContext)(BN),k=e8e(f?.id),j=Moe(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=LU(d),C=K9e({config:n,draggableNodes:h,droppableContainers:m,measuringConfiguration:b}),N=O?g.setRef:void 0;return nt.default.createElement(V9e,null,nt.default.createElement(W9e,{animation:C},f&&k?nt.default.createElement(Y9e,{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 Hs(e,t,r){let n=e.slice();return n.splice(r<0?n.length+r:r,0,n.splice(t,1)[0]),n}function t8e(e,t){return e.reduce((r,n,i)=>{let a=t.get(n);return a&&(r[i]=a),r},Array(e.length))}function RN(e){return e!==null&&e>=0}function r8e(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=Hs(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 joe="Sortable",Noe=To.default.createContext({activeIndex:-1,containerId:joe,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:R6,disabled:{draggable:!1,droppable:!1}});function WU(e){let{children:t,id:r,items:n,strategy:i=R6,disabled:a=!1}=e,{active:o,dragOverlay:s,droppableRects:l,over:u,measureDroppableContainers:c}=zU(),f=dy(joe,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=!r8e(p,A.current),v=g!==-1&&m===-1||b,x=n8e(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:t8e(p,l),strategy:i}),[m,f,x.draggable,x.droppable,v,p,g,l,d,i]);return To.default.createElement(Noe.Provider,{value:w},t)}var i8e=e=>{let{id:t,items:r,activeIndex:n,overIndex:i}=e;return Hs(r,n,i).indexOf(t)},HU=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},a8e={duration:200,easing:"ease"},Toe="transform",o8e=qu.Transition.toString({property:Toe,duration:0,easing:"linear"}),s8e={roleDescription:"sortable"};function l8e(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=vy(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 Foe(e){let{animateLayoutChanges:t=HU,attributes:r,disabled:n,data:i,getNewIndex:a=i8e,id:o,strategy:s,resizeObserverConfig:l,transition:u=a8e}=e,{items:c,containerId:f,activeIndex:d,disabled:p,disableTransforms:h,sortedRects:m,overIndex:g,useDragOverlay:A,strategy:b}=(0,To.useContext)(Noe),v=u8e(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}=Lu({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}=Ws({id:o,data:w,attributes:{...s8e,...r},disabled:v.draggable}),oe=Vae(C,z),te=Boolean(N),Q=te&&!h&&RN(d)&&RN(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=RN(d)&&RN(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=l8e({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 o8e;if(!(fe&&!$w(D)||!u)&&(te||$))return qu.Transition.toString({...u,property:Toe})}}function u8e(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 $N(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 c8e=[$n.Down,$n.Right,$n.Up,$n.Left],qN=(e,t)=>{let{context:{active:r,collisionRect:n,droppableRects:i,droppableContainers:a,over:o,scrollableAncestors:s}}=t;if(c8e.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=I6(h).some((S,k)=>s[k]!==S),A=_oe(f,d),b=f8e(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:my(x,v)}}}};function _oe(e,t){return!$N(e)||!$N(t)?!1:e.data.current.sortable.containerId===t.data.current.sortable.containerId}function f8e(e,t){return!$N(e)||!$N(t)||!_oe(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=ir(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}},zN=async(e,t,r,n)=>{let i=await e.readTable(t.path,r);i&&await n(i,t)},qA=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 Poe=(e,t,r,n,i)=>({...e,rows:e.rows.map(a=>a[t]==r?{...a,[n]:yi(tr(a[n]).filter(o=>o!=i))}:a)}),d8e=(e,t,r,n,i)=>({...e,rows:e.rows.map(a=>a[t]==r?{...a,[n]:i}:a)});var p8e=(e,t,r)=>({...e,rows:r?Dx(e.rows,r,t):[...e.rows,...t]}),m8e=(e,t,r)=>({...e,rows:e.rows.map((n,i)=>i==r?t:n)}),Ioe=async(e,t,r,n,i,a,o)=>{zN(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:Hs(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})},UN=async(e,t,r,n,i,a,o)=>{e.contextForSpace(t.path).then(s=>{let u=(a??d8e)(s,mt,r,n,i);return o&&(u=fL(u,[r],o)),e.superstate.settings.enhancedLogs&&console.log("Saving Context Change: Update Context Value"),wc(e,t,u).then(c=>u)})};var h8e=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]:$i(o,i[o],r.find(s=>s.name==o).type)}:a,{}):{}},Boe=(e,t)=>t=="$space"?ore:t=="$context"?sd.rows:e.contextsIndex.get(t)?.contextTable?.cols??[],VU=async(e,t,r)=>{let n=async a=>{let o=a.rows.some(l=>l[mt]===t),s=await h8e(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=>qA(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)},WN=async(e,t,r,n,i)=>zN(e,t,r,async(a,o)=>{let s=m8e(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}),Roe=async(e,t,r,n,i)=>{let a=o=>({...o,rows:o.rows.map(s=>s[mt]==t?{...s,[r]:n}:s)});return qA(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})},$oe=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=>qA(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)},qoe=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=>qA(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)},Loe=async(e,t,r,n,i)=>zN(e,r,n,async(a,o)=>{let s=p8e(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}),zoe=async(e,t,r,n)=>zN(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 Uoe=async(e,t,r,n)=>{let i=n.map(a=>qA(e,a,async(o,s)=>{let l=cL(o.cols),u={...o,rows:o.rows.map(c=>cre(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)},Woe=async(e,t,r)=>{let n=r.map(i=>qA(e,i,async(a,o)=>{let s=cL(a.cols),l={...a,rows:a.rows.map(u=>ure(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)},Hoe=async(e,t,r,n)=>{let i=n.map(a=>qA(e,a,async(o,s)=>{let l=fre(o,t,r);return xc.default.isEqual(o,l)||await wc(e,s,l),l}));return Promise.all(i)},Voe=async(e,t,r)=>{let n=r.map(i=>qA(e,i,async(a,o)=>{let s=dre(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)},Goe=async(e,t,r,n)=>qA(e,n,async(i,a)=>{let o=fL(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 iT=["Matrix","Array"],aT=["number","BigNumber","Fraction"];function Joe(e,t){function r(n){if(n){var i=Ww(e,Bt);Koe(n,"matrix",iT),Koe(n,"number",aT),GU(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=iT,r.NUMBER_OPTIONS=aT,Object.keys(yy).forEach(n=>{Object.defineProperty(r,n,{get:()=>e[n],enumerable:!0,configurable:!0})}),r}function A8e(e,t){return e.indexOf(t)!==-1}function Koe(e,t,r){e[t]!==void 0&&!A8e(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. + `},V5e={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 G5e(e){let{announcements:t=V5e,container:r,hiddenTextDescribedById:n,screenReaderInstructions:i=H5e}=e,{announce:a,announcement:o}=eoe(),s=dy("DndLiveRegion"),[l,u]=(0,nt.useState)(!1);if((0,nt.useEffect)(()=>{u(!0)},[]),Da((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(Kae,{id:n,value:i.draggable}),nt.default.createElement(Jae,{id:s,announcement:o}));return r?(0,R0.createPortal)(c,r):c}var ds;(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"})(ds||(ds={}));function TN(){}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 qU(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function Q5e(e,t){let r=T6(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 LU(e,t){let{data:{value:r}}=e,{data:{value:n}}=t;return r-n}function Y5e(e,t){let{data:{value:r}}=e,{data:{value:n}}=t;return n-r}function IU(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 zU(e,t){if(!e||e.length===0)return null;let[r]=e;return t?r[t]:r}function toe(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 PN=e=>{let{collisionRect:t,droppableRects:r,droppableContainers:n}=e,i=toe(t,t.left,t.top),a=[];for(let o of n){let{id:s}=o,l=r.get(s);if(l){let u=qU(toe(l),i);a.push({id:s,data:{droppableContainer:o,value:u}})}}return a.sort(LU)},poe=e=>{let{collisionRect:t,droppableRects:r,droppableContainers:n}=e,i=IU(t),a=[];for(let o of n){let{id:s}=o,l=r.get(s);if(l){let u=IU(l),c=i.reduce((d,p,h)=>d+qU(u[h],p),0),f=Number((c/4).toFixed(4));a.push({id:s,data:{droppableContainer:o,value:f}})}}return a.sort(LU)};function Z5e(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=Z5e(s,t);l>0&&i.push({id:o,data:{droppableContainer:a,value:l}})}}return i.sort(Y5e)};function K5e(e,t){let{top:r,left:n,bottom:i,right:a}=t;return r<=e.y&&e.y<=i&&n<=e.x&&e.x<=a}var moe=e=>{let{droppableContainers:t,droppableRects:r,pointerCoordinates:n}=e;if(!n)return[];let i=[];for(let a of t){let{id:o}=a,s=r.get(o);if(s&&K5e(n,s)){let u=IU(s).reduce((f,d)=>f+qU(n,d),0),c=Number((u/4).toFixed(4));i.push({id:o,data:{droppableContainer:a,value:c}})}}return i.sort(LU)};function J5e(e,t,r){return{...e,scaleX:t&&r?t.width/r.width:1,scaleY:t&&r?t.height/r.height:1}}function hoe(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:Fp}function e9e(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 t9e=e9e(1);function Aoe(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 r9e(e,t,r){let n=Aoe(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 n9e={ignoreTransform:!1};function vy(e,t){t===void 0&&(t=n9e);let r=e.getBoundingClientRect();if(t.ignoreTransform){let{transform:u,transformOrigin:c}=nu(e).getComputedStyle(e);u&&(r=r9e(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 roe(e){return vy(e,{ignoreTransform:!0})}function i9e(e){let t=e.innerWidth,r=e.innerHeight;return{top:0,left:0,right:t,bottom:r,width:t,height:r}}function a9e(e,t){return t===void 0&&(t=nu(e).getComputedStyle(e)),t.position==="fixed"}function o9e(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 I6(e,t){let r=[];function n(i){if(t!=null&&r.length>=t||!i)return r;if(jN(i)&&i.scrollingElement!=null&&!r.includes(i.scrollingElement))return r.push(i.scrollingElement),r;if(!Iw(i)||NU(i)||r.includes(i))return r;let a=nu(e).getComputedStyle(i);return i!==e&&o9e(i,a)&&r.push(i),a9e(i,a)?r:n(i.parentNode)}return e?n(e):r}function goe(e){let[t]=I6(e,1);return t??null}function TU(e){return!O6||!e?null:cy(e)?e:MN(e)?jN(e)||e===fy(e).scrollingElement?window:Iw(e)?e:null:null}function voe(e){return cy(e)?e.scrollX:e.scrollLeft}function yoe(e){return cy(e)?e.scrollY:e.scrollTop}function BU(e){return{x:voe(e),y:yoe(e)}}var Us;(function(e){e[e.Forward=1]="Forward",e[e.Backward=-1]="Backward"})(Us||(Us={}));function boe(e){return!O6||!e?!1:e===document.scrollingElement}function xoe(e){let t={x:0,y:0},r=boe(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 s9e={x:.2,y:.2};function l9e(e,t,r,n,i){let{top:a,left:o,right:s,bottom:l}=r;n===void 0&&(n=10),i===void 0&&(i=s9e);let{isTop:u,isBottom:c,isLeft:f,isRight:d}=xoe(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=Us.Backward,h.y=n*Math.abs((t.top+m.height-a)/m.height)):!c&&l>=t.bottom-m.height&&(p.y=Us.Forward,h.y=n*Math.abs((t.bottom-m.height-l)/m.height)),!d&&s>=t.right-m.width?(p.x=Us.Forward,h.x=n*Math.abs((t.right-m.width-s)/m.width)):!f&&o<=t.left+m.width&&(p.x=Us.Backward,h.x=n*Math.abs((t.left+m.width-o)/m.width)),{direction:p,speed:h}}function u9e(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 woe(e){return e.reduce((t,r)=>py(t,BU(r)),Fp)}function c9e(e){return e.reduce((t,r)=>t+voe(r),0)}function f9e(e){return e.reduce((t,r)=>t+yoe(r),0)}function Soe(e,t){if(t===void 0&&(t=vy),!e)return;let{top:r,left:n,bottom:i,right:a}=t(e);!goe(e)||(i<=0||a<=0||r>=window.innerHeight||n>=window.innerWidth)&&e.scrollIntoView({block:"center",inline:"center"})}var d9e=[["x",["left","right"],c9e],["y",["top","bottom"],f9e]],_6=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=I6(r),i=woe(n);this.rect={...t},this.width=t.width,this.height=t.height;for(let[a,o,s]of d9e)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})}},Ay=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 p9e(e){let{EventTarget:t}=nu(e);return e instanceof t?e:fy(e)}function FU(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 noe(e){e.preventDefault()}function m9e(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 Eoe={start:[$n.Space,$n.Enter],cancel:[$n.Esc],end:[$n.Space,$n.Enter]},h9e=(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}}},$0=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 Ay(fy(r)),this.windowListeners=new Ay(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&&Soe(n),r(Fp)}handleKeyDown(t){if($w(t)){let{active:r,context:n,options:i}=this.props,{keyboardCodes:a=Eoe,coordinateGetter:o=h9e,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=my(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}=xoe(m),k=u9e(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,py(my(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()}};$0.activators=[{eventName:"onKeyDown",handler:(e,t,r)=>{let{keyboardCodes:n=Eoe,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 ioe(e){return Boolean(e&&"distance"in e)}function aoe(e){return Boolean(e&&"delay"in e)}var P6=class{constructor(t,r,n){var i;n===void 0&&(n=p9e(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=fy(o),this.documentListeners=new Ay(this.document),this.listeners=new Ay(n),this.windowListeners=new Ay(nu(o)),this.initialCoordinates=(i=T6(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,noe),this.windowListeners.add(Sd.VisibilityChange,this.handleCancel),this.windowListeners.add(Sd.ContextMenu,noe),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(aoe(r)){this.timeoutId=setTimeout(this.handleStart,r.delay);return}if(ioe(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,m9e,{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=T6(t))!=null?r:Fp,u=my(i,l);if(!n&&s){if(ioe(s)){if(s.tolerance!=null&&FU(u,s.tolerance))return this.handleCancel();if(FU(u,s.distance))return this.handleStart()}return aoe(s)&&FU(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()}},A9e={move:{name:"pointermove"},end:{name:"pointerup"}},FN=class extends P6{constructor(t){let{event:r}=t,n=fy(r.target);super(t,A9e,n)}};FN.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 g9e={move:{name:"mousemove"},end:{name:"mouseup"}},RU;(function(e){e[e.RightClick=2]="RightClick"})(RU||(RU={}));var RA=class extends P6{constructor(t){super(t,g9e,fy(t.event.target))}};RA.activators=[{eventName:"onMouseDown",handler:(e,t)=>{let{nativeEvent:r}=e,{onActivation:n}=t;return r.button===RU.RightClick?!1:(n?.({event:r}),!0)}}];var _U={move:{name:"touchmove"},end:{name:"touchend"}},$A=class extends P6{constructor(t){super(t,_U)}static setup(){return window.addEventListener(_U.move.name,t,{capture:!1,passive:!1}),function(){window.removeEventListener(_U.move.name,t)};function t(){}}};$A.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 F6;(function(e){e[e.Pointer=0]="Pointer",e[e.DraggableRect=1]="DraggableRect"})(F6||(F6={}));var _N;(function(e){e[e.TreeOrder=0]="TreeOrder",e[e.ReversedTreeOrder=1]="ReversedTreeOrder"})(_N||(_N={}));function v9e(e){let{acceleration:t,activator:r=F6.Pointer,canScroll:n,draggingRect:i,enabled:a,interval:o=5,order:s=_N.TreeOrder,pointerCoordinates:l,scrollableAncestors:u,scrollableAncestorRects:c,delta:f,threshold:d}=e,p=b9e({delta:f,disabled:!a}),[h,m]=Yae(),g=(0,nt.useRef)({x:0,y:0}),A=(0,nt.useRef)({x:0,y:0}),b=(0,nt.useMemo)(()=>{switch(r){case F6.Pointer:return l?{top:l.y,bottom:l.y,left:l.x,right:l.x}:null;case F6.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===_N.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}=l9e(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 y9e={x:{[Us.Backward]:!1,[Us.Forward]:!1},y:{[Us.Backward]:!1,[Us.Forward]:!1}};function b9e(e){let{delta:t,disabled:r}=e,n=N6(t);return Rw(i=>{if(r||!n||!i)return y9e;let a={x:Math.sign(t.x-n.x),y:Math.sign(t.y-n.y)};return{x:{[Us.Backward]:i.x[Us.Backward]||a.x===-1,[Us.Forward]:i.x[Us.Forward]||a.x===1},y:{[Us.Backward]:i.y[Us.Backward]||a.y===-1,[Us.Forward]:i.y[Us.Forward]||a.y===1}}},[r,t,n])}function x9e(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 w9e(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 ooe=new Map;function S9e(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 ooe;if(!A||A===ooe||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 _6(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 UU(e,t){return Rw(r=>e?r||(typeof t=="function"?t(e):e):null,[t,e])}function E9e(e,t){return UU(e,t)}function k9e(e){let{callback:t,disabled:r}=e,n=M6(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 IN(e){let{callback:t,disabled:r}=e,n=M6(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 C9e(e){return new _6(vy(e),e)}function soe(e,t,r){t===void 0&&(t=C9e);let[n,i]=(0,nt.useReducer)(s,null),a=k9e({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=IN({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 D9e(e){let t=UU(e);return hoe(e,t)}var loe=[];function O9e(e){let t=(0,nt.useRef)(e),r=Rw(n=>e?n&&n!==loe&&e&&t.current&&e.parentNode===t.current.parentNode?n:I6(e):loe,[e]);return(0,nt.useEffect)(()=>{t.current=e},[e]),r}function M9e(e){let[t,r]=(0,nt.useState)(null),n=(0,nt.useRef)(e),i=(0,nt.useCallback)(a=>{let o=TU(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=TU(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=TU(l);u?.removeEventListener("scroll",i)})}},[i,e]),(0,nt.useMemo)(()=>e.length?t?Array.from(t.values()).reduce((a,o)=>py(a,o),Fp):woe(e):Fp,[e,t])}function uoe(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?my(e,r.current):Fp}function j9e(e){(0,nt.useEffect)(()=>{if(!O6)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 N9e(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 koe(e){return(0,nt.useMemo)(()=>e?i9e(e):null,[e])}var PU=[];function T9e(e,t){t===void 0&&(t=vy);let[r]=e,n=koe(r?nu(r):null),[i,a]=(0,nt.useReducer)(s,PU),o=IN({callback:a});return e.length>0&&i===PU&&a(),bc(()=>{e.length?e.forEach(l=>o?.observe(l)):(o?.disconnect(),a())},[e]),i;function s(){return e.length?e.map(l=>boe(l)?n:new _6(t(l),l)):PU}}function Coe(e){if(!e)return null;if(e.children.length>1)return e;let t=e.children[0];return Iw(t)?t:e}function F9e(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=IN({callback:i}),o=(0,nt.useCallback)(u=>{let c=Coe(u);a?.disconnect(),c&&a?.observe(c),n(c?t(c):null)},[t,a]),[s,l]=j6(o);return(0,nt.useMemo)(()=>({nodeRef:s,rect:r,setRef:l}),[r,s,l])}var _9e=[{sensor:FN,options:{}},{sensor:$0,options:{}}],P9e={current:{}},NN={draggable:{measure:roe},droppable:{measure:roe,strategy:_p.WhileDragging,frequency:$U.Optimized},dragOverlay:{measure:vy}},gy=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}},I9e={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new gy,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:TN},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:NN,measureDroppableContainers:TN,windowRect:null,measuringScheduled:!1},Doe={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:TN,draggableNodes:new Map,over:null,measureDroppableContainers:TN},B6=(0,nt.createContext)(Doe),Ooe=(0,nt.createContext)(I9e);function B9e(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new gy}}}function R9e(e,t){switch(t.type){case ds.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case ds.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 ds.DragEnd:case ds.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case ds.RegisterDroppable:{let{element:r}=t,{id:n}=r,i=new gy(e.droppable.containers);return i.set(n,r),{...e,droppable:{...e.droppable,containers:i}}}case ds.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 gy(e.droppable.containers);return o.set(r,{...a,disabled:i}),{...e,droppable:{...e.droppable,containers:o}}}case ds.UnregisterDroppable:{let{id:r,key:n}=t,i=e.droppable.containers.get(r);if(!i||n!==i.key)return e;let a=new gy(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)(B6),a=N6(n),o=N6(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=Xae(c);if(f){f.focus();break}}})}},[n,t,i,o,a]),null}function Moe(e,t){let{transform:r,...n}=t;return e!=null&&e.length?e.reduce((i,a)=>a({transform:i,...n}),r):r}function q9e(e){return(0,nt.useMemo)(()=>({draggable:{...NN.draggable,...e?.draggable},droppable:{...NN.droppable,...e?.droppable},dragOverlay:{...NN.dragOverlay,...e?.dragOverlay}}),[e?.draggable,e?.droppable,e?.dragOverlay])}function L9e(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=hoe(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=goe(u);d&&d.scrollBy({top:f.y,left:f.x})}},[t,o,s,n,r])}var BN=(0,nt.createContext)({...Fp,scaleX:1,scaleY:1}),B0;(function(e){e[e.Uninitialized=0]="Uninitialized",e[e.Initializing=1]="Initializing",e[e.Initialized=2]="Initialized"})(B0||(B0={}));var Lw=(0,nt.memo)(function(t){var r,n,i,a;let{id:o,accessibility:s,autoScroll:l=!0,children:u,sensors:c=_9e,collisionDetection:f=X5e,measuring:d,modifiers:p,...h}=t,m=(0,nt.useReducer)(R9e,void 0,B9e),[g,A]=m,[b,v]=W5e(),[x,w]=(0,nt.useState)(B0.Uninitialized),S=x===B0.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:P9e,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=dy("DndDescribedBy",o),oe=(0,nt.useMemo)(()=>C.getEnabled(),[C]),te=q9e(d),{droppableRects:Q,measureDroppableContainers:fe,measuringScheduled:Ie}=S9e(oe,{dragging:S,dependencies:[O.x,O.y],config:te.droppable}),Se=x9e(j,k),Oe=(0,nt.useMemo)(()=>T?T6(T):null,[T]),ve=De(),ye=E9e(Se,te.draggable.measure);L9e({activeNode:k?j.get(k):null,config:ve.layoutShiftCompensation,initialRect:ye,measure:te.draggable.measure});let me=soe(Se,te.draggable.measure,ye),ke=soe(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=F9e({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=D9e(J?null:me),ie=koe(U?nu(U):null),re=O9e(S?ae??Se:null),Ee=T9e(re),Ce=Moe(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?py(Oe,O):null,he=M9e(re),ze=uoe(he),Ye=uoe(he,[me]),tt=py(Ce,ze),Ct=R?t9e(R,Ce):null,we=P&&Ct?f({active:P,collisionRect:Ct,droppableRects:Q,droppableContainers:oe,pointerCoordinates:_e}):null,Be=zU(we,"id"),[Le,Ze]=(0,nt.useState)(null),He=J?Ce:py(Ce,Ye),Qe=J5e(He,(a=Le?.rect)!=null?a:null,me),et=(0,nt.useCallback)((at,ht)=>{let{sensor:Yt,options:Wr}=ht;if(q.current==null)return;let en=j.get(q.current);if(!en)return;let tn=at.nativeEvent,ci=new Yt({active:q.current,activeNode:en,event:tn,options:Wr,context:$,onStart(Yi){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,R0.unstable_batchedUpdates)(()=>{Hc?.(Wf),w(B0.Initializing),A({type:ds.DragStart,initialCoordinates:Yi,active:Pa}),b({type:"onDragStart",event:Wf})})},onMove(Yi){A({type:ds.DragMove,coordinates:Yi})},onEnd:is(ds.DragEnd),onCancel:is(ds.DragCancel)});(0,R0.unstable_batchedUpdates)(()=>{I(ci),L(at.nativeEvent)});function is(Yi){return async function(){let{active:Dt,collisions:Hc,over:Wf,scrollAdjustedTranslate:Ha}=$.current,Eu=null;if(Dt&&Ha){let{cancelDrop:Yr}=_.current;Eu={activatorEvent:tn,active:Dt,collisions:Hc,delta:Ha,over:Wf},Yi===ds.DragEnd&&typeof Yr=="function"&&await Promise.resolve(Yr(Eu))&&(Yi=ds.DragCancel)}q.current=null,(0,R0.unstable_batchedUpdates)(()=>{A({type:Yi}),w(B0.Uninitialized),Ze(null),I(null),L(null);let Yr=Yi===ds.DragEnd?"onDragEnd":"onDragCancel";if(Eu){let zl=_.current[Yr];zl?.(Eu),b({type:Yr,event:Eu})}})}}},[j]),Ge=(0,nt.useCallback)((at,ht)=>(Yt,Wr)=>{let en=Yt.nativeEvent,tn=j.get(Wr);if(q.current!==null||!tn||en.dndKit||en.defaultPrevented)return;let ci={active:tn};at(Yt,ht.options,ci)===!0&&(en.dndKit={capturedBy:ht.sensor},q.current=Wr,et(Yt,ht))},[j,et]),G=w9e(c,Ge);j9e(c),bc(()=>{me&&x===B0.Initializing&&w(B0.Initialized)},[me,x]),(0,nt.useEffect)(()=>{let{onDragMove:at}=_.current,{active:ht,activatorEvent:Yt,collisions:Wr,over:en}=$.current;if(!ht||!Yt)return;let tn={active:ht,activatorEvent:Yt,collisions:Wr,delta:{x:tt.x,y:tt.y},over:en};(0,R0.unstable_batchedUpdates)(()=>{at?.(tn),b({type:"onDragMove",event:tn})})},[tt.x,tt.y]),(0,nt.useEffect)(()=>{let{active:at,activatorEvent:ht,collisions:Yt,droppableContainers:Wr,scrollAdjustedTranslate:en}=$.current;if(!at||q.current==null||!ht||!en)return;let{onDragOver:tn}=_.current,ci=Wr.get(Be),is=ci&&ci.rect.current?{id:ci.id,rect:ci.rect.current,data:ci.data,disabled:ci.disabled}:null,Yi={active:at,activatorEvent:ht,collisions:Yt,delta:{x:en.x,y:en.y},over:is};(0,R0.unstable_batchedUpdates)(()=>{Ze(is),tn?.(Yi),b({type:"onDragOver",event:Yi})})},[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]),v9e({...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(doe.Provider,{value:v},nt.default.createElement(B6.Provider,{value:Pe},nt.default.createElement(Ooe.Provider,{value:ue},nt.default.createElement(BN.Provider,{value:Qe},u)),nt.default.createElement($9e,{disabled:s?.restoreFocus===!1})),nt.default.createElement(G5e,{...s,hiddenTextDescribedById:Y}));function De(){let at=z?.autoScrollEnabled===!1,ht=typeof l=="object"?l.enabled===!1:l===!1,Yt=S&&!at&&!ht;return typeof l=="object"?{...l,enabled:Yt}:{enabled:Yt}}}),z9e=(0,nt.createContext)(null),coe="button",U9e="Droppable";function Ws(e){let{id:t,data:r,disabled:n=!1,attributes:i}=e,a=dy(U9e),{activators:o,activatorEvent:s,active:l,activeNodeRect:u,ariaDescribedById:c,draggableNodes:f,over:d}=(0,nt.useContext)(B6),{role:p=coe,roleDescription:h="draggable",tabIndex:m=0}=i??{},g=l?.id===t,A=(0,nt.useContext)(g?BN:z9e),[b,v]=j6(),[x,w]=j6(),S=N9e(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===coe?!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 WU(){return(0,nt.useContext)(Ooe)}var W9e="Droppable",H9e={timeout:25};function Lu(e){let{data:t,disabled:r=!1,id:n,resizeObserverConfig:i}=e,a=dy(W9e),{active:o,dispatch:s,over:l,measureDroppableContainers:u}=(0,nt.useContext)(B6),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}={...H9e,...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=IN({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]=j6(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:ds.RegisterDroppable,element:{id:n,key:a,disabled:r,node:w,rect:d,data:k}}),()=>s({type:ds.UnregisterDroppable,key:a,id:n})),[n]),(0,nt.useEffect)(()=>{r!==c.current.disabled&&(s({type:ds.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 V9e(e){let{animation:t,children:r}=e,[n,i]=(0,nt.useState)(null),[a,o]=(0,nt.useState)(null),s=N6(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 G9e={x:0,y:0,scaleX:1,scaleY:1};function Q9e(e){let{children:t}=e;return nt.default.createElement(B6.Provider,{value:Doe},nt.default.createElement(BN.Provider,{value:G9e},t))}var Y9e={position:"fixed",touchAction:"none"},Z9e=e=>$w(e)?"transform 250ms ease":void 0,X9e=(0,nt.forwardRef)((e,t)=>{let{as:r,activatorEvent:n,adjustScale:i,children:a,className:o,rect:s,style:l,transform:u,transition:c=Z9e}=e;if(!s)return null;let f=i?u:{...u,scaleX:1,scaleY:1},d={...Y9e,width:s.width,height:s.height,top:s.top,left:s.left,transform:qu.Transform.toString(f),transformOrigin:i&&n?Q5e(n,s):void 0,transition:typeof c=="function"?c(n):c,...l};return nt.default.createElement(r,{className:o,style:d,ref:t},a)}),K9e=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)}},J9e=e=>{let{transform:{initial:t,final:r}}=e;return[{transform:qu.Transform.toString(t)},{transform:qu.Transform.toString(r)}]},HU={duration:250,easing:"ease",keyframes:J9e,sideEffects:K9e({styles:{active:{opacity:"0"}}})};function e8e(e){let{config:t,draggableNodes:r,droppableContainers:n,measuringConfiguration:i}=e;return M6((a,o)=>{if(t===null)return;let s=r.get(a);if(!s)return;let l=s.node.current;if(!l)return;let u=Coe(o);if(!u)return;let{transform:c}=nu(o).getComputedStyle(o),f=Aoe(c);if(!f)return;let d=typeof t=="function"?t:t8e(t);return Soe(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 t8e(e){let{duration:t,easing:r,sideEffects:n,keyframes:i}={...HU,...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 foe=0;function r8e(e){return(0,nt.useMemo)(()=>{if(e!=null)return foe++,foe},[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}=WU(),S=(0,nt.useContext)(BN),k=r8e(f?.id),j=Moe(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=UU(d),C=e8e({config:n,draggableNodes:h,droppableContainers:m,measuringConfiguration:b}),N=O?g.setRef:void 0;return nt.default.createElement(Q9e,null,nt.default.createElement(V9e,{animation:C},f&&k?nt.default.createElement(X9e,{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 Hs(e,t,r){let n=e.slice();return n.splice(r<0?n.length+r:r,0,n.splice(t,1)[0]),n}function n8e(e,t){return e.reduce((r,n,i)=>{let a=t.get(n);return a&&(r[i]=a),r},Array(e.length))}function RN(e){return e!==null&&e>=0}function i8e(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=Hs(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 joe="Sortable",Noe=To.default.createContext({activeIndex:-1,containerId:joe,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:R6,disabled:{draggable:!1,droppable:!1}});function VU(e){let{children:t,id:r,items:n,strategy:i=R6,disabled:a=!1}=e,{active:o,dragOverlay:s,droppableRects:l,over:u,measureDroppableContainers:c}=WU(),f=dy(joe,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=!i8e(p,A.current),v=g!==-1&&m===-1||b,x=a8e(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:n8e(p,l),strategy:i}),[m,f,x.draggable,x.droppable,v,p,g,l,d,i]);return To.default.createElement(Noe.Provider,{value:w},t)}var o8e=e=>{let{id:t,items:r,activeIndex:n,overIndex:i}=e;return Hs(r,n,i).indexOf(t)},GU=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},s8e={duration:200,easing:"ease"},Toe="transform",l8e=qu.Transition.toString({property:Toe,duration:0,easing:"linear"}),u8e={roleDescription:"sortable"};function c8e(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=vy(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 Foe(e){let{animateLayoutChanges:t=GU,attributes:r,disabled:n,data:i,getNewIndex:a=o8e,id:o,strategy:s,resizeObserverConfig:l,transition:u=s8e}=e,{items:c,containerId:f,activeIndex:d,disabled:p,disableTransforms:h,sortedRects:m,overIndex:g,useDragOverlay:A,strategy:b}=(0,To.useContext)(Noe),v=f8e(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}=Lu({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}=Ws({id:o,data:w,attributes:{...u8e,...r},disabled:v.draggable}),oe=Qae(C,z),te=Boolean(N),Q=te&&!h&&RN(d)&&RN(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=RN(d)&&RN(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=c8e({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 l8e;if(!(fe&&!$w(D)||!u)&&(te||$))return qu.Transition.toString({...u,property:Toe})}}function f8e(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 $N(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 d8e=[$n.Down,$n.Right,$n.Up,$n.Left],qN=(e,t)=>{let{context:{active:r,collisionRect:n,droppableRects:i,droppableContainers:a,over:o,scrollableAncestors:s}}=t;if(d8e.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=I6(h).some((S,k)=>s[k]!==S),A=_oe(f,d),b=p8e(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:my(x,v)}}}};function _oe(e,t){return!$N(e)||!$N(t)?!1:e.data.current.sortable.containerId===t.data.current.sortable.containerId}function p8e(e,t){return!$N(e)||!$N(t)||!_oe(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=ir(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}},zN=async(e,t,r,n)=>{let i=await e.readTable(t.path,r);i&&await n(i,t)},qA=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 Poe=(e,t,r,n,i)=>({...e,rows:e.rows.map(a=>a[t]==r?{...a,[n]:yi(tr(a[n]).filter(o=>o!=i))}:a)}),m8e=(e,t,r,n,i)=>({...e,rows:e.rows.map(a=>a[t]==r?{...a,[n]:i}:a)});var h8e=(e,t,r)=>({...e,rows:r?Dx(e.rows,r,t):[...e.rows,...t]}),A8e=(e,t,r)=>({...e,rows:e.rows.map((n,i)=>i==r?t:n)}),Ioe=async(e,t,r,n,i,a,o)=>{zN(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:Hs(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})},UN=async(e,t,r,n,i,a,o)=>{e.contextForSpace(t.path).then(s=>{let u=(a??m8e)(s,mt,r,n,i);return o&&(u=fL(u,[r],o)),e.superstate.settings.enhancedLogs&&console.log("Saving Context Change: Update Context Value"),wc(e,t,u).then(c=>u)})};var g8e=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]:$i(o,i[o],r.find(s=>s.name==o).type)}:a,{}):{}},Boe=(e,t)=>t=="$space"?lre:t=="$context"?sd.rows:e.contextsIndex.get(t)?.contextTable?.cols??[],QU=async(e,t,r)=>{let n=async a=>{let o=a.rows.some(l=>l[mt]===t),s=await g8e(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=>qA(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)},WN=async(e,t,r,n,i)=>zN(e,t,r,async(a,o)=>{let s=A8e(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}),Roe=async(e,t,r,n,i)=>{let a=o=>({...o,rows:o.rows.map(s=>s[mt]==t?{...s,[r]:n}:s)});return qA(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})},$oe=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=>qA(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)},qoe=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=>qA(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)},Loe=async(e,t,r,n,i)=>zN(e,r,n,async(a,o)=>{let s=h8e(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}),zoe=async(e,t,r,n)=>zN(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 Uoe=async(e,t,r,n)=>{let i=n.map(a=>qA(e,a,async(o,s)=>{let l=cL(o.cols),u={...o,rows:o.rows.map(c=>dre(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)},Woe=async(e,t,r)=>{let n=r.map(i=>qA(e,i,async(a,o)=>{let s=cL(a.cols),l={...a,rows:a.rows.map(u=>fre(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)},Hoe=async(e,t,r,n)=>{let i=n.map(a=>qA(e,a,async(o,s)=>{let l=pre(o,t,r);return xc.default.isEqual(o,l)||await wc(e,s,l),l}));return Promise.all(i)},Voe=async(e,t,r)=>{let n=r.map(i=>qA(e,i,async(a,o)=>{let s=mre(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)},Goe=async(e,t,r,n)=>qA(e,n,async(i,a)=>{let o=fL(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 iT=["Matrix","Array"],aT=["number","BigNumber","Fraction"];function Joe(e,t){function r(n){if(n){var i=Ww(e,Bt);Koe(n,"matrix",iT),Koe(n,"number",aT),YU(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=iT,r.NUMBER_OPTIONS=aT,Object.keys(yy).forEach(n=>{Object.defineProperty(r,n,{get:()=>e[n],enumerable:!0,configurable:!0})}),r}function v8e(e,t){return e.indexOf(t)!==-1}function Koe(e,t,r){e[t]!==void 0&&!v8e(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(yy)};Fn(it,yy,{MATRIX_OPTIONS:iT,NUMBER_OPTIONS:aT});var LH={};fM(LH,{createAbs:()=>oF,createAccessorNode:()=>i4,createAcos:()=>p_,createAcosh:()=>m_,createAcot:()=>h_,createAcoth:()=>A_,createAcsc:()=>g_,createAcsch:()=>v_,createAdd:()=>Q_,createAddScalar:()=>lF,createAnd:()=>wS,createAndTransform:()=>wB,createApply:()=>Y0,createApplyTransform:()=>rB,createArg:()=>_F,createArrayNode:()=>o4,createAsec:()=>y_,createAsech:()=>b_,createAsin:()=>x_,createAsinh:()=>w_,createAssignmentNode:()=>c4,createAtan:()=>S_,createAtan2:()=>E_,createAtanh:()=>k_,createAtomicMass:()=>_I,createAvogadro:()=>PI,createBellNumbers:()=>DP,createBigNumberClass:()=>kT,createBignumber:()=>ZT,createBin:()=>A3,createBitAnd:()=>sS,createBitAndTransform:()=>EB,createBitNot:()=>TF,createBitOr:()=>lS,createBitOrTransform:()=>kB,createBitXor:()=>FF,createBlockNode:()=>d4,createBohrMagneton:()=>mI,createBohrRadius:()=>bI,createBoltzmann:()=>II,createBoolean:()=>YT,createCatalan:()=>OP,createCbrt:()=>cF,createCeil:()=>fF,createChain:()=>X4,createChainClass:()=>Y4,createClassicalElectronRadius:()=>xI,createClone:()=>TT,createColumn:()=>fS,createColumnTransform:()=>nB,createCombinations:()=>mP,createCombinationsWithRep:()=>hP,createCompare:()=>$3,createCompareNatural:()=>q3,createCompareText:()=>L3,createCompile:()=>B4,createComplex:()=>XT,createComplexClass:()=>CT,createComposition:()=>MP,createConcat:()=>cS,createConcatTransform:()=>mB,createConditionalNode:()=>m4,createConductanceQuantum:()=>hI,createConj:()=>PF,createConstantNode:()=>v4,createCorr:()=>pP,createCos:()=>C_,createCosh:()=>D_,createCot:()=>O_,createCoth:()=>M_,createCoulomb:()=>dI,createCount:()=>qF,createCreateUnit:()=>d_,createCross:()=>LF,createCsc:()=>j_,createCsch:()=>N_,createCtranspose:()=>o3,createCube:()=>dF,createCumSum:()=>DS,createCumSumTransform:()=>yB,createDeepEqual:()=>J3,createDenseMatrixClass:()=>NT,createDerivative:()=>IP,createDet:()=>K4,createDeuteronMass:()=>DI,createDiag:()=>zF,createDiff:()=>dS,createDiffTransform:()=>hB,createDistance:()=>lP,createDivide:()=>sP,createDivideScalar:()=>S3,createDot:()=>X_,createDotDivide:()=>j3,createDotMultiply:()=>jF,createDotPow:()=>M3,createE:()=>YP,createEfimovFactor:()=>FI,createEigs:()=>tP,createElectricConstant:()=>cI,createElectronMass:()=>wI,createElementaryCharge:()=>pI,createEqual:()=>U3,createEqualScalar:()=>HT,createEqualText:()=>W3,createErf:()=>f3,createEvaluate:()=>R4,createExp:()=>pF,createExpm:()=>rP,createExpm1:()=>mF,createFactorial:()=>vP,createFalse:()=>UP,createFaraday:()=>BI,createFermiCoupling:()=>SI,createFft:()=>l3,createFibonacciHeapClass:()=>o_,createFilter:()=>UF,createFilterTransform:()=>iB,createFineStructure:()=>EI,createFirstRadiation:()=>RI,createFix:()=>hF,createFlatten:()=>WF,createFloor:()=>nS,createForEach:()=>HF,createForEachTransform:()=>aB,createFormat:()=>h3,createFraction:()=>KT,createFractionClass:()=>DT,createFreqz:()=>$P,createFunctionAssignmentNode:()=>b4,createFunctionNode:()=>P4,createGamma:()=>AP,createGasConstant:()=>qI,createGcd:()=>AF,createGetMatrixDataType:()=>VF,createGravitationConstant:()=>oI,createGravity:()=>YI,createHartreeEnergy:()=>kI,createHasNumericValue:()=>$T,createHelp:()=>Z4,createHelpClass:()=>Q4,createHex:()=>v3,createHypot:()=>Y_,createI:()=>nI,createIdentity:()=>GF,createIfft:()=>u3,createIm:()=>IF,createImmutableDenseMatrixClass:()=>i_,createIndex:()=>J_,createIndexClass:()=>a_,createIndexNode:()=>w4,createIndexTransform:()=>oB,createInfinity:()=>HP,createIntersect:()=>uP,createInv:()=>J4,createInverseConductanceQuantum:()=>AI,createInvmod:()=>OF,createIsInteger:()=>PT,createIsNaN:()=>zT,createIsNegative:()=>BT,createIsNumeric:()=>RT,createIsPositive:()=>qT,createIsPrime:()=>x3,createIsZero:()=>LT,createKldivergence:()=>yP,createKlitzing:()=>yI,createKron:()=>QF,createLN10:()=>KP,createLN2:()=>XP,createLOG10E:()=>eI,createLOG2E:()=>JP,createLarger:()=>Z3,createLargerEq:()=>K3,createLcm:()=>gF,createLeafCount:()=>jP,createLeftShift:()=>P3,createLgamma:()=>gP,createLog:()=>C3,createLog10:()=>vF,createLog1p:()=>D3,createLog2:()=>yF,createLoschmidt:()=>$I,createLsolve:()=>N3,createLsolveAll:()=>F3,createLup:()=>L4,createLusolve:()=>V4,createLyap:()=>oP,createMad:()=>dP,createMagneticConstant:()=>uI,createMagneticFluxQuantum:()=>gI,createMap:()=>YF,createMapTransform:()=>sB,createMatrix:()=>JT,createMatrixClass:()=>MT,createMatrixFromColumns:()=>rF,createMatrixFromFunction:()=>eF,createMatrixFromRows:()=>tF,createMax:()=>SS,createMaxTransform:()=>lB,createMean:()=>OS,createMeanTransform:()=>uB,createMedian:()=>fP,createMin:()=>ES,createMinTransform:()=>cB,createMod:()=>iS,createMode:()=>p3,createMolarMass:()=>GI,createMolarMassC12:()=>QI,createMolarPlanckConstant:()=>LI,createMolarVolume:()=>zI,createMultinomial:()=>bP,createMultiply:()=>xF,createMultiplyScalar:()=>bF,createNaN:()=>VP,createNeutronMass:()=>OI,createNode:()=>t4,createNorm:()=>Z_,createNot:()=>RF,createNthRoot:()=>wF,createNthRoots:()=>O3,createNuclearMagneton:()=>vI,createNull:()=>WP,createNumber:()=>GT,createNumeric:()=>w3,createObjectNode:()=>E4,createOct:()=>g3,createOnes:()=>ZF,createOperatorNode:()=>C4,createOr:()=>uS,createOrTransform:()=>SB,createParenthesisNode:()=>O4,createParse:()=>I4,createParser:()=>q4,createParserClass:()=>$4,createPartitionSelect:()=>r_,createPermutations:()=>xP,createPhi:()=>ZP,createPi:()=>GP,createPickRandom:()=>SP,createPinv:()=>eP,createPlanckCharge:()=>JI,createPlanckConstant:()=>sI,createPlanckLength:()=>ZI,createPlanckMass:()=>XI,createPlanckTemperature:()=>eB,createPlanckTime:()=>KI,createPolynomialRoot:()=>G4,createPow:()=>E3,createPrint:()=>vS,createPrintTransform:()=>xB,createProd:()=>m3,createProtonMass:()=>CI,createQr:()=>z4,createQuantileSeq:()=>jS,createQuantileSeqTransform:()=>vB,createQuantumOfCirculation:()=>MI,createRandom:()=>EP,createRandomInt:()=>kP,createRange:()=>mS,createRangeClass:()=>OT,createRangeNode:()=>j4,createRangeTransform:()=>fB,createRationalize:()=>BP,createRe:()=>BF,createReducedPlanckConstant:()=>lI,createRelationalNode:()=>T4,createReplacer:()=>LP,createReshape:()=>JF,createResize:()=>e3,createResolve:()=>_P,createResultSet:()=>gT,createReviver:()=>qP,createRightArithShift:()=>I3,createRightLogShift:()=>B3,createRotate:()=>t3,createRotationMatrix:()=>r3,createRound:()=>k3,createRow:()=>hS,createRowTransform:()=>dB,createRydberg:()=>jI,createSQRT1_2:()=>tI,createSQRT2:()=>rI,createSackurTetrode:()=>UI,createSchur:()=>aP,createSec:()=>T_,createSech:()=>F_,createSecondRadiation:()=>WI,createSetCartesian:()=>R_,createSetDifference:()=>$_,createSetDistinct:()=>q_,createSetIntersect:()=>L_,createSetIsSubset:()=>z_,createSetMultiplicity:()=>U_,createSetPowerset:()=>W_,createSetSize:()=>H_,createSetSymDifference:()=>V_,createSetUnion:()=>G_,createSign:()=>SF,createSimplify:()=>NP,createSimplifyConstant:()=>TP,createSimplifyCore:()=>FP,createSin:()=>__,createSinh:()=>P_,createSize:()=>n3,createSlu:()=>H4,createSmaller:()=>V3,createSmallerEq:()=>Q3,createSolveODE:()=>c3,createSort:()=>n_,createSpaClass:()=>s_,createSparse:()=>f_,createSparseMatrixClass:()=>VT,createSpeedOfLight:()=>aI,createSplitUnit:()=>nF,createSqrt:()=>EF,createSqrtm:()=>nP,createSquare:()=>kF,createSqueeze:()=>i3,createStd:()=>NS,createStdTransform:()=>AB,createStefanBoltzmann:()=>HI,createStirlingS2:()=>CP,createString:()=>QT,createSubset:()=>AS,createSubsetTransform:()=>pB,createSubtract:()=>CF,createSubtractScalar:()=>uF,createSum:()=>CS,createSumTransform:()=>gB,createSylvester:()=>iP,createSymbolNode:()=>F4,createSymbolicEqual:()=>PP,createTan:()=>I_,createTanh:()=>B_,createTau:()=>QP,createThomsonCrossSection:()=>NI,createTo:()=>b3,createTrace:()=>K_,createTranspose:()=>a3,createTrue:()=>zP,createTypeOf:()=>UT,createTyped:()=>AT,createUnaryMinus:()=>iF,createUnaryPlus:()=>aF,createUnequal:()=>t_,createUnitClass:()=>u_,createUnitFunction:()=>c_,createUppercaseE:()=>bge,createUppercasePi:()=>yge,createUsolve:()=>T3,createUsolveAll:()=>_3,createVacuumImpedance:()=>fI,createVariance:()=>MS,createVarianceTransform:()=>bB,createVersion:()=>iI,createWeakMixingAngle:()=>TI,createWienDisplacement:()=>VI,createXgcd:()=>DF,createXor:()=>$F,createZeros:()=>s3,createZeta:()=>d3,createZpk2tf:()=>RP});var fW=Ae(oT(),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},rse=Math.log2||function(t){return Math.log(t)/Math.LN2},nse=Math.log10||function(t){return Math.log(t)/Math.LN10},sT=Math.log1p||function(e){return Math.log(e+1)},ise=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},ase=Math.expm1||function(t){return t>=2e-4||t<=-2e-4?Math.exp(t)-1:t+t*t/2+t*t*t/6};function XU(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}=KU(t);switch(r){case"fixed":return JU(e,n);case"exponential":return ose(e,n);case"engineering":return g8e(e,n);case"bin":return XU(e,2,i);case"oct":return XU(e,8,i);case"hex":return XU(e,16,i);case"auto":return v8e(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 KU(e){var t="auto",r,n;if(e!==void 0)if(Gt(e))r=e;else if(It(e))r=e.toNumber();else if(Hm(e))e.precision!==void 0&&(r=ese(e.precision,()=>{throw new Error('Option "precision" must be a number or BigNumber')})),e.wordSize!==void 0&&(n=ese(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 g8e(e,t){if(isNaN(e)||!isFinite(e))return String(e);var r=Gw(e),n=lT(r,t),i=n.exponent,a=n.coefficients,o=i%3===0?i:i<0?i-3-i%3:i-i%3;if(Gt(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=Gt(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 JU(e,t){if(isNaN(e)||!isFinite(e))return String(e);var r=Gw(e),n=typeof t=="number"?lT(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 v8e(e,t,r){if(isNaN(e)||!isFinite(e))return String(e);var n=tse(r?.lowerExp,-3),i=tse(r?.upperExp,5),a=Gw(e),o=t?lT(a,t):a;if(o.exponent=i)return ose(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 ese(e,t){if(Gt(e))return e;if(It(e))return e.toNumber();t()}function tse(e,t){return Gt(e)?e:It(e)?e.toNumber():t}function eW(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 hse(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}=KU(t);switch(r){case"fixed":return x8e(e,n);case"exponential":return pse(e,n);case"engineering":return b8e(e,n);case"bin":return eW(e,2,i);case"oct":return eW(e,8,i);case"hex":return eW(e,16,i);case"auto":{var a=mse(t?.lowerExp,-3),o=mse(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 pse(e,t){return t!==void 0?e.toExponential(t-1):e.toExponential()}function x8e(e,t){return e.toFixed(t)}function mse(e,t){return Gt(e)?e:It(e)?e.toNumber():t}function gse(e,t){var r=e.length-t.length,n=e.length;return e.substring(r,n)===t}function rr(e,t){var r=w8e(e,t);return t&&typeof t=="object"&&"truncate"in t&&r.length>t.truncate?r.substring(0,t.truncate-3)+"...":r}function w8e(e,t){if(typeof e=="number")return Bp(e,t);if(It(e))return hse(e,t);if(S8e(e))return!t||t.fraction!=="decimal"?e.s*e.n+"/"+e.d:e.toString();if(Array.isArray(e))return vse(e,t);if(ma(e))return by(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=>by(n)+": "+rr(e[n],t));return"{"+r.join(", ")+"}"}return String(e)}function by(e){for(var t=String(e),r="",n=0;n/g,">"),t}function vse(e,t){if(Array.isArray(e)){for(var r="[",n=e.length,i=0;it?1:-1}function ar(e,t,r){if(!(this instanceof ar))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}ar.prototype=new RangeError;ar.prototype.constructor=RangeError;ar.prototype.name="DimensionError";ar.prototype.isDimensionError=!0;function gs(e,t,r){if(!(this instanceof gs))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}gs.prototype=new RangeError;gs.prototype.constructor=RangeError;gs.prototype.name="IndexError";gs.prototype.isIndexError=!0;function Qt(e){for(var t=[];Array.isArray(e);)t.push(e.length),e=e[0];return t}function yse(e,t,r){var n,i=e.length;if(i!==t[r])throw new ar(i,t[r]);if(r")}function rW(e,t){var r=t.length===0;if(r){if(Array.isArray(e))throw new ar(e.length,0)}else yse(e,t,0)}function q6(e,t){var r=e.isMatrix?e._size:Qt(e),n=t._sourceSize;n.forEach((i,a)=>{if(i!==null&&i!==r[a])throw new ar(i,r[a])})}function Gn(e,t){if(e!==void 0){if(!Gt(e)||!wt(e))throw new TypeError("Index must be an integer (value: "+e+")");if(e<0||typeof t=="number"&&e>=t)throw new gs(e,t)}}function xy(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 bse(e){return e.reduce((t,r)=>t*r,1)}function E8e(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 nW(e,t){return Array.prototype.join.call(e,t)}function zA(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 Sse(r,n,t,0)},e[0]);throw new Error("Wrong number of arguments in function concat")}function k8e(){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 oW(e,t){var r=Qt(e);if(Ip(r,t))return e;U6(r,t);var n=k8e(r,t),i=n.length,a=[...Array(i-r.length).fill(1),...r],o=D8e(e);r.length!M8e(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 M8e(e){return e&&e[0]==="?"}function sW(e){return e&&e[0]==="?"?e.slice(1):e}function Xi(e,t){if(Dse(e)&&kse(e,t))return e[t];throw typeof e[t]=="function"&&mT(e,t)?new Error('Cannot access method "'+t+'" as a property'):new Error('No access to property "'+t+'"')}function Gm(e,t,r){if(Dse(e)&&kse(e,t))return e[t]=r,r;throw new Error('No access to property "'+t+'"')}function Ese(e,t){return t in e}function kse(e,t){return!e||typeof e!="object"?!1:Et(j8e,t)?!0:!(t in Object.prototype||t in Function.prototype)}function Cse(e,t){if(!mT(e,t))throw new Error('No access to method "'+t+'"');return e[t]}function mT(e,t){return e==null||typeof e[t]!="function"||Et(e,t)&&Object.getPrototypeOf&&t in Object.getPrototypeOf(e)?!1:Et(N8e,t)?!0:!(t in Object.prototype||t in Function.prototype)}function Dse(e){return typeof e=="object"&&e&&e.constructor===Object}var j8e={length:!0,name:!0},N8e={toString:!0,valueOf:!0,toLocaleString:!0};var Sy=class{constructor(t){this.wrappedObject=t,this[Symbol.iterator]=this.entries}keys(){return Object.keys(this.wrappedObject).values()}get(t){return Xi(this.wrappedObject,t)}set(t,r){return Gm(this.wrappedObject,t,r),this}has(t){return Ese(this.wrappedObject,t)}entries(){return Ose(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 Ose(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 Ose(e,t){return{next:()=>{var r=e.next();return r.done?r:{value:t(r.value),done:!1}}}}function U0(){return new Map}function UA(e){if(!e)return U0();if(lW(e))return e;if(Hm(e))return new Sy(e);throw new Error("createMap can create maps from objects or Maps")}function Mse(e){if(e instanceof Sy)return e.wrappedObject;var t={};for(var r of e.keys()){var n=e.get(r);Gm(t,r,n)}return t}function lW(e){return e?e instanceof Map||e instanceof Sy||typeof e.set=="function"&&typeof e.get=="function"&&typeof e.keys=="function"&&typeof e.has=="function":!1}var jse=function(){return jse=fW.default.create,fW.default},T8e=["?BigNumber","?Complex","?DenseMatrix","?Fraction"],AT=V("typed",T8e,function(t){var{BigNumber:r,Complex:n,DenseMatrix:i,Fraction:a}=t,o=jse();return o.clear(),o.addTypes([{name:"number",test:Gt},{name:"Complex",test:ps},{name:"BigNumber",test:It},{name:"Fraction",test:gf},{name:"Unit",test:Fo},{name:"identifier",test:s=>ma&&/^(?:[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:ma},{name:"Chain",test:Uw},{name:"Array",test:Ir},{name:"Matrix",test:St},{name:"DenseMatrix",test:LA},{name:"SparseMatrix",test:vf},{name:"Range",test:q0},{name:"Index",test:Wm},{name:"boolean",test:HN},{name:"ResultSet",test:VN},{name:"Help",test:zw},{name:"function",test:GN},{name:"Date",test:QN},{name:"RegExp",test:YN},{name:"null",test:ZN},{name:"undefined",test:XN},{name:"AccessorNode",test:zu},{name:"ArrayNode",test:ms},{name:"AssignmentNode",test:KN},{name:"BlockNode",test:JN},{name:"ConditionalNode",test:eT},{name:"ConstantNode",test:vr},{name:"FunctionNode",test:xl},{name:"FunctionAssignmentNode",test:Ed},{name:"IndexNode",test:Sc},{name:"Node",test:Nr},{name:"ObjectNode",test:Vm},{name:"OperatorNode",test:xi},{name:"ParenthesisNode",test:hs},{name:"RangeNode",test:tT},{name:"RelationalNode",test:rT},{name:"SymbolNode",test:ri},{name:"Map",test:lW},{name:"Object",test:Hm}]),o.addConversions([{from:"number",to:"BigNumber",convert:function(l){if(r||uW(l),sse(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||hT(l),new n(l,0)}},{from:"BigNumber",to:"Complex",convert:function(l){return n||hT(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||hT(l),new n(l.valueOf(),0)}},{from:"number",to:"Fraction",convert:function(l){a||cW(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||uW(l);try{return new r(l)}catch{throw new Error('Cannot convert "'+l+'" to BigNumber')}}},{from:"string",to:"Fraction",convert:function(l){a||cW(l);try{return new a(l)}catch{throw new Error('Cannot convert "'+l+'" to Fraction')}}},{from:"string",to:"Complex",convert:function(l){n||hT(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||uW(l),new r(+l)}},{from:"boolean",to:"Fraction",convert:function(l){return a||cW(l),new a(+l)}},{from:"boolean",to:"string",convert:function(l){return String(l)}},{from:"Array",to:"Matrix",convert:function(l){return i||F8e(),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&&Oa(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&&Oa(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 uW(e){throw new Error("Cannot convert value ".concat(e," into a BigNumber: no class 'BigNumber' provided"))}function hT(e){throw new Error("Cannot convert value ".concat(e," into a Complex number: no class 'Complex' provided"))}function F8e(){throw new Error("Cannot convert array into a Matrix: no class 'DenseMatrix' provided")}function cW(e){throw new Error("Cannot convert value ".concat(e," into a Fraction, no class 'Fraction' provided."))}var _8e="ResultSet",P8e=[],gT=V(_8e,P8e,()=>{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,G0=1e9,dW="0123456789abcdef",yT="2.3025850929940456840179914546843642076011014886287729760333279009675726096773524802359972050895982983419677840422862486334095254650828067566662873690987816894829072083255546808437998948262331985283935053089653777326288461633662222876982198867465436674744042432743651550489343149393914796194044002221051017141748003688084012647080685567743216228355220114804663715659121373450747856947683463616792101806445070648000277502684916746550586856935673420670581136429224554405758925724208241314695689016758940256776311356919292033376587141660230105703089634572075440370847469940168269282808481184289314848524948644871927809676271275775397027668605952496716674183485704422507197965004714951050492214776567636938662976979522110718264549734772662425709429322582798502585509785265383207606726317164309505995087807523710333101197857547331541421808427543863591778117054309827482385045648019095610299291824318237525357709750539565187697510374970888692180205189339507238539205144634197265287286965110862571492198849978748873771345686209167058",bT="3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679821480865132823066470938446095505822317253594081284811174502841027019385211055596446229489549303819644288109756659334461284756482337867831652712019091456485669234603486104543266482133936072602491412737245870066063155881748815209209628292540917153643678925903600113305305488204665213841469519415116094330572703657595919530921861173819326117931051185480744623799627495673518857527248912279381830119491298336733624406566430860213949463952247371907021798609437027705392171762931767523846748184676694051320005681271452635608277857713427577896091736371787214684409012249534301465495853710507922796892589235420199561121290219608640344181598136297747713099605187072113499999983729780499510597317328160963185950244594553469083026425223082533446850352619311881710100031378387528865875332083814206171776691473035982534904287554687311595628638823537875937519577818577805321712268066130019278766111959092164201989380952572010654858632789",pW={precision:20,rounding:4,modulo:1,toExpNeg:-7,toExpPos:21,minE:-Kw,maxE:Kw,crypto:!1},_se,WA,Br=!0,wT="[DecimalError] ",V0=wT+"Invalid argument: ",Pse=wT+"Precision limit exceeded",Ise=wT+"crypto unavailable",Bse="[object Decimal]",iu=Math.floor,vs=Math.pow,I8e=/^0b([01]+(\.[01]*)?|\.[01]+)(p[+-]?\d+)?$/i,B8e=/^0x([0-9a-f]+(\.[0-9a-f]*)?|\.[0-9a-f]+)(p[+-]?\d+)?$/i,R8e=/^0o([0-7]+(\.[0-7]*)?|\.[0-7]+)(p[+-]?\d+)?$/i,Rse=/^(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,qp=1e7,yr=7,$8e=9007199254740991,q8e=yT.length-1,mW=bT.length-1,pt={toStringTag:Bse};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(V0+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())+yr,n.rounding=1,r=L8e(n,Use(n,r)),n.precision=e,n.rounding=t,cr(WA==2||WA==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*vs(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=vs(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=Ki(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/yr))*yr,e=t[e],e)for(;e%10==0;e/=10)r--;r<0&&(r=0)}return r};pt.dividedBy=pt.div=function(e){return Ki(this,new this.constructor(e))};pt.dividedToIntegerBy=pt.divToInt=function(e){var t=this,r=t.constructor;return cr(Ki(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/ET(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/ET(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,Ki(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=Ki(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<=mW)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<=mW)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/yr+2|0),e=r;e;--e)u=u.div(u.times(u).plus(1).sqrt().plus(1));for(Br=!1,t=Math.ceil(s/yr),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=H0(u,s),n=t?xT(c,s+10):H0(e,s),l=Ki(o,n,s,1),W6(l.d,i=f,d))do if(s+=10,o=H0(u,s),n=t?xT(c,s+10):H0(e,s),l=Ki(o,n,s,1),!a){+wl(l.d).slice(i+1,i+15)+1==1e14&&(l=cr(l,f+1,0));break}while(W6(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/yr),c=iu(p.e/yr),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/yr),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=ST(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(V0+e);return r.d?(t=$se(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())+yr,n.rounding=1,r=U8e(n,Use(n,r)),n.precision=e,n.rounding=t,cr(WA>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(Ki(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=Ki(r,new n(1).minus(r.times(r)).sqrt(),e+10,0),n.precision=e,n.rounding=t,cr(WA==2||WA==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/yr)+iu(e.e/yr),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=ST(a,r),Br?cr(e,f.precision,f.rounding):e};pt.toBinary=function(e,t){return gW(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,G0),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,G0),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,G0),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=$se(h)-p.e-1,o=a%yr,t.d[0]=vs(10,o<0?yr+o:o),e==null)e=a>0?t:u;else{if(s=new m(e),!s.isInt()||s.lt(u))throw Error(V0+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*yr*2;f=Ki(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=Ki(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=Ki(u,n,a,1).minus(p).abs().cmp(Ki(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 gW(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=Ki(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 gW(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(vs(+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/yr),t>=e.d.length-1&&(r=u<0?-u:u)<=$8e)return i=qse(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=hW(e.times(H0(s,n+r)),n),i.d&&(i=cr(i,n+5,1),W6(i.d,n,a)&&(t=n+10,i=cr(hW(e.times(H0(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,G0),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,G0),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(V0+e)}function W6(e,t,r,n){var i,a,o,s;for(a=e[0];a>=10;a/=10)--t;return--t<0?(t+=yr,i=0):(i=Math.ceil((t+1)/yr),t%=yr),a=vs(10,yr-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)==vs(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)==vs(10,t-3)-1,o}function vT(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 L8e(e,t){var r,n,i;if(t.isZero())return t;n=t.d.length,n<32?(r=Math.ceil(n/3),i=(1/ET(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 Ki=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=yr,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+=yr,o=t,c=f[d=0],l=c/vs(10,i-o-1)%10|0;else if(d=Math.ceil((a+1)/yr),s=f.length,d>=s)if(n){for(;s++<=d;)f.push(0);c=l=0,i=1,a%=yr,o=a-yr+1}else break e;else{for(c=s=f[d],i=1;s>=10;s/=10)i++;a%=yr,o=a-yr+i,l=o<0?0:c/vs(10,i-o-1)%10|0}if(n=n||t<0||f[d+1]!==void 0||(o<0?c:c%vs(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/vs(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]=vs(10,(yr-t%yr)%yr),e.e=-t||0):f[0]=e.e=0,e;if(a==0?(f.length=d,s=1,d--):(f.length=d+1,s=vs(10,yr-a),f[d]=o>0?(c/vs(10,i-o)%vs(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)+W0(n):o>1&&(a=a.charAt(0)+"."+a.slice(1)),a=a+(e.e<0?"e":"e+")+e.e):i<0?(a="0."+W0(-i-1)+a,r&&(n=r-o)>0&&(a+=W0(n))):i>=o?(a+=W0(i+1-o),r&&(n=r-i-1)>0&&(a=a+"."+W0(n))):((n=i+1)0&&(i+1===o&&(a+="."),a+=W0(n))),a}function ST(e,t){var r=e[0];for(t*=yr;r>=10;r/=10)t++;return t}function xT(e,t,r){if(t>q8e)throw Br=!0,r&&(e.precision=r),Error(Pse);return cr(new e(yT),t,1,!0)}function $p(e,t,r){if(t>mW)throw Error(Pse);return cr(new e(bT),t,r,!0)}function $se(e){var t=e.length-1,r=t*yr+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 W0(e){for(var t="";e--;)t+="0";return t}function qse(e,t,r,n){var i,a=new e(1),o=Math.ceil(n/yr+4);for(Br=!1;;){if(r%2&&(a=a.times(t),Tse(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),Tse(t.d,o)}return Br=!0,a}function Nse(e){return e.d[e.d.length-1]&1}function Lse(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(vs(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(Ki(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&&W6(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 H0(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=xT(A,c+2,v).times(a+""),m=H0(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=Ki(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(Ki(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(xT(A,c+2,v).times(a+""))),l=Ki(l,new A(p),c,1),t==null)if(W6(l.d,c-h,b,s))A.precision=c+=h,u=o=m=Ki(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 zse(e){return String(e.s*e.s/0)}function AW(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)%yr,r<0&&(n+=yr),ne.constructor.maxE?(e.d=null,e.e=NaN):e.e-1){if(t=t.replace(/(\d)_(?=\d)/g,"$1"),Rse.test(t))return AW(e,t)}else if(t==="Infinity"||t==="NaN")return+t||(e.s=NaN),e.e=NaN,e.d=null,e;if(B8e.test(t))r=16,t=t.toLowerCase();else if(I8e.test(t))r=2;else if(R8e.test(t))r=8;else throw Error(V0+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=qse(n,new n(r),a,a*2)),u=vT(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=ST(u,c),e.d=u,Br=!1,o&&(e=Ki(e,i,s*4)),l&&(e=e.times(Math.abs(l)<54?vs(2,l):H6.pow(2,l))),Br=!0,e)}function U8e(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/ET(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/yr);for(Br=!1,l=r.times(r),s=new e(n);;){if(o=Ki(s.times(l),new e(t++*t++),c,1),s=i?n.plus(o):n.minus(o),n=Ki(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 ET(e,t){for(var r=e;--t;)r*=e;return r}function Use(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 WA=n?4:1,t;if(r=t.divToInt(i),r.isZero())WA=n?3:2;else{if(t=t.minus(r.times(i)),t.lte(a))return WA=Nse(r)?n?2:3:n?4:1,t;WA=Nse(r)?n?1:4:n?3:2}return t.minus(i).abs()}function gW(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,G0),n===void 0?n=p.rounding:kc(n,0,8)):(r=p.precision,n=p.rounding),!e.isFinite())c=zse(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=vT(Qm(d),10,i),d.e=d.d.length),f=vT(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=Ki(e,d,r,n,0,i),f=e.d,a=e.e,u=_se),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=vT(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 W8e(e){return new this(e).abs()}function H8e(e){return new this(e).acos()}function V8e(e){return new this(e).acosh()}function G8e(e,t){return new this(e).plus(t)}function Q8e(e){return new this(e).asin()}function Y8e(e){return new this(e).asinh()}function Z8e(e){return new this(e).atan()}function X8e(e){return new this(e).atanh()}function K8e(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(Ki(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(Ki(e,t,a,1)),r}function J8e(e){return new this(e).cbrt()}function e7e(e){return cr(e=new this(e),e.e+1,2)}function t7e(e,t,r){return new this(e).clamp(t,r)}function r7e(e){if(!e||typeof e!="object")throw Error(wT+"Object expected");var t,r,n,i=e.defaults===!0,a=["precision",1,G0,"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(V0+r+": "+n);if(r="crypto",i&&(this[r]=pW[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(Ise);else this[r]=!1;else throw Error(V0+r+": "+n);return this}function n7e(e){return new this(e).cos()}function i7e(e){return new this(e).cosh()}function Wse(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,Fse(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(Ise);else for(;a=10;i/=10)n++;n{var{on:t,config:r}=e,n=Ey.clone({precision:r.precision,modulo:Ey.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 Vs=Ae(Vse(),1);var N7e="Complex",T7e=[],CT=V(N7e,T7e,()=>(Object.defineProperty(Vs.default,"name",{value:"Complex"}),Vs.default.prototype.constructor=Vs.default,Vs.default.prototype.type="Complex",Vs.default.prototype.isComplex=!0,Vs.default.prototype.toJSON=function(){return{mathjs:"Complex",re:this.re,im:this.im}},Vs.default.prototype.toPolar=function(){return{r:this.abs(),phi:this.arg()}},Vs.default.prototype.format=function(e){var t="",r=this.im,n=this.re,i=Bp(this.re,e),a=Bp(this.im,e),o=Gt(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 P7e="Range",I7e=[],OT=V(P7e,I7e,()=>{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 B7e="Matrix",R7e=[],MT=V(B7e,R7e,()=>{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 Yse(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 ky(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:Yse(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&&!ma(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,rW(this._data,this._size),this._datatype=f||c.datatype;else if(Ir(c))this._data=u(c),this._size=Qt(this._data),rW(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 z0(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 ar(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){Gn(A),c[A]=d[b[0]]}):g.forEach(function(A,b){Gn(A),o(c[A],f,d[b[0]],p,h+1)})}r.prototype.resize=function(c,f,d){if(!Oa(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=L6(d._data,c);var p=d._size.reduce((h,m)=>h*m);return d._size=z6(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=jT(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?z0(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(Zse,{any:Bt})});function FT(e){var t=e.length,r=e[0].length,n,i,a=[];for(i=0;i=n.length)throw new gs(t,n.length);return St(e)?e.create(_T(e.valueOf(),t,r)):_T(e,t,r)}function _T(e,t,r){var n,i,a,o;if(t<=0)if(Array.isArray(e[0])){for(o=FT(e),i=[],n=0;n{var{typed:t}=e;return t(Xse,{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",HA="number, number";function xW(e){return Math.abs(e)}xW.signature=Cc;function wW(e,t){return e+t}wW.signature=HA;function SW(e,t){return e-t}SW.signature=HA;function EW(e,t){return e*t}EW.signature=HA;function U7e(e,t){return e/t}U7e.signature=HA;function kW(e){return-e}kW.signature=Cc;function CW(e){return e}CW.signature=Cc;function eS(e){return ise(e)}eS.signature=Cc;function DW(e){return e*e*e}DW.signature=Cc;function OW(e){return Math.exp(e)}OW.signature=Cc;function MW(e){return ase(e)}MW.signature=Cc;function W7e(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}W7e.signature=HA;function jW(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)}jW.signature=HA;function Kse(e,t){return t?Math.log(e)/Math.log(t):Math.log(e)}function NW(e){return nse(e)}NW.signature=Cc;function TW(e){return rse(e)}TW.signature=Cc;function H7e(e){return sT(e)}H7e.signature=Cc;function V7e(e,t){return t===0?e:e-t*Math.floor(e/t)}V7e.signature=HA;function FW(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 IT(e){return kd(e)}IT.signature=Cc;function G7e(e){return Math.sqrt(e)}G7e.signature=Cc;function _W(e){return e*e}_W.signature=Cc;function PW(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}PW.signature=HA;function IW(e,t){return e*e<1&&t===1/0||e*e>1&&t===-1/0?0:Math.pow(e,t)}IW.signature=HA;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(JU(e,t))}function Q7e(e){return Math.abs(e)}Q7e.signature=Cc;var Y7e="number",rS="number, number";function BW(e,t){if(!wt(e)||!wt(t))throw new Error("Integers expected in function bitAnd");return e&t}BW.signature=rS;function RW(e){if(!wt(e))throw new Error("Integer expected in function bitNot");return~e}RW.signature=Y7e;function $W(e,t){if(!wt(e)||!wt(t))throw new Error("Integers expected in function bitOr");return e|t}$W.signature=rS;function qW(e,t){if(!wt(e)||!wt(t))throw new Error("Integers expected in function bitXor");return e^t}qW.signature=rS;function LW(e,t){if(!wt(e)||!wt(t))throw new Error("Integers expected in function leftShift");return e<>t}zW.signature=rS;function UW(e,t){if(!wt(e)||!wt(t))throw new Error("Integers expected in function rightLogShift");return e>>>t}UW.signature=rS;function yf(e,t){if(t>1;return yf(e,r)*yf(r+1,t)}function WW(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)*V6(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=Cy[0];for(var o=1;o=1;n--)r+=nle[n]/(e+n);return XW+(e+.5)*Math.log(t)-t+Math.log(r)}G6.signature="number";var qa="number",J7e="number, number";function eRe(e){return Math.acos(e)}eRe.signature=qa;function KW(e){return lse(e)}KW.signature=qa;function JW(e){return Math.atan(1/e)}JW.signature=qa;function eH(e){return isFinite(e)?(Math.log((e+1)/e)+Math.log(e/(e-1)))/2:0}eH.signature=qa;function tH(e){return Math.asin(1/e)}tH.signature=qa;function rH(e){var t=1/e;return Math.log(t+Math.sqrt(t*t+1))}rH.signature=qa;function nH(e){return Math.acos(1/e)}nH.signature=qa;function iH(e){var t=1/e,r=Math.sqrt(t*t-1);return Math.log(r+t)}iH.signature=qa;function tRe(e){return Math.asin(e)}tRe.signature=qa;function aH(e){return use(e)}aH.signature=qa;function rRe(e){return Math.atan(e)}rRe.signature=qa;function nRe(e,t){return Math.atan2(e,t)}nRe.signature=J7e;function oH(e){return cse(e)}oH.signature=qa;function iRe(e){return Math.cos(e)}iRe.signature=qa;function aRe(e){return uT(e)}aRe.signature=qa;function sH(e){return 1/Math.tan(e)}sH.signature=qa;function lH(e){var t=Math.exp(2*e);return(t+1)/(t-1)}lH.signature=qa;function uH(e){return 1/Math.sin(e)}uH.signature=qa;function cH(e){return e===0?Number.POSITIVE_INFINITY:Math.abs(2/(Math.exp(e)-Math.exp(-e)))*kd(e)}cH.signature=qa;function fH(e){return 1/Math.cos(e)}fH.signature=qa;function dH(e){return 2/(Math.exp(e)+Math.exp(-e))}dH.signature=qa;function oRe(e){return Math.sin(e)}oRe.signature=qa;function pH(e){return fse(e)}pH.signature=qa;function sRe(e){return Math.tan(e)}sRe.signature=qa;function lRe(e){return cT(e)}lRe.signature=qa;var Q6="number";function uRe(e){return wt(e)}uRe.signature=Q6;function mH(e){return e<0}mH.signature=Q6;function hH(e){return e>0}hH.signature=Q6;function AH(e){return e===0}AH.signature=Q6;function gH(e){return Number.isNaN(e)}gH.signature=Q6;var ile="isNegative",cRe=["typed"],BT=V(ile,cRe,e=>{var{typed:t}=e;return t(ile,{number:mH,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 ale="isNumeric",fRe=["typed"],RT=V(ale,fRe,e=>{var{typed:t}=e;return t(ale,{"number | BigNumber | Fraction | boolean":()=>!0,"Complex | Unit | string | null | undefined | Node":()=>!1,"Array | Matrix":t.referToSelf(r=>n=>jt(n,r))})});var ole="hasNumericValue",dRe=["typed","isNumeric"],$T=V(ole,dRe,e=>{var{typed:t,isNumeric:r}=e;return t(ole,{boolean:()=>!0,string:function(i){return i.trim().length>0&&!isNaN(Number(i))},any:function(i){return r(i)}})});var sle="isPositive",pRe=["typed"],qT=V(sle,pRe,e=>{var{typed:t}=e;return t(sle,{number:hH,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 lle="isZero",mRe=["typed"],LT=V(lle,mRe,e=>{var{typed:t}=e;return t(lle,{number:AH,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 ule="isNaN",hRe=["typed"],zT=V(ule,hRe,e=>{var{typed:t}=e;return t(ule,{number:gH,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 cle="typeOf",ARe=["typed"],UT=V(cle,ARe,e=>{var{typed:t}=e;return t(cle,{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 fle(e,t,r){return Ma(e.re,t.re,r)&&Ma(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 WT="equalScalar",gRe=["typed","config"],HT=V(WT,gRe,e=>{var{typed:t,config:r}=e,n=Dd({typed:t});return t(WT,{"boolean, boolean":function(a,o){return a===o},"number, number":function(a,o){return Ma(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 fle(a,o,r.epsilon)}},n)}),Ggt=V(WT,["typed","config"],e=>{var{typed:t,config:r}=e;return t(WT,{"number, number":function(i,a){return Ma(i,a,r.epsilon)}})});var vRe="SparseMatrix",yRe=["typed","equalScalar","Matrix"],VT=V(vRe,yRe,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&&!ma(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(ma(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){Gn(N),m.set([N,0],A[D[0]],b)})}else{var O=g.dimension(0),C=g.dimension(1);O.forEach(function(N,D){Gn(N),C.forEach(function(P,q){Gn(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 ar(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];Gn(g,this._size[0]),Gn(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]),Gn(b,x),Gn(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(!Gt(x)||!wt(x)||x<0)throw new TypeError("Invalid size, must contain positive integers (size: "+rr(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;ma(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(!Gt(_)||!wt(_)||_<=-2||_===0)throw new TypeError("Invalid size, must contain positive integers or -1 (size: "+rr(m)+")")});var A=this._size[0]*this._size[1];m=z6(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;LoF,createAccessorNode:()=>i4,createAcos:()=>p_,createAcosh:()=>m_,createAcot:()=>h_,createAcoth:()=>A_,createAcsc:()=>g_,createAcsch:()=>v_,createAdd:()=>Q_,createAddScalar:()=>lF,createAnd:()=>wS,createAndTransform:()=>wB,createApply:()=>Y0,createApplyTransform:()=>rB,createArg:()=>_F,createArrayNode:()=>o4,createAsec:()=>y_,createAsech:()=>b_,createAsin:()=>x_,createAsinh:()=>w_,createAssignmentNode:()=>c4,createAtan:()=>S_,createAtan2:()=>E_,createAtanh:()=>k_,createAtomicMass:()=>_I,createAvogadro:()=>PI,createBellNumbers:()=>DP,createBigNumberClass:()=>kT,createBignumber:()=>ZT,createBin:()=>A3,createBitAnd:()=>sS,createBitAndTransform:()=>EB,createBitNot:()=>TF,createBitOr:()=>lS,createBitOrTransform:()=>kB,createBitXor:()=>FF,createBlockNode:()=>d4,createBohrMagneton:()=>mI,createBohrRadius:()=>bI,createBoltzmann:()=>II,createBoolean:()=>YT,createCatalan:()=>OP,createCbrt:()=>cF,createCeil:()=>fF,createChain:()=>X4,createChainClass:()=>Y4,createClassicalElectronRadius:()=>xI,createClone:()=>TT,createColumn:()=>fS,createColumnTransform:()=>nB,createCombinations:()=>mP,createCombinationsWithRep:()=>hP,createCompare:()=>$3,createCompareNatural:()=>q3,createCompareText:()=>L3,createCompile:()=>B4,createComplex:()=>XT,createComplexClass:()=>CT,createComposition:()=>MP,createConcat:()=>cS,createConcatTransform:()=>mB,createConditionalNode:()=>m4,createConductanceQuantum:()=>hI,createConj:()=>PF,createConstantNode:()=>v4,createCorr:()=>pP,createCos:()=>C_,createCosh:()=>D_,createCot:()=>O_,createCoth:()=>M_,createCoulomb:()=>dI,createCount:()=>qF,createCreateUnit:()=>d_,createCross:()=>LF,createCsc:()=>j_,createCsch:()=>N_,createCtranspose:()=>o3,createCube:()=>dF,createCumSum:()=>DS,createCumSumTransform:()=>yB,createDeepEqual:()=>J3,createDenseMatrixClass:()=>NT,createDerivative:()=>IP,createDet:()=>K4,createDeuteronMass:()=>DI,createDiag:()=>zF,createDiff:()=>dS,createDiffTransform:()=>hB,createDistance:()=>lP,createDivide:()=>sP,createDivideScalar:()=>S3,createDot:()=>X_,createDotDivide:()=>j3,createDotMultiply:()=>jF,createDotPow:()=>M3,createE:()=>YP,createEfimovFactor:()=>FI,createEigs:()=>tP,createElectricConstant:()=>cI,createElectronMass:()=>wI,createElementaryCharge:()=>pI,createEqual:()=>U3,createEqualScalar:()=>HT,createEqualText:()=>W3,createErf:()=>f3,createEvaluate:()=>R4,createExp:()=>pF,createExpm:()=>rP,createExpm1:()=>mF,createFactorial:()=>vP,createFalse:()=>UP,createFaraday:()=>BI,createFermiCoupling:()=>SI,createFft:()=>l3,createFibonacciHeapClass:()=>o_,createFilter:()=>UF,createFilterTransform:()=>iB,createFineStructure:()=>EI,createFirstRadiation:()=>RI,createFix:()=>hF,createFlatten:()=>WF,createFloor:()=>nS,createForEach:()=>HF,createForEachTransform:()=>aB,createFormat:()=>h3,createFraction:()=>KT,createFractionClass:()=>DT,createFreqz:()=>$P,createFunctionAssignmentNode:()=>b4,createFunctionNode:()=>P4,createGamma:()=>AP,createGasConstant:()=>qI,createGcd:()=>AF,createGetMatrixDataType:()=>VF,createGravitationConstant:()=>oI,createGravity:()=>YI,createHartreeEnergy:()=>kI,createHasNumericValue:()=>$T,createHelp:()=>Z4,createHelpClass:()=>Q4,createHex:()=>v3,createHypot:()=>Y_,createI:()=>nI,createIdentity:()=>GF,createIfft:()=>u3,createIm:()=>IF,createImmutableDenseMatrixClass:()=>i_,createIndex:()=>J_,createIndexClass:()=>a_,createIndexNode:()=>w4,createIndexTransform:()=>oB,createInfinity:()=>HP,createIntersect:()=>uP,createInv:()=>J4,createInverseConductanceQuantum:()=>AI,createInvmod:()=>OF,createIsInteger:()=>PT,createIsNaN:()=>zT,createIsNegative:()=>BT,createIsNumeric:()=>RT,createIsPositive:()=>qT,createIsPrime:()=>x3,createIsZero:()=>LT,createKldivergence:()=>yP,createKlitzing:()=>yI,createKron:()=>QF,createLN10:()=>KP,createLN2:()=>XP,createLOG10E:()=>eI,createLOG2E:()=>JP,createLarger:()=>Z3,createLargerEq:()=>K3,createLcm:()=>gF,createLeafCount:()=>jP,createLeftShift:()=>P3,createLgamma:()=>gP,createLog:()=>C3,createLog10:()=>vF,createLog1p:()=>D3,createLog2:()=>yF,createLoschmidt:()=>$I,createLsolve:()=>N3,createLsolveAll:()=>F3,createLup:()=>L4,createLusolve:()=>V4,createLyap:()=>oP,createMad:()=>dP,createMagneticConstant:()=>uI,createMagneticFluxQuantum:()=>gI,createMap:()=>YF,createMapTransform:()=>sB,createMatrix:()=>JT,createMatrixClass:()=>MT,createMatrixFromColumns:()=>rF,createMatrixFromFunction:()=>eF,createMatrixFromRows:()=>tF,createMax:()=>SS,createMaxTransform:()=>lB,createMean:()=>OS,createMeanTransform:()=>uB,createMedian:()=>fP,createMin:()=>ES,createMinTransform:()=>cB,createMod:()=>iS,createMode:()=>p3,createMolarMass:()=>GI,createMolarMassC12:()=>QI,createMolarPlanckConstant:()=>LI,createMolarVolume:()=>zI,createMultinomial:()=>bP,createMultiply:()=>xF,createMultiplyScalar:()=>bF,createNaN:()=>VP,createNeutronMass:()=>OI,createNode:()=>t4,createNorm:()=>Z_,createNot:()=>RF,createNthRoot:()=>wF,createNthRoots:()=>O3,createNuclearMagneton:()=>vI,createNull:()=>WP,createNumber:()=>GT,createNumeric:()=>w3,createObjectNode:()=>E4,createOct:()=>g3,createOnes:()=>ZF,createOperatorNode:()=>C4,createOr:()=>uS,createOrTransform:()=>SB,createParenthesisNode:()=>O4,createParse:()=>I4,createParser:()=>q4,createParserClass:()=>$4,createPartitionSelect:()=>r_,createPermutations:()=>xP,createPhi:()=>ZP,createPi:()=>GP,createPickRandom:()=>SP,createPinv:()=>eP,createPlanckCharge:()=>JI,createPlanckConstant:()=>sI,createPlanckLength:()=>ZI,createPlanckMass:()=>XI,createPlanckTemperature:()=>eB,createPlanckTime:()=>KI,createPolynomialRoot:()=>G4,createPow:()=>E3,createPrint:()=>vS,createPrintTransform:()=>xB,createProd:()=>m3,createProtonMass:()=>CI,createQr:()=>z4,createQuantileSeq:()=>jS,createQuantileSeqTransform:()=>vB,createQuantumOfCirculation:()=>MI,createRandom:()=>EP,createRandomInt:()=>kP,createRange:()=>mS,createRangeClass:()=>OT,createRangeNode:()=>j4,createRangeTransform:()=>fB,createRationalize:()=>BP,createRe:()=>BF,createReducedPlanckConstant:()=>lI,createRelationalNode:()=>T4,createReplacer:()=>LP,createReshape:()=>JF,createResize:()=>e3,createResolve:()=>_P,createResultSet:()=>gT,createReviver:()=>qP,createRightArithShift:()=>I3,createRightLogShift:()=>B3,createRotate:()=>t3,createRotationMatrix:()=>r3,createRound:()=>k3,createRow:()=>hS,createRowTransform:()=>dB,createRydberg:()=>jI,createSQRT1_2:()=>tI,createSQRT2:()=>rI,createSackurTetrode:()=>UI,createSchur:()=>aP,createSec:()=>T_,createSech:()=>F_,createSecondRadiation:()=>WI,createSetCartesian:()=>R_,createSetDifference:()=>$_,createSetDistinct:()=>q_,createSetIntersect:()=>L_,createSetIsSubset:()=>z_,createSetMultiplicity:()=>U_,createSetPowerset:()=>W_,createSetSize:()=>H_,createSetSymDifference:()=>V_,createSetUnion:()=>G_,createSign:()=>SF,createSimplify:()=>NP,createSimplifyConstant:()=>TP,createSimplifyCore:()=>FP,createSin:()=>__,createSinh:()=>P_,createSize:()=>n3,createSlu:()=>H4,createSmaller:()=>V3,createSmallerEq:()=>Q3,createSolveODE:()=>c3,createSort:()=>n_,createSpaClass:()=>s_,createSparse:()=>f_,createSparseMatrixClass:()=>VT,createSpeedOfLight:()=>aI,createSplitUnit:()=>nF,createSqrt:()=>EF,createSqrtm:()=>nP,createSquare:()=>kF,createSqueeze:()=>i3,createStd:()=>NS,createStdTransform:()=>AB,createStefanBoltzmann:()=>HI,createStirlingS2:()=>CP,createString:()=>QT,createSubset:()=>AS,createSubsetTransform:()=>pB,createSubtract:()=>CF,createSubtractScalar:()=>uF,createSum:()=>CS,createSumTransform:()=>gB,createSylvester:()=>iP,createSymbolNode:()=>F4,createSymbolicEqual:()=>PP,createTan:()=>I_,createTanh:()=>B_,createTau:()=>QP,createThomsonCrossSection:()=>NI,createTo:()=>b3,createTrace:()=>K_,createTranspose:()=>a3,createTrue:()=>zP,createTypeOf:()=>UT,createTyped:()=>AT,createUnaryMinus:()=>iF,createUnaryPlus:()=>aF,createUnequal:()=>t_,createUnitClass:()=>u_,createUnitFunction:()=>c_,createUppercaseE:()=>bge,createUppercasePi:()=>yge,createUsolve:()=>T3,createUsolveAll:()=>_3,createVacuumImpedance:()=>fI,createVariance:()=>MS,createVarianceTransform:()=>bB,createVersion:()=>iI,createWeakMixingAngle:()=>TI,createWienDisplacement:()=>VI,createXgcd:()=>DF,createXor:()=>$F,createZeros:()=>s3,createZeta:()=>d3,createZpk2tf:()=>RP});var pW=Ae(oT(),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},rse=Math.log2||function(t){return Math.log(t)/Math.LN2},nse=Math.log10||function(t){return Math.log(t)/Math.LN10},sT=Math.log1p||function(e){return Math.log(e+1)},ise=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},ase=Math.expm1||function(t){return t>=2e-4||t<=-2e-4?Math.exp(t)-1:t+t*t/2+t*t*t/6};function JU(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}=eW(t);switch(r){case"fixed":return tW(e,n);case"exponential":return ose(e,n);case"engineering":return y8e(e,n);case"bin":return JU(e,2,i);case"oct":return JU(e,8,i);case"hex":return JU(e,16,i);case"auto":return b8e(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 eW(e){var t="auto",r,n;if(e!==void 0)if(Gt(e))r=e;else if(It(e))r=e.toNumber();else if(Hm(e))e.precision!==void 0&&(r=ese(e.precision,()=>{throw new Error('Option "precision" must be a number or BigNumber')})),e.wordSize!==void 0&&(n=ese(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 y8e(e,t){if(isNaN(e)||!isFinite(e))return String(e);var r=Gw(e),n=lT(r,t),i=n.exponent,a=n.coefficients,o=i%3===0?i:i<0?i-3-i%3:i-i%3;if(Gt(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=Gt(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 tW(e,t){if(isNaN(e)||!isFinite(e))return String(e);var r=Gw(e),n=typeof t=="number"?lT(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 b8e(e,t,r){if(isNaN(e)||!isFinite(e))return String(e);var n=tse(r?.lowerExp,-3),i=tse(r?.upperExp,5),a=Gw(e),o=t?lT(a,t):a;if(o.exponent=i)return ose(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 ese(e,t){if(Gt(e))return e;if(It(e))return e.toNumber();t()}function tse(e,t){return Gt(e)?e:It(e)?e.toNumber():t}function rW(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 hse(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}=eW(t);switch(r){case"fixed":return S8e(e,n);case"exponential":return pse(e,n);case"engineering":return w8e(e,n);case"bin":return rW(e,2,i);case"oct":return rW(e,8,i);case"hex":return rW(e,16,i);case"auto":{var a=mse(t?.lowerExp,-3),o=mse(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 pse(e,t){return t!==void 0?e.toExponential(t-1):e.toExponential()}function S8e(e,t){return e.toFixed(t)}function mse(e,t){return Gt(e)?e:It(e)?e.toNumber():t}function gse(e,t){var r=e.length-t.length,n=e.length;return e.substring(r,n)===t}function rr(e,t){var r=E8e(e,t);return t&&typeof t=="object"&&"truncate"in t&&r.length>t.truncate?r.substring(0,t.truncate-3)+"...":r}function E8e(e,t){if(typeof e=="number")return Bp(e,t);if(It(e))return hse(e,t);if(k8e(e))return!t||t.fraction!=="decimal"?e.s*e.n+"/"+e.d:e.toString();if(Array.isArray(e))return vse(e,t);if(ma(e))return by(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=>by(n)+": "+rr(e[n],t));return"{"+r.join(", ")+"}"}return String(e)}function by(e){for(var t=String(e),r="",n=0;n/g,">"),t}function vse(e,t){if(Array.isArray(e)){for(var r="[",n=e.length,i=0;it?1:-1}function ar(e,t,r){if(!(this instanceof ar))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}ar.prototype=new RangeError;ar.prototype.constructor=RangeError;ar.prototype.name="DimensionError";ar.prototype.isDimensionError=!0;function gs(e,t,r){if(!(this instanceof gs))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}gs.prototype=new RangeError;gs.prototype.constructor=RangeError;gs.prototype.name="IndexError";gs.prototype.isIndexError=!0;function Qt(e){for(var t=[];Array.isArray(e);)t.push(e.length),e=e[0];return t}function yse(e,t,r){var n,i=e.length;if(i!==t[r])throw new ar(i,t[r]);if(r")}function iW(e,t){var r=t.length===0;if(r){if(Array.isArray(e))throw new ar(e.length,0)}else yse(e,t,0)}function q6(e,t){var r=e.isMatrix?e._size:Qt(e),n=t._sourceSize;n.forEach((i,a)=>{if(i!==null&&i!==r[a])throw new ar(i,r[a])})}function Gn(e,t){if(e!==void 0){if(!Gt(e)||!wt(e))throw new TypeError("Index must be an integer (value: "+e+")");if(e<0||typeof t=="number"&&e>=t)throw new gs(e,t)}}function xy(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 bse(e){return e.reduce((t,r)=>t*r,1)}function C8e(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 aW(e,t){return Array.prototype.join.call(e,t)}function zA(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 Sse(r,n,t,0)},e[0]);throw new Error("Wrong number of arguments in function concat")}function D8e(){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 lW(e,t){var r=Qt(e);if(Ip(r,t))return e;U6(r,t);var n=D8e(r,t),i=n.length,a=[...Array(i-r.length).fill(1),...r],o=M8e(e);r.length!N8e(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 N8e(e){return e&&e[0]==="?"}function uW(e){return e&&e[0]==="?"?e.slice(1):e}function Xi(e,t){if(Dse(e)&&kse(e,t))return e[t];throw typeof e[t]=="function"&&mT(e,t)?new Error('Cannot access method "'+t+'" as a property'):new Error('No access to property "'+t+'"')}function Gm(e,t,r){if(Dse(e)&&kse(e,t))return e[t]=r,r;throw new Error('No access to property "'+t+'"')}function Ese(e,t){return t in e}function kse(e,t){return!e||typeof e!="object"?!1:Et(T8e,t)?!0:!(t in Object.prototype||t in Function.prototype)}function Cse(e,t){if(!mT(e,t))throw new Error('No access to method "'+t+'"');return e[t]}function mT(e,t){return e==null||typeof e[t]!="function"||Et(e,t)&&Object.getPrototypeOf&&t in Object.getPrototypeOf(e)?!1:Et(F8e,t)?!0:!(t in Object.prototype||t in Function.prototype)}function Dse(e){return typeof e=="object"&&e&&e.constructor===Object}var T8e={length:!0,name:!0},F8e={toString:!0,valueOf:!0,toLocaleString:!0};var Sy=class{constructor(t){this.wrappedObject=t,this[Symbol.iterator]=this.entries}keys(){return Object.keys(this.wrappedObject).values()}get(t){return Xi(this.wrappedObject,t)}set(t,r){return Gm(this.wrappedObject,t,r),this}has(t){return Ese(this.wrappedObject,t)}entries(){return Ose(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 Ose(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 Ose(e,t){return{next:()=>{var r=e.next();return r.done?r:{value:t(r.value),done:!1}}}}function U0(){return new Map}function UA(e){if(!e)return U0();if(cW(e))return e;if(Hm(e))return new Sy(e);throw new Error("createMap can create maps from objects or Maps")}function Mse(e){if(e instanceof Sy)return e.wrappedObject;var t={};for(var r of e.keys()){var n=e.get(r);Gm(t,r,n)}return t}function cW(e){return e?e instanceof Map||e instanceof Sy||typeof e.set=="function"&&typeof e.get=="function"&&typeof e.keys=="function"&&typeof e.has=="function":!1}var jse=function(){return jse=pW.default.create,pW.default},_8e=["?BigNumber","?Complex","?DenseMatrix","?Fraction"],AT=V("typed",_8e,function(t){var{BigNumber:r,Complex:n,DenseMatrix:i,Fraction:a}=t,o=jse();return o.clear(),o.addTypes([{name:"number",test:Gt},{name:"Complex",test:ps},{name:"BigNumber",test:It},{name:"Fraction",test:gf},{name:"Unit",test:Fo},{name:"identifier",test:s=>ma&&/^(?:[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:ma},{name:"Chain",test:Uw},{name:"Array",test:Ir},{name:"Matrix",test:St},{name:"DenseMatrix",test:LA},{name:"SparseMatrix",test:vf},{name:"Range",test:q0},{name:"Index",test:Wm},{name:"boolean",test:HN},{name:"ResultSet",test:VN},{name:"Help",test:zw},{name:"function",test:GN},{name:"Date",test:QN},{name:"RegExp",test:YN},{name:"null",test:ZN},{name:"undefined",test:XN},{name:"AccessorNode",test:zu},{name:"ArrayNode",test:ms},{name:"AssignmentNode",test:KN},{name:"BlockNode",test:JN},{name:"ConditionalNode",test:eT},{name:"ConstantNode",test:vr},{name:"FunctionNode",test:xl},{name:"FunctionAssignmentNode",test:Ed},{name:"IndexNode",test:Sc},{name:"Node",test:Nr},{name:"ObjectNode",test:Vm},{name:"OperatorNode",test:xi},{name:"ParenthesisNode",test:hs},{name:"RangeNode",test:tT},{name:"RelationalNode",test:rT},{name:"SymbolNode",test:ri},{name:"Map",test:cW},{name:"Object",test:Hm}]),o.addConversions([{from:"number",to:"BigNumber",convert:function(l){if(r||fW(l),sse(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||hT(l),new n(l,0)}},{from:"BigNumber",to:"Complex",convert:function(l){return n||hT(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||hT(l),new n(l.valueOf(),0)}},{from:"number",to:"Fraction",convert:function(l){a||dW(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||fW(l);try{return new r(l)}catch{throw new Error('Cannot convert "'+l+'" to BigNumber')}}},{from:"string",to:"Fraction",convert:function(l){a||dW(l);try{return new a(l)}catch{throw new Error('Cannot convert "'+l+'" to Fraction')}}},{from:"string",to:"Complex",convert:function(l){n||hT(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||fW(l),new r(+l)}},{from:"boolean",to:"Fraction",convert:function(l){return a||dW(l),new a(+l)}},{from:"boolean",to:"string",convert:function(l){return String(l)}},{from:"Array",to:"Matrix",convert:function(l){return i||P8e(),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&&Oa(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&&Oa(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 fW(e){throw new Error("Cannot convert value ".concat(e," into a BigNumber: no class 'BigNumber' provided"))}function hT(e){throw new Error("Cannot convert value ".concat(e," into a Complex number: no class 'Complex' provided"))}function P8e(){throw new Error("Cannot convert array into a Matrix: no class 'DenseMatrix' provided")}function dW(e){throw new Error("Cannot convert value ".concat(e," into a Fraction, no class 'Fraction' provided."))}var I8e="ResultSet",B8e=[],gT=V(I8e,B8e,()=>{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,G0=1e9,mW="0123456789abcdef",yT="2.3025850929940456840179914546843642076011014886287729760333279009675726096773524802359972050895982983419677840422862486334095254650828067566662873690987816894829072083255546808437998948262331985283935053089653777326288461633662222876982198867465436674744042432743651550489343149393914796194044002221051017141748003688084012647080685567743216228355220114804663715659121373450747856947683463616792101806445070648000277502684916746550586856935673420670581136429224554405758925724208241314695689016758940256776311356919292033376587141660230105703089634572075440370847469940168269282808481184289314848524948644871927809676271275775397027668605952496716674183485704422507197965004714951050492214776567636938662976979522110718264549734772662425709429322582798502585509785265383207606726317164309505995087807523710333101197857547331541421808427543863591778117054309827482385045648019095610299291824318237525357709750539565187697510374970888692180205189339507238539205144634197265287286965110862571492198849978748873771345686209167058",bT="3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679821480865132823066470938446095505822317253594081284811174502841027019385211055596446229489549303819644288109756659334461284756482337867831652712019091456485669234603486104543266482133936072602491412737245870066063155881748815209209628292540917153643678925903600113305305488204665213841469519415116094330572703657595919530921861173819326117931051185480744623799627495673518857527248912279381830119491298336733624406566430860213949463952247371907021798609437027705392171762931767523846748184676694051320005681271452635608277857713427577896091736371787214684409012249534301465495853710507922796892589235420199561121290219608640344181598136297747713099605187072113499999983729780499510597317328160963185950244594553469083026425223082533446850352619311881710100031378387528865875332083814206171776691473035982534904287554687311595628638823537875937519577818577805321712268066130019278766111959092164201989380952572010654858632789",hW={precision:20,rounding:4,modulo:1,toExpNeg:-7,toExpPos:21,minE:-Kw,maxE:Kw,crypto:!1},_se,WA,Br=!0,wT="[DecimalError] ",V0=wT+"Invalid argument: ",Pse=wT+"Precision limit exceeded",Ise=wT+"crypto unavailable",Bse="[object Decimal]",iu=Math.floor,vs=Math.pow,R8e=/^0b([01]+(\.[01]*)?|\.[01]+)(p[+-]?\d+)?$/i,$8e=/^0x([0-9a-f]+(\.[0-9a-f]*)?|\.[0-9a-f]+)(p[+-]?\d+)?$/i,q8e=/^0o([0-7]+(\.[0-7]*)?|\.[0-7]+)(p[+-]?\d+)?$/i,Rse=/^(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,qp=1e7,yr=7,L8e=9007199254740991,z8e=yT.length-1,AW=bT.length-1,pt={toStringTag:Bse};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(V0+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())+yr,n.rounding=1,r=U8e(n,Use(n,r)),n.precision=e,n.rounding=t,cr(WA==2||WA==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*vs(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=vs(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=Ki(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/yr))*yr,e=t[e],e)for(;e%10==0;e/=10)r--;r<0&&(r=0)}return r};pt.dividedBy=pt.div=function(e){return Ki(this,new this.constructor(e))};pt.dividedToIntegerBy=pt.divToInt=function(e){var t=this,r=t.constructor;return cr(Ki(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/ET(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/ET(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,Ki(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=Ki(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<=AW)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<=AW)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/yr+2|0),e=r;e;--e)u=u.div(u.times(u).plus(1).sqrt().plus(1));for(Br=!1,t=Math.ceil(s/yr),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=H0(u,s),n=t?xT(c,s+10):H0(e,s),l=Ki(o,n,s,1),W6(l.d,i=f,d))do if(s+=10,o=H0(u,s),n=t?xT(c,s+10):H0(e,s),l=Ki(o,n,s,1),!a){+wl(l.d).slice(i+1,i+15)+1==1e14&&(l=cr(l,f+1,0));break}while(W6(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/yr),c=iu(p.e/yr),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/yr),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=ST(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(V0+e);return r.d?(t=$se(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())+yr,n.rounding=1,r=H8e(n,Use(n,r)),n.precision=e,n.rounding=t,cr(WA>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(Ki(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=Ki(r,new n(1).minus(r.times(r)).sqrt(),e+10,0),n.precision=e,n.rounding=t,cr(WA==2||WA==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/yr)+iu(e.e/yr),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=ST(a,r),Br?cr(e,f.precision,f.rounding):e};pt.toBinary=function(e,t){return yW(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,G0),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,G0),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,G0),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=$se(h)-p.e-1,o=a%yr,t.d[0]=vs(10,o<0?yr+o:o),e==null)e=a>0?t:u;else{if(s=new m(e),!s.isInt()||s.lt(u))throw Error(V0+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*yr*2;f=Ki(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=Ki(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=Ki(u,n,a,1).minus(p).abs().cmp(Ki(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 yW(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=Ki(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 yW(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(vs(+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/yr),t>=e.d.length-1&&(r=u<0?-u:u)<=L8e)return i=qse(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=gW(e.times(H0(s,n+r)),n),i.d&&(i=cr(i,n+5,1),W6(i.d,n,a)&&(t=n+10,i=cr(gW(e.times(H0(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,G0),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,G0),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(V0+e)}function W6(e,t,r,n){var i,a,o,s;for(a=e[0];a>=10;a/=10)--t;return--t<0?(t+=yr,i=0):(i=Math.ceil((t+1)/yr),t%=yr),a=vs(10,yr-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)==vs(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)==vs(10,t-3)-1,o}function vT(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 U8e(e,t){var r,n,i;if(t.isZero())return t;n=t.d.length,n<32?(r=Math.ceil(n/3),i=(1/ET(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 Ki=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=yr,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+=yr,o=t,c=f[d=0],l=c/vs(10,i-o-1)%10|0;else if(d=Math.ceil((a+1)/yr),s=f.length,d>=s)if(n){for(;s++<=d;)f.push(0);c=l=0,i=1,a%=yr,o=a-yr+1}else break e;else{for(c=s=f[d],i=1;s>=10;s/=10)i++;a%=yr,o=a-yr+i,l=o<0?0:c/vs(10,i-o-1)%10|0}if(n=n||t<0||f[d+1]!==void 0||(o<0?c:c%vs(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/vs(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]=vs(10,(yr-t%yr)%yr),e.e=-t||0):f[0]=e.e=0,e;if(a==0?(f.length=d,s=1,d--):(f.length=d+1,s=vs(10,yr-a),f[d]=o>0?(c/vs(10,i-o)%vs(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)+W0(n):o>1&&(a=a.charAt(0)+"."+a.slice(1)),a=a+(e.e<0?"e":"e+")+e.e):i<0?(a="0."+W0(-i-1)+a,r&&(n=r-o)>0&&(a+=W0(n))):i>=o?(a+=W0(i+1-o),r&&(n=r-i-1)>0&&(a=a+"."+W0(n))):((n=i+1)0&&(i+1===o&&(a+="."),a+=W0(n))),a}function ST(e,t){var r=e[0];for(t*=yr;r>=10;r/=10)t++;return t}function xT(e,t,r){if(t>z8e)throw Br=!0,r&&(e.precision=r),Error(Pse);return cr(new e(yT),t,1,!0)}function $p(e,t,r){if(t>AW)throw Error(Pse);return cr(new e(bT),t,r,!0)}function $se(e){var t=e.length-1,r=t*yr+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 W0(e){for(var t="";e--;)t+="0";return t}function qse(e,t,r,n){var i,a=new e(1),o=Math.ceil(n/yr+4);for(Br=!1;;){if(r%2&&(a=a.times(t),Tse(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),Tse(t.d,o)}return Br=!0,a}function Nse(e){return e.d[e.d.length-1]&1}function Lse(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(vs(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(Ki(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&&W6(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 H0(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=xT(A,c+2,v).times(a+""),m=H0(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=Ki(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(Ki(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(xT(A,c+2,v).times(a+""))),l=Ki(l,new A(p),c,1),t==null)if(W6(l.d,c-h,b,s))A.precision=c+=h,u=o=m=Ki(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 zse(e){return String(e.s*e.s/0)}function vW(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)%yr,r<0&&(n+=yr),ne.constructor.maxE?(e.d=null,e.e=NaN):e.e-1){if(t=t.replace(/(\d)_(?=\d)/g,"$1"),Rse.test(t))return vW(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(R8e.test(t))r=2;else if(q8e.test(t))r=8;else throw Error(V0+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=qse(n,new n(r),a,a*2)),u=vT(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=ST(u,c),e.d=u,Br=!1,o&&(e=Ki(e,i,s*4)),l&&(e=e.times(Math.abs(l)<54?vs(2,l):H6.pow(2,l))),Br=!0,e)}function H8e(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/ET(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/yr);for(Br=!1,l=r.times(r),s=new e(n);;){if(o=Ki(s.times(l),new e(t++*t++),c,1),s=i?n.plus(o):n.minus(o),n=Ki(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 ET(e,t){for(var r=e;--t;)r*=e;return r}function Use(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 WA=n?4:1,t;if(r=t.divToInt(i),r.isZero())WA=n?3:2;else{if(t=t.minus(r.times(i)),t.lte(a))return WA=Nse(r)?n?2:3:n?4:1,t;WA=Nse(r)?n?1:4:n?3:2}return t.minus(i).abs()}function yW(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,G0),n===void 0?n=p.rounding:kc(n,0,8)):(r=p.precision,n=p.rounding),!e.isFinite())c=zse(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=vT(Qm(d),10,i),d.e=d.d.length),f=vT(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=Ki(e,d,r,n,0,i),f=e.d,a=e.e,u=_se),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=vT(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 V8e(e){return new this(e).abs()}function G8e(e){return new this(e).acos()}function Q8e(e){return new this(e).acosh()}function Y8e(e,t){return new this(e).plus(t)}function Z8e(e){return new this(e).asin()}function X8e(e){return new this(e).asinh()}function K8e(e){return new this(e).atan()}function J8e(e){return new this(e).atanh()}function e7e(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(Ki(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(Ki(e,t,a,1)),r}function t7e(e){return new this(e).cbrt()}function r7e(e){return cr(e=new this(e),e.e+1,2)}function n7e(e,t,r){return new this(e).clamp(t,r)}function i7e(e){if(!e||typeof e!="object")throw Error(wT+"Object expected");var t,r,n,i=e.defaults===!0,a=["precision",1,G0,"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(V0+r+": "+n);if(r="crypto",i&&(this[r]=hW[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(Ise);else this[r]=!1;else throw Error(V0+r+": "+n);return this}function a7e(e){return new this(e).cos()}function o7e(e){return new this(e).cosh()}function Wse(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,Fse(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(Ise);else for(;a=10;i/=10)n++;n{var{on:t,config:r}=e,n=Ey.clone({precision:r.precision,modulo:Ey.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 Vs=Ae(Vse(),1);var F7e="Complex",_7e=[],CT=V(F7e,_7e,()=>(Object.defineProperty(Vs.default,"name",{value:"Complex"}),Vs.default.prototype.constructor=Vs.default,Vs.default.prototype.type="Complex",Vs.default.prototype.isComplex=!0,Vs.default.prototype.toJSON=function(){return{mathjs:"Complex",re:this.re,im:this.im}},Vs.default.prototype.toPolar=function(){return{r:this.abs(),phi:this.arg()}},Vs.default.prototype.format=function(e){var t="",r=this.im,n=this.re,i=Bp(this.re,e),a=Bp(this.im,e),o=Gt(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 B7e="Range",R7e=[],OT=V(B7e,R7e,()=>{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",q7e=[],MT=V($7e,q7e,()=>{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 Yse(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 ky(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:Yse(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&&!ma(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,iW(this._data,this._size),this._datatype=f||c.datatype;else if(Ir(c))this._data=u(c),this._size=Qt(this._data),iW(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 z0(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 ar(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){Gn(A),c[A]=d[b[0]]}):g.forEach(function(A,b){Gn(A),o(c[A],f,d[b[0]],p,h+1)})}r.prototype.resize=function(c,f,d){if(!Oa(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=L6(d._data,c);var p=d._size.reduce((h,m)=>h*m);return d._size=z6(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=jT(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?z0(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(Zse,{any:Bt})});function FT(e){var t=e.length,r=e[0].length,n,i,a=[];for(i=0;i=n.length)throw new gs(t,n.length);return St(e)?e.create(_T(e.valueOf(),t,r)):_T(e,t,r)}function _T(e,t,r){var n,i,a,o;if(t<=0)if(Array.isArray(e[0])){for(o=FT(e),i=[],n=0;n{var{typed:t}=e;return t(Xse,{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",HA="number, number";function SW(e){return Math.abs(e)}SW.signature=Cc;function EW(e,t){return e+t}EW.signature=HA;function kW(e,t){return e-t}kW.signature=HA;function CW(e,t){return e*t}CW.signature=HA;function H7e(e,t){return e/t}H7e.signature=HA;function DW(e){return-e}DW.signature=Cc;function OW(e){return e}OW.signature=Cc;function eS(e){return ise(e)}eS.signature=Cc;function MW(e){return e*e*e}MW.signature=Cc;function jW(e){return Math.exp(e)}jW.signature=Cc;function NW(e){return ase(e)}NW.signature=Cc;function V7e(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}V7e.signature=HA;function TW(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)}TW.signature=HA;function Kse(e,t){return t?Math.log(e)/Math.log(t):Math.log(e)}function FW(e){return nse(e)}FW.signature=Cc;function _W(e){return rse(e)}_W.signature=Cc;function G7e(e){return sT(e)}G7e.signature=Cc;function Q7e(e,t){return t===0?e:e-t*Math.floor(e/t)}Q7e.signature=HA;function PW(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 IT(e){return kd(e)}IT.signature=Cc;function Y7e(e){return Math.sqrt(e)}Y7e.signature=Cc;function IW(e){return e*e}IW.signature=Cc;function BW(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}BW.signature=HA;function RW(e,t){return e*e<1&&t===1/0||e*e>1&&t===-1/0?0:Math.pow(e,t)}RW.signature=HA;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(tW(e,t))}function Z7e(e){return Math.abs(e)}Z7e.signature=Cc;var X7e="number",rS="number, number";function $W(e,t){if(!wt(e)||!wt(t))throw new Error("Integers expected in function bitAnd");return e&t}$W.signature=rS;function qW(e){if(!wt(e))throw new Error("Integer expected in function bitNot");return~e}qW.signature=X7e;function LW(e,t){if(!wt(e)||!wt(t))throw new Error("Integers expected in function bitOr");return e|t}LW.signature=rS;function zW(e,t){if(!wt(e)||!wt(t))throw new Error("Integers expected in function bitXor");return e^t}zW.signature=rS;function UW(e,t){if(!wt(e)||!wt(t))throw new Error("Integers expected in function leftShift");return e<>t}WW.signature=rS;function HW(e,t){if(!wt(e)||!wt(t))throw new Error("Integers expected in function rightLogShift");return e>>>t}HW.signature=rS;function yf(e,t){if(t>1;return yf(e,r)*yf(r+1,t)}function VW(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)*V6(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=Cy[0];for(var o=1;o=1;n--)r+=nle[n]/(e+n);return JW+(e+.5)*Math.log(t)-t+Math.log(r)}G6.signature="number";var qa="number",tRe="number, number";function rRe(e){return Math.acos(e)}rRe.signature=qa;function eH(e){return lse(e)}eH.signature=qa;function tH(e){return Math.atan(1/e)}tH.signature=qa;function rH(e){return isFinite(e)?(Math.log((e+1)/e)+Math.log(e/(e-1)))/2:0}rH.signature=qa;function nH(e){return Math.asin(1/e)}nH.signature=qa;function iH(e){var t=1/e;return Math.log(t+Math.sqrt(t*t+1))}iH.signature=qa;function aH(e){return Math.acos(1/e)}aH.signature=qa;function oH(e){var t=1/e,r=Math.sqrt(t*t-1);return Math.log(r+t)}oH.signature=qa;function nRe(e){return Math.asin(e)}nRe.signature=qa;function sH(e){return use(e)}sH.signature=qa;function iRe(e){return Math.atan(e)}iRe.signature=qa;function aRe(e,t){return Math.atan2(e,t)}aRe.signature=tRe;function lH(e){return cse(e)}lH.signature=qa;function oRe(e){return Math.cos(e)}oRe.signature=qa;function sRe(e){return uT(e)}sRe.signature=qa;function uH(e){return 1/Math.tan(e)}uH.signature=qa;function cH(e){var t=Math.exp(2*e);return(t+1)/(t-1)}cH.signature=qa;function fH(e){return 1/Math.sin(e)}fH.signature=qa;function dH(e){return e===0?Number.POSITIVE_INFINITY:Math.abs(2/(Math.exp(e)-Math.exp(-e)))*kd(e)}dH.signature=qa;function pH(e){return 1/Math.cos(e)}pH.signature=qa;function mH(e){return 2/(Math.exp(e)+Math.exp(-e))}mH.signature=qa;function lRe(e){return Math.sin(e)}lRe.signature=qa;function hH(e){return fse(e)}hH.signature=qa;function uRe(e){return Math.tan(e)}uRe.signature=qa;function cRe(e){return cT(e)}cRe.signature=qa;var Q6="number";function fRe(e){return wt(e)}fRe.signature=Q6;function AH(e){return e<0}AH.signature=Q6;function gH(e){return e>0}gH.signature=Q6;function vH(e){return e===0}vH.signature=Q6;function yH(e){return Number.isNaN(e)}yH.signature=Q6;var ile="isNegative",dRe=["typed"],BT=V(ile,dRe,e=>{var{typed:t}=e;return t(ile,{number:AH,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 ale="isNumeric",pRe=["typed"],RT=V(ale,pRe,e=>{var{typed:t}=e;return t(ale,{"number | BigNumber | Fraction | boolean":()=>!0,"Complex | Unit | string | null | undefined | Node":()=>!1,"Array | Matrix":t.referToSelf(r=>n=>jt(n,r))})});var ole="hasNumericValue",mRe=["typed","isNumeric"],$T=V(ole,mRe,e=>{var{typed:t,isNumeric:r}=e;return t(ole,{boolean:()=>!0,string:function(i){return i.trim().length>0&&!isNaN(Number(i))},any:function(i){return r(i)}})});var sle="isPositive",hRe=["typed"],qT=V(sle,hRe,e=>{var{typed:t}=e;return t(sle,{number:gH,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 lle="isZero",ARe=["typed"],LT=V(lle,ARe,e=>{var{typed:t}=e;return t(lle,{number:vH,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 ule="isNaN",gRe=["typed"],zT=V(ule,gRe,e=>{var{typed:t}=e;return t(ule,{number:yH,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 cle="typeOf",vRe=["typed"],UT=V(cle,vRe,e=>{var{typed:t}=e;return t(cle,{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 fle(e,t,r){return Ma(e.re,t.re,r)&&Ma(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 WT="equalScalar",yRe=["typed","config"],HT=V(WT,yRe,e=>{var{typed:t,config:r}=e,n=Dd({typed:t});return t(WT,{"boolean, boolean":function(a,o){return a===o},"number, number":function(a,o){return Ma(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 fle(a,o,r.epsilon)}},n)}),Ygt=V(WT,["typed","config"],e=>{var{typed:t,config:r}=e;return t(WT,{"number, number":function(i,a){return Ma(i,a,r.epsilon)}})});var bRe="SparseMatrix",xRe=["typed","equalScalar","Matrix"],VT=V(bRe,xRe,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&&!ma(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(ma(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){Gn(N),m.set([N,0],A[D[0]],b)})}else{var O=g.dimension(0),C=g.dimension(1);O.forEach(function(N,D){Gn(N),C.forEach(function(P,q){Gn(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 ar(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];Gn(g,this._size[0]),Gn(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]),Gn(b,x),Gn(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(!Gt(x)||!wt(x)||x<0)throw new TypeError("Invalid size, must contain positive integers (size: "+rr(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;ma(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(!Gt(_)||!wt(_)||_<=-2||_===0)throw new TypeError("Invalid size, must contain positive integers or -1 (size: "+rr(m)+")")});var A=this._size[0]*this._size[1];m=z6(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?rr(this._values[k],m):"X")}return v},i.prototype.toString=function(){return rr(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()),!Gt(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 bRe="number",xRe=["typed"];function wRe(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 SRe(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=wRe(i);if(a)return SRe(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 dle="string",ERe=["typed"],QT=V(dle,ERe,e=>{var{typed:t}=e;return t(dle,{"":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 ple="boolean",kRe=["typed"],YT=V(ple,kRe,e=>{var{typed:t}=e;return t(ple,{"":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 CRe="bignumber",DRe=["typed","BigNumber"],ZT=V(CRe,DRe,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 ORe="complex",MRe=["typed","Complex"],XT=V(ORe,MRe,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 jRe="fraction",NRe=["typed","Fraction"],KT=V(jRe,NRe,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 mle="matrix",TRe=["typed","Matrix","DenseMatrix","SparseMatrix"],JT=V(mle,TRe,e=>{var{typed:t,Matrix:r,DenseMatrix:n,SparseMatrix:i}=e;return t(mle,{"":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 hle="matrixFromFunction",FRe=["typed","matrix","isZero"],eF=V(hle,FRe,e=>{var{typed:t,matrix:r,isZero:n}=e;return t(hle,{"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 Ale="matrixFromRows",_Re=["typed","matrix","flatten","size"],tF=V(Ale,_Re,e=>{var{typed:t,matrix:r,flatten:n,size:i}=e;return t(Ale,{"...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 gle="matrixFromColumns",PRe=["typed","matrix","flatten","size"],rF=V(gle,PRe,e=>{var{typed:t,matrix:r,flatten:n,size:i}=e;return t(gle,{"...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(vle,{"Unit, Array":function(n,i){return n.splitUnit(i)}})});var yle="unaryMinus",BRe=["typed"],iF=V(yle,BRe,e=>{var{typed:t}=e;return t(yle,{number:kW,"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 ble="unaryPlus",RRe=["typed","config","BigNumber"],aF=V(ble,RRe,e=>{var{typed:t,config:r,BigNumber:n}=e;return t(ble,{number:CW,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 xle="abs",$Re=["typed"],oF=V(xle,$Re,e=>{var{typed:t}=e;return t(xle,{number:xW,"Complex | BigNumber | Fraction | Unit":r=>r.abs(),"Array | Matrix":t.referToSelf(r=>n=>jt(n,r,!0))})});var wle="apply",qRe=["typed","isInteger"],Y0=V(wle,qRe,e=>{var{typed:t,isInteger:r}=e;return t(wle,{"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)?Qt(i):i.size();if(a<0||a>=s.length)throw new gs(a,s.length);return St(i)?i.create(sF(i.valueOf(),a,o)):sF(i,a,o)}})});function sF(e,t,r){var n,i,a;if(t<=0)if(Array.isArray(e[0])){for(a=LRe(e),i=[],n=0;n{var{typed:t}=e;return t(Sle,{"number, number":wW,"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 Ele="subtractScalar",URe=["typed"],uF=V(Ele,URe,e=>{var{typed:t}=e;return t(Ele,{"number, number":SW,"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 kle="cbrt",WRe=["config","typed","isNegative","unaryMinus","matrix","Complex","BigNumber","Fraction"],cF=V(kle,WRe,e=>{var{config:t,typed:r,isNegative:n,unaryMinus:i,matrix:a,Complex:o,BigNumber:s,Fraction:l}=e;return r(kle,{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&&ps(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 HRe="matAlgo11xS0s",VRe=["typed","equalScalar"],Qn=V(HRe,VRe,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(vH,{number:function(a){return Ma(a,n(a),r.epsilon)?n(a):Math.ceil(a)},"number, number":function(a,o){if(Ma(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))}})}),fF=V(vH,XRe,e=>{var{typed:t,config:r,round:n,matrix:i,equalScalar:a,zeros:o,DenseMatrix:s}=e,l=Qn({typed:t,equalScalar:a}),u=An({typed:t,DenseMatrix:s}),c=vo({typed:t}),f=KRe({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(),Ey.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 Cle="cube",JRe=["typed"],dF=V(Cle,JRe,e=>{var{typed:t}=e;return t(Cle,{number:DW,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 Dle="exp",e$e=["typed"],pF=V(Dle,e$e,e=>{var{typed:t}=e;return t(Dle,{number:OW,Complex:function(n){return n.exp()},BigNumber:function(n){return n.exp()}})});var Ole="expm1",t$e=["typed","Complex"],mF=V(Ole,t$e,e=>{var{typed:t,Complex:r}=e;return t(Ole,{number:MW,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 yH="fix",r$e=["typed","Complex","matrix","ceil","floor","equalScalar","zeros","DenseMatrix"],n$e=V(yH,["typed","ceil","floor"],e=>{var{typed:t,ceil:r,floor:n}=e;return t(yH,{number:function(a){return a>0?n(a):r(a)},"number, number":function(a,o){return a>0?n(a,o):r(a,o)}})}),hF=V(yH,r$e,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=n$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 bH="floor",i$e=["typed","config","round","matrix","equalScalar","zeros","DenseMatrix"],a$e=V(bH,["typed","config","round"],e=>{var{typed:t,config:r,round:n}=e;return t(bH,{number:function(a){return Ma(a,n(a),r.epsilon)?n(a):Math.floor(a)},"number, number":function(a,o){if(Ma(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(bH,i$e,e=>{var{typed:t,config:r,round:n,matrix:i,equalScalar:a,zeros:o,DenseMatrix:s}=e,l=Qn({typed:t,equalScalar:a}),u=An({typed:t,DenseMatrix:s}),c=vo({typed:t}),f=a$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(),Ey.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 o$e="matAlgo02xDS0",s$e=["typed","equalScalar"],yo=V(o$e,s$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 ar(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 ar(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 ar(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 ar(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=Mle({typed:t}),a=vo({typed:t}),o=jle({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&&nT(f,u.signatures),f}});var Nle="mod",v$e=["typed","config","round","matrix","equalScalar","zeros","DenseMatrix","concat"],iS=V(Nle,v$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=wi({typed:t}),d=Z0({typed:t,equalScalar:a}),p=Qn({typed:t,equalScalar:a}),h=An({typed:t,DenseMatrix:s}),m=fr({typed:t,matrix:i,concat:l});return t(Nle,{"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 y$e="matAlgo01xDSid",b$e=["typed"],ou=V(y$e,b$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 ar(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 ar(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 AF=V(Tle,k$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(Tle,{"number, number":m,"BigNumber, BigNumber":g,"Fraction, Fraction":(A,b)=>A.gcd(b)},h({SS:d,DS:f,Ss:p}),{[C$e]:t.referToSelf(A=>(b,v,x)=>{for(var w=A(b,v),S=0;Sb=>{if(b.length===1&&Array.isArray(b[0])&&Fle(b[0]))return A(...b[0]);if(Fle(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 D$e="matAlgo06xS0S0",O$e=["typed","equalScalar"],X0=V(D$e,O$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 ar(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=X0({typed:t,equalScalar:n}),s=Qn({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 Ple="log10",j$e=["typed","config","Complex"],vF=V(Ple,j$e,e=>{var{typed:t,config:r,Complex:n}=e;return t(Ple,{number:function(a){return a>=0||r.predictable?NW(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 Ile="log2",N$e=["typed","config","Complex"],yF=V(Ile,N$e,e=>{var{typed:t,config:r,Complex:n}=e;return t(Ile,{number:function(o){return o>=0||r.predictable?TW(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 T$e="multiplyScalar",F$e=["typed"],bF=V(T$e,F$e,e=>{var{typed:t}=e;return t("multiplyScalar",{"number, number":EW,"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 Ble="multiply",_$e=["typed","matrix","addScalar","multiplyScalar","equalScalar","dot"],xF=V(Ble,_$e,e=>{var{typed:t,matrix:r,addScalar:n,multiplyScalar:i,equalScalar:a,dot:o}=e,s=Qn({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(Qt(S),Qt(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=X0({typed:t,equalScalar:n}),u=Qn({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(Rle,{number:FW,"number, number":FW,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 $le="sign",I$e=["typed","BigNumber","Fraction","complex"],SF=V($le,I$e,e=>{var{typed:t,BigNumber:r,complex:n,Fraction:i}=e;return t($le,{number:IT,Complex:function(o){return o.im===0?n(IT(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 B$e="sqrt",R$e=["config","typed","Complex"],EF=V(B$e,R$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 qle="square",$$e=["typed"],kF=V(qle,$$e,e=>{var{typed:t}=e;return t(qle,{number:_W,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 Lle="subtract",q$e=["typed","matrix","equalScalar","subtractScalar","unaryMinus","DenseMatrix","concat"],CF=V(Lle,q$e,e=>{var{typed:t,matrix:r,equalScalar:n,subtractScalar:i,unaryMinus:a,DenseMatrix:o,concat:s}=e,l=ou({typed:t}),u=wi({typed:t}),c=Z0({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(Lle,{"any, any":i},p({elop:i,SS:c,DS:l,SD:u,Ss:d,sS:f}))});var zle="xgcd",L$e=["typed","config","matrix","BigNumber"],DF=V(zle,L$e,e=>{var{typed:t,config:r,matrix:n,BigNumber:i}=e;return t(zle,{"number, number":function(s,l){var u=PW(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 Ule="invmod",z$e=["typed","config","BigNumber","xgcd","equal","smaller","mod","add","isInteger"],OF=V(Ule,z$e,e=>{var{typed:t,config:r,BigNumber:n,xgcd:i,equal:a,smaller:o,mod:s,add:l,isInteger:u}=e;return t(Ule,{"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 U$e="matAlgo09xS0Sf",W$e=["typed","equalScalar"],MF=V(U$e,W$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 ar(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=MF({typed:t,equalScalar:n}),l=Qn({typed:t,equalScalar:n}),u=fr({typed:t,matrix:r,concat:a});return t(Wle,u({elop:i,SS:s,DS:o,Ss:l}))});function Hle(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 wH(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 Vle(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:wH(e,t,function(i,a){return i|a})}function wH(e,t,r){var n=e.constructor,i,a,o=+(e.s<0),s=+(t.s<0);if(o){i=NF(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 NF(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 Gle(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):wH(e,t,function(i,a){return i^a})}function Qle(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 Yle(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 Zle="bitAnd",V$e=["typed","matrix","equalScalar","concat"],sS=V(Zle,V$e,e=>{var{typed:t,matrix:r,equalScalar:n,concat:i}=e,a=yo({typed:t,equalScalar:n}),o=X0({typed:t,equalScalar:n}),s=Qn({typed:t,equalScalar:n}),l=fr({typed:t,matrix:r,concat:i});return t(Zle,{"number, number":BW,"BigNumber, BigNumber":Hle},l({SS:o,DS:a,Ss:s}))});var Xle="bitNot",G$e=["typed"],TF=V(Xle,G$e,e=>{var{typed:t}=e;return t(Xle,{number:RW,BigNumber:oS,"Array | Matrix":t.referToSelf(r=>n=>jt(n,r))})});var Kle="bitOr",Q$e=["typed","matrix","equalScalar","DenseMatrix","concat"],lS=V(Kle,Q$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(Kle,{"number, number":$W,"BigNumber, BigNumber":Vle},u({SS:s,DS:o,Ss:l}))});var Y$e="matAlgo07xSSf",Z$e=["typed","DenseMatrix"],Qo=V(Y$e,Z$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 ar(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=wi({typed:t}),o=Qo({typed:t,DenseMatrix:n}),s=An({typed:t,DenseMatrix:n}),l=fr({typed:t,matrix:r,concat:i});return t(Jle,{"number, number":qW,"BigNumber, BigNumber":Gle},l({SS:o,DS:a,Ss:s}))});var eue="arg",K$e=["typed"],_F=V(eue,K$e,e=>{var{typed:t}=e;return t(eue,{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 tue="conj",J$e=["typed"],PF=V(tue,J$e,e=>{var{typed:t}=e;return t(tue,{"number | BigNumber | Fraction":r=>r,Complex:r=>r.conjugate(),"Array | Matrix":t.referToSelf(r=>n=>jt(n,r))})});var rue="im",eqe=["typed"],IF=V(rue,eqe,e=>{var{typed:t}=e;return t(rue,{number:()=>0,"BigNumber | Fraction":r=>r.mul(0),Complex:r=>r.im,"Array | Matrix":t.referToSelf(r=>n=>jt(n,r))})});var nue="re",tqe=["typed"],BF=V(nue,tqe,e=>{var{typed:t}=e;return t(nue,{"number | BigNumber | Fraction":r=>r,Complex:r=>r.re,"Array | Matrix":t.referToSelf(r=>n=>jt(n,r))})});var iue="not",rqe=["typed"],RF=V(iue,rqe,e=>{var{typed:t}=e;return t(iue,{"null | undefined":()=>!0,number:VW,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 aue="or",nqe=["typed","matrix","equalScalar","DenseMatrix","concat"],uS=V(aue,nqe,e=>{var{typed:t,matrix:r,equalScalar:n,DenseMatrix:i,concat:a}=e,o=wi({typed:t}),s=Z0({typed:t,equalScalar:n}),l=An({typed:t,DenseMatrix:i}),u=fr({typed:t,matrix:r,concat:a});return t(aue,{"number, number":GW,"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 oue="xor",iqe=["typed","matrix","DenseMatrix","concat"],$F=V(oue,iqe,e=>{var{typed:t,matrix:r,DenseMatrix:n,concat:i}=e,a=wi({typed:t}),o=Qo({typed:t,DenseMatrix:n}),s=An({typed:t,DenseMatrix:n}),l=fr({typed:t,matrix:r,concat:i});return t(oue,{"number, number":QW,"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 sue="concat",aqe=["typed","matrix","isInteger"],cS=V(sue,aqe,e=>{var{typed:t,matrix:r,isInteger:n}=e;return t(sue,{"...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 gs(l,u+1)}else{var p=Bt(d).valueOf(),h=Qt(p);if(f[o]=p,u=l,l=h.length-1,o>0&&l!==u)throw new ar(u+1,l+1)}}if(f.length===0)throw new SyntaxError("At least one matrix expected");for(var m=f.shift();f.length;)m=aW(m,f.shift(),l);return c?r(m):m},"...string":function(a){return a.join("")}})});var lue="column",oqe=["typed","Index","matrix","range"],fS=V(lue,oqe,e=>{var{typed:t,Index:r,matrix:n,range:i}=e;return t(lue,{"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");Gn(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 uue="count",sqe=["typed","size","prod"],qF=V(uue,sqe,e=>{var{typed:t,size:r,prod:n}=e;return t(uue,{string:function(a){return a.length},"Matrix | Array":function(a){return n(r(a))}})});var cue="cross",lqe=["typed","matrix","subtract","multiply"],LF=V(cue,lqe,e=>{var{typed:t,matrix:r,subtract:n,multiply:i}=e;return t(cue,{"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(Qt(o).length,Qt(s).length);o=Qw(o),s=Qw(s);var u=Qt(o),c=Qt(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 fue="diag",uqe=["typed","matrix","DenseMatrix","SparseMatrix"],zF=V(fue,uqe,e=>{var{typed:t,matrix:r,DenseMatrix:n,SparseMatrix:i}=e;return t(fue,{Array:function(u){return a(u,0,Qt(u),null)},"Array, number":function(u,c){return a(u,c,Qt(u),null)},"Array, BigNumber":function(u,c){return a(u,c.toNumber(),Qt(u),null)},"Array, string":function(u,c){return a(u,0,Qt(u),c)},"Array, number, string":function(u,c,f){return a(u,c,Qt(u),f)},"Array, BigNumber, string":function(u,c,f){return a(u,c.toNumber(),Qt(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 cqe="filter",fqe=["typed"],UF=V(cqe,fqe,e=>{var{typed:t}=e;return t("filter",{"Array, function":due,"Matrix, function":function(n,i){return n.create(due(n.toArray(),i))},"Array, RegExp":Yw,"Matrix, RegExp":function(n,i){return n.create(Yw(n.toArray(),i))}})});function due(e,t){return pT(e,function(r,n,i){return Od(t,r,[n],i,"filter")})}var pue="flatten",dqe=["typed","matrix"],WF=V(pue,dqe,e=>{var{typed:t,matrix:r}=e;return t(pue,{Array:function(i){return hr(i)},Matrix:function(i){var a=hr(i.toArray());return r(a)}})});var mue="forEach",pqe=["typed"],HF=V(mue,pqe,e=>{var{typed:t}=e;return t(mue,{"Array, function":mqe,"Matrix, function":function(n,i){n.forEach(i)}})});function mqe(e,t){var r=function n(i,a){if(Array.isArray(i))L0(i,function(o,s){n(o,a.concat(s))});else return Od(t,i,a,e,"forEach")};r(e,[])}var hue="getMatrixDataType",hqe=["typed"],VF=V(hue,hqe,e=>{var{typed:t}=e;return t(hue,{Array:function(n){return z0(n,qr)},Matrix:function(n){return n.getDataType()}})});var Aue="identity",Aqe=["typed","config","matrix","BigNumber","DenseMatrix","SparseMatrix"],GF=V(Aue,Aqe,e=>{var{typed:t,config:r,matrix:n,BigNumber:i,DenseMatrix:a,SparseMatrix:o}=e;return t(Aue,{"":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(gue,{"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(Qt(a).length===1&&(a=[a]),Qt(o).length===1&&(o=[o]),Qt(a).length>2||Qt(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 vue="map",vqe=["typed"],YF=V(vue,vqe,e=>{var{typed:t}=e;return t(vue,{"Array, function":yqe,"Matrix, function":function(n,i){return n.map(i)}})});function yqe(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 yue="diff",bqe=["typed","matrix","subtract","number"],dS=V(yue,bqe,e=>{var{typed:t,matrix:r,subtract:n,number:i}=e;return t(yue,{"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 XF(){throw new Error('No "fraction" implementation available')}function KF(){throw new Error('No "matrix" implementation available')}var bue="range",Sqe=["typed","config","?matrix","?bignumber","smaller","smallerEq","larger","largerEq","add","isPositive"],mS=V(bue,Sqe,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(bue,{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):KF():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 xue="reshape",Eqe=["typed","isInteger","matrix"],JF=V(xue,Eqe,e=>{var{typed:t,isInteger:r}=e;return t(xue,{"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)}),L6(i,a)}})});var kqe="resize",Cqe=["config","matrix"],e3=V(kqe,Cqe,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 ar(a.length,1);var s=a[0];if(typeof s!="number"||!wt(s))throw new TypeError("Invalid size, must contain positive integers (size: "+rr(a)+")");if(i.length>s)return i.substring(0,s);if(i.length{var{typed:t,multiply:r,rotationMatrix:n}=e;return t(wue,{"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)?Qt(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 Sue="rotationMatrix",Oqe=["typed","config","multiplyScalar","addScalar","unaryMinus","norm","matrix","BigNumber","DenseMatrix","SparseMatrix","cos","sin"],r3=V(Sue,Oqe,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(Sue,{"":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 Eue="row",Mqe=["typed","Index","matrix","range"],hS=V(Eue,Mqe,e=>{var{typed:t,Index:r,matrix:n,range:i}=e;return t(Eue,{"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");Gn(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 kue="size",jqe=["typed","config","?matrix"],n3=V(kue,jqe,e=>{var{typed:t,config:r,matrix:n}=e;return t(kue,{Matrix:function(a){return a.create(a.size())},Array:Qt,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([]):KF()}})});var Cue="squeeze",Nqe=["typed","matrix"],i3=V(Cue,Nqe,e=>{var{typed:t,matrix:r}=e;return t(Cue,{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 Due="subset",Tqe=["typed","matrix","zeros","add"],AS=V(Due,Tqe,e=>{var{typed:t,matrix:r,zeros:n,add:i}=e;return t(Due,{"Matrix, Index":function(s,l){return xy(l)?r():(q6(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":_qe,"string, Index":Fqe,"Matrix, Index, any, any":function(s,l,u,c){return xy(l)?s:(q6(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":Oue,"string, Index, string, string":Oue,"Object, Index, any":Pqe});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 Fqe(e,t){if(!Wm(t))throw new TypeError("Index expected");if(xy(t))return"";if(q6(Array.from(e),t),t.size().length!==1)throw new ar(t.size().length,1);var r=e.length;Gn(t.min()[0],r),Gn(t.max()[0],r);var n=t.dimension(0),i="";return n.forEach(function(a){i+=e.charAt(a)}),i}function Oue(e,t,r,n){if(!t||t.isIndex!==!0)throw new TypeError("Index expected");if(xy(t))return e;if(q6(Array.from(e),t),t.size().length!==1)throw new ar(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 ar(i.size()[0],r.length);var o=e.length;Gn(t.min()[0]),Gn(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(Mue,{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: "+rr(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: "+rr(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(jue,{any:function(a){return n(r(a))}})});var Nue="zeros",Rqe=["typed","config","matrix","BigNumber"],s3=V(Nue,Rqe,e=>{var{typed:t,config:r,matrix:n,BigNumber:i}=e;return t(Nue,{"":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 Tue="fft",$qe=["typed","matrix","addScalar","multiplyScalar","divideScalar","exp","tau","i","dotDivide","conj","pow","ceil","log2"],l3=V(Tue,$qe,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(Tue,{Array:h,Matrix:function(v){return v.create(h(v.toArray()))}});function h(b){var v=Qt(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=Qt(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=Qt(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(Fue,{"Array | Matrix":function(o){var s=St(o)?o.size():Qt(o);return n(i(r(i(o))),s.reduce((l,u)=>l*u,1))}})});function _ue(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 Lqe(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=Lqe({},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)||Gt(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 Wqe="erf",Hqe=["typed"],f3=V(Wqe,Hqe,e=>{var{typed:t}=e;return t("name",{number:function(o){var s=Math.abs(o);return s>=Qqe?kd(o):s<=Vqe?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=VA[0][4]*o,l=o,u;for(u=0;u<3;u+=1)s=(s+VA[0][u])*o,l=(l+gS[0][u])*o;return a*(s+VA[0][3])/(l+gS[0][3])}function n(a){var o=VA[1][8]*a,s=a,l;for(l=0;l<7;l+=1)o=(o+VA[1][l])*a,s=(s+gS[1][l])*a;var u=(o+VA[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=VA[2][5]*o,l=o,u;for(u=0;u<4;u+=1)s=(s+VA[2][u])*o,l=(l+gS[2][u])*o;var c=o*(s+VA[2][4])/(l+gS[2][4]);c=(Gqe-c)/a,o=parseInt(a*16)/16;var f=(a-o)*(a+o);return Math.exp(-o*o)*Math.exp(-f)*c}}),Vqe=.46875,Gqe=.5641895835477563,VA=[[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]],Qqe=Math.pow(2,53);var Pue="zeta",Yqe=["typed","config","multiply","pow","divide","factorial","equal","smallerEq","isNegative","gamma","sin","subtract","add","?Complex","?BigNumber","pi"],d3=V(Pue,Yqe,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(Pue,{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 Iue="mode",Zqe=["typed","isNaN","isNumeric"],p3=V(Iue,Zqe,e=>{var{typed:t,isNaN:r,isNumeric:n}=e;return t(Iue,{"Array | Matrix":i,"...":function(o){return i(o)}});function i(a){a=hr(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 Bue="prod",Xqe=["typed","config","multiplyScalar","numeric"],m3=V(Bue,Xqe,e=>{var{typed:t,config:r,multiplyScalar:n,numeric:i}=e;return t(Bue,{"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 Rue="format",Kqe=["typed"],h3=V(Rue,Kqe,e=>{var{typed:t}=e;return t(Rue,{any:rr,"any, Object | function | number | BigNumber":rr})});var $ue="bin",Jqe=["typed","format"],A3=V($ue,Jqe,e=>{var{typed:t,format:r}=e;return t($ue,{"number | BigNumber":function(i){return r(i,{notation:"bin"})},"number | BigNumber, number | BigNumber":function(i,a){return r(i,{notation:"bin",wordSize:a})}})});var que="oct",eLe=["typed","format"],g3=V(que,eLe,e=>{var{typed:t,format:r}=e;return t(que,{"number | BigNumber":function(i){return r(i,{notation:"oct"})},"number | BigNumber, number | BigNumber":function(i,a){return r(i,{notation:"oct",wordSize:a})}})});var Lue="hex",tLe=["typed","format"],v3=V(Lue,tLe,e=>{var{typed:t,format:r}=e;return t(Lue,{"number | BigNumber":function(i){return r(i,{notation:"hex"})},"number | BigNumber, number | BigNumber":function(i,a){return r(i,{notation:"hex",wordSize:a})}})});var y3=/\$([\w.]+)/g;var zue="print",rLe=["typed"],vS=V(zue,rLe,e=>{var{typed:t}=e;return t(zue,{"string, Object | Array":Uue,"string, Object | Array, number | Object":Uue})});function Uue(e,t,r){return e.replace(y3,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?ma(o)?o:rr(o,r):n})}var Wue="to",nLe=["typed","matrix","concat"],b3=V(Wue,nLe,e=>{var{typed:t,matrix:r,concat:n}=e,i=fr({typed:t,matrix:r,concat:n});return t(Wue,{"Unit, Unit | string":(a,o)=>a.to(o)},i({Ds:!0}))});var Hue="isPrime",iLe=["typed"],x3=V(Hue,iLe,e=>{var{typed:t}=e;return t(Hue,{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 aLe="numeric",oLe=["number","?bignumber","?fraction"],w3=V(aLe,oLe,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):XF};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 Vue="divideScalar",sLe=["typed","numeric"],S3=V(Vue,sLe,e=>{var{typed:t,numeric:r}=e;return t(Vue,{"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 Gue="pow",lLe=["typed","config","identity","multiply","matrix","inv","fraction","number","Complex"],E3=V(Gue,lLe,e=>{var{typed:t,config:r,identity:n,multiply:i,matrix:a,inv:o,number:s,fraction:l,Complex:u}=e;return t(Gue,{"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?IW(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=Qt(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",Que="round",uLe=["typed","config","matrix","equalScalar","zeros","BigNumber","DenseMatrix"],k3=V(Que,uLe,e=>{var{typed:t,config:r,matrix:n,equalScalar:i,zeros:a,BigNumber:o,DenseMatrix:s}=e,l=Qn({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(Que,{number:function(p){var h=tS(p,f(r.epsilon)),m=Ma(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=Ma(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 Yue="log",cLe=["config","typed","divideScalar","Complex"],C3=V(Yue,cLe,e=>{var{typed:t,config:r,divideScalar:n,Complex:i}=e;return t(Yue,{number:function(o){return o>=0||r.predictable?Kse(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 Zue="log1p",fLe=["typed","config","divideScalar","log","Complex"],D3=V(Zue,fLe,e=>{var{typed:t,config:r,divideScalar:n,log:i,Complex:a}=e;return t(Zue,{number:function(l){return l>=-1||r.predictable?sT(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 Xue="nthRoots",dLe=["config","typed","divideScalar","Complex"],O3=V(Xue,dLe,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=wi({typed:t}),l=Qo({typed:t,DenseMatrix:a}),u=Qn({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(Kue,f({elop:h,SS:l,DS:s,Ss:u,sS:c}))});var Jue="dotDivide",mLe=["typed","matrix","equalScalar","divideScalar","DenseMatrix","concat"],j3=V(Jue,mLe,e=>{var{typed:t,matrix:r,equalScalar:n,divideScalar:i,DenseMatrix:a,concat:o}=e,s=yo({typed:t,equalScalar:n}),l=wi({typed:t}),u=Qo({typed:t,DenseMatrix:a}),c=Qn({typed:t,equalScalar:n}),f=An({typed:t,DenseMatrix:a}),d=fr({typed:t,matrix:r,concat:o});return t(Jue,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: "+rr(o)+")");var s=o[0],l=o[1];if(s!==l)throw new RangeError("Matrix must be square (size: "+rr(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(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.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(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.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(rce,{"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 nce="usolveAll",vLe=["typed","matrix","divideScalar","multiplyScalar","subtractScalar","equalScalar","DenseMatrix"],_3=V(nce,vLe,e=>{var{typed:t,matrix:r,divideScalar:n,multiplyScalar:i,subtractScalar:a,equalScalar:o,DenseMatrix:s}=e,l=Zm({DenseMatrix:s});return t(nce,{"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 yLe="matAlgo08xS0Sid",bLe=["typed","equalScalar"],bS=V(yLe,bLe,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 ar(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 ice="leftShift",xLe=["typed","matrix","equalScalar","zeros","DenseMatrix","concat"],P3=V(ice,xLe,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=Qn({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":LW,"BigNumber, BigNumber":Qle,"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="rightArithShift",wLe=["typed","matrix","equalScalar","zeros","DenseMatrix","concat"],I3=V(ace,wLe,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=Qn({typed:t,equalScalar:n}),d=vo({typed:t}),p=fr({typed:t,matrix:r,concat:o}),h=xS({typed:t,matrix:r});return t(ace,{"number, number":zW,"BigNumber, BigNumber":Yle,"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 oce="rightLogShift",SLe=["typed","matrix","equalScalar","zeros","DenseMatrix","concat"],B3=V(oce,SLe,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=Qn({typed:t,equalScalar:n}),d=vo({typed:t}),p=fr({typed:t,matrix:r,concat:o}),h=xS({typed:t,matrix:r});return t(oce,{"number, number":UW,"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 sce="and",ELe=["typed","matrix","equalScalar","zeros","not","concat"],wS=V(sce,ELe,e=>{var{typed:t,matrix:r,equalScalar:n,zeros:i,not:a,concat:o}=e,s=yo({typed:t,equalScalar:n}),l=X0({typed:t,equalScalar:n}),u=Qn({typed:t,equalScalar:n}),c=vo({typed:t}),f=fr({typed:t,matrix:r,concat:o});return t(sce,{"number, number":YW,"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 R3="compare",kLe=["typed","config","matrix","equalScalar","BigNumber","Fraction","DenseMatrix","concat"],$3=V(R3,kLe,e=>{var{typed:t,config:r,equalScalar:n,matrix:i,BigNumber:a,Fraction:o,DenseMatrix:s,concat:l}=e,u=wi({typed:t}),c=Z0({typed:t,equalScalar:n}),f=An({typed:t,DenseMatrix:s}),d=fr({typed:t,matrix:i,concat:l}),p=Dd({typed:t});return t(R3,CLe({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}))}),CLe=V(R3,["typed","config"],e=>{var{typed:t,config:r}=e;return t(R3,{"number, number":function(i,a){return Ma(i,a,r.epsilon)?0:i>a?1:-1}})});var Dy=Ae(uce(),1);var cce="compareNatural",DLe=["typed","compare"],q3=V(cce,DLe,e=>{var{typed:t,compare:r}=e,n=r.signatures["boolean,boolean"];return t(cce,{"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,Dy.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,Dy.default)(c,f);if(c!==f)return(0,Dy.default)(c,f);if(c==="Complex")return OLe(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,Dy.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()):LA(u)?a(l,u.toJSON().data,c):LA(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(fce,fT,i({elop:fT,Ds:!0}))});var z3="equal",jLe=["typed","matrix","equalScalar","DenseMatrix","concat"],U3=V(z3,jLe,e=>{var{typed:t,matrix:r,equalScalar:n,DenseMatrix:i,concat:a}=e,o=wi({typed:t}),s=Qo({typed:t,DenseMatrix:i}),l=An({typed:t,DenseMatrix:i}),u=fr({typed:t,matrix:r,concat:a});return t(z3,NLe({typed:t,equalScalar:n}),u({elop:n,SS:s,DS:o,Ss:l}))}),NLe=V(z3,["typed","equalScalar"],e=>{var{typed:t,equalScalar:r}=e;return t(z3,{"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="equalText",TLe=["typed","compareText","isZero"],W3=V(dce,TLe,e=>{var{typed:t,compareText:r,isZero:n}=e;return t(dce,{"any, any":function(a,o){return n(r(a,o))}})});var H3="smaller",FLe=["typed","config","matrix","DenseMatrix","concat"],V3=V(H3,FLe,e=>{var{typed:t,config:r,matrix:n,DenseMatrix:i,concat:a}=e,o=wi({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(H3,_Le({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}))}),_Le=V(H3,["typed","config"],e=>{var{typed:t,config:r}=e;return t(H3,{"number, number":function(i,a){return i{var{typed:t,config:r,matrix:n,DenseMatrix:i,concat:a}=e,o=wi({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(G3,ILe({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}))}),ILe=V(G3,["typed","config"],e=>{var{typed:t,config:r}=e;return t(G3,{"number, number":function(i,a){return i<=a||Ma(i,a,r.epsilon)}})});var Y3="larger",BLe=["typed","config","matrix","DenseMatrix","concat"],Z3=V(Y3,BLe,e=>{var{typed:t,config:r,matrix:n,DenseMatrix:i,concat:a}=e,o=wi({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(Y3,RLe({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}))}),RLe=V(Y3,["typed","config"],e=>{var{typed:t,config:r}=e;return t(Y3,{"number, number":function(i,a){return i>a&&!Ma(i,a,r.epsilon)}})});var X3="largerEq",$Le=["typed","config","matrix","DenseMatrix","concat"],K3=V(X3,$Le,e=>{var{typed:t,config:r,matrix:n,DenseMatrix:i,concat:a}=e,o=wi({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(X3,qLe({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}))}),qLe=V(X3,["typed","config"],e=>{var{typed:t,config:r}=e;return t(X3,{"number, number":function(i,a){return i>=a||Ma(i,a,r.epsilon)}})});var pce="deepEqual",LLe=["typed","equal"],J3=V(pce,LLe,e=>{var{typed:t,equal:r}=e;return t(pce,{"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=wi({typed:t}),l=Qo({typed:t,DenseMatrix:a}),u=An({typed:t,DenseMatrix:a}),c=fr({typed:t,matrix:i,concat:o});return t(e_,ULe({typed:t,equalScalar:n}),c({elop:f,SS:l,DS:s,Ss:u}));function f(d,p){return!n(d,p)}}),ULe=V(e_,["typed","equalScalar"],e=>{var{typed:t,equalScalar:r}=e;return t(e_,{"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 mce="partitionSelect",WLe=["typed","isNumeric","isNaN","compare"],r_=V(mce,WLe,e=>{var{typed:t,isNumeric:r,isNaN:n,compare:i}=e,a=i,o=(u,c)=>-i(u,c);return t(mce,{"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 hce="sort",HLe=["typed","matrix","compare","compareNatural"],n_=V(hce,HLe,e=>{var{typed:t,matrix:r,compare:n,compareNatural:i}=e,a=n,o=(c,f)=>-n(c,f);return t(hce,{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(Qt(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 Ace="max",VLe=["typed","config","numeric","larger"],SS=V(Ace,VLe,e=>{var{typed:t,config:r,numeric:n,larger:i}=e;return t(Ace,{"Array | Matrix":o,"Array | Matrix, number | BigNumber":function(l,u){return Q0(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 gce="min",GLe=["typed","config","numeric","smaller"],ES=V(gce,GLe,e=>{var{typed:t,config:r,numeric:n,smaller:i}=e;return t(gce,{"Array | Matrix":o,"Array | Matrix, number | BigNumber":function(l,u){return Q0(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 QLe="ImmutableDenseMatrix",YLe=["smaller","DenseMatrix"],i_=V(QLe,YLe,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&&!ma(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 ZLe="Index",XLe=["ImmutableDenseMatrix","getMatrixDataType"],a_=V(ZLe,XLe,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 KLe="FibonacciHeap",JLe=["smaller","larger"],o_=V(KLe,JLe,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)||ps(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)&&gse(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&&ps(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&&ps(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=Z6(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(Sce,{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 Ece="sparse",aze=["typed","SparseMatrix"],f_=V(Ece,aze,e=>{var{typed:t,SparseMatrix:r}=e;return t(Ece,{"":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 kce="createUnit",oze=["typed","Unit"],d_=V(kce,oze,e=>{var{typed:t,Unit:r}=e;return t(kce,{"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 Cce="acos",sze=["typed","config","Complex"],p_=V(Cce,sze,e=>{var{typed:t,config:r,Complex:n}=e;return t(Cce,{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 Dce="acosh",lze=["typed","config","Complex"],m_=V(Dce,lze,e=>{var{typed:t,config:r,Complex:n}=e;return t(Dce,{number:function(a){return a>=1||r.predictable?KW(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 Oce="acot",uze=["typed","BigNumber"],h_=V(Oce,uze,e=>{var{typed:t,BigNumber:r}=e;return t(Oce,{number:JW,Complex:function(i){return i.acot()},BigNumber:function(i){return new r(1).div(i).atan()}})});var Mce="acoth",cze=["typed","config","Complex","BigNumber"],A_=V(Mce,cze,e=>{var{typed:t,config:r,Complex:n,BigNumber:i}=e;return t(Mce,{number:function(o){return o>=1||o<=-1||r.predictable?eH(o):new n(o,0).acoth()},Complex:function(o){return o.acoth()},BigNumber:function(o){return new i(1).div(o).atanh()}})});var jce="acsc",fze=["typed","config","Complex","BigNumber"],g_=V(jce,fze,e=>{var{typed:t,config:r,Complex:n,BigNumber:i}=e;return t(jce,{number:function(o){return o<=-1||o>=1||r.predictable?tH(o):new n(o,0).acsc()},Complex:function(o){return o.acsc()},BigNumber:function(o){return new i(1).div(o).asin()}})});var Nce="acsch",dze=["typed","BigNumber"],v_=V(Nce,dze,e=>{var{typed:t,BigNumber:r}=e;return t(Nce,{number:rH,Complex:function(i){return i.acsch()},BigNumber:function(i){return new r(1).div(i).asinh()}})});var Tce="asec",pze=["typed","config","Complex","BigNumber"],y_=V(Tce,pze,e=>{var{typed:t,config:r,Complex:n,BigNumber:i}=e;return t(Tce,{number:function(o){return o<=-1||o>=1||r.predictable?nH(o):new n(o,0).asec()},Complex:function(o){return o.asec()},BigNumber:function(o){return new i(1).div(o).acos()}})});var Fce="asech",mze=["typed","config","Complex","BigNumber"],b_=V(Fce,mze,e=>{var{typed:t,config:r,Complex:n,BigNumber:i}=e;return t(Fce,{number:function(o){if(o<=1&&o>=-1||r.predictable){var s=1/o;if(s>0||r.predictable)return iH(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 _ce="asin",hze=["typed","config","Complex"],x_=V(_ce,hze,e=>{var{typed:t,config:r,Complex:n}=e;return t(_ce,{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 Aze="asinh",gze=["typed"],w_=V(Aze,gze,e=>{var{typed:t}=e;return t("asinh",{number:aH,Complex:function(n){return n.asinh()},BigNumber:function(n){return n.asinh()}})});var vze="atan",yze=["typed"],S_=V(vze,yze,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 Pce="atan2",bze=["typed","matrix","equalScalar","BigNumber","DenseMatrix","concat"],E_=V(Pce,bze,e=>{var{typed:t,matrix:r,equalScalar:n,BigNumber:i,DenseMatrix:a,concat:o}=e,s=yo({typed:t,equalScalar:n}),l=wi({typed:t}),u=MF({typed:t,equalScalar:n}),c=Qn({typed:t,equalScalar:n}),f=An({typed:t,DenseMatrix:a}),d=fr({typed:t,matrix:r,concat:o});return t(Pce,{"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 Ice="atanh",xze=["typed","config","Complex"],k_=V(Ice,xze,e=>{var{typed:t,config:r,Complex:n}=e;return t(Ice,{number:function(a){return a<=1&&a>=-1||r.predictable?oH(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 Bce="cos",wze=["typed"],C_=V(Bce,wze,e=>{var{typed:t}=e,r=Md({typed:t});return t(Bce,{number:Math.cos,"Complex | BigNumber":n=>n.cos()},r)});var Rce="cosh",Sze=["typed"],D_=V(Rce,Sze,e=>{var{typed:t}=e;return t(Rce,{number:uT,"Complex | BigNumber":r=>r.cosh()})});var $ce="cot",Eze=["typed","BigNumber"],O_=V($ce,Eze,e=>{var{typed:t,BigNumber:r}=e,n=Md({typed:t});return t($ce,{number:sH,Complex:i=>i.cot(),BigNumber:i=>new r(1).div(i.tan())},n)});var qce="coth",kze=["typed","BigNumber"],M_=V(qce,kze,e=>{var{typed:t,BigNumber:r}=e;return t(qce,{number:lH,Complex:n=>n.coth(),BigNumber:n=>new r(1).div(n.tanh())})});var Lce="csc",Cze=["typed","BigNumber"],j_=V(Lce,Cze,e=>{var{typed:t,BigNumber:r}=e,n=Md({typed:t});return t(Lce,{number:uH,Complex:i=>i.csc(),BigNumber:i=>new r(1).div(i.sin())},n)});var zce="csch",Dze=["typed","BigNumber"],N_=V(zce,Dze,e=>{var{typed:t,BigNumber:r}=e;return t(zce,{number:cH,Complex:n=>n.csch(),BigNumber:n=>new r(1).div(n.sinh())})});var Uce="sec",Oze=["typed","BigNumber"],T_=V(Uce,Oze,e=>{var{typed:t,BigNumber:r}=e,n=Md({typed:t});return t(Uce,{number:fH,Complex:i=>i.sec(),BigNumber:i=>new r(1).div(i.cos())},n)});var Wce="sech",Mze=["typed","BigNumber"],F_=V(Wce,Mze,e=>{var{typed:t,BigNumber:r}=e;return t(Wce,{number:dH,Complex:n=>n.sech(),BigNumber:n=>new r(1).div(n.cosh())})});var Hce="sin",jze=["typed"],__=V(Hce,jze,e=>{var{typed:t}=e,r=Md({typed:t});return t(Hce,{number:Math.sin,"Complex | BigNumber":n=>n.sin()},r)});var Vce="sinh",Nze=["typed"],P_=V(Vce,Nze,e=>{var{typed:t}=e;return t(Vce,{number:pH,"Complex | BigNumber":r=>r.sinh()})});var Gce="tan",Tze=["typed"],I_=V(Gce,Tze,e=>{var{typed:t}=e,r=Md({typed:t});return t(Gce,{number:Math.tan,"Complex | BigNumber":n=>n.tan()},r)});var Fze="tanh",_ze=["typed"],B_=V(Fze,_ze,e=>{var{typed:t}=e;return t("tanh",{number:cT,"Complex | BigNumber":r=>r.tanh()})});var Qce="setCartesian",Pze=["typed","size","subset","compareNatural","Index","DenseMatrix"],R_=V(Qce,Pze,e=>{var{typed:t,size:r,subset:n,compareNatural:i,Index:a,DenseMatrix:o}=e;return t(Qce,{"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=hr(Array.isArray(l)?l:l.toArray()).sort(i),d=hr(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(Yce,{"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 hr(l.toArray());var f=zA(hr(Array.isArray(l)?l:l.toArray()).sort(i)),d=zA(hr(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(Zce,{"Array | Matrix":function(l){var u;if(n(r(l),new a(0))===0)u=[];else{var c=hr(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(Xce,{"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=zA(hr(Array.isArray(l)?l:l.toArray()).sort(i)),d=zA(hr(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(Kce,{"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=zA(hr(Array.isArray(s)?s:s.toArray()).sort(i)),c=zA(hr(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(Jce,{"number | BigNumber | Fraction | Complex, Array | Matrix":function(s,l){if(n(r(l),new a(0))===0)return 0;for(var u=hr(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(efe,{"Array | Matrix":function(u){if(n(r(u),new a(0))===0)return[];for(var c=hr(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 tfe="setSize",zze=["typed","compareNatural"],H_=V(tfe,zze,e=>{var{typed:t,compareNatural:r}=e;return t(tfe,{"Array | Matrix":function(i){return Array.isArray(i)?hr(i).length:hr(i.toArray()).length},"Array | Matrix, boolean":function(i,a){if(a===!1||i.length===0)return Array.isArray(i)?hr(i).length:hr(i.toArray()).length;for(var o=hr(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(rfe,{"Array | Matrix, Array | Matrix":function(l,u){if(i(r(l),new o(0))===0)return hr(u);if(i(r(u),new o(0))===0)return hr(l);var c=hr(l),f=hr(u);return n(a(c,f),a(f,c))}})});var nfe="setUnion",Wze=["typed","size","concat","subset","setIntersect","setSymDifference","Index"],G_=V(nfe,Wze,e=>{var{typed:t,size:r,concat:n,subset:i,setIntersect:a,setSymDifference:o,Index:s}=e;return t(nfe,{"Array | Matrix, Array | Matrix":function(u,c){if(i(r(u),new s(0))===0)return hr(c);if(i(r(c),new s(0))===0)return hr(u);var f=hr(u),d=hr(c);return n(o(f,d),a(f,d))}})});var ife="add",Hze=["typed","matrix","addScalar","equalScalar","DenseMatrix","SparseMatrix","concat"],Q_=V(ife,Hze,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(ife,{"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(afe,{"... number | BigNumber":u,Array:u,Matrix:c=>u(hr(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(ofe,{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 sfe="dot",Qze=["typed","addScalar","multiplyScalar","conj","size"],X_=V(sfe,Qze,e=>{var{typed:t,addScalar:r,multiplyScalar:n,conj:i,size:a}=e;return t(sfe,{"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 Yze="trace",Zze=["typed","matrix","add"],K_=V(Yze,Zze,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: "+rr(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: "+rr(c)+")")}});var lfe="index",Xze=["typed","Index"],J_=V(lfe,Xze,e=>{var{typed:t,Index:r}=e;return t(lfe,{"...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 e4=new Set(["end"]);var Kze="Node",Jze=["mathWithTransform"],t4=V(Kze,Jze,e=>{var{mathWithTransform:t}=e;function r(i){for(var a of[...e4])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=UA(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 Si(e){return e&&e.isIndexError?new gs(e.index+1,e.min+1,e.max!==void 0?e.max+1:void 0):e}function r4(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 Xi(n,i.getObjectProperty())}else throw new TypeError("Cannot apply index: unsupported type of object")}catch(a){throw Si(a)}}}var n4="AccessorNode",eUe=["subset","Node"],i4=V(n4,eUe,e=>{var{subset:t,Node:r}=e,n=r4({subset:t});function i(o){return!(zu(o)||ms(o)||vr(o)||xl(o)||Vm(o)||hs(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 n4}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 Xi(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:n4,object:this.object,index:this.index}}static fromJSON(s){return new a(s.object,s.index)}}return yn(a,"name",n4),a},{isClass:!0,isNode:!0});var a4="ArrayNode",tUe=["Node"],o4=V(a4,tUe,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 a4}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(ms)&&!o.every(ms),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",a4),r},{isClass:!0,isNode:!0});function ufe(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 Si(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 s4(e,t){if(!t||t!=="auto")return e;for(var r=e;hs(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=r4({subset:t}),a=ufe({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)&&!zu(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 u4}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=Xi(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:u4,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",u4),s},{isClass:!0,isNode:!0});var f4="BlockNode",nUe=["ResultSet","Node"],d4=V(f4,nUe,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 f4}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 L0(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?rr(this._values[k],m):"X")}return v},i.prototype.toString=function(){return rr(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()),!Gt(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 wRe="number",SRe=["typed"];function ERe(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 kRe(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=ERe(i);if(a)return kRe(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 dle="string",CRe=["typed"],QT=V(dle,CRe,e=>{var{typed:t}=e;return t(dle,{"":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 ple="boolean",DRe=["typed"],YT=V(ple,DRe,e=>{var{typed:t}=e;return t(ple,{"":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 ORe="bignumber",MRe=["typed","BigNumber"],ZT=V(ORe,MRe,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 jRe="complex",NRe=["typed","Complex"],XT=V(jRe,NRe,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 TRe="fraction",FRe=["typed","Fraction"],KT=V(TRe,FRe,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 mle="matrix",_Re=["typed","Matrix","DenseMatrix","SparseMatrix"],JT=V(mle,_Re,e=>{var{typed:t,Matrix:r,DenseMatrix:n,SparseMatrix:i}=e;return t(mle,{"":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 hle="matrixFromFunction",PRe=["typed","matrix","isZero"],eF=V(hle,PRe,e=>{var{typed:t,matrix:r,isZero:n}=e;return t(hle,{"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 Ale="matrixFromRows",IRe=["typed","matrix","flatten","size"],tF=V(Ale,IRe,e=>{var{typed:t,matrix:r,flatten:n,size:i}=e;return t(Ale,{"...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 gle="matrixFromColumns",BRe=["typed","matrix","flatten","size"],rF=V(gle,BRe,e=>{var{typed:t,matrix:r,flatten:n,size:i}=e;return t(gle,{"...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(vle,{"Unit, Array":function(n,i){return n.splitUnit(i)}})});var yle="unaryMinus",$Re=["typed"],iF=V(yle,$Re,e=>{var{typed:t}=e;return t(yle,{number:DW,"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 ble="unaryPlus",qRe=["typed","config","BigNumber"],aF=V(ble,qRe,e=>{var{typed:t,config:r,BigNumber:n}=e;return t(ble,{number:OW,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 xle="abs",LRe=["typed"],oF=V(xle,LRe,e=>{var{typed:t}=e;return t(xle,{number:SW,"Complex | BigNumber | Fraction | Unit":r=>r.abs(),"Array | Matrix":t.referToSelf(r=>n=>jt(n,r,!0))})});var wle="apply",zRe=["typed","isInteger"],Y0=V(wle,zRe,e=>{var{typed:t,isInteger:r}=e;return t(wle,{"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)?Qt(i):i.size();if(a<0||a>=s.length)throw new gs(a,s.length);return St(i)?i.create(sF(i.valueOf(),a,o)):sF(i,a,o)}})});function sF(e,t,r){var n,i,a;if(t<=0)if(Array.isArray(e[0])){for(a=URe(e),i=[],n=0;n{var{typed:t}=e;return t(Sle,{"number, number":EW,"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 Ele="subtractScalar",HRe=["typed"],uF=V(Ele,HRe,e=>{var{typed:t}=e;return t(Ele,{"number, number":kW,"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 kle="cbrt",VRe=["config","typed","isNegative","unaryMinus","matrix","Complex","BigNumber","Fraction"],cF=V(kle,VRe,e=>{var{config:t,typed:r,isNegative:n,unaryMinus:i,matrix:a,Complex:o,BigNumber:s,Fraction:l}=e;return r(kle,{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&&ps(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 GRe="matAlgo11xS0s",QRe=["typed","equalScalar"],Qn=V(GRe,QRe,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(bH,{number:function(a){return Ma(a,n(a),r.epsilon)?n(a):Math.ceil(a)},"number, number":function(a,o){if(Ma(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))}})}),fF=V(bH,JRe,e=>{var{typed:t,config:r,round:n,matrix:i,equalScalar:a,zeros:o,DenseMatrix:s}=e,l=Qn({typed:t,equalScalar:a}),u=An({typed:t,DenseMatrix:s}),c=vo({typed:t}),f=e$e({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(),Ey.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 Cle="cube",t$e=["typed"],dF=V(Cle,t$e,e=>{var{typed:t}=e;return t(Cle,{number:MW,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 Dle="exp",r$e=["typed"],pF=V(Dle,r$e,e=>{var{typed:t}=e;return t(Dle,{number:jW,Complex:function(n){return n.exp()},BigNumber:function(n){return n.exp()}})});var Ole="expm1",n$e=["typed","Complex"],mF=V(Ole,n$e,e=>{var{typed:t,Complex:r}=e;return t(Ole,{number:NW,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 xH="fix",i$e=["typed","Complex","matrix","ceil","floor","equalScalar","zeros","DenseMatrix"],a$e=V(xH,["typed","ceil","floor"],e=>{var{typed:t,ceil:r,floor:n}=e;return t(xH,{number:function(a){return a>0?n(a):r(a)},"number, number":function(a,o){return a>0?n(a,o):r(a,o)}})}),hF=V(xH,i$e,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=a$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 wH="floor",o$e=["typed","config","round","matrix","equalScalar","zeros","DenseMatrix"],s$e=V(wH,["typed","config","round"],e=>{var{typed:t,config:r,round:n}=e;return t(wH,{number:function(a){return Ma(a,n(a),r.epsilon)?n(a):Math.floor(a)},"number, number":function(a,o){if(Ma(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(wH,o$e,e=>{var{typed:t,config:r,round:n,matrix:i,equalScalar:a,zeros:o,DenseMatrix:s}=e,l=Qn({typed:t,equalScalar:a}),u=An({typed:t,DenseMatrix:s}),c=vo({typed:t}),f=s$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(),Ey.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 l$e="matAlgo02xDS0",u$e=["typed","equalScalar"],yo=V(l$e,u$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 ar(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 ar(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 ar(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 ar(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=Mle({typed:t}),a=vo({typed:t}),o=jle({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&&nT(f,u.signatures),f}});var Nle="mod",b$e=["typed","config","round","matrix","equalScalar","zeros","DenseMatrix","concat"],iS=V(Nle,b$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=wi({typed:t}),d=Z0({typed:t,equalScalar:a}),p=Qn({typed:t,equalScalar:a}),h=An({typed:t,DenseMatrix:s}),m=fr({typed:t,matrix:i,concat:l});return t(Nle,{"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 x$e="matAlgo01xDSid",w$e=["typed"],ou=V(x$e,w$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 ar(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 ar(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 AF=V(Tle,D$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(Tle,{"number, number":m,"BigNumber, BigNumber":g,"Fraction, Fraction":(A,b)=>A.gcd(b)},h({SS:d,DS:f,Ss:p}),{[O$e]:t.referToSelf(A=>(b,v,x)=>{for(var w=A(b,v),S=0;Sb=>{if(b.length===1&&Array.isArray(b[0])&&Fle(b[0]))return A(...b[0]);if(Fle(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 M$e="matAlgo06xS0S0",j$e=["typed","equalScalar"],X0=V(M$e,j$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 ar(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=X0({typed:t,equalScalar:n}),s=Qn({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 Ple="log10",T$e=["typed","config","Complex"],vF=V(Ple,T$e,e=>{var{typed:t,config:r,Complex:n}=e;return t(Ple,{number:function(a){return a>=0||r.predictable?FW(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 Ile="log2",F$e=["typed","config","Complex"],yF=V(Ile,F$e,e=>{var{typed:t,config:r,Complex:n}=e;return t(Ile,{number:function(o){return o>=0||r.predictable?_W(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 _$e="multiplyScalar",P$e=["typed"],bF=V(_$e,P$e,e=>{var{typed:t}=e;return t("multiplyScalar",{"number, number":CW,"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 Ble="multiply",I$e=["typed","matrix","addScalar","multiplyScalar","equalScalar","dot"],xF=V(Ble,I$e,e=>{var{typed:t,matrix:r,addScalar:n,multiplyScalar:i,equalScalar:a,dot:o}=e,s=Qn({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(Qt(S),Qt(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=X0({typed:t,equalScalar:n}),u=Qn({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(Rle,{number:PW,"number, number":PW,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 $le="sign",R$e=["typed","BigNumber","Fraction","complex"],SF=V($le,R$e,e=>{var{typed:t,BigNumber:r,complex:n,Fraction:i}=e;return t($le,{number:IT,Complex:function(o){return o.im===0?n(IT(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",q$e=["config","typed","Complex"],EF=V($$e,q$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 qle="square",L$e=["typed"],kF=V(qle,L$e,e=>{var{typed:t}=e;return t(qle,{number:IW,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 Lle="subtract",z$e=["typed","matrix","equalScalar","subtractScalar","unaryMinus","DenseMatrix","concat"],CF=V(Lle,z$e,e=>{var{typed:t,matrix:r,equalScalar:n,subtractScalar:i,unaryMinus:a,DenseMatrix:o,concat:s}=e,l=ou({typed:t}),u=wi({typed:t}),c=Z0({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(Lle,{"any, any":i},p({elop:i,SS:c,DS:l,SD:u,Ss:d,sS:f}))});var zle="xgcd",U$e=["typed","config","matrix","BigNumber"],DF=V(zle,U$e,e=>{var{typed:t,config:r,matrix:n,BigNumber:i}=e;return t(zle,{"number, number":function(s,l){var u=BW(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 Ule="invmod",W$e=["typed","config","BigNumber","xgcd","equal","smaller","mod","add","isInteger"],OF=V(Ule,W$e,e=>{var{typed:t,config:r,BigNumber:n,xgcd:i,equal:a,smaller:o,mod:s,add:l,isInteger:u}=e;return t(Ule,{"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 H$e="matAlgo09xS0Sf",V$e=["typed","equalScalar"],MF=V(H$e,V$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 ar(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=MF({typed:t,equalScalar:n}),l=Qn({typed:t,equalScalar:n}),u=fr({typed:t,matrix:r,concat:a});return t(Wle,u({elop:i,SS:s,DS:o,Ss:l}))});function Hle(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 EH(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 Vle(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:EH(e,t,function(i,a){return i|a})}function EH(e,t,r){var n=e.constructor,i,a,o=+(e.s<0),s=+(t.s<0);if(o){i=NF(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 NF(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 Gle(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):EH(e,t,function(i,a){return i^a})}function Qle(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 Yle(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 Zle="bitAnd",Q$e=["typed","matrix","equalScalar","concat"],sS=V(Zle,Q$e,e=>{var{typed:t,matrix:r,equalScalar:n,concat:i}=e,a=yo({typed:t,equalScalar:n}),o=X0({typed:t,equalScalar:n}),s=Qn({typed:t,equalScalar:n}),l=fr({typed:t,matrix:r,concat:i});return t(Zle,{"number, number":$W,"BigNumber, BigNumber":Hle},l({SS:o,DS:a,Ss:s}))});var Xle="bitNot",Y$e=["typed"],TF=V(Xle,Y$e,e=>{var{typed:t}=e;return t(Xle,{number:qW,BigNumber:oS,"Array | Matrix":t.referToSelf(r=>n=>jt(n,r))})});var Kle="bitOr",Z$e=["typed","matrix","equalScalar","DenseMatrix","concat"],lS=V(Kle,Z$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(Kle,{"number, number":LW,"BigNumber, BigNumber":Vle},u({SS:s,DS:o,Ss:l}))});var X$e="matAlgo07xSSf",K$e=["typed","DenseMatrix"],Qo=V(X$e,K$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 ar(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=wi({typed:t}),o=Qo({typed:t,DenseMatrix:n}),s=An({typed:t,DenseMatrix:n}),l=fr({typed:t,matrix:r,concat:i});return t(Jle,{"number, number":zW,"BigNumber, BigNumber":Gle},l({SS:o,DS:a,Ss:s}))});var eue="arg",eqe=["typed"],_F=V(eue,eqe,e=>{var{typed:t}=e;return t(eue,{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 tue="conj",tqe=["typed"],PF=V(tue,tqe,e=>{var{typed:t}=e;return t(tue,{"number | BigNumber | Fraction":r=>r,Complex:r=>r.conjugate(),"Array | Matrix":t.referToSelf(r=>n=>jt(n,r))})});var rue="im",rqe=["typed"],IF=V(rue,rqe,e=>{var{typed:t}=e;return t(rue,{number:()=>0,"BigNumber | Fraction":r=>r.mul(0),Complex:r=>r.im,"Array | Matrix":t.referToSelf(r=>n=>jt(n,r))})});var nue="re",nqe=["typed"],BF=V(nue,nqe,e=>{var{typed:t}=e;return t(nue,{"number | BigNumber | Fraction":r=>r,Complex:r=>r.re,"Array | Matrix":t.referToSelf(r=>n=>jt(n,r))})});var iue="not",iqe=["typed"],RF=V(iue,iqe,e=>{var{typed:t}=e;return t(iue,{"null | undefined":()=>!0,number:QW,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 aue="or",aqe=["typed","matrix","equalScalar","DenseMatrix","concat"],uS=V(aue,aqe,e=>{var{typed:t,matrix:r,equalScalar:n,DenseMatrix:i,concat:a}=e,o=wi({typed:t}),s=Z0({typed:t,equalScalar:n}),l=An({typed:t,DenseMatrix:i}),u=fr({typed:t,matrix:r,concat:a});return t(aue,{"number, number":YW,"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 oue="xor",oqe=["typed","matrix","DenseMatrix","concat"],$F=V(oue,oqe,e=>{var{typed:t,matrix:r,DenseMatrix:n,concat:i}=e,a=wi({typed:t}),o=Qo({typed:t,DenseMatrix:n}),s=An({typed:t,DenseMatrix:n}),l=fr({typed:t,matrix:r,concat:i});return t(oue,{"number, number":ZW,"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 sue="concat",sqe=["typed","matrix","isInteger"],cS=V(sue,sqe,e=>{var{typed:t,matrix:r,isInteger:n}=e;return t(sue,{"...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 gs(l,u+1)}else{var p=Bt(d).valueOf(),h=Qt(p);if(f[o]=p,u=l,l=h.length-1,o>0&&l!==u)throw new ar(u+1,l+1)}}if(f.length===0)throw new SyntaxError("At least one matrix expected");for(var m=f.shift();f.length;)m=sW(m,f.shift(),l);return c?r(m):m},"...string":function(a){return a.join("")}})});var lue="column",lqe=["typed","Index","matrix","range"],fS=V(lue,lqe,e=>{var{typed:t,Index:r,matrix:n,range:i}=e;return t(lue,{"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");Gn(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 uue="count",uqe=["typed","size","prod"],qF=V(uue,uqe,e=>{var{typed:t,size:r,prod:n}=e;return t(uue,{string:function(a){return a.length},"Matrix | Array":function(a){return n(r(a))}})});var cue="cross",cqe=["typed","matrix","subtract","multiply"],LF=V(cue,cqe,e=>{var{typed:t,matrix:r,subtract:n,multiply:i}=e;return t(cue,{"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(Qt(o).length,Qt(s).length);o=Qw(o),s=Qw(s);var u=Qt(o),c=Qt(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 fue="diag",fqe=["typed","matrix","DenseMatrix","SparseMatrix"],zF=V(fue,fqe,e=>{var{typed:t,matrix:r,DenseMatrix:n,SparseMatrix:i}=e;return t(fue,{Array:function(u){return a(u,0,Qt(u),null)},"Array, number":function(u,c){return a(u,c,Qt(u),null)},"Array, BigNumber":function(u,c){return a(u,c.toNumber(),Qt(u),null)},"Array, string":function(u,c){return a(u,0,Qt(u),c)},"Array, number, string":function(u,c,f){return a(u,c,Qt(u),f)},"Array, BigNumber, string":function(u,c,f){return a(u,c.toNumber(),Qt(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 dqe="filter",pqe=["typed"],UF=V(dqe,pqe,e=>{var{typed:t}=e;return t("filter",{"Array, function":due,"Matrix, function":function(n,i){return n.create(due(n.toArray(),i))},"Array, RegExp":Yw,"Matrix, RegExp":function(n,i){return n.create(Yw(n.toArray(),i))}})});function due(e,t){return pT(e,function(r,n,i){return Od(t,r,[n],i,"filter")})}var pue="flatten",mqe=["typed","matrix"],WF=V(pue,mqe,e=>{var{typed:t,matrix:r}=e;return t(pue,{Array:function(i){return hr(i)},Matrix:function(i){var a=hr(i.toArray());return r(a)}})});var mue="forEach",hqe=["typed"],HF=V(mue,hqe,e=>{var{typed:t}=e;return t(mue,{"Array, function":Aqe,"Matrix, function":function(n,i){n.forEach(i)}})});function Aqe(e,t){var r=function n(i,a){if(Array.isArray(i))L0(i,function(o,s){n(o,a.concat(s))});else return Od(t,i,a,e,"forEach")};r(e,[])}var hue="getMatrixDataType",gqe=["typed"],VF=V(hue,gqe,e=>{var{typed:t}=e;return t(hue,{Array:function(n){return z0(n,qr)},Matrix:function(n){return n.getDataType()}})});var Aue="identity",vqe=["typed","config","matrix","BigNumber","DenseMatrix","SparseMatrix"],GF=V(Aue,vqe,e=>{var{typed:t,config:r,matrix:n,BigNumber:i,DenseMatrix:a,SparseMatrix:o}=e;return t(Aue,{"":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(gue,{"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(Qt(a).length===1&&(a=[a]),Qt(o).length===1&&(o=[o]),Qt(a).length>2||Qt(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 vue="map",bqe=["typed"],YF=V(vue,bqe,e=>{var{typed:t}=e;return t(vue,{"Array, function":xqe,"Matrix, function":function(n,i){return n.map(i)}})});function xqe(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 yue="diff",wqe=["typed","matrix","subtract","number"],dS=V(yue,wqe,e=>{var{typed:t,matrix:r,subtract:n,number:i}=e;return t(yue,{"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 XF(){throw new Error('No "fraction" implementation available')}function KF(){throw new Error('No "matrix" implementation available')}var bue="range",kqe=["typed","config","?matrix","?bignumber","smaller","smallerEq","larger","largerEq","add","isPositive"],mS=V(bue,kqe,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(bue,{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):KF():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 xue="reshape",Cqe=["typed","isInteger","matrix"],JF=V(xue,Cqe,e=>{var{typed:t,isInteger:r}=e;return t(xue,{"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)}),L6(i,a)}})});var Dqe="resize",Oqe=["config","matrix"],e3=V(Dqe,Oqe,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 ar(a.length,1);var s=a[0];if(typeof s!="number"||!wt(s))throw new TypeError("Invalid size, must contain positive integers (size: "+rr(a)+")");if(i.length>s)return i.substring(0,s);if(i.length{var{typed:t,multiply:r,rotationMatrix:n}=e;return t(wue,{"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)?Qt(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 Sue="rotationMatrix",jqe=["typed","config","multiplyScalar","addScalar","unaryMinus","norm","matrix","BigNumber","DenseMatrix","SparseMatrix","cos","sin"],r3=V(Sue,jqe,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(Sue,{"":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 Eue="row",Nqe=["typed","Index","matrix","range"],hS=V(Eue,Nqe,e=>{var{typed:t,Index:r,matrix:n,range:i}=e;return t(Eue,{"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");Gn(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 kue="size",Tqe=["typed","config","?matrix"],n3=V(kue,Tqe,e=>{var{typed:t,config:r,matrix:n}=e;return t(kue,{Matrix:function(a){return a.create(a.size())},Array:Qt,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([]):KF()}})});var Cue="squeeze",Fqe=["typed","matrix"],i3=V(Cue,Fqe,e=>{var{typed:t,matrix:r}=e;return t(Cue,{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 Due="subset",_qe=["typed","matrix","zeros","add"],AS=V(Due,_qe,e=>{var{typed:t,matrix:r,zeros:n,add:i}=e;return t(Due,{"Matrix, Index":function(s,l){return xy(l)?r():(q6(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":Iqe,"string, Index":Pqe,"Matrix, Index, any, any":function(s,l,u,c){return xy(l)?s:(q6(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":Oue,"string, Index, string, string":Oue,"Object, Index, any":Bqe});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 Pqe(e,t){if(!Wm(t))throw new TypeError("Index expected");if(xy(t))return"";if(q6(Array.from(e),t),t.size().length!==1)throw new ar(t.size().length,1);var r=e.length;Gn(t.min()[0],r),Gn(t.max()[0],r);var n=t.dimension(0),i="";return n.forEach(function(a){i+=e.charAt(a)}),i}function Oue(e,t,r,n){if(!t||t.isIndex!==!0)throw new TypeError("Index expected");if(xy(t))return e;if(q6(Array.from(e),t),t.size().length!==1)throw new ar(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 ar(i.size()[0],r.length);var o=e.length;Gn(t.min()[0]),Gn(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(Mue,{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: "+rr(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: "+rr(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(jue,{any:function(a){return n(r(a))}})});var Nue="zeros",qqe=["typed","config","matrix","BigNumber"],s3=V(Nue,qqe,e=>{var{typed:t,config:r,matrix:n,BigNumber:i}=e;return t(Nue,{"":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 Tue="fft",Lqe=["typed","matrix","addScalar","multiplyScalar","divideScalar","exp","tau","i","dotDivide","conj","pow","ceil","log2"],l3=V(Tue,Lqe,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(Tue,{Array:h,Matrix:function(v){return v.create(h(v.toArray()))}});function h(b){var v=Qt(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=Qt(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=Qt(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(Fue,{"Array | Matrix":function(o){var s=St(o)?o.size():Qt(o);return n(i(r(i(o))),s.reduce((l,u)=>l*u,1))}})});function _ue(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 Uqe(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=Uqe({},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)||Gt(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 Vqe="erf",Gqe=["typed"],f3=V(Vqe,Gqe,e=>{var{typed:t}=e;return t("name",{number:function(o){var s=Math.abs(o);return s>=Zqe?kd(o):s<=Qqe?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=VA[0][4]*o,l=o,u;for(u=0;u<3;u+=1)s=(s+VA[0][u])*o,l=(l+gS[0][u])*o;return a*(s+VA[0][3])/(l+gS[0][3])}function n(a){var o=VA[1][8]*a,s=a,l;for(l=0;l<7;l+=1)o=(o+VA[1][l])*a,s=(s+gS[1][l])*a;var u=(o+VA[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=VA[2][5]*o,l=o,u;for(u=0;u<4;u+=1)s=(s+VA[2][u])*o,l=(l+gS[2][u])*o;var c=o*(s+VA[2][4])/(l+gS[2][4]);c=(Yqe-c)/a,o=parseInt(a*16)/16;var f=(a-o)*(a+o);return Math.exp(-o*o)*Math.exp(-f)*c}}),Qqe=.46875,Yqe=.5641895835477563,VA=[[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]],Zqe=Math.pow(2,53);var Pue="zeta",Xqe=["typed","config","multiply","pow","divide","factorial","equal","smallerEq","isNegative","gamma","sin","subtract","add","?Complex","?BigNumber","pi"],d3=V(Pue,Xqe,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(Pue,{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 Iue="mode",Kqe=["typed","isNaN","isNumeric"],p3=V(Iue,Kqe,e=>{var{typed:t,isNaN:r,isNumeric:n}=e;return t(Iue,{"Array | Matrix":i,"...":function(o){return i(o)}});function i(a){a=hr(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 Bue="prod",Jqe=["typed","config","multiplyScalar","numeric"],m3=V(Bue,Jqe,e=>{var{typed:t,config:r,multiplyScalar:n,numeric:i}=e;return t(Bue,{"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 Rue="format",eLe=["typed"],h3=V(Rue,eLe,e=>{var{typed:t}=e;return t(Rue,{any:rr,"any, Object | function | number | BigNumber":rr})});var $ue="bin",tLe=["typed","format"],A3=V($ue,tLe,e=>{var{typed:t,format:r}=e;return t($ue,{"number | BigNumber":function(i){return r(i,{notation:"bin"})},"number | BigNumber, number | BigNumber":function(i,a){return r(i,{notation:"bin",wordSize:a})}})});var que="oct",rLe=["typed","format"],g3=V(que,rLe,e=>{var{typed:t,format:r}=e;return t(que,{"number | BigNumber":function(i){return r(i,{notation:"oct"})},"number | BigNumber, number | BigNumber":function(i,a){return r(i,{notation:"oct",wordSize:a})}})});var Lue="hex",nLe=["typed","format"],v3=V(Lue,nLe,e=>{var{typed:t,format:r}=e;return t(Lue,{"number | BigNumber":function(i){return r(i,{notation:"hex"})},"number | BigNumber, number | BigNumber":function(i,a){return r(i,{notation:"hex",wordSize:a})}})});var y3=/\$([\w.]+)/g;var zue="print",iLe=["typed"],vS=V(zue,iLe,e=>{var{typed:t}=e;return t(zue,{"string, Object | Array":Uue,"string, Object | Array, number | Object":Uue})});function Uue(e,t,r){return e.replace(y3,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?ma(o)?o:rr(o,r):n})}var Wue="to",aLe=["typed","matrix","concat"],b3=V(Wue,aLe,e=>{var{typed:t,matrix:r,concat:n}=e,i=fr({typed:t,matrix:r,concat:n});return t(Wue,{"Unit, Unit | string":(a,o)=>a.to(o)},i({Ds:!0}))});var Hue="isPrime",oLe=["typed"],x3=V(Hue,oLe,e=>{var{typed:t}=e;return t(Hue,{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 sLe="numeric",lLe=["number","?bignumber","?fraction"],w3=V(sLe,lLe,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):XF};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 Vue="divideScalar",uLe=["typed","numeric"],S3=V(Vue,uLe,e=>{var{typed:t,numeric:r}=e;return t(Vue,{"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 Gue="pow",cLe=["typed","config","identity","multiply","matrix","inv","fraction","number","Complex"],E3=V(Gue,cLe,e=>{var{typed:t,config:r,identity:n,multiply:i,matrix:a,inv:o,number:s,fraction:l,Complex:u}=e;return t(Gue,{"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?RW(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=Qt(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",Que="round",fLe=["typed","config","matrix","equalScalar","zeros","BigNumber","DenseMatrix"],k3=V(Que,fLe,e=>{var{typed:t,config:r,matrix:n,equalScalar:i,zeros:a,BigNumber:o,DenseMatrix:s}=e,l=Qn({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(Que,{number:function(p){var h=tS(p,f(r.epsilon)),m=Ma(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=Ma(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 Yue="log",dLe=["config","typed","divideScalar","Complex"],C3=V(Yue,dLe,e=>{var{typed:t,config:r,divideScalar:n,Complex:i}=e;return t(Yue,{number:function(o){return o>=0||r.predictable?Kse(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 Zue="log1p",pLe=["typed","config","divideScalar","log","Complex"],D3=V(Zue,pLe,e=>{var{typed:t,config:r,divideScalar:n,log:i,Complex:a}=e;return t(Zue,{number:function(l){return l>=-1||r.predictable?sT(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 Xue="nthRoots",mLe=["config","typed","divideScalar","Complex"],O3=V(Xue,mLe,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=wi({typed:t}),l=Qo({typed:t,DenseMatrix:a}),u=Qn({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(Kue,f({elop:h,SS:l,DS:s,Ss:u,sS:c}))});var Jue="dotDivide",ALe=["typed","matrix","equalScalar","divideScalar","DenseMatrix","concat"],j3=V(Jue,ALe,e=>{var{typed:t,matrix:r,equalScalar:n,divideScalar:i,DenseMatrix:a,concat:o}=e,s=yo({typed:t,equalScalar:n}),l=wi({typed:t}),u=Qo({typed:t,DenseMatrix:a}),c=Qn({typed:t,equalScalar:n}),f=An({typed:t,DenseMatrix:a}),d=fr({typed:t,matrix:r,concat:o});return t(Jue,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: "+rr(o)+")");var s=o[0],l=o[1];if(s!==l)throw new RangeError("Matrix must be square (size: "+rr(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(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.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(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.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(rce,{"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 nce="usolveAll",bLe=["typed","matrix","divideScalar","multiplyScalar","subtractScalar","equalScalar","DenseMatrix"],_3=V(nce,bLe,e=>{var{typed:t,matrix:r,divideScalar:n,multiplyScalar:i,subtractScalar:a,equalScalar:o,DenseMatrix:s}=e,l=Zm({DenseMatrix:s});return t(nce,{"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 xLe="matAlgo08xS0Sid",wLe=["typed","equalScalar"],bS=V(xLe,wLe,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 ar(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 ice="leftShift",SLe=["typed","matrix","equalScalar","zeros","DenseMatrix","concat"],P3=V(ice,SLe,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=Qn({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":UW,"BigNumber, BigNumber":Qle,"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="rightArithShift",ELe=["typed","matrix","equalScalar","zeros","DenseMatrix","concat"],I3=V(ace,ELe,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=Qn({typed:t,equalScalar:n}),d=vo({typed:t}),p=fr({typed:t,matrix:r,concat:o}),h=xS({typed:t,matrix:r});return t(ace,{"number, number":WW,"BigNumber, BigNumber":Yle,"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 oce="rightLogShift",kLe=["typed","matrix","equalScalar","zeros","DenseMatrix","concat"],B3=V(oce,kLe,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=Qn({typed:t,equalScalar:n}),d=vo({typed:t}),p=fr({typed:t,matrix:r,concat:o}),h=xS({typed:t,matrix:r});return t(oce,{"number, number":HW,"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 sce="and",CLe=["typed","matrix","equalScalar","zeros","not","concat"],wS=V(sce,CLe,e=>{var{typed:t,matrix:r,equalScalar:n,zeros:i,not:a,concat:o}=e,s=yo({typed:t,equalScalar:n}),l=X0({typed:t,equalScalar:n}),u=Qn({typed:t,equalScalar:n}),c=vo({typed:t}),f=fr({typed:t,matrix:r,concat:o});return t(sce,{"number, number":XW,"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 R3="compare",DLe=["typed","config","matrix","equalScalar","BigNumber","Fraction","DenseMatrix","concat"],$3=V(R3,DLe,e=>{var{typed:t,config:r,equalScalar:n,matrix:i,BigNumber:a,Fraction:o,DenseMatrix:s,concat:l}=e,u=wi({typed:t}),c=Z0({typed:t,equalScalar:n}),f=An({typed:t,DenseMatrix:s}),d=fr({typed:t,matrix:i,concat:l}),p=Dd({typed:t});return t(R3,OLe({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}))}),OLe=V(R3,["typed","config"],e=>{var{typed:t,config:r}=e;return t(R3,{"number, number":function(i,a){return Ma(i,a,r.epsilon)?0:i>a?1:-1}})});var Dy=Ae(uce(),1);var cce="compareNatural",MLe=["typed","compare"],q3=V(cce,MLe,e=>{var{typed:t,compare:r}=e,n=r.signatures["boolean,boolean"];return t(cce,{"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,Dy.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,Dy.default)(c,f);if(c!==f)return(0,Dy.default)(c,f);if(c==="Complex")return jLe(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,Dy.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()):LA(u)?a(l,u.toJSON().data,c):LA(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(fce,fT,i({elop:fT,Ds:!0}))});var z3="equal",TLe=["typed","matrix","equalScalar","DenseMatrix","concat"],U3=V(z3,TLe,e=>{var{typed:t,matrix:r,equalScalar:n,DenseMatrix:i,concat:a}=e,o=wi({typed:t}),s=Qo({typed:t,DenseMatrix:i}),l=An({typed:t,DenseMatrix:i}),u=fr({typed:t,matrix:r,concat:a});return t(z3,FLe({typed:t,equalScalar:n}),u({elop:n,SS:s,DS:o,Ss:l}))}),FLe=V(z3,["typed","equalScalar"],e=>{var{typed:t,equalScalar:r}=e;return t(z3,{"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="equalText",_Le=["typed","compareText","isZero"],W3=V(dce,_Le,e=>{var{typed:t,compareText:r,isZero:n}=e;return t(dce,{"any, any":function(a,o){return n(r(a,o))}})});var H3="smaller",PLe=["typed","config","matrix","DenseMatrix","concat"],V3=V(H3,PLe,e=>{var{typed:t,config:r,matrix:n,DenseMatrix:i,concat:a}=e,o=wi({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(H3,ILe({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}))}),ILe=V(H3,["typed","config"],e=>{var{typed:t,config:r}=e;return t(H3,{"number, number":function(i,a){return i{var{typed:t,config:r,matrix:n,DenseMatrix:i,concat:a}=e,o=wi({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(G3,RLe({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}))}),RLe=V(G3,["typed","config"],e=>{var{typed:t,config:r}=e;return t(G3,{"number, number":function(i,a){return i<=a||Ma(i,a,r.epsilon)}})});var Y3="larger",$Le=["typed","config","matrix","DenseMatrix","concat"],Z3=V(Y3,$Le,e=>{var{typed:t,config:r,matrix:n,DenseMatrix:i,concat:a}=e,o=wi({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(Y3,qLe({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}))}),qLe=V(Y3,["typed","config"],e=>{var{typed:t,config:r}=e;return t(Y3,{"number, number":function(i,a){return i>a&&!Ma(i,a,r.epsilon)}})});var X3="largerEq",LLe=["typed","config","matrix","DenseMatrix","concat"],K3=V(X3,LLe,e=>{var{typed:t,config:r,matrix:n,DenseMatrix:i,concat:a}=e,o=wi({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(X3,zLe({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}))}),zLe=V(X3,["typed","config"],e=>{var{typed:t,config:r}=e;return t(X3,{"number, number":function(i,a){return i>=a||Ma(i,a,r.epsilon)}})});var pce="deepEqual",ULe=["typed","equal"],J3=V(pce,ULe,e=>{var{typed:t,equal:r}=e;return t(pce,{"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=wi({typed:t}),l=Qo({typed:t,DenseMatrix:a}),u=An({typed:t,DenseMatrix:a}),c=fr({typed:t,matrix:i,concat:o});return t(e_,HLe({typed:t,equalScalar:n}),c({elop:f,SS:l,DS:s,Ss:u}));function f(d,p){return!n(d,p)}}),HLe=V(e_,["typed","equalScalar"],e=>{var{typed:t,equalScalar:r}=e;return t(e_,{"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 mce="partitionSelect",VLe=["typed","isNumeric","isNaN","compare"],r_=V(mce,VLe,e=>{var{typed:t,isNumeric:r,isNaN:n,compare:i}=e,a=i,o=(u,c)=>-i(u,c);return t(mce,{"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 hce="sort",GLe=["typed","matrix","compare","compareNatural"],n_=V(hce,GLe,e=>{var{typed:t,matrix:r,compare:n,compareNatural:i}=e,a=n,o=(c,f)=>-n(c,f);return t(hce,{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(Qt(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 Ace="max",QLe=["typed","config","numeric","larger"],SS=V(Ace,QLe,e=>{var{typed:t,config:r,numeric:n,larger:i}=e;return t(Ace,{"Array | Matrix":o,"Array | Matrix, number | BigNumber":function(l,u){return Q0(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 gce="min",YLe=["typed","config","numeric","smaller"],ES=V(gce,YLe,e=>{var{typed:t,config:r,numeric:n,smaller:i}=e;return t(gce,{"Array | Matrix":o,"Array | Matrix, number | BigNumber":function(l,u){return Q0(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 ZLe="ImmutableDenseMatrix",XLe=["smaller","DenseMatrix"],i_=V(ZLe,XLe,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&&!ma(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 KLe="Index",JLe=["ImmutableDenseMatrix","getMatrixDataType"],a_=V(KLe,JLe,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 eze="FibonacciHeap",tze=["smaller","larger"],o_=V(eze,tze,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)||ps(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)&&gse(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&&ps(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&&ps(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=Z6(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(Sce,{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 Ece="sparse",sze=["typed","SparseMatrix"],f_=V(Ece,sze,e=>{var{typed:t,SparseMatrix:r}=e;return t(Ece,{"":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 kce="createUnit",lze=["typed","Unit"],d_=V(kce,lze,e=>{var{typed:t,Unit:r}=e;return t(kce,{"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 Cce="acos",uze=["typed","config","Complex"],p_=V(Cce,uze,e=>{var{typed:t,config:r,Complex:n}=e;return t(Cce,{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 Dce="acosh",cze=["typed","config","Complex"],m_=V(Dce,cze,e=>{var{typed:t,config:r,Complex:n}=e;return t(Dce,{number:function(a){return a>=1||r.predictable?eH(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 Oce="acot",fze=["typed","BigNumber"],h_=V(Oce,fze,e=>{var{typed:t,BigNumber:r}=e;return t(Oce,{number:tH,Complex:function(i){return i.acot()},BigNumber:function(i){return new r(1).div(i).atan()}})});var Mce="acoth",dze=["typed","config","Complex","BigNumber"],A_=V(Mce,dze,e=>{var{typed:t,config:r,Complex:n,BigNumber:i}=e;return t(Mce,{number:function(o){return o>=1||o<=-1||r.predictable?rH(o):new n(o,0).acoth()},Complex:function(o){return o.acoth()},BigNumber:function(o){return new i(1).div(o).atanh()}})});var jce="acsc",pze=["typed","config","Complex","BigNumber"],g_=V(jce,pze,e=>{var{typed:t,config:r,Complex:n,BigNumber:i}=e;return t(jce,{number:function(o){return o<=-1||o>=1||r.predictable?nH(o):new n(o,0).acsc()},Complex:function(o){return o.acsc()},BigNumber:function(o){return new i(1).div(o).asin()}})});var Nce="acsch",mze=["typed","BigNumber"],v_=V(Nce,mze,e=>{var{typed:t,BigNumber:r}=e;return t(Nce,{number:iH,Complex:function(i){return i.acsch()},BigNumber:function(i){return new r(1).div(i).asinh()}})});var Tce="asec",hze=["typed","config","Complex","BigNumber"],y_=V(Tce,hze,e=>{var{typed:t,config:r,Complex:n,BigNumber:i}=e;return t(Tce,{number:function(o){return o<=-1||o>=1||r.predictable?aH(o):new n(o,0).asec()},Complex:function(o){return o.asec()},BigNumber:function(o){return new i(1).div(o).acos()}})});var Fce="asech",Aze=["typed","config","Complex","BigNumber"],b_=V(Fce,Aze,e=>{var{typed:t,config:r,Complex:n,BigNumber:i}=e;return t(Fce,{number:function(o){if(o<=1&&o>=-1||r.predictable){var s=1/o;if(s>0||r.predictable)return oH(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 _ce="asin",gze=["typed","config","Complex"],x_=V(_ce,gze,e=>{var{typed:t,config:r,Complex:n}=e;return t(_ce,{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 vze="asinh",yze=["typed"],w_=V(vze,yze,e=>{var{typed:t}=e;return t("asinh",{number:sH,Complex:function(n){return n.asinh()},BigNumber:function(n){return n.asinh()}})});var bze="atan",xze=["typed"],S_=V(bze,xze,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 Pce="atan2",wze=["typed","matrix","equalScalar","BigNumber","DenseMatrix","concat"],E_=V(Pce,wze,e=>{var{typed:t,matrix:r,equalScalar:n,BigNumber:i,DenseMatrix:a,concat:o}=e,s=yo({typed:t,equalScalar:n}),l=wi({typed:t}),u=MF({typed:t,equalScalar:n}),c=Qn({typed:t,equalScalar:n}),f=An({typed:t,DenseMatrix:a}),d=fr({typed:t,matrix:r,concat:o});return t(Pce,{"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 Ice="atanh",Sze=["typed","config","Complex"],k_=V(Ice,Sze,e=>{var{typed:t,config:r,Complex:n}=e;return t(Ice,{number:function(a){return a<=1&&a>=-1||r.predictable?lH(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 Bce="cos",Eze=["typed"],C_=V(Bce,Eze,e=>{var{typed:t}=e,r=Md({typed:t});return t(Bce,{number:Math.cos,"Complex | BigNumber":n=>n.cos()},r)});var Rce="cosh",kze=["typed"],D_=V(Rce,kze,e=>{var{typed:t}=e;return t(Rce,{number:uT,"Complex | BigNumber":r=>r.cosh()})});var $ce="cot",Cze=["typed","BigNumber"],O_=V($ce,Cze,e=>{var{typed:t,BigNumber:r}=e,n=Md({typed:t});return t($ce,{number:uH,Complex:i=>i.cot(),BigNumber:i=>new r(1).div(i.tan())},n)});var qce="coth",Dze=["typed","BigNumber"],M_=V(qce,Dze,e=>{var{typed:t,BigNumber:r}=e;return t(qce,{number:cH,Complex:n=>n.coth(),BigNumber:n=>new r(1).div(n.tanh())})});var Lce="csc",Oze=["typed","BigNumber"],j_=V(Lce,Oze,e=>{var{typed:t,BigNumber:r}=e,n=Md({typed:t});return t(Lce,{number:fH,Complex:i=>i.csc(),BigNumber:i=>new r(1).div(i.sin())},n)});var zce="csch",Mze=["typed","BigNumber"],N_=V(zce,Mze,e=>{var{typed:t,BigNumber:r}=e;return t(zce,{number:dH,Complex:n=>n.csch(),BigNumber:n=>new r(1).div(n.sinh())})});var Uce="sec",jze=["typed","BigNumber"],T_=V(Uce,jze,e=>{var{typed:t,BigNumber:r}=e,n=Md({typed:t});return t(Uce,{number:pH,Complex:i=>i.sec(),BigNumber:i=>new r(1).div(i.cos())},n)});var Wce="sech",Nze=["typed","BigNumber"],F_=V(Wce,Nze,e=>{var{typed:t,BigNumber:r}=e;return t(Wce,{number:mH,Complex:n=>n.sech(),BigNumber:n=>new r(1).div(n.cosh())})});var Hce="sin",Tze=["typed"],__=V(Hce,Tze,e=>{var{typed:t}=e,r=Md({typed:t});return t(Hce,{number:Math.sin,"Complex | BigNumber":n=>n.sin()},r)});var Vce="sinh",Fze=["typed"],P_=V(Vce,Fze,e=>{var{typed:t}=e;return t(Vce,{number:hH,"Complex | BigNumber":r=>r.sinh()})});var Gce="tan",_ze=["typed"],I_=V(Gce,_ze,e=>{var{typed:t}=e,r=Md({typed:t});return t(Gce,{number:Math.tan,"Complex | BigNumber":n=>n.tan()},r)});var Pze="tanh",Ize=["typed"],B_=V(Pze,Ize,e=>{var{typed:t}=e;return t("tanh",{number:cT,"Complex | BigNumber":r=>r.tanh()})});var Qce="setCartesian",Bze=["typed","size","subset","compareNatural","Index","DenseMatrix"],R_=V(Qce,Bze,e=>{var{typed:t,size:r,subset:n,compareNatural:i,Index:a,DenseMatrix:o}=e;return t(Qce,{"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=hr(Array.isArray(l)?l:l.toArray()).sort(i),d=hr(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(Yce,{"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 hr(l.toArray());var f=zA(hr(Array.isArray(l)?l:l.toArray()).sort(i)),d=zA(hr(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(Zce,{"Array | Matrix":function(l){var u;if(n(r(l),new a(0))===0)u=[];else{var c=hr(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(Xce,{"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=zA(hr(Array.isArray(l)?l:l.toArray()).sort(i)),d=zA(hr(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(Kce,{"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=zA(hr(Array.isArray(s)?s:s.toArray()).sort(i)),c=zA(hr(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(Jce,{"number | BigNumber | Fraction | Complex, Array | Matrix":function(s,l){if(n(r(l),new a(0))===0)return 0;for(var u=hr(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(efe,{"Array | Matrix":function(u){if(n(r(u),new a(0))===0)return[];for(var c=hr(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 tfe="setSize",Wze=["typed","compareNatural"],H_=V(tfe,Wze,e=>{var{typed:t,compareNatural:r}=e;return t(tfe,{"Array | Matrix":function(i){return Array.isArray(i)?hr(i).length:hr(i.toArray()).length},"Array | Matrix, boolean":function(i,a){if(a===!1||i.length===0)return Array.isArray(i)?hr(i).length:hr(i.toArray()).length;for(var o=hr(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(rfe,{"Array | Matrix, Array | Matrix":function(l,u){if(i(r(l),new o(0))===0)return hr(u);if(i(r(u),new o(0))===0)return hr(l);var c=hr(l),f=hr(u);return n(a(c,f),a(f,c))}})});var nfe="setUnion",Vze=["typed","size","concat","subset","setIntersect","setSymDifference","Index"],G_=V(nfe,Vze,e=>{var{typed:t,size:r,concat:n,subset:i,setIntersect:a,setSymDifference:o,Index:s}=e;return t(nfe,{"Array | Matrix, Array | Matrix":function(u,c){if(i(r(u),new s(0))===0)return hr(c);if(i(r(c),new s(0))===0)return hr(u);var f=hr(u),d=hr(c);return n(o(f,d),a(f,d))}})});var ife="add",Gze=["typed","matrix","addScalar","equalScalar","DenseMatrix","SparseMatrix","concat"],Q_=V(ife,Gze,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(ife,{"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(afe,{"... number | BigNumber":u,Array:u,Matrix:c=>u(hr(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(ofe,{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 sfe="dot",Zze=["typed","addScalar","multiplyScalar","conj","size"],X_=V(sfe,Zze,e=>{var{typed:t,addScalar:r,multiplyScalar:n,conj:i,size:a}=e;return t(sfe,{"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 Xze="trace",Kze=["typed","matrix","add"],K_=V(Xze,Kze,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: "+rr(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: "+rr(c)+")")}});var lfe="index",Jze=["typed","Index"],J_=V(lfe,Jze,e=>{var{typed:t,Index:r}=e;return t(lfe,{"...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 e4=new Set(["end"]);var eUe="Node",tUe=["mathWithTransform"],t4=V(eUe,tUe,e=>{var{mathWithTransform:t}=e;function r(i){for(var a of[...e4])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=UA(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 Si(e){return e&&e.isIndexError?new gs(e.index+1,e.min+1,e.max!==void 0?e.max+1:void 0):e}function r4(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 Xi(n,i.getObjectProperty())}else throw new TypeError("Cannot apply index: unsupported type of object")}catch(a){throw Si(a)}}}var n4="AccessorNode",rUe=["subset","Node"],i4=V(n4,rUe,e=>{var{subset:t,Node:r}=e,n=r4({subset:t});function i(o){return!(zu(o)||ms(o)||vr(o)||xl(o)||Vm(o)||hs(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 n4}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 Xi(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:n4,object:this.object,index:this.index}}static fromJSON(s){return new a(s.object,s.index)}}return yn(a,"name",n4),a},{isClass:!0,isNode:!0});var a4="ArrayNode",nUe=["Node"],o4=V(a4,nUe,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 a4}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(ms)&&!o.every(ms),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",a4),r},{isClass:!0,isNode:!0});function ufe(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 Si(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 s4(e,t){if(!t||t!=="auto")return e;for(var r=e;hs(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=r4({subset:t}),a=ufe({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)&&!zu(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 u4}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=Xi(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:u4,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",u4),s},{isClass:!0,isNode:!0});var f4="BlockNode",aUe=["ResultSet","Node"],d4=V(f4,aUe,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 f4}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 L0(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",f4),n},{isClass:!0,isNode:!0});var p4="ConditionalNode",iUe=["Node"],m4=V(p4,iUe,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(ps(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 p4}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:p4,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",p4),n},{isClass:!0,isNode:!0});var mfe=Ae(dfe(),1);var kH={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"},CH={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(kH.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)"}},hfe="\\mathrm{${name}}\\left(${args}\\right)",pfe={deg:"^\\circ"};function h4(e){return(0,mfe.default)(e,{preserveFormatting:!0})}function A4(e,t){return t=typeof t>"u"?!1:t,t?Et(pfe,e)?pfe[e]:"\\mathrm{"+h4(e)+"}":Et(kH,e)?kH[e]:h4(e)}var g4="ConstantNode",lUe=["Node"],v4=V(g4,lUe,e=>{var{Node:t}=e;class r extends t{constructor(i){super(),this.value=i}get type(){return g4}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 rr(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:g4,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{"+h4(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",g4),r},{isClass:!0,isNode:!0});var y4="FunctionAssignmentNode",uUe=["typed","Node"],b4=V(y4,uUe,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(e4.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 y4}get isFunctionAssignmentNode(){return!0}_compile(o,s){var l=Object.create(s);L0(this.params,function(h){l[h]=!0});var u=this.expr._compile(o,l),c=this.name,f=this.params,d=nW(this.types,","),p=c+"("+nW(this.params,", ")+")";return function(m,g,A){var b={};b[d]=function(){for(var x=Object.create(g),w=0;w'+As(this.params[u])+"");var c=this.expr.toHTML(o);return n(this,s,o&&o.implicit)&&(c='('+c+')'),''+As(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(A4).join(",")+"\\right)="+l}}return yn(i,"name",y4),i},{isClass:!0,isNode:!0});var x4="IndexNode",cUe=["Node","size"],w4=V(x4,cUe,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 x4}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)&&!ma(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=Xi(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.'+As(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",x4),n},{isClass:!0,isNode:!0});var S4="ObjectNode",fUe=["Node"],E4=V(S4,fUe,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 S4}get isObjectNode(){return!0}_compile(i,a){var o={};for(var s in this.properties)if(Et(this.properties,s)){var l=by(s),u=JSON.parse(l),c=Xi(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["+by(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["+by(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(by(o)+": "+this.properties[o].toString(i));return"{"+a.join(", ")+"}"}toJSON(){return{mathjs:S4,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(''+As(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",S4),r},{isClass:!0,isNode:!0});function Oy(e,t){return new Xw(e,new Sy(t),new Set(Object.keys(t)))}var k4="OperatorNode",dUe=["Node"],C4=V(k4,dUe,e=>{var{Node:t}=e;function r(a,o){var s=a;if(o==="auto")for(;hs(s);)s=s.content;return vr(s)?!0:xi(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=l4(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:k4,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"?''+As(this.op)+""+d:d+''+As(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+''+As(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(''+As(this.op)+""):''+As(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",k4),i},{isClass:!0,isNode:!0});var D4="ParenthesisNode",pUe=["Node"],O4=V(D4,pUe,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 D4}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:D4,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",D4),r},{isClass:!0,isNode:!0});var M4="RangeNode",mUe=["Node"],j4=V(M4,mUe,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 M4}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:M4,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",M4),n},{isClass:!0,isNode:!0});var N4="RelationalNode",hUe=["Node"],T4=V(N4,hUe,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 N4}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'+As(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 Xi(d,u)};if(u in s)return function(f,d,p){return f.has(u)?f.get(u):Xi(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=As(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=A4(this.name,l);return u[0]==="\\"?u:" "+u}}return a},{isClass:!0,isNode:!0});var _4="FunctionNode",vUe=["math","Node","SymbolNode"],P4=V(_4,vUe,e=>{var t,{math:r,Node:n,SymbolNode:i}=e,a=l=>rr(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 _4}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=Xi(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,Oy(O,C));var P=f.map(q=>q(O,C,N));return D.apply(D,P)}}else{var p=d in u?Xi(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=Xi(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: +`)}}return yn(n,"name",f4),n},{isClass:!0,isNode:!0});var p4="ConditionalNode",oUe=["Node"],m4=V(p4,oUe,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(ps(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 p4}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:p4,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",p4),n},{isClass:!0,isNode:!0});var mfe=Ae(dfe(),1);var DH={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"},OH={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(DH.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)"}},hfe="\\mathrm{${name}}\\left(${args}\\right)",pfe={deg:"^\\circ"};function h4(e){return(0,mfe.default)(e,{preserveFormatting:!0})}function A4(e,t){return t=typeof t>"u"?!1:t,t?Et(pfe,e)?pfe[e]:"\\mathrm{"+h4(e)+"}":Et(DH,e)?DH[e]:h4(e)}var g4="ConstantNode",cUe=["Node"],v4=V(g4,cUe,e=>{var{Node:t}=e;class r extends t{constructor(i){super(),this.value=i}get type(){return g4}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 rr(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:g4,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{"+h4(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",g4),r},{isClass:!0,isNode:!0});var y4="FunctionAssignmentNode",fUe=["typed","Node"],b4=V(y4,fUe,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(e4.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 y4}get isFunctionAssignmentNode(){return!0}_compile(o,s){var l=Object.create(s);L0(this.params,function(h){l[h]=!0});var u=this.expr._compile(o,l),c=this.name,f=this.params,d=aW(this.types,","),p=c+"("+aW(this.params,", ")+")";return function(m,g,A){var b={};b[d]=function(){for(var x=Object.create(g),w=0;w'+As(this.params[u])+"");var c=this.expr.toHTML(o);return n(this,s,o&&o.implicit)&&(c='('+c+')'),''+As(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(A4).join(",")+"\\right)="+l}}return yn(i,"name",y4),i},{isClass:!0,isNode:!0});var x4="IndexNode",dUe=["Node","size"],w4=V(x4,dUe,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 x4}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)&&!ma(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=Xi(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.'+As(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",x4),n},{isClass:!0,isNode:!0});var S4="ObjectNode",pUe=["Node"],E4=V(S4,pUe,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 S4}get isObjectNode(){return!0}_compile(i,a){var o={};for(var s in this.properties)if(Et(this.properties,s)){var l=by(s),u=JSON.parse(l),c=Xi(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["+by(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["+by(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(by(o)+": "+this.properties[o].toString(i));return"{"+a.join(", ")+"}"}toJSON(){return{mathjs:S4,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(''+As(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",S4),r},{isClass:!0,isNode:!0});function Oy(e,t){return new Xw(e,new Sy(t),new Set(Object.keys(t)))}var k4="OperatorNode",mUe=["Node"],C4=V(k4,mUe,e=>{var{Node:t}=e;function r(a,o){var s=a;if(o==="auto")for(;hs(s);)s=s.content;return vr(s)?!0:xi(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=l4(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:k4,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"?''+As(this.op)+""+d:d+''+As(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+''+As(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(''+As(this.op)+""):''+As(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",k4),i},{isClass:!0,isNode:!0});var D4="ParenthesisNode",hUe=["Node"],O4=V(D4,hUe,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 D4}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:D4,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",D4),r},{isClass:!0,isNode:!0});var M4="RangeNode",AUe=["Node"],j4=V(M4,AUe,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 M4}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:M4,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",M4),n},{isClass:!0,isNode:!0});var N4="RelationalNode",gUe=["Node"],T4=V(N4,gUe,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 N4}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'+As(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 Xi(d,u)};if(u in s)return function(f,d,p){return f.has(u)?f.get(u):Xi(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=As(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=A4(this.name,l);return u[0]==="\\"?u:" "+u}}return a},{isClass:!0,isNode:!0});var _4="FunctionNode",bUe=["math","Node","SymbolNode"],P4=V(_4,bUe,e=>{var t,{math:r,Node:n,SymbolNode:i}=e,a=l=>rr(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 _4}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=Xi(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,Oy(O,C));var P=f.map(q=>q(O,C,N));return D.apply(D,P)}}else{var p=d in u?Xi(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=Xi(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: `).concat(a(O)))};if(h){var g=this.args;return function(O,C,N){var D=m(O);return D(g,u,Oy(O,C))}}else switch(f.length){case 0:return function(O,C,N){var D=m(O);return D()};case 1:return function(O,C,N){var D=m(O),P=f[0];return D(P(O,C,N))};case 2:return function(O,C,N){var D=m(O),P=f[0],q=f[1];return D(P(O,C,N),q(O,C,N))};default:return function(O,C,N){var D=m(O),P=f.map(q=>q(O,C,N));return D(...P)}}}}else if(zu(this.fn)&&Sc(this.fn.index)&&this.fn.index.isObjectProperty()){var b=this.fn.object._compile(u,c),v=this.fn.index.getObjectProperty(),x=this.args;return function(O,C,N){var D=b(O,C,N),P=Cse(D,v);if(P!=null&&P.rawArgs)return P(x,u,Oy(O,C));var q=f.map(z=>z(O,C,N));return P.apply(D,q)}}else{var w=this.fn.toString(),S=this.fn._compile(u,c),k=this.args;return function(O,C,N){var D=S(O,C,N);if(typeof D!="function")throw new TypeError("Expression '".concat(w,"' did not evaluate to a function; value is:")+` - `.concat(a(D)));if(D.rawArgs)return D(k,u,Oy(O,C));var P=f.map(q=>q(O,C,N));return D.apply(D,P)}}}forEach(u){u(this.fn,"fn",this);for(var c=0;c'+As(this.fn)+'('+c.join(',')+')'}toTex(u){var c;return u&&typeof u.handler=="object"&&Et(u.handler,this.name)&&(c=u.handler[this.name](this,u)),typeof c<"u"?c:super.toTex(u)}_toTex(u){var c=this.args.map(function(p){return p.toTex(u)}),f;CH[this.name]&&(f=CH[this.name]),r[this.name]&&(typeof r[this.name].toTex=="function"||typeof r[this.name].toTex=="object"||typeof r[this.name].toTex=="string")&&(f=r[this.name].toTex);var d;switch(typeof f){case"function":d=f(this,u);break;case"string":d=o(f,this,u);break;case"object":switch(typeof f[c.length]){case"function":d=f[c.length](this,u);break;case"string":d=o(f[c.length],this,u);break}}return typeof d<"u"?d:o(hfe,this,u)}getIdentifier(){return this.type+":"+this.name}}return t=s,yn(s,"name",_4),yn(s,"onUndefinedFunction",function(l){throw new Error("Undefined function "+l)}),yn(s,"fromJSON",function(l){return new t(l.fn,l.args)}),s},{isClass:!0,isNode:!0});var Afe="parse",yUe=["typed","numeric","config","AccessorNode","ArrayNode","AssignmentNode","BlockNode","ConditionalNode","ConstantNode","FunctionAssignmentNode","FunctionNode","IndexNode","ObjectNode","OperatorNode","ParenthesisNode","RangeNode","RelationalNode","SymbolNode"],I4=V(Afe,yUe,e=>{var{typed:t,numeric:r,config:n,AccessorNode:i,ArrayNode:a,AssignmentNode:o,BlockNode:s,ConditionalNode:l,ConstantNode:u,FunctionAssignmentNode:c,FunctionNode:f,IndexNode:d,ObjectNode:p,OperatorNode:h,ParenthesisNode:m,RangeNode:g,RelationalNode:A,SymbolNode:b}=e,v=t(Afe,{string:function(ue){return oe(ue,{})},"Array | Matrix":function(ue){return x(ue,{})},"string, Object":function(ue,Pe){var De=Pe.nodes!==void 0?Pe.nodes:{};return oe(ue,De)},"Array | Matrix, Object":x});function x(G){var ue=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},Pe=ue.nodes!==void 0?ue.nodes:{};return jt(G,function(De){if(typeof De!="string")throw new TypeError("String expected");return oe(De,Pe)})}var w={NULL:0,DELIMITER:1,NUMBER:2,SYMBOL:3,UNKNOWN:4},S={",":!0,"(":!0,")":!0,"[":!0,"]":!0,"{":!0,"}":!0,'"':!0,"'":!0,";":!0,"+":!0,"-":!0,"*":!0,".*":!0,"/":!0,"./":!0,"%":!0,"^":!0,".^":!0,"~":!0,"!":!0,"&":!0,"|":!0,"^|":!0,"=":!0,":":!0,"?":!0,"==":!0,"!=":!0,"<":!0,">":!0,"<=":!0,">=":!0,"<<":!0,">>":!0,">>>":!0},k={mod:!0,to:!0,in:!0,and:!0,xor:!0,or:!0,not:!0},j={true:!0,false:!1,null:null,undefined:void 0},O=["NaN","Infinity"],C={'"':'"',"'":"'","\\":"\\","/":"/",b:"\b",f:"\f",n:` + `.concat(a(D)));if(D.rawArgs)return D(k,u,Oy(O,C));var P=f.map(q=>q(O,C,N));return D.apply(D,P)}}}forEach(u){u(this.fn,"fn",this);for(var c=0;c'+As(this.fn)+'('+c.join(',')+')'}toTex(u){var c;return u&&typeof u.handler=="object"&&Et(u.handler,this.name)&&(c=u.handler[this.name](this,u)),typeof c<"u"?c:super.toTex(u)}_toTex(u){var c=this.args.map(function(p){return p.toTex(u)}),f;OH[this.name]&&(f=OH[this.name]),r[this.name]&&(typeof r[this.name].toTex=="function"||typeof r[this.name].toTex=="object"||typeof r[this.name].toTex=="string")&&(f=r[this.name].toTex);var d;switch(typeof f){case"function":d=f(this,u);break;case"string":d=o(f,this,u);break;case"object":switch(typeof f[c.length]){case"function":d=f[c.length](this,u);break;case"string":d=o(f[c.length],this,u);break}}return typeof d<"u"?d:o(hfe,this,u)}getIdentifier(){return this.type+":"+this.name}}return t=s,yn(s,"name",_4),yn(s,"onUndefinedFunction",function(l){throw new Error("Undefined function "+l)}),yn(s,"fromJSON",function(l){return new t(l.fn,l.args)}),s},{isClass:!0,isNode:!0});var Afe="parse",xUe=["typed","numeric","config","AccessorNode","ArrayNode","AssignmentNode","BlockNode","ConditionalNode","ConstantNode","FunctionAssignmentNode","FunctionNode","IndexNode","ObjectNode","OperatorNode","ParenthesisNode","RangeNode","RelationalNode","SymbolNode"],I4=V(Afe,xUe,e=>{var{typed:t,numeric:r,config:n,AccessorNode:i,ArrayNode:a,AssignmentNode:o,BlockNode:s,ConditionalNode:l,ConstantNode:u,FunctionAssignmentNode:c,FunctionNode:f,IndexNode:d,ObjectNode:p,OperatorNode:h,ParenthesisNode:m,RangeNode:g,RelationalNode:A,SymbolNode:b}=e,v=t(Afe,{string:function(ue){return oe(ue,{})},"Array | Matrix":function(ue){return x(ue,{})},"string, Object":function(ue,Pe){var De=Pe.nodes!==void 0?Pe.nodes:{};return oe(ue,De)},"Array | Matrix, Object":x});function x(G){var ue=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},Pe=ue.nodes!==void 0?ue.nodes:{};return jt(G,function(De){if(typeof De!="string")throw new TypeError("String expected");return oe(De,Pe)})}var w={NULL:0,DELIMITER:1,NUMBER:2,SYMBOL:3,UNKNOWN:4},S={",":!0,"(":!0,")":!0,"[":!0,"]":!0,"{":!0,"}":!0,'"':!0,"'":!0,";":!0,"+":!0,"-":!0,"*":!0,".*":!0,"/":!0,"./":!0,"%":!0,"^":!0,".^":!0,"~":!0,"!":!0,"&":!0,"|":!0,"^|":!0,"=":!0,":":!0,"?":!0,"==":!0,"!=":!0,"<":!0,">":!0,"<=":!0,">=":!0,"<<":!0,">>":!0,">>>":!0},k={mod:!0,to:!0,in:!0,and:!0,xor:!0,or:!0,not:!0},j={true:!0,false:!1,null:null,undefined:void 0},O=["NaN","Infinity"],C={'"':'"',"'":"'","\\":"\\","/":"/",b:"\b",f:"\f",n:` `,r:"\r",t:" "};function N(){return{extraNodes:{},expression:"",comment:"",index:0,token:"",tokenType:w.NULL,nestingLevel:0,conditionalLevel:null}}function D(G,ue){return G.expression.substr(G.index,ue)}function P(G){return D(G,1)}function q(G){G.index++}function z(G){return G.expression.charAt(G.index-1)}function I(G){return G.expression.charAt(G.index+1)}function T(G){for(G.tokenType=w.NULL,G.token="",G.comment="";;){if(P(G)==="#")for(;P(G)!==` `&&P(G)!=="";)G.comment+=P(G),q(G);if(v.isWhitespace(P(G),G.nestingLevel))q(G);else break}if(P(G)===""){G.tokenType=w.DELIMITER;return}if(P(G)===` `&&!G.nestingLevel){G.tokenType=w.DELIMITER,G.token=P(G),q(G);return}var ue=P(G),Pe=D(G,2),De=D(G,3);if(De.length===3&&S[De]){G.tokenType=w.DELIMITER,G.token=De,q(G),q(G),q(G);return}if(Pe.length===2&&S[Pe]){G.tokenType=w.DELIMITER,G.token=Pe,q(G),q(G);return}if(S[ue]){G.tokenType=w.DELIMITER,G.token=ue,q(G);return}if(v.isDigitDot(ue)){G.tokenType=w.NUMBER;var at=D(G,2);if(at==="0b"||at==="0o"||at==="0x"){for(G.token+=P(G),q(G),G.token+=P(G),q(G);v.isHexDigit(P(G));)G.token+=P(G),q(G);if(P(G)===".")for(G.token+=".",q(G);v.isHexDigit(P(G));)G.token+=P(G),q(G);else if(P(G)==="i")for(G.token+="i",q(G);v.isDigit(P(G));)G.token+=P(G),q(G);return}if(P(G)==="."){if(G.token+=P(G),q(G),!v.isDigit(P(G))){G.tokenType=w.DELIMITER;return}}else{for(;v.isDigit(P(G));)G.token+=P(G),q(G);v.isDecimalMark(P(G),I(G))&&(G.token+=P(G),q(G))}for(;v.isDigit(P(G));)G.token+=P(G),q(G);if(P(G)==="E"||P(G)==="e"){if(v.isDigit(I(G))||I(G)==="-"||I(G)==="+"){if(G.token+=P(G),q(G),(P(G)==="+"||P(G)==="-")&&(G.token+=P(G),q(G)),!v.isDigit(P(G)))throw et(G,'Digit expected, got "'+P(G)+'"');for(;v.isDigit(P(G));)G.token+=P(G),q(G);if(v.isDecimalMark(P(G),I(G)))throw et(G,'Digit expected, got "'+P(G)+'"')}else if(I(G)===".")throw q(G),et(G,'Digit expected, got "'+P(G)+'"')}return}if(v.isAlpha(P(G),z(G),I(G))){for(;v.isAlpha(P(G),z(G),I(G))||v.isDigit(P(G));)G.token+=P(G),q(G);Et(k,G.token)?G.tokenType=w.DELIMITER:G.tokenType=w.SYMBOL;return}for(G.tokenType=w.UNKNOWN;P(G)!=="";)G.token+=P(G),q(G);throw et(G,'Syntax error in part "'+G.token+'"')}function L(G){do T(G);while(G.token===` @@ -91,16 +91,16 @@ Example: `&&Pe>0},v.isDecimalMark=function(ue,Pe){return ue==="."&&Pe!=="/"&&Pe!=="*"&&Pe!=="^"},v.isDigitDot=function(ue){return ue>="0"&&ue<="9"||ue==="."},v.isDigit=function(ue){return ue>="0"&&ue<="9"},v.isHexDigit=function(ue){return ue>="0"&&ue<="9"||ue>="a"&&ue<="f"||ue>="A"&&ue<="F"};function oe(G,ue){var Pe=N();Fn(Pe,{expression:G,extraNodes:ue}),T(Pe);var De=te(Pe);if(Pe.token!=="")throw Pe.tokenType===w.DELIMITER?Ge(Pe,"Unexpected operator "+Pe.token):et(Pe,'Unexpected part "'+Pe.token+'"');return De}function te(G){var ue,Pe=[],De;for(G.token!==""&&G.token!==` `&&G.token!==";"&&(ue=Q(G),G.comment&&(ue.comment=G.comment));G.token===` `||G.token===";";)Pe.length===0&&ue&&(De=G.token!==";",Pe.push({node:ue,visible:De})),T(G),G.token!==` -`&&G.token!==";"&&G.token!==""&&(ue=Q(G),G.comment&&(ue.comment=G.comment),De=G.token!==";",Pe.push({node:ue,visible:De}));return Pe.length>0?new s(Pe):(ue||(ue=new u(void 0),G.comment&&(ue.comment=G.comment)),ue)}function Q(G){var ue,Pe,De,at,ht=fe(G);if(G.token==="="){if(ri(ht))return ue=ht.name,L(G),De=Q(G),new o(new b(ue),De);if(zu(ht))return L(G),De=Q(G),new o(ht.object,ht.index,De);if(xl(ht)&&ri(ht.fn)&&(at=!0,Pe=[],ue=ht.name,ht.args.forEach(function(Yt,Wr){ri(Yt)?Pe[Wr]=Yt.name:at=!1}),at))return L(G),De=Q(G),new c(ue,Pe,De);throw et(G,"Invalid left hand side of assignment operator =")}return ht}function fe(G){for(var ue=Ie(G);G.token==="?";){var Pe=G.conditionalLevel;G.conditionalLevel=G.nestingLevel,L(G);var De=ue,at=Q(G);if(G.token!==":")throw et(G,"False part of conditional expression expected");G.conditionalLevel=null,L(G);var ht=Q(G);ue=new l(De,at,ht),G.conditionalLevel=Pe}return ue}function Ie(G){for(var ue=Se(G);G.token==="or";)L(G),ue=new h("or","or",[ue,Se(G)]);return ue}function Se(G){for(var ue=Oe(G);G.token==="xor";)L(G),ue=new h("xor","xor",[ue,Oe(G)]);return ue}function Oe(G){for(var ue=ve(G);G.token==="and";)L(G),ue=new h("and","and",[ue,ve(G)]);return ue}function ve(G){for(var ue=ye(G);G.token==="|";)L(G),ue=new h("|","bitOr",[ue,ye(G)]);return ue}function ye(G){for(var ue=me(G);G.token==="^|";)L(G),ue=new h("^|","bitXor",[ue,me(G)]);return ue}function me(G){for(var ue=ke(G);G.token==="&";)L(G),ue=new h("&","bitAnd",[ue,ke(G)]);return ue}function ke(G){for(var ue=[$(G)],Pe=[],De={"==":"equal","!=":"unequal","<":"smaller",">":"larger","<=":"smallerEq",">=":"largerEq"};Et(De,G.token);){var at={name:G.token,fn:De[G.token]};Pe.push(at),L(G),ue.push($(G))}return ue.length===1?ue[0]:ue.length===2?new h(Pe[0].name,Pe[0].fn,ue):new A(Pe.map(ht=>ht.fn),ue)}function $(G){var ue,Pe,De,at;ue=ae(G);for(var ht={"<<":"leftShift",">>":"rightArithShift",">>>":"rightLogShift"};Et(ht,G.token);)Pe=G.token,De=ht[Pe],L(G),at=[ue,ae(G)],ue=new h(Pe,De,at);return ue}function ae(G){var ue,Pe,De,at;ue=ce(G);for(var ht={to:"to",in:"to"};Et(ht,G.token);)Pe=G.token,De=ht[Pe],L(G),Pe==="in"&&G.token===""?ue=new h("*","multiply",[ue,new b("in")],!0):(at=[ue,ce(G)],ue=new h(Pe,De,at));return ue}function ce(G){var ue,Pe=[];if(G.token===":"?ue=new u(1):ue=U(G),G.token===":"&&G.conditionalLevel!==G.nestingLevel){for(Pe.push(ue);G.token===":"&&Pe.length<3;)L(G),G.token===")"||G.token==="]"||G.token===","||G.token===""?Pe.push(new b("end")):Pe.push(U(G));Pe.length===3?ue=new g(Pe[0],Pe[2],Pe[1]):ue=new g(Pe[0],Pe[1])}return ue}function U(G){var ue,Pe,De,at;ue=R(G);for(var ht={"+":"add","-":"subtract"};Et(ht,G.token);){Pe=G.token,De=ht[Pe],L(G);var Yt=R(G);Yt.isPercentage?at=[ue,new h("*","multiply",[ue,Yt])]:at=[ue,Yt],ue=new h(Pe,De,at)}return ue}function R(G){var ue,Pe,De,at;ue=J(G),Pe=ue;for(var ht={"*":"multiply",".*":"dotMultiply","/":"divide","./":"dotDivide"};Et(ht,G.token);)De=G.token,at=ht[De],L(G),Pe=J(G),ue=new h(De,at,[ue,Pe]);return ue}function J(G){var ue,Pe;for(ue=ee(G),Pe=ue;G.tokenType===w.SYMBOL||G.token==="in"&&vr(ue)||G.tokenType===w.NUMBER&&!vr(Pe)&&(!xi(Pe)||Pe.op==="!")||G.token==="(";)Pe=ee(G),ue=new h("*","multiply",[ue,Pe],!0);return ue}function ee(G){for(var ue=ie(G),Pe=ue,De=[];G.token==="/"&&$6(Pe);)if(De.push(Fn({},G)),L(G),G.tokenType===w.NUMBER)if(De.push(Fn({},G)),L(G),G.tokenType===w.SYMBOL||G.token==="(")Fn(G,De.pop()),De.pop(),Pe=ie(G),ue=new h("/","divide",[ue,Pe]);else{De.pop(),Fn(G,De.pop());break}else{Fn(G,De.pop());break}return ue}function ie(G){var ue,Pe,De,at;ue=re(G);for(var ht={"%":"mod",mod:"mod"};Et(ht,G.token);)Pe=G.token,De=ht[Pe],L(G),Pe==="%"&&G.tokenType===w.DELIMITER&&G.token!=="("?ue=new h("/","divide",[ue,new u(100)],!1,!0):(at=[ue,re(G)],ue=new h(Pe,De,at));return ue}function re(G){var ue,Pe,De,at={"-":"unaryMinus","+":"unaryPlus","~":"bitNot",not:"not"};return Et(at,G.token)?(De=at[G.token],ue=G.token,L(G),Pe=[re(G)],new h(ue,De,Pe)):Ee(G)}function Ee(G){var ue,Pe,De,at;return ue=Ce(G),(G.token==="^"||G.token===".^")&&(Pe=G.token,De=Pe==="^"?"pow":"dotPow",L(G),at=[ue,re(G)],ue=new h(Pe,De,at)),ue}function Ce(G){var ue,Pe,De,at;ue=_e(G);for(var ht={"!":"factorial","'":"ctranspose"};Et(ht,G.token);)Pe=G.token,De=ht[Pe],T(G),at=[ue],ue=new h(Pe,De,at),ue=ze(G,ue);return ue}function _e(G){var ue=[];if(G.tokenType===w.SYMBOL&&Et(G.extraNodes,G.token)){var Pe=G.extraNodes[G.token];if(T(G),G.token==="("){if(ue=[],_(G),T(G),G.token!==")")for(ue.push(Q(G));G.token===",";)T(G),ue.push(Q(G));if(G.token!==")")throw et(G,"Parenthesis ) expected");Y(G),T(G)}return new Pe(ue)}return he(G)}function he(G){var ue,Pe;return G.tokenType===w.SYMBOL||G.tokenType===w.DELIMITER&&G.token in k?(Pe=G.token,T(G),Et(j,Pe)?ue=new u(j[Pe]):O.indexOf(Pe)!==-1?ue=new u(r(Pe,"number")):ue=new b(Pe),ue=ze(G,ue),ue):Ye(G)}function ze(G,ue,Pe){for(var De;(G.token==="("||G.token==="["||G.token===".")&&(!Pe||Pe.indexOf(G.token)!==-1);)if(De=[],G.token==="(")if(ri(ue)||zu(ue)){if(_(G),T(G),G.token!==")")for(De.push(Q(G));G.token===",";)T(G),De.push(Q(G));if(G.token!==")")throw et(G,"Parenthesis ) expected");Y(G),T(G),ue=new f(ue,De)}else return ue;else if(G.token==="["){if(_(G),T(G),G.token!=="]")for(De.push(Q(G));G.token===",";)T(G),De.push(Q(G));if(G.token!=="]")throw et(G,"Parenthesis ] expected");Y(G),T(G),ue=new i(ue,new d(De))}else{T(G);var at=G.tokenType===w.SYMBOL||G.tokenType===w.DELIMITER&&G.token in k;if(!at)throw et(G,"Property name expected after dot");De.push(new u(G.token)),T(G);var ht=!0;ue=new i(ue,new d(De,ht))}return ue}function Ye(G){var ue,Pe;return G.token==='"'||G.token==="'"?(Pe=tt(G,G.token),ue=new u(Pe),ue=ze(G,ue),ue):Ct(G)}function tt(G,ue){for(var Pe="";P(G)!==""&&P(G)!==ue;)if(P(G)==="\\"){q(G);var De=P(G),at=C[De];if(at!==void 0)Pe+=at,G.index+=1;else if(De==="u"){var ht=G.expression.slice(G.index+1,G.index+5);if(/^[0-9A-Fa-f]{4}$/.test(ht))Pe+=String.fromCharCode(parseInt(ht,16)),G.index+=5;else throw et(G,"Invalid unicode character \\u".concat(ht))}else throw et(G,"Bad escape character \\".concat(De))}else Pe+=P(G),q(G);if(T(G),G.token!==ue)throw et(G,"End of string ".concat(ue," expected"));return T(G),Pe}function Ct(G){var ue,Pe,De,at;if(G.token==="["){if(_(G),T(G),G.token!=="]"){var ht=we(G);if(G.token===";"){for(De=1,Pe=[ht];G.token===";";)T(G),G.token!=="]"&&(Pe[De]=we(G),De++);if(G.token!=="]")throw et(G,"End of matrix ] expected");Y(G),T(G),at=Pe[0].items.length;for(var Yt=1;Yt{var{typed:t,parse:r}=e;return t(gfe,{string:function(i){return r(i).compile()},"Array | Matrix":function(i){return jt(i,function(a){return r(a).compile()})}})});var vfe="evaluate",xUe=["typed","parse"],R4=V(vfe,xUe,e=>{var{typed:t,parse:r}=e;return t(vfe,{string:function(i){var a=U0();return r(i).compile().evaluate(a)},"string, Map | Object":function(i,a){return r(i).compile().evaluate(a)},"Array | Matrix":function(i){var a=U0();return jt(i,function(o){return r(o).compile().evaluate(a)})},"Array | Matrix, Map | Object":function(i,a){return jt(i,function(o){return r(o).compile().evaluate(a)})}})});var wUe="Parser",SUe=["evaluate"],$4=V(wUe,SUe,e=>{var{evaluate:t}=e;function r(){if(!(this instanceof r))throw new SyntaxError("Constructor must be called with the new operator");Object.defineProperty(this,"scope",{value:U0(),writable:!1})}return r.prototype.type="Parser",r.prototype.isParser=!0,r.prototype.evaluate=function(n){return t(n,this.scope)},r.prototype.get=function(n){if(this.scope.has(n))return this.scope.get(n)},r.prototype.getAll=function(){return Mse(this.scope)},r.prototype.getAllAsMap=function(){return this.scope},r.prototype.set=function(n,i){return this.scope.set(n,i),i},r.prototype.remove=function(n){this.scope.delete(n)},r.prototype.clear=function(){this.scope.clear()},r},{isClass:!0});var yfe="parser",EUe=["typed","Parser"],q4=V(yfe,EUe,e=>{var{typed:t,Parser:r}=e;return t(yfe,{"":function(){return new r}})});var bfe="lup",kUe=["typed","matrix","abs","addScalar","divideScalar","multiplyScalar","subtractScalar","larger","equalScalar","unaryMinus","DenseMatrix","SparseMatrix","Spa"],L4=V(bfe,kUe,e=>{var{typed:t,matrix:r,abs:n,addScalar:i,divideScalar:a,multiplyScalar:o,subtractScalar:s,larger:l,equalScalar:u,unaryMinus:c,DenseMatrix:f,SparseMatrix:d,Spa:p}=e;return t(bfe,{DenseMatrix:function(A){return h(A)},SparseMatrix:function(A){return m(A)},Array:function(A){var b=r(A),v=h(b);return{L:v.L.valueOf(),U:v.U.valueOf(),p:v.p}}});function h(g){var A=g._size[0],b=g._size[1],v=Math.min(A,b),x=Bt(g._data),w=[],S=[A,v],k=[],j=[v,b],O,C,N,D=[];for(O=0;O0)for(O=0;O0?new s(Pe):(ue||(ue=new u(void 0),G.comment&&(ue.comment=G.comment)),ue)}function Q(G){var ue,Pe,De,at,ht=fe(G);if(G.token==="="){if(ri(ht))return ue=ht.name,L(G),De=Q(G),new o(new b(ue),De);if(zu(ht))return L(G),De=Q(G),new o(ht.object,ht.index,De);if(xl(ht)&&ri(ht.fn)&&(at=!0,Pe=[],ue=ht.name,ht.args.forEach(function(Yt,Wr){ri(Yt)?Pe[Wr]=Yt.name:at=!1}),at))return L(G),De=Q(G),new c(ue,Pe,De);throw et(G,"Invalid left hand side of assignment operator =")}return ht}function fe(G){for(var ue=Ie(G);G.token==="?";){var Pe=G.conditionalLevel;G.conditionalLevel=G.nestingLevel,L(G);var De=ue,at=Q(G);if(G.token!==":")throw et(G,"False part of conditional expression expected");G.conditionalLevel=null,L(G);var ht=Q(G);ue=new l(De,at,ht),G.conditionalLevel=Pe}return ue}function Ie(G){for(var ue=Se(G);G.token==="or";)L(G),ue=new h("or","or",[ue,Se(G)]);return ue}function Se(G){for(var ue=Oe(G);G.token==="xor";)L(G),ue=new h("xor","xor",[ue,Oe(G)]);return ue}function Oe(G){for(var ue=ve(G);G.token==="and";)L(G),ue=new h("and","and",[ue,ve(G)]);return ue}function ve(G){for(var ue=ye(G);G.token==="|";)L(G),ue=new h("|","bitOr",[ue,ye(G)]);return ue}function ye(G){for(var ue=me(G);G.token==="^|";)L(G),ue=new h("^|","bitXor",[ue,me(G)]);return ue}function me(G){for(var ue=ke(G);G.token==="&";)L(G),ue=new h("&","bitAnd",[ue,ke(G)]);return ue}function ke(G){for(var ue=[$(G)],Pe=[],De={"==":"equal","!=":"unequal","<":"smaller",">":"larger","<=":"smallerEq",">=":"largerEq"};Et(De,G.token);){var at={name:G.token,fn:De[G.token]};Pe.push(at),L(G),ue.push($(G))}return ue.length===1?ue[0]:ue.length===2?new h(Pe[0].name,Pe[0].fn,ue):new A(Pe.map(ht=>ht.fn),ue)}function $(G){var ue,Pe,De,at;ue=ae(G);for(var ht={"<<":"leftShift",">>":"rightArithShift",">>>":"rightLogShift"};Et(ht,G.token);)Pe=G.token,De=ht[Pe],L(G),at=[ue,ae(G)],ue=new h(Pe,De,at);return ue}function ae(G){var ue,Pe,De,at;ue=ce(G);for(var ht={to:"to",in:"to"};Et(ht,G.token);)Pe=G.token,De=ht[Pe],L(G),Pe==="in"&&G.token===""?ue=new h("*","multiply",[ue,new b("in")],!0):(at=[ue,ce(G)],ue=new h(Pe,De,at));return ue}function ce(G){var ue,Pe=[];if(G.token===":"?ue=new u(1):ue=U(G),G.token===":"&&G.conditionalLevel!==G.nestingLevel){for(Pe.push(ue);G.token===":"&&Pe.length<3;)L(G),G.token===")"||G.token==="]"||G.token===","||G.token===""?Pe.push(new b("end")):Pe.push(U(G));Pe.length===3?ue=new g(Pe[0],Pe[2],Pe[1]):ue=new g(Pe[0],Pe[1])}return ue}function U(G){var ue,Pe,De,at;ue=R(G);for(var ht={"+":"add","-":"subtract"};Et(ht,G.token);){Pe=G.token,De=ht[Pe],L(G);var Yt=R(G);Yt.isPercentage?at=[ue,new h("*","multiply",[ue,Yt])]:at=[ue,Yt],ue=new h(Pe,De,at)}return ue}function R(G){var ue,Pe,De,at;ue=J(G),Pe=ue;for(var ht={"*":"multiply",".*":"dotMultiply","/":"divide","./":"dotDivide"};Et(ht,G.token);)De=G.token,at=ht[De],L(G),Pe=J(G),ue=new h(De,at,[ue,Pe]);return ue}function J(G){var ue,Pe;for(ue=ee(G),Pe=ue;G.tokenType===w.SYMBOL||G.token==="in"&&vr(ue)||G.tokenType===w.NUMBER&&!vr(Pe)&&(!xi(Pe)||Pe.op==="!")||G.token==="(";)Pe=ee(G),ue=new h("*","multiply",[ue,Pe],!0);return ue}function ee(G){for(var ue=ie(G),Pe=ue,De=[];G.token==="/"&&$6(Pe);)if(De.push(Fn({},G)),L(G),G.tokenType===w.NUMBER)if(De.push(Fn({},G)),L(G),G.tokenType===w.SYMBOL||G.token==="(")Fn(G,De.pop()),De.pop(),Pe=ie(G),ue=new h("/","divide",[ue,Pe]);else{De.pop(),Fn(G,De.pop());break}else{Fn(G,De.pop());break}return ue}function ie(G){var ue,Pe,De,at;ue=re(G);for(var ht={"%":"mod",mod:"mod"};Et(ht,G.token);)Pe=G.token,De=ht[Pe],L(G),Pe==="%"&&G.tokenType===w.DELIMITER&&G.token!=="("?ue=new h("/","divide",[ue,new u(100)],!1,!0):(at=[ue,re(G)],ue=new h(Pe,De,at));return ue}function re(G){var ue,Pe,De,at={"-":"unaryMinus","+":"unaryPlus","~":"bitNot",not:"not"};return Et(at,G.token)?(De=at[G.token],ue=G.token,L(G),Pe=[re(G)],new h(ue,De,Pe)):Ee(G)}function Ee(G){var ue,Pe,De,at;return ue=Ce(G),(G.token==="^"||G.token===".^")&&(Pe=G.token,De=Pe==="^"?"pow":"dotPow",L(G),at=[ue,re(G)],ue=new h(Pe,De,at)),ue}function Ce(G){var ue,Pe,De,at;ue=_e(G);for(var ht={"!":"factorial","'":"ctranspose"};Et(ht,G.token);)Pe=G.token,De=ht[Pe],T(G),at=[ue],ue=new h(Pe,De,at),ue=ze(G,ue);return ue}function _e(G){var ue=[];if(G.tokenType===w.SYMBOL&&Et(G.extraNodes,G.token)){var Pe=G.extraNodes[G.token];if(T(G),G.token==="("){if(ue=[],_(G),T(G),G.token!==")")for(ue.push(Q(G));G.token===",";)T(G),ue.push(Q(G));if(G.token!==")")throw et(G,"Parenthesis ) expected");Y(G),T(G)}return new Pe(ue)}return he(G)}function he(G){var ue,Pe;return G.tokenType===w.SYMBOL||G.tokenType===w.DELIMITER&&G.token in k?(Pe=G.token,T(G),Et(j,Pe)?ue=new u(j[Pe]):O.indexOf(Pe)!==-1?ue=new u(r(Pe,"number")):ue=new b(Pe),ue=ze(G,ue),ue):Ye(G)}function ze(G,ue,Pe){for(var De;(G.token==="("||G.token==="["||G.token===".")&&(!Pe||Pe.indexOf(G.token)!==-1);)if(De=[],G.token==="(")if(ri(ue)||zu(ue)){if(_(G),T(G),G.token!==")")for(De.push(Q(G));G.token===",";)T(G),De.push(Q(G));if(G.token!==")")throw et(G,"Parenthesis ) expected");Y(G),T(G),ue=new f(ue,De)}else return ue;else if(G.token==="["){if(_(G),T(G),G.token!=="]")for(De.push(Q(G));G.token===",";)T(G),De.push(Q(G));if(G.token!=="]")throw et(G,"Parenthesis ] expected");Y(G),T(G),ue=new i(ue,new d(De))}else{T(G);var at=G.tokenType===w.SYMBOL||G.tokenType===w.DELIMITER&&G.token in k;if(!at)throw et(G,"Property name expected after dot");De.push(new u(G.token)),T(G);var ht=!0;ue=new i(ue,new d(De,ht))}return ue}function Ye(G){var ue,Pe;return G.token==='"'||G.token==="'"?(Pe=tt(G,G.token),ue=new u(Pe),ue=ze(G,ue),ue):Ct(G)}function tt(G,ue){for(var Pe="";P(G)!==""&&P(G)!==ue;)if(P(G)==="\\"){q(G);var De=P(G),at=C[De];if(at!==void 0)Pe+=at,G.index+=1;else if(De==="u"){var ht=G.expression.slice(G.index+1,G.index+5);if(/^[0-9A-Fa-f]{4}$/.test(ht))Pe+=String.fromCharCode(parseInt(ht,16)),G.index+=5;else throw et(G,"Invalid unicode character \\u".concat(ht))}else throw et(G,"Bad escape character \\".concat(De))}else Pe+=P(G),q(G);if(T(G),G.token!==ue)throw et(G,"End of string ".concat(ue," expected"));return T(G),Pe}function Ct(G){var ue,Pe,De,at;if(G.token==="["){if(_(G),T(G),G.token!=="]"){var ht=we(G);if(G.token===";"){for(De=1,Pe=[ht];G.token===";";)T(G),G.token!=="]"&&(Pe[De]=we(G),De++);if(G.token!=="]")throw et(G,"End of matrix ] expected");Y(G),T(G),at=Pe[0].items.length;for(var Yt=1;Yt{var{typed:t,parse:r}=e;return t(gfe,{string:function(i){return r(i).compile()},"Array | Matrix":function(i){return jt(i,function(a){return r(a).compile()})}})});var vfe="evaluate",SUe=["typed","parse"],R4=V(vfe,SUe,e=>{var{typed:t,parse:r}=e;return t(vfe,{string:function(i){var a=U0();return r(i).compile().evaluate(a)},"string, Map | Object":function(i,a){return r(i).compile().evaluate(a)},"Array | Matrix":function(i){var a=U0();return jt(i,function(o){return r(o).compile().evaluate(a)})},"Array | Matrix, Map | Object":function(i,a){return jt(i,function(o){return r(o).compile().evaluate(a)})}})});var EUe="Parser",kUe=["evaluate"],$4=V(EUe,kUe,e=>{var{evaluate:t}=e;function r(){if(!(this instanceof r))throw new SyntaxError("Constructor must be called with the new operator");Object.defineProperty(this,"scope",{value:U0(),writable:!1})}return r.prototype.type="Parser",r.prototype.isParser=!0,r.prototype.evaluate=function(n){return t(n,this.scope)},r.prototype.get=function(n){if(this.scope.has(n))return this.scope.get(n)},r.prototype.getAll=function(){return Mse(this.scope)},r.prototype.getAllAsMap=function(){return this.scope},r.prototype.set=function(n,i){return this.scope.set(n,i),i},r.prototype.remove=function(n){this.scope.delete(n)},r.prototype.clear=function(){this.scope.clear()},r},{isClass:!0});var yfe="parser",CUe=["typed","Parser"],q4=V(yfe,CUe,e=>{var{typed:t,Parser:r}=e;return t(yfe,{"":function(){return new r}})});var bfe="lup",DUe=["typed","matrix","abs","addScalar","divideScalar","multiplyScalar","subtractScalar","larger","equalScalar","unaryMinus","DenseMatrix","SparseMatrix","Spa"],L4=V(bfe,DUe,e=>{var{typed:t,matrix:r,abs:n,addScalar:i,divideScalar:a,multiplyScalar:o,subtractScalar:s,larger:l,equalScalar:u,unaryMinus:c,DenseMatrix:f,SparseMatrix:d,Spa:p}=e;return t(bfe,{DenseMatrix:function(A){return h(A)},SparseMatrix:function(A){return m(A)},Array:function(A){var b=r(A),v=h(b);return{L:v.L.valueOf(),U:v.U.valueOf(),p:v.p}}});function h(g){var A=g._size[0],b=g._size[1],v=Math.min(A,b),x=Bt(g._data),w=[],S=[A,v],k=[],j=[v,b],O,C,N,D=[];for(O=0;O0)for(O=0;O0&&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(xfe,{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 Sfe(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);kfe(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=U4(_,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=Cfe({add:t,multiply:r,transpose:n}),a=Ofe({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?wfe(u,null,m.q,0):u;m.parent=Efe(g,1);var A=Sfe(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;X6(o,e)||(W4(o,e),n[l+d]=p<0?0:DH(o[p]));var h=1;for(c=n[l+d],f=p<0?0:DH(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=Nfe(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=Tfe({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=Mfe({add:n,multiply:i,transpose:a}),d=Ffe({abs:r,divideScalar:o,multiply:i,subtract:s,larger:l,largerEq:u,SparseMatrix:c});return t(_fe,{"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()+` +P: `+this.p}}}});var xfe="qr",OUe=["typed","matrix","zeros","identity","isZero","equal","sign","sqrt","conj","unaryMinus","addScalar","divideScalar","multiplyScalar","subtractScalar","complex"],z4=V(xfe,OUe,e=>{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(xfe,{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 Sfe(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);kfe(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=U4(_,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=Cfe({add:t,multiply:r,transpose:n}),a=Ofe({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?wfe(u,null,m.q,0):u;m.parent=Efe(g,1);var A=Sfe(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;X6(o,e)||(W4(o,e),n[l+d]=p<0?0:MH(o[p]));var h=1;for(c=n[l+d],f=p<0?0:MH(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=Nfe(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=Tfe({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=Mfe({add:n,multiply:i,transpose:a}),d=Ffe({abs:r,divideScalar:o,multiply:i,subtract:s,larger:l,largerEq:u,SparseMatrix:c});return t(_fe,{"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():"")+` -`}}}})});function OH(e,t){var r,n=t.length,i=[];if(e)for(r=0;r{var{typed:t,matrix:r,lup:n,slu:i,usolve:a,lsolve:o,DenseMatrix:s}=e,l=Zm({DenseMatrix:s});return t(Pfe,{"Array, Array | Matrix":function(d,p){d=r(d);var h=n(d),m=c(h.L,h.U,h.p,null,p);return m.valueOf()},"DenseMatrix, Array | Matrix":function(d,p){var h=n(d);return c(h.L,h.U,h.p,null,p)},"SparseMatrix, Array | Matrix":function(d,p){var h=n(d);return c(h.L,h.U,h.p,null,p)},"SparseMatrix, Array | Matrix, number, number":function(d,p,h,m){var g=i(d,h,m);return c(g.L,g.U,g.p,g.q,p)},"Object, Array | Matrix":function(d,p){return c(d.L,d.U,d.p,d.q,p)}});function u(f){if(St(f))return f;if(Ir(f))return r(f);throw new TypeError("Invalid Matrix LU decomposition")}function c(f,d,p,h,m){f=u(f),d=u(d),p&&(m=l(f,m,!0),m._data=OH(p,m._data));var g=o(f,m),A=a(d,g);return h&&(A._data=OH(h,A._data)),A}});var Ife="polynomialRoot",$Ue=["typed","isZero","equalScalar","add","subtract","multiply","divide","sqrt","unaryMinus","cbrt","typeOf","im","re"],G4=V(Ife,$Ue,e=>{var{typed:t,isZero:r,equalScalar:n,add:i,subtract:a,multiply:o,divide:s,sqrt:l,unaryMinus:u,cbrt:c,typeOf:f,im:d,re:p}=e;return t(Ife,{"number|Complex, ...number|Complex":(h,m)=>{for(var g=[h,...m];g.length>0&&r(g[g.length-1]);)g.pop();if(g.length<2)throw new RangeError("Polynomial [".concat(h,", ").concat(m,"] must have a non-zero non-constant coefficient"));switch(g.length){case 2:return[u(s(g[0],g[1]))];case 3:{var[A,b,v]=g,x=o(2,v),w=o(b,b),S=o(4,v,A);if(n(w,S))return[s(u(b),x)];var k=l(a(w,S));return[s(a(k,b),x),s(a(u(k),b),x)]}case 4:{var[j,O,C,N]=g,D=u(o(3,N)),P=o(C,C),q=o(3,N,O),z=i(o(2,C,C,C),o(27,N,N,j)),I=o(9,N,C,O);if(n(P,q)&&n(z,I))return[s(C,D)];var T=a(P,q),L=a(z,I),_=i(o(18,N,C,O,j),o(C,C,O,O)),Y=i(o(4,C,C,C,j),o(4,N,O,O,O),o(27,N,N,j,j));if(n(_,Y))return[s(a(o(4,N,C,O),i(o(9,N,N,j),o(C,C,C))),o(N,T)),s(a(o(9,N,j),o(C,O)),o(2,T))];var oe;n(P,q)?oe=L:oe=s(i(L,l(a(o(L,L),o(4,T,T,T)))),2);var te=!0,Q=c(oe,te).toArray().map(fe=>s(i(C,fe,s(T,fe)),D));return Q.map(fe=>f(fe)==="Complex"&&n(p(fe),p(fe)+d(fe))?p(fe):fe)}default:throw new RangeError("only implemented for cubic or lower-order polynomials, not ".concat(g))}}})});var qUe="Help",LUe=["evaluate"],Q4=V(qUe,LUe,e=>{var{evaluate:t}=e;function r(n){if(!(this instanceof r))throw new SyntaxError("Constructor must be called with the new operator");if(!n)throw new Error('Argument "doc" missing');this.doc=n}return r.prototype.type="Help",r.prototype.isHelp=!0,r.prototype.toString=function(){var n=this.doc||{},i=` +`}}}})});function jH(e,t){var r,n=t.length,i=[];if(e)for(r=0;r{var{typed:t,matrix:r,lup:n,slu:i,usolve:a,lsolve:o,DenseMatrix:s}=e,l=Zm({DenseMatrix:s});return t(Pfe,{"Array, Array | Matrix":function(d,p){d=r(d);var h=n(d),m=c(h.L,h.U,h.p,null,p);return m.valueOf()},"DenseMatrix, Array | Matrix":function(d,p){var h=n(d);return c(h.L,h.U,h.p,null,p)},"SparseMatrix, Array | Matrix":function(d,p){var h=n(d);return c(h.L,h.U,h.p,null,p)},"SparseMatrix, Array | Matrix, number, number":function(d,p,h,m){var g=i(d,h,m);return c(g.L,g.U,g.p,g.q,p)},"Object, Array | Matrix":function(d,p){return c(d.L,d.U,d.p,d.q,p)}});function u(f){if(St(f))return f;if(Ir(f))return r(f);throw new TypeError("Invalid Matrix LU decomposition")}function c(f,d,p,h,m){f=u(f),d=u(d),p&&(m=l(f,m,!0),m._data=jH(p,m._data));var g=o(f,m),A=a(d,g);return h&&(A._data=jH(h,A._data)),A}});var Ife="polynomialRoot",LUe=["typed","isZero","equalScalar","add","subtract","multiply","divide","sqrt","unaryMinus","cbrt","typeOf","im","re"],G4=V(Ife,LUe,e=>{var{typed:t,isZero:r,equalScalar:n,add:i,subtract:a,multiply:o,divide:s,sqrt:l,unaryMinus:u,cbrt:c,typeOf:f,im:d,re:p}=e;return t(Ife,{"number|Complex, ...number|Complex":(h,m)=>{for(var g=[h,...m];g.length>0&&r(g[g.length-1]);)g.pop();if(g.length<2)throw new RangeError("Polynomial [".concat(h,", ").concat(m,"] must have a non-zero non-constant coefficient"));switch(g.length){case 2:return[u(s(g[0],g[1]))];case 3:{var[A,b,v]=g,x=o(2,v),w=o(b,b),S=o(4,v,A);if(n(w,S))return[s(u(b),x)];var k=l(a(w,S));return[s(a(k,b),x),s(a(u(k),b),x)]}case 4:{var[j,O,C,N]=g,D=u(o(3,N)),P=o(C,C),q=o(3,N,O),z=i(o(2,C,C,C),o(27,N,N,j)),I=o(9,N,C,O);if(n(P,q)&&n(z,I))return[s(C,D)];var T=a(P,q),L=a(z,I),_=i(o(18,N,C,O,j),o(C,C,O,O)),Y=i(o(4,C,C,C,j),o(4,N,O,O,O),o(27,N,N,j,j));if(n(_,Y))return[s(a(o(4,N,C,O),i(o(9,N,N,j),o(C,C,C))),o(N,T)),s(a(o(9,N,j),o(C,O)),o(2,T))];var oe;n(P,q)?oe=L:oe=s(i(L,l(a(o(L,L),o(4,T,T,T)))),2);var te=!0,Q=c(oe,te).toArray().map(fe=>s(i(C,fe,s(T,fe)),D));return Q.map(fe=>f(fe)==="Complex"&&n(p(fe),p(fe)+d(fe))?p(fe):fe)}default:throw new RangeError("only implemented for cubic or lower-order polynomials, not ".concat(g))}}})});var zUe="Help",UUe=["evaluate"],Q4=V(zUe,UUe,e=>{var{evaluate:t}=e;function r(n){if(!(this instanceof r))throw new SyntaxError("Constructor must be called with the new operator");if(!n)throw new Error('Argument "doc" missing');this.doc=n}return r.prototype.type="Help",r.prototype.isHelp=!0,r.prototype.toString=function(){var n=this.doc||{},i=` `;if(n.name&&(i+="Name: "+n.name+` `),n.category&&(i+="Category: "+n.category+` @@ -119,18 +119,18 @@ q: `+this.q.toString():"")+` `,a&&t("config(originalConfig)",{originalConfig:o})}return n.mayThrow&&n.mayThrow.length&&(i+="Throws: "+n.mayThrow.join(", ")+` `),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 zUe="Chain",UUe=["?on","math","typed"],Y4=V(zUe,UUe,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 rr(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 MH={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 Bfe={name:"false",category:"Constants",syntax:["false"],description:"Boolean value false",examples:["false"],seealso:["true"]};var Rfe={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 $fe={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 qfe={name:"LN10",category:"Constants",syntax:["LN10"],description:"Returns the natural logarithm of 10, approximately equal to 2.302",examples:["LN10","log(10)"],seealso:[]};var Lfe={name:"LN2",category:"Constants",syntax:["LN2"],description:"Returns the natural logarithm of 2, approximately equal to 0.693",examples:["LN2","log(2)"],seealso:[]};var zfe={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 Ufe={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 Wfe={name:"NaN",category:"Constants",syntax:["NaN"],description:"Not a number",examples:["NaN","0 / 0"],seealso:[]};var Hfe={name:"null",category:"Constants",syntax:["null"],description:"Value null",examples:["null"],seealso:["true","false"]};var Vfe={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 jH={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 Gfe={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 Qfe={name:"SQRT2",category:"Constants",syntax:["SQRT2"],description:"Returns the square root of 2, approximately equal to 1.414",examples:["SQRT2","sqrt(2)"],seealso:[]};var Yfe={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 Zfe={name:"true",category:"Constants",syntax:["true"],description:"Boolean value true",examples:["true"],seealso:["false"]};var Xfe={name:"version",category:"Constants",syntax:["version"],description:"A string with the version number of math.js",examples:["version"],seealso:[]};var Kfe={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 Jfe={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 ede={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 tde={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 rde={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 nde={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 ide={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 ade={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 ode={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 sde={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 lde={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 ude={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 cde={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 fde={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 dde={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 pde={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 mde={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 hde={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 Ade={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 gde={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 vde={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 yde={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 bde={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 xde={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 wde={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 Sde={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 Ede={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 kde={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 Cde={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 Dde={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 Ode={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 Mde={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 jde={name:"abs",category:"Arithmetic",syntax:["abs(x)"],description:"Compute the absolute value.",examples:["abs(3.5)","abs(-4.2)"],seealso:["sign"]};var Nde={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 Tde={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 Fde={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 _de={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 Pde={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 Ide={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 Bde={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 Rde={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 $de={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 qde={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 Lde={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 zde={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 Ude={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 Wde={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 Hde={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 Vde={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 Gde={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 Qde={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 Yde={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 Zde={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 Xde={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 Kde={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 Jde={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 epe={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 tpe={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 rpe={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 npe={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 ipe={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 ape={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 ope={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 spe={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 lpe={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 upe={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 cpe={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 fpe={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 dpe={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 ppe={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 mpe={name:"unaryPlus",category:"Operators",syntax:["+x","unaryPlus(x)"],description:"Converts booleans and strings to numbers.",examples:["+true",'+"2"'],seealso:["add","subtract","unaryMinus"]};var hpe={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 Ape={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 gpe={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 vpe={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 ype={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 bpe={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 xpe={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 wpe={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 Spe={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 Epe={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 kpe={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 Cpe={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 Dpe={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 Ope={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 Mpe={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 jpe={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 Npe={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 Tpe={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 Fpe={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 _pe={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 Ppe={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 Ipe={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 Bpe={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 Rpe={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 $pe={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 qpe={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 Lpe={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 zpe={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 Upe={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 Wpe={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 Hpe={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 Vpe={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 Gpe={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 Qpe={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 Ype={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 Zpe={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 Xpe={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 Kpe={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 Jpe={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 eme={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 tme={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 rme={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 nme={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 ime={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 ame={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 ome={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 sme={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 lme={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 ume={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 cme={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 fme={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 dme={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 pme={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 mme={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 hme={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 Ame={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 gme={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 vme={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 yme={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 bme={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 xme={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 wme={name:"fft",category:"Matrix",syntax:["fft(x)"],description:"Calculate N-dimensional fourier transform",examples:["fft([[1, 0], [1, 0]])"],seealso:["ifft"]};var Sme={name:"ifft",category:"Matrix",syntax:["ifft(x)"],description:"Calculate N-dimensional inverse fourier transform",examples:["ifft([[2, 2], [0, 0]])"],seealso:["fft"]};var Eme={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 kme={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 Cme={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 Dme={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 Ome={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 Mme={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 jme={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 Nme={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 Tme={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 Fme={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 _me={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 Pme={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 Ime={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 Bme={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 Rme={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 $me={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 qme={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 Lme={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 zme={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 Ume={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 Wme={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 Hme={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 Vme={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 Gme={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 Qme={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 Yme={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 Zme={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 Xme={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 Kme={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 Jme={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 ehe={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 the={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 rhe={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 nhe={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 ihe={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 ahe={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 ohe={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 she={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 lhe={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 uhe={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 che={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 fhe={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 dhe={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 phe={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. +`),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 WUe="Chain",HUe=["?on","math","typed"],Y4=V(WUe,HUe,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 rr(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 NH={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 Bfe={name:"false",category:"Constants",syntax:["false"],description:"Boolean value false",examples:["false"],seealso:["true"]};var Rfe={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 $fe={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 qfe={name:"LN10",category:"Constants",syntax:["LN10"],description:"Returns the natural logarithm of 10, approximately equal to 2.302",examples:["LN10","log(10)"],seealso:[]};var Lfe={name:"LN2",category:"Constants",syntax:["LN2"],description:"Returns the natural logarithm of 2, approximately equal to 0.693",examples:["LN2","log(2)"],seealso:[]};var zfe={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 Ufe={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 Wfe={name:"NaN",category:"Constants",syntax:["NaN"],description:"Not a number",examples:["NaN","0 / 0"],seealso:[]};var Hfe={name:"null",category:"Constants",syntax:["null"],description:"Value null",examples:["null"],seealso:["true","false"]};var Vfe={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 TH={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 Gfe={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 Qfe={name:"SQRT2",category:"Constants",syntax:["SQRT2"],description:"Returns the square root of 2, approximately equal to 1.414",examples:["SQRT2","sqrt(2)"],seealso:[]};var Yfe={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 Zfe={name:"true",category:"Constants",syntax:["true"],description:"Boolean value true",examples:["true"],seealso:["false"]};var Xfe={name:"version",category:"Constants",syntax:["version"],description:"A string with the version number of math.js",examples:["version"],seealso:[]};var Kfe={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 Jfe={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 ede={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 tde={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 rde={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 nde={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 ide={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 ade={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 ode={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 sde={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 lde={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 ude={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 cde={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 fde={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 dde={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 pde={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 mde={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 hde={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 Ade={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 gde={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 vde={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 yde={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 bde={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 xde={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 wde={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 Sde={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 Ede={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 kde={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 Cde={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 Dde={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 Ode={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 Mde={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 jde={name:"abs",category:"Arithmetic",syntax:["abs(x)"],description:"Compute the absolute value.",examples:["abs(3.5)","abs(-4.2)"],seealso:["sign"]};var Nde={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 Tde={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 Fde={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 _de={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 Pde={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 Ide={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 Bde={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 Rde={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 $de={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 qde={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 Lde={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 zde={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 Ude={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 Wde={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 Hde={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 Vde={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 Gde={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 Qde={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 Yde={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 Zde={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 Xde={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 Kde={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 Jde={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 epe={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 tpe={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 rpe={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 npe={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 ipe={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 ape={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 ope={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 spe={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 lpe={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 upe={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 cpe={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 fpe={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 dpe={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 ppe={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 mpe={name:"unaryPlus",category:"Operators",syntax:["+x","unaryPlus(x)"],description:"Converts booleans and strings to numbers.",examples:["+true",'+"2"'],seealso:["add","subtract","unaryMinus"]};var hpe={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 Ape={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 gpe={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 vpe={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 ype={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 bpe={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 xpe={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 wpe={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 Spe={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 Epe={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 kpe={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 Cpe={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 Dpe={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 Ope={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 Mpe={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 jpe={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 Npe={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 Tpe={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 Fpe={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 _pe={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 Ppe={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 Ipe={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 Bpe={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 Rpe={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 $pe={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 qpe={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 Lpe={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 zpe={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 Upe={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 Wpe={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 Hpe={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 Vpe={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 Gpe={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 Qpe={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 Ype={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 Zpe={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 Xpe={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 Kpe={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 Jpe={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 eme={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 tme={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 rme={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 nme={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 ime={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 ame={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 ome={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 sme={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 lme={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 ume={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 cme={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 fme={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 dme={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 pme={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 mme={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 hme={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 Ame={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 gme={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 vme={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 yme={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 bme={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 xme={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 wme={name:"fft",category:"Matrix",syntax:["fft(x)"],description:"Calculate N-dimensional fourier transform",examples:["fft([[1, 0], [1, 0]])"],seealso:["ifft"]};var Sme={name:"ifft",category:"Matrix",syntax:["ifft(x)"],description:"Calculate N-dimensional inverse fourier transform",examples:["ifft([[2, 2], [0, 0]])"],seealso:["fft"]};var Eme={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 kme={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 Cme={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 Dme={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 Ome={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 Mme={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 jme={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 Nme={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 Tme={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 Fme={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 _me={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 Pme={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 Ime={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 Bme={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 Rme={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 $me={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 qme={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 Lme={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 zme={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 Ume={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 Wme={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 Hme={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 Vme={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 Gme={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 Qme={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 Yme={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 Zme={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 Xme={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 Kme={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 Jme={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 ehe={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 the={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 rhe={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 nhe={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 ihe={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 ahe={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 ohe={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 she={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 lhe={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 uhe={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 che={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 fhe={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 dhe={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 phe={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 mhe={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 hhe={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 Ahe={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 ghe={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 vhe={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 yhe={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 bhe={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 xhe={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 whe={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 She={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 Ehe={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 khe={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 Che={name:"asech",category:"Trigonometry",syntax:["asech(x)"],description:"Calculate the inverse secant of a value.",examples:["asech(0.5)"],seealso:["acsch","acoth"]};var Dhe={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 Ohe={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 Mhe={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 jhe={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 Nhe={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 The={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 Fhe={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 _he={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 Phe={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 Ihe={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 Bhe={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 Rhe={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 $he={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 qhe={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 Lhe={name:"sinh",category:"Trigonometry",syntax:["sinh(x)"],description:"Compute the hyperbolic sine of x in radians.",examples:["sinh(0.5)"],seealso:["cosh","tanh"]};var zhe={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 Uhe={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 Whe={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 Hhe={name:"bin",category:"Utils",syntax:["bin(value)"],description:"Format a number as binary",examples:["bin(2)"],seealso:["oct","hex"]};var Vhe={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 Ghe={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 Qhe={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 Yhe={name:"hex",category:"Utils",syntax:["hex(value)"],description:"Format a number as hexadecimal",examples:["hex(240)"],seealso:["bin","oct"]};var Zhe={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 Xhe={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 Khe={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 Jhe={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 eAe={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 tAe={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 rAe={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 nAe={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 iAe={name:"oct",category:"Utils",syntax:["oct(value)"],description:"Format a number as octal",examples:["oct(56)"],seealso:["bin","hex"]};var aAe={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 oAe={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 sAe={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 lAe={bignumber:Kfe,boolean:Jfe,complex:ede,createUnit:tde,fraction:rde,index:nde,matrix:ide,number:ade,sparse:ode,splitUnit:sde,string:lde,unit:ude,e:MH,E:MH,false:Bfe,i:Rfe,Infinity:$fe,LN2:Lfe,LN10:qfe,LOG2E:Ufe,LOG10E:zfe,NaN:Wfe,null:Hfe,pi:jH,PI:jH,phi:Vfe,SQRT1_2:Gfe,SQRT2:Qfe,tau:Yfe,true:Zfe,version:Xfe,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:pde,lsolve:hde,lsolveAll:Ade,lup:gde,lusolve:vde,leafCount:mde,polynomialRoot:yde,resolve:wde,simplify:Sde,simplifyConstant:Ede,simplifyCore:kde,symbolicEqual:Dde,rationalize:xde,slu:Cde,usolve:Ode,usolveAll:Mde,qr:bde,abs:jde,add:Nde,cbrt:Tde,ceil:Fde,cube:_de,divide:Pde,dotDivide:Ide,dotMultiply:Bde,dotPow:Rde,exp:$de,expm:qde,expm1:Lde,fix:zde,floor:Ude,gcd:Wde,hypot:Hde,lcm:Gde,log:Qde,log2:Xde,log1p:Zde,log10:Yde,mod:Kde,multiply:Jde,norm:epe,nthRoot:tpe,nthRoots:rpe,pow:npe,round:ipe,sign:ape,sqrt:ope,sqrtm:spe,square:fpe,subtract:dpe,unaryMinus:ppe,unaryPlus:mpe,xgcd:hpe,invmod:Vde,bitAnd:Ape,bitNot:gpe,bitOr:vpe,bitXor:ype,leftShift:bpe,rightArithShift:xpe,rightLogShift:wpe,bellNumbers:Spe,catalan:Epe,composition:kpe,stirlingS2:Cpe,config:cde,import:fde,typed:dde,arg:Dpe,conj:Ope,re:jpe,im:Mpe,evaluate:Npe,help:Tpe,distance:Fpe,intersect:_pe,and:Ppe,not:Ipe,or:Bpe,xor:Rpe,concat:qpe,count:Lpe,cross:zpe,column:$pe,ctranspose:Upe,det:Wpe,diag:Hpe,diff:Vpe,dot:Gpe,getMatrixDataType:Kpe,identity:Jpe,filter:Ype,flatten:Zpe,forEach:Xpe,inv:eme,pinv:tme,eigs:Qpe,kron:rme,matrixFromFunction:ame,matrixFromRows:ome,matrixFromColumns:ime,map:nme,ones:sme,partitionSelect:lme,range:ume,resize:fme,reshape:cme,rotate:dme,rotationMatrix:pme,row:mme,size:hme,sort:Ame,squeeze:gme,subset:vme,trace:yme,transpose:bme,zeros:xme,fft:wme,ifft:Sme,sylvester:lpe,schur:upe,lyap:cpe,solveODE:sAe,combinations:Eme,combinationsWithRep:kme,factorial:Cme,gamma:Dme,kldivergence:Mme,lgamma:Ome,multinomial:jme,permutations:Nme,pickRandom:Tme,random:Fme,randomInt:_me,compare:Pme,compareNatural:Ime,compareText:Bme,deepEqual:Rme,equal:$me,equalText:qme,larger:Lme,largerEq:zme,smaller:Ume,smallerEq:Wme,unequal:Hme,setCartesian:Vme,setDifference:Gme,setDistinct:Qme,setIntersect:Yme,setIsSubset:Zme,setMultiplicity:Xme,setPowerset:Kme,setSize:Jme,setSymDifference:ehe,setUnion:the,zpk2tf:rhe,freqz:nhe,erf:ihe,zeta:ahe,cumsum:hhe,mad:ohe,max:she,mean:lhe,median:uhe,min:che,mode:fhe,prod:dhe,quantileSeq:phe,std:mhe,sum:Ahe,variance:ghe,corr:vhe,acos:yhe,acosh:bhe,acot:xhe,acoth:whe,acsc:She,acsch:Ehe,asec:khe,asech:Che,asin:Dhe,asinh:Ohe,atan:Mhe,atanh:Nhe,atan2:jhe,cos:The,cosh:Fhe,cot:_he,coth:Phe,csc:Ihe,csch:Bhe,sec:Rhe,sech:$he,sin:qhe,sinh:Lhe,tan:zhe,tanh:Uhe,to:Whe,clone:Vhe,format:Ghe,bin:Hhe,oct:iAe,hex:Yhe,isNaN:Xhe,isInteger:Zhe,isNegative:Khe,isNumeric:Jhe,hasNumericValue:Qhe,isPositive:eAe,isPrime:tAe,isZero:rAe,print:aAe,typeOf:oAe,numeric:nAe};var uAe="help",WUe=["typed","mathWithTransform","Help"],Z4=V(uAe,WUe,e=>{var{typed:t,mathWithTransform:r,Help:n}=e;return t(uAe,{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=Xi(lAe,s);if(!l){var u=typeof s=="function"?s.name:s;throw new Error('No documentation found on "'+u+'"')}return new n(l)}})});var cAe="chain",HUe=["typed","Chain"],X4=V(cAe,HUe,e=>{var{typed:t,Chain:r}=e;return t(cAe,{"":function(){return new r},any:function(i){return new r(i)}})});var fAe="det",VUe=["typed","matrix","subtractScalar","multiply","divideScalar","isZero","unaryMinus"],K4=V(fAe,VUe,e=>{var{typed:t,matrix:r,subtractScalar:n,multiply:i,divideScalar:a,isZero:o,unaryMinus:s}=e;return t(fAe,{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: "+rr(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: "+rr(f)+")")}default:throw new RangeError("Matrix must be two dimensional (size: "+rr(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(dAe,{"Array | Matrix":function(d){var p=St(d)?d.size():Qt(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: "+rr(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: "+rr(p)+")")}default:throw new RangeError("Matrix must be two dimensional (size: "+rr(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(pAe,{"Array | Matrix":function(v){var x=St(v)?v.size():Qt(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: "+rr(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 mAe(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 hAe(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 YUe="eigs",ZUe=["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"],tP=V(YUe,ZUe,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=hAe({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}),_=mAe({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(rr(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(AAe,{Matrix:function(f){var d=f.size();if(d.length!==2||d[0]!==d[1])throw new RangeError("Matrix must be square (size: "+rr(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(gAe,{"Array | Matrix":function(g){var A=St(g)?g.size():Qt(g);switch(A.length){case 1:if(A[0]===1)return a(g,o);throw new RangeError("Matrix must be square (size: "+rr(A)+")");case 2:{var b=A[0],v=A[1];if(b===v)return h(g);throw new RangeError("Matrix must be square (size: "+rr(A)+")")}default:throw new RangeError("Matrix must be at most two dimensional (size: "+rr(A)+")")}}})});var vAe="sylvester",JUe=["typed","schur","matrixFromColumns","matrix","multiply","range","concat","transpose","index","subset","add","subtract","identity","lusolve","abs"],iP=V(vAe,JUe,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(vAe,{"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(yAe,{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 bAe="lyap",tWe=["typed","matrix","sylvester","multiply","transpose"],oP=V(bAe,tWe,e=>{var{typed:t,matrix:r,sylvester:n,multiply:i,transpose:a}=e;return t(bAe,{"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 rWe="divide",nWe=["typed","matrix","multiply","equalScalar","divideScalar","inv"],sP=V(rWe,nWe,e=>{var{typed:t,matrix:r,multiply:n,equalScalar:i,divideScalar:a,inv:o}=e,s=Qn({typed:t,equalScalar:i}),l=vo({typed:t});return t("divide",nT({"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 xAe="distance",iWe=["typed","addScalar","subtractScalar","divideScalar","multiplyScalar","deepEqual","sqrt","abs"],lP=V(xAe,iWe,e=>{var{typed:t,addScalar:r,subtractScalar:n,multiplyScalar:i,divideScalar:a,deepEqual:o,sqrt:s,abs:l}=e;return t(xAe,{"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 wAe="sum",sWe=["typed","config","add","numeric"],CS=V(wAe,sWe,e=>{var{typed:t,config:r,add:n,numeric:i}=e;return t(wAe,{"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=Q0(s,l,n);return u}catch(c){throw La(c,"sum")}}});var cP="cumsum",lWe=["typed","add","unaryPlus"],DS=V(cP,lWe,e=>{var{typed:t,add:r,unaryPlus:n}=e;return t(cP,{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,cP)}}function a(l){if(l.length===0)return[];for(var u=[n(l[0])],c=1;c=c.length)throw new gs(u,c.length);try{return s(l,u)}catch(f){throw La(f,cP)}}function s(l,u){var c,f,d;if(u<=0){var p=l[0][0];if(Array.isArray(p)){for(d=FT(l),f=[],c=0;c{var{typed:t,add:r,divide:n}=e;return t(SAe,{"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=Q0(o,s,r),u=Array.isArray(o)?Qt(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 EAe="median",cWe=["typed","add","divide","compare","partitionSelect"],fP=V(EAe,cWe,e=>{var{typed:t,add:r,divide:n,compare:i,partitionSelect:a}=e;function o(u){try{u=hr(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(EAe,{"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 kAe="mad",fWe=["typed","abs","map","median","subtract"],dP=V(kAe,fWe,e=>{var{typed:t,abs:r,map:n,median:i,subtract:a}=e;return t(kAe,{"Array | Matrix":o,"...":function(l){return o(l)}});function o(s){if(s=hr(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 NH="unbiased",CAe="variance",dWe=["typed","add","subtract","multiply","divide","apply","isNaN"],MS=V(CAe,dWe,e=>{var{typed:t,add:r,subtract:n,multiply:i,divide:a,apply:o,isNaN:s}=e;return t(CAe,{"Array | Matrix":function(f){return l(f,NH)},"Array | Matrix, string":l,"Array | Matrix, number | BigNumber":function(f,d){return u(f,d,NH)},"Array | Matrix, number | BigNumber, string":u,"...":function(f){return l(f,NH)}});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 DAe="quantileSeq",pWe=["typed","?bignumber","add","subtract","divide","multiply","partitionSelect","compare","isInteger","smaller","smallerEq","larger"],jS=V(DAe,pWe,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=Y0({typed:t,isInteger:u});return t(DAe,{"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 Gt(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 Gt(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 OAe="std",mWe=["typed","map","sqrt","variance"],NS=V(OAe,mWe,e=>{var{typed:t,map:r,sqrt:n,variance:i}=e;return t(OAe,{"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 Oa(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 MAe="corr",hWe=["typed","matrix","mean","sqrt","sum","add","subtract","multiply","pow","divide"],pP=V(MAe,hWe,e=>{var{typed:t,matrix:r,sqrt:n,sum:i,add:a,subtract:o,multiply:s,pow:l,divide:u}=e;return t(MAe,{"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 jAe="combinations",AWe=["typed"],mP=V(jAe,AWe,e=>{var{typed:t}=e;return t(jAe,{"number, number":WW,"BigNumber, BigNumber":function(n,i){var a=n.constructor,o,s,l=n.minus(i),u=new a(1);if(!NAe(n)||!NAe(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 NAe(e){return e.isInteger()&&e.gte(0)}var TAe="combinationsWithRep",gWe=["typed"],hP=V(TAe,gWe,e=>{var{typed:t}=e;return t(TAe,{"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 V6(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(Cy[0],0),p=1;p2;)d-=2,h+=d,p=p.times(h);return new a(p.toPrecision(a.precision))}});var PAe="lgamma",yWe=["Complex","typed"],gP=V(PAe,yWe,e=>{var{Complex:t,typed:r}=e,n=7,i=7,a=[-.029550653594771242,.00641025641025641,-.0019175269175269176,.0008417508417508417,-.0005952380952380953,.0007936507936507937,-.002777777777777778,.08333333333333333];return r(PAe,{number:G6,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(G6(u.re),0);if(u.re>=n||Math.abs(u.im)>=i)return s(u);if(u.re<=d){var p=dse(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(XW),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 IAe="factorial",bWe=["typed","gamma"],vP=V(IAe,bWe,e=>{var{typed:t,gamma:r}=e;return t(IAe,{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 BAe="kldivergence",xWe=["typed","matrix","divide","sum","multiply","map","dotDivide","log","isNumeric"],yP=V(BAe,xWe,e=>{var{typed:t,matrix:r,divide:n,sum:i,multiply:a,map:o,dotDivide:s,log:l,isNumeric:u}=e;return t(BAe,{"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 RAe="multinomial",wWe=["typed","add","divide","multiply","factorial","isInteger","isPositive"],bP=V(RAe,wWe,e=>{var{typed:t,add:r,divide:n,multiply:i,factorial:a,isInteger:o,isPositive:s}=e;return t(RAe,{"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 $Ae="permutations",SWe=["typed","factorial"],xP=V($Ae,SWe,e=>{var{typed:t,factorial:r}=e;return t($Ae,{"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(!qAe(i)||!qAe(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 qAe(e){return e.isInteger()&&e.gte(0)}var RH=Ae(rge(),1),jWe=(0,RH.default)(Date.now());function GA(e){var t;function r(i){t=i===null?jWe:(0,RH.default)(String(i))}r(e);function n(){return t()}return n}var nge="pickRandom",NWe=["typed","config","?on"],SP=V(nge,NWe,e=>{var{typed:t,config:r,on:n}=e,i=GA(r.randomSeed);return n&&n("config",function(o,s){o.randomSeed!==s.randomSeed&&(i=GA(o.randomSeed))}),t(nge,{"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=hr(o),u=hr(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=GA(r.randomSeed);return n&&n("config",function(s,l){s.randomSeed!==l.randomSeed&&(i=GA(s.randomSeed))}),t(ige,{"":()=>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=K6(s.valueOf(),()=>o(l,u));return St(s)?s.create(c):c}function o(s,l){return s+i()*(l-s)}});var age="randomInt",FWe=["typed","config","?on"],kP=V(age,FWe,e=>{var{typed:t,config:r,on:n}=e,i=GA(r.randomSeed);return n&&n("config",function(s,l){s.randomSeed!==l.randomSeed&&(i=GA(s.randomSeed))}),t(age,{"":()=>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=K6(s.valueOf(),()=>o(l,u));return St(s)?s.create(c):c}function o(s,l){return Math.floor(s+i()*(l-s))}});var oge="stirlingS2",_We=["typed","addScalar","subtractScalar","multiplyScalar","divideScalar","pow","factorial","combinations","isNegative","isInteger","number","?bignumber","larger"],CP=V(oge,_We,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(oge,{"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=!(Gt(A)&&Gt(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 sge="bellNumbers",PWe=["typed","addScalar","isNegative","isInteger","stirlingS2"],DP=V(sge,PWe,e=>{var{typed:t,addScalar:r,isNegative:n,isInteger:i,stirlingS2:a}=e;return t(sge,{"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 lge="catalan",IWe=["typed","addScalar","divideScalar","multiplyScalar","combinations","isNegative","isInteger"],OP=V(lge,IWe,e=>{var{typed:t,addScalar:r,divideScalar:n,multiplyScalar:i,combinations:a,isNegative:o,isInteger:s}=e;return t(lge,{"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 uge="composition",BWe=["typed","addScalar","combinations","isNegative","isPositive","isInteger","larger"],MP=V(uge,BWe,e=>{var{typed:t,addScalar:r,combinations:n,isPositive:i,isNegative:a,isInteger:o,larger:s}=e;return t(uge,{"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 cge="leafCount",RWe=["parse","typed"],jP=V(cge,RWe,e=>{var{parse:t,typed:r}=e;function n(i){var a=0;return i.forEach(o=>{a+=n(o)}),a||1}return r(cge,{Node:function(a){return n(a)}})});function $H(e){return vr(e)||xi(e)&&e.isUnary()&&vr(e.args[0])}function J6(e){return!!(vr(e)||(xl(e)||xi(e))&&e.args.every(J6)||hs(e)&&J6(e.content))}function fge(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 qH(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:xi(v)?S=v.fn.toString():xl(v)?S=v.name:hs(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=qH({},v);for(var S in x)Et(v,S)?w[S]=qH(qH({},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 xi(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 LWe="simplify",zWe=["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"],NP=V(LWe,zWe,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:UA});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:UA}),te.defaultContext=_,te.realContext=Y,te.positiveContext=oe;function Q(ee){return ee.transform(function(ie,re,Ee){return hs(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]:U0(),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(vr(ie))Ce[0].placeholders[ee.name]=ie;else return[];break;case"v":if(!vr(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($H(ie))Ce[0].placeholders[ee.name]=ie;else return[];break;case"vd":if(!$H(ie))Ce[0].placeholders[ee.name]=ie;else return[];break;case"ce":if(J6(ie))Ce[0].placeholders[ee.name]=ie;else return[];break;case"ve":if(!J6(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&&XF(),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(ms(z)||St(z)){for(var L=Array.from(I.dimensions);L.length>0;)if(vr(L[0])&&typeof L[0].value!="string"){var _=O(L.shift().value,T);ms(z)?z=z.items[_-1]:(z=z.valueOf()[_-1],z instanceof Array&&(z=i(z)))}else if(L.length>1&&vr(L[1])&&typeof L[1].value!="string"){var Y=O(L[1].value,T),oe=[],te=ms(z)?z.items:z.valueOf();for(var Q of te)if(ms(Q))oe.push(Q.items[Y-1]);else if(St(z))oe.push(Q[Y-1]);else break;if(oe.length===te.length)ms(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&&vr(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&&ms(L[0])){for(var _=[],Y=L[0];ms(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(xi(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 dge="simplifyCore",HWe=["typed","parse","equal","isZero","add","subtract","multiply","divide","pow","AccessorNode","ArrayNode","ConstantNode","FunctionNode","IndexNode","ObjectNode","OperatorNode","ParenthesisNode","SymbolNode"],FP=V(dge,HWe,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 xi(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=cfe(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(xi(I)&&I.isUnary()){var Y=C(I.args[0],D);if(I.op==="~"&&xi(Y)&&Y.isUnary()&&Y.op==="~"||I.op==="not"&&xi(Y)&&Y.isUnary()&&Y.op==="not"&&k(Y.args[0]))return Y.args[0];var oe=!0;if(I.op==="-"&&xi(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(xi(I)&&I.isBinary()){var te=C(I.args[0],D),Q=C(I.args[1],D);if(I.op==="+"){if(vr(te)&&i(te.value))return Q;if(vr(Q)&&i(Q.value))return te;xi(Q)&&Q.isUnary()&&Q.op==="-"&&(Q=Q.args[0],I=new g("-","subtract",[te,Q]))}if(I.op==="-")return xi(Q)&&Q.isUnary()&&Q.op==="-"?C(new g("+","add",[te,Q.args[0]]),D):vr(te)&&i(te.value)?C(new g("-","unaryMinus",[Q])):vr(Q)&&i(Q.value)?te:new g(I.op,I.fn,[te,Q]);if(I.op==="*"){if(vr(te)){if(i(te.value))return v;if(n(te.value,1))return Q}if(vr(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 vr(te)&&i(te.value)?v:vr(Q)&&n(Q.value,1)?te:new g(I.op,I.fn,[te,Q]);if(I.op==="^"&&vr(Q)){if(i(Q.value))return x;if(n(Q.value,1))return te}if(I.op==="and"){if(vr(te))if(te.value){if(k(Q))return Q;if(vr(Q))return Q.value?w:S}else return S;if(vr(Q))if(Q.value){if(k(te))return te}else return S}if(I.op==="or"){if(vr(te)){if(te.value)return w;if(k(Q))return Q}if(vr(Q)){if(Q.value)return w;if(k(te))return te}}return new g(I.op,I.fn,[te,Q])}if(xi(I))return new g(I.op,I.fn,I.args.map(Se=>C(Se,D)));if(ms(I))return new f(I.items.map(Se=>C(Se,D)));if(zu(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(dge,{Node:C,"Node,Object":C})});var VWe="resolve",GWe=["typed","parse","ConstantNode","FunctionNode","OperatorNode","ParenthesisNode"],_P=V(VWe,GWe,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(xi(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(hs(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,UA(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,UA(c))),"Matrix, Object":t.referTo("Matrix,Map",l=>(u,c)=>l(u,UA(c))),"Array | Matrix, Map":t.referToSelf(l=>(u,c)=>u.map(f=>l(f,c)))})});var pge="symbolicEqual",QWe=["parse","simplify","typed","OperatorNode"],PP=V(pge,QWe,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 vr(c)&&!c.value}return n(pge,{"Node, Node":a,"Node, Node, Object":a})});var mge="derivative",YWe=["typed","config","parse","simplify","equal","isZero","numeric","ConstantNode","FunctionNode","OperatorNode","ParenthesisNode","SymbolNode"],IP=V(mge,YWe,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(mge,{"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 vr(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 vr(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(vr(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 hge="rationalize",ZWe=["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"],BP=V(hge,ZWe,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(hge,{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 Age="zpk2tf",XWe=["typed","add","multiply","Complex","number"],RP=V(Age,XWe,e=>{var{typed:t,add:r,multiply:n,Complex:i,number:a}=e;return t(Age,{"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(gge,{"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 tHe="replacer",rHe=[],LP=V(tHe,rHe,()=>function(t,r){return typeof r=="number"&&(!isFinite(r)||isNaN(r))?{mathjs:"number",value:String(r)}:r});var vge="12.4.1";var zP=V("true",[],()=>!0),UP=V("false",[],()=>!1),WP=V("null",[],()=>null),HP=xf("Infinity",["config","?BigNumber"],e=>{var{config:t,BigNumber:r}=e;return t.number==="BigNumber"?new r(1/0):1/0}),VP=xf("NaN",["config","?BigNumber"],e=>{var{config:t,BigNumber:r}=e;return t.number==="BigNumber"?new r(NaN):NaN}),GP=xf("pi",["config","?BigNumber"],e=>{var{config:t,BigNumber:r}=e;return t.number==="BigNumber"?Z6(r):Jse}),QP=xf("tau",["config","?BigNumber"],e=>{var{config:t,BigNumber:r}=e;return t.number==="BigNumber"?xce(r):ele}),YP=xf("e",["config","?BigNumber"],e=>{var{config:t,BigNumber:r}=e;return t.number==="BigNumber"?yce(r):tle}),ZP=xf("phi",["config","?BigNumber"],e=>{var{config:t,BigNumber:r}=e;return t.number==="BigNumber"?bce(r):rle}),XP=xf("LN2",["config","?BigNumber"],e=>{var{config:t,BigNumber:r}=e;return t.number==="BigNumber"?new r(2).ln():Math.LN2}),KP=xf("LN10",["config","?BigNumber"],e=>{var{config:t,BigNumber:r}=e;return t.number==="BigNumber"?new r(10).ln():Math.LN10}),JP=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}),eI=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}),tI=xf("SQRT1_2",["config","?BigNumber"],e=>{var{config:t,BigNumber:r}=e;return t.number==="BigNumber"?new r("0.5").sqrt():Math.SQRT1_2}),rI=xf("SQRT2",["config","?BigNumber"],e=>{var{config:t,BigNumber:r}=e;return t.number==="BigNumber"?new r(2).sqrt():Math.SQRT2}),nI=xf("i",["Complex"],e=>{var{Complex:t}=e;return t.I}),yge=V("PI",["pi"],e=>{var{pi:t}=e;return t}),bge=V("E",["e"],e=>{var{e:t}=e;return t}),iI=V("version",[],()=>vge);function xf(e,t,r){return V(e,t,r,{recreateOnConfigChange:!0})}var aI=Rr("speedOfLight","299792458","m s^-1"),oI=Rr("gravitationConstant","6.67430e-11","m^3 kg^-1 s^-2"),sI=Rr("planckConstant","6.62607015e-34","J s"),lI=Rr("reducedPlanckConstant","1.0545718176461565e-34","J s"),uI=Rr("magneticConstant","1.25663706212e-6","N A^-2"),cI=Rr("electricConstant","8.8541878128e-12","F m^-1"),fI=Rr("vacuumImpedance","376.730313667","ohm"),dI=Rr("coulomb","8.987551792261171e9","N m^2 C^-2"),pI=Rr("elementaryCharge","1.602176634e-19","C"),mI=Rr("bohrMagneton","9.2740100783e-24","J T^-1"),hI=Rr("conductanceQuantum","7.748091729863649e-5","S"),AI=Rr("inverseConductanceQuantum","12906.403729652257","ohm"),gI=Rr("magneticFluxQuantum","2.0678338484619295e-15","Wb"),vI=Rr("nuclearMagneton","5.0507837461e-27","J T^-1"),yI=Rr("klitzing","25812.807459304513","ohm");var bI=Rr("bohrRadius","5.29177210903e-11","m"),xI=Rr("classicalElectronRadius","2.8179403262e-15","m"),wI=Rr("electronMass","9.1093837015e-31","kg"),SI=Rr("fermiCoupling","1.1663787e-5","GeV^-2"),EI=tB("fineStructure",.0072973525693),kI=Rr("hartreeEnergy","4.3597447222071e-18","J"),CI=Rr("protonMass","1.67262192369e-27","kg"),DI=Rr("deuteronMass","3.3435830926e-27","kg"),OI=Rr("neutronMass","1.6749271613e-27","kg"),MI=Rr("quantumOfCirculation","3.6369475516e-4","m^2 s^-1"),jI=Rr("rydberg","10973731.568160","m^-1"),NI=Rr("thomsonCrossSection","6.6524587321e-29","m^2"),TI=tB("weakMixingAngle",.2229),FI=tB("efimovFactor",22.7),_I=Rr("atomicMass","1.66053906660e-27","kg"),PI=Rr("avogadro","6.02214076e23","mol^-1"),II=Rr("boltzmann","1.380649e-23","J K^-1"),BI=Rr("faraday","96485.33212331001","C mol^-1"),RI=Rr("firstRadiation","3.7417718521927573e-16","W m^2"),$I=Rr("loschmidt","2.686780111798444e25","m^-3"),qI=Rr("gasConstant","8.31446261815324","J K^-1 mol^-1"),LI=Rr("molarPlanckConstant","3.990312712893431e-10","J s mol^-1"),zI=Rr("molarVolume","0.022413969545014137","m^3 mol^-1"),UI=tB("sackurTetrode",-1.16487052358),WI=Rr("secondRadiation","0.014387768775039337","m K"),HI=Rr("stefanBoltzmann","5.67037441918443e-8","W m^-2 K^-4"),VI=Rr("wienDisplacement","2.897771955e-3","m K"),GI=Rr("molarMass","0.99999999965e-3","kg mol^-1"),QI=Rr("molarMassC12","11.9999999958e-3","kg mol^-1"),YI=Rr("gravity","9.80665","m s^-2"),ZI=Rr("planckLength","1.616255e-35","m"),XI=Rr("planckMass","2.176435e-8","kg"),KI=Rr("planckTime","5.391245e-44","s"),JI=Rr("planckCharge","1.87554603778e-18","C"),eB=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 tB(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 nHe="apply",iHe=["typed","isInteger"],rB=V(nHe,iHe,e=>{var{typed:t,isInteger:r}=e,n=Y0({typed:t,isInteger:r});return t("apply",{"...any":function(a){var o=a[1];Gt(o)?a[1]=o-1:It(o)&&(a[1]=o.minus(1));try{return n.apply(null,a)}catch(s){throw Si(s)}}})},{isTransformFunction:!0});var aHe="column",oHe=["typed","Index","matrix","range"],nB=V(aHe,oHe,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];Gt(u)&&(s[l]=u-1);try{return a.apply(null,s)}catch(c){throw Si(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 sHe="filter",lHe=["typed"],iB=V(sHe,lHe,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":xge,"Matrix, function":function(a,o){return a.create(xge(a.toArray(),o))},"Array, RegExp":Yw,"Matrix, RegExp":function(a,o){return a.create(Yw(a.toArray(),o))}});return r},{isTransformFunction:!0});function xge(e,t){return pT(e,function(r,n,i){return Od(t,r,[n+1],i,"filter")})}var uHe="forEach",cHe=["typed"],aB=V(uHe,cHe,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))L0(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 fHe="index",dHe=["Index","getMatrixDataType"],oB=V(fHe,dHe,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(Gt(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 pHe="map",mHe=["typed"],sB=V(pHe,mHe,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 wge(a,o,a)},"Matrix, function":function(a,o){return a.create(wge(a.valueOf(),o,a))}});return r},{isTransformFunction:!0});function wge(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&&Oa(e[0])){e=e.slice();var t=e[1];Gt(t)?e[1]=t-1:It(t)&&(e[1]=t.minus(1))}return e}var hHe="max",AHe=["typed","config","numeric","larger"],lB=V(hHe,AHe,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 Si(l)}}})},{isTransformFunction:!0});var gHe="mean",vHe=["typed","add","divide"],uB=V(gHe,vHe,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 Si(s)}}})},{isTransformFunction:!0});var yHe="min",bHe=["typed","config","numeric","smaller"],cB=V(yHe,bHe,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 Si(l)}}})},{isTransformFunction:!0});var xHe="range",wHe=["typed","config","?matrix","?bignumber","smaller","smallerEq","larger","largerEq","add","isPositive"],fB=V(xHe,wHe,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 SHe="row",EHe=["typed","Index","matrix","range"],dB=V(SHe,EHe,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];Gt(u)&&(s[l]=u-1);try{return a.apply(null,s)}catch(c){throw Si(c)}}})},{isTransformFunction:!0});var kHe="subset",CHe=["typed","matrix","zeros","add"],pB=V(kHe,CHe,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 Si(l)}}})},{isTransformFunction:!0});var DHe="concat",OHe=["typed","matrix","isInteger"],mB=V(DHe,OHe,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];Gt(l)?o[s]=l-1:It(l)&&(o[s]=l.minus(1));try{return i.apply(null,o)}catch(u){throw Si(u)}}})},{isTransformFunction:!0});var Sge="diff",MHe=["typed","matrix","subtract","number","bignumber"],hB=V(Sge,MHe,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(Sge,{"...any":function(l){l=su(l);try{return o.apply(null,l)}catch(u){throw Si(u)}}})},{isTransformFunction:!0});var jHe="std",NHe=["typed","map","sqrt","variance"],AB=V(jHe,NHe,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 Si(l)}}})},{isTransformFunction:!0});var Ege="sum",THe=["typed","config","add","numeric"],gB=V(Ege,THe,e=>{var{typed:t,config:r,add:n,numeric:i}=e,a=CS({typed:t,config:r,add:n,numeric:i});return t(Ege,{"...any":function(s){s=su(s);try{return a.apply(null,s)}catch(l){throw Si(l)}}})},{isTransformFunction:!0});var FHe="quantileSeq",_He=["typed","bignumber","add","subtract","divide","multiply","partitionSelect","compare","isInteger","smaller","smallerEq","larger"],vB=V(FHe,_He,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 kge="cumsum",PHe=["typed","add","unaryPlus"],yB=V(kge,PHe,e=>{var{typed:t,add:r,unaryPlus:n}=e,i=DS({typed:t,add:r,unaryPlus:n});return t(kge,{"...any":function(o){if(o.length===2&&Oa(o[0])){var s=o[1];Gt(s)?o[1]=s-1:It(s)&&(o[1]=s.minus(1))}try{return i.apply(null,o)}catch(l){throw Si(l)}}})},{isTransformFunction:!0});var Cge="variance",IHe=["typed","add","subtract","multiply","divide","apply","isNaN"],bB=V(Cge,IHe,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(Cge,{"...any":function(c){c=su(c);try{return l.apply(null,c)}catch(f){throw Si(f)}}})},{isTransformFunction:!0});var Dge="print",BHe=["typed","matrix","zeros","add"],xB=V(Dge,BHe,e=>{var{typed:t,matrix:r,zeros:n,add:i}=e,a=vS({typed:t,matrix:r,zeros:n,add:i});return t(Dge,{"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(y3,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 RHe="and",$He=["typed","matrix","zeros","add","equalScalar","not","concat"],wB=V(RHe,$He,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(!Oa(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 qHe="or",LHe=["typed","matrix","equalScalar","DenseMatrix","concat"],SB=V(qHe,LHe,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(!Oa(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 zHe="bitAnd",UHe=["typed","matrix","zeros","add","equalScalar","not","concat"],EB=V(zHe,UHe,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(!Oa(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 WHe="bitOr",HHe=["typed","matrix","equalScalar","DenseMatrix","concat"],kB=V(WHe,HHe,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(!Oa(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=kT({config:it}),Ei=CT({}),zH=YP({BigNumber:yt,config:it}),Oge=UP({}),Mge=EI({BigNumber:yt,config:it}),K0=DT({}),UH=nI({Complex:Ei}),jge=HP({BigNumber:yt,config:it}),Nge=KP({BigNumber:yt,config:it}),Tge=eI({BigNumber:yt,config:it}),eC=MT({}),Fge=VP({BigNumber:yt,config:it}),_ge=WP({}),Pge=ZP({BigNumber:yt,config:it}),Ige=OT({}),WH=gT({}),Bge=tI({BigNumber:yt,config:it}),Rge=UI({BigNumber:yt,config:it}),HH=QP({BigNumber:yt,config:it}),$ge=zP({}),qge=iI({}),Lr=NT({Matrix:eC}),Lge=FI({BigNumber:yt,config:it}),zge=XP({BigNumber:yt,config:it}),CB=GP({BigNumber:yt,config:it}),Uge=LP({}),Wge=rI({BigNumber:yt,config:it}),Me=AT({BigNumber:yt,Complex:Ei,DenseMatrix:Lr,Fraction:K0}),DB=aF({BigNumber:yt,config:it,typed:Me}),Hge=TI({BigNumber:yt,config:it}),lu=oF({typed:Me}),Vge=p_({Complex:Ei,config:it,typed:Me}),Gge=h_({BigNumber:yt,typed:Me}),Qge=g_({BigNumber:yt,Complex:Ei,config:it,typed:Me}),Yo=lF({typed:Me}),Yge=_F({typed:Me}),Zge=b_({BigNumber:yt,Complex:Ei,config:it,typed:Me}),Xge=w_({typed:Me}),VH=S_({typed:Me}),Kge=k_({Complex:Ei,config:it,typed:Me}),Oc=ZT({BigNumber:yt,typed:Me}),Jge=TF({typed:Me}),e0e=YT({typed:Me}),t0e=TT({typed:Me}),tC=mP({typed:Me}),rC=XT({Complex:Ei,typed:Me}),J0=PF({typed:Me}),OB=C_({typed:Me}),r0e=O_({BigNumber:yt,typed:Me}),n0e=j_({BigNumber:yt,typed:Me}),i0e=dF({typed:Me}),Zr=HT({config:it,typed:Me}),a0e=f3({typed:Me}),GH=pF({typed:Me}),o0e=mF({Complex:Ei,typed:Me}),s0e=UF({typed:Me}),l0e=HF({typed:Me}),_S=h3({typed:Me}),MB=VF({typed:Me}),u0e=v3({format:_S,typed:Me}),jB=IF({typed:Me}),Uu=PT({typed:Me}),QA=BT({typed:Me}),ev=qT({typed:Me}),Nd=LT({typed:Me}),c0e=JP({BigNumber:yt,config:it}),f0e=gP({Complex:Ei,typed:Me}),d0e=vF({Complex:Ei,config:it,typed:Me}),QH=yF({Complex:Ei,config:it,typed:Me}),tv=YF({typed:Me}),eo=bF({typed:Me}),nC=RF({typed:Me}),Xm=GT({typed:Me}),p0e=g3({format:_S,typed:Me}),m0e=SP({config:it,typed:Me}),h0e=vS({typed:Me}),A0e=EP({config:it,typed:Me}),NB=BF({typed:Me}),g0e=T_({BigNumber:yt,typed:Me}),YH=SF({BigNumber:yt,Fraction:K0,complex:rC,typed:Me}),iC=__({typed:Me}),Km=VT({Matrix:eC,equalScalar:Zr,typed:Me}),v0e=nF({typed:Me}),y0e=kF({typed:Me}),b0e=QT({typed:Me}),wf=uF({typed:Me}),x0e=I_({typed:Me}),ZH=UT({typed:Me}),w0e=m_({Complex:Ei,config:it,typed:Me}),S0e=v_({BigNumber:yt,typed:Me}),TB=Y0({isInteger:Uu,typed:Me}),E0e=y_({BigNumber:yt,Complex:Ei,config:it,typed:Me}),k0e=A3({format:_S,typed:Me}),C0e=hP({typed:Me}),D0e=D_({typed:Me}),O0e=N_({BigNumber:yt,typed:Me}),PS=zT({typed:Me}),M0e=x3({typed:Me}),j0e=kP({config:it,typed:Me}),N0e=F_({BigNumber:yt,typed:Me}),T0e=P_({typed:Me}),F0e=f_({SparseMatrix:Km,typed:Me}),Td=EF({Complex:Ei,config:it,typed:Me}),_0e=B_({typed:Me}),zp=iF({typed:Me}),P0e=A_({BigNumber:yt,Complex:Ei,config:it,typed:Me}),I0e=M_({BigNumber:yt,typed:Me}),jy=KT({Fraction:K0,typed:Me}),rv=RT({typed:Me}),vt=JT({DenseMatrix:Lr,Matrix:eC,SparseMatrix:Km,typed:Me}),B0e=eF({isZero:Nd,matrix:vt,typed:Me}),R0e=p3({isNaN:PS,isNumeric:rv,typed:Me}),Fd=w3({bignumber:Oc,fraction:jy,number:Xm}),XH=m3({config:it,multiplyScalar:eo,numeric:Fd,typed:Me}),KH=JF({isInteger:Uu,matrix:vt,typed:Me}),Gs=n3({matrix:vt,config:it,typed:Me}),$0e=i3({matrix:vt,typed:Me}),IS=a3({matrix:vt,typed:Me}),JH=DF({BigNumber:yt,config:it,matrix:vt,typed:Me}),Qs=s3({BigNumber:yt,config:it,matrix:vt,typed:Me}),q0e=x_({Complex:Ei,config:it,typed:Me}),eV=cF({BigNumber:yt,Complex:Ei,Fraction:K0,config:it,isNegative:QA,matrix:vt,typed:Me,unaryMinus:zp}),xn=cS({isInteger:Uu,matrix:vt,typed:Me}),L0e=qF({prod:XH,size:Gs,typed:Me}),FB=o3({conj:J0,transpose:IS,typed:Me}),tV=zF({DenseMatrix:Lr,SparseMatrix:Km,matrix:vt,typed:Me}),ja=S3({numeric:Fd,typed:Me}),BS=j3({DenseMatrix:Lr,concat:xn,divideScalar:ja,equalScalar:Zr,matrix:vt,typed:Me}),Sf=U3({DenseMatrix:Lr,concat:xn,equalScalar:Zr,matrix:vt,typed:Me}),RS=WF({matrix:vt,typed:Me}),z0e=$T({isNumeric:rv,typed:Me}),YA=GF({BigNumber:yt,DenseMatrix:Lr,SparseMatrix:Km,config:it,matrix:vt,typed:Me}),U0e=QF({matrix:vt,multiplyScalar:eo,typed:Me}),aC=K3({DenseMatrix:Lr,concat:xn,config:it,matrix:vt,typed:Me}),W0e=P3({DenseMatrix:Lr,concat:xn,equalScalar:Zr,matrix:vt,typed:Me,zeros:Qs}),rV=N3({DenseMatrix:Lr,divideScalar:ja,equalScalar:Zr,matrix:vt,multiplyScalar:eo,subtractScalar:wf,typed:Me}),_B=rF({flatten:RS,matrix:vt,size:Gs,typed:Me}),H0e=wF({BigNumber:yt,concat:xn,equalScalar:Zr,matrix:vt,typed:Me}),V0e=ZF({BigNumber:yt,config:it,matrix:vt,typed:Me}),PB=z4({addScalar:Yo,complex:rC,conj:J0,divideScalar:ja,equal:Sf,identity:YA,isZero:Nd,matrix:vt,multiplyScalar:eo,sign:YH,sqrt:Td,subtractScalar:wf,typed:Me,unaryMinus:zp,zeros:Qs}),G0e=e3({config:it,matrix:vt}),Q0e=I3({DenseMatrix:Lr,concat:xn,equalScalar:Zr,matrix:vt,typed:Me,zeros:Qs}),Ny=k3({BigNumber:yt,DenseMatrix:Lr,config:it,equalScalar:Zr,matrix:vt,typed:Me,zeros:Qs}),uu=V3({DenseMatrix:Lr,concat:xn,config:it,matrix:vt,typed:Me}),to=CF({DenseMatrix:Lr,concat:xn,equalScalar:Zr,matrix:vt,subtractScalar:wf,typed:Me,unaryMinus:zp}),Y0e=b3({concat:xn,matrix:vt,typed:Me}),Z0e=t_({DenseMatrix:Lr,concat:xn,config:it,equalScalar:Zr,matrix:vt,typed:Me}),IB=T3({DenseMatrix:Lr,divideScalar:ja,equalScalar:Zr,matrix:vt,multiplyScalar:eo,subtractScalar:wf,typed:Me}),X0e=$F({DenseMatrix:Lr,concat:xn,matrix:vt,typed:Me}),an=Q_({DenseMatrix:Lr,SparseMatrix:Km,addScalar:Yo,concat:xn,equalScalar:Zr,matrix:vt,typed:Me}),K0e=E_({BigNumber:yt,DenseMatrix:Lr,concat:xn,equalScalar:Zr,matrix:vt,typed:Me}),J0e=sS({concat:xn,equalScalar:Zr,matrix:vt,typed:Me}),eve=lS({DenseMatrix:Lr,concat:xn,equalScalar:Zr,matrix:vt,typed:Me}),tve=FF({DenseMatrix:Lr,concat:xn,matrix:vt,typed:Me}),rve=OP({addScalar:Yo,combinations:tC,divideScalar:ja,isInteger:Uu,isNegative:QA,multiplyScalar:eo,typed:Me}),nv=$3({BigNumber:yt,DenseMatrix:Lr,Fraction:K0,concat:xn,config:it,equalScalar:Zr,matrix:vt,typed:Me}),nV=L3({concat:xn,matrix:vt,typed:Me}),nve=DS({add:an,typed:Me,unaryPlus:DB}),BB=J3({equal:Sf,typed:Me}),ive=dS({matrix:vt,number:Xm,subtract:to,typed:Me}),ave=lP({abs:lu,addScalar:Yo,deepEqual:BB,divideScalar:ja,multiplyScalar:eo,sqrt:Td,subtractScalar:wf,typed:Me}),oC=X_({addScalar:Yo,conj:J0,multiplyScalar:eo,size:Gs,typed:Me}),ove=W3({compareText:nV,isZero:Nd,typed:Me}),iV=nS({DenseMatrix:Lr,config:it,equalScalar:Zr,matrix:vt,round:Ny,typed:Me,zeros:Qs}),sve=AF({BigNumber:yt,DenseMatrix:Lr,concat:xn,config:it,equalScalar:Zr,matrix:vt,round:Ny,typed:Me,zeros:Qs}),lve=Y_({abs:lu,addScalar:Yo,divideScalar:ja,isPositive:ev,multiplyScalar:eo,smaller:uu,sqrt:Td,typed:Me}),aV=i_({DenseMatrix:Lr,smaller:uu}),Sl=a_({ImmutableDenseMatrix:aV,getMatrixDataType:MB}),cu=Z3({DenseMatrix:Lr,concat:xn,config:it,matrix:vt,typed:Me}),RB=C3({Complex:Ei,config:it,divideScalar:ja,typed:Me}),uve=F3({DenseMatrix:Lr,divideScalar:ja,equalScalar:Zr,matrix:vt,multiplyScalar:eo,subtractScalar:wf,typed:Me}),cve=tF({flatten:RS,matrix:vt,size:Gs,typed:Me}),fve=ES({config:it,numeric:Fd,smaller:uu,typed:Me}),oV=iS({DenseMatrix:Lr,concat:xn,config:it,equalScalar:Zr,matrix:vt,round:Ny,typed:Me,zeros:Qs}),ni=xF({addScalar:Yo,dot:oC,equalScalar:Zr,matrix:vt,multiplyScalar:eo,typed:Me}),dve=O3({Complex:Ei,config:it,divideScalar:ja,typed:Me}),pve=uS({DenseMatrix:Lr,concat:xn,equalScalar:Zr,matrix:vt,typed:Me}),sC=r_({compare:nv,isNaN:PS,isNumeric:rv,typed:Me}),mve=B3({DenseMatrix:Lr,concat:xn,equalScalar:Zr,matrix:vt,typed:Me,zeros:Qs}),sV=H4({SparseMatrix:Km,abs:lu,add:an,divideScalar:ja,larger:cu,largerEq:aC,multiply:ni,subtract:to,transpose:IS,typed:Me}),Mc=AS({add:an,matrix:vt,typed:Me,zeros:Qs}),$B=CS({add:an,config:it,numeric:Fd,typed:Me}),hve=K_({add:an,matrix:vt,typed:Me}),lV=_3({DenseMatrix:Lr,divideScalar:ja,equalScalar:Zr,matrix:vt,multiplyScalar:eo,subtractScalar:wf,typed:Me}),Ave=RP({Complex:Ei,add:an,multiply:ni,number:Xm,typed:Me}),qB=fF({DenseMatrix:Lr,config:it,equalScalar:Zr,matrix:vt,round:Ny,typed:Me,zeros:Qs}),Up=q3({compare:nv,typed:Me}),gve=MP({addScalar:Yo,combinations:tC,isInteger:Uu,isNegative:QA,isPositive:ev,larger:cu,typed:Me}),vve=LF({matrix:vt,multiply:ni,subtract:to,typed:Me}),uV=K4({divideScalar:ja,isZero:Nd,matrix:vt,multiply:ni,subtractScalar:wf,typed:Me,unaryMinus:zp}),yve=jF({concat:xn,equalScalar:Zr,matrix:vt,multiplyScalar:eo,typed:Me}),cV=o_({larger:cu,smaller:uu}),fV=hF({Complex:Ei,DenseMatrix:Lr,ceil:qB,equalScalar:Zr,floor:iV,matrix:vt,typed:Me,zeros:Qs}),dV=J_({Index:Sl,typed:Me}),bve=uP({abs:lu,add:an,addScalar:Yo,config:it,divideScalar:ja,equalScalar:Zr,flatten:RS,isNumeric:rv,isZero:Nd,matrix:vt,multiply:ni,multiplyScalar:eo,smaller:uu,subtract:to,typed:Me}),xve=OF({BigNumber:yt,add:an,config:it,equal:Sf,isInteger:Uu,mod:oV,smaller:uu,typed:Me,xgcd:JH}),wve=gF({concat:xn,equalScalar:Zr,matrix:vt,typed:Me}),Sve=D3({Complex:Ei,config:it,divideScalar:ja,log:RB,typed:Me}),LB=SS({config:it,larger:cu,numeric:Fd,typed:Me}),Eve=R_({DenseMatrix:Lr,Index:Sl,compareNatural:Up,size:Gs,subset:Mc,typed:Me}),kve=q_({DenseMatrix:Lr,Index:Sl,compareNatural:Up,size:Gs,subset:Mc,typed:Me}),Cve=z_({Index:Sl,compareNatural:Up,size:Gs,subset:Mc,typed:Me}),Dve=W_({Index:Sl,compareNatural:Up,size:Gs,subset:Mc,typed:Me}),Ty=Q3({DenseMatrix:Lr,concat:xn,config:it,matrix:vt,typed:Me}),Ove=n_({compare:nv,compareNatural:Up,matrix:vt,typed:Me}),Mve=wS({concat:xn,equalScalar:Zr,matrix:vt,not:nC,typed:Me,zeros:Qs}),Fy=mS({bignumber:Oc,matrix:vt,add:an,config:it,isPositive:ev,larger:cu,largerEq:aC,smaller:uu,smallerEq:Ty,typed:Me}),jve=hS({Index:Sl,matrix:vt,range:Fy,typed:Me}),pV=$_({DenseMatrix:Lr,Index:Sl,compareNatural:Up,size:Gs,subset:Mc,typed:Me}),Nve=U_({Index:Sl,compareNatural:Up,size:Gs,subset:Mc,typed:Me}),mV=V_({Index:Sl,concat:xn,setDifference:pV,size:Gs,subset:Mc,typed:Me}),hV=s_({FibonacciHeap:cV,addScalar:Yo,equalScalar:Zr}),AV=fS({Index:Sl,matrix:vt,range:Fy,typed:Me}),iv=J4({abs:lu,addScalar:Yo,det:uV,divideScalar:ja,identity:YA,matrix:vt,multiply:ni,typed:Me,unaryMinus:zp}),gV=L4({DenseMatrix:Lr,Spa:hV,SparseMatrix:Km,abs:lu,addScalar:Yo,divideScalar:ja,equalScalar:Zr,larger:cu,matrix:vt,multiplyScalar:eo,subtractScalar:wf,typed:Me,unaryMinus:zp}),Tve=eP({Complex:Ei,add:an,ctranspose:FB,deepEqual:BB,divideScalar:ja,dot:oC,dotDivide:BS,equal:Sf,inv:iv,matrix:vt,multiply:ni,typed:Me}),Ef=E3({Complex:Ei,config:it,fraction:jy,identity:YA,inv:iv,matrix:vt,multiply:ni,number:Xm,typed:Me}),vV=L_({DenseMatrix:Lr,Index:Sl,compareNatural:Up,size:Gs,subset:Mc,typed:Me}),Fve=G_({Index:Sl,concat:xn,setIntersect:vV,setSymDifference:mV,size:Gs,subset:Mc,typed:Me}),_ve=nP({abs:lu,add:an,identity:YA,inv:iv,map:tv,max:LB,multiply:ni,size:Gs,sqrt:Td,subtract:to,typed:Me}),br=u_({BigNumber:yt,Complex:Ei,Fraction:K0,abs:lu,addScalar:Yo,config:it,divideScalar:ja,equal:Sf,fix:fV,format:_S,isNumeric:rv,multiplyScalar:eo,number:Xm,pow:Ef,round:Ny,subtractScalar:wf}),Pve=fI({BigNumber:yt,Unit:br,config:it}),Ive=VI({BigNumber:yt,Unit:br,config:it}),Bve=_I({BigNumber:yt,Unit:br,config:it}),Rve=mI({BigNumber:yt,Unit:br,config:it}),$ve=II({BigNumber:yt,Unit:br,config:it}),qve=hI({BigNumber:yt,Unit:br,config:it}),Lve=dI({BigNumber:yt,Unit:br,config:it}),zve=DI({BigNumber:yt,Unit:br,config:it}),Uve=M3({DenseMatrix:Lr,concat:xn,equalScalar:Zr,matrix:vt,pow:Ef,typed:Me}),Wve=cI({BigNumber:yt,Unit:br,config:it}),Hve=pI({BigNumber:yt,Unit:br,config:it}),Vve=rP({abs:lu,add:an,identity:YA,inv:iv,multiply:ni,typed:Me}),Gve=BI({BigNumber:yt,Unit:br,config:it}),yV=l3({addScalar:Yo,ceil:qB,conj:J0,divideScalar:ja,dotDivide:BS,exp:GH,i:UH,log2:QH,matrix:vt,multiplyScalar:eo,pow:Ef,tau:HH,typed:Me}),zB=AP({BigNumber:yt,Complex:Ei,config:it,multiplyScalar:eo,pow:Ef,typed:Me}),Qve=oI({BigNumber:yt,Unit:br,config:it}),Yve=kI({BigNumber:yt,Unit:br,config:it}),Zve=u3({conj:J0,dotDivide:BS,fft:yV,typed:Me}),Xve=yI({BigNumber:yt,Unit:br,config:it}),Kve=$I({BigNumber:yt,Unit:br,config:it}),Jve=uI({BigNumber:yt,Unit:br,config:it}),e1e=GI({BigNumber:yt,Unit:br,config:it}),t1e=LI({BigNumber:yt,Unit:br,config:it}),r1e=OI({BigNumber:yt,Unit:br,config:it}),n1e=vI({BigNumber:yt,Unit:br,config:it}),i1e=JI({BigNumber:yt,Unit:br,config:it}),a1e=ZI({BigNumber:yt,Unit:br,config:it}),o1e=eB({BigNumber:yt,Unit:br,config:it}),s1e=CI({BigNumber:yt,Unit:br,config:it}),l1e=MI({BigNumber:yt,Unit:br,config:it}),u1e=lI({BigNumber:yt,Unit:br,config:it}),c1e=jI({BigNumber:yt,Unit:br,config:it}),f1e=WI({BigNumber:yt,Unit:br,config:it}),d1e=aI({BigNumber:yt,Unit:br,config:it}),p1e=HI({BigNumber:yt,Unit:br,config:it}),m1e=NI({BigNumber:yt,Unit:br,config:it}),h1e=PI({BigNumber:yt,Unit:br,config:it}),A1e=bI({BigNumber:yt,Unit:br,config:it}),g1e=d_({Unit:br,typed:Me}),ys=sP({divideScalar:ja,equalScalar:Zr,inv:iv,matrix:vt,multiply:ni,typed:Me}),v1e=wI({BigNumber:yt,Unit:br,config:it}),$S=vP({gamma:zB,typed:Me}),y1e=RI({BigNumber:yt,Unit:br,config:it}),b1e=YI({BigNumber:yt,Unit:br,config:it}),x1e=AI({BigNumber:yt,Unit:br,config:it}),bV=V4({DenseMatrix:Lr,lsolve:rV,lup:gV,matrix:vt,slu:sV,typed:Me,usolve:IB}),w1e=gI({BigNumber:yt,Unit:br,config:it}),S1e=QI({BigNumber:yt,Unit:br,config:it}),E1e=bP({add:an,divide:ys,factorial:$S,isInteger:Uu,isPositive:ev,multiply:ni,typed:Me}),k1e=xP({factorial:$S,typed:Me}),C1e=XI({BigNumber:yt,Unit:br,config:it}),D1e=G4({add:an,cbrt:eV,divide:ys,equalScalar:Zr,im:jB,isZero:Nd,multiply:ni,re:NB,sqrt:Td,subtract:to,typeOf:ZH,typed:Me,unaryMinus:zp}),O1e=H_({compareNatural:Up,typed:Me}),M1e=c3({abs:lu,add:an,bignumber:Oc,divide:ys,isNegative:QA,isPositive:ev,larger:cu,map:tv,matrix:vt,max:LB,multiply:ni,smaller:uu,subtract:to,typed:Me,unaryMinus:zp}),xV=CP({bignumber:Oc,addScalar:Yo,combinations:tC,divideScalar:ja,factorial:$S,isInteger:Uu,isNegative:QA,larger:cu,multiplyScalar:eo,number:Xm,pow:Ef,subtractScalar:wf,typed:Me}),j1e=c_({Unit:br,typed:Me}),N1e=DP({addScalar:Yo,isInteger:Uu,isNegative:QA,stirlingS2:xV,typed:Me}),wV=tP({abs:lu,add:an,addScalar:Yo,atan:VH,bignumber:Oc,column:AV,complex:rC,config:it,cos:OB,diag:tV,divideScalar:ja,dot:oC,equal:Sf,flatten:RS,im:jB,inv:iv,larger:cu,matrix:vt,matrixFromColumns:_B,multiply:ni,multiplyScalar:eo,number:Xm,qr:PB,re:NB,reshape:KH,sin:iC,size:Gs,smaller:uu,sqrt:Td,subtract:to,typed:Me,usolve:IB,usolveAll:lV}),T1e=SI({BigNumber:yt,Unit:br,config:it}),F1e=qI({BigNumber:yt,Unit:br,config:it}),_1e=yP({divide:ys,dotDivide:BS,isNumeric:rv,log:RB,map:tv,matrix:vt,multiply:ni,sum:$B,typed:Me}),SV=OS({add:an,divide:ys,typed:Me}),P1e=zI({BigNumber:yt,Unit:br,config:it}),I1e=sI({BigNumber:yt,Unit:br,config:it}),B1e=jS({bignumber:Oc,add:an,compare:nv,divide:ys,isInteger:Uu,larger:cu,multiply:ni,partitionSelect:sC,smaller:uu,smallerEq:Ty,subtract:to,typed:Me}),UB=MS({add:an,apply:TB,divide:ys,isNaN:PS,multiply:ni,subtract:to,typed:Me}),R1e=xI({BigNumber:yt,Unit:br,config:it}),lC=fP({add:an,compare:nv,divide:ys,partitionSelect:sC,typed:Me}),$1e=pP({add:an,divide:ys,matrix:vt,mean:SV,multiply:ni,pow:Ef,sqrt:Td,subtract:to,sum:$B,typed:Me}),q1e=$P({Complex:Ei,add:an,divide:ys,matrix:vt,multiply:ni,typed:Me}),L1e=dP({abs:lu,map:tv,median:lC,subtract:to,typed:Me}),z1e=NS({map:tv,sqrt:Td,typed:Me,variance:UB}),U1e=d3({BigNumber:yt,Complex:Ei,add:an,config:it,divide:ys,equal:Sf,factorial:$S,gamma:zB,isNegative:QA,multiply:ni,pi:CB,pow:Ef,sin:iC,smallerEq:Ty,subtract:to,typed:Me}),WB=Z_({abs:lu,add:an,conj:J0,ctranspose:FB,eigs:wV,equalScalar:Zr,larger:cu,matrix:vt,multiply:ni,pow:Ef,smaller:uu,sqrt:Td,typed:Me}),EV=r3({BigNumber:yt,DenseMatrix:Lr,SparseMatrix:Km,addScalar:Yo,config:it,cos:OB,matrix:vt,multiplyScalar:eo,norm:WB,sin:iC,typed:Me,unaryMinus:zp}),W1e=KI({BigNumber:yt,Unit:br,config:it}),kV=aP({identity:YA,matrix:vt,multiply:ni,norm:WB,qr:PB,subtract:to,typed:Me}),H1e=t3({multiply:ni,rotationMatrix:EV,typed:Me}),CV=iP({abs:lu,add:an,concat:xn,identity:YA,index:dV,lusolve:bV,matrix:vt,matrixFromColumns:_B,multiply:ni,range:Fy,schur:kV,subset:Mc,subtract:to,transpose:IS,typed:Me}),V1e=oP({matrix:vt,multiply:ni,sylvester:CV,transpose:IS,typed:Me});var qS={},LS={},G1e={},fu=t4({mathWithTransform:LS}),zS=E4({Node:fu}),ZA=C4({Node:fu}),_y=O4({Node:fu}),Q1e=T4({Node:fu}),US=o4({Node:fu}),Y1e=d4({Node:fu,ResultSet:WH}),Z1e=m4({Node:fu}),av=v4({Node:fu}),X1e=j4({Node:fu}),VHe=qP({classes:G1e}),DV=Y4({math:qS,typed:Me}),K1e=b4({Node:fu,typed:Me}),GHe=X4({Chain:DV,typed:Me}),WS=w4({Node:fu,size:Gs}),HS=i4({Node:fu,subset:Mc}),J1e=c4({matrix:vt,Node:fu,subset:Mc}),ov=F4({Unit:br,Node:fu,math:qS}),sv=P4({Node:fu,SymbolNode:ov,math:qS}),_d=I4({AccessorNode:HS,ArrayNode:US,AssignmentNode:J1e,BlockNode:Y1e,ConditionalNode:Z1e,ConstantNode:av,FunctionAssignmentNode:K1e,FunctionNode:sv,IndexNode:WS,ObjectNode:zS,OperatorNode:ZA,ParenthesisNode:_y,RangeNode:X1e,RelationalNode:Q1e,SymbolNode:ov,config:it,numeric:Fd,typed:Me}),eye=_P({ConstantNode:av,FunctionNode:sv,OperatorNode:ZA,ParenthesisNode:_y,parse:_d,typed:Me}),OV=TP({bignumber:Oc,fraction:jy,AccessorNode:HS,ArrayNode:US,ConstantNode:av,FunctionNode:sv,IndexNode:WS,ObjectNode:zS,OperatorNode:ZA,SymbolNode:ov,config:it,mathWithTransform:LS,matrix:vt,typed:Me}),QHe=B4({parse:_d,typed:Me}),MV=FP({AccessorNode:HS,ArrayNode:US,ConstantNode:av,FunctionNode:sv,IndexNode:WS,ObjectNode:zS,OperatorNode:ZA,ParenthesisNode:_y,SymbolNode:ov,add:an,divide:ys,equal:Sf,isZero:Nd,multiply:ni,parse:_d,pow:Ef,subtract:to,typed:Me}),jV=R4({parse:_d,typed:Me}),tye=Q4({evaluate:jV}),rye=$4({evaluate:jV}),HB=NP({bignumber:Oc,fraction:jy,AccessorNode:HS,ArrayNode:US,ConstantNode:av,FunctionNode:sv,IndexNode:WS,ObjectNode:zS,OperatorNode:ZA,ParenthesisNode:_y,SymbolNode:ov,add:an,config:it,divide:ys,equal:Sf,isZero:Nd,mathWithTransform:LS,matrix:vt,multiply:ni,parse:_d,pow:Ef,resolve:eye,simplifyConstant:OV,simplifyCore:MV,subtract:to,typed:Me}),YHe=PP({OperatorNode:ZA,parse:_d,simplify:HB,typed:Me}),ZHe=jP({parse:_d,typed:Me}),XHe=q4({Parser:rye,typed:Me}),KHe=BP({bignumber:Oc,fraction:jy,AccessorNode:HS,ArrayNode:US,ConstantNode:av,FunctionNode:sv,IndexNode:WS,ObjectNode:zS,OperatorNode:ZA,ParenthesisNode:_y,SymbolNode:ov,add:an,config:it,divide:ys,equal:Sf,isZero:Nd,mathWithTransform:LS,matrix:vt,multiply:ni,parse:_d,pow:Ef,simplify:HB,simplifyConstant:OV,simplifyCore:MV,subtract:to,typed:Me}),JHe=IP({ConstantNode:av,FunctionNode:sv,OperatorNode:ZA,ParenthesisNode:_y,SymbolNode:ov,config:it,equal:Sf,isZero:Nd,numeric:Fd,parse:_d,simplify:HB,typed:Me}),eVe=Z4({Help:tye,mathWithTransform:LS,typed:Me});Fn(qS,{e:zH,false:Oge,fineStructure:Mge,i:UH,Infinity:jge,LN10:Nge,LOG10E:Tge,NaN:Fge,null:_ge,phi:Pge,SQRT1_2:Bge,sackurTetrode:Rge,tau:HH,true:$ge,E:zH,version:qge,efimovFactor:Lge,LN2:zge,pi:CB,replacer:Uge,reviver:VHe,SQRT2:Wge,typed:Me,unaryPlus:DB,PI:CB,weakMixingAngle:Hge,abs:lu,acos:Vge,acot:Gge,acsc:Qge,addScalar:Yo,arg:Yge,asech:Zge,asinh:Xge,atan:VH,atanh:Kge,bignumber:Oc,bitNot:Jge,boolean:e0e,clone:t0e,combinations:tC,complex:rC,conj:J0,cos:OB,cot:r0e,csc:n0e,cube:i0e,equalScalar:Zr,erf:a0e,exp:GH,expm1:o0e,filter:s0e,forEach:l0e,format:_S,getMatrixDataType:MB,hex:u0e,im:jB,isInteger:Uu,isNegative:QA,isPositive:ev,isZero:Nd,LOG2E:c0e,lgamma:f0e,log10:d0e,log2:QH,map:tv,multiplyScalar:eo,not:nC,number:Xm,oct:p0e,pickRandom:m0e,print:h0e,random:A0e,re:NB,sec:g0e,sign:YH,sin:iC,splitUnit:v0e,square:y0e,string:b0e,subtractScalar:wf,tan:x0e,typeOf:ZH,acosh:w0e,acsch:S0e,apply:TB,asec:E0e,bin:k0e,chain:GHe,combinationsWithRep:C0e,cosh:D0e,csch:O0e,isNaN:PS,isPrime:M0e,randomInt:j0e,sech:N0e,sinh:T0e,sparse:F0e,sqrt:Td,tanh:_0e,unaryMinus:zp,acoth:P0e,coth:I0e,fraction:jy,isNumeric:rv,matrix:vt,matrixFromFunction:B0e,mode:R0e,numeric:Fd,prod:XH,reshape:KH,size:Gs,squeeze:$0e,transpose:IS,xgcd:JH,zeros:Qs,asin:q0e,cbrt:eV,concat:xn,count:L0e,ctranspose:FB,diag:tV,divideScalar:ja,dotDivide:BS,equal:Sf,flatten:RS,hasNumericValue:z0e,identity:YA,kron:U0e,largerEq:aC,leftShift:W0e,lsolve:rV,matrixFromColumns:_B,nthRoot:H0e,ones:V0e,qr:PB,resize:G0e,rightArithShift:Q0e,round:Ny,smaller:uu,subtract:to,to:Y0e,unequal:Z0e,usolve:IB,xor:X0e,add:an,atan2:K0e,bitAnd:J0e,bitOr:eve,bitXor:tve,catalan:rve,compare:nv,compareText:nV,cumsum:nve,deepEqual:BB,diff:ive,distance:ave,dot:oC,equalText:ove,floor:iV,gcd:sve,hypot:lve,larger:cu,log:RB,lsolveAll:uve,matrixFromRows:cve,min:fve,mod:oV,multiply:ni,nthRoots:dve,or:pve,partitionSelect:sC,rightLogShift:mve,slu:sV,subset:Mc,sum:$B,trace:hve,usolveAll:lV,zpk2tf:Ave,ceil:qB,compareNatural:Up,composition:gve,cross:vve,det:uV,dotMultiply:yve,fix:fV,index:dV,intersect:bve,invmod:xve,lcm:wve,log1p:Sve,max:LB,setCartesian:Eve,setDistinct:kve,setIsSubset:Cve,setPowerset:Dve,smallerEq:Ty,sort:Ove,and:Mve,range:Fy,row:jve,setDifference:pV,setMultiplicity:Nve,setSymDifference:mV,column:AV,inv:iv,lup:gV,pinv:Tve,pow:Ef,setIntersect:vV,setUnion:Fve,sqrtm:_ve,vacuumImpedance:Pve,wienDisplacement:Ive,atomicMass:Bve,bohrMagneton:Rve,boltzmann:$ve,conductanceQuantum:qve,coulomb:Lve,deuteronMass:zve,dotPow:Uve,electricConstant:Wve,elementaryCharge:Hve,expm:Vve,faraday:Gve,fft:yV,gamma:zB,gravitationConstant:Qve,hartreeEnergy:Yve,ifft:Zve,klitzing:Xve,loschmidt:Kve,magneticConstant:Jve,molarMass:e1e,molarPlanckConstant:t1e,neutronMass:r1e,nuclearMagneton:n1e,planckCharge:i1e,planckLength:a1e,planckTemperature:o1e,protonMass:s1e,quantumOfCirculation:l1e,reducedPlanckConstant:u1e,rydberg:c1e,secondRadiation:f1e,speedOfLight:d1e,stefanBoltzmann:p1e,thomsonCrossSection:m1e,avogadro:h1e,bohrRadius:A1e,createUnit:g1e,divide:ys,electronMass:v1e,factorial:$S,firstRadiation:y1e,gravity:b1e,inverseConductanceQuantum:x1e,lusolve:bV,magneticFluxQuantum:w1e,molarMassC12:S1e,multinomial:E1e,parse:_d,permutations:k1e,planckMass:C1e,polynomialRoot:D1e,resolve:eye,setSize:O1e,simplifyConstant:OV,solveODE:M1e,stirlingS2:xV,unit:j1e,bellNumbers:N1e,compile:QHe,eigs:wV,fermiCoupling:T1e,gasConstant:F1e,kldivergence:_1e,mean:SV,molarVolume:P1e,planckConstant:I1e,quantileSeq:B1e,simplifyCore:MV,variance:UB,classicalElectronRadius:R1e,evaluate:jV,median:lC,simplify:HB,symbolicEqual:YHe,corr:$1e,freqz:q1e,leafCount:ZHe,mad:L1e,parser:XHe,rationalize:KHe,std:z1e,zeta:U1e,derivative:JHe,norm:WB,rotationMatrix:EV,help:eVe,planckTime:W1e,schur:kV,rotate:H1e,sylvester:CV,lyap:V1e,config:it});Fn(LS,qS,{filter:iB({typed:Me}),forEach:aB({typed:Me}),map:sB({typed:Me}),apply:rB({isInteger:Uu,typed:Me}),or:SB({DenseMatrix:Lr,concat:xn,equalScalar:Zr,matrix:vt,typed:Me}),and:wB({add:an,concat:xn,equalScalar:Zr,matrix:vt,not:nC,typed:Me,zeros:Qs}),concat:mB({isInteger:Uu,matrix:vt,typed:Me}),max:lB({config:it,larger:cu,numeric:Fd,typed:Me}),print:xB({add:an,matrix:vt,typed:Me,zeros:Qs}),bitAnd:EB({add:an,concat:xn,equalScalar:Zr,matrix:vt,not:nC,typed:Me,zeros:Qs}),diff:hB({bignumber:Oc,matrix:vt,number:Xm,subtract:to,typed:Me}),min:cB({config:it,numeric:Fd,smaller:uu,typed:Me}),subset:pB({add:an,matrix:vt,typed:Me,zeros:Qs}),bitOr:kB({DenseMatrix:Lr,concat:xn,equalScalar:Zr,matrix:vt,typed:Me}),cumsum:yB({add:an,typed:Me,unaryPlus:DB}),index:oB({Index:Sl,getMatrixDataType:MB}),sum:gB({add:an,config:it,numeric:Fd,typed:Me}),range:fB({bignumber:Oc,matrix:vt,add:an,config:it,isPositive:ev,larger:cu,largerEq:aC,smaller:uu,smallerEq:Ty,typed:Me}),row:dB({Index:Sl,matrix:vt,range:Fy,typed:Me}),column:nB({Index:Sl,matrix:vt,range:Fy,typed:Me}),mean:uB({add:an,divide:ys,typed:Me}),quantileSeq:vB({add:an,bignumber:Oc,compare:nv,divide:ys,isInteger:Uu,larger:cu,multiply:ni,partitionSelect:sC,smaller:uu,smallerEq:Ty,subtract:to,typed:Me}),variance:bB({add:an,apply:TB,divide:ys,isNaN:PS,multiply:ni,subtract:to,typed:Me}),std:AB({map:tv,sqrt:Td,typed:Me,variance:UB})});Fn(G1e,{BigNumber:yt,Complex:Ei,Fraction:K0,Matrix:eC,Node:fu,ObjectNode:zS,OperatorNode:ZA,ParenthesisNode:_y,Range:Ige,RelationalNode:Q1e,ResultSet:WH,ArrayNode:US,BlockNode:Y1e,ConditionalNode:Z1e,ConstantNode:av,DenseMatrix:Lr,RangeNode:X1e,Chain:DV,FunctionAssignmentNode:K1e,SparseMatrix:Km,IndexNode:WS,ImmutableDenseMatrix:aV,Index:Sl,AccessorNode:HS,AssignmentNode:J1e,FibonacciHeap:cV,Spa:hV,Unit:br,SymbolNode:ov,FunctionNode:sv,Help:tye,Parser:rye});DV.createProxy(qS);var NV=LH;var sye=Ae(oT(),1);var iye=Ae(nye(),1);function aye(e){var t=new iye.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 oye(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(wy(j)||O!==void 0){var N=wy(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(wy(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(iW(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(sW).forEach(C=>{if(iW(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)||ps(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 VB(e,t){var r=Fn({},yy,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=aye({isNumber:Gt,isComplex:ps,isBigNumber:It,isFraction:gf,isUnit:Fo,isString:ma,isArray:Ir,isMatrix:St,isCollection:Oa,isDenseMatrix:LA,isSparseMatrix:vf,isRange:q0,isIndex:Wm,isBoolean:HN,isResultSet:VN,isHelp:zw,isFunction:GN,isDate:QN,isRegExp:YN,isObject:Hm,isNull:ZN,isUndefined:XN,isAccessorNode:zu,isArrayNode:ms,isAssignmentNode:KN,isBlockNode:JN,isConditionalNode:eT,isConstantNode:vr,isFunctionAssignmentNode:Ed,isFunctionNode:xl,isIndexNode:Sc,isNode:Nr,isObjectNode:Vm,isOperatorNode:xi,isParenthesisNode:hs,isRangeNode:tT,isRelationalNode:rT,isSymbolNode:ri,isChain:Uw});n.config=Joe(r,n.emit),n.expression={transform:{},mathWithTransform:{config:n.config}};var i=[],a=[];function o(c){if(wy(c))return c(n);var f=c[Object.keys(c)[0]];if(wy(f))return f(n);if(!Zoe(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{QU(s).forEach(c=>{c&&c.meta&&c.meta.recreateOnConfigChange&&u(c,{override:!0})})}),n.create=VB.bind(null,e),n.factory=V,n.import(QU(Qoe(e))),n.ArgumentsError=bf,n.DimensionError=ar,n.IndexError=gs,n}var uC={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}},lye=(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)};lye.rawArgs=!0;var uye=(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)};cye.rawArgs=!0;var fye=(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))};fye.rawArgs=!0;var dye=(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))};dye.rawArgs=!0;var pye=(e,t,r)=>r?.get("$current");pye.rawArgs=!0;var mye=(e,t,r)=>r?.get("$index");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.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})??"":""};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.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}):""};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.filter((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.map((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!==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))):""};yye.rawArgs=!0;var bye=(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))):""};bye.rawArgs=!0;var xye=(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():""};xye.rawArgs=!0;var wye=(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=ca(i,r.get(n[0]));return(i=="file"||i=="link"||i=="context")&&(i.includes("multi")?a=tr(a).map(o=>r.get("$paths").get(o)??o):a=r.get("$paths").get(a)??a),i=="date"&&(a=Zi(a)),a??""};wye.rawArgs=!0;var Sye=(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?Ya(n,i):Ya(n,r.get("$settings")?.dateFormat??"yyyy-MM-dd")};Eye.rawArgs=!0;var Wu=e=>typeof e=="string"||e instanceof String?e:e instanceof Date?Ya(e,"yyyy-MM-dd"):typeof e=="number"?e.toFixed(0):e?.path?e.path:"",cC={prop:wye,_current:pye,_index:mye,slice:(e,t,r)=>(e=Wu(e),e.slice(t,r)),if:(e,t,r)=>e===!0?t:r,ifs:Sye,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=Wu(e),r?e.substring(t,r):e.substring(t)),startsWith:(e,t)=>(e=Wu(e),t=Wu(t),e.startsWith(t)),contains:(e,t)=>(e=Wu(e),t=Wu(t),e.includes(t)),test:(e,t)=>(e=Wu(e),new RegExp(t).test(e)),match:(e,t)=>(e=Wu(e),e.match(new RegExp(t))),replace:(e,t,r)=>(e=Wu(e),e.replace(new RegExp(t),r)),replaceAll:(e,t,r)=>(e=Wu(e),t=Wu(t),r=Wu(r),e.replace(new RegExp(t,"g"),r)),lower:e=>(e=Wu(e),e.toLowerCase()),upper:e=>(e=Wu(e),e.toUpperCase()),repeat:(e,t)=>e.repeat(t),format:Wu,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=>Ya(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:Eye,parseDate:e=>Zi(e),find:hye,findIndex:Aye,filter:gye,map:vye,some:yye,every:bye,flat:xye,path:cye,let:lye,lets:uye,spaceItems:fye,spaces:dye};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=$i("",u),typeof u!="string"&&s)throw u}catch(c){if(u="",s)throw c}return u};var GB=(e,t)=>t.startsWith(e),_V=(e,t)=>(r,n)=>{let i=t?r:n,a=t?n:r;return e(i)e(a)?1:0},kye=(e,t)=>(r,n)=>{let i=t?r:n,a=t?n:r;return i[e]a[e]?1:0},Cye=(e,t)=>(r,n)=>{let i=t?r:n,a=t?n:r;return i[e]?.toLowerCase().localeCompare(a[e]?.toLowerCase(),void 0,{numeric:!0})},Dye=(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),""}},XA=e=>e?.charAt(0)=="_"?XA(e.substring(1)):e?.replace(/"/g,""),eh=e=>e?.replace(/[^a-z0-9+]+/gi,""),nVe=/^[+\$#^]+/,Oye=/[\/\?<>\\:\*\|":]/g,Mye=/[\x00-\x1f\x80-\x9f]/g,jye=/^\.+$/,Nye=/^(con|prn|aux|nul|com[0-9]|lpt[0-9])(\..*)?$/i,Tye=e=>{let t="";return e.replace(nVe,t).replace(Oye,t).replace(Mye,t).replace(jye,t).replace(Nye,t)},lv=e=>{let t="";return e.replace(Oye,t).replace(Mye,t).replace(jye,t).replace(Nye,t)};var QB=(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),fC=(e,t)=>e.spaceManager.createSpace(zx(t),e.settings.spacesFolder,null);var iVe=e=>({field:Rs(e?.field??"rank"),asc:YE(e?.asc),group:YE(e?.group),recursive:YE(e?.recursive)}),aVe=e=>e=="fileprop"?"file":e=="filemeta"?"path":Rs(e),oVe=e=>({type:aVe(e.type),fType:Rs(e.fType),field:Rs(e.field),fn:Rs(e.fn),value:Rs(e.value)}),sVe=e=>({type:wJ(e.type,["any","all"],"any"),trueFalse:!!e.truefalse,filters:dl(e.filters).map(t=>oVe(t))}),dC=(e,t)=>({sort:iVe(e[_k]),recursive:Rs(e[oj]),contexts:dl(e[Mk]),links:dl(e[Fk]),filters:dl(e[Tk]).map(r=>sVe(r)),template:Rs(e[jk]),templateName:Rs(e[Nk]),defaultSticker:Rs(e.defaultSticker),readMode:YE(e.readMode)}),Fye=(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"}),YB=(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),PV=e=>(t,r)=>{if(e.field=="rank")return t.rank-r.rank;let n=[];if(e.group&&n.push(kye("type",!1)),e.field=="number")n.push(Dye("name",e.asc));else if(e.field=="name")n.push(Cye(e.field,e.asc));else if(e.field.startsWith("props")){let i=e.field.split(".")[1],a=o=>o?.metadata?.property?.[i];n.push(_V(a,e.asc))}else{let i=a=>a?.metadata?.file?.[e.field];n.push(_V(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(()=>Goe(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})))},IV=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(W.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)},_ye=(e,t,r)=>{pC(e,t,"template",r)},Pye=(e,t,r)=>{pC(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},pC=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})},lVe=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 uv=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)},Iye=async(e,t)=>{let r=e.spacesIndex.get(t);!r||(r.type=="tag"?e.onTagDeleted(r.name):r.type=="folder"&&await P1(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,cv=async(e,t,r)=>{let n=e.spacesIndex.get(r);!n||(await e.spaceManager.saveTemplate(t,n.path),e.ui.notify(W.notice.templateSaved+n.name))},fv=async(e,t,r)=>{let n=e.spacesIndex.get(t);!n||(n.type=="tag"?r.forEach(i=>QB(e,i,n.name)):(n.type=="folder"||n.type=="vault")&&await pC(e,n.path,"links",n.metadata.links.filter(i=>!r.some(a=>a==i))))},mC=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}`)){Ji(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)},Ji=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 Bye=async(e,t,r)=>{let n=(i,a,o)=>{let s={...a,name:XA(a.name)},l=i;if(s.name=="")return e.ui.notify(W.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(W.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)?lVe(e,t,r):e.spaceManager.saveProperties(t,r),BV=(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)},Rye=(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}=mr(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]:$i(p,l[p])}),{}),c=s.map(d=>i.find(p=>p.name==d)).filter(d=>d&&d.type=="fileprop"),f=i.reduce((d,p)=>({...d,[p.name]:p}),{});return{...n,...u,...c.reduce((d,p)=>{let{value:h}=mr(p.value,p.type);return{...d,[p.name]:Pd(e,t,r,h,f,{...n,...d},a)}},{})}};var ZB=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 uVe(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]=Hte({...l,node:{...l.node,props:{...l.node.props,_index:`${s}`,value:`${n.id}.props.value[${s}]`}}},a);return a=c,kk(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}},uVe=async(e,t,r,n)=>{let i=await cVe(e,t,r,n),a=$ye(e.node,"styles",e.execStyles,i);return $ye(e.node,"actions",e.execActions,a)},YS=(e,t)=>((typeof e=="string"||e instanceof String?e.includes(` -`):!1)?new Function(`with(this) { ${e} }`):new Function(`with(this) { return ${e}; }`)).call(t),cVe=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 $ye(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 RV=(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(ir(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=ji(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=>!RV(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 yA.rows;let i=await this.fileSystem.readFileFragments(n,"schemas",null);return i.length==0?yA.rows:i}defaultDBTablesForContext(t){let r=Kx(this.spaceManager.superstate,t),n=bq(t);return{...YJ(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(Xg)&&t==Xg+"overview"?are: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?aj: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={...Ok(r),m_schema:VJ},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:ua.uniques,cols:ua.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=YS(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:ua.uniques,cols:ua.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",pr):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=>!RV(this.spaceManager.superstate.settings,i)).map(i=>Pk(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=>h0(this.spaceManager,MM(o)))??[])();return[...n,...a,...r]}return r}readTags(){return this.fileSystem.allTags()}spaceInfoForPath(t){return sre(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 dC(s,this.spaceManager.superstate.settings)}let i=ir(n)??{};return dC(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=>({[Tk]:i.filters,[Mk]:i.contexts,[Fk]:i.links,[_k]:i.sort,[jk]:i.template,[Nk]:i.templateName,[oj]: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=h0(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 qye={"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 mhe={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 hhe={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 Ahe={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 ghe={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 vhe={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 yhe={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 bhe={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 xhe={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 whe={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 She={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 Ehe={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 khe={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 Che={name:"asech",category:"Trigonometry",syntax:["asech(x)"],description:"Calculate the inverse secant of a value.",examples:["asech(0.5)"],seealso:["acsch","acoth"]};var Dhe={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 Ohe={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 Mhe={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 jhe={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 Nhe={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 The={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 Fhe={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 _he={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 Phe={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 Ihe={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 Bhe={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 Rhe={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 $he={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 qhe={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 Lhe={name:"sinh",category:"Trigonometry",syntax:["sinh(x)"],description:"Compute the hyperbolic sine of x in radians.",examples:["sinh(0.5)"],seealso:["cosh","tanh"]};var zhe={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 Uhe={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 Whe={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 Hhe={name:"bin",category:"Utils",syntax:["bin(value)"],description:"Format a number as binary",examples:["bin(2)"],seealso:["oct","hex"]};var Vhe={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 Ghe={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 Qhe={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 Yhe={name:"hex",category:"Utils",syntax:["hex(value)"],description:"Format a number as hexadecimal",examples:["hex(240)"],seealso:["bin","oct"]};var Zhe={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 Xhe={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 Khe={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 Jhe={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 eAe={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 tAe={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 rAe={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 nAe={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 iAe={name:"oct",category:"Utils",syntax:["oct(value)"],description:"Format a number as octal",examples:["oct(56)"],seealso:["bin","hex"]};var aAe={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 oAe={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 sAe={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 lAe={bignumber:Kfe,boolean:Jfe,complex:ede,createUnit:tde,fraction:rde,index:nde,matrix:ide,number:ade,sparse:ode,splitUnit:sde,string:lde,unit:ude,e:NH,E:NH,false:Bfe,i:Rfe,Infinity:$fe,LN2:Lfe,LN10:qfe,LOG2E:Ufe,LOG10E:zfe,NaN:Wfe,null:Hfe,pi:TH,PI:TH,phi:Vfe,SQRT1_2:Gfe,SQRT2:Qfe,tau:Yfe,true:Zfe,version:Xfe,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:pde,lsolve:hde,lsolveAll:Ade,lup:gde,lusolve:vde,leafCount:mde,polynomialRoot:yde,resolve:wde,simplify:Sde,simplifyConstant:Ede,simplifyCore:kde,symbolicEqual:Dde,rationalize:xde,slu:Cde,usolve:Ode,usolveAll:Mde,qr:bde,abs:jde,add:Nde,cbrt:Tde,ceil:Fde,cube:_de,divide:Pde,dotDivide:Ide,dotMultiply:Bde,dotPow:Rde,exp:$de,expm:qde,expm1:Lde,fix:zde,floor:Ude,gcd:Wde,hypot:Hde,lcm:Gde,log:Qde,log2:Xde,log1p:Zde,log10:Yde,mod:Kde,multiply:Jde,norm:epe,nthRoot:tpe,nthRoots:rpe,pow:npe,round:ipe,sign:ape,sqrt:ope,sqrtm:spe,square:fpe,subtract:dpe,unaryMinus:ppe,unaryPlus:mpe,xgcd:hpe,invmod:Vde,bitAnd:Ape,bitNot:gpe,bitOr:vpe,bitXor:ype,leftShift:bpe,rightArithShift:xpe,rightLogShift:wpe,bellNumbers:Spe,catalan:Epe,composition:kpe,stirlingS2:Cpe,config:cde,import:fde,typed:dde,arg:Dpe,conj:Ope,re:jpe,im:Mpe,evaluate:Npe,help:Tpe,distance:Fpe,intersect:_pe,and:Ppe,not:Ipe,or:Bpe,xor:Rpe,concat:qpe,count:Lpe,cross:zpe,column:$pe,ctranspose:Upe,det:Wpe,diag:Hpe,diff:Vpe,dot:Gpe,getMatrixDataType:Kpe,identity:Jpe,filter:Ype,flatten:Zpe,forEach:Xpe,inv:eme,pinv:tme,eigs:Qpe,kron:rme,matrixFromFunction:ame,matrixFromRows:ome,matrixFromColumns:ime,map:nme,ones:sme,partitionSelect:lme,range:ume,resize:fme,reshape:cme,rotate:dme,rotationMatrix:pme,row:mme,size:hme,sort:Ame,squeeze:gme,subset:vme,trace:yme,transpose:bme,zeros:xme,fft:wme,ifft:Sme,sylvester:lpe,schur:upe,lyap:cpe,solveODE:sAe,combinations:Eme,combinationsWithRep:kme,factorial:Cme,gamma:Dme,kldivergence:Mme,lgamma:Ome,multinomial:jme,permutations:Nme,pickRandom:Tme,random:Fme,randomInt:_me,compare:Pme,compareNatural:Ime,compareText:Bme,deepEqual:Rme,equal:$me,equalText:qme,larger:Lme,largerEq:zme,smaller:Ume,smallerEq:Wme,unequal:Hme,setCartesian:Vme,setDifference:Gme,setDistinct:Qme,setIntersect:Yme,setIsSubset:Zme,setMultiplicity:Xme,setPowerset:Kme,setSize:Jme,setSymDifference:ehe,setUnion:the,zpk2tf:rhe,freqz:nhe,erf:ihe,zeta:ahe,cumsum:hhe,mad:ohe,max:she,mean:lhe,median:uhe,min:che,mode:fhe,prod:dhe,quantileSeq:phe,std:mhe,sum:Ahe,variance:ghe,corr:vhe,acos:yhe,acosh:bhe,acot:xhe,acoth:whe,acsc:She,acsch:Ehe,asec:khe,asech:Che,asin:Dhe,asinh:Ohe,atan:Mhe,atanh:Nhe,atan2:jhe,cos:The,cosh:Fhe,cot:_he,coth:Phe,csc:Ihe,csch:Bhe,sec:Rhe,sech:$he,sin:qhe,sinh:Lhe,tan:zhe,tanh:Uhe,to:Whe,clone:Vhe,format:Ghe,bin:Hhe,oct:iAe,hex:Yhe,isNaN:Xhe,isInteger:Zhe,isNegative:Khe,isNumeric:Jhe,hasNumericValue:Qhe,isPositive:eAe,isPrime:tAe,isZero:rAe,print:aAe,typeOf:oAe,numeric:nAe};var uAe="help",VUe=["typed","mathWithTransform","Help"],Z4=V(uAe,VUe,e=>{var{typed:t,mathWithTransform:r,Help:n}=e;return t(uAe,{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=Xi(lAe,s);if(!l){var u=typeof s=="function"?s.name:s;throw new Error('No documentation found on "'+u+'"')}return new n(l)}})});var cAe="chain",GUe=["typed","Chain"],X4=V(cAe,GUe,e=>{var{typed:t,Chain:r}=e;return t(cAe,{"":function(){return new r},any:function(i){return new r(i)}})});var fAe="det",QUe=["typed","matrix","subtractScalar","multiply","divideScalar","isZero","unaryMinus"],K4=V(fAe,QUe,e=>{var{typed:t,matrix:r,subtractScalar:n,multiply:i,divideScalar:a,isZero:o,unaryMinus:s}=e;return t(fAe,{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: "+rr(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: "+rr(f)+")")}default:throw new RangeError("Matrix must be two dimensional (size: "+rr(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(dAe,{"Array | Matrix":function(d){var p=St(d)?d.size():Qt(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: "+rr(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: "+rr(p)+")")}default:throw new RangeError("Matrix must be two dimensional (size: "+rr(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(pAe,{"Array | Matrix":function(v){var x=St(v)?v.size():Qt(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: "+rr(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 mAe(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 hAe(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 XUe="eigs",KUe=["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"],tP=V(XUe,KUe,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=hAe({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}),_=mAe({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(rr(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(AAe,{Matrix:function(f){var d=f.size();if(d.length!==2||d[0]!==d[1])throw new RangeError("Matrix must be square (size: "+rr(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(gAe,{"Array | Matrix":function(g){var A=St(g)?g.size():Qt(g);switch(A.length){case 1:if(A[0]===1)return a(g,o);throw new RangeError("Matrix must be square (size: "+rr(A)+")");case 2:{var b=A[0],v=A[1];if(b===v)return h(g);throw new RangeError("Matrix must be square (size: "+rr(A)+")")}default:throw new RangeError("Matrix must be at most two dimensional (size: "+rr(A)+")")}}})});var vAe="sylvester",tWe=["typed","schur","matrixFromColumns","matrix","multiply","range","concat","transpose","index","subset","add","subtract","identity","lusolve","abs"],iP=V(vAe,tWe,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(vAe,{"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(yAe,{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 bAe="lyap",nWe=["typed","matrix","sylvester","multiply","transpose"],oP=V(bAe,nWe,e=>{var{typed:t,matrix:r,sylvester:n,multiply:i,transpose:a}=e;return t(bAe,{"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 iWe="divide",aWe=["typed","matrix","multiply","equalScalar","divideScalar","inv"],sP=V(iWe,aWe,e=>{var{typed:t,matrix:r,multiply:n,equalScalar:i,divideScalar:a,inv:o}=e,s=Qn({typed:t,equalScalar:i}),l=vo({typed:t});return t("divide",nT({"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 xAe="distance",oWe=["typed","addScalar","subtractScalar","divideScalar","multiplyScalar","deepEqual","sqrt","abs"],lP=V(xAe,oWe,e=>{var{typed:t,addScalar:r,subtractScalar:n,multiplyScalar:i,divideScalar:a,deepEqual:o,sqrt:s,abs:l}=e;return t(xAe,{"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 wAe="sum",uWe=["typed","config","add","numeric"],CS=V(wAe,uWe,e=>{var{typed:t,config:r,add:n,numeric:i}=e;return t(wAe,{"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=Q0(s,l,n);return u}catch(c){throw La(c,"sum")}}});var cP="cumsum",cWe=["typed","add","unaryPlus"],DS=V(cP,cWe,e=>{var{typed:t,add:r,unaryPlus:n}=e;return t(cP,{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,cP)}}function a(l){if(l.length===0)return[];for(var u=[n(l[0])],c=1;c=c.length)throw new gs(u,c.length);try{return s(l,u)}catch(f){throw La(f,cP)}}function s(l,u){var c,f,d;if(u<=0){var p=l[0][0];if(Array.isArray(p)){for(d=FT(l),f=[],c=0;c{var{typed:t,add:r,divide:n}=e;return t(SAe,{"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=Q0(o,s,r),u=Array.isArray(o)?Qt(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 EAe="median",dWe=["typed","add","divide","compare","partitionSelect"],fP=V(EAe,dWe,e=>{var{typed:t,add:r,divide:n,compare:i,partitionSelect:a}=e;function o(u){try{u=hr(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(EAe,{"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 kAe="mad",pWe=["typed","abs","map","median","subtract"],dP=V(kAe,pWe,e=>{var{typed:t,abs:r,map:n,median:i,subtract:a}=e;return t(kAe,{"Array | Matrix":o,"...":function(l){return o(l)}});function o(s){if(s=hr(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 FH="unbiased",CAe="variance",mWe=["typed","add","subtract","multiply","divide","apply","isNaN"],MS=V(CAe,mWe,e=>{var{typed:t,add:r,subtract:n,multiply:i,divide:a,apply:o,isNaN:s}=e;return t(CAe,{"Array | Matrix":function(f){return l(f,FH)},"Array | Matrix, string":l,"Array | Matrix, number | BigNumber":function(f,d){return u(f,d,FH)},"Array | Matrix, number | BigNumber, string":u,"...":function(f){return l(f,FH)}});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 DAe="quantileSeq",hWe=["typed","?bignumber","add","subtract","divide","multiply","partitionSelect","compare","isInteger","smaller","smallerEq","larger"],jS=V(DAe,hWe,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=Y0({typed:t,isInteger:u});return t(DAe,{"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 Gt(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 Gt(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 OAe="std",AWe=["typed","map","sqrt","variance"],NS=V(OAe,AWe,e=>{var{typed:t,map:r,sqrt:n,variance:i}=e;return t(OAe,{"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 Oa(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 MAe="corr",gWe=["typed","matrix","mean","sqrt","sum","add","subtract","multiply","pow","divide"],pP=V(MAe,gWe,e=>{var{typed:t,matrix:r,sqrt:n,sum:i,add:a,subtract:o,multiply:s,pow:l,divide:u}=e;return t(MAe,{"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 jAe="combinations",vWe=["typed"],mP=V(jAe,vWe,e=>{var{typed:t}=e;return t(jAe,{"number, number":VW,"BigNumber, BigNumber":function(n,i){var a=n.constructor,o,s,l=n.minus(i),u=new a(1);if(!NAe(n)||!NAe(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 NAe(e){return e.isInteger()&&e.gte(0)}var TAe="combinationsWithRep",yWe=["typed"],hP=V(TAe,yWe,e=>{var{typed:t}=e;return t(TAe,{"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 V6(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(Cy[0],0),p=1;p2;)d-=2,h+=d,p=p.times(h);return new a(p.toPrecision(a.precision))}});var PAe="lgamma",xWe=["Complex","typed"],gP=V(PAe,xWe,e=>{var{Complex:t,typed:r}=e,n=7,i=7,a=[-.029550653594771242,.00641025641025641,-.0019175269175269176,.0008417508417508417,-.0005952380952380953,.0007936507936507937,-.002777777777777778,.08333333333333333];return r(PAe,{number:G6,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(G6(u.re),0);if(u.re>=n||Math.abs(u.im)>=i)return s(u);if(u.re<=d){var p=dse(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(JW),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 IAe="factorial",wWe=["typed","gamma"],vP=V(IAe,wWe,e=>{var{typed:t,gamma:r}=e;return t(IAe,{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 BAe="kldivergence",SWe=["typed","matrix","divide","sum","multiply","map","dotDivide","log","isNumeric"],yP=V(BAe,SWe,e=>{var{typed:t,matrix:r,divide:n,sum:i,multiply:a,map:o,dotDivide:s,log:l,isNumeric:u}=e;return t(BAe,{"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 RAe="multinomial",EWe=["typed","add","divide","multiply","factorial","isInteger","isPositive"],bP=V(RAe,EWe,e=>{var{typed:t,add:r,divide:n,multiply:i,factorial:a,isInteger:o,isPositive:s}=e;return t(RAe,{"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 $Ae="permutations",kWe=["typed","factorial"],xP=V($Ae,kWe,e=>{var{typed:t,factorial:r}=e;return t($Ae,{"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(!qAe(i)||!qAe(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 qAe(e){return e.isInteger()&&e.gte(0)}var qH=Ae(rge(),1),TWe=(0,qH.default)(Date.now());function GA(e){var t;function r(i){t=i===null?TWe:(0,qH.default)(String(i))}r(e);function n(){return t()}return n}var nge="pickRandom",FWe=["typed","config","?on"],SP=V(nge,FWe,e=>{var{typed:t,config:r,on:n}=e,i=GA(r.randomSeed);return n&&n("config",function(o,s){o.randomSeed!==s.randomSeed&&(i=GA(o.randomSeed))}),t(nge,{"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=hr(o),u=hr(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=GA(r.randomSeed);return n&&n("config",function(s,l){s.randomSeed!==l.randomSeed&&(i=GA(s.randomSeed))}),t(ige,{"":()=>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=K6(s.valueOf(),()=>o(l,u));return St(s)?s.create(c):c}function o(s,l){return s+i()*(l-s)}});var age="randomInt",PWe=["typed","config","?on"],kP=V(age,PWe,e=>{var{typed:t,config:r,on:n}=e,i=GA(r.randomSeed);return n&&n("config",function(s,l){s.randomSeed!==l.randomSeed&&(i=GA(s.randomSeed))}),t(age,{"":()=>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=K6(s.valueOf(),()=>o(l,u));return St(s)?s.create(c):c}function o(s,l){return Math.floor(s+i()*(l-s))}});var oge="stirlingS2",IWe=["typed","addScalar","subtractScalar","multiplyScalar","divideScalar","pow","factorial","combinations","isNegative","isInteger","number","?bignumber","larger"],CP=V(oge,IWe,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(oge,{"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=!(Gt(A)&&Gt(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 sge="bellNumbers",BWe=["typed","addScalar","isNegative","isInteger","stirlingS2"],DP=V(sge,BWe,e=>{var{typed:t,addScalar:r,isNegative:n,isInteger:i,stirlingS2:a}=e;return t(sge,{"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 lge="catalan",RWe=["typed","addScalar","divideScalar","multiplyScalar","combinations","isNegative","isInteger"],OP=V(lge,RWe,e=>{var{typed:t,addScalar:r,divideScalar:n,multiplyScalar:i,combinations:a,isNegative:o,isInteger:s}=e;return t(lge,{"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 uge="composition",$We=["typed","addScalar","combinations","isNegative","isPositive","isInteger","larger"],MP=V(uge,$We,e=>{var{typed:t,addScalar:r,combinations:n,isPositive:i,isNegative:a,isInteger:o,larger:s}=e;return t(uge,{"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 cge="leafCount",qWe=["parse","typed"],jP=V(cge,qWe,e=>{var{parse:t,typed:r}=e;function n(i){var a=0;return i.forEach(o=>{a+=n(o)}),a||1}return r(cge,{Node:function(a){return n(a)}})});function LH(e){return vr(e)||xi(e)&&e.isUnary()&&vr(e.args[0])}function J6(e){return!!(vr(e)||(xl(e)||xi(e))&&e.args.every(J6)||hs(e)&&J6(e.content))}function fge(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 zH(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:xi(v)?S=v.fn.toString():xl(v)?S=v.name:hs(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=zH({},v);for(var S in x)Et(v,S)?w[S]=zH(zH({},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 xi(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 UWe="simplify",WWe=["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"],NP=V(UWe,WWe,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:UA});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:UA}),te.defaultContext=_,te.realContext=Y,te.positiveContext=oe;function Q(ee){return ee.transform(function(ie,re,Ee){return hs(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]:U0(),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(vr(ie))Ce[0].placeholders[ee.name]=ie;else return[];break;case"v":if(!vr(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(LH(ie))Ce[0].placeholders[ee.name]=ie;else return[];break;case"vd":if(!LH(ie))Ce[0].placeholders[ee.name]=ie;else return[];break;case"ce":if(J6(ie))Ce[0].placeholders[ee.name]=ie;else return[];break;case"ve":if(!J6(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&&XF(),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(ms(z)||St(z)){for(var L=Array.from(I.dimensions);L.length>0;)if(vr(L[0])&&typeof L[0].value!="string"){var _=O(L.shift().value,T);ms(z)?z=z.items[_-1]:(z=z.valueOf()[_-1],z instanceof Array&&(z=i(z)))}else if(L.length>1&&vr(L[1])&&typeof L[1].value!="string"){var Y=O(L[1].value,T),oe=[],te=ms(z)?z.items:z.valueOf();for(var Q of te)if(ms(Q))oe.push(Q.items[Y-1]);else if(St(z))oe.push(Q[Y-1]);else break;if(oe.length===te.length)ms(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&&vr(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&&ms(L[0])){for(var _=[],Y=L[0];ms(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(xi(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 dge="simplifyCore",GWe=["typed","parse","equal","isZero","add","subtract","multiply","divide","pow","AccessorNode","ArrayNode","ConstantNode","FunctionNode","IndexNode","ObjectNode","OperatorNode","ParenthesisNode","SymbolNode"],FP=V(dge,GWe,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 xi(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=cfe(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(xi(I)&&I.isUnary()){var Y=C(I.args[0],D);if(I.op==="~"&&xi(Y)&&Y.isUnary()&&Y.op==="~"||I.op==="not"&&xi(Y)&&Y.isUnary()&&Y.op==="not"&&k(Y.args[0]))return Y.args[0];var oe=!0;if(I.op==="-"&&xi(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(xi(I)&&I.isBinary()){var te=C(I.args[0],D),Q=C(I.args[1],D);if(I.op==="+"){if(vr(te)&&i(te.value))return Q;if(vr(Q)&&i(Q.value))return te;xi(Q)&&Q.isUnary()&&Q.op==="-"&&(Q=Q.args[0],I=new g("-","subtract",[te,Q]))}if(I.op==="-")return xi(Q)&&Q.isUnary()&&Q.op==="-"?C(new g("+","add",[te,Q.args[0]]),D):vr(te)&&i(te.value)?C(new g("-","unaryMinus",[Q])):vr(Q)&&i(Q.value)?te:new g(I.op,I.fn,[te,Q]);if(I.op==="*"){if(vr(te)){if(i(te.value))return v;if(n(te.value,1))return Q}if(vr(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 vr(te)&&i(te.value)?v:vr(Q)&&n(Q.value,1)?te:new g(I.op,I.fn,[te,Q]);if(I.op==="^"&&vr(Q)){if(i(Q.value))return x;if(n(Q.value,1))return te}if(I.op==="and"){if(vr(te))if(te.value){if(k(Q))return Q;if(vr(Q))return Q.value?w:S}else return S;if(vr(Q))if(Q.value){if(k(te))return te}else return S}if(I.op==="or"){if(vr(te)){if(te.value)return w;if(k(Q))return Q}if(vr(Q)){if(Q.value)return w;if(k(te))return te}}return new g(I.op,I.fn,[te,Q])}if(xi(I))return new g(I.op,I.fn,I.args.map(Se=>C(Se,D)));if(ms(I))return new f(I.items.map(Se=>C(Se,D)));if(zu(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(dge,{Node:C,"Node,Object":C})});var QWe="resolve",YWe=["typed","parse","ConstantNode","FunctionNode","OperatorNode","ParenthesisNode"],_P=V(QWe,YWe,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(xi(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(hs(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,UA(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,UA(c))),"Matrix, Object":t.referTo("Matrix,Map",l=>(u,c)=>l(u,UA(c))),"Array | Matrix, Map":t.referToSelf(l=>(u,c)=>u.map(f=>l(f,c)))})});var pge="symbolicEqual",ZWe=["parse","simplify","typed","OperatorNode"],PP=V(pge,ZWe,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 vr(c)&&!c.value}return n(pge,{"Node, Node":a,"Node, Node, Object":a})});var mge="derivative",XWe=["typed","config","parse","simplify","equal","isZero","numeric","ConstantNode","FunctionNode","OperatorNode","ParenthesisNode","SymbolNode"],IP=V(mge,XWe,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(mge,{"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 vr(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 vr(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(vr(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 hge="rationalize",KWe=["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"],BP=V(hge,KWe,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(hge,{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 Age="zpk2tf",JWe=["typed","add","multiply","Complex","number"],RP=V(Age,JWe,e=>{var{typed:t,add:r,multiply:n,Complex:i,number:a}=e;return t(Age,{"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(gge,{"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 nHe="replacer",iHe=[],LP=V(nHe,iHe,()=>function(t,r){return typeof r=="number"&&(!isFinite(r)||isNaN(r))?{mathjs:"number",value:String(r)}:r});var vge="12.4.1";var zP=V("true",[],()=>!0),UP=V("false",[],()=>!1),WP=V("null",[],()=>null),HP=xf("Infinity",["config","?BigNumber"],e=>{var{config:t,BigNumber:r}=e;return t.number==="BigNumber"?new r(1/0):1/0}),VP=xf("NaN",["config","?BigNumber"],e=>{var{config:t,BigNumber:r}=e;return t.number==="BigNumber"?new r(NaN):NaN}),GP=xf("pi",["config","?BigNumber"],e=>{var{config:t,BigNumber:r}=e;return t.number==="BigNumber"?Z6(r):Jse}),QP=xf("tau",["config","?BigNumber"],e=>{var{config:t,BigNumber:r}=e;return t.number==="BigNumber"?xce(r):ele}),YP=xf("e",["config","?BigNumber"],e=>{var{config:t,BigNumber:r}=e;return t.number==="BigNumber"?yce(r):tle}),ZP=xf("phi",["config","?BigNumber"],e=>{var{config:t,BigNumber:r}=e;return t.number==="BigNumber"?bce(r):rle}),XP=xf("LN2",["config","?BigNumber"],e=>{var{config:t,BigNumber:r}=e;return t.number==="BigNumber"?new r(2).ln():Math.LN2}),KP=xf("LN10",["config","?BigNumber"],e=>{var{config:t,BigNumber:r}=e;return t.number==="BigNumber"?new r(10).ln():Math.LN10}),JP=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}),eI=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}),tI=xf("SQRT1_2",["config","?BigNumber"],e=>{var{config:t,BigNumber:r}=e;return t.number==="BigNumber"?new r("0.5").sqrt():Math.SQRT1_2}),rI=xf("SQRT2",["config","?BigNumber"],e=>{var{config:t,BigNumber:r}=e;return t.number==="BigNumber"?new r(2).sqrt():Math.SQRT2}),nI=xf("i",["Complex"],e=>{var{Complex:t}=e;return t.I}),yge=V("PI",["pi"],e=>{var{pi:t}=e;return t}),bge=V("E",["e"],e=>{var{e:t}=e;return t}),iI=V("version",[],()=>vge);function xf(e,t,r){return V(e,t,r,{recreateOnConfigChange:!0})}var aI=Rr("speedOfLight","299792458","m s^-1"),oI=Rr("gravitationConstant","6.67430e-11","m^3 kg^-1 s^-2"),sI=Rr("planckConstant","6.62607015e-34","J s"),lI=Rr("reducedPlanckConstant","1.0545718176461565e-34","J s"),uI=Rr("magneticConstant","1.25663706212e-6","N A^-2"),cI=Rr("electricConstant","8.8541878128e-12","F m^-1"),fI=Rr("vacuumImpedance","376.730313667","ohm"),dI=Rr("coulomb","8.987551792261171e9","N m^2 C^-2"),pI=Rr("elementaryCharge","1.602176634e-19","C"),mI=Rr("bohrMagneton","9.2740100783e-24","J T^-1"),hI=Rr("conductanceQuantum","7.748091729863649e-5","S"),AI=Rr("inverseConductanceQuantum","12906.403729652257","ohm"),gI=Rr("magneticFluxQuantum","2.0678338484619295e-15","Wb"),vI=Rr("nuclearMagneton","5.0507837461e-27","J T^-1"),yI=Rr("klitzing","25812.807459304513","ohm");var bI=Rr("bohrRadius","5.29177210903e-11","m"),xI=Rr("classicalElectronRadius","2.8179403262e-15","m"),wI=Rr("electronMass","9.1093837015e-31","kg"),SI=Rr("fermiCoupling","1.1663787e-5","GeV^-2"),EI=tB("fineStructure",.0072973525693),kI=Rr("hartreeEnergy","4.3597447222071e-18","J"),CI=Rr("protonMass","1.67262192369e-27","kg"),DI=Rr("deuteronMass","3.3435830926e-27","kg"),OI=Rr("neutronMass","1.6749271613e-27","kg"),MI=Rr("quantumOfCirculation","3.6369475516e-4","m^2 s^-1"),jI=Rr("rydberg","10973731.568160","m^-1"),NI=Rr("thomsonCrossSection","6.6524587321e-29","m^2"),TI=tB("weakMixingAngle",.2229),FI=tB("efimovFactor",22.7),_I=Rr("atomicMass","1.66053906660e-27","kg"),PI=Rr("avogadro","6.02214076e23","mol^-1"),II=Rr("boltzmann","1.380649e-23","J K^-1"),BI=Rr("faraday","96485.33212331001","C mol^-1"),RI=Rr("firstRadiation","3.7417718521927573e-16","W m^2"),$I=Rr("loschmidt","2.686780111798444e25","m^-3"),qI=Rr("gasConstant","8.31446261815324","J K^-1 mol^-1"),LI=Rr("molarPlanckConstant","3.990312712893431e-10","J s mol^-1"),zI=Rr("molarVolume","0.022413969545014137","m^3 mol^-1"),UI=tB("sackurTetrode",-1.16487052358),WI=Rr("secondRadiation","0.014387768775039337","m K"),HI=Rr("stefanBoltzmann","5.67037441918443e-8","W m^-2 K^-4"),VI=Rr("wienDisplacement","2.897771955e-3","m K"),GI=Rr("molarMass","0.99999999965e-3","kg mol^-1"),QI=Rr("molarMassC12","11.9999999958e-3","kg mol^-1"),YI=Rr("gravity","9.80665","m s^-2"),ZI=Rr("planckLength","1.616255e-35","m"),XI=Rr("planckMass","2.176435e-8","kg"),KI=Rr("planckTime","5.391245e-44","s"),JI=Rr("planckCharge","1.87554603778e-18","C"),eB=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 tB(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 aHe="apply",oHe=["typed","isInteger"],rB=V(aHe,oHe,e=>{var{typed:t,isInteger:r}=e,n=Y0({typed:t,isInteger:r});return t("apply",{"...any":function(a){var o=a[1];Gt(o)?a[1]=o-1:It(o)&&(a[1]=o.minus(1));try{return n.apply(null,a)}catch(s){throw Si(s)}}})},{isTransformFunction:!0});var sHe="column",lHe=["typed","Index","matrix","range"],nB=V(sHe,lHe,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];Gt(u)&&(s[l]=u-1);try{return a.apply(null,s)}catch(c){throw Si(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 uHe="filter",cHe=["typed"],iB=V(uHe,cHe,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":xge,"Matrix, function":function(a,o){return a.create(xge(a.toArray(),o))},"Array, RegExp":Yw,"Matrix, RegExp":function(a,o){return a.create(Yw(a.toArray(),o))}});return r},{isTransformFunction:!0});function xge(e,t){return pT(e,function(r,n,i){return Od(t,r,[n+1],i,"filter")})}var fHe="forEach",dHe=["typed"],aB=V(fHe,dHe,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))L0(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 pHe="index",mHe=["Index","getMatrixDataType"],oB=V(pHe,mHe,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(Gt(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 hHe="map",AHe=["typed"],sB=V(hHe,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("map",{"Array, function":function(a,o){return wge(a,o,a)},"Matrix, function":function(a,o){return a.create(wge(a.valueOf(),o,a))}});return r},{isTransformFunction:!0});function wge(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&&Oa(e[0])){e=e.slice();var t=e[1];Gt(t)?e[1]=t-1:It(t)&&(e[1]=t.minus(1))}return e}var gHe="max",vHe=["typed","config","numeric","larger"],lB=V(gHe,vHe,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 Si(l)}}})},{isTransformFunction:!0});var yHe="mean",bHe=["typed","add","divide"],uB=V(yHe,bHe,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 Si(s)}}})},{isTransformFunction:!0});var xHe="min",wHe=["typed","config","numeric","smaller"],cB=V(xHe,wHe,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 Si(l)}}})},{isTransformFunction:!0});var SHe="range",EHe=["typed","config","?matrix","?bignumber","smaller","smallerEq","larger","largerEq","add","isPositive"],fB=V(SHe,EHe,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 kHe="row",CHe=["typed","Index","matrix","range"],dB=V(kHe,CHe,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];Gt(u)&&(s[l]=u-1);try{return a.apply(null,s)}catch(c){throw Si(c)}}})},{isTransformFunction:!0});var DHe="subset",OHe=["typed","matrix","zeros","add"],pB=V(DHe,OHe,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 Si(l)}}})},{isTransformFunction:!0});var MHe="concat",jHe=["typed","matrix","isInteger"],mB=V(MHe,jHe,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];Gt(l)?o[s]=l-1:It(l)&&(o[s]=l.minus(1));try{return i.apply(null,o)}catch(u){throw Si(u)}}})},{isTransformFunction:!0});var Sge="diff",NHe=["typed","matrix","subtract","number","bignumber"],hB=V(Sge,NHe,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(Sge,{"...any":function(l){l=su(l);try{return o.apply(null,l)}catch(u){throw Si(u)}}})},{isTransformFunction:!0});var THe="std",FHe=["typed","map","sqrt","variance"],AB=V(THe,FHe,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 Si(l)}}})},{isTransformFunction:!0});var Ege="sum",_He=["typed","config","add","numeric"],gB=V(Ege,_He,e=>{var{typed:t,config:r,add:n,numeric:i}=e,a=CS({typed:t,config:r,add:n,numeric:i});return t(Ege,{"...any":function(s){s=su(s);try{return a.apply(null,s)}catch(l){throw Si(l)}}})},{isTransformFunction:!0});var PHe="quantileSeq",IHe=["typed","bignumber","add","subtract","divide","multiply","partitionSelect","compare","isInteger","smaller","smallerEq","larger"],vB=V(PHe,IHe,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 kge="cumsum",BHe=["typed","add","unaryPlus"],yB=V(kge,BHe,e=>{var{typed:t,add:r,unaryPlus:n}=e,i=DS({typed:t,add:r,unaryPlus:n});return t(kge,{"...any":function(o){if(o.length===2&&Oa(o[0])){var s=o[1];Gt(s)?o[1]=s-1:It(s)&&(o[1]=s.minus(1))}try{return i.apply(null,o)}catch(l){throw Si(l)}}})},{isTransformFunction:!0});var Cge="variance",RHe=["typed","add","subtract","multiply","divide","apply","isNaN"],bB=V(Cge,RHe,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(Cge,{"...any":function(c){c=su(c);try{return l.apply(null,c)}catch(f){throw Si(f)}}})},{isTransformFunction:!0});var Dge="print",$He=["typed","matrix","zeros","add"],xB=V(Dge,$He,e=>{var{typed:t,matrix:r,zeros:n,add:i}=e,a=vS({typed:t,matrix:r,zeros:n,add:i});return t(Dge,{"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(y3,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 qHe="and",LHe=["typed","matrix","zeros","add","equalScalar","not","concat"],wB=V(qHe,LHe,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(!Oa(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 zHe="or",UHe=["typed","matrix","equalScalar","DenseMatrix","concat"],SB=V(zHe,UHe,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(!Oa(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 WHe="bitAnd",HHe=["typed","matrix","zeros","add","equalScalar","not","concat"],EB=V(WHe,HHe,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(!Oa(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 VHe="bitOr",GHe=["typed","matrix","equalScalar","DenseMatrix","concat"],kB=V(VHe,GHe,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(!Oa(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=kT({config:it}),Ei=CT({}),WH=YP({BigNumber:yt,config:it}),Oge=UP({}),Mge=EI({BigNumber:yt,config:it}),K0=DT({}),HH=nI({Complex:Ei}),jge=HP({BigNumber:yt,config:it}),Nge=KP({BigNumber:yt,config:it}),Tge=eI({BigNumber:yt,config:it}),eC=MT({}),Fge=VP({BigNumber:yt,config:it}),_ge=WP({}),Pge=ZP({BigNumber:yt,config:it}),Ige=OT({}),VH=gT({}),Bge=tI({BigNumber:yt,config:it}),Rge=UI({BigNumber:yt,config:it}),GH=QP({BigNumber:yt,config:it}),$ge=zP({}),qge=iI({}),Lr=NT({Matrix:eC}),Lge=FI({BigNumber:yt,config:it}),zge=XP({BigNumber:yt,config:it}),CB=GP({BigNumber:yt,config:it}),Uge=LP({}),Wge=rI({BigNumber:yt,config:it}),Me=AT({BigNumber:yt,Complex:Ei,DenseMatrix:Lr,Fraction:K0}),DB=aF({BigNumber:yt,config:it,typed:Me}),Hge=TI({BigNumber:yt,config:it}),lu=oF({typed:Me}),Vge=p_({Complex:Ei,config:it,typed:Me}),Gge=h_({BigNumber:yt,typed:Me}),Qge=g_({BigNumber:yt,Complex:Ei,config:it,typed:Me}),Yo=lF({typed:Me}),Yge=_F({typed:Me}),Zge=b_({BigNumber:yt,Complex:Ei,config:it,typed:Me}),Xge=w_({typed:Me}),QH=S_({typed:Me}),Kge=k_({Complex:Ei,config:it,typed:Me}),Oc=ZT({BigNumber:yt,typed:Me}),Jge=TF({typed:Me}),e0e=YT({typed:Me}),t0e=TT({typed:Me}),tC=mP({typed:Me}),rC=XT({Complex:Ei,typed:Me}),J0=PF({typed:Me}),OB=C_({typed:Me}),r0e=O_({BigNumber:yt,typed:Me}),n0e=j_({BigNumber:yt,typed:Me}),i0e=dF({typed:Me}),Zr=HT({config:it,typed:Me}),a0e=f3({typed:Me}),YH=pF({typed:Me}),o0e=mF({Complex:Ei,typed:Me}),s0e=UF({typed:Me}),l0e=HF({typed:Me}),_S=h3({typed:Me}),MB=VF({typed:Me}),u0e=v3({format:_S,typed:Me}),jB=IF({typed:Me}),Uu=PT({typed:Me}),QA=BT({typed:Me}),ev=qT({typed:Me}),Nd=LT({typed:Me}),c0e=JP({BigNumber:yt,config:it}),f0e=gP({Complex:Ei,typed:Me}),d0e=vF({Complex:Ei,config:it,typed:Me}),ZH=yF({Complex:Ei,config:it,typed:Me}),tv=YF({typed:Me}),eo=bF({typed:Me}),nC=RF({typed:Me}),Xm=GT({typed:Me}),p0e=g3({format:_S,typed:Me}),m0e=SP({config:it,typed:Me}),h0e=vS({typed:Me}),A0e=EP({config:it,typed:Me}),NB=BF({typed:Me}),g0e=T_({BigNumber:yt,typed:Me}),XH=SF({BigNumber:yt,Fraction:K0,complex:rC,typed:Me}),iC=__({typed:Me}),Km=VT({Matrix:eC,equalScalar:Zr,typed:Me}),v0e=nF({typed:Me}),y0e=kF({typed:Me}),b0e=QT({typed:Me}),wf=uF({typed:Me}),x0e=I_({typed:Me}),KH=UT({typed:Me}),w0e=m_({Complex:Ei,config:it,typed:Me}),S0e=v_({BigNumber:yt,typed:Me}),TB=Y0({isInteger:Uu,typed:Me}),E0e=y_({BigNumber:yt,Complex:Ei,config:it,typed:Me}),k0e=A3({format:_S,typed:Me}),C0e=hP({typed:Me}),D0e=D_({typed:Me}),O0e=N_({BigNumber:yt,typed:Me}),PS=zT({typed:Me}),M0e=x3({typed:Me}),j0e=kP({config:it,typed:Me}),N0e=F_({BigNumber:yt,typed:Me}),T0e=P_({typed:Me}),F0e=f_({SparseMatrix:Km,typed:Me}),Td=EF({Complex:Ei,config:it,typed:Me}),_0e=B_({typed:Me}),zp=iF({typed:Me}),P0e=A_({BigNumber:yt,Complex:Ei,config:it,typed:Me}),I0e=M_({BigNumber:yt,typed:Me}),jy=KT({Fraction:K0,typed:Me}),rv=RT({typed:Me}),vt=JT({DenseMatrix:Lr,Matrix:eC,SparseMatrix:Km,typed:Me}),B0e=eF({isZero:Nd,matrix:vt,typed:Me}),R0e=p3({isNaN:PS,isNumeric:rv,typed:Me}),Fd=w3({bignumber:Oc,fraction:jy,number:Xm}),JH=m3({config:it,multiplyScalar:eo,numeric:Fd,typed:Me}),eV=JF({isInteger:Uu,matrix:vt,typed:Me}),Gs=n3({matrix:vt,config:it,typed:Me}),$0e=i3({matrix:vt,typed:Me}),IS=a3({matrix:vt,typed:Me}),tV=DF({BigNumber:yt,config:it,matrix:vt,typed:Me}),Qs=s3({BigNumber:yt,config:it,matrix:vt,typed:Me}),q0e=x_({Complex:Ei,config:it,typed:Me}),rV=cF({BigNumber:yt,Complex:Ei,Fraction:K0,config:it,isNegative:QA,matrix:vt,typed:Me,unaryMinus:zp}),xn=cS({isInteger:Uu,matrix:vt,typed:Me}),L0e=qF({prod:JH,size:Gs,typed:Me}),FB=o3({conj:J0,transpose:IS,typed:Me}),nV=zF({DenseMatrix:Lr,SparseMatrix:Km,matrix:vt,typed:Me}),ja=S3({numeric:Fd,typed:Me}),BS=j3({DenseMatrix:Lr,concat:xn,divideScalar:ja,equalScalar:Zr,matrix:vt,typed:Me}),Sf=U3({DenseMatrix:Lr,concat:xn,equalScalar:Zr,matrix:vt,typed:Me}),RS=WF({matrix:vt,typed:Me}),z0e=$T({isNumeric:rv,typed:Me}),YA=GF({BigNumber:yt,DenseMatrix:Lr,SparseMatrix:Km,config:it,matrix:vt,typed:Me}),U0e=QF({matrix:vt,multiplyScalar:eo,typed:Me}),aC=K3({DenseMatrix:Lr,concat:xn,config:it,matrix:vt,typed:Me}),W0e=P3({DenseMatrix:Lr,concat:xn,equalScalar:Zr,matrix:vt,typed:Me,zeros:Qs}),iV=N3({DenseMatrix:Lr,divideScalar:ja,equalScalar:Zr,matrix:vt,multiplyScalar:eo,subtractScalar:wf,typed:Me}),_B=rF({flatten:RS,matrix:vt,size:Gs,typed:Me}),H0e=wF({BigNumber:yt,concat:xn,equalScalar:Zr,matrix:vt,typed:Me}),V0e=ZF({BigNumber:yt,config:it,matrix:vt,typed:Me}),PB=z4({addScalar:Yo,complex:rC,conj:J0,divideScalar:ja,equal:Sf,identity:YA,isZero:Nd,matrix:vt,multiplyScalar:eo,sign:XH,sqrt:Td,subtractScalar:wf,typed:Me,unaryMinus:zp,zeros:Qs}),G0e=e3({config:it,matrix:vt}),Q0e=I3({DenseMatrix:Lr,concat:xn,equalScalar:Zr,matrix:vt,typed:Me,zeros:Qs}),Ny=k3({BigNumber:yt,DenseMatrix:Lr,config:it,equalScalar:Zr,matrix:vt,typed:Me,zeros:Qs}),uu=V3({DenseMatrix:Lr,concat:xn,config:it,matrix:vt,typed:Me}),to=CF({DenseMatrix:Lr,concat:xn,equalScalar:Zr,matrix:vt,subtractScalar:wf,typed:Me,unaryMinus:zp}),Y0e=b3({concat:xn,matrix:vt,typed:Me}),Z0e=t_({DenseMatrix:Lr,concat:xn,config:it,equalScalar:Zr,matrix:vt,typed:Me}),IB=T3({DenseMatrix:Lr,divideScalar:ja,equalScalar:Zr,matrix:vt,multiplyScalar:eo,subtractScalar:wf,typed:Me}),X0e=$F({DenseMatrix:Lr,concat:xn,matrix:vt,typed:Me}),an=Q_({DenseMatrix:Lr,SparseMatrix:Km,addScalar:Yo,concat:xn,equalScalar:Zr,matrix:vt,typed:Me}),K0e=E_({BigNumber:yt,DenseMatrix:Lr,concat:xn,equalScalar:Zr,matrix:vt,typed:Me}),J0e=sS({concat:xn,equalScalar:Zr,matrix:vt,typed:Me}),eve=lS({DenseMatrix:Lr,concat:xn,equalScalar:Zr,matrix:vt,typed:Me}),tve=FF({DenseMatrix:Lr,concat:xn,matrix:vt,typed:Me}),rve=OP({addScalar:Yo,combinations:tC,divideScalar:ja,isInteger:Uu,isNegative:QA,multiplyScalar:eo,typed:Me}),nv=$3({BigNumber:yt,DenseMatrix:Lr,Fraction:K0,concat:xn,config:it,equalScalar:Zr,matrix:vt,typed:Me}),aV=L3({concat:xn,matrix:vt,typed:Me}),nve=DS({add:an,typed:Me,unaryPlus:DB}),BB=J3({equal:Sf,typed:Me}),ive=dS({matrix:vt,number:Xm,subtract:to,typed:Me}),ave=lP({abs:lu,addScalar:Yo,deepEqual:BB,divideScalar:ja,multiplyScalar:eo,sqrt:Td,subtractScalar:wf,typed:Me}),oC=X_({addScalar:Yo,conj:J0,multiplyScalar:eo,size:Gs,typed:Me}),ove=W3({compareText:aV,isZero:Nd,typed:Me}),oV=nS({DenseMatrix:Lr,config:it,equalScalar:Zr,matrix:vt,round:Ny,typed:Me,zeros:Qs}),sve=AF({BigNumber:yt,DenseMatrix:Lr,concat:xn,config:it,equalScalar:Zr,matrix:vt,round:Ny,typed:Me,zeros:Qs}),lve=Y_({abs:lu,addScalar:Yo,divideScalar:ja,isPositive:ev,multiplyScalar:eo,smaller:uu,sqrt:Td,typed:Me}),sV=i_({DenseMatrix:Lr,smaller:uu}),Sl=a_({ImmutableDenseMatrix:sV,getMatrixDataType:MB}),cu=Z3({DenseMatrix:Lr,concat:xn,config:it,matrix:vt,typed:Me}),RB=C3({Complex:Ei,config:it,divideScalar:ja,typed:Me}),uve=F3({DenseMatrix:Lr,divideScalar:ja,equalScalar:Zr,matrix:vt,multiplyScalar:eo,subtractScalar:wf,typed:Me}),cve=tF({flatten:RS,matrix:vt,size:Gs,typed:Me}),fve=ES({config:it,numeric:Fd,smaller:uu,typed:Me}),lV=iS({DenseMatrix:Lr,concat:xn,config:it,equalScalar:Zr,matrix:vt,round:Ny,typed:Me,zeros:Qs}),ni=xF({addScalar:Yo,dot:oC,equalScalar:Zr,matrix:vt,multiplyScalar:eo,typed:Me}),dve=O3({Complex:Ei,config:it,divideScalar:ja,typed:Me}),pve=uS({DenseMatrix:Lr,concat:xn,equalScalar:Zr,matrix:vt,typed:Me}),sC=r_({compare:nv,isNaN:PS,isNumeric:rv,typed:Me}),mve=B3({DenseMatrix:Lr,concat:xn,equalScalar:Zr,matrix:vt,typed:Me,zeros:Qs}),uV=H4({SparseMatrix:Km,abs:lu,add:an,divideScalar:ja,larger:cu,largerEq:aC,multiply:ni,subtract:to,transpose:IS,typed:Me}),Mc=AS({add:an,matrix:vt,typed:Me,zeros:Qs}),$B=CS({add:an,config:it,numeric:Fd,typed:Me}),hve=K_({add:an,matrix:vt,typed:Me}),cV=_3({DenseMatrix:Lr,divideScalar:ja,equalScalar:Zr,matrix:vt,multiplyScalar:eo,subtractScalar:wf,typed:Me}),Ave=RP({Complex:Ei,add:an,multiply:ni,number:Xm,typed:Me}),qB=fF({DenseMatrix:Lr,config:it,equalScalar:Zr,matrix:vt,round:Ny,typed:Me,zeros:Qs}),Up=q3({compare:nv,typed:Me}),gve=MP({addScalar:Yo,combinations:tC,isInteger:Uu,isNegative:QA,isPositive:ev,larger:cu,typed:Me}),vve=LF({matrix:vt,multiply:ni,subtract:to,typed:Me}),fV=K4({divideScalar:ja,isZero:Nd,matrix:vt,multiply:ni,subtractScalar:wf,typed:Me,unaryMinus:zp}),yve=jF({concat:xn,equalScalar:Zr,matrix:vt,multiplyScalar:eo,typed:Me}),dV=o_({larger:cu,smaller:uu}),pV=hF({Complex:Ei,DenseMatrix:Lr,ceil:qB,equalScalar:Zr,floor:oV,matrix:vt,typed:Me,zeros:Qs}),mV=J_({Index:Sl,typed:Me}),bve=uP({abs:lu,add:an,addScalar:Yo,config:it,divideScalar:ja,equalScalar:Zr,flatten:RS,isNumeric:rv,isZero:Nd,matrix:vt,multiply:ni,multiplyScalar:eo,smaller:uu,subtract:to,typed:Me}),xve=OF({BigNumber:yt,add:an,config:it,equal:Sf,isInteger:Uu,mod:lV,smaller:uu,typed:Me,xgcd:tV}),wve=gF({concat:xn,equalScalar:Zr,matrix:vt,typed:Me}),Sve=D3({Complex:Ei,config:it,divideScalar:ja,log:RB,typed:Me}),LB=SS({config:it,larger:cu,numeric:Fd,typed:Me}),Eve=R_({DenseMatrix:Lr,Index:Sl,compareNatural:Up,size:Gs,subset:Mc,typed:Me}),kve=q_({DenseMatrix:Lr,Index:Sl,compareNatural:Up,size:Gs,subset:Mc,typed:Me}),Cve=z_({Index:Sl,compareNatural:Up,size:Gs,subset:Mc,typed:Me}),Dve=W_({Index:Sl,compareNatural:Up,size:Gs,subset:Mc,typed:Me}),Ty=Q3({DenseMatrix:Lr,concat:xn,config:it,matrix:vt,typed:Me}),Ove=n_({compare:nv,compareNatural:Up,matrix:vt,typed:Me}),Mve=wS({concat:xn,equalScalar:Zr,matrix:vt,not:nC,typed:Me,zeros:Qs}),Fy=mS({bignumber:Oc,matrix:vt,add:an,config:it,isPositive:ev,larger:cu,largerEq:aC,smaller:uu,smallerEq:Ty,typed:Me}),jve=hS({Index:Sl,matrix:vt,range:Fy,typed:Me}),hV=$_({DenseMatrix:Lr,Index:Sl,compareNatural:Up,size:Gs,subset:Mc,typed:Me}),Nve=U_({Index:Sl,compareNatural:Up,size:Gs,subset:Mc,typed:Me}),AV=V_({Index:Sl,concat:xn,setDifference:hV,size:Gs,subset:Mc,typed:Me}),gV=s_({FibonacciHeap:dV,addScalar:Yo,equalScalar:Zr}),vV=fS({Index:Sl,matrix:vt,range:Fy,typed:Me}),iv=J4({abs:lu,addScalar:Yo,det:fV,divideScalar:ja,identity:YA,matrix:vt,multiply:ni,typed:Me,unaryMinus:zp}),yV=L4({DenseMatrix:Lr,Spa:gV,SparseMatrix:Km,abs:lu,addScalar:Yo,divideScalar:ja,equalScalar:Zr,larger:cu,matrix:vt,multiplyScalar:eo,subtractScalar:wf,typed:Me,unaryMinus:zp}),Tve=eP({Complex:Ei,add:an,ctranspose:FB,deepEqual:BB,divideScalar:ja,dot:oC,dotDivide:BS,equal:Sf,inv:iv,matrix:vt,multiply:ni,typed:Me}),Ef=E3({Complex:Ei,config:it,fraction:jy,identity:YA,inv:iv,matrix:vt,multiply:ni,number:Xm,typed:Me}),bV=L_({DenseMatrix:Lr,Index:Sl,compareNatural:Up,size:Gs,subset:Mc,typed:Me}),Fve=G_({Index:Sl,concat:xn,setIntersect:bV,setSymDifference:AV,size:Gs,subset:Mc,typed:Me}),_ve=nP({abs:lu,add:an,identity:YA,inv:iv,map:tv,max:LB,multiply:ni,size:Gs,sqrt:Td,subtract:to,typed:Me}),br=u_({BigNumber:yt,Complex:Ei,Fraction:K0,abs:lu,addScalar:Yo,config:it,divideScalar:ja,equal:Sf,fix:pV,format:_S,isNumeric:rv,multiplyScalar:eo,number:Xm,pow:Ef,round:Ny,subtractScalar:wf}),Pve=fI({BigNumber:yt,Unit:br,config:it}),Ive=VI({BigNumber:yt,Unit:br,config:it}),Bve=_I({BigNumber:yt,Unit:br,config:it}),Rve=mI({BigNumber:yt,Unit:br,config:it}),$ve=II({BigNumber:yt,Unit:br,config:it}),qve=hI({BigNumber:yt,Unit:br,config:it}),Lve=dI({BigNumber:yt,Unit:br,config:it}),zve=DI({BigNumber:yt,Unit:br,config:it}),Uve=M3({DenseMatrix:Lr,concat:xn,equalScalar:Zr,matrix:vt,pow:Ef,typed:Me}),Wve=cI({BigNumber:yt,Unit:br,config:it}),Hve=pI({BigNumber:yt,Unit:br,config:it}),Vve=rP({abs:lu,add:an,identity:YA,inv:iv,multiply:ni,typed:Me}),Gve=BI({BigNumber:yt,Unit:br,config:it}),xV=l3({addScalar:Yo,ceil:qB,conj:J0,divideScalar:ja,dotDivide:BS,exp:YH,i:HH,log2:ZH,matrix:vt,multiplyScalar:eo,pow:Ef,tau:GH,typed:Me}),zB=AP({BigNumber:yt,Complex:Ei,config:it,multiplyScalar:eo,pow:Ef,typed:Me}),Qve=oI({BigNumber:yt,Unit:br,config:it}),Yve=kI({BigNumber:yt,Unit:br,config:it}),Zve=u3({conj:J0,dotDivide:BS,fft:xV,typed:Me}),Xve=yI({BigNumber:yt,Unit:br,config:it}),Kve=$I({BigNumber:yt,Unit:br,config:it}),Jve=uI({BigNumber:yt,Unit:br,config:it}),e1e=GI({BigNumber:yt,Unit:br,config:it}),t1e=LI({BigNumber:yt,Unit:br,config:it}),r1e=OI({BigNumber:yt,Unit:br,config:it}),n1e=vI({BigNumber:yt,Unit:br,config:it}),i1e=JI({BigNumber:yt,Unit:br,config:it}),a1e=ZI({BigNumber:yt,Unit:br,config:it}),o1e=eB({BigNumber:yt,Unit:br,config:it}),s1e=CI({BigNumber:yt,Unit:br,config:it}),l1e=MI({BigNumber:yt,Unit:br,config:it}),u1e=lI({BigNumber:yt,Unit:br,config:it}),c1e=jI({BigNumber:yt,Unit:br,config:it}),f1e=WI({BigNumber:yt,Unit:br,config:it}),d1e=aI({BigNumber:yt,Unit:br,config:it}),p1e=HI({BigNumber:yt,Unit:br,config:it}),m1e=NI({BigNumber:yt,Unit:br,config:it}),h1e=PI({BigNumber:yt,Unit:br,config:it}),A1e=bI({BigNumber:yt,Unit:br,config:it}),g1e=d_({Unit:br,typed:Me}),ys=sP({divideScalar:ja,equalScalar:Zr,inv:iv,matrix:vt,multiply:ni,typed:Me}),v1e=wI({BigNumber:yt,Unit:br,config:it}),$S=vP({gamma:zB,typed:Me}),y1e=RI({BigNumber:yt,Unit:br,config:it}),b1e=YI({BigNumber:yt,Unit:br,config:it}),x1e=AI({BigNumber:yt,Unit:br,config:it}),wV=V4({DenseMatrix:Lr,lsolve:iV,lup:yV,matrix:vt,slu:uV,typed:Me,usolve:IB}),w1e=gI({BigNumber:yt,Unit:br,config:it}),S1e=QI({BigNumber:yt,Unit:br,config:it}),E1e=bP({add:an,divide:ys,factorial:$S,isInteger:Uu,isPositive:ev,multiply:ni,typed:Me}),k1e=xP({factorial:$S,typed:Me}),C1e=XI({BigNumber:yt,Unit:br,config:it}),D1e=G4({add:an,cbrt:rV,divide:ys,equalScalar:Zr,im:jB,isZero:Nd,multiply:ni,re:NB,sqrt:Td,subtract:to,typeOf:KH,typed:Me,unaryMinus:zp}),O1e=H_({compareNatural:Up,typed:Me}),M1e=c3({abs:lu,add:an,bignumber:Oc,divide:ys,isNegative:QA,isPositive:ev,larger:cu,map:tv,matrix:vt,max:LB,multiply:ni,smaller:uu,subtract:to,typed:Me,unaryMinus:zp}),SV=CP({bignumber:Oc,addScalar:Yo,combinations:tC,divideScalar:ja,factorial:$S,isInteger:Uu,isNegative:QA,larger:cu,multiplyScalar:eo,number:Xm,pow:Ef,subtractScalar:wf,typed:Me}),j1e=c_({Unit:br,typed:Me}),N1e=DP({addScalar:Yo,isInteger:Uu,isNegative:QA,stirlingS2:SV,typed:Me}),EV=tP({abs:lu,add:an,addScalar:Yo,atan:QH,bignumber:Oc,column:vV,complex:rC,config:it,cos:OB,diag:nV,divideScalar:ja,dot:oC,equal:Sf,flatten:RS,im:jB,inv:iv,larger:cu,matrix:vt,matrixFromColumns:_B,multiply:ni,multiplyScalar:eo,number:Xm,qr:PB,re:NB,reshape:eV,sin:iC,size:Gs,smaller:uu,sqrt:Td,subtract:to,typed:Me,usolve:IB,usolveAll:cV}),T1e=SI({BigNumber:yt,Unit:br,config:it}),F1e=qI({BigNumber:yt,Unit:br,config:it}),_1e=yP({divide:ys,dotDivide:BS,isNumeric:rv,log:RB,map:tv,matrix:vt,multiply:ni,sum:$B,typed:Me}),kV=OS({add:an,divide:ys,typed:Me}),P1e=zI({BigNumber:yt,Unit:br,config:it}),I1e=sI({BigNumber:yt,Unit:br,config:it}),B1e=jS({bignumber:Oc,add:an,compare:nv,divide:ys,isInteger:Uu,larger:cu,multiply:ni,partitionSelect:sC,smaller:uu,smallerEq:Ty,subtract:to,typed:Me}),UB=MS({add:an,apply:TB,divide:ys,isNaN:PS,multiply:ni,subtract:to,typed:Me}),R1e=xI({BigNumber:yt,Unit:br,config:it}),lC=fP({add:an,compare:nv,divide:ys,partitionSelect:sC,typed:Me}),$1e=pP({add:an,divide:ys,matrix:vt,mean:kV,multiply:ni,pow:Ef,sqrt:Td,subtract:to,sum:$B,typed:Me}),q1e=$P({Complex:Ei,add:an,divide:ys,matrix:vt,multiply:ni,typed:Me}),L1e=dP({abs:lu,map:tv,median:lC,subtract:to,typed:Me}),z1e=NS({map:tv,sqrt:Td,typed:Me,variance:UB}),U1e=d3({BigNumber:yt,Complex:Ei,add:an,config:it,divide:ys,equal:Sf,factorial:$S,gamma:zB,isNegative:QA,multiply:ni,pi:CB,pow:Ef,sin:iC,smallerEq:Ty,subtract:to,typed:Me}),WB=Z_({abs:lu,add:an,conj:J0,ctranspose:FB,eigs:EV,equalScalar:Zr,larger:cu,matrix:vt,multiply:ni,pow:Ef,smaller:uu,sqrt:Td,typed:Me}),CV=r3({BigNumber:yt,DenseMatrix:Lr,SparseMatrix:Km,addScalar:Yo,config:it,cos:OB,matrix:vt,multiplyScalar:eo,norm:WB,sin:iC,typed:Me,unaryMinus:zp}),W1e=KI({BigNumber:yt,Unit:br,config:it}),DV=aP({identity:YA,matrix:vt,multiply:ni,norm:WB,qr:PB,subtract:to,typed:Me}),H1e=t3({multiply:ni,rotationMatrix:CV,typed:Me}),OV=iP({abs:lu,add:an,concat:xn,identity:YA,index:mV,lusolve:wV,matrix:vt,matrixFromColumns:_B,multiply:ni,range:Fy,schur:DV,subset:Mc,subtract:to,transpose:IS,typed:Me}),V1e=oP({matrix:vt,multiply:ni,sylvester:OV,transpose:IS,typed:Me});var qS={},LS={},G1e={},fu=t4({mathWithTransform:LS}),zS=E4({Node:fu}),ZA=C4({Node:fu}),_y=O4({Node:fu}),Q1e=T4({Node:fu}),US=o4({Node:fu}),Y1e=d4({Node:fu,ResultSet:VH}),Z1e=m4({Node:fu}),av=v4({Node:fu}),X1e=j4({Node:fu}),QHe=qP({classes:G1e}),MV=Y4({math:qS,typed:Me}),K1e=b4({Node:fu,typed:Me}),YHe=X4({Chain:MV,typed:Me}),WS=w4({Node:fu,size:Gs}),HS=i4({Node:fu,subset:Mc}),J1e=c4({matrix:vt,Node:fu,subset:Mc}),ov=F4({Unit:br,Node:fu,math:qS}),sv=P4({Node:fu,SymbolNode:ov,math:qS}),_d=I4({AccessorNode:HS,ArrayNode:US,AssignmentNode:J1e,BlockNode:Y1e,ConditionalNode:Z1e,ConstantNode:av,FunctionAssignmentNode:K1e,FunctionNode:sv,IndexNode:WS,ObjectNode:zS,OperatorNode:ZA,ParenthesisNode:_y,RangeNode:X1e,RelationalNode:Q1e,SymbolNode:ov,config:it,numeric:Fd,typed:Me}),eye=_P({ConstantNode:av,FunctionNode:sv,OperatorNode:ZA,ParenthesisNode:_y,parse:_d,typed:Me}),jV=TP({bignumber:Oc,fraction:jy,AccessorNode:HS,ArrayNode:US,ConstantNode:av,FunctionNode:sv,IndexNode:WS,ObjectNode:zS,OperatorNode:ZA,SymbolNode:ov,config:it,mathWithTransform:LS,matrix:vt,typed:Me}),ZHe=B4({parse:_d,typed:Me}),NV=FP({AccessorNode:HS,ArrayNode:US,ConstantNode:av,FunctionNode:sv,IndexNode:WS,ObjectNode:zS,OperatorNode:ZA,ParenthesisNode:_y,SymbolNode:ov,add:an,divide:ys,equal:Sf,isZero:Nd,multiply:ni,parse:_d,pow:Ef,subtract:to,typed:Me}),TV=R4({parse:_d,typed:Me}),tye=Q4({evaluate:TV}),rye=$4({evaluate:TV}),HB=NP({bignumber:Oc,fraction:jy,AccessorNode:HS,ArrayNode:US,ConstantNode:av,FunctionNode:sv,IndexNode:WS,ObjectNode:zS,OperatorNode:ZA,ParenthesisNode:_y,SymbolNode:ov,add:an,config:it,divide:ys,equal:Sf,isZero:Nd,mathWithTransform:LS,matrix:vt,multiply:ni,parse:_d,pow:Ef,resolve:eye,simplifyConstant:jV,simplifyCore:NV,subtract:to,typed:Me}),XHe=PP({OperatorNode:ZA,parse:_d,simplify:HB,typed:Me}),KHe=jP({parse:_d,typed:Me}),JHe=q4({Parser:rye,typed:Me}),eVe=BP({bignumber:Oc,fraction:jy,AccessorNode:HS,ArrayNode:US,ConstantNode:av,FunctionNode:sv,IndexNode:WS,ObjectNode:zS,OperatorNode:ZA,ParenthesisNode:_y,SymbolNode:ov,add:an,config:it,divide:ys,equal:Sf,isZero:Nd,mathWithTransform:LS,matrix:vt,multiply:ni,parse:_d,pow:Ef,simplify:HB,simplifyConstant:jV,simplifyCore:NV,subtract:to,typed:Me}),tVe=IP({ConstantNode:av,FunctionNode:sv,OperatorNode:ZA,ParenthesisNode:_y,SymbolNode:ov,config:it,equal:Sf,isZero:Nd,numeric:Fd,parse:_d,simplify:HB,typed:Me}),rVe=Z4({Help:tye,mathWithTransform:LS,typed:Me});Fn(qS,{e:WH,false:Oge,fineStructure:Mge,i:HH,Infinity:jge,LN10:Nge,LOG10E:Tge,NaN:Fge,null:_ge,phi:Pge,SQRT1_2:Bge,sackurTetrode:Rge,tau:GH,true:$ge,E:WH,version:qge,efimovFactor:Lge,LN2:zge,pi:CB,replacer:Uge,reviver:QHe,SQRT2:Wge,typed:Me,unaryPlus:DB,PI:CB,weakMixingAngle:Hge,abs:lu,acos:Vge,acot:Gge,acsc:Qge,addScalar:Yo,arg:Yge,asech:Zge,asinh:Xge,atan:QH,atanh:Kge,bignumber:Oc,bitNot:Jge,boolean:e0e,clone:t0e,combinations:tC,complex:rC,conj:J0,cos:OB,cot:r0e,csc:n0e,cube:i0e,equalScalar:Zr,erf:a0e,exp:YH,expm1:o0e,filter:s0e,forEach:l0e,format:_S,getMatrixDataType:MB,hex:u0e,im:jB,isInteger:Uu,isNegative:QA,isPositive:ev,isZero:Nd,LOG2E:c0e,lgamma:f0e,log10:d0e,log2:ZH,map:tv,multiplyScalar:eo,not:nC,number:Xm,oct:p0e,pickRandom:m0e,print:h0e,random:A0e,re:NB,sec:g0e,sign:XH,sin:iC,splitUnit:v0e,square:y0e,string:b0e,subtractScalar:wf,tan:x0e,typeOf:KH,acosh:w0e,acsch:S0e,apply:TB,asec:E0e,bin:k0e,chain:YHe,combinationsWithRep:C0e,cosh:D0e,csch:O0e,isNaN:PS,isPrime:M0e,randomInt:j0e,sech:N0e,sinh:T0e,sparse:F0e,sqrt:Td,tanh:_0e,unaryMinus:zp,acoth:P0e,coth:I0e,fraction:jy,isNumeric:rv,matrix:vt,matrixFromFunction:B0e,mode:R0e,numeric:Fd,prod:JH,reshape:eV,size:Gs,squeeze:$0e,transpose:IS,xgcd:tV,zeros:Qs,asin:q0e,cbrt:rV,concat:xn,count:L0e,ctranspose:FB,diag:nV,divideScalar:ja,dotDivide:BS,equal:Sf,flatten:RS,hasNumericValue:z0e,identity:YA,kron:U0e,largerEq:aC,leftShift:W0e,lsolve:iV,matrixFromColumns:_B,nthRoot:H0e,ones:V0e,qr:PB,resize:G0e,rightArithShift:Q0e,round:Ny,smaller:uu,subtract:to,to:Y0e,unequal:Z0e,usolve:IB,xor:X0e,add:an,atan2:K0e,bitAnd:J0e,bitOr:eve,bitXor:tve,catalan:rve,compare:nv,compareText:aV,cumsum:nve,deepEqual:BB,diff:ive,distance:ave,dot:oC,equalText:ove,floor:oV,gcd:sve,hypot:lve,larger:cu,log:RB,lsolveAll:uve,matrixFromRows:cve,min:fve,mod:lV,multiply:ni,nthRoots:dve,or:pve,partitionSelect:sC,rightLogShift:mve,slu:uV,subset:Mc,sum:$B,trace:hve,usolveAll:cV,zpk2tf:Ave,ceil:qB,compareNatural:Up,composition:gve,cross:vve,det:fV,dotMultiply:yve,fix:pV,index:mV,intersect:bve,invmod:xve,lcm:wve,log1p:Sve,max:LB,setCartesian:Eve,setDistinct:kve,setIsSubset:Cve,setPowerset:Dve,smallerEq:Ty,sort:Ove,and:Mve,range:Fy,row:jve,setDifference:hV,setMultiplicity:Nve,setSymDifference:AV,column:vV,inv:iv,lup:yV,pinv:Tve,pow:Ef,setIntersect:bV,setUnion:Fve,sqrtm:_ve,vacuumImpedance:Pve,wienDisplacement:Ive,atomicMass:Bve,bohrMagneton:Rve,boltzmann:$ve,conductanceQuantum:qve,coulomb:Lve,deuteronMass:zve,dotPow:Uve,electricConstant:Wve,elementaryCharge:Hve,expm:Vve,faraday:Gve,fft:xV,gamma:zB,gravitationConstant:Qve,hartreeEnergy:Yve,ifft:Zve,klitzing:Xve,loschmidt:Kve,magneticConstant:Jve,molarMass:e1e,molarPlanckConstant:t1e,neutronMass:r1e,nuclearMagneton:n1e,planckCharge:i1e,planckLength:a1e,planckTemperature:o1e,protonMass:s1e,quantumOfCirculation:l1e,reducedPlanckConstant:u1e,rydberg:c1e,secondRadiation:f1e,speedOfLight:d1e,stefanBoltzmann:p1e,thomsonCrossSection:m1e,avogadro:h1e,bohrRadius:A1e,createUnit:g1e,divide:ys,electronMass:v1e,factorial:$S,firstRadiation:y1e,gravity:b1e,inverseConductanceQuantum:x1e,lusolve:wV,magneticFluxQuantum:w1e,molarMassC12:S1e,multinomial:E1e,parse:_d,permutations:k1e,planckMass:C1e,polynomialRoot:D1e,resolve:eye,setSize:O1e,simplifyConstant:jV,solveODE:M1e,stirlingS2:SV,unit:j1e,bellNumbers:N1e,compile:ZHe,eigs:EV,fermiCoupling:T1e,gasConstant:F1e,kldivergence:_1e,mean:kV,molarVolume:P1e,planckConstant:I1e,quantileSeq:B1e,simplifyCore:NV,variance:UB,classicalElectronRadius:R1e,evaluate:TV,median:lC,simplify:HB,symbolicEqual:XHe,corr:$1e,freqz:q1e,leafCount:KHe,mad:L1e,parser:JHe,rationalize:eVe,std:z1e,zeta:U1e,derivative:tVe,norm:WB,rotationMatrix:CV,help:rVe,planckTime:W1e,schur:DV,rotate:H1e,sylvester:OV,lyap:V1e,config:it});Fn(LS,qS,{filter:iB({typed:Me}),forEach:aB({typed:Me}),map:sB({typed:Me}),apply:rB({isInteger:Uu,typed:Me}),or:SB({DenseMatrix:Lr,concat:xn,equalScalar:Zr,matrix:vt,typed:Me}),and:wB({add:an,concat:xn,equalScalar:Zr,matrix:vt,not:nC,typed:Me,zeros:Qs}),concat:mB({isInteger:Uu,matrix:vt,typed:Me}),max:lB({config:it,larger:cu,numeric:Fd,typed:Me}),print:xB({add:an,matrix:vt,typed:Me,zeros:Qs}),bitAnd:EB({add:an,concat:xn,equalScalar:Zr,matrix:vt,not:nC,typed:Me,zeros:Qs}),diff:hB({bignumber:Oc,matrix:vt,number:Xm,subtract:to,typed:Me}),min:cB({config:it,numeric:Fd,smaller:uu,typed:Me}),subset:pB({add:an,matrix:vt,typed:Me,zeros:Qs}),bitOr:kB({DenseMatrix:Lr,concat:xn,equalScalar:Zr,matrix:vt,typed:Me}),cumsum:yB({add:an,typed:Me,unaryPlus:DB}),index:oB({Index:Sl,getMatrixDataType:MB}),sum:gB({add:an,config:it,numeric:Fd,typed:Me}),range:fB({bignumber:Oc,matrix:vt,add:an,config:it,isPositive:ev,larger:cu,largerEq:aC,smaller:uu,smallerEq:Ty,typed:Me}),row:dB({Index:Sl,matrix:vt,range:Fy,typed:Me}),column:nB({Index:Sl,matrix:vt,range:Fy,typed:Me}),mean:uB({add:an,divide:ys,typed:Me}),quantileSeq:vB({add:an,bignumber:Oc,compare:nv,divide:ys,isInteger:Uu,larger:cu,multiply:ni,partitionSelect:sC,smaller:uu,smallerEq:Ty,subtract:to,typed:Me}),variance:bB({add:an,apply:TB,divide:ys,isNaN:PS,multiply:ni,subtract:to,typed:Me}),std:AB({map:tv,sqrt:Td,typed:Me,variance:UB})});Fn(G1e,{BigNumber:yt,Complex:Ei,Fraction:K0,Matrix:eC,Node:fu,ObjectNode:zS,OperatorNode:ZA,ParenthesisNode:_y,Range:Ige,RelationalNode:Q1e,ResultSet:VH,ArrayNode:US,BlockNode:Y1e,ConditionalNode:Z1e,ConstantNode:av,DenseMatrix:Lr,RangeNode:X1e,Chain:MV,FunctionAssignmentNode:K1e,SparseMatrix:Km,IndexNode:WS,ImmutableDenseMatrix:sV,Index:Sl,AccessorNode:HS,AssignmentNode:J1e,FibonacciHeap:dV,Spa:gV,Unit:br,SymbolNode:ov,FunctionNode:sv,Help:tye,Parser:rye});MV.createProxy(qS);var FV=UH;var sye=Ae(oT(),1);var iye=Ae(nye(),1);function aye(e){var t=new iye.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 oye(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(wy(j)||O!==void 0){var N=wy(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(wy(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(oW(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(uW).forEach(C=>{if(oW(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)||ps(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 VB(e,t){var r=Fn({},yy,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=aye({isNumber:Gt,isComplex:ps,isBigNumber:It,isFraction:gf,isUnit:Fo,isString:ma,isArray:Ir,isMatrix:St,isCollection:Oa,isDenseMatrix:LA,isSparseMatrix:vf,isRange:q0,isIndex:Wm,isBoolean:HN,isResultSet:VN,isHelp:zw,isFunction:GN,isDate:QN,isRegExp:YN,isObject:Hm,isNull:ZN,isUndefined:XN,isAccessorNode:zu,isArrayNode:ms,isAssignmentNode:KN,isBlockNode:JN,isConditionalNode:eT,isConstantNode:vr,isFunctionAssignmentNode:Ed,isFunctionNode:xl,isIndexNode:Sc,isNode:Nr,isObjectNode:Vm,isOperatorNode:xi,isParenthesisNode:hs,isRangeNode:tT,isRelationalNode:rT,isSymbolNode:ri,isChain:Uw});n.config=Joe(r,n.emit),n.expression={transform:{},mathWithTransform:{config:n.config}};var i=[],a=[];function o(c){if(wy(c))return c(n);var f=c[Object.keys(c)[0]];if(wy(f))return f(n);if(!Zoe(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{ZU(s).forEach(c=>{c&&c.meta&&c.meta.recreateOnConfigChange&&u(c,{override:!0})})}),n.create=VB.bind(null,e),n.factory=V,n.import(ZU(Qoe(e))),n.ArgumentsError=bf,n.DimensionError=ar,n.IndexError=gs,n}var uC={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}},lye=(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)};lye.rawArgs=!0;var uye=(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)};cye.rawArgs=!0;var fye=(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))};fye.rawArgs=!0;var dye=(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))};dye.rawArgs=!0;var pye=(e,t,r)=>r?.get("$current");pye.rawArgs=!0;var mye=(e,t,r)=>r?.get("$index");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.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})??"":""};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.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}):""};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.filter((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.map((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!==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))):""};yye.rawArgs=!0;var bye=(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))):""};bye.rawArgs=!0;var xye=(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():""};xye.rawArgs=!0;var wye=(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=ca(i,r.get(n[0]));return(i=="file"||i=="link"||i=="context")&&(i.includes("multi")?a=tr(a).map(o=>r.get("$paths").get(o)??o):a=r.get("$paths").get(a)??a),i=="date"&&(a=Zi(a)),a??""};wye.rawArgs=!0;var Sye=(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?Ya(n,i):Ya(n,r.get("$settings")?.dateFormat??"yyyy-MM-dd")};Eye.rawArgs=!0;var Wu=e=>typeof e=="string"||e instanceof String?e:e instanceof Date?Ya(e,"yyyy-MM-dd"):typeof e=="number"?e.toFixed(0):e?.path?e.path:"",cC={prop:wye,_current:pye,_index:mye,slice:(e,t,r)=>(e=Wu(e),e.slice(t,r)),if:(e,t,r)=>e===!0?t:r,ifs:Sye,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=Wu(e),r?e.substring(t,r):e.substring(t)),startsWith:(e,t)=>(e=Wu(e),t=Wu(t),e.startsWith(t)),contains:(e,t)=>(e=Wu(e),t=Wu(t),e.includes(t)),test:(e,t)=>(e=Wu(e),new RegExp(t).test(e)),match:(e,t)=>(e=Wu(e),e.match(new RegExp(t))),replace:(e,t,r)=>(e=Wu(e),e.replace(new RegExp(t),r)),replaceAll:(e,t,r)=>(e=Wu(e),t=Wu(t),r=Wu(r),e.replace(new RegExp(t,"g"),r)),lower:e=>(e=Wu(e),e.toLowerCase()),upper:e=>(e=Wu(e),e.toUpperCase()),repeat:(e,t)=>e.repeat(t),format:Wu,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=>Ya(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:Eye,parseDate:e=>Zi(e),find:hye,findIndex:Aye,filter:gye,map:vye,some:yye,every:bye,flat:xye,path:cye,let:lye,lets:uye,spaceItems:fye,spaces:dye};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=$i("",u),typeof u!="string"&&s)throw u}catch(c){if(u="",s)throw c}return u};var GB=(e,t)=>t.startsWith(e),IV=(e,t)=>(r,n)=>{let i=t?r:n,a=t?n:r;return e(i)e(a)?1:0},kye=(e,t)=>(r,n)=>{let i=t?r:n,a=t?n:r;return i[e]a[e]?1:0},Cye=(e,t)=>(r,n)=>{let i=t?r:n,a=t?n:r;return i[e]?.toLowerCase().localeCompare(a[e]?.toLowerCase(),void 0,{numeric:!0})},Dye=(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),""}},XA=e=>e?.charAt(0)=="_"?XA(e.substring(1)):e?.replace(/"/g,""),eh=e=>e?.replace(/[^a-z0-9+]+/gi,""),aVe=/^[+\$#^]+/,Oye=/[\/\?<>\\:\*\|":]/g,Mye=/[\x00-\x1f\x80-\x9f]/g,jye=/^\.+$/,Nye=/^(con|prn|aux|nul|com[0-9]|lpt[0-9])(\..*)?$/i,Tye=e=>{let t="";return e.replace(aVe,t).replace(Oye,t).replace(Mye,t).replace(jye,t).replace(Nye,t)},lv=e=>{let t="";return e.replace(Oye,t).replace(Mye,t).replace(jye,t).replace(Nye,t)};var QB=(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),fC=(e,t)=>e.spaceManager.createSpace(zx(t),e.settings.spacesFolder,null);var oVe=e=>({field:Rs(e?.field??"rank"),asc:YE(e?.asc),group:YE(e?.group),recursive:YE(e?.recursive)}),sVe=e=>e=="fileprop"?"file":e=="filemeta"?"path":Rs(e),lVe=e=>({type:sVe(e.type),fType:Rs(e.fType),field:Rs(e.field),fn:Rs(e.fn),value:Rs(e.value)}),uVe=e=>({type:EJ(e.type,["any","all"],"any"),trueFalse:!!e.truefalse,filters:dl(e.filters).map(t=>lVe(t))}),dC=(e,t)=>({sort:oVe(e[_k]),recursive:Rs(e[oj]),contexts:dl(e[Mk]),links:dl(e[Fk]),filters:dl(e[Tk]).map(r=>uVe(r)),template:Rs(e[jk]),templateName:Rs(e[Nk]),defaultSticker:Rs(e.defaultSticker),readMode:YE(e.readMode)}),Fye=(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"}),YB=(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(kye("type",!1)),e.field=="number")n.push(Dye("name",e.asc));else if(e.field=="name")n.push(Cye(e.field,e.asc));else if(e.field.startsWith("props")){let i=e.field.split(".")[1],a=o=>o?.metadata?.property?.[i];n.push(IV(a,e.asc))}else{let i=a=>a?.metadata?.file?.[e.field];n.push(IV(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(()=>Goe(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(W.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)},_ye=(e,t,r)=>{pC(e,t,"template",r)},Pye=(e,t,r)=>{pC(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},pC=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})},cVe=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 uv=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)},Iye=async(e,t)=>{let r=e.spacesIndex.get(t);!r||(r.type=="tag"?e.onTagDeleted(r.name):r.type=="folder"&&await P1(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,cv=async(e,t,r)=>{let n=e.spacesIndex.get(r);!n||(await e.spaceManager.saveTemplate(t,n.path),e.ui.notify(W.notice.templateSaved+n.name))},fv=async(e,t,r)=>{let n=e.spacesIndex.get(t);!n||(n.type=="tag"?r.forEach(i=>QB(e,i,n.name)):(n.type=="folder"||n.type=="vault")&&await pC(e,n.path,"links",n.metadata.links.filter(i=>!r.some(a=>a==i))))},mC=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}`)){Ji(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)},Ji=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 Bye=async(e,t,r)=>{let n=(i,a,o)=>{let s={...a,name:XA(a.name)},l=i;if(s.name=="")return e.ui.notify(W.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(W.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)?cVe(e,t,r):e.spaceManager.saveProperties(t,r),$V=(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)},Rye=(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}=mr(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]:$i(p,l[p])}),{}),c=s.map(d=>i.find(p=>p.name==d)).filter(d=>d&&d.type=="fileprop"),f=i.reduce((d,p)=>({...d,[p.name]:p}),{});return{...n,...u,...c.reduce((d,p)=>{let{value:h}=mr(p.value,p.type);return{...d,[p.name]:Pd(e,t,r,h,f,{...n,...d},a)}},{})}};var ZB=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 fVe(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]=Gte({...l,node:{...l.node,props:{...l.node.props,_index:`${s}`,value:`${n.id}.props.value[${s}]`}}},a);return a=c,kk(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}},fVe=async(e,t,r,n)=>{let i=await dVe(e,t,r,n),a=$ye(e.node,"styles",e.execStyles,i);return $ye(e.node,"actions",e.execActions,a)},YS=(e,t)=>((typeof e=="string"||e instanceof String?e.includes(` +`):!1)?new Function(`with(this) { ${e} }`):new Function(`with(this) { return ${e}; }`)).call(t),dVe=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 $ye(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 qV=(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(ir(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=ji(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=>!qV(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 yA.rows;let i=await this.fileSystem.readFileFragments(n,"schemas",null);return i.length==0?yA.rows:i}defaultDBTablesForContext(t){let r=Kx(this.spaceManager.superstate,t),n=bq(t);return{...XJ(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(Xg)&&t==Xg+"overview"?sre: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?aj: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={...Ok(r),m_schema:QJ},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:ua.uniques,cols:ua.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=YS(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:ua.uniques,cols:ua.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",pr):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=>!qV(this.spaceManager.superstate.settings,i)).map(i=>Pk(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=>h0(this.spaceManager,MM(o)))??[])();return[...n,...a,...r]}return r}readTags(){return this.fileSystem.allTags()}spaceInfoForPath(t){return ure(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 dC(s,this.spaceManager.superstate.settings)}let i=ir(n)??{};return dC(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=>({[Tk]:i.filters,[Mk]:i.contexts,[Fk]:i.links,[_k]:i.sort,[jk]:i.template,[Nk]:i.templateName,[oj]: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=h0(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 qye={"image-select":` - `};var kxe=Ae(Qa());var Lye=(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 Exe=Ae(Qa()),$d=Ae(Te());var ha=Ae(Te(),1);function ih(e,t,{checkForDefaultPrevented:r=!0}={}){return function(i){if(e?.(i),r===!1||!i.defaultPrevented)return t?.(i)}}var zye=Ae(Te(),1);function fVe(e,t){typeof e=="function"?e(t):e!=null&&(e.current=t)}function $V(...e){return t=>e.forEach(r=>fVe(r,t))}function Wp(...e){return zye.useCallback($V(...e),e)}var Bd=Ae(Te(),1),qV=Ae(KA(),1);function Vye(e,t){let r=Bd.createContext(t);function n(a){let{children:o,...s}=a,l=Bd.useMemo(()=>s,Object.values(s));return(0,qV.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 Gye(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,qV.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,vVe(i,...t)]}function vVe(...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 LV=Ae(Te(),1);var Qye=Ae(Te(),1),Py=Boolean(globalThis?.document)?Qye.useLayoutEffect:()=>{};var yVe=LV["useId".toString()]||(()=>{}),bVe=0;function KB(e){let[t,r]=LV.useState(yVe());return Py(()=>{e||r(n=>n??String(bVe++))},[e]),e||(t?`radix-${t}`:"")}var dv=Ae(Te(),1);var ZS=Ae(Te(),1);function Hp(e){let t=ZS.useRef(e);return ZS.useEffect(()=>{t.current=e}),ZS.useMemo(()=>(...r)=>t.current?.(...r),[])}function Yye({prop:e,defaultProp:t,onChange:r=()=>{}}){let[n,i]=xVe({defaultProp:t,onChange:r}),a=e!==void 0,o=a?e:n,s=Hp(r),l=dv.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 xVe({defaultProp:e,onChange:t}){let r=dv.useState(e),[n]=r,i=dv.useRef(n),a=Hp(t);return dv.useEffect(()=>{i.current!==n&&(a(n),i.current=n)},[n,i,a]),r}var ro=Ae(Te(),1);var Zye=Ae(Te(),1),Xye=Ae(bl(),1);var El=Ae(Te(),1);var XS=Ae(KA(),1),xC=El.forwardRef((e,t)=>{let{children:r,...n}=e,i=El.Children.toArray(r),a=i.find(SVe);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,XS.jsx)(zV,{...n,ref:t,children:El.isValidElement(o)?El.cloneElement(o,void 0,s):null})}return(0,XS.jsx)(zV,{...n,ref:t,children:r})});xC.displayName="Slot";var zV=El.forwardRef((e,t)=>{let{children:r,...n}=e;if(El.isValidElement(r)){let i=kVe(r);return El.cloneElement(r,{...EVe(n,r.props),ref:t?$V(t,i):i})}return El.Children.count(r)>1?El.Children.only(null):null});zV.displayName="SlotClone";var wVe=({children:e})=>(0,XS.jsx)(XS.Fragment,{children:e});function SVe(e){return El.isValidElement(e)&&e.type===wVe}function EVe(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 kVe(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 Kye=Ae(KA(),1),CVe=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"],Cf=CVe.reduce((e,t)=>{let r=Zye.forwardRef((n,i)=>{let{asChild:a,...o}=n,s=a?xC:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),(0,Kye.jsx)(s,{...o,ref:i})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function Jye(e,t){e&&Xye.flushSync(()=>e.dispatchEvent(t))}var ebe=Ae(Te(),1);function tbe(e,t=globalThis?.document){let r=Hp(e);ebe.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 WV=Ae(KA(),1),DVe="DismissableLayer",UV="dismissableLayer.update",OVe="dismissableLayer.pointerDownOutside",MVe="dismissableLayer.focusOutside",rbe,ibe=ro.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),HV=ro.forwardRef((e,t)=>{let{disableOutsidePointerEvents:r=!1,onEscapeKeyDown:n,onPointerDownOutside:i,onFocusOutside:a,onInteractOutside:o,onDismiss:s,...l}=e,u=ro.useContext(ibe),[c,f]=ro.useState(null),d=c?.ownerDocument??globalThis?.document,[,p]=ro.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=TVe(k=>{let j=k.target,O=[...u.branches].some(C=>C.contains(j));!x||O||(i?.(k),o?.(k),k.defaultPrevented||s?.())},d),S=FVe(k=>{let j=k.target;[...u.branches].some(C=>C.contains(j))||(a?.(k),o?.(k),k.defaultPrevented||s?.())},d);return tbe(k=>{b===u.layers.size-1&&(n?.(k),!k.defaultPrevented&&s&&(k.preventDefault(),s()))},d),ro.useEffect(()=>{if(!!c)return r&&(u.layersWithOutsidePointerEventsDisabled.size===0&&(rbe=d.body.style.pointerEvents,d.body.style.pointerEvents="none"),u.layersWithOutsidePointerEventsDisabled.add(c)),u.layers.add(c),nbe(),()=>{r&&u.layersWithOutsidePointerEventsDisabled.size===1&&(d.body.style.pointerEvents=rbe)}},[c,d,r,u]),ro.useEffect(()=>()=>{!c||(u.layers.delete(c),u.layersWithOutsidePointerEventsDisabled.delete(c),nbe())},[c,u]),ro.useEffect(()=>{let k=()=>p({});return document.addEventListener(UV,k),()=>document.removeEventListener(UV,k)},[]),(0,WV.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)})});HV.displayName=DVe;var jVe="DismissableLayerBranch",NVe=ro.forwardRef((e,t)=>{let r=ro.useContext(ibe),n=ro.useRef(null),i=Wp(t,n);return ro.useEffect(()=>{let a=n.current;if(a)return r.branches.add(a),()=>{r.branches.delete(a)}},[r.branches]),(0,WV.jsx)(Cf.div,{...e,ref:i})});NVe.displayName=jVe;function TVe(e,t=globalThis?.document){let r=Hp(e),n=ro.useRef(!1),i=ro.useRef(()=>{});return ro.useEffect(()=>{let a=s=>{if(s.target&&!n.current){let u=function(){abe(OVe,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 FVe(e,t=globalThis?.document){let r=Hp(e),n=ro.useRef(!1);return ro.useEffect(()=>{let i=a=>{a.target&&!n.current&&abe(MVe,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 nbe(){let e=new CustomEvent(UV);document.dispatchEvent(e)}function abe(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?Jye(i,a):i.dispatchEvent(a)}var Rd=Ae(Te(),1);var cbe=Ae(KA(),1),VV="focusScope.autoFocusOnMount",GV="focusScope.autoFocusOnUnmount",obe={bubbles:!1,cancelable:!0},_Ve="FocusScope",QV=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:pv(f.current,{select:!0})},v=function(S){if(p.paused||!s)return;let k=S.relatedTarget;k!==null&&(s.contains(k)||pv(f.current,{select:!0}))},x=function(S){if(document.activeElement===document.body)for(let j of S)j.removedNodes.length>0&&pv(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){lbe.add(p);let m=document.activeElement;if(!s.contains(m)){let A=new CustomEvent(VV,obe);s.addEventListener(VV,u),s.dispatchEvent(A),A.defaultPrevented||(PVe(qVe(fbe(s)),{select:!0}),document.activeElement===m&&pv(s))}return()=>{s.removeEventListener(VV,u),setTimeout(()=>{let A=new CustomEvent(GV,obe);s.addEventListener(GV,c),s.dispatchEvent(A),A.defaultPrevented||pv(m??document.body,{select:!0}),s.removeEventListener(GV,c),lbe.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]=IVe(b);v&&x?!m.shiftKey&&A===x?(m.preventDefault(),r&&pv(v,{select:!0})):m.shiftKey&&A===v&&(m.preventDefault(),r&&pv(x,{select:!0})):A===b&&m.preventDefault()}},[r,n,p.paused]);return(0,cbe.jsx)(Cf.div,{tabIndex:-1,...o,ref:d,onKeyDown:h})});QV.displayName=_Ve;function PVe(e,{select:t=!1}={}){let r=document.activeElement;for(let n of e)if(pv(n,{select:t}),document.activeElement!==r)return}function IVe(e){let t=fbe(e),r=sbe(t,e),n=sbe(t.reverse(),e);return[r,n]}function fbe(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 sbe(e,t){for(let r of e)if(!BVe(r,{upTo:t}))return r}function BVe(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 RVe(e){return e instanceof HTMLInputElement&&"select"in e}function pv(e,{select:t=!1}={}){if(e&&e.focus){let r=document.activeElement;e.focus({preventScroll:!0}),e!==r&&RVe(e)&&t&&e.select()}}var lbe=$Ve();function $Ve(){let e=[];return{add(t){let r=e[0];t!==r&&r?.pause(),e=ube(e,t),e.unshift(t)},remove(t){e=ube(e,t),e[0]?.resume()}}}function ube(e,t){let r=[...e],n=r.indexOf(t);return n!==-1&&r.splice(n,1),r}function qVe(e){return e.filter(t=>t.tagName!=="A")}var JB=Ae(Te(),1),dbe=Ae(bl(),1);var pbe=Ae(KA(),1),LVe="Portal",YV=JB.forwardRef((e,t)=>{let{container:r,...n}=e,[i,a]=JB.useState(!1);Py(()=>a(!0),[]);let o=r||i&&globalThis?.document?.body;return o?dbe.default.createPortal((0,pbe.jsx)(Cf.div,{...n,ref:t}),o):null});YV.displayName=LVe;var Nc=Ae(Te(),1),mbe=Ae(bl(),1);var hbe=Ae(Te(),1);function zVe(e,t){return hbe.useReducer((r,n)=>t[r][n]??r,e)}var wC=e=>{let{present:t,children:r}=e,n=UVe(t),i=typeof r=="function"?r({present:n.isPresent}):Nc.Children.only(r),a=Wp(n.ref,WVe(i));return typeof r=="function"||n.isPresent?Nc.cloneElement(i,{ref:a}):null};wC.displayName="Presence";function UVe(e){let[t,r]=Nc.useState(),n=Nc.useRef({}),i=Nc.useRef(e),a=Nc.useRef("none"),o=e?"mounted":"unmounted",[s,l]=zVe(o,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return Nc.useEffect(()=>{let u=e5(n.current);a.current=s==="mounted"?u:"none"},[s]),Py(()=>{let u=n.current,c=i.current;if(c!==e){let d=a.current,p=e5(u);e?l("MOUNT"):p==="none"||u?.display==="none"?l("UNMOUNT"):l(c&&d!==p?"ANIMATION_OUT":"UNMOUNT"),i.current=e}},[e,l]),Py(()=>{if(t){let u=f=>{let p=e5(n.current).includes(f.animationName);f.target===t&&p&&mbe.flushSync(()=>l("ANIMATION_END"))},c=f=>{f.target===t&&(a.current=e5(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 e5(e){return e?.animationName||"none"}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 gbe=Ae(Te(),1),ZV=0;function vbe(){gbe.useEffect(()=>{let e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??Abe()),document.body.insertAdjacentElement("beforeend",e[1]??Abe()),ZV++,()=>{ZV===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(t=>t.remove()),ZV--}},[])}function Abe(){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 a5=Ae(Te());var pu=Ae(Te());var Iy="right-scroll-bar-position",By="width-before-scroll-bar",XV="with-scroll-bars-hidden",KV="--removed-body-scroll-bar-size";function t5(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}var ybe=Ae(Te());function bbe(e,t){var r=(0,ybe.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 r5=Ae(Te());var HVe=typeof window<"u"?r5.useLayoutEffect:r5.useEffect,xbe=new WeakMap;function JV(e,t){var r=bbe(t||null,function(n){return e.forEach(function(i){return t5(i,n)})});return HVe(function(){var n=xbe.get(r);if(n){var i=new Set(n),a=new Set(e),o=r.current;i.forEach(function(s){a.has(s)||t5(s,null)}),a.forEach(function(s){i.has(s)||t5(s,o)})}xbe.set(r,e)},[e]),r}function VVe(e){return e}function GVe(e,t){t===void 0&&(t=VVe);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 eG(e){e===void 0&&(e={});var t=GVe(null);return t.options=Ni({async:!0,ssr:!1},e),t}var wbe=Ae(Te()),Sbe=function(e){var t=e.sideCar,r=RM(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 wbe.createElement(n,Ni({},r))};Sbe.isSideCarExport=!0;function tG(e,t){return e.useMedium(t),Sbe}var n5=eG();var rG=function(){},SC=pu.forwardRef(function(e,t){var r=pu.useRef(null),n=pu.useState({onScrollCapture:rG,onWheelCapture:rG,onTouchMoveCapture:rG}),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=RM(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noIsolation","inert","allowPinchZoom","as","gapMode"]),x=d,w=JV([r,t]),S=Ni(Ni({},v),i);return pu.createElement(pu.Fragment,null,c&&pu.createElement(x,{sideCar:n5,removeScrollBar:u,shards:f,noIsolation:p,inert:h,setCallbacks:a,allowPinchZoom:!!m,lockRef:r,gapMode:b}),o?pu.cloneElement(pu.Children.only(s),Ni(Ni({},S),{ref:w})):pu.createElement(A,Ni({},S,{className:l,ref:w}),s))});SC.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};SC.classNames={fullWidth:By,zeroRight:Iy};var Na=Ae(Te());var JS=Ae(Te());var Cbe=Ae(Te());var Ebe;var kbe=function(){if(Ebe)return Ebe;if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function QVe(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=kbe();return t&&e.setAttribute("nonce",t),e}function YVe(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function ZVe(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var nG=function(){var e=0,t=null;return{add:function(r){e==0&&(t=QVe())&&(YVe(t,r),ZVe(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}};var iG=function(){var e=nG();return function(t,r){Cbe.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&r])}};var EC=function(){var e=iG(),t=function(r){var n=r.styles,i=r.dynamic;return e(n,i),null};return t};var XVe={left:0,top:0,right:0,gap:0},aG=function(e){return parseInt(e||"",10)||0},KVe=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[aG(r),aG(n),aG(i)]},oG=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return XVe;var t=KVe(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 JVe=EC(),KS="data-scroll-locked",eGe=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(XV,` { + `};var kxe=Ae(Qa());var Lye=(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 Exe=Ae(Qa()),$d=Ae(Te());var ha=Ae(Te(),1);function ih(e,t,{checkForDefaultPrevented:r=!0}={}){return function(i){if(e?.(i),r===!1||!i.defaultPrevented)return t?.(i)}}var zye=Ae(Te(),1);function pVe(e,t){typeof e=="function"?e(t):e!=null&&(e.current=t)}function LV(...e){return t=>e.forEach(r=>pVe(r,t))}function Wp(...e){return zye.useCallback(LV(...e),e)}var Bd=Ae(Te(),1),zV=Ae(KA(),1);function Vye(e,t){let r=Bd.createContext(t);function n(a){let{children:o,...s}=a,l=Bd.useMemo(()=>s,Object.values(s));return(0,zV.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 Gye(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,zV.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,bVe(i,...t)]}function bVe(...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 UV=Ae(Te(),1);var Qye=Ae(Te(),1),Py=Boolean(globalThis?.document)?Qye.useLayoutEffect:()=>{};var xVe=UV["useId".toString()]||(()=>{}),wVe=0;function KB(e){let[t,r]=UV.useState(xVe());return Py(()=>{e||r(n=>n??String(wVe++))},[e]),e||(t?`radix-${t}`:"")}var dv=Ae(Te(),1);var ZS=Ae(Te(),1);function Hp(e){let t=ZS.useRef(e);return ZS.useEffect(()=>{t.current=e}),ZS.useMemo(()=>(...r)=>t.current?.(...r),[])}function Yye({prop:e,defaultProp:t,onChange:r=()=>{}}){let[n,i]=SVe({defaultProp:t,onChange:r}),a=e!==void 0,o=a?e:n,s=Hp(r),l=dv.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 SVe({defaultProp:e,onChange:t}){let r=dv.useState(e),[n]=r,i=dv.useRef(n),a=Hp(t);return dv.useEffect(()=>{i.current!==n&&(a(n),i.current=n)},[n,i,a]),r}var ro=Ae(Te(),1);var Zye=Ae(Te(),1),Xye=Ae(bl(),1);var El=Ae(Te(),1);var XS=Ae(KA(),1),xC=El.forwardRef((e,t)=>{let{children:r,...n}=e,i=El.Children.toArray(r),a=i.find(kVe);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,XS.jsx)(WV,{...n,ref:t,children:El.isValidElement(o)?El.cloneElement(o,void 0,s):null})}return(0,XS.jsx)(WV,{...n,ref:t,children:r})});xC.displayName="Slot";var WV=El.forwardRef((e,t)=>{let{children:r,...n}=e;if(El.isValidElement(r)){let i=DVe(r);return El.cloneElement(r,{...CVe(n,r.props),ref:t?LV(t,i):i})}return El.Children.count(r)>1?El.Children.only(null):null});WV.displayName="SlotClone";var EVe=({children:e})=>(0,XS.jsx)(XS.Fragment,{children:e});function kVe(e){return El.isValidElement(e)&&e.type===EVe}function CVe(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 DVe(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 Kye=Ae(KA(),1),OVe=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"],Cf=OVe.reduce((e,t)=>{let r=Zye.forwardRef((n,i)=>{let{asChild:a,...o}=n,s=a?xC:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),(0,Kye.jsx)(s,{...o,ref:i})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function Jye(e,t){e&&Xye.flushSync(()=>e.dispatchEvent(t))}var ebe=Ae(Te(),1);function tbe(e,t=globalThis?.document){let r=Hp(e);ebe.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 VV=Ae(KA(),1),MVe="DismissableLayer",HV="dismissableLayer.update",jVe="dismissableLayer.pointerDownOutside",NVe="dismissableLayer.focusOutside",rbe,ibe=ro.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),GV=ro.forwardRef((e,t)=>{let{disableOutsidePointerEvents:r=!1,onEscapeKeyDown:n,onPointerDownOutside:i,onFocusOutside:a,onInteractOutside:o,onDismiss:s,...l}=e,u=ro.useContext(ibe),[c,f]=ro.useState(null),d=c?.ownerDocument??globalThis?.document,[,p]=ro.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=_Ve(k=>{let j=k.target,O=[...u.branches].some(C=>C.contains(j));!x||O||(i?.(k),o?.(k),k.defaultPrevented||s?.())},d),S=PVe(k=>{let j=k.target;[...u.branches].some(C=>C.contains(j))||(a?.(k),o?.(k),k.defaultPrevented||s?.())},d);return tbe(k=>{b===u.layers.size-1&&(n?.(k),!k.defaultPrevented&&s&&(k.preventDefault(),s()))},d),ro.useEffect(()=>{if(!!c)return r&&(u.layersWithOutsidePointerEventsDisabled.size===0&&(rbe=d.body.style.pointerEvents,d.body.style.pointerEvents="none"),u.layersWithOutsidePointerEventsDisabled.add(c)),u.layers.add(c),nbe(),()=>{r&&u.layersWithOutsidePointerEventsDisabled.size===1&&(d.body.style.pointerEvents=rbe)}},[c,d,r,u]),ro.useEffect(()=>()=>{!c||(u.layers.delete(c),u.layersWithOutsidePointerEventsDisabled.delete(c),nbe())},[c,u]),ro.useEffect(()=>{let k=()=>p({});return document.addEventListener(HV,k),()=>document.removeEventListener(HV,k)},[]),(0,VV.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)})});GV.displayName=MVe;var TVe="DismissableLayerBranch",FVe=ro.forwardRef((e,t)=>{let r=ro.useContext(ibe),n=ro.useRef(null),i=Wp(t,n);return ro.useEffect(()=>{let a=n.current;if(a)return r.branches.add(a),()=>{r.branches.delete(a)}},[r.branches]),(0,VV.jsx)(Cf.div,{...e,ref:i})});FVe.displayName=TVe;function _Ve(e,t=globalThis?.document){let r=Hp(e),n=ro.useRef(!1),i=ro.useRef(()=>{});return ro.useEffect(()=>{let a=s=>{if(s.target&&!n.current){let u=function(){abe(jVe,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 PVe(e,t=globalThis?.document){let r=Hp(e),n=ro.useRef(!1);return ro.useEffect(()=>{let i=a=>{a.target&&!n.current&&abe(NVe,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 nbe(){let e=new CustomEvent(HV);document.dispatchEvent(e)}function abe(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?Jye(i,a):i.dispatchEvent(a)}var Rd=Ae(Te(),1);var cbe=Ae(KA(),1),QV="focusScope.autoFocusOnMount",YV="focusScope.autoFocusOnUnmount",obe={bubbles:!1,cancelable:!0},IVe="FocusScope",ZV=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:pv(f.current,{select:!0})},v=function(S){if(p.paused||!s)return;let k=S.relatedTarget;k!==null&&(s.contains(k)||pv(f.current,{select:!0}))},x=function(S){if(document.activeElement===document.body)for(let j of S)j.removedNodes.length>0&&pv(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){lbe.add(p);let m=document.activeElement;if(!s.contains(m)){let A=new CustomEvent(QV,obe);s.addEventListener(QV,u),s.dispatchEvent(A),A.defaultPrevented||(BVe(zVe(fbe(s)),{select:!0}),document.activeElement===m&&pv(s))}return()=>{s.removeEventListener(QV,u),setTimeout(()=>{let A=new CustomEvent(YV,obe);s.addEventListener(YV,c),s.dispatchEvent(A),A.defaultPrevented||pv(m??document.body,{select:!0}),s.removeEventListener(YV,c),lbe.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]=RVe(b);v&&x?!m.shiftKey&&A===x?(m.preventDefault(),r&&pv(v,{select:!0})):m.shiftKey&&A===v&&(m.preventDefault(),r&&pv(x,{select:!0})):A===b&&m.preventDefault()}},[r,n,p.paused]);return(0,cbe.jsx)(Cf.div,{tabIndex:-1,...o,ref:d,onKeyDown:h})});ZV.displayName=IVe;function BVe(e,{select:t=!1}={}){let r=document.activeElement;for(let n of e)if(pv(n,{select:t}),document.activeElement!==r)return}function RVe(e){let t=fbe(e),r=sbe(t,e),n=sbe(t.reverse(),e);return[r,n]}function fbe(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 sbe(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 qVe(e){return e instanceof HTMLInputElement&&"select"in e}function pv(e,{select:t=!1}={}){if(e&&e.focus){let r=document.activeElement;e.focus({preventScroll:!0}),e!==r&&qVe(e)&&t&&e.select()}}var lbe=LVe();function LVe(){let e=[];return{add(t){let r=e[0];t!==r&&r?.pause(),e=ube(e,t),e.unshift(t)},remove(t){e=ube(e,t),e[0]?.resume()}}}function ube(e,t){let r=[...e],n=r.indexOf(t);return n!==-1&&r.splice(n,1),r}function zVe(e){return e.filter(t=>t.tagName!=="A")}var JB=Ae(Te(),1),dbe=Ae(bl(),1);var pbe=Ae(KA(),1),UVe="Portal",XV=JB.forwardRef((e,t)=>{let{container:r,...n}=e,[i,a]=JB.useState(!1);Py(()=>a(!0),[]);let o=r||i&&globalThis?.document?.body;return o?dbe.default.createPortal((0,pbe.jsx)(Cf.div,{...n,ref:t}),o):null});XV.displayName=UVe;var Nc=Ae(Te(),1),mbe=Ae(bl(),1);var hbe=Ae(Te(),1);function WVe(e,t){return hbe.useReducer((r,n)=>t[r][n]??r,e)}var wC=e=>{let{present:t,children:r}=e,n=HVe(t),i=typeof r=="function"?r({present:n.isPresent}):Nc.Children.only(r),a=Wp(n.ref,VVe(i));return typeof r=="function"||n.isPresent?Nc.cloneElement(i,{ref:a}):null};wC.displayName="Presence";function HVe(e){let[t,r]=Nc.useState(),n=Nc.useRef({}),i=Nc.useRef(e),a=Nc.useRef("none"),o=e?"mounted":"unmounted",[s,l]=WVe(o,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return Nc.useEffect(()=>{let u=e5(n.current);a.current=s==="mounted"?u:"none"},[s]),Py(()=>{let u=n.current,c=i.current;if(c!==e){let d=a.current,p=e5(u);e?l("MOUNT"):p==="none"||u?.display==="none"?l("UNMOUNT"):l(c&&d!==p?"ANIMATION_OUT":"UNMOUNT"),i.current=e}},[e,l]),Py(()=>{if(t){let u=f=>{let p=e5(n.current).includes(f.animationName);f.target===t&&p&&mbe.flushSync(()=>l("ANIMATION_END"))},c=f=>{f.target===t&&(a.current=e5(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 e5(e){return e?.animationName||"none"}function VVe(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 gbe=Ae(Te(),1),KV=0;function vbe(){gbe.useEffect(()=>{let e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??Abe()),document.body.insertAdjacentElement("beforeend",e[1]??Abe()),KV++,()=>{KV===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(t=>t.remove()),KV--}},[])}function Abe(){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 a5=Ae(Te());var pu=Ae(Te());var Iy="right-scroll-bar-position",By="width-before-scroll-bar",JV="with-scroll-bars-hidden",eG="--removed-body-scroll-bar-size";function t5(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}var ybe=Ae(Te());function bbe(e,t){var r=(0,ybe.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 r5=Ae(Te());var GVe=typeof window<"u"?r5.useLayoutEffect:r5.useEffect,xbe=new WeakMap;function tG(e,t){var r=bbe(t||null,function(n){return e.forEach(function(i){return t5(i,n)})});return GVe(function(){var n=xbe.get(r);if(n){var i=new Set(n),a=new Set(e),o=r.current;i.forEach(function(s){a.has(s)||t5(s,null)}),a.forEach(function(s){i.has(s)||t5(s,o)})}xbe.set(r,e)},[e]),r}function QVe(e){return e}function YVe(e,t){t===void 0&&(t=QVe);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 rG(e){e===void 0&&(e={});var t=YVe(null);return t.options=Ni({async:!0,ssr:!1},e),t}var wbe=Ae(Te()),Sbe=function(e){var t=e.sideCar,r=RM(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 wbe.createElement(n,Ni({},r))};Sbe.isSideCarExport=!0;function nG(e,t){return e.useMedium(t),Sbe}var n5=rG();var iG=function(){},SC=pu.forwardRef(function(e,t){var r=pu.useRef(null),n=pu.useState({onScrollCapture:iG,onWheelCapture:iG,onTouchMoveCapture:iG}),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=RM(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noIsolation","inert","allowPinchZoom","as","gapMode"]),x=d,w=tG([r,t]),S=Ni(Ni({},v),i);return pu.createElement(pu.Fragment,null,c&&pu.createElement(x,{sideCar:n5,removeScrollBar:u,shards:f,noIsolation:p,inert:h,setCallbacks:a,allowPinchZoom:!!m,lockRef:r,gapMode:b}),o?pu.cloneElement(pu.Children.only(s),Ni(Ni({},S),{ref:w})):pu.createElement(A,Ni({},S,{className:l,ref:w}),s))});SC.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};SC.classNames={fullWidth:By,zeroRight:Iy};var Na=Ae(Te());var JS=Ae(Te());var Cbe=Ae(Te());var Ebe;var kbe=function(){if(Ebe)return Ebe;if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function ZVe(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=kbe();return t&&e.setAttribute("nonce",t),e}function XVe(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function KVe(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var aG=function(){var e=0,t=null;return{add:function(r){e==0&&(t=ZVe())&&(XVe(t,r),KVe(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}};var oG=function(){var e=aG();return function(t,r){Cbe.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&r])}};var EC=function(){var e=oG(),t=function(r){var n=r.styles,i=r.dynamic;return e(n,i),null};return t};var JVe={left:0,top:0,right:0,gap:0},sG=function(e){return parseInt(e||"",10)||0},eGe=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[sG(r),sG(n),sG(i)]},lG=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return JVe;var t=eGe(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 tGe=EC(),KS="data-scroll-locked",rGe=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(JV,` { overflow: hidden `).concat(n,`; padding-right: `).concat(s,"px ").concat(n,`; } @@ -164,33 +164,33 @@ In case of a (multi dimensional) array or matrix, the prob order quantile of all } body[`).concat(KS,`] { - `).concat(KV,": ").concat(s,`px; + `).concat(eG,": ").concat(s,`px; } -`)},Dbe=function(){var e=parseInt(document.body.getAttribute(KS)||"0",10);return isFinite(e)?e:0},tGe=function(){JS.useEffect(function(){return document.body.setAttribute(KS,(Dbe()+1).toString()),function(){var e=Dbe()-1;e<=0?document.body.removeAttribute(KS):document.body.setAttribute(KS,e.toString())}},[])},sG=function(e){var t=e.noRelative,r=e.noImportant,n=e.gapMode,i=n===void 0?"margin":n;tGe();var a=JS.useMemo(function(){return oG(i)},[i]);return JS.createElement(JVe,{styles:eGe(a,!t,i,r?"":"!important")})};var lG=!1;if(typeof window<"u")try{kC=Object.defineProperty({},"passive",{get:function(){return lG=!0,!0}}),window.addEventListener("test",kC,kC),window.removeEventListener("test",kC,kC)}catch{lG=!1}var kC,Ry=lG?{passive:!1}:!1;var rGe=function(e){return e.tagName==="TEXTAREA"},Obe=function(e,t){var r=window.getComputedStyle(e);return r[t]!=="hidden"&&!(r.overflowY===r.overflowX&&!rGe(e)&&r[t]==="visible")},nGe=function(e){return Obe(e,"overflowY")},iGe=function(e){return Obe(e,"overflowX")},uG=function(e,t){var r=t.ownerDocument,n=t;do{typeof ShadowRoot<"u"&&n instanceof ShadowRoot&&(n=n.host);var i=Mbe(e,n);if(i){var a=jbe(e,n),o=a[1],s=a[2];if(o>s)return!0}n=n.parentNode}while(n&&n!==r.body);return!1},aGe=function(e){var t=e.scrollTop,r=e.scrollHeight,n=e.clientHeight;return[t,r,n]},oGe=function(e){var t=e.scrollLeft,r=e.scrollWidth,n=e.clientWidth;return[t,r,n]},Mbe=function(e,t){return e==="v"?nGe(t):iGe(t)},jbe=function(e,t){return e==="v"?aGe(t):oGe(t)},sGe=function(e,t){return e==="h"&&t==="rtl"?-1:1},Nbe=function(e,t,r,n,i){var a=sGe(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=jbe(e,s),h=p[0],m=p[1],g=p[2],A=m-g-a*h;(h||A)&&Mbe(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 i5=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},Tbe=function(e){return[e.deltaX,e.deltaY]},Fbe=function(e){return e&&"current"in e?e.current:e},lGe=function(e,t){return e[0]===t[0]&&e[1]===t[1]},uGe=function(e){return` +`)},Dbe=function(){var e=parseInt(document.body.getAttribute(KS)||"0",10);return isFinite(e)?e:0},nGe=function(){JS.useEffect(function(){return document.body.setAttribute(KS,(Dbe()+1).toString()),function(){var e=Dbe()-1;e<=0?document.body.removeAttribute(KS):document.body.setAttribute(KS,e.toString())}},[])},uG=function(e){var t=e.noRelative,r=e.noImportant,n=e.gapMode,i=n===void 0?"margin":n;nGe();var a=JS.useMemo(function(){return lG(i)},[i]);return JS.createElement(tGe,{styles:rGe(a,!t,i,r?"":"!important")})};var cG=!1;if(typeof window<"u")try{kC=Object.defineProperty({},"passive",{get:function(){return cG=!0,!0}}),window.addEventListener("test",kC,kC),window.removeEventListener("test",kC,kC)}catch{cG=!1}var kC,Ry=cG?{passive:!1}:!1;var iGe=function(e){return e.tagName==="TEXTAREA"},Obe=function(e,t){var r=window.getComputedStyle(e);return r[t]!=="hidden"&&!(r.overflowY===r.overflowX&&!iGe(e)&&r[t]==="visible")},aGe=function(e){return Obe(e,"overflowY")},oGe=function(e){return Obe(e,"overflowX")},fG=function(e,t){var r=t.ownerDocument,n=t;do{typeof ShadowRoot<"u"&&n instanceof ShadowRoot&&(n=n.host);var i=Mbe(e,n);if(i){var a=jbe(e,n),o=a[1],s=a[2];if(o>s)return!0}n=n.parentNode}while(n&&n!==r.body);return!1},sGe=function(e){var t=e.scrollTop,r=e.scrollHeight,n=e.clientHeight;return[t,r,n]},lGe=function(e){var t=e.scrollLeft,r=e.scrollWidth,n=e.clientWidth;return[t,r,n]},Mbe=function(e,t){return e==="v"?aGe(t):oGe(t)},jbe=function(e,t){return e==="v"?sGe(t):lGe(t)},uGe=function(e,t){return e==="h"&&t==="rtl"?-1:1},Nbe=function(e,t,r,n,i){var a=uGe(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=jbe(e,s),h=p[0],m=p[1],g=p[2],A=m-g-a*h;(h||A)&&Mbe(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 i5=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},Tbe=function(e){return[e.deltaX,e.deltaY]},Fbe=function(e){return e&&"current"in e?e.current:e},cGe=function(e,t){return e[0]===t[0]&&e[1]===t[1]},fGe=function(e){return` .block-interactivity-`.concat(e,` {pointer-events: none;} .allow-interactivity-`).concat(e,` {pointer-events: all;} -`)},cGe=0,e2=[];function _be(e){var t=Na.useRef([]),r=Na.useRef([0,0]),n=Na.useRef(),i=Na.useState(cGe++)[0],a=Na.useState(EC)[0],o=Na.useRef(e);Na.useEffect(function(){o.current=e},[e]),Na.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(i));var m=kt([e.lockRef.current],(e.shards||[]).map(Fbe),!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=Na.useCallback(function(m,g){if("touches"in m&&m.touches.length===2)return!o.current.allowPinchZoom;var A=i5(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=uG(k,S);if(!j)return!0;if(j?w=k:(w=k==="v"?"h":"v",j=uG(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 Nbe(O,g,m,O==="h"?v:x,!0)},[]),l=Na.useCallback(function(m){var g=m;if(!(!e2.length||e2[e2.length-1]!==a)){var A="deltaY"in g?Tbe(g):i5(g),b=t.current.filter(function(w){return w.name===g.type&&(w.target===g.target||g.target===w.shadowParent)&&lGe(w.delta,A)})[0];if(b&&b.should){g.cancelable&&g.preventDefault();return}if(!b){var v=(o.current.shards||[]).map(Fbe).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=Na.useCallback(function(m,g,A,b){var v={name:m,delta:g,target:A,should:b,shadowParent:fGe(A)};t.current.push(v),setTimeout(function(){t.current=t.current.filter(function(x){return x!==v})},1)},[]),c=Na.useCallback(function(m){r.current=i5(m),n.current=void 0},[]),f=Na.useCallback(function(m){u(m.type,Tbe(m),m.target,s(m,e.lockRef.current))},[]),d=Na.useCallback(function(m){u(m.type,i5(m),m.target,s(m,e.lockRef.current))},[]);Na.useEffect(function(){return e2.push(a),e.setCallbacks({onScrollCapture:f,onWheelCapture:f,onTouchMoveCapture:d}),document.addEventListener("wheel",l,Ry),document.addEventListener("touchmove",l,Ry),document.addEventListener("touchstart",c,Ry),function(){e2=e2.filter(function(m){return m!==a}),document.removeEventListener("wheel",l,Ry),document.removeEventListener("touchmove",l,Ry),document.removeEventListener("touchstart",c,Ry)}},[]);var p=e.removeScrollBar,h=e.inert;return Na.createElement(Na.Fragment,null,h?Na.createElement(a,{styles:uGe(i)}):null,p?Na.createElement(sG,{gapMode:e.gapMode}):null)}function fGe(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}var Pbe=tG(n5,_be);var Ibe=a5.forwardRef(function(e,t){return a5.createElement(SC,Ni({},e,{ref:t,sideCar:Pbe}))});Ibe.classNames=SC.classNames;var cG=Ibe;var dGe=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},t2=new WeakMap,o5=new WeakMap,s5={},fG=0,Bbe=function(e){return e&&(e.host||Bbe(e.parentNode))},pGe=function(e,t){return t.map(function(r){if(e.contains(r))return r;var n=Bbe(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)})},mGe=function(e,t,r,n){var i=pGe(t,Array.isArray(e)?e:[e]);s5[r]||(s5[r]=new WeakMap);var a=s5[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=(t2.get(d)||0)+1,g=(a.get(d)||0)+1;t2.set(d,m),a.set(d,g),o.push(d),m===1&&h&&o5.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(),fG++,function(){o.forEach(function(f){var d=t2.get(f)-1,p=a.get(f)-1;t2.set(f,d),a.set(f,p),d||(o5.has(f)||f.removeAttribute(n),o5.delete(f)),p||f.removeAttribute(r)}),fG--,fG||(t2=new WeakMap,t2=new WeakMap,o5=new WeakMap,s5={})}},Rbe=function(e,t,r){r===void 0&&(r="data-aria-hidden");var n=Array.from(Array.isArray(e)?e:[e]),i=t||dGe(e);return i?(n.push.apply(n,Array.from(i.querySelectorAll("[aria-live]"))),mGe(n,i,r,"aria-hidden")):function(){return null}};var qi=Ae(KA(),1),dG="Dialog",[$be,tXt]=Gye(dG),[hGe,Vp]=$be(dG),qbe=e=>{let{__scopeDialog:t,children:r,open:n,defaultOpen:i,onOpenChange:a,modal:o=!0}=e,s=ha.useRef(null),l=ha.useRef(null),[u=!1,c]=Yye({prop:n,defaultProp:i,onChange:a});return(0,qi.jsx)(hGe,{scope:t,triggerRef:s,contentRef:l,contentId:KB(),titleId:KB(),descriptionId:KB(),open:u,onOpenChange:c,onOpenToggle:ha.useCallback(()=>c(f=>!f),[c]),modal:o,children:r})};qbe.displayName=dG;var Lbe="DialogTrigger",zbe=ha.forwardRef((e,t)=>{let{__scopeDialog:r,...n}=e,i=Vp(Lbe,r),a=Wp(t,i.triggerRef);return(0,qi.jsx)(Cf.button,{type:"button","aria-haspopup":"dialog","aria-expanded":i.open,"aria-controls":i.contentId,"data-state":hG(i.open),...n,ref:a,onClick:ih(e.onClick,i.onOpenToggle)})});zbe.displayName=Lbe;var pG="DialogPortal",[AGe,Ube]=$be(pG,{forceMount:void 0}),Wbe=e=>{let{__scopeDialog:t,forceMount:r,children:n,container:i}=e,a=Vp(pG,t);return(0,qi.jsx)(AGe,{scope:t,forceMount:r,children:ha.Children.map(n,o=>(0,qi.jsx)(wC,{present:r||a.open,children:(0,qi.jsx)(YV,{asChild:!0,container:i,children:o})}))})};Wbe.displayName=pG;var l5="DialogOverlay",Hbe=ha.forwardRef((e,t)=>{let r=Ube(l5,e.__scopeDialog),{forceMount:n=r.forceMount,...i}=e,a=Vp(l5,e.__scopeDialog);return a.modal?(0,qi.jsx)(wC,{present:n||a.open,children:(0,qi.jsx)(gGe,{...i,ref:t})}):null});Hbe.displayName=l5;var gGe=ha.forwardRef((e,t)=>{let{__scopeDialog:r,...n}=e,i=Vp(l5,r);return(0,qi.jsx)(cG,{as:xC,allowPinchZoom:!0,shards:[i.contentRef],children:(0,qi.jsx)(Cf.div,{"data-state":hG(i.open),...n,ref:t,style:{pointerEvents:"auto",...n.style}})})}),$y="DialogContent",Vbe=ha.forwardRef((e,t)=>{let r=Ube($y,e.__scopeDialog),{forceMount:n=r.forceMount,...i}=e,a=Vp($y,e.__scopeDialog);return(0,qi.jsx)(wC,{present:n||a.open,children:a.modal?(0,qi.jsx)(vGe,{...i,ref:t}):(0,qi.jsx)(yGe,{...i,ref:t})})});Vbe.displayName=$y;var vGe=ha.forwardRef((e,t)=>{let r=Vp($y,e.__scopeDialog),n=ha.useRef(null),i=Wp(t,r.contentRef,n);return ha.useEffect(()=>{let a=n.current;if(a)return Rbe(a)},[]),(0,qi.jsx)(Gbe,{...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())})}),yGe=ha.forwardRef((e,t)=>{let r=Vp($y,e.__scopeDialog),n=ha.useRef(!1),i=ha.useRef(!1);return(0,qi.jsx)(Gbe,{...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()}})}),Gbe=ha.forwardRef((e,t)=>{let{__scopeDialog:r,trapFocus:n,onOpenAutoFocus:i,onCloseAutoFocus:a,...o}=e,s=Vp($y,r),l=ha.useRef(null),u=Wp(t,l);return vbe(),(0,qi.jsxs)(qi.Fragment,{children:[(0,qi.jsx)(QV,{asChild:!0,loop:!0,trapped:n,onMountAutoFocus:i,onUnmountAutoFocus:a,children:(0,qi.jsx)(HV,{role:"dialog",id:s.contentId,"aria-describedby":s.descriptionId,"aria-labelledby":s.titleId,"data-state":hG(s.open),...o,ref:u,onDismiss:()=>s.onOpenChange(!1)})}),(0,qi.jsxs)(qi.Fragment,{children:[(0,qi.jsx)(bGe,{titleId:s.titleId}),(0,qi.jsx)(wGe,{contentRef:l,descriptionId:s.descriptionId})]})]})}),mG="DialogTitle",Qbe=ha.forwardRef((e,t)=>{let{__scopeDialog:r,...n}=e,i=Vp(mG,r);return(0,qi.jsx)(Cf.h2,{id:i.titleId,...n,ref:t})});Qbe.displayName=mG;var Ybe="DialogDescription",Zbe=ha.forwardRef((e,t)=>{let{__scopeDialog:r,...n}=e,i=Vp(Ybe,r);return(0,qi.jsx)(Cf.p,{id:i.descriptionId,...n,ref:t})});Zbe.displayName=Ybe;var Xbe="DialogClose",Kbe=ha.forwardRef((e,t)=>{let{__scopeDialog:r,...n}=e,i=Vp(Xbe,r);return(0,qi.jsx)(Cf.button,{type:"button",...n,ref:t,onClick:ih(e.onClick,()=>i.onOpenChange(!1))})});Kbe.displayName=Xbe;function hG(e){return e?"open":"closed"}var Jbe="DialogTitleWarning",[rXt,exe]=Vye(Jbe,{contentName:$y,titleName:mG,docsSlug:"dialog"}),bGe=({titleId:e})=>{let t=exe(Jbe),r=`\`${t.contentName}\` requires a \`${t.titleName}\` for the component to be accessible for screen reader users. +`)},dGe=0,e2=[];function _be(e){var t=Na.useRef([]),r=Na.useRef([0,0]),n=Na.useRef(),i=Na.useState(dGe++)[0],a=Na.useState(EC)[0],o=Na.useRef(e);Na.useEffect(function(){o.current=e},[e]),Na.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(i));var m=kt([e.lockRef.current],(e.shards||[]).map(Fbe),!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=Na.useCallback(function(m,g){if("touches"in m&&m.touches.length===2)return!o.current.allowPinchZoom;var A=i5(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=fG(k,S);if(!j)return!0;if(j?w=k:(w=k==="v"?"h":"v",j=fG(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 Nbe(O,g,m,O==="h"?v:x,!0)},[]),l=Na.useCallback(function(m){var g=m;if(!(!e2.length||e2[e2.length-1]!==a)){var A="deltaY"in g?Tbe(g):i5(g),b=t.current.filter(function(w){return w.name===g.type&&(w.target===g.target||g.target===w.shadowParent)&&cGe(w.delta,A)})[0];if(b&&b.should){g.cancelable&&g.preventDefault();return}if(!b){var v=(o.current.shards||[]).map(Fbe).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=Na.useCallback(function(m,g,A,b){var v={name:m,delta:g,target:A,should:b,shadowParent:pGe(A)};t.current.push(v),setTimeout(function(){t.current=t.current.filter(function(x){return x!==v})},1)},[]),c=Na.useCallback(function(m){r.current=i5(m),n.current=void 0},[]),f=Na.useCallback(function(m){u(m.type,Tbe(m),m.target,s(m,e.lockRef.current))},[]),d=Na.useCallback(function(m){u(m.type,i5(m),m.target,s(m,e.lockRef.current))},[]);Na.useEffect(function(){return e2.push(a),e.setCallbacks({onScrollCapture:f,onWheelCapture:f,onTouchMoveCapture:d}),document.addEventListener("wheel",l,Ry),document.addEventListener("touchmove",l,Ry),document.addEventListener("touchstart",c,Ry),function(){e2=e2.filter(function(m){return m!==a}),document.removeEventListener("wheel",l,Ry),document.removeEventListener("touchmove",l,Ry),document.removeEventListener("touchstart",c,Ry)}},[]);var p=e.removeScrollBar,h=e.inert;return Na.createElement(Na.Fragment,null,h?Na.createElement(a,{styles:fGe(i)}):null,p?Na.createElement(uG,{gapMode:e.gapMode}):null)}function pGe(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}var Pbe=nG(n5,_be);var Ibe=a5.forwardRef(function(e,t){return a5.createElement(SC,Ni({},e,{ref:t,sideCar:Pbe}))});Ibe.classNames=SC.classNames;var dG=Ibe;var mGe=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},t2=new WeakMap,o5=new WeakMap,s5={},pG=0,Bbe=function(e){return e&&(e.host||Bbe(e.parentNode))},hGe=function(e,t){return t.map(function(r){if(e.contains(r))return r;var n=Bbe(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)})},AGe=function(e,t,r,n){var i=hGe(t,Array.isArray(e)?e:[e]);s5[r]||(s5[r]=new WeakMap);var a=s5[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=(t2.get(d)||0)+1,g=(a.get(d)||0)+1;t2.set(d,m),a.set(d,g),o.push(d),m===1&&h&&o5.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(),pG++,function(){o.forEach(function(f){var d=t2.get(f)-1,p=a.get(f)-1;t2.set(f,d),a.set(f,p),d||(o5.has(f)||f.removeAttribute(n),o5.delete(f)),p||f.removeAttribute(r)}),pG--,pG||(t2=new WeakMap,t2=new WeakMap,o5=new WeakMap,s5={})}},Rbe=function(e,t,r){r===void 0&&(r="data-aria-hidden");var n=Array.from(Array.isArray(e)?e:[e]),i=t||mGe(e);return i?(n.push.apply(n,Array.from(i.querySelectorAll("[aria-live]"))),AGe(n,i,r,"aria-hidden")):function(){return null}};var qi=Ae(KA(),1),mG="Dialog",[$be,nXt]=Gye(mG),[gGe,Vp]=$be(mG),qbe=e=>{let{__scopeDialog:t,children:r,open:n,defaultOpen:i,onOpenChange:a,modal:o=!0}=e,s=ha.useRef(null),l=ha.useRef(null),[u=!1,c]=Yye({prop:n,defaultProp:i,onChange:a});return(0,qi.jsx)(gGe,{scope:t,triggerRef:s,contentRef:l,contentId:KB(),titleId:KB(),descriptionId:KB(),open:u,onOpenChange:c,onOpenToggle:ha.useCallback(()=>c(f=>!f),[c]),modal:o,children:r})};qbe.displayName=mG;var Lbe="DialogTrigger",zbe=ha.forwardRef((e,t)=>{let{__scopeDialog:r,...n}=e,i=Vp(Lbe,r),a=Wp(t,i.triggerRef);return(0,qi.jsx)(Cf.button,{type:"button","aria-haspopup":"dialog","aria-expanded":i.open,"aria-controls":i.contentId,"data-state":gG(i.open),...n,ref:a,onClick:ih(e.onClick,i.onOpenToggle)})});zbe.displayName=Lbe;var hG="DialogPortal",[vGe,Ube]=$be(hG,{forceMount:void 0}),Wbe=e=>{let{__scopeDialog:t,forceMount:r,children:n,container:i}=e,a=Vp(hG,t);return(0,qi.jsx)(vGe,{scope:t,forceMount:r,children:ha.Children.map(n,o=>(0,qi.jsx)(wC,{present:r||a.open,children:(0,qi.jsx)(XV,{asChild:!0,container:i,children:o})}))})};Wbe.displayName=hG;var l5="DialogOverlay",Hbe=ha.forwardRef((e,t)=>{let r=Ube(l5,e.__scopeDialog),{forceMount:n=r.forceMount,...i}=e,a=Vp(l5,e.__scopeDialog);return a.modal?(0,qi.jsx)(wC,{present:n||a.open,children:(0,qi.jsx)(yGe,{...i,ref:t})}):null});Hbe.displayName=l5;var yGe=ha.forwardRef((e,t)=>{let{__scopeDialog:r,...n}=e,i=Vp(l5,r);return(0,qi.jsx)(dG,{as:xC,allowPinchZoom:!0,shards:[i.contentRef],children:(0,qi.jsx)(Cf.div,{"data-state":gG(i.open),...n,ref:t,style:{pointerEvents:"auto",...n.style}})})}),$y="DialogContent",Vbe=ha.forwardRef((e,t)=>{let r=Ube($y,e.__scopeDialog),{forceMount:n=r.forceMount,...i}=e,a=Vp($y,e.__scopeDialog);return(0,qi.jsx)(wC,{present:n||a.open,children:a.modal?(0,qi.jsx)(bGe,{...i,ref:t}):(0,qi.jsx)(xGe,{...i,ref:t})})});Vbe.displayName=$y;var bGe=ha.forwardRef((e,t)=>{let r=Vp($y,e.__scopeDialog),n=ha.useRef(null),i=Wp(t,r.contentRef,n);return ha.useEffect(()=>{let a=n.current;if(a)return Rbe(a)},[]),(0,qi.jsx)(Gbe,{...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())})}),xGe=ha.forwardRef((e,t)=>{let r=Vp($y,e.__scopeDialog),n=ha.useRef(!1),i=ha.useRef(!1);return(0,qi.jsx)(Gbe,{...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()}})}),Gbe=ha.forwardRef((e,t)=>{let{__scopeDialog:r,trapFocus:n,onOpenAutoFocus:i,onCloseAutoFocus:a,...o}=e,s=Vp($y,r),l=ha.useRef(null),u=Wp(t,l);return vbe(),(0,qi.jsxs)(qi.Fragment,{children:[(0,qi.jsx)(ZV,{asChild:!0,loop:!0,trapped:n,onMountAutoFocus:i,onUnmountAutoFocus:a,children:(0,qi.jsx)(GV,{role:"dialog",id:s.contentId,"aria-describedby":s.descriptionId,"aria-labelledby":s.titleId,"data-state":gG(s.open),...o,ref:u,onDismiss:()=>s.onOpenChange(!1)})}),(0,qi.jsxs)(qi.Fragment,{children:[(0,qi.jsx)(wGe,{titleId:s.titleId}),(0,qi.jsx)(EGe,{contentRef:l,descriptionId:s.descriptionId})]})]})}),AG="DialogTitle",Qbe=ha.forwardRef((e,t)=>{let{__scopeDialog:r,...n}=e,i=Vp(AG,r);return(0,qi.jsx)(Cf.h2,{id:i.titleId,...n,ref:t})});Qbe.displayName=AG;var Ybe="DialogDescription",Zbe=ha.forwardRef((e,t)=>{let{__scopeDialog:r,...n}=e,i=Vp(Ybe,r);return(0,qi.jsx)(Cf.p,{id:i.descriptionId,...n,ref:t})});Zbe.displayName=Ybe;var Xbe="DialogClose",Kbe=ha.forwardRef((e,t)=>{let{__scopeDialog:r,...n}=e,i=Vp(Xbe,r);return(0,qi.jsx)(Cf.button,{type:"button",...n,ref:t,onClick:ih(e.onClick,()=>i.onOpenChange(!1))})});Kbe.displayName=Xbe;function gG(e){return e?"open":"closed"}var Jbe="DialogTitleWarning",[iXt,exe]=Vye(Jbe,{contentName:$y,titleName:AG,docsSlug:"dialog"}),wGe=({titleId:e})=>{let t=exe(Jbe),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 ha.useEffect(()=>{e&&(document.getElementById(e)||console.error(r))},[r,e]),null},xGe="DialogDescriptionWarning",wGe=({contentRef:e,descriptionId:t})=>{let n=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${exe(xGe).contentName}}.`;return ha.useEffect(()=>{let i=e.current?.getAttribute("aria-describedby");t&&i&&(document.getElementById(t)||console.warn(n))},[n,e,t]),null},txe=qbe,rxe=zbe,nxe=Wbe,ixe=Hbe,axe=Vbe,oxe=Qbe,sxe=Zbe,lxe=Kbe;var dxe=Ae(Te(),1),Lt=Ae(Te(),1);function EGe(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]},pxe=.4,mxe=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"}),d5=()=>{let e=Lt.default.useContext(mxe);if(!e)throw new Error("useDrawerContext must be used within a Drawer.Root");return e};function Fi(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 qy(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 no=e=>{switch(e){case"top":case"bottom":return!0;case"left":case"right":return!1;default:return e}};function u5(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(", ")[no(t)?13:12]):(i=n.match(/^matrix\((.+)\)$/),i?parseFloat(i[1].split(", ")[no(t)?5:4]):null)}function kGe(e){return 8*(Math.log(e+1)-2)}EGe("[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 CGe(e,t){typeof e=="function"?e(t):e!=null&&(e.current=t)}function DGe(...e){return t=>e.forEach(r=>CGe(r,t))}function hxe(...e){return dxe.useCallback(DGe(...e),e)}var CC=null;function OGe({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 MGe=typeof window<"u"?Lt.useLayoutEffect:Lt.useEffect;function yG(...e){return(...t)=>{for(let r of e)typeof r=="function"&&r(...t)}}function jGe(){return xG(/^Mac/)}function NGe(){return xG(/^iPhone/)}function TGe(){return xG(/^iPad/)||jGe()&&navigator.maxTouchPoints>1}function Axe(){return NGe()||TGe()}function xG(e){return typeof window<"u"&&window.navigator!=null?e.test(window.navigator.platform):void 0}var AG=typeof document<"u"&&window.visualViewport;function uxe(e){let t=window.getComputedStyle(e);return/(auto|scroll)/.test(t.overflow+t.overflowX+t.overflowY)}function gxe(e){for(uxe(e)&&(e=e.parentElement);e&&!uxe(e);)e=e.parentElement;return e||document.scrollingElement||document.documentElement}var FGe=new Set(["checkbox","radio","range","color","file","image","button","submit","reset"]),c5=0,gG;function _Ge(e={}){let{isDisabled:t}=e;MGe(()=>{if(!t)return c5++,c5===1&&(Axe()?gG=IGe():gG=PGe()),()=>{c5--,c5===0&&gG()}},[t])}function PGe(){return yG(vxe(document.documentElement,"paddingRight",`${window.innerWidth-document.documentElement.clientWidth}px`))}function IGe(){let e,t=0,r=f=>{e=gxe(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;bG(d)&&d!==document.activeElement&&(f.preventDefault(),d.style.transform="translateY(-2000px)",d.focus(),requestAnimationFrame(()=>{d.style.transform=""}))},a=f=>{let d=f.target;bG(d)&&(d.style.transform="translateY(-2000px)",requestAnimationFrame(()=>{d.style.transform="",AG&&(AG.height{cxe(d)}):AG.addEventListener("resize",()=>cxe(d),{once:!0}))}))},o=()=>{window.scrollTo(0,0)},s=window.pageXOffset,l=window.pageYOffset,u=yG(vxe(document.documentElement,"paddingRight",`${window.innerWidth-document.documentElement.clientWidth}px`));window.scrollTo(0,0);let c=yG(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 vxe(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 cxe(e){let t=document.scrollingElement||document.documentElement;for(;e&&e!==t;){let r=gxe(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 bG(e){return e instanceof HTMLInputElement&&!FGe.has(e.type)||e instanceof HTMLTextAreaElement||e instanceof HTMLElement&&e.isContentEditable}function yxe(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 BGe({defaultProp:e,onChange:t}){let r=Lt.default.useState(e),[n]=r,i=Lt.default.useRef(n),a=yxe(t);return Lt.default.useEffect(()=>{i.current!==n&&(a(n),i.current=n)},[n,i,a]),r}function RGe({prop:e,defaultProp:t,onChange:r=()=>{}}){let[n,i]=BGe({defaultProp:t,onChange:r}),a=e!==void 0,o=a?e:n,s=yxe(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 $Ge({activeSnapPointProp:e,setActiveSnapPointProp:t,snapPoints:r,drawerRef:n,overlayRef:i,cacheRef:a,fadeFromIndex:o,onSnapPointChange:s,direction:l="bottom"}){let[u,c]=RGe({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)),no(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),Fi(a.current,n.current,{transition:`transform ${ii.DURATION}s cubic-bezier(${ii.EASE.join(",")})`,transform:no(l)?`translate3d(0, ${x}px, 0)`:`translate3d(${x}px, 0, 0)`}),h&&S!==h.length-1&&S!==o?Fi(a.current,i.current,{transition:`opacity ${ii.DURATION}s cubic-bezier(${ii.EASE.join(",")})`,opacity:"0"}):Fi(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&&Fi(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)pxe&&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]||Fi(a.current,n.current,{transform:no(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 qGe=.25,LGe=100,f5=8,Ly=16,fxe=26,vG="vaul-dragging";function bxe({open:e,onOpenChange:t,children:r,shouldScaleBackground:n,onDrag:i,onRelease:a,snapPoints:o,nested:s=!1,setBackgroundColorOnScale:l=!0,closeThreshold:u=qGe,scrollLockTimeout:c=LGe,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}=$Ge({snapPoints:o,cacheRef:ae,activeSnapPointProp:h,setActiveSnapPointProp:m,drawerRef:me,fadeFromIndex:p,overlayRef:Y,onSnapPointChange:ce,direction:x});_Ge({isDisabled:!j||I||!A||L||!C||S});let{restorePositionSetting:_e}=OGe({isOpen:j,modal:A,nested:s,hasBeenOpened:C,preventScrollRestoration:w,noBodyStyles:v});function he(){return(window.innerWidth-fxe)/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,Axe()&&window.addEventListener("touchend",()=>Ie.current=!1,{once:!0}),Ge.target.setPointerCapture(Ge.pointerId),Oe.current=no(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?u5(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-(no(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]"),Yt=at/ke.current,Wr=Ce(at,Pe);if(Wr!==null&&(Yt=Wr),De&&Yt>=1||!Ie.current&&!Ye(Ge.target,Pe))return;if(me.current.classList.add(vG),Ie.current=!0,Fi(ae.current,me.current,{transition:"none"}),Fi(ae.current,Y.current,{transition:"none"}),o&&re({draggedDistance:ue}),Pe&&!o){let tn=kGe(ue),ci=Math.min(tn*-1,0)*G;Fi(ae.current,me.current,{transform:no(x)?`translate3d(0, ${ci}px, 0)`:`translate3d(${ci}px, 0, 0)`});return}let en=1-Yt;if((Ee||p&&R===p-1)&&(i?.(Ge,Yt),Fi(ae.current,Y.current,{opacity:`${en}`,transition:"none"},!0)),ht&&Y.current&&n){let tn=Math.min(he()+Yt*(1-he()),1),ci=8-Yt*8,is=Math.max(0,14-Yt*14);document.querySelectorAll("[vaul-drawer]").forEach(Pa=>{Pa!==me.current&&Fi(ae.current,Pa,{borderRadius:`${ci}px`,transform:no(x)?`scale(${tn}) translate3d(0, ${is}px, 0)`:`scale(${tn}) translate3d(${is}px, 0, 0)`,transition:"none"},!0)}),Fi(ae.current,ht,{borderRadius:`${ci}px`,transform:no(x)?`scale(${tn}) translate3d(0, ${is}px, 0)`:`scale(${tn}) translate3d(${is}px, 0, 0)`,transition:"none"},!0)}if(!o){let tn=at*G;Fi(ae.current,me.current,{transform:no(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(bG(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 Yt=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-fxe),g?me.current.style.height=`${Wr-Math.max(at,0)}px`:me.current.style.height=`${Math.max(en,De-Yt)}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?.(),Fi(ae.current,me.current,{transform:no(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(",")})`}),Fi(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(()=>{qy(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=u5(me.current,x);Fi(ae.current,me.current,{transform:"translate3d(0, 0, 0)",transition:`transform ${ii.DURATION}s cubic-bezier(${ii.EASE.join(",")})`}),Fi(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&&Fi(ae.current,Pe,{borderRadius:`${f5}px`,overflow:"hidden",...no(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)}),Fi(ae.current,Ge,{borderRadius:`${f5}px`,overflow:"hidden",...no(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(vG),Ie.current=!1,T(!1),Q.current=new Date)}function Le(Ge){if(!I||!me.current)return;me.current.classList.remove(vG),Ie.current=!1,T(!1),Q.current=new Date;let G=u5(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-(no(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>pxe){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&&(Fi(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&&(Fi(ae.current,document.body,{background:document.body.style.backgroundColor||document.body.style.background}),Fi(ae.current,document.body,{background:"black"},!0)),document.querySelectorAll("[vaul-drawer]").forEach(Pe=>{Pe!==me.current&&Fi(ae.current,Pe,{borderRadius:`${f5}px`,overflow:"hidden",...no(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(",")})`})}),Fi(ae.current,G,{borderRadius:`${f5}px`,overflow:"hidden",...no(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&&(qy(ae.current,Pe,"overflow"),qy(ae.current,Pe,"transform"),qy(ae.current,Pe,"borderRadius"),Fi(ae.current,Pe,{transitionProperty:"transform, border-radius",transitionDuration:`${ii.DURATION}s`,transitionTimingFunction:`cubic-bezier(${ii.EASE.join(",")})`}))}),qy(ae.current,G,"overflow"),qy(ae.current,G,"transform"),qy(ae.current,G,"borderRadius"),Fi(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-Ly)/window.innerWidth:1,ue=Ge?-Ly:0;Se.current&&window.clearTimeout(Se.current),Fi(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=u5(me.current,x);Fi(ae.current,me.current,{transition:"none",transform:no(x)?`translate3d(0, ${Pe}px, 0)`:`translate3d(${Pe}px, 0, 0)`})},500))}function Qe(Ge,G){if(G<0)return;let ue=no(x)?window.innerHeight:window.innerWidth,Pe=(ue-Ly)/ue,De=Pe+G*(1-Pe),at=-Ly+G*Ly;Fi(ae.current,me.current,{transform:no(x)?`scale(${De}) translate3d(0, ${at}px, 0)`:`scale(${De}) translate3d(${at}px, 0, 0)`,transition:"none"})}function et(Ge,G){let ue=no(x)?window.innerHeight:window.innerWidth,Pe=G?(ue-Ly)/ue:1,De=G?-Ly:0;G&&Fi(ae.current,me.current,{transition:`transform ${ii.DURATION}s cubic-bezier(${ii.EASE.join(",")})`,transform:no(x)?`scale(${Pe}) translate3d(0, ${De}px, 0)`:`scale(${Pe}) translate3d(${De}px, 0, 0)`})}return Lt.default.createElement(txe,{modal:A,onOpenChange:Ge=>{if(e!==void 0){t?.(Ge);return}Ge?(N(!0),O(Ge)):Ct()},open:j},Lt.default.createElement(mxe.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 zGe=250,UGe=120,xxe=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}=d5(),h=Lt.default.useRef(null),m=Lt.default.useRef(!1);function g(){if(m.current){v();return}window.setTimeout(()=>{A()},UGe)}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},zGe)}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))});xxe.displayName="Drawer.Handle";var wxe=Lt.default.forwardRef(function({children:e,...t},r){let{overlayRef:n,snapPoints:i,onRelease:a,shouldFade:o,isOpen:s,visible:l}=d5(),u=hxe(r,n),c=i&&i.length>0;return Lt.default.createElement(ixe,{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})});wxe.displayName="Drawer.Overlay";var Sxe=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}=d5(),w=hxe(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(axe,{"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)}})});Sxe.displayName="Drawer.Content";function WGe({onDrag:e,onOpenChange:t,...r}){let{onNestedDrag:n,onNestedOpenChange:i,onNestedRelease:a}=d5();if(!n)throw new Error("Drawer.NestedRoot must be placed in another drawer");return Lt.default.createElement(bxe,{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 zy={Root:bxe,NestedRoot:WGe,Content:Sxe,Handle:xxe,Overlay:wxe,Trigger:rxe,Portal:nxe,Close:lxe,Title:oxe,Description:sxe};var p5=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(zy.Root,{open:r,onOpenChange:a=>{n(a)},shouldScaleBackground:!0,onClose:()=>{n(!1),e.hide(!0)},noBodyStyles:!0},$d.default.createElement(zy.Portal,null,$d.default.createElement(zy.Content,{className:(0,Exe.default)("mk-drawer-content",e.className),"data-drawer-index":i,style:{"--drawer-index":i}},$d.default.createElement(zy.Handle,{className:"mk-drawer-handle"}),$d.default.createElement(zy.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(zy.Overlay,{className:"mk-drawer-overlay",style:{"--drawer-index":i}})))};var HGe=e=>{let t=qw(Pp(RA,{activationConstraint:{distance:10}}),Pp($A,{activationConstraint:{delay:250,tolerance:5}}),Pp($0,{coordinateGetter:qN})),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:PN,measuring:{droppable:{strategy:_p.Always}}},qd.default.createElement("div",{className:`mk-menu-wrapper ${!jc(e.ui)||n?"mk-ready":""}`,ref:r},e.children))},m5=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(p5,{fc:e.fc,hide:u=>a(u),newProps:l,className:(0,kxe.default)("mk-drawer-menu",e.className)}));return}o.render(qd.default.createElement(HGe,{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=Lye(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 Cxe=Ae(Te());var Dxe=(e,t,r,n,i,a)=>m5({ui:t.ui,rect:e,anchor:n,win:r,fc:Cxe.default.createElement(wG,{...t}),onHide:i,className:t.searchable?"mk-combo-menu":"mk-select-menu",force:a});var Df=Ae(Te());var Oxe=(e,t,r,n,i,a)=>{e.ui.openModal(t,Df.default.createElement(_i,{value:r,saveValue:n,saveLabel:i}),a)},_i=e=>{let[t,r]=(0,Df.useState)(e.value),n=()=>{e.saveValue(t),e.hide&&e.hide()},i=(0,Df.useRef)(null);return(0,Df.useEffect)(()=>{i?.current&&i.current.focus()},[i]),Df.default.createElement("div",{className:"mk-layout-column mk-gap-8"},Df.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()}}),Df.default.createElement("div",{className:"mk-modal-actions"},Df.default.createElement("button",{onClick:()=>n()},e.saveLabel),Df.default.createElement("button",{onClick:()=>e.hide&&e.hide()},W.buttons.cancel)))};var Mxe=Ae(bi());var jxe=Ae(Te());var h5=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 Uy=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 a0;this.activeState={};this.adapters=[];this.adapters=r??[],t.manager=this,this.mainFrame=t,this.inputManager=new h5}quickOpen(t,r,n,i){this.mainFrame.quickOpen(t,r,n,i)}availableViews(){return this.mainFrame.availableViews()}defaultAdd(t,r,n){if(t?.path==Kg)this.openModal("New Tag",jxe.default.createElement(_i,{value:"",saveLabel:W.labels.saveView,saveValue:i=>fC(this.superstate,i)}),r);else if(t)if(t?.metadata.template?.length>0){mC(this.superstate,t,t.metadata.template,n);return}else Ji(this.superstate,t,"md",null,!1,null,n);else uv(this.superstate,this.superstate.pathsIndex.get(this.superstate.ui.activePath)).then(i=>{i&&Ji(this.superstate,i,"md",null,!1,null,n)})}setActiveState(t){Mxe.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 Uy(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 Dxe(t,r,n,i,a,o)}openCustomMenu(t,r,n,i,a="right",o,s,l){return m5({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 qye[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)}hasNativePathMenu(t){return this.mainFrame.hasNativePathMenu(t)}nativePathMenu(t,r){this.mainFrame.nativePathMenu(t,r)}};var Mf=Ae(Te());function JA(e){return Array.isArray?Array.isArray(e):Rxe(e)==="[object Array]"}var VGe=1/0;function GGe(e){if(typeof e=="string")return e;let t=e+"";return t=="0"&&1/e==-VGe?"-0":t}function QGe(e){return e==null?"":GGe(e)}function ah(e){return typeof e=="string"}function Ixe(e){return typeof e=="number"}function YGe(e){return e===!0||e===!1||ZGe(e)&&Rxe(e)=="[object Boolean]"}function Bxe(e){return typeof e=="object"}function ZGe(e){return Bxe(e)&&e!==null}function Of(e){return e!=null}function SG(e){return!e.trim().length}function Rxe(e){return e==null?e===void 0?"[object Undefined]":"[object Null]":Object.prototype.toString.call(e)}var XGe="Incorrect 'index' type",KGe=e=>`Invalid value for key ${e}`,JGe=e=>`Pattern length exceeds max of ${e}.`,eQe=e=>`Missing ${e} property in key`,tQe=e=>`Property 'weight' in key '${e}' must be a positive integer`,Nxe=Object.prototype.hasOwnProperty,EG=class{constructor(t){this._keys=[],this._keyMap={};let r=0;t.forEach(n=>{let i=$xe(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 $xe(e){let t=null,r=null,n=null,i=1,a=null;if(ah(e)||JA(e))n=e,t=Txe(e),r=kG(e);else{if(!Nxe.call(e,"name"))throw new Error(eQe("name"));let o=e.name;if(n=o,Nxe.call(e,"weight")&&(i=e.weight,i<=0))throw new Error(tQe(o));t=Txe(o),r=kG(o),a=e.getFn}return{path:t,id:r,weight:i,src:n,getFn:a}}function Txe(e){return JA(e)?e:e.split(".")}function kG(e){return JA(e)?e.join("."):e}function rQe(e,t){let r=[],n=!1,i=(a,o,s)=>{if(!!Of(a))if(!o[s])r.push(a);else{let l=o[s],u=a[l];if(!Of(u))return;if(s===o.length-1&&(ah(u)||Ixe(u)||YGe(u)))r.push(QGe(u));else if(JA(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(!!Of(o)){if(JA(o)){let s=[],l=[{nestedArrIndex:-1,value:o}];for(;l.length;){let{nestedArrIndex:u,value:c}=l.pop();if(!!Of(c))if(ah(c)&&!SG(c)){let f={v:c,i:u,n:this.norm.get(c)};s.push(f)}else JA(c)&&c.forEach((f,d)=>{l.push({nestedArrIndex:d,value:f})})}n.$[a]=s}else if(ah(o)&&!SG(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 qxe(e,t,{getFn:r=zr.getFn,fieldNormWeight:n=zr.fieldNormWeight}={}){let i=new OC({getFn:r,fieldNormWeight:n});return i.setKeys(e.map($xe)),i.setSources(t),i.create(),i}function uQe(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 A5(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 cQe(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 Wy=32;function fQe(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>Wy)throw new Error(JGe(Wy));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=A5(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=A5(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(A5(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=cQe(g,s);k.length?l&&(S.indices=k):S.isMatch=!1}return S}function dQe(e){let t={};for(let r=0,n=e.length;r{this.chunks.push({pattern:d,alphabet:dQe(d),startIndex:p})},f=this.pattern.length;if(f>Wy){let d=0,p=f%Wy,h=f-p;for(;d{let{isMatch:A,score:b,indices:v}=fQe(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 Fxe(t,this.multiRegex)}static isSingleMatch(t){return Fxe(t,this.singleRegex)}search(){}};function Fxe(e,t){let r=e.match(t);return r?r[1]:null}var CG=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]}}},DG=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]}}},OG=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]}}},MG=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]}}},jG=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]}}},NG=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]}}},v5=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 g5(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)}},y5=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}}},TG=[CG,y5,OG,MG,NG,jG,DG,v5],_xe=TG.length,pQe=/ +(?=(?:[^\"]*\"[^\"]*\")*[^\"]*$)/,mQe="|";function hQe(e,t={}){return e.split(mQe).map(r=>{let n=r.trim().split(pQe).filter(a=>a&&!!a.trim()),i=[];for(let a=0,o=n.length;a!!(e[b5.AND]||e[b5.OR]),vQe=e=>!!e[IG.PATH],yQe=e=>!JA(e)&&Bxe(e)&&!BG(e),Pxe=e=>({[b5.AND]:Object.keys(e).map(t=>({[t]:e[t]}))});function Lxe(e,t,{auto:r=!0}={}){let n=i=>{let a=Object.keys(i),o=vQe(i);if(!o&&a.length>1&&!BG(i))return n(Pxe(i));if(yQe(i)){let l=o?i[IG.PATH]:a[0],u=o?i[IG.PATTERN]:i[l];if(!ah(u))throw new Error(KGe(l));let c={keyId:kG(l),pattern:u};return r&&(c.searcher=PG(u,t)),c}let s={children:[],operator:a[0]};return a.forEach(l=>{let u=i[l];JA(u)&&u.forEach(c=>{s.children.push(n(c))})}),s};return BG(e)||(e=Pxe(e)),n(e)}function bQe(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 xQe(e,t){let r=e.matches;t.matches=[],Of(r)&&r.forEach(n=>{if(!Of(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 wQe(e,t){t.score=e.score}function SQe(e,t,{includeMatches:r=zr.includeMatches,includeScore:n=zr.includeScore}={}){let i=[];return r&&i.push(xQe),n&&i.push(wQe),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 EG(this.options.keys),this.setCollection(t,n)}setCollection(t,r){if(this._docs=t,r&&!(r instanceof OC))throw new Error(XGe);this._myIndex=r||qxe(this.options.keys,this._docs,{getFn:this.options.getFn,fieldNormWeight:this.options.fieldNormWeight})}add(t){!Of(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)),SQe(l,this._docs,{includeMatches:n,includeScore:i})}_searchStringList(t){let r=PG(t,this.options),{records:n}=this._myIndex,i=[];return n.forEach(({v:a,i:o,n:s})=>{if(!Of(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=Lxe(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(Of(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=PG(t,this.options),{keys:n,records:i}=this._myIndex,a=[];return i.forEach(({$:o,i:s})=>{if(!Of(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(!Of(r))return[];let i=[];if(JA(r))r.forEach(({v:a,i:o,n:s})=>{if(!Of(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=qxe;Gp.parseIndex=uQe;Gp.config=zr;Gp.parseQuery=Lxe;gQe(FG);var ki=Ae(Te());var kl=Ae(Te()),EQe={position:"absolute",width:0,height:0,visibility:"hidden",overflow:"scroll",whiteSpace:"pre"},kQe=["fontSize","fontFamily","fontWeight","fontStyle","letterSpacing","textTransform"],zxe=(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);kQe.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:EQe},e.query||u),kl.default.createElement("span",null)))}),Uxe=zxe;zxe.displayName="SelectMenuSearch";var RG=Ae(Te()),CQe=e=>RG.default.createElement("button",{type:"button",className:e.classNames.selectedTag,onClick:e.onDelete},RG.default.createElement("span",{className:e.classNames.selectedTagName},e.tag.name)),Wxe=CQe;var Hxe=Ae(Te()),Vxe=e=>Hxe.default.createElement("div",{className:"mk-sticker",dangerouslySetInnerHTML:{__html:e.ui.getSticker(e.sticker)}});var mi=Ae(Te());function Gxe(e){return e.replace(/[-\\^$*+?.()|[\]{}]/g,"\\$&")}function r2(e){return new RegExp(Gxe(e),"gi")}function Qxe(e){return new RegExp(`^${Gxe(e)}$`,"i")}function Yxe(e,t){let r=r2(t);return e?.replace(r,"$&")}var DQe=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(Vxe,{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?Yxe(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:Yxe(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")}}))},OQe=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)})},MQe=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(OQe,{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(DQe,{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)))},Zxe=MQe;function Xxe(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 Hy={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"},Jxe={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"},jQe={ui:null,id:"SelectMenu",tags:[],hide:()=>null,onHide:()=>null,suggestionsOnly:!1,placeholderText:W.labels.optionItemSelectPlaceholder,noSuggestionsText:null,newTagText:null,suggestions:[],suggestionsFilter:NQe,suggestionsTransform:null,classNames:Jxe,delimiters:[Hy.ENTER],minQueryLength:2,maxSuggestionsLength:8,inputAttributes:{}},ewe=(e,t)=>e.findIndex(r=>Qxe(t).test(r.name)),Kxe=(e,t,r,n,i,a)=>{if(t.length>=e.minQueryLength){let o=ewe(n,t),s=r===-1?o:r,l=s>-1?n[s]:null;i(l||{name:t,value:t},a)}};function NQe(e,t){return r2(t).test(e.name)}function TQe(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&&ewe(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 twe=ki.default.forwardRef((e,t)=>{let r={...jQe,...e},[n,i]=(0,ki.useState)([]),a=(0,ki.useRef)([]),o=(0,ki.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,ki.useRef)(null),[l,u]=(0,ki.useState)(""),[c,f]=(0,ki.useState)(""),[d,p]=(0,ki.useState)(!1),[h,m]=(0,ki.useState)(0),g=(0,ki.useRef)(!1);(0,ki.useEffect)(()=>{t&&(t.current=()=>d?!0:(s?.current?.focus(),p(!0),!1))},[d]),(0,ki.useEffect)(()=>{if(c.length==0&&r.defaultSuggestions){i(r.defaultSuggestions);return}i(TQe(r,c,l))},[c,r.defaultSuggestions,l,r.suggestions]);let A=(0,ki.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?Kxe(r,c,h,n,k,{}):Q!==c&&f(Q)},v=te=>{g.current||(r.delimiters.indexOf(te.key)>-1&&((c||h>-1)&&te.preventDefault(),Kxe(r,c,h,n,k,{ctrlKey:te.ctrlKey,metaKey:te.metaKey,altKey:te.altKey,shiftKey:te.shiftKey})),te.key!="Escape"&&(te.key===Hy.TAB&&q(te),te.key===Hy.BACKSPACE&&P(),(te.key===Hy.UP_ARROW||te.key===Hy.UP_ARROW_COMPAT)&&N(te),(te.key===Hy.DOWN_ARROW||te.key===Hy.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&&Xxe(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,ki.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({},Jxe,r.classNames);r.wrapperClass&&(L.root=`${L.root} ${r.wrapperClass}`);let _=[L.root];d&&_.push(L.rootFocused);let Y=(0,ki.useRef)(null),oe=te=>{Y.current&&Y.current.hide(!0),Y.current=te};return ki.default.createElement("div",{ref:A,className:_.join(" "),style:r.suggestionsOnly?{}:{"--mk-menu-max-height":"200px"}},r.suggestionsOnly?null:ki.default.createElement("div",{className:L.selected,"aria-relevant":"additions removals","aria-live":"polite"},r.tags.length>0&&ki.default.createElement("div",{className:L.selectedTagWrapper},r.tags.map((te,Q)=>ki.default.createElement(Wxe,{key:Q,tag:te,classNames:L,onDelete:fe=>S(Q,fe)}))),ki.default.createElement(Uxe,{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?ki.default.createElement("div",{className:"mk-menu-sections"},o.map((te,Q)=>ki.default.createElement("div",{key:Q,onClick:fe=>{fe.stopPropagation(),u(te.value)},className:`${l==te.value?"is-active":""} mk-menu-section`},te.name==""?W.labels.all:te.name))):ki.default.createElement(ki.default.Fragment,null),n.length||r.allowNew?ki.default.createElement(Zxe,{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)});twe.displayName="SelectMenuComponent";var rwe=twe;var nwe=Mf.default.forwardRef((e,t)=>{let r=e.options.map((f,d)=>({...f,id:d+1}));(0,Mf.useEffect)(()=>{i(e.options.map((f,d)=>({...f,id:d+1})))},[e.options]);let[n,i]=(0,Mf.useState)(r),[a,o]=(0,Mf.useState)(e.value.map(f=>r.find(d=>d.value==f)??{id:0,name:f,value:f})),s=(0,Mf.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,Mf.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,Mf.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,Mf.useCallback)(f=>!(!e.editable&&!n.find(d=>d.value==f.value)||f.name.length==0),[n]);return Mf.default.createElement(rwe,{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})});nwe.displayName="SelectMenu";var wG=nwe;var Xo=Ae(Te());var sh=Ae(Te());function mv(){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}),Ys=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=>{fv(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:mv(),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 hv=(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)"}},W.labels.notePlaceholder.replace("${1}",rf(e.path))):Cl.default.createElement(Cl.default.Fragment,null))});hv.displayName="FlowView";var Ne=e=>e.defaultView||window;var uh=(e,t)=>({name:"",type:2,value:e,onValueChange:t});var qt={name:"",type:-1,disabled:!0},Zt=(e,t)=>({ui:e,multi:!1,value:[],editable:!1,options:t,searchable:!1,showAll:!0});var iwe=(e,t,r,n,i,a,o,s)=>{let l=[];l.push(uh(n?.name??"",u=>o(n.name,u))),l.push(qt),l.push({name:W.menu.changePropertyType,icon:"ui//list",onClick:u=>{s(u,n.name)}}),n.type!="object"&&l.push({name:W.menu.syncToContext,icon:"ui//sync",onClick:u=>{a(n)}}),l.push({name:W.menu.deleteProperty,icon:"ui//trash",onClick:u=>{i(n)}}),e.ui.openMenu(t,Zt(e.ui,l),r)};var io=Ae(Te());var Vy={view:"list",filters:[],listView:"",listItem:"",listGroup:"",listGroupProps:{},listViewProps:{},listItemProps:{},sort:[],groupBy:[],colsOrder:[],colsHidden:[],colsSize:{},colsCalc:{}};var Aa=(0,io.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}),Av=e=>{let[t,r]=(0,io.useState)([]),[n,i]=(0,io.useState)([]),[a,o]=(0,io.useState)(null),s=(0,io.useMemo)(()=>(a?.rows??[]).map(N=>Ao(N))??[],[a]),l=s.filter(N=>N.type=="frame"),[u,c]=(0,io.useState)(null),[f,d]=(0,io.useState)(null),p=(0,io.useMemo)(()=>u?.[f?.id],[u,f]),{spaceInfo:h,readMode:m}=(0,io.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?wp(N):q)}:{...a,rows:[...a.rows,wp(N)]};h.readOnly||await e.superstate.spaceManager.saveFrameSchema(h.path,N.id,()=>wp(N)),N.id==f?.id&&(d(N),c(q=>({...q,[N.id]:{...q[N.id],schema:wp(N)}}))),o(P)};(0,io.useEffect)(()=>{a&&x().then(N=>{N&&Object.keys(N).length>0&&c(N)})},[a]),(0,io.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:ji(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:ji(e.contextSchema,a?.rows.map(D=>D.id)??[]),name:"Table",type:"view",predicate:JSON.stringify({...Vy,view:"table"}),def:JSON.stringify({db:e.contextSchema,icon:"ui//table"})}):Ao(bp);return N})},[a,e.contextSchema,e.schema]);let b=(0,io.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,io.useCallback)(async N=>{if(N.path==h.path){b();return}},[h,b]);(0,io.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,io.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:XA(N.name)},q=p;if(P.name=="")return e.superstate.ui.notify(W.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(W.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 io.default.createElement(Aa.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 Ss=Ae(Te());var FQe={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"}]}}},awe={name:"repeat",type:"object",value:JSON.stringify({typeName:"Repeat",type:FQe})};var owe=(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]??[],bA(i[a],a)]})}return Object.keys(r).reduce((n,i)=>[...n,{name:i,type:r[i][0]}],[])};var Kr=Ae(Te());var _Qe=0,MC=class{constructor(t,r){this.from=t,this.to=r}},wn=class{constructor(t={}){this.id=_Qe++,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 n2=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]}},PQe=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):PQe,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 i2=class{constructor(t){this.types=t;for(let r=0;r0;for(let l=this.cursor(o|Zs.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:WG(Dl.none,this.children,this.positions,0,this.children.length,0,this.length,(r,n,i)=>new ga(this.type,r,n,i,this.propValues),t.makeTree||((r,n,i)=>new ga(Dl.none,r,n,i)))}static build(t){return BQe(t)}};ga.empty=new ga(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(!!cwe(i,n,f,f+c.length)){if(c instanceof fh){if(a&Zs.ExcludeBuffers)continue;let d=c.findChild(0,c.buffer.length,r,n-f,i);if(d>-1)return new ch(new qG(o,c,t,f),null,d)}else if(a&Zs.IncludeAnonymous||!c.type.isAnonymous||UG(c)){let d;if(!(a&Zs.IgnoreMounts)&&(d=n2.get(c))&&!d.overlay)return new Tc(d.tree,f,t,o);let p=new Tc(c,f,t,o);return a&Zs.IncludeAnonymous||!p.type.isAnonymous?p:p.nextChild(r<0?c.children.length-1:0,r,n,i)}}}if(a&Zs.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&Zs.IgnoreOverlays)&&(i=n2.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 lwe(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 $G(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 qG=class{constructor(t,r,n,i){this.parent=t,this.buffer=r,this.index=n,this.start=i}},ch=class extends S5{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&Zs.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 ga(this.type,t,r,this.to-this.from)}toString(){return this.context.buffer.childString(this.index)}};function fwe(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?fwe(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&Zs.ExcludeBuffers?!1:this.enterChild(1,t,r):this.yield(this._tree.enter(t,r,n))}parent(){if(!this.buffer)return this.yieldNode(this.mode&Zs.IncludeAnonymous?this._tree._parent:this._tree.parent);if(this.stack.length)return this.yieldBuf(this.stack.pop());let t=this.mode&Zs.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&Zs.IncludeAnonymous||s instanceof fh||!s.type.isAnonymous||UG(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 $G(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 UG(e){return e.children.some(t=>t instanceof fh||!t.type.isAnonymous||UG(t))}function BQe(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=WG(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 ga){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 ga(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 ga(l[e.topID],b.reverse(),v.reverse(),x)}var uwe=new WeakMap;function w5(e,t){if(!e.isAnonymous||t instanceof fh||t.type!=e)return 1;let r=uwe.get(t);if(r==null){r=1;for(let n of t.children){if(n.type!=e||!(n instanceof ga)){r=1;break}r+=w5(e,n)}uwe.set(t,r)}return r}function WG(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(WG(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}}},zG=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 BKt=new wn({perNode:!0});var Sn=require("@codemirror/state"),on=require("@codemirror/view");var RQe=0,Ud=class{constructor(t,r,n){this.set=t,this.base=r,this.modified=n,this.id=RQe++}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 a2;return r=>r.modified.indexOf(t)>-1?r:a2.get(r.base||r,r.modified.concat(t).sort((n,i)=>n.id-i.id))}},$Qe=0,a2=class{constructor(){this.instances=[],this.id=$Qe++}static get(t,r){if(!r.length)return t;let n=r[0].instances.find(s=>s.base==t&&qQe(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=LQe(r);for(let s of t.set)if(!s.modified.length)for(let l of o)i.push(a2.get(s,l));return a}};function qQe(e,t){return e.length==t.length&&e.every((r,n)=>r==t[n])}function LQe(e){let t=[[]];for(let r=0;rn.length-r.length)}function mwe(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 o2(n,o,l>0?a.slice(0,l):null);t[u]=c.sort(t[u])}}return hwe.add(t)}var hwe=new wn,o2=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 zQe(e,t){let r=null;for(let n of e){let i=n.style(t);i&&(r=r?r+" "+i:i)}return r}function Awe(e,t,r,n=0,i=e.length){let a=new VG(n,Array.isArray(t)?t:[t],r);a.highlightRange(e.cursor(),n,i,"",a.highlighters),a.flush(i)}var VG=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=UQe(t)||o2.empty,f=zQe(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 UQe(e){let t=e.type.prop(hwe);for(;t&&t.context&&!e.matchContext(t.context);)t=t.next;return t||null}var Nt=Ud.define,E5=Nt(),gv=Nt(),dwe=Nt(gv),pwe=Nt(gv),vv=Nt(),k5=Nt(vv),HG=Nt(vv),hh=Nt(),Gy=Nt(hh),ph=Nt(),mh=Nt(),GG=Nt(),_C=Nt(GG),C5=Nt(),qe={comment:E5,lineComment:Nt(E5),blockComment:Nt(E5),docComment:Nt(E5),name:gv,variableName:Nt(gv),typeName:dwe,tagName:Nt(dwe),propertyName:pwe,attributeName:Nt(pwe),className:Nt(gv),labelName:Nt(gv),namespace:Nt(gv),macroName:Nt(gv),literal:vv,string:k5,docString:Nt(k5),character:Nt(k5),attributeValue:Nt(k5),number:HG,integer:Nt(HG),float:Nt(HG),bool:Nt(vv),regexp:Nt(vv),escape:Nt(vv),color:Nt(vv),url:Nt(vv),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:GG,separator:Nt(GG),bracket:_C,angleBracket:Nt(_C),squareBracket:Nt(_C),paren:Nt(_C),brace:Nt(_C),content:hh,heading:Gy,heading1:Nt(Gy),heading2:Nt(Gy),heading3:Nt(Gy),heading4:Nt(Gy),heading5:Nt(Gy),heading6:Nt(Gy),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:C5,documentMeta:Nt(C5),annotation:Nt(C5),processingInstruction:Nt(C5),definition:Ud.defineModifier(),constant:Ud.defineModifier(),function:Ud.defineModifier(),standard:Ud.defineModifier(),local:Ud.defineModifier(),special:Ud.defineModifier()},qKt=QG([{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 YG="\u037C",gwe=typeof Symbol>"u"?"__"+YG:Symbol.for(YG),ZG=typeof Symbol>"u"?"__styleSet"+Math.floor(Math.random()*1e8):Symbol("styleSet"),vwe=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=vwe[gwe]||1;return vwe[gwe]=t+1,YG+t.toString(36)}static mount(t,r,n){let i=t[ZG],a=n&&n.nonce;i?a&&i.setNonce(a):i=new XG(t,a),i.mount(Array.isArray(r)?r:[r],t)}},ywe=new Map,XG=class{constructor(t,r){let n=t.ownerDocument||t,i=n.defaultView;if(!t.head&&t.adoptedStyleSheets&&i.CSSStyleSheet){let a=ywe.get(n);if(a)return t[ZG]=a;this.sheet=new i.CSSStyleSheet,ywe.set(n,this)}else this.styleTag=n.createElement("style"),r&&this.styleTag.setAttribute("nonce",r);this.modules=[],t[ZG]=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 HQe=new wn,jf=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 Xs(this)}}),this.parser=r,this.extension=[xv.of(this),Sn.EditorState.languageData.of((a,o,s)=>{let l=bwe(a,o,s),u=l.type.prop(s2);if(!u)return[];let c=a.facet(u),f=l.type.prop(HQe);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 bwe(t,r,n).type.prop(s2)==this.data}findRegions(t){let r=t.facet(xv);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(s2)==this.data){n.push({from:o,to:o+a.length});return}let s=a.prop(wn.mounted);if(s){if(s.tree.prop(s2)==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,yv=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 yv(t,r,[],ga.empty,0,n,[],null)}startParse(){return this.parser.startParse(new rQ(this.state.doc),this.fragments)}work(t,r){return r!=null&&r>=this.state.doc.length&&(r=void 0),this.tree!=ga.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=xwe(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=ga.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=xwe(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 ga(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 xwe(e,t,r){return dh.applyChanges(e,[{fromA:t,toA:r,fromB:t,toB:r}])}var bv=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 bv(r)}static init(t){let r=Math.min(3e3,t.doc.length),n=yv.create(t.facet(xv).parser,t,{from:0,to:r});return n.work(20,r)||n.takeTree(),new bv(n)}};jf.state=Sn.StateField.define({create:bv.init,update(e,t){for(let r of t.effects)if(r.is(jf.setState))return r.value;return t.startState.facet(xv)!=t.state.facet(xv)?bv.init(t.state):e.apply(t)}});var Dwe=e=>{let t=setTimeout(()=>e(),500);return()=>clearTimeout(t)};typeof requestIdleCallback<"u"&&(Dwe=e=>{let t=-1,r=setTimeout(()=>{t=requestIdleCallback(e,{timeout:500-100})},100);return()=>t<0?clearTimeout(r):cancelIdleCallback(t)});var JG=typeof navigator<"u"&&((KG=navigator.scheduling)===null||KG===void 0?void 0:KG.isInputPending)?()=>navigator.scheduling.isInputPending():null,VQe=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(jf.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(jf.state);(r.tree!=r.context.tree||!r.context.isDone(t.doc.length))&&(this.working=Dwe(this.work))}work(t){this.working=null;let r=Date.now();if(this.chunkEndi+1e3,l=a.context.work(()=>JG&&JG()||Date.now()>o,i+(s?0:1e5));this.chunkBudget-=Date.now()-r,(l||this.chunkBudget<=0)&&(a.context.takeTree(),this.view.dispatch({effects:jf.setState.of(new bv(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()}}}),xv=Sn.Facet.define({combine(e){return e.length?e[0]:null},enables:e=>[jf.state,VQe,on.EditorView.contentAttributes.compute([e],t=>{let r=t.facet(e);return r&&r.name?{"data-language":r.name}:{}})]});var Owe=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 O5(e){let t=e.facet($C);return t.charCodeAt(0)==9?e.tabSize*t.length:t.length}function GQe(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?ZQe(e,r,t):null}var M5=class{constructor(t,r={}){this.state=t,this.options=r,this.unit=O5(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}},YQe=new wn;function ZQe(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 Mwe(n,e,r)}function Mwe(e,t,r){for(let n=e;n;n=n.next){let i=KQe(n.node);if(i)return i(BC.create(t,r,n))}return 0}function XQe(e){return e.pos==e.options.simulateBreak&&e.options.simulateDoubleBreak}function KQe(e){let t=e.type.prop(YQe);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=>rYe(o,!0,1,void 0,a&&!XQe(o)?i.from:void 0)}return e.parent==null?JQe:null}function JQe(){return 0}var BC=class extends M5{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(eYe(n,t))break;r=this.state.doc.lineAt(n.from)}return this.lineIndent(r.from)}continue(){return Mwe(this.context.next,this.base,this.pos)}};function eYe(e,t){for(let r=t;r;r=r.parent)if(e==r)return!0;return!1}function tYe(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+nYe)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=QQe(o,c.from);if(f==null)continue;let d=/^\s*/.exec(c.text)[0],p=GQe(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 iYe=Sn.Facet.define(),aYe=new wn;function oYe(e,t,r){let n=Xs(e);if(n.lengthr)continue;if(a&&s.from=t&&u.to>r&&(a=u)}}return a}function sYe(e){let t=e.lastChild;return t&&t.to==e.to&&t.type.isError}function j5(e,t,r){for(let n of e.facet(iYe)){let i=n(e,t,r);if(i)return i}return oYe(e,t,r)}function Nwe(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 _5=Sn.StateEffect.define({map:Nwe}),qC=Sn.StateEffect.define({map:Nwe});function Twe(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 Qy=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(_5)&&!lYe(e,r.value.from,r.value.to)){let{preparePlaceholder:n}=t.state.facet(uQ),i=n?on.Decoration.replace({widget:new nQ(n(t.state,r.value))}):wwe;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 lYe(e,t,r){let n=!1;return e.between(t,t,(i,a)=>{i==t&&a==r&&(n=!0)}),n}function Fwe(e,t){return e.field(Qy,!1)?t:t.concat(Sn.StateEffect.appendConfig.of(Iwe()))}var uYe=e=>{for(let t of Twe(e)){let r=j5(e.state,t.from,t.to);if(r)return e.dispatch({effects:Fwe(e.state,[_5.of(r),_we(e,r)])}),!0}return!1},cYe=e=>{if(!e.state.field(Qy,!1))return!1;let t=[];for(let r of Twe(e)){let n=N5(e.state,r.from,r.to);n&&t.push(qC.of(n),_we(e,n,!1))}return t.length&&e.dispatch({effects:t}),t.length>0};function _we(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 fYe=e=>{let{state:t}=e,r=[];for(let n=0;n{let t=e.state.field(Qy,!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 Pwe=[{key:"Ctrl-Shift-[",mac:"Cmd-Alt-[",run:uYe},{key:"Ctrl-Shift-]",mac:"Cmd-Alt-]",run:cYe},{key:"Ctrl-Alt-[",run:fYe},{key:"Ctrl-Alt-]",run:dYe}],pYe={placeholderDOM:null,preparePlaceholder:null,placeholderText:"\u2026"},uQ=Sn.Facet.define({combine(e){return(0,Sn.combineConfig)(e,pYe)}});function Iwe(e){let t=[Qy,hYe];return e&&t.push(uQ.of(e)),t}function Bwe(e,t){let{state:r}=e,n=r.facet(uQ),i=o=>{let s=e.lineBlockAt(e.posAtDOM(o.target)),l=N5(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 wwe=on.Decoration.replace({widget:new class extends on.WidgetType{toDOM(e){return Bwe(e,null)}}}),nQ=class extends on.WidgetType{constructor(t){super(),this.value=t}eq(t){return this.value==t.value}toDOM(t){return Bwe(t,this.value)}},mYe={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 Rwe(e={}){let t=Object.assign(Object.assign({},mYe),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(xv)!=o.state.facet(xv)||o.startState.field(Qy,!1)!=o.state.field(Qy,!1)||Xs(o.startState)!=Xs(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=N5(o.state,l.from,l.to)?n:j5(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=N5(o.state,s.from,s.to);if(u)return o.dispatch({effects:qC.of(u)}),!0;let c=j5(o.state,s.from,s.to);return c?(o.dispatch({effects:_5.of(c)}),!0):!1}})}),Iwe()]}var hYe=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 jf?s=>s.prop(s2)==o.data:o?s=>s==o:void 0,this.style=QG(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||{})}},iQ=Sn.Facet.define(),$we=Sn.Facet.define({combine(e){return e.length?[e[0]]:null}});function eQ(e){let t=e.facet(iQ);return t.length?t:e.facet($we)}function eg(e,t){let r=[AYe],n;return e instanceof Wd&&(e.module&&r.push(on.EditorView.styleModule.of(e.module)),n=e.themeType),t?.fallback?r.push($we.of(e)):n?r.push(iQ.computeN([on.EditorView.darkTheme],i=>i.facet(on.EditorView.darkTheme)==(n=="dark")?[e]:[])):r.push(iQ.of(e)),r}var aQ=class{constructor(t){this.markCache=Object.create(null),this.tree=Xs(t.state),this.decorations=this.buildDeco(t,eQ(t.state)),this.decoratedTo=t.viewport.to}update(t){let r=Xs(t.state),n=eQ(t.state),i=n!=eQ(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)Awe(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()}},AYe=Sn.Prec.high(on.ViewPlugin.fromClass(aQ,{decorations:e=>e.decorations})),cQ=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"}]),gYe=on.EditorView.baseTheme({"&.cm-focused .cm-matchingBracket":{backgroundColor:"#328c8252"},"&.cm-focused .cm-nonmatchingBracket":{backgroundColor:"#bb555544"}}),qwe=1e4,Lwe="()[]{}",zwe=Sn.Facet.define({combine(e){return(0,Sn.combineConfig)(e,{afterCursor:!0,brackets:Lwe,maxScanDistance:qwe,renderMatch:bYe})}}),vYe=on.Decoration.mark({class:"cm-matchingBracket"}),yYe=on.Decoration.mark({class:"cm-nonmatchingBracket"});function bYe(e){let t=[],r=e.matched?vYe:yYe;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 xYe=Sn.StateField.define({create(){return on.Decoration.none},update(e,t){if(!t.docChanged&&!t.selection)return e;let r=[],n=t.state.facet(zwe);for(let i of t.state.selection.ranges){if(!i.empty)continue;let a=D5(t.state,i.head,-1,n)||i.head>0&&D5(t.state,i.head-1,1,n)||n.afterCursor&&(D5(t.state,i.head,1,n)||i.headon.EditorView.decorations.from(e)}),wYe=[xYe,gYe];function Uwe(e={}){return[zwe.of(e),wYe]}var SYe=new wn;function oQ(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 sQ(e){let t=e.type.prop(SYe);return t?t(e.node):e}function D5(e,t,r,n={}){let i=n.maxScanDistance||qwe,a=n.brackets||Lwe,o=Xs(e),s=o.resolveInner(t,r);for(let l=s;l;l=l.parent){let u=oQ(l.type,r,a);if(u&&l.from0?t>=c.from&&tc.from&&t<=c.to))return EYe(e,t,r,l,c,u,a)}}return kYe(e,t,r,o,s.type,i,a)}function EYe(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 Swe(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 CYe(e){return{name:e.name||"",token:e.token,blankLine:e.blankLine||(()=>{}),startState:e.startState||(()=>!0),copyState:e.copyState||DYe,indent:e.indent||(()=>null),languageData:e.languageData||{},tokenTable:e.tokenTable||dQ}}function DYe(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 Ewe=new WeakMap,l2=class extends jf{constructor(t){let r=WQe(t.languageData),n=CYe(t),i,a=new class extends FC{createParse(o,s,l){return new lQ(i,o,s,l)}};super(r,a,[Owe.of((o,s)=>this.getIndent(o,s))],t.name),this.topNode=NYe(r),i=this,this.streamParser=n,this.stateAfter=new wn({perNode:!0}),this.tokenTable=t.tokenTable?new F5(n.tokenTable):jYe}static define(t){return new l2(t)}getIndent(t,r){let n=Xs(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=Ewe.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 ga&&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&&fQ(e,i.tree,0-i.offset,r,o),l;if(s&&(l=Wwe(e,i.tree,r+i.offset,s.pos+i.offset,!1)))return{state:s.state,tree:l}}return{state:e.streamParser.startState(n?O5(n):4),tree:ga.empty}}var lQ=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=yv.get(),o=i[0].from,{state:s,tree:l}=OYe(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==` +For more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return ha.useEffect(()=>{e&&(document.getElementById(e)||console.error(r))},[r,e]),null},SGe="DialogDescriptionWarning",EGe=({contentRef:e,descriptionId:t})=>{let n=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${exe(SGe).contentName}}.`;return ha.useEffect(()=>{let i=e.current?.getAttribute("aria-describedby");t&&i&&(document.getElementById(t)||console.warn(n))},[n,e,t]),null},txe=qbe,rxe=zbe,nxe=Wbe,ixe=Hbe,axe=Vbe,oxe=Qbe,sxe=Zbe,lxe=Kbe;var dxe=Ae(Te(),1),Lt=Ae(Te(),1);function CGe(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]},pxe=.4,mxe=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"}),d5=()=>{let e=Lt.default.useContext(mxe);if(!e)throw new Error("useDrawerContext must be used within a Drawer.Root");return e};function Fi(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 qy(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 no=e=>{switch(e){case"top":case"bottom":return!0;case"left":case"right":return!1;default:return e}};function u5(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(", ")[no(t)?13:12]):(i=n.match(/^matrix\((.+)\)$/),i?parseFloat(i[1].split(", ")[no(t)?5:4]):null)}function DGe(e){return 8*(Math.log(e+1)-2)}CGe("[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 OGe(e,t){typeof e=="function"?e(t):e!=null&&(e.current=t)}function MGe(...e){return t=>e.forEach(r=>OGe(r,t))}function hxe(...e){return dxe.useCallback(MGe(...e),e)}var CC=null;function jGe({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 NGe=typeof window<"u"?Lt.useLayoutEffect:Lt.useEffect;function xG(...e){return(...t)=>{for(let r of e)typeof r=="function"&&r(...t)}}function TGe(){return SG(/^Mac/)}function FGe(){return SG(/^iPhone/)}function _Ge(){return SG(/^iPad/)||TGe()&&navigator.maxTouchPoints>1}function Axe(){return FGe()||_Ge()}function SG(e){return typeof window<"u"&&window.navigator!=null?e.test(window.navigator.platform):void 0}var vG=typeof document<"u"&&window.visualViewport;function uxe(e){let t=window.getComputedStyle(e);return/(auto|scroll)/.test(t.overflow+t.overflowX+t.overflowY)}function gxe(e){for(uxe(e)&&(e=e.parentElement);e&&!uxe(e);)e=e.parentElement;return e||document.scrollingElement||document.documentElement}var PGe=new Set(["checkbox","radio","range","color","file","image","button","submit","reset"]),c5=0,yG;function IGe(e={}){let{isDisabled:t}=e;NGe(()=>{if(!t)return c5++,c5===1&&(Axe()?yG=RGe():yG=BGe()),()=>{c5--,c5===0&&yG()}},[t])}function BGe(){return xG(vxe(document.documentElement,"paddingRight",`${window.innerWidth-document.documentElement.clientWidth}px`))}function RGe(){let e,t=0,r=f=>{e=gxe(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;wG(d)&&d!==document.activeElement&&(f.preventDefault(),d.style.transform="translateY(-2000px)",d.focus(),requestAnimationFrame(()=>{d.style.transform=""}))},a=f=>{let d=f.target;wG(d)&&(d.style.transform="translateY(-2000px)",requestAnimationFrame(()=>{d.style.transform="",vG&&(vG.height{cxe(d)}):vG.addEventListener("resize",()=>cxe(d),{once:!0}))}))},o=()=>{window.scrollTo(0,0)},s=window.pageXOffset,l=window.pageYOffset,u=xG(vxe(document.documentElement,"paddingRight",`${window.innerWidth-document.documentElement.clientWidth}px`));window.scrollTo(0,0);let c=xG(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 vxe(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 cxe(e){let t=document.scrollingElement||document.documentElement;for(;e&&e!==t;){let r=gxe(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 wG(e){return e instanceof HTMLInputElement&&!PGe.has(e.type)||e instanceof HTMLTextAreaElement||e instanceof HTMLElement&&e.isContentEditable}function yxe(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=yxe(t);return Lt.default.useEffect(()=>{i.current!==n&&(a(n),i.current=n)},[n,i,a]),r}function qGe({prop:e,defaultProp:t,onChange:r=()=>{}}){let[n,i]=$Ge({defaultProp:t,onChange:r}),a=e!==void 0,o=a?e:n,s=yxe(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 LGe({activeSnapPointProp:e,setActiveSnapPointProp:t,snapPoints:r,drawerRef:n,overlayRef:i,cacheRef:a,fadeFromIndex:o,onSnapPointChange:s,direction:l="bottom"}){let[u,c]=qGe({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)),no(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),Fi(a.current,n.current,{transition:`transform ${ii.DURATION}s cubic-bezier(${ii.EASE.join(",")})`,transform:no(l)?`translate3d(0, ${x}px, 0)`:`translate3d(${x}px, 0, 0)`}),h&&S!==h.length-1&&S!==o?Fi(a.current,i.current,{transition:`opacity ${ii.DURATION}s cubic-bezier(${ii.EASE.join(",")})`,opacity:"0"}):Fi(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&&Fi(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)pxe&&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]||Fi(a.current,n.current,{transform:no(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 zGe=.25,UGe=100,f5=8,Ly=16,fxe=26,bG="vaul-dragging";function bxe({open:e,onOpenChange:t,children:r,shouldScaleBackground:n,onDrag:i,onRelease:a,snapPoints:o,nested:s=!1,setBackgroundColorOnScale:l=!0,closeThreshold:u=zGe,scrollLockTimeout:c=UGe,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}=LGe({snapPoints:o,cacheRef:ae,activeSnapPointProp:h,setActiveSnapPointProp:m,drawerRef:me,fadeFromIndex:p,overlayRef:Y,onSnapPointChange:ce,direction:x});IGe({isDisabled:!j||I||!A||L||!C||S});let{restorePositionSetting:_e}=jGe({isOpen:j,modal:A,nested:s,hasBeenOpened:C,preventScrollRestoration:w,noBodyStyles:v});function he(){return(window.innerWidth-fxe)/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,Axe()&&window.addEventListener("touchend",()=>Ie.current=!1,{once:!0}),Ge.target.setPointerCapture(Ge.pointerId),Oe.current=no(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?u5(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-(no(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]"),Yt=at/ke.current,Wr=Ce(at,Pe);if(Wr!==null&&(Yt=Wr),De&&Yt>=1||!Ie.current&&!Ye(Ge.target,Pe))return;if(me.current.classList.add(bG),Ie.current=!0,Fi(ae.current,me.current,{transition:"none"}),Fi(ae.current,Y.current,{transition:"none"}),o&&re({draggedDistance:ue}),Pe&&!o){let tn=DGe(ue),ci=Math.min(tn*-1,0)*G;Fi(ae.current,me.current,{transform:no(x)?`translate3d(0, ${ci}px, 0)`:`translate3d(${ci}px, 0, 0)`});return}let en=1-Yt;if((Ee||p&&R===p-1)&&(i?.(Ge,Yt),Fi(ae.current,Y.current,{opacity:`${en}`,transition:"none"},!0)),ht&&Y.current&&n){let tn=Math.min(he()+Yt*(1-he()),1),ci=8-Yt*8,is=Math.max(0,14-Yt*14);document.querySelectorAll("[vaul-drawer]").forEach(Pa=>{Pa!==me.current&&Fi(ae.current,Pa,{borderRadius:`${ci}px`,transform:no(x)?`scale(${tn}) translate3d(0, ${is}px, 0)`:`scale(${tn}) translate3d(${is}px, 0, 0)`,transition:"none"},!0)}),Fi(ae.current,ht,{borderRadius:`${ci}px`,transform:no(x)?`scale(${tn}) translate3d(0, ${is}px, 0)`:`scale(${tn}) translate3d(${is}px, 0, 0)`,transition:"none"},!0)}if(!o){let tn=at*G;Fi(ae.current,me.current,{transform:no(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(wG(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 Yt=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-fxe),g?me.current.style.height=`${Wr-Math.max(at,0)}px`:me.current.style.height=`${Math.max(en,De-Yt)}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?.(),Fi(ae.current,me.current,{transform:no(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(",")})`}),Fi(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(()=>{qy(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=u5(me.current,x);Fi(ae.current,me.current,{transform:"translate3d(0, 0, 0)",transition:`transform ${ii.DURATION}s cubic-bezier(${ii.EASE.join(",")})`}),Fi(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&&Fi(ae.current,Pe,{borderRadius:`${f5}px`,overflow:"hidden",...no(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)}),Fi(ae.current,Ge,{borderRadius:`${f5}px`,overflow:"hidden",...no(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(bG),Ie.current=!1,T(!1),Q.current=new Date)}function Le(Ge){if(!I||!me.current)return;me.current.classList.remove(bG),Ie.current=!1,T(!1),Q.current=new Date;let G=u5(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-(no(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>pxe){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&&(Fi(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&&(Fi(ae.current,document.body,{background:document.body.style.backgroundColor||document.body.style.background}),Fi(ae.current,document.body,{background:"black"},!0)),document.querySelectorAll("[vaul-drawer]").forEach(Pe=>{Pe!==me.current&&Fi(ae.current,Pe,{borderRadius:`${f5}px`,overflow:"hidden",...no(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(",")})`})}),Fi(ae.current,G,{borderRadius:`${f5}px`,overflow:"hidden",...no(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&&(qy(ae.current,Pe,"overflow"),qy(ae.current,Pe,"transform"),qy(ae.current,Pe,"borderRadius"),Fi(ae.current,Pe,{transitionProperty:"transform, border-radius",transitionDuration:`${ii.DURATION}s`,transitionTimingFunction:`cubic-bezier(${ii.EASE.join(",")})`}))}),qy(ae.current,G,"overflow"),qy(ae.current,G,"transform"),qy(ae.current,G,"borderRadius"),Fi(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-Ly)/window.innerWidth:1,ue=Ge?-Ly:0;Se.current&&window.clearTimeout(Se.current),Fi(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=u5(me.current,x);Fi(ae.current,me.current,{transition:"none",transform:no(x)?`translate3d(0, ${Pe}px, 0)`:`translate3d(${Pe}px, 0, 0)`})},500))}function Qe(Ge,G){if(G<0)return;let ue=no(x)?window.innerHeight:window.innerWidth,Pe=(ue-Ly)/ue,De=Pe+G*(1-Pe),at=-Ly+G*Ly;Fi(ae.current,me.current,{transform:no(x)?`scale(${De}) translate3d(0, ${at}px, 0)`:`scale(${De}) translate3d(${at}px, 0, 0)`,transition:"none"})}function et(Ge,G){let ue=no(x)?window.innerHeight:window.innerWidth,Pe=G?(ue-Ly)/ue:1,De=G?-Ly:0;G&&Fi(ae.current,me.current,{transition:`transform ${ii.DURATION}s cubic-bezier(${ii.EASE.join(",")})`,transform:no(x)?`scale(${Pe}) translate3d(0, ${De}px, 0)`:`scale(${Pe}) translate3d(${De}px, 0, 0)`})}return Lt.default.createElement(txe,{modal:A,onOpenChange:Ge=>{if(e!==void 0){t?.(Ge);return}Ge?(N(!0),O(Ge)):Ct()},open:j},Lt.default.createElement(mxe.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 WGe=250,HGe=120,xxe=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}=d5(),h=Lt.default.useRef(null),m=Lt.default.useRef(!1);function g(){if(m.current){v();return}window.setTimeout(()=>{A()},HGe)}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},WGe)}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))});xxe.displayName="Drawer.Handle";var wxe=Lt.default.forwardRef(function({children:e,...t},r){let{overlayRef:n,snapPoints:i,onRelease:a,shouldFade:o,isOpen:s,visible:l}=d5(),u=hxe(r,n),c=i&&i.length>0;return Lt.default.createElement(ixe,{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})});wxe.displayName="Drawer.Overlay";var Sxe=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}=d5(),w=hxe(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(axe,{"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)}})});Sxe.displayName="Drawer.Content";function VGe({onDrag:e,onOpenChange:t,...r}){let{onNestedDrag:n,onNestedOpenChange:i,onNestedRelease:a}=d5();if(!n)throw new Error("Drawer.NestedRoot must be placed in another drawer");return Lt.default.createElement(bxe,{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 zy={Root:bxe,NestedRoot:VGe,Content:Sxe,Handle:xxe,Overlay:wxe,Trigger:rxe,Portal:nxe,Close:lxe,Title:oxe,Description:sxe};var p5=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(zy.Root,{open:r,onOpenChange:a=>{n(a)},shouldScaleBackground:!0,onClose:()=>{n(!1),e.hide(!0)},noBodyStyles:!0},$d.default.createElement(zy.Portal,null,$d.default.createElement(zy.Content,{className:(0,Exe.default)("mk-drawer-content",e.className),"data-drawer-index":i,style:{"--drawer-index":i}},$d.default.createElement(zy.Handle,{className:"mk-drawer-handle"}),$d.default.createElement(zy.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(zy.Overlay,{className:"mk-drawer-overlay",style:{"--drawer-index":i}})))};var GGe=e=>{let t=qw(Pp(RA,{activationConstraint:{distance:10}}),Pp($A,{activationConstraint:{delay:250,tolerance:5}}),Pp($0,{coordinateGetter:qN})),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:PN,measuring:{droppable:{strategy:_p.Always}}},qd.default.createElement("div",{className:`mk-menu-wrapper ${!jc(e.ui)||n?"mk-ready":""}`,ref:r},e.children))},m5=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(p5,{fc:e.fc,hide:u=>a(u),newProps:l,className:(0,kxe.default)("mk-drawer-menu",e.className)}));return}o.render(qd.default.createElement(GGe,{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=Lye(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 Cxe=Ae(Te());var Dxe=(e,t,r,n,i,a)=>m5({ui:t.ui,rect:e,anchor:n,win:r,fc:Cxe.default.createElement(EG,{...t}),onHide:i,className:t.searchable?"mk-combo-menu":"mk-select-menu",force:a});var Df=Ae(Te());var Oxe=(e,t,r,n,i,a)=>{e.ui.openModal(t,Df.default.createElement(_i,{value:r,saveValue:n,saveLabel:i}),a)},_i=e=>{let[t,r]=(0,Df.useState)(e.value),n=()=>{e.saveValue(t),e.hide&&e.hide()},i=(0,Df.useRef)(null);return(0,Df.useEffect)(()=>{i?.current&&i.current.focus()},[i]),Df.default.createElement("div",{className:"mk-layout-column mk-gap-8"},Df.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()}}),Df.default.createElement("div",{className:"mk-modal-actions"},Df.default.createElement("button",{onClick:()=>n()},e.saveLabel),Df.default.createElement("button",{onClick:()=>e.hide&&e.hide()},W.buttons.cancel)))};var Mxe=Ae(bi());var jxe=Ae(Te());var h5=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 Uy=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 a0;this.activeState={};this.adapters=[];this.adapters=r??[],t.manager=this,this.mainFrame=t,this.inputManager=new h5}quickOpen(t,r,n,i){this.mainFrame.quickOpen(t,r,n,i)}availableViews(){return this.mainFrame.availableViews()}defaultAdd(t,r,n){if(t?.path==Kg)this.openModal("New Tag",jxe.default.createElement(_i,{value:"",saveLabel:W.labels.saveView,saveValue:i=>fC(this.superstate,i)}),r);else if(t)if(t?.metadata.template?.length>0){mC(this.superstate,t,t.metadata.template,n);return}else Ji(this.superstate,t,"md",null,!1,null,n);else uv(this.superstate,this.superstate.pathsIndex.get(this.superstate.ui.activePath)).then(i=>{i&&Ji(this.superstate,i,"md",null,!1,null,n)})}setActiveState(t){Mxe.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 Uy(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 Dxe(t,r,n,i,a,o)}openCustomMenu(t,r,n,i,a="right",o,s,l){return m5({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 qye[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)}hasNativePathMenu(t){return this.mainFrame.hasNativePathMenu(t)}nativePathMenu(t,r){this.mainFrame.nativePathMenu(t,r)}};var Mf=Ae(Te());function JA(e){return Array.isArray?Array.isArray(e):Rxe(e)==="[object Array]"}var QGe=1/0;function YGe(e){if(typeof e=="string")return e;let t=e+"";return t=="0"&&1/e==-QGe?"-0":t}function ZGe(e){return e==null?"":YGe(e)}function ah(e){return typeof e=="string"}function Ixe(e){return typeof e=="number"}function XGe(e){return e===!0||e===!1||KGe(e)&&Rxe(e)=="[object Boolean]"}function Bxe(e){return typeof e=="object"}function KGe(e){return Bxe(e)&&e!==null}function Of(e){return e!=null}function kG(e){return!e.trim().length}function Rxe(e){return e==null?e===void 0?"[object Undefined]":"[object Null]":Object.prototype.toString.call(e)}var JGe="Incorrect 'index' type",eQe=e=>`Invalid value for key ${e}`,tQe=e=>`Pattern length exceeds max of ${e}.`,rQe=e=>`Missing ${e} property in key`,nQe=e=>`Property 'weight' in key '${e}' must be a positive integer`,Nxe=Object.prototype.hasOwnProperty,CG=class{constructor(t){this._keys=[],this._keyMap={};let r=0;t.forEach(n=>{let i=$xe(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 $xe(e){let t=null,r=null,n=null,i=1,a=null;if(ah(e)||JA(e))n=e,t=Txe(e),r=DG(e);else{if(!Nxe.call(e,"name"))throw new Error(rQe("name"));let o=e.name;if(n=o,Nxe.call(e,"weight")&&(i=e.weight,i<=0))throw new Error(nQe(o));t=Txe(o),r=DG(o),a=e.getFn}return{path:t,id:r,weight:i,src:n,getFn:a}}function Txe(e){return JA(e)?e:e.split(".")}function DG(e){return JA(e)?e.join("."):e}function iQe(e,t){let r=[],n=!1,i=(a,o,s)=>{if(!!Of(a))if(!o[s])r.push(a);else{let l=o[s],u=a[l];if(!Of(u))return;if(s===o.length-1&&(ah(u)||Ixe(u)||XGe(u)))r.push(ZGe(u));else if(JA(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(!!Of(o)){if(JA(o)){let s=[],l=[{nestedArrIndex:-1,value:o}];for(;l.length;){let{nestedArrIndex:u,value:c}=l.pop();if(!!Of(c))if(ah(c)&&!kG(c)){let f={v:c,i:u,n:this.norm.get(c)};s.push(f)}else JA(c)&&c.forEach((f,d)=>{l.push({nestedArrIndex:d,value:f})})}n.$[a]=s}else if(ah(o)&&!kG(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 qxe(e,t,{getFn:r=zr.getFn,fieldNormWeight:n=zr.fieldNormWeight}={}){let i=new OC({getFn:r,fieldNormWeight:n});return i.setKeys(e.map($xe)),i.setSources(t),i.create(),i}function fQe(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 A5(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 dQe(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 Wy=32;function pQe(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>Wy)throw new Error(tQe(Wy));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=A5(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=A5(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(A5(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=dQe(g,s);k.length?l&&(S.indices=k):S.isMatch=!1}return S}function mQe(e){let t={};for(let r=0,n=e.length;r{this.chunks.push({pattern:d,alphabet:mQe(d),startIndex:p})},f=this.pattern.length;if(f>Wy){let d=0,p=f%Wy,h=f-p;for(;d{let{isMatch:A,score:b,indices:v}=pQe(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 Fxe(t,this.multiRegex)}static isSingleMatch(t){return Fxe(t,this.singleRegex)}search(){}};function Fxe(e,t){let r=e.match(t);return r?r[1]:null}var OG=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]}}},MG=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]}}},jG=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]}}},NG=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]}}},TG=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]}}},FG=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]}}},v5=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 g5(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)}},y5=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}}},_G=[OG,y5,jG,NG,FG,TG,MG,v5],_xe=_G.length,hQe=/ +(?=(?:[^\"]*\"[^\"]*\")*[^\"]*$)/,AQe="|";function gQe(e,t={}){return e.split(AQe).map(r=>{let n=r.trim().split(hQe).filter(a=>a&&!!a.trim()),i=[];for(let a=0,o=n.length;a!!(e[b5.AND]||e[b5.OR]),bQe=e=>!!e[RG.PATH],xQe=e=>!JA(e)&&Bxe(e)&&!$G(e),Pxe=e=>({[b5.AND]:Object.keys(e).map(t=>({[t]:e[t]}))});function Lxe(e,t,{auto:r=!0}={}){let n=i=>{let a=Object.keys(i),o=bQe(i);if(!o&&a.length>1&&!$G(i))return n(Pxe(i));if(xQe(i)){let l=o?i[RG.PATH]:a[0],u=o?i[RG.PATTERN]:i[l];if(!ah(u))throw new Error(eQe(l));let c={keyId:DG(l),pattern:u};return r&&(c.searcher=BG(u,t)),c}let s={children:[],operator:a[0]};return a.forEach(l=>{let u=i[l];JA(u)&&u.forEach(c=>{s.children.push(n(c))})}),s};return $G(e)||(e=Pxe(e)),n(e)}function wQe(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 SQe(e,t){let r=e.matches;t.matches=[],Of(r)&&r.forEach(n=>{if(!Of(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 EQe(e,t){t.score=e.score}function kQe(e,t,{includeMatches:r=zr.includeMatches,includeScore:n=zr.includeScore}={}){let i=[];return r&&i.push(SQe),n&&i.push(EQe),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 CG(this.options.keys),this.setCollection(t,n)}setCollection(t,r){if(this._docs=t,r&&!(r instanceof OC))throw new Error(JGe);this._myIndex=r||qxe(this.options.keys,this._docs,{getFn:this.options.getFn,fieldNormWeight:this.options.fieldNormWeight})}add(t){!Of(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)),kQe(l,this._docs,{includeMatches:n,includeScore:i})}_searchStringList(t){let r=BG(t,this.options),{records:n}=this._myIndex,i=[];return n.forEach(({v:a,i:o,n:s})=>{if(!Of(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=Lxe(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(Of(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=BG(t,this.options),{keys:n,records:i}=this._myIndex,a=[];return i.forEach(({$:o,i:s})=>{if(!Of(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(!Of(r))return[];let i=[];if(JA(r))r.forEach(({v:a,i:o,n:s})=>{if(!Of(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=qxe;Gp.parseIndex=fQe;Gp.config=zr;Gp.parseQuery=Lxe;yQe(PG);var ki=Ae(Te());var kl=Ae(Te()),CQe={position:"absolute",width:0,height:0,visibility:"hidden",overflow:"scroll",whiteSpace:"pre"},DQe=["fontSize","fontFamily","fontWeight","fontStyle","letterSpacing","textTransform"],zxe=(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);DQe.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:CQe},e.query||u),kl.default.createElement("span",null)))}),Uxe=zxe;zxe.displayName="SelectMenuSearch";var qG=Ae(Te()),OQe=e=>qG.default.createElement("button",{type:"button",className:e.classNames.selectedTag,onClick:e.onDelete},qG.default.createElement("span",{className:e.classNames.selectedTagName},e.tag.name)),Wxe=OQe;var Hxe=Ae(Te()),Vxe=e=>Hxe.default.createElement("div",{className:"mk-sticker",dangerouslySetInnerHTML:{__html:e.ui.getSticker(e.sticker)}});var mi=Ae(Te());function Gxe(e){return e.replace(/[-\\^$*+?.()|[\]{}]/g,"\\$&")}function r2(e){return new RegExp(Gxe(e),"gi")}function Qxe(e){return new RegExp(`^${Gxe(e)}$`,"i")}function Yxe(e,t){let r=r2(t);return e?.replace(r,"$&")}var MQe=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(Vxe,{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?Yxe(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:Yxe(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")}}))},jQe=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)})},NQe=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(jQe,{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(MQe,{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)))},Zxe=NQe;function Xxe(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 Hy={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"},Jxe={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"},TQe={ui:null,id:"SelectMenu",tags:[],hide:()=>null,onHide:()=>null,suggestionsOnly:!1,placeholderText:W.labels.optionItemSelectPlaceholder,noSuggestionsText:null,newTagText:null,suggestions:[],suggestionsFilter:FQe,suggestionsTransform:null,classNames:Jxe,delimiters:[Hy.ENTER],minQueryLength:2,maxSuggestionsLength:8,inputAttributes:{}},ewe=(e,t)=>e.findIndex(r=>Qxe(t).test(r.name)),Kxe=(e,t,r,n,i,a)=>{if(t.length>=e.minQueryLength){let o=ewe(n,t),s=r===-1?o:r,l=s>-1?n[s]:null;i(l||{name:t,value:t},a)}};function FQe(e,t){return r2(t).test(e.name)}function _Qe(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&&ewe(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 twe=ki.default.forwardRef((e,t)=>{let r={...TQe,...e},[n,i]=(0,ki.useState)([]),a=(0,ki.useRef)([]),o=(0,ki.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,ki.useRef)(null),[l,u]=(0,ki.useState)(""),[c,f]=(0,ki.useState)(""),[d,p]=(0,ki.useState)(!1),[h,m]=(0,ki.useState)(0),g=(0,ki.useRef)(!1);(0,ki.useEffect)(()=>{t&&(t.current=()=>d?!0:(s?.current?.focus(),p(!0),!1))},[d]),(0,ki.useEffect)(()=>{if(c.length==0&&r.defaultSuggestions){i(r.defaultSuggestions);return}i(_Qe(r,c,l))},[c,r.defaultSuggestions,l,r.suggestions]);let A=(0,ki.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?Kxe(r,c,h,n,k,{}):Q!==c&&f(Q)},v=te=>{g.current||(r.delimiters.indexOf(te.key)>-1&&((c||h>-1)&&te.preventDefault(),Kxe(r,c,h,n,k,{ctrlKey:te.ctrlKey,metaKey:te.metaKey,altKey:te.altKey,shiftKey:te.shiftKey})),te.key!="Escape"&&(te.key===Hy.TAB&&q(te),te.key===Hy.BACKSPACE&&P(),(te.key===Hy.UP_ARROW||te.key===Hy.UP_ARROW_COMPAT)&&N(te),(te.key===Hy.DOWN_ARROW||te.key===Hy.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&&Xxe(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,ki.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({},Jxe,r.classNames);r.wrapperClass&&(L.root=`${L.root} ${r.wrapperClass}`);let _=[L.root];d&&_.push(L.rootFocused);let Y=(0,ki.useRef)(null),oe=te=>{Y.current&&Y.current.hide(!0),Y.current=te};return ki.default.createElement("div",{ref:A,className:_.join(" "),style:r.suggestionsOnly?{}:{"--mk-menu-max-height":"200px"}},r.suggestionsOnly?null:ki.default.createElement("div",{className:L.selected,"aria-relevant":"additions removals","aria-live":"polite"},r.tags.length>0&&ki.default.createElement("div",{className:L.selectedTagWrapper},r.tags.map((te,Q)=>ki.default.createElement(Wxe,{key:Q,tag:te,classNames:L,onDelete:fe=>S(Q,fe)}))),ki.default.createElement(Uxe,{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?ki.default.createElement("div",{className:"mk-menu-sections"},o.map((te,Q)=>ki.default.createElement("div",{key:Q,onClick:fe=>{fe.stopPropagation(),u(te.value)},className:`${l==te.value?"is-active":""} mk-menu-section`},te.name==""?W.labels.all:te.name))):ki.default.createElement(ki.default.Fragment,null),n.length||r.allowNew?ki.default.createElement(Zxe,{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)});twe.displayName="SelectMenuComponent";var rwe=twe;var nwe=Mf.default.forwardRef((e,t)=>{let r=e.options.map((f,d)=>({...f,id:d+1}));(0,Mf.useEffect)(()=>{i(e.options.map((f,d)=>({...f,id:d+1})))},[e.options]);let[n,i]=(0,Mf.useState)(r),[a,o]=(0,Mf.useState)(e.value.map(f=>r.find(d=>d.value==f)??{id:0,name:f,value:f})),s=(0,Mf.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,Mf.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,Mf.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,Mf.useCallback)(f=>!(!e.editable&&!n.find(d=>d.value==f.value)||f.name.length==0),[n]);return Mf.default.createElement(rwe,{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})});nwe.displayName="SelectMenu";var EG=nwe;var Xo=Ae(Te());var sh=Ae(Te());function mv(){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}),Ys=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=>{fv(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:mv(),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 hv=(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)"}},W.labels.notePlaceholder.replace("${1}",rf(e.path))):Cl.default.createElement(Cl.default.Fragment,null))});hv.displayName="FlowView";var Ne=e=>e.defaultView||window;var uh=(e,t)=>({name:"",type:2,value:e,onValueChange:t});var qt={name:"",type:-1,disabled:!0},Zt=(e,t)=>({ui:e,multi:!1,value:[],editable:!1,options:t,searchable:!1,showAll:!0});var iwe=(e,t,r,n,i,a,o,s)=>{let l=[];l.push(uh(n?.name??"",u=>o(n.name,u))),l.push(qt),l.push({name:W.menu.changePropertyType,icon:"ui//list",onClick:u=>{s(u,n.name)}}),n.type!="object"&&l.push({name:W.menu.syncToContext,icon:"ui//sync",onClick:u=>{a(n)}}),l.push({name:W.menu.deleteProperty,icon:"ui//trash",onClick:u=>{i(n)}}),e.ui.openMenu(t,Zt(e.ui,l),r)};var io=Ae(Te());var Vy={view:"list",filters:[],listView:"",listItem:"",listGroup:"",listGroupProps:{},listViewProps:{},listItemProps:{},sort:[],groupBy:[],colsOrder:[],colsHidden:[],colsSize:{},colsCalc:{}};var Aa=(0,io.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}),Av=e=>{let[t,r]=(0,io.useState)([]),[n,i]=(0,io.useState)([]),[a,o]=(0,io.useState)(null),s=(0,io.useMemo)(()=>(a?.rows??[]).map(N=>Ao(N))??[],[a]),l=s.filter(N=>N.type=="frame"),[u,c]=(0,io.useState)(null),[f,d]=(0,io.useState)(null),p=(0,io.useMemo)(()=>u?.[f?.id],[u,f]),{spaceInfo:h,readMode:m}=(0,io.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?wp(N):q)}:{...a,rows:[...a.rows,wp(N)]};h.readOnly||await e.superstate.spaceManager.saveFrameSchema(h.path,N.id,()=>wp(N)),N.id==f?.id&&(d(N),c(q=>({...q,[N.id]:{...q[N.id],schema:wp(N)}}))),o(P)};(0,io.useEffect)(()=>{a&&x().then(N=>{N&&Object.keys(N).length>0&&c(N)})},[a]),(0,io.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:ji(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:ji(e.contextSchema,a?.rows.map(D=>D.id)??[]),name:"Table",type:"view",predicate:JSON.stringify({...Vy,view:"table"}),def:JSON.stringify({db:e.contextSchema,icon:"ui//table"})}):Ao(bp);return N})},[a,e.contextSchema,e.schema]);let b=(0,io.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,io.useCallback)(async N=>{if(N.path==h.path){b();return}},[h,b]);(0,io.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,io.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:XA(N.name)},q=p;if(P.name=="")return e.superstate.ui.notify(W.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(W.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 io.default.createElement(Aa.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 Ss=Ae(Te());var PQe={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"}]}}},awe={name:"repeat",type:"object",value:JSON.stringify({typeName:"Repeat",type:PQe})};var owe=(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]??[],bA(i[a],a)]})}return Object.keys(r).reduce((n,i)=>[...n,{name:i,type:r[i][0]}],[])};var Kr=Ae(Te());var IQe=0,MC=class{constructor(t,r){this.from=t,this.to=r}},wn=class{constructor(t={}){this.id=IQe++,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 n2=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]}},BQe=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):BQe,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 i2=class{constructor(t){this.types=t;for(let r=0;r0;for(let l=this.cursor(o|Zs.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:VG(Dl.none,this.children,this.positions,0,this.children.length,0,this.length,(r,n,i)=>new ga(this.type,r,n,i,this.propValues),t.makeTree||((r,n,i)=>new ga(Dl.none,r,n,i)))}static build(t){return $Qe(t)}};ga.empty=new ga(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(!!cwe(i,n,f,f+c.length)){if(c instanceof fh){if(a&Zs.ExcludeBuffers)continue;let d=c.findChild(0,c.buffer.length,r,n-f,i);if(d>-1)return new ch(new zG(o,c,t,f),null,d)}else if(a&Zs.IncludeAnonymous||!c.type.isAnonymous||HG(c)){let d;if(!(a&Zs.IgnoreMounts)&&(d=n2.get(c))&&!d.overlay)return new Tc(d.tree,f,t,o);let p=new Tc(c,f,t,o);return a&Zs.IncludeAnonymous||!p.type.isAnonymous?p:p.nextChild(r<0?c.children.length-1:0,r,n,i)}}}if(a&Zs.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&Zs.IgnoreOverlays)&&(i=n2.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 lwe(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 LG(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 zG=class{constructor(t,r,n,i){this.parent=t,this.buffer=r,this.index=n,this.start=i}},ch=class extends S5{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&Zs.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 ga(this.type,t,r,this.to-this.from)}toString(){return this.context.buffer.childString(this.index)}};function fwe(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?fwe(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&Zs.ExcludeBuffers?!1:this.enterChild(1,t,r):this.yield(this._tree.enter(t,r,n))}parent(){if(!this.buffer)return this.yieldNode(this.mode&Zs.IncludeAnonymous?this._tree._parent:this._tree.parent);if(this.stack.length)return this.yieldBuf(this.stack.pop());let t=this.mode&Zs.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&Zs.IncludeAnonymous||s instanceof fh||!s.type.isAnonymous||HG(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 LG(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 HG(e){return e.children.some(t=>t instanceof fh||!t.type.isAnonymous||HG(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=VG(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 ga){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 ga(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 ga(l[e.topID],b.reverse(),v.reverse(),x)}var uwe=new WeakMap;function w5(e,t){if(!e.isAnonymous||t instanceof fh||t.type!=e)return 1;let r=uwe.get(t);if(r==null){r=1;for(let n of t.children){if(n.type!=e||!(n instanceof ga)){r=1;break}r+=w5(e,n)}uwe.set(t,r)}return r}function VG(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(VG(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}}},WG=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 $Kt=new wn({perNode:!0});var Sn=require("@codemirror/state"),on=require("@codemirror/view");var qQe=0,Ud=class{constructor(t,r,n){this.set=t,this.base=r,this.modified=n,this.id=qQe++}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 a2;return r=>r.modified.indexOf(t)>-1?r:a2.get(r.base||r,r.modified.concat(t).sort((n,i)=>n.id-i.id))}},LQe=0,a2=class{constructor(){this.instances=[],this.id=LQe++}static get(t,r){if(!r.length)return t;let n=r[0].instances.find(s=>s.base==t&&zQe(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=UQe(r);for(let s of t.set)if(!s.modified.length)for(let l of o)i.push(a2.get(s,l));return a}};function zQe(e,t){return e.length==t.length&&e.every((r,n)=>r==t[n])}function UQe(e){let t=[[]];for(let r=0;rn.length-r.length)}function mwe(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 o2(n,o,l>0?a.slice(0,l):null);t[u]=c.sort(t[u])}}return hwe.add(t)}var hwe=new wn,o2=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 WQe(e,t){let r=null;for(let n of e){let i=n.style(t);i&&(r=r?r+" "+i:i)}return r}function Awe(e,t,r,n=0,i=e.length){let a=new QG(n,Array.isArray(t)?t:[t],r);a.highlightRange(e.cursor(),n,i,"",a.highlighters),a.flush(i)}var QG=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=HQe(t)||o2.empty,f=WQe(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 HQe(e){let t=e.type.prop(hwe);for(;t&&t.context&&!e.matchContext(t.context);)t=t.next;return t||null}var Nt=Ud.define,E5=Nt(),gv=Nt(),dwe=Nt(gv),pwe=Nt(gv),vv=Nt(),k5=Nt(vv),GG=Nt(vv),hh=Nt(),Gy=Nt(hh),ph=Nt(),mh=Nt(),YG=Nt(),_C=Nt(YG),C5=Nt(),qe={comment:E5,lineComment:Nt(E5),blockComment:Nt(E5),docComment:Nt(E5),name:gv,variableName:Nt(gv),typeName:dwe,tagName:Nt(dwe),propertyName:pwe,attributeName:Nt(pwe),className:Nt(gv),labelName:Nt(gv),namespace:Nt(gv),macroName:Nt(gv),literal:vv,string:k5,docString:Nt(k5),character:Nt(k5),attributeValue:Nt(k5),number:GG,integer:Nt(GG),float:Nt(GG),bool:Nt(vv),regexp:Nt(vv),escape:Nt(vv),color:Nt(vv),url:Nt(vv),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:YG,separator:Nt(YG),bracket:_C,angleBracket:Nt(_C),squareBracket:Nt(_C),paren:Nt(_C),brace:Nt(_C),content:hh,heading:Gy,heading1:Nt(Gy),heading2:Nt(Gy),heading3:Nt(Gy),heading4:Nt(Gy),heading5:Nt(Gy),heading6:Nt(Gy),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:C5,documentMeta:Nt(C5),annotation:Nt(C5),processingInstruction:Nt(C5),definition:Ud.defineModifier(),constant:Ud.defineModifier(),function:Ud.defineModifier(),standard:Ud.defineModifier(),local:Ud.defineModifier(),special:Ud.defineModifier()},zKt=ZG([{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 XG="\u037C",gwe=typeof Symbol>"u"?"__"+XG:Symbol.for(XG),KG=typeof Symbol>"u"?"__styleSet"+Math.floor(Math.random()*1e8):Symbol("styleSet"),vwe=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=vwe[gwe]||1;return vwe[gwe]=t+1,XG+t.toString(36)}static mount(t,r,n){let i=t[KG],a=n&&n.nonce;i?a&&i.setNonce(a):i=new JG(t,a),i.mount(Array.isArray(r)?r:[r],t)}},ywe=new Map,JG=class{constructor(t,r){let n=t.ownerDocument||t,i=n.defaultView;if(!t.head&&t.adoptedStyleSheets&&i.CSSStyleSheet){let a=ywe.get(n);if(a)return t[KG]=a;this.sheet=new i.CSSStyleSheet,ywe.set(n,this)}else this.styleTag=n.createElement("style"),r&&this.styleTag.setAttribute("nonce",r);this.modules=[],t[KG]=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 GQe=new wn,jf=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 Xs(this)}}),this.parser=r,this.extension=[xv.of(this),Sn.EditorState.languageData.of((a,o,s)=>{let l=bwe(a,o,s),u=l.type.prop(s2);if(!u)return[];let c=a.facet(u),f=l.type.prop(GQe);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 bwe(t,r,n).type.prop(s2)==this.data}findRegions(t){let r=t.facet(xv);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(s2)==this.data){n.push({from:o,to:o+a.length});return}let s=a.prop(wn.mounted);if(s){if(s.tree.prop(s2)==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,yv=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 yv(t,r,[],ga.empty,0,n,[],null)}startParse(){return this.parser.startParse(new iQ(this.state.doc),this.fragments)}work(t,r){return r!=null&&r>=this.state.doc.length&&(r=void 0),this.tree!=ga.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=xwe(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=ga.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=xwe(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 ga(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 xwe(e,t,r){return dh.applyChanges(e,[{fromA:t,toA:r,fromB:t,toB:r}])}var bv=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 bv(r)}static init(t){let r=Math.min(3e3,t.doc.length),n=yv.create(t.facet(xv).parser,t,{from:0,to:r});return n.work(20,r)||n.takeTree(),new bv(n)}};jf.state=Sn.StateField.define({create:bv.init,update(e,t){for(let r of t.effects)if(r.is(jf.setState))return r.value;return t.startState.facet(xv)!=t.state.facet(xv)?bv.init(t.state):e.apply(t)}});var Dwe=e=>{let t=setTimeout(()=>e(),500);return()=>clearTimeout(t)};typeof requestIdleCallback<"u"&&(Dwe=e=>{let t=-1,r=setTimeout(()=>{t=requestIdleCallback(e,{timeout:500-100})},100);return()=>t<0?clearTimeout(r):cancelIdleCallback(t)});var tQ=typeof navigator<"u"&&((eQ=navigator.scheduling)===null||eQ===void 0?void 0:eQ.isInputPending)?()=>navigator.scheduling.isInputPending():null,QQe=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(jf.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(jf.state);(r.tree!=r.context.tree||!r.context.isDone(t.doc.length))&&(this.working=Dwe(this.work))}work(t){this.working=null;let r=Date.now();if(this.chunkEndi+1e3,l=a.context.work(()=>tQ&&tQ()||Date.now()>o,i+(s?0:1e5));this.chunkBudget-=Date.now()-r,(l||this.chunkBudget<=0)&&(a.context.takeTree(),this.view.dispatch({effects:jf.setState.of(new bv(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()}}}),xv=Sn.Facet.define({combine(e){return e.length?e[0]:null},enables:e=>[jf.state,QQe,on.EditorView.contentAttributes.compute([e],t=>{let r=t.facet(e);return r&&r.name?{"data-language":r.name}:{}})]});var Owe=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 O5(e){let t=e.facet($C);return t.charCodeAt(0)==9?e.tabSize*t.length:t.length}function YQe(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?KQe(e,r,t):null}var M5=class{constructor(t,r={}){this.state=t,this.options=r,this.unit=O5(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}},XQe=new wn;function KQe(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 Mwe(n,e,r)}function Mwe(e,t,r){for(let n=e;n;n=n.next){let i=eYe(n.node);if(i)return i(BC.create(t,r,n))}return 0}function JQe(e){return e.pos==e.options.simulateBreak&&e.options.simulateDoubleBreak}function eYe(e){let t=e.type.prop(XQe);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=>iYe(o,!0,1,void 0,a&&!JQe(o)?i.from:void 0)}return e.parent==null?tYe:null}function tYe(){return 0}var BC=class extends M5{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(rYe(n,t))break;r=this.state.doc.lineAt(n.from)}return this.lineIndent(r.from)}continue(){return Mwe(this.context.next,this.base,this.pos)}};function rYe(e,t){for(let r=t;r;r=r.parent)if(e==r)return!0;return!1}function nYe(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+aYe)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=ZQe(o,c.from);if(f==null)continue;let d=/^\s*/.exec(c.text)[0],p=YQe(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 oYe=Sn.Facet.define(),sYe=new wn;function lYe(e,t,r){let n=Xs(e);if(n.lengthr)continue;if(a&&s.from=t&&u.to>r&&(a=u)}}return a}function uYe(e){let t=e.lastChild;return t&&t.to==e.to&&t.type.isError}function j5(e,t,r){for(let n of e.facet(oYe)){let i=n(e,t,r);if(i)return i}return lYe(e,t,r)}function Nwe(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 _5=Sn.StateEffect.define({map:Nwe}),qC=Sn.StateEffect.define({map:Nwe});function Twe(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 Qy=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(_5)&&!cYe(e,r.value.from,r.value.to)){let{preparePlaceholder:n}=t.state.facet(fQ),i=n?on.Decoration.replace({widget:new aQ(n(t.state,r.value))}):wwe;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 cYe(e,t,r){let n=!1;return e.between(t,t,(i,a)=>{i==t&&a==r&&(n=!0)}),n}function Fwe(e,t){return e.field(Qy,!1)?t:t.concat(Sn.StateEffect.appendConfig.of(Iwe()))}var fYe=e=>{for(let t of Twe(e)){let r=j5(e.state,t.from,t.to);if(r)return e.dispatch({effects:Fwe(e.state,[_5.of(r),_we(e,r)])}),!0}return!1},dYe=e=>{if(!e.state.field(Qy,!1))return!1;let t=[];for(let r of Twe(e)){let n=N5(e.state,r.from,r.to);n&&t.push(qC.of(n),_we(e,n,!1))}return t.length&&e.dispatch({effects:t}),t.length>0};function _we(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 pYe=e=>{let{state:t}=e,r=[];for(let n=0;n{let t=e.state.field(Qy,!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 Pwe=[{key:"Ctrl-Shift-[",mac:"Cmd-Alt-[",run:fYe},{key:"Ctrl-Shift-]",mac:"Cmd-Alt-]",run:dYe},{key:"Ctrl-Alt-[",run:pYe},{key:"Ctrl-Alt-]",run:mYe}],hYe={placeholderDOM:null,preparePlaceholder:null,placeholderText:"\u2026"},fQ=Sn.Facet.define({combine(e){return(0,Sn.combineConfig)(e,hYe)}});function Iwe(e){let t=[Qy,gYe];return e&&t.push(fQ.of(e)),t}function Bwe(e,t){let{state:r}=e,n=r.facet(fQ),i=o=>{let s=e.lineBlockAt(e.posAtDOM(o.target)),l=N5(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 wwe=on.Decoration.replace({widget:new class extends on.WidgetType{toDOM(e){return Bwe(e,null)}}}),aQ=class extends on.WidgetType{constructor(t){super(),this.value=t}eq(t){return this.value==t.value}toDOM(t){return Bwe(t,this.value)}},AYe={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 Rwe(e={}){let t=Object.assign(Object.assign({},AYe),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(xv)!=o.state.facet(xv)||o.startState.field(Qy,!1)!=o.state.field(Qy,!1)||Xs(o.startState)!=Xs(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=N5(o.state,l.from,l.to)?n:j5(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=N5(o.state,s.from,s.to);if(u)return o.dispatch({effects:qC.of(u)}),!0;let c=j5(o.state,s.from,s.to);return c?(o.dispatch({effects:_5.of(c)}),!0):!1}})}),Iwe()]}var gYe=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 jf?s=>s.prop(s2)==o.data:o?s=>s==o:void 0,this.style=ZG(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||{})}},oQ=Sn.Facet.define(),$we=Sn.Facet.define({combine(e){return e.length?[e[0]]:null}});function rQ(e){let t=e.facet(oQ);return t.length?t:e.facet($we)}function eg(e,t){let r=[vYe],n;return e instanceof Wd&&(e.module&&r.push(on.EditorView.styleModule.of(e.module)),n=e.themeType),t?.fallback?r.push($we.of(e)):n?r.push(oQ.computeN([on.EditorView.darkTheme],i=>i.facet(on.EditorView.darkTheme)==(n=="dark")?[e]:[])):r.push(oQ.of(e)),r}var sQ=class{constructor(t){this.markCache=Object.create(null),this.tree=Xs(t.state),this.decorations=this.buildDeco(t,rQ(t.state)),this.decoratedTo=t.viewport.to}update(t){let r=Xs(t.state),n=rQ(t.state),i=n!=rQ(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)Awe(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()}},vYe=Sn.Prec.high(on.ViewPlugin.fromClass(sQ,{decorations:e=>e.decorations})),dQ=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"}]),yYe=on.EditorView.baseTheme({"&.cm-focused .cm-matchingBracket":{backgroundColor:"#328c8252"},"&.cm-focused .cm-nonmatchingBracket":{backgroundColor:"#bb555544"}}),qwe=1e4,Lwe="()[]{}",zwe=Sn.Facet.define({combine(e){return(0,Sn.combineConfig)(e,{afterCursor:!0,brackets:Lwe,maxScanDistance:qwe,renderMatch:wYe})}}),bYe=on.Decoration.mark({class:"cm-matchingBracket"}),xYe=on.Decoration.mark({class:"cm-nonmatchingBracket"});function wYe(e){let t=[],r=e.matched?bYe:xYe;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 SYe=Sn.StateField.define({create(){return on.Decoration.none},update(e,t){if(!t.docChanged&&!t.selection)return e;let r=[],n=t.state.facet(zwe);for(let i of t.state.selection.ranges){if(!i.empty)continue;let a=D5(t.state,i.head,-1,n)||i.head>0&&D5(t.state,i.head-1,1,n)||n.afterCursor&&(D5(t.state,i.head,1,n)||i.headon.EditorView.decorations.from(e)}),EYe=[SYe,yYe];function Uwe(e={}){return[zwe.of(e),EYe]}var kYe=new wn;function lQ(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 uQ(e){let t=e.type.prop(kYe);return t?t(e.node):e}function D5(e,t,r,n={}){let i=n.maxScanDistance||qwe,a=n.brackets||Lwe,o=Xs(e),s=o.resolveInner(t,r);for(let l=s;l;l=l.parent){let u=lQ(l.type,r,a);if(u&&l.from0?t>=c.from&&tc.from&&t<=c.to))return CYe(e,t,r,l,c,u,a)}}return DYe(e,t,r,o,s.type,i,a)}function CYe(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 Swe(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 OYe(e){return{name:e.name||"",token:e.token,blankLine:e.blankLine||(()=>{}),startState:e.startState||(()=>!0),copyState:e.copyState||MYe,indent:e.indent||(()=>null),languageData:e.languageData||{},tokenTable:e.tokenTable||mQ}}function MYe(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 Ewe=new WeakMap,l2=class extends jf{constructor(t){let r=VQe(t.languageData),n=OYe(t),i,a=new class extends FC{createParse(o,s,l){return new cQ(i,o,s,l)}};super(r,a,[Owe.of((o,s)=>this.getIndent(o,s))],t.name),this.topNode=FYe(r),i=this,this.streamParser=n,this.stateAfter=new wn({perNode:!0}),this.tokenTable=t.tokenTable?new F5(n.tokenTable):TYe}static define(t){return new l2(t)}getIndent(t,r){let n=Xs(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=Ewe.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 ga&&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&&pQ(e,i.tree,0-i.offset,r,o),l;if(s&&(l=Wwe(e,i.tree,r+i.offset,s.pos+i.offset,!1)))return{state:s.state,tree:l}}return{state:e.streamParser.startState(n?O5(n):4),tree:ga.empty}}var cQ=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=yv.get(),o=i[0].from,{state:s,tree:l}=jYe(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 T5(r,t?t.state.tabSize:4,t?O5(t.state):2);if(o.eol())a.blankLine(this.state,o.indentUnit);else for(;!o.eol();){let s=Hwe(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 dQ=Object.create(null),RC=[Dl.none],MYe=new i2(RC),kwe=[],Cwe=Object.create(null),Vwe=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"]])Vwe[e]=Gwe(dQ,t);var F5=class{constructor(t){this.extra=t,this.table=Object.assign(Object.create(null),Vwe)}resolve(t){return t?this.table[t]||(this.table[t]=Gwe(this.extra,t)):0}},jYe=new F5(dQ);function tQ(e,t){kwe.indexOf(e)>-1||(kwe.push(e),console.warn(t))}function Gwe(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):tQ(u,`Modifier ${u} used at start of tag`):l.length?tQ(u,`Tag ${u} used as modifier`):l=Array.isArray(c)?c:[c]:tQ(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=Cwe[i];if(a)return a.id;let o=Cwe[i]=Dl.define({id:RC.length,name:n,props:[mwe({[n]:r})]});return RC.push(o),o.id}function NYe(e){let t=Dl.define({id:RC.length,name:"Document",props:[s2.add(()=>e)],top:!0});return RC.push(t),t}var GKt={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 Qwe=require("@codemirror/view");var Ywe=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=Qwe.EditorView.theme(i,{dark:t==="dark"}),l=Wd.define(n),u=[s,eg(l)];return u};var TYe={background:"#0f0f0f",foreground:"#defdef",caret:"#00FF00",selection:"#515151",selectionMatch:"#515151",gutterBackground:"#555",gutterForeground:"#FFFFFF",lineHighlight:"#0a6bcb3d"},pQ=e=>{var{theme:t="dark",settings:r={},styles:n=[]}=e||{};return Ywe({theme:t,settings:Fn({},TYe,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]})},iJt=pQ();var En={};fM(En,{basicSetup:()=>L5,color:()=>mZe,default:()=>VC,defaultLightThemeOption:()=>jQ,getDefaultExtensions:()=>NQ,getStatistics:()=>TQ,minimalSetup:()=>pZe,oneDark:()=>MQ,oneDarkHighlightStyle:()=>kSe,oneDarkTheme:()=>ESe,useCodeMirror:()=>FQ});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 f2=Ae(Te());var Yp=Ae(Te()),Zy=require("@codemirror/state"),HC=require("@codemirror/view");var DSe=require("@codemirror/commands");var Po=require("@codemirror/view"),pSe=require("@codemirror/state"),tg=require("@codemirror/commands"),q5=require("@codemirror/search");var Xt=require("@codemirror/state"),bo=require("@codemirror/view");var I5=class{constructor(t,r,n){this.state=t,this.pos=r,this.explicit=n,this.abortListeners=[]}tokenBefore(t){let r=Xs(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(nSe(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 Zwe(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 FYe(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+$/]:FYe(t);return i=>{let a=i.matchBefore(n);return a||i.explicit?{from:a?a.from:i.pos,options:t,validFor:r}:null}}var B5=class{constructor(t,r,n,i){this.completion=t,this.source=r,this.match=n,this.score=i}};function Sv(e){return e.selection.main.from}function nSe(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 PYe=Xt.Annotation.define();function IYe(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 Xwe=new WeakMap;function BYe(e){if(!Array.isArray(e))return e;let t=Xwe.get(e);return t||Xwe.set(e,t=_Ye(e)),t}var R5=Xt.StateEffect.define(),zC=Xt.StateEffect.define(),AQ=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)}},gQ=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:RYe,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=>Kwe(t(n),r(n)),optionClass:(t,r)=>n=>Kwe(t(n),r(n)),addToOptions:(t,r)=>t.concat(r),filterStrict:(t,r)=>t||r})}});function Kwe(e,t){return e?t?e+" "+t:e:t}function RYe(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 $Ye(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 mQ(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 vQ=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=$Ye(s),this.optionClass=s.optionClass,this.tooltipClass=s.tooltipClass,this.range=mQ(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=mQ(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=mQ(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&&LYe(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 vQ(r,e,t)}function LYe(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 Jwe(e){return(e.boost||0)*100+(e.apply?10:0)+(e.info?5:0)+(e.type?1:0)}function zYe(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 B5(f,u.source,c?c(f):[],1e9-r.length));else{let f=t.sliceDoc(u.from,u.to),d,p=a.filterStrict?new gQ(f):new AQ(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 B5(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):Jwe(u.completion)>Jwe(s)&&(o[o.length-1]=u),s=u.completion}return o}var wv=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 wv(this.options,eSe(r,t),this.tooltip,this.timestamp,t,this.disabled)}static build(t,r,n,i,a){let o=zYe(t,r);if(!o.length)return i&&t.some(l=>l.state==1)?new wv(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:GYe,above:a.aboveCursor},i?i.timestamp:Date.now(),s,!1)}map(t){return new wv(this.options,this.attrs,Object.assign(Object.assign({},this.tooltip),{pos:t.mapPos(this.tooltip.pos)}),this.timestamp,this.selected,this.disabled)}},u2=class{constructor(t,r,n){this.active=t,this.id=r,this.open=n}static start(){return new u2(HYe,"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",Sv(r)).map(BYe)).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))||!UYe(a,this.active)?o=wv.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(aSe)&&(o=o&&o.setSelected(s.value,this.id));return a==this.active&&o==this.open?this:new u2(a,this.id,o)}get tooltip(){return this.open?this.open.tooltip:null}get attrs(){return this.open?this.open.attrs:WYe}};function UYe(e,t){if(e==t)return!0;for(let r=0,n=0;;){for(;r-1&&(r["aria-activedescendant"]=e+"-"+t),r}var HYe=[];function yQ(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=yQ(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(R5))i=new Ol(i.source,1,a.value?Sv(t.state):-1);else if(a.is(zC))i=new Ol(i.source,0);else if(a.is(iSe))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(Sv(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))}},Ev=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=Sv(t.state);if((this.explicitPos<0?l<=o:ls||!a||r=="delete"&&Sv(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 VYe(a.validFor,t.state,o,s)?new Ev(this.source,u,a,o,s):a.update&&(a=a.update(a,o,s,new I5(t.state,l,u>=0)))?new Ev(this.source,u,a,a.from,(i=a.to)!==null&&i!==void 0?i:Sv(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 Ev(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 VYe(e,t,r,n){if(!e)return!1;let i=t.sliceDoc(r,n);return typeof e=="function"?e(i,r,n,t):nSe(e,!0).test(i)}var iSe=Xt.StateEffect.define({map(e,t){return e.map(r=>r.map(t))}}),aSe=Xt.StateEffect.define(),Fc=Xt.StateField.define({create(){return u2.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 xQ(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 Ev?(typeof r=="string"?e.dispatch(Object.assign(Object.assign({},IYe(e.state,r,n.from,n.to)),{annotations:PYe.of(t.completion)})):r(e,t.completion,n.from,n.to),!0):!1}var GYe=qYe(Fc,xQ);function P5(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:aSe.of(s)}),!0}}var QYe=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:R5.of(!0)}),!0):!1,ZYe=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)},bQ=class{constructor(t,r){this.active=t,this.context=r,this.time=Date.now(),this.updates=[],this.done=void 0}},XYe=50,KYe=1e3,JYe=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)&&!yQ(i));for(let i=0;iXYe&&Date.now()-a.time>KYe){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(R5)))&&(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)yQ(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=Sv(t),n=new I5(t,r,e.explicitPos==r),i=new bQ(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:iSe.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:R5.of(!1)}),20),this.composing=0}}}),eZe=typeof navigator=="object"&&/Win/.test(navigator.platform),tZe=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&&!(eZe&&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&&xQ(t,n),!1}})),rZe=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:[]},Yy=Xt.StateEffect.define({map(e,t){let r=t.mapPos(e,-1,Xt.MapMode.TrackAfter);return r??void 0}}),wQ=new class extends Xt.RangeValue{};wQ.startSide=1;wQ.endSide=-1;var oSe=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(Yy)&&(e=e.update({add:[wQ.range(r.value,r.value+1)]}));return e}});function sSe(){return[iZe,oSe]}var hQ="()[]{}<>";function lSe(e){for(let t=0;t{if((nZe?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=oZe(e.state,n);return a?(e.dispatch(a),!0):!1}),aZe=({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=uSe(e,e.selection.main.head).brackets||UC.brackets,i=null,a=e.changeByRange(o=>{if(o.empty){let s=sZe(e.doc,o.head);for(let l of n)if(l==s&&$5(e.doc,o.head)==lSe((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},cSe=[{key:"Backspace",run:aZe}];function oZe(e,t){let r=uSe(e,e.selection.main.head),n=r.brackets||UC.brackets;for(let i of n){let a=lSe((0,Xt.codePointAt)(i,0));if(t==i)return a==i?cZe(e,i,n.indexOf(i+i+i)>-1,r):lZe(e,i,a,r.before||UC.before);if(t==a&&fSe(e,e.selection.main.from))return uZe(e,i,a)}return null}function fSe(e,t){let r=!1;return e.field(oSe).between(0,e.doc.length,n=>{n==t&&(r=!0)}),r}function $5(e,t){let r=e.sliceString(t,t+2);return r.slice(0,(0,Xt.codePointSize)((0,Xt.codePointAt)(r,0)))}function sZe(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 lZe(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:Yy.of(o.to+t.length),range:Xt.EditorSelection.range(o.anchor+t.length,o.head+t.length)};let s=$5(e.doc,o.head);return!s||/\s/.test(s)||n.indexOf(s)>-1?{changes:{insert:t+r,from:o.head},effects:Yy.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 uZe(e,t,r){let n=null,i=e.changeByRange(a=>a.empty&&$5(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 cZe(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:Yy.of(s.to+t.length),range:Xt.EditorSelection.range(s.anchor+t.length,s.head+t.length)};let l=s.head,u=$5(e.doc,l),c;if(u==t){if(tSe(e,l))return{changes:{insert:t+t,from:l},effects:Yy.of(l+t.length),range:Xt.EditorSelection.cursor(l+t.length)};if(fSe(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=rSe(e,l-2*t.length,i))>-1&&tSe(e,c))return{changes:{insert:t+t+t+t,from:l},effects:Yy.of(l+t.length),range:Xt.EditorSelection.cursor(l+t.length)};if(e.charCategorizer(l)(u)!=Xt.CharCategory.Word&&rSe(e,l,i)>-1&&!fZe(e,l,t,i))return{changes:{insert:t+t,from:l},effects:Yy.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 tSe(e,t){let r=Xs(e).resolveInner(t+1);return r.parent&&r.from==t}function fZe(e,t,r,n){let i=Xs(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 rSe(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 dSe(e={}){return[tZe,Fc,Ml.of(e),JYe,dZe,rZe]}var SQ=[{key:"Ctrl-Space",run:YYe},{key:"Escape",run:ZYe},{key:"ArrowDown",run:P5(!0)},{key:"ArrowUp",run:P5(!1)},{key:"PageDown",run:P5(!0,"page")},{key:"PageUp",run:P5(!1,"page")},{key:"Enter",run:QYe}],dZe=Xt.Prec.highest(bo.keymap.computeN([Ml],e=>e.facet(Ml).defaultKeymap?[SQ]:[]));var mSe=require("@codemirror/lint"),L5=function(t){t===void 0&&(t={});var{crosshairCursor:r=!1}=t,n=[];t.closeBracketsKeymap!==!1&&(n=n.concat(cSe)),t.defaultKeymap!==!1&&(n=n.concat(tg.defaultKeymap)),t.searchKeymap!==!1&&(n=n.concat(q5.searchKeymap)),t.historyKeymap!==!1&&(n=n.concat(tg.historyKeymap)),t.foldKeymap!==!1&&(n=n.concat(Pwe)),t.completionKeymap!==!1&&(n=n.concat(SQ)),t.lintKeymap!==!1&&(n=n.concat(mSe.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,tg.history)()),t.foldGutter!==!1&&i.push(Rwe()),t.drawSelection!==!1&&i.push((0,Po.drawSelection)()),t.dropCursor!==!1&&i.push((0,Po.dropCursor)()),t.allowMultipleSelections!==!1&&i.push(pSe.EditorState.allowMultipleSelections.of(!0)),t.indentOnInput!==!1&&i.push(jwe()),t.syntaxHighlighting!==!1&&i.push(eg(cQ,{fallback:!0})),t.bracketMatching!==!1&&i.push(Uwe()),t.closeBrackets!==!1&&i.push(sSe()),t.autocompletion!==!1&&i.push(dSe()),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,q5.highlightSelectionMatches)()),t.tabSize&&typeof t.tabSize=="number"&&i.push($C.of(" ".repeat(t.tabSize))),i.concat([Po.keymap.of(n.flat())]).filter(Boolean)},pZe=function(t){t===void 0&&(t={});var r=[];t.defaultKeymap!==!1&&(r=r.concat(tg.defaultKeymap)),t.historyKeymap!==!1&&(r=r.concat(tg.historyKeymap));var n=[];return t.highlightSpecialChars!==!1&&n.push((0,Po.highlightSpecialChars)()),t.history!==!1&&n.push((0,tg.history)()),t.drawSelection!==!1&&n.push((0,Po.drawSelection)()),t.syntaxHighlighting!==!1&&n.push(eg(cQ,{fallback:!0})),n.concat([Po.keymap.of(r.flat())]).filter(Boolean)};var c2=require("@codemirror/view");var hSe=require("@codemirror/view");var ASe="#e5c07b",EQ="#e06c75",gSe="#56b6c2",vSe="#ffffff",WC="#abb2bf",U5="#7d8799",ySe="#61afef",bSe="#98c379",kQ="#d19a66",xSe="#c678dd",wSe="#21252b",CQ="#2c313a",DQ="#282c34",z5="#353a42",SSe="#3E4451",OQ="#528bff",mZe={chalky:ASe,coral:EQ,cyan:gSe,invalid:vSe,ivory:WC,stone:U5,malibu:ySe,sage:bSe,whiskey:kQ,violet:xSe,darkBackground:wSe,highlightBackground:CQ,background:DQ,tooltipBackground:z5,selection:SSe,cursor:OQ},ESe=hSe.EditorView.theme({"&":{color:WC,backgroundColor:DQ},".cm-content":{caretColor:OQ},".cm-cursor, .cm-dropCursor":{borderLeftColor:OQ},"&.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection":{backgroundColor:SSe},".cm-panels":{backgroundColor:wSe,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:DQ,color:U5,border:"none"},".cm-activeLineGutter":{backgroundColor:CQ},".cm-foldPlaceholder":{backgroundColor:"transparent",border:"none",color:"#ddd"},".cm-tooltip":{border:"none",backgroundColor:z5},".cm-tooltip .cm-tooltip-arrow:before":{borderTopColor:"transparent",borderBottomColor:"transparent"},".cm-tooltip .cm-tooltip-arrow:after":{borderTopColor:z5,borderBottomColor:z5},".cm-tooltip-autocomplete":{"& > ul > li[aria-selected]":{backgroundColor:CQ,color:WC}}},{dark:!0}),kSe=Wd.define([{tag:qe.keyword,color:xSe},{tag:[qe.name,qe.deleted,qe.character,qe.propertyName,qe.macroName],color:EQ},{tag:[qe.function(qe.variableName),qe.labelName],color:ySe},{tag:[qe.color,qe.constant(qe.name),qe.standard(qe.name)],color:kQ},{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:ASe},{tag:[qe.operator,qe.operatorKeyword,qe.url,qe.escape,qe.regexp,qe.link,qe.special(qe.string)],color:gSe},{tag:[qe.meta,qe.comment],color:U5},{tag:qe.strong,fontWeight:"bold"},{tag:qe.emphasis,fontStyle:"italic"},{tag:qe.strikethrough,textDecoration:"line-through"},{tag:qe.link,color:U5,textDecoration:"underline"},{tag:qe.heading,fontWeight:"bold",color:EQ},{tag:[qe.atom,qe.bool,qe.special(qe.variableName)],color:kQ},{tag:[qe.processingInstruction,qe.string,qe.inserted],color:bSe},{tag:qe.invalid,color:vSe}]),MQ=[ESe,eg(kSe)];var OSe=require("@codemirror/state");var CSe=require("@codemirror/view"),jQ=CSe.EditorView.theme({"&":{backgroundColor:"#fff"}},{dark:!1});var NQ=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(c2.keymap.of([DSe.indentWithTab])),s&&(typeof s=="boolean"?l.unshift(L5()):l.unshift(L5(s))),o&&l.unshift((0,c2.placeholder)(o)),a){case"light":l.push(jQ);break;case"dark":l.push(MQ);break;case"none":break;default:l.push(a);break}return n===!1&&l.push(c2.EditorView.editable.of(!1)),i&&l.push(OSe.EditorState.readOnly.of(!0)),[...l]};var TQ=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 MSe=Zy.Annotation.define(),hZe=[];function FQ(e){var{value:t,selection:r,onChange:n,onStatistics:i,onCreateEditor:a,onUpdate:o,extensions:s=hZe,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(MSe))){var L=T.state.doc,_=L.toString();n(_,T)}i&&i(TQ(T))}),z=NQ({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?Zy.EditorState.fromJSON(S.json,T,S.fields):Zy.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:Zy.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:[MSe.of(!0)]})}},[t,O]),{state:N,setState:D,view:O,setView:C,container:k,setContainer:j}}var jSe=Ae(KA());li(En,require("@codemirror/view"));li(En,require("@codemirror/state"));var AZe=["className","value","selection","extensions","onChange","onStatistics","onCreateEditor","onUpdate","autoFocus","theme","height","minHeight","maxHeight","width","minWidth","maxWidth","basicSetup","placeholder","indentWithTab","editable","readOnly","root","initialState"],NSe=(0,f2.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,AZe),C=(0,f2.useRef)(null),{state:N,view:D,container:P}=FQ({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,f2.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,jSe.jsx)("div",Fn({ref:C,className:""+q+(r?" "+r:"")},O))});NSe.displayName="CodeMirror";var VC=NSe;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"]},_Q=(()=>{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())]})(),PQ="today|tomorrow|now|time|yesterday|sum|total|average|avg".split("|"),IQ="in|to|last|off|of|mod|xor|or|ago".split("|"),gZe=[..._Q,...PQ,...GC.functions,...IQ,...Object.keys(uC)],$Jt=gZe.sort((e,t)=>e.length-t.length).filter(e=>e.length>0),TSe=GC.functions,FSe=GC.constants;function QC(e){let t={};for(let r=0;r/:^%!]/;function SZe(e,t){let r=e.next();if(r=="#"||r=="/"&&e.eat("/"))return e.skipToEnd(),"comment";if(r=='"'||r=="'")return t.tokenize=EZe(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(_Se.test(r))return e.eatWhile(_Se),"operator";e.eatWhile(/[\w_]/);let n=e.current();return Object.hasOwn(vZe,n)?"operatorKeyword":Object.hasOwn(yZe,n)||Object.hasOwn(wZe,n)?"variableName.standard":Object.hasOwn(xZe,n)?"variableName.special":Object.hasOwn(bZe,n)?"function":e.peek()==="("?"variableName.definition":"variable"}function EZe(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 PSe={name:"mkformula",startState:function(){return{tokenize:null}},token:function(e,t){if(e.eatSpace())return null;let r=(t.tokenize||SZe)(e,t);return r=="comment"||r=="meta",r},languageData:{autocomplete:Object.keys(cC),closeBrackets:{brackets:["(","[","{","'",'"',"`"]},commentTokens:{line:"#"}}};var cn=Ae(Te());var HSe=Ae(bi());var Hu=Ae(Te());var ISe=(e,t)=>{let r=e?tr(e):[],n=t?tr(t):[];return n.every(i=>r.some(a=>a==i))&&r.every(i=>n.some(a=>a==i))},d2=(e,t)=>e==t,kv=(e,t)=>(e??"").length==0,BQ=(e,t)=>(e??"").toLowerCase().includes((t??"").toLowerCase()),RQ=(e,t)=>parseFloat(e)>parseFloat(t),$Q=(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()},RSe=(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?tr(e):[],n=t?tr(t):[];return r.length==0?!1:n.some(i=>r.some(a=>a==i))},$Se=(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()},qSe=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()},LSe=(e,t,r,n)=>{if(!e)return!0;let i=Li[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 Li={isNotEmpty:{type:["text","file","number","option","option-multi","link","link-multi","image"],fn:(e,t)=>!kv(e,""),valueType:"none"},isEmpty:{type:["text","file","number","option","option-multi","link","link-multi","image"],fn:(e,t)=>kv(e,""),valueType:"none"},include:{fn:(e,t)=>BQ(e,t),type:["text","file","link","image"],valueType:"text"},notInclude:{type:["text","file","link","image"],fn:(e,t)=>!BQ(e,t),valueType:"text"},is:{type:["text"],fn:(e,t)=>d2(e,t),valueType:"text"},isNot:{type:["text"],fn:(e,t)=>!d2(e,t),valueType:"text"},equal:{type:["number"],fn:(e,t)=>d2(e,t),valueType:"number"},isLink:{type:["link","context"],fn:(e,t)=>d2(e,t),valueType:"link"},isNotLink:{type:["link","context"],fn:(e,t)=>!d2(e,t),valueType:"link"},isGreatThan:{type:["number"],fn:(e,t)=>RQ(e,t),valueType:"number"},isLessThan:{type:["number"],fn:(e,t)=>$Q(e,t),valueType:"number"},isLessThanOrEqual:{type:["number"],fn:(e,t)=>!RQ(e,t),valueType:"number"},isGreatThanOrEqual:{type:["number"],fn:(e,t)=>!$Q(e,t),valueType:"number"},dateBefore:{type:["date"],fn:(e,t)=>RSe(e,t),valueType:"date"},dateAfter:{type:["date"],fn:(e,t)=>BSe(e,t),valueType:"date"},isSameDate:{type:["date"],fn:(e,t)=>$Se(e,t),valueType:"date"},isSameDateAsToday:{type:["date"],fn:(e,t)=>qSe(e,t),valueType:"none"},isExactList:{type:["option","option-multi","link-multi","context-multi","tags-multi"],fn:(e,t)=>ISe(e,t),valueType:"list"},isAnyInList:{type:["option","context","link","option-multi","link-multi","context-multi","tags-multi"],fn:(e,t)=>qQ(e,t),valueType:"list"},isNoneInList:{type:["option","context","link","option-multi","link-multi","context-multi","tags-multi"],fn:(e,t)=>!qQ(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 kZe=(e,t)=>t.reduce((r,n)=>r==!0?!0:e?zSe(e,n):!1,!1),zSe=(e,t)=>{let r=Li[t.fn],n=!0;return r&&(n=r.fn($i(t.field,e[t.field]),t.value)),n},CZe=(e,t)=>t.reduce((r,n)=>r==!1?!1:e?zSe(e,n):!1,!0),USe=(e,t)=>e.reduce((n,i)=>!n||i.filters.length==0?!1:i.type=="any"?kZe(t,i.filters):CZe(t,i.filters),!0);var WSe=Ae(bi());var zQ=e=>ir(e),W5=async(e,t,r)=>{let n=zQ(t);return LQ(e,n,r)},LQ=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,WSe.isArray)(r.result))return await Promise.all(r.result.map(u=>Promise.all(t.children.map(c=>LQ(e,c,o))).then(c=>c[c.length-1])));if(i.schema.id=="filter"&&!USe(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=>LQ(e,l,o)));return s[s.length-1]};var H5=e=>{let t=e.superstate.pathsIndex.get(e.path),[r,n]=(0,Hu.useState)({}),[i,a]=(0,Hu.useState)(),[o,s]=(0,Hu.useState)();(0,Hu.useEffect)(()=>{e.autoTest&&(0,HSe.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 xq(h.type,r[p])?.length>0?{...d,[p]:xq(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 W5(e.superstate,e.code,{props:{},instanceProps:u,iterations:0})),e.type=="script"&&(c=await YS(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 Hu.default.createElement("div",{className:"mk-editor-tester"},o?.length>0?Hu.default.createElement(Hu.default.Fragment,null,"Error:"," ",Hu.default.createElement("span",{style:{color:"var(--mk-ui-text-error)"}},o)):Hu.default.createElement(Hu.default.Fragment,null,"Result:"," ",Hu.default.createElement("span",{style:{color:"var(--mk-ui-text-primary"}},String(i))),!e.autoTest&&Hu.default.createElement("button",{onClick:()=>l()},W.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(uC),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:pQ({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,l2.define(PSe)],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:uC[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(H5,{type:"formula",code:t,autoTest:!0,fields:e.fields,value:e.value,superstate:e.superstate,path:e.path}))};var V5=(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=ir(n.value)?.format;o=_r(e,Zi(s),l)}else o=s??""}catch(s){console.error(s)}return o},_c={values:{label:"Values",type:["any"],fn:e=>kr(e.map(t=>$i("",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 lC(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=>kv(t,"")).length/e.length*100+"%",valueType:"string"},percentageNotEmpty:{label:"Percentage Not Empty",shortLabel:"Not Empty",type:["any"],fn:e=>e.filter(t=>!kv(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=>kv(t,"")).length,valueType:"none"},notEmpty:{label:"Not Empty",type:["any"],fn:e=>e.filter(t=>!kv(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 G5=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:W.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)(()=>mr(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:pr,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=mr(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=mr(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")&&mr(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,W.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,W.labels.propertyValueSpace),Dr.default.createElement("span",null,EJ(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,W.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,W.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,W.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,W.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,W.labels.propertyLookup)),Dr.default.createElement("div",{className:"mk-menu-option",onClick:h=>r(h)},Dr.default.createElement("span",null,W.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(_i,{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,W.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,W.labels.propertyFileProp),Dr.default.createElement("span",null,n.field))):Dr.default.createElement(Dr.default.Fragment,null)};var DZe=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:W.menu.setNone,value:"$fm"}),e.contextPath&&(!e.fileMetadata||e.contextPath!="$fm")&&k.push({name:o0(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=[awe].map((P,q)=>({name:Vo(P,e.superstate),value:P.name,icon:Ri(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(W.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=owe(e.superstate,[...e.superstate.spacesMap.getInverse(j)??[]]).filter(N=>!O.some(D=>D.name==N.name)&&![...m0(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(W.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,pr).then(q=>{e.superstate.spaceManager.saveTable(j,{...q,cols:[...q.cols,...C]},!0)}).then(q=>e.superstate.reloadContextByPath(j,!0)),e.hide();return}e.saveField(n,D[0])&&e.hide()},value:[],showAll:!0,options:[{name:W.labels.all,value:"all",icon:"ui//plus"},qt,...C.map((N,D)=>({id:D+1,name:N.name,value:N,icon:Ri(N)}))],placeholder:W.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":W.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"},W.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"},W.labels.propertyType),Kr.default.createElement("span",null,A.label)),A.multi?Kr.default.createElement("div",{className:"mk-menu-option"},Kr.default.createElement("span",null,W.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(G5,{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,W.buttons.saveProperty)),Kr.default.createElement("div",{className:"mk-menu-option",onClick:k=>e.hide()},Kr.default.createElement("span",null,W.buttons.cancel))))},Nf=(e,t,r,n,i,a)=>e.ui.openCustomMenu(t,Kr.default.createElement(DZe,{superstate:e,...n}),{},r,null,i);var wo=Ae(Te());var VSe=Ae(Te()),gh=e=>VSe.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 UQ=(e,t)=>et?1:0,YC=(e,t)=>e.localeCompare(t,void 0,{numeric:!0,sensitivity:"base"}),GSe=(e,t)=>{let r=e.split("/").pop(),n=t.split("/").pop();return YC(r,n)},QSe=(e,t)=>UQ(parseFloat(e),parseFloat(t)),YSe=(e,t)=>UQ(e=="true"?1:0,t=="true"?1:0),ZSe=(e,t)=>UQ(tr(e).length,tr(t).length),WQ=(e,t)=>Object.keys(Zp).find(r=>Zp[r].type.some(n=>n==e)&&Zp[r].desc==t),Zp={alphabetical:{type:["text","option"],fn:YC,label:W.sortTypes.alphaAsc,desc:!1},reverseAlphabetical:{type:["text","option"],fn:(e,t)=>YC(e,t)*-1,label:W.sortTypes.alphaDesc,desc:!0},linkAlphabetical:{type:["link","context","file","image"],fn:GSe,label:W.sortTypes.alphaAsc,desc:!1},linkReverseAlphabetical:{type:["link","context","file","image"],fn:(e,t)=>GSe(e,t)*-1,label:W.sortTypes.alphaDesc,desc:!0},earliest:{type:["date"],fn:YC,label:W.sortTypes.earliest,desc:!1},latest:{type:["date"],fn:(e,t)=>YC(e,t)*-1,label:W.sortTypes.latest,desc:!0},boolean:{type:["boolean"],fn:YSe,label:W.sortTypes.checkAsc,desc:!1},booleanReverse:{type:["boolean"],fn:(e,t)=>YSe(e,t)*-1,label:W.sortTypes.checkDesc,desc:!0},number:{type:["number"],fn:QSe,label:"1 \u2192 9",desc:!1},reverseNumber:{type:["number"],fn:(e,t)=>QSe(e,t)*-1,label:"9 \u2192 1",desc:!0},count:{type:["option-multi","context-multi","link-multi","tags-multi"],fn:ZSe,label:W.sortTypes.itemsDesc,desc:!0},reverseCount:{type:["option-multi","context-multi","link-multi","tags-multi"],fn:(e,t)=>ZSe(e,t)*-1,label:W.sortTypes.itemsAsc,desc:!1}},XSe=(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(bi()),hi=Ae(Te());var HQ=(e,t)=>Object.keys(t).find(n=>t[n].type.find(i=>i==e)),JSe=e=>Object.keys(e),p2=(e,t)=>Object.keys(t).filter(n=>t[n].type.find(i=>i==e)),KSe=(e,t)=>e.filter(r=>Object.keys(t).find(n=>n==r.fn)),VQ=(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)?KSe(e.filters,Li):[],sort:Array.isArray(e.sort)?KSe(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"?Vy:{...Vy,view:"table"};var Ta=(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:[]}),m2=e=>{let{frameSchemas:t,saveSchema:r,frameSchema:n}=(0,hi.useContext)(Aa),{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=yA,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(Hn(ce));for(let ce of ae.cols)if(ce.type.startsWith("context")){let U=mr(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||(P($),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[Hn(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[Hn(U)]?.rows.findIndex(ie=>ie[mt]==$[mt])??-1,J=u[Hn(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.schemaId==pr&&R.name=="tags")?{...$,tags:(e.superstate.pathsIndex.get($[mt])?.tags??[]).join(", ")}:$;return ae&&LSe(z.find(R=>R.name+R.table==ce.field),ce,U,o.properties)},!0)).filter($=>p?.length>0?r2(p).test(Object.keys($).filter(ae=>ae.charAt(0)!="_").map(ae=>$[ae]).join("|")):!0).sort(($,ae)=>(m?.sort??[]).reduce((ce,U)=>ce==0?XSe(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==pr){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=Vl(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(vk(f,$));return}Y($,J);return}q(vk(f,$));return}let U=I[ae],R=Object.keys($).filter(J=>$[J]!=U[J]);e.superstate.settings.saveAllContextToFrontmatter&&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[Hn(ce)])?.cols.find(ee=>ee.name==$);if(ce==pr&&J&&e.superstate.settings.saveAllContextToFrontmatter&&pi(e.superstate,R??f.rows[U]?.[mt],{[$]:ca(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[Hn(ce)],rows:u[Hn(ce)].rows.map((ie,re)=>ie[mt]==ee?{...ie,[$]:ae}:ie)},Hn(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(e.superstate.settings.saveAllContextToFrontmatter&&pi(e.superstate,J??f.rows[R]?.[mt],{[$]:ca(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[Hn(U)]){let ie=f.rows[R][mt];T({...u[Hn(U)],cols:u[Hn(U)].cols.map(re=>re.name==$?{...re,value:ae}:re),rows:u[Hn(U)].rows.map((re,Ee)=>ie==re[mt]?{...re,[$]:ce}:re)},Hn(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=$i(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=VQ(ce,ae);r(n?{...n,predicate:JSON.stringify(U)}:{id:ji(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=VQ(ir($),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[Hn(ce)]&&(ae=u[Hn(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[Hn(ce)]&&T(R,Hn(ce))},me=$=>ke($),ke=($,ae)=>{let ce,U={...$,name:XA($.name)},R=U.table;if(R==""||R==w?ce=f:u[Hn(R)]&&(ce=u[Hn(R)]),U.name=="")return e.superstate.ui.notify(W.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(W.notice.duplicatePropertyName),!1;if(!ae&&$.schemaId==pr&&$.type.startsWith("option")){let re=kr([...e.superstate.spacesMap.getInverse(w)??[]].flatMap(Ce=>tr(e.superstate.pathsIndex.get(Ce)?.metadata?.property?.[$.name])??[])),Ee=mA(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==pr?Ie(ie):q(ie):u[Hn(R)]&&T(ie,Hn(R)),!0};return hi.default.createElement(Ta.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()),e2e=Ae(bl()),vh=KC.default.createContext({dragNode:null,setDragNode:()=>null,dragActive:!1}),t2e=e=>{let[t,r]=KC.default.useState(null);return Da({onDragCancel:()=>{r(null)},onDragEnd:()=>{r(null)}}),KC.default.createElement(vh.Provider,{value:{dragNode:t,setDragNode:r,dragActive:e.dragActive}},e.children,t&&(0,e2e.createPortal)(KC.default.createElement(Um,{dropAnimation:null,zIndex:1600},t),document.body))};var Qr=Ae(Te());var r2e=Ae(Te()),Io=e=>r2e.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 n2e=e=>{let{pathState:t}=(0,Qr.useContext)($r),{spaceInfo:r}=(0,Qr.useContext)(ur),{predicate:n,savePredicate:i,sortedColumns:a}=(0,Qr.useContext)(Ta),o=(b,v)=>{i({view:"frame",[v]:b})},{frameSchemas:s,saveSchema:l}=(0,Qr.useContext)(Aa),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:W.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=hA(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 nre(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:W.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:W.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:W.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:W.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":W.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??W.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":W.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()}},W.labels.done)),e.editSection=="listItem"&&Qr.default.createElement("div",{className:"mk-editor-context-properties"},Qr.default.createElement("div",{style:{display:"flex"}},W.labels.properties,Qr.default.createElement("div",{"aria-label":W.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}=Ws({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 Da({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(Ri(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(Ri(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 Cv(e,t){return typeof e=="function"?e(t):e}function Tf(e,t){return r=>{t.setState(n=>({...n,[e]:Cv(r,n[e])}))}}function X5(e){return e instanceof Function}function OZe(e){return Array.isArray(e)&&e.every(t=>typeof t=="number")}function o2e(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 T5(r,t?t.state.tabSize:4,t?O5(t.state):2);if(o.eol())a.blankLine(this.state,o.indentUnit);else for(;!o.eol();){let s=Hwe(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 mQ=Object.create(null),RC=[Dl.none],NYe=new i2(RC),kwe=[],Cwe=Object.create(null),Vwe=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"]])Vwe[e]=Gwe(mQ,t);var F5=class{constructor(t){this.extra=t,this.table=Object.assign(Object.create(null),Vwe)}resolve(t){return t?this.table[t]||(this.table[t]=Gwe(this.extra,t)):0}},TYe=new F5(mQ);function nQ(e,t){kwe.indexOf(e)>-1||(kwe.push(e),console.warn(t))}function Gwe(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):nQ(u,`Modifier ${u} used at start of tag`):l.length?nQ(u,`Tag ${u} used as modifier`):l=Array.isArray(c)?c:[c]:nQ(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=Cwe[i];if(a)return a.id;let o=Cwe[i]=Dl.define({id:RC.length,name:n,props:[mwe({[n]:r})]});return RC.push(o),o.id}function FYe(e){let t=Dl.define({id:RC.length,name:"Document",props:[s2.add(()=>e)],top:!0});return RC.push(t),t}var YKt={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 Qwe=require("@codemirror/view");var Ywe=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=Qwe.EditorView.theme(i,{dark:t==="dark"}),l=Wd.define(n),u=[s,eg(l)];return u};var _Ye={background:"#0f0f0f",foreground:"#defdef",caret:"#00FF00",selection:"#515151",selectionMatch:"#515151",gutterBackground:"#555",gutterForeground:"#FFFFFF",lineHighlight:"#0a6bcb3d"},hQ=e=>{var{theme:t="dark",settings:r={},styles:n=[]}=e||{};return Ywe({theme:t,settings:Fn({},_Ye,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]})},oJt=hQ();var En={};fM(En,{basicSetup:()=>L5,color:()=>AZe,default:()=>VC,defaultLightThemeOption:()=>TQ,getDefaultExtensions:()=>FQ,getStatistics:()=>_Q,minimalSetup:()=>hZe,oneDark:()=>NQ,oneDarkHighlightStyle:()=>kSe,oneDarkTheme:()=>ESe,useCodeMirror:()=>PQ});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 f2=Ae(Te());var Yp=Ae(Te()),Zy=require("@codemirror/state"),HC=require("@codemirror/view");var DSe=require("@codemirror/commands");var Po=require("@codemirror/view"),pSe=require("@codemirror/state"),tg=require("@codemirror/commands"),q5=require("@codemirror/search");var Xt=require("@codemirror/state"),bo=require("@codemirror/view");var I5=class{constructor(t,r,n){this.state=t,this.pos=r,this.explicit=n,this.abortListeners=[]}tokenBefore(t){let r=Xs(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(nSe(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 Zwe(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 PYe(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+$/]:PYe(t);return i=>{let a=i.matchBefore(n);return a||i.explicit?{from:a?a.from:i.pos,options:t,validFor:r}:null}}var B5=class{constructor(t,r,n,i){this.completion=t,this.source=r,this.match=n,this.score=i}};function Sv(e){return e.selection.main.from}function nSe(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 BYe=Xt.Annotation.define();function RYe(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 Xwe=new WeakMap;function $Ye(e){if(!Array.isArray(e))return e;let t=Xwe.get(e);return t||Xwe.set(e,t=IYe(e)),t}var R5=Xt.StateEffect.define(),zC=Xt.StateEffect.define(),vQ=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)}},yQ=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:qYe,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=>Kwe(t(n),r(n)),optionClass:(t,r)=>n=>Kwe(t(n),r(n)),addToOptions:(t,r)=>t.concat(r),filterStrict:(t,r)=>t||r})}});function Kwe(e,t){return e?t?e+" "+t:e:t}function qYe(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 LYe(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 AQ(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 bQ=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=LYe(s),this.optionClass=s.optionClass,this.tooltipClass=s.tooltipClass,this.range=AQ(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=AQ(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=AQ(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&&UYe(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 bQ(r,e,t)}function UYe(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 Jwe(e){return(e.boost||0)*100+(e.apply?10:0)+(e.info?5:0)+(e.type?1:0)}function WYe(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 B5(f,u.source,c?c(f):[],1e9-r.length));else{let f=t.sliceDoc(u.from,u.to),d,p=a.filterStrict?new yQ(f):new vQ(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 B5(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):Jwe(u.completion)>Jwe(s)&&(o[o.length-1]=u),s=u.completion}return o}var wv=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 wv(this.options,eSe(r,t),this.tooltip,this.timestamp,t,this.disabled)}static build(t,r,n,i,a){let o=WYe(t,r);if(!o.length)return i&&t.some(l=>l.state==1)?new wv(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:YYe,above:a.aboveCursor},i?i.timestamp:Date.now(),s,!1)}map(t){return new wv(this.options,this.attrs,Object.assign(Object.assign({},this.tooltip),{pos:t.mapPos(this.tooltip.pos)}),this.timestamp,this.selected,this.disabled)}},u2=class{constructor(t,r,n){this.active=t,this.id=r,this.open=n}static start(){return new u2(GYe,"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",Sv(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))||!HYe(a,this.active)?o=wv.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(aSe)&&(o=o&&o.setSelected(s.value,this.id));return a==this.active&&o==this.open?this:new u2(a,this.id,o)}get tooltip(){return this.open?this.open.tooltip:null}get attrs(){return this.open?this.open.attrs:VYe}};function HYe(e,t){if(e==t)return!0;for(let r=0,n=0;;){for(;r-1&&(r["aria-activedescendant"]=e+"-"+t),r}var GYe=[];function xQ(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=xQ(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(R5))i=new Ol(i.source,1,a.value?Sv(t.state):-1);else if(a.is(zC))i=new Ol(i.source,0);else if(a.is(iSe))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(Sv(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))}},Ev=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=Sv(t.state);if((this.explicitPos<0?l<=o:ls||!a||r=="delete"&&Sv(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 QYe(a.validFor,t.state,o,s)?new Ev(this.source,u,a,o,s):a.update&&(a=a.update(a,o,s,new I5(t.state,l,u>=0)))?new Ev(this.source,u,a,a.from,(i=a.to)!==null&&i!==void 0?i:Sv(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 Ev(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 QYe(e,t,r,n){if(!e)return!1;let i=t.sliceDoc(r,n);return typeof e=="function"?e(i,r,n,t):nSe(e,!0).test(i)}var iSe=Xt.StateEffect.define({map(e,t){return e.map(r=>r.map(t))}}),aSe=Xt.StateEffect.define(),Fc=Xt.StateField.define({create(){return u2.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 SQ(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 Ev?(typeof r=="string"?e.dispatch(Object.assign(Object.assign({},RYe(e.state,r,n.from,n.to)),{annotations:BYe.of(t.completion)})):r(e,t.completion,n.from,n.to),!0):!1}var YYe=zYe(Fc,SQ);function P5(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:aSe.of(s)}),!0}}var ZYe=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:R5.of(!0)}),!0):!1,KYe=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)},wQ=class{constructor(t,r){this.active=t,this.context=r,this.time=Date.now(),this.updates=[],this.done=void 0}},JYe=50,eZe=1e3,tZe=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)&&!xQ(i));for(let i=0;iJYe&&Date.now()-a.time>eZe){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(R5)))&&(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)xQ(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=Sv(t),n=new I5(t,r,e.explicitPos==r),i=new wQ(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:iSe.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:R5.of(!1)}),20),this.composing=0}}}),rZe=typeof navigator=="object"&&/Win/.test(navigator.platform),nZe=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&&!(rZe&&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&&SQ(t,n),!1}})),iZe=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:[]},Yy=Xt.StateEffect.define({map(e,t){let r=t.mapPos(e,-1,Xt.MapMode.TrackAfter);return r??void 0}}),EQ=new class extends Xt.RangeValue{};EQ.startSide=1;EQ.endSide=-1;var oSe=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(Yy)&&(e=e.update({add:[EQ.range(r.value,r.value+1)]}));return e}});function sSe(){return[oZe,oSe]}var gQ="()[]{}<>";function lSe(e){for(let t=0;t{if((aZe?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=lZe(e.state,n);return a?(e.dispatch(a),!0):!1}),sZe=({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=uSe(e,e.selection.main.head).brackets||UC.brackets,i=null,a=e.changeByRange(o=>{if(o.empty){let s=uZe(e.doc,o.head);for(let l of n)if(l==s&&$5(e.doc,o.head)==lSe((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},cSe=[{key:"Backspace",run:sZe}];function lZe(e,t){let r=uSe(e,e.selection.main.head),n=r.brackets||UC.brackets;for(let i of n){let a=lSe((0,Xt.codePointAt)(i,0));if(t==i)return a==i?dZe(e,i,n.indexOf(i+i+i)>-1,r):cZe(e,i,a,r.before||UC.before);if(t==a&&fSe(e,e.selection.main.from))return fZe(e,i,a)}return null}function fSe(e,t){let r=!1;return e.field(oSe).between(0,e.doc.length,n=>{n==t&&(r=!0)}),r}function $5(e,t){let r=e.sliceString(t,t+2);return r.slice(0,(0,Xt.codePointSize)((0,Xt.codePointAt)(r,0)))}function uZe(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 cZe(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:Yy.of(o.to+t.length),range:Xt.EditorSelection.range(o.anchor+t.length,o.head+t.length)};let s=$5(e.doc,o.head);return!s||/\s/.test(s)||n.indexOf(s)>-1?{changes:{insert:t+r,from:o.head},effects:Yy.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 fZe(e,t,r){let n=null,i=e.changeByRange(a=>a.empty&&$5(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 dZe(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:Yy.of(s.to+t.length),range:Xt.EditorSelection.range(s.anchor+t.length,s.head+t.length)};let l=s.head,u=$5(e.doc,l),c;if(u==t){if(tSe(e,l))return{changes:{insert:t+t,from:l},effects:Yy.of(l+t.length),range:Xt.EditorSelection.cursor(l+t.length)};if(fSe(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=rSe(e,l-2*t.length,i))>-1&&tSe(e,c))return{changes:{insert:t+t+t+t,from:l},effects:Yy.of(l+t.length),range:Xt.EditorSelection.cursor(l+t.length)};if(e.charCategorizer(l)(u)!=Xt.CharCategory.Word&&rSe(e,l,i)>-1&&!pZe(e,l,t,i))return{changes:{insert:t+t,from:l},effects:Yy.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 tSe(e,t){let r=Xs(e).resolveInner(t+1);return r.parent&&r.from==t}function pZe(e,t,r,n){let i=Xs(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 rSe(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 dSe(e={}){return[nZe,Fc,Ml.of(e),tZe,mZe,iZe]}var kQ=[{key:"Ctrl-Space",run:XYe},{key:"Escape",run:KYe},{key:"ArrowDown",run:P5(!0)},{key:"ArrowUp",run:P5(!1)},{key:"PageDown",run:P5(!0,"page")},{key:"PageUp",run:P5(!1,"page")},{key:"Enter",run:ZYe}],mZe=Xt.Prec.highest(bo.keymap.computeN([Ml],e=>e.facet(Ml).defaultKeymap?[kQ]:[]));var mSe=require("@codemirror/lint"),L5=function(t){t===void 0&&(t={});var{crosshairCursor:r=!1}=t,n=[];t.closeBracketsKeymap!==!1&&(n=n.concat(cSe)),t.defaultKeymap!==!1&&(n=n.concat(tg.defaultKeymap)),t.searchKeymap!==!1&&(n=n.concat(q5.searchKeymap)),t.historyKeymap!==!1&&(n=n.concat(tg.historyKeymap)),t.foldKeymap!==!1&&(n=n.concat(Pwe)),t.completionKeymap!==!1&&(n=n.concat(kQ)),t.lintKeymap!==!1&&(n=n.concat(mSe.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,tg.history)()),t.foldGutter!==!1&&i.push(Rwe()),t.drawSelection!==!1&&i.push((0,Po.drawSelection)()),t.dropCursor!==!1&&i.push((0,Po.dropCursor)()),t.allowMultipleSelections!==!1&&i.push(pSe.EditorState.allowMultipleSelections.of(!0)),t.indentOnInput!==!1&&i.push(jwe()),t.syntaxHighlighting!==!1&&i.push(eg(dQ,{fallback:!0})),t.bracketMatching!==!1&&i.push(Uwe()),t.closeBrackets!==!1&&i.push(sSe()),t.autocompletion!==!1&&i.push(dSe()),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,q5.highlightSelectionMatches)()),t.tabSize&&typeof t.tabSize=="number"&&i.push($C.of(" ".repeat(t.tabSize))),i.concat([Po.keymap.of(n.flat())]).filter(Boolean)},hZe=function(t){t===void 0&&(t={});var r=[];t.defaultKeymap!==!1&&(r=r.concat(tg.defaultKeymap)),t.historyKeymap!==!1&&(r=r.concat(tg.historyKeymap));var n=[];return t.highlightSpecialChars!==!1&&n.push((0,Po.highlightSpecialChars)()),t.history!==!1&&n.push((0,tg.history)()),t.drawSelection!==!1&&n.push((0,Po.drawSelection)()),t.syntaxHighlighting!==!1&&n.push(eg(dQ,{fallback:!0})),n.concat([Po.keymap.of(r.flat())]).filter(Boolean)};var c2=require("@codemirror/view");var hSe=require("@codemirror/view");var ASe="#e5c07b",CQ="#e06c75",gSe="#56b6c2",vSe="#ffffff",WC="#abb2bf",U5="#7d8799",ySe="#61afef",bSe="#98c379",DQ="#d19a66",xSe="#c678dd",wSe="#21252b",OQ="#2c313a",MQ="#282c34",z5="#353a42",SSe="#3E4451",jQ="#528bff",AZe={chalky:ASe,coral:CQ,cyan:gSe,invalid:vSe,ivory:WC,stone:U5,malibu:ySe,sage:bSe,whiskey:DQ,violet:xSe,darkBackground:wSe,highlightBackground:OQ,background:MQ,tooltipBackground:z5,selection:SSe,cursor:jQ},ESe=hSe.EditorView.theme({"&":{color:WC,backgroundColor:MQ},".cm-content":{caretColor:jQ},".cm-cursor, .cm-dropCursor":{borderLeftColor:jQ},"&.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection":{backgroundColor:SSe},".cm-panels":{backgroundColor:wSe,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:MQ,color:U5,border:"none"},".cm-activeLineGutter":{backgroundColor:OQ},".cm-foldPlaceholder":{backgroundColor:"transparent",border:"none",color:"#ddd"},".cm-tooltip":{border:"none",backgroundColor:z5},".cm-tooltip .cm-tooltip-arrow:before":{borderTopColor:"transparent",borderBottomColor:"transparent"},".cm-tooltip .cm-tooltip-arrow:after":{borderTopColor:z5,borderBottomColor:z5},".cm-tooltip-autocomplete":{"& > ul > li[aria-selected]":{backgroundColor:OQ,color:WC}}},{dark:!0}),kSe=Wd.define([{tag:qe.keyword,color:xSe},{tag:[qe.name,qe.deleted,qe.character,qe.propertyName,qe.macroName],color:CQ},{tag:[qe.function(qe.variableName),qe.labelName],color:ySe},{tag:[qe.color,qe.constant(qe.name),qe.standard(qe.name)],color:DQ},{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:ASe},{tag:[qe.operator,qe.operatorKeyword,qe.url,qe.escape,qe.regexp,qe.link,qe.special(qe.string)],color:gSe},{tag:[qe.meta,qe.comment],color:U5},{tag:qe.strong,fontWeight:"bold"},{tag:qe.emphasis,fontStyle:"italic"},{tag:qe.strikethrough,textDecoration:"line-through"},{tag:qe.link,color:U5,textDecoration:"underline"},{tag:qe.heading,fontWeight:"bold",color:CQ},{tag:[qe.atom,qe.bool,qe.special(qe.variableName)],color:DQ},{tag:[qe.processingInstruction,qe.string,qe.inserted],color:bSe},{tag:qe.invalid,color:vSe}]),NQ=[ESe,eg(kSe)];var OSe=require("@codemirror/state");var CSe=require("@codemirror/view"),TQ=CSe.EditorView.theme({"&":{backgroundColor:"#fff"}},{dark:!1});var FQ=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(c2.keymap.of([DSe.indentWithTab])),s&&(typeof s=="boolean"?l.unshift(L5()):l.unshift(L5(s))),o&&l.unshift((0,c2.placeholder)(o)),a){case"light":l.push(TQ);break;case"dark":l.push(NQ);break;case"none":break;default:l.push(a);break}return n===!1&&l.push(c2.EditorView.editable.of(!1)),i&&l.push(OSe.EditorState.readOnly.of(!0)),[...l]};var _Q=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 MSe=Zy.Annotation.define(),gZe=[];function PQ(e){var{value:t,selection:r,onChange:n,onStatistics:i,onCreateEditor:a,onUpdate:o,extensions:s=gZe,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(MSe))){var L=T.state.doc,_=L.toString();n(_,T)}i&&i(_Q(T))}),z=FQ({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?Zy.EditorState.fromJSON(S.json,T,S.fields):Zy.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:Zy.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:[MSe.of(!0)]})}},[t,O]),{state:N,setState:D,view:O,setView:C,container:k,setContainer:j}}var jSe=Ae(KA());li(En,require("@codemirror/view"));li(En,require("@codemirror/state"));var vZe=["className","value","selection","extensions","onChange","onStatistics","onCreateEditor","onUpdate","autoFocus","theme","height","minHeight","maxHeight","width","minWidth","maxWidth","basicSetup","placeholder","indentWithTab","editable","readOnly","root","initialState"],NSe=(0,f2.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,vZe),C=(0,f2.useRef)(null),{state:N,view:D,container:P}=PQ({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,f2.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,jSe.jsx)("div",Fn({ref:C,className:""+q+(r?" "+r:"")},O))});NSe.displayName="CodeMirror";var VC=NSe;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"]},IQ=(()=>{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())]})(),BQ="today|tomorrow|now|time|yesterday|sum|total|average|avg".split("|"),RQ="in|to|last|off|of|mod|xor|or|ago".split("|"),yZe=[...IQ,...BQ,...GC.functions,...RQ,...Object.keys(uC)],LJt=yZe.sort((e,t)=>e.length-t.length).filter(e=>e.length>0),TSe=GC.functions,FSe=GC.constants;function QC(e){let t={};for(let r=0;r/:^%!]/;function kZe(e,t){let r=e.next();if(r=="#"||r=="/"&&e.eat("/"))return e.skipToEnd(),"comment";if(r=='"'||r=="'")return t.tokenize=CZe(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(_Se.test(r))return e.eatWhile(_Se),"operator";e.eatWhile(/[\w_]/);let n=e.current();return Object.hasOwn(bZe,n)?"operatorKeyword":Object.hasOwn(xZe,n)||Object.hasOwn(EZe,n)?"variableName.standard":Object.hasOwn(SZe,n)?"variableName.special":Object.hasOwn(wZe,n)?"function":e.peek()==="("?"variableName.definition":"variable"}function CZe(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 PSe={name:"mkformula",startState:function(){return{tokenize:null}},token:function(e,t){if(e.eatSpace())return null;let r=(t.tokenize||kZe)(e,t);return r=="comment"||r=="meta",r},languageData:{autocomplete:Object.keys(cC),closeBrackets:{brackets:["(","[","{","'",'"',"`"]},commentTokens:{line:"#"}}};var cn=Ae(Te());var HSe=Ae(bi());var Hu=Ae(Te());var ISe=(e,t)=>{let r=e?tr(e):[],n=t?tr(t):[];return n.every(i=>r.some(a=>a==i))&&r.every(i=>n.some(a=>a==i))},d2=(e,t)=>e==t,kv=(e,t)=>(e??"").length==0,$Q=(e,t)=>(e??"").toLowerCase().includes((t??"").toLowerCase()),qQ=(e,t)=>parseFloat(e)>parseFloat(t),LQ=(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()},RSe=(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?tr(e):[],n=t?tr(t):[];return r.length==0?!1:n.some(i=>r.some(a=>a==i))},$Se=(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()},qSe=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()},LSe=(e,t,r,n)=>{if(!e)return!0;let i=Li[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 Li={isNotEmpty:{type:["text","file","number","option","option-multi","link","link-multi","image"],fn:(e,t)=>!kv(e,""),valueType:"none"},isEmpty:{type:["text","file","number","option","option-multi","link","link-multi","image"],fn:(e,t)=>kv(e,""),valueType:"none"},include:{fn:(e,t)=>$Q(e,t),type:["text","file","link","image"],valueType:"text"},notInclude:{type:["text","file","link","image"],fn:(e,t)=>!$Q(e,t),valueType:"text"},is:{type:["text"],fn:(e,t)=>d2(e,t),valueType:"text"},isNot:{type:["text"],fn:(e,t)=>!d2(e,t),valueType:"text"},equal:{type:["number"],fn:(e,t)=>d2(e,t),valueType:"number"},isLink:{type:["link","context"],fn:(e,t)=>d2(e,t),valueType:"link"},isNotLink:{type:["link","context"],fn:(e,t)=>!d2(e,t),valueType:"link"},isGreatThan:{type:["number"],fn:(e,t)=>qQ(e,t),valueType:"number"},isLessThan:{type:["number"],fn:(e,t)=>LQ(e,t),valueType:"number"},isLessThanOrEqual:{type:["number"],fn:(e,t)=>!qQ(e,t),valueType:"number"},isGreatThanOrEqual:{type:["number"],fn:(e,t)=>!LQ(e,t),valueType:"number"},dateBefore:{type:["date"],fn:(e,t)=>RSe(e,t),valueType:"date"},dateAfter:{type:["date"],fn:(e,t)=>BSe(e,t),valueType:"date"},isSameDate:{type:["date"],fn:(e,t)=>$Se(e,t),valueType:"date"},isSameDateAsToday:{type:["date"],fn:(e,t)=>qSe(e,t),valueType:"none"},isExactList:{type:["option","option-multi","link-multi","context-multi","tags-multi"],fn:(e,t)=>ISe(e,t),valueType:"list"},isAnyInList:{type:["option","context","link","option-multi","link-multi","context-multi","tags-multi"],fn:(e,t)=>zQ(e,t),valueType:"list"},isNoneInList:{type:["option","context","link","option-multi","link-multi","context-multi","tags-multi"],fn:(e,t)=>!zQ(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 DZe=(e,t)=>t.reduce((r,n)=>r==!0?!0:e?zSe(e,n):!1,!1),zSe=(e,t)=>{let r=Li[t.fn],n=!0;return r&&(n=r.fn($i(t.field,e[t.field]),t.value)),n},OZe=(e,t)=>t.reduce((r,n)=>r==!1?!1:e?zSe(e,n):!1,!0),USe=(e,t)=>e.reduce((n,i)=>!n||i.filters.length==0?!1:i.type=="any"?DZe(t,i.filters):OZe(t,i.filters),!0);var WSe=Ae(bi());var WQ=e=>ir(e),W5=async(e,t,r)=>{let n=WQ(t);return UQ(e,n,r)},UQ=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,WSe.isArray)(r.result))return await Promise.all(r.result.map(u=>Promise.all(t.children.map(c=>UQ(e,c,o))).then(c=>c[c.length-1])));if(i.schema.id=="filter"&&!USe(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=>UQ(e,l,o)));return s[s.length-1]};var H5=e=>{let t=e.superstate.pathsIndex.get(e.path),[r,n]=(0,Hu.useState)({}),[i,a]=(0,Hu.useState)(),[o,s]=(0,Hu.useState)();(0,Hu.useEffect)(()=>{e.autoTest&&(0,HSe.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 xq(h.type,r[p])?.length>0?{...d,[p]:xq(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 W5(e.superstate,e.code,{props:{},instanceProps:u,iterations:0})),e.type=="script"&&(c=await YS(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 Hu.default.createElement("div",{className:"mk-editor-tester"},o?.length>0?Hu.default.createElement(Hu.default.Fragment,null,"Error:"," ",Hu.default.createElement("span",{style:{color:"var(--mk-ui-text-error)"}},o)):Hu.default.createElement(Hu.default.Fragment,null,"Result:"," ",Hu.default.createElement("span",{style:{color:"var(--mk-ui-text-primary"}},String(i))),!e.autoTest&&Hu.default.createElement("button",{onClick:()=>l()},W.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(uC),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:hQ({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,l2.define(PSe)],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:uC[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(H5,{type:"formula",code:t,autoTest:!0,fields:e.fields,value:e.value,superstate:e.superstate,path:e.path}))};var V5=(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=ir(n.value)?.format;o=_r(e,Zi(s),l)}else o=s??""}catch(s){console.error(s)}return o},_c={values:{label:"Values",type:["any"],fn:e=>kr(e.map(t=>$i("",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 lC(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=>kv(t,"")).length/e.length*100+"%",valueType:"string"},percentageNotEmpty:{label:"Percentage Not Empty",shortLabel:"Not Empty",type:["any"],fn:e=>e.filter(t=>!kv(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=>kv(t,"")).length,valueType:"none"},notEmpty:{label:"Not Empty",type:["any"],fn:e=>e.filter(t=>!kv(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 G5=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:W.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)(()=>mr(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:pr,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=mr(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=mr(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")&&mr(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,W.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,W.labels.propertyValueSpace),Dr.default.createElement("span",null,CJ(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,W.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,W.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,W.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,W.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,W.labels.propertyLookup)),Dr.default.createElement("div",{className:"mk-menu-option",onClick:h=>r(h)},Dr.default.createElement("span",null,W.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(_i,{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,W.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,W.labels.propertyFileProp),Dr.default.createElement("span",null,n.field))):Dr.default.createElement(Dr.default.Fragment,null)};var MZe=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:W.menu.setNone,value:"$fm"}),e.contextPath&&(!e.fileMetadata||e.contextPath!="$fm")&&k.push({name:o0(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=[awe].map((P,q)=>({name:Vo(P,e.superstate),value:P.name,icon:Ri(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(W.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=owe(e.superstate,[...e.superstate.spacesMap.getInverse(j)??[]]).filter(N=>!O.some(D=>D.name==N.name)&&![...m0(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(W.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,pr).then(q=>{e.superstate.spaceManager.saveTable(j,{...q,cols:[...q.cols,...C]},!0)}).then(q=>e.superstate.reloadContextByPath(j,!0)),e.hide();return}e.saveField(n,D[0])&&e.hide()},value:[],showAll:!0,options:[{name:W.labels.all,value:"all",icon:"ui//plus"},qt,...C.map((N,D)=>({id:D+1,name:N.name,value:N,icon:Ri(N)}))],placeholder:W.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":W.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"},W.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"},W.labels.propertyType),Kr.default.createElement("span",null,A.label)),A.multi?Kr.default.createElement("div",{className:"mk-menu-option"},Kr.default.createElement("span",null,W.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(G5,{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,W.buttons.saveProperty)),Kr.default.createElement("div",{className:"mk-menu-option",onClick:k=>e.hide()},Kr.default.createElement("span",null,W.buttons.cancel))))},Nf=(e,t,r,n,i,a)=>e.ui.openCustomMenu(t,Kr.default.createElement(MZe,{superstate:e,...n}),{},r,null,i);var wo=Ae(Te());var VSe=Ae(Te()),gh=e=>VSe.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 HQ=(e,t)=>et?1:0,YC=(e,t)=>e.localeCompare(t,void 0,{numeric:!0,sensitivity:"base"}),GSe=(e,t)=>{let r=e.split("/").pop(),n=t.split("/").pop();return YC(r,n)},QSe=(e,t)=>HQ(parseFloat(e),parseFloat(t)),YSe=(e,t)=>HQ(e=="true"?1:0,t=="true"?1:0),ZSe=(e,t)=>HQ(tr(e).length,tr(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:YC,label:W.sortTypes.alphaAsc,desc:!1},reverseAlphabetical:{type:["text","option"],fn:(e,t)=>YC(e,t)*-1,label:W.sortTypes.alphaDesc,desc:!0},linkAlphabetical:{type:["link","context","file","image"],fn:GSe,label:W.sortTypes.alphaAsc,desc:!1},linkReverseAlphabetical:{type:["link","context","file","image"],fn:(e,t)=>GSe(e,t)*-1,label:W.sortTypes.alphaDesc,desc:!0},earliest:{type:["date"],fn:YC,label:W.sortTypes.earliest,desc:!1},latest:{type:["date"],fn:(e,t)=>YC(e,t)*-1,label:W.sortTypes.latest,desc:!0},boolean:{type:["boolean"],fn:YSe,label:W.sortTypes.checkAsc,desc:!1},booleanReverse:{type:["boolean"],fn:(e,t)=>YSe(e,t)*-1,label:W.sortTypes.checkDesc,desc:!0},number:{type:["number"],fn:QSe,label:"1 \u2192 9",desc:!1},reverseNumber:{type:["number"],fn:(e,t)=>QSe(e,t)*-1,label:"9 \u2192 1",desc:!0},count:{type:["option-multi","context-multi","link-multi","tags-multi"],fn:ZSe,label:W.sortTypes.itemsDesc,desc:!0},reverseCount:{type:["option-multi","context-multi","link-multi","tags-multi"],fn:(e,t)=>ZSe(e,t)*-1,label:W.sortTypes.itemsAsc,desc:!1}},XSe=(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(bi()),hi=Ae(Te());var GQ=(e,t)=>Object.keys(t).find(n=>t[n].type.find(i=>i==e)),JSe=e=>Object.keys(e),p2=(e,t)=>Object.keys(t).filter(n=>t[n].type.find(i=>i==e)),KSe=(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)?KSe(e.filters,Li):[],sort:Array.isArray(e.sort)?KSe(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"?Vy:{...Vy,view:"table"};var Ta=(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:[]}),m2=e=>{let{frameSchemas:t,saveSchema:r,frameSchema:n}=(0,hi.useContext)(Aa),{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=yA,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(Hn(ce));for(let ce of ae.cols)if(ce.type.startsWith("context")){let U=mr(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||(P($),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[Hn(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[Hn(U)]?.rows.findIndex(ie=>ie[mt]==$[mt])??-1,J=u[Hn(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.schemaId==pr&&R.name=="tags")?{...$,tags:(e.superstate.pathsIndex.get($[mt])?.tags??[]).join(", ")}:$;return ae&&LSe(z.find(R=>R.name+R.table==ce.field),ce,U,o.properties)},!0)).filter($=>p?.length>0?r2(p).test(Object.keys($).filter(ae=>ae.charAt(0)!="_").map(ae=>$[ae]).join("|")):!0).sort(($,ae)=>(m?.sort??[]).reduce((ce,U)=>ce==0?XSe(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==pr){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=Vl(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(vk(f,$));return}Y($,J);return}q(vk(f,$));return}let U=I[ae],R=Object.keys($).filter(J=>$[J]!=U[J]);e.superstate.settings.saveAllContextToFrontmatter&&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[Hn(ce)])?.cols.find(ee=>ee.name==$);if(ce==pr&&J&&e.superstate.settings.saveAllContextToFrontmatter&&pi(e.superstate,R??f.rows[U]?.[mt],{[$]:ca(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[Hn(ce)],rows:u[Hn(ce)].rows.map((ie,re)=>ie[mt]==ee?{...ie,[$]:ae}:ie)},Hn(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(e.superstate.settings.saveAllContextToFrontmatter&&pi(e.superstate,J??f.rows[R]?.[mt],{[$]:ca(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[Hn(U)]){let ie=f.rows[R][mt];T({...u[Hn(U)],cols:u[Hn(U)].cols.map(re=>re.name==$?{...re,value:ae}:re),rows:u[Hn(U)].rows.map((re,Ee)=>ie==re[mt]?{...re,[$]:ce}:re)},Hn(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=$i(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:ji(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(ir($),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[Hn(ce)]&&(ae=u[Hn(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[Hn(ce)]&&T(R,Hn(ce))},me=$=>ke($),ke=($,ae)=>{let ce,U={...$,name:XA($.name)},R=U.table;if(R==""||R==w?ce=f:u[Hn(R)]&&(ce=u[Hn(R)]),U.name=="")return e.superstate.ui.notify(W.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(W.notice.duplicatePropertyName),!1;if(!ae&&$.schemaId==pr&&$.type.startsWith("option")){let re=kr([...e.superstate.spacesMap.getInverse(w)??[]].flatMap(Ce=>tr(e.superstate.pathsIndex.get(Ce)?.metadata?.property?.[$.name])??[])),Ee=mA(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==pr?Ie(ie):q(ie):u[Hn(R)]&&T(ie,Hn(R)),!0};return hi.default.createElement(Ta.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()),e2e=Ae(bl()),vh=KC.default.createContext({dragNode:null,setDragNode:()=>null,dragActive:!1}),t2e=e=>{let[t,r]=KC.default.useState(null);return Da({onDragCancel:()=>{r(null)},onDragEnd:()=>{r(null)}}),KC.default.createElement(vh.Provider,{value:{dragNode:t,setDragNode:r,dragActive:e.dragActive}},e.children,t&&(0,e2e.createPortal)(KC.default.createElement(Um,{dropAnimation:null,zIndex:1600},t),document.body))};var Qr=Ae(Te());var r2e=Ae(Te()),Io=e=>r2e.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 n2e=e=>{let{pathState:t}=(0,Qr.useContext)($r),{spaceInfo:r}=(0,Qr.useContext)(ur),{predicate:n,savePredicate:i,sortedColumns:a}=(0,Qr.useContext)(Ta),o=(b,v)=>{i({view:"frame",[v]:b})},{frameSchemas:s,saveSchema:l}=(0,Qr.useContext)(Aa),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:W.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=hA(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 are(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:W.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:W.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:W.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:W.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":W.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??W.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":W.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()}},W.labels.done)),e.editSection=="listItem"&&Qr.default.createElement("div",{className:"mk-editor-context-properties"},Qr.default.createElement("div",{style:{display:"flex"}},W.labels.properties,Qr.default.createElement("div",{"aria-label":W.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}=Ws({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 Da({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(Ri(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(Ri(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 Cv(e,t){return typeof e=="function"?e(t):e}function Tf(e,t){return r=>{t.setState(n=>({...n,[e]:Cv(r,n[e])}))}}function X5(e){return e instanceof Function}function jZe(e){return Array.isArray(e)&&e.every(t=>typeof t=="number")}function o2e(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 MZe(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 jZe(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 i2e(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 NZe={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 Q5(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))),Q5(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 Q5(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 Q5(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 Q5(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=i2e(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)=>i2e(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 s2e=(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:()=>o2e(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=>MZe(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()}}},l2e=(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))};l2e.autoRemove=e=>Xp(e);var u2e=(e,t,r)=>{var n;return Boolean((n=e.getValue(t))==null||(n=n.toString())==null?void 0:n.includes(r))};u2e.autoRemove=e=>Xp(e);var c2e=(e,t,r)=>{var n;return((n=e.getValue(t))==null||(n=n.toString())==null?void 0:n.toLowerCase())===r?.toLowerCase()};c2e.autoRemove=e=>Xp(e);var f2e=(e,t,r)=>{var n;return(n=e.getValue(t))==null?void 0:n.includes(r)};f2e.autoRemove=e=>Xp(e)||!(e!=null&&e.length);var d2e=(e,t,r)=>!r.some(n=>{var i;return!((i=e.getValue(t))!=null&&i.includes(n))});d2e.autoRemove=e=>Xp(e)||!(e!=null&&e.length);var p2e=(e,t,r)=>r.some(n=>{var i;return(i=e.getValue(t))==null?void 0:i.includes(n)});p2e.autoRemove=e=>Xp(e)||!(e!=null&&e.length);var m2e=(e,t,r)=>e.getValue(t)===r;m2e.autoRemove=e=>Xp(e);var h2e=(e,t,r)=>e.getValue(t)==r;h2e.autoRemove=e=>Xp(e);var aY=(e,t,r)=>{let[n,i]=r,a=e.getValue(t);return a>=n&&a<=i};aY.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]};aY.autoRemove=e=>Xp(e)||Xp(e[0])&&Xp(e[1]);var rg={includesString:l2e,includesStringSensitive:u2e,equalsString:c2e,arrIncludes:f2e,arrIncludesAll:d2e,arrIncludesSome:p2e,equals:m2e,weakEquals:h2e,inNumberRange:aY};function Xp(e){return e==null||e===""}var FZe={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"?rg.includesString:typeof n=="number"?rg.inNumberRange:typeof n=="boolean"||n!==null&&typeof n=="object"?rg.equals:Array.isArray(n)?rg.arrIncludes:rg.weakEquals},e.getFilterFn=()=>{var r,n;return X5(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:rg[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=Cv(r,a?a.value:void 0);if(a2e(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=Cv(t,i))==null?void 0:a.filter(o=>{let s=r.find(l=>l.id===o.id);if(s){let l=s.getFilterFn();if(a2e(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 a2e(e,t,r){return(e&&e.autoRemove?e.autoRemove(t,r):!1)||typeof t>"u"||typeof t=="string"&&!t}var _Ze=(e,t,r)=>r.reduce((n,i)=>{let a=i.getValue(e);return n+(typeof a=="number"?a:0)},0),PZe=(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},IZe=(e,t,r)=>{let n;return r.forEach(i=>{let a=i.getValue(e);a!=null&&(n=a)&&(n=a)}),n},BZe=(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},$Ze=(e,t)=>{if(!t.length)return;let r=t.map(a=>a.getValue(e));if(!OZe(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},qZe=(e,t)=>Array.from(new Set(t.map(r=>r.getValue(e))).values()),LZe=(e,t)=>new Set(t.map(r=>r.getValue(e))).size,zZe=(e,t)=>t.length,GQ={sum:_Ze,min:PZe,max:IZe,extent:BZe,mean:RZe,median:$Ze,unique:qZe,uniqueCount:LZe,count:zZe},UZe={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 GQ.sum;if(Object.prototype.toString.call(n)==="[object Date]")return GQ.extent},e.getAggregationFn=()=>{var r,n;if(!e)throw new Error;return X5(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:GQ[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 WZe(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 HZe={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 WZe(a,r,n)},Mr(e.options,"debugTable","_getOrderColumnsFn"))}},QQ=()=>({left:[],right:[]}),VZe={getInitialState:e=>({columnPinning:QQ(),...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?QQ():(r=(n=e.initialState)==null?void 0:n.columnPinning)!=null?r:QQ())},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"))}},Y5={size:150,minSize:20,maxSize:Number.MAX_SAFE_INTEGER},YQ=()=>({startOffset:null,startSize:null,deltaOffset:null,deltaPercentage:null,isResizingColumn:!1,columnSizingStart:[]}),GZe={getDefaultColumnDef:()=>Y5,getInitialState:e=>({columnSizing:{},columnSizingInfo:YQ(),...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:Y5.minSize,(n=a??e.columnDef.size)!=null?n:Y5.size),(i=e.columnDef.maxSize)!=null?i:Y5.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(),ZQ(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=ZQ(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=QZe()?{passive:!1}:!1;ZQ(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?YQ():(r=e.initialState.columnSizingInfo)!=null?r:YQ())},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}}},Z5=null;function QZe(){if(typeof Z5=="boolean")return Z5;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 Z5=e,Z5}function ZQ(e){return e.type==="touchstart"}var YZe={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 ZZe={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=()=>rg.includesString,e.getGlobalFilterFn=()=>{var t,r;let{globalFilterFn:n}=e.options;return X5(n)?n:n==="auto"?e.getGlobalAutoFilterFn():(t=(r=e.options.filterFns)==null?void 0:r[n])!=null?t:rg[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()}}},XZe={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()}}}},eY=0,tY=10,XQ=()=>({pageIndex:eY,pageSize:tY}),KZe={getInitialState:e=>({...e,pagination:{...XQ(),...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=>Cv(n,a);return e.options.onPaginationChange==null?void 0:e.options.onPaginationChange(i)},e.resetPagination=n=>{var i;e.setPagination(n?XQ():(i=e.initialState.pagination)!=null?i:XQ())},e.setPageIndex=n=>{e.setPagination(i=>{let a=Cv(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?eY:(i=(a=e.initialState)==null||(a=a.pagination)==null?void 0:a.pageIndex)!=null?i:eY)},e.resetPageSize=n=>{var i,a;e.setPageSize(n?tY:(i=(a=e.initialState)==null||(a=a.pagination)==null?void 0:a.pageSize)!=null?i:tY)},e.setPageSize=n=>{e.setPagination(i=>{let a=Math.max(1,Cv(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=Cv(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}}},KQ=()=>({top:[],bottom:[]}),JZe={getInitialState:e=>({rowPinning:KQ(),...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?KQ():(r=(n=e.initialState)==null?void 0:n.rowPinning)!=null?r:KQ())},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"))}},eXe={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=>{rY(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?JQ(e,r):{rows:[],flatRows:[],rowsById:{}},Mr(e.options,"debugTable","getSelectedRowModel")),e.getFilteredSelectedRowModel=Or(()=>[e.getState().rowSelection,e.getFilteredRowModel()],(t,r)=>Object.keys(t).length?JQ(e,r):{rows:[],flatRows:[],rowsById:{}},Mr(e.options,"debugTable","getFilteredSelectedRowModel")),e.getGroupedSelectedRowModel=Or(()=>[e.getState().rowSelection,e.getSortedRowModel()],(t,r)=>Object.keys(t).length?JQ(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 rY(s,e.id,r,(o=n?.selectChildren)!=null?o:!0,t),s})},e.getIsSelected=()=>{let{rowSelection:r}=t.getState();return oY(e,r)},e.getIsSomeSelected=()=>{let{rowSelection:r}=t.getState();return nY(e,r)==="some"},e.getIsAllSubRowsSelected=()=>{let{rowSelection:r}=t.getState();return nY(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)}}}},rY=(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=>rY(e,s.id,r,n,i))};function JQ(e,t){let r=e.getState().rowSelection,n=[],i={},a=function(o,s){return o.map(l=>{var u;let c=oY(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 oY(e,t){var r;return(r=t[e.id])!=null?r:!1}function nY(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()&&(oY(o,t)?a=!0:i=!1),o.subRows&&o.subRows.length)){let s=nY(o,t);s==="all"?a=!0:(s==="some"&&(a=!0),i=!1)}}),i?"all":a?"some":!1}var iY=/([0-9]+)/gm,tXe=(e,t,r)=>A2e(Dv(e.getValue(r)).toLowerCase(),Dv(t.getValue(r)).toLowerCase()),rXe=(e,t,r)=>A2e(Dv(e.getValue(r)),Dv(t.getValue(r))),nXe=(e,t,r)=>sY(Dv(e.getValue(r)).toLowerCase(),Dv(t.getValue(r)).toLowerCase()),iXe=(e,t,r)=>sY(Dv(e.getValue(r)),Dv(t.getValue(r))),aXe=(e,t,r)=>{let n=e.getValue(r),i=t.getValue(r);return n>i?1:nsY(e.getValue(r),t.getValue(r));function sY(e,t){return e===t?0:e>t?1:-1}function Dv(e){return typeof e=="number"?isNaN(e)||e===1/0||e===-1/0?"":String(e):typeof e=="string"?e:""}function A2e(e,t){let r=e.split(iY).filter(Boolean),n=t.split(iY).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:tXe,alphanumericCaseSensitive:rXe,text:nXe,textCaseSensitive:iXe,datetime:aXe,basic:oXe},sXe={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(iY).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 X5(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())}},lXe=[NZe,YZe,HZe,VZe,TZe,FZe,ZZe,sXe,UZe,XZe,KZe,JZe,eXe,GZe];function g2e(e){var t,r;let n=[...lXe,...(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=Cv(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=jZe(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 y2e(){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:b2e(r),Mr(e.options,"debugTable","getExpandedRowModel"))}function b2e(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 x2e(){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=uXe(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?o2e(A,S=>S.subRows):A,w=s2e(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 uXe(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 w2e(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=b2e({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 K5(e,t){return e?cXe(e)?rD.createElement(e,t):e:null}function cXe(e){return fXe(e)||typeof e=="function"||dXe(e)}function fXe(e){return typeof e=="function"&&(()=>{let t=Object.getPrototypeOf(e);return t.prototype&&t.prototype.isReactComponent})()}function dXe(e){return typeof e=="object"&&typeof e.$$typeof=="symbol"&&["react.memo","react.forward_ref"].includes(e.$$typeof.description)}function S2e(e){let t={state:{},onStateChange:()=>{},renderFallbackValue:null,...e},[r]=rD.useState(()=>({current:g2e(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 Ht=Ae(Te()),pEe=Ae(bl());var Ks=Ae(Te());var ai=Ae(Te());var Xy=e=>{let t;try{t=pXe(e)}catch{t=e}return t};function ng(e){if(!e)return["",""];let t=e.match(/^(.*?)\s*\/\/\s*(.*)$/);return t?[t[1],t[2]]:["",e]}var pXe=e=>{let r=e.split("-").map(n=>`0x${n}`);return String.fromCodePoint(...r)};var mXe=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"?Xy(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:W.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})))},Fa=mXe;var hXe=e=>{let[t,r]=(0,Ks.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 Ks.default.createElement(Ks.default.Fragment,null,Ks.default.createElement("li",null,Ks.default.createElement("div",{className:"mk-menu-option",onClick:u=>e.onSubmenu((c,f)=>i(c,Ne(u.view.document),n))},Ks.default.createElement("span",null,W.labels.propertyType),Ks.default.createElement("span",null,s.label))),s.multi?Ks.default.createElement("div",{className:"mk-menu-option"},Ks.default.createElement("span",null,W.labels.multiple),Ks.default.createElement("input",{type:"checkbox",checked:t.type==s.multiType,onChange:()=>o()})):Ks.default.createElement(Ks.default.Fragment,null),Ks.default.createElement("div",{className:"mk-menu-separator"}),Ks.default.createElement(G5,{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=ir(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(qt),a&&A.push({name:"",type:5,fragment:x=>Ks.default.createElement(hXe,{superstate:n,field:s,fields:l,contextPath:u,options:o,saveField:c,onSubmenu:x.onSubmenu})}),A.push(qt),A.push({name:W.menu.setIcon,icon:"ui//gem",onClick:x=>{n.ui.openPalette(Ks.default.createElement(Fa,{ui:n.ui,selectedSticker:w=>c({...s,attrs:JSON.stringify({icon:w})})}),Ne(x.view.document))}}),A.push(qt);let b=WQ(s.type,!1);return b&&p&&(A.push({name:W.menu.sortAscending,icon:"ui//sort-asc",onClick:()=>{p({field:s.name+s.table,fn:b})}}),A.push({name:W.menu.sortDescending,icon:"ui//sort-desc",onClick:()=>{p({field:s.name+s.table,fn:WQ(s.type,!0)})}})),A.push(qt),f&&(m?A.push({name:W.menu.unhideProperty,icon:"ui//eye",onClick:()=>{f(s,!1)}}):A.push({name:W.menu.hideProperty,icon:"ui//eye-off",onClick:()=>{f(s,!0)}})),a&&(h&&A.push({name:W.menu.editCode,icon:"ui//code",onClick:()=>{h()}}),d&&A.push({name:W.menu.deleteProperty,icon:"ui//trash",onClick:()=>{d(s)}})),n.ui.openMenu(i,Zt(n.ui,A),e.win,e.anchor,t)};var E2e=Ae(Te());function J5(...e){return(0,E2e.useMemo)(()=>t=>{e.forEach(r=>r(t))},e)}var Js=Ae(Te());var Frr=[{name:W.properties.fileProperty.name,value:"name"},{name:W.properties.fileProperty.createdTime,value:"ctime"},{name:W.properties.fileProperty.modifiedTime,value:"mtime"},{name:W.properties.fileProperty.sticker,value:"sticker"},{name:W.properties.fileProperty.extension,value:"extension"},{name:W.properties.fileProperty.size,value:"size"},{name:W.properties.fileProperty.parentFolder,value:"folder"},{name:W.properties.fileProperty.links,value:"inlinks"},{name:W.properties.fileProperty.tags,value:"tags"},{name:W.properties.fileProperty.spaces,value:"spaces"}],e9=e=>{let[t,r]=(0,Js.useState)(e.column),n=(0,Js.useRef)(null),{spaceInfo:i,spaceState:a}=(0,Js.useContext)(ur),{predicate:o,tableData:s,contextTable:l,cols:u,newColumn:c,saveColumn:f,hideColumn:d,sortColumn:p,delColumn:h}=(0,Js.useContext)(Ta);(0,Js.useEffect)(()=>{r(e.column)},[e.column]);let{attributes:m,listeners:g,setNodeRef:A,transform:b}=Ws({id:t.name+t.table,data:{name:t.name}}),{setNodeRef:v}=Lu({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=Hee(t.name,t.table==""?s:l[Hn(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,Js.useRef)(null),j=J5(v,A);return Js.default.createElement("div",{ref:j,...g,...m,className:"mk-col-header",onClick:O=>{S(O)}},Js.default.createElement("div",{ref:k},e.column.name.length>0?Js.default.createElement(Js.default.Fragment,null,Js.default.createElement("div",{className:"mk-path-context-field-icon",dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker(Ri(e.column))}}),Js.default.createElement("div",{className:"mk-path-context-field-key"},Vo(t,e.superstate))):"+",Js.default.createElement("span",{className:"mk-col-header-context","aria-label":e.column.table.length>0?e.column.table:""},e.column.table.length>0?"#":"")))};var mEe=Ae(Qa());var B2e=Ae(Te());var Ky=(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})},h2=async(e,t,r)=>{e.spaceManager.saveLabel(t,e.settings.fmKeyColor,r)},nD=(e,t,r,n)=>{let i=ss([n,...dl(r).filter(a=>a==n)]);return pi(e,t,{[e.settings.fmKeyAlias]:ca("option-multi",i,!0)})};var C2e=async(e,t,r,n,i,a,o,s)=>{if(t.length==1){AXe(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=>!GB(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;A2(e,f,p,i.sortable&&h,s)}},AXe=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){k2e(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;k2e(e,m.item.path,g,d,i.sortable&&p,s)}},gXe=(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=Hs(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)},k2e=async(e,t,r,n,i,a)=>{if(!e.pathsIndex.get(t))return!1;if(!n){gXe(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"||GB(t,s.path)?rh(e,s,t,i):IV(e,e.pathsIndex.get(t),s.path,i,a=="copy")),s.type=="tag"&&th(e,t,s.name),r&&r!=n&&fv(e,r,[t])},A2=async(e,t,r,n,i)=>{let a=e.spacesIndex.get(r);!a||((a.type=="folder"||a.type=="vault")&&t.forEach(o=>{i=="link"||GB(o,a.path)?rh(e,a,o,n):IV(e,e.pathsIndex.get(o),a.path,n,i=="copy")}),a.type=="tag"&&t.forEach(o=>th(e,o,a.name)))};var Kp=async(e,t,r)=>{e.spaceManager.saveLabel(t,e.settings.fmKeySticker,r)},t9=(e,t)=>{t.forEach(r=>{Kp(e,r,"")})};var D2e=(e,t,r)=>{t.forEach(n=>{Kp(e,n,r)})},O2e=(e,t,r)=>{t.forEach(n=>{h2(e,n,r)})},g2=(e,t,r)=>{Kp(e,t,r)},v2=(e,t)=>{Kp(e,t,"")};var iD=Ae(Te());var y2=Ae(Te());var Jy=e=>{let{hide:t,confirmAction:r,message:n,confirmLabel:i}=e,a=()=>{r(),t()};return y2.default.createElement("div",{className:"mk-modal-contents"},y2.default.createElement("div",{className:"mk-modal-message"},n),y2.default.createElement("div",{className:"mk-button-group"},y2.default.createElement("button",{onClick:()=>a(),className:"mod-warning"},i),y2.default.createElement("button",{onClick:()=>t&&t()},W.buttons.cancel)))};var vXe=e=>`${e}-gradient(`,lY=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})`:""},M2e=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(vXe(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 uY=Ae(bi());var va=Ae(Te());var b2=[["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)"]],j2e=[["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)"]],N2e=[["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)"]],T2e=[["Text Primary","var(--mk-ui-text-primary)"],["Text Secondary","var(--mk-ui-text-secondary)"],["Text Tertiary","var(--mk-ui-text-tertiary)"]];var yXe=e=>{let[t,r]=(0,va.useState)(null),[n,i]=(0,va.useState)(null),[a,o]=(0,va.useState)(e.color??"#eb3b5a"),[s,l]=(0,va.useState)(a),u=(0,va.useRef)(null),c=p=>{if(l(p),t){let h={...t};h.values.find(g=>g.id==n).color=p,r(h);let m=lY(h);o(m),e.saveValue(m);return}o(p),e.saveValue(p),e.stayOpen||e.hide()},f=p=>{let h=lY(p);o(h),e.saveValue(h)},d=p=>{p&&(o(p),l(p));let h;try{h=M2e(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,uY.uniqueId)()}:{...g,id:(0,uY.uniqueId)()}});h.values=m}catch(m){console.log(m)}h?(r(h),l(h.values[0].color)):l(p)};return(0,va.useEffect)(()=>{l(t?.values.find(p=>p.id==n)?.color)},[n,t]),va.default.createElement("div",{className:"mk-ui-color-picker"},va.default.createElement("div",{className:"mk-ui-color-picker-palette"},va.default.createElement("div",{style:{width:"100%",display:"flex",alignItems:"center",marginBottom:"12px"}},va.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 NZe(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 TZe(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 i2e(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 FZe={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 Q5(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))),Q5(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 Q5(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 Q5(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 Q5(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=i2e(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)=>i2e(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 s2e=(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:()=>o2e(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=>NZe(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()}}},l2e=(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))};l2e.autoRemove=e=>Xp(e);var u2e=(e,t,r)=>{var n;return Boolean((n=e.getValue(t))==null||(n=n.toString())==null?void 0:n.includes(r))};u2e.autoRemove=e=>Xp(e);var c2e=(e,t,r)=>{var n;return((n=e.getValue(t))==null||(n=n.toString())==null?void 0:n.toLowerCase())===r?.toLowerCase()};c2e.autoRemove=e=>Xp(e);var f2e=(e,t,r)=>{var n;return(n=e.getValue(t))==null?void 0:n.includes(r)};f2e.autoRemove=e=>Xp(e)||!(e!=null&&e.length);var d2e=(e,t,r)=>!r.some(n=>{var i;return!((i=e.getValue(t))!=null&&i.includes(n))});d2e.autoRemove=e=>Xp(e)||!(e!=null&&e.length);var p2e=(e,t,r)=>r.some(n=>{var i;return(i=e.getValue(t))==null?void 0:i.includes(n)});p2e.autoRemove=e=>Xp(e)||!(e!=null&&e.length);var m2e=(e,t,r)=>e.getValue(t)===r;m2e.autoRemove=e=>Xp(e);var h2e=(e,t,r)=>e.getValue(t)==r;h2e.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 rg={includesString:l2e,includesStringSensitive:u2e,equalsString:c2e,arrIncludes:f2e,arrIncludesAll:d2e,arrIncludesSome:p2e,equals:m2e,weakEquals:h2e,inNumberRange:sY};function Xp(e){return e==null||e===""}var PZe={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"?rg.includesString:typeof n=="number"?rg.inNumberRange:typeof n=="boolean"||n!==null&&typeof n=="object"?rg.equals:Array.isArray(n)?rg.arrIncludes:rg.weakEquals},e.getFilterFn=()=>{var r,n;return X5(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:rg[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=Cv(r,a?a.value:void 0);if(a2e(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=Cv(t,i))==null?void 0:a.filter(o=>{let s=r.find(l=>l.id===o.id);if(s){let l=s.getFilterFn();if(a2e(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 a2e(e,t,r){return(e&&e.autoRemove?e.autoRemove(t,r):!1)||typeof t>"u"||typeof t=="string"&&!t}var IZe=(e,t,r)=>r.reduce((n,i)=>{let a=i.getValue(e);return n+(typeof a=="number"?a:0)},0),BZe=(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},RZe=(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},LZe=(e,t)=>{if(!t.length)return;let r=t.map(a=>a.getValue(e));if(!jZe(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},zZe=(e,t)=>Array.from(new Set(t.map(r=>r.getValue(e))).values()),UZe=(e,t)=>new Set(t.map(r=>r.getValue(e))).size,WZe=(e,t)=>t.length,YQ={sum:IZe,min:BZe,max:RZe,extent:$Ze,mean:qZe,median:LZe,unique:zZe,uniqueCount:UZe,count:WZe},HZe={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 X5(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 VZe(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 GZe={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 VZe(a,r,n)},Mr(e.options,"debugTable","_getOrderColumnsFn"))}},ZQ=()=>({left:[],right:[]}),QZe={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"))}},Y5={size:150,minSize:20,maxSize:Number.MAX_SAFE_INTEGER},XQ=()=>({startOffset:null,startSize:null,deltaOffset:null,deltaPercentage:null,isResizingColumn:!1,columnSizingStart:[]}),YZe={getDefaultColumnDef:()=>Y5,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:Y5.minSize,(n=a??e.columnDef.size)!=null?n:Y5.size),(i=e.columnDef.maxSize)!=null?i:Y5.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=ZZe()?{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}}},Z5=null;function ZZe(){if(typeof Z5=="boolean")return Z5;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 Z5=e,Z5}function KQ(e){return e.type==="touchstart"}var XZe={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 KZe={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=()=>rg.includesString,e.getGlobalFilterFn=()=>{var t,r;let{globalFilterFn:n}=e.options;return X5(n)?n:n==="auto"?e.getGlobalAutoFilterFn():(t=(r=e.options.filterFns)==null?void 0:r[n])!=null?t:rg[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()}}},JZe={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}),eXe={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=>Cv(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=Cv(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,Cv(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=Cv(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:[]}),tXe={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"))}},rXe={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,nXe=(e,t,r)=>A2e(Dv(e.getValue(r)).toLowerCase(),Dv(t.getValue(r)).toLowerCase()),iXe=(e,t,r)=>A2e(Dv(e.getValue(r)),Dv(t.getValue(r))),aXe=(e,t,r)=>uY(Dv(e.getValue(r)).toLowerCase(),Dv(t.getValue(r)).toLowerCase()),oXe=(e,t,r)=>uY(Dv(e.getValue(r)),Dv(t.getValue(r))),sXe=(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 Dv(e){return typeof e=="number"?isNaN(e)||e===1/0||e===-1/0?"":String(e):typeof e=="string"?e:""}function A2e(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:nXe,alphanumericCaseSensitive:iXe,text:aXe,textCaseSensitive:oXe,datetime:sXe,basic:lXe},uXe={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 X5(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())}},cXe=[FZe,XZe,GZe,QZe,_Ze,PZe,KZe,uXe,HZe,JZe,eXe,tXe,rXe,YZe];function g2e(e){var t,r;let n=[...cXe,...(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=Cv(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=TZe(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 y2e(){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:b2e(r),Mr(e.options,"debugTable","getExpandedRowModel"))}function b2e(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 x2e(){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=fXe(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?o2e(A,S=>S.subRows):A,w=s2e(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 fXe(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 w2e(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=b2e({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 K5(e,t){return e?dXe(e)?rD.createElement(e,t):e:null}function dXe(e){return pXe(e)||typeof e=="function"||mXe(e)}function pXe(e){return typeof e=="function"&&(()=>{let t=Object.getPrototypeOf(e);return t.prototype&&t.prototype.isReactComponent})()}function mXe(e){return typeof e=="object"&&typeof e.$$typeof=="symbol"&&["react.memo","react.forward_ref"].includes(e.$$typeof.description)}function S2e(e){let t={state:{},onStateChange:()=>{},renderFallbackValue:null,...e},[r]=rD.useState(()=>({current:g2e(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 Ht=Ae(Te()),pEe=Ae(bl());var Ks=Ae(Te());var ai=Ae(Te());var Xy=e=>{let t;try{t=hXe(e)}catch{t=e}return t};function ng(e){if(!e)return["",""];let t=e.match(/^(.*?)\s*\/\/\s*(.*)$/);return t?[t[1],t[2]]:["",e]}var hXe=e=>{let r=e.split("-").map(n=>`0x${n}`);return String.fromCodePoint(...r)};var AXe=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"?Xy(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:W.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})))},Fa=AXe;var gXe=e=>{let[t,r]=(0,Ks.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 Ks.default.createElement(Ks.default.Fragment,null,Ks.default.createElement("li",null,Ks.default.createElement("div",{className:"mk-menu-option",onClick:u=>e.onSubmenu((c,f)=>i(c,Ne(u.view.document),n))},Ks.default.createElement("span",null,W.labels.propertyType),Ks.default.createElement("span",null,s.label))),s.multi?Ks.default.createElement("div",{className:"mk-menu-option"},Ks.default.createElement("span",null,W.labels.multiple),Ks.default.createElement("input",{type:"checkbox",checked:t.type==s.multiType,onChange:()=>o()})):Ks.default.createElement(Ks.default.Fragment,null),Ks.default.createElement("div",{className:"mk-menu-separator"}),Ks.default.createElement(G5,{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=ir(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(qt),a&&A.push({name:"",type:5,fragment:x=>Ks.default.createElement(gXe,{superstate:n,field:s,fields:l,contextPath:u,options:o,saveField:c,onSubmenu:x.onSubmenu})}),A.push(qt),A.push({name:W.menu.setIcon,icon:"ui//gem",onClick:x=>{n.ui.openPalette(Ks.default.createElement(Fa,{ui:n.ui,selectedSticker:w=>c({...s,attrs:JSON.stringify({icon:w})})}),Ne(x.view.document))}}),A.push(qt);let b=VQ(s.type,!1);return b&&p&&(A.push({name:W.menu.sortAscending,icon:"ui//sort-asc",onClick:()=>{p({field:s.name+s.table,fn:b})}}),A.push({name:W.menu.sortDescending,icon:"ui//sort-desc",onClick:()=>{p({field:s.name+s.table,fn:VQ(s.type,!0)})}})),A.push(qt),f&&(m?A.push({name:W.menu.unhideProperty,icon:"ui//eye",onClick:()=>{f(s,!1)}}):A.push({name:W.menu.hideProperty,icon:"ui//eye-off",onClick:()=>{f(s,!0)}})),a&&(h&&A.push({name:W.menu.editCode,icon:"ui//code",onClick:()=>{h()}}),d&&A.push({name:W.menu.deleteProperty,icon:"ui//trash",onClick:()=>{d(s)}})),n.ui.openMenu(i,Zt(n.ui,A),e.win,e.anchor,t)};var E2e=Ae(Te());function J5(...e){return(0,E2e.useMemo)(()=>t=>{e.forEach(r=>r(t))},e)}var Js=Ae(Te());var Prr=[{name:W.properties.fileProperty.name,value:"name"},{name:W.properties.fileProperty.createdTime,value:"ctime"},{name:W.properties.fileProperty.modifiedTime,value:"mtime"},{name:W.properties.fileProperty.sticker,value:"sticker"},{name:W.properties.fileProperty.extension,value:"extension"},{name:W.properties.fileProperty.size,value:"size"},{name:W.properties.fileProperty.parentFolder,value:"folder"},{name:W.properties.fileProperty.links,value:"inlinks"},{name:W.properties.fileProperty.tags,value:"tags"},{name:W.properties.fileProperty.spaces,value:"spaces"}],e9=e=>{let[t,r]=(0,Js.useState)(e.column),n=(0,Js.useRef)(null),{spaceInfo:i,spaceState:a}=(0,Js.useContext)(ur),{predicate:o,tableData:s,contextTable:l,cols:u,newColumn:c,saveColumn:f,hideColumn:d,sortColumn:p,delColumn:h}=(0,Js.useContext)(Ta);(0,Js.useEffect)(()=>{r(e.column)},[e.column]);let{attributes:m,listeners:g,setNodeRef:A,transform:b}=Ws({id:t.name+t.table,data:{name:t.name}}),{setNodeRef:v}=Lu({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=Gee(t.name,t.table==""?s:l[Hn(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,Js.useRef)(null),j=J5(v,A);return Js.default.createElement("div",{ref:j,...g,...m,className:"mk-col-header",onClick:O=>{S(O)}},Js.default.createElement("div",{ref:k},e.column.name.length>0?Js.default.createElement(Js.default.Fragment,null,Js.default.createElement("div",{className:"mk-path-context-field-icon",dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker(Ri(e.column))}}),Js.default.createElement("div",{className:"mk-path-context-field-key"},Vo(t,e.superstate))):"+",Js.default.createElement("span",{className:"mk-col-header-context","aria-label":e.column.table.length>0?e.column.table:""},e.column.table.length>0?"#":"")))};var mEe=Ae(Qa());var B2e=Ae(Te());var Ky=(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})},h2=async(e,t,r)=>{e.spaceManager.saveLabel(t,e.settings.fmKeyColor,r)},nD=(e,t,r,n)=>{let i=ss([n,...dl(r).filter(a=>a==n)]);return pi(e,t,{[e.settings.fmKeyAlias]:ca("option-multi",i,!0)})};var C2e=async(e,t,r,n,i,a,o,s)=>{if(t.length==1){vXe(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=>!GB(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;A2(e,f,p,i.sortable&&h,s)}},vXe=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){k2e(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;k2e(e,m.item.path,g,d,i.sortable&&p,s)}},yXe=(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=Hs(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)},k2e=async(e,t,r,n,i,a)=>{if(!e.pathsIndex.get(t))return!1;if(!n){yXe(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"||GB(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&&fv(e,r,[t])},A2=async(e,t,r,n,i)=>{let a=e.spacesIndex.get(r);!a||((a.type=="folder"||a.type=="vault")&&t.forEach(o=>{i=="link"||GB(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 Kp=async(e,t,r)=>{e.spaceManager.saveLabel(t,e.settings.fmKeySticker,r)},t9=(e,t)=>{t.forEach(r=>{Kp(e,r,"")})};var D2e=(e,t,r)=>{t.forEach(n=>{Kp(e,n,r)})},O2e=(e,t,r)=>{t.forEach(n=>{h2(e,n,r)})},g2=(e,t,r)=>{Kp(e,t,r)},v2=(e,t)=>{Kp(e,t,"")};var iD=Ae(Te());var y2=Ae(Te());var Jy=e=>{let{hide:t,confirmAction:r,message:n,confirmLabel:i}=e,a=()=>{r(),t()};return y2.default.createElement("div",{className:"mk-modal-contents"},y2.default.createElement("div",{className:"mk-modal-message"},n),y2.default.createElement("div",{className:"mk-button-group"},y2.default.createElement("button",{onClick:()=>a(),className:"mod-warning"},i),y2.default.createElement("button",{onClick:()=>t&&t()},W.buttons.cancel)))};var bXe=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})`:""},M2e=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(bXe(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(bi());var va=Ae(Te());var b2=[["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)"]],j2e=[["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)"]],N2e=[["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)"]],T2e=[["Text Primary","var(--mk-ui-text-primary)"],["Text Secondary","var(--mk-ui-text-secondary)"],["Text Tertiary","var(--mk-ui-text-tertiary)"]];var xXe=e=>{let[t,r]=(0,va.useState)(null),[n,i]=(0,va.useState)(null),[a,o]=(0,va.useState)(e.color??"#eb3b5a"),[s,l]=(0,va.useState)(a),u=(0,va.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=M2e(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,va.useEffect)(()=>{l(t?.values.find(p=>p.id==n)?.color)},[n,t]),va.default.createElement("div",{className:"mk-ui-color-picker"},va.default.createElement("div",{className:"mk-ui-color-picker-palette"},va.default.createElement("div",{style:{width:"100%",display:"flex",alignItems:"center",marginBottom:"12px"}},va.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%)`}}),va.default.createElement("span",{style:{flex:1}}),W.editor.hex,va.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)}})),va.default.createElement("div",{style:{fontSize:"13px",padding:"4px",marginTop:"8px"}},W.editor.themeColors),va.default.createElement("div",null,b2.map((p,h)=>va.default.createElement("div",{key:h,"aria-label":p[0],onMouseDown:()=>{c(p[1])},className:"mk-color",style:{background:p[1]}}))),va.default.createElement("div",null,j2e.map((p,h)=>va.default.createElement("div",{key:h,"aria-label":p[0],onMouseDown:()=>{c(p[1])},className:"mk-color",style:{background:p[1]}}))),va.default.createElement("div",{style:{fontSize:"13px",padding:"4px",marginTop:"8px"}},W.editor.uiColors),va.default.createElement("div",null,N2e.map((p,h)=>va.default.createElement("div",{key:h,"aria-label":p[0],onMouseDown:()=>{c(p[1])},className:"mk-color",style:{background:p[1]}})),T2e.map((p,h)=>va.default.createElement("div",{key:h,"aria-label":p[0],onMouseDown:()=>{c(p[1])},className:"mk-color",style:{background:p[1]}})))))},Vu=(e,t,r,n,i,a,o)=>e.ui.openCustomMenu(t,va.default.createElement(yXe,{superstate:e,color:n,saveValue:i,stayOpen:a}),{},r,"bottom");var ao=(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:W.buttons.tag,value:"tag"},{name:W.menu.folder,value:"folder"}],saveOptions:(l,u)=>{n(u[0],!s.some(c=>c.value==u[0]))},placeholder:W.labels.spaceSelectPlaceholder,detail:!0,searchable:!0,showSections:!o,showAll:!0},t,"bottom")};var F2e=(e,t,r)=>{let n=t.map(a=>a.item.path),i=[];return i.push({name:W.menu.openFilePane,icon:"ui//go-to-file",onClick:a=>{n.forEach(o=>e.ui.openPath(o,!0))}}),e.settings.spacesStickers&&(i.push(qt),i.push({name:W.menu.changeColor,icon:"ui//palette",type:6,onSubmenu:a=>Vu(e,a,Ne(r.view.document),"",o=>O2e(e,n,o),!1,!0)}),i.push({name:W.buttons.changeIcon,icon:"ui//sticker",onClick:a=>{e.ui.openPalette(iD.default.createElement(Fa,{ui:e.ui,selectedSticker:o=>D2e(e,n,o)}),Ne(a.view.document))}}),i.push({name:W.buttons.removeIcon,icon:"ui//file-minus",onClick:a=>{t9(e,n)}})),i.push(qt),i.push({name:W.menu.moveFile,icon:"ui//paper-plane",onClick:a=>{let o=a.target.getBoundingClientRect();ao(o,Ne(a.view.document),e,s=>{n.forEach(l=>{nee(e,l,s)})})}}),i.push({name:W.buttons.addToSpace,icon:"ui//pin",onClick:a=>{let o=a.target.getBoundingClientRect();ao(o,Ne(a.view.document),e,s=>{A2(e,t.map(l=>l.path),s,-1,"link")},!0)}}),i.push(qt),i.push({name:W.menu.hide,icon:"ui//eye-off",onClick:a=>{ree(e,n)}}),i.push({name:W.menu.delete,icon:"ui//trash",onClick:a=>{e.ui.openModal(W.labels.deleteFiles,iD.default.createElement(Jy,{confirmAction:()=>{n.forEach(o=>{P1(e,o)})},confirmLabel:W.buttons.delete,message:W.descriptions.deleteFiles.replace("${1}",n.length.toString())}),Ne(a.view.document))}}),e.ui.openMenu(r.target.getBoundingClientRect(),Zt(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:W.menu.openFilePane,icon:"ui//go-to-file",onClick:u=>{e.ui.openPath(t,!0)}}),l.push(qt),o&&(l.push({name:W.menu.closeSpace,icon:"ui//close",onClick:u=>{o()}}),l.push(qt)),r&&r!=s.parent){let u=e.spacesIndex.get(r);u&&l.push({name:W.menu.removeFromSpace,icon:"ui//pin-off",onClick:c=>{fv(e,u.path,[t])}})}return e.settings.spacesStickers&&(l.push(qt),l.push({name:W.menu.changeColor,icon:"ui//palette",type:6,onSubmenu:u=>Vu(e,u,i,"",c=>h2(e,t,c),!1,!0)}),l.push({name:W.buttons.changeIcon,icon:"ui//sticker",onClick:u=>{e.ui.openPalette(iD.default.createElement(Fa,{ui:e.ui,selectedSticker:c=>g2(e,t,c)}),Ne(u.view.document))}}),l.push({name:W.buttons.removeIcon,icon:"ui//file-minus",onClick:u=>{v2(e,t)}})),e.ui.hasNativePathMenu(t)&&(l.push(qt),l.push({name:W.menu.openNativeMenu,icon:"ui//options",onClick:u=>{e.ui.nativePathMenu(u,t)}})),l.push(qt),s.type=="file"&&s.subtype=="md"&&l.push({name:W.menu.changeToFolderNote,icon:"ui//file-plus-2",onClick:u=>{NM(e,t,!1)}}),l.push({name:W.menu.rename,icon:"ui//edit",onClick:u=>{e.ui.openModal(W.labels.rename,iD.default.createElement(_i,{saveLabel:W.buttons.rename,value:s.name,saveValue:c=>Ux(e,t,c)}),Ne(u.view.document))}}),l.push({name:W.buttons.addToSpace,icon:"ui//pin",onClick:u=>{let c=u.target.getBoundingClientRect();ao(c,Ne(u.view.document),e,f=>{A2(e,[t],f,-1,"link")},!0)}}),l.push({name:W.menu.moveFile,icon:"ui//paper-plane",onClick:u=>{let c=u.target.getBoundingClientRect();ao(c,Ne(u.view.document),e,f=>{let d=e.pathsIndex.get(t);e.spaceManager.renamePath(t,jm(t,f))})}}),l.push({name:W.menu.duplicate,icon:"ui//documents",onClick:u=>{e.spaceManager.copyPath(t,`${s.parent}`,`${s.name}`)}}),l.push({name:W.buttons.saveTemplate,icon:"ui//clipboard-add",onClick:u=>{cv(e,t,r)}}),l.push(qt),Gr(e.ui)||(l.push({name:e.ui.getOS()=="mac"?W.menu.revealInDefault:W.menu.revealInExplorer,icon:"ui//arrow-up-right",onClick:u=>{e.ui.openPath(t,"system")}}),l.push(qt)),l.push({name:W.menu.hide,icon:"ui//eye-off",onClick:u=>{jM(e,t)}}),l.push({name:W.menu.delete,icon:"ui//trash",onClick:u=>{P1(e,t)}}),e.ui.openMenu(n,Zt(e.ui,l),i,a),!1};var o9=Ae(Te());var _2e=Ae(Te());var P2e=(e,t,r)=>{let n=e.spacesIndex.get(t);du(e,n.space,{...n.metadata,contexts:r})},bXe=(e,t,r,n,i)=>{let a=t.spacesIndex.get(r),o=t.spaceManager.readTags(),s=async l=>{let u=zx(l);P2e(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:W.labels.contextItemSelectPlaceholder,searchable:!0,showAll:!0},n,null,i)},xXe=(e,t,r,n,i)=>{let a=[];a.push({name:W.buttons.addContext,icon:"ui//plus",type:6,onSubmenu:(s,l)=>bXe(s,r,t,n,l)}),a.push(qt);let o=r.spacesIndex.get(t);return o.contexts.forEach(s=>{a.push({name:s,icon:"ui//tags",onClick:l=>{r.ui.openPath(Hn(s))},onMoreOptions:l=>{let u=l.target.getBoundingClientRect(),c=[];return c.push({name:W.menu.deleteContext,icon:"ui//trash",onClick:f=>{P2e(r,o.path,o.contexts.filter(d=>d!=s))}}),r.ui.openMenu(u,{ui:r.ui,multi:!1,editable:!1,value:[],options:c,placeholder:W.labels.contextItemSelectPlaceholder,searchable:!1,showAll:!0},n)}})}),r.ui.openMenu(e,{ui:r.ui,multi:!1,editable:!1,value:[],options:a,placeholder:W.labels.contextItemSelectPlaceholder,searchable:!1,showAll:!0},n,null,i)},r9=(e,t,r,n)=>{let i=[{name:"Apply Tags",icon:"ui//tags",value:"apply-tags",onSubmenu:(a,o)=>xXe(a,r.path,t,n,o)},{name:"Set Default Sticker",icon:"ui//sticker",value:"apply-all-sticker",onClick:()=>{t.ui.openPalette(_2e.default.createElement(Fa,{ui:t.ui,selectedSticker:a=>du(t,r.space,{...r.metadata,defaultSticker:a})}),n)}}];return t.ui.openMenu(e,Zt(t.ui,i),n)};var n9=Ae(Te());var Gu=(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:W.labels.linkItemSelectPlaceholder,detail:!0,searchable:!0,showAll:!0,sections:o,showSections:!0,...i??{}},t)};var i9=(e,t,r,n)=>{if(t?.path==Kg)e.ui.openModal("New Tag",n9.default.createElement(_i,{value:"",saveLabel:W.labels.saveView,saveValue:i=>fC(e,i)}),r);else if(t)if(t?.metadata.template?.length>0){mC(e,t,t.metadata.template,n);return}else Ji(e,t,"md",null,!1,null,n);else uv(e,e.pathsIndex.get(e.ui.activePath)).then(i=>{i&&Ji(e,i,"md",null,!1,null,n)})},a9=(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",n9.default.createElement(_i,{value:"",saveLabel:W.labels.saveView,saveValue:l=>fC(e,l)}),Ne(s.view.document))}});else if(o.push({name:W.labels.createNote,icon:"ui//edit",onClick:s=>{Ji(e,n,"md",e.settings.newNotePlaceholder,i)}}),o.push({name:W.buttons.createCanvas,icon:"ui//layout-dashboard",onClick:s=>{Ji(e,n,"canvas",null,i)}}),o.push({name:W.labels.createSection,icon:"ui//folder-plus",onClick:s=>{e.ui.openModal(W.labels.createSection,n9.default.createElement(_i,{saveLabel:W.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(W.notice.newSpaceName);return}if(e.spacesIndex.has(d)){e.ui.notify(W.notice.duplicateSpaceName);return}kf(e,d,{})}}),Ne(s.view.document))}}),n.type=="folder"&&o.push({name:W.buttons.addIntoSpace,icon:"ui//pin",onClick:s=>{let l=s.target.getBoundingClientRect();Gu(l,Ne(s.view.document),e,u=>{rh(e,n,u)}),s.stopPropagation()}}),n.templates.length>0){o.push(qt);for(let s of n.templates)o.push({name:s,icon:"ui//clipboard-pen",onClick:l=>{mC(e,n,s)}})}return e.ui.openMenu(t,Zt(e.ui,o),r,"right")};var eb=(e,t,r,n,i,a)=>{let o=e.spacesIndex.get(t.path);if(!o)return;let s=[];s.push({name:W.menu.openFilePane,icon:"ui//go-to-file",onClick:u=>{e.ui.openPath(t.path,!0)}}),s.push(qt),s.push({name:"New",type:6,onSubmenu:u=>a9(e,u,Ne(r.view.document),o,!1,!0),icon:"ui//plus"}),s.push(qt),s.push(qt),e.settings.spacesStickers&&(s.push({name:W.menu.changeColor,icon:"ui//palette",type:6,onSubmenu:u=>Vu(e,u,Ne(r.view.document),"",c=>h2(e,o.path,c),!1,!0)}),s.push({name:W.buttons.changeIcon,icon:"ui//sticker",onClick:u=>{e.ui.openPalette(o9.default.createElement(Fa,{ui:e.ui,selectedSticker:c=>Kp(e,o.path,c)}),Ne(u.view.document))}}),s.push({name:W.buttons.removeIcon,icon:"ui//file-minus",onClick:u=>{v2(e,o.path)}})),o.metadata?.sort&&(s.push(qt),s.push({name:W.menu.sortBy,icon:"ui//sort-desc",type:6,onSubmenu:u=>{let c=[];c.push({name:W.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(qt),c.push({name:W.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(qt);let f={field:"rank",asc:!0,group:o.metadata.sort.group,recursive:o.metadata.sort.recursive};c.push({name:W.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(qt);let d={field:"name",asc:!0,group:o.metadata.sort.group,recursive:o.metadata.sort.recursive};c.push({name:W.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:W.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(qt);let h={field:"number",asc:!0,group:o.metadata.sort.group,recursive:o.metadata.sort.recursive};c.push({name:W.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:W.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(qt);let g={field:"ctime",asc:!1,group:o.metadata.sort.group,recursive:o.metadata.sort.recursive};c.push({name:W.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:W.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(qt);let b={field:"size",asc:!1,group:o.metadata.sort.group,recursive:o.metadata.sort.recursive};c.push({name:W.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:W.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,Zt(e.ui,c),Ne(r.view.document))}})),s.push({name:W.menu.applyItems,icon:"ui//apply-items",value:"apply-all",type:6,onSubmenu:u=>r9(u,e,o,Ne(r.view.document))}),e.ui.hasNativePathMenu(o.path)&&(s.push(qt),s.push({name:W.menu.openNativeMenu,icon:"ui//options",onClick:u=>{e.ui.nativePathMenu(u,o.path)}})),o.type!="default"&&(s.push(qt),s.push({name:W.menu.rename,icon:"ui//edit",onClick:u=>{e.ui.openModal(W.labels.rename,o9.default.createElement(_i,{saveLabel:W.buttons.rename,value:o.type=="tag"?hl(o.name):o.name,saveValue:c=>Ux(e,o.path,c)}),Ne(u.view.document))}}));let l=e.spacesIndex.get(i);if(l&&(l.type=="folder"||l.type=="vault")&&i!=t.parent){let u=e.spacesIndex.get(i);u&&s.push({name:W.menu.removeFromSpace.replace("${1}",u.name),icon:"ui//pin-off",onClick:c=>{fv(e,u.path,[o.path])}})}return a&&s.push({name:W.menu.closeSpace,icon:"ui//close",onClick:u=>{a()}}),o.type=="folder"&&s.push({name:W.buttons.addToSpace,icon:"ui//pin",onClick:u=>{let c=u.target.getBoundingClientRect();ao(c,Ne(u.view.document),e,f=>{let d=e.spacesIndex.get(f);d&&QS(e,d,o.path,-1)},!0)}}),o.type=="folder"&&s.push({name:W.menu.moveFile,icon:"ui//paper-plane",onClick:u=>{let c=u.target.getBoundingClientRect();ao(c,Ne(u.view.document),e,f=>{e.spaceManager.renameSpace(o.path,jm(o.path,f))})}}),s.push({name:W.menu.duplicate,icon:"ui//documents",onClick:u=>{e.spaceManager.copyPath(t.path,`${t.parent}`)}}),l&&(l.type=="folder"||l.type=="vault")&&s.push({name:W.buttons.saveTemplate,icon:"ui//clipboard-add",onClick:u=>{cv(e,o.path,i)}}),s.push(qt),Gr(e.ui)||s.push({name:e.ui.getOS()=="mac"?W.menu.revealInDefault:W.menu.revealInExplorer,icon:"ui//arrow-up-right",onClick:u=>{e.ui.openPath(o.space.folderPath,"system")}}),s.push(qt),o.type=="folder"&&s.push({name:W.menu.hide,icon:"ui//eye-off",onClick:u=>{jM(e,o.path)}}),(o.type=="folder"||o.type=="tag")&&s.push({name:W.menu.delete,icon:"ui//trash",onClick:u=>{e.ui.openModal(W.labels.deleteSpace,o9.default.createElement(Jy,{confirmAction:()=>Iye(e,o.path),confirmLabel:W.buttons.delete,message:W.descriptions.deleteSpace}),Ne(u.view.document))}}),e.ui.openMenu(r.target.getBoundingClientRect(),Zt(e.ui,s),Ne(r.view.document)),!1};var Qu=Ae(Te()),I2e=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&&WN(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"},W.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(xs,{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 s9=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&&eb(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:W.menu.editProperties,icon:"ui//list",onClick:c=>{t.ui.openCustomMenu(c.currentTarget.getBoundingClientRect(),B2e.default.createElement(I2e,{...u}),u,Ne(c.view.document))}}),l.push({name:W.menu.deleteRow,icon:"ui//trash",onClick:c=>{zoe(t.spaceManager,t.spacesIndex.get(r)?.space,n,i)}}),t.ui.openMenu(e.target.getBoundingClientRect(),Zt(t.ui,l),Ne(e.view.document))};var cY=(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]},R2e=(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 hEe=Ae(bi());var xo=Ae(Te());var ig=Ae(Te());var l9=e=>{let{initialValue:t,saveValue:r}=e,[n,i]=ig.default.useState(t=="true"),a=()=>{e.editMode!=0&&(i(!n),r(n?"false":"true"))};return(0,ig.useEffect)(()=>{e.editMode==4&&(i(!n),r(n?"false":"true"),e.setEditMode(null))},[e.editMode]),ig.default.useEffect(()=>{i(t=="true")},[t]),e.editMode<2?ig.default.createElement("div",{className:"mk-cell-boolean"},ig.default.createElement("input",{type:"checkbox",checked:n,onChange:a})):ig.default.createElement("div",{className:"mk-cell-boolean"},ig.default.createElement("input",{type:"checkbox",checked:n,onChange:a}))};var dY=Ae(Te());var $2e=e=>{let t=r=>{let n=a=>{e.saveValue(a)},i=r.target.getBoundingClientRect();Vu(e.superstate,i,Ne(r.view.document),e.initialValue,n)};return dY.default.createElement("div",null,dY.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:W.buttons.changeIcon,icon:"ui//sticker",onClick:c=>{e.superstate.ui.openPalette(Pc.default.createElement(Fa,{ui:e.superstate.ui,selectedSticker:f=>Kp(e.superstate,t?.path,f)}),Ne(c.view.document))}}),u.push({name:W.buttons.removeIcon,icon:"ui//file-minus",onClick:()=>{t9(e.superstate,[t.path])}}),e.superstate.ui.openMenu(l.target.getBoundingClientRect(),{ui:e.superstate.ui,multi:!1,value:[],editable:!1,options:u,searchable:!1,showAll:!0},Ne(l.view.document)),!1},a=l=>{if(l.stopPropagation(),t?.type=="space"){e.superstate.ui.openPalette(Pc.default.createElement(Fa,{ui:e.superstate.ui,selectedSticker:u=>Kp(e.superstate,t.path,u)}),Ne(l.view.document));return}e.superstate.ui.openPalette(Pc.default.createElement(Fa,{ui:e.superstate.ui,selectedSticker:u=>Kp(e.superstate,t.path,u)}),Ne(l.view.document))},[o,s]=ng(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":W.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)}))},u9=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 pY=Ae(bi()),Ai=Ae(Te());var c9=e=>{let t=(0,Ai.useMemo)(()=>mr(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(vJ("value")).filter(v=>v.value.length>0),n=(m,g)=>(g?tr(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(yi(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(mA(g,t),yi(A)):e.saveOptions(mA(g,t),ss(A))},c=(m,g)=>{e.multi?e.saveOptions(mA(m,t),yi(g)):e.saveOptions(mA(m,t),ss(g))},f=(m,g)=>{let A=(0,pY.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,pY.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(qt),b.push({name:"None",color:"var(--mk-color-none)",onClick:()=>{d(A.value,{...A,color:""})}}),b2.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(),Zt(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:W.menu.none,value:""},...i],saveOptions:f,removeOption:e.editMode>=2&&u,onMoreOption:e.editMode>=2&&p,placeholder:W.labels.optionItemSelectPlaceholder,searchable:!0,showAll:!0,onHide:()=>e.setEditMode(null)});return Ai.default.createElement(ag,{superstate:e.superstate,baseClass:"mk-cell-option",value:o,menuProps:h,multi:e.multi,removeValue:l,selectLabel:e.compactMode?e.property.name:W.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)}})},ag=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,W.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 q2e=e=>{let{contextTable:t}=e,r=(0,Ff.useMemo)(()=>mr(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?tr(m)??[]:[m]).filter(A=>A),[a,o]=(0,Ff.useState)([]);(0,Ff.useEffect)(()=>{!r?.field||!t[n]||o(t[n].rows.reduce((m,g)=>tr(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(yi(m)):e.saveValue(ss(m))},d=m=>{if(a.includes(m)){let g=a.filter(A=>A!=m);o(g),UN(e.superstate.spaceManager,e.superstate.spacesIndex.get(n).space,m,r.spaceField,e.path,Poe)}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):Ji(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:W.menu.none,value:""},...s];return{ui:e.superstate.ui,multi:!1,editable:!0,value:c.map(g=>g.path),options:m,saveOptions:p,placeholder:W.labels.contextItemSelectPlaceholder,searchable:!0,showAll:!0,onHide:()=>e.setEditMode(null)}};return Ff.default.createElement(ag,{baseClass:"mk-cell-context",superstate:e.superstate,menuProps:h,removeValue:d,selectLabel:e.compactMode?e.property.name:W.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 Pi=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(tKe,{displayMonth:e.displayMonth,hideNext:c,hidePrevious:f,nextMonth:i,previousMonth:n,onPreviousClick:d,onNextClick:p})}function rKe(e){var t,r=ya(),n=r.classNames,i=r.disableNavigation,a=r.styles,o=r.captionLayout,s=r.components,l=(t=s?.CaptionLabel)!==null&&t!==void 0?t:Y2e,u;return i?u=dt.jsx(l,{id:e.id,displayMonth:e.displayMonth}):o==="dropdown"?u=dt.jsx(z2e,{displayMonth:e.displayMonth,id:e.id}):o==="dropdown-buttons"?u=dt.jsxs(dt.Fragment,{children:[dt.jsx(z2e,{displayMonth:e.displayMonth,displayIndex:e.displayIndex,id:e.id}),dt.jsx(U2e,{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(U2e,{displayMonth:e.displayMonth,id:e.id})]}),dt.jsx("div",{className:n.caption,style:a.caption,children:u})}function nKe(e){var t=ya(),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 iKe(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=la(n,a);i.push(o)}return i}function aKe(){var e=ya(),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=iKe(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 oKe(){var e,t=ya(),r=t.classNames,n=t.styles,i=t.components,a=(e=i?.HeadRow)!==null&&e!==void 0?e:aKe;return dt.jsx("thead",{style:n.head,className:r.head,children:dt.jsx(a,{})})}function sKe(e){var t=ya(),r=t.locale,n=t.formatters.formatDay;return dt.jsx(dt.Fragment,{children:n(e.date,{locale:r})})}var vY=(0,Ln.createContext)(void 0);function lKe(e){if(!sD(e.initialProps)){var t={selected:void 0,modifiers:{disabled:[]}};return dt.jsx(vY.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=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?V2e([],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(vY.Provider,{value:l,children:r})}function yY(){var e=(0,Ln.useContext)(vY);if(!e)throw new Error("useSelectMultiple must be used within a SelectMultipleProvider");return e}function cKe(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?nk(e,n)?{from:e,to:n}:{from:n,to:e}:{from:e,to:void 0}}var bY=(0,Ln.createContext)(void 0);function fKe(e){if(!lD(e.initialProps)){var t={selected:void 0,modifiers:{range_start:[],range_end:[],range_middle:[],disabled:[]}};return dt.jsx(bY.Provider,{value:t,children:e.children})}return dt.jsx(dKe,{initialProps:e.initialProps,children:e.children})}function dKe(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=cKe(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:la(a,s-1)}),a&&o&&c.disabled.push({after:a,before:la(a,s-1)}),!a&&o&&c.disabled.push({after:Fx(o,s-1),before:la(o,s-1)})),l){if(a&&!o&&(c.disabled.push({before:la(a,-l+1)}),c.disabled.push({after:la(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:la(o,d)})}!a&&o&&(c.disabled.push({before:la(o,-l+1)}),c.disabled.push({after:la(o,l-1)}))}return dt.jsx(bY.Provider,{value:{selected:n,onDayClick:u,modifiers:c},children:r})}function xY(){var e=(0,Ln.useContext)(bY);if(!e)throw new Error("useSelectRange must be used within a SelectRangeProvider");return e}function f9(e){return Array.isArray(e)?V2e([],e,!0):e!==void 0?[e]:[]}function pKe(e){var t={};return Object.entries(e).forEach(function(r){var n=r[0],i=r[1];t[n]=f9(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 mKe=em.Selected,og=em.Disabled,hKe=em.Hidden,AKe=em.Today,mY=em.RangeEnd,hY=em.RangeMiddle,AY=em.RangeStart,gKe=em.Outside;function vKe(e,t,r){var n,i=(n={},n[mKe]=f9(e.selected),n[og]=f9(e.disabled),n[hKe]=f9(e.hidden),n[AKe]=[e.today],n[mY]=[],n[hY]=[],n[AY]=[],n[gKe]=[],n);return e.fromDate&&i[og].push({before:e.fromDate}),e.toDate&&i[og].push({after:e.toDate}),sD(e)?i[og]=i[og].concat(t.modifiers[og]):lD(e)&&(i[og]=i[og].concat(r.modifiers[og]),i[AY]=r.modifiers[AY],i[hY]=r.modifiers[hY],i[mY]=r.modifiers[mY]),i}var K2e=(0,Ln.createContext)(void 0);function yKe(e){var t=ya(),r=yY(),n=xY(),i=vKe(t,r,n),a=pKe(t.modifiers),o=Tr(Tr({},i),a);return dt.jsx(K2e.Provider,{value:o,children:e.children})}function J2e(){var e=(0,Ln.useContext)(K2e);if(!e)throw new Error("useModifiers must be used within a ModifiersProvider");return e}function bKe(e){return Boolean(e&&typeof e=="object"&&"before"in e&&"after"in e)}function xKe(e){return Boolean(e&&typeof e=="object"&&"from"in e)}function wKe(e){return Boolean(e&&typeof e=="object"&&"after"in e)}function SKe(e){return Boolean(e&&typeof e=="object"&&"before"in e)}function EKe(e){return Boolean(e&&typeof e=="object"&&"dayOfWeek"in e)}function kKe(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 CKe(e){return O1(e)}function DKe(e){return Array.isArray(e)&&e.every(O1)}function OKe(e,t){return t.some(function(r){if(typeof r=="boolean")return r;if(CKe(r))return pl(e,r);if(DKe(r))return r.includes(e);if(xKe(r))return kKe(e,r);if(EKe(r))return r.dayOfWeek.includes(e.getDay());if(bKe(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 wKe(r)?od(e,r.after)>0:SKe(r)?od(r.before,e)>0:typeof r=="function"?r(e):!1})}function wY(e,t,r){var n=Object.keys(t).reduce(function(a,o){var s=t[o];return OKe(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 MKe(e,t){for(var r=Wo(e[0]),n=t0(e[e.length-1]),i,a,o=r;o<=n;){var s=wY(o,t),l=!s.disabled&&!s.hidden;if(!l){o=la(o,1);continue}if(s.selected)return o;s.today&&!a&&(a=o),i||(i=o),o=la(o,1)}return a||i}var jKe=365;function eEe(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:la,week:Jg,month:Uo,year:AM,startOfWeek:function(g){return i.ISOWeek?tf(g):mo(g,{locale:f,weekStartsOn:l})},endOfWeek:function(g){return i.ISOWeek?KE(g):gA(g,{locale:f,weekStartsOn:l})}},p=d[r](e,n==="after"?1:-1);n==="before"&&u?p=gM([u,p]):n==="after"&&c&&(p=vM([c,p]));var h=!0;if(a){var m=wY(p,a);h=!m.disabled&&!m.hidden}return h?p:s.count>jKe?s.lastFocused:eEe(p,{moveBy:r,direction:n,context:i,modifiers:a,retry:Tr(Tr({},s),{count:s.count+1})})}var tEe=(0,Ln.createContext)(void 0);function NKe(e){var t=tb(),r=J2e(),n=(0,Ln.useState)(),i=n[0],a=n[1],o=(0,Ln.useState)(),s=o[0],l=o[1],u=MKe(t.displayMonths,r),c=i??(s&&t.isDateDisplayed(s))?s:u,f=function(){l(i),a(void 0)},d=function(g){a(g)},p=ya(),h=function(g,A){if(!!i){var b=eEe(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(tEe.Provider,{value:m,children:e.children})}function SY(){var e=(0,Ln.useContext)(tEe);if(!e)throw new Error("useFocusContext must be used within a FocusProvider");return e}function TKe(e,t){var r=J2e(),n=wY(e,r,t);return n}var EY=(0,Ln.createContext)(void 0);function FKe(e){if(!p9(e.initialProps)){var t={selected:void 0};return dt.jsx(EY.Provider,{value:t,children:e.children})}return dt.jsx(_Ke,{initialProps:e.initialProps,children:e.children})}function _Ke(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(EY.Provider,{value:i,children:r})}function rEe(){var e=(0,Ln.useContext)(EY);if(!e)throw new Error("useSelectSingle must be used within a SelectSingleProvider");return e}function PKe(e,t){var r=ya(),n=rEe(),i=yY(),a=xY(),o=SY(),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;p9(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 IKe(){var e=ya(),t=rEe(),r=yY(),n=xY(),i=p9(e)?t.selected:sD(e)?r.selected:lD(e)?n.selected:void 0;return i}function BKe(e){return Object.values(em).includes(e)}function RKe(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(BKe(n)){var a=e.classNames["day_".concat(n)];a&&r.push(a)}}),r}function $Ke(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 qKe(e,t,r){var n,i,a,o=ya(),s=SY(),l=TKe(e,t),u=PKe(e,l),c=IKe(),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=RKe(o,l).join(" "),p=$Ke(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:sKe,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 LKe(e){var t=(0,Ln.useRef)(null),r=qKe(e.date,e.displayMonth,t);return r.isHidden?dt.jsx("div",{role:"gridcell"}):r.isButton?dt.jsx(d9,Tr({name:"day",ref:t},r.buttonProps)):dt.jsx("div",Tr({},r.divProps))}function zKe(e){var t=e.number,r=e.dates,n=ya(),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(d9,{name:"week-number","aria-label":f,className:o.weeknumber,style:a.weeknumber,onClick:d,children:c})}function UKe(e){var t,r,n=ya(),i=n.styles,a=n.classNames,o=n.showWeekNumber,s=n.components,l=(t=s?.Day)!==null&&t!==void 0?t:LKe,u=(r=s?.WeekNumber)!==null&&r!==void 0?r:zKe,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})},xM(f))})]})}function W2e(e,t,r){for(var n=r?.ISOWeek?KE(t):gA(t,r),i=r?.ISOWeek?tf(e):mo(e,r),a=od(n,i),o=[],s=0;s<=a;s++)o.push(la(i,s));var l=o.reduce(function(u,c){var f=r?.ISOWeek?bM(c):wM(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 WKe(e,t){var r=W2e(Wo(e),t0(e),t);if(t?.useFixedWeeks){var n=SM(e,t);if(n<6){var i=r[r.length-1],a=i.dates[i.dates.length-1],o=Jg(a,6-n),s=W2e(Jg(a,1),o,t);r.push.apply(r,s)}}return r}function HKe(e){var t,r,n,i=ya(),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=WKe(e.displayMonth,{useFixedWeeks:Boolean(u),ISOWeek:p,locale:a,weekStartsOn:f,firstWeekContainsDate:d}),m=(t=c?.Head)!==null&&t!==void 0?t:oKe,g=(r=c?.Row)!==null&&r!==void 0?r:UKe,A=(n=c?.Footer)!==null&&n!==void 0?n:nKe;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 VKe(){return!!(typeof window<"u"&&window.document&&window.document.createElement)}var GKe=VKe()?Ln.useLayoutEffect:Ln.useEffect,gY=!1,QKe=0;function H2e(){return"react-day-picker-".concat(++QKe)}function YKe(e){var t,r=e??(gY?H2e():null),n=(0,Ln.useState)(r),i=n[0],a=n[1];return GKe(function(){i===null&&a(H2e())},[]),(0,Ln.useEffect)(function(){gY===!1&&(gY=!0)},[]),(t=e??i)!==null&&t!==void 0?t:void 0}function ZKe(e){var t,r,n=ya(),i=n.dir,a=n.classNames,o=n.styles,s=n.components,l=tb().displayMonths,u=YKe(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:rKe;return dt.jsxs("div",{className:f.join(" "),style:d,children:[dt.jsx(g,{id:u,displayMonth:e.displayMonth,displayIndex:e.displayIndex}),dt.jsx(HKe,{id:c,"aria-labelledby":u,displayMonth:e.displayMonth})]},e.displayIndex)}function XKe(e){var t=ya(),r=t.classNames,n=t.styles;return dt.jsx("div",{className:r.months,style:n.months,children:e.children})}function KKe(e){var t,r,n=e.initialProps,i=ya(),a=SY(),o=tb(),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:XKe;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(ZKe,{displayIndex:m,displayMonth:h},m)})})}))}function JKe(e){var t=e.children,r=wXe(e,["children"]);return dt.jsx(zXe,{initialProps:r,children:dt.jsx(KXe,{children:dt.jsx(FKe,{initialProps:r,children:dt.jsx(lKe,{initialProps:r,children:dt.jsx(fKe,{initialProps:r,children:dt.jsx(yKe,{children:dt.jsx(NKe,{children:t})})})})})})})}function nEe(e){return dt.jsx(JKe,Tr({},e,{children:dt.jsx(KKe,{initialProps:e})}))}var Ov=(e,t,r,n,i,a,o,s)=>e.openCustomMenu(t,Pi.default.createElement(tJe,{ui:e,value:n,setValue:i,time:a}),{width:"280px",height:"280px"},r,s),eJe=e=>{let{goToMonth:t,nextMonth:r,previousMonth:n}=tb(),[i,a]=(0,Pi.useState)(!1);return Pi.default.createElement("div",{className:"mk-date-picker-header"},Pi.default.createElement("button",{disabled:!n,onClick:()=>n&&t(n),dangerouslySetInnerHTML:{__html:e.ui.getSticker("ui//chevron-left")}}),i?Pi.default.createElement("div",{className:"mk-date-picker-header-input"},Pi.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)}}),Pi.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)}})):Pi.default.createElement("div",{onClick:()=>a(!0)},_r(e.ui.superstate,e.displayMonth,"MMM yyy")),Pi.default.createElement("button",{disabled:!r,onClick:()=>r&&t(r),dangerouslySetInnerHTML:{__html:e.ui.getSticker("ui//chevron-right")}}))},tJe=e=>{let[t,r]=(0,Pi.useState)(0),[n,i]=(0,Pi.useState)(0),[a,o]=(0,Pi.useState)(0),[s,l]=(0,Pi.useState)(e.value),[u,c]=(0,Pi.useState)(e.time==2),[f,d]=(0,Pi.useState)(!1),p=()=>{let m=e.value?e.value:e.time==0?Vn(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,Pi.useEffect)(()=>{p()},[e.value,e.time]),(0,Pi.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 Pi.default.createElement("div",{className:"mk-date-picker-container"},Pi.default.createElement(nEe,{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=>eJe({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?Pi.default.createElement("div",{className:"mk-date-picker-time"},Pi.default.createElement("div",{dangerouslySetInnerHTML:{__html:e.ui.getSticker("ui//clock")}}),Pi.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})}}),":",Pi.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})}}),Pi.default.createElement("button",{className:"mk-date-picker-meridiem",onClick:()=>{h({h:(t+12)%24})}},t<12?"AM":"PM"),Pi.default.createElement("button",{onClick:()=>h({h:0,m:0,s:0}),dangerouslySetInnerHTML:{__html:e.ui.getSticker("ui//close")}})):e.time==1?Pi.default.createElement("button",{onClick:()=>c(!0)},"Add Time"):null)};var iEe=Ae(Qa()),ws=Ae(Te());var aEe=e=>{let[t,r]=(0,ws.useState)(e.initialValue);(0,ws.useEffect)(()=>{r(e.initialValue)},[e.initialValue]);let n=(0,ws.useMemo)(()=>{let f=Zi(t);return Uee(f)?f:null},[t]),i=(f,d)=>{let p=_r(e.superstate,f,d?qs:"yyyy-MM-dd");e.saveValue(p),r(p),e.setEditMode(null)},a=(0,ws.useRef)(null),o=(0,ws.useRef)(null);(0,ws.useEffect)(()=>{e.editMode==4&&o.current&&(s(),o.current.focus())},[e.editMode]);let s=(0,ws.useCallback)(f=>{if(e.editMode<=1)return;let d=f?f.target.getBoundingClientRect():o.current.getBoundingClientRect();a.current=Ov(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,ws.useMemo)(()=>ir(e.propertyValue)?.format,[e.propertyValue]),c=!(t?.length>0);return ws.default.createElement("div",{className:"mk-cell-date",onClick:f=>!t&&s(f)},ws.default.createElement("div",{className:(0,iEe.default)("mk-cell-date-item",c&&"mk-cell-date-new")},ws.default.createElement("div",{className:"mk-icon-xsmall",dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//calendar")}}),c&&"Select",e.editMode==4?ws.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}):ws.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 m9=e=>{let t=(0,tm.useMemo)(()=>e.multi?tr(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(Fa,{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":W.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)},W.labels.selectIcon)))};var jl=Ae(Te());var Mv=/https?:\/\/(www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_\+.~#?&//=]*)/gi;var rJe=e=>{let[t,r]=(0,jl.useState)(""),[n,i]=(0,jl.useState)([]),[a,o]=(0,jl.useState)([]),[s,l]=(0,jl.useState)(null);(0,jl.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,jl.useEffect)(()=>{t.match(Mv)?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]),jl.default.createElement(jl.default.Fragment,null,jl.default.createElement("input",{onKeyDown:c,value:t,ref:f,onChange:u,className:"mk-input mk-input-large mk-border-bottom"}),jl.default.createElement("div",{className:"mk-layout-masonry mk-padding-12 mk-layout-scroll"},a.map(d=>jl.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=rJe;var Zo=Ae(Te());var h9=e=>{let{initialValue:t,multi:r}=e,[n,i]=Zo.default.useState(tr(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(tr(t))},[t]);let s=c=>{if(r){let f=[...n];f.splice(c,1),i(f),e.saveValue(yi(f))}else e.saveValue("")},l=(c,f)=>{e.multi?c==-1?e.saveValue(yi([...n,f])):e.saveValue(yi(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 rb=Ae(Te());var uD=e=>{let t=u=>e.multi?tr(u)??[]:[u].filter(c=>c).map(c=>e.superstate.spaceManager.resolvePath(c,e.source));(0,rb.useEffect)(()=>{n(t(e.initialValue))},[e.initialValue]);let[r,n]=(0,rb.useState)(t(e.initialValue)),i=u=>{let c=r.filter(f=>f!=u);n(c),a(c)},a=u=>{e.multi?e.saveValue(yi(u)):e.saveValue(ss(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:W.menu.none,value:""},...u];return{ui:e.superstate.ui,multi:!1,editable:!0,value:r.map(f=>f),options:c,saveOptions:o,placeholder:W.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 rb.default.createElement(ag,{superstate:e.superstate,baseClass:"mk-cell-link",removeValue:i,selectLabel:e.compactMode?e.property.name:W.labels.select,menuProps:s,labelElement:u=>rb.default.createElement(oo,{superstate:e.superstate,path:u.value},u.children),value:r,multi:e.multi,editMode:e.editMode})};var oEe=e=>{let t=Rs(e.initialValue),r=(0,rm.useMemo)(()=>mr(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(l9,{...e,initialValue:t,editMode:0}):t?.length==0?rm.default.createElement(rm.default.Fragment,null):r.type=="image"?rm.default.createElement(h9,{...e,initialValue:t,editMode:0,multi:!0}):r.type=="icon"?rm.default.createElement(m9,{...e,initialValue:t,multi:!0,editMode:0}):r.type=="link"?rm.default.createElement(uD,{...e,initialValue:t,multi:!0,editMode:0}):rm.default.createElement(c9,{...e,initialValue:t,editMode:0,multi:!0,source:e.source})};var sg=Ae(Te());var sEe=e=>{let{initialValue:t,saveValue:r}=e,[n,i]=sg.default.useState(t),a=(0,sg.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 sg.default.useEffect(()=>{i(t)},[t]),(0,sg.useEffect)(()=>{e.editMode==4&&a?.current?.focus()},[e.editMode]),e.editMode>2?sg.default.createElement("input",{className:"mk-cell-text",type:"number",ref:a,value:n??"",onChange:l=>i(l.target.value),onKeyDown:s,onBlur:o}):sg.default.createElement("div",{className:"mk-cell-number"},n)};var fn=Ae(Te()),lEe=Ae(bl());var CY=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:W.menu.rename,icon:"ui//edit",value:"edit",onClick:()=>{e.superstate.ui.openModal(W.labels.rename,fn.default.createElement(_i,{value:c,saveLabel:W.labels.rename,saveValue:p=>{a(c,p)}}),Ne(u.view.document))}}),d.push({name:W.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,Zt(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=mr(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(xs,{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}))))},DY=e=>{let t=mr(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:W.menu.insertAbove,value:"insert-above",onClick:k=>{l(x)}}),S.push({name:W.menu.insertBelow,value:"insert-below",onClick:k=>{l(x+1)}}),S.push(qt),x>0&&S.push({name:W.menu.moveUp,value:"move-up",onClick:k=>{e.saveValue(JSON.stringify(Hs(a,x,x-1)))}}),x{e.saveValue(JSON.stringify(Hs(a,x,x+1)))}}),S.push(qt),S.push({name:W.buttons.delete,icon:"ui//trash",value:"delete",onClick:()=>{c(x)}}),e.superstate.ui.openMenu(w,Zt(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)};Da({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(Hs(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(nJe,{...e}),e,Ne(v.view.document))}},fn.default.createElement("div",{className:"mk-icon-xsmall",dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//edit")}}),`${W.menu.edit} ${e.property.name}`)):e.multi?fn.default.createElement("div",{className:"mk-cell-object-multi"},a.map((v,x)=>fn.default.createElement(CY,{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,lEe.createPortal)(fn.default.createElement(Um,{dropAnimation:null,zIndex:1600},fn.default.createElement(CY,{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(CY,{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})},nJe=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=mr(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=mr(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=mr(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"},W.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(DY,{...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")}}),W.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 A9=e=>{let[t,r]=(0,cD.useState)(Dk(e.initialValue)),n=(a,o)=>{r(Dk(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:W.labels.linkItemSelectPlaceholder,detail:!0,searchable:!0}};return cD.default.createElement(ag,{superstate:e.superstate,removeValue:null,baseClass:"mk-cell-link",selectLabel:e.compactMode?e.property.name:W.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 uEe=e=>{let t=(0,Ic.useMemo)(()=>mr(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"?mr(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?tr(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)=>tr(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?"":V5(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 el=Ae(Te());var OY=e=>{let t=async()=>{e.superstate.ui.openPath(e.initialValue,!1)},r=(0,el.useRef)(null),[n,i]=(0,el.useState)(null);(0,el.useEffect)(()=>{LN(e.superstate,e.initialValue).then(c=>i(c))},[e.initialValue]);let a=(0,el.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:W.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:W.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 el.default.createElement("div",{ref:a,className:"mk-cell-space"},el.default.createElement("div",{className:"mk-cell-option-item"},el.default.createElement("div",{onClick:()=>t()},n?.space),e.editMode>2&&el.default.createElement(el.default.Fragment,null,el.default.createElement("span",null),el.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&&el.default.createElement("div",{className:"mk-cell-option-item"},el.default.createElement("div",{onClick:()=>t()},n?.schemaName),n?.space&&el.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 MY=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(xs,{key:o,superstate:e.superstate,initialValue:a.type.startsWith("object")?t?.[a.name]:Sa(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 cEe=e=>{let t=(0,Hd.useMemo)(()=>{let l=mr(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(Z$(e.initialValue)));(0,Hd.useEffect)(()=>{i(r(Z$(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=CJ(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(MY,{...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(MY,{superstate:e.superstate,command:t,value:n,saveValue:o})))};var xh=Ae(Te());var fEe=e=>{let[t,r]=(0,xh.useState)([]),[n,i]=(0,xh.useState)([]);(0,xh.useEffect)(()=>{e.path?(r(e.superstate.pathsIndex.get(e.path)?.metadata?.tags??[]),i([...e.superstate.tagsMap.get(e.path)??[]])):(r(tr(e.initialValue)),i(tr(e.initialValue)))},[]),(0,xh.useEffect)(()=>{e.path||(r(tr(e.initialValue)),i(tr(e.initialValue)))},[e.initialValue]),(0,xh.useEffect)(()=>{if(e.path){let u=c=>{c.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",u),()=>{e.superstate.eventsDispatcher.removeListener("pathStateUpdated",u)}}},[e.path]);let a=u=>{e.path?QB(e.superstate,e.path,u):(r(t.filter(c=>c!=u)),i(n.filter(c=>c!=u)))},o=u=>{e.saveValue(yi(u))},s=(u,c)=>{let f=c[0];e.path?th(e.superstate,e.path,f):(r([...t,f]),i([...n,f]),o([...n,f]))},l=()=>{let u=e.superstate.spaceManager.readTags().map(c=>({name:c,value:c}));return{ui:e.superstate.ui,multi:!1,editable:!0,value:n,options:u,saveOptions:s,placeholder:W.labels.tagItemSelectPlaceholder,searchable:!0,showAll:!0,onHide:()=>e.setEditMode(null)}};return xh.default.createElement(ag,{superstate:e.superstate,baseClass:"mk-cell-tags",removeValue:a,menuProps:l,selectLabel:e.compactMode?e.property.name:W.labels.select,value:n,multi:!0,editMode:e.editMode,labelElement:u=>xh.default.createElement("div",{className:"mk-cell-tags-label"},u.value,t.some(c=>c.toLowerCase()==u.value)&&u.children)})};var nb=Ae(Te());var dEe=e=>{let{initialValue:t,saveValue:r}=e,n=(0,nb.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,nb.useEffect)(()=>{if(e.editMode==4&&n?.current){let o=window.getSelection();o.selectAllChildren(n.current),o.collapseToEnd()}},[e.editMode]),e.editMode>2?nb.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}}):nb.default.createElement("div",{className:"mk-cell-text"},t)};var x2=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(m9,{...o,multi:s.multiType==r.type}):s.type=="boolean"?xo.default.createElement(l9,{...o}):s.type=="option"?xo.default.createElement(c9,{...o,multi:s.multiType==r.type,saveOptions:a,source:e.source}):s.type=="date"?xo.default.createElement(aEe,{...o}):s.type=="context"?xo.default.createElement(q2e,{...o,multi:s.multiType==r.type,source:e.source,contextTable:e.contextTable,contextPath:e.contextPath}):s.type=="aggregate"?xo.default.createElement(uEe,{...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(oEe,{...o,row:e.row,columns:e.columns,saveOptions:a,source:e.source}):s.type=="number"?xo.default.createElement(sEe,{...o}):s.type=="link"?xo.default.createElement(uD,{...o,multi:s.multiType==r.type,source:e.source}):s.type=="tags-multi"?xo.default.createElement(fEe,{...o}):s.type=="image"?xo.default.createElement(h9,{...o,multi:s.multiType==r.type}):s.type=="object"?xo.default.createElement(DY,{...o,multi:s.multiType==r.type,savePropValue:a,columns:e.columns,row:e.row,compactMode:e.compactMode}):s.type=="color"?xo.default.createElement($2e,{...o}):s.type=="space"?xo.default.createElement(OY,{...o,isTable:!1}):s.type=="table"?xo.default.createElement(OY,{...o,isTable:!0}):s.type=="super"?xo.default.createElement(cEe,{...o,row:n,columns:e.columns,compactMode:e.compactMode,source:e.source}):s.type=="input"?xo.default.createElement(A9,{...o,columns:e.columns}):xo.default.createElement(dEe,{...o}):xo.default.createElement(xo.default.Fragment,null)};var AEe=e=>{let{spaceInfo:t,spaceState:r}=(0,Ht.useContext)(ur),{readMode:n}=(0,Ht.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,Ht.useContext)(Ta),g=e.superstate.settings.contextPagination??25,[A,b]=Ht.default.useState({pageIndex:0,pageSize:g}),[v,x]=(0,Ht.useState)(null),[w,S]=(0,Ht.useState)(null),[k,j]=(0,Ht.useState)(null),[O,C]=(0,Ht.useState)(null),[N,D]=(0,Ht.useState)(null),[P,q]=(0,Ht.useState)({}),z=(0,Ht.useRef)(null),I=c.find(R=>R.primary=="true");(0,Ht.useEffect)(()=>{q({...d?.colsSize??{},"+":30})},[d]),(0,Ht.useEffect)(()=>{C(null)},[k,w]);let T=R=>{let J=R(P);q(J),L(J)},L=(0,Ht.useCallback)((0,hEe.debounce)(R=>p({colsSize:R}),1e3),[d]),_=(R,J,ee)=>{a?.id==pr?Ji(e.superstate,r,"md",R,!0):s(vk(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,...R2e(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=cY(w,f.map(_e=>_e._index));u(Ce,[Ce]),S(Ce)},Ee=()=>{let Ce=fY(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=fY(k,te.map(_e=>_e.accessorKey).filter(_e=>_e!="+"));j(Ce)}if(R.key=="ArrowRight"){let Ce=cY(k,te.map(_e=>_e.accessorKey).filter(_e=>_e!="+"));j(Ce)}},te=(0,Ht.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:R.schemaId==pr&&f[ee][mt],columns:c,contextPath:r.path};return fc(R.type,R.name)?Ht.default.createElement(x2,{...Ct}):Ht.default.createElement(Ht.default.Fragment,null,Ce)}}))??[],...n?[]:[{header:"+",meta:{schemaId:a?.id},accessorKey:"+",size:20,cell:()=>Ht.default.createElement(Ht.default.Fragment,null)}]],[c,f,O,d,a,o]),Q=(0,Ht.useMemo)(()=>d?.groupBy?.length>0&&c.find(R=>R.name+R.table==d.groupBy[0])?d.groupBy:[],[d,c]),fe=S2e({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:v2e(),getExpandedRowModel:y2e(),getGroupedRowModel:x2e(),getPaginationRowModel:w2e(),onPaginationChange:b,meta:{updateData:m,updateFieldValue:h}}),Ie=qw(Pp(RA,{activationConstraint:{distance:10}}),Pp($A,{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,Ht.useMemo)(()=>{let R={};return Object.keys(d.colsCalc).forEach(J=>{R[J]=V5(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:Hs(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 Ht.default.createElement(Lw,{sensors:Ie,collisionDetection:PN,measuring:Se,onDragStart:Oe,onDragOver:ve,onDragEnd:ae,onDragCancel:ce},Ht.default.createElement("div",{className:"mk-table",ref:z,tabIndex:1,onKeyDown:oe,onMouseDown:R=>R.stopPropagation()},Ht.default.createElement("table",{...{}},Ht.default.createElement("thead",null,fe.getHeaderGroups().map(R=>Ht.default.createElement("tr",{key:R.id},Ht.default.createElement("th",null),R.headers.map(J=>Ht.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()?Ht.default.createElement(Ht.default.Fragment,null):Ht.default.createElement(e9,{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)}):Ht.default.createElement(e9,{superstate:e.superstate,isNew:!0,editable:!0,column:{name:"",schemaId:J.column.columnDef.meta.schemaId,type:"text",table:""}}),Ht.default.createElement("div",{...{onMouseDown:J.getResizeHandler(),onTouchStart:J.getResizeHandler(),className:`mk-resizer ${J.column.getIsResizing()?"isResizing":""}`}})))))),Ht.default.createElement("tbody",null,fe.getRowModel().rows.map(R=>Ht.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);s9(J,e.superstate,r.path,a.id,ee)},key:R.id},Ht.default.createElement("td",null),R.getVisibleCells().map((J,ee)=>J.getIsGrouped()?Ht.default.createElement("td",{key:ee,className:"mk-td-group",colSpan:c.length+(n?0:1)},Ht.default.createElement("div",{...{onClick:R.getToggleExpandedHandler(),style:{display:"flex",alignItems:"center",cursor:"normal"}}},K5(J.column.columnDef.cell,J.getContext())," ","(",R.subRows.length,")")):J.getIsAggregated()?Ht.default.createElement(Ht.default.Fragment,{key:ee},K5(J.column.columnDef.aggregatedCell??J.column.columnDef.cell,J.getContext())):Ht.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:K5(J.column.columnDef.cell,J.getContext())))))),Ht.default.createElement("tfoot",null,fe.getCanNextPage()&&Ht.default.createElement("tr",null,Ht.default.createElement("th",{className:"mk-row-new",colSpan:c.length+(n?1:2),onClick:()=>fe.setPageSize(A.pageSize+g)},W.buttons.loadMore)),n?Ht.default.createElement(Ht.default.Fragment,null):Ht.default.createElement("tr",null,Ht.default.createElement("th",{className:"mk-row-new",colSpan:c.length+(n?1:2),"data-placeholder":W.hintText.newItem,onFocus:R=>{j(null),S(null)},onKeyPress:R=>{R.key=="Enter"&&(_(R.currentTarget.innerText),R.currentTarget.innerText="",R.currentTarget.blur())},contentEditable:!0})),Ht.default.createElement("tr",null,Ht.default.createElement("td",null),Q.map((R,J)=>Ht.default.createElement("td",{key:J})),(Q.length>0?c.filter(R=>!Q.includes(R.name)):c).map((R,J)=>Ht.default.createElement("td",{key:J,className:(0,mEe.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,Zt(e.superstate.ui,ie),Ne(ee.view.document))}},d.colsCalc[R.name]?.length>0?Ht.default.createElement("div",null,Ht.default.createElement("span",null,_c[d.colsCalc[R.name]].shortLabel??_c[d.colsCalc[R.name]].label),ke[R.name]):Ht.default.createElement("div",null,Ht.default.createElement("span",null,"Calculate")))),Ht.default.createElement("td",null)))),(0,pEe.createPortal)(Ht.default.createElement(Um,{dropAnimation:null,zIndex:1600},v?Ht.default.createElement(e9,{superstate:e.superstate,editable:!1,column:{name:v,schemaId:i.schema.id,type:"text",table:""}}):null),document.body)))};var xs=e=>{let t=(0,wo.useMemo)(()=>Rx(e.column),[e.column]),r=mr(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=mr(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=mr(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(x2,{...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")}}),W.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(x2,{...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(x2,{...e})))};var gEe=e=>{let{pathState:t}=(0,Ss.useContext)($r),[r,n]=(0,Ss.useState)({}),[i,a]=(0,Ss.useState)([]),[o,s]=(0,Ss.useState)([]),{tableData:l,saveProperty:u,delProperty:c,saveFrame:f}=(0,Ss.useContext)(Aa),d=async()=>{let D=e.superstate.spacesMap.get(t.path)??new Set,P=(await Promise.all([...D].map(async _=>e.superstate.spaceManager.readTable(_,pr).then(Y=>Y.cols??[])))).reduce((_,Y)=>[..._,...Y],[]),q=[],z={},I=t?.metadata?.property??{},T=pM([...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:bA(I[_],_)});I&&(q.push(...L),T.forEach(_=>{z[_]=$i(_,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,Ss.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]:ca(P.type,D,!0)})},m=D=>{c&&D&&c(D),Rye(e.superstate,t.path,D.name)},g=async(D,P)=>{let q={...D,schemaId:pr},z=e.superstate.spacesIndex.get(P)?.space;!z||(await e.superstate.spaceManager.addSpaceProperty(P,q),await UN(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:W.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)}BV(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,Ss.useState)(null),[k,j]=(0,Ss.useState)(null),O=()=>{j(null),S(null)};Da({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&&BV(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}iwe(e.superstate,q,Ne(D.view.document),P,m,()=>A(D,P),b,x)};return Ss.default.createElement(Ss.default.Fragment,null,e.compactMode?i.map((D,P)=>Ss.default.createElement(xs,{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)=>Ss.default.createElement(xs,{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})):Ss.default.createElement(Ss.default.Fragment,null),o.length>0&&Ss.default.createElement("style",null,`${o.map(D=>`.metadata-property[data-property-key="${D}"]`).join(", ")} + rgba(0,0,0,0) 100%)`}}),va.default.createElement("span",{style:{flex:1}}),W.editor.hex,va.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)}})),va.default.createElement("div",{style:{fontSize:"13px",padding:"4px",marginTop:"8px"}},W.editor.themeColors),va.default.createElement("div",null,b2.map((p,h)=>va.default.createElement("div",{key:h,"aria-label":p[0],onMouseDown:()=>{c(p[1])},className:"mk-color",style:{background:p[1]}}))),va.default.createElement("div",null,j2e.map((p,h)=>va.default.createElement("div",{key:h,"aria-label":p[0],onMouseDown:()=>{c(p[1])},className:"mk-color",style:{background:p[1]}}))),va.default.createElement("div",{style:{fontSize:"13px",padding:"4px",marginTop:"8px"}},W.editor.uiColors),va.default.createElement("div",null,N2e.map((p,h)=>va.default.createElement("div",{key:h,"aria-label":p[0],onMouseDown:()=>{c(p[1])},className:"mk-color",style:{background:p[1]}})),T2e.map((p,h)=>va.default.createElement("div",{key:h,"aria-label":p[0],onMouseDown:()=>{c(p[1])},className:"mk-color",style:{background:p[1]}})))))},Vu=(e,t,r,n,i,a,o)=>e.ui.openCustomMenu(t,va.default.createElement(xXe,{superstate:e,color:n,saveValue:i,stayOpen:a}),{},r,"bottom");var ao=(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:W.buttons.tag,value:"tag"},{name:W.menu.folder,value:"folder"}],saveOptions:(l,u)=>{n(u[0],!s.some(c=>c.value==u[0]))},placeholder:W.labels.spaceSelectPlaceholder,detail:!0,searchable:!0,showSections:!o,showAll:!0},t,"bottom")};var F2e=(e,t,r)=>{let n=t.map(a=>a.item.path),i=[];return i.push({name:W.menu.openFilePane,icon:"ui//go-to-file",onClick:a=>{n.forEach(o=>e.ui.openPath(o,!0))}}),e.settings.spacesStickers&&(i.push(qt),i.push({name:W.menu.changeColor,icon:"ui//palette",type:6,onSubmenu:a=>Vu(e,a,Ne(r.view.document),"",o=>O2e(e,n,o),!1,!0)}),i.push({name:W.buttons.changeIcon,icon:"ui//sticker",onClick:a=>{e.ui.openPalette(iD.default.createElement(Fa,{ui:e.ui,selectedSticker:o=>D2e(e,n,o)}),Ne(a.view.document))}}),i.push({name:W.buttons.removeIcon,icon:"ui//file-minus",onClick:a=>{t9(e,n)}})),i.push(qt),i.push({name:W.menu.moveFile,icon:"ui//paper-plane",onClick:a=>{let o=a.target.getBoundingClientRect();ao(o,Ne(a.view.document),e,s=>{n.forEach(l=>{aee(e,l,s)})})}}),i.push({name:W.buttons.addToSpace,icon:"ui//pin",onClick:a=>{let o=a.target.getBoundingClientRect();ao(o,Ne(a.view.document),e,s=>{A2(e,t.map(l=>l.path),s,-1,"link")},!0)}}),i.push(qt),i.push({name:W.menu.hide,icon:"ui//eye-off",onClick:a=>{iee(e,n)}}),i.push({name:W.menu.delete,icon:"ui//trash",onClick:a=>{e.ui.openModal(W.labels.deleteFiles,iD.default.createElement(Jy,{confirmAction:()=>{n.forEach(o=>{P1(e,o)})},confirmLabel:W.buttons.delete,message:W.descriptions.deleteFiles.replace("${1}",n.length.toString())}),Ne(a.view.document))}}),e.ui.openMenu(r.target.getBoundingClientRect(),Zt(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:W.menu.openFilePane,icon:"ui//go-to-file",onClick:u=>{e.ui.openPath(t,!0)}}),l.push(qt),o&&(l.push({name:W.menu.closeSpace,icon:"ui//close",onClick:u=>{o()}}),l.push(qt)),r&&r!=s.parent){let u=e.spacesIndex.get(r);u&&l.push({name:W.menu.removeFromSpace,icon:"ui//pin-off",onClick:c=>{fv(e,u.path,[t])}})}return e.settings.spacesStickers&&(l.push(qt),l.push({name:W.menu.changeColor,icon:"ui//palette",type:6,onSubmenu:u=>Vu(e,u,i,"",c=>h2(e,t,c),!1,!0)}),l.push({name:W.buttons.changeIcon,icon:"ui//sticker",onClick:u=>{e.ui.openPalette(iD.default.createElement(Fa,{ui:e.ui,selectedSticker:c=>g2(e,t,c)}),Ne(u.view.document))}}),l.push({name:W.buttons.removeIcon,icon:"ui//file-minus",onClick:u=>{v2(e,t)}})),e.ui.hasNativePathMenu(t)&&(l.push(qt),l.push({name:W.menu.openNativeMenu,icon:"ui//options",onClick:u=>{e.ui.nativePathMenu(u,t)}})),l.push(qt),s.type=="file"&&s.subtype=="md"&&l.push({name:W.menu.changeToFolderNote,icon:"ui//file-plus-2",onClick:u=>{NM(e,t,!1)}}),l.push({name:W.menu.rename,icon:"ui//edit",onClick:u=>{e.ui.openModal(W.labels.rename,iD.default.createElement(_i,{saveLabel:W.buttons.rename,value:s.name,saveValue:c=>Ux(e,t,c)}),Ne(u.view.document))}}),l.push({name:W.buttons.addToSpace,icon:"ui//pin",onClick:u=>{let c=u.target.getBoundingClientRect();ao(c,Ne(u.view.document),e,f=>{A2(e,[t],f,-1,"link")},!0)}}),l.push({name:W.menu.moveFile,icon:"ui//paper-plane",onClick:u=>{let c=u.target.getBoundingClientRect();ao(c,Ne(u.view.document),e,f=>{let d=e.pathsIndex.get(t);e.spaceManager.renamePath(t,jm(t,f))})}}),l.push({name:W.menu.duplicate,icon:"ui//documents",onClick:u=>{e.spaceManager.copyPath(t,`${s.parent}`,`${s.name}`)}}),l.push({name:W.buttons.saveTemplate,icon:"ui//clipboard-add",onClick:u=>{cv(e,t,r)}}),l.push(qt),Gr(e.ui)||(l.push({name:e.ui.getOS()=="mac"?W.menu.revealInDefault:W.menu.revealInExplorer,icon:"ui//arrow-up-right",onClick:u=>{e.ui.openPath(t,"system")}}),l.push(qt)),l.push({name:W.menu.hide,icon:"ui//eye-off",onClick:u=>{jM(e,t)}}),l.push({name:W.menu.delete,icon:"ui//trash",onClick:u=>{P1(e,t)}}),e.ui.openMenu(n,Zt(e.ui,l),i,a),!1};var o9=Ae(Te());var _2e=Ae(Te());var P2e=(e,t,r)=>{let n=e.spacesIndex.get(t);du(e,n.space,{...n.metadata,contexts:r})},wXe=(e,t,r,n,i)=>{let a=t.spacesIndex.get(r),o=t.spaceManager.readTags(),s=async l=>{let u=zx(l);P2e(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:W.labels.contextItemSelectPlaceholder,searchable:!0,showAll:!0},n,null,i)},SXe=(e,t,r,n,i)=>{let a=[];a.push({name:W.buttons.addContext,icon:"ui//plus",type:6,onSubmenu:(s,l)=>wXe(s,r,t,n,l)}),a.push(qt);let o=r.spacesIndex.get(t);return o.contexts.forEach(s=>{a.push({name:s,icon:"ui//tags",onClick:l=>{r.ui.openPath(Hn(s))},onMoreOptions:l=>{let u=l.target.getBoundingClientRect(),c=[];return c.push({name:W.menu.deleteContext,icon:"ui//trash",onClick:f=>{P2e(r,o.path,o.contexts.filter(d=>d!=s))}}),r.ui.openMenu(u,{ui:r.ui,multi:!1,editable:!1,value:[],options:c,placeholder:W.labels.contextItemSelectPlaceholder,searchable:!1,showAll:!0},n)}})}),r.ui.openMenu(e,{ui:r.ui,multi:!1,editable:!1,value:[],options:a,placeholder:W.labels.contextItemSelectPlaceholder,searchable:!1,showAll:!0},n,null,i)},r9=(e,t,r,n)=>{let i=[{name:"Apply Tags",icon:"ui//tags",value:"apply-tags",onSubmenu:(a,o)=>SXe(a,r.path,t,n,o)},{name:"Set Default Sticker",icon:"ui//sticker",value:"apply-all-sticker",onClick:()=>{t.ui.openPalette(_2e.default.createElement(Fa,{ui:t.ui,selectedSticker:a=>du(t,r.space,{...r.metadata,defaultSticker:a})}),n)}}];return t.ui.openMenu(e,Zt(t.ui,i),n)};var n9=Ae(Te());var Gu=(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:W.labels.linkItemSelectPlaceholder,detail:!0,searchable:!0,showAll:!0,sections:o,showSections:!0,...i??{}},t)};var i9=(e,t,r,n)=>{if(t?.path==Kg)e.ui.openModal("New Tag",n9.default.createElement(_i,{value:"",saveLabel:W.labels.saveView,saveValue:i=>fC(e,i)}),r);else if(t)if(t?.metadata.template?.length>0){mC(e,t,t.metadata.template,n);return}else Ji(e,t,"md",null,!1,null,n);else uv(e,e.pathsIndex.get(e.ui.activePath)).then(i=>{i&&Ji(e,i,"md",null,!1,null,n)})},a9=(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",n9.default.createElement(_i,{value:"",saveLabel:W.labels.saveView,saveValue:l=>fC(e,l)}),Ne(s.view.document))}});else if(o.push({name:W.labels.createNote,icon:"ui//edit",onClick:s=>{Ji(e,n,"md",e.settings.newNotePlaceholder,i)}}),o.push({name:W.buttons.createCanvas,icon:"ui//layout-dashboard",onClick:s=>{Ji(e,n,"canvas",null,i)}}),o.push({name:W.labels.createSection,icon:"ui//folder-plus",onClick:s=>{e.ui.openModal(W.labels.createSection,n9.default.createElement(_i,{saveLabel:W.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(W.notice.newSpaceName);return}if(e.spacesIndex.has(d)){e.ui.notify(W.notice.duplicateSpaceName);return}kf(e,d,{})}}),Ne(s.view.document))}}),n.type=="folder"&&o.push({name:W.buttons.addIntoSpace,icon:"ui//pin",onClick:s=>{let l=s.target.getBoundingClientRect();Gu(l,Ne(s.view.document),e,u=>{rh(e,n,u)}),s.stopPropagation()}}),n.templates.length>0){o.push(qt);for(let s of n.templates)o.push({name:s,icon:"ui//clipboard-pen",onClick:l=>{mC(e,n,s)}})}return e.ui.openMenu(t,Zt(e.ui,o),r,"right")};var eb=(e,t,r,n,i,a)=>{let o=e.spacesIndex.get(t.path);if(!o)return;let s=[];s.push({name:W.menu.openFilePane,icon:"ui//go-to-file",onClick:u=>{e.ui.openPath(t.path,!0)}}),s.push(qt),s.push({name:"New",type:6,onSubmenu:u=>a9(e,u,Ne(r.view.document),o,!1,!0),icon:"ui//plus"}),s.push(qt),s.push(qt),e.settings.spacesStickers&&(s.push({name:W.menu.changeColor,icon:"ui//palette",type:6,onSubmenu:u=>Vu(e,u,Ne(r.view.document),"",c=>h2(e,o.path,c),!1,!0)}),s.push({name:W.buttons.changeIcon,icon:"ui//sticker",onClick:u=>{e.ui.openPalette(o9.default.createElement(Fa,{ui:e.ui,selectedSticker:c=>Kp(e,o.path,c)}),Ne(u.view.document))}}),s.push({name:W.buttons.removeIcon,icon:"ui//file-minus",onClick:u=>{v2(e,o.path)}})),o.metadata?.sort&&(s.push(qt),s.push({name:W.menu.sortBy,icon:"ui//sort-desc",type:6,onSubmenu:u=>{let c=[];c.push({name:W.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(qt),c.push({name:W.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(qt);let f={field:"rank",asc:!0,group:o.metadata.sort.group,recursive:o.metadata.sort.recursive};c.push({name:W.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(qt);let d={field:"name",asc:!0,group:o.metadata.sort.group,recursive:o.metadata.sort.recursive};c.push({name:W.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:W.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(qt);let h={field:"number",asc:!0,group:o.metadata.sort.group,recursive:o.metadata.sort.recursive};c.push({name:W.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:W.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(qt);let g={field:"ctime",asc:!1,group:o.metadata.sort.group,recursive:o.metadata.sort.recursive};c.push({name:W.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:W.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(qt);let b={field:"size",asc:!1,group:o.metadata.sort.group,recursive:o.metadata.sort.recursive};c.push({name:W.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:W.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,Zt(e.ui,c),Ne(r.view.document))}})),s.push({name:W.menu.applyItems,icon:"ui//apply-items",value:"apply-all",type:6,onSubmenu:u=>r9(u,e,o,Ne(r.view.document))}),e.ui.hasNativePathMenu(o.path)&&(s.push(qt),s.push({name:W.menu.openNativeMenu,icon:"ui//options",onClick:u=>{e.ui.nativePathMenu(u,o.path)}})),o.type!="default"&&(s.push(qt),s.push({name:W.menu.rename,icon:"ui//edit",onClick:u=>{e.ui.openModal(W.labels.rename,o9.default.createElement(_i,{saveLabel:W.buttons.rename,value:o.type=="tag"?hl(o.name):o.name,saveValue:c=>Ux(e,o.path,c)}),Ne(u.view.document))}}));let l=e.spacesIndex.get(i);if(l&&(l.type=="folder"||l.type=="vault")&&i!=t.parent){let u=e.spacesIndex.get(i);u&&s.push({name:W.menu.removeFromSpace.replace("${1}",u.name),icon:"ui//pin-off",onClick:c=>{fv(e,u.path,[o.path])}})}return a&&s.push({name:W.menu.closeSpace,icon:"ui//close",onClick:u=>{a()}}),o.type=="folder"&&s.push({name:W.buttons.addToSpace,icon:"ui//pin",onClick:u=>{let c=u.target.getBoundingClientRect();ao(c,Ne(u.view.document),e,f=>{let d=e.spacesIndex.get(f);d&&QS(e,d,o.path,-1)},!0)}}),o.type=="folder"&&s.push({name:W.menu.moveFile,icon:"ui//paper-plane",onClick:u=>{let c=u.target.getBoundingClientRect();ao(c,Ne(u.view.document),e,f=>{e.spaceManager.renameSpace(o.path,jm(o.path,f))})}}),s.push({name:W.menu.duplicate,icon:"ui//documents",onClick:u=>{e.spaceManager.copyPath(t.path,`${t.parent}`)}}),l&&(l.type=="folder"||l.type=="vault")&&s.push({name:W.buttons.saveTemplate,icon:"ui//clipboard-add",onClick:u=>{cv(e,o.path,i)}}),s.push(qt),Gr(e.ui)||s.push({name:e.ui.getOS()=="mac"?W.menu.revealInDefault:W.menu.revealInExplorer,icon:"ui//arrow-up-right",onClick:u=>{e.ui.openPath(o.space.folderPath,"system")}}),s.push(qt),o.type=="folder"&&s.push({name:W.menu.hide,icon:"ui//eye-off",onClick:u=>{jM(e,o.path)}}),(o.type=="folder"||o.type=="tag")&&s.push({name:W.menu.delete,icon:"ui//trash",onClick:u=>{e.ui.openModal(W.labels.deleteSpace,o9.default.createElement(Jy,{confirmAction:()=>Iye(e,o.path),confirmLabel:W.buttons.delete,message:W.descriptions.deleteSpace}),Ne(u.view.document))}}),e.ui.openMenu(r.target.getBoundingClientRect(),Zt(e.ui,s),Ne(r.view.document)),!1};var Qu=Ae(Te()),I2e=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&&WN(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"},W.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(xs,{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 s9=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&&eb(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:W.menu.editProperties,icon:"ui//list",onClick:c=>{t.ui.openCustomMenu(c.currentTarget.getBoundingClientRect(),B2e.default.createElement(I2e,{...u}),u,Ne(c.view.document))}}),l.push({name:W.menu.deleteRow,icon:"ui//trash",onClick:c=>{zoe(t.spaceManager,t.spacesIndex.get(r)?.space,n,i)}}),t.ui.openMenu(e.target.getBoundingClientRect(),Zt(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]},R2e=(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 hEe=Ae(bi());var xo=Ae(Te());var ig=Ae(Te());var l9=e=>{let{initialValue:t,saveValue:r}=e,[n,i]=ig.default.useState(t=="true"),a=()=>{e.editMode!=0&&(i(!n),r(n?"false":"true"))};return(0,ig.useEffect)(()=>{e.editMode==4&&(i(!n),r(n?"false":"true"),e.setEditMode(null))},[e.editMode]),ig.default.useEffect(()=>{i(t=="true")},[t]),e.editMode<2?ig.default.createElement("div",{className:"mk-cell-boolean"},ig.default.createElement("input",{type:"checkbox",checked:n,onChange:a})):ig.default.createElement("div",{className:"mk-cell-boolean"},ig.default.createElement("input",{type:"checkbox",checked:n,onChange:a}))};var mY=Ae(Te());var $2e=e=>{let t=r=>{let n=a=>{e.saveValue(a)},i=r.target.getBoundingClientRect();Vu(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:W.buttons.changeIcon,icon:"ui//sticker",onClick:c=>{e.superstate.ui.openPalette(Pc.default.createElement(Fa,{ui:e.superstate.ui,selectedSticker:f=>Kp(e.superstate,t?.path,f)}),Ne(c.view.document))}}),u.push({name:W.buttons.removeIcon,icon:"ui//file-minus",onClick:()=>{t9(e.superstate,[t.path])}}),e.superstate.ui.openMenu(l.target.getBoundingClientRect(),{ui:e.superstate.ui,multi:!1,value:[],editable:!1,options:u,searchable:!1,showAll:!0},Ne(l.view.document)),!1},a=l=>{if(l.stopPropagation(),t?.type=="space"){e.superstate.ui.openPalette(Pc.default.createElement(Fa,{ui:e.superstate.ui,selectedSticker:u=>Kp(e.superstate,t.path,u)}),Ne(l.view.document));return}e.superstate.ui.openPalette(Pc.default.createElement(Fa,{ui:e.superstate.ui,selectedSticker:u=>Kp(e.superstate,t.path,u)}),Ne(l.view.document))},[o,s]=ng(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":W.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)}))},u9=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(bi()),Ai=Ae(Te());var c9=e=>{let t=(0,Ai.useMemo)(()=>mr(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(bJ("value")).filter(v=>v.value.length>0),n=(m,g)=>(g?tr(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(yi(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(mA(g,t),yi(A)):e.saveOptions(mA(g,t),ss(A))},c=(m,g)=>{e.multi?e.saveOptions(mA(m,t),yi(g)):e.saveOptions(mA(m,t),ss(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(qt),b.push({name:"None",color:"var(--mk-color-none)",onClick:()=>{d(A.value,{...A,color:""})}}),b2.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(),Zt(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:W.menu.none,value:""},...i],saveOptions:f,removeOption:e.editMode>=2&&u,onMoreOption:e.editMode>=2&&p,placeholder:W.labels.optionItemSelectPlaceholder,searchable:!0,showAll:!0,onHide:()=>e.setEditMode(null)});return Ai.default.createElement(ag,{superstate:e.superstate,baseClass:"mk-cell-option",value:o,menuProps:h,multi:e.multi,removeValue:l,selectLabel:e.compactMode?e.property.name:W.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)}})},ag=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,W.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 q2e=e=>{let{contextTable:t}=e,r=(0,Ff.useMemo)(()=>mr(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?tr(m)??[]:[m]).filter(A=>A),[a,o]=(0,Ff.useState)([]);(0,Ff.useEffect)(()=>{!r?.field||!t[n]||o(t[n].rows.reduce((m,g)=>tr(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(yi(m)):e.saveValue(ss(m))},d=m=>{if(a.includes(m)){let g=a.filter(A=>A!=m);o(g),UN(e.superstate.spaceManager,e.superstate.spacesIndex.get(n).space,m,r.spaceField,e.path,Poe)}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):Ji(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:W.menu.none,value:""},...s];return{ui:e.superstate.ui,multi:!1,editable:!0,value:c.map(g=>g.path),options:m,saveOptions:p,placeholder:W.labels.contextItemSelectPlaceholder,searchable:!0,showAll:!0,onHide:()=>e.setEditMode(null)}};return Ff.default.createElement(ag,{baseClass:"mk-cell-context",superstate:e.superstate,menuProps:h,removeValue:d,selectLabel:e.compactMode?e.property.name:W.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 Pi=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(nKe,{displayMonth:e.displayMonth,hideNext:c,hidePrevious:f,nextMonth:i,previousMonth:n,onPreviousClick:d,onNextClick:p})}function iKe(e){var t,r=ya(),n=r.classNames,i=r.disableNavigation,a=r.styles,o=r.captionLayout,s=r.components,l=(t=s?.CaptionLabel)!==null&&t!==void 0?t:Y2e,u;return i?u=dt.jsx(l,{id:e.id,displayMonth:e.displayMonth}):o==="dropdown"?u=dt.jsx(z2e,{displayMonth:e.displayMonth,id:e.id}):o==="dropdown-buttons"?u=dt.jsxs(dt.Fragment,{children:[dt.jsx(z2e,{displayMonth:e.displayMonth,displayIndex:e.displayIndex,id:e.id}),dt.jsx(U2e,{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(U2e,{displayMonth:e.displayMonth,id:e.id})]}),dt.jsx("div",{className:n.caption,style:a.caption,children:u})}function aKe(e){var t=ya(),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 oKe(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=la(n,a);i.push(o)}return i}function sKe(){var e=ya(),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=oKe(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 lKe(){var e,t=ya(),r=t.classNames,n=t.styles,i=t.components,a=(e=i?.HeadRow)!==null&&e!==void 0?e:sKe;return dt.jsx("thead",{style:n.head,className:r.head,children:dt.jsx(a,{})})}function uKe(e){var t=ya(),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 cKe(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(fKe,{initialProps:e.initialProps,children:e.children})}function fKe(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?V2e([],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 dKe(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?nk(e,n)?{from:e,to:n}:{from:n,to:e}:{from:e,to:void 0}}var wY=(0,Ln.createContext)(void 0);function pKe(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(mKe,{initialProps:e.initialProps,children:e.children})}function mKe(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=dKe(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:la(a,s-1)}),a&&o&&c.disabled.push({after:a,before:la(a,s-1)}),!a&&o&&c.disabled.push({after:Fx(o,s-1),before:la(o,s-1)})),l){if(a&&!o&&(c.disabled.push({before:la(a,-l+1)}),c.disabled.push({after:la(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:la(o,d)})}!a&&o&&(c.disabled.push({before:la(o,-l+1)}),c.disabled.push({after:la(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 f9(e){return Array.isArray(e)?V2e([],e,!0):e!==void 0?[e]:[]}function hKe(e){var t={};return Object.entries(e).forEach(function(r){var n=r[0],i=r[1];t[n]=f9(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 AKe=em.Selected,og=em.Disabled,gKe=em.Hidden,vKe=em.Today,AY=em.RangeEnd,gY=em.RangeMiddle,vY=em.RangeStart,yKe=em.Outside;function bKe(e,t,r){var n,i=(n={},n[AKe]=f9(e.selected),n[og]=f9(e.disabled),n[gKe]=f9(e.hidden),n[vKe]=[e.today],n[AY]=[],n[gY]=[],n[vY]=[],n[yKe]=[],n);return e.fromDate&&i[og].push({before:e.fromDate}),e.toDate&&i[og].push({after:e.toDate}),sD(e)?i[og]=i[og].concat(t.modifiers[og]):lD(e)&&(i[og]=i[og].concat(r.modifiers[og]),i[vY]=r.modifiers[vY],i[gY]=r.modifiers[gY],i[AY]=r.modifiers[AY]),i}var K2e=(0,Ln.createContext)(void 0);function xKe(e){var t=ya(),r=xY(),n=SY(),i=bKe(t,r,n),a=hKe(t.modifiers),o=Tr(Tr({},i),a);return dt.jsx(K2e.Provider,{value:o,children:e.children})}function J2e(){var e=(0,Ln.useContext)(K2e);if(!e)throw new Error("useModifiers must be used within a ModifiersProvider");return e}function wKe(e){return Boolean(e&&typeof e=="object"&&"before"in e&&"after"in e)}function SKe(e){return Boolean(e&&typeof e=="object"&&"from"in e)}function EKe(e){return Boolean(e&&typeof e=="object"&&"after"in e)}function kKe(e){return Boolean(e&&typeof e=="object"&&"before"in e)}function CKe(e){return Boolean(e&&typeof e=="object"&&"dayOfWeek"in e)}function DKe(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 OKe(e){return O1(e)}function MKe(e){return Array.isArray(e)&&e.every(O1)}function jKe(e,t){return t.some(function(r){if(typeof r=="boolean")return r;if(OKe(r))return pl(e,r);if(MKe(r))return r.includes(e);if(SKe(r))return DKe(e,r);if(CKe(r))return r.dayOfWeek.includes(e.getDay());if(wKe(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 EKe(r)?od(e,r.after)>0:kKe(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 jKe(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 NKe(e,t){for(var r=Wo(e[0]),n=t0(e[e.length-1]),i,a,o=r;o<=n;){var s=EY(o,t),l=!s.disabled&&!s.hidden;if(!l){o=la(o,1);continue}if(s.selected)return o;s.today&&!a&&(a=o),i||(i=o),o=la(o,1)}return a||i}var TKe=365;function eEe(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:la,week:Jg,month:Uo,year:AM,startOfWeek:function(g){return i.ISOWeek?tf(g):mo(g,{locale:f,weekStartsOn:l})},endOfWeek:function(g){return i.ISOWeek?KE(g):gA(g,{locale:f,weekStartsOn:l})}},p=d[r](e,n==="after"?1:-1);n==="before"&&u?p=gM([u,p]):n==="after"&&c&&(p=vM([c,p]));var h=!0;if(a){var m=EY(p,a);h=!m.disabled&&!m.hidden}return h?p:s.count>TKe?s.lastFocused:eEe(p,{moveBy:r,direction:n,context:i,modifiers:a,retry:Tr(Tr({},s),{count:s.count+1})})}var tEe=(0,Ln.createContext)(void 0);function FKe(e){var t=tb(),r=J2e(),n=(0,Ln.useState)(),i=n[0],a=n[1],o=(0,Ln.useState)(),s=o[0],l=o[1],u=NKe(t.displayMonths,r),c=i??(s&&t.isDateDisplayed(s))?s:u,f=function(){l(i),a(void 0)},d=function(g){a(g)},p=ya(),h=function(g,A){if(!!i){var b=eEe(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(tEe.Provider,{value:m,children:e.children})}function kY(){var e=(0,Ln.useContext)(tEe);if(!e)throw new Error("useFocusContext must be used within a FocusProvider");return e}function _Ke(e,t){var r=J2e(),n=EY(e,r,t);return n}var CY=(0,Ln.createContext)(void 0);function PKe(e){if(!p9(e.initialProps)){var t={selected:void 0};return dt.jsx(CY.Provider,{value:t,children:e.children})}return dt.jsx(IKe,{initialProps:e.initialProps,children:e.children})}function IKe(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 rEe(){var e=(0,Ln.useContext)(CY);if(!e)throw new Error("useSelectSingle must be used within a SelectSingleProvider");return e}function BKe(e,t){var r=ya(),n=rEe(),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;p9(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 RKe(){var e=ya(),t=rEe(),r=xY(),n=SY(),i=p9(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 qKe(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 LKe(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 zKe(e,t,r){var n,i,a,o=ya(),s=kY(),l=_Ke(e,t),u=BKe(e,l),c=RKe(),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=qKe(o,l).join(" "),p=LKe(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:uKe,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 UKe(e){var t=(0,Ln.useRef)(null),r=zKe(e.date,e.displayMonth,t);return r.isHidden?dt.jsx("div",{role:"gridcell"}):r.isButton?dt.jsx(d9,Tr({name:"day",ref:t},r.buttonProps)):dt.jsx("div",Tr({},r.divProps))}function WKe(e){var t=e.number,r=e.dates,n=ya(),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(d9,{name:"week-number","aria-label":f,className:o.weeknumber,style:a.weeknumber,onClick:d,children:c})}function HKe(e){var t,r,n=ya(),i=n.styles,a=n.classNames,o=n.showWeekNumber,s=n.components,l=(t=s?.Day)!==null&&t!==void 0?t:UKe,u=(r=s?.WeekNumber)!==null&&r!==void 0?r:WKe,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})},xM(f))})]})}function W2e(e,t,r){for(var n=r?.ISOWeek?KE(t):gA(t,r),i=r?.ISOWeek?tf(e):mo(e,r),a=od(n,i),o=[],s=0;s<=a;s++)o.push(la(i,s));var l=o.reduce(function(u,c){var f=r?.ISOWeek?bM(c):wM(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 VKe(e,t){var r=W2e(Wo(e),t0(e),t);if(t?.useFixedWeeks){var n=SM(e,t);if(n<6){var i=r[r.length-1],a=i.dates[i.dates.length-1],o=Jg(a,6-n),s=W2e(Jg(a,1),o,t);r.push.apply(r,s)}}return r}function GKe(e){var t,r,n,i=ya(),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=VKe(e.displayMonth,{useFixedWeeks:Boolean(u),ISOWeek:p,locale:a,weekStartsOn:f,firstWeekContainsDate:d}),m=(t=c?.Head)!==null&&t!==void 0?t:lKe,g=(r=c?.Row)!==null&&r!==void 0?r:HKe,A=(n=c?.Footer)!==null&&n!==void 0?n:aKe;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 QKe(){return!!(typeof window<"u"&&window.document&&window.document.createElement)}var YKe=QKe()?Ln.useLayoutEffect:Ln.useEffect,yY=!1,ZKe=0;function H2e(){return"react-day-picker-".concat(++ZKe)}function XKe(e){var t,r=e??(yY?H2e():null),n=(0,Ln.useState)(r),i=n[0],a=n[1];return YKe(function(){i===null&&a(H2e())},[]),(0,Ln.useEffect)(function(){yY===!1&&(yY=!0)},[]),(t=e??i)!==null&&t!==void 0?t:void 0}function KKe(e){var t,r,n=ya(),i=n.dir,a=n.classNames,o=n.styles,s=n.components,l=tb().displayMonths,u=XKe(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:iKe;return dt.jsxs("div",{className:f.join(" "),style:d,children:[dt.jsx(g,{id:u,displayMonth:e.displayMonth,displayIndex:e.displayIndex}),dt.jsx(GKe,{id:c,"aria-labelledby":u,displayMonth:e.displayMonth})]},e.displayIndex)}function JKe(e){var t=ya(),r=t.classNames,n=t.styles;return dt.jsx("div",{className:r.months,style:n.months,children:e.children})}function eJe(e){var t,r,n=e.initialProps,i=ya(),a=kY(),o=tb(),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:JKe;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(KKe,{displayIndex:m,displayMonth:h},m)})})}))}function tJe(e){var t=e.children,r=EXe(e,["children"]);return dt.jsx(WXe,{initialProps:r,children:dt.jsx(eKe,{children:dt.jsx(PKe,{initialProps:r,children:dt.jsx(cKe,{initialProps:r,children:dt.jsx(pKe,{initialProps:r,children:dt.jsx(xKe,{children:dt.jsx(FKe,{children:t})})})})})})})}function nEe(e){return dt.jsx(tJe,Tr({},e,{children:dt.jsx(eJe,{initialProps:e})}))}var Ov=(e,t,r,n,i,a,o,s)=>e.openCustomMenu(t,Pi.default.createElement(nJe,{ui:e,value:n,setValue:i,time:a}),{width:"280px",height:"280px"},r,s),rJe=e=>{let{goToMonth:t,nextMonth:r,previousMonth:n}=tb(),[i,a]=(0,Pi.useState)(!1);return Pi.default.createElement("div",{className:"mk-date-picker-header"},Pi.default.createElement("button",{disabled:!n,onClick:()=>n&&t(n),dangerouslySetInnerHTML:{__html:e.ui.getSticker("ui//chevron-left")}}),i?Pi.default.createElement("div",{className:"mk-date-picker-header-input"},Pi.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)}}),Pi.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)}})):Pi.default.createElement("div",{onClick:()=>a(!0)},_r(e.ui.superstate,e.displayMonth,"MMM yyy")),Pi.default.createElement("button",{disabled:!r,onClick:()=>r&&t(r),dangerouslySetInnerHTML:{__html:e.ui.getSticker("ui//chevron-right")}}))},nJe=e=>{let[t,r]=(0,Pi.useState)(0),[n,i]=(0,Pi.useState)(0),[a,o]=(0,Pi.useState)(0),[s,l]=(0,Pi.useState)(e.value),[u,c]=(0,Pi.useState)(e.time==2),[f,d]=(0,Pi.useState)(!1),p=()=>{let m=e.value?e.value:e.time==0?Vn(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,Pi.useEffect)(()=>{p()},[e.value,e.time]),(0,Pi.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 Pi.default.createElement("div",{className:"mk-date-picker-container"},Pi.default.createElement(nEe,{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=>rJe({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?Pi.default.createElement("div",{className:"mk-date-picker-time"},Pi.default.createElement("div",{dangerouslySetInnerHTML:{__html:e.ui.getSticker("ui//clock")}}),Pi.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})}}),":",Pi.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})}}),Pi.default.createElement("button",{className:"mk-date-picker-meridiem",onClick:()=>{h({h:(t+12)%24})}},t<12?"AM":"PM"),Pi.default.createElement("button",{onClick:()=>h({h:0,m:0,s:0}),dangerouslySetInnerHTML:{__html:e.ui.getSticker("ui//close")}})):e.time==1?Pi.default.createElement("button",{onClick:()=>c(!0)},"Add Time"):null)};var iEe=Ae(Qa()),ws=Ae(Te());var aEe=e=>{let[t,r]=(0,ws.useState)(e.initialValue);(0,ws.useEffect)(()=>{r(e.initialValue)},[e.initialValue]);let n=(0,ws.useMemo)(()=>{let f=Zi(t);return Hee(f)?f:null},[t]),i=(f,d)=>{let p=_r(e.superstate,f,d?qs:"yyyy-MM-dd");e.saveValue(p),r(p),e.setEditMode(null)},a=(0,ws.useRef)(null),o=(0,ws.useRef)(null);(0,ws.useEffect)(()=>{e.editMode==4&&o.current&&(s(),o.current.focus())},[e.editMode]);let s=(0,ws.useCallback)(f=>{if(e.editMode<=1)return;let d=f?f.target.getBoundingClientRect():o.current.getBoundingClientRect();a.current=Ov(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,ws.useMemo)(()=>ir(e.propertyValue)?.format,[e.propertyValue]),c=!(t?.length>0);return ws.default.createElement("div",{className:"mk-cell-date",onClick:f=>!t&&s(f)},ws.default.createElement("div",{className:(0,iEe.default)("mk-cell-date-item",c&&"mk-cell-date-new")},ws.default.createElement("div",{className:"mk-icon-xsmall",dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//calendar")}}),c&&"Select",e.editMode==4?ws.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}):ws.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 m9=e=>{let t=(0,tm.useMemo)(()=>e.multi?tr(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(Fa,{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":W.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)},W.labels.selectIcon)))};var jl=Ae(Te());var Mv=/https?:\/\/(www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_\+.~#?&//=]*)/gi;var iJe=e=>{let[t,r]=(0,jl.useState)(""),[n,i]=(0,jl.useState)([]),[a,o]=(0,jl.useState)([]),[s,l]=(0,jl.useState)(null);(0,jl.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,jl.useEffect)(()=>{t.match(Mv)?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]),jl.default.createElement(jl.default.Fragment,null,jl.default.createElement("input",{onKeyDown:c,value:t,ref:f,onChange:u,className:"mk-input mk-input-large mk-border-bottom"}),jl.default.createElement("div",{className:"mk-layout-masonry mk-padding-12 mk-layout-scroll"},a.map(d=>jl.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=iJe;var Zo=Ae(Te());var h9=e=>{let{initialValue:t,multi:r}=e,[n,i]=Zo.default.useState(tr(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(tr(t))},[t]);let s=c=>{if(r){let f=[...n];f.splice(c,1),i(f),e.saveValue(yi(f))}else e.saveValue("")},l=(c,f)=>{e.multi?c==-1?e.saveValue(yi([...n,f])):e.saveValue(yi(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 rb=Ae(Te());var uD=e=>{let t=u=>e.multi?tr(u)??[]:[u].filter(c=>c).map(c=>e.superstate.spaceManager.resolvePath(c,e.source));(0,rb.useEffect)(()=>{n(t(e.initialValue))},[e.initialValue]);let[r,n]=(0,rb.useState)(t(e.initialValue)),i=u=>{let c=r.filter(f=>f!=u);n(c),a(c)},a=u=>{e.multi?e.saveValue(yi(u)):e.saveValue(ss(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:W.menu.none,value:""},...u];return{ui:e.superstate.ui,multi:!1,editable:!0,value:r.map(f=>f),options:c,saveOptions:o,placeholder:W.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 rb.default.createElement(ag,{superstate:e.superstate,baseClass:"mk-cell-link",removeValue:i,selectLabel:e.compactMode?e.property.name:W.labels.select,menuProps:s,labelElement:u=>rb.default.createElement(oo,{superstate:e.superstate,path:u.value},u.children),value:r,multi:e.multi,editMode:e.editMode})};var oEe=e=>{let t=Rs(e.initialValue),r=(0,rm.useMemo)(()=>mr(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(l9,{...e,initialValue:t,editMode:0}):t?.length==0?rm.default.createElement(rm.default.Fragment,null):r.type=="image"?rm.default.createElement(h9,{...e,initialValue:t,editMode:0,multi:!0}):r.type=="icon"?rm.default.createElement(m9,{...e,initialValue:t,multi:!0,editMode:0}):r.type=="link"?rm.default.createElement(uD,{...e,initialValue:t,multi:!0,editMode:0}):rm.default.createElement(c9,{...e,initialValue:t,editMode:0,multi:!0,source:e.source})};var sg=Ae(Te());var sEe=e=>{let{initialValue:t,saveValue:r}=e,[n,i]=sg.default.useState(t),a=(0,sg.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 sg.default.useEffect(()=>{i(t)},[t]),(0,sg.useEffect)(()=>{e.editMode==4&&a?.current?.focus()},[e.editMode]),e.editMode>2?sg.default.createElement("input",{className:"mk-cell-text",type:"number",ref:a,value:n??"",onChange:l=>i(l.target.value),onKeyDown:s,onBlur:o}):sg.default.createElement("div",{className:"mk-cell-number"},n)};var fn=Ae(Te()),lEe=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:W.menu.rename,icon:"ui//edit",value:"edit",onClick:()=>{e.superstate.ui.openModal(W.labels.rename,fn.default.createElement(_i,{value:c,saveLabel:W.labels.rename,saveValue:p=>{a(c,p)}}),Ne(u.view.document))}}),d.push({name:W.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,Zt(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=mr(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(xs,{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=mr(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:W.menu.insertAbove,value:"insert-above",onClick:k=>{l(x)}}),S.push({name:W.menu.insertBelow,value:"insert-below",onClick:k=>{l(x+1)}}),S.push(qt),x>0&&S.push({name:W.menu.moveUp,value:"move-up",onClick:k=>{e.saveValue(JSON.stringify(Hs(a,x,x-1)))}}),x{e.saveValue(JSON.stringify(Hs(a,x,x+1)))}}),S.push(qt),S.push({name:W.buttons.delete,icon:"ui//trash",value:"delete",onClick:()=>{c(x)}}),e.superstate.ui.openMenu(w,Zt(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)};Da({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(Hs(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(aJe,{...e}),e,Ne(v.view.document))}},fn.default.createElement("div",{className:"mk-icon-xsmall",dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//edit")}}),`${W.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,lEe.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})},aJe=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=mr(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=mr(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=mr(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"},W.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")}}),W.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 A9=e=>{let[t,r]=(0,cD.useState)(Dk(e.initialValue)),n=(a,o)=>{r(Dk(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:W.labels.linkItemSelectPlaceholder,detail:!0,searchable:!0}};return cD.default.createElement(ag,{superstate:e.superstate,removeValue:null,baseClass:"mk-cell-link",selectLabel:e.compactMode?e.property.name:W.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 uEe=e=>{let t=(0,Ic.useMemo)(()=>mr(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"?mr(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?tr(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)=>tr(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?"":V5(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 el=Ae(Te());var jY=e=>{let t=async()=>{e.superstate.ui.openPath(e.initialValue,!1)},r=(0,el.useRef)(null),[n,i]=(0,el.useState)(null);(0,el.useEffect)(()=>{LN(e.superstate,e.initialValue).then(c=>i(c))},[e.initialValue]);let a=(0,el.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:W.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:W.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 el.default.createElement("div",{ref:a,className:"mk-cell-space"},el.default.createElement("div",{className:"mk-cell-option-item"},el.default.createElement("div",{onClick:()=>t()},n?.space),e.editMode>2&&el.default.createElement(el.default.Fragment,null,el.default.createElement("span",null),el.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&&el.default.createElement("div",{className:"mk-cell-option-item"},el.default.createElement("div",{onClick:()=>t()},n?.schemaName),n?.space&&el.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(xs,{key:o,superstate:e.superstate,initialValue:a.type.startsWith("object")?t?.[a.name]:Sa(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 cEe=e=>{let t=(0,Hd.useMemo)(()=>{let l=mr(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(Z$(e.initialValue)));(0,Hd.useEffect)(()=>{i(r(Z$(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=OJ(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 xh=Ae(Te());var fEe=e=>{let[t,r]=(0,xh.useState)([]),[n,i]=(0,xh.useState)([]);(0,xh.useEffect)(()=>{e.path?(r(e.superstate.pathsIndex.get(e.path)?.metadata?.tags??[]),i([...e.superstate.tagsMap.get(e.path)??[]])):(r(tr(e.initialValue)),i(tr(e.initialValue)))},[]),(0,xh.useEffect)(()=>{e.path||(r(tr(e.initialValue)),i(tr(e.initialValue)))},[e.initialValue]),(0,xh.useEffect)(()=>{if(e.path){let u=c=>{c.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",u),()=>{e.superstate.eventsDispatcher.removeListener("pathStateUpdated",u)}}},[e.path]);let a=u=>{e.path?QB(e.superstate,e.path,u):(r(t.filter(c=>c!=u)),i(n.filter(c=>c!=u)))},o=u=>{e.saveValue(yi(u))},s=(u,c)=>{let f=c[0];e.path?th(e.superstate,e.path,f):(r([...t,f]),i([...n,f]),o([...n,f]))},l=()=>{let u=e.superstate.spaceManager.readTags().map(c=>({name:c,value:c}));return{ui:e.superstate.ui,multi:!1,editable:!0,value:n,options:u,saveOptions:s,placeholder:W.labels.tagItemSelectPlaceholder,searchable:!0,showAll:!0,onHide:()=>e.setEditMode(null)}};return xh.default.createElement(ag,{superstate:e.superstate,baseClass:"mk-cell-tags",removeValue:a,menuProps:l,selectLabel:e.compactMode?e.property.name:W.labels.select,value:n,multi:!0,editMode:e.editMode,labelElement:u=>xh.default.createElement("div",{className:"mk-cell-tags-label"},u.value,t.some(c=>c.toLowerCase()==u.value)&&u.children)})};var nb=Ae(Te());var dEe=e=>{let{initialValue:t,saveValue:r}=e,n=(0,nb.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,nb.useEffect)(()=>{if(e.editMode==4&&n?.current){let o=window.getSelection();o.selectAllChildren(n.current),o.collapseToEnd()}},[e.editMode]),e.editMode>2?nb.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}}):nb.default.createElement("div",{className:"mk-cell-text"},t)};var x2=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(m9,{...o,multi:s.multiType==r.type}):s.type=="boolean"?xo.default.createElement(l9,{...o}):s.type=="option"?xo.default.createElement(c9,{...o,multi:s.multiType==r.type,saveOptions:a,source:e.source}):s.type=="date"?xo.default.createElement(aEe,{...o}):s.type=="context"?xo.default.createElement(q2e,{...o,multi:s.multiType==r.type,source:e.source,contextTable:e.contextTable,contextPath:e.contextPath}):s.type=="aggregate"?xo.default.createElement(uEe,{...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(oEe,{...o,row:e.row,columns:e.columns,saveOptions:a,source:e.source}):s.type=="number"?xo.default.createElement(sEe,{...o}):s.type=="link"?xo.default.createElement(uD,{...o,multi:s.multiType==r.type,source:e.source}):s.type=="tags-multi"?xo.default.createElement(fEe,{...o}):s.type=="image"?xo.default.createElement(h9,{...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($2e,{...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(cEe,{...o,row:n,columns:e.columns,compactMode:e.compactMode,source:e.source}):s.type=="input"?xo.default.createElement(A9,{...o,columns:e.columns}):xo.default.createElement(dEe,{...o}):xo.default.createElement(xo.default.Fragment,null)};var AEe=e=>{let{spaceInfo:t,spaceState:r}=(0,Ht.useContext)(ur),{readMode:n}=(0,Ht.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,Ht.useContext)(Ta),g=e.superstate.settings.contextPagination??25,[A,b]=Ht.default.useState({pageIndex:0,pageSize:g}),[v,x]=(0,Ht.useState)(null),[w,S]=(0,Ht.useState)(null),[k,j]=(0,Ht.useState)(null),[O,C]=(0,Ht.useState)(null),[N,D]=(0,Ht.useState)(null),[P,q]=(0,Ht.useState)({}),z=(0,Ht.useRef)(null),I=c.find(R=>R.primary=="true");(0,Ht.useEffect)(()=>{q({...d?.colsSize??{},"+":30})},[d]),(0,Ht.useEffect)(()=>{C(null)},[k,w]);let T=R=>{let J=R(P);q(J),L(J)},L=(0,Ht.useCallback)((0,hEe.debounce)(R=>p({colsSize:R}),1e3),[d]),_=(R,J,ee)=>{a?.id==pr?Ji(e.superstate,r,"md",R,!0):s(vk(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,...R2e(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,Ht.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:R.schemaId==pr&&f[ee][mt],columns:c,contextPath:r.path};return fc(R.type,R.name)?Ht.default.createElement(x2,{...Ct}):Ht.default.createElement(Ht.default.Fragment,null,Ce)}}))??[],...n?[]:[{header:"+",meta:{schemaId:a?.id},accessorKey:"+",size:20,cell:()=>Ht.default.createElement(Ht.default.Fragment,null)}]],[c,f,O,d,a,o]),Q=(0,Ht.useMemo)(()=>d?.groupBy?.length>0&&c.find(R=>R.name+R.table==d.groupBy[0])?d.groupBy:[],[d,c]),fe=S2e({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:v2e(),getExpandedRowModel:y2e(),getGroupedRowModel:x2e(),getPaginationRowModel:w2e(),onPaginationChange:b,meta:{updateData:m,updateFieldValue:h}}),Ie=qw(Pp(RA,{activationConstraint:{distance:10}}),Pp($A,{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,Ht.useMemo)(()=>{let R={};return Object.keys(d.colsCalc).forEach(J=>{R[J]=V5(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:Hs(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 Ht.default.createElement(Lw,{sensors:Ie,collisionDetection:PN,measuring:Se,onDragStart:Oe,onDragOver:ve,onDragEnd:ae,onDragCancel:ce},Ht.default.createElement("div",{className:"mk-table",ref:z,tabIndex:1,onKeyDown:oe,onMouseDown:R=>R.stopPropagation()},Ht.default.createElement("table",{...{}},Ht.default.createElement("thead",null,fe.getHeaderGroups().map(R=>Ht.default.createElement("tr",{key:R.id},Ht.default.createElement("th",null),R.headers.map(J=>Ht.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()?Ht.default.createElement(Ht.default.Fragment,null):Ht.default.createElement(e9,{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)}):Ht.default.createElement(e9,{superstate:e.superstate,isNew:!0,editable:!0,column:{name:"",schemaId:J.column.columnDef.meta.schemaId,type:"text",table:""}}),Ht.default.createElement("div",{...{onMouseDown:J.getResizeHandler(),onTouchStart:J.getResizeHandler(),className:`mk-resizer ${J.column.getIsResizing()?"isResizing":""}`}})))))),Ht.default.createElement("tbody",null,fe.getRowModel().rows.map(R=>Ht.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);s9(J,e.superstate,r.path,a.id,ee)},key:R.id},Ht.default.createElement("td",null),R.getVisibleCells().map((J,ee)=>J.getIsGrouped()?Ht.default.createElement("td",{key:ee,className:"mk-td-group",colSpan:c.length+(n?0:1)},Ht.default.createElement("div",{...{onClick:R.getToggleExpandedHandler(),style:{display:"flex",alignItems:"center",cursor:"normal"}}},K5(J.column.columnDef.cell,J.getContext())," ","(",R.subRows.length,")")):J.getIsAggregated()?Ht.default.createElement(Ht.default.Fragment,{key:ee},K5(J.column.columnDef.aggregatedCell??J.column.columnDef.cell,J.getContext())):Ht.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:K5(J.column.columnDef.cell,J.getContext())))))),Ht.default.createElement("tfoot",null,fe.getCanNextPage()&&Ht.default.createElement("tr",null,Ht.default.createElement("th",{className:"mk-row-new",colSpan:c.length+(n?1:2),onClick:()=>fe.setPageSize(A.pageSize+g)},W.buttons.loadMore)),n?Ht.default.createElement(Ht.default.Fragment,null):Ht.default.createElement("tr",null,Ht.default.createElement("th",{className:"mk-row-new",colSpan:c.length+(n?1:2),"data-placeholder":W.hintText.newItem,onFocus:R=>{j(null),S(null)},onKeyPress:R=>{R.key=="Enter"&&(_(R.currentTarget.innerText),R.currentTarget.innerText="",R.currentTarget.blur())},contentEditable:!0})),Ht.default.createElement("tr",null,Ht.default.createElement("td",null),Q.map((R,J)=>Ht.default.createElement("td",{key:J})),(Q.length>0?c.filter(R=>!Q.includes(R.name)):c).map((R,J)=>Ht.default.createElement("td",{key:J,className:(0,mEe.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,Zt(e.superstate.ui,ie),Ne(ee.view.document))}},d.colsCalc[R.name]?.length>0?Ht.default.createElement("div",null,Ht.default.createElement("span",null,_c[d.colsCalc[R.name]].shortLabel??_c[d.colsCalc[R.name]].label),ke[R.name]):Ht.default.createElement("div",null,Ht.default.createElement("span",null,"Calculate")))),Ht.default.createElement("td",null)))),(0,pEe.createPortal)(Ht.default.createElement(Um,{dropAnimation:null,zIndex:1600},v?Ht.default.createElement(e9,{superstate:e.superstate,editable:!1,column:{name:v,schemaId:i.schema.id,type:"text",table:""}}):null),document.body)))};var xs=e=>{let t=(0,wo.useMemo)(()=>Rx(e.column),[e.column]),r=mr(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=mr(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=mr(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(x2,{...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")}}),W.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(x2,{...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(x2,{...e})))};var gEe=e=>{let{pathState:t}=(0,Ss.useContext)($r),[r,n]=(0,Ss.useState)({}),[i,a]=(0,Ss.useState)([]),[o,s]=(0,Ss.useState)([]),{tableData:l,saveProperty:u,delProperty:c,saveFrame:f}=(0,Ss.useContext)(Aa),d=async()=>{let D=e.superstate.spacesMap.get(t.path)??new Set,P=(await Promise.all([...D].map(async _=>e.superstate.spaceManager.readTable(_,pr).then(Y=>Y.cols??[])))).reduce((_,Y)=>[..._,...Y],[]),q=[],z={},I=t?.metadata?.property??{},T=pM([...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:bA(I[_],_)});I&&(q.push(...L),T.forEach(_=>{z[_]=$i(_,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,Ss.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]:ca(P.type,D,!0)})},m=D=>{c&&D&&c(D),Rye(e.superstate,t.path,D.name)},g=async(D,P)=>{let q={...D,schemaId:pr},z=e.superstate.spacesIndex.get(P)?.space;!z||(await e.superstate.spaceManager.addSpaceProperty(P,q),await UN(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:W.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)}$V(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,Ss.useState)(null),[k,j]=(0,Ss.useState)(null),O=()=>{j(null),S(null)};Da({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&&$V(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}iwe(e.superstate,q,Ne(D.view.document),P,m,()=>A(D,P),b,x)};return Ss.default.createElement(Ss.default.Fragment,null,e.compactMode?i.map((D,P)=>Ss.default.createElement(xs,{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)=>Ss.default.createElement(xs,{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})):Ss.default.createElement(Ss.default.Fragment,null),o.length>0&&Ss.default.createElement("style",null,`${o.map(D=>`.metadata-property[data-property-key="${D}"]`).join(", ")} { display: none; - }`))};var hu=Ae(Te());var jv={isEmpty:W.filterTypes.isEmpty,isNotEmpty:W.filterTypes.isNotEmpty,include:W.filterTypes.contains,notInclude:W.filterTypes.notContains,is:W.filterTypes.is,isNot:W.filterTypes.isNot,isLink:W.filterTypes.is,isNotLink:W.filterTypes.isNot,equal:"=",isGreatThan:">",isLessThan:"<",isLessThanOrEqual:"\u2264",isGreatThanOrEqual:"\u2265",dateBefore:W.filterTypes.before,dateAfter:W.filterTypes.after,isSameDate:W.filterTypes.isSameDate,isSameDateAsToday:W.filterTypes.isSameDateAsToday,isExactList:W.filterTypes.is,isAnyInList:W.filterTypes.anyOf,isNoneInList:W.filterTypes.noneOf,isTrue:W.filterTypes.checked,isFalse:W.filterTypes.unchecked};var Ci=Ae(Te());var SEe=Ae(Qa());var g9=(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,{...Zt(r.ui,[o])},t)}else if(n.type=="date")Ov(r.ui,e,t,new Date,o=>i(o.toISOString()),0);else if(n.type=="option"){let o=mr(n.value,n.type,r,a)?.options??[];r.ui.openMenu(e,{...Zt(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,{...Zt(r.ui,o),saveOptions:(s,l)=>{i(l[0])}},t)}}};var Kt=Ae(Te());var Nv=Ae(Te());var iJe=(e,t)=>e.type=="folder"?`${e.path}/#*${t}`:e.type=="vault"?`/#*${t}`:`${e.path}/#*${t}`,jY=(e,t)=>e.type=="folder"?`${e.path}/#;${t}`:e.type=="vault"?`/#;${t}`:`${e.path}/#;${t}`,ib=(e,t)=>e.type=="folder"?`${e.path}/#^${t}`:e.type=="vault"?`/#^${t}`:`${e.path}/#^${t}`,dD=(e,t)=>`![![${iJe(e,t)}]]`,v9=(e,t)=>`![![${ib(e,t)}]]`;var vEe=e=>{let{dbSchema:t,source:r}=(0,Nv.useContext)(Ta),n=u=>{e.superstate.ui.openPalette(Nv.default.createElement(Fa,{ui:e.superstate.ui,selectedSticker:c=>e.superstate.spaceManager.saveTableSchema(r,t.id,()=>({...t,def:JSON.stringify({...ir(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 Nv.default.createElement("div",{className:"mk-context-title"},Nv.default.createElement("div",{className:"mk-path-icon",onClick:u=>n(u),dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker(HJ(t))}}),Nv.default.createElement("div",{contentEditable:!0,dangerouslySetInnerHTML:{__html:t?.name},onBlur:a,onKeyPress:o,onKeyUp:s,onKeyDown:l}),Nv.default.createElement("button",{className:"mk-toolbar-button",onClick:()=>e.superstate.ui.openPath(ib(e.superstate.spacesIndex.get(r),t.id)),dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//expand")}}))};var yEe=Ae(Te()),bEe=e=>yEe.default.createElement("div",{onClick:t=>e.onSelect(t),onContextMenu:t=>e.onContextMenu(t,e.schema),className:`mk-context ${e.active?"mk-active":""}`},mM(e.schema.name,"Untitled"),e.children);var xEe=Ae(Te()),Vd=e=>xEe.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 tl=Ae(Te());var wEe=e=>{let{views:t,dbSchema:r,source:n}=(0,tl.useContext)(Ta),{readMode:i}=(0,tl.useContext)($r),{spaceState:a}=(0,tl.useContext)(ur),{frameSchema:o,setFrameSchema:s,saveSchema:l,deleteSchema:u}=(0,tl.useContext)(Aa),c=(m,g)=>{let A=[];A.push({name:W.menu.copyEmbedLink,icon:"ui//link",onClick:b=>{navigator.clipboard.writeText(dD(a,g.id))}}),A.push({name:W.buttons.renameView,icon:"ui//edit",onClick:b=>{e.superstate.ui.openModal(W.labels.renameView,tl.default.createElement(_i,{value:g.name,saveLabel:W.labels.renameView,saveValue:v=>l({...g,name:v})}),Ne(b.view.document))}}),t.length>1&&A.push({name:W.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(),Zt(e.superstate.ui,A),Ne(m.view.document))},f=m=>{s(t.find(g=>g.id==m)),e.setView&&e.setView(m)},d=(0,tl.useRef)(null),p=m=>{e.superstate.ui.openModal(W.labels.saveView,tl.default.createElement(_i,{value:"",saveLabel:W.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:mM(A.name,"Untitled"),value:A.id,icon:Ix(A),onClick:()=>f(A.id),onMoreOptions:i?null:b=>c(b,A)})}),i||(g.push(qt),g.push({name:W.menu.newView,icon:"ui//plus",value:"",onClick:A=>p(A)})),e.superstate.ui.openMenu(m.target.getBoundingClientRect(),Zt(e.superstate.ui,g),Ne(m.view.document),"bottom")};return r&&(o?tl.default.createElement(tl.default.Fragment,null,tl.default.createElement("div",{className:"mk-view-selector",ref:d},t.map((m,g)=>tl.default.createElement(bEe,{key:g,active:o.id==m.id,superstate:e.superstate,schema:m,onSelect:()=>s(t.find(A=>A.id==m.id)),onContextMenu:c})),tl.default.createElement("button",{className:"mk-toolbar-button",onClick:m=>p(m),dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//plus")}}))):tl.default.createElement("div",{onClick:m=>h(m),className:"mk-context"},tl.default.createElement("div",{className:"mk-path-icon",dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//table")}}),r.name,tl.default.createElement(Vd,{collapsed:!1,onToggle:null,superstate:e.superstate})))};var nm=Ae(Te());var y9=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:W.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 b9=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)(Ta),{frameSchema:p,saveSchema:h,setFrameSchema:m}=(0,Kt.useContext)(Aa),[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:W.menu.tableView,icon:"ui//table",view:"table",listView:"",listGroup:"",listItem:""},list:{name:W.menu.listView,icon:"ui//list",view:"list",listView:"spaces://$kit/#*listView",listGroup:"spaces://$kit/#*listGroup",listItem:"spaces://$kit/#*rowItem"},details:{name:W.menu.detailsView,icon:"ui//layout-grid",view:"list",listView:"spaces://$kit/#*listView",listGroup:"spaces://$kit/#*listGroup",listItem:"spaces://$kit/#*detailItem"},board:{name:W.menu.boardView,icon:"ui//square-kanban",view:"list",listView:"spaces://$kit/#*columnView",listGroup:"spaces://$kit/#*columnGroup",listItem:"spaces://$kit/#*cardListItem"},cards:{name:W.menu.cardView,icon:"ui//layout-dashboard",view:"list",listView:"spaces://$kit/#*listView",listGroup:"spaces://$kit/#*gridGroup",listItem:"spaces://$kit/#*cardsListItem"},catalog:{name:W.menu.catalogView,icon:"ui//gallery-horizontal-end",view:"list",listView:"spaces://$kit/#*listView",listGroup:"spaces://$kit/#*rowGroup",listItem:"spaces://$kit/#*coverListItem"},gallery:{name:W.menu.galleryView,icon:"ui//layout-dashboard",view:"list",listView:"spaces://$kit/#*listView",listGroup:"spaces://$kit/#*masonryGroup",listItem:"spaces://$kit/#*imageListItem"},flow:{name:W.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:W.menu.customView,icon:"ui//brush",onClick:ke=>{s(3)}}),e.superstate.ui.openMenu(ye,Zt(e.superstate.ui,me),Ne(ve.view.document))},P=(ve,ye)=>ao(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(qt),ye.push({name:W.menu.properties,icon:"ui//list",type:6,onSubmenu:(U,R)=>Ie(U,Ne(ve.view.document),R)})),ye.push({name:W.menu.groupBy,icon:"ui//columns",type:6,onSubmenu:(U,R)=>Se(U,Ne(ve.view.document),R)}),ye.push({name:W.menu.sortBy,icon:"ui//sort-desc",type:6,onSubmenu:(U,R)=>te(U,Ne(ve.view.document),R)}),ye.push({name:W.menu.filters,icon:"ui//filter",type:6,onSubmenu:(U,R)=>oe(U,Ne(ve.view.document),R)}),ye.push(qt),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(qt)}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:Ri(U),type:1,onClick:R=>{g9(R.target.getBoundingClientRect(),Ne(R.view.document),e.superstate,U,J=>ae("listViewProps",U.name,ca(U.type,J,!0)),t.path)}})}),ke.forEach(U=>{ye.push({name:Vo(U,e.superstate),icon:Ri(U),type:1,onClick:R=>{g9(R.target.getBoundingClientRect(),Ne(R.view.document),e.superstate,U,J=>ae("listGroupProps",U.name,ca(U.type,J,!0)),t.path)}})}),$.forEach(U=>{ye.push({name:Vo(U,e.superstate),icon:Ri(U),type:1,onClick:R=>{g9(R.target.getBoundingClientRect(),Ne(R.view.document),e.superstate,U,J=>ae("listItemProps",U.name,ca(U.type,J,!0)),t.path)}})});let ce=ve.target.getBoundingClientRect();e.superstate.ui.openMenu(ce,Zt(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=HQ($,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=HQ(me,Li);if(!ke)return;let $=me=="boolean"?{field:ve,fn:ke,fType:Li[ke].valueType,value:"true"}:{field:ve,fn:ke,fType:Li[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=p2(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:W.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:Li[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=p2(ce,Li);e.superstate.ui.openMenu(ke,{ui:e.superstate.ui,multi:!1,editable:!1,value:[],options:U.map(R=>({name:jv[R],value:R})),saveOptions:$,placeholder:W.labels.filterItemSelectPlaceholder,searchable:!1,showAll:!0},Ne(ve.view.document))},oe=(ve,ye,me)=>{let ke=x.filter($=>$.type=="fileprop"||p2($.type,Li).length>0).map($=>({name:$.name+$.table,value:$.name+$.table,icon:Ri($),onClick:ae=>{L($.name+$.table)}}));return ke.push(qt),ke.push({name:W.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:W.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:Ri(ke),value:ke.name+ke.table})),saveOptions:z,placeholder:W.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:W.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(qt),$.push(...x.filter(ae=>l.colsHidden.some(ce=>ce==ae.name+ae.table)==!1).map(ae=>({name:ae.name+ae.table,icon:Ri(ae),value:ae.name+ae.table,type:6,onSubmenu:(ce,U)=>ke(ae,ce,U)}))),$.push(qt),$.push(...x.filter(ae=>l.colsHidden.some(ce=>ce==ae.name+ae.table)).map(ae=>({name:ae.name+ae.table,icon:Ri(ae),value:ae.name+ae.table,type:6,onSubmenu:(ce,U)=>ke(ae,ce,U)}))),$.push(qt),$.push({name:W.menu.unhideFields,icon:"ui//eye",onClick:ae=>{O()}}),e.superstate.ui.openMenu(ve,{ui:e.superstate.ui,multi:!1,editable:!1,value:[],options:$,placeholder:W.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:Ri(ke),value:ke.name+ke.table})),saveOptions:I,placeholder:W.labels.propertyItemSelectPlaceholder,searchable:!1,showAll:!0},ye,"right",me),Oe=(ve,ye,me)=>{switch(ye.fType??Li[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);Ov(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=mr(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:tr(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:W.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();Gu(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:yi(ce)};u({filters:(l?.filters??[]).map((R,J)=>J==me?U:R)})};if(ke.type.startsWith("option")){let ae=ve.target.getBoundingClientRect(),ce=mr(ke.value,ke.type).options;e.superstate.ui.openMenu(ae,{ui:e.superstate.ui,multi:!0,editable:!1,value:tr(ye.value),options:ce??[],saveOptions:$,placeholder:W.labels.optionItemSelectPlaceholder,searchable:!0,showAll:!0},Ne(ve.view.document))}else if(ke.type.startsWith("context")){let ae=mr(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:tr(ye.value),options:ce.map(R=>({name:R.name,value:R.path}))??[],saveOptions:$,placeholder:W.labels.optionItemSelectPlaceholder,searchable:!0,showAll:!0},Ne(ve.view.document))}else if(ke.type.startsWith("link")){let ae=ve.target.getBoundingClientRect();Gu(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:tr(ye.value),options:ae.map(U=>({name:U,value:U}))??[],saveOptions:$,placeholder:W.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(y9,{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(vEe,{superstate:e.superstate}),Kt.default.createElement("span",null),i?.id==pr&&!t.space.readOnly&&Kt.default.createElement(Kt.default.Fragment,null,Kt.default.createElement("button",{className:"mk-button-new",onClick:ve=>a9(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(wEe,{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,SEe.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(y9,{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(y9,{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,W.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)},jv[ve.fn]),Kt.default.createElement(NY,{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:W.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")}}),W.buttons.addFilter)),Kt.default.createElement("span",null)))},NY=e=>{let{filter:t,selectFilterValue:r,fieldType:n}=e,i=Li[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=tr(t.value);return Kt.default.createElement("span",{onClick:l=>r(l,t)},s.length==0?W.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)},W.labels.select);return Kt.default.createElement("span",{onClick:s=>r(s,t)},t.value)};var w2=e=>{(0,Ci.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(Li[m.fn]?.valueType){case"text":case"number":b(m.value);break;case"date":{let v=S=>{b(Ya(S,"yyyy-MM-dd"))},x=h.target.getBoundingClientRect(),w=new Date(m.value);Ov(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();Gu(x,Ne(h.view.document),e.superstate,v),h.stopPropagation();break}case"space":{let v=w=>{b(w)},x=h.target.getBoundingClientRect();ao(x,Ne(h.view.document),e.superstate,v);break}case"list":{let v=m.fType,x=(k,j)=>{b(yi(j))},w=[];v.startsWith("option")?w=tr(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:tr(m.value),options:w,saveOptions:x,placeholder:W.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"?JSe(Li):p2(x,Li);e.superstate.ui.openMenu(A,{ui:e.superstate.ui,multi:!1,editable:!0,value:[],options:w.map(S=>({name:jv[S],value:S})),saveOptions:(S,k)=>s(k[0],m,g),placeholder:W.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:W.labels.contextItemSelectPlaceholder,searchable:!0,showAll:!0,sections:e.sections,showSections:!0},Ne(h.view.document))};return Ci.default.createElement("div",{className:"mk-query"},t.length==0?Ci.default.createElement(EEe,{superstate:e.superstate,selectGroupType:f,group:null,addDefGroup:i,selectField:p,i:0,removeable:e.removeable,removeDefGroup:a}):t.map((h,m)=>Ci.default.createElement(EEe,{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)=>Ci.default.createElement(Ci.default.Fragment,{key:A},Ci.default.createElement(aJe,{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&&Ci.default.createElement("div",{className:"mk-filter",onClick:v=>f(v,m)},Ci.default.createElement("span",null,h.type=="any"?"or":"and")))))))},aJe=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 Ci.default.createElement("div",{className:"mk-filter"},Ci.default.createElement("span",{onClick:u=>r(u,o,s)},t.field.length==0?W.labels.select:l),t.field.length>0&&Ci.default.createElement("span",{onClick:u=>n(u,o,s)},jv[t.fn]?jv[t.fn]:W.labels.select),t.field.length>0&&jv[t.fn]&&Li[t.fn]?.valueType!="none"&&Ci.default.createElement(Ci.default.Fragment,null,Ci.default.createElement("span",null,Ci.default.createElement(NY,{superstate:e.superstate,fieldType:t.fType,filter:t,selectFilterValue:(u,c)=>i(u,c,o,s)})),e.linkProps&&e.linkProps.length>0&&Ci.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:W.labels.contextItemSelectPlaceholder,searchable:!0,showAll:!0,sections:[],showSections:!1},Ne(u.view.document))}},Ci.default.createElement("div",{className:"mk-icon-xsmall",dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//plug")}}))),Ci.default.createElement("span",{onClick:u=>{a(s,o),u.stopPropagation()}},Ci.default.createElement("div",{className:"mk-icon-xsmall",dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//close")}})))},EEe=e=>{let{group:t,selectGroupType:r,addDefGroup:n,selectField:i,i:a,removeDefGroup:o}=e;return Ci.default.createElement("div",{className:"mk-query-group"},Ci.default.createElement("div",{className:"mk-filter-bar mk-query-filters"},e.children,Ci.default.createElement("div",{className:"mk-filter-add",onClick:s=>i(s,a,t?.filters.length??0)},Ci.default.createElement("span",null,Ci.default.createElement("span",{className:"mk-icon-xsmall",dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//plus")}}),W.buttons.addCondition))),e.removeable&&Ci.default.createElement("div",{className:"mk-filter-add",onClick:s=>{o(a),s.stopPropagation()}},Ci.default.createElement("span",null,Ci.default.createElement("span",{className:"mk-icon-small",dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//close")}}))))};var kEe=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"},W.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(w2,{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":W.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")}}),W.buttons.addSmartSearch))))))};var _a=Ae(Te());var CEe=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(W.labels.newAction,_a.default.createElement(_i,{value:"",saveLabel:W.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(jY(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,Zt(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(jY(r,c.schema.id),d.metaKey)}},c.schema.name)))))):_a.default.createElement(_a.default.Fragment,null)};var za=Ae(Te());var DEe=e=>{let[t,r]=(0,za.useState)(!0),[n,i]=(0,za.useState)(e.space.metadata??{}),a=l=>{i(l),du(e.superstate,e.space.space,l)},o=(0,za.useMemo)(()=>(n?.links??[]).map(l=>e.superstate.pathsIndex.get(l)).filter(l=>l),[n]),s=(0,za.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,za.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?za.default.createElement("div",{className:"mk-props-pill",onClick:()=>r(l=>!l)},za.default.createElement("div",{className:"mk-path-context-field-icon",dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//file-stack")}}),o.length+s.length," Items"):za.default.createElement("div",{className:"mk-path-context-row"},za.default.createElement("div",{className:"mk-path-context-field"},za.default.createElement("div",{className:"mk-path-context-field-icon",dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//file-stack")}}),za.default.createElement("div",{className:"mk-path-context-field-key","aria-label":W.descriptions.spaceItems},"Items")),za.default.createElement("div",{className:"mk-path-context-value"},za.default.createElement("div",{className:"mk-props-value"},za.default.createElement("div",{className:"mk-props-list"},za.default.createElement("div",{className:"mk-props-pill",onClick:()=>r(l=>!l)},o.length+s.length," Items",za.default.createElement(gh,{superstate:e.superstate,collapsed:t})),za.default.createElement("button",{className:"mk-toolbar-button","aria-label":W.buttons.addSmartSearch,onClick:l=>{let u=[];u.push({name:W.buttons.addSmartSearch,icon:"ui//live",onClick:()=>{a({...n,filters:[...n.filters??[],{type:"any",trueFalse:!0,filters:[]}]})}}),u.push({name:W.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,Zt(e.superstate.ui,p),Ne(l.view.document),null,d)}});let c=l.currentTarget.getBoundingClientRect();e.superstate.ui.openMenu(c,Zt(e.superstate.ui,u),Ne(l.view.document))},dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//plus")}})),!t&&za.default.createElement("div",{className:"mk-props-list"},o.map((l,u)=>za.default.createElement(oo,{key:u,superstate:e.superstate,path:l.path,source:e.space.path})),s.map((l,u)=>za.default.createElement(oo,{key:u,superstate:e.superstate,path:l.path,source:e.space.path}))))))};var lg=Ae(Te()),OEe=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}=Ws({id:n,data:{id:n,type:"context",space:r?.path,schema:e.schema?.id}}),l=(0,lg.useRef)(null);return Da({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 zi=Ae(Te());var MEe=e=>{let{pathState:t}=(0,zi.useContext)($r),{spaceState:r}=(0,zi.useContext)(ur),[n,i]=(0,zi.useState)(!0),[a,o]=(0,zi.useState)([]);(0,zi.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,zi.useEffect)(()=>(e.superstate.eventsDispatcher.addListener("contextStateUpdated",s),()=>{e.superstate.eventsDispatcher.removeListener("contextStateUpdated",s)}),[t]);let l=c=>{e.superstate.ui.openModal(W.labels.newTable,zi.default.createElement(_i,{value:"",saveLabel:W.buttons.save,saveValue:f=>{e.superstate.spaceManager.tablesForSpace(r.path).then(d=>{if(d){let p={id:ji(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:W.menu.copyEmbedLink,icon:"ui//link",onClick:p=>{navigator.clipboard.writeText(v9(r,f.id))}}),d.push({name:W.menu.moveFile,icon:"ui//move",onClick:p=>{let h=p.target.getBoundingClientRect();ao(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=ji(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:W.menu.duplicate,icon:"ui//copy",onClick:p=>{e.superstate.ui.openModal("Duplicate Table",zi.default.createElement(_i,{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=ji(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:W.buttons.renameView,icon:"ui//edit",onClick:p=>{e.superstate.ui.openModal(W.labels.renameView,zi.default.createElement(_i,{value:f.name,saveLabel:W.labels.renameView,saveValue:h=>{e.superstate.spaceManager.saveTableSchema(t.path,f.id,()=>({...f,name:h}))}}),Ne(p.view.document))}}),d.push({name:W.buttons.delete,icon:"ui//trash",onClick:p=>{e.superstate.spaceManager.deleteTable(t.path,f.id)}}),e.superstate.ui.openMenu(c.target.getBoundingClientRect(),Zt(e.superstate.ui,d),Ne(c.view.document))};return a.length>0?e.compactMode?zi.default.createElement("div",{className:"mk-props-pill",onClick:()=>i(c=>!c)},a.length," Lists"):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//layout-list")}}),zi.default.createElement("div",{className:"mk-path-context-field-key"},"Lists")),zi.default.createElement("div",{className:"mk-props-value"},zi.default.createElement("div",{className:"mk-props-pill",onClick:()=>i(c=>!c)},a.length," Lists",zi.default.createElement(gh,{superstate:e.superstate,collapsed:n})),!n&&zi.default.createElement(zi.default.Fragment,null,zi.default.createElement("div",{className:"mk-props-list"},a.map((c,f)=>zi.default.createElement(OEe,{key:f,superstate:e.superstate,schema:c,onClick:d=>{e.superstate.ui.openPath(ib(r,c.id),d.metaKey)},onContextMenu:d=>{u(d,c)}})),zi.default.createElement("button",{className:"mk-toolbar-button","aria-label":W.labels.newTable,onClick:c=>l(c),dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//plus")}}))))):zi.default.createElement(zi.default.Fragment,null)};var Ui=Ae(Te());var jEe=e=>{let{pathState:t}=(0,Ui.useContext)($r),{spaceState:r}=(0,Ui.useContext)(ur),[n,i]=(0,Ui.useState)(!0),[a,o]=Ui.default.useState([]);(0,Ui.useEffect)(()=>{s({path:t.path})},[]);let s=f=>{f.path==t?.path&&o(e.superstate.spacesIndex.get(r.path)?.templates)};(0,Ui.useEffect)(()=>(e.superstate.eventsDispatcher.addListener("spaceStateUpdated",s),()=>{e.superstate.eventsDispatcher.removeListener("spaceStateUpdated",s)}),[t]);let l=f=>{let d=f.target.getBoundingClientRect();Gu(d,Ne(f.view.document),e.superstate,p=>{cv(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:()=>_ye(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,Zt(e.superstate.ui,h),Ne(f.view.document),"bottom")},c=f=>{let d={superstate:e.superstate,saveFormula:p=>Pye(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(),Ui.default.createElement(Ah,{...d}),{...d},Ne(f.view.document),"bottom")};return a?.length>0?e.compactMode?Ui.default.createElement("div",{className:"mk-props-pill",onClick:()=>i(f=>!f)},a.length," Templates"):Ui.default.createElement("div",{className:"mk-path-context-row"},Ui.default.createElement("div",{className:"mk-path-context-field"},Ui.default.createElement("div",{className:"mk-path-context-field-icon",dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//clipboard-pen")}}),Ui.default.createElement("div",{className:"mk-path-context-field-key"},"Templates")),Ui.default.createElement("div",{className:"mk-path-context-value"},Ui.default.createElement("div",{className:"mk-props-pill",onClick:()=>i(f=>!f)},a.length," Templates",Ui.default.createElement(gh,{superstate:e.superstate,collapsed:n})),Ui.default.createElement("button",{className:"mk-toolbar-button","aria-label":W.labels.editFormula,onClick:f=>c(f),dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//formula")}}),!n&&Ui.default.createElement("div",{className:"mk-props-list"},a.map((f,d)=>Ui.default.createElement("div",{key:d,className:"mk-path",onContextMenu:p=>u(p,f)},Ui.default.createElement("div",{className:"mk-path-icon",dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//clipboard-pen")}}),Ui.default.createElement("div",null,f),r.metadata.template==f&&Ui.default.createElement("div",{className:"mk-path-icon","aria-label":"Default",dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//check")}}))),Ui.default.createElement("button",{className:"mk-toolbar-button","aria-label":W.labels.newAction,onClick:f=>l(f),dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//plus")}})))):Ui.default.createElement(Ui.default.Fragment,null)};var dr=Ae(Te());var S2=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:W.menu.openSpace,icon:"ui//layout-grid",onClick:te=>{e.superstate.ui.openPath(L.path,te.metaKey)}}),Y.push({name:W.labels.newProperty,icon:"ui//plus",onClick:te=>{g(te,L.path)}}),l&&!_&&Y.push({name:W.menu.removeFromSpace,icon:"ui//trash",onClick:te=>{l(L.path)}});let oe=I.target.getBoundingClientRect();e.superstate.ui.openMenu(oe,Zt(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"?(Bye(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:pr,contextPath:T,fileMetadata:!c})},A=I=>{let T=I.target.getBoundingClientRect();ao(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(W.labels.newAction,dr.default.createElement(_i,{value:"",saveLabel:W.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(W.labels.newTable,dr.default.createElement(_i,{value:"",saveLabel:W.buttons.save,saveValue:T=>{e.superstate.spaceManager.tablesForSpace(a.path).then(L=>{if(L){let _={id:ji(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)=>Gu(I,T,e.superstate,L=>{cv(e.superstate,u.path,L)}),w=I=>{let T=I.target.getBoundingClientRect(),L=Ne(I.view.document);e.superstate.ui.openMenu(T,Zt(e.superstate.ui,[{name:W.labels.newTable,description:W.descriptions.spaceLists,icon:"ui//table",onClick:_=>v(_)},{name:W.labels.template,description:W.descriptions.spaceTemplates,icon:"ui//clipboard-pen",onClick:_=>x(T,L)},{name:W.labels.newAction,description:W.descriptions.spaceActions,icon:"ui//mouse-pointer-click",onClick:_=>b(_)},qt,{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})}},qt,{name:"Apply to Items",description:W.descriptions.spaceProperties,icon:"ui//list",type:6,onSubmenu:_=>r9(_,e.superstate,a,L)},qt,{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?aj.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,pr).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=>mr(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,pr).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]:ca(T.property.type,I,!0)})},C=(I,T,L)=>{pi(e.superstate,u.path,{[L.property.name]:ca(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=[...m0(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")}}),W.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(DEe,{superstate:e.superstate,space:a,compactMode:!1}),dr.default.createElement(kEe,{superstate:e.superstate,space:a}),dr.default.createElement(MEe,{superstate:e.superstate,compactMode:!1}),dr.default.createElement(jEe,{superstate:e.superstate,compactMode:!1}),dr.default.createElement(CEe,{superstate:e.superstate,compactMode:!1})),S.map((I,T)=>dr.default.createElement(xs,{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(gEe,{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"},W.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 jv={isEmpty:W.filterTypes.isEmpty,isNotEmpty:W.filterTypes.isNotEmpty,include:W.filterTypes.contains,notInclude:W.filterTypes.notContains,is:W.filterTypes.is,isNot:W.filterTypes.isNot,isLink:W.filterTypes.is,isNotLink:W.filterTypes.isNot,equal:"=",isGreatThan:">",isLessThan:"<",isLessThanOrEqual:"\u2264",isGreatThanOrEqual:"\u2265",dateBefore:W.filterTypes.before,dateAfter:W.filterTypes.after,isSameDate:W.filterTypes.isSameDate,isSameDateAsToday:W.filterTypes.isSameDateAsToday,isExactList:W.filterTypes.is,isAnyInList:W.filterTypes.anyOf,isNoneInList:W.filterTypes.noneOf,isTrue:W.filterTypes.checked,isFalse:W.filterTypes.unchecked};var Ci=Ae(Te());var SEe=Ae(Qa());var g9=(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,{...Zt(r.ui,[o])},t)}else if(n.type=="date")Ov(r.ui,e,t,new Date,o=>i(o.toISOString()),0);else if(n.type=="option"){let o=mr(n.value,n.type,r,a)?.options??[];r.ui.openMenu(e,{...Zt(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,{...Zt(r.ui,o),saveOptions:(s,l)=>{i(l[0])}},t)}}};var Kt=Ae(Te());var Nv=Ae(Te());var oJe=(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}`,ib=(e,t)=>e.type=="folder"?`${e.path}/#^${t}`:e.type=="vault"?`/#^${t}`:`${e.path}/#^${t}`,dD=(e,t)=>`![![${oJe(e,t)}]]`,v9=(e,t)=>`![![${ib(e,t)}]]`;var vEe=e=>{let{dbSchema:t,source:r}=(0,Nv.useContext)(Ta),n=u=>{e.superstate.ui.openPalette(Nv.default.createElement(Fa,{ui:e.superstate.ui,selectedSticker:c=>e.superstate.spaceManager.saveTableSchema(r,t.id,()=>({...t,def:JSON.stringify({...ir(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 Nv.default.createElement("div",{className:"mk-context-title"},Nv.default.createElement("div",{className:"mk-path-icon",onClick:u=>n(u),dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker(GJ(t))}}),Nv.default.createElement("div",{contentEditable:!0,dangerouslySetInnerHTML:{__html:t?.name},onBlur:a,onKeyPress:o,onKeyUp:s,onKeyDown:l}),Nv.default.createElement("button",{className:"mk-toolbar-button",onClick:()=>e.superstate.ui.openPath(ib(e.superstate.spacesIndex.get(r),t.id)),dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//expand")}}))};var yEe=Ae(Te()),bEe=e=>yEe.default.createElement("div",{onClick:t=>e.onSelect(t),onContextMenu:t=>e.onContextMenu(t,e.schema),className:`mk-context ${e.active?"mk-active":""}`},mM(e.schema.name,"Untitled"),e.children);var xEe=Ae(Te()),Vd=e=>xEe.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 tl=Ae(Te());var wEe=e=>{let{views:t,dbSchema:r,source:n}=(0,tl.useContext)(Ta),{readMode:i}=(0,tl.useContext)($r),{spaceState:a}=(0,tl.useContext)(ur),{frameSchema:o,setFrameSchema:s,saveSchema:l,deleteSchema:u}=(0,tl.useContext)(Aa),c=(m,g)=>{let A=[];A.push({name:W.menu.copyEmbedLink,icon:"ui//link",onClick:b=>{navigator.clipboard.writeText(dD(a,g.id))}}),A.push({name:W.buttons.renameView,icon:"ui//edit",onClick:b=>{e.superstate.ui.openModal(W.labels.renameView,tl.default.createElement(_i,{value:g.name,saveLabel:W.labels.renameView,saveValue:v=>l({...g,name:v})}),Ne(b.view.document))}}),t.length>1&&A.push({name:W.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(),Zt(e.superstate.ui,A),Ne(m.view.document))},f=m=>{s(t.find(g=>g.id==m)),e.setView&&e.setView(m)},d=(0,tl.useRef)(null),p=m=>{e.superstate.ui.openModal(W.labels.saveView,tl.default.createElement(_i,{value:"",saveLabel:W.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:mM(A.name,"Untitled"),value:A.id,icon:Ix(A),onClick:()=>f(A.id),onMoreOptions:i?null:b=>c(b,A)})}),i||(g.push(qt),g.push({name:W.menu.newView,icon:"ui//plus",value:"",onClick:A=>p(A)})),e.superstate.ui.openMenu(m.target.getBoundingClientRect(),Zt(e.superstate.ui,g),Ne(m.view.document),"bottom")};return r&&(o?tl.default.createElement(tl.default.Fragment,null,tl.default.createElement("div",{className:"mk-view-selector",ref:d},t.map((m,g)=>tl.default.createElement(bEe,{key:g,active:o.id==m.id,superstate:e.superstate,schema:m,onSelect:()=>s(t.find(A=>A.id==m.id)),onContextMenu:c})),tl.default.createElement("button",{className:"mk-toolbar-button",onClick:m=>p(m),dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//plus")}}))):tl.default.createElement("div",{onClick:m=>h(m),className:"mk-context"},tl.default.createElement("div",{className:"mk-path-icon",dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//table")}}),r.name,tl.default.createElement(Vd,{collapsed:!1,onToggle:null,superstate:e.superstate})))};var nm=Ae(Te());var y9=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:W.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 b9=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)(Ta),{frameSchema:p,saveSchema:h,setFrameSchema:m}=(0,Kt.useContext)(Aa),[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:W.menu.tableView,icon:"ui//table",view:"table",listView:"",listGroup:"",listItem:""},list:{name:W.menu.listView,icon:"ui//list",view:"list",listView:"spaces://$kit/#*listView",listGroup:"spaces://$kit/#*listGroup",listItem:"spaces://$kit/#*rowItem"},details:{name:W.menu.detailsView,icon:"ui//layout-grid",view:"list",listView:"spaces://$kit/#*listView",listGroup:"spaces://$kit/#*listGroup",listItem:"spaces://$kit/#*detailItem"},board:{name:W.menu.boardView,icon:"ui//square-kanban",view:"list",listView:"spaces://$kit/#*columnView",listGroup:"spaces://$kit/#*columnGroup",listItem:"spaces://$kit/#*cardListItem"},cards:{name:W.menu.cardView,icon:"ui//layout-dashboard",view:"list",listView:"spaces://$kit/#*listView",listGroup:"spaces://$kit/#*gridGroup",listItem:"spaces://$kit/#*cardsListItem"},catalog:{name:W.menu.catalogView,icon:"ui//gallery-horizontal-end",view:"list",listView:"spaces://$kit/#*listView",listGroup:"spaces://$kit/#*rowGroup",listItem:"spaces://$kit/#*coverListItem"},gallery:{name:W.menu.galleryView,icon:"ui//layout-dashboard",view:"list",listView:"spaces://$kit/#*listView",listGroup:"spaces://$kit/#*masonryGroup",listItem:"spaces://$kit/#*imageListItem"},flow:{name:W.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:W.menu.customView,icon:"ui//brush",onClick:ke=>{s(3)}}),e.superstate.ui.openMenu(ye,Zt(e.superstate.ui,me),Ne(ve.view.document))},P=(ve,ye)=>ao(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(qt),ye.push({name:W.menu.properties,icon:"ui//list",type:6,onSubmenu:(U,R)=>Ie(U,Ne(ve.view.document),R)})),ye.push({name:W.menu.groupBy,icon:"ui//columns",type:6,onSubmenu:(U,R)=>Se(U,Ne(ve.view.document),R)}),ye.push({name:W.menu.sortBy,icon:"ui//sort-desc",type:6,onSubmenu:(U,R)=>te(U,Ne(ve.view.document),R)}),ye.push({name:W.menu.filters,icon:"ui//filter",type:6,onSubmenu:(U,R)=>oe(U,Ne(ve.view.document),R)}),ye.push(qt),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(qt)}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:Ri(U),type:1,onClick:R=>{g9(R.target.getBoundingClientRect(),Ne(R.view.document),e.superstate,U,J=>ae("listViewProps",U.name,ca(U.type,J,!0)),t.path)}})}),ke.forEach(U=>{ye.push({name:Vo(U,e.superstate),icon:Ri(U),type:1,onClick:R=>{g9(R.target.getBoundingClientRect(),Ne(R.view.document),e.superstate,U,J=>ae("listGroupProps",U.name,ca(U.type,J,!0)),t.path)}})}),$.forEach(U=>{ye.push({name:Vo(U,e.superstate),icon:Ri(U),type:1,onClick:R=>{g9(R.target.getBoundingClientRect(),Ne(R.view.document),e.superstate,U,J=>ae("listItemProps",U.name,ca(U.type,J,!0)),t.path)}})});let ce=ve.target.getBoundingClientRect();e.superstate.ui.openMenu(ce,Zt(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,Li);if(!ke)return;let $=me=="boolean"?{field:ve,fn:ke,fType:Li[ke].valueType,value:"true"}:{field:ve,fn:ke,fType:Li[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=p2(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:W.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:Li[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=p2(ce,Li);e.superstate.ui.openMenu(ke,{ui:e.superstate.ui,multi:!1,editable:!1,value:[],options:U.map(R=>({name:jv[R],value:R})),saveOptions:$,placeholder:W.labels.filterItemSelectPlaceholder,searchable:!1,showAll:!0},Ne(ve.view.document))},oe=(ve,ye,me)=>{let ke=x.filter($=>$.type=="fileprop"||p2($.type,Li).length>0).map($=>({name:$.name+$.table,value:$.name+$.table,icon:Ri($),onClick:ae=>{L($.name+$.table)}}));return ke.push(qt),ke.push({name:W.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:W.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:Ri(ke),value:ke.name+ke.table})),saveOptions:z,placeholder:W.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:W.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(qt),$.push(...x.filter(ae=>l.colsHidden.some(ce=>ce==ae.name+ae.table)==!1).map(ae=>({name:ae.name+ae.table,icon:Ri(ae),value:ae.name+ae.table,type:6,onSubmenu:(ce,U)=>ke(ae,ce,U)}))),$.push(qt),$.push(...x.filter(ae=>l.colsHidden.some(ce=>ce==ae.name+ae.table)).map(ae=>({name:ae.name+ae.table,icon:Ri(ae),value:ae.name+ae.table,type:6,onSubmenu:(ce,U)=>ke(ae,ce,U)}))),$.push(qt),$.push({name:W.menu.unhideFields,icon:"ui//eye",onClick:ae=>{O()}}),e.superstate.ui.openMenu(ve,{ui:e.superstate.ui,multi:!1,editable:!1,value:[],options:$,placeholder:W.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:Ri(ke),value:ke.name+ke.table})),saveOptions:I,placeholder:W.labels.propertyItemSelectPlaceholder,searchable:!1,showAll:!0},ye,"right",me),Oe=(ve,ye,me)=>{switch(ye.fType??Li[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);Ov(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=mr(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:tr(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:W.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();Gu(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:yi(ce)};u({filters:(l?.filters??[]).map((R,J)=>J==me?U:R)})};if(ke.type.startsWith("option")){let ae=ve.target.getBoundingClientRect(),ce=mr(ke.value,ke.type).options;e.superstate.ui.openMenu(ae,{ui:e.superstate.ui,multi:!0,editable:!1,value:tr(ye.value),options:ce??[],saveOptions:$,placeholder:W.labels.optionItemSelectPlaceholder,searchable:!0,showAll:!0},Ne(ve.view.document))}else if(ke.type.startsWith("context")){let ae=mr(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:tr(ye.value),options:ce.map(R=>({name:R.name,value:R.path}))??[],saveOptions:$,placeholder:W.labels.optionItemSelectPlaceholder,searchable:!0,showAll:!0},Ne(ve.view.document))}else if(ke.type.startsWith("link")){let ae=ve.target.getBoundingClientRect();Gu(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:tr(ye.value),options:ae.map(U=>({name:U,value:U}))??[],saveOptions:$,placeholder:W.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(y9,{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(vEe,{superstate:e.superstate}),Kt.default.createElement("span",null),i?.id==pr&&!t.space.readOnly&&Kt.default.createElement(Kt.default.Fragment,null,Kt.default.createElement("button",{className:"mk-button-new",onClick:ve=>a9(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(wEe,{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,SEe.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(y9,{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(y9,{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,W.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)},jv[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:W.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")}}),W.buttons.addFilter)),Kt.default.createElement("span",null)))},FY=e=>{let{filter:t,selectFilterValue:r,fieldType:n}=e,i=Li[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=tr(t.value);return Kt.default.createElement("span",{onClick:l=>r(l,t)},s.length==0?W.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)},W.labels.select);return Kt.default.createElement("span",{onClick:s=>r(s,t)},t.value)};var w2=e=>{(0,Ci.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(Li[m.fn]?.valueType){case"text":case"number":b(m.value);break;case"date":{let v=S=>{b(Ya(S,"yyyy-MM-dd"))},x=h.target.getBoundingClientRect(),w=new Date(m.value);Ov(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();Gu(x,Ne(h.view.document),e.superstate,v),h.stopPropagation();break}case"space":{let v=w=>{b(w)},x=h.target.getBoundingClientRect();ao(x,Ne(h.view.document),e.superstate,v);break}case"list":{let v=m.fType,x=(k,j)=>{b(yi(j))},w=[];v.startsWith("option")?w=tr(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:tr(m.value),options:w,saveOptions:x,placeholder:W.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"?JSe(Li):p2(x,Li);e.superstate.ui.openMenu(A,{ui:e.superstate.ui,multi:!1,editable:!0,value:[],options:w.map(S=>({name:jv[S],value:S})),saveOptions:(S,k)=>s(k[0],m,g),placeholder:W.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:W.labels.contextItemSelectPlaceholder,searchable:!0,showAll:!0,sections:e.sections,showSections:!0},Ne(h.view.document))};return Ci.default.createElement("div",{className:"mk-query"},t.length==0?Ci.default.createElement(EEe,{superstate:e.superstate,selectGroupType:f,group:null,addDefGroup:i,selectField:p,i:0,removeable:e.removeable,removeDefGroup:a}):t.map((h,m)=>Ci.default.createElement(EEe,{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)=>Ci.default.createElement(Ci.default.Fragment,{key:A},Ci.default.createElement(sJe,{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&&Ci.default.createElement("div",{className:"mk-filter",onClick:v=>f(v,m)},Ci.default.createElement("span",null,h.type=="any"?"or":"and")))))))},sJe=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 Ci.default.createElement("div",{className:"mk-filter"},Ci.default.createElement("span",{onClick:u=>r(u,o,s)},t.field.length==0?W.labels.select:l),t.field.length>0&&Ci.default.createElement("span",{onClick:u=>n(u,o,s)},jv[t.fn]?jv[t.fn]:W.labels.select),t.field.length>0&&jv[t.fn]&&Li[t.fn]?.valueType!="none"&&Ci.default.createElement(Ci.default.Fragment,null,Ci.default.createElement("span",null,Ci.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&&Ci.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:W.labels.contextItemSelectPlaceholder,searchable:!0,showAll:!0,sections:[],showSections:!1},Ne(u.view.document))}},Ci.default.createElement("div",{className:"mk-icon-xsmall",dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//plug")}}))),Ci.default.createElement("span",{onClick:u=>{a(s,o),u.stopPropagation()}},Ci.default.createElement("div",{className:"mk-icon-xsmall",dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//close")}})))},EEe=e=>{let{group:t,selectGroupType:r,addDefGroup:n,selectField:i,i:a,removeDefGroup:o}=e;return Ci.default.createElement("div",{className:"mk-query-group"},Ci.default.createElement("div",{className:"mk-filter-bar mk-query-filters"},e.children,Ci.default.createElement("div",{className:"mk-filter-add",onClick:s=>i(s,a,t?.filters.length??0)},Ci.default.createElement("span",null,Ci.default.createElement("span",{className:"mk-icon-xsmall",dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//plus")}}),W.buttons.addCondition))),e.removeable&&Ci.default.createElement("div",{className:"mk-filter-add",onClick:s=>{o(a),s.stopPropagation()}},Ci.default.createElement("span",null,Ci.default.createElement("span",{className:"mk-icon-small",dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//close")}}))))};var kEe=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"},W.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(w2,{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":W.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")}}),W.buttons.addSmartSearch))))))};var _a=Ae(Te());var CEe=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(W.labels.newAction,_a.default.createElement(_i,{value:"",saveLabel:W.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,Zt(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 za=Ae(Te());var DEe=e=>{let[t,r]=(0,za.useState)(!0),[n,i]=(0,za.useState)(e.space.metadata??{}),a=l=>{i(l),du(e.superstate,e.space.space,l)},o=(0,za.useMemo)(()=>(n?.links??[]).map(l=>e.superstate.pathsIndex.get(l)).filter(l=>l),[n]),s=(0,za.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,za.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?za.default.createElement("div",{className:"mk-props-pill",onClick:()=>r(l=>!l)},za.default.createElement("div",{className:"mk-path-context-field-icon",dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//file-stack")}}),o.length+s.length," Items"):za.default.createElement("div",{className:"mk-path-context-row"},za.default.createElement("div",{className:"mk-path-context-field"},za.default.createElement("div",{className:"mk-path-context-field-icon",dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//file-stack")}}),za.default.createElement("div",{className:"mk-path-context-field-key","aria-label":W.descriptions.spaceItems},"Items")),za.default.createElement("div",{className:"mk-path-context-value"},za.default.createElement("div",{className:"mk-props-value"},za.default.createElement("div",{className:"mk-props-list"},za.default.createElement("div",{className:"mk-props-pill",onClick:()=>r(l=>!l)},o.length+s.length," Items",za.default.createElement(gh,{superstate:e.superstate,collapsed:t})),za.default.createElement("button",{className:"mk-toolbar-button","aria-label":W.buttons.addSmartSearch,onClick:l=>{let u=[];u.push({name:W.buttons.addSmartSearch,icon:"ui//live",onClick:()=>{a({...n,filters:[...n.filters??[],{type:"any",trueFalse:!0,filters:[]}]})}}),u.push({name:W.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,Zt(e.superstate.ui,p),Ne(l.view.document),null,d)}});let c=l.currentTarget.getBoundingClientRect();e.superstate.ui.openMenu(c,Zt(e.superstate.ui,u),Ne(l.view.document))},dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//plus")}})),!t&&za.default.createElement("div",{className:"mk-props-list"},o.map((l,u)=>za.default.createElement(oo,{key:u,superstate:e.superstate,path:l.path,source:e.space.path})),s.map((l,u)=>za.default.createElement(oo,{key:u,superstate:e.superstate,path:l.path,source:e.space.path}))))))};var lg=Ae(Te()),OEe=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}=Ws({id:n,data:{id:n,type:"context",space:r?.path,schema:e.schema?.id}}),l=(0,lg.useRef)(null);return Da({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 zi=Ae(Te());var MEe=e=>{let{pathState:t}=(0,zi.useContext)($r),{spaceState:r}=(0,zi.useContext)(ur),[n,i]=(0,zi.useState)(!0),[a,o]=(0,zi.useState)([]);(0,zi.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,zi.useEffect)(()=>(e.superstate.eventsDispatcher.addListener("contextStateUpdated",s),()=>{e.superstate.eventsDispatcher.removeListener("contextStateUpdated",s)}),[t]);let l=c=>{e.superstate.ui.openModal(W.labels.newTable,zi.default.createElement(_i,{value:"",saveLabel:W.buttons.save,saveValue:f=>{e.superstate.spaceManager.tablesForSpace(r.path).then(d=>{if(d){let p={id:ji(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:W.menu.copyEmbedLink,icon:"ui//link",onClick:p=>{navigator.clipboard.writeText(v9(r,f.id))}}),d.push({name:W.menu.moveFile,icon:"ui//move",onClick:p=>{let h=p.target.getBoundingClientRect();ao(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=ji(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:W.menu.duplicate,icon:"ui//copy",onClick:p=>{e.superstate.ui.openModal("Duplicate Table",zi.default.createElement(_i,{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=ji(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:W.buttons.renameView,icon:"ui//edit",onClick:p=>{e.superstate.ui.openModal(W.labels.renameView,zi.default.createElement(_i,{value:f.name,saveLabel:W.labels.renameView,saveValue:h=>{e.superstate.spaceManager.saveTableSchema(t.path,f.id,()=>({...f,name:h}))}}),Ne(p.view.document))}}),d.push({name:W.buttons.delete,icon:"ui//trash",onClick:p=>{e.superstate.spaceManager.deleteTable(t.path,f.id)}}),e.superstate.ui.openMenu(c.target.getBoundingClientRect(),Zt(e.superstate.ui,d),Ne(c.view.document))};return a.length>0?e.compactMode?zi.default.createElement("div",{className:"mk-props-pill",onClick:()=>i(c=>!c)},a.length," Lists"):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//layout-list")}}),zi.default.createElement("div",{className:"mk-path-context-field-key"},"Lists")),zi.default.createElement("div",{className:"mk-props-value"},zi.default.createElement("div",{className:"mk-props-pill",onClick:()=>i(c=>!c)},a.length," Lists",zi.default.createElement(gh,{superstate:e.superstate,collapsed:n})),!n&&zi.default.createElement(zi.default.Fragment,null,zi.default.createElement("div",{className:"mk-props-list"},a.map((c,f)=>zi.default.createElement(OEe,{key:f,superstate:e.superstate,schema:c,onClick:d=>{e.superstate.ui.openPath(ib(r,c.id),d.metaKey)},onContextMenu:d=>{u(d,c)}})),zi.default.createElement("button",{className:"mk-toolbar-button","aria-label":W.labels.newTable,onClick:c=>l(c),dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//plus")}}))))):zi.default.createElement(zi.default.Fragment,null)};var Ui=Ae(Te());var jEe=e=>{let{pathState:t}=(0,Ui.useContext)($r),{spaceState:r}=(0,Ui.useContext)(ur),[n,i]=(0,Ui.useState)(!0),[a,o]=Ui.default.useState([]);(0,Ui.useEffect)(()=>{s({path:t.path})},[]);let s=f=>{f.path==t?.path&&o(e.superstate.spacesIndex.get(r.path)?.templates)};(0,Ui.useEffect)(()=>(e.superstate.eventsDispatcher.addListener("spaceStateUpdated",s),()=>{e.superstate.eventsDispatcher.removeListener("spaceStateUpdated",s)}),[t]);let l=f=>{let d=f.target.getBoundingClientRect();Gu(d,Ne(f.view.document),e.superstate,p=>{cv(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:()=>_ye(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,Zt(e.superstate.ui,h),Ne(f.view.document),"bottom")},c=f=>{let d={superstate:e.superstate,saveFormula:p=>Pye(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(),Ui.default.createElement(Ah,{...d}),{...d},Ne(f.view.document),"bottom")};return a?.length>0?e.compactMode?Ui.default.createElement("div",{className:"mk-props-pill",onClick:()=>i(f=>!f)},a.length," Templates"):Ui.default.createElement("div",{className:"mk-path-context-row"},Ui.default.createElement("div",{className:"mk-path-context-field"},Ui.default.createElement("div",{className:"mk-path-context-field-icon",dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//clipboard-pen")}}),Ui.default.createElement("div",{className:"mk-path-context-field-key"},"Templates")),Ui.default.createElement("div",{className:"mk-path-context-value"},Ui.default.createElement("div",{className:"mk-props-pill",onClick:()=>i(f=>!f)},a.length," Templates",Ui.default.createElement(gh,{superstate:e.superstate,collapsed:n})),Ui.default.createElement("button",{className:"mk-toolbar-button","aria-label":W.labels.editFormula,onClick:f=>c(f),dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//formula")}}),!n&&Ui.default.createElement("div",{className:"mk-props-list"},a.map((f,d)=>Ui.default.createElement("div",{key:d,className:"mk-path",onContextMenu:p=>u(p,f)},Ui.default.createElement("div",{className:"mk-path-icon",dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//clipboard-pen")}}),Ui.default.createElement("div",null,f),r.metadata.template==f&&Ui.default.createElement("div",{className:"mk-path-icon","aria-label":"Default",dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//check")}}))),Ui.default.createElement("button",{className:"mk-toolbar-button","aria-label":W.labels.newAction,onClick:f=>l(f),dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//plus")}})))):Ui.default.createElement(Ui.default.Fragment,null)};var dr=Ae(Te());var S2=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:W.menu.openSpace,icon:"ui//layout-grid",onClick:te=>{e.superstate.ui.openPath(L.path,te.metaKey)}}),Y.push({name:W.labels.newProperty,icon:"ui//plus",onClick:te=>{g(te,L.path)}}),l&&!_&&Y.push({name:W.menu.removeFromSpace,icon:"ui//trash",onClick:te=>{l(L.path)}});let oe=I.target.getBoundingClientRect();e.superstate.ui.openMenu(oe,Zt(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"?(Bye(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:pr,contextPath:T,fileMetadata:!c})},A=I=>{let T=I.target.getBoundingClientRect();ao(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(W.labels.newAction,dr.default.createElement(_i,{value:"",saveLabel:W.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(W.labels.newTable,dr.default.createElement(_i,{value:"",saveLabel:W.buttons.save,saveValue:T=>{e.superstate.spaceManager.tablesForSpace(a.path).then(L=>{if(L){let _={id:ji(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)=>Gu(I,T,e.superstate,L=>{cv(e.superstate,u.path,L)}),w=I=>{let T=I.target.getBoundingClientRect(),L=Ne(I.view.document);e.superstate.ui.openMenu(T,Zt(e.superstate.ui,[{name:W.labels.newTable,description:W.descriptions.spaceLists,icon:"ui//table",onClick:_=>v(_)},{name:W.labels.template,description:W.descriptions.spaceTemplates,icon:"ui//clipboard-pen",onClick:_=>x(T,L)},{name:W.labels.newAction,description:W.descriptions.spaceActions,icon:"ui//mouse-pointer-click",onClick:_=>b(_)},qt,{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})}},qt,{name:"Apply to Items",description:W.descriptions.spaceProperties,icon:"ui//list",type:6,onSubmenu:_=>r9(_,e.superstate,a,L)},qt,{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?aj.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,pr).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=>mr(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,pr).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]:ca(T.property.type,I,!0)})},C=(I,T,L)=>{pi(e.superstate,u.path,{[L.property.name]:ca(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=[...m0(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")}}),W.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(DEe,{superstate:e.superstate,space:a,compactMode:!1}),dr.default.createElement(kEe,{superstate:e.superstate,space:a}),dr.default.createElement(MEe,{superstate:e.superstate,compactMode:!1}),dr.default.createElement(jEe,{superstate:e.superstate,compactMode:!1}),dr.default.createElement(CEe,{superstate:e.superstate,compactMode:!1})),S.map((I,T)=>dr.default.createElement(xs,{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(gEe,{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"},W.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 TY=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(Ys,{superstate:e.superstate,path:t,readMode:!1},i?Xo.default.createElement(lh,{superstate:e.superstate},Xo.default.createElement(NEe,{superstate:e.superstate})):Xo.default.createElement(NEe,{superstate:e.superstate}))},NEe=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")}}),W.labels.properties),Xo.default.createElement(S2,{superstate:e.superstate,collapseSpaces:!1})),Xo.default.createElement(ab,{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 Di=Ae(Te());var oJe=e=>{let[t,r]=(0,Di.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,Di.useEffect)(()=>{n(e.path)},[]),(0,Di.useEffect)(()=>{n(e.path)},[e.path]);let[i,a]=(0,Di.useState)(!0);return Di.default.createElement(Di.default.Fragment,null,Di.default.createElement("div",{className:"mk-path-backlink-title"},Di.default.createElement(oo,{superstate:e.superstate,path:e.path},Di.default.createElement(Vd,{superstate:e.superstate,collapsed:i,onToggle:o=>a(o)}))),!i&&t?Di.default.createElement("div",{className:"mk-path-context-backlink"},Di.default.createElement(hv,{load:!0,forceNote:!0,superstate:e.superstate,path:e.path,properties:{from:t[0],to:t[1]},classname:"mk-path-context-flow"})):Di.default.createElement(Di.default.Fragment,null))},ab=e=>{let[t,r]=(0,Di.useState)(!e.superstate.settings.inlineBacklinksExpanded),[n,i]=(0,Di.useState)([]);(0,Di.useEffect)(()=>{!e.path||i(kr([...e.superstate.linksMap.getInverse(e.path)]).map(o=>e.superstate.pathsIndex.get(o).path))},[e.path]),(0,Di.useEffect)(()=>{e.superstate.settings.inlineBacklinksExpanded=!t,e.superstate.saveSettings()},[t]);let a=()=>{r(!t)};return(0,Di.useEffect)(()=>(window.addEventListener(im.toggleBacklinks,a),()=>{window.removeEventListener(im.toggleBacklinks,a)}),[t]),n.length>0&&e.path?Di.default.createElement("div",{className:"mk-path-context-component mk-note-footer"},Di.default.createElement("div",{onClick:o=>{r(!t),o.stopPropagation()},className:"mk-path-context-title"},Di.default.createElement("div",{dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//backlink")}}),W.labels.backlinks),Di.default.createElement("div",{className:"mk-fold"},Di.default.createElement(Vd,{superstate:e.superstate,collapsed:t,onToggle:o=>a()})),Di.default.createElement("div",{className:"mk-path-backlinks"},!t&&n.map((o,s)=>Di.default.createElement(oJe,{path:o,key:s,superstate:e.superstate,source:e.path})))):Di.default.createElement(Di.default.Fragment,null)};var Bc=Ae(Te());var TEe=Ae(Qa());var Yn=Ae(Te());var x9=e=>{let{pathState:t}=(0,Yn.useContext)($r),{spaceState:r}=(0,Yn.useContext)(ur),n=t?.metadata.property?.aliases??[],[i,a]=(0,Yn.useState)(e.superstate.settings.spacesUseAlias&&n?.[0]?.length>0),o=(0,Yn.useMemo)(()=>t?i?n?.[0]:t.subtype=="tag"?hl(t?.name):t?.name:null,[t,i]);(0,Yn.useEffect)(()=>{e.superstate.settings.spacesUseAlias&&n?.[0]?.length>0?a(!0):a(!1)},[t]);let s=(0,Yn.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=lv(b);Ux(e.superstate,t.path,v).then(x=>{x&&v!=b&&nD(e.superstate,x,t.metadata?.property?.aliases,b)})}}};(0,Yn.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:W.buttons.changeIcon,icon:"ui//sticker",onClick:x=>e.superstate.ui.openPalette(Yn.default.createElement(Fa,{ui:e.superstate.ui,selectedSticker:w=>g2(e.superstate,t.path,w)}),Ne(x.view.document))}),v.push({name:W.buttons.removeIcon,icon:"ui//sticker",onClick:x=>{v2(e.superstate,t.path)}})):v.push({name:W.buttons.addIcon,icon:"ui//sticker",onClick:x=>e.superstate.ui.openPalette(Yn.default.createElement(Fa,{ui:e.superstate.ui,selectedSticker:w=>g2(e.superstate,t.path,w)}),Ne(x.view.document))}),v.push(qt),h?(v.push({name:W.buttons.changeBanner,icon:"ui//mk-make-image",onClick:x=>e.superstate.ui.openPalette(Yn.default.createElement(_f,{superstate:e.superstate,selectedPath:w=>Ky(e.superstate,t.path,w)}),Ne(x.view.document))}),v.push({name:W.labels.reposition,icon:"ui//move",onClick:x=>e.setReposition(w=>!w)}),v.push({name:W.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:W.buttons.addCover,icon:"ui//mk-make-image",onClick:x=>e.superstate.ui.openPalette(Yn.default.createElement(_f,{superstate:e.superstate,selectedPath:w=>Ky(e.superstate,t.path,w)}),Ne(x.view.document))}),v.push(qt),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,Zt(e.superstate.ui,v),Ne(A.view.document))};return t&&Yn.default.createElement(Yn.default.Fragment,null,!m&&Yn.default.createElement(sJe,{superstate:e.superstate,pathState:t,hasBanner:h,hasSticker:p}),e.superstate.settings.spacesStickers&&p&&Yn.default.createElement("div",{className:"mk-header-icon",style:h?{"--label-color":"var(--mk-ui-background)"}:{}},Yn.default.createElement(u9,{superstate:e.superstate,path:t.path})),Yn.default.createElement("div",{className:"mk-title-container"},t?.subtype=="tag"?Yn.default.createElement("div",{className:"mk-title-prefix"},"#"):"",Yn.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?W.hintText.alias:W.hintText.fileName}),m?Yn.default.createElement("div",{className:"mk-toolbar-button",dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//edit")},onClick:A=>g(A)}):Yn.default.createElement("button",{className:(0,TEe.default)("mk-title-alias",i&&"mk-active"),dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//alias")},"aria-label":W.buttons.alias,onClick:()=>a(!i)})))},sJe=e=>{let{pathState:t,hasBanner:r,hasSticker:n}=e;return Yn.default.createElement("div",{className:"mk-header-label-actions"},e.superstate.settings.spacesStickers&&!n&&Yn.default.createElement("button",{className:"mk-inline-button",onClick:i=>e.superstate.ui.openPalette(Yn.default.createElement(Fa,{ui:e.superstate.ui,selectedSticker:a=>g2(e.superstate,t.path,a)}),Ne(i.view.document))},Yn.default.createElement("div",{className:"mk-icon-xsmall",dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//smile")}}),W.buttons.addIcon),!r&&Yn.default.createElement("button",{className:"mk-inline-button",onClick:i=>e.superstate.ui.openPalette(Yn.default.createElement(_f,{superstate:e.superstate,selectedPath:a=>Ky(e.superstate,t.path,a)}),Ne(i.view.document))},Yn.default.createElement("div",{className:"mk-icon-xsmall",dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//mk-make-image")}}),W.buttons.addCover))};var zn=Ae(Te());var E2=e=>{let[t,r]=(0,zn.useState)(!1),{pathState:n}=(0,zn.useContext)($r),[i,a]=(0,zn.useState)(e.superstate.spaceManager.uriByString(n?.metadata.property?.[e.superstate.settings.fmKeyBanner])),o=n.readOnly;(0,zn.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,zn.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(zn.default.createElement(_f,{superstate:e.superstate,selectedPath:j=>Ky(e.superstate,n.path,j)}),Ne(k.view.document))},c=k=>{k.preventDefault();let j=[{name:W.buttons.changeBanner,value:"change",icon:"ui//image",onClick:O=>{u(O)}},{name:W.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},Zt(e.superstate.ui,j),Ne(k.view.document)),!1},[f,d]=(0,zn.useState)(null),p=(0,zn.useRef)(s=="center"?50:parseFloat(s)),h=(0,zn.useRef)(s=="center"?50:parseFloat(s)),m=(0,zn.useCallback)(k=>{l(k+"%"),pi(e.superstate,n.path,{[e.superstate.settings.fmKeyBannerOffset]:k.toString()})},[n]),[,g]=(0,zn.useState)([0,0]),A=.5,b=(0,zn.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,zn.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,m]),x=(0,zn.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,zn.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?zn.default.createElement(zn.default.Fragment,null,zn.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&&zn.default.createElement("div",{className:"mk-space-banner-buttons"},e.reposition?zn.default.createElement("button",{className:"mk-hover-button",onClick:()=>e.setReposition(!1)},zn.default.createElement("div",{dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//check")}}),W.labels.done):zn.default.createElement("button",{className:"mk-hover-button",onClick:()=>e.setReposition(!0)},zn.default.createElement("div",{dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//move")}}),W.labels.reposition),zn.default.createElement("button",{className:"mk-hover-button",onClick:k=>u(k)},zn.default.createElement("div",{dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//edit")}}),W.labels.changeCoverShort),zn.default.createElement("button",{className:"mk-hover-button",dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//options")},onClick:k=>c(k)})),zn.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()})):zn.default.createElement(zn.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(E2,{superstate:e.superstate,reposition:r,setReposition:n}),Bc.default.createElement(x9,{superstate:e.superstate,readOnly:!e.editable,setReposition:n})),e.editable&&e.superstate.settings.inlineContextProperties&&Bc.default.createElement(S2,{superstate:e.superstate,collapseSpaces:!0})))};var rE=Ae(Te());var Tl=Ae(Te());var _v=Ae(bi()),Ua=Ae(Te());var PEe=Ae(bi()),Nl=Ae(Te());var Tv={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"}}},Wi={def:{icon:"ui//gem"},node:{icon:"ui//gem",schemaId:"delta",parentId:"",name:"Delta",rank:0,id:"delta",styles:{},type:"delta"}};var FEe=["content","group","container","column","list","slides","slide"],w9={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"}}},S9={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"}}},E9={def:{id:"divider",icon:"ui//minus",description:W.frames.divider.description},node:{icon:"ui//minus",schemaId:"divider",parentId:"",name:W.frames.divider.label,rank:0,id:"divider",type:"group",styles:{width:"'100%'",height:"'16px'",borderBottom:"'1px solid var(--mk-ui-divider)'"}}},kpr={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(Ys,{superstate:e.superstate,path:t,readMode:!1},i?Xo.default.createElement(lh,{superstate:e.superstate},Xo.default.createElement(NEe,{superstate:e.superstate})):Xo.default.createElement(NEe,{superstate:e.superstate}))},NEe=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")}}),W.labels.properties),Xo.default.createElement(S2,{superstate:e.superstate,collapseSpaces:!1})),Xo.default.createElement(ab,{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 Di=Ae(Te());var lJe=e=>{let[t,r]=(0,Di.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,Di.useEffect)(()=>{n(e.path)},[]),(0,Di.useEffect)(()=>{n(e.path)},[e.path]);let[i,a]=(0,Di.useState)(!0);return Di.default.createElement(Di.default.Fragment,null,Di.default.createElement("div",{className:"mk-path-backlink-title"},Di.default.createElement(oo,{superstate:e.superstate,path:e.path},Di.default.createElement(Vd,{superstate:e.superstate,collapsed:i,onToggle:o=>a(o)}))),!i&&t?Di.default.createElement("div",{className:"mk-path-context-backlink"},Di.default.createElement(hv,{load:!0,forceNote:!0,superstate:e.superstate,path:e.path,properties:{from:t[0],to:t[1]},classname:"mk-path-context-flow"})):Di.default.createElement(Di.default.Fragment,null))},ab=e=>{let[t,r]=(0,Di.useState)(!e.superstate.settings.inlineBacklinksExpanded),[n,i]=(0,Di.useState)([]);(0,Di.useEffect)(()=>{!e.path||i(kr([...e.superstate.linksMap.getInverse(e.path)]).map(o=>e.superstate.pathsIndex.get(o).path))},[e.path]),(0,Di.useEffect)(()=>{e.superstate.settings.inlineBacklinksExpanded=!t,e.superstate.saveSettings()},[t]);let a=()=>{r(!t)};return(0,Di.useEffect)(()=>(window.addEventListener(im.toggleBacklinks,a),()=>{window.removeEventListener(im.toggleBacklinks,a)}),[t]),n.length>0&&e.path?Di.default.createElement("div",{className:"mk-path-context-component mk-note-footer"},Di.default.createElement("div",{onClick:o=>{r(!t),o.stopPropagation()},className:"mk-path-context-title"},Di.default.createElement("div",{dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//backlink")}}),W.labels.backlinks),Di.default.createElement("div",{className:"mk-fold"},Di.default.createElement(Vd,{superstate:e.superstate,collapsed:t,onToggle:o=>a()})),Di.default.createElement("div",{className:"mk-path-backlinks"},!t&&n.map((o,s)=>Di.default.createElement(lJe,{path:o,key:s,superstate:e.superstate,source:e.path})))):Di.default.createElement(Di.default.Fragment,null)};var Bc=Ae(Te());var TEe=Ae(Qa());var Yn=Ae(Te());var x9=e=>{let{pathState:t}=(0,Yn.useContext)($r),{spaceState:r}=(0,Yn.useContext)(ur),n=t?.metadata.property?.aliases??[],[i,a]=(0,Yn.useState)(e.superstate.settings.spacesUseAlias&&n?.[0]?.length>0),o=(0,Yn.useMemo)(()=>t?i?n?.[0]:t.subtype=="tag"?hl(t?.name):t?.name:null,[t,i]);(0,Yn.useEffect)(()=>{e.superstate.settings.spacesUseAlias&&n?.[0]?.length>0?a(!0):a(!1)},[t]);let s=(0,Yn.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=lv(b);Ux(e.superstate,t.path,v).then(x=>{x&&v!=b&&nD(e.superstate,x,t.metadata?.property?.aliases,b)})}}};(0,Yn.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:W.buttons.changeIcon,icon:"ui//sticker",onClick:x=>e.superstate.ui.openPalette(Yn.default.createElement(Fa,{ui:e.superstate.ui,selectedSticker:w=>g2(e.superstate,t.path,w)}),Ne(x.view.document))}),v.push({name:W.buttons.removeIcon,icon:"ui//sticker",onClick:x=>{v2(e.superstate,t.path)}})):v.push({name:W.buttons.addIcon,icon:"ui//sticker",onClick:x=>e.superstate.ui.openPalette(Yn.default.createElement(Fa,{ui:e.superstate.ui,selectedSticker:w=>g2(e.superstate,t.path,w)}),Ne(x.view.document))}),v.push(qt),h?(v.push({name:W.buttons.changeBanner,icon:"ui//mk-make-image",onClick:x=>e.superstate.ui.openPalette(Yn.default.createElement(_f,{superstate:e.superstate,selectedPath:w=>Ky(e.superstate,t.path,w)}),Ne(x.view.document))}),v.push({name:W.labels.reposition,icon:"ui//move",onClick:x=>e.setReposition(w=>!w)}),v.push({name:W.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:W.buttons.addCover,icon:"ui//mk-make-image",onClick:x=>e.superstate.ui.openPalette(Yn.default.createElement(_f,{superstate:e.superstate,selectedPath:w=>Ky(e.superstate,t.path,w)}),Ne(x.view.document))}),v.push(qt),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,Zt(e.superstate.ui,v),Ne(A.view.document))};return t&&Yn.default.createElement(Yn.default.Fragment,null,!m&&Yn.default.createElement(uJe,{superstate:e.superstate,pathState:t,hasBanner:h,hasSticker:p}),e.superstate.settings.spacesStickers&&p&&Yn.default.createElement("div",{className:"mk-header-icon",style:h?{"--label-color":"var(--mk-ui-background)"}:{}},Yn.default.createElement(u9,{superstate:e.superstate,path:t.path})),Yn.default.createElement("div",{className:"mk-title-container"},t?.subtype=="tag"?Yn.default.createElement("div",{className:"mk-title-prefix"},"#"):"",Yn.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?W.hintText.alias:W.hintText.fileName}),m?Yn.default.createElement("div",{className:"mk-toolbar-button",dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//edit")},onClick:A=>g(A)}):Yn.default.createElement("button",{className:(0,TEe.default)("mk-title-alias",i&&"mk-active"),dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//alias")},"aria-label":W.buttons.alias,onClick:()=>a(!i)})))},uJe=e=>{let{pathState:t,hasBanner:r,hasSticker:n}=e;return Yn.default.createElement("div",{className:"mk-header-label-actions"},e.superstate.settings.spacesStickers&&!n&&Yn.default.createElement("button",{className:"mk-inline-button",onClick:i=>e.superstate.ui.openPalette(Yn.default.createElement(Fa,{ui:e.superstate.ui,selectedSticker:a=>g2(e.superstate,t.path,a)}),Ne(i.view.document))},Yn.default.createElement("div",{className:"mk-icon-xsmall",dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//smile")}}),W.buttons.addIcon),!r&&Yn.default.createElement("button",{className:"mk-inline-button",onClick:i=>e.superstate.ui.openPalette(Yn.default.createElement(_f,{superstate:e.superstate,selectedPath:a=>Ky(e.superstate,t.path,a)}),Ne(i.view.document))},Yn.default.createElement("div",{className:"mk-icon-xsmall",dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//mk-make-image")}}),W.buttons.addCover))};var zn=Ae(Te());var E2=e=>{let[t,r]=(0,zn.useState)(!1),{pathState:n}=(0,zn.useContext)($r),[i,a]=(0,zn.useState)(e.superstate.spaceManager.uriByString(n?.metadata.property?.[e.superstate.settings.fmKeyBanner])),o=n.readOnly;(0,zn.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,zn.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(zn.default.createElement(_f,{superstate:e.superstate,selectedPath:j=>Ky(e.superstate,n.path,j)}),Ne(k.view.document))},c=k=>{k.preventDefault();let j=[{name:W.buttons.changeBanner,value:"change",icon:"ui//image",onClick:O=>{u(O)}},{name:W.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},Zt(e.superstate.ui,j),Ne(k.view.document)),!1},[f,d]=(0,zn.useState)(null),p=(0,zn.useRef)(s=="center"?50:parseFloat(s)),h=(0,zn.useRef)(s=="center"?50:parseFloat(s)),m=(0,zn.useCallback)(k=>{l(k+"%"),pi(e.superstate,n.path,{[e.superstate.settings.fmKeyBannerOffset]:k.toString()})},[n]),[,g]=(0,zn.useState)([0,0]),A=.5,b=(0,zn.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,zn.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,m]),x=(0,zn.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,zn.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?zn.default.createElement(zn.default.Fragment,null,zn.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&&zn.default.createElement("div",{className:"mk-space-banner-buttons"},e.reposition?zn.default.createElement("button",{className:"mk-hover-button",onClick:()=>e.setReposition(!1)},zn.default.createElement("div",{dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//check")}}),W.labels.done):zn.default.createElement("button",{className:"mk-hover-button",onClick:()=>e.setReposition(!0)},zn.default.createElement("div",{dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//move")}}),W.labels.reposition),zn.default.createElement("button",{className:"mk-hover-button",onClick:k=>u(k)},zn.default.createElement("div",{dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//edit")}}),W.labels.changeCoverShort),zn.default.createElement("button",{className:"mk-hover-button",dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//options")},onClick:k=>c(k)})),zn.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()})):zn.default.createElement(zn.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(E2,{superstate:e.superstate,reposition:r,setReposition:n}),Bc.default.createElement(x9,{superstate:e.superstate,readOnly:!e.editable,setReposition:n})),e.editable&&e.superstate.settings.inlineContextProperties&&Bc.default.createElement(S2,{superstate:e.superstate,collapseSpaces:!0})))};var rE=Ae(Te());var Tl=Ae(Te());var _v=Ae(bi()),Ua=Ae(Te());var PEe=Ae(bi()),Nl=Ae(Te());var Tv={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"}}},Wi={def:{icon:"ui//gem"},node:{icon:"ui//gem",schemaId:"delta",parentId:"",name:"Delta",rank:0,id:"delta",styles:{},type:"delta"}};var FEe=["content","group","container","column","list","slides","slide"],w9={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"}}},S9={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"}}},E9={def:{id:"divider",icon:"ui//minus",description:W.frames.divider.description},node:{icon:"ui//minus",schemaId:"divider",parentId:"",name:W.frames.divider.label,rank:0,id:"divider",type:"group",styles:{width:"'100%'",height:"'16px'",borderBottom:"'1px solid var(--mk-ui-divider)'"}}},Dpr={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)"}}}]},Fv={id:"button",def:{id:"button",icon:"ui//mouse-pointer-click",description:W.frames.button.description},node:{icon:"ui//mouse-pointer-click",schemaId:"button",parentId:"",name:W.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:W.properties.super.whenClicked,icon:"ui//mouse-pointer-click"}),actionValue:JSON.stringify({name:W.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:[{...Za,node:{...Za.node,props:{value:"button.props.icon"},styles:{"--icon-size":'button.props.iconSize+"px"'}}},{...mn,node:{...mn.node,props:{value:"button.props.label"}}}]},k9={id:"tabs",def:{id:"tabs",icon:"ui//tabs"},node:{icon:"ui//tabs",schemaId:"tabs",parentId:"",name:W.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({...w9,children:[ct({...S9,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"},{})]},wh={id:"field",def:{id:"field",description:W.frames.field.description},node:{schemaId:"field",parentId:"",name:W.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(Za,{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(Za,{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({...w9,children:[ct({...S9,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(Za,{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'"})]},C9={id:"rating",def:{id:"rating",icon:"ui//star"},node:{icon:"ui//star",schemaId:"rating",parentId:"",name:W.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(Za,{value:"$root.props.icon"},{width:"$root.styles.height",height:"$root.styles.height",hidden:"$root.props.value < 1"}),ct(Za,{value:"$root.props.icon"},{width:"$root.styles.height",height:"$root.styles.height",hidden:"$root.props.value < 2"}),ct(Za,{value:"$root.props.icon"},{width:"$root.styles.height",height:"$root.styles.height",hidden:"$root.props.value < 3"}),ct(Za,{value:"$root.props.icon"},{width:"$root.styles.height",height:"$root.styles.height",hidden:"$root.props.value < 4"}),ct(Za,{value:"$root.props.icon"},{width:"$root.styles.height",height:"$root.styles.height",hidden:"$root.props.value < 5"})]},D9={id:"callout",def:{id:"callout",icon:"ui//callout"},node:{icon:"ui//callout",schemaId:"callout",parentId:"",name:W.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(Za,{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'"})]},O9={id:"toggle",def:{id:"toggle",icon:"ui//collapse-solid",description:W.frames.toggle.description},node:{icon:"ui//collapse-solid",schemaId:"toggle",parentId:"",name:W.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({...Tv,children:[ct({...Rc,children:[ct({...Wi,node:{...Wi.node,ref:"icon"}},{},{transform:"'rotate(90deg)'"})]},{value:"true"}),ct({...Rc,children:[ct({...Wi,node:{...Wi.node,ref:"icon"}},{},{transform:"'rotate(0deg)'"})]},{value:"false"})]},{value:"'value'"}),ct({...hn,children:[{...Za,node:{...Za.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"})]},M9={id:"progress",def:{id:"progress",icon:"ui//pie-chart"},node:{icon:"ui//pie-chart",schemaId:"progress",parentId:"",name:W.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'"}}}]},j9={id:"circularProgress",def:{id:"circularProgress",icon:"ui//pie-chart"},node:{icon:"ui//pie-chart",schemaId:"circularProgress",parentId:"",name:W.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%'"})]},Cpr={id:"card",def:{id:"card",icon:"ui//mouse-pointer-click"},node:{icon:"ui//mouse-pointer-click",schemaId:"card",parentId:"",name:W.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:[{...Za,node:{...Za.node,props:{value:"card.props.icon"}}},{...mn,node:{...mn.node,props:{value:"card.props.label"}}}]},_Ee={id:"link",def:{id:"link",icon:"ui//link"},node:{icon:"ui//link",schemaId:"link",parentId:"",name:W.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:[{...Za,node:{...Za.node,props:{value:"link.props.sticker"},styles:{width:"'18px'",height:"'18px'"}}},{...mn,node:{...mn.node,props:{value:"link.props.label"}}}]};var Hi=(0,Nl.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}),IEe=e=>{let{spaceInfo:t}=(0,Nl.useContext)(ur),[r,n]=(0,Nl.useState)(null),[i,a]=(0,Nl.useState)(null),{frameSchema:o,saveFrame:s,frameSchemas:l,tableData:u,getMDBData:c}=(0,Nl.useContext)(Aa),f=(0,Nl.useMemo)(()=>{if(!o)return[];let D=u?.rows.map(q=>q.id==o.id?{...V1(q),types:u.cols.reduce((z,I)=>({...z,[I.name]:I.type}),{}),propsValue:u.cols.reduce((z,I)=>({...z,[I.name]:I.value}),{})}:V1(q))??[],P=oL(o);return D.some(q=>q.id==P.id)?D:[...D,P]},[u,o]),[d,p]=(0,Nl.useState)(null),h=(0,Nl.useMemo)(()=>{let D=[...m0(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 sL(o,[...u?.cols??[],...(e.cols??[]).map(P=>({...P,schemaId:o.id}))],f,e.superstate,{editMode:e.editMode,screenType:e.superstate.ui.getScreenType()});nj(D,d)&&p(D)}},g=D=>{D.path==t.path&&(!D.schemaId||D.schemaId==o?.id)&&m()};(0,Nl.useEffect)(()=>(e.superstate.eventsDispatcher.addListener("frameStateUpdated",g),()=>{e.superstate.eventsDispatcher.removeListener("frameStateUpdated",g)}),[t]),(0,Nl.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({...Wi.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=Hs(q,z,P).map((L,_)=>({...L,rank:_}));j(T)},S=(D,P)=>{let q=D[0].id==o.id?"":D[0].parentId,z={...W1(hn,q,f,o.id)},I=D.map(T=>{let L=PEe.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=ji(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||!FEe.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=>V1(Q)),L=l.find(Q=>Q.id==P),_=T.find(Q=>Q.id==D);if(!L||!_)return;let Y=await Ck(_,T,e.superstate,0,!1,{editMode:e.editMode}).then(Q=>Q[0]),oe=G1(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 Ck(D,f,e.superstate,0,!1,{editMode:e.editMode},!0).then(T=>T[0]),q=pc(d,D.id),z=[],I=G1(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 Nl.default.createElement(Hi.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 ob=Ae(Te());var FY=ob.default.createContext({root:null,path:null}),N9=e=>{let[t,r]=(0,ob.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=>tj(e.superstate,a,{...d0,screenType:e.superstate.ui.getScreenType()})).then(a=>r(a))}};return(0,ob.useEffect)(()=>(e.superstate.eventsDispatcher.addListener("frameStateUpdated",n),n({path:e.path.basePath}),()=>{e.superstate.eventsDispatcher.removeListener("frameStateUpdated",n)}),[e.path]),ob.default.createElement(FY.Provider,{value:{root:t,path:e.path.fullPath}},e.children)};var Ii=(0,Ua.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,Ua.useState)(null),[n,i]=(0,Ua.useState)({state:{},id:null,root:null,exec:null,slides:{},contexts:{}}),[a,o]=(0,Ua.useState)(e.props);(0,Ua.useEffect)(()=>{o(x=>_v.default.isEqual(x,e.props)?x:e.props)},[e.props]);let{selectedSlide:s}=(0,Ua.useContext)(Hi),l=e.editable?s:null,{root:u}=(0,Ua.useContext)(Hi),{root:c,path:f}=(0,Ua.useContext)(FY),d=(0,Ua.useMemo)(()=>e.editable?u:c,[e.editable,u,c]),p=(0,Ua.useRef)(null),h=(0,Ua.useRef)(null),m=(0,Ua.useMemo)(()=>Object.keys(e.propSetters||{}),[e.propSetters]),g=(x,w)=>{let{root:S,exec:k,id:j,state:O}=w;if(_te(x,"$root",k.id),p.current!=j)return;let{$api:C,...N}=O;ZB(k,{state:O,newState:aL(x,a,k.id),prevState:_v.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,Ua.useEffect)(()=>{n?.root&&e.propSetters&&rre(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,Ua.useRef)({}),b=x=>{i(w=>({...w,state:x}))};(0,Ua.useEffect)(()=>()=>{p.current=null},[]);let v=()=>{if(d){let x=_v.default.cloneDeep(d),w=(0,_v.uniqueId)();p.current=w,ZB(x,{prevState:{},state:{},newState:aL({},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,Ua.useEffect)(()=>{n.root&&!nj(d,n.root)&&(0,_v.isEqual)(e.contexts,n.contexts)?g({[n.root.id]:{props:a}},n):v()},[a,d,e.contexts]),Ua.default.createElement(Ii.Provider,{value:{id:e.id,linkedProps:m,hoverNode:t,setHoverNode:r,selectableNodeBounds:A,runRoot:v,instance:n,saveState:g,fastSaveState:b}},e.children)};var Vi=(0,Tl.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:""}),Pv=e=>{let{selection:t,selectionMode:r,setIsParentToSelection:n}=(0,Tl.useContext)(Vi),{spaceState:i}=(0,Tl.useContext)(ur),a=(0,Tl.useMemo)(()=>t.includes(e.id)||e.selected,[t,e.id,e.selected]),o=(0,Tl.useMemo)(()=>i?.metadata.readMode?0:e.editMode??0,[e.editMode,i]),{instance:s}=(0,Tl.useContext)(Ii),[l,u]=(0,Tl.useState)([]),[c,f]=(0,Tl.useState)(!1),d=(0,Tl.useMemo)(()=>!!(l.length>0||c||a&&o>=3||o==1),[a,o,l,c]);(0,Tl.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 Tl.default.createElement(Vi.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 Z6e=Ae(bi());var ra=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{let t=_r(e.superstate,e.date,e.mode=="day"?"MMMM d":"MMMM");return Iv.default.createElement("div",{className:"mk-calendar-header"},Iv.default.createElement("div",{className:"mk-calendar-header-title"},Iv.default.createElement("span",null,t),_r(e.superstate,e.date,"yyyy")),Iv.default.createElement("span",null),Iv.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)))}}),Iv.default.createElement("button",{onClick:()=>{e.setDate(new Date)}},"Today"),Iv.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 _Y=Ae(Te());var T9=e=>{let{attributes:t,listeners:r,setNodeRef:n,transform:i}=Ws({id:"event-"+e.index,data:{type:"event",index:e.index}});return _Y.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`}},_Y.default.createElement(oo,{superstate:e.superstate,path:e.data[mt]}))};var hD=Ae(Te()),F9=e=>hD.default.createElement("div",{className:"mk-day-view-gutter"},e.allDay&&hD.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 hD.default.createElement("div",{key:n,className:"mk-day-view-hour-title"},hD.default.createElement("span",null,n%12===0?12:n%12)," ",n<12?"AM":"PM")}));var So=Ae(Te());var Yu=Ae(Te()),rl=e=>{let[t,r]=(0,Yu.useState)(null),n=(0,Yu.useRef)(e.value),i=(0,Yu.useRef)(e.value),[,a]=(0,Yu.useState)([0,0]),o=e.step??1,s=(0,Yu.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,Yu.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,Yu.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,Yu.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)}),[]),Yu.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"}},Yu.default.createElement("span",null))};var AD=e=>{let{event:t,hourHeight:r,startHour:n}=e,{spaceState:i}=(0,So.useContext)(ur),{attributes:a,listeners:o,setNodeRef:s,transform:l}=Ws({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??XE(Vn(new Date),e.event.startOffset),m=t.end??XE(Vn(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(rl,{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(rl,{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 _9=e=>{let{hourHeight:t}=e,[r,n]=(0,$c.useState)(e.date??Vn(new Date)),{source:i}=(0,$c.useContext)(Ta),[a,o]=(0,$c.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=ir(L[z]),oe=[],te=Zi(L[P]);if(te>=D&&te<=Ea(D,{days:1})&&oe.push(L),Y&&Y.freq){let Q=Zi(L[q]).getTime()-te.getTime(),fe={dtstart:te,freq:Y.freq&&LM(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((Zi(Y.until)??Ea(D,{days:1})).getTime(),Ea(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,Ea(D,{days:1}),!0).forEach(Oe=>{Oe.getTime()!=te.getTime()&&oe.push({...L,[P]:_r(e.superstate,Oe,qs),[q]:_r(e.superstate,ad(Oe,Q),qs)})})}oe.forEach(Q=>{let fe=Vn(r).getTime(),Ie=Ea(r,{days:1}).getTime(),Se=Zi(Q[P]),Oe=Zi(Q[q])?Zi(Q[q]):Vn(Se).getTime()==Se.getTime()?Se:Ea(Se,{hours:1}),ve=Math.max(l*60,(Se.getTime()-fe)/6e4),ye=Math.min(Oe.getTime()-fe,Ie-fe)/6e4;if(Se.getTime()==Vn(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,$c.useState)(null),[h,m]=(0,$c.useState)(null),[g,A]=(0,$c.useState)(null),[b,v]=(0,$c.useState)(null),x=()=>{p(null),m(null),A(null),v(null)},w=N=>Math.round(N/15)*15;Da({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=Ea(r,{minutes:Math.round(w(P.startOffset+g/t*60))}),z=Ea(r,{minutes:Math.round(w(P.endOffset+g/t*60))});e.updateItem({...e.data[D],[e.field]:_r(e.superstate,q,qs),[e.fieldEnd]:_r(e.superstate,z,qs)})}else if(h){let D=Ea(r,{minutes:Math.round(g/t*60)}),P=Ea(r,{minutes:Math.round(g/t*60)+60});e.insertItem({[e.field]:_r(e.superstate,D,qs),[e.fieldEnd]:_r(e.superstate,P,qs),[mt]:h})}x()}});let{setNodeRef:S}=Lu({id:s,data:{type:"day-view",date:r}}),k=new Date().toDateString()===r.toDateString(),[j,O]=(0,$c.useState)(0),C=f.find(N=>N.index==d);return(0,$c.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)}},[]),Fl.default.createElement("div",{className:"mk-day-view-container",style:{"--hour-height":`${t}px`}},e.header&&Fl.default.createElement(k2,{superstate:e.superstate,date:r,mode:"day",setDate:n}),e.gutter&&Fl.default.createElement("div",{className:"mk-day-view-all-day"},Fl.default.createElement("div",{className:"mk-day-view-gutter"},Fl.default.createElement("div",{className:"mk-day-view-hour-title"},"all day")),Fl.default.createElement("div",{className:"mk-day-view-hour"},f.filter(N=>N.allDay).map((N,D)=>Fl.default.createElement(T9,{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"}})))),Fl.default.createElement("div",{className:"mk-day-view"},e.gutter&&Fl.default.createElement(F9,{hourHeight:t,startHour:l,endHour:c}),Fl.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=Ea(r,{minutes:a.startOffset}),P=Ea(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,qs),[e.fieldEnd]:_r(e.superstate,P,qs),[mt]:z})},i),o(null)}},Array.from({length:c-l}).map((N,D)=>Fl.default.createElement("div",{key:D,className:"mk-day-view-hour"})),k&&j>0&&Fl.default.createElement("div",{className:"mk-day-view-hour-current",style:{top:`${j*t/60}px`}}),f.filter(N=>!N.allDay).map((N,D)=>Fl.default.createElement(AD,{superstate:e.superstate,key:D,event:N,item:e.data[N.index],hourHeight:t,startHour:l,updateStartEnd:(P,q)=>{let z=Ea(r,{minutes:P}),I=Ea(r,{minutes:q});e.updateItem({...e.data[N.index],[e.field]:_r(e.superstate,z,qs),[e.fieldEnd]:_r(e.superstate,I,qs)})}})),a&&a.endOffset>a.startOffset&&Fl.default.createElement(AD,{superstate:e.superstate,event:a,item:{},hourHeight:t,startHour:l,clone:!0}),d!==null&&C?Fl.default.createElement(AD,{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?Fl.default.createElement(AD,{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 _l=Ae(Te());var Pf=Ae(Te()),REe=Ae(bl());var PY=Ae(Te()),BEe=e=>{let{attributes:t,listeners:r,setNodeRef:n,transform:i}=Ws({id:"day-"+e.date.getTime(),data:{type:"day",date:e.date.getTime()}}),{setNodeRef:a}=Lu({id:"day-"+e.date.getTime(),data:{type:"day",weekStart:e.weekStart.getTime(),date:e.date.getTime()}}),o=e.date.toDateString()===new Date().toDateString(),s=J5(a,n);return PY.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"}},PY.default.createElement("div",{className:"mk-month-day-number"},e.date.getDate()),e.children)};var sb=Ae(Te());var IY=e=>{let{attributes:t,listeners:r,setNodeRef:n,transform:i}=Ws({id:"event-"+e.index,data:{type:"event",index:e.index}}),a=(0,sb.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 sb.default.createElement("div",{className:"mk-month-event",ref:n,style:e.style,...t,...r},!e.allDay&&sb.default.createElement("div",{className:"mk-day-block-inner-indicator"}),sb.default.createElement(oo,{superstate:e.superstate,path:e.data[mt],hideIcon:!0}),sb.default.createElement("div",{className:"mk-day-block-time"},a))};var $Ee=e=>{let t=mo(e.date),r=gA(t),{source:n}=(0,Pf.useContext)(Ta),i=(0,Pf.useMemo)(()=>{let u=[];return e.events.forEach((c,f)=>{let d=[],p=ir(c[e.fieldRepeat]),h=Zi(c[e.field]),m=Zi(c[e.fieldEnd])??h;if(h<=Mx(r)&&m>=Vn(t)&&d.push(c),p&&p.freq){let g=Zi(c[e.fieldEnd]).getTime()-h.getTime(),A={dtstart:h,freq:p.freq&&LM(p.freq),count:p.count&&Math.min(p.count,100),interval:parseInt(p.interval),byweekday:p.byweekday&&p.byweekday.map(x=>Xx(x)),until:Zi(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(Vn(t),Mx(r),!0).forEach(x=>{x.getTime()!=h.getTime()&&d.push({...c,[e.field]:_r(e.superstate,x,qs),[e.fieldEnd]:_r(e.superstate,ad(x,g),qs)})})}d.forEach(g=>{let A=Zi(g[e.field]),b=Zi(g[e.fieldEnd]),v=b||(Vn(A).getTime()==A.getTime()?Vn(A):Ox(A,1)),x=A>t?A:t,w=vc.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,Pf.useState)(null),[s,l]=(0,Pf.useState)(null);return Da({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)}}),Pf.default.createElement("div",{className:"mk-month-week"},Array.from({length:7}).map((u,c)=>{let f=Ea(t,{days:c}),d=f.getMonth()===e.date.getMonth();return Pf.default.createElement(BEe,{key:c,superstate:e.superstate,weekStart:t,active:d,date:f,insertItem:p=>{let h=i.reduce((v,x)=>{let w=Zi(e.events[x.index])?.getHours();return w>v?w:v},9),m=_r(e.superstate,Ox(Vn(f),h),qs),g=_r(e.superstate,Ox(Vn(f),h+1),qs),A=i.reduce((v,x)=>x.endDay>=c?v+1:v,0);o({offset:A,index:-1,startDay:c,endDay:c,startTime:Vn(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&&Pf.default.createElement(IY,{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 Pf.default.createElement(IY,{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,REe.createPortal)(Pf.default.createElement(Um,{dropAnimation:UU}),document.body))};var qEe=e=>{let[t,r]=(0,_l.useState)(e.date??new Date),n=(0,_l.useMemo)(()=>{let o=Wo(t),s=t0(t),l=[],u=o;for(;u<=s;)l.push(u),u=Jg(u,1);return l},[t]),[i,a]=(0,_l.useState)(null);return Da({onDragStart:o=>{a(o.active.id)},onDragEnd:o=>{a(null)}}),_l.default.createElement("div",{className:"mk-month-grid"},e.header&&_l.default.createElement(k2,{superstate:e.superstate,date:t,setDate:r,mode:"month"}),_l.default.createElement("div",{className:"mk-month-header"},_l.default.createElement("div",null,"S"),_l.default.createElement("div",null,"M"),_l.default.createElement("div",null,"T"),_l.default.createElement("div",null,"W"),_l.default.createElement("div",null,"T"),_l.default.createElement("div",null,"F"),_l.default.createElement("div",null,"S")),n.map((o,s)=>_l.default.createElement($Ee,{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 Es=Ae(Te());var P9=Ae(Te());var LEe=e=>{let{source:t}=(0,P9.useContext)(Ta),{setNodeRef:r}=Lu({id:"allday-"+e.date.toISOString()});return P9.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 zEe=e=>{let t=e.hourHeight,[r,n]=(0,Es.useState)(e.weekStart??mo(new Date)),i=e.startHour??0,a=e.endHour??24,[o,s]=(0,Es.useState)(0),l=(0,Es.useMemo)(()=>{let u=[];e.data.forEach((f,d)=>{let p=Zi(f[e.field]),h=Zi(f[e.fieldEnd])??p;h>=r&&p<=Ea(r,{days:7})&&Vn(p).getTime()==p.getTime()&&Vn(h).getTime()==h.getTime()&&u.push({index:d,startDay:new Date(Math.max(r.getTime(),p.getTime())).getDay(),endDay:new Date(Math.min(Ea(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 Es.default.createElement("div",{className:"mk-week-view",style:{"--hour-height":`${t}px`}},e.header&&Es.default.createElement(k2,{superstate:e.superstate,date:r,mode:"week",setDate:n}),Es.default.createElement("div",{className:"mk-week-view-header"},Es.default.createElement("div",{className:"mk-day-view-gutter"}),Array.from({length:7}).map((u,c)=>Es.default.createElement("div",{key:c},_r(e.superstate,Ea(r,{days:c}),"EEE d")))),Es.default.createElement("div",{className:"mk-week-view-all-day"},Es.default.createElement("div",{className:"mk-day-view-gutter"},Es.default.createElement("div",{className:"mk-day-view-hour-title",style:{height:`${o*30}px`}},"all day")),Array.from({length:7}).map((u,c)=>Es.default.createElement(LEe,{key:c,height:o+1,superstate:e.superstate,date:la(r,c),insertItem:f=>{e.insertItem({[e.field]:_r(e.superstate,la(r,c),"yyyy-MM-dd"),[e.fieldEnd]:_r(e.superstate,la(r,c),"yyyy-MM-dd"),[mt]:f})}},l.filter(f=>f.startDay==c).map((f,d)=>Es.default.createElement(T9,{superstate:e.superstate,data:e.data[f.index],index:f.index,startDay:f.startDay,endDay:f.endDay,topOffset:f.topOffset,key:d}))))),Es.default.createElement("div",{className:"mk-week-view-content"},Es.default.createElement(F9,{hourHeight:t,startHour:i,endHour:a}),Array.from({length:7}).map((u,c)=>Es.default.createElement(_9,{superstate:e.superstate,key:_r(e.superstate,Ea(r,{days:c})),field:e.field,fieldEnd:e.fieldEnd,fieldRepeat:e.fieldRepeat,date:Ea(r,{days:c}),data:e.data,hourHeight:t,startHour:i,endHour:a,insertItem:f=>{e.insertItem(f)},updateItem:f=>{e.updateItem(f)}}))))};var G6e=Ae(bi()),$o=Ae(Te());var lJe=e=>e.node.type=="column"&&e.children.length==1,uJe=e=>e.node.type=="container"&&e.children.length==1,cJe=e=>e.node.type=="container"&&e.children.length==2,gD=(e,t,r,n,i)=>{let a=e;if(a.schemaId!=r.id){a=sf("$root",r.id,a,r.id);let d=ji(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={...W1(ire,u.id,n,l),rank:t.node.rank},v={...W1(ij,b.id,[...n,b],l),rank:i=="left"?1:0},x={...W1(ij,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={...W1(ij,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&&lJe(c)){let d=pc(r,c.id);if(s.push(c.node),uJe(d))s.push(d.node);else if(cJe(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 Rl=Ae(Te());var FZ=Ae(Qa());var C2=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 zt=Ae(Te()),V6e=Ae(bl());var Gd=Ae(Te());var UEe=e=>{let{groupNodes:t,saveNodes:r,nodes:n}=(0,Gd.useContext)(Hi),{selection:i,select:a}=(0,Gd.useContext)(Vi),o=i.map(s=>n.find(l=>l.id==s)).filter(s=>s);return Gd.default.createElement("div",{className:"mk-editor-frame-node-selector",style:{pointerEvents:"auto"},onClick:s=>s.stopPropagation()},Gd.default.createElement("div",{className:"mk-editor-frame-node-button"},Gd.default.createElement("div",{dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//copy-check")}}),W.labels.itemsSelected.replace("${1}",i.length.toString())),Gd.default.createElement("div",{className:"mk-divider"}),Gd.default.createElement("div",{"aria-label":W.editor.createVerticalSection,className:"mk-editor-frame-node-button",dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//rows")},onClick:()=>t(o,{layoutAlign:'"left"',gap:'"8px"'})}),Gd.default.createElement("div",{"aria-label":W.editor.createHorizontalSection,className:"mk-editor-frame-node-button ",dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//columns")},onClick:()=>t(o,{layout:'"row"',gap:'"8px"'})}),Gd.default.createElement("div",{className:"mk-divider"}),Gd.default.createElement("div",{className:"mk-editor-frame-node-button ","aria-label":W.menu.delete,onClick:()=>r([],o),dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//trash")}}))};var or=Ae(Te());var I9={table:{name:W.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:W.menu.listView,icon:"ui//list",view:"list",listView:"spaces://$kit/#*listView",listGroup:"spaces://$kit/#*listGroup",listItem:"spaces://$kit/#*rowItem"},details:{name:W.menu.detailsView,icon:"ui//layout-grid",view:"list",listView:"spaces://$kit/#*listView",listGroup:"spaces://$kit/#*listGroup",listItem:"spaces://$kit/#*detailItem"},board:{name:W.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:W.menu.cardView,icon:"ui//layout-dashboard",view:"list",listView:"spaces://$kit/#*listView",listGroup:"spaces://$kit/#*gridGroup",listItem:"spaces://$kit/#*cardsListItem"},catalog:{name:W.menu.catalogView,icon:"ui//gallery-horizontal-end",view:"list",listView:"spaces://$kit/#*listView",listGroup:"spaces://$kit/#*rowGroup",listItem:"spaces://$kit/#*coverListItem"},gallery:{name:W.menu.galleryView,icon:"ui//layout-dashboard",view:"list",listView:"spaces://$kit/#*listView",listGroup:"spaces://$kit/#*masonryGroup",listItem:"spaces://$kit/#*imageListItem"},flow:{name:W.menu.flowView,icon:"ui//edit",view:"list",listView:"spaces://$kit/#*listView",listGroup:"spaces://$kit/#*listGroup",listItem:"spaces://$kit/#*flowListItem"}};var fJe=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"}},vD=async(e,t,r)=>{let n=r=="board"?"Board":"Table",i=await e.spaceManager.tablesForSpace(t);return i&&(n=ji(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:ji(n,s?.map(u=>u.id)??[]),name:n,type:"view",predicate:JSON.stringify({...Vy,...r?fJe(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 D2=(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 vD(r,n.path);i({...p0.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:W.commands.newNote,value:"presetnote",onClick:()=>{o("note")},icon:"ui//mk-make-flow"},{name:W.commands.internalLink,value:"presetlink",onClick:()=>{o("link")},icon:"ui//mk-make-link"},{name:W.commands.table,value:"presettable",onClick:()=>{o("table")},icon:"ui//mk-make-table"}],c=async m=>{let g=await r.spaceManager.framesForSpace(n.path),A=ji(m,g.map(x=>x.id)),b=I9[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,()=>wp(v)).then(()=>i({...p0.node,props:{value:jr(`./#*${v.id}`)}}))},f=Object.keys(I9).map(m=>{let g=I9[m];return{name:g.name,value:g.view,onClick:()=>{c(m)},icon:g.icon}}),d=[mn,uf,E9,Za,hn],p=[Fv,C9,O9,D9,M9,j9,k9],h=[...u,{name:"List View",value:"frame",type:6,onSubmenu:m=>r.ui.openMenu(m,Zt(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 WEe=Ae(Te());var B9=e=>{let t=(r,n)=>{let i=o=>{e.setValue(o)},a=r.target.getBoundingClientRect();Vu(e.superstate,a,Ne(r.view.document),e.value,i)};return WEe.default.createElement("div",{className:"mk-color",style:{background:e.value},onClick:r=>{t(r,"--text-normal")}})};var Bo=Ae(Te());var HEe=Ae(bi()),so=Ae(Te());function dJe(e){if(Math.floor(e)===e)return 0;let t=e.toString();return t.split(".")[1].length||t.split(",")[1].length||0}function VEe({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,HEe.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=dJe(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 ba=e=>{let t=e.value&&_u(e.value)?Sa(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,Zt(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(VEe,{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 yD=Ae(Te()),GEe=e=>{let t=["nw","n","ne","w","m","e","sw","s","se"],[r,n]=(0,yD.useState)(e.state?.styles?.layoutAlign);return yD.default.createElement("div",{className:"mk-editor-alignment-menu"},t.map(i=>yD.default.createElement("div",{className:`mk-editor-alignment-selector ${r==i&&"mk-active"}`,key:"d",onClick:()=>{n(i),e.saveStyleValue("layoutAlign",jr(i))}})))};var QEe=e=>{let{spaceInfo:t}=(0,Bo.useContext)(ur),{addNode:r}=(0,Bo.useContext)(Hi),{select:n}=(0,Bo.useContext)(Vi),{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=>{D2(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:W.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:W.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:W.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(GEe,{...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",`${Sa(i.styles.flexWrap)=="wrap"?"":jr("wrap")}`)},dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//wrap-text")}}),Bo.default.createElement(ba,{superstate:e.superstate,name:W.editor.gap,value:i.styles?.gap,setValue:o=>a("gap",o),units:["px"]})):Bo.default.createElement(Bo.default.Fragment,null,Bo.default.createElement(ba,{superstate:e.superstate,name:W.editor.columns,value:i.styles?.columnCount,min:0,setValue:o=>a("columnCount",o),units:[""]})))};var fb=Ae(Te());var lb=Ae(Te());var YEe=e=>{let{selectedNode:t,saveStyleValue:r}=e;return lb.default.createElement(lb.default.Fragment,null,lb.default.createElement("div",{className:"mk-divider"}),lb.default.createElement(ba,{superstate:e.superstate,name:W.editor.width,min:0,value:t.styles?.width,setValue:n=>r("width",n),units:["px","%","em"]}),lb.default.createElement("div",{className:"mk-divider"}),lb.default.createElement(ba,{superstate:e.superstate,name:W.editor.height,min:0,value:t.styles?.height,setValue:n=>r("height",n),units:["px","%","em"]}))};var dg=Ae(Te());var ub=Ae(Te());var ZEe=e=>{let{selectedNode:t,saveStyleValue:r}=e;return ub.default.createElement(ub.default.Fragment,null,ub.default.createElement(ba,{superstate:e.superstate,name:W.editor.marginLeft,value:t.styles?.marginLeft,setValue:n=>r("marginLeft",n),units:["px","em"]}),ub.default.createElement(ba,{superstate:e.superstate,name:W.editor.marginTop,value:t.styles?.marginTop,setValue:n=>r("marginTop",n),units:["px","em"]}),ub.default.createElement(ba,{superstate:e.superstate,name:W.editor.marginRight,value:t.styles?.marginRight,setValue:n=>r("marginRight",n),units:["px","em"]}),ub.default.createElement(ba,{superstate:e.superstate,name:W.editor.marginBottom,value:t.styles?.marginBottom,setValue:n=>r("marginBottom",n),units:["px","em"]}))};var cb=Ae(Te());var XEe=e=>{let{selectedNode:t,saveStyleValue:r}=e;return cb.default.createElement(cb.default.Fragment,null,cb.default.createElement(ba,{superstate:e.superstate,name:W.editor.paddingLeft,value:t.styles?.paddingLeft,setValue:n=>r("paddingLeft",n),units:["px","em"]}),cb.default.createElement(ba,{superstate:e.superstate,name:W.editor.paddingTop,min:0,value:t.styles?.paddingTop,setValue:n=>r("paddingTop",n),units:["px","em"]}),cb.default.createElement(ba,{superstate:e.superstate,name:W.editor.paddingRight,min:0,value:t.styles?.paddingRight,setValue:n=>r("paddingRight",n),units:["px","em"]}),cb.default.createElement(ba,{superstate:e.superstate,name:W.editor.paddingBottom,min:0,value:t.styles?.paddingBottom,setValue:n=>r("paddingBottom",n),units:["px","em"]}))};var KEe=e=>{let{selectedNode:t,saveStyleValue:r}=e,n=a=>{let o=a.target.getBoundingClientRect();return e.superstate.ui.openCustomMenu(o,dg.default.createElement(XEe,{...e}),e,Ne(a.view.document))},i=a=>{let o=a.target.getBoundingClientRect();return e.superstate.ui.openCustomMenu(o,dg.default.createElement(ZEe,{...e}),e,Ne(a.view.document))};return dg.default.createElement(dg.default.Fragment,null,dg.default.createElement(ba,{superstate:e.superstate,name:W.editor.margin,value:t.styles?.margin,setValue:a=>r("margin",a),units:["px","em"]}),dg.default.createElement("div",{dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//plus")},onClick:a=>{i(a)}}),dg.default.createElement(ba,{superstate:e.superstate,name:W.editor.padding,min:0,value:t.styles?.padding,setValue:a=>r("padding",a),units:["px","em"]}),dg.default.createElement("div",{dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//plus")},onClick:a=>{n(a)}}))};var JEe=e=>{let{selectedNode:t,saveStyleValue:r}=e,n=(i,a)=>{let o=a=="icon"?"iconSize":"imageSize",s=[];s.push({name:W.labels.styleSmall,icon:"type",onClick:()=>{r(o,"'s'")}}),s.push({name:W.labels.styleMedium,icon:"type",onClick:()=>{r(o,"'m'")}}),s.push({name:W.labels.styleLarge,icon:"type",onClick:()=>{r(o,"'l'")}});let l=i.target.getBoundingClientRect();e.superstate.ui.openMenu(l,Zt(e.superstate.ui,s),Ne(i.view.document))};return fb.default.createElement(fb.default.Fragment,null,fb.default.createElement("div",{className:"mk-divider"}),fb.default.createElement(KEe,{...e}),fb.default.createElement(YEe,{...e}),fb.default.createElement("div",{className:"mk-divider"}))};var R9=Ae(Te());var eke=e=>{let{selectedNode:t,saveStyleValue:r}=e;return R9.default.createElement(R9.default.Fragment,null,R9.default.createElement(Io,{superstate:e.superstate,name:W.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 tke=Ae(Qa());var Ro=Ae(Te());var rke=e=>{let{selectedNode:t,pathState:r,savePropValue:n,frameProps:i,fields:a,frameProperties:o,instance:s}=e,l=(d,p)=>{d.preventDefault();let h=_u(i?.[p.name]),m=[];h||(m.push({name:W.editor.unlinkProperty,icon:"ui//unplug",onClick:()=>{n(p.name,jr(e.state.props?.[p.name]))}}),m.push(qt));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"?W.editor.currentSpace:v;Object.keys(s.state.$contexts).forEach(v=>{Boe(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:Ri(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:Ri(x),description:A(v),onClick:()=>{n(p.name,`$api.path.label($contexts['${v}']['${x.name}'])?.sticker`)}}),p.type=="text"&&m.push({name:W.editor.linkName.replace("${1}",Vo(x,e.superstate)),icon:Ri(x),description:A(v),onClick:()=>{n(p.name,`$api.path.label($contexts['${v}']['${x.name}'])?.name`)}}),p.type=="image"&&m.push({name:W.editor.linkThumbnail.replace("${1}",Vo(x,e.superstate)),icon:Ri(x),description:A(v),onClick:()=>{n(p.name,`$api.path.label($contexts['${v}']['${x.name}'])?.thumbnail`)}})))}),m.push(qt)}),o.filter(v=>g.some(x=>x==v.type)).forEach(v=>{m.push({name:v.name,icon:Ri(v),onClick:()=>{n(p.name,`${v.schemaId}.props['${v.name}']`)}})}),m.push(qt),o.filter(v=>v.type!=p.type).forEach(v=>{(v.type=="link"||v.type=="image"||v.type=="file")&&(p.type=="icon"&&m.push({name:W.editor.linkSticker.replace("${1}",Vo(v,e.superstate)),icon:Ri(v),onClick:()=>{n(p.name,`$api.path.label(${v.schemaId}.props['${v.name}'])?.sticker`)}}),p.type=="image"&&m.push({name:W.editor.linkThumbnail.replace("${1}",v.name),icon:Ri(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:W.editor.linkName.replace("${1}",Vo(v,e.superstate)),icon:Ri(v),onClick:()=>{n(p.name,`$api.path.label(${v.schemaId}.props['${v.name}'])?.name`)}})});let b=d.target.getBoundingClientRect();e.superstate.ui.openMenu(b,Zt(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 tL(p);if(d.type=="option")return(mr(d.value,d.type,e.superstate,r.path).options??[]).find(g=>g.value==Sa(p))?.name??null;if(d.type=="super"){let h=mr(d.value,d.type,e.superstate);if(h.dynamic?Sa(i[h.field??""]):h.field)return p}return _u(p)?Sa(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"},W.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")?KM(i?.[d.name],d.type):d.type=="super"||_u(i?.[d.name]),m=f(d);return Ro.default.createElement(Ro.default.Fragment,{key:p},h?Ro.default.createElement(xs,{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,tke.default)("mk-path-context-row",m&&"mk-path-context-stacked")},d.type=="input"?Ro.default.createElement(A9,{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":W.editor.linkedProperty},Dk(i?.[d.name])))),Ro.default.createElement("span",null),!m&&Ro.default.createElement("div",{"aria-label":W.editor.linkProperty,className:"mk-icon-small mk-inline-button",onClick:g=>l(g,d),dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//plug")}})))})))};var O2=Ae(Te());var Bv=Ae(Te());var nke=e=>{let{selectedNode:t,saveStyleValue:r}=e,n=a=>{let o=[];o.push({name:W.editor.strokeNone,icon:"ui//type",onClick:()=>{r("outlineStyle","'none'")}}),o.push({name:W.editor.strokeSolid,icon:"ui//type",onClick:()=>{r("outlineStyle","'solid'")}}),o.push({name:W.editor.strokeDashed,icon:"ui//type",onClick:()=>{r("outlineStyle","'dashed'")}}),o.push({name:W.editor.strokeDotted,icon:"ui//type",onClick:()=>{r("outlineStyle","'dotted'")}});let s=a.target.getBoundingClientRect();e.superstate.ui.openMenu(s,Zt(e.superstate.ui,o),Ne(a.view.document))},i=(a,o)=>{let s=u=>{r(o,`'${u}'`)},l=a.target.getBoundingClientRect();Vu(e.superstate,l,Ne(a.view.document),Sa(t.styles?.[o]),s)};return Bv.default.createElement(Bv.default.Fragment,null,Bv.default.createElement("div",{className:"mk-divider"}),Bv.default.createElement("div",{className:"mk-editor-frame-node-button",onClick:a=>n(a)},Bv.default.createElement("div",{dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//case-sensitive")}}),e.state.styles?.outlineStyle??W.labels.none),Bv.default.createElement(ba,{superstate:e.superstate,name:W.editor.size,value:e.state.styles?.outlineWidth,setValue:a=>r("outlineWidth",a),units:["px","em"]}),Bv.default.createElement("div",{onClick:a=>{i(a,"outlineColor")},className:"mk-color",style:{background:e.state.styles?.outlineColor}}))};var ike=e=>{let{selectedNode:t,saveStyleValue:r}=e,n=(i,a)=>{let o=l=>{r(a,`'${l}'`)},s=i.target.getBoundingClientRect();Vu(e.superstate,s,Ne(i.view.document),Sa(e.selectedNode.styles?.[a]),o)};return O2.default.createElement(O2.default.Fragment,null,O2.default.createElement("div",{className:"mk-color",onClick:i=>n(i,"background"),style:{background:Sa(e.selectedNode.styles?.background)}}),O2.default.createElement(nke,{...e}),O2.default.createElement(ba,{superstate:e.superstate,name:W.editor.opacity,min:0,max:100,value:t.styles?.opacity,setValue:i=>r("opacity",i),units:["%"]}))};function ake(){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 nl=Ae(Te());var oke=e=>{let{selectedNode:t,saveStyleValue:r}=e,n=o=>{let s=ake().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();Vu(e.superstate,u,Ne(o.view.document),Sa(e.selectedNode.styles?.[s]),l)};return nl.default.createElement(nl.default.Fragment,null,nl.default.createElement("div",{className:"mk-editor-frame-node-button",onClick:o=>n(o)},nl.default.createElement("div",{dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//type")}}),t.styles?.["--font-text"]),nl.default.createElement("div",{className:"mk-divider"}),nl.default.createElement(ba,{superstate:e.superstate,name:W.editor.size,value:t.styles?.["--font-text-size"],setValue:o=>r("--font-text-size",o),units:["px","em"]}),nl.default.createElement(Io,{superstate:e.superstate,name:W.editor.bold,value:t.styles?.["--font-text-weight"],defaultValue:"'normal'",onValue:"'bold'",icon:"ui//bold",setValue:o=>r("--font-text-weight",o)}),nl.default.createElement(Io,{superstate:e.superstate,name:W.editor.italic,value:t.styles?.["--font-text-style"],defaultValue:"'normal'",onValue:"'italic'",icon:"ui//italic",setValue:o=>r("--font-text-style",o)}),nl.default.createElement(Io,{superstate:e.superstate,name:W.editor.underline,value:t.styles?.["--font-text-decoration"],defaultValue:"'none'",onValue:"'underline'",icon:"ui//underline",setValue:o=>r("--font-text-decoration",o)}),nl.default.createElement(B9,{superstate:e.superstate,value:Sa(t.styles?.["--font-text-color"]),setValue:o=>r("--font-text-color",`'${o}'`)}),nl.default.createElement("div",{className:"mk-divider"}),nl.default.createElement(Io,{superstate:e.superstate,name:W.editor.alignLeft,value:t.styles?.textAlign,defaultValue:"'left'",onValue:"'left'",icon:"ui//align-left",setValue:o=>r("textAlign",o)}),nl.default.createElement(Io,{superstate:e.superstate,name:W.editor.alignCenter,value:t.styles?.textAlign,defaultValue:"'center'",onValue:"'center'",icon:"ui//align-center",setValue:o=>r("textAlign",o)}),nl.default.createElement(Io,{superstate:e.superstate,name:W.editor.alignRight,value:t.styles?.textAlign,defaultValue:"'left'",onValue:"'right'",icon:"ui//align-right",setValue:o=>r("textAlign",o)}),nl.default.createElement(Io,{superstate:e.superstate,name:W.editor.alignJustify,value:t.styles?.textAlign,defaultValue:"'left'",onValue:"'justify'",icon:"ui//align-justify",setValue:o=>r("textAlign",o)}),nl.default.createElement("div",{className:"mk-divider"}),nl.default.createElement(ba,{superstate:e.superstate,name:W.editor.numberOfLines,value:t.styles?.["--line-count"],setValue:o=>r("--line-count",o),units:[""]}))};var ske=e=>{let{pathState:t}=(0,or.useContext)($r),{deleteFrame:r,duplicateFrame:n}=e,{spaceInfo:i}=(0,or.useContext)(ur),{addNode:a,ungroupNode:o,updateNode:s,saveNodes:l,frameProperties:u}=(0,or.useContext)(Hi),{selectionMode:c}=(0,or.useContext)(Vi),{instance:f}=(0,or.useContext)(Ii),d=(0,or.useCallback)((C,N)=>{s(N,{props:{...C}})},[s]),p=(C,N)=>{s(e.node,{styles:{[C]:N}})},[h,m]=(0,or.useState)(0),[g,A]=(0,or.useState)(e.node.props),b=(0,or.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,or.useEffect)(()=>{A(e.node.props)},[e.node]);let v=(0,or.useCallback)((C,N)=>{A(D=>({...D,[C]:N})),d({[C]:N},e.node)},[A,d,e.node]),x=[{type:"h1",name:W.commands.h1,icon:"ui//heading-1",class:"mk-t-h1"},{type:"h2",name:W.commands.h2,icon:"ui//heading-2",class:"mk-t-h2"},{type:"h3",name:W.commands.h3,icon:"ui//heading-3",class:"mk-t-h3"},{type:"h4",name:W.commands.h4,icon:"ui//heading-4",class:"mk-t-h4"},{type:"h5",name:W.commands.h5,icon:"ui//heading-5",class:"mk-t-h5"},{type:"h6",name:W.commands.h6,icon:"ui//heading-6",class:"mk-t-h6"},{type:"p",name:W.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,Zt(e.superstate.ui,N),Ne(C.view.document))},S=(0,or.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,or.useEffect)(()=>{S.current&&S.current.update(j)},[f,b,e.state,e.node,g]);let O=(0,or.useRef)(null);return or.default.createElement("div",{className:"mk-editor-frame-node-selector",style:{pointerEvents:"auto"},ref:O,onClick:C=>{C.preventDefault()}},e.node.type=="new"&&or.default.createElement(or.default.Fragment,null,or.default.createElement("div",{className:"mk-editor-frame-node-button-primary",dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//plus")},onClick:C=>{D2(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()}}),or.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&&Ji(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?or.default.createElement(or.default.Fragment,null,e.node.type=="group"||e.node.type=="content"?or.default.createElement(QEe,{...k}):b.length>0&&or.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(),or.default.createElement(rke,{...j}),j,Ne(C.view.document),"bottom")},dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//list")}}),e.node.type=="text"&&or.default.createElement(or.default.Fragment,null,or.default.createElement("div",{className:"mk-editor-frame-node-button",onClick:C=>w(C)},or.default.createElement("div",{dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker(x.find(C=>C.class==Sa(e.node.styles?.class))?.icon??"ui//type")}}),x.find(C=>C.class==Sa(e.node.styles?.class))?.name??"Paragraph"),or.default.createElement("div",{className:"mk-divider"})),e.node.type=="icon"&&or.default.createElement(B9,{superstate:e.superstate,value:Sa(e.node.styles?.color),setValue:C=>p("color",`'${C}'`)}),or.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")}}),or.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")&&or.default.createElement(eke,{...k}),or.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&&or.default.createElement(or.default.Fragment,null,or.default.createElement("div",{className:"mk-divider"}),or.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"})),or.default.createElement("div",{className:"mk-divider"}),e.node.type=="group"||e.node.type=="container"?or.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")}}):or.default.createElement(or.default.Fragment,null),or.default.createElement("div",{className:"mk-editor-frame-node-button","aria-label":"Delete",onClick:()=>r(),dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//trash")}})):or.default.createElement(or.default.Fragment,null,or.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")}}),or.default.createElement("div",{className:"mk-editor-frame-node-divider"}),h==3?or.default.createElement(oke,{...k}):h==4?or.default.createElement(JEe,{...k}):h==5?or.default.createElement(ike,{...k}):or.default.createElement(or.default.Fragment,null)))};var BY=Ae(Te()),$9=e=>BY.default.createElement(BY.default.Fragment,null,e.children);var Lc=Ae(Te());var ta=Ae(Te());var q9=Ae(Te());var L9=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 q9.default.createElement("div",{className:"mk-cell-option-item",onClick:r=>e.triggerMenu?e.triggerMenu(r):t(r)},q9.default.createElement("div",null,e.options?e.options.find(r=>r.value==e.value)?.name:e.value),q9.default.createElement("div",{className:"mk-cell-option-select mk-icon-xxsmall mk-icon-rotated",dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//collapse-solid")}}))};var z9=Ae(Te());var Ko=Ae(Te());var Rv=Ae(Te());var lke=e=>{let t=(0,Rv.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(),Rv.default.createElement(Ah,{...i}),{...i},Ne(n.view.document),"bottom")};return e.command.schema.id=="formula"?Rv.default.createElement("button",{onClick:n=>r(n)},"Edit Formula"):e.command.schema.id=="filter"?Rv.default.createElement(w2,{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}):Rv.default.createElement(Rv.default.Fragment,null)};var RY=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=[...yq(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(lke,{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(xs,{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(RY,{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 uke=e=>{let[t,r]=z9.default.useState(zQ(e.formula)??{action:"",props:{},propsValue:{},children:[]});return z9.default.createElement("div",{className:"mk-editor-actions-nodes"},z9.default.createElement(RY,{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 Q2=Ae(Te());var pJe=0,bD=class{constructor(t,r){this.from=t,this.to=r}},Bi=class{constructor(t={}){this.id=pJe++,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=qc.match(t)),r=>{let n=t(r);return n===void 0?null:[this,n]}}};Bi.closedBy=new Bi({deserialize:e=>e.split(" ")});Bi.openedBy=new Bi({deserialize:e=>e.split(" ")});Bi.group=new Bi({deserialize:e=>e.split(" ")});Bi.contextHash=new Bi({perNode:!0});Bi.lookAhead=new Bi({perNode:!0});Bi.mounted=new Bi({perNode:!0});var mJe=Object.create(null),qc=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):mJe,n=(t.top?1:0)|(t.skipped?2:0)|(t.error?4:0)|(t.name==null?8:0),i=new qc(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(Bi.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(Bi.group),a=-1;a<(i?i.length:0);a++){let o=r[a<0?n.name:i[a]];if(o)return o}}}};qc.none=new qc("",Object.create(null),0,8);var M2=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:zY(qc.none,this.children,this.positions,0,this.children.length,0,this.length,(r,n,i)=>new Il(this.type,r,n,i,this.propValues),t.makeTree||((r,n,i)=>new Il(qc.none,r,n,i)))}static build(t){return hJe(t)}};Il.empty=new Il(qc.none,[],[],0);var xD=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 xD(this.buffer,this.index)}},pg=class{constructor(t,r,n){this.buffer=t,this.length=r,this.set=n}get type(){return qc.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 pke(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 j2(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(!!dke(i,n,f,f+c.length)){if(c instanceof pg){if(a&Pl.ExcludeBuffers)continue;let d=c.findChild(0,c.buffer.length,r,n-f,i);if(d>-1)return new Sh(new $Y(o,c,t,f),null,d)}else if(a&Pl.IncludeAnonymous||!c.type.isAnonymous||LY(c)){let d;if(!(a&Pl.IgnoreMounts)&&c.props&&(d=c.prop(Bi.mounted))&&!d.overlay)return new am(d.tree,f,t,o);let p=new am(c,f,t,o);return a&Pl.IncludeAnonymous||!p.type.isAnonymous?p:p.nextChild(r<0?c.children.length-1:0,r,n,i)}}}if(a&Pl.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&Pl.IgnoreOverlays)&&(i=this._tree.prop(Bi.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 N2(this,t)}get tree(){return this._tree}toTree(){return this._tree}resolve(t,r=0){return j2(this,t,r,!1)}resolveInner(t,r=0){return j2(this,t,r,!0)}enterUnfinishedNodesBefore(t){return pke(this,t)}getChild(t,r=null,n=null){let i=H9(this,t,r,n);return i.length?i[0]:null}getChildren(t,r=null,n=null){return H9(this,t,r,n)}toString(){return this._tree.toString()}get node(){return this}matchContext(t){return V9(this,t)}};function H9(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 V9(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 $Y=class{constructor(t,r,n,i){this.parent=t,this.buffer=r,this.index=n,this.start=i}},Sh=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 Sh(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&Pl.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 Sh(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 Sh(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 Sh(this.context,this._parent,t.findChild(r,this.index,-1,0,4))}cursor(t=0){return new N2(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 Il(this.type,t,r,this.to-this.from)}resolve(t,r=0){return j2(this,t,r,!1)}resolveInner(t,r=0){return j2(this,t,r,!0)}enterUnfinishedNodesBefore(t){return pke(this,t)}toString(){return this.context.buffer.childString(this.index)}getChild(t,r=null,n=null){let i=H9(this,t,r,n);return i.length?i[0]:null}getChildren(t,r=null,n=null){return H9(this,t,r,n)}get node(){return this}matchContext(t){return V9(this,t)}},N2=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&Pl.ExcludeBuffers?!1:this.enterChild(1,t,r):this.yield(this._tree.enter(t,r,n))}parent(){if(!this.buffer)return this.yieldNode(this.mode&Pl.IncludeAnonymous?this._tree._parent:this._tree.parent);if(this.stack.length)return this.yieldBuf(this.stack.pop());let t=this.mode&Pl.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&Pl.IncludeAnonymous||s instanceof pg||!s.type.isAnonymous||LY(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 V9(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 LY(e){return e.children.some(t=>t instanceof pg||!t.type.isAnonymous||LY(t))}function hJe(e){var t;let{buffer:r,nodeSet:n,maxBufferLength:i=1024,reused:a=[],minRepeatType:o=n.types.length}=e,s=Array.isArray(r)?new xD(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=zY(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 Il){if(!O&&C.type==x&&C.length==k)return C;(N=C.prop(Bi.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=[Bi.contextHash,u];O=O?[C].concat(O):[C]}if(j>25){let C=[Bi.lookAhead,j];O=O?[C].concat(O):[C]}return new Il(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 Il(l[e.topID],A.reverse(),b.reverse(),v)}var fke=new WeakMap;function W9(e,t){if(!e.isAnonymous||t instanceof pg||t.type!=e)return 1;let r=fke.get(t);if(r==null){r=1;for(let n of t.children){if(n.type!=e||!(n instanceof Il)){r=1;break}r+=W9(e,n)}fke.set(t,r)}return r}function zY(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(zY(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 G9=class{startParse(t,r,n){return typeof t=="string"&&(t=new qY(t)),n=n?n.length?n.map(i=>new bD(i.from,i.to)):[new bD(0,0)]:[new bD(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}}},qY=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 M0r=new Bi({perNode:!0});var _2=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 _2(t,[],r,n,n,0,[],0,i?new Y9(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 _2(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 HY(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()}},Y9=class{constructor(t,r){this.tracker=t,this.context=r,this.hash=t.strict?t.hash(r):0}},mke;(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"})(mke||(mke={}));var HY=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}},P2=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 P2(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 P2(this.stack,this.pos,this.index)}},T2=class{constructor(){this.start=-1,this.value=-1,this.end=-1,this.extended=-1,this.lookAhead=0,this.mask=0,this.context=0}},hke=new T2,VY=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=hke,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=hke,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}},F2=class{constructor(t,r){this.data=t,this.id=r}token(t,r){gJe(this.data,t,r,this.id)}};F2.prototype.contextual=F2.prototype.fallback=F2.prototype.extend=!1;var db=class{constructor(t,r={}){this.token=t,this.contextual=!!r.contextual,this.fallback=!!r.fallback,this.extend=!!r.extend}};function gJe(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 Q9(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),UY=null,Ake;(function(e){e[e.Margin=25]="Margin"})(Ake||(Ake={}));function gke(e,t,r){let n=e.cursor(Pl.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 GY=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?gke(t.tree,t.from+t.offset,1)-t.offset:t.from,this.safeTo=t.openEnd?gke(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 Il){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}}},QY=class{constructor(t,r){this.stream=r,this.tokens=[],this.mainToken=null,this.actions=[],this.tokens=t.tokenizers.map(n=>new T2)}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 T2,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 T2,{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 GY(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&&vJe(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(Bi.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 Il)||f.children.length==0||f.positions[0]>0)break;let p=f.children[0];if(p instanceof Il&&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 yke(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)})`),yke(s,n)):(!i||i.scoree,Z9=class{constructor(t){this.start=t.start,this.shift=t.shift||WY,this.reduce=t.reduce||WY,this.reuse=t.reuse||WY,this.hash=t.hash||(()=>0),this.strict=t.strict!==!1}},pb=class extends G9{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 M2(r.map((s,l)=>qc.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=Q9(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 F2(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 YY(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=mg(this.data,n+2);else return!1;if(r==mg(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=mg(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=bke(this.data,this.tokenPrecTable,r);return n<0||bke(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:I2.get(r.base||r,r.modified.concat(t).sort((n,i)=>n.id-i.id))}},bJe=0,I2=class{constructor(){this.instances=[],this.id=bJe++}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 Qd(i,t,r);for(let s of r)s.instances.push(a);let o=Ske(r);for(let s of t.set)for(let l of o)i.push(I2.get(s,l));return a}};function xJe(e,t){return e.length==t.length&&e.every((r,n)=>r==t[n])}function Ske(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 KY(n,o,l>0?a.slice(0,l):null);t[u]=c.sort(t[u])}}return wJe.add(t)}var wJe=new Bi,KY=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=Qd.define,X9=Tt(),$v=Tt(),xke=Tt($v),wke=Tt($v),qv=Tt(),K9=Tt(qv),XY=Tt(qv),Ch=Tt(),mb=Tt(Ch),Eh=Tt(),kh=Tt(),JY=Tt(),wD=Tt(JY),J9=Tt(),gt={comment:X9,lineComment:Tt(X9),blockComment:Tt(X9),docComment:Tt(X9),name:$v,variableName:Tt($v),typeName:xke,tagName:Tt(xke),propertyName:wke,attributeName:Tt(wke),className:Tt($v),labelName:Tt($v),namespace:Tt($v),macroName:Tt($v),literal:qv,string:K9,docString:Tt(K9),character:Tt(K9),attributeValue:Tt(K9),number:XY,integer:Tt(XY),float:Tt(XY),bool:Tt(qv),regexp:Tt(qv),escape:Tt(qv),color:Tt(qv),url:Tt(qv),keyword:Eh,self:Tt(Eh),null:Tt(Eh),atom:Tt(Eh),unit:Tt(Eh),modifier:Tt(Eh),operatorKeyword:Tt(Eh),controlKeyword:Tt(Eh),definitionKeyword:Tt(Eh),moduleKeyword:Tt(Eh),operator:kh,derefOperator:Tt(kh),arithmeticOperator:Tt(kh),logicOperator:Tt(kh),bitwiseOperator:Tt(kh),compareOperator:Tt(kh),updateOperator:Tt(kh),definitionOperator:Tt(kh),typeOperator:Tt(kh),controlOperator:Tt(kh),punctuation:JY,separator:Tt(JY),bracket:wD,angleBracket:Tt(wD),squareBracket:Tt(wD),paren:Tt(wD),brace:Tt(wD),content:Ch,heading:mb,heading1:Tt(mb),heading2:Tt(mb),heading3:Tt(mb),heading4:Tt(mb),heading5:Tt(mb),heading6:Tt(mb),contentSeparator:Tt(Ch),list:Tt(Ch),quote:Tt(Ch),emphasis:Tt(Ch),strong:Tt(Ch),link:Tt(Ch),monospace:Tt(Ch),strikethrough:Tt(Ch),inserted:Tt(),deleted:Tt(),changed:Tt(),invalid:Tt(),meta:J9,documentMeta:Tt(J9),annotation:Tt(J9),processingInstruction:Tt(J9),definition:Qd.defineModifier(),constant:Qd.defineModifier(),function:Qd.defineModifier(),standard:Qd.defineModifier(),local:Qd.defineModifier(),special:Qd.defineModifier()},_0r=SJe([{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 kke=281,Cke=1,EJe=2,e8=282,kJe=3,CJe=283,Dke=284,DJe=4,OJe=286,MJe=287,jJe=5,NJe=6,TJe=1,FJe=[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],Mke=125,_Je=123,PJe=59,Oke=47,IJe=42,BJe=43,RJe=45,$Je=36,qJe=96,LJe=92,zJe=new Z9({start:!1,shift(e,t){return t==jJe||t==NJe||t==OJe?e:t==MJe},strict:!1}),UJe=new db((e,t)=>{let{next:r}=e;(r==Mke||r==-1||t.context)&&t.canShift(Dke)&&e.acceptToken(Dke)},{contextual:!0,fallback:!0}),WJe=new db((e,t)=>{let{next:r}=e,n;FJe.indexOf(r)>-1||r==Oke&&((n=e.peek(1))==Oke||n==IJe)||r!=Mke&&r!=PJe&&r!=-1&&!t.context&&t.canShift(kke)&&e.acceptToken(kke)},{contextual:!0}),HJe=new db((e,t)=>{let{next:r}=e;if((r==BJe||r==RJe)&&(e.advance(),r==e.next)){e.advance();let n=!t.context&&t.canShift(Cke);e.acceptToken(n?Cke:EJe)}},{contextual:!0}),VJe=new db(e=>{for(let t=!1,r=0;;r++){let{next:n}=e;if(n<0){r&&e.acceptToken(e8);break}else if(n==qJe){r?e.acceptToken(e8):e.acceptToken(CJe,1);break}else if(n==_Je&&t){r==1?e.acceptToken(kJe,1):e.acceptToken(e8,-1);break}else if(n==10&&r){e.advance(),e.acceptToken(e8);break}else n==LJe&&e.advance();t=n==$Je,e.advance()}});function GJe(e,t){return e=="extends"&&t.dialectEnabled(TJe)?DJe:-1}var QJe=Eke({"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}),YJe={__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},ZJe={__proto__:null,async:109,get:111,set:113,public:161,private:161,protected:161,static:163,abstract:165,override:167,readonly:173,new:355},XJe={__proto__:null,"<":129},jke=pb.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:[WJe,HJe,VJe,0,1,2,3,4,5,6,7,8,9,UJe],topRules:{Script:[0,7]},dialects:{jsx:11707,ts:11709},dynamicPrecedences:{149:1,176:1},specialized:[{term:289,get:(e,t)=>GJe(e,t)<<1},{term:289,get:e=>YJe[e]||-1},{term:299,get:e=>ZJe[e]||-1},{term:63,get:e=>XJe[e]||-1}],tokenPrec:11730});var KJe=0,SD=class{constructor(t,r){this.from=t,this.to=r}},Oi=class{constructor(t={}){this.id=KJe++,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]}}};Oi.closedBy=new Oi({deserialize:e=>e.split(" ")});Oi.openedBy=new Oi({deserialize:e=>e.split(" ")});Oi.group=new Oi({deserialize:e=>e.split(" ")});Oi.contextHash=new Oi({perNode:!0});Oi.lookAhead=new Oi({perNode:!0});Oi.mounted=new Oi({perNode:!0});var JJe=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):JJe,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(Oi.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(Oi.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 t8=new WeakMap,Nke=new WeakMap,ks;(function(e){e[e.ExcludeBuffers=1]="ExcludeBuffers",e[e.IncludeAnonymous=2]="IncludeAnonymous",e[e.IgnoreMounts=4]="IgnoreMounts",e[e.IgnoreOverlays=8]="IgnoreOverlays"})(ks||(ks={}));var Cs=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(Oi.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 R2(this.topNode,t)}cursorAt(t,r=0,n=0){let i=t8.get(this)||this.topNode,a=new R2(i);return a.moveTo(t,r),t8.set(this,a._tree),a}get topNode(){return new If(this,0,0,null)}resolve(t,r=0){let n=B2(t8.get(this)||this.topNode,t,r,!1);return t8.set(this,n),n}resolveInner(t,r=0){let n=B2(Nke.get(this)||this.topNode,t,r,!0);return Nke.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)|ks.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:nZ(Zu.none,this.children,this.positions,0,this.children.length,0,this.length,(r,n,i)=>new Cs(this.type,r,n,i,this.propValues),t.makeTree||((r,n,i)=>new Cs(Zu.none,r,n,i)))}static build(t){return eet(t)}};Cs.empty=new Cs(Zu.none,[],[],0);var ED=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 ED(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 _ke(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 B2(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(!!Fke(i,n,f,f+c.length)){if(c instanceof hg){if(a&ks.ExcludeBuffers)continue;let d=c.findChild(0,c.buffer.length,r,n-f,i);if(d>-1)return new Yd(new eZ(o,c,t,f),null,d)}else if(a&ks.IncludeAnonymous||!c.type.isAnonymous||rZ(c)){let d;if(!(a&ks.IgnoreMounts)&&c.props&&(d=c.prop(Oi.mounted))&&!d.overlay)return new If(d.tree,f,t,o);let p=new If(c,f,t,o);return a&ks.IncludeAnonymous||!p.type.isAnonymous?p:p.nextChild(r<0?c.children.length-1:0,r,n,i)}}}if(a&ks.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&ks.IgnoreOverlays)&&(i=this._tree.prop(Oi.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 If(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 R2(this,t)}get tree(){return this._tree}toTree(){return this._tree}resolve(t,r=0){return B2(this,t,r,!1)}resolveInner(t,r=0){return B2(this,t,r,!0)}enterUnfinishedNodesBefore(t){return _ke(this,t)}getChild(t,r=null,n=null){let i=n8(this,t,r,n);return i.length?i[0]:null}getChildren(t,r=null,n=null){return n8(this,t,r,n)}toString(){return this._tree.toString()}get node(){return this}matchContext(t){return i8(this,t)}};function n8(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 i8(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 eZ=class{constructor(t,r,n,i){this.parent=t,this.buffer=r,this.index=n,this.start=i}},Yd=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 Yd(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&ks.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 Yd(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 Yd(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 Yd(this.context,this._parent,t.findChild(r,this.index,-1,0,4))}cursor(t=0){return new R2(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 Cs(this.type,t,r,this.to-this.from)}resolve(t,r=0){return B2(this,t,r,!1)}resolveInner(t,r=0){return B2(this,t,r,!0)}enterUnfinishedNodesBefore(t){return _ke(this,t)}toString(){return this.context.buffer.childString(this.index)}getChild(t,r=null,n=null){let i=n8(this,t,r,n);return i.length?i[0]:null}getChildren(t,r=null,n=null){return n8(this,t,r,n)}get node(){return this}matchContext(t){return i8(this,t)}},R2=class{constructor(t,r=0){if(this.mode=r,this.buffer=null,this.stack=[],this.index=0,this.bufferNode=null,t instanceof If)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 If?(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&ks.ExcludeBuffers?!1:this.enterChild(1,t,r):this.yield(this._tree.enter(t,r,n))}parent(){if(!this.buffer)return this.yieldNode(this.mode&ks.IncludeAnonymous?this._tree._parent:this._tree.parent);if(this.stack.length)return this.yieldBuf(this.stack.pop());let t=this.mode&ks.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&ks.IncludeAnonymous||s instanceof hg||!s.type.isAnonymous||rZ(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 i8(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 rZ(e){return e.children.some(t=>t instanceof hg||!t.type.isAnonymous||rZ(t))}function eet(e){var t;let{buffer:r,nodeSet:n,maxBufferLength:i=1024,reused:a=[],minRepeatType:o=n.types.length}=e,s=Array.isArray(r)?new ED(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=nZ(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 Cs){if(!O&&C.type==x&&C.length==k)return C;(N=C.prop(Oi.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=[Oi.contextHash,u];O=O?[C].concat(O):[C]}if(j>25){let C=[Oi.lookAhead,j];O=O?[C].concat(O):[C]}return new Cs(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 Cs(l[e.topID],A.reverse(),b.reverse(),v)}var Tke=new WeakMap;function r8(e,t){if(!e.isAnonymous||t instanceof hg||t.type!=e)return 1;let r=Tke.get(t);if(r==null){r=1;for(let n of t.children){if(n.type!=e||!(n instanceof Cs)){r=1;break}r+=r8(e,n)}Tke.set(t,r)}return r}function nZ(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(nZ(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 a8=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 Yd?this.setBuffer(t.context.buffer,t.index,r):t instanceof If&&this.map.set(t.tree,r)}get(t){return t instanceof Yd?this.getBuffer(t.context.buffer,t.index):t instanceof If?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)}},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 SD(i.from,i.to)):[new SD(0,0)]:[new SD(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}}},tZ=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 $0r=new Oi({perNode:!0});var Au=require("@codemirror/state"),Ag=require("@codemirror/view");var tet=0,Zd=class{constructor(t,r,n){this.set=t,this.base=r,this.modified=n,this.id=tet++}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 $2;return r=>r.modified.indexOf(t)>-1?r:$2.get(r.base||r,r.modified.concat(t).sort((n,i)=>n.id-i.id))}},ret=0,$2=class{constructor(){this.instances=[],this.id=ret++}static get(t,r){if(!r.length)return t;let n=r[0].instances.find(s=>s.base==t&&net(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=Bke(r);for(let s of t.set)for(let l of o)i.push($2.get(s,l));return a}};function net(e,t){return e.length==t.length&&e.every((r,n)=>r==t[n])}function Bke(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 aZ(n,o,l>0?a.slice(0,l):null);t[u]=c.sort(t[u])}}return iet.add(t)}var iet=new Oi,aZ=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=Zd.define,s8=Ft(),Lv=Ft(),Pke=Ft(Lv),Ike=Ft(Lv),zv=Ft(),l8=Ft(zv),iZ=Ft(zv),jh=Ft(),hb=Ft(jh),Oh=Ft(),Mh=Ft(),oZ=Ft(),kD=Ft(oZ),u8=Ft(),Rt={comment:s8,lineComment:Ft(s8),blockComment:Ft(s8),docComment:Ft(s8),name:Lv,variableName:Ft(Lv),typeName:Pke,tagName:Ft(Pke),propertyName:Ike,attributeName:Ft(Ike),className:Ft(Lv),labelName:Ft(Lv),namespace:Ft(Lv),macroName:Ft(Lv),literal:zv,string:l8,docString:Ft(l8),character:Ft(l8),attributeValue:Ft(l8),number:iZ,integer:Ft(iZ),float:Ft(iZ),bool:Ft(zv),regexp:Ft(zv),escape:Ft(zv),color:Ft(zv),url:Ft(zv),keyword:Oh,self:Ft(Oh),null:Ft(Oh),atom:Ft(Oh),unit:Ft(Oh),modifier:Ft(Oh),operatorKeyword:Ft(Oh),controlKeyword:Ft(Oh),definitionKeyword:Ft(Oh),moduleKeyword:Ft(Oh),operator:Mh,derefOperator:Ft(Mh),arithmeticOperator:Ft(Mh),logicOperator:Ft(Mh),bitwiseOperator:Ft(Mh),compareOperator:Ft(Mh),updateOperator:Ft(Mh),definitionOperator:Ft(Mh),typeOperator:Ft(Mh),controlOperator:Ft(Mh),punctuation:oZ,separator:Ft(oZ),bracket:kD,angleBracket:Ft(kD),squareBracket:Ft(kD),paren:Ft(kD),brace:Ft(kD),content:jh,heading:hb,heading1:Ft(hb),heading2:Ft(hb),heading3:Ft(hb),heading4:Ft(hb),heading5:Ft(hb),heading6:Ft(hb),contentSeparator:Ft(jh),list:Ft(jh),quote:Ft(jh),emphasis:Ft(jh),strong:Ft(jh),link:Ft(jh),monospace:Ft(jh),strikethrough:Ft(jh),inserted:Ft(),deleted:Ft(),changed:Ft(),invalid:Ft(),meta:u8,documentMeta:Ft(u8),annotation:Ft(u8),processingInstruction:Ft(u8),definition:Zd.defineModifier(),constant:Zd.defineModifier(),function:Zd.defineModifier(),standard:Zd.defineModifier(),local:Zd.defineModifier(),special:Zd.defineModifier()},z0r=sZ([{tag:Rt.link,class:"tok-link"},{tag:Rt.heading,class:"tok-heading"},{tag:Rt.emphasis,class:"tok-emphasis"},{tag:Rt.strong,class:"tok-strong"},{tag:Rt.keyword,class:"tok-keyword"},{tag:Rt.atom,class:"tok-atom"},{tag:Rt.bool,class:"tok-bool"},{tag:Rt.url,class:"tok-url"},{tag:Rt.labelName,class:"tok-labelName"},{tag:Rt.inserted,class:"tok-inserted"},{tag:Rt.deleted,class:"tok-deleted"},{tag:Rt.literal,class:"tok-literal"},{tag:Rt.string,class:"tok-string"},{tag:Rt.number,class:"tok-number"},{tag:[Rt.regexp,Rt.escape,Rt.special(Rt.string)],class:"tok-string2"},{tag:Rt.variableName,class:"tok-variableName"},{tag:Rt.local(Rt.variableName),class:"tok-variableName tok-local"},{tag:Rt.definition(Rt.variableName),class:"tok-variableName tok-definition"},{tag:Rt.special(Rt.variableName),class:"tok-variableName2"},{tag:Rt.definition(Rt.propertyName),class:"tok-propertyName tok-definition"},{tag:Rt.typeName,class:"tok-typeName"},{tag:Rt.namespace,class:"tok-namespace"},{tag:Rt.className,class:"tok-className"},{tag:Rt.macroName,class:"tok-macroName"},{tag:Rt.propertyName,class:"tok-propertyName"},{tag:Rt.operator,class:"tok-operator"},{tag:Rt.comment,class:"tok-comment"},{tag:Rt.meta,class:"tok-meta"},{tag:Rt.invalid,class:"tok-invalid"},{tag:Rt.punctuation,class:"tok-punctuation"}]);var lZ,DD=new Oi;function aet(e){return Au.Facet.define({combine:e?t=>t.concat(e):void 0})}var Bf=class{constructor(t,r,n=[]){this.data=t,Au.EditorState.prototype.hasOwnProperty("tree")||Object.defineProperty(Au.EditorState.prototype,"tree",{get(){return q2(this)}}),this.parser=r,this.extension=[z2.of(this),Au.EditorState.languageData.of((i,a,o)=>i.facet($ke(i,a,o)))].concat(n)}isActiveAt(t,r,n=-1){return $ke(t,r,n)==this.data}findRegions(t){let r=t.facet(z2);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(DD)==this.data){n.push({from:o,to:o+a.length});return}let s=a.prop(Oi.mounted);if(s){if(s.tree.prop(DD)==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 Ab(this.data,this.parser.configure(t))}get allowsNesting(){return this.parser.hasWrappers()}};function q2(e){let t=e.field(Bf.state,!1);return t?t.tree:Cs.empty}var fZ=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)}},CD=null,L2=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 L2(t,r,[],Cs.empty,0,n,[],null)}startParse(){return this.parser.startParse(new fZ(this.state.doc),this.fragments)}work(t,r){return r!=null&&r>=this.state.doc.length&&(r=void 0),this.tree!=Cs.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=CD;CD=this;try{return t()}finally{CD=r}}withoutTempSkipped(t){for(let r;r=this.tempSkipped.pop();)t=qke(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=Cs.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=qke(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 o8{createParse(r,n,i){let a=i[0].from,o=i[i.length-1].to;return{parsedPos:a,advance(){let l=CD;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 Cs(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 CD}};function qke(e,t,r){return Dh.applyChanges(e,[{fromA:t,toA:r,fromB:t,toB:r}])}var Uv=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 Uv(r)}static init(t){let r=Math.min(3e3,t.doc.length),n=L2.create(t.facet(z2).parser,t,{from:0,to:r});return n.work(20,r)||n.takeTree(),new Uv(n)}};Bf.state=Au.StateField.define({create:Uv.init,update(e,t){for(let r of t.effects)if(r.is(Bf.setState))return r.value;return t.startState.facet(z2)!=t.state.facet(z2)?Uv.init(t.state):e.apply(t)}});var Uke=e=>{let t=setTimeout(()=>e(),500);return()=>clearTimeout(t)};typeof requestIdleCallback<"u"&&(Uke=e=>{let t=-1,r=setTimeout(()=>{t=requestIdleCallback(e,{timeout:500-100})},100);return()=>t<0?clearTimeout(r):cancelIdleCallback(t)});var uZ=typeof navigator<"u"&&((lZ=navigator.scheduling)===null||lZ===void 0?void 0:lZ.isInputPending)?()=>navigator.scheduling.isInputPending():null,oet=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(Bf.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(Bf.state);(r.tree!=r.context.tree||!r.context.isDone(t.doc.length))&&(this.working=Uke(this.work))}work(t){this.working=null;let r=Date.now();if(this.chunkEndi+1e3,l=a.context.work(()=>uZ&&uZ()||Date.now()>o,i+(s?0:1e5));this.chunkBudget-=Date.now()-r,(l||this.chunkBudget<=0)&&(a.context.takeTree(),this.view.dispatch({effects:Bf.setState.of(new Uv(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()}}}),z2=Au.Facet.define({combine(e){return e.length?e[0]:null},enables:[Bf.state,oet]}),c8=class{constructor(t,r=[]){this.language=t,this.support=r,this.extension=[t,r]}};var Wke=new Oi;function set(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.fromuet(n,t,r,e)}function uet(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?set(e):null;return l?s?e.column(l.from):e.column(l.to):e.baseIndent+(s?0:e.unit*r)}var Vke=e=>e.baseIndent;function f8({except:e,units:t=1}={}){return r=>{let n=e&&e.test(r.textAfter);return r.baseIndent+(n?0:t*r.unit)}}var Gke=new Oi;function Qke(e){let t=e.firstChild,r=e.lastChild;return t&&t.tos.prop(DD)==o.data:o?s=>s==o:void 0,this.style=sZ(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 OD(t,r||{})}};var Z0r=OD.define([{tag:Rt.meta,color:"#7a757a"},{tag:Rt.link,textDecoration:"underline"},{tag:Rt.heading,textDecoration:"underline",fontWeight:"bold"},{tag:Rt.emphasis,fontStyle:"italic"},{tag:Rt.strong,fontWeight:"bold"},{tag:Rt.strikethrough,textDecoration:"line-through"},{tag:Rt.keyword,color:"#708"},{tag:[Rt.atom,Rt.bool,Rt.url,Rt.contentSeparator,Rt.labelName],color:"#219"},{tag:[Rt.literal,Rt.inserted],color:"#164"},{tag:[Rt.string,Rt.deleted],color:"#a11"},{tag:[Rt.regexp,Rt.escape,Rt.special(Rt.string)],color:"#e40"},{tag:Rt.definition(Rt.variableName),color:"#00f"},{tag:Rt.local(Rt.variableName),color:"#30a"},{tag:[Rt.typeName,Rt.namespace],color:"#085"},{tag:Rt.className,color:"#167"},{tag:[Rt.special(Rt.variableName),Rt.macroName],color:"#256"},{tag:Rt.definition(Rt.propertyName),color:"#00c"},{tag:Rt.comment,color:"#940"},{tag:Rt.invalid,color:"#f00"}]);var cet=Object.create(null),Lke=[Zu.none];var zke=[],fet=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"]])fet[e]=det(cet,t);function cZ(e,t){zke.indexOf(e)>-1||(zke.push(e),console.warn(t))}function det(e,t){let r=null;for(let a of t.split(".")){let o=e[a]||Rt[a];o?typeof o=="function"?r?r=o(r):cZ(a,`Modifier ${a} used at start of tag`):r?cZ(a,`Tag ${a} used as modifier`):r=o:cZ(a,`Unknown highlighting tag ${a}`)}if(!r)return 0;let n=t.replace(/ /g,"_"),i=Zu.define({id:Lke.length,name:n,props:[Rke({[n]:r})]});return Lke.push(i),i.id}var x8=require("@codemirror/state"),v6e=require("@codemirror/view");var ea=require("@codemirror/state"),il=require("@codemirror/view");var pet=0,MD=class{constructor(t,r){this.from=t,this.to=r}},Gi=class{constructor(t={}){this.id=pet++,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=Xu.match(t)),r=>{let n=t(r);return n===void 0?null:[this,n]}}};Gi.closedBy=new Gi({deserialize:e=>e.split(" ")});Gi.openedBy=new Gi({deserialize:e=>e.split(" ")});Gi.group=new Gi({deserialize:e=>e.split(" ")});Gi.contextHash=new Gi({perNode:!0});Gi.lookAhead=new Gi({perNode:!0});Gi.mounted=new Gi({perNode:!0});var met=Object.create(null),Xu=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):met,n=(t.top?1:0)|(t.skipped?2:0)|(t.error?4:0)|(t.name==null?8:0),i=new Xu(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(Gi.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(Gi.group),a=-1;a<(i?i.length:0);a++){let o=r[a<0?n.name:i[a]];if(o)return o}}}};Xu.none=new Xu("",Object.create(null),0,8);var d8=new WeakMap,Yke=new WeakMap,Bl;(function(e){e[e.ExcludeBuffers=1]="ExcludeBuffers",e[e.IncludeAnonymous=2]="IncludeAnonymous",e[e.IgnoreMounts=4]="IgnoreMounts",e[e.IgnoreOverlays=8]="IgnoreOverlays"})(Bl||(Bl={}));var Ds=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(Gi.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 W2(this.topNode,t)}cursorAt(t,r=0,n=0){let i=d8.get(this)||this.topNode,a=new W2(i);return a.moveTo(t,r),d8.set(this,a._tree),a}get topNode(){return new sm(this,0,0,null)}resolve(t,r=0){let n=U2(d8.get(this)||this.topNode,t,r,!1);return d8.set(this,n),n}resolveInner(t,r=0){let n=U2(Yke.get(this)||this.topNode,t,r,!0);return Yke.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)|Bl.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:hZ(Xu.none,this.children,this.positions,0,this.children.length,0,this.length,(r,n,i)=>new Ds(this.type,r,n,i,this.propValues),t.makeTree||((r,n,i)=>new Ds(Xu.none,r,n,i)))}static build(t){return het(t)}};Ds.empty=new Ds(Xu.none,[],[],0);var jD=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 jD(this.buffer,this.index)}},gg=class{constructor(t,r,n){this.buffer=t,this.length=r,this.set=n}get type(){return Xu.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 Kke(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 U2(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(!!Xke(i,n,f,f+c.length)){if(c instanceof gg){if(a&Bl.ExcludeBuffers)continue;let d=c.findChild(0,c.buffer.length,r,n-f,i);if(d>-1)return new Nh(new dZ(o,c,t,f),null,d)}else if(a&Bl.IncludeAnonymous||!c.type.isAnonymous||mZ(c)){let d;if(!(a&Bl.IgnoreMounts)&&c.props&&(d=c.prop(Gi.mounted))&&!d.overlay)return new sm(d.tree,f,t,o);let p=new sm(c,f,t,o);return a&Bl.IncludeAnonymous||!p.type.isAnonymous?p:p.nextChild(r<0?c.children.length-1:0,r,n,i)}}}if(a&Bl.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&Bl.IgnoreOverlays)&&(i=this._tree.prop(Gi.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 W2(this,t)}get tree(){return this._tree}toTree(){return this._tree}resolve(t,r=0){return U2(this,t,r,!1)}resolveInner(t,r=0){return U2(this,t,r,!0)}enterUnfinishedNodesBefore(t){return Kke(this,t)}getChild(t,r=null,n=null){let i=m8(this,t,r,n);return i.length?i[0]:null}getChildren(t,r=null,n=null){return m8(this,t,r,n)}toString(){return this._tree.toString()}get node(){return this}matchContext(t){return h8(this,t)}};function m8(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 h8(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 dZ=class{constructor(t,r,n,i){this.parent=t,this.buffer=r,this.index=n,this.start=i}},Nh=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 Nh(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&Bl.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 Nh(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 Nh(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 Nh(this.context,this._parent,t.findChild(r,this.index,-1,0,4))}cursor(t=0){return new W2(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 Ds(this.type,t,r,this.to-this.from)}resolve(t,r=0){return U2(this,t,r,!1)}resolveInner(t,r=0){return U2(this,t,r,!0)}enterUnfinishedNodesBefore(t){return Kke(this,t)}toString(){return this.context.buffer.childString(this.index)}getChild(t,r=null,n=null){let i=m8(this,t,r,n);return i.length?i[0]:null}getChildren(t,r=null,n=null){return m8(this,t,r,n)}get node(){return this}matchContext(t){return h8(this,t)}},W2=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&Bl.ExcludeBuffers?!1:this.enterChild(1,t,r):this.yield(this._tree.enter(t,r,n))}parent(){if(!this.buffer)return this.yieldNode(this.mode&Bl.IncludeAnonymous?this._tree._parent:this._tree.parent);if(this.stack.length)return this.yieldBuf(this.stack.pop());let t=this.mode&Bl.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&Bl.IncludeAnonymous||s instanceof gg||!s.type.isAnonymous||mZ(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 h8(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 mZ(e){return e.children.some(t=>t instanceof gg||!t.type.isAnonymous||mZ(t))}function het(e){var t;let{buffer:r,nodeSet:n,maxBufferLength:i=1024,reused:a=[],minRepeatType:o=n.types.length}=e,s=Array.isArray(r)?new jD(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 gg(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=hZ(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 Ds){if(!O&&C.type==x&&C.length==k)return C;(N=C.prop(Gi.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=[Gi.contextHash,u];O=O?[C].concat(O):[C]}if(j>25){let C=[Gi.lookAhead,j];O=O?[C].concat(O):[C]}return new Ds(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 Ds(l[e.topID],A.reverse(),b.reverse(),v)}var Zke=new WeakMap;function p8(e,t){if(!e.isAnonymous||t instanceof gg||t.type!=e)return 1;let r=Zke.get(t);if(r==null){r=1;for(let n of t.children){if(n.type!=e||!(n instanceof Ds)){r=1;break}r+=p8(e,n)}Zke.set(t,r)}return r}function hZ(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(hZ(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 Th=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 Th(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 Th(p,h,d.tree,d.offset+u,s>0,!!c)}if(d&&i.push(d),o.to>f)break;o=anew MD(i.from,i.to)):[new MD(0,0)]:[new MD(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}}},pZ=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 J0r=new Gi({perNode:!0});var gu=require("@codemirror/state"),vg=require("@codemirror/view");var Aet=0,Xd=class{constructor(t,r,n){this.set=t,this.base=r,this.modified=n,this.id=Aet++}static define(t){if(t?.base)throw new Error("Can not derive from a modified tag");let r=new Xd([],null,[]);if(r.set.push(r),t)for(let n of t.set)r.set.push(n);return r}static defineModifier(){let t=new H2;return r=>r.modified.indexOf(t)>-1?r:H2.get(r.base||r,r.modified.concat(t).sort((n,i)=>n.id-i.id))}},get=0,H2=class{constructor(){this.instances=[],this.id=get++}static get(t,r){if(!r.length)return t;let n=r[0].instances.find(s=>s.base==t&&vet(r,s.modified));if(n)return n;let i=[],a=new Xd(i,t,r);for(let s of r)s.instances.push(a);let o=t6e(r);for(let s of t.set)for(let l of o)i.push(H2.get(s,l));return a}};function vet(e,t){return e.length==t.length&&e.every((r,n)=>r==t[n])}function t6e(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 gZ(n,o,l>0?a.slice(0,l):null);t[u]=c.sort(t[u])}}return yet.add(t)}var yet=new Gi,gZ=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=Xd.define,g8=_t(),Wv=_t(),Jke=_t(Wv),e6e=_t(Wv),Hv=_t(),v8=_t(Hv),AZ=_t(Hv),Ph=_t(),gb=_t(Ph),Fh=_t(),_h=_t(),vZ=_t(),ND=_t(vZ),y8=_t(),$t={comment:g8,lineComment:_t(g8),blockComment:_t(g8),docComment:_t(g8),name:Wv,variableName:_t(Wv),typeName:Jke,tagName:_t(Jke),propertyName:e6e,attributeName:_t(e6e),className:_t(Wv),labelName:_t(Wv),namespace:_t(Wv),macroName:_t(Wv),literal:Hv,string:v8,docString:_t(v8),character:_t(v8),attributeValue:_t(v8),number:AZ,integer:_t(AZ),float:_t(AZ),bool:_t(Hv),regexp:_t(Hv),escape:_t(Hv),color:_t(Hv),url:_t(Hv),keyword:Fh,self:_t(Fh),null:_t(Fh),atom:_t(Fh),unit:_t(Fh),modifier:_t(Fh),operatorKeyword:_t(Fh),controlKeyword:_t(Fh),definitionKeyword:_t(Fh),moduleKeyword:_t(Fh),operator:_h,derefOperator:_t(_h),arithmeticOperator:_t(_h),logicOperator:_t(_h),bitwiseOperator:_t(_h),compareOperator:_t(_h),updateOperator:_t(_h),definitionOperator:_t(_h),typeOperator:_t(_h),controlOperator:_t(_h),punctuation:vZ,separator:_t(vZ),bracket:ND,angleBracket:_t(ND),squareBracket:_t(ND),paren:_t(ND),brace:_t(ND),content:Ph,heading:gb,heading1:_t(gb),heading2:_t(gb),heading3:_t(gb),heading4:_t(gb),heading5:_t(gb),heading6:_t(gb),contentSeparator:_t(Ph),list:_t(Ph),quote:_t(Ph),emphasis:_t(Ph),strong:_t(Ph),link:_t(Ph),monospace:_t(Ph),strikethrough:_t(Ph),inserted:_t(),deleted:_t(),changed:_t(),invalid:_t(),meta:y8,documentMeta:_t(y8),annotation:_t(y8),processingInstruction:_t(y8),definition:Xd.defineModifier(),constant:Xd.defineModifier(),function:Xd.defineModifier(),standard:Xd.defineModifier(),local:Xd.defineModifier(),special:Xd.defineModifier()},rvr=yZ([{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 bZ,b8=new Gi;var Kd=class{constructor(t,r,n=[]){this.data=t,gu.EditorState.prototype.hasOwnProperty("tree")||Object.defineProperty(gu.EditorState.prototype,"tree",{get(){return FD(this)}}),this.parser=r,this.extension=[G2.of(this),gu.EditorState.languageData.of((i,a,o)=>i.facet(n6e(i,a,o)))].concat(n)}isActiveAt(t,r,n=-1){return n6e(t,r,n)==this.data}findRegions(t){let r=t.facet(G2);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(b8)==this.data){n.push({from:o,to:o+a.length});return}let s=a.prop(Gi.mounted);if(s){if(s.tree.prop(b8)==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)}},TD=null,V2=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 V2(t,r,[],Ds.empty,0,n,[],null)}startParse(){return this.parser.startParse(new SZ(this.state.doc),this.fragments)}work(t,r){return r!=null&&r>=this.state.doc.length&&(r=void 0),this.tree!=Ds.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(Th.addTree(this.tree,this.fragments,!0)),this.parse=null)}withContext(t){let r=TD;TD=this;try{return t()}finally{TD=r}}withoutTempSkipped(t){for(let r;r=this.tempSkipped.pop();)t=i6e(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=Th.applyChanges(n,l),i=Ds.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=i6e(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 A8{createParse(r,n,i){let a=i[0].from,o=i[i.length-1].to;return{parsedPos:a,advance(){let l=TD;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 Ds(Xu.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 TD}};function i6e(e,t,r){return Th.applyChanges(e,[{fromA:t,toA:r,fromB:t,toB:r}])}var Vv=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 Vv(r)}static init(t){let r=Math.min(3e3,t.doc.length),n=V2.create(t.facet(G2).parser,t,{from:0,to:r});return n.work(20,r)||n.takeTree(),new Vv(n)}};Kd.state=gu.StateField.define({create:Vv.init,update(e,t){for(let r of t.effects)if(r.is(Kd.setState))return r.value;return t.startState.facet(G2)!=t.state.facet(G2)?Vv.init(t.state):e.apply(t)}});var s6e=e=>{let t=setTimeout(()=>e(),500);return()=>clearTimeout(t)};typeof requestIdleCallback<"u"&&(s6e=e=>{let t=-1,r=setTimeout(()=>{t=requestIdleCallback(e,{timeout:500-100})},100);return()=>t<0?clearTimeout(r):cancelIdleCallback(t)});var xZ=typeof navigator<"u"&&((bZ=navigator.scheduling)===null||bZ===void 0?void 0:bZ.isInputPending)?()=>navigator.scheduling.isInputPending():null,bet=vg.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(Kd.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(Kd.state);(r.tree!=r.context.tree||!r.context.isDone(t.doc.length))&&(this.working=s6e(this.work))}work(t){this.working=null;let r=Date.now();if(this.chunkEndi+1e3,l=a.context.work(()=>xZ&&xZ()||Date.now()>o,i+(s?0:1e5));this.chunkBudget-=Date.now()-r,(l||this.chunkBudget<=0)&&(a.context.takeTree(),this.view.dispatch({effects:Kd.setState.of(new Vv(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,vg.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()}}}),G2=gu.Facet.define({combine(e){return e.length?e[0]:null},enables:[Kd.state,bet]});var l6e=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 _D=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 Kd?s=>s.prop(b8)==o.data:o?s=>s==o:void 0,this.style=yZ(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 _D(t,r||{})}};var cvr=_D.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 xet=Object.create(null),a6e=[Xu.none];var o6e=[],wet=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"]])wet[e]=Eet(xet,t);function wZ(e,t){o6e.indexOf(e)>-1||(o6e.push(e),console.warn(t))}function Eet(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):wZ(a,`Modifier ${a} used at start of tag`):r?wZ(a,`Tag ${a} used as modifier`):r=o:wZ(a,`Unknown highlighting tag ${a}`)}if(!r)return 0;let n=t.replace(/ /g,"_"),i=Xu.define({id:a6e.length,name:n,props:[r6e({[n]:r})]});return a6e.push(i),i.id}function u6e(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 ket(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+$/]:ket(t);return i=>{let a=i.matchBefore(n);return a||i.explicit?{from:a?a.from:i.pos,options:t,validFor:r}:null}}function d6e(e,t){return r=>{for(let n=FD(r.state).resolveInner(r.pos,-1);n;n=n.parent)if(e.indexOf(n.name)>-1)return null;return t(r)}}var Cet=il.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"}}}),EZ=class{constructor(t,r,n,i){this.field=t,this.line=r,this.from=n,this.to=i}},PD=class{constructor(t,r,n){this.field=t,this.from=r,this.to=n}map(t){let r=t.mapPos(this.from,-1,ea.MapMode.TrackDel),n=t.mapPos(this.to,1,ea.MapMode.TrackDel);return r==null||n==null?null:new PD(this.field,r,n)}},ID=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 PD(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 EZ(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 ID(n,i)}},Det=il.Decoration.widget({widget:new class extends il.WidgetType{toDOM(){let e=document.createElement("span");return e.className="cm-snippetFieldPosition",e}ignoreEvent(){return!1}}}),Oet=il.Decoration.mark({class:"cm-snippetField"}),Gv=class{constructor(t,r){this.ranges=t,this.active=r,this.deco=il.Decoration.set(t.map(n=>(n.from==n.to?Det:Oet).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 Gv(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))}},RD=ea.StateEffect.define({map(e,t){return e&&e.map(t)}}),Met=ea.StateEffect.define(),BD=ea.StateField.define({create(){return null},update(e,t){for(let r of t.effects){if(r.is(RD))return r.value;if(r.is(Met)&&e)return new Gv(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=>il.EditorView.decorations.from(e,t=>t?t.deco:il.Decoration.none)});function kZ(e,t){return ea.EditorSelection.create(e.filter(r=>r.field==t).map(r=>ea.EditorSelection.range(r.from,r.to)))}function jet(e){let t=ID.parse(e);return(r,n,i,a)=>{let{text:o,ranges:s}=t.instantiate(r.state,i),l={changes:{from:i,to:a,insert:ea.Text.of(o)}};if(s.length&&(l.selection=kZ(s,0)),s.length>1){let u=new Gv(s,0),c=l.effects=[RD.of(u)];r.state.field(BD,!1)===void 0&&c.push(ea.StateEffect.appendConfig.of([BD,Pet,Iet,Cet]))}r.dispatch(r.state.update(l))}}function p6e(e){return({state:t,dispatch:r})=>{let n=t.field(BD,!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:kZ(n.ranges,i),effects:RD.of(a?null:new Gv(n.ranges,i))})),!0}}var Net=({state:e,dispatch:t})=>e.field(BD,!1)?(t(e.update({effects:RD.of(null)})),!0):!1,Tet=p6e(1),Fet=p6e(-1),_et=[{key:"Tab",run:Tet,shift:Fet},{key:"Escape",run:Net}],c6e=ea.Facet.define({combine(e){return e.length?e[0]:_et}}),Pet=ea.Prec.highest(il.keymap.compute([c6e],e=>e.facet(c6e)));function Qv(e,t){return Object.assign(Object.assign({},t),{apply:jet(e)})}var Iet=il.EditorView.domEventHandlers({mousedown(e,t){let r=t.state.field(BD,!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:kZ(r.ranges,i.field),effects:RD.of(r.ranges.some(a=>a.field>i.field)?new Gv(r.ranges,i.field):null)}),!0)}});var m6e=new class extends ea.RangeValue{};m6e.startSide=1;m6e.endSide=-1;var mvr=typeof navigator=="object"&&/Android\b/.test(navigator.userAgent);var Bet=[Qv("function ${name}(${params}) {\n ${}\n}",{label:"function",detail:"definition",type:"keyword"}),Qv("for (let ${index} = 0; ${index} < ${bound}; ${index}++) {\n ${}\n}",{label:"for",detail:"loop",type:"keyword"}),Qv("for (let ${name} of ${collection}) {\n ${}\n}",{label:"for",detail:"of loop",type:"keyword"}),Qv(`try { + return days + ":" + hours + ":" + minutes + ':' + seconds;`},types:{date:"date",value:"string"},actions:{onRun:"setTimeout(() => $saveState({}), 1000)"}}}]},Fv={id:"button",def:{id:"button",icon:"ui//mouse-pointer-click",description:W.frames.button.description},node:{icon:"ui//mouse-pointer-click",schemaId:"button",parentId:"",name:W.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:W.properties.super.whenClicked,icon:"ui//mouse-pointer-click"}),actionValue:JSON.stringify({name:W.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:[{...Za,node:{...Za.node,props:{value:"button.props.icon"},styles:{"--icon-size":'button.props.iconSize+"px"'}}},{...mn,node:{...mn.node,props:{value:"button.props.label"}}}]},k9={id:"tabs",def:{id:"tabs",icon:"ui//tabs"},node:{icon:"ui//tabs",schemaId:"tabs",parentId:"",name:W.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({...w9,children:[ct({...S9,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"},{})]},wh={id:"field",def:{id:"field",description:W.frames.field.description},node:{schemaId:"field",parentId:"",name:W.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(Za,{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(Za,{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({...w9,children:[ct({...S9,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(Za,{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'"})]},C9={id:"rating",def:{id:"rating",icon:"ui//star"},node:{icon:"ui//star",schemaId:"rating",parentId:"",name:W.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(Za,{value:"$root.props.icon"},{width:"$root.styles.height",height:"$root.styles.height",hidden:"$root.props.value < 1"}),ct(Za,{value:"$root.props.icon"},{width:"$root.styles.height",height:"$root.styles.height",hidden:"$root.props.value < 2"}),ct(Za,{value:"$root.props.icon"},{width:"$root.styles.height",height:"$root.styles.height",hidden:"$root.props.value < 3"}),ct(Za,{value:"$root.props.icon"},{width:"$root.styles.height",height:"$root.styles.height",hidden:"$root.props.value < 4"}),ct(Za,{value:"$root.props.icon"},{width:"$root.styles.height",height:"$root.styles.height",hidden:"$root.props.value < 5"})]},D9={id:"callout",def:{id:"callout",icon:"ui//callout"},node:{icon:"ui//callout",schemaId:"callout",parentId:"",name:W.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(Za,{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'"})]},O9={id:"toggle",def:{id:"toggle",icon:"ui//collapse-solid",description:W.frames.toggle.description},node:{icon:"ui//collapse-solid",schemaId:"toggle",parentId:"",name:W.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({...Tv,children:[ct({...Rc,children:[ct({...Wi,node:{...Wi.node,ref:"icon"}},{},{transform:"'rotate(90deg)'"})]},{value:"true"}),ct({...Rc,children:[ct({...Wi,node:{...Wi.node,ref:"icon"}},{},{transform:"'rotate(0deg)'"})]},{value:"false"})]},{value:"'value'"}),ct({...hn,children:[{...Za,node:{...Za.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"})]},M9={id:"progress",def:{id:"progress",icon:"ui//pie-chart"},node:{icon:"ui//pie-chart",schemaId:"progress",parentId:"",name:W.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'"}}}]},j9={id:"circularProgress",def:{id:"circularProgress",icon:"ui//pie-chart"},node:{icon:"ui//pie-chart",schemaId:"circularProgress",parentId:"",name:W.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%'"})]},Opr={id:"card",def:{id:"card",icon:"ui//mouse-pointer-click"},node:{icon:"ui//mouse-pointer-click",schemaId:"card",parentId:"",name:W.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:[{...Za,node:{...Za.node,props:{value:"card.props.icon"}}},{...mn,node:{...mn.node,props:{value:"card.props.label"}}}]},_Ee={id:"link",def:{id:"link",icon:"ui//link"},node:{icon:"ui//link",schemaId:"link",parentId:"",name:W.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:[{...Za,node:{...Za.node,props:{value:"link.props.sticker"},styles:{width:"'18px'",height:"'18px'"}}},{...mn,node:{...mn.node,props:{value:"link.props.label"}}}]};var Hi=(0,Nl.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}),IEe=e=>{let{spaceInfo:t}=(0,Nl.useContext)(ur),[r,n]=(0,Nl.useState)(null),[i,a]=(0,Nl.useState)(null),{frameSchema:o,saveFrame:s,frameSchemas:l,tableData:u,getMDBData:c}=(0,Nl.useContext)(Aa),f=(0,Nl.useMemo)(()=>{if(!o)return[];let D=u?.rows.map(q=>q.id==o.id?{...V1(q),types:u.cols.reduce((z,I)=>({...z,[I.name]:I.type}),{}),propsValue:u.cols.reduce((z,I)=>({...z,[I.name]:I.value}),{})}:V1(q))??[],P=oL(o);return D.some(q=>q.id==P.id)?D:[...D,P]},[u,o]),[d,p]=(0,Nl.useState)(null),h=(0,Nl.useMemo)(()=>{let D=[...m0(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 sL(o,[...u?.cols??[],...(e.cols??[]).map(P=>({...P,schemaId:o.id}))],f,e.superstate,{editMode:e.editMode,screenType:e.superstate.ui.getScreenType()});nj(D,d)&&p(D)}},g=D=>{D.path==t.path&&(!D.schemaId||D.schemaId==o?.id)&&m()};(0,Nl.useEffect)(()=>(e.superstate.eventsDispatcher.addListener("frameStateUpdated",g),()=>{e.superstate.eventsDispatcher.removeListener("frameStateUpdated",g)}),[t]),(0,Nl.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({...Wi.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=Hs(q,z,P).map((L,_)=>({...L,rank:_}));j(T)},S=(D,P)=>{let q=D[0].id==o.id?"":D[0].parentId,z={...W1(hn,q,f,o.id)},I=D.map(T=>{let L=PEe.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=ji(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||!FEe.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=>V1(Q)),L=l.find(Q=>Q.id==P),_=T.find(Q=>Q.id==D);if(!L||!_)return;let Y=await Ck(_,T,e.superstate,0,!1,{editMode:e.editMode}).then(Q=>Q[0]),oe=G1(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 Ck(D,f,e.superstate,0,!1,{editMode:e.editMode},!0).then(T=>T[0]),q=pc(d,D.id),z=[],I=G1(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 Nl.default.createElement(Hi.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 ob=Ae(Te());var PY=ob.default.createContext({root:null,path:null}),N9=e=>{let[t,r]=(0,ob.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=>tj(e.superstate,a,{...d0,screenType:e.superstate.ui.getScreenType()})).then(a=>r(a))}};return(0,ob.useEffect)(()=>(e.superstate.eventsDispatcher.addListener("frameStateUpdated",n),n({path:e.path.basePath}),()=>{e.superstate.eventsDispatcher.removeListener("frameStateUpdated",n)}),[e.path]),ob.default.createElement(PY.Provider,{value:{root:t,path:e.path.fullPath}},e.children)};var Ii=(0,Ua.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,Ua.useState)(null),[n,i]=(0,Ua.useState)({state:{},id:null,root:null,exec:null,slides:{},contexts:{}}),[a,o]=(0,Ua.useState)(e.props);(0,Ua.useEffect)(()=>{o(x=>_v.default.isEqual(x,e.props)?x:e.props)},[e.props]);let{selectedSlide:s}=(0,Ua.useContext)(Hi),l=e.editable?s:null,{root:u}=(0,Ua.useContext)(Hi),{root:c,path:f}=(0,Ua.useContext)(PY),d=(0,Ua.useMemo)(()=>e.editable?u:c,[e.editable,u,c]),p=(0,Ua.useRef)(null),h=(0,Ua.useRef)(null),m=(0,Ua.useMemo)(()=>Object.keys(e.propSetters||{}),[e.propSetters]),g=(x,w)=>{let{root:S,exec:k,id:j,state:O}=w;if(Ite(x,"$root",k.id),p.current!=j)return;let{$api:C,...N}=O;ZB(k,{state:O,newState:aL(x,a,k.id),prevState:_v.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,Ua.useEffect)(()=>{n?.root&&e.propSetters&&ire(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,Ua.useRef)({}),b=x=>{i(w=>({...w,state:x}))};(0,Ua.useEffect)(()=>()=>{p.current=null},[]);let v=()=>{if(d){let x=_v.default.cloneDeep(d),w=(0,_v.uniqueId)();p.current=w,ZB(x,{prevState:{},state:{},newState:aL({},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,Ua.useEffect)(()=>{n.root&&!nj(d,n.root)&&(0,_v.isEqual)(e.contexts,n.contexts)?g({[n.root.id]:{props:a}},n):v()},[a,d,e.contexts]),Ua.default.createElement(Ii.Provider,{value:{id:e.id,linkedProps:m,hoverNode:t,setHoverNode:r,selectableNodeBounds:A,runRoot:v,instance:n,saveState:g,fastSaveState:b}},e.children)};var Vi=(0,Tl.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:""}),Pv=e=>{let{selection:t,selectionMode:r,setIsParentToSelection:n}=(0,Tl.useContext)(Vi),{spaceState:i}=(0,Tl.useContext)(ur),a=(0,Tl.useMemo)(()=>t.includes(e.id)||e.selected,[t,e.id,e.selected]),o=(0,Tl.useMemo)(()=>i?.metadata.readMode?0:e.editMode??0,[e.editMode,i]),{instance:s}=(0,Tl.useContext)(Ii),[l,u]=(0,Tl.useState)([]),[c,f]=(0,Tl.useState)(!1),d=(0,Tl.useMemo)(()=>!!(l.length>0||c||a&&o>=3||o==1),[a,o,l,c]);(0,Tl.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 Tl.default.createElement(Vi.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 Z6e=Ae(bi());var ra=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{let t=_r(e.superstate,e.date,e.mode=="day"?"MMMM d":"MMMM");return Iv.default.createElement("div",{className:"mk-calendar-header"},Iv.default.createElement("div",{className:"mk-calendar-header-title"},Iv.default.createElement("span",null,t),_r(e.superstate,e.date,"yyyy")),Iv.default.createElement("span",null),Iv.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)))}}),Iv.default.createElement("button",{onClick:()=>{e.setDate(new Date)}},"Today"),Iv.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 IY=Ae(Te());var T9=e=>{let{attributes:t,listeners:r,setNodeRef:n,transform:i}=Ws({id:"event-"+e.index,data:{type:"event",index:e.index}});return IY.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`}},IY.default.createElement(oo,{superstate:e.superstate,path:e.data[mt]}))};var hD=Ae(Te()),F9=e=>hD.default.createElement("div",{className:"mk-day-view-gutter"},e.allDay&&hD.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 hD.default.createElement("div",{key:n,className:"mk-day-view-hour-title"},hD.default.createElement("span",null,n%12===0?12:n%12)," ",n<12?"AM":"PM")}));var So=Ae(Te());var Yu=Ae(Te()),rl=e=>{let[t,r]=(0,Yu.useState)(null),n=(0,Yu.useRef)(e.value),i=(0,Yu.useRef)(e.value),[,a]=(0,Yu.useState)([0,0]),o=e.step??1,s=(0,Yu.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,Yu.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,Yu.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,Yu.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)}),[]),Yu.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"}},Yu.default.createElement("span",null))};var AD=e=>{let{event:t,hourHeight:r,startHour:n}=e,{spaceState:i}=(0,So.useContext)(ur),{attributes:a,listeners:o,setNodeRef:s,transform:l}=Ws({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??XE(Vn(new Date),e.event.startOffset),m=t.end??XE(Vn(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(rl,{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(rl,{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 _9=e=>{let{hourHeight:t}=e,[r,n]=(0,$c.useState)(e.date??Vn(new Date)),{source:i}=(0,$c.useContext)(Ta),[a,o]=(0,$c.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=ir(L[z]),oe=[],te=Zi(L[P]);if(te>=D&&te<=Ea(D,{days:1})&&oe.push(L),Y&&Y.freq){let Q=Zi(L[q]).getTime()-te.getTime(),fe={dtstart:te,freq:Y.freq&&LM(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((Zi(Y.until)??Ea(D,{days:1})).getTime(),Ea(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,Ea(D,{days:1}),!0).forEach(Oe=>{Oe.getTime()!=te.getTime()&&oe.push({...L,[P]:_r(e.superstate,Oe,qs),[q]:_r(e.superstate,ad(Oe,Q),qs)})})}oe.forEach(Q=>{let fe=Vn(r).getTime(),Ie=Ea(r,{days:1}).getTime(),Se=Zi(Q[P]),Oe=Zi(Q[q])?Zi(Q[q]):Vn(Se).getTime()==Se.getTime()?Se:Ea(Se,{hours:1}),ve=Math.max(l*60,(Se.getTime()-fe)/6e4),ye=Math.min(Oe.getTime()-fe,Ie-fe)/6e4;if(Se.getTime()==Vn(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,$c.useState)(null),[h,m]=(0,$c.useState)(null),[g,A]=(0,$c.useState)(null),[b,v]=(0,$c.useState)(null),x=()=>{p(null),m(null),A(null),v(null)},w=N=>Math.round(N/15)*15;Da({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=Ea(r,{minutes:Math.round(w(P.startOffset+g/t*60))}),z=Ea(r,{minutes:Math.round(w(P.endOffset+g/t*60))});e.updateItem({...e.data[D],[e.field]:_r(e.superstate,q,qs),[e.fieldEnd]:_r(e.superstate,z,qs)})}else if(h){let D=Ea(r,{minutes:Math.round(g/t*60)}),P=Ea(r,{minutes:Math.round(g/t*60)+60});e.insertItem({[e.field]:_r(e.superstate,D,qs),[e.fieldEnd]:_r(e.superstate,P,qs),[mt]:h})}x()}});let{setNodeRef:S}=Lu({id:s,data:{type:"day-view",date:r}}),k=new Date().toDateString()===r.toDateString(),[j,O]=(0,$c.useState)(0),C=f.find(N=>N.index==d);return(0,$c.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)}},[]),Fl.default.createElement("div",{className:"mk-day-view-container",style:{"--hour-height":`${t}px`}},e.header&&Fl.default.createElement(k2,{superstate:e.superstate,date:r,mode:"day",setDate:n}),e.gutter&&Fl.default.createElement("div",{className:"mk-day-view-all-day"},Fl.default.createElement("div",{className:"mk-day-view-gutter"},Fl.default.createElement("div",{className:"mk-day-view-hour-title"},"all day")),Fl.default.createElement("div",{className:"mk-day-view-hour"},f.filter(N=>N.allDay).map((N,D)=>Fl.default.createElement(T9,{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"}})))),Fl.default.createElement("div",{className:"mk-day-view"},e.gutter&&Fl.default.createElement(F9,{hourHeight:t,startHour:l,endHour:c}),Fl.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=Ea(r,{minutes:a.startOffset}),P=Ea(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,qs),[e.fieldEnd]:_r(e.superstate,P,qs),[mt]:z})},i),o(null)}},Array.from({length:c-l}).map((N,D)=>Fl.default.createElement("div",{key:D,className:"mk-day-view-hour"})),k&&j>0&&Fl.default.createElement("div",{className:"mk-day-view-hour-current",style:{top:`${j*t/60}px`}}),f.filter(N=>!N.allDay).map((N,D)=>Fl.default.createElement(AD,{superstate:e.superstate,key:D,event:N,item:e.data[N.index],hourHeight:t,startHour:l,updateStartEnd:(P,q)=>{let z=Ea(r,{minutes:P}),I=Ea(r,{minutes:q});e.updateItem({...e.data[N.index],[e.field]:_r(e.superstate,z,qs),[e.fieldEnd]:_r(e.superstate,I,qs)})}})),a&&a.endOffset>a.startOffset&&Fl.default.createElement(AD,{superstate:e.superstate,event:a,item:{},hourHeight:t,startHour:l,clone:!0}),d!==null&&C?Fl.default.createElement(AD,{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?Fl.default.createElement(AD,{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 _l=Ae(Te());var Pf=Ae(Te()),REe=Ae(bl());var BY=Ae(Te()),BEe=e=>{let{attributes:t,listeners:r,setNodeRef:n,transform:i}=Ws({id:"day-"+e.date.getTime(),data:{type:"day",date:e.date.getTime()}}),{setNodeRef:a}=Lu({id:"day-"+e.date.getTime(),data:{type:"day",weekStart:e.weekStart.getTime(),date:e.date.getTime()}}),o=e.date.toDateString()===new Date().toDateString(),s=J5(a,n);return BY.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"}},BY.default.createElement("div",{className:"mk-month-day-number"},e.date.getDate()),e.children)};var sb=Ae(Te());var RY=e=>{let{attributes:t,listeners:r,setNodeRef:n,transform:i}=Ws({id:"event-"+e.index,data:{type:"event",index:e.index}}),a=(0,sb.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 sb.default.createElement("div",{className:"mk-month-event",ref:n,style:e.style,...t,...r},!e.allDay&&sb.default.createElement("div",{className:"mk-day-block-inner-indicator"}),sb.default.createElement(oo,{superstate:e.superstate,path:e.data[mt],hideIcon:!0}),sb.default.createElement("div",{className:"mk-day-block-time"},a))};var $Ee=e=>{let t=mo(e.date),r=gA(t),{source:n}=(0,Pf.useContext)(Ta),i=(0,Pf.useMemo)(()=>{let u=[];return e.events.forEach((c,f)=>{let d=[],p=ir(c[e.fieldRepeat]),h=Zi(c[e.field]),m=Zi(c[e.fieldEnd])??h;if(h<=Mx(r)&&m>=Vn(t)&&d.push(c),p&&p.freq){let g=Zi(c[e.fieldEnd]).getTime()-h.getTime(),A={dtstart:h,freq:p.freq&&LM(p.freq),count:p.count&&Math.min(p.count,100),interval:parseInt(p.interval),byweekday:p.byweekday&&p.byweekday.map(x=>Xx(x)),until:Zi(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(Vn(t),Mx(r),!0).forEach(x=>{x.getTime()!=h.getTime()&&d.push({...c,[e.field]:_r(e.superstate,x,qs),[e.fieldEnd]:_r(e.superstate,ad(x,g),qs)})})}d.forEach(g=>{let A=Zi(g[e.field]),b=Zi(g[e.fieldEnd]),v=b||(Vn(A).getTime()==A.getTime()?Vn(A):Ox(A,1)),x=A>t?A:t,w=vc.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,Pf.useState)(null),[s,l]=(0,Pf.useState)(null);return Da({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)}}),Pf.default.createElement("div",{className:"mk-month-week"},Array.from({length:7}).map((u,c)=>{let f=Ea(t,{days:c}),d=f.getMonth()===e.date.getMonth();return Pf.default.createElement(BEe,{key:c,superstate:e.superstate,weekStart:t,active:d,date:f,insertItem:p=>{let h=i.reduce((v,x)=>{let w=Zi(e.events[x.index])?.getHours();return w>v?w:v},9),m=_r(e.superstate,Ox(Vn(f),h),qs),g=_r(e.superstate,Ox(Vn(f),h+1),qs),A=i.reduce((v,x)=>x.endDay>=c?v+1:v,0);o({offset:A,index:-1,startDay:c,endDay:c,startTime:Vn(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&&Pf.default.createElement(RY,{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 Pf.default.createElement(RY,{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,REe.createPortal)(Pf.default.createElement(Um,{dropAnimation:HU}),document.body))};var qEe=e=>{let[t,r]=(0,_l.useState)(e.date??new Date),n=(0,_l.useMemo)(()=>{let o=Wo(t),s=t0(t),l=[],u=o;for(;u<=s;)l.push(u),u=Jg(u,1);return l},[t]),[i,a]=(0,_l.useState)(null);return Da({onDragStart:o=>{a(o.active.id)},onDragEnd:o=>{a(null)}}),_l.default.createElement("div",{className:"mk-month-grid"},e.header&&_l.default.createElement(k2,{superstate:e.superstate,date:t,setDate:r,mode:"month"}),_l.default.createElement("div",{className:"mk-month-header"},_l.default.createElement("div",null,"S"),_l.default.createElement("div",null,"M"),_l.default.createElement("div",null,"T"),_l.default.createElement("div",null,"W"),_l.default.createElement("div",null,"T"),_l.default.createElement("div",null,"F"),_l.default.createElement("div",null,"S")),n.map((o,s)=>_l.default.createElement($Ee,{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 Es=Ae(Te());var P9=Ae(Te());var LEe=e=>{let{source:t}=(0,P9.useContext)(Ta),{setNodeRef:r}=Lu({id:"allday-"+e.date.toISOString()});return P9.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 zEe=e=>{let t=e.hourHeight,[r,n]=(0,Es.useState)(e.weekStart??mo(new Date)),i=e.startHour??0,a=e.endHour??24,[o,s]=(0,Es.useState)(0),l=(0,Es.useMemo)(()=>{let u=[];e.data.forEach((f,d)=>{let p=Zi(f[e.field]),h=Zi(f[e.fieldEnd])??p;h>=r&&p<=Ea(r,{days:7})&&Vn(p).getTime()==p.getTime()&&Vn(h).getTime()==h.getTime()&&u.push({index:d,startDay:new Date(Math.max(r.getTime(),p.getTime())).getDay(),endDay:new Date(Math.min(Ea(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 Es.default.createElement("div",{className:"mk-week-view",style:{"--hour-height":`${t}px`}},e.header&&Es.default.createElement(k2,{superstate:e.superstate,date:r,mode:"week",setDate:n}),Es.default.createElement("div",{className:"mk-week-view-header"},Es.default.createElement("div",{className:"mk-day-view-gutter"}),Array.from({length:7}).map((u,c)=>Es.default.createElement("div",{key:c},_r(e.superstate,Ea(r,{days:c}),"EEE d")))),Es.default.createElement("div",{className:"mk-week-view-all-day"},Es.default.createElement("div",{className:"mk-day-view-gutter"},Es.default.createElement("div",{className:"mk-day-view-hour-title",style:{height:`${o*30}px`}},"all day")),Array.from({length:7}).map((u,c)=>Es.default.createElement(LEe,{key:c,height:o+1,superstate:e.superstate,date:la(r,c),insertItem:f=>{e.insertItem({[e.field]:_r(e.superstate,la(r,c),"yyyy-MM-dd"),[e.fieldEnd]:_r(e.superstate,la(r,c),"yyyy-MM-dd"),[mt]:f})}},l.filter(f=>f.startDay==c).map((f,d)=>Es.default.createElement(T9,{superstate:e.superstate,data:e.data[f.index],index:f.index,startDay:f.startDay,endDay:f.endDay,topOffset:f.topOffset,key:d}))))),Es.default.createElement("div",{className:"mk-week-view-content"},Es.default.createElement(F9,{hourHeight:t,startHour:i,endHour:a}),Array.from({length:7}).map((u,c)=>Es.default.createElement(_9,{superstate:e.superstate,key:_r(e.superstate,Ea(r,{days:c})),field:e.field,fieldEnd:e.fieldEnd,fieldRepeat:e.fieldRepeat,date:Ea(r,{days:c}),data:e.data,hourHeight:t,startHour:i,endHour:a,insertItem:f=>{e.insertItem(f)},updateItem:f=>{e.updateItem(f)}}))))};var G6e=Ae(bi()),$o=Ae(Te());var cJe=e=>e.node.type=="column"&&e.children.length==1,fJe=e=>e.node.type=="container"&&e.children.length==1,dJe=e=>e.node.type=="container"&&e.children.length==2,gD=(e,t,r,n,i)=>{let a=e;if(a.schemaId!=r.id){a=sf("$root",r.id,a,r.id);let d=ji(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={...W1(ore,u.id,n,l),rank:t.node.rank},v={...W1(ij,b.id,[...n,b],l),rank:i=="left"?1:0},x={...W1(ij,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={...W1(ij,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&&cJe(c)){let d=pc(r,c.id);if(s.push(c.node),fJe(d))s.push(d.node);else if(dJe(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 Rl=Ae(Te());var PZ=Ae(Qa());var C2=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 zt=Ae(Te()),V6e=Ae(bl());var Gd=Ae(Te());var UEe=e=>{let{groupNodes:t,saveNodes:r,nodes:n}=(0,Gd.useContext)(Hi),{selection:i,select:a}=(0,Gd.useContext)(Vi),o=i.map(s=>n.find(l=>l.id==s)).filter(s=>s);return Gd.default.createElement("div",{className:"mk-editor-frame-node-selector",style:{pointerEvents:"auto"},onClick:s=>s.stopPropagation()},Gd.default.createElement("div",{className:"mk-editor-frame-node-button"},Gd.default.createElement("div",{dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//copy-check")}}),W.labels.itemsSelected.replace("${1}",i.length.toString())),Gd.default.createElement("div",{className:"mk-divider"}),Gd.default.createElement("div",{"aria-label":W.editor.createVerticalSection,className:"mk-editor-frame-node-button",dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//rows")},onClick:()=>t(o,{layoutAlign:'"left"',gap:'"8px"'})}),Gd.default.createElement("div",{"aria-label":W.editor.createHorizontalSection,className:"mk-editor-frame-node-button ",dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//columns")},onClick:()=>t(o,{layout:'"row"',gap:'"8px"'})}),Gd.default.createElement("div",{className:"mk-divider"}),Gd.default.createElement("div",{className:"mk-editor-frame-node-button ","aria-label":W.menu.delete,onClick:()=>r([],o),dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//trash")}}))};var or=Ae(Te());var I9={table:{name:W.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:W.menu.listView,icon:"ui//list",view:"list",listView:"spaces://$kit/#*listView",listGroup:"spaces://$kit/#*listGroup",listItem:"spaces://$kit/#*rowItem"},details:{name:W.menu.detailsView,icon:"ui//layout-grid",view:"list",listView:"spaces://$kit/#*listView",listGroup:"spaces://$kit/#*listGroup",listItem:"spaces://$kit/#*detailItem"},board:{name:W.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:W.menu.cardView,icon:"ui//layout-dashboard",view:"list",listView:"spaces://$kit/#*listView",listGroup:"spaces://$kit/#*gridGroup",listItem:"spaces://$kit/#*cardsListItem"},catalog:{name:W.menu.catalogView,icon:"ui//gallery-horizontal-end",view:"list",listView:"spaces://$kit/#*listView",listGroup:"spaces://$kit/#*rowGroup",listItem:"spaces://$kit/#*coverListItem"},gallery:{name:W.menu.galleryView,icon:"ui//layout-dashboard",view:"list",listView:"spaces://$kit/#*listView",listGroup:"spaces://$kit/#*masonryGroup",listItem:"spaces://$kit/#*imageListItem"},flow:{name:W.menu.flowView,icon:"ui//edit",view:"list",listView:"spaces://$kit/#*listView",listGroup:"spaces://$kit/#*listGroup",listItem:"spaces://$kit/#*flowListItem"}};var pJe=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"}},vD=async(e,t,r)=>{let n=r=="board"?"Board":"Table",i=await e.spaceManager.tablesForSpace(t);return i&&(n=ji(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:ji(n,s?.map(u=>u.id)??[]),name:n,type:"view",predicate:JSON.stringify({...Vy,...r?pJe(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 D2=(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 vD(r,n.path);i({...p0.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:W.commands.newNote,value:"presetnote",onClick:()=>{o("note")},icon:"ui//mk-make-flow"},{name:W.commands.internalLink,value:"presetlink",onClick:()=>{o("link")},icon:"ui//mk-make-link"},{name:W.commands.table,value:"presettable",onClick:()=>{o("table")},icon:"ui//mk-make-table"}],c=async m=>{let g=await r.spaceManager.framesForSpace(n.path),A=ji(m,g.map(x=>x.id)),b=I9[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,()=>wp(v)).then(()=>i({...p0.node,props:{value:jr(`./#*${v.id}`)}}))},f=Object.keys(I9).map(m=>{let g=I9[m];return{name:g.name,value:g.view,onClick:()=>{c(m)},icon:g.icon}}),d=[mn,uf,E9,Za,hn],p=[Fv,C9,O9,D9,M9,j9,k9],h=[...u,{name:"List View",value:"frame",type:6,onSubmenu:m=>r.ui.openMenu(m,Zt(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 WEe=Ae(Te());var B9=e=>{let t=(r,n)=>{let i=o=>{e.setValue(o)},a=r.target.getBoundingClientRect();Vu(e.superstate,a,Ne(r.view.document),e.value,i)};return WEe.default.createElement("div",{className:"mk-color",style:{background:e.value},onClick:r=>{t(r,"--text-normal")}})};var Bo=Ae(Te());var HEe=Ae(bi()),so=Ae(Te());function mJe(e){if(Math.floor(e)===e)return 0;let t=e.toString();return t.split(".")[1].length||t.split(",")[1].length||0}function VEe({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,HEe.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=mJe(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 ba=e=>{let t=e.value&&_u(e.value)?Sa(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,Zt(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(VEe,{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 yD=Ae(Te()),GEe=e=>{let t=["nw","n","ne","w","m","e","sw","s","se"],[r,n]=(0,yD.useState)(e.state?.styles?.layoutAlign);return yD.default.createElement("div",{className:"mk-editor-alignment-menu"},t.map(i=>yD.default.createElement("div",{className:`mk-editor-alignment-selector ${r==i&&"mk-active"}`,key:"d",onClick:()=>{n(i),e.saveStyleValue("layoutAlign",jr(i))}})))};var QEe=e=>{let{spaceInfo:t}=(0,Bo.useContext)(ur),{addNode:r}=(0,Bo.useContext)(Hi),{select:n}=(0,Bo.useContext)(Vi),{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=>{D2(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:W.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:W.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:W.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(GEe,{...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",`${Sa(i.styles.flexWrap)=="wrap"?"":jr("wrap")}`)},dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//wrap-text")}}),Bo.default.createElement(ba,{superstate:e.superstate,name:W.editor.gap,value:i.styles?.gap,setValue:o=>a("gap",o),units:["px"]})):Bo.default.createElement(Bo.default.Fragment,null,Bo.default.createElement(ba,{superstate:e.superstate,name:W.editor.columns,value:i.styles?.columnCount,min:0,setValue:o=>a("columnCount",o),units:[""]})))};var fb=Ae(Te());var lb=Ae(Te());var YEe=e=>{let{selectedNode:t,saveStyleValue:r}=e;return lb.default.createElement(lb.default.Fragment,null,lb.default.createElement("div",{className:"mk-divider"}),lb.default.createElement(ba,{superstate:e.superstate,name:W.editor.width,min:0,value:t.styles?.width,setValue:n=>r("width",n),units:["px","%","em"]}),lb.default.createElement("div",{className:"mk-divider"}),lb.default.createElement(ba,{superstate:e.superstate,name:W.editor.height,min:0,value:t.styles?.height,setValue:n=>r("height",n),units:["px","%","em"]}))};var dg=Ae(Te());var ub=Ae(Te());var ZEe=e=>{let{selectedNode:t,saveStyleValue:r}=e;return ub.default.createElement(ub.default.Fragment,null,ub.default.createElement(ba,{superstate:e.superstate,name:W.editor.marginLeft,value:t.styles?.marginLeft,setValue:n=>r("marginLeft",n),units:["px","em"]}),ub.default.createElement(ba,{superstate:e.superstate,name:W.editor.marginTop,value:t.styles?.marginTop,setValue:n=>r("marginTop",n),units:["px","em"]}),ub.default.createElement(ba,{superstate:e.superstate,name:W.editor.marginRight,value:t.styles?.marginRight,setValue:n=>r("marginRight",n),units:["px","em"]}),ub.default.createElement(ba,{superstate:e.superstate,name:W.editor.marginBottom,value:t.styles?.marginBottom,setValue:n=>r("marginBottom",n),units:["px","em"]}))};var cb=Ae(Te());var XEe=e=>{let{selectedNode:t,saveStyleValue:r}=e;return cb.default.createElement(cb.default.Fragment,null,cb.default.createElement(ba,{superstate:e.superstate,name:W.editor.paddingLeft,value:t.styles?.paddingLeft,setValue:n=>r("paddingLeft",n),units:["px","em"]}),cb.default.createElement(ba,{superstate:e.superstate,name:W.editor.paddingTop,min:0,value:t.styles?.paddingTop,setValue:n=>r("paddingTop",n),units:["px","em"]}),cb.default.createElement(ba,{superstate:e.superstate,name:W.editor.paddingRight,min:0,value:t.styles?.paddingRight,setValue:n=>r("paddingRight",n),units:["px","em"]}),cb.default.createElement(ba,{superstate:e.superstate,name:W.editor.paddingBottom,min:0,value:t.styles?.paddingBottom,setValue:n=>r("paddingBottom",n),units:["px","em"]}))};var KEe=e=>{let{selectedNode:t,saveStyleValue:r}=e,n=a=>{let o=a.target.getBoundingClientRect();return e.superstate.ui.openCustomMenu(o,dg.default.createElement(XEe,{...e}),e,Ne(a.view.document))},i=a=>{let o=a.target.getBoundingClientRect();return e.superstate.ui.openCustomMenu(o,dg.default.createElement(ZEe,{...e}),e,Ne(a.view.document))};return dg.default.createElement(dg.default.Fragment,null,dg.default.createElement(ba,{superstate:e.superstate,name:W.editor.margin,value:t.styles?.margin,setValue:a=>r("margin",a),units:["px","em"]}),dg.default.createElement("div",{dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//plus")},onClick:a=>{i(a)}}),dg.default.createElement(ba,{superstate:e.superstate,name:W.editor.padding,min:0,value:t.styles?.padding,setValue:a=>r("padding",a),units:["px","em"]}),dg.default.createElement("div",{dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//plus")},onClick:a=>{n(a)}}))};var JEe=e=>{let{selectedNode:t,saveStyleValue:r}=e,n=(i,a)=>{let o=a=="icon"?"iconSize":"imageSize",s=[];s.push({name:W.labels.styleSmall,icon:"type",onClick:()=>{r(o,"'s'")}}),s.push({name:W.labels.styleMedium,icon:"type",onClick:()=>{r(o,"'m'")}}),s.push({name:W.labels.styleLarge,icon:"type",onClick:()=>{r(o,"'l'")}});let l=i.target.getBoundingClientRect();e.superstate.ui.openMenu(l,Zt(e.superstate.ui,s),Ne(i.view.document))};return fb.default.createElement(fb.default.Fragment,null,fb.default.createElement("div",{className:"mk-divider"}),fb.default.createElement(KEe,{...e}),fb.default.createElement(YEe,{...e}),fb.default.createElement("div",{className:"mk-divider"}))};var R9=Ae(Te());var eke=e=>{let{selectedNode:t,saveStyleValue:r}=e;return R9.default.createElement(R9.default.Fragment,null,R9.default.createElement(Io,{superstate:e.superstate,name:W.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 tke=Ae(Qa());var Ro=Ae(Te());var rke=e=>{let{selectedNode:t,pathState:r,savePropValue:n,frameProps:i,fields:a,frameProperties:o,instance:s}=e,l=(d,p)=>{d.preventDefault();let h=_u(i?.[p.name]),m=[];h||(m.push({name:W.editor.unlinkProperty,icon:"ui//unplug",onClick:()=>{n(p.name,jr(e.state.props?.[p.name]))}}),m.push(qt));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"?W.editor.currentSpace:v;Object.keys(s.state.$contexts).forEach(v=>{Boe(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:Ri(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:Ri(x),description:A(v),onClick:()=>{n(p.name,`$api.path.label($contexts['${v}']['${x.name}'])?.sticker`)}}),p.type=="text"&&m.push({name:W.editor.linkName.replace("${1}",Vo(x,e.superstate)),icon:Ri(x),description:A(v),onClick:()=>{n(p.name,`$api.path.label($contexts['${v}']['${x.name}'])?.name`)}}),p.type=="image"&&m.push({name:W.editor.linkThumbnail.replace("${1}",Vo(x,e.superstate)),icon:Ri(x),description:A(v),onClick:()=>{n(p.name,`$api.path.label($contexts['${v}']['${x.name}'])?.thumbnail`)}})))}),m.push(qt)}),o.filter(v=>g.some(x=>x==v.type)).forEach(v=>{m.push({name:v.name,icon:Ri(v),onClick:()=>{n(p.name,`${v.schemaId}.props['${v.name}']`)}})}),m.push(qt),o.filter(v=>v.type!=p.type).forEach(v=>{(v.type=="link"||v.type=="image"||v.type=="file")&&(p.type=="icon"&&m.push({name:W.editor.linkSticker.replace("${1}",Vo(v,e.superstate)),icon:Ri(v),onClick:()=>{n(p.name,`$api.path.label(${v.schemaId}.props['${v.name}'])?.sticker`)}}),p.type=="image"&&m.push({name:W.editor.linkThumbnail.replace("${1}",v.name),icon:Ri(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:W.editor.linkName.replace("${1}",Vo(v,e.superstate)),icon:Ri(v),onClick:()=>{n(p.name,`$api.path.label(${v.schemaId}.props['${v.name}'])?.name`)}})});let b=d.target.getBoundingClientRect();e.superstate.ui.openMenu(b,Zt(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 tL(p);if(d.type=="option")return(mr(d.value,d.type,e.superstate,r.path).options??[]).find(g=>g.value==Sa(p))?.name??null;if(d.type=="super"){let h=mr(d.value,d.type,e.superstate);if(h.dynamic?Sa(i[h.field??""]):h.field)return p}return _u(p)?Sa(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"},W.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")?KM(i?.[d.name],d.type):d.type=="super"||_u(i?.[d.name]),m=f(d);return Ro.default.createElement(Ro.default.Fragment,{key:p},h?Ro.default.createElement(xs,{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,tke.default)("mk-path-context-row",m&&"mk-path-context-stacked")},d.type=="input"?Ro.default.createElement(A9,{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":W.editor.linkedProperty},Dk(i?.[d.name])))),Ro.default.createElement("span",null),!m&&Ro.default.createElement("div",{"aria-label":W.editor.linkProperty,className:"mk-icon-small mk-inline-button",onClick:g=>l(g,d),dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//plug")}})))})))};var O2=Ae(Te());var Bv=Ae(Te());var nke=e=>{let{selectedNode:t,saveStyleValue:r}=e,n=a=>{let o=[];o.push({name:W.editor.strokeNone,icon:"ui//type",onClick:()=>{r("outlineStyle","'none'")}}),o.push({name:W.editor.strokeSolid,icon:"ui//type",onClick:()=>{r("outlineStyle","'solid'")}}),o.push({name:W.editor.strokeDashed,icon:"ui//type",onClick:()=>{r("outlineStyle","'dashed'")}}),o.push({name:W.editor.strokeDotted,icon:"ui//type",onClick:()=>{r("outlineStyle","'dotted'")}});let s=a.target.getBoundingClientRect();e.superstate.ui.openMenu(s,Zt(e.superstate.ui,o),Ne(a.view.document))},i=(a,o)=>{let s=u=>{r(o,`'${u}'`)},l=a.target.getBoundingClientRect();Vu(e.superstate,l,Ne(a.view.document),Sa(t.styles?.[o]),s)};return Bv.default.createElement(Bv.default.Fragment,null,Bv.default.createElement("div",{className:"mk-divider"}),Bv.default.createElement("div",{className:"mk-editor-frame-node-button",onClick:a=>n(a)},Bv.default.createElement("div",{dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//case-sensitive")}}),e.state.styles?.outlineStyle??W.labels.none),Bv.default.createElement(ba,{superstate:e.superstate,name:W.editor.size,value:e.state.styles?.outlineWidth,setValue:a=>r("outlineWidth",a),units:["px","em"]}),Bv.default.createElement("div",{onClick:a=>{i(a,"outlineColor")},className:"mk-color",style:{background:e.state.styles?.outlineColor}}))};var ike=e=>{let{selectedNode:t,saveStyleValue:r}=e,n=(i,a)=>{let o=l=>{r(a,`'${l}'`)},s=i.target.getBoundingClientRect();Vu(e.superstate,s,Ne(i.view.document),Sa(e.selectedNode.styles?.[a]),o)};return O2.default.createElement(O2.default.Fragment,null,O2.default.createElement("div",{className:"mk-color",onClick:i=>n(i,"background"),style:{background:Sa(e.selectedNode.styles?.background)}}),O2.default.createElement(nke,{...e}),O2.default.createElement(ba,{superstate:e.superstate,name:W.editor.opacity,min:0,max:100,value:t.styles?.opacity,setValue:i=>r("opacity",i),units:["%"]}))};function ake(){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 nl=Ae(Te());var oke=e=>{let{selectedNode:t,saveStyleValue:r}=e,n=o=>{let s=ake().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();Vu(e.superstate,u,Ne(o.view.document),Sa(e.selectedNode.styles?.[s]),l)};return nl.default.createElement(nl.default.Fragment,null,nl.default.createElement("div",{className:"mk-editor-frame-node-button",onClick:o=>n(o)},nl.default.createElement("div",{dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//type")}}),t.styles?.["--font-text"]),nl.default.createElement("div",{className:"mk-divider"}),nl.default.createElement(ba,{superstate:e.superstate,name:W.editor.size,value:t.styles?.["--font-text-size"],setValue:o=>r("--font-text-size",o),units:["px","em"]}),nl.default.createElement(Io,{superstate:e.superstate,name:W.editor.bold,value:t.styles?.["--font-text-weight"],defaultValue:"'normal'",onValue:"'bold'",icon:"ui//bold",setValue:o=>r("--font-text-weight",o)}),nl.default.createElement(Io,{superstate:e.superstate,name:W.editor.italic,value:t.styles?.["--font-text-style"],defaultValue:"'normal'",onValue:"'italic'",icon:"ui//italic",setValue:o=>r("--font-text-style",o)}),nl.default.createElement(Io,{superstate:e.superstate,name:W.editor.underline,value:t.styles?.["--font-text-decoration"],defaultValue:"'none'",onValue:"'underline'",icon:"ui//underline",setValue:o=>r("--font-text-decoration",o)}),nl.default.createElement(B9,{superstate:e.superstate,value:Sa(t.styles?.["--font-text-color"]),setValue:o=>r("--font-text-color",`'${o}'`)}),nl.default.createElement("div",{className:"mk-divider"}),nl.default.createElement(Io,{superstate:e.superstate,name:W.editor.alignLeft,value:t.styles?.textAlign,defaultValue:"'left'",onValue:"'left'",icon:"ui//align-left",setValue:o=>r("textAlign",o)}),nl.default.createElement(Io,{superstate:e.superstate,name:W.editor.alignCenter,value:t.styles?.textAlign,defaultValue:"'center'",onValue:"'center'",icon:"ui//align-center",setValue:o=>r("textAlign",o)}),nl.default.createElement(Io,{superstate:e.superstate,name:W.editor.alignRight,value:t.styles?.textAlign,defaultValue:"'left'",onValue:"'right'",icon:"ui//align-right",setValue:o=>r("textAlign",o)}),nl.default.createElement(Io,{superstate:e.superstate,name:W.editor.alignJustify,value:t.styles?.textAlign,defaultValue:"'left'",onValue:"'justify'",icon:"ui//align-justify",setValue:o=>r("textAlign",o)}),nl.default.createElement("div",{className:"mk-divider"}),nl.default.createElement(ba,{superstate:e.superstate,name:W.editor.numberOfLines,value:t.styles?.["--line-count"],setValue:o=>r("--line-count",o),units:[""]}))};var ske=e=>{let{pathState:t}=(0,or.useContext)($r),{deleteFrame:r,duplicateFrame:n}=e,{spaceInfo:i}=(0,or.useContext)(ur),{addNode:a,ungroupNode:o,updateNode:s,saveNodes:l,frameProperties:u}=(0,or.useContext)(Hi),{selectionMode:c}=(0,or.useContext)(Vi),{instance:f}=(0,or.useContext)(Ii),d=(0,or.useCallback)((C,N)=>{s(N,{props:{...C}})},[s]),p=(C,N)=>{s(e.node,{styles:{[C]:N}})},[h,m]=(0,or.useState)(0),[g,A]=(0,or.useState)(e.node.props),b=(0,or.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,or.useEffect)(()=>{A(e.node.props)},[e.node]);let v=(0,or.useCallback)((C,N)=>{A(D=>({...D,[C]:N})),d({[C]:N},e.node)},[A,d,e.node]),x=[{type:"h1",name:W.commands.h1,icon:"ui//heading-1",class:"mk-t-h1"},{type:"h2",name:W.commands.h2,icon:"ui//heading-2",class:"mk-t-h2"},{type:"h3",name:W.commands.h3,icon:"ui//heading-3",class:"mk-t-h3"},{type:"h4",name:W.commands.h4,icon:"ui//heading-4",class:"mk-t-h4"},{type:"h5",name:W.commands.h5,icon:"ui//heading-5",class:"mk-t-h5"},{type:"h6",name:W.commands.h6,icon:"ui//heading-6",class:"mk-t-h6"},{type:"p",name:W.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,Zt(e.superstate.ui,N),Ne(C.view.document))},S=(0,or.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,or.useEffect)(()=>{S.current&&S.current.update(j)},[f,b,e.state,e.node,g]);let O=(0,or.useRef)(null);return or.default.createElement("div",{className:"mk-editor-frame-node-selector",style:{pointerEvents:"auto"},ref:O,onClick:C=>{C.preventDefault()}},e.node.type=="new"&&or.default.createElement(or.default.Fragment,null,or.default.createElement("div",{className:"mk-editor-frame-node-button-primary",dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//plus")},onClick:C=>{D2(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()}}),or.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&&Ji(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?or.default.createElement(or.default.Fragment,null,e.node.type=="group"||e.node.type=="content"?or.default.createElement(QEe,{...k}):b.length>0&&or.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(),or.default.createElement(rke,{...j}),j,Ne(C.view.document),"bottom")},dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//list")}}),e.node.type=="text"&&or.default.createElement(or.default.Fragment,null,or.default.createElement("div",{className:"mk-editor-frame-node-button",onClick:C=>w(C)},or.default.createElement("div",{dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker(x.find(C=>C.class==Sa(e.node.styles?.class))?.icon??"ui//type")}}),x.find(C=>C.class==Sa(e.node.styles?.class))?.name??"Paragraph"),or.default.createElement("div",{className:"mk-divider"})),e.node.type=="icon"&&or.default.createElement(B9,{superstate:e.superstate,value:Sa(e.node.styles?.color),setValue:C=>p("color",`'${C}'`)}),or.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")}}),or.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")&&or.default.createElement(eke,{...k}),or.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&&or.default.createElement(or.default.Fragment,null,or.default.createElement("div",{className:"mk-divider"}),or.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"})),or.default.createElement("div",{className:"mk-divider"}),e.node.type=="group"||e.node.type=="container"?or.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")}}):or.default.createElement(or.default.Fragment,null),or.default.createElement("div",{className:"mk-editor-frame-node-button","aria-label":"Delete",onClick:()=>r(),dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//trash")}})):or.default.createElement(or.default.Fragment,null,or.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")}}),or.default.createElement("div",{className:"mk-editor-frame-node-divider"}),h==3?or.default.createElement(oke,{...k}):h==4?or.default.createElement(JEe,{...k}):h==5?or.default.createElement(ike,{...k}):or.default.createElement(or.default.Fragment,null)))};var $Y=Ae(Te()),$9=e=>$Y.default.createElement($Y.default.Fragment,null,e.children);var Lc=Ae(Te());var ta=Ae(Te());var q9=Ae(Te());var L9=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 q9.default.createElement("div",{className:"mk-cell-option-item",onClick:r=>e.triggerMenu?e.triggerMenu(r):t(r)},q9.default.createElement("div",null,e.options?e.options.find(r=>r.value==e.value)?.name:e.value),q9.default.createElement("div",{className:"mk-cell-option-select mk-icon-xxsmall mk-icon-rotated",dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//collapse-solid")}}))};var z9=Ae(Te());var Ko=Ae(Te());var Rv=Ae(Te());var lke=e=>{let t=(0,Rv.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(),Rv.default.createElement(Ah,{...i}),{...i},Ne(n.view.document),"bottom")};return e.command.schema.id=="formula"?Rv.default.createElement("button",{onClick:n=>r(n)},"Edit Formula"):e.command.schema.id=="filter"?Rv.default.createElement(w2,{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}):Rv.default.createElement(Rv.default.Fragment,null)};var qY=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=[...yq(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(lke,{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(xs,{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(qY,{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 uke=e=>{let[t,r]=z9.default.useState(WQ(e.formula)??{action:"",props:{},propsValue:{},children:[]});return z9.default.createElement("div",{className:"mk-editor-actions-nodes"},z9.default.createElement(qY,{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 Q2=Ae(Te());var hJe=0,bD=class{constructor(t,r){this.from=t,this.to=r}},Bi=class{constructor(t={}){this.id=hJe++,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=qc.match(t)),r=>{let n=t(r);return n===void 0?null:[this,n]}}};Bi.closedBy=new Bi({deserialize:e=>e.split(" ")});Bi.openedBy=new Bi({deserialize:e=>e.split(" ")});Bi.group=new Bi({deserialize:e=>e.split(" ")});Bi.contextHash=new Bi({perNode:!0});Bi.lookAhead=new Bi({perNode:!0});Bi.mounted=new Bi({perNode:!0});var AJe=Object.create(null),qc=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):AJe,n=(t.top?1:0)|(t.skipped?2:0)|(t.error?4:0)|(t.name==null?8:0),i=new qc(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(Bi.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(Bi.group),a=-1;a<(i?i.length:0);a++){let o=r[a<0?n.name:i[a]];if(o)return o}}}};qc.none=new qc("",Object.create(null),0,8);var M2=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:WY(qc.none,this.children,this.positions,0,this.children.length,0,this.length,(r,n,i)=>new Il(this.type,r,n,i,this.propValues),t.makeTree||((r,n,i)=>new Il(qc.none,r,n,i)))}static build(t){return gJe(t)}};Il.empty=new Il(qc.none,[],[],0);var xD=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 xD(this.buffer,this.index)}},pg=class{constructor(t,r,n){this.buffer=t,this.length=r,this.set=n}get type(){return qc.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 pke(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 j2(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(!!dke(i,n,f,f+c.length)){if(c instanceof pg){if(a&Pl.ExcludeBuffers)continue;let d=c.findChild(0,c.buffer.length,r,n-f,i);if(d>-1)return new Sh(new LY(o,c,t,f),null,d)}else if(a&Pl.IncludeAnonymous||!c.type.isAnonymous||UY(c)){let d;if(!(a&Pl.IgnoreMounts)&&c.props&&(d=c.prop(Bi.mounted))&&!d.overlay)return new am(d.tree,f,t,o);let p=new am(c,f,t,o);return a&Pl.IncludeAnonymous||!p.type.isAnonymous?p:p.nextChild(r<0?c.children.length-1:0,r,n,i)}}}if(a&Pl.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&Pl.IgnoreOverlays)&&(i=this._tree.prop(Bi.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 N2(this,t)}get tree(){return this._tree}toTree(){return this._tree}resolve(t,r=0){return j2(this,t,r,!1)}resolveInner(t,r=0){return j2(this,t,r,!0)}enterUnfinishedNodesBefore(t){return pke(this,t)}getChild(t,r=null,n=null){let i=H9(this,t,r,n);return i.length?i[0]:null}getChildren(t,r=null,n=null){return H9(this,t,r,n)}toString(){return this._tree.toString()}get node(){return this}matchContext(t){return V9(this,t)}};function H9(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 V9(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 LY=class{constructor(t,r,n,i){this.parent=t,this.buffer=r,this.index=n,this.start=i}},Sh=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 Sh(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&Pl.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 Sh(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 Sh(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 Sh(this.context,this._parent,t.findChild(r,this.index,-1,0,4))}cursor(t=0){return new N2(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 Il(this.type,t,r,this.to-this.from)}resolve(t,r=0){return j2(this,t,r,!1)}resolveInner(t,r=0){return j2(this,t,r,!0)}enterUnfinishedNodesBefore(t){return pke(this,t)}toString(){return this.context.buffer.childString(this.index)}getChild(t,r=null,n=null){let i=H9(this,t,r,n);return i.length?i[0]:null}getChildren(t,r=null,n=null){return H9(this,t,r,n)}get node(){return this}matchContext(t){return V9(this,t)}},N2=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&Pl.ExcludeBuffers?!1:this.enterChild(1,t,r):this.yield(this._tree.enter(t,r,n))}parent(){if(!this.buffer)return this.yieldNode(this.mode&Pl.IncludeAnonymous?this._tree._parent:this._tree.parent);if(this.stack.length)return this.yieldBuf(this.stack.pop());let t=this.mode&Pl.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&Pl.IncludeAnonymous||s instanceof pg||!s.type.isAnonymous||UY(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 V9(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 UY(e){return e.children.some(t=>t instanceof pg||!t.type.isAnonymous||UY(t))}function gJe(e){var t;let{buffer:r,nodeSet:n,maxBufferLength:i=1024,reused:a=[],minRepeatType:o=n.types.length}=e,s=Array.isArray(r)?new xD(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=WY(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 Il){if(!O&&C.type==x&&C.length==k)return C;(N=C.prop(Bi.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=[Bi.contextHash,u];O=O?[C].concat(O):[C]}if(j>25){let C=[Bi.lookAhead,j];O=O?[C].concat(O):[C]}return new Il(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 Il(l[e.topID],A.reverse(),b.reverse(),v)}var fke=new WeakMap;function W9(e,t){if(!e.isAnonymous||t instanceof pg||t.type!=e)return 1;let r=fke.get(t);if(r==null){r=1;for(let n of t.children){if(n.type!=e||!(n instanceof Il)){r=1;break}r+=W9(e,n)}fke.set(t,r)}return r}function WY(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(WY(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 G9=class{startParse(t,r,n){return typeof t=="string"&&(t=new zY(t)),n=n?n.length?n.map(i=>new bD(i.from,i.to)):[new bD(0,0)]:[new bD(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}}},zY=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 N0r=new Bi({perNode:!0});var _2=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 _2(t,[],r,n,n,0,[],0,i?new Y9(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 _2(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 GY(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()}},Y9=class{constructor(t,r){this.tracker=t,this.context=r,this.hash=t.strict?t.hash(r):0}},mke;(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"})(mke||(mke={}));var GY=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}},P2=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 P2(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 P2(this.stack,this.pos,this.index)}},T2=class{constructor(){this.start=-1,this.value=-1,this.end=-1,this.extended=-1,this.lookAhead=0,this.mask=0,this.context=0}},hke=new T2,QY=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=hke,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=hke,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}},F2=class{constructor(t,r){this.data=t,this.id=r}token(t,r){yJe(this.data,t,r,this.id)}};F2.prototype.contextual=F2.prototype.fallback=F2.prototype.extend=!1;var db=class{constructor(t,r={}){this.token=t,this.contextual=!!r.contextual,this.fallback=!!r.fallback,this.extend=!!r.extend}};function yJe(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 Q9(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),HY=null,Ake;(function(e){e[e.Margin=25]="Margin"})(Ake||(Ake={}));function gke(e,t,r){let n=e.cursor(Pl.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 YY=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?gke(t.tree,t.from+t.offset,1)-t.offset:t.from,this.safeTo=t.openEnd?gke(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 Il){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}}},ZY=class{constructor(t,r){this.stream=r,this.tokens=[],this.mainToken=null,this.actions=[],this.tokens=t.tokenizers.map(n=>new T2)}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 T2,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 T2,{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 YY(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&&bJe(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(Bi.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 Il)||f.children.length==0||f.positions[0]>0)break;let p=f.children[0];if(p instanceof Il&&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 yke(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)})`),yke(s,n)):(!i||i.scoree,Z9=class{constructor(t){this.start=t.start,this.shift=t.shift||VY,this.reduce=t.reduce||VY,this.reuse=t.reuse||VY,this.hash=t.hash||(()=>0),this.strict=t.strict!==!1}},pb=class extends G9{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 M2(r.map((s,l)=>qc.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=Q9(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 F2(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 XY(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=mg(this.data,n+2);else return!1;if(r==mg(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=mg(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=bke(this.data,this.tokenPrecTable,r);return n<0||bke(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:I2.get(r.base||r,r.modified.concat(t).sort((n,i)=>n.id-i.id))}},wJe=0,I2=class{constructor(){this.instances=[],this.id=wJe++}static get(t,r){if(!r.length)return t;let n=r[0].instances.find(s=>s.base==t&&SJe(r,s.modified));if(n)return n;let i=[],a=new Qd(i,t,r);for(let s of r)s.instances.push(a);let o=Ske(r);for(let s of t.set)for(let l of o)i.push(I2.get(s,l));return a}};function SJe(e,t){return e.length==t.length&&e.every((r,n)=>r==t[n])}function Ske(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 eZ(n,o,l>0?a.slice(0,l):null);t[u]=c.sort(t[u])}}return EJe.add(t)}var EJe=new Bi,eZ=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=Qd.define,X9=Tt(),$v=Tt(),xke=Tt($v),wke=Tt($v),qv=Tt(),K9=Tt(qv),JY=Tt(qv),Ch=Tt(),mb=Tt(Ch),Eh=Tt(),kh=Tt(),tZ=Tt(),wD=Tt(tZ),J9=Tt(),gt={comment:X9,lineComment:Tt(X9),blockComment:Tt(X9),docComment:Tt(X9),name:$v,variableName:Tt($v),typeName:xke,tagName:Tt(xke),propertyName:wke,attributeName:Tt(wke),className:Tt($v),labelName:Tt($v),namespace:Tt($v),macroName:Tt($v),literal:qv,string:K9,docString:Tt(K9),character:Tt(K9),attributeValue:Tt(K9),number:JY,integer:Tt(JY),float:Tt(JY),bool:Tt(qv),regexp:Tt(qv),escape:Tt(qv),color:Tt(qv),url:Tt(qv),keyword:Eh,self:Tt(Eh),null:Tt(Eh),atom:Tt(Eh),unit:Tt(Eh),modifier:Tt(Eh),operatorKeyword:Tt(Eh),controlKeyword:Tt(Eh),definitionKeyword:Tt(Eh),moduleKeyword:Tt(Eh),operator:kh,derefOperator:Tt(kh),arithmeticOperator:Tt(kh),logicOperator:Tt(kh),bitwiseOperator:Tt(kh),compareOperator:Tt(kh),updateOperator:Tt(kh),definitionOperator:Tt(kh),typeOperator:Tt(kh),controlOperator:Tt(kh),punctuation:tZ,separator:Tt(tZ),bracket:wD,angleBracket:Tt(wD),squareBracket:Tt(wD),paren:Tt(wD),brace:Tt(wD),content:Ch,heading:mb,heading1:Tt(mb),heading2:Tt(mb),heading3:Tt(mb),heading4:Tt(mb),heading5:Tt(mb),heading6:Tt(mb),contentSeparator:Tt(Ch),list:Tt(Ch),quote:Tt(Ch),emphasis:Tt(Ch),strong:Tt(Ch),link:Tt(Ch),monospace:Tt(Ch),strikethrough:Tt(Ch),inserted:Tt(),deleted:Tt(),changed:Tt(),invalid:Tt(),meta:J9,documentMeta:Tt(J9),annotation:Tt(J9),processingInstruction:Tt(J9),definition:Qd.defineModifier(),constant:Qd.defineModifier(),function:Qd.defineModifier(),standard:Qd.defineModifier(),local:Qd.defineModifier(),special:Qd.defineModifier()},I0r=kJe([{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 kke=281,Cke=1,CJe=2,e8=282,DJe=3,OJe=283,Dke=284,MJe=4,jJe=286,NJe=287,TJe=5,FJe=6,_Je=1,PJe=[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],Mke=125,IJe=123,BJe=59,Oke=47,RJe=42,$Je=43,qJe=45,LJe=36,zJe=96,UJe=92,WJe=new Z9({start:!1,shift(e,t){return t==TJe||t==FJe||t==jJe?e:t==NJe},strict:!1}),HJe=new db((e,t)=>{let{next:r}=e;(r==Mke||r==-1||t.context)&&t.canShift(Dke)&&e.acceptToken(Dke)},{contextual:!0,fallback:!0}),VJe=new db((e,t)=>{let{next:r}=e,n;PJe.indexOf(r)>-1||r==Oke&&((n=e.peek(1))==Oke||n==RJe)||r!=Mke&&r!=BJe&&r!=-1&&!t.context&&t.canShift(kke)&&e.acceptToken(kke)},{contextual:!0}),GJe=new db((e,t)=>{let{next:r}=e;if((r==$Je||r==qJe)&&(e.advance(),r==e.next)){e.advance();let n=!t.context&&t.canShift(Cke);e.acceptToken(n?Cke:CJe)}},{contextual:!0}),QJe=new db(e=>{for(let t=!1,r=0;;r++){let{next:n}=e;if(n<0){r&&e.acceptToken(e8);break}else if(n==zJe){r?e.acceptToken(e8):e.acceptToken(OJe,1);break}else if(n==IJe&&t){r==1?e.acceptToken(DJe,1):e.acceptToken(e8,-1);break}else if(n==10&&r){e.advance(),e.acceptToken(e8);break}else n==UJe&&e.advance();t=n==LJe,e.advance()}});function YJe(e,t){return e=="extends"&&t.dialectEnabled(_Je)?MJe:-1}var ZJe=Eke({"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}),XJe={__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},KJe={__proto__:null,async:109,get:111,set:113,public:161,private:161,protected:161,static:163,abstract:165,override:167,readonly:173,new:355},JJe={__proto__:null,"<":129},jke=pb.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:[VJe,GJe,QJe,0,1,2,3,4,5,6,7,8,9,HJe],topRules:{Script:[0,7]},dialects:{jsx:11707,ts:11709},dynamicPrecedences:{149:1,176:1},specialized:[{term:289,get:(e,t)=>YJe(e,t)<<1},{term:289,get:e=>XJe[e]||-1},{term:299,get:e=>KJe[e]||-1},{term:63,get:e=>JJe[e]||-1}],tokenPrec:11730});var eet=0,SD=class{constructor(t,r){this.from=t,this.to=r}},Oi=class{constructor(t={}){this.id=eet++,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]}}};Oi.closedBy=new Oi({deserialize:e=>e.split(" ")});Oi.openedBy=new Oi({deserialize:e=>e.split(" ")});Oi.group=new Oi({deserialize:e=>e.split(" ")});Oi.contextHash=new Oi({perNode:!0});Oi.lookAhead=new Oi({perNode:!0});Oi.mounted=new Oi({perNode:!0});var tet=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):tet,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(Oi.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(Oi.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 t8=new WeakMap,Nke=new WeakMap,ks;(function(e){e[e.ExcludeBuffers=1]="ExcludeBuffers",e[e.IncludeAnonymous=2]="IncludeAnonymous",e[e.IgnoreMounts=4]="IgnoreMounts",e[e.IgnoreOverlays=8]="IgnoreOverlays"})(ks||(ks={}));var Cs=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(Oi.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 R2(this.topNode,t)}cursorAt(t,r=0,n=0){let i=t8.get(this)||this.topNode,a=new R2(i);return a.moveTo(t,r),t8.set(this,a._tree),a}get topNode(){return new If(this,0,0,null)}resolve(t,r=0){let n=B2(t8.get(this)||this.topNode,t,r,!1);return t8.set(this,n),n}resolveInner(t,r=0){let n=B2(Nke.get(this)||this.topNode,t,r,!0);return Nke.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)|ks.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:aZ(Zu.none,this.children,this.positions,0,this.children.length,0,this.length,(r,n,i)=>new Cs(this.type,r,n,i,this.propValues),t.makeTree||((r,n,i)=>new Cs(Zu.none,r,n,i)))}static build(t){return ret(t)}};Cs.empty=new Cs(Zu.none,[],[],0);var ED=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 ED(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 _ke(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 B2(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(!!Fke(i,n,f,f+c.length)){if(c instanceof hg){if(a&ks.ExcludeBuffers)continue;let d=c.findChild(0,c.buffer.length,r,n-f,i);if(d>-1)return new Yd(new rZ(o,c,t,f),null,d)}else if(a&ks.IncludeAnonymous||!c.type.isAnonymous||iZ(c)){let d;if(!(a&ks.IgnoreMounts)&&c.props&&(d=c.prop(Oi.mounted))&&!d.overlay)return new If(d.tree,f,t,o);let p=new If(c,f,t,o);return a&ks.IncludeAnonymous||!p.type.isAnonymous?p:p.nextChild(r<0?c.children.length-1:0,r,n,i)}}}if(a&ks.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&ks.IgnoreOverlays)&&(i=this._tree.prop(Oi.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 If(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 R2(this,t)}get tree(){return this._tree}toTree(){return this._tree}resolve(t,r=0){return B2(this,t,r,!1)}resolveInner(t,r=0){return B2(this,t,r,!0)}enterUnfinishedNodesBefore(t){return _ke(this,t)}getChild(t,r=null,n=null){let i=n8(this,t,r,n);return i.length?i[0]:null}getChildren(t,r=null,n=null){return n8(this,t,r,n)}toString(){return this._tree.toString()}get node(){return this}matchContext(t){return i8(this,t)}};function n8(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 i8(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 rZ=class{constructor(t,r,n,i){this.parent=t,this.buffer=r,this.index=n,this.start=i}},Yd=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 Yd(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&ks.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 Yd(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 Yd(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 Yd(this.context,this._parent,t.findChild(r,this.index,-1,0,4))}cursor(t=0){return new R2(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 Cs(this.type,t,r,this.to-this.from)}resolve(t,r=0){return B2(this,t,r,!1)}resolveInner(t,r=0){return B2(this,t,r,!0)}enterUnfinishedNodesBefore(t){return _ke(this,t)}toString(){return this.context.buffer.childString(this.index)}getChild(t,r=null,n=null){let i=n8(this,t,r,n);return i.length?i[0]:null}getChildren(t,r=null,n=null){return n8(this,t,r,n)}get node(){return this}matchContext(t){return i8(this,t)}},R2=class{constructor(t,r=0){if(this.mode=r,this.buffer=null,this.stack=[],this.index=0,this.bufferNode=null,t instanceof If)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 If?(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&ks.ExcludeBuffers?!1:this.enterChild(1,t,r):this.yield(this._tree.enter(t,r,n))}parent(){if(!this.buffer)return this.yieldNode(this.mode&ks.IncludeAnonymous?this._tree._parent:this._tree.parent);if(this.stack.length)return this.yieldBuf(this.stack.pop());let t=this.mode&ks.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&ks.IncludeAnonymous||s instanceof hg||!s.type.isAnonymous||iZ(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 i8(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 iZ(e){return e.children.some(t=>t instanceof hg||!t.type.isAnonymous||iZ(t))}function ret(e){var t;let{buffer:r,nodeSet:n,maxBufferLength:i=1024,reused:a=[],minRepeatType:o=n.types.length}=e,s=Array.isArray(r)?new ED(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=aZ(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 Cs){if(!O&&C.type==x&&C.length==k)return C;(N=C.prop(Oi.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=[Oi.contextHash,u];O=O?[C].concat(O):[C]}if(j>25){let C=[Oi.lookAhead,j];O=O?[C].concat(O):[C]}return new Cs(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 Cs(l[e.topID],A.reverse(),b.reverse(),v)}var Tke=new WeakMap;function r8(e,t){if(!e.isAnonymous||t instanceof hg||t.type!=e)return 1;let r=Tke.get(t);if(r==null){r=1;for(let n of t.children){if(n.type!=e||!(n instanceof Cs)){r=1;break}r+=r8(e,n)}Tke.set(t,r)}return r}function aZ(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(aZ(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 a8=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 Yd?this.setBuffer(t.context.buffer,t.index,r):t instanceof If&&this.map.set(t.tree,r)}get(t){return t instanceof Yd?this.getBuffer(t.context.buffer,t.index):t instanceof If?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)}},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 SD(i.from,i.to)):[new SD(0,0)]:[new SD(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}}},nZ=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 L0r=new Oi({perNode:!0});var Au=require("@codemirror/state"),Ag=require("@codemirror/view");var net=0,Zd=class{constructor(t,r,n){this.set=t,this.base=r,this.modified=n,this.id=net++}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 $2;return r=>r.modified.indexOf(t)>-1?r:$2.get(r.base||r,r.modified.concat(t).sort((n,i)=>n.id-i.id))}},iet=0,$2=class{constructor(){this.instances=[],this.id=iet++}static get(t,r){if(!r.length)return t;let n=r[0].instances.find(s=>s.base==t&&aet(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=Bke(r);for(let s of t.set)for(let l of o)i.push($2.get(s,l));return a}};function aet(e,t){return e.length==t.length&&e.every((r,n)=>r==t[n])}function Bke(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 sZ(n,o,l>0?a.slice(0,l):null);t[u]=c.sort(t[u])}}return oet.add(t)}var oet=new Oi,sZ=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=Zd.define,s8=Ft(),Lv=Ft(),Pke=Ft(Lv),Ike=Ft(Lv),zv=Ft(),l8=Ft(zv),oZ=Ft(zv),jh=Ft(),hb=Ft(jh),Oh=Ft(),Mh=Ft(),lZ=Ft(),kD=Ft(lZ),u8=Ft(),Rt={comment:s8,lineComment:Ft(s8),blockComment:Ft(s8),docComment:Ft(s8),name:Lv,variableName:Ft(Lv),typeName:Pke,tagName:Ft(Pke),propertyName:Ike,attributeName:Ft(Ike),className:Ft(Lv),labelName:Ft(Lv),namespace:Ft(Lv),macroName:Ft(Lv),literal:zv,string:l8,docString:Ft(l8),character:Ft(l8),attributeValue:Ft(l8),number:oZ,integer:Ft(oZ),float:Ft(oZ),bool:Ft(zv),regexp:Ft(zv),escape:Ft(zv),color:Ft(zv),url:Ft(zv),keyword:Oh,self:Ft(Oh),null:Ft(Oh),atom:Ft(Oh),unit:Ft(Oh),modifier:Ft(Oh),operatorKeyword:Ft(Oh),controlKeyword:Ft(Oh),definitionKeyword:Ft(Oh),moduleKeyword:Ft(Oh),operator:Mh,derefOperator:Ft(Mh),arithmeticOperator:Ft(Mh),logicOperator:Ft(Mh),bitwiseOperator:Ft(Mh),compareOperator:Ft(Mh),updateOperator:Ft(Mh),definitionOperator:Ft(Mh),typeOperator:Ft(Mh),controlOperator:Ft(Mh),punctuation:lZ,separator:Ft(lZ),bracket:kD,angleBracket:Ft(kD),squareBracket:Ft(kD),paren:Ft(kD),brace:Ft(kD),content:jh,heading:hb,heading1:Ft(hb),heading2:Ft(hb),heading3:Ft(hb),heading4:Ft(hb),heading5:Ft(hb),heading6:Ft(hb),contentSeparator:Ft(jh),list:Ft(jh),quote:Ft(jh),emphasis:Ft(jh),strong:Ft(jh),link:Ft(jh),monospace:Ft(jh),strikethrough:Ft(jh),inserted:Ft(),deleted:Ft(),changed:Ft(),invalid:Ft(),meta:u8,documentMeta:Ft(u8),annotation:Ft(u8),processingInstruction:Ft(u8),definition:Zd.defineModifier(),constant:Zd.defineModifier(),function:Zd.defineModifier(),standard:Zd.defineModifier(),local:Zd.defineModifier(),special:Zd.defineModifier()},W0r=uZ([{tag:Rt.link,class:"tok-link"},{tag:Rt.heading,class:"tok-heading"},{tag:Rt.emphasis,class:"tok-emphasis"},{tag:Rt.strong,class:"tok-strong"},{tag:Rt.keyword,class:"tok-keyword"},{tag:Rt.atom,class:"tok-atom"},{tag:Rt.bool,class:"tok-bool"},{tag:Rt.url,class:"tok-url"},{tag:Rt.labelName,class:"tok-labelName"},{tag:Rt.inserted,class:"tok-inserted"},{tag:Rt.deleted,class:"tok-deleted"},{tag:Rt.literal,class:"tok-literal"},{tag:Rt.string,class:"tok-string"},{tag:Rt.number,class:"tok-number"},{tag:[Rt.regexp,Rt.escape,Rt.special(Rt.string)],class:"tok-string2"},{tag:Rt.variableName,class:"tok-variableName"},{tag:Rt.local(Rt.variableName),class:"tok-variableName tok-local"},{tag:Rt.definition(Rt.variableName),class:"tok-variableName tok-definition"},{tag:Rt.special(Rt.variableName),class:"tok-variableName2"},{tag:Rt.definition(Rt.propertyName),class:"tok-propertyName tok-definition"},{tag:Rt.typeName,class:"tok-typeName"},{tag:Rt.namespace,class:"tok-namespace"},{tag:Rt.className,class:"tok-className"},{tag:Rt.macroName,class:"tok-macroName"},{tag:Rt.propertyName,class:"tok-propertyName"},{tag:Rt.operator,class:"tok-operator"},{tag:Rt.comment,class:"tok-comment"},{tag:Rt.meta,class:"tok-meta"},{tag:Rt.invalid,class:"tok-invalid"},{tag:Rt.punctuation,class:"tok-punctuation"}]);var cZ,DD=new Oi;function set(e){return Au.Facet.define({combine:e?t=>t.concat(e):void 0})}var Bf=class{constructor(t,r,n=[]){this.data=t,Au.EditorState.prototype.hasOwnProperty("tree")||Object.defineProperty(Au.EditorState.prototype,"tree",{get(){return q2(this)}}),this.parser=r,this.extension=[z2.of(this),Au.EditorState.languageData.of((i,a,o)=>i.facet($ke(i,a,o)))].concat(n)}isActiveAt(t,r,n=-1){return $ke(t,r,n)==this.data}findRegions(t){let r=t.facet(z2);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(DD)==this.data){n.push({from:o,to:o+a.length});return}let s=a.prop(Oi.mounted);if(s){if(s.tree.prop(DD)==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 Ab(this.data,this.parser.configure(t))}get allowsNesting(){return this.parser.hasWrappers()}};function q2(e){let t=e.field(Bf.state,!1);return t?t.tree:Cs.empty}var pZ=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)}},CD=null,L2=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 L2(t,r,[],Cs.empty,0,n,[],null)}startParse(){return this.parser.startParse(new pZ(this.state.doc),this.fragments)}work(t,r){return r!=null&&r>=this.state.doc.length&&(r=void 0),this.tree!=Cs.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=CD;CD=this;try{return t()}finally{CD=r}}withoutTempSkipped(t){for(let r;r=this.tempSkipped.pop();)t=qke(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=Cs.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=qke(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 o8{createParse(r,n,i){let a=i[0].from,o=i[i.length-1].to;return{parsedPos:a,advance(){let l=CD;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 Cs(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 CD}};function qke(e,t,r){return Dh.applyChanges(e,[{fromA:t,toA:r,fromB:t,toB:r}])}var Uv=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 Uv(r)}static init(t){let r=Math.min(3e3,t.doc.length),n=L2.create(t.facet(z2).parser,t,{from:0,to:r});return n.work(20,r)||n.takeTree(),new Uv(n)}};Bf.state=Au.StateField.define({create:Uv.init,update(e,t){for(let r of t.effects)if(r.is(Bf.setState))return r.value;return t.startState.facet(z2)!=t.state.facet(z2)?Uv.init(t.state):e.apply(t)}});var Uke=e=>{let t=setTimeout(()=>e(),500);return()=>clearTimeout(t)};typeof requestIdleCallback<"u"&&(Uke=e=>{let t=-1,r=setTimeout(()=>{t=requestIdleCallback(e,{timeout:500-100})},100);return()=>t<0?clearTimeout(r):cancelIdleCallback(t)});var fZ=typeof navigator<"u"&&((cZ=navigator.scheduling)===null||cZ===void 0?void 0:cZ.isInputPending)?()=>navigator.scheduling.isInputPending():null,uet=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(Bf.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(Bf.state);(r.tree!=r.context.tree||!r.context.isDone(t.doc.length))&&(this.working=Uke(this.work))}work(t){this.working=null;let r=Date.now();if(this.chunkEndi+1e3,l=a.context.work(()=>fZ&&fZ()||Date.now()>o,i+(s?0:1e5));this.chunkBudget-=Date.now()-r,(l||this.chunkBudget<=0)&&(a.context.takeTree(),this.view.dispatch({effects:Bf.setState.of(new Uv(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()}}}),z2=Au.Facet.define({combine(e){return e.length?e[0]:null},enables:[Bf.state,uet]}),c8=class{constructor(t,r=[]){this.language=t,this.support=r,this.extension=[t,r]}};var Wke=new Oi;function cet(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.fromfet(n,t,r,e)}function fet(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?cet(e):null;return l?s?e.column(l.from):e.column(l.to):e.baseIndent+(s?0:e.unit*r)}var Vke=e=>e.baseIndent;function f8({except:e,units:t=1}={}){return r=>{let n=e&&e.test(r.textAfter);return r.baseIndent+(n?0:t*r.unit)}}var Gke=new Oi;function Qke(e){let t=e.firstChild,r=e.lastChild;return t&&t.tos.prop(DD)==o.data:o?s=>s==o:void 0,this.style=uZ(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 OD(t,r||{})}};var K0r=OD.define([{tag:Rt.meta,color:"#7a757a"},{tag:Rt.link,textDecoration:"underline"},{tag:Rt.heading,textDecoration:"underline",fontWeight:"bold"},{tag:Rt.emphasis,fontStyle:"italic"},{tag:Rt.strong,fontWeight:"bold"},{tag:Rt.strikethrough,textDecoration:"line-through"},{tag:Rt.keyword,color:"#708"},{tag:[Rt.atom,Rt.bool,Rt.url,Rt.contentSeparator,Rt.labelName],color:"#219"},{tag:[Rt.literal,Rt.inserted],color:"#164"},{tag:[Rt.string,Rt.deleted],color:"#a11"},{tag:[Rt.regexp,Rt.escape,Rt.special(Rt.string)],color:"#e40"},{tag:Rt.definition(Rt.variableName),color:"#00f"},{tag:Rt.local(Rt.variableName),color:"#30a"},{tag:[Rt.typeName,Rt.namespace],color:"#085"},{tag:Rt.className,color:"#167"},{tag:[Rt.special(Rt.variableName),Rt.macroName],color:"#256"},{tag:Rt.definition(Rt.propertyName),color:"#00c"},{tag:Rt.comment,color:"#940"},{tag:Rt.invalid,color:"#f00"}]);var det=Object.create(null),Lke=[Zu.none];var zke=[],pet=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"]])pet[e]=met(det,t);function dZ(e,t){zke.indexOf(e)>-1||(zke.push(e),console.warn(t))}function met(e,t){let r=null;for(let a of t.split(".")){let o=e[a]||Rt[a];o?typeof o=="function"?r?r=o(r):dZ(a,`Modifier ${a} used at start of tag`):r?dZ(a,`Tag ${a} used as modifier`):r=o:dZ(a,`Unknown highlighting tag ${a}`)}if(!r)return 0;let n=t.replace(/ /g,"_"),i=Zu.define({id:Lke.length,name:n,props:[Rke({[n]:r})]});return Lke.push(i),i.id}var x8=require("@codemirror/state"),v6e=require("@codemirror/view");var ea=require("@codemirror/state"),il=require("@codemirror/view");var het=0,MD=class{constructor(t,r){this.from=t,this.to=r}},Gi=class{constructor(t={}){this.id=het++,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=Xu.match(t)),r=>{let n=t(r);return n===void 0?null:[this,n]}}};Gi.closedBy=new Gi({deserialize:e=>e.split(" ")});Gi.openedBy=new Gi({deserialize:e=>e.split(" ")});Gi.group=new Gi({deserialize:e=>e.split(" ")});Gi.contextHash=new Gi({perNode:!0});Gi.lookAhead=new Gi({perNode:!0});Gi.mounted=new Gi({perNode:!0});var Aet=Object.create(null),Xu=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):Aet,n=(t.top?1:0)|(t.skipped?2:0)|(t.error?4:0)|(t.name==null?8:0),i=new Xu(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(Gi.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(Gi.group),a=-1;a<(i?i.length:0);a++){let o=r[a<0?n.name:i[a]];if(o)return o}}}};Xu.none=new Xu("",Object.create(null),0,8);var d8=new WeakMap,Yke=new WeakMap,Bl;(function(e){e[e.ExcludeBuffers=1]="ExcludeBuffers",e[e.IncludeAnonymous=2]="IncludeAnonymous",e[e.IgnoreMounts=4]="IgnoreMounts",e[e.IgnoreOverlays=8]="IgnoreOverlays"})(Bl||(Bl={}));var Ds=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(Gi.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 W2(this.topNode,t)}cursorAt(t,r=0,n=0){let i=d8.get(this)||this.topNode,a=new W2(i);return a.moveTo(t,r),d8.set(this,a._tree),a}get topNode(){return new sm(this,0,0,null)}resolve(t,r=0){let n=U2(d8.get(this)||this.topNode,t,r,!1);return d8.set(this,n),n}resolveInner(t,r=0){let n=U2(Yke.get(this)||this.topNode,t,r,!0);return Yke.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)|Bl.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:gZ(Xu.none,this.children,this.positions,0,this.children.length,0,this.length,(r,n,i)=>new Ds(this.type,r,n,i,this.propValues),t.makeTree||((r,n,i)=>new Ds(Xu.none,r,n,i)))}static build(t){return get(t)}};Ds.empty=new Ds(Xu.none,[],[],0);var jD=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 jD(this.buffer,this.index)}},gg=class{constructor(t,r,n){this.buffer=t,this.length=r,this.set=n}get type(){return Xu.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 Kke(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 U2(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(!!Xke(i,n,f,f+c.length)){if(c instanceof gg){if(a&Bl.ExcludeBuffers)continue;let d=c.findChild(0,c.buffer.length,r,n-f,i);if(d>-1)return new Nh(new mZ(o,c,t,f),null,d)}else if(a&Bl.IncludeAnonymous||!c.type.isAnonymous||AZ(c)){let d;if(!(a&Bl.IgnoreMounts)&&c.props&&(d=c.prop(Gi.mounted))&&!d.overlay)return new sm(d.tree,f,t,o);let p=new sm(c,f,t,o);return a&Bl.IncludeAnonymous||!p.type.isAnonymous?p:p.nextChild(r<0?c.children.length-1:0,r,n,i)}}}if(a&Bl.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&Bl.IgnoreOverlays)&&(i=this._tree.prop(Gi.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 W2(this,t)}get tree(){return this._tree}toTree(){return this._tree}resolve(t,r=0){return U2(this,t,r,!1)}resolveInner(t,r=0){return U2(this,t,r,!0)}enterUnfinishedNodesBefore(t){return Kke(this,t)}getChild(t,r=null,n=null){let i=m8(this,t,r,n);return i.length?i[0]:null}getChildren(t,r=null,n=null){return m8(this,t,r,n)}toString(){return this._tree.toString()}get node(){return this}matchContext(t){return h8(this,t)}};function m8(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 h8(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 mZ=class{constructor(t,r,n,i){this.parent=t,this.buffer=r,this.index=n,this.start=i}},Nh=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 Nh(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&Bl.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 Nh(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 Nh(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 Nh(this.context,this._parent,t.findChild(r,this.index,-1,0,4))}cursor(t=0){return new W2(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 Ds(this.type,t,r,this.to-this.from)}resolve(t,r=0){return U2(this,t,r,!1)}resolveInner(t,r=0){return U2(this,t,r,!0)}enterUnfinishedNodesBefore(t){return Kke(this,t)}toString(){return this.context.buffer.childString(this.index)}getChild(t,r=null,n=null){let i=m8(this,t,r,n);return i.length?i[0]:null}getChildren(t,r=null,n=null){return m8(this,t,r,n)}get node(){return this}matchContext(t){return h8(this,t)}},W2=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&Bl.ExcludeBuffers?!1:this.enterChild(1,t,r):this.yield(this._tree.enter(t,r,n))}parent(){if(!this.buffer)return this.yieldNode(this.mode&Bl.IncludeAnonymous?this._tree._parent:this._tree.parent);if(this.stack.length)return this.yieldBuf(this.stack.pop());let t=this.mode&Bl.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&Bl.IncludeAnonymous||s instanceof gg||!s.type.isAnonymous||AZ(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 h8(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 AZ(e){return e.children.some(t=>t instanceof gg||!t.type.isAnonymous||AZ(t))}function get(e){var t;let{buffer:r,nodeSet:n,maxBufferLength:i=1024,reused:a=[],minRepeatType:o=n.types.length}=e,s=Array.isArray(r)?new jD(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 gg(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=gZ(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 Ds){if(!O&&C.type==x&&C.length==k)return C;(N=C.prop(Gi.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=[Gi.contextHash,u];O=O?[C].concat(O):[C]}if(j>25){let C=[Gi.lookAhead,j];O=O?[C].concat(O):[C]}return new Ds(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 Ds(l[e.topID],A.reverse(),b.reverse(),v)}var Zke=new WeakMap;function p8(e,t){if(!e.isAnonymous||t instanceof gg||t.type!=e)return 1;let r=Zke.get(t);if(r==null){r=1;for(let n of t.children){if(n.type!=e||!(n instanceof Ds)){r=1;break}r+=p8(e,n)}Zke.set(t,r)}return r}function gZ(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(gZ(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 Th=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 Th(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 Th(p,h,d.tree,d.offset+u,s>0,!!c)}if(d&&i.push(d),o.to>f)break;o=anew MD(i.from,i.to)):[new MD(0,0)]:[new MD(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}}},hZ=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 tvr=new Gi({perNode:!0});var gu=require("@codemirror/state"),vg=require("@codemirror/view");var vet=0,Xd=class{constructor(t,r,n){this.set=t,this.base=r,this.modified=n,this.id=vet++}static define(t){if(t?.base)throw new Error("Can not derive from a modified tag");let r=new Xd([],null,[]);if(r.set.push(r),t)for(let n of t.set)r.set.push(n);return r}static defineModifier(){let t=new H2;return r=>r.modified.indexOf(t)>-1?r:H2.get(r.base||r,r.modified.concat(t).sort((n,i)=>n.id-i.id))}},yet=0,H2=class{constructor(){this.instances=[],this.id=yet++}static get(t,r){if(!r.length)return t;let n=r[0].instances.find(s=>s.base==t&&bet(r,s.modified));if(n)return n;let i=[],a=new Xd(i,t,r);for(let s of r)s.instances.push(a);let o=t6e(r);for(let s of t.set)for(let l of o)i.push(H2.get(s,l));return a}};function bet(e,t){return e.length==t.length&&e.every((r,n)=>r==t[n])}function t6e(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 yZ(n,o,l>0?a.slice(0,l):null);t[u]=c.sort(t[u])}}return xet.add(t)}var xet=new Gi,yZ=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=Xd.define,g8=_t(),Wv=_t(),Jke=_t(Wv),e6e=_t(Wv),Hv=_t(),v8=_t(Hv),vZ=_t(Hv),Ph=_t(),gb=_t(Ph),Fh=_t(),_h=_t(),bZ=_t(),ND=_t(bZ),y8=_t(),$t={comment:g8,lineComment:_t(g8),blockComment:_t(g8),docComment:_t(g8),name:Wv,variableName:_t(Wv),typeName:Jke,tagName:_t(Jke),propertyName:e6e,attributeName:_t(e6e),className:_t(Wv),labelName:_t(Wv),namespace:_t(Wv),macroName:_t(Wv),literal:Hv,string:v8,docString:_t(v8),character:_t(v8),attributeValue:_t(v8),number:vZ,integer:_t(vZ),float:_t(vZ),bool:_t(Hv),regexp:_t(Hv),escape:_t(Hv),color:_t(Hv),url:_t(Hv),keyword:Fh,self:_t(Fh),null:_t(Fh),atom:_t(Fh),unit:_t(Fh),modifier:_t(Fh),operatorKeyword:_t(Fh),controlKeyword:_t(Fh),definitionKeyword:_t(Fh),moduleKeyword:_t(Fh),operator:_h,derefOperator:_t(_h),arithmeticOperator:_t(_h),logicOperator:_t(_h),bitwiseOperator:_t(_h),compareOperator:_t(_h),updateOperator:_t(_h),definitionOperator:_t(_h),typeOperator:_t(_h),controlOperator:_t(_h),punctuation:bZ,separator:_t(bZ),bracket:ND,angleBracket:_t(ND),squareBracket:_t(ND),paren:_t(ND),brace:_t(ND),content:Ph,heading:gb,heading1:_t(gb),heading2:_t(gb),heading3:_t(gb),heading4:_t(gb),heading5:_t(gb),heading6:_t(gb),contentSeparator:_t(Ph),list:_t(Ph),quote:_t(Ph),emphasis:_t(Ph),strong:_t(Ph),link:_t(Ph),monospace:_t(Ph),strikethrough:_t(Ph),inserted:_t(),deleted:_t(),changed:_t(),invalid:_t(),meta:y8,documentMeta:_t(y8),annotation:_t(y8),processingInstruction:_t(y8),definition:Xd.defineModifier(),constant:Xd.defineModifier(),function:Xd.defineModifier(),standard:Xd.defineModifier(),local:Xd.defineModifier(),special:Xd.defineModifier()},ivr=xZ([{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 wZ,b8=new Gi;var Kd=class{constructor(t,r,n=[]){this.data=t,gu.EditorState.prototype.hasOwnProperty("tree")||Object.defineProperty(gu.EditorState.prototype,"tree",{get(){return FD(this)}}),this.parser=r,this.extension=[G2.of(this),gu.EditorState.languageData.of((i,a,o)=>i.facet(n6e(i,a,o)))].concat(n)}isActiveAt(t,r,n=-1){return n6e(t,r,n)==this.data}findRegions(t){let r=t.facet(G2);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(b8)==this.data){n.push({from:o,to:o+a.length});return}let s=a.prop(Gi.mounted);if(s){if(s.tree.prop(b8)==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)}},TD=null,V2=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 V2(t,r,[],Ds.empty,0,n,[],null)}startParse(){return this.parser.startParse(new kZ(this.state.doc),this.fragments)}work(t,r){return r!=null&&r>=this.state.doc.length&&(r=void 0),this.tree!=Ds.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(Th.addTree(this.tree,this.fragments,!0)),this.parse=null)}withContext(t){let r=TD;TD=this;try{return t()}finally{TD=r}}withoutTempSkipped(t){for(let r;r=this.tempSkipped.pop();)t=i6e(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=Th.applyChanges(n,l),i=Ds.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=i6e(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 A8{createParse(r,n,i){let a=i[0].from,o=i[i.length-1].to;return{parsedPos:a,advance(){let l=TD;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 Ds(Xu.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 TD}};function i6e(e,t,r){return Th.applyChanges(e,[{fromA:t,toA:r,fromB:t,toB:r}])}var Vv=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 Vv(r)}static init(t){let r=Math.min(3e3,t.doc.length),n=V2.create(t.facet(G2).parser,t,{from:0,to:r});return n.work(20,r)||n.takeTree(),new Vv(n)}};Kd.state=gu.StateField.define({create:Vv.init,update(e,t){for(let r of t.effects)if(r.is(Kd.setState))return r.value;return t.startState.facet(G2)!=t.state.facet(G2)?Vv.init(t.state):e.apply(t)}});var s6e=e=>{let t=setTimeout(()=>e(),500);return()=>clearTimeout(t)};typeof requestIdleCallback<"u"&&(s6e=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"&&((wZ=navigator.scheduling)===null||wZ===void 0?void 0:wZ.isInputPending)?()=>navigator.scheduling.isInputPending():null,wet=vg.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(Kd.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(Kd.state);(r.tree!=r.context.tree||!r.context.isDone(t.doc.length))&&(this.working=s6e(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:Kd.setState.of(new Vv(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,vg.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()}}}),G2=gu.Facet.define({combine(e){return e.length?e[0]:null},enables:[Kd.state,wet]});var l6e=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 _D=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 Kd?s=>s.prop(b8)==o.data:o?s=>s==o:void 0,this.style=xZ(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 _D(t,r||{})}};var dvr=_D.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 Eet=Object.create(null),a6e=[Xu.none];var o6e=[],ket=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"]])ket[e]=Cet(Eet,t);function EZ(e,t){o6e.indexOf(e)>-1||(o6e.push(e),console.warn(t))}function Cet(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):EZ(a,`Modifier ${a} used at start of tag`):r?EZ(a,`Tag ${a} used as modifier`):r=o:EZ(a,`Unknown highlighting tag ${a}`)}if(!r)return 0;let n=t.replace(/ /g,"_"),i=Xu.define({id:a6e.length,name:n,props:[r6e({[n]:r})]});return a6e.push(i),i.id}function u6e(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 Det(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+$/]:Det(t);return i=>{let a=i.matchBefore(n);return a||i.explicit?{from:a?a.from:i.pos,options:t,validFor:r}:null}}function d6e(e,t){return r=>{for(let n=FD(r.state).resolveInner(r.pos,-1);n;n=n.parent)if(e.indexOf(n.name)>-1)return null;return t(r)}}var Oet=il.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"}}}),CZ=class{constructor(t,r,n,i){this.field=t,this.line=r,this.from=n,this.to=i}},PD=class{constructor(t,r,n){this.field=t,this.from=r,this.to=n}map(t){let r=t.mapPos(this.from,-1,ea.MapMode.TrackDel),n=t.mapPos(this.to,1,ea.MapMode.TrackDel);return r==null||n==null?null:new PD(this.field,r,n)}},ID=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 PD(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 CZ(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 ID(n,i)}},Met=il.Decoration.widget({widget:new class extends il.WidgetType{toDOM(){let e=document.createElement("span");return e.className="cm-snippetFieldPosition",e}ignoreEvent(){return!1}}}),jet=il.Decoration.mark({class:"cm-snippetField"}),Gv=class{constructor(t,r){this.ranges=t,this.active=r,this.deco=il.Decoration.set(t.map(n=>(n.from==n.to?Met:jet).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 Gv(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))}},RD=ea.StateEffect.define({map(e,t){return e&&e.map(t)}}),Net=ea.StateEffect.define(),BD=ea.StateField.define({create(){return null},update(e,t){for(let r of t.effects){if(r.is(RD))return r.value;if(r.is(Net)&&e)return new Gv(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=>il.EditorView.decorations.from(e,t=>t?t.deco:il.Decoration.none)});function DZ(e,t){return ea.EditorSelection.create(e.filter(r=>r.field==t).map(r=>ea.EditorSelection.range(r.from,r.to)))}function Tet(e){let t=ID.parse(e);return(r,n,i,a)=>{let{text:o,ranges:s}=t.instantiate(r.state,i),l={changes:{from:i,to:a,insert:ea.Text.of(o)}};if(s.length&&(l.selection=DZ(s,0)),s.length>1){let u=new Gv(s,0),c=l.effects=[RD.of(u)];r.state.field(BD,!1)===void 0&&c.push(ea.StateEffect.appendConfig.of([BD,Bet,Ret,Oet]))}r.dispatch(r.state.update(l))}}function p6e(e){return({state:t,dispatch:r})=>{let n=t.field(BD,!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:DZ(n.ranges,i),effects:RD.of(a?null:new Gv(n.ranges,i))})),!0}}var Fet=({state:e,dispatch:t})=>e.field(BD,!1)?(t(e.update({effects:RD.of(null)})),!0):!1,_et=p6e(1),Pet=p6e(-1),Iet=[{key:"Tab",run:_et,shift:Pet},{key:"Escape",run:Fet}],c6e=ea.Facet.define({combine(e){return e.length?e[0]:Iet}}),Bet=ea.Prec.highest(il.keymap.compute([c6e],e=>e.facet(c6e)));function Qv(e,t){return Object.assign(Object.assign({},t),{apply:Tet(e)})}var Ret=il.EditorView.domEventHandlers({mousedown(e,t){let r=t.state.field(BD,!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:DZ(r.ranges,i.field),effects:RD.of(r.ranges.some(a=>a.field>i.field)?new Gv(r.ranges,i.field):null)}),!0)}});var m6e=new class extends ea.RangeValue{};m6e.startSide=1;m6e.endSide=-1;var Avr=typeof navigator=="object"&&/Android\b/.test(navigator.userAgent);var $et=[Qv("function ${name}(${params}) {\n ${}\n}",{label:"function",detail:"definition",type:"keyword"}),Qv("for (let ${index} = 0; ${index} < ${bound}; ${index}++) {\n ${}\n}",{label:"for",detail:"loop",type:"keyword"}),Qv("for (let ${name} of ${collection}) {\n ${}\n}",{label:"for",detail:"of loop",type:"keyword"}),Qv(`try { \${} } catch (\${error}) { \${} @@ -208,23 +208,23 @@ For more information, see https://radix-ui.com/primitives/docs/components/${t.do constructor(\${params}) { \${} } -}`,{label:"class",detail:"definition",type:"keyword"}),Qv('import {${names}} from "${module}"\n${}',{label:"import",detail:"named",type:"keyword"}),Qv('import ${name} from "${module}"\n${}',{label:"import",detail:"default",type:"keyword"})],h6e=new a8,y6e=new Set(["Script","Block","FunctionExpression","FunctionDeclaration","ArrowFunction","MethodDeclaration","ForStatement"]);function $D(e){return(t,r)=>{let n=t.node.getChild("VariableDefinition");return n&&r(n,e),!0}}var Ret=["FunctionDeclaration"],$et={FunctionDeclaration:$D("function"),ClassDeclaration:$D("class"),ClassExpression:()=>!0,EnumDeclaration:$D("constant"),TypeAliasDeclaration:$D("type"),NamespaceDeclaration:$D("namespace"),VariableDefinition(e,t){e.matchContext(Ret)||t(e,"variable")},TypeDefinition(e,t){t(e,"type")},__proto__:null};function b6e(e,t){let r=h6e.get(t);if(r)return r;let n=[],i=!0;function a(o,s){let l=e.sliceString(o.from,o.to);n.push({label:l,type:s})}return t.cursor(ks.IncludeAnonymous).iterate(o=>{if(i)i=!1;else if(o.name){let s=$et[o.name];if(s&&s(o,a)||y6e.has(o.name))return!1}else if(o.to-o.from>8192){for(let s of b6e(e,o.node))n.push(s);return!1}}),h6e.set(t,n),n}var A6e=/^[\w$\xa1-\uffff][\w$\d\xa1-\uffff]*$/;function qet(e){let t=q2(e.state).resolve(e.pos,-1);if(t.name=="TemplateString"||t.name=="String"||t.name=="LineComment"||t.name=="BlockComment")return null;let r=t.to-t.from<20&&A6e.test(e.state.sliceDoc(t.from,t.to));if(!r&&!e.explicit)return null;let n=[];for(let i=t;i;i=i.parent)y6e.has(i.name)&&(n=n.concat(b6e(e.state.doc,i)));return{options:n,from:r?t.from:e.pos,validFor:A6e}}var vb=Ab.define({parser:jke.configure({props:[Wke.add({IfStatement:f8({except:/^\s*({|else\b)/}),TryStatement:f8({except:/^\s*({|catch\b|finally\b)/}),LabeledStatement:Vke,SwitchBody:e=>{let t=e.textAfter,r=/^\s*\}/.test(t),n=/^\s*(case|default)\b/.test(t);return e.baseIndent+(r?0:n?1:2)*e.unit},Block:Hke({closing:"}"}),ArrowFunction:e=>e.baseIndent+e.unit,"TemplateString BlockComment":()=>-1,"Statement Property":f8({except:/^{/}),JSXElement(e){let t=/^\s*<\//.test(e.textAfter);return e.lineIndent(e.node.from)+(t?0:e.unit)},JSXEscape(e){let t=/\s*\}/.test(e.textAfter);return e.lineIndent(e.node.from)+(t?0:e.unit)},"JSXOpenTag JSXSelfClosingTag"(e){return e.column(e.node.from)+e.unit}}),Gke.add({"Block ClassBody SwitchBody EnumBody ObjectExpression ArrayExpression":Qke,BlockComment(e){return{from:e.from+2,to:e.to-2}}})]}),languageData:{closeBrackets:{brackets:["(","[","{","'",'"',"`"]},commentTokens:{line:"//",block:{open:"/*",close:"*/"}},indentOnInput:/^\s*(?:case |default:|\{|\}|<\/)$/,wordChars:"$"}}),Let=vb.configure({dialect:"ts"}),zet=vb.configure({dialect:"jsx"}),Uet=vb.configure({dialect:"jsx ts"});function x6e(e={}){let t=e.jsx?e.typescript?Uet:zet:e.typescript?Let:vb;return new c8(t,[vb.data.of({autocomplete:d6e(["LineComment","BlockComment","String"],f6e(Bet))}),vb.data.of({autocomplete:qet}),e.jsx?Het:[]])}function g6e(e,t,r=e.length){if(!t)return"";let n=t.getChild("JSXIdentifier");return n?e.sliceString(n.from,Math.min(n.to,r)):""}var Wet=typeof navigator=="object"&&/Android\b/.test(navigator.userAgent),Het=v6e.EditorView.inputHandler.of((e,t,r,n)=>{if((Wet?e.composing:e.compositionStarted)||e.state.readOnly||t!=r||n!=">"&&n!="/"||!vb.isActiveAt(e.state,t,-1))return!1;let{state:i}=e,a=i.changeByRange(o=>{var s,l,u;let{head:c}=o,f=q2(i).resolveInner(c,-1),d;if(f.name=="JSXStartTag"&&(f=f.parent),n==">"&&f.name=="JSXFragmentTag")return{range:x8.EditorSelection.cursor(c+1),changes:{from:c,insert:"><>"}};if(n==">"&&f.name=="JSXIdentifier"){if(((l=(s=f.parent)===null||s===void 0?void 0:s.lastChild)===null||l===void 0?void 0:l.name)!="JSXEndTag"&&(d=g6e(i.doc,f.parent,c)))return{range:x8.EditorSelection.cursor(c+1),changes:{from:c,insert:`>`}}}else if(n=="/"&&f.name=="JSXFragmentTag"){let p=f.parent,h=p?.parent;if(p.from==c-1&&((u=h.lastChild)===null||u===void 0?void 0:u.name)!="JSXEndTag"&&(d=g6e(i.doc,h?.firstChild,c))){let m=`/${d}>`;return{range:x8.EditorSelection.cursor(c+m.length),changes:{from:c,insert:m}}}}return{range:o}});return a.changes.empty?!1:(e.dispatch(a,{userEvent:"input.type",scrollIntoView:!0}),!0)});var w6e=require("@codemirror/view");var CZ=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.fontSize&&(a.fontSize=r.fontSize),(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=w6e.EditorView.theme(i,{dark:t==="dark"}),l=Wd.define(n),u=[s,eg(l)];return u};var Vet={background:"#fff",foreground:"#24292e",selection:"#BBDFFF",selectionMatch:"#BBDFFF",gutterBackground:"#fff",gutterForeground:"#6e7781"},Get=[{tag:[qe.standard(qe.tagName),qe.tagName],color:"#116329"},{tag:[qe.comment,qe.bracket],color:"#6a737d"},{tag:[qe.className,qe.propertyName],color:"#6f42c1"},{tag:[qe.variableName,qe.attributeName,qe.number,qe.operator],color:"#005cc5"},{tag:[qe.keyword,qe.typeName,qe.typeOperator,qe.typeName],color:"#d73a49"},{tag:[qe.string,qe.meta,qe.regexp],color:"#032f62"},{tag:[qe.name,qe.quote],color:"#22863a"},{tag:[qe.heading,qe.strong],color:"#24292e",fontWeight:"bold"},{tag:[qe.emphasis],color:"#24292e",fontStyle:"italic"},{tag:[qe.deleted],color:"#b31d28",backgroundColor:"ffeef0"},{tag:[qe.atom,qe.bool,qe.special(qe.variableName)],color:"#e36209"},{tag:[qe.url,qe.escape,qe.regexp,qe.link],color:"#032f62"},{tag:qe.link,textDecoration:"underline"},{tag:qe.strikethrough,textDecoration:"line-through"},{tag:qe.invalid,color:"#cb2431"}],Qet=e=>{var{theme:t="light",settings:r={},styles:n=[]}=e||{};return CZ({theme:t,settings:Fn({},Vet,r),styles:[...Get,...n]})},Ovr=Qet(),Yet={background:"#0d1117",foreground:"#c9d1d9",caret:"#c9d1d9",selection:"#003d73",selectionMatch:"#003d73",lineHighlight:"#36334280"},Zet=[{tag:[qe.standard(qe.tagName),qe.tagName],color:"#7ee787"},{tag:[qe.comment,qe.bracket],color:"#8b949e"},{tag:[qe.className,qe.propertyName],color:"#d2a8ff"},{tag:[qe.variableName,qe.attributeName,qe.number,qe.operator],color:"#79c0ff"},{tag:[qe.keyword,qe.typeName,qe.typeOperator,qe.typeName],color:"#ff7b72"},{tag:[qe.string,qe.meta,qe.regexp],color:"#a5d6ff"},{tag:[qe.name,qe.quote],color:"#7ee787"},{tag:[qe.heading,qe.strong],color:"#d2a8ff",fontWeight:"bold"},{tag:[qe.emphasis],color:"#d2a8ff",fontStyle:"italic"},{tag:[qe.deleted],color:"#ffdcd7",backgroundColor:"ffeef0"},{tag:[qe.atom,qe.bool,qe.special(qe.variableName)],color:"#ffab70"},{tag:qe.link,textDecoration:"underline"},{tag:qe.strikethrough,textDecoration:"line-through"},{tag:qe.invalid,color:"#f97583"}],Xet=e=>{var{theme:t="dark",settings:r={},styles:n=[]}=e||{};return CZ({theme:t,settings:Fn({},Yet,r),styles:[...Zet,...n]})},S6e=Xet();var E6e=e=>{let{command:t}=e,r=(0,Q2.useMemo)(()=>t?`const ${t.schema.id} = (${t.fields.map(i=>`${i.name}: ${i.type}`).join(", ")}, $api: API, $contexts) => { +}`,{label:"class",detail:"definition",type:"keyword"}),Qv('import {${names}} from "${module}"\n${}',{label:"import",detail:"named",type:"keyword"}),Qv('import ${name} from "${module}"\n${}',{label:"import",detail:"default",type:"keyword"})],h6e=new a8,y6e=new Set(["Script","Block","FunctionExpression","FunctionDeclaration","ArrowFunction","MethodDeclaration","ForStatement"]);function $D(e){return(t,r)=>{let n=t.node.getChild("VariableDefinition");return n&&r(n,e),!0}}var qet=["FunctionDeclaration"],Let={FunctionDeclaration:$D("function"),ClassDeclaration:$D("class"),ClassExpression:()=>!0,EnumDeclaration:$D("constant"),TypeAliasDeclaration:$D("type"),NamespaceDeclaration:$D("namespace"),VariableDefinition(e,t){e.matchContext(qet)||t(e,"variable")},TypeDefinition(e,t){t(e,"type")},__proto__:null};function b6e(e,t){let r=h6e.get(t);if(r)return r;let n=[],i=!0;function a(o,s){let l=e.sliceString(o.from,o.to);n.push({label:l,type:s})}return t.cursor(ks.IncludeAnonymous).iterate(o=>{if(i)i=!1;else if(o.name){let s=Let[o.name];if(s&&s(o,a)||y6e.has(o.name))return!1}else if(o.to-o.from>8192){for(let s of b6e(e,o.node))n.push(s);return!1}}),h6e.set(t,n),n}var A6e=/^[\w$\xa1-\uffff][\w$\d\xa1-\uffff]*$/;function zet(e){let t=q2(e.state).resolve(e.pos,-1);if(t.name=="TemplateString"||t.name=="String"||t.name=="LineComment"||t.name=="BlockComment")return null;let r=t.to-t.from<20&&A6e.test(e.state.sliceDoc(t.from,t.to));if(!r&&!e.explicit)return null;let n=[];for(let i=t;i;i=i.parent)y6e.has(i.name)&&(n=n.concat(b6e(e.state.doc,i)));return{options:n,from:r?t.from:e.pos,validFor:A6e}}var vb=Ab.define({parser:jke.configure({props:[Wke.add({IfStatement:f8({except:/^\s*({|else\b)/}),TryStatement:f8({except:/^\s*({|catch\b|finally\b)/}),LabeledStatement:Vke,SwitchBody:e=>{let t=e.textAfter,r=/^\s*\}/.test(t),n=/^\s*(case|default)\b/.test(t);return e.baseIndent+(r?0:n?1:2)*e.unit},Block:Hke({closing:"}"}),ArrowFunction:e=>e.baseIndent+e.unit,"TemplateString BlockComment":()=>-1,"Statement Property":f8({except:/^{/}),JSXElement(e){let t=/^\s*<\//.test(e.textAfter);return e.lineIndent(e.node.from)+(t?0:e.unit)},JSXEscape(e){let t=/\s*\}/.test(e.textAfter);return e.lineIndent(e.node.from)+(t?0:e.unit)},"JSXOpenTag JSXSelfClosingTag"(e){return e.column(e.node.from)+e.unit}}),Gke.add({"Block ClassBody SwitchBody EnumBody ObjectExpression ArrayExpression":Qke,BlockComment(e){return{from:e.from+2,to:e.to-2}}})]}),languageData:{closeBrackets:{brackets:["(","[","{","'",'"',"`"]},commentTokens:{line:"//",block:{open:"/*",close:"*/"}},indentOnInput:/^\s*(?:case |default:|\{|\}|<\/)$/,wordChars:"$"}}),Uet=vb.configure({dialect:"ts"}),Wet=vb.configure({dialect:"jsx"}),Het=vb.configure({dialect:"jsx ts"});function x6e(e={}){let t=e.jsx?e.typescript?Het:Wet:e.typescript?Uet:vb;return new c8(t,[vb.data.of({autocomplete:d6e(["LineComment","BlockComment","String"],f6e($et))}),vb.data.of({autocomplete:zet}),e.jsx?Get:[]])}function g6e(e,t,r=e.length){if(!t)return"";let n=t.getChild("JSXIdentifier");return n?e.sliceString(n.from,Math.min(n.to,r)):""}var Vet=typeof navigator=="object"&&/Android\b/.test(navigator.userAgent),Get=v6e.EditorView.inputHandler.of((e,t,r,n)=>{if((Vet?e.composing:e.compositionStarted)||e.state.readOnly||t!=r||n!=">"&&n!="/"||!vb.isActiveAt(e.state,t,-1))return!1;let{state:i}=e,a=i.changeByRange(o=>{var s,l,u;let{head:c}=o,f=q2(i).resolveInner(c,-1),d;if(f.name=="JSXStartTag"&&(f=f.parent),n==">"&&f.name=="JSXFragmentTag")return{range:x8.EditorSelection.cursor(c+1),changes:{from:c,insert:"><>"}};if(n==">"&&f.name=="JSXIdentifier"){if(((l=(s=f.parent)===null||s===void 0?void 0:s.lastChild)===null||l===void 0?void 0:l.name)!="JSXEndTag"&&(d=g6e(i.doc,f.parent,c)))return{range:x8.EditorSelection.cursor(c+1),changes:{from:c,insert:`>`}}}else if(n=="/"&&f.name=="JSXFragmentTag"){let p=f.parent,h=p?.parent;if(p.from==c-1&&((u=h.lastChild)===null||u===void 0?void 0:u.name)!="JSXEndTag"&&(d=g6e(i.doc,h?.firstChild,c))){let m=`/${d}>`;return{range:x8.EditorSelection.cursor(c+m.length),changes:{from:c,insert:m}}}}return{range:o}});return a.changes.empty?!1:(e.dispatch(a,{userEvent:"input.type",scrollIntoView:!0}),!0)});var w6e=require("@codemirror/view");var OZ=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.fontSize&&(a.fontSize=r.fontSize),(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=w6e.EditorView.theme(i,{dark:t==="dark"}),l=Wd.define(n),u=[s,eg(l)];return u};var Qet={background:"#fff",foreground:"#24292e",selection:"#BBDFFF",selectionMatch:"#BBDFFF",gutterBackground:"#fff",gutterForeground:"#6e7781"},Yet=[{tag:[qe.standard(qe.tagName),qe.tagName],color:"#116329"},{tag:[qe.comment,qe.bracket],color:"#6a737d"},{tag:[qe.className,qe.propertyName],color:"#6f42c1"},{tag:[qe.variableName,qe.attributeName,qe.number,qe.operator],color:"#005cc5"},{tag:[qe.keyword,qe.typeName,qe.typeOperator,qe.typeName],color:"#d73a49"},{tag:[qe.string,qe.meta,qe.regexp],color:"#032f62"},{tag:[qe.name,qe.quote],color:"#22863a"},{tag:[qe.heading,qe.strong],color:"#24292e",fontWeight:"bold"},{tag:[qe.emphasis],color:"#24292e",fontStyle:"italic"},{tag:[qe.deleted],color:"#b31d28",backgroundColor:"ffeef0"},{tag:[qe.atom,qe.bool,qe.special(qe.variableName)],color:"#e36209"},{tag:[qe.url,qe.escape,qe.regexp,qe.link],color:"#032f62"},{tag:qe.link,textDecoration:"underline"},{tag:qe.strikethrough,textDecoration:"line-through"},{tag:qe.invalid,color:"#cb2431"}],Zet=e=>{var{theme:t="light",settings:r={},styles:n=[]}=e||{};return OZ({theme:t,settings:Fn({},Qet,r),styles:[...Yet,...n]})},jvr=Zet(),Xet={background:"#0d1117",foreground:"#c9d1d9",caret:"#c9d1d9",selection:"#003d73",selectionMatch:"#003d73",lineHighlight:"#36334280"},Ket=[{tag:[qe.standard(qe.tagName),qe.tagName],color:"#7ee787"},{tag:[qe.comment,qe.bracket],color:"#8b949e"},{tag:[qe.className,qe.propertyName],color:"#d2a8ff"},{tag:[qe.variableName,qe.attributeName,qe.number,qe.operator],color:"#79c0ff"},{tag:[qe.keyword,qe.typeName,qe.typeOperator,qe.typeName],color:"#ff7b72"},{tag:[qe.string,qe.meta,qe.regexp],color:"#a5d6ff"},{tag:[qe.name,qe.quote],color:"#7ee787"},{tag:[qe.heading,qe.strong],color:"#d2a8ff",fontWeight:"bold"},{tag:[qe.emphasis],color:"#d2a8ff",fontStyle:"italic"},{tag:[qe.deleted],color:"#ffdcd7",backgroundColor:"ffeef0"},{tag:[qe.atom,qe.bool,qe.special(qe.variableName)],color:"#ffab70"},{tag:qe.link,textDecoration:"underline"},{tag:qe.strikethrough,textDecoration:"line-through"},{tag:qe.invalid,color:"#f97583"}],Jet=e=>{var{theme:t="dark",settings:r={},styles:n=[]}=e||{};return OZ({theme:t,settings:Fn({},Xet,r),styles:[...Ket,...n]})},S6e=Jet();var E6e=e=>{let{command:t}=e,r=(0,Q2.useMemo)(()=>t?`const ${t.schema.id} = (${t.fields.map(i=>`${i.name}: ${i.type}`).join(", ")}, $api: API, $contexts) => { ${t.code} }`:"",[t]),n=i=>{e.saveCommand({...t,code:i.split(` `).slice(1,-1).join(` -`),codeType:"script"})};return Q2.default.createElement("div",null,Q2.default.createElement(VC,{className:"mk-editor-code",value:r,height:"100%",theme:S6e,extensions:[x6e({jsx:!0})],onChange:n}),Q2.default.createElement(H5,{type:"script",code:t.code,fields:t.fields,value:{},superstate:e.superstate,path:e.path}))};var k6e=e=>{let[t,r]=(0,ta.useState)(null),n=(0,ta.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,ta.useEffect)(()=>{r(e.superstate.cli.commandForAction(e.action))},[e.action]),(0,ta.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=mr(p.value,p.type);if(h)return h?.default},f=(p,h)=>{let m=mr(p.value,p.type)??{};m.default=h,s({...p,value:JSON.stringify(m)},p)},d=(0,ta.useMemo)(()=>t?.fields.reduce((p,h)=>({...p,[h.name]:c(h)}),{})??{},[t?.fields]);return ta.default.createElement("div",{className:"mk-editor-actions"},t&&ta.default.createElement(ta.default.Fragment,null,ta.default.createElement("div",{className:"mk-props-contexts"},ta.default.createElement("div",{className:"mk-path-context-row"},ta.default.createElement("div",{className:"mk-path-context-field"},"Type"),ta.default.createElement("div",{className:"mk-path-context-value"},ta.default.createElement(L9,{superstate:e.superstate,options:u,value:t.schema.type,selectValue:p=>i({...t,schema:{...t.schema,type:p}})}))),ta.default.createElement("div",{className:"mk-path-context-row"},ta.default.createElement("div",{className:"mk-path-context-field"},"Properties")),ta.default.createElement("div",{className:"mk-cell-object"},t.fields.map(p=>ta.default.createElement(xs,{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})}}))),ta.default.createElement("button",{className:"mk-inline-button",onClick:p=>l(p)},ta.default.createElement("div",{className:"mk-icon-xsmall",dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//plus")}}),W.labels.newProperty)),t.schema.type=="script"?ta.default.createElement(E6e,{superstate:e.superstate,command:t,saveCommand:i,values:d,path:n.path}):t.schema.type=="actions"?ta.default.createElement(uke,{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"?ta.default.createElement(Ah,{superstate:e.superstate,formula:t.code,saveFormula:p=>{i({...t,code:p})},fields:t.fields,value:d,path:n.path}):ta.default.createElement("div",null)))};var Jo=Ae(Te());var M8=Ae(Te());var ep=Ae(Te());var Y2=Ae(Te()),w8=e=>{let t=e.state.props.value,r=(0,Y2.useMemo)(()=>e.superstate.ui.getUIPath(t),[t]);return e.state?.props.value?.length>0?Y2.default.createElement("audio",{controls:!0,preload:"none",src:r}):Y2.default.createElement(Y2.default.Fragment,null)};var Z2=Ae(Te());function Ket(e){return e?.replace(/([^/])#([*^])/g,"$1/#$2")}var S8=e=>{let t=Ket(e.state?.props?.value),{updateNode:r}=(0,Z2.useContext)(Hi),{id:n}=(0,Z2.useContext)(Ii),i=o=>{ao(o,Ne(o.view.document),e.superstate,s=>r(e.treeNode.node,{props:{...e.treeNode.node.props,value:jr(s+"/#^"+pr)}}))},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}LN(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?Z2.default.createElement(Yv,{id:n,source:e.source,showTitle:!0,superstate:e.superstate,path:t,minMode:e.state?.styles?.["--mk-min-mode"],containerRef:e.containerRef,setFrameSchema:a}):Z2.default.createElement("div",{className:"mk-frame-placeholder",onClick:o=>i(o)},W.labels.selectSpace)};var Jd=Ae(Te());var E8=e=>{let{selectionMode:t,selected:r,selection:n}=(0,Jd.useContext)(Vi),{updateNode:i,nodes:a}=(0,Jd.useContext)(Hi),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(Fa,{ui:e.superstate.ui,selectedSticker:p=>o(p)}),Ne(d.view.document))},[c,f]=e.state.props?.value?ng(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 Rf=Ae(Te());var k8=e=>{let t=e.state.props.value,r=(0,Rf.useMemo)(()=>e.superstate.ui.getUIPath(t,!0),[t]),{nodes:n,updateNode:i}=(0,Rf.useContext)(Hi),{linkedProps:a}=(0,Rf.useContext)(Ii),{selectionMode:o,selected:s,selection:l}=(0,Rf.useContext)(Vi),u=l?.includes(e.treeNode.node.id),c=p=>{!_u(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(Rf.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,Rf.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?Rf.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?Rf.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)}):Rf.default.createElement(Rf.default.Fragment,null)};var yg=Ae(Te()),C8=e=>{let{selectionMode:t}=(0,yg.useContext)(Vi),{saveState:r,instance:n}=(0,yg.useContext)(Ii),[i,a]=(0,yg.useState)(""),o=e.state,s=e.state.styles?.as;return(0,yg.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]),yg.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 Bh=Ae(Te());var C6e=Ae(Te());function DZ(e){(0,C6e.useEffect)(e,[])}var qD=Ae(Te());function yb(e,t,r=window){let n=(0,qD.useRef)(t);(0,qD.useEffect)(()=>{n.current=t},[t]),(0,qD.useEffect)(()=>{if(r==null)return;let i=a=>n.current(a);return r.addEventListener(e,i),()=>r.removeEventListener(e,i)},[e,r])}var Ih=Ae(Te());function OZ(e,t){let r=(0,Ih.useRef)(e),n=(0,Ih.useRef)(null);(0,Ih.useEffect)(()=>{r.current=e},[e]);let i=(0,Ih.useCallback)(()=>{n.current=setTimeout(()=>r.current(),t)},[t]),a=(0,Ih.useCallback)(()=>{n.current&&clearTimeout(n.current)},[]);return(0,Ih.useEffect)(()=>(i(),a),[t,i,a]),{reset:(0,Ih.useCallback)(()=>{a(),i()},[a,i]),clear:a}}function LD(e,t,{delay:r=400}={}){let{reset:n,clear:i}=OZ(t,r);DZ(i),yb("mousedown",n,e.current),yb("touchstart",n,e.current),yb("mouseup",i,e.current),yb("mouseleave",i,e.current),yb("touchend",i,e.current)}var D8=e=>{let{selectionMode:t,selection:r,selectable:n,selected:i,select:a}=(0,Bh.useContext)(Vi),o=(0,Bh.useRef)(null),{updateNode:s,nodes:l,deleteNode:u}=(0,Bh.useContext)(Hi),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)};LD(o,()=>{if(x){a(e.treeNode.node.id,!1);return}});let b=r.includes(e.treeNode.id),{linkedProps:v}=(0,Bh.useContext)(Ii),x=(0,Bh.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:_u(e.treeNode.node.props.value)?!!(t==1||t==3&&b):!1,[e.treeNode,t,i,b,v]);return e.state&&Bh.default.createElement("div",{className:"mk-frame-text","data-placeholder":x||n?W.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 X2=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(C8,{...t}):e.treeNode.node.type=="text"?ep.default.createElement(D8,{...t}):e.treeNode.node.type=="icon"?ep.default.createElement(E8,{...t}):e.treeNode.node.type=="audio"?ep.default.createElement(w8,{...t}):e.treeNode.node.type=="image"?ep.default.createElement(k8,{...t}):e.treeNode.node.type=="space"?ep.default.createElement(S8,{...t,source:e.source}):e.treeNode.node.type=="content"?ep.default.createElement($9,null,e.treeNode.children.filter(i=>i.node.type!="slides").map((i,a)=>ep.default.createElement(X2,{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(O8,{...t,source:e.source}):e.treeNode.children.filter(i=>i.node.type!="slides").map((i,a)=>ep.default.createElement(X2,{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 ${C2(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:{...MZ,...e.instance.state[e.treeNode.id]?.styles}},r)};var bb=e=>{let{saveState:t,instance:r}=(0,M8.useContext)(Ii);return r.exec&&M8.default.createElement(X2,{superstate:e.superstate,treeNode:r.exec,instance:r,saveState:t,source:e.source},e.children)};var Yv=e=>{let t=(0,Jo.useMemo)(()=>e.superstate.spaceManager.uriByString(e.path,e.source),[e.path,e.source]),[r,n]=(0,Jo.useState)(null);return(0,Jo.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:i0})},[t]),Jo.default.createElement(Jo.default.Fragment,null,r?.path&&(r?.type=="context"?Jo.default.createElement(Ys,{superstate:e.superstate,path:r.path,readMode:!1},Jo.default.createElement(lh,{superstate:e.superstate},Jo.default.createElement(Av,{superstate:e.superstate,contextSchema:r.contextSchema,schema:r.frameSchema},Jo.default.createElement(m2,{superstate:e.superstate},Jo.default.createElement(K2,{showTitle:e.showTitle,superstate:e.superstate,minMode:e.minMode,containerRef:e.containerRef,setView:e.setFrameSchema}))))):r?.type=="frame"?Jo.default.createElement(N9,{superstate:e.superstate,path:t,cols:[]},Jo.default.createElement(ug,{id:e.id,superstate:e.superstate,props:{},editable:!1},Jo.default.createElement(bb,{superstate:e.superstate,source:e.source}))):r?.type=="action"?Jo.default.createElement(k6e,{superstate:e.superstate,action:e.path}):Jo.default.createElement(Jo.default.Fragment,null)))};var j8=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(hv,{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(Yv,{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(hv,{superstate:e.superstate,path:e.path,load:!0,classname:"mk-flow-node"}):Lc.default.createElement(Lc.default.Fragment,null))};var Os=Ae(Te());function Jet(e){let t=/!\[!\[(.*?)\]\]/,r=/!!\[\[(.*?)\]\]/,n=e.match(t),i=e.match(r);return n?n[1]:i?i[1]:e}var O8=e=>{let{spaceState:t}=(0,Os.useContext)(ur),r=(0,Os.useMemo)(()=>{let h=e.state?.props?.value,m=h?e.superstate.spaceManager.resolvePath(Jet(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,Os.useContext)(Hi),{selectionMode:a}=(0,Os.useContext)(Vi),[o,s]=(0,Os.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,Os.useContext)(Ii),[f,d]=(0,Os.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 Os.default.createElement("div",{className:"mk-node-flow"},r&&(e.state?.styles?.["--mk-min-mode"]?Os.default.createElement(Os.default.Fragment,null):Os.default.createElement("div",{className:"mk-node-link"},Os.default.createElement(oo,{superstate:e.superstate,path:r.path},!u&&Os.default.createElement(Vd,{superstate:e.superstate,collapsed:!o,onToggle:p})))),e.state&&o&&e.state?.props?.value?.length>0?Os.default.createElement(j8,{id:c,superstate:e.superstate,path:r?.path??e.state?.props?.value,containerRef:e.containerRef,styles:{},readOnly:!0}):a>0&&Os.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)})}},W.hintText.selectNote))};var Rh=Ae(Te()),D6e=e=>{let{spaceInfo:t}=(0,Rh.useContext)(ur),{addNode:r,moveUp:n,moveDown:i,setLastCreatedId:a}=(0,Rh.useContext)(Hi),{select:o,selection:s}=(0,Rh.useContext)(Vi),l=s.includes(e.node.id);return Rh.default.createElement(Rh.default.Fragment,null,Rh.default.createElement("div",{className:"mk-editor-frame-hover-horizontal",style:{pointerEvents:"auto",opacity:e.visible?"1":"0"}},e.dragRef&&Rh.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)&&Rh.default.createElement("div",{onClick:u=>{D2(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 bg=Ae(Te()),jZ=e=>{let t=(0,bg.useRef)(null),[r,n]=(0,bg.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,bg.useState)(!1);return(0,bg.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]),bg.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 O6e=Ae(Qa()),zc=Ae(Te());var M6e=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]=zc.default.useState(Math.max(8,r));(0,zc.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 zc.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)"}},zc.default.createElement("div",{className:(0,O6e.default)("mk-frame-corners")},zc.default.createElement("div",{className:"mk-frame-corner",style:{position:"absolute",transform:`translate(${s}px, ${s}px)`,zIndex:"var(--mk-layer-editor-overlay)"}},zc.default.createElement(rl,{...o,cursor:"nwse-resize",reverseY:!0})),zc.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)"}},zc.default.createElement(rl,{...o,cursor:"nesw-resize",reverseX:!0,reverseY:!0})),zc.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)"}},zc.default.createElement(rl,{...o,cursor:"nesw-resize"})),zc.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)"}},zc.default.createElement(rl,{...o,reverseX:!0,cursor:"nwse-resize"}))))};var j6e=Ae(Qa());var xg=Ae(Te());var ett=e=>{let{instance:t,id:r}=(0,xg.useContext)(Ii),{spaceInfo:n}=(0,xg.useContext)(ur),{setNodeRef:i}=Lu({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 xg.default.createElement("div",{ref:i,className:(0,j6e.default)(e.active?`mk-indicator-${c}`:"","mk-frame-drop-zone"),style:{left:o,top:s,width:l,height:u}})},N6e=e=>{let{frameSchema:t}=(0,xg.useContext)(Aa),{hoverNode:r}=(0,xg.useContext)(Ii),n=[...e.mode==1?["top","bottom","left","right"]:e.mode==2?["top","bottom"]:e.mode==3?["left","right"]:[],...e.insertMode==1?["inside"]:[]];return xg.default.createElement("div",{className:"mk-frame-drop-zone-container",style:{width:e.width,height:e.height}},n.map(i=>xg.default.createElement(ett,{...e,key:i,active:r?.node==e.node&&r?.direction==i,direction:i,mode:e.mode,schemaID:t.id})))};var xa=Ae(Te());var ttt=(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},T6e=e=>{let t=l=>{let u=l?l.match(/^(\d+(?:\.\d+)?)\s?([a-zA-Z%]+)$/):null;return u?parseInt(u[1]):0},[r,n]=xa.default.useState({row:t(e.styles.rowGap),column:t(e.styles.columnGap)});(0,xa.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,xa.useMemo)(()=>ttt(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,xa.useMemo)(()=>{let l=[];return Object.keys(o).forEach(u=>{l.push(...o[u].items)}),l},[o]);return xa.default.createElement("div",{className:`mk-frame-gaps ${C2(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)=>xa.default.createElement(xa.default.Fragment,null,xa.default.createElement("div",{style:{width:l.width,height:l.height}}),u==c.length-1?xa.default.createElement(xa.default.Fragment,null):o[l.row].end==u?xa.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)"}},xa.default.createElement(rl,{...a,cursor:"col-resize",disableX:!0,reverseY:!0})):xa.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)"}},xa.default.createElement(rl,{...i,cursor:"col-resize",disableY:!0})))):s.map((l,u,c)=>xa.default.createElement(xa.default.Fragment,null,xa.default.createElement("div",{style:{width:l.width,height:l.height}}),u==c.length-1?xa.default.createElement(xa.default.Fragment,null):o[l.row].end==u?xa.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)"}},xa.default.createElement(rl,{...a,cursor:"col-resize",disableX:!0,reverseY:!0})):xa.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)"}},xa.default.createElement(rl,{...i,cursor:"row-resize",disableX:!0,reverseY:!0})))))};var F6e=Ae(Qa()),vu=Ae(Te());var _6e=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,F6e.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(rl,{...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(rl,{...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(rl,{...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(rl,{...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 U6e=Ae(Qa());var xb=Ae(Te()),L6e=Ae(bl());var T8=Ae(Te()),rtt=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)}}(),es=function(){return es=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)}},ltt=["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"],q6e="__resizable_base__",z6e=function(e){itt(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(q6e):a.className+=q6e,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||att},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 NZ(r.state[s])},a=n&&typeof n.width<"u"&&!this.state.isResizing?NZ(n.width):i("width"),o=n&&typeof n.height<"u"&&!this.state.isResizing?NZ(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&&J2("left",a),s=i&&J2("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=F8(r,x,w),n=F8(n,S,k)}else r=F8(r,c,f),n=F8(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&&ott(r.nativeEvent)?(i=r.nativeEvent.clientX,a=r.nativeEvent.clientY):r.nativeEvent&&_8(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:$h($h({},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&&_8(r))try{r.preventDefault(),r.stopPropagation()}catch{}var i=this.props,a=i.maxWidth,o=i.maxHeight,s=i.minWidth,l=i.minHeight,u=_8(r)?r.touches[0].clientX:r.clientX,c=_8(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=stt(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=$6e(x,this.props.snap.x,this.props.snapGap)),this.props.snap&&this.props.snap.y&&(v=$6e(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=R6e(x,this.props.grid[0]),j=R6e(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,L6e.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:$h($h({},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?xb.createElement(B6e,{key:f,direction:f,onResizeStart:r.onResizeStart,replaceStyles:a&&a[f],className:o&&o[f]},u&&u[f]?u[f]:null):null});return xb.createElement("div",{className:l,style:s},c)},t.prototype.render=function(){var r=this,n=Object.keys(this.props).reduce(function(o,s){return ltt.indexOf(s)!==-1||(o[s]=r.props[s]),o},{}),i=$h($h($h({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 xb.createElement(a,$h({ref:this.ref,style:i,className:this.props.className},n),this.state.isResizing&&xb.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}(xb.PureComponent);var al=Ae(Te());var TZ=e=>{let t=o=>o?o=="auto"?"Fit":o=="100%"?"Fill":o:null,[r,n]=al.default.useState(null),[i,a]=al.default.useState({width:e.resizeMode!=2?e.size.width:e.size.minWidth,height:e.size.height});return al.default.useEffect(()=>{a({width:e.resizeMode!=2?e.size.width:e.size.minWidth,height:e.size.height})},[e.size,e.resizeMode]),(0,al.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]),al.default.createElement("div",{style:{position:"absolute",top:0,left:0,width:e.clientSize.width,height:e.clientSize.height}},al.default.createElement(z6e,{lockAspectRatio:r?.shiftKey,className:(0,U6e.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&&al.default.createElement("div",{className:"mk-frame-resize-label-width"},al.default.createElement("div",null,al.default.createElement("span",null,t(i.width)??W.editor.fit),i.width&&i.width!="auto"?al.default.createElement("div",{onClick:o=>{e.resize({width:jr("auto")}),o.stopPropagation()},"aria-label":W.editor.scaleToFit,style:{display:"flex"},dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//fold-horizontal")}}):al.default.createElement("div",{onClick:o=>{e.resize({width:jr("100%")}),o.stopPropagation()},"aria-label":W.editor.scaleToFill,style:{display:"flex"},dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//unfold-horizontal")}}))),e.clientSize?.height>50&&e.resizeMode==1&&al.default.createElement("div",{className:"mk-frame-resize-label-height"},al.default.createElement("div",null,al.default.createElement("span",null,t(i.height)??W.editor.fit),i.height&&i.height!="auto"?al.default.createElement("div",{onClick:o=>{e.resize({height:jr("auto")}),o.stopPropagation()},"aria-label":W.editor.scaleToFit,style:{display:"flex"},dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//fold-vertical")}}):al.default.createElement("div",{onClick:o=>{e.resize({height:jr("100%")}),o.stopPropagation()},"aria-label":W.editor.scaleToFill,style:{display:"flex"},dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//unfold-vertical")}}))))};var W6e=Ae(Te()),H6e=e=>W6e.default.createElement("div",{className:"mk-node-new"});var MZ={position:"relative"},utt=(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)(Ii);return zt.default.createElement(zt.default.Fragment,null,n.node.type=="new"?zt.default.createElement(H6e,{...r}):n.node.type=="input"?zt.default.createElement(C8,{...r}):n.node.type=="text"?zt.default.createElement(D8,{...r}):n.node.type=="icon"?zt.default.createElement(E8,{...r}):n.node.type=="audio"?zt.default.createElement(w8,{...r}):n.node.type=="image"?zt.default.createElement(k8,{...r}):n.node.type=="space"?zt.default.createElement(S8,{...r,containerRef:t.containerRef,source:i.path}):n.node.type=="flow"?zt.default.createElement(O8,{...r,source:i.path,containerRef:t.containerRef}):n.node.type=="content"?zt.default.createElement($9,{editable:!t.treeNode.isRef},t.treeNode.children.map((o,s)=>o.node.type=="slides"?null:zt.default.createElement(zD,{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(zD,{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(Pv,{superstate:t.superstate,id:n.id,editMode:t.editMode},n.children.map((o,s)=>o.node.type=="slides"?null:zt.default.createElement(zD,{superstate:t.superstate,key:o.id,treeNode:o,instance:t.instance,containerRef:t.containerRef},t.children)))))}),zD=e=>{let{selectionMode:t,selectable:r,selected:n,isParentToSelection:i,select:a,selection:o}=(0,zt.useContext)(Vi),{updateNode:s,addNode:l,deleteNode:u,nodes:c,selectedSlide:f}=(0,zt.useContext)(Hi),{setDragNode:d}=(0,zt.useContext)(vh),{saveState:p,selectableNodeBounds:h,id:m}=(0,zt.useContext)(Ii),{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)(Aa),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:_}=Ws({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={...MZ,...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 Da({onDragStart:ee=>{ee.active?.id==j&&d(zt.default.createElement("div",{style:{width:Y.current.clientWidth}},zt.default.createElement(X2,{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,FZ.default)(`mk-frame-edit ${C2(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(utt,{...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,FZ.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(TZ,{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(N6e,{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(TZ,{superstate:e.superstate,resizeMode:1,size:x?.styles,resize:fe,clientSize:{width:me,height:ke}}),zt.default.createElement(M6e,{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(T6e,{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(_6e,{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(D6e,{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(jZ,{nodeRect:U,containerRect:R},zt.default.createElement(ske,{editLayout:ee=>Oe(ee),superstate:e.superstate,node:S.node,duplicateFrame:()=>{l(S.node,S.node)},state:x,deleteFrame:()=>u(S.node),fields:tre(S.node)})):o.length>1&&o[0]==S.id?zt.default.createElement(jZ,{nodeRect:U,containerRect:R},zt.default.createElement(UEe,{superstate:e.superstate})):null),e.containerRef.current))};var I8=e=>{let{spaceInfo:t}=(0,Rl.useContext)(ur),{undoLastAction:r,redoAction:n,frameSchema:i}=(0,Rl.useContext)(Aa),{nodes:a,addNode:o,saveNodes:s,setLastCreatedId:l}=(0,Rl.useContext)(Hi),{hoverNode:u,setHoverNode:c,instance:f,id:d}=(0,Rl.useContext)(Ii),{selectionMode:p,selection:h,select:m}=(0,Rl.useContext)(Vi),g=()=>{c(null)};Da({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]=gD(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]=gD(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]=gD({...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]=gD({...p0.node,props:{value:jr(ib(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={...Q1.node,styles:{...Q1.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,Rl.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,Rl.useEffect)(()=>(e.superstate.ui.inputManager.on("keydown",b),()=>{e.superstate.ui.inputManager.off("keydown",b)}),[b]),Rl.default.createElement(Rl.default.Fragment,null,f.exec&&Rl.default.createElement("div",{className:"mk-f-root",style:{position:"relative"}},p>=3&&Rl.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"&&Rl.default.createElement("button",{onClick:()=>{e.superstate.spaceManager.saveFrame(t.path,aw.main)}},"+ Add View"),Rl.default.createElement(zD,{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=>G6e.default.isEqual(e.contexts,g)?g:e.contexts),[e.contexts]);let{spaceInfo:n}=(0,$o.useContext)(ur),{dbSchema:i}=(0,$o.useContext)(Ta),{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}=Foe({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:HU});return Da({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(Pv,{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(I8,{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(bb,{superstate:e.superstate})),$o.default.createElement("div",{ref:g=>{c(g),o.current=g},...s,...l,style:{transform:qu.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(bb,{superstate:e.superstate},e.children))))},ctt=async(e,t,r,n,i)=>{if(e&&t.id==r.id)if(n.data.current.schema==pr){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;Ioe(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 eE=Ae(Te()),Q6e=e=>{let t=(0,eE.useRef)(null);return(0,eE.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]),eE.default.createElement("div",{ref:t})};var tE=Ae(Te());var wb=e=>{let{selected:t}=(0,tE.useContext)(Vi);return e.editMode>=1&&e.uri.authority!="$kit"?tE.default.createElement(Av,{superstate:e.superstate,schema:e.uri.ref},tE.default.createElement(IEe,{superstate:e.superstate,cols:e.cols,editMode:e.editMode},e.children)):tE.default.createElement(N9,{superstate:e.superstate,path:e.uri,cols:e.cols},e.children)};var Y6e=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)(Ta),[A,b]=(0,Eo.useState)(1),v=25,{instance:x}=(0,Eo.useContext)(Ii),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(["",...(mr(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 Li[P]??Li.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=>Hn(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(wb,{superstate:e.superstate,uri:i,editMode:t=="listGroup"?f:0,cols:[]},Eo.default.createElement(WU,{items:Object.keys(j).map((P,q)=>s.path+"listGroup"+q),strategy:R6},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(wb,{uri:a,superstate:e.superstate,cols:[],editMode:t=="listItem"?f:0},Eo.default.createElement(WU,{items:j[P].flatMap((z,I)=>s.path+"listGroup"+q+"_listItem"+I),strategy:R6},j[P].filter(z=>parseInt(z._pageId)<=A*v).map((z,I)=>parseInt(z._pageId)==A*v?Eo.default.createElement(Q6e,{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 K2=e=>{let{pathState:t}=(0,ra.useContext)($r),{predicate:r,editMode:n,setEditMode:i,dbSchema:a,tableData:o,data:s,updateRow:l}=(0,ra.useContext)(Ta),{frameSchema:u}=(0,ra.useContext)(Aa),[c,f]=(0,ra.useState)(null),[d,p]=(0,ra.useState)(null),[h,m]=(0,ra.useState)(r?{listView:e.superstate.spaceManager.uriByString(hA(r.listView,"spaces://$kit/#*listView"),t.path),listGroup:e.superstate.spaceManager.uriByString(hA(r.listGroup,"spaces://$kit/#*listGroup"),t.path),listItem:e.superstate.spaceManager.uriByString(hA(r.listItem,"spaces://$kit/#*rowItem"),t.path)}:null);(0,ra.useEffect)(()=>{if(!r)return;let A={listView:e.superstate.spaceManager.uriByString(hA(r.listView,"spaces://$kit/#*listView"),t.path),listGroup:e.superstate.spaceManager.uriByString(hA(r.listGroup,"spaces://$kit/#*listGroup"),t.path),listItem:e.superstate.spaceManager.uriByString(hA(r.listItem,"spaces://$kit/#*rowItem"),t.path)};m(b=>Z6e.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?ra.default.createElement("div",{className:"mk-context-container"},!e.minMode&&ra.default.createElement(b9,{showTitle:e.showTitle,superstate:e.superstate,setView:e.setView}),h?r.view=="table"||r.view=="db"||a?.primary!="true"&&!u?ra.default.createElement(AEe,{superstate:e.superstate}):r.view=="day"?ra.default.createElement(_9,{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"?ra.default.createElement(zEe,{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"?ra.default.createElement(qEe,{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))}}):ra.default.createElement("div",{className:"mk-editor-context",onKeyDown:g},ra.default.createElement(Pv,{superstate:e.superstate,id:"list",editMode:c=="listView"?n:0},n>0&&ra.default.createElement(n2e,{editSection:c,superstate:e.superstate,setEditSection:f,setEditMode:i}),ra.default.createElement(wb,{superstate:e.superstate,uri:h.listView,cols:[],editMode:c=="listView"?n:0},ra.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},ra.default.createElement(Y6e,{superstate:e.superstate,containerRef:e.containerRef,editSection:c,selectedIndex:d,setSelectedIndex:p,groupURI:h.listGroup,itemURI:h.listItem}))))):ra.default.createElement(ra.default.Fragment,null)):ra.default.createElement(ra.default.Fragment,null)};var _Z=e=>rE.default.createElement(Ys,{superstate:e.superstate,path:e.space.path,readMode:!1},rE.default.createElement(lh,{superstate:e.superstate},rE.default.createElement(Av,{superstate:e.superstate,schema:e.schema},rE.default.createElement(m2,{superstate:e.superstate},rE.default.createElement(K2,{showTitle:!1,superstate:e.superstate})))));var qh=Ae(bi()),Ku=Ae(Te()),yu=(0,Ku.createContext)({dragPaths:[],setDragPaths:qh.default.noop,selectedPaths:[],setSelectedPaths:qh.default.noop,activePath:null,setActivePath:qh.default.noop,activeFocus:0,setActiveFocus:qh.default.noop,activeViewSpaces:[],focuses:[],setFocuses:qh.default.noop,saveActiveSpace:qh.default.noop,closeActiveSpace:qh.default.noop,modifier:null,setModifier:qh.default.noop,editFocus:!1,setEditFocus:qh.default.noop}),X6e=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 W8=Ae(Te());var GCe=Ae(bi());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 K6e(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 J6e(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 eCe=()=>window.navigator.platform.startsWith("Mac")?"\u2325":"Alt";var Jr=Ae(Te());var tCe=Ae(Qa());var ts=Ae(Te());var rCe=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,tCe.default)("mk-focuses-item"),dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker(s.sticker)},onClick:u=>e.superstate.ui.openPalette(ts.default.createElement(Fa,{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)},W.buttons.save),ts.default.createElement("button",{onClick:()=>{e.focus.name.length==0?(i(a.filter((u,c)=>c!=n)),e.superstate.saveSettings()):o(!1)}},W.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 $8=Ae(Qa());var Zn=Ae(Te());var dn=Ae(Te()),Qi=Ae(cCe());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 nE(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 IZ(e){return R1(this,void 0,void 0,function(){return $1(this,function(t){return B8(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 B8(e)}function btt(e){return B8(e)&&B8(e.target)}function B8(e){return typeof e=="object"&&e!==null}function xtt(e){return PZ(e.target.files).map(function(t){return nE(t)})}function wtt(e){return R1(this,void 0,void 0,function(){var t;return $1(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 nE(n)})]}})})}function Stt(e,t){return R1(this,void 0,void 0,function(){var r,n;return $1(this,function(i){switch(i.label){case 0:return e.items?(r=PZ(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,fCe(pCe(n))];case 2:return[2,fCe(PZ(e.files).map(function(a){return nE(a)}))]}})})}function fCe(e){return e.filter(function(t){return vtt.indexOf(t.name)===-1})}function PZ(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,yCe(r)];if(e.sizer)return[!1,yCe(r)]}return[!0,null]}function Sb(e){return e!=null}function kCe(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=$Z(l,r),c=WD(u,1),f=c[0],d=qZ(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 LZ(e){e.preventDefault()}function Rtt(e){return e.indexOf("MSIE")!==-1||e.indexOf("Trident/")!==-1}function $tt(e){return e.indexOf("Edge/")!==-1}function CCe(){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 VZ=(0,dn.forwardRef)(function(e,t){var r=e.children,n=R8(e,qtt),i=GZ(n),a=i.open,o=R8(i,Ltt);return(0,dn.useImperativeHandle)(t,function(){return{open:a}},[a]),dn.default.createElement(dn.Fragment,null,r(lo(lo({},o),{},{open:a})))});VZ.displayName="Dropzone";var BCe={disabled:!1,getFilesFromEvent:IZ,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};VZ.defaultProps=BCe;VZ.propTypes={children:Qi.default.func,accept:Qi.default.objectOf(Qi.default.arrayOf(Qi.default.string)),multiple:Qi.default.bool,preventDropOnDocument:Qi.default.bool,noClick:Qi.default.bool,noKeyboard:Qi.default.bool,noDrag:Qi.default.bool,noDragEventsBubbling:Qi.default.bool,minSize:Qi.default.number,maxSize:Qi.default.number,maxFiles:Qi.default.number,disabled:Qi.default.bool,getFilesFromEvent:Qi.default.func,onFileDialogCancel:Qi.default.func,onFileDialogOpen:Qi.default.func,useFsAccessApi:Qi.default.bool,autoFocus:Qi.default.bool,onDragEnter:Qi.default.func,onDragLeave:Qi.default.func,onDragOver:Qi.default.func,onDrop:Qi.default.func,onDropAccepted:Qi.default.func,onDropRejected:Qi.default.func,onError:Qi.default.func,validator:Qi.default.func};var HZ={isFocused:!1,isFileDialogActive:!1,isDragActive:!1,isDragAccept:!1,isDragReject:!1,acceptedFiles:[],fileRejections:[]};function GZ(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t=lo(lo({},BCe),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 MCe(r)},[r]),N=(0,dn.useMemo)(function(){return OCe(r)},[r]),D=(0,dn.useMemo)(function(){return typeof g=="function"?g:PCe},[g]),P=(0,dn.useMemo)(function(){return typeof m=="function"?m:PCe},[m]),q=(0,dn.useRef)(null),z=(0,dn.useRef)(null),I=(0,dn.useReducer)(Ktt,HZ),T=zZ(I,2),L=T[0],_=T[1],Y=L.isFocused,oe=L.isFileDialogActive,te=(0,dn.useRef)(typeof window<"u"&&window.isSecureContext&&A&&DCe()),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",LZ,!1),document.addEventListener("drop",Ie,!1)),function(){v&&(document.removeEventListener("dragover",LZ),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&&kCe({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=$Z(Ct,C),Be=zZ(we,2),Le=Be[0],Ze=Be[1],He=qZ(Ct,o,a),Qe=zZ(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:[ECe]})}),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){jCe(ze)?(P(ze),_({type:"closeDialog"})):NCe(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=eO(n.label.sticker,e);t.tabHeaderInnerIconEl.innerHTML=o}}return}else if(t=e.app.workspace.getActiveViewOfType(kb)?.leaf,t){let r=t.view.getState().path,n=e.superstate.pathsIndex.get(r);if(n?.label?.sticker&&t.tabHeaderInnerIconEl){let[i,a]=ng(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=eO(n.label.sticker,e);t.tabHeaderInnerIconEl.innerHTML=o}}return}};var Pb=Ae(Te()),TOe=Ae(bl());function FOe(){let[e,t]=(0,Pb.useState)(new Map),[r,n]=(0,Pb.useState)(new Map),i=s=>r.get(s),a=(0,Pb.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,Pb.useMemo)(()=>[...e.entries()].map(([s,l])=>(0,TOe.createPortal)(l,s)),[e]);return{createRoot:a,portals:o,getRoot:i}}var vE=Ae(Te()),_Oe=e=>{let t=qw(Pp(RA,{activationConstraint:{distance:10}}),Pp($A,{activationConstraint:{delay:250,tolerance:5}}),Pp($0,{coordinateGetter:qN})),{createRoot:r,portals:n,getRoot:i}=FOe();(0,vE.useEffect)(()=>{e.ui.createRoot=r,e.ui.getRoot=i,e.ui.manager.eventsDispatch.dispatchEvent("windowReady",null)},[r]);let[a,o]=vE.default.useState(!1);return vE.default.createElement(Lw,{sensors:t,onDragStart:()=>{o(!0)},onDragEnd:()=>{o(!1),document.body.style.setProperty("cursor","")},onDragCancel:()=>{o(!1)},collisionDetection:qU,measuring:{droppable:{strategy:_p.Always}}},vE.default.createElement(t2e,{dragActive:a},n))};var pm=Ae(Te());function SX(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,ik(e,t)}var rO=Ae(Te()),nO=Ae(bl());var EX={disabled:!1};var POe=Ae(Te()),kX=POe.default.createContext(null);var IOe=function(t){return t.scrollTop};var iO="unmounted",Ib="exited",Bb="entering",bE="entered",CX="exiting",Sg=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=Ib,a.appearStatus=Bb):l=bE:n.unmountOnExit||n.mountOnEnter?l=iO:l=Ib,a.state={status:l},a.nextCallback=null,a}t.getDerivedStateFromProps=function(i,a){var o=i.in;return o&&a.status===iO?{status:Ib}: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!==Bb&&o!==bE&&(a=Bb):(o===Bb||o===bE)&&(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===Bb){if(this.props.unmountOnExit||this.props.mountOnEnter){var o=this.props.nodeRef?this.props.nodeRef.current:nO.default.findDOMNode(this);o&&IOe(o)}this.performEnter(i)}else this.performExit();else this.props.unmountOnExit&&this.state.status===Ib&&this.setState({status:iO})},r.performEnter=function(i){var a=this,o=this.props.enter,s=this.context?this.context.isMounting:i,l=this.props.nodeRef?[s]:[nO.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:bE},function(){a.props.onEntered(u)});return}this.props.onEnter(u,c),this.safeSetState({status:Bb},function(){a.props.onEntering(u,c),a.onTransitionEnd(d,function(){a.safeSetState({status:bE},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:nO.default.findDOMNode(this);if(!a||EX.disabled){this.safeSetState({status:Ib},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:Ib},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:nO.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===iO)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 rO.default.createElement(kX.Provider,{value:null},typeof o=="function"?o(i,S):rO.default.cloneElement(rO.default.Children.only(o),S))},t}(rO.default.Component);Sg.contextType=kX;Sg.propTypes={};function yE(){}Sg.defaultProps={in:!1,mountOnEnter:!1,unmountOnExit:!1,appear:!1,enter:!0,exit:!0,onEnter:yE,onEntering:yE,onEntered:yE,onExit:yE,onExiting:yE,onExited:yE};Sg.UNMOUNTED=iO;Sg.EXITED=Ib;Sg.ENTERING=Bb;Sg.ENTERED=bE;Sg.EXITING=CX;var DX=Sg;var BOe=e=>{let{setNodeRef:t,isOver:r}=Lu({id:"_modal",data:{id:"_modal"}});return Da({onDragOver:n=>{r&&e.hide()}}),pm.default.createElement("div",{className:"mk-modal-container",ref:t},pm.default.createElement(Qrt,{ui:e.ui,hide:e.hide,className:e.className},e.children))},Qrt=e=>{let t=pm.default.useRef(null),{setNodeRef:r,isOver:n}=Lu({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 Kv=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(Kv.default.createElement(p5,{fc:e.fc,hide:()=>i(),newProps:o,className:`${e.isPalette?"mk-drawer-palette":"mk-drawer-modal"} ${e.className?e.className:""}`}));return}n.render(Kv.default.createElement(BOe,{ui:e.ui.manager,hide:()=>i(),className:`${e.isPalette?"mk-palette":"mk-modal"} ${e.className?e.className:""}`},!e.isPalette&&Kv.default.createElement("div",{className:"mk-modal-header"},e.title&&Kv.default.createElement("div",{className:"mk-modal-title"},e.title),Kv.default.createElement("div",{className:"mk-x-small",dangerouslySetInnerHTML:{__html:e.ui.getSticker("ui//close")},onClick:()=>i()})),(0,Kv.cloneElement)(e.fc,{hide:()=>i(),...o})))};return a(e.props),{hide:i,update:a}};var Ts=Ae(Te()),D7=(e,t)=>{e.ui.openModal("Sync Warnings",Ts.default.createElement(Yrt,{superstate:e}),t)},Yrt=e=>{let{superstate:t}=e,[r,n]=(0,Ts.useState)(t.ui.getWarnings()),i=()=>{n(e.superstate.ui.getWarnings().filter(a=>!e.superstate.settings.suppressedWarnings.some(o=>a.id==o)))};return(0,Ts.useEffect)(()=>(e.superstate.eventsDispatcher.addListener("settingsChanged",i),()=>{e.superstate.eventsDispatcher.removeListener("settingsChanged",i)}),[]),Ts.default.createElement("div",{className:"mk-modal-contents"},Ts.default.createElement("div",{className:"mk-modal-message"},"The following issues may affect the synchronization of your files. Please review and resolve them."),Ts.default.createElement("div",{className:"mk-button-group"},Ts.default.createElement("button",{onClick:()=>{t.eventsDispatcher.dispatchEvent("warningsChanged",null)}},W.buttons.refresh),t.settings.suppressedWarnings.length>0&&Ts.default.createElement("button",{onClick:()=>{t.settings.suppressedWarnings=[],t.saveSettings()}},W.buttons.showHidden)),r.length==0&&Ts.default.createElement("div",null,Ts.default.createElement("div",{className:"mk-modal-heading"},"No warnings")),r.map((a,o)=>Ts.default.createElement("div",{key:o,className:"mk-modal-card"},Ts.default.createElement("div",{className:"mk-modal-heading"},a.message),Ts.default.createElement("div",{className:"mk-modal-description"},a.description),Ts.default.createElement("div",{className:"mk-button-group"},a.command.length>0&&Ts.default.createElement("button",{onClick:()=>{t.cli.runCommand(a.command,{iterations:0,instanceProps:{},props:{}})}},"Resolve"),Ts.default.createElement("button",{onClick:()=>{t.settings.suppressedWarnings=[...t.settings.suppressedWarnings,a.id],t.saveSettings()}},"Ignore")))))};var wa=Ae(Te());var ROe=e=>{let{superstate:t}=e,r=(0,wa.useRef)(null),[n,i]=(0,wa.useState)(t.settings.hiddenFiles),[a,o]=(0,wa.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,wa.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:W.labels.linkItemSelectPlaceholder,detail:!0,searchable:!0},Ne(h.view.document))};return wa.default.createElement("div",{className:"mk-modal-contents"},wa.default.createElement("div",{className:"mk-modal-heading"},W.labels.hiddenFilePattern),wa.default.createElement("div",{className:"mk-modal-description"},W.descriptions.hiddenFileOptions),wa.default.createElement("div",{className:"mk-modal-items"},a.map((h,m)=>wa.default.createElement("div",{key:m,className:"mk-modal-item"},wa.default.createElement("span",null,h),wa.default.createElement("div",{className:"mk-modal-item-button","aria-label":W.buttons.delete,dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//close")},onClick:()=>u(m)})))),wa.default.createElement("div",{className:"mk-modal-item"},wa.default.createElement("input",{placeholder:W.labels.addExtension,type:"text",ref:r}),wa.default.createElement("button",{onClick:h=>f()},W.buttons.add)),wa.default.createElement("div",{className:"mk-modal-heading"},W.subViews.filesAndFolders),wa.default.createElement("div",{className:"mk-modal-description"},W.labels.hiddenFileSpecific),wa.default.createElement("div",{className:"mk-modal-items"},n.map((h,m)=>wa.default.createElement("div",{key:m,className:"mk-modal-item"},wa.default.createElement("span",{className:"mk-modal-item-name"},h),wa.default.createElement("div",{className:"mk-modal-item-button","aria-label":W.buttons.delete,dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//close")},onClick:()=>c(m)})))),wa.default.createElement("div",{className:"mk-modal-item"},wa.default.createElement("button",{onClick:h=>p(h)},"+ ",W.buttons.addFile)))};var MX=Ae(Te());var $Oe=(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=>{D7(t,Ne(c.view.document))}}),l.push(qt)),jc(t.ui)||(l.push({name:"Open Overview",icon:"ui//columns",onClick:()=>{r.openEverView()}}),l.push(qt)),l.push({name:W.menu.collapseAllSections,icon:"ui//chevrons-down-up",onClick:()=>{n(!0)}}),l.push({name:W.menu.expandAllSections,icon:"ui//chevrons-up-down",onClick:()=>{n(!1)}}),l.push(qt),l.push({name:"Rename System",icon:"ui//edit",onClick:c=>{t.ui.openModal("Rename System",MX.default.createElement(_i,{value:"",saveLabel:"Rename System",saveValue:f=>{t.settings.systemName=f,t.saveSettings(),t.reloadPath("/",!0)}}),Ne(c.view.document))}}),l.push({name:W.menu.manageHiddenFiles,icon:"ui//eye-off",onClick:c=>{t.ui.openModal(W.labels.hiddenFiles,MX.default.createElement(ROe,{superstate:t}),Ne(c.view.document))}}),l.push(qt),i&&l.push({name:W.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(qt),l.push({name:W.menu.obSettings,icon:"ui//settings",onClick:()=>{r.app.commands.commands["app:open-settings"].callback()}}),l.push({name:W.menu.openVault,icon:"ui//vault",onClick:()=>{r.app.commands.commands["app:open-vault"].callback()}}),l.push(qt),l.push({name:W.menu.getHelp,icon:"ui//mk-logo",onClick:()=>{window.open("https://make.md/community")}});let u=e.getBoundingClientRect();t.ui.openMenu(u,Zt(t.ui,l),Ne(e.ownerDocument),"bottom")};var O7=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(t==4){this.openPalette(jX.default.createElement(_f,{superstate:this.manager.superstate,selectedPath:i}),n,null);return}if(this.manager.superstate.settings.blinkEnabled)this.plugin.quickOpen(this.manager.superstate,t,i,a);else{if(!r)return;t==2?Gu(r,n,this.manager.superstate,i):ao(r,n,this.manager.superstate,i)}};this.mainMenu=(t,r)=>{$Oe(t,r,this.plugin)};this.onMetadataRefresh=()=>{tO(this.plugin)};this.navigationHistory=()=>this.plugin.app.workspace.getLastOpenFiles();this.getSticker=t=>eO(t,this.plugin);this.getOS=()=>rs.Platform.isMacOS?"mac":rs.Platform.isWin?"windows":rs.Platform.isLinux?"linux":rs.Platform.isIosApp?"ios":rs.Platform.isAndroidApp?"android":"unknown";this.openToast=t=>{new rs.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=ia(this.plugin.app,n);if(!i)return;if(i instanceof rs.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=>ia(this.plugin.app,i)).filter(i=>i);this.plugin.app.dragManager.onDragStart({...t,doc:document},{icon:"lucide-files",source:void 0,title:W.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=VDe.map(i=>({name:i,type:"lucide",keywords:i,value:i,html:(0,rs.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(hE).reduce((i,a)=>[...i,...hE[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 rs.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(Mv))return t;return`${Tu(this.plugin.app.vault.getResourcePath(this.plugin.app.vault.getRoot()))}${t}`};this.viewsByPath=t=>{let r=ia(this.plugin.app,t);return r instanceof rs.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);AE(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 rs.TFile){await l.openFile(this.plugin.app.vault.getAbstractFileByPath(o.basePath));let u=gE(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 this.plugin.openPath(l,t,!0)});return}let a=sX(this.plugin.app,r);this.plugin.openPath(a,t)};this.primaryInteractionType=()=>rs.Platform.isMobile?0:1;this.getScreenType=()=>rs.Platform.isPhone?0:rs.Platform.isTablet?2:1;this.hasNativePathMenu=t=>!0;this.nativePathMenu=(t,r)=>{let n=this.plugin.app.vault.getAbstractFileByPath(r);if(n){let i=new rs.Menu;this.plugin.app.workspace.trigger("file-menu",i,n,"file-explorer");let a=t.currentTarget.getBoundingClientRect();i.showAtPosition({x:a.left,y:a.bottom})}};let r=document.createElement("div");document.body.appendChild(r),r.className="mk-root",this.createRoot=()=>null,this.getRoot=()=>null,this.root=(0,qOe.createRoot)(r),this.root.render(jX.default.createElement(_Oe,{ui:this}))}};var M7=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 WDe(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 tO=e=>{if(!e.superstate.settings.spacesStickers)return;let t=e.app.workspace.getActiveViewOfType(NOe.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]=ng(n.label.sticker);if(i=="image"){let o=e.superstate.ui.getUIPath(e.superstate.imagesCache.get(a));o&&(t.tabHeaderInnerIconEl.innerHTML=``)}else{let o=eO(n.label.sticker,e);t.tabHeaderInnerIconEl.innerHTML=o}}return}else if(t=e.app.workspace.getActiveViewOfType(kb)?.leaf,t){let r=t.view.getState().path,n=e.superstate.pathsIndex.get(r);if(n?.label?.sticker&&t.tabHeaderInnerIconEl){let[i,a]=ng(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=eO(n.label.sticker,e);t.tabHeaderInnerIconEl.innerHTML=o}}return}};var Pb=Ae(Te()),TOe=Ae(bl());function FOe(){let[e,t]=(0,Pb.useState)(new Map),[r,n]=(0,Pb.useState)(new Map),i=s=>r.get(s),a=(0,Pb.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,Pb.useMemo)(()=>[...e.entries()].map(([s,l])=>(0,TOe.createPortal)(l,s)),[e]);return{createRoot:a,portals:o,getRoot:i}}var vE=Ae(Te()),_Oe=e=>{let t=qw(Pp(RA,{activationConstraint:{distance:10}}),Pp($A,{activationConstraint:{delay:250,tolerance:5}}),Pp($0,{coordinateGetter:qN})),{createRoot:r,portals:n,getRoot:i}=FOe();(0,vE.useEffect)(()=>{e.ui.createRoot=r,e.ui.getRoot=i,e.ui.manager.eventsDispatch.dispatchEvent("windowReady",null)},[r]);let[a,o]=vE.default.useState(!1);return vE.default.createElement(Lw,{sensors:t,onDragStart:()=>{o(!0)},onDragEnd:()=>{o(!1),document.body.style.setProperty("cursor","")},onDragCancel:()=>{o(!1)},collisionDetection:moe,measuring:{droppable:{strategy:_p.Always}}},vE.default.createElement(t2e,{dragActive:a},n))};var pm=Ae(Te());function kX(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,ik(e,t)}var rO=Ae(Te()),nO=Ae(bl());var CX={disabled:!1};var POe=Ae(Te()),DX=POe.default.createContext(null);var IOe=function(t){return t.scrollTop};var iO="unmounted",Ib="exited",Bb="entering",bE="entered",OX="exiting",Sg=function(e){kX(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=Ib,a.appearStatus=Bb):l=bE:n.unmountOnExit||n.mountOnEnter?l=iO:l=Ib,a.state={status:l},a.nextCallback=null,a}t.getDerivedStateFromProps=function(i,a){var o=i.in;return o&&a.status===iO?{status:Ib}: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!==Bb&&o!==bE&&(a=Bb):(o===Bb||o===bE)&&(a=OX)}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===Bb){if(this.props.unmountOnExit||this.props.mountOnEnter){var o=this.props.nodeRef?this.props.nodeRef.current:nO.default.findDOMNode(this);o&&IOe(o)}this.performEnter(i)}else this.performExit();else this.props.unmountOnExit&&this.state.status===Ib&&this.setState({status:iO})},r.performEnter=function(i){var a=this,o=this.props.enter,s=this.context?this.context.isMounting:i,l=this.props.nodeRef?[s]:[nO.default.findDOMNode(this),s],u=l[0],c=l[1],f=this.getTimeouts(),d=s?f.appear:f.enter;if(!i&&!o||CX.disabled){this.safeSetState({status:bE},function(){a.props.onEntered(u)});return}this.props.onEnter(u,c),this.safeSetState({status:Bb},function(){a.props.onEntering(u,c),a.onTransitionEnd(d,function(){a.safeSetState({status:bE},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:nO.default.findDOMNode(this);if(!a||CX.disabled){this.safeSetState({status:Ib},function(){i.props.onExited(s)});return}this.props.onExit(s),this.safeSetState({status:OX},function(){i.props.onExiting(s),i.onTransitionEnd(o.exit,function(){i.safeSetState({status:Ib},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:nO.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===iO)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 rO.default.createElement(DX.Provider,{value:null},typeof o=="function"?o(i,S):rO.default.cloneElement(rO.default.Children.only(o),S))},t}(rO.default.Component);Sg.contextType=DX;Sg.propTypes={};function yE(){}Sg.defaultProps={in:!1,mountOnEnter:!1,unmountOnExit:!1,appear:!1,enter:!0,exit:!0,onEnter:yE,onEntering:yE,onEntered:yE,onExit:yE,onExiting:yE,onExited:yE};Sg.UNMOUNTED=iO;Sg.EXITED=Ib;Sg.ENTERING=Bb;Sg.ENTERED=bE;Sg.EXITING=OX;var MX=Sg;var BOe=e=>{let{setNodeRef:t,isOver:r}=Lu({id:"_modal",data:{id:"_modal"}});return Da({onDragOver:n=>{r&&e.hide()}}),pm.default.createElement("div",{className:"mk-modal-container",ref:t},pm.default.createElement(Zrt,{ui:e.ui,hide:e.hide,className:e.className},e.children))},Zrt=e=>{let t=pm.default.useRef(null),{setNodeRef:r,isOver:n}=Lu({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(MX,{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 Kv=Ae(Te()),jX=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(Kv.default.createElement(p5,{fc:e.fc,hide:()=>i(),newProps:o,className:`${e.isPalette?"mk-drawer-palette":"mk-drawer-modal"} ${e.className?e.className:""}`}));return}n.render(Kv.default.createElement(BOe,{ui:e.ui.manager,hide:()=>i(),className:`${e.isPalette?"mk-palette":"mk-modal"} ${e.className?e.className:""}`},!e.isPalette&&Kv.default.createElement("div",{className:"mk-modal-header"},e.title&&Kv.default.createElement("div",{className:"mk-modal-title"},e.title),Kv.default.createElement("div",{className:"mk-x-small",dangerouslySetInnerHTML:{__html:e.ui.getSticker("ui//close")},onClick:()=>i()})),(0,Kv.cloneElement)(e.fc,{hide:()=>i(),...o})))};return a(e.props),{hide:i,update:a}};var Ts=Ae(Te()),D7=(e,t)=>{e.ui.openModal("Sync Warnings",Ts.default.createElement(Xrt,{superstate:e}),t)},Xrt=e=>{let{superstate:t}=e,[r,n]=(0,Ts.useState)(t.ui.getWarnings()),i=()=>{n(e.superstate.ui.getWarnings().filter(a=>!e.superstate.settings.suppressedWarnings.some(o=>a.id==o)))};return(0,Ts.useEffect)(()=>(e.superstate.eventsDispatcher.addListener("settingsChanged",i),()=>{e.superstate.eventsDispatcher.removeListener("settingsChanged",i)}),[]),Ts.default.createElement("div",{className:"mk-modal-contents"},Ts.default.createElement("div",{className:"mk-modal-message"},"The following issues may affect the synchronization of your files. Please review and resolve them."),Ts.default.createElement("div",{className:"mk-button-group"},Ts.default.createElement("button",{onClick:()=>{t.eventsDispatcher.dispatchEvent("warningsChanged",null)}},W.buttons.refresh),t.settings.suppressedWarnings.length>0&&Ts.default.createElement("button",{onClick:()=>{t.settings.suppressedWarnings=[],t.saveSettings()}},W.buttons.showHidden)),r.length==0&&Ts.default.createElement("div",null,Ts.default.createElement("div",{className:"mk-modal-heading"},"No warnings")),r.map((a,o)=>Ts.default.createElement("div",{key:o,className:"mk-modal-card"},Ts.default.createElement("div",{className:"mk-modal-heading"},a.message),Ts.default.createElement("div",{className:"mk-modal-description"},a.description),Ts.default.createElement("div",{className:"mk-button-group"},a.command.length>0&&Ts.default.createElement("button",{onClick:()=>{t.cli.runCommand(a.command,{iterations:0,instanceProps:{},props:{}})}},"Resolve"),Ts.default.createElement("button",{onClick:()=>{t.settings.suppressedWarnings=[...t.settings.suppressedWarnings,a.id],t.saveSettings()}},"Ignore")))))};var wa=Ae(Te());var ROe=e=>{let{superstate:t}=e,r=(0,wa.useRef)(null),[n,i]=(0,wa.useState)(t.settings.hiddenFiles),[a,o]=(0,wa.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,wa.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:W.labels.linkItemSelectPlaceholder,detail:!0,searchable:!0},Ne(h.view.document))};return wa.default.createElement("div",{className:"mk-modal-contents"},wa.default.createElement("div",{className:"mk-modal-heading"},W.labels.hiddenFilePattern),wa.default.createElement("div",{className:"mk-modal-description"},W.descriptions.hiddenFileOptions),wa.default.createElement("div",{className:"mk-modal-items"},a.map((h,m)=>wa.default.createElement("div",{key:m,className:"mk-modal-item"},wa.default.createElement("span",null,h),wa.default.createElement("div",{className:"mk-modal-item-button","aria-label":W.buttons.delete,dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//close")},onClick:()=>u(m)})))),wa.default.createElement("div",{className:"mk-modal-item"},wa.default.createElement("input",{placeholder:W.labels.addExtension,type:"text",ref:r}),wa.default.createElement("button",{onClick:h=>f()},W.buttons.add)),wa.default.createElement("div",{className:"mk-modal-heading"},W.subViews.filesAndFolders),wa.default.createElement("div",{className:"mk-modal-description"},W.labels.hiddenFileSpecific),wa.default.createElement("div",{className:"mk-modal-items"},n.map((h,m)=>wa.default.createElement("div",{key:m,className:"mk-modal-item"},wa.default.createElement("span",{className:"mk-modal-item-name"},h),wa.default.createElement("div",{className:"mk-modal-item-button","aria-label":W.buttons.delete,dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//close")},onClick:()=>c(m)})))),wa.default.createElement("div",{className:"mk-modal-item"},wa.default.createElement("button",{onClick:h=>p(h)},"+ ",W.buttons.addFile)))};var NX=Ae(Te());var $Oe=(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=>{D7(t,Ne(c.view.document))}}),l.push(qt)),jc(t.ui)||(l.push({name:"Open Overview",icon:"ui//columns",onClick:()=>{r.openEverView()}}),l.push(qt)),l.push({name:W.menu.collapseAllSections,icon:"ui//chevrons-down-up",onClick:()=>{n(!0)}}),l.push({name:W.menu.expandAllSections,icon:"ui//chevrons-up-down",onClick:()=>{n(!1)}}),l.push(qt),l.push({name:"Rename System",icon:"ui//edit",onClick:c=>{t.ui.openModal("Rename System",NX.default.createElement(_i,{value:"",saveLabel:"Rename System",saveValue:f=>{t.settings.systemName=f,t.saveSettings(),t.reloadPath("/",!0)}}),Ne(c.view.document))}}),l.push({name:W.menu.manageHiddenFiles,icon:"ui//eye-off",onClick:c=>{t.ui.openModal(W.labels.hiddenFiles,NX.default.createElement(ROe,{superstate:t}),Ne(c.view.document))}}),l.push(qt),i&&l.push({name:W.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(qt),l.push({name:W.menu.obSettings,icon:"ui//settings",onClick:()=>{r.app.commands.commands["app:open-settings"].callback()}}),l.push({name:W.menu.openVault,icon:"ui//vault",onClick:()=>{r.app.commands.commands["app:open-vault"].callback()}}),l.push(qt),l.push({name:W.menu.getHelp,icon:"ui//mk-logo",onClick:()=>{window.open("https://make.md/community")}});let u=e.getBoundingClientRect();t.ui.openMenu(u,Zt(t.ui,l),Ne(e.ownerDocument),"bottom")};var O7=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(t==4){this.openPalette(TX.default.createElement(_f,{superstate:this.manager.superstate,selectedPath:i}),n,null);return}if(this.manager.superstate.settings.blinkEnabled)this.plugin.quickOpen(this.manager.superstate,t,i,a);else{if(!r)return;t==2?Gu(r,n,this.manager.superstate,i):ao(r,n,this.manager.superstate,i)}};this.mainMenu=(t,r)=>{$Oe(t,r,this.plugin)};this.onMetadataRefresh=()=>{tO(this.plugin)};this.navigationHistory=()=>this.plugin.app.workspace.getLastOpenFiles();this.getSticker=t=>eO(t,this.plugin);this.getOS=()=>rs.Platform.isMacOS?"mac":rs.Platform.isWin?"windows":rs.Platform.isLinux?"linux":rs.Platform.isIosApp?"ios":rs.Platform.isAndroidApp?"android":"unknown";this.openToast=t=>{new rs.Notice(t)};this.openPalette=(t,r,n)=>jX({ui:this,fc:t,isPalette:!0,className:n,win:r});this.openModal=(t,r,n,i,a)=>jX({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=ia(this.plugin.app,n);if(!i)return;if(i instanceof rs.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=>ia(this.plugin.app,i)).filter(i=>i);this.plugin.app.dragManager.onDragStart({...t,doc:document},{icon:"lucide-files",source:void 0,title:W.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=VDe.map(i=>({name:i,type:"lucide",keywords:i,value:i,html:(0,rs.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(hE).reduce((i,a)=>[...i,...hE[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 rs.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(Mv))return t;return`${Tu(this.plugin.app.vault.getResourcePath(this.plugin.app.vault.getRoot()))}${t}`};this.viewsByPath=t=>{let r=ia(this.plugin.app,t);return r instanceof rs.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);AE(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 rs.TFile){await l.openFile(this.plugin.app.vault.getAbstractFileByPath(o.basePath));let u=gE(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 this.plugin.openPath(l,t,!0)});return}let a=uX(this.plugin.app,r);this.plugin.openPath(a,t)};this.primaryInteractionType=()=>rs.Platform.isMobile?0:1;this.getScreenType=()=>rs.Platform.isPhone?0:rs.Platform.isTablet?2:1;this.hasNativePathMenu=t=>!0;this.nativePathMenu=(t,r)=>{let n=this.plugin.app.vault.getAbstractFileByPath(r);if(n){let i=new rs.Menu;this.plugin.app.workspace.trigger("file-menu",i,n,"file-explorer");let a=t.currentTarget.getBoundingClientRect();i.showAtPosition({x:a.left,y:a.bottom})}};let r=document.createElement("div");document.body.appendChild(r),r.className="mk-root",this.createRoot=()=>null,this.getRoot=()=>null,this.root=(0,qOe.createRoot)(r),this.root.render(TX.default.createElement(_Oe,{ui:this}))}};var M7=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 LOe=e=>e?{scheme:"obsidian",schema:{id:e.id,name:e.name,type:"command"},path:"obsidian://"+e.id,fields:[],code:e.callback,codeType:"closure"}:null,j7=class{constructor(t){this.plugin=t;this.scheme="obsidian";this.allCommands=()=>Object.values(this.plugin.app.commands.commands).map(t=>LOe(t));this.commandForAction=t=>{if(!t)return null;let r=cc(t);return LOe(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 Zrt=[{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:[]}],xE=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=Zrt.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 xE(t)}allCommands(){return[...this.builtinCommands.map(t=>({scheme:"builtin",path:"builtin://"+t.schema.id,...t})),...this.terminals.flatMap(t=>t.allCommands())]}};var eMe=Ae(Te());var zOe=[{id:"label.sticker",label:W.metadataTypes.sticker,field:"sticker",vType:"text",defaultFilter:"isEmpty",type:"label",description:"Sticker label for the item"},{id:"label.color",label:W.metadataTypes.color,field:"color",vType:"color",defaultFilter:"equals",type:"label",description:"Color label for the item"}],UOe=[{id:"file.name",label:W.metadataTypes.fileName,field:"name",vType:"text",defaultFilter:"contains",type:"file",description:"Name for a space or note"},{id:"file.path",label:W.metadataTypes.path,field:"path",vType:"link",defaultFilter:"contains",type:"file",description:"Path for a space or note"},{id:"file.parent",label:W.metadataTypes.folder,field:"parent",vType:"space",defaultFilter:"contains",type:"file",description:"Folder the note or space is in"},{id:"file.ctime",label:W.metadataTypes.created,field:"ctime",vType:"date",defaultFilter:"isSameDate",type:"file",description:"Creation date for the note or space"},{id:"file.mtime",label:W.metadataTypes.lastModified,field:"mtime",vType:"date",defaultFilter:"isSameDate",type:"file",description:"Last modified date for the note or space"},{id:"file.extension",label:W.metadataTypes.extension,field:"extension",vType:"text",defaultFilter:"is",type:"file",description:"File extension"},{id:"file.size",label:W.metadataTypes.size,field:"size",vType:"number",defaultFilter:"lessThan",type:"file",description:"File size"}],WOe=[{id:"path.tags",label:W.metadataTypes.tags,field:"tags",vType:"tags-multi",defaultFilter:"contains",type:"path",description:"Tags for the note or space"},{id:"path.inlinks",label:W.metadataTypes.inlinks,field:"inlinks",vType:"link-multi",defaultFilter:"contains",type:"path",description:"Links to the note or space"},{id:"path.outlinks",label:W.metadataTypes.outlinks,field:"outlinks",vType:"link-multi",defaultFilter:"contains",type:"path",description:"Links from the note or space"}];var N7=e=>({label:{name:W.metadataTypes.label,properties:zOe},file:{name:W.metadataTypes.fileMetadata,properties:UOe},path:{name:W.metadataTypes.outlinks,properties:WOe},frontmatter:{name:W.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:W.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 XOe=Ae(bi());var xr=Ae(Te()),KOe=Ae(Qa());var Xrt=(e,t,r)=>t.reduce((i,a)=>{let[o,s]=i,l=a.type=="context"?HOe(s,a,r):a.type=="path"?GOe(s,a,r):a.type=="frontmatter"?VOe(s,a,r):QOe(s,a,r),u=s.filter(c=>!l.includes(c));return[[...o,...l],u]},[[],e])[0],Krt=(e,t,r)=>t.reduce((n,i)=>i.type=="context"?HOe(n,i,r):i.type=="path"?GOe(n,i,r):i.type=="frontmatter"?VOe(n,i,r):QOe(n,i,r),e),HOe=(e,t,r)=>{let n=Li[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($i(o,s[o]),u)}return l})},VOe=(e,t,r)=>{let n=Li[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($i(t.field,a[t.field]),s)}return o})},GOe=(e,t,r)=>{let n=Li[t.fn];return!n||n.valueType!="none"&&t.value.length==0?[]:e.filter(i=>{let a="";t.field=="outlinks"?a=yi(i.outlinks??[]):t.field=="inlinks"?a=yi(i.metadata?.inlinks??[]):t.field=="tags"&&(a=yi(i.tags??[]));let o=!0;if(n){let s=t.fType=="property"?r[t.value]:t.value;o=n.fn(a,s)}return o})},QOe=(e,t,r)=>{let n=Li[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})},T7=(e,t,r)=>e.reduce((i,a)=>!i||a.filters.length==0?!1:a.type=="any"?Xrt([t],a.filters,r).length>0:Krt([t],a.filters,r).length>0,!0);function YOe(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 ZOe(e){let{queries:t,pathsIndex:r,count:n}=e,i=[];for(let[a,o]of r)!o.hidden&&T7(t,o,{})&&i.push(o);return i.slice(0,n)}var JOe=e=>{let[t,r]=(0,xr.useState)(null),[n,i]=(0,xr.useState)(!1),[a,o]=(0,xr.useState)(!1),[s,l]=(0,xr.useState)(""),[u,c]=(0,xr.useState)(0),f=N=>{l(N)},[d,p]=(0,xr.useState)([]),h=(0,xr.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,xr.useState)(e.parentSpace?g:A);(0,xr.useEffect)(()=>{let N=(D,P)=>{if(D.length==0&&s.length==0){v(e.parentSpace?g:A);return}let q=[{type:"section",label:"Create New"}];if(e.mode!=3&&q.push({type:"new-note",sticker:"ui//edit",value:s,label:"New Note"}),q.push({type:"new-space",sticker:"ui//folder-plus",value:s,label:"New Space"}),d.length==0){if(!e.superstate.settings.searchWorker){let z=YOe({query:s,pathsIndex:e.superstate.pathsIndex,count:10});v([{type:"section",label:"Results"},...z.map(I=>m(I)),...q]);return}e.superstate.search(D,s).then(z=>v([{type:"section",label:"Results"},...z.map(I=>m(I)),...q]));return}if(!e.superstate.settings.searchWorker){let z=ZOe({queries:P,count:10,pathsIndex:e.superstate.pathsIndex});v([{type:"section",label:"Results"},...z.map(I=>m(I)),...q]);return}e.superstate.search(D,null,P).then(z=>v(z.map(I=>m(I))))};(0,XOe.debounce)(()=>N(s,h),300)()},[s,h]),(0,xr.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){Ji(e.superstate,P,"md",s,!!e.onSelect).then(q=>{(e.mode==2||e.mode==4)&&e.onSelect(q),e.hide()});return}}uv(e.superstate,e.superstate.pathsIndex.get(e.superstate.ui.activePath)).then(P=>Ji(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(W.notice.newSpaceName);return}if(e.superstate.spacesIndex.has(I)){e.superstate.ui.notify(W.notice.duplicateSpaceName);return}kf(e.superstate,I,{}).then(T=>{(e.mode==2||3)&&e.onSelect(T.path),e.hide()});return}if(N.cache){if(e.mode==2||3){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=xr.default.useRef(null);(0,xr.useEffect)(()=>{k.current?.focus()},[k.current]);let j=N7(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 xr.default.createElement(xr.default.Fragment,null,xr.default.createElement("div",{className:"mk-blink-input-container"},xr.default.createElement("div",{className:"mk-icon-small",dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//search")}}),xr.default.createElement("div",{"data-placeholder":W.labels.blinkPlaceholder,onInput:N=>f(N.currentTarget.innerText),onKeyDown:N=>S(N),ref:k,contentEditable:!0,className:"mk-blink-input"}),e.mode==1&&xr.default.createElement(xr.default.Fragment,null,xr.default.createElement("button",{onClick:()=>i(N=>!N),className:"mk-toolbar-button",dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//blink")}}),xr.default.createElement("button",{className:"mk-toolbar-button",dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//filter")},onClick:()=>o(!a)}))),a&&xr.default.createElement("div",{className:"mk-blink-filters"},xr.default.createElement("div",{className:"mk-icon-xsmall",dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//filter")}}),xr.default.createElement(w2,{superstate:e.superstate,filters:d,setFilters:p,fields:O,sections:C})),xr.default.createElement("div",{className:"mk-blink-suggester",style:{}},xr.default.createElement("div",{className:"mk-blink-suggestions"},b.map((N,D)=>xr.default.createElement("div",{key:D,className:(0,KOe.default)(N.type=="section"?"mk-blink-section":"mk-blink-suggestion",u==D&&"mk-active"),onClick:P=>x(N)},N.type=="section"?xr.default.createElement("div",{className:"mk-blink-suggestion-title"},N.label):xr.default.createElement(xr.default.Fragment,null,xr.default.createElement("div",{className:"mk-blink-suggestion-icon",dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker(N.sticker)}}),xr.default.createElement("div",{className:"mk-blink-suggestion-text"},xr.default.createElement("div",{className:"mk-blink-suggestion-title"},N.label),xr.default.createElement("div",{className:"mk-blink-suggestion-description"},N.value),N.description&&xr.default.createElement("div",{className:"mk-blink-suggestion-preview"},N.description)))))),e.mode==1&&n&&xr.default.createElement(Jrt,{superstate:e.superstate,path:t})))},Jrt=e=>{let t=xr.default.useRef(null),[r,n]=(0,xr.useState)(!1);return xr.default.createElement("div",{className:"mk-blink-preview",ref:t},xr.default.createElement("div",{className:"mk-blink-preview-title"},xr.default.createElement(oo,{superstate:e.superstate,path:e.path}),xr.default.createElement("span",null),xr.default.createElement("button",{className:r?"is-active mk-icon-small":"mk-icon-small",dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//list")},onClick:()=>n(!r)})),xr.default.createElement(j8,{id:"blink",superstate:e.superstate,path:e.path,containerRef:t,styles:{},readOnly:!0}),r&&xr.default.createElement("div",{className:"mk-blink-properties"},xr.default.createElement("div",{className:"mk-blink-properties-header"},"Properties"),xr.default.createElement(Ys,{path:e.path,superstate:e.superstate,readMode:!1})))};var tMe=(e,t,r,n,i)=>{e.ui.openPalette(eMe.default.createElement(JOe,{superstate:e,mode:t,onSelect:n,parentSpace:i}),r,"mk-blink-modal")};var rMe=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}/${rMe(t.path)}.${t.extension}`,i=t.path;this.plugin.superstate.settings.imageThumbnails&&(await this.middleware.fileExists(n)?i=n:aMe.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 sMe=require("obsidian"),lMe=Ae(Te());var TX=e=>{let t=e.superstate,r=[...e.obsidianAdapter.fileNameWarnings],n=`The following files have issues with their names. Would you like to fix them? + }`};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 LOe=e=>e?{scheme:"obsidian",schema:{id:e.id,name:e.name,type:"command"},path:"obsidian://"+e.id,fields:[],code:e.callback,codeType:"closure"}:null,j7=class{constructor(t){this.plugin=t;this.scheme="obsidian";this.allCommands=()=>Object.values(this.plugin.app.commands.commands).map(t=>LOe(t));this.commandForAction=t=>{if(!t)return null;let r=cc(t);return LOe(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 Krt=[{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:[]}],xE=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=Krt.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 xE(t)}allCommands(){return[...this.builtinCommands.map(t=>({scheme:"builtin",path:"builtin://"+t.schema.id,...t})),...this.terminals.flatMap(t=>t.allCommands())]}};var eMe=Ae(Te());var zOe=[{id:"label.sticker",label:W.metadataTypes.sticker,field:"sticker",vType:"text",defaultFilter:"isEmpty",type:"label",description:"Sticker label for the item"},{id:"label.color",label:W.metadataTypes.color,field:"color",vType:"color",defaultFilter:"equals",type:"label",description:"Color label for the item"}],UOe=[{id:"file.name",label:W.metadataTypes.fileName,field:"name",vType:"text",defaultFilter:"contains",type:"file",description:"Name for a space or note"},{id:"file.path",label:W.metadataTypes.path,field:"path",vType:"link",defaultFilter:"contains",type:"file",description:"Path for a space or note"},{id:"file.parent",label:W.metadataTypes.folder,field:"parent",vType:"space",defaultFilter:"contains",type:"file",description:"Folder the note or space is in"},{id:"file.ctime",label:W.metadataTypes.created,field:"ctime",vType:"date",defaultFilter:"isSameDate",type:"file",description:"Creation date for the note or space"},{id:"file.mtime",label:W.metadataTypes.lastModified,field:"mtime",vType:"date",defaultFilter:"isSameDate",type:"file",description:"Last modified date for the note or space"},{id:"file.extension",label:W.metadataTypes.extension,field:"extension",vType:"text",defaultFilter:"is",type:"file",description:"File extension"},{id:"file.size",label:W.metadataTypes.size,field:"size",vType:"number",defaultFilter:"lessThan",type:"file",description:"File size"}],WOe=[{id:"path.tags",label:W.metadataTypes.tags,field:"tags",vType:"tags-multi",defaultFilter:"contains",type:"path",description:"Tags for the note or space"},{id:"path.inlinks",label:W.metadataTypes.inlinks,field:"inlinks",vType:"link-multi",defaultFilter:"contains",type:"path",description:"Links to the note or space"},{id:"path.outlinks",label:W.metadataTypes.outlinks,field:"outlinks",vType:"link-multi",defaultFilter:"contains",type:"path",description:"Links from the note or space"}];var N7=e=>({label:{name:W.metadataTypes.label,properties:zOe},file:{name:W.metadataTypes.fileMetadata,properties:UOe},path:{name:W.metadataTypes.outlinks,properties:WOe},frontmatter:{name:W.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:W.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 XOe=Ae(bi());var xr=Ae(Te()),KOe=Ae(Qa());var Jrt=(e,t,r)=>t.reduce((i,a)=>{let[o,s]=i,l=a.type=="context"?HOe(s,a,r):a.type=="path"?GOe(s,a,r):a.type=="frontmatter"?VOe(s,a,r):QOe(s,a,r),u=s.filter(c=>!l.includes(c));return[[...o,...l],u]},[[],e])[0],ent=(e,t,r)=>t.reduce((n,i)=>i.type=="context"?HOe(n,i,r):i.type=="path"?GOe(n,i,r):i.type=="frontmatter"?VOe(n,i,r):QOe(n,i,r),e),HOe=(e,t,r)=>{let n=Li[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($i(o,s[o]),u)}return l})},VOe=(e,t,r)=>{let n=Li[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($i(t.field,a[t.field]),s)}return o})},GOe=(e,t,r)=>{let n=Li[t.fn];return!n||n.valueType!="none"&&t.value.length==0?[]:e.filter(i=>{let a="";t.field=="outlinks"?a=yi(i.outlinks??[]):t.field=="inlinks"?a=yi(i.metadata?.inlinks??[]):t.field=="tags"&&(a=yi(i.tags??[]));let o=!0;if(n){let s=t.fType=="property"?r[t.value]:t.value;o=n.fn(a,s)}return o})},QOe=(e,t,r)=>{let n=Li[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})},T7=(e,t,r)=>e.reduce((i,a)=>!i||a.filters.length==0?!1:a.type=="any"?Jrt([t],a.filters,r).length>0:ent([t],a.filters,r).length>0,!0);function YOe(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 ZOe(e){let{queries:t,pathsIndex:r,count:n}=e,i=[];for(let[a,o]of r)!o.hidden&&T7(t,o,{})&&i.push(o);return i.slice(0,n)}var JOe=e=>{let[t,r]=(0,xr.useState)(null),[n,i]=(0,xr.useState)(!1),[a,o]=(0,xr.useState)(!1),[s,l]=(0,xr.useState)(""),[u,c]=(0,xr.useState)(0),f=N=>{l(N)},[d,p]=(0,xr.useState)([]),h=(0,xr.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,xr.useState)(e.parentSpace?g:A);(0,xr.useEffect)(()=>{let N=(D,P)=>{if(D.length==0&&s.length==0){v(e.parentSpace?g:A);return}let q=[{type:"section",label:"Create New"}];if(e.mode!=3&&q.push({type:"new-note",sticker:"ui//edit",value:s,label:"New Note"}),q.push({type:"new-space",sticker:"ui//folder-plus",value:s,label:"New Space"}),d.length==0){if(!e.superstate.settings.searchWorker){let z=YOe({query:s,pathsIndex:e.superstate.pathsIndex,count:10});v([{type:"section",label:"Results"},...z.map(I=>m(I)),...q]);return}e.superstate.search(D,s).then(z=>v([{type:"section",label:"Results"},...z.map(I=>m(I)),...q]));return}if(!e.superstate.settings.searchWorker){let z=ZOe({queries:P,count:10,pathsIndex:e.superstate.pathsIndex});v([{type:"section",label:"Results"},...z.map(I=>m(I)),...q]);return}e.superstate.search(D,null,P).then(z=>v(z.map(I=>m(I))))};(0,XOe.debounce)(()=>N(s,h),300)()},[s,h]),(0,xr.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){Ji(e.superstate,P,"md",s,!!e.onSelect).then(q=>{(e.mode==2||e.mode==4)&&e.onSelect(q),e.hide()});return}}uv(e.superstate,e.superstate.pathsIndex.get(e.superstate.ui.activePath)).then(P=>Ji(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(W.notice.newSpaceName);return}if(e.superstate.spacesIndex.has(I)){e.superstate.ui.notify(W.notice.duplicateSpaceName);return}kf(e.superstate,I,{}).then(T=>{(e.mode==2||3)&&e.onSelect(T.path),e.hide()});return}if(N.cache){if(e.mode==2||3){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=xr.default.useRef(null);(0,xr.useEffect)(()=>{k.current?.focus()},[k.current]);let j=N7(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 xr.default.createElement(xr.default.Fragment,null,xr.default.createElement("div",{className:"mk-blink-input-container"},xr.default.createElement("div",{className:"mk-icon-small",dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//search")}}),xr.default.createElement("div",{"data-placeholder":W.labels.blinkPlaceholder,onInput:N=>f(N.currentTarget.innerText),onKeyDown:N=>S(N),ref:k,contentEditable:!0,className:"mk-blink-input"}),e.mode==1&&xr.default.createElement(xr.default.Fragment,null,xr.default.createElement("button",{onClick:()=>i(N=>!N),className:"mk-toolbar-button",dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//blink")}}),xr.default.createElement("button",{className:"mk-toolbar-button",dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//filter")},onClick:()=>o(!a)}))),a&&xr.default.createElement("div",{className:"mk-blink-filters"},xr.default.createElement("div",{className:"mk-icon-xsmall",dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//filter")}}),xr.default.createElement(w2,{superstate:e.superstate,filters:d,setFilters:p,fields:O,sections:C})),xr.default.createElement("div",{className:"mk-blink-suggester",style:{}},xr.default.createElement("div",{className:"mk-blink-suggestions"},b.map((N,D)=>xr.default.createElement("div",{key:D,className:(0,KOe.default)(N.type=="section"?"mk-blink-section":"mk-blink-suggestion",u==D&&"mk-active"),onClick:P=>x(N)},N.type=="section"?xr.default.createElement("div",{className:"mk-blink-suggestion-title"},N.label):xr.default.createElement(xr.default.Fragment,null,xr.default.createElement("div",{className:"mk-blink-suggestion-icon",dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker(N.sticker)}}),xr.default.createElement("div",{className:"mk-blink-suggestion-text"},xr.default.createElement("div",{className:"mk-blink-suggestion-title"},N.label),xr.default.createElement("div",{className:"mk-blink-suggestion-description"},N.value),N.description&&xr.default.createElement("div",{className:"mk-blink-suggestion-preview"},N.description)))))),e.mode==1&&n&&xr.default.createElement(tnt,{superstate:e.superstate,path:t})))},tnt=e=>{let t=xr.default.useRef(null),[r,n]=(0,xr.useState)(!1);return xr.default.createElement("div",{className:"mk-blink-preview",ref:t},xr.default.createElement("div",{className:"mk-blink-preview-title"},xr.default.createElement(oo,{superstate:e.superstate,path:e.path}),xr.default.createElement("span",null),xr.default.createElement("button",{className:r?"is-active mk-icon-small":"mk-icon-small",dangerouslySetInnerHTML:{__html:e.superstate.ui.getSticker("ui//list")},onClick:()=>n(!r)})),xr.default.createElement(j8,{id:"blink",superstate:e.superstate,path:e.path,containerRef:t,styles:{},readOnly:!0}),r&&xr.default.createElement("div",{className:"mk-blink-properties"},xr.default.createElement("div",{className:"mk-blink-properties-header"},"Properties"),xr.default.createElement(Ys,{path:e.path,superstate:e.superstate,readMode:!1})))};var tMe=(e,t,r,n,i)=>{e.ui.openPalette(eMe.default.createElement(JOe,{superstate:e,mode:t,onSelect:n,parentSpace:i}),r,"mk-blink-modal")};var rMe=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}/${rMe(t.path)}.${t.extension}`,i=t.path;this.plugin.superstate.settings.imageThumbnails&&(await this.middleware.fileExists(n)?i=n:aMe.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 sMe=require("obsidian"),lMe=Ae(Te());var _X=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",lMe.default.createElement(Jy,{message:n,confirmLabel:"Rename",confirmAction:async()=>{for(let i of r){let a=ia(e.app,i),o=a instanceof sMe.TFile?a?.basename:a.name;if(!a)return;await nD(e.superstate,i,e.superstate.pathsIndex.get(i)?.metadata?.property?.aliases,o),await NDe(e,a,lv(o))}e.obsidianAdapter.fileNameWarnings=new Set}}),window)};var ent=Ae(Te());var uMe=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 FX=Ae(bi());var _7=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=ir(await this.middleware.readTextFromFile(t.path))??{},i=n.label??{},a=n.property??{},o=(0,FX.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,FX.omit)(ir(i)??{},["label","property"])}if(r=="property"){let i=await this.middleware.readTextFromFile(t.path);return ir(i)?.property??{}}if(r=="label"){let i=await this.middleware.readTextFromFile(t.path),a=ir(i)?.label??{},o=$i("sticker",a[this.plugin.superstate.settings.fmKeySticker]),s=$i("color",a[this.plugin.superstate.settings.fmKeyColor]),l=$i("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=ir(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=ir(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=ir(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=ir(await this.middleware.readTextFromFile(t.path))??{};await this.middleware.writeTextToFile(t.path,JSON.stringify({...a,property:i})),this.parseCache(t,!0)}}};var cMe=require("obsidian"),P7=Ae(Te());var B7="mk-space-fragment";var I7=class extends cMe.ItemView{constructor(r,n){super(r);this.navigation=!0;this.plugin=n}getViewType(){return B7}getDisplayText(){return this.path}async onClose(){this.destroy()}onunload(){this.destroy()}destroy(){this.root&&this.root.unmount()}async onOpen(){this.destroy()}async setState(r,n){this.path=r.path,this.source=r.source,this.flow=r.flow,this.constructInlineContext(),await super.setState(r,n);let i=_1(this.path,this.plugin.superstate);this.leaf.tabHeaderInnerTitleEl.innerText=i,this.leaf.view.titleEl=i;let a=this.leaf.view.headerEl;a&&(a.querySelector(".view-header-title").innerText=i)}getState(){let r=super.getState();return r.path=this.path,r.source=this.source,r.flow=this.flow,r}constructInlineContext(){this.destroy(),this.root=this.plugin.ui.createRoot(this.contentEl),this.root?this.flow?this.root.render(P7.default.createElement(Yv,{id:this.path,superstate:this.plugin.superstate,path:this.path,source:this.source,showTitle:!0})):this.root.render(P7.default.createElement(eX,{superstate:this.plugin.superstate,path:this.path},P7.default.createElement(Yv,{id:this.path,superstate:this.plugin.superstate,path:this.path,source:this.source}))):this.plugin.ui.manager.eventsDispatch.addOnceListener("windowReady",()=>{this.constructInlineContext()})}};var fMe=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:ua.uniques,cols:ua.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:ua.uniques,cols:ua.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):Ji(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)},dMe=(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[pr].rows=e[pr].rows.map(n=>(n[mt]=dMe(n[mt],t),n)),r},aO=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 aO(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 aO(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(Zv);if(x){let w=x[1];l=(0,fMe.parseYaml)(w)}}g&&(u=dC(ir(g),t.settings)),o=await fE(e.mdbFileAdapter,m.dbPath),s=await fE(e.mdbFileAdapter,m.framePath);let b=await t.spaceManager.childrenForPath(r,"folder");for(let x of b){let w=await aO(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:dMe(r,n),definition:u,properties:l,context:int(o,r),frames:s,children:c,content:p,notes:f,assets:[],templates:d}};var ql=Ae(Te());var _X=(e,t,r,n)=>{t.ui.openModal("Add Kit",ql.default.createElement(ant,{plugin:e,superstate:t,kit:r}),n)},ant=e=>{let[t,r]=(0,ql.useState)(e.kit),[n,i]=(0,ql.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,ir(o),n)}).then(o=>{e.superstate.ui.notify("Kit added"),e.hide()})};return ql.default.createElement("div",null,ql.default.createElement("div",{className:"setting-item"},ql.default.createElement("div",{className:"setting-item-heading"},"Kit Location"),ql.default.createElement("span",null),ql.default.createElement("input",{type:"text",value:t,onChange:o=>r(o.target.value)})),ql.default.createElement("div",{className:"setting-item"},ql.default.createElement("div",{className:"setting-item-heading"},"Add Kit to Space"),ql.default.createElement("span",null),ql.default.createElement(L9,{superstate:e.superstate,triggerMenu:o=>{let s=o.target.getBoundingClientRect();ao(s,Ne(o.view.document),e.superstate,l=>i(l))},value:e.superstate.spacesIndex.get(n)?.name,selectValue:o=>{i(o)}})),ql.default.createElement("div",{className:"setting-item"},ql.default.createElement("button",{onClick:()=>a()},"Add"),ql.default.createElement("button",{onClick:e.hide},"Cancel")))};var $b=require("@codemirror/state"),kg=require("@codemirror/view");var Eg=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},oO=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 pMe(e,t,r){Xs(t).iterate({...r,from:e,to:e})}function sO(e,t,r){Xs(t).iterate({...r,from:e.from,to:e.to})}var mm=require("@codemirror/state"),Vh=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),PX="-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=Vh.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=PX,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=PX;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==Vh.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 lO(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:lO.create,above:t[0].above,arrow:t.some(r=>r.arrow)}});var IX=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==Vh.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,Vh.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&&!mMe(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&&!mMe(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 mMe(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,Vh.ViewPlugin.define(i=>new IX(i,e,n,r,t.hoverTime||300)),fnt]}var gMe=mm.StateEffect.define(),Kjr=gMe.of(null);var RX=Ae(Te());var wE=require("@codemirror/state"),U7=wE.Annotation.define(),vMe=wE.Annotation.define(),W7=wE.StateField.define({create:()=>{},update(e,t){return t.annotation(vMe)?t.annotation(vMe):e}}),Rb=wE.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(W.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:W.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:W.buttons.cutTable,icon:"ui//cut",onClick:c=>{i()}}),u.push({name:W.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":W.buttons.toggleFlow,onClick:o,className:`mk-toolbar-button ${e.toggleState?"mk-toggle-on":""}`,dangerouslySetInnerHTML:{__html:e.toggleState?oi["book-open"]:oi["edit-3"]}})))};var Ll=Ae(Te());var pnt=e=>e.charAt(0)=="/"?e.substring(1):e,yMe=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,uO=(0,Ll.forwardRef)((e,t)=>{let r=(0,Ll.useRef)(null),[n,i]=(0,Ll.useState)(!1),[a,o]=(0,Ll.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,yMe(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,Ll.useEffect)(()=>{l()},[e.load,e.path]),(0,Ll.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)}},[]),Ll.default.createElement(Ll.default.Fragment,null,Ll.default.createElement("div",{className:`${e.classname??""} mk-flowspace-editor`,ref:r,onClick:u=>u.stopPropagation()}),n?Ll.default.createElement("div",{onClick:()=>s(!0),className:"mk-placeholder",style:{color:"var(--mk-ui-text-tertiary)"}},W.labels.notePlaceholder.replace("${1}",yMe(e.path))):Ll.default.createElement(Ll.default.Fragment,null))});uO.displayName="UINote";var SE=(e,t)=>(r,n)=>{let i=t?r:n,a=t?n:r;return i[e]a[e]?1:0};var cO=require("obsidian");var Uf=$b.Annotation.define(),Am=$b.Annotation.define(),bMe=$b.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(Rb,!1)=="doc"?{annotations:Uf.of([n.id,2])}:{annotations:Uf.of([n.id,0])})),[e,...t]}),xMe=kg.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])}))}}}}),wMe=e=>AMe((t,r,n)=>{let{from:i,to:a}=t.state.doc.lineAt(r),o=null;return sO({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?W.buttons.openFlow:W.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?W.buttons.openFlow:W.buttons.hideFlow),{dom:p}}},!1}}}),o}),Wc=$b.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:mv();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:mv();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:mv();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(SE("from",!0)),r}}),V7=class extends kg.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(cO.editorInfoField,!1)){let a=r.state.field(cO.editorInfoField,!1).file;this.root=this.plugin.enactor.createRoot(n),this.root.render(RX.default.createElement(uO,{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()}},BX=class extends kg.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(cO.editorInfoField,!1)){let o=r.state.field(cO.editorInfoField,!1).file;i.render(RX.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)=>kg.Decoration.replace({widget:new BX(e,t),inclusive:!0,block:!1}),EE=(e,t)=>kg.Decoration.replace({widget:new V7(e,t),inclusive:!0,block:!1}),Q7=(e,t)=>kg.Decoration.widget({widget:new V7(e,t),inclusiveStart:!0,block:!0});var SMe=require("obsidian");var fO=class extends SMe.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())||W.commands[i]&&W.commands[i].toLowerCase().includes(r.query.toLowerCase()));return n.length>0?n:[{label:W.commandsSuggest.noResult,value:"",icon:"",type:0}]}renderSuggestion(r,n){if(r.value==""){n.setText(W.commandsSuggest.noResult);return}let i=n.createDiv("mk-slash-item"),a=i.createDiv("mk-slash-icon");a.innerHTML=oi[r.icon],i.createDiv().setText(W.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!==W.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 EMe=require("obsidian"),$X=Ae(Te());var dO=class extends EMe.EditorSuggest{constructor(r,n){super(r);this.inCmd=!1;this.cmdStartCh=0;this.plugin=n,this.emojis=Object.keys(hE).reduce((i,a)=>[...i,...hE[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:W.commandsSuggest.noResult,unicode:"",desc:""}]}renderSuggestion(r,n){let i=document.createElement("div");i.setAttribute("aria-label",r.label),this.plugin.enactor.createRoot(i).render($X.default.createElement($X.default.Fragment,null,r.unicode.length>0?Xy(r.unicode):W.commandsSuggest.noResult)),n.appendChild(i)}selectSuggestion(r,n){r.label!==W.commandsSuggest.noResult&&(this.context.editor.replaceRange(Xy(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 qb=X7.Annotation.define(),kMe=(e,t,r)=>t&&r.sliceDoc(e,e+1)==" "?e+1:!t&&r.sliceDoc(e-1,e)==" "?e-1:e,CMe=(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 sO({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=kMe(CMe(e.from,!0,t),!0,t),n=kMe(CMe(e.to,!1,t),!1,t);return{from:r,to:n}},Jv=(e,t)=>({changes:{from:e,to:e,insert:t.formatChar}}),zX=(e,t,r)=>pO(r.from,e,t.mark)&&pO(r.to,e,t.mark),pO=(e,t,r)=>{let n=!1;return pMe(e,t,{enter:({name:i,from:a,to:o})=>{qX(i,r)&&(n=!0)}}),n},qX=(e,t)=>e.includes(t),Z7=(e,t,r)=>pO(e,t,r.mark),kE=(e,t,r)=>pO(e,t,r.formatting)?!0:r.altFormatting?pO(e,t,r.altFormatting):!1,mnt=(e,t,r)=>{let n=[];return zX(r,t,e)?(kE(e.from,r,t)&&!kE(e.to,r,t)&&n.push(Jv(e.to,t)),kE(e.to,r,t)&&!kE(e.from,r,t)&&n.push(Jv(e.from,t))):Z7(e.from,r,t)?(kE(e.from,r,t)&&!Z7(e.from-1,r,t)&&n.push(Jv(e.from,t)),n.push(Jv(e.to,t))):Z7(e.to,r,t)?(kE(e.to,r,t)&&!Z7(e.to+1,r,t)&&n.push(Jv(e.to,t)),n.push(Jv(e.from,t))):(n.push(Jv(e.to,t)),n.push(Jv(e.from,t))),n},hnt=(e,t,r)=>{let n=[];return sO({from:e.from,to:e.to},t,{enter:({name:i,from:a,to:o})=>{(qX(i,r.formatting)||(r.altFormatting?qX(i,r.altFormatting):!1))&&n.push({from:a,to:a+r.formatChar.length})}}),{changes:n}},DMe=X7.EditorState.transactionFilter.of(e=>{if(!e.annotation(qb))return e;let t=e.annotation(qb),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=LX(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 TMe=Ae(Qa());var UX=require("obsidian"),Un=Ae(Te());var OMe=Ae(Te());var MMe=e=>{let{i:t,style:r,active:n,toggleMarkAction:i}=e;return OMe.default.createElement("div",{key:t,"aria-label":e.plugin.isTouchScreen()?void 0:W.styles[r.label],className:`mk-mark ${r.mark&&n?"mk-mark-active":""}`,dangerouslySetInnerHTML:{__html:oi[`${r.icon}`]},onMouseDown:a=>i(a,r)})};var jMe=[{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 NMe(){return jMe}var FMe=(e,t)=>{t.enactor.createRoot(e).render(Un.default.createElement(WX,{mobile:!0,activeMarks:[],plugin:t}))},WX=e=>{let[t,r]=(0,Un.useState)(e.mobile?0:1),[n,i]=(0,Un.useState)(null),a=g=>{g.preventDefault();let A=e.cm??Eg(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??Eg(e.plugin);if(!b)return;if(A.mark){b.dispatch({annotations:qb.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=()=>Un.default.createElement(Un.default.Fragment,null,Un.default.createElement("div",{"aria-label":e.plugin.isTouchScreen()?void 0:W.commands.makeMenu,onMouseDown:g=>{a(g)},className:"mk-mark",dangerouslySetInnerHTML:{__html:oi["mk-make-slash"]}}),Un.default.createElement("div",{"aria-label":e.plugin.isTouchScreen()?void 0:W.commands.selectStyle,onMouseDown:()=>{r(1)},className:"mk-mark",dangerouslySetInnerHTML:{__html:oi["mk-make-style"]}}),Un.default.createElement("div",{"aria-label":e.plugin.isTouchScreen()?void 0:W.commands.image,onMouseDown:()=>{let g=oO(e.plugin);e.plugin.app.commands.commands["editor:attach-file"].editorCallback(g.editor,g)},className:"mk-mark",dangerouslySetInnerHTML:{__html:oi["mk-make-attach"]}}),Un.default.createElement("div",{"aria-label":e.plugin.isTouchScreen()?void 0:W.commands.toggleKeyboard,onMouseDown:()=>{let g=oO(e.plugin);e.plugin.app.commands.commands["editor:indent-list"].editorCallback(g.editor,g)},className:"mk-mark",dangerouslySetInnerHTML:{__html:oi["mk-make-indent"]}}),Un.default.createElement("div",{"aria-label":e.plugin.isTouchScreen()?void 0:W.commands.toggleKeyboard,onMouseDown:()=>{let g=oO(e.plugin);e.plugin.app.commands.commands["editor:unindent-list"].editorCallback(g.editor,g)},className:"mk-mark",dangerouslySetInnerHTML:{__html:oi["mk-make-unindent"]}}),Un.default.createElement("div",{"aria-label":e.plugin.isTouchScreen()?void 0:W.commands.toggleKeyboard,onMouseDown:()=>{let g=oO(e.plugin);e.plugin.app.commands.commands["editor:toggle-keyboard"].editorCallback(g.editor,g)},className:"mk-mark",dangerouslySetInnerHTML:{__html:oi["mk-make-keyboard"]}})),l=()=>Un.default.createElement(Un.default.Fragment,null,Un.default.createElement("div",{className:"mk-mark",onMouseDown:()=>{i(null),r(1)},dangerouslySetInnerHTML:{__html:oi.close}}),b2.map((g,A)=>Un.default.createElement("div",{key:A,onMouseDown:()=>{r(1),i(null);let b=e.cm??Eg(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(UX.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(UX.editorInfoField,!1).file,j=e.cm.state.sliceDoc(w.from,w.to);if(k&&e.plugin.enactor.isSpace(k.parent.path)){let C=lv(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=()=>Un.default.createElement(Un.default.Fragment,null,e.mobile?Un.default.createElement("div",{className:"mk-mark",onMouseDown:()=>{r(0)},dangerouslySetInnerHTML:{__html:oi.close}}):Un.default.createElement(Un.default.Fragment,null),NMe().map((g,A)=>Un.default.createElement(MMe,{plugin:e.plugin,key:A,i:A,style:g,active:!!e.activeMarks.find(b=>b==g.mark),toggleMarkAction:o})),Un.default.createElement("div",{className:"mk-divider"}),Un.default.createElement("div",{"aria-label":W.styles.blocklink,onClick:g=>{p(g)},className:"mk-mark",dangerouslySetInnerHTML:{__html:oi["mk-mark-blocklink"]}}),Un.default.createElement("div",{className:"mk-mark-group"},Un.default.createElement("div",{"aria-label":"New Note",onMouseDown:()=>{h(0)},className:"mk-mark",dangerouslySetInnerHTML:{__html:oi["new-note"]}})),e.plugin.settings.inlineStylerColors?Un.default.createElement(Un.default.Fragment,null,Un.default.createElement("div",{className:"mk-divider"}),Un.default.createElement("div",{"aria-label":e.plugin.isTouchScreen()?void 0:W.styles.textColor,onMouseDown:()=>{r(2),i({prefix:"",closeTag:""})},className:"mk-mark",dangerouslySetInnerHTML:{__html:oi["mk-mark-color"]}}),Un.default.createElement("div",{"aria-label":e.plugin.isTouchScreen()?void 0:W.styles.highlight,onMouseDown:()=>{r(2),i({prefix:"",closeTag:""})},className:"mk-mark",dangerouslySetInnerHTML:{__html:oi["mk-mark-highlight"]}})):Un.default.createElement(Un.default.Fragment,null));return Un.default.createElement("div",{className:(0,TMe.default)(e.mobile?"mk-style-toolbar":"mk-style-menu"),onMouseDown:g=>g.preventDefault()},t==0&&e.mobile?s():t==2?l():m())};var _Me=e=>{e.settings.flowMenuEnabled&&e.plugin.registerEditorSuggest(new fO(e.app,e)),e.settings.inlineStickerMenu&&e.plugin.registerEditorSuggest(new dO(e.app,e)),e.isTouchScreen()&&e.settings.mobileMakeBar&&e.settings.inlineStyler&&FMe(e.app.mobileToolbar.containerEl,e)};var rje=require("obsidian");var nR=require("@codemirror/state"),e1=require("@codemirror/view");var PMe=require("@codemirror/view");var IMe=e=>PMe.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(Rb,!1)&&r.containerEl.parentElement?.hasClass("workspace-tab-container")&&n.state.field(Rb,!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"),mO=require("@codemirror/view");var Ant=e=>mO.Decoration.line({attributes:{"data-ph":W.labels.placeholder.replace("${1}",e.settings.menuTriggerChar)},class:"mk-placeholder"}),BMe=e=>K7.StateField.define({create(){return mO.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=>mO.EditorView.decorations.from(t)});var $Me=require("@codemirror/state");var J7=Ae(Te());var gnt=e=>$Me.StateField.define({create:RMe(e),update(t,r){return!r.docChanged&&!r.selection?t:RMe(e)(r.state)},provide:t=>z7.computeN([t],r=>r.field(t))}),RMe=e=>t=>t.selection.ranges.filter(r=>!r.empty).map(r=>{let n=LX(r,t),i=t.doc.lineAt(r.head),a=Y7.map(o=>zX(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(WX,{plugin:e,cm:o,activeMarks:a,mobile:!1}))),{dom:s}}}});function qMe(e){return gnt(e)}var eR=(e,t)=>{let r=[...jOe()];return r.push(DMe,hMe({parent:document.body})),!t&&e.settings.inlineStyler&&r.push(qMe(e)),e.settings.flowMenuEnabled&&e.settings.makeMenuPlaceholder&&r.push(BMe(e)),e.settings.editorFlow&&(r.push(Rb,bMe),r.push(Wc,W7,IMe(e)),e.settings.internalLinkClickFlow?r.push(xMe):r.push(wMe(e))),r};var LMe=Ae(Qa()),zMe=require("obsidian"),ns=Ae(Te());var UMe=(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(ns.default.createElement(vnt,{superstate:t,plugin:e}))}},vnt=e=>{let t=(0,ns.useRef)(),[r,n]=ns.default.useState([]);(0,ns.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,ns.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)}),[]),ns.default.createElement("div",{className:"mk-main-menu-container"},ns.default.createElement("div",{className:"mk-main-menu-inner"},ns.default.createElement("div",{className:(0,LMe.default)("mk-main-menu")},ns.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&&ns.default.createElement("div",{className:"mk-icon-xsmall",dangerouslySetInnerHTML:{__html:oi.warning}}),ns.default.createElement("div",{className:"mk-icon-xsmall",dangerouslySetInnerHTML:{__html:oi["chevrons-up-down"]}})),e.superstate.settings.blinkEnabled&&ns.default.createElement("div",{className:"mk-main-menu-button",onClick:a=>e.superstate.ui.quickOpen()},ns.default.createElement("div",{className:"mk-icon-small",dangerouslySetInnerHTML:{__html:oi.search}}))),ns.default.createElement("button",{"aria-label":W.buttons.newNote,className:"mk-main-menu-button",onClick:a=>e.superstate.ui.defaultAdd(null,Ne(a.view.document),a.metaKey?"tab":!1)},ns.default.createElement("div",{className:"mk-icon-small",dangerouslySetInnerHTML:{__html:oi["new-note"]}})),zMe.Platform.isTablet&&ns.default.createElement("div",{"aria-label":W.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()},ns.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 WMe=Ae(Te());var HMe=e=>WMe.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 CE=require("obsidian"),GX=Ae(Te());var VMe=(e,t)=>{let r=t.map(a=>a.name),n="|",i=n+r.join(n)+`| +`)}`;t.ui.openModal("Path Fixer",lMe.default.createElement(Jy,{message:n,confirmLabel:"Rename",confirmAction:async()=>{for(let i of r){let a=ia(e.app,i),o=a instanceof sMe.TFile?a?.basename:a.name;if(!a)return;await nD(e.superstate,i,e.superstate.pathsIndex.get(i)?.metadata?.property?.aliases,o),await NDe(e,a,lv(o))}e.obsidianAdapter.fileNameWarnings=new Set}}),window)};var rnt=Ae(Te());var uMe=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 PX=Ae(bi());var _7=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=ir(await this.middleware.readTextFromFile(t.path))??{},i=n.label??{},a=n.property??{},o=(0,PX.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,PX.omit)(ir(i)??{},["label","property"])}if(r=="property"){let i=await this.middleware.readTextFromFile(t.path);return ir(i)?.property??{}}if(r=="label"){let i=await this.middleware.readTextFromFile(t.path),a=ir(i)?.label??{},o=$i("sticker",a[this.plugin.superstate.settings.fmKeySticker]),s=$i("color",a[this.plugin.superstate.settings.fmKeyColor]),l=$i("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=ir(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=ir(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=ir(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=ir(await this.middleware.readTextFromFile(t.path))??{};await this.middleware.writeTextToFile(t.path,JSON.stringify({...a,property:i})),this.parseCache(t,!0)}}};var cMe=require("obsidian"),P7=Ae(Te());var B7="mk-space-fragment";var I7=class extends cMe.ItemView{constructor(r,n){super(r);this.navigation=!0;this.plugin=n}getViewType(){return B7}getDisplayText(){return this.path}async onClose(){this.destroy()}onunload(){this.destroy()}destroy(){this.root&&this.root.unmount()}async onOpen(){this.destroy()}async setState(r,n){this.path=r.path,this.source=r.source,this.flow=r.flow,this.constructInlineContext(),await super.setState(r,n);let i=_1(this.path,this.plugin.superstate);this.leaf.tabHeaderInnerTitleEl.innerText=i,this.leaf.view.titleEl=i;let a=this.leaf.view.headerEl;a&&(a.querySelector(".view-header-title").innerText=i)}getState(){let r=super.getState();return r.path=this.path,r.source=this.source,r.flow=this.flow,r}constructInlineContext(){this.destroy(),this.root=this.plugin.ui.createRoot(this.contentEl),this.root?this.flow?this.root.render(P7.default.createElement(Yv,{id:this.path,superstate:this.plugin.superstate,path:this.path,source:this.source,showTitle:!0})):this.root.render(P7.default.createElement(rX,{superstate:this.plugin.superstate,path:this.path},P7.default.createElement(Yv,{id:this.path,superstate:this.plugin.superstate,path:this.path,source:this.source}))):this.plugin.ui.manager.eventsDispatch.addOnceListener("windowReady",()=>{this.constructInlineContext()})}};var fMe=require("obsidian");var nnt=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)},int=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:ua.uniques,cols:ua.cols,rows:r}}},ant=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:ua.uniques,cols:ua.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","",int(r.frames),{})}if(r.context){let s=o.space.dbPath;e.mdbFileAdapter.newContent({path:s,isFolder:!1,name:"context",parent:"",filename:"context.mdb"},"tables","",ant(r.context),{})}if(r.templates?.length>0){await e.files.createFolder(`${n}/${e.superstate.settings.spaceSubFolder}/templates`);for(let s of r.templates)await nnt(e,t,o.path,s)}for(let s of r.notes)i?await e.files.writeTextToFile(o.path+"/"+s.name,s.content):Ji(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)},dMe=(e,t)=>{let r=e.replace(t,"");if(r.startsWith("/"))return"."+r;{let n=t.split("/").length;return(n>0?"../".repeat(n):"")+r}},ont=(e,t)=>{let r={...e};return e[pr].rows=e[pr].rows.map(n=>(n[mt]=dMe(n[mt],t),n)),r},aO=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 aO(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 aO(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(Zv);if(x){let w=x[1];l=(0,fMe.parseYaml)(w)}}g&&(u=dC(ir(g),t.settings)),o=await fE(e.mdbFileAdapter,m.dbPath),s=await fE(e.mdbFileAdapter,m.framePath);let b=await t.spaceManager.childrenForPath(r,"folder");for(let x of b){let w=await aO(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:dMe(r,n),definition:u,properties:l,context:ont(o,r),frames:s,children:c,content:p,notes:f,assets:[],templates:d}};var ql=Ae(Te());var IX=(e,t,r,n)=>{t.ui.openModal("Add Kit",ql.default.createElement(snt,{plugin:e,superstate:t,kit:r}),n)},snt=e=>{let[t,r]=(0,ql.useState)(e.kit),[n,i]=(0,ql.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,ir(o),n)}).then(o=>{e.superstate.ui.notify("Kit added"),e.hide()})};return ql.default.createElement("div",null,ql.default.createElement("div",{className:"setting-item"},ql.default.createElement("div",{className:"setting-item-heading"},"Kit Location"),ql.default.createElement("span",null),ql.default.createElement("input",{type:"text",value:t,onChange:o=>r(o.target.value)})),ql.default.createElement("div",{className:"setting-item"},ql.default.createElement("div",{className:"setting-item-heading"},"Add Kit to Space"),ql.default.createElement("span",null),ql.default.createElement(L9,{superstate:e.superstate,triggerMenu:o=>{let s=o.target.getBoundingClientRect();ao(s,Ne(o.view.document),e.superstate,l=>i(l))},value:e.superstate.spacesIndex.get(n)?.name,selectValue:o=>{i(o)}})),ql.default.createElement("div",{className:"setting-item"},ql.default.createElement("button",{onClick:()=>a()},"Add"),ql.default.createElement("button",{onClick:e.hide},"Cancel")))};var $b=require("@codemirror/state"),kg=require("@codemirror/view");var Eg=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},oO=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 pMe(e,t,r){Xs(t).iterate({...r,from:e,to:e})}function sO(e,t,r){Xs(t).iterate({...r,from:e.from,to:e.to})}var mm=require("@codemirror/state"),Vh=require("@codemirror/view"),lnt=typeof navigator<"u"&&!/Edge\/(\d+)/.exec(navigator.userAgent)&&/Apple Computer/.test(navigator.vendor)&&(/Mobile\/\w+/.test(navigator.userAgent)||navigator.maxTouchPoints>2),BX="-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:lnt?"absolute":e.find(t=>t.position)?.position||"fixed",parent:e.find(t=>t.parent)?.parent||null,tooltipSpace:e.find(t=>t.tooltipSpace)?.tooltipSpace||unt})}),cnt=Vh.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=BX,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=BX;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||dnt,m=this.view.textDirection==Vh.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 lO(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)}},pnt=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:lO.create,above:t[0].above,arrow:t.some(r=>r.arrow)}});var RX=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==Vh.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,Vh.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&&!mMe(this.lastMove.target)||this.pending){let{pos:n}=r||this.pending,i=r?.end??n;(n==i?this.view.posAtCoords(this.lastMove)!=n:!mnt(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&&!mMe(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 mMe(e){for(let t=e;t;t=t.parentNode)if(t.nodeType==1&&t.classList.contains("cm-tooltip"))return!0;return!1}function mnt(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,Vh.ViewPlugin.define(i=>new RX(i,e,n,r,t.hoverTime||300)),pnt]}var gMe=mm.StateEffect.define(),eNr=gMe.of(null);var qX=Ae(Te());var wE=require("@codemirror/state"),U7=wE.Annotation.define(),vMe=wE.Annotation.define(),W7=wE.StateField.define({create:()=>{},update(e,t){return t.annotation(vMe)?t.annotation(vMe):e}}),Rb=wE.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(W.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:W.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:W.buttons.cutTable,icon:"ui//cut",onClick:c=>{i()}}),u.push({name:W.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":W.buttons.toggleFlow,onClick:o,className:`mk-toolbar-button ${e.toggleState?"mk-toggle-on":""}`,dangerouslySetInnerHTML:{__html:e.toggleState?oi["book-open"]:oi["edit-3"]}})))};var Ll=Ae(Te());var hnt=e=>e.charAt(0)=="/"?e.substring(1):e,yMe=e=>e.lastIndexOf("/")!=-1?e.lastIndexOf(".")!=-1?hnt(e.substring(e.lastIndexOf("/")+1,e.lastIndexOf("."))):e.substring(e.lastIndexOf("/")+1):e.lastIndexOf(".")!=-1?e.substring(0,e.lastIndexOf(".")):e,uO=(0,Ll.forwardRef)((e,t)=>{let r=(0,Ll.useRef)(null),[n,i]=(0,Ll.useState)(!1),[a,o]=(0,Ll.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,yMe(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,Ll.useEffect)(()=>{l()},[e.load,e.path]),(0,Ll.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)}},[]),Ll.default.createElement(Ll.default.Fragment,null,Ll.default.createElement("div",{className:`${e.classname??""} mk-flowspace-editor`,ref:r,onClick:u=>u.stopPropagation()}),n?Ll.default.createElement("div",{onClick:()=>s(!0),className:"mk-placeholder",style:{color:"var(--mk-ui-text-tertiary)"}},W.labels.notePlaceholder.replace("${1}",yMe(e.path))):Ll.default.createElement(Ll.default.Fragment,null))});uO.displayName="UINote";var SE=(e,t)=>(r,n)=>{let i=t?r:n,a=t?n:r;return i[e]a[e]?1:0};var cO=require("obsidian");var Uf=$b.Annotation.define(),Am=$b.Annotation.define(),bMe=$b.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(Rb,!1)=="doc"?{annotations:Uf.of([n.id,2])}:{annotations:Uf.of([n.id,0])})),[e,...t]}),xMe=kg.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])}))}}}}),wMe=e=>AMe((t,r,n)=>{let{from:i,to:a}=t.state.doc.lineAt(r),o=null;return sO({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?W.buttons.openFlow:W.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?W.buttons.openFlow:W.buttons.hideFlow),{dom:p}}},!1}}}),o}),Wc=$b.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:mv();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:mv();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:mv();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(SE("from",!0)),r}}),V7=class extends kg.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(cO.editorInfoField,!1)){let a=r.state.field(cO.editorInfoField,!1).file;this.root=this.plugin.enactor.createRoot(n),this.root.render(qX.default.createElement(uO,{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()}},$X=class extends kg.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(cO.editorInfoField,!1)){let o=r.state.field(cO.editorInfoField,!1).file;i.render(qX.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)=>kg.Decoration.replace({widget:new $X(e,t),inclusive:!0,block:!1}),EE=(e,t)=>kg.Decoration.replace({widget:new V7(e,t),inclusive:!0,block:!1}),Q7=(e,t)=>kg.Decoration.widget({widget:new V7(e,t),inclusiveStart:!0,block:!0});var SMe=require("obsidian");var fO=class extends SMe.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())||W.commands[i]&&W.commands[i].toLowerCase().includes(r.query.toLowerCase()));return n.length>0?n:[{label:W.commandsSuggest.noResult,value:"",icon:"",type:0}]}renderSuggestion(r,n){if(r.value==""){n.setText(W.commandsSuggest.noResult);return}let i=n.createDiv("mk-slash-item"),a=i.createDiv("mk-slash-icon");a.innerHTML=oi[r.icon],i.createDiv().setText(W.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!==W.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 EMe=require("obsidian"),LX=Ae(Te());var dO=class extends EMe.EditorSuggest{constructor(r,n){super(r);this.inCmd=!1;this.cmdStartCh=0;this.plugin=n,this.emojis=Object.keys(hE).reduce((i,a)=>[...i,...hE[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:W.commandsSuggest.noResult,unicode:"",desc:""}]}renderSuggestion(r,n){let i=document.createElement("div");i.setAttribute("aria-label",r.label),this.plugin.enactor.createRoot(i).render(LX.default.createElement(LX.default.Fragment,null,r.unicode.length>0?Xy(r.unicode):W.commandsSuggest.noResult)),n.appendChild(i)}selectSuggestion(r,n){r.label!==W.commandsSuggest.noResult&&(this.context.editor.replaceRange(Xy(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 qb=X7.Annotation.define(),kMe=(e,t,r)=>t&&r.sliceDoc(e,e+1)==" "?e+1:!t&&r.sliceDoc(e-1,e)==" "?e-1:e,CMe=(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 sO({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=kMe(CMe(e.from,!0,t),!0,t),n=kMe(CMe(e.to,!1,t),!1,t);return{from:r,to:n}},Jv=(e,t)=>({changes:{from:e,to:e,insert:t.formatChar}}),WX=(e,t,r)=>pO(r.from,e,t.mark)&&pO(r.to,e,t.mark),pO=(e,t,r)=>{let n=!1;return pMe(e,t,{enter:({name:i,from:a,to:o})=>{zX(i,r)&&(n=!0)}}),n},zX=(e,t)=>e.includes(t),Z7=(e,t,r)=>pO(e,t,r.mark),kE=(e,t,r)=>pO(e,t,r.formatting)?!0:r.altFormatting?pO(e,t,r.altFormatting):!1,Ant=(e,t,r)=>{let n=[];return WX(r,t,e)?(kE(e.from,r,t)&&!kE(e.to,r,t)&&n.push(Jv(e.to,t)),kE(e.to,r,t)&&!kE(e.from,r,t)&&n.push(Jv(e.from,t))):Z7(e.from,r,t)?(kE(e.from,r,t)&&!Z7(e.from-1,r,t)&&n.push(Jv(e.from,t)),n.push(Jv(e.to,t))):Z7(e.to,r,t)?(kE(e.to,r,t)&&!Z7(e.to+1,r,t)&&n.push(Jv(e.to,t)),n.push(Jv(e.from,t))):(n.push(Jv(e.to,t)),n.push(Jv(e.from,t))),n},gnt=(e,t,r)=>{let n=[];return sO({from:e.from,to:e.to},t,{enter:({name:i,from:a,to:o})=>{(zX(i,r.formatting)||(r.altFormatting?zX(i,r.altFormatting):!1))&&n.push({from:a,to:a+r.formatChar.length})}}),{changes:n}},DMe=X7.EditorState.transactionFilter.of(e=>{if(!e.annotation(qb))return e;let t=e.annotation(qb),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=UX(n,e.startState);i.push(gnt(a,e.startState,r));let o=a.from,s=a.to;return i.push(...Ant(a,r,e.startState)),[e,...i,{selection:{anchor:o,head:s}}]});var TMe=Ae(Qa());var HX=require("obsidian"),Un=Ae(Te());var OMe=Ae(Te());var MMe=e=>{let{i:t,style:r,active:n,toggleMarkAction:i}=e;return OMe.default.createElement("div",{key:t,"aria-label":e.plugin.isTouchScreen()?void 0:W.styles[r.label],className:`mk-mark ${r.mark&&n?"mk-mark-active":""}`,dangerouslySetInnerHTML:{__html:oi[`${r.icon}`]},onMouseDown:a=>i(a,r)})};var jMe=[{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 NMe(){return jMe}var FMe=(e,t)=>{t.enactor.createRoot(e).render(Un.default.createElement(VX,{mobile:!0,activeMarks:[],plugin:t}))},VX=e=>{let[t,r]=(0,Un.useState)(e.mobile?0:1),[n,i]=(0,Un.useState)(null),a=g=>{g.preventDefault();let A=e.cm??Eg(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??Eg(e.plugin);if(!b)return;if(A.mark){b.dispatch({annotations:qb.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=()=>Un.default.createElement(Un.default.Fragment,null,Un.default.createElement("div",{"aria-label":e.plugin.isTouchScreen()?void 0:W.commands.makeMenu,onMouseDown:g=>{a(g)},className:"mk-mark",dangerouslySetInnerHTML:{__html:oi["mk-make-slash"]}}),Un.default.createElement("div",{"aria-label":e.plugin.isTouchScreen()?void 0:W.commands.selectStyle,onMouseDown:()=>{r(1)},className:"mk-mark",dangerouslySetInnerHTML:{__html:oi["mk-make-style"]}}),Un.default.createElement("div",{"aria-label":e.plugin.isTouchScreen()?void 0:W.commands.image,onMouseDown:()=>{let g=oO(e.plugin);e.plugin.app.commands.commands["editor:attach-file"].editorCallback(g.editor,g)},className:"mk-mark",dangerouslySetInnerHTML:{__html:oi["mk-make-attach"]}}),Un.default.createElement("div",{"aria-label":e.plugin.isTouchScreen()?void 0:W.commands.toggleKeyboard,onMouseDown:()=>{let g=oO(e.plugin);e.plugin.app.commands.commands["editor:indent-list"].editorCallback(g.editor,g)},className:"mk-mark",dangerouslySetInnerHTML:{__html:oi["mk-make-indent"]}}),Un.default.createElement("div",{"aria-label":e.plugin.isTouchScreen()?void 0:W.commands.toggleKeyboard,onMouseDown:()=>{let g=oO(e.plugin);e.plugin.app.commands.commands["editor:unindent-list"].editorCallback(g.editor,g)},className:"mk-mark",dangerouslySetInnerHTML:{__html:oi["mk-make-unindent"]}}),Un.default.createElement("div",{"aria-label":e.plugin.isTouchScreen()?void 0:W.commands.toggleKeyboard,onMouseDown:()=>{let g=oO(e.plugin);e.plugin.app.commands.commands["editor:toggle-keyboard"].editorCallback(g.editor,g)},className:"mk-mark",dangerouslySetInnerHTML:{__html:oi["mk-make-keyboard"]}})),l=()=>Un.default.createElement(Un.default.Fragment,null,Un.default.createElement("div",{className:"mk-mark",onMouseDown:()=>{i(null),r(1)},dangerouslySetInnerHTML:{__html:oi.close}}),b2.map((g,A)=>Un.default.createElement("div",{key:A,onMouseDown:()=>{r(1),i(null);let b=e.cm??Eg(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(HX.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(HX.editorInfoField,!1).file,j=e.cm.state.sliceDoc(w.from,w.to);if(k&&e.plugin.enactor.isSpace(k.parent.path)){let C=lv(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=()=>Un.default.createElement(Un.default.Fragment,null,e.mobile?Un.default.createElement("div",{className:"mk-mark",onMouseDown:()=>{r(0)},dangerouslySetInnerHTML:{__html:oi.close}}):Un.default.createElement(Un.default.Fragment,null),NMe().map((g,A)=>Un.default.createElement(MMe,{plugin:e.plugin,key:A,i:A,style:g,active:!!e.activeMarks.find(b=>b==g.mark),toggleMarkAction:o})),Un.default.createElement("div",{className:"mk-divider"}),Un.default.createElement("div",{"aria-label":W.styles.blocklink,onClick:g=>{p(g)},className:"mk-mark",dangerouslySetInnerHTML:{__html:oi["mk-mark-blocklink"]}}),Un.default.createElement("div",{className:"mk-mark-group"},Un.default.createElement("div",{"aria-label":"New Note",onMouseDown:()=>{h(0)},className:"mk-mark",dangerouslySetInnerHTML:{__html:oi["new-note"]}})),e.plugin.settings.inlineStylerColors?Un.default.createElement(Un.default.Fragment,null,Un.default.createElement("div",{className:"mk-divider"}),Un.default.createElement("div",{"aria-label":e.plugin.isTouchScreen()?void 0:W.styles.textColor,onMouseDown:()=>{r(2),i({prefix:"",closeTag:""})},className:"mk-mark",dangerouslySetInnerHTML:{__html:oi["mk-mark-color"]}}),Un.default.createElement("div",{"aria-label":e.plugin.isTouchScreen()?void 0:W.styles.highlight,onMouseDown:()=>{r(2),i({prefix:"",closeTag:""})},className:"mk-mark",dangerouslySetInnerHTML:{__html:oi["mk-mark-highlight"]}})):Un.default.createElement(Un.default.Fragment,null));return Un.default.createElement("div",{className:(0,TMe.default)(e.mobile?"mk-style-toolbar":"mk-style-menu"),onMouseDown:g=>g.preventDefault()},t==0&&e.mobile?s():t==2?l():m())};var _Me=e=>{e.settings.flowMenuEnabled&&e.plugin.registerEditorSuggest(new fO(e.app,e)),e.settings.inlineStickerMenu&&e.plugin.registerEditorSuggest(new dO(e.app,e)),e.isTouchScreen()&&e.settings.mobileMakeBar&&e.settings.inlineStyler&&FMe(e.app.mobileToolbar.containerEl,e)};var rje=require("obsidian");var nR=require("@codemirror/state"),e1=require("@codemirror/view");var PMe=require("@codemirror/view");var IMe=e=>PMe.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(Rb,!1)&&r.containerEl.parentElement?.hasClass("workspace-tab-container")&&n.state.field(Rb,!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"),mO=require("@codemirror/view");var vnt=e=>mO.Decoration.line({attributes:{"data-ph":W.labels.placeholder.replace("${1}",e.settings.menuTriggerChar)},class:"mk-placeholder"}),BMe=e=>K7.StateField.define({create(){return mO.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,vnt(e)),n.finish()},provide:t=>mO.EditorView.decorations.from(t)});var $Me=require("@codemirror/state");var J7=Ae(Te());var ynt=e=>$Me.StateField.define({create:RMe(e),update(t,r){return!r.docChanged&&!r.selection?t:RMe(e)(r.state)},provide:t=>z7.computeN([t],r=>r.field(t))}),RMe=e=>t=>t.selection.ranges.filter(r=>!r.empty).map(r=>{let n=UX(r,t),i=t.doc.lineAt(r.head),a=Y7.map(o=>WX(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(VX,{plugin:e,cm:o,activeMarks:a,mobile:!1}))),{dom:s}}}});function qMe(e){return ynt(e)}var eR=(e,t)=>{let r=[...jOe()];return r.push(DMe,hMe({parent:document.body})),!t&&e.settings.inlineStyler&&r.push(qMe(e)),e.settings.flowMenuEnabled&&e.settings.makeMenuPlaceholder&&r.push(BMe(e)),e.settings.editorFlow&&(r.push(Rb,bMe),r.push(Wc,W7,IMe(e)),e.settings.internalLinkClickFlow?r.push(xMe):r.push(wMe(e))),r};var LMe=Ae(Qa()),zMe=require("obsidian"),ns=Ae(Te());var UMe=(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(ns.default.createElement(bnt,{superstate:t,plugin:e}))}},bnt=e=>{let t=(0,ns.useRef)(),[r,n]=ns.default.useState([]);(0,ns.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,ns.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)}),[]),ns.default.createElement("div",{className:"mk-main-menu-container"},ns.default.createElement("div",{className:"mk-main-menu-inner"},ns.default.createElement("div",{className:(0,LMe.default)("mk-main-menu")},ns.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&&ns.default.createElement("div",{className:"mk-icon-xsmall",dangerouslySetInnerHTML:{__html:oi.warning}}),ns.default.createElement("div",{className:"mk-icon-xsmall",dangerouslySetInnerHTML:{__html:oi["chevrons-up-down"]}})),e.superstate.settings.blinkEnabled&&ns.default.createElement("div",{className:"mk-main-menu-button",onClick:a=>e.superstate.ui.quickOpen()},ns.default.createElement("div",{className:"mk-icon-small",dangerouslySetInnerHTML:{__html:oi.search}}))),ns.default.createElement("button",{"aria-label":W.buttons.newNote,className:"mk-main-menu-button",onClick:a=>e.superstate.ui.defaultAdd(null,Ne(a.view.document),a.metaKey?"tab":!1)},ns.default.createElement("div",{className:"mk-icon-small",dangerouslySetInnerHTML:{__html:oi["new-note"]}})),zMe.Platform.isTablet&&ns.default.createElement("div",{"aria-label":W.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()},ns.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 WMe=Ae(Te());var HMe=e=>WMe.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 CE=require("obsidian"),YX=Ae(Te());var VMe=(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},HX=class extends e1.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(CE.editorInfoField,!1)){let o=r.state.field(CE.editorInfoField,!1).file,s=this.superstate.spaceManager.uriByString(this.info.link,o?.path);i.render(GX.default.createElement(u9,{superstate:this.superstate,path:s.basePath}))}return n}},VX=class extends e1.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(CE.editorInfoField,!1)&&i.render(GX.default.createElement(HMe,{collapsed:this.info.expandedState==0,onToggle:a=>{r.dispatch({annotations:Uf.of([this.info.id,a?2:0])})}})),n}},GMe=(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:e1.Decoration.widget({widget:new HX(s,r),side:-1})}),t.settings.internalLinkClickFlow&&a.push({start:u+2,end:u+2,decoration:e1.Decoration.widget({widget:new VX(s,r),side:-1})}),f==2&&a.push({start:u+2,end:u+2,decoration:EE(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:EE(s,t)})))}a.sort(SE("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 GMe(r,e,t)},update(r,n){return GMe(n.state,e,t)},provide:r=>e1.EditorView.decorations.from(r)}),rR=class{constructor(t,r){this.makemd=t;this.plugin=r;this.name="MakeMD"}load(){this.plugin.settings=Object.assign({},tR,this.makemd.superstate.settings,this.makemd.superstate.settings.basicsSettings),this.plugin.settings.mobileSidepanel&&this.plugin.app.workspace.onLayoutReady(async()=>{UMe(this.plugin,this.makemd.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:` +`}),i},GX=class extends e1.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(CE.editorInfoField,!1)){let o=r.state.field(CE.editorInfoField,!1).file,s=this.superstate.spaceManager.uriByString(this.info.link,o?.path);i.render(YX.default.createElement(u9,{superstate:this.superstate,path:s.basePath}))}return n}},QX=class extends e1.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(CE.editorInfoField,!1)&&i.render(YX.default.createElement(HMe,{collapsed:this.info.expandedState==0,onToggle:a=>{r.dispatch({annotations:Uf.of([this.info.id,a?2:0])})}})),n}},GMe=(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:e1.Decoration.widget({widget:new GX(s,r),side:-1})}),t.settings.internalLinkClickFlow&&a.push({start:u+2,end:u+2,decoration:e1.Decoration.widget({widget:new QX(s,r),side:-1})}),f==2&&a.push({start:u+2,end:u+2,decoration:EE(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:EE(s,t)})))}a.sort(SE("start",!0));for(let s of a)n.add(s.start,s.end,s.decoration);return n.finish()},Snt=(e,t)=>nR.StateField.define({create(r){return GMe(r,e,t)},update(r,n){return GMe(n.state,e,t)},provide:r=>e1.EditorView.decorations.from(r)}),rR=class{constructor(t,r){this.makemd=t;this.plugin=r;this.name="MakeMD"}load(){this.plugin.settings=Object.assign({},tR,this.makemd.superstate.settings,this.makemd.superstate.settings.basicsSettings),this.plugin.settings.mobileSidepanel&&this.plugin.app.workspace.onLayoutReady(async()=>{UMe(this.plugin,this.makemd.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(t,u=>{i.replaceRange(`![[${u}]]`,{...a,ch:o},s),l()})}},{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(v9(r.enactor.makemd.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)=>{vD(r.enactor.makemd.superstate,n.parent.path,"table").then(u=>{i.replaceRange(dD(r.enactor.makemd.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)=>{vD(r.enactor.makemd.superstate,n.parent.path,"board").then(u=>{i.replaceRange(dD(r.enactor.makemd.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.makemd.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.makemd.superstate.spaceManager.readFrame(t.path,t.id).then(i=>i?.schema);if(n){let i=Ao(n);this.makemd.superstate.spaceManager.readTable(t.path,i.def.db).then(a=>{if(!a)return;let o=VMe(a.rows,a.cols);r(o)})}}else this.makemd.superstate.spaceManager.readTable(t.path,t.id).then(n=>{if(!n)return;let i=VMe(n.rows,n.cols);r(i)})}selectLink(t,r){let n=t.target.getBoundingClientRect();return this.makemd.superstate.ui.quickOpen(2,n,Ne(t.view.document),r)}selectSpace(t,r){let n=t.target.getBoundingClientRect();return this.makemd.superstate.ui.quickOpen(3,n,Ne(t.view.document),r)}selectImage(t,r){let n=t.target.getBoundingClientRect();this.makemd.superstate.ui.quickOpen(4,n,Ne(t.view.document),r)}isSpace(t){return this.makemd.superstate.spacesIndex.has(t)}spaceNotePath(t){return this.makemd.superstate.spacesIndex.get(t)?.space.notePath}spaceFolderPath(t){return(this.makemd.superstate.spacesIndex.get(t)?.space).folderPath}parentPath(t){return this.makemd.superstate.spaceManager.parentPathForPath(t)}createNote(t,r,n){return this.makemd.superstate.spaceManager.createItemAtPath(t,"md",r,n)}createRoot(t){return this.makemd.superstate.ui.createRoot(t)}notify(t){return this.makemd.superstate.ui.notify(t)}uriByString(t,r){return this.makemd.superstate.spaceManager.uriByString(t,r)}spaceFragmentSchema(t){return H8(this.makemd.superstate,t)}saveSettings(){this.makemd.superstate.settings.basicsSettings=this.plugin.settings,this.plugin.plugin.saveSettings()}resolvePath(t,r){return this.makemd.superstate.spaceManager.resolvePath(t,r)}openMenu(t,r){let n=t.target.getBoundingClientRect();return this.makemd.superstate.ui.openMenu(n,{ui:this.makemd.superstate.ui,multi:!1,value:[],editable:!1,options:r,searchable:!1,showAll:!0},Ne(t.view.document))}pathExists(t){return this.makemd.superstate.spaceManager.pathExists(t)}openPath(t,r){let n=this.uriByString(t);AE(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 CE.TFile){await a.openFile(this.plugin.app.vault.getAbstractFileByPath(n.basePath));let o=gE(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 this.plugin.plugin.openPath(a,t,!0)})}addActiveStateListener(t){this.makemd.superstate.ui.eventsDispatch.addListener("activeStateChanged",t)}removeActiveStateListener(t){this.makemd.superstate.ui.eventsDispatch.removeListener("activeStateChanged",t)}};var aR=require("@codemirror/state"),YMe=require("@codemirror/view");var t1=require("obsidian"),ZMe=Ae(bX());var QMe=(e,t)=>{let r=new aR.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:EE(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:EE(o,t)})))}i.sort(SE("start",!0));for(let o of i)r.add(o.start,o.end,o.decoration);return r.finish()},wnt=e=>aR.StateField.define({create(t){return QMe(t,e)},update(t,r){return QMe(r.state,e)},provide:t=>YMe.EditorView.decorations.from(t)}),QX=class extends t1.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)}},iR=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(t,u=>{i.replaceRange(`![[${u}]]`,{...a,ch:o},s),l()})}},{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(v9(r.enactor.makemd.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)=>{vD(r.enactor.makemd.superstate,n.parent.path,"table").then(u=>{i.replaceRange(dD(r.enactor.makemd.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)=>{vD(r.enactor.makemd.superstate,n.parent.path,"board").then(u=>{i.replaceRange(dD(r.enactor.makemd.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(Snt(this.plugin,this.makemd.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.makemd.superstate.spaceManager.readFrame(t.path,t.id).then(i=>i?.schema);if(n){let i=Ao(n);this.makemd.superstate.spaceManager.readTable(t.path,i.def.db).then(a=>{if(!a)return;let o=VMe(a.rows,a.cols);r(o)})}}else this.makemd.superstate.spaceManager.readTable(t.path,t.id).then(n=>{if(!n)return;let i=VMe(n.rows,n.cols);r(i)})}selectLink(t,r){let n=t.target.getBoundingClientRect();return this.makemd.superstate.ui.quickOpen(2,n,Ne(t.view.document),r)}selectSpace(t,r){let n=t.target.getBoundingClientRect();return this.makemd.superstate.ui.quickOpen(3,n,Ne(t.view.document),r)}selectImage(t,r){let n=t.target.getBoundingClientRect();this.makemd.superstate.ui.quickOpen(4,n,Ne(t.view.document),r)}isSpace(t){return this.makemd.superstate.spacesIndex.has(t)}spaceNotePath(t){return this.makemd.superstate.spacesIndex.get(t)?.space.notePath}spaceFolderPath(t){return(this.makemd.superstate.spacesIndex.get(t)?.space).folderPath}parentPath(t){return this.makemd.superstate.spaceManager.parentPathForPath(t)}createNote(t,r,n){return this.makemd.superstate.spaceManager.createItemAtPath(t,"md",r,n)}createRoot(t){return this.makemd.superstate.ui.createRoot(t)}notify(t){return this.makemd.superstate.ui.notify(t)}uriByString(t,r){return this.makemd.superstate.spaceManager.uriByString(t,r)}spaceFragmentSchema(t){return H8(this.makemd.superstate,t)}saveSettings(){this.makemd.superstate.settings.basicsSettings=this.plugin.settings,this.plugin.plugin.saveSettings()}resolvePath(t,r){return this.makemd.superstate.spaceManager.resolvePath(t,r)}openMenu(t,r){let n=t.target.getBoundingClientRect();return this.makemd.superstate.ui.openMenu(n,{ui:this.makemd.superstate.ui,multi:!1,value:[],editable:!1,options:r,searchable:!1,showAll:!0},Ne(t.view.document))}pathExists(t){return this.makemd.superstate.spaceManager.pathExists(t)}openPath(t,r){let n=this.uriByString(t);AE(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 CE.TFile){await a.openFile(this.plugin.app.vault.getAbstractFileByPath(n.basePath));let o=gE(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 this.plugin.plugin.openPath(a,t,!0)})}addActiveStateListener(t){this.makemd.superstate.ui.eventsDispatch.addListener("activeStateChanged",t)}removeActiveStateListener(t){this.makemd.superstate.ui.eventsDispatch.removeListener("activeStateChanged",t)}};var aR=require("@codemirror/state"),YMe=require("@codemirror/view");var t1=require("obsidian"),ZMe=Ae(wX());var QMe=(e,t)=>{let r=new aR.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:EE(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:EE(o,t)})))}i.sort(SE("start",!0));for(let o of i)r.add(o.start,o.end,o.decoration);return r.finish()},Ent=e=>aR.StateField.define({create(t){return QMe(t,e)},update(t,r){return QMe(r.state,e)},provide:t=>YMe.EditorView.decorations.from(t)}),ZX=class extends t1.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)}},iR=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:"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 QX(this.plugin.app,r).open()}selectSpace(t,r){return this.notify("Not implemented")}pathExists(t){return this.plugin.app.vault.adapter.exists(t)}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,ZMe.createRoot)(t)}notify(t){new t1.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 t1.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);AE(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 t1.TFile){await a.openFile(this.plugin.app.vault.getAbstractFileByPath(n.basePath));let o=gE(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)]})}})}addActiveStateListener(t){}removeActiveStateListener(t){}};var XMe=e=>{e.plugin.addCommand({id:"mk-open-flow",name:W.commandPalette.openFlow,callback:()=>e.openFlow()}),e.plugin.addCommand({id:"mk-close-flow",name:W.commandPalette.closeFlow,callback:()=>e.closeFlow()})};var YX=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},KMe=(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(YX.default.createElement(uO,{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 JMe=(e,t,r,n)=>{Ent(e,async i=>{let a=i.querySelectorAll(".markdown-embed-link");for(let o=0;o{let t=!1,r=Mb(r1.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 Hh.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=Hh.forLeaf(a);return n.call(this,i,a)}}});e.plugin.register(r)},tje=e=>{e.plugin.register(Mb(r1.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(Mb(r1.WorkspaceItem.prototype,{getContainer(t){return function(){if(!!t)return!this.parentSplit||this instanceof r1.WorkspaceContainer?t.call(this):this.parentSplit.getContainer()}}}))};var hO=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"),this);this.enactor=r}else this.enactor=new iR(this)}isTouchScreen(){return rje.Platform.isMobile}toggleBold(){let t=Eg(this);t&&t.dispatch({annotations:qb.of("strong")})}toggleEm(){let t=Eg(this);t&&t.dispatch({annotations:qb.of("em")})}openFlow(){let t=Eg(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=Eg(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),_Me(this),this.settings.editorFlow&&(eje(this),tje(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 sR=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 oR(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[pr].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 nje=e=>JSON.stringify(e),DE=e=>`${e.type}:${e.path}`;var n1=Ae(bi());var ije={def:{id:"eventItem",type:"listItem"},node:{type:"group",id:"$root",schemaId:"$root",name:W.frames.event.label,rank:0},id:"$root",children:[ct(Mo,{value:"$contexts.$context['_keyValue']"},{padding:"'0'","--font-text-weight":"'bold'"})]},aje={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'"})]},oje={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:W.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:[us(Fv,{icon:"'ui//chevron-left'"},{},{onClick:"$saveState({$root: {props: {offset: $root.props.offset - 1}}})"}),us(Fv,{label:"'Today'"},{},{onClick:"$saveState({$root: {props: {offset: 0}}})"}),us(Fv,{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 AO={id:"fieldsView",def:{id:"fieldsView"},node:{schemaId:"fieldsView",parentId:"",name:"Properties",rank:0,id:"fieldsView",type:"group"},children:[ct({...w9,children:[ct({...S9,children:[us(wh,{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'"})]},sje={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'"})]},lje={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'"})]},uje={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'"})]},cje={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({...Tv,children:[ct({...Rc,children:[ct({...Wi,node:{...Wi.node,ref:"$root"}},{},{background:"'var(--mk-ui-background-selected)'"})]},{value:"true"}),ct({...Rc,children:[ct({...Wi,node:{...Wi.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(Za,{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)'"}),us(AO,{},{marginTop:"'8px'"})]}]},fje={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({...Tv,children:[ct({...Rc,children:[ct({...Wi,node:{...Wi.node,ref:"$root"}},{},{background:"'var(--mk-ui-background-selected)'"})]},{value:"true"}),ct({...Rc,children:[ct({...Wi,node:{...Wi.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)'"}),us(AO,{})]}]},dje={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({...Tv,children:[ct({...Rc,children:[ct({...Wi,node:{...Wi.node,ref:"$root"}},{},{background:"'var(--mk-ui-background-selected)'"})]},{value:"true"}),ct({...Rc,children:[ct({...Wi,node:{...Wi.node,ref:"$root"}},{},{background:"'transparent'"})]},{value:"false"})]},{value:"'_selected'"}),us(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'"}),us(wh,{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)'"})]}]}]},pje={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({...Tv,children:[ct({...Rc,children:[ct({...Wi,node:{...Wi.node,ref:"$root"}},{},{background:"'var(--mk-ui-background-selected)'"})]},{value:"true"}),ct({...Rc,children:[ct({...Wi,node:{...Wi.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(Za,{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"})]},mje={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({...Tv,children:[ct({...Rc,children:[ct({...Wi,node:{...Wi.node,ref:"$root"}},{},{background:"'var(--mk-ui-background-selected)'"})]},{value:"true"}),ct({...Rc,children:[ct({...Wi,node:{...Wi.node,ref:"$root"}},{},{background:"'transparent'"})]},{value:"false"})]},{value:"'_selected'"}),us(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)'"}),us(AO,{})]}]},lR={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:[{...Q1,node:{...Q1.node,styles:{...Q1.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 = ''"}}}]},hje={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:[us(wh,{type:"$root.props['_groupType']",value:"$root.props['_groupValue']"}),ct(mc,{},{layout:"'column'",alignItems:"'stretch'"}),us(lR,{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']"})]},Aje={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:[us(wh,{type:"$root.props['_groupType']",value:"$root.props['_groupValue']"}),ct(mc,{},{gap:"'8px'",layout:"'column'",width:"'100%'",alignItems:"'stretch'"}),ct({...hn,children:[us(lR,{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']"})]},gje={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:[us(wh,{type:"$root.props['_groupType']",value:"$root.props['_groupValue']"}),ct(mc,{},{gap:"'8px'",layout:"'row'",width:"'100%'",overflow:"'scroll'"})]},vje={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:[us(wh,{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'"})]},yje={def:{id:"masonryGroup",type:"listGroup"},node:{type:"group",props:{},id:"$root",schemaId:"$root",name:"Masonry",rank:0,styles:{layout:"'column'"}},id:"$root",children:[us(wh,{type:"$root.props['_groupType']",value:"$root.props['_groupValue']"}),ct(mc,{},{padding:"'8px'",layout:"'masonry'"})]},bje={def:{id:"listView",type:"listView"},node:{type:"group",props:{},id:"$root",schemaId:"$root",name:"List View",rank:0},id:"$root",children:[mc]},xje={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 uR=class{constructor(t){this.frame={update:(t,r,n,i)=>{if(t.startsWith("$contexts")){let{context:a,prop:o}=uL(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=mr(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=>Ri(t),value:(t,r)=>t?ca(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=>{Ji(this.superstate,this.superstate.spacesIndex.get(r),n,t,!0,a)}):Ji(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 WN(this.superstate.spaceManager,a.space,r,n,i)},insert:(t,r,n)=>{if(r==pr){this.context.insert(t,r,n[mt],n);return}let i=this.superstate.spacesIndex.get(t);return i?Loe(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==pr){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==pr){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 s9(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&&Roe(this.superstate.spaceManager,r,n,i,a.space)},insert:async(t,r,n,i)=>{if(r==pr)Ji(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 cR=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=W5(this.superstate,n.code,r)),n.schema.type=="script"&&(i=YS(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 gO(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 ZX(){return gO(`"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,Qu)=>{(function(e,r){typeof Rw=="object"&&typeof Qu<"u"?Qu.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,ZMe.createRoot)(t)}notify(t){new t1.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 t1.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);AE(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 t1.TFile){await a.openFile(this.plugin.app.vault.getAbstractFileByPath(n.basePath));let o=gE(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)]})}})}addActiveStateListener(t){}removeActiveStateListener(t){}};var XMe=e=>{e.plugin.addCommand({id:"mk-open-flow",name:W.commandPalette.openFlow,callback:()=>e.openFlow()}),e.plugin.addCommand({id:"mk-close-flow",name:W.commandPalette.closeFlow,callback:()=>e.closeFlow()})};var XX=Ae(Te()),knt=(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},KMe=(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(XX.default.createElement(uO,{load:!0,plugin:e,path:a,source:r.sourcePath}))}})},Cnt=(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 JMe=(e,t,r,n)=>{Cnt(e,async i=>{let a=i.querySelectorAll(".markdown-embed-link");for(let o=0;o{let t=!1,r=Mb(r1.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 Hh.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=Hh.forLeaf(a);return n.call(this,i,a)}}});e.plugin.register(r)},tje=e=>{e.plugin.register(Mb(r1.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(Mb(r1.WorkspaceItem.prototype,{getContainer(t){return function(){if(!!t)return!this.parentSplit||this instanceof r1.WorkspaceContainer?t.call(this):this.parentSplit.getContainer()}}}))};var hO=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"),this);this.enactor=r}else this.enactor=new iR(this)}isTouchScreen(){return rje.Platform.isMobile}toggleBold(){let t=Eg(this);t&&t.dispatch({annotations:qb.of("strong")})}toggleEm(){let t=Eg(this);t&&t.dispatch({annotations:qb.of("em")})}openFlow(){let t=Eg(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=Eg(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),_Me(this),this.settings.editorFlow&&(eje(this),tje(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 sR=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 oR(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[pr].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 nje=e=>JSON.stringify(e),DE=e=>`${e.type}:${e.path}`;var n1=Ae(bi());var ije={def:{id:"eventItem",type:"listItem"},node:{type:"group",id:"$root",schemaId:"$root",name:W.frames.event.label,rank:0},id:"$root",children:[ct(Mo,{value:"$contexts.$context['_keyValue']"},{padding:"'0'","--font-text-weight":"'bold'"})]},aje={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'"})]},oje={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:W.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:[us(Fv,{icon:"'ui//chevron-left'"},{},{onClick:"$saveState({$root: {props: {offset: $root.props.offset - 1}}})"}),us(Fv,{label:"'Today'"},{},{onClick:"$saveState({$root: {props: {offset: 0}}})"}),us(Fv,{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 AO={id:"fieldsView",def:{id:"fieldsView"},node:{schemaId:"fieldsView",parentId:"",name:"Properties",rank:0,id:"fieldsView",type:"group"},children:[ct({...w9,children:[ct({...S9,children:[us(wh,{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'"})]},sje={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'"})]},lje={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'"})]},uje={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'"})]},cje={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({...Tv,children:[ct({...Rc,children:[ct({...Wi,node:{...Wi.node,ref:"$root"}},{},{background:"'var(--mk-ui-background-selected)'"})]},{value:"true"}),ct({...Rc,children:[ct({...Wi,node:{...Wi.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(Za,{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)'"}),us(AO,{},{marginTop:"'8px'"})]}]},fje={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({...Tv,children:[ct({...Rc,children:[ct({...Wi,node:{...Wi.node,ref:"$root"}},{},{background:"'var(--mk-ui-background-selected)'"})]},{value:"true"}),ct({...Rc,children:[ct({...Wi,node:{...Wi.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)'"}),us(AO,{})]}]},dje={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({...Tv,children:[ct({...Rc,children:[ct({...Wi,node:{...Wi.node,ref:"$root"}},{},{background:"'var(--mk-ui-background-selected)'"})]},{value:"true"}),ct({...Rc,children:[ct({...Wi,node:{...Wi.node,ref:"$root"}},{},{background:"'transparent'"})]},{value:"false"})]},{value:"'_selected'"}),us(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'"}),us(wh,{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)'"})]}]}]},pje={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({...Tv,children:[ct({...Rc,children:[ct({...Wi,node:{...Wi.node,ref:"$root"}},{},{background:"'var(--mk-ui-background-selected)'"})]},{value:"true"}),ct({...Rc,children:[ct({...Wi,node:{...Wi.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(Za,{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"})]},mje={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({...Tv,children:[ct({...Rc,children:[ct({...Wi,node:{...Wi.node,ref:"$root"}},{},{background:"'var(--mk-ui-background-selected)'"})]},{value:"true"}),ct({...Rc,children:[ct({...Wi,node:{...Wi.node,ref:"$root"}},{},{background:"'transparent'"})]},{value:"false"})]},{value:"'_selected'"}),us(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)'"}),us(AO,{})]}]},lR={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:[{...Q1,node:{...Q1.node,styles:{...Q1.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 = ''"}}}]},hje={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:[us(wh,{type:"$root.props['_groupType']",value:"$root.props['_groupValue']"}),ct(mc,{},{layout:"'column'",alignItems:"'stretch'"}),us(lR,{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']"})]},Aje={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:[us(wh,{type:"$root.props['_groupType']",value:"$root.props['_groupValue']"}),ct(mc,{},{gap:"'8px'",layout:"'column'",width:"'100%'",alignItems:"'stretch'"}),ct({...hn,children:[us(lR,{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']"})]},gje={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:[us(wh,{type:"$root.props['_groupType']",value:"$root.props['_groupValue']"}),ct(mc,{},{gap:"'8px'",layout:"'row'",width:"'100%'",overflow:"'scroll'"})]},vje={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:[us(wh,{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'"})]},yje={def:{id:"masonryGroup",type:"listGroup"},node:{type:"group",props:{},id:"$root",schemaId:"$root",name:"Masonry",rank:0,styles:{layout:"'column'"}},id:"$root",children:[us(wh,{type:"$root.props['_groupType']",value:"$root.props['_groupValue']"}),ct(mc,{},{padding:"'8px'",layout:"'masonry'"})]},bje={def:{id:"listView",type:"listView"},node:{type:"group",props:{},id:"$root",schemaId:"$root",name:"List View",rank:0},id:"$root",children:[mc]},xje={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 uR=class{constructor(t){this.frame={update:(t,r,n,i)=>{if(t.startsWith("$contexts")){let{context:a,prop:o}=uL(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=mr(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=>Ri(t),value:(t,r)=>t?ca(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=>{Ji(this.superstate,this.superstate.spacesIndex.get(r),n,t,!0,a)}):Ji(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 WN(this.superstate.spaceManager,a.space,r,n,i)},insert:(t,r,n)=>{if(r==pr){this.context.insert(t,r,n[mt],n);return}let i=this.superstate.spacesIndex.get(t);return i?Loe(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==pr){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==pr){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 s9(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&&Roe(this.superstate.spaceManager,r,n,i,a.space)},insert:async(t,r,n,i)=>{if(r==pr)Ji(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 cR=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=W5(this.superstate,n.code,r)),n.schema.type=="script"&&(i=YS(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 gO(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 KX(){return gO(`"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,Qu)=>{(function(e,r){typeof Rw=="object"&&typeof Qu<"u"?Qu.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 wl=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 Dl(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 Sl(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")||Nl.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")||Nl.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")||Nl.call(this),g?this._weekdaysMinStrictRegex:this._weekdaysMinRegex):(i(this,"_weekdaysMinRegex")||(this._weekdaysMinRegex=w1),this._weekdaysMinStrictRegex&&g?this._weekdaysMinStrictRegex:this._weekdaysMinRegex)}function Nl(){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 Al(){return this.hours()%12||12}function _1(){return this.hours()||24}$("H",["HH",2],0,"hour"),$("h",["hh",2],0,Al),$("k",["kk",2],0,_1),$("hmm",0,0,function(){return""+Al.apply(this)+X(this.minutes(),2)}),$("hmmss",0,0,function(){return""+Al.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 Ml(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:gl,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 Qu<"u"&&Qu&&Qu.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=hl),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)?)?$/,Cl=/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/]],Tl=/^\\/?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}))$/,_l={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 Ol(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),dl(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]=Bl(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 Bl(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 Il(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=Rl;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 kl(){return this._d.valueOf()-(this._offset||0)*6e4}function Bs(){return Math.floor(this.valueOf()/1e3)}function Ll(){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=Ll,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=kl,Ve.creationData=ob,Ve.eraName=Pu,Ve.eraNarrow=Rs,Ve.eraAbbr=ym,Ve.eraYear=Z,Ve.year=wl,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",wl),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=yl,tt.monthsRegex=h1,tt.monthsShortRegex=xl,tt.week=Dl,tt.firstDayOfYear=Uc,tt.firstDayOfWeek=qc,tt.weekdays=D1,tt.weekdaysMin=Sl,tt.weekdaysShort=S1,tt.weekdaysParse=A1,tt.weekdaysRegex=Nt,tt.weekdaysShortRegex=Dt,tt.weekdaysMinRegex=T1,tt.isPM=Zc,tt.meridiem=Ml;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 ql(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 Ul(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 Ul(this,g,A,1)}function vi(g,A){return Ul(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(zl(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(zl(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 zl(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(zl(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"),Yl=Qn("Q"),Tm=Qn("y");function Ua(){return zr(this)}function Wl(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"),Hl=za("hours"),Fb=za("days"),Ob=za("months"),Bb=za("years");function $l(){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 Gl=Math.abs;function qi(g){return(g>0)-(g<0)||+g}function qs(){if(!this.isValid())return this.localeData().invalidDate();var g=Gl(this._milliseconds)/1e3,A=Gl(this._days),P=Gl(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=Yl,Xr.asYears=Tm,Xr.valueOf=Mm,Xr._bubble=so,Xr.clone=Ua,Xr.get=Wl,Xr.milliseconds=uo,Xr.seconds=_m,Xr.minutes=Dn,Xr.hours=Hl,Xr.days=Fb,Xr.weeks=$l,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",cl),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=ql,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((Ku,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*$/,cl=/[^.[\\]]+|\\[(?:(-?\\d+(?:\\.\\d+)?)|(["'])((?:(?!\\2)[^\\\\]|\\\\.)*?)\\2)\\]|(?=(?:\\.|\\[\\])(?:\\.|\\[\\]|$))/g,ui=/[\\\\^$.*+?()[\\]{}|]/g,Fo=RegExp(ui.source),ar=/^\\s+/,ml=/\\s/,pl=/\\{(?:\\n\\/\\* \\[wrapped with .+\\] \\*\\/)?\\n?/,bn=/\\{\\n\\/\\* \\[wrapped with (.+)\\] \\*/,Ss=/,? & /,ct=/[^\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\x7f]+/g,eo=/[()=,{}\\[\\]\\/\\s]/,dl=/\\\\(\\\\)?/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*)$/,hl=/[\\xc0-\\xd6\\xd8-\\xf6\\xf8-\\xff\\u0100-\\u017f]/g,Oo=/($^)/,vl=/['\\n\\r\\u2028\\u2029\\\\]/g,wt="\\\\ud800-\\\\udfff",Bo="\\\\u0300-\\\\u036f",gl="\\\\ufe20-\\\\ufe2f",vu="\\\\u20d0-\\\\u20ff",Ns=Bo+gl+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",yl=" \\\\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+yl,xl="['\\u2019]",h1="["+wt+"]",bl="["+xu+"]",Fi="["+Ns+"]",wl="\\\\d+",v1="["+gu+"]",kc="["+yu+"]",Io="[^"+wt+xu+wl+gu+yu+_i+"]",Po="\\\\ud83c[\\\\udffb-\\\\udfff]",Lc="(?:"+Fi+"|"+Po+")",Ro="[^"+wt+"]",ya="(?:\\\\ud83c[\\\\udde6-\\\\uddff]){2}",Dl="[\\\\ud800-\\\\udbff][\\\\udc00-\\\\udfff]",ko="["+_i+"]",qc="\\\\u200d",Uc="(?:"+kc+"|"+Io+")",g1="(?:"+ko+"|"+Io+")",zc="(?:"+xl+"(?:d|ll|m|re|s|t|ve))?",Yc="(?:"+xl+"(?:D|LL|M|RE|S|T|VE))?",Wc=Lc+"?",bu="["+li+"]?",y1="(?:"+qc+"(?:"+[Ro,ya,Dl].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,Dl].join("|")+")"+$c,w1="(?:"+[Ro+Fi+"?",Fi,ya,Dl,h1].join("|")+")",D1=RegExp(xl,"g"),S1=RegExp(Fi,"g"),Sl=RegExp(Po+"(?="+Po+")|"+w1+$c,"g"),N1=RegExp([ko+"?"+kc+"+"+zc+"(?="+[bl,ko,"$"].join("|")+")",g1+"+"+Yc+"(?="+[bl,ko+Uc,"$"].join("|")+")",ko+"?"+Uc+"+"+zc,ko+"+"+Yc,x1,Hc,wl,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"},Nl={"&":"&","<":"<",">":">",'"':""","'":"'"},Al={"&":"&","<":"<",">":">",""":'"',"'":"'"},_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")(),Ml=typeof Ku=="object"&&Ku&&!Ku.nodeType&&Ku,Oi=Ml&&typeof ac=="object"&&ac&&!ac.nodeType&&ac,At=Oi&&Oi.exports===Ml,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,El=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 Cl(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(Nl);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 Rl(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,Ul(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 zl(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 Xl(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=Cl,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 Yl=cA(),Tm=cA(!0);function Ua(l,d){return l&&Yl(l,d,vn)}function Wl(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 Vl(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(pl,\`{ @@ -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 fR=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=DE(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=DE(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 XX(){return gO('"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,Mt=/(\\[[^\\[]*\\])|(\\\\)?(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&&Mt.test(e);)e=e.replace(Mt,i),Mt.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 Ot(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):Ft(this,e)}}function Ft(e,t){return e.isValid()?e._d["get"+(e._isUTC?"UTC":"")+t]():NaN}function da(e,t,a){e.isValid()&&!isNaN(a)&&(t==="FullYear"&&Ot(e.year())&&e.month()===1&&e.date()===29?(a=O(a),e._d["set"+(e._isUTC?"UTC":"")+t](a,e.month(),At(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 Ot(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 Lt(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=Lt(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=Lt(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=Lt(e,t,a),l=Lt(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 Pi(){return this._week.dow}function Ci(){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=Et(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 Et(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=Et(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=Et(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=Et(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]>At(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)?/,Rt=[["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=Rt.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 Ca(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 Ht(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 Ut(a),Ht(e)&&d(e,"_locale")&&(c._locale=e._locale),Ht(e)&&d(e,"_isValid")&&(c._isValid=e._isValid),c}he.fn=Ut.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,Ft(e,"Month")+h*a),c&&da(e,"Date",Ft(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 jt=1e3,et=60*jt,$t=60*et,Ha=(365*400+97)*24*$t;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),$t);break;case"minute":t=this._d.valueOf(),t-=tt(t,et);break;case"second":t=this._d.valueOf(),t-=tt(t,jt);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+=$t-tt(t+(this._isUTC?0:this.utcOffset()*et),$t)-1;break;case"minute":t=this._d.valueOf(),t+=et-tt(t,et)-1;break;case"second":t=this._d.valueOf(),t+=jt-tt(t,jt)-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 Po(){return x({},S(this))}function Co(){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=Co,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=Po,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 C=Q.prototype;C.calendar=Qe,C.longDateFormat=Zn,C.invalidDate=Kn,C.ordinal=ti,C.preparse=qa,C.postformat=qa,C.relativeTime=ai,C.pastFuture=ni,C.set=pe,C.eras=Yo,C.erasParse=Io,C.erasConvertYear=Wo,C.erasAbbrRegex=Ho,C.erasNameRegex=Uo,C.erasNarrowRegex=Vo,C.months=wi,C.monthsShort=xi,C.monthsParse=bi,C.monthsRegex=Ti,C.monthsShortRegex=_i,C.week=Oi,C.firstDayOfYear=Ci,C.firstDayOfWeek=Pi,C.weekdays=Hi,C.weekdaysMin=ji,C.weekdaysShort=Vi,C.weekdaysParse=Bi,C.weekdaysRegex=Qi,C.weekdaysShortRegex=Zi,C.weekdaysMinRegex=Ji,C.isPM=Xi,C.meridiem=rs;function Gt(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 Gt(e,t,a,"month");var i,l=[];for(i=0;i<12;i++)l[i]=Gt(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 Gt(t,(a+c)%7,i,"day");for(h=0;h<7;h++)_[h]=Gt(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 Pl=He("milliseconds"),Cl=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 qt(){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 P=Ut.prototype;P.isValid=Ys,P.abs=hl,P.add=ml,P.subtract=pl,P.as=yl,P.asMilliseconds=wl,P.asSeconds=xl,P.asMinutes=vl,P.asHours=bl,P.asDays=kl,P.asWeeks=_l,P.asMonths=Tl,P.asQuarters=Ml,P.asYears=Dl,P.valueOf=Sl,P._bubble=gl,P.clone=Ol,P.get=Fl,P.milliseconds=Pl,P.seconds=Cl,P.minutes=Nl,P.hours=Yl,P.days=Il,P.weeks=Ll,P.months=Wl,P.years=Al,P.humanize=Vl,P.toISOString=qt,P.toString=qt,P.toJSON=qt,P.locale=Ea,P.localeData=Ua,P.toIsoString=A("toIsoString() is deprecated. Please use toISOString() instead (notice the capitals)",qt),P.lang=Ra,k("X",0,0,"unix"),k("x",0,0,"valueOf"),v("x",Yt),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=Ps,r.now=Cs,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=Ht,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})});var wt=n=>{let r;try{r=JSON.parse(n)}catch{}return 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 Pr(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 Cr(n){Y(1,arguments);var r=xt(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()-Cr(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=vt(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=vt(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=xt(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=Pr(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 bt(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:bt({formats:uu,defaultWidth:"full"}),time:bt({formats:du,defaultWidth:"full"}),dateTime:bt({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},Pu={any:[/1/i,/2/i,/3/i,/4/i]},Cu={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:Pu,defaultParseWidth:"any",valueCallback:function(r){return r+1}}),month:Be({matchPatterns:Cu,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:{openNativeMenu:"Obsidian options",layout:"Layout",enterFlowState:"Enter Flow State",exitFlowState:"Exit Flow State",newView:"New View",calendarView:"Calendar View",dayView:"Day View",closeSpace:"Remove from 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",applyItems:"Apply to items in folder",rename:"Rename",changeToFolderNote:"Transform into Folder",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 ${1}",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:"Color",labels:"Labels",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:"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 Tag",cancel:"Cancel",search:"Search",delete:"Delete",toggleFlow:"Toggle Flow",openFlow:"Open Flow",hideFlow:"Hide Flow",openLink:"Open Link",addToSpace:"Pin file to...",addToSpaceShort:"Pin",addTag:"Add Tag",saveTemplate:"Make into template",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"},editStickerInSidebar:{name:"Edit Stickers in Sidebar",desc:"Edit stickers directly in the sidebar"},notesPreview:{name:"Notes Preview",desc:"Show a preview of notes, may cause performance issues"},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",kt={id:Ge,name:"Items",type:"db",primary:"true"};var xn={uniques:["name,schemaId"],cols:["name","schemaId","type","value","attrs","hidden","unique","primary"]},_t={...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 sh=[{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"}),oh={uniques:[],cols:["id","name","type","def","predicate","primary"],rows:[zu(qu),Gu]},Zt={uniques:[],cols:["id","name","type","def","predicate","primary"],rows:[kt]};var lh={schema:kt,cols:_t.rows,rows:[]},uh={schema:kt,cols:_t.rows,rows:[]},dh={schema:kt,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 ch={m_schema:Zt,m_fields:_t,...vn(_t.rows,Zt.rows)},fh={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(wt(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 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"?Cn(m,d,s):d.type=="frontmatter"?Pn(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"?Cn(o,u,s):u.type=="frontmatter"?Pn(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})},Pn=(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})},Cn=(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 Pe(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)||Pe(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 Pe(n)?n:n.split(".")}function Qr(n){return Pe(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(Pe(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(Pe(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 Pe(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 Tt({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 Tt({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=>!Pe(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];Pe(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 Ce=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 Tt))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(Pe(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}};Ce.version="7.0.0";Ce.createIndex=jn;Ce.parseIndex=pd;Ce.config=T;Ce.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 Ce([...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 Pd=self;Pd.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 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)}}run(t){let r=DE(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=DE(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 OE=class{constructor(t,r,n,i,a){this.indexVersion=t;this.onChange=r;this.kit=[Fv,E9,M9,D9,O9,ije,j9,mD,_Ee,lje,mje,pje,uje,fje,cje,dje,hje,Aje,yje,bje,oje,aje,k9,wh,vje,lR,C9,AO,gje,sje,xje];this.eventsDispatcher=new a0;let o={...NV,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=VB(o,{matrix:"Array"});l.import(cC,{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 cR(this.cli,this);this.cli.superstate=this,this.cli.terminals.splice(0,0,u),this.cli.mainTerminal=u,this.allMetadata={},this.api=new uR(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 fR(2,this),this.searcher=new dR(1,this)}static create(t,r,n,i,a){return new OE(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=N7(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=>rj(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 tj(this,r,{...d0,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=ir(i.cache);a&&a.type&&this.spacesIndex.set(i.path,a)}),n.forEach(i=>{let a=ir(i.cache);a&&this.contextsIndex.set(i.path,a)}),t.forEach(i=>{let a=v7(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=>Hn(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&&!n1.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(!n1.default.isEqual(t.metadata?.filters,r?.filters)||s)for(let[l,u]of this.pathsIndex)!u.hidden&&T7(t.metadata?.filters,u,t.properties)&&i.push(l)}let o=[...n1.default.difference(i,[...n]),...n1.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=kJ(t),i=h0(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(()=>$oe(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:Kg})}async onTagDeleted(t){this.tagsMap.getInverse(t).forEach(i=>{this.deleteTagInPath(t,i)});let r=TM(t,this.settings);await this.spaceManager.deletePath(r),this.onSpaceDeleted(Hn(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(()=>qoe(this.spaceManager,t,n)),this.dispatchEvent("spaceStateUpdated",{path:Kg})}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!=Hn(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(()=>VU(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 Hoe(this.spaceManager,t,n,u.map(f=>f.space));for(let f of u)f.metadata?.links?.includes(t)&&this.addToContextStateQueue(()=>pC(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(()=>Uoe(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=Tu(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(()=>Voe(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(()=>Woe(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]:ca(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?yJ([...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";(!n1.default.isEqual(n.metadata.links,r.links)||!n1.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,T1).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"?tr(b.value):[])),m=kr((i.filters??[]).flatMap(b=>b.filters).flatMap(b=>b.type.startsWith("link")?tr(b.value):[]));if(s=="tag"&&this.settings.autoAddContextsToSubtags){let b=JJ(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=>{iee(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)),!n1.default.isEqual(r.spaces,Array.from(this.spacesMap.get(t)))){this.spacesMap.set(t,new Set(r.spaces));let a=r.tags.map(s=>h0(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:Kg})})}if(i){let a=r.spaces.map(o=>this.spacesIndex.get(o)?.space).filter(o=>o);this.addToContextStateQueue(()=>VU(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,nje(r),"path")}};var wje=.999,pR=class extends Su.Plugin{constructor(){super(...arguments);this.debouncedRefresh=()=>null;this.openPath=async(r,n,i)=>{let a=this.superstate.spaceManager.uriByString(n);if(!!a){if(a.scheme=="https"||a.scheme=="http"){if(this.superstate.spacesIndex.has(n)){let o=bu;this.app.workspace.setActiveLeaf(r,{focus:!0}),await r.setViewState({type:o,state:{path:n,flow:i}});return}else if(this.superstate.pathsIndex.has(n)){let o=Db;this.app.workspace.setActiveLeaf(r,{focus:!0}),await r.setViewState({type:o,state:{path:n,flow:i}});return}window.open(a.fullPath,"_blank");return}if(a.scheme=="obsidian"){await r.setViewState({type:a.authority});return}if(a.ref&&(this.superstate.pathsIndex.get(a.path)?.type=="space"||a.scheme=="spaces")){i&&a.ref=="main"?await r.setViewState({type:Cb,state:{path:a.fullPath}}):await r.setViewState({type:B7,state:{path:a.fullPath,flow:i}});return}if(a.scheme=="spaces"){_De(r,a.basePath,this.app);return}this.files.getFile(n).then(o=>{if(o)if(o.isFolder)FDe(r,ia(this.app,o.path),this,i);else if(o)TDe(r,ia(this.app,o.path),this.app);else return;else if(n.contains("/")){let s=Vl(Tu(n)),l=this.superstate.spacesIndex.get(s);l&&Ji(this.superstate,l,iX(n),aX(n))}else uv(this.superstate,this.superstate.pathsIndex.get(this.superstate.ui.activePath)).then(s=>{s&&Ji(this.superstate,s,iX(n),aX(n))})})}};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 sE&&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 sE&&n.view.destroy(),n.detach()};this.detachFileContextLeafs=()=>{let r=this.app.workspace.getLeavesOfType(Ob);for(let n of r)n.view instanceof ZD&&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(Ob)}}quickOpen(r,n,i,a){let o=Ne(this.app.workspace.getLeaf()?.containerEl.ownerDocument);tMe(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),wje>this.superstate.settings.releaseNotesPrompt&&(this.releaseTheNotes(),this.superstate.settings.releaseNotesPrompt=wje,this.saveSettings()),this.superstate.settings.firstLaunch||(this.getStarted(),this.superstate.settings.firstLaunch=!0,this.saveSettings())})}loadViews(){this.registerView(zh,r=>new i7(r,this.superstate,this.ui)),this.registerView(qf,r=>new sE(r,this.superstate,this.ui)),this.registerView(bu,r=>new kb(r,this.superstate,this.ui,bu)),this.registerView(B7,r=>new I7(r,this)),this.registerView(Cb,r=>new J8(r,this)),this.superstate.settings.contextEnabled&&(this.registerView(Db,r=>new n7(r,this.app,Db,this.superstate)),this.registerView(Ob,r=>new ZD(r,this.superstate,this.ui)),this.registerView(o7,r=>new a7(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&&GDe(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&&NM(this.superstate,n.file.path,!0)}else this.superstate.ui.notify(W.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(kb)?.leaf);let a=i?.view;return!a||i.isFlowBlock||(a.getViewType()==bu?(tO(this),n=a.getState(),r=a.getState().path):a.getViewType()=="markdown"&&(r=a.file.path,n=a.getState(),YDe(this),tO(this)),!r||!n)?null:{path:r,state:n}}fixFileWarnings(){TX(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&&_X(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:()=>{D7(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:()=>{TX(this)}}),this.addCommand({id:"move-space-folder",name:"Move Space Data Folder",callback:()=>{let r=Ne(this.app.workspace.getLeaf()?.containerEl.ownerDocument);Oxe(this.superstate,"Move Space Data Folder",this.superstate.settings.spaceSubFolder,n=>{uMe(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:()=>{_X(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)&&aO(this,this.superstate,r,r).then(n=>{this.superstate.spaceManager.createItemAtPath("/","mkit","kit",JSON.stringify(n))})}}),this.addCommand({id:"mk-collapse-folders",name:W.commandPalette.collapseAllFolders,callback:()=>{this.superstate.settings.expandedSpaces=[],this.saveSettings()}}),this.addCommand({id:"mk-release-notes",name:W.commandPalette.releaseNotes,callback:()=>{this.releaseTheNotes()}}),this.addCommand({id:"mk-get-started",name:W.commandPalette.getStarted,callback:()=>{this.getStarted()}}),this.addCommand({id:"mk-reveal-file",name:W.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:W.commandPalette.openSpaces,callback:()=>this.openFileTreeLeaf(!0)})),this.superstate.settings.enableFolderNote&&this.addCommand({id:"mk-convert-folder-note",name:W.commandPalette.convertPathToSpace,callback:()=>this.convertPathToSpace()}),this.superstate.settings.contextEnabled&&this.addCommand({id:"mk-open-file-context",name:W.commandPalette.openFileContext,callback:()=>this.openFileContextLeaf(Ob,!0)}),this.superstate.settings.inlineBacklinks&&this.addCommand({id:"mk-toggle-backlinks",name:W.commandPalette.toggleBacklinks,callback:()=>{let r=new CustomEvent(im.toggleBacklinks);window.dispatchEvent(r)}}),this.superstate.settings.blinkEnabled&&this.addCommand({id:"mk-blink",name:W.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"],o7),this.app.workspace.onLayoutReady(async()=>{this.superstate.settings.autoOpenFileContext&&await this.openFileContextLeaf(Ob),setTimeout(()=>this.activeFileChange(),2e3)}),this.superstate.settings.inlineContext&&(this.registerMarkdownPostProcessor((r,n)=>{zDe(this,r,n)}),document.body.classList.toggle("mk-inline-context-enabled",this.superstate.settings.inlineContext)))}openEverView(){let r=this.app.workspace.getLeavesOfType(zh);if(r.length==0){let n=this.app.workspace.createLeafBySplit(this.app.workspace.getLeaf(),"vertical",!0);n.setViewState({type:zh}),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:zh}),i.setPinned(!0)});QDe(this)}async onload(){let r=Date.now(),n=Object.assign({},oE,await this.loadData());this.mdbFileAdapter=new A7(this),this.files=F1.create(),this.obsidianAdapter=new b7(this,this.files,(0,Su.normalizePath)(this.app.vault.configDir+"/plugins/make-md/Spaces.mdb")),this.files.initiateFileSystemAdapter(this.obsidianAdapter,!0),this.markdownAdapter=new S7(this),this.files.initiateFiletypeAdapter(this.mdbFileAdapter),this.files.initiateFiletypeAdapter(this.markdownAdapter),this.files.initiateFiletypeAdapter(new w7(this)),this.files.initiateFiletypeAdapter(new _7(this)),this.files.initiateFiletypeAdapter(new F7(this)),this.files.initiateFiletypeAdapter(new M7(this));let i=new bC(this.files,n.spaceSubFolder),a=new sR;this.ui=new O7(this);let o=Uy.create(this.ui),s=xE.create(new j7(this));this.superstate=OE.create("0.9",()=>{this.debouncedRefresh()},new sk,o,s),await this.loadSettings(),this.superstate.settings.experimental&&this.files.initiateFiletypeAdapter(new e7(this)),this.superstate.spaceManager.addSpaceAdapter(i,!0),this.superstate.spaceManager.addSpaceAdapter(a),(0,Su.addIcon)("mk-logo",HDe),this.superstate.saveSettings=()=>this.saveSettings(),this.loadViews();let l;Su.Platform.isMobile?l=new mE(".makemd/superstate.mdc",this.mdbFileAdapter,["path","space","frame","context","icon"]):l=new pE(".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 Z8(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 hO(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({},oE,await this.loadData()),this.superstate.settings.hiddenExtensions.length==1&&this.superstate.settings.hiddenExtensions[0]==".mdb"&&(this.superstate.settings.hiddenExtensions=oE.hiddenExtensions);let r=ir(await jDe(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 fR=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=DE(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=DE(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 JX(){return gO('"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,Mt=/(\\[[^\\[]*\\])|(\\\\)?(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&&Mt.test(e);)e=e.replace(Mt,i),Mt.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 Ot(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):Ft(this,e)}}function Ft(e,t){return e.isValid()?e._d["get"+(e._isUTC?"UTC":"")+t]():NaN}function da(e,t,a){e.isValid()&&!isNaN(a)&&(t==="FullYear"&&Ot(e.year())&&e.month()===1&&e.date()===29?(a=O(a),e._d["set"+(e._isUTC?"UTC":"")+t](a,e.month(),At(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 Ot(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 Lt(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=Lt(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=Lt(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=Lt(e,t,a),l=Lt(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 Pi(){return this._week.dow}function Ci(){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=Et(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 Et(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=Et(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=Et(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=Et(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]>At(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)?/,Rt=[["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=Rt.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 Ca(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 Ht(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 Ut(a),Ht(e)&&d(e,"_locale")&&(c._locale=e._locale),Ht(e)&&d(e,"_isValid")&&(c._isValid=e._isValid),c}he.fn=Ut.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,Ft(e,"Month")+h*a),c&&da(e,"Date",Ft(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 jt=1e3,et=60*jt,$t=60*et,Ha=(365*400+97)*24*$t;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),$t);break;case"minute":t=this._d.valueOf(),t-=tt(t,et);break;case"second":t=this._d.valueOf(),t-=tt(t,jt);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+=$t-tt(t+(this._isUTC?0:this.utcOffset()*et),$t)-1;break;case"minute":t=this._d.valueOf(),t+=et-tt(t,et)-1;break;case"second":t=this._d.valueOf(),t+=jt-tt(t,jt)-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 Po(){return x({},S(this))}function Co(){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=Co,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=Po,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 C=Q.prototype;C.calendar=Qe,C.longDateFormat=Zn,C.invalidDate=Kn,C.ordinal=ti,C.preparse=qa,C.postformat=qa,C.relativeTime=ai,C.pastFuture=ni,C.set=pe,C.eras=Yo,C.erasParse=Io,C.erasConvertYear=Wo,C.erasAbbrRegex=Ho,C.erasNameRegex=Uo,C.erasNarrowRegex=Vo,C.months=wi,C.monthsShort=xi,C.monthsParse=bi,C.monthsRegex=Ti,C.monthsShortRegex=_i,C.week=Oi,C.firstDayOfYear=Ci,C.firstDayOfWeek=Pi,C.weekdays=Hi,C.weekdaysMin=ji,C.weekdaysShort=Vi,C.weekdaysParse=Bi,C.weekdaysRegex=Qi,C.weekdaysShortRegex=Zi,C.weekdaysMinRegex=Ji,C.isPM=Xi,C.meridiem=rs;function Gt(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 Gt(e,t,a,"month");var i,l=[];for(i=0;i<12;i++)l[i]=Gt(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 Gt(t,(a+c)%7,i,"day");for(h=0;h<7;h++)_[h]=Gt(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 Pl=He("milliseconds"),Cl=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 qt(){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 P=Ut.prototype;P.isValid=Ys,P.abs=hl,P.add=ml,P.subtract=pl,P.as=yl,P.asMilliseconds=wl,P.asSeconds=xl,P.asMinutes=vl,P.asHours=bl,P.asDays=kl,P.asWeeks=_l,P.asMonths=Tl,P.asQuarters=Ml,P.asYears=Dl,P.valueOf=Sl,P._bubble=gl,P.clone=Ol,P.get=Fl,P.milliseconds=Pl,P.seconds=Cl,P.minutes=Nl,P.hours=Yl,P.days=Il,P.weeks=Ll,P.months=Wl,P.years=Al,P.humanize=Vl,P.toISOString=qt,P.toString=qt,P.toJSON=qt,P.locale=Ea,P.localeData=Ua,P.toIsoString=A("toIsoString() is deprecated. Please use toISOString() instead (notice the capitals)",qt),P.lang=Ra,k("X",0,0,"unix"),k("x",0,0,"valueOf"),v("x",Yt),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=Ps,r.now=Cs,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=Ht,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})});var wt=n=>{let r;try{r=JSON.parse(n)}catch{}return 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 Pr(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 Cr(n){Y(1,arguments);var r=xt(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()-Cr(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=vt(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=vt(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=xt(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=Pr(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 bt(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:bt({formats:uu,defaultWidth:"full"}),time:bt({formats:du,defaultWidth:"full"}),dateTime:bt({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},Pu={any:[/1/i,/2/i,/3/i,/4/i]},Cu={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:Pu,defaultParseWidth:"any",valueCallback:function(r){return r+1}}),month:Be({matchPatterns:Cu,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:{openNativeMenu:"Obsidian options",layout:"Layout",enterFlowState:"Enter Flow State",exitFlowState:"Exit Flow State",newView:"New View",calendarView:"Calendar View",dayView:"Day View",closeSpace:"Remove from 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",applyItems:"Apply to items in folder",rename:"Rename",changeToFolderNote:"Transform into Folder",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 ${1}",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:"Color",labels:"Labels",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:"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 Tag",cancel:"Cancel",search:"Search",delete:"Delete",toggleFlow:"Toggle Flow",openFlow:"Open Flow",hideFlow:"Hide Flow",openLink:"Open Link",addToSpace:"Pin file to...",addToSpaceShort:"Pin",addTag:"Add Tag",saveTemplate:"Make into template",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"},editStickerInSidebar:{name:"Edit Stickers in Sidebar",desc:"Edit stickers directly in the sidebar"},notesPreview:{name:"Notes Preview",desc:"Show a preview of notes, may cause performance issues"},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",kt={id:Ge,name:"Items",type:"db",primary:"true"};var xn={uniques:["name,schemaId"],cols:["name","schemaId","type","value","attrs","hidden","unique","primary"]},_t={...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 sh=[{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"}),oh={uniques:[],cols:["id","name","type","def","predicate","primary"],rows:[zu(qu),Gu]},Zt={uniques:[],cols:["id","name","type","def","predicate","primary"],rows:[kt]};var lh={schema:kt,cols:_t.rows,rows:[]},uh={schema:kt,cols:_t.rows,rows:[]},dh={schema:kt,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 ch={m_schema:Zt,m_fields:_t,...vn(_t.rows,Zt.rows)},fh={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(wt(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 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"?Cn(m,d,s):d.type=="frontmatter"?Pn(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"?Cn(o,u,s):u.type=="frontmatter"?Pn(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})},Pn=(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})},Cn=(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 Pe(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)||Pe(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 Pe(n)?n:n.split(".")}function Qr(n){return Pe(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(Pe(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(Pe(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 Pe(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 Tt({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 Tt({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=>!Pe(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];Pe(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 Ce=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 Tt))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(Pe(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}};Ce.version="7.0.0";Ce.createIndex=jn;Ce.parseIndex=pd;Ce.config=T;Ce.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 Ce([...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 Pd=self;Pd.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 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)}}run(t){let r=DE(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=DE(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 OE=class{constructor(t,r,n,i,a){this.indexVersion=t;this.onChange=r;this.kit=[Fv,E9,M9,D9,O9,ije,j9,mD,_Ee,lje,mje,pje,uje,fje,cje,dje,hje,Aje,yje,bje,oje,aje,k9,wh,vje,lR,C9,AO,gje,sje,xje];this.eventsDispatcher=new a0;let o={...FV,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=VB(o,{matrix:"Array"});l.import(cC,{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 cR(this.cli,this);this.cli.superstate=this,this.cli.terminals.splice(0,0,u),this.cli.mainTerminal=u,this.allMetadata={},this.api=new uR(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 fR(2,this),this.searcher=new dR(1,this)}static create(t,r,n,i,a){return new OE(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=N7(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=>rj(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 tj(this,r,{...d0,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=ir(i.cache);a&&a.type&&this.spacesIndex.set(i.path,a)}),n.forEach(i=>{let a=ir(i.cache);a&&this.contextsIndex.set(i.path,a)}),t.forEach(i=>{let a=v7(i.cache);a&&(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=>Hn(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&&!n1.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(!n1.default.isEqual(t.metadata?.filters,r?.filters)||s)for(let[l,u]of this.pathsIndex)!u.hidden&&T7(t.metadata?.filters,u,t.properties)&&i.push(l)}let o=[...n1.default.difference(i,[...n]),...n1.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=DJ(t),i=h0(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(()=>$oe(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:Kg})}async onTagDeleted(t){this.tagsMap.getInverse(t).forEach(i=>{this.deleteTagInPath(t,i)});let r=TM(t,this.settings);await this.spaceManager.deletePath(r),this.onSpaceDeleted(Hn(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(()=>qoe(this.spaceManager,t,n)),this.dispatchEvent("spaceStateUpdated",{path:Kg})}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!=Hn(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(()=>QU(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 Hoe(this.spaceManager,t,n,u.map(f=>f.space));for(let f of u)f.metadata?.links?.includes(t)&&this.addToContextStateQueue(()=>pC(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(()=>Uoe(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=Tu(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(()=>Voe(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(()=>Woe(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]:ca(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?xJ([...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";(!n1.default.isEqual(n.metadata.links,r.links)||!n1.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,T1).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"?tr(b.value):[])),m=kr((i.filters??[]).flatMap(b=>b.filters).flatMap(b=>b.type.startsWith("link")?tr(b.value):[]));if(s=="tag"&&this.settings.autoAddContextsToSubtags){let b=tee(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=>{oee(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)),!n1.default.isEqual(r.spaces,Array.from(this.spacesMap.get(t)))){this.spacesMap.set(t,new Set(r.spaces));let a=r.tags.map(s=>h0(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:Kg})})}if(i){let a=r.spaces.map(o=>this.spacesIndex.get(o)?.space).filter(o=>o);this.addToContextStateQueue(()=>QU(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,nje(r),"path")}};var wje=.999,pR=class extends Su.Plugin{constructor(){super(...arguments);this.debouncedRefresh=()=>null;this.openPath=async(r,n,i)=>{let a=this.superstate.spaceManager.uriByString(n);if(!!a){if(a.scheme=="https"||a.scheme=="http"){if(this.superstate.spacesIndex.has(n)){let o=bu;this.app.workspace.setActiveLeaf(r,{focus:!0}),await r.setViewState({type:o,state:{path:n,flow:i}});return}else if(this.superstate.pathsIndex.has(n)){let o=Db;this.app.workspace.setActiveLeaf(r,{focus:!0}),await r.setViewState({type:o,state:{path:n,flow:i}});return}window.open(a.fullPath,"_blank");return}if(a.scheme=="obsidian"){await r.setViewState({type:a.authority});return}if(a.ref&&(this.superstate.pathsIndex.get(a.path)?.type=="space"||a.scheme=="spaces")){i&&a.ref=="main"?await r.setViewState({type:Cb,state:{path:a.fullPath}}):await r.setViewState({type:B7,state:{path:a.fullPath,flow:i}});return}if(a.scheme=="spaces"){_De(r,a.basePath,this.app);return}this.files.getFile(n).then(o=>{if(o)if(o.isFolder)FDe(r,ia(this.app,o.path),this,i);else if(o)TDe(r,ia(this.app,o.path),this.app);else return;else if(n.contains("/")){let s=Vl(Tu(n)),l=this.superstate.spacesIndex.get(s);l&&Ji(this.superstate,l,oX(n),sX(n))}else uv(this.superstate,this.superstate.pathsIndex.get(this.superstate.ui.activePath)).then(s=>{s&&Ji(this.superstate,s,oX(n),sX(n))})})}};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 sE&&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 sE&&n.view.destroy(),n.detach()};this.detachFileContextLeafs=()=>{let r=this.app.workspace.getLeavesOfType(Ob);for(let n of r)n.view instanceof ZD&&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(Ob)}}quickOpen(r,n,i,a){let o=Ne(this.app.workspace.getLeaf()?.containerEl.ownerDocument);tMe(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),wje>this.superstate.settings.releaseNotesPrompt&&(this.releaseTheNotes(),this.superstate.settings.releaseNotesPrompt=wje,this.saveSettings()),this.superstate.settings.firstLaunch||(this.getStarted(),this.superstate.settings.firstLaunch=!0,this.saveSettings())})}loadViews(){this.registerView(zh,r=>new i7(r,this.superstate,this.ui)),this.registerView(qf,r=>new sE(r,this.superstate,this.ui)),this.registerView(bu,r=>new kb(r,this.superstate,this.ui,bu)),this.registerView(B7,r=>new I7(r,this)),this.registerView(Cb,r=>new J8(r,this)),this.superstate.settings.contextEnabled&&(this.registerView(Db,r=>new n7(r,this.app,Db,this.superstate)),this.registerView(Ob,r=>new ZD(r,this.superstate,this.ui)),this.registerView(o7,r=>new a7(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&&GDe(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&&NM(this.superstate,n.file.path,!0)}else this.superstate.ui.notify(W.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(kb)?.leaf);let a=i?.view;return!a||i.isFlowBlock||(a.getViewType()==bu?(tO(this),n=a.getState(),r=a.getState().path):a.getViewType()=="markdown"&&(r=a.file.path,n=a.getState(),YDe(this),tO(this)),!r||!n)?null:{path:r,state:n}}fixFileWarnings(){_X(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(){cX("https://www.make.md/static/latest.md",this.app,!0)}getStarted(){cX("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&&IX(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:()=>{D7(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:()=>{_X(this)}}),this.addCommand({id:"move-space-folder",name:"Move Space Data Folder",callback:()=>{let r=Ne(this.app.workspace.getLeaf()?.containerEl.ownerDocument);Oxe(this.superstate,"Move Space Data Folder",this.superstate.settings.spaceSubFolder,n=>{uMe(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:()=>{IX(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)&&aO(this,this.superstate,r,r).then(n=>{this.superstate.spaceManager.createItemAtPath("/","mkit","kit",JSON.stringify(n))})}}),this.addCommand({id:"mk-collapse-folders",name:W.commandPalette.collapseAllFolders,callback:()=>{this.superstate.settings.expandedSpaces=[],this.saveSettings()}}),this.addCommand({id:"mk-release-notes",name:W.commandPalette.releaseNotes,callback:()=>{this.releaseTheNotes()}}),this.addCommand({id:"mk-get-started",name:W.commandPalette.getStarted,callback:()=>{this.getStarted()}}),this.addCommand({id:"mk-reveal-file",name:W.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:W.commandPalette.openSpaces,callback:()=>this.openFileTreeLeaf(!0)})),this.superstate.settings.enableFolderNote&&this.addCommand({id:"mk-convert-folder-note",name:W.commandPalette.convertPathToSpace,callback:()=>this.convertPathToSpace()}),this.superstate.settings.contextEnabled&&this.addCommand({id:"mk-open-file-context",name:W.commandPalette.openFileContext,callback:()=>this.openFileContextLeaf(Ob,!0)}),this.superstate.settings.inlineBacklinks&&this.addCommand({id:"mk-toggle-backlinks",name:W.commandPalette.toggleBacklinks,callback:()=>{let r=new CustomEvent(im.toggleBacklinks);window.dispatchEvent(r)}}),this.superstate.settings.blinkEnabled&&this.addCommand({id:"mk-blink",name:W.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"],o7),this.app.workspace.onLayoutReady(async()=>{this.superstate.settings.autoOpenFileContext&&await this.openFileContextLeaf(Ob),setTimeout(()=>this.activeFileChange(),2e3)}),this.superstate.settings.inlineContext&&(this.registerMarkdownPostProcessor((r,n)=>{zDe(this,r,n)}),document.body.classList.toggle("mk-inline-context-enabled",this.superstate.settings.inlineContext)))}openEverView(){let r=this.app.workspace.getLeavesOfType(zh);if(r.length==0){let n=this.app.workspace.createLeafBySplit(this.app.workspace.getLeaf(),"vertical",!0);n.setViewState({type:zh}),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:zh}),i.setPinned(!0)});QDe(this)}async onload(){let r=Date.now(),n=Object.assign({},oE,await this.loadData());this.mdbFileAdapter=new A7(this),this.files=F1.create(),this.obsidianAdapter=new b7(this,this.files,(0,Su.normalizePath)(this.app.vault.configDir+"/plugins/make-md/Spaces.mdb")),this.files.initiateFileSystemAdapter(this.obsidianAdapter,!0),this.markdownAdapter=new S7(this),this.files.initiateFiletypeAdapter(this.mdbFileAdapter),this.files.initiateFiletypeAdapter(this.markdownAdapter),this.files.initiateFiletypeAdapter(new w7(this)),this.files.initiateFiletypeAdapter(new _7(this)),this.files.initiateFiletypeAdapter(new F7(this)),this.files.initiateFiletypeAdapter(new M7(this));let i=new bC(this.files,n.spaceSubFolder),a=new sR;this.ui=new O7(this);let o=Uy.create(this.ui),s=xE.create(new j7(this));this.superstate=OE.create("0.9",()=>{this.debouncedRefresh()},new sk,o,s),await this.loadSettings(),this.superstate.settings.experimental&&this.files.initiateFiletypeAdapter(new e7(this)),this.superstate.spaceManager.addSpaceAdapter(i,!0),this.superstate.spaceManager.addSpaceAdapter(a),(0,Su.addIcon)("mk-logo",HDe),this.superstate.saveSettings=()=>this.saveSettings(),this.loadViews();let l;Su.Platform.isMobile?l=new mE(".makemd/superstate.mdc",this.mdbFileAdapter,["path","space","frame","context","icon"]):l=new pE(".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 Z8(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 hO(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({},oE,await this.loadData()),this.superstate.settings.hiddenExtensions.length==1&&this.superstate.settings.hiddenExtensions[0]==".mdb"&&(this.superstate.settings.hiddenExtensions=oE.hiddenExtensions);let r=ir(await jDe(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 0d65d06..5df819f 100755 --- a/manifest.json +++ b/manifest.json @@ -1,7 +1,7 @@ { "id": "make-md", "name": "MAKE.md", - "version": "1.0.3", + "version": "1.0.4", "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 8d249db..19f9ba9 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "make-md", - "version": "1.0.2", + "version": "1.0.4", "description": "make.md", "main": "main.js", "scripts": { diff --git a/src/adapters/obsidian/ui/WindowManager.tsx b/src/adapters/obsidian/ui/WindowManager.tsx index d428bdf..6df3424 100644 --- a/src/adapters/obsidian/ui/WindowManager.tsx +++ b/src/adapters/obsidian/ui/WindowManager.tsx @@ -4,7 +4,7 @@ import { MeasuringStrategy, MouseSensor, TouchSensor, - rectIntersection, + pointerWithin, useSensor, useSensors, } from "@dnd-kit/core"; @@ -54,7 +54,7 @@ export const WindowManager = (props: { ui: ObsidianUI }) => { onDragCancel={() => { setDragActive(false); }} - collisionDetection={rectIntersection} + collisionDetection={pointerWithin} measuring={{ droppable: { strategy: MeasuringStrategy.Always, diff --git a/src/core/react/components/SpaceView/Frames/EditorNodes/FlowNodeView.tsx b/src/core/react/components/SpaceView/Frames/EditorNodes/FlowNodeView.tsx index 329f9ab..1326de9 100644 --- a/src/core/react/components/SpaceView/Frames/EditorNodes/FlowNodeView.tsx +++ b/src/core/react/components/SpaceView/Frames/EditorNodes/FlowNodeView.tsx @@ -124,35 +124,37 @@ export const FlowNodeView = ( ) : ( <> ))} - {props.state && expanded && props.state?.props?.value?.length > 0 ? ( - - ) : ( - selectionMode > FrameEditorMode.Read && ( -
{ - const rect = e.currentTarget.getBoundingClientRect(); - props.superstate.ui.quickOpen( - BlinkMode.Open, - rect, - windowFromDocument(e.view.document), - (path) => { - updateValue(path); - } - ); - }} - > - {i18n.hintText.selectNote} -
- ) - )} + {props.state && + expanded && + (props.state?.props?.value?.length > 0 ? ( + + ) : ( + selectionMode > FrameEditorMode.Read && ( +
{ + const rect = e.currentTarget.getBoundingClientRect(); + props.superstate.ui.quickOpen( + BlinkMode.Open, + rect, + windowFromDocument(e.view.document), + (path) => { + updateValue(path); + } + ); + }} + > + {i18n.hintText.selectNote} +
+ ) + ))} ); }; diff --git a/src/core/react/components/SpaceView/Frames/EditorNodes/FrameEditorNodeView.tsx b/src/core/react/components/SpaceView/Frames/EditorNodes/FrameEditorNodeView.tsx index d7b54ae..f800493 100644 --- a/src/core/react/components/SpaceView/Frames/EditorNodes/FrameEditorNodeView.tsx +++ b/src/core/react/components/SpaceView/Frames/EditorNodes/FrameEditorNodeView.tsx @@ -574,7 +574,8 @@ export const FrameEditorNodeView = (props: { insertMode={ treeNode.node.type == "group" ? 1 - : treeNode.node.type == "space" + : treeNode.node.type == "space" || + treeNode.node.type == "container" ? -1 : 0 } diff --git a/src/core/superstate/superstate.ts b/src/core/superstate/superstate.ts index 3dbb3df..5e17293 100644 --- a/src/core/superstate/superstate.ts +++ b/src/core/superstate/superstate.ts @@ -389,11 +389,12 @@ public api: API; allPaths.forEach(f => { const cache = parsePathState(f.cache) - + if (cache) { this.pathsIndex.set(f.path, cache); this.tagsMap.set(f.path, new Set(cache.tags)) this.spacesMap.set(f.path, new Set(cache.spaces)) this.linksMap.set(f.path, new Set(cache.outlinks)) + } }); if (this.settings.enhancedLogs) console.log('Initial Cache Loaded')